From d64fe765a9c45e4bd61530282501da5e5979c501 Mon Sep 17 00:00:00 2001 From: NDZHER <156980843+LexaFrontDev@users.noreply.github.com> Date: Sun, 14 Sep 2025 20:33:37 +0500 Subject: [PATCH] refactor: update Readme --- README.md | 86 +- README.ru.md | 83 + public/react/App.js | 19 - .../Component/HabitsPage/Pages/HabitsPage.js | 27 - .../HabitsPage/Pages/habits-modal.js | 534 - public/react/Component/HomePage/Pages/Home.js | 0 .../PomodrPage/chunk/HistoryChunk.js | 4 - .../Component/PomodrPage/page/PomodorPage.js | 127 - .../Component/Users/Pages/RegisterPage.js | 2 - public/react/Utils/HttpClient.js | 76 - public/react/Utils/httpReq.js | 35 - public/react/Utils/tokenSync.js | 59 - public/react/babel.min.js | 2 - public/react/react-dom.development.js | 29924 ---------------- public/react/react.development.js | 3343 -- 15 files changed, 161 insertions(+), 34160 deletions(-) create mode 100644 README.ru.md delete mode 100644 public/react/App.js delete mode 100644 public/react/Component/HabitsPage/Pages/HabitsPage.js delete mode 100644 public/react/Component/HabitsPage/Pages/habits-modal.js delete mode 100644 public/react/Component/HomePage/Pages/Home.js delete mode 100644 public/react/Component/PomodrPage/chunk/HistoryChunk.js delete mode 100644 public/react/Component/PomodrPage/page/PomodorPage.js delete mode 100644 public/react/Component/Users/Pages/RegisterPage.js delete mode 100644 public/react/Utils/HttpClient.js delete mode 100644 public/react/Utils/httpReq.js delete mode 100644 public/react/Utils/tokenSync.js delete mode 100644 public/react/babel.min.js delete mode 100644 public/react/react-dom.development.js delete mode 100644 public/react/react.development.js diff --git a/README.md b/README.md index e2518ed..0d6e3f0 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,85 @@ -HabitAi is an application designed to help people boost their productivity using AI (artificial intelligence). +# 🚀 HabitAi -Currently under active development. The tech stack includes Flutter, React, Vue, Symfony, PHP 8.3, and the architecture follows Clean Architecture principles, Domain-Driven Design (DDD), and Atomic Design. +**HabitAi** is an application designed to boost productivity with the help of Artificial Intelligence (AI). -New frontend improvements: +Project is currently under **active development**. -Implemented Cache-Then-Network (CTN) system for optimized data fetching and faster response times. +[🇷🇺 Читать на русском](README.ru.md) -Integrated IndexedDB (IDB) for persistent client-side caching, allowing offline access and reducing server load. +--- -The data layer architecture has been updated to support centralized caching and efficient state management. +## 🛠️ Tech Stack -Features such as task management, Eisenhower matrix, Pomodoro timer, and multilingual support for 5 languages are already implemented but still being refined. +* **Frontend:** Flutter, React, Vue +* **Backend:** Symfony (PHP 8.3) +* **Architecture:** Clean Architecture, Domain-Driven Design (DDD), Atomic Design + +## ✨ Features + +* 📌 **Task Management** +* 🧭 **Eisenhower Matrix** for prioritization +* ⏳ **Pomodoro Timer** for focused work +* 🌍 **Multilingual Support** (5 languages) +* ⚡ **Frontend improvements**: + + * **Cache-Then-Network (CTN)** system for optimized data fetching + * **IndexedDB (IDB)** integration for offline access and reduced server load + * Centralized caching and efficient state management + +--- + +## 📦 Installation & Usage + +### 1. Clone the repository + +```bash +git clone https://github.com/LexaFrontDev/HabitAi.git +cd HabitAi +composer install +npm install +``` + +### 2. Start Docker containers + +```bash +make up-docker-build +``` + +### 3. Enter PHP container + +```bash +make sh +``` + +### 4. Run migrations + +```bash +php bin/console doctrine:migrations:migrate -n +``` + +### 5. Load fixtures + +```bash +php bin/console doctrine:fixtures:load +exit +``` + +### 6. Start frontend + +```bash +npm run +``` + +### 7. Stop and remove containers + +```bash +make down +``` + +--- + +## 📌 Project Status + +🔧 Under active development. +Stay tuned for updates and new releases! -Stay tuned for updates! diff --git a/README.ru.md b/README.ru.md new file mode 100644 index 0000000..bcac0ef --- /dev/null +++ b/README.ru.md @@ -0,0 +1,83 @@ +# 🚀 HabitAi + +**HabitAi** — это приложение, созданное для повышения продуктивности людей с помощью искусственного интеллекта (AI). + +Проект находится в **активной разработке**. + +[🇬🇧 Read in English](README.md) + +## 🛠️ Технологический стек + +* **Frontend:** Flutter, React, Vue +* **Backend:** Symfony (PHP 8.3) +* **Архитектура:** Clean Architecture, Domain-Driven Design (DDD), Atomic Design + +## ✨ Основные возможности + +* 📌 **Управление задачами** (Task Management) +* 🧭 **Матрица Эйзенхауэра** для приоритизации задач +* ⏳ **Pomodoro-таймер** для фокусированной работы +* 🌍 **Мультиязычность** (поддержка 5 языков) +* ⚡ **Новые улучшения фронтенда:** + + * Реализована система **Cache-Then-Network (CTN)** для быстрой загрузки данных + * Интеграция **IndexedDB (IDB)** для офлайн-доступа и снижения нагрузки на сервер + * Централизованное кэширование и оптимизированное управление состоянием + +--- + +## 📦 Установка и запуск + +### 1. Клонирование репозитория + +```bash +git clone https://github.com/LexaFrontDev/HabitAi.git +cd HabitAi +composer install +npm install +``` + +### 2. Поднятие Docker-контейнеров + +```bash +make up-docker-build +``` + +### 3. Подключение к PHP-контейнеру + +```bash +make sh +``` + +### 4. Запуск миграций + +```bash +php bin/console doctrine:migrations:migrate -n +``` + +### 5. Загрузка фикстур + +```bash +php bin/console doctrine:fixtures:load +exit +``` + +### 6. Запуск фронтенда + +```bash +npm run +``` + +### 7. Остановка и удаление контейнеров + +```bash +make down +``` + +--- + +## 📌 Статус проекта + +🔧 В активной разработке. +Следите за обновлениями и новыми релизами! + diff --git a/public/react/App.js b/public/react/App.js deleted file mode 100644 index cf76209..0000000 --- a/public/react/App.js +++ /dev/null @@ -1,19 +0,0 @@ -const { createRoot } = ReactDOM; -const { BrowserRouter, Routes, Route } = ReactRouterDOM; - -const Profile = () => React.createElement('h1', null, 'Профиль'); - -const App = () => { - return React.createElement( - BrowserRouter, - null, - React.createElement( - Routes, - null, - React.createElement(Route, { path: "/profile", element: React.createElement(Profile) }) - ) - ); -}; - -const root = createRoot(document.getElementById("react-root")); -root.render(React.createElement(App)); diff --git a/public/react/Component/HabitsPage/Pages/HabitsPage.js b/public/react/Component/HabitsPage/Pages/HabitsPage.js deleted file mode 100644 index a805110..0000000 --- a/public/react/Component/HabitsPage/Pages/HabitsPage.js +++ /dev/null @@ -1,27 +0,0 @@ - -document.addEventListener('DOMContentLoaded', () => { - - const groups = document.querySelectorAll('.habits-group'); - groups.forEach(group => { - const items = group.querySelector('.habits-items'); - if (!items || !items.querySelector('li:not(:contains("Нет привычек."))')) { - group.style.display = 'none'; - } - }); - - document.querySelectorAll('.toggle-header').forEach(header => { - header.addEventListener('click', () => { - const targetId = header.getAttribute('data-target'); - const list = document.getElementById(targetId); - const icon = header.querySelector('.toggle-icon'); - - if (list.style.display === 'none') { - list.style.display = 'block'; - icon.textContent = '▼'; - } else { - list.style.display = 'none'; - icon.textContent = '▶'; - } - }); - }); -}); diff --git a/public/react/Component/HabitsPage/Pages/habits-modal.js b/public/react/Component/HabitsPage/Pages/habits-modal.js deleted file mode 100644 index 5ae2219..0000000 --- a/public/react/Component/HabitsPage/Pages/habits-modal.js +++ /dev/null @@ -1,534 +0,0 @@ -(function() { - const btn = document.getElementById('addHabitButton'); - if (!btn) return; - const habitTemplates = [ - { - title: "Ранний подъем", - quote: "Кто рано встает, тому Бог дает!", - icon: "⏰" - }, - { - title: "Утренняя пробежка", - quote: "Бег - это жизнь!", - icon: "🏃" - }, - { - title: "Чтение книги", - quote: "Книги - корабли мысли", - icon: "📚" - }, - { - title: "Медитация", - quote: "Тишина - великий учитель", - icon: "🧘" - } - ]; - - let step = 1; - const data = { - titleHabit: '', - iconBase64: '', - quote: '', - goalInDays: '30', - datesType: 'daily', - date: { - mon: false, - tue: false, - wed: false, - thu: false, - fri: false, - sat: false, - sun: false - }, - beginDate: Math.floor(Date.now() / 1000), - notificationDate: '', - purposeType: 'count', - purposeCount: 1, - checkManually: false, - checkAuto: false, - checkClose: false, - autoCount: 0 // New field for automatic count - }; - - const container = document.getElementById('habit-modal'); - let modal; - - const templates = { - 1: (data) => ` - `, - 2: (data) => ` - `, - 3: (data) => ` - ` - }; - - function renderFrequencyOptions(type, data) { - if (type === 'daily') { - const daysList = ['Пн','Вт','Ср','Чт','Пт','Сб','Вс']; - const daysMap = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']; - return ` -
-
Выберите дни недели:
-
- ${daysList.map((d, i) => - `
${d}
` - ).join('')} -
-
`; - } else if (type === 'weekly') { - return ` -
-
Сколько дней в неделю?
- -
`; - } else { - return ` -
-
Выберите дату месяца:
- -
`; - } - } - - const handlers = { - 1() { - modal.querySelectorAll('.habit-template').forEach(template => { - template.addEventListener('click', function() { - const title = this.getAttribute('data-title'); - const quote = this.getAttribute('data-quote'); - const icon = this.getAttribute('data-icon'); - - data.titleHabit = title; - data.quote = quote; - data.iconBase64 = icon; - - modal.querySelectorAll('.habit-template').forEach(t => t.classList.remove('active')); - this.classList.add('active'); - - step = 2; - renderStep(); - }); - }); - }, - 2() { - modal.querySelector('#habit-icon')?.addEventListener('change', function(e) { - const file = e.target.files[0]; - if (file) { - const reader = new FileReader(); - reader.onload = function(event) { - data.iconBase64 = event.target.result; - modal.querySelector('.icon-preview').innerHTML = `Icon`; - }; - reader.readAsDataURL(file); - } - }); - - modal.querySelector('#habit-title')?.addEventListener('input', e => { - data.titleHabit = e.target.value; - }); - - modal.querySelector('#habit-quote')?.addEventListener('input', e => { - data.quote = e.target.value; - }); - }, - 3() { - // Обработчики для переключения настроек - modal.querySelectorAll('.setting-toggle').forEach(toggle => { - toggle.addEventListener('click', function() { - const content = this.nextElementSibling; - content.classList.toggle('inactive'); - content.classList.toggle('active'); - }); - }); - - // Обработчики для выбора типа цели - modal.querySelectorAll('input[name="goal-type"]').forEach(radio => { - radio.addEventListener('change', e => { - const goalType = e.target.value; - data.checkClose = (goalType === 'complete'); - modal.querySelector('.specific-goal').classList.toggle('active', goalType === 'specific'); - - // Сбрасываем другие флаги при выборе "Достигните всего этого" - if (goalType === 'complete') { - data.checkAuto = false; - data.checkManually = false; - } - }); - }); - - // Обработчик для выбора метода проверки - modal.querySelector('#verification-type')?.addEventListener('change', e => { - const method = e.target.value; - data.checkAuto = (method === 'auto'); - data.checkManually = (method === 'manual'); - data.checkClose = (method === 'complete'); - - // Показываем/скрываем поле для автоматического количества - const autoCountContainer = modal.querySelector('#auto-count-container'); - if (autoCountContainer) { - autoCountContainer.style.display = method === 'auto' ? 'block' : 'none'; - } - }); - - // Обработчик для поля автоматического количества - modal.querySelector('#auto-count')?.addEventListener('input', e => { - data.autoCount = parseInt(e.target.value) || 0; - }); - - // Обработчики для полей специфической цели - modal.querySelector('#daily-goal')?.addEventListener('input', e => { - data.purposeCount = parseInt(e.target.value) || 0; - }); - - modal.querySelector('#goal-unit')?.addEventListener('change', e => { - data.purposeType = e.target.value; - }); - - modal.querySelectorAll('.chose-data-block .option')?.forEach(option => { - option.addEventListener('click', e => { - modal.querySelectorAll('.option')?.forEach(o => o.classList.remove('active')); - e.currentTarget.classList.add('active'); - - const type = e.currentTarget.classList.contains('daily') ? 'daily' - : e.currentTarget.classList.contains('weekly') ? 'weekly' : 'repeat'; - - data.datesType = type; - modal.querySelector('.date-type').innerHTML = renderFrequencyOptions(type, data); - attachDayHandlers(); - }); - }); - - attachDayHandlers(); - - modal.querySelector('#start-date')?.addEventListener('change', e => { - data.beginDate = Math.floor(new Date(e.target.value).getTime() / 1000); - }); - - modal.querySelector('#duration')?.addEventListener('input', e => { - data.goalInDays = e.target.value; - }); - - modal.querySelector('#reminder')?.addEventListener('change', e => { - data.notificationDate = e.target.value; - }); - } - }; - - function attachDayHandlers() { - modal.querySelectorAll('.day-item')?.forEach(el => { - el.addEventListener('click', e => { - e.currentTarget.classList.toggle('active-day'); - const day = e.currentTarget.getAttribute('data-day'); - data.date[day] = e.currentTarget.classList.contains('active-day'); - }); - }); - } - - function createModal() { - if (modal) return; - modal = document.createElement('div'); - modal.className = 'modal'; - container.appendChild(modal); - renderStep(); - } - - function closeModal() { - if (modal && container.contains(modal)) { - container.removeChild(modal); - modal = null; - } - } - - function renderStep() { - if (!modal) return; - modal.innerHTML = templates[step]?.(data) || ''; - attachHandlers(); - handlers[step]?.(); - } - - function attachHandlers() { - modal.querySelector('#next')?.addEventListener('click', () => { - if (validateStep(step)) { - step++; - renderStep(); - } - }); - - modal.querySelector('#prev')?.addEventListener('click', () => { - step--; - renderStep(); - }); - - modal.querySelector('#cancel')?.addEventListener('click', closeModal); - modal.querySelector('#save')?.addEventListener('click', saveData); - } - - function validateStep(step) { - if (step === 1) { - return true; - } else if (step === 2) { - if (!data.titleHabit.trim()) { - showError('Введите название привычки'); - return false; - } - } else if (step === 3) { - if (data.datesType === 'daily' && !Object.values(data.date).some(v => v)) { - showError('Выберите хотя бы один день'); - return false; - } - - if (!data.checkClose && data.purposeCount <= 0) { - showError('Введите корректное значение цели'); - return false; - } - - if (data.checkAuto && data.autoCount <= 0) { - showError('Введите корректное значение автоматического количества'); - return false; - } - - if (!data.goalInDays || parseInt(data.goalInDays) <= 0) { - showError('Укажите корректную длительность'); - return false; - } - } - return true; - } - - function saveData() { - if (!validateStep(step)) return; - - const payload = { - titleHabit: data.titleHabit, - iconBase64: data.iconBase64, - quote: data.quote, - goalInDays: data.goalInDays, - datesType: data.datesType, - date: prepareDateField(), - beginDate: data.beginDate, - notificationDate: data.notificationDate, - purposeType: data.purposeType, - purposeCount: data.purposeCount, - checkManually: data.checkManually, - checkAuto: data.checkAuto, - checkClose: data.checkClose, - autoCount: data.autoCount // Добавляем autoCount в отправляемые данные - }; - - const loader = document.createElement('div'); - loader.className = 'loader'; - loader.innerHTML = `Загрузка...`; - modal.appendChild(loader); - - console.log(payload); - - fetch('http://taskflow/api/habits/save', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify(payload), - }) - .then(response => response.json()) - .then(result => { - loader.remove(); - if (result.success) { - alert('Привычка сохранена!'); - closeModal(); - } else { - showError(result.message || 'Ошибка сохранения данных!'); - } - }) - .catch(error => { - loader.remove(); - console.error(error); - showError('Произошла ошибка! Попробуйте позже.'); - }); - } - - function prepareDateField() { - if (data.datesType === 'daily') { - return { - mon: data.date.mon, - tue: data.date.tue, - wed: data.date.wed, - thu: data.date.thu, - fri: data.date.fri, - sat: data.date.sat, - sun: data.date.sun - }; - } else if (data.datesType === 'weekly') { - return { - count: parseInt(modal.querySelector('#weekly-count').value) || 1 - }; - } else { - return { - day: parseInt(modal.querySelector('#repeat-day').value) || 1 - }; - } - } - - function showError(message) { - let errorDiv = modal.querySelector('.error-message'); - if (!errorDiv) { - errorDiv = document.createElement('div'); - errorDiv.className = 'error-message'; - errorDiv.style.color = '#ff3d3d'; - errorDiv.style.margin = '10px'; - errorDiv.style.textAlign = 'center'; - errorDiv.style.fontWeight = 'bold'; - modal.appendChild(errorDiv); - } - errorDiv.textContent = message; - } - - btn.addEventListener('click', e => { - e.preventDefault(); - step = 1; - data.titleHabit = ''; - data.quote = ''; - data.iconBase64 = ''; - data.date = { - mon: false, - tue: false, - wed: false, - thu: false, - fri: false, - sat: false, - sun: false - }; - data.datesType = 'daily'; - data.beginDate = Math.floor(Date.now() / 1000); - data.notificationDate = '08:30'; - data.purposeType = 'count'; - data.purposeCount = 1; - data.checkManually = false; - data.checkAuto = false; - data.checkClose = false; - data.goalInDays = '30'; - data.autoCount = 0; // Сбрасываем autoCount - - createModal(); - }); -})(); \ No newline at end of file diff --git a/public/react/Component/HomePage/Pages/Home.js b/public/react/Component/HomePage/Pages/Home.js deleted file mode 100644 index e69de29..0000000 diff --git a/public/react/Component/PomodrPage/chunk/HistoryChunk.js b/public/react/Component/PomodrPage/chunk/HistoryChunk.js deleted file mode 100644 index c0eb61f..0000000 --- a/public/react/Component/PomodrPage/chunk/HistoryChunk.js +++ /dev/null @@ -1,4 +0,0 @@ -(function() { - - -})(); \ No newline at end of file diff --git a/public/react/Component/PomodrPage/page/PomodorPage.js b/public/react/Component/PomodrPage/page/PomodorPage.js deleted file mode 100644 index d54944b..0000000 --- a/public/react/Component/PomodrPage/page/PomodorPage.js +++ /dev/null @@ -1,127 +0,0 @@ -(function() { - let userId = null; - - let totalTime = parseInt(localStorage.getItem('pomodoroTotalTime')) || 0; - let timeLeft = parseInt(localStorage.getItem('pomodoroTimeLeft')) || 0; - let isRunning = false; - let startTime = localStorage.getItem('pomodoroStartTime') || null; - - const circumference = 2 * Math.PI * 16; - - const timerText = document.getElementById('timer-text'); - const startBtn = document.getElementById('start-btn'); - const pomodoroWrapper = document.getElementById('Pomodoro-wrapper'); - const progressPath = document.getElementById('progress-path'); - const overlay = document.getElementById('modal-overlay'); - const minutesInputEl = document.getElementById('modal-minutes-input'); - const saveBtn = document.getElementById('modal-save-btn'); - const closeBtn = document.getElementById('modal-close-btn'); - - let intervalId; - - async function fetchUserId() { - const resp = await fetch('/api/web/user/id'); - const data = await resp.json(); - return userId = data?.userId ?? null; - } - - - function saveToLocal() { - localStorage.setItem('pomodoroTotalTime', totalTime); - localStorage.setItem('pomodoroTimeLeft', timeLeft); - } - - function formatTime(seconds) { - const mins = Math.floor(seconds / 60).toString().padStart(2, '0'); - const secs = (seconds % 60).toString().padStart(2, '0'); - return `${mins}:${secs}`; - } - - async function endFocus(finishTime) { - alert("Время вышло! 🕰️"); - - if (!userId) { - userId = await fetchUserId(); - } - - if (!userId) { - console.error("Не удалось получить userId!"); - return; - } - - console.log("Используем userId:", userId); - - await fetch("/api/pomodor/create", { - method: "POST", - headers: {"Content-Type": "application/json"}, - body: JSON.stringify({ - userId, - timeFocus: totalTime, - timeStart: Math.floor(new Date(startTime).getTime() / 1000), - timeEnd: Math.floor(finishTime.getTime() / 1000), - createdDate: Math.floor(new Date().getTime() / 1000), - }), - }).catch(error => console.error(error)); - } - - - - function updateDisplay() { - timerText.textContent = formatTime(timeLeft); - const offset = totalTime > 0 ? ((totalTime - timeLeft) / totalTime) * circumference : 0; - progressPath.setAttribute('stroke-dasharray', `${offset} ${circumference}`); - } - - function handleStartPause() { - if (!isRunning) { - if (!startTime) { - startTime = new Date(); - localStorage.setItem('pomodoroStartTime', startTime); - } - intervalId = setInterval(() => { - if (timeLeft > 0) { - timeLeft -= 1; - saveToLocal(); - updateDisplay(); - } else { - clearInterval(intervalId); - const finishTime = new Date(); - localStorage.removeItem('pomodoroTotalTime'); - localStorage.removeItem('pomodoroTimeLeft'); - localStorage.removeItem('pomodoroStartTime'); - endFocus(finishTime); - } - }, 1000); - } else { - clearInterval(intervalId); - } - isRunning = !isRunning; - startBtn.textContent = isRunning ? 'Пауза' : 'Старт'; - } - - function handleSetTime() { - const minutes = parseInt(minutesInputEl.value); - if (!minutes) return; - - totalTime = minutes * 60; - timeLeft = totalTime; - - saveToLocal(); - overlay.style.display = 'none'; - updateDisplay(); - } - - pomodoroWrapper.addEventListener('click', () => { - overlay.style.display = 'block'; - }); - saveBtn.addEventListener('click', handleSetTime); - closeBtn.addEventListener('click', () => { - overlay.style.display = 'none'; - }); - startBtn.addEventListener('click', handleStartPause); - - (async function init() { - await fetchUserId(); - updateDisplay(); - })(); -})(); diff --git a/public/react/Component/Users/Pages/RegisterPage.js b/public/react/Component/Users/Pages/RegisterPage.js deleted file mode 100644 index 2355910..0000000 --- a/public/react/Component/Users/Pages/RegisterPage.js +++ /dev/null @@ -1,2 +0,0 @@ -const root = ReactDOM.createRoot(document.getElementById("root")); -root.render(); \ No newline at end of file diff --git a/public/react/Utils/HttpClient.js b/public/react/Utils/HttpClient.js deleted file mode 100644 index b3f2231..0000000 --- a/public/react/Utils/HttpClient.js +++ /dev/null @@ -1,76 +0,0 @@ -class HttpClient { - constructor(baseURL = '') { - this.baseURL = baseURL; - this.accessToken = localStorage.getItem('access_token'); - this.refreshToken = localStorage.getItem('refresh_token'); - } - - setTokens({ access_token, refresh_token }) { - this.accessToken = access_token; - this.refreshToken = refresh_token; - localStorage.setItem('access_token', access_token); - localStorage.setItem('refresh_token', refresh_token); - } - - getHeaders() { - return { - 'Content-Type': 'application/json', - 'Authorization': `Bearer ${this.accessToken}`, - 'X-Refresh-Token': this.refreshToken - }; - } - - async refreshTokens() { - const res = await fetch(`${this.baseURL}/auth/refresh`, { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ refresh_token: this.refreshToken }) - }); - - if (!res.ok) throw new Error('Failed to refresh token'); - const data = await res.json(); - this.setTokens(data); - } - - async request(method, url, body = null, customHeaders = {}) { - let options = { - method, - headers: { ...this.getHeaders(), ...customHeaders } - }; - - if (body) options.body = JSON.stringify(body); - - let res = await fetch(this.baseURL + url, options); - - if (res.status === 401) { - try { - await this.refreshTokens(); - options.headers = { ...this.getHeaders(), ...customHeaders }; - res = await fetch(this.baseURL + url, options); - } catch (e) { - console.error("Не удалось обновить токен:", e); - throw e; - } - } - - return res; - } - - get(url, headers = {}) { - return this.request('GET', url, null, headers); - } - - post(url, body, headers = {}) { - return this.request('POST', url, body, headers); - } - - put(url, body, headers = {}) { - return this.request('PUT', url, body, headers); - } - - delete(url, body = null, headers = {}) { - return this.request('DELETE', url, body, headers); - } -} - -export const http = new HttpClient('/api'); diff --git a/public/react/Utils/httpReq.js b/public/react/Utils/httpReq.js deleted file mode 100644 index 13899db..0000000 --- a/public/react/Utils/httpReq.js +++ /dev/null @@ -1,35 +0,0 @@ -export async function httpRequest(url, { method = 'GET', body = null, headers = {} } = {}) { - const accessToken = localStorage.getItem('accessToken'); - - const config = { - method, - headers: { - 'Content-Type': 'application/json', - ...headers, - ...(accessToken ? { 'access-token': accessToken } : {}), - }, - }; - - if (body) { - config.body = JSON.stringify(body); - } - - try { - const response = await fetch(url, config); - if (!response.ok) { - const errorData = await response.json().catch(() => ({})); - const error = new Error(errorData.message || 'Ошибка запроса'); - error.status = response.status; - error.data = errorData; - throw error; - } - const contentType = response.headers.get('Content-Type') || ''; - if (contentType.includes('application/json')) { - return await response.json(); - } - - return await response.text(); - } catch (err) { - throw err; - } -} \ No newline at end of file diff --git a/public/react/Utils/tokenSync.js b/public/react/Utils/tokenSync.js deleted file mode 100644 index 76bbfe4..0000000 --- a/public/react/Utils/tokenSync.js +++ /dev/null @@ -1,59 +0,0 @@ -export const syncTokens = () => { - const getCookie = (name) => { - const value = `; ${document.cookie}`; - const parts = value.split(`; ${name}=`); - if (parts.length === 2) return parts.pop().split(';').shift(); - }; - - const setCookie = (name, value, days = 7) => { - const expires = new Date(Date.now() + days * 864e5).toUTCString(); - const isSecure = location.protocol === 'https:'; - document.cookie = `${name}=${value}; path=/; expires=${expires}; ${isSecure ? 'Secure;' : ''} SameSite=Strict`; - }; - - const setTokenEverywhere = (access, refresh) => { - if (access) { - localStorage.setItem('accessToken', access); - setCookie('accessToken', access); - } - if (refresh) { - localStorage.setItem('refreshToken', refresh); - setCookie('refreshToken', refresh); - } - }; - - const accessFromStorage = localStorage.getItem('accessToken'); - const refreshFromStorage = localStorage.getItem('refreshToken'); - const accessFromCookie = getCookie('accessToken'); - const refreshFromCookie = getCookie('refreshToken'); - - if (!accessFromStorage && accessFromCookie) { - localStorage.setItem('accessToken', accessFromCookie); - } else if (accessFromStorage && accessFromStorage !== accessFromCookie) { - setCookie('accessToken', accessFromStorage); - } - if (!refreshFromStorage && refreshFromCookie) { - localStorage.setItem('refreshToken', refreshFromCookie); - } else if (refreshFromStorage && refreshFromStorage !== refreshFromCookie) { - setCookie('refreshToken', refreshFromStorage); - } - - // Патчим fetch - const originalFetch = window.fetch; - window.fetch = async (url, options = {}) => { - const accessToken = localStorage.getItem('accessToken'); - const refreshToken = localStorage.getItem('refreshToken'); - options.headers = { - ...(options.headers || {}), - ...(accessToken ? { 'access-token': accessToken } : {}), - ...(refreshToken ? { 'refresh-token': refreshToken } : {}), - }; - const response = await originalFetch(url, options); - const newAccessToken = response.headers.get('access-token'); - const newRefreshToken = response.headers.get('refresh-token'); - if (newAccessToken || newRefreshToken) { - setTokenEverywhere(newAccessToken, newRefreshToken); - } - return response; - }; -}; diff --git a/public/react/babel.min.js b/public/react/babel.min.js deleted file mode 100644 index f6ad6dc..0000000 --- a/public/react/babel.min.js +++ /dev/null @@ -1,2 +0,0 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Babel={})}(this,(function(e){"use strict";var t=Object.freeze({__proto__:null,get _call(){return ED},get _getQueueContexts(){return VD},get _resyncKey(){return ND},get _resyncList(){return BD},get _resyncParent(){return OD},get _resyncRemoved(){return MD},get call(){return wD},get isDenylisted(){return SD},get popContext(){return FD},get pushContext(){return LD},get requeue(){return GD},get requeueComputedKeyAndDecorators(){return WD},get resync(){return DD},get setContext(){return ID},get setKey(){return qD},get setScope(){return _D},get setup(){return UD},get skip(){return AD},get skipKey(){return kD},get stop(){return CD},get visit(){return PD}}),r=Object.freeze({__proto__:null,get DEFAULT_EXTENSIONS(){return ZW},get File(){return jB},get buildExternalHelpers(){return XB},get createConfigItem(){return XG},get createConfigItemAsync(){return KG},get createConfigItemSync(){return zG},get getEnv(){return dM},get loadOptions(){return VG},get loadOptionsAsync(){return GG},get loadOptionsSync(){return WG},get loadPartialConfig(){return LG},get loadPartialConfigAsync(){return MG},get loadPartialConfigSync(){return FG},get parse(){return zW},get parseAsync(){return JW},get parseSync(){return XW},get resolvePlugin(){return $W},get resolvePreset(){return QW},get template(){return ej},get tokTypes(){return Kx},get transform(){return BW},get transformAsync(){return FW},get transformFile(){return LW},get transformFileAsync(){return qW},get transformFileSync(){return UW},get transformFromAst(){return WW},get transformFromAstAsync(){return HW},get transformFromAstSync(){return VW},get transformSync(){return MW},get traverse(){return JD},get types(){return Gm},get version(){return YW}});function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=Array(t);r=e.length?{done:!0}:{done:!1,value:e[a++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t)}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(l=function(){return!!e})()}function u(e,t){if(null==e)return{};var r={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(-1!==t.indexOf(a))continue;r[a]=e[a]}return r}function p(){p=function(){return t};var e,t={},r=Object.prototype,a=r.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},s="function"==typeof Symbol?Symbol:{},o=s.iterator||"@@iterator",i=s.asyncIterator||"@@asyncIterator",d=s.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function l(e,t,r,a){var s=t&&t.prototype instanceof b?t:b,o=Object.create(s.prototype),i=new _(a||[]);return n(o,"_invoke",{value:P(e,r,i)}),o}function u(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var f="suspendedStart",g="suspendedYield",y="executing",m="completed",h={};function b(){}function v(){}function x(){}var R={};c(R,o,(function(){return this}));var j=Object.getPrototypeOf,w=j&&j(j(I([])));w&&w!==r&&a.call(w,o)&&(R=w);var E=x.prototype=b.prototype=Object.create(R);function S(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function r(n,s,o,i){var d=u(e[n],e,s);if("throw"!==d.type){var c=d.arg,l=c.value;return l&&"object"==typeof l&&a.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,o,i)}),(function(e){r("throw",e,o,i)})):t.resolve(l).then((function(e){c.value=e,o(c)}),(function(e){return r("throw",e,o,i)}))}i(d.arg)}var s;n(this,"_invoke",{value:function(e,a){function n(){return new t((function(t,n){r(e,a,t,n)}))}return s=s?s.then(n,n):n()}})}function P(t,r,a){var n=f;return function(s,o){if(n===y)throw Error("Generator is already running");if(n===m){if("throw"===s)throw o;return{value:e,done:!0}}for(a.method=s,a.arg=o;;){var i=a.delegate;if(i){var d=A(i,a);if(d){if(d===h)continue;return d}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(n===f)throw n=m,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);n=y;var c=u(t,r,a);if("normal"===c.type){if(n=a.done?m:g,c.arg===h)continue;return{value:c.arg,done:a.done}}"throw"===c.type&&(n=m,a.method="throw",a.arg=c.arg)}}}function A(t,r){var a=r.method,n=t.iterator[a];if(n===e)return r.delegate=null,"throw"===a&&t.iterator.return&&(r.method="return",r.arg=e,A(t,r),"throw"===r.method)||"return"!==a&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+a+"' method")),h;var s=u(n,t.iterator,r.arg);if("throw"===s.type)return r.method="throw",r.arg=s.arg,r.delegate=null,h;var o=s.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,h):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,h)}function k(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function I(t){if(t||""===t){var r=t[o];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,s=function r(){for(;++n=0;--s){var o=this.tryEntries[s],i=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var d=a.call(o,"catchLoc"),c=a.call(o,"finallyLoc");if(d&&c){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var a=r.completion;if("throw"===a.type){var n=a.arg;C(r)}return n}}throw Error("illegal catch attempt")},delegateYield:function(t,r,a){return this.delegate={iterator:I(t),resultName:r,nextLoc:a},"next"===this.method&&(this.arg=e),h}},t}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a,n,s,o,i=[],d=!0,c=!1;try{if(s=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;d=!1}else for(;!(d=(a=s.call(r)).done)&&(i.push(a.value),i.length!==t);d=!0);}catch(e){c=!0,n=e}finally{try{if(!d&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw n}}return i}}(e,t)||b(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){return t||(t=e.slice(0)),e.raw=t,e}function m(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||b(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.call(e,t);if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}function b(e,t){if(e){if("string"==typeof e)return a(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(e,t):void 0}}function v(e){var t="function"==typeof Map?new Map:void 0;return v=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return function(e,t,r){if(l())return Reflect.construct.apply(null,arguments);var a=[null];a.push.apply(a,t);var n=new(e.bind.apply(e,a));return r&&f(n,r.prototype),n}(e,arguments,d(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),f(r,e)},v(e)}var x="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function R(){throw new Error("setTimeout has not been defined")}function j(){throw new Error("clearTimeout has not been defined")}var w=R,E=j;function S(e){if(w===setTimeout)return setTimeout(e,0);if((w===R||!w)&&setTimeout)return w=setTimeout,setTimeout(e,0);try{return w(e,0)}catch(t){try{return w.call(null,e,0)}catch(t){return w.call(this,e,0)}}}"function"==typeof x.setTimeout&&(w=setTimeout),"function"==typeof x.clearTimeout&&(E=clearTimeout);var T,P=[],A=!1,k=-1;function C(){A&&T&&(A=!1,T.length?P=T.concat(P):k=-1,P.length&&_())}function _(){if(!A){var e=S(C);A=!0;for(var t=P.length;t;){for(T=P,P=[];++k1)for(var r=1;rn.length)return!1;for(var o=0,i=s.length-1;oe)return!1;if((r+=t[a+1])>=e)return!0}return!1}function Mr(e){return e<65?36===e:e<=90||(e<97?95===e:e<=122||(e<=65535?e>=170&&Ir.test(String.fromCharCode(e)):Br(e,Or)))}function Fr(e){return e<48?36===e:e<58||!(e<65)&&(e<=90||(e<97?95===e:e<=122||(e<=65535?e>=170&&Dr.test(String.fromCharCode(e)):Br(e,Or)||Br(e,Nr))))}function Lr(e){for(var t=!0,r=0;r=48&&e<=57},Qr={decBinOct:new Set([46,66,69,79,95,98,101,111]),hex:new Set([46,88,95,120])},Zr={bin:function(e){return 48===e||49===e},oct:function(e){return e>=48&&e<=55},dec:function(e){return e>=48&&e<=57},hex:function(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}};function ea(e,t,r,a,n,s){for(var o=r,i=a,d=n,c="",l=null,u=r,p=t.length;;){if(r>=p){s.unterminated(o,i,d),c+=t.slice(u,r);break}var f=t.charCodeAt(r);if(ta(e,f,t,r)){c+=t.slice(u,r);break}if(92===f){c+=t.slice(u,r);var g=ra(t,r,a,n,"template"===e,s);null!==g.ch||l?c+=g.ch:l={pos:r,lineStart:a,curLine:n},r=g.pos,a=g.lineStart,n=g.curLine,u=r}else 8232===f||8233===f?(++n,a=++r):10===f||13===f?"template"===e?(c+=t.slice(u,r)+"\n",++r,13===f&&10===t.charCodeAt(r)&&++r,++n,u=a=r):s.unterminated(o,i,d):++r}return{pos:r,str:c,firstInvalidLoc:l,lineStart:a,curLine:n,containsInvalid:!!l}}function ta(e,t,r,a){return"template"===e?96===t||36===t&&123===r.charCodeAt(a+1):t===("double"===e?34:39)}function ra(e,t,r,a,n,s){var o=!n;t++;var i=function(e){return{pos:t,ch:e,lineStart:r,curLine:a}},d=e.charCodeAt(t++);switch(d){case 110:return i("\n");case 114:return i("\r");case 120:var c,l=aa(e,t,r,a,2,!1,o,s);return c=l.code,t=l.pos,i(null===c?null:String.fromCharCode(c));case 117:var u,p=sa(e,t,r,a,o,s);return u=p.code,t=p.pos,i(null===u?null:String.fromCodePoint(u));case 116:return i("\t");case 98:return i("\b");case 118:return i("\v");case 102:return i("\f");case 13:10===e.charCodeAt(t)&&++t;case 10:r=t,++a;case 8232:case 8233:return i("");case 56:case 57:if(n)return i(null);s.strictNumericEscape(t-1,r,a);default:if(d>=48&&d<=55){var f=t-1,g=/^[0-7]+/.exec(e.slice(f,t+2))[0],y=parseInt(g,8);y>255&&(g=g.slice(0,-1),y=parseInt(g,8)),t+=g.length-1;var m=e.charCodeAt(t);if("0"!==g||56===m||57===m){if(n)return i(null);s.strictNumericEscape(f,r,a)}return i(String.fromCharCode(y))}return i(String.fromCharCode(d))}}function aa(e,t,r,a,n,s,o,i){var d,c=t,l=na(e,t,r,a,16,n,s,!1,i,!o);return d=l.n,t=l.pos,null===d&&(o?i.invalidEscapeSequence(c,r,a):t=c-1),{code:d,pos:t}}function na(e,t,r,a,n,s,o,i,d,c){for(var l=t,u=16===n?Qr.hex:Qr.decBinOct,p=16===n?Zr.hex:10===n?Zr.dec:8===n?Zr.oct:Zr.bin,f=!1,g=0,y=0,m=null==s?1/0:s;y=97?h-97+10:h>=65?h-65+10:$r(h)?h-48:1/0)>=n){if(b<=9&&c)return{n:null,pos:t};if(b<=9&&d.invalidDigit(t,r,a,n))b=0;else{if(!o)break;b=0,f=!0}}++t,g=g*n+b}else{var v=e.charCodeAt(t-1),x=e.charCodeAt(t+1);if(i){if(Number.isNaN(x)||!p(x)||u.has(v)||u.has(x)){if(c)return{n:null,pos:t};d.unexpectedNumericSeparator(t,r,a)}}else{if(c)return{n:null,pos:t};d.numericSeparatorInEscapeSequence(t,r,a)}++t}}return t===l||null!=s&&t-l!==s||f?{n:null,pos:t}:{n:g,pos:t}}function sa(e,t,r,a,n,s){var o;if(123===e.charCodeAt(t)){var i=aa(e,++t,r,a,e.indexOf("}",t)-t,!0,n,s);if(o=i.code,t=i.pos,++t,null!==o&&o>1114111){if(!n)return{code:null,pos:t};s.invalidCodePoint(t,r,a)}}else{var d=aa(e,t,r,a,4,!1,n,s);o=d.code,t=d.pos}return{code:o,pos:t}}var oa=["consequent","body","alternate"],ia=["leadingComments","trailingComments","innerComments"],da=["||","&&","??"],ca=["++","--"],la=[">","<",">=","<="],ua=["==","===","!=","!=="],pa=[].concat(ua,["in","instanceof"]),fa=[].concat(m(pa),la),ga=["-","/","%","*","**","&","|",">>",">>>","<<","^"],ya=["+"].concat(ga,m(fa),["|>"]),ma=["=","+="].concat(m(ga.map((function(e){return e+"="}))),m(da.map((function(e){return e+"="})))),ha=["delete","!"],ba=["+","-","~"],va=["typeof"],xa=["void","throw"].concat(ha,ba,va),Ra={optional:["typeAnnotation","typeParameters","returnType"],force:["start","loc","end"]};e.BLOCK_SCOPED_SYMBOL=Symbol.for("var used to be block scoped"),e.NOT_LOCAL_BINDING=Symbol.for("should not be considered a local binding");var ja={},wa={},Ea={},Sa={},Ta={},Pa={},Aa={};function ka(e){return Array.isArray(e)?"array":null===e?"null":typeof e}function Ca(e){return{validate:e}}function _a(){return Ca(Ua.apply(void 0,arguments))}function Ia(e){return{validate:e,optional:!0}}function Da(){return{validate:Ua.apply(void 0,arguments),optional:!0}}function Oa(e){return Va(Ga("array"),Ma(e))}function Na(){return Oa(Ua.apply(void 0,arguments))}function Ba(){return Ca(Na.apply(void 0,arguments))}function Ma(e){var t=V.env.BABEL_TYPES_8_BREAKING?ts:function(){};function r(r,a,n){if(Array.isArray(n))for(var s=0,o={toString:function(){return a+"["+s+"]"}};s=2&&"type"in t[0]&&"array"===t[0].type&&!("each"in t[1]))throw new Error('An assertValueType("array") validator can only be followed by an assertEach(...) validator.');return a}var Ha,Ka,za,Xa=new Set(["aliases","builder","deprecatedAlias","fields","inherits","visitor","validate"]),Ja=new Set(["default","optional","deprecated","validate"]),Ya={};function $a(){for(var e=arguments.length,t=new Array(e),r=0;r0:c&&"object"==typeof c)throw new Error("field defaults can only be primitives or empty arrays currently");a[o]={default:Array.isArray(c)?[]:c,optional:d.optional,deprecated:d.deprecated,validate:d.validate}}for(var l=t.visitor||r.visitor||[],u=t.aliases||r.aliases||[],p=t.builder||r.builder||t.visitor||[],f=0,g=Object.keys(t);f+s+1)throw new TypeError("RestElement must be last element of "+n)}:void 0}),Za("ReturnStatement",{visitor:["argument"],aliases:["Statement","Terminatorless","CompletionStatement"],fields:{argument:{validate:Ua("Expression"),optional:!0}}}),Za("SequenceExpression",{visitor:["expressions"],fields:{expressions:Ba("Expression")},aliases:["Expression"]}),Za("ParenthesizedExpression",{visitor:["expression"],aliases:["Expression","ExpressionWrapper"],fields:{expression:{validate:Ua("Expression")}}}),Za("SwitchCase",{visitor:["test","consequent"],fields:{test:{validate:Ua("Expression"),optional:!0},consequent:Ba("Statement")}}),Za("SwitchStatement",{visitor:["discriminant","cases"],aliases:["Statement","BlockParent","Scopable"],fields:{discriminant:{validate:Ua("Expression")},cases:Ba("SwitchCase")}}),Za("ThisExpression",{aliases:["Expression"]}),Za("ThrowStatement",{visitor:["argument"],aliases:["Statement","Terminatorless","CompletionStatement"],fields:{argument:{validate:Ua("Expression")}}}),Za("TryStatement",{visitor:["block","handler","finalizer"],aliases:["Statement"],fields:{block:{validate:V.env.BABEL_TYPES_8_BREAKING?Va(Ua("BlockStatement"),Object.assign((function(e){if(!e.handler&&!e.finalizer)throw new TypeError("TryStatement expects either a handler or finalizer, or both")}),{oneOfNodeTypes:["BlockStatement"]})):Ua("BlockStatement")},handler:{optional:!0,validate:Ua("CatchClause")},finalizer:{optional:!0,validate:Ua("BlockStatement")}}}),Za("UnaryExpression",{builder:["operator","argument","prefix"],fields:{prefix:{default:!0},argument:{validate:Ua("Expression")},operator:{validate:Fa.apply(void 0,m(xa))}},visitor:["argument"],aliases:["UnaryLike","Expression"]}),Za("UpdateExpression",{builder:["operator","argument","prefix"],fields:{prefix:{default:!1},argument:{validate:V.env.BABEL_TYPES_8_BREAKING?Ua("Identifier","MemberExpression"):Ua("Expression")},operator:{validate:Fa.apply(void 0,m(ca))}},visitor:["argument"],aliases:["Expression"]}),Za("VariableDeclaration",{builder:["kind","declarations"],visitor:["declarations"],aliases:["Statement","Declaration"],fields:{declare:{validate:Ga("boolean"),optional:!0},kind:{validate:Fa("var","let","const","using","await using")},declarations:Ba("VariableDeclarator")},validate:V.env.BABEL_TYPES_8_BREAKING?(on=Ua("Identifier","Placeholder"),dn=Ua("Identifier","ArrayPattern","ObjectPattern","Placeholder"),cn=on,function(e,t,r){var a=r.kind,n=r.declarations,s=kr("ForXStatement",e,{left:r});if(s&&1!==n.length)throw new TypeError("Exactly one VariableDeclarator is required in the VariableDeclaration of a "+e.type);for(var o,d=i(n);!(o=d()).done;){var c=o.value;"const"===a||"let"===a||"var"===a?s||c.init?dn(c,"id",c.id):on(c,"id",c.id):cn(c,"id",c.id)}}):void 0}),Za("VariableDeclarator",{visitor:["id","init"],fields:{id:{validate:V.env.BABEL_TYPES_8_BREAKING?Ua("Identifier","ArrayPattern","ObjectPattern"):Ua("LVal")},definite:{optional:!0,validate:Ga("boolean")},init:{optional:!0,validate:Ua("Expression")}}}),Za("WhileStatement",{visitor:["test","body"],aliases:["Statement","BlockParent","Loop","While","Scopable"],fields:{test:{validate:Ua("Expression")},body:{validate:Ua("Statement")}}}),Za("WithStatement",{visitor:["object","body"],aliases:["Statement"],fields:{object:{validate:Ua("Expression")},body:{validate:Ua("Statement")}}}),Za("AssignmentPattern",{visitor:["left","right","decorators"],builder:["left","right"],aliases:["Pattern","PatternLike","LVal"],fields:Object.assign({},ln(),{left:{validate:Ua("Identifier","ObjectPattern","ArrayPattern","MemberExpression","TSAsExpression","TSSatisfiesExpression","TSTypeAssertion","TSNonNullExpression")},right:{validate:Ua("Expression")},decorators:{validate:Na("Decorator"),optional:!0}})}),Za("ArrayPattern",{visitor:["elements","typeAnnotation"],builder:["elements"],aliases:["Pattern","PatternLike","LVal"],fields:Object.assign({},ln(),{elements:{validate:Va(Ga("array"),Ma(qa("null","PatternLike","LVal")))}})}),Za("ArrowFunctionExpression",{builder:["params","body","async"],visitor:["typeParameters","params","predicate","returnType","body"],aliases:["Scopable","Function","BlockParent","FunctionParent","Expression","Pureish"],fields:Object.assign({},en(),tn(),{expression:{validate:Ga("boolean")},body:{validate:Ua("BlockStatement","Expression")},predicate:{validate:Ua("DeclaredPredicate","InferredPredicate"),optional:!0}})}),Za("ClassBody",{visitor:["body"],fields:{body:Ba("ClassMethod","ClassPrivateMethod","ClassProperty","ClassPrivateProperty","ClassAccessorProperty","TSDeclareMethod","TSIndexSignature","StaticBlock")}}),Za("ClassExpression",{builder:["id","superClass","body","decorators"],visitor:["decorators","id","typeParameters","superClass","superTypeParameters","mixins","implements","body"],aliases:["Scopable","Class","Expression"],fields:(Ha={id:{validate:Ua("Identifier"),optional:!0},typeParameters:{validate:Ua("TypeParameterDeclaration","TSTypeParameterDeclaration","Noop"),optional:!0},body:{validate:Ua("ClassBody")},superClass:{optional:!0,validate:Ua("Expression")}},Ha.superTypeParameters={validate:Ua("TypeParameterInstantiation","TSTypeParameterInstantiation"),optional:!0},Ha.implements={validate:Na("TSExpressionWithTypeArguments","ClassImplements"),optional:!0},Ha.decorators={validate:Na("Decorator"),optional:!0},Ha.mixins={validate:Ua("InterfaceExtends"),optional:!0},Ha)}),Za("ClassDeclaration",{inherits:"ClassExpression",aliases:["Scopable","Class","Statement","Declaration"],fields:(Ka={id:{validate:Ua("Identifier"),optional:!0},typeParameters:{validate:Ua("TypeParameterDeclaration","TSTypeParameterDeclaration","Noop"),optional:!0},body:{validate:Ua("ClassBody")},superClass:{optional:!0,validate:Ua("Expression")}},Ka.superTypeParameters={validate:Ua("TypeParameterInstantiation","TSTypeParameterInstantiation"),optional:!0},Ka.implements={validate:Na("TSExpressionWithTypeArguments","ClassImplements"),optional:!0},Ka.decorators={validate:Na("Decorator"),optional:!0},Ka.mixins={validate:Ua("InterfaceExtends"),optional:!0},Ka.declare={validate:Ga("boolean"),optional:!0},Ka.abstract={validate:Ga("boolean"),optional:!0},Ka),validate:V.env.BABEL_TYPES_8_BREAKING?function(){var e=Ua("Identifier");return function(t,r,a){kr("ExportDefaultDeclaration",t)||e(a,"id",a.id)}}():void 0});var un,pn,fn={attributes:{optional:!0,validate:Na("ImportAttribute")},assertions:{deprecated:!0,optional:!0,validate:Na("ImportAttribute")}};Za("ExportAllDeclaration",{builder:["source"],visitor:["source","attributes","assertions"],aliases:["Statement","Declaration","ImportOrExportDeclaration","ExportDeclaration"],fields:Object.assign({source:{validate:Ua("StringLiteral")},exportKind:Ia(Fa("type","value"))},fn)}),Za("ExportDefaultDeclaration",{visitor:["declaration"],aliases:["Statement","Declaration","ImportOrExportDeclaration","ExportDeclaration"],fields:{declaration:_a("TSDeclareFunction","FunctionDeclaration","ClassDeclaration","Expression"),exportKind:Ia(Fa("value"))}}),Za("ExportNamedDeclaration",{builder:["declaration","specifiers","source"],visitor:V.env?["declaration","specifiers","source","attributes"]:["declaration","specifiers","source","attributes","assertions"],aliases:["Statement","Declaration","ImportOrExportDeclaration","ExportDeclaration"],fields:Object.assign({declaration:{optional:!0,validate:V.env.BABEL_TYPES_8_BREAKING?Va(Ua("Declaration"),Object.assign((function(e,t,r){if(r&&e.specifiers.length)throw new TypeError("Only declaration or specifiers is allowed on ExportNamedDeclaration");if(r&&e.source)throw new TypeError("Cannot export a declaration from a source")}),{oneOfNodeTypes:["Declaration"]})):Ua("Declaration")}},fn,{specifiers:{default:[],validate:Oa((un=Ua("ExportSpecifier","ExportDefaultSpecifier","ExportNamespaceSpecifier"),pn=Ua("ExportSpecifier"),V.env.BABEL_TYPES_8_BREAKING?Object.assign((function(e,t,r){(e.source?un:pn)(e,t,r)}),{oneOfNodeTypes:["ExportSpecifier","ExportDefaultSpecifier","ExportNamespaceSpecifier"]}):un))},source:{validate:Ua("StringLiteral"),optional:!0},exportKind:Ia(Fa("type","value"))})}),Za("ExportSpecifier",{visitor:["local","exported"],aliases:["ModuleSpecifier"],fields:{local:{validate:Ua("Identifier")},exported:{validate:Ua("Identifier","StringLiteral")},exportKind:{validate:Fa("type","value"),optional:!0}}}),Za("ForOfStatement",{visitor:["left","right","body"],builder:["left","right","body","await"],aliases:["Scopable","Statement","For","BlockParent","Loop","ForXStatement"],fields:{left:{validate:function(){if(!V.env.BABEL_TYPES_8_BREAKING)return Ua("VariableDeclaration","LVal");var e=Ua("VariableDeclaration"),t=Ua("Identifier","MemberExpression","ArrayPattern","ObjectPattern","TSAsExpression","TSSatisfiesExpression","TSTypeAssertion","TSNonNullExpression");return Object.assign((function(r,a,n){kr("VariableDeclaration",n)?e(r,a,n):t(r,a,n)}),{oneOfNodeTypes:["VariableDeclaration","Identifier","MemberExpression","ArrayPattern","ObjectPattern","TSAsExpression","TSSatisfiesExpression","TSTypeAssertion","TSNonNullExpression"]})}()},right:{validate:Ua("Expression")},body:{validate:Ua("Statement")},await:{default:!1}}}),Za("ImportDeclaration",{builder:["specifiers","source"],visitor:["specifiers","source","attributes","assertions"],aliases:["Statement","Declaration","ImportOrExportDeclaration"],fields:Object.assign({},fn,{module:{optional:!0,validate:Ga("boolean")},phase:{default:null,validate:Fa("source","defer")},specifiers:Ba("ImportSpecifier","ImportDefaultSpecifier","ImportNamespaceSpecifier"),source:{validate:Ua("StringLiteral")},importKind:{validate:Fa("type","typeof","value"),optional:!0}})}),Za("ImportDefaultSpecifier",{visitor:["local"],aliases:["ModuleSpecifier"],fields:{local:{validate:Ua("Identifier")}}}),Za("ImportNamespaceSpecifier",{visitor:["local"],aliases:["ModuleSpecifier"],fields:{local:{validate:Ua("Identifier")}}}),Za("ImportSpecifier",{visitor:["imported","local"],builder:["local","imported"],aliases:["ModuleSpecifier"],fields:{local:{validate:Ua("Identifier")},imported:{validate:Ua("Identifier","StringLiteral")},importKind:{validate:Fa("type","typeof","value"),optional:!0}}}),Za("ImportExpression",{visitor:["source","options"],aliases:["Expression"],fields:{phase:{default:null,validate:Fa("source","defer")},source:{validate:Ua("Expression")},options:{validate:Ua("Expression"),optional:!0}}}),Za("MetaProperty",{visitor:["meta","property"],aliases:["Expression"],fields:{meta:{validate:V.env.BABEL_TYPES_8_BREAKING?Va(Ua("Identifier"),Object.assign((function(e,t,r){var a;switch(r.name){case"function":a="sent";break;case"new":a="target";break;case"import":a="meta"}if(!kr("Identifier",e.property,{name:a}))throw new TypeError("Unrecognised MetaProperty")}),{oneOfNodeTypes:["Identifier"]})):Ua("Identifier")},property:{validate:Ua("Identifier")}}});var gn=function(){return{abstract:{validate:Ga("boolean"),optional:!0},accessibility:{validate:Fa("public","private","protected"),optional:!0},static:{default:!1},override:{default:!1},computed:{default:!1},optional:{validate:Ga("boolean"),optional:!0},key:{validate:Va(function(){var e=Ua("Identifier","StringLiteral","NumericLiteral","BigIntLiteral"),t=Ua("Expression");return function(r,a,n){(r.computed?t:e)(r,a,n)}}(),Ua("Identifier","StringLiteral","NumericLiteral","BigIntLiteral","Expression"))}}},yn=function(){return Object.assign({},en(),gn(),{params:Ba("Identifier","Pattern","RestElement","TSParameterProperty"),kind:{validate:Fa("get","set","method","constructor"),default:"method"},access:{validate:Va(Ga("string"),Fa("public","private","protected")),optional:!0},decorators:{validate:Na("Decorator"),optional:!0}})};Za("ClassMethod",{aliases:["Function","Scopable","BlockParent","FunctionParent","Method"],builder:["kind","key","params","body","computed","static","generator","async"],visitor:["decorators","key","typeParameters","params","returnType","body"],fields:Object.assign({},yn(),tn(),{body:{validate:Ua("BlockStatement")}})}),Za("ObjectPattern",{visitor:["decorators","properties","typeAnnotation"],builder:["properties"],aliases:["Pattern","PatternLike","LVal"],fields:Object.assign({},ln(),{properties:Ba("RestElement","ObjectProperty")})}),Za("SpreadElement",{visitor:["argument"],aliases:["UnaryLike"],deprecatedAlias:"SpreadProperty",fields:{argument:{validate:Ua("Expression")}}}),Za("Super",{aliases:["Expression"]}),Za("TaggedTemplateExpression",{visitor:["tag","typeParameters","quasi"],builder:["tag","quasi"],aliases:["Expression"],fields:(za={tag:{validate:Ua("Expression")},quasi:{validate:Ua("TemplateLiteral")}},za.typeParameters={validate:Ua("TypeParameterInstantiation","TSTypeParameterInstantiation"),optional:!0},za)}),Za("TemplateElement",{builder:["value","tail"],fields:{value:{validate:Va(function(e){var t=Object.keys(e);function r(r,a,n){for(var s,o=[],d=i(t);!(s=d()).done;){var c=s.value;try{es(r,c,n[c],e[c])}catch(e){if(e instanceof TypeError){o.push(e.message);continue}throw e}}if(o.length)throw new TypeError("Property "+a+" of "+r.type+" expected to have the following:\n"+o.join("\n"))}return r.shapeOf=e,r}({raw:{validate:Ga("string")},cooked:{validate:Ga("string"),optional:!0}}),(function(e){var t=e.value.raw,r=!1,a=function(){throw new Error("Internal @babel/types error.")},n=ea("template",t,0,0,0,{unterminated:function(){r=!0},strictNumericEscape:a,invalidEscapeSequence:a,numericSeparatorInEscapeSequence:a,unexpectedNumericSeparator:a,invalidDigit:a,invalidCodePoint:a}),s=n.str,o=n.firstInvalidLoc;if(!r)throw new Error("Invalid raw");e.value.cooked=o?null:s}))},tail:{default:!1}}}),Za("TemplateLiteral",{visitor:["quasis","expressions"],aliases:["Expression","Literal"],fields:{quasis:Ba("TemplateElement"),expressions:{validate:Va(Ga("array"),Ma(Ua("Expression","TSType")),(function(e,t,r){if(e.quasis.length!==r.length+1)throw new TypeError("Number of "+e.type+" quasis should be exactly one more than the number of expressions.\nExpected "+(r.length+1)+" quasis but got "+e.quasis.length)}))}}}),Za("YieldExpression",{builder:["argument","delegate"],visitor:["argument"],aliases:["Expression","Terminatorless"],fields:{delegate:{validate:V.env.BABEL_TYPES_8_BREAKING?Va(Ga("boolean"),Object.assign((function(e,t,r){if(r&&!e.argument)throw new TypeError("Property delegate of YieldExpression cannot be true if there is no argument")}),{type:"boolean"})):Ga("boolean"),default:!1},argument:{optional:!0,validate:Ua("Expression")}}}),Za("AwaitExpression",{builder:["argument"],visitor:["argument"],aliases:["Expression","Terminatorless"],fields:{argument:{validate:Ua("Expression")}}}),Za("Import",{aliases:["Expression"]}),Za("BigIntLiteral",{builder:["value"],fields:{value:{validate:Ga("string")}},aliases:["Expression","Pureish","Literal","Immutable"]}),Za("ExportNamespaceSpecifier",{visitor:["exported"],aliases:["ModuleSpecifier"],fields:{exported:{validate:Ua("Identifier")}}}),Za("OptionalMemberExpression",{builder:["object","property","computed","optional"],visitor:["object","property"],aliases:["Expression"],fields:{object:{validate:Ua("Expression")},property:{validate:function(){var e=Ua("Identifier"),t=Ua("Expression"),r=Object.assign((function(r,a,n){(r.computed?t:e)(r,a,n)}),{oneOfNodeTypes:["Expression","Identifier"]});return r}()},computed:{default:!1},optional:{validate:V.env.BABEL_TYPES_8_BREAKING?Va(Ga("boolean"),Wa()):Ga("boolean")}}}),Za("OptionalCallExpression",{visitor:["callee","typeParameters","typeArguments","arguments"],builder:["callee","arguments","optional"],aliases:["Expression"],fields:Object.assign({callee:{validate:Ua("Expression")},arguments:Ba("Expression","SpreadElement","ArgumentPlaceholder"),optional:{validate:V.env.BABEL_TYPES_8_BREAKING?Va(Ga("boolean"),Wa()):Ga("boolean")},typeArguments:{validate:Ua("TypeParameterInstantiation"),optional:!0}},{typeParameters:{validate:Ua("TSTypeParameterInstantiation"),optional:!0}})}),Za("ClassProperty",{visitor:["decorators","variance","key","typeAnnotation","value"],builder:["key","value","typeAnnotation","decorators","computed","static"],aliases:["Property"],fields:Object.assign({},gn(),{value:{validate:Ua("Expression"),optional:!0},definite:{validate:Ga("boolean"),optional:!0},typeAnnotation:{validate:Ua("TypeAnnotation","TSTypeAnnotation","Noop"),optional:!0},decorators:{validate:Na("Decorator"),optional:!0},readonly:{validate:Ga("boolean"),optional:!0},declare:{validate:Ga("boolean"),optional:!0},variance:{validate:Ua("Variance"),optional:!0}})}),Za("ClassAccessorProperty",{visitor:["decorators","key","typeAnnotation","value"],builder:["key","value","typeAnnotation","decorators","computed","static"],aliases:["Property","Accessor"],fields:Object.assign({},gn(),{key:{validate:Va(function(){var e=Ua("Identifier","StringLiteral","NumericLiteral","BigIntLiteral","PrivateName"),t=Ua("Expression");return function(r,a,n){(r.computed?t:e)(r,a,n)}}(),Ua("Identifier","StringLiteral","NumericLiteral","BigIntLiteral","Expression","PrivateName"))},value:{validate:Ua("Expression"),optional:!0},definite:{validate:Ga("boolean"),optional:!0},typeAnnotation:{validate:Ua("TypeAnnotation","TSTypeAnnotation","Noop"),optional:!0},decorators:{validate:Na("Decorator"),optional:!0},readonly:{validate:Ga("boolean"),optional:!0},declare:{validate:Ga("boolean"),optional:!0},variance:{validate:Ua("Variance"),optional:!0}})}),Za("ClassPrivateProperty",{visitor:["decorators","variance","key","typeAnnotation","value"],builder:["key","value","decorators","static"],aliases:["Property","Private"],fields:{key:{validate:Ua("PrivateName")},value:{validate:Ua("Expression"),optional:!0},typeAnnotation:{validate:Ua("TypeAnnotation","TSTypeAnnotation","Noop"),optional:!0},decorators:{validate:Na("Decorator"),optional:!0},static:{validate:Ga("boolean"),default:!1},readonly:{validate:Ga("boolean"),optional:!0},optional:{validate:Ga("boolean"),optional:!0},definite:{validate:Ga("boolean"),optional:!0},variance:{validate:Ua("Variance"),optional:!0}}}),Za("ClassPrivateMethod",{builder:["kind","key","params","body","static"],visitor:["decorators","key","typeParameters","params","returnType","body"],aliases:["Function","Scopable","BlockParent","FunctionParent","Method","Private"],fields:Object.assign({},yn(),tn(),{kind:{validate:Fa("get","set","method"),default:"method"},key:{validate:Ua("PrivateName")},body:{validate:Ua("BlockStatement")}})}),Za("PrivateName",{visitor:["id"],aliases:["Private"],fields:{id:{validate:Ua("Identifier")}}}),Za("StaticBlock",{visitor:["body"],fields:{body:Ba("Statement")},aliases:["Scopable","BlockParent","FunctionParent"]}),Za("ImportAttribute",{visitor:["key","value"],fields:{key:{validate:Ua("Identifier","StringLiteral")},value:{validate:Ua("StringLiteral")}}});var mn=$a("Flow"),hn=function(e){var t="DeclareClass"===e;mn(e,{builder:["id","typeParameters","extends","body"],visitor:["id","typeParameters","extends"].concat(m(t?["mixins","implements"]:[]),["body"]),aliases:["FlowDeclaration","Statement","Declaration"],fields:Object.assign({id:_a("Identifier"),typeParameters:Da("TypeParameterDeclaration"),extends:Ia(Na("InterfaceExtends"))},t?{mixins:Ia(Na("InterfaceExtends")),implements:Ia(Na("ClassImplements"))}:{},{body:_a("ObjectTypeAnnotation")})})};mn("AnyTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]}),mn("ArrayTypeAnnotation",{visitor:["elementType"],aliases:["FlowType"],fields:{elementType:_a("FlowType")}}),mn("BooleanTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]}),mn("BooleanLiteralTypeAnnotation",{builder:["value"],aliases:["FlowType"],fields:{value:Ca(Ga("boolean"))}}),mn("NullLiteralTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]}),mn("ClassImplements",{visitor:["id","typeParameters"],fields:{id:_a("Identifier"),typeParameters:Da("TypeParameterInstantiation")}}),hn("DeclareClass"),mn("DeclareFunction",{builder:["id"],visitor:["id","predicate"],aliases:["FlowDeclaration","Statement","Declaration"],fields:{id:_a("Identifier"),predicate:Da("DeclaredPredicate")}}),hn("DeclareInterface"),mn("DeclareModule",{builder:["id","body","kind"],visitor:["id","body"],aliases:["FlowDeclaration","Statement","Declaration"],fields:{id:_a("Identifier","StringLiteral"),body:_a("BlockStatement"),kind:Ia(Fa("CommonJS","ES"))}}),mn("DeclareModuleExports",{visitor:["typeAnnotation"],aliases:["FlowDeclaration","Statement","Declaration"],fields:{typeAnnotation:_a("TypeAnnotation")}}),mn("DeclareTypeAlias",{visitor:["id","typeParameters","right"],aliases:["FlowDeclaration","Statement","Declaration"],fields:{id:_a("Identifier"),typeParameters:Da("TypeParameterDeclaration"),right:_a("FlowType")}}),mn("DeclareOpaqueType",{visitor:["id","typeParameters","supertype"],aliases:["FlowDeclaration","Statement","Declaration"],fields:{id:_a("Identifier"),typeParameters:Da("TypeParameterDeclaration"),supertype:Da("FlowType"),impltype:Da("FlowType")}}),mn("DeclareVariable",{visitor:["id"],aliases:["FlowDeclaration","Statement","Declaration"],fields:{id:_a("Identifier")}}),mn("DeclareExportDeclaration",{visitor:["declaration","specifiers","source","attributes"],aliases:["FlowDeclaration","Statement","Declaration"],fields:Object.assign({declaration:Da("Flow"),specifiers:Ia(Na("ExportSpecifier","ExportNamespaceSpecifier")),source:Da("StringLiteral"),default:Ia(Ga("boolean"))},fn)}),mn("DeclareExportAllDeclaration",{visitor:["source","attributes"],aliases:["FlowDeclaration","Statement","Declaration"],fields:Object.assign({source:_a("StringLiteral"),exportKind:Ia(Fa("type","value"))},fn)}),mn("DeclaredPredicate",{visitor:["value"],aliases:["FlowPredicate"],fields:{value:_a("Flow")}}),mn("ExistsTypeAnnotation",{aliases:["FlowType"]}),mn("FunctionTypeAnnotation",{builder:["typeParameters","params","rest","returnType"],visitor:["typeParameters","this","params","rest","returnType"],aliases:["FlowType"],fields:{typeParameters:Da("TypeParameterDeclaration"),params:Ba("FunctionTypeParam"),rest:Da("FunctionTypeParam"),this:Da("FunctionTypeParam"),returnType:_a("FlowType")}}),mn("FunctionTypeParam",{visitor:["name","typeAnnotation"],fields:{name:Da("Identifier"),typeAnnotation:_a("FlowType"),optional:Ia(Ga("boolean"))}}),mn("GenericTypeAnnotation",{visitor:["id","typeParameters"],aliases:["FlowType"],fields:{id:_a("Identifier","QualifiedTypeIdentifier"),typeParameters:Da("TypeParameterInstantiation")}}),mn("InferredPredicate",{aliases:["FlowPredicate"]}),mn("InterfaceExtends",{visitor:["id","typeParameters"],fields:{id:_a("Identifier","QualifiedTypeIdentifier"),typeParameters:Da("TypeParameterInstantiation")}}),hn("InterfaceDeclaration"),mn("InterfaceTypeAnnotation",{visitor:["extends","body"],aliases:["FlowType"],fields:{extends:Ia(Na("InterfaceExtends")),body:_a("ObjectTypeAnnotation")}}),mn("IntersectionTypeAnnotation",{visitor:["types"],aliases:["FlowType"],fields:{types:Ca(Na("FlowType"))}}),mn("MixedTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]}),mn("EmptyTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]}),mn("NullableTypeAnnotation",{visitor:["typeAnnotation"],aliases:["FlowType"],fields:{typeAnnotation:_a("FlowType")}}),mn("NumberLiteralTypeAnnotation",{builder:["value"],aliases:["FlowType"],fields:{value:Ca(Ga("number"))}}),mn("NumberTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]}),mn("ObjectTypeAnnotation",{visitor:["properties","indexers","callProperties","internalSlots"],aliases:["FlowType"],builder:["properties","indexers","callProperties","internalSlots","exact"],fields:{properties:Ca(Na("ObjectTypeProperty","ObjectTypeSpreadProperty")),indexers:{validate:Na("ObjectTypeIndexer"),optional:!0,default:[]},callProperties:{validate:Na("ObjectTypeCallProperty"),optional:!0,default:[]},internalSlots:{validate:Na("ObjectTypeInternalSlot"),optional:!0,default:[]},exact:{validate:Ga("boolean"),default:!1},inexact:Ia(Ga("boolean"))}}),mn("ObjectTypeInternalSlot",{visitor:["id","value"],builder:["id","value","optional","static","method"],aliases:["UserWhitespacable"],fields:{id:_a("Identifier"),value:_a("FlowType"),optional:Ca(Ga("boolean")),static:Ca(Ga("boolean")),method:Ca(Ga("boolean"))}}),mn("ObjectTypeCallProperty",{visitor:["value"],aliases:["UserWhitespacable"],fields:{value:_a("FlowType"),static:Ca(Ga("boolean"))}}),mn("ObjectTypeIndexer",{visitor:["variance","id","key","value"],builder:["id","key","value","variance"],aliases:["UserWhitespacable"],fields:{id:Da("Identifier"),key:_a("FlowType"),value:_a("FlowType"),static:Ca(Ga("boolean")),variance:Da("Variance")}}),mn("ObjectTypeProperty",{visitor:["key","value","variance"],aliases:["UserWhitespacable"],fields:{key:_a("Identifier","StringLiteral"),value:_a("FlowType"),kind:Ca(Fa("init","get","set")),static:Ca(Ga("boolean")),proto:Ca(Ga("boolean")),optional:Ca(Ga("boolean")),variance:Da("Variance"),method:Ca(Ga("boolean"))}}),mn("ObjectTypeSpreadProperty",{visitor:["argument"],aliases:["UserWhitespacable"],fields:{argument:_a("FlowType")}}),mn("OpaqueType",{visitor:["id","typeParameters","supertype","impltype"],aliases:["FlowDeclaration","Statement","Declaration"],fields:{id:_a("Identifier"),typeParameters:Da("TypeParameterDeclaration"),supertype:Da("FlowType"),impltype:_a("FlowType")}}),mn("QualifiedTypeIdentifier",{visitor:["qualification","id"],builder:["id","qualification"],fields:{id:_a("Identifier"),qualification:_a("Identifier","QualifiedTypeIdentifier")}}),mn("StringLiteralTypeAnnotation",{builder:["value"],aliases:["FlowType"],fields:{value:Ca(Ga("string"))}}),mn("StringTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]}),mn("SymbolTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]}),mn("ThisTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]}),mn("TupleTypeAnnotation",{visitor:["types"],aliases:["FlowType"],fields:{types:Ca(Na("FlowType"))}}),mn("TypeofTypeAnnotation",{visitor:["argument"],aliases:["FlowType"],fields:{argument:_a("FlowType")}}),mn("TypeAlias",{visitor:["id","typeParameters","right"],aliases:["FlowDeclaration","Statement","Declaration"],fields:{id:_a("Identifier"),typeParameters:Da("TypeParameterDeclaration"),right:_a("FlowType")}}),mn("TypeAnnotation",{visitor:["typeAnnotation"],fields:{typeAnnotation:_a("FlowType")}}),mn("TypeCastExpression",{visitor:["expression","typeAnnotation"],aliases:["ExpressionWrapper","Expression"],fields:{expression:_a("Expression"),typeAnnotation:_a("TypeAnnotation")}}),mn("TypeParameter",{visitor:["bound","default","variance"],fields:{name:Ca(Ga("string")),bound:Da("TypeAnnotation"),default:Da("FlowType"),variance:Da("Variance")}}),mn("TypeParameterDeclaration",{visitor:["params"],fields:{params:Ca(Na("TypeParameter"))}}),mn("TypeParameterInstantiation",{visitor:["params"],fields:{params:Ca(Na("FlowType"))}}),mn("UnionTypeAnnotation",{visitor:["types"],aliases:["FlowType"],fields:{types:Ca(Na("FlowType"))}}),mn("Variance",{builder:["kind"],fields:{kind:Ca(Fa("minus","plus"))}}),mn("VoidTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]}),mn("EnumDeclaration",{aliases:["Statement","Declaration"],visitor:["id","body"],fields:{id:_a("Identifier"),body:_a("EnumBooleanBody","EnumNumberBody","EnumStringBody","EnumSymbolBody")}}),mn("EnumBooleanBody",{aliases:["EnumBody"],visitor:["members"],fields:{explicitType:Ca(Ga("boolean")),members:Ba("EnumBooleanMember"),hasUnknownMembers:Ca(Ga("boolean"))}}),mn("EnumNumberBody",{aliases:["EnumBody"],visitor:["members"],fields:{explicitType:Ca(Ga("boolean")),members:Ba("EnumNumberMember"),hasUnknownMembers:Ca(Ga("boolean"))}}),mn("EnumStringBody",{aliases:["EnumBody"],visitor:["members"],fields:{explicitType:Ca(Ga("boolean")),members:Ba("EnumStringMember","EnumDefaultedMember"),hasUnknownMembers:Ca(Ga("boolean"))}}),mn("EnumSymbolBody",{aliases:["EnumBody"],visitor:["members"],fields:{members:Ba("EnumDefaultedMember"),hasUnknownMembers:Ca(Ga("boolean"))}}),mn("EnumBooleanMember",{aliases:["EnumMember"],builder:["id"],visitor:["id","init"],fields:{id:_a("Identifier"),init:_a("BooleanLiteral")}}),mn("EnumNumberMember",{aliases:["EnumMember"],visitor:["id","init"],fields:{id:_a("Identifier"),init:_a("NumericLiteral")}}),mn("EnumStringMember",{aliases:["EnumMember"],visitor:["id","init"],fields:{id:_a("Identifier"),init:_a("StringLiteral")}}),mn("EnumDefaultedMember",{aliases:["EnumMember"],visitor:["id"],fields:{id:_a("Identifier")}}),mn("IndexedAccessType",{visitor:["objectType","indexType"],aliases:["FlowType"],fields:{objectType:_a("FlowType"),indexType:_a("FlowType")}}),mn("OptionalIndexedAccessType",{visitor:["objectType","indexType"],aliases:["FlowType"],fields:{objectType:_a("FlowType"),indexType:_a("FlowType"),optional:Ca(Ga("boolean"))}});var bn=$a("JSX");bn("JSXAttribute",{visitor:["name","value"],aliases:["Immutable"],fields:{name:{validate:Ua("JSXIdentifier","JSXNamespacedName")},value:{optional:!0,validate:Ua("JSXElement","JSXFragment","StringLiteral","JSXExpressionContainer")}}}),bn("JSXClosingElement",{visitor:["name"],aliases:["Immutable"],fields:{name:{validate:Ua("JSXIdentifier","JSXMemberExpression","JSXNamespacedName")}}}),bn("JSXElement",{builder:["openingElement","closingElement","children","selfClosing"],visitor:["openingElement","children","closingElement"],aliases:["Immutable","Expression"],fields:Object.assign({openingElement:{validate:Ua("JSXOpeningElement")},closingElement:{optional:!0,validate:Ua("JSXClosingElement")},children:Ba("JSXText","JSXExpressionContainer","JSXSpreadChild","JSXElement","JSXFragment")},{selfClosing:{validate:Ga("boolean"),optional:!0}})}),bn("JSXEmptyExpression",{}),bn("JSXExpressionContainer",{visitor:["expression"],aliases:["Immutable"],fields:{expression:{validate:Ua("Expression","JSXEmptyExpression")}}}),bn("JSXSpreadChild",{visitor:["expression"],aliases:["Immutable"],fields:{expression:{validate:Ua("Expression")}}}),bn("JSXIdentifier",{builder:["name"],fields:{name:{validate:Ga("string")}}}),bn("JSXMemberExpression",{visitor:["object","property"],fields:{object:{validate:Ua("JSXMemberExpression","JSXIdentifier")},property:{validate:Ua("JSXIdentifier")}}}),bn("JSXNamespacedName",{visitor:["namespace","name"],fields:{namespace:{validate:Ua("JSXIdentifier")},name:{validate:Ua("JSXIdentifier")}}}),bn("JSXOpeningElement",{builder:["name","attributes","selfClosing"],visitor:["name","typeParameters","typeArguments","attributes"],aliases:["Immutable"],fields:Object.assign({name:{validate:Ua("JSXIdentifier","JSXMemberExpression","JSXNamespacedName")},selfClosing:{default:!1},attributes:Ba("JSXAttribute","JSXSpreadAttribute"),typeArguments:{validate:Ua("TypeParameterInstantiation"),optional:!0}},{typeParameters:{validate:Ua("TSTypeParameterInstantiation"),optional:!0}})}),bn("JSXSpreadAttribute",{visitor:["argument"],fields:{argument:{validate:Ua("Expression")}}}),bn("JSXText",{aliases:["Immutable"],builder:["value"],fields:{value:{validate:Ga("string")}}}),bn("JSXFragment",{builder:["openingFragment","closingFragment","children"],visitor:["openingFragment","children","closingFragment"],aliases:["Immutable","Expression"],fields:{openingFragment:{validate:Ua("JSXOpeningFragment")},closingFragment:{validate:Ua("JSXClosingFragment")},children:Ba("JSXText","JSXExpressionContainer","JSXSpreadChild","JSXElement","JSXFragment")}}),bn("JSXOpeningFragment",{aliases:["Immutable"]}),bn("JSXClosingFragment",{aliases:["Immutable"]});for(var vn=["Identifier","StringLiteral","Expression","Statement","Declaration","BlockStatement","ClassBody","Pattern"],xn={Declaration:["Statement"],Pattern:["PatternLike","LVal"]},Rn=0,jn=vn;Rn=Number.MAX_SAFE_INTEGER?vm.uid=0:vm.uid++};var Rm=Function.call.bind(Object.prototype.toString);function jm(e){if(void 0===e)return Ss("undefined");if(!0===e||!1===e)return _s(e);if(null===e)return{type:"NullLiteral"};if("string"==typeof e)return As(e);if("number"==typeof e){var t;if(Number.isFinite(e))t=ks(Math.abs(e));else t=os("/",Number.isNaN(e)?ks(0):ks(1),ks(0));return(e<0||Object.is(e,-0))&&(t=Js("-",t)),t}if("bigint"==typeof e)return ko(e.toString());if(function(e){return"[object RegExp]"===Rm(e)}(e))return Is(e.source,/\/([a-z]*)$/.exec(e.toString())[1]);if(Array.isArray(e))return ns(e.map(jm));if(function(e){if("object"!=typeof e||null===e||"[object Object]"!==Object.prototype.toString.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||null===Object.getPrototypeOf(t)}(e)){for(var r=[],a=0,n=Object.keys(e);a1?e:e[0]})),Km=Vm((function(e){return e})),zm=Vm((function(e){if(0===e.length)throw new Error("Found nothing to return.");if(e.length>1)throw new Error("Found multiple statements but wanted one");return e[0]})),Xm={code:function(e){return"(\n"+e+"\n)"},validate:function(e){if(e.program.body.length>1)throw new Error("Found multiple statements but wanted one");if(0===Xm.unwrap(e).start)throw new Error("Parse result included parens.")},unwrap:function(e){var t=g(e.program.body,1)[0];return Wm(t),t.expression}},Jm=["placeholderWhitelist","placeholderPattern","preserveComments","syntacticPlaceholders"];function Ym(e,t){var r=t.placeholderWhitelist,a=void 0===r?e.placeholderWhitelist:r,n=t.placeholderPattern,s=void 0===n?e.placeholderPattern:n,o=t.preserveComments,i=void 0===o?e.preserveComments:o,d=t.syntacticPlaceholders,c=void 0===d?e.syntacticPlaceholders:d;return{parser:Object.assign({},e.parser,t.parser),placeholderWhitelist:a,placeholderPattern:s,preserveComments:i,syntacticPlaceholders:c}}function $m(e){if(null!=e&&"object"!=typeof e)throw new Error("Unknown template options.");var t=e||{},r=t.placeholderWhitelist,a=t.placeholderPattern,n=t.preserveComments,s=t.syntacticPlaceholders,o=u(t,Jm);if(null!=r&&!(r instanceof Set))throw new Error("'.placeholderWhitelist' must be a Set, null, or undefined");if(null!=a&&!(a instanceof RegExp)&&!1!==a)throw new Error("'.placeholderPattern' must be a RegExp, false, null, or undefined");if(null!=n&&"boolean"!=typeof n)throw new Error("'.preserveComments' must be a boolean, null, or undefined");if(null!=s&&"boolean"!=typeof s)throw new Error("'.syntacticPlaceholders' must be a boolean, null, or undefined");if(!0===s&&(null!=r||null!=a))throw new Error("'.placeholderWhitelist' and '.placeholderPattern' aren't compatible with '.syntacticPlaceholders: true'");return{parser:o,placeholderWhitelist:r||void 0,placeholderPattern:null==a?void 0:a,preserveComments:null==n?void 0:n,syntacticPlaceholders:null==s?void 0:s}}function Qm(e){if(Array.isArray(e))return e.reduce((function(e,t,r){return e["$"+r]=t,e}),{});if("object"==typeof e||null==e)return e||void 0;throw new Error("Template replacements must be an array, object, null, or undefined")}var Zm=o((function(e,t,r){this.line=void 0,this.column=void 0,this.index=void 0,this.line=e,this.column=t,this.index=r})),eh=o((function(e,t){this.start=void 0,this.end=void 0,this.filename=void 0,this.identifierName=void 0,this.start=e,this.end=t}));function th(e,t){var r=e.line,a=e.column,n=e.index;return new Zm(r,a+t,n+t)}var rh,ah="BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED",nh={ImportMetaOutsideModule:{message:"import.meta may appear only with 'sourceType: \"module\"'",code:ah},ImportOutsideModule:{message:"'import' and 'export' may appear only with 'sourceType: \"module\"'",code:ah}},sh={ArrayPattern:"array destructuring pattern",AssignmentExpression:"assignment expression",AssignmentPattern:"assignment expression",ArrowFunctionExpression:"arrow function expression",ConditionalExpression:"conditional expression",CatchClause:"catch clause",ForOfStatement:"for-of statement",ForInStatement:"for-in statement",ForStatement:"for-loop",FormalParameters:"function parameter list",Identifier:"identifier",ImportSpecifier:"import specifier",ImportDefaultSpecifier:"import default specifier",ImportNamespaceSpecifier:"import namespace specifier",ObjectPattern:"object destructuring pattern",ParenthesizedExpression:"parenthesized expression",RestElement:"rest element",UpdateExpression:{true:"prefix operation",false:"postfix operation"},VariableDeclarator:"variable declaration",YieldExpression:"yield expression"},oh=function(e){return"UpdateExpression"===e.type?sh.UpdateExpression[""+e.prefix]:sh[e.type]},ih={AccessorIsGenerator:function(e){return"A "+e.kind+"ter cannot be a generator."},ArgumentsInClass:"'arguments' is only allowed in functions and class methods.",AsyncFunctionInSingleStatementContext:"Async functions can only be declared at the top level or inside a block.",AwaitBindingIdentifier:"Can not use 'await' as identifier inside an async function.",AwaitBindingIdentifierInStaticBlock:"Can not use 'await' as identifier inside a static block.",AwaitExpressionFormalParameter:"'await' is not allowed in async function parameters.",AwaitUsingNotInAsyncContext:"'await using' is only allowed within async functions and at the top levels of modules.",AwaitNotInAsyncContext:"'await' is only allowed within async functions and at the top levels of modules.",BadGetterArity:"A 'get' accessor must not have any formal parameters.",BadSetterArity:"A 'set' accessor must have exactly one formal parameter.",BadSetterRestParameter:"A 'set' accessor function argument must not be a rest parameter.",ConstructorClassField:"Classes may not have a field named 'constructor'.",ConstructorClassPrivateField:"Classes may not have a private field named '#constructor'.",ConstructorIsAccessor:"Class constructor may not be an accessor.",ConstructorIsAsync:"Constructor can't be an async function.",ConstructorIsGenerator:"Constructor can't be a generator.",DeclarationMissingInitializer:function(e){return"Missing initializer in "+e.kind+" declaration."},DecoratorArgumentsOutsideParentheses:"Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.",DecoratorBeforeExport:"Decorators must be placed *before* the 'export' keyword. Remove the 'decoratorsBeforeExport: true' option to use the 'export @decorator class {}' syntax.",DecoratorsBeforeAfterExport:"Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time.",DecoratorConstructor:"Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",DecoratorExportClass:"Decorators must be placed *after* the 'export' keyword. Remove the 'decoratorsBeforeExport: false' option to use the '@decorator export class {}' syntax.",DecoratorSemicolon:"Decorators must not be followed by a semicolon.",DecoratorStaticBlock:"Decorators can't be used with a static block.",DeferImportRequiresNamespace:'Only `import defer * as x from "./module"` is valid.',DeletePrivateField:"Deleting a private field is not allowed.",DestructureNamedImport:"ES2015 named imports do not destructure. Use another statement for destructuring after the import.",DuplicateConstructor:"Duplicate constructor in the same class.",DuplicateDefaultExport:"Only one default export allowed per module.",DuplicateExport:function(e){return"`"+e.exportName+"` has already been exported. Exported identifiers must be unique."},DuplicateProto:"Redefinition of __proto__ property.",DuplicateRegExpFlags:"Duplicate regular expression flag.",ElementAfterRest:"Rest element must be last element.",EscapedCharNotAnIdentifier:"Invalid Unicode escape.",ExportBindingIsString:function(e){return"A string literal cannot be used as an exported binding without `from`.\n- Did you mean `export { '"+e.localName+"' as '"+e.exportName+"' } from 'some-module'`?"},ExportDefaultFromAsIdentifier:"'from' is not allowed as an identifier after 'export default'.",ForInOfLoopInitializer:function(e){return"'"+("ForInStatement"===e.type?"for-in":"for-of")+"' loop variable declaration may not have an initializer."},ForInUsing:"For-in loop may not start with 'using' declaration.",ForOfAsync:"The left-hand side of a for-of loop may not be 'async'.",ForOfLet:"The left-hand side of a for-of loop may not start with 'let'.",GeneratorInSingleStatementContext:"Generators can only be declared at the top level or inside a block.",IllegalBreakContinue:function(e){return"Unsyntactic "+("BreakStatement"===e.type?"break":"continue")+"."},IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list.",IllegalReturn:"'return' outside of function.",ImportAttributesUseAssert:"The `assert` keyword in import attributes is deprecated and it has been replaced by the `with` keyword. You can enable the `deprecatedImportAssert` parser plugin to suppress this error.",ImportBindingIsString:function(e){return'A string literal cannot be used as an imported binding.\n- Did you mean `import { "'+e.importName+'" as foo }`?'},ImportCallArity:"`import()` requires exactly one or two arguments.",ImportCallNotNewExpression:"Cannot use new with import(...).",ImportCallSpreadArgument:"`...` is not allowed in `import()`.",ImportJSONBindingNotDefault:"A JSON module can only be imported with `default`.",ImportReflectionHasAssertion:"`import module x` cannot have assertions.",ImportReflectionNotBinding:'Only `import module x from "./module"` is valid.',IncompatibleRegExpUVFlags:"The 'u' and 'v' regular expression flags cannot be enabled at the same time.",InvalidBigIntLiteral:"Invalid BigIntLiteral.",InvalidCodePoint:"Code point out of bounds.",InvalidCoverInitializedName:"Invalid shorthand property initializer.",InvalidDecimal:"Invalid decimal.",InvalidDigit:function(e){return"Expected number in radix "+e.radix+"."},InvalidEscapeSequence:"Bad character escape sequence.",InvalidEscapeSequenceTemplate:"Invalid escape sequence in template.",InvalidEscapedReservedWord:function(e){return"Escape sequence in keyword "+e.reservedWord+"."},InvalidIdentifier:function(e){return"Invalid identifier "+e.identifierName+"."},InvalidLhs:function(e){var t=e.ancestor;return"Invalid left-hand side in "+oh(t)+"."},InvalidLhsBinding:function(e){var t=e.ancestor;return"Binding invalid left-hand side in "+oh(t)+"."},InvalidLhsOptionalChaining:function(e){var t=e.ancestor;return"Invalid optional chaining in the left-hand side of "+oh(t)+"."},InvalidNumber:"Invalid number.",InvalidOrMissingExponent:"Floating-point numbers require a valid exponent after the 'e'.",InvalidOrUnexpectedToken:function(e){return"Unexpected character '"+e.unexpected+"'."},InvalidParenthesizedAssignment:"Invalid parenthesized assignment pattern.",InvalidPrivateFieldResolution:function(e){return"Private name #"+e.identifierName+" is not defined."},InvalidPropertyBindingPattern:"Binding member expression.",InvalidRecordProperty:"Only properties and spread elements are allowed in record definitions.",InvalidRestAssignmentPattern:"Invalid rest operator's argument.",LabelRedeclaration:function(e){return"Label '"+e.labelName+"' is already declared."},LetInLexicalBinding:"'let' is disallowed as a lexically bound name.",LineTerminatorBeforeArrow:"No line break is allowed before '=>'.",MalformedRegExpFlags:"Invalid regular expression flag.",MissingClassName:"A class name is required.",MissingEqInAssignment:"Only '=' operator can be used for specifying default value.",MissingSemicolon:"Missing semicolon.",MissingPlugin:function(e){return"This experimental syntax requires enabling the parser plugin: "+e.missingPlugin.map((function(e){return JSON.stringify(e)})).join(", ")+"."},MissingOneOfPlugins:function(e){return"This experimental syntax requires enabling one of the following parser plugin(s): "+e.missingPlugin.map((function(e){return JSON.stringify(e)})).join(", ")+"."},MissingUnicodeEscape:"Expecting Unicode escape sequence \\uXXXX.",MixingCoalesceWithLogical:"Nullish coalescing operator(??) requires parens when mixing with logical operators.",ModuleAttributeDifferentFromType:"The only accepted module attribute is `type`.",ModuleAttributeInvalidValue:"Only string literals are allowed as module attribute values.",ModuleAttributesWithDuplicateKeys:function(e){return'Duplicate key "'+e.key+'" is not allowed in module attributes.'},ModuleExportNameHasLoneSurrogate:function(e){return"An export name cannot include a lone surrogate, found '\\u"+e.surrogateCharCode.toString(16)+"'."},ModuleExportUndefined:function(e){return"Export '"+e.localName+"' is not defined."},MultipleDefaultsInSwitch:"Multiple default clauses.",NewlineAfterThrow:"Illegal newline after throw.",NoCatchOrFinally:"Missing catch or finally clause.",NumberIdentifier:"Identifier directly after number.",NumericSeparatorInEscapeSequence:"Numeric separators are not allowed inside unicode escape sequences or hex escape sequences.",ObsoleteAwaitStar:"'await*' has been removed from the async functions proposal. Use Promise.all() instead.",OptionalChainingNoNew:"Constructors in/after an Optional Chain are not allowed.",OptionalChainingNoTemplate:"Tagged Template Literals are not allowed in optionalChain.",OverrideOnConstructor:"'override' modifier cannot appear on a constructor declaration.",ParamDupe:"Argument name clash.",PatternHasAccessor:"Object pattern can't contain getter or setter.",PatternHasMethod:"Object pattern can't contain methods.",PrivateInExpectedIn:function(e){var t=e.identifierName;return"Private names are only allowed in property accesses (`obj.#"+t+"`) or in `in` expressions (`#"+t+" in obj`)."},PrivateNameRedeclaration:function(e){return"Duplicate private name #"+e.identifierName+"."},RecordExpressionBarIncorrectEndSyntaxType:"Record expressions ending with '|}' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",RecordExpressionBarIncorrectStartSyntaxType:"Record expressions starting with '{|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",RecordExpressionHashIncorrectStartSyntaxType:"Record expressions starting with '#{' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",RecordNoProto:"'__proto__' is not allowed in Record expressions.",RestTrailingComma:"Unexpected trailing comma after rest element.",SloppyFunction:"In non-strict mode code, functions can only be declared at top level or inside a block.",SloppyFunctionAnnexB:"In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement.",SourcePhaseImportRequiresDefault:'Only `import source x from "./module"` is valid.',StaticPrototype:"Classes may not have static property named prototype.",SuperNotAllowed:"`super()` is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?",SuperPrivateField:"Private fields can't be accessed on super.",TrailingDecorator:"Decorators must be attached to a class element.",TupleExpressionBarIncorrectEndSyntaxType:"Tuple expressions ending with '|]' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",TupleExpressionBarIncorrectStartSyntaxType:"Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",TupleExpressionHashIncorrectStartSyntaxType:"Tuple expressions starting with '#[' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",UnexpectedArgumentPlaceholder:"Unexpected argument placeholder.",UnexpectedAwaitAfterPipelineBody:'Unexpected "await" after pipeline body; await must have parentheses in minimal proposal.',UnexpectedDigitAfterHash:"Unexpected digit after hash token.",UnexpectedImportExport:"'import' and 'export' may only appear at the top level.",UnexpectedKeyword:function(e){return"Unexpected keyword '"+e.keyword+"'."},UnexpectedLeadingDecorator:"Leading decorators must be attached to a class declaration.",UnexpectedLexicalDeclaration:"Lexical declaration cannot appear in a single-statement context.",UnexpectedNewTarget:"`new.target` can only be used in functions or class properties.",UnexpectedNumericSeparator:"A numeric separator is only allowed between two digits.",UnexpectedPrivateField:"Unexpected private name.",UnexpectedReservedWord:function(e){return"Unexpected reserved word '"+e.reservedWord+"'."},UnexpectedSuper:"'super' is only allowed in object methods and classes.",UnexpectedToken:function(e){var t=e.expected,r=e.unexpected;return"Unexpected token"+(r?" '"+r+"'.":"")+(t?', expected "'+t+'"':"")},UnexpectedTokenUnaryExponentiation:"Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",UnexpectedUsingDeclaration:"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement.",UnsupportedBind:"Binding should be performed on object property.",UnsupportedDecoratorExport:"A decorated export must export a class declaration.",UnsupportedDefaultExport:"Only expressions, functions or classes are allowed as the `default` export.",UnsupportedImport:"`import` can only be used in `import()` or `import.meta`.",UnsupportedMetaProperty:function(e){var t=e.target;return"The only valid meta property for "+t+" is "+t+"."+e.onlyValidPropertyName+"."},UnsupportedParameterDecorator:"Decorators cannot be used to decorate parameters.",UnsupportedPropertyDecorator:"Decorators cannot be used to decorate object literal properties.",UnsupportedSuper:"'super' can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]).",UnterminatedComment:"Unterminated comment.",UnterminatedRegExp:"Unterminated regular expression.",UnterminatedString:"Unterminated string constant.",UnterminatedTemplate:"Unterminated template.",UsingDeclarationExport:"Using declaration cannot be exported.",UsingDeclarationHasBindingPattern:"Using declaration cannot have destructuring patterns.",VarRedeclaration:function(e){return"Identifier '"+e.identifierName+"' has already been declared."},YieldBindingIdentifier:"Can not use 'yield' as identifier inside a generator.",YieldInParameter:"Yield expression is not allowed in formal parameters.",YieldNotInGeneratorFunction:"'yield' is only allowed within generator functions.",ZeroDigitNumericSeparator:"Numeric separator can not be used after leading 0."},dh={ParseExpressionEmptyInput:"Unexpected parseExpression() input: The input is empty or contains only comments.",ParseExpressionExpectsEOF:function(e){var t=e.unexpected;return"Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character `"+String.fromCodePoint(t)+"`."}},ch=new Set(["ArrowFunctionExpression","AssignmentExpression","ConditionalExpression","YieldExpression"]),lh=Object.assign({PipeBodyIsTighter:"Unexpected yield after pipeline body; any yield expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence.",PipeTopicRequiresHackPipes:'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.',PipeTopicUnbound:"Topic reference is unbound; it must be inside a pipe body.",PipeTopicUnconfiguredToken:function(e){var t=e.token;return"Invalid topic token "+t+". In order to use "+t+' as a topic reference, the pipelineOperator plugin must be configured with { "proposal": "hack", "topicToken": "'+t+'" }.'},PipeTopicUnused:"Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.",PipeUnparenthesizedBody:function(e){var t=e.type;return"Hack-style pipe body cannot be an unparenthesized "+oh({type:t})+"; please wrap it in parentheses."}},{PipelineBodyNoArrow:'Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized.',PipelineBodySequenceExpression:"Pipeline body may not be a comma-separated sequence expression.",PipelineHeadSequenceExpression:"Pipeline head should not be a comma-separated sequence expression.",PipelineTopicUnused:"Pipeline is in topic style but does not use topic reference.",PrimaryTopicNotAllowed:"Topic reference was used in a lexical context without topic binding.",PrimaryTopicRequiresSmartPipeline:'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'}),uh=["message"];function ph(e,t,r){Object.defineProperty(e,t,{enumerable:!1,configurable:!0,value:r})}function fh(e,t){if(Array.isArray(e))return function(t){return fh(t,e[0])};for(var r={},a=function(){var a=s[n],o=e[a],i="string"==typeof o?{message:function(){return o}}:"function"==typeof o?{message:o}:o,d=i.message,c=u(i,uh),l="string"==typeof d?function(){return d}:d;r[a]=function(e){var t=e.toMessage,r=e.code,a=e.reasonCode,n=e.syntaxPlugin,s="MissingPlugin"===a||"MissingOneOfPlugins"===a,o={AccessorCannotDeclareThisParameter:"AccesorCannotDeclareThisParameter",AccessorCannotHaveTypeParameters:"AccesorCannotHaveTypeParameters",ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference:"ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference",SetAccessorCannotHaveOptionalParameter:"SetAccesorCannotHaveOptionalParameter",SetAccessorCannotHaveRestParameter:"SetAccesorCannotHaveRestParameter",SetAccessorCannotHaveReturnType:"SetAccesorCannotHaveReturnType"};return o[a]&&(a=o[a]),function e(o,i){var d=new SyntaxError;return d.code=r,d.reasonCode=a,d.loc=o,d.pos=o.index,d.syntaxPlugin=n,s&&(d.missingPlugin=i.missingPlugin),ph(d,"clone",(function(t){var r;void 0===t&&(t={});var a=null!=(r=t.loc)?r:o,n=a.line,s=a.column,d=a.index;return e(new Zm(n,s,d),Object.assign({},i,t.details))})),ph(d,"details",i),Object.defineProperty(d,"message",{configurable:!0,get:function(){var e=t(i)+" ("+o.line+":"+o.column+")";return this.message=e,e},set:function(e){Object.defineProperty(this,"message",{value:e,writable:!0})}}),d}}(Object.assign({code:"BABEL_PARSER_SYNTAX_ERROR",reasonCode:a,toMessage:l},t?{syntaxPlugin:t}:{},c))},n=0,s=Object.keys(e);n...",!0)};Dh.template=new Ih("`",!0);var Oh=!0,Nh=!0,Bh=!0,Mh=!0,Fh=!0,Lh=o((function(e,t){void 0===t&&(t={}),this.label=void 0,this.keyword=void 0,this.beforeExpr=void 0,this.startsExpr=void 0,this.rightAssociative=void 0,this.isLoop=void 0,this.isAssign=void 0,this.prefix=void 0,this.postfix=void 0,this.binop=void 0,this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.rightAssociative=!!t.rightAssociative,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=null!=t.binop?t.binop:null,this.updateContext=null})),Uh=new Map;function qh(e,t){void 0===t&&(t={}),t.keyword=e;var r=Yh(e,t);return Uh.set(e,r),r}function Gh(e,t){return Yh(e,{beforeExpr:Oh,binop:t})}var Wh=-1,Vh=[],Hh=[],Kh=[],zh=[],Xh=[],Jh=[];function Yh(e,t){var r,a,n,s;return void 0===t&&(t={}),++Wh,Hh.push(e),Kh.push(null!=(r=t.binop)?r:-1),zh.push(null!=(a=t.beforeExpr)&&a),Xh.push(null!=(n=t.startsExpr)&&n),Jh.push(null!=(s=t.prefix)&&s),Vh.push(new Lh(e,t)),Wh}function $h(e,t){var r,a,n,s;return void 0===t&&(t={}),++Wh,Uh.set(e,Wh),Hh.push(e),Kh.push(null!=(r=t.binop)?r:-1),zh.push(null!=(a=t.beforeExpr)&&a),Xh.push(null!=(n=t.startsExpr)&&n),Jh.push(null!=(s=t.prefix)&&s),Vh.push(new Lh("name",t)),Wh}var Qh={bracketL:Yh("[",{beforeExpr:Oh,startsExpr:Nh}),bracketHashL:Yh("#[",{beforeExpr:Oh,startsExpr:Nh}),bracketBarL:Yh("[|",{beforeExpr:Oh,startsExpr:Nh}),bracketR:Yh("]"),bracketBarR:Yh("|]"),braceL:Yh("{",{beforeExpr:Oh,startsExpr:Nh}),braceBarL:Yh("{|",{beforeExpr:Oh,startsExpr:Nh}),braceHashL:Yh("#{",{beforeExpr:Oh,startsExpr:Nh}),braceR:Yh("}"),braceBarR:Yh("|}"),parenL:Yh("(",{beforeExpr:Oh,startsExpr:Nh}),parenR:Yh(")"),comma:Yh(",",{beforeExpr:Oh}),semi:Yh(";",{beforeExpr:Oh}),colon:Yh(":",{beforeExpr:Oh}),doubleColon:Yh("::",{beforeExpr:Oh}),dot:Yh("."),question:Yh("?",{beforeExpr:Oh}),questionDot:Yh("?."),arrow:Yh("=>",{beforeExpr:Oh}),template:Yh("template"),ellipsis:Yh("...",{beforeExpr:Oh}),backQuote:Yh("`",{startsExpr:Nh}),dollarBraceL:Yh("${",{beforeExpr:Oh,startsExpr:Nh}),templateTail:Yh("...`",{startsExpr:Nh}),templateNonTail:Yh("...${",{beforeExpr:Oh,startsExpr:Nh}),at:Yh("@"),hash:Yh("#",{startsExpr:Nh}),interpreterDirective:Yh("#!..."),eq:Yh("=",{beforeExpr:Oh,isAssign:Mh}),assign:Yh("_=",{beforeExpr:Oh,isAssign:Mh}),slashAssign:Yh("_=",{beforeExpr:Oh,isAssign:Mh}),xorAssign:Yh("_=",{beforeExpr:Oh,isAssign:Mh}),moduloAssign:Yh("_=",{beforeExpr:Oh,isAssign:Mh}),incDec:Yh("++/--",{prefix:Fh,postfix:!0,startsExpr:Nh}),bang:Yh("!",{beforeExpr:Oh,prefix:Fh,startsExpr:Nh}),tilde:Yh("~",{beforeExpr:Oh,prefix:Fh,startsExpr:Nh}),doubleCaret:Yh("^^",{startsExpr:Nh}),doubleAt:Yh("@@",{startsExpr:Nh}),pipeline:Gh("|>",0),nullishCoalescing:Gh("??",1),logicalOR:Gh("||",1),logicalAND:Gh("&&",2),bitwiseOR:Gh("|",3),bitwiseXOR:Gh("^",4),bitwiseAND:Gh("&",5),equality:Gh("==/!=/===/!==",6),lt:Gh("/<=/>=",7),gt:Gh("/<=/>=",7),relational:Gh("/<=/>=",7),bitShift:Gh("<>/>>>",8),bitShiftL:Gh("<>/>>>",8),bitShiftR:Gh("<>/>>>",8),plusMin:Yh("+/-",{beforeExpr:Oh,binop:9,prefix:Fh,startsExpr:Nh}),modulo:Yh("%",{binop:10,startsExpr:Nh}),star:Yh("*",{binop:10}),slash:Gh("/",10),exponent:Yh("**",{beforeExpr:Oh,binop:11,rightAssociative:!0}),_in:qh("in",{beforeExpr:Oh,binop:7}),_instanceof:qh("instanceof",{beforeExpr:Oh,binop:7}),_break:qh("break"),_case:qh("case",{beforeExpr:Oh}),_catch:qh("catch"),_continue:qh("continue"),_debugger:qh("debugger"),_default:qh("default",{beforeExpr:Oh}),_else:qh("else",{beforeExpr:Oh}),_finally:qh("finally"),_function:qh("function",{startsExpr:Nh}),_if:qh("if"),_return:qh("return",{beforeExpr:Oh}),_switch:qh("switch"),_throw:qh("throw",{beforeExpr:Oh,prefix:Fh,startsExpr:Nh}),_try:qh("try"),_var:qh("var"),_const:qh("const"),_with:qh("with"),_new:qh("new",{beforeExpr:Oh,startsExpr:Nh}),_this:qh("this",{startsExpr:Nh}),_super:qh("super",{startsExpr:Nh}),_class:qh("class",{startsExpr:Nh}),_extends:qh("extends",{beforeExpr:Oh}),_export:qh("export"),_import:qh("import",{startsExpr:Nh}),_null:qh("null",{startsExpr:Nh}),_true:qh("true",{startsExpr:Nh}),_false:qh("false",{startsExpr:Nh}),_typeof:qh("typeof",{beforeExpr:Oh,prefix:Fh,startsExpr:Nh}),_void:qh("void",{beforeExpr:Oh,prefix:Fh,startsExpr:Nh}),_delete:qh("delete",{beforeExpr:Oh,prefix:Fh,startsExpr:Nh}),_do:qh("do",{isLoop:Bh,beforeExpr:Oh}),_for:qh("for",{isLoop:Bh}),_while:qh("while",{isLoop:Bh}),_as:$h("as",{startsExpr:Nh}),_assert:$h("assert",{startsExpr:Nh}),_async:$h("async",{startsExpr:Nh}),_await:$h("await",{startsExpr:Nh}),_defer:$h("defer",{startsExpr:Nh}),_from:$h("from",{startsExpr:Nh}),_get:$h("get",{startsExpr:Nh}),_let:$h("let",{startsExpr:Nh}),_meta:$h("meta",{startsExpr:Nh}),_of:$h("of",{startsExpr:Nh}),_sent:$h("sent",{startsExpr:Nh}),_set:$h("set",{startsExpr:Nh}),_source:$h("source",{startsExpr:Nh}),_static:$h("static",{startsExpr:Nh}),_using:$h("using",{startsExpr:Nh}),_yield:$h("yield",{startsExpr:Nh}),_asserts:$h("asserts",{startsExpr:Nh}),_checks:$h("checks",{startsExpr:Nh}),_exports:$h("exports",{startsExpr:Nh}),_global:$h("global",{startsExpr:Nh}),_implements:$h("implements",{startsExpr:Nh}),_intrinsic:$h("intrinsic",{startsExpr:Nh}),_infer:$h("infer",{startsExpr:Nh}),_is:$h("is",{startsExpr:Nh}),_mixins:$h("mixins",{startsExpr:Nh}),_proto:$h("proto",{startsExpr:Nh}),_require:$h("require",{startsExpr:Nh}),_satisfies:$h("satisfies",{startsExpr:Nh}),_keyof:$h("keyof",{startsExpr:Nh}),_readonly:$h("readonly",{startsExpr:Nh}),_unique:$h("unique",{startsExpr:Nh}),_abstract:$h("abstract",{startsExpr:Nh}),_declare:$h("declare",{startsExpr:Nh}),_enum:$h("enum",{startsExpr:Nh}),_module:$h("module",{startsExpr:Nh}),_namespace:$h("namespace",{startsExpr:Nh}),_interface:$h("interface",{startsExpr:Nh}),_type:$h("type",{startsExpr:Nh}),_opaque:$h("opaque",{startsExpr:Nh}),name:Yh("name",{startsExpr:Nh}),placeholder:Yh("%%",{startsExpr:!0}),string:Yh("string",{startsExpr:Nh}),num:Yh("num",{startsExpr:Nh}),bigint:Yh("bigint",{startsExpr:Nh}),decimal:Yh("decimal",{startsExpr:Nh}),regexp:Yh("regexp",{startsExpr:Nh}),privateName:Yh("#name",{startsExpr:Nh}),eof:Yh("eof"),jsxName:Yh("jsxName"),jsxText:Yh("jsxText",{beforeExpr:!0}),jsxTagStart:Yh("jsxTagStart",{startsExpr:!0}),jsxTagEnd:Yh("jsxTagEnd")};function Zh(e){return e>=93&&e<=133}function eb(e){return e>=58&&e<=133}function tb(e){return e>=58&&e<=137}function rb(e){return Xh[e]}function ab(e){return e>=129&&e<=131}function nb(e){return e>=58&&e<=92}function sb(e){return Hh[e]}function ob(e){return Kh[e]}function ib(e){return e>=24&&e<=25}function db(e){return Vh[e]}Vh[8].updateContext=function(e){e.pop()},Vh[5].updateContext=Vh[7].updateContext=Vh[23].updateContext=function(e){e.push(Dh.brace)},Vh[22].updateContext=function(e){e[e.length-1]===Dh.template?e.pop():e.push(Dh.template)},Vh[143].updateContext=function(e){e.push(Dh.j_expr,Dh.j_oTag)};var cb=new Set(["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete","implements","interface","let","package","private","protected","public","static","yield","eval","arguments","enum","await"]);var lb,ub=0,pb=1,fb=2,gb=4,yb=8,mb=16,hb=32,bb=64,vb=128,xb=256,Rb=512,jb=643,wb=1,Eb=2,Sb=4,Tb=8,Pb=16,Ab=128,kb=256,Cb=512,_b=1024,Ib=2048,Db=4096,Ob=8192,Nb=8331,Bb=8201,Mb=9,Fb=5,Lb=17,Ub=130,qb=2,Gb=8459,Wb=1024,Vb=64,Hb=65,Kb=8971,zb=1024,Xb=4098,Jb=4096,Yb=2048,$b=0,Qb=4,Zb=3,ev=6,tv=5,rv=2,av=1,nv=1,sv=2,ov=4,iv=o((function(e){this.flags=0,this.names=new Map,this.firstLexicalName="",this.flags=e})),dv=function(){function e(e,t){this.parser=void 0,this.scopeStack=[],this.inModule=void 0,this.undefinedExports=new Map,this.parser=e,this.inModule=t}var t=e.prototype;return t.createScope=function(e){return new iv(e)},t.enter=function(e){this.scopeStack.push(this.createScope(e))},t.exit=function(){return this.scopeStack.pop().flags},t.treatFunctionsAsVarInScope=function(e){return!!(e.flags&(fb|vb)||!this.parser.inModule&&e.flags&pb)},t.declareName=function(e,t,r){var a=this.currentScope();if(t&Tb||t&Pb){this.checkRedeclarationInScope(a,e,t,r);var n=a.names.get(e)||0;t&Pb?n|=ov:(a.firstLexicalName||(a.firstLexicalName=e),n|=sv),a.names.set(e,n),t&Tb&&this.maybeExportDefined(a,e)}else if(t&Sb)for(var s=this.scopeStack.length-1;s>=0&&(a=this.scopeStack[s],this.checkRedeclarationInScope(a,e,t,r),a.names.set(e,(a.names.get(e)||0)|nv),this.maybeExportDefined(a,e),!(a.flags&jb));--s);this.parser.inModule&&a.flags&pb&&this.undefinedExports.delete(e)},t.maybeExportDefined=function(e,t){this.parser.inModule&&e.flags&pb&&this.undefinedExports.delete(t)},t.checkRedeclarationInScope=function(e,t,r,a){this.isRedeclaredInScope(e,t,r)&&this.parser.raise(gh.VarRedeclaration,a,{identifierName:t})},t.isRedeclaredInScope=function(e,t,r){if(!(r&wb))return!1;if(r&Tb)return e.names.has(t);var a=e.names.get(t);return r&Pb?(a&sv)>0||!this.treatFunctionsAsVarInScope(e)&&(a&nv)>0:(a&sv)>0&&!(e.flags&yb&&e.firstLexicalName===t)||!this.treatFunctionsAsVarInScope(e)&&(a&ov)>0},t.checkLocalExport=function(e){var t=e.name;this.scopeStack[0].names.has(t)||this.undefinedExports.set(t,e.loc.start)},t.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},t.currentVarScopeFlags=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e].flags;if(t&jb)return t}},t.currentThisScopeFlags=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e].flags;if(t&(jb|bb)&&!(t&gb))return t}},o(e,[{key:"inTopLevel",get:function(){return(this.currentScope().flags&pb)>0}},{key:"inFunction",get:function(){return(this.currentVarScopeFlags()&fb)>0}},{key:"allowSuper",get:function(){return(this.currentThisScopeFlags()&mb)>0}},{key:"allowDirectSuper",get:function(){return(this.currentThisScopeFlags()&hb)>0}},{key:"inClass",get:function(){return(this.currentThisScopeFlags()&bb)>0}},{key:"inClassAndNotInNonArrowFunction",get:function(){var e=this.currentThisScopeFlags();return(e&bb)>0&&0==(e&fb)}},{key:"inStaticBlock",get:function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e].flags;if(t&vb)return!0;if(t&(jb|bb))return!1}}},{key:"inNonArrowFunction",get:function(){return(this.currentThisScopeFlags()&fb)>0}},{key:"inBareCaseStatement",get:function(){return(this.currentScope().flags&xb)>0}},{key:"treatFunctionsAsVar",get:function(){return this.treatFunctionsAsVarInScope(this.currentScope())}}])}(),cv=function(e){function t(){for(var t,r=arguments.length,a=new Array(r),n=0;n0||(n&sv)>0}return!1},r.checkLocalExport=function(t){this.scopeStack[0].declareFunctions.has(t.name)||e.prototype.checkLocalExport.call(this,t)},o(t)}(dv),uv=new Set(["_","any","bool","boolean","empty","extends","false","interface","mixed","null","number","static","string","true","typeof","void"]),pv=fh(lb||(lb=y(["flow"])))({AmbiguousConditionalArrow:"Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.",AmbiguousDeclareModuleKind:"Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module.",AssignReservedType:function(e){return"Cannot overwrite reserved type "+e.reservedType+"."},DeclareClassElement:"The `declare` modifier can only appear on class fields.",DeclareClassFieldInitializer:"Initializers are not allowed in fields with the `declare` modifier.",DuplicateDeclareModuleExports:"Duplicate `declare module.exports` statement.",EnumBooleanMemberNotInitialized:function(e){var t=e.memberName;return"Boolean enum members need to be initialized. Use either `"+t+" = true,` or `"+t+" = false,` in enum `"+e.enumName+"`."},EnumDuplicateMemberName:function(e){return"Enum member names need to be unique, but the name `"+e.memberName+"` has already been used before in enum `"+e.enumName+"`."},EnumInconsistentMemberValues:function(e){return"Enum `"+e.enumName+"` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers."},EnumInvalidExplicitType:function(e){return"Enum type `"+e.invalidEnumType+"` is not valid. Use one of `boolean`, `number`, `string`, or `symbol` in enum `"+e.enumName+"`."},EnumInvalidExplicitTypeUnknownSupplied:function(e){return"Supplied enum type is not valid. Use one of `boolean`, `number`, `string`, or `symbol` in enum `"+e.enumName+"`."},EnumInvalidMemberInitializerPrimaryType:function(e){var t=e.enumName,r=e.memberName,a=e.explicitType;return"Enum `"+t+"` has type `"+a+"`, so the initializer of `"+r+"` needs to be a "+a+" literal."},EnumInvalidMemberInitializerSymbolType:function(e){var t=e.enumName;return"Symbol enum members cannot be initialized. Use `"+e.memberName+",` in enum `"+t+"`."},EnumInvalidMemberInitializerUnknownType:function(e){var t=e.enumName;return"The enum member initializer for `"+e.memberName+"` needs to be a literal (either a boolean, number, or string) in enum `"+t+"`."},EnumInvalidMemberName:function(e){var t=e.enumName;return"Enum member names cannot start with lowercase 'a' through 'z'. Instead of using `"+e.memberName+"`, consider using `"+e.suggestion+"`, in enum `"+t+"`."},EnumNumberMemberNotInitialized:function(e){var t=e.enumName;return"Number enum members need to be initialized, e.g. `"+e.memberName+" = 1` in enum `"+t+"`."},EnumStringMemberInconsistentlyInitialized:function(e){return"String enum members need to consistently either all use initializers, or use no initializers, in enum `"+e.enumName+"`."},GetterMayNotHaveThisParam:"A getter cannot have a `this` parameter.",ImportReflectionHasImportType:"An `import module` declaration can not use `type` or `typeof` keyword.",ImportTypeShorthandOnlyInPureImport:"The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements.",InexactInsideExact:"Explicit inexact syntax cannot appear inside an explicit exact object type.",InexactInsideNonObject:"Explicit inexact syntax cannot appear in class or interface definitions.",InexactVariance:"Explicit inexact syntax cannot have variance.",InvalidNonTypeImportInDeclareModule:"Imports within a `declare module` body must always be `import type` or `import typeof`.",MissingTypeParamDefault:"Type parameter declaration needs a default, since a preceding type parameter declaration has a default.",NestedDeclareModule:"`declare module` cannot be used inside another `declare module`.",NestedFlowComment:"Cannot have a flow comment inside another flow comment.",PatternIsOptional:Object.assign({message:"A binding pattern parameter cannot be optional in an implementation signature."},{reasonCode:"OptionalBindingPattern"}),SetterMayNotHaveThisParam:"A setter cannot have a `this` parameter.",SpreadVariance:"Spread properties cannot have variance.",ThisParamAnnotationRequired:"A type annotation is required for the `this` parameter.",ThisParamBannedInConstructor:"Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions.",ThisParamMayNotBeOptional:"The `this` parameter cannot be optional.",ThisParamMustBeFirst:"The `this` parameter must be the first function parameter.",ThisParamNoDefault:"The `this` parameter may not have a default value.",TypeBeforeInitializer:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeCastInPattern:"The type cast expression is expected to be wrapped with parenthesis.",UnexpectedExplicitInexactInObject:"Explicit inexact syntax must appear at the end of an inexact object.",UnexpectedReservedType:function(e){return"Unexpected reserved type "+e.reservedType+"."},UnexpectedReservedUnderscore:"`_` is only allowed as a type argument to call or new.",UnexpectedSpaceBetweenModuloChecks:"Spaces between `%` and `checks` are not allowed here.",UnexpectedSpreadType:"Spread operator cannot appear in class or interface definitions.",UnexpectedSubtractionOperand:'Unexpected token, expected "number" or "bigint".',UnexpectedTokenAfterTypeParameter:"Expected an arrow function after this type parameter declaration.",UnexpectedTypeParameterBeforeAsyncArrowFunction:"Type parameters must come after the async keyword, e.g. instead of ` async () => {}`, use `async () => {}`.",UnsupportedDeclareExportKind:function(e){return"`declare export "+e.unsupportedExportKind+"` is not supported. Use `"+e.suggestion+"` instead."},UnsupportedStatementInDeclareModule:"Only declares and type imports are allowed inside declare module.",UnterminatedFlowComment:"Unterminated flow-comment."});function fv(e){return"type"===e.importKind||"typeof"===e.importKind}var gv={const:"declare export var",let:"declare export var",type:"export type",interface:"export interface"};var yv=/\*?\s*@((?:no)?flow)\b/,mv={__proto__:null,quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:"\xa0",iexcl:"\xa1",cent:"\xa2",pound:"\xa3",curren:"\xa4",yen:"\xa5",brvbar:"\xa6",sect:"\xa7",uml:"\xa8",copy:"\xa9",ordf:"\xaa",laquo:"\xab",not:"\xac",shy:"\xad",reg:"\xae",macr:"\xaf",deg:"\xb0",plusmn:"\xb1",sup2:"\xb2",sup3:"\xb3",acute:"\xb4",micro:"\xb5",para:"\xb6",middot:"\xb7",cedil:"\xb8",sup1:"\xb9",ordm:"\xba",raquo:"\xbb",frac14:"\xbc",frac12:"\xbd",frac34:"\xbe",iquest:"\xbf",Agrave:"\xc0",Aacute:"\xc1",Acirc:"\xc2",Atilde:"\xc3",Auml:"\xc4",Aring:"\xc5",AElig:"\xc6",Ccedil:"\xc7",Egrave:"\xc8",Eacute:"\xc9",Ecirc:"\xca",Euml:"\xcb",Igrave:"\xcc",Iacute:"\xcd",Icirc:"\xce",Iuml:"\xcf",ETH:"\xd0",Ntilde:"\xd1",Ograve:"\xd2",Oacute:"\xd3",Ocirc:"\xd4",Otilde:"\xd5",Ouml:"\xd6",times:"\xd7",Oslash:"\xd8",Ugrave:"\xd9",Uacute:"\xda",Ucirc:"\xdb",Uuml:"\xdc",Yacute:"\xdd",THORN:"\xde",szlig:"\xdf",agrave:"\xe0",aacute:"\xe1",acirc:"\xe2",atilde:"\xe3",auml:"\xe4",aring:"\xe5",aelig:"\xe6",ccedil:"\xe7",egrave:"\xe8",eacute:"\xe9",ecirc:"\xea",euml:"\xeb",igrave:"\xec",iacute:"\xed",icirc:"\xee",iuml:"\xef",eth:"\xf0",ntilde:"\xf1",ograve:"\xf2",oacute:"\xf3",ocirc:"\xf4",otilde:"\xf5",ouml:"\xf6",divide:"\xf7",oslash:"\xf8",ugrave:"\xf9",uacute:"\xfa",ucirc:"\xfb",uuml:"\xfc",yacute:"\xfd",thorn:"\xfe",yuml:"\xff",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",fnof:"\u0192",circ:"\u02c6",tilde:"\u02dc",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039a",Lambda:"\u039b",Mu:"\u039c",Nu:"\u039d",Xi:"\u039e",Omicron:"\u039f",Pi:"\u03a0",Rho:"\u03a1",Sigma:"\u03a3",Tau:"\u03a4",Upsilon:"\u03a5",Phi:"\u03a6",Chi:"\u03a7",Psi:"\u03a8",Omega:"\u03a9",alpha:"\u03b1",beta:"\u03b2",gamma:"\u03b3",delta:"\u03b4",epsilon:"\u03b5",zeta:"\u03b6",eta:"\u03b7",theta:"\u03b8",iota:"\u03b9",kappa:"\u03ba",lambda:"\u03bb",mu:"\u03bc",nu:"\u03bd",xi:"\u03be",omicron:"\u03bf",pi:"\u03c0",rho:"\u03c1",sigmaf:"\u03c2",sigma:"\u03c3",tau:"\u03c4",upsilon:"\u03c5",phi:"\u03c6",chi:"\u03c7",psi:"\u03c8",omega:"\u03c9",thetasym:"\u03d1",upsih:"\u03d2",piv:"\u03d6",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200c",zwj:"\u200d",lrm:"\u200e",rlm:"\u200f",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201a",ldquo:"\u201c",rdquo:"\u201d",bdquo:"\u201e",dagger:"\u2020",Dagger:"\u2021",bull:"\u2022",hellip:"\u2026",permil:"\u2030",prime:"\u2032",Prime:"\u2033",lsaquo:"\u2039",rsaquo:"\u203a",oline:"\u203e",frasl:"\u2044",euro:"\u20ac",image:"\u2111",weierp:"\u2118",real:"\u211c",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21b5",lArr:"\u21d0",uArr:"\u21d1",rArr:"\u21d2",dArr:"\u21d3",hArr:"\u21d4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220b",prod:"\u220f",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221a",prop:"\u221d",infin:"\u221e",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222a",int:"\u222b",there4:"\u2234",sim:"\u223c",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22a5",sdot:"\u22c5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230a",rfloor:"\u230b",lang:"\u2329",rang:"\u232a",loz:"\u25ca",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666"},hv=new RegExp(/\r\n|[\r\n\u2028\u2029]/.source,"g");function bv(e){switch(e){case 10:case 13:case 8232:case 8233:return!0;default:return!1}}function vv(e,t,r){for(var a=t;a."},MissingClosingTagFragment:"Expected corresponding JSX closing tag for <>.",UnexpectedSequenceExpression:"Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?",UnexpectedToken:function(e){var t=e.unexpected;return"Unexpected token `"+t+"`. Did you mean `"+e.HTMLEntity+"` or `{'"+t+"'}`?"},UnsupportedJsxValue:"JSX value should be either an expression or a quoted JSX text.",UnterminatedJsxContent:"Unterminated JSX contents.",UnwrappedAdjacentJSXElements:"Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...?"});function Sv(e){return!!e&&("JSXOpeningFragment"===e.type||"JSXClosingFragment"===e.type)}function Tv(e){if("JSXIdentifier"===e.type)return e.name;if("JSXNamespacedName"===e.type)return e.namespace.name+":"+e.name.name;if("JSXMemberExpression"===e.type)return Tv(e.object)+"."+Tv(e.property);throw new Error("Node had unexpected type: "+e.type)}var Pv=function(e){function t(){for(var t,r=arguments.length,a=new Array(r),n=0;n1)for(var a=0;a0?!(a&kb)||!!(a&Cb)!==(4&n)>0:a&Ab&&(8&n)>0?!!(t.names.get(r)&sv)&&!!(a&wb):!!(a&Eb&&(1&n)>0)||e.prototype.isRedeclaredInScope.call(this,t,r,a)},r.checkLocalExport=function(t){var r=t.name;if(!this.hasImport(r)){for(var a=this.scopeStack.length-1;a>=0;a--){var n=this.scopeStack[a].tsNames.get(r);if((1&n)>0||(16&n)>0)return}e.prototype.checkLocalExport.call(this,t)}},o(t)}(dv),kv=0,Cv=1,_v=2,Iv=4,Dv=8,Ov=function(){function e(){this.stacks=[]}var t=e.prototype;return t.enter=function(e){this.stacks.push(e)},t.exit=function(){this.stacks.pop()},t.currentFlags=function(){return this.stacks[this.stacks.length-1]},o(e,[{key:"hasAwait",get:function(){return(this.currentFlags()&_v)>0}},{key:"hasYield",get:function(){return(this.currentFlags()&Cv)>0}},{key:"hasReturn",get:function(){return(this.currentFlags()&Iv)>0}},{key:"hasIn",get:function(){return(this.currentFlags()&Dv)>0}}])}();function Nv(e,t){return(e?_v:0)|(t?Cv:0)}var Bv=function(){function e(){this.sawUnambiguousESM=!1,this.ambiguousScriptDifferentAst=!1}var t=e.prototype;return t.sourceToOffsetPos=function(e){return e+this.startIndex},t.offsetToSourcePos=function(e){return e-this.startIndex},t.hasPlugin=function(e){if("string"==typeof e)return this.plugins.has(e);var t=e[0],r=e[1];if(!this.hasPlugin(t))return!1;for(var a=this.plugins.get(t),n=0,s=Object.keys(r);n0;)a=t[--n];null===a||a.start>r.start?Fv(e,r.comments):Mv(a,r.comments)}var Uv=function(e){function t(){return e.apply(this,arguments)||this}c(t,e);var r=t.prototype;return r.addComment=function(e){this.filename&&(e.loc.filename=this.filename);var t=this.state.commentsLen;this.comments.length!==t&&(this.comments.length=t),this.comments.push(e),this.state.commentsLen++},r.processComment=function(e){var t=this.state.commentStack,r=t.length;if(0!==r){var a=r-1,n=t[a];n.start===e.end&&(n.leadingNode=e,a--);for(var s=e.start;a>=0;a--){var o=t[a],i=o.end;if(!(i>s)){i===s&&(o.trailingNode=e);break}o.containingNode=e,this.finalizeComment(o),t.splice(a,1)}}},r.finalizeComment=function(e){var t,r=e.comments;if(null!==e.leadingNode||null!==e.trailingNode)null!==e.leadingNode&&Mv(e.leadingNode,r),null!==e.trailingNode&&function(e,t){var r;void 0===e.leadingComments?e.leadingComments=t:(r=e.leadingComments).unshift.apply(r,t)}(e.trailingNode,r);else{var a=e.containingNode,n=e.start;if(44===this.input.charCodeAt(this.offsetToSourcePos(n)-1))switch(a.type){case"ObjectExpression":case"ObjectPattern":case"RecordExpression":Lv(a,a.properties,e);break;case"CallExpression":case"OptionalCallExpression":Lv(a,a.arguments,e);break;case"ImportExpression":Lv(a,[a.source,null!=(t=a.options)?t:null],e);break;case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":case"ObjectMethod":case"ClassMethod":case"ClassPrivateMethod":Lv(a,a.params,e);break;case"ArrayExpression":case"ArrayPattern":case"TupleExpression":Lv(a,a.elements,e);break;case"ExportNamedDeclaration":case"ImportDeclaration":Lv(a,a.specifiers,e);break;case"TSEnumDeclaration":case"TSEnumBody":Lv(a,a.members,e);break;default:Fv(a,r)}else Fv(a,r)}},r.finalizeRemainingComments=function(){for(var e=this.state.commentStack,t=e.length-1;t>=0;t--)this.finalizeComment(e[t]);this.state.commentStack=[]},r.resetPreviousNodeTrailingComments=function(e){var t=this.state.commentStack,r=t.length;if(0!==r){var a=t[r-1];a.leadingNode===e&&(a.leadingNode=null)}},r.takeSurroundingComments=function(e,t,r){var a=this.state.commentStack,n=a.length;if(0!==n)for(var s=n-1;s>=0;s--){var o=a[s],i=o.end;if(o.start===r)o.leadingNode=e;else if(i===t)o.trailingNode=e;else if(i0},set:function(e){e?this.flags|=1:this.flags&=-2}},{key:"maybeInArrowParameters",get:function(){return(2&this.flags)>0},set:function(e){e?this.flags|=2:this.flags&=-3}},{key:"inType",get:function(){return(4&this.flags)>0},set:function(e){e?this.flags|=4:this.flags&=-5}},{key:"noAnonFunctionType",get:function(){return(8&this.flags)>0},set:function(e){e?this.flags|=8:this.flags&=-9}},{key:"hasFlowComment",get:function(){return(16&this.flags)>0},set:function(e){e?this.flags|=16:this.flags&=-17}},{key:"isAmbientContext",get:function(){return(32&this.flags)>0},set:function(e){e?this.flags|=32:this.flags&=-33}},{key:"inAbstractClass",get:function(){return(64&this.flags)>0},set:function(e){e?this.flags|=64:this.flags&=-65}},{key:"inDisallowConditionalTypesContext",get:function(){return(128&this.flags)>0},set:function(e){e?this.flags|=128:this.flags&=-129}},{key:"soloAwait",get:function(){return(256&this.flags)>0},set:function(e){e?this.flags|=256:this.flags&=-257}},{key:"inFSharpPipelineDirectBody",get:function(){return(512&this.flags)>0},set:function(e){e?this.flags|=512:this.flags&=-513}},{key:"canStartJSXElement",get:function(){return(1024&this.flags)>0},set:function(e){e?this.flags|=1024:this.flags&=-1025}},{key:"containsEsc",get:function(){return(2048&this.flags)>0},set:function(e){e?this.flags|=2048:this.flags&=-2049}},{key:"hasTopLevelAwait",get:function(){return(4096&this.flags)>0},set:function(e){e?this.flags|=4096:this.flags&=-4097}}])}();function Vv(e,t,r){return new Zm(r,e-t,e)}var Hv=new Set([103,109,115,105,121,117,100,118]),Kv=o((function(e){var t=e.startIndex||0;this.type=e.type,this.value=e.value,this.start=t+e.start,this.end=t+e.end,this.loc=new eh(e.startLoc,e.endLoc)})),zv=function(e){function t(t,r){var a;return(a=e.call(this)||this).isLookahead=void 0,a.tokens=[],a.errorHandlers_readInt={invalidDigit:function(e,t,r,n){return!!(a.optionFlags&Th)&&(a.raise(gh.InvalidDigit,Vv(e,t,r),{radix:n}),!0)},numericSeparatorInEscapeSequence:a.errorBuilder(gh.NumericSeparatorInEscapeSequence),unexpectedNumericSeparator:a.errorBuilder(gh.UnexpectedNumericSeparator)},a.errorHandlers_readCodePoint=Object.assign({},a.errorHandlers_readInt,{invalidEscapeSequence:a.errorBuilder(gh.InvalidEscapeSequence),invalidCodePoint:a.errorBuilder(gh.InvalidCodePoint)}),a.errorHandlers_readStringContents_string=Object.assign({},a.errorHandlers_readCodePoint,{strictNumericEscape:function(e,t,r){a.recordStrictModeErrors(gh.StrictNumericEscape,Vv(e,t,r))},unterminated:function(e,t,r){throw a.raise(gh.UnterminatedString,Vv(e-1,t,r))}}),a.errorHandlers_readStringContents_template=Object.assign({},a.errorHandlers_readCodePoint,{strictNumericEscape:a.errorBuilder(gh.StrictNumericEscape),unterminated:function(e,t,r){throw a.raise(gh.UnterminatedTemplate,Vv(e,t,r))}}),a.state=new Wv,a.state.init(t),a.input=r,a.length=r.length,a.comments=[],a.isLookahead=!1,a}c(t,e);var r=t.prototype;return r.pushToken=function(e){this.tokens.length=this.state.tokensLength,this.tokens.push(e),++this.state.tokensLength},r.next=function(){this.checkKeywordEscapes(),this.optionFlags&wh&&this.pushToken(new Kv(this.state)),this.state.lastTokEndLoc=this.state.endLoc,this.state.lastTokStartLoc=this.state.startLoc,this.nextToken()},r.eat=function(e){return!!this.match(e)&&(this.next(),!0)},r.match=function(e){return this.state.type===e},r.createLookaheadState=function(e){return{pos:e.pos,value:null,type:e.type,start:e.start,end:e.end,context:[this.curContext()],inType:e.inType,startLoc:e.startLoc,lastTokEndLoc:e.lastTokEndLoc,curLine:e.curLine,lineStart:e.lineStart,curPosition:e.curPosition}},r.lookahead=function(){var e=this.state;this.state=this.createLookaheadState(e),this.isLookahead=!0,this.nextToken(),this.isLookahead=!1;var t=this.state;return this.state=e,t},r.nextTokenStart=function(){return this.nextTokenStartSince(this.state.pos)},r.nextTokenStartSince=function(e){return Rv.lastIndex=e,Rv.test(this.input)?Rv.lastIndex:e},r.lookaheadCharCode=function(){return this.lookaheadCharCodeSince(this.state.pos)},r.lookaheadCharCodeSince=function(e){return this.input.charCodeAt(this.nextTokenStartSince(e))},r.nextTokenInLineStart=function(){return this.nextTokenInLineStartSince(this.state.pos)},r.nextTokenInLineStartSince=function(e){return jv.lastIndex=e,jv.test(this.input)?jv.lastIndex:e},r.lookaheadInLineCharCode=function(){return this.input.charCodeAt(this.nextTokenInLineStart())},r.codePointAtPos=function(e){var t=this.input.charCodeAt(e);if(55296==(64512&t)&&++e=this.length?this.finishToken(140):this.getTokenFromCode(this.codePointAtPos(this.state.pos))},r.skipBlockComment=function(e){var t;this.isLookahead||(t=this.state.curPosition());var r=this.state.pos,a=this.input.indexOf(e,r+2);if(-1===a)throw this.raise(gh.UnterminatedComment,this.state.curPosition());for(this.state.pos=a+e.length,hv.lastIndex=r+2;hv.test(this.input)&&hv.lastIndex<=a;)++this.state.curLine,this.state.lineStart=hv.lastIndex;if(!this.isLookahead){var n={type:"CommentBlock",value:this.input.slice(r+2,a),start:this.sourceToOffsetPos(r),end:this.sourceToOffsetPos(a+e.length),loc:new eh(t,this.state.curPosition())};return this.optionFlags&wh&&this.pushToken(n),n}},r.skipLineComment=function(e){var t,r=this.state.pos;this.isLookahead||(t=this.state.curPosition());var a=this.input.charCodeAt(this.state.pos+=e);if(this.state.pose))break e;var o=this.skipLineComment(3);void 0!==o&&(this.addComment(o),null==t||t.push(o))}else{if(60!==r||this.inModule||!(this.optionFlags&Ah))break e;var i=this.state.pos;if(33!==this.input.charCodeAt(i+1)||45!==this.input.charCodeAt(i+2)||45!==this.input.charCodeAt(i+3))break e;var d=this.skipLineComment(4);void 0!==d&&(this.addComment(d),null==t||t.push(d))}}}if((null==t?void 0:t.length)>0){var c=this.state.pos,l={start:this.sourceToOffsetPos(e),end:this.sourceToOffsetPos(c),comments:t,leadingNode:null,trailingNode:null,containingNode:null};this.state.commentStack.push(l)}},r.finishToken=function(e,t){this.state.end=this.state.pos,this.state.endLoc=this.state.curPosition();var r=this.state.type;this.state.type=e,this.state.value=t,this.isLookahead||this.updateContext(r)},r.replaceToken=function(e){this.state.type=e,this.updateContext()},r.readToken_numberSign=function(){if(0!==this.state.pos||!this.readToken_interpreter()){var e=this.state.pos+1,t=this.codePointAtPos(e);if(t>=48&&t<=57)throw this.raise(gh.UnexpectedDigitAfterHash,this.state.curPosition());if(123===t||91===t&&this.hasPlugin("recordAndTuple")){if(this.expectPlugin("recordAndTuple"),"bar"===this.getPluginOption("recordAndTuple","syntaxType"))throw this.raise(123===t?gh.RecordExpressionHashIncorrectStartSyntaxType:gh.TupleExpressionHashIncorrectStartSyntaxType,this.state.curPosition());this.state.pos+=2,123===t?this.finishToken(7):this.finishToken(1)}else Mr(t)?(++this.state.pos,this.finishToken(139,this.readWord1(t))):92===t?(++this.state.pos,this.finishToken(139,this.readWord1())):this.finishOp(27,1)}},r.readToken_dot=function(){var e=this.input.charCodeAt(this.state.pos+1);e>=48&&e<=57?this.readNumber(!0):46===e&&46===this.input.charCodeAt(this.state.pos+2)?(this.state.pos+=3,this.finishToken(21)):(++this.state.pos,this.finishToken(16))},r.readToken_slash=function(){61===this.input.charCodeAt(this.state.pos+1)?this.finishOp(31,2):this.finishOp(56,1)},r.readToken_interpreter=function(){if(0!==this.state.pos||this.length<2)return!1;var e=this.input.charCodeAt(this.state.pos+1);if(33!==e)return!1;var t=this.state.pos;for(this.state.pos+=1;!bv(e)&&++this.state.pos=48&&t<=57?(++this.state.pos,this.finishToken(17)):(this.state.pos+=2,this.finishToken(18))},r.getTokenFromCode=function(e){switch(e){case 46:return void this.readToken_dot();case 40:return++this.state.pos,void this.finishToken(10);case 41:return++this.state.pos,void this.finishToken(11);case 59:return++this.state.pos,void this.finishToken(13);case 44:return++this.state.pos,void this.finishToken(12);case 91:if(this.hasPlugin("recordAndTuple")&&124===this.input.charCodeAt(this.state.pos+1)){if("bar"!==this.getPluginOption("recordAndTuple","syntaxType"))throw this.raise(gh.TupleExpressionBarIncorrectStartSyntaxType,this.state.curPosition());this.state.pos+=2,this.finishToken(2)}else++this.state.pos,this.finishToken(0);return;case 93:return++this.state.pos,void this.finishToken(3);case 123:if(this.hasPlugin("recordAndTuple")&&124===this.input.charCodeAt(this.state.pos+1)){if("bar"!==this.getPluginOption("recordAndTuple","syntaxType"))throw this.raise(gh.RecordExpressionBarIncorrectStartSyntaxType,this.state.curPosition());this.state.pos+=2,this.finishToken(6)}else++this.state.pos,this.finishToken(5);return;case 125:return++this.state.pos,void this.finishToken(8);case 58:return void(this.hasPlugin("functionBind")&&58===this.input.charCodeAt(this.state.pos+1)?this.finishOp(15,2):(++this.state.pos,this.finishToken(14)));case 63:return void this.readToken_question();case 96:return void this.readTemplateToken();case 48:var t=this.input.charCodeAt(this.state.pos+1);if(120===t||88===t)return void this.readRadixNumber(16);if(111===t||79===t)return void this.readRadixNumber(8);if(98===t||66===t)return void this.readRadixNumber(2);case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return void this.readNumber(!1);case 34:case 39:return void this.readString(e);case 47:return void this.readToken_slash();case 37:case 42:return void this.readToken_mult_modulo(e);case 124:case 38:return void this.readToken_pipe_amp(e);case 94:return void this.readToken_caret();case 43:case 45:return void this.readToken_plus_min(e);case 60:return void this.readToken_lt();case 62:return void this.readToken_gt();case 61:case 33:return void this.readToken_eq_excl(e);case 126:return void this.finishOp(36,1);case 64:return void this.readToken_atSign();case 35:return void this.readToken_numberSign();case 92:return void this.readWord();default:if(Mr(e))return void this.readWord(e)}throw this.raise(gh.InvalidOrUnexpectedToken,this.state.curPosition(),{unexpected:String.fromCodePoint(e)})},r.finishOp=function(e,t){var r=this.input.slice(this.state.pos,this.state.pos+t);this.state.pos+=t,this.finishToken(e,r)},r.readRegexp=function(){for(var e,t,r=this.state.startLoc,a=this.state.start+1,n=this.state.pos;;++n){if(n>=this.length)throw this.raise(gh.UnterminatedRegExp,th(r,1));var s=this.input.charCodeAt(n);if(bv(s))throw this.raise(gh.UnterminatedRegExp,th(r,1));if(e)e=!1;else{if(91===s)t=!0;else if(93===s&&t)t=!1;else if(47===s&&!t)break;e=92===s}}var o=this.input.slice(a,n);++n;for(var i="",d=function(){return th(r,n+2-a)};n=2&&48===this.input.charCodeAt(t);if(i){var d=this.input.slice(t,this.state.pos);if(this.recordStrictModeErrors(gh.StrictOctalLiteral,r),!this.state.strict){var c=d.indexOf("_");c>0&&this.raise(gh.ZeroDigitNumericSeparator,th(r,c))}o=i&&!/[89]/.test(d)}var l=this.input.charCodeAt(this.state.pos);if(46!==l||o||(++this.state.pos,this.readInt(10),a=!0,l=this.input.charCodeAt(this.state.pos)),69!==l&&101!==l||o||(43!==(l=this.input.charCodeAt(++this.state.pos))&&45!==l||++this.state.pos,null===this.readInt(10)&&this.raise(gh.InvalidOrMissingExponent,r),a=!0,s=!0,l=this.input.charCodeAt(this.state.pos)),110===l&&((a||i)&&this.raise(gh.InvalidBigIntLiteral,r),++this.state.pos,n=!0),109===l){this.expectPlugin("decimal",this.state.curPosition()),(s||i)&&this.raise(gh.InvalidDecimal,r),++this.state.pos;var u=!0}if(Mr(this.codePointAtPos(this.state.pos)))throw this.raise(gh.NumberIdentifier,this.state.curPosition());var p=this.input.slice(t,this.state.pos).replace(/[_mn]/g,"");if(n)this.finishToken(136,p);else if(u)this.finishToken(137,p);else{var f=o?parseInt(p,8):parseFloat(p);this.finishToken(135,f)}},r.readCodePoint=function(e){var t=sa(this.input,this.state.pos,this.state.lineStart,this.state.curLine,e,this.errorHandlers_readCodePoint),r=t.code,a=t.pos;return this.state.pos=a,r},r.readString=function(e){var t=ea(34===e?"double":"single",this.input,this.state.pos+1,this.state.lineStart,this.state.curLine,this.errorHandlers_readStringContents_string),r=t.str,a=t.pos,n=t.curLine,s=t.lineStart;this.state.pos=a+1,this.state.lineStart=s,this.state.curLine=n,this.finishToken(134,r)},r.readTemplateContinuation=function(){this.match(8)||this.unexpected(null,8),this.state.pos--,this.readTemplateToken()},r.readTemplateToken=function(){var e=this.input[this.state.pos],t=ea("template",this.input,this.state.pos+1,this.state.lineStart,this.state.curLine,this.errorHandlers_readStringContents_template),r=t.str,a=t.firstInvalidLoc,n=t.pos,s=t.curLine,o=t.lineStart;this.state.pos=n+1,this.state.lineStart=o,this.state.curLine=s,a&&(this.state.firstInvalidTemplateEscapePos=new Zm(a.curLine,a.pos-a.lineStart,this.sourceToOffsetPos(a.pos))),96===this.input.codePointAt(n)?this.finishToken(24,a?null:e+r+"`"):(this.state.pos++,this.finishToken(25,a?null:e+r+"${"))},r.recordStrictModeErrors=function(e,t){var r=t.index;this.state.strict&&!this.state.strictErrors.has(r)?this.raise(e,t):this.state.strictErrors.set(r,[e,t])},r.readWord1=function(e){this.state.containsEsc=!1;var t="",r=this.state.pos,a=this.state.pos;for(void 0!==e&&(this.state.pos+=e<=65535?1:2);this.state.pos=0;o--){var i=s[o];if(i.loc.index===n)return s[o]=e(a,r);if(i.loc.indext.errors.length){var n=this.state;return this.state=t,this.state.tokensLength=n.tokensLength,{node:a,error:n.errors[t.errors.length],thrown:!1,aborted:!1,failState:n}}return{node:a,error:null,thrown:!1,aborted:!1,failState:null}}catch(e){var s=this.state;if(this.state=t,e instanceof SyntaxError)return{node:null,error:e,thrown:!0,aborted:!1,failState:s};if(e===r)return{node:r.node,error:null,thrown:!1,aborted:!0,failState:s};throw e}},r.checkExpressionErrors=function(e,t){if(!e)return!1;var r=e.shorthandAssignLoc,a=e.doubleProtoLoc,n=e.privateKeyLoc,s=e.optionalParametersLoc;if(!t)return!!(r||a||s||n);null!=r&&this.raise(gh.InvalidCoverInitializedName,r),null!=a&&this.raise(gh.DuplicateProto,a),null!=n&&this.raise(gh.UnexpectedPrivateField,n),null!=s&&this.unexpected(s)},r.isLiteralPropertyName=function(){return tb(this.state.type)},r.isPrivateName=function(e){return"PrivateName"===e.type},r.getPrivateNameSV=function(e){return e.id.name},r.hasPropertyAsPrivateName=function(e){return("MemberExpression"===e.type||"OptionalMemberExpression"===e.type)&&this.isPrivateName(e.property)},r.isObjectProperty=function(e){return"ObjectProperty"===e.type},r.isObjectMethod=function(e){return"ObjectMethod"===e.type},r.initializeScopes=function(e){var t=this;void 0===e&&(e="module"===this.options.sourceType);var r=this.state.labels;this.state.labels=[];var a=this.exportedIdentifiers;this.exportedIdentifiers=new Set;var n=this.inModule;this.inModule=e;var s=this.scope,o=this.getScopeHandler();this.scope=new o(this,e);var i=this.prodParam;this.prodParam=new Ov;var d=this.classScope;this.classScope=new Jv(this);var c=this.expressionScope;return this.expressionScope=new Qv(this),function(){t.state.labels=r,t.exportedIdentifiers=a,t.inModule=n,t.scope=s,t.prodParam=i,t.classScope=d,t.expressionScope=c}},r.enterInitialScopes=function(){var e=kv;this.inModule&&(e|=_v),this.optionFlags&xh&&(e|=Cv),this.scope.enter(pb),this.prodParam.enter(e)},r.checkDestructuringPrivate=function(e){var t=e.privateKeyLoc;null!==t&&this.expectPlugin("destructuringPrivate",t)},o(t)}(zv),tx=o((function(){this.shorthandAssignLoc=null,this.doubleProtoLoc=null,this.privateKeyLoc=null,this.optionalParametersLoc=null})),rx=o((function(e,t,r){this.type="",this.start=t,this.end=0,this.loc=new eh(r),(null==e?void 0:e.optionFlags)&jh&&(this.range=[t,0]),null!=e&&e.filename&&(this.loc.filename=e.filename)})),ax=rx.prototype;ax.__clone=function(){for(var e=new rx(void 0,this.start,this.loc.start),t=Object.keys(this),r=0,a=t.length;r() => ...`.",ReservedTypeAssertion:"This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.",SetAccessorCannotHaveOptionalParameter:"A 'set' accessor cannot have an optional parameter.",SetAccessorCannotHaveRestParameter:"A 'set' accessor cannot have rest parameter.",SetAccessorCannotHaveReturnType:"A 'set' accessor cannot have a return type annotation.",SingleTypeParameterWithoutTrailingComma:function(e){var t=e.typeParameterName;return"Single type parameter "+t+" should have a trailing comma. Example usage: <"+t+",>."},StaticBlockCannotHaveModifier:"Static class blocks cannot have any modifier.",TupleOptionalAfterType:"A labeled tuple optional element must be declared using a question mark after the name and before the colon (`name?: type`), rather than after the type (`name: type?`).",TypeAnnotationAfterAssign:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeImportCannotSpecifyDefaultAndNamed:"A type-only import can specify a default import or named bindings, but not both.",TypeModifierIsUsedInTypeExports:"The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.",TypeModifierIsUsedInTypeImports:"The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.",UnexpectedParameterModifier:"A parameter property is only allowed in a constructor implementation.",UnexpectedReadonly:"'readonly' type modifier is only permitted on array and tuple literal types.",UnexpectedTypeAnnotation:"Did not expect a type annotation here.",UnexpectedTypeCastInParameter:"Unexpected type cast in parameter position.",UnsupportedImportTypeArgument:"Argument in a type import must be a string literal.",UnsupportedParameterPropertyKind:"A parameter property may not be declared using a binding pattern.",UnsupportedSignatureParameterKind:function(e){return"Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got "+e.type+"."}});function fx(e){return"private"===e||"public"===e||"protected"===e}function gx(e){return"in"===e||"out"===e}var yx,mx=0,hx=1,bx=2;function vx(e){if("MemberExpression"!==e.type)return!1;var t=e.computed,r=e.property;return(!t||"StringLiteral"===r.type||!("TemplateLiteral"!==r.type||r.expressions.length>0))&&jx(e.object)}function xx(e,t){var r,a=e.type;if(null!=(r=e.extra)&&r.parenthesized)return!1;if(t){if("Literal"===a){var n=e.value;if("string"==typeof n||"boolean"==typeof n)return!0}}else if("StringLiteral"===a||"BooleanLiteral"===a)return!0;return!(!Rx(e,t)&&!function(e,t){if("UnaryExpression"===e.type){var r=e.operator,a=e.argument;if("-"===r&&Rx(a,t))return!0}return!1}(e,t))||("TemplateLiteral"===a&&0===e.expressions.length||!!vx(e))}function Rx(e,t){return t?"Literal"===e.type&&("number"==typeof e.value||"bigint"in e):"NumericLiteral"===e.type||"BigIntLiteral"===e.type}function jx(e){return"Identifier"===e.type||"MemberExpression"===e.type&&!e.computed&&jx(e.object)}var wx=fh(yx||(yx=y(["placeholders"])))({ClassNameIsRequired:"A class name is required.",UnexpectedSpace:"Unexpected space in placeholder."}),Ex=["minimal","fsharp","hack","smart"],Sx=["^^","@@","^","%","#"];var Tx={estree:function(e){return function(e){function t(){return e.apply(this,arguments)||this}c(t,e);var r=t.prototype;return r.parse=function(){var t=_h(e.prototype.parse.call(this));return this.optionFlags&wh&&(t.tokens=t.tokens.map(_h)),t},r.parseRegExpLiteral=function(e){var t=e.pattern,r=e.flags,a=null;try{a=new RegExp(t,r)}catch(e){}var n=this.estreeParseLiteral(a);return n.regex={pattern:t,flags:r},n},r.parseBigIntLiteral=function(e){var t;try{t=BigInt(e)}catch(e){t=null}var r=this.estreeParseLiteral(t);return r.bigint=String(r.value||e),r},r.parseDecimalLiteral=function(e){var t=this.estreeParseLiteral(null);return t.decimal=String(t.value||e),t},r.estreeParseLiteral=function(e){return this.parseLiteral(e,"Literal")},r.parseStringLiteral=function(e){return this.estreeParseLiteral(e)},r.parseNumericLiteral=function(e){return this.estreeParseLiteral(e)},r.parseNullLiteral=function(){return this.estreeParseLiteral(null)},r.parseBooleanLiteral=function(e){return this.estreeParseLiteral(e)},r.estreeParseChainExpression=function(e,t){var r=this.startNodeAtNode(e);return r.expression=e,this.finishNodeAt(r,"ChainExpression",t)},r.directiveToStmt=function(e){var t=e.value;delete e.value,this.castNodeTo(t,"Literal"),t.raw=t.extra.raw,t.value=t.extra.expressionValue;var r=this.castNodeTo(e,"ExpressionStatement");return r.expression=t,r.directive=t.extra.rawValue,delete t.extra,r},r.fillOptionalPropertiesForTSESLint=function(e){},r.cloneEstreeStringLiteral=function(e){var t=e.start,r=e.end,a=e.loc,n=e.range,s=e.raw,o=e.value,i=Object.create(e.constructor.prototype);return i.type="Literal",i.start=t,i.end=r,i.loc=a,i.range=n,i.raw=s,i.value=o,i},r.initFunction=function(t,r){e.prototype.initFunction.call(this,t,r),t.expression=!1},r.checkDeclaration=function(t){null!=t&&this.isObjectProperty(t)?this.checkDeclaration(t.value):e.prototype.checkDeclaration.call(this,t)},r.getObjectOrClassMethodParams=function(e){return e.value.params},r.isValidDirective=function(e){var t;return"ExpressionStatement"===e.type&&"Literal"===e.expression.type&&"string"==typeof e.expression.value&&!(null!=(t=e.expression.extra)&&t.parenthesized)},r.parseBlockBody=function(t,r,a,n,s){var o=this;e.prototype.parseBlockBody.call(this,t,r,a,n,s);var i=t.directives.map((function(e){return o.directiveToStmt(e)}));t.body=i.concat(t.body),delete t.directives},r.parsePrivateName=function(){var t=e.prototype.parsePrivateName.call(this);return this.getPluginOption("estree","classFeatures")?this.convertPrivateNameToPrivateIdentifier(t):t},r.convertPrivateNameToPrivateIdentifier=function(t){var r=e.prototype.getPrivateNameSV.call(this,t);return delete t.id,t.name=r,this.castNodeTo(t,"PrivateIdentifier")},r.isPrivateName=function(t){return this.getPluginOption("estree","classFeatures")?"PrivateIdentifier"===t.type:e.prototype.isPrivateName.call(this,t)},r.getPrivateNameSV=function(t){return this.getPluginOption("estree","classFeatures")?t.name:e.prototype.getPrivateNameSV.call(this,t)},r.parseLiteral=function(t,r){var a=e.prototype.parseLiteral.call(this,t,r);return a.raw=a.extra.raw,delete a.extra,a},r.parseFunctionBody=function(t,r,a){void 0===a&&(a=!1),e.prototype.parseFunctionBody.call(this,t,r,a),t.expression="BlockStatement"!==t.body.type},r.parseMethod=function(t,r,a,n,s,o,i){void 0===i&&(i=!1);var d=this.startNode();d.kind=t.kind,delete(d=e.prototype.parseMethod.call(this,d,r,a,n,s,o,i)).kind;var c=t.typeParameters;c&&(delete t.typeParameters,d.typeParameters=c,this.resetStartLocationFromNode(d,c));var l=this.castNodeTo(d,"FunctionExpression");return t.value=l,"ClassPrivateMethod"===o&&(t.computed=!1),"ObjectMethod"===o?("method"===t.kind&&(t.kind="init"),t.shorthand=!1,this.finishNode(t,"Property")):this.finishNode(t,"MethodDefinition")},r.nameIsConstructor=function(t){return"Literal"===t.type?"constructor"===t.value:e.prototype.nameIsConstructor.call(this,t)},r.parseClassProperty=function(){for(var t,r=arguments.length,a=new Array(r),n=0;n0&&o.start===n.start&&this.resetStartLocation(n,a)}return n},r.stopParseSubscript=function(t,r){var a=e.prototype.stopParseSubscript.call(this,t,r);return r.optionalChainMember?this.estreeParseChainExpression(a,t.loc.end):a},r.parseMember=function(t,r,a,n,s){var o=e.prototype.parseMember.call(this,t,r,a,n,s);return"OptionalMemberExpression"===o.type?this.castNodeTo(o,"MemberExpression"):o.optional=!1,o},r.isOptionalMemberExpression=function(t){return"ChainExpression"===t.type?"MemberExpression"===t.expression.type:e.prototype.isOptionalMemberExpression.call(this,t)},r.hasPropertyAsPrivateName=function(t){return"ChainExpression"===t.type&&(t=t.expression),e.prototype.hasPropertyAsPrivateName.call(this,t)},r.isObjectProperty=function(e){return"Property"===e.type&&"init"===e.kind&&!e.method},r.isObjectMethod=function(e){return"Property"===e.type&&(e.method||"get"===e.kind||"set"===e.kind)},r.castNodeTo=function(t,r){var a=e.prototype.castNodeTo.call(this,t,r);return this.fillOptionalPropertiesForTSESLint(a),a},r.cloneIdentifier=function(t){var r=e.prototype.cloneIdentifier.call(this,t);return this.fillOptionalPropertiesForTSESLint(r),r},r.cloneStringLiteral=function(t){return"Literal"===t.type?this.cloneEstreeStringLiteral(t):e.prototype.cloneStringLiteral.call(this,t)},r.finishNodeAt=function(t,r,a){return _h(e.prototype.finishNodeAt.call(this,t,r,a))},r.finishNode=function(t,r){var a=e.prototype.finishNode.call(this,t,r);return this.fillOptionalPropertiesForTSESLint(a),a},r.resetStartLocation=function(t,r){e.prototype.resetStartLocation.call(this,t,r),_h(t)},r.resetEndLocation=function(t,r){void 0===r&&(r=this.state.lastTokEndLoc),e.prototype.resetEndLocation.call(this,t,r),_h(t)},o(t)}(e)},jsx:function(e){return function(e){function t(){return e.apply(this,arguments)||this}c(t,e);var r=t.prototype;return r.jsxReadToken=function(){for(var t="",r=this.state.pos;;){if(this.state.pos>=this.length)throw this.raise(Ev.UnterminatedJsxContent,this.state.startLoc);var a=this.input.charCodeAt(this.state.pos);switch(a){case 60:case 123:return this.state.pos===this.state.start?void(60===a&&this.state.canStartJSXElement?(++this.state.pos,this.finishToken(143)):e.prototype.getTokenFromCode.call(this,a)):(t+=this.input.slice(r,this.state.pos),void this.finishToken(142,t));case 38:t+=this.input.slice(r,this.state.pos),t+=this.jsxReadEntity(),r=this.state.pos;break;default:bv(a)?(t+=this.input.slice(r,this.state.pos),t+=this.jsxReadNewLine(!0),r=this.state.pos):++this.state.pos}}},r.jsxReadNewLine=function(e){var t,r=this.input.charCodeAt(this.state.pos);return++this.state.pos,13===r&&10===this.input.charCodeAt(this.state.pos)?(++this.state.pos,t=e?"\n":"\r\n"):t=String.fromCharCode(r),++this.state.curLine,this.state.lineStart=this.state.pos,t},r.jsxReadString=function(e){for(var t="",r=++this.state.pos;;){if(this.state.pos>=this.length)throw this.raise(gh.UnterminatedString,this.state.startLoc);var a=this.input.charCodeAt(this.state.pos);if(a===e)break;38===a?(t+=this.input.slice(r,this.state.pos),t+=this.jsxReadEntity(),r=this.state.pos):bv(a)?(t+=this.input.slice(r,this.state.pos),t+=this.jsxReadNewLine(!1),r=this.state.pos):++this.state.pos}t+=this.input.slice(r,this.state.pos++),this.finishToken(134,t)},r.jsxReadEntity=function(){var e=++this.state.pos;if(35===this.codePointAtPos(this.state.pos)){++this.state.pos;var t=10;120===this.codePointAtPos(this.state.pos)&&(t=16,++this.state.pos);var r=this.readInt(t,void 0,!1,"bail");if(null!==r&&59===this.codePointAtPos(this.state.pos))return++this.state.pos,String.fromCodePoint(r)}else{for(var a=0,n=!1;a++<10&&this.state.posr.index+1&&this.raise(pv.UnexpectedSpaceBetweenModuloChecks,r),this.eat(10)?(t.value=e.prototype.parseExpression.call(this),this.expect(11),this.finishNode(t,"DeclaredPredicate")):this.finishNode(t,"InferredPredicate")},r.flowParseTypeAndPredicateInitialiser=function(){var e=this.state.inType;this.state.inType=!0,this.expect(14);var t=null,r=null;return this.match(54)?(this.state.inType=e,r=this.flowParsePredicate()):(t=this.flowParseType(),this.state.inType=e,this.match(54)&&(r=this.flowParsePredicate())),[t,r]},r.flowParseDeclareClass=function(e){return this.next(),this.flowParseInterfaceish(e,!0),this.finishNode(e,"DeclareClass")},r.flowParseDeclareFunction=function(e){this.next();var t=e.id=this.parseIdentifier(),r=this.startNode(),a=this.startNode();this.match(47)?r.typeParameters=this.flowParseTypeParameterDeclaration():r.typeParameters=null,this.expect(10);var n=this.flowParseFunctionTypeParams();r.params=n.params,r.rest=n.rest,r.this=n._this,this.expect(11);var s=this.flowParseTypeAndPredicateInitialiser();return r.returnType=s[0],e.predicate=s[1],a.typeAnnotation=this.finishNode(r,"FunctionTypeAnnotation"),t.typeAnnotation=this.finishNode(a,"TypeAnnotation"),this.resetEndLocation(t),this.semicolon(),this.scope.declareName(e.id.name,Yb,e.id.loc.start),this.finishNode(e,"DeclareFunction")},r.flowParseDeclare=function(e,t){return this.match(80)?this.flowParseDeclareClass(e):this.match(68)?this.flowParseDeclareFunction(e):this.match(74)?this.flowParseDeclareVariable(e):this.eatContextual(127)?this.match(16)?this.flowParseDeclareModuleExports(e):(t&&this.raise(pv.NestedDeclareModule,this.state.lastTokStartLoc),this.flowParseDeclareModule(e)):this.isContextual(130)?this.flowParseDeclareTypeAlias(e):this.isContextual(131)?this.flowParseDeclareOpaqueType(e):this.isContextual(129)?this.flowParseDeclareInterface(e):this.match(82)?this.flowParseDeclareExportDeclaration(e,t):void this.unexpected()},r.flowParseDeclareVariable=function(e){return this.next(),e.id=this.flowParseTypeAnnotatableIdentifier(!0),this.scope.declareName(e.id.name,Fb,e.id.loc.start),this.semicolon(),this.finishNode(e,"DeclareVariable")},r.flowParseDeclareModule=function(t){var r=this;this.scope.enter(ub),this.match(134)?t.id=e.prototype.parseExprAtom.call(this):t.id=this.parseIdentifier();var a=t.body=this.startNode(),n=a.body=[];for(this.expect(5);!this.match(8);){var s=this.startNode();this.match(83)?(this.next(),this.isContextual(130)||this.match(87)||this.raise(pv.InvalidNonTypeImportInDeclareModule,this.state.lastTokStartLoc),e.prototype.parseImport.call(this,s)):(this.expectContextual(125,pv.UnsupportedStatementInDeclareModule),s=this.flowParseDeclare(s,!0)),n.push(s)}this.scope.exit(),this.expect(8),this.finishNode(a,"BlockStatement");var o=null,i=!1;return n.forEach((function(e){!function(e){return"DeclareExportAllDeclaration"===e.type||"DeclareExportDeclaration"===e.type&&(!e.declaration||"TypeAlias"!==e.declaration.type&&"InterfaceDeclaration"!==e.declaration.type)}(e)?"DeclareModuleExports"===e.type&&(i&&r.raise(pv.DuplicateDeclareModuleExports,e),"ES"===o&&r.raise(pv.AmbiguousDeclareModuleKind,e),o="CommonJS",i=!0):("CommonJS"===o&&r.raise(pv.AmbiguousDeclareModuleKind,e),o="ES")})),t.kind=o||"CommonJS",this.finishNode(t,"DeclareModule")},r.flowParseDeclareExportDeclaration=function(e,t){if(this.expect(82),this.eat(65))return this.match(68)||this.match(80)?e.declaration=this.flowParseDeclare(this.startNode()):(e.declaration=this.flowParseType(),this.semicolon()),e.default=!0,this.finishNode(e,"DeclareExportDeclaration");if(this.match(75)||this.isLet()||(this.isContextual(130)||this.isContextual(129))&&!t){var r=this.state.value;throw this.raise(pv.UnsupportedDeclareExportKind,this.state.startLoc,{unsupportedExportKind:r,suggestion:gv[r]})}return this.match(74)||this.match(68)||this.match(80)||this.isContextual(131)?(e.declaration=this.flowParseDeclare(this.startNode()),e.default=!1,this.finishNode(e,"DeclareExportDeclaration")):this.match(55)||this.match(5)||this.isContextual(129)||this.isContextual(130)||this.isContextual(131)?"ExportNamedDeclaration"===(e=this.parseExport(e,null)).type?(e.default=!1,delete e.exportKind,this.castNodeTo(e,"DeclareExportDeclaration")):this.castNodeTo(e,"DeclareExportAllDeclaration"):void this.unexpected()},r.flowParseDeclareModuleExports=function(e){return this.next(),this.expectContextual(111),e.typeAnnotation=this.flowParseTypeAnnotation(),this.semicolon(),this.finishNode(e,"DeclareModuleExports")},r.flowParseDeclareTypeAlias=function(e){this.next();var t=this.flowParseTypeAlias(e);return this.castNodeTo(t,"DeclareTypeAlias"),t},r.flowParseDeclareOpaqueType=function(e){this.next();var t=this.flowParseOpaqueType(e,!0);return this.castNodeTo(t,"DeclareOpaqueType"),t},r.flowParseDeclareInterface=function(e){return this.next(),this.flowParseInterfaceish(e,!1),this.finishNode(e,"DeclareInterface")},r.flowParseInterfaceish=function(e,t){if(e.id=this.flowParseRestrictedIdentifier(!t,!0),this.scope.declareName(e.id.name,t?Lb:Bb,e.id.loc.start),this.match(47)?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e.extends=[],this.eat(81))do{e.extends.push(this.flowParseInterfaceExtends())}while(!t&&this.eat(12));if(t){if(e.implements=[],e.mixins=[],this.eatContextual(117))do{e.mixins.push(this.flowParseInterfaceExtends())}while(this.eat(12));if(this.eatContextual(113))do{e.implements.push(this.flowParseInterfaceExtends())}while(this.eat(12))}e.body=this.flowParseObjectType({allowStatic:t,allowExact:!1,allowSpread:!1,allowProto:t,allowInexact:!1})},r.flowParseInterfaceExtends=function(){var e=this.startNode();return e.id=this.flowParseQualifiedTypeIdentifier(),this.match(47)?e.typeParameters=this.flowParseTypeParameterInstantiation():e.typeParameters=null,this.finishNode(e,"InterfaceExtends")},r.flowParseInterface=function(e){return this.flowParseInterfaceish(e,!1),this.finishNode(e,"InterfaceDeclaration")},r.checkNotUnderscore=function(e){"_"===e&&this.raise(pv.UnexpectedReservedUnderscore,this.state.startLoc)},r.checkReservedType=function(e,t,r){uv.has(e)&&this.raise(r?pv.AssignReservedType:pv.UnexpectedReservedType,t,{reservedType:e})},r.flowParseRestrictedIdentifier=function(e,t){return this.checkReservedType(this.state.value,this.state.startLoc,t),this.parseIdentifier(e)},r.flowParseTypeAlias=function(e){return e.id=this.flowParseRestrictedIdentifier(!1,!0),this.scope.declareName(e.id.name,Bb,e.id.loc.start),this.match(47)?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e.right=this.flowParseTypeInitialiser(29),this.semicolon(),this.finishNode(e,"TypeAlias")},r.flowParseOpaqueType=function(e,t){return this.expectContextual(130),e.id=this.flowParseRestrictedIdentifier(!0,!0),this.scope.declareName(e.id.name,Bb,e.id.loc.start),this.match(47)?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e.supertype=null,this.match(14)&&(e.supertype=this.flowParseTypeInitialiser(14)),e.impltype=null,t||(e.impltype=this.flowParseTypeInitialiser(29)),this.semicolon(),this.finishNode(e,"OpaqueType")},r.flowParseTypeParameter=function(e){void 0===e&&(e=!1);var t=this.state.startLoc,r=this.startNode(),a=this.flowParseVariance(),n=this.flowParseTypeAnnotatableIdentifier();return r.name=n.name,r.variance=a,r.bound=n.typeAnnotation,this.match(29)?(this.eat(29),r.default=this.flowParseType()):e&&this.raise(pv.MissingTypeParamDefault,t),this.finishNode(r,"TypeParameter")},r.flowParseTypeParameterDeclaration=function(){var e=this.state.inType,t=this.startNode();t.params=[],this.state.inType=!0,this.match(47)||this.match(143)?this.next():this.unexpected();var r=!1;do{var a=this.flowParseTypeParameter(r);t.params.push(a),a.default&&(r=!0),this.match(48)||this.expect(12)}while(!this.match(48));return this.expect(48),this.state.inType=e,this.finishNode(t,"TypeParameterDeclaration")},r.flowInTopLevelContext=function(e){if(this.curContext()===Dh.brace)return e();var t=this.state.context;this.state.context=[t[0]];try{return e()}finally{this.state.context=t}},r.flowParseTypeParameterInstantiationInExpression=function(){if(47===this.reScan_lt())return this.flowParseTypeParameterInstantiation()},r.flowParseTypeParameterInstantiation=function(){var e=this,t=this.startNode(),r=this.state.inType;return this.state.inType=!0,t.params=[],this.flowInTopLevelContext((function(){e.expect(47);var r=e.state.noAnonFunctionType;for(e.state.noAnonFunctionType=!1;!e.match(48);)t.params.push(e.flowParseType()),e.match(48)||e.expect(12);e.state.noAnonFunctionType=r})),this.state.inType=r,this.state.inType||this.curContext()!==Dh.brace||this.reScan_lt_gt(),this.expect(48),this.finishNode(t,"TypeParameterInstantiation")},r.flowParseTypeParameterInstantiationCallOrNew=function(){if(47===this.reScan_lt()){var e=this.startNode(),t=this.state.inType;for(e.params=[],this.state.inType=!0,this.expect(47);!this.match(48);)e.params.push(this.flowParseTypeOrImplicitInstantiation()),this.match(48)||this.expect(12);return this.expect(48),this.state.inType=t,this.finishNode(e,"TypeParameterInstantiation")}},r.flowParseInterfaceType=function(){var e=this.startNode();if(this.expectContextual(129),e.extends=[],this.eat(81))do{e.extends.push(this.flowParseInterfaceExtends())}while(this.eat(12));return e.body=this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!1,allowProto:!1,allowInexact:!1}),this.finishNode(e,"InterfaceTypeAnnotation")},r.flowParseObjectPropertyKey=function(){return this.match(135)||this.match(134)?e.prototype.parseExprAtom.call(this):this.parseIdentifier(!0)},r.flowParseObjectTypeIndexer=function(e,t,r){return e.static=t,14===this.lookahead().type?(e.id=this.flowParseObjectPropertyKey(),e.key=this.flowParseTypeInitialiser()):(e.id=null,e.key=this.flowParseType()),this.expect(3),e.value=this.flowParseTypeInitialiser(),e.variance=r,this.finishNode(e,"ObjectTypeIndexer")},r.flowParseObjectTypeInternalSlot=function(e,t){return e.static=t,e.id=this.flowParseObjectPropertyKey(),this.expect(3),this.expect(3),this.match(47)||this.match(10)?(e.method=!0,e.optional=!1,e.value=this.flowParseObjectTypeMethodish(this.startNodeAt(e.loc.start))):(e.method=!1,this.eat(17)&&(e.optional=!0),e.value=this.flowParseTypeInitialiser()),this.finishNode(e,"ObjectTypeInternalSlot")},r.flowParseObjectTypeMethodish=function(e){for(e.params=[],e.rest=null,e.typeParameters=null,e.this=null,this.match(47)&&(e.typeParameters=this.flowParseTypeParameterDeclaration()),this.expect(10),this.match(78)&&(e.this=this.flowParseFunctionTypeParam(!0),e.this.name=null,this.match(11)||this.expect(12));!this.match(11)&&!this.match(21);)e.params.push(this.flowParseFunctionTypeParam(!1)),this.match(11)||this.expect(12);return this.eat(21)&&(e.rest=this.flowParseFunctionTypeParam(!1)),this.expect(11),e.returnType=this.flowParseTypeInitialiser(),this.finishNode(e,"FunctionTypeAnnotation")},r.flowParseObjectTypeCallProperty=function(e,t){var r=this.startNode();return e.static=t,e.value=this.flowParseObjectTypeMethodish(r),this.finishNode(e,"ObjectTypeCallProperty")},r.flowParseObjectType=function(e){var t=e.allowStatic,r=e.allowExact,a=e.allowSpread,n=e.allowProto,s=e.allowInexact,o=this.state.inType;this.state.inType=!0;var i,d,c=this.startNode();c.callProperties=[],c.properties=[],c.indexers=[],c.internalSlots=[];var l=!1;for(r&&this.match(6)?(this.expect(6),i=9,d=!0):(this.expect(5),i=8,d=!1),c.exact=d;!this.match(i);){var u=!1,p=null,f=null,g=this.startNode();if(n&&this.isContextual(118)){var y=this.lookahead();14!==y.type&&17!==y.type&&(this.next(),p=this.state.startLoc,t=!1)}if(t&&this.isContextual(106)){var m=this.lookahead();14!==m.type&&17!==m.type&&(this.next(),u=!0)}var h=this.flowParseVariance();if(this.eat(0))null!=p&&this.unexpected(p),this.eat(0)?(h&&this.unexpected(h.loc.start),c.internalSlots.push(this.flowParseObjectTypeInternalSlot(g,u))):c.indexers.push(this.flowParseObjectTypeIndexer(g,u,h));else if(this.match(10)||this.match(47))null!=p&&this.unexpected(p),h&&this.unexpected(h.loc.start),c.callProperties.push(this.flowParseObjectTypeCallProperty(g,u));else{var b="init";if(this.isContextual(99)||this.isContextual(104))tb(this.lookahead().type)&&(b=this.state.value,this.next());var v=this.flowParseObjectTypeProperty(g,u,p,h,b,a,null!=s?s:!d);null===v?(l=!0,f=this.state.lastTokStartLoc):c.properties.push(v)}this.flowObjectTypeSemicolon(),!f||this.match(8)||this.match(9)||this.raise(pv.UnexpectedExplicitInexactInObject,f)}this.expect(i),a&&(c.inexact=l);var x=this.finishNode(c,"ObjectTypeAnnotation");return this.state.inType=o,x},r.flowParseObjectTypeProperty=function(e,t,r,a,n,s,o){if(this.eat(21))return this.match(12)||this.match(13)||this.match(8)||this.match(9)?(s?o||this.raise(pv.InexactInsideExact,this.state.lastTokStartLoc):this.raise(pv.InexactInsideNonObject,this.state.lastTokStartLoc),a&&this.raise(pv.InexactVariance,a),null):(s||this.raise(pv.UnexpectedSpreadType,this.state.lastTokStartLoc),null!=r&&this.unexpected(r),a&&this.raise(pv.SpreadVariance,a),e.argument=this.flowParseType(),this.finishNode(e,"ObjectTypeSpreadProperty"));e.key=this.flowParseObjectPropertyKey(),e.static=t,e.proto=null!=r,e.kind=n;var i=!1;return this.match(47)||this.match(10)?(e.method=!0,null!=r&&this.unexpected(r),a&&this.unexpected(a.loc.start),e.value=this.flowParseObjectTypeMethodish(this.startNodeAt(e.loc.start)),"get"!==n&&"set"!==n||this.flowCheckGetterSetterParams(e),!s&&"constructor"===e.key.name&&e.value.this&&this.raise(pv.ThisParamBannedInConstructor,e.value.this)):("init"!==n&&this.unexpected(),e.method=!1,this.eat(17)&&(i=!0),e.value=this.flowParseTypeInitialiser(),e.variance=a),e.optional=i,this.finishNode(e,"ObjectTypeProperty")},r.flowCheckGetterSetterParams=function(e){var t="get"===e.kind?0:1,r=e.value.params.length+(e.value.rest?1:0);e.value.this&&this.raise("get"===e.kind?pv.GetterMayNotHaveThisParam:pv.SetterMayNotHaveThisParam,e.value.this),r!==t&&this.raise("get"===e.kind?gh.BadGetterArity:gh.BadSetterArity,e),"set"===e.kind&&e.value.rest&&this.raise(gh.BadSetterRestParameter,e)},r.flowObjectTypeSemicolon=function(){this.eat(13)||this.eat(12)||this.match(8)||this.match(9)||this.unexpected()},r.flowParseQualifiedTypeIdentifier=function(e,t){null!=e||(e=this.state.startLoc);for(var r=t||this.flowParseRestrictedIdentifier(!0);this.eat(16);){var a=this.startNodeAt(e);a.qualification=r,a.id=this.flowParseRestrictedIdentifier(!0),r=this.finishNode(a,"QualifiedTypeIdentifier")}return r},r.flowParseGenericType=function(e,t){var r=this.startNodeAt(e);return r.typeParameters=null,r.id=this.flowParseQualifiedTypeIdentifier(e,t),this.match(47)&&(r.typeParameters=this.flowParseTypeParameterInstantiation()),this.finishNode(r,"GenericTypeAnnotation")},r.flowParseTypeofType=function(){var e=this.startNode();return this.expect(87),e.argument=this.flowParsePrimaryType(),this.finishNode(e,"TypeofTypeAnnotation")},r.flowParseTupleType=function(){var e=this.startNode();for(e.types=[],this.expect(0);this.state.pos0){var g=[].concat(o);if(f.length>0){this.state=s,this.state.noArrowAt=g;for(var y=0;y1&&this.raise(pv.AmbiguousConditionalArrow,s.startLoc),l&&1===p.length){this.state=s,g.push(p[0].start),this.state.noArrowAt=g;var b=this.tryParseConditionalConsequent();c=b.consequent,l=b.failed}}return this.getArrowLikeExpressions(c,!0),this.state.noArrowAt=o,this.expect(14),i.test=e,i.consequent=c,i.alternate=this.forwardNoArrowParamsConversionAt(i,(function(){return a.parseMaybeAssign(void 0,void 0)})),this.finishNode(i,"ConditionalExpression")},r.tryParseConditionalConsequent=function(){this.state.noArrowParamsConversionAt.push(this.state.start);var e=this.parseMaybeAssignAllowIn(),t=!this.match(14);return this.state.noArrowParamsConversionAt.pop(),{consequent:e,failed:t}},r.getArrowLikeExpressions=function(e,t){for(var r=this,a=[e],n=[];0!==a.length;){var s=a.pop();"ArrowFunctionExpression"===s.type&&"BlockStatement"!==s.body.type?(s.typeParameters||!s.returnType?this.finishArrowValidation(s):n.push(s),a.push(s.body)):"ConditionalExpression"===s.type&&(a.push(s.consequent),a.push(s.alternate))}return t?(n.forEach((function(e){return r.finishArrowValidation(e)})),[n,[]]):function(e,t){for(var r=[],a=[],n=0;n1)&&t||this.raise(pv.TypeCastInPattern,n.typeAnnotation)}return e},r.parseArrayLike=function(t,r,a,n){var s=e.prototype.parseArrayLike.call(this,t,r,a,n);return r&&!this.state.maybeInArrowParameters&&this.toReferencedList(s.elements),s},r.isValidLVal=function(t,r,a){return"TypeCastExpression"===t||e.prototype.isValidLVal.call(this,t,r,a)},r.parseClassProperty=function(t){return this.match(14)&&(t.typeAnnotation=this.flowParseTypeAnnotation()),e.prototype.parseClassProperty.call(this,t)},r.parseClassPrivateProperty=function(t){return this.match(14)&&(t.typeAnnotation=this.flowParseTypeAnnotation()),e.prototype.parseClassPrivateProperty.call(this,t)},r.isClassMethod=function(){return this.match(47)||e.prototype.isClassMethod.call(this)},r.isClassProperty=function(){return this.match(14)||e.prototype.isClassProperty.call(this)},r.isNonstaticConstructor=function(t){return!this.match(14)&&e.prototype.isNonstaticConstructor.call(this,t)},r.pushClassMethod=function(t,r,a,n,s,o){if(r.variance&&this.unexpected(r.variance.loc.start),delete r.variance,this.match(47)&&(r.typeParameters=this.flowParseTypeParameterDeclaration()),e.prototype.pushClassMethod.call(this,t,r,a,n,s,o),r.params&&s){var i=r.params;i.length>0&&this.isThisParam(i[0])&&this.raise(pv.ThisParamBannedInConstructor,r)}else if("MethodDefinition"===r.type&&s&&r.value.params){var d=r.value.params;d.length>0&&this.isThisParam(d[0])&&this.raise(pv.ThisParamBannedInConstructor,r)}},r.pushClassPrivateMethod=function(t,r,a,n){r.variance&&this.unexpected(r.variance.loc.start),delete r.variance,this.match(47)&&(r.typeParameters=this.flowParseTypeParameterDeclaration()),e.prototype.pushClassPrivateMethod.call(this,t,r,a,n)},r.parseClassSuper=function(t){if(e.prototype.parseClassSuper.call(this,t),t.superClass&&(this.match(47)||this.match(51))&&(t.superTypeParameters=this.flowParseTypeParameterInstantiationInExpression()),this.isContextual(113)){this.next();var r=t.implements=[];do{var a=this.startNode();a.id=this.flowParseRestrictedIdentifier(!0),this.match(47)?a.typeParameters=this.flowParseTypeParameterInstantiation():a.typeParameters=null,r.push(this.finishNode(a,"ClassImplements"))}while(this.eat(12))}},r.checkGetterSetterParams=function(t){e.prototype.checkGetterSetterParams.call(this,t);var r=this.getObjectOrClassMethodParams(t);if(r.length>0){var a=r[0];this.isThisParam(a)&&"get"===t.kind?this.raise(pv.GetterMayNotHaveThisParam,a):this.isThisParam(a)&&this.raise(pv.SetterMayNotHaveThisParam,a)}},r.parsePropertyNamePrefixOperator=function(e){e.variance=this.flowParseVariance()},r.parseObjPropValue=function(t,r,a,n,s,o,i){var d;t.variance&&this.unexpected(t.variance.loc.start),delete t.variance,this.match(47)&&!o&&(d=this.flowParseTypeParameterDeclaration(),this.match(10)||this.unexpected());var c=e.prototype.parseObjPropValue.call(this,t,r,a,n,s,o,i);return d&&((c.value||c).typeParameters=d),c},r.parseFunctionParamType=function(e){return this.eat(17)&&("Identifier"!==e.type&&this.raise(pv.PatternIsOptional,e),this.isThisParam(e)&&this.raise(pv.ThisParamMayNotBeOptional,e),e.optional=!0),this.match(14)?e.typeAnnotation=this.flowParseTypeAnnotation():this.isThisParam(e)&&this.raise(pv.ThisParamAnnotationRequired,e),this.match(29)&&this.isThisParam(e)&&this.raise(pv.ThisParamNoDefault,e),this.resetEndLocation(e),e},r.parseMaybeDefault=function(t,r){var a=e.prototype.parseMaybeDefault.call(this,t,r);return"AssignmentPattern"===a.type&&a.typeAnnotation&&a.right.start0&&this.raise(pv.ThisParamMustBeFirst,t.params[s]);e.prototype.checkParams.call(this,t,r,a,n)}},r.parseParenAndDistinguishExpression=function(t){return e.prototype.parseParenAndDistinguishExpression.call(this,t&&!this.state.noArrowAt.includes(this.sourceToOffsetPos(this.state.start)))},r.parseSubscripts=function(t,r,a){var n=this;if("Identifier"===t.type&&"async"===t.name&&this.state.noArrowAt.includes(r.index)){this.next();var s=this.startNodeAt(r);s.callee=t,s.arguments=e.prototype.parseCallExpressionArguments.call(this,11),t=this.finishNode(s,"CallExpression")}else if("Identifier"===t.type&&"async"===t.name&&this.match(47)){var o=this.state.clone(),i=this.tryParse((function(e){return n.parseAsyncArrowWithTypeParameters(r)||e()}),o);if(!i.error&&!i.aborted)return i.node;var d=this.tryParse((function(){return e.prototype.parseSubscripts.call(n,t,r,a)}),o);if(d.node&&!d.error)return d.node;if(i.node)return this.state=i.failState,i.node;if(d.node)return this.state=d.failState,d.node;throw i.error||d.error}return e.prototype.parseSubscripts.call(this,t,r,a)},r.parseSubscript=function(t,r,a,n){var s=this;if(this.match(18)&&this.isLookaheadToken_lt()){if(n.optionalChainMember=!0,a)return n.stop=!0,t;this.next();var o=this.startNodeAt(r);return o.callee=t,o.typeArguments=this.flowParseTypeParameterInstantiationInExpression(),this.expect(10),o.arguments=this.parseCallExpressionArguments(11),o.optional=!0,this.finishCallExpression(o,!0)}if(!a&&this.shouldParseTypes()&&(this.match(47)||this.match(51))){var i=this.startNodeAt(r);i.callee=t;var d=this.tryParse((function(){return i.typeArguments=s.flowParseTypeParameterInstantiationCallOrNew(),s.expect(10),i.arguments=e.prototype.parseCallExpressionArguments.call(s,11),n.optionalChainMember&&(i.optional=!1),s.finishCallExpression(i,n.optionalChainMember)}));if(d.node)return d.error&&(this.state=d.failState),d.node}return e.prototype.parseSubscript.call(this,t,r,a,n)},r.parseNewCallee=function(t){var r=this;e.prototype.parseNewCallee.call(this,t);var a=null;this.shouldParseTypes()&&this.match(47)&&(a=this.tryParse((function(){return r.flowParseTypeParameterInstantiationCallOrNew()})).node),t.typeArguments=a},r.parseAsyncArrowWithTypeParameters=function(t){var r=this.startNodeAt(t);if(this.parseFunctionParams(r,!1),this.parseArrow(r))return e.prototype.parseArrowExpression.call(this,r,void 0,!0)},r.readToken_mult_modulo=function(t){var r=this.input.charCodeAt(this.state.pos+1);if(42===t&&47===r&&this.state.hasFlowComment)return this.state.hasFlowComment=!1,this.state.pos+=2,void this.nextToken();e.prototype.readToken_mult_modulo.call(this,t)},r.readToken_pipe_amp=function(t){var r=this.input.charCodeAt(this.state.pos+1);124!==t||125!==r?e.prototype.readToken_pipe_amp.call(this,t):this.finishOp(9,2)},r.parseTopLevel=function(t,r){var a=e.prototype.parseTopLevel.call(this,t,r);return this.state.hasFlowComment&&this.raise(pv.UnterminatedFlowComment,this.state.curPosition()),a},r.skipBlockComment=function(){if(!this.hasPlugin("flowComments")||!this.skipFlowComment())return e.prototype.skipBlockComment.call(this,this.state.hasFlowComment?"*-/":"*/");if(this.state.hasFlowComment)throw this.raise(pv.NestedFlowComment,this.state.startLoc);this.hasFlowCommentCompletion();var t=this.skipFlowComment();t&&(this.state.pos+=t,this.state.hasFlowComment=!0)},r.skipFlowComment=function(){for(var e=this.state.pos,t=2;[32,9].includes(this.input.charCodeAt(e+t));)t++;var r=this.input.charCodeAt(t+e),a=this.input.charCodeAt(t+e+1);return 58===r&&58===a?t+2:"flow-include"===this.input.slice(t+e,t+e+12)?t+12:58===r&&58!==a&&t},r.hasFlowCommentCompletion=function(){if(-1===this.input.indexOf("*/",this.state.pos))throw this.raise(gh.UnterminatedComment,this.state.curPosition())},r.flowEnumErrorBooleanMemberNotInitialized=function(e,t){var r=t.enumName,a=t.memberName;this.raise(pv.EnumBooleanMemberNotInitialized,e,{memberName:a,enumName:r})},r.flowEnumErrorInvalidMemberInitializer=function(e,t){return this.raise(t.explicitType?"symbol"===t.explicitType?pv.EnumInvalidMemberInitializerSymbolType:pv.EnumInvalidMemberInitializerPrimaryType:pv.EnumInvalidMemberInitializerUnknownType,e,t)},r.flowEnumErrorNumberMemberNotInitialized=function(e,t){this.raise(pv.EnumNumberMemberNotInitialized,e,t)},r.flowEnumErrorStringMemberInconsistentlyInitialized=function(e,t){this.raise(pv.EnumStringMemberInconsistentlyInitialized,e,t)},r.flowEnumMemberInit=function(){var e=this,t=this.state.startLoc,r=function(){return e.match(12)||e.match(8)};switch(this.state.type){case 135:var a=this.parseNumericLiteral(this.state.value);return r()?{type:"number",loc:a.loc.start,value:a}:{type:"invalid",loc:t};case 134:var n=this.parseStringLiteral(this.state.value);return r()?{type:"string",loc:n.loc.start,value:n}:{type:"invalid",loc:t};case 85:case 86:var s=this.parseBooleanLiteral(this.match(85));return r()?{type:"boolean",loc:s.loc.start,value:s}:{type:"invalid",loc:t};default:return{type:"invalid",loc:t}}},r.flowEnumMemberRaw=function(){var e=this.state.startLoc;return{id:this.parseIdentifier(!0),init:this.eat(29)?this.flowEnumMemberInit():{type:"none",loc:e}}},r.flowEnumCheckExplicitTypeMismatch=function(e,t,r){var a=t.explicitType;null!==a&&a!==r&&this.flowEnumErrorInvalidMemberInitializer(e,t)},r.flowEnumMembers=function(e){for(var t=e.enumName,r=e.explicitType,a=new Set,n={booleanMembers:[],numberMembers:[],stringMembers:[],defaultedMembers:[]},s=!1;!this.match(8);){if(this.eat(21)){s=!0;break}var o=this.startNode(),i=this.flowEnumMemberRaw(),d=i.id,c=i.init,l=d.name;if(""!==l){/^[a-z]/.test(l)&&this.raise(pv.EnumInvalidMemberName,d,{memberName:l,suggestion:l[0].toUpperCase()+l.slice(1),enumName:t}),a.has(l)&&this.raise(pv.EnumDuplicateMemberName,d,{memberName:l,enumName:t}),a.add(l);var u={enumName:t,explicitType:r,memberName:l};switch(o.id=d,c.type){case"boolean":this.flowEnumCheckExplicitTypeMismatch(c.loc,u,"boolean"),o.init=c.value,n.booleanMembers.push(this.finishNode(o,"EnumBooleanMember"));break;case"number":this.flowEnumCheckExplicitTypeMismatch(c.loc,u,"number"),o.init=c.value,n.numberMembers.push(this.finishNode(o,"EnumNumberMember"));break;case"string":this.flowEnumCheckExplicitTypeMismatch(c.loc,u,"string"),o.init=c.value,n.stringMembers.push(this.finishNode(o,"EnumStringMember"));break;case"invalid":throw this.flowEnumErrorInvalidMemberInitializer(c.loc,u);case"none":switch(r){case"boolean":this.flowEnumErrorBooleanMemberNotInitialized(c.loc,u);break;case"number":this.flowEnumErrorNumberMemberNotInitialized(c.loc,u);break;default:n.defaultedMembers.push(this.finishNode(o,"EnumDefaultedMember"))}}this.match(8)||this.expect(12)}}return{members:n,hasUnknownMembers:s}},r.flowEnumStringMembers=function(e,t,r){var a=r.enumName;if(0===e.length)return t;if(0===t.length)return e;if(t.length>e.length){for(var n=0;n=f){for(var g=0,y=i.defaultedMembers;g=f){for(var h=0,b=i.defaultedMembers;h0&&(this.raise(gh.BadGetterArity,this.state.curPosition()),this.isThisParam(r[a][0])&&this.raise(px.AccessorCannotDeclareThisParameter,this.state.curPosition()));else if("set"===r.kind){if(1!==r[a].length)this.raise(gh.BadSetterArity,this.state.curPosition());else{var s=r[a][0];this.isThisParam(s)&&this.raise(px.AccessorCannotDeclareThisParameter,this.state.curPosition()),"Identifier"===s.type&&s.optional&&this.raise(px.SetAccessorCannotHaveOptionalParameter,this.state.curPosition()),"RestElement"===s.type&&this.raise(px.SetAccessorCannotHaveRestParameter,this.state.curPosition())}r[n]&&this.raise(px.SetAccessorCannotHaveReturnType,r[n])}else r.kind="method";return this.finishNode(r,"TSMethodSignature")}var o=e;t&&(o.readonly=!0);var i=this.tsTryParseTypeAnnotation();return i&&(o.typeAnnotation=i),this.tsParseTypeMemberSemicolon(),this.finishNode(o,"TSPropertySignature")},r.tsParseTypeMember=function(){var t=this.startNode();if(this.match(10)||this.match(47))return this.tsParseSignatureMember("TSCallSignatureDeclaration",t);if(this.match(77)){var r=this.startNode();return this.next(),this.match(10)||this.match(47)?this.tsParseSignatureMember("TSConstructSignatureDeclaration",t):(t.key=this.createIdentifier(r,"new"),this.tsParsePropertyOrMethodSignature(t,!1))}this.tsParseModifiers({allowedModifiers:["readonly"],disallowedModifiers:["declare","abstract","private","protected","public","static","override"]},t);var a=this.tsTryParseIndexSignature(t);return a||(e.prototype.parsePropertyName.call(this,t),t.computed||"Identifier"!==t.key.type||"get"!==t.key.name&&"set"!==t.key.name||!this.tsTokenCanFollowModifier()||(t.kind=t.key.name,e.prototype.parsePropertyName.call(this,t),this.match(10)||this.match(47)||this.unexpected(null,10)),this.tsParsePropertyOrMethodSignature(t,!!t.readonly))},r.tsParseTypeLiteral=function(){var e=this.startNode();return e.members=this.tsParseObjectTypeMembers(),this.finishNode(e,"TSTypeLiteral")},r.tsParseObjectTypeMembers=function(){this.expect(5);var e=this.tsParseList("TypeMembers",this.tsParseTypeMember.bind(this));return this.expect(8),e},r.tsIsStartOfMappedType=function(){return this.next(),this.eat(53)?this.isContextual(122):(this.isContextual(122)&&this.next(),!!this.match(0)&&(this.next(),!!this.tsIsIdentifier()&&(this.next(),this.match(58))))},r.tsParseMappedType=function(){var e=this.startNode();this.expect(5),this.match(53)?(e.readonly=this.state.value,this.next(),this.expectContextual(122)):this.eatContextual(122)&&(e.readonly=!0),this.expect(0);var t=this.startNode();return t.name=this.tsParseTypeParameterName(),t.constraint=this.tsExpectThenParseType(58),e.typeParameter=this.finishNode(t,"TSTypeParameter"),e.nameType=this.eatContextual(93)?this.tsParseType():null,this.expect(3),this.match(53)?(e.optional=this.state.value,this.next(),this.expect(17)):this.eat(17)&&(e.optional=!0),e.typeAnnotation=this.tsTryParseType(),this.semicolon(),this.expect(8),this.finishNode(e,"TSMappedType")},r.tsParseTupleType=function(){var e=this,t=this.startNode();t.elementTypes=this.tsParseBracketedList("TupleElementTypes",this.tsParseTupleElementType.bind(this),!0,!1);var r=!1;return t.elementTypes.forEach((function(t){var a=t.type;!r||"TSRestType"===a||"TSOptionalType"===a||"TSNamedTupleMember"===a&&t.optional||e.raise(px.OptionalTypeBeforeRequired,t),r||(r="TSNamedTupleMember"===a&&t.optional||"TSOptionalType"===a)})),this.finishNode(t,"TSTupleType")},r.tsParseTupleElementType=function(){var e,t,r,a,n,s=this.state.startLoc,o=this.eat(21),i=this.state.startLoc,d=eb(this.state.type)?this.lookaheadCharCode():null;if(58===d)e=!0,r=!1,t=this.parseIdentifier(!0),this.expect(14),a=this.tsParseType();else if(63===d){r=!0;var c=this.state.value,l=this.tsParseNonArrayType();58===this.lookaheadCharCode()?(e=!0,t=this.createIdentifier(this.startNodeAt(i),c),this.expect(17),this.expect(14),a=this.tsParseType()):(e=!1,a=l,this.expect(17))}else a=this.tsParseType(),r=this.eat(17),e=this.eat(14);if(e)t?((n=this.startNodeAt(i)).optional=r,n.label=t,n.elementType=a,this.eat(17)&&(n.optional=!0,this.raise(px.TupleOptionalAfterType,this.state.lastTokStartLoc))):((n=this.startNodeAt(i)).optional=r,this.raise(px.InvalidTupleMemberLabel,a),n.label=a,n.elementType=this.tsParseType()),a=this.finishNode(n,"TSNamedTupleMember");else if(r){var u=this.startNodeAt(i);u.typeAnnotation=a,a=this.finishNode(u,"TSOptionalType")}if(o){var p=this.startNodeAt(s);p.typeAnnotation=a,a=this.finishNode(p,"TSRestType")}return a},r.tsParseParenthesizedType=function(){var e=this.startNode();return this.expect(10),e.typeAnnotation=this.tsParseType(),this.expect(11),this.finishNode(e,"TSParenthesizedType")},r.tsParseFunctionOrConstructorType=function(e,t){var r=this,a=this.startNode();return"TSConstructorType"===e&&(a.abstract=!!t,t&&this.next(),this.next()),this.tsInAllowConditionalTypesContext((function(){return r.tsFillSignature(19,a)})),this.finishNode(a,e)},r.tsParseLiteralTypeNode=function(){var t=this.startNode();switch(this.state.type){case 135:case 136:case 134:case 85:case 86:t.literal=e.prototype.parseExprAtom.call(this);break;default:this.unexpected()}return this.finishNode(t,"TSLiteralType")},r.tsParseTemplateLiteralType=function(){var t=this.startNode();return t.literal=e.prototype.parseTemplate.call(this,!1),this.finishNode(t,"TSLiteralType")},r.parseTemplateSubstitution=function(){return this.state.inType?this.tsParseType():e.prototype.parseTemplateSubstitution.call(this)},r.tsParseThisTypeOrThisTypePredicate=function(){var e=this.tsParseThisTypeNode();return this.isContextual(116)&&!this.hasPrecedingLineBreak()?this.tsParseThisTypePredicate(e):e},r.tsParseNonArrayType=function(){switch(this.state.type){case 134:case 135:case 136:case 85:case 86:return this.tsParseLiteralTypeNode();case 53:if("-"===this.state.value){var e=this.startNode(),t=this.lookahead();return 135!==t.type&&136!==t.type&&this.unexpected(),e.literal=this.parseMaybeUnary(),this.finishNode(e,"TSLiteralType")}break;case 78:return this.tsParseThisTypeOrThisTypePredicate();case 87:return this.tsParseTypeQuery();case 83:return this.tsParseImportType();case 5:return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this))?this.tsParseMappedType():this.tsParseTypeLiteral();case 0:return this.tsParseTupleType();case 10:return this.tsParseParenthesizedType();case 25:case 24:return this.tsParseTemplateLiteralType();default:var r=this.state.type;if(Zh(r)||88===r||84===r){var a=88===r?"TSVoidKeyword":84===r?"TSNullKeyword":function(e){switch(e){case"any":return"TSAnyKeyword";case"boolean":return"TSBooleanKeyword";case"bigint":return"TSBigIntKeyword";case"never":return"TSNeverKeyword";case"number":return"TSNumberKeyword";case"object":return"TSObjectKeyword";case"string":return"TSStringKeyword";case"symbol":return"TSSymbolKeyword";case"undefined":return"TSUndefinedKeyword";case"unknown":return"TSUnknownKeyword";default:return}}(this.state.value);if(void 0!==a&&46!==this.lookaheadCharCode()){var n=this.startNode();return this.next(),this.finishNode(n,a)}return this.tsParseTypeReference()}}this.unexpected()},r.tsParseArrayTypeOrHigher=function(){for(var e=this.state.startLoc,t=this.tsParseNonArrayType();!this.hasPrecedingLineBreak()&&this.eat(0);)if(this.match(3)){var r=this.startNodeAt(e);r.elementType=t,this.expect(3),t=this.finishNode(r,"TSArrayType")}else{var a=this.startNodeAt(e);a.objectType=t,a.indexType=this.tsParseType(),this.expect(3),t=this.finishNode(a,"TSIndexedAccessType")}return t},r.tsParseTypeOperator=function(){var e=this.startNode(),t=this.state.value;return this.next(),e.operator=t,e.typeAnnotation=this.tsParseTypeOperatorOrHigher(),"readonly"===t&&this.tsCheckTypeAnnotationForReadOnly(e),this.finishNode(e,"TSTypeOperator")},r.tsCheckTypeAnnotationForReadOnly=function(e){switch(e.typeAnnotation.type){case"TSTupleType":case"TSArrayType":return;default:this.raise(px.UnexpectedReadonly,e)}},r.tsParseInferType=function(){var e=this,t=this.startNode();this.expectContextual(115);var r=this.startNode();return r.name=this.tsParseTypeParameterName(),r.constraint=this.tsTryParse((function(){return e.tsParseConstraintForInferType()})),t.typeParameter=this.finishNode(r,"TSTypeParameter"),this.finishNode(t,"TSInferType")},r.tsParseConstraintForInferType=function(){var e=this;if(this.eat(81)){var t=this.tsInDisallowConditionalTypesContext((function(){return e.tsParseType()}));if(this.state.inDisallowConditionalTypesContext||!this.match(17))return t}},r.tsParseTypeOperatorOrHigher=function(){var e,t=this;return(e=this.state.type)>=121&&e<=123&&!this.state.containsEsc?this.tsParseTypeOperator():this.isContextual(115)?this.tsParseInferType():this.tsInAllowConditionalTypesContext((function(){return t.tsParseArrayTypeOrHigher()}))},r.tsParseUnionOrIntersectionType=function(e,t,r){var a=this.startNode(),n=this.eat(r),s=[];do{s.push(t())}while(this.eat(r));return 1!==s.length||n?(a.types=s,this.finishNode(a,e)):s[0]},r.tsParseIntersectionTypeOrHigher=function(){return this.tsParseUnionOrIntersectionType("TSIntersectionType",this.tsParseTypeOperatorOrHigher.bind(this),45)},r.tsParseUnionTypeOrHigher=function(){return this.tsParseUnionOrIntersectionType("TSUnionType",this.tsParseIntersectionTypeOrHigher.bind(this),43)},r.tsIsStartOfFunctionType=function(){return!!this.match(47)||this.match(10)&&this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this))},r.tsSkipParameterStart=function(){if(Zh(this.state.type)||this.match(78))return this.next(),!0;if(this.match(5)){var t=this.state.errors,r=t.length;try{return this.parseObjectLike(8,!0),t.length===r}catch(e){return!1}}if(this.match(0)){this.next();var a=this.state.errors,n=a.length;try{return e.prototype.parseBindingList.call(this,3,93,ix),a.length===n}catch(e){return!1}}return!1},r.tsIsUnambiguouslyStartOfFunctionType=function(){if(this.next(),this.match(11)||this.match(21))return!0;if(this.tsSkipParameterStart()){if(this.match(14)||this.match(12)||this.match(17)||this.match(29))return!0;if(this.match(11)&&(this.next(),this.match(19)))return!0}return!1},r.tsParseTypeOrTypePredicateAnnotation=function(e){var t=this;return this.tsInType((function(){var r=t.startNode();t.expect(e);var a=t.startNode(),n=!!t.tsTryParse(t.tsParseTypePredicateAsserts.bind(t));if(n&&t.match(78)){var s=t.tsParseThisTypeOrThisTypePredicate();return"TSThisType"===s.type?(a.parameterName=s,a.asserts=!0,a.typeAnnotation=null,s=t.finishNode(a,"TSTypePredicate")):(t.resetStartLocationFromNode(s,a),s.asserts=!0),r.typeAnnotation=s,t.finishNode(r,"TSTypeAnnotation")}var o=t.tsIsIdentifier()&&t.tsTryParse(t.tsParseTypePredicatePrefix.bind(t));if(!o)return n?(a.parameterName=t.parseIdentifier(),a.asserts=n,a.typeAnnotation=null,r.typeAnnotation=t.finishNode(a,"TSTypePredicate"),t.finishNode(r,"TSTypeAnnotation")):t.tsParseTypeAnnotation(!1,r);var i=t.tsParseTypeAnnotation(!1);return a.parameterName=o,a.typeAnnotation=i,a.asserts=n,r.typeAnnotation=t.finishNode(a,"TSTypePredicate"),t.finishNode(r,"TSTypeAnnotation")}))},r.tsTryParseTypeOrTypePredicateAnnotation=function(){if(this.match(14))return this.tsParseTypeOrTypePredicateAnnotation(14)},r.tsTryParseTypeAnnotation=function(){if(this.match(14))return this.tsParseTypeAnnotation()},r.tsTryParseType=function(){return this.tsEatThenParseType(14)},r.tsParseTypePredicatePrefix=function(){var e=this.parseIdentifier();if(this.isContextual(116)&&!this.hasPrecedingLineBreak())return this.next(),e},r.tsParseTypePredicateAsserts=function(){if(109!==this.state.type)return!1;var e=this.state.containsEsc;return this.next(),!(!Zh(this.state.type)&&!this.match(78))&&(e&&this.raise(gh.InvalidEscapedReservedWord,this.state.lastTokStartLoc,{reservedWord:"asserts"}),!0)},r.tsParseTypeAnnotation=function(e,t){var r=this;return void 0===e&&(e=!0),void 0===t&&(t=this.startNode()),this.tsInType((function(){e&&r.expect(14),t.typeAnnotation=r.tsParseType()})),this.finishNode(t,"TSTypeAnnotation")},r.tsParseType=function(){var e=this;ux(this.state.inType);var t=this.tsParseNonConditionalType();if(this.state.inDisallowConditionalTypesContext||this.hasPrecedingLineBreak()||!this.eat(81))return t;var r=this.startNodeAtNode(t);return r.checkType=t,r.extendsType=this.tsInDisallowConditionalTypesContext((function(){return e.tsParseNonConditionalType()})),this.expect(17),r.trueType=this.tsInAllowConditionalTypesContext((function(){return e.tsParseType()})),this.expect(14),r.falseType=this.tsInAllowConditionalTypesContext((function(){return e.tsParseType()})),this.finishNode(r,"TSConditionalType")},r.isAbstractConstructorSignature=function(){return this.isContextual(124)&&77===this.lookahead().type},r.tsParseNonConditionalType=function(){return this.tsIsStartOfFunctionType()?this.tsParseFunctionOrConstructorType("TSFunctionType"):this.match(77)?this.tsParseFunctionOrConstructorType("TSConstructorType"):this.isAbstractConstructorSignature()?this.tsParseFunctionOrConstructorType("TSConstructorType",!0):this.tsParseUnionTypeOrHigher()},r.tsParseTypeAssertion=function(){var e=this;this.getPluginOption("typescript","disallowAmbiguousJSXLike")&&this.raise(px.ReservedTypeAssertion,this.state.startLoc);var t=this.startNode();return t.typeAnnotation=this.tsInType((function(){return e.next(),e.match(75)?e.tsParseTypeReference():e.tsParseType()})),this.expect(48),t.expression=this.parseMaybeUnary(),this.finishNode(t,"TSTypeAssertion")},r.tsParseHeritageClause=function(e){var t=this,r=this.state.startLoc,a=this.tsParseDelimitedList("HeritageClauseElement",(function(){var e=t.startNode();return e.expression=t.tsParseEntityName(hx|bx),t.match(47)&&(e.typeParameters=t.tsParseTypeArguments()),t.finishNode(e,"TSExpressionWithTypeArguments")}));return a.length||this.raise(px.EmptyHeritageClauseType,r,{token:e}),a},r.tsParseInterfaceDeclaration=function(e,t){if(void 0===t&&(t={}),this.hasFollowingLineBreak())return null;this.expectContextual(129),t.declare&&(e.declare=!0),Zh(this.state.type)?(e.id=this.parseIdentifier(),this.checkIdentifier(e.id,Ub)):(e.id=null,this.raise(px.MissingInterfaceName,this.state.startLoc)),e.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers),this.eat(81)&&(e.extends=this.tsParseHeritageClause("extends"));var r=this.startNode();return r.body=this.tsInType(this.tsParseObjectTypeMembers.bind(this)),e.body=this.finishNode(r,"TSInterfaceBody"),this.finishNode(e,"TSInterfaceDeclaration")},r.tsParseTypeAliasDeclaration=function(e){var t=this;return e.id=this.parseIdentifier(),this.checkIdentifier(e.id,qb),e.typeAnnotation=this.tsInType((function(){if(e.typeParameters=t.tsTryParseTypeParameters(t.tsParseInOutModifiers),t.expect(29),t.isContextual(114)&&16!==t.lookahead().type){var r=t.startNode();return t.next(),t.finishNode(r,"TSIntrinsicKeyword")}return t.tsParseType()})),this.semicolon(),this.finishNode(e,"TSTypeAliasDeclaration")},r.tsInTopLevelContext=function(e){if(this.curContext()===Dh.brace)return e();var t=this.state.context;this.state.context=[t[0]];try{return e()}finally{this.state.context=t}},r.tsInType=function(e){var t=this.state.inType;this.state.inType=!0;try{return e()}finally{this.state.inType=t}},r.tsInDisallowConditionalTypesContext=function(e){var t=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=!0;try{return e()}finally{this.state.inDisallowConditionalTypesContext=t}},r.tsInAllowConditionalTypesContext=function(e){var t=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=!1;try{return e()}finally{this.state.inDisallowConditionalTypesContext=t}},r.tsEatThenParseType=function(e){if(this.match(e))return this.tsNextThenParseType()},r.tsExpectThenParseType=function(e){var t=this;return this.tsInType((function(){return t.expect(e),t.tsParseType()}))},r.tsNextThenParseType=function(){var e=this;return this.tsInType((function(){return e.next(),e.tsParseType()}))},r.tsParseEnumMember=function(){var t=this.startNode();return t.id=this.match(134)?e.prototype.parseStringLiteral.call(this,this.state.value):this.parseIdentifier(!0),this.eat(29)&&(t.initializer=e.prototype.parseMaybeAssignAllowIn.call(this)),this.finishNode(t,"TSEnumMember")},r.tsParseEnumDeclaration=function(e,t){return void 0===t&&(t={}),t.const&&(e.const=!0),t.declare&&(e.declare=!0),this.expectContextual(126),e.id=this.parseIdentifier(),this.checkIdentifier(e.id,e.const?Kb:Gb),this.expect(5),e.members=this.tsParseDelimitedList("EnumMembers",this.tsParseEnumMember.bind(this)),this.expect(8),this.finishNode(e,"TSEnumDeclaration")},r.tsParseEnumBody=function(){var e=this.startNode();return this.expect(5),e.members=this.tsParseDelimitedList("EnumMembers",this.tsParseEnumMember.bind(this)),this.expect(8),this.finishNode(e,"TSEnumBody")},r.tsParseModuleBlock=function(){var t=this.startNode();return this.scope.enter(ub),this.expect(5),e.prototype.parseBlockOrModuleBlockBody.call(this,t.body=[],void 0,!0,8),this.scope.exit(),this.finishNode(t,"TSModuleBlock")},r.tsParseModuleOrNamespaceDeclaration=function(e,t){if(void 0===t&&(t=!1),e.id=this.parseIdentifier(),t||this.checkIdentifier(e.id,zb),this.eat(16)){var r=this.startNode();this.tsParseModuleOrNamespaceDeclaration(r,!0),e.body=r}else this.scope.enter(Rb),this.prodParam.enter(kv),e.body=this.tsParseModuleBlock(),this.prodParam.exit(),this.scope.exit();return this.finishNode(e,"TSModuleDeclaration")},r.tsParseAmbientExternalModuleDeclaration=function(t){return this.isContextual(112)?(t.kind="global",t.global=!0,t.id=this.parseIdentifier()):this.match(134)?(t.kind="module",t.id=e.prototype.parseStringLiteral.call(this,this.state.value)):this.unexpected(),this.match(5)?(this.scope.enter(Rb),this.prodParam.enter(kv),t.body=this.tsParseModuleBlock(),this.prodParam.exit(),this.scope.exit()):this.semicolon(),this.finishNode(t,"TSModuleDeclaration")},r.tsParseImportEqualsDeclaration=function(e,t,r){e.isExport=r||!1,e.id=t||this.parseIdentifier(),this.checkIdentifier(e.id,Jb),this.expect(29);var a=this.tsParseModuleReference();return"type"===e.importKind&&"TSExternalModuleReference"!==a.type&&this.raise(px.ImportAliasHasImportType,a),e.moduleReference=a,this.semicolon(),this.finishNode(e,"TSImportEqualsDeclaration")},r.tsIsExternalModuleReference=function(){return this.isContextual(119)&&40===this.lookaheadCharCode()},r.tsParseModuleReference=function(){return this.tsIsExternalModuleReference()?this.tsParseExternalModuleReference():this.tsParseEntityName(mx)},r.tsParseExternalModuleReference=function(){var t=this.startNode();return this.expectContextual(119),this.expect(10),this.match(134)||this.unexpected(),t.expression=e.prototype.parseExprAtom.call(this),this.expect(11),this.sawUnambiguousESM=!0,this.finishNode(t,"TSExternalModuleReference")},r.tsLookAhead=function(e){var t=this.state.clone(),r=e();return this.state=t,r},r.tsTryParseAndCatch=function(e){var t=this.tryParse((function(t){return e()||t()}));if(!t.aborted&&t.node)return t.error&&(this.state=t.failState),t.node},r.tsTryParse=function(e){var t=this.state.clone(),r=e();if(void 0!==r&&!1!==r)return r;this.state=t},r.tsTryParseDeclare=function(t){var r=this;if(!this.isLineTerminator()){var a=this.state.type;return this.tsInAmbientContext((function(){switch(a){case 68:return t.declare=!0,e.prototype.parseFunctionStatement.call(r,t,!1,!1);case 80:return t.declare=!0,r.parseClass(t,!0,!1);case 126:return r.tsParseEnumDeclaration(t,{declare:!0});case 112:return r.tsParseAmbientExternalModuleDeclaration(t);case 100:if(r.state.containsEsc)return;case 75:case 74:return r.match(75)&&r.isLookaheadContextual("enum")?(r.expect(75),r.tsParseEnumDeclaration(t,{const:!0,declare:!0})):(t.declare=!0,r.parseVarStatement(t,r.state.value,!0));case 107:if(r.hasPlugin("explicitResourceManagement")&&r.isUsing())return r.raise(px.InvalidModifierOnUsingDeclaration,r.state.startLoc,"declare"),t.declare=!0,r.parseVarStatement(t,"using",!0);break;case 96:if(r.hasPlugin("explicitResourceManagement")&&r.isAwaitUsing())return r.raise(px.InvalidModifierOnAwaitUsingDeclaration,r.state.startLoc,"declare"),t.declare=!0,r.next(),r.parseVarStatement(t,"await using",!0);break;case 129:var n=r.tsParseInterfaceDeclaration(t,{declare:!0});if(n)return n;default:if(Zh(a))return r.tsParseDeclaration(t,r.state.value,!0,null)}}))}},r.tsTryParseExportDeclaration=function(){return this.tsParseDeclaration(this.startNode(),this.state.value,!0,null)},r.tsParseExpressionStatement=function(e,t,r){switch(t.name){case"declare":var a=this.tsTryParseDeclare(e);return a&&(a.declare=!0),a;case"global":if(this.match(5)){this.scope.enter(Rb),this.prodParam.enter(kv);var n=e;return n.kind="global",e.global=!0,n.id=t,n.body=this.tsParseModuleBlock(),this.scope.exit(),this.prodParam.exit(),this.finishNode(n,"TSModuleDeclaration")}break;default:return this.tsParseDeclaration(e,t.name,!1,r)}},r.tsParseDeclaration=function(e,t,r,a){switch(t){case"abstract":if(this.tsCheckLineTerminator(r)&&(this.match(80)||Zh(this.state.type)))return this.tsParseAbstractDeclaration(e,a);break;case"module":if(this.tsCheckLineTerminator(r)){if(this.match(134))return this.tsParseAmbientExternalModuleDeclaration(e);if(Zh(this.state.type))return e.kind="module",this.tsParseModuleOrNamespaceDeclaration(e)}break;case"namespace":if(this.tsCheckLineTerminator(r)&&Zh(this.state.type))return e.kind="namespace",this.tsParseModuleOrNamespaceDeclaration(e);break;case"type":if(this.tsCheckLineTerminator(r)&&Zh(this.state.type))return this.tsParseTypeAliasDeclaration(e)}},r.tsCheckLineTerminator=function(e){return e?!this.hasFollowingLineBreak()&&(this.next(),!0):!this.isLineTerminator()},r.tsTryParseGenericAsyncArrowFunction=function(t){var r=this;if(this.match(47)){var a=this.state.maybeInArrowParameters;this.state.maybeInArrowParameters=!0;var n=this.tsTryParseAndCatch((function(){var a=r.startNodeAt(t);return a.typeParameters=r.tsParseTypeParameters(r.tsParseConstModifier),e.prototype.parseFunctionParams.call(r,a),a.returnType=r.tsTryParseTypeOrTypePredicateAnnotation(),r.expect(19),a}));if(this.state.maybeInArrowParameters=a,n)return e.prototype.parseArrowExpression.call(this,n,null,!0)}},r.tsParseTypeArgumentsInExpression=function(){if(47===this.reScan_lt())return this.tsParseTypeArguments()},r.tsParseTypeArguments=function(){var e=this,t=this.startNode();return t.params=this.tsInType((function(){return e.tsInTopLevelContext((function(){return e.expect(47),e.tsParseDelimitedList("TypeParametersOrArguments",e.tsParseType.bind(e))}))})),0===t.params.length?this.raise(px.EmptyTypeArguments,t):this.state.inType||this.curContext()!==Dh.brace||this.reScan_lt_gt(),this.expect(48),this.finishNode(t,"TSTypeParameterInstantiation")},r.tsIsDeclarationStart=function(){return(e=this.state.type)>=124&&e<=130;var e},r.isExportDefaultSpecifier=function(){return!this.tsIsDeclarationStart()&&e.prototype.isExportDefaultSpecifier.call(this)},r.parseBindingElement=function(e,t){var r=t.length?t[0].loc.start:this.state.startLoc,a={};this.tsParseModifiers({allowedModifiers:["public","private","protected","override","readonly"]},a);var n=a.accessibility,s=a.override,o=a.readonly;e&cx||!(n||o||s)||this.raise(px.UnexpectedParameterModifier,r);var i=this.parseMaybeDefault();e&dx&&this.parseFunctionParamType(i);var d=this.parseMaybeDefault(i.loc.start,i);if(n||o||s){var c=this.startNodeAt(r);return t.length&&(c.decorators=t),n&&(c.accessibility=n),o&&(c.readonly=o),s&&(c.override=s),"Identifier"!==d.type&&"AssignmentPattern"!==d.type&&this.raise(px.UnsupportedParameterPropertyKind,c),c.parameter=d,this.finishNode(c,"TSParameterProperty")}return t.length&&(i.decorators=t),d},r.isSimpleParameter=function(t){return"TSParameterProperty"===t.type&&e.prototype.isSimpleParameter.call(this,t.parameter)||e.prototype.isSimpleParameter.call(this,t)},r.tsDisallowOptionalPattern=function(e){for(var t=0,r=e.params;ta&&!this.hasPrecedingLineBreak()&&(this.isContextual(93)||(n=this.isContextual(120)))){var o=this.startNodeAt(r);return o.expression=t,o.typeAnnotation=this.tsInType((function(){return s.next(),s.match(75)?(n&&s.raise(gh.UnexpectedKeyword,s.state.startLoc,{keyword:"const"}),s.tsParseTypeReference()):s.tsParseType()})),this.finishNode(o,n?"TSSatisfiesExpression":"TSAsExpression"),this.reScan_lt_gt(),this.parseExprOp(o,r,a)}return e.prototype.parseExprOp.call(this,t,r,a)},r.checkReservedWord=function(t,r,a,n){this.state.isAmbientContext||e.prototype.checkReservedWord.call(this,t,r,a,n)},r.checkImportReflection=function(t){e.prototype.checkImportReflection.call(this,t),t.module&&"value"!==t.importKind&&this.raise(px.ImportReflectionHasImportType,t.specifiers[0].loc.start)},r.checkDuplicateExports=function(){},r.isPotentialImportPhase=function(t){if(e.prototype.isPotentialImportPhase.call(this,t))return!0;if(this.isContextual(130)){var r=this.lookaheadCharCode();return t?123===r||42===r:61!==r}return!t&&this.isContextual(87)},r.applyImportPhase=function(t,r,a,n){e.prototype.applyImportPhase.call(this,t,r,a,n),r?t.exportKind="type"===a?"type":"value":t.importKind="type"===a||"typeof"===a?a:"value"},r.parseImport=function(t){if(this.match(134))return t.importKind="value",e.prototype.parseImport.call(this,t);var r;if(Zh(this.state.type)&&61===this.lookaheadCharCode())return t.importKind="value",this.tsParseImportEqualsDeclaration(t);if(this.isContextual(130)){var a=this.parseMaybeImportPhase(t,!1);if(61===this.lookaheadCharCode())return this.tsParseImportEqualsDeclaration(t,a);r=e.prototype.parseImportSpecifiersAndAfter.call(this,t,a)}else r=e.prototype.parseImport.call(this,t);return"type"===r.importKind&&r.specifiers.length>1&&"ImportDefaultSpecifier"===r.specifiers[0].type&&this.raise(px.TypeImportCannotSpecifyDefaultAndNamed,r),r},r.parseExport=function(t,r){if(this.match(83)){var a=t;this.next();var n=null;return this.isContextual(130)&&this.isPotentialImportPhase(!1)?n=this.parseMaybeImportPhase(a,!1):a.importKind="value",this.tsParseImportEqualsDeclaration(a,n,!0)}if(this.eat(29)){var s=t;return s.expression=e.prototype.parseExpression.call(this),this.semicolon(),this.sawUnambiguousESM=!0,this.finishNode(s,"TSExportAssignment")}if(this.eatContextual(93)){var o=t;return this.expectContextual(128),o.id=this.parseIdentifier(),this.semicolon(),this.finishNode(o,"TSNamespaceExportDeclaration")}return e.prototype.parseExport.call(this,t,r)},r.isAbstractClass=function(){return this.isContextual(124)&&80===this.lookahead().type},r.parseExportDefaultExpression=function(){if(this.isAbstractClass()){var t=this.startNode();return this.next(),t.abstract=!0,this.parseClass(t,!0,!0)}if(this.match(129)){var r=this.tsParseInterfaceDeclaration(this.startNode());if(r)return r}return e.prototype.parseExportDefaultExpression.call(this)},r.parseVarStatement=function(t,r,a){void 0===a&&(a=!1);var n=this.state.isAmbientContext,s=e.prototype.parseVarStatement.call(this,t,r,a||n);if(!n)return s;for(var o=0,i=s.declarations;othis.offsetToSourcePos(this.state.lastTokEndLoc.index)&&this.raise(wx.UnexpectedSpace,this.state.lastTokEndLoc)},o(t)}(e)}},Px=Object.keys(Tx),Ax=function(e){function t(){return e.apply(this,arguments)||this}c(t,e);var r=t.prototype;return r.checkProto=function(e,t,r,a){if("SpreadElement"===e.type||this.isObjectMethod(e)||e.computed||e.shorthand)return r;var n=e.key;return"__proto__"===("Identifier"===n.type?n.name:n.value)?t?(this.raise(gh.RecordNoProto,n),!0):(r&&(a?null===a.doubleProtoLoc&&(a.doubleProtoLoc=n.loc.start):this.raise(gh.DuplicateProto,n)),!0):r},r.shouldExitDescending=function(e,t){return"ArrowFunctionExpression"===e.type&&this.offsetToSourcePos(e.start)===t},r.getExpression=function(){if(this.enterInitialScopes(),this.nextToken(),this.match(140))throw this.raise(gh.ParseExpressionEmptyInput,this.state.startLoc);var e=this.parseExpression();if(!this.match(140))throw this.raise(gh.ParseExpressionExpectsEOF,this.state.startLoc,{unexpected:this.input.codePointAt(this.state.start)});return this.finalizeRemainingComments(),e.comments=this.comments,e.errors=this.state.errors,this.optionFlags&wh&&(e.tokens=this.tokens),e},r.parseExpression=function(e,t){var r=this;return e?this.disallowInAnd((function(){return r.parseExpressionBase(t)})):this.allowInAnd((function(){return r.parseExpressionBase(t)}))},r.parseExpressionBase=function(e){var t=this.state.startLoc,r=this.parseMaybeAssign(e);if(this.match(12)){var a=this.startNodeAt(t);for(a.expressions=[r];this.eat(12);)a.expressions.push(this.parseMaybeAssign(e));return this.toReferencedList(a.expressions),this.finishNode(a,"SequenceExpression")}return r},r.parseMaybeAssignDisallowIn=function(e,t){var r=this;return this.disallowInAnd((function(){return r.parseMaybeAssign(e,t)}))},r.parseMaybeAssignAllowIn=function(e,t){var r=this;return this.allowInAnd((function(){return r.parseMaybeAssign(e,t)}))},r.setOptionalParametersError=function(e){e.optionalParametersLoc=this.state.startLoc},r.parseMaybeAssign=function(e,t){var r,a=this.state.startLoc,n=this.isContextual(108);if(n&&this.prodParam.hasYield){this.next();var s=this.parseYield(a);return t&&(s=t.call(this,s,a)),s}e?r=!1:(e=new tx,r=!0);var o=this.state.type;(10===o||Zh(o))&&(this.state.potentialArrowAt=this.state.start);var i,d=this.parseMaybeConditional(e);if(t&&(d=t.call(this,d,a)),(i=this.state.type)>=29&&i<=33){var c=this.startNodeAt(a),l=this.state.value;if(c.operator=l,this.match(29)){this.toAssignable(d,!0),c.left=d;var u=a.index;null!=e.doubleProtoLoc&&e.doubleProtoLoc.index>=u&&(e.doubleProtoLoc=null),null!=e.shorthandAssignLoc&&e.shorthandAssignLoc.index>=u&&(e.shorthandAssignLoc=null),null!=e.privateKeyLoc&&e.privateKeyLoc.index>=u&&(this.checkDestructuringPrivate(e),e.privateKeyLoc=null)}else c.left=d;return this.next(),c.right=this.parseMaybeAssign(),this.checkLVal(d,this.finishNode(c,"AssignmentExpression")),c}if(r&&this.checkExpressionErrors(e,!0),n){var p=this.state.type;if((this.hasPlugin("v8intrinsic")?rb(p):rb(p)&&!this.match(54))&&!this.isAmbiguousPrefixOrIdentifier())return this.raiseOverwrite(gh.YieldNotInGeneratorFunction,a),this.parseYield(a)}return d},r.parseMaybeConditional=function(e){var t=this.state.startLoc,r=this.state.potentialArrowAt,a=this.parseExprOps(e);return this.shouldExitDescending(a,r)?a:this.parseConditional(a,t,e)},r.parseConditional=function(e,t,r){if(this.eat(17)){var a=this.startNodeAt(t);return a.test=e,a.consequent=this.parseMaybeAssignAllowIn(),this.expect(14),a.alternate=this.parseMaybeAssign(),this.finishNode(a,"ConditionalExpression")}return e},r.parseMaybeUnaryOrPrivate=function(e){return this.match(139)?this.parsePrivateName():this.parseMaybeUnary(e)},r.parseExprOps=function(e){var t=this.state.startLoc,r=this.state.potentialArrowAt,a=this.parseMaybeUnaryOrPrivate(e);return this.shouldExitDescending(a,r)?a:this.parseExprOp(a,t,-1)},r.parseExprOp=function(e,t,r){if(this.isPrivateName(e)){var a=this.getPrivateNameSV(e);(r>=ob(58)||!this.prodParam.hasIn||!this.match(58))&&this.raise(gh.PrivateInExpectedIn,e,{identifierName:a}),this.classScope.usePrivateName(a,e.loc.start)}var n,s=this.state.type;if((n=s)>=39&&n<=59&&(this.prodParam.hasIn||!this.match(58))){var o=ob(s);if(o>r){if(39===s){if(this.expectPlugin("pipelineOperator"),this.state.inFSharpPipelineDirectBody)return e;this.checkPipelineAtInfixOperator(e,t)}var i=this.startNodeAt(t);i.left=e,i.operator=this.state.value;var d=41===s||42===s,c=40===s;if(c&&(o=ob(42)),this.next(),39===s&&this.hasPlugin(["pipelineOperator",{proposal:"minimal"}])&&96===this.state.type&&this.prodParam.hasAwait)throw this.raise(gh.UnexpectedAwaitAfterPipelineBody,this.state.startLoc);i.right=this.parseExprOpRightExpr(s,o);var l=this.finishNode(i,d||c?"LogicalExpression":"BinaryExpression"),u=this.state.type;if(c&&(41===u||42===u)||d&&40===u)throw this.raise(gh.MixingCoalesceWithLogical,this.state.startLoc);return this.parseExprOp(l,t,r)}}return e},r.parseExprOpRightExpr=function(e,t){var r=this,a=this.state.startLoc;if(39===e){switch(this.getPluginOption("pipelineOperator","proposal")){case"hack":return this.withTopicBindingContext((function(){return r.parseHackPipeBody()}));case"fsharp":return this.withSoloAwaitPermittingContext((function(){return r.parseFSharpPipelineBody(t)}))}if("smart"===this.getPluginOption("pipelineOperator","proposal"))return this.withTopicBindingContext((function(){if(r.prodParam.hasYield&&r.isContextual(108))throw r.raise(gh.PipeBodyIsTighter,r.state.startLoc);return r.parseSmartPipelineBodyInStyle(r.parseExprOpBaseRightExpr(e,t),a)}))}return this.parseExprOpBaseRightExpr(e,t)},r.parseExprOpBaseRightExpr=function(e,t){var r=this.state.startLoc;return this.parseExprOp(this.parseMaybeUnaryOrPrivate(),r,57===e?t-1:t)},r.parseHackPipeBody=function(){var e,t=this.state.startLoc,r=this.parseMaybeAssign();return!ch.has(r.type)||null!=(e=r.extra)&&e.parenthesized||this.raise(gh.PipeUnparenthesizedBody,t,{type:r.type}),this.topicReferenceWasUsedInCurrentContext()||this.raise(gh.PipeTopicUnused,t),r},r.checkExponentialAfterUnary=function(e){this.match(57)&&this.raise(gh.UnexpectedTokenUnaryExponentiation,e.argument)},r.parseMaybeUnary=function(e,t){var r=this.state.startLoc,a=this.isContextual(96);if(a&&this.recordAwaitIfAllowed()){this.next();var n=this.parseAwait(r);return t||this.checkExponentialAfterUnary(n),n}var s,o=this.match(34),i=this.startNode();if(s=this.state.type,Jh[s]){i.operator=this.state.value,i.prefix=!0,this.match(72)&&this.expectPlugin("throwExpressions");var d=this.match(89);if(this.next(),i.argument=this.parseMaybeUnary(null,!0),this.checkExpressionErrors(e,!0),this.state.strict&&d){var c=i.argument;"Identifier"===c.type?this.raise(gh.StrictDelete,i):this.hasPropertyAsPrivateName(c)&&this.raise(gh.DeletePrivateField,i)}if(!o)return t||this.checkExponentialAfterUnary(i),this.finishNode(i,"UnaryExpression")}var l=this.parseUpdate(i,o,e);if(a){var u=this.state.type;if((this.hasPlugin("v8intrinsic")?rb(u):rb(u)&&!this.match(54))&&!this.isAmbiguousPrefixOrIdentifier())return this.raiseOverwrite(gh.AwaitNotInAsyncContext,r),this.parseAwait(r)}return l},r.parseUpdate=function(e,t,r){if(t){var a=e;return this.checkLVal(a.argument,this.finishNode(a,"UpdateExpression")),e}var n=this.state.startLoc,s=this.parseExprSubscripts(r);if(this.checkExpressionErrors(r,!1))return s;for(;34===this.state.type&&!this.canInsertSemicolon();){var o=this.startNodeAt(n);o.operator=this.state.value,o.prefix=!1,o.argument=s,this.next(),this.checkLVal(s,s=this.finishNode(o,"UpdateExpression"))}return s},r.parseExprSubscripts=function(e){var t=this.state.startLoc,r=this.state.potentialArrowAt,a=this.parseExprAtom(e);return this.shouldExitDescending(a,r)?a:this.parseSubscripts(a,t)},r.parseSubscripts=function(e,t,r){var a={optionalChainMember:!1,maybeAsyncArrow:this.atPossibleAsyncArrow(e),stop:!1};do{e=this.parseSubscript(e,t,r,a),a.maybeAsyncArrow=!1}while(!a.stop);return e},r.parseSubscript=function(e,t,r,a){var n=this.state.type;if(!r&&15===n)return this.parseBind(e,t,r,a);if(ib(n))return this.parseTaggedTemplateExpression(e,t,a);var s=!1;if(18===n){if(r&&(this.raise(gh.OptionalChainingNoNew,this.state.startLoc),40===this.lookaheadCharCode()))return this.stopParseSubscript(e,a);a.optionalChainMember=s=!0,this.next()}if(!r&&this.match(10))return this.parseCoverCallAndAsyncArrowHead(e,t,a,s);var o=this.eat(0);return o||s||this.eat(16)?this.parseMember(e,t,a,o,s):this.stopParseSubscript(e,a)},r.stopParseSubscript=function(e,t){return t.stop=!0,e},r.parseMember=function(e,t,r,a,n){var s=this.startNodeAt(t);return s.object=e,s.computed=a,a?(s.property=this.parseExpression(),this.expect(3)):this.match(139)?("Super"===e.type&&this.raise(gh.SuperPrivateField,t),this.classScope.usePrivateName(this.state.value,this.state.startLoc),s.property=this.parsePrivateName()):s.property=this.parseIdentifier(!0),r.optionalChainMember?(s.optional=n,this.finishNode(s,"OptionalMemberExpression")):this.finishNode(s,"MemberExpression")},r.parseBind=function(e,t,r,a){var n=this.startNodeAt(t);return n.object=e,this.next(),n.callee=this.parseNoCallExpr(),a.stop=!0,this.parseSubscripts(this.finishNode(n,"BindExpression"),t,r)},r.parseCoverCallAndAsyncArrowHead=function(e,t,r,a){var n=this.state.maybeInArrowParameters,s=null;this.state.maybeInArrowParameters=!0,this.next();var o=this.startNodeAt(t);o.callee=e;var i=r.maybeAsyncArrow,d=r.optionalChainMember;i&&(this.expressionScope.enter(new $v(2)),s=new tx),d&&(o.optional=a),o.arguments=a?this.parseCallExpressionArguments(11):this.parseCallExpressionArguments(11,"Super"!==e.type,o,s);var c=this.finishCallExpression(o,d);return i&&this.shouldParseAsyncArrow()&&!a?(r.stop=!0,this.checkDestructuringPrivate(s),this.expressionScope.validateAsPattern(),this.expressionScope.exit(),c=this.parseAsyncArrowFromCallExpression(this.startNodeAt(t),c)):(i&&(this.checkExpressionErrors(s,!0),this.expressionScope.exit()),this.toReferencedArguments(c)),this.state.maybeInArrowParameters=n,c},r.toReferencedArguments=function(e,t){this.toReferencedListDeep(e.arguments,t)},r.parseTaggedTemplateExpression=function(e,t,r){var a=this.startNodeAt(t);return a.tag=e,a.quasi=this.parseTemplate(!0),r.optionalChainMember&&this.raise(gh.OptionalChainingNoTemplate,t),this.finishNode(a,"TaggedTemplateExpression")},r.atPossibleAsyncArrow=function(e){return"Identifier"===e.type&&"async"===e.name&&this.state.lastTokEndLoc.index===e.end&&!this.canInsertSemicolon()&&e.end-e.start==5&&this.offsetToSourcePos(e.start)===this.state.potentialArrowAt},r.finishCallExpression=function(e,t){if("Import"===e.callee.type)if(0===e.arguments.length||e.arguments.length>2)this.raise(gh.ImportCallArity,e);else for(var r=0,a=e.arguments;r1?((t=this.startNodeAt(i)).expressions=d,this.finishNode(t,"SequenceExpression"),this.resetEndLocation(t,p)):t=d[0],this.wrapParenthesis(r,t))},r.wrapParenthesis=function(e,t){if(!(this.optionFlags&Sh))return this.addExtra(t,"parenthesized",!0),this.addExtra(t,"parenStart",e.index),this.takeSurroundingComments(t,e.index,this.state.lastTokEndLoc.index),t;var r=this.startNodeAt(e);return r.expression=t,this.finishNode(r,"ParenthesizedExpression")},r.shouldParseArrow=function(e){return!this.canInsertSemicolon()},r.parseArrow=function(e){if(this.eat(19))return e},r.parseParenItem=function(e,t){return e},r.parseNewOrNewTarget=function(){var e=this.startNode();if(this.next(),this.match(16)){var t=this.createIdentifier(this.startNodeAtNode(e),"new");this.next();var r=this.parseMetaProperty(e,t,"target");return this.scope.inNonArrowFunction||this.scope.inClass||this.optionFlags&hh||this.raise(gh.UnexpectedNewTarget,r),r}return this.parseNew(e)},r.parseNew=function(e){if(this.parseNewCallee(e),this.eat(10)){var t=this.parseExprList(11);this.toReferencedList(t),e.arguments=t}else e.arguments=[];return this.finishNode(e,"NewExpression")},r.parseNewCallee=function(e){var t=this.match(83),r=this.parseNoCallExpr();e.callee=r,!t||"Import"!==r.type&&"ImportExpression"!==r.type||this.raise(gh.ImportCallNotNewExpression,r)},r.parseTemplateElement=function(e){var t=this.state,r=t.start,a=t.startLoc,n=t.end,s=t.value,o=r+1,i=this.startNodeAt(th(a,1));null===s&&(e||this.raise(gh.InvalidEscapeSequenceTemplate,th(this.state.firstInvalidTemplateEscapePos,1)));var d=this.match(24),c=d?-1:-2,l=n+c;i.value={raw:this.input.slice(o,l).replace(/\r\n?/g,"\n"),cooked:null===s?null:s.slice(1,c)},i.tail=d,this.next();var u=this.finishNode(i,"TemplateElement");return this.resetEndLocation(u,th(this.state.lastTokEndLoc,c)),u},r.parseTemplate=function(e){for(var t=this.startNode(),r=this.parseTemplateElement(e),a=[r],n=[];!r.tail;)n.push(this.parseTemplateSubstitution()),this.readTemplateContinuation(),a.push(r=this.parseTemplateElement(e));return t.expressions=n,t.quasis=a,this.finishNode(t,"TemplateLiteral")},r.parseTemplateSubstitution=function(){return this.parseExpression()},r.parseObjectLike=function(e,t,r,a){r&&this.expectPlugin("recordAndTuple");var n=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!1;var s=!1,o=!0,i=this.startNode();for(i.properties=[],this.next();!this.match(e);){if(o)o=!1;else if(this.expect(12),this.match(e)){this.addTrailingCommaExtraToNode(i);break}var d=void 0;t?d=this.parseBindingProperty():(d=this.parsePropertyDefinition(a),s=this.checkProto(d,r,s,a)),r&&!this.isObjectProperty(d)&&"SpreadElement"!==d.type&&this.raise(gh.InvalidRecordProperty,d),d.shorthand&&this.addExtra(d,"shorthand",!0),i.properties.push(d)}this.next(),this.state.inFSharpPipelineDirectBody=n;var c="ObjectExpression";return t?c="ObjectPattern":r&&(c="RecordExpression"),this.finishNode(i,c)},r.addTrailingCommaExtraToNode=function(e){this.addExtra(e,"trailingComma",this.state.lastTokStartLoc.index),this.addExtra(e,"trailingCommaLoc",this.state.lastTokStartLoc,!1)},r.maybeAsyncOrAccessorProp=function(e){return!e.computed&&"Identifier"===e.key.type&&(this.isLiteralPropertyName()||this.match(0)||this.match(55))},r.parsePropertyDefinition=function(e){var t=[];if(this.match(26))for(this.hasPlugin("decorators")&&this.raise(gh.UnsupportedPropertyDecorator,this.state.startLoc);this.match(26);)t.push(this.parseDecorator());var r,a=this.startNode(),n=!1,s=!1;if(this.match(21))return t.length&&this.unexpected(),this.parseSpread();t.length&&(a.decorators=t,t=[]),a.method=!1,e&&(r=this.state.startLoc);var o=this.eat(55);this.parsePropertyNamePrefixOperator(a);var i=this.state.containsEsc;if(this.parsePropertyName(a,e),!o&&!i&&this.maybeAsyncOrAccessorProp(a)){var d=a.key,c=d.name;"async"!==c||this.hasPrecedingLineBreak()||(n=!0,this.resetPreviousNodeTrailingComments(d),o=this.eat(55),this.parsePropertyName(a)),"get"!==c&&"set"!==c||(s=!0,this.resetPreviousNodeTrailingComments(d),a.kind=c,this.match(55)&&(o=!0,this.raise(gh.AccessorIsGenerator,this.state.curPosition(),{kind:c}),this.next()),this.parsePropertyName(a))}return this.parseObjPropValue(a,r,o,n,!1,s,e)},r.getGetterSetterExpectedParamCount=function(e){return"get"===e.kind?0:1},r.getObjectOrClassMethodParams=function(e){return e.params},r.checkGetterSetterParams=function(e){var t,r=this.getGetterSetterExpectedParamCount(e),a=this.getObjectOrClassMethodParams(e);a.length!==r&&this.raise("get"===e.kind?gh.BadGetterArity:gh.BadSetterArity,e),"set"===e.kind&&"RestElement"===(null==(t=a[a.length-1])?void 0:t.type)&&this.raise(gh.BadSetterRestParameter,e)},r.parseObjectMethod=function(e,t,r,a,n){if(n){var s=this.parseMethod(e,t,!1,!1,!1,"ObjectMethod");return this.checkGetterSetterParams(s),s}if(r||t||this.match(10))return a&&this.unexpected(),e.kind="method",e.method=!0,this.parseMethod(e,t,r,!1,!1,"ObjectMethod")},r.parseObjectProperty=function(e,t,r,a){if(e.shorthand=!1,this.eat(14))return e.value=r?this.parseMaybeDefault(this.state.startLoc):this.parseMaybeAssignAllowIn(a),this.finishObjectProperty(e);if(!e.computed&&"Identifier"===e.key.type){if(this.checkReservedWord(e.key.name,e.key.loc.start,!0,!1),r)e.value=this.parseMaybeDefault(t,this.cloneIdentifier(e.key));else if(this.match(29)){var n=this.state.startLoc;null!=a?null===a.shorthandAssignLoc&&(a.shorthandAssignLoc=n):this.raise(gh.InvalidCoverInitializedName,n),e.value=this.parseMaybeDefault(t,this.cloneIdentifier(e.key))}else e.value=this.cloneIdentifier(e.key);return e.shorthand=!0,this.finishObjectProperty(e)}},r.finishObjectProperty=function(e){return this.finishNode(e,"ObjectProperty")},r.parseObjPropValue=function(e,t,r,a,n,s,o){var i=this.parseObjectMethod(e,r,a,n,s)||this.parseObjectProperty(e,t,n,o);return i||this.unexpected(),i},r.parsePropertyName=function(e,t){if(this.eat(0))e.computed=!0,e.key=this.parseMaybeAssignAllowIn(),this.expect(3);else{var r,a=this.state,n=a.type,s=a.value;if(eb(n))r=this.parseIdentifier(!0);else switch(n){case 135:r=this.parseNumericLiteral(s);break;case 134:r=this.parseStringLiteral(s);break;case 136:r=this.parseBigIntLiteral(s);break;case 139:var o=this.state.startLoc;null!=t?null===t.privateKeyLoc&&(t.privateKeyLoc=o):this.raise(gh.UnexpectedPrivateField,o),r=this.parsePrivateName();break;default:if(137===n){r=this.parseDecimalLiteral(s);break}this.unexpected()}e.key=r,139!==n&&(e.computed=!1)}},r.initFunction=function(e,t){e.id=null,e.generator=!1,e.async=t},r.parseMethod=function(e,t,r,a,n,s,o){void 0===o&&(o=!1),this.initFunction(e,r),e.generator=t,this.scope.enter(fb|mb|(o?bb:0)|(n?hb:0)),this.prodParam.enter(Nv(r,e.generator)),this.parseFunctionParams(e,a);var i=this.parseFunctionBodyAndFinish(e,s,!0);return this.prodParam.exit(),this.scope.exit(),i},r.parseArrayLike=function(e,t,r,a){r&&this.expectPlugin("recordAndTuple");var n=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!1;var s=this.startNode();return this.next(),s.elements=this.parseExprList(e,!r,a,s),this.state.inFSharpPipelineDirectBody=n,this.finishNode(s,r?"TupleExpression":"ArrayExpression")},r.parseArrowExpression=function(e,t,r,a){this.scope.enter(fb|gb);var n=Nv(r,!1);!this.match(5)&&this.prodParam.hasIn&&(n|=Dv),this.prodParam.enter(n),this.initFunction(e,r);var s=this.state.maybeInArrowParameters;return t&&(this.state.maybeInArrowParameters=!0,this.setArrowFunctionParameters(e,t,a)),this.state.maybeInArrowParameters=!1,this.parseFunctionBody(e,!0),this.prodParam.exit(),this.scope.exit(),this.state.maybeInArrowParameters=s,this.finishNode(e,"ArrowFunctionExpression")},r.setArrowFunctionParameters=function(e,t,r){this.toAssignableList(t,r,!1),e.params=t},r.parseFunctionBodyAndFinish=function(e,t,r){return void 0===r&&(r=!1),this.parseFunctionBody(e,!1,r),this.finishNode(e,t)},r.parseFunctionBody=function(e,t,r){var a=this;void 0===r&&(r=!1);var n=t&&!this.match(5);if(this.expressionScope.enter(Zv()),n)e.body=this.parseMaybeAssign(),this.checkParams(e,!1,t,!1);else{var s=this.state.strict,o=this.state.labels;this.state.labels=[],this.prodParam.enter(this.prodParam.currentFlags()|Iv),e.body=this.parseBlock(!0,!1,(function(n){var o=!a.isSimpleParamList(e.params);n&&o&&a.raise(gh.IllegalLanguageModeDirective,"method"!==e.kind&&"constructor"!==e.kind||!e.key?e:e.key.loc.end);var i=!s&&a.state.strict;a.checkParams(e,!(a.state.strict||t||r||o),t,i),a.state.strict&&e.id&&a.checkIdentifier(e.id,Hb,i)})),this.prodParam.exit(),this.state.labels=o}this.expressionScope.exit()},r.isSimpleParameter=function(e){return"Identifier"===e.type},r.isSimpleParamList=function(e){for(var t=0,r=e.length;t10)&&function(e){return cb.has(e)}(e))if(r&&Jr(e))this.raise(gh.UnexpectedKeyword,t,{keyword:e});else if((this.state.strict?a?Xr:Kr:Hr)(e,this.inModule))this.raise(gh.UnexpectedReservedWord,t,{reservedWord:e});else if("yield"===e){if(this.prodParam.hasYield)return void this.raise(gh.YieldBindingIdentifier,t)}else if("await"===e){if(this.prodParam.hasAwait)return void this.raise(gh.AwaitBindingIdentifier,t);if(this.scope.inStaticBlock)return void this.raise(gh.AwaitBindingIdentifierInStaticBlock,t);this.expressionScope.recordAsyncArrowParametersError(t)}else if("arguments"===e&&this.scope.inClassAndNotInNonArrowFunction)return void this.raise(gh.ArgumentsInClass,t)},r.recordAwaitIfAllowed=function(){var e=this.prodParam.hasAwait||this.optionFlags&yh&&!this.scope.inFunction;return e&&!this.scope.inFunction&&(this.state.hasTopLevelAwait=!0),e},r.parseAwait=function(e){var t=this.startNodeAt(e);return this.expressionScope.recordParameterInitializerError(gh.AwaitExpressionFormalParameter,t),this.eat(55)&&this.raise(gh.ObsoleteAwaitStar,t),this.scope.inFunction||this.optionFlags&yh||(this.isAmbiguousPrefixOrIdentifier()?this.ambiguousScriptDifferentAst=!0:this.sawUnambiguousESM=!0),this.state.soloAwait||(t.argument=this.parseMaybeUnary(null,!0)),this.finishNode(t,"AwaitExpression")},r.isAmbiguousPrefixOrIdentifier=function(){if(this.hasPrecedingLineBreak())return!0;var e=this.state.type;return 53===e||10===e||0===e||ib(e)||102===e&&!this.state.containsEsc||138===e||56===e||this.hasPlugin("v8intrinsic")&&54===e},r.parseYield=function(e){var t=this.startNodeAt(e);this.expressionScope.recordParameterInitializerError(gh.YieldInParameter,t);var r=!1,a=null;if(!this.hasPrecedingLineBreak())switch(r=this.eat(55),this.state.type){case 13:case 140:case 8:case 11:case 3:case 9:case 14:case 12:if(!r)break;default:a=this.parseMaybeAssign()}return t.delegate=r,t.argument=a,this.finishNode(t,"YieldExpression")},r.parseImportCall=function(e){if(this.next(),e.source=this.parseMaybeAssignAllowIn(),e.options=null,this.eat(12))if(this.match(11))this.addTrailingCommaExtraToNode(e.source);else if(e.options=this.parseMaybeAssignAllowIn(),this.eat(12)&&(this.addTrailingCommaExtraToNode(e.options),!this.match(11))){do{this.parseMaybeAssignAllowIn()}while(this.eat(12)&&!this.match(11));this.raise(gh.ImportCallArity,e)}return this.expect(11),this.finishNode(e,"ImportExpression")},r.checkPipelineAtInfixOperator=function(e,t){this.hasPlugin(["pipelineOperator",{proposal:"smart"}])&&"SequenceExpression"===e.type&&this.raise(gh.PipelineHeadSequenceExpression,t)},r.parseSmartPipelineBodyInStyle=function(e,t){if(this.isSimpleReference(e)){var r=this.startNodeAt(t);return r.callee=e,this.finishNode(r,"PipelineBareFunction")}var a=this.startNodeAt(t);return this.checkSmartPipeTopicBodyEarlyErrors(t),a.expression=e,this.finishNode(a,"PipelineTopicExpression")},r.isSimpleReference=function(e){switch(e.type){case"MemberExpression":return!e.computed&&this.isSimpleReference(e.object);case"Identifier":return!0;default:return!1}},r.checkSmartPipeTopicBodyEarlyErrors=function(e){if(this.match(19))throw this.raise(gh.PipelineBodyNoArrow,this.state.startLoc);this.topicReferenceWasUsedInCurrentContext()||this.raise(gh.PipelineTopicUnused,e)},r.withTopicBindingContext=function(e){var t=this.state.topicContext;this.state.topicContext={maxNumOfResolvableTopics:1,maxTopicIndex:null};try{return e()}finally{this.state.topicContext=t}},r.withSmartMixTopicForbiddingContext=function(e){if(!this.hasPlugin(["pipelineOperator",{proposal:"smart"}]))return e();var t=this.state.topicContext;this.state.topicContext={maxNumOfResolvableTopics:0,maxTopicIndex:null};try{return e()}finally{this.state.topicContext=t}},r.withSoloAwaitPermittingContext=function(e){var t=this.state.soloAwait;this.state.soloAwait=!0;try{return e()}finally{this.state.soloAwait=t}},r.allowInAnd=function(e){var t=this.prodParam.currentFlags();if(Dv&~t){this.prodParam.enter(t|Dv);try{return e()}finally{this.prodParam.exit()}}return e()},r.disallowInAnd=function(e){var t=this.prodParam.currentFlags();if(Dv&t){this.prodParam.enter(t&~Dv);try{return e()}finally{this.prodParam.exit()}}return e()},r.registerTopicReference=function(){this.state.topicContext.maxTopicIndex=0},r.topicReferenceIsAllowedInCurrentContext=function(){return this.state.topicContext.maxNumOfResolvableTopics>=1},r.topicReferenceWasUsedInCurrentContext=function(){return null!=this.state.topicContext.maxTopicIndex&&this.state.topicContext.maxTopicIndex>=0},r.parseFSharpPipelineBody=function(e){var t=this.state.startLoc;this.state.potentialArrowAt=this.state.start;var r=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!0;var a=this.parseExprOp(this.parseMaybeUnaryOrPrivate(),t,e);return this.state.inFSharpPipelineDirectBody=r,a},r.parseModuleExpression=function(){this.expectPlugin("moduleBlocks");var e=this.startNode();this.next(),this.match(5)||this.unexpected(null,5);var t=this.startNodeAt(this.state.endLoc);this.next();var r=this.initializeScopes(!0);this.enterInitialScopes();try{e.body=this.parseProgram(t,8,"module")}finally{r()}return this.finishNode(e,"ModuleExpression")},r.parsePropertyNamePrefixOperator=function(e){},o(t)}(lx),kx={kind:qv},Cx={kind:Gv},_x=0,Ix=1,Dx=2,Ox=4,Nx=8,Bx=0,Mx=1,Fx=2,Lx=4,Ux=8,qx=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Gx=new RegExp("in(?:stanceof)?","y");var Wx=function(e){function t(){return e.apply(this,arguments)||this}c(t,e);var r=t.prototype;return r.parseTopLevel=function(e,t){return e.program=this.parseProgram(t),e.comments=this.comments,this.optionFlags&wh&&(e.tokens=function(e,t,r){for(var a=0;a0)for(var a=0,n=Array.from(this.scope.undefinedExports);a=90&&o<=92?qv:this.match(71)?Gv:null,d=this.state.labels.length-1;d>=0;d--){var c=this.state.labels[d];if(c.statementStart!==e.start)break;c.statementStart=this.sourceToOffsetPos(this.state.start),c.kind=i}return this.state.labels.push({name:t,kind:i,statementStart:this.sourceToOffsetPos(this.state.start)}),e.body=a&Ux?this.parseStatementOrSloppyAnnexBFunctionDeclaration(!0):this.parseStatement(),this.state.labels.pop(),e.label=r,this.finishNode(e,"LabeledStatement")},r.parseExpressionStatement=function(e,t,r){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},r.parseBlock=function(e,t,r){void 0===e&&(e=!1),void 0===t&&(t=!0);var a=this.startNode();return e&&this.state.strictErrors.clear(),this.expect(5),t&&this.scope.enter(ub),this.parseBlockBody(a,e,!1,8,r),t&&this.scope.exit(),this.finishNode(a,"BlockStatement")},r.isValidDirective=function(e){return"ExpressionStatement"===e.type&&"StringLiteral"===e.expression.type&&!e.expression.extra.parenthesized},r.parseBlockBody=function(e,t,r,a,n){var s=e.body=[],o=e.directives=[];this.parseBlockOrModuleBlockBody(s,t?o:void 0,r,a,n)},r.parseBlockOrModuleBlockBody=function(e,t,r,a,n){for(var s=this.state.strict,o=!1,i=!1;!this.match(a);){var d=r?this.parseModuleItem():this.parseStatementListItem();if(t&&!i){if(this.isValidDirective(d)){var c=this.stmtToDirective(d);t.push(c),o||"use strict"!==c.value.value||(o=!0,this.setStrict(!0));continue}i=!0,this.state.strictErrors.clear()}e.push(d)}null==n||n.call(this,o),s||this.setStrict(!1),this.next()},r.parseFor=function(e,t){var r=this;return e.init=t,this.semicolon(!1),e.test=this.match(13)?null:this.parseExpression(),this.semicolon(!1),e.update=this.match(11)?null:this.parseExpression(),this.expect(11),e.body=this.withSmartMixTopicForbiddingContext((function(){return r.parseStatement()})),this.scope.exit(),this.state.labels.pop(),this.finishNode(e,"ForStatement")},r.parseForIn=function(e,t,r){var a=this,n=this.match(58);return this.next(),n?null!==r&&this.unexpected(r):e.await=null!==r,"VariableDeclaration"!==t.type||null==t.declarations[0].init||n&&this.options.annexB&&!this.state.strict&&"var"===t.kind&&"Identifier"===t.declarations[0].id.type||this.raise(gh.ForInOfLoopInitializer,t,{type:n?"ForInStatement":"ForOfStatement"}),"AssignmentPattern"===t.type&&this.raise(gh.InvalidLhs,t,{ancestor:{type:"ForStatement"}}),e.left=t,e.right=n?this.parseExpression():this.parseMaybeAssignAllowIn(),this.expect(11),e.body=this.withSmartMixTopicForbiddingContext((function(){return a.parseStatement()})),this.scope.exit(),this.state.labels.pop(),this.finishNode(e,n?"ForInStatement":"ForOfStatement")},r.parseVar=function(e,t,r,a){void 0===a&&(a=!1);var n=e.declarations=[];for(e.kind=r;;){var s=this.startNode();if(this.parseVarId(s,r),s.init=this.eat(29)?t?this.parseMaybeAssignDisallowIn():this.parseMaybeAssignAllowIn():null,null!==s.init||a||("Identifier"===s.id.type||t&&(this.match(58)||this.isContextual(102))?"const"!==r&&"using"!==r&&"await using"!==r||this.match(58)||this.isContextual(102)||this.raise(gh.DeclarationMissingInitializer,this.state.lastTokEndLoc,{kind:r}):this.raise(gh.DeclarationMissingInitializer,this.state.lastTokEndLoc,{kind:"destructuring"})),n.push(this.finishNode(s,"VariableDeclarator")),!this.eat(12))break}return e},r.parseVarId=function(e,t){var r=this.parseBindingAtom();"using"!==t&&"await using"!==t||"ArrayPattern"!==r.type&&"ObjectPattern"!==r.type||this.raise(gh.UsingDeclarationHasBindingPattern,r.loc.start),this.checkLVal(r,{type:"VariableDeclarator"},"var"===t?Fb:Bb),e.id=r},r.parseAsyncFunctionExpression=function(e){return this.parseFunction(e,Nx)},r.parseFunction=function(e,t){var r=this;void 0===t&&(t=_x);var a=t&Dx,n=!!(t&Ix),s=n&&!(t&Ox),o=!!(t&Nx);this.initFunction(e,o),this.match(55)&&(a&&this.raise(gh.GeneratorInSingleStatementContext,this.state.startLoc),this.next(),e.generator=!0),n&&(e.id=this.parseFunctionId(s));var i=this.state.maybeInArrowParameters;return this.state.maybeInArrowParameters=!1,this.scope.enter(fb),this.prodParam.enter(Nv(o,e.generator)),n||(e.id=this.parseFunctionId()),this.parseFunctionParams(e,!1),this.withSmartMixTopicForbiddingContext((function(){r.parseFunctionBodyAndFinish(e,n?"FunctionDeclaration":"FunctionExpression")})),this.prodParam.exit(),this.scope.exit(),n&&!a&&this.registerFunctionStatementId(e),this.state.maybeInArrowParameters=i,e},r.parseFunctionId=function(e){return e||Zh(this.state.type)?this.parseIdentifier():null},r.parseFunctionParams=function(e,t){this.expect(10),this.expressionScope.enter(new Yv(3)),e.params=this.parseBindingList(11,41,dx|(t?cx:0)),this.expressionScope.exit()},r.registerFunctionStatementId=function(e){e.id&&this.scope.declareName(e.id.name,!this.options.annexB||this.state.strict||e.generator||e.async?this.scope.treatFunctionsAsVar?Fb:Bb:Lb,e.id.loc.start)},r.parseClass=function(e,t,r){this.next();var a=this.state.strict;return this.state.strict=!0,this.parseClassId(e,t,r),this.parseClassSuper(e),e.body=this.parseClassBody(!!e.superClass,a),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},r.isClassProperty=function(){return this.match(29)||this.match(13)||this.match(8)},r.isClassMethod=function(){return this.match(10)},r.nameIsConstructor=function(e){return"Identifier"===e.type&&"constructor"===e.name||"StringLiteral"===e.type&&"constructor"===e.value},r.isNonstaticConstructor=function(e){return!e.computed&&!e.static&&this.nameIsConstructor(e.key)},r.parseClassBody=function(e,t){var r=this;this.classScope.enter();var a={hadConstructor:!1,hadSuperClass:e},n=[],s=this.startNode();if(s.body=[],this.expect(5),this.withSmartMixTopicForbiddingContext((function(){for(;!r.match(8);)if(r.eat(13)){if(n.length>0)throw r.raise(gh.DecoratorSemicolon,r.state.lastTokEndLoc)}else if(r.match(26))n.push(r.parseDecorator());else{var e=r.startNode();n.length&&(e.decorators=n,r.resetStartLocationFromNode(e,n[0]),n=[]),r.parseClassMember(s,e,a),"constructor"===e.kind&&e.decorators&&e.decorators.length>0&&r.raise(gh.DecoratorConstructor,e)}})),this.state.strict=t,this.next(),n.length)throw this.raise(gh.TrailingDecorator,this.state.startLoc);return this.classScope.exit(),this.finishNode(s,"ClassBody")},r.parseClassMemberFromModifier=function(e,t){var r=this.parseIdentifier(!0);if(this.isClassMethod()){var a=t;return a.kind="method",a.computed=!1,a.key=r,a.static=!1,this.pushClassMethod(e,a,!1,!1,!1,!1),!0}if(this.isClassProperty()){var n=t;return n.computed=!1,n.key=r,n.static=!1,e.body.push(this.parseClassProperty(n)),!0}return this.resetPreviousNodeTrailingComments(r),!1},r.parseClassMember=function(e,t,r){var a=this.isContextual(106);if(a){if(this.parseClassMemberFromModifier(e,t))return;if(this.eat(5))return void this.parseClassStaticBlock(e,t)}this.parseClassMemberWithIsStatic(e,t,r,a)},r.parseClassMemberWithIsStatic=function(e,t,r,a){var n=t,s=t,o=t,i=t,d=t,c=n,l=n;if(t.static=a,this.parsePropertyNamePrefixOperator(t),this.eat(55)){c.kind="method";var u=this.match(139);return this.parseClassElementName(c),this.parsePostMemberNameModifiers(c),u?void this.pushClassPrivateMethod(e,s,!0,!1):(this.isNonstaticConstructor(n)&&this.raise(gh.ConstructorIsGenerator,n.key),void this.pushClassMethod(e,n,!0,!1,!1,!1))}var p=!this.state.containsEsc&&Zh(this.state.type),f=this.parseClassElementName(t),g=p?f.name:null,y=this.isPrivateName(f),m=this.state.startLoc;if(this.parsePostMemberNameModifiers(l),this.isClassMethod()){if(c.kind="method",y)return void this.pushClassPrivateMethod(e,s,!1,!1);var h=this.isNonstaticConstructor(n),b=!1;h&&(n.kind="constructor",r.hadConstructor&&!this.hasPlugin("typescript")&&this.raise(gh.DuplicateConstructor,f),h&&this.hasPlugin("typescript")&&t.override&&this.raise(gh.OverrideOnConstructor,f),r.hadConstructor=!0,b=r.hadSuperClass),this.pushClassMethod(e,n,!1,!1,h,b)}else if(this.isClassProperty())y?this.pushClassPrivateProperty(e,i):this.pushClassProperty(e,o);else if("async"!==g||this.isLineTerminator())if("get"!==g&&"set"!==g||this.match(55)&&this.isLineTerminator())if("accessor"!==g||this.isLineTerminator())this.isLineTerminator()?y?this.pushClassPrivateProperty(e,i):this.pushClassProperty(e,o):this.unexpected();else{this.expectPlugin("decoratorAutoAccessors"),this.resetPreviousNodeTrailingComments(f);var v=this.match(139);this.parseClassElementName(o),this.pushClassAccessorProperty(e,d,v)}else{this.resetPreviousNodeTrailingComments(f),c.kind=g;var x=this.match(139);this.parseClassElementName(n),x?this.pushClassPrivateMethod(e,s,!1,!1):(this.isNonstaticConstructor(n)&&this.raise(gh.ConstructorIsAccessor,n.key),this.pushClassMethod(e,n,!1,!1,!1,!1)),this.checkGetterSetterParams(n)}else{this.resetPreviousNodeTrailingComments(f);var R=this.eat(55);l.optional&&this.unexpected(m),c.kind="method";var j=this.match(139);this.parseClassElementName(c),this.parsePostMemberNameModifiers(l),j?this.pushClassPrivateMethod(e,s,R,!0):(this.isNonstaticConstructor(n)&&this.raise(gh.ConstructorIsAsync,n.key),this.pushClassMethod(e,n,R,!0,!1,!1))}},r.parseClassElementName=function(e){var t=this.state,r=t.type,a=t.value;if(132!==r&&134!==r||!e.static||"prototype"!==a||this.raise(gh.StaticPrototype,this.state.startLoc),139===r){"constructor"===a&&this.raise(gh.ConstructorClassPrivateField,this.state.startLoc);var n=this.parsePrivateName();return e.key=n,n}return this.parsePropertyName(e),e.key},r.parseClassStaticBlock=function(e,t){var r;this.scope.enter(bb|vb|mb);var a=this.state.labels;this.state.labels=[],this.prodParam.enter(kv);var n=t.body=[];this.parseBlockOrModuleBlockBody(n,void 0,!1,8),this.prodParam.exit(),this.scope.exit(),this.state.labels=a,e.body.push(this.finishNode(t,"StaticBlock")),null!=(r=t.decorators)&&r.length&&this.raise(gh.DecoratorStaticBlock,t)},r.pushClassProperty=function(e,t){!t.computed&&this.nameIsConstructor(t.key)&&this.raise(gh.ConstructorClassField,t.key),e.body.push(this.parseClassProperty(t))},r.pushClassPrivateProperty=function(e,t){var r=this.parseClassPrivateProperty(t);e.body.push(r),this.classScope.declarePrivateName(this.getPrivateNameSV(r.key),$b,r.key.loc.start)},r.pushClassAccessorProperty=function(e,t,r){r||t.computed||!this.nameIsConstructor(t.key)||this.raise(gh.ConstructorClassField,t.key);var a=this.parseClassAccessorProperty(t);e.body.push(a),r&&this.classScope.declarePrivateName(this.getPrivateNameSV(a.key),$b,a.key.loc.start)},r.pushClassMethod=function(e,t,r,a,n,s){e.body.push(this.parseMethod(t,r,a,n,s,"ClassMethod",!0))},r.pushClassPrivateMethod=function(e,t,r,a){var n=this.parseMethod(t,r,a,!1,!1,"ClassPrivateMethod",!0);e.body.push(n);var s="get"===n.kind?n.static?ev:rv:"set"===n.kind?n.static?tv:av:$b;this.declareClassPrivateMethodInScope(n,s)},r.declareClassPrivateMethodInScope=function(e,t){this.classScope.declarePrivateName(this.getPrivateNameSV(e.key),t,e.key.loc.start)},r.parsePostMemberNameModifiers=function(e){},r.parseClassPrivateProperty=function(e){return this.parseInitializer(e),this.semicolon(),this.finishNode(e,"ClassPrivateProperty")},r.parseClassProperty=function(e){return this.parseInitializer(e),this.semicolon(),this.finishNode(e,"ClassProperty")},r.parseClassAccessorProperty=function(e){return this.parseInitializer(e),this.semicolon(),this.finishNode(e,"ClassAccessorProperty")},r.parseInitializer=function(e){this.scope.enter(bb|mb),this.expressionScope.enter(Zv()),this.prodParam.enter(kv),e.value=this.eat(29)?this.parseMaybeAssignAllowIn():null,this.expressionScope.exit(),this.prodParam.exit(),this.scope.exit()},r.parseClassId=function(e,t,r,a){if(void 0===a&&(a=Nb),Zh(this.state.type))e.id=this.parseIdentifier(),t&&this.declareNameFromIdentifier(e.id,a);else{if(!r&&t)throw this.raise(gh.MissingClassName,this.state.startLoc);e.id=null}},r.parseClassSuper=function(e){e.superClass=this.eat(81)?this.parseExprSubscripts():null},r.parseExport=function(e,t){var r=this.parseMaybeImportPhase(e,!0),a=this.maybeParseExportDefaultSpecifier(e,r),n=!a||this.eat(12),s=n&&this.eatExportStar(e),o=s&&this.maybeParseExportNamespaceSpecifier(e),i=n&&(!o||this.eat(12)),d=a||s;if(s&&!o){if(a&&this.unexpected(),t)throw this.raise(gh.UnsupportedDecoratorExport,e);return this.parseExportFrom(e,!0),this.sawUnambiguousESM=!0,this.finishNode(e,"ExportAllDeclaration")}var c,l=this.maybeParseExportNamedSpecifiers(e);if(a&&n&&!s&&!l&&this.unexpected(null,5),o&&i&&this.unexpected(null,98),d||l){if(c=!1,t)throw this.raise(gh.UnsupportedDecoratorExport,e);this.parseExportFrom(e,d)}else c=this.maybeParseExportDeclaration(e);if(d||l||c){var u,p=e;if(this.checkExport(p,!0,!1,!!p.source),"ClassDeclaration"===(null==(u=p.declaration)?void 0:u.type))this.maybeTakeDecorators(t,p.declaration,p);else if(t)throw this.raise(gh.UnsupportedDecoratorExport,e);return this.sawUnambiguousESM=!0,this.finishNode(p,"ExportNamedDeclaration")}if(this.eat(65)){var f=e,g=this.parseExportDefaultExpression();if(f.declaration=g,"ClassDeclaration"===g.type)this.maybeTakeDecorators(t,g,f);else if(t)throw this.raise(gh.UnsupportedDecoratorExport,e);return this.checkExport(f,!0,!0),this.sawUnambiguousESM=!0,this.finishNode(f,"ExportDefaultDeclaration")}this.unexpected(null,5)},r.eatExportStar=function(e){return this.eat(55)},r.maybeParseExportDefaultSpecifier=function(e,t){if(t||this.isExportDefaultSpecifier()){this.expectPlugin("exportDefaultFrom",null==t?void 0:t.loc.start);var r=t||this.parseIdentifier(!0),a=this.startNodeAtNode(r);return a.exported=r,e.specifiers=[this.finishNode(a,"ExportDefaultSpecifier")],!0}return!1},r.maybeParseExportNamespaceSpecifier=function(e){if(this.isContextual(93)){var t;null!=(t=e).specifiers||(t.specifiers=[]);var r=this.startNodeAt(this.state.lastTokStartLoc);return this.next(),r.exported=this.parseModuleExportName(),e.specifiers.push(this.finishNode(r,"ExportNamespaceSpecifier")),!0}return!1},r.maybeParseExportNamedSpecifiers=function(e){if(this.match(5)){var t,r=e;r.specifiers||(r.specifiers=[]);var a="type"===r.exportKind;return(t=r.specifiers).push.apply(t,this.parseExportSpecifiers(a)),r.source=null,this.hasPlugin("importAssertions")?r.assertions=[]:r.attributes=[],r.declaration=null,!0}return!1},r.maybeParseExportDeclaration=function(e){return!!this.shouldParseExportDeclaration()&&(e.specifiers=[],e.source=null,this.hasPlugin("importAssertions")?e.assertions=[]:e.attributes=[],e.declaration=this.parseExportDeclaration(e),!0)},r.isAsyncFunction=function(){if(!this.isContextual(95))return!1;var e=this.nextTokenInLineStart();return this.isUnparsedContextual(e,"function")},r.parseExportDefaultExpression=function(){var e=this.startNode();if(this.match(68))return this.next(),this.parseFunction(e,Ix|Ox);if(this.isAsyncFunction())return this.next(),this.next(),this.parseFunction(e,Ix|Ox|Nx);if(this.match(80))return this.parseClass(e,!0,!0);if(this.match(26))return this.hasPlugin("decorators")&&!0===this.getPluginOption("decorators","decoratorsBeforeExport")&&this.raise(gh.DecoratorBeforeExport,this.state.startLoc),this.parseClass(this.maybeTakeDecorators(this.parseDecorators(!1),this.startNode()),!0,!0);if(this.match(75)||this.match(74)||this.isLet()||this.hasPlugin("explicitResourceManagement")&&(this.isUsing()||this.isAwaitUsing()))throw this.raise(gh.UnsupportedDefaultExport,this.state.startLoc);var t=this.parseMaybeAssignAllowIn();return this.semicolon(),t},r.parseExportDeclaration=function(e){return this.match(80)?this.parseClass(this.startNode(),!0,!1):this.parseStatementListItem()},r.isExportDefaultSpecifier=function(){var e=this.state.type;if(Zh(e)){if(95===e&&!this.state.containsEsc||100===e)return!1;if((130===e||129===e)&&!this.state.containsEsc){var t=this.lookahead().type;if(Zh(t)&&98!==t||5===t)return this.expectOnePlugin(["flow","typescript"]),!1}}else if(!this.match(65))return!1;var r=this.nextTokenStart(),a=this.isUnparsedContextual(r,"from");if(44===this.input.charCodeAt(r)||Zh(this.state.type)&&a)return!0;if(this.match(65)&&a){var n=this.input.charCodeAt(this.nextTokenStartSince(r+4));return 34===n||39===n}return!1},r.parseExportFrom=function(e,t){this.eatContextual(98)?(e.source=this.parseImportSource(),this.checkExport(e),this.maybeParseImportAttributes(e),this.checkJSONModuleImport(e)):t&&this.unexpected(),this.semicolon()},r.shouldParseExportDeclaration=function(){var e=this.state.type;if(26===e&&(this.expectOnePlugin(["decorators","decorators-legacy"]),this.hasPlugin("decorators")))return!0===this.getPluginOption("decorators","decoratorsBeforeExport")&&this.raise(gh.DecoratorBeforeExport,this.state.startLoc),!0;if(this.hasPlugin("explicitResourceManagement")){if(this.isUsing())return this.raise(gh.UsingDeclarationExport,this.state.startLoc),!0;if(this.isAwaitUsing())return this.raise(gh.UsingDeclarationExport,this.state.startLoc),!0}return 74===e||75===e||68===e||80===e||this.isLet()||this.isAsyncFunction()},r.checkExport=function(e,t,r,a){var n;if(t)if(r){if(this.checkDuplicateExports(e,"default"),this.hasPlugin("exportDefaultFrom")){var s,o=e.declaration;"Identifier"!==o.type||"from"!==o.name||o.end-o.start!=4||null!=(s=o.extra)&&s.parenthesized||this.raise(gh.ExportDefaultFromAsIdentifier,o)}}else if(null!=(n=e.specifiers)&&n.length)for(var i=0,d=e.specifiers;i0&&this.raise(gh.ImportReflectionHasAssertion,t[0].loc.start)}},r.checkJSONModuleImport=function(e){if(this.isJSONModuleImport(e)&&"ExportAllDeclaration"!==e.type){var t=e.specifiers;if(null!=t){var r=t.find((function(e){var t;if("ExportSpecifier"===e.type?t=e.local:"ImportSpecifier"===e.type&&(t=e.imported),void 0!==t)return"Identifier"===t.type?"default"!==t.name:"default"!==t.value}));void 0!==r&&this.raise(gh.ImportJSONBindingNotDefault,r.loc.start)}}},r.isPotentialImportPhase=function(e){return!e&&(this.isContextual(105)||this.isContextual(97)||this.isContextual(127))},r.applyImportPhase=function(e,t,r,a){t||("module"===r?(this.expectPlugin("importReflection",a),e.module=!0):this.hasPlugin("importReflection")&&(e.module=!1),"source"===r?(this.expectPlugin("sourcePhaseImports",a),e.phase="source"):"defer"===r?(this.expectPlugin("deferredImportEvaluation",a),e.phase="defer"):this.hasPlugin("sourcePhaseImports")&&(e.phase=null))},r.parseMaybeImportPhase=function(e,t){if(!this.isPotentialImportPhase(t))return this.applyImportPhase(e,t,null),null;var r=this.startNode(),a=this.parseIdentifierName(!0),n=this.state.type;return(eb(n)?98!==n||102===this.lookaheadCharCode():12!==n)?(this.applyImportPhase(e,t,a,r.loc.start),null):(this.applyImportPhase(e,t,null),this.createIdentifier(r,a))},r.isPrecedingIdImportPhase=function(e){var t=this.state.type;return Zh(t)?98!==t||102===this.lookaheadCharCode():12!==t},r.parseImport=function(e){return this.match(134)?this.parseImportSourceAndAttributes(e):this.parseImportSpecifiersAndAfter(e,this.parseMaybeImportPhase(e,!1))},r.parseImportSpecifiersAndAfter=function(e,t){e.specifiers=[];var r=!this.maybeParseDefaultImportSpecifier(e,t)||this.eat(12),a=r&&this.maybeParseStarImportSpecifier(e);return r&&!a&&this.parseNamedImportSpecifiers(e),this.expectContextual(98),this.parseImportSourceAndAttributes(e)},r.parseImportSourceAndAttributes=function(e){return null!=e.specifiers||(e.specifiers=[]),e.source=this.parseImportSource(),this.maybeParseImportAttributes(e),this.checkImportReflection(e),this.checkJSONModuleImport(e),this.semicolon(),this.sawUnambiguousESM=!0,this.finishNode(e,"ImportDeclaration")},r.parseImportSource=function(){return this.match(134)||this.unexpected(),this.parseExprAtom()},r.parseImportSpecifierLocal=function(e,t,r){t.local=this.parseIdentifier(),e.specifiers.push(this.finishImportSpecifier(t,r))},r.finishImportSpecifier=function(e,t,r){return void 0===r&&(r=Bb),this.checkLVal(e.local,{type:t},r),this.finishNode(e,t)},r.parseImportAttributes=function(){this.expect(5);var e=[],t=new Set;do{if(this.match(8))break;var r=this.startNode(),a=this.state.value;if(t.has(a)&&this.raise(gh.ModuleAttributesWithDuplicateKeys,this.state.startLoc,{key:a}),t.add(a),this.match(134)?r.key=this.parseStringLiteral(a):r.key=this.parseIdentifier(!0),this.expect(14),!this.match(134))throw this.raise(gh.ModuleAttributeInvalidValue,this.state.startLoc);r.value=this.parseStringLiteral(this.state.value),e.push(this.finishNode(r,"ImportAttribute"))}while(this.eat(12));return this.expect(8),e},r.parseModuleAttributes=function(){var e=[],t=new Set;do{var r=this.startNode();if(r.key=this.parseIdentifier(!0),"type"!==r.key.name&&this.raise(gh.ModuleAttributeDifferentFromType,r.key),t.has(r.key.name)&&this.raise(gh.ModuleAttributesWithDuplicateKeys,r.key,{key:r.key.name}),t.add(r.key.name),this.expect(14),!this.match(134))throw this.raise(gh.ModuleAttributeInvalidValue,this.state.startLoc);r.value=this.parseStringLiteral(this.state.value),e.push(this.finishNode(r,"ImportAttribute"))}while(this.eat(12));return e},r.maybeParseImportAttributes=function(e){var t,r=!1;if(this.match(76)){if(this.hasPrecedingLineBreak()&&40===this.lookaheadCharCode())return;this.next(),this.hasPlugin("moduleAttributes")?(t=this.parseModuleAttributes(),this.addExtra(e,"deprecatedWithLegacySyntax",!0)):t=this.parseImportAttributes(),r=!0}else this.isContextual(94)&&!this.hasPrecedingLineBreak()?(this.hasPlugin("deprecatedImportAssert")||this.hasPlugin("importAssertions")||this.raise(gh.ImportAttributesUseAssert,this.state.startLoc),this.hasPlugin("importAssertions")||this.addExtra(e,"deprecatedAssertSyntax",!0),this.next(),t=this.parseImportAttributes()):t=[];!r&&this.hasPlugin("importAssertions")?e.assertions=t:e.attributes=t},r.maybeParseDefaultImportSpecifier=function(e,t){if(t){var r=this.startNodeAtNode(t);return r.local=t,e.specifiers.push(this.finishImportSpecifier(r,"ImportDefaultSpecifier")),!0}return!!eb(this.state.type)&&(this.parseImportSpecifierLocal(e,this.startNode(),"ImportDefaultSpecifier"),!0)},r.maybeParseStarImportSpecifier=function(e){if(this.match(55)){var t=this.startNode();return this.next(),this.expectContextual(93),this.parseImportSpecifierLocal(e,t,"ImportNamespaceSpecifier"),!0}return!1},r.parseNamedImportSpecifiers=function(e){var t=!0;for(this.expect(5);!this.eat(8);){if(t)t=!1;else{if(this.eat(14))throw this.raise(gh.DestructureNamedImport,this.state.startLoc);if(this.expect(12),this.eat(8))break}var r=this.startNode(),a=this.match(134),n=this.isContextual(130);r.imported=this.parseModuleExportName();var s=this.parseImportSpecifier(r,a,"type"===e.importKind||"typeof"===e.importKind,n,void 0);e.specifiers.push(s)}},r.parseImportSpecifier=function(e,t,r,a,n){if(this.eatContextual(93))e.local=this.parseIdentifier();else{var s=e.imported;if(t)throw this.raise(gh.ImportBindingIsString,e,{importName:s.value});this.checkReservedWord(s.name,e.loc.start,!0,!0),e.local||(e.local=this.cloneIdentifier(s))}return this.finishImportSpecifier(e,"ImportSpecifier",n)},r.isThisParam=function(e){return"Identifier"===e.type&&"this"===e.name},o(t)}(Ax),Vx=function(e){function t(t,r,a){var n;t=function(e){var t={sourceType:"script",sourceFilename:void 0,startIndex:0,startColumn:0,startLine:1,allowAwaitOutsideFunction:!1,allowReturnOutsideFunction:!1,allowNewTargetOutsideFunction:!1,allowImportExportEverywhere:!1,allowSuperOutsideMethod:!1,allowUndeclaredExports:!1,allowYieldOutsideFunction:!1,plugins:[],strictMode:null,ranges:!1,tokens:!1,createImportExpressions:!1,createParenthesizedExpressions:!1,errorRecovery:!1,attachComment:!0,annexB:!0};if(null==e)return t;if(null!=e.annexB&&!1!==e.annexB)throw new Error("The `annexB` option can only be set to `false`.");for(var r=0,a=Object.keys(t);r0?t.startIndex=t.startColumn:null==e.startColumn&&t.startIndex>0&&(t.startColumn=t.startIndex);else if((null==e.startColumn||null==e.startIndex)&&null!=e.startIndex)throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.");return t}(t),(n=e.call(this,t,r)||this).options=t,n.initializeScopes(),n.plugins=a,n.filename=t.sourceFilename,n.startIndex=t.startIndex;var s=0;return t.allowAwaitOutsideFunction&&(s|=yh),t.allowReturnOutsideFunction&&(s|=mh),t.allowImportExportEverywhere&&(s|=bh),t.allowSuperOutsideMethod&&(s|=vh),t.allowUndeclaredExports&&(s|=Rh),t.allowNewTargetOutsideFunction&&(s|=hh),t.allowYieldOutsideFunction&&(s|=xh),t.ranges&&(s|=jh),t.tokens&&(s|=wh),t.createImportExpressions&&(s|=Eh),t.createParenthesizedExpressions&&(s|=Sh),t.errorRecovery&&(s|=Th),t.attachComment&&(s|=Ph),t.annexB&&(s|=Ah),n.optionFlags=s,n}c(t,e);var r=t.prototype;return r.getScopeHandler=function(){return dv},r.parse=function(){this.enterInitialScopes();var e=this.startNode(),t=this.startNode();return this.nextToken(),e.errors=null,this.parseTopLevel(e,t),e.errors=this.state.errors,e.comments.length=this.state.commentsLen,e},o(t)}(Wx);function Hx(e,t){var r;if("unambiguous"!==(null==(r=t)?void 0:r.sourceType))return zx(t,e).parse();t=Object.assign({},t);try{t.sourceType="module";var a=zx(t,e),n=a.parse();if(a.sawUnambiguousESM)return n;if(a.ambiguousScriptDifferentAst)try{return t.sourceType="script",zx(t,e).parse()}catch(e){}else n.program.sourceType="script";return n}catch(r){try{return t.sourceType="script",zx(t,e).parse()}catch(e){}throw r}}var Kx=function(e){for(var t={},r=0,a=Object.keys(e);r!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g,cR.matchToToken=function(e){var t={type:"invalid",value:e[0],closed:void 0};return e[1]?(t.type="string",t.closed=!(!e[3]&&!e[4])):e[5]?t.type="comment":e[6]?(t.type="comment",t.closed=!!e[7]):e[8]?t.type="regex":e[9]?t.type="number":e[10]?t.type="name":e[11]?t.type="punctuator":e[12]&&(t.type="whitespace"),t}),cR}var uR,pR=(void V.env.BABEL_8_BREAKING,lR()),fR=new Set(["as","async","from","get","of","set"]),gR=/\r\n|[\n\r\u2028\u2029]/,yR=/^[()[\]{}]$/,mR=/^[a-z][\w-]*$/i,hR=function(e,t,r){if("name"===e.type){if(Jr(e.value)||Kr(e.value,!0)||fR.has(e.value))return"keyword";if(mR.test(e.value)&&("<"===r[t-1]||""),n.gutter(s),e.length>0?" "+e:"",l].join("")}return" "+n.gutter(s)+(e.length>0?" "+e:"")})).join("\n");return r.message&&!l&&(f=""+" ".repeat(u+1)+r.message+"\n"+f),a?n.reset(f):f}var xR=Q,RR=te,jR=or,wR=oe,ER=Pt,SR=ye,TR=It,PR=rr,AR=ce,kR=bm,CR=km,_R=/^[_$A-Z0-9]+$/;function IR(e,t,r){var a=r.placeholderWhitelist,n=r.placeholderPattern,s=r.preserveComments,o=r.syntacticPlaceholders,i=function(e,t,r){var a=(t.plugins||[]).slice();!1!==r&&a.push("placeholders");t=Object.assign({allowAwaitOutsideFunction:!0,allowReturnOutsideFunction:!0,allowNewTargetOutsideFunction:!0,allowSuperOutsideMethod:!0,allowYieldOutsideFunction:!0,sourceType:"module"},t,{plugins:a});try{return Hx(e,t)}catch(t){var n=t.loc;throw n&&(t.message+="\n"+vR(e,{start:n}),t.code="BABEL_TEMPLATE_PARSE_ERROR"),t}}(t,r.parser,o);kR(i,{preserveComments:s}),e.validate(i);var d={syntactic:{placeholders:[],placeholderNames:new Set},legacy:{placeholders:[],placeholderNames:new Set},placeholderWhitelist:a,placeholderPattern:n,syntacticPlaceholders:o};return CR(i,DR,d),Object.assign({ast:i},d.syntactic.placeholders.length?d.syntactic:d.legacy)}function DR(e,t,r){var a,n,s=r.syntactic.placeholders.length>0;if(TR(e)){if(!1===r.syntacticPlaceholders)throw new Error("%%foo%%-style placeholders can't be used when '.syntacticPlaceholders' is false.");n=e.name.name,s=!0}else{if(s||r.syntacticPlaceholders)return;if(wR(e)||ER(e))n=e.name;else{if(!AR(e))return;n=e.value}}if(s&&(null!=r.placeholderPattern||null!=r.placeholderWhitelist))throw new Error("'.placeholderWhitelist' and '.placeholderPattern' aren't compatible with '.syntacticPlaceholders: true'");if(s||!1!==r.placeholderPattern&&(r.placeholderPattern||_R).test(n)||null!=(a=r.placeholderWhitelist)&&a.has(n)){var o,i=(t=t.slice())[t.length-1],d=i.node,c=i.key;AR(e)||TR(e,{expectedNode:"StringLiteral"})?o="string":SR(d)&&"arguments"===c||xR(d)&&"arguments"===c||jR(d)&&"params"===c?o="param":RR(d)&&!TR(e)?(o="statement",t=t.slice(0,-1)):o=PR(e)&&TR(e)?"statement":"other";var l=s?r.syntactic:r.legacy,u=l.placeholders,p=l.placeholderNames;u.push({name:n,type:o,resolve:function(e){return function(e,t){for(var r=e,a=0;a1?a-1:0),o=1;o1)throw new Error("Unexpected extra params.");return XR(VR(e,t,Ym(n,$m(s[0]))))}if(Array.isArray(t)){var i=r.get(t);return i||(i=HR(e,t,n),r.set(t,i)),XR(i(s))}if("object"==typeof t&&t){if(s.length>0)throw new Error("Unexpected extra params.");return zR(e,Ym(n,$m(t)))}throw new Error("Unexpected template param "+typeof t)}),{ast:function(t){for(var r=arguments.length,s=new Array(r>1?r-1:0),o=1;o1)throw new Error("Unexpected extra params.");return VR(e,t,Ym(Ym(n,$m(s[0])),KR))()}if(Array.isArray(t)){var i=a.get(t);return i||(i=HR(e,t,Ym(n,KR)),a.set(t,i)),i(s)()}throw new Error("Unexpected template param "+typeof t)}})}function XR(e){var t="";try{throw new Error}catch(e){e.stack&&(t=e.stack.split("\n").slice(3).join("\n"))}return function(r){try{return e(r)}catch(e){throw e.stack+="\n =============\n"+t,e}}}var JR=zR(Hm),YR=zR(zm),$R=zR(Km),QR=zR(Xm),ZR=zR({code:function(e){return e},validate:function(){},unwrap:function(e){return e.program}}),ej=Object.assign(JR.bind(void 0),{smart:JR,statement:YR,statements:$R,expression:QR,program:ZR,ast:JR.ast}),tj=Object.freeze({__proto__:null,default:ej,expression:QR,program:ZR,smart:JR,statement:YR,statements:$R});function rj(e,t,r){return Object.freeze({minVersion:e,ast:function(){return ej.program.ast(t,{preserveComments:!0})},metadata:r})}var aj={__proto__:null,OverloadYield:rj("7.18.14","function _OverloadYield(e,d){this.v=e,this.k=d}",{globals:[],locals:{_OverloadYield:["body.0.id"]},exportBindingAssignments:[],exportName:"_OverloadYield",dependencies:{},internal:!1}),applyDecoratedDescriptor:rj("7.0.0-beta.0",'function _applyDecoratedDescriptor(i,e,r,n,l){var a={};return Object.keys(n).forEach((function(i){a[i]=n[i]})),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=r.slice().reverse().reduce((function(r,n){return n(i,e,r)||r}),a),l&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(l):void 0,a.initializer=void 0),void 0===a.initializer?(Object.defineProperty(i,e,a),null):a}',{globals:["Object"],locals:{_applyDecoratedDescriptor:["body.0.id"]},exportBindingAssignments:[],exportName:"_applyDecoratedDescriptor",dependencies:{},internal:!1}),applyDecs2311:rj("7.24.0",'function applyDecs2311(e,t,n,r,o,i){var a,c,u,s,f,l,p,d=Symbol.metadata||Symbol.for("Symbol.metadata"),m=Object.defineProperty,h=Object.create,y=[h(null),h(null)],v=t.length;function g(t,n,r){return function(o,i){n&&(i=o,o=e);for(var a=0;a=0;O-=n?2:1){var T=b(h[O],"A decorator","be",!0),z=n?h[O-1]:void 0,A={},H={kind:["field","accessor","method","getter","setter","class"][o],name:r,metadata:a,addInitializer:function(e,t){if(e.v)throw new TypeError("attempted to call addInitializer after decoration was finished");b(t,"An initializer","be",!0),i.push(t)}.bind(null,A)};if(w)c=T.call(z,N,H),A.v=1,b(c,"class decorators","return")&&(N=c);else if(H.static=s,H.private=f,c=H.access={has:f?p.bind():function(e){return r in e}},j||(c.get=f?E?function(e){return d(e),P.value}:I("get",0,d):function(e){return e[r]}),E||S||(c.set=f?I("set",0,d):function(e,t){e[r]=t}),N=T.call(z,D?{get:P.get,set:P.set}:P[F],H),A.v=1,D){if("object"==typeof N&&N)(c=b(N.get,"accessor.get"))&&(P.get=c),(c=b(N.set,"accessor.set"))&&(P.set=c),(c=b(N.init,"accessor.init"))&&k.unshift(c);else if(void 0!==N)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else b(N,(l?"field":"method")+" decorators","return")&&(l?k.unshift(N):P[F]=N)}return o<2&&u.push(g(k,s,1),g(i,s,0)),l||w||(f?D?u.splice(-1,0,I("get",s),I("set",s)):u.push(E?P[F]:b.call.bind(P[F])):m(e,r,P)),N}function w(e){return m(e,d,{configurable:!0,enumerable:!0,value:a})}return void 0!==i&&(a=i[d]),a=h(null==a?null:a),f=[],l=function(e){e&&f.push(g(e))},p=function(t,r){for(var i=0;ir.length)&&(a=r.length);for(var e=0,n=Array(a);e=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(r){throw r},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){t=t.call(r)},n:function(){var r=t.next();return a=r.done,r},e:function(r){u=!0,o=r},f:function(){try{a||null==t.return||t.return()}finally{if(u)throw o}}}}',{globals:["Symbol","Array","TypeError"],locals:{_createForOfIteratorHelper:["body.0.id"]},exportBindingAssignments:[],exportName:"_createForOfIteratorHelper",dependencies:{unsupportedIterableToArray:["body.0.body.body.1.consequent.body.0.test.left.right.right.callee"]},internal:!1}),createForOfIteratorHelperLoose:rj("7.9.0",'function _createForOfIteratorHelperLoose(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(t)return(t=t.call(r)).next.bind(t);if(Array.isArray(r)||(t=unsupportedIterableToArray(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var o=0;return function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}',{globals:["Symbol","Array","TypeError"],locals:{_createForOfIteratorHelperLoose:["body.0.id"]},exportBindingAssignments:[],exportName:"_createForOfIteratorHelperLoose",dependencies:{unsupportedIterableToArray:["body.0.body.body.2.test.left.right.right.callee"]},internal:!1}),createSuper:rj("7.9.0","function _createSuper(t){var r=isNativeReflectConstruct();return function(){var e,o=getPrototypeOf(t);if(r){var s=getPrototypeOf(this).constructor;e=Reflect.construct(o,arguments,s)}else e=o.apply(this,arguments);return possibleConstructorReturn(this,e)}}",{globals:["Reflect"],locals:{_createSuper:["body.0.id"]},exportBindingAssignments:[],exportName:"_createSuper",dependencies:{getPrototypeOf:["body.0.body.body.1.argument.body.body.0.declarations.1.init.callee","body.0.body.body.1.argument.body.body.1.consequent.body.0.declarations.0.init.object.callee"],isNativeReflectConstruct:["body.0.body.body.0.declarations.0.init.callee"],possibleConstructorReturn:["body.0.body.body.1.argument.body.body.2.argument.callee"]},internal:!1}),decorate:rj("7.1.5",'function _decorate(e,r,t,i){var o=_getDecoratorsApi();if(i)for(var n=0;n=0;n--){var s=r[e.placement];s.splice(s.indexOf(e.key),1);var a=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,o[n])(a)||a);e=l.element,this.addElementPlacement(e,r),l.finisher&&i.push(l.finisher);var c=l.extras;if(c){for(var p=0;p=0;i--){var o=this.fromClassDescriptor(e),n=this.toClassDescriptor((0,r[i])(o)||o);if(void 0!==n.finisher&&t.push(n.finisher),void 0!==n.elements){e=n.elements;for(var s=0;s1){for(var t=Array(n),f=0;f3?(o=l===n)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&dn||n>l)&&(i[4]=r,i[5]=n,G.n=l,c=0))}if(o||r>1)return a;throw y=!0,n}return function(o,p,l){if(f>1)throw TypeError("Generator is already running");for(y&&1===p&&d(p,l),c=p,u=l;(t=c<2?e:u)||!y;){i||(c?c<3?(c>1&&(G.n=-1),d(c,u)):G.n=u:G.v=u);try{if(f=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a \'"+o+"\' method"),c=1);i=e}else if((t=(y=G.n<0)?u:r.call(n,G))!==a)break}catch(t){i=e,c=1,u=t}finally{f=1}}return{value:t,done:y}}}(r,o,i),!0),u}var a={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}t=Object.getPrototypeOf;var c=[][n]?t(t([][n]())):(define(t={},n,(function(){return this})),t),u=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(c);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,GeneratorFunctionPrototype):(e.__proto__=GeneratorFunctionPrototype,define(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(u,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName="GeneratorFunction",define(GeneratorFunctionPrototype,o,"GeneratorFunction"),define(u),define(u,o,"Generator"),define(u,n,(function(){return this})),define(u,"toString",(function(){return"[object Generator]"})),(_regenerator=function(){return{w:i,m:f}})()}',{globals:["Symbol","Object","TypeError"],locals:{_regenerator:["body.0.id","body.0.body.body.9.argument.expressions.9.callee.left"]},exportBindingAssignments:["body.0.body.body.9.argument.expressions.9.callee"],exportName:"_regenerator",dependencies:{regeneratorDefine:["body.0.body.body.1.body.body.1.argument.expressions.0.callee","body.0.body.body.7.declarations.0.init.alternate.expressions.0.callee","body.0.body.body.8.body.body.0.argument.expressions.0.alternate.expressions.1.callee","body.0.body.body.9.argument.expressions.1.callee","body.0.body.body.9.argument.expressions.2.callee","body.0.body.body.9.argument.expressions.4.callee","body.0.body.body.9.argument.expressions.5.callee","body.0.body.body.9.argument.expressions.6.callee","body.0.body.body.9.argument.expressions.7.callee","body.0.body.body.9.argument.expressions.8.callee"]},internal:!1}),regeneratorAsync:rj("7.27.0","function _regeneratorAsync(n,e,r,t,o){var a=asyncGen(n,e,r,t,o);return a.next().then((function(n){return n.done?n.value:a.next()}))}",{globals:[],locals:{_regeneratorAsync:["body.0.id"]},exportBindingAssignments:[],exportName:"_regeneratorAsync",dependencies:{regeneratorAsyncGen:["body.0.body.body.0.declarations.0.init.callee"]},internal:!1}),regeneratorAsyncGen:rj("7.27.0","function _regeneratorAsyncGen(r,e,t,o,n){return new regeneratorAsyncIterator(regenerator().w(r,e,t,o),n||Promise)}",{globals:["Promise"],locals:{_regeneratorAsyncGen:["body.0.id"]},exportBindingAssignments:[],exportName:"_regeneratorAsyncGen",dependencies:{regenerator:["body.0.body.body.0.argument.arguments.0.callee.object.callee"],regeneratorAsyncIterator:["body.0.body.body.0.argument.callee"]},internal:!1}),regeneratorAsyncIterator:rj("7.27.0",'function AsyncIterator(t,e){function n(r,o,i,f){try{var c=t[r](o),u=c.value;return u instanceof OverloadYield?e.resolve(u.v).then((function(t){n("next",t,i,f)}),(function(t){n("throw",t,i,f)})):e.resolve(u).then((function(t){c.value=t,i(c)}),(function(t){return n("throw",t,i,f)}))}catch(t){f(t)}}var r;this.next||(define(AsyncIterator.prototype),define(AsyncIterator.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",(function(){return this}))),define(this,"_invoke",(function(t,o,i){function f(){return new e((function(e,r){n(t,i,e,r)}))}return r=r?r.then(f,f):f()}),!0)}',{globals:["Symbol"],locals:{AsyncIterator:["body.0.id","body.0.body.body.2.expression.expressions.0.right.expressions.0.arguments.0.object","body.0.body.body.2.expression.expressions.0.right.expressions.1.arguments.0.object"]},exportBindingAssignments:[],exportName:"AsyncIterator",dependencies:{OverloadYield:["body.0.body.body.0.body.body.0.block.body.1.argument.test.right"],regeneratorDefine:["body.0.body.body.2.expression.expressions.0.right.expressions.0.callee","body.0.body.body.2.expression.expressions.0.right.expressions.1.callee","body.0.body.body.2.expression.expressions.1.callee"]},internal:!0}),regeneratorDefine:rj("7.27.0",'function regeneratorDefine(e,r,n,t){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}regeneratorDefine=function(e,r,n,t){if(r)i?i(e,r,{value:n,enumerable:!t,configurable:!t,writable:!t}):e[r]=n;else{function o(r,n){regeneratorDefine(e,r,(function(e){return this._invoke(r,n,e)}))}o("next",0),o("throw",1),o("return",2)}},regeneratorDefine(e,r,n,t)}',{globals:["Object"],locals:{regeneratorDefine:["body.0.id","body.0.body.body.2.expression.expressions.0.right.body.body.0.alternate.body.0.body.body.0.expression.callee","body.0.body.body.2.expression.expressions.1.callee","body.0.body.body.2.expression.expressions.0.left"]},exportBindingAssignments:["body.0.body.body.2.expression.expressions.0"],exportName:"regeneratorDefine",dependencies:{},internal:!0}),regeneratorKeys:rj("7.27.0","function _regeneratorKeys(e){var n=Object(e),r=[];for(var t in n)r.unshift(t);return function e(){for(;r.length;)if((t=r.pop())in n)return e.value=t,e.done=!1,e;return e.done=!0,e}}",{globals:["Object"],locals:{_regeneratorKeys:["body.0.id"]},exportBindingAssignments:[],exportName:"_regeneratorKeys",dependencies:{},internal:!1}),regeneratorValues:rj("7.18.0",'function _regeneratorValues(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],r=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}throw new TypeError(typeof e+" is not iterable")}',{globals:["Symbol","isNaN","TypeError"],locals:{_regeneratorValues:["body.0.id"]},exportBindingAssignments:[],exportName:"_regeneratorValues",dependencies:{},internal:!1}),set:rj("7.0.0-beta.0",'function set(e,r,t,o){return set="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(e,r,t,o){var f,i=superPropBase(e,r);if(i){if((f=Object.getOwnPropertyDescriptor(i,r)).set)return f.set.call(o,t),!0;if(!f.writable)return!1}if(f=Object.getOwnPropertyDescriptor(o,r)){if(!f.writable)return!1;f.value=t,Object.defineProperty(o,r,f)}else defineProperty(o,r,t);return!0},set(e,r,t,o)}function _set(e,r,t,o,f){if(!set(e,r,t,o||e)&&f)throw new TypeError("failed to set property");return t}',{globals:["Reflect","Object","TypeError"],locals:{set:["body.0.id","body.0.body.body.0.argument.expressions.1.callee","body.1.body.body.0.test.left.argument.callee","body.0.body.body.0.argument.expressions.0.left"],_set:["body.1.id"]},exportBindingAssignments:[],exportName:"_set",dependencies:{superPropBase:["body.0.body.body.0.argument.expressions.0.right.alternate.body.body.0.declarations.1.init.callee"],defineProperty:["body.0.body.body.0.argument.expressions.0.right.alternate.body.body.2.alternate.expression.callee"]},internal:!1}),setFunctionName:rj("7.23.6",'function setFunctionName(e,t,n){"symbol"==typeof t&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:n?n+" "+t:t})}catch(e){}return e}',{globals:["Object"],locals:{setFunctionName:["body.0.id"]},exportBindingAssignments:[],exportName:"setFunctionName",dependencies:{},internal:!1}),setPrototypeOf:rj("7.0.0-beta.0","function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_setPrototypeOf(t,e)}",{globals:["Object"],locals:{_setPrototypeOf:["body.0.id","body.0.body.body.0.argument.expressions.1.callee","body.0.body.body.0.argument.expressions.0.left"]},exportBindingAssignments:["body.0.body.body.0.argument.expressions.0"],exportName:"_setPrototypeOf",dependencies:{},internal:!1}),skipFirstGeneratorNext:rj("7.0.0-beta.0","function _skipFirstGeneratorNext(t){return function(){var r=t.apply(this,arguments);return r.next(),r}}",{globals:[],locals:{_skipFirstGeneratorNext:["body.0.id"]},exportBindingAssignments:[],exportName:"_skipFirstGeneratorNext",dependencies:{},internal:!1}),slicedToArray:rj("7.0.0-beta.0","function _slicedToArray(r,e){return arrayWithHoles(r)||iterableToArrayLimit(r,e)||unsupportedIterableToArray(r,e)||nonIterableRest()}",{globals:[],locals:{_slicedToArray:["body.0.id"]},exportBindingAssignments:[],exportName:"_slicedToArray",dependencies:{arrayWithHoles:["body.0.body.body.0.argument.left.left.left.callee"],iterableToArrayLimit:["body.0.body.body.0.argument.left.left.right.callee"],unsupportedIterableToArray:["body.0.body.body.0.argument.left.right.callee"],nonIterableRest:["body.0.body.body.0.argument.right.callee"]},internal:!1}),superPropBase:rj("7.0.0-beta.0","function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=getPrototypeOf(t)););return t}",{globals:[],locals:{_superPropBase:["body.0.id"]},exportBindingAssignments:[],exportName:"_superPropBase",dependencies:{getPrototypeOf:["body.0.body.body.0.test.right.right.right.callee"]},internal:!1}),superPropGet:rj("7.25.0",'function _superPropGet(t,o,e,r){var p=get(getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t)}:p}',{globals:[],locals:{_superPropGet:["body.0.id"]},exportBindingAssignments:[],exportName:"_superPropGet",dependencies:{get:["body.0.body.body.0.declarations.0.init.callee"],getPrototypeOf:["body.0.body.body.0.declarations.0.init.arguments.0.callee"]},internal:!1}),superPropSet:rj("7.25.0","function _superPropSet(t,e,o,r,p,f){return set(getPrototypeOf(f?t.prototype:t),e,o,r,p)}",{globals:[],locals:{_superPropSet:["body.0.id"]},exportBindingAssignments:[],exportName:"_superPropSet",dependencies:{set:["body.0.body.body.0.argument.callee"],getPrototypeOf:["body.0.body.body.0.argument.arguments.0.callee"]},internal:!1}),taggedTemplateLiteral:rj("7.0.0-beta.0","function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}",{globals:["Object"],locals:{_taggedTemplateLiteral:["body.0.id"]},exportBindingAssignments:[],exportName:"_taggedTemplateLiteral",dependencies:{},internal:!1}),taggedTemplateLiteralLoose:rj("7.0.0-beta.0","function _taggedTemplateLiteralLoose(e,t){return t||(t=e.slice(0)),e.raw=t,e}",{globals:[],locals:{_taggedTemplateLiteralLoose:["body.0.id"]},exportBindingAssignments:[],exportName:"_taggedTemplateLiteralLoose",dependencies:{},internal:!1}),tdz:rj("7.5.5",'function _tdzError(e){throw new ReferenceError(e+" is not defined - temporal dead zone")}',{globals:["ReferenceError"],locals:{_tdzError:["body.0.id"]},exportBindingAssignments:[],exportName:"_tdzError",dependencies:{},internal:!1}),temporalRef:rj("7.0.0-beta.0","function _temporalRef(r,e){return r===undef?err(e):r}",{globals:[],locals:{_temporalRef:["body.0.id"]},exportBindingAssignments:[],exportName:"_temporalRef",dependencies:{temporalUndefined:["body.0.body.body.0.argument.test.right"],tdz:["body.0.body.body.0.argument.consequent.callee"]},internal:!1}),temporalUndefined:rj("7.0.0-beta.0","function _temporalUndefined(){}",{globals:[],locals:{_temporalUndefined:["body.0.id"]},exportBindingAssignments:[],exportName:"_temporalUndefined",dependencies:{},internal:!1}),toArray:rj("7.0.0-beta.0","function _toArray(r){return arrayWithHoles(r)||iterableToArray(r)||unsupportedIterableToArray(r)||nonIterableRest()}",{globals:[],locals:{_toArray:["body.0.id"]},exportBindingAssignments:[],exportName:"_toArray",dependencies:{arrayWithHoles:["body.0.body.body.0.argument.left.left.left.callee"],iterableToArray:["body.0.body.body.0.argument.left.left.right.callee"],unsupportedIterableToArray:["body.0.body.body.0.argument.left.right.callee"],nonIterableRest:["body.0.body.body.0.argument.right.callee"]},internal:!1}),toConsumableArray:rj("7.0.0-beta.0","function _toConsumableArray(r){return arrayWithoutHoles(r)||iterableToArray(r)||unsupportedIterableToArray(r)||nonIterableSpread()}",{globals:[],locals:{_toConsumableArray:["body.0.id"]},exportBindingAssignments:[],exportName:"_toConsumableArray",dependencies:{arrayWithoutHoles:["body.0.body.body.0.argument.left.left.left.callee"],iterableToArray:["body.0.body.body.0.argument.left.left.right.callee"],unsupportedIterableToArray:["body.0.body.body.0.argument.left.right.callee"],nonIterableSpread:["body.0.body.body.0.argument.right.callee"]},internal:!1}),toPrimitive:rj("7.1.5",'function toPrimitive(t,r){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}',{globals:["Symbol","TypeError","String","Number"],locals:{toPrimitive:["body.0.id"]},exportBindingAssignments:[],exportName:"toPrimitive",dependencies:{},internal:!1}),toPropertyKey:rj("7.1.5",'function toPropertyKey(t){var i=toPrimitive(t,"string");return"symbol"==typeof i?i:i+""}',{globals:[],locals:{toPropertyKey:["body.0.id"]},exportBindingAssignments:[],exportName:"toPropertyKey",dependencies:{toPrimitive:["body.0.body.body.0.declarations.0.init.callee"]},internal:!1}),toSetter:rj("7.24.0",'function _toSetter(t,e,n){e||(e=[]);var r=e.length++;return Object.defineProperty({},"_",{set:function(o){e[r]=o,t.apply(n,e)}})}',{globals:["Object"],locals:{_toSetter:["body.0.id"]},exportBindingAssignments:[],exportName:"_toSetter",dependencies:{},internal:!1}),tsRewriteRelativeImportExtensions:rj("7.27.0",'function tsRewriteRelativeImportExtensions(t,e){return"string"==typeof t&&/^\\.\\.?\\//.test(t)?t.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+)?)\\.([cm]?)ts$/i,(function(t,s,r,n,o){return s?e?".jsx":".js":!r||n&&o?r+n+"."+o.toLowerCase()+"js":t})):t}',{globals:[],locals:{tsRewriteRelativeImportExtensions:["body.0.id"]},exportBindingAssignments:[],exportName:"tsRewriteRelativeImportExtensions",dependencies:{},internal:!1}),typeof:rj("7.0.0-beta.0",'function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}',{globals:["Symbol"],locals:{_typeof:["body.0.id","body.0.body.body.0.argument.expressions.1.callee","body.0.body.body.0.argument.expressions.0.left"]},exportBindingAssignments:["body.0.body.body.0.argument.expressions.0"],exportName:"_typeof",dependencies:{},internal:!1}),unsupportedIterableToArray:rj("7.9.0",'function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?arrayLikeToArray(r,a):void 0}}',{globals:["Array"],locals:{_unsupportedIterableToArray:["body.0.id"]},exportBindingAssignments:[],exportName:"_unsupportedIterableToArray",dependencies:{arrayLikeToArray:["body.0.body.body.0.consequent.body.0.consequent.argument.callee","body.0.body.body.0.consequent.body.2.argument.expressions.1.alternate.consequent.callee"]},internal:!1}),usingCtx:rj("7.23.9",'function _usingCtx(){var r="function"==typeof SuppressedError?SuppressedError:function(r,e){var n=Error();return n.name="SuppressedError",n.error=r,n.suppressed=e,n},e={},n=[];function using(r,e){if(null!=e){if(Object(e)!==e)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(r)var o=e[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(void 0===o&&(o=e[Symbol.dispose||Symbol.for("Symbol.dispose")],r))var t=o;if("function"!=typeof o)throw new TypeError("Object is not disposable.");t&&(o=function(){try{t.call(e)}catch(r){return Promise.reject(r)}}),n.push({v:e,d:o,a:r})}else r&&n.push({d:e,a:r});return e}return{e:e,u:using.bind(null,!1),a:using.bind(null,!0),d:function(){var o,t=this.e,s=0;function next(){for(;o=n.pop();)try{if(!o.a&&1===s)return s=0,n.push(o),Promise.resolve().then(next);if(o.d){var r=o.d.call(o.v);if(o.a)return s|=2,Promise.resolve(r).then(next,err)}else s|=1}catch(r){return err(r)}if(1===s)return t!==e?Promise.reject(t):Promise.resolve();if(t!==e)throw t}function err(n){return t=t!==e?new r(n,t):n,next()}return next()}}}',{globals:["SuppressedError","Error","Object","TypeError","Symbol","Promise"],locals:{_usingCtx:["body.0.id"]},exportBindingAssignments:[],exportName:"_usingCtx",dependencies:{},internal:!1}),wrapAsyncGenerator:rj("7.0.0-beta.0",'function _wrapAsyncGenerator(e){return function(){return new AsyncGenerator(e.apply(this,arguments))}}function AsyncGenerator(e){var r,t;function resume(r,t){try{var n=e[r](t),o=n.value,u=o instanceof OverloadYield;Promise.resolve(u?o.v:o).then((function(t){if(u){var i="return"===r?"return":"next";if(!o.k||t.done)return resume(i,t);t=e[i](t).value}settle(n.done?"return":"normal",t)}),(function(e){resume("throw",e)}))}catch(e){settle("throw",e)}}function settle(e,n){switch(e){case"return":r.resolve({value:n,done:!0});break;case"throw":r.reject(n);break;default:r.resolve({value:n,done:!1})}(r=r.next)?resume(r.key,r.arg):t=null}this._invoke=function(e,n){return new Promise((function(o,u){var i={key:e,arg:n,resolve:o,reject:u,next:null};t?t=t.next=i:(r=t=i,resume(e,n))}))},"function"!=typeof e.return&&(this.return=void 0)}AsyncGenerator.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},AsyncGenerator.prototype.next=function(e){return this._invoke("next",e)},AsyncGenerator.prototype.throw=function(e){return this._invoke("throw",e)},AsyncGenerator.prototype.return=function(e){return this._invoke("return",e)};',{globals:["Promise","Symbol"],locals:{_wrapAsyncGenerator:["body.0.id"],AsyncGenerator:["body.1.id","body.0.body.body.0.argument.body.body.0.argument.callee","body.2.expression.expressions.0.left.object.object","body.2.expression.expressions.1.left.object.object","body.2.expression.expressions.2.left.object.object","body.2.expression.expressions.3.left.object.object"]},exportBindingAssignments:[],exportName:"_wrapAsyncGenerator",dependencies:{OverloadYield:["body.1.body.body.1.body.body.0.block.body.0.declarations.2.init.right"]},internal:!1}),wrapNativeSuper:rj("7.0.0-beta.0",'function _wrapNativeSuper(t){var r="function"==typeof Map?new Map:void 0;return _wrapNativeSuper=function(t){if(null===t||!isNativeFunction(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,Wrapper)}function Wrapper(){return construct(t,arguments,getPrototypeOf(this).constructor)}return Wrapper.prototype=Object.create(t.prototype,{constructor:{value:Wrapper,enumerable:!1,writable:!0,configurable:!0}}),setPrototypeOf(Wrapper,t)},_wrapNativeSuper(t)}',{globals:["Map","TypeError","Object"],locals:{_wrapNativeSuper:["body.0.id","body.0.body.body.1.argument.expressions.1.callee","body.0.body.body.1.argument.expressions.0.left"]},exportBindingAssignments:["body.0.body.body.1.argument.expressions.0"],exportName:"_wrapNativeSuper",dependencies:{getPrototypeOf:["body.0.body.body.1.argument.expressions.0.right.body.body.3.body.body.0.argument.arguments.2.object.callee"],setPrototypeOf:["body.0.body.body.1.argument.expressions.0.right.body.body.4.argument.expressions.1.callee"],isNativeFunction:["body.0.body.body.1.argument.expressions.0.right.body.body.0.test.right.argument.callee"],construct:["body.0.body.body.1.argument.expressions.0.right.body.body.3.body.body.0.argument.callee"]},internal:!1}),wrapRegExp:rj("7.19.0",'function _wrapRegExp(){_wrapRegExp=function(e,r){return new BabelRegExp(e,void 0,r)};var e=RegExp.prototype,r=new WeakMap;function BabelRegExp(e,t,p){var o=RegExp(e,t);return r.set(o,p||r.get(e)),setPrototypeOf(o,BabelRegExp.prototype)}function buildGroups(e,t){var p=r.get(t);return Object.keys(p).reduce((function(r,t){var o=p[t];if("number"==typeof o)r[t]=e[o];else{for(var i=0;void 0===e[o[i]]&&i+1]+)(>|$)/g,(function(e,r,t){if(""===t)return e;var p=o[r];return Array.isArray(p)?"$"+p.join("$"):"number"==typeof p?"$"+p:""})))}if("function"==typeof p){var i=this;return e[Symbol.replace].call(this,t,(function(){var e=arguments;return"object"!=typeof e[e.length-1]&&(e=[].slice.call(e)).push(buildGroups(e,i)),p.apply(this,e)}))}return e[Symbol.replace].call(this,t,p)},_wrapRegExp.apply(this,arguments)}',{globals:["RegExp","WeakMap","Object","Symbol","Array"],locals:{_wrapRegExp:["body.0.id","body.0.body.body.4.argument.expressions.3.callee.object","body.0.body.body.0.expression.left"]},exportBindingAssignments:["body.0.body.body.0.expression"],exportName:"_wrapRegExp",dependencies:{setPrototypeOf:["body.0.body.body.2.body.body.1.argument.expressions.1.callee"],inherits:["body.0.body.body.4.argument.expressions.0.callee"]},internal:!1}),writeOnlyError:rj("7.12.13","function _writeOnlyError(r){throw new TypeError('\"'+r+'\" is write-only')}",{globals:["TypeError"],locals:{_writeOnlyError:["body.0.id"]},exportBindingAssignments:[],exportName:"_writeOnlyError",dependencies:{},internal:!1})};Object.assign(aj,{AwaitValue:rj("7.0.0-beta.0","function _AwaitValue(t){this.wrapped=t}",{globals:[],locals:{_AwaitValue:["body.0.id"]},exportBindingAssignments:[],exportName:"_AwaitValue",dependencies:{},internal:!1}),applyDecs:rj("7.17.8",'function old_createMetadataMethodsForProperty(e,t,a,r){return{getMetadata:function(o){old_assertNotFinished(r,"getMetadata"),old_assertMetadataKey(o);var i=e[o];if(void 0!==i)if(1===t){var n=i.public;if(void 0!==n)return n[a]}else if(2===t){var l=i.private;if(void 0!==l)return l.get(a)}else if(Object.hasOwnProperty.call(i,"constructor"))return i.constructor},setMetadata:function(o,i){old_assertNotFinished(r,"setMetadata"),old_assertMetadataKey(o);var n=e[o];if(void 0===n&&(n=e[o]={}),1===t){var l=n.public;void 0===l&&(l=n.public={}),l[a]=i}else if(2===t){var s=n.priv;void 0===s&&(s=n.private=new Map),s.set(a,i)}else n.constructor=i}}}function old_convertMetadataMapToFinal(e,t){var a=e[Symbol.metadata||Symbol.for("Symbol.metadata")],r=Object.getOwnPropertySymbols(t);if(0!==r.length){for(var o=0;o=0;m--){var b;void 0!==(p=old_memberDec(h[m],r,c,l,s,o,i,n,f))&&(old_assertValidReturnValue(o,p),0===o?b=p:1===o?(b=old_getInit(p),v=p.get||f.get,y=p.set||f.set,f={get:v,set:y}):f=p,void 0!==b&&(void 0===d?d=b:"function"==typeof d?d=[d,b]:d.push(b)))}if(0===o||1===o){if(void 0===d)d=function(e,t){return t};else if("function"!=typeof d){var g=d;d=function(e,t){for(var a=t,r=0;r3,m=v>=5;if(m?(u=t,f=r,0!=(v-=5)&&(p=n=n||[])):(u=t.prototype,f=a,0!==v&&(p=i=i||[])),0!==v&&!h){var b=m?s:l,g=b.get(y)||0;if(!0===g||3===g&&4!==v||4===g&&3!==v)throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+y);!g&&v>2?b.set(y,v):b.set(y,!0)}old_applyMemberDec(e,u,d,y,v,m,h,f,p)}}old_pushInitializers(e,i),old_pushInitializers(e,n)}function old_pushInitializers(e,t){t&&e.push((function(e){for(var a=0;a0){for(var o=[],i=t,n=t.name,l=r.length-1;l>=0;l--){var s={v:!1};try{var c=Object.assign({kind:"class",name:n,addInitializer:old_createAddInitializerMethod(o,s)},old_createMetadataMethodsForProperty(a,0,n,s)),d=r[l](i,c)}finally{s.v=!0}void 0!==d&&(old_assertValidReturnValue(10,d),i=d)}e.push(i,(function(){for(var e=0;e=0;v--){var g;void 0!==(f=memberDec(h[v],a,c,o,n,i,s,u))&&(assertValidReturnValue(n,f),0===n?g=f:1===n?(g=f.init,p=f.get||u.get,d=f.set||u.set,u={get:p,set:d}):u=f,void 0!==g&&(void 0===l?l=g:"function"==typeof l?l=[l,g]:l.push(g)))}if(0===n||1===n){if(void 0===l)l=function(e,t){return t};else if("function"!=typeof l){var y=l;l=function(e,t){for(var r=t,a=0;a3,h=f>=5;if(h?(l=t,0!=(f-=5)&&(u=n=n||[])):(l=t.prototype,0!==f&&(u=a=a||[])),0!==f&&!d){var v=h?s:i,g=v.get(p)||0;if(!0===g||3===g&&4!==f||4===g&&3!==f)throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+p);!g&&f>2?v.set(p,f):v.set(p,!0)}applyMemberDec(e,l,c,p,f,h,d,u)}}pushInitializers(e,a),pushInitializers(e,n)}(a,e,t),function(e,t,r){if(r.length>0){for(var a=[],n=t,i=t.name,s=r.length-1;s>=0;s--){var o={v:!1};try{var c=r[s](n,{kind:"class",name:i,addInitializer:createAddInitializerMethod(a,o)})}finally{o.v=!0}void 0!==c&&(assertValidReturnValue(10,c),n=c)}e.push(n,(function(){for(var e=0;e=0;g--){var y;void 0!==(p=memberDec(v[g],n,c,s,a,i,o,f))&&(assertValidReturnValue(a,p),0===a?y=p:1===a?(y=p.init,d=p.get||f.get,h=p.set||f.set,f={get:d,set:h}):f=p,void 0!==y&&(void 0===l?l=y:"function"==typeof l?l=[l,y]:l.push(y)))}if(0===a||1===a){if(void 0===l)l=function(e,t){return t};else if("function"!=typeof l){var m=l;l=function(e,t){for(var r=t,n=0;n3,h=f>=5;if(h?(l=e,0!=(f-=5)&&(u=n=n||[])):(l=e.prototype,0!==f&&(u=r=r||[])),0!==f&&!d){var v=h?o:i,g=v.get(p)||0;if(!0===g||3===g&&4!==f||4===g&&3!==f)throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+p);!g&&f>2?v.set(p,f):v.set(p,!0)}applyMemberDec(a,l,c,p,f,h,d,u)}}return pushInitializers(a,r),pushInitializers(a,n),a}function pushInitializers(e,t){t&&e.push((function(e){for(var r=0;r0){for(var r=[],n=e,a=e.name,i=t.length-1;i>=0;i--){var o={v:!1};try{var s=t[i](n,{kind:"class",name:a,addInitializer:createAddInitializerMethod(r,o)})}finally{o.v=!0}void 0!==s&&(assertValidReturnValue(10,s),n=s)}return[n,function(){for(var e=0;e=0;m--){var b;void 0!==(h=memberDec(g[m],n,u,o,a,i,s,p,c))&&(assertValidReturnValue(a,h),0===a?b=h:1===a?(b=h.init,v=h.get||p.get,y=h.set||p.set,p={get:v,set:y}):p=h,void 0!==b&&(void 0===l?l=b:"function"==typeof l?l=[l,b]:l.push(b)))}if(0===a||1===a){if(void 0===l)l=function(e,t){return t};else if("function"!=typeof l){var I=l;l=function(e,t){for(var r=t,n=0;n3,y=d>=5,g=r;if(y?(f=e,0!=(d-=5)&&(p=a=a||[]),v&&!i&&(i=function(t){return checkInRHS(t)===e}),g=i):(f=e.prototype,0!==d&&(p=n=n||[])),0!==d&&!v){var m=y?c:o,b=m.get(h)||0;if(!0===b||3===b&&4!==d||4===b&&3!==d)throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+h);!b&&d>2?m.set(h,d):m.set(h,!0)}applyMemberDec(s,f,l,h,d,y,v,p,g)}}return pushInitializers(s,n),pushInitializers(s,a),s}function pushInitializers(e,t){t&&e.push((function(e){for(var r=0;r0){for(var r=[],n=e,a=e.name,i=t.length-1;i>=0;i--){var s={v:!1};try{var o=t[i](n,{kind:"class",name:a,addInitializer:createAddInitializerMethod(r,s)})}finally{s.v=!0}void 0!==o&&(assertValidReturnValue(10,o),n=o)}return[n,function(){for(var e=0;e=0;j-=r?2:1){var D=v[j],E=r?v[j-1]:void 0,I={},O={kind:["field","accessor","method","getter","setter","class"][o],name:n,metadata:a,addInitializer:function(e,t){if(e.v)throw Error("attempted to call addInitializer after decoration was finished");s(t,"An initializer","be",!0),c.push(t)}.bind(null,I)};try{if(b)(y=s(D.call(E,P,O),"class decorators","return"))&&(P=y);else{var k,F;O.static=l,O.private=f,f?2===o?k=function(e){return m(e),w.value}:(o<4&&(k=i(w,"get",m)),3!==o&&(F=i(w,"set",m))):(k=function(e){return e[n]},(o<2||4===o)&&(F=function(e,t){e[n]=t}));var N=O.access={has:f?h.bind():function(e){return n in e}};if(k&&(N.get=k),F&&(N.set=F),P=D.call(E,d?{get:w.get,set:w.set}:w[A],O),d){if("object"==typeof P&&P)(y=s(P.get,"accessor.get"))&&(w.get=y),(y=s(P.set,"accessor.set"))&&(w.set=y),(y=s(P.init,"accessor.init"))&&S.push(y);else if(void 0!==P)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0")}else s(P,(p?"field":"method")+" decorators","return")&&(p?S.push(P):w[A]=P)}}finally{I.v=!0}}return(p||d)&&u.push((function(e,t){for(var r=S.length-1;r>=0;r--)t=S[r].call(e,t);return t})),p||b||(f?d?u.push(i(w,"get"),i(w,"set")):u.push(2===o?w[A]:i.call.bind(w[A])):Object.defineProperty(e,n,w)),P}function u(e,t){return Object.defineProperty(e,Symbol.metadata||Symbol.for("Symbol.metadata"),{configurable:!0,enumerable:!0,value:t})}if(arguments.length>=6)var l=a[Symbol.metadata||Symbol.for("Symbol.metadata")];var f=Object.create(null==l?null:l),p=function(e,t,r,n){var o,a,i=[],s=function(t){return checkInRHS(t)===e},u=new Map;function l(e){e&&i.push(c.bind(null,e))}for(var f=0;f3,y=16&d,v=!!(8&d),g=0==(d&=7),b=h+"/"+v;if(!g&&!m){var w=u.get(b);if(!0===w||3===w&&4!==d||4===w&&3!==d)throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+h);u.set(b,!(d>2)||d)}applyDec(v?e:e.prototype,p,y,m?"#"+h:toPropertyKey(h),d,n,v?a=a||[]:o=o||[],i,v,m,g,1===d,v&&m?s:r)}}return l(o),l(a),i}(e,t,o,f);return r.length||u(e,f),{e:p,get c(){var t=[];return r.length&&[u(applyDec(e,[r],n,e.name,5,f,t),f),c.bind(null,t,e)]}}}',{globals:["TypeError","Array","Object","Error","Symbol","Map"],locals:{applyDecs2305:["body.0.id"]},exportBindingAssignments:[],exportName:"applyDecs2305",dependencies:{checkInRHS:["body.0.body.body.6.declarations.1.init.callee.body.body.0.declarations.3.init.body.body.0.argument.left.callee"],setFunctionName:["body.0.body.body.3.body.body.2.consequent.body.2.expression.consequent.expressions.0.consequent.right.properties.0.value.callee","body.0.body.body.3.body.body.2.consequent.body.2.expression.consequent.expressions.1.right.callee"],toPropertyKey:["body.0.body.body.6.declarations.1.init.callee.body.body.2.body.body.1.consequent.body.2.expression.arguments.3.alternate.callee"]},internal:!1}),classApplyDescriptorDestructureSet:rj("7.13.10",'function _classApplyDescriptorDestructureSet(e,t){if(t.set)return"__destrObj"in t||(t.__destrObj={set value(r){t.set.call(e,r)}}),t.__destrObj;if(!t.writable)throw new TypeError("attempted to set read only private field");return t}',{globals:["TypeError"],locals:{_classApplyDescriptorDestructureSet:["body.0.id"]},exportBindingAssignments:[],exportName:"_classApplyDescriptorDestructureSet",dependencies:{},internal:!1}),classApplyDescriptorGet:rj("7.13.10","function _classApplyDescriptorGet(e,t){return t.get?t.get.call(e):t.value}",{globals:[],locals:{_classApplyDescriptorGet:["body.0.id"]},exportBindingAssignments:[],exportName:"_classApplyDescriptorGet",dependencies:{},internal:!1}),classApplyDescriptorSet:rj("7.13.10",'function _classApplyDescriptorSet(e,t,l){if(t.set)t.set.call(e,l);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=l}}',{globals:["TypeError"],locals:{_classApplyDescriptorSet:["body.0.id"]},exportBindingAssignments:[],exportName:"_classApplyDescriptorSet",dependencies:{},internal:!1}),classCheckPrivateStaticAccess:rj("7.13.10","function _classCheckPrivateStaticAccess(s,a,r){return assertClassBrand(a,s,r)}",{globals:[],locals:{_classCheckPrivateStaticAccess:["body.0.id"]},exportBindingAssignments:[],exportName:"_classCheckPrivateStaticAccess",dependencies:{assertClassBrand:["body.0.body.body.0.argument.callee"]},internal:!1}),classCheckPrivateStaticFieldDescriptor:rj("7.13.10",'function _classCheckPrivateStaticFieldDescriptor(t,e){if(void 0===t)throw new TypeError("attempted to "+e+" private static field before its declaration")}',{globals:["TypeError"],locals:{_classCheckPrivateStaticFieldDescriptor:["body.0.id"]},exportBindingAssignments:[],exportName:"_classCheckPrivateStaticFieldDescriptor",dependencies:{},internal:!1}),classExtractFieldDescriptor:rj("7.13.10","function _classExtractFieldDescriptor(e,t){return classPrivateFieldGet2(t,e)}",{globals:[],locals:{_classExtractFieldDescriptor:["body.0.id"]},exportBindingAssignments:[],exportName:"_classExtractFieldDescriptor",dependencies:{classPrivateFieldGet2:["body.0.body.body.0.argument.callee"]},internal:!1}),classPrivateFieldDestructureSet:rj("7.4.4","function _classPrivateFieldDestructureSet(e,t){var r=classPrivateFieldGet2(t,e);return classApplyDescriptorDestructureSet(e,r)}",{globals:[],locals:{_classPrivateFieldDestructureSet:["body.0.id"]},exportBindingAssignments:[],exportName:"_classPrivateFieldDestructureSet",dependencies:{classApplyDescriptorDestructureSet:["body.0.body.body.1.argument.callee"],classPrivateFieldGet2:["body.0.body.body.0.declarations.0.init.callee"]},internal:!1}),classPrivateFieldGet:rj("7.0.0-beta.0","function _classPrivateFieldGet(e,t){var r=classPrivateFieldGet2(t,e);return classApplyDescriptorGet(e,r)}",{globals:[],locals:{_classPrivateFieldGet:["body.0.id"]},exportBindingAssignments:[],exportName:"_classPrivateFieldGet",dependencies:{classApplyDescriptorGet:["body.0.body.body.1.argument.callee"],classPrivateFieldGet2:["body.0.body.body.0.declarations.0.init.callee"]},internal:!1}),classPrivateFieldSet:rj("7.0.0-beta.0","function _classPrivateFieldSet(e,t,r){var s=classPrivateFieldGet2(t,e);return classApplyDescriptorSet(e,s,r),r}",{globals:[],locals:{_classPrivateFieldSet:["body.0.id"]},exportBindingAssignments:[],exportName:"_classPrivateFieldSet",dependencies:{classApplyDescriptorSet:["body.0.body.body.1.argument.expressions.0.callee"],classPrivateFieldGet2:["body.0.body.body.0.declarations.0.init.callee"]},internal:!1}),classPrivateMethodGet:rj("7.1.6","function _classPrivateMethodGet(s,a,r){return assertClassBrand(a,s),r}",{globals:[],locals:{_classPrivateMethodGet:["body.0.id"]},exportBindingAssignments:[],exportName:"_classPrivateMethodGet",dependencies:{assertClassBrand:["body.0.body.body.0.argument.expressions.0.callee"]},internal:!1}),classPrivateMethodSet:rj("7.1.6",'function _classPrivateMethodSet(){throw new TypeError("attempted to reassign private method")}',{globals:["TypeError"],locals:{_classPrivateMethodSet:["body.0.id"]},exportBindingAssignments:[],exportName:"_classPrivateMethodSet",dependencies:{},internal:!1}),classStaticPrivateFieldDestructureSet:rj("7.13.10",'function _classStaticPrivateFieldDestructureSet(t,r,s){return assertClassBrand(r,t),classCheckPrivateStaticFieldDescriptor(s,"set"),classApplyDescriptorDestructureSet(t,s)}',{globals:[],locals:{_classStaticPrivateFieldDestructureSet:["body.0.id"]},exportBindingAssignments:[],exportName:"_classStaticPrivateFieldDestructureSet",dependencies:{classApplyDescriptorDestructureSet:["body.0.body.body.0.argument.expressions.2.callee"],assertClassBrand:["body.0.body.body.0.argument.expressions.0.callee"],classCheckPrivateStaticFieldDescriptor:["body.0.body.body.0.argument.expressions.1.callee"]},internal:!1}),classStaticPrivateFieldSpecGet:rj("7.0.2",'function _classStaticPrivateFieldSpecGet(t,s,r){return assertClassBrand(s,t),classCheckPrivateStaticFieldDescriptor(r,"get"),classApplyDescriptorGet(t,r)}',{globals:[],locals:{_classStaticPrivateFieldSpecGet:["body.0.id"]},exportBindingAssignments:[],exportName:"_classStaticPrivateFieldSpecGet",dependencies:{classApplyDescriptorGet:["body.0.body.body.0.argument.expressions.2.callee"],assertClassBrand:["body.0.body.body.0.argument.expressions.0.callee"],classCheckPrivateStaticFieldDescriptor:["body.0.body.body.0.argument.expressions.1.callee"]},internal:!1}),classStaticPrivateFieldSpecSet:rj("7.0.2",'function _classStaticPrivateFieldSpecSet(s,t,r,e){return assertClassBrand(t,s),classCheckPrivateStaticFieldDescriptor(r,"set"),classApplyDescriptorSet(s,r,e),e}',{globals:[],locals:{_classStaticPrivateFieldSpecSet:["body.0.id"]},exportBindingAssignments:[],exportName:"_classStaticPrivateFieldSpecSet",dependencies:{classApplyDescriptorSet:["body.0.body.body.0.argument.expressions.2.callee"],assertClassBrand:["body.0.body.body.0.argument.expressions.0.callee"],classCheckPrivateStaticFieldDescriptor:["body.0.body.body.0.argument.expressions.1.callee"]},internal:!1}),classStaticPrivateMethodSet:rj("7.3.2",'function _classStaticPrivateMethodSet(){throw new TypeError("attempted to set read only static private field")}',{globals:["TypeError"],locals:{_classStaticPrivateMethodSet:["body.0.id"]},exportBindingAssignments:[],exportName:"_classStaticPrivateMethodSet",dependencies:{},internal:!1}),defineEnumerableProperties:rj("7.0.0-beta.0",'function _defineEnumerableProperties(e,r){for(var t in r){var n=r[t];n.configurable=n.enumerable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,t,n)}if(Object.getOwnPropertySymbols)for(var a=Object.getOwnPropertySymbols(r),b=0;b0;)try{var o=r.pop(),p=o.d.call(o.v);if(o.a)return Promise.resolve(p).then(next,err)}catch(r){return err(r)}if(s)throw e}function err(r){return e=s?new dispose_SuppressedError(e,r):r,s=!0,next()}return next()}',{globals:["SuppressedError","Error","Object","Promise"],locals:{dispose_SuppressedError:["body.0.id","body.0.body.body.0.argument.expressions.0.alternate.expressions.1.left.object","body.0.body.body.0.argument.expressions.0.alternate.expressions.1.right.arguments.1.properties.0.value.properties.0.value","body.0.body.body.0.argument.expressions.1.callee","body.1.body.body.1.body.body.0.argument.expressions.0.right.consequent.callee","body.0.body.body.0.argument.expressions.0.consequent.left","body.0.body.body.0.argument.expressions.0.alternate.expressions.0.left"],_dispose:["body.1.id"]},exportBindingAssignments:[],exportName:"_dispose",dependencies:{},internal:!1}),objectSpread:rj("7.0.0-beta.0",'function _objectSpread(e){for(var r=1;r0;)e=e[n],n=a.shift();if(!(arguments.length>2))return e[n];e[n]=r}catch(e){throw e.message+=" (when accessing "+t+")",e}}var ij=Object.create(null);function dj(e){if(!ij[e]){var t=aj[e];if(!t)throw Object.assign(new ReferenceError("Unknown helper "+e),{code:"BABEL_HELPER_UNKNOWN",helper:e});ij[e]={minVersion:t.minVersion,build:function(e,r,a,n){var s=t.ast();return function(e,t,r,a,n,s){var o=t.locals,d=t.dependencies,c=t.exportBindingAssignments,l=t.exportName,u=new Set(a||[]);r&&u.add(r);for(var p=0,f=(Object.entries||function(e){return Object.keys(e).map((function(t){return[t,e[t]]}))})(o);p=1.5*r;return Math.round(e/r)+" "+a+(n?"s":"")}return pj=function(i,d){d=d||{};var c=typeof i;if("string"===c&&i.length>0)return function(o){if((o=String(o)).length>100)return;var i=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(o);if(!i)return;var d=parseFloat(i[1]);switch((i[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return d*s;case"weeks":case"week":case"w":return d*n;case"days":case"day":case"d":return d*a;case"hours":case"hour":case"hrs":case"hr":case"h":return d*r;case"minutes":case"minute":case"mins":case"min":case"m":return d*t;case"seconds":case"second":case"secs":case"sec":case"s":return d*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return d;default:return}}(i);if("number"===c&&isFinite(i))return d.long?function(n){var s=Math.abs(n);if(s>=a)return o(n,s,a,"day");if(s>=r)return o(n,s,r,"hour");if(s>=t)return o(n,s,t,"minute");if(s>=e)return o(n,s,e,"second");return n+" ms"}(i):function(n){var s=Math.abs(n);if(s>=a)return Math.round(n/a)+"d";if(s>=r)return Math.round(n/r)+"h";if(s>=t)return Math.round(n/t)+"m";if(s>=e)return Math.round(n/e)+"s";return n+"ms"}(i);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(i))},pj}var bj=function(e){function t(e){var a,n,s,o=null;function i(){for(var e=arguments.length,r=new Array(e),n=0;n=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(r=!1,function(){r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||function(){},e.exports=bj(t),e.exports.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(mj,mj.exports);var vj=mj.exports,xj=_m,Rj=Om,jj=yr,wj=Zt,Ej=br,Sj=ae,Tj=sr,Pj=oe,Aj=Ue,kj=We,Cj=Pt,_j=At,Ij=ge,Dj=xe,Oj=Nm,Nj=Bm,Bj=rr,Mj=Um,Fj=Pe,Lj=Le,Uj=qm.isCompatTag;e.isExistentialTypeParam=function(){throw new Error("`path.isExistentialTypeParam` has been renamed to `path.isExistsTypeAnnotation()` in Babel 7.")},e.isNumericLiteralTypeAnnotation=function(){throw new Error("`path.isNumericLiteralTypeAnnotation()` has been renamed to `path.isNumberLiteralTypeAnnotation()` in Babel 7.")};var qj=Object.freeze({__proto__:null,isBindingIdentifier:function(){var e=this.node,t=this.parent,r=this.parentPath.parent;return Pj(e)&&xj(e,t,r)},isBlockScoped:function(){return Rj(this.node)},isExpression:function(){return this.isIdentifier()?this.isReferencedIdentifier():wj(this.node)},isFlow:function(){var e=this.node;return!!Ej(e)||(Aj(e)?"type"===e.importKind||"typeof"===e.importKind:jj(e)?"type"===e.exportKind:!!kj(e)&&("type"===e.importKind||"typeof"===e.importKind))},isForAwaitStatement:function(){return Lj(this.node,{await:!0})},isGenerated:function(){return!this.isUser()},isPure:function(e){return this.scope.isPure(this.node,e)},isReferenced:function(){return Oj(this.node,this.parent)},isReferencedIdentifier:function(e){var t=this.node,r=this.parent;if(!Pj(t,e)&&!_j(r,e)){if(!Cj(t,e))return!1;if(Uj(t.name))return!1}return Oj(t,r,this.parentPath.parent)},isReferencedMemberExpression:function(){var e=this.node,t=this.parent;return Ij(e)&&Oj(e,t)},isRestProperty:function(){var e;return Dj(this.node)&&(null==(e=this.parentPath)?void 0:e.isObjectPattern())},isScope:function(){return Nj(this.node,this.parent)},isSpreadProperty:function(){var e;return Dj(this.node)&&(null==(e=this.parentPath)?void 0:e.isObjectExpression())},isStatement:function(){var e=this.node,t=this.parent;if(Bj(e)){if(Fj(e)){if(Tj(t,{left:e}))return!1;if(Sj(t,{init:e}))return!1}return!0}return!1},isUser:function(){return this.node&&!!this.node.loc},isVar:function(){return Mj(this.node)}}),Gj=Pa,Wj=Gn,Vj=Ea,Hj=Qn,Kj=z;function zj(e){return e in yj}function Xj(e){return null==e?void 0:e._exploded}function Jj(e){if(Xj(e))return e;e._exploded=!0;for(var t=0,r=Object.keys(e);t=11?t+=r-1:r>=9?t+=r-9:r>=1&&(t+=r+1),r++}while(this.hasLabel(t)||this.hasBinding(t)||this.hasGlobal(t)||this.hasReference(t));var a=this.getProgramParent();return a.references[t]=!0,a.uids[t]=!0,t},t.generateUidBasedOnNode=function(e,t){var r=[];hE(e,r);var a=r.join("$");return a=a.replace(/^_/,"")||t||"ref",this.generateUid(a.slice(0,20))},t.generateUidIdentifierBasedOnNode=function(e,t){return Pw(this.generateUidBasedOnNode(e,t))},t.isStatic=function(e){if(Qw(e)||Jw(e)||uE(e))return!0;if(Fw(e)){var t=this.getBinding(e.name);return t?t.constant:this.hasBinding(e.name)}return!1},t.maybeGenerateMemoised=function(e,t){if(this.isStatic(e))return null;var r=this.generateUidIdentifierBasedOnNode(e);return t?r:(this.push({id:r}),Sw(r))},t.checkBlockScopedCollisions=function(e,t,r,a){if("param"!==t&&("local"!==e.kind&&("let"===t||"let"===e.kind||"const"===e.kind||"module"===e.kind||"param"===e.kind&&"const"===t)))throw this.path.hub.buildError(a,'Duplicate declaration "'+r+'"',TypeError)},t.rename=function(e,t){var r=this.getBinding(e);r&&(t||(t=this.generateUidIdentifier(e).name),new cw(r,e,t).rename(arguments[2]))},t.dump=function(){var e="-".repeat(60);console.log(e);var t=this;do{console.log("#",t.block.type);for(var r=0,a=Object.keys(t.bindings);r0)&&this.isPure(e.body,t));if(Iw(e)){for(var o,d=i(e.body);!(o=d()).done;){var c=o.value;if(!this.isPure(c,t))return!1}return!0}if(kw(e))return this.isPure(e.left,t)&&this.isPure(e.right,t);if(Aw(e)||cE(e)){for(var l,u=i(e.elements);!(l=u()).done;){var p=l.value;if(null!==p&&!this.isPure(p,t))return!1}return!0}if(Hw(e)||dE(e)){for(var f,g=i(e.properties);!(f=g()).done;){var y=f.value;if(!this.isPure(y,t))return!1}return!0}if(Gw(e))return!(e.computed&&!this.isPure(e.key,t))&&!((null==(n=e.decorators)?void 0:n.length)>0);if(Kw(e))return!(e.computed&&!this.isPure(e.key,t))&&(!((null==(s=e.decorators)?void 0:s.length)>0)&&!((lE(e)||e.static)&&null!==e.value&&!this.isPure(e.value,t)));if(Zw(e))return this.isPure(e.argument,t);if($w(e)){for(var m,h=i(e.expressions);!(m=h()).done;){var b=m.value;if(!this.isPure(b,t))return!1}return!0}return Yw(e)?rE(e.tag,"String.raw")&&!this.hasBinding("String",{noGlobals:!0})&&this.isPure(e.quasi,t):qw(e)?!e.computed&&Fw(e.object)&&"Symbol"===e.object.name&&Fw(e.property)&&"for"!==e.property.name&&!this.hasBinding("Symbol",{noGlobals:!0}):Cw(e)?rE(e.callee,"Symbol.for")&&!this.hasBinding("Symbol",{noGlobals:!0})&&1===e.arguments.length&&ce(e.arguments[0]):zw(e)},t.setData=function(e,t){return this.data[e]=t},t.getData=function(e){var t=this;do{var r=t.data[e];if(null!=r)return r}while(t=t.parent)},t.removeData=function(e){var t=this;do{null!=t.data[e]&&(t.data[e]=null)}while(t=t.parent)},t.init=function(){this.inited||(this.inited=!0,this.crawl())},t.crawl=function(){var e=this.path;bE(this),this.data=Object.create(null);var t=this;do{if(t.crawling)return;if(t.path.isProgram())break}while(t=t.parent);var r=t,a={references:[],constantViolations:[],assignments:[]};if(this.crawling=!0,vE||(vE=JD.visitors.merge([{Scope:function(e){bE(e.scope)}},RE])),"Program"!==e.type){for(var n,s=i(vE.enter);!(n=s()).done;){n.value.call(a,e,a)}var o=vE[e.type];if(o)for(var d,c=i(o.enter);!(d=c()).done;){d.value.call(a,e,a)}}e.traverse(vE,a),this.crawling=!1;for(var l,u=i(a.assignments);!(l=u()).done;){for(var p=l.value,f=p.getAssignmentIdentifiers(),g=0,y=Object.keys(f);g1&&(r+=t),"_"+r},wE.prototype.toArray=function(e,t,r){if(Fw(e)){var a=this.getBinding(e.name);if(null!=a&&a.constant&&a.path.isGenericType("Array"))return e}if(Aw(e))return e;if(Fw(e,{name:"arguments"}))return Ew(aE(aE(aE(Pw("Array"),Pw("prototype")),Pw("slice")),Pw("call")),[e]);var n,s=[e];return!0===t?n="toConsumableArray":"number"==typeof t?(s.push(nE(t)),n="slicedToArray"):n="toArray",r&&(s.unshift(this.path.hub.addHelper(n)),n="maybeArrayLike"),Ew(this.path.hub.addHelper(n),s)},wE.prototype.getAllBindingsOfKind=function(){for(var e=Object.create(null),t=arguments.length,r=new Array(t),a=0;a>18&63]+AE[n>>12&63]+AE[n>>6&63]+AE[63&n]);return s.join("")}function OE(e){var t;_E||IE();for(var r=e.length,a=r%3,n="",s=[],o=16383,i=0,d=r-a;id?d:i+o));return 1===a?(t=e[r-1],n+=AE[t>>2],n+=AE[t<<4&63],n+="=="):2===a&&(t=(e[r-2]<<8)+e[r-1],n+=AE[t>>10],n+=AE[t>>4&63],n+=AE[t<<2&63],n+="="),s.push(n),s.join("")}function NE(e,t,r,a,n){var s,o,i=8*n-a-1,d=(1<>1,l=-7,u=r?n-1:0,p=r?-1:1,f=e[t+u];for(u+=p,s=f&(1<<-l)-1,f>>=-l,l+=i;l>0;s=256*s+e[t+u],u+=p,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=a;l>0;o=256*o+e[t+u],u+=p,l-=8);if(0===s)s=1-c;else{if(s===d)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,a),s-=c}return(f?-1:1)*o*Math.pow(2,s-a)}function BE(e,t,r,a,n,s){var o,i,d,c=8*s-n-1,l=(1<>1,p=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,f=a?0:s-1,g=a?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(i=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(d=Math.pow(2,-o))<1&&(o--,d*=2),(t+=o+u>=1?p/d:p*Math.pow(2,1-u))*d>=2&&(o++,d/=2),o+u>=l?(i=0,o=l):o+u>=1?(i=(t*d-1)*Math.pow(2,n),o+=u):(i=t*Math.pow(2,u-1)*Math.pow(2,n),o=0));n>=8;e[r+f]=255&i,f+=g,i/=256,n-=8);for(o=o<0;e[r+f]=255&o,f+=g,o/=256,c-=8);e[r+f-g]|=128*y}var ME={}.toString,FE=Array.isArray||function(e){return"[object Array]"==ME.call(e)};function LE(){return qE.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function UE(e,t){if(LE()=LE())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+LE().toString(16)+" bytes");return 0|e}function zE(e){return!(null==e||!e._isBuffer)}function XE(e,t){if(zE(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var a=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return RS(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return jS(e).length;default:if(a)return RS(e).length;t=(""+t).toLowerCase(),a=!0}}function JE(e,t,r){var a=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return lS(this,t,r);case"utf8":case"utf-8":return oS(this,t,r);case"ascii":return dS(this,t,r);case"latin1":case"binary":return cS(this,t,r);case"base64":return sS(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return uS(this,t,r);default:if(a)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0}}function YE(e,t,r){var a=e[t];e[t]=e[r],e[r]=a}function $E(e,t,r,a,n){if(0===e.length)return-1;if("string"==typeof r?(a=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=qE.from(t,a)),zE(t))return 0===t.length?-1:QE(e,t,r,a,n);if("number"==typeof t)return t&=255,qE.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):QE(e,[t],r,a,n);throw new TypeError("val must be string, number or Buffer")}function QE(e,t,r,a,n){var s,o=1,i=e.length,d=t.length;if(void 0!==a&&("ucs2"===(a=String(a).toLowerCase())||"ucs-2"===a||"utf16le"===a||"utf-16le"===a)){if(e.length<2||t.length<2)return-1;o=2,i/=2,d/=2,r/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(n){var l=-1;for(s=r;si&&(r=i-d),s=r;s>=0;s--){for(var u=!0,p=0;pn&&(a=n):a=n;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");a>s/2&&(a=s/2);for(var o=0;o>8,n=r%256,s.push(n),s.push(a);return s}(t,e.length-r),e,r,a)}function sS(e,t,r){return 0===t&&r===e.length?OE(e):OE(e.slice(t,r))}function oS(e,t,r){r=Math.min(e.length,r);for(var a=[],n=t;n239?4:c>223?3:c>191?2:1;if(n+u<=r)switch(u){case 1:c<128&&(l=c);break;case 2:128==(192&(s=e[n+1]))&&(d=(31&c)<<6|63&s)>127&&(l=d);break;case 3:s=e[n+1],o=e[n+2],128==(192&s)&&128==(192&o)&&(d=(15&c)<<12|(63&s)<<6|63&o)>2047&&(d<55296||d>57343)&&(l=d);break;case 4:s=e[n+1],o=e[n+2],i=e[n+3],128==(192&s)&&128==(192&o)&&128==(192&i)&&(d=(15&c)<<18|(63&s)<<12|(63&o)<<6|63&i)>65535&&d<1114112&&(l=d)}null===l?(l=65533,u=1):l>65535&&(l-=65536,a.push(l>>>10&1023|55296),l=56320|1023&l),a.push(l),n+=u}return function(e){var t=e.length;if(t<=iS)return String.fromCharCode.apply(String,e);var r="",a=0;for(;a0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),""},qE.prototype.compare=function(e,t,r,a,n){if(!zE(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===a&&(a=0),void 0===n&&(n=this.length),t<0||r>e.length||a<0||n>this.length)throw new RangeError("out of range index");if(a>=n&&t>=r)return 0;if(a>=n)return-1;if(t>=r)return 1;if(this===e)return 0;for(var s=(n>>>=0)-(a>>>=0),o=(r>>>=0)-(t>>>=0),i=Math.min(s,o),d=this.slice(a,n),c=e.slice(t,r),l=0;ln)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");a||(a="utf8");for(var s=!1;;)switch(a){case"hex":return ZE(this,e,t,r);case"utf8":case"utf-8":return eS(this,e,t,r);case"ascii":return tS(this,e,t,r);case"latin1":case"binary":return rS(this,e,t,r);case"base64":return aS(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return nS(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),s=!0}},qE.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var iS=4096;function dS(e,t,r){var a="";r=Math.min(e.length,r);for(var n=t;na)&&(r=a);for(var n="",s=t;sr)throw new RangeError("Trying to access beyond buffer length")}function fS(e,t,r,a,n,s){if(!zE(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||te.length)throw new RangeError("Index out of range")}function gS(e,t,r,a){t<0&&(t=65535+t+1);for(var n=0,s=Math.min(e.length-r,2);n>>8*(a?n:1-n)}function yS(e,t,r,a){t<0&&(t=4294967295+t+1);for(var n=0,s=Math.min(e.length-r,4);n>>8*(a?n:3-n)&255}function mS(e,t,r,a,n,s){if(r+a>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function hS(e,t,r,a,n){return n||mS(e,0,r,4),BE(e,t,r,a,23,4),r+4}function bS(e,t,r,a,n){return n||mS(e,0,r,8),BE(e,t,r,a,52,8),r+8}qE.prototype.slice=function(e,t){var r,a=this.length;if((e=~~e)<0?(e+=a)<0&&(e=0):e>a&&(e=a),(t=void 0===t?a:~~t)<0?(t+=a)<0&&(t=0):t>a&&(t=a),t0&&(n*=256);)a+=this[e+--t]*n;return a},qE.prototype.readUInt8=function(e,t){return t||pS(e,1,this.length),this[e]},qE.prototype.readUInt16LE=function(e,t){return t||pS(e,2,this.length),this[e]|this[e+1]<<8},qE.prototype.readUInt16BE=function(e,t){return t||pS(e,2,this.length),this[e]<<8|this[e+1]},qE.prototype.readUInt32LE=function(e,t){return t||pS(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},qE.prototype.readUInt32BE=function(e,t){return t||pS(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},qE.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||pS(e,t,this.length);for(var a=this[e],n=1,s=0;++s=(n*=128)&&(a-=Math.pow(2,8*t)),a},qE.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||pS(e,t,this.length);for(var a=t,n=1,s=this[e+--a];a>0&&(n*=256);)s+=this[e+--a]*n;return s>=(n*=128)&&(s-=Math.pow(2,8*t)),s},qE.prototype.readInt8=function(e,t){return t||pS(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},qE.prototype.readInt16LE=function(e,t){t||pS(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},qE.prototype.readInt16BE=function(e,t){t||pS(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},qE.prototype.readInt32LE=function(e,t){return t||pS(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},qE.prototype.readInt32BE=function(e,t){return t||pS(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},qE.prototype.readFloatLE=function(e,t){return t||pS(e,4,this.length),NE(this,e,!0,23,4)},qE.prototype.readFloatBE=function(e,t){return t||pS(e,4,this.length),NE(this,e,!1,23,4)},qE.prototype.readDoubleLE=function(e,t){return t||pS(e,8,this.length),NE(this,e,!0,52,8)},qE.prototype.readDoubleBE=function(e,t){return t||pS(e,8,this.length),NE(this,e,!1,52,8)},qE.prototype.writeUIntLE=function(e,t,r,a){(e=+e,t|=0,r|=0,a)||fS(this,e,t,r,Math.pow(2,8*r)-1,0);var n=1,s=0;for(this[t]=255&e;++s=0&&(s*=256);)this[t+n]=e/s&255;return t+r},qE.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||fS(this,e,t,1,255,0),qE.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},qE.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||fS(this,e,t,2,65535,0),qE.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):gS(this,e,t,!0),t+2},qE.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||fS(this,e,t,2,65535,0),qE.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):gS(this,e,t,!1),t+2},qE.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||fS(this,e,t,4,4294967295,0),qE.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):yS(this,e,t,!0),t+4},qE.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||fS(this,e,t,4,4294967295,0),qE.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):yS(this,e,t,!1),t+4},qE.prototype.writeIntLE=function(e,t,r,a){if(e=+e,t|=0,!a){var n=Math.pow(2,8*r-1);fS(this,e,t,r,n-1,-n)}var s=0,o=1,i=0;for(this[t]=255&e;++s>0)-i&255;return t+r},qE.prototype.writeIntBE=function(e,t,r,a){if(e=+e,t|=0,!a){var n=Math.pow(2,8*r-1);fS(this,e,t,r,n-1,-n)}var s=r-1,o=1,i=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===i&&0!==this[t+s+1]&&(i=1),this[t+s]=(e/o>>0)-i&255;return t+r},qE.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||fS(this,e,t,1,127,-128),qE.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},qE.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||fS(this,e,t,2,32767,-32768),qE.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):gS(this,e,t,!0),t+2},qE.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||fS(this,e,t,2,32767,-32768),qE.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):gS(this,e,t,!1),t+2},qE.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||fS(this,e,t,4,2147483647,-2147483648),qE.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):yS(this,e,t,!0),t+4},qE.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||fS(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),qE.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):yS(this,e,t,!1),t+4},qE.prototype.writeFloatLE=function(e,t,r){return hS(this,e,t,!0,r)},qE.prototype.writeFloatBE=function(e,t,r){return hS(this,e,t,!1,r)},qE.prototype.writeDoubleLE=function(e,t,r){return bS(this,e,t,!0,r)},qE.prototype.writeDoubleBE=function(e,t,r){return bS(this,e,t,!1,r)},qE.prototype.copy=function(e,t,r,a){if(r||(r=0),a||0===a||(a=this.length),t>=e.length&&(t=e.length),t||(t=0),a>0&&a=this.length)throw new RangeError("sourceStart out of bounds");if(a<0)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),e.length-t=0;--n)e[n+t]=this[n+r];else if(s<1e3||!qE.TYPED_ARRAY_SUPPORT)for(n=0;n>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(s=t;s55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===a){(t-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function jS(e){return function(e){var t,r,a,n,s,o;_E||IE();var i=e.length;if(i%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s="="===e[i-2]?2:"="===e[i-1]?1:0,o=new CE(3*i/4-s),a=s>0?i-4:i;var d=0;for(t=0,r=0;t>16&255,o[d++]=n>>8&255,o[d++]=255&n;return 2===s?(n=kE[e.charCodeAt(t)]<<2|kE[e.charCodeAt(t+1)]>>4,o[d++]=255&n):1===s&&(n=kE[e.charCodeAt(t)]<<10|kE[e.charCodeAt(t+1)]<<4|kE[e.charCodeAt(t+2)]>>2,o[d++]=n>>8&255,o[d++]=255&n),o}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(vS,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function wS(e,t,r,a){for(var n=0;n=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function ES(e){return null!=e&&(!!e._isBuffer||SS(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&SS(e.slice(0,0))}(e))}function SS(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var TS,PS={exports:{}};function AS(){return TS||(TS=1,function(e,t){!function(e){for(var t=",".charCodeAt(0),r=";".charCodeAt(0),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=new Uint8Array(64),s=new Uint8Array(128),o=0;o>>=1,c&&(n=-2147483648|-n),r[a]+=n,t}function p(e,r,a){return!(r>=a)&&e.charCodeAt(r)!==t}function f(e){e.sort(g)}function g(e,t){return e[0]-t[0]}function y(e){for(var a=new Int32Array(5),n=16384,s=n-36,o=new Uint8Array(n),i=o.subarray(0,s),c=0,l="",u=0;u0&&(c===n&&(l+=d.decode(o),c=0),o[c++]=r),0!==p.length){a[0]=0;for(var f=0;fs&&(l+=d.decode(i),o.copyWithin(0,s,c),c-=s),f>0&&(o[c++]=t),c=m(o,c,a,g,0),1!==g.length&&(c=m(o,c,a,g,1),c=m(o,c,a,g,2),c=m(o,c,a,g,3),4!==g.length&&(c=m(o,c,a,g,4)))}}}return l+d.decode(o.subarray(0,c))}function m(e,t,r,a,s){var o=a[s],i=o-r[s];r[s]=o,i=i<0?-i<<1|1:i<<1;do{var d=31&i;(i>>>=5)>0&&(d|=32),e[t++]=n[d]}while(i>0);return t}e.decode=c,e.encode=y,Object.defineProperty(e,"__esModule",{value:!0})}(t)}(0,PS.exports)),PS.exports}var kS,CS={exports:{}},_S={exports:{}};function IS(){return kS||(kS=1,function(e,t){e.exports=function(){var e=/^[\w+.-]+:\/\//,t=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,r=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function a(t){return e.test(t)}function n(e){return e.startsWith("//")}function s(e){return e.startsWith("/")}function o(e){return e.startsWith("file:")}function i(e){return/^[.?#]/.test(e)}function d(e){var r=t.exec(e);return l(r[1],r[2]||"",r[3],r[4]||"",r[5]||"/",r[6]||"",r[7]||"")}function c(e){var t=r.exec(e),a=t[2];return l("file:","",t[1]||"","",s(a)?a:"/"+a,t[3]||"",t[4]||"")}function l(e,t,r,a,n,s,o){return{scheme:e,user:t,host:r,port:a,path:n,query:s,hash:o,type:7}}function u(e){if(n(e)){var t=d("http:"+e);return t.scheme="",t.type=6,t}if(s(e)){var r=d("http://foo.com"+e);return r.scheme="",r.host="",r.type=5,r}if(o(e))return c(e);if(a(e))return d(e);var i=d("http://foo.com/"+e);return i.scheme="",i.host="",i.type=e?e.startsWith("?")?3:e.startsWith("#")?2:4:1,i}function p(e){if(e.endsWith("/.."))return e;var t=e.lastIndexOf("/");return e.slice(0,t+1)}function f(e,t){g(t,t.type),"/"===e.path?e.path=t.path:e.path=p(t.path)+e.path}function g(e,t){for(var r=t<=4,a=e.path.split("/"),n=1,s=0,o=!1,i=1;ia&&(a=s)}g(r,a);var o=r.query+r.hash;switch(a){case 2:case 3:return o;case 4:var d=r.path.slice(1);return d?i(t||e)&&!i(d)?"./"+d+o:d+o:o||".";case 5:return r.path+o;default:return r.scheme+"//"+r.user+r.host+r.port+r.path+o}}return y}()}(_S)),_S.exports}!function(e,t){!function(e,t,r){function a(e,t){return t&&!t.endsWith("/")&&(t+="/"),r(e,t)}function n(e){if(!e)return"";var t=e.lastIndexOf("/");return e.slice(0,t+1)}var s=0,i=1,d=2,c=3,l=4,u=1,p=2;function f(e,t){var r=g(e,0);if(r===e.length)return e;t||(e=e.slice());for(var a=r;a>1),o=e[n][s]-t;if(0===o)return b=!0,n;o<0?r=n+1:a=n-1}return b=!1,r-1}function x(e,t,r){for(var a=r+1;a=0&&e[a][s]===t;r=a--);return r}function j(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}function w(e,t,r,a){var n=r.lastKey,o=r.lastNeedle,i=r.lastIndex,d=0,c=e.length-1;if(a===n){if(t===o)return b=-1!==i&&e[i][s]===t,i;t>=o?d=-1===i?0:i:c=i}return r.lastKey=a,r.lastNeedle=t,r.lastIndex=v(e,t,d,c)}function E(e,t){for(var r=t.map(T),a=0;at;a--)e[a]=e[a-1];e[t]=r}function T(){return{__proto__:null}}var P=function(e,t){var r=A(e);if(!("sections"in r))return new M(r,t);var a=[],n=[],s=[],o=[],i=[];return k(r,t,a,n,s,o,i,0,0,1/0,1/0),J({version:3,file:r.file,names:o,sources:n,sourcesContent:s,mappings:a,ignoreList:i})};function A(e){return"string"==typeof e?JSON.parse(e):e}function k(e,t,r,a,n,s,o,i,d,c,l){for(var u=e.sections,p=0;pg)return;for(var C=I(r,P),D=0===T?f:0,O=x[T],N=0;N=y)return;if(1!==B.length){var L=b+B[i],q=B[d],G=B[c];C.push(4===B.length?[F,L,q,G]:[F,L,q,G,v+B[l]])}else C.push([F])}}}function _(e,t){for(var r=0;r=a.length)return null;var n=a[t],s=te(n,F(e)._decodedMemo,t,r,B);return-1===s?null:n[s]}function G(e,t){var r=t.line,a=t.column,n=t.bias;if(--r<0)throw new Error(D);if(a<0)throw new Error(O);var s=U(e);if(r>=s.length)return Z(null,null,null,null);var o=s[r],u=te(o,F(e)._decodedMemo,r,a,n||B);if(-1===u)return Z(null,null,null,null);var p=o[u];if(1===p.length)return Z(null,null,null,null);var f=e.names;return Z(e.resolvedSources[p[i]],p[d]+1,p[c],5===p.length?f[p[l]]:null)}function W(e,t){return ae(e,t.source,t.line,t.column,t.bias||B,!1)}function V(e,t){return ae(e,t.source,t.line,t.column,t.bias||N,!0)}function H(e,t){for(var r=U(e),a=e.names,n=e.resolvedSources,s=0;s=0&&!(t>=e[a][n]);r=a--);return r}function T(e,t,r){for(var a=e.length;a>t;a--)e[a]=e[a-1];e[t]=r}function P(e){for(var t=e.length,r=t,a=r-1;a>=0&&!(e[a].length>0);r=a,a--);r1?this._indentChar.repeat(t):this._indentChar}else this._str+=t>1?String.fromCharCode(e).repeat(t):String.fromCharCode(e);10!==e?(this._mark(r.line,r.column,r.identifierName,r.identifierNamePos,r.filename),this._position.column+=t):(this._position.line++,this._position.column=0),this._canMarkIdName&&(r.identifierName=void 0,r.identifierNamePos=void 0)},t._append=function(e,t,r){var a=e.length,n=this._position;if(this._last=e.charCodeAt(a-1),++this._appendCount>4096?(this._str,this._buf+=this._str,this._str=e,this._appendCount=0):this._str+=e,r||this._map){var s=t.column,o=t.identifierName,i=t.identifierNamePos,d=t.filename,c=t.line;null==o&&null==i||!this._canMarkIdName||(t.identifierName=void 0,t.identifierNamePos=void 0);var l=e.indexOf("\n"),u=0;for(0!==l&&this._mark(c,s,o,i,d);-1!==l;)n.line++,n.column=0,(u=l+1)=0&&10===this._queue[r].char;r--)t++;return t===e&&10===this._last?t+1:t},t.endsWithCharAndNewline=function(){var e=this._queue,t=this._queueCursor;if(0!==t){if(10!==e[t-1].char)return;return t>1?e[t-2].char:this._last}},t.hasContent=function(){return 0!==this._queueCursor||!!this._last},t.exactSource=function(e,t){if(this._map){this.source("start",e);var r=e.identifierName,a=this._sourcePosition;r&&(this._canMarkIdName=!1,a.identifierName=r),t(),r&&(this._canMarkIdName=!0,a.identifierName=void 0,a.identifierNamePos=void 0),this.source("end",e)}else t()},t.source=function(e,t){this._map&&this._normalizePosition(e,t,0)},t.sourceWithOffset=function(e,t,r){this._map&&this._normalizePosition(e,t,r)},t._normalizePosition=function(e,t,r){var a=t[e],n=this._sourcePosition;a&&(n.line=a.line,n.column=Math.max(a.column+r,0),n.filename=t.filename)},t.getCurrentColumn=function(){for(var e=this._queue,t=this._queueCursor,r=-1,a=0,n=0;n",0],["&&",1],["|",2],["^",3],["&",4],["==",5],["===",5],["!=",5],["!==",5],["<",6],[">",6],["<=",6],[">=",6],["in",6],["instanceof",6],[">>",7],["<<",7],[">>>",7],["+",8],["-",8],["*",9],["/",9],["%",9],["**",10]]);function fT(e,t){return"BinaryExpression"===t||"LogicalExpression"===t?pT.get(e.operator):"TSAsExpression"===t||"TSSatisfiesExpression"===t?pT.get("in"):void 0}function gT(e){return"TSAsExpression"===e||"TSSatisfiesExpression"===e||"TSTypeAssertion"===e}var yT=function(e,t){var r=t.type;return("ClassDeclaration"===r||"ClassExpression"===r)&&t.superClass===e},mT=function(e,t){var r=t.type;return("MemberExpression"===r||"OptionalMemberExpression"===r)&&t.object===e||("CallExpression"===r||"OptionalCallExpression"===r||"NewExpression"===r)&&t.callee===e||"TaggedTemplateExpression"===r&&t.tag===e||"TSNonNullExpression"===r};function hT(e){return Boolean(e&(OT.expressionStatement|OT.arrowBody))}function bT(e,t){var r=t.type;if("BinaryExpression"===e.type&&"**"===e.operator&&"BinaryExpression"===r&&"**"===t.operator)return t.left===e;if(yT(e,t))return!0;if(mT(e,t)||"UnaryExpression"===r||"SpreadElement"===r||"AwaitExpression"===r)return!0;var a=fT(t,r);if(null!=a){var n=fT(e,e.type);if(a===n&&"BinaryExpression"===r&&t.right===e||a>n)return!0}}function vT(e,t){var r=t.type;return"ArrayTypeAnnotation"===r||"NullableTypeAnnotation"===r||"IntersectionTypeAnnotation"===r||"UnionTypeAnnotation"===r}function xT(e,t){return("AssignmentExpression"===t.type||"AssignmentPattern"===t.type)&&t.left===e||("BinaryExpression"===t.type&&("|"===t.operator||"&"===t.operator)&&e===t.left||bT(e,t))}function RT(e,t){var r=t.type;return"TSIntersectionType"===r||"TSUnionType"===r||"TSTypeOperator"===r||"TSOptionalType"===r||"TSArrayType"===r||"TSIndexedAccessType"===r&&t.objectType===e||"TSConditionalType"===r&&(t.checkType===e||t.extendsType===e)}function jT(e,t){var r=t.type;return"BinaryExpression"===r||"LogicalExpression"===r||"UnaryExpression"===r||"SpreadElement"===r||mT(e,t)||"AwaitExpression"===r&&lT(e)||"ConditionalExpression"===r&&e===t.test||yT(e,t)||gT(r)}function wT(e,t){return mT(e,t)||aT(t)&&"**"===t.operator&&t.left===e||yT(e,t)}function ET(e,t){var r=t.type;return!!("UnaryExpression"===r||"SpreadElement"===r||"BinaryExpression"===r||"LogicalExpression"===r||"ConditionalExpression"===r&&t.test===e||"AwaitExpression"===r||gT(r))||wT(e,t)}function ST(e,t){return nT(t)&&t.callee===e||iT(t)&&t.object===e}var TT=Object.freeze({__proto__:null,ArrowFunctionExpression:ET,AssignmentExpression:function(e,t,r){return!(!hT(r)||!dT(e.left))||ET(e,t)},AwaitExpression:jT,Binary:bT,BinaryExpression:function(e,t,r){return"in"===e.operator&&Boolean(r&OT.forInOrInitHeadAccumulate)},ClassExpression:function(e,t,r){return Boolean(r&(OT.expressionStatement|OT.exportDefault))},ConditionalExpression:ET,DoExpression:function(e,t,r){return!e.async&&Boolean(r&OT.expressionStatement)},FunctionExpression:function(e,t,r){return Boolean(r&(OT.expressionStatement|OT.exportDefault))},FunctionTypeAnnotation:function(e,t,r){var a=t.type;return"UnionTypeAnnotation"===a||"IntersectionTypeAnnotation"===a||"ArrayTypeAnnotation"===a||Boolean(r&OT.arrowFlowReturnType)},Identifier:function(e,t,r,a){var n,s=t.type;if(null!=(n=e.extra)&&n.parenthesized&&"AssignmentExpression"===s&&t.left===e){var o=t.right.type;if(("FunctionExpression"===o||"ClassExpression"===o)&&null==t.right.id)return!0}return(!a||a(e)===e.name)&&("let"===e.name?!!((iT(t,{object:e,computed:!0})||cT(t,{object:e,computed:!0,optional:!1}))&&r&(OT.expressionStatement|OT.forInitHead|OT.forInHead))||Boolean(r&OT.forOfHead):"async"===e.name&&sT(t,{left:e,await:!1}))},IntersectionTypeAnnotation:vT,LogicalExpression:function(e,t){var r=t.type;if(gT(r))return!0;if("LogicalExpression"!==r)return!1;switch(e.operator){case"||":return"??"===t.operator||"&&"===t.operator;case"&&":return"??"===t.operator;case"??":return"??"!==t.operator}},NullableTypeAnnotation:function(e,t){return rT(t)},ObjectExpression:function(e,t,r){return hT(r)},OptionalCallExpression:ST,OptionalIndexedAccessType:function(e,t){return oT(t)&&t.objectType===e},OptionalMemberExpression:ST,SequenceExpression:function(e,t){var r=t.type;return!("SequenceExpression"===r||"ParenthesizedExpression"===r||"MemberExpression"===r&&t.property===e||"OptionalMemberExpression"===r&&t.property===e||"TemplateLiteral"===r)&&("ClassDeclaration"===r||("ForOfStatement"===r?t.right===e:"ExportDefaultDeclaration"===r||!uT(t)))},TSAsExpression:xT,TSConditionalType:function(e,t){var r=t.type;return"TSArrayType"===r||"TSIndexedAccessType"===r&&t.objectType===e||"TSOptionalType"===r||"TSTypeOperator"===r||"TSTypeParameter"===r||(("TSIntersectionType"===r||"TSUnionType"===r)&&t.types[0]===e||"TSConditionalType"===r&&(t.checkType===e||t.extendsType===e))},TSConstructorType:RT,TSFunctionType:RT,TSInferType:function(e,t){var r=t.type;return"TSArrayType"===r||"TSIndexedAccessType"===r&&t.objectType===e||"TSOptionalType"===r||!(!e.typeParameter.constraint||"TSIntersectionType"!==r&&"TSUnionType"!==r||t.types[0]!==e)},TSInstantiationExpression:function(e,t){var r=t.type;return("CallExpression"===r||"OptionalCallExpression"===r||"NewExpression"===r||"TSInstantiationExpression"===r)&&!!t.typeParameters},TSIntersectionType:function(e,t){var r=t.type;return"TSTypeOperator"===r||"TSArrayType"===r||"TSIndexedAccessType"===r&&t.objectType===e||"TSOptionalType"===r},TSSatisfiesExpression:xT,TSTypeAssertion:wT,TSTypeOperator:function(e,t){var r=t.type;return"TSArrayType"===r||"TSIndexedAccessType"===r&&t.objectType===e||"TSOptionalType"===r},TSUnionType:function(e,t){var r=t.type;return"TSIntersectionType"===r||"TSTypeOperator"===r||"TSArrayType"===r||"TSIndexedAccessType"===r&&t.objectType===e||"TSOptionalType"===r},UnaryLike:wT,UnionTypeAnnotation:vT,UpdateExpression:function(e,t){return mT(e,t)||yT(e,t)},YieldExpression:jT}),PT=Ea,AT=ja,kT=Q,CT=Ot,_T=ge,IT=ye,DT=we,OT={normal:0,expressionStatement:1,arrowBody:2,exportDefault:4,arrowFlowReturnType:8,forInitHead:16,forInHead:32,forOfHead:64,forInOrInitHeadAccumulate:128,forInOrInitHeadAccumulatePassThroughMask:128};function NT(e){var t=new Map;function r(e,r){var a=t.get(e);t.set(e,a?function(e,t,n,s){var o;return null!=(o=a(e,t,n,s))?o:r(e,t,n,s)}:r)}for(var a=0,n=Object.keys(e);a0&&a._nodesToTokenIndexes.set(e,t)})),this._tokensCache=null}var t=e.prototype;return t.has=function(e){return this._nodesToTokenIndexes.has(e)},t.getIndexes=function(e){return this._nodesToTokenIndexes.get(e)},t.find=function(e,t){var r=this._nodesToTokenIndexes.get(e);if(r)for(var a=0;a=0;a--){var n=r[a];if(t(this._tokens[n],n))return n}return-1},t.findMatching=function(e,t,r){void 0===r&&(r=0);var a=this._nodesToTokenIndexes.get(e);if(a){var n=0,s=r;if(s>1){var o=this._nodesOccurrencesCountCache.get(e);o&&o.test===t&&o.count0&&this._nodesOccurrencesCountCache.set(e,{test:t,count:s,i:n}),i;r--}}}return null},t.matchesOriginal=function(e,t){return e.end-e.start===t.length&&(null!=e.value?e.value===t:this._source.startsWith(t,e.start))},t.startMatches=function(e,t){var r=this._nodesToTokenIndexes.get(e);if(!r)return!1;var a=this._tokens[r[0]];return a.start===e.start&&this.matchesOriginal(a,t)},t.endMatches=function(e,t){var r=this._nodesToTokenIndexes.get(e);if(!r)return!1;var a=this._tokens[r[r.length-1]];return a.end===e.end&&this.matchesOriginal(a,t)},t._getTokensIndexesOfNode=function(e){if(null==e.start||null==e.end)return[];var t=this._findTokensOfNode(e,0,this._tokens.length-1),r=t.first,a=t.last,n=r,s=WT(e);"ExportNamedDeclaration"!==e.type&&"ExportDefaultDeclaration"!==e.type||!e.declaration||"ClassDeclaration"!==e.declaration.type||s.next();for(var o,d=[],c=i(s);!(o=c()).done;){var l=o.value;if(null!=l&&(null!=l.start&&null!=l.end)){for(var u=this._findTokensOfNode(l,n,a),p=u.first,f=n;f>1;if(ethis._tokens[a].start))return a;t=a+1}}return t},t._findLastTokenOfNode=function(e,t,r){for(;t<=r;){var a=r+t>>1;if(ethis._tokens[a].end))return a;t=a+1}}return r},o(e)}();function WT(e){var t,r,a,n,s,o;return p().wrap((function(d){for(;;)switch(d.prev=d.next){case 0:if("TemplateLiteral"!==e.type){d.next=13;break}return d.next=3,e.quasis[0];case 3:t=1;case 4:if(!(t2?wP(p):"\\x"+("00"+p).slice(-2)})),"`"==d&&(i=i.replace(/\$\{/g,"\\${")),t.isScriptContext&&(i=i.replace(/<\/(script|style)/gi,"<\\/$1").replace(/ previous live fiber - // --sibling--> deleted fiber - // - // We can't disconnect `alternate` on nodes that haven't been deleted - // yet, but we can disconnect the `sibling` and `child` pointers. - var previousFiber = fiber.alternate; - - if (previousFiber !== null) { - var detachedChild = previousFiber.child; - - if (detachedChild !== null) { - previousFiber.child = null; - - do { - var detachedSibling = detachedChild.sibling; - detachedChild.sibling = null; - detachedChild = detachedSibling; - } while (detachedChild !== null); - } - } - } - - nextEffect = fiber; - } - } - - if ((fiber.subtreeFlags & PassiveMask) !== NoFlags && child !== null) { - child.return = fiber; - nextEffect = child; - } else { - commitPassiveUnmountEffects_complete(); - } - } - } - - function commitPassiveUnmountEffects_complete() { - while (nextEffect !== null) { - var fiber = nextEffect; - - if ((fiber.flags & Passive) !== NoFlags) { - setCurrentFiber(fiber); - commitPassiveUnmountOnFiber(fiber); - resetCurrentFiber(); - } - - var sibling = fiber.sibling; - - if (sibling !== null) { - sibling.return = fiber.return; - nextEffect = sibling; - return; - } - - nextEffect = fiber.return; - } - } - - function commitPassiveUnmountOnFiber(finishedWork) { - switch (finishedWork.tag) { - case FunctionComponent: - case ForwardRef: - case SimpleMemoComponent: - { - if ( finishedWork.mode & ProfileMode) { - startPassiveEffectTimer(); - commitHookEffectListUnmount(Passive$1 | HasEffect, finishedWork, finishedWork.return); - recordPassiveEffectDuration(finishedWork); - } else { - commitHookEffectListUnmount(Passive$1 | HasEffect, finishedWork, finishedWork.return); - } - - break; - } - } - } - - function commitPassiveUnmountEffectsInsideOfDeletedTree_begin(deletedSubtreeRoot, nearestMountedAncestor) { - while (nextEffect !== null) { - var fiber = nextEffect; // Deletion effects fire in parent -> child order - // TODO: Check if fiber has a PassiveStatic flag - - setCurrentFiber(fiber); - commitPassiveUnmountInsideDeletedTreeOnFiber(fiber, nearestMountedAncestor); - resetCurrentFiber(); - var child = fiber.child; // TODO: Only traverse subtree if it has a PassiveStatic flag. (But, if we - // do this, still need to handle `deletedTreeCleanUpLevel` correctly.) - - if (child !== null) { - child.return = fiber; - nextEffect = child; - } else { - commitPassiveUnmountEffectsInsideOfDeletedTree_complete(deletedSubtreeRoot); - } - } - } - - function commitPassiveUnmountEffectsInsideOfDeletedTree_complete(deletedSubtreeRoot) { - while (nextEffect !== null) { - var fiber = nextEffect; - var sibling = fiber.sibling; - var returnFiber = fiber.return; - - { - // Recursively traverse the entire deleted tree and clean up fiber fields. - // This is more aggressive than ideal, and the long term goal is to only - // have to detach the deleted tree at the root. - detachFiberAfterEffects(fiber); - - if (fiber === deletedSubtreeRoot) { - nextEffect = null; - return; - } - } - - if (sibling !== null) { - sibling.return = returnFiber; - nextEffect = sibling; - return; - } - - nextEffect = returnFiber; - } - } - - function commitPassiveUnmountInsideDeletedTreeOnFiber(current, nearestMountedAncestor) { - switch (current.tag) { - case FunctionComponent: - case ForwardRef: - case SimpleMemoComponent: - { - if ( current.mode & ProfileMode) { - startPassiveEffectTimer(); - commitHookEffectListUnmount(Passive$1, current, nearestMountedAncestor); - recordPassiveEffectDuration(current); - } else { - commitHookEffectListUnmount(Passive$1, current, nearestMountedAncestor); - } - - break; - } - } - } // TODO: Reuse reappearLayoutEffects traversal here? - - - function invokeLayoutEffectMountInDEV(fiber) { - { - // We don't need to re-check StrictEffectsMode here. - // This function is only called if that check has already passed. - switch (fiber.tag) { - case FunctionComponent: - case ForwardRef: - case SimpleMemoComponent: - { - try { - commitHookEffectListMount(Layout | HasEffect, fiber); - } catch (error) { - captureCommitPhaseError(fiber, fiber.return, error); - } - - break; - } - - case ClassComponent: - { - var instance = fiber.stateNode; - - try { - instance.componentDidMount(); - } catch (error) { - captureCommitPhaseError(fiber, fiber.return, error); - } - - break; - } - } - } - } - - function invokePassiveEffectMountInDEV(fiber) { - { - // We don't need to re-check StrictEffectsMode here. - // This function is only called if that check has already passed. - switch (fiber.tag) { - case FunctionComponent: - case ForwardRef: - case SimpleMemoComponent: - { - try { - commitHookEffectListMount(Passive$1 | HasEffect, fiber); - } catch (error) { - captureCommitPhaseError(fiber, fiber.return, error); - } - - break; - } - } - } - } - - function invokeLayoutEffectUnmountInDEV(fiber) { - { - // We don't need to re-check StrictEffectsMode here. - // This function is only called if that check has already passed. - switch (fiber.tag) { - case FunctionComponent: - case ForwardRef: - case SimpleMemoComponent: - { - try { - commitHookEffectListUnmount(Layout | HasEffect, fiber, fiber.return); - } catch (error) { - captureCommitPhaseError(fiber, fiber.return, error); - } - - break; - } - - case ClassComponent: - { - var instance = fiber.stateNode; - - if (typeof instance.componentWillUnmount === 'function') { - safelyCallComponentWillUnmount(fiber, fiber.return, instance); - } - - break; - } - } - } - } - - function invokePassiveEffectUnmountInDEV(fiber) { - { - // We don't need to re-check StrictEffectsMode here. - // This function is only called if that check has already passed. - switch (fiber.tag) { - case FunctionComponent: - case ForwardRef: - case SimpleMemoComponent: - { - try { - commitHookEffectListUnmount(Passive$1 | HasEffect, fiber, fiber.return); - } catch (error) { - captureCommitPhaseError(fiber, fiber.return, error); - } - } - } - } - } - - var COMPONENT_TYPE = 0; - var HAS_PSEUDO_CLASS_TYPE = 1; - var ROLE_TYPE = 2; - var TEST_NAME_TYPE = 3; - var TEXT_TYPE = 4; - - if (typeof Symbol === 'function' && Symbol.for) { - var symbolFor = Symbol.for; - COMPONENT_TYPE = symbolFor('selector.component'); - HAS_PSEUDO_CLASS_TYPE = symbolFor('selector.has_pseudo_class'); - ROLE_TYPE = symbolFor('selector.role'); - TEST_NAME_TYPE = symbolFor('selector.test_id'); - TEXT_TYPE = symbolFor('selector.text'); - } - var commitHooks = []; - function onCommitRoot$1() { - { - commitHooks.forEach(function (commitHook) { - return commitHook(); - }); - } - } - - var ReactCurrentActQueue = ReactSharedInternals.ReactCurrentActQueue; - function isLegacyActEnvironment(fiber) { - { - // Legacy mode. We preserve the behavior of React 17's act. It assumes an - // act environment whenever `jest` is defined, but you can still turn off - // spurious warnings by setting IS_REACT_ACT_ENVIRONMENT explicitly - // to false. - var isReactActEnvironmentGlobal = // $FlowExpectedError – Flow doesn't know about IS_REACT_ACT_ENVIRONMENT global - typeof IS_REACT_ACT_ENVIRONMENT !== 'undefined' ? IS_REACT_ACT_ENVIRONMENT : undefined; // $FlowExpectedError - Flow doesn't know about jest - - var jestIsDefined = typeof jest !== 'undefined'; - return jestIsDefined && isReactActEnvironmentGlobal !== false; - } - } - function isConcurrentActEnvironment() { - { - var isReactActEnvironmentGlobal = // $FlowExpectedError – Flow doesn't know about IS_REACT_ACT_ENVIRONMENT global - typeof IS_REACT_ACT_ENVIRONMENT !== 'undefined' ? IS_REACT_ACT_ENVIRONMENT : undefined; - - if (!isReactActEnvironmentGlobal && ReactCurrentActQueue.current !== null) { - // TODO: Include link to relevant documentation page. - error('The current testing environment is not configured to support ' + 'act(...)'); - } - - return isReactActEnvironmentGlobal; - } - } - - var ceil = Math.ceil; - var ReactCurrentDispatcher$2 = ReactSharedInternals.ReactCurrentDispatcher, - ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner, - ReactCurrentBatchConfig$3 = ReactSharedInternals.ReactCurrentBatchConfig, - ReactCurrentActQueue$1 = ReactSharedInternals.ReactCurrentActQueue; - var NoContext = - /* */ - 0; - var BatchedContext = - /* */ - 1; - var RenderContext = - /* */ - 2; - var CommitContext = - /* */ - 4; - var RootInProgress = 0; - var RootFatalErrored = 1; - var RootErrored = 2; - var RootSuspended = 3; - var RootSuspendedWithDelay = 4; - var RootCompleted = 5; - var RootDidNotComplete = 6; // Describes where we are in the React execution stack - - var executionContext = NoContext; // The root we're working on - - var workInProgressRoot = null; // The fiber we're working on - - var workInProgress = null; // The lanes we're rendering - - var workInProgressRootRenderLanes = NoLanes; // Stack that allows components to change the render lanes for its subtree - // This is a superset of the lanes we started working on at the root. The only - // case where it's Different from `workInProgressRootRenderLanes` is when we - // enter a subtree that is hidden and needs to be unhidden: Suspense and - // Offscreen component. - // - // Most things in the work loop should deal with workInProgressRootRenderLanes. - // Most things in begin/complete phases should deal with subtreeRenderLanes. - - var subtreeRenderLanes = NoLanes; - var subtreeRenderLanesCursor = createCursor(NoLanes); // Whether to root completed, errored, suspended, etc. - - var workInProgressRootExitStatus = RootInProgress; // A fatal error, if one is thrown - - var workInProgressRootFatalError = null; // "Included" lanes refer to lanes that were worked on during this render. It's - // slightly Different than `renderLanes` because `renderLanes` can change as you - // enter and exit an Offscreen tree. This value is the combination of all render - // lanes for the entire render phase. - - var workInProgressRootIncludedLanes = NoLanes; // The work left over by components that were visited during this render. Only - // includes unprocessed updates, not work in bailed out children. - - var workInProgressRootSkippedLanes = NoLanes; // Lanes that were updated (in an interleaved event) during this render. - - var workInProgressRootInterleavedUpdatedLanes = NoLanes; // Lanes that were updated during the render phase (*not* an interleaved event). - - var workInProgressRootPingedLanes = NoLanes; // Errors that are thrown during the render phase. - - var workInProgressRootConcurrentErrors = null; // These are errors that we recovered from without surfacing them to the UI. - // We will log them once the tree commits. - - var workInProgressRootRecoverableErrors = null; // The most recent time we committed a fallback. This lets us ensure a train - // model where we don't commit new loading states in too quick succession. - - var globalMostRecentFallbackTime = 0; - var FALLBACK_THROTTLE_MS = 500; // The absolute time for when we should start giving up on rendering - // more and prefer CPU suspense heuristics instead. - - var workInProgressRootRenderTargetTime = Infinity; // How long a render is supposed to take before we start following CPU - // suspense heuristics and opt out of rendering more content. - - var RENDER_TIMEOUT_MS = 500; - var workInProgressTransitions = null; - - function resetRenderTimer() { - workInProgressRootRenderTargetTime = now() + RENDER_TIMEOUT_MS; - } - - function getRenderTargetTime() { - return workInProgressRootRenderTargetTime; - } - var hasUncaughtError = false; - var firstUncaughtError = null; - var legacyErrorBoundariesThatAlreadyFailed = null; // Only used when enableProfilerNestedUpdateScheduledHook is true; - var rootDoesHavePassiveEffects = false; - var rootWithPendingPassiveEffects = null; - var pendingPassiveEffectsLanes = NoLanes; - var pendingPassiveProfilerEffects = []; - var pendingPassiveTransitions = null; // Use these to prevent an infinite loop of nested updates - - var NESTED_UPDATE_LIMIT = 50; - var nestedUpdateCount = 0; - var rootWithNestedUpdates = null; - var isFlushingPassiveEffects = false; - var didScheduleUpdateDuringPassiveEffects = false; - var NESTED_PASSIVE_UPDATE_LIMIT = 50; - var nestedPassiveUpdateCount = 0; - var rootWithPassiveNestedUpdates = null; // If two updates are scheduled within the same event, we should treat their - // event times as simultaneous, even if the actual clock time has advanced - // between the first and second call. - - var currentEventTime = NoTimestamp; - var currentEventTransitionLane = NoLanes; - var isRunningInsertionEffect = false; - function getWorkInProgressRoot() { - return workInProgressRoot; - } - function requestEventTime() { - if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { - // We're inside React, so it's fine to read the actual time. - return now(); - } // We're not inside React, so we may be in the middle of a browser event. - - - if (currentEventTime !== NoTimestamp) { - // Use the same start time for all updates until we enter React again. - return currentEventTime; - } // This is the first update since React yielded. Compute a new start time. - - - currentEventTime = now(); - return currentEventTime; - } - function requestUpdateLane(fiber) { - // Special cases - var mode = fiber.mode; - - if ((mode & ConcurrentMode) === NoMode) { - return SyncLane; - } else if ( (executionContext & RenderContext) !== NoContext && workInProgressRootRenderLanes !== NoLanes) { - // This is a render phase update. These are not officially supported. The - // old behavior is to give this the same "thread" (lanes) as - // whatever is currently rendering. So if you call `setState` on a component - // that happens later in the same render, it will flush. Ideally, we want to - // remove the special case and treat them as if they came from an - // interleaved event. Regardless, this pattern is not officially supported. - // This behavior is only a fallback. The flag only exists until we can roll - // out the setState warning, since existing code might accidentally rely on - // the current behavior. - return pickArbitraryLane(workInProgressRootRenderLanes); - } - - var isTransition = requestCurrentTransition() !== NoTransition; - - if (isTransition) { - if ( ReactCurrentBatchConfig$3.transition !== null) { - var transition = ReactCurrentBatchConfig$3.transition; - - if (!transition._updatedFibers) { - transition._updatedFibers = new Set(); - } - - transition._updatedFibers.add(fiber); - } // The algorithm for assigning an update to a lane should be stable for all - // updates at the same priority within the same event. To do this, the - // inputs to the algorithm must be the same. - // - // The trick we use is to cache the first of each of these inputs within an - // event. Then reset the cached values once we can be sure the event is - // over. Our heuristic for that is whenever we enter a concurrent work loop. - - - if (currentEventTransitionLane === NoLane) { - // All transitions within the same event are assigned the same lane. - currentEventTransitionLane = claimNextTransitionLane(); - } - - return currentEventTransitionLane; - } // Updates originating inside certain React methods, like flushSync, have - // their priority set by tracking it with a context variable. - // - // The opaque type returned by the host config is internally a lane, so we can - // use that directly. - // TODO: Move this type conversion to the event priority module. - - - var updateLane = getCurrentUpdatePriority(); - - if (updateLane !== NoLane) { - return updateLane; - } // This update originated outside React. Ask the host environment for an - // appropriate priority, based on the type of event. - // - // The opaque type returned by the host config is internally a lane, so we can - // use that directly. - // TODO: Move this type conversion to the event priority module. - - - var eventLane = getCurrentEventPriority(); - return eventLane; - } - - function requestRetryLane(fiber) { - // This is a fork of `requestUpdateLane` designed specifically for Suspense - // "retries" — a special update that attempts to flip a Suspense boundary - // from its placeholder state to its primary/resolved state. - // Special cases - var mode = fiber.mode; - - if ((mode & ConcurrentMode) === NoMode) { - return SyncLane; - } - - return claimNextRetryLane(); - } - - function scheduleUpdateOnFiber(root, fiber, lane, eventTime) { - checkForNestedUpdates(); - - { - if (isRunningInsertionEffect) { - error('useInsertionEffect must not schedule updates.'); - } - } - - { - if (isFlushingPassiveEffects) { - didScheduleUpdateDuringPassiveEffects = true; - } - } // Mark that the root has a pending update. - - - markRootUpdated(root, lane, eventTime); - - if ((executionContext & RenderContext) !== NoLanes && root === workInProgressRoot) { - // This update was dispatched during the render phase. This is a mistake - // if the update originates from user space (with the exception of local - // hook updates, which are handled differently and don't reach this - // function), but there are some internal React features that use this as - // an implementation detail, like selective hydration. - warnAboutRenderPhaseUpdatesInDEV(fiber); // Track lanes that were updated during the render phase - } else { - // This is a normal update, scheduled from outside the render phase. For - // example, during an input event. - { - if (isDevToolsPresent) { - addFiberToLanesMap(root, fiber, lane); - } - } - - warnIfUpdatesNotWrappedWithActDEV(fiber); - - if (root === workInProgressRoot) { - // Received an update to a tree that's in the middle of rendering. Mark - // that there was an interleaved update work on this root. Unless the - // `deferRenderPhaseUpdateToNextBatch` flag is off and this is a render - // phase update. In that case, we don't treat render phase updates as if - // they were interleaved, for backwards compat reasons. - if ( (executionContext & RenderContext) === NoContext) { - workInProgressRootInterleavedUpdatedLanes = mergeLanes(workInProgressRootInterleavedUpdatedLanes, lane); - } - - if (workInProgressRootExitStatus === RootSuspendedWithDelay) { - // The root already suspended with a delay, which means this render - // definitely won't finish. Since we have a new update, let's mark it as - // suspended now, right before marking the incoming update. This has the - // effect of interrupting the current render and switching to the update. - // TODO: Make sure this doesn't override pings that happen while we've - // already started rendering. - markRootSuspended$1(root, workInProgressRootRenderLanes); - } - } - - ensureRootIsScheduled(root, eventTime); - - if (lane === SyncLane && executionContext === NoContext && (fiber.mode & ConcurrentMode) === NoMode && // Treat `act` as if it's inside `batchedUpdates`, even in legacy mode. - !( ReactCurrentActQueue$1.isBatchingLegacy)) { - // Flush the synchronous work now, unless we're already working or inside - // a batch. This is intentionally inside scheduleUpdateOnFiber instead of - // scheduleCallbackForFiber to preserve the ability to schedule a callback - // without immediately flushing it. We only do this for user-initiated - // updates, to preserve historical behavior of legacy mode. - resetRenderTimer(); - flushSyncCallbacksOnlyInLegacyMode(); - } - } - } - function scheduleInitialHydrationOnRoot(root, lane, eventTime) { - // This is a special fork of scheduleUpdateOnFiber that is only used to - // schedule the initial hydration of a root that has just been created. Most - // of the stuff in scheduleUpdateOnFiber can be skipped. - // - // The main reason for this separate path, though, is to distinguish the - // initial children from subsequent updates. In fully client-rendered roots - // (createRoot instead of hydrateRoot), all top-level renders are modeled as - // updates, but hydration roots are special because the initial render must - // match what was rendered on the server. - var current = root.current; - current.lanes = lane; - markRootUpdated(root, lane, eventTime); - ensureRootIsScheduled(root, eventTime); - } - function isUnsafeClassRenderPhaseUpdate(fiber) { - // Check if this is a render phase update. Only called by class components, - // which special (deprecated) behavior for UNSAFE_componentWillReceive props. - return (// TODO: Remove outdated deferRenderPhaseUpdateToNextBatch experiment. We - // decided not to enable it. - (executionContext & RenderContext) !== NoContext - ); - } // Use this function to schedule a task for a root. There's only one task per - // root; if a task was already scheduled, we'll check to make sure the priority - // of the existing task is the same as the priority of the next level that the - // root has work on. This function is called on every update, and right before - // exiting a task. - - function ensureRootIsScheduled(root, currentTime) { - var existingCallbackNode = root.callbackNode; // Check if any lanes are being starved by other work. If so, mark them as - // expired so we know to work on those next. - - markStarvedLanesAsExpired(root, currentTime); // Determine the next lanes to work on, and their priority. - - var nextLanes = getNextLanes(root, root === workInProgressRoot ? workInProgressRootRenderLanes : NoLanes); - - if (nextLanes === NoLanes) { - // Special case: There's nothing to work on. - if (existingCallbackNode !== null) { - cancelCallback$1(existingCallbackNode); - } - - root.callbackNode = null; - root.callbackPriority = NoLane; - return; - } // We use the highest priority lane to represent the priority of the callback. - - - var newCallbackPriority = getHighestPriorityLane(nextLanes); // Check if there's an existing task. We may be able to reuse it. - - var existingCallbackPriority = root.callbackPriority; - - if (existingCallbackPriority === newCallbackPriority && // Special case related to `act`. If the currently scheduled task is a - // Scheduler task, rather than an `act` task, cancel it and re-scheduled - // on the `act` queue. - !( ReactCurrentActQueue$1.current !== null && existingCallbackNode !== fakeActCallbackNode)) { - { - // If we're going to re-use an existing task, it needs to exist. - // Assume that discrete update microtasks are non-cancellable and null. - // TODO: Temporary until we confirm this warning is not fired. - if (existingCallbackNode == null && existingCallbackPriority !== SyncLane) { - error('Expected scheduled callback to exist. This error is likely caused by a bug in React. Please file an issue.'); - } - } // The priority hasn't changed. We can reuse the existing task. Exit. - - - return; - } - - if (existingCallbackNode != null) { - // Cancel the existing callback. We'll schedule a new one below. - cancelCallback$1(existingCallbackNode); - } // Schedule a new callback. - - - var newCallbackNode; - - if (newCallbackPriority === SyncLane) { - // Special case: Sync React callbacks are scheduled on a special - // internal queue - if (root.tag === LegacyRoot) { - if ( ReactCurrentActQueue$1.isBatchingLegacy !== null) { - ReactCurrentActQueue$1.didScheduleLegacyUpdate = true; - } - - scheduleLegacySyncCallback(performSyncWorkOnRoot.bind(null, root)); - } else { - scheduleSyncCallback(performSyncWorkOnRoot.bind(null, root)); - } - - { - // Flush the queue in a microtask. - if ( ReactCurrentActQueue$1.current !== null) { - // Inside `act`, use our internal `act` queue so that these get flushed - // at the end of the current scope even when using the sync version - // of `act`. - ReactCurrentActQueue$1.current.push(flushSyncCallbacks); - } else { - scheduleMicrotask(function () { - // In Safari, appending an iframe forces microtasks to run. - // https://github.com/facebook/react/issues/22459 - // We don't support running callbacks in the middle of render - // or commit so we need to check against that. - if ((executionContext & (RenderContext | CommitContext)) === NoContext) { - // Note that this would still prematurely flush the callbacks - // if this happens outside render or commit phase (e.g. in an event). - flushSyncCallbacks(); - } - }); - } - } - - newCallbackNode = null; - } else { - var schedulerPriorityLevel; - - switch (lanesToEventPriority(nextLanes)) { - case DiscreteEventPriority: - schedulerPriorityLevel = ImmediatePriority; - break; - - case ContinuousEventPriority: - schedulerPriorityLevel = UserBlockingPriority; - break; - - case DefaultEventPriority: - schedulerPriorityLevel = NormalPriority; - break; - - case IdleEventPriority: - schedulerPriorityLevel = IdlePriority; - break; - - default: - schedulerPriorityLevel = NormalPriority; - break; - } - - newCallbackNode = scheduleCallback$1(schedulerPriorityLevel, performConcurrentWorkOnRoot.bind(null, root)); - } - - root.callbackPriority = newCallbackPriority; - root.callbackNode = newCallbackNode; - } // This is the entry point for every concurrent task, i.e. anything that - // goes through Scheduler. - - - function performConcurrentWorkOnRoot(root, didTimeout) { - { - resetNestedUpdateFlag(); - } // Since we know we're in a React event, we can clear the current - // event time. The next update will compute a new event time. - - - currentEventTime = NoTimestamp; - currentEventTransitionLane = NoLanes; - - if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { - throw new Error('Should not already be working.'); - } // Flush any pending passive effects before deciding which lanes to work on, - // in case they schedule additional work. - - - var originalCallbackNode = root.callbackNode; - var didFlushPassiveEffects = flushPassiveEffects(); - - if (didFlushPassiveEffects) { - // Something in the passive effect phase may have canceled the current task. - // Check if the task node for this root was changed. - if (root.callbackNode !== originalCallbackNode) { - // The current task was canceled. Exit. We don't need to call - // `ensureRootIsScheduled` because the check above implies either that - // there's a new task, or that there's no remaining work on this root. - return null; - } - } // Determine the next lanes to work on, using the fields stored - // on the root. - - - var lanes = getNextLanes(root, root === workInProgressRoot ? workInProgressRootRenderLanes : NoLanes); - - if (lanes === NoLanes) { - // Defensive coding. This is never expected to happen. - return null; - } // We disable time-slicing in some cases: if the work has been CPU-bound - // for too long ("expired" work, to prevent starvation), or we're in - // sync-updates-by-default mode. - // TODO: We only check `didTimeout` defensively, to account for a Scheduler - // bug we're still investigating. Once the bug in Scheduler is fixed, - // we can remove this, since we track expiration ourselves. - - - var shouldTimeSlice = !includesBlockingLane(root, lanes) && !includesExpiredLane(root, lanes) && ( !didTimeout); - var exitStatus = shouldTimeSlice ? renderRootConcurrent(root, lanes) : renderRootSync(root, lanes); - - if (exitStatus !== RootInProgress) { - if (exitStatus === RootErrored) { - // If something threw an error, try rendering one more time. We'll - // render synchronously to block concurrent data mutations, and we'll - // includes all pending updates are included. If it still fails after - // the second attempt, we'll give up and commit the resulting tree. - var errorRetryLanes = getLanesToRetrySynchronouslyOnError(root); - - if (errorRetryLanes !== NoLanes) { - lanes = errorRetryLanes; - exitStatus = recoverFromConcurrentError(root, errorRetryLanes); - } - } - - if (exitStatus === RootFatalErrored) { - var fatalError = workInProgressRootFatalError; - prepareFreshStack(root, NoLanes); - markRootSuspended$1(root, lanes); - ensureRootIsScheduled(root, now()); - throw fatalError; - } - - if (exitStatus === RootDidNotComplete) { - // The render unwound without completing the tree. This happens in special - // cases where need to exit the current render without producing a - // consistent tree or committing. - // - // This should only happen during a concurrent render, not a discrete or - // synchronous update. We should have already checked for this when we - // unwound the stack. - markRootSuspended$1(root, lanes); - } else { - // The render completed. - // Check if this render may have yielded to a concurrent event, and if so, - // confirm that any newly rendered stores are consistent. - // TODO: It's possible that even a concurrent render may never have yielded - // to the main thread, if it was fast enough, or if it expired. We could - // skip the consistency check in that case, too. - var renderWasConcurrent = !includesBlockingLane(root, lanes); - var finishedWork = root.current.alternate; - - if (renderWasConcurrent && !isRenderConsistentWithExternalStores(finishedWork)) { - // A store was mutated in an interleaved event. Render again, - // synchronously, to block further mutations. - exitStatus = renderRootSync(root, lanes); // We need to check again if something threw - - if (exitStatus === RootErrored) { - var _errorRetryLanes = getLanesToRetrySynchronouslyOnError(root); - - if (_errorRetryLanes !== NoLanes) { - lanes = _errorRetryLanes; - exitStatus = recoverFromConcurrentError(root, _errorRetryLanes); // We assume the tree is now consistent because we didn't yield to any - // concurrent events. - } - } - - if (exitStatus === RootFatalErrored) { - var _fatalError = workInProgressRootFatalError; - prepareFreshStack(root, NoLanes); - markRootSuspended$1(root, lanes); - ensureRootIsScheduled(root, now()); - throw _fatalError; - } - } // We now have a consistent tree. The next step is either to commit it, - // or, if something suspended, wait to commit it after a timeout. - - - root.finishedWork = finishedWork; - root.finishedLanes = lanes; - finishConcurrentRender(root, exitStatus, lanes); - } - } - - ensureRootIsScheduled(root, now()); - - if (root.callbackNode === originalCallbackNode) { - // The task node scheduled for this root is the same one that's - // currently executed. Need to return a continuation. - return performConcurrentWorkOnRoot.bind(null, root); - } - - return null; - } - - function recoverFromConcurrentError(root, errorRetryLanes) { - // If an error occurred during hydration, discard server response and fall - // back to client side render. - // Before rendering again, save the errors from the previous attempt. - var errorsFromFirstAttempt = workInProgressRootConcurrentErrors; - - if (isRootDehydrated(root)) { - // The shell failed to hydrate. Set a flag to force a client rendering - // during the next attempt. To do this, we call prepareFreshStack now - // to create the root work-in-progress fiber. This is a bit weird in terms - // of factoring, because it relies on renderRootSync not calling - // prepareFreshStack again in the call below, which happens because the - // root and lanes haven't changed. - // - // TODO: I think what we should do is set ForceClientRender inside - // throwException, like we do for nested Suspense boundaries. The reason - // it's here instead is so we can switch to the synchronous work loop, too. - // Something to consider for a future refactor. - var rootWorkInProgress = prepareFreshStack(root, errorRetryLanes); - rootWorkInProgress.flags |= ForceClientRender; - - { - errorHydratingContainer(root.containerInfo); - } - } - - var exitStatus = renderRootSync(root, errorRetryLanes); - - if (exitStatus !== RootErrored) { - // Successfully finished rendering on retry - // The errors from the failed first attempt have been recovered. Add - // them to the collection of recoverable errors. We'll log them in the - // commit phase. - var errorsFromSecondAttempt = workInProgressRootRecoverableErrors; - workInProgressRootRecoverableErrors = errorsFromFirstAttempt; // The errors from the second attempt should be queued after the errors - // from the first attempt, to preserve the causal sequence. - - if (errorsFromSecondAttempt !== null) { - queueRecoverableErrors(errorsFromSecondAttempt); - } - } - - return exitStatus; - } - - function queueRecoverableErrors(errors) { - if (workInProgressRootRecoverableErrors === null) { - workInProgressRootRecoverableErrors = errors; - } else { - workInProgressRootRecoverableErrors.push.apply(workInProgressRootRecoverableErrors, errors); - } - } - - function finishConcurrentRender(root, exitStatus, lanes) { - switch (exitStatus) { - case RootInProgress: - case RootFatalErrored: - { - throw new Error('Root did not complete. This is a bug in React.'); - } - // Flow knows about invariant, so it complains if I add a break - // statement, but eslint doesn't know about invariant, so it complains - // if I do. eslint-disable-next-line no-fallthrough - - case RootErrored: - { - // We should have already attempted to retry this tree. If we reached - // this point, it errored again. Commit it. - commitRoot(root, workInProgressRootRecoverableErrors, workInProgressTransitions); - break; - } - - case RootSuspended: - { - markRootSuspended$1(root, lanes); // We have an acceptable loading state. We need to figure out if we - // should immediately commit it or wait a bit. - - if (includesOnlyRetries(lanes) && // do not delay if we're inside an act() scope - !shouldForceFlushFallbacksInDEV()) { - // This render only included retries, no updates. Throttle committing - // retries so that we don't show too many loading states too quickly. - var msUntilTimeout = globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now(); // Don't bother with a very short suspense time. - - if (msUntilTimeout > 10) { - var nextLanes = getNextLanes(root, NoLanes); - - if (nextLanes !== NoLanes) { - // There's additional work on this root. - break; - } - - var suspendedLanes = root.suspendedLanes; - - if (!isSubsetOfLanes(suspendedLanes, lanes)) { - // We should prefer to render the fallback of at the last - // suspended level. Ping the last suspended level to try - // rendering it again. - // FIXME: What if the suspended lanes are Idle? Should not restart. - var eventTime = requestEventTime(); - markRootPinged(root, suspendedLanes); - break; - } // The render is suspended, it hasn't timed out, and there's no - // lower priority work to do. Instead of committing the fallback - // immediately, wait for more data to arrive. - - - root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root, workInProgressRootRecoverableErrors, workInProgressTransitions), msUntilTimeout); - break; - } - } // The work expired. Commit immediately. - - - commitRoot(root, workInProgressRootRecoverableErrors, workInProgressTransitions); - break; - } - - case RootSuspendedWithDelay: - { - markRootSuspended$1(root, lanes); - - if (includesOnlyTransitions(lanes)) { - // This is a transition, so we should exit without committing a - // placeholder and without scheduling a timeout. Delay indefinitely - // until we receive more data. - break; - } - - if (!shouldForceFlushFallbacksInDEV()) { - // This is not a transition, but we did trigger an avoided state. - // Schedule a placeholder to display after a short delay, using the Just - // Noticeable Difference. - // TODO: Is the JND optimization worth the added complexity? If this is - // the only reason we track the event time, then probably not. - // Consider removing. - var mostRecentEventTime = getMostRecentEventTime(root, lanes); - var eventTimeMs = mostRecentEventTime; - var timeElapsedMs = now() - eventTimeMs; - - var _msUntilTimeout = jnd(timeElapsedMs) - timeElapsedMs; // Don't bother with a very short suspense time. - - - if (_msUntilTimeout > 10) { - // Instead of committing the fallback immediately, wait for more data - // to arrive. - root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root, workInProgressRootRecoverableErrors, workInProgressTransitions), _msUntilTimeout); - break; - } - } // Commit the placeholder. - - - commitRoot(root, workInProgressRootRecoverableErrors, workInProgressTransitions); - break; - } - - case RootCompleted: - { - // The work completed. Ready to commit. - commitRoot(root, workInProgressRootRecoverableErrors, workInProgressTransitions); - break; - } - - default: - { - throw new Error('Unknown root exit status.'); - } - } - } - - function isRenderConsistentWithExternalStores(finishedWork) { - // Search the rendered tree for external store reads, and check whether the - // stores were mutated in a concurrent event. Intentionally using an iterative - // loop instead of recursion so we can exit early. - var node = finishedWork; - - while (true) { - if (node.flags & StoreConsistency) { - var updateQueue = node.updateQueue; - - if (updateQueue !== null) { - var checks = updateQueue.stores; - - if (checks !== null) { - for (var i = 0; i < checks.length; i++) { - var check = checks[i]; - var getSnapshot = check.getSnapshot; - var renderedValue = check.value; - - try { - if (!objectIs(getSnapshot(), renderedValue)) { - // Found an inconsistent store. - return false; - } - } catch (error) { - // If `getSnapshot` throws, return `false`. This will schedule - // a re-render, and the error will be rethrown during render. - return false; - } - } - } - } - } - - var child = node.child; - - if (node.subtreeFlags & StoreConsistency && child !== null) { - child.return = node; - node = child; - continue; - } - - if (node === finishedWork) { - return true; - } - - while (node.sibling === null) { - if (node.return === null || node.return === finishedWork) { - return true; - } - - node = node.return; - } - - node.sibling.return = node.return; - node = node.sibling; - } // Flow doesn't know this is unreachable, but eslint does - // eslint-disable-next-line no-unreachable - - - return true; - } - - function markRootSuspended$1(root, suspendedLanes) { - // When suspending, we should always exclude lanes that were pinged or (more - // rarely, since we try to avoid it) updated during the render phase. - // TODO: Lol maybe there's a better way to factor this besides this - // obnoxiously named function :) - suspendedLanes = removeLanes(suspendedLanes, workInProgressRootPingedLanes); - suspendedLanes = removeLanes(suspendedLanes, workInProgressRootInterleavedUpdatedLanes); - markRootSuspended(root, suspendedLanes); - } // This is the entry point for synchronous tasks that don't go - // through Scheduler - - - function performSyncWorkOnRoot(root) { - { - syncNestedUpdateFlag(); - } - - if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { - throw new Error('Should not already be working.'); - } - - flushPassiveEffects(); - var lanes = getNextLanes(root, NoLanes); - - if (!includesSomeLane(lanes, SyncLane)) { - // There's no remaining sync work left. - ensureRootIsScheduled(root, now()); - return null; - } - - var exitStatus = renderRootSync(root, lanes); - - if (root.tag !== LegacyRoot && exitStatus === RootErrored) { - // If something threw an error, try rendering one more time. We'll render - // synchronously to block concurrent data mutations, and we'll includes - // all pending updates are included. If it still fails after the second - // attempt, we'll give up and commit the resulting tree. - var errorRetryLanes = getLanesToRetrySynchronouslyOnError(root); - - if (errorRetryLanes !== NoLanes) { - lanes = errorRetryLanes; - exitStatus = recoverFromConcurrentError(root, errorRetryLanes); - } - } - - if (exitStatus === RootFatalErrored) { - var fatalError = workInProgressRootFatalError; - prepareFreshStack(root, NoLanes); - markRootSuspended$1(root, lanes); - ensureRootIsScheduled(root, now()); - throw fatalError; - } - - if (exitStatus === RootDidNotComplete) { - throw new Error('Root did not complete. This is a bug in React.'); - } // We now have a consistent tree. Because this is a sync render, we - // will commit it even if something suspended. - - - var finishedWork = root.current.alternate; - root.finishedWork = finishedWork; - root.finishedLanes = lanes; - commitRoot(root, workInProgressRootRecoverableErrors, workInProgressTransitions); // Before exiting, make sure there's a callback scheduled for the next - // pending level. - - ensureRootIsScheduled(root, now()); - return null; - } - - function flushRoot(root, lanes) { - if (lanes !== NoLanes) { - markRootEntangled(root, mergeLanes(lanes, SyncLane)); - ensureRootIsScheduled(root, now()); - - if ((executionContext & (RenderContext | CommitContext)) === NoContext) { - resetRenderTimer(); - flushSyncCallbacks(); - } - } - } - function batchedUpdates$1(fn, a) { - var prevExecutionContext = executionContext; - executionContext |= BatchedContext; - - try { - return fn(a); - } finally { - executionContext = prevExecutionContext; // If there were legacy sync updates, flush them at the end of the outer - // most batchedUpdates-like method. - - if (executionContext === NoContext && // Treat `act` as if it's inside `batchedUpdates`, even in legacy mode. - !( ReactCurrentActQueue$1.isBatchingLegacy)) { - resetRenderTimer(); - flushSyncCallbacksOnlyInLegacyMode(); - } - } - } - function discreteUpdates(fn, a, b, c, d) { - var previousPriority = getCurrentUpdatePriority(); - var prevTransition = ReactCurrentBatchConfig$3.transition; - - try { - ReactCurrentBatchConfig$3.transition = null; - setCurrentUpdatePriority(DiscreteEventPriority); - return fn(a, b, c, d); - } finally { - setCurrentUpdatePriority(previousPriority); - ReactCurrentBatchConfig$3.transition = prevTransition; - - if (executionContext === NoContext) { - resetRenderTimer(); - } - } - } // Overload the definition to the two valid signatures. - // Warning, this opts-out of checking the function body. - - // eslint-disable-next-line no-redeclare - function flushSync(fn) { - // In legacy mode, we flush pending passive effects at the beginning of the - // next event, not at the end of the previous one. - if (rootWithPendingPassiveEffects !== null && rootWithPendingPassiveEffects.tag === LegacyRoot && (executionContext & (RenderContext | CommitContext)) === NoContext) { - flushPassiveEffects(); - } - - var prevExecutionContext = executionContext; - executionContext |= BatchedContext; - var prevTransition = ReactCurrentBatchConfig$3.transition; - var previousPriority = getCurrentUpdatePriority(); - - try { - ReactCurrentBatchConfig$3.transition = null; - setCurrentUpdatePriority(DiscreteEventPriority); - - if (fn) { - return fn(); - } else { - return undefined; - } - } finally { - setCurrentUpdatePriority(previousPriority); - ReactCurrentBatchConfig$3.transition = prevTransition; - executionContext = prevExecutionContext; // Flush the immediate callbacks that were scheduled during this batch. - // Note that this will happen even if batchedUpdates is higher up - // the stack. - - if ((executionContext & (RenderContext | CommitContext)) === NoContext) { - flushSyncCallbacks(); - } - } - } - function isAlreadyRendering() { - // Used by the renderer to print a warning if certain APIs are called from - // the wrong context. - return (executionContext & (RenderContext | CommitContext)) !== NoContext; - } - function pushRenderLanes(fiber, lanes) { - push(subtreeRenderLanesCursor, subtreeRenderLanes, fiber); - subtreeRenderLanes = mergeLanes(subtreeRenderLanes, lanes); - workInProgressRootIncludedLanes = mergeLanes(workInProgressRootIncludedLanes, lanes); - } - function popRenderLanes(fiber) { - subtreeRenderLanes = subtreeRenderLanesCursor.current; - pop(subtreeRenderLanesCursor, fiber); - } - - function prepareFreshStack(root, lanes) { - root.finishedWork = null; - root.finishedLanes = NoLanes; - var timeoutHandle = root.timeoutHandle; - - if (timeoutHandle !== noTimeout) { - // The root previous suspended and scheduled a timeout to commit a fallback - // state. Now that we have additional work, cancel the timeout. - root.timeoutHandle = noTimeout; // $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above - - cancelTimeout(timeoutHandle); - } - - if (workInProgress !== null) { - var interruptedWork = workInProgress.return; - - while (interruptedWork !== null) { - var current = interruptedWork.alternate; - unwindInterruptedWork(current, interruptedWork); - interruptedWork = interruptedWork.return; - } - } - - workInProgressRoot = root; - var rootWorkInProgress = createWorkInProgress(root.current, null); - workInProgress = rootWorkInProgress; - workInProgressRootRenderLanes = subtreeRenderLanes = workInProgressRootIncludedLanes = lanes; - workInProgressRootExitStatus = RootInProgress; - workInProgressRootFatalError = null; - workInProgressRootSkippedLanes = NoLanes; - workInProgressRootInterleavedUpdatedLanes = NoLanes; - workInProgressRootPingedLanes = NoLanes; - workInProgressRootConcurrentErrors = null; - workInProgressRootRecoverableErrors = null; - finishQueueingConcurrentUpdates(); - - { - ReactStrictModeWarnings.discardPendingWarnings(); - } - - return rootWorkInProgress; - } - - function handleError(root, thrownValue) { - do { - var erroredWork = workInProgress; - - try { - // Reset module-level state that was set during the render phase. - resetContextDependencies(); - resetHooksAfterThrow(); - resetCurrentFiber(); // TODO: I found and added this missing line while investigating a - // separate issue. Write a regression test using string refs. - - ReactCurrentOwner$2.current = null; - - if (erroredWork === null || erroredWork.return === null) { - // Expected to be working on a non-root fiber. This is a fatal error - // because there's no ancestor that can handle it; the root is - // supposed to capture all errors that weren't caught by an error - // boundary. - workInProgressRootExitStatus = RootFatalErrored; - workInProgressRootFatalError = thrownValue; // Set `workInProgress` to null. This represents advancing to the next - // sibling, or the parent if there are no siblings. But since the root - // has no siblings nor a parent, we set it to null. Usually this is - // handled by `completeUnitOfWork` or `unwindWork`, but since we're - // intentionally not calling those, we need set it here. - // TODO: Consider calling `unwindWork` to pop the contexts. - - workInProgress = null; - return; - } - - if (enableProfilerTimer && erroredWork.mode & ProfileMode) { - // Record the time spent rendering before an error was thrown. This - // avoids inaccurate Profiler durations in the case of a - // suspended render. - stopProfilerTimerIfRunningAndRecordDelta(erroredWork, true); - } - - if (enableSchedulingProfiler) { - markComponentRenderStopped(); - - if (thrownValue !== null && typeof thrownValue === 'object' && typeof thrownValue.then === 'function') { - var wakeable = thrownValue; - markComponentSuspended(erroredWork, wakeable, workInProgressRootRenderLanes); - } else { - markComponentErrored(erroredWork, thrownValue, workInProgressRootRenderLanes); - } - } - - throwException(root, erroredWork.return, erroredWork, thrownValue, workInProgressRootRenderLanes); - completeUnitOfWork(erroredWork); - } catch (yetAnotherThrownValue) { - // Something in the return path also threw. - thrownValue = yetAnotherThrownValue; - - if (workInProgress === erroredWork && erroredWork !== null) { - // If this boundary has already errored, then we had trouble processing - // the error. Bubble it to the next boundary. - erroredWork = erroredWork.return; - workInProgress = erroredWork; - } else { - erroredWork = workInProgress; - } - - continue; - } // Return to the normal work loop. - - - return; - } while (true); - } - - function pushDispatcher() { - var prevDispatcher = ReactCurrentDispatcher$2.current; - ReactCurrentDispatcher$2.current = ContextOnlyDispatcher; - - if (prevDispatcher === null) { - // The React isomorphic package does not include a default dispatcher. - // Instead the first renderer will lazily attach one, in order to give - // nicer error messages. - return ContextOnlyDispatcher; - } else { - return prevDispatcher; - } - } - - function popDispatcher(prevDispatcher) { - ReactCurrentDispatcher$2.current = prevDispatcher; - } - - function markCommitTimeOfFallback() { - globalMostRecentFallbackTime = now(); - } - function markSkippedUpdateLanes(lane) { - workInProgressRootSkippedLanes = mergeLanes(lane, workInProgressRootSkippedLanes); - } - function renderDidSuspend() { - if (workInProgressRootExitStatus === RootInProgress) { - workInProgressRootExitStatus = RootSuspended; - } - } - function renderDidSuspendDelayIfPossible() { - if (workInProgressRootExitStatus === RootInProgress || workInProgressRootExitStatus === RootSuspended || workInProgressRootExitStatus === RootErrored) { - workInProgressRootExitStatus = RootSuspendedWithDelay; - } // Check if there are updates that we skipped tree that might have unblocked - // this render. - - - if (workInProgressRoot !== null && (includesNonIdleWork(workInProgressRootSkippedLanes) || includesNonIdleWork(workInProgressRootInterleavedUpdatedLanes))) { - // Mark the current render as suspended so that we switch to working on - // the updates that were skipped. Usually we only suspend at the end of - // the render phase. - // TODO: We should probably always mark the root as suspended immediately - // (inside this function), since by suspending at the end of the render - // phase introduces a potential mistake where we suspend lanes that were - // pinged or updated while we were rendering. - markRootSuspended$1(workInProgressRoot, workInProgressRootRenderLanes); - } - } - function renderDidError(error) { - if (workInProgressRootExitStatus !== RootSuspendedWithDelay) { - workInProgressRootExitStatus = RootErrored; - } - - if (workInProgressRootConcurrentErrors === null) { - workInProgressRootConcurrentErrors = [error]; - } else { - workInProgressRootConcurrentErrors.push(error); - } - } // Called during render to determine if anything has suspended. - // Returns false if we're not sure. - - function renderHasNotSuspendedYet() { - // If something errored or completed, we can't really be sure, - // so those are false. - return workInProgressRootExitStatus === RootInProgress; - } - - function renderRootSync(root, lanes) { - var prevExecutionContext = executionContext; - executionContext |= RenderContext; - var prevDispatcher = pushDispatcher(); // If the root or lanes have changed, throw out the existing stack - // and prepare a fresh one. Otherwise we'll continue where we left off. - - if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) { - { - if (isDevToolsPresent) { - var memoizedUpdaters = root.memoizedUpdaters; - - if (memoizedUpdaters.size > 0) { - restorePendingUpdaters(root, workInProgressRootRenderLanes); - memoizedUpdaters.clear(); - } // At this point, move Fibers that scheduled the upcoming work from the Map to the Set. - // If we bailout on this work, we'll move them back (like above). - // It's important to move them now in case the work spawns more work at the same priority with Different updaters. - // That way we can keep the current update and future updates separate. - - - movePendingFibersToMemoized(root, lanes); - } - } - - workInProgressTransitions = getTransitionsForLanes(); - prepareFreshStack(root, lanes); - } - - { - markRenderStarted(lanes); - } - - do { - try { - workLoopSync(); - break; - } catch (thrownValue) { - handleError(root, thrownValue); - } - } while (true); - - resetContextDependencies(); - executionContext = prevExecutionContext; - popDispatcher(prevDispatcher); - - if (workInProgress !== null) { - // This is a sync render, so we should have finished the whole tree. - throw new Error('Cannot commit an incomplete root. This error is likely caused by a ' + 'bug in React. Please file an issue.'); - } - - { - markRenderStopped(); - } // Set this to null to indicate there's no in-progress render. - - - workInProgressRoot = null; - workInProgressRootRenderLanes = NoLanes; - return workInProgressRootExitStatus; - } // The work loop is an extremely hot path. Tell Closure not to inline it. - - /** @noinline */ - - - function workLoopSync() { - // Already timed out, so perform work without checking if we need to yield. - while (workInProgress !== null) { - performUnitOfWork(workInProgress); - } - } - - function renderRootConcurrent(root, lanes) { - var prevExecutionContext = executionContext; - executionContext |= RenderContext; - var prevDispatcher = pushDispatcher(); // If the root or lanes have changed, throw out the existing stack - // and prepare a fresh one. Otherwise we'll continue where we left off. - - if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) { - { - if (isDevToolsPresent) { - var memoizedUpdaters = root.memoizedUpdaters; - - if (memoizedUpdaters.size > 0) { - restorePendingUpdaters(root, workInProgressRootRenderLanes); - memoizedUpdaters.clear(); - } // At this point, move Fibers that scheduled the upcoming work from the Map to the Set. - // If we bailout on this work, we'll move them back (like above). - // It's important to move them now in case the work spawns more work at the same priority with Different updaters. - // That way we can keep the current update and future updates separate. - - - movePendingFibersToMemoized(root, lanes); - } - } - - workInProgressTransitions = getTransitionsForLanes(); - resetRenderTimer(); - prepareFreshStack(root, lanes); - } - - { - markRenderStarted(lanes); - } - - do { - try { - workLoopConcurrent(); - break; - } catch (thrownValue) { - handleError(root, thrownValue); - } - } while (true); - - resetContextDependencies(); - popDispatcher(prevDispatcher); - executionContext = prevExecutionContext; - - - if (workInProgress !== null) { - // Still work remaining. - { - markRenderYielded(); - } - - return RootInProgress; - } else { - // Completed the tree. - { - markRenderStopped(); - } // Set this to null to indicate there's no in-progress render. - - - workInProgressRoot = null; - workInProgressRootRenderLanes = NoLanes; // Return the final exit status. - - return workInProgressRootExitStatus; - } - } - /** @noinline */ - - - function workLoopConcurrent() { - // Perform work until Scheduler asks us to yield - while (workInProgress !== null && !shouldYield()) { - performUnitOfWork(workInProgress); - } - } - - function performUnitOfWork(unitOfWork) { - // The current, flushed, state of this fiber is the alternate. Ideally - // nothing should rely on this, but relying on it here means that we don't - // need an additional field on the work in progress. - var current = unitOfWork.alternate; - setCurrentFiber(unitOfWork); - var next; - - if ( (unitOfWork.mode & ProfileMode) !== NoMode) { - startProfilerTimer(unitOfWork); - next = beginWork$1(current, unitOfWork, subtreeRenderLanes); - stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, true); - } else { - next = beginWork$1(current, unitOfWork, subtreeRenderLanes); - } - - resetCurrentFiber(); - unitOfWork.memoizedProps = unitOfWork.pendingProps; - - if (next === null) { - // If this doesn't spawn new work, complete the current work. - completeUnitOfWork(unitOfWork); - } else { - workInProgress = next; - } - - ReactCurrentOwner$2.current = null; - } - - function completeUnitOfWork(unitOfWork) { - // Attempt to complete the current unit of work, then move to the next - // sibling. If there are no more siblings, return to the parent fiber. - var completedWork = unitOfWork; - - do { - // The current, flushed, state of this fiber is the alternate. Ideally - // nothing should rely on this, but relying on it here means that we don't - // need an additional field on the work in progress. - var current = completedWork.alternate; - var returnFiber = completedWork.return; // Check if the work completed or if something threw. - - if ((completedWork.flags & Incomplete) === NoFlags) { - setCurrentFiber(completedWork); - var next = void 0; - - if ( (completedWork.mode & ProfileMode) === NoMode) { - next = completeWork(current, completedWork, subtreeRenderLanes); - } else { - startProfilerTimer(completedWork); - next = completeWork(current, completedWork, subtreeRenderLanes); // Update render duration assuming we didn't error. - - stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); - } - - resetCurrentFiber(); - - if (next !== null) { - // Completing this fiber spawned new work. Work on that next. - workInProgress = next; - return; - } - } else { - // This fiber did not complete because something threw. Pop values off - // the stack without entering the complete phase. If this is a boundary, - // capture values if possible. - var _next = unwindWork(current, completedWork); // Because this fiber did not complete, don't reset its lanes. - - - if (_next !== null) { - // If completing this work spawned new work, do that next. We'll come - // back here again. - // Since we're restarting, remove anything that is not a host effect - // from the effect tag. - _next.flags &= HostEffectMask; - workInProgress = _next; - return; - } - - if ( (completedWork.mode & ProfileMode) !== NoMode) { - // Record the render duration for the fiber that errored. - stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); // Include the time spent working on failed children before continuing. - - var actualDuration = completedWork.actualDuration; - var child = completedWork.child; - - while (child !== null) { - actualDuration += child.actualDuration; - child = child.sibling; - } - - completedWork.actualDuration = actualDuration; - } - - if (returnFiber !== null) { - // Mark the parent fiber as incomplete and clear its subtree flags. - returnFiber.flags |= Incomplete; - returnFiber.subtreeFlags = NoFlags; - returnFiber.deletions = null; - } else { - // We've unwound all the way to the root. - workInProgressRootExitStatus = RootDidNotComplete; - workInProgress = null; - return; - } - } - - var siblingFiber = completedWork.sibling; - - if (siblingFiber !== null) { - // If there is more work to do in this returnFiber, do that next. - workInProgress = siblingFiber; - return; - } // Otherwise, return to the parent - - - completedWork = returnFiber; // Update the next thing we're working on in case something throws. - - workInProgress = completedWork; - } while (completedWork !== null); // We've reached the root. - - - if (workInProgressRootExitStatus === RootInProgress) { - workInProgressRootExitStatus = RootCompleted; - } - } - - function commitRoot(root, recoverableErrors, transitions) { - // TODO: This no longer makes any sense. We already wrap the mutation and - // layout phases. Should be able to remove. - var previousUpdateLanePriority = getCurrentUpdatePriority(); - var prevTransition = ReactCurrentBatchConfig$3.transition; - - try { - ReactCurrentBatchConfig$3.transition = null; - setCurrentUpdatePriority(DiscreteEventPriority); - commitRootImpl(root, recoverableErrors, transitions, previousUpdateLanePriority); - } finally { - ReactCurrentBatchConfig$3.transition = prevTransition; - setCurrentUpdatePriority(previousUpdateLanePriority); - } - - return null; - } - - function commitRootImpl(root, recoverableErrors, transitions, renderPriorityLevel) { - do { - // `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which - // means `flushPassiveEffects` will sometimes result in additional - // passive effects. So we need to keep flushing in a loop until there are - // no more pending effects. - // TODO: Might be better if `flushPassiveEffects` did not automatically - // flush synchronous work at the end, to avoid factoring hazards like this. - flushPassiveEffects(); - } while (rootWithPendingPassiveEffects !== null); - - flushRenderPhaseStrictModeWarningsInDEV(); - - if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { - throw new Error('Should not already be working.'); - } - - var finishedWork = root.finishedWork; - var lanes = root.finishedLanes; - - { - markCommitStarted(lanes); - } - - if (finishedWork === null) { - - { - markCommitStopped(); - } - - return null; - } else { - { - if (lanes === NoLanes) { - error('root.finishedLanes should not be empty during a commit. This is a ' + 'bug in React.'); - } - } - } - - root.finishedWork = null; - root.finishedLanes = NoLanes; - - if (finishedWork === root.current) { - throw new Error('Cannot commit the same tree as before. This error is likely caused by ' + 'a bug in React. Please file an issue.'); - } // commitRoot never returns a continuation; it always finishes synchronously. - // So we can clear these now to allow a new callback to be scheduled. - - - root.callbackNode = null; - root.callbackPriority = NoLane; // Update the first and last pending times on this root. The new first - // pending time is whatever is left on the root fiber. - - var remainingLanes = mergeLanes(finishedWork.lanes, finishedWork.childLanes); - markRootFinished(root, remainingLanes); - - if (root === workInProgressRoot) { - // We can reset these now that they are finished. - workInProgressRoot = null; - workInProgress = null; - workInProgressRootRenderLanes = NoLanes; - } // If there are pending passive effects, schedule a callback to process them. - // Do this as early as possible, so it is queued before anything else that - // might get scheduled in the commit phase. (See #16714.) - // TODO: Delete all other places that schedule the passive effect callback - // They're redundant. - - - if ((finishedWork.subtreeFlags & PassiveMask) !== NoFlags || (finishedWork.flags & PassiveMask) !== NoFlags) { - if (!rootDoesHavePassiveEffects) { - rootDoesHavePassiveEffects = true; - // to store it in pendingPassiveTransitions until they get processed - // We need to pass this through as an argument to commitRoot - // because workInProgressTransitions might have changed between - // the previous render and commit if we throttle the commit - // with setTimeout - - pendingPassiveTransitions = transitions; - scheduleCallback$1(NormalPriority, function () { - flushPassiveEffects(); // This render triggered passive effects: release the root cache pool - // *after* passive effects fire to avoid freeing a cache pool that may - // be referenced by a node in the tree (HostRoot, Cache boundary etc) - - return null; - }); - } - } // Check if there are any effects in the whole tree. - // TODO: This is left over from the effect list implementation, where we had - // to check for the existence of `firstEffect` to satisfy Flow. I think the - // only other reason this optimization exists is because it affects profiling. - // Reconsider whether this is necessary. - - - var subtreeHasEffects = (finishedWork.subtreeFlags & (BeforeMutationMask | MutationMask | LayoutMask | PassiveMask)) !== NoFlags; - var rootHasEffect = (finishedWork.flags & (BeforeMutationMask | MutationMask | LayoutMask | PassiveMask)) !== NoFlags; - - if (subtreeHasEffects || rootHasEffect) { - var prevTransition = ReactCurrentBatchConfig$3.transition; - ReactCurrentBatchConfig$3.transition = null; - var previousPriority = getCurrentUpdatePriority(); - setCurrentUpdatePriority(DiscreteEventPriority); - var prevExecutionContext = executionContext; - executionContext |= CommitContext; // Reset this to null before calling lifecycles - - ReactCurrentOwner$2.current = null; // The commit phase is broken into several sub-phases. We do a separate pass - // of the effect list for each phase: all mutation effects come before all - // layout effects, and so on. - // The first phase a "before mutation" phase. We use this phase to read the - // state of the host tree right before we mutate it. This is where - // getSnapshotBeforeUpdate is called. - - var shouldFireAfterActiveInstanceBlur = commitBeforeMutationEffects(root, finishedWork); - - { - // Mark the current commit time to be shared by all Profilers in this - // batch. This enables them to be grouped later. - recordCommitTime(); - } - - - commitMutationEffects(root, finishedWork, lanes); - - resetAfterCommit(root.containerInfo); // The work-in-progress tree is now the current tree. This must come after - // the mutation phase, so that the previous tree is still current during - // componentWillUnmount, but before the layout phase, so that the finished - // work is current during componentDidMount/Update. - - root.current = finishedWork; // The next phase is the layout phase, where we call effects that read - - { - markLayoutEffectsStarted(lanes); - } - - commitLayoutEffects(finishedWork, root, lanes); - - { - markLayoutEffectsStopped(); - } - // opportunity to paint. - - - requestPaint(); - executionContext = prevExecutionContext; // Reset the priority to the previous non-sync value. - - setCurrentUpdatePriority(previousPriority); - ReactCurrentBatchConfig$3.transition = prevTransition; - } else { - // No effects. - root.current = finishedWork; // Measure these anyway so the flamegraph explicitly shows that there were - // no effects. - // TODO: Maybe there's a better way to report this. - - { - recordCommitTime(); - } - } - - var rootDidHavePassiveEffects = rootDoesHavePassiveEffects; - - if (rootDoesHavePassiveEffects) { - // This commit has passive effects. Stash a reference to them. But don't - // schedule a callback until after flushing layout work. - rootDoesHavePassiveEffects = false; - rootWithPendingPassiveEffects = root; - pendingPassiveEffectsLanes = lanes; - } else { - - { - nestedPassiveUpdateCount = 0; - rootWithPassiveNestedUpdates = null; - } - } // Read this again, since an effect might have updated it - - - remainingLanes = root.pendingLanes; // Check if there's remaining work on this root - // TODO: This is part of the `componentDidCatch` implementation. Its purpose - // is to detect whether something might have called setState inside - // `componentDidCatch`. The mechanism is known to be flawed because `setState` - // inside `componentDidCatch` is itself flawed — that's why we recommend - // `getDerivedStateFromError` instead. However, it could be improved by - // checking if remainingLanes includes Sync work, instead of whether there's - // any work remaining at all (which would also include stuff like Suspense - // retries or transitions). It's been like this for a while, though, so fixing - // it probably isn't that urgent. - - if (remainingLanes === NoLanes) { - // If there's no remaining work, we can clear the set of already failed - // error boundaries. - legacyErrorBoundariesThatAlreadyFailed = null; - } - - { - if (!rootDidHavePassiveEffects) { - commitDoubleInvokeEffectsInDEV(root.current, false); - } - } - - onCommitRoot(finishedWork.stateNode, renderPriorityLevel); - - { - if (isDevToolsPresent) { - root.memoizedUpdaters.clear(); - } - } - - { - onCommitRoot$1(); - } // Always call this before exiting `commitRoot`, to ensure that any - // additional work on this root is scheduled. - - - ensureRootIsScheduled(root, now()); - - if (recoverableErrors !== null) { - // There were errors during this render, but recovered from them without - // needing to surface it to the UI. We log them here. - var onRecoverableError = root.onRecoverableError; - - for (var i = 0; i < recoverableErrors.length; i++) { - var recoverableError = recoverableErrors[i]; - var componentStack = recoverableError.stack; - var digest = recoverableError.digest; - onRecoverableError(recoverableError.value, { - componentStack: componentStack, - digest: digest - }); - } - } - - if (hasUncaughtError) { - hasUncaughtError = false; - var error$1 = firstUncaughtError; - firstUncaughtError = null; - throw error$1; - } // If the passive effects are the result of a discrete render, flush them - // synchronously at the end of the current task so that the result is - // immediately observable. Otherwise, we assume that they are not - // order-dependent and do not need to be observed by external systems, so we - // can wait until after paint. - // TODO: We can optimize this by not scheduling the callback earlier. Since we - // currently schedule the callback in multiple places, will wait until those - // are consolidated. - - - if (includesSomeLane(pendingPassiveEffectsLanes, SyncLane) && root.tag !== LegacyRoot) { - flushPassiveEffects(); - } // Read this again, since a passive effect might have updated it - - - remainingLanes = root.pendingLanes; - - if (includesSomeLane(remainingLanes, SyncLane)) { - { - markNestedUpdateScheduled(); - } // Count the number of times the root synchronously re-renders without - // finishing. If there are too many, it indicates an infinite update loop. - - - if (root === rootWithNestedUpdates) { - nestedUpdateCount++; - } else { - nestedUpdateCount = 0; - rootWithNestedUpdates = root; - } - } else { - nestedUpdateCount = 0; - } // If layout work was scheduled, flush it now. - - - flushSyncCallbacks(); - - { - markCommitStopped(); - } - - return null; - } - - function flushPassiveEffects() { - // Returns whether passive effects were flushed. - // TODO: Combine this check with the one in flushPassiveEFfectsImpl. We should - // probably just combine the two functions. I believe they were only separate - // in the first place because we used to wrap it with - // `Scheduler.runWithPriority`, which accepts a function. But now we track the - // priority within React itself, so we can mutate the variable directly. - if (rootWithPendingPassiveEffects !== null) { - var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes); - var priority = lowerEventPriority(DefaultEventPriority, renderPriority); - var prevTransition = ReactCurrentBatchConfig$3.transition; - var previousPriority = getCurrentUpdatePriority(); - - try { - ReactCurrentBatchConfig$3.transition = null; - setCurrentUpdatePriority(priority); - return flushPassiveEffectsImpl(); - } finally { - setCurrentUpdatePriority(previousPriority); - ReactCurrentBatchConfig$3.transition = prevTransition; // Once passive effects have run for the tree - giving components a - } - } - - return false; - } - function enqueuePendingPassiveProfilerEffect(fiber) { - { - pendingPassiveProfilerEffects.push(fiber); - - if (!rootDoesHavePassiveEffects) { - rootDoesHavePassiveEffects = true; - scheduleCallback$1(NormalPriority, function () { - flushPassiveEffects(); - return null; - }); - } - } - } - - function flushPassiveEffectsImpl() { - if (rootWithPendingPassiveEffects === null) { - return false; - } // Cache and clear the transitions flag - - - var transitions = pendingPassiveTransitions; - pendingPassiveTransitions = null; - var root = rootWithPendingPassiveEffects; - var lanes = pendingPassiveEffectsLanes; - rootWithPendingPassiveEffects = null; // TODO: This is sometimes out of sync with rootWithPendingPassiveEffects. - // Figure out why and fix it. It's not causing any known issues (probably - // because it's only used for profiling), but it's a refactor hazard. - - pendingPassiveEffectsLanes = NoLanes; - - if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { - throw new Error('Cannot flush passive effects while already rendering.'); - } - - { - isFlushingPassiveEffects = true; - didScheduleUpdateDuringPassiveEffects = false; - } - - { - markPassiveEffectsStarted(lanes); - } - - var prevExecutionContext = executionContext; - executionContext |= CommitContext; - commitPassiveUnmountEffects(root.current); - commitPassiveMountEffects(root, root.current, lanes, transitions); // TODO: Move to commitPassiveMountEffects - - { - var profilerEffects = pendingPassiveProfilerEffects; - pendingPassiveProfilerEffects = []; - - for (var i = 0; i < profilerEffects.length; i++) { - var _fiber = profilerEffects[i]; - commitPassiveEffectDurations(root, _fiber); - } - } - - { - markPassiveEffectsStopped(); - } - - { - commitDoubleInvokeEffectsInDEV(root.current, true); - } - - executionContext = prevExecutionContext; - flushSyncCallbacks(); - - { - // If additional passive effects were scheduled, increment a counter. If this - // exceeds the limit, we'll fire a warning. - if (didScheduleUpdateDuringPassiveEffects) { - if (root === rootWithPassiveNestedUpdates) { - nestedPassiveUpdateCount++; - } else { - nestedPassiveUpdateCount = 0; - rootWithPassiveNestedUpdates = root; - } - } else { - nestedPassiveUpdateCount = 0; - } - - isFlushingPassiveEffects = false; - didScheduleUpdateDuringPassiveEffects = false; - } // TODO: Move to commitPassiveMountEffects - - - onPostCommitRoot(root); - - { - var stateNode = root.current.stateNode; - stateNode.effectDuration = 0; - stateNode.passiveEffectDuration = 0; - } - - return true; - } - - function isAlreadyFailedLegacyErrorBoundary(instance) { - return legacyErrorBoundariesThatAlreadyFailed !== null && legacyErrorBoundariesThatAlreadyFailed.has(instance); - } - function markLegacyErrorBoundaryAsFailed(instance) { - if (legacyErrorBoundariesThatAlreadyFailed === null) { - legacyErrorBoundariesThatAlreadyFailed = new Set([instance]); - } else { - legacyErrorBoundariesThatAlreadyFailed.add(instance); - } - } - - function prepareToThrowUncaughtError(error) { - if (!hasUncaughtError) { - hasUncaughtError = true; - firstUncaughtError = error; - } - } - - var onUncaughtError = prepareToThrowUncaughtError; - - function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { - var errorInfo = createCapturedValueAtFiber(error, sourceFiber); - var update = createRootErrorUpdate(rootFiber, errorInfo, SyncLane); - var root = enqueueUpdate(rootFiber, update, SyncLane); - var eventTime = requestEventTime(); - - if (root !== null) { - markRootUpdated(root, SyncLane, eventTime); - ensureRootIsScheduled(root, eventTime); - } - } - - function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error$1) { - { - reportUncaughtErrorInDEV(error$1); - setIsRunningInsertionEffect(false); - } - - if (sourceFiber.tag === HostRoot) { - // Error was thrown at the root. There is no parent, so the root - // itself should capture it. - captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error$1); - return; - } - - var fiber = null; - - { - fiber = nearestMountedAncestor; - } - - while (fiber !== null) { - if (fiber.tag === HostRoot) { - captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error$1); - return; - } else if (fiber.tag === ClassComponent) { - var ctor = fiber.type; - var instance = fiber.stateNode; - - if (typeof ctor.getDerivedStateFromError === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) { - var errorInfo = createCapturedValueAtFiber(error$1, sourceFiber); - var update = createClassErrorUpdate(fiber, errorInfo, SyncLane); - var root = enqueueUpdate(fiber, update, SyncLane); - var eventTime = requestEventTime(); - - if (root !== null) { - markRootUpdated(root, SyncLane, eventTime); - ensureRootIsScheduled(root, eventTime); - } - - return; - } - } - - fiber = fiber.return; - } - - { - // TODO: Until we re-land skipUnmountedBoundaries (see #20147), this warning - // will fire for errors that are thrown by destroy functions inside deleted - // trees. What it should instead do is propagate the error to the parent of - // the deleted tree. In the meantime, do not add this warning to the - // allowlist; this is only for our internal use. - error('Internal React error: Attempted to capture a commit phase error ' + 'inside a detached tree. This indicates a bug in React. Likely ' + 'causes include deleting the same fiber more than once, committing an ' + 'already-finished tree, or an inconsistent return pointer.\n\n' + 'Error message:\n\n%s', error$1); - } - } - function pingSuspendedRoot(root, wakeable, pingedLanes) { - var pingCache = root.pingCache; - - if (pingCache !== null) { - // The wakeable resolved, so we no longer need to memoize, because it will - // never be thrown again. - pingCache.delete(wakeable); - } - - var eventTime = requestEventTime(); - markRootPinged(root, pingedLanes); - warnIfSuspenseResolutionNotWrappedWithActDEV(root); - - if (workInProgressRoot === root && isSubsetOfLanes(workInProgressRootRenderLanes, pingedLanes)) { - // Received a ping at the same priority level at which we're currently - // rendering. We might want to restart this render. This should mirror - // the logic of whether or not a root suspends once it completes. - // TODO: If we're rendering sync either due to Sync, Batched or expired, - // we should probably never restart. - // If we're suspended with delay, or if it's a retry, we'll always suspend - // so we can always restart. - if (workInProgressRootExitStatus === RootSuspendedWithDelay || workInProgressRootExitStatus === RootSuspended && includesOnlyRetries(workInProgressRootRenderLanes) && now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS) { - // Restart from the root. - prepareFreshStack(root, NoLanes); - } else { - // Even though we can't restart right now, we might get an - // opportunity later. So we mark this render as having a ping. - workInProgressRootPingedLanes = mergeLanes(workInProgressRootPingedLanes, pingedLanes); - } - } - - ensureRootIsScheduled(root, eventTime); - } - - function retryTimedOutBoundary(boundaryFiber, retryLane) { - // The boundary fiber (a Suspense component or SuspenseList component) - // previously was rendered in its fallback state. One of the promises that - // suspended it has resolved, which means at least part of the tree was - // likely unblocked. Try rendering again, at a new lanes. - if (retryLane === NoLane) { - // TODO: Assign this to `suspenseState.retryLane`? to avoid - // unnecessary entanglement? - retryLane = requestRetryLane(boundaryFiber); - } // TODO: Special case idle priority? - - - var eventTime = requestEventTime(); - var root = enqueueConcurrentRenderForLane(boundaryFiber, retryLane); - - if (root !== null) { - markRootUpdated(root, retryLane, eventTime); - ensureRootIsScheduled(root, eventTime); - } - } - - function retryDehydratedSuspenseBoundary(boundaryFiber) { - var suspenseState = boundaryFiber.memoizedState; - var retryLane = NoLane; - - if (suspenseState !== null) { - retryLane = suspenseState.retryLane; - } - - retryTimedOutBoundary(boundaryFiber, retryLane); - } - function resolveRetryWakeable(boundaryFiber, wakeable) { - var retryLane = NoLane; // Default - - var retryCache; - - switch (boundaryFiber.tag) { - case SuspenseComponent: - retryCache = boundaryFiber.stateNode; - var suspenseState = boundaryFiber.memoizedState; - - if (suspenseState !== null) { - retryLane = suspenseState.retryLane; - } - - break; - - case SuspenseListComponent: - retryCache = boundaryFiber.stateNode; - break; - - default: - throw new Error('Pinged unknown suspense boundary type. ' + 'This is probably a bug in React.'); - } - - if (retryCache !== null) { - // The wakeable resolved, so we no longer need to memoize, because it will - // never be thrown again. - retryCache.delete(wakeable); - } - - retryTimedOutBoundary(boundaryFiber, retryLane); - } // Computes the next Just Noticeable Difference (JND) boundary. - // The theory is that a person can't tell the difference between small differences in time. - // Therefore, if we wait a bit longer than necessary that won't translate to a noticeable - // difference in the experience. However, waiting for longer might mean that we can avoid - // showing an intermediate loading state. The longer we have already waited, the harder it - // is to tell small differences in time. Therefore, the longer we've already waited, - // the longer we can wait additionally. At some point we have to give up though. - // We pick a train model where the next boundary commits at a consistent schedule. - // These particular numbers are vague estimates. We expect to adjust them based on research. - - function jnd(timeElapsed) { - return timeElapsed < 120 ? 120 : timeElapsed < 480 ? 480 : timeElapsed < 1080 ? 1080 : timeElapsed < 1920 ? 1920 : timeElapsed < 3000 ? 3000 : timeElapsed < 4320 ? 4320 : ceil(timeElapsed / 1960) * 1960; - } - - function checkForNestedUpdates() { - if (nestedUpdateCount > NESTED_UPDATE_LIMIT) { - nestedUpdateCount = 0; - rootWithNestedUpdates = null; - throw new Error('Maximum update depth exceeded. This can happen when a component ' + 'repeatedly calls setState inside componentWillUpdate or ' + 'componentDidUpdate. React limits the number of nested updates to ' + 'prevent infinite loops.'); - } - - { - if (nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT) { - nestedPassiveUpdateCount = 0; - rootWithPassiveNestedUpdates = null; - - error('Maximum update depth exceeded. This can happen when a component ' + "calls setState inside useEffect, but useEffect either doesn't " + 'have a dependency array, or one of the dependencies changes on ' + 'every render.'); - } - } - } - - function flushRenderPhaseStrictModeWarningsInDEV() { - { - ReactStrictModeWarnings.flushLegacyContextWarning(); - - { - ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings(); - } - } - } - - function commitDoubleInvokeEffectsInDEV(fiber, hasPassiveEffects) { - { - // TODO (StrictEffects) Should we set a marker on the root if it contains strict effects - // so we don't traverse unnecessarily? similar to subtreeFlags but just at the root level. - // Maybe not a big deal since this is DEV only behavior. - setCurrentFiber(fiber); - invokeEffectsInDev(fiber, MountLayoutDev, invokeLayoutEffectUnmountInDEV); - - if (hasPassiveEffects) { - invokeEffectsInDev(fiber, MountPassiveDev, invokePassiveEffectUnmountInDEV); - } - - invokeEffectsInDev(fiber, MountLayoutDev, invokeLayoutEffectMountInDEV); - - if (hasPassiveEffects) { - invokeEffectsInDev(fiber, MountPassiveDev, invokePassiveEffectMountInDEV); - } - - resetCurrentFiber(); - } - } - - function invokeEffectsInDev(firstChild, fiberFlags, invokeEffectFn) { - { - // We don't need to re-check StrictEffectsMode here. - // This function is only called if that check has already passed. - var current = firstChild; - var subtreeRoot = null; - - while (current !== null) { - var primarySubtreeFlag = current.subtreeFlags & fiberFlags; - - if (current !== subtreeRoot && current.child !== null && primarySubtreeFlag !== NoFlags) { - current = current.child; - } else { - if ((current.flags & fiberFlags) !== NoFlags) { - invokeEffectFn(current); - } - - if (current.sibling !== null) { - current = current.sibling; - } else { - current = subtreeRoot = current.return; - } - } - } - } - } - - var didWarnStateUpdateForNotYetMountedComponent = null; - function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) { - { - if ((executionContext & RenderContext) !== NoContext) { - // We let the other warning about render phase updates deal with this one. - return; - } - - if (!(fiber.mode & ConcurrentMode)) { - return; - } - - var tag = fiber.tag; - - if (tag !== IndeterminateComponent && tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && tag !== ForwardRef && tag !== MemoComponent && tag !== SimpleMemoComponent) { - // Only warn for user-defined components, not internal ones like Suspense. - return; - } // We show the whole stack but dedupe on the top component's name because - // the problematic code almost always lies inside that component. - - - var componentName = getComponentNameFromFiber(fiber) || 'ReactComponent'; - - if (didWarnStateUpdateForNotYetMountedComponent !== null) { - if (didWarnStateUpdateForNotYetMountedComponent.has(componentName)) { - return; - } - - didWarnStateUpdateForNotYetMountedComponent.add(componentName); - } else { - didWarnStateUpdateForNotYetMountedComponent = new Set([componentName]); - } - - var previousFiber = current; - - try { - setCurrentFiber(fiber); - - error("Can't perform a React state update on a component that hasn't mounted yet. " + 'This indicates that you have a side-effect in your render function that ' + 'asynchronously later calls tries to update the component. Move this work to ' + 'useEffect instead.'); - } finally { - if (previousFiber) { - setCurrentFiber(fiber); - } else { - resetCurrentFiber(); - } - } - } - } - var beginWork$1; - - { - var dummyFiber = null; - - beginWork$1 = function (current, unitOfWork, lanes) { - // If a component throws an error, we replay it again in a synchronously - // dispatched event, so that the debugger will treat it as an uncaught - // error See ReactErrorUtils for more information. - // Before entering the begin phase, copy the work-in-progress onto a dummy - // fiber. If beginWork throws, we'll use this to reset the state. - var originalWorkInProgressCopy = assignFiberPropertiesInDEV(dummyFiber, unitOfWork); - - try { - return beginWork(current, unitOfWork, lanes); - } catch (originalError) { - if (didSuspendOrErrorWhileHydratingDEV() || originalError !== null && typeof originalError === 'object' && typeof originalError.then === 'function') { - // Don't replay promises. - // Don't replay errors if we are hydrating and have already suspended or handled an error - throw originalError; - } // Keep this code in sync with handleError; any changes here must have - // corresponding changes there. - - - resetContextDependencies(); - resetHooksAfterThrow(); // Don't reset current debug fiber, since we're about to work on the - // same fiber again. - // Unwind the failed stack frame - - unwindInterruptedWork(current, unitOfWork); // Restore the original properties of the fiber. - - assignFiberPropertiesInDEV(unitOfWork, originalWorkInProgressCopy); - - if ( unitOfWork.mode & ProfileMode) { - // Reset the profiler timer. - startProfilerTimer(unitOfWork); - } // Run beginWork again. - - - invokeGuardedCallback(null, beginWork, null, current, unitOfWork, lanes); - - if (hasCaughtError()) { - var replayError = clearCaughtError(); - - if (typeof replayError === 'object' && replayError !== null && replayError._suppressLogging && typeof originalError === 'object' && originalError !== null && !originalError._suppressLogging) { - // If suppressed, let the flag carry over to the original error which is the one we'll rethrow. - originalError._suppressLogging = true; - } - } // We always throw the original error in case the second render pass is not idempotent. - // This can happen if a memoized function or CommonJS module doesn't throw after first invocation. - - - throw originalError; - } - }; - } - - var didWarnAboutUpdateInRender = false; - var didWarnAboutUpdateInRenderForAnotherComponent; - - { - didWarnAboutUpdateInRenderForAnotherComponent = new Set(); - } - - function warnAboutRenderPhaseUpdatesInDEV(fiber) { - { - if (isRendering && !getIsUpdatingOpaqueValueInRenderPhaseInDEV()) { - switch (fiber.tag) { - case FunctionComponent: - case ForwardRef: - case SimpleMemoComponent: - { - var renderingComponentName = workInProgress && getComponentNameFromFiber(workInProgress) || 'Unknown'; // Dedupe by the rendering component because it's the one that needs to be fixed. - - var dedupeKey = renderingComponentName; - - if (!didWarnAboutUpdateInRenderForAnotherComponent.has(dedupeKey)) { - didWarnAboutUpdateInRenderForAnotherComponent.add(dedupeKey); - var setStateComponentName = getComponentNameFromFiber(fiber) || 'Unknown'; - - error('Cannot update a component (`%s`) while rendering a ' + 'Different component (`%s`). To locate the bad setState() call inside `%s`, ' + 'follow the stack trace as described in https://reactjs.org/link/setstate-in-render', setStateComponentName, renderingComponentName, renderingComponentName); - } - - break; - } - - case ClassComponent: - { - if (!didWarnAboutUpdateInRender) { - error('Cannot update during an existing state transition (such as ' + 'within `render`). Render methods should be a pure ' + 'function of props and state.'); - - didWarnAboutUpdateInRender = true; - } - - break; - } - } - } - } - } - - function restorePendingUpdaters(root, lanes) { - { - if (isDevToolsPresent) { - var memoizedUpdaters = root.memoizedUpdaters; - memoizedUpdaters.forEach(function (schedulingFiber) { - addFiberToLanesMap(root, schedulingFiber, lanes); - }); // This function intentionally does not clear memoized updaters. - // Those may still be relevant to the current commit - // and a future one (e.g. Suspense). - } - } - } - var fakeActCallbackNode = {}; - - function scheduleCallback$1(priorityLevel, callback) { - { - // If we're currently inside an `act` scope, bypass Scheduler and push to - // the `act` queue instead. - var actQueue = ReactCurrentActQueue$1.current; - - if (actQueue !== null) { - actQueue.push(callback); - return fakeActCallbackNode; - } else { - return scheduleCallback(priorityLevel, callback); - } - } - } - - function cancelCallback$1(callbackNode) { - if ( callbackNode === fakeActCallbackNode) { - return; - } // In production, always call Scheduler. This function will be stripped out. - - - return cancelCallback(callbackNode); - } - - function shouldForceFlushFallbacksInDEV() { - // Never force flush in production. This function should get stripped out. - return ReactCurrentActQueue$1.current !== null; - } - - function warnIfUpdatesNotWrappedWithActDEV(fiber) { - { - if (fiber.mode & ConcurrentMode) { - if (!isConcurrentActEnvironment()) { - // Not in an act environment. No need to warn. - return; - } - } else { - // Legacy mode has additional cases where we suppress a warning. - if (!isLegacyActEnvironment()) { - // Not in an act environment. No need to warn. - return; - } - - if (executionContext !== NoContext) { - // Legacy mode doesn't warn if the update is batched, i.e. - // batchedUpdates or flushSync. - return; - } - - if (fiber.tag !== FunctionComponent && fiber.tag !== ForwardRef && fiber.tag !== SimpleMemoComponent) { - // For backwards compatibility with pre-hooks code, legacy mode only - // warns for updates that originate from a hook. - return; - } - } - - if (ReactCurrentActQueue$1.current === null) { - var previousFiber = current; - - try { - setCurrentFiber(fiber); - - error('An update to %s inside a test was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://reactjs.org/link/wrap-tests-with-act', getComponentNameFromFiber(fiber)); - } finally { - if (previousFiber) { - setCurrentFiber(fiber); - } else { - resetCurrentFiber(); - } - } - } - } - } - - function warnIfSuspenseResolutionNotWrappedWithActDEV(root) { - { - if (root.tag !== LegacyRoot && isConcurrentActEnvironment() && ReactCurrentActQueue$1.current === null) { - error('A suspended resource finished loading inside a test, but the event ' + 'was not wrapped in act(...).\n\n' + 'When testing, code that resolves suspended data should be wrapped ' + 'into act(...):\n\n' + 'act(() => {\n' + ' /* finish loading suspended data */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://reactjs.org/link/wrap-tests-with-act'); - } - } - } - - function setIsRunningInsertionEffect(isRunning) { - { - isRunningInsertionEffect = isRunning; - } - } - - /* eslint-disable react-internal/prod-error-codes */ - var resolveFamily = null; // $FlowFixMe Flow gets confused by a WeakSet feature check below. - - var failedBoundaries = null; - var setRefreshHandler = function (handler) { - { - resolveFamily = handler; - } - }; - function resolveFunctionForHotReloading(type) { - { - if (resolveFamily === null) { - // Hot reloading is disabled. - return type; - } - - var family = resolveFamily(type); - - if (family === undefined) { - return type; - } // Use the latest known implementation. - - - return family.current; - } - } - function resolveClassForHotReloading(type) { - // No implementation differences. - return resolveFunctionForHotReloading(type); - } - function resolveForwardRefForHotReloading(type) { - { - if (resolveFamily === null) { - // Hot reloading is disabled. - return type; - } - - var family = resolveFamily(type); - - if (family === undefined) { - // Check if we're dealing with a real forwardRef. Don't want to crash early. - if (type !== null && type !== undefined && typeof type.render === 'function') { - // ForwardRef is special because its resolved .type is an object, - // but it's possible that we only have its inner render function in the map. - // If that inner render function is Different, we'll build a new forwardRef type. - var currentRender = resolveFunctionForHotReloading(type.render); - - if (type.render !== currentRender) { - var syntheticType = { - $$typeof: REACT_FORWARD_REF_TYPE, - render: currentRender - }; - - if (type.displayName !== undefined) { - syntheticType.displayName = type.displayName; - } - - return syntheticType; - } - } - - return type; - } // Use the latest known implementation. - - - return family.current; - } - } - function isCompatibleFamilyForHotReloading(fiber, element) { - { - if (resolveFamily === null) { - // Hot reloading is disabled. - return false; - } - - var prevType = fiber.elementType; - var nextType = element.type; // If we got here, we know types aren't === equal. - - var needsCompareFamilies = false; - var $$typeofNextType = typeof nextType === 'object' && nextType !== null ? nextType.$$typeof : null; - - switch (fiber.tag) { - case ClassComponent: - { - if (typeof nextType === 'function') { - needsCompareFamilies = true; - } - - break; - } - - case FunctionComponent: - { - if (typeof nextType === 'function') { - needsCompareFamilies = true; - } else if ($$typeofNextType === REACT_LAZY_TYPE) { - // We don't know the inner type yet. - // We're going to assume that the lazy inner type is stable, - // and so it is sufficient to avoid reconciling it away. - // We're not going to unwrap or actually use the new lazy type. - needsCompareFamilies = true; - } - - break; - } - - case ForwardRef: - { - if ($$typeofNextType === REACT_FORWARD_REF_TYPE) { - needsCompareFamilies = true; - } else if ($$typeofNextType === REACT_LAZY_TYPE) { - needsCompareFamilies = true; - } - - break; - } - - case MemoComponent: - case SimpleMemoComponent: - { - if ($$typeofNextType === REACT_MEMO_TYPE) { - // TODO: if it was but can no longer be simple, - // we shouldn't set this. - needsCompareFamilies = true; - } else if ($$typeofNextType === REACT_LAZY_TYPE) { - needsCompareFamilies = true; - } - - break; - } - - default: - return false; - } // Check if both types have a family and it's the same one. - - - if (needsCompareFamilies) { - // Note: memo() and forwardRef() we'll compare outer rather than inner type. - // This means both of them need to be registered to preserve state. - // If we unwrapped and compared the inner types for wrappers instead, - // then we would risk falsely saying two separate memo(Foo) - // calls are equivalent because they wrap the same Foo function. - var prevFamily = resolveFamily(prevType); - - if (prevFamily !== undefined && prevFamily === resolveFamily(nextType)) { - return true; - } - } - - return false; - } - } - function markFailedErrorBoundaryForHotReloading(fiber) { - { - if (resolveFamily === null) { - // Hot reloading is disabled. - return; - } - - if (typeof WeakSet !== 'function') { - return; - } - - if (failedBoundaries === null) { - failedBoundaries = new WeakSet(); - } - - failedBoundaries.add(fiber); - } - } - var scheduleRefresh = function (root, update) { - { - if (resolveFamily === null) { - // Hot reloading is disabled. - return; - } - - var staleFamilies = update.staleFamilies, - updatedFamilies = update.updatedFamilies; - flushPassiveEffects(); - flushSync(function () { - scheduleFibersWithFamiliesRecursively(root.current, updatedFamilies, staleFamilies); - }); - } - }; - var scheduleRoot = function (root, element) { - { - if (root.context !== emptyContextObject) { - // Super edge case: root has a legacy _renderSubtree context - // but we don't know the parentComponent so we can't pass it. - // Just ignore. We'll delete this with _renderSubtree code path later. - return; - } - - flushPassiveEffects(); - flushSync(function () { - updateContainer(element, root, null, null); - }); - } - }; - - function scheduleFibersWithFamiliesRecursively(fiber, updatedFamilies, staleFamilies) { - { - var alternate = fiber.alternate, - child = fiber.child, - sibling = fiber.sibling, - tag = fiber.tag, - type = fiber.type; - var candidateType = null; - - switch (tag) { - case FunctionComponent: - case SimpleMemoComponent: - case ClassComponent: - candidateType = type; - break; - - case ForwardRef: - candidateType = type.render; - break; - } - - if (resolveFamily === null) { - throw new Error('Expected resolveFamily to be set during hot reload.'); - } - - var needsRender = false; - var needsRemount = false; - - if (candidateType !== null) { - var family = resolveFamily(candidateType); - - if (family !== undefined) { - if (staleFamilies.has(family)) { - needsRemount = true; - } else if (updatedFamilies.has(family)) { - if (tag === ClassComponent) { - needsRemount = true; - } else { - needsRender = true; - } - } - } - } - - if (failedBoundaries !== null) { - if (failedBoundaries.has(fiber) || alternate !== null && failedBoundaries.has(alternate)) { - needsRemount = true; - } - } - - if (needsRemount) { - fiber._debugNeedsRemount = true; - } - - if (needsRemount || needsRender) { - var _root = enqueueConcurrentRenderForLane(fiber, SyncLane); - - if (_root !== null) { - scheduleUpdateOnFiber(_root, fiber, SyncLane, NoTimestamp); - } - } - - if (child !== null && !needsRemount) { - scheduleFibersWithFamiliesRecursively(child, updatedFamilies, staleFamilies); - } - - if (sibling !== null) { - scheduleFibersWithFamiliesRecursively(sibling, updatedFamilies, staleFamilies); - } - } - } - - var findHostInstancesForRefresh = function (root, families) { - { - var hostInstances = new Set(); - var types = new Set(families.map(function (family) { - return family.current; - })); - findHostInstancesForMatchingFibersRecursively(root.current, types, hostInstances); - return hostInstances; - } - }; - - function findHostInstancesForMatchingFibersRecursively(fiber, types, hostInstances) { - { - var child = fiber.child, - sibling = fiber.sibling, - tag = fiber.tag, - type = fiber.type; - var candidateType = null; - - switch (tag) { - case FunctionComponent: - case SimpleMemoComponent: - case ClassComponent: - candidateType = type; - break; - - case ForwardRef: - candidateType = type.render; - break; - } - - var didMatch = false; - - if (candidateType !== null) { - if (types.has(candidateType)) { - didMatch = true; - } - } - - if (didMatch) { - // We have a match. This only drills down to the closest host components. - // There's no need to search deeper because for the purpose of giving - // visual feedback, "flashing" outermost parent rectangles is sufficient. - findHostInstancesForFiberShallowly(fiber, hostInstances); - } else { - // If there's no match, maybe there will be one further down in the child tree. - if (child !== null) { - findHostInstancesForMatchingFibersRecursively(child, types, hostInstances); - } - } - - if (sibling !== null) { - findHostInstancesForMatchingFibersRecursively(sibling, types, hostInstances); - } - } - } - - function findHostInstancesForFiberShallowly(fiber, hostInstances) { - { - var foundHostInstances = findChildHostInstancesForFiberShallowly(fiber, hostInstances); - - if (foundHostInstances) { - return; - } // If we didn't find any host children, fallback to closest host parent. - - - var node = fiber; - - while (true) { - switch (node.tag) { - case HostComponent: - hostInstances.add(node.stateNode); - return; - - case HostPortal: - hostInstances.add(node.stateNode.containerInfo); - return; - - case HostRoot: - hostInstances.add(node.stateNode.containerInfo); - return; - } - - if (node.return === null) { - throw new Error('Expected to reach root first.'); - } - - node = node.return; - } - } - } - - function findChildHostInstancesForFiberShallowly(fiber, hostInstances) { - { - var node = fiber; - var foundHostInstances = false; - - while (true) { - if (node.tag === HostComponent) { - // We got a match. - foundHostInstances = true; - hostInstances.add(node.stateNode); // There may still be more, so keep searching. - } else if (node.child !== null) { - node.child.return = node; - node = node.child; - continue; - } - - if (node === fiber) { - return foundHostInstances; - } - - while (node.sibling === null) { - if (node.return === null || node.return === fiber) { - return foundHostInstances; - } - - node = node.return; - } - - node.sibling.return = node.return; - node = node.sibling; - } - } - - return false; - } - - var hasBadMapPolyfill; - - { - hasBadMapPolyfill = false; - - try { - var nonExtensibleObject = Object.preventExtensions({}); - /* eslint-disable no-new */ - - new Map([[nonExtensibleObject, null]]); - new Set([nonExtensibleObject]); - /* eslint-enable no-new */ - } catch (e) { - // TODO: Consider warning about bad polyfills - hasBadMapPolyfill = true; - } - } - - function FiberNode(tag, pendingProps, key, mode) { - // Instance - this.tag = tag; - this.key = key; - this.elementType = null; - this.type = null; - this.stateNode = null; // Fiber - - this.return = null; - this.child = null; - this.sibling = null; - this.index = 0; - this.ref = null; - this.pendingProps = pendingProps; - this.memoizedProps = null; - this.updateQueue = null; - this.memoizedState = null; - this.dependencies = null; - this.mode = mode; // Effects - - this.flags = NoFlags; - this.subtreeFlags = NoFlags; - this.deletions = null; - this.lanes = NoLanes; - this.childLanes = NoLanes; - this.alternate = null; - - { - // Note: The following is done to avoid a v8 performance cliff. - // - // Initializing the fields below to smis and later updating them with - // double values will cause Fibers to end up having separate shapes. - // This behavior/bug has something to do with Object.preventExtension(). - // Fortunately this only impacts DEV builds. - // Unfortunately it makes React unusably slow for some applications. - // To work around this, initialize the fields below with doubles. - // - // Learn more about this here: - // https://github.com/facebook/react/issues/14365 - // https://bugs.chromium.org/p/v8/issues/detail?id=8538 - this.actualDuration = Number.NaN; - this.actualStartTime = Number.NaN; - this.selfBaseDuration = Number.NaN; - this.treeBaseDuration = Number.NaN; // It's okay to replace the initial doubles with smis after initialization. - // This won't trigger the performance cliff mentioned above, - // and it simplifies other profiler code (including DevTools). - - this.actualDuration = 0; - this.actualStartTime = -1; - this.selfBaseDuration = 0; - this.treeBaseDuration = 0; - } - - { - // This isn't directly used but is handy for debugging internals: - this._debugSource = null; - this._debugOwner = null; - this._debugNeedsRemount = false; - this._debugHookTypes = null; - - if (!hasBadMapPolyfill && typeof Object.preventExtensions === 'function') { - Object.preventExtensions(this); - } - } - } // This is a constructor function, rather than a POJO constructor, still - // please ensure we do the following: - // 1) Nobody should add any instance methods on this. Instance methods can be - // more difficult to predict when they get optimized and they are almost - // never inlined properly in static compilers. - // 2) Nobody should rely on `instanceof Fiber` for type testing. We should - // always know when it is a fiber. - // 3) We might want to experiment with using numeric keys since they are easier - // to optimize in a non-JIT environment. - // 4) We can easily go from a constructor to a createFiber object literal if that - // is faster. - // 5) It should be easy to port this to a C struct and keep a C implementation - // compatible. - - - var createFiber = function (tag, pendingProps, key, mode) { - // $FlowFixMe: the shapes are exact here but Flow doesn't like constructors - return new FiberNode(tag, pendingProps, key, mode); - }; - - function shouldConstruct$1(Component) { - var prototype = Component.prototype; - return !!(prototype && prototype.isReactComponent); - } - - function isSimpleFunctionComponent(type) { - return typeof type === 'function' && !shouldConstruct$1(type) && type.defaultProps === undefined; - } - function resolveLazyComponentTag(Component) { - if (typeof Component === 'function') { - return shouldConstruct$1(Component) ? ClassComponent : FunctionComponent; - } else if (Component !== undefined && Component !== null) { - var $$typeof = Component.$$typeof; - - if ($$typeof === REACT_FORWARD_REF_TYPE) { - return ForwardRef; - } - - if ($$typeof === REACT_MEMO_TYPE) { - return MemoComponent; - } - } - - return IndeterminateComponent; - } // This is used to create an alternate fiber to do work on. - - function createWorkInProgress(current, pendingProps) { - var workInProgress = current.alternate; - - if (workInProgress === null) { - // We use a double buffering pooling technique because we know that we'll - // only ever need at most two versions of a tree. We pool the "other" unused - // node that we're free to reuse. This is lazily created to avoid allocating - // extra objects for things that are never updated. It also allow us to - // reclaim the extra memory if needed. - workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode); - workInProgress.elementType = current.elementType; - workInProgress.type = current.type; - workInProgress.stateNode = current.stateNode; - - { - // DEV-only fields - workInProgress._debugSource = current._debugSource; - workInProgress._debugOwner = current._debugOwner; - workInProgress._debugHookTypes = current._debugHookTypes; - } - - workInProgress.alternate = current; - current.alternate = workInProgress; - } else { - workInProgress.pendingProps = pendingProps; // Needed because Blocks store data on type. - - workInProgress.type = current.type; // We already have an alternate. - // Reset the effect tag. - - workInProgress.flags = NoFlags; // The effects are no longer valid. - - workInProgress.subtreeFlags = NoFlags; - workInProgress.deletions = null; - - { - // We intentionally reset, rather than copy, actualDuration & actualStartTime. - // This prevents time from endlessly accumulating in new commits. - // This has the downside of resetting values for Different priority renders, - // But works for yielding (the common case) and should support resuming. - workInProgress.actualDuration = 0; - workInProgress.actualStartTime = -1; - } - } // Reset all effects except static ones. - // Static effects are not specific to a render. - - - workInProgress.flags = current.flags & StaticMask; - workInProgress.childLanes = current.childLanes; - workInProgress.lanes = current.lanes; - workInProgress.child = current.child; - workInProgress.memoizedProps = current.memoizedProps; - workInProgress.memoizedState = current.memoizedState; - workInProgress.updateQueue = current.updateQueue; // Clone the dependencies object. This is mutated during the render phase, so - // it cannot be shared with the current fiber. - - var currentDependencies = current.dependencies; - workInProgress.dependencies = currentDependencies === null ? null : { - lanes: currentDependencies.lanes, - firstContext: currentDependencies.firstContext - }; // These will be overridden during the parent's reconciliation - - workInProgress.sibling = current.sibling; - workInProgress.index = current.index; - workInProgress.ref = current.ref; - - { - workInProgress.selfBaseDuration = current.selfBaseDuration; - workInProgress.treeBaseDuration = current.treeBaseDuration; - } - - { - workInProgress._debugNeedsRemount = current._debugNeedsRemount; - - switch (workInProgress.tag) { - case IndeterminateComponent: - case FunctionComponent: - case SimpleMemoComponent: - workInProgress.type = resolveFunctionForHotReloading(current.type); - break; - - case ClassComponent: - workInProgress.type = resolveClassForHotReloading(current.type); - break; - - case ForwardRef: - workInProgress.type = resolveForwardRefForHotReloading(current.type); - break; - } - } - - return workInProgress; - } // Used to reuse a Fiber for a second pass. - - function resetWorkInProgress(workInProgress, renderLanes) { - // This resets the Fiber to what createFiber or createWorkInProgress would - // have set the values to before during the first pass. Ideally this wouldn't - // be necessary but unfortunately many code paths reads from the workInProgress - // when they should be reading from current and writing to workInProgress. - // We assume pendingProps, index, key, ref, return are still untouched to - // avoid doing another reconciliation. - // Reset the effect flags but keep any Placement tags, since that's something - // that child fiber is setting, not the reconciliation. - workInProgress.flags &= StaticMask | Placement; // The effects are no longer valid. - - var current = workInProgress.alternate; - - if (current === null) { - // Reset to createFiber's initial values. - workInProgress.childLanes = NoLanes; - workInProgress.lanes = renderLanes; - workInProgress.child = null; - workInProgress.subtreeFlags = NoFlags; - workInProgress.memoizedProps = null; - workInProgress.memoizedState = null; - workInProgress.updateQueue = null; - workInProgress.dependencies = null; - workInProgress.stateNode = null; - - { - // Note: We don't reset the actualTime counts. It's useful to accumulate - // actual time across multiple render passes. - workInProgress.selfBaseDuration = 0; - workInProgress.treeBaseDuration = 0; - } - } else { - // Reset to the cloned values that createWorkInProgress would've. - workInProgress.childLanes = current.childLanes; - workInProgress.lanes = current.lanes; - workInProgress.child = current.child; - workInProgress.subtreeFlags = NoFlags; - workInProgress.deletions = null; - workInProgress.memoizedProps = current.memoizedProps; - workInProgress.memoizedState = current.memoizedState; - workInProgress.updateQueue = current.updateQueue; // Needed because Blocks store data on type. - - workInProgress.type = current.type; // Clone the dependencies object. This is mutated during the render phase, so - // it cannot be shared with the current fiber. - - var currentDependencies = current.dependencies; - workInProgress.dependencies = currentDependencies === null ? null : { - lanes: currentDependencies.lanes, - firstContext: currentDependencies.firstContext - }; - - { - // Note: We don't reset the actualTime counts. It's useful to accumulate - // actual time across multiple render passes. - workInProgress.selfBaseDuration = current.selfBaseDuration; - workInProgress.treeBaseDuration = current.treeBaseDuration; - } - } - - return workInProgress; - } - function createHostRootFiber(tag, isStrictMode, concurrentUpdatesByDefaultOverride) { - var mode; - - if (tag === ConcurrentRoot) { - mode = ConcurrentMode; - - if (isStrictMode === true) { - mode |= StrictLegacyMode; - - { - mode |= StrictEffectsMode; - } - } - } else { - mode = NoMode; - } - - if ( isDevToolsPresent) { - // Always collect profile timings when DevTools are present. - // This enables DevTools to start capturing timing at any point– - // Without some nodes in the tree having empty base times. - mode |= ProfileMode; - } - - return createFiber(HostRoot, null, null, mode); - } - function createFiberFromTypeAndProps(type, // React$ElementType - key, pendingProps, owner, mode, lanes) { - var fiberTag = IndeterminateComponent; // The resolved type is set if we know what the final type will be. I.e. it's not lazy. - - var resolvedType = type; - - if (typeof type === 'function') { - if (shouldConstruct$1(type)) { - fiberTag = ClassComponent; - - { - resolvedType = resolveClassForHotReloading(resolvedType); - } - } else { - { - resolvedType = resolveFunctionForHotReloading(resolvedType); - } - } - } else if (typeof type === 'string') { - fiberTag = HostComponent; - } else { - getTag: switch (type) { - case REACT_FRAGMENT_TYPE: - return createFiberFromFragment(pendingProps.children, mode, lanes, key); - - case REACT_STRICT_MODE_TYPE: - fiberTag = Mode; - mode |= StrictLegacyMode; - - if ( (mode & ConcurrentMode) !== NoMode) { - // Strict effects should never run on legacy roots - mode |= StrictEffectsMode; - } - - break; - - case REACT_PROFILER_TYPE: - return createFiberFromProfiler(pendingProps, mode, lanes, key); - - case REACT_SUSPENSE_TYPE: - return createFiberFromSuspense(pendingProps, mode, lanes, key); - - case REACT_SUSPENSE_LIST_TYPE: - return createFiberFromSuspenseList(pendingProps, mode, lanes, key); - - case REACT_OFFSCREEN_TYPE: - return createFiberFromOffscreen(pendingProps, mode, lanes, key); - - case REACT_LEGACY_HIDDEN_TYPE: - - // eslint-disable-next-line no-fallthrough - - case REACT_SCOPE_TYPE: - - // eslint-disable-next-line no-fallthrough - - case REACT_CACHE_TYPE: - - // eslint-disable-next-line no-fallthrough - - case REACT_TRACING_MARKER_TYPE: - - // eslint-disable-next-line no-fallthrough - - case REACT_DEBUG_TRACING_MODE_TYPE: - - // eslint-disable-next-line no-fallthrough - - default: - { - if (typeof type === 'object' && type !== null) { - switch (type.$$typeof) { - case REACT_PROVIDER_TYPE: - fiberTag = ContextProvider; - break getTag; - - case REACT_CONTEXT_TYPE: - // This is a consumer - fiberTag = ContextConsumer; - break getTag; - - case REACT_FORWARD_REF_TYPE: - fiberTag = ForwardRef; - - { - resolvedType = resolveForwardRefForHotReloading(resolvedType); - } - - break getTag; - - case REACT_MEMO_TYPE: - fiberTag = MemoComponent; - break getTag; - - case REACT_LAZY_TYPE: - fiberTag = LazyComponent; - resolvedType = null; - break getTag; - } - } - - var info = ''; - - { - if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { - info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and " + 'named imports.'; - } - - var ownerName = owner ? getComponentNameFromFiber(owner) : null; - - if (ownerName) { - info += '\n\nCheck the render method of `' + ownerName + '`.'; - } - } - - throw new Error('Element type is invalid: expected a string (for built-in ' + 'components) or a class/function (for composite components) ' + ("but got: " + (type == null ? type : typeof type) + "." + info)); - } - } - } - - var fiber = createFiber(fiberTag, pendingProps, key, mode); - fiber.elementType = type; - fiber.type = resolvedType; - fiber.lanes = lanes; - - { - fiber._debugOwner = owner; - } - - return fiber; - } - function createFiberFromElement(element, mode, lanes) { - var owner = null; - - { - owner = element._owner; - } - - var type = element.type; - var key = element.key; - var pendingProps = element.props; - var fiber = createFiberFromTypeAndProps(type, key, pendingProps, owner, mode, lanes); - - { - fiber._debugSource = element._source; - fiber._debugOwner = element._owner; - } - - return fiber; - } - function createFiberFromFragment(elements, mode, lanes, key) { - var fiber = createFiber(Fragment, elements, key, mode); - fiber.lanes = lanes; - return fiber; - } - - function createFiberFromProfiler(pendingProps, mode, lanes, key) { - { - if (typeof pendingProps.id !== 'string') { - error('Profiler must specify an "id" of type `string` as a prop. Received the type `%s` instead.', typeof pendingProps.id); - } - } - - var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode); - fiber.elementType = REACT_PROFILER_TYPE; - fiber.lanes = lanes; - - { - fiber.stateNode = { - effectDuration: 0, - passiveEffectDuration: 0 - }; - } - - return fiber; - } - - function createFiberFromSuspense(pendingProps, mode, lanes, key) { - var fiber = createFiber(SuspenseComponent, pendingProps, key, mode); - fiber.elementType = REACT_SUSPENSE_TYPE; - fiber.lanes = lanes; - return fiber; - } - function createFiberFromSuspenseList(pendingProps, mode, lanes, key) { - var fiber = createFiber(SuspenseListComponent, pendingProps, key, mode); - fiber.elementType = REACT_SUSPENSE_LIST_TYPE; - fiber.lanes = lanes; - return fiber; - } - function createFiberFromOffscreen(pendingProps, mode, lanes, key) { - var fiber = createFiber(OffscreenComponent, pendingProps, key, mode); - fiber.elementType = REACT_OFFSCREEN_TYPE; - fiber.lanes = lanes; - var primaryChildInstance = { - isHidden: false - }; - fiber.stateNode = primaryChildInstance; - return fiber; - } - function createFiberFromText(content, mode, lanes) { - var fiber = createFiber(HostText, content, null, mode); - fiber.lanes = lanes; - return fiber; - } - function createFiberFromHostInstanceForDeletion() { - var fiber = createFiber(HostComponent, null, null, NoMode); - fiber.elementType = 'DELETED'; - return fiber; - } - function createFiberFromDehydratedFragment(dehydratedNode) { - var fiber = createFiber(DehydratedFragment, null, null, NoMode); - fiber.stateNode = dehydratedNode; - return fiber; - } - function createFiberFromPortal(portal, mode, lanes) { - var pendingProps = portal.children !== null ? portal.children : []; - var fiber = createFiber(HostPortal, pendingProps, portal.key, mode); - fiber.lanes = lanes; - fiber.stateNode = { - containerInfo: portal.containerInfo, - pendingChildren: null, - // Used by persistent updates - implementation: portal.implementation - }; - return fiber; - } // Used for stashing WIP properties to replay failed work in DEV. - - function assignFiberPropertiesInDEV(target, source) { - if (target === null) { - // This Fiber's initial properties will always be overwritten. - // We only use a Fiber to ensure the same hidden class so DEV isn't slow. - target = createFiber(IndeterminateComponent, null, null, NoMode); - } // This is intentionally written as a list of all properties. - // We tried to use Object.assign() instead but this is called in - // the hottest path, and Object.assign() was too slow: - // https://github.com/facebook/react/issues/12502 - // This code is DEV-only so size is not a concern. - - - target.tag = source.tag; - target.key = source.key; - target.elementType = source.elementType; - target.type = source.type; - target.stateNode = source.stateNode; - target.return = source.return; - target.child = source.child; - target.sibling = source.sibling; - target.index = source.index; - target.ref = source.ref; - target.pendingProps = source.pendingProps; - target.memoizedProps = source.memoizedProps; - target.updateQueue = source.updateQueue; - target.memoizedState = source.memoizedState; - target.dependencies = source.dependencies; - target.mode = source.mode; - target.flags = source.flags; - target.subtreeFlags = source.subtreeFlags; - target.deletions = source.deletions; - target.lanes = source.lanes; - target.childLanes = source.childLanes; - target.alternate = source.alternate; - - { - target.actualDuration = source.actualDuration; - target.actualStartTime = source.actualStartTime; - target.selfBaseDuration = source.selfBaseDuration; - target.treeBaseDuration = source.treeBaseDuration; - } - - target._debugSource = source._debugSource; - target._debugOwner = source._debugOwner; - target._debugNeedsRemount = source._debugNeedsRemount; - target._debugHookTypes = source._debugHookTypes; - return target; - } - - function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix, onRecoverableError) { - this.tag = tag; - this.containerInfo = containerInfo; - this.pendingChildren = null; - this.current = null; - this.pingCache = null; - this.finishedWork = null; - this.timeoutHandle = noTimeout; - this.context = null; - this.pendingContext = null; - this.callbackNode = null; - this.callbackPriority = NoLane; - this.eventTimes = createLaneMap(NoLanes); - this.expirationTimes = createLaneMap(NoTimestamp); - this.pendingLanes = NoLanes; - this.suspendedLanes = NoLanes; - this.pingedLanes = NoLanes; - this.expiredLanes = NoLanes; - this.mutableReadLanes = NoLanes; - this.finishedLanes = NoLanes; - this.entangledLanes = NoLanes; - this.entanglements = createLaneMap(NoLanes); - this.identifierPrefix = identifierPrefix; - this.onRecoverableError = onRecoverableError; - - { - this.mutableSourceEagerHydrationData = null; - } - - { - this.effectDuration = 0; - this.passiveEffectDuration = 0; - } - - { - this.memoizedUpdaters = new Set(); - var pendingUpdatersLaneMap = this.pendingUpdatersLaneMap = []; - - for (var _i = 0; _i < TotalLanes; _i++) { - pendingUpdatersLaneMap.push(new Set()); - } - } - - { - switch (tag) { - case ConcurrentRoot: - this._debugRootType = hydrate ? 'hydrateRoot()' : 'createRoot()'; - break; - - case LegacyRoot: - this._debugRootType = hydrate ? 'hydrate()' : 'render()'; - break; - } - } - } - - function createFiberRoot(containerInfo, tag, hydrate, initialChildren, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, // TODO: We have several of these arguments that are conceptually part of the - // host config, but because they are passed in at runtime, we have to thread - // them through the root constructor. Perhaps we should put them all into a - // single type, like a DynamicHostConfig that is defined by the renderer. - identifierPrefix, onRecoverableError, transitionCallbacks) { - var root = new FiberRootNode(containerInfo, tag, hydrate, identifierPrefix, onRecoverableError); - // stateNode is any. - - - var uninitializedFiber = createHostRootFiber(tag, isStrictMode); - root.current = uninitializedFiber; - uninitializedFiber.stateNode = root; - - { - var _initialState = { - element: initialChildren, - isDehydrated: hydrate, - cache: null, - // not enabled yet - transitions: null, - pendingSuspenseBoundaries: null - }; - uninitializedFiber.memoizedState = _initialState; - } - - initializeUpdateQueue(uninitializedFiber); - return root; - } - - var ReactVersion = '18.3.1'; - - function createPortal(children, containerInfo, // TODO: figure out the API for cross-renderer implementation. - implementation) { - var key = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; - - { - checkKeyStringCoercion(key); - } - - return { - // This tag allow us to uniquely identify this as a React Portal - $$typeof: REACT_PORTAL_TYPE, - key: key == null ? null : '' + key, - children: children, - containerInfo: containerInfo, - implementation: implementation - }; - } - - var didWarnAboutNestedUpdates; - var didWarnAboutFindNodeInStrictMode; - - { - didWarnAboutNestedUpdates = false; - didWarnAboutFindNodeInStrictMode = {}; - } - - function getContextForSubtree(parentComponent) { - if (!parentComponent) { - return emptyContextObject; - } - - var fiber = get(parentComponent); - var parentContext = findCurrentUnmaskedContext(fiber); - - if (fiber.tag === ClassComponent) { - var Component = fiber.type; - - if (isContextProvider(Component)) { - return processChildContext(fiber, Component, parentContext); - } - } - - return parentContext; - } - - function findHostInstanceWithWarning(component, methodName) { - { - var fiber = get(component); - - if (fiber === undefined) { - if (typeof component.render === 'function') { - throw new Error('Unable to find node on an unmounted component.'); - } else { - var keys = Object.keys(component).join(','); - throw new Error("Argument appears to not be a ReactComponent. Keys: " + keys); - } - } - - var hostFiber = findCurrentHostFiber(fiber); - - if (hostFiber === null) { - return null; - } - - if (hostFiber.mode & StrictLegacyMode) { - var componentName = getComponentNameFromFiber(fiber) || 'Component'; - - if (!didWarnAboutFindNodeInStrictMode[componentName]) { - didWarnAboutFindNodeInStrictMode[componentName] = true; - var previousFiber = current; - - try { - setCurrentFiber(hostFiber); - - if (fiber.mode & StrictLegacyMode) { - error('%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which is inside StrictMode. ' + 'Instead, add a ref directly to the element you want to reference. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-find-node', methodName, methodName, componentName); - } else { - error('%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which renders StrictMode children. ' + 'Instead, add a ref directly to the element you want to reference. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-find-node', methodName, methodName, componentName); - } - } finally { - // Ideally this should reset to previous but this shouldn't be called in - // render and there's another warning for that anyway. - if (previousFiber) { - setCurrentFiber(previousFiber); - } else { - resetCurrentFiber(); - } - } - } - } - - return hostFiber.stateNode; - } - } - - function createContainer(containerInfo, tag, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError, transitionCallbacks) { - var hydrate = false; - var initialChildren = null; - return createFiberRoot(containerInfo, tag, hydrate, initialChildren, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError); - } - function createHydrationContainer(initialChildren, // TODO: Remove `callback` when we delete legacy mode. - callback, containerInfo, tag, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError, transitionCallbacks) { - var hydrate = true; - var root = createFiberRoot(containerInfo, tag, hydrate, initialChildren, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError); // TODO: Move this to FiberRoot constructor - - root.context = getContextForSubtree(null); // Schedule the initial render. In a hydration root, this is Different from - // a regular update because the initial render must match was was rendered - // on the server. - // NOTE: This update intentionally doesn't have a payload. We're only using - // the update to schedule work on the root fiber (and, for legacy roots, to - // enqueue the callback if one is provided). - - var current = root.current; - var eventTime = requestEventTime(); - var lane = requestUpdateLane(current); - var update = createUpdate(eventTime, lane); - update.callback = callback !== undefined && callback !== null ? callback : null; - enqueueUpdate(current, update, lane); - scheduleInitialHydrationOnRoot(root, lane, eventTime); - return root; - } - function updateContainer(element, container, parentComponent, callback) { - { - onScheduleRoot(container, element); - } - - var current$1 = container.current; - var eventTime = requestEventTime(); - var lane = requestUpdateLane(current$1); - - { - markRenderScheduled(lane); - } - - var context = getContextForSubtree(parentComponent); - - if (container.context === null) { - container.context = context; - } else { - container.pendingContext = context; - } - - { - if (isRendering && current !== null && !didWarnAboutNestedUpdates) { - didWarnAboutNestedUpdates = true; - - error('Render methods should be a pure function of props and state; ' + 'triggering nested component updates from render is not allowed. ' + 'If necessary, trigger nested updates in componentDidUpdate.\n\n' + 'Check the render method of %s.', getComponentNameFromFiber(current) || 'Unknown'); - } - } - - var update = createUpdate(eventTime, lane); // Caution: React DevTools currently depends on this property - // being called "element". - - update.payload = { - element: element - }; - callback = callback === undefined ? null : callback; - - if (callback !== null) { - { - if (typeof callback !== 'function') { - error('render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback); - } - } - - update.callback = callback; - } - - var root = enqueueUpdate(current$1, update, lane); - - if (root !== null) { - scheduleUpdateOnFiber(root, current$1, lane, eventTime); - entangleTransitions(root, current$1, lane); - } - - return lane; - } - function getPublicRootInstance(container) { - var containerFiber = container.current; - - if (!containerFiber.child) { - return null; - } - - switch (containerFiber.child.tag) { - case HostComponent: - return getPublicInstance(containerFiber.child.stateNode); - - default: - return containerFiber.child.stateNode; - } - } - function attemptSynchronousHydration$1(fiber) { - switch (fiber.tag) { - case HostRoot: - { - var root = fiber.stateNode; - - if (isRootDehydrated(root)) { - // Flush the first scheduled "update". - var lanes = getHighestPriorityPendingLanes(root); - flushRoot(root, lanes); - } - - break; - } - - case SuspenseComponent: - { - flushSync(function () { - var root = enqueueConcurrentRenderForLane(fiber, SyncLane); - - if (root !== null) { - var eventTime = requestEventTime(); - scheduleUpdateOnFiber(root, fiber, SyncLane, eventTime); - } - }); // If we're still blocked after this, we need to increase - // the priority of any promises resolving within this - // boundary so that they next attempt also has higher pri. - - var retryLane = SyncLane; - markRetryLaneIfNotHydrated(fiber, retryLane); - break; - } - } - } - - function markRetryLaneImpl(fiber, retryLane) { - var suspenseState = fiber.memoizedState; - - if (suspenseState !== null && suspenseState.dehydrated !== null) { - suspenseState.retryLane = higherPriorityLane(suspenseState.retryLane, retryLane); - } - } // Increases the priority of thenables when they resolve within this boundary. - - - function markRetryLaneIfNotHydrated(fiber, retryLane) { - markRetryLaneImpl(fiber, retryLane); - var alternate = fiber.alternate; - - if (alternate) { - markRetryLaneImpl(alternate, retryLane); - } - } - function attemptContinuousHydration$1(fiber) { - if (fiber.tag !== SuspenseComponent) { - // We ignore HostRoots here because we can't increase - // their priority and they should not suspend on I/O, - // since you have to wrap anything that might suspend in - // Suspense. - return; - } - - var lane = SelectiveHydrationLane; - var root = enqueueConcurrentRenderForLane(fiber, lane); - - if (root !== null) { - var eventTime = requestEventTime(); - scheduleUpdateOnFiber(root, fiber, lane, eventTime); - } - - markRetryLaneIfNotHydrated(fiber, lane); - } - function attemptHydrationAtCurrentPriority$1(fiber) { - if (fiber.tag !== SuspenseComponent) { - // We ignore HostRoots here because we can't increase - // their priority other than synchronously flush it. - return; - } - - var lane = requestUpdateLane(fiber); - var root = enqueueConcurrentRenderForLane(fiber, lane); - - if (root !== null) { - var eventTime = requestEventTime(); - scheduleUpdateOnFiber(root, fiber, lane, eventTime); - } - - markRetryLaneIfNotHydrated(fiber, lane); - } - function findHostInstanceWithNoPortals(fiber) { - var hostFiber = findCurrentHostFiberWithNoPortals(fiber); - - if (hostFiber === null) { - return null; - } - - return hostFiber.stateNode; - } - - var shouldErrorImpl = function (fiber) { - return null; - }; - - function shouldError(fiber) { - return shouldErrorImpl(fiber); - } - - var shouldSuspendImpl = function (fiber) { - return false; - }; - - function shouldSuspend(fiber) { - return shouldSuspendImpl(fiber); - } - var overrideHookState = null; - var overrideHookStateDeletePath = null; - var overrideHookStateRenamePath = null; - var overrideProps = null; - var overridePropsDeletePath = null; - var overridePropsRenamePath = null; - var scheduleUpdate = null; - var setErrorHandler = null; - var setSuspenseHandler = null; - - { - var copyWithDeleteImpl = function (obj, path, index) { - var key = path[index]; - var updated = isArray(obj) ? obj.slice() : assign({}, obj); - - if (index + 1 === path.length) { - if (isArray(updated)) { - updated.splice(key, 1); - } else { - delete updated[key]; - } - - return updated; - } // $FlowFixMe number or string is fine here - - - updated[key] = copyWithDeleteImpl(obj[key], path, index + 1); - return updated; - }; - - var copyWithDelete = function (obj, path) { - return copyWithDeleteImpl(obj, path, 0); - }; - - var copyWithRenameImpl = function (obj, oldPath, newPath, index) { - var oldKey = oldPath[index]; - var updated = isArray(obj) ? obj.slice() : assign({}, obj); - - if (index + 1 === oldPath.length) { - var newKey = newPath[index]; // $FlowFixMe number or string is fine here - - updated[newKey] = updated[oldKey]; - - if (isArray(updated)) { - updated.splice(oldKey, 1); - } else { - delete updated[oldKey]; - } - } else { - // $FlowFixMe number or string is fine here - updated[oldKey] = copyWithRenameImpl( // $FlowFixMe number or string is fine here - obj[oldKey], oldPath, newPath, index + 1); - } - - return updated; - }; - - var copyWithRename = function (obj, oldPath, newPath) { - if (oldPath.length !== newPath.length) { - warn('copyWithRename() expects paths of the same length'); - - return; - } else { - for (var i = 0; i < newPath.length - 1; i++) { - if (oldPath[i] !== newPath[i]) { - warn('copyWithRename() expects paths to be the same except for the deepest key'); - - return; - } - } - } - - return copyWithRenameImpl(obj, oldPath, newPath, 0); - }; - - var copyWithSetImpl = function (obj, path, index, value) { - if (index >= path.length) { - return value; - } - - var key = path[index]; - var updated = isArray(obj) ? obj.slice() : assign({}, obj); // $FlowFixMe number or string is fine here - - updated[key] = copyWithSetImpl(obj[key], path, index + 1, value); - return updated; - }; - - var copyWithSet = function (obj, path, value) { - return copyWithSetImpl(obj, path, 0, value); - }; - - var findHook = function (fiber, id) { - // For now, the "id" of stateful hooks is just the stateful hook index. - // This may change in the future with e.g. nested hooks. - var currentHook = fiber.memoizedState; - - while (currentHook !== null && id > 0) { - currentHook = currentHook.next; - id--; - } - - return currentHook; - }; // Support DevTools editable values for useState and useReducer. - - - overrideHookState = function (fiber, id, path, value) { - var hook = findHook(fiber, id); - - if (hook !== null) { - var newState = copyWithSet(hook.memoizedState, path, value); - hook.memoizedState = newState; - hook.baseState = newState; // We aren't actually adding an update to the queue, - // because there is no update we can add for useReducer hooks that won't trigger an error. - // (There's no appropriate action type for DevTools overrides.) - // As a result though, React will see the scheduled update as a noop and bailout. - // Shallow cloning props works as a workaround for now to bypass the bailout check. - - fiber.memoizedProps = assign({}, fiber.memoizedProps); - var root = enqueueConcurrentRenderForLane(fiber, SyncLane); - - if (root !== null) { - scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); - } - } - }; - - overrideHookStateDeletePath = function (fiber, id, path) { - var hook = findHook(fiber, id); - - if (hook !== null) { - var newState = copyWithDelete(hook.memoizedState, path); - hook.memoizedState = newState; - hook.baseState = newState; // We aren't actually adding an update to the queue, - // because there is no update we can add for useReducer hooks that won't trigger an error. - // (There's no appropriate action type for DevTools overrides.) - // As a result though, React will see the scheduled update as a noop and bailout. - // Shallow cloning props works as a workaround for now to bypass the bailout check. - - fiber.memoizedProps = assign({}, fiber.memoizedProps); - var root = enqueueConcurrentRenderForLane(fiber, SyncLane); - - if (root !== null) { - scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); - } - } - }; - - overrideHookStateRenamePath = function (fiber, id, oldPath, newPath) { - var hook = findHook(fiber, id); - - if (hook !== null) { - var newState = copyWithRename(hook.memoizedState, oldPath, newPath); - hook.memoizedState = newState; - hook.baseState = newState; // We aren't actually adding an update to the queue, - // because there is no update we can add for useReducer hooks that won't trigger an error. - // (There's no appropriate action type for DevTools overrides.) - // As a result though, React will see the scheduled update as a noop and bailout. - // Shallow cloning props works as a workaround for now to bypass the bailout check. - - fiber.memoizedProps = assign({}, fiber.memoizedProps); - var root = enqueueConcurrentRenderForLane(fiber, SyncLane); - - if (root !== null) { - scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); - } - } - }; // Support DevTools props for function components, forwardRef, memo, host components, etc. - - - overrideProps = function (fiber, path, value) { - fiber.pendingProps = copyWithSet(fiber.memoizedProps, path, value); - - if (fiber.alternate) { - fiber.alternate.pendingProps = fiber.pendingProps; - } - - var root = enqueueConcurrentRenderForLane(fiber, SyncLane); - - if (root !== null) { - scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); - } - }; - - overridePropsDeletePath = function (fiber, path) { - fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path); - - if (fiber.alternate) { - fiber.alternate.pendingProps = fiber.pendingProps; - } - - var root = enqueueConcurrentRenderForLane(fiber, SyncLane); - - if (root !== null) { - scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); - } - }; - - overridePropsRenamePath = function (fiber, oldPath, newPath) { - fiber.pendingProps = copyWithRename(fiber.memoizedProps, oldPath, newPath); - - if (fiber.alternate) { - fiber.alternate.pendingProps = fiber.pendingProps; - } - - var root = enqueueConcurrentRenderForLane(fiber, SyncLane); - - if (root !== null) { - scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); - } - }; - - scheduleUpdate = function (fiber) { - var root = enqueueConcurrentRenderForLane(fiber, SyncLane); - - if (root !== null) { - scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); - } - }; - - setErrorHandler = function (newShouldErrorImpl) { - shouldErrorImpl = newShouldErrorImpl; - }; - - setSuspenseHandler = function (newShouldSuspendImpl) { - shouldSuspendImpl = newShouldSuspendImpl; - }; - } - - function findHostInstanceByFiber(fiber) { - var hostFiber = findCurrentHostFiber(fiber); - - if (hostFiber === null) { - return null; - } - - return hostFiber.stateNode; - } - - function emptyFindFiberByHostInstance(instance) { - return null; - } - - function getCurrentFiberForDevTools() { - return current; - } - - function injectIntoDevTools(devToolsConfig) { - var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance; - var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; - return injectInternals({ - bundleType: devToolsConfig.bundleType, - version: devToolsConfig.version, - rendererPackageName: devToolsConfig.rendererPackageName, - rendererConfig: devToolsConfig.rendererConfig, - overrideHookState: overrideHookState, - overrideHookStateDeletePath: overrideHookStateDeletePath, - overrideHookStateRenamePath: overrideHookStateRenamePath, - overrideProps: overrideProps, - overridePropsDeletePath: overridePropsDeletePath, - overridePropsRenamePath: overridePropsRenamePath, - setErrorHandler: setErrorHandler, - setSuspenseHandler: setSuspenseHandler, - scheduleUpdate: scheduleUpdate, - currentDispatcherRef: ReactCurrentDispatcher, - findHostInstanceByFiber: findHostInstanceByFiber, - findFiberByHostInstance: findFiberByHostInstance || emptyFindFiberByHostInstance, - // React Refresh - findHostInstancesForRefresh: findHostInstancesForRefresh , - scheduleRefresh: scheduleRefresh , - scheduleRoot: scheduleRoot , - setRefreshHandler: setRefreshHandler , - // Enables DevTools to append owner stacks to error messages in DEV mode. - getCurrentFiber: getCurrentFiberForDevTools , - // Enables DevTools to detect reconciler version rather than renderer version - // which may not match for third party renderers. - reconcilerVersion: ReactVersion - }); - } - - /* global reportError */ - - var defaultOnRecoverableError = typeof reportError === 'function' ? // In modern browsers, reportError will dispatch an error event, - // emulating an uncaught JavaScript error. - reportError : function (error) { - // In older browsers and test environments, fallback to console.error. - // eslint-disable-next-line react-internal/no-production-logging - console['error'](error); - }; - - function ReactDOMRoot(internalRoot) { - this._internalRoot = internalRoot; - } - - ReactDOMHydrationRoot.prototype.render = ReactDOMRoot.prototype.render = function (children) { - var root = this._internalRoot; - - if (root === null) { - throw new Error('Cannot update an unmounted root.'); - } - - { - if (typeof arguments[1] === 'function') { - error('render(...): does not support the second callback argument. ' + 'To execute a side effect after rendering, declare it in a component body with useEffect().'); - } else if (isValidContainer(arguments[1])) { - error('You passed a container to the second argument of root.render(...). ' + "You don't need to pass it again since you already passed it to create the root."); - } else if (typeof arguments[1] !== 'undefined') { - error('You passed a second argument to root.render(...) but it only accepts ' + 'one argument.'); - } - - var container = root.containerInfo; - - if (container.nodeType !== COMMENT_NODE) { - var hostInstance = findHostInstanceWithNoPortals(root.current); - - if (hostInstance) { - if (hostInstance.parentNode !== container) { - error('render(...): It looks like the React-rendered content of the ' + 'root container was removed without using React. This is not ' + 'supported and will cause errors. Instead, call ' + "root.unmount() to empty a root's container."); - } - } - } - } - - updateContainer(children, root, null, null); - }; - - ReactDOMHydrationRoot.prototype.unmount = ReactDOMRoot.prototype.unmount = function () { - { - if (typeof arguments[0] === 'function') { - error('unmount(...): does not support a callback argument. ' + 'To execute a side effect after rendering, declare it in a component body with useEffect().'); - } - } - - var root = this._internalRoot; - - if (root !== null) { - this._internalRoot = null; - var container = root.containerInfo; - - { - if (isAlreadyRendering()) { - error('Attempted to synchronously unmount a root while React was already ' + 'rendering. React cannot finish unmounting the root until the ' + 'current render has completed, which may lead to a race condition.'); - } - } - - flushSync(function () { - updateContainer(null, root, null, null); - }); - unmarkContainerAsRoot(container); - } - }; - - function createRoot(container, options) { - if (!isValidContainer(container)) { - throw new Error('createRoot(...): Target container is not a DOM element.'); - } - - warnIfReactDOMContainerInDEV(container); - var isStrictMode = false; - var concurrentUpdatesByDefaultOverride = false; - var identifierPrefix = ''; - var onRecoverableError = defaultOnRecoverableError; - var transitionCallbacks = null; - - if (options !== null && options !== undefined) { - { - if (options.hydrate) { - warn('hydrate through createRoot is deprecated. Use ReactDOMClient.hydrateRoot(container, ) instead.'); - } else { - if (typeof options === 'object' && options !== null && options.$$typeof === REACT_ELEMENT_TYPE) { - error('You passed a JSX element to createRoot. You probably meant to ' + 'call root.render instead. ' + 'Example usage:\n\n' + ' let root = createRoot(domContainer);\n' + ' root.render();'); - } - } - } - - if (options.unstable_strictMode === true) { - isStrictMode = true; - } - - if (options.identifierPrefix !== undefined) { - identifierPrefix = options.identifierPrefix; - } - - if (options.onRecoverableError !== undefined) { - onRecoverableError = options.onRecoverableError; - } - - if (options.transitionCallbacks !== undefined) { - transitionCallbacks = options.transitionCallbacks; - } - } - - var root = createContainer(container, ConcurrentRoot, null, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError); - markContainerAsRoot(root.current, container); - var rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container; - listenToAllSupportedEvents(rootContainerElement); - return new ReactDOMRoot(root); - } - - function ReactDOMHydrationRoot(internalRoot) { - this._internalRoot = internalRoot; - } - - function scheduleHydration(target) { - if (target) { - queueExplicitHydrationTarget(target); - } - } - - ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = scheduleHydration; - function hydrateRoot(container, initialChildren, options) { - if (!isValidContainer(container)) { - throw new Error('hydrateRoot(...): Target container is not a DOM element.'); - } - - warnIfReactDOMContainerInDEV(container); - - { - if (initialChildren === undefined) { - error('Must provide initial children as second argument to hydrateRoot. ' + 'Example usage: hydrateRoot(domContainer, )'); - } - } // For now we reuse the whole bag of options since they contain - // the hydration callbacks. - - - var hydrationCallbacks = options != null ? options : null; // TODO: Delete this option - - var mutableSources = options != null && options.hydratedSources || null; - var isStrictMode = false; - var concurrentUpdatesByDefaultOverride = false; - var identifierPrefix = ''; - var onRecoverableError = defaultOnRecoverableError; - - if (options !== null && options !== undefined) { - if (options.unstable_strictMode === true) { - isStrictMode = true; - } - - if (options.identifierPrefix !== undefined) { - identifierPrefix = options.identifierPrefix; - } - - if (options.onRecoverableError !== undefined) { - onRecoverableError = options.onRecoverableError; - } - } - - var root = createHydrationContainer(initialChildren, null, container, ConcurrentRoot, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError); - markContainerAsRoot(root.current, container); // This can't be a comment node since hydration doesn't work on comment nodes anyway. - - listenToAllSupportedEvents(container); - - if (mutableSources) { - for (var i = 0; i < mutableSources.length; i++) { - var mutableSource = mutableSources[i]; - registerMutableSourceForHydration(root, mutableSource); - } - } - - return new ReactDOMHydrationRoot(root); - } - function isValidContainer(node) { - return !!(node && (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE || !disableCommentsAsDOMContainers )); - } // TODO: Remove this function which also includes comment nodes. - // We only use it in places that are currently more relaxed. - - function isValidContainerLegacy(node) { - return !!(node && (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE || node.nodeType === COMMENT_NODE && node.nodeValue === ' react-mount-point-unstable ')); - } - - function warnIfReactDOMContainerInDEV(container) { - { - if (container.nodeType === ELEMENT_NODE && container.tagName && container.tagName.toUpperCase() === 'BODY') { - error('createRoot(): Creating roots directly with document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try using a container element created ' + 'for your app.'); - } - - if (isContainerMarkedAsRoot(container)) { - if (container._reactRootContainer) { - error('You are calling ReactDOMClient.createRoot() on a container that was previously ' + 'passed to ReactDOM.render(). This is not supported.'); - } else { - error('You are calling ReactDOMClient.createRoot() on a container that ' + 'has already been passed to createRoot() before. Instead, call ' + 'root.render() on the existing root instead if you want to update it.'); - } - } - } - } - - var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner; - var topLevelUpdateWarnings; - - { - topLevelUpdateWarnings = function (container) { - if (container._reactRootContainer && container.nodeType !== COMMENT_NODE) { - var hostInstance = findHostInstanceWithNoPortals(container._reactRootContainer.current); - - if (hostInstance) { - if (hostInstance.parentNode !== container) { - error('render(...): It looks like the React-rendered content of this ' + 'container was removed without using React. This is not ' + 'supported and will cause errors. Instead, call ' + 'ReactDOM.unmountComponentAtNode to empty a container.'); - } - } - } - - var isRootRenderedBySomeReact = !!container._reactRootContainer; - var rootEl = getReactRootElementInContainer(container); - var hasNonRootReactChild = !!(rootEl && getInstanceFromNode(rootEl)); - - if (hasNonRootReactChild && !isRootRenderedBySomeReact) { - error('render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.'); - } - - if (container.nodeType === ELEMENT_NODE && container.tagName && container.tagName.toUpperCase() === 'BODY') { - error('render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.'); - } - }; - } - - function getReactRootElementInContainer(container) { - if (!container) { - return null; - } - - if (container.nodeType === DOCUMENT_NODE) { - return container.documentElement; - } else { - return container.firstChild; - } - } - - function noopOnRecoverableError() {// This isn't reachable because onRecoverableError isn't called in the - // legacy API. - } - - function legacyCreateRootFromDOMContainer(container, initialChildren, parentComponent, callback, isHydrationContainer) { - if (isHydrationContainer) { - if (typeof callback === 'function') { - var originalCallback = callback; - - callback = function () { - var instance = getPublicRootInstance(root); - originalCallback.call(instance); - }; - } - - var root = createHydrationContainer(initialChildren, callback, container, LegacyRoot, null, // hydrationCallbacks - false, // isStrictMode - false, // concurrentUpdatesByDefaultOverride, - '', // identifierPrefix - noopOnRecoverableError); - container._reactRootContainer = root; - markContainerAsRoot(root.current, container); - var rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container; - listenToAllSupportedEvents(rootContainerElement); - flushSync(); - return root; - } else { - // First clear any existing content. - var rootSibling; - - while (rootSibling = container.lastChild) { - container.removeChild(rootSibling); - } - - if (typeof callback === 'function') { - var _originalCallback = callback; - - callback = function () { - var instance = getPublicRootInstance(_root); - - _originalCallback.call(instance); - }; - } - - var _root = createContainer(container, LegacyRoot, null, // hydrationCallbacks - false, // isStrictMode - false, // concurrentUpdatesByDefaultOverride, - '', // identifierPrefix - noopOnRecoverableError); - - container._reactRootContainer = _root; - markContainerAsRoot(_root.current, container); - - var _rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container; - - listenToAllSupportedEvents(_rootContainerElement); // Initial mount should not be batched. - - flushSync(function () { - updateContainer(initialChildren, _root, parentComponent, callback); - }); - return _root; - } - } - - function warnOnInvalidCallback$1(callback, callerName) { - { - if (callback !== null && typeof callback !== 'function') { - error('%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback); - } - } - } - - function legacyRenderSubtreeIntoContainer(parentComponent, children, container, forceHydrate, callback) { - { - topLevelUpdateWarnings(container); - warnOnInvalidCallback$1(callback === undefined ? null : callback, 'render'); - } - - var maybeRoot = container._reactRootContainer; - var root; - - if (!maybeRoot) { - // Initial mount - root = legacyCreateRootFromDOMContainer(container, children, parentComponent, callback, forceHydrate); - } else { - root = maybeRoot; - - if (typeof callback === 'function') { - var originalCallback = callback; - - callback = function () { - var instance = getPublicRootInstance(root); - originalCallback.call(instance); - }; - } // Update - - - updateContainer(children, root, parentComponent, callback); - } - - return getPublicRootInstance(root); - } - - var didWarnAboutFindDOMNode = false; - function findDOMNode(componentOrElement) { - { - if (!didWarnAboutFindDOMNode) { - didWarnAboutFindDOMNode = true; - - error('findDOMNode is deprecated and will be removed in the next major ' + 'release. Instead, add a ref directly to the element you want ' + 'to reference. Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-find-node'); - } - - var owner = ReactCurrentOwner$3.current; - - if (owner !== null && owner.stateNode !== null) { - var warnedAboutRefsInRender = owner.stateNode._warnedAboutRefsInRender; - - if (!warnedAboutRefsInRender) { - error('%s is accessing findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentNameFromType(owner.type) || 'A component'); - } - - owner.stateNode._warnedAboutRefsInRender = true; - } - } - - if (componentOrElement == null) { - return null; - } - - if (componentOrElement.nodeType === ELEMENT_NODE) { - return componentOrElement; - } - - { - return findHostInstanceWithWarning(componentOrElement, 'findDOMNode'); - } - } - function hydrate(element, container, callback) { - { - error('ReactDOM.hydrate is no longer supported in React 18. Use hydrateRoot ' + 'instead. Until you switch to the new API, your app will behave as ' + "if it's running React 17. Learn " + 'more: https://reactjs.org/link/switch-to-createroot'); - } - - if (!isValidContainerLegacy(container)) { - throw new Error('Target container is not a DOM element.'); - } - - { - var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined; - - if (isModernRoot) { - error('You are calling ReactDOM.hydrate() on a container that was previously ' + 'passed to ReactDOMClient.createRoot(). This is not supported. ' + 'Did you mean to call hydrateRoot(container, element)?'); - } - } // TODO: throw or warn if we couldn't hydrate? - - - return legacyRenderSubtreeIntoContainer(null, element, container, true, callback); - } - function render(element, container, callback) { - { - error('ReactDOM.render is no longer supported in React 18. Use createRoot ' + 'instead. Until you switch to the new API, your app will behave as ' + "if it's running React 17. Learn " + 'more: https://reactjs.org/link/switch-to-createroot'); - } - - if (!isValidContainerLegacy(container)) { - throw new Error('Target container is not a DOM element.'); - } - - { - var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined; - - if (isModernRoot) { - error('You are calling ReactDOM.render() on a container that was previously ' + 'passed to ReactDOMClient.createRoot(). This is not supported. ' + 'Did you mean to call root.render(element)?'); - } - } - - return legacyRenderSubtreeIntoContainer(null, element, container, false, callback); - } - function unstable_renderSubtreeIntoContainer(parentComponent, element, containerNode, callback) { - { - error('ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported ' + 'in React 18. Consider using a portal instead. Until you switch to ' + "the createRoot API, your app will behave as if it's running React " + '17. Learn more: https://reactjs.org/link/switch-to-createroot'); - } - - if (!isValidContainerLegacy(containerNode)) { - throw new Error('Target container is not a DOM element.'); - } - - if (parentComponent == null || !has(parentComponent)) { - throw new Error('parentComponent must be a valid React Component'); - } - - return legacyRenderSubtreeIntoContainer(parentComponent, element, containerNode, false, callback); - } - var didWarnAboutUnmountComponentAtNode = false; - function unmountComponentAtNode(container) { - { - if (!didWarnAboutUnmountComponentAtNode) { - didWarnAboutUnmountComponentAtNode = true; - - error('unmountComponentAtNode is deprecated and will be removed in the ' + 'next major release. Switch to the createRoot API. Learn ' + 'more: https://reactjs.org/link/switch-to-createroot'); - } - } - - if (!isValidContainerLegacy(container)) { - throw new Error('unmountComponentAtNode(...): Target container is not a DOM element.'); - } - - { - var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined; - - if (isModernRoot) { - error('You are calling ReactDOM.unmountComponentAtNode() on a container that was previously ' + 'passed to ReactDOMClient.createRoot(). This is not supported. Did you mean to call root.unmount()?'); - } - } - - if (container._reactRootContainer) { - { - var rootEl = getReactRootElementInContainer(container); - var renderedByDifferentReact = rootEl && !getInstanceFromNode(rootEl); - - if (renderedByDifferentReact) { - error("unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by another copy of React.'); - } - } // Unmount should not be batched. - - - flushSync(function () { - legacyRenderSubtreeIntoContainer(null, null, container, false, function () { - // $FlowFixMe This should probably use `delete container._reactRootContainer` - container._reactRootContainer = null; - unmarkContainerAsRoot(container); - }); - }); // If you call unmountComponentAtNode twice in quick succession, you'll - // get `true` twice. That's probably fine? - - return true; - } else { - { - var _rootEl = getReactRootElementInContainer(container); - - var hasNonRootReactChild = !!(_rootEl && getInstanceFromNode(_rootEl)); // Check if the container itself is a React root node. - - var isContainerReactRoot = container.nodeType === ELEMENT_NODE && isValidContainerLegacy(container.parentNode) && !!container.parentNode._reactRootContainer; - - if (hasNonRootReactChild) { - error("unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.'); - } - } - - return false; - } - } - - setAttemptSynchronousHydration(attemptSynchronousHydration$1); - setAttemptContinuousHydration(attemptContinuousHydration$1); - setAttemptHydrationAtCurrentPriority(attemptHydrationAtCurrentPriority$1); - setGetCurrentUpdatePriority(getCurrentUpdatePriority); - setAttemptHydrationAtPriority(runWithPriority); - - { - if (typeof Map !== 'function' || // $FlowIssue Flow incorrectly thinks Map has no prototype - Map.prototype == null || typeof Map.prototype.forEach !== 'function' || typeof Set !== 'function' || // $FlowIssue Flow incorrectly thinks Set has no prototype - Set.prototype == null || typeof Set.prototype.clear !== 'function' || typeof Set.prototype.forEach !== 'function') { - error('React depends on Map and Set built-in types. Make sure that you load a ' + 'polyfill in older browsers. https://reactjs.org/link/react-polyfills'); - } - } - - setRestoreImplementation(restoreControlledState$3); - setBatchingImplementation(batchedUpdates$1, discreteUpdates, flushSync); - - function createPortal$1(children, container) { - var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; - - if (!isValidContainer(container)) { - throw new Error('Target container is not a DOM element.'); - } // TODO: pass ReactDOM portal implementation as third argument - // $FlowFixMe The Flow type is opaque but there's no way to actually create it. - - - return createPortal(children, container, null, key); - } - - function renderSubtreeIntoContainer(parentComponent, element, containerNode, callback) { - return unstable_renderSubtreeIntoContainer(parentComponent, element, containerNode, callback); - } - - var Internals = { - usingClientEntryPoint: false, - // Keep in sync with ReactTestUtils.js. - // This is an array for better minification. - Events: [getInstanceFromNode, getNodeFromInstance, getFiberCurrentPropsFromNode, enqueueStateRestore, restoreStateIfNeeded, batchedUpdates$1] - }; - - function createRoot$1(container, options) { - { - if (!Internals.usingClientEntryPoint && !true) { - error('You are importing createRoot from "react-dom" which is not supported. ' + 'You should instead import it from "react-dom/client".'); - } - } - - return createRoot(container, options); - } - - function hydrateRoot$1(container, initialChildren, options) { - { - if (!Internals.usingClientEntryPoint && !true) { - error('You are importing hydrateRoot from "react-dom" which is not supported. ' + 'You should instead import it from "react-dom/client".'); - } - } - - return hydrateRoot(container, initialChildren, options); - } // Overload the definition to the two valid signatures. - // Warning, this opts-out of checking the function body. - - - // eslint-disable-next-line no-redeclare - function flushSync$1(fn) { - { - if (isAlreadyRendering()) { - error('flushSync was called from inside a lifecycle method. React cannot ' + 'flush when React is already rendering. Consider moving this call to ' + 'a scheduler task or micro task.'); - } - } - - return flushSync(fn); - } - var foundDevTools = injectIntoDevTools({ - findFiberByHostInstance: getClosestInstanceFromNode, - bundleType: 1 , - version: ReactVersion, - rendererPackageName: 'react-dom' - }); - - { - if (!foundDevTools && canUseDOM && window.top === window.self) { - // If we're in Chrome or Firefox, provide a download link if not installed. - if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) { - var protocol = window.location.protocol; // Don't warn in exotic cases like chrome-extension://. - - if (/^(https?|file):$/.test(protocol)) { - // eslint-disable-next-line react-internal/no-production-logging - console.info('%cDownload the React DevTools ' + 'for a better development experience: ' + 'https://reactjs.org/link/react-devtools' + (protocol === 'file:' ? '\nYou might need to use a local HTTP server (instead of file://): ' + 'https://reactjs.org/link/react-devtools-faq' : ''), 'font-weight:bold'); - } - } - } - } - - exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; - exports.createPortal = createPortal$1; - exports.createRoot = createRoot$1; - exports.findDOMNode = findDOMNode; - exports.flushSync = flushSync$1; - exports.hydrate = hydrate; - exports.hydrateRoot = hydrateRoot$1; - exports.render = render; - exports.unmountComponentAtNode = unmountComponentAtNode; - exports.unstable_batchedUpdates = batchedUpdates$1; - exports.unstable_renderSubtreeIntoContainer = renderSubtreeIntoContainer; - exports.version = ReactVersion; - -}))); diff --git a/public/react/react.development.js b/public/react/react.development.js deleted file mode 100644 index dfb2710..0000000 --- a/public/react/react.development.js +++ /dev/null @@ -1,3343 +0,0 @@ -/** - * @license React - * react.development.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. - */ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = global || self, factory(global.React = {})); -}(this, (function (exports) { 'use strict'; - - var ReactVersion = '18.3.1'; - - // ATTENTION - // When adding new symbols to this file, - // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' - // The Symbol used to tag the ReactElement-like types. - var REACT_ELEMENT_TYPE = Symbol.for('react.element'); - var REACT_PORTAL_TYPE = Symbol.for('react.portal'); - var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment'); - var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode'); - var REACT_PROFILER_TYPE = Symbol.for('react.profiler'); - var REACT_PROVIDER_TYPE = Symbol.for('react.provider'); - var REACT_CONTEXT_TYPE = Symbol.for('react.context'); - var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref'); - var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense'); - var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list'); - var REACT_MEMO_TYPE = Symbol.for('react.memo'); - var REACT_LAZY_TYPE = Symbol.for('react.lazy'); - var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen'); - var MAYBE_ITERATOR_SYMBOL = Symbol.iterator; - var FAUX_ITERATOR_SYMBOL = '@@iterator'; - function getIteratorFn(maybeIterable) { - if (maybeIterable === null || typeof maybeIterable !== 'object') { - return null; - } - - var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; - - if (typeof maybeIterator === 'function') { - return maybeIterator; - } - - return null; - } - - /** - * Keeps track of the current dispatcher. - */ - var ReactCurrentDispatcher = { - /** - * @internal - * @type {ReactComponent} - */ - current: null - }; - - /** - * Keeps track of the current batch's configuration such as how long an update - * should suspend for if it needs to. - */ - var ReactCurrentBatchConfig = { - transition: null - }; - - var ReactCurrentActQueue = { - current: null, - // Used to reproduce behavior of `batchedUpdates` in legacy mode. - isBatchingLegacy: false, - didScheduleLegacyUpdate: false - }; - - /** - * Keeps track of the current owner. - * - * The current owner is the component who should own any components that are - * currently being constructed. - */ - var ReactCurrentOwner = { - /** - * @internal - * @type {ReactComponent} - */ - current: null - }; - - var ReactDebugCurrentFrame = {}; - var currentExtraStackFrame = null; - function setExtraStackFrame(stack) { - { - currentExtraStackFrame = stack; - } - } - - { - ReactDebugCurrentFrame.setExtraStackFrame = function (stack) { - { - currentExtraStackFrame = stack; - } - }; // Stack implementation injected by the current renderer. - - - ReactDebugCurrentFrame.getCurrentStack = null; - - ReactDebugCurrentFrame.getStackAddendum = function () { - var stack = ''; // Add an extra top frame while an element is being validated - - if (currentExtraStackFrame) { - stack += currentExtraStackFrame; - } // Delegate to the injected renderer-specific implementation - - - var impl = ReactDebugCurrentFrame.getCurrentStack; - - if (impl) { - stack += impl() || ''; - } - - return stack; - }; - } - - // ----------------------------------------------------------------------------- - - var enableScopeAPI = false; // Experimental Create Event Handle API. - var enableCacheElement = false; - var enableTransitionTracing = false; // No known bugs, but needs performance testing - - var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber - // stuff. Intended to enable React core members to more easily debug scheduling - // issues in DEV builds. - - var enableDebugTracing = false; // Track which Fiber(s) schedule render work. - - var ReactSharedInternals = { - ReactCurrentDispatcher: ReactCurrentDispatcher, - ReactCurrentBatchConfig: ReactCurrentBatchConfig, - ReactCurrentOwner: ReactCurrentOwner - }; - - { - ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame; - ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue; - } - - // by calls to these methods by a Babel plugin. - // - // In PROD (or in packages without access to React internals), - // they are left as they are instead. - - function warn(format) { - { - { - for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - printWarning('warn', format, args); - } - } - } - function error(format) { - { - { - for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { - args[_key2 - 1] = arguments[_key2]; - } - - printWarning('error', format, args); - } - } - } - - function printWarning(level, format, args) { - // When changing this logic, you might want to also - // update consoleWithStackDev.www.js as well. - { - var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; - var stack = ReactDebugCurrentFrame.getStackAddendum(); - - if (stack !== '') { - format += '%s'; - args = args.concat([stack]); - } // eslint-disable-next-line react-internal/safe-string-coercion - - - var argsWithFormat = args.map(function (item) { - return String(item); - }); // Careful: RN currently depends on this prefix - - argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it - // breaks IE9: https://github.com/facebook/react/issues/13610 - // eslint-disable-next-line react-internal/no-production-logging - - Function.prototype.apply.call(console[level], console, argsWithFormat); - } - } - - var didWarnStateUpdateForUnmountedComponent = {}; - - function warnNoop(publicInstance, callerName) { - { - var _constructor = publicInstance.constructor; - var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass'; - var warningKey = componentName + "." + callerName; - - if (didWarnStateUpdateForUnmountedComponent[warningKey]) { - return; - } - - error("Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName); - - didWarnStateUpdateForUnmountedComponent[warningKey] = true; - } - } - /** - * This is the abstract API for an update queue. - */ - - - var ReactNoopUpdateQueue = { - /** - * Checks whether or not this composite component is mounted. - * @param {ReactClass} publicInstance The instance we want to test. - * @return {boolean} True if mounted, false otherwise. - * @protected - * @final - */ - isMounted: function (publicInstance) { - return false; - }, - - /** - * Forces an update. This should only be invoked when it is known with - * certainty that we are **not** in a DOM transaction. - * - * You may want to call this when you know that some deeper aspect of the - * component's state has changed but `setState` was not called. - * - * This will not invoke `shouldComponentUpdate`, but it will invoke - * `componentWillUpdate` and `componentDidUpdate`. - * - * @param {ReactClass} publicInstance The instance that should rerender. - * @param {?function} callback Called after component is updated. - * @param {?string} callerName name of the calling function in the public API. - * @internal - */ - enqueueForceUpdate: function (publicInstance, callback, callerName) { - warnNoop(publicInstance, 'forceUpdate'); - }, - - /** - * Replaces all of the state. Always use this or `setState` to mutate state. - * You should treat `this.state` as immutable. - * - * There is no guarantee that `this.state` will be immediately updated, so - * accessing `this.state` after calling this method may return the old value. - * - * @param {ReactClass} publicInstance The instance that should rerender. - * @param {object} completeState Next state. - * @param {?function} callback Called after component is updated. - * @param {?string} callerName name of the calling function in the public API. - * @internal - */ - enqueueReplaceState: function (publicInstance, completeState, callback, callerName) { - warnNoop(publicInstance, 'replaceState'); - }, - - /** - * Sets a subset of the state. This only exists because _pendingState is - * internal. This provides a merging strategy that is not available to deep - * properties which is confusing. TODO: Expose pendingState or don't use it - * during the merge. - * - * @param {ReactClass} publicInstance The instance that should rerender. - * @param {object} partialState Next partial state to be merged with state. - * @param {?function} callback Called after component is updated. - * @param {?string} Name of the calling function in the public API. - * @internal - */ - enqueueSetState: function (publicInstance, partialState, callback, callerName) { - warnNoop(publicInstance, 'setState'); - } - }; - - var assign = Object.assign; - - var emptyObject = {}; - - { - Object.freeze(emptyObject); - } - /** - * Base class helpers for the updating state of a component. - */ - - - function Component(props, context, updater) { - this.props = props; - this.context = context; // If a component has string refs, we will assign a Different object later. - - this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the - // renderer. - - this.updater = updater || ReactNoopUpdateQueue; - } - - Component.prototype.isReactComponent = {}; - /** - * Sets a subset of the state. Always use this to mutate - * state. You should treat `this.state` as immutable. - * - * There is no guarantee that `this.state` will be immediately updated, so - * accessing `this.state` after calling this method may return the old value. - * - * There is no guarantee that calls to `setState` will run synchronously, - * as they may eventually be batched together. You can provide an optional - * callback that will be executed when the call to setState is actually - * completed. - * - * When a function is provided to setState, it will be called at some point in - * the future (not synchronously). It will be called with the up to date - * component arguments (state, props, context). These values can be Different - * from this.* because your function may be called after receiveProps but before - * shouldComponentUpdate, and this new state, props, and context will not yet be - * assigned to this. - * - * @param {object|function} partialState Next partial state or function to - * produce next partial state to be merged with current state. - * @param {?function} callback Called after state is updated. - * @final - * @protected - */ - - Component.prototype.setState = function (partialState, callback) { - if (typeof partialState !== 'object' && typeof partialState !== 'function' && partialState != null) { - throw new Error('setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.'); - } - - this.updater.enqueueSetState(this, partialState, callback, 'setState'); - }; - /** - * Forces an update. This should only be invoked when it is known with - * certainty that we are **not** in a DOM transaction. - * - * You may want to call this when you know that some deeper aspect of the - * component's state has changed but `setState` was not called. - * - * This will not invoke `shouldComponentUpdate`, but it will invoke - * `componentWillUpdate` and `componentDidUpdate`. - * - * @param {?function} callback Called after update is complete. - * @final - * @protected - */ - - - Component.prototype.forceUpdate = function (callback) { - this.updater.enqueueForceUpdate(this, callback, 'forceUpdate'); - }; - /** - * Deprecated APIs. These APIs used to exist on classic React classes but since - * we would like to deprecate them, we're not going to move them over to this - * modern base class. Instead, we define a getter that warns if it's accessed. - */ - - - { - var deprecatedAPIs = { - isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'], - replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'] - }; - - var defineDeprecationWarning = function (methodName, info) { - Object.defineProperty(Component.prototype, methodName, { - get: function () { - warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]); - - return undefined; - } - }); - }; - - for (var fnName in deprecatedAPIs) { - if (deprecatedAPIs.hasOwnProperty(fnName)) { - defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); - } - } - } - - function ComponentDummy() {} - - ComponentDummy.prototype = Component.prototype; - /** - * Convenience component with default shallow equality check for sCU. - */ - - function PureComponent(props, context, updater) { - this.props = props; - this.context = context; // If a component has string refs, we will assign a Different object later. - - this.refs = emptyObject; - this.updater = updater || ReactNoopUpdateQueue; - } - - var pureComponentPrototype = PureComponent.prototype = new ComponentDummy(); - pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods. - - assign(pureComponentPrototype, Component.prototype); - pureComponentPrototype.isPureReactComponent = true; - - // an immutable object with a single mutable value - function createRef() { - var refObject = { - current: null - }; - - { - Object.seal(refObject); - } - - return refObject; - } - - var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare - - function isArray(a) { - return isArrayImpl(a); - } - - /* - * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol - * and Temporal.* types. See https://github.com/facebook/react/pull/22064. - * - * The functions in this module will throw an easier-to-understand, - * easier-to-debug exception with a clear errors message message explaining the - * problem. (Instead of a confusing exception thrown inside the implementation - * of the `value` object). - */ - // $FlowFixMe only called in DEV, so void return is not possible. - function typeName(value) { - { - // toStringTag is needed for namespaced types like Temporal.Instant - var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag; - var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object'; - return type; - } - } // $FlowFixMe only called in DEV, so void return is not possible. - - - function willCoercionThrow(value) { - { - try { - testStringCoercion(value); - return false; - } catch (e) { - return true; - } - } - } - - function testStringCoercion(value) { - // If you ended up here by following an exception call stack, here's what's - // happened: you supplied an object or symbol value to React (as a prop, key, - // DOM attribute, CSS property, string ref, etc.) and when React tried to - // coerce it to a string using `'' + value`, an exception was thrown. - // - // The most common types that will cause this exception are `Symbol` instances - // and Temporal objects like `Temporal.Instant`. But any object that has a - // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this - // exception. (Library authors do this to prevent Users from using built-in - // numeric operators like `+` or comparison operators like `>=` because custom - // methods are needed to perform accurate arithmetic or comparison.) - // - // To fix the problem, coerce this object or symbol value to a string before - // passing it to React. The most reliable way is usually `String(value)`. - // - // To find which value is throwing, check the browser or debugger console. - // Before this exception was thrown, there should be `console.error` output - // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the - // problem and how that type was used: key, atrribute, input value prop, etc. - // In most cases, this console output also shows the component and its - // ancestor components where the exception happened. - // - // eslint-disable-next-line react-internal/safe-string-coercion - return '' + value; - } - function checkKeyStringCoercion(value) { - { - if (willCoercionThrow(value)) { - error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value)); - - return testStringCoercion(value); // throw (to help callers find troubleshooting comments) - } - } - } - - function getWrappedName(outerType, innerType, wrapperName) { - var displayName = outerType.displayName; - - if (displayName) { - return displayName; - } - - var functionName = innerType.displayName || innerType.name || ''; - return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName; - } // Keep in sync with react-reconciler/getComponentNameFromFiber - - - function getContextName(type) { - return type.displayName || 'Context'; - } // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead. - - - function getComponentNameFromType(type) { - if (type == null) { - // Host root, text node or just invalid type. - return null; - } - - { - if (typeof type.tag === 'number') { - error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.'); - } - } - - if (typeof type === 'function') { - return type.displayName || type.name || null; - } - - if (typeof type === 'string') { - return type; - } - - switch (type) { - case REACT_FRAGMENT_TYPE: - return 'Fragment'; - - case REACT_PORTAL_TYPE: - return 'Portal'; - - case REACT_PROFILER_TYPE: - return 'Profiler'; - - case REACT_STRICT_MODE_TYPE: - return 'StrictMode'; - - case REACT_SUSPENSE_TYPE: - return 'Suspense'; - - case REACT_SUSPENSE_LIST_TYPE: - return 'SuspenseList'; - - } - - if (typeof type === 'object') { - switch (type.$$typeof) { - case REACT_CONTEXT_TYPE: - var context = type; - return getContextName(context) + '.Consumer'; - - case REACT_PROVIDER_TYPE: - var provider = type; - return getContextName(provider._context) + '.Provider'; - - case REACT_FORWARD_REF_TYPE: - return getWrappedName(type, type.render, 'ForwardRef'); - - case REACT_MEMO_TYPE: - var outerName = type.displayName || null; - - if (outerName !== null) { - return outerName; - } - - return getComponentNameFromType(type.type) || 'Memo'; - - case REACT_LAZY_TYPE: - { - var lazyComponent = type; - var payload = lazyComponent._payload; - var init = lazyComponent._init; - - try { - return getComponentNameFromType(init(payload)); - } catch (x) { - return null; - } - } - - // eslint-disable-next-line no-fallthrough - } - } - - return null; - } - - var hasOwnProperty = Object.prototype.hasOwnProperty; - - var RESERVED_PROPS = { - key: true, - ref: true, - __self: true, - __source: true - }; - var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs; - - { - didWarnAboutStringRefs = {}; - } - - function hasValidRef(config) { - { - if (hasOwnProperty.call(config, 'ref')) { - var getter = Object.getOwnPropertyDescriptor(config, 'ref').get; - - if (getter && getter.isReactWarning) { - return false; - } - } - } - - return config.ref !== undefined; - } - - function hasValidKey(config) { - { - if (hasOwnProperty.call(config, 'key')) { - var getter = Object.getOwnPropertyDescriptor(config, 'key').get; - - if (getter && getter.isReactWarning) { - return false; - } - } - } - - return config.key !== undefined; - } - - function defineKeyPropWarningGetter(props, displayName) { - var warnAboutAccessingKey = function () { - { - if (!specialPropKeyWarningShown) { - specialPropKeyWarningShown = true; - - error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a Different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); - } - } - }; - - warnAboutAccessingKey.isReactWarning = true; - Object.defineProperty(props, 'key', { - get: warnAboutAccessingKey, - configurable: true - }); - } - - function defineRefPropWarningGetter(props, displayName) { - var warnAboutAccessingRef = function () { - { - if (!specialPropRefWarningShown) { - specialPropRefWarningShown = true; - - error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a Different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); - } - } - }; - - warnAboutAccessingRef.isReactWarning = true; - Object.defineProperty(props, 'ref', { - get: warnAboutAccessingRef, - configurable: true - }); - } - - function warnIfStringRefCannotBeAutoConverted(config) { - { - if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) { - var componentName = getComponentNameFromType(ReactCurrentOwner.current.type); - - if (!didWarnAboutStringRefs[componentName]) { - error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', componentName, config.ref); - - didWarnAboutStringRefs[componentName] = true; - } - } - } - } - /** - * Factory method to create a new React element. This no longer adheres to - * the class pattern, so do not use new to call it. Also, instanceof check - * will not work. Instead test $$typeof field against Symbol.for('react.element') to check - * if something is a React Element. - * - * @param {*} type - * @param {*} props - * @param {*} key - * @param {string|object} ref - * @param {*} owner - * @param {*} self A *temporary* helper to detect places where `this` is - * Different from the `owner` when React.createElement is called, so that we - * can warn. We want to get rid of owner and replace string `ref`s with arrow - * functions, and as long as `this` and owner are the same, there will be no - * change in behavior. - * @param {*} source An annotation object (added by a transpiler or otherwise) - * indicating filename, line number, and/or other information. - * @internal - */ - - - var ReactElement = function (type, key, ref, self, source, owner, props) { - var element = { - // This tag allows us to uniquely identify this as a React Element - $$typeof: REACT_ELEMENT_TYPE, - // Built-in properties that belong on the element - type: type, - key: key, - ref: ref, - props: props, - // Record the component responsible for creating this element. - _owner: owner - }; - - { - // The validation flag is currently mutative. We put it on - // an external backing store so that we can freeze the whole object. - // This can be replaced with a WeakMap once they are implemented in - // commonly used development environments. - element._store = {}; // To make comparing ReactElements easier for testing purposes, we make - // the validation flag non-enumerable (where possible, which should - // include every environment we run tests in), so the test framework - // ignores it. - - Object.defineProperty(element._store, 'validated', { - configurable: false, - enumerable: false, - writable: true, - value: false - }); // self and source are DEV only properties. - - Object.defineProperty(element, '_self', { - configurable: false, - enumerable: false, - writable: false, - value: self - }); // Two elements created in two Different places should be considered - // equal for testing purposes and therefore we hide it from enumeration. - - Object.defineProperty(element, '_source', { - configurable: false, - enumerable: false, - writable: false, - value: source - }); - - if (Object.freeze) { - Object.freeze(element.props); - Object.freeze(element); - } - } - - return element; - }; - /** - * Create and return a new ReactElement of the given type. - * See https://reactjs.org/docs/react-api.html#createelement - */ - - function createElement(type, config, children) { - var propName; // Reserved names are extracted - - var props = {}; - var key = null; - var ref = null; - var self = null; - var source = null; - - if (config != null) { - if (hasValidRef(config)) { - ref = config.ref; - - { - warnIfStringRefCannotBeAutoConverted(config); - } - } - - if (hasValidKey(config)) { - { - checkKeyStringCoercion(config.key); - } - - key = '' + config.key; - } - - self = config.__self === undefined ? null : config.__self; - source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object - - for (propName in config) { - if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { - props[propName] = config[propName]; - } - } - } // Children can be more than one argument, and those are transferred onto - // the newly allocated props object. - - - var childrenLength = arguments.length - 2; - - if (childrenLength === 1) { - props.children = children; - } else if (childrenLength > 1) { - var childArray = Array(childrenLength); - - for (var i = 0; i < childrenLength; i++) { - childArray[i] = arguments[i + 2]; - } - - { - if (Object.freeze) { - Object.freeze(childArray); - } - } - - props.children = childArray; - } // Resolve default props - - - if (type && type.defaultProps) { - var defaultProps = type.defaultProps; - - for (propName in defaultProps) { - if (props[propName] === undefined) { - props[propName] = defaultProps[propName]; - } - } - } - - { - if (key || ref) { - var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; - - if (key) { - defineKeyPropWarningGetter(props, displayName); - } - - if (ref) { - defineRefPropWarningGetter(props, displayName); - } - } - } - - return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); - } - function cloneAndReplaceKey(oldElement, newKey) { - var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); - return newElement; - } - /** - * Clone and return a new ReactElement using element as the starting point. - * See https://reactjs.org/docs/react-api.html#cloneelement - */ - - function cloneElement(element, config, children) { - if (element === null || element === undefined) { - throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + "."); - } - - var propName; // Original props are copied - - var props = assign({}, element.props); // Reserved names are extracted - - var key = element.key; - var ref = element.ref; // Self is preserved since the owner is preserved. - - var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a - // transpiler, and the original source is probably a better indicator of the - // true owner. - - var source = element._source; // Owner will be preserved, unless ref is overridden - - var owner = element._owner; - - if (config != null) { - if (hasValidRef(config)) { - // Silently steal the ref from the parent. - ref = config.ref; - owner = ReactCurrentOwner.current; - } - - if (hasValidKey(config)) { - { - checkKeyStringCoercion(config.key); - } - - key = '' + config.key; - } // Remaining properties override existing props - - - var defaultProps; - - if (element.type && element.type.defaultProps) { - defaultProps = element.type.defaultProps; - } - - for (propName in config) { - if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { - if (config[propName] === undefined && defaultProps !== undefined) { - // Resolve default props - props[propName] = defaultProps[propName]; - } else { - props[propName] = config[propName]; - } - } - } - } // Children can be more than one argument, and those are transferred onto - // the newly allocated props object. - - - var childrenLength = arguments.length - 2; - - if (childrenLength === 1) { - props.children = children; - } else if (childrenLength > 1) { - var childArray = Array(childrenLength); - - for (var i = 0; i < childrenLength; i++) { - childArray[i] = arguments[i + 2]; - } - - props.children = childArray; - } - - return ReactElement(element.type, key, ref, self, source, owner, props); - } - /** - * Verifies the object is a ReactElement. - * See https://reactjs.org/docs/react-api.html#isvalidelement - * @param {?object} object - * @return {boolean} True if `object` is a ReactElement. - * @final - */ - - function isValidElement(object) { - return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; - } - - var SEPARATOR = '.'; - var SUBSEPARATOR = ':'; - /** - * Escape and wrap key so it is safe to use as a reactid - * - * @param {string} key to be escaped. - * @return {string} the escaped key. - */ - - function escape(key) { - var escapeRegex = /[=:]/g; - var escaperLookup = { - '=': '=0', - ':': '=2' - }; - var escapedString = key.replace(escapeRegex, function (match) { - return escaperLookup[match]; - }); - return '$' + escapedString; - } - /** - * TODO: Test that a single child and an array with one item have the same key - * pattern. - */ - - - var didWarnAboutMaps = false; - var userProvidedKeyEscapeRegex = /\/+/g; - - function escapeUserProvidedKey(text) { - return text.replace(userProvidedKeyEscapeRegex, '$&/'); - } - /** - * Generate a key string that identifies a element within a set. - * - * @param {*} element A element that could contain a manual key. - * @param {number} index Index that is used if a manual key is not provided. - * @return {string} - */ - - - function getElementKey(element, index) { - // Do some typechecking here since we call this blindly. We want to ensure - // that we don't block potential future ES APIs. - if (typeof element === 'object' && element !== null && element.key != null) { - // Explicit key - { - checkKeyStringCoercion(element.key); - } - - return escape('' + element.key); - } // Implicit key determined by the index in the set - - - return index.toString(36); - } - - function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) { - var type = typeof children; - - if (type === 'undefined' || type === 'boolean') { - // All of the above are perceived as null. - children = null; - } - - var invokeCallback = false; - - if (children === null) { - invokeCallback = true; - } else { - switch (type) { - case 'string': - case 'number': - invokeCallback = true; - break; - - case 'object': - switch (children.$$typeof) { - case REACT_ELEMENT_TYPE: - case REACT_PORTAL_TYPE: - invokeCallback = true; - } - - } - } - - if (invokeCallback) { - var _child = children; - var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array - // so that it's consistent if the number of children grows: - - var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar; - - if (isArray(mappedChild)) { - var escapedChildKey = ''; - - if (childKey != null) { - escapedChildKey = escapeUserProvidedKey(childKey) + '/'; - } - - mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) { - return c; - }); - } else if (mappedChild != null) { - if (isValidElement(mappedChild)) { - { - // The `if` statement here prevents auto-disabling of the safe - // coercion ESLint rule, so we must manually disable it below. - // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key - if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) { - checkKeyStringCoercion(mappedChild.key); - } - } - - mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as - // traverseAllChildren used to do for objects as children - escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key - mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number - // eslint-disable-next-line react-internal/safe-string-coercion - escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey); - } - - array.push(mappedChild); - } - - return 1; - } - - var child; - var nextName; - var subtreeCount = 0; // Count of children found in the current subtree. - - var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; - - if (isArray(children)) { - for (var i = 0; i < children.length; i++) { - child = children[i]; - nextName = nextNamePrefix + getElementKey(child, i); - subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback); - } - } else { - var iteratorFn = getIteratorFn(children); - - if (typeof iteratorFn === 'function') { - var iterableChildren = children; - - { - // Warn about using Maps as children - if (iteratorFn === iterableChildren.entries) { - if (!didWarnAboutMaps) { - warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.'); - } - - didWarnAboutMaps = true; - } - } - - var iterator = iteratorFn.call(iterableChildren); - var step; - var ii = 0; - - while (!(step = iterator.next()).done) { - child = step.value; - nextName = nextNamePrefix + getElementKey(child, ii++); - subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback); - } - } else if (type === 'object') { - // eslint-disable-next-line react-internal/safe-string-coercion - var childrenString = String(children); - throw new Error("Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + "). " + 'If you meant to render a collection of children, use an array ' + 'instead.'); - } - } - - return subtreeCount; - } - - /** - * Maps children that are typically specified as `props.children`. - * - * See https://reactjs.org/docs/react-api.html#reactchildrenmap - * - * The provided mapFunction(child, index) will be called for each - * leaf child. - * - * @param {?*} children Children tree container. - * @param {function(*, int)} func The map function. - * @param {*} context Context for mapFunction. - * @return {object} Object containing the ordered map of results. - */ - function mapChildren(children, func, context) { - if (children == null) { - return children; - } - - var result = []; - var count = 0; - mapIntoArray(children, result, '', '', function (child) { - return func.call(context, child, count++); - }); - return result; - } - /** - * Count the number of children that are typically specified as - * `props.children`. - * - * See https://reactjs.org/docs/react-api.html#reactchildrencount - * - * @param {?*} children Children tree container. - * @return {number} The number of children. - */ - - - function countChildren(children) { - var n = 0; - mapChildren(children, function () { - n++; // Don't return anything - }); - return n; - } - - /** - * Iterates through children that are typically specified as `props.children`. - * - * See https://reactjs.org/docs/react-api.html#reactchildrenforeach - * - * The provided forEachFunc(child, index) will be called for each - * leaf child. - * - * @param {?*} children Children tree container. - * @param {function(*, int)} forEachFunc - * @param {*} forEachContext Context for forEachContext. - */ - function forEachChildren(children, forEachFunc, forEachContext) { - mapChildren(children, function () { - forEachFunc.apply(this, arguments); // Don't return anything. - }, forEachContext); - } - /** - * Flatten a children object (typically specified as `props.children`) and - * return an array with appropriately re-keyed children. - * - * See https://reactjs.org/docs/react-api.html#reactchildrentoarray - */ - - - function toArray(children) { - return mapChildren(children, function (child) { - return child; - }) || []; - } - /** - * Returns the first child in a collection of children and verifies that there - * is only one child in the collection. - * - * See https://reactjs.org/docs/react-api.html#reactchildrenonly - * - * The current implementation of this function assumes that a single child gets - * passed without a wrapper, but the purpose of this helper function is to - * abstract away the particular structure of children. - * - * @param {?object} children Child collection structure. - * @return {ReactElement} The first and only `ReactElement` contained in the - * structure. - */ - - - function onlyChild(children) { - if (!isValidElement(children)) { - throw new Error('React.Children.only expected to receive a single React element child.'); - } - - return children; - } - - function createContext(defaultValue) { - // TODO: Second argument used to be an optional `calculateChangedBits` - // function. Warn to reserve for future use? - var context = { - $$typeof: REACT_CONTEXT_TYPE, - // As a workaround to support multiple concurrent renderers, we categorize - // some renderers as primary and others as secondary. We only expect - // there to be two concurrent renderers at most: React Native (primary) and - // Fabric (secondary); React DOM (primary) and React ART (secondary). - // Secondary renderers store their context values on separate fields. - _currentValue: defaultValue, - _currentValue2: defaultValue, - // Used to track how many concurrent renderers this context currently - // supports within in a single renderer. Such as parallel server rendering. - _threadCount: 0, - // These are circular - Provider: null, - Consumer: null, - // Add these to use same hidden class in VM as ServerContext - _defaultValue: null, - _globalName: null - }; - context.Provider = { - $$typeof: REACT_PROVIDER_TYPE, - _context: context - }; - var hasWarnedAboutUsingNestedContextConsumers = false; - var hasWarnedAboutUsingConsumerProvider = false; - var hasWarnedAboutDisplayNameOnConsumer = false; - - { - // A separate object, but proxies back to the original context object for - // backwards compatibility. It has a Different $$typeof, so we can properly - // warn for the incorrect usage of Context as a Consumer. - var Consumer = { - $$typeof: REACT_CONTEXT_TYPE, - _context: context - }; // $FlowFixMe: Flow complains about not setting a value, which is intentional here - - Object.defineProperties(Consumer, { - Provider: { - get: function () { - if (!hasWarnedAboutUsingConsumerProvider) { - hasWarnedAboutUsingConsumerProvider = true; - - error('Rendering is not supported and will be removed in ' + 'a future major release. Did you mean to render instead?'); - } - - return context.Provider; - }, - set: function (_Provider) { - context.Provider = _Provider; - } - }, - _currentValue: { - get: function () { - return context._currentValue; - }, - set: function (_currentValue) { - context._currentValue = _currentValue; - } - }, - _currentValue2: { - get: function () { - return context._currentValue2; - }, - set: function (_currentValue2) { - context._currentValue2 = _currentValue2; - } - }, - _threadCount: { - get: function () { - return context._threadCount; - }, - set: function (_threadCount) { - context._threadCount = _threadCount; - } - }, - Consumer: { - get: function () { - if (!hasWarnedAboutUsingNestedContextConsumers) { - hasWarnedAboutUsingNestedContextConsumers = true; - - error('Rendering is not supported and will be removed in ' + 'a future major release. Did you mean to render instead?'); - } - - return context.Consumer; - } - }, - displayName: { - get: function () { - return context.displayName; - }, - set: function (displayName) { - if (!hasWarnedAboutDisplayNameOnConsumer) { - warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName); - - hasWarnedAboutDisplayNameOnConsumer = true; - } - } - } - }); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty - - context.Consumer = Consumer; - } - - { - context._currentRenderer = null; - context._currentRenderer2 = null; - } - - return context; - } - - var Uninitialized = -1; - var Pending = 0; - var Resolved = 1; - var Rejected = 2; - - function lazyInitializer(payload) { - if (payload._status === Uninitialized) { - var ctor = payload._result; - var thenable = ctor(); // Transition to the next state. - // This might throw either because it's missing or throws. If so, we treat it - // as still uninitialized and try again next time. Which is the same as what - // happens if the ctor or any wrappers processing the ctor throws. This might - // end up fixing it if the resolution was a concurrency bug. - - thenable.then(function (moduleObject) { - if (payload._status === Pending || payload._status === Uninitialized) { - // Transition to the next state. - var resolved = payload; - resolved._status = Resolved; - resolved._result = moduleObject; - } - }, function (error) { - if (payload._status === Pending || payload._status === Uninitialized) { - // Transition to the next state. - var rejected = payload; - rejected._status = Rejected; - rejected._result = error; - } - }); - - if (payload._status === Uninitialized) { - // In case, we're still uninitialized, then we're waiting for the thenable - // to resolve. Set it as pending in the meantime. - var pending = payload; - pending._status = Pending; - pending._result = thenable; - } - } - - if (payload._status === Resolved) { - var moduleObject = payload._result; - - { - if (moduleObject === undefined) { - error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies. - 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))\n\n" + 'Did you accidentally put curly braces around the import?', moduleObject); - } - } - - { - if (!('default' in moduleObject)) { - error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies. - 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject); - } - } - - return moduleObject.default; - } else { - throw payload._result; - } - } - - function lazy(ctor) { - var payload = { - // We use these fields to store the result. - _status: Uninitialized, - _result: ctor - }; - var lazyType = { - $$typeof: REACT_LAZY_TYPE, - _payload: payload, - _init: lazyInitializer - }; - - { - // In production, this would just set it on the object. - var defaultProps; - var propTypes; // $FlowFixMe - - Object.defineProperties(lazyType, { - defaultProps: { - configurable: true, - get: function () { - return defaultProps; - }, - set: function (newDefaultProps) { - error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.'); - - defaultProps = newDefaultProps; // Match production behavior more closely: - // $FlowFixMe - - Object.defineProperty(lazyType, 'defaultProps', { - enumerable: true - }); - } - }, - propTypes: { - configurable: true, - get: function () { - return propTypes; - }, - set: function (newPropTypes) { - error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.'); - - propTypes = newPropTypes; // Match production behavior more closely: - // $FlowFixMe - - Object.defineProperty(lazyType, 'propTypes', { - enumerable: true - }); - } - } - }); - } - - return lazyType; - } - - function forwardRef(render) { - { - if (render != null && render.$$typeof === REACT_MEMO_TYPE) { - error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).'); - } else if (typeof render !== 'function') { - error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render); - } else { - if (render.length !== 0 && render.length !== 2) { - error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.'); - } - } - - if (render != null) { - if (render.defaultProps != null || render.propTypes != null) { - error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?'); - } - } - } - - var elementType = { - $$typeof: REACT_FORWARD_REF_TYPE, - render: render - }; - - { - var ownName; - Object.defineProperty(elementType, 'displayName', { - enumerable: false, - configurable: true, - get: function () { - return ownName; - }, - set: function (name) { - ownName = name; // The inner component shouldn't inherit this display name in most cases, - // because the component may be used elsewhere. - // But it's nice for anonymous functions to inherit the name, - // so that our component-stack generation logic will display their frames. - // An anonymous function generally suggests a pattern like: - // React.forwardRef((props, ref) => {...}); - // This kind of inner function is not used elsewhere so the side effect is okay. - - if (!render.name && !render.displayName) { - render.displayName = name; - } - } - }); - } - - return elementType; - } - - var REACT_MODULE_REFERENCE; - - { - REACT_MODULE_REFERENCE = Symbol.for('react.module.reference'); - } - - function isValidElementType(type) { - if (typeof type === 'string' || typeof type === 'function') { - return true; - } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill). - - - if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) { - return true; - } - - if (typeof type === 'object' && type !== null) { - if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object - // types supported by any Flight configuration anywhere since - // we don't know which Flight build this will end up being used - // with. - type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) { - return true; - } - } - - return false; - } - - function memo(type, compare) { - { - if (!isValidElementType(type)) { - error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type); - } - } - - var elementType = { - $$typeof: REACT_MEMO_TYPE, - type: type, - compare: compare === undefined ? null : compare - }; - - { - var ownName; - Object.defineProperty(elementType, 'displayName', { - enumerable: false, - configurable: true, - get: function () { - return ownName; - }, - set: function (name) { - ownName = name; // The inner component shouldn't inherit this display name in most cases, - // because the component may be used elsewhere. - // But it's nice for anonymous functions to inherit the name, - // so that our component-stack generation logic will display their frames. - // An anonymous function generally suggests a pattern like: - // React.memo((props) => {...}); - // This kind of inner function is not used elsewhere so the side effect is okay. - - if (!type.name && !type.displayName) { - type.displayName = name; - } - } - }); - } - - return elementType; - } - - function resolveDispatcher() { - var dispatcher = ReactCurrentDispatcher.current; - - { - if (dispatcher === null) { - error('Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for' + ' one of the following reasons:\n' + '1. You might have mismatching versions of React and the renderer (such as React DOM)\n' + '2. You might be breaking the Rules of Hooks\n' + '3. You might have more than one copy of React in the same app\n' + 'See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.'); - } - } // Will result in a null access error if accessed outside render phase. We - // intentionally don't throw our own error because this is in a hot path. - // Also helps ensure this is inlined. - - - return dispatcher; - } - function useContext(Context) { - var dispatcher = resolveDispatcher(); - - { - // TODO: add a more generic warning for invalid values. - if (Context._context !== undefined) { - var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs - // and nobody should be using this in existing code. - - if (realContext.Consumer === Context) { - error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?'); - } else if (realContext.Provider === Context) { - error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?'); - } - } - } - - return dispatcher.useContext(Context); - } - function useState(initialState) { - var dispatcher = resolveDispatcher(); - return dispatcher.useState(initialState); - } - function useReducer(reducer, initialArg, init) { - var dispatcher = resolveDispatcher(); - return dispatcher.useReducer(reducer, initialArg, init); - } - function useRef(initialValue) { - var dispatcher = resolveDispatcher(); - return dispatcher.useRef(initialValue); - } - function useEffect(create, deps) { - var dispatcher = resolveDispatcher(); - return dispatcher.useEffect(create, deps); - } - function useInsertionEffect(create, deps) { - var dispatcher = resolveDispatcher(); - return dispatcher.useInsertionEffect(create, deps); - } - function useLayoutEffect(create, deps) { - var dispatcher = resolveDispatcher(); - return dispatcher.useLayoutEffect(create, deps); - } - function useCallback(callback, deps) { - var dispatcher = resolveDispatcher(); - return dispatcher.useCallback(callback, deps); - } - function useMemo(create, deps) { - var dispatcher = resolveDispatcher(); - return dispatcher.useMemo(create, deps); - } - function useImperativeHandle(ref, create, deps) { - var dispatcher = resolveDispatcher(); - return dispatcher.useImperativeHandle(ref, create, deps); - } - function useDebugValue(value, formatterFn) { - { - var dispatcher = resolveDispatcher(); - return dispatcher.useDebugValue(value, formatterFn); - } - } - function useTransition() { - var dispatcher = resolveDispatcher(); - return dispatcher.useTransition(); - } - function useDeferredValue(value) { - var dispatcher = resolveDispatcher(); - return dispatcher.useDeferredValue(value); - } - function useId() { - var dispatcher = resolveDispatcher(); - return dispatcher.useId(); - } - function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { - var dispatcher = resolveDispatcher(); - return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); - } - - // Helpers to patch console.logs to avoid logging during side-effect free - // replaying on render function. This currently only patches the object - // lazily which won't cover if the log function was extracted eagerly. - // We could also eagerly patch the method. - var disabledDepth = 0; - var prevLog; - var prevInfo; - var prevWarn; - var prevError; - var prevGroup; - var prevGroupCollapsed; - var prevGroupEnd; - - function disabledLog() {} - - disabledLog.__reactDisabledLog = true; - function disableLogs() { - { - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - prevLog = console.log; - prevInfo = console.info; - prevWarn = console.warn; - prevError = console.error; - prevGroup = console.group; - prevGroupCollapsed = console.groupCollapsed; - prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 - - var props = { - configurable: true, - enumerable: true, - value: disabledLog, - writable: true - }; // $FlowFixMe Flow thinks console is immutable. - - Object.defineProperties(console, { - info: props, - log: props, - warn: props, - error: props, - group: props, - groupCollapsed: props, - groupEnd: props - }); - /* eslint-enable react-internal/no-production-logging */ - } - - disabledDepth++; - } - } - function reenableLogs() { - { - disabledDepth--; - - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - var props = { - configurable: true, - enumerable: true, - writable: true - }; // $FlowFixMe Flow thinks console is immutable. - - Object.defineProperties(console, { - log: assign({}, props, { - value: prevLog - }), - info: assign({}, props, { - value: prevInfo - }), - warn: assign({}, props, { - value: prevWarn - }), - error: assign({}, props, { - value: prevError - }), - group: assign({}, props, { - value: prevGroup - }), - groupCollapsed: assign({}, props, { - value: prevGroupCollapsed - }), - groupEnd: assign({}, props, { - value: prevGroupEnd - }) - }); - /* eslint-enable react-internal/no-production-logging */ - } - - if (disabledDepth < 0) { - error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); - } - } - } - - var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher; - var prefix; - function describeBuiltInComponentFrame(name, source, ownerFn) { - { - if (prefix === undefined) { - // Extract the VM specific prefix used by each line. - try { - throw Error(); - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = match && match[1] || ''; - } - } // We use the prefix to ensure our stacks line up with native stack frames. - - - return '\n' + prefix + name; - } - } - var reentry = false; - var componentFrameCache; - - { - var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; - componentFrameCache = new PossiblyWeakMap(); - } - - function describeNativeComponentFrame(fn, construct) { - // If something asked for a stack inside a fake render, it should get ignored. - if ( !fn || reentry) { - return ''; - } - - { - var frame = componentFrameCache.get(fn); - - if (frame !== undefined) { - return frame; - } - } - - var control; - reentry = true; - var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined. - - Error.prepareStackTrace = undefined; - var previousDispatcher; - - { - previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function - // for warnings. - - ReactCurrentDispatcher$1.current = null; - disableLogs(); - } - - try { - // This should throw. - if (construct) { - // Something should be setting the props in the constructor. - var Fake = function () { - throw Error(); - }; // $FlowFixMe - - - Object.defineProperty(Fake.prototype, 'props', { - set: function () { - // We use a throwing setter instead of frozen or non-writable props - // because that won't throw in a non-strict mode function. - throw Error(); - } - }); - - if (typeof Reflect === 'object' && Reflect.construct) { - // We construct a Different control for this case to include any extra - // frames added by the construct call. - try { - Reflect.construct(Fake, []); - } catch (x) { - control = x; - } - - Reflect.construct(fn, [], Fake); - } else { - try { - Fake.call(); - } catch (x) { - control = x; - } - - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x) { - control = x; - } - - fn(); - } - } catch (sample) { - // This is inlined manually because closure doesn't do it for us. - if (sample && control && typeof sample.stack === 'string') { - // This extracts the first frame from the sample that isn't also in the control. - // Skipping one frame that we assume is the frame that calls the two. - var sampleLines = sample.stack.split('\n'); - var controlLines = control.stack.split('\n'); - var s = sampleLines.length - 1; - var c = controlLines.length - 1; - - while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { - // We expect at least one stack frame to be shared. - // Typically this will be the root most one. However, stack frames may be - // cut off due to maximum stack limits. In this case, one maybe cut off - // earlier than the other. We assume that the sample is longer or the same - // and there for cut off earlier. So we should find the root most frame in - // the sample somewhere in the control. - c--; - } - - for (; s >= 1 && c >= 0; s--, c--) { - // Next we find the first one that isn't the same which should be the - // frame that called our sample function and the control. - if (sampleLines[s] !== controlLines[c]) { - // In V8, the first line is describing the message but other VMs don't. - // If we're about to return the first line, and the control is also on the same - // line, that's a pretty good indicator that our sample threw at same line as - // the control. I.e. before we entered the sample frame. So we ignore this result. - // This can happen if you passed a class to function component, or non-function. - if (s !== 1 || c !== 1) { - do { - s--; - c--; // We may still have similar intermediate frames from the construct call. - // The next one that isn't the same should be our match though. - - if (c < 0 || sampleLines[s] !== controlLines[c]) { - // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. - var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "" - // but we have a user-provided "displayName" - // splice it in to make the stack more readable. - - - if (fn.displayName && _frame.includes('')) { - _frame = _frame.replace('', fn.displayName); - } - - { - if (typeof fn === 'function') { - componentFrameCache.set(fn, _frame); - } - } // Return the line we found. - - - return _frame; - } - } while (s >= 1 && c >= 0); - } - - break; - } - } - } - } finally { - reentry = false; - - { - ReactCurrentDispatcher$1.current = previousDispatcher; - reenableLogs(); - } - - Error.prepareStackTrace = previousPrepareStackTrace; - } // Fallback to just using the name if we couldn't make it throw. - - - var name = fn ? fn.displayName || fn.name : ''; - var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; - - { - if (typeof fn === 'function') { - componentFrameCache.set(fn, syntheticFrame); - } - } - - return syntheticFrame; - } - function describeFunctionComponentFrame(fn, source, ownerFn) { - { - return describeNativeComponentFrame(fn, false); - } - } - - function shouldConstruct(Component) { - var prototype = Component.prototype; - return !!(prototype && prototype.isReactComponent); - } - - function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) { - - if (type == null) { - return ''; - } - - if (typeof type === 'function') { - { - return describeNativeComponentFrame(type, shouldConstruct(type)); - } - } - - if (typeof type === 'string') { - return describeBuiltInComponentFrame(type); - } - - switch (type) { - case REACT_SUSPENSE_TYPE: - return describeBuiltInComponentFrame('Suspense'); - - case REACT_SUSPENSE_LIST_TYPE: - return describeBuiltInComponentFrame('SuspenseList'); - } - - if (typeof type === 'object') { - switch (type.$$typeof) { - case REACT_FORWARD_REF_TYPE: - return describeFunctionComponentFrame(type.render); - - case REACT_MEMO_TYPE: - // Memo may contain any component type so we recursively resolve it. - return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn); - - case REACT_LAZY_TYPE: - { - var lazyComponent = type; - var payload = lazyComponent._payload; - var init = lazyComponent._init; - - try { - // Lazy may contain any component type so we recursively resolve it. - return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn); - } catch (x) {} - } - } - } - - return ''; - } - - var loggedTypeFailures = {}; - var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; - - function setCurrentlyValidatingElement(element) { - { - if (element) { - var owner = element._owner; - var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); - ReactDebugCurrentFrame$1.setExtraStackFrame(stack); - } else { - ReactDebugCurrentFrame$1.setExtraStackFrame(null); - } - } - } - - function checkPropTypes(typeSpecs, values, location, componentName, element) { - { - // $FlowFixMe This is okay but Flow doesn't know it. - var has = Function.call.bind(hasOwnProperty); - - for (var typeSpecName in typeSpecs) { - if (has(typeSpecs, typeSpecName)) { - var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to - // fail the render phase where it didn't fail before. So we log it. - // After these have been cleaned up, we'll let them throw. - - try { - // This is intentionally an invariant that gets caught. It's the same - // behavior as without this statement except with a better message. - if (typeof typeSpecs[typeSpecName] !== 'function') { - // eslint-disable-next-line react-internal/prod-error-codes - var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'); - err.name = 'Invariant Violation'; - throw err; - } - - error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'); - } catch (ex) { - error$1 = ex; - } - - if (error$1 && !(error$1 instanceof Error)) { - setCurrentlyValidatingElement(element); - - error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1); - - setCurrentlyValidatingElement(null); - } - - if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) { - // Only monitor this failure once because there tends to be a lot of the - // same error. - loggedTypeFailures[error$1.message] = true; - setCurrentlyValidatingElement(element); - - error('Failed %s type: %s', location, error$1.message); - - setCurrentlyValidatingElement(null); - } - } - } - } - } - - function setCurrentlyValidatingElement$1(element) { - { - if (element) { - var owner = element._owner; - var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); - setExtraStackFrame(stack); - } else { - setExtraStackFrame(null); - } - } - } - - var propTypesMisspellWarningShown; - - { - propTypesMisspellWarningShown = false; - } - - function getDeclarationErrorAddendum() { - if (ReactCurrentOwner.current) { - var name = getComponentNameFromType(ReactCurrentOwner.current.type); - - if (name) { - return '\n\nCheck the render method of `' + name + '`.'; - } - } - - return ''; - } - - function getSourceInfoErrorAddendum(source) { - if (source !== undefined) { - var fileName = source.fileName.replace(/^.*[\\\/]/, ''); - var lineNumber = source.lineNumber; - return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.'; - } - - return ''; - } - - function getSourceInfoErrorAddendumForProps(elementProps) { - if (elementProps !== null && elementProps !== undefined) { - return getSourceInfoErrorAddendum(elementProps.__source); - } - - return ''; - } - /** - * Warn if there's no key explicitly set on dynamic arrays of children or - * object keys are not valid. This allows us to keep track of children between - * updates. - */ - - - var ownerHasKeyUseWarning = {}; - - function getCurrentComponentErrorInfo(parentType) { - var info = getDeclarationErrorAddendum(); - - if (!info) { - var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; - - if (parentName) { - info = "\n\nCheck the top-level render call using <" + parentName + ">."; - } - } - - return info; - } - /** - * Warn if the element doesn't have an explicit key assigned to it. - * This element is in an array. The array could grow and shrink or be - * reordered. All children that haven't already been validated are required to - * have a "key" property assigned to it. Error statuses are cached so a warning - * will only be shown once. - * - * @internal - * @param {ReactElement} element Element that requires a key. - * @param {*} parentType element's parent's type. - */ - - - function validateExplicitKey(element, parentType) { - if (!element._store || element._store.validated || element.key != null) { - return; - } - - element._store.validated = true; - var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); - - if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { - return; - } - - ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a - // property, it may be the creator of the child that's responsible for - // assigning it a key. - - var childOwner = ''; - - if (element && element._owner && element._owner !== ReactCurrentOwner.current) { - // Give the component that originally created this child. - childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + "."; - } - - { - setCurrentlyValidatingElement$1(element); - - error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner); - - setCurrentlyValidatingElement$1(null); - } - } - /** - * Ensure that every element either is passed in a static location, in an - * array with an explicit keys property defined, or in an object literal - * with valid key property. - * - * @internal - * @param {ReactNode} node Statically passed child of any type. - * @param {*} parentType node's parent's type. - */ - - - function validateChildKeys(node, parentType) { - if (typeof node !== 'object') { - return; - } - - if (isArray(node)) { - for (var i = 0; i < node.length; i++) { - var child = node[i]; - - if (isValidElement(child)) { - validateExplicitKey(child, parentType); - } - } - } else if (isValidElement(node)) { - // This element was passed in a valid location. - if (node._store) { - node._store.validated = true; - } - } else if (node) { - var iteratorFn = getIteratorFn(node); - - if (typeof iteratorFn === 'function') { - // Entry iterators used to provide implicit keys, - // but now we print a separate warning for them later. - if (iteratorFn !== node.entries) { - var iterator = iteratorFn.call(node); - var step; - - while (!(step = iterator.next()).done) { - if (isValidElement(step.value)) { - validateExplicitKey(step.value, parentType); - } - } - } - } - } - } - /** - * Given an element, validate that its props follow the propTypes definition, - * provided by the type. - * - * @param {ReactElement} element - */ - - - function validatePropTypes(element) { - { - var type = element.type; - - if (type === null || type === undefined || typeof type === 'string') { - return; - } - - var propTypes; - - if (typeof type === 'function') { - propTypes = type.propTypes; - } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here. - // Inner props are checked in the reconciler. - type.$$typeof === REACT_MEMO_TYPE)) { - propTypes = type.propTypes; - } else { - return; - } - - if (propTypes) { - // Intentionally inside to avoid triggering lazy initializers: - var name = getComponentNameFromType(type); - checkPropTypes(propTypes, element.props, 'prop', name, element); - } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) { - propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers: - - var _name = getComponentNameFromType(type); - - error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown'); - } - - if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) { - error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.'); - } - } - } - /** - * Given a fragment, validate that it can only be provided with fragment props - * @param {ReactElement} fragment - */ - - - function validateFragmentProps(fragment) { - { - var keys = Object.keys(fragment.props); - - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - - if (key !== 'children' && key !== 'key') { - setCurrentlyValidatingElement$1(fragment); - - error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); - - setCurrentlyValidatingElement$1(null); - break; - } - } - - if (fragment.ref !== null) { - setCurrentlyValidatingElement$1(fragment); - - error('Invalid attribute `ref` supplied to `React.Fragment`.'); - - setCurrentlyValidatingElement$1(null); - } - } - } - function createElementWithValidation(type, props, children) { - var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to - // succeed and there will likely be errors in render. - - if (!validType) { - var info = ''; - - if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { - info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; - } - - var sourceInfo = getSourceInfoErrorAddendumForProps(props); - - if (sourceInfo) { - info += sourceInfo; - } else { - info += getDeclarationErrorAddendum(); - } - - var typeString; - - if (type === null) { - typeString = 'null'; - } else if (isArray(type)) { - typeString = 'array'; - } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) { - typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />"; - info = ' Did you accidentally export a JSX literal instead of a component?'; - } else { - typeString = typeof type; - } - - { - error('React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info); - } - } - - var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used. - // TODO: Drop this when these are no longer allowed as the type argument. - - if (element == null) { - return element; - } // Skip key warning if the type isn't valid since our key validation logic - // doesn't expect a non-string/function type and can throw confusing errors. - // We don't want exception behavior to differ between dev.log and prod. - // (Rendering will throw with a helpful message and as soon as the type is - // fixed, the key warnings will appear.) - - - if (validType) { - for (var i = 2; i < arguments.length; i++) { - validateChildKeys(arguments[i], type); - } - } - - if (type === REACT_FRAGMENT_TYPE) { - validateFragmentProps(element); - } else { - validatePropTypes(element); - } - - return element; - } - var didWarnAboutDeprecatedCreateFactory = false; - function createFactoryWithValidation(type) { - var validatedFactory = createElementWithValidation.bind(null, type); - validatedFactory.type = type; - - { - if (!didWarnAboutDeprecatedCreateFactory) { - didWarnAboutDeprecatedCreateFactory = true; - - warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.'); - } // Legacy hook: remove it - - - Object.defineProperty(validatedFactory, 'type', { - enumerable: false, - get: function () { - warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.'); - - Object.defineProperty(this, 'type', { - value: type - }); - return type; - } - }); - } - - return validatedFactory; - } - function cloneElementWithValidation(element, props, children) { - var newElement = cloneElement.apply(this, arguments); - - for (var i = 2; i < arguments.length; i++) { - validateChildKeys(arguments[i], newElement.type); - } - - validatePropTypes(newElement); - return newElement; - } - - var enableSchedulerDebugging = false; - var enableProfiling = false; - var frameYieldMs = 5; - - function push(heap, node) { - var index = heap.length; - heap.push(node); - siftUp(heap, node, index); - } - function peek(heap) { - return heap.length === 0 ? null : heap[0]; - } - function pop(heap) { - if (heap.length === 0) { - return null; - } - - var first = heap[0]; - var last = heap.pop(); - - if (last !== first) { - heap[0] = last; - siftDown(heap, last, 0); - } - - return first; - } - - function siftUp(heap, node, i) { - var index = i; - - while (index > 0) { - var parentIndex = index - 1 >>> 1; - var parent = heap[parentIndex]; - - if (compare(parent, node) > 0) { - // The parent is larger. Swap positions. - heap[parentIndex] = node; - heap[index] = parent; - index = parentIndex; - } else { - // The parent is smaller. Exit. - return; - } - } - } - - function siftDown(heap, node, i) { - var index = i; - var length = heap.length; - var halfLength = length >>> 1; - - while (index < halfLength) { - var leftIndex = (index + 1) * 2 - 1; - var left = heap[leftIndex]; - var rightIndex = leftIndex + 1; - var right = heap[rightIndex]; // If the left or right node is smaller, swap with the smaller of those. - - if (compare(left, node) < 0) { - if (rightIndex < length && compare(right, left) < 0) { - heap[index] = right; - heap[rightIndex] = node; - index = rightIndex; - } else { - heap[index] = left; - heap[leftIndex] = node; - index = leftIndex; - } - } else if (rightIndex < length && compare(right, node) < 0) { - heap[index] = right; - heap[rightIndex] = node; - index = rightIndex; - } else { - // Neither child is smaller. Exit. - return; - } - } - } - - function compare(a, b) { - // Compare sort index first, then task id. - var diff = a.sortIndex - b.sortIndex; - return diff !== 0 ? diff : a.id - b.id; - } - - // TODO: Use symbols? - var ImmediatePriority = 1; - var UserBlockingPriority = 2; - var NormalPriority = 3; - var LowPriority = 4; - var IdlePriority = 5; - - function markTaskErrored(task, ms) { - } - - /* eslint-disable no-var */ - var getCurrentTime; - var hasPerformanceNow = typeof performance === 'object' && typeof performance.now === 'function'; - - if (hasPerformanceNow) { - var localPerformance = performance; - - getCurrentTime = function () { - return localPerformance.now(); - }; - } else { - var localDate = Date; - var initialTime = localDate.now(); - - getCurrentTime = function () { - return localDate.now() - initialTime; - }; - } // Max 31 bit integer. The max integer size in V8 for 32-bit systems. - // Math.pow(2, 30) - 1 - // 0b111111111111111111111111111111 - - - var maxSigned31BitInt = 1073741823; // Times out immediately - - var IMMEDIATE_PRIORITY_TIMEOUT = -1; // Eventually times out - - var USER_BLOCKING_PRIORITY_TIMEOUT = 250; - var NORMAL_PRIORITY_TIMEOUT = 5000; - var LOW_PRIORITY_TIMEOUT = 10000; // Never times out - - var IDLE_PRIORITY_TIMEOUT = maxSigned31BitInt; // tasks are stored on a min heap - - var taskQueue = []; - var timerQueue = []; // Incrementing id counter. Used to maintain insertion order. - - var taskIdCounter = 1; // Pausing the scheduler is useful for debugging. - var currentTask = null; - var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrance. - - var isPerformingWork = false; - var isHostCallbackScheduled = false; - var isHostTimeoutScheduled = false; // Capture local references to native APIs, in case a polyfill overrides them. - - var localSetTimeout = typeof setTimeout === 'function' ? setTimeout : null; - var localClearTimeout = typeof clearTimeout === 'function' ? clearTimeout : null; - var localSetImmediate = typeof setImmediate !== 'undefined' ? setImmediate : null; // IE and Node.js + jsdom - - var isInputPending = typeof navigator !== 'undefined' && navigator.scheduling !== undefined && navigator.scheduling.isInputPending !== undefined ? navigator.scheduling.isInputPending.bind(navigator.scheduling) : null; - - function advanceTimers(currentTime) { - // Check for tasks that are no longer delayed and add them to the queue. - var timer = peek(timerQueue); - - while (timer !== null) { - if (timer.callback === null) { - // Timer was cancelled. - pop(timerQueue); - } else if (timer.startTime <= currentTime) { - // Timer fired. Transfer to the task queue. - pop(timerQueue); - timer.sortIndex = timer.expirationTime; - push(taskQueue, timer); - } else { - // Remaining timers are pending. - return; - } - - timer = peek(timerQueue); - } - } - - function handleTimeout(currentTime) { - isHostTimeoutScheduled = false; - advanceTimers(currentTime); - - if (!isHostCallbackScheduled) { - if (peek(taskQueue) !== null) { - isHostCallbackScheduled = true; - requestHostCallback(flushWork); - } else { - var firstTimer = peek(timerQueue); - - if (firstTimer !== null) { - requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); - } - } - } - } - - function flushWork(hasTimeRemaining, initialTime) { - - - isHostCallbackScheduled = false; - - if (isHostTimeoutScheduled) { - // We scheduled a timeout but it's no longer needed. Cancel it. - isHostTimeoutScheduled = false; - cancelHostTimeout(); - } - - isPerformingWork = true; - var previousPriorityLevel = currentPriorityLevel; - - try { - if (enableProfiling) { - try { - return workLoop(hasTimeRemaining, initialTime); - } catch (error) { - if (currentTask !== null) { - var currentTime = getCurrentTime(); - markTaskErrored(currentTask, currentTime); - currentTask.isQueued = false; - } - - throw error; - } - } else { - // No catch in prod code path. - return workLoop(hasTimeRemaining, initialTime); - } - } finally { - currentTask = null; - currentPriorityLevel = previousPriorityLevel; - isPerformingWork = false; - } - } - - function workLoop(hasTimeRemaining, initialTime) { - var currentTime = initialTime; - advanceTimers(currentTime); - currentTask = peek(taskQueue); - - while (currentTask !== null && !(enableSchedulerDebugging )) { - if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost())) { - // This currentTask hasn't expired, and we've reached the deadline. - break; - } - - var callback = currentTask.callback; - - if (typeof callback === 'function') { - currentTask.callback = null; - currentPriorityLevel = currentTask.priorityLevel; - var didUserCallbackTimeout = currentTask.expirationTime <= currentTime; - - var continuationCallback = callback(didUserCallbackTimeout); - currentTime = getCurrentTime(); - - if (typeof continuationCallback === 'function') { - currentTask.callback = continuationCallback; - } else { - - if (currentTask === peek(taskQueue)) { - pop(taskQueue); - } - } - - advanceTimers(currentTime); - } else { - pop(taskQueue); - } - - currentTask = peek(taskQueue); - } // Return whether there's additional work - - - if (currentTask !== null) { - return true; - } else { - var firstTimer = peek(timerQueue); - - if (firstTimer !== null) { - requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); - } - - return false; - } - } - - function unstable_runWithPriority(priorityLevel, eventHandler) { - switch (priorityLevel) { - case ImmediatePriority: - case UserBlockingPriority: - case NormalPriority: - case LowPriority: - case IdlePriority: - break; - - default: - priorityLevel = NormalPriority; - } - - var previousPriorityLevel = currentPriorityLevel; - currentPriorityLevel = priorityLevel; - - try { - return eventHandler(); - } finally { - currentPriorityLevel = previousPriorityLevel; - } - } - - function unstable_next(eventHandler) { - var priorityLevel; - - switch (currentPriorityLevel) { - case ImmediatePriority: - case UserBlockingPriority: - case NormalPriority: - // Shift down to normal priority - priorityLevel = NormalPriority; - break; - - default: - // Anything lower than normal priority should remain at the current level. - priorityLevel = currentPriorityLevel; - break; - } - - var previousPriorityLevel = currentPriorityLevel; - currentPriorityLevel = priorityLevel; - - try { - return eventHandler(); - } finally { - currentPriorityLevel = previousPriorityLevel; - } - } - - function unstable_wrapCallback(callback) { - var parentPriorityLevel = currentPriorityLevel; - return function () { - // This is a fork of runWithPriority, inlined for performance. - var previousPriorityLevel = currentPriorityLevel; - currentPriorityLevel = parentPriorityLevel; - - try { - return callback.apply(this, arguments); - } finally { - currentPriorityLevel = previousPriorityLevel; - } - }; - } - - function unstable_scheduleCallback(priorityLevel, callback, options) { - var currentTime = getCurrentTime(); - var startTime; - - if (typeof options === 'object' && options !== null) { - var delay = options.delay; - - if (typeof delay === 'number' && delay > 0) { - startTime = currentTime + delay; - } else { - startTime = currentTime; - } - } else { - startTime = currentTime; - } - - var timeout; - - switch (priorityLevel) { - case ImmediatePriority: - timeout = IMMEDIATE_PRIORITY_TIMEOUT; - break; - - case UserBlockingPriority: - timeout = USER_BLOCKING_PRIORITY_TIMEOUT; - break; - - case IdlePriority: - timeout = IDLE_PRIORITY_TIMEOUT; - break; - - case LowPriority: - timeout = LOW_PRIORITY_TIMEOUT; - break; - - case NormalPriority: - default: - timeout = NORMAL_PRIORITY_TIMEOUT; - break; - } - - var expirationTime = startTime + timeout; - var newTask = { - id: taskIdCounter++, - callback: callback, - priorityLevel: priorityLevel, - startTime: startTime, - expirationTime: expirationTime, - sortIndex: -1 - }; - - if (startTime > currentTime) { - // This is a delayed task. - newTask.sortIndex = startTime; - push(timerQueue, newTask); - - if (peek(taskQueue) === null && newTask === peek(timerQueue)) { - // All tasks are delayed, and this is the task with the earliest delay. - if (isHostTimeoutScheduled) { - // Cancel an existing timeout. - cancelHostTimeout(); - } else { - isHostTimeoutScheduled = true; - } // Schedule a timeout. - - - requestHostTimeout(handleTimeout, startTime - currentTime); - } - } else { - newTask.sortIndex = expirationTime; - push(taskQueue, newTask); - // wait until the next time we yield. - - - if (!isHostCallbackScheduled && !isPerformingWork) { - isHostCallbackScheduled = true; - requestHostCallback(flushWork); - } - } - - return newTask; - } - - function unstable_pauseExecution() { - } - - function unstable_continueExecution() { - - if (!isHostCallbackScheduled && !isPerformingWork) { - isHostCallbackScheduled = true; - requestHostCallback(flushWork); - } - } - - function unstable_getFirstCallbackNode() { - return peek(taskQueue); - } - - function unstable_cancelCallback(task) { - // remove from the queue because you can't remove arbitrary nodes from an - // array based heap, only the first one.) - - - task.callback = null; - } - - function unstable_getCurrentPriorityLevel() { - return currentPriorityLevel; - } - - var isMessageLoopRunning = false; - var scheduledHostCallback = null; - var taskTimeoutID = -1; // Scheduler periodically yields in case there is other work on the main - // thread, like user events. By default, it yields multiple times per frame. - // It does not attempt to align with frame boundaries, since most tasks don't - // need to be frame aligned; for those that do, use requestAnimationFrame. - - var frameInterval = frameYieldMs; - var startTime = -1; - - function shouldYieldToHost() { - var timeElapsed = getCurrentTime() - startTime; - - if (timeElapsed < frameInterval) { - // The main thread has only been blocked for a really short amount of time; - // smaller than a single frame. Don't yield yet. - return false; - } // The main thread has been blocked for a non-negligible amount of time. We - - - return true; - } - - function requestPaint() { - - } - - function forceFrameRate(fps) { - if (fps < 0 || fps > 125) { - // Using console['error'] to evade Babel and ESLint - console['error']('forceFrameRate takes a positive int between 0 and 125, ' + 'forcing frame rates higher than 125 fps is not supported'); - return; - } - - if (fps > 0) { - frameInterval = Math.floor(1000 / fps); - } else { - // reset the framerate - frameInterval = frameYieldMs; - } - } - - var performWorkUntilDeadline = function () { - if (scheduledHostCallback !== null) { - var currentTime = getCurrentTime(); // Keep track of the start time so we can measure how long the main thread - // has been blocked. - - startTime = currentTime; - var hasTimeRemaining = true; // If a scheduler task throws, exit the current browser task so the - // error can be observed. - // - // Intentionally not using a try-catch, since that makes some debugging - // techniques harder. Instead, if `scheduledHostCallback` errors, then - // `hasMoreWork` will remain true, and we'll continue the work loop. - - var hasMoreWork = true; - - try { - hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime); - } finally { - if (hasMoreWork) { - // If there's more work, schedule the next message event at the end - // of the preceding one. - schedulePerformWorkUntilDeadline(); - } else { - isMessageLoopRunning = false; - scheduledHostCallback = null; - } - } - } else { - isMessageLoopRunning = false; - } // Yielding to the browser will give it a chance to paint, so we can - }; - - var schedulePerformWorkUntilDeadline; - - if (typeof localSetImmediate === 'function') { - // Node.js and old IE. - // There's a few reasons for why we prefer setImmediate. - // - // Unlike MessageChannel, it doesn't prevent a Node.js process from exiting. - // (Even though this is a DOM fork of the Scheduler, you could get here - // with a mix of Node.js 15+, which has a MessageChannel, and jsdom.) - // https://github.com/facebook/react/issues/20756 - // - // But also, it runs earlier which is the semantic we want. - // If other browsers ever implement it, it's better to use it. - // Although both of these would be inferior to native scheduling. - schedulePerformWorkUntilDeadline = function () { - localSetImmediate(performWorkUntilDeadline); - }; - } else if (typeof MessageChannel !== 'undefined') { - // DOM and Worker environments. - // We prefer MessageChannel because of the 4ms setTimeout clamping. - var channel = new MessageChannel(); - var port = channel.port2; - channel.port1.onmessage = performWorkUntilDeadline; - - schedulePerformWorkUntilDeadline = function () { - port.postMessage(null); - }; - } else { - // We should only fallback here in non-browser environments. - schedulePerformWorkUntilDeadline = function () { - localSetTimeout(performWorkUntilDeadline, 0); - }; - } - - function requestHostCallback(callback) { - scheduledHostCallback = callback; - - if (!isMessageLoopRunning) { - isMessageLoopRunning = true; - schedulePerformWorkUntilDeadline(); - } - } - - function requestHostTimeout(callback, ms) { - taskTimeoutID = localSetTimeout(function () { - callback(getCurrentTime()); - }, ms); - } - - function cancelHostTimeout() { - localClearTimeout(taskTimeoutID); - taskTimeoutID = -1; - } - - var unstable_requestPaint = requestPaint; - var unstable_Profiling = null; - - - - var Scheduler = /*#__PURE__*/Object.freeze({ - __proto__: null, - unstable_ImmediatePriority: ImmediatePriority, - unstable_UserBlockingPriority: UserBlockingPriority, - unstable_NormalPriority: NormalPriority, - unstable_IdlePriority: IdlePriority, - unstable_LowPriority: LowPriority, - unstable_runWithPriority: unstable_runWithPriority, - unstable_next: unstable_next, - unstable_scheduleCallback: unstable_scheduleCallback, - unstable_cancelCallback: unstable_cancelCallback, - unstable_wrapCallback: unstable_wrapCallback, - unstable_getCurrentPriorityLevel: unstable_getCurrentPriorityLevel, - unstable_shouldYield: shouldYieldToHost, - unstable_requestPaint: unstable_requestPaint, - unstable_continueExecution: unstable_continueExecution, - unstable_pauseExecution: unstable_pauseExecution, - unstable_getFirstCallbackNode: unstable_getFirstCallbackNode, - get unstable_now () { return getCurrentTime; }, - unstable_forceFrameRate: forceFrameRate, - unstable_Profiling: unstable_Profiling - }); - - var ReactSharedInternals$1 = { - ReactCurrentDispatcher: ReactCurrentDispatcher, - ReactCurrentOwner: ReactCurrentOwner, - ReactCurrentBatchConfig: ReactCurrentBatchConfig, - // Re-export the schedule API(s) for UMD bundles. - // This avoids introducing a dependency on a new UMD global in a minor update, - // Since that would be a breaking change (e.g. for all existing CodeSandboxes). - // This re-export is only required for UMD bundles; - // CJS bundles use the shared NPM package. - Scheduler: Scheduler - }; - - { - ReactSharedInternals$1.ReactCurrentActQueue = ReactCurrentActQueue; - ReactSharedInternals$1.ReactDebugCurrentFrame = ReactDebugCurrentFrame; - } - - function startTransition(scope, options) { - var prevTransition = ReactCurrentBatchConfig.transition; - ReactCurrentBatchConfig.transition = {}; - var currentTransition = ReactCurrentBatchConfig.transition; - - { - ReactCurrentBatchConfig.transition._updatedFibers = new Set(); - } - - try { - scope(); - } finally { - ReactCurrentBatchConfig.transition = prevTransition; - - { - if (prevTransition === null && currentTransition._updatedFibers) { - var updatedFibersCount = currentTransition._updatedFibers.size; - - if (updatedFibersCount > 10) { - warn('Detected a large number of updates inside startTransition. ' + 'If this is due to a subscription please re-write it to use React provided hooks. ' + 'Otherwise concurrent mode guarantees are off the table.'); - } - - currentTransition._updatedFibers.clear(); - } - } - } - } - - var didWarnAboutMessageChannel = false; - var enqueueTaskImpl = null; - function enqueueTask(task) { - if (enqueueTaskImpl === null) { - try { - // read require off the module object to get around the bundlers. - // we don't want them to detect a require and bundle a Node polyfill. - var requireString = ('require' + Math.random()).slice(0, 7); - var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's - // version of setImmediate, bypassing fake timers if any. - - enqueueTaskImpl = nodeRequire.call(module, 'timers').setImmediate; - } catch (_err) { - // we're in a browser - // we can't use regular timers because they may still be faked - // so we try MessageChannel+postMessage instead - enqueueTaskImpl = function (callback) { - { - if (didWarnAboutMessageChannel === false) { - didWarnAboutMessageChannel = true; - - if (typeof MessageChannel === 'undefined') { - error('This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.'); - } - } - } - - var channel = new MessageChannel(); - channel.port1.onmessage = callback; - channel.port2.postMessage(undefined); - }; - } - } - - return enqueueTaskImpl(task); - } - - var actScopeDepth = 0; - var didWarnNoAwaitAct = false; - function act(callback) { - { - // `act` calls can be nested, so we track the depth. This represents the - // number of `act` scopes on the stack. - var prevActScopeDepth = actScopeDepth; - actScopeDepth++; - - if (ReactCurrentActQueue.current === null) { - // This is the outermost `act` scope. Initialize the queue. The reconciler - // will detect the queue and use it instead of Scheduler. - ReactCurrentActQueue.current = []; - } - - var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy; - var result; - - try { - // Used to reproduce behavior of `batchedUpdates` in legacy mode. Only - // set to `true` while the given callback is executed, not for updates - // triggered during an async event, because this is how the legacy - // implementation of `act` behaved. - ReactCurrentActQueue.isBatchingLegacy = true; - result = callback(); // Replicate behavior of original `act` implementation in legacy mode, - // which flushed updates immediately after the scope function exits, even - // if it's an async function. - - if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) { - var queue = ReactCurrentActQueue.current; - - if (queue !== null) { - ReactCurrentActQueue.didScheduleLegacyUpdate = false; - flushActQueue(queue); - } - } - } catch (error) { - popActScope(prevActScopeDepth); - throw error; - } finally { - ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy; - } - - if (result !== null && typeof result === 'object' && typeof result.then === 'function') { - var thenableResult = result; // The callback is an async function (i.e. returned a promise). Wait - // for it to resolve before exiting the current scope. - - var wasAwaited = false; - var thenable = { - then: function (resolve, reject) { - wasAwaited = true; - thenableResult.then(function (returnValue) { - popActScope(prevActScopeDepth); - - if (actScopeDepth === 0) { - // We've exited the outermost act scope. Recursively flush the - // queue until there's no remaining work. - recursivelyFlushAsyncActWork(returnValue, resolve, reject); - } else { - resolve(returnValue); - } - }, function (error) { - // The callback threw an error. - popActScope(prevActScopeDepth); - reject(error); - }); - } - }; - - { - if (!didWarnNoAwaitAct && typeof Promise !== 'undefined') { - // eslint-disable-next-line no-undef - Promise.resolve().then(function () {}).then(function () { - if (!wasAwaited) { - didWarnNoAwaitAct = true; - - error('You called act(async () => ...) without await. ' + 'This could lead to unexpected testing behaviour, ' + 'interleaving multiple act calls and mixing their ' + 'scopes. ' + 'You should - await act(async () => ...);'); - } - }); - } - } - - return thenable; - } else { - var returnValue = result; // The callback is not an async function. Exit the current scope - // immediately, without awaiting. - - popActScope(prevActScopeDepth); - - if (actScopeDepth === 0) { - // Exiting the outermost act scope. Flush the queue. - var _queue = ReactCurrentActQueue.current; - - if (_queue !== null) { - flushActQueue(_queue); - ReactCurrentActQueue.current = null; - } // Return a thenable. If the user awaits it, we'll flush again in - // case additional work was scheduled by a microtask. - - - var _thenable = { - then: function (resolve, reject) { - // Confirm we haven't re-entered another `act` scope, in case - // the user does something weird like await the thenable - // multiple times. - if (ReactCurrentActQueue.current === null) { - // Recursively flush the queue until there's no remaining work. - ReactCurrentActQueue.current = []; - recursivelyFlushAsyncActWork(returnValue, resolve, reject); - } else { - resolve(returnValue); - } - } - }; - return _thenable; - } else { - // Since we're inside a nested `act` scope, the returned thenable - // immediately resolves. The outer scope will flush the queue. - var _thenable2 = { - then: function (resolve, reject) { - resolve(returnValue); - } - }; - return _thenable2; - } - } - } - } - - function popActScope(prevActScopeDepth) { - { - if (prevActScopeDepth !== actScopeDepth - 1) { - error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. '); - } - - actScopeDepth = prevActScopeDepth; - } - } - - function recursivelyFlushAsyncActWork(returnValue, resolve, reject) { - { - var queue = ReactCurrentActQueue.current; - - if (queue !== null) { - try { - flushActQueue(queue); - enqueueTask(function () { - if (queue.length === 0) { - // No additional work was scheduled. Finish. - ReactCurrentActQueue.current = null; - resolve(returnValue); - } else { - // Keep flushing work until there's none left. - recursivelyFlushAsyncActWork(returnValue, resolve, reject); - } - }); - } catch (error) { - reject(error); - } - } else { - resolve(returnValue); - } - } - } - - var isFlushing = false; - - function flushActQueue(queue) { - { - if (!isFlushing) { - // Prevent re-entrance. - isFlushing = true; - var i = 0; - - try { - for (; i < queue.length; i++) { - var callback = queue[i]; - - do { - callback = callback(true); - } while (callback !== null); - } - - queue.length = 0; - } catch (error) { - // If something throws, leave the remaining callbacks on the queue. - queue = queue.slice(i + 1); - throw error; - } finally { - isFlushing = false; - } - } - } - } - - var createElement$1 = createElementWithValidation ; - var cloneElement$1 = cloneElementWithValidation ; - var createFactory = createFactoryWithValidation ; - var Children = { - map: mapChildren, - forEach: forEachChildren, - count: countChildren, - toArray: toArray, - only: onlyChild - }; - - exports.Children = Children; - exports.Component = Component; - exports.Fragment = REACT_FRAGMENT_TYPE; - exports.Profiler = REACT_PROFILER_TYPE; - exports.PureComponent = PureComponent; - exports.StrictMode = REACT_STRICT_MODE_TYPE; - exports.Suspense = REACT_SUSPENSE_TYPE; - exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals$1; - exports.act = act; - exports.cloneElement = cloneElement$1; - exports.createContext = createContext; - exports.createElement = createElement$1; - exports.createFactory = createFactory; - exports.createRef = createRef; - exports.forwardRef = forwardRef; - exports.isValidElement = isValidElement; - exports.lazy = lazy; - exports.memo = memo; - exports.startTransition = startTransition; - exports.unstable_act = act; - exports.useCallback = useCallback; - exports.useContext = useContext; - exports.useDebugValue = useDebugValue; - exports.useDeferredValue = useDeferredValue; - exports.useEffect = useEffect; - exports.useId = useId; - exports.useImperativeHandle = useImperativeHandle; - exports.useInsertionEffect = useInsertionEffect; - exports.useLayoutEffect = useLayoutEffect; - exports.useMemo = useMemo; - exports.useReducer = useReducer; - exports.useRef = useRef; - exports.useState = useState; - exports.useSyncExternalStore = useSyncExternalStore; - exports.useTransition = useTransition; - exports.version = ReactVersion; - -})));