Repository: nraiden/cofounder Branch: main Commit: 19ba19f61737 Files: 309 Total size: 1.9 MB Directory structure: gitextract_zsblhoht/ ├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── ROADMAP.md ├── TODO.md ├── apps/ │ └── README.md ├── benchmarks/ │ └── README.md └── cofounder/ ├── api/ │ ├── .gitignore │ ├── .prettierignore │ ├── .prettierrc │ ├── README.md │ ├── build.js │ ├── db/ │ │ ├── README.md │ │ ├── index/ │ │ │ └── README.md │ │ ├── projects/ │ │ │ └── README.md │ │ └── storage/ │ │ └── README.md │ ├── dist/ │ │ ├── assets/ │ │ │ ├── index-B1d7LZHm.js │ │ │ └── index-COffgP7k.css │ │ └── index.html │ ├── package.json │ ├── server.js │ ├── system/ │ │ ├── functions/ │ │ │ ├── backend/ │ │ │ │ ├── asyncapi.js │ │ │ │ ├── openapi.js │ │ │ │ └── server.js │ │ │ ├── db/ │ │ │ │ ├── postgres.js │ │ │ │ └── schemas.js │ │ │ ├── designer/ │ │ │ │ └── layoutv1.js │ │ │ ├── op/ │ │ │ │ ├── convert.js │ │ │ │ ├── indexdb.js │ │ │ │ ├── llm.js │ │ │ │ ├── project.js │ │ │ │ └── render.js │ │ │ ├── pm/ │ │ │ │ ├── brd.js │ │ │ │ ├── drd.js │ │ │ │ ├── fjmd.js │ │ │ │ ├── frd.js │ │ │ │ ├── prd.js │ │ │ │ ├── uxdmd.js │ │ │ │ └── uxsmd.js │ │ │ ├── swarm/ │ │ │ │ ├── augment.js │ │ │ │ ├── fix.js │ │ │ │ └── review.js │ │ │ ├── ux/ │ │ │ │ ├── datamap.js │ │ │ │ └── sitemap.js │ │ │ └── webapp/ │ │ │ ├── root.js │ │ │ ├── store.js │ │ │ └── view.js │ │ ├── presets/ │ │ │ └── ui/ │ │ │ └── design/ │ │ │ └── systems/ │ │ │ ├── protoboy-v1/ │ │ │ │ ├── README.md │ │ │ │ └── primitives/ │ │ │ │ ├── .gitignore │ │ │ │ └── ontology.yaml │ │ │ └── shadcn/ │ │ │ └── primitives/ │ │ │ ├── .gitignore │ │ │ ├── docs/ │ │ │ │ ├── accordion.mdx │ │ │ │ ├── avatar.mdx │ │ │ │ ├── badge.mdx │ │ │ │ ├── bar_progress.mdx │ │ │ │ ├── bar_slider.mdx │ │ │ │ ├── breadcrumbs.mdx │ │ │ │ ├── button.mdx │ │ │ │ ├── button_icon_only.mdx │ │ │ │ ├── button_secondary.mdx │ │ │ │ ├── button_with_icon.mdx │ │ │ │ ├── calendar_datepicker.mdx │ │ │ │ ├── carousel_horizontal.mdx │ │ │ │ ├── carousel_vertical.mdx │ │ │ │ ├── dialog_overlay_trigger_button.mdx │ │ │ │ ├── input_checkbox.mdx │ │ │ │ ├── input_combobox.mdx │ │ │ │ ├── input_datepicker.mdx │ │ │ │ ├── input_field.mdx │ │ │ │ ├── input_label.mdx │ │ │ │ ├── input_radio.mdx │ │ │ │ ├── input_searchfield.mdx │ │ │ │ ├── input_select.mdx │ │ │ │ ├── input_switch.mdx │ │ │ │ ├── input_textarea.mdx │ │ │ │ ├── menu_bar.mdx │ │ │ │ ├── menu_navigation.mdx │ │ │ │ ├── pagination.mdx │ │ │ │ ├── table.mdx │ │ │ │ ├── tabs.mdx │ │ │ │ ├── toggle.mdx │ │ │ │ └── tooltip.mdx │ │ │ └── ontology.yaml │ │ └── structure/ │ │ ├── nodes/ │ │ │ ├── backend/ │ │ │ │ ├── asyncapi.yaml │ │ │ │ ├── openapi.yaml │ │ │ │ └── server.yaml │ │ │ ├── db/ │ │ │ │ ├── postgres.yaml │ │ │ │ └── schemas.yaml │ │ │ ├── designer/ │ │ │ │ └── layoutv1.yaml │ │ │ ├── op/ │ │ │ │ ├── convert.yaml │ │ │ │ ├── indexdb.yaml │ │ │ │ ├── llm.yaml │ │ │ │ ├── project.yaml │ │ │ │ └── render.yaml │ │ │ ├── pm/ │ │ │ │ ├── brd.yaml │ │ │ │ ├── drb.yaml │ │ │ │ ├── fjmd.yaml │ │ │ │ ├── frd.yaml │ │ │ │ ├── prd.yaml │ │ │ │ ├── uxdmd.yaml │ │ │ │ └── uxsmd.yaml │ │ │ ├── swarm/ │ │ │ │ ├── augment.yaml │ │ │ │ ├── fix.yaml │ │ │ │ └── review.yaml │ │ │ ├── ux/ │ │ │ │ ├── datamap.yaml │ │ │ │ └── sitemap.yaml │ │ │ └── webapp/ │ │ │ ├── root.yaml │ │ │ ├── store.yaml │ │ │ └── view.yaml │ │ └── sequences/ │ │ ├── projectInit.yaml │ │ └── projectResume.yaml.bak │ └── utils/ │ ├── anthropic.js │ ├── firebase.js │ ├── index.js │ ├── load.js │ ├── openai.js │ ├── parsers.js │ ├── render.js │ ├── storage.js │ └── vectra.js ├── boilerplate/ │ ├── README.md │ ├── backend-boilerplate/ │ │ ├── .gitignore │ │ ├── db.sql │ │ ├── initdb.js │ │ ├── package.json │ │ └── server.js │ ├── package.json │ └── vitereact-boilerplate/ │ ├── .gitignore │ ├── .prettierignore │ ├── .prettierrc │ ├── README.md │ ├── components.json │ ├── eslint.config.js │ ├── index.html │ ├── package.json │ ├── postcss.config.js │ ├── src/ │ │ ├── App.css │ │ ├── App.tsx │ │ ├── AppWrapper.tsx │ │ ├── _cofounder/ │ │ │ ├── dev/ │ │ │ │ ├── cmdk.tsx.bak │ │ │ │ ├── cmdl.tsx │ │ │ │ └── firstlaunch.tsx │ │ │ ├── genui/ │ │ │ │ ├── error-boundary.tsx │ │ │ │ ├── genui-loading.tsx │ │ │ │ ├── genui-placeholder.tsx │ │ │ │ ├── genui-root.tsx │ │ │ │ ├── genui-section.tsx.bak │ │ │ │ ├── genui-view.tsx │ │ │ │ ├── genui-view.tsx.bak │ │ │ │ └── tooltip.tsx │ │ │ ├── meta.json │ │ │ ├── utils.js │ │ │ └── vite-plugin/ │ │ │ └── index.js │ │ ├── components/ │ │ │ └── ui/ │ │ │ ├── accordion.tsx │ │ │ ├── alert-dialog.tsx │ │ │ ├── alert.tsx │ │ │ ├── aspect-ratio.tsx │ │ │ ├── avatar.tsx │ │ │ ├── badge.tsx │ │ │ ├── breadcrumb.tsx │ │ │ ├── button.tsx │ │ │ ├── calendar.tsx │ │ │ ├── card.tsx │ │ │ ├── carousel.tsx │ │ │ ├── chart.tsx │ │ │ ├── checkbox.tsx │ │ │ ├── collapsible.tsx │ │ │ ├── command.tsx │ │ │ ├── context-menu.tsx │ │ │ ├── dialog.tsx │ │ │ ├── drawer.tsx │ │ │ ├── dropdown-menu.tsx │ │ │ ├── form.tsx │ │ │ ├── hover-card.tsx │ │ │ ├── input-otp.tsx │ │ │ ├── input.tsx │ │ │ ├── label.tsx │ │ │ ├── menubar.tsx │ │ │ ├── navigation-menu.tsx │ │ │ ├── pagination.tsx │ │ │ ├── popover.tsx │ │ │ ├── progress.tsx │ │ │ ├── radio-group.tsx │ │ │ ├── resizable.tsx │ │ │ ├── scroll-area.tsx │ │ │ ├── select.tsx │ │ │ ├── separator.tsx │ │ │ ├── sheet.tsx │ │ │ ├── skeleton.tsx │ │ │ ├── slider.tsx │ │ │ ├── sonner.tsx │ │ │ ├── switch.tsx │ │ │ ├── table.tsx │ │ │ ├── tabs.tsx │ │ │ ├── textarea.tsx │ │ │ ├── toast.tsx │ │ │ ├── toaster.tsx │ │ │ ├── toggle-group.tsx │ │ │ ├── toggle.tsx │ │ │ └── tooltip.tsx │ │ ├── hooks/ │ │ │ └── use-toast.ts │ │ ├── index.css │ │ ├── index.css.bak │ │ ├── lib/ │ │ │ └── utils.ts │ │ ├── main.tsx │ │ ├── store/ │ │ │ └── main.tsx │ │ └── vite-env.d.ts │ ├── tailwind.config.js │ ├── tailwind.config.js.bak │ ├── tsconfig.app.json │ ├── tsconfig.json │ ├── tsconfig.node.json │ └── vite.config.ts └── dashboard/ ├── .gitignore ├── .prettierignore ├── .prettierrc ├── README.md ├── components.json ├── eslint.config.js ├── index.html ├── package.json ├── postcss.config.js ├── src/ │ ├── App.tsx │ ├── App.tsx.bak │ ├── app-wrapper.tsx │ ├── app.css │ ├── components/ │ │ ├── flow/ │ │ │ ├── helpers/ │ │ │ │ ├── FloatingConnectionLine.tsx │ │ │ │ ├── FloatingEdge.tsx │ │ │ │ ├── floating.css │ │ │ │ ├── utils.js │ │ │ │ └── zTouchEdit.js │ │ │ ├── keymap.tsx │ │ │ ├── nodes/ │ │ │ │ ├── cofounder-iframe.css │ │ │ │ ├── cofounder-iframe.tsx │ │ │ │ ├── cofounder-node.css │ │ │ │ ├── cofounder-node.tsx │ │ │ │ ├── cofounder-terminal.css │ │ │ │ ├── cofounder-terminal.tsx │ │ │ │ ├── color-selector.css │ │ │ │ └── color-selector.tsx │ │ │ └── template.tsx │ │ ├── styles/ │ │ │ └── flow.css │ │ ├── ui/ │ │ │ ├── accordion.tsx │ │ │ ├── alert-dialog.tsx │ │ │ ├── alert.tsx │ │ │ ├── aspect-ratio.tsx │ │ │ ├── avatar.tsx │ │ │ ├── badge.tsx │ │ │ ├── breadcrumb.tsx │ │ │ ├── button.tsx │ │ │ ├── calendar.tsx │ │ │ ├── card.tsx │ │ │ ├── carousel.tsx │ │ │ ├── chart.tsx │ │ │ ├── checkbox.tsx │ │ │ ├── collapsible.tsx │ │ │ ├── command.tsx │ │ │ ├── context-menu.tsx │ │ │ ├── dialog.tsx │ │ │ ├── drawer.tsx │ │ │ ├── dropdown-menu.tsx │ │ │ ├── form.tsx │ │ │ ├── hover-card.tsx │ │ │ ├── input-otp.tsx │ │ │ ├── input.tsx │ │ │ ├── label.tsx │ │ │ ├── menubar.tsx │ │ │ ├── navigation-menu.tsx │ │ │ ├── pagination.tsx │ │ │ ├── popover.tsx │ │ │ ├── progress.tsx │ │ │ ├── radio-group.tsx │ │ │ ├── resizable.tsx │ │ │ ├── scroll-area.tsx │ │ │ ├── select.tsx │ │ │ ├── separator.tsx │ │ │ ├── sheet.tsx │ │ │ ├── skeleton.tsx │ │ │ ├── slider.tsx │ │ │ ├── sonner.tsx │ │ │ ├── switch.tsx │ │ │ ├── table.tsx │ │ │ ├── tabs.tsx │ │ │ ├── textarea.tsx │ │ │ ├── toast.tsx │ │ │ ├── toaster.tsx │ │ │ ├── toggle-group.tsx │ │ │ ├── toggle.tsx │ │ │ └── tooltip.tsx │ │ └── views/ │ │ ├── component-designer.tsx │ │ ├── events.tsx │ │ ├── flow.tsx │ │ ├── project.tsx │ │ ├── projects-list.tsx │ │ ├── settings.tsx │ │ └── sidebar.tsx │ ├── hooks/ │ │ └── use-toast.ts │ ├── index.css │ ├── lib/ │ │ └── utils.ts │ ├── main.tsx │ ├── store/ │ │ └── main.tsx │ └── vite-env.d.ts ├── tailwind.config.js ├── tailwind.config.js.bak ├── tsconfig.app.json ├── tsconfig.json ├── tsconfig.node.json └── vite.config.ts ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ node_modules ================================================ FILE: CONTRIBUTING.md ================================================ ### contribution guide [merge from /dev here] ================================================ FILE: LICENSE ================================================ MIT License Copyright (c) [year] [fullname] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ ![cofounder-og-black](https://github.com/user-attachments/assets/b4e51f02-59e4-4540-ac14-e1f40e20a658) # Cofounder | Early alpha release * project - [cofounder.openinterface.ai](https://cofounder.openinterface.ai) * 👋 [@n_raidenai](https://x.com/n_raidenai) **cofounder** - full stack generative web apps ; backend + db + stateful web apps - gen ui rooted in app architecture, with ai-guided mockup designer & modular design systems --- # Early Alpha : Unstable ⚠️ The following points are very emphasized : - This is an **EARLY, UNSTABLE, PREVIEW RELEASE** of the project. ⚠️ Until v1 is released, it is expected to break often. - **It consumes a lot of tokens**. If you are on a tokens budget, wait until v1 is released. - Again, this is an early, unstable release. A first test run. An early preview of the project's ideas. Far from completion. Open-source iterative development. Work in progress. Unstable early alpha release. [etc] ### **If any of these might be issues for you, even in the slightest way, wait until v1 is released ! Do not try the current release !** To help you guide your decision on whether or not to try the current release , here is a guide | Situation | Recommendation | |------------------------------------------------------------------------------------------------------|------------------------| | I'm not sure if this tool release is mature yet, maybe it will not work as intended and I may spend millions of tokens for nothing | Do not use it yet | | I am very excited about this tool, I hope it is perfectly production-ready, because if it's not, I will make commentary about `I spent X amount on OpenAI API calls` | Do not use it yet | | I am not interested in code. I want to type words into a box and have my project completed; I do not want messy broken unfinished code | Do not use it yet | | I love exploring experimental tools but I am on the fence. It's going to break halfway and leave me sad | Do not use it yet | | Who should even try it at this point? | Nobody. Do not use it yet | | But I really want to use it for some esoteric reason having read all the above. | Do not use it yet either | --- https://github.com/user-attachments/assets/cfd09250-d21e-49fc-a29b-fa0c661abfc0 https://github.com/user-attachments/assets/c055f9c4-6bc0-4b11-ba8f-cc9f149387fa --- ## Important **Early alpha release ; earlier than expected by few weeks** Still not merged with key target features of the project, notably : - project iteration modules for all dimensions of generated projects - admin interface for event streams and (deeper) project iterations - integrate the full genUI plugin : * generative design systems * deploy finetuned models & serve from api.cofounder - local, browser-based dev env for the entire project scope - add { react-native , flutter , other web frameworks } - validations & swarm code review and autofix - code optimization - [...] be patient :) --- # Usage ## Install & Init * Open your terminal and run ```sh npx @openinterface/cofounder ``` Follow the instructions. The installer - will ask you for your keys - setup dirs & start installs - will start the local `cofounder/api` builder and server - will open the web dashboard where you can create new projects (at `http://localhost:4200` ) 🎉 ``` note : you will be asked for a cofounder.openinterface.ai key it is recommended to use one as it enables the designer/layoutv1 and swarm/external-apis features and can be used without limits during the current early alpha period the full index will be available for local download on v1 release ``` - currently using `node v22` for the whole project. ```sh # alternatively, you can make a new project without going through the dashboard # by runing : npx @openinterface/cofounder -p "YourAppProjectName" -d "describe your app here" -a "(optional) design instructions" ``` ## Run Generated Apps - Your backend & vite+react web app will incrementally generate inside `./apps/{YourApp}` Open your terminal in `./apps/{YourApp}` and run ```sh npm i && npm run dev ``` It will start both the backend and vite+react, concurrently, after installing their dependencies Go to `http://localhost:5173/` to open the web app 🎉 - From within the generated apps , you can use ⌘+K / Ctrl+K to iterate on UI components [more details later] ## Notes ### Dashboard & Local API If you resume later and would like to iterate on your generated apps, the local `./cofounder/api` server needs to be running to receive queries You can (re)start the `local cofounder API` running the following command from `./cofounder/api` ```sh npm run start ``` The dashboard will open in `http://localhost:4200` - note: You can also generate new apps from the same env, without the the dashboard, by running, from `./cofounder/api`, one of these commands ```sh npm run start -- -p "ProjectName" -f "some app description" -a "minimalist and spacious , light theme" npm run start -- -p "ProjectName" -f "./example_description.txt" -a "minimalist and spacious , light theme" ``` ### Concurrency **[the architecture will be further detailed and documented later]** Every "node" in the `cofounder` architecture has a defined configuration under `./cofounder/api/system/structure/nodes/{category}/{name}.yaml` to handle things like concurrency, retries and limits per time interval For example, if you want multiple LLM generations to run in parallel (when possible - sequences and parallels are defined in DAGS under `./cofounder/api/system/structure/sequences/{definition}.yaml` ), go to ```yaml #./cofounder/api/system/structure/nodes/op/llm.yaml nodes: op:LLM::GEN: desc: "..." in: [model, messages, preparser, parser, query, stream] out: [generated, usage] queue: concurrency: 1 # <------------------------------- here op:LLM::VECTORIZE: desc: "{texts} -> {vectors}" in: [texts] out: [vectors, usage] mapreduce: true op:LLM::VECTORIZE:CHUNK: desc: "{texts} -> {vectors}" in: [texts] out: [vectors, usage] queue: concurrency: 50 ``` and change the `op:LLM::GEN` parameter `concurrency` to a higher value The default LLM concurrency is set to `2` so you can see what's happening in your console streams step by step - but you can increment it depending on your api keys limits --- # Changelog --- # Roadmap --- # Benchmarks --- # Community & Links - [![Cofounder](https://img.shields.io/badge/Cofounder-gray?style=for-the-badge&logo=discord&link=https://discord.gg/2kVMzeASj9)](https://discord.gg/2kVMzeASj9) | Community discord server by @flamecoders --- # Docs, Design Systems, ... **[WIP]** --- # Architecture [more details later] archi/v1 is as follows : ![architecture](https://github.com/user-attachments/assets/b2d8b70e-7a6d-45c9-a706-0cf955d13451) --- # Credits - Demo design systems built using Figma renders / UI kits from: * blocks.pm by Hexa Plugin (see `cofounder/api/system/presets`) * google material * figma core * shadcn - Dashboard node-based ui powered by [react flow](https://reactflow.dev/) ================================================ FILE: ROADMAP.md ================================================ ### roadmap to v1 [merge from /dev here] ================================================ FILE: TODO.md ================================================ A non-ordered roadmap & todo dump will update with proper map later, ignore for now --- ## nearest merge with browser-based local dev env using webcontainers ; console.cofounder.openinterface.ai ## validation, errorfix post-generation validation swarm modules swarm autofix modules, merge babel parse ## build, deploy vite plugin to generate web app without the cofounder modules generate packed projects ready for deployment automate deployments, integrate different services ## design, layouts plug in advanced designer + models document how to custom design systems add & index docs for shiny design systems fonts / css modules release extensive cofounder index on api access for layout designer to use separate {desktop,mobile} in designer RAG on icons via {text/clip} (like in openv0), maybe as a vite plugin ## functional deploy latest index checkpoint in api.cofounder ## mgmt more iteration modules, sequences to handle full lifecycle of generated projects document everything ## platforms react-native / flutter more frontend frameworks ## project technical articles model train & serve from api admin panel à la coolify ## also SEO stuff analytics into the dev feedback animation (ie. framer-motion) functional, api, python support api-side benchmarks ================================================ FILE: apps/README.md ================================================ ## How to start apps Your backend & vite+react web app will incrementally generate inside `./apps/{YourApp}` Open your terminal in `./apps/{YourApp}` and run ```sh npm i && npm run dev ``` ================================================ FILE: benchmarks/README.md ================================================ ### benchmark cases [merge from /dev here] ================================================ FILE: cofounder/api/.gitignore ================================================ node_modules/ dump/ ================================================ FILE: cofounder/api/.prettierignore ================================================ db/ dump/ dist/ node_modules/ ================================================ FILE: cofounder/api/.prettierrc ================================================ { "tabWidth": 1, "useTabs": true } ================================================ FILE: cofounder/api/README.md ================================================ ================================================ FILE: cofounder/api/build.js ================================================ import fs from "fs"; import path from "path"; import yaml from "yaml-js"; import yml from "yaml"; import { merge, fromPairs } from "lodash-es"; import retry from "async-retry"; import pqueue from "p-queue"; import { EventEmitter } from "node:events"; import { promisify } from "util"; import { readdir } from "fs"; import delay from "delay"; const functionsDir = `./system/functions`; const unitsDir = `./system/structure`; const LOGS_ENABLED = true; async function build({ system }) { console.dir({ build: system.functions }); if (!system.nodes) system.nodes = {}; if (!system.functions) system.functions = {}; if (!system.sequences) system.sequences = {}; const queues = {}; const events = { main: new EventEmitter(), log: { node: new EventEmitter(), sequence: new EventEmitter(), }, }; if (LOGS_ENABLED) { events.log.node.on(`enqueue`, ({ id, context, data }) => { console.log( `\x1b[36mlog:enqueue: node:${id}\t${JSON.stringify({ context, data }).slice(0, 150)}\x1b[0m`, ); }); events.log.node.on(`start`, ({ id, context, data }) => { console.log( `\x1b[33mlog:start: node:${id}\t${JSON.stringify({ context, data }).slice(0, 150)}\x1b[0m`, ); }); events.log.node.on(`end`, ({ id, context, data, response }) => { console.log( `\x1b[32mlog:complete: node:${id}\t${JSON.stringify({ context, response, data }).slice(0, 150)}\x1b[0m`, ); }); } system.run = async ({ id, context, data }) => { // console.dir({ __debug__system__run : { input : { id, context, data }, system_nodes: system.nodes, } }) try { return await system.nodes[id].run({ context, data }); } catch (err) { console.dir({ SYSTEM_RUN_ERR: { err, id } }); } }; events.main.on(`run`, async ({ id, context, data }) => { if (LOGS_ENABLED) { console.log(`\x1b[31mevent:\`run\` →id:${id}\x1b[0m`); } await system.run({ id, context, data }); }); system.nodes = fromPairs( await Promise.all( Object.keys(system.functions) .filter((id) => Object.keys(system.nodes).includes(id)) .map(async (id) => { queues[id] = new pqueue({ concurrency: parseInt(system.nodes[id].queue?.concurrency) || Infinity, intervalCap: parseInt(system.nodes[id].queue?.interval?.limit) || Infinity, interval: parseInt(system.nodes[id].queue?.interval?.time) || 0, timeout: parseInt(system.nodes[id].queue?.timeout) || undefined, }); // this is the function to be ran const fn = async ({ context = {}, data = {} }) => { events.log.node.emit(`enqueue`, { id, context, data }); return await queues[id].add(async () => { events.log.node.emit(`start`, { id, context, data }); const response = await retry( async (bail) => { try { const fnresponse = await system.functions[id]({ context: { ...context, run: system.run }, data: system.nodes[id].in?.length ? system.nodes[id].in.reduce( (acc, inp) => ({ ...acc, [inp]: data[inp] || null }), {}, ) // higher perf than fromPairs ? : data, }); return !fnresponse ? { success: false } : system.nodes[id].out?.length ? system.nodes[id].out.reduce( (acc, inp) => ({ ...acc, [inp]: fnresponse[inp] || null }), {}, ) : fnresponse; } catch (error) { console.dir({ asyncretry_error: { id, error } }, { depth: null }); throw new Error(error); } }, { retries: parseInt(system.nodes[id].queue?.retry) || 5, }, ); events.log.node.emit(`end`, { id, context, data, response }); return response; }); }; return [ id, { type: `node`, meta: system.nodes[id], run: fn, }, // to have same format as sequence : system.sequences[id].run and system.functions[id].run ]; }), ), ); /* make the DAG graph decomposition parallelizor from the system and relations handle : seq , parallel , recursion too ! */ /* event registration for system triggers (nodes are all registered for events node:{id} ) */ if (LOGS_ENABLED) { events.log.sequence.on(`sequence:start`, ({ id, context, data }) => { console.log( `\x1b[34mlog:start: sequence:${id}\t${JSON.stringify({ context, data }).slice(0, 150)}\x1b[0m`, ); }); events.log.sequence.on( `sequence:step:start`, ({ id, index, over, context, data }) => { console.log( `\x1b[34mlog:start: sequence:${id}:step:${index}/${over - 1}\t${JSON.stringify({ context, data }).slice(0, 150)}\x1b[0m`, ); }, ); events.log.sequence.on( `sequence:step:end`, ({ id, index, over, context, data }) => { console.log( `\x1b[35mlog:done: sequence:${id}:step:${index}/${over - 1}\t${JSON.stringify({ context, data }).slice(0, 150)}\x1b[0m`, ); }, ); events.log.sequence.on(`sequence:end`, ({ id, context, data }) => { console.log( `\x1b[35mlog:done: sequence:${id}\t${JSON.stringify({ context, data }).slice(0, 150)}\x1b[0m`, ); }); } async function makeDags() { // need to implement recursion cases next ! return fromPairs( Object.keys(system.sequences).map((sequenceId) => { const inDegree = {}, adjList = {}; const seq = system.sequences[sequenceId]; const dag = fromPairs( system.sequences[sequenceId].nodes.map((nodeId) => { return [ nodeId, { parents: !seq.relations?.parents ? [] : !seq.relations?.parents[nodeId]?.length ? [] : seq.relations.parents[nodeId], }, ]; }), ); Object.keys(dag).forEach((node) => { inDegree[node] = 0; adjList[node] = []; }); Object.entries(dag).forEach(([node, { parents }]) => { if (parents) { parents.forEach((parent) => { if (!adjList[parent]) { console.error( `build:DAG : parent node ${parent} of node ${node} not found in DAG - skipping dependency`, ); } else { adjList[parent].push(node); inDegree[node]++; } }); } }); const queue = Object.keys(inDegree).filter((node) => inDegree[node] === 0); const sequence = [], visitedNodes = new Set(); while (queue.length) { const currentLevel = queue.splice(0, queue.length); currentLevel.forEach((node) => { visitedNodes.add(node); adjList[node].forEach((neighbor) => { if (--inDegree[neighbor] === 0) queue.push(neighbor); }); }); sequence.push(currentLevel); } if (visitedNodes.size !== Object.keys(dag).length) { console.dir({ dag, visitedNodes }, { depth: null }); throw new Error("The provided DAG has cycles or unresolved dependencies"); } // later ; update for logging etc const run = async ({ context, data }) => { events.log.sequence.emit(`sequence:start`, { id: sequenceId, context, data, }); const sequenceLength = sequence.length; if (context.sequence) { console.dir({ "debug:build:context:sequence": context.sequence }); } const resume_at = context?.sequence?.resume ? context.sequence.resume : 0; let step_index = -1; for (const s of sequence.entries()) { step_index++; if (step_index >= resume_at) { const [index, step] = s; events.log.sequence.emit(`sequence:step:start`, { id: sequenceId, index, over: sequenceLength, context, data, }); await Promise.all( step.map(async (parallelfnId) => { const response = await system.run({ id: parallelfnId, context: { ...context, run: system.run }, data, }); data = merge(data, response); }), ); events.log.sequence.emit(`sequence:step:end`, { id: sequenceId, index, over: sequenceLength, context, data, }); } } events.log.sequence.emit(`sequence:end`, { id: sequenceId, context, data, }); return data; }; if (system.sequences[sequenceId].triggers?.length) { system.sequences[sequenceId].triggers.map((triggerevent) => { events.main.on(triggerevent, async ({ context, data }) => { if (LOGS_ENABLED) { console.log( `\x1b[31mevent:\`${triggerevent}\` →sequence:${sequenceId}\x1b[0m`, ); } await run({ context, data }); }); }); } return [ sequenceId, { type: `sequence`, meta: { ...system.sequences[sequenceId], dag: sequence, }, run, }, ]; }), ); } system.nodes = { ...system.nodes, ...(await makeDags()), }; system.queues = queues; system.events = { events, new: async ({ event, context = {}, data = {} }) => { events.main.emit(event, { context, data }); }, // trigger events run: async ({ id = false, context = {}, data = {} }) => { events.main.emit(`run`, { id, context, data }); }, // run node/seq events }; return system; } const readdirAsync = promisify(readdir); async function getFilesRecursively(dir, ext) { let results = []; const list = await readdirAsync(dir, { withFileTypes: true }); for (const file of list) { const filePath = path.join(dir, file.name); if (file.isDirectory()) { results = results.concat(await getFilesRecursively(filePath, ext)); } else if (file.name.endsWith(ext)) { results.push(filePath); } } return results; } const system = await build({ system: { functions: merge( {}, ...(await Promise.all( (await getFilesRecursively(functionsDir, ".js")).map((file) => import(`./${file}`).then((m) => m.default), ), )), ), ...merge( {}, ...(await Promise.all( (await getFilesRecursively(unitsDir, ".yaml")).map((file) => yaml.load(fs.readFileSync(`./${file}`, `utf-8`).toString()), ), )), ), }, }); export default { system, }; ================================================ FILE: cofounder/api/db/README.md ================================================ ================================================ FILE: cofounder/api/db/index/README.md ================================================ ================================================ FILE: cofounder/api/db/projects/README.md ================================================ ================================================ FILE: cofounder/api/db/storage/README.md ================================================ ================================================ FILE: cofounder/api/dist/assets/index-B1d7LZHm.js ================================================ var Wj=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ghe=Wj((pn,mn)=>{function Kj(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var la=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ci(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var qT={exports:{}},Sh={},YT={exports:{}},ke={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Xu=Symbol.for("react.element"),qj=Symbol.for("react.portal"),Yj=Symbol.for("react.fragment"),Gj=Symbol.for("react.strict_mode"),Xj=Symbol.for("react.profiler"),Qj=Symbol.for("react.provider"),Zj=Symbol.for("react.context"),Jj=Symbol.for("react.forward_ref"),eF=Symbol.for("react.suspense"),tF=Symbol.for("react.memo"),nF=Symbol.for("react.lazy"),O1=Symbol.iterator;function rF(e){return e===null||typeof e!="object"?null:(e=O1&&e[O1]||e["@@iterator"],typeof e=="function"?e:null)}var GT={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},XT=Object.assign,QT={};function Pa(e,t,n){this.props=e,this.context=t,this.refs=QT,this.updater=n||GT}Pa.prototype.isReactComponent={};Pa.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Pa.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function ZT(){}ZT.prototype=Pa.prototype;function sv(e,t,n){this.props=e,this.context=t,this.refs=QT,this.updater=n||GT}var ov=sv.prototype=new ZT;ov.constructor=sv;XT(ov,Pa.prototype);ov.isPureReactComponent=!0;var L1=Array.isArray,JT=Object.prototype.hasOwnProperty,av={current:null},e_={key:!0,ref:!0,__self:!0,__source:!0};function t_(e,t,n){var r,i={},s=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)JT.call(t,r)&&!e_.hasOwnProperty(r)&&(i[r]=t[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1{throw new Error("uSES not initialized!")};function uv(e=Ki){return function(){return dn.useContext(e)}}var o_=uv(),a_=kF,EF=e=>{a_=e},CF=(e,t)=>e===t;function TF(e=Ki){const t=e===Ki?o_:uv(e),n=(r,i={})=>{const{equalityFn:s=CF,devModeChecks:o={}}=typeof i=="function"?{equalityFn:i}:i,{store:a,subscription:l,getServerState:u,stabilityCheck:f,identityFunctionCheck:c}=t();dn.useRef(!0);const d=dn.useCallback({[r.name](p){return r(p)}}[r.name],[r,f,o.stabilityCheck]),h=a_(l.addNestedSub,a.getState,u||a.getState,d,s);return dn.useDebugValue(h),h};return Object.assign(n,{withTypes:()=>n}),n}var bo=TF();function _F(e){e()}function AF(){let e=null,t=null;return{clear(){e=null,t=null},notify(){_F(()=>{let n=e;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=e;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!r||e===null||(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var M1={notify(){},get:()=>[]};function NF(e,t){let n,r=M1,i=0,s=!1;function o(m){f();const w=r.subscribe(m);let y=!1;return()=>{y||(y=!0,w(),c())}}function a(){r.notify()}function l(){p.onStateChange&&p.onStateChange()}function u(){return s}function f(){i++,n||(n=e.subscribe(l),r=AF())}function c(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=M1)}function d(){s||(s=!0,f())}function h(){s&&(s=!1,c())}const p={addNestedSub:o,notifyNestedSubs:a,handleChangeWrapper:l,isSubscribed:u,trySubscribe:d,tryUnsubscribe:h,getListeners:()=>r};return p}var PF=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",OF=typeof navigator<"u"&&navigator.product==="ReactNative",LF=PF||OF?dn.useLayoutEffect:dn.useEffect;function RF({store:e,context:t,children:n,serverState:r,stabilityCheck:i="once",identityFunctionCheck:s="once"}){const o=dn.useMemo(()=>{const u=NF(e);return{store:e,subscription:u,getServerState:r?()=>r:void 0,stabilityCheck:i,identityFunctionCheck:s}},[e,r,i,s]),a=dn.useMemo(()=>e.getState(),[e]);LF(()=>{const{subscription:u}=o;return u.onStateChange=u.notifyNestedSubs,u.trySubscribe(),a!==e.getState()&&u.notifyNestedSubs(),()=>{u.tryUnsubscribe(),u.onStateChange=void 0}},[o,a]);const l=t||Ki;return dn.createElement(l.Provider,{value:o},n)}var IF=RF;function l_(e=Ki){const t=e===Ki?o_:uv(e),n=()=>{const{store:r}=t();return r};return Object.assign(n,{withTypes:()=>n}),n}var DF=l_();function MF(e=Ki){const t=e===Ki?DF:l_(e),n=()=>t().dispatch;return Object.assign(n,{withTypes:()=>n}),n}var kh=MF();EF(bF.useSyncExternalStoreWithSelector);var u_={exports:{}},kn={},c_={exports:{}},f_={};/** * @license React * scheduler.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */(function(e){function t(P,D){var _=P.length;P.push(D);e:for(;0<_;){var V=_-1>>>1,W=P[V];if(0>>1;Vi(J,_))Yi(re,J)?(P[V]=re,P[Y]=_,V=Y):(P[V]=J,P[q]=_,V=q);else if(Yi(re,_))P[V]=re,P[Y]=_,V=Y;else break e}}return D}function i(P,D){var _=P.sortIndex-D.sortIndex;return _!==0?_:P.id-D.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var l=[],u=[],f=1,c=null,d=3,h=!1,p=!1,m=!1,w=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(P){for(var D=n(u);D!==null;){if(D.callback===null)r(u);else if(D.startTime<=P)r(u),D.sortIndex=D.expirationTime,t(l,D);else break;D=n(u)}}function x(P){if(m=!1,g(P),!p)if(n(l)!==null)p=!0,I(S);else{var D=n(u);D!==null&&F(x,D.startTime-P)}}function S(P,D){p=!1,m&&(m=!1,y(T),T=-1),h=!0;var _=d;try{for(g(D),c=n(l);c!==null&&(!(c.expirationTime>D)||P&&!j());){var V=c.callback;if(typeof V=="function"){c.callback=null,d=c.priorityLevel;var W=V(c.expirationTime<=D);D=e.unstable_now(),typeof W=="function"?c.callback=W:c===n(l)&&r(l),g(D)}else r(l);c=n(l)}if(c!==null)var R=!0;else{var q=n(u);q!==null&&F(x,q.startTime-D),R=!1}return R}finally{c=null,d=_,h=!1}}var k=!1,C=null,T=-1,O=5,A=-1;function j(){return!(e.unstable_now()-AP||125V?(P.sortIndex=_,t(u,P),n(l)===null&&P===n(u)&&(m?(y(T),T=-1):m=!0,F(x,_-V))):(P.sortIndex=W,t(l,P),p||h||(p=!0,I(S))),P},e.unstable_shouldYield=j,e.unstable_wrapCallback=function(P){var D=d;return function(){var _=d;d=D;try{return P.apply(this,arguments)}finally{d=_}}}})(f_);c_.exports=f_;var jF=c_.exports;/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var FF=E,vn=jF;function Q(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),jg=Object.prototype.hasOwnProperty,$F=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,j1={},F1={};function BF(e){return jg.call(F1,e)?!0:jg.call(j1,e)?!1:$F.test(e)?F1[e]=!0:(j1[e]=!0,!1)}function VF(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function zF(e,t,n,r){if(t===null||typeof t>"u"||VF(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function zt(e,t,n,r,i,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var kt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){kt[e]=new zt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];kt[t]=new zt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){kt[e]=new zt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){kt[e]=new zt(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){kt[e]=new zt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){kt[e]=new zt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){kt[e]=new zt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){kt[e]=new zt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){kt[e]=new zt(e,5,!1,e.toLowerCase(),null,!1,!1)});var cv=/[\-:]([a-z])/g;function fv(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(cv,fv);kt[t]=new zt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(cv,fv);kt[t]=new zt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(cv,fv);kt[t]=new zt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){kt[e]=new zt(e,1,!1,e.toLowerCase(),null,!1,!1)});kt.xlinkHref=new zt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){kt[e]=new zt(e,1,!1,e.toLowerCase(),null,!0,!0)});function dv(e,t,n,r){var i=kt.hasOwnProperty(t)?kt[t]:null;(i!==null?i.type!==0:r||!(2a||i[o]!==s[a]){var l=` `+i[o].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=o&&0<=a);break}}}finally{Zp=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?El(e):""}function UF(e){switch(e.tag){case 5:return El(e.type);case 16:return El("Lazy");case 13:return El("Suspense");case 19:return El("SuspenseList");case 0:case 2:case 15:return e=Jp(e.type,!1),e;case 11:return e=Jp(e.type.render,!1),e;case 1:return e=Jp(e.type,!0),e;default:return""}}function Vg(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ko:return"Fragment";case So:return"Portal";case Fg:return"Profiler";case hv:return"StrictMode";case $g:return"Suspense";case Bg:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case p_:return(e.displayName||"Context")+".Consumer";case h_:return(e._context.displayName||"Context")+".Provider";case pv:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case mv:return t=e.displayName||null,t!==null?t:Vg(e.type)||"Memo";case Ei:t=e._payload,e=e._init;try{return Vg(e(t))}catch{}}return null}function HF(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Vg(t);case 8:return t===hv?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function qi(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function g_(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function WF(e){var t=g_(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ac(e){e._valueTracker||(e._valueTracker=WF(e))}function y_(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=g_(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ud(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function zg(e,t){var n=t.checked;return Ge({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function B1(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=qi(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function v_(e,t){t=t.checked,t!=null&&dv(e,"checked",t,!1)}function Ug(e,t){v_(e,t);var n=qi(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Hg(e,t.type,n):t.hasOwnProperty("defaultValue")&&Hg(e,t.type,qi(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function V1(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Hg(e,t,n){(t!=="number"||ud(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Cl=Array.isArray;function qo(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=Nc.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ou(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var jl={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},KF=["Webkit","ms","Moz","O"];Object.keys(jl).forEach(function(e){KF.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),jl[t]=jl[e]})});function S_(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||jl.hasOwnProperty(e)&&jl[e]?(""+t).trim():t+"px"}function k_(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=S_(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var qF=Ge({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function qg(e,t){if(t){if(qF[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Q(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Q(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Q(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Q(62))}}function Yg(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Gg=null;function gv(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Xg=null,Yo=null,Go=null;function H1(e){if(e=ec(e)){if(typeof Xg!="function")throw Error(Q(280));var t=e.stateNode;t&&(t=Ah(t),Xg(e.stateNode,e.type,t))}}function E_(e){Yo?Go?Go.push(e):Go=[e]:Yo=e}function C_(){if(Yo){var e=Yo,t=Go;if(Go=Yo=null,H1(e),t)for(e=0;e>>=0,e===0?32:31-(i$(e)/s$|0)|0}var Pc=64,Oc=4194304;function Tl(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function hd(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,o=n&268435455;if(o!==0){var a=o&~i;a!==0?r=Tl(a):(s&=o,s!==0&&(r=Tl(s)))}else o=n&~i,o!==0?r=Tl(o):s!==0&&(r=Tl(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,s=t&-t,i>=s||i===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Zu(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-nr(t),e[t]=n}function u$(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=$l),J1=" ",eb=!1;function W_(e,t){switch(e){case"keyup":return j$.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function K_(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Eo=!1;function $$(e,t){switch(e){case"compositionend":return K_(t);case"keypress":return t.which!==32?null:(eb=!0,J1);case"textInput":return e=t.data,e===J1&&eb?null:e;default:return null}}function B$(e,t){if(Eo)return e==="compositionend"||!Ev&&W_(e,t)?(e=U_(),Cf=bv=Oi=null,Eo=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=ib(n)}}function X_(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?X_(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Q_(){for(var e=window,t=ud();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ud(e.document)}return t}function Cv(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function G$(e){var t=Q_(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&X_(n.ownerDocument.documentElement,n)){if(r!==null&&Cv(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=sb(n,s);var o=sb(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Co=null,ny=null,Vl=null,ry=!1;function ob(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ry||Co==null||Co!==ud(r)||(r=Co,"selectionStart"in r&&Cv(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Vl&&du(Vl,r)||(Vl=r,r=gd(ny,"onSelect"),0Ao||(e.current=uy[Ao],uy[Ao]=null,Ao--)}function De(e,t){Ao++,uy[Ao]=e.current,e.current=t}var Yi={},Lt=ss(Yi),tn=ss(!1),Fs=Yi;function ca(e,t){var n=e.type.contextTypes;if(!n)return Yi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function nn(e){return e=e.childContextTypes,e!=null}function vd(){Ve(tn),Ve(Lt)}function hb(e,t,n){if(Lt.current!==Yi)throw Error(Q(168));De(Lt,t),De(tn,n)}function oA(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(Q(108,HF(e)||"Unknown",i));return Ge({},n,r)}function wd(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Yi,Fs=Lt.current,De(Lt,e),De(tn,tn.current),!0}function pb(e,t,n){var r=e.stateNode;if(!r)throw Error(Q(169));n?(e=oA(e,t,Fs),r.__reactInternalMemoizedMergedChildContext=e,Ve(tn),Ve(Lt),De(Lt,e)):Ve(tn),De(tn,n)}var Vr=null,Nh=!1,hm=!1;function aA(e){Vr===null?Vr=[e]:Vr.push(e)}function a3(e){Nh=!0,aA(e)}function os(){if(!hm&&Vr!==null){hm=!0;var e=0,t=Oe;try{var n=Vr;for(Oe=1;e>=o,i-=o,zr=1<<32-nr(t)+i|n<T?(O=C,C=null):O=C.sibling;var A=d(y,C,g[T],x);if(A===null){C===null&&(C=O);break}e&&C&&A.alternate===null&&t(y,C),v=s(A,v,T),k===null?S=A:k.sibling=A,k=A,C=O}if(T===g.length)return n(y,C),ze&&ys(y,T),S;if(C===null){for(;TT?(O=C,C=null):O=C.sibling;var j=d(y,C,A.value,x);if(j===null){C===null&&(C=O);break}e&&C&&j.alternate===null&&t(y,C),v=s(j,v,T),k===null?S=j:k.sibling=j,k=j,C=O}if(A.done)return n(y,C),ze&&ys(y,T),S;if(C===null){for(;!A.done;T++,A=g.next())A=c(y,A.value,x),A!==null&&(v=s(A,v,T),k===null?S=A:k.sibling=A,k=A);return ze&&ys(y,T),S}for(C=r(y,C);!A.done;T++,A=g.next())A=h(C,y,T,A.value,x),A!==null&&(e&&A.alternate!==null&&C.delete(A.key===null?T:A.key),v=s(A,v,T),k===null?S=A:k.sibling=A,k=A);return e&&C.forEach(function(L){return t(y,L)}),ze&&ys(y,T),S}function w(y,v,g,x){if(typeof g=="object"&&g!==null&&g.type===ko&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case _c:e:{for(var S=g.key,k=v;k!==null;){if(k.key===S){if(S=g.type,S===ko){if(k.tag===7){n(y,k.sibling),v=i(k,g.props.children),v.return=y,y=v;break e}}else if(k.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Ei&&yb(S)===k.type){n(y,k.sibling),v=i(k,g.props),v.ref=sl(y,k,g),v.return=y,y=v;break e}n(y,k);break}else t(y,k);k=k.sibling}g.type===ko?(v=Is(g.props.children,y.mode,x,g.key),v.return=y,y=v):(x=Rf(g.type,g.key,g.props,null,y.mode,x),x.ref=sl(y,v,g),x.return=y,y=x)}return o(y);case So:e:{for(k=g.key;v!==null;){if(v.key===k)if(v.tag===4&&v.stateNode.containerInfo===g.containerInfo&&v.stateNode.implementation===g.implementation){n(y,v.sibling),v=i(v,g.children||[]),v.return=y,y=v;break e}else{n(y,v);break}else t(y,v);v=v.sibling}v=bm(g,y.mode,x),v.return=y,y=v}return o(y);case Ei:return k=g._init,w(y,v,k(g._payload),x)}if(Cl(g))return p(y,v,g,x);if(el(g))return m(y,v,g,x);Fc(y,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,v!==null&&v.tag===6?(n(y,v.sibling),v=i(v,g),v.return=y,y=v):(n(y,v),v=xm(g,y.mode,x),v.return=y,y=v),o(y)):n(y,v)}return w}var da=fA(!0),dA=fA(!1),Sd=ss(null),kd=null,Oo=null,Nv=null;function Pv(){Nv=Oo=kd=null}function Ov(e){var t=Sd.current;Ve(Sd),e._currentValue=t}function dy(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Qo(e,t){kd=e,Nv=Oo=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Jt=!0),e.firstContext=null)}function Fn(e){var t=e._currentValue;if(Nv!==e)if(e={context:e,memoizedValue:t,next:null},Oo===null){if(kd===null)throw Error(Q(308));Oo=e,kd.dependencies={lanes:0,firstContext:e}}else Oo=Oo.next=e;return t}var Ts=null;function Lv(e){Ts===null?Ts=[e]:Ts.push(e)}function hA(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Lv(t)):(n.next=i.next,i.next=n),t.interleaved=n,ni(e,r)}function ni(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Ci=!1;function Rv(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function pA(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Yr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Fi(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ae&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,ni(e,n)}return i=r.interleaved,i===null?(t.next=t,Lv(r)):(t.next=i.next,i.next=t),r.interleaved=t,ni(e,n)}function _f(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,vv(e,n)}}function vb(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Ed(e,t,n,r){var i=e.updateQueue;Ci=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,u=l.next;l.next=null,o===null?s=u:o.next=u,o=l;var f=e.alternate;f!==null&&(f=f.updateQueue,a=f.lastBaseUpdate,a!==o&&(a===null?f.firstBaseUpdate=u:a.next=u,f.lastBaseUpdate=l))}if(s!==null){var c=i.baseState;o=0,f=u=l=null,a=s;do{var d=a.lane,h=a.eventTime;if((r&d)===d){f!==null&&(f=f.next={eventTime:h,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var p=e,m=a;switch(d=t,h=n,m.tag){case 1:if(p=m.payload,typeof p=="function"){c=p.call(h,c,d);break e}c=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=m.payload,d=typeof p=="function"?p.call(h,c,d):p,d==null)break e;c=Ge({},c,d);break e;case 2:Ci=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,d=i.effects,d===null?i.effects=[a]:d.push(a))}else h={eventTime:h,lane:d,tag:a.tag,payload:a.payload,callback:a.callback,next:null},f===null?(u=f=h,l=c):f=f.next=h,o|=d;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;d=a,a=d.next,d.next=null,i.lastBaseUpdate=d,i.shared.pending=null}}while(!0);if(f===null&&(l=c),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=f,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else s===null&&(i.shared.lanes=0);Vs|=o,e.lanes=o,e.memoizedState=c}}function wb(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=mm.transition;mm.transition={};try{e(!1),t()}finally{Oe=n,mm.transition=r}}function OA(){return $n().memoizedState}function f3(e,t,n){var r=Bi(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},LA(e))RA(t,n);else if(n=hA(e,t,n,r),n!==null){var i=Bt();rr(n,e,r,i),IA(n,t,r)}}function d3(e,t,n){var r=Bi(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(LA(e))RA(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,a=s(o,n);if(i.hasEagerState=!0,i.eagerState=a,or(a,o)){var l=t.interleaved;l===null?(i.next=i,Lv(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}n=hA(e,t,i,r),n!==null&&(i=Bt(),rr(n,e,r,i),IA(n,t,r))}}function LA(e){var t=e.alternate;return e===Ye||t!==null&&t===Ye}function RA(e,t){zl=Td=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function IA(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,vv(e,n)}}var _d={readContext:Fn,useCallback:Et,useContext:Et,useEffect:Et,useImperativeHandle:Et,useInsertionEffect:Et,useLayoutEffect:Et,useMemo:Et,useReducer:Et,useRef:Et,useState:Et,useDebugValue:Et,useDeferredValue:Et,useTransition:Et,useMutableSource:Et,useSyncExternalStore:Et,useId:Et,unstable_isNewReconciler:!1},h3={readContext:Fn,useCallback:function(e,t){return mr().memoizedState=[e,t===void 0?null:t],e},useContext:Fn,useEffect:bb,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Nf(4194308,4,TA.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Nf(4194308,4,e,t)},useInsertionEffect:function(e,t){return Nf(4,2,e,t)},useMemo:function(e,t){var n=mr();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=mr();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=f3.bind(null,Ye,e),[r.memoizedState,e]},useRef:function(e){var t=mr();return e={current:e},t.memoizedState=e},useState:xb,useDebugValue:Vv,useDeferredValue:function(e){return mr().memoizedState=e},useTransition:function(){var e=xb(!1),t=e[0];return e=c3.bind(null,e[1]),mr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Ye,i=mr();if(ze){if(n===void 0)throw Error(Q(407));n=n()}else{if(n=t(),mt===null)throw Error(Q(349));Bs&30||vA(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,bb(xA.bind(null,r,s,e),[e]),r.flags|=2048,xu(9,wA.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=mr(),t=mt.identifierPrefix;if(ze){var n=Ur,r=zr;n=(r&~(1<<32-nr(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=vu++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[vr]=t,e[mu]=r,HA(e,t,!1,!1),t.stateNode=e;e:{switch(o=Yg(n,r),n){case"dialog":$e("cancel",e),$e("close",e),i=r;break;case"iframe":case"object":case"embed":$e("load",e),i=r;break;case"video":case"audio":for(i=0;i<_l.length;i++)$e(_l[i],e);i=r;break;case"source":$e("error",e),i=r;break;case"img":case"image":case"link":$e("error",e),$e("load",e),i=r;break;case"details":$e("toggle",e),i=r;break;case"input":B1(e,r),i=zg(e,r),$e("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=Ge({},r,{value:void 0}),$e("invalid",e);break;case"textarea":z1(e,r),i=Wg(e,r),$e("invalid",e);break;default:i=r}qg(n,i),a=i;for(s in a)if(a.hasOwnProperty(s)){var l=a[s];s==="style"?k_(e,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&b_(e,l)):s==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&ou(e,l):typeof l=="number"&&ou(e,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(su.hasOwnProperty(s)?l!=null&&s==="onScroll"&&$e("scroll",e):l!=null&&dv(e,s,l,o))}switch(n){case"input":Ac(e),V1(e,r,!1);break;case"textarea":Ac(e),U1(e);break;case"option":r.value!=null&&e.setAttribute("value",""+qi(r.value));break;case"select":e.multiple=!!r.multiple,s=r.value,s!=null?qo(e,!!r.multiple,s,!1):r.defaultValue!=null&&qo(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=yd)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Ct(t),null;case 6:if(e&&t.stateNode!=null)KA(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(Q(166));if(n=_s(yu.current),_s(Sr.current),jc(t)){if(r=t.stateNode,n=t.memoizedProps,r[vr]=t,(s=r.nodeValue!==n)&&(e=gn,e!==null))switch(e.tag){case 3:Mc(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Mc(r.nodeValue,n,(e.mode&1)!==0)}s&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[vr]=t,t.stateNode=r}return Ct(t),null;case 13:if(Ve(We),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(ze&&hn!==null&&t.mode&1&&!(t.flags&128))cA(),fa(),t.flags|=98560,s=!1;else if(s=jc(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(Q(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(Q(317));s[vr]=t}else fa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ct(t),s=!1}else Qn!==null&&(Ay(Qn),Qn=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||We.current&1?ht===0&&(ht=3):Yv())),t.updateQueue!==null&&(t.flags|=4),Ct(t),null);case 4:return ha(),xy(e,t),e===null&&hu(t.stateNode.containerInfo),Ct(t),null;case 10:return Ov(t.type._context),Ct(t),null;case 17:return nn(t.type)&&vd(),Ct(t),null;case 19:if(Ve(We),s=t.memoizedState,s===null)return Ct(t),null;if(r=(t.flags&128)!==0,o=s.rendering,o===null)if(r)ol(s,!1);else{if(ht!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Cd(e),o!==null){for(t.flags|=128,ol(s,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)s=n,e=r,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,e=o.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return De(We,We.current&1|2),t.child}e=e.sibling}s.tail!==null&&tt()>ma&&(t.flags|=128,r=!0,ol(s,!1),t.lanes=4194304)}else{if(!r)if(e=Cd(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ol(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!ze)return Ct(t),null}else 2*tt()-s.renderingStartTime>ma&&n!==1073741824&&(t.flags|=128,r=!0,ol(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(n=s.last,n!==null?n.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=tt(),t.sibling=null,n=We.current,De(We,r?n&1|2:n&1),t):(Ct(t),null);case 22:case 23:return qv(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?ln&1073741824&&(Ct(t),t.subtreeFlags&6&&(t.flags|=8192)):Ct(t),null;case 24:return null;case 25:return null}throw Error(Q(156,t.tag))}function b3(e,t){switch(_v(t),t.tag){case 1:return nn(t.type)&&vd(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ha(),Ve(tn),Ve(Lt),Mv(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Dv(t),null;case 13:if(Ve(We),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Q(340));fa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ve(We),null;case 4:return ha(),null;case 10:return Ov(t.type._context),null;case 22:case 23:return qv(),null;case 24:return null;default:return null}}var Bc=!1,_t=!1,S3=typeof WeakSet=="function"?WeakSet:Set,oe=null;function Lo(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Qe(e,t,r)}else n.current=null}function by(e,t,n){try{n()}catch(r){Qe(e,t,r)}}var Lb=!1;function k3(e,t){if(iy=pd,e=Q_(),Cv(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,u=0,f=0,c=e,d=null;t:for(;;){for(var h;c!==n||i!==0&&c.nodeType!==3||(a=o+i),c!==s||r!==0&&c.nodeType!==3||(l=o+r),c.nodeType===3&&(o+=c.nodeValue.length),(h=c.firstChild)!==null;)d=c,c=h;for(;;){if(c===e)break t;if(d===n&&++u===i&&(a=o),d===s&&++f===r&&(l=o),(h=c.nextSibling)!==null)break;c=d,d=c.parentNode}c=h}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(sy={focusedElem:e,selectionRange:n},pd=!1,oe=t;oe!==null;)if(t=oe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,oe=e;else for(;oe!==null;){t=oe;try{var p=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var m=p.memoizedProps,w=p.memoizedState,y=t.stateNode,v=y.getSnapshotBeforeUpdate(t.elementType===t.type?m:qn(t.type,m),w);y.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Q(163))}}catch(x){Qe(t,t.return,x)}if(e=t.sibling,e!==null){e.return=t.return,oe=e;break}oe=t.return}return p=Lb,Lb=!1,p}function Ul(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&by(t,n,s)}i=i.next}while(i!==r)}}function Lh(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Sy(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function qA(e){var t=e.alternate;t!==null&&(e.alternate=null,qA(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[vr],delete t[mu],delete t[ly],delete t[s3],delete t[o3])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function YA(e){return e.tag===5||e.tag===3||e.tag===4}function Rb(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||YA(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ky(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=yd));else if(r!==4&&(e=e.child,e!==null))for(ky(e,t,n),e=e.sibling;e!==null;)ky(e,t,n),e=e.sibling}function Ey(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Ey(e,t,n),e=e.sibling;e!==null;)Ey(e,t,n),e=e.sibling}var xt=null,Yn=!1;function gi(e,t,n){for(n=n.child;n!==null;)GA(e,t,n),n=n.sibling}function GA(e,t,n){if(br&&typeof br.onCommitFiberUnmount=="function")try{br.onCommitFiberUnmount(Eh,n)}catch{}switch(n.tag){case 5:_t||Lo(n,t);case 6:var r=xt,i=Yn;xt=null,gi(e,t,n),xt=r,Yn=i,xt!==null&&(Yn?(e=xt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):xt.removeChild(n.stateNode));break;case 18:xt!==null&&(Yn?(e=xt,n=n.stateNode,e.nodeType===8?dm(e.parentNode,n):e.nodeType===1&&dm(e,n),cu(e)):dm(xt,n.stateNode));break;case 4:r=xt,i=Yn,xt=n.stateNode.containerInfo,Yn=!0,gi(e,t,n),xt=r,Yn=i;break;case 0:case 11:case 14:case 15:if(!_t&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&by(n,t,o),i=i.next}while(i!==r)}gi(e,t,n);break;case 1:if(!_t&&(Lo(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Qe(n,t,a)}gi(e,t,n);break;case 21:gi(e,t,n);break;case 22:n.mode&1?(_t=(r=_t)||n.memoizedState!==null,gi(e,t,n),_t=r):gi(e,t,n);break;default:gi(e,t,n)}}function Ib(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new S3),t.forEach(function(r){var i=L3.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Wn(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=tt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*C3(r/1960))-r,10e?16:e,Li===null)var r=!1;else{if(e=Li,Li=null,Pd=0,Ae&6)throw Error(Q(331));var i=Ae;for(Ae|=4,oe=e.current;oe!==null;){var s=oe,o=s.child;if(oe.flags&16){var a=s.deletions;if(a!==null){for(var l=0;ltt()-Wv?Rs(e,0):Hv|=n),rn(e,t)}function r2(e,t){t===0&&(e.mode&1?(t=Oc,Oc<<=1,!(Oc&130023424)&&(Oc=4194304)):t=1);var n=Bt();e=ni(e,t),e!==null&&(Zu(e,t,n),rn(e,n))}function O3(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),r2(e,n)}function L3(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Q(314))}r!==null&&r.delete(t),r2(e,n)}var i2;i2=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||tn.current)Jt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Jt=!1,w3(e,t,n);Jt=!!(e.flags&131072)}else Jt=!1,ze&&t.flags&1048576&&lA(t,bd,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Pf(e,t),e=t.pendingProps;var i=ca(t,Lt.current);Qo(t,n),i=Fv(null,t,r,e,i,n);var s=$v();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,nn(r)?(s=!0,wd(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Rv(t),i.updater=Oh,t.stateNode=i,i._reactInternals=t,py(t,r,e,n),t=yy(null,t,r,!0,s,n)):(t.tag=0,ze&&s&&Tv(t),Mt(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Pf(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=I3(r),e=qn(r,e),i){case 0:t=gy(null,t,r,e,n);break e;case 1:t=Nb(null,t,r,e,n);break e;case 11:t=_b(null,t,r,e,n);break e;case 14:t=Ab(null,t,r,qn(r.type,e),n);break e}throw Error(Q(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:qn(r,i),gy(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:qn(r,i),Nb(e,t,r,i,n);case 3:e:{if(VA(t),e===null)throw Error(Q(387));r=t.pendingProps,s=t.memoizedState,i=s.element,pA(e,t),Ed(t,r,null,n);var o=t.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=pa(Error(Q(423)),t),t=Pb(e,t,r,n,i);break e}else if(r!==i){i=pa(Error(Q(424)),t),t=Pb(e,t,r,n,i);break e}else for(hn=ji(t.stateNode.containerInfo.firstChild),gn=t,ze=!0,Qn=null,n=dA(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(fa(),r===i){t=ri(e,t,n);break e}Mt(e,t,r,n)}t=t.child}return t;case 5:return mA(t),e===null&&fy(t),r=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,oy(r,i)?o=null:s!==null&&oy(r,s)&&(t.flags|=32),BA(e,t),Mt(e,t,o,n),t.child;case 6:return e===null&&fy(t),null;case 13:return zA(e,t,n);case 4:return Iv(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=da(t,null,r,n):Mt(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:qn(r,i),_b(e,t,r,i,n);case 7:return Mt(e,t,t.pendingProps,n),t.child;case 8:return Mt(e,t,t.pendingProps.children,n),t.child;case 12:return Mt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,De(Sd,r._currentValue),r._currentValue=o,s!==null)if(or(s.value,o)){if(s.children===i.children&&!tn.current){t=ri(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=Yr(-1,n&-n),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var f=u.pending;f===null?l.next=l:(l.next=f.next,f.next=l),u.pending=l}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),dy(s.return,n,t),a.lanes|=n;break}l=l.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(Q(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),dy(o,n,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Mt(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,Qo(t,n),i=Fn(i),r=r(i),t.flags|=1,Mt(e,t,r,n),t.child;case 14:return r=t.type,i=qn(r,t.pendingProps),i=qn(r.type,i),Ab(e,t,r,i,n);case 15:return FA(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:qn(r,i),Pf(e,t),t.tag=1,nn(r)?(e=!0,wd(t)):e=!1,Qo(t,n),DA(t,r,i),py(t,r,i,n),yy(null,t,r,!0,e,n);case 19:return UA(e,t,n);case 22:return $A(e,t,n)}throw Error(Q(156,t.tag))};function s2(e,t){return L_(e,t)}function R3(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function In(e,t,n,r){return new R3(e,t,n,r)}function Gv(e){return e=e.prototype,!(!e||!e.isReactComponent)}function I3(e){if(typeof e=="function")return Gv(e)?1:0;if(e!=null){if(e=e.$$typeof,e===pv)return 11;if(e===mv)return 14}return 2}function Vi(e,t){var n=e.alternate;return n===null?(n=In(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Rf(e,t,n,r,i,s){var o=2;if(r=e,typeof e=="function")Gv(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case ko:return Is(n.children,i,s,t);case hv:o=8,i|=8;break;case Fg:return e=In(12,n,t,i|2),e.elementType=Fg,e.lanes=s,e;case $g:return e=In(13,n,t,i),e.elementType=$g,e.lanes=s,e;case Bg:return e=In(19,n,t,i),e.elementType=Bg,e.lanes=s,e;case m_:return Ih(n,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case h_:o=10;break e;case p_:o=9;break e;case pv:o=11;break e;case mv:o=14;break e;case Ei:o=16,r=null;break e}throw Error(Q(130,e==null?e:typeof e,""))}return t=In(o,n,t,i),t.elementType=e,t.type=r,t.lanes=s,t}function Is(e,t,n,r){return e=In(7,e,r,t),e.lanes=n,e}function Ih(e,t,n,r){return e=In(22,e,r,t),e.elementType=m_,e.lanes=n,e.stateNode={isHidden:!1},e}function xm(e,t,n){return e=In(6,e,null,t),e.lanes=n,e}function bm(e,t,n){return t=In(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function D3(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=tm(0),this.expirationTimes=tm(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=tm(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Xv(e,t,n,r,i,s,o,a,l){return e=new D3(e,t,n,a,l),t===1?(t=1,s===!0&&(t|=8)):t=0,s=In(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Rv(s),e}function M3(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(u2)}catch(e){console.error(e)}}u2(),u_.exports=kn;var nc=u_.exports;const V3=ci(nc);var c2,zb=nc;c2=zb.createRoot,zb.hydrateRoot;/** * @remix-run/router v1.19.2 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function Su(){return Su=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function f2(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function U3(){return Math.random().toString(36).substr(2,8)}function Hb(e,t){return{usr:e.state,key:e.key,idx:t}}function Ny(e,t,n,r){return n===void 0&&(n=null),Su({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Ra(t):t,{state:n,key:t&&t.key||r||U3()})}function Rd(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Ra(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function H3(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,a=Ri.Pop,l=null,u=f();u==null&&(u=0,o.replaceState(Su({},o.state,{idx:u}),""));function f(){return(o.state||{idx:null}).idx}function c(){a=Ri.Pop;let w=f(),y=w==null?null:w-u;u=w,l&&l({action:a,location:m.location,delta:y})}function d(w,y){a=Ri.Push;let v=Ny(m.location,w,y);u=f()+1;let g=Hb(v,u),x=m.createHref(v);try{o.pushState(g,"",x)}catch(S){if(S instanceof DOMException&&S.name==="DataCloneError")throw S;i.location.assign(x)}s&&l&&l({action:a,location:m.location,delta:1})}function h(w,y){a=Ri.Replace;let v=Ny(m.location,w,y);u=f();let g=Hb(v,u),x=m.createHref(v);o.replaceState(g,"",x),s&&l&&l({action:a,location:m.location,delta:0})}function p(w){let y=i.location.origin!=="null"?i.location.origin:i.location.href,v=typeof w=="string"?w:Rd(w);return v=v.replace(/ $/,"%20"),ot(y,"No window.location.(origin|href) available to create URL for href: "+v),new URL(v,y)}let m={get action(){return a},get location(){return e(i,o)},listen(w){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(Ub,c),l=w,()=>{i.removeEventListener(Ub,c),l=null}},createHref(w){return t(i,w)},createURL:p,encodeLocation(w){let y=p(w);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:d,replace:h,go(w){return o.go(w)}};return m}var Wb;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Wb||(Wb={}));function W3(e,t,n){return n===void 0&&(n="/"),K3(e,t,n,!1)}function K3(e,t,n,r){let i=typeof t=="string"?Ra(t):t,s=ew(i.pathname||"/",n);if(s==null)return null;let o=d2(e);q3(o);let a=null;for(let l=0;a==null&&l{let l={relativePath:a===void 0?s.path||"":a,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};l.relativePath.startsWith("/")&&(ot(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let u=zi([r,l.relativePath]),f=n.concat(l);s.children&&s.children.length>0&&(ot(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),d2(s.children,t,f,u)),!(s.path==null&&!s.index)&&t.push({path:u,score:e5(u,s.index),routesMeta:f})};return e.forEach((s,o)=>{var a;if(s.path===""||!((a=s.path)!=null&&a.includes("?")))i(s,o);else for(let l of h2(s.path))i(s,o,l)}),t}function h2(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=h2(r.join("/")),a=[];return a.push(...o.map(l=>l===""?s:[s,l].join("/"))),i&&a.push(...o),a.map(l=>e.startsWith("/")&&l===""?"/":l)}function q3(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:t5(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const Y3=/^:[\w-]+$/,G3=3,X3=2,Q3=1,Z3=10,J3=-2,Kb=e=>e==="*";function e5(e,t){let n=e.split("/"),r=n.length;return n.some(Kb)&&(r+=J3),t&&(r+=X3),n.filter(i=>!Kb(i)).reduce((i,s)=>i+(Y3.test(s)?G3:s===""?Q3:Z3),r)}function t5(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function n5(e,t,n){let{routesMeta:r}=e,i={},s="/",o=[];for(let a=0;a{let{paramName:d,isOptional:h}=f;if(d==="*"){let m=a[c]||"";o=s.slice(0,s.length-m.length).replace(/(.)\/+$/,"$1")}const p=a[c];return h&&!p?u[d]=void 0:u[d]=(p||"").replace(/%2F/g,"/"),u},{}),pathname:s,pathnameBase:o,pattern:e}}function r5(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),f2(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function i5(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return f2(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function ew(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function s5(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?Ra(e):e;return{pathname:n?n.startsWith("/")?n:o5(n,t):t,search:u5(r),hash:c5(i)}}function o5(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function Sm(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function a5(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function p2(e,t){let n=a5(e);return t?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function m2(e,t,n,r){r===void 0&&(r=!1);let i;typeof e=="string"?i=Ra(e):(i=Su({},e),ot(!i.pathname||!i.pathname.includes("?"),Sm("?","pathname","search",i)),ot(!i.pathname||!i.pathname.includes("#"),Sm("#","pathname","hash",i)),ot(!i.search||!i.search.includes("#"),Sm("#","search","hash",i)));let s=e===""||i.pathname==="",o=s?"/":i.pathname,a;if(o==null)a=n;else{let c=t.length-1;if(!r&&o.startsWith("..")){let d=o.split("/");for(;d[0]==="..";)d.shift(),c-=1;i.pathname=d.join("/")}a=c>=0?t[c]:"/"}let l=s5(i,a),u=o&&o!=="/"&&o.endsWith("/"),f=(s||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(u||f)&&(l.pathname+="/"),l}const zi=e=>e.join("/").replace(/\/\/+/g,"/"),l5=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),u5=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,c5=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function f5(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const g2=["post","put","patch","delete"];new Set(g2);const d5=["get",...g2];new Set(d5);/** * React Router v6.26.2 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function ku(){return ku=Object.assign?Object.assign.bind():function(e){for(var t=1;t{a.current=!0}),E.useCallback(function(u,f){if(f===void 0&&(f={}),!a.current)return;if(typeof u=="number"){r.go(u);return}let c=m2(u,JSON.parse(o),s,f.relative==="path");e==null&&t!=="/"&&(c.pathname=c.pathname==="/"?t:zi([t,c.pathname])),(f.replace?r.replace:r.push)(c,f.state,f)},[t,r,o,s,e])}function g5(){let{matches:e}=E.useContext(as),t=e[e.length-1];return t?t.params:{}}function x2(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=E.useContext(to),{matches:i}=E.useContext(as),{pathname:s}=ic(),o=JSON.stringify(p2(i,r.v7_relativeSplatPath));return E.useMemo(()=>m2(e,JSON.parse(o),s,n==="path"),[e,o,s,n])}function y5(e,t){return v5(e,t)}function v5(e,t,n,r){rc()||ot(!1);let{navigator:i}=E.useContext(to),{matches:s}=E.useContext(as),o=s[s.length-1],a=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let u=ic(),f;if(t){var c;let w=typeof t=="string"?Ra(t):t;l==="/"||(c=w.pathname)!=null&&c.startsWith(l)||ot(!1),f=w}else f=u;let d=f.pathname||"/",h=d;if(l!=="/"){let w=l.replace(/^\//,"").split("/");h="/"+d.replace(/^\//,"").split("/").slice(w.length).join("/")}let p=W3(e,{pathname:h}),m=k5(p&&p.map(w=>Object.assign({},w,{params:Object.assign({},a,w.params),pathname:zi([l,i.encodeLocation?i.encodeLocation(w.pathname).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?l:zi([l,i.encodeLocation?i.encodeLocation(w.pathnameBase).pathname:w.pathnameBase])})),s,n,r);return t&&m?E.createElement($h.Provider,{value:{location:ku({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:Ri.Pop}},m):m}function w5(){let e=_5(),t=f5(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return E.createElement(E.Fragment,null,E.createElement("h2",null,"Unexpected Application Error!"),E.createElement("h3",{style:{fontStyle:"italic"}},t),n?E.createElement("pre",{style:i},n):null,null)}const x5=E.createElement(w5,null);class b5 extends E.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?E.createElement(as.Provider,{value:this.props.routeContext},E.createElement(y2.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function S5(e){let{routeContext:t,match:n,children:r}=e,i=E.useContext(tw);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),E.createElement(as.Provider,{value:t},r)}function k5(e,t,n,r){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var s;if(!n)return null;if(n.errors)e=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,a=(i=n)==null?void 0:i.errors;if(a!=null){let f=o.findIndex(c=>c.route.id&&(a==null?void 0:a[c.route.id])!==void 0);f>=0||ot(!1),o=o.slice(0,Math.min(o.length,f+1))}let l=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let f=0;f=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((f,c,d)=>{let h,p=!1,m=null,w=null;n&&(h=a&&c.route.id?a[c.route.id]:void 0,m=c.route.errorElement||x5,l&&(u<0&&d===0?(p=!0,w=null):u===d&&(p=!0,w=c.route.hydrateFallbackElement||null)));let y=t.concat(o.slice(0,d+1)),v=()=>{let g;return h?g=m:p?g=w:c.route.Component?g=E.createElement(c.route.Component,null):c.route.element?g=c.route.element:g=f,E.createElement(S5,{match:c,routeContext:{outlet:f,matches:y,isDataRoute:n!=null},children:g})};return n&&(c.route.ErrorBoundary||c.route.errorElement||d===0)?E.createElement(b5,{location:n.location,revalidation:n.revalidation,component:m,error:h,children:v(),routeContext:{outlet:null,matches:y,isDataRoute:!0}}):v()},null)}var b2=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(b2||{}),Id=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(Id||{});function E5(e){let t=E.useContext(tw);return t||ot(!1),t}function C5(e){let t=E.useContext(h5);return t||ot(!1),t}function T5(e){let t=E.useContext(as);return t||ot(!1),t}function S2(e){let t=T5(),n=t.matches[t.matches.length-1];return n.route.id||ot(!1),n.route.id}function _5(){var e;let t=E.useContext(y2),n=C5(Id.UseRouteError),r=S2(Id.UseRouteError);return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function A5(){let{router:e}=E5(b2.UseNavigateStable),t=S2(Id.UseNavigateStable),n=E.useRef(!1);return v2(()=>{n.current=!0}),E.useCallback(function(i,s){s===void 0&&(s={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,ku({fromRouteId:t},s)))},[e,t])}function yo(e){ot(!1)}function N5(e){let{basename:t="/",children:n=null,location:r,navigationType:i=Ri.Pop,navigator:s,static:o=!1,future:a}=e;rc()&&ot(!1);let l=t.replace(/^\/*/,"/"),u=E.useMemo(()=>({basename:l,navigator:s,static:o,future:ku({v7_relativeSplatPath:!1},a)}),[l,a,s,o]);typeof r=="string"&&(r=Ra(r));let{pathname:f="/",search:c="",hash:d="",state:h=null,key:p="default"}=r,m=E.useMemo(()=>{let w=ew(f,l);return w==null?null:{location:{pathname:w,search:c,hash:d,state:h,key:p},navigationType:i}},[l,f,c,d,h,p,i]);return m==null?null:E.createElement(to.Provider,{value:u},E.createElement($h.Provider,{children:n,value:m}))}function P5(e){let{children:t,location:n}=e;return y5(Py(t),n)}new Promise(()=>{});function Py(e,t){t===void 0&&(t=[]);let n=[];return E.Children.forEach(e,(r,i)=>{if(!E.isValidElement(r))return;let s=[...t,i];if(r.type===E.Fragment){n.push.apply(n,Py(r.props.children,s));return}r.type!==yo&&ot(!1),!r.props.index||!r.props.children||ot(!1);let o={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=Py(r.props.children,s)),n.push(o)}),n}/** * React Router DOM v6.26.2 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function Oy(){return Oy=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}function L5(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function R5(e,t){return e.button===0&&(!t||t==="_self")&&!L5(e)}const I5=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],D5="6";try{window.__reactRouterVersion=D5}catch{}const M5="startTransition",Yb=ld[M5];function j5(e){let{basename:t,children:n,future:r,window:i}=e,s=E.useRef();s.current==null&&(s.current=z3({window:i,v5Compat:!0}));let o=s.current,[a,l]=E.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},f=E.useCallback(c=>{u&&Yb?Yb(()=>l(c)):l(c)},[l,u]);return E.useLayoutEffect(()=>o.listen(f),[o,f]),E.createElement(N5,{basename:t,children:n,location:a.location,navigationType:a.action,navigator:o,future:r})}const F5=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",$5=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Kl=E.forwardRef(function(t,n){let{onClick:r,relative:i,reloadDocument:s,replace:o,state:a,target:l,to:u,preventScrollReset:f,unstable_viewTransition:c}=t,d=O5(t,I5),{basename:h}=E.useContext(to),p,m=!1;if(typeof u=="string"&&$5.test(u)&&(p=u,F5))try{let g=new URL(window.location.href),x=u.startsWith("//")?new URL(g.protocol+u):new URL(u),S=ew(x.pathname,h);x.origin===g.origin&&S!=null?u=S+x.search+x.hash:m=!0}catch{}let w=p5(u,{relative:i}),y=B5(u,{replace:o,state:a,target:l,preventScrollReset:f,relative:i,unstable_viewTransition:c});function v(g){r&&r(g),g.defaultPrevented||y(g)}return E.createElement("a",Oy({},d,{href:p||w,onClick:m||s?r:v,ref:n,target:l}))});var Gb;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Gb||(Gb={}));var Xb;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Xb||(Xb={}));function B5(e,t){let{target:n,replace:r,state:i,preventScrollReset:s,relative:o,unstable_viewTransition:a}=t===void 0?{}:t,l=w2(),u=ic(),f=x2(e,{relative:o});return E.useCallback(c=>{if(R5(c,n)){c.preventDefault();let d=r!==void 0?r:Rd(u)===Rd(f);l(e,{replace:d,state:i,preventScrollReset:s,relative:o,unstable_viewTransition:a})}},[u,l,f,r,i,n,e,s,o,a])}function wt(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var V5=typeof Symbol=="function"&&Symbol.observable||"@@observable",Qb=V5,km=()=>Math.random().toString(36).substring(7).split("").join("."),z5={INIT:`@@redux/INIT${km()}`,REPLACE:`@@redux/REPLACE${km()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${km()}`},Dd=z5;function nw(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function k2(e,t,n){if(typeof e!="function")throw new Error(wt(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(wt(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(wt(1));return n(k2)(e,t)}let r=e,i=t,s=new Map,o=s,a=0,l=!1;function u(){o===s&&(o=new Map,s.forEach((w,y)=>{o.set(y,w)}))}function f(){if(l)throw new Error(wt(3));return i}function c(w){if(typeof w!="function")throw new Error(wt(4));if(l)throw new Error(wt(5));let y=!0;u();const v=a++;return o.set(v,w),function(){if(y){if(l)throw new Error(wt(6));y=!1,u(),o.delete(v),s=null}}}function d(w){if(!nw(w))throw new Error(wt(7));if(typeof w.type>"u")throw new Error(wt(8));if(typeof w.type!="string")throw new Error(wt(17));if(l)throw new Error(wt(9));try{l=!0,i=r(i,w)}finally{l=!1}return(s=o).forEach(v=>{v()}),w}function h(w){if(typeof w!="function")throw new Error(wt(10));r=w,d({type:Dd.REPLACE})}function p(){const w=c;return{subscribe(y){if(typeof y!="object"||y===null)throw new Error(wt(11));function v(){const x=y;x.next&&x.next(f())}return v(),{unsubscribe:w(v)}},[Qb](){return this}}}return d({type:Dd.INIT}),{dispatch:d,subscribe:c,getState:f,replaceReducer:h,[Qb]:p}}function U5(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:Dd.INIT})>"u")throw new Error(wt(12));if(typeof n(void 0,{type:Dd.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(wt(13))})}function H5(e){const t=Object.keys(e),n={};for(let s=0;s"u")throw a&&a.type,new Error(wt(14));u[c]=p,l=l||p!==h}return l=l||r.length!==Object.keys(o).length,l?u:o}}function Md(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function W5(...e){return t=>(n,r)=>{const i=t(n,r);let s=()=>{throw new Error(wt(15))};const o={getState:i.getState,dispatch:(l,...u)=>s(l,...u)},a=e.map(l=>l(o));return s=Md(...a)(i.dispatch),{...i,dispatch:s}}}function K5(e){return nw(e)&&"type"in e&&typeof e.type=="string"}var E2=Symbol.for("immer-nothing"),Zb=Symbol.for("immer-draftable"),wn=Symbol.for("immer-state");function Zn(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var ga=Object.getPrototypeOf;function Us(e){return!!e&&!!e[wn]}function ii(e){var t;return e?C2(e)||Array.isArray(e)||!!e[Zb]||!!((t=e.constructor)!=null&&t[Zb])||Vh(e)||zh(e):!1}var q5=Object.prototype.constructor.toString();function C2(e){if(!e||typeof e!="object")return!1;const t=ga(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===q5}function jd(e,t){Bh(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Bh(e){const t=e[wn];return t?t.type_:Array.isArray(e)?1:Vh(e)?2:zh(e)?3:0}function Ly(e,t){return Bh(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function T2(e,t,n){const r=Bh(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Y5(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Vh(e){return e instanceof Map}function zh(e){return e instanceof Set}function ws(e){return e.copy_||e.base_}function Ry(e,t){if(Vh(e))return new Map(e);if(zh(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=C2(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[wn];let i=Reflect.ownKeys(r);for(let s=0;s1&&(e.set=e.add=e.clear=e.delete=G5),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>rw(r,!0))),e}function G5(){Zn(2)}function Uh(e){return Object.isFrozen(e)}var X5={};function Hs(e){const t=X5[e];return t||Zn(0,e),t}var Eu;function _2(){return Eu}function Q5(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Jb(e,t){t&&(Hs("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Iy(e){Dy(e),e.drafts_.forEach(Z5),e.drafts_=null}function Dy(e){e===Eu&&(Eu=e.parent_)}function eS(e){return Eu=Q5(Eu,e)}function Z5(e){const t=e[wn];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function tS(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[wn].modified_&&(Iy(t),Zn(4)),ii(e)&&(e=Fd(t,e),t.parent_||$d(t,e)),t.patches_&&Hs("Patches").generateReplacementPatches_(n[wn].base_,e,t.patches_,t.inversePatches_)):e=Fd(t,n,[]),Iy(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==E2?e:void 0}function Fd(e,t,n){if(Uh(t))return t;const r=t[wn];if(!r)return jd(t,(i,s)=>nS(e,r,t,i,s,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return $d(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const i=r.copy_;let s=i,o=!1;r.type_===3&&(s=new Set(i),i.clear(),o=!0),jd(s,(a,l)=>nS(e,r,i,a,l,n,o)),$d(e,i,!1),n&&e.patches_&&Hs("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function nS(e,t,n,r,i,s,o){if(Us(i)){const a=s&&t&&t.type_!==3&&!Ly(t.assigned_,r)?s.concat(r):void 0,l=Fd(e,i,a);if(T2(n,r,l),Us(l))e.canAutoFreeze_=!1;else return}else o&&n.add(i);if(ii(i)&&!Uh(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Fd(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&$d(e,i)}}function $d(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&rw(t,n)}function J5(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:_2(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,s=iw;n&&(i=[r],s=Cu);const{revoke:o,proxy:a}=Proxy.revocable(i,s);return r.draft_=a,r.revoke_=o,a}var iw={get(e,t){if(t===wn)return e;const n=ws(e);if(!Ly(n,t))return eB(e,n,t);const r=n[t];return e.finalized_||!ii(r)?r:r===Em(e.base_,t)?(Cm(e),e.copy_[t]=jy(r,e)):r},has(e,t){return t in ws(e)},ownKeys(e){return Reflect.ownKeys(ws(e))},set(e,t,n){const r=A2(ws(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=Em(ws(e),t),s=i==null?void 0:i[wn];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Y5(n,i)&&(n!==void 0||Ly(e.base_,t)))return!0;Cm(e),My(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Em(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Cm(e),My(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=ws(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Zn(11)},getPrototypeOf(e){return ga(e.base_)},setPrototypeOf(){Zn(12)}},Cu={};jd(iw,(e,t)=>{Cu[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Cu.deleteProperty=function(e,t){return Cu.set.call(this,e,t,void 0)};Cu.set=function(e,t,n){return iw.set.call(this,e[0],t,n,e[0])};function Em(e,t){const n=e[wn];return(n?ws(n):e)[t]}function eB(e,t,n){var i;const r=A2(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function A2(e,t){if(!(t in e))return;let n=ga(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=ga(n)}}function My(e){e.modified_||(e.modified_=!0,e.parent_&&My(e.parent_))}function Cm(e){e.copy_||(e.copy_=Ry(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var tB=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const s=n;n=t;const o=this;return function(l=s,...u){return o.produce(l,f=>n.call(this,f,...u))}}typeof n!="function"&&Zn(6),r!==void 0&&typeof r!="function"&&Zn(7);let i;if(ii(t)){const s=eS(this),o=jy(t,void 0);let a=!0;try{i=n(o),a=!1}finally{a?Iy(s):Dy(s)}return Jb(s,r),tS(i,s)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===E2&&(i=void 0),this.autoFreeze_&&rw(i,!0),r){const s=[],o=[];Hs("Patches").generateReplacementPatches_(t,i,s,o),r(s,o)}return i}else Zn(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(o,...a)=>this.produceWithPatches(o,l=>t(l,...a));let r,i;return[this.produce(t,n,(o,a)=>{r=o,i=a}),r,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){ii(e)||Zn(8),Us(e)&&(e=nB(e));const t=eS(this),n=jy(e,void 0);return n[wn].isManual_=!0,Dy(t),n}finishDraft(e,t){const n=e&&e[wn];(!n||!n.isManual_)&&Zn(9);const{scope_:r}=n;return Jb(r,t),tS(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=Hs("Patches").applyPatches_;return Us(e)?r(e,t):this.produce(e,i=>r(i,t))}};function jy(e,t){const n=Vh(e)?Hs("MapSet").proxyMap_(e,t):zh(e)?Hs("MapSet").proxySet_(e,t):J5(e,t);return(t?t.scope_:_2()).drafts_.push(n),n}function nB(e){return Us(e)||Zn(10,e),N2(e)}function N2(e){if(!ii(e)||Uh(e))return e;const t=e[wn];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Ry(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Ry(e,!0);return jd(n,(r,i)=>{T2(n,r,N2(i))}),t&&(t.finalized_=!1),n}var xn=new tB,P2=xn.produce;xn.produceWithPatches.bind(xn);xn.setAutoFreeze.bind(xn);xn.setUseStrictShallowCopy.bind(xn);xn.applyPatches.bind(xn);xn.createDraft.bind(xn);xn.finishDraft.bind(xn);function O2(e){return({dispatch:n,getState:r})=>i=>s=>typeof s=="function"?s(n,r,e):i(s)}var rB=O2(),iB=O2,sB=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Md:Md.apply(null,arguments)};function rS(e,t){function n(...r){if(t){let i=t(...r);if(!i)throw new Error(ir(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=r=>K5(r)&&r.type===e,n}var L2=class Al extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Al.prototype)}static get[Symbol.species](){return Al}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Al(...t[0].concat(this)):new Al(...t.concat(this))}};function iS(e){return ii(e)?P2(e,()=>{}):e}function sS(e,t,n){if(e.has(t)){let i=e.get(t);return n.update&&(i=n.update(i,t,e),e.set(t,i)),i}if(!n.insert)throw new Error(ir(10));const r=n.insert(t,e);return e.set(t,r),r}function oB(e){return typeof e=="boolean"}var aB=()=>function(t){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:s=!0}=t??{};let o=new L2;return n&&(oB(n)?o.push(rB):o.push(iB(n.extraArgument))),o},lB="RTK_autoBatch",R2=e=>t=>{setTimeout(t,e)},uB=typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:R2(10),cB=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let i=!0,s=!1,o=!1;const a=new Set,l=e.type==="tick"?queueMicrotask:e.type==="raf"?uB:e.type==="callback"?e.queueNotification:R2(e.timeout),u=()=>{o=!1,s&&(s=!1,a.forEach(f=>f()))};return Object.assign({},r,{subscribe(f){const c=()=>i&&f(),d=r.subscribe(c);return a.add(f),()=>{d(),a.delete(f)}},dispatch(f){var c;try{return i=!((c=f==null?void 0:f.meta)!=null&&c[lB]),s=!i,s&&(o||(o=!0,l(u))),r.dispatch(f)}finally{i=!0}}})},fB=e=>function(n){const{autoBatch:r=!0}=n??{};let i=new L2(e);return r&&i.push(cB(typeof r=="object"?r:void 0)),i};function dB(e){const t=aB(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:s=void 0,enhancers:o=void 0}=e||{};let a;if(typeof n=="function")a=n;else if(nw(n))a=H5(n);else throw new Error(ir(1));let l;typeof r=="function"?l=r(t):l=t();let u=Md;i&&(u=sB({trace:!1,...typeof i=="object"&&i}));const f=W5(...l),c=fB(f);let d=typeof o=="function"?o(c):c();const h=u(...d);return k2(a,s,h)}function I2(e){const t={},n=[];let r;const i={addCase(s,o){const a=typeof s=="string"?s:s.type;if(!a)throw new Error(ir(28));if(a in t)throw new Error(ir(29));return t[a]=o,i},addMatcher(s,o){return n.push({matcher:s,reducer:o}),i},addDefaultCase(s){return r=s,i}};return e(i),[t,n,r]}function hB(e){return typeof e=="function"}function pB(e,t){let[n,r,i]=I2(t),s;if(hB(e))s=()=>iS(e());else{const a=iS(e);s=()=>a}function o(a=s(),l){let u=[n[l.type],...r.filter(({matcher:f})=>f(l)).map(({reducer:f})=>f)];return u.filter(f=>!!f).length===0&&(u=[i]),u.reduce((f,c)=>{if(c)if(Us(f)){const h=c(f,l);return h===void 0?f:h}else{if(ii(f))return P2(f,d=>c(d,l));{const d=c(f,l);if(d===void 0){if(f===null)return f;throw new Error(ir(9))}return d}}return f},a)}return o.getInitialState=s,o}var mB=Symbol.for("rtk-slice-createasyncthunk");function gB(e,t){return`${e}/${t}`}function yB({creators:e}={}){var n;const t=(n=e==null?void 0:e.asyncThunk)==null?void 0:n[mB];return function(i){const{name:s,reducerPath:o=s}=i;if(!s)throw new Error(ir(11));typeof process<"u";const a=(typeof i.reducers=="function"?i.reducers(xB()):i.reducers)||{},l=Object.keys(a),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},f={addCase(g,x){const S=typeof g=="string"?g:g.type;if(!S)throw new Error(ir(12));if(S in u.sliceCaseReducersByType)throw new Error(ir(13));return u.sliceCaseReducersByType[S]=x,f},addMatcher(g,x){return u.sliceMatchers.push({matcher:g,reducer:x}),f},exposeAction(g,x){return u.actionCreators[g]=x,f},exposeCaseReducer(g,x){return u.sliceCaseReducersByName[g]=x,f}};l.forEach(g=>{const x=a[g],S={reducerName:g,type:gB(s,g),createNotation:typeof i.reducers=="function"};SB(x)?EB(S,x,f,t):bB(S,x,f)});function c(){const[g={},x=[],S=void 0]=typeof i.extraReducers=="function"?I2(i.extraReducers):[i.extraReducers],k={...g,...u.sliceCaseReducersByType};return pB(i.initialState,C=>{for(let T in k)C.addCase(T,k[T]);for(let T of u.sliceMatchers)C.addMatcher(T.matcher,T.reducer);for(let T of x)C.addMatcher(T.matcher,T.reducer);S&&C.addDefaultCase(S)})}const d=g=>g,h=new Map;let p;function m(g,x){return p||(p=c()),p(g,x)}function w(){return p||(p=c()),p.getInitialState()}function y(g,x=!1){function S(C){let T=C[g];return typeof T>"u"&&x&&(T=w()),T}function k(C=d){const T=sS(h,x,{insert:()=>new WeakMap});return sS(T,C,{insert:()=>{const O={};for(const[A,j]of Object.entries(i.selectors??{}))O[A]=vB(j,C,w,x);return O}})}return{reducerPath:g,getSelectors:k,get selectors(){return k(S)},selectSlice:S}}const v={name:s,reducer:m,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:w,...y(o),injectInto(g,{reducerPath:x,...S}={}){const k=x??o;return g.inject({reducerPath:k,reducer:m},S),{...v,...y(k,!0)}}};return v}}function vB(e,t,n,r){function i(s,...o){let a=t(s);return typeof a>"u"&&r&&(a=n()),e(a,...o)}return i.unwrapped=e,i}var wB=yB();function xB(){function e(t,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...n}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...n){return t(...n)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:n}},asyncThunk:e}}function bB({type:e,reducerName:t,createNotation:n},r,i){let s,o;if("reducer"in r){if(n&&!kB(r))throw new Error(ir(17));s=r.reducer,o=r.prepare}else s=r;i.addCase(e,s).exposeCaseReducer(t,s).exposeAction(t,o?rS(e,o):rS(e))}function SB(e){return e._reducerDefinitionType==="asyncThunk"}function kB(e){return e._reducerDefinitionType==="reducerWithPrepare"}function EB({type:e,reducerName:t},n,r,i){if(!i)throw new Error(ir(18));const{payloadCreator:s,fulfilled:o,pending:a,rejected:l,settled:u,options:f}=n,c=i(e,s,f);r.exposeAction(t,c),o&&r.addCase(c.fulfilled,o),a&&r.addCase(c.pending,a),l&&r.addCase(c.rejected,l),u&&r.addMatcher(c.settled,u),r.exposeCaseReducer(t,{fulfilled:o||Uc,pending:a||Uc,rejected:l||Uc,settled:u||Uc})}function Uc(){}function ir(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}const Ar=Object.create(null);Ar.open="0";Ar.close="1";Ar.ping="2";Ar.pong="3";Ar.message="4";Ar.upgrade="5";Ar.noop="6";const If=Object.create(null);Object.keys(Ar).forEach(e=>{If[Ar[e]]=e});const Fy={type:"error",data:"parser error"},D2=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",M2=typeof ArrayBuffer=="function",j2=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,sw=({type:e,data:t},n,r)=>D2&&t instanceof Blob?n?r(t):oS(t,r):M2&&(t instanceof ArrayBuffer||j2(t))?n?r(t):oS(new Blob([t]),r):r(Ar[e]+(t||"")),oS=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function aS(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Tm;function CB(e,t){if(D2&&e.data instanceof Blob)return e.data.arrayBuffer().then(aS).then(t);if(M2&&(e.data instanceof ArrayBuffer||j2(e.data)))return t(aS(e.data));sw(e,!1,n=>{Tm||(Tm=new TextEncoder),t(Tm.encode(n))})}const lS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Nl=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e{let t=e.length*.75,n=e.length,r,i=0,s,o,a,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const u=new ArrayBuffer(t),f=new Uint8Array(u);for(r=0;r>4,f[i++]=(o&15)<<4|a>>2,f[i++]=(a&3)<<6|l&63;return u},_B=typeof ArrayBuffer=="function",ow=(e,t)=>{if(typeof e!="string")return{type:"message",data:F2(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:AB(e.substring(1),t)}:If[n]?e.length>1?{type:If[n],data:e.substring(1)}:{type:If[n]}:Fy},AB=(e,t)=>{if(_B){const n=TB(e);return F2(n,t)}else return{base64:!0,data:e}},F2=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},$2="",NB=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((s,o)=>{sw(s,!1,a=>{r[o]=a,++i===n&&t(r.join($2))})})},PB=(e,t)=>{const n=e.split($2),r=[];for(let i=0;i{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const s=new DataView(i.buffer);s.setUint8(0,126),s.setUint16(1,r)}else{i=new Uint8Array(9);const s=new DataView(i.buffer);s.setUint8(0,127),s.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let _m;function Hc(e){return e.reduce((t,n)=>t+n.length,0)}function Wc(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let i=0;iMath.pow(2,21)-1){a.enqueue(Fy);break}i=f*Math.pow(2,32)+u.getUint32(4),r=3}else{if(Hc(n)e){a.enqueue(Fy);break}}}})}const B2=4;function st(e){if(e)return RB(e)}function RB(e){for(var t in st.prototype)e[t]=st.prototype[t];return e}st.prototype.on=st.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};st.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};st.prototype.off=st.prototype.removeListener=st.prototype.removeAllListeners=st.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,i=0;iPromise.resolve().then(t):(t,n)=>n(t,0),Ln=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),IB="arraybuffer";function V2(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const DB=Ln.setTimeout,MB=Ln.clearTimeout;function Wh(e,t){t.useNativeTimers?(e.setTimeoutFn=DB.bind(Ln),e.clearTimeoutFn=MB.bind(Ln)):(e.setTimeoutFn=Ln.setTimeout.bind(Ln),e.clearTimeoutFn=Ln.clearTimeout.bind(Ln))}const jB=1.33;function FB(e){return typeof e=="string"?$B(e):Math.ceil((e.byteLength||e.size)*jB)}function $B(e){let t=0,n=0;for(let r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n}function z2(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function BB(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function VB(e){let t={},n=e.split("&");for(let r=0,i=n.length;r{this.readyState="paused",t()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};PB(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,NB(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=z2()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let U2=!1;try{U2=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const HB=U2;function WB(){}class KB extends UB{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||r!==t.port}}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(i,s)=>{this.onError("xhr post error",i,s)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}class kr extends st{constructor(t,n,r){super(),this.createRequest=t,Wh(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var t;const n=V2(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=kr.requestsCount++,kr.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=WB,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete kr.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}kr.requestsCount=0;kr.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",uS);else if(typeof addEventListener=="function"){const e="onpagehide"in Ln?"pagehide":"unload";addEventListener(e,uS,!1)}}function uS(){for(let e in kr.requests)kr.requests.hasOwnProperty(e)&&kr.requests[e].abort()}const qB=function(){const e=H2({xdomain:!1});return e&&e.responseType!==null}();class YB extends KB{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=qB&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new kr(H2,this.uri(),t)}}function H2(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||HB))return new XMLHttpRequest}catch{}if(!t)try{return new Ln[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const W2=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class GB extends aw{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,r=W2?{}:V2(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n{try{this.doWrite(r,s)}catch{}i&&Hh(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=z2()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const Am=Ln.WebSocket||Ln.MozWebSocket;class XB extends GB{createSocket(t,n,r){return W2?new Am(t,n,r):n?new Am(t,n):new Am(t)}doWrite(t,n){this.ws.send(n)}}class QB extends aw{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=LB(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=OB();i.readable.pipeTo(t.writable),this._writer=i.writable.getWriter();const s=()=>{r.read().then(({done:a,value:l})=>{a||(this.onPacket(l),s())}).catch(a=>{})};s();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n{i&&Hh(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const ZB={websocket:XB,webtransport:QB,polling:YB},JB=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,e4=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function $y(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=JB.exec(e||""),s={},o=14;for(;o--;)s[e4[o]]=i[o]||"";return n!=-1&&r!=-1&&(s.source=t,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s.pathNames=t4(s,s.path),s.queryKey=n4(s,s.query),s}function t4(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function n4(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,s){i&&(n[i]=s)}),n}const By=typeof addEventListener=="function"&&typeof removeEventListener=="function",Df=[];By&&addEventListener("offline",()=>{Df.forEach(e=>e())},!1);class Ui extends st{constructor(t,n){if(super(),this.binaryType=IB,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const r=$y(t);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=$y(n.host).host);Wh(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const i=r.prototype.name;this.transports.push(i),this._transportsByName[i]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=VB(this.opts.query)),By&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Df.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=B2,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&Ui.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",Ui.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,Hh(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,r){return this._sendPacket("message",t,n,r),this}send(t,n,r){return this._sendPacket("message",t,n,r),this}_sendPacket(t,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const s={type:t,data:n,options:r};this.emitReserved("packetCreate",s),this.writeBuffer.push(s),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}_onError(t){if(Ui.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),By&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=Df.indexOf(this._offlineEventListener);r!==-1&&Df.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}Ui.protocol=B2;class r4 extends Ui{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",c=>{if(!r)if(c.type==="pong"&&c.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Ui.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(f(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const d=new Error("probe error");d.transport=n.name,this.emitReserved("upgradeError",d)}}))};function s(){r||(r=!0,f(),n.close(),n=null)}const o=c=>{const d=new Error("probe error: "+c);d.transport=n.name,s(),this.emitReserved("upgradeError",d)};function a(){o("transport closed")}function l(){o("socket closed")}function u(c){n&&c.name!==n.name&&s()}const f=()=>{n.removeListener("open",i),n.removeListener("error",o),n.removeListener("close",a),this.off("close",l),this.off("upgrading",u)};n.once("open",i),n.once("error",o),n.once("close",a),this.once("close",l),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let r=0;rZB[i]).filter(i=>!!i)),super(t,r)}};function s4(e,t="",n){let r=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),r=$y(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const s=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+s+":"+r.port+t,r.href=r.protocol+"://"+s+(n&&n.port===r.port?"":":"+r.port),r}const o4=typeof ArrayBuffer=="function",a4=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,K2=Object.prototype.toString,l4=typeof Blob=="function"||typeof Blob<"u"&&K2.call(Blob)==="[object BlobConstructor]",u4=typeof File=="function"||typeof File<"u"&&K2.call(File)==="[object FileConstructor]";function lw(e){return o4&&(e instanceof ArrayBuffer||a4(e))||l4&&e instanceof Blob||u4&&e instanceof File}function Mf(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n=0&&e.num{delete this.acks[t];for(let a=0;a{this.io.clearTimeoutFn(s),n.apply(this,a)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...n){return new Promise((r,i)=>{const s=(o,a)=>o?i(o):r(a);s.withError=!0,n.push(s),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...s)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...s)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Ee.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(r=>String(r.id)===t)){const r=this.acks[t];delete this.acks[t],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Ee.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ee.EVENT:case Ee.BINARY_EVENT:this.onevent(t);break;case Ee.ACK:case Ee.BINARY_ACK:this.onack(t);break;case Ee.DISCONNECT:this.ondisconnect();break;case Ee.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:Ee.ACK,id:t,data:i}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ee.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r0&&e.jitter<=1?e.jitter:0,this.attempts=0}Ia.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};Ia.prototype.reset=function(){this.attempts=0};Ia.prototype.setMin=function(e){this.ms=e};Ia.prototype.setMax=function(e){this.max=e};Ia.prototype.setJitter=function(e){this.jitter=e};class Uy extends st{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Wh(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new Ia({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const i=n.parser||g4;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new i4(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Gn(n,"open",function(){r.onopen(),t&&t()}),s=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),t?t(a):this.maybeReconnectOnOpen()},o=Gn(n,"error",s);if(this._timeout!==!1){const a=this._timeout,l=this.setTimeoutFn(()=>{i(),s(new Error("timeout")),n.close()},a);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(i),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Gn(t,"ping",this.onping.bind(this)),Gn(t,"data",this.ondata.bind(this)),Gn(t,"error",this.onerror.bind(this)),Gn(t,"close",this.onclose.bind(this)),Gn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){Hh(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new q2(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;rt()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const ll={};function jf(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=s4(e,t.path||"/socket.io"),r=n.source,i=n.id,s=n.path,o=ll[i]&&s in ll[i].nsps,a=t.forceNew||t["force new connection"]||t.multiplex===!1||o;let l;return a?l=new Uy(r,t):(ll[i]||(ll[i]=new Uy(r,t)),l=ll[i]),n.query&&!t.query&&(t.query=n.queryKey),l.socket(n.path,t)}Object.assign(jf,{Manager:Uy,Socket:q2,io:jf,connect:jf});var Y2=typeof global=="object"&&global&&global.Object===Object&&global,v4=typeof self=="object"&&self&&self.Object===Object&&self,Da=Y2||v4||Function("return this")(),Bd=Da.Symbol,G2=Object.prototype,w4=G2.hasOwnProperty,x4=G2.toString,ul=Bd?Bd.toStringTag:void 0;function b4(e){var t=w4.call(e,ul),n=e[ul];try{e[ul]=void 0;var r=!0}catch{}var i=x4.call(e);return r&&(t?e[ul]=n:delete e[ul]),i}var S4=Object.prototype,k4=S4.toString;function E4(e){return k4.call(e)}var C4="[object Null]",T4="[object Undefined]",fS=Bd?Bd.toStringTag:void 0;function Kh(e){return e==null?e===void 0?T4:C4:fS&&fS in Object(e)?b4(e):E4(e)}function sc(e){return e!=null&&typeof e=="object"}var Hy=Array.isArray;function no(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function X2(e){return e}var _4="[object AsyncFunction]",A4="[object Function]",N4="[object GeneratorFunction]",P4="[object Proxy]";function cw(e){if(!no(e))return!1;var t=Kh(e);return t==A4||t==N4||t==_4||t==P4}var Nm=Da["__core-js_shared__"],dS=function(){var e=/[^.]+$/.exec(Nm&&Nm.keys&&Nm.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function O4(e){return!!dS&&dS in e}var L4=Function.prototype,R4=L4.toString;function I4(e){if(e!=null){try{return R4.call(e)}catch{}try{return e+""}catch{}}return""}var D4=/[\\^$.*+?()[\]{}|]/g,M4=/^\[object .+?Constructor\]$/,j4=Function.prototype,F4=Object.prototype,$4=j4.toString,B4=F4.hasOwnProperty,V4=RegExp("^"+$4.call(B4).replace(D4,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function z4(e){if(!no(e)||O4(e))return!1;var t=cw(e)?V4:M4;return t.test(I4(e))}function U4(e,t){return e==null?void 0:e[t]}function fw(e,t){var n=U4(e,t);return z4(n)?n:void 0}var hS=Object.create,H4=function(){function e(){}return function(t){if(!no(t))return{};if(hS)return hS(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function W4(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function K4(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n0){if(++t>=q4)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Q4(e){return function(){return e}}var Vd=function(){try{var e=fw(Object,"defineProperty");return e({},"",{}),e}catch{}}(),Z4=Vd?function(e,t){return Vd(e,"toString",{configurable:!0,enumerable:!1,value:Q4(t),writable:!0})}:X2,J4=X4(Z4),eV=9007199254740991,tV=/^(?:0|[1-9]\d*)$/;function Q2(e,t){var n=typeof e;return t=t??eV,!!t&&(n=="number"||n!="symbol"&&tV.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=lV}function hw(e){return e!=null&&Z2(e.length)&&!cw(e)}function uV(e,t,n){if(!no(n))return!1;var r=typeof t;return(r=="number"?hw(n)&&Q2(t,n.length):r=="string"&&t in n)?qh(n[t],e):!1}function cV(e){return aV(function(t,n){var r=-1,i=n.length,s=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(s=e.length>3&&typeof s=="function"?(i--,s):void 0,o&&uV(n[0],n[1],o)&&(s=i<3?void 0:s,i=1),t=Object(t);++r-1}function mz(e,t){var n=this.__data__,r=Yh(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function di(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t debug : store : resetProject()"),kS},loadProjectState(e,t){e.projectData=t.payload.state,e.nodesKeys=[...new Set([...e.nodesKeys,...Object.keys(e.projectData)])],Object.keys(e.projectData).map(n=>{e.nodesKeysDict[n]=!0})},updateProjectState(e,t){const{key:n,data:r}=t.payload;console.log("> debug : store : updateProjectState ",{key:n,data:r}),n&&r&&(e.projectData=Hz(e.projectData,{[n]:r}),e.nodesKeys=[...new Set([...e.nodesKeys,...Object.keys(e.projectData)])],Object.keys(e.projectData).map(i=>{e.nodesKeysDict[i]=!0}))},startStreamEvent(e,t){const{key:n,meta:r}=t.payload;e.streamEvents[n]||(e.streamEvents[n]={is_running:!0,meta:r,data:{key:n,data:""}}),e.nodesKeysDict[n]||(e.nodesKeys=[...new Set([...e.nodesKeys,n])],e.nodesKeysDict[n]=!0),e.streamEvents[n].is_running||(e.streamEvents[n].is_running=!0)},updateStreamEvent(e,t){var i;const{key:n,data:r}=t.payload;(i=e.streamEvents[n])!=null&&i.data&&(e.streamEvents[n].data.data+=r.data)},endStreamEvent(e,t){const{key:n}=t.payload;e.streamEvents[n]&&(e.streamEvents[n].is_running=!1,e.streamEvents[n].data=!1,delete e.streamEvents[n])}}}),$a=dB({reducer:{project:ro.reducer}});Fa.on("state$load",e=>{$a.dispatch(ro.actions.loadProjectState(e))});Fa.on("stream$start",e=>{const{key:t,meta:n}=e;$a.dispatch(ro.actions.startStreamEvent({key:t,meta:n}))});Fa.on("stream$data",e=>{const{key:t}=e;$a.dispatch(ro.actions.updateStreamEvent({key:t,data:e}))});Fa.on("stream$end",e=>{const{key:t}=e;$a.dispatch(ro.actions.endStreamEvent({key:t}))});Fa.on("state$update",e=>{$a.dispatch(ro.actions.updateProjectState(e))});const{setProject:Wz,resetProject:Kz}=ro.actions,qz="/assets/cofounder-ts8-tu2p.webp";function Yz(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...r)=>e(...r);return new Proxy(n,{get:(r,i)=>i==="create"?e:(t.has(i)||t.set(i,e(i)),t.get(i))})}function _u(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const Yy=e=>Array.isArray(e);function fN(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function pw(e,t,n,r){if(typeof t=="function"){const[i,s]=ES(r);t=t(n!==void 0?n:e.custom,i,s)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,s]=ES(r);t=t(n!==void 0?n:e.custom,i,s)}return t}function Xh(e,t,n){const r=e.getProps();return pw(r,t,n!==void 0?n:r.custom,e)}const mw=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],gw=["initial",...mw],oc=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ls=new Set(oc),Gr=e=>e*1e3,Xr=e=>e/1e3,Gz={type:"spring",stiffness:500,damping:25,restSpeed:10},Xz=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Qz={type:"keyframes",duration:.8},Zz={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Jz=(e,{keyframes:t})=>t.length>2?Qz:ls.has(e)?e.startsWith("scale")?Xz(t[1]):Gz:Zz;function e9({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:i,repeat:s,repeatType:o,repeatDelay:a,from:l,elapsed:u,...f}){return!!Object.keys(f).length}function yw(e,t){return e[t]||e.default||e}const t9={skipAnimations:!1,useManualTiming:!1},n9=e=>e!==null;function Qh(e,{repeat:t,repeatType:n="loop"},r){const i=e.filter(n9),s=t&&n!=="loop"&&t%2===1?0:i.length-1;return!s||r===void 0?i[s]:r}const Pt=e=>e;function r9(e){let t=new Set,n=new Set,r=!1,i=!1;const s=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(u){s.has(u)&&(l.schedule(u),e()),u(o)}const l={schedule:(u,f=!1,c=!1)=>{const h=c&&r?t:n;return f&&s.add(u),h.has(u)||h.add(u),u},cancel:u=>{n.delete(u),s.delete(u)},process:u=>{if(o=u,r){i=!0;return}r=!0,[t,n]=[n,t],n.clear(),t.forEach(a),r=!1,i&&(i=!1,l.process(u))}};return l}const Kc=["read","resolveKeyframes","update","preRender","render","postRender"],i9=40;function dN(e,t){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>n=!0,o=Kc.reduce((y,v)=>(y[v]=r9(s),y),{}),{read:a,resolveKeyframes:l,update:u,preRender:f,render:c,postRender:d}=o,h=()=>{const y=performance.now();n=!1,i.delta=r?1e3/60:Math.max(Math.min(y-i.timestamp,i9),1),i.timestamp=y,i.isProcessing=!0,a.process(i),l.process(i),u.process(i),f.process(i),c.process(i),d.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},p=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:Kc.reduce((y,v)=>{const g=o[v];return y[v]=(x,S=!1,k=!1)=>(n||p(),g.schedule(x,S,k)),y},{}),cancel:y=>{for(let v=0;v/^0[^.\s]+$/u.test(e);function s9(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||hN(e):!0}let Gy=Pt;const pN=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),mN=e=>t=>typeof t=="string"&&t.startsWith(e),gN=mN("--"),o9=mN("var(--"),vw=e=>o9(e)?a9.test(e.split("/*")[0].trim()):!1,a9=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,l9=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function u9(e){const t=l9.exec(e);if(!t)return[,];const[,n,r,i]=t;return[`--${n??r}`,i]}function yN(e,t,n=1){const[r,i]=u9(e);if(!r)return;const s=window.getComputedStyle(t).getPropertyValue(r);if(s){const o=s.trim();return pN(o)?parseFloat(o):o}return vw(i)?yN(i,t,n+1):i}const Gi=(e,t,n)=>n>t?t:ntypeof e=="number",parse:parseFloat,transform:e=>e},Yl={...Ba,transform:e=>Gi(0,1,e)},qc={...Ba,default:1},Gl=e=>Math.round(e*1e5)/1e5,ww=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,c9=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,f9=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;function ac(e){return typeof e=="string"}function d9(e){return e==null}const lc=e=>({test:t=>ac(t)&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Si=lc("deg"),Er=lc("%"),he=lc("px"),h9=lc("vh"),p9=lc("vw"),CS={...Er,parse:e=>Er.parse(e)/100,transform:e=>Er.transform(e*100)},m9=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),TS=e=>e===Ba||e===he,_S=(e,t)=>parseFloat(e.split(", ")[t]),AS=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/u);if(i)return _S(i[1],t);{const s=r.match(/^matrix\((.+)\)$/u);return s?_S(s[1],e):0}},g9=new Set(["x","y","z"]),y9=oc.filter(e=>!g9.has(e));function v9(e){const t=[];return y9.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const ya={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:AS(4,13),y:AS(5,14)};ya.translateX=ya.x;ya.translateY=ya.y;const vN=e=>t=>t.test(e),w9={test:e=>e==="auto",parse:e=>e},wN=[Ba,he,Er,Si,p9,h9,w9],NS=e=>wN.find(vN(e)),Ds=new Set;let Xy=!1,Qy=!1;function xN(){if(Qy){const e=Array.from(Ds).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const i=v9(r);i.length&&(n.set(r,i),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const i=n.get(r);i&&i.forEach(([s,o])=>{var a;(a=r.getValue(s))===null||a===void 0||a.set(o)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Qy=!1,Xy=!1,Ds.forEach(e=>e.complete()),Ds.clear()}function bN(){Ds.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Qy=!0)})}function x9(){bN(),xN()}class xw{constructor(t,n,r,i,s,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Ds.add(this),Xy||(Xy=!0,Pe.read(bN),Pe.resolveKeyframes(xN))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:i}=this;for(let s=0;sn=>!!(ac(n)&&f9.test(n)&&n.startsWith(e)||t&&!d9(n)&&Object.prototype.hasOwnProperty.call(n,t)),SN=(e,t,n)=>r=>{if(!ac(r))return r;const[i,s,o,a]=r.match(ww);return{[e]:parseFloat(i),[t]:parseFloat(s),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},b9=e=>Gi(0,255,e),Lm={...Ba,transform:e=>Math.round(b9(e))},As={test:bw("rgb","red"),parse:SN("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+Lm.transform(e)+", "+Lm.transform(t)+", "+Lm.transform(n)+", "+Gl(Yl.transform(r))+")"};function S9(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const Zy={test:bw("#"),parse:S9,transform:As.transform},Io={test:bw("hsl","hue"),parse:SN("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Er.transform(Gl(t))+", "+Er.transform(Gl(n))+", "+Gl(Yl.transform(r))+")"},Tt={test:e=>As.test(e)||Zy.test(e)||Io.test(e),parse:e=>As.test(e)?As.parse(e):Io.test(e)?Io.parse(e):Zy.parse(e),transform:e=>ac(e)?e:e.hasOwnProperty("red")?As.transform(e):Io.transform(e)};function k9(e){var t,n;return isNaN(e)&&ac(e)&&(((t=e.match(ww))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(c9))===null||n===void 0?void 0:n.length)||0)>0}const kN="number",EN="color",E9="var",C9="var(",PS="${}",T9=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Nu(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[];let s=0;const a=t.replace(T9,l=>(Tt.test(l)?(r.color.push(s),i.push(EN),n.push(Tt.parse(l))):l.startsWith(C9)?(r.var.push(s),i.push(E9),n.push(l)):(r.number.push(s),i.push(kN),n.push(parseFloat(l))),++s,PS)).split(PS);return{values:n,split:a,indexes:r,types:i}}function CN(e){return Nu(e).values}function TN(e){const{split:t,types:n}=Nu(e),r=t.length;return i=>{let s="";for(let o=0;otypeof e=="number"?0:e;function A9(e){const t=CN(e);return TN(e)(t.map(_9))}const Xi={test:k9,parse:CN,createTransformer:TN,getAnimatableNone:A9},N9=new Set(["brightness","contrast","saturate","opacity"]);function P9(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(ww)||[];if(!r)return e;const i=n.replace(r,"");let s=N9.has(t)?1:0;return r!==n&&(s*=100),t+"("+s+i+")"}const O9=/\b([a-z-]*)\(.*?\)/gu,Jy={...Xi,getAnimatableNone:e=>{const t=e.match(O9);return t?t.map(P9).join(" "):e}},OS={...Ba,transform:Math.round},Sw={borderWidth:he,borderTopWidth:he,borderRightWidth:he,borderBottomWidth:he,borderLeftWidth:he,borderRadius:he,radius:he,borderTopLeftRadius:he,borderTopRightRadius:he,borderBottomRightRadius:he,borderBottomLeftRadius:he,width:he,maxWidth:he,height:he,maxHeight:he,size:he,top:he,right:he,bottom:he,left:he,padding:he,paddingTop:he,paddingRight:he,paddingBottom:he,paddingLeft:he,margin:he,marginTop:he,marginRight:he,marginBottom:he,marginLeft:he,rotate:Si,rotateX:Si,rotateY:Si,rotateZ:Si,scale:qc,scaleX:qc,scaleY:qc,scaleZ:qc,skew:Si,skewX:Si,skewY:Si,distance:he,translateX:he,translateY:he,translateZ:he,x:he,y:he,z:he,perspective:he,transformPerspective:he,opacity:Yl,originX:CS,originY:CS,originZ:he,zIndex:OS,backgroundPositionX:he,backgroundPositionY:he,fillOpacity:Yl,strokeOpacity:Yl,numOctaves:OS},L9={...Sw,color:Tt,backgroundColor:Tt,outlineColor:Tt,fill:Tt,stroke:Tt,borderColor:Tt,borderTopColor:Tt,borderRightColor:Tt,borderBottomColor:Tt,borderLeftColor:Tt,filter:Jy,WebkitFilter:Jy},kw=e=>L9[e];function _N(e,t){let n=kw(e);return n!==Jy&&(n=Xi),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const R9=new Set(["auto","none","0"]);function I9(e,t,n){let r=0,i;for(;r{n.getValue(l).set(u)}),this.resolveNoneKeyframes()}}function NN(e){let t;return()=>(t===void 0&&(t=e()),t)}let Ff;function D9(){Ff=void 0}const Cr={now:()=>(Ff===void 0&&Cr.set(bt.isProcessing||t9.useManualTiming?bt.timestamp:performance.now()),Ff),set:e=>{Ff=e,queueMicrotask(D9)}},LS=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Xi.test(e)||e==="0")&&!e.startsWith("url("));function M9(e){const t=e[0];if(e.length===1)return!0;for(let n=0;nF9?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&x9(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=Cr.now(),this.hasAttemptedResolve=!0;const{name:r,type:i,velocity:s,delay:o,onComplete:a,onUpdate:l,isGenerator:u}=this.options;if(!u&&!j9(t,r,i,s))if(o)this.options.duration=0;else{l==null||l(Qh(t,this.options,n)),a==null||a(),this.resolveFinishedPromise();return}const f=this.initPlayback(t,n);f!==!1&&(this._resolved={keyframes:t,finalKeyframe:n,...f},this.onPostResolved())}onPostResolved(){}then(t,n){return this.currentFinishedPromise.then(t,n)}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}function ON(e,t){return t?e*(1e3/t):0}const $9=5;function LN(e,t,n){const r=Math.max(t-$9,0);return ON(n-e(r),t-r)}const Rm=.001,B9=.01,V9=10,z9=.05,U9=1;function H9({duration:e=800,bounce:t=.25,velocity:n=0,mass:r=1}){let i,s,o=1-t;o=Gi(z9,U9,o),e=Gi(B9,V9,Xr(e)),o<1?(i=u=>{const f=u*o,c=f*e,d=f-n,h=e0(u,o),p=Math.exp(-c);return Rm-d/h*p},s=u=>{const c=u*o*e,d=c*n+n,h=Math.pow(o,2)*Math.pow(u,2)*e,p=Math.exp(-c),m=e0(Math.pow(u,2),o);return(-i(u)+Rm>0?-1:1)*((d-h)*p)/m}):(i=u=>{const f=Math.exp(-u*e),c=(u-n)*e+1;return-Rm+f*c},s=u=>{const f=Math.exp(-u*e),c=(n-u)*(e*e);return f*c});const a=5/e,l=K9(i,s,a);if(e=Gr(e),isNaN(l))return{stiffness:100,damping:10,duration:e};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:o*2*Math.sqrt(r*u),duration:e}}}const W9=12;function K9(e,t,n){let r=n;for(let i=1;ie[n]!==void 0)}function G9(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!RS(e,Y9)&&RS(e,q9)){const n=H9(e);t={...t,...n,mass:1},t.isResolvedFromDuration=!0}return t}function RN({keyframes:e,restDelta:t,restSpeed:n,...r}){const i=e[0],s=e[e.length-1],o={done:!1,value:i},{stiffness:a,damping:l,mass:u,duration:f,velocity:c,isResolvedFromDuration:d}=G9({...r,velocity:-Xr(r.velocity||0)}),h=c||0,p=l/(2*Math.sqrt(a*u)),m=s-i,w=Xr(Math.sqrt(a/u)),y=Math.abs(m)<5;n||(n=y?.01:2),t||(t=y?.005:.5);let v;if(p<1){const g=e0(w,p);v=x=>{const S=Math.exp(-p*w*x);return s-S*((h+p*w*m)/g*Math.sin(g*x)+m*Math.cos(g*x))}}else if(p===1)v=g=>s-Math.exp(-w*g)*(m+(h+w*m)*g);else{const g=w*Math.sqrt(p*p-1);v=x=>{const S=Math.exp(-p*w*x),k=Math.min(g*x,300);return s-S*((h+p*w*m)*Math.sinh(k)+g*m*Math.cosh(k))/g}}return{calculatedDuration:d&&f||null,next:g=>{const x=v(g);if(d)o.done=g>=f;else{let S=0;p<1&&(S=g===0?Gr(h):LN(v,g,x));const k=Math.abs(S)<=n,C=Math.abs(s-x)<=t;o.done=k&&C}return o.value=o.done?s:x,o}}}function IS({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:l,restDelta:u=.5,restSpeed:f}){const c=e[0],d={done:!1,value:c},h=T=>a!==void 0&&Tl,p=T=>a===void 0?l:l===void 0||Math.abs(a-T)-m*Math.exp(-T/r),g=T=>y+v(T),x=T=>{const O=v(T),A=g(T);d.done=Math.abs(O)<=u,d.value=d.done?y:A};let S,k;const C=T=>{h(d.value)&&(S=T,k=RN({keyframes:[d.value,p(d.value)],velocity:LN(g,T,d.value),damping:i,stiffness:s,restDelta:u,restSpeed:f}))};return C(0),{calculatedDuration:null,next:T=>{let O=!1;return!k&&S===void 0&&(O=!0,x(T),C(T)),S!==void 0&&T>=S?k.next(T-S):(!O&&x(T),d)}}}const IN=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,X9=1e-7,Q9=12;function Z9(e,t,n,r,i){let s,o,a=0;do o=t+(n-t)/2,s=IN(o,r,i)-e,s>0?n=o:t=o;while(Math.abs(s)>X9&&++aZ9(s,0,1,e,n);return s=>s===0||s===1?s:IN(i(s),t,r)}const J9=uc(.42,0,1,1),e6=uc(0,0,.58,1),DN=uc(.42,0,.58,1),t6=e=>Array.isArray(e)&&typeof e[0]!="number",MN=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,jN=e=>t=>1-e(1-t),Ew=e=>1-Math.sin(Math.acos(e)),FN=jN(Ew),n6=MN(Ew),$N=uc(.33,1.53,.69,.99),Cw=jN($N),r6=MN(Cw),i6=e=>(e*=2)<1?.5*Cw(e):.5*(2-Math.pow(2,-10*(e-1))),DS={linear:Pt,easeIn:J9,easeInOut:DN,easeOut:e6,circIn:Ew,circInOut:n6,circOut:FN,backIn:Cw,backInOut:r6,backOut:$N,anticipate:i6},MS=e=>{if(Array.isArray(e)){Gy(e.length===4);const[t,n,r,i]=e;return uc(t,n,r,i)}else if(typeof e=="string")return Gy(DS[e]!==void 0),DS[e];return e},s6=(e,t)=>n=>t(e(n)),Qr=(...e)=>e.reduce(s6),Pu=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},Ke=(e,t,n)=>e+(t-e)*n;function Im(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function o6({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,s=0,o=0;if(!t)i=s=o=n;else{const a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;i=Im(l,a,e+1/3),s=Im(l,a,e),o=Im(l,a,e-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:r}}function zd(e,t){return n=>n>0?t:e}const Dm=(e,t,n)=>{const r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},a6=[Zy,As,Io],l6=e=>a6.find(t=>t.test(e));function jS(e){const t=l6(e);if(!t)return!1;let n=t.parse(e);return t===Io&&(n=o6(n)),n}const FS=(e,t)=>{const n=jS(e),r=jS(t);if(!n||!r)return zd(e,t);const i={...n};return s=>(i.red=Dm(n.red,r.red,s),i.green=Dm(n.green,r.green,s),i.blue=Dm(n.blue,r.blue,s),i.alpha=Ke(n.alpha,r.alpha,s),As.transform(i))},t0=new Set(["none","hidden"]);function u6(e,t){return t0.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function c6(e,t){return n=>Ke(e,t,n)}function Tw(e){return typeof e=="number"?c6:typeof e=="string"?vw(e)?zd:Tt.test(e)?FS:h6:Array.isArray(e)?BN:typeof e=="object"?Tt.test(e)?FS:f6:zd}function BN(e,t){const n=[...e],r=n.length,i=e.map((s,o)=>Tw(s)(s,t[o]));return s=>{for(let o=0;o{for(const s in r)n[s]=r[s](i);return n}}function d6(e,t){var n;const r=[],i={color:0,var:0,number:0};for(let s=0;s{const n=Xi.createTransformer(t),r=Nu(e),i=Nu(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?t0.has(e)&&!i.values.length||t0.has(t)&&!r.values.length?u6(e,t):Qr(BN(d6(r,i),i.values),n):zd(e,t)};function VN(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Ke(e,t,n):Tw(e)(e,t)}function p6(e,t,n){const r=[],i=n||VN,s=e.length-1;for(let o=0;ot[0];if(s===2&&e[0]===e[1])return()=>t[1];e[0]>e[s-1]&&(e=[...e].reverse(),t=[...t].reverse());const o=p6(t,r,i),a=o.length,l=u=>{let f=0;if(a>1)for(;fl(Gi(e[0],e[s-1],u)):l}function g6(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=Pu(0,t,r);e.push(Ke(n,1,i))}}function y6(e){const t=[0];return g6(t,e.length-1),t}function v6(e,t){return e.map(n=>n*t)}function w6(e,t){return e.map(()=>t||DN).splice(0,e.length-1)}function Ud({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=t6(r)?r.map(MS):MS(r),s={done:!1,value:t[0]},o=v6(n&&n.length===t.length?n:y6(t),e),a=m6(o,t,{ease:Array.isArray(i)?i:w6(t,i)});return{calculatedDuration:e,next:l=>(s.value=a(l),s.done=l>=e,s)}}const $S=2e4;function x6(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<$S;)t+=n,r=e.next(t);return t>=$S?1/0:t}const b6=e=>{const t=({timestamp:n})=>e(n);return{start:()=>Pe.update(t,!0),stop:()=>si(t),now:()=>bt.isProcessing?bt.timestamp:Cr.now()}},S6={decay:IS,inertia:IS,tween:Ud,keyframes:Ud,spring:RN},k6=e=>e/100;class _w extends PN{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:l}=this.options;l&&l()};const{name:n,motionValue:r,element:i,keyframes:s}=this.options,o=(i==null?void 0:i.KeyframeResolver)||xw,a=(l,u)=>this.onKeyframesResolved(l,u);this.resolver=new o(s,a,n,r,i),this.resolver.scheduleResolve()}initPlayback(t){const{type:n="keyframes",repeat:r=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=this.options,a=S6[n]||Ud;let l,u;a!==Ud&&typeof t[0]!="number"&&(l=Qr(k6,VN(t[0],t[1])),t=[0,100]);const f=a({...this.options,keyframes:t});s==="mirror"&&(u=a({...this.options,keyframes:[...t].reverse(),velocity:-o})),f.calculatedDuration===null&&(f.calculatedDuration=x6(f));const{calculatedDuration:c}=f,d=c+i,h=d*(r+1)-i;return{generator:f,mirroredGenerator:u,mapPercentToKeyframes:l,calculatedDuration:c,resolvedDuration:d,totalDuration:h}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,n=!1){const{resolved:r}=this;if(!r){const{keyframes:T}=this.options;return{done:!0,value:T[T.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:l,calculatedDuration:u,totalDuration:f,resolvedDuration:c}=r;if(this.startTime===null)return s.next(0);const{delay:d,repeat:h,repeatType:p,repeatDelay:m,onUpdate:w}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-f/this.speed,this.startTime)),n?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const y=this.currentTime-d*(this.speed>=0?1:-1),v=this.speed>=0?y<0:y>f;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=f);let g=this.currentTime,x=s;if(h){const T=Math.min(this.currentTime,f)/c;let O=Math.floor(T),A=T%1;!A&&T>=1&&(A=1),A===1&&O--,O=Math.min(O,h+1),!!(O%2)&&(p==="reverse"?(A=1-A,m&&(A-=m/c)):p==="mirror"&&(x=o)),g=Gi(0,1,A)*c}const S=v?{done:!1,value:l[0]}:x.next(g);a&&(S.value=a(S.value));let{done:k}=S;!v&&u!==null&&(k=this.speed>=0?this.currentTime>=f:this.currentTime<=0);const C=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&k);return C&&i!==void 0&&(S.value=Qh(l,this.options,i)),w&&w(S.value),C&&this.finish(),S}get duration(){const{resolved:t}=this;return t?Xr(t.calculatedDuration):0}get time(){return Xr(this.currentTime)}set time(t){t=Gr(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=Xr(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=b6,onPlay:n,startTime:r}=this.options;this.driver||(this.driver=t(s=>this.tick(s))),n&&n();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const zN=new Set(["opacity","clipPath","filter","transform"]),UN=e=>Array.isArray(e)&&typeof e[0]=="number";function HN(e){return!!(!e||typeof e=="string"&&e in Aw||UN(e)||Array.isArray(e)&&e.every(HN))}const Pl=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Aw={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Pl([0,.65,.55,1]),circOut:Pl([.55,0,1,.45]),backIn:Pl([.31,.01,.66,-.59]),backOut:Pl([.33,1.53,.69,.99])};function E6(e){return WN(e)||Aw.easeOut}function WN(e){if(e)return UN(e)?Pl(e):Array.isArray(e)?e.map(E6):Aw[e]}function C6(e,t,n,{delay:r=0,duration:i=300,repeat:s=0,repeatType:o="loop",ease:a,times:l}={}){const u={[t]:n};l&&(u.offset=l);const f=WN(a);return Array.isArray(f)&&(u.easing=f),e.animate(u,{delay:r,duration:i,easing:Array.isArray(f)?"linear":f,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"})}const T6=NN(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Hd=10,_6=2e4;function A6(e){return e.type==="spring"||!HN(e.ease)}function N6(e,t){const n=new _w({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:e[0]};const i=[];let s=0;for(;!r.done&&s<_6;)r=n.sample(s),i.push(r.value),s+=Hd;return{times:void 0,keyframes:i,duration:s-Hd,ease:"linear"}}class BS extends PN{constructor(t){super(t);const{name:n,motionValue:r,element:i,keyframes:s}=this.options;this.resolver=new AN(s,(o,a)=>this.onKeyframesResolved(o,a),n,r,i),this.resolver.scheduleResolve()}initPlayback(t,n){var r;let{duration:i=300,times:s,ease:o,type:a,motionValue:l,name:u,startTime:f}=this.options;if(!(!((r=l.owner)===null||r===void 0)&&r.current))return!1;if(A6(this.options)){const{onComplete:d,onUpdate:h,motionValue:p,element:m,...w}=this.options,y=N6(t,w);t=y.keyframes,t.length===1&&(t[1]=t[0]),i=y.duration,s=y.times,o=y.ease,a="keyframes"}const c=C6(l.owner.current,u,t,{...this.options,duration:i,times:s,ease:o});return c.startTime=f??this.calcStartTime(),this.pendingTimeline?(c.timeline=this.pendingTimeline,this.pendingTimeline=void 0):c.onfinish=()=>{const{onComplete:d}=this.options;l.set(Qh(t,this.options,n)),d&&d(),this.cancel(),this.resolveFinishedPromise()},{animation:c,duration:i,times:s,type:a,ease:o,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return Xr(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return Xr(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=Gr(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:n}=t;return n.playbackRate}set speed(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:n}=t;return n.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:n}=t;return n.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:n}=this;if(!n)return Pt;const{animation:r}=n;r.timeline=t,r.onfinish=null}return Pt}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:n,keyframes:r,duration:i,type:s,ease:o,times:a}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:f,onComplete:c,element:d,...h}=this.options,p=new _w({...h,keyframes:r,duration:i,type:s,ease:o,times:a,isGenerator:!0}),m=Gr(this.time);u.setWithVelocity(p.sample(m-Hd).value,p.sample(m).value,Hd)}const{onStop:l}=this.options;l&&l(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:n,name:r,repeatDelay:i,repeatType:s,damping:o,type:a}=t;return T6()&&r&&zN.has(r)&&n&&n.owner&&n.owner.current instanceof HTMLElement&&!n.owner.getProps().onUpdate&&!i&&s!=="mirror"&&o!==0&&a!=="inertia"}}function P6(e,t){let n;const r=()=>{const{currentTime:i}=t,o=(i===null?0:i.value)/100;n!==o&&e(o),n=o};return Pe.update(r,!0),()=>si(r)}const O6=NN(()=>window.ScrollTimeline!==void 0);class L6{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}then(t,n){return Promise.all(this.animations).then(t).catch(n)}getAll(t){return this.animations[0][t]}setAll(t,n){for(let r=0;r{if(O6()&&r.attachTimeline)r.attachTimeline(t);else return r.pause(),P6(i=>{r.time=r.duration*i},t)});return()=>{n.forEach((r,i)=>{r&&r(),this.animations[i].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let n=0;nn[t]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}const Nw=(e,t,n,r={},i,s,o)=>a=>{const l=yw(r,e)||{},u=l.delay||r.delay||0;let{elapsed:f=0}=r;f=f-Gr(u);let c={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-f,onUpdate:h=>{t.set(h),l.onUpdate&&l.onUpdate(h)},onComplete:()=>{a(),l.onComplete&&l.onComplete(),o&&o()},onStop:o,name:e,motionValue:t,element:s?void 0:i};e9(l)||(c={...c,...Jz(e,c)}),c.duration&&(c.duration=Gr(c.duration)),c.repeatDelay&&(c.repeatDelay=Gr(c.repeatDelay)),c.from!==void 0&&(c.keyframes[0]=c.from);let d=!1;if((c.type===!1||c.duration===0&&!c.repeatDelay)&&(c.duration=0,c.delay===0&&(d=!0)),d&&!s&&t.get()!==void 0){const h=Qh(c.keyframes,l);if(h!==void 0)return Pe.update(()=>{c.onUpdate(h),c.onComplete()}),new L6([])}return!s&&BS.supports(c)?new BS(c):new _w(c)},R6=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),I6=e=>Yy(e)?e[e.length-1]||0:e;function Zh(e,t){e.indexOf(t)===-1&&e.push(t)}function Jh(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class Pw{constructor(){this.subscriptions=[]}add(t){return Zh(this.subscriptions,t),()=>Jh(this.subscriptions,t)}notify(t,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,r);else for(let s=0;s!isNaN(parseFloat(e));class KN{constructor(t,n={}){this.version="11.5.6",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,i=!0)=>{const s=Cr.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Cr.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=D6(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Pw);const r=this.events[t].add(n);return t==="change"?()=>{r(),Pe.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Cr.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>VS)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,VS);return ON(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Ou(e,t){return new KN(e,t)}function M6(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Ou(n))}function j6(e,t){const n=Xh(e,t);let{transitionEnd:r={},transition:i={},...s}=n||{};s={...s,...r};for(const o in s){const a=I6(s[o]);M6(e,o,a)}}const ep=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),F6="framerAppearId",qN="data-"+ep(F6);function YN(e){return e.props[qN]}function GN(e){if(ls.has(e))return"transform";if(zN.has(e))return ep(e)}class $6 extends KN{constructor(){super(...arguments),this.output=[],this.counts=new Map}add(t){const n=GN(t);if(!n)return;const r=this.counts.get(n)||0;this.counts.set(n,r+1),r===0&&(this.output.push(n),this.update());let i=!1;return()=>{if(i)return;i=!0;const s=this.counts.get(n)-1;this.counts.set(n,s),s===0&&(Jh(this.output,n),this.update())}}update(){this.set(this.output.length?this.output.join(", "):"auto")}}const At=e=>!!(e&&e.getVelocity);function B6(e){return!!(At(e)&&e.add)}function n0(e,t){var n;if(!e.applyWillChange)return;let r=e.getValue("willChange");if(!r&&!(!((n=e.props.style)===null||n===void 0)&&n.willChange)&&(r=new $6("auto"),e.addValue("willChange",r)),B6(r))return r.add(t)}function V6({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function XN(e,t,{delay:n=0,transitionOverride:r,type:i}={}){var s;let{transition:o=e.getDefaultTransition(),transitionEnd:a,...l}=t;r&&(o=r);const u=[],f=i&&e.animationState&&e.animationState.getState()[i];for(const c in l){const d=e.getValue(c,(s=e.latestValues[c])!==null&&s!==void 0?s:null),h=l[c];if(h===void 0||f&&V6(f,c))continue;const p={delay:n,...yw(o||{},c)};let m=!1;if(window.MotionHandoffAnimation){const y=YN(e);if(y){const v=window.MotionHandoffAnimation(y,c,Pe);v!==null&&(p.startTime=v,m=!0)}}d.start(Nw(c,d,h,e.shouldReduceMotion&&ls.has(c)?{type:!1}:p,e,m,n0(e,c)));const w=d.animation;w&&u.push(w)}return a&&Promise.all(u).then(()=>{Pe.update(()=>{a&&j6(e,a)})}),u}function r0(e,t,n={}){var r;const i=Xh(e,t,n.type==="exit"?(r=e.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:s=e.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(s=n.transitionOverride);const o=i?()=>Promise.all(XN(e,i,n)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:f=0,staggerChildren:c,staggerDirection:d}=s;return z6(e,t,f+u,c,d,n)}:()=>Promise.resolve(),{when:l}=s;if(l){const[u,f]=l==="beforeChildren"?[o,a]:[a,o];return u().then(()=>f())}else return Promise.all([o(),a(n.delay)])}function z6(e,t,n=0,r=0,i=1,s){const o=[],a=(e.variantChildren.size-1)*r,l=i===1?(u=0)=>u*r:(u=0)=>a-u*r;return Array.from(e.variantChildren).sort(U6).forEach((u,f)=>{u.notify("AnimationStart",t),o.push(r0(u,t,{...s,delay:n+l(f)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(o)}function U6(e,t){return e.sortNodePosition(t)}function H6(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(s=>r0(e,s,n));r=Promise.all(i)}else if(typeof t=="string")r=r0(e,t,n);else{const i=typeof t=="function"?Xh(e,t,n.custom):t;r=Promise.all(XN(e,i,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const W6=gw.length;function QN(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?QN(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;nPromise.all(t.map(({animation:n,options:r})=>H6(e,n,r)))}function G6(e){let t=Y6(e),n=zS(),r=!0;const i=l=>(u,f)=>{var c;const d=Xh(e,f,l==="exit"?(c=e.presenceContext)===null||c===void 0?void 0:c.custom:void 0);if(d){const{transition:h,transitionEnd:p,...m}=d;u={...u,...m,...p}}return u};function s(l){t=l(e)}function o(l){const{props:u}=e,f=QN(e.parent)||{},c=[],d=new Set;let h={},p=1/0;for(let w=0;wp&&x,O=!1;const A=Array.isArray(g)?g:[g];let j=A.reduce(i(y),{});S===!1&&(j={});const{prevResolvedValues:L={}}=v,B={...L,...j},N=F=>{T=!0,d.has(F)&&(O=!0,d.delete(F)),v.needsAnimating[F]=!0;const P=e.getValue(F);P&&(P.liveStyle=!1)};for(const F in B){const P=j[F],D=L[F];if(h.hasOwnProperty(F))continue;let _=!1;Yy(P)&&Yy(D)?_=!fN(P,D):_=P!==D,_?P!=null?N(F):d.add(F):P!==void 0&&d.has(F)?N(F):v.protectedKeys[F]=!0}v.prevProp=g,v.prevResolvedValues=j,v.isActive&&(h={...h,...j}),r&&e.blockInitialAnimation&&(T=!1),T&&(!(k&&C)||O)&&c.push(...A.map(F=>({animation:F,options:{type:y}})))}if(d.size){const w={};d.forEach(y=>{const v=e.getBaseTarget(y),g=e.getValue(y);g&&(g.liveStyle=!0),w[y]=v??null}),c.push({animation:w})}let m=!!c.length;return r&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(m=!1),r=!1,m?t(c):Promise.resolve()}function a(l,u){var f;if(n[l].isActive===u)return Promise.resolve();(f=e.variantChildren)===null||f===void 0||f.forEach(d=>{var h;return(h=d.animationState)===null||h===void 0?void 0:h.setActive(l,u)}),n[l].isActive=u;const c=o(l);for(const d in n)n[d].protectedKeys={};return c}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>n,reset:()=>{n=zS(),r=!0}}}function X6(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!fN(t,e):!1}function hs(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function zS(){return{animate:hs(!0),whileInView:hs(),whileHover:hs(),whileTap:hs(),whileDrag:hs(),whileFocus:hs(),exit:hs()}}class us{constructor(t){this.isMounted=!1,this.node=t}update(){}}class Q6 extends us{constructor(t){super(t),t.animationState||(t.animationState=G6(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();_u(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let Z6=0;class J6 extends us{constructor(){super(...arguments),this.id=Z6++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const i=this.node.animationState.setActive("exit",!t);n&&!t&&i.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const e8={animation:{Feature:Q6},exit:{Feature:J6}},ZN=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function tp(e,t="page"){return{point:{x:e[`${t}X`],y:e[`${t}Y`]}}}const t8=e=>t=>ZN(t)&&e(t,tp(t));function Hr(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function Zr(e,t,n,r){return Hr(e,t,t8(n),r)}const US=(e,t)=>Math.abs(e-t);function n8(e,t){const n=US(e.x,t.x),r=US(e.y,t.y);return Math.sqrt(n**2+r**2)}class JN{constructor(t,n,{transformPagePoint:r,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const c=jm(this.lastMoveEventInfo,this.history),d=this.startEvent!==null,h=n8(c.offset,{x:0,y:0})>=3;if(!d&&!h)return;const{point:p}=c,{timestamp:m}=bt;this.history.push({...p,timestamp:m});const{onStart:w,onMove:y}=this.handlers;d||(w&&w(this.lastMoveEvent,c),this.startEvent=this.lastMoveEvent),y&&y(this.lastMoveEvent,c)},this.handlePointerMove=(c,d)=>{this.lastMoveEvent=c,this.lastMoveEventInfo=Mm(d,this.transformPagePoint),Pe.update(this.updatePoint,!0)},this.handlePointerUp=(c,d)=>{this.end();const{onEnd:h,onSessionEnd:p,resumeAnimation:m}=this.handlers;if(this.dragSnapToOrigin&&m&&m(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const w=jm(c.type==="pointercancel"?this.lastMoveEventInfo:Mm(d,this.transformPagePoint),this.history);this.startEvent&&h&&h(c,w),p&&p(c,w)},!ZN(t))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=r,this.contextWindow=i||window;const o=tp(t),a=Mm(o,this.transformPagePoint),{point:l}=a,{timestamp:u}=bt;this.history=[{...l,timestamp:u}];const{onSessionStart:f}=n;f&&f(t,jm(a,this.history)),this.removeListeners=Qr(Zr(this.contextWindow,"pointermove",this.handlePointerMove),Zr(this.contextWindow,"pointerup",this.handlePointerUp),Zr(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),si(this.updatePoint)}}function Mm(e,t){return t?{point:t(e.point)}:e}function HS(e,t){return{x:e.x-t.x,y:e.y-t.y}}function jm({point:e},t){return{point:e,delta:HS(e,eP(t)),offset:HS(e,r8(t)),velocity:i8(t,.1)}}function r8(e){return e[0]}function eP(e){return e[e.length-1]}function i8(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=eP(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Gr(t)));)n--;if(!r)return{x:0,y:0};const s=Xr(i.timestamp-r.timestamp);if(s===0)return{x:0,y:0};const o={x:(i.x-r.x)/s,y:(i.y-r.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function tP(e){let t=null;return()=>{const n=()=>{t=null};return t===null?(t=e,n):!1}}const WS=tP("dragHorizontal"),KS=tP("dragVertical");function nP(e){let t=!1;if(e==="y")t=KS();else if(e==="x")t=WS();else{const n=WS(),r=KS();n&&r?t=()=>{n(),r()}:(n&&n(),r&&r())}return t}function rP(){const e=nP(!0);return e?(e(),!1):!0}function Do(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}const iP=1e-4,s8=1-iP,o8=1+iP,sP=.01,a8=0-sP,l8=0+sP;function bn(e){return e.max-e.min}function u8(e,t,n){return Math.abs(e-t)<=n}function qS(e,t,n,r=.5){e.origin=r,e.originPoint=Ke(t.min,t.max,e.origin),e.scale=bn(n)/bn(t),e.translate=Ke(n.min,n.max,e.origin)-e.originPoint,(e.scale>=s8&&e.scale<=o8||isNaN(e.scale))&&(e.scale=1),(e.translate>=a8&&e.translate<=l8||isNaN(e.translate))&&(e.translate=0)}function Xl(e,t,n,r){qS(e.x,t.x,n.x,r?r.originX:void 0),qS(e.y,t.y,n.y,r?r.originY:void 0)}function YS(e,t,n){e.min=n.min+t.min,e.max=e.min+bn(t)}function c8(e,t,n){YS(e.x,t.x,n.x),YS(e.y,t.y,n.y)}function GS(e,t,n){e.min=t.min-n.min,e.max=e.min+bn(t)}function Ql(e,t,n){GS(e.x,t.x,n.x),GS(e.y,t.y,n.y)}function f8(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?Ke(n,e,r.max):Math.min(e,n)),e}function XS(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function d8(e,{top:t,left:n,bottom:r,right:i}){return{x:XS(e.x,n,i),y:XS(e.y,t,r)}}function QS(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=Pu(t.min,t.max-r,e.min):r>i&&(n=Pu(e.min,e.max-i,t.min)),Gi(0,1,n)}function m8(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const i0=.35;function g8(e=i0){return e===!1?e=0:e===!0&&(e=i0),{x:ZS(e,"left","right"),y:ZS(e,"top","bottom")}}function ZS(e,t,n){return{min:JS(e,t),max:JS(e,n)}}function JS(e,t){return typeof e=="number"?e:e[t]||0}const ek=()=>({translate:0,scale:1,origin:0,originPoint:0}),Mo=()=>({x:ek(),y:ek()}),tk=()=>({min:0,max:0}),et=()=>({x:tk(),y:tk()});function _n(e){return[e("x"),e("y")]}function oP({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function y8({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function v8(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Fm(e){return e===void 0||e===1}function s0({scale:e,scaleX:t,scaleY:n}){return!Fm(e)||!Fm(t)||!Fm(n)}function xs(e){return s0(e)||aP(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function aP(e){return nk(e.x)||nk(e.y)}function nk(e){return e&&e!=="0%"}function Wd(e,t,n){const r=e-n,i=t*r;return n+i}function rk(e,t,n,r,i){return i!==void 0&&(e=Wd(e,i,r)),Wd(e,n,r)+t}function o0(e,t=0,n=1,r,i){e.min=rk(e.min,t,n,r,i),e.max=rk(e.max,t,n,r,i)}function lP(e,{x:t,y:n}){o0(e.x,t.translate,t.scale,t.originPoint),o0(e.y,n.translate,n.scale,n.originPoint)}const ik=.999999999999,sk=1.0000000000001;function w8(e,t,n,r=!1){const i=n.length;if(!i)return;t.x=t.y=1;let s,o;for(let a=0;aik&&(t.x=1),t.yik&&(t.y=1)}function jo(e,t){e.min=e.min+t,e.max=e.max+t}function ok(e,t,n,r,i=.5){const s=Ke(e.min,e.max,i);o0(e,t,n,s,r)}function Fo(e,t){ok(e.x,t.x,t.scaleX,t.scale,t.originX),ok(e.y,t.y,t.scaleY,t.scale,t.originY)}function uP(e,t){return oP(v8(e.getBoundingClientRect(),t))}function x8(e,t,n){const r=uP(e,n),{scroll:i}=t;return i&&(jo(r.x,i.offset.x),jo(r.y,i.offset.y)),r}const cP=({current:e})=>e?e.ownerDocument.defaultView:null,b8=new WeakMap;class S8{constructor(t){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=et(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const i=f=>{const{dragSnapToOrigin:c}=this.getProps();c?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(tp(f,"page").point)},s=(f,c)=>{var d;const{drag:h,dragPropagation:p,onDragStart:m}=this.getProps();if(h&&!p&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=nP(h),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),_n(y=>{let v=this.getAxisMotionValue(y).get()||0;if(Er.test(v)){const{projection:g}=this.visualElement;if(g&&g.layout){const x=g.layout.layoutBox[y];x&&(v=bn(x)*(parseFloat(v)/100))}}this.originPoint[y]=v}),m&&Pe.postRender(()=>m(f,c)),(d=this.removeWillChange)===null||d===void 0||d.call(this),this.removeWillChange=n0(this.visualElement,"transform");const{animationState:w}=this.visualElement;w&&w.setActive("whileDrag",!0)},o=(f,c)=>{const{dragPropagation:d,dragDirectionLock:h,onDirectionLock:p,onDrag:m}=this.getProps();if(!d&&!this.openGlobalLock)return;const{offset:w}=c;if(h&&this.currentDirection===null){this.currentDirection=k8(w),this.currentDirection!==null&&p&&p(this.currentDirection);return}this.updateAxis("x",c.point,w),this.updateAxis("y",c.point,w),this.visualElement.render(),m&&m(f,c)},a=(f,c)=>this.stop(f,c),l=()=>_n(f=>{var c;return this.getAnimationState(f)==="paused"&&((c=this.getAxisMotionValue(f).animation)===null||c===void 0?void 0:c.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new JN(t,{onSessionStart:i,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:cP(this.visualElement)})}stop(t,n){var r;(r=this.removeWillChange)===null||r===void 0||r.call(this);const i=this.isDragging;if(this.cancel(),!i)return;const{velocity:s}=n;this.startAnimation(s);const{onDragEnd:o}=this.getProps();o&&Pe.postRender(()=>o(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:i}=this.getProps();if(!r||!Yc(t,i,this.currentDirection))return;const s=this.getAxisMotionValue(t);let o=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(o=f8(o,this.constraints[t],this.elastic[t])),s.set(o)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:r}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,s=this.constraints;n&&Do(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&i?this.constraints=d8(i.layoutBox,n):this.constraints=!1,this.elastic=g8(r),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&_n(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=m8(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Do(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=x8(r,i.root,this.visualElement.getTransformPagePoint());let o=h8(i.layout.layoutBox,s);if(n){const a=n(y8(o));this.hasMutatedConstraints=!!a,a&&(o=oP(a))}return o}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},u=_n(f=>{if(!Yc(f,n,this.currentDirection))return;let c=l&&l[f]||{};o&&(c={min:0,max:0});const d=i?200:1e6,h=i?40:1e7,p={type:"inertia",velocity:r?t[f]:0,bounceStiffness:d,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...s,...c};return this.startAxisValueAnimation(f,p)});return Promise.all(u).then(a)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return r.start(Nw(t,r,0,n,this.visualElement,!1,n0(this.visualElement,t)))}stopAnimation(){_n(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){_n(t=>{var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),i=r[n];return i||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){_n(n=>{const{drag:r}=this.getProps();if(!Yc(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(n);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[n];s.set(t[n]-Ke(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Do(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};_n(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const l=a.get();i[o]=p8({min:l,max:l},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),_n(o=>{if(!Yc(o,t,null))return;const a=this.getAxisMotionValue(o),{min:l,max:u}=this.constraints[o];a.set(Ke(l,u,i[o]))})}addListeners(){if(!this.visualElement.current)return;b8.set(this.visualElement,this);const t=this.visualElement.current,n=Zr(t,"pointerdown",l=>{const{drag:u,dragListener:f=!0}=this.getProps();u&&f&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();Do(l)&&l.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Pe.read(r);const o=Hr(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(_n(f=>{const c=this.getAxisMotionValue(f);c&&(this.originPoint[f]+=l[f].translate,c.set(c.get()+l[f].translate))}),this.visualElement.render())});return()=>{o(),n(),s(),a&&a()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:o=i0,dragMomentum:a=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function Yc(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function k8(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class E8 extends us{constructor(t){super(t),this.removeGroupControls=Pt,this.removeListeners=Pt,this.controls=new S8(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Pt}unmount(){this.removeGroupControls(),this.removeListeners()}}const ak=e=>(t,n)=>{e&&Pe.postRender(()=>e(t,n))};class C8 extends us{constructor(){super(...arguments),this.removePointerDownListener=Pt}onPointerDown(t){this.session=new JN(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:cP(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:ak(t),onStart:ak(n),onMove:r,onEnd:(s,o)=>{delete this.session,i&&Pe.postRender(()=>i(s,o))}}}mount(){this.removePointerDownListener=Zr(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const Ow=E.createContext(null);function T8(){const e=E.useContext(Ow);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:n,register:r}=e,i=E.useId();E.useEffect(()=>r(i),[]);const s=E.useCallback(()=>n&&n(i),[i,n]);return!t&&n?[!1,s]:[!0]}const fP=E.createContext({}),dP=E.createContext({}),$f={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function lk(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const cl={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(he.test(e))e=parseFloat(e);else return e;const n=lk(e,t.target.x),r=lk(e,t.target.y);return`${n}% ${r}%`}},_8={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=Xi.parse(e);if(i.length>5)return r;const s=Xi.createTransformer(e),o=typeof i[0]!="number"?1:0,a=n.x.scale*t.x,l=n.y.scale*t.y;i[0+o]/=a,i[1+o]/=l;const u=Ke(a,l,.5);return typeof i[2+o]=="number"&&(i[2+o]/=u),typeof i[3+o]=="number"&&(i[3+o]/=u),s(i)}},Kd={};function A8(e){Object.assign(Kd,e)}const{schedule:Lw,cancel:Zhe}=dN(queueMicrotask,!1);class N8 extends E.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:s}=t;A8(P8),s&&(n.group&&n.group.add(s),r&&r.register&&i&&r.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),$f.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:i,isPresent:s}=this.props,o=r.projection;return o&&(o.isPresent=s,i||t.layoutDependency!==n||n===void 0?o.willUpdate():this.safeToRemove(),t.isPresent!==s&&(s?o.promote():o.relegate()||Pe.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),Lw.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=t;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function hP(e){const[t,n]=T8(),r=E.useContext(fP);return b.jsx(N8,{...e,layoutGroup:r,switchLayoutGroup:E.useContext(dP),isPresent:t,safeToRemove:n})}const P8={borderRadius:{...cl,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:cl,borderTopRightRadius:cl,borderBottomLeftRadius:cl,borderBottomRightRadius:cl,boxShadow:_8},pP=["TopLeft","TopRight","BottomLeft","BottomRight"],O8=pP.length,uk=e=>typeof e=="string"?parseFloat(e):e,ck=e=>typeof e=="number"||he.test(e);function L8(e,t,n,r,i,s){i?(e.opacity=Ke(0,n.opacity!==void 0?n.opacity:1,R8(r)),e.opacityExit=Ke(t.opacity!==void 0?t.opacity:1,0,I8(r))):s&&(e.opacity=Ke(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let o=0;ort?1:n(Pu(e,t,r))}function dk(e,t){e.min=t.min,e.max=t.max}function Cn(e,t){dk(e.x,t.x),dk(e.y,t.y)}function hk(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function pk(e,t,n,r,i){return e-=t,e=Wd(e,1/n,r),i!==void 0&&(e=Wd(e,1/i,r)),e}function D8(e,t=0,n=1,r=.5,i,s=e,o=e){if(Er.test(t)&&(t=parseFloat(t),t=Ke(o.min,o.max,t/100)-o.min),typeof t!="number")return;let a=Ke(s.min,s.max,r);e===s&&(a-=t),e.min=pk(e.min,t,n,a,i),e.max=pk(e.max,t,n,a,i)}function mk(e,t,[n,r,i],s,o){D8(e,t[n],t[r],t[i],t.scale,s,o)}const M8=["x","scaleX","originX"],j8=["y","scaleY","originY"];function gk(e,t,n,r){mk(e.x,t,M8,n?n.x:void 0,r?r.x:void 0),mk(e.y,t,j8,n?n.y:void 0,r?r.y:void 0)}function yk(e){return e.translate===0&&e.scale===1}function gP(e){return yk(e.x)&&yk(e.y)}function vk(e,t){return e.min===t.min&&e.max===t.max}function F8(e,t){return vk(e.x,t.x)&&vk(e.y,t.y)}function wk(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function yP(e,t){return wk(e.x,t.x)&&wk(e.y,t.y)}function xk(e){return bn(e.x)/bn(e.y)}function bk(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class $8{constructor(){this.members=[]}add(t){Zh(this.members,t),t.scheduleRender()}remove(t){if(Jh(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(i=>t===i);if(n===0)return!1;let r;for(let i=n;i>=0;i--){const s=this.members[i];if(s.isPresent!==!1){r=s;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:i}=t.options;i===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function B8(e,t,n){let r="";const i=e.x.translate/t.x,s=e.y.translate/t.y,o=(n==null?void 0:n.z)||0;if((i||s||o)&&(r=`translate3d(${i}px, ${s}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:f,rotateX:c,rotateY:d,skewX:h,skewY:p}=n;u&&(r=`perspective(${u}px) ${r}`),f&&(r+=`rotate(${f}deg) `),c&&(r+=`rotateX(${c}deg) `),d&&(r+=`rotateY(${d}deg) `),h&&(r+=`skewX(${h}deg) `),p&&(r+=`skewY(${p}deg) `)}const a=e.x.scale*t.x,l=e.y.scale*t.y;return(a!==1||l!==1)&&(r+=`scale(${a}, ${l})`),r||"none"}const V8=(e,t)=>e.depth-t.depth;class z8{constructor(){this.children=[],this.isDirty=!1}add(t){Zh(this.children,t),this.isDirty=!0}remove(t){Jh(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(V8),this.isDirty=!1,this.children.forEach(t)}}function Bf(e){const t=At(e)?e.get():e;return R6(t)?t.toValue():t}function U8(e,t){const n=Cr.now(),r=({timestamp:i})=>{const s=i-n;s>=t&&(si(r),e(s-t))};return Pe.read(r,!0),()=>si(r)}function H8(e){return e instanceof SVGElement&&e.tagName!=="svg"}function W8(e,t,n){const r=At(e)?e:Ou(e);return r.start(Nw("",r,t,n)),r.animation}const bs={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Ol=typeof window<"u"&&window.MotionDebug!==void 0,$m=["","X","Y","Z"],K8={visibility:"hidden"},Sk=1e3;let q8=0;function Bm(e,t,n,r){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function vP(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=YN(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:s}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Pe,!(i||s))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&vP(r)}function wP({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(o={},a=t==null?void 0:t()){this.id=q8++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Ol&&(bs.totalNodes=bs.resolvedTargetDeltas=bs.recalculatedProjection=0),this.nodes.forEach(X8),this.nodes.forEach(tU),this.nodes.forEach(nU),this.nodes.forEach(Q8),Ol&&window.MotionDebug.record(bs)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;e(o,()=>{this.root.updateBlockedByResize=!0,c&&c(),c=U8(d,250),$f.hasAnimatedSinceResize&&($f.hasAnimatedSinceResize=!1,this.nodes.forEach(Ek))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&f&&(l||u)&&this.addEventListener("didUpdate",({delta:c,hasLayoutChanged:d,hasRelativeTargetChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||f.getDefaultTransition()||aU,{onLayoutAnimationStart:w,onLayoutAnimationComplete:y}=f.getProps(),v=!this.targetLayout||!yP(this.targetLayout,p)||h,g=!d&&h;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||g||d&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(c,g);const x={...yw(m,"layout"),onPlay:w,onComplete:y};(f.shouldReduceMotion||this.options.layoutRoot)&&(x.delay=0,x.type=!1),this.startAnimation(x)}else d||Ek(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,si(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(rU),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&vP(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let f=0;f{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const S=x/1e3;Ck(c.x,o.x,S),Ck(c.y,o.y,S),this.setTargetDelta(c),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Ql(d,this.layout.layoutBox,this.relativeParent.layout.layoutBox),sU(this.relativeTarget,this.relativeTargetOrigin,d,S),g&&F8(this.relativeTarget,g)&&(this.isProjectionDirty=!1),g||(g=et()),Cn(g,this.relativeTarget)),m&&(this.animationValues=f,L8(f,u,this.latestValues,S,v,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(si(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Pe.update(()=>{$f.hasAnimatedSinceResize=!0,this.currentAnimation=W8(0,Sk,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Sk),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:u,latestValues:f}=o;if(!(!a||!l||!u)){if(this!==o&&this.layout&&u&&xP(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||et();const c=bn(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+c;const d=bn(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+d}Cn(a,l),Fo(a,f),Xl(this.projectionDeltaWithTransform,this.layoutCorrected,a,f)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new $8),this.sharedNodes.get(o).add(a);const u=a.options.initialPromotionConfig;a.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const u={};l.z&&Bm("z",o,u,this.animationValues);for(let f=0;f<$m.length;f++)Bm(`rotate${$m[f]}`,o,u,this.animationValues),Bm(`skew${$m[f]}`,o,u,this.animationValues);o.render();for(const f in u)o.setStaticValue(f,u[f]),this.animationValues&&(this.animationValues[f]=u[f]);o.scheduleRender()}getProjectionStyles(o){var a,l;if(!this.instance||this.isSVG)return;if(!this.isVisible)return K8;const u={visibility:""},f=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,u.opacity="",u.pointerEvents=Bf(o==null?void 0:o.pointerEvents)||"",u.transform=f?f(this.latestValues,""):"none",u;const c=this.getLead();if(!this.projectionDelta||!this.layout||!c.target){const m={};return this.options.layoutId&&(m.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,m.pointerEvents=Bf(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!xs(this.latestValues)&&(m.transform=f?f({},""):"none",this.hasProjected=!1),m}const d=c.animationValues||c.latestValues;this.applyTransformsToTarget(),u.transform=B8(this.projectionDeltaWithTransform,this.treeScale,d),f&&(u.transform=f(d,u.transform));const{x:h,y:p}=this.projectionDelta;u.transformOrigin=`${h.origin*100}% ${p.origin*100}% 0`,c.animationValues?u.opacity=c===this?(l=(a=d.opacity)!==null&&a!==void 0?a:this.latestValues.opacity)!==null&&l!==void 0?l:1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:u.opacity=c===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const m in Kd){if(d[m]===void 0)continue;const{correct:w,applyTo:y}=Kd[m],v=u.transform==="none"?d[m]:w(d[m],c);if(y){const g=y.length;for(let x=0;x{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(kk),this.root.sharedNodes.clear()}}}function Y8(e){e.updateLayout()}function G8(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:i}=e.layout,{animationType:s}=e.options,o=n.source!==e.layout.source;s==="size"?_n(c=>{const d=o?n.measuredBox[c]:n.layoutBox[c],h=bn(d);d.min=r[c].min,d.max=d.min+h}):xP(s,n.layoutBox,r)&&_n(c=>{const d=o?n.measuredBox[c]:n.layoutBox[c],h=bn(r[c]);d.max=d.min+h,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[c].max=e.relativeTarget[c].min+h)});const a=Mo();Xl(a,r,n.layoutBox);const l=Mo();o?Xl(l,e.applyTransform(i,!0),n.measuredBox):Xl(l,r,n.layoutBox);const u=!gP(a);let f=!1;if(!e.resumeFrom){const c=e.getClosestProjectingParent();if(c&&!c.resumeFrom){const{snapshot:d,layout:h}=c;if(d&&h){const p=et();Ql(p,n.layoutBox,d.layoutBox);const m=et();Ql(m,r,h.layoutBox),yP(p,m)||(f=!0),c.options.layoutRoot&&(e.relativeTarget=m,e.relativeTargetOrigin=p,e.relativeParent=c)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:l,layoutDelta:a,hasLayoutChanged:u,hasRelativeTargetChanged:f})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function X8(e){Ol&&bs.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function Q8(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function Z8(e){e.clearSnapshot()}function kk(e){e.clearMeasurements()}function J8(e){e.isLayoutDirty=!1}function eU(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Ek(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function tU(e){e.resolveTargetDelta()}function nU(e){e.calcProjection()}function rU(e){e.resetSkewAndRotation()}function iU(e){e.removeLeadSnapshot()}function Ck(e,t,n){e.translate=Ke(t.translate,0,n),e.scale=Ke(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Tk(e,t,n,r){e.min=Ke(t.min,n.min,r),e.max=Ke(t.max,n.max,r)}function sU(e,t,n,r){Tk(e.x,t.x,n.x,r),Tk(e.y,t.y,n.y,r)}function oU(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const aU={duration:.45,ease:[.4,0,.1,1]},_k=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Ak=_k("applewebkit/")&&!_k("chrome/")?Math.round:Pt;function Nk(e){e.min=Ak(e.min),e.max=Ak(e.max)}function lU(e){Nk(e.x),Nk(e.y)}function xP(e,t,n){return e==="position"||e==="preserve-aspect"&&!u8(xk(t),xk(n),.2)}function uU(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const cU=wP({attachResizeListener:(e,t)=>Hr(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Vm={current:void 0},bP=wP({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Vm.current){const e=new cU({});e.mount(window),e.setOptions({layoutScroll:!0}),Vm.current=e}return Vm.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),fU={pan:{Feature:C8},drag:{Feature:E8,ProjectionNode:bP,MeasureLayout:hP}};function Pk(e,t){const n=t?"pointerenter":"pointerleave",r=t?"onHoverStart":"onHoverEnd",i=(s,o)=>{if(s.pointerType==="touch"||rP())return;const a=e.getProps();e.animationState&&a.whileHover&&e.animationState.setActive("whileHover",t);const l=a[r];l&&Pe.postRender(()=>l(s,o))};return Zr(e.current,n,i,{passive:!e.getProps()[r]})}class dU extends us{mount(){this.unmount=Qr(Pk(this.node,!0),Pk(this.node,!1))}unmount(){}}class hU extends us{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Qr(Hr(this.node.current,"focus",()=>this.onFocus()),Hr(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const SP=(e,t)=>t?e===t?!0:SP(e,t.parentElement):!1;function zm(e,t){if(!t)return;const n=new PointerEvent("pointer"+e);t(n,tp(n))}class pU extends us{constructor(){super(...arguments),this.removeStartListeners=Pt,this.removeEndListeners=Pt,this.removeAccessibleListeners=Pt,this.startPointerPress=(t,n)=>{if(this.isPressing)return;this.removeEndListeners();const r=this.node.getProps(),s=Zr(window,"pointerup",(a,l)=>{if(!this.checkPressEnd())return;const{onTap:u,onTapCancel:f,globalTapTarget:c}=this.node.getProps(),d=!c&&!SP(this.node.current,a.target)?f:u;d&&Pe.update(()=>d(a,l))},{passive:!(r.onTap||r.onPointerUp)}),o=Zr(window,"pointercancel",(a,l)=>this.cancelPress(a,l),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=Qr(s,o),this.startPress(t,n)},this.startAccessiblePress=()=>{const t=s=>{if(s.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||zm("up",(l,u)=>{const{onTap:f}=this.node.getProps();f&&Pe.postRender(()=>f(l,u))})};this.removeEndListeners(),this.removeEndListeners=Hr(this.node.current,"keyup",o),zm("down",(a,l)=>{this.startPress(a,l)})},n=Hr(this.node.current,"keydown",t),r=()=>{this.isPressing&&zm("cancel",(s,o)=>this.cancelPress(s,o))},i=Hr(this.node.current,"blur",r);this.removeAccessibleListeners=Qr(n,i)}}startPress(t,n){this.isPressing=!0;const{onTapStart:r,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),r&&Pe.postRender(()=>r(t,n))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!rP()}cancelPress(t,n){if(!this.checkPressEnd())return;const{onTapCancel:r}=this.node.getProps();r&&Pe.postRender(()=>r(t,n))}mount(){const t=this.node.getProps(),n=Zr(t.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),r=Hr(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Qr(n,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const a0=new WeakMap,Um=new WeakMap,mU=e=>{const t=a0.get(e.target);t&&t(e)},gU=e=>{e.forEach(mU)};function yU({root:e,...t}){const n=e||document;Um.has(n)||Um.set(n,{});const r=Um.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(gU,{root:e,...t})),r[i]}function vU(e,t,n){const r=yU(t);return a0.set(e,n),r.observe(e),()=>{a0.delete(e),r.unobserve(e)}}const wU={some:0,all:1};class xU extends us{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:s}=t,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:wU[i]},a=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,s&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:f,onViewportLeave:c}=this.node.getProps(),d=u?f:c;d&&d(l)};return vU(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(bU(t,n))&&this.startObserver()}unmount(){}}function bU({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const SU={inView:{Feature:xU},tap:{Feature:pU},focus:{Feature:hU},hover:{Feature:dU}},kU={layout:{ProjectionNode:bP,MeasureLayout:hP}},kP=E.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),np=E.createContext({}),Rw=typeof window<"u",EU=Rw?E.useLayoutEffect:E.useEffect,EP=E.createContext({strict:!1});let Ok=!1;function CU(e,t,n,r,i){var s;const{visualElement:o}=E.useContext(np),a=E.useContext(EP),l=E.useContext(Ow),u=E.useContext(kP).reducedMotion,f=E.useRef();r=r||a.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:u}));const c=f.current,d=E.useContext(dP);c&&!c.projection&&i&&(c.type==="html"||c.type==="svg")&&_U(f.current,n,i,d),E.useInsertionEffect(()=>{c&&c.update(n,l)});const h=n[qN],p=E.useRef(!!h&&!window.MotionHandoffIsComplete&&((s=window.MotionHasOptimisedAnimation)===null||s===void 0?void 0:s.call(window,h)));return EU(()=>{c&&(c.updateFeatures(),Lw.render(c.render),p.current&&c.animationState&&c.animationState.animateChanges())}),E.useEffect(()=>{c&&(!p.current&&c.animationState&&c.animationState.animateChanges(),p.current=!1,Ok||(Ok=!0,queueMicrotask(TU)))}),c}function TU(){window.MotionHandoffIsComplete=!0}function _U(e,t,n,r){const{layoutId:i,layout:s,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:CP(e.parent)),e.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!o||a&&Do(a),visualElement:e,animationType:typeof s=="string"?s:"both",initialPromotionConfig:r,layoutScroll:l,layoutRoot:u})}function CP(e){if(e)return e.options.allowProjection!==!1?e.projection:CP(e.parent)}function AU(e,t,n){return E.useCallback(r=>{r&&e.mount&&e.mount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):Do(n)&&(n.current=r))},[t])}function rp(e){return _u(e.animate)||gw.some(t=>Au(e[t]))}function TP(e){return!!(rp(e)||e.variants)}function NU(e,t){if(rp(e)){const{initial:n,animate:r}=e;return{initial:n===!1||Au(n)?n:void 0,animate:Au(r)?r:void 0}}return e.inherit!==!1?t:{}}function PU(e){const{initial:t,animate:n}=NU(e,E.useContext(np));return E.useMemo(()=>({initial:t,animate:n}),[Lk(t),Lk(n)])}function Lk(e){return Array.isArray(e)?e.join(" "):e}const Rk={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},va={};for(const e in Rk)va[e]={isEnabled:t=>Rk[e].some(n=>!!t[n])};function OU(e){for(const t in e)va[t]={...va[t],...e[t]}}const LU=Symbol.for("motionComponentSymbol");function RU({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:i}){e&&OU(e);function s(a,l){let u;const f={...E.useContext(kP),...a,layoutId:IU(a)},{isStatic:c}=f,d=PU(a),h=r(a,c);if(!c&&Rw){DU();const p=MU(f);u=p.MeasureLayout,d.visualElement=CU(i,h,f,t,p.ProjectionNode)}return b.jsxs(np.Provider,{value:d,children:[u&&d.visualElement?b.jsx(u,{visualElement:d.visualElement,...f}):null,n(i,a,AU(h,d.visualElement,l),h,c,d.visualElement)]})}const o=E.forwardRef(s);return o[LU]=i,o}function IU({layoutId:e}){const t=E.useContext(fP).id;return t&&e!==void 0?t+"-"+e:e}function DU(e,t){E.useContext(EP).strict}function MU(e){const{drag:t,layout:n}=va;if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const jU=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Iw(e){return typeof e!="string"||e.includes("-")?!1:!!(jU.indexOf(e)>-1||/[A-Z]/u.test(e))}function _P(e,{style:t,vars:n},r,i){Object.assign(e.style,t,i&&i.getProjectionStyles(r));for(const s in n)e.style.setProperty(s,n[s])}const AP=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function NP(e,t,n,r){_P(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(AP.has(i)?i:ep(i),t.attrs[i])}function PP(e,{layout:t,layoutId:n}){return ls.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Kd[e]||e==="opacity")}function Dw(e,t,n){var r;const{style:i}=e,s={};for(const o in i)(At(i[o])||t.style&&At(t.style[o])||PP(o,e)||((r=n==null?void 0:n.getValue(o))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(s[o]=i[o]);return n&&i&&typeof i.willChange=="string"&&(n.applyWillChange=!1),s}function OP(e,t,n){const r=Dw(e,t,n);for(const i in e)if(At(e[i])||At(t[i])){const s=oc.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[s]=e[i]}return r}function FU(e){const t=E.useRef(null);return t.current===null&&(t.current=e()),t.current}function $U({applyWillChange:e=!1,scrapeMotionValuesFromProps:t,createRenderState:n,onMount:r},i,s,o,a){const l={latestValues:VU(i,s,o,a?!1:e,t),renderState:n()};return r&&(l.mount=u=>r(i,u,l)),l}const LP=e=>(t,n)=>{const r=E.useContext(np),i=E.useContext(Ow),s=()=>$U(e,t,r,i,n);return n?s():FU(s)};function BU(e,t){const n=GN(t);n&&Zh(e,n)}function Ik(e,t,n){const r=Array.isArray(t)?t:[t];for(let i=0;i{for(const v in w){let g=w[v];if(Array.isArray(g)){const x=p?g.length-1:0;g=g[x]}g!==null&&(o[v]=g)}for(const v in y)o[v]=y[v]}),l&&(c&&f!==!1&&!_u(c)&&Ik(e,c,w=>{for(const y in w)BU(a,y)}),a.length&&(o.willChange=a.join(","))),o}const Mw=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),RP=()=>({...Mw(),attrs:{}}),IP=(e,t)=>t&&typeof e=="number"?t.transform(e):e,zU={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},UU=oc.length;function HU(e,t,n){let r="",i=!0;for(let s=0;stypeof e=="string"&&e.toLowerCase()==="svg",GU={useVisualState:LP({scrapeMotionValuesFromProps:OP,createRenderState:RP,onMount:(e,t,{renderState:n,latestValues:r})=>{Pe.read(()=>{try{n.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}}),Pe.render(()=>{Fw(n,r,$w(t.tagName),e.transformTemplate),NP(t,n)})}})},XU={useVisualState:LP({applyWillChange:!0,scrapeMotionValuesFromProps:Dw,createRenderState:Mw})};function DP(e,t,n){for(const r in t)!At(t[r])&&!PP(r,n)&&(e[r]=t[r])}function QU({transformTemplate:e},t){return E.useMemo(()=>{const n=Mw();return jw(n,t,e),Object.assign({},n.vars,n.style)},[t])}function ZU(e,t){const n=e.style||{},r={};return DP(r,n,e),Object.assign(r,QU(e,t)),r}function JU(e,t){const n={},r=ZU(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}const eH=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function qd(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||eH.has(e)}let MP=e=>!qd(e);function tH(e){e&&(MP=t=>t.startsWith("on")?!qd(t):e(t))}try{tH(require("@emotion/is-prop-valid").default)}catch{}function nH(e,t,n){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||(MP(i)||n===!0&&qd(i)||!t&&!qd(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}function rH(e,t,n,r){const i=E.useMemo(()=>{const s=RP();return Fw(s,t,$w(r),e.transformTemplate),{...s.attrs,style:{...s.style}}},[t]);if(e.style){const s={};DP(s,e.style,e),i.style={...s,...i.style}}return i}function iH(e=!1){return(n,r,i,{latestValues:s},o)=>{const l=(Iw(n)?rH:JU)(r,s,o,n),u=nH(r,typeof n=="string",e),f=n!==E.Fragment?{...u,...l,ref:i}:{},{children:c}=r,d=E.useMemo(()=>At(c)?c.get():c,[c]);return E.createElement(n,{...f,children:d})}}function sH(e,t){return function(r,{forwardMotionProps:i}={forwardMotionProps:!1}){const o={...Iw(r)?GU:XU,preloadedFeatures:e,useRender:iH(i),createVisualElement:t,Component:r};return RU(o)}}const l0={current:null},jP={current:!1};function oH(){if(jP.current=!0,!!Rw)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>l0.current=e.matches;e.addListener(t),t()}else l0.current=!1}function aH(e,t,n){for(const r in t){const i=t[r],s=n[r];if(At(i))e.addValue(r,i);else if(At(s))e.addValue(r,Ou(i,{owner:e}));else if(s!==i)if(e.hasValue(r)){const o=e.getValue(r);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=e.getStaticValue(r);e.addValue(r,Ou(o!==void 0?o:i,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const Mk=new WeakMap,lH=[...wN,Tt,Xi],uH=e=>lH.find(vN(e)),jk=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class cH{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:i,blockInitialAnimation:s,visualState:o},a={}){this.applyWillChange=!1,this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=xw,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const d=Cr.now();this.renderScheduledAtthis.bindToMotionValue(r,n)),jP.current||oH(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:l0.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Mk.delete(this.current),this.projection&&this.projection.unmount(),si(this.notifyUpdate),si(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const r=ls.has(t),i=n.on("change",a=>{this.latestValues[t]=a,this.props.onUpdate&&Pe.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),s=n.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{i(),s(),o&&o(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in va){const n=va[t];if(!n)continue;const{isEnabled:r,Feature:i}=n;if(!this.features[t]&&i&&r(this.props)&&(this.features[t]=new i(this)),this.features[t]){const s=this.features[t];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):et()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=Ou(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){var r;let i=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(r=this.getBaseTargetFromProps(this.props,t))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,t,this.options);return i!=null&&(typeof i=="string"&&(pN(i)||hN(i))?i=parseFloat(i):!uH(i)&&Xi.test(n)&&(i=_N(t,n)),this.setBaseTarget(t,At(i)?i.get():i)),At(i)?i.get():i}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props;let i;if(typeof r=="string"||typeof r=="object"){const o=pw(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);o&&(i=o[t])}if(r&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,t);return s!==void 0&&!At(s)?s:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Pw),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class FP extends cH{constructor(){super(...arguments),this.KeyframeResolver=AN}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}}function fH(e){return window.getComputedStyle(e)}class dH extends FP{constructor(){super(...arguments),this.type="html",this.applyWillChange=!0,this.renderInstance=_P}readValueFromInstance(t,n){if(ls.has(n)){const r=kw(n);return r&&r.default||0}else{const r=fH(t),i=(gN(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return uP(t,n)}build(t,n,r){jw(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return Dw(t,n,r)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;At(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class hH extends FP{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=et}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(ls.has(n)){const r=kw(n);return r&&r.default||0}return n=AP.has(n)?n:ep(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return OP(t,n,r)}build(t,n,r){Fw(t,n,this.isSVGTag,r.transformTemplate)}renderInstance(t,n,r,i){NP(t,n,r,i)}mount(t){this.isSVGTag=$w(t.tagName),super.mount(t)}}const pH=(e,t)=>Iw(e)?new hH(t):new dH(t,{allowProjection:e!==E.Fragment}),mH=sH({...e8,...SU,...fU,...kU},pH),u0=Yz(mH);function gH({title:e,titleId:t,...n},r){return E.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?E.createElement("title",{id:t},e):null,E.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"}))}const yH=E.forwardRef(gH);function vH({title:e,titleId:t,...n},r){return E.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?E.createElement("title",{id:t},e):null,E.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m8.25 4.5 7.5 7.5-7.5 7.5"}))}const Fk=E.forwardRef(vH);function wH({title:e,titleId:t,...n},r){return E.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?E.createElement("title",{id:t},e):null,E.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z"}),E.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))}const xH=E.forwardRef(wH);function bH({title:e,titleId:t,...n},r){return E.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?E.createElement("title",{id:t},e):null,E.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 0 1 4.5 9.75h15A2.25 2.25 0 0 1 21.75 12v.75m-8.69-6.44-2.12-2.12a1.5 1.5 0 0 0-1.061-.44H4.5A2.25 2.25 0 0 0 2.25 6v12a2.25 2.25 0 0 0 2.25 2.25h15A2.25 2.25 0 0 0 21.75 18V9a2.25 2.25 0 0 0-2.25-2.25h-5.379a1.5 1.5 0 0 1-1.06-.44Z"}))}const SH=E.forwardRef(bH);function kH({title:e,titleId:t,...n},r){return E.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?E.createElement("title",{id:t},e):null,E.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.347a1.125 1.125 0 0 1 0 1.972l-11.54 6.347a1.125 1.125 0 0 1-1.667-.986V5.653Z"}))}const EH=E.forwardRef(kH);function CH({title:e,titleId:t,...n},r){return E.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?E.createElement("title",{id:t},e):null,E.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6A2.25 2.25 0 0 1 6 3.75h2.25A2.25 2.25 0 0 1 10.5 6v2.25a2.25 2.25 0 0 1-2.25 2.25H6a2.25 2.25 0 0 1-2.25-2.25V6ZM3.75 15.75A2.25 2.25 0 0 1 6 13.5h2.25a2.25 2.25 0 0 1 2.25 2.25V18a2.25 2.25 0 0 1-2.25 2.25H6A2.25 2.25 0 0 1 3.75 18v-2.25ZM13.5 6a2.25 2.25 0 0 1 2.25-2.25H18A2.25 2.25 0 0 1 20.25 6v2.25A2.25 2.25 0 0 1 18 10.5h-2.25a2.25 2.25 0 0 1-2.25-2.25V6ZM13.5 15.75a2.25 2.25 0 0 1 2.25-2.25H18a2.25 2.25 0 0 1 2.25 2.25V18A2.25 2.25 0 0 1 18 20.25h-2.25A2.25 2.25 0 0 1 13.5 18v-2.25Z"}))}const TH=E.forwardRef(CH);function Qt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function _H(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function $P(...e){return t=>e.forEach(n=>_H(n,t))}function ur(...e){return E.useCallback($P(...e),e)}function AH(e,t){const n=E.createContext(t);function r(s){const{children:o,...a}=s,l=E.useMemo(()=>a,Object.values(a));return b.jsx(n.Provider,{value:l,children:o})}function i(s){const o=E.useContext(n);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return r.displayName=e+"Provider",[r,i]}function Bw(e,t=[]){let n=[];function r(s,o){const a=E.createContext(o),l=n.length;n=[...n,o];function u(c){const{scope:d,children:h,...p}=c,m=(d==null?void 0:d[e][l])||a,w=E.useMemo(()=>p,Object.values(p));return b.jsx(m.Provider,{value:w,children:h})}function f(c,d){const h=(d==null?void 0:d[e][l])||a,p=E.useContext(h);if(p)return p;if(o!==void 0)return o;throw new Error(`\`${c}\` must be used within \`${s}\``)}return u.displayName=s+"Provider",[u,f]}const i=()=>{const s=n.map(o=>E.createContext(o));return function(a){const l=(a==null?void 0:a[e])||s;return E.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,NH(i,...t)]}function NH(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:u})=>{const c=l(s)[`__scope${u}`];return{...a,...c}},{});return E.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var cc=E.forwardRef((e,t)=>{const{children:n,...r}=e,i=E.Children.toArray(n),s=i.find(PH);if(s){const o=s.props.children,a=i.map(l=>l===s?E.Children.count(o)>1?E.Children.only(null):E.isValidElement(o)?o.props.children:null:l);return b.jsx(c0,{...r,ref:t,children:E.isValidElement(o)?E.cloneElement(o,void 0,a):null})}return b.jsx(c0,{...r,ref:t,children:n})});cc.displayName="Slot";var c0=E.forwardRef((e,t)=>{const{children:n,...r}=e;if(E.isValidElement(n)){const i=LH(n);return E.cloneElement(n,{...OH(r,n.props),ref:t?$P(t,i):i})}return E.Children.count(n)>1?E.Children.only(null):null});c0.displayName="SlotClone";var BP=({children:e})=>b.jsx(b.Fragment,{children:e});function PH(e){return E.isValidElement(e)&&e.type===BP}function OH(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{s(...a),i(...a)}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function LH(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var RH=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Ut=RH.reduce((e,t)=>{const n=E.forwardRef((r,i)=>{const{asChild:s,...o}=r,a=s?cc:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),b.jsx(a,{...o,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function IH(e,t){e&&nc.flushSync(()=>e.dispatchEvent(t))}function Qi(e){const t=E.useRef(e);return E.useEffect(()=>{t.current=e}),E.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function DH(e,t=globalThis==null?void 0:globalThis.document){const n=Qi(e);E.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var MH="DismissableLayer",f0="dismissableLayer.update",jH="dismissableLayer.pointerDownOutside",FH="dismissableLayer.focusOutside",$k,VP=E.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Vw=E.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=e,u=E.useContext(VP),[f,c]=E.useState(null),d=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=E.useState({}),p=ur(t,C=>c(C)),m=Array.from(u.layers),[w]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=m.indexOf(w),v=f?m.indexOf(f):-1,g=u.layersWithOutsidePointerEventsDisabled.size>0,x=v>=y,S=VH(C=>{const T=C.target,O=[...u.branches].some(A=>A.contains(T));!x||O||(i==null||i(C),o==null||o(C),C.defaultPrevented||a==null||a())},d),k=zH(C=>{const T=C.target;[...u.branches].some(A=>A.contains(T))||(s==null||s(C),o==null||o(C),C.defaultPrevented||a==null||a())},d);return DH(C=>{v===u.layers.size-1&&(r==null||r(C),!C.defaultPrevented&&a&&(C.preventDefault(),a()))},d),E.useEffect(()=>{if(f)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&($k=d.body.style.pointerEvents,d.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),Bk(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(d.body.style.pointerEvents=$k)}},[f,d,n,u]),E.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),Bk())},[f,u]),E.useEffect(()=>{const C=()=>h({});return document.addEventListener(f0,C),()=>document.removeEventListener(f0,C)},[]),b.jsx(Ut.div,{...l,ref:p,style:{pointerEvents:g?x?"auto":"none":void 0,...e.style},onFocusCapture:Qt(e.onFocusCapture,k.onFocusCapture),onBlurCapture:Qt(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:Qt(e.onPointerDownCapture,S.onPointerDownCapture)})});Vw.displayName=MH;var $H="DismissableLayerBranch",BH=E.forwardRef((e,t)=>{const n=E.useContext(VP),r=E.useRef(null),i=ur(t,r);return E.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),b.jsx(Ut.div,{...e,ref:i})});BH.displayName=$H;function VH(e,t=globalThis==null?void 0:globalThis.document){const n=Qi(e),r=E.useRef(!1),i=E.useRef(()=>{});return E.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let l=function(){zP(jH,n,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=l,t.addEventListener("click",i.current,{once:!0})):l()}else t.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",s),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function zH(e,t=globalThis==null?void 0:globalThis.document){const n=Qi(e),r=E.useRef(!1);return E.useEffect(()=>{const i=s=>{s.target&&!r.current&&zP(FH,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Bk(){const e=new CustomEvent(f0);document.dispatchEvent(e)}function zP(e,t,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?IH(i,s):i.dispatchEvent(s)}var Ks=globalThis!=null&&globalThis.document?E.useLayoutEffect:()=>{},UH=ld.useId||(()=>{}),HH=0;function Vf(e){const[t,n]=E.useState(UH());return Ks(()=>{e||n(r=>r??String(HH++))},[e]),e||(t?`radix-${t}`:"")}const WH=["top","right","bottom","left"],Zi=Math.min,un=Math.max,Yd=Math.round,Gc=Math.floor,Ji=e=>({x:e,y:e}),KH={left:"right",right:"left",bottom:"top",top:"bottom"},qH={start:"end",end:"start"};function d0(e,t,n){return un(e,Zi(t,n))}function oi(e,t){return typeof e=="function"?e(t):e}function ai(e){return e.split("-")[0]}function Va(e){return e.split("-")[1]}function zw(e){return e==="x"?"y":"x"}function Uw(e){return e==="y"?"height":"width"}function es(e){return["top","bottom"].includes(ai(e))?"y":"x"}function Hw(e){return zw(es(e))}function YH(e,t,n){n===void 0&&(n=!1);const r=Va(e),i=Hw(e),s=Uw(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=Gd(o)),[o,Gd(o)]}function GH(e){const t=Gd(e);return[h0(e),t,h0(t)]}function h0(e){return e.replace(/start|end/g,t=>qH[t])}function XH(e,t,n){const r=["left","right"],i=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(e){case"top":case"bottom":return n?t?i:r:t?r:i;case"left":case"right":return t?s:o;default:return[]}}function QH(e,t,n,r){const i=Va(e);let s=XH(ai(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(h0)))),s}function Gd(e){return e.replace(/left|right|bottom|top/g,t=>KH[t])}function ZH(e){return{top:0,right:0,bottom:0,left:0,...e}}function UP(e){return typeof e!="number"?ZH(e):{top:e,right:e,bottom:e,left:e}}function Xd(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Vk(e,t,n){let{reference:r,floating:i}=e;const s=es(t),o=Hw(t),a=Uw(o),l=ai(t),u=s==="y",f=r.x+r.width/2-i.width/2,c=r.y+r.height/2-i.height/2,d=r[a]/2-i[a]/2;let h;switch(l){case"top":h={x:f,y:r.y-i.height};break;case"bottom":h={x:f,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:c};break;case"left":h={x:r.x-i.width,y:c};break;default:h={x:r.x,y:r.y}}switch(Va(t)){case"start":h[o]-=d*(n&&u?-1:1);break;case"end":h[o]+=d*(n&&u?-1:1);break}return h}const JH=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:f,y:c}=Vk(u,r,l),d=r,h={},p=0;for(let m=0;m({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=t,{element:u,padding:f=0}=oi(e,t)||{};if(u==null)return{};const c=UP(f),d={x:n,y:r},h=Hw(i),p=Uw(h),m=await o.getDimensions(u),w=h==="y",y=w?"top":"left",v=w?"bottom":"right",g=w?"clientHeight":"clientWidth",x=s.reference[p]+s.reference[h]-d[h]-s.floating[p],S=d[h]-s.reference[h],k=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let C=k?k[g]:0;(!C||!await(o.isElement==null?void 0:o.isElement(k)))&&(C=a.floating[g]||s.floating[p]);const T=x/2-S/2,O=C/2-m[p]/2-1,A=Zi(c[y],O),j=Zi(c[v],O),L=A,B=C-m[p]-j,N=C/2-m[p]/2+T,M=d0(L,N,B),I=!l.arrow&&Va(i)!=null&&N!==M&&s.reference[p]/2-(NN<=0)){var j,L;const N=(((j=s.flip)==null?void 0:j.index)||0)+1,M=C[N];if(M)return{data:{index:N,overflows:A},reset:{placement:M}};let I=(L=A.filter(F=>F.overflows[0]<=0).sort((F,P)=>F.overflows[1]-P.overflows[1])[0])==null?void 0:L.placement;if(!I)switch(h){case"bestFit":{var B;const F=(B=A.filter(P=>{if(k){const D=es(P.placement);return D===v||D==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(D=>D>0).reduce((D,_)=>D+_,0)]).sort((P,D)=>P[1]-D[1])[0])==null?void 0:B[0];F&&(I=F);break}case"initialPlacement":I=a;break}if(i!==I)return{reset:{placement:I}}}return{}}}};function zk(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Uk(e){return WH.some(t=>e[t]>=0)}const n7=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...i}=oi(e,t);switch(r){case"referenceHidden":{const s=await Lu(t,{...i,elementContext:"reference"}),o=zk(s,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:Uk(o)}}}case"escaped":{const s=await Lu(t,{...i,altBoundary:!0}),o=zk(s,n.floating);return{data:{escapedOffsets:o,escaped:Uk(o)}}}default:return{}}}}};async function r7(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=ai(n),a=Va(n),l=es(n)==="y",u=["left","top"].includes(o)?-1:1,f=s&&l?-1:1,c=oi(t,e);let{mainAxis:d,crossAxis:h,alignmentAxis:p}=typeof c=="number"?{mainAxis:c,crossAxis:0,alignmentAxis:null}:{mainAxis:c.mainAxis||0,crossAxis:c.crossAxis||0,alignmentAxis:c.alignmentAxis};return a&&typeof p=="number"&&(h=a==="end"?p*-1:p),l?{x:h*f,y:d*u}:{x:d*u,y:h*f}}const i7=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:o,middlewareData:a}=t,l=await r7(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},s7=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:w=>{let{x:y,y:v}=w;return{x:y,y:v}}},...l}=oi(e,t),u={x:n,y:r},f=await Lu(t,l),c=es(ai(i)),d=zw(c);let h=u[d],p=u[c];if(s){const w=d==="y"?"top":"left",y=d==="y"?"bottom":"right",v=h+f[w],g=h-f[y];h=d0(v,h,g)}if(o){const w=c==="y"?"top":"left",y=c==="y"?"bottom":"right",v=p+f[w],g=p-f[y];p=d0(v,p,g)}const m=a.fn({...t,[d]:h,[c]:p});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[d]:s,[c]:o}}}}}},o7=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=t,{offset:a=0,mainAxis:l=!0,crossAxis:u=!0}=oi(e,t),f={x:n,y:r},c=es(i),d=zw(c);let h=f[d],p=f[c];const m=oi(a,t),w=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const g=d==="y"?"height":"width",x=s.reference[d]-s.floating[g]+w.mainAxis,S=s.reference[d]+s.reference[g]-w.mainAxis;hS&&(h=S)}if(u){var y,v;const g=d==="y"?"width":"height",x=["top","left"].includes(ai(i)),S=s.reference[c]-s.floating[g]+(x&&((y=o.offset)==null?void 0:y[c])||0)+(x?0:w.crossAxis),k=s.reference[c]+s.reference[g]+(x?0:((v=o.offset)==null?void 0:v[c])||0)-(x?w.crossAxis:0);pk&&(p=k)}return{[d]:h,[c]:p}}}},a7=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:s,platform:o,elements:a}=t,{apply:l=()=>{},...u}=oi(e,t),f=await Lu(t,u),c=ai(i),d=Va(i),h=es(i)==="y",{width:p,height:m}=s.floating;let w,y;c==="top"||c==="bottom"?(w=c,y=d===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(y=c,w=d==="end"?"top":"bottom");const v=m-f.top-f.bottom,g=p-f.left-f.right,x=Zi(m-f[w],v),S=Zi(p-f[y],g),k=!t.middlewareData.shift;let C=x,T=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=g),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),k&&!d){const A=un(f.left,0),j=un(f.right,0),L=un(f.top,0),B=un(f.bottom,0);h?T=p-2*(A!==0||j!==0?A+j:un(f.left,f.right)):C=m-2*(L!==0||B!==0?L+B:un(f.top,f.bottom))}await l({...t,availableWidth:T,availableHeight:C});const O=await o.getDimensions(a.floating);return p!==O.width||m!==O.height?{reset:{rects:!0}}:{}}}};function ip(){return typeof window<"u"}function za(e){return HP(e)?(e.nodeName||"").toLowerCase():"#document"}function yn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Pr(e){var t;return(t=(HP(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function HP(e){return ip()?e instanceof Node||e instanceof yn(e).Node:!1}function ar(e){return ip()?e instanceof Element||e instanceof yn(e).Element:!1}function Nr(e){return ip()?e instanceof HTMLElement||e instanceof yn(e).HTMLElement:!1}function Hk(e){return!ip()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof yn(e).ShadowRoot}function fc(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=lr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function l7(e){return["table","td","th"].includes(za(e))}function sp(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Ww(e){const t=Kw(),n=ar(e)?lr(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function u7(e){let t=ts(e);for(;Nr(t)&&!wa(t);){if(Ww(t))return t;if(sp(t))return null;t=ts(t)}return null}function Kw(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function wa(e){return["html","body","#document"].includes(za(e))}function lr(e){return yn(e).getComputedStyle(e)}function op(e){return ar(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ts(e){if(za(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Hk(e)&&e.host||Pr(e);return Hk(t)?t.host:t}function WP(e){const t=ts(e);return wa(t)?e.ownerDocument?e.ownerDocument.body:e.body:Nr(t)&&fc(t)?t:WP(t)}function Ru(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=WP(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=yn(i);if(s){const a=p0(o);return t.concat(o,o.visualViewport||[],fc(i)?i:[],a&&n?Ru(a):[])}return t.concat(i,Ru(i,[],n))}function p0(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function KP(e){const t=lr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Nr(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,a=Yd(n)!==s||Yd(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function qw(e){return ar(e)?e:e.contextElement}function Jo(e){const t=qw(e);if(!Nr(t))return Ji(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=KP(t);let o=(s?Yd(n.width):n.width)/r,a=(s?Yd(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const c7=Ji(0);function qP(e){const t=yn(e);return!Kw()||!t.visualViewport?c7:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function f7(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==yn(e)?!1:t}function qs(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=qw(e);let o=Ji(1);t&&(r?ar(r)&&(o=Jo(r)):o=Jo(e));const a=f7(s,n,r)?qP(s):Ji(0);let l=(i.left+a.x)/o.x,u=(i.top+a.y)/o.y,f=i.width/o.x,c=i.height/o.y;if(s){const d=yn(s),h=r&&ar(r)?yn(r):r;let p=d,m=p0(p);for(;m&&r&&h!==p;){const w=Jo(m),y=m.getBoundingClientRect(),v=lr(m),g=y.left+(m.clientLeft+parseFloat(v.paddingLeft))*w.x,x=y.top+(m.clientTop+parseFloat(v.paddingTop))*w.y;l*=w.x,u*=w.y,f*=w.x,c*=w.y,l+=g,u+=x,p=yn(m),m=p0(p)}}return Xd({width:f,height:c,x:l,y:u})}function d7(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=Pr(r),a=t?sp(t.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},u=Ji(1);const f=Ji(0),c=Nr(r);if((c||!c&&!s)&&((za(r)!=="body"||fc(o))&&(l=op(r)),Nr(r))){const d=qs(r);u=Jo(r),f.x=d.x+r.clientLeft,f.y=d.y+r.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+f.x,y:n.y*u.y-l.scrollTop*u.y+f.y}}function h7(e){return Array.from(e.getClientRects())}function m0(e,t){const n=op(e).scrollLeft;return t?t.left+n:qs(Pr(e)).left+n}function p7(e){const t=Pr(e),n=op(e),r=e.ownerDocument.body,i=un(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=un(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+m0(e);const a=-n.scrollTop;return lr(r).direction==="rtl"&&(o+=un(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}function m7(e,t){const n=yn(e),r=Pr(e),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const u=Kw();(!u||u&&t==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a,y:l}}function g7(e,t){const n=qs(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=Nr(e)?Jo(e):Ji(1),o=e.clientWidth*s.x,a=e.clientHeight*s.y,l=i*s.x,u=r*s.y;return{width:o,height:a,x:l,y:u}}function Wk(e,t,n){let r;if(t==="viewport")r=m7(e,n);else if(t==="document")r=p7(Pr(e));else if(ar(t))r=g7(t,n);else{const i=qP(e);r={...t,x:t.x-i.x,y:t.y-i.y}}return Xd(r)}function YP(e,t){const n=ts(e);return n===t||!ar(n)||wa(n)?!1:lr(n).position==="fixed"||YP(n,t)}function y7(e,t){const n=t.get(e);if(n)return n;let r=Ru(e,[],!1).filter(a=>ar(a)&&za(a)!=="body"),i=null;const s=lr(e).position==="fixed";let o=s?ts(e):e;for(;ar(o)&&!wa(o);){const a=lr(o),l=Ww(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||fc(o)&&!l&&YP(e,o))?r=r.filter(f=>f!==o):i=a,o=ts(o)}return t.set(e,r),r}function v7(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?sp(t)?[]:y7(t,this._c):[].concat(n),r],a=o[0],l=o.reduce((u,f)=>{const c=Wk(t,f,i);return u.top=un(c.top,u.top),u.right=Zi(c.right,u.right),u.bottom=Zi(c.bottom,u.bottom),u.left=un(c.left,u.left),u},Wk(t,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function w7(e){const{width:t,height:n}=KP(e);return{width:t,height:n}}function x7(e,t,n){const r=Nr(t),i=Pr(t),s=n==="fixed",o=qs(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const l=Ji(0);if(r||!r&&!s)if((za(t)!=="body"||fc(i))&&(a=op(t)),r){const h=qs(t,!0,s,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else i&&(l.x=m0(i));let u=0,f=0;if(i&&!r&&!s){const h=i.getBoundingClientRect();f=h.top+a.scrollTop,u=h.left+a.scrollLeft-m0(i,h)}const c=o.left+a.scrollLeft-l.x-u,d=o.top+a.scrollTop-l.y-f;return{x:c,y:d,width:o.width,height:o.height}}function Hm(e){return lr(e).position==="static"}function Kk(e,t){if(!Nr(e)||lr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Pr(e)===n&&(n=n.ownerDocument.body),n}function GP(e,t){const n=yn(e);if(sp(e))return n;if(!Nr(e)){let i=ts(e);for(;i&&!wa(i);){if(ar(i)&&!Hm(i))return i;i=ts(i)}return n}let r=Kk(e,t);for(;r&&l7(r)&&Hm(r);)r=Kk(r,t);return r&&wa(r)&&Hm(r)&&!Ww(r)?n:r||u7(e)||n}const b7=async function(e){const t=this.getOffsetParent||GP,n=this.getDimensions,r=await n(e.floating);return{reference:x7(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function S7(e){return lr(e).direction==="rtl"}const k7={convertOffsetParentRelativeRectToViewportRelativeRect:d7,getDocumentElement:Pr,getClippingRect:v7,getOffsetParent:GP,getElementRects:b7,getClientRects:h7,getDimensions:w7,getScale:Jo,isElement:ar,isRTL:S7};function E7(e,t){let n=null,r;const i=Pr(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const{left:u,top:f,width:c,height:d}=e.getBoundingClientRect();if(a||t(),!c||!d)return;const h=Gc(f),p=Gc(i.clientWidth-(u+c)),m=Gc(i.clientHeight-(f+d)),w=Gc(u),v={rootMargin:-h+"px "+-p+"px "+-m+"px "+-w+"px",threshold:un(0,Zi(1,l))||1};let g=!0;function x(S){const k=S[0].intersectionRatio;if(k!==l){if(!g)return o();k?o(!1,k):r=setTimeout(()=>{o(!1,1e-7)},1e3)}g=!1}try{n=new IntersectionObserver(x,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(x,v)}n.observe(e)}return o(!0),s}function C7(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=qw(e),f=i||s?[...u?Ru(u):[],...Ru(t)]:[];f.forEach(y=>{i&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const c=u&&a?E7(u,n):null;let d=-1,h=null;o&&(h=new ResizeObserver(y=>{let[v]=y;v&&v.target===u&&h&&(h.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var g;(g=h)==null||g.observe(t)})),n()}),u&&!l&&h.observe(u),h.observe(t));let p,m=l?qs(e):null;l&&w();function w(){const y=qs(e);m&&(y.x!==m.x||y.y!==m.y||y.width!==m.width||y.height!==m.height)&&n(),m=y,p=requestAnimationFrame(w)}return n(),()=>{var y;f.forEach(v=>{i&&v.removeEventListener("scroll",n),s&&v.removeEventListener("resize",n)}),c==null||c(),(y=h)==null||y.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const T7=i7,_7=s7,A7=t7,N7=a7,P7=n7,qk=e7,O7=o7,L7=(e,t,n)=>{const r=new Map,i={platform:k7,...n},s={...i.platform,_c:r};return JH(e,t,{...i,platform:s})};var zf=typeof document<"u"?E.useLayoutEffect:E.useEffect;function Qd(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Qd(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!Qd(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function XP(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Yk(e,t){const n=XP(e);return Math.round(t*n)/n}function Wm(e){const t=E.useRef(e);return zf(()=>{t.current=e}),t}function R7(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:u}=e,[f,c]=E.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,h]=E.useState(r);Qd(d,r)||h(r);const[p,m]=E.useState(null),[w,y]=E.useState(null),v=E.useCallback(P=>{P!==k.current&&(k.current=P,m(P))},[]),g=E.useCallback(P=>{P!==C.current&&(C.current=P,y(P))},[]),x=s||p,S=o||w,k=E.useRef(null),C=E.useRef(null),T=E.useRef(f),O=l!=null,A=Wm(l),j=Wm(i),L=Wm(u),B=E.useCallback(()=>{if(!k.current||!C.current)return;const P={placement:t,strategy:n,middleware:d};j.current&&(P.platform=j.current),L7(k.current,C.current,P).then(D=>{const _={...D,isPositioned:L.current!==!1};N.current&&!Qd(T.current,_)&&(T.current=_,nc.flushSync(()=>{c(_)}))})},[d,t,n,j,L]);zf(()=>{u===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,c(P=>({...P,isPositioned:!1})))},[u]);const N=E.useRef(!1);zf(()=>(N.current=!0,()=>{N.current=!1}),[]),zf(()=>{if(x&&(k.current=x),S&&(C.current=S),x&&S){if(A.current)return A.current(x,S,B);B()}},[x,S,B,A,O]);const M=E.useMemo(()=>({reference:k,floating:C,setReference:v,setFloating:g}),[v,g]),I=E.useMemo(()=>({reference:x,floating:S}),[x,S]),F=E.useMemo(()=>{const P={position:n,left:0,top:0};if(!I.floating)return P;const D=Yk(I.floating,f.x),_=Yk(I.floating,f.y);return a?{...P,transform:"translate("+D+"px, "+_+"px)",...XP(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:D,top:_}},[n,a,I.floating,f.x,f.y]);return E.useMemo(()=>({...f,update:B,refs:M,elements:I,floatingStyles:F}),[f,B,M,I,F])}const I7=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?qk({element:r.current,padding:i}).fn(n):{}:r?qk({element:r,padding:i}).fn(n):{}}}},D7=(e,t)=>({...T7(e),options:[e,t]}),M7=(e,t)=>({..._7(e),options:[e,t]}),j7=(e,t)=>({...O7(e),options:[e,t]}),F7=(e,t)=>({...A7(e),options:[e,t]}),$7=(e,t)=>({...N7(e),options:[e,t]}),B7=(e,t)=>({...P7(e),options:[e,t]}),V7=(e,t)=>({...I7(e),options:[e,t]});var z7="Arrow",QP=E.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return b.jsx(Ut.svg,{...s,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:b.jsx("polygon",{points:"0,0 30,0 15,10"})})});QP.displayName=z7;var U7=QP;function H7(e){const[t,n]=E.useState(void 0);return Ks(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,u=Array.isArray(l)?l[0]:l;o=u.inlineSize,a=u.blockSize}else o=e.offsetWidth,a=e.offsetHeight;n({width:o,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Yw="Popper",[ZP,JP]=Bw(Yw),[W7,eO]=ZP(Yw),tO=e=>{const{__scopePopper:t,children:n}=e,[r,i]=E.useState(null);return b.jsx(W7,{scope:t,anchor:r,onAnchorChange:i,children:n})};tO.displayName=Yw;var nO="PopperAnchor",rO=E.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=eO(nO,n),o=E.useRef(null),a=ur(t,o);return E.useEffect(()=>{s.onAnchorChange((r==null?void 0:r.current)||o.current)}),r?null:b.jsx(Ut.div,{...i,ref:a})});rO.displayName=nO;var Gw="PopperContent",[K7,q7]=ZP(Gw),iO=E.forwardRef((e,t)=>{var re,G,le,de,ue,ie;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:c="partial",hideWhenDetached:d=!1,updatePositionStrategy:h="optimized",onPlaced:p,...m}=e,w=eO(Gw,n),[y,v]=E.useState(null),g=ur(t,pe=>v(pe)),[x,S]=E.useState(null),k=H7(x),C=(k==null?void 0:k.width)??0,T=(k==null?void 0:k.height)??0,O=r+(s!=="center"?"-"+s:""),A=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},j=Array.isArray(u)?u:[u],L=j.length>0,B={padding:A,boundary:j.filter(G7),altBoundary:L},{refs:N,floatingStyles:M,placement:I,isPositioned:F,middlewareData:P}=R7({strategy:"fixed",placement:O,whileElementsMounted:(...pe)=>C7(...pe,{animationFrame:h==="always"}),elements:{reference:w.anchor},middleware:[D7({mainAxis:i+T,alignmentAxis:o}),l&&M7({mainAxis:!0,crossAxis:!1,limiter:c==="partial"?j7():void 0,...B}),l&&F7({...B}),$7({...B,apply:({elements:pe,rects:Ne,availableWidth:gt,availableHeight:Ht})=>{const{width:Ir,height:$}=Ne.reference,z=pe.floating.style;z.setProperty("--radix-popper-available-width",`${gt}px`),z.setProperty("--radix-popper-available-height",`${Ht}px`),z.setProperty("--radix-popper-anchor-width",`${Ir}px`),z.setProperty("--radix-popper-anchor-height",`${$}px`)}}),x&&V7({element:x,padding:a}),X7({arrowWidth:C,arrowHeight:T}),d&&B7({strategy:"referenceHidden",...B})]}),[D,_]=aO(I),V=Qi(p);Ks(()=>{F&&(V==null||V())},[F,V]);const W=(re=P.arrow)==null?void 0:re.x,R=(G=P.arrow)==null?void 0:G.y,q=((le=P.arrow)==null?void 0:le.centerOffset)!==0,[J,Y]=E.useState();return Ks(()=>{y&&Y(window.getComputedStyle(y).zIndex)},[y]),b.jsx("div",{ref:N.setFloating,"data-radix-popper-content-wrapper":"",style:{...M,transform:F?M.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:J,"--radix-popper-transform-origin":[(de=P.transformOrigin)==null?void 0:de.x,(ue=P.transformOrigin)==null?void 0:ue.y].join(" "),...((ie=P.hide)==null?void 0:ie.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:b.jsx(K7,{scope:n,placedSide:D,onArrowChange:S,arrowX:W,arrowY:R,shouldHideArrow:q,children:b.jsx(Ut.div,{"data-side":D,"data-align":_,...m,ref:g,style:{...m.style,animation:F?void 0:"none"}})})})});iO.displayName=Gw;var sO="PopperArrow",Y7={top:"bottom",right:"left",bottom:"top",left:"right"},oO=E.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=q7(sO,r),o=Y7[s.placedSide];return b.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:b.jsx(U7,{...i,ref:n,style:{...i.style,display:"block"}})})});oO.displayName=sO;function G7(e){return e!==null}var X7=e=>({name:"transformOrigin",options:e,fn(t){var w,y,v;const{placement:n,rects:r,middlewareData:i}=t,o=((w=i.arrow)==null?void 0:w.centerOffset)!==0,a=o?0:e.arrowWidth,l=o?0:e.arrowHeight,[u,f]=aO(n),c={start:"0%",center:"50%",end:"100%"}[f],d=(((y=i.arrow)==null?void 0:y.x)??0)+a/2,h=(((v=i.arrow)==null?void 0:v.y)??0)+l/2;let p="",m="";return u==="bottom"?(p=o?c:`${d}px`,m=`${-l}px`):u==="top"?(p=o?c:`${d}px`,m=`${r.floating.height+l}px`):u==="right"?(p=`${-l}px`,m=o?c:`${h}px`):u==="left"&&(p=`${r.floating.width+l}px`,m=o?c:`${h}px`),{data:{x:p,y:m}}}});function aO(e){const[t,n="center"]=e.split("-");return[t,n]}var Q7=tO,Z7=rO,J7=iO,eW=oO,tW="Portal",lO=E.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[i,s]=E.useState(!1);Ks(()=>s(!0),[]);const o=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?V3.createPortal(b.jsx(Ut.div,{...r,ref:t}),o):null});lO.displayName=tW;function nW(e,t){return E.useReducer((n,r)=>t[n][r]??n,e)}var dc=e=>{const{present:t,children:n}=e,r=rW(t),i=typeof n=="function"?n({present:r.isPresent}):E.Children.only(n),s=ur(r.ref,iW(i));return typeof n=="function"||r.isPresent?E.cloneElement(i,{ref:s}):null};dc.displayName="Presence";function rW(e){const[t,n]=E.useState(),r=E.useRef({}),i=E.useRef(e),s=E.useRef("none"),o=e?"mounted":"unmounted",[a,l]=nW(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const u=Xc(r.current);s.current=a==="mounted"?u:"none"},[a]),Ks(()=>{const u=r.current,f=i.current;if(f!==e){const d=s.current,h=Xc(u);e?l("MOUNT"):h==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(f&&d!==h?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),Ks(()=>{if(t){const u=c=>{const h=Xc(r.current).includes(c.animationName);c.target===t&&h&&nc.flushSync(()=>l("ANIMATION_END"))},f=c=>{c.target===t&&(s.current=Xc(r.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:E.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function Xc(e){return(e==null?void 0:e.animationName)||"none"}function iW(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function uO({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,i]=sW({defaultProp:t,onChange:n}),s=e!==void 0,o=s?e:r,a=Qi(n),l=E.useCallback(u=>{if(s){const c=typeof u=="function"?u(e):u;c!==e&&a(c)}else i(u)},[s,e,i,a]);return[o,l]}function sW({defaultProp:e,onChange:t}){const n=E.useState(e),[r]=n,i=E.useRef(r),s=Qi(t);return E.useEffect(()=>{i.current!==r&&(s(r),i.current=r)},[r,i,s]),n}var oW="VisuallyHidden",cO=E.forwardRef((e,t)=>b.jsx(Ut.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));cO.displayName=oW;var aW=cO,[ap,epe]=Bw("Tooltip",[JP]),lp=JP(),fO="TooltipProvider",lW=700,g0="tooltip.open",[uW,Xw]=ap(fO),dO=e=>{const{__scopeTooltip:t,delayDuration:n=lW,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=e,[o,a]=E.useState(!0),l=E.useRef(!1),u=E.useRef(0);return E.useEffect(()=>{const f=u.current;return()=>window.clearTimeout(f)},[]),b.jsx(uW,{scope:t,isOpenDelayed:o,delayDuration:n,onOpen:E.useCallback(()=>{window.clearTimeout(u.current),a(!1)},[]),onClose:E.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a(!0),r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:E.useCallback(f=>{l.current=f},[]),disableHoverableContent:i,children:s})};dO.displayName=fO;var up="Tooltip",[cW,cp]=ap(up),hO=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i=!1,onOpenChange:s,disableHoverableContent:o,delayDuration:a}=e,l=Xw(up,e.__scopeTooltip),u=lp(t),[f,c]=E.useState(null),d=Vf(),h=E.useRef(0),p=o??l.disableHoverableContent,m=a??l.delayDuration,w=E.useRef(!1),[y=!1,v]=uO({prop:r,defaultProp:i,onChange:C=>{C?(l.onOpen(),document.dispatchEvent(new CustomEvent(g0))):l.onClose(),s==null||s(C)}}),g=E.useMemo(()=>y?w.current?"delayed-open":"instant-open":"closed",[y]),x=E.useCallback(()=>{window.clearTimeout(h.current),w.current=!1,v(!0)},[v]),S=E.useCallback(()=>{window.clearTimeout(h.current),v(!1)},[v]),k=E.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{w.current=!0,v(!0)},m)},[m,v]);return E.useEffect(()=>()=>window.clearTimeout(h.current),[]),b.jsx(Q7,{...u,children:b.jsx(cW,{scope:t,contentId:d,open:y,stateAttribute:g,trigger:f,onTriggerChange:c,onTriggerEnter:E.useCallback(()=>{l.isOpenDelayed?k():x()},[l.isOpenDelayed,k,x]),onTriggerLeave:E.useCallback(()=>{p?S():window.clearTimeout(h.current)},[S,p]),onOpen:x,onClose:S,disableHoverableContent:p,children:n})})};hO.displayName=up;var y0="TooltipTrigger",pO=E.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=cp(y0,n),s=Xw(y0,n),o=lp(n),a=E.useRef(null),l=ur(t,a,i.onTriggerChange),u=E.useRef(!1),f=E.useRef(!1),c=E.useCallback(()=>u.current=!1,[]);return E.useEffect(()=>()=>document.removeEventListener("pointerup",c),[c]),b.jsx(Z7,{asChild:!0,...o,children:b.jsx(Ut.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:Qt(e.onPointerMove,d=>{d.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),f.current=!0)}),onPointerLeave:Qt(e.onPointerLeave,()=>{i.onTriggerLeave(),f.current=!1}),onPointerDown:Qt(e.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",c,{once:!0})}),onFocus:Qt(e.onFocus,()=>{u.current||i.onOpen()}),onBlur:Qt(e.onBlur,i.onClose),onClick:Qt(e.onClick,i.onClose)})})});pO.displayName=y0;var fW="TooltipPortal",[tpe,dW]=ap(fW,{forceMount:void 0}),xa="TooltipContent",mO=E.forwardRef((e,t)=>{const n=dW(xa,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=e,o=cp(xa,e.__scopeTooltip);return b.jsx(dc,{present:r||o.open,children:o.disableHoverableContent?b.jsx(gO,{side:i,...s,ref:t}):b.jsx(hW,{side:i,...s,ref:t})})}),hW=E.forwardRef((e,t)=>{const n=cp(xa,e.__scopeTooltip),r=Xw(xa,e.__scopeTooltip),i=E.useRef(null),s=ur(t,i),[o,a]=E.useState(null),{trigger:l,onClose:u}=n,f=i.current,{onPointerInTransitChange:c}=r,d=E.useCallback(()=>{a(null),c(!1)},[c]),h=E.useCallback((p,m)=>{const w=p.currentTarget,y={x:p.clientX,y:p.clientY},v=yW(y,w.getBoundingClientRect()),g=vW(y,v),x=wW(m.getBoundingClientRect()),S=bW([...g,...x]);a(S),c(!0)},[c]);return E.useEffect(()=>()=>d(),[d]),E.useEffect(()=>{if(l&&f){const p=w=>h(w,f),m=w=>h(w,l);return l.addEventListener("pointerleave",p),f.addEventListener("pointerleave",m),()=>{l.removeEventListener("pointerleave",p),f.removeEventListener("pointerleave",m)}}},[l,f,h,d]),E.useEffect(()=>{if(o){const p=m=>{const w=m.target,y={x:m.clientX,y:m.clientY},v=(l==null?void 0:l.contains(w))||(f==null?void 0:f.contains(w)),g=!xW(y,o);v?d():g&&(d(),u())};return document.addEventListener("pointermove",p),()=>document.removeEventListener("pointermove",p)}},[l,f,o,u,d]),b.jsx(gO,{...e,ref:s})}),[pW,mW]=ap(up,{isInside:!1}),gO=E.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=e,l=cp(xa,n),u=lp(n),{onClose:f}=l;return E.useEffect(()=>(document.addEventListener(g0,f),()=>document.removeEventListener(g0,f)),[f]),E.useEffect(()=>{if(l.trigger){const c=d=>{const h=d.target;h!=null&&h.contains(l.trigger)&&f()};return window.addEventListener("scroll",c,{capture:!0}),()=>window.removeEventListener("scroll",c,{capture:!0})}},[l.trigger,f]),b.jsx(Vw,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:c=>c.preventDefault(),onDismiss:f,children:b.jsxs(J7,{"data-state":l.stateAttribute,...u,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[b.jsx(BP,{children:r}),b.jsx(pW,{scope:n,isInside:!0,children:b.jsx(aW,{id:l.contentId,role:"tooltip",children:i||r})})]})})});mO.displayName=xa;var yO="TooltipArrow",gW=E.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=lp(n);return mW(yO,n).isInside?null:b.jsx(eW,{...i,...r,ref:t})});gW.displayName=yO;function yW(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function vW(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function wW(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function xW(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;sr!=f>r&&n<(u-a)*(r-l)/(f-l)+a&&(i=!i)}return i}function bW(e){const t=e.slice();return t.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),SW(t)}function SW(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const s=n[n.length-1],o=n[n.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var kW=dO,EW=hO,CW=pO,vO=mO;function wO(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t{const t=NW(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{const a=o.split(Qw);return a[0]===""&&a.length!==1&&a.shift(),xO(a,t)||AW(o)},getConflictingClassGroupIds:(o,a)=>{const l=n[o]||[];return a&&r[o]?[...l,...r[o]]:l}}},xO=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),i=r?xO(e.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;const s=e.join(Qw);return(o=t.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},Gk=/^\[(.+)\]$/,AW=e=>{if(Gk.test(e)){const t=Gk.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},NW=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return OW(Object.entries(e.classGroups),n).forEach(([s,o])=>{v0(o,r,s,t)}),r},v0=(e,t,n,r)=>{e.forEach(i=>{if(typeof i=="string"){const s=i===""?t:Xk(t,i);s.classGroupId=n;return}if(typeof i=="function"){if(PW(i)){v0(i(r),t,n,r);return}t.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,o])=>{v0(o,Xk(t,s),n,r)})})},Xk=(e,t)=>{let n=e;return t.split(Qw).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},PW=e=>e.isThemeGetter,OW=(e,t)=>t?e.map(([n,r])=>{const i=r.map(s=>typeof s=="string"?t+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[t+o,a])):s);return[n,i]}):e,LW=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const i=(s,o)=>{n.set(s,o),t++,t>e&&(t=0,r=n,n=new Map)};return{get(s){let o=n.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){n.has(s)?n.set(s,o):i(s,o)}}},bO="!",RW=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,i=t[0],s=t.length,o=a=>{const l=[];let u=0,f=0,c;for(let w=0;wf?c-f:void 0;return{modifiers:l,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:m}};return n?a=>n({className:a,parseClassName:o}):o},IW=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},DW=e=>({cache:LW(e.cacheSize),parseClassName:RW(e),..._W(e)}),MW=/\s+/,jW=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=t,s=[],o=e.trim().split(MW);let a="";for(let l=o.length-1;l>=0;l-=1){const u=o[l],{modifiers:f,hasImportantModifier:c,baseClassName:d,maybePostfixModifierPosition:h}=n(u);let p=!!h,m=r(p?d.substring(0,h):d);if(!m){if(!p){a=u+(a.length>0?" "+a:a);continue}if(m=r(d),!m){a=u+(a.length>0?" "+a:a);continue}p=!1}const w=IW(f).join(":"),y=c?w+bO:w,v=y+m;if(s.includes(v))continue;s.push(v);const g=i(m,p);for(let x=0;x0?" "+a:a)}return a};function FW(){let e=0,t,n,r="";for(;e{if(typeof e=="string")return e;let t,n="";for(let r=0;rc(f),e());return n=DW(u),r=n.cache.get,i=n.cache.set,s=a,a(l)}function a(l){const u=r(l);if(u)return u;const f=jW(l,n);return i(l,f),f}return function(){return s(FW.apply(null,arguments))}}const je=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},kO=/^\[(?:([a-z-]+):)?(.+)\]$/i,BW=/^\d+\/\d+$/,VW=new Set(["px","full","screen"]),zW=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,UW=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,HW=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,WW=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,KW=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Mr=e=>ea(e)||VW.has(e)||BW.test(e),yi=e=>Ua(e,"length",eK),ea=e=>!!e&&!Number.isNaN(Number(e)),Km=e=>Ua(e,"number",ea),fl=e=>!!e&&Number.isInteger(Number(e)),qW=e=>e.endsWith("%")&&ea(e.slice(0,-1)),ve=e=>kO.test(e),vi=e=>zW.test(e),YW=new Set(["length","size","percentage"]),GW=e=>Ua(e,YW,EO),XW=e=>Ua(e,"position",EO),QW=new Set(["image","url"]),ZW=e=>Ua(e,QW,nK),JW=e=>Ua(e,"",tK),dl=()=>!0,Ua=(e,t,n)=>{const r=kO.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},eK=e=>UW.test(e)&&!HW.test(e),EO=()=>!1,tK=e=>WW.test(e),nK=e=>KW.test(e),rK=()=>{const e=je("colors"),t=je("spacing"),n=je("blur"),r=je("brightness"),i=je("borderColor"),s=je("borderRadius"),o=je("borderSpacing"),a=je("borderWidth"),l=je("contrast"),u=je("grayscale"),f=je("hueRotate"),c=je("invert"),d=je("gap"),h=je("gradientColorStops"),p=je("gradientColorStopPositions"),m=je("inset"),w=je("margin"),y=je("opacity"),v=je("padding"),g=je("saturate"),x=je("scale"),S=je("sepia"),k=je("skew"),C=je("space"),T=je("translate"),O=()=>["auto","contain","none"],A=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto",ve,t],L=()=>[ve,t],B=()=>["",Mr,yi],N=()=>["auto",ea,ve],M=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],I=()=>["solid","dashed","dotted","double","none"],F=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],P=()=>["start","end","center","between","around","evenly","stretch"],D=()=>["","0",ve],_=()=>["auto","avoid","all","avoid-page","page","left","right","column"],V=()=>[ea,ve];return{cacheSize:500,separator:":",theme:{colors:[dl],spacing:[Mr,yi],blur:["none","",vi,ve],brightness:V(),borderColor:[e],borderRadius:["none","","full",vi,ve],borderSpacing:L(),borderWidth:B(),contrast:V(),grayscale:D(),hueRotate:V(),invert:D(),gap:L(),gradientColorStops:[e],gradientColorStopPositions:[qW,yi],inset:j(),margin:j(),opacity:V(),padding:L(),saturate:V(),scale:V(),sepia:D(),skew:V(),space:L(),translate:L()},classGroups:{aspect:[{aspect:["auto","square","video",ve]}],container:["container"],columns:[{columns:[vi]}],"break-after":[{"break-after":_()}],"break-before":[{"break-before":_()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...M(),ve]}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",fl,ve]}],basis:[{basis:j()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ve]}],grow:[{grow:D()}],shrink:[{shrink:D()}],order:[{order:["first","last","none",fl,ve]}],"grid-cols":[{"grid-cols":[dl]}],"col-start-end":[{col:["auto",{span:["full",fl,ve]},ve]}],"col-start":[{"col-start":N()}],"col-end":[{"col-end":N()}],"grid-rows":[{"grid-rows":[dl]}],"row-start-end":[{row:["auto",{span:[fl,ve]},ve]}],"row-start":[{"row-start":N()}],"row-end":[{"row-end":N()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ve]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ve]}],gap:[{gap:[d]}],"gap-x":[{"gap-x":[d]}],"gap-y":[{"gap-y":[d]}],"justify-content":[{justify:["normal",...P()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...P(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...P(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],ms:[{ms:[w]}],me:[{me:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[C]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[C]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ve,t]}],"min-w":[{"min-w":[ve,t,"min","max","fit"]}],"max-w":[{"max-w":[ve,t,"none","full","min","max","fit","prose",{screen:[vi]},vi]}],h:[{h:[ve,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ve,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ve,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ve,t,"auto","min","max","fit"]}],"font-size":[{text:["base",vi,yi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Km]}],"font-family":[{font:[dl]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",ve]}],"line-clamp":[{"line-clamp":["none",ea,Km]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Mr,ve]}],"list-image":[{"list-image":["none",ve]}],"list-style-type":[{list:["none","disc","decimal",ve]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...I(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Mr,yi]}],"underline-offset":[{"underline-offset":["auto",Mr,ve]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:L()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ve]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ve]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...M(),XW]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",GW]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},ZW]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[p]}],"gradient-via-pos":[{via:[p]}],"gradient-to-pos":[{to:[p]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[...I(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}],"divide-style":[{divide:I()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...I()]}],"outline-offset":[{"outline-offset":[Mr,ve]}],"outline-w":[{outline:[Mr,yi]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[Mr,yi]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",vi,JW]}],"shadow-color":[{shadow:[dl]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...F(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":F()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",vi,ve]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[f]}],invert:[{invert:[c]}],saturate:[{saturate:[g]}],sepia:[{sepia:[S]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[f]}],"backdrop-invert":[{"backdrop-invert":[c]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[g]}],"backdrop-sepia":[{"backdrop-sepia":[S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ve]}],duration:[{duration:V()}],ease:[{ease:["linear","in","out","in-out",ve]}],delay:[{delay:V()}],animate:[{animate:["none","spin","ping","pulse","bounce",ve]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[x]}],"scale-x":[{"scale-x":[x]}],"scale-y":[{"scale-y":[x]}],rotate:[{rotate:[fl,ve]}],"translate-x":[{"translate-x":[T]}],"translate-y":[{"translate-y":[T]}],"skew-x":[{"skew-x":[k]}],"skew-y":[{"skew-y":[k]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ve]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ve]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ve]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Mr,yi,Km]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},iK=$W(rK);function nt(...e){return iK(TW(e))}const hl=kW,pl=EW,ml=CW,vo=E.forwardRef(({className:e,sideOffset:t=4,...n},r)=>b.jsx(vO,{ref:r,sideOffset:t,className:nt("z-50 overflow-hidden rounded-md border border-neutral-200 bg-white px-3 py-1.5 text-sm text-neutral-950 shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50",e),...n}));vo.displayName=vO.displayName;const sK=()=>{const[e,t]=E.useState(!1),[n,r]=E.useState(!1),i=()=>t(!e),s=()=>r(!n);return b.jsxs(u0.div,{className:"h-screen bg-black text-[#ddd] border-r border-[#222] text-sm",initial:{width:240},animate:{width:e?60:240},transition:{duration:.2},children:[b.jsxs("div",{onClick:i,className:"hover:bg-[#1a1a1a] cursor-pointer p-4 flex items-center justify-between",children:[!e&&b.jsxs("h1",{className:"flex gap-2 items-center",children:[b.jsx(Fk,{className:`w-4 h-4 text-[#bbb] transition-transform ${e?"":"rotate-180"}`}),"Dashboard"]}),b.jsx(hl,{children:b.jsxs(pl,{children:[b.jsx(ml,{asChild:!0,children:e&&b.jsx("button",{className:"p-2 rounded-full",children:b.jsx(Fk,{className:"w-4 h-4 text-[#bbb] transition-transform"})})||b.jsx("div",{className:"h-8"})}),b.jsx(vo,{children:b.jsxs("p",{children:[e?"Expand":"Collapse"," sidebar"]})})]})})]}),b.jsxs("nav",{className:"mt-4",children:[b.jsx(hl,{children:b.jsxs(pl,{children:[b.jsx(ml,{asChild:!0,children:b.jsxs(Kl,{to:"/projects",className:"flex items-center p-3 hover:bg-[#1a1a1a]",children:[b.jsx(SH,{className:"w-3 h-3 text-[#bbb]"}),!e&&b.jsx("span",{className:"ml-3",children:"Projects"})]})}),b.jsx(vo,{children:b.jsx("p",{children:"View Projects"})})]})}),!e&&b.jsxs("div",{children:[b.jsx(hl,{children:b.jsxs(pl,{children:[b.jsx(ml,{asChild:!0,children:b.jsxs("button",{onClick:s,className:"w-full flex items-center justify-between p-3 hover:bg-[#1a1a1a]",children:[b.jsxs("div",{className:"flex items-center",children:[b.jsx(EH,{className:"w-3 h-3 text-[#bbb]"}),!e&&b.jsx("span",{className:"ml-3",children:"Playground"})]}),!e&&b.jsx(yH,{className:`w-3 h-3 transition-transform ${n?"rotate-180":""}`})]})}),b.jsx(vo,{children:b.jsxs("p",{children:[n?"Close":"Open"," Playground"]})})]})}),n&&!e&&b.jsx(hl,{children:b.jsxs(pl,{children:[b.jsx(ml,{asChild:!0,children:b.jsxs(Kl,{to:"/playground/designer",className:"flex items-center p-3 pl-6 hover:bg-[#1a1a1a]",children:[b.jsx(TH,{className:"w-3 h-3 text-[#bbb]"}),b.jsx("span",{className:"ml-3",children:"Component Designer"})]})}),b.jsx(vo,{children:b.jsx("p",{children:"Open Component Designer"})})]})})]}),b.jsx(hl,{children:b.jsxs(pl,{children:[b.jsx(ml,{asChild:!0,children:b.jsxs(Kl,{to:"/settings",className:"flex items-center p-3 hover:bg-[#1a1a1a]",children:[b.jsx(xH,{className:"w-3 h-3 text-[#bbb]"}),!e&&b.jsx("span",{className:"ml-3",children:"Settings"})]})}),b.jsx(vo,{children:b.jsx("p",{children:"Open Settings"})})]})})]})]})};var hc=e=>e.type==="checkbox",$o=e=>e instanceof Date,jt=e=>e==null;const CO=e=>typeof e=="object";var lt=e=>!jt(e)&&!Array.isArray(e)&&CO(e)&&!$o(e),TO=e=>lt(e)&&e.target?hc(e.target)?e.target.checked:e.target.value:e,oK=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,_O=(e,t)=>e.has(oK(t)),aK=e=>{const t=e.constructor&&e.constructor.prototype;return lt(t)&&t.hasOwnProperty("isPrototypeOf")},Zw=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Yt(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(Zw&&(e instanceof Blob||e instanceof FileList))&&(n||lt(e)))if(t=n?[]:{},!n&&!aK(e))t=e;else for(const r in e)e.hasOwnProperty(r)&&(t[r]=Yt(e[r]));else return e;return t}var fp=e=>Array.isArray(e)?e.filter(Boolean):[],Ze=e=>e===void 0,te=(e,t,n)=>{if(!t||!lt(e))return n;const r=fp(t.split(/[,[\].]+?/)).reduce((i,s)=>jt(i)?i:i[s],e);return Ze(r)||r===e?Ze(e[t])?n:e[t]:r},Nn=e=>typeof e=="boolean",Jw=e=>/^\w*$/.test(e),AO=e=>fp(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Le=(e,t,n)=>{let r=-1;const i=Jw(t)?[t]:AO(t),s=i.length,o=s-1;for(;++rwe.useContext(NO),lK=e=>{const{children:t,...n}=e;return we.createElement(NO.Provider,{value:n},t)};var PO=(e,t,n,r=!0)=>{const i={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(i,s,{get:()=>{const o=s;return t._proxyFormState[o]!==Jn.all&&(t._proxyFormState[o]=!r||Jn.all),n&&(n[o]=!0),e[o]}});return i},Gt=e=>lt(e)&&!Object.keys(e).length,OO=(e,t,n,r)=>{n(e);const{name:i,...s}=e;return Gt(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(o=>t[o]===(!r||Jn.all))},Zl=e=>Array.isArray(e)?e:[e],LO=(e,t,n)=>!e||!t||e===t||Zl(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r)));function ex(e){const t=we.useRef(e);t.current=e,we.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}function uK(e){const t=dp(),{control:n=t.control,disabled:r,name:i,exact:s}=e||{},[o,a]=we.useState(n._formState),l=we.useRef(!0),u=we.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),f=we.useRef(i);return f.current=i,ex({disabled:r,next:c=>l.current&&LO(f.current,c.name,s)&&OO(c,u.current,n._updateFormState)&&a({...n._formState,...c}),subject:n._subjects.state}),we.useEffect(()=>(l.current=!0,u.current.isValid&&n._updateValid(!0),()=>{l.current=!1}),[n]),PO(o,n,u.current,!1)}var xr=e=>typeof e=="string",RO=(e,t,n,r,i)=>xr(e)?(r&&t.watch.add(e),te(n,e,i)):Array.isArray(e)?e.map(s=>(r&&t.watch.add(s),te(n,s))):(r&&(t.watchAll=!0),n);function cK(e){const t=dp(),{control:n=t.control,name:r,defaultValue:i,disabled:s,exact:o}=e||{},a=we.useRef(r);a.current=r,ex({disabled:s,subject:n._subjects.values,next:f=>{LO(a.current,f.name,o)&&u(Yt(RO(a.current,n._names,f.values||n._formValues,!1,i)))}});const[l,u]=we.useState(n._getWatch(r,i));return we.useEffect(()=>n._removeUnmounted()),l}function fK(e){const t=dp(),{name:n,disabled:r,control:i=t.control,shouldUnregister:s}=e,o=_O(i._names.array,n),a=cK({control:i,name:n,defaultValue:te(i._formValues,n,te(i._defaultValues,n,e.defaultValue)),exact:!0}),l=uK({control:i,name:n,exact:!0}),u=we.useRef(i.register(n,{...e.rules,value:a,...Nn(e.disabled)?{disabled:e.disabled}:{}}));return we.useEffect(()=>{const f=i._options.shouldUnregister||s,c=(d,h)=>{const p=te(i._fields,d);p&&p._f&&(p._f.mount=h)};if(c(n,!0),f){const d=Yt(te(i._options.defaultValues,n));Le(i._defaultValues,n,d),Ze(te(i._formValues,n))&&Le(i._formValues,n,d)}return()=>{(o?f&&!i._state.action:f)?i.unregister(n):c(n,!1)}},[n,i,o,s]),we.useEffect(()=>{te(i._fields,n)&&i._updateDisabledField({disabled:r,fields:i._fields,name:n,value:te(i._fields,n)._f.value})},[r,n,i]),{field:{name:n,value:a,...Nn(r)||l.disabled?{disabled:l.disabled||r}:{},onChange:we.useCallback(f=>u.current.onChange({target:{value:TO(f),name:n},type:Zd.CHANGE}),[n]),onBlur:we.useCallback(()=>u.current.onBlur({target:{value:te(i._formValues,n),name:n},type:Zd.BLUR}),[n,i]),ref:we.useCallback(f=>{const c=te(i._fields,n);c&&f&&(c._f.ref={focus:()=>f.focus(),select:()=>f.select(),setCustomValidity:d=>f.setCustomValidity(d),reportValidity:()=>f.reportValidity()})},[i._fields,n])},formState:l,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!te(l.errors,n)},isDirty:{enumerable:!0,get:()=>!!te(l.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!te(l.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!te(l.validatingFields,n)},error:{enumerable:!0,get:()=>te(l.errors,n)}})}}const dK=e=>e.render(fK(e));var hK=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},Qk=e=>({isOnSubmit:!e||e===Jn.onSubmit,isOnBlur:e===Jn.onBlur,isOnChange:e===Jn.onChange,isOnAll:e===Jn.all,isOnTouch:e===Jn.onTouched}),Zk=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const Jl=(e,t,n,r)=>{for(const i of n||Object.keys(e)){const s=te(e,i);if(s){const{_f:o,...a}=s;if(o){if(o.refs&&o.refs[0]&&t(o.refs[0],i)&&!r)return!0;if(o.ref&&t(o.ref,o.name)&&!r)return!0;if(Jl(a,t))break}else if(lt(a)&&Jl(a,t))break}}};var pK=(e,t,n)=>{const r=Zl(te(e,n));return Le(r,"root",t[n]),Le(e,n,r),e},tx=e=>e.type==="file",Wr=e=>typeof e=="function",Jd=e=>{if(!Zw)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Uf=e=>xr(e),nx=e=>e.type==="radio",eh=e=>e instanceof RegExp;const Jk={value:!1,isValid:!1},eE={value:!0,isValid:!0};var IO=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Ze(e[0].attributes.value)?Ze(e[0].value)||e[0].value===""?eE:{value:e[0].value,isValid:!0}:eE:Jk}return Jk};const tE={isValid:!1,value:null};var DO=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,tE):tE;function nE(e,t,n="validate"){if(Uf(e)||Array.isArray(e)&&e.every(Uf)||Nn(e)&&!e)return{type:n,message:Uf(e)?e:"",ref:t}}var lo=e=>lt(e)&&!eh(e)?e:{value:e,message:""},rE=async(e,t,n,r,i)=>{const{ref:s,refs:o,required:a,maxLength:l,minLength:u,min:f,max:c,pattern:d,validate:h,name:p,valueAsNumber:m,mount:w,disabled:y}=e._f,v=te(t,p);if(!w||y)return{};const g=o?o[0]:s,x=L=>{r&&g.reportValidity&&(g.setCustomValidity(Nn(L)?"":L||""),g.reportValidity())},S={},k=nx(s),C=hc(s),T=k||C,O=(m||tx(s))&&Ze(s.value)&&Ze(v)||Jd(s)&&s.value===""||v===""||Array.isArray(v)&&!v.length,A=hK.bind(null,p,n,S),j=(L,B,N,M=jr.maxLength,I=jr.minLength)=>{const F=L?B:N;S[p]={type:L?M:I,message:F,ref:s,...A(L?M:I,F)}};if(i?!Array.isArray(v)||!v.length:a&&(!T&&(O||jt(v))||Nn(v)&&!v||C&&!IO(o).isValid||k&&!DO(o).isValid)){const{value:L,message:B}=Uf(a)?{value:!!a,message:a}:lo(a);if(L&&(S[p]={type:jr.required,message:B,ref:g,...A(jr.required,B)},!n))return x(B),S}if(!O&&(!jt(f)||!jt(c))){let L,B;const N=lo(c),M=lo(f);if(!jt(v)&&!isNaN(v)){const I=s.valueAsNumber||v&&+v;jt(N.value)||(L=I>N.value),jt(M.value)||(B=Inew Date(new Date().toDateString()+" "+_),P=s.type=="time",D=s.type=="week";xr(N.value)&&v&&(L=P?F(v)>F(N.value):D?v>N.value:I>new Date(N.value)),xr(M.value)&&v&&(B=P?F(v)+L.value,M=!jt(B.value)&&v.length<+B.value;if((N||M)&&(j(N,L.message,B.message),!n))return x(S[p].message),S}if(d&&!O&&xr(v)){const{value:L,message:B}=lo(d);if(eh(L)&&!v.match(L)&&(S[p]={type:jr.pattern,message:B,ref:s,...A(jr.pattern,B)},!n))return x(B),S}if(h){if(Wr(h)){const L=await h(v,t),B=nE(L,g);if(B&&(S[p]={...B,...A(jr.validate,B.message)},!n))return x(B.message),S}else if(lt(h)){let L={};for(const B in h){if(!Gt(L)&&!n)break;const N=nE(await h[B](v,t),g,B);N&&(L={...N,...A(B,N.message)},x(N.message),n&&(S[p]=L))}if(!Gt(L)&&(S[p]={ref:g,...L},!n))return S}}return x(!0),S};function mK(e,t){const n=t.slice(0,-1).length;let r=0;for(;r{let e=[];return{get observers(){return e},next:i=>{for(const s of e)s.next&&s.next(i)},subscribe:i=>(e.push(i),{unsubscribe:()=>{e=e.filter(s=>s!==i)}}),unsubscribe:()=>{e=[]}}},th=e=>jt(e)||!CO(e);function Ni(e,t){if(th(e)||th(t))return e===t;if($o(e)&&$o(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n){const s=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const o=t[i];if($o(s)&&$o(o)||lt(s)&<(o)||Array.isArray(s)&&Array.isArray(o)?!Ni(s,o):s!==o)return!1}}return!0}var MO=e=>e.type==="select-multiple",yK=e=>nx(e)||hc(e),Ym=e=>Jd(e)&&e.isConnected,jO=e=>{for(const t in e)if(Wr(e[t]))return!0;return!1};function nh(e,t={}){const n=Array.isArray(e);if(lt(e)||n)for(const r in e)Array.isArray(e[r])||lt(e[r])&&!jO(e[r])?(t[r]=Array.isArray(e[r])?[]:{},nh(e[r],t[r])):jt(e[r])||(t[r]=!0);return t}function FO(e,t,n){const r=Array.isArray(e);if(lt(e)||r)for(const i in e)Array.isArray(e[i])||lt(e[i])&&!jO(e[i])?Ze(t)||th(n[i])?n[i]=Array.isArray(e[i])?nh(e[i],[]):{...nh(e[i])}:FO(e[i],jt(t)?{}:t[i],n[i]):n[i]=!Ni(e[i],t[i]);return n}var Qc=(e,t)=>FO(e,t,nh(t)),$O=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Ze(e)?e:t?e===""?NaN:e&&+e:n&&xr(e)?new Date(e):r?r(e):e;function Gm(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return tx(t)?t.files:nx(t)?DO(e.refs).value:MO(t)?[...t.selectedOptions].map(({value:n})=>n):hc(t)?IO(e.refs).value:$O(Ze(t.value)?e.ref.value:t.value,e)}var vK=(e,t,n,r)=>{const i={};for(const s of e){const o=te(t,s);o&&Le(i,s,o._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},gl=e=>Ze(e)?e:eh(e)?e.source:lt(e)?eh(e.value)?e.value.source:e.value:e;const iE="AsyncFunction";var wK=e=>(!e||!e.validate)&&!!(Wr(e.validate)&&e.validate.constructor.name===iE||lt(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===iE)),xK=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function sE(e,t,n){const r=te(e,n);if(r||Jw(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const s=i.join("."),o=te(t,s),a=te(e,s);if(o&&!Array.isArray(o)&&n!==s)return{name:n};if(a&&a.type)return{name:s,error:a};i.pop()}return{name:n}}var bK=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:(n?r.isOnChange:i.isOnChange)?e:!0,SK=(e,t)=>!fp(te(e,t)).length&&ft(e,t);const kK={mode:Jn.onSubmit,reValidateMode:Jn.onChange,shouldFocusError:!0};function EK(e={}){let t={...kK,...e},n={submitCount:0,isDirty:!1,isLoading:Wr(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},i=lt(t.defaultValues)||lt(t.values)?Yt(t.defaultValues||t.values)||{}:{},s=t.shouldUnregister?{}:Yt(i),o={action:!1,mount:!1,watch:!1},a={mount:new Set,unMount:new Set,array:new Set,watch:new Set},l,u=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},c={values:qm(),array:qm(),state:qm()},d=Qk(t.mode),h=Qk(t.reValidateMode),p=t.criteriaMode===Jn.all,m=$=>z=>{clearTimeout(u),u=setTimeout($,z)},w=async $=>{if(f.isValid||$){const z=t.resolver?Gt((await T()).errors):await A(r,!0);z!==n.isValid&&c.state.next({isValid:z})}},y=($,z)=>{(f.isValidating||f.validatingFields)&&(($||Array.from(a.mount)).forEach(H=>{H&&(z?Le(n.validatingFields,H,z):ft(n.validatingFields,H))}),c.state.next({validatingFields:n.validatingFields,isValidating:!Gt(n.validatingFields)}))},v=($,z=[],H,ne,ee=!0,X=!0)=>{if(ne&&H){if(o.action=!0,X&&Array.isArray(te(r,$))){const ae=H(te(r,$),ne.argA,ne.argB);ee&&Le(r,$,ae)}if(X&&Array.isArray(te(n.errors,$))){const ae=H(te(n.errors,$),ne.argA,ne.argB);ee&&Le(n.errors,$,ae),SK(n.errors,$)}if(f.touchedFields&&X&&Array.isArray(te(n.touchedFields,$))){const ae=H(te(n.touchedFields,$),ne.argA,ne.argB);ee&&Le(n.touchedFields,$,ae)}f.dirtyFields&&(n.dirtyFields=Qc(i,s)),c.state.next({name:$,isDirty:L($,z),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Le(s,$,z)},g=($,z)=>{Le(n.errors,$,z),c.state.next({errors:n.errors})},x=$=>{n.errors=$,c.state.next({errors:n.errors,isValid:!1})},S=($,z,H,ne)=>{const ee=te(r,$);if(ee){const X=te(s,$,Ze(H)?te(i,$):H);Ze(X)||ne&&ne.defaultChecked||z?Le(s,$,z?X:Gm(ee._f)):M($,X),o.mount&&w()}},k=($,z,H,ne,ee)=>{let X=!1,ae=!1;const xe={name:$},U=!!(te(r,$)&&te(r,$)._f&&te(r,$)._f.disabled);if(!H||ne){f.isDirty&&(ae=n.isDirty,n.isDirty=xe.isDirty=L(),X=ae!==xe.isDirty);const K=U||Ni(te(i,$),z);ae=!!(!U&&te(n.dirtyFields,$)),K||U?ft(n.dirtyFields,$):Le(n.dirtyFields,$,!0),xe.dirtyFields=n.dirtyFields,X=X||f.dirtyFields&&ae!==!K}if(H){const K=te(n.touchedFields,$);K||(Le(n.touchedFields,$,H),xe.touchedFields=n.touchedFields,X=X||f.touchedFields&&K!==H)}return X&&ee&&c.state.next(xe),X?xe:{}},C=($,z,H,ne)=>{const ee=te(n.errors,$),X=f.isValid&&Nn(z)&&n.isValid!==z;if(e.delayError&&H?(l=m(()=>g($,H)),l(e.delayError)):(clearTimeout(u),l=null,H?Le(n.errors,$,H):ft(n.errors,$)),(H?!Ni(ee,H):ee)||!Gt(ne)||X){const ae={...ne,...X&&Nn(z)?{isValid:z}:{},errors:n.errors,name:$};n={...n,...ae},c.state.next(ae)}},T=async $=>{y($,!0);const z=await t.resolver(s,t.context,vK($||a.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return y($),z},O=async $=>{const{errors:z}=await T($);if($)for(const H of $){const ne=te(z,H);ne?Le(n.errors,H,ne):ft(n.errors,H)}else n.errors=z;return z},A=async($,z,H={valid:!0})=>{for(const ne in $){const ee=$[ne];if(ee){const{_f:X,...ae}=ee;if(X){const xe=a.array.has(X.name),U=ee._f&&wK(ee._f);U&&f.validatingFields&&y([ne],!0);const K=await rE(ee,s,p,t.shouldUseNativeValidation&&!z,xe);if(U&&f.validatingFields&&y([ne]),K[X.name]&&(H.valid=!1,z))break;!z&&(te(K,X.name)?xe?pK(n.errors,K,X.name):Le(n.errors,X.name,K[X.name]):ft(n.errors,X.name))}!Gt(ae)&&await A(ae,z,H)}}return H.valid},j=()=>{for(const $ of a.unMount){const z=te(r,$);z&&(z._f.refs?z._f.refs.every(H=>!Ym(H)):!Ym(z._f.ref))&&Y($)}a.unMount=new Set},L=($,z)=>($&&z&&Le(s,$,z),!Ni(V(),i)),B=($,z,H)=>RO($,a,{...o.mount?s:Ze(z)?i:xr($)?{[$]:z}:z},H,z),N=$=>fp(te(o.mount?s:i,$,e.shouldUnregister?te(i,$,[]):[])),M=($,z,H={})=>{const ne=te(r,$);let ee=z;if(ne){const X=ne._f;X&&(!X.disabled&&Le(s,$,$O(z,X)),ee=Jd(X.ref)&&jt(z)?"":z,MO(X.ref)?[...X.ref.options].forEach(ae=>ae.selected=ee.includes(ae.value)):X.refs?hc(X.ref)?X.refs.length>1?X.refs.forEach(ae=>(!ae.defaultChecked||!ae.disabled)&&(ae.checked=Array.isArray(ee)?!!ee.find(xe=>xe===ae.value):ee===ae.value)):X.refs[0]&&(X.refs[0].checked=!!ee):X.refs.forEach(ae=>ae.checked=ae.value===ee):tx(X.ref)?X.ref.value="":(X.ref.value=ee,X.ref.type||c.values.next({name:$,values:{...s}})))}(H.shouldDirty||H.shouldTouch)&&k($,ee,H.shouldTouch,H.shouldDirty,!0),H.shouldValidate&&_($)},I=($,z,H)=>{for(const ne in z){const ee=z[ne],X=`${$}.${ne}`,ae=te(r,X);(a.array.has($)||!th(ee)||ae&&!ae._f)&&!$o(ee)?I(X,ee,H):M(X,ee,H)}},F=($,z,H={})=>{const ne=te(r,$),ee=a.array.has($),X=Yt(z);Le(s,$,X),ee?(c.array.next({name:$,values:{...s}}),(f.isDirty||f.dirtyFields)&&H.shouldDirty&&c.state.next({name:$,dirtyFields:Qc(i,s),isDirty:L($,X)})):ne&&!ne._f&&!jt(X)?I($,X,H):M($,X,H),Zk($,a)&&c.state.next({...n}),c.values.next({name:o.mount?$:void 0,values:{...s}})},P=async $=>{o.mount=!0;const z=$.target;let H=z.name,ne=!0;const ee=te(r,H),X=()=>z.type?Gm(ee._f):TO($),ae=xe=>{ne=Number.isNaN(xe)||Ni(xe,te(s,H,xe))};if(ee){let xe,U;const K=X(),ce=$.type===Zd.BLUR||$.type===Zd.FOCUS_OUT,ye=!xK(ee._f)&&!t.resolver&&!te(n.errors,H)&&!ee._f.deps||bK(ce,te(n.touchedFields,H),n.isSubmitted,h,d),_e=Zk(H,a,ce);Le(s,H,K),ce?(ee._f.onBlur&&ee._f.onBlur($),l&&l(0)):ee._f.onChange&&ee._f.onChange($);const yt=k(H,K,ce,!1),Un=!Gt(yt)||_e;if(!ce&&c.values.next({name:H,type:$.type,values:{...s}}),ye)return f.isValid&&(e.mode==="onBlur"?ce&&w():w()),Un&&c.state.next({name:H,..._e?{}:yt});if(!ce&&_e&&c.state.next({...n}),t.resolver){const{errors:Wt}=await T([H]);if(ae(K),ne){const Dr=sE(n.errors,r,H),hr=sE(Wt,r,Dr.name||H);xe=hr.error,H=hr.name,U=Gt(Wt)}}else y([H],!0),xe=(await rE(ee,s,p,t.shouldUseNativeValidation))[H],y([H]),ae(K),ne&&(xe?U=!1:f.isValid&&(U=await A(r,!0)));ne&&(ee._f.deps&&_(ee._f.deps),C(H,U,xe,yt))}},D=($,z)=>{if(te(n.errors,z)&&$.focus)return $.focus(),1},_=async($,z={})=>{let H,ne;const ee=Zl($);if(t.resolver){const X=await O(Ze($)?$:ee);H=Gt(X),ne=$?!ee.some(ae=>te(X,ae)):H}else $?(ne=(await Promise.all(ee.map(async X=>{const ae=te(r,X);return await A(ae&&ae._f?{[X]:ae}:ae)}))).every(Boolean),!(!ne&&!n.isValid)&&w()):ne=H=await A(r);return c.state.next({...!xr($)||f.isValid&&H!==n.isValid?{}:{name:$},...t.resolver||!$?{isValid:H}:{},errors:n.errors}),z.shouldFocus&&!ne&&Jl(r,D,$?ee:a.mount),ne},V=$=>{const z={...o.mount?s:i};return Ze($)?z:xr($)?te(z,$):$.map(H=>te(z,H))},W=($,z)=>({invalid:!!te((z||n).errors,$),isDirty:!!te((z||n).dirtyFields,$),error:te((z||n).errors,$),isValidating:!!te(n.validatingFields,$),isTouched:!!te((z||n).touchedFields,$)}),R=$=>{$&&Zl($).forEach(z=>ft(n.errors,z)),c.state.next({errors:$?n.errors:{}})},q=($,z,H)=>{const ne=(te(r,$,{_f:{}})._f||{}).ref,ee=te(n.errors,$)||{},{ref:X,message:ae,type:xe,...U}=ee;Le(n.errors,$,{...U,...z,ref:ne}),c.state.next({name:$,errors:n.errors,isValid:!1}),H&&H.shouldFocus&&ne&&ne.focus&&ne.focus()},J=($,z)=>Wr($)?c.values.subscribe({next:H=>$(B(void 0,z),H)}):B($,z,!0),Y=($,z={})=>{for(const H of $?Zl($):a.mount)a.mount.delete(H),a.array.delete(H),z.keepValue||(ft(r,H),ft(s,H)),!z.keepError&&ft(n.errors,H),!z.keepDirty&&ft(n.dirtyFields,H),!z.keepTouched&&ft(n.touchedFields,H),!z.keepIsValidating&&ft(n.validatingFields,H),!t.shouldUnregister&&!z.keepDefaultValue&&ft(i,H);c.values.next({values:{...s}}),c.state.next({...n,...z.keepDirty?{isDirty:L()}:{}}),!z.keepIsValid&&w()},re=({disabled:$,name:z,field:H,fields:ne,value:ee})=>{if(Nn($)&&o.mount||$){const X=$?void 0:Ze(ee)?Gm(H?H._f:te(ne,z)._f):ee;Le(s,z,X),k(z,X,!1,!1,!0)}},G=($,z={})=>{let H=te(r,$);const ne=Nn(z.disabled)||Nn(e.disabled);return Le(r,$,{...H||{},_f:{...H&&H._f?H._f:{ref:{name:$}},name:$,mount:!0,...z}}),a.mount.add($),H?re({field:H,disabled:Nn(z.disabled)?z.disabled:e.disabled,name:$,value:z.value}):S($,!0,z.value),{...ne?{disabled:z.disabled||e.disabled}:{},...t.progressive?{required:!!z.required,min:gl(z.min),max:gl(z.max),minLength:gl(z.minLength),maxLength:gl(z.maxLength),pattern:gl(z.pattern)}:{},name:$,onChange:P,onBlur:P,ref:ee=>{if(ee){G($,z),H=te(r,$);const X=Ze(ee.value)&&ee.querySelectorAll&&ee.querySelectorAll("input,select,textarea")[0]||ee,ae=yK(X),xe=H._f.refs||[];if(ae?xe.find(U=>U===X):X===H._f.ref)return;Le(r,$,{_f:{...H._f,...ae?{refs:[...xe.filter(Ym),X,...Array.isArray(te(i,$))?[{}]:[]],ref:{type:X.type,name:$}}:{ref:X}}}),S($,!1,void 0,X)}else H=te(r,$,{}),H._f&&(H._f.mount=!1),(t.shouldUnregister||z.shouldUnregister)&&!(_O(a.array,$)&&o.action)&&a.unMount.add($)}}},le=()=>t.shouldFocusError&&Jl(r,D,a.mount),de=$=>{Nn($)&&(c.state.next({disabled:$}),Jl(r,(z,H)=>{const ne=te(r,H);ne&&(z.disabled=ne._f.disabled||$,Array.isArray(ne._f.refs)&&ne._f.refs.forEach(ee=>{ee.disabled=ne._f.disabled||$}))},0,!1))},ue=($,z)=>async H=>{let ne;H&&(H.preventDefault&&H.preventDefault(),H.persist&&H.persist());let ee=Yt(s);if(c.state.next({isSubmitting:!0}),t.resolver){const{errors:X,values:ae}=await T();n.errors=X,ee=ae}else await A(r);if(ft(n.errors,"root"),Gt(n.errors)){c.state.next({errors:{}});try{await $(ee,H)}catch(X){ne=X}}else z&&await z({...n.errors},H),le(),setTimeout(le);if(c.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Gt(n.errors)&&!ne,submitCount:n.submitCount+1,errors:n.errors}),ne)throw ne},ie=($,z={})=>{te(r,$)&&(Ze(z.defaultValue)?F($,Yt(te(i,$))):(F($,z.defaultValue),Le(i,$,Yt(z.defaultValue))),z.keepTouched||ft(n.touchedFields,$),z.keepDirty||(ft(n.dirtyFields,$),n.isDirty=z.defaultValue?L($,Yt(te(i,$))):L()),z.keepError||(ft(n.errors,$),f.isValid&&w()),c.state.next({...n}))},pe=($,z={})=>{const H=$?Yt($):i,ne=Yt(H),ee=Gt($),X=ee?i:ne;if(z.keepDefaultValues||(i=H),!z.keepValues){if(z.keepDirtyValues)for(const ae of a.mount)te(n.dirtyFields,ae)?Le(X,ae,te(s,ae)):F(ae,te(X,ae));else{if(Zw&&Ze($))for(const ae of a.mount){const xe=te(r,ae);if(xe&&xe._f){const U=Array.isArray(xe._f.refs)?xe._f.refs[0]:xe._f.ref;if(Jd(U)){const K=U.closest("form");if(K){K.reset();break}}}}r={}}s=e.shouldUnregister?z.keepDefaultValues?Yt(i):{}:Yt(X),c.array.next({values:{...X}}),c.values.next({values:{...X}})}a={mount:z.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!f.isValid||!!z.keepIsValid||!!z.keepDirtyValues,o.watch=!!e.shouldUnregister,c.state.next({submitCount:z.keepSubmitCount?n.submitCount:0,isDirty:ee?!1:z.keepDirty?n.isDirty:!!(z.keepDefaultValues&&!Ni($,i)),isSubmitted:z.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:ee?{}:z.keepDirtyValues?z.keepDefaultValues&&s?Qc(i,s):n.dirtyFields:z.keepDefaultValues&&$?Qc(i,$):z.keepDirty?n.dirtyFields:{},touchedFields:z.keepTouched?n.touchedFields:{},errors:z.keepErrors?n.errors:{},isSubmitSuccessful:z.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},Ne=($,z)=>pe(Wr($)?$(s):$,z);return{control:{register:G,unregister:Y,getFieldState:W,handleSubmit:ue,setError:q,_executeSchema:T,_getWatch:B,_getDirty:L,_updateValid:w,_removeUnmounted:j,_updateFieldArray:v,_updateDisabledField:re,_getFieldArray:N,_reset:pe,_resetDefaultValues:()=>Wr(t.defaultValues)&&t.defaultValues().then($=>{Ne($,t.resetOptions),c.state.next({isLoading:!1})}),_updateFormState:$=>{n={...n,...$}},_disableForm:de,_subjects:c,_proxyFormState:f,_setErrors:x,get _fields(){return r},get _formValues(){return s},get _state(){return o},set _state($){o=$},get _defaultValues(){return i},get _names(){return a},set _names($){a=$},get _formState(){return n},set _formState($){n=$},get _options(){return t},set _options($){t={...t,...$}}},trigger:_,register:G,handleSubmit:ue,watch:J,setValue:F,getValues:V,reset:Ne,resetField:ie,clearErrors:R,unregister:Y,setError:q,setFocus:($,z={})=>{const H=te(r,$),ne=H&&H._f;if(ne){const ee=ne.refs?ne.refs[0]:ne.ref;ee.focus&&(ee.focus(),z.shouldSelect&&ee.select())}},getFieldState:W}}function CK(e={}){const t=we.useRef(),n=we.useRef(),[r,i]=we.useState({isDirty:!1,isValidating:!1,isLoading:Wr(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:Wr(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...EK(e),formState:r});const s=t.current.control;return s._options=e,ex({subject:s._subjects.state,next:o=>{OO(o,s._proxyFormState,s._updateFormState,!0)&&i({...s._formState})}}),we.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),we.useEffect(()=>{if(s._proxyFormState.isDirty){const o=s._getDirty();o!==r.isDirty&&s._subjects.state.next({isDirty:o})}},[s,r.isDirty]),we.useEffect(()=>{e.values&&!Ni(e.values,n.current)?(s._reset(e.values,s._options.resetOptions),n.current=e.values,i(o=>({...o}))):s._resetDefaultValues()},[e.values,s]),we.useEffect(()=>{e.errors&&s._setErrors(e.errors)},[e.errors,s]),we.useEffect(()=>{s._state.mount||(s._updateValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),we.useEffect(()=>{e.shouldUnregister&&s._subjects.values.next({values:s._getWatch()})},[e.shouldUnregister,s]),t.current.formState=PO(r,s),t.current}function TK({title:e,titleId:t,...n},r){return E.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?E.createElement("title",{id:t},e):null,E.createElement("path",{d:"M8.25 4.5a3.75 3.75 0 1 1 7.5 0v8.25a3.75 3.75 0 1 1-7.5 0V4.5Z"}),E.createElement("path",{d:"M6 10.5a.75.75 0 0 1 .75.75v1.5a5.25 5.25 0 1 0 10.5 0v-1.5a.75.75 0 0 1 1.5 0v1.5a6.751 6.751 0 0 1-6 6.709v2.291h3a.75.75 0 0 1 0 1.5h-7.5a.75.75 0 0 1 0-1.5h3v-2.291a6.751 6.751 0 0 1-6-6.709v-1.5A.75.75 0 0 1 6 10.5Z"}))}const _K=E.forwardRef(TK),BO=E.forwardRef(({className:e,...t},n)=>b.jsx("div",{ref:n,className:nt("rounded-lg border border-neutral-200 bg-white text-neutral-950 shadow-sm dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50",e),...t}));BO.displayName="Card";const VO=E.forwardRef(({className:e,...t},n)=>b.jsx("div",{ref:n,className:nt("flex flex-col space-y-1.5 p-6",e),...t}));VO.displayName="CardHeader";const zO=E.forwardRef(({className:e,...t},n)=>b.jsx("h3",{ref:n,className:nt("text-2xl font-semibold leading-none tracking-tight",e),...t}));zO.displayName="CardTitle";const AK=E.forwardRef(({className:e,...t},n)=>b.jsx("p",{ref:n,className:nt("text-sm text-neutral-500 dark:text-neutral-400",e),...t}));AK.displayName="CardDescription";const UO=E.forwardRef(({className:e,...t},n)=>b.jsx("div",{ref:n,className:nt("p-6 pt-0",e),...t}));UO.displayName="CardContent";const HO=E.forwardRef(({className:e,...t},n)=>b.jsx("div",{ref:n,className:nt("flex items-center p-6 pt-0",e),...t}));HO.displayName="CardFooter";function WO(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;ttypeof e=="boolean"?"".concat(e):e===0?"0":e,aE=NK,KO=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return aE(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:s}=t,o=Object.keys(i).map(u=>{const f=n==null?void 0:n[u],c=s==null?void 0:s[u];if(f===null)return null;const d=oE(f)||oE(c);return i[u][d]}),a=n&&Object.entries(n).reduce((u,f)=>{let[c,d]=f;return d===void 0||(u[c]=d),u},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,f)=>{let{class:c,className:d,...h}=f;return Object.entries(h).every(p=>{let[m,w]=p;return Array.isArray(w)?w.includes({...s,...a}[m]):{...s,...a}[m]===w})?[...u,c,d]:u},[]);return aE(e,o,l,n==null?void 0:n.class,n==null?void 0:n.className)},PK=KO("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-neutral-950 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 dark:ring-offset-neutral-950 dark:focus-visible:ring-neutral-300",{variants:{variant:{default:"bg-neutral-900 text-neutral-50 hover:bg-neutral-900/90 dark:bg-neutral-50 dark:text-neutral-900 dark:hover:bg-neutral-50/90",destructive:"bg-red-500 text-neutral-50 hover:bg-red-500/90 dark:bg-red-900 dark:text-neutral-50 dark:hover:bg-red-900/90",outline:"border border-neutral-200 bg-white hover:bg-neutral-100 hover:text-neutral-900 dark:border-neutral-800 dark:bg-neutral-950 dark:hover:bg-neutral-800 dark:hover:text-neutral-50",secondary:"bg-neutral-100 text-neutral-900 hover:bg-neutral-100/80 dark:bg-neutral-800 dark:text-neutral-50 dark:hover:bg-neutral-800/80",ghost:"hover:bg-neutral-100 hover:text-neutral-900 dark:hover:bg-neutral-800 dark:hover:text-neutral-50",link:"text-neutral-900 underline-offset-4 hover:underline dark:text-neutral-50"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),ta=E.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},s)=>{const o=r?cc:"button";return b.jsx(o,{className:nt(PK({variant:t,size:n,className:e})),ref:s,...i})});ta.displayName="Button";var Xm="focusScope.autoFocusOnMount",Qm="focusScope.autoFocusOnUnmount",lE={bubbles:!1,cancelable:!0},OK="FocusScope",qO=E.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=e,[a,l]=E.useState(null),u=Qi(i),f=Qi(s),c=E.useRef(null),d=ur(t,m=>l(m)),h=E.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;E.useEffect(()=>{if(r){let m=function(g){if(h.paused||!a)return;const x=g.target;a.contains(x)?c.current=x:ki(c.current,{select:!0})},w=function(g){if(h.paused||!a)return;const x=g.relatedTarget;x!==null&&(a.contains(x)||ki(c.current,{select:!0}))},y=function(g){if(document.activeElement===document.body)for(const S of g)S.removedNodes.length>0&&ki(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",w);const v=new MutationObserver(y);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",w),v.disconnect()}}},[r,a,h.paused]),E.useEffect(()=>{if(a){cE.add(h);const m=document.activeElement;if(!a.contains(m)){const y=new CustomEvent(Xm,lE);a.addEventListener(Xm,u),a.dispatchEvent(y),y.defaultPrevented||(LK(jK(YO(a)),{select:!0}),document.activeElement===m&&ki(a))}return()=>{a.removeEventListener(Xm,u),setTimeout(()=>{const y=new CustomEvent(Qm,lE);a.addEventListener(Qm,f),a.dispatchEvent(y),y.defaultPrevented||ki(m??document.body,{select:!0}),a.removeEventListener(Qm,f),cE.remove(h)},0)}}},[a,u,f,h]);const p=E.useCallback(m=>{if(!n&&!r||h.paused)return;const w=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,y=document.activeElement;if(w&&y){const v=m.currentTarget,[g,x]=RK(v);g&&x?!m.shiftKey&&y===x?(m.preventDefault(),n&&ki(g,{select:!0})):m.shiftKey&&y===g&&(m.preventDefault(),n&&ki(x,{select:!0})):y===v&&m.preventDefault()}},[n,r,h.paused]);return b.jsx(Ut.div,{tabIndex:-1,...o,ref:d,onKeyDown:p})});qO.displayName=OK;function LK(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(ki(r,{select:t}),document.activeElement!==n)return}function RK(e){const t=YO(e),n=uE(t,e),r=uE(t.reverse(),e);return[n,r]}function YO(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function uE(e,t){for(const n of e)if(!IK(n,{upTo:t}))return n}function IK(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function DK(e){return e instanceof HTMLInputElement&&"select"in e}function ki(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&DK(e)&&t&&e.select()}}var cE=MK();function MK(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=fE(e,t),e.unshift(t)},remove(t){var n;e=fE(e,t),(n=e[0])==null||n.resume()}}}function fE(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function jK(e){return e.filter(t=>t.tagName!=="A")}var Zm=0;function FK(){E.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??dE()),document.body.insertAdjacentElement("beforeend",e[1]??dE()),Zm++,()=>{Zm===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Zm--}},[])}function dE(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}var wr=function(){return wr=Object.assign||function(t){for(var n,r=1,i=arguments.length;r"u")return tq;var t=nq(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},iq=ZO(),na="data-scroll-locked",sq=function(e,t,n,r){var i=e.left,s=e.top,o=e.right,a=e.gap;return n===void 0&&(n="margin"),` .`.concat(BK,` { overflow: hidden `).concat(r,`; padding-right: `).concat(a,"px ").concat(r,`; } body[`).concat(na,`] { overflow: hidden `).concat(r,`; overscroll-behavior: contain; `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&` padding-left: `.concat(i,`px; padding-top: `).concat(s,`px; padding-right: `).concat(o,`px; margin-left:0; margin-top:0; margin-right: `).concat(a,"px ").concat(r,`; `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),` } .`).concat(Hf,` { right: `).concat(a,"px ").concat(r,`; } .`).concat(Wf,` { margin-right: `).concat(a,"px ").concat(r,`; } .`).concat(Hf," .").concat(Hf,` { right: 0 `).concat(r,`; } .`).concat(Wf," .").concat(Wf,` { margin-right: 0 `).concat(r,`; } body[`).concat(na,`] { `).concat(VK,": ").concat(a,`px; } `)},pE=function(){var e=parseInt(document.body.getAttribute(na)||"0",10);return isFinite(e)?e:0},oq=function(){E.useEffect(function(){return document.body.setAttribute(na,(pE()+1).toString()),function(){var e=pE()-1;e<=0?document.body.removeAttribute(na):document.body.setAttribute(na,e.toString())}},[])},aq=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;oq();var s=E.useMemo(function(){return rq(i)},[i]);return E.createElement(iq,{styles:sq(s,!t,i,n?"":"!important")})},w0=!1;if(typeof window<"u")try{var Zc=Object.defineProperty({},"passive",{get:function(){return w0=!0,!0}});window.addEventListener("test",Zc,Zc),window.removeEventListener("test",Zc,Zc)}catch{w0=!1}var uo=w0?{passive:!1}:!1,lq=function(e){return e.tagName==="TEXTAREA"},JO=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!lq(e)&&n[t]==="visible")},uq=function(e){return JO(e,"overflowY")},cq=function(e){return JO(e,"overflowX")},mE=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=eL(e,r);if(i){var s=tL(e,r),o=s[1],a=s[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},fq=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},dq=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},eL=function(e,t){return e==="v"?uq(t):cq(t)},tL=function(e,t){return e==="v"?fq(t):dq(t)},hq=function(e,t){return e==="h"&&t==="rtl"?-1:1},pq=function(e,t,n,r,i){var s=hq(e,window.getComputedStyle(t).direction),o=s*r,a=n.target,l=t.contains(a),u=!1,f=o>0,c=0,d=0;do{var h=tL(e,a),p=h[0],m=h[1],w=h[2],y=m-w-s*p;(p||y)&&eL(e,a)&&(c+=y,d+=p),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(f&&(Math.abs(c)<1||!i)||!f&&(Math.abs(d)<1||!i))&&(u=!0),u},Jc=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},gE=function(e){return[e.deltaX,e.deltaY]},yE=function(e){return e&&"current"in e?e.current:e},mq=function(e,t){return e[0]===t[0]&&e[1]===t[1]},gq=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} `)},yq=0,co=[];function vq(e){var t=E.useRef([]),n=E.useRef([0,0]),r=E.useRef(),i=E.useState(yq++)[0],s=E.useState(ZO)[0],o=E.useRef(e);E.useEffect(function(){o.current=e},[e]),E.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var m=$K([e.lockRef.current],(e.shards||[]).map(yE),!0).filter(Boolean);return m.forEach(function(w){return w.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),m.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=E.useCallback(function(m,w){if("touches"in m&&m.touches.length===2)return!o.current.allowPinchZoom;var y=Jc(m),v=n.current,g="deltaX"in m?m.deltaX:v[0]-y[0],x="deltaY"in m?m.deltaY:v[1]-y[1],S,k=m.target,C=Math.abs(g)>Math.abs(x)?"h":"v";if("touches"in m&&C==="h"&&k.type==="range")return!1;var T=mE(C,k);if(!T)return!0;if(T?S=C:(S=C==="v"?"h":"v",T=mE(C,k)),!T)return!1;if(!r.current&&"changedTouches"in m&&(g||x)&&(r.current=S),!S)return!0;var O=r.current||S;return pq(O,w,m,O==="h"?g:x,!0)},[]),l=E.useCallback(function(m){var w=m;if(!(!co.length||co[co.length-1]!==s)){var y="deltaY"in w?gE(w):Jc(w),v=t.current.filter(function(S){return S.name===w.type&&(S.target===w.target||w.target===S.shadowParent)&&mq(S.delta,y)})[0];if(v&&v.should){w.cancelable&&w.preventDefault();return}if(!v){var g=(o.current.shards||[]).map(yE).filter(Boolean).filter(function(S){return S.contains(w.target)}),x=g.length>0?a(w,g[0]):!o.current.noIsolation;x&&w.cancelable&&w.preventDefault()}}},[]),u=E.useCallback(function(m,w,y,v){var g={name:m,delta:w,target:y,should:v,shadowParent:wq(y)};t.current.push(g),setTimeout(function(){t.current=t.current.filter(function(x){return x!==g})},1)},[]),f=E.useCallback(function(m){n.current=Jc(m),r.current=void 0},[]),c=E.useCallback(function(m){u(m.type,gE(m),m.target,a(m,e.lockRef.current))},[]),d=E.useCallback(function(m){u(m.type,Jc(m),m.target,a(m,e.lockRef.current))},[]);E.useEffect(function(){return co.push(s),e.setCallbacks({onScrollCapture:c,onWheelCapture:c,onTouchMoveCapture:d}),document.addEventListener("wheel",l,uo),document.addEventListener("touchmove",l,uo),document.addEventListener("touchstart",f,uo),function(){co=co.filter(function(m){return m!==s}),document.removeEventListener("wheel",l,uo),document.removeEventListener("touchmove",l,uo),document.removeEventListener("touchstart",f,uo)}},[]);var h=e.removeScrollBar,p=e.inert;return E.createElement(E.Fragment,null,p?E.createElement(s,{styles:gq(i)}):null,h?E.createElement(aq,{gapMode:e.gapMode}):null)}function wq(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const xq=YK(QO,vq);var nL=E.forwardRef(function(e,t){return E.createElement(hp,wr({},e,{ref:t,sideCar:xq}))});nL.classNames=hp.classNames;var bq=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},fo=new WeakMap,ef=new WeakMap,tf={},ng=0,rL=function(e){return e&&(e.host||rL(e.parentNode))},Sq=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=rL(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},kq=function(e,t,n,r){var i=Sq(t,Array.isArray(e)?e:[e]);tf[n]||(tf[n]=new WeakMap);var s=tf[n],o=[],a=new Set,l=new Set(i),u=function(c){!c||a.has(c)||(a.add(c),u(c.parentNode))};i.forEach(u);var f=function(c){!c||l.has(c)||Array.prototype.forEach.call(c.children,function(d){if(a.has(d))f(d);else try{var h=d.getAttribute(r),p=h!==null&&h!=="false",m=(fo.get(d)||0)+1,w=(s.get(d)||0)+1;fo.set(d,m),s.set(d,w),o.push(d),m===1&&p&&ef.set(d,!0),w===1&&d.setAttribute(n,"true"),p||d.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",d,y)}})};return f(t),a.clear(),ng++,function(){o.forEach(function(c){var d=fo.get(c)-1,h=s.get(c)-1;fo.set(c,d),s.set(c,h),d||(ef.has(c)||c.removeAttribute(r),ef.delete(c)),h||c.removeAttribute(n)}),ng--,ng||(fo=new WeakMap,fo=new WeakMap,ef=new WeakMap,tf={})}},Eq=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=bq(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),kq(r,i,n,"aria-hidden")):function(){return null}},rx="Dialog",[iL,npe]=Bw(rx),[Cq,cr]=iL(rx),sL=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!0}=e,a=E.useRef(null),l=E.useRef(null),[u=!1,f]=uO({prop:r,defaultProp:i,onChange:s});return b.jsx(Cq,{scope:t,triggerRef:a,contentRef:l,contentId:Vf(),titleId:Vf(),descriptionId:Vf(),open:u,onOpenChange:f,onOpenToggle:E.useCallback(()=>f(c=>!c),[f]),modal:o,children:n})};sL.displayName=rx;var oL="DialogTrigger",aL=E.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=cr(oL,n),s=ur(t,i.triggerRef);return b.jsx(Ut.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":ox(i.open),...r,ref:s,onClick:Qt(e.onClick,i.onOpenToggle)})});aL.displayName=oL;var ix="DialogPortal",[Tq,lL]=iL(ix,{forceMount:void 0}),uL=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:i}=e,s=cr(ix,t);return b.jsx(Tq,{scope:t,forceMount:n,children:E.Children.map(r,o=>b.jsx(dc,{present:n||s.open,children:b.jsx(lO,{asChild:!0,container:i,children:o})}))})};uL.displayName=ix;var rh="DialogOverlay",cL=E.forwardRef((e,t)=>{const n=lL(rh,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,s=cr(rh,e.__scopeDialog);return s.modal?b.jsx(dc,{present:r||s.open,children:b.jsx(_q,{...i,ref:t})}):null});cL.displayName=rh;var _q=E.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=cr(rh,n);return b.jsx(nL,{as:cc,allowPinchZoom:!0,shards:[i.contentRef],children:b.jsx(Ut.div,{"data-state":ox(i.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Ys="DialogContent",fL=E.forwardRef((e,t)=>{const n=lL(Ys,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,s=cr(Ys,e.__scopeDialog);return b.jsx(dc,{present:r||s.open,children:s.modal?b.jsx(Aq,{...i,ref:t}):b.jsx(Nq,{...i,ref:t})})});fL.displayName=Ys;var Aq=E.forwardRef((e,t)=>{const n=cr(Ys,e.__scopeDialog),r=E.useRef(null),i=ur(t,n.contentRef,r);return E.useEffect(()=>{const s=r.current;if(s)return Eq(s)},[]),b.jsx(dL,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Qt(e.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Qt(e.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:Qt(e.onFocusOutside,s=>s.preventDefault())})}),Nq=E.forwardRef((e,t)=>{const n=cr(Ys,e.__scopeDialog),r=E.useRef(!1),i=E.useRef(!1);return b.jsx(dL,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=e.onCloseAutoFocus)==null||o.call(e,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,u;(l=e.onInteractOutside)==null||l.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),dL=E.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=e,a=cr(Ys,n),l=E.useRef(null),u=ur(t,l);return FK(),b.jsxs(b.Fragment,{children:[b.jsx(qO,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:b.jsx(Vw,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":ox(a.open),...o,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),b.jsxs(b.Fragment,{children:[b.jsx(Pq,{titleId:a.titleId}),b.jsx(Lq,{contentRef:l,descriptionId:a.descriptionId})]})]})}),sx="DialogTitle",hL=E.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=cr(sx,n);return b.jsx(Ut.h2,{id:i.titleId,...r,ref:t})});hL.displayName=sx;var pL="DialogDescription",mL=E.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=cr(pL,n);return b.jsx(Ut.p,{id:i.descriptionId,...r,ref:t})});mL.displayName=pL;var gL="DialogClose",yL=E.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=cr(gL,n);return b.jsx(Ut.button,{type:"button",...r,ref:t,onClick:Qt(e.onClick,()=>i.onOpenChange(!1))})});yL.displayName=gL;function ox(e){return e?"open":"closed"}var vL="DialogTitleWarning",[rpe,wL]=AH(vL,{contentName:Ys,titleName:sx,docsSlug:"dialog"}),Pq=({titleId:e})=>{const t=wL(vL),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return E.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Oq="DialogDescriptionWarning",Lq=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${wL(Oq).contentName}}.`;return E.useEffect(()=>{var s;const i=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Rq=sL,Iq=aL,Dq=uL,xL=cL,bL=fL,SL=hL,kL=mL,EL=yL;/** * @license lucide-react v0.439.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mq=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),CL=(...e)=>e.filter((t,n,r)=>!!t&&r.indexOf(t)===n).join(" ");/** * @license lucide-react v0.439.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var jq={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.439.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fq=E.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...a},l)=>E.createElement("svg",{ref:l,...jq,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:CL("lucide",i),...a},[...o.map(([u,f])=>E.createElement(u,f)),...Array.isArray(s)?s:[s]]));/** * @license lucide-react v0.439.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TL=(e,t)=>{const n=E.forwardRef(({className:r,...i},s)=>E.createElement(Fq,{ref:s,iconNode:t,className:CL(`lucide-${Mq(e)}`,r),...i}));return n.displayName=`${e}`,n};/** * @license lucide-react v0.439.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $q=TL("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** * @license lucide-react v0.439.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bq=TL("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),_L=Rq,AL=Iq,Vq=Dq,zq=EL,NL=E.forwardRef(({className:e,...t},n)=>b.jsx(xL,{ref:n,className:nt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));NL.displayName=xL.displayName;const ax=E.forwardRef(({className:e,children:t,...n},r)=>b.jsxs(Vq,{children:[b.jsx(NL,{}),b.jsxs(bL,{ref:r,className:nt("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-neutral-200 bg-white p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg dark:border-neutral-800 dark:bg-neutral-950",e),...n,children:[t,b.jsxs(EL,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-neutral-950 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-neutral-100 data-[state=open]:text-neutral-500 dark:ring-offset-neutral-950 dark:focus:ring-neutral-300 dark:data-[state=open]:bg-neutral-800 dark:data-[state=open]:text-neutral-400",children:[b.jsx(Bq,{className:"h-4 w-4"}),b.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ax.displayName=bL.displayName;const lx=({className:e,...t})=>b.jsx("div",{className:nt("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});lx.displayName="DialogHeader";const ux=({className:e,...t})=>b.jsx("div",{className:nt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});ux.displayName="DialogFooter";const cx=E.forwardRef(({className:e,...t},n)=>b.jsx(SL,{ref:n,className:nt("text-lg font-semibold leading-none tracking-tight",e),...t}));cx.displayName=SL.displayName;const fx=E.forwardRef(({className:e,...t},n)=>b.jsx(kL,{ref:n,className:nt("text-sm text-neutral-500 dark:text-neutral-400",e),...t}));fx.displayName=kL.displayName;var Uq="Label",PL=E.forwardRef((e,t)=>b.jsx(Ut.label,{...e,ref:t,onMouseDown:n=>{var i;n.target.closest("button, input, select, textarea")||((i=e.onMouseDown)==null||i.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));PL.displayName=Uq;var OL=PL;const Hq=KO("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),LL=E.forwardRef(({className:e,...t},n)=>b.jsx(OL,{ref:n,className:nt(Hq(),e),...t}));LL.displayName=OL.displayName;const Wq=lK,RL=E.createContext({}),rg=({...e})=>b.jsx(RL.Provider,{value:{name:e.name},children:b.jsx(dK,{...e})}),pp=()=>{const e=E.useContext(RL),t=E.useContext(IL),{getFieldState:n,formState:r}=dp(),i=n(e.name,r);if(!e)throw new Error("useFormField should be used within ");const{id:s}=t;return{id:s,name:e.name,formItemId:`${s}-form-item`,formDescriptionId:`${s}-form-item-description`,formMessageId:`${s}-form-item-message`,...i}},IL=E.createContext({}),Kf=E.forwardRef(({className:e,...t},n)=>{const r=E.useId();return b.jsx(IL.Provider,{value:{id:r},children:b.jsx("div",{ref:n,className:nt("space-y-2",e),...t})})});Kf.displayName="FormItem";const qf=E.forwardRef(({className:e,...t},n)=>{const{error:r,formItemId:i}=pp();return b.jsx(LL,{ref:n,className:nt(r&&"text-red-500 dark:text-red-900",e),htmlFor:i,...t})});qf.displayName="FormLabel";const Yf=E.forwardRef(({...e},t)=>{const{error:n,formItemId:r,formDescriptionId:i,formMessageId:s}=pp();return b.jsx(cc,{ref:t,id:r,"aria-describedby":n?`${i} ${s}`:`${i}`,"aria-invalid":!!n,...e})});Yf.displayName="FormControl";const x0=E.forwardRef(({className:e,...t},n)=>{const{formDescriptionId:r}=pp();return b.jsx("p",{ref:n,id:r,className:nt("text-sm text-neutral-500 dark:text-neutral-400",e),...t})});x0.displayName="FormDescription";const Gf=E.forwardRef(({className:e,children:t,...n},r)=>{const{error:i,formMessageId:s}=pp(),o=i?String(i==null?void 0:i.message):t;return o?b.jsx("p",{ref:r,id:s,className:nt("text-sm font-medium text-red-500 dark:text-red-900",e),...n,children:o}):null});Gf.displayName="FormMessage";const b0=E.forwardRef(({className:e,type:t,...n},r)=>b.jsx("input",{type:t,className:nt("flex h-10 w-full rounded-md border border-neutral-200 bg-white px-3 py-2 text-sm ring-offset-white file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-neutral-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-neutral-950 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 dark:border-neutral-800 dark:bg-neutral-950 dark:ring-offset-neutral-950 dark:placeholder:text-neutral-400 dark:focus-visible:ring-neutral-300",e),ref:r,...n}));b0.displayName="Input";const DL=E.forwardRef(({className:e,...t},n)=>b.jsx("textarea",{className:nt("flex min-h-[80px] w-full rounded-md border border-neutral-200 bg-white px-3 py-2 text-sm ring-offset-white placeholder:text-neutral-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-neutral-950 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 dark:border-neutral-800 dark:bg-neutral-950 dark:ring-offset-neutral-950 dark:placeholder:text-neutral-400 dark:focus-visible:ring-neutral-300",e),ref:n,...t}));DL.displayName="Textarea";const Kq=()=>{const e="http://localhost:4200/api",[t,n]=E.useState([]),[r,i]=E.useState(""),s=w2(),[o,a]=E.useState(!1),[l,u]=E.useState(null),f=E.useRef(null),c=E.useRef([]),d=CK({defaultValues:{project:"",description:"",aesthetics:""}});E.useEffect(()=>{(async()=>{try{const k=await(await fetch(`${e}/projects/list`)).json();n(k.projects)}catch(S){console.error("Failed to fetch projects:",S)}})()},[]);const h=x=>x.toString().toLowerCase().replace(/\s+/g,"-").replace(/[^\w\-]+/g,"").replace(/\-\-+/g,"-").replace(/^-+/,"").replace(/-+$/,""),p=async x=>{try{const k=await(await fetch(`${e}/projects/new`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)})).json();s(`/project/${k.project}`)}catch(S){console.error("Failed to create new project:",S)}},m=async({project:x})=>{try{const k=await(await fetch(`${e}/project/resume`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:x})})).json();s(`/project/${x}`)}catch(S){console.error("Failed to resume project:",S)}},w=async()=>{o?g():y()},y=async()=>{try{const x=await navigator.mediaDevices.getUserMedia({audio:!0});f.current=new MediaRecorder(x,{mimeType:"audio/webm;codecs=opus"}),c.current=[],f.current.ondataavailable=S=>{S.data.size>0&&c.current.push(S.data)},f.current.onstop=async()=>{const S=new Blob(c.current,{type:"audio/webm;codecs=opus"});u(S);const k=new FileReader;k.onloadend=async()=>{const C=k.result,T=await v(C);T&&d.setValue("description",T)},k.readAsDataURL(S)},f.current.start(),a(!0)}catch(x){console.error("Error starting recording:",x)}},v=async x=>{try{const S=await fetch(`${e}/utils/transcribe`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({audio:x})});if(!S.ok)throw new Error("Transcription failed");return(await S.json()).transcript}catch(S){return console.error("Error transcribing audio:",S),null}},g=()=>{f.current&&o&&(f.current.stop(),a(!1),f.current.stream&&f.current.stream.getTracks().forEach(x=>x.stop()),f.current=null)};return b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"flex justify-between items-center mb-6 dark",children:[b.jsx("h1",{className:"text-xl",children:"Projects"}),b.jsxs(_L,{children:[b.jsx(AL,{asChild:!0,children:b.jsx(ta,{variant:"secondary",className:"font-normal",children:"+ New Project"})}),b.jsxs(ax,{className:`font-light text-white bg-[#222] backdrop-blur-md\r border-[#222] min-w-[50vw] min-h-[65vh] max-h-[90vh] overflow-auto p-8`,children:[b.jsxs(lx,{children:[b.jsx(cx,{className:"font-normal text-xl",children:"New Project"}),b.jsx(fx,{className:"text-base text-[#ccc]",children:"Enter details for your new app project"})]}),b.jsx(Wq,{...d,children:b.jsxs("form",{onSubmit:d.handleSubmit(p),className:"flex flex-col gap-4 py-4",children:[b.jsx(rg,{control:d.control,name:"project",render:({field:x})=>b.jsxs(Kf,{children:[b.jsx(qf,{className:"font-light text-base",children:"Project"}),b.jsx(Yf,{children:b.jsx(b0,{...x,onChange:S=>{x.onChange(S),i(h(S.target.value))},className:"flex-grow bg-[#2a2a2a] border-[#333] text-base"})}),b.jsx(x0,{className:"text-[#aaa] text-sm",children:r&&`id : ${r}`||"only use a-z/0-9/hypens"}),b.jsx(Gf,{})]})}),b.jsx(rg,{control:d.control,name:"description",render:({field:x})=>b.jsxs(Kf,{className:"border-t border-[#333] pt-4",children:[b.jsxs(qf,{className:"font-light text-base",children:["Description ",b.jsx("span",{className:"opacity-50",children:"(required)"})]}),b.jsx(Yf,{children:b.jsxs("div",{className:"relative",children:[b.jsx(DL,{...x,className:"flex-grow bg-[#2a2a2a] border-[#333] text-base font-light pr-10",placeholder:"describe your app to the best extent you can",rows:4}),b.jsx(u0.button,{type:"button",onClick:w,className:"absolute right-4 bottom-4 text-[#aaa] hover:text-white",whileHover:{scale:1.1},whileTap:{scale:.9},children:b.jsx("div",{className:"p-2 bg-[#111] hover:bg-green-800 rounded opacity-80",children:b.jsx(_K,{className:`h-4 w-4 ${o?"text-red-500":""}`})})})]})}),b.jsx(Gf,{})]})}),b.jsx(rg,{control:d.control,name:"aesthetics",render:({field:x})=>b.jsxs(Kf,{className:"border-t border-[#333] pt-4",children:[b.jsxs(qf,{className:"font-light text-base",children:["Aesthetics ",b.jsx("span",{className:"opacity-50",children:"(optional)"})]}),b.jsx(Yf,{children:b.jsx(b0,{...x,className:"flex-grow bg-[#2a2a2a] border-[#333] text-base",placeholder:"light theme with blue as primary"})}),b.jsx(x0,{className:"text-[#aaa] text-sm",children:"the desired overall visual style of your app"}),b.jsx(Gf,{})]})}),b.jsx(ux,{className:"mt-4 dark",children:b.jsx(ta,{type:"submit",variant:"outline",className:"font-normal",children:"Create Project"})})]})})]})]})]}),b.jsx("div",{className:"mt-4 pt-4 border-t border-[#222] grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:t.map(x=>b.jsx(Kl,{to:`/project/${x.id}`,children:b.jsx(u0.div,{whileHover:{x:5,transition:{duration:.2}},whileTap:{scale:.95},children:b.jsxs(BO,{className:"h-full hover:shadow-lg transition-shadow duration-300 bg-[#1a1a1a] border-[#333333] group/card",children:[b.jsx(VO,{children:b.jsx(zO,{className:"text-xl font-semibold text-[#ffffff] group-hover/card:after:content-['→'] group-hover/card:after:ml-2",children:x.id})}),b.jsx(UO,{children:x.data&&b.jsx("p",{className:"text-sm text-[#cccccc] whitespace-pre-wrap break-words line-clamp-5",children:x.data.text})}),b.jsxs(HO,{className:"flex gap-4 group border-t border-[#222] pt-4",children:[b.jsx(ta,{variant:"",className:"font-normal text-xs text-[#ffffff] border-[#333] hover:bg-red-700 duration-200 dark w-1/2",onClick:S=>{S.preventDefault(),m({project:x.id})},children:"resume"}),b.jsx("span",{className:"hidden group-hover:block text-red-400 text-xs",children:"only use if generation was interrupted !"})]})]})})},x.id))})]})},qq=()=>b.jsx("div",{className:"flex items-center justify-center h-screen w-full text-white",children:b.jsxs("h1",{className:"text-2xl font-light opacity-50 text-center whitespace-pre-wrap break-words",children:["{ playground/designer : not implemented yet }",b.jsx("br",{}),"component designer enabled on projects (auto)"]})}),Yq=()=>b.jsx("div",{className:"flex items-center justify-center h-screen w-full text-white",children:b.jsx("h1",{className:"text-2xl font-light opacity-50 text-center",children:"{ settings : not implemented yet }"})});function ut(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{}};function mp(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Xf.prototype=mp.prototype={constructor:Xf,on:function(e,t){var n=this._,r=Xq(e+"",n),i,s=-1,o=r.length;if(arguments.length<2){for(;++s0)for(var n=new Array(i),r=0,i,s;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),wE.hasOwnProperty(t)?{space:wE[t],local:e}:e}function Zq(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===S0&&t.documentElement.namespaceURI===S0?t.createElement(e):t.createElementNS(n,e)}}function Jq(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ML(e){var t=gp(e);return(t.local?Jq:Zq)(t)}function eY(){}function dx(e){return e==null?eY:function(){return this.querySelector(e)}}function tY(e){typeof e!="function"&&(e=dx(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=g&&(g=v+1);!(S=w[g])&&++g=0;)(o=r[i])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function TY(e){e||(e=_Y);function t(c,d){return c&&d?e(c.__data__,d.__data__):!c-!d}for(var n=this._groups,r=n.length,i=new Array(r),s=0;st?1:e>=t?0:NaN}function AY(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function NY(){return Array.from(this)}function PY(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?VY:typeof t=="function"?UY:zY)(e,t,n??"")):ba(this.node(),e)}function ba(e,t){return e.style.getPropertyValue(t)||VL(e).getComputedStyle(e,null).getPropertyValue(t)}function WY(e){return function(){delete this[e]}}function KY(e,t){return function(){this[e]=t}}function qY(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function YY(e,t){return arguments.length>1?this.each((t==null?WY:typeof t=="function"?qY:KY)(e,t)):this.node()[e]}function zL(e){return e.trim().split(/^|\s+/)}function hx(e){return e.classList||new UL(e)}function UL(e){this._node=e,this._names=zL(e.getAttribute("class")||"")}UL.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function HL(e,t){for(var n=hx(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function SG(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,s;n()=>e;function k0(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:s,x:o,y:a,dx:l,dy:u,dispatch:f}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:f}})}k0.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function LG(e){return!e.ctrlKey&&!e.button}function RG(){return this.parentNode}function IG(e,t){return t??{x:e.x,y:e.y}}function DG(){return navigator.maxTouchPoints||"ontouchstart"in this}function XL(){var e=LG,t=RG,n=IG,r=DG,i={},s=mp("start","drag","end"),o=0,a,l,u,f,c=0;function d(x){x.on("mousedown.drag",h).filter(r).on("touchstart.drag",w).on("touchmove.drag",y,OG).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(x,S){if(!(f||!e.call(this,x,S))){var k=g(this,t.call(this,x,S),x,S,"mouse");k&&(cn(x.view).on("mousemove.drag",p,Iu).on("mouseup.drag",m,Iu),YL(x.view),ig(x),u=!1,a=x.clientX,l=x.clientY,k("start",x))}}function p(x){if(ra(x),!u){var S=x.clientX-a,k=x.clientY-l;u=S*S+k*k>c}i.mouse("drag",x)}function m(x){cn(x.view).on("mousemove.drag mouseup.drag",null),GL(x.view,u),ra(x),i.mouse("end",x)}function w(x,S){if(e.call(this,x,S)){var k=x.changedTouches,C=t.call(this,x,S),T=k.length,O,A;for(O=0;O>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?rf(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?rf(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=jG.exec(e))?new en(t[1],t[2],t[3],1):(t=FG.exec(e))?new en(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=$G.exec(e))?rf(t[1],t[2],t[3],t[4]):(t=BG.exec(e))?rf(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=VG.exec(e))?TE(t[1],t[2]/100,t[3]/100,1):(t=zG.exec(e))?TE(t[1],t[2]/100,t[3]/100,t[4]):xE.hasOwnProperty(e)?kE(xE[e]):e==="transparent"?new en(NaN,NaN,NaN,0):null}function kE(e){return new en(e>>16&255,e>>8&255,e&255,1)}function rf(e,t,n,r){return r<=0&&(e=t=n=NaN),new en(e,t,n,r)}function WG(e){return e instanceof mc||(e=ju(e)),e?(e=e.rgb(),new en(e.r,e.g,e.b,e.opacity)):new en}function E0(e,t,n,r){return arguments.length===1?WG(e):new en(e,t,n,r??1)}function en(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}px(en,E0,QL(mc,{brighter(e){return e=e==null?sh:Math.pow(sh,e),new en(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Du:Math.pow(Du,e),new en(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new en(Ms(this.r),Ms(this.g),Ms(this.b),oh(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:EE,formatHex:EE,formatHex8:KG,formatRgb:CE,toString:CE}));function EE(){return`#${Ns(this.r)}${Ns(this.g)}${Ns(this.b)}`}function KG(){return`#${Ns(this.r)}${Ns(this.g)}${Ns(this.b)}${Ns((isNaN(this.opacity)?1:this.opacity)*255)}`}function CE(){const e=oh(this.opacity);return`${e===1?"rgb(":"rgba("}${Ms(this.r)}, ${Ms(this.g)}, ${Ms(this.b)}${e===1?")":`, ${e})`}`}function oh(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ms(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ns(e){return e=Ms(e),(e<16?"0":"")+e.toString(16)}function TE(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new er(e,t,n,r)}function ZL(e){if(e instanceof er)return new er(e.h,e.s,e.l,e.opacity);if(e instanceof mc||(e=ju(e)),!e)return new er;if(e instanceof er)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),s=Math.max(t,n,r),o=NaN,a=s-i,l=(s+i)/2;return a?(t===s?o=(n-r)/a+(n0&&l<1?0:o,new er(o,a,l,e.opacity)}function qG(e,t,n,r){return arguments.length===1?ZL(e):new er(e,t,n,r??1)}function er(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}px(er,qG,QL(mc,{brighter(e){return e=e==null?sh:Math.pow(sh,e),new er(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Du:Math.pow(Du,e),new er(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new en(sg(e>=240?e-240:e+120,i,r),sg(e,i,r),sg(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new er(_E(this.h),sf(this.s),sf(this.l),oh(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=oh(this.opacity);return`${e===1?"hsl(":"hsla("}${_E(this.h)}, ${sf(this.s)*100}%, ${sf(this.l)*100}%${e===1?")":`, ${e})`}`}}));function _E(e){return e=(e||0)%360,e<0?e+360:e}function sf(e){return Math.max(0,Math.min(1,e||0))}function sg(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const JL=e=>()=>e;function YG(e,t){return function(n){return e+n*t}}function GG(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function XG(e){return(e=+e)==1?eR:function(t,n){return n-t?GG(t,n,e):JL(isNaN(t)?n:t)}}function eR(e,t){var n=t-e;return n?YG(e,n):JL(isNaN(e)?t:e)}const AE=function e(t){var n=XG(t);function r(i,s){var o=n((i=E0(i)).r,(s=E0(s)).r),a=n(i.g,s.g),l=n(i.b,s.b),u=eR(i.opacity,s.opacity);return function(f){return i.r=o(f),i.g=a(f),i.b=l(f),i.opacity=u(f),i+""}}return r.gamma=e,r}(1);function Ti(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var C0=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,og=new RegExp(C0.source,"g");function QG(e){return function(){return e}}function ZG(e){return function(t){return e(t)+""}}function JG(e,t){var n=C0.lastIndex=og.lastIndex=0,r,i,s,o=-1,a=[],l=[];for(e=e+"",t=t+"";(r=C0.exec(e))&&(i=og.exec(t));)(s=i.index)>n&&(s=t.slice(n,s),a[o]?a[o]+=s:a[++o]=s),(r=r[0])===(i=i[0])?a[o]?a[o]+=i:a[++o]=i:(a[++o]=null,l.push({i:o,x:Ti(r,i)})),n=og.lastIndex;return n180?f+=360:f-u>180&&(u+=360),d.push({i:c.push(i(c)+"rotate(",null,r)-2,x:Ti(u,f)})):f&&c.push(i(c)+"rotate("+f+r)}function a(u,f,c,d){u!==f?d.push({i:c.push(i(c)+"skewX(",null,r)-2,x:Ti(u,f)}):f&&c.push(i(c)+"skewX("+f+r)}function l(u,f,c,d,h,p){if(u!==c||f!==d){var m=h.push(i(h)+"scale(",null,",",null,")");p.push({i:m-4,x:Ti(u,c)},{i:m-2,x:Ti(f,d)})}else(c!==1||d!==1)&&h.push(i(h)+"scale("+c+","+d+")")}return function(u,f){var c=[],d=[];return u=e(u),f=e(f),s(u.translateX,u.translateY,f.translateX,f.translateY,c,d),o(u.rotate,f.rotate,c,d),a(u.skewX,f.skewX,c,d),l(u.scaleX,u.scaleY,f.scaleX,f.scaleY,c,d),u=f=null,function(h){for(var p=-1,m=d.length,w;++p=0&&e._call.call(void 0,t),e=e._next;--Sa}function OE(){Gs=(lh=Fu.now())+yp,Sa=Ll=0;try{uX()}finally{Sa=0,fX(),Gs=0}}function cX(){var e=Fu.now(),t=e-lh;t>rR&&(yp-=t,lh=e)}function fX(){for(var e,t=ah,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:ah=n);Rl=e,_0(r)}function _0(e){if(!Sa){Ll&&(Ll=clearTimeout(Ll));var t=e-Gs;t>24?(e<1/0&&(Ll=setTimeout(OE,e-Fu.now()-yp)),yl&&(yl=clearInterval(yl))):(yl||(lh=Fu.now(),yl=setInterval(cX,rR)),Sa=1,iR(OE))}}function LE(e,t,n){var r=new uh;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var dX=mp("start","end","cancel","interrupt"),hX=[],oR=0,RE=1,A0=2,Qf=3,IE=4,N0=5,Zf=6;function vp(e,t,n,r,i,s){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;pX(e,n,{name:t,index:r,group:i,on:dX,tween:hX,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:oR})}function gx(e,t){var n=fr(e,t);if(n.state>oR)throw new Error("too late; already scheduled");return n}function Or(e,t){var n=fr(e,t);if(n.state>Qf)throw new Error("too late; already running");return n}function fr(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function pX(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=sR(s,0,n.time);function s(u){n.state=RE,n.timer.restart(o,n.delay,n.time),n.delay<=u&&o(u-n.delay)}function o(u){var f,c,d,h;if(n.state!==RE)return l();for(f in r)if(h=r[f],h.name===n.name){if(h.state===Qf)return LE(o);h.state===IE?(h.state=Zf,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[f]):+fA0&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function HX(e,t,n){var r,i,s=UX(t)?gx:Or;return function(){var o=s(this,e),a=o.on;a!==r&&(i=(r=a).copy()).on(t,n),o.on=i}}function WX(e,t){var n=this._id;return arguments.length<2?fr(this.node(),n).on.on(e):this.each(HX(n,e,t))}function KX(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function qX(){return this.on("end.remove",KX(this._id))}function YX(e){var t=this._name,n=this._id;typeof e!="function"&&(e=dx(e));for(var r=this._groups,i=r.length,s=new Array(i),o=0;o()=>e;function wQ(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Kr(e,t,n){this.k=e,this.x=t,this.y=n}Kr.prototype={constructor:Kr,scale:function(e){return e===1?this:new Kr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Kr(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var wp=new Kr(1,0,0);cR.prototype=Kr.prototype;function cR(e){for(;!e.__zoom;)if(!(e=e.parentNode))return wp;return e.__zoom}function ag(e){e.stopImmediatePropagation()}function vl(e){e.preventDefault(),e.stopImmediatePropagation()}function xQ(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function bQ(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function DE(){return this.__zoom||wp}function SQ(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function kQ(){return navigator.maxTouchPoints||"ontouchstart"in this}function EQ(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>s?(s+o)/2:Math.min(0,s)||Math.max(0,o))}function fR(){var e=xQ,t=bQ,n=EQ,r=SQ,i=kQ,s=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],a=250,l=aX,u=mp("start","zoom","end"),f,c,d,h=500,p=150,m=0,w=10;function y(N){N.property("__zoom",DE).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",O).on("dblclick.zoom",A).filter(i).on("touchstart.zoom",j).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",B).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(N,M,I,F){var P=N.selection?N.selection():N;P.property("__zoom",DE),N!==P?S(N,M,I,F):P.interrupt().each(function(){k(this,arguments).event(F).start().zoom(null,typeof M=="function"?M.apply(this,arguments):M).end()})},y.scaleBy=function(N,M,I,F){y.scaleTo(N,function(){var P=this.__zoom.k,D=typeof M=="function"?M.apply(this,arguments):M;return P*D},I,F)},y.scaleTo=function(N,M,I,F){y.transform(N,function(){var P=t.apply(this,arguments),D=this.__zoom,_=I==null?x(P):typeof I=="function"?I.apply(this,arguments):I,V=D.invert(_),W=typeof M=="function"?M.apply(this,arguments):M;return n(g(v(D,W),_,V),P,o)},I,F)},y.translateBy=function(N,M,I,F){y.transform(N,function(){return n(this.__zoom.translate(typeof M=="function"?M.apply(this,arguments):M,typeof I=="function"?I.apply(this,arguments):I),t.apply(this,arguments),o)},null,F)},y.translateTo=function(N,M,I,F,P){y.transform(N,function(){var D=t.apply(this,arguments),_=this.__zoom,V=F==null?x(D):typeof F=="function"?F.apply(this,arguments):F;return n(wp.translate(V[0],V[1]).scale(_.k).translate(typeof M=="function"?-M.apply(this,arguments):-M,typeof I=="function"?-I.apply(this,arguments):-I),D,o)},F,P)};function v(N,M){return M=Math.max(s[0],Math.min(s[1],M)),M===N.k?N:new Kr(M,N.x,N.y)}function g(N,M,I){var F=M[0]-I[0]*N.k,P=M[1]-I[1]*N.k;return F===N.x&&P===N.y?N:new Kr(N.k,F,P)}function x(N){return[(+N[0][0]+ +N[1][0])/2,(+N[0][1]+ +N[1][1])/2]}function S(N,M,I,F){N.on("start.zoom",function(){k(this,arguments).event(F).start()}).on("interrupt.zoom end.zoom",function(){k(this,arguments).event(F).end()}).tween("zoom",function(){var P=this,D=arguments,_=k(P,D).event(F),V=t.apply(P,D),W=I==null?x(V):typeof I=="function"?I.apply(P,D):I,R=Math.max(V[1][0]-V[0][0],V[1][1]-V[0][1]),q=P.__zoom,J=typeof M=="function"?M.apply(P,D):M,Y=l(q.invert(W).concat(R/q.k),J.invert(W).concat(R/J.k));return function(re){if(re===1)re=J;else{var G=Y(re),le=R/G[2];re=new Kr(le,W[0]-G[0]*le,W[1]-G[1]*le)}_.zoom(null,re)}})}function k(N,M,I){return!I&&N.__zooming||new C(N,M)}function C(N,M){this.that=N,this.args=M,this.active=0,this.sourceEvent=null,this.extent=t.apply(N,M),this.taps=0}C.prototype={event:function(N){return N&&(this.sourceEvent=N),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(N,M){return this.mouse&&N!=="mouse"&&(this.mouse[1]=M.invert(this.mouse[0])),this.touch0&&N!=="touch"&&(this.touch0[1]=M.invert(this.touch0[0])),this.touch1&&N!=="touch"&&(this.touch1[1]=M.invert(this.touch1[0])),this.that.__zoom=M,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(N){var M=cn(this.that).datum();u.call(N,this.that,new wQ(N,{sourceEvent:this.sourceEvent,target:y,type:N,transform:this.that.__zoom,dispatch:u}),M)}};function T(N,...M){if(!e.apply(this,arguments))return;var I=k(this,M).event(N),F=this.__zoom,P=Math.max(s[0],Math.min(s[1],F.k*Math.pow(2,r.apply(this,arguments)))),D=Xn(N);if(I.wheel)(I.mouse[0][0]!==D[0]||I.mouse[0][1]!==D[1])&&(I.mouse[1]=F.invert(I.mouse[0]=D)),clearTimeout(I.wheel);else{if(F.k===P)return;I.mouse=[D,F.invert(D)],Jf(this),I.start()}vl(N),I.wheel=setTimeout(_,p),I.zoom("mouse",n(g(v(F,P),I.mouse[0],I.mouse[1]),I.extent,o));function _(){I.wheel=null,I.end()}}function O(N,...M){if(d||!e.apply(this,arguments))return;var I=N.currentTarget,F=k(this,M,!0).event(N),P=cn(N.view).on("mousemove.zoom",W,!0).on("mouseup.zoom",R,!0),D=Xn(N,I),_=N.clientX,V=N.clientY;YL(N.view),ag(N),F.mouse=[D,this.__zoom.invert(D)],Jf(this),F.start();function W(q){if(vl(q),!F.moved){var J=q.clientX-_,Y=q.clientY-V;F.moved=J*J+Y*Y>m}F.event(q).zoom("mouse",n(g(F.that.__zoom,F.mouse[0]=Xn(q,I),F.mouse[1]),F.extent,o))}function R(q){P.on("mousemove.zoom mouseup.zoom",null),GL(q.view,F.moved),vl(q),F.event(q).end()}}function A(N,...M){if(e.apply(this,arguments)){var I=this.__zoom,F=Xn(N.changedTouches?N.changedTouches[0]:N,this),P=I.invert(F),D=I.k*(N.shiftKey?.5:2),_=n(g(v(I,D),F,P),t.apply(this,M),o);vl(N),a>0?cn(this).transition().duration(a).call(S,_,F,N):cn(this).call(y.transform,_,F,N)}}function j(N,...M){if(e.apply(this,arguments)){var I=N.touches,F=I.length,P=k(this,M,N.changedTouches.length===F).event(N),D,_,V,W;for(ag(N),_=0;_"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`},$u=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],dR=["Enter"," ","Escape"];var ka;(function(e){e.Strict="strict",e.Loose="loose"})(ka||(ka={}));var js;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(js||(js={}));var Bu;(function(e){e.Partial="partial",e.Full="full"})(Bu||(Bu={}));const hR={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var Pi;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Pi||(Pi={}));var Xs;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Xs||(Xs={}));var se;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(se||(se={}));const ME={[se.Left]:se.Right,[se.Right]:se.Left,[se.Top]:se.Bottom,[se.Bottom]:se.Top};function pR(e){return e===null?null:e?"valid":"invalid"}const mR=e=>"id"in e&&"source"in e&&"target"in e,CQ=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),vx=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),xp=(e,t=[0,0])=>{const{width:n,height:r}=cs(e),i=e.origin??t,s=n*i[0],o=r*i[1];return{x:e.position.x-s,y:e.position.y-o}},TQ=(e,t={nodeOrigin:[0,0],nodeLookup:void 0})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,i)=>{const s=typeof i=="string";let o=!t.nodeLookup&&!s?i:void 0;t.nodeLookup&&(o=s?t.nodeLookup.get(i):vx(i)?i:t.nodeLookup.get(i.id));const a=o?ch(o,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return bp(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Sp(n)},gc=(e,t={})=>{if(e.size===0)return{x:0,y:0,width:0,height:0};let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach(r=>{if(t.filter===void 0||t.filter(r)){const i=ch(r);n=bp(n,i)}}),Sp(n)},gR=(e,t,[n,r,i]=[0,0,1],s=!1,o=!1)=>{const a={...yc(t,[n,r,i]),width:t.width/i,height:t.height/i},l=[];for(const u of e.values()){const{measured:f,selectable:c=!0,hidden:d=!1}=u;if(o&&!c||d)continue;const h=f.width??u.width??u.initialWidth??null,p=f.height??u.height??u.initialHeight??null,m=Vu(a,Ta(u)),w=(h??0)*(p??0),y=s&&m>0;(!u.internals.handleBounds||y||m>=w||u.dragging)&&l.push(u)}return l},_Q=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function P0(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(i=>i.id)):null;return e.forEach(i=>{i.measured.width&&i.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!i.hidden)&&(!r||r.has(i.id))&&n.set(i.id,i)}),n}async function O0({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:s},o){if(e.size===0)return Promise.resolve(!1);const a=gc(e),l=wx(a,t,n,(o==null?void 0:o.minZoom)??i,(o==null?void 0:o.maxZoom)??s,(o==null?void 0:o.padding)??.1);return await r.setViewport(l,{duration:o==null?void 0:o.duration}),Promise.resolve(!0)}function yR({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:s}){const o=n.get(e),a=o.parentId?n.get(o.parentId):void 0,{x:l,y:u}=a?a.internals.positionAbsolute:{x:0,y:0},f=o.origin??r;let c=i;if(o.extent==="parent"&&!o.expandParent)if(!a)s==null||s("005",hi.error005());else{const h=a.measured.width,p=a.measured.height;h&&p&&(c=[[l,u],[l+h,u+p]])}else a&&zu(o.extent)&&(c=[[o.extent[0][0]+l,o.extent[0][1]+u],[o.extent[1][0]+l,o.extent[1][1]+u]]);const d=zu(c)?Ca(t,c,o.measured):t;return{position:{x:d.x-l+o.measured.width*f[0],y:d.y-u+o.measured.height*f[1]},positionAbsolute:d}}async function AQ({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){const s=new Set(e.map(d=>d.id)),o=[];for(const d of n){if(d.deletable===!1)continue;const h=s.has(d.id),p=!h&&d.parentId&&o.find(m=>m.id===d.parentId);(h||p)&&o.push(d)}const a=new Set(t.map(d=>d.id)),l=r.filter(d=>d.deletable!==!1),f=_Q(o,l);for(const d of l)a.has(d.id)&&!f.find(p=>p.id===d.id)&&f.push(d);if(!i)return{edges:f,nodes:o};const c=await i({nodes:o,edges:f});return typeof c=="boolean"?c?{edges:f,nodes:o}:{edges:[],nodes:[]}:c}const Ea=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Ca=(e={x:0,y:0},t,n)=>({x:Ea(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Ea(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function vR(e,t,n){const{width:r,height:i}=cs(n),{x:s,y:o}=n.internals.positionAbsolute;return Ca(e,[[s,o],[s+r,o+i]],t)}const jE=(e,t,n)=>en?-Ea(Math.abs(e-n),1,t)/t:0,wR=(e,t,n=15,r=40)=>{const i=jE(e.x,r,t.width-r)*n,s=jE(e.y,r,t.height-r)*n;return[i,s]},bp=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),L0=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Sp=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Ta=(e,t=[0,0])=>{var i,s;const{x:n,y:r}=vx(e)?e.internals.positionAbsolute:xp(e,t);return{x:n,y:r,width:((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0,height:((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0}},ch=(e,t=[0,0])=>{var i,s;const{x:n,y:r}=vx(e)?e.internals.positionAbsolute:xp(e,t);return{x:n,y:r,x2:n+(((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0),y2:r+(((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0)}},xR=(e,t)=>Sp(bp(L0(e),L0(t))),Vu=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},FE=e=>tr(e.width)&&tr(e.height)&&tr(e.x)&&tr(e.y),tr=e=>!isNaN(e)&&isFinite(e),NQ=(e,t)=>{},kp=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),yc=({x:e,y:t},[n,r,i],s=!1,o=[1,1])=>{const a={x:(e-n)/i,y:(t-r)/i};return s?kp(a,o):a},bR=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r}),wx=(e,t,n,r,i,s)=>{const o=t/(e.width*(1+s)),a=n/(e.height*(1+s)),l=Math.min(o,a),u=Ea(l,r,i),f=e.x+e.width/2,c=e.y+e.height/2,d=t/2-f*u,h=n/2-c*u;return{x:d,y:h,zoom:u}},fh=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function zu(e){return e!==void 0&&e!=="parent"}function cs(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function SR(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function kR(e,t={width:0,height:0},n,r,i){let s=n;const o={...e};for(;s;){const a=r.get(s);if(s=a==null?void 0:a.parentId,a){const l=a.origin||i;o.x+=a.internals.positionAbsolute.x-(t.width??0)*l[0],o.y+=a.internals.positionAbsolute.y-(t.height??0)*l[1]}}return o}function eu(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r}){const{x:i,y:s}=Jr(e),o=yc({x:i,y:s},r),{x:a,y:l}=n?kp(o,t):o;return{xSnapped:a,ySnapped:l,...o}}const xx=e=>({width:e.offsetWidth,height:e.offsetHeight}),ER=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},PQ=["INPUT","SELECT","TEXTAREA"];function R0(e){var r,i;const t=((i=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:i[0])||e.target;return PQ.includes(t==null?void 0:t.nodeName)||(t==null?void 0:t.hasAttribute("contenteditable"))||!!(t!=null&&t.closest(".nokey"))}const CR=e=>"clientX"in e,Jr=(e,t)=>{var s,o;const n=CR(e),r=n?e.clientX:(s=e.touches)==null?void 0:s[0].clientX,i=n?e.clientY:(o=e.touches)==null?void 0:o[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},$E=(e,t,n,r,i)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(o=>{const a=o.getBoundingClientRect();return{id:o.getAttribute("data-handleid"),type:e,nodeId:i,position:o.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...xx(o)}})};function TR({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:s,targetControlX:o,targetControlY:a}){const l=e*.125+i*.375+o*.375+n*.125,u=t*.125+s*.375+a*.375+r*.125,f=Math.abs(l-e),c=Math.abs(u-t);return[l,u,f,c]}function lf(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function BE({pos:e,x1:t,y1:n,x2:r,y2:i,c:s}){switch(e){case se.Left:return[t-lf(t-r,s),n];case se.Right:return[t+lf(r-t,s),n];case se.Top:return[t,n-lf(n-i,s)];case se.Bottom:return[t,n+lf(i-n,s)]}}function Ep({sourceX:e,sourceY:t,sourcePosition:n=se.Bottom,targetX:r,targetY:i,targetPosition:s=se.Top,curvature:o=.25}){const[a,l]=BE({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[u,f]=BE({pos:s,x1:r,y1:i,x2:e,y2:t,c:o}),[c,d,h,p]=TR({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:a,sourceControlY:l,targetControlX:u,targetControlY:f});return[`M${e},${t} C${a},${l} ${u},${f} ${r},${i}`,c,d,h,p]}function _R({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,s=n0}const RQ=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,IQ=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),AR=(e,t)=>{if(!e.source||!e.target)return t;let n;return mR(e)?n={...e}:n={...e,id:RQ(e)},IQ(n,t)?t:(n.sourceHandle===null&&delete n.sourceHandle,n.targetHandle===null&&delete n.targetHandle,t.concat(n))};function NR({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,s,o,a]=_R({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,s,o,a]}const VE={[se.Left]:{x:-1,y:0},[se.Right]:{x:1,y:0},[se.Top]:{x:0,y:-1},[se.Bottom]:{x:0,y:1}},DQ=({source:e,sourcePosition:t=se.Bottom,target:n})=>t===se.Left||t===se.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function MQ({source:e,sourcePosition:t=se.Bottom,target:n,targetPosition:r=se.Top,center:i,offset:s}){const o=VE[t],a=VE[r],l={x:e.x+o.x*s,y:e.y+o.y*s},u={x:n.x+a.x*s,y:n.y+a.y*s},f=DQ({source:l,sourcePosition:t,target:u}),c=f.x!==0?"x":"y",d=f[c];let h=[],p,m;const w={x:0,y:0},y={x:0,y:0},[v,g,x,S]=_R({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(o[c]*a[c]===-1){p=i.x??v,m=i.y??g;const C=[{x:p,y:l.y},{x:p,y:u.y}],T=[{x:l.x,y:m},{x:u.x,y:m}];o[c]===d?h=c==="x"?C:T:h=c==="x"?T:C}else{const C=[{x:l.x,y:u.y}],T=[{x:u.x,y:l.y}];if(c==="x"?h=o.x===d?T:C:h=o.y===d?C:T,t===r){const B=Math.abs(e[c]-n[c]);if(B<=s){const N=Math.min(s-1,s-B);o[c]===d?w[c]=(l[c]>e[c]?-1:1)*N:y[c]=(u[c]>n[c]?-1:1)*N}}if(t!==r){const B=c==="x"?"y":"x",N=o[c]===a[B],M=l[B]>u[B],I=l[B]=L?(p=(O.x+A.x)/2,m=h[0].y):(p=h[0].x,m=(O.y+A.y)/2)}return[[e,{x:l.x+w.x,y:l.y+w.y},...h,{x:u.x+y.x,y:u.y+y.y},n],p,m,x,S]}function jQ(e,t,n,r){const i=Math.min(zE(e,t)/2,zE(t,n)/2,r),{x:s,y:o}=t;if(e.x===s&&s===n.x||e.y===o&&o===n.y)return`L${s} ${o}`;if(e.y===o){const u=e.x{let g="";return v>0&&vn.id===t):e[0])||null}function D0(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function $Q(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){const s=new Set;return e.reduce((o,a)=>([a.markerStart||r,a.markerEnd||i].forEach(l=>{if(l&&typeof l=="object"){const u=D0(l,t);s.has(u)||(o.push({id:u,color:l.color||n,...l}),s.add(u))}}),o),[]).sort((o,a)=>o.id.localeCompare(a.id))}const bx={nodeOrigin:[0,0],nodeExtent:$u,elevateNodesOnSelect:!0,defaults:{}},BQ={...bx,checkEquality:!0};function Sx(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function VQ(e,t,n){const r=Sx(bx,n);for(const i of e.values())i.parentId&&kx(i,e,t,r)}function M0(e,t,n,r){var a,l;const i=Sx(BQ,r),s=new Map(t),o=i!=null&&i.elevateNodesOnSelect?1e3:0;t.clear(),n.clear();for(const u of e){let f=s.get(u.id);if(i.checkEquality&&u===(f==null?void 0:f.internals.userNode))t.set(u.id,f);else{const c=xp(u,i.nodeOrigin),d=zu(u.extent)?u.extent:i.nodeExtent,h=Ca(c,d,cs(u));f={...i.defaults,...u,measured:{width:(a=u.measured)==null?void 0:a.width,height:(l=u.measured)==null?void 0:l.height},internals:{positionAbsolute:h,handleBounds:u.measured?f==null?void 0:f.internals.handleBounds:void 0,z:PR(u,o),userNode:u}},t.set(u.id,f)}u.parentId&&kx(f,t,n,r)}}function zQ(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function kx(e,t,n,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:o}=Sx(bx,r),a=e.parentId,l=t.get(a);if(!l){console.warn(`Parent node ${a} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}zQ(e,n);const u=i?1e3:0,{x:f,y:c,z:d}=UQ(e,l,s,o,u),{positionAbsolute:h}=e.internals,p=f!==h.x||c!==h.y;(p||d!==e.internals.z)&&(e.internals={...e.internals,positionAbsolute:p?{x:f,y:c}:h,z:d})}function PR(e,t){return(tr(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function UQ(e,t,n,r,i){const{x:s,y:o}=t.internals.positionAbsolute,a=cs(e),l=xp(e,n),u=zu(e.extent)?Ca(l,e.extent,a):l;let f=Ca({x:s+u.x,y:o+u.y},r,a);e.extent==="parent"&&(f=vR(f,a,t));const c=PR(e,i),d=t.internals.z??0;return{x:f.x,y:f.y,z:d>c?d:c}}function Ex(e,t,n,r=[0,0]){var o;const i=[],s=new Map;for(const a of e){const l=t.get(a.parentId);if(!l)continue;const u=((o=s.get(a.parentId))==null?void 0:o.expandedRect)??Ta(l),f=xR(u,a.rect);s.set(a.parentId,{expandedRect:f,parent:l})}return s.size>0&&s.forEach(({expandedRect:a,parent:l},u)=>{var g;const f=l.internals.positionAbsolute,c=cs(l),d=l.origin??r,h=a.x0||p>0||y||v)&&(i.push({id:u,type:"position",position:{x:l.position.x-h+y,y:l.position.y-p+v}}),(g=n.get(u))==null||g.forEach(x=>{e.some(S=>S.id===x.id)||i.push({id:x.id,type:"position",position:{x:x.position.x+h,y:x.position.y+p}})})),(c.width0){const d=Ex(c,t,n,i);l.push(...d)}return{changes:l,updatedInternals:a}}async function WQ({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,s]],r),a=!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2]);return Promise.resolve(a)}function OR(e,t,n){e.clear(),t.clear();for(const r of n){const{source:i,target:s,sourceHandle:o=null,targetHandle:a=null}=r,l=`${i}-source-${o}`,u=`${s}-target-${a}`,f=e.get(l)||new Map,c=e.get(u)||new Map,d={edgeId:r.id,source:i,target:s,sourceHandle:o,targetHandle:a};t.set(r.id,r),e.set(l,f.set(`${s}-${a}`,d)),e.set(u,c.set(`${i}-${o}`,d))}}function LR(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:LR(n,t):!1}function KE(e,t,n){let r=e;do{if(r!=null&&r.matches(t))return!0;if(r===n)return!1;r=r.parentElement}while(r);return!1}function KQ(e,t,n,r){const i=new Map;for(const[s,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!LR(o,e))&&(o.draggable||t&&typeof o.draggable>"u")){const a=e.get(s);a&&i.set(s,{id:s,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return i}function lg({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var o,a;const i=[];for(const[l,u]of t){const f=(o=n.get(l))==null?void 0:o.internals.userNode;f&&i.push({...f,position:u.position,dragging:r})}if(!e)return[i[0],i];const s=n.get(e).internals.userNode;return[{...s,position:((a=t.get(e))==null?void 0:a.position)||s.position,dragging:r},i]}function qQ({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let s={x:null,y:null},o=0,a=new Map,l=!1,u={x:0,y:0},f=null,c=!1,d=null,h=!1;function p({noDragClassName:w,handleSelector:y,domNode:v,isSelectable:g,nodeId:x,nodeClickDistance:S=0}){d=cn(v);function k({x:A,y:j},L){const{nodeLookup:B,nodeExtent:N,snapGrid:M,snapToGrid:I,nodeOrigin:F,onNodeDrag:P,onSelectionDrag:D,onError:_,updateNodePositions:V}=t();s={x:A,y:j};let W=!1,R={x:0,y:0,x2:0,y2:0};if(a.size>1&&N){const q=gc(a);R=L0(q)}for(const[q,J]of a){let Y={x:A-J.distance.x,y:j-J.distance.y};I&&(Y=kp(Y,M));let re=[[N[0][0],N[0][1]],[N[1][0],N[1][1]]];if(a.size>1&&N&&!J.extent){const{positionAbsolute:de}=J.internals,ue=de.x-R.x+N[0][0],ie=de.x+J.measured.width-R.x2+N[1][0],pe=de.y-R.y+N[0][1],Ne=de.y+J.measured.height-R.y2+N[1][1];re=[[ue,pe],[ie,Ne]]}const{position:G,positionAbsolute:le}=yR({nodeId:q,nextPosition:Y,nodeLookup:B,nodeExtent:re,nodeOrigin:F,onError:_});W=W||J.position.x!==G.x||J.position.y!==G.y,J.position=G,J.internals.positionAbsolute=le}if(W&&(V(a,!0),L&&(r||P||!x&&D))){const[q,J]=lg({nodeId:x,dragItems:a,nodeLookup:B});r==null||r(L,a,q,J),P==null||P(L,q,J),x||D==null||D(L,J)}}async function C(){if(!f)return;const{transform:A,panBy:j,autoPanSpeed:L}=t(),[B,N]=wR(u,f,L);(B!==0||N!==0)&&(s.x=(s.x??0)-B/A[2],s.y=(s.y??0)-N/A[2],await j({x:B,y:N})&&k(s,null)),o=requestAnimationFrame(C)}function T(A){var W;const{nodeLookup:j,multiSelectionActive:L,nodesDraggable:B,transform:N,snapGrid:M,snapToGrid:I,selectNodesOnDrag:F,onNodeDragStart:P,onSelectionDragStart:D,unselectNodesAndEdges:_}=t();c=!0,(!F||!g)&&!L&&x&&((W=j.get(x))!=null&&W.selected||_()),g&&F&&x&&(e==null||e(x));const V=eu(A.sourceEvent,{transform:N,snapGrid:M,snapToGrid:I});if(s=V,a=KQ(j,B,V,x),a.size>0&&(n||P||!x&&D)){const[R,q]=lg({nodeId:x,dragItems:a,nodeLookup:j});n==null||n(A.sourceEvent,a,R,q),P==null||P(A.sourceEvent,R,q),x||D==null||D(A.sourceEvent,q)}}const O=XL().clickDistance(S).on("start",A=>{const{domNode:j,nodeDragThreshold:L,transform:B,snapGrid:N,snapToGrid:M}=t();h=!1,L===0&&T(A),s=eu(A.sourceEvent,{transform:B,snapGrid:N,snapToGrid:M}),f=(j==null?void 0:j.getBoundingClientRect())||null,u=Jr(A.sourceEvent,f)}).on("drag",A=>{const{autoPanOnNodeDrag:j,transform:L,snapGrid:B,snapToGrid:N,nodeDragThreshold:M}=t(),I=eu(A.sourceEvent,{transform:L,snapGrid:B,snapToGrid:N});if(A.sourceEvent.type==="touchmove"&&A.sourceEvent.touches.length>1&&(h=!0),!h){if(!l&&j&&c&&(l=!0,C()),!c){const F=I.xSnapped-(s.x??0),P=I.ySnapped-(s.y??0);Math.sqrt(F*F+P*P)>M&&T(A)}(s.x!==I.xSnapped||s.y!==I.ySnapped)&&a&&c&&(u=Jr(A.sourceEvent,f),k(I,A.sourceEvent))}}).on("end",A=>{if(!(!c||h)&&(l=!1,c=!1,cancelAnimationFrame(o),a.size>0)){const{nodeLookup:j,updateNodePositions:L,onNodeDragStop:B,onSelectionDragStop:N}=t();if(L(a,!1),i||B||!x&&N){const[M,I]=lg({nodeId:x,dragItems:a,nodeLookup:j,dragging:!1});i==null||i(A.sourceEvent,a,M,I),B==null||B(A.sourceEvent,M,I),x||N==null||N(A.sourceEvent,I)}}}).filter(A=>{const j=A.target;return!A.button&&(!w||!KE(j,`.${w}`,v))&&(!y||KE(j,y,v))});d.call(O)}function m(){d==null||d.on(".drag",null)}return{update:p,destroy:m}}function YQ(e,t,n){const r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())Vu(i,Ta(s))>0&&r.push(s);return r}const GQ=250;function XQ(e,t,n,r){var a,l;let i=[],s=1/0;const o=YQ(e,n,t+GQ);for(const u of o){const f=[...((a=u.internals.handleBounds)==null?void 0:a.source)??[],...((l=u.internals.handleBounds)==null?void 0:l.target)??[]];for(const c of f){if(r.nodeId===c.nodeId&&r.type===c.type&&r.id===c.id)continue;const{x:d,y:h}=Uu(u,c,c.position,!0),p=Math.sqrt(Math.pow(d-e.x,2)+Math.pow(h-e.y,2));p>t||(p1){const u=r.type==="source"?"target":"source";return i.find(f=>f.type===u)??i[0]}return i[0]}function RR(e,t,n,r,i,s=!1){var u,f,c;const o=r.get(e);if(!o)return null;const a=i==="strict"?(u=o.internals.handleBounds)==null?void 0:u[t]:[...((f=o.internals.handleBounds)==null?void 0:f.source)??[],...((c=o.internals.handleBounds)==null?void 0:c.target)??[]],l=(n?a==null?void 0:a.find(d=>d.id===n):a==null?void 0:a[0])??null;return l&&s?{...l,...Uu(o,l,l.position,!0)}:l}function IR(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function QQ(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const DR=()=>!0;function ZQ(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:s,isTarget:o,domNode:a,nodeLookup:l,lib:u,autoPanOnConnect:f,flowId:c,panBy:d,cancelConnection:h,onConnectStart:p,onConnect:m,onConnectEnd:w,isValidConnection:y=DR,onReconnectEnd:v,updateConnection:g,getTransform:x,getFromHandle:S,autoPanSpeed:k}){const C=ER(e.target);let T=0,O;const{x:A,y:j}=Jr(e),L=C==null?void 0:C.elementFromPoint(A,j),B=IR(s,L),N=a==null?void 0:a.getBoundingClientRect();if(!N||!B)return;const M=RR(i,B,r,l,t);if(!M)return;let I=Jr(e,N),F=!1,P=null,D=!1,_=null;function V(){if(!f||!N)return;const[le,de]=wR(I,N,k);d({x:le,y:de}),T=requestAnimationFrame(V)}const W={...M,nodeId:i,type:B,position:M.position},R=l.get(i),J={inProgress:!0,isValid:null,from:Uu(R,W,se.Left,!0),fromHandle:W,fromPosition:W.position,fromNode:R,to:I,toHandle:null,toPosition:ME[W.position],toNode:null};g(J);let Y=J;p==null||p(e,{nodeId:i,handleId:r,handleType:B});function re(le){if(!S()||!W){G(le);return}const de=x();I=Jr(le,N),O=XQ(yc(I,de,!1,[1,1]),n,l,W),F||(V(),F=!0);const ue=MR(le,{handle:O,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?"target":"source",isValidConnection:y,doc:C,lib:u,flowId:c,nodeLookup:l});_=ue.handleDomNode,P=ue.connection,D=QQ(!!O,ue.isValid);const ie={...Y,isValid:D,to:O&&D?bR({x:O.x,y:O.y},de):I,toHandle:ue.toHandle,toPosition:D&&ue.toHandle?ue.toHandle.position:ME[W.position],toNode:ue.toHandle?l.get(ue.toHandle.nodeId):null};D&&O&&Y.toHandle&&ie.toHandle&&Y.toHandle.type===ie.toHandle.type&&Y.toHandle.nodeId===ie.toHandle.nodeId&&Y.toHandle.id===ie.toHandle.id&&Y.to.x===ie.to.x&&Y.to.y===ie.to.y||(g(ie),Y=ie)}function G(le){(O||_)&&P&&D&&(m==null||m(P));const{inProgress:de,...ue}=Y,ie={...ue,toPosition:Y.toHandle?Y.toPosition:null};w==null||w(le,ie),s&&(v==null||v(le,ie)),h(),cancelAnimationFrame(T),F=!1,D=!1,P=null,_=null,C.removeEventListener("mousemove",re),C.removeEventListener("mouseup",G),C.removeEventListener("touchmove",re),C.removeEventListener("touchend",G)}C.addEventListener("mousemove",re),C.addEventListener("mouseup",G),C.addEventListener("touchmove",re),C.addEventListener("touchend",G)}function MR(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:s,doc:o,lib:a,flowId:l,isValidConnection:u=DR,nodeLookup:f}){const c=s==="target",d=t?o.querySelector(`.${a}-flow__handle[data-id="${l}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y:p}=Jr(e),m=o.elementFromPoint(h,p),w=m!=null&&m.classList.contains(`${a}-flow__handle`)?m:d,y={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const v=IR(void 0,w),g=w.getAttribute("data-nodeid"),x=w.getAttribute("data-handleid"),S=w.classList.contains("connectable"),k=w.classList.contains("connectableend");if(!g||!v)return y;const C={source:c?g:r,sourceHandle:c?x:i,target:c?r:g,targetHandle:c?i:x};y.connection=C;const O=S&&k&&(n===ka.Strict?c&&v==="source"||!c&&v==="target":g!==r||x!==i);y.isValid=O&&u(C),y.toHandle=RR(g,v,x,f,n,!1)}return y}const j0={onPointerDown:ZQ,isValid:MR};function JQ({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const i=cn(e);function s({translateExtent:a,width:l,height:u,zoomStep:f=10,pannable:c=!0,zoomable:d=!0,inversePan:h=!1}){const p=g=>{const x=n();if(g.sourceEvent.type!=="wheel"||!t)return;const S=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*f,k=x[2]*Math.pow(2,S);t.scaleTo(k)};let m=[0,0];const w=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(m=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},y=g=>{const x=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;const S=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],k=[S[0]-m[0],S[1]-m[1]];m=S;const C=r()*Math.max(x[2],Math.log(x[2]))*(h?-1:1),T={x:x[0]-k[0]*C,y:x[1]-k[1]*C},O=[[0,0],[l,u]];t.setViewportConstrained({x:T.x,y:T.y,zoom:x[2]},O,a)},v=fR().on("start",w).on("zoom",c?y:null).on("zoom.wheel",d?p:null);i.call(v,{})}function o(){i.on("zoom",null)}return{update:s,destroy:o,pointer:Xn}}const eZ=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Cp=e=>({x:e.x,y:e.y,zoom:e.k}),ug=({x:e,y:t,zoom:n})=>wp.translate(e,t).scale(n),Bo=(e,t)=>e.target.closest(`.${t}`),jR=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),cg=(e,t=0,n=()=>{})=>{const r=typeof t=="number"&&t>0;return r||n(),r?e.transition().duration(t).on("end",n):e},FR=e=>{const t=e.ctrlKey&&fh()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function tZ({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:s,zoomOnPinch:o,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:u}){return f=>{if(Bo(f,t))return!1;f.preventDefault(),f.stopImmediatePropagation();const c=n.property("__zoom").k||1;if(f.ctrlKey&&o){const w=Xn(f),y=FR(f),v=c*Math.pow(2,y);r.scaleTo(n,v,w,f);return}const d=f.deltaMode===1?20:1;let h=i===js.Vertical?0:f.deltaX*d,p=i===js.Horizontal?0:f.deltaY*d;!fh()&&f.shiftKey&&i!==js.Vertical&&(h=f.deltaY*d,p=0),r.translateBy(n,-(h/c)*s,-(p/c)*s,{internal:!0});const m=Cp(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling||(e.isPanScrolling=!0,a==null||a(f,m)),e.isPanScrolling&&(l==null||l(f,m),e.panScrollTimeout=setTimeout(()=>{u==null||u(f,m),e.isPanScrolling=!1},150))}}function nZ({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){if(!t&&r.type==="wheel"&&!r.ctrlKey||Bo(r,e))return null;r.preventDefault(),n.call(this,r,i)}}function rZ({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var s,o,a;if((s=r.sourceEvent)!=null&&s.internal)return;const i=Cp(r.transform);e.mouseButton=((o=r.sourceEvent)==null?void 0:o.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=i,((a=r.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,i))}}function iZ({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return s=>{var o,a;e.usedRightMouseButton=!!(n&&jR(t,e.mouseButton??0)),(o=s.sourceEvent)!=null&&o.sync||r([s.transform.x,s.transform.y,s.transform.k]),i&&!((a=s.sourceEvent)!=null&&a.internal)&&(i==null||i(s.sourceEvent,Cp(s.transform)))}}function sZ({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:s}){return o=>{var a;if(!((a=o.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,s&&jR(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&s(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i&&eZ(e.prevViewport,o.transform))){const l=Cp(o.transform);e.prevViewport=l,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i==null||i(o.sourceEvent,l)},n?150:0)}}}function oZ({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:o,noWheelClassName:a,noPanClassName:l,lib:u}){return f=>{var p;const c=e||t,d=n&&f.ctrlKey;if(f.button===1&&f.type==="mousedown"&&(Bo(f,`${u}-flow__node`)||Bo(f,`${u}-flow__edge`)))return!0;if(!r&&!c&&!i&&!s&&!n||o||Bo(f,a)&&f.type==="wheel"||Bo(f,l)&&(f.type!=="wheel"||i&&f.type==="wheel"&&!e)||!n&&f.ctrlKey&&f.type==="wheel")return!1;if(!n&&f.type==="touchstart"&&((p=f.touches)==null?void 0:p.length)>1)return f.preventDefault(),!1;if(!c&&!i&&!d&&f.type==="wheel"||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const h=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||f.type==="wheel")&&h}}function aZ({domNode:e,minZoom:t,maxZoom:n,paneClickDistance:r,translateExtent:i,viewport:s,onPanZoom:o,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:u}){const f={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},c=e.getBoundingClientRect(),d=fR().clickDistance(!tr(r)||r<0?0:r).scaleExtent([t,n]).translateExtent(i),h=cn(e).call(d);g({x:s.x,y:s.y,zoom:Ea(s.zoom,t,n)},[[0,0],[c.width,c.height]],i);const p=h.on("wheel.zoom"),m=h.on("dblclick.zoom");d.wheelDelta(FR);function w(L,B){return h?new Promise(N=>{d==null||d.transform(cg(h,B==null?void 0:B.duration,()=>N(!0)),L)}):Promise.resolve(!1)}function y({noWheelClassName:L,noPanClassName:B,onPaneContextMenu:N,userSelectionActive:M,panOnScroll:I,panOnDrag:F,panOnScrollMode:P,panOnScrollSpeed:D,preventScrolling:_,zoomOnPinch:V,zoomOnScroll:W,zoomOnDoubleClick:R,zoomActivationKeyPressed:q,lib:J,onTransformChange:Y}){M&&!f.isZoomingOrPanning&&v();const G=I&&!q&&!M?tZ({zoomPanValues:f,noWheelClassName:L,d3Selection:h,d3Zoom:d,panOnScrollMode:P,panOnScrollSpeed:D,zoomOnPinch:V,onPanZoomStart:a,onPanZoom:o,onPanZoomEnd:l}):nZ({noWheelClassName:L,preventScrolling:_,d3ZoomHandler:p});if(h.on("wheel.zoom",G,{passive:!1}),!M){const de=rZ({zoomPanValues:f,onDraggingChange:u,onPanZoomStart:a});d.on("start",de);const ue=iZ({zoomPanValues:f,panOnDrag:F,onPaneContextMenu:!!N,onPanZoom:o,onTransformChange:Y});d.on("zoom",ue);const ie=sZ({zoomPanValues:f,panOnDrag:F,panOnScroll:I,onPaneContextMenu:N,onPanZoomEnd:l,onDraggingChange:u});d.on("end",ie)}const le=oZ({zoomActivationKeyPressed:q,panOnDrag:F,zoomOnScroll:W,panOnScroll:I,zoomOnDoubleClick:R,zoomOnPinch:V,userSelectionActive:M,noPanClassName:B,noWheelClassName:L,lib:J});d.filter(le),R?h.on("dblclick.zoom",m):h.on("dblclick.zoom",null)}function v(){d.on("zoom",null)}async function g(L,B,N){const M=ug(L),I=d==null?void 0:d.constrain()(M,B,N);return I&&await w(I),new Promise(F=>F(I))}async function x(L,B){const N=ug(L);return await w(N,B),new Promise(M=>M(N))}function S(L){if(h){const B=ug(L),N=h.property("__zoom");(N.k!==L.zoom||N.x!==L.x||N.y!==L.y)&&(d==null||d.transform(h,B,null,{sync:!0}))}}function k(){const L=h?cR(h.node()):{x:0,y:0,k:1};return{x:L.x,y:L.y,zoom:L.k}}function C(L,B){return h?new Promise(N=>{d==null||d.scaleTo(cg(h,B==null?void 0:B.duration,()=>N(!0)),L)}):Promise.resolve(!1)}function T(L,B){return h?new Promise(N=>{d==null||d.scaleBy(cg(h,B==null?void 0:B.duration,()=>N(!0)),L)}):Promise.resolve(!1)}function O(L){d==null||d.scaleExtent(L)}function A(L){d==null||d.translateExtent(L)}function j(L){const B=!tr(L)||L<0?0:L;d==null||d.clickDistance(B)}return{update:y,destroy:v,setViewport:x,setViewportConstrained:g,getViewport:k,scaleTo:C,scaleBy:T,setScaleExtent:O,setTranslateExtent:A,syncViewport:S,setClickDistance:j}}var tu;(function(e){e.Line="line",e.Handle="handle"})(tu||(tu={}));function lZ({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:s}){const o=e-t,a=n-r,l=[o>0?1:o<0?-1:0,a>0?1:a<0?-1:0];return o&&i&&(l[0]=l[0]*-1),a&&s&&(l[1]=l[1]*-1),l}function uZ(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),i=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:i}}function wi(e,t){return Math.max(0,t-e)}function xi(e,t){return Math.max(0,e-t)}function uf(e,t,n){return Math.max(0,t-e,e-n)}function qE(e,t){return e?!t:t}function cZ(e,t,n,r,i,s,o,a){let{affectsX:l,affectsY:u}=t;const{isHorizontal:f,isVertical:c}=t,d=f&&c,{xSnapped:h,ySnapped:p}=n,{minWidth:m,maxWidth:w,minHeight:y,maxHeight:v}=r,{x:g,y:x,width:S,height:k,aspectRatio:C}=e;let T=Math.floor(f?h-e.pointerX:0),O=Math.floor(c?p-e.pointerY:0);const A=S+(l?-T:T),j=k+(u?-O:O),L=-s[0]*S,B=-s[1]*k;let N=uf(A,m,w),M=uf(j,y,v);if(o){let P=0,D=0;l&&T<0?P=wi(g+T+L,o[0][0]):!l&&T>0&&(P=xi(g+A+L,o[1][0])),u&&O<0?D=wi(x+O+B,o[0][1]):!u&&O>0&&(D=xi(x+j+B,o[1][1])),N=Math.max(N,P),M=Math.max(M,D)}if(a){let P=0,D=0;l&&T>0?P=xi(g+T,a[0][0]):!l&&T<0&&(P=wi(g+A,a[1][0])),u&&O>0?D=xi(x+O,a[0][1]):!u&&O<0&&(D=wi(x+j,a[1][1])),N=Math.max(N,P),M=Math.max(M,D)}if(i){if(f){const P=uf(A/C,y,v)*C;if(N=Math.max(N,P),o){let D=0;!l&&!u||l&&!u&&d?D=xi(x+B+A/C,o[1][1])*C:D=wi(x+B+(l?T:-T)/C,o[0][1])*C,N=Math.max(N,D)}if(a){let D=0;!l&&!u||l&&!u&&d?D=wi(x+A/C,a[1][1])*C:D=xi(x+(l?T:-T)/C,a[0][1])*C,N=Math.max(N,D)}}if(c){const P=uf(j*C,m,w)/C;if(M=Math.max(M,P),o){let D=0;!l&&!u||u&&!l&&d?D=xi(g+j*C+L,o[1][0])/C:D=wi(g+(u?O:-O)*C+L,o[0][0])/C,M=Math.max(M,D)}if(a){let D=0;!l&&!u||u&&!l&&d?D=wi(g+j*C,a[1][0])/C:D=xi(g+(u?O:-O)*C,a[0][0])/C,M=Math.max(M,D)}}}O=O+(O<0?M:-M),T=T+(T<0?N:-N),i&&(d?A>j*C?O=(qE(l,u)?-T:T)/C:T=(qE(l,u)?-O:O)*C:f?(O=T/C,u=l):(T=O*C,l=u));const I=l?g+T:g,F=u?x+O:x;return{width:S+(l?-T:T),height:k+(u?-O:O),x:s[0]*T*(l?-1:1)+I,y:s[1]*O*(u?-1:1)+F}}const $R={width:0,height:0,x:0,y:0},fZ={...$R,pointerX:0,pointerY:0,aspectRatio:1};function dZ(e){return[[0,0],[e.measured.width,e.measured.height]]}function hZ(e,t,n){const r=t.position.x+e.position.x,i=t.position.y+e.position.y,s=e.measured.width??0,o=e.measured.height??0,a=n[0]*s,l=n[1]*o;return[[r-a,i-l],[r+s-a,i+o-l]]}function pZ({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){const s=cn(e);function o({controlPosition:l,boundaries:u,keepAspectRatio:f,onResizeStart:c,onResize:d,onResizeEnd:h,shouldResize:p}){let m={...$R},w={...fZ};const y=uZ(l);let v,g=[],x,S,k;const C=XL().on("start",T=>{const{nodeLookup:O,transform:A,snapGrid:j,snapToGrid:L,nodeOrigin:B}=n();if(v=O.get(t),!v)return;const{xSnapped:N,ySnapped:M}=eu(T.sourceEvent,{transform:A,snapGrid:j,snapToGrid:L});m={width:v.measured.width??0,height:v.measured.height??0,x:v.position.x??0,y:v.position.y??0},w={...m,pointerX:N,pointerY:M,aspectRatio:m.width/m.height},x=void 0,v.parentId&&(v.extent==="parent"||v.expandParent)&&(x=O.get(v.parentId),S=x&&v.extent==="parent"?dZ(x):void 0),g=[],k=void 0;for(const[I,F]of O)if(F.parentId===t&&(g.push({id:I,position:{...F.position},extent:F.extent}),F.extent==="parent"||F.expandParent)){const P=hZ(F,v,F.origin??B);k?k=[[Math.min(P[0][0],k[0][0]),Math.min(P[0][1],k[0][1])],[Math.max(P[1][0],k[1][0]),Math.max(P[1][1],k[1][1])]]:k=P}c==null||c(T,{...m})}).on("drag",T=>{const{transform:O,snapGrid:A,snapToGrid:j,nodeOrigin:L}=n(),B=eu(T.sourceEvent,{transform:O,snapGrid:A,snapToGrid:j}),N=[];if(!v)return;const{x:M,y:I,width:F,height:P}=m,D={},_=v.origin??L,{width:V,height:W,x:R,y:q}=cZ(w,y,B,u,f,_,S,k),J=V!==F,Y=W!==P,re=R!==M&&J,G=q!==I&&Y;if(!re&&!G&&!J&&!Y)return;if((re||G||_[0]===1||_[1]===1)&&(D.x=re?R:m.x,D.y=G?q:m.y,m.x=D.x,m.y=D.y,g.length>0)){const ie=R-M,pe=q-I;for(const Ne of g)Ne.position={x:Ne.position.x-ie+_[0]*(V-F),y:Ne.position.y-pe+_[1]*(W-P)},N.push(Ne)}if((J||Y)&&(D.width=J?V:m.width,D.height=Y?W:m.height,m.width=D.width,m.height=D.height),x&&v.expandParent){const ie=_[0]*(D.width??0);D.x&&D.x{h==null||h(T,{...m}),i==null||i()});s.call(C)}function a(){s.on(".drag",null)}return{update:o,destroy:a}}var BR={exports:{}},VR={},zR={exports:{}},UR={};/** * @license React * use-sync-external-store-shim.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var _a=E;function mZ(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var gZ=typeof Object.is=="function"?Object.is:mZ,yZ=_a.useState,vZ=_a.useEffect,wZ=_a.useLayoutEffect,xZ=_a.useDebugValue;function bZ(e,t){var n=t(),r=yZ({inst:{value:n,getSnapshot:t}}),i=r[0].inst,s=r[1];return wZ(function(){i.value=n,i.getSnapshot=t,fg(i)&&s({inst:i})},[e,n,t]),vZ(function(){return fg(i)&&s({inst:i}),e(function(){fg(i)&&s({inst:i})})},[e]),xZ(n),n}function fg(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!gZ(e,n)}catch{return!0}}function SZ(e,t){return t()}var kZ=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?SZ:bZ;UR.useSyncExternalStore=_a.useSyncExternalStore!==void 0?_a.useSyncExternalStore:kZ;zR.exports=UR;var EZ=zR.exports;/** * @license React * use-sync-external-store-shim/with-selector.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Tp=E,CZ=EZ;function TZ(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var _Z=typeof Object.is=="function"?Object.is:TZ,AZ=CZ.useSyncExternalStore,NZ=Tp.useRef,PZ=Tp.useEffect,OZ=Tp.useMemo,LZ=Tp.useDebugValue;VR.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var s=NZ(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=OZ(function(){function l(h){if(!u){if(u=!0,f=h,h=r(h),i!==void 0&&o.hasValue){var p=o.value;if(i(p,h))return c=p}return c=h}if(p=c,_Z(f,h))return p;var m=r(h);return i!==void 0&&i(p,m)?p:(f=h,c=m)}var u=!1,f,c,d=n===void 0?null:n;return[function(){return l(t())},d===null?void 0:function(){return l(d())}]},[t,n,r,i]);var a=AZ(e,s[0],s[1]);return PZ(function(){o.hasValue=!0,o.value=a},[a]),LZ(a),a};BR.exports=VR;var RZ=BR.exports;const IZ=ci(RZ),DZ={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},YE=e=>{let t;const n=new Set,r=(f,c)=>{const d=typeof f=="function"?f(t):f;if(!Object.is(d,t)){const h=t;t=c??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(p=>p(t,h))}},i=()=>t,l={setState:r,getState:i,getInitialState:()=>u,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(DZ?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(r,i,l);return l},MZ=e=>e?YE(e):YE,{useDebugValue:jZ}=we,{useSyncExternalStoreWithSelector:FZ}=IZ,$Z=e=>e;function HR(e,t=$Z,n){const r=FZ(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return jZ(r),r}const GE=(e,t)=>{const n=MZ(e),r=(i,s=t)=>HR(n,i,s);return Object.assign(r,n),r},BZ=(e,t)=>e?GE(e,t):GE;function Xe(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,i]of e)if(!Object.is(i,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const _p=E.createContext(null),VZ=_p.Provider,WR=hi.error001();function Te(e,t){const n=E.useContext(_p);if(n===null)throw new Error(WR);return HR(n,e,t)}function He(){const e=E.useContext(_p);if(e===null)throw new Error(WR);return E.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const XE={display:"none"},zZ={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},KR="react-flow__node-desc",qR="react-flow__edge-desc",UZ="react-flow__aria-live",HZ=e=>e.ariaLiveMessage;function WZ({rfId:e}){const t=Te(HZ);return b.jsx("div",{id:`${UZ}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:zZ,children:t})}function KZ({rfId:e,disableKeyboardA11y:t}){return b.jsxs(b.Fragment,{children:[b.jsxs("div",{id:`${KR}-${e}`,style:XE,children:["Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "]}),b.jsx("div",{id:`${qR}-${e}`,style:XE,children:"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."}),!t&&b.jsx(WZ,{rfId:e})]})}const qZ=e=>e.userSelectionActive?"none":"all";function Cx({position:e="top-left",children:t,className:n,style:r,...i}){const s=Te(qZ),o=`${e}`.split("-");return b.jsx("div",{className:ut(["react-flow__panel",n,...o]),style:{...r,pointerEvents:s},...i,children:t})}function YZ({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:b.jsx(Cx,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:b.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const GZ=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},cf=e=>e.id;function XZ(e,t){return Xe(e.selectedNodes.map(cf),t.selectedNodes.map(cf))&&Xe(e.selectedEdges.map(cf),t.selectedEdges.map(cf))}function QZ({onSelectionChange:e}){const t=He(),{selectedNodes:n,selectedEdges:r}=Te(GZ,XZ);return E.useEffect(()=>{const i={nodes:n,edges:r};e==null||e(i),t.getState().onSelectionChangeHandlers.forEach(s=>s(i))},[n,r,e]),null}const ZZ=e=>!!e.onSelectionChangeHandlers;function JZ({onSelectionChange:e}){const t=Te(ZZ);return e||t?b.jsx(QZ,{onSelectionChange:e}):null}const YR=[0,0],eJ={x:0,y:0,zoom:1},tJ=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","onBeforeDelete","debug","autoPanSpeed","paneClickDistance"],QE=[...tJ,"rfId"],nJ=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setPaneClickDistance:e.setPaneClickDistance}),ZE={translateExtent:$u,nodeOrigin:YR,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1",paneClickDistance:0};function rJ(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:s,setNodeExtent:o,reset:a,setDefaultNodesAndEdges:l,setPaneClickDistance:u}=Te(nJ,Xe),f=He();E.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{c.current=ZE,a()}),[]);const c=E.useRef(ZE);return E.useEffect(()=>{for(const d of QE){const h=e[d],p=c.current[d];h!==p&&(typeof e[d]>"u"||(d==="nodes"?t(h):d==="edges"?n(h):d==="minZoom"?r(h):d==="maxZoom"?i(h):d==="translateExtent"?s(h):d==="nodeExtent"?o(h):d==="paneClickDistance"?u(h):d==="fitView"?f.setState({fitViewOnInit:h}):d==="fitViewOptions"?f.setState({fitViewOnInitOptions:h}):f.setState({[d]:h})))}c.current=e},QE.map(d=>e[d])),null}function JE(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function iJ(e){var r;const[t,n]=E.useState(e==="system"?null:e);return E.useEffect(()=>{if(e!=="system"){n(e);return}const i=JE(),s=()=>n(i!=null&&i.matches?"dark":"light");return s(),i==null||i.addEventListener("change",s),()=>{i==null||i.removeEventListener("change",s)}},[e]),t!==null?t:(r=JE())!=null&&r.matches?"dark":"light"}const eC=typeof document<"u"?document:null;function Hu(e=null,t={target:eC,actInsideInputWithModifier:!0}){const[n,r]=E.useState(!1),i=E.useRef(!1),s=E.useRef(new Set([])),[o,a]=E.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(c=>typeof c=="string").map(c=>c.split("+")),f=u.reduce((c,d)=>c.concat(...d),[]);return[u,f]}return[[],[]]},[e]);return E.useEffect(()=>{const l=(t==null?void 0:t.target)||eC;if(e!==null){const u=d=>{if(i.current=d.ctrlKey||d.metaKey||d.shiftKey,(!i.current||i.current&&!t.actInsideInputWithModifier)&&R0(d))return!1;const p=nC(d.code,a);s.current.add(d[p]),tC(o,s.current,!1)&&(d.preventDefault(),r(!0))},f=d=>{if((!i.current||i.current&&!t.actInsideInputWithModifier)&&R0(d))return!1;const p=nC(d.code,a);tC(o,s.current,!0)?(r(!1),s.current.clear()):s.current.delete(d[p]),d.key==="Meta"&&s.current.clear(),i.current=!1},c=()=>{s.current.clear(),r(!1)};return l==null||l.addEventListener("keydown",u),l==null||l.addEventListener("keyup",f),window.addEventListener("blur",c),window.addEventListener("contextmenu",c),()=>{l==null||l.removeEventListener("keydown",u),l==null||l.removeEventListener("keyup",f),window.removeEventListener("blur",c),window.removeEventListener("contextmenu",c)}}},[e,r]),n}function tC(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function nC(e,t){return t.includes(e)?"code":"key"}const sJ=()=>{const e=He();return E.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,i,s],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??s},{duration:n==null?void 0:n.duration}),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},fitView:t=>{const{nodeLookup:n,width:r,height:i,minZoom:s,maxZoom:o,panZoom:a}=e.getState(),l=P0(n,t);return a?O0({nodes:l,width:r,height:i,minZoom:s,maxZoom:o,panZoom:a},t):Promise.resolve(!1)},setCenter:async(t,n,r)=>{const{width:i,height:s,maxZoom:o,panZoom:a}=e.getState(),l=typeof(r==null?void 0:r.zoom)<"u"?r.zoom:o,u=i/2-t*l,f=s/2-n*l;return a?(await a.setViewport({x:u,y:f,zoom:l},{duration:r==null?void 0:r.duration}),Promise.resolve(!0)):Promise.resolve(!1)},fitBounds:async(t,n)=>{const{width:r,height:i,minZoom:s,maxZoom:o,panZoom:a}=e.getState(),l=wx(t,r,i,s,o,(n==null?void 0:n.padding)??.1);return a?(await a.setViewport(l,{duration:n==null?void 0:n.duration}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={snapToGrid:!0})=>{const{transform:r,snapGrid:i,domNode:s}=e.getState();if(!s)return t;const{x:o,y:a}=s.getBoundingClientRect(),l={x:t.x-o,y:t.y-a};return yc(l,r,n.snapToGrid,i)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:i,y:s}=r.getBoundingClientRect(),o=bR(t,n);return{x:o.x+i,y:o.y+s}}}),[])};function GR(e,t){const n=[],r=new Map,i=[];for(const s of e)if(s.type==="add"){i.push(s);continue}else if(s.type==="remove"||s.type==="replace")r.set(s.id,[s]);else{const o=r.get(s.id);o?o.push(s):r.set(s.id,[s])}for(const s of t){const o=r.get(s.id);if(!o){n.push(s);continue}if(o[0].type==="remove")continue;if(o[0].type==="replace"){n.push({...o[0].item});continue}const a={...s};for(const l of o)oJ(l,a);n.push(a)}return i.length&&i.forEach(s=>{s.index!==void 0?n.splice(s.index,0,{...s.item}):n.push({...s.item})}),n}function oJ(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured??(t.measured={}),t.measured.width=e.dimensions.width,t.measured.height=e.dimensions.height,e.setAttributes&&(t.width=e.dimensions.width,t.height=e.dimensions.height)),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function XR(e,t){return GR(e,t)}function QR(e,t){return GR(e,t)}function Ss(e,t){return{id:e,type:"select",selected:t}}function Vo(e,t=new Set,n=!1){const r=[];for(const[i,s]of e){const o=t.has(i);!(s.selected===void 0&&!o)&&s.selected!==o&&(n&&(s.selected=o),r.push(Ss(s.id,o)))}return r}function rC({items:e=[],lookup:t}){var i;const n=[],r=new Map(e.map(s=>[s.id,s]));for(const[s,o]of e.entries()){const a=t.get(o.id),l=((i=a==null?void 0:a.internals)==null?void 0:i.userNode)??a;l!==void 0&&l!==o&&n.push({id:o.id,item:o,type:"replace"}),l===void 0&&n.push({item:o,type:"add",index:s})}for(const[s]of t)r.get(s)===void 0&&n.push({id:s,type:"remove"});return n}function iC(e){return{id:e.id,type:"remove"}}const sC=e=>CQ(e),aJ=e=>mR(e);function ZR(e){return E.forwardRef(e)}const lJ=typeof window<"u"?E.useLayoutEffect:E.useEffect;function oC(e){const[t,n]=E.useState(!1),[r]=E.useState(()=>uJ(()=>n(!0)));return lJ(()=>{if(!t){r.reset();return}const i=r.get();i.length&&(e(i),r.reset()),n(!1)},[t]),r}function uJ(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const JR=E.createContext(null);function cJ({children:e}){const t=He(),n=E.useCallback(a=>{const{nodes:l=[],setNodes:u,hasDefaultNodes:f,onNodesChange:c,nodeLookup:d}=t.getState();let h=l;for(const p of a)h=typeof p=="function"?p(h):p;f?u(h):c&&c(rC({items:h,lookup:d}))},[]),r=oC(n),i=E.useCallback(a=>{const{edges:l=[],setEdges:u,hasDefaultEdges:f,onEdgesChange:c,edgeLookup:d}=t.getState();let h=l;for(const p of a)h=typeof p=="function"?p(h):p;f?u(h):c&&c(rC({items:h,lookup:d}))},[]),s=oC(i),o=E.useMemo(()=>({nodeQueue:r,edgeQueue:s}),[]);return b.jsx(JR.Provider,{value:o,children:e})}function fJ(){const e=E.useContext(JR);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const dJ=e=>!!e.panZoom;function Tx(){const e=sJ(),t=He(),n=fJ(),r=Te(dJ),i=E.useMemo(()=>{const s=c=>t.getState().nodeLookup.get(c),o=c=>{n.nodeQueue.push(c)},a=c=>{n.edgeQueue.push(c)},l=c=>{var y,v;const{nodeLookup:d,nodeOrigin:h}=t.getState(),p=sC(c)?c:d.get(c.id),m=p.parentId?kR(p.position,p.measured,p.parentId,d,h):p.position,w={id:p.id,position:m,width:((y=p.measured)==null?void 0:y.width)??p.width,height:((v=p.measured)==null?void 0:v.height)??p.height,data:p.data};return Ta(w)},u=(c,d,h={replace:!1})=>{o(p=>p.map(m=>{if(m.id===c){const w=typeof d=="function"?d(m):d;return h.replace&&sC(w)?w:{...m,...w}}return m}))},f=(c,d,h={replace:!1})=>{a(p=>p.map(m=>{if(m.id===c){const w=typeof d=="function"?d(m):d;return h.replace&&aJ(w)?w:{...m,...w}}return m}))};return{getNodes:()=>t.getState().nodes.map(c=>({...c})),getNode:c=>{var d;return(d=s(c))==null?void 0:d.internals.userNode},getInternalNode:s,getEdges:()=>{const{edges:c=[]}=t.getState();return c.map(d=>({...d}))},getEdge:c=>t.getState().edgeLookup.get(c),setNodes:o,setEdges:a,addNodes:c=>{const d=Array.isArray(c)?c:[c];n.nodeQueue.push(h=>[...h,...d])},addEdges:c=>{const d=Array.isArray(c)?c:[c];n.edgeQueue.push(h=>[...h,...d])},toObject:()=>{const{nodes:c=[],edges:d=[],transform:h}=t.getState(),[p,m,w]=h;return{nodes:c.map(y=>({...y})),edges:d.map(y=>({...y})),viewport:{x:p,y:m,zoom:w}}},deleteElements:async({nodes:c=[],edges:d=[]})=>{const{nodes:h,edges:p,onNodesDelete:m,onEdgesDelete:w,triggerNodeChanges:y,triggerEdgeChanges:v,onDelete:g,onBeforeDelete:x}=t.getState(),{nodes:S,edges:k}=await AQ({nodesToRemove:c,edgesToRemove:d,nodes:h,edges:p,onBeforeDelete:x}),C=k.length>0,T=S.length>0;if(C){const O=k.map(iC);w==null||w(k),v(O)}if(T){const O=S.map(iC);m==null||m(S),y(O)}return(T||C)&&(g==null||g({nodes:S,edges:k})),{deletedNodes:S,deletedEdges:k}},getIntersectingNodes:(c,d=!0,h)=>{const p=FE(c),m=p?c:l(c),w=h!==void 0;return m?(h||t.getState().nodes).filter(y=>{const v=t.getState().nodeLookup.get(y.id);if(v&&!p&&(y.id===c.id||!v.internals.positionAbsolute))return!1;const g=Ta(w?y:v),x=Vu(g,m);return d&&x>0||x>=m.width*m.height}):[]},isNodeIntersecting:(c,d,h=!0)=>{const m=FE(c)?c:l(c);if(!m)return!1;const w=Vu(m,d);return h&&w>0||w>=m.width*m.height},updateNode:u,updateNodeData:(c,d,h={replace:!1})=>{u(c,p=>{const m=typeof d=="function"?d(p):d;return h.replace?{...p,data:m}:{...p,data:{...p.data,...m}}},h)},updateEdge:f,updateEdgeData:(c,d,h={replace:!1})=>{f(c,p=>{const m=typeof d=="function"?d(p):d;return h.replace?{...p,data:m}:{...p,data:{...p.data,...m}}},h)},getNodesBounds:c=>{const{nodeLookup:d,nodeOrigin:h}=t.getState();return TQ(c,{nodeLookup:d,nodeOrigin:h})},getHandleConnections:({type:c,id:d,nodeId:h})=>{var p;return Array.from(((p=t.getState().connectionLookup.get(`${h}-${c}-${d??null}`))==null?void 0:p.values())??[])}}},[]);return E.useMemo(()=>({...i,...e,viewportInitialized:r}),[r])}const aC=e=>e.selected,hJ={actInsideInputWithModifier:!1},pJ=typeof window<"u"?window:void 0;function mJ({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=He(),{deleteElements:r}=Tx(),i=Hu(e,hJ),s=Hu(t,{target:pJ});E.useEffect(()=>{if(i){const{edges:o,nodes:a}=n.getState();r({nodes:a.filter(aC),edges:o.filter(aC)}),n.setState({nodesSelectionActive:!1})}},[i]),E.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function gJ(e){const t=He();E.useEffect(()=>{const n=()=>{var i,s;if(!e.current)return!1;const r=xx(e.current);(r.height===0||r.width===0)&&((s=(i=t.getState()).onError)==null||s.call(i,"004",hi.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const Ap={position:"absolute",width:"100%",height:"100%",top:0,left:0},yJ=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib});function vJ({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:s=js.Free,zoomOnDoubleClick:o=!0,panOnDrag:a=!0,defaultViewport:l,translateExtent:u,minZoom:f,maxZoom:c,zoomActivationKeyCode:d,preventScrolling:h=!0,children:p,noWheelClassName:m,noPanClassName:w,onViewportChange:y,isControlledViewport:v,paneClickDistance:g}){const x=He(),S=E.useRef(null),{userSelectionActive:k,lib:C}=Te(yJ,Xe),T=Hu(d),O=E.useRef();gJ(S);const A=E.useCallback(j=>{y==null||y({x:j[0],y:j[1],zoom:j[2]}),v||x.setState({transform:j})},[y,v]);return E.useEffect(()=>{if(S.current){O.current=aZ({domNode:S.current,minZoom:f,maxZoom:c,translateExtent:u,viewport:l,paneClickDistance:g,onDraggingChange:N=>x.setState({paneDragging:N}),onPanZoomStart:(N,M)=>{const{onViewportChangeStart:I,onMoveStart:F}=x.getState();F==null||F(N,M),I==null||I(M)},onPanZoom:(N,M)=>{const{onViewportChange:I,onMove:F}=x.getState();F==null||F(N,M),I==null||I(M)},onPanZoomEnd:(N,M)=>{const{onViewportChangeEnd:I,onMoveEnd:F}=x.getState();F==null||F(N,M),I==null||I(M)}});const{x:j,y:L,zoom:B}=O.current.getViewport();return x.setState({panZoom:O.current,transform:[j,L,B],domNode:S.current.closest(".react-flow")}),()=>{var N;(N=O.current)==null||N.destroy()}}},[]),E.useEffect(()=>{var j;(j=O.current)==null||j.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:s,zoomOnDoubleClick:o,panOnDrag:a,zoomActivationKeyPressed:T,preventScrolling:h,noPanClassName:w,userSelectionActive:k,noWheelClassName:m,lib:C,onTransformChange:A})},[e,t,n,r,i,s,o,a,T,h,w,k,m,C,A]),b.jsx("div",{className:"react-flow__renderer",ref:S,style:Ap,children:p})}const wJ=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function xJ(){const{userSelectionActive:e,userSelectionRect:t}=Te(wJ,Xe);return e&&t?b.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const dg=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},bJ=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging});function SJ({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Bu.Full,panOnDrag:r,selectionOnDrag:i,onSelectionStart:s,onSelectionEnd:o,onPaneClick:a,onPaneContextMenu:l,onPaneScroll:u,onPaneMouseEnter:f,onPaneMouseMove:c,onPaneMouseLeave:d,children:h}){const p=E.useRef(null),m=He(),w=E.useRef(0),y=E.useRef(0),v=E.useRef(),g=E.useRef(new Map),{userSelectionActive:x,elementsSelectable:S,dragging:k}=Te(bJ,Xe),C=S&&(e||x),T=E.useRef(!1),O=E.useRef(!1),A=()=>{m.setState({userSelectionActive:!1,userSelectionRect:null}),w.current=0,y.current=0},j=P=>{if(T.current){T.current=!1;return}a==null||a(P),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1})},L=P=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){P.preventDefault();return}l==null||l(P)},B=u?P=>u(P):void 0,N=P=>{var q,J,Y,re;const{resetSelectedElements:D,domNode:_,edgeLookup:V}=m.getState();if(v.current=_==null?void 0:_.getBoundingClientRect(),!S||!e||P.button!==0||P.target!==p.current||!v.current)return;(J=(q=P.target)==null?void 0:q.setPointerCapture)==null||J.call(q,P.pointerId),O.current=!0,T.current=!1,g.current=new Map;for(const[G,le]of V)g.current.set(le.source,((Y=g.current.get(le.source))==null?void 0:Y.add(G))||new Set([G])),g.current.set(le.target,((re=g.current.get(le.target))==null?void 0:re.add(G))||new Set([G]));const{x:W,y:R}=Jr(P.nativeEvent,v.current);D(),m.setState({userSelectionRect:{width:0,height:0,startX:W,startY:R,x:W,y:R}}),s==null||s(P)},M=P=>{const{userSelectionRect:D,edgeLookup:_,transform:V,nodeLookup:W,triggerNodeChanges:R,triggerEdgeChanges:q}=m.getState();if(!v.current||!D)return;T.current=!0;const{x:J,y:Y}=Jr(P.nativeEvent,v.current),{startX:re,startY:G}=D,le={startX:re,startY:G,x:J{var _,V;if(P.button!==0||!O.current)return;(V=(_=P.target)==null?void 0:_.releasePointerCapture)==null||V.call(_,P.pointerId);const{userSelectionRect:D}=m.getState();!x&&D&&P.target===p.current&&(j==null||j(P)),w.current>0&&m.setState({nodesSelectionActive:!0}),A(),o==null||o(P),(t||i)&&(T.current=!1),O.current=!1},F=r===!0||Array.isArray(r)&&r.includes(0);return b.jsxs("div",{className:ut(["react-flow__pane",{draggable:F,dragging:k,selection:e}]),onClick:C?void 0:dg(j,p),onContextMenu:dg(L,p),onWheel:dg(B,p),onPointerEnter:C?void 0:f,onPointerDown:C?N:c,onPointerMove:C?M:c,onPointerUp:C?I:void 0,onPointerLeave:d,ref:p,style:Ap,children:[h,b.jsx(xJ,{})]})}function F0({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:s,multiSelectionActive:o,nodeLookup:a,onError:l}=t.getState(),u=a.get(e);if(!u){l==null||l("012",hi.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&o)&&(s({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var f;return(f=r==null?void 0:r.current)==null?void 0:f.blur()})):i([e])}function eI({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:s,nodeClickDistance:o}){const a=He(),[l,u]=E.useState(!1),f=E.useRef();return E.useEffect(()=>{f.current=qQ({getStoreItems:()=>a.getState(),onNodeMouseDown:c=>{F0({id:c,store:a,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),E.useEffect(()=>{var c,d;if(t)(c=f.current)==null||c.destroy();else if(e.current)return(d=f.current)==null||d.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:s,nodeId:i,nodeClickDistance:o}),()=>{var h;(h=f.current)==null||h.destroy()}},[n,r,t,s,e,i]),l}const kJ=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function tI(){const e=He();return E.useCallback(n=>{const{nodeExtent:r,snapToGrid:i,snapGrid:s,nodesDraggable:o,onError:a,updateNodePositions:l,nodeLookup:u,nodeOrigin:f}=e.getState(),c=new Map,d=kJ(o),h=i?s[0]:5,p=i?s[1]:5,m=n.direction.x*h*n.factor,w=n.direction.y*p*n.factor;for(const[,y]of u){if(!d(y))continue;let v={x:y.internals.positionAbsolute.x+m,y:y.internals.positionAbsolute.y+w};i&&(v=kp(v,s));const{position:g,positionAbsolute:x}=yR({nodeId:y.id,nextPosition:v,nodeLookup:u,nodeExtent:r,nodeOrigin:f,onError:a});y.position=g,y.internals.positionAbsolute=x,c.set(y.id,y)}l(c)},[])}const _x=E.createContext(null),EJ=_x.Provider;_x.Consumer;const nI=()=>E.useContext(_x),CJ=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),TJ=(e,t,n)=>r=>{const{connectionClickStartHandle:i,connectionMode:s,connection:o}=r,{fromHandle:a,toHandle:l,isValid:u}=o,f=(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===n;return{connectingFrom:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===t&&(a==null?void 0:a.type)===n,connectingTo:f,clickConnecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.id)===t&&(i==null?void 0:i.type)===n,isPossibleEndHandle:s===ka.Strict?(a==null?void 0:a.type)!==n:e!==(a==null?void 0:a.nodeId)||t!==(a==null?void 0:a.id),connectionInProcess:!!a,valid:f&&u}};function _J({type:e="source",position:t=se.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:s=!0,id:o,onConnect:a,children:l,className:u,onMouseDown:f,onTouchStart:c,...d},h){var N,M;const p=o||null,m=e==="target",w=He(),y=nI(),{connectOnClick:v,noPanClassName:g,rfId:x}=Te(CJ,Xe),{connectingFrom:S,connectingTo:k,clickConnecting:C,isPossibleEndHandle:T,connectionInProcess:O,valid:A}=Te(TJ(y,p,e),Xe);y||(M=(N=w.getState()).onError)==null||M.call(N,"010",hi.error010());const j=I=>{const{defaultEdgeOptions:F,onConnect:P,hasDefaultEdges:D}=w.getState(),_={...F,...I};if(D){const{edges:V,setEdges:W}=w.getState();W(AR(_,V))}P==null||P(_),a==null||a(_)},L=I=>{if(!y)return;const F=CR(I.nativeEvent);if(i&&(F&&I.button===0||!F)){const P=w.getState();j0.onPointerDown(I.nativeEvent,{autoPanOnConnect:P.autoPanOnConnect,connectionMode:P.connectionMode,connectionRadius:P.connectionRadius,domNode:P.domNode,nodeLookup:P.nodeLookup,lib:P.lib,isTarget:m,handleId:p,nodeId:y,flowId:P.rfId,panBy:P.panBy,cancelConnection:P.cancelConnection,onConnectStart:P.onConnectStart,onConnectEnd:P.onConnectEnd,updateConnection:P.updateConnection,onConnect:j,isValidConnection:n||P.isValidConnection,getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,autoPanSpeed:P.autoPanSpeed})}F?f==null||f(I):c==null||c(I)},B=I=>{const{onClickConnectStart:F,onClickConnectEnd:P,connectionClickStartHandle:D,connectionMode:_,isValidConnection:V,lib:W,rfId:R,nodeLookup:q,connection:J}=w.getState();if(!y||!D&&!i)return;if(!D){F==null||F(I.nativeEvent,{nodeId:y,handleId:p,handleType:e}),w.setState({connectionClickStartHandle:{nodeId:y,type:e,id:p}});return}const Y=ER(I.target),re=n||V,{connection:G,isValid:le}=j0.isValid(I.nativeEvent,{handle:{nodeId:y,id:p,type:e},connectionMode:_,fromNodeId:D.nodeId,fromHandleId:D.id||null,fromType:D.type,isValidConnection:re,flowId:R,doc:Y,lib:W,nodeLookup:q});le&&G&&j(G);const de=structuredClone(J);delete de.inProgress,de.toPosition=de.toHandle?de.toHandle.position:null,P==null||P(I,de),w.setState({connectionClickStartHandle:null})};return b.jsx("div",{"data-handleid":p,"data-nodeid":y,"data-handlepos":t,"data-id":`${x}-${y}-${p}-${e}`,className:ut(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",g,u,{source:!m,target:m,connectable:r,connectablestart:i,connectableend:s,clickconnecting:C,connectingfrom:S,connectingto:k,valid:A,connectionindicator:r&&(!O||T)&&(O?s:i)}]),onMouseDown:L,onTouchStart:L,onClick:v?B:void 0,ref:h,...d,children:l})}const An=E.memo(ZR(_J));function AJ({data:e,isConnectable:t,sourcePosition:n=se.Bottom}){return b.jsxs(b.Fragment,{children:[e==null?void 0:e.label,b.jsx(An,{type:"source",position:n,isConnectable:t})]})}function NJ({data:e,isConnectable:t,targetPosition:n=se.Top,sourcePosition:r=se.Bottom}){return b.jsxs(b.Fragment,{children:[b.jsx(An,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,b.jsx(An,{type:"source",position:r,isConnectable:t})]})}function PJ(){return null}function OJ({data:e,isConnectable:t,targetPosition:n=se.Top}){return b.jsxs(b.Fragment,{children:[b.jsx(An,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const dh={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},lC={input:AJ,default:NJ,output:OJ,group:PJ};function LJ(e){var t,n,r,i;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((i=e.style)==null?void 0:i.height)}}const RJ=e=>{const{width:t,height:n,x:r,y:i}=gc(e.nodeLookup,{filter:s=>!!s.selected});return{width:tr(t)?t:null,height:tr(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function IJ({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=He(),{width:i,height:s,transformString:o,userSelectionActive:a}=Te(RJ,Xe),l=tI(),u=E.useRef(null);if(E.useEffect(()=>{var d;n||(d=u.current)==null||d.focus({preventScroll:!0})},[n]),eI({nodeRef:u}),a||!i||!s)return null;const f=e?d=>{const h=r.getState().nodes.filter(p=>p.selected);e(d,h)}:void 0,c=d=>{Object.prototype.hasOwnProperty.call(dh,d.key)&&l({direction:dh[d.key],factor:d.shiftKey?4:1})};return b.jsx("div",{className:ut(["react-flow__nodesselection","react-flow__container",t]),style:{transform:o},children:b.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:c,style:{width:i,height:s}})})}const uC=typeof window<"u"?window:void 0,DJ=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function rI({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:o,paneClickDistance:a,deleteKeyCode:l,selectionKeyCode:u,selectionOnDrag:f,selectionMode:c,onSelectionStart:d,onSelectionEnd:h,multiSelectionKeyCode:p,panActivationKeyCode:m,zoomActivationKeyCode:w,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:g,panOnScroll:x,panOnScrollSpeed:S,panOnScrollMode:k,zoomOnDoubleClick:C,panOnDrag:T,defaultViewport:O,translateExtent:A,minZoom:j,maxZoom:L,preventScrolling:B,onSelectionContextMenu:N,noWheelClassName:M,noPanClassName:I,disableKeyboardA11y:F,onViewportChange:P,isControlledViewport:D}){const{nodesSelectionActive:_,userSelectionActive:V}=Te(DJ),W=Hu(u,{target:uC}),R=Hu(m,{target:uC}),q=R||T,J=R||x,Y=f&&q!==!0,re=W||V||Y;return mJ({deleteKeyCode:l,multiSelectionKeyCode:p}),b.jsx(vJ,{onPaneContextMenu:s,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:g,panOnScroll:J,panOnScrollSpeed:S,panOnScrollMode:k,zoomOnDoubleClick:C,panOnDrag:!W&&q,defaultViewport:O,translateExtent:A,minZoom:j,maxZoom:L,zoomActivationKeyCode:w,preventScrolling:B,noWheelClassName:M,noPanClassName:I,onViewportChange:P,isControlledViewport:D,paneClickDistance:a,children:b.jsxs(SJ,{onSelectionStart:d,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:o,panOnDrag:q,isSelecting:!!re,selectionMode:c,selectionKeyPressed:W,selectionOnDrag:Y,children:[e,_&&b.jsx(IJ,{onSelectionContextMenu:N,noPanClassName:I,disableKeyboardA11y:F})]})})}rI.displayName="FlowRenderer";const MJ=E.memo(rI),jJ=e=>t=>e?gR(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function FJ(e){return Te(E.useCallback(jJ(e),[e]),Xe)}const $J=e=>e.updateNodeInternals;function BJ(){const e=Te($J),[t]=E.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(i=>{const s=i.target.getAttribute("data-id");r.set(s,{id:s,nodeElement:i.target,force:!0})}),e(r)}));return E.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function VJ({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const i=He(),s=E.useRef(null),o=E.useRef(null),a=E.useRef(e.sourcePosition),l=E.useRef(e.targetPosition),u=E.useRef(t),f=n&&!!e.internals.handleBounds;return E.useEffect(()=>{s.current&&!e.hidden&&(!f||o.current!==s.current)&&(o.current&&(r==null||r.unobserve(o.current)),r==null||r.observe(s.current),o.current=s.current)},[f,e.hidden]),E.useEffect(()=>()=>{o.current&&(r==null||r.unobserve(o.current),o.current=null)},[]),E.useEffect(()=>{if(s.current){const c=u.current!==t,d=a.current!==e.sourcePosition,h=l.current!==e.targetPosition;(c||d||h)&&(u.current=t,a.current=e.sourcePosition,l.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),s}function zJ({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:s,onDoubleClick:o,nodesDraggable:a,elementsSelectable:l,nodesConnectable:u,nodesFocusable:f,resizeObserver:c,noDragClassName:d,noPanClassName:h,disableKeyboardA11y:p,rfId:m,nodeTypes:w,nodeExtent:y,nodeClickDistance:v,onError:g}){const{node:x,internals:S,isParent:k}=Te(G=>{const le=G.nodeLookup.get(e),de=G.parentLookup.has(e);return{node:le,internals:le.internals,isParent:de}},Xe);let C=x.type||"default",T=(w==null?void 0:w[C])||lC[C];T===void 0&&(g==null||g("003",hi.error003(C)),C="default",T=lC.default);const O=!!(x.draggable||a&&typeof x.draggable>"u"),A=!!(x.selectable||l&&typeof x.selectable>"u"),j=!!(x.connectable||u&&typeof x.connectable>"u"),L=!!(x.focusable||f&&typeof x.focusable>"u"),B=He(),N=SR(x),M=VJ({node:x,nodeType:C,hasDimensions:N,resizeObserver:c}),I=eI({nodeRef:M,disabled:x.hidden||!O,noDragClassName:d,handleSelector:x.dragHandle,nodeId:e,isSelectable:A,nodeClickDistance:v}),F=tI();if(x.hidden)return null;const P=cs(x),D=LJ(x),_=A||O||t||n||r||i,V=n?G=>n(G,{...S.userNode}):void 0,W=r?G=>r(G,{...S.userNode}):void 0,R=i?G=>i(G,{...S.userNode}):void 0,q=s?G=>s(G,{...S.userNode}):void 0,J=o?G=>o(G,{...S.userNode}):void 0,Y=G=>{const{selectNodesOnDrag:le,nodeDragThreshold:de}=B.getState();A&&(!le||!O||de>0)&&F0({id:e,store:B,nodeRef:M}),t&&t(G,{...S.userNode})},re=G=>{if(!(R0(G.nativeEvent)||p))if(dR.includes(G.key)&&A){const le=G.key==="Escape";F0({id:e,store:B,unselect:le,nodeRef:M})}else O&&x.selected&&Object.prototype.hasOwnProperty.call(dh,G.key)&&(B.setState({ariaLiveMessage:`Moved selected node ${G.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~S.positionAbsolute.x}, y: ${~~S.positionAbsolute.y}`}),F({direction:dh[G.key],factor:G.shiftKey?4:1}))};return b.jsx("div",{className:ut(["react-flow__node",`react-flow__node-${C}`,{[h]:O},x.className,{selected:x.selected,selectable:A,parent:k,draggable:O,dragging:I}]),ref:M,style:{zIndex:S.z,transform:`translate(${S.positionAbsolute.x}px,${S.positionAbsolute.y}px)`,pointerEvents:_?"all":"none",visibility:N?"visible":"hidden",...x.style,...D},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:V,onMouseMove:W,onMouseLeave:R,onContextMenu:q,onClick:Y,onDoubleClick:J,onKeyDown:L?re:void 0,tabIndex:L?0:void 0,role:L?"button":void 0,"aria-describedby":p?void 0:`${KR}-${m}`,"aria-label":x.ariaLabel,children:b.jsx(EJ,{value:e,children:b.jsx(T,{id:e,data:x.data,type:C,positionAbsoluteX:S.positionAbsolute.x,positionAbsoluteY:S.positionAbsolute.y,selected:x.selected,selectable:A,draggable:O,deletable:x.deletable??!0,isConnectable:j,sourcePosition:x.sourcePosition,targetPosition:x.targetPosition,dragging:I,dragHandle:x.dragHandle,zIndex:S.z,parentId:x.parentId,...P})})})}const UJ=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function iI(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:s}=Te(UJ,Xe),o=FJ(e.onlyRenderVisibleElements),a=BJ();return b.jsx("div",{className:"react-flow__nodes",style:Ap,children:o.map(l=>b.jsx(zJ,{id:l,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:a,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:s},l))})}iI.displayName="NodeRenderer";const HJ=E.memo(iI);function WJ(e){return Te(E.useCallback(n=>{if(!e)return n.edges.map(i=>i.id);const r=[];if(n.width&&n.height)for(const i of n.edges){const s=n.nodeLookup.get(i.source),o=n.nodeLookup.get(i.target);s&&o&&LQ({sourceNode:s,targetNode:o,width:n.width,height:n.height,transform:n.transform})&&r.push(i.id)}return r},[e]),Xe)}const KJ=({color:e="none",strokeWidth:t=1})=>b.jsx("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),qJ=({color:e="none",strokeWidth:t=1})=>b.jsx("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),cC={[Xs.Arrow]:KJ,[Xs.ArrowClosed]:qJ};function YJ(e){const t=He();return E.useMemo(()=>{var i,s;return Object.prototype.hasOwnProperty.call(cC,e)?cC[e]:((s=(i=t.getState()).onError)==null||s.call(i,"009",hi.error009(e)),null)},[e])}const GJ=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:s="strokeWidth",strokeWidth:o,orient:a="auto-start-reverse"})=>{const l=YJ(t);return l?b.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:a,refX:"0",refY:"0",children:b.jsx(l,{color:n,strokeWidth:o})}):null},sI=({defaultColor:e,rfId:t})=>{const n=Te(s=>s.edges),r=Te(s=>s.defaultEdgeOptions),i=E.useMemo(()=>$Q(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return i.length?b.jsx("svg",{className:"react-flow__marker",children:b.jsx("defs",{children:i.map(s=>b.jsx(GJ,{id:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient},s.id))})}):null};sI.displayName="MarkerDefinitions";var XJ=E.memo(sI);function oI({x:e,y:t,label:n,labelStyle:r={},labelShowBg:i=!0,labelBgStyle:s={},labelBgPadding:o=[2,4],labelBgBorderRadius:a=2,children:l,className:u,...f}){const[c,d]=E.useState({x:1,y:0,width:0,height:0}),h=ut(["react-flow__edge-textwrapper",u]),p=E.useRef(null);return E.useEffect(()=>{if(p.current){const m=p.current.getBBox();d({x:m.x,y:m.y,width:m.width,height:m.height})}},[n]),typeof n>"u"||!n?null:b.jsxs("g",{transform:`translate(${e-c.width/2} ${t-c.height/2})`,className:h,visibility:c.width?"visible":"hidden",...f,children:[i&&b.jsx("rect",{width:c.width+2*o[0],x:-o[0],y:-o[1],height:c.height+2*o[1],className:"react-flow__edge-textbg",style:s,rx:a,ry:a}),b.jsx("text",{className:"react-flow__edge-text",y:c.height/2,dy:"0.3em",ref:p,style:r,children:n}),l]})}oI.displayName="EdgeText";const QJ=E.memo(oI);function Np({id:e,path:t,labelX:n,labelY:r,label:i,labelStyle:s,labelShowBg:o,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u,style:f,markerEnd:c,markerStart:d,className:h,interactionWidth:p=20}){return b.jsxs(b.Fragment,{children:[b.jsx("path",{id:e,style:f,d:t,fill:"none",className:ut(["react-flow__edge-path",h]),markerEnd:c,markerStart:d}),p&&b.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:p,className:"react-flow__edge-interaction"}),i&&tr(n)&&tr(r)?b.jsx(QJ,{x:n,y:r,label:i,labelStyle:s,labelShowBg:o,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u}):null]})}function fC({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===se.Left||e===se.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function aI({sourceX:e,sourceY:t,sourcePosition:n=se.Bottom,targetX:r,targetY:i,targetPosition:s=se.Top}){const[o,a]=fC({pos:n,x1:e,y1:t,x2:r,y2:i}),[l,u]=fC({pos:s,x1:r,y1:i,x2:e,y2:t}),[f,c,d,h]=TR({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:a,targetControlX:l,targetControlY:u});return[`M${e},${t} C${o},${a} ${l},${u} ${r},${i}`,f,c,d,h]}function lI(e){return E.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:o=se.Bottom,targetPosition:a=se.Top,label:l,labelStyle:u,labelShowBg:f,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:p,markerEnd:m,markerStart:w,interactionWidth:y})=>{const[v,g,x]=aI({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:s,targetPosition:a}),S=e.isInternal?void 0:t;return b.jsx(Np,{id:S,path:v,labelX:g,labelY:x,label:l,labelStyle:u,labelShowBg:f,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:p,markerEnd:m,markerStart:w,interactionWidth:y})})}const ZJ=lI({isInternal:!1}),uI=lI({isInternal:!0});ZJ.displayName="SimpleBezierEdge";uI.displayName="SimpleBezierEdgeInternal";function cI(e){return E.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,label:o,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:c,style:d,sourcePosition:h=se.Bottom,targetPosition:p=se.Top,markerEnd:m,markerStart:w,pathOptions:y,interactionWidth:v})=>{const[g,x,S]=I0({sourceX:n,sourceY:r,sourcePosition:h,targetX:i,targetY:s,targetPosition:p,borderRadius:y==null?void 0:y.borderRadius,offset:y==null?void 0:y.offset}),k=e.isInternal?void 0:t;return b.jsx(Np,{id:k,path:g,labelX:x,labelY:S,label:o,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:c,style:d,markerEnd:m,markerStart:w,interactionWidth:v})})}const fI=cI({isInternal:!1}),dI=cI({isInternal:!0});fI.displayName="SmoothStepEdge";dI.displayName="SmoothStepEdgeInternal";function hI(e){return E.memo(({id:t,...n})=>{var i;const r=e.isInternal?void 0:t;return b.jsx(fI,{...n,id:r,pathOptions:E.useMemo(()=>{var s;return{borderRadius:0,offset:(s=n.pathOptions)==null?void 0:s.offset}},[(i=n.pathOptions)==null?void 0:i.offset])})})}const JJ=hI({isInternal:!1}),pI=hI({isInternal:!0});JJ.displayName="StepEdge";pI.displayName="StepEdgeInternal";function mI(e){return E.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,label:o,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:c,style:d,markerEnd:h,markerStart:p,interactionWidth:m})=>{const[w,y,v]=NR({sourceX:n,sourceY:r,targetX:i,targetY:s}),g=e.isInternal?void 0:t;return b.jsx(Np,{id:g,path:w,labelX:y,labelY:v,label:o,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:c,style:d,markerEnd:h,markerStart:p,interactionWidth:m})})}const eee=mI({isInternal:!1}),gI=mI({isInternal:!0});eee.displayName="StraightEdge";gI.displayName="StraightEdgeInternal";function yI(e){return E.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:o=se.Bottom,targetPosition:a=se.Top,label:l,labelStyle:u,labelShowBg:f,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:p,markerEnd:m,markerStart:w,pathOptions:y,interactionWidth:v})=>{const[g,x,S]=Ep({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:s,targetPosition:a,curvature:y==null?void 0:y.curvature}),k=e.isInternal?void 0:t;return b.jsx(Np,{id:k,path:g,labelX:x,labelY:S,label:l,labelStyle:u,labelShowBg:f,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:h,style:p,markerEnd:m,markerStart:w,interactionWidth:v})})}const tee=yI({isInternal:!1}),vI=yI({isInternal:!0});tee.displayName="BezierEdge";vI.displayName="BezierEdgeInternal";const dC={default:vI,straight:gI,step:pI,smoothstep:dI,simplebezier:uI},hC={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},nee=(e,t,n)=>n===se.Left?e-t:n===se.Right?e+t:e,ree=(e,t,n)=>n===se.Top?e-t:n===se.Bottom?e+t:e,pC="react-flow__edgeupdater";function mC({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:s,onMouseOut:o,type:a}){return b.jsx("circle",{onMouseDown:i,onMouseEnter:s,onMouseOut:o,className:ut([pC,`${pC}-${a}`]),cx:nee(t,r,e),cy:ree(n,r,e),r,stroke:"transparent",fill:"transparent"})}function iee({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:s,targetY:o,sourcePosition:a,targetPosition:l,onReconnect:u,onReconnectStart:f,onReconnectEnd:c,setReconnecting:d,setUpdateHover:h}){const p=He(),m=(x,S)=>{if(x.button!==0)return;const{autoPanOnConnect:k,domNode:C,isValidConnection:T,connectionMode:O,connectionRadius:A,lib:j,onConnectStart:L,onConnectEnd:B,cancelConnection:N,nodeLookup:M,rfId:I,panBy:F,updateConnection:P}=p.getState(),D=S.type==="target";d(!0),f==null||f(x,n,S.type);const _=(W,R)=>{d(!1),c==null||c(W,n,S.type,R)},V=W=>u==null?void 0:u(n,W);j0.onPointerDown(x.nativeEvent,{autoPanOnConnect:k,connectionMode:O,connectionRadius:A,domNode:C,handleId:S.id,nodeId:S.nodeId,nodeLookup:M,isTarget:D,edgeUpdaterType:S.type,lib:j,flowId:I,cancelConnection:N,panBy:F,isValidConnection:T,onConnect:V,onConnectStart:L,onConnectEnd:B,onReconnectEnd:_,updateConnection:P,getTransform:()=>p.getState().transform,getFromHandle:()=>p.getState().connection.fromHandle})},w=x=>m(x,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),y=x=>m(x,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),v=()=>h(!0),g=()=>h(!1);return b.jsxs(b.Fragment,{children:[(e===!0||e==="source")&&b.jsx(mC,{position:a,centerX:r,centerY:i,radius:t,onMouseDown:w,onMouseEnter:v,onMouseOut:g,type:"source"}),(e===!0||e==="target")&&b.jsx(mC,{position:l,centerX:s,centerY:o,radius:t,onMouseDown:y,onMouseEnter:v,onMouseOut:g,type:"target"})]})}function see({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:s,onContextMenu:o,onMouseEnter:a,onMouseMove:l,onMouseLeave:u,reconnectRadius:f,onReconnect:c,onReconnectStart:d,onReconnectEnd:h,rfId:p,edgeTypes:m,noPanClassName:w,onError:y,disableKeyboardA11y:v}){let g=Te(ie=>ie.edgeLookup.get(e));const x=Te(ie=>ie.defaultEdgeOptions);g=x?{...x,...g}:g;let S=g.type||"default",k=(m==null?void 0:m[S])||dC[S];k===void 0&&(y==null||y("011",hi.error011(S)),S="default",k=dC.default);const C=!!(g.focusable||t&&typeof g.focusable>"u"),T=typeof c<"u"&&(g.reconnectable||n&&typeof g.reconnectable>"u"),O=!!(g.selectable||r&&typeof g.selectable>"u"),A=E.useRef(null),[j,L]=E.useState(!1),[B,N]=E.useState(!1),M=He(),{zIndex:I,sourceX:F,sourceY:P,targetX:D,targetY:_,sourcePosition:V,targetPosition:W}=Te(E.useCallback(ie=>{const pe=ie.nodeLookup.get(g.source),Ne=ie.nodeLookup.get(g.target);if(!pe||!Ne)return{zIndex:g.zIndex,...hC};const gt=FQ({id:e,sourceNode:pe,targetNode:Ne,sourceHandle:g.sourceHandle||null,targetHandle:g.targetHandle||null,connectionMode:ie.connectionMode,onError:y});return{zIndex:OQ({selected:g.selected,zIndex:g.zIndex,sourceNode:pe,targetNode:Ne,elevateOnSelect:ie.elevateEdgesOnSelect}),...gt||hC}},[g.source,g.target,g.sourceHandle,g.targetHandle,g.selected,g.zIndex]),Xe),R=E.useMemo(()=>g.markerStart?`url('#${D0(g.markerStart,p)}')`:void 0,[g.markerStart,p]),q=E.useMemo(()=>g.markerEnd?`url('#${D0(g.markerEnd,p)}')`:void 0,[g.markerEnd,p]);if(g.hidden||F===null||P===null||D===null||_===null)return null;const J=ie=>{var Ht;const{addSelectedEdges:pe,unselectNodesAndEdges:Ne,multiSelectionActive:gt}=M.getState();O&&(M.setState({nodesSelectionActive:!1}),g.selected&>?(Ne({nodes:[],edges:[g]}),(Ht=A.current)==null||Ht.blur()):pe([e])),i&&i(ie,g)},Y=s?ie=>{s(ie,{...g})}:void 0,re=o?ie=>{o(ie,{...g})}:void 0,G=a?ie=>{a(ie,{...g})}:void 0,le=l?ie=>{l(ie,{...g})}:void 0,de=u?ie=>{u(ie,{...g})}:void 0,ue=ie=>{var pe;if(!v&&dR.includes(ie.key)&&O){const{unselectNodesAndEdges:Ne,addSelectedEdges:gt}=M.getState();ie.key==="Escape"?((pe=A.current)==null||pe.blur(),Ne({edges:[g]})):gt([e])}};return b.jsx("svg",{style:{zIndex:I},children:b.jsxs("g",{className:ut(["react-flow__edge",`react-flow__edge-${S}`,g.className,w,{selected:g.selected,animated:g.animated,inactive:!O&&!i,updating:j,selectable:O}]),onClick:J,onDoubleClick:Y,onContextMenu:re,onMouseEnter:G,onMouseMove:le,onMouseLeave:de,onKeyDown:C?ue:void 0,tabIndex:C?0:void 0,role:C?"button":"img","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":g.ariaLabel===null?void 0:g.ariaLabel||`Edge from ${g.source} to ${g.target}`,"aria-describedby":C?`${qR}-${p}`:void 0,ref:A,children:[!B&&b.jsx(k,{id:e,source:g.source,target:g.target,type:g.type,selected:g.selected,animated:g.animated,selectable:O,deletable:g.deletable??!0,label:g.label,labelStyle:g.labelStyle,labelShowBg:g.labelShowBg,labelBgStyle:g.labelBgStyle,labelBgPadding:g.labelBgPadding,labelBgBorderRadius:g.labelBgBorderRadius,sourceX:F,sourceY:P,targetX:D,targetY:_,sourcePosition:V,targetPosition:W,data:g.data,style:g.style,sourceHandleId:g.sourceHandle,targetHandleId:g.targetHandle,markerStart:R,markerEnd:q,pathOptions:"pathOptions"in g?g.pathOptions:void 0,interactionWidth:g.interactionWidth}),T&&b.jsx(iee,{edge:g,isReconnectable:T,reconnectRadius:f,onReconnect:c,onReconnectStart:d,onReconnectEnd:h,sourceX:F,sourceY:P,targetX:D,targetY:_,sourcePosition:V,targetPosition:W,setUpdateHover:L,setReconnecting:N})]})})}const oee=e=>({width:e.width,height:e.height,edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function wI({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:s,onEdgeContextMenu:o,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:u,onEdgeClick:f,reconnectRadius:c,onEdgeDoubleClick:d,onReconnectStart:h,onReconnectEnd:p,disableKeyboardA11y:m}){const{edgesFocusable:w,edgesReconnectable:y,elementsSelectable:v,onError:g}=Te(oee,Xe),x=WJ(t);return b.jsxs("div",{className:"react-flow__edges",children:[b.jsx(XJ,{defaultColor:e,rfId:n}),x.map(S=>b.jsx(see,{id:S,edgesFocusable:w,edgesReconnectable:y,elementsSelectable:v,noPanClassName:i,onReconnect:s,onContextMenu:o,onMouseEnter:a,onMouseMove:l,onMouseLeave:u,onClick:f,reconnectRadius:c,onDoubleClick:d,onReconnectStart:h,onReconnectEnd:p,rfId:n,onError:g,edgeTypes:r,disableKeyboardA11y:m},S))]})}wI.displayName="EdgeRenderer";const aee=E.memo(wI),lee=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function uee({children:e}){const t=Te(lee);return b.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function cee(e){const t=Tx(),n=E.useRef(!1);E.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const fee=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function dee(e){const t=Te(fee),n=He();return E.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function hee(e){return e.connection.inProgress?{...e.connection,to:yc(e.connection.to,e.transform)}:{...e.connection}}function pee(e){return hee}function mee(e){const t=pee();return Te(t,Xe)}const gee=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function yee({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:i,width:s,height:o,isValid:a,inProgress:l}=Te(gee,Xe);return!(s&&i&&l)?null:b.jsx("svg",{style:e,width:s,height:o,className:"react-flow__connectionline react-flow__container",children:b.jsx("g",{className:ut(["react-flow__connection",pR(a)]),children:b.jsx(xI,{style:t,type:n,CustomComponent:r,isValid:a})})})}const xI=({style:e,type:t=Pi.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:i,from:s,fromNode:o,fromHandle:a,fromPosition:l,to:u,toNode:f,toHandle:c,toPosition:d}=mee();if(!i)return;if(n)return b.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:a,fromX:s.x,fromY:s.y,toX:u.x,toY:u.y,fromPosition:l,toPosition:d,connectionStatus:pR(r),toNode:f,toHandle:c});let h="";const p={sourceX:s.x,sourceY:s.y,sourcePosition:l,targetX:u.x,targetY:u.y,targetPosition:d};switch(t){case Pi.Bezier:[h]=Ep(p);break;case Pi.SimpleBezier:[h]=aI(p);break;case Pi.Step:[h]=I0({...p,borderRadius:0});break;case Pi.SmoothStep:[h]=I0(p);break;default:[h]=NR(p)}return b.jsx("path",{d:h,fill:"none",className:"react-flow__connection-path",style:e})};xI.displayName="ConnectionLine";const vee={};function gC(e=vee){E.useRef(e),He(),E.useEffect(()=>{},[e])}function wee(){He(),E.useRef(!1),E.useEffect(()=>{},[])}function bI({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:s,onEdgeDoubleClick:o,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:u,onNodeContextMenu:f,onSelectionContextMenu:c,onSelectionStart:d,onSelectionEnd:h,connectionLineType:p,connectionLineStyle:m,connectionLineComponent:w,connectionLineContainerStyle:y,selectionKeyCode:v,selectionOnDrag:g,selectionMode:x,multiSelectionKeyCode:S,panActivationKeyCode:k,zoomActivationKeyCode:C,deleteKeyCode:T,onlyRenderVisibleElements:O,elementsSelectable:A,defaultViewport:j,translateExtent:L,minZoom:B,maxZoom:N,preventScrolling:M,defaultMarkerColor:I,zoomOnScroll:F,zoomOnPinch:P,panOnScroll:D,panOnScrollSpeed:_,panOnScrollMode:V,zoomOnDoubleClick:W,panOnDrag:R,onPaneClick:q,onPaneMouseEnter:J,onPaneMouseMove:Y,onPaneMouseLeave:re,onPaneScroll:G,onPaneContextMenu:le,paneClickDistance:de,nodeClickDistance:ue,onEdgeContextMenu:ie,onEdgeMouseEnter:pe,onEdgeMouseMove:Ne,onEdgeMouseLeave:gt,reconnectRadius:Ht,onReconnect:Ir,onReconnectStart:$,onReconnectEnd:z,noDragClassName:H,noWheelClassName:ne,noPanClassName:ee,disableKeyboardA11y:X,nodeExtent:ae,rfId:xe,viewport:U,onViewportChange:K}){return gC(e),gC(t),wee(),cee(n),dee(U),b.jsx(MJ,{onPaneClick:q,onPaneMouseEnter:J,onPaneMouseMove:Y,onPaneMouseLeave:re,onPaneContextMenu:le,onPaneScroll:G,paneClickDistance:de,deleteKeyCode:T,selectionKeyCode:v,selectionOnDrag:g,selectionMode:x,onSelectionStart:d,onSelectionEnd:h,multiSelectionKeyCode:S,panActivationKeyCode:k,zoomActivationKeyCode:C,elementsSelectable:A,zoomOnScroll:F,zoomOnPinch:P,zoomOnDoubleClick:W,panOnScroll:D,panOnScrollSpeed:_,panOnScrollMode:V,panOnDrag:R,defaultViewport:j,translateExtent:L,minZoom:B,maxZoom:N,onSelectionContextMenu:c,preventScrolling:M,noDragClassName:H,noWheelClassName:ne,noPanClassName:ee,disableKeyboardA11y:X,onViewportChange:K,isControlledViewport:!!U,children:b.jsxs(uee,{children:[b.jsx(aee,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:Ir,onReconnectStart:$,onReconnectEnd:z,onlyRenderVisibleElements:O,onEdgeContextMenu:ie,onEdgeMouseEnter:pe,onEdgeMouseMove:Ne,onEdgeMouseLeave:gt,reconnectRadius:Ht,defaultMarkerColor:I,noPanClassName:ee,disableKeyboardA11y:X,rfId:xe}),b.jsx(yee,{style:m,type:p,component:w,containerStyle:y}),b.jsx("div",{className:"react-flow__edgelabel-renderer"}),b.jsx(HJ,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:s,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:u,onNodeContextMenu:f,nodeClickDistance:ue,onlyRenderVisibleElements:O,noPanClassName:ee,noDragClassName:H,disableKeyboardA11y:X,nodeExtent:ae,rfId:xe}),b.jsx("div",{className:"react-flow__viewport-portal"})]})})}bI.displayName="GraphView";const xee=E.memo(bI),yC=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:o,nodeOrigin:a,nodeExtent:l}={})=>{const u=new Map,f=new Map,c=new Map,d=new Map,h=r??t??[],p=n??e??[],m=a??[0,0],w=l??$u;OR(c,d,h),M0(p,u,f,{nodeOrigin:m,nodeExtent:w,elevateNodesOnSelect:!1});let y=[0,0,1];if(o&&i&&s){const v=gc(u,{filter:k=>!!((k.width||k.initialWidth)&&(k.height||k.initialHeight))}),{x:g,y:x,zoom:S}=wx(v,i,s,.5,2,.1);y=[g,x,S]}return{rfId:"1",width:0,height:0,transform:y,nodes:p,nodeLookup:u,parentLookup:f,edges:h,edgeLookup:d,connectionLookup:c,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:.5,maxZoom:2,translateExtent:$u,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:ka.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:m,nodeDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,fitViewOnInit:!1,fitViewDone:!1,fitViewOnInitOptions:void 0,selectNodesOnDrag:!0,multiSelectionActive:!1,connection:{...hR},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanSpeed:15,connectionRadius:20,onError:NQ,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1}},bee=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:o,nodeOrigin:a,nodeExtent:l})=>BZ((u,f)=>({...yC({nodes:e,edges:t,width:i,height:s,fitView:o,nodeOrigin:a,nodeExtent:l,defaultNodes:n,defaultEdges:r}),setNodes:c=>{const{nodeLookup:d,parentLookup:h,nodeOrigin:p,elevateNodesOnSelect:m}=f();M0(c,d,h,{nodeOrigin:p,nodeExtent:l,elevateNodesOnSelect:m,checkEquality:!0}),u({nodes:c})},setEdges:c=>{const{connectionLookup:d,edgeLookup:h}=f();OR(d,h,c),u({edges:c})},setDefaultNodesAndEdges:(c,d)=>{if(c){const{setNodes:h}=f();h(c),u({hasDefaultNodes:!0})}if(d){const{setEdges:h}=f();h(d),u({hasDefaultEdges:!0})}},updateNodeInternals:(c,d={triggerFitView:!0})=>{const{triggerNodeChanges:h,nodeLookup:p,parentLookup:m,fitViewOnInit:w,fitViewDone:y,fitViewOnInitOptions:v,domNode:g,nodeOrigin:x,nodeExtent:S,debug:k,fitViewSync:C}=f(),{changes:T,updatedInternals:O}=HQ(c,p,m,g,x,S);if(O){if(VQ(p,m,{nodeOrigin:x,nodeExtent:S}),d.triggerFitView){let A=y;!y&&w&&(A=C({...v,nodes:v==null?void 0:v.nodes})),u({fitViewDone:A})}else u({});(T==null?void 0:T.length)>0&&(k&&console.log("React Flow: trigger node changes",T),h==null||h(T))}},updateNodePositions:(c,d=!1)=>{const h=[],p=[];for(const[m,w]of c){const y={id:m,type:"position",position:w.position,dragging:d};w!=null&&w.expandParent&&(w!=null&&w.parentId)&&y.position&&(h.push({id:m,parentId:w.parentId,rect:{...w.internals.positionAbsolute,width:w.measured.width,height:w.measured.height}}),y.position.x=Math.max(0,y.position.x),y.position.y=Math.max(0,y.position.y)),p.push(y)}if(h.length>0){const{nodeLookup:m,parentLookup:w,nodeOrigin:y}=f(),v=Ex(h,m,w,y);p.push(...v)}f().triggerNodeChanges(p)},triggerNodeChanges:c=>{const{onNodesChange:d,setNodes:h,nodes:p,hasDefaultNodes:m,debug:w}=f();if(c!=null&&c.length){if(m){const y=XR(c,p);h(y)}w&&console.log("React Flow: trigger node changes",c),d==null||d(c)}},triggerEdgeChanges:c=>{const{onEdgesChange:d,setEdges:h,edges:p,hasDefaultEdges:m,debug:w}=f();if(c!=null&&c.length){if(m){const y=QR(c,p);h(y)}w&&console.log("React Flow: trigger edge changes",c),d==null||d(c)}},addSelectedNodes:c=>{const{multiSelectionActive:d,edgeLookup:h,nodeLookup:p,triggerNodeChanges:m,triggerEdgeChanges:w}=f();if(d){const y=c.map(v=>Ss(v,!0));m(y);return}m(Vo(p,new Set([...c]),!0)),w(Vo(h))},addSelectedEdges:c=>{const{multiSelectionActive:d,edgeLookup:h,nodeLookup:p,triggerNodeChanges:m,triggerEdgeChanges:w}=f();if(d){const y=c.map(v=>Ss(v,!0));w(y);return}w(Vo(h,new Set([...c]))),m(Vo(p,new Set,!0))},unselectNodesAndEdges:({nodes:c,edges:d}={})=>{const{edges:h,nodes:p,triggerNodeChanges:m,triggerEdgeChanges:w}=f(),y=c||p,v=d||h,g=y.map(S=>(S.selected=!1,Ss(S.id,!1))),x=v.map(S=>Ss(S.id,!1));m(g),w(x)},setMinZoom:c=>{const{panZoom:d,maxZoom:h}=f();d==null||d.setScaleExtent([c,h]),u({minZoom:c})},setMaxZoom:c=>{const{panZoom:d,minZoom:h}=f();d==null||d.setScaleExtent([h,c]),u({maxZoom:c})},setTranslateExtent:c=>{var d;(d=f().panZoom)==null||d.setTranslateExtent(c),u({translateExtent:c})},setPaneClickDistance:c=>{var d;(d=f().panZoom)==null||d.setClickDistance(c)},resetSelectedElements:()=>{const{edges:c,nodes:d,triggerNodeChanges:h,triggerEdgeChanges:p}=f(),m=d.reduce((y,v)=>v.selected?[...y,Ss(v.id,!1)]:y,[]),w=c.reduce((y,v)=>v.selected?[...y,Ss(v.id,!1)]:y,[]);h(m),p(w)},setNodeExtent:c=>{const{nodes:d,nodeLookup:h,parentLookup:p,nodeOrigin:m,elevateNodesOnSelect:w,nodeExtent:y}=f();c[0][0]===y[0][0]&&c[0][1]===y[0][1]&&c[1][0]===y[1][0]&&c[1][1]===y[1][1]||(M0(d,h,p,{nodeOrigin:m,nodeExtent:c,elevateNodesOnSelect:w,checkEquality:!1}),u({nodeExtent:c}))},panBy:c=>{const{transform:d,width:h,height:p,panZoom:m,translateExtent:w}=f();return WQ({delta:c,panZoom:m,transform:d,translateExtent:w,width:h,height:p})},fitView:c=>{const{panZoom:d,width:h,height:p,minZoom:m,maxZoom:w,nodeLookup:y}=f();if(!d)return Promise.resolve(!1);const v=P0(y,c);return O0({nodes:v,width:h,height:p,panZoom:d,minZoom:m,maxZoom:w},c)},fitViewSync:c=>{const{panZoom:d,width:h,height:p,minZoom:m,maxZoom:w,nodeLookup:y}=f();if(!d)return!1;const v=P0(y,c);return O0({nodes:v,width:h,height:p,panZoom:d,minZoom:m,maxZoom:w},c),v.size>0},cancelConnection:()=>{u({connection:{...hR}})},updateConnection:c=>{u({connection:c})},reset:()=>u({...yC()})}),Object.is);function See({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:s,fitView:o,nodeOrigin:a,nodeExtent:l,children:u}){const[f]=E.useState(()=>bee({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:o,nodeOrigin:a,nodeExtent:l}));return b.jsx(VZ,{value:f,children:b.jsx(cJ,{children:u})})}function kee({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:s,height:o,fitView:a,nodeOrigin:l,nodeExtent:u}){return E.useContext(_p)?b.jsx(b.Fragment,{children:e}):b.jsx(See,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:s,initialHeight:o,fitView:a,nodeOrigin:l,nodeExtent:u,children:e})}const Eee={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Cee({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:s,edgeTypes:o,onNodeClick:a,onEdgeClick:l,onInit:u,onMove:f,onMoveStart:c,onMoveEnd:d,onConnect:h,onConnectStart:p,onConnectEnd:m,onClickConnectStart:w,onClickConnectEnd:y,onNodeMouseEnter:v,onNodeMouseMove:g,onNodeMouseLeave:x,onNodeContextMenu:S,onNodeDoubleClick:k,onNodeDragStart:C,onNodeDrag:T,onNodeDragStop:O,onNodesDelete:A,onEdgesDelete:j,onDelete:L,onSelectionChange:B,onSelectionDragStart:N,onSelectionDrag:M,onSelectionDragStop:I,onSelectionContextMenu:F,onSelectionStart:P,onSelectionEnd:D,onBeforeDelete:_,connectionMode:V,connectionLineType:W=Pi.Bezier,connectionLineStyle:R,connectionLineComponent:q,connectionLineContainerStyle:J,deleteKeyCode:Y="Backspace",selectionKeyCode:re="Shift",selectionOnDrag:G=!1,selectionMode:le=Bu.Full,panActivationKeyCode:de="Space",multiSelectionKeyCode:ue=fh()?"Meta":"Control",zoomActivationKeyCode:ie=fh()?"Meta":"Control",snapToGrid:pe,snapGrid:Ne,onlyRenderVisibleElements:gt=!1,selectNodesOnDrag:Ht,nodesDraggable:Ir,nodesConnectable:$,nodesFocusable:z,nodeOrigin:H=YR,edgesFocusable:ne,edgesReconnectable:ee,elementsSelectable:X=!0,defaultViewport:ae=eJ,minZoom:xe=.5,maxZoom:U=2,translateExtent:K=$u,preventScrolling:ce=!0,nodeExtent:ye,defaultMarkerColor:_e="#b1b1b7",zoomOnScroll:yt=!0,zoomOnPinch:Un=!0,panOnScroll:Wt=!1,panOnScrollSpeed:Dr=.5,panOnScrollMode:hr=js.Free,zoomOnDoubleClick:It=!0,panOnDrag:mi=!0,onPaneClick:Hn,onPaneMouseEnter:tj,onPaneMouseMove:nj,onPaneMouseLeave:rj,onPaneScroll:ij,onPaneContextMenu:sj,paneClickDistance:T1=0,nodeClickDistance:oj=0,children:aj,onReconnect:lj,onReconnectStart:uj,onReconnectEnd:cj,onEdgeContextMenu:fj,onEdgeDoubleClick:dj,onEdgeMouseEnter:hj,onEdgeMouseMove:pj,onEdgeMouseLeave:mj,reconnectRadius:gj=10,onNodesChange:yj,onEdgesChange:vj,noDragClassName:wj="nodrag",noWheelClassName:xj="nowheel",noPanClassName:_1="nopan",fitView:A1,fitViewOptions:bj,connectOnClick:Sj,attributionPosition:kj,proOptions:Ej,defaultEdgeOptions:Cj,elevateNodesOnSelect:Tj,elevateEdgesOnSelect:_j,disableKeyboardA11y:N1=!1,autoPanOnConnect:Aj,autoPanOnNodeDrag:Nj,autoPanSpeed:Pj,connectionRadius:Oj,isValidConnection:Lj,onError:Rj,style:Ij,id:P1,nodeDragThreshold:Dj,viewport:Mj,onViewportChange:jj,width:Fj,height:$j,colorMode:Bj="light",debug:Vj,...zj},Uj){const Gp=P1||"1",Hj=iJ(Bj);return b.jsx("div",{...zj,style:{...Ij,...Eee},ref:Uj,className:ut(["react-flow",i,Hj]),"data-testid":"rf__wrapper",id:P1,children:b.jsxs(kee,{nodes:e,edges:t,width:Fj,height:$j,fitView:A1,nodeOrigin:H,nodeExtent:ye,children:[b.jsx(xee,{onInit:u,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:v,onNodeMouseMove:g,onNodeMouseLeave:x,onNodeContextMenu:S,onNodeDoubleClick:k,nodeTypes:s,edgeTypes:o,connectionLineType:W,connectionLineStyle:R,connectionLineComponent:q,connectionLineContainerStyle:J,selectionKeyCode:re,selectionOnDrag:G,selectionMode:le,deleteKeyCode:Y,multiSelectionKeyCode:ue,panActivationKeyCode:de,zoomActivationKeyCode:ie,onlyRenderVisibleElements:gt,defaultViewport:ae,translateExtent:K,minZoom:xe,maxZoom:U,preventScrolling:ce,zoomOnScroll:yt,zoomOnPinch:Un,zoomOnDoubleClick:It,panOnScroll:Wt,panOnScrollSpeed:Dr,panOnScrollMode:hr,panOnDrag:mi,onPaneClick:Hn,onPaneMouseEnter:tj,onPaneMouseMove:nj,onPaneMouseLeave:rj,onPaneScroll:ij,onPaneContextMenu:sj,paneClickDistance:T1,nodeClickDistance:oj,onSelectionContextMenu:F,onSelectionStart:P,onSelectionEnd:D,onReconnect:lj,onReconnectStart:uj,onReconnectEnd:cj,onEdgeContextMenu:fj,onEdgeDoubleClick:dj,onEdgeMouseEnter:hj,onEdgeMouseMove:pj,onEdgeMouseLeave:mj,reconnectRadius:gj,defaultMarkerColor:_e,noDragClassName:wj,noWheelClassName:xj,noPanClassName:_1,rfId:Gp,disableKeyboardA11y:N1,nodeExtent:ye,viewport:Mj,onViewportChange:jj}),b.jsx(rJ,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:p,onConnectEnd:m,onClickConnectStart:w,onClickConnectEnd:y,nodesDraggable:Ir,nodesConnectable:$,nodesFocusable:z,edgesFocusable:ne,edgesReconnectable:ee,elementsSelectable:X,elevateNodesOnSelect:Tj,elevateEdgesOnSelect:_j,minZoom:xe,maxZoom:U,nodeExtent:ye,onNodesChange:yj,onEdgesChange:vj,snapToGrid:pe,snapGrid:Ne,connectionMode:V,translateExtent:K,connectOnClick:Sj,defaultEdgeOptions:Cj,fitView:A1,fitViewOptions:bj,onNodesDelete:A,onEdgesDelete:j,onDelete:L,onNodeDragStart:C,onNodeDrag:T,onNodeDragStop:O,onSelectionDrag:M,onSelectionDragStart:N,onSelectionDragStop:I,onMove:f,onMoveStart:c,onMoveEnd:d,noPanClassName:_1,nodeOrigin:H,rfId:Gp,autoPanOnConnect:Aj,autoPanOnNodeDrag:Nj,autoPanSpeed:Pj,onError:Rj,connectionRadius:Oj,isValidConnection:Lj,selectNodesOnDrag:Ht,nodeDragThreshold:Dj,onBeforeDelete:_,paneClickDistance:T1,debug:Vj}),b.jsx(JZ,{onSelectionChange:B}),aj,b.jsx(YZ,{proOptions:Ej,position:kj}),b.jsx(KZ,{rfId:Gp,disableKeyboardA11y:N1})]})})}var Tee=ZR(Cee);function _ee(e){const[t,n]=E.useState(e),r=E.useCallback(i=>n(s=>XR(i,s)),[]);return[t,n,r]}function Aee(e){const[t,n]=E.useState(e),r=E.useCallback(i=>n(s=>QR(i,s)),[]);return[t,n,r]}function vC(e){return Te(E.useCallback(n=>n.nodeLookup.get(e),[e]),Xe)}function Nee({dimensions:e,lineWidth:t,variant:n,className:r}){return b.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:ut(["react-flow__background-pattern",n,r])})}function Pee({radius:e,className:t}){return b.jsx("circle",{cx:e,cy:e,r:e,className:ut(["react-flow__background-pattern","dots",t])})}var Hi;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Hi||(Hi={}));const Oee={[Hi.Dots]:1,[Hi.Lines]:1,[Hi.Cross]:6},Lee=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function SI({id:e,variant:t=Hi.Dots,gap:n=20,size:r,lineWidth:i=1,offset:s=0,color:o,bgColor:a,style:l,className:u,patternClassName:f}){const c=E.useRef(null),{transform:d,patternId:h}=Te(Lee,Xe),p=r||Oee[t],m=t===Hi.Dots,w=t===Hi.Cross,y=Array.isArray(n)?n:[n,n],v=[y[0]*d[2]||1,y[1]*d[2]||1],g=p*d[2],x=Array.isArray(s)?s:[s,s],S=w?[g,g]:v,k=[x[0]*d[2]||1+S[0]/2,x[1]*d[2]||1+S[1]/2],C=`${h}${e||""}`;return b.jsxs("svg",{className:ut(["react-flow__background",u]),style:{...l,...Ap,"--xy-background-color-props":a,"--xy-background-pattern-color-props":o},ref:c,"data-testid":"rf__background",children:[b.jsx("pattern",{id:C,x:d[0]%v[0],y:d[1]%v[1],width:v[0],height:v[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${k[0]},-${k[1]})`,children:m?b.jsx(Pee,{radius:g/2,className:f}):b.jsx(Nee,{dimensions:S,lineWidth:i,variant:t,className:f})}),b.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${C})`})]})}SI.displayName="Background";const Ree=E.memo(SI);function Iee(){return b.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:b.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Dee(){return b.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:b.jsx("path",{d:"M0 0h32v4.2H0z"})})}function Mee(){return b.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:b.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function jee(){return b.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:b.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function Fee(){return b.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:b.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function ff({children:e,className:t,...n}){return b.jsx("button",{type:"button",className:ut(["react-flow__controls-button",t]),...n,children:e})}const $ee=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom});function kI({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:s,onZoomOut:o,onFitView:a,onInteractiveChange:l,className:u,children:f,position:c="bottom-left",orientation:d="vertical","aria-label":h="React Flow controls"}){const p=He(),{isInteractive:m,minZoomReached:w,maxZoomReached:y}=Te($ee,Xe),{zoomIn:v,zoomOut:g,fitView:x}=Tx(),S=()=>{v(),s==null||s()},k=()=>{g(),o==null||o()},C=()=>{x(i),a==null||a()},T=()=>{p.setState({nodesDraggable:!m,nodesConnectable:!m,elementsSelectable:!m}),l==null||l(!m)},O=d==="horizontal"?"horizontal":"vertical";return b.jsxs(Cx,{className:ut(["react-flow__controls",O,u]),position:c,style:e,"data-testid":"rf__controls","aria-label":h,children:[t&&b.jsxs(b.Fragment,{children:[b.jsx(ff,{onClick:S,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:y,children:b.jsx(Iee,{})}),b.jsx(ff,{onClick:k,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:w,children:b.jsx(Dee,{})})]}),n&&b.jsx(ff,{className:"react-flow__controls-fitview",onClick:C,title:"fit view","aria-label":"fit view",children:b.jsx(Mee,{})}),r&&b.jsx(ff,{className:"react-flow__controls-interactive",onClick:T,title:"toggle interactivity","aria-label":"toggle interactivity",children:m?b.jsx(Fee,{}):b.jsx(jee,{})}),f]})}kI.displayName="Controls";const Bee=E.memo(kI);function Vee({id:e,x:t,y:n,width:r,height:i,style:s,color:o,strokeColor:a,strokeWidth:l,className:u,borderRadius:f,shapeRendering:c,selected:d,onClick:h}){const{background:p,backgroundColor:m}=s||{},w=o||p||m;return b.jsx("rect",{className:ut(["react-flow__minimap-node",{selected:d},u]),x:t,y:n,rx:f,ry:f,width:r,height:i,style:{fill:w,stroke:a,strokeWidth:l},shapeRendering:c,onClick:h?y=>h(y,e):void 0})}const zee=E.memo(Vee),Uee=e=>e.nodes.map(t=>t.id),hg=e=>e instanceof Function?e:()=>e;function Hee({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:s=zee,onClick:o}){const a=Te(Uee,Xe),l=hg(t),u=hg(e),f=hg(n),c=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return b.jsx(b.Fragment,{children:a.map(d=>b.jsx(Kee,{id:d,nodeColorFunc:l,nodeStrokeColorFunc:u,nodeClassNameFunc:f,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:s,onClick:o,shapeRendering:c},d))})}function Wee({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:s,shapeRendering:o,NodeComponent:a,onClick:l}){const{node:u,x:f,y:c,width:d,height:h}=Te(p=>{const m=p.nodeLookup.get(e),{x:w,y}=m.internals.positionAbsolute,{width:v,height:g}=cs(m);return{node:m,x:w,y,width:v,height:g}},Xe);return!u||u.hidden||!SR(u)?null:b.jsx(a,{x:f,y:c,width:d,height:h,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:i,strokeColor:n(u),strokeWidth:s,shapeRendering:o,onClick:l,id:u.id})}const Kee=E.memo(Wee);var qee=E.memo(Hee);const Yee=200,Gee=150,Xee=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?xR(gc(e.nodeLookup),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height}},Qee="react-flow__minimap-desc";function EI({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i="",nodeBorderRadius:s=5,nodeStrokeWidth:o,nodeComponent:a,bgColor:l,maskColor:u,maskStrokeColor:f,maskStrokeWidth:c,position:d="bottom-right",onClick:h,onNodeClick:p,pannable:m=!1,zoomable:w=!1,ariaLabel:y="React Flow mini map",inversePan:v,zoomStep:g=10,offsetScale:x=5}){const S=He(),k=E.useRef(null),{boundingRect:C,viewBB:T,rfId:O,panZoom:A,translateExtent:j,flowWidth:L,flowHeight:B}=Te(Xee,Xe),N=(e==null?void 0:e.width)??Yee,M=(e==null?void 0:e.height)??Gee,I=C.width/N,F=C.height/M,P=Math.max(I,F),D=P*N,_=P*M,V=x*P,W=C.x-(D-C.width)/2-V,R=C.y-(_-C.height)/2-V,q=D+V*2,J=_+V*2,Y=`${Qee}-${O}`,re=E.useRef(0),G=E.useRef();re.current=P,E.useEffect(()=>{if(k.current&&A)return G.current=JQ({domNode:k.current,panZoom:A,getTransform:()=>S.getState().transform,getViewScale:()=>re.current}),()=>{var ue;(ue=G.current)==null||ue.destroy()}},[A]),E.useEffect(()=>{var ue;(ue=G.current)==null||ue.update({translateExtent:j,width:L,height:B,inversePan:v,pannable:m,zoomStep:g,zoomable:w})},[m,w,v,g,j,L,B]);const le=h?ue=>{var Ne;const[ie,pe]=((Ne=G.current)==null?void 0:Ne.pointer(ue))||[0,0];h(ue,{x:ie,y:pe})}:void 0,de=p?E.useCallback((ue,ie)=>{const pe=S.getState().nodeLookup.get(ie);p(ue,pe)},[]):void 0;return b.jsx(Cx,{position:d,style:{...e,"--xy-minimap-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-width-props":typeof c=="number"?c*P:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o=="string"?o:void 0},className:ut(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:b.jsxs("svg",{width:N,height:M,viewBox:`${W} ${R} ${q} ${J}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Y,ref:k,onClick:le,children:[y&&b.jsx("title",{id:Y,children:y}),b.jsx(qee,{onClick:de,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:a}),b.jsx("path",{className:"react-flow__minimap-mask",d:`M${W-V},${R-V}h${q+V*2}v${J+V*2}h${-q-V*2}z M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}EI.displayName="MiniMap";const Zee=E.memo(EI);function Jee({nodeId:e,position:t,variant:n=tu.Handle,className:r,style:i={},children:s,color:o,minWidth:a=10,minHeight:l=10,maxWidth:u=Number.MAX_VALUE,maxHeight:f=Number.MAX_VALUE,keepAspectRatio:c=!1,shouldResize:d,onResizeStart:h,onResize:p,onResizeEnd:m}){const w=nI(),y=typeof e=="string"?e:w,v=He(),g=E.useRef(null),x=n===tu.Line?"right":"bottom-right",S=t??x,k=E.useRef(null);E.useEffect(()=>{if(!(!g.current||!y))return k.current||(k.current=pZ({domNode:g.current,nodeId:y,getStoreItems:()=>{const{nodeLookup:A,transform:j,snapGrid:L,snapToGrid:B,nodeOrigin:N}=v.getState();return{nodeLookup:A,transform:j,snapGrid:L,snapToGrid:B,nodeOrigin:N}},onChange:(A,j)=>{const{triggerNodeChanges:L,nodeLookup:B,parentLookup:N,nodeOrigin:M}=v.getState(),I=[],F={x:A.x,y:A.y},P=B.get(y);if(P&&P.expandParent&&P.parentId){const D=P.origin??M,_=A.width??P.measured.width,V=A.height??P.measured.height,W={id:P.id,parentId:P.parentId,rect:{width:_,height:V,...kR({x:A.x??P.position.x,y:A.y??P.position.y},{width:_,height:V},P.parentId,B,D)}},R=Ex([W],B,N,M);I.push(...R),F.x=A.x?Math.max(D[0]*_,A.x):void 0,F.y=A.y?Math.max(D[1]*V,A.y):void 0}if(F.x!==void 0&&F.y!==void 0){const D={id:y,type:"position",position:{...F}};I.push(D)}if(A.width!==void 0&&A.height!==void 0){const D={id:y,type:"dimensions",resizing:!0,setAttributes:!0,dimensions:{width:A.width,height:A.height}};I.push(D)}for(const D of j){const _={...D,type:"position"};I.push(_)}L(I)},onEnd:()=>{const A={id:y,type:"dimensions",resizing:!1};v.getState().triggerNodeChanges([A])}})),k.current.update({controlPosition:S,boundaries:{minWidth:a,minHeight:l,maxWidth:u,maxHeight:f},keepAspectRatio:c,onResizeStart:h,onResize:p,onResizeEnd:m,shouldResize:d}),()=>{var A;(A=k.current)==null||A.destroy()}},[S,a,l,u,f,c,h,p,m,d]);const C=S.split("-"),T=n===tu.Line?"borderColor":"backgroundColor",O=o?{...i,[T]:o}:i;return b.jsx("div",{className:ut(["react-flow__resize-control","nodrag",...C,n,r]),ref:g,style:O,children:s})}E.memo(Jee);function wC(e,t){const{width:n,height:r}=e.measured,i=e.internals.positionAbsolute,s=t.internals.positionAbsolute,o=n/2,a=r/2,l=i.x+o,u=i.y+a,f=s.x+t.measured.width/2,c=s.y+t.measured.height/2,d=(f-l)/(2*o)-(c-u)/(2*a),h=(f-l)/(2*o)+(c-u)/(2*a),p=1/(Math.abs(d)+Math.abs(h)),m=p*d,w=p*h,y=o*(m+w)+l,v=a*(-m+w)+u;return{x:y,y:v}}function xC(e,t){const n={...e.internals.positionAbsolute,...e},r=Math.round(n.x),i=Math.round(n.y),s=Math.round(t.x),o=Math.round(t.y);return s<=r+1?se.Left:s>=r+n.measured.width-1?se.Right:o<=i+1?se.Top:o>=n.y+n.measured.height-1?se.Bottom:se.Top}function CI(e,t){const n=wC(e,t),r=wC(t,e),i=xC(e,n),s=xC(t,r);return{sx:n.x,sy:n.y,tx:r.x,ty:r.y,sourcePos:i,targetPos:s}}function ete({id:e,source:t,target:n,markerEnd:r,style:i}){const s=vC(t),o=vC(n);if(!s||!o)return null;const{sx:a,sy:l,tx:u,ty:f,sourcePos:c,targetPos:d}=CI(s,o),[h]=Ep({sourceX:a,sourceY:l,sourcePosition:c,targetPosition:d,targetX:u,targetY:f});return b.jsx("path",{id:e,className:"react-flow__edge-path",d:h,markerEnd:r,style:i})}function tte({toX:e,toY:t,fromPosition:n,toPosition:r,fromNode:i}){if(!i)return null;const s={id:"connection-target",measured:{width:1,height:1},internals:{positionAbsolute:{x:e,y:t}}},{sx:o,sy:a}=CI(i,s),[l]=Ep({sourceX:o,sourceY:a,sourcePosition:n,targetPosition:r,targetX:e,targetY:t});return b.jsxs("g",{children:[b.jsx("path",{fill:"none",stroke:"#222",strokeWidth:1.5,className:"animated",d:l}),b.jsx("circle",{cx:e,cy:t,fill:"#fff",r:3,stroke:"#222",strokeWidth:1.5})]})}const ed=150,vt=ed*2,sn=75,ct=sn*6,$r={metrics:{PADDING_X:ed,PADDING_Y:sn,DIST_X:vt,DIST_Y:ct},layers:{},nodes:{"pm.details":{position:{x:vt*2,y:-ct*2}},"pm.prd":{position:{x:0,y:0}},"pm.frd":{position:{x:vt*4,y:0}},"pm.drd":{position:{x:vt*4,y:ct}},"db.schemas":{position:{x:ed*2+vt*5,y:ct+sn}},"db.postgres":{position:{x:ed*2+vt*6,y:ct+sn*2}},"pm.brd":{position:{x:vt*5,y:sn+ct*2}},"backend.specifications.openapi":{position:{x:vt*7,y:sn+ct*2+sn}},"backend.specifications.asyncapi":{position:{x:vt*7,y:sn+ct*2.75+sn}},"backend.server.main":{position:{x:vt*9,y:ct*2.5}},"pm.uxsmd":{position:{x:0,y:ct}},"pm.uxdmd":{position:{x:vt*2,y:ct}},"uxsitemap.structure":{position:{x:-vt*3.5,y:ct*4.5}},"uxdatamap.structure":{position:{x:vt*1.5,y:ct*2+sn}},"uxdatamap.views":{position:{x:vt*3,y:ct*2+sn*2}},"webapp.react.root":{position:{x:0,y:ct*3+sn*2}},"webapp.react.store":{position:{x:vt*3,y:ct*3+sn*2}},"webapp.react.views":{position:{x:0,y:ct*6}},"settings.config.package":{position:{x:vt*12,y:ct*4}},"settings.preferences.versions":{position:{x:-vt*5,y:ct*4.5}}},edges:[...["pm.prd","pm.frd"].map(e=>{const t="pm.details";return{id:`${t}-${e}`,source:t,target:e}}),...["pm.frd","pm.drd","pm.uxsmd","pm.uxdmd","pm.brd"].map(e=>{const t="pm.prd";return{id:`${t}-${e}`,source:t,target:e}}),...["pm.brd","db.schemas","db.postgres"].map(e=>{const t="pm.drd";return{id:`${t}-${e}`,source:t,target:e}}),...["backend.specifications.openapi","backend.specifications.asyncapi","pm.uxdmd"].map(e=>{const t="pm.brd";return{id:`${t}-${e}`,source:t,target:e}}),...["pm.brd","backend.specifications.openapi","backend.specifications.asyncapi"].map(e=>{const t="backend.server.main";return{id:`${e}-${t}`,source:e,target:t}}),...["pm.uxdmd","uxsitemap.structure"].map(e=>{const t="pm.uxsmd";return{id:`${t}-${e}`,source:t,target:e}}),...["uxdatamap.structure","uxdatamap.views"].map(e=>{const t="pm.uxdmd";return{id:`${t}-${e}`,source:t,target:e}}),...["webapp.react.root.app"].map(e=>{const t="uxsitemap.structure";return{id:`${t}-${e}`,source:t,target:e}}),...["webapp.react.root.app"].map(e=>{const t="uxdatamap.views";return{id:`${t}-${e}`,source:t,target:e}}),...["webapp.react.store.redux"].map(e=>{const t="uxdatamap.structure";return{id:`${t}-${e}`,source:t,target:e}}),...["backend.server.main","uxsitemap.structure"].map(e=>{const t="settings.config.package";return{id:`${t}-${e}`,source:t,target:e}}),...["uxsitemap.structure"].map(e=>{const t="settings.preferences.versions";return{id:`${t}-${e}`,source:t,target:e}})].map(e=>({animated:!0,style:{stroke:"#999"},type:"floating",markerEnd:{type:Xs.ArrowClosed,width:30,height:30},...e}))},bC={meta:{"pm.details":{type:"pm",name:"Details",desc:"User-submitted Project Details"},"pm.prd":{type:"pm",name:"PRD",desc:"Product Requirements Document"},"pm.frd":{type:"pm",name:"FRD",desc:"Features Requirements Document"},"pm.drd":{type:"pm",name:"DRD",desc:"Database Requirements Document"},"pm.brd":{type:"pm",name:"BRD",desc:"Backend Requirements Document"},"pm.uxsmd":{type:"pm",name:"UXSMD",desc:"UX Sitemap Document"},"pm.uxdmd":{type:"pm",name:"UXDMD",desc:"UX Datamap Document"},"db.schemas":{type:"db",name:"DB/schemas",desc:"Database Tables Schemas"},"db.postgres":{type:"db",name:"DB/postgres",desc:"Database Postgresql Commands"},"backend.specifications.openapi":{type:"backend",name:"backend/define:openapi",desc:"Backend Definition : openAPI"},"backend.specifications.asyncapi":{type:"backend",name:"backend/define:asyncapi",desc:"Backend Definition : asyncAPI"},"backend.server.main":{type:"backend",name:"backend/server:main",desc:"Backend Server : Main"},"uxsitemap.structure":{type:"ux",name:"ux/sitemap:structure",desc:"UX Sitemap"},"uxdatamap.structure":{type:"ux",name:"ux/datamap:structure",desc:"UX Datamap Structure"},"uxdatamap.views":{type:"ux",name:"ux/datamap:views",desc:"UX Datamap Views"},"webapp.react.root":{type:"webapp-structure",name:"webapp/react:root",desc:"Webapp App Root Component"},"webapp.react.store":{type:"webapp-structure",name:"webapp/react:store",desc:"Webapp Data Store"},"webapp.react.views":{type:"webapp-view",name:"webapp/react:views",desc:"Webapp View"},"settings.config.package":{type:"ux",name:"settings/config:package",desc:"Dependencies & .env for package.json"},"settings.preferences.versions":{type:"ux",name:"settings/preferences:versions",desc:"Components versions preferences"}},types:{"pm.details":"yaml",pm:"markdown",db:"yaml",backend:"complex",uxsitemap:"yaml",uxdatamap:"yaml","webapp-structure":"complex","webapp-view":"complex",settings:"yaml"}},Ax=Symbol.for("yaml.alias"),$0=Symbol.for("yaml.document"),Wi=Symbol.for("yaml.map"),TI=Symbol.for("yaml.pair"),ui=Symbol.for("yaml.scalar"),Ha=Symbol.for("yaml.seq"),Bn=Symbol.for("yaml.node.type"),io=e=>!!e&&typeof e=="object"&&e[Bn]===Ax,Wa=e=>!!e&&typeof e=="object"&&e[Bn]===$0,Ka=e=>!!e&&typeof e=="object"&&e[Bn]===Wi,Ue=e=>!!e&&typeof e=="object"&&e[Bn]===TI,Me=e=>!!e&&typeof e=="object"&&e[Bn]===ui,qa=e=>!!e&&typeof e=="object"&&e[Bn]===Ha;function qe(e){if(e&&typeof e=="object")switch(e[Bn]){case Wi:case Ha:return!0}return!1}function Je(e){if(e&&typeof e=="object")switch(e[Bn]){case Ax:case Wi:case ui:case Ha:return!0}return!1}const nte=e=>(Me(e)||qe(e))&&!!e.anchor,Zt=Symbol("break visit"),_I=Symbol("skip children"),_r=Symbol("remove node");function ns(e,t){const n=AI(t);Wa(e)?zo(null,e.contents,n,Object.freeze([e]))===_r&&(e.contents=null):zo(null,e,n,Object.freeze([]))}ns.BREAK=Zt;ns.SKIP=_I;ns.REMOVE=_r;function zo(e,t,n,r){const i=NI(e,t,n,r);if(Je(i)||Ue(i))return PI(e,r,i),zo(e,i,n,r);if(typeof i!="symbol"){if(qe(t)){r=Object.freeze(r.concat(t));for(let s=0;se.replace(/[!,[\]{}]/g,t=>rte[t]);class Ft{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Ft.defaultYaml,t),this.tags=Object.assign({},Ft.defaultTags,n)}clone(){const t=new Ft(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new Ft(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:Ft.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},Ft.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:Ft.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},Ft.defaultTags),this.atNextDocument=!1);const r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;const[s,o]=r;return this.tags[s]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;const[s]=r;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{const o=/^\d+\.\d+$/.test(s);return n(6,`Unsupported YAML version ${s}`,o),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){const o=t.slice(2,-1);return o==="!"||o==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),o)}const[,r,i]=t.match(/^(.*!)([^!]*)$/s);i||n(`The ${t} tag has no suffix`);const s=this.tags[r];if(s)try{return s+decodeURIComponent(i)}catch(o){return n(String(o)),null}return r==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[n,r]of Object.entries(this.tags))if(t.startsWith(r))return n+ite(t.substring(r.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags);let i;if(t&&r.length>0&&Je(t.contents)){const s={};ns(t.contents,(o,a)=>{Je(a)&&a.tag&&(s[a.tag]=!0)}),i=Object.keys(s)}else i=[];for(const[s,o]of r)s==="!!"&&o==="tag:yaml.org,2002:"||(!t||i.some(a=>a.startsWith(o)))&&n.push(`%TAG ${s} ${o}`);return n.join(` `)}}Ft.defaultYaml={explicit:!1,version:"1.2"};Ft.defaultTags={"!!":"tag:yaml.org,2002:"};function OI(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){const n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function LI(e){const t=new Set;return ns(e,{Value(n,r){r.anchor&&t.add(r.anchor)}}),t}function RI(e,t){for(let n=1;;++n){const r=`${e}${n}`;if(!t.has(r))return r}}function ste(e,t){const n=[],r=new Map;let i=null;return{onAnchor:s=>{n.push(s),i||(i=LI(e));const o=RI(t,i);return i.add(o),o},setAnchors:()=>{for(const s of n){const o=r.get(s);if(typeof o=="object"&&o.anchor&&(Me(o.node)||qe(o.node)))o.node.anchor=o.anchor;else{const a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=s,a}}},sourceObjects:r}}function Ho(e,t,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let i=0,s=r.length;iMn(r,String(i),n));if(e&&typeof e.toJSON=="function"){if(!n||!nte(e))return e.toJSON(t,n);const r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=s=>{r.res=s,delete n.onCreate};const i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e=="bigint"&&!(n!=null&&n.keep)?Number(e):e}class Nx{constructor(t){Object.defineProperty(this,Bn,{value:t})}clone(){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:s}={}){if(!Wa(t))throw new TypeError("A document argument is required");const o={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},a=Mn(this,"",o);if(typeof i=="function")for(const{count:l,res:u}of o.anchors.values())i(u,l);return typeof s=="function"?Ho(s,{"":a},"",a):a}}class Op extends Nx{constructor(t){super(Ax),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t){let n;return ns(t,{Node:(r,i)=>{if(i===this)return ns.BREAK;i.anchor===this.source&&(n=i)}}),n}toJSON(t,n){if(!n)return{source:this.source};const{anchors:r,doc:i,maxAliasCount:s}=n,o=this.resolve(i);if(!o){const l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=r.get(o);if(a||(Mn(o,null,n),a=r.get(o)),!a||a.res===void 0){const l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(s>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=td(i,o,r)),a.count*a.aliasCount>s)){const l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(t,n,r){const i=`*${this.source}`;if(t){if(OI(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){const s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(s)}if(t.implicitKey)return`${i} `}return i}}function td(e,t,n){if(io(t)){const r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(qe(t)){let r=0;for(const i of t.items){const s=td(e,i,n);s>r&&(r=s)}return r}else if(Ue(t)){const r=td(e,t.key,n),i=td(e,t.value,n);return Math.max(r,i)}return 1}const II=e=>!e||typeof e!="function"&&typeof e!="object";class ge extends Nx{constructor(t){super(ui),this.value=t}toJSON(t,n){return n!=null&&n.keep?this.value:Mn(this.value,t,n)}toString(){return String(this.value)}}ge.BLOCK_FOLDED="BLOCK_FOLDED";ge.BLOCK_LITERAL="BLOCK_LITERAL";ge.PLAIN="PLAIN";ge.QUOTE_DOUBLE="QUOTE_DOUBLE";ge.QUOTE_SINGLE="QUOTE_SINGLE";const ote="tag:yaml.org,2002:";function ate(e,t,n){if(t){const r=n.filter(s=>s.tag===t),i=r.find(s=>!s.format)??r[0];if(!i)throw new Error(`Tag ${t} not found`);return i}return n.find(r=>{var i;return((i=r.identify)==null?void 0:i.call(r,e))&&!r.format})}function Wu(e,t,n){var c,d,h;if(Wa(e)&&(e=e.contents),Je(e))return e;if(Ue(e)){const p=(d=(c=n.schema[Wi]).createNode)==null?void 0:d.call(c,n.schema,null,n);return p.items.push(e),p}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());const{aliasDuplicateObjects:r,onAnchor:i,onTagObj:s,schema:o,sourceObjects:a}=n;let l;if(r&&e&&typeof e=="object"){if(l=a.get(e),l)return l.anchor||(l.anchor=i(e)),new Op(l.anchor);l={anchor:null,node:null},a.set(e,l)}t!=null&&t.startsWith("!!")&&(t=ote+t.slice(2));let u=ate(e,t,o.tags);if(!u){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){const p=new ge(e);return l&&(l.node=p),p}u=e instanceof Map?o[Wi]:Symbol.iterator in Object(e)?o[Ha]:o[Wi]}s&&(s(u),delete n.onTagObj);const f=u!=null&&u.createNode?u.createNode(n.schema,e,n):typeof((h=u==null?void 0:u.nodeClass)==null?void 0:h.from)=="function"?u.nodeClass.from(n.schema,e,n):new ge(e);return t?f.tag=t:u.default||(f.tag=u.tag),l&&(l.node=f),f}function hh(e,t,n){let r=n;for(let i=t.length-1;i>=0;--i){const s=t[i];if(typeof s=="number"&&Number.isInteger(s)&&s>=0){const o=[];o[s]=r,r=o}else r=new Map([[s,r]])}return Wu(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}const Il=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done;class DI extends Nx{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){const n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(r=>Je(r)||Ue(r)?r.clone(t):r),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(Il(t))this.add(n);else{const[r,...i]=t,s=this.get(r,!0);if(qe(s))s.addIn(i,n);else if(s===void 0&&this.schema)this.set(r,hh(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(t){const[n,...r]=t;if(r.length===0)return this.delete(n);const i=this.get(n,!0);if(qe(i))return i.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(t,n){const[r,...i]=t,s=this.get(r,!0);return i.length===0?!n&&Me(s)?s.value:s:qe(s)?s.getIn(i,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!Ue(n))return!1;const r=n.value;return r==null||t&&Me(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(t){const[n,...r]=t;if(r.length===0)return this.has(n);const i=this.get(n,!0);return qe(i)?i.hasIn(r):!1}setIn(t,n){const[r,...i]=t;if(i.length===0)this.set(r,n);else{const s=this.get(r,!0);if(qe(s))s.setIn(i,n);else if(s===void 0&&this.schema)this.set(r,hh(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}}const lte=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function qr(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const Ps=(e,t,n)=>e.endsWith(` `)?qr(n,t):n.includes(` `)?` `+qr(n,t):(e.endsWith(" ")?"":" ")+n,MI="flow",B0="block",nd="quoted";function Lp(e,t,n="flow",{indentAtStart:r,lineWidth:i=80,minContentWidth:s=20,onFold:o,onOverflow:a}={}){if(!i||i<0)return e;ii-Math.max(2,s)?u.push(0):c=i-r);let d,h,p=!1,m=-1,w=-1,y=-1;n===B0&&(m=SC(e,m,t.length),m!==-1&&(c=m+l));for(let g;g=e[m+=1];){if(n===nd&&g==="\\"){switch(w=m,e[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}y=m}if(g===` `)n===B0&&(m=SC(e,m,t.length)),c=m+t.length+l,d=void 0;else{if(g===" "&&h&&h!==" "&&h!==` `&&h!==" "){const x=e[m+1];x&&x!==" "&&x!==` `&&x!==" "&&(d=m)}if(m>=c)if(d)u.push(d),c=d+l,d=void 0;else if(n===nd){for(;h===" "||h===" ";)h=g,g=e[m+=1],p=!0;const x=m>y+1?m-2:w-1;if(f[x])return e;u.push(x),f[x]=!0,c=x+l,d=void 0}else p=!0}h=g}if(p&&a&&a(),u.length===0)return e;o&&o();let v=e.slice(0,u[0]);for(let g=0;g({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Ip=e=>/^(%|---|\.\.\.)/m.test(e);function ute(e,t,n){if(!t||t<0)return!1;const r=t-n,i=e.length;if(i<=r)return!1;for(let s=0,o=0;sr)return!0;if(o=s+1,i-o<=r)return!1}return!0}function nu(e,t){const n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;const{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,s=t.indent||(Ip(e)?" ":"");let o="",a=0;for(let l=0,u=n[l];u;u=n[++l])if(u===" "&&n[l+1]==="\\"&&n[l+2]==="n"&&(o+=n.slice(a,l)+"\\ ",l+=1,a=l,u="\\"),u==="\\")switch(n[l+1]){case"u":{o+=n.slice(a,l);const f=n.substr(l+2,4);switch(f){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:f.substr(0,2)==="00"?o+="\\x"+f.substr(2):o+=n.substr(l,6)}l+=5,a=l+1}break;case"n":if(r||n[l+2]==='"'||n.length `;let c,d;for(d=n.length;d>0;--d){const k=n[d-1];if(k!==` `&&k!==" "&&k!==" ")break}let h=n.substring(d);const p=h.indexOf(` `);p===-1?c="-":n===h||p!==h.length-1?(c="+",s&&s()):c="",h&&(n=n.slice(0,-h.length),h[h.length-1]===` `&&(h=h.slice(0,-1)),h=h.replace(z0,`$&${u}`));let m=!1,w,y=-1;for(w=0;w")+(m?u?"2":"1":"")+c;if(e&&(x+=" "+a(e.replace(/ ?[\r\n]+/g," ")),i&&i()),f)return n=n.replace(/\n+/g,`$&${u}`),`${x} ${u}${v}${n}${h}`;n=n.replace(/\n+/g,` $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${u}`);const S=Lp(`${v}${n}${h}`,u,B0,Rp(r,!0));return`${x} ${u}${S}`}function cte(e,t,n,r){const{type:i,value:s}=e,{actualString:o,implicitKey:a,indent:l,indentStep:u,inFlow:f}=t;if(a&&s.includes(` `)||f&&/[[\]{},]/.test(s))return Wo(s,t);if(!s||/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return a||f||!s.includes(` `)?Wo(s,t):rd(e,t,n,r);if(!a&&!f&&i!==ge.PLAIN&&s.includes(` `))return rd(e,t,n,r);if(Ip(s)){if(l==="")return t.forceBlockIndent=!0,rd(e,t,n,r);if(a&&l===u)return Wo(s,t)}const c=s.replace(/\n+/g,`$& ${l}`);if(o){const d=m=>{var w;return m.default&&m.tag!=="tag:yaml.org,2002:str"&&((w=m.test)==null?void 0:w.test(c))},{compat:h,tags:p}=t.doc.schema;if(p.some(d)||h!=null&&h.some(d))return Wo(s,t)}return a?c:Lp(c,l,MI,Rp(t,!1))}function vc(e,t,n,r){const{implicitKey:i,inFlow:s}=t,o=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)});let{type:a}=e;a!==ge.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=ge.QUOTE_DOUBLE);const l=f=>{switch(f){case ge.BLOCK_FOLDED:case ge.BLOCK_LITERAL:return i||s?Wo(o.value,t):rd(o,t,n,r);case ge.QUOTE_DOUBLE:return nu(o.value,t);case ge.QUOTE_SINGLE:return V0(o.value,t);case ge.PLAIN:return cte(o,t,n,r);default:return null}};let u=l(a);if(u===null){const{defaultKeyType:f,defaultStringType:c}=t.options,d=i&&f||c;if(u=l(d),u===null)throw new Error(`Unsupported default string type ${d}`)}return u}function jI(e,t){const n=Object.assign({blockQuote:!0,commentString:lte,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t);let r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function fte(e,t){var i;if(t.tag){const s=e.filter(o=>o.tag===t.tag);if(s.length>0)return s.find(o=>o.format===t.format)??s[0]}let n,r;if(Me(t)){r=t.value;const s=e.filter(o=>{var a;return(a=o.identify)==null?void 0:a.call(o,r)});n=s.find(o=>o.format===t.format)??s.find(o=>!o.format)}else r=t,n=e.find(s=>s.nodeClass&&r instanceof s.nodeClass);if(!n){const s=((i=r==null?void 0:r.constructor)==null?void 0:i.name)??typeof r;throw new Error(`Tag not resolved for ${s} value`)}return n}function dte(e,t,{anchors:n,doc:r}){if(!r.directives)return"";const i=[],s=(Me(e)||qe(e))&&e.anchor;s&&OI(s)&&(n.add(s),i.push(`&${s}`));const o=e.tag?e.tag:t.default?null:t.tag;return o&&i.push(r.directives.tagString(o)),i.join(" ")}function Aa(e,t,n,r){var l;if(Ue(e))return e.toString(t,n,r);if(io(e)){if(t.doc.directives)return e.toString(t);if((l=t.resolvedAliases)!=null&&l.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i;const s=Je(e)?e:t.doc.createNode(e,{onTagObj:u=>i=u});i||(i=fte(t.doc.schema.tags,s));const o=dte(s,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);const a=typeof i.stringify=="function"?i.stringify(s,t,n,r):Me(s)?vc(s,t,n,r):s.toString(t,n,r);return o?Me(s)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o} ${t.indent}${a}`:a}function hte({key:e,value:t},n,r,i){const{allNullValues:s,doc:o,indent:a,indentStep:l,options:{commentString:u,indentSeq:f,simpleKeys:c}}=n;let d=Je(e)&&e.comment||null;if(c){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(qe(e)||!Je(e)&&typeof e=="object"){const C="With simple keys, collection cannot be used as a key value";throw new Error(C)}}let h=!c&&(!e||d&&t==null&&!n.inFlow||qe(e)||(Me(e)?e.type===ge.BLOCK_FOLDED||e.type===ge.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!h&&(c||!s),indent:a+l});let p=!1,m=!1,w=Aa(e,n,()=>p=!0,()=>m=!0);if(!h&&!n.inFlow&&w.length>1024){if(c)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");h=!0}if(n.inFlow){if(s||t==null)return p&&r&&r(),w===""?"?":h?`? ${w}`:w}else if(s&&!c||t==null&&h)return w=`? ${w}`,d&&!p?w+=Ps(w,n.indent,u(d)):m&&i&&i(),w;p&&(d=null),h?(d&&(w+=Ps(w,n.indent,u(d))),w=`? ${w} ${a}:`):(w=`${w}:`,d&&(w+=Ps(w,n.indent,u(d))));let y,v,g;Je(t)?(y=!!t.spaceBefore,v=t.commentBefore,g=t.comment):(y=!1,v=null,g=null,t&&typeof t=="object"&&(t=o.createNode(t))),n.implicitKey=!1,!h&&!d&&Me(t)&&(n.indentAtStart=w.length+1),m=!1,!f&&l.length>=2&&!n.inFlow&&!h&&qa(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let x=!1;const S=Aa(t,n,()=>x=!0,()=>m=!0);let k=" ";if(d||y||v){if(k=y?` `:"",v){const C=u(v);k+=` ${qr(C,n.indent)}`}S===""&&!n.inFlow?k===` `&&(k=` `):k+=` ${n.indent}`}else if(!h&&qe(t)){const C=S[0],T=S.indexOf(` `),O=T!==-1,A=n.inFlow??t.flow??t.items.length===0;if(O||!A){let j=!1;if(O&&(C==="&"||C==="!")){let L=S.indexOf(" ");C==="&"&&L!==-1&&Le===kC||Me(e)&&e.value===kC&&(!e.type||e.type===ge.PLAIN);function pg(e,t,n){const r=e&&io(n)?n.resolve(e.doc):n;if(!Ka(r))throw new Error("Merge sources must be maps or map aliases");const i=r.toJSON(null,e,Map);for(const[s,o]of i)t instanceof Map?t.has(s)||t.set(s,o):t instanceof Set?t.add(s):Object.prototype.hasOwnProperty.call(t,s)||Object.defineProperty(t,s,{value:o,writable:!0,enumerable:!0,configurable:!0});return t}function mte(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(Je(e)&&(n!=null&&n.doc)){const r=jI(n.doc,{});r.anchors=new Set;for(const s of n.anchors.keys())r.anchors.add(s.anchor);r.inFlow=!0,r.inStringifyKey=!0;const i=e.toString(r);if(!n.mapKeyWarned){let s=JSON.stringify(i);s.length>40&&(s=s.substring(0,36)+'..."'),FI(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(t)}function Px(e,t,n){const r=Wu(e,void 0,n),i=Wu(t,void 0,n);return new Ot(r,i)}class Ot{constructor(t,n=null){Object.defineProperty(this,Bn,{value:TI}),this.key=t,this.value=n}clone(t){let{key:n,value:r}=this;return Je(n)&&(n=n.clone(t)),Je(r)&&(r=r.clone(t)),new Ot(n,r)}toJSON(t,n){const r=n!=null&&n.mapAsMap?new Map:{};return $I(n,r,this)}toString(t,n,r){return t!=null&&t.doc?hte(this,t,n,r):JSON.stringify(this)}}function BI(e,t,n){return(t.inFlow??e.flow?yte:gte)(e,t,n)}function gte({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:s,onChompKeep:o,onComment:a}){const{indent:l,options:{commentString:u}}=n,f=Object.assign({},n,{indent:s,type:null});let c=!1;const d=[];for(let p=0;pw=null,()=>c=!0);w&&(y+=Ps(y,s,u(w))),c&&w&&(c=!1),d.push(r+y)}let h;if(d.length===0)h=i.start+i.end;else{h=d[0];for(let p=1;pw=null);pf||y.includes(` `))&&(u=!0),c.push(y),f=c.length}const{start:d,end:h}=n;if(c.length===0)return d+h;if(!u){const p=c.reduce((m,w)=>m+w.length+2,2);u=t.options.lineWidth>0&&p>t.options.lineWidth}if(u){let p=d;for(const m of c)p+=m?` ${s}${i}${m}`:` `;return`${p} ${i}${h}`}else return`${d}${o}${c.join(" ")}${o}${h}`}function ph({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){const s=qr(t(r),e);n.push(s.trimStart())}}function Os(e,t){const n=Me(t)?t.value:t;for(const r of e)if(Ue(r)&&(r.key===t||r.key===n||Me(r.key)&&r.key.value===n))return r}class fn extends DI{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Wi,t),this.items=[]}static from(t,n,r){const{keepUndefined:i,replacer:s}=r,o=new this(t),a=(l,u)=>{if(typeof s=="function")u=s.call(n,l,u);else if(Array.isArray(s)&&!s.includes(l))return;(u!==void 0||i)&&o.items.push(Px(l,u,r))};if(n instanceof Map)for(const[l,u]of n)a(l,u);else if(n&&typeof n=="object")for(const l of Object.keys(n))a(l,n[l]);return typeof t.sortMapEntries=="function"&&o.items.sort(t.sortMapEntries),o}add(t,n){var o;let r;Ue(t)?r=t:!t||typeof t!="object"||!("key"in t)?r=new Ot(t,t==null?void 0:t.value):r=new Ot(t.key,t.value);const i=Os(this.items,r.key),s=(o=this.schema)==null?void 0:o.sortMapEntries;if(i){if(!n)throw new Error(`Key ${r.key} already set`);Me(i.value)&&II(r.value)?i.value.value=r.value:i.value=r.value}else if(s){const a=this.items.findIndex(l=>s(r,l)<0);a===-1?this.items.push(r):this.items.splice(a,0,r)}else this.items.push(r)}delete(t){const n=Os(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){const r=Os(this.items,t),i=r==null?void 0:r.value;return(!n&&Me(i)?i.value:i)??void 0}has(t){return!!Os(this.items,t)}set(t,n){this.add(new Ot(t,n),!0)}toJSON(t,n,r){const i=r?new r:n!=null&&n.mapAsMap?new Map:{};n!=null&&n.onCreate&&n.onCreate(i);for(const s of this.items)$I(n,i,s);return i}toString(t,n,r){if(!t)return JSON.stringify(this);for(const i of this.items)if(!Ue(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),BI(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:r,onComment:n})}}const Ya={collection:"map",default:!0,nodeClass:fn,tag:"tag:yaml.org,2002:map",resolve(e,t){return Ka(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>fn.from(e,t,n)};class rs extends DI{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(Ha,t),this.items=[]}add(t){this.items.push(t)}delete(t){const n=df(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){const r=df(t);if(typeof r!="number")return;const i=this.items[r];return!n&&Me(i)?i.value:i}has(t){const n=df(t);return typeof n=="number"&&n=0?t:null}const Ga={collection:"seq",default:!0,nodeClass:rs,tag:"tag:yaml.org,2002:seq",resolve(e,t){return qa(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>rs.from(e,t,n)},Dp={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),vc(e,t,n,r)}},Mp={identify:e=>e==null,createNode:()=>new ge(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new ge(null),stringify:({source:e},t)=>typeof e=="string"&&Mp.test.test(e)?e:t.options.nullStr},Ox={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new ge(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&Ox.test.test(e)){const r=e[0]==="t"||e[0]==="T";if(t===r)return e}return t?n.options.trueStr:n.options.falseStr}};function dr({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r=="bigint")return String(r);const i=typeof r=="number"?r:Number(r);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let s=JSON.stringify(r);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^\d/.test(s)){let o=s.indexOf(".");o<0&&(o=s.length,s+=".");let a=t-(s.length-o-1);for(;a-- >0;)s+="0"}return s}const VI={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:dr},zI={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():dr(e)}},UI={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){const t=new ge(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:dr},jp=e=>typeof e=="bigint"||Number.isInteger(e),Lx=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function HI(e,t,n){const{value:r}=e;return jp(r)&&r>=0?n+r.toString(t):dr(e)}const WI={identify:e=>jp(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>Lx(e,2,8,n),stringify:e=>HI(e,8,"0o")},KI={identify:jp,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>Lx(e,0,10,n),stringify:dr},qI={identify:e=>jp(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>Lx(e,2,16,n),stringify:e=>HI(e,16,"0x")},vte=[Ya,Ga,Dp,Mp,Ox,WI,KI,qI,VI,zI,UI];function EC(e){return typeof e=="bigint"||Number.isInteger(e)}const hf=({value:e})=>JSON.stringify(e),wte=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:hf},{identify:e=>e==null,createNode:()=>new ge(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:hf},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true|false$/,resolve:e=>e==="true",stringify:hf},{identify:EC,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>EC(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:hf}],xte={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},bte=[Ya,Ga].concat(wte,xte),Rx={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof Buffer=="function")return Buffer.from(e,"base64");if(typeof atob=="function"){const n=atob(e.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let i=0;i1&&t("Each pair must have its own sequence indicator");const i=r.items[0]||new Ot(new ge(null));if(r.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${r.commentBefore} ${i.key.commentBefore}`:r.commentBefore),r.comment){const s=i.value??i.key;s.comment=s.comment?`${r.comment} ${s.comment}`:r.comment}r=i}e.items[n]=Ue(r)?r:new Ot(r)}}else t("Expected a sequence for this tag");return e}function GI(e,t,n){const{replacer:r}=n,i=new rs(e);i.tag="tag:yaml.org,2002:pairs";let s=0;if(t&&Symbol.iterator in Object(t))for(let o of t){typeof r=="function"&&(o=r.call(t,String(s++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){const u=Object.keys(o);if(u.length===1)a=u[0],l=o[a];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else a=o;i.items.push(Px(a,l,n))}return i}const Ix={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:YI,createNode:GI};class sa extends rs{constructor(){super(),this.add=fn.prototype.add.bind(this),this.delete=fn.prototype.delete.bind(this),this.get=fn.prototype.get.bind(this),this.has=fn.prototype.has.bind(this),this.set=fn.prototype.set.bind(this),this.tag=sa.tag}toJSON(t,n){if(!n)return super.toJSON(t);const r=new Map;n!=null&&n.onCreate&&n.onCreate(r);for(const i of this.items){let s,o;if(Ue(i)?(s=Mn(i.key,"",n),o=Mn(i.value,s,n)):s=Mn(i,"",n),r.has(s))throw new Error("Ordered maps must not include duplicate keys");r.set(s,o)}return r}static from(t,n,r){const i=GI(t,n,r),s=new this;return s.items=i.items,s}}sa.tag="tag:yaml.org,2002:omap";const Dx={collection:"seq",identify:e=>e instanceof Map,nodeClass:sa,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){const n=YI(e,t),r=[];for(const{key:i}of n.items)Me(i)&&(r.includes(i.value)?t(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new sa,n)},createNode:(e,t,n)=>sa.from(e,t,n)};function XI({value:e,source:t},n){return t&&(e?QI:ZI).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}const QI={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new ge(!0),stringify:XI},ZI={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new ge(!1),stringify:XI},Ste={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:dr},kte={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():dr(e)}},Ete={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){const t=new ge(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){const r=e.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(t.minFractionDigits=r.length)}return t},stringify:dr},wc=e=>typeof e=="bigint"||Number.isInteger(e);function Fp(e,t,n,{intAsBigInt:r}){const i=e[0];if((i==="-"||i==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}const o=BigInt(e);return i==="-"?BigInt(-1)*o:o}const s=parseInt(e,n);return i==="-"?-1*s:s}function Mx(e,t,n){const{value:r}=e;if(wc(r)){const i=r.toString(t);return r<0?"-"+n+i.substr(1):n+i}return dr(e)}const Cte={identify:wc,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Fp(e,2,2,n),stringify:e=>Mx(e,2,"0b")},Tte={identify:wc,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Fp(e,1,8,n),stringify:e=>Mx(e,8,"0")},_te={identify:wc,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Fp(e,0,10,n),stringify:dr},Ate={identify:wc,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Fp(e,2,16,n),stringify:e=>Mx(e,16,"0x")};class oa extends fn{constructor(t){super(t),this.tag=oa.tag}add(t){let n;Ue(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new Ot(t.key,null):n=new Ot(t,null),Os(this.items,n.key)||this.items.push(n)}get(t,n){const r=Os(this.items,t);return!n&&Ue(r)?Me(r.key)?r.key.value:r.key:r}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);const r=Os(this.items,t);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new Ot(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,r){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(t,n,r){const{replacer:i}=r,s=new this(t);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof i=="function"&&(o=i.call(n,o,o)),s.items.push(Px(o,null,r));return s}}oa.tag="tag:yaml.org,2002:set";const jx={collection:"map",identify:e=>e instanceof Set,nodeClass:oa,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>oa.from(e,t,n),resolve(e,t){if(Ka(e)){if(e.hasAllNullValues(!0))return Object.assign(new oa,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function Fx(e,t){const n=e[0],r=n==="-"||n==="+"?e.substring(1):e,i=o=>t?BigInt(o):Number(o),s=r.replace(/_/g,"").split(":").reduce((o,a)=>o*i(60)+i(a),i(0));return n==="-"?i(-1)*s:s}function JI(e){let{value:t}=e,n=o=>o;if(typeof t=="bigint")n=o=>BigInt(o);else if(isNaN(t)||!isFinite(t))return dr(e);let r="";t<0&&(r="-",t*=n(-1));const i=n(60),s=[t%i];return t<60?s.unshift(0):(t=(t-s[0])/i,s.unshift(t%i),t>=60&&(t=(t-s[0])/i,s.unshift(t))),r+s.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const eD={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>Fx(e,n),stringify:JI},tD={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>Fx(e,!1),stringify:JI},$p={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){const t=e.match($p.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,n,r,i,s,o,a]=t.map(Number),l=t[7]?Number((t[7]+"00").substr(1,3)):0;let u=Date.UTC(n,r-1,i,s||0,o||0,a||0,l);const f=t[8];if(f&&f!=="Z"){let c=Fx(f,!1);Math.abs(c)<30&&(c*=60),u-=6e4*c}return new Date(u)},stringify:({value:e})=>e.toISOString().replace(/((T00:00)?:00)?\.000Z$/,"")},CC=[Ya,Ga,Dp,Mp,QI,ZI,Cte,Tte,_te,Ate,Ste,kte,Ete,Rx,Dx,Ix,jx,eD,tD,$p],TC=new Map([["core",vte],["failsafe",[Ya,Ga,Dp]],["json",bte],["yaml11",CC],["yaml-1.1",CC]]),_C={binary:Rx,bool:Ox,float:UI,floatExp:zI,floatNaN:VI,floatTime:tD,int:KI,intHex:qI,intOct:WI,intTime:eD,map:Ya,null:Mp,omap:Dx,pairs:Ix,seq:Ga,set:jx,timestamp:$p},Nte={"tag:yaml.org,2002:binary":Rx,"tag:yaml.org,2002:omap":Dx,"tag:yaml.org,2002:pairs":Ix,"tag:yaml.org,2002:set":jx,"tag:yaml.org,2002:timestamp":$p};function mg(e,t){let n=TC.get(t);if(!n)if(Array.isArray(e))n=[];else{const r=Array.from(TC.keys()).filter(i=>i!=="yaml11").map(i=>JSON.stringify(i)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${r} or define customTags array`)}if(Array.isArray(e))for(const r of e)n=n.concat(r);else typeof e=="function"&&(n=e(n.slice()));return n.map(r=>{if(typeof r!="string")return r;const i=_C[r];if(i)return i;const s=Object.keys(_C).map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown custom tag "${r}"; use one of ${s}`)})}const Pte=(e,t)=>e.keyt.key?1:0;let nD=class rD{constructor({compat:t,customTags:n,merge:r,resolveKnownTags:i,schema:s,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(t)?mg(t,"compat"):t?mg(null,t):null,this.merge=!!r,this.name=typeof s=="string"&&s||"core",this.knownTags=i?Nte:{},this.tags=mg(n,this.name),this.toStringOptions=a??null,Object.defineProperty(this,Wi,{value:Ya}),Object.defineProperty(this,ui,{value:Dp}),Object.defineProperty(this,Ha,{value:Ga}),this.sortMapEntries=typeof o=="function"?o:o===!0?Pte:null}clone(){const t=Object.create(rD.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function Ote(e,t){var l;const n=[];let r=t.directives===!0;if(t.directives!==!1&&e.directives){const u=e.directives.toString(e);u?(n.push(u),r=!0):e.directives.docStart&&(r=!0)}r&&n.push("---");const i=jI(e,t),{commentString:s}=i.options;if(e.commentBefore){n.length!==1&&n.unshift("");const u=s(e.commentBefore);n.unshift(qr(u,""))}let o=!1,a=null;if(e.contents){if(Je(e.contents)){if(e.contents.spaceBefore&&r&&n.push(""),e.contents.commentBefore){const c=s(e.contents.commentBefore);n.push(qr(c,""))}i.forceBlockIndent=!!e.comment,a=e.contents.comment}const u=a?void 0:()=>o=!0;let f=Aa(e.contents,i,()=>a=null,u);a&&(f+=Ps(f,"",s(a))),(f[0]==="|"||f[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${f}`:n.push(f)}else n.push(Aa(e.contents,i));if((l=e.directives)!=null&&l.docEnd)if(e.comment){const u=s(e.comment);u.includes(` `)?(n.push("..."),n.push(qr(u,""))):n.push(`... ${u}`)}else n.push("...");else{let u=e.comment;u&&o&&(u=u.replace(/^\n+/,"")),u&&((!o||a)&&n[n.length-1]!==""&&n.push(""),n.push(qr(s(u),"")))}return n.join(` `)+` `}class Xa{constructor(t,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Bn,{value:$0});let i=null;typeof n=="function"||Array.isArray(n)?i=n:r===void 0&&n&&(r=n,n=void 0);const s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,uniqueKeys:!0,version:"1.2"},r);this.options=s;let{version:o}=s;r!=null&&r._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new Ft({version:o}),this.setSchema(o,r),this.contents=t===void 0?null:this.createNode(t,i,r)}clone(){const t=Object.create(Xa.prototype,{[Bn]:{value:$0}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=Je(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){ho(this.contents)&&this.contents.add(t)}addIn(t,n){ho(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){const r=LI(this);t.anchor=!n||r.has(n)?RI(n||"a",r):n}return new Op(t.anchor)}createNode(t,n,r){let i;if(typeof n=="function")t=n.call({"":t},"",t),i=n;else if(Array.isArray(n)){const w=v=>typeof v=="number"||v instanceof String||v instanceof Number,y=n.filter(w).map(String);y.length>0&&(n=n.concat(y)),i=n}else r===void 0&&n&&(r=n,n=void 0);const{aliasDuplicateObjects:s,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:u,tag:f}=r??{},{onAnchor:c,setAnchors:d,sourceObjects:h}=ste(this,o||"a"),p={aliasDuplicateObjects:s??!0,keepUndefined:l??!1,onAnchor:c,onTagObj:u,replacer:i,schema:this.schema,sourceObjects:h},m=Wu(t,f,p);return a&&qe(m)&&(m.flow=!0),d(),m}createPair(t,n,r={}){const i=this.createNode(t,null,r),s=this.createNode(n,null,r);return new Ot(i,s)}delete(t){return ho(this.contents)?this.contents.delete(t):!1}deleteIn(t){return Il(t)?this.contents==null?!1:(this.contents=null,!0):ho(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return qe(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return Il(t)?!n&&Me(this.contents)?this.contents.value:this.contents:qe(this.contents)?this.contents.getIn(t,n):void 0}has(t){return qe(this.contents)?this.contents.has(t):!1}hasIn(t){return Il(t)?this.contents!==void 0:qe(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=hh(this.schema,[t],n):ho(this.contents)&&this.contents.set(t,n)}setIn(t,n){Il(t)?this.contents=n:this.contents==null?this.contents=hh(this.schema,Array.from(t),n):ho(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let r;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Ft({version:"1.1"}),r={merge:!0,resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new Ft({version:t}),r={merge:!1,resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{const i=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new nD(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:r,maxAliasCount:i,onAnchor:s,reviver:o}={}){const a={anchors:new Map,doc:this,keep:!t,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},l=Mn(this.contents,n??"",a);if(typeof s=="function")for(const{count:u,res:f}of a.anchors.values())s(f,u);return typeof o=="function"?Ho(o,{"":l},"",l):l}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){const n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return Ote(this,t)}}function ho(e){if(qe(e))return!0;throw new Error("Expected a YAML collection as document contents")}class $x extends Error{constructor(t,n,r,i){super(),this.name=t,this.code=r,this.message=i,this.pos=n}}class Ls extends $x{constructor(t,n,r){super("YAMLParseError",t,n,r)}}class iD extends $x{constructor(t,n,r){super("YAMLWarning",t,n,r)}}const mh=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>t.linePos(a));const{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let s=i-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,"");if(s>=60&&o.length>80){const a=Math.min(s-39,o.length-79);o="…"+o.substring(a),s-=a-1}if(o.length>80&&(o=o.substring(0,79)+"…"),r>1&&/^ *$/.test(o.substring(0,s))){let a=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);a.length>80&&(a=a.substring(0,79)+`… `),o=a+o}if(/[^ ]/.test(o)){let a=1;const l=n.linePos[1];l&&l.line===r&&l.col>i&&(a=Math.max(1,Math.min(l.col-i,80-s)));const u=" ".repeat(s)+"^".repeat(a);n.message+=`: ${o} ${u} `}};function Na(e,{flow:t,indicator:n,next:r,offset:i,onError:s,parentIndent:o,startOnNewline:a}){let l=!1,u=a,f=a,c="",d="",h=!1,p=!1,m=null,w=null,y=null,v=null,g=null,x=null,S=null;for(const T of e)switch(p&&(T.type!=="space"&&T.type!=="newline"&&T.type!=="comma"&&s(T.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),p=!1),m&&(u&&T.type!=="comment"&&T.type!=="newline"&&s(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),m=null),T.type){case"space":!t&&(n!=="doc-start"||(r==null?void 0:r.type)!=="flow-collection")&&T.source.includes(" ")&&(m=T),f=!0;break;case"comment":{f||s(T,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const O=T.source.substring(1)||" ";c?c+=d+O:c=O,d="",u=!1;break}case"newline":u?c?c+=T.source:l=!0:d+=T.source,u=!0,h=!0,(w||y)&&(v=T),f=!0;break;case"anchor":w&&s(T,"MULTIPLE_ANCHORS","A node can have at most one anchor"),T.source.endsWith(":")&&s(T.offset+T.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),w=T,S===null&&(S=T.offset),u=!1,f=!1,p=!0;break;case"tag":{y&&s(T,"MULTIPLE_TAGS","A node can have at most one tag"),y=T,S===null&&(S=T.offset),u=!1,f=!1,p=!0;break}case n:(w||y)&&s(T,"BAD_PROP_ORDER",`Anchors and tags must be after the ${T.source} indicator`),x&&s(T,"UNEXPECTED_TOKEN",`Unexpected ${T.source} in ${t??"collection"}`),x=T,u=n==="seq-item-ind"||n==="explicit-key-ind",f=!1;break;case"comma":if(t){g&&s(T,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),g=T,u=!1,f=!1;break}default:s(T,"UNEXPECTED_TOKEN",`Unexpected ${T.type} token`),u=!1,f=!1}const k=e[e.length-1],C=k?k.offset+k.source.length:i;return p&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&s(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m&&(u&&m.indent<=o||(r==null?void 0:r.type)==="block-map"||(r==null?void 0:r.type)==="block-seq")&&s(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:g,found:x,spaceBefore:l,comment:c,hasNewline:h,anchor:w,tag:y,newlineAfterProp:v,end:C,start:S??C}}function Ku(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(` `))return!0;if(e.end){for(const t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(const t of e.items){for(const n of t.start)if(n.type==="newline")return!0;if(t.sep){for(const n of t.sep)if(n.type==="newline")return!0}if(Ku(t.key)||Ku(t.value))return!0}return!1;default:return!0}}function U0(e,t,n){if((t==null?void 0:t.type)==="flow-collection"){const r=t.end[0];r.indent===e&&(r.source==="]"||r.source==="}")&&Ku(t)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function sD(e,t,n){const{uniqueKeys:r}=e.options;if(r===!1)return!1;const i=typeof r=="function"?r:(s,o)=>s===o||Me(s)&&Me(o)&&s.value===o.value&&!(s.value==="<<"&&e.schema.merge);return t.some(s=>i(s.key,n))}const AC="All mapping items must start at the same column";function Lte({composeNode:e,composeEmptyNode:t},n,r,i,s){var f;const o=(s==null?void 0:s.nodeClass)??fn,a=new o(n.schema);n.atRoot&&(n.atRoot=!1);let l=r.offset,u=null;for(const c of r.items){const{start:d,key:h,sep:p,value:m}=c,w=Na(d,{indicator:"explicit-key-ind",next:h??(p==null?void 0:p[0]),offset:l,onError:i,parentIndent:r.indent,startOnNewline:!0}),y=!w.found;if(y){if(h&&(h.type==="block-seq"?i(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in h&&h.indent!==r.indent&&i(l,"BAD_INDENT",AC)),!w.anchor&&!w.tag&&!p){u=w.end,w.comment&&(a.comment?a.comment+=` `+w.comment:a.comment=w.comment);continue}(w.newlineAfterProp||Ku(h))&&i(h??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else((f=w.found)==null?void 0:f.indent)!==r.indent&&i(l,"BAD_INDENT",AC);const v=w.end,g=h?e(n,h,w,i):t(n,v,d,null,w,i);n.schema.compat&&U0(r.indent,h,i),sD(n,a.items,g)&&i(v,"DUPLICATE_KEY","Map keys must be unique");const x=Na(p??[],{indicator:"map-value-ind",next:m,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!h||h.type==="block-scalar"});if(l=x.end,x.found){y&&((m==null?void 0:m.type)==="block-map"&&!x.hasNewline&&i(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&w.starte&&(e.type==="block-map"||e.type==="block-seq");function Ite({composeNode:e,composeEmptyNode:t},n,r,i,s){const o=r.start.source==="{",a=o?"flow map":"flow sequence",l=(s==null?void 0:s.nodeClass)??(o?fn:rs),u=new l(n.schema);u.flow=!0;const f=n.atRoot;f&&(n.atRoot=!1);let c=r.offset+r.start.source.length;for(let w=0;w0){const w=xc(p,m,n.options.strict,i);w.comment&&(u.comment?u.comment+=` `+w.comment:u.comment=w.comment),u.range=[r.offset,m,w.offset]}else u.range=[r.offset,m,m];return u}function vg(e,t,n,r,i,s){const o=n.type==="block-map"?Lte(e,t,n,r,s):n.type==="block-seq"?Rte(e,t,n,r,s):Ite(e,t,n,r,s),a=o.constructor;return i==="!"||i===a.tagName?(o.tag=a.tagName,o):(i&&(o.tag=i),o)}function Dte(e,t,n,r,i){var d;const s=r.tag,o=s?t.directives.tagName(s.source,h=>i(s,"TAG_RESOLVE_FAILED",h)):null;if(n.type==="block-seq"){const{anchor:h,newlineAfterProp:p}=r,m=h&&s?h.offset>s.offset?h:s:h??s;m&&(!p||p.offseth.tag===o&&h.collection===a);if(!l){const h=t.schema.knownTags[o];if(h&&h.collection===a)t.schema.tags.push(Object.assign({},h,{default:!1})),l=h;else return h!=null&&h.collection?i(s,"BAD_COLLECTION_TYPE",`${h.tag} used for ${a} collection, but expects ${h.collection}`,!0):i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),vg(e,t,n,i,o)}const u=vg(e,t,n,i,o,l),f=((d=l.resolve)==null?void 0:d.call(l,u,h=>i(s,"TAG_RESOLVE_FAILED",h),t.options))??u,c=Je(f)?f:new ge(f);return c.range=u.range,c.tag=o,l!=null&&l.format&&(c.format=l.format),c}function oD(e,t,n){const r=t.offset,i=Mte(t,e.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[r,r,r]};const s=i.mode===">"?ge.BLOCK_FOLDED:ge.BLOCK_LITERAL,o=t.source?jte(t.source):[];let a=o.length;for(let m=o.length-1;m>=0;--m){const w=o[m][1];if(w===""||w==="\r")a=m;else break}if(a===0){const m=i.chomp==="+"&&o.length>0?` `.repeat(Math.max(1,o.length-1)):"";let w=r+i.length;return t.source&&(w+=t.source.length),{value:m,type:s,comment:i.comment,range:[r,w,w]}}let l=t.indent+i.indent,u=t.offset+i.length,f=0;for(let m=0;ml&&(l=w.length);else{w.length=a;--m)o[m][0].length>l&&(a=m+1);let c="",d="",h=!1;for(let m=0;ml||y[0]===" "?(d===" "?d=` `:!h&&d===` `&&(d=` `),c+=d+w.slice(l)+y,d=` `,h=!0):y===""?d===` `?c+=` `:d=` `:(c+=d+y,d=" ",h=!1)}switch(i.chomp){case"-":break;case"+":for(let m=a;mn(r+d,h,p);switch(i){case"scalar":a=ge.PLAIN,l=Fte(s,u);break;case"single-quoted-scalar":a=ge.QUOTE_SINGLE,l=$te(s,u);break;case"double-quoted-scalar":a=ge.QUOTE_DOUBLE,l=Bte(s,u);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[r,r+s.length,r+s.length]}}const f=r+s.length,c=xc(o,f,t,n);return{value:l,type:a,comment:c.comment,range:[r,f,c.offset]}}function Fte(e,t){let n="";switch(e[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),lD(e)}function $te(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),lD(e.slice(1,-1)).replace(/''/g,"'")}function lD(e){let t,n;try{t=new RegExp(`(.*?)(?s?e.slice(s,r+1):i)}else n+=i}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function Vte(e,t){let n="",r=e[t+1];for(;(r===" "||r===" "||r===` `||r==="\r")&&!(r==="\r"&&e[t+2]!==` `);)r===` `&&(n+=` `),t+=1,r=e[t+1];return n||(n=" "),{fold:n,offset:t}}const zte={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Ute(e,t,n,r){const i=e.substr(t,n),o=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;if(isNaN(o)){const a=e.substr(t-2,n+2);return r(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}function uD(e,t,n,r){const{value:i,type:s,comment:o,range:a}=t.type==="block-scalar"?oD(e,t,r):aD(t,e.options.strict,r),l=n?e.directives.tagName(n.source,c=>r(n,"TAG_RESOLVE_FAILED",c)):null,u=n&&l?Hte(e.schema,i,l,n,r):t.type==="scalar"?Wte(e,i,t,r):e.schema[ui];let f;try{const c=u.resolve(i,d=>r(n??t,"TAG_RESOLVE_FAILED",d),e.options);f=Me(c)?c:new ge(c)}catch(c){const d=c instanceof Error?c.message:String(c);r(n??t,"TAG_RESOLVE_FAILED",d),f=new ge(i)}return f.range=a,f.source=i,s&&(f.type=s),l&&(f.tag=l),u.format&&(f.format=u.format),o&&(f.comment=o),f}function Hte(e,t,n,r,i){var a;if(n==="!")return e[ui];const s=[];for(const l of e.tags)if(!l.collection&&l.tag===n)if(l.default&&l.test)s.push(l);else return l;for(const l of s)if((a=l.test)!=null&&a.test(t))return l;const o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[ui])}function Wte({directives:e,schema:t},n,r,i){const s=t.tags.find(o=>{var a;return o.default&&((a=o.test)==null?void 0:a.test(n))})||t[ui];if(t.compat){const o=t.compat.find(a=>{var l;return a.default&&((l=a.test)==null?void 0:l.test(n))})??t[ui];if(s.tag!==o.tag){const a=e.tagString(s.tag),l=e.tagString(o.tag),u=`Value may be parsed as either ${a} or ${l}`;i(r,"TAG_RESOLVE_FAILED",u,!0)}}return s}function Kte(e,t,n){if(t){n===null&&(n=t.length);for(let r=n-1;r>=0;--r){let i=t[r];switch(i.type){case"space":case"comment":case"newline":e-=i.source.length;continue}for(i=t[++r];(i==null?void 0:i.type)==="space";)e+=i.source.length,i=t[++r];break}}return e}const qte={composeNode:cD,composeEmptyNode:Bx};function cD(e,t,n,r){const{spaceBefore:i,comment:s,anchor:o,tag:a}=n;let l,u=!0;switch(t.type){case"alias":l=Yte(e,t,r),(o||a)&&r(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=uD(e,t,a,r),o&&(l.anchor=o.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":l=Dte(qte,e,t,n,r),o&&(l.anchor=o.source.substring(1));break;default:{const f=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;r(t,"UNEXPECTED_TOKEN",f),l=Bx(e,t.offset,void 0,null,n,r),u=!1}}return o&&l.anchor===""&&r(o,"BAD_ALIAS","Anchor cannot be an empty string"),i&&(l.spaceBefore=!0),s&&(t.type==="scalar"&&t.source===""?l.comment=s:l.commentBefore=s),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function Bx(e,t,n,r,{spaceBefore:i,comment:s,anchor:o,tag:a,end:l},u){const f={type:"scalar",offset:Kte(t,n,r),indent:-1,source:""},c=uD(e,f,a,u);return o&&(c.anchor=o.source.substring(1),c.anchor===""&&u(o,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(c.spaceBefore=!0),s&&(c.comment=s,c.range[2]=l),c}function Yte({options:e},{offset:t,source:n,end:r},i){const s=new Op(n.substring(1));s.source===""&&i(t,"BAD_ALIAS","Alias cannot be an empty string"),s.source.endsWith(":")&&i(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const o=t+n.length,a=xc(r,o,e.strict,i);return s.range=[t,o,a.offset],a.comment&&(s.comment=a.comment),s}function Gte(e,t,{offset:n,start:r,value:i,end:s},o){const a=Object.assign({_directives:t},e),l=new Xa(void 0,a),u={atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},f=Na(r,{indicator:"doc-start",next:i??(s==null?void 0:s[0]),offset:n,onError:o,parentIndent:0,startOnNewline:!0});f.found&&(l.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!f.hasNewline&&o(f.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=i?cD(u,i,f,o):Bx(u,f.end,r,null,f,o);const c=l.contents.range[2],d=xc(s,c,!1,o);return d.comment&&(l.comment=d.comment),l.range=[n,c,d.offset],l}function wl(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];const{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function NC(e){var i;let t="",n=!1,r=!1;for(let s=0;s{const o=wl(n);s?this.warnings.push(new iD(o,r,i)):this.errors.push(new Ls(o,r,i))},this.directives=new Ft({version:t.version||"1.2"}),this.options=t}decorate(t,n){const{comment:r,afterEmptyLine:i}=NC(this.prelude);if(r){const s=t.contents;if(n)t.comment=t.comment?`${t.comment} ${r}`:r;else if(i||t.directives.docStart||!s)t.commentBefore=r;else if(qe(s)&&!s.flow&&s.items.length>0){let o=s.items[0];Ue(o)&&(o=o.key);const a=o.commentBefore;o.commentBefore=a?`${r} ${a}`:r}else{const o=s.commentBefore;s.commentBefore=o?`${r} ${o}`:r}}n?(Array.prototype.push.apply(t.errors,this.errors),Array.prototype.push.apply(t.warnings,this.warnings)):(t.errors=this.errors,t.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:NC(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,n=!1,r=-1){for(const i of t)yield*this.next(i);yield*this.end(n,r)}*next(t){switch(t.type){case"directive":this.directives.add(t.source,(n,r,i)=>{const s=wl(t);s[0]+=n,this.onError(s,"BAD_DIRECTIVE",r,i)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{const n=Gte(this.options,this.directives,t,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{const n=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,r=new Ls(wl(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){const r="Unexpected doc-end without preceding document";this.errors.push(new Ls(wl(t),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;const n=xc(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){const r=this.doc.comment;this.doc.comment=r?`${r} ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new Ls(wl(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){const r=Object.assign({_directives:this.directives},this.options),i=new Xa(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,n,n],this.decorate(i,!1),yield i}}}function Xte(e,t=!0,n){if(e){const r=(i,s,o)=>{const a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(n)n(a,s,o);else throw new Ls([a,a+1],s,o)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return aD(e,t,r);case"block-scalar":return oD({options:{strict:t}},e,r)}}return null}function Qte(e,t){const{implicitKey:n=!1,indent:r,inFlow:i=!1,offset:s=-1,type:o="PLAIN"}=t,a=vc({type:o,value:e},{implicitKey:n,indent:r>0?" ".repeat(r):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),l=t.end??[{type:"newline",offset:-1,indent:r,source:` `}];switch(a[0]){case"|":case">":{const u=a.indexOf(` `),f=a.substring(0,u),c=a.substring(u+1)+` `,d=[{type:"block-scalar-header",offset:s,indent:r,source:f}];return fD(d,l)||d.push({type:"newline",offset:-1,indent:r,source:` `}),{type:"block-scalar",offset:s,indent:r,props:d,source:c}}case'"':return{type:"double-quoted-scalar",offset:s,indent:r,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:s,indent:r,source:a,end:l};default:return{type:"scalar",offset:s,indent:r,source:a,end:l}}}function Zte(e,t,n={}){let{afterKey:r=!1,implicitKey:i=!1,inFlow:s=!1,type:o}=n,a="indent"in e?e.indent:null;if(r&&typeof a=="number"&&(a+=2),!o)switch(e.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{const u=e.props[0];if(u.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=u.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}const l=vc({type:o,value:t},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":Jte(e,l);break;case'"':wg(e,l,"double-quoted-scalar");break;case"'":wg(e,l,"single-quoted-scalar");break;default:wg(e,l,"scalar")}}function Jte(e,t){const n=t.indexOf(` `),r=t.substring(0,n),i=t.substring(n+1)+` `;if(e.type==="block-scalar"){const s=e.props[0];if(s.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s.source=r,e.source=i}else{const{offset:s}=e,o="indent"in e?e.indent:-1,a=[{type:"block-scalar-header",offset:s,indent:o,source:r}];fD(a,"end"in e?e.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:` `});for(const l of Object.keys(e))l!=="type"&&l!=="offset"&&delete e[l];Object.assign(e,{type:"block-scalar",indent:o,props:a,source:i})}}function fD(e,t){if(t)for(const n of t)switch(n.type){case"space":case"comment":e.push(n);break;case"newline":return e.push(n),!0}return!1}function wg(e,t,n){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=n,e.source=t;break;case"block-scalar":{const r=e.props.slice(1);let i=t.length;e.props[0].type==="block-scalar-header"&&(i-=e.props[0].source.length);for(const s of r)s.offset+=i;delete e.props,Object.assign(e,{type:n,source:t,end:r});break}case"block-map":case"block-seq":{const i={type:"newline",offset:e.offset+t.length,indent:e.indent,source:` `};delete e.items,Object.assign(e,{type:n,source:t,end:[i]});break}default:{const r="indent"in e?e.indent:-1,i="end"in e&&Array.isArray(e.end)?e.end.filter(s=>s.type==="space"||s.type==="comment"||s.type==="newline"):[];for(const s of Object.keys(e))s!=="type"&&s!=="offset"&&delete e[s];Object.assign(e,{type:n,indent:r,source:t,end:i})}}}const ene=e=>"type"in e?gh(e):id(e);function gh(e){switch(e.type){case"block-scalar":{let t="";for(const n of e.props)t+=gh(n);return t+e.source}case"block-map":case"block-seq":{let t="";for(const n of e.items)t+=id(n);return t}case"flow-collection":{let t=e.start.source;for(const n of e.items)t+=id(n);for(const n of e.end)t+=n.source;return t}case"document":{let t=id(e);if(e.end)for(const n of e.end)t+=n.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(const n of e.end)t+=n.source;return t}}}function id({start:e,key:t,sep:n,value:r}){let i="";for(const s of e)i+=s.source;if(t&&(i+=gh(t)),n)for(const s of n)i+=s.source;return r&&(i+=gh(r)),i}const H0=Symbol("break visit"),tne=Symbol("skip children"),dD=Symbol("remove item");function Qs(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),hD(Object.freeze([]),e,t)}Qs.BREAK=H0;Qs.SKIP=tne;Qs.REMOVE=dD;Qs.itemAtPath=(e,t)=>{let n=e;for(const[r,i]of t){const s=n==null?void 0:n[r];if(s&&"items"in s)n=s.items[i];else return}return n};Qs.parentCollection=(e,t)=>{const n=Qs.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n==null?void 0:n[r];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function hD(e,t,n){let r=n(t,e);if(typeof r=="symbol")return r;for(const i of["key","value"]){const s=t[i];if(s&&"items"in s){for(let o=0;o!!e&&"items"in e,rne=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function ine(e){switch(e){case Bp:return"";case Vp:return"";case zp:return"";case qu:return"";default:return JSON.stringify(e)}}function pD(e){switch(e){case Bp:return"byte-order-mark";case Vp:return"doc-mode";case zp:return"flow-error-end";case qu:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` `:case`\r `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}const sne=Object.freeze(Object.defineProperty({__proto__:null,BOM:Bp,DOCUMENT:Vp,FLOW_END:zp,SCALAR:qu,createScalarToken:Qte,isCollection:nne,isScalar:rne,prettyToken:ine,resolveAsScalar:Xte,setScalarValue:Zte,stringify:ene,tokenType:pD,visit:Qs},Symbol.toStringTag,{value:"Module"}));function Kn(e){switch(e){case void 0:case" ":case` `:case"\r":case" ":return!0;default:return!1}}const PC=new Set("0123456789ABCDEFabcdef"),one=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),pf=new Set(",[]{}"),ane=new Set(` ,[]{} \r `),xg=e=>!e||ane.has(e);class mD{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,n=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!n;let r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===` `?!0:n==="\r"?this.buffer[t+1]===` `:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let n=this.buffer[t];if(this.indentNext>0){let r=0;for(;n===" ";)n=this.buffer[++r+t];if(n==="\r"){const i=this.buffer[r+t+1];if(i===` `||!i&&!this.atEnd)return t+r+1}return n===` `||r>=this.indentNext||!n&&!this.atEnd?t+r:-1}if(n==="-"||n==="."){const r=this.buffer.substr(t,3);if((r==="---"||r==="...")&&Kn(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&tthis.indentValue&&!Kn(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){const[t,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&Kn(n)){const r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);const t=this.getLine();if(t===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(t[n]){case"#":yield*this.pushCount(t.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(xg),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,n,r=-1;do t=yield*this.pushNewline(),t>0?(n=yield*this.pushSpaces(!1),this.indentValue=r=n):n=0,n+=yield*this.pushSpaces(!0);while(t+n>0);const i=this.getLine();if(i===null)return this.setNext("flow");if((r!==-1&&r"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>Kn(n)||n==="#")}*parseBlockScalar(){let t=this.pos-1,n=0,r;e:for(let s=this.pos;r=this.buffer[s];++s)switch(r){case" ":n+=1;break;case` `:t=s,n=0;break;case"\r":{const o=this.buffer[s+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===` `)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{const s=this.continueScalar(t+1);if(s===-1)break;t=this.buffer.indexOf(` `,s)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let i=t+1;for(r=this.buffer[i];r===" ";)r=this.buffer[++i];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===` `;)r=this.buffer[++i];t=i-1}else if(!this.blockScalarKeep)do{let s=t-1,o=this.buffer[s];o==="\r"&&(o=this.buffer[--s]);const a=s;for(;o===" ";)o=this.buffer[--s];if(o===` `&&s>=this.pos&&s+1+n>a)t=s;else break}while(!0);return yield qu,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const t=this.flowLevel>0;let n=this.pos-1,r=this.pos-1,i;for(;i=this.buffer[++r];)if(i===":"){const s=this.buffer[r+1];if(Kn(s)||t&&pf.has(s))break;n=r}else if(Kn(i)){let s=this.buffer[r+1];if(i==="\r"&&(s===` `?(r+=1,i=` `,s=this.buffer[r+1]):n=r),s==="#"||t&&pf.has(s))break;if(i===` `){const o=this.continueScalar(r+1);if(o===-1)break;r=Math.max(r,o-2)}}else{if(t&&pf.has(i))break;n=r}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield qu,yield*this.pushToIndex(n+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,n){const r=this.buffer.slice(this.pos,t);return r?(yield r,this.pos+=r.length,r.length):(n&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(xg))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{const t=this.flowLevel>0,n=this.charAt(1);if(Kn(n)||t&&pf.has(n))return t?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,n=this.buffer[t];for(;!Kn(n)&&n!==">";)n=this.buffer[++t];return yield*this.pushToIndex(n===">"?t+1:t,!1)}else{let t=this.pos+1,n=this.buffer[t];for(;n;)if(one.has(n))n=this.buffer[++t];else if(n==="%"&&PC.has(this.buffer[t+1])&&PC.has(this.buffer[t+2]))n=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){const t=this.buffer[this.pos];return t===` `?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===` `?yield*this.pushCount(2):0}*pushSpaces(t){let n=this.pos-1,r;do r=this.buffer[++n];while(r===" "||t&&r===" ");const i=n-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*pushUntil(t){let n=this.pos,r=this.buffer[n];for(;!t(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}}class gD{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,r=this.lineStarts.length;for(;n>1;this.lineStarts[s]=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;((n=e[++t])==null?void 0:n.type)==="space";);return e.splice(t,e.length)}function LC(e){if(e.start.type==="flow-seq-start")for(const t of e.items)t.sep&&!t.value&&!ks(t.start,"explicit-key-ind")&&!ks(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,yD(t.value)?t.value.end?Array.prototype.push.apply(t.value.end,t.sep):t.value.end=t.sep:Array.prototype.push.apply(t.start,t.sep),delete t.sep)}class zx{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new mD,this.onNewLine=t}*parse(t,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(const r of this.lexer.lex(t,n))yield*this.next(r);n||(yield*this.end())}*next(t){if(this.source=t,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}const n=pD(t);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{const r=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:t}),this.offset+=t.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){const t=this.peek(1);if(this.type==="doc-end"&&(!t||t.type!=="doc-end")){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){const n=t??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{const r=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in r?r.indent:0:n.type==="flow-collection"&&r.type==="document"&&(n.indent=0),n.type==="flow-collection"&&LC(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{const i=r.items[r.items.length-1];if(i.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=n;else{Object.assign(i,{key:n,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{const i=r.items[r.items.length-1];i.value?r.items.push({start:[],value:n}):i.value=n;break}case"flow-collection":{const i=r.items[r.items.length-1];!i||i.value?r.items.push({start:[],key:n,sep:[]}):i.sep?i.value=n:Object.assign(i,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){const i=n.items[n.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&OC(i.start)===-1&&(n.indent===0||i.start.every(s=>s.type!=="comment"||s.indent=t.indent){const i=!this.onKeyLine&&this.indent===t.indent,s=i&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind";let o=[];if(s&&n.sep&&!n.value){const a=[];for(let l=0;lt.indent&&(a.length=0);break;default:a.length=0}}a.length>=2&&(o=n.sep.splice(a[1]))}switch(this.type){case"anchor":case"tag":s||n.value?(o.push(this.sourceToken),t.items.push({start:o}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):s||n.value?(o.push(this.sourceToken),t.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(ks(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(yD(n.key)&&!ks(n.sep,"newline")){const a=po(n.start),l=n.key,u=n.sep;u.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:l,sep:u}]})}else o.length>0?n.sep=n.sep.concat(o,this.sourceToken):n.sep.push(this.sourceToken);else if(ks(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const a=po(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||s?t.items.push({start:o,key:null,sep:[this.sourceToken]}):ks(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const a=this.flowScalar(this.type);s||n.value?(t.items.push({start:o,key:a,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(a):(Object.assign(n,{key:a,sep:[]}),this.onKeyLine=!0);return}default:{const a=this.startBlockValue(t);if(a){i&&a.type!=="block-seq"&&t.items.push({start:o}),this.stack.push(a);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){var r;const n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){const i="end"in n.value?n.value.end:void 0,s=Array.isArray(i)?i[i.length-1]:void 0;(s==null?void 0:s.type)==="comment"?i==null||i.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,t.indent)){const i=t.items[t.items.length-2],s=(r=i==null?void 0:i.value)==null?void 0:r.end;if(Array.isArray(s)){Array.prototype.push.apply(s,n.start),s.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=t.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;n.value||ks(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){const i=this.startBlockValue(t);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){const n=t.items[t.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r&&r.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?t.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const i=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:i,sep:[]}):n.sep?this.stack.push(i):Object.assign(n,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}const r=this.startBlockValue(t);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{const r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===t.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){const i=mf(r),s=po(i);LC(t);const o=t.end.splice(1,t.end.length);o.push(this.sourceToken);const a={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:s,key:t,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let n=this.source.indexOf(` `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(` `,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const n=mf(t),r=po(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=mf(t),r=po(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function vD(e){const t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new gD||null,prettyErrors:t}}function lne(e,t={}){const{lineCounter:n,prettyErrors:r}=vD(t),i=new zx(n==null?void 0:n.addNewLine),s=new Vx(t),o=Array.from(s.compose(i.parse(e)));if(r&&n)for(const a of o)a.errors.forEach(mh(e,n)),a.warnings.forEach(mh(e,n));return o.length>0?o:Object.assign([],{empty:!0},s.streamInfo())}function wD(e,t={}){const{lineCounter:n,prettyErrors:r}=vD(t),i=new zx(n==null?void 0:n.addNewLine),s=new Vx(t);let o=null;for(const a of s.compose(i.parse(e),!0,e.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new Ls(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(o.errors.forEach(mh(e,n)),o.warnings.forEach(mh(e,n))),o}function une(e,t,n){let r;typeof t=="function"?r=t:n===void 0&&t&&typeof t=="object"&&(n=t);const i=wD(e,n);if(!i)return null;if(i.warnings.forEach(s=>FI(i.options.logLevel,s)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function cne(e,t,n){let r=null;if(typeof t=="function"||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n=="string"&&(n=n.length),typeof n=="number"){const i=Math.round(n);n=i<1?void 0:i>8?{indent:8}:{indent:i}}if(e===void 0){const{keepUndefined:i}=n??t??{};if(!i)return}return new Xa(e,r,n).toString(n)}const xl=Object.freeze(Object.defineProperty({__proto__:null,Alias:Op,CST:sne,Composer:Vx,Document:Xa,Lexer:mD,LineCounter:gD,Pair:Ot,Parser:zx,Scalar:ge,Schema:nD,YAMLError:$x,YAMLMap:fn,YAMLParseError:Ls,YAMLSeq:rs,YAMLWarning:iD,isAlias:io,isCollection:qe,isDocument:Wa,isMap:Ka,isNode:Je,isPair:Ue,isScalar:Me,isSeq:qa,parse:une,parseAllDocuments:lne,parseDocument:wD,stringify:cne,visit:ns,visitAsync:Pp},Symbol.toStringTag,{value:"Module"}));function fne(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const dne=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,hne=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,pne={};function RC(e,t){return(pne.jsx?hne:dne).test(e)}const mne=/[ \t\n\f\r]/g;function gne(e){return typeof e=="object"?e.type==="text"?IC(e.value):!1:IC(e)}function IC(e){return e.replace(mne,"")===""}let bc=class{constructor(t,n,r){this.property=t,this.normal=n,r&&(this.space=r)}};bc.prototype.property={};bc.prototype.normal={};bc.prototype.space=null;function xD(e,t){const n={},r={};let i=-1;for(;++i4&&n.slice(0,4)==="data"&&bne.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(MC,Cne);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!MC.test(s)){let o=s.replace(Sne,Ene);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=Ux}return new i(r,t)}function Ene(e){return"-"+e.toLowerCase()}function Cne(e){return e.charAt(1).toUpperCase()}const Tne={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},_ne=xD([kD,SD,TD,_D,wne],"html"),Hx=xD([kD,SD,TD,_D,xne],"svg");function Ane(e){return e.join(" ").trim()}var AD={},jC=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Nne=/\n/g,Pne=/^\s*/,One=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Lne=/^:\s*/,Rne=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Ine=/^[;\s]*/,Dne=/^\s+|\s+$/g,Mne=` `,FC="/",$C="*",Es="",jne="comment",Fne="declaration",$ne=function(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(p){var m=p.match(Nne);m&&(n+=m.length);var w=p.lastIndexOf(Mne);r=~w?p.length-w:r+p.length}function s(){var p={line:n,column:r};return function(m){return m.position=new o(p),u(),m}}function o(p){this.start=p,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function a(p){var m=new Error(t.source+":"+n+":"+r+": "+p);if(m.reason=p,m.filename=t.source,m.line=n,m.column=r,m.source=e,!t.silent)throw m}function l(p){var m=p.exec(e);if(m){var w=m[0];return i(w),e=e.slice(w.length),m}}function u(){l(Pne)}function f(p){var m;for(p=p||[];m=c();)m!==!1&&p.push(m);return p}function c(){var p=s();if(!(FC!=e.charAt(0)||$C!=e.charAt(1))){for(var m=2;Es!=e.charAt(m)&&($C!=e.charAt(m)||FC!=e.charAt(m+1));)++m;if(m+=2,Es===e.charAt(m-1))return a("End of comment missing");var w=e.slice(2,m-2);return r+=2,i(w),e=e.slice(m),r+=2,p({type:jne,comment:w})}}function d(){var p=s(),m=l(One);if(m){if(c(),!l(Lne))return a("property missing ':'");var w=l(Rne),y=p({type:Fne,property:BC(m[0].replace(jC,Es)),value:w?BC(w[0].replace(jC,Es)):Es});return l(Ine),y}}function h(){var p=[];f(p);for(var m;m=d();)m!==!1&&(p.push(m),f(p));return p}return u(),h()};function BC(e){return e?e.replace(Dne,Es):Es}var Bne=la&&la.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(AD,"__esModule",{value:!0});var VC=AD.default=zne,Vne=Bne($ne);function zne(e,t){var n=null;if(!e||typeof e!="string")return n;var r=(0,Vne.default)(e),i=typeof t=="function";return r.forEach(function(s){if(s.type==="declaration"){var o=s.property,a=s.value;i?t(o,a,s):a&&(n=n||{},n[o]=a)}}),n}const Une=VC.default||VC,ND=PD("end"),Wx=PD("start");function PD(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Hne(e){const t=Wx(e),n=ND(e);if(t&&n)return{start:t,end:n}}function ru(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?zC(e.position):"start"in e||"end"in e?zC(e):"line"in e||"column"in e?q0(e):""}function q0(e){return UC(e&&e.line)+":"+UC(e&&e.column)}function zC(e){return q0(e&&e.start)+"-"+q0(e&&e.end)}function UC(e){return e&&typeof e=="number"?e:1}class Rt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=a?a.line:void 0,this.name=ru(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual,this.expected,this.note,this.url}}Rt.prototype.file="";Rt.prototype.name="";Rt.prototype.reason="";Rt.prototype.message="";Rt.prototype.stack="";Rt.prototype.column=void 0;Rt.prototype.line=void 0;Rt.prototype.ancestors=void 0;Rt.prototype.cause=void 0;Rt.prototype.fatal=void 0;Rt.prototype.place=void 0;Rt.prototype.ruleId=void 0;Rt.prototype.source=void 0;const Kx={}.hasOwnProperty,Wne=new Map,Kne=/[A-Z]/g,qne=/-([a-z])/g,Yne=new Set(["table","tbody","thead","tfoot","tr"]),Gne=new Set(["td","th"]),OD="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Xne(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=ire(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=rre(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Hx:_ne,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=LD(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function LD(e,t,n){if(t.type==="element")return Qne(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Zne(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return ere(e,t,n);if(t.type==="mdxjsEsm")return Jne(e,t);if(t.type==="root")return tre(e,t,n);if(t.type==="text")return nre(e,t)}function Qne(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Hx,e.schema=i),e.ancestors.push(t);const s=ID(e,t.tagName,!1),o=sre(e,t);let a=Yx(e,t);return Yne.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!gne(l):!0})),RD(e,o,s,t),qx(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function Zne(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Yu(e,t.position)}function Jne(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Yu(e,t.position)}function ere(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Hx,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:ID(e,t.name,!0),o=ore(e,t),a=Yx(e,t);return RD(e,o,s,t),qx(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function tre(e,t,n){const r={};return qx(r,Yx(e,t)),e.create(t,e.Fragment,r,n)}function nre(e,t){return t.value}function RD(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function qx(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function rre(e,t,n){return r;function r(i,s,o,a){const u=Array.isArray(o.children)?n:t;return a?u(s,o,a):u(s,o)}}function ire(e,t){return n;function n(r,i,s,o){const a=Array.isArray(s.children),l=Wx(r);return t(i,s,o,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function sre(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Kx.call(t.properties,i)){const s=are(e,i,t.properties[i]);if(s){const[o,a]=s;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&Gne.has(t.tagName)?r=a:n[o]=a}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function ore(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const o=s.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Yu(e,t.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,s=e.evaluater.evaluateExpression(a.expression)}else Yu(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function Yx(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:Wne;for(;++ri?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);s0?(jn(e,e.length,0,t),e):t}const KC={}.hasOwnProperty;function MD(e){const t={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function sr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const $t=fs(/[A-Za-z]/),Nt=fs(/[\dA-Za-z]/),yre=fs(/[#-'*+\--9=?A-Z^-~]/);function yh(e){return e!==null&&(e<32||e===127)}const Y0=fs(/\d/),vre=fs(/[\dA-Fa-f]/),wre=fs(/[!-/:-@[-`{-~]/);function fe(e){return e!==null&&e<-2}function Re(e){return e!==null&&(e<0||e===32)}function Se(e){return e===-2||e===-1||e===32}const Up=fs(new RegExp("\\p{P}|\\p{S}","u")),Zs=fs(/\s/);function fs(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Za(e){const t=[];let n=-1,r=0,i=0;for(;++n55295&&s<57344){const a=e.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(o=String.fromCharCode(s,a),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Ce(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return Se(l)?(e.enter(n),a(l)):t(l)}function a(l){return Se(l)&&s++o))return;const C=t.events.length;let T=C,O,A;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(O){A=t.events[T][1].end;break}O=!0}for(y(r),k=C;kg;){const S=n[x];t.containerState=S[1],S[0].exit.call(t,e)}n.length=g}function v(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Ere(e,t,n){return Ce(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function vh(e){if(e===null||Re(e)||Zs(e))return 1;if(Up(e))return 2}function Hp(e,t,n){const r=[];let i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const c=Object.assign({},e[r][1].end),d=Object.assign({},e[n][1].start);YC(c,-l),YC(d,l),o={type:l>1?"strongSequence":"emphasisSequence",start:c,end:Object.assign({},e[r][1].end)},a={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:d},s={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},i={type:l>1?"strong":"emphasis",start:Object.assign({},o.start),end:Object.assign({},a.end)},e[r][1].end=Object.assign({},o.start),e[n][1].start=Object.assign({},a.end),u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Rn(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Rn(u,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),u=Rn(u,Hp(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Rn(u,[["exit",s,t],["enter",a,t],["exit",a,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(f=2,u=Rn(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):f=0,jn(e,r-1,n-r+3,u),n=r+u.length-f-2;break}}for(n=-1;++n0&&Se(k)?Ce(e,v,"linePrefix",s+1)(k):v(k)}function v(k){return k===null||fe(k)?e.check(GC,m,x)(k):(e.enter("codeFlowValue"),g(k))}function g(k){return k===null||fe(k)?(e.exit("codeFlowValue"),v(k)):(e.consume(k),g)}function x(k){return e.exit("codeFenced"),t(k)}function S(k,C,T){let O=0;return A;function A(M){return k.enter("lineEnding"),k.consume(M),k.exit("lineEnding"),j}function j(M){return k.enter("codeFencedFence"),Se(M)?Ce(k,L,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):L(M)}function L(M){return M===a?(k.enter("codeFencedFenceSequence"),B(M)):T(M)}function B(M){return M===a?(O++,k.consume(M),B):O>=o?(k.exit("codeFencedFenceSequence"),Se(M)?Ce(k,N,"whitespace")(M):N(M)):T(M)}function N(M){return M===null||fe(M)?(k.exit("codeFencedFence"),C(M)):T(M)}}}function Mre(e,t,n){const r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const kg={name:"codeIndented",tokenize:Fre},jre={tokenize:$re,partial:!0};function Fre(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),Ce(e,s,"linePrefix",5)(u)}function s(u){const f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?l(u):fe(u)?e.attempt(jre,o,l)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||fe(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),a)}function l(u){return e.exit("codeIndented"),t(u)}}function $re(e,t,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):fe(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):Ce(e,s,"linePrefix",5)(o)}function s(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):fe(o)?i(o):n(o)}}const Bre={name:"codeText",tokenize:Ure,resolve:Vre,previous:zre};function Vre(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&bl(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),bl(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),bl(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function zD(e,t,n,r,i,s,o,a,l){const u=l||Number.POSITIVE_INFINITY;let f=0;return c;function c(y){return y===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(y),e.exit(s),d):y===null||y===32||y===41||yh(y)?n(y):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),m(y))}function d(y){return y===62?(e.enter(s),e.consume(y),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===62?(e.exit("chunkString"),e.exit(a),d(y)):y===null||y===60||fe(y)?n(y):(e.consume(y),y===92?p:h)}function p(y){return y===60||y===62||y===92?(e.consume(y),h):h(y)}function m(y){return!f&&(y===null||y===41||Re(y))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),t(y)):f999||h===null||h===91||h===93&&!l||h===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(h):h===93?(e.exit(s),e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):fe(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),f):(e.enter("chunkString",{contentType:"string"}),c(h))}function c(h){return h===null||h===91||h===93||fe(h)||a++>999?(e.exit("chunkString"),f(h)):(e.consume(h),l||(l=!Se(h)),h===92?d:c)}function d(h){return h===91||h===92||h===93?(e.consume(h),a++,c):c(h)}}function HD(e,t,n,r,i,s){let o;return a;function a(d){return d===34||d===39||d===40?(e.enter(r),e.enter(i),e.consume(d),e.exit(i),o=d===40?41:d,l):n(d)}function l(d){return d===o?(e.enter(i),e.consume(d),e.exit(i),e.exit(r),t):(e.enter(s),u(d))}function u(d){return d===o?(e.exit(s),l(o)):d===null?n(d):fe(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),Ce(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),f(d))}function f(d){return d===o||d===null||fe(d)?(e.exit("chunkString"),u(d)):(e.consume(d),d===92?c:f)}function c(d){return d===o||d===92?(e.consume(d),f):f(d)}}function iu(e,t){let n;return r;function r(i){return fe(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Se(i)?Ce(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const Qre={name:"definition",tokenize:Jre},Zre={tokenize:eie,partial:!0};function Jre(e,t,n){const r=this;let i;return s;function s(h){return e.enter("definition"),o(h)}function o(h){return UD.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function a(h){return i=sr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),l):n(h)}function l(h){return Re(h)?iu(e,u)(h):u(h)}function u(h){return zD(e,f,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function f(h){return e.attempt(Zre,c,c)(h)}function c(h){return Se(h)?Ce(e,d,"whitespace")(h):d(h)}function d(h){return h===null||fe(h)?(e.exit("definition"),r.parser.defined.push(i),t(h)):n(h)}}function eie(e,t,n){return r;function r(a){return Re(a)?iu(e,i)(a):n(a)}function i(a){return HD(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return Se(a)?Ce(e,o,"whitespace")(a):o(a)}function o(a){return a===null||fe(a)?t(a):n(a)}}const tie={name:"hardBreakEscape",tokenize:nie};function nie(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return fe(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const rie={name:"headingAtx",tokenize:sie,resolve:iie};function iie(e,t){let n=e.length-2,r=3,i,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},jn(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function sie(e,t,n){let r=0;return i;function i(f){return e.enter("atxHeading"),s(f)}function s(f){return e.enter("atxHeadingSequence"),o(f)}function o(f){return f===35&&r++<6?(e.consume(f),o):f===null||Re(f)?(e.exit("atxHeadingSequence"),a(f)):n(f)}function a(f){return f===35?(e.enter("atxHeadingSequence"),l(f)):f===null||fe(f)?(e.exit("atxHeading"),t(f)):Se(f)?Ce(e,a,"whitespace")(f):(e.enter("atxHeadingText"),u(f))}function l(f){return f===35?(e.consume(f),l):(e.exit("atxHeadingSequence"),a(f))}function u(f){return f===null||f===35||Re(f)?(e.exit("atxHeadingText"),a(f)):(e.consume(f),u)}}const oie=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],QC=["pre","script","style","textarea"],aie={name:"htmlFlow",tokenize:fie,resolveTo:cie,concrete:!0},lie={tokenize:hie,partial:!0},uie={tokenize:die,partial:!0};function cie(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function fie(e,t,n){const r=this;let i,s,o,a,l;return u;function u(R){return f(R)}function f(R){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(R),c}function c(R){return R===33?(e.consume(R),d):R===47?(e.consume(R),s=!0,m):R===63?(e.consume(R),i=3,r.interrupt?t:_):$t(R)?(e.consume(R),o=String.fromCharCode(R),w):n(R)}function d(R){return R===45?(e.consume(R),i=2,h):R===91?(e.consume(R),i=5,a=0,p):$t(R)?(e.consume(R),i=4,r.interrupt?t:_):n(R)}function h(R){return R===45?(e.consume(R),r.interrupt?t:_):n(R)}function p(R){const q="CDATA[";return R===q.charCodeAt(a++)?(e.consume(R),a===q.length?r.interrupt?t:L:p):n(R)}function m(R){return $t(R)?(e.consume(R),o=String.fromCharCode(R),w):n(R)}function w(R){if(R===null||R===47||R===62||Re(R)){const q=R===47,J=o.toLowerCase();return!q&&!s&&QC.includes(J)?(i=1,r.interrupt?t(R):L(R)):oie.includes(o.toLowerCase())?(i=6,q?(e.consume(R),y):r.interrupt?t(R):L(R)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(R):s?v(R):g(R))}return R===45||Nt(R)?(e.consume(R),o+=String.fromCharCode(R),w):n(R)}function y(R){return R===62?(e.consume(R),r.interrupt?t:L):n(R)}function v(R){return Se(R)?(e.consume(R),v):A(R)}function g(R){return R===47?(e.consume(R),A):R===58||R===95||$t(R)?(e.consume(R),x):Se(R)?(e.consume(R),g):A(R)}function x(R){return R===45||R===46||R===58||R===95||Nt(R)?(e.consume(R),x):S(R)}function S(R){return R===61?(e.consume(R),k):Se(R)?(e.consume(R),S):g(R)}function k(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),l=R,C):Se(R)?(e.consume(R),k):T(R)}function C(R){return R===l?(e.consume(R),l=null,O):R===null||fe(R)?n(R):(e.consume(R),C)}function T(R){return R===null||R===34||R===39||R===47||R===60||R===61||R===62||R===96||Re(R)?S(R):(e.consume(R),T)}function O(R){return R===47||R===62||Se(R)?g(R):n(R)}function A(R){return R===62?(e.consume(R),j):n(R)}function j(R){return R===null||fe(R)?L(R):Se(R)?(e.consume(R),j):n(R)}function L(R){return R===45&&i===2?(e.consume(R),I):R===60&&i===1?(e.consume(R),F):R===62&&i===4?(e.consume(R),V):R===63&&i===3?(e.consume(R),_):R===93&&i===5?(e.consume(R),D):fe(R)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(lie,W,B)(R)):R===null||fe(R)?(e.exit("htmlFlowData"),B(R)):(e.consume(R),L)}function B(R){return e.check(uie,N,W)(R)}function N(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),M}function M(R){return R===null||fe(R)?B(R):(e.enter("htmlFlowData"),L(R))}function I(R){return R===45?(e.consume(R),_):L(R)}function F(R){return R===47?(e.consume(R),o="",P):L(R)}function P(R){if(R===62){const q=o.toLowerCase();return QC.includes(q)?(e.consume(R),V):L(R)}return $t(R)&&o.length<8?(e.consume(R),o+=String.fromCharCode(R),P):L(R)}function D(R){return R===93?(e.consume(R),_):L(R)}function _(R){return R===62?(e.consume(R),V):R===45&&i===2?(e.consume(R),_):L(R)}function V(R){return R===null||fe(R)?(e.exit("htmlFlowData"),W(R)):(e.consume(R),V)}function W(R){return e.exit("htmlFlow"),t(R)}}function die(e,t,n){const r=this;return i;function i(o){return fe(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function hie(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Sc,t,n)}}const pie={name:"htmlText",tokenize:mie};function mie(e,t,n){const r=this;let i,s,o;return a;function a(_){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(_),l}function l(_){return _===33?(e.consume(_),u):_===47?(e.consume(_),S):_===63?(e.consume(_),g):$t(_)?(e.consume(_),T):n(_)}function u(_){return _===45?(e.consume(_),f):_===91?(e.consume(_),s=0,p):$t(_)?(e.consume(_),v):n(_)}function f(_){return _===45?(e.consume(_),h):n(_)}function c(_){return _===null?n(_):_===45?(e.consume(_),d):fe(_)?(o=c,F(_)):(e.consume(_),c)}function d(_){return _===45?(e.consume(_),h):c(_)}function h(_){return _===62?I(_):_===45?d(_):c(_)}function p(_){const V="CDATA[";return _===V.charCodeAt(s++)?(e.consume(_),s===V.length?m:p):n(_)}function m(_){return _===null?n(_):_===93?(e.consume(_),w):fe(_)?(o=m,F(_)):(e.consume(_),m)}function w(_){return _===93?(e.consume(_),y):m(_)}function y(_){return _===62?I(_):_===93?(e.consume(_),y):m(_)}function v(_){return _===null||_===62?I(_):fe(_)?(o=v,F(_)):(e.consume(_),v)}function g(_){return _===null?n(_):_===63?(e.consume(_),x):fe(_)?(o=g,F(_)):(e.consume(_),g)}function x(_){return _===62?I(_):g(_)}function S(_){return $t(_)?(e.consume(_),k):n(_)}function k(_){return _===45||Nt(_)?(e.consume(_),k):C(_)}function C(_){return fe(_)?(o=C,F(_)):Se(_)?(e.consume(_),C):I(_)}function T(_){return _===45||Nt(_)?(e.consume(_),T):_===47||_===62||Re(_)?O(_):n(_)}function O(_){return _===47?(e.consume(_),I):_===58||_===95||$t(_)?(e.consume(_),A):fe(_)?(o=O,F(_)):Se(_)?(e.consume(_),O):I(_)}function A(_){return _===45||_===46||_===58||_===95||Nt(_)?(e.consume(_),A):j(_)}function j(_){return _===61?(e.consume(_),L):fe(_)?(o=j,F(_)):Se(_)?(e.consume(_),j):O(_)}function L(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),i=_,B):fe(_)?(o=L,F(_)):Se(_)?(e.consume(_),L):(e.consume(_),N)}function B(_){return _===i?(e.consume(_),i=void 0,M):_===null?n(_):fe(_)?(o=B,F(_)):(e.consume(_),B)}function N(_){return _===null||_===34||_===39||_===60||_===61||_===96?n(_):_===47||_===62||Re(_)?O(_):(e.consume(_),N)}function M(_){return _===47||_===62||Re(_)?O(_):n(_)}function I(_){return _===62?(e.consume(_),e.exit("htmlTextData"),e.exit("htmlText"),t):n(_)}function F(_){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),P}function P(_){return Se(_)?Ce(e,D,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):D(_)}function D(_){return e.enter("htmlTextData"),o(_)}}const Qx={name:"labelEnd",tokenize:bie,resolveTo:xie,resolveAll:wie},gie={tokenize:Sie},yie={tokenize:kie},vie={tokenize:Eie};function wie(e){let t=-1;for(;++t=3&&(u===null||fe(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===i?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Se(u)?Ce(e,a,"whitespace")(u):a(u))}}const qt={name:"list",tokenize:Rie,continuation:{tokenize:Iie},exit:Mie},Oie={tokenize:jie,partial:!0},Lie={tokenize:Die,partial:!0};function Rie(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(h){const p=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(p==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:Y0(h)){if(r.containerState.type||(r.containerState.type=p,e.enter(p,{_container:!0})),p==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(sd,n,u)(h):u(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(h)}return n(h)}function l(h){return Y0(h)&&++o<10?(e.consume(h),l):(!r.interrupt||o<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),u(h)):n(h)}function u(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(Sc,r.interrupt?n:f,e.attempt(Oie,d,c))}function f(h){return r.containerState.initialBlankLine=!0,s++,d(h)}function c(h){return Se(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),d):n(h)}function d(h){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function Iie(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Sc,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ce(e,t,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!Se(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Lie,t,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ce(e,e.attempt(qt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function Die(e,t,n){const r=this;return Ce(e,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(s):n(s)}}function Mie(e){e.exit(this.containerState.type)}function jie(e,t,n){const r=this;return Ce(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!Se(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const ZC={name:"setextUnderline",tokenize:$ie,resolveTo:Fie};function Fie(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",o,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end=Object.assign({},e[s][1].end)):e[r][1]=o,e.push(["exit",o,t]),e}function $ie(e,t,n){const r=this;let i;return s;function s(u){let f=r.events.length,c;for(;f--;)if(r.events[f][1].type!=="lineEnding"&&r.events[f][1].type!=="linePrefix"&&r.events[f][1].type!=="content"){c=r.events[f][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||c)?(e.enter("setextHeadingLine"),i=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===i?(e.consume(u),a):(e.exit("setextHeadingLineSequence"),Se(u)?Ce(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||fe(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const Bie={tokenize:Vie};function Vie(e){const t=this,n=e.attempt(Sc,r,e.attempt(this.parser.constructs.flowInitial,i,Ce(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Kre,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const zie={resolveAll:KD()},Uie=WD("string"),Hie=WD("text");function WD(e){return{tokenize:t,resolveAll:KD(e==="text"?Wie:void 0)};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,o,a);return o;function o(f){return u(f)?s(f):a(f)}function a(f){if(f===null){n.consume(f);return}return n.enter("data"),n.consume(f),l}function l(f){return u(f)?(n.exit("data"),s(f)):(n.consume(f),l)}function u(f){if(f===null)return!0;const c=i[f];let d=-1;if(c)for(;++d-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}s>0&&o.push(e[i].slice(0,s))}return o}function Yie(e,t){let n=-1;const r=[];let i;for(;++n0){const yt=ce.tokenStack[ce.tokenStack.length-1];(yt[1]||eT).call(ce,void 0,yt[0])}for(K.position={start:bi(U.length>0?U[0][1].start:{line:1,column:1,offset:0}),end:bi(U.length>0?U[U.length-2][1].end:{line:1,column:1,offset:0})},_e=-1;++_e1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)}function bse(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Sse(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function GD(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function kse(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return GD(e,t);const i={src:Za(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function Ese(e,t){const n={src:Za(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function Cse(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function Tse(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return GD(e,t);const i={href:Za(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function _se(e,t){const n={href:Za(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Ase(e,t,n){const r=e.all(t),i=n?Nse(n):XD(t),s={},o=[];if(typeof t.checked=="boolean"){const f=r[0];let c;f&&f.type==="element"&&f.tagName==="p"?c=f:(c={type:"element",tagName:"p",properties:{},children:[]},r.unshift(c)),c.children.length>0&&c.children.unshift({type:"text",value:" "}),c.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a1}function Pse(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=Wx(t.children[1]),l=ND(t.children[t.children.length-1]);a&&l&&(o.position={start:a,end:l}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function Dse(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,a=o?o.length:t.children.length;let l=-1;const u=[];for(;++l0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(rT(t.slice(i),i>0,!1)),s.join("")}function rT(e,t,n){let r=0,i=e.length;if(t){let s=e.codePointAt(r);for(;s===tT||s===nT;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(i-1);for(;s===tT||s===nT;)i--,s=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function Fse(e,t){const n={type:"text",value:jse(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function $se(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const Bse={blockquote:mse,break:gse,code:yse,delete:vse,emphasis:wse,footnoteReference:xse,heading:bse,html:Sse,imageReference:kse,image:Ese,inlineCode:Cse,linkReference:Tse,link:_se,listItem:Ase,list:Pse,paragraph:Ose,root:Lse,strong:Rse,table:Ise,tableCell:Mse,tableRow:Dse,text:Fse,thematicBreak:$se,toml:gf,yaml:gf,definition:gf,footnoteDefinition:gf};function gf(){}const QD=-1,Wp=0,wh=1,xh=2,Zx=3,Jx=4,e1=5,t1=6,ZD=7,JD=8,iT=typeof self=="object"?self:globalThis,Vse=(e,t)=>{const n=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,o]=t[i];switch(s){case Wp:case QD:return n(o,i);case wh:{const a=n([],i);for(const l of o)a.push(r(l));return a}case xh:{const a=n({},i);for(const[l,u]of o)a[r(l)]=r(u);return a}case Zx:return n(new Date(o),i);case Jx:{const{source:a,flags:l}=o;return n(new RegExp(a,l),i)}case e1:{const a=n(new Map,i);for(const[l,u]of o)a.set(r(l),r(u));return a}case t1:{const a=n(new Set,i);for(const l of o)a.add(r(l));return a}case ZD:{const{name:a,message:l}=o;return n(new iT[a](l),i)}case JD:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i)}return n(new iT[s](o),i)};return r},sT=e=>Vse(new Map,e)(0),mo="",{toString:zse}={},{keys:Use}=Object,Sl=e=>{const t=typeof e;if(t!=="object"||!e)return[Wp,t];const n=zse.call(e).slice(8,-1);switch(n){case"Array":return[wh,mo];case"Object":return[xh,mo];case"Date":return[Zx,mo];case"RegExp":return[Jx,mo];case"Map":return[e1,mo];case"Set":return[t1,mo]}return n.includes("Array")?[wh,n]:n.includes("Error")?[ZD,n]:[xh,n]},yf=([e,t])=>e===Wp&&(t==="function"||t==="symbol"),Hse=(e,t,n,r)=>{const i=(o,a)=>{const l=r.push(o)-1;return n.set(a,l),l},s=o=>{if(n.has(o))return n.get(o);let[a,l]=Sl(o);switch(a){case Wp:{let f=o;switch(l){case"bigint":a=JD,f=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);f=null;break;case"undefined":return i([QD],o)}return i([a,f],o)}case wh:{if(l)return i([l,[...o]],o);const f=[],c=i([a,f],o);for(const d of o)f.push(s(d));return c}case xh:{if(l)switch(l){case"BigInt":return i([l,o.toString()],o);case"Boolean":case"Number":case"String":return i([l,o.valueOf()],o)}if(t&&"toJSON"in o)return s(o.toJSON());const f=[],c=i([a,f],o);for(const d of Use(o))(e||!yf(Sl(o[d])))&&f.push([s(d),s(o[d])]);return c}case Zx:return i([a,o.toISOString()],o);case Jx:{const{source:f,flags:c}=o;return i([a,{source:f,flags:c}],o)}case e1:{const f=[],c=i([a,f],o);for(const[d,h]of o)(e||!(yf(Sl(d))||yf(Sl(h))))&&f.push([s(d),s(h)]);return c}case t1:{const f=[],c=i([a,f],o);for(const d of o)(e||!yf(Sl(d)))&&f.push(s(d));return c}}const{message:u}=o;return i([a,{name:l,message:u}],o)};return s},oT=(e,{json:t,lossy:n}={})=>{const r=[];return Hse(!(t||n),!!t,new Map,r)(e),r},bh=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?sT(oT(e,t)):structuredClone(e):(e,t)=>sT(oT(e,t));function Wse(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function Kse(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function qse(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Wse,r=e.options.footnoteBackLabel||Kse,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l0&&p.push({type:"text",value:" "});let v=typeof n=="string"?n:n(l,h);typeof v=="string"&&(v={type:"text",value:v}),p.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+d+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,h),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const w=f[f.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const v=w.children[w.children.length-1];v&&v.type==="text"?v.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...p)}else f.push(...p);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+d},children:e.wrap(f,!0)};e.patch(u,y),a.push(y)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...bh(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:` `},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:` `}]}}const Kp=function(e){if(e==null)return Qse;if(typeof e=="function")return qp(e);if(typeof e=="object")return Array.isArray(e)?Yse(e):Gse(e);if(typeof e=="string")return Xse(e);throw new Error("Expected function, string, or object as test")};function Yse(e){const t=[];let n=-1;for(;++n":""))+")"})}return d;function d(){let h=eM,p,m,w;if((!t||s(l,u,f[f.length-1]||void 0))&&(h=toe(n(l,f)),h[0]===X0))return h;if("children"in l&&l.children){const y=l;if(y.children&&h[0]!==eoe)for(m=(r?y.children.length:-1)+o,w=f.concat(y);m>-1&&m0&&n.push({type:"text",value:` `}),n}function aT(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function lT(e,t){const n=roe(e,t),r=n.one(e,void 0),i=qse(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:` `},i),s}function loe(e,t){return e&&"run"in e?async function(n,r){const i=lT(n,{file:r,...t});await e.run(i,r)}:function(n,r){return lT(n,{file:r,...e||t})}}function uT(e){if(e)throw e}var od=Object.prototype.hasOwnProperty,nM=Object.prototype.toString,cT=Object.defineProperty,fT=Object.getOwnPropertyDescriptor,dT=function(t){return typeof Array.isArray=="function"?Array.isArray(t):nM.call(t)==="[object Array]"},hT=function(t){if(!t||nM.call(t)!=="[object Object]")return!1;var n=od.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&od.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||od.call(t,i)},pT=function(t,n){cT&&n.name==="__proto__"?cT(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},mT=function(t,n){if(n==="__proto__")if(od.call(t,n)){if(fT)return fT(t,n).value}else return;return t[n]},uoe=function e(){var t,n,r,i,s,o,a=arguments[0],l=1,u=arguments.length,f=!1;for(typeof a=="boolean"&&(f=a,a=arguments[1]||{},l=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});lo.length;let l;a&&o.push(i);try{l=e.apply(this,o)}catch(u){const f=u;if(a&&n)throw f;return i(f)}a||(l&&l.then&&typeof l.then=="function"?l.then(s,i):l instanceof Error?i(l):s(l))}function i(o,...a){n||(n=!0,t(o,...a))}function s(o){i(null,o)}}const gr={basename:doe,dirname:hoe,extname:poe,join:moe,sep:"/"};function doe(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');kc(e);let n=0,r=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,a=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),a>-1&&(e.codePointAt(i)===t.codePointAt(a--)?a<0&&(r=i):(a=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function hoe(e){if(kc(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function poe(e){kc(e);let t=e.length,n=-1,r=0,i=-1,s=0,o;for(;t--;){const a=e.codePointAt(t);if(a===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),a===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function moe(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function yoe(e,t){let n="",r=0,i=-1,s=0,o=-1,a,l;for(;++o<=e.length;){if(o2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,s=0}else a===46&&s>-1?s++:s=-1}return n}function kc(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const voe={cwd:woe};function woe(){return"/"}function J0(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function xoe(e){if(typeof e=="string")e=new URL(e);else if(!J0(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return boe(e)}function boe(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n0){let[h,...p]=f;const m=r[d][1];Z0(m)&&Z0(h)&&(h=Cg(!0,m,h)),r[d]=[u,h,...p]}}}}const Coe=new r1().freeze();function Ng(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Pg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Og(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function yT(e){if(!Z0(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function vT(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function vf(e){return Toe(e)?e:new rM(e)}function Toe(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function _oe(e){return typeof e=="string"||Aoe(e)}function Aoe(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Noe="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",wT=[],xT={allowDangerousHtml:!0},Poe=/^(https?|ircs?|mailto|xmpp)$/i,Ooe=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Loe(e){const t=e.allowedElements,n=e.allowElement,r=e.children||"",i=e.className,s=e.components,o=e.disallowedElements,a=e.rehypePlugins||wT,l=e.remarkPlugins||wT,u=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...xT}:xT,f=e.skipHtml,c=e.unwrapDisallowed,d=e.urlTransform||Roe,h=Coe().use(pse).use(l).use(loe,u).use(a),p=new rM;typeof r=="string"&&(p.value=r);for(const v of Ooe)Object.hasOwn(e,v.from)&&(""+v.from+(v.to?"use `"+v.to+"` instead":"remove it")+Noe+v.id,void 0);const m=h.parse(p);let w=h.runSync(m,p);return i&&(w={type:"element",tagName:"div",properties:{className:i},children:w.type==="root"?w.children:[w]}),n1(w,y),Xne(w,{Fragment:b.Fragment,components:s,ignoreInvalidStyle:!0,jsx:b.jsx,jsxs:b.jsxs,passKeys:!0,passNode:!0});function y(v,g,x){if(v.type==="raw"&&x&&typeof g=="number")return f?x.children.splice(g,1):x.children[g]={type:"text",value:v.value},g;if(v.type==="element"){let S;for(S in Sg)if(Object.hasOwn(Sg,S)&&Object.hasOwn(v.properties,S)){const k=v.properties[S],C=Sg[S];(C===null||C.includes(v.tagName))&&(v.properties[S]=d(String(k||""),S,v))}}if(v.type==="element"){let S=t?!t.includes(v.tagName):o?o.includes(v.tagName):!1;if(!S&&n&&typeof g=="number"&&(S=!n(v,g,x)),S&&x&&typeof g=="number")return c&&v.children?x.children.splice(g,1,...v.children):x.children.splice(g,1),g}}}function Roe(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t<0||i>-1&&t>i||n>-1&&t>n||r>-1&&t>r||Poe.test(e.slice(0,t))?e:""}function bT(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function Ioe(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Doe(e,t,n){const i=Kp((n||{}).ignore||[]),s=Moe(t);let o=-1;for(;++o0?{type:"text",value:k}:void 0),k===!1?d.lastIndex=x+1:(p!==x&&v.push({type:"text",value:u.value.slice(p,x)}),Array.isArray(k)?v.push(...k):k&&v.push(k),p=x+g[0].length,y=!0),!d.global)break;g=d.exec(u.value)}return y?(p?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=bT(e,"(");let s=bT(e,")");for(;r!==-1&&i>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}function iM(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Zs(n)||Up(n))&&(!t||n!==47)}sM.peek=aae;function Qoe(){return{enter:{gfmFootnoteDefinition:Joe,gfmFootnoteDefinitionLabelString:eae,gfmFootnoteCall:rae,gfmFootnoteCallString:iae},exit:{gfmFootnoteDefinition:nae,gfmFootnoteDefinitionLabelString:tae,gfmFootnoteCall:oae,gfmFootnoteCallString:sae}}}function Zoe(){return{unsafe:[{character:"[",inConstruct:["phrasing","label","reference"]}],handlers:{footnoteDefinition:lae,footnoteReference:sM}}}function Joe(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function eae(){this.buffer()}function tae(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.label=t,n.identifier=sr(this.sliceSerialize(e)).toLowerCase()}function nae(e){this.exit(e)}function rae(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function iae(){this.buffer()}function sae(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.label=t,n.identifier=sr(this.sliceSerialize(e)).toLowerCase()}function oae(e){this.exit(e)}function sM(e,t,n,r){const i=n.createTracker(r);let s=i.move("[^");const o=n.enter("footnoteReference"),a=n.enter("reference");return s+=i.move(n.safe(n.associationId(e),{...i.current(),before:s,after:"]"})),a(),o(),s+=i.move("]"),s}function aae(){return"["}function lae(e,t,n,r){const i=n.createTracker(r);let s=i.move("[^");const o=n.enter("footnoteDefinition"),a=n.enter("label");return s+=i.move(n.safe(n.associationId(e),{...i.current(),before:s,after:"]"})),a(),s+=i.move("]:"+(e.children&&e.children.length>0?" ":"")),i.shift(4),s+=i.move(n.indentLines(n.containerFlow(e,i.current()),uae)),o(),s}function uae(e,t,n){return t===0?e:(n?"":" ")+e}const cae=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];oM.peek=mae;function fae(){return{canContainEols:["delete"],enter:{strikethrough:hae},exit:{strikethrough:pae}}}function dae(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:cae}],handlers:{delete:oM}}}function hae(e){this.enter({type:"delete",children:[]},e)}function pae(e){this.exit(e)}function oM(e,t,n,r){const i=n.createTracker(r),s=n.enter("strikethrough");let o=i.move("~~");return o+=n.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function mae(){return"~"}function gae(e,t={}){const n=(t.align||[]).concat(),r=t.stringLength||vae,i=[],s=[],o=[],a=[];let l=0,u=-1;for(;++ul&&(l=e[u].length);++wa[w])&&(a[w]=v)}p.push(y)}s[u]=p,o[u]=m}let f=-1;if(typeof n=="object"&&"length"in n)for(;++fa[f]&&(a[f]=y),d[f]=y),c[f]=v}s.splice(1,0,c),o.splice(1,0,d),u=-1;const h=[];for(;++u "),s.shift(2);const o=n.indentLines(n.containerFlow(e,s.current()),xae);return i(),o}function xae(e,t,n){return">"+(n?"":" ")+e}function bae(e,t){return kT(e,t.inConstruct,!0)&&!kT(e,t.notInConstruct,!1)}function kT(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++ro&&(o=s):s=1,i=r+t.length,r=n.indexOf(t,i);return o}function kae(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Eae(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function Cae(e,t,n,r){const i=Eae(n),s=e.value||"",o=i==="`"?"GraveAccent":"Tilde";if(kae(e,n)){const c=n.enter("codeIndented"),d=n.indentLines(s,Tae);return c(),d}const a=n.createTracker(r),l=i.repeat(Math.max(Sae(s,i)+1,3)),u=n.enter("codeFenced");let f=a.move(l);if(e.lang){const c=n.enter(`codeFencedLang${o}`);f+=a.move(n.safe(e.lang,{before:f,after:" ",encode:["`"],...a.current()})),c()}if(e.lang&&e.meta){const c=n.enter(`codeFencedMeta${o}`);f+=a.move(" "),f+=a.move(n.safe(e.meta,{before:f,after:` `,encode:["`"],...a.current()})),c()}return f+=a.move(` `),s&&(f+=a.move(s+` `)),f+=a.move(l),u(),f}function Tae(e,t,n){return(n?"":" ")+e}function i1(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function _ae(e,t,n,r){const i=i1(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("definition");let a=n.enter("label");const l=n.createTracker(r);let u=l.move("[");return u+=l.move(n.safe(n.associationId(e),{before:u,after:"]",...l.current()})),u+=l.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(a=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":` `,...l.current()}))),a(),e.title&&(a=n.enter(`title${s}`),u+=l.move(" "+i),u+=l.move(n.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),a()),o(),u}function Aae(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}aM.peek=Nae;function aM(e,t,n,r){const i=Aae(n),s=n.enter("emphasis"),o=n.createTracker(r);let a=o.move(i);return a+=o.move(n.containerPhrasing(e,{before:a,after:i,...o.current()})),a+=o.move(i),s(),a}function Nae(e,t,n){return n.options.emphasis||"*"}function Pae(e,t){let n=!1;return n1(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,X0}),!!((!e.depth||e.depth<3)&&Gx(e)&&(t.options.setext||n))}function Oae(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if(Pae(e,n)){const f=n.enter("headingSetext"),c=n.enter("phrasing"),d=n.containerPhrasing(e,{...s.current(),before:` `,after:` `});return c(),f(),d+` `+(i===1?"=":"-").repeat(d.length-(Math.max(d.lastIndexOf("\r"),d.lastIndexOf(` `))+1))}const o="#".repeat(i),a=n.enter("headingAtx"),l=n.enter("phrasing");s.move(o+" ");let u=n.containerPhrasing(e,{before:"# ",after:` `,...s.current()});return/^[\t ]/.test(u)&&(u="&#x"+u.charCodeAt(0).toString(16).toUpperCase()+";"+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),l(),a(),u}lM.peek=Lae;function lM(e){return e.value||""}function Lae(){return"<"}uM.peek=Rae;function uM(e,t,n,r){const i=i1(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("image");let a=n.enter("label");const l=n.createTracker(r);let u=l.move("![");return u+=l.move(n.safe(e.alt,{before:u,after:"]",...l.current()})),u+=l.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(a=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":")",...l.current()}))),a(),e.title&&(a=n.enter(`title${s}`),u+=l.move(" "+i),u+=l.move(n.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),a()),u+=l.move(")"),o(),u}function Rae(){return"!"}cM.peek=Iae;function cM(e,t,n,r){const i=e.referenceType,s=n.enter("imageReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("![");const u=n.safe(e.alt,{before:l,after:"]",...a.current()});l+=a.move(u+"]["),o();const f=n.stack;n.stack=[],o=n.enter("reference");const c=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=f,s(),i==="full"||!u||u!==c?l+=a.move(c+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function Iae(){return"!"}fM.peek=Dae;function fM(e,t,n){let r=e.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s\u007F]/.test(e.url))}hM.peek=Mae;function hM(e,t,n,r){const i=i1(n),s=i==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let a,l;if(dM(e,n)){const f=n.stack;n.stack=[],a=n.enter("autolink");let c=o.move("<");return c+=o.move(n.containerPhrasing(e,{before:c,after:">",...o.current()})),c+=o.move(">"),a(),n.stack=f,c}a=n.enter("link"),l=n.enter("label");let u=o.move("[");return u+=o.move(n.containerPhrasing(e,{before:u,after:"](",...o.current()})),u+=o.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(n.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(l=n.enter("destinationRaw"),u+=o.move(n.safe(e.url,{before:u,after:e.title?" ":")",...o.current()}))),l(),e.title&&(l=n.enter(`title${s}`),u+=o.move(" "+i),u+=o.move(n.safe(e.title,{before:u,after:i,...o.current()})),u+=o.move(i),l()),u+=o.move(")"),a(),u}function Mae(e,t,n){return dM(e,n)?"<":"["}pM.peek=jae;function pM(e,t,n,r){const i=e.referenceType,s=n.enter("linkReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("[");const u=n.containerPhrasing(e,{before:l,after:"]",...a.current()});l+=a.move(u+"]["),o();const f=n.stack;n.stack=[],o=n.enter("reference");const c=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=f,s(),i==="full"||!u||u!==c?l+=a.move(c+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function jae(){return"["}function s1(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Fae(e){const t=s1(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function $ae(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function mM(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function Bae(e,t,n,r){const i=n.enter("list"),s=n.bulletCurrent;let o=e.ordered?$ae(n):s1(n);const a=e.ordered?o==="."?")":".":Fae(n);let l=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const f=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&f&&(!f.children||!f.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),mM(n)===o&&f){let c=-1;for(;++c-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let o=s.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const a=n.createTracker(r);a.move(s+" ".repeat(o-s.length)),a.shift(o);const l=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,a.current()),f);return l(),u;function f(c,d,h){return d?(h?"":" ".repeat(o))+c:(h?s:s+" ".repeat(o-s.length))+c}}function Uae(e,t,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),o=n.containerPhrasing(e,r);return s(),i(),o}const Hae=Kp(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Wae(e,t,n,r){return(e.children.some(function(o){return Hae(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function Kae(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}gM.peek=qae;function gM(e,t,n,r){const i=Kae(n),s=n.enter("strong"),o=n.createTracker(r);let a=o.move(i+i);return a+=o.move(n.containerPhrasing(e,{before:a,after:i,...o.current()})),a+=o.move(i+i),s(),a}function qae(e,t,n){return n.options.strong||"*"}function Yae(e,t,n,r){return n.safe(e.value,r)}function Gae(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Xae(e,t,n){const r=(mM(n)+(n.options.ruleSpaces?" ":"")).repeat(Gae(n));return n.options.ruleSpaces?r.slice(0,-1):r}const yM={blockquote:wae,break:ET,code:Cae,definition:_ae,emphasis:aM,hardBreak:ET,heading:Oae,html:lM,image:uM,imageReference:cM,inlineCode:fM,link:hM,linkReference:pM,list:Bae,listItem:zae,paragraph:Uae,root:Wae,strong:gM,text:Yae,thematicBreak:Xae};function Qae(){return{enter:{table:Zae,tableData:CT,tableHeader:CT,tableRow:ele},exit:{codeText:tle,table:Jae,tableData:Dg,tableHeader:Dg,tableRow:Dg}}}function Zae(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function Jae(e){this.exit(e),this.data.inTable=void 0}function ele(e){this.enter({type:"tableRow",children:[]},e)}function Dg(e){this.exit(e)}function CT(e){this.enter({type:"tableCell",children:[]},e)}function tle(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,nle));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function nle(e,t){return t==="|"?t:e}function rle(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:d,table:o,tableCell:l,tableRow:a}};function o(h,p,m,w){return u(f(h,m,w),h.align)}function a(h,p,m,w){const y=c(h,m,w),v=u([y]);return v.slice(0,v.indexOf(` `))}function l(h,p,m,w){const y=m.enter("tableCell"),v=m.enter("phrasing"),g=m.containerPhrasing(h,{...w,before:s,after:s});return v(),y(),g}function u(h,p){return gae(h,{align:p,alignDelimiters:r,padding:n,stringLength:i})}function f(h,p,m){const w=h.children;let y=-1;const v=[],g=p.enter("table");for(;++y0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const ble={tokenize:Nle,partial:!0};function Sle(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Tle,continuation:{tokenize:_le},exit:Ale}},text:{91:{name:"gfmFootnoteCall",tokenize:Cle},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:kle,resolveTo:Ele}}}}function kle(e,t,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const l=r.events[i][1];if(l.type==="labelImage"){o=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!o||!o._balanced)return n(l);const u=sr(r.sliceSerialize({start:o.end,end:r.now()}));return u.codePointAt(0)!==94||!s.includes(u.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function Ele(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function Cle(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,o;return a;function a(c){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),l}function l(c){return c!==94?n(c):(e.enter("gfmFootnoteCallMarker"),e.consume(c),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(c){if(s>999||c===93&&!o||c===null||c===91||Re(c))return n(c);if(c===93){e.exit("chunkString");const d=e.exit("gfmFootnoteCallString");return i.includes(sr(r.sliceSerialize(d)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(c)}return Re(c)||(o=!0),s++,e.consume(c),c===92?f:u}function f(c){return c===91||c===92||c===93?(e.consume(c),s++,u):u(c)}}function Tle(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,o=0,a;return l;function l(p){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(p){return p===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",f):n(p)}function f(p){if(o>999||p===93&&!a||p===null||p===91||Re(p))return n(p);if(p===93){e.exit("chunkString");const m=e.exit("gfmFootnoteDefinitionLabelString");return s=sr(r.sliceSerialize(m)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return Re(p)||(a=!0),o++,e.consume(p),p===92?c:f}function c(p){return p===91||p===92||p===93?(e.consume(p),o++,f):f(p)}function d(p){return p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),i.includes(s)||i.push(s),Ce(e,h,"gfmFootnoteDefinitionWhitespace")):n(p)}function h(p){return t(p)}}function _le(e,t,n){return e.check(Sc,t,e.attempt(ble,t,n))}function Ale(e){e.exit("gfmFootnoteDefinition")}function Nle(e,t,n){const r=this;return Ce(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(s):n(s)}}function Ple(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(o,a){let l=-1;for(;++l1?l(p):(o.consume(p),c++,h);if(c<2&&!n)return l(p);const w=o.exit("strikethroughSequenceTemporary"),y=vh(p);return w._open=!y||y===2&&!!m,w._close=!m||m===2&&!!y,a(p)}}}class Ole{constructor(){this.map=[]}add(t,n,r){Lle(this,t,n,r)}consume(t){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push([...t]),t.length=0;let i=r.pop();for(;i;)t.push(...i),i=r.pop();this.map.length=0}}function Lle(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i-1;){const N=r.events[j][1].type;if(N==="lineEnding"||N==="linePrefix")j--;else break}const L=j>-1?r.events[j][1].type:null,B=L==="tableHead"||L==="tableRow"?k:l;return B===k&&r.parser.lazy[r.now().line]?n(A):B(A)}function l(A){return e.enter("tableHead"),e.enter("tableRow"),u(A)}function u(A){return A===124||(o=!0,s+=1),f(A)}function f(A){return A===null?n(A):fe(A)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),h):n(A):Se(A)?Ce(e,f,"whitespace")(A):(s+=1,o&&(o=!1,i+=1),A===124?(e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),o=!0,f):(e.enter("data"),c(A)))}function c(A){return A===null||A===124||Re(A)?(e.exit("data"),f(A)):(e.consume(A),A===92?d:c)}function d(A){return A===92||A===124?(e.consume(A),c):c(A)}function h(A){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(A):(e.enter("tableDelimiterRow"),o=!1,Se(A)?Ce(e,p,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):p(A))}function p(A){return A===45||A===58?w(A):A===124?(o=!0,e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),m):S(A)}function m(A){return Se(A)?Ce(e,w,"whitespace")(A):w(A)}function w(A){return A===58?(s+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(A),e.exit("tableDelimiterMarker"),y):A===45?(s+=1,y(A)):A===null||fe(A)?x(A):S(A)}function y(A){return A===45?(e.enter("tableDelimiterFiller"),v(A)):S(A)}function v(A){return A===45?(e.consume(A),v):A===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(A),e.exit("tableDelimiterMarker"),g):(e.exit("tableDelimiterFiller"),g(A))}function g(A){return Se(A)?Ce(e,x,"whitespace")(A):x(A)}function x(A){return A===124?p(A):A===null||fe(A)?!o||i!==s?S(A):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(A)):S(A)}function S(A){return n(A)}function k(A){return e.enter("tableRow"),C(A)}function C(A){return A===124?(e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),C):A===null||fe(A)?(e.exit("tableRow"),t(A)):Se(A)?Ce(e,C,"whitespace")(A):(e.enter("data"),T(A))}function T(A){return A===null||A===124||Re(A)?(e.exit("data"),C(A)):(e.consume(A),A===92?O:T)}function O(A){return A===92||A===124?(e.consume(A),T):T(A)}}function Mle(e,t){let n=-1,r=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,u,f,c;const d=new Ole;for(;++nn[2]+1){const p=n[2]+1,m=n[3]-n[2]-1;e.add(p,m,[])}}e.add(n[3]+1,0,[["exit",c,t]])}return i!==void 0&&(s.end=Object.assign({},wo(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function _T(e,t,n,r,i){const s=[],o=wo(t.events,n);i&&(i.end=Object.assign({},o),s.push(["exit",i,t])),r.end=Object.assign({},o),s.push(["exit",r,t]),e.add(n+1,0,s)}function wo(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const jle={name:"tasklistCheck",tokenize:$le};function Fle(){return{text:{91:jle}}}function $le(e,t,n){const r=this;return i;function i(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),s)}function s(l){return Re(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),o):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),o):n(l)}function o(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):n(l)}function a(l){return fe(l)?t(l):Se(l)?e.check({tokenize:Ble},t,n)(l):n(l)}}function Ble(e,t,n){return Ce(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function Vle(e){return MD([dle(),Sle(),Ple(e),Ile(),Fle()])}const zle={};function Ule(e){const t=this,n=e||zle,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(Vle(n)),s.push(lle()),o.push(ule(n))}function Hle(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function Wle(e,t){if(e==null)return{};var n,r,i=Hle(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;re.length)&&(t=e.length);for(var n=0,r=Array(t);n=4)return[e[0],e[1],e[2],e[3],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[2],".").concat(e[3]),"".concat(e[3],".").concat(e[0]),"".concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[0]),"".concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[3],".").concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[2],".").concat(e[1],".").concat(e[0])]}var Mg={};function eue(e){if(e.length===0||e.length===1)return e;var t=e.join(".");return Mg[t]||(Mg[t]=Jle(e)),Mg[t]}function tue(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=e.filter(function(s){return s!=="token"}),i=eue(r);return i.reduce(function(s,o){return Ko(Ko({},s),n[o])},t)}function NT(e){return e.join(" ")}function nue(e,t){var n=0;return function(r){return n+=1,r.map(function(i,s){return _M({node:i,stylesheet:e,useInlineStyles:t,key:"code-segment-".concat(n,"-").concat(s)})})}}function _M(e){var t=e.node,n=e.stylesheet,r=e.style,i=r===void 0?{}:r,s=e.useInlineStyles,o=e.key,a=t.properties,l=t.type,u=t.tagName,f=t.value;if(l==="text")return f;if(u){var c=nue(n,s),d;if(!s)d=Ko(Ko({},a),{},{className:NT(a.className)});else{var h=Object.keys(n).reduce(function(y,v){return v.split(".").forEach(function(g){y.includes(g)||y.push(g)}),y},[]),p=a.className&&a.className.includes("token")?["token"]:[],m=a.className&&p.concat(a.className.filter(function(y){return!h.includes(y)}));d=Ko(Ko({},a),{},{className:NT(m)||void 0,style:tue(a.className,Object.assign({},a.style,i),n)})}var w=c(t.children);return we.createElement(u,nv({key:o},d),w)}}const rue=function(e,t){var n=e.listLanguages();return n.indexOf(t)!==-1};var iue=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function PT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function yr(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],r=0;r2&&arguments[2]!==void 0?arguments[2]:[];return ad({children:S,lineNumber:k,lineNumberStyle:a,largestLineNumber:o,showInlineLineNumbers:i,lineProps:n,className:C,showLineNumbers:r,wrapLongLines:l})}function m(S,k){if(r&&k&&i){var C=NM(a,k,o);S.unshift(AM(k,C))}return S}function w(S,k){var C=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return t||C.length>0?p(S,k,C):m(S,k)}for(var y=function(){var k=f[h],C=k.children[0].value,T=oue(C);if(T){var O=C.split(` `);O.forEach(function(A,j){var L=r&&c.length+s,B={type:"text",value:"".concat(A,` `)};if(j===0){var N=f.slice(d+1,h).concat(ad({children:[B],className:k.properties.className})),M=w(N,L);c.push(M)}else if(j===O.length-1){var I=f[h+1]&&f[h+1].children&&f[h+1].children[0],F={type:"text",value:"".concat(A)};if(I){var P=ad({children:[F],className:k.properties.className});f.splice(h+1,0,P)}else{var D=[F],_=w(D,L,k.properties.className);c.push(_)}}else{var V=[B],W=w(V,L,k.properties.className);c.push(W)}}),d=h}h++};h4&&n.slice(0,4)===f1&&rce.test(t)&&(t.charAt(4)==="-"?r=oce(t):t=ace(t),i=ece),new i(r,t))}function oce(e){var t=e.slice(5).replace(BM,uce);return f1+t.charAt(0).toUpperCase()+t.slice(1)}function ace(e){var t=e.slice(4);return BM.test(t)?e:(t=t.replace(ice,lce),t.charAt(0)!=="-"&&(t="-"+t),f1+t)}function lce(e){return"-"+e.toLowerCase()}function uce(e){return e.charAt(1).toUpperCase()}var cce=fce,DT=/[#.]/g;function fce(e,t){for(var n=e||"",r=t||"div",i={},s=0,o,a,l;s=48&&t<=57}var Rde=Ide;function Ide(e){var t=typeof e=="string"?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}var Dde=Mde;function Mde(e){var t=typeof e=="string"?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}var jde=Dde,Fde=UM,$de=Bde;function Bde(e){return jde(e)||Fde(e)}var bf,Vde=59,zde=Ude;function Ude(e){var t="&"+e+";",n;return bf=bf||document.createElement("i"),bf.innerHTML=t,n=bf.textContent,n.charCodeAt(n.length-1)===Vde&&e!=="semi"||n===t?!1:n}var zT=Pde,UT=Ode,Hde=UM,Wde=Rde,HM=$de,Kde=zde,qde=ohe,Yde={}.hasOwnProperty,go=String.fromCharCode,Gde=Function.prototype,HT={warning:null,reference:null,text:null,warningContext:null,referenceContext:null,textContext:null,position:{},additional:null,attribute:!1,nonTerminated:!0},Xde=9,WT=10,Qde=12,Zde=32,KT=38,Jde=59,ehe=60,the=61,nhe=35,rhe=88,ihe=120,she=65533,xo="named",p1="hexadecimal",m1="decimal",g1={};g1[p1]=16;g1[m1]=10;var Yp={};Yp[xo]=HM;Yp[m1]=Hde;Yp[p1]=Wde;var WM=1,KM=2,qM=3,YM=4,GM=5,iv=6,XM=7,ds={};ds[WM]="Named character references must be terminated by a semicolon";ds[KM]="Numeric character references must be terminated by a semicolon";ds[qM]="Named character references cannot be empty";ds[YM]="Numeric character references cannot be empty";ds[GM]="Named character references must be known";ds[iv]="Numeric character references cannot be disallowed";ds[XM]="Numeric character references cannot be outside the permissible Unicode range";function ohe(e,t){var n={},r,i;t||(t={});for(i in HT)r=t[i],n[i]=r??HT[i];return(n.position.indent||n.position.start)&&(n.indent=n.position.indent||[],n.position=n.position.start),ahe(e,n)}function ahe(e,t){var n=t.additional,r=t.nonTerminated,i=t.text,s=t.reference,o=t.warning,a=t.textContext,l=t.referenceContext,u=t.warningContext,f=t.position,c=t.indent||[],d=e.length,h=0,p=-1,m=f.column||1,w=f.line||1,y="",v=[],g,x,S,k,C,T,O,A,j,L,B,N,M,I,F,P,D,_,V;for(typeof n=="string"&&(n=n.charCodeAt(0)),P=W(),A=o?R:Gde,h--,d++;++h65535&&(T-=65536,L+=go(T>>>10|55296),T=56320|T&1023),T=L+go(T))):I!==xo&&A(YM,_)),T?(q(),P=W(),h=V-1,m+=V-M+1,v.push(T),D=W(),D.offset++,s&&s.call(l,T,{start:P,end:D},e.slice(M-1,V)),P=D):(k=e.slice(M-1,V),y+=k,m+=k.length,h=V-1)}else C===10&&(w++,p++,m=0),C===C?(y+=go(C),m++):q();return v.join("");function W(){return{line:w,column:m,offset:h+(f.offset||0)}}function R(J,Y){var re=W();re.column+=Y,re.offset+=Y,o.call(u,ds[J],re,J)}function q(){y&&(v.push(y),i&&i.call(a,y,{start:P,end:W()}),y="")}}function lhe(e){return e>=55296&&e<=57343||e>1114111}function uhe(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534}var QM={exports:{}};(function(e){var t=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/** * Prism: Lightweight, robust, elegant syntax highlighting * * @license MIT * @author Lea Verou * @namespace * @public */var n=function(r){var i=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,s=0,o={},a={manual:r.Prism&&r.Prism.manual,disableWorkerMessageHandler:r.Prism&&r.Prism.disableWorkerMessageHandler,util:{encode:function v(g){return g instanceof l?new l(g.type,v(g.content),g.alias):Array.isArray(g)?g.map(v):g.replace(/&/g,"&").replace(/"u")return null;if("currentScript"in document)return document.currentScript;try{throw new Error}catch(S){var v=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(S.stack)||[])[1];if(v){var g=document.getElementsByTagName("script");for(var x in g)if(g[x].src==v)return g[x]}return null}},isActive:function(v,g,x){for(var S="no-"+g;v;){var k=v.classList;if(k.contains(g))return!0;if(k.contains(S))return!1;v=v.parentElement}return!!x}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(v,g){var x=a.util.clone(a.languages[v]);for(var S in g)x[S]=g[S];return x},insertBefore:function(v,g,x,S){S=S||a.languages;var k=S[v],C={};for(var T in k)if(k.hasOwnProperty(T)){if(T==g)for(var O in x)x.hasOwnProperty(O)&&(C[O]=x[O]);x.hasOwnProperty(T)||(C[T]=k[T])}var A=S[v];return S[v]=C,a.languages.DFS(a.languages,function(j,L){L===A&&j!=v&&(this[j]=C)}),C},DFS:function v(g,x,S,k){k=k||{};var C=a.util.objId;for(var T in g)if(g.hasOwnProperty(T)){x.call(g,T,g[T],S||T);var O=g[T],A=a.util.type(O);A==="Object"&&!k[C(O)]?(k[C(O)]=!0,v(O,x,null,k)):A==="Array"&&!k[C(O)]&&(k[C(O)]=!0,v(O,x,T,k))}}},plugins:{},highlightAll:function(v,g){a.highlightAllUnder(document,v,g)},highlightAllUnder:function(v,g,x){var S={callback:x,container:v,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};a.hooks.run("before-highlightall",S),S.elements=Array.prototype.slice.apply(S.container.querySelectorAll(S.selector)),a.hooks.run("before-all-elements-highlight",S);for(var k=0,C;C=S.elements[k++];)a.highlightElement(C,g===!0,S.callback)},highlightElement:function(v,g,x){var S=a.util.getLanguage(v),k=a.languages[S];a.util.setLanguage(v,S);var C=v.parentElement;C&&C.nodeName.toLowerCase()==="pre"&&a.util.setLanguage(C,S);var T=v.textContent,O={element:v,language:S,grammar:k,code:T};function A(L){O.highlightedCode=L,a.hooks.run("before-insert",O),O.element.innerHTML=O.highlightedCode,a.hooks.run("after-highlight",O),a.hooks.run("complete",O),x&&x.call(O.element)}if(a.hooks.run("before-sanity-check",O),C=O.element.parentElement,C&&C.nodeName.toLowerCase()==="pre"&&!C.hasAttribute("tabindex")&&C.setAttribute("tabindex","0"),!O.code){a.hooks.run("complete",O),x&&x.call(O.element);return}if(a.hooks.run("before-highlight",O),!O.grammar){A(a.util.encode(O.code));return}if(g&&r.Worker){var j=new Worker(a.filename);j.onmessage=function(L){A(L.data)},j.postMessage(JSON.stringify({language:O.language,code:O.code,immediateClose:!0}))}else A(a.highlight(O.code,O.grammar,O.language))},highlight:function(v,g,x){var S={code:v,grammar:g,language:x};if(a.hooks.run("before-tokenize",S),!S.grammar)throw new Error('The language "'+S.language+'" has no grammar.');return S.tokens=a.tokenize(S.code,S.grammar),a.hooks.run("after-tokenize",S),l.stringify(a.util.encode(S.tokens),S.language)},tokenize:function(v,g){var x=g.rest;if(x){for(var S in x)g[S]=x[S];delete g.rest}var k=new c;return d(k,k.head,v),f(v,k,g,k.head,0),p(k)},hooks:{all:{},add:function(v,g){var x=a.hooks.all;x[v]=x[v]||[],x[v].push(g)},run:function(v,g){var x=a.hooks.all[v];if(!(!x||!x.length))for(var S=0,k;k=x[S++];)k(g)}},Token:l};r.Prism=a;function l(v,g,x,S){this.type=v,this.content=g,this.alias=x,this.length=(S||"").length|0}l.stringify=function v(g,x){if(typeof g=="string")return g;if(Array.isArray(g)){var S="";return g.forEach(function(A){S+=v(A,x)}),S}var k={type:g.type,content:v(g.content,x),tag:"span",classes:["token",g.type],attributes:{},language:x},C=g.alias;C&&(Array.isArray(C)?Array.prototype.push.apply(k.classes,C):k.classes.push(C)),a.hooks.run("wrap",k);var T="";for(var O in k.attributes)T+=" "+O+'="'+(k.attributes[O]||"").replace(/"/g,""")+'"';return"<"+k.tag+' class="'+k.classes.join(" ")+'"'+T+">"+k.content+""};function u(v,g,x,S){v.lastIndex=g;var k=v.exec(x);if(k&&S&&k[1]){var C=k[1].length;k.index+=C,k[0]=k[0].slice(C)}return k}function f(v,g,x,S,k,C){for(var T in x)if(!(!x.hasOwnProperty(T)||!x[T])){var O=x[T];O=Array.isArray(O)?O:[O];for(var A=0;A=C.reach);D+=P.value.length,P=P.next){var _=P.value;if(g.length>v.length)return;if(!(_ instanceof l)){var V=1,W;if(N){if(W=u(F,D,v,B),!W||W.index>=v.length)break;var Y=W.index,R=W.index+W[0].length,q=D;for(q+=P.value.length;Y>=q;)P=P.next,q+=P.value.length;if(q-=P.value.length,D=q,P.value instanceof l)continue;for(var J=P;J!==g.tail&&(qC.reach&&(C.reach=de);var ue=P.prev;G&&(ue=d(g,ue,G),D+=G.length),h(g,ue,V);var ie=new l(T,L?a.tokenize(re,L):re,M,re);if(P=d(g,ue,ie),le&&d(g,P,le),V>1){var pe={cause:T+","+A,reach:de};f(v,g,x,P.prev,D,pe),C&&pe.reach>C.reach&&(C.reach=pe.reach)}}}}}}function c(){var v={value:null,prev:null,next:null},g={value:null,prev:v,next:null};v.next=g,this.head=v,this.tail=g,this.length=0}function d(v,g,x){var S=g.next,k={value:x,prev:g,next:S};return g.next=k,S.prev=k,v.length++,k}function h(v,g,x){for(var S=g.next,k=0;k/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},e.languages.markup.tag.inside["attr-value"].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside["internal-subset"].inside=e.languages.markup,e.hooks.add("wrap",function(t){t.type==="entity"&&(t.attributes.title=t.content.value.replace(/&/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(n,r){var i={};i["language-"+r]={pattern:/(^$)/i,lookbehind:!0,inside:e.languages[r]},i.cdata=/^$/i;var s={"included-cdata":{pattern://i,inside:i}};s["language-"+r]={pattern:/[\s\S]+/,inside:e.languages[r]};var o={};o[n]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return n}),"i"),lookbehind:!0,greedy:!0,inside:s},e.languages.insertBefore("markup","cdata",o)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(t,n){e.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[n,"language-"+n],inside:e.languages[n]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup,e.languages.xml=e.languages.extend("markup",{}),e.languages.ssml=e.languages.xml,e.languages.atom=e.languages.xml,e.languages.rss=e.languages.xml}var dhe=v1;v1.displayName="css";v1.aliases=[];function v1(e){(function(t){var n=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+n.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+n.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+n.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:n,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var r=t.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))})(e)}var hhe=w1;w1.displayName="clike";w1.aliases=[];function w1(e){e.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/}}var ZM=x1;x1.displayName="javascript";x1.aliases=["js"];function x1(e){e.languages.javascript=e.languages.extend("clike",{"class-name":[e.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),e.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,e.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:e.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:e.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:e.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:e.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:e.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),e.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:e.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),e.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),e.languages.markup&&(e.languages.markup.tag.addInlined("script","javascript"),e.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),e.languages.js=e.languages.javascript}const phe=ci(ZM);var Ml=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof la=="object"?la:{},mhe=Ohe();Ml.Prism={manual:!0,disableWorkerMessageHandler:!0};var ghe=Oce,yhe=qde,JM=che,vhe=fhe,whe=dhe,xhe=hhe,bhe=ZM;mhe();var b1={}.hasOwnProperty;function ej(){}ej.prototype=JM;var at=new ej,She=at;at.highlight=Ehe;at.register=Cc;at.alias=khe;at.registered=Che;at.listLanguages=The;Cc(vhe);Cc(whe);Cc(xhe);Cc(bhe);at.util.encode=Nhe;at.Token.stringify=_he;function Cc(e){if(typeof e!="function"||!e.displayName)throw new Error("Expected `function` for `grammar`, got `"+e+"`");at.languages[e.displayName]===void 0&&e(at)}function khe(e,t){var n=at.languages,r=e,i,s,o,a;t&&(r={},r[e]=t);for(i in r)for(s=r[i],s=typeof s=="string"?[s]:s,o=s.length,a=-1;++a?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/}}const Rhe=ci(Lhe);var Ihe=E1;E1.displayName="typescript";E1.aliases=["ts"];function E1(e){(function(t){t.languages.typescript=t.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),t.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete t.languages.typescript.parameter,delete t.languages.typescript["literal-property"];var n=t.languages.extend("typescript",{});delete n["class-name"],t.languages.typescript["class-name"].inside=n,t.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:n}}}}),t.languages.ts=t.languages.typescript})(e)}const Dhe=ci(Ihe);var Mhe=C1;C1.displayName="yaml";C1.aliases=["yml"];function C1(e){(function(t){var n=/[*&][^\s[\]{},]+/,r=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,i="(?:"+r.source+"(?:[ ]+"+n.source+")?|"+n.source+"(?:[ ]+"+r.source+")?)",s=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-])(?:[ \t]*(?:(?![#:])|:))*/.source.replace(//g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),o=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function a(l,u){u=(u||"").replace(/m/g,"")+"m";var f=/([:\-,[{]\s*(?:\s<>[ \t]+)?)(?:<>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<>/g,function(){return i}).replace(/<>/g,function(){return l});return RegExp(f,u)}t.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<>/g,function(){return i})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<>[ \t]+)?)<>(?=\s*:\s)/.source.replace(/<>/g,function(){return i}).replace(/<>/g,function(){return"(?:"+s+"|"+o+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:a(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:a(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:a(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:a(o),lookbehind:!0,greedy:!0},number:{pattern:a(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:r,important:n,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},t.languages.yml=t.languages.yaml})(e)}const jhe=ci(Mhe),gs={'code[class*="language-"]':{color:"white",fontFamily:"JetBrains Mono",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",lineHeight:"25px",fontSize:"0.8rem",margin:"5px 0"},'pre[class*="language-"]':{color:"white",fontFamily:"JetBrains Mono",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",lineHeight:"25px",fontSize:"0.85rem",margin:"0.5em 0",background:"#2a2a2a",padding:"1em",overflow:"auto"},'pre[class*="language-"] *':{fontFamily:"JetBrains Mono"},':not(pre) > code[class*="language-"]':{color:"white",background:"#0a143c",padding:"0.1em",borderRadius:"0.3em",whiteSpace:"normal"},'pre[class*="language-"]::-moz-selection':{textShadow:"none",background:"rgba(29, 59, 83, 0.99)"},'pre[class*="language-"] ::-moz-selection':{textShadow:"none",background:"rgba(29, 59, 83, 0.99)"},'code[class*="language-"]::-moz-selection':{textShadow:"none",background:"rgba(29, 59, 83, 0.99)"},'code[class*="language-"] ::-moz-selection':{textShadow:"none",background:"rgba(29, 59, 83, 0.99)"},'pre[class*="language-"]::selection':{textShadow:"none",background:"rgba(29, 59, 83, 0.99)"},'pre[class*="language-"] ::selection':{textShadow:"none",background:"rgba(29, 59, 83, 0.99)"},'code[class*="language-"]::selection':{textShadow:"none",background:"rgba(29, 59, 83, 0.99)"},'code[class*="language-"] ::selection':{textShadow:"none",background:"rgba(29, 59, 83, 0.99)"},comment:{color:"#6272a4",fontStyle:"italic"},prolog:{color:"#6272a4",fontStyle:"italic"},cdata:{color:"#6272a4",fontStyle:"italic"},punctuation:{color:"#f8f8f2"},".namespace":{color:"#f8f8f2"},deleted:{color:"#ff5555",fontStyle:"italic"},symbol:{color:"#ff79c6"},property:{color:"#ff79c6"},tag:{color:"#ff79c6"},operator:{color:"#ff79c6"},keyword:{color:"#ff79c6"},boolean:{color:"#bd93f9"},number:{color:"#bd93f9"},constant:{color:"#8be9fd"},function:{color:"#8be9fd"},builtin:{color:"#8be9fd"},char:{color:"#8be9fd"},selector:{color:"#ff79c6",fontStyle:"italic"},doctype:{color:"#6272a4",fontStyle:"italic"},"attr-name":{color:"#50fa7b",fontStyle:"italic"},inserted:{color:"#50fa7b",fontStyle:"italic"},string:{color:"#f1fa8c"},url:{color:"#f1fa8c"},entity:{color:"#f1fa8c"},".language-css .token.string":{color:"#f1fa8c"},".style .token.string":{color:"#f1fa8c"},"class-name":{color:"#8be9fd"},atrule:{color:"#50fa7b"},"attr-value":{color:"#f1fa8c"},regex:{color:"#ffb86c"},important:{color:"#ffb86c",fontWeight:"bold"},variable:{color:"#f8f8f2"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}},Fhe=E.memo(({data:e,isConnectable:t})=>{const n={pm:"#FFA500",db:"#000080",backend:"#FF10F0",ux:"#A020F0","webapp-structure":"#39FF14","webapp-view":"#05D9FF"};an.registerLanguage("yaml",jhe),an.registerLanguage("js",phe),an.registerLanguage("sql",Rhe),an.registerLanguage("typescript",Dhe),kh();const r=e.key.includes("webapp.react.views")?bo(w=>w.project.streamEvents[`${e.key.split(".").slice(0,4).join(".")}`]):bo(w=>w.project.streamEvents[e.key]),i=bo(w=>w.project.projectData[e.key]);let s;e.key.includes("webapp.react.views")&&(s=bo(w=>w.project.projectData[e.key.replace(".react.",".layout.")]));const o=E.useRef(null);E.useState("");const[a,l]=E.useState(Date.now());function u(){var w;return(w=e==null?void 0:e.meta)!=null&&w.type&&n[e.meta.type]?`[${n[e.meta.type]}]`:"none"}function f(){return e.key==="db.postgres"?"sql":"yaml"}function c(){return i?e.key==="db.postgres"?i:xl.stringify(i):""}const[d,h]=E.useState(!1);E.useEffect(()=>{e.key.includes("webapp.")&&i&&Object.keys(i).length&&h(Object.keys(i).reverse()[0])},[i]);function p(){var w,y,v,g,x,S,k,C,T,O,A,j,L,B,N,M,I,F;return e.key.includes("webapp.react.root")||e.key.includes("webapp.react.store")?b.jsxs("div",{className:"grid grid-cols-12",children:[b.jsxs("div",{className:"col-span-9 grid grid-cols-2",children:[(r==null?void 0:r.is_running)&&(r==null?void 0:r.data)&&b.jsx("pre",{className:"p-2 m-2 max-h-[40vh] overflow-auto whitespace-pre-wrap break-words",style:{fontFamily:"JetBrains Mono",fontWeight:400},children:b.jsx("div",{className:"mx-2",children:b.jsx("div",{className:"flex justify-center items-center p-4 m-4",children:b.jsx("div",{className:"animate-spin rounded-full h-5 w-5 border-r border-[#aaa]"})})})})||b.jsx(b.Fragment,{}),b.jsx("pre",{ref:o,className:`p-2 m-2 max-h-[40vh] overflow-auto whitespace-pre-wrap break-words duration-200 ${r!=null&&r.is_running&&(r!=null&&r.data)?"":"col-span-2"}`,style:{fontFamily:"JetBrains Mono",fontWeight:400},children:(r==null?void 0:r.is_running)&&(r==null?void 0:r.data)&&b.jsx(b.Fragment,{children:r.data.data})||b.jsx(b.Fragment,{children:d&&i?i[d].tsx.slice(0,300)+" ...":""})})]}),(r==null?void 0:r.is_running)&&(r==null?void 0:r.data)&&b.jsx(b.Fragment,{children:b.jsx("div",{className:"col-span-3 text-sm p-2 m-2",children:b.jsx("h3",{className:"py-2 mb-2 opacity-50",children:"processing"})})})||b.jsx(b.Fragment,{children:i&&b.jsxs("div",{className:"col-span-3 text-sm p-2 m-2",children:[b.jsx("h3",{className:"border-b py-2 mb-2 border-[#333]",children:"versions"}),b.jsx("div",{className:"grid",children:Object.entries(i).reverse().map(([P,D],_)=>b.jsx("a",{className:`rounded cursor-pointer p-2 mb-1 hover:bg-[#222] duration-200 ${d===P?"bg-[#333]":""} `,onClick:()=>{h(P)},children:P},_))})]})||""})]}):e.key.includes("webapp.react.views")?b.jsxs("div",{className:"grid grid-cols-12",children:[b.jsxs("div",{className:"col-span-9 grid grid-cols-2",children:[(r==null?void 0:r.is_running)&&(r==null?void 0:r.data)&&b.jsx("pre",{className:"p-2 m-2 max-h-[40vh] overflow-auto whitespace-pre-wrap break-words",style:{fontFamily:"JetBrains Mono",fontWeight:400},children:b.jsx("div",{className:"mx-2",children:b.jsx("div",{className:"flex justify-center items-center p-4 m-4",children:b.jsx("div",{className:"animate-spin rounded-full h-5 w-5 border-r border-[#aaa]"})})})})||b.jsx(b.Fragment,{}),b.jsx("pre",{ref:o,className:`p-2 m-2 max-h-[40vh] overflow-auto whitespace-pre-wrap break-words duration-200 ${r!=null&&r.is_running&&(r!=null&&r.data)?"":"col-span-2"} text-xs `,style:{fontFamily:"JetBrains Mono",fontWeight:400},children:(r==null?void 0:r.is_running)&&(r==null?void 0:r.data)&&b.jsx(b.Fragment,{children:r.data.data})||b.jsx(b.Fragment,{children:d&&i?i[d].tsx.slice(0,300)+" ...":""})})]}),(r==null?void 0:r.is_running)&&(r==null?void 0:r.data)&&b.jsx(b.Fragment,{children:b.jsx("div",{className:"col-span-3 text-sm p-2 m-2",children:b.jsx("h3",{className:"py-2 mb-2 opacity-50",children:"processing"})})})||b.jsx(b.Fragment,{children:b.jsxs("div",{className:"col-span-3 text-sm p-2 m-2 max-h-[40vh] overflow-auto",children:[b.jsx("h3",{className:"border-b py-2 mb-2 border-[#333]",children:"versions"}),b.jsx("div",{className:"grid",children:i&&Object.entries(i).reverse().map(([P,D],_)=>b.jsx("a",{className:`rounded cursor-pointer p-2 mb-1 hover:bg-[#222] duration-200 ${d===P?"bg-[#333]":""} `,onClick:()=>{h(P)},children:P},_))||b.jsx(b.Fragment,{})})]})}),s&&d&&s[d]&&(((g=(v=(y=(w=s[d])==null?void 0:w.render)==null?void 0:y.image)==null?void 0:v.url)==null?void 0:g.length)||((C=(k=(S=(x=s[d])==null?void 0:x.render)==null?void 0:S.image)==null?void 0:k.local)==null?void 0:C.length))&&b.jsx("div",{className:"col-span-12 p-2 m-2 text-xs",children:b.jsx("img",{title:`Design mockup reference generated for ${e.key}, version : ${d}`,alt:`Design mockup reference generated for ${e.key}, version : ${d}`,src:(j=(A=(O=(T=s[d])==null?void 0:T.render)==null?void 0:O.image)==null?void 0:A.url)!=null&&j.length?(N=(B=(L=s[d])==null?void 0:L.render)==null?void 0:B.image)==null?void 0:N.url:`http://localhost:4200/storage/${(F=(I=(M=s[d])==null?void 0:M.render)==null?void 0:I.image)==null?void 0:F.local.split("/storage/")[1]}`})})||b.jsx(b.Fragment,{})]}):b.jsxs("div",{className:`grid ${r!=null&&r.is_running&&(r!=null&&r.data)?"grid-cols-2":""}`,children:[b.jsx("div",{children:b.jsxs("pre",{className:"p-2 m-2 max-h-[25vh] overflow-auto whitespace-pre-wrap break-words",style:{fontFamily:"JetBrains Mono",fontWeight:400},children:[(r==null?void 0:r.is_running)&&(r==null?void 0:r.data)&&b.jsx(b.Fragment,{children:b.jsx("div",{className:"flex justify-center items-center p-4 m-4",children:b.jsx("div",{className:"animate-spin rounded-full h-5 w-5 border-r border-[#aaa]"})})})||b.jsx(b.Fragment,{}),i&&b.jsx(b.Fragment,{children:typeof i=="string"?i.slice(0,100)+" ...":xl.stringify(i).slice(0,100)+" ..."})||b.jsx(b.Fragment,{})]})}),(r==null?void 0:r.is_running)&&(r==null?void 0:r.data)&&b.jsx("div",{children:b.jsx("pre",{ref:o,className:"p-2 m-2 max-h-[25vh] overflow-auto whitespace-pre-wrap break-words font-light",children:r.data.data})})||b.jsx(b.Fragment,{})]})}function m(){var w,y,v,g;return e.key.includes("webapp.react.root")||e.key.includes("webapp.react.store")?d?b.jsx(b.Fragment,{children:d&&i&&b.jsxs("pre",{className:"rounded grid grid-cols-6 gap-2 rounded-lg p-2 text-white text-xs overflow-auto whitespace-pre-wrap break-words",children:[b.jsx(an,{className:"col-span-4 rounded bg-black text-xs",language:"typescript",style:gs,wrapLines:!0,wrapLongLines:!0,children:i[d].tsx}),b.jsx(an,{className:"col-span-2 rounded bg-black text-xs",language:f(),style:gs,wrapLines:!0,wrapLongLines:!0,children:xl.stringify({...(w=i[d])!=null&&w.dependencies?{dependencies:i[d].dependencies}:{},...(y=i[d])!=null&&y.analysis?{analysis:i[d].analysis}:{}})})]})||""}):b.jsx(b.Fragment,{}):e.key.includes("webapp.react.views")?d?b.jsx(b.Fragment,{children:d&&i&&b.jsxs("pre",{className:"rounded grid grid-cols-6 gap-2 rounded-lg p-2 text-white text-xs overflow-auto whitespace-pre-wrap break-words",children:[b.jsx(an,{className:"col-span-4 rounded bg-black text-xs",language:"typescript",style:gs,wrapLines:!0,wrapLongLines:!0,children:i[d].tsx}),b.jsx(an,{className:"col-span-2 rounded bg-black text-xs",language:f(),style:gs,wrapLines:!0,wrapLongLines:!0,children:xl.stringify({...(v=i[d])!=null&&v.dependencies?{dependencies:i[d].dependencies}:{},...(g=i[d])!=null&&g.analysis?{analysis:i[d].analysis}:{}})})]})||""}):b.jsx(b.Fragment,{}):e.key==="backend.server.main"?b.jsx(b.Fragment,{children:i&&b.jsxs("pre",{className:"rounded grid grid-cols-6 gap-2 rounded-lg p-2 text-white text-xs overflow-auto whitespace-pre-wrap break-words",children:[b.jsx(an,{className:"col-span-4 rounded bg-black text-xs",language:"javascript",style:gs,wrapLines:!0,wrapLongLines:!0,children:i.mjs}),b.jsx(an,{className:"col-span-2 rounded bg-black text-xs",language:f(),style:gs,wrapLines:!0,wrapLongLines:!0,children:xl.stringify({env:i.env,dependencies:i.dependencies})})]})||""}):b.jsx(b.Fragment,{children:b.jsx("pre",{className:"rounded rounded-lg p-2 text-white text-xs overflow-auto whitespace-pre-wrap break-words",children:b.jsx(an,{className:"rounded bg-black text-xs",language:f(),style:gs,wrapLines:!0,wrapLongLines:!0,children:c()})})})}return E.useEffect(()=>{o.current&&(o.current.scrollTop=o.current.scrollHeight)},[r]),b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"hidden bg-[#FFA500] bg-[#000080] bg-[#FF10F0] bg-[#A020F0] bg-[#05D9FF] bg-[#39FF14]",children:"_tw_manual_debugging_ _preload_all_colors_variations_so_it_builds_them"}),b.jsxs("div",{className:`dark bg-[#0a0a0a] font-light ${r!=null&&r.is_running&&(r!=null&&r.data)?"max-w-[60vw] xl:max-w-[50vw]":"max-w-[60vw] xl:max-w-[40vw]"} overflow-auto text-xs`,children:[b.jsxs("div",{className:"opacity-0",children:[b.jsx(An,{type:"target",id:"top",position:se.Top,style:{background:"#555"},onConnect:w=>console.log("handle onConnect",w),isConnectable:t}),b.jsx(An,{type:"target",id:"botom",position:se.Bottom,style:{background:"#555"},onConnect:w=>console.log("handle onConnect",w),isConnectable:t}),b.jsx(An,{type:"target",id:"left",position:se.Left,style:{background:"#555"},onConnect:w=>console.log("handle onConnect",w),isConnectable:t}),b.jsx(An,{type:"target",id:"right",position:se.Right,style:{background:"#555"},onConnect:w=>console.log("handle onConnect",w),isConnectable:t})]}),b.jsxs("div",{className:"text-white rounded rounded-xl p-2 font-light",children:[b.jsxs("div",{className:"text-base p-2 m-2 duration-200 rounded flex gap-2 items-start",children:[b.jsx("div",{className:`h-8 w-8 m-2 rounded bg-${u()}`}),b.jsxs("div",{children:[b.jsx("strong",{children:e.meta.name}),b.jsx("br",{}),b.jsxs("span",{className:"opacity-80",children:[e.meta.desc," ",e.key.includes("webapp.react.views")?` : ${e.key.split(".")[3]}`:""]})]})]},a),p(),i&&b.jsxs(_L,{children:[b.jsx("div",{className:"flex justify-end border-t pt-2 my-2 border-[#222]",children:b.jsx(AL,{asChild:!0,children:b.jsx(ta,{variant:"outline",children:"View"})})}),b.jsxs(ax,{className:"font-light bg-white/10 backdrop-blur-md border-[#222] max-w-[90vw] h-[90vh] max-h-[90vh] overflow-auto p-8",children:[b.jsxs(lx,{className:"text-[#aaa]",children:[b.jsx(cx,{children:"Detailed View"}),b.jsxs(fx,{className:"text-white text-lg whitespace-pre-wrap break-words font-light",children:[e.key," ",b.jsx("strong",{className:"text-base",children:d?`{ ${d} }`:""})]})]}),e.meta.content_type==="markdown"&&e.key!="pm.details"&&b.jsx(b.Fragment,{children:b.jsx("div",{className:"rounded rounded-lg p-12 m-2 bg-[#2a2a2a] text-white text-sm overflow-auto whitespace-pre-wrap break-words",children:b.jsx(Loe,{className:"markdown",remarkPlugins:[Ule],children:i})})})||m(),b.jsx("pre",{className:"",style:{fontFamily:"JetBrains Mono",fontWeight:400}}),b.jsx(ux,{children:b.jsx(zq,{asChild:!0,children:b.jsx(ta,{variant:"",children:"Back"})})})]})]})||b.jsx(b.Fragment,{})]}),b.jsxs("div",{className:"opacity-0",children:[b.jsx(An,{type:"source",position:se.Top,id:"top",style:{left:10,background:"#555"},isConnectable:t}),b.jsx(An,{type:"source",position:se.Right,id:"right",style:{top:10,background:"#555"},isConnectable:t}),b.jsx(An,{type:"source",position:se.Bottom,id:"bottom",style:{left:10,background:"#555"},isConnectable:t}),b.jsx(An,{type:"source",position:se.Left,id:"left",style:{top:10,background:"#555"},isConnectable:t})]})]},a)]})}),$he={cofounder_node:Fhe},Bhe={floating:ete},Vhe={},zhe=[],Uhe=[],Hhe=({project:e})=>{const t=kh(),n=bo(p=>p.project.nodesKeys);E.useEffect(()=>{t(Wz(e))},[t,e]);const[r,i,s]=_ee(zhe),[o,a,l]=Aee(Uhe),[u,f]=E.useState("dark");E.useState(!1),E.useState(null);const[c,d]=E.useState(Date.now());E.useEffect(()=>{if(n&&n.length){let p={},m=[],w=n.filter(y=>y.startsWith("webapp.react.views."));w.length&&w.map((v,g)=>{const x=Math.floor(g/5),S=g%5;p[v]={position:{x:($r.metrics.DIST_X*2+$r.metrics.PADDING_X*.5)*S,y:$r.nodes["webapp.react.views"].position.y+$r.metrics.DIST_Y*2.5*x-S*$r.metrics.PADDING_Y*2}},m.push({id:`uxsitemap.structure-${v}`,source:"uxsitemap.structure",target:v})}),i(y=>{const v={};return y.map(g=>{v[g.id]={position:g.position}}),n.filter(g=>Object.keys($r.nodes).some(x=>g.startsWith(x))).map((g,x)=>{let S=`${g}`,k=!1,C=!1;g.startsWith("webapp")&&(S=g.split(".").slice(0,3).join("."),k=!0,g.includes("webapp.react.views")&&(C=!0));const T=bC.meta[S],O=v[g]?v[g]:k&&C?p[g]:$r.nodes[S];return{type:"cofounder_node",id:g,data:{key:g,meta:{...T,content_type:bC.types[T.type]}},...O}}).filter(g=>g)}),a([...$r.edges,...m.map(y=>({animated:!0,style:{stroke:"#999"},type:"floating",markerEnd:{type:Xs.ArrowClosed,width:30,height:30},...y}))])}},[n]);const h=E.useCallback(p=>a(m=>AR({...p,type:"floating",markerEnd:{type:Xs.Arrow}},m)),[a]);return b.jsxs("div",{style:{width:"100vw",height:"100vh"},children:[b.jsx("pre",{className:"m-4 p-4 bg-black text-white text-sm hidden",children:JSON.stringify(r)}),b.jsxs(Tee,{colorMode:u,nodes:r,edges:o,onNodesChange:s,onEdgesChange:l,onConnect:h,fitView:!0,minZoom:.1,edgeTypes:Bhe,connectionLineComponent:tte,nodeTypes:$he,proOptions:Vhe,children:[b.jsx(Bee,{}),b.jsx(Zee,{}),b.jsx(Ree,{variant:"dots",gap:48,size:2})]},c)]})},Whe=({project:e})=>{var u,f,c;kh();const t=bo(d=>d.project.streamEvents),[n,r]=E.useState(!0),[i,s]=E.useState(""),[o,a]=E.useState(!1),l=E.useRef(null);return E.useEffect(()=>{Object.entries(t).filter(([h,p])=>p.is_running).length&&(i!=null&&i.length)&&(l.current.scrollTop=l.current.scrollHeight)},[t]),b.jsxs(b.Fragment,{children:[Object.keys(t).length&&(i==null?void 0:i.length)&&b.jsx(b.Fragment,{children:b.jsx("div",{className:`fixed top-0 left-0 inset-0 flex items-start justify-center\r h-[80vh] w-[75vw] overflow-hidden`,style:{zIndex:999},children:b.jsx("div",{className:`text-white text-sm font-light overflow-auto shadow-2xl rounded rounded-lg bg-[#444]/30 backdrop-blur-md whitespace-pre-wrap break-words mt-[10vh] w-full max-h-[65vh] m-12 p-12 duration-300`,ref:l,children:b.jsx("p",{children:(c=(f=(u=t[i])==null?void 0:u.data)==null?void 0:f.data)==null?void 0:c.trim()})})})})||b.jsx(b.Fragment,{}),b.jsx("div",{className:`dark text-white fixed top-0 right-0 m-4 ${n?"w-[25vw] h-[70vh] p-8 bg-[#333]/20":"w-[3vw] h-[70vh] flex items-center justify-center text-center cursor-pointer bg-[#666]/20 hover:bg-white/20"} backdrop-blur-md rounded rounded-lg duration-300`,onClick:()=>{n||r(!0)},style:{zIndex:2},children:b.jsxs("div",{children:[b.jsx("a",{className:`cursor-pointer hover:text-[#ccc] duration-200 ${n?"":"text-xl font-light"}`,onClick:()=>{r(!n)},children:`${n?"Operations Streams >":"<"}`}),n&&b.jsx(b.Fragment,{children:b.jsxs("div",{className:"py-2 mt-2 border-t border-[#222] max-h-[60vh] overflow-auto",children:[!Object.keys(t).length&&b.jsx(b.Fragment,{children:b.jsx("h2",{className:"opacity-50 text-lg font-light",children:"No current streaming operations"})})||b.jsx(b.Fragment,{}),Object.entries(t).filter(([d,h])=>h.is_running).map(([d,h],p)=>{var m,w,y;return b.jsxs("div",{className:"group p-2 my-2 rounded bg-[#222] hover:bg-black cursor-pointer duration-200 font-light whitespace-pre-wrap break-words",onMouseEnter:()=>{s(d)},onMouseLeave:()=>{o||s("")},onClick:()=>{o?(s(""),a(!1)):(s(d),a(!0))},children:[b.jsxs("div",{className:"flex gap-2 items-center mb-1",children:[b.jsxs("div",{role:"status",children:[b.jsxs("svg",{"aria-hidden":"true",className:"w-3 h-3 text-gray-200 animate-spin fill-[#666]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),b.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),b.jsx("span",{className:"sr-only",children:"Loading..."})]}),b.jsx("h2",{className:"text-sm",children:(m=h.meta)!=null&&m.name?h.meta.name:h.data.key})]}),((w=h.meta)==null?void 0:w.desc)&&b.jsx(b.Fragment,{children:b.jsxs("div",{className:"flex gap-2 items-center mb-1",children:[b.jsx("div",{role:"status opacity-0",children:b.jsxs("svg",{"aria-hidden":"true",className:"opacity-0 w-3 h-3 text-gray-200 animate-spin fill-[#666]",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),b.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]})}),b.jsx("h3",{className:"text-xs text-[#aaa]",children:(y=h.meta)==null?void 0:y.desc})]})})||b.jsx(b.Fragment,{})]},d)})]})})||b.jsx(b.Fragment,{})]})})]})},Khe=()=>{const{project:e}=g5(),[t,n]=E.useState("blueprint"),[r,i]=E.useState(!1),[s,o]=E.useState(!1),[a,l]=E.useState(!1),[u,f]=E.useState(!1),c=["blueprint","live","editor","export"],d="http://localhost:4200/api",h="http://localhost:5173",p=kh();return E.useEffect(()=>{u||(f(!0),p(Kz()))},[]),E.useEffect(()=>{t==="blueprint"&&(async()=>{try{(await fetch(`${d}/ping`)).ok?i(!0):i(!1)}catch{i(!1)}l(!0)})(),t==="live"&&(async()=>{try{(await fetch(h)).ok?o(!0):o(!1)}catch{o(!1)}})()},[t]),a?b.jsx(b.Fragment,{children:(e==null?void 0:e.length)&&b.jsxs(b.Fragment,{children:[b.jsx("div",{className:`fixed top-0 z-10 bg-[#333]/20 backdrop-blur-md rounded-lg shadow-md text-sm text-white font-light mt-4 p-2 ml-2 sm:ml-0 sm:left-1/2 sm:transform sm:-translate-x-1/2 px-6 `,children:b.jsxs("ul",{className:"flex justify-center space-x-4 items-center",children:[b.jsx(Kl,{className:"cursor-pointer p-2 rounded-xl hover:bg-[#333]/50 px-3",to:"/projects",children:b.jsx("li",{children:"<"})},e),c.map(m=>b.jsxs("li",{className:`cursor-pointer p-2 rounded-xl hover:bg-[#333]/50 flex items-center gap-2 px-3 ${t===m?"bg-black/50":""}`,onClick:()=>n(m),children:[m.charAt(0).toUpperCase()+m.slice(1),m==="live"&&b.jsx(b.Fragment,{children:b.jsx("a",{href:"http://localhost:5371",target:"_blank",rel:"noopener noreferrer",className:"flex items-center rounded-xl hover:bg-[#111] p-2",children:b.jsx($q,{className:"w-3 h-3"})})})||""]},m))]})}),b.jsx("div",{className:t==="blueprint"?"":"hidden",children:r&&b.jsxs(b.Fragment,{children:[b.jsx(Hhe,{project:e}),b.jsx(Whe,{project:e})]})||b.jsx(b.Fragment,{children:b.jsx("div",{className:"flex items-center justify-center h-screen w-full text-white",children:b.jsxs("h1",{className:"text-2xl font-light opacity-50 whitespace-pre-wrap break-all",children:[`{ local cofounder/api server at \`${d}\` not reachable }`,b.jsx("br",{}),b.jsx("br",{}),"> make sure local cofounder server is launched\n ( use `npm run start` in cofounder/api/ )"]})})})}),b.jsx("div",{className:t==="editor"?"":"hidden",children:b.jsx("div",{className:"flex items-center justify-center h-screen w-full text-white",children:b.jsx("h1",{className:"text-2xl font-light opacity-50 text-center",children:"{ editor : not implemented yet }"})})}),b.jsx("div",{className:t==="export"?"":"hidden",children:b.jsx("div",{className:"flex items-center justify-center h-screen w-full text-white",children:b.jsx("h1",{className:"text-2xl font-light opacity-50 text-center",children:"{ export : not implemented yet }"})})}),b.jsx("div",{className:t==="live"?"":"hidden",children:b.jsx(b.Fragment,{children:b.jsx("div",{className:"flex items-center justify-center h-screen w-full text-white",children:s&&b.jsx(b.Fragment,{children:b.jsx("iframe",{src:h,className:"w-full mt-[12vh] min-h-[88vh] border-t border-[#222] overflow-auto",style:{position:"absolute",top:0,left:0,right:0,bottom:0},title:"Live mode",sandbox:"allow-same-origin allow-scripts allow-popups allow-forms"})})||b.jsx(b.Fragment,{children:b.jsx("div",{className:"flex items-center justify-center h-screen w-full text-white",children:b.jsxs("h1",{className:"text-2xl font-light opacity-50 whitespace-pre-wrap break-all",children:[`{ app at \`${h}\` not reachable }`,b.jsx("br",{}),b.jsx("br",{}),b.jsx("br",{}),`either > webapp vite server not launched ( use \`npm run dev\` in apps/${e}/ to start )`,b.jsx("br",{}),b.jsx("br",{}),"or > problem in app root/store/view"]})})})})})})]})||b.jsx(b.Fragment,{children:b.jsx("div",{className:"flex items-center justify-center h-screen w-full text-white",children:b.jsx("h1",{className:"text-2xl font-light opacity-50 whitespace-pre-wrap break-all",children:"{ project not set ; double check your url }"})})})}):b.jsx(b.Fragment,{})},qhe=()=>{const[e,t]=E.useState(!1),[n,r]=E.useState(!1),i=ic(),s="http://localhost:4200/api";return E.useEffect(()=>{(async()=>{try{(await fetch(`${s}/ping`)).ok?t(!0):t(!1)}catch{t(!1)}r(!0)})()},[]),n?b.jsx(b.Fragment,{children:e&&b.jsx(b.Fragment,{children:b.jsxs("div",{className:"flex h-screen",children:[!i.pathname.startsWith("/project/")&&b.jsx(sK,{}),b.jsx("div",{className:"flex-1 overflow-auto",children:b.jsxs(P5,{children:[b.jsx(yo,{path:"/",element:b.jsx(b.Fragment,{children:b.jsxs("div",{className:"container text-white mx-auto w-full max-w-[90vw] xl:max-w-[60vw] p-12 mt-12 text-left whitespace-pre-line break-words",children:[b.jsx("section",{className:"pb-4 mb-4 text-center",children:b.jsx("a",{href:"https://github.com/raidendotai/cofounder",target:"_blank",className:"opacity-100 hover:opacity-90 duration-200",children:b.jsx("img",{className:"rounded rounded-xl max-w-[90vw] md:max-w-[35vw] mx-auto",src:qz})})}),b.jsx("h2",{className:"mt-4 text-2xl opacity-50 font-light text-center uppercase",children:"early alpha release"})]})})}),b.jsx(yo,{path:"/projects",element:b.jsx("div",{className:"container text-white mx-auto w-full max-w-[90vw] xl:max-w-[80vw] p-6 mt-6 text-left whitespace-pre-line break-words",children:b.jsx(Kq,{})})}),b.jsx(yo,{path:"/project/:project",element:b.jsx(Khe,{})}),b.jsx(yo,{path:"/playground/designer",element:b.jsx(qq,{})}),b.jsx(yo,{path:"/settings",element:b.jsx(Yq,{})})]})})]})})||b.jsx(b.Fragment,{children:b.jsx("div",{className:"flex items-center justify-center h-screen w-full text-white",children:b.jsxs("h1",{className:"text-2xl font-light opacity-50 whitespace-pre-wrap break-all",children:[`{ local cofounder/api server at \`${s}\` not reachable }`,b.jsx("br",{}),b.jsx("br",{}),"> make sure local cofounder server is launched\n ( use `npm run start` in cofounder/api/ )"]})})})}):b.jsx(b.Fragment,{})},Yhe=()=>b.jsx(b.Fragment,{children:b.jsx(qhe,{})});c2(document.getElementById("root")).render(b.jsx(IF,{store:$a,children:b.jsx(j5,{children:b.jsx(Yhe,{})})}))});export default Ghe(); ================================================ FILE: cofounder/api/dist/assets/index-COffgP7k.css ================================================ .react-flow{direction:ltr;--xy-edge-stroke-default: #b1b1b7;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #555;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(255, 255, 255, .5);--xy-minimap-background-color-default: #fff;--xy-minimap-mask-background-color-default: rgb(240, 240, 240, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #e2e2e2;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: transparent;--xy-background-pattern-dots-color-default: #91919a;--xy-background-pattern-lines-color-default: #eee;--xy-background-pattern-cross-color-default: #e2e2e2;background-color:var( --xy-background-color, var(--xy-background-color-default) );--xy-node-color-default: inherit;--xy-node-border-default: 1px solid #1a192b;--xy-node-background-color-default: #fff;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #1a192b;--xy-node-border-radius-default: 3px;--xy-handle-background-color-default: #1a192b;--xy-handle-border-color-default: #fff;--xy-selection-background-color-default: rgba(0, 89, 220, .08);--xy-selection-border-default: 1px dotted rgba(0, 89, 220, .8);--xy-controls-button-background-color-default: #fefefe;--xy-controls-button-background-color-hover-default: #f4f4f4;--xy-controls-button-color-default: inherit;--xy-controls-button-color-hover-default: inherit;--xy-controls-button-border-color-default: #eee;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #ffffff;--xy-edge-label-color-default: inherit;--xy-resize-background-color-default: #3367d9}.react-flow.dark{--xy-edge-stroke-default: #5c5c5c;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #8a8a8a;--xy-connectionline-stroke-default: #4a4a4a;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(100, 100, 100, .25);--xy-minimap-background-color-default: #1a1a1a;--xy-minimap-mask-background-color-default: rgba(80, 80, 80, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #3a3a3a;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: #1a1a1a;--xy-background-pattern-dots-color-default: #616161;--xy-background-pattern-lines-color-default: #141414;--xy-background-pattern-cross-color-default: #525252;--xy-node-color-default: #e0e0e0;--xy-node-border-default: 1px solid #4a4a4a;--xy-node-background-color-default: #2a2a2a;--xy-node-group-background-color-default: rgba(200, 200, 200, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #b0b0b0;--xy-handle-background-color-default: #d0d0d0;--xy-handle-border-color-default: #2a2a2a;--xy-selection-background-color-default: rgba(150, 150, 200, .08);--xy-selection-border-default: 1px dotted rgba(150, 150, 200, .8);--xy-controls-button-background-color-default: #3a3a3a;--xy-controls-button-background-color-hover-default: #4a4a4a;--xy-controls-button-color-default: #e0e0e0;--xy-controls-button-color-hover-default: #ffffff;--xy-controls-button-border-color-default: #6a6a6a;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #1a1a1a;--xy-edge-label-color-default: #e0e0e0}.react-flow__background{background-color:var( --xy-background-color, var(--xy-background-color-props, var(--xy-background-color-default)) );pointer-events:none;z-index:-1}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var( --xy-connectionline-stroke, var(--xy-connectionline-stroke-default) );stroke-width:var( --xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default) );fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{overflow:visible;position:absolute;pointer-events:none}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge.selectable:focus .react-flow__edge-path,.react-flow__edge.selectable:focus-visible .react-flow__edge-path{stroke:var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default))}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}svg.react-flow__connectionline{z-index:1001;overflow:visible;position:absolute}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default}.react-flow__node.selectable{cursor:pointer}.react-flow__node.draggable{cursor:grab;pointer-events:all}.react-flow__node.draggable.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background-color:var( --xy-handle-background-color, var(--xy-handle-background-color-default) );border:1px solid var(--xy-handle-border-color, var(--xy-handle-border-color-default));border-radius:100%}.react-flow__handle.connectingfrom{pointer-events:all}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:0;transform:translate(-50%,50%)}.react-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.react-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.react-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.center{left:50%;transform:translate(-50%)}.react-flow__attribution{font-size:10px;background:var( --xy-attribution-background-color, var(--xy-attribution-background-color-default) );padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;left:0;top:0}.react-flow__viewport-portal{position:absolute;width:100%;height:100%;left:0;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__minimap{background:var( --xy-minimap-background-color-props, var(--xy-minimap-background-color, var(--xy-minimap-background-color-default)) )}.react-flow__minimap-svg{display:block}.react-flow__minimap-mask{fill:var( --xy-minimap-mask-background-color-props, var( --xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default) ) );stroke:var( --xy-minimap-mask-stroke-color-props, var( --xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default) ) );stroke-width:var( --xy-minimap-mask-stroke-width-props, var( --xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default) ) )}.react-flow__minimap-node{fill:var( --xy-minimap-node-background-color-props, var( --xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default) ) );stroke:var( --xy-minimap-node-stroke-color-props, var( --xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default) ) );stroke-width:var( --xy-minimap-node-stroke-width-props, var( --xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default) ) )}.react-flow__background-pattern.dots{fill:var( --xy-background-pattern-color-props, var( --xy-background-pattern-color, var(--xy-background-pattern-dots-color-default) ) )}.react-flow__background-pattern.lines{stroke:var( --xy-background-pattern-color-props, var( --xy-background-pattern-color, var(--xy-background-pattern-lines-color-default) ) )}.react-flow__background-pattern.cross{stroke:var( --xy-background-pattern-color-props, var( --xy-background-pattern-color, var(--xy-background-pattern-cross-color-default) ) )}.react-flow__controls{display:flex;flex-direction:column;box-shadow:var( --xy-controls-box-shadow, var(--xy-controls-box-shadow-default) )}.react-flow__controls.horizontal{flex-direction:row}.react-flow__controls-button{display:flex;justify-content:center;align-items:center;height:26px;width:26px;padding:4px;border:none;background:var( --xy-controls-button-background-color, var(--xy-controls-button-background-color-default) );border-bottom:1px solid var( --xy-controls-button-border-color-props, var( --xy-controls-button-border-color, var(--xy-controls-button-border-color-default) ) );color:var( --xy-controls-button-color-props, var(--xy-controls-button-color, var(--xy-controls-button-color-default)) );cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px;fill:currentColor}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-input,.react-flow__node-default,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:var( --xy-node-border-radius, var(--xy-node-border-radius-default) );width:150px;font-size:12px;color:var(--xy-node-color, var(--xy-node-color-default));text-align:center;border:var(--xy-node-border, var(--xy-node-border-default));background-color:var( --xy-node-background-color, var(--xy-node-background-color-default) )}.react-flow__node-input.selectable:hover,.react-flow__node-default.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:var( --xy-node-boxshadow-hover, var(--xy-node-boxshadow-hover-default) )}.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:var( --xy-node-boxshadow-selected, var(--xy-node-boxshadow-selected-default) )}.react-flow__node-group{background-color:var( --xy-node-group-background-color, var(--xy-node-group-background-color-default) )}.react-flow__nodesselection-rect,.react-flow__selection{background:var( --xy-selection-background-color, var(--xy-selection-background-color-default) );border:var(--xy-selection-border, var(--xy-selection-border-default))}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls-button:hover{background:var( --xy-controls-button-background-color-hover-props, var( --xy-controls-button-background-color-hover, var(--xy-controls-button-background-color-hover-default) ) );color:var( --xy-controls-button-color-hover-props, var( --xy-controls-button-color-hover, var(--xy-controls-button-color-hover-default) ) )}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__controls-button:last-child{border-bottom:none}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:4px;height:4px;border:1px solid #fff;border-radius:1px;background-color:var( --xy-resize-background-color, var(--xy-resize-background-color-default) );transform:translate(-50%,-50%)}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:var( --xy-resize-background-color, var(--xy-resize-background-color-default) );border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}.react-flow__edge-textbg{fill:var( --xy-edge-label-background-color, var(--xy-edge-label-background-color-default) )}.react-flow__edge-text{fill:var(--xy-edge-label-color, var(--xy-edge-label-color-default))}.floatingedges{flex-direction:column;display:flex;flex-grow:1;height:100%}.floatingedges .react-flow__handle{opacity:0}.react-flow__node-cofounder_node{background:#000;border:1px solid #555;border-radius:5px;text-align:left}.markdown{color:#fff;font-size:.975rem;line-height:1.3;padding:.3rem;border-bottom:1px solid #555;margin-bottom:1rem;-webkit-font-smoothing:antialiased}.markdown h1{font-size:1.5rem;margin:.3rem 0;border-bottom:1px solid #444;padding-bottom:.2rem}.markdown h2{font-size:1.25rem;margin:.3rem 0;border-bottom:1px solid #444;padding-bottom:.2rem}.markdown h3{font-size:1rem;margin:.2rem 0;border-bottom:1px solid #444;padding-bottom:.2rem}.markdown p{margin:.3rem 0;line-height:1.75}.markdown ul,.markdown ol{margin:.3rem 0;padding-left:1.2rem}.markdown li{margin:.1rem 0;border-bottom:1px solid #222}.markdown blockquote{border-left:2px solid #555;padding-left:.5rem;color:#ccc;margin:.3rem 0;border-bottom:1px solid #222}.markdown code{background-color:#222;color:#f8f8f2;padding:.2rem .4rem;margin:.1rem;border-radius:3px}.markdown pre{background-color:#111;color:#f8f8f2;padding:.4rem;border-radius:5px;overflow:auto;margin:.3rem 0}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}:root{--radius: .5rem}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.-bottom-12{bottom:-3rem}.-left-12{left:-3rem}.-right-12{right:-3rem}.-top-12{top:-3rem}.bottom-0{bottom:0}.bottom-4{bottom:1rem}.left-0{left:0}.left-1{left:.25rem}.left-1\/2{left:50%}.left-2{left:.5rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-1\/2{top:50%}.top-2{top:.5rem}.top-4{top:1rem}.top-\[1px\]{top:1px}.top-\[50\%\]{top:50%}.top-\[60\%\]{top:60%}.top-full{top:100%}.z-10{z-index:10}.z-50{z-index:50}.z-\[100\]{z-index:100}.z-\[1\]{z-index:1}.col-span-12{grid-column:span 12 / span 12}.col-span-2{grid-column:span 2 / span 2}.col-span-3{grid-column:span 3 / span 3}.col-span-4{grid-column:span 4 / span 4}.col-span-9{grid-column:span 9 / span 9}.m-12{margin:3rem}.m-2{margin:.5rem}.m-4{margin:1rem}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.-ml-4{margin-left:-1rem}.-mt-4{margin-top:-1rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-auto{margin-left:auto}.mr-2{margin-right:.5rem}.mt-1\.5{margin-top:.375rem}.mt-12{margin-top:3rem}.mt-2{margin-top:.5rem}.mt-24{margin-top:6rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-\[10vh\]{margin-top:10vh}.mt-\[12vh\]{margin-top:12vh}.mt-auto{margin-top:auto}.line-clamp-5{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:5}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[1px\]{height:1px}.h-\[70vh\]{height:70vh}.h-\[80vh\]{height:80vh}.h-\[90vh\]{height:90vh}.h-\[var\(--radix-navigation-menu-viewport-height\)\]{height:var(--radix-navigation-menu-viewport-height)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-96{max-height:24rem}.max-h-\[25vh\]{max-height:25vh}.max-h-\[300px\]{max-height:300px}.max-h-\[40vh\]{max-height:40vh}.max-h-\[60vh\]{max-height:60vh}.max-h-\[65vh\]{max-height:65vh}.max-h-\[90vh\]{max-height:90vh}.max-h-screen{max-height:100vh}.min-h-\[65vh\]{min-height:65vh}.min-h-\[80px\]{min-height:80px}.min-h-\[88vh\]{min-height:88vh}.w-0{width:0px}.w-1{width:.25rem}.w-1\/2{width:50%}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-4{width:1rem}.w-5{width:1.25rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[100px\]{width:100px}.w-\[1px\]{width:1px}.w-\[25vw\]{width:25vw}.w-\[3vw\]{width:3vw}.w-\[75vw\]{width:75vw}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[12rem\]{min-width:12rem}.min-w-\[50vw\]{min-width:50vw}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.max-w-\[30vw\]{max-width:30vw}.max-w-\[60vw\]{max-width:60vw}.max-w-\[90vw\]{max-width:90vw}.max-w-lg{max-width:32rem}.max-w-max{max-width:-moz-max-content;max-width:max-content}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.grow-0{flex-grow:0}.basis-full{flex-basis:100%}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.list-none{list-style-type:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-stretch{align-items:stretch}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-t-\[10px\]{border-top-left-radius:10px;border-top-right-radius:10px}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.border{border-width:1px}.border-2{border-width:2px}.border-\[1\.5px\]{border-width:1.5px}.border-y{border-top-width:1px;border-bottom-width:1px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[\#222\]{--tw-border-opacity: 1;border-color:rgb(34 34 34 / var(--tw-border-opacity))}.border-\[\#333333\],.border-\[\#333\]{--tw-border-opacity: 1;border-color:rgb(51 51 51 / var(--tw-border-opacity))}.border-\[\#aaa\]{--tw-border-opacity: 1;border-color:rgb(170 170 170 / var(--tw-border-opacity))}.border-\[--color-border\]{border-color:var(--color-border)}.border-neutral-200{--tw-border-opacity: 1;border-color:rgb(229 229 229 / var(--tw-border-opacity))}.border-neutral-200\/50{border-color:#e5e5e580}.border-neutral-900{--tw-border-opacity: 1;border-color:rgb(23 23 23 / var(--tw-border-opacity))}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity))}.border-red-500\/50{border-color:#ef444480}.border-transparent{border-color:transparent}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[\#000080\]{--tw-bg-opacity: 1;background-color:rgb(0 0 128 / var(--tw-bg-opacity))}.bg-\[\#05D9FF\]{--tw-bg-opacity: 1;background-color:rgb(5 217 255 / var(--tw-bg-opacity))}.bg-\[\#0a0a0a\]{--tw-bg-opacity: 1;background-color:rgb(10 10 10 / var(--tw-bg-opacity))}.bg-\[\#111\]{--tw-bg-opacity: 1;background-color:rgb(17 17 17 / var(--tw-bg-opacity))}.bg-\[\#1a1a1a\]{--tw-bg-opacity: 1;background-color:rgb(26 26 26 / var(--tw-bg-opacity))}.bg-\[\#222\]{--tw-bg-opacity: 1;background-color:rgb(34 34 34 / var(--tw-bg-opacity))}.bg-\[\#2a2a2a\]{--tw-bg-opacity: 1;background-color:rgb(42 42 42 / var(--tw-bg-opacity))}.bg-\[\#333\]{--tw-bg-opacity: 1;background-color:rgb(51 51 51 / var(--tw-bg-opacity))}.bg-\[\#333\]\/20{background-color:#3333}.bg-\[\#39FF14\]{--tw-bg-opacity: 1;background-color:rgb(57 255 20 / var(--tw-bg-opacity))}.bg-\[\#444\]\/30{background-color:#4444444d}.bg-\[\#666\]\/20{background-color:#6663}.bg-\[\#A020F0\]{--tw-bg-opacity: 1;background-color:rgb(160 32 240 / var(--tw-bg-opacity))}.bg-\[\#FF10F0\]{--tw-bg-opacity: 1;background-color:rgb(255 16 240 / var(--tw-bg-opacity))}.bg-\[\#FFA500\]{--tw-bg-opacity: 1;background-color:rgb(255 165 0 / var(--tw-bg-opacity))}.bg-\[--color-bg\]{background-color:var(--color-bg)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}.bg-black\/50{background-color:#00000080}.bg-black\/80{background-color:#000c}.bg-neutral-100{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity))}.bg-neutral-100\/50{background-color:#f5f5f580}.bg-neutral-200{--tw-bg-opacity: 1;background-color:rgb(229 229 229 / var(--tw-bg-opacity))}.bg-neutral-800{--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}.bg-neutral-900{--tw-bg-opacity: 1;background-color:rgb(23 23 23 / var(--tw-bg-opacity))}.bg-neutral-950{--tw-bg-opacity: 1;background-color:rgb(10 10 10 / var(--tw-bg-opacity))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.bg-white\/10{background-color:#ffffff1a}.fill-\[\#666\]{fill:#666}.fill-current{fill:currentColor}.p-0{padding:0}.p-1{padding:.25rem}.p-12{padding:3rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.p-\[1px\]{padding:1px}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-2\.5{padding-left:.625rem}.pl-4{padding-left:1rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pr-10{padding-right:2.5rem}.pr-2{padding-right:.5rem}.pr-2\.5{padding-right:.625rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-\[0\.8rem\]{font-size:.8rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-light{font-weight:300}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.tracking-tight{letter-spacing:-.025em}.tracking-widest{letter-spacing:.1em}.text-\[\#aaa\]{--tw-text-opacity: 1;color:rgb(170 170 170 / var(--tw-text-opacity))}.text-\[\#bbb\]{--tw-text-opacity: 1;color:rgb(187 187 187 / var(--tw-text-opacity))}.text-\[\#ccc\],.text-\[\#cccccc\]{--tw-text-opacity: 1;color:rgb(204 204 204 / var(--tw-text-opacity))}.text-\[\#ddd\]{--tw-text-opacity: 1;color:rgb(221 221 221 / var(--tw-text-opacity))}.text-\[\#ffffff\]{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.text-current{color:currentColor}.text-gray-200{--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity))}.text-neutral-50{--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity))}.text-neutral-500{--tw-text-opacity: 1;color:rgb(115 115 115 / var(--tw-text-opacity))}.text-neutral-900{--tw-text-opacity: 1;color:rgb(23 23 23 / var(--tw-text-opacity))}.text-neutral-950{--tw-text-opacity: 1;color:rgb(10 10 10 / var(--tw-text-opacity))}.text-neutral-950\/50{color:#0a0a0a80}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-neutral-950{--tw-ring-opacity: 1;--tw-ring-color: rgb(10 10 10 / var(--tw-ring-opacity))}.ring-offset-white{--tw-ring-offset-color: #fff}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-1000{transition-duration:1s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.fade-in-0{--tw-enter-opacity: 0}.fade-in-80{--tw-enter-opacity: .8}.zoom-in-95{--tw-enter-scale: .95}.duration-1000{animation-duration:1s}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}:root{font-family:Karla,system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;background:#111;color-scheme:light dark;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}*::-moz-selection{background-color:#bbb;color:#000}*::selection{background-color:#bbb;color:#000}::-webkit-scrollbar{width:5px;height:5px}::-webkit-scrollbar-track{background:#222}::-webkit-scrollbar-thumb{background:#69696999;height:50px}::-webkit-scrollbar-thumb:hover{background:#aaa}::-webkit-scrollbar-thumb:horizontal{height:5px}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.placeholder\:text-neutral-500::-moz-placeholder{--tw-text-opacity: 1;color:rgb(115 115 115 / var(--tw-text-opacity))}.placeholder\:text-neutral-500::placeholder{--tw-text-opacity: 1;color:rgb(115 115 115 / var(--tw-text-opacity))}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:inset-y-0:after{content:var(--tw-content);top:0;bottom:0}.after\:left-1\/2:after{content:var(--tw-content);left:50%}.after\:w-1:after{content:var(--tw-content);width:.25rem}.after\:-translate-x-1\/2:after{content:var(--tw-content);--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.first\:rounded-l-md:first-child{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.first\:border-l:first-child{border-left-width:1px}.last\:rounded-r-md:last-child{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.focus-within\:relative:focus-within{position:relative}.focus-within\:z-20:focus-within{z-index:20}.hover\:bg-\[\#111\]:hover{--tw-bg-opacity: 1;background-color:rgb(17 17 17 / var(--tw-bg-opacity))}.hover\:bg-\[\#1a1a1a\]:hover{--tw-bg-opacity: 1;background-color:rgb(26 26 26 / var(--tw-bg-opacity))}.hover\:bg-\[\#222\]:hover{--tw-bg-opacity: 1;background-color:rgb(34 34 34 / var(--tw-bg-opacity))}.hover\:bg-\[\#333\]\/50:hover{background-color:#33333380}.hover\:bg-black:hover{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}.hover\:bg-green-800:hover{--tw-bg-opacity: 1;background-color:rgb(22 101 52 / var(--tw-bg-opacity))}.hover\:bg-neutral-100:hover{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity))}.hover\:bg-neutral-100\/50:hover{background-color:#f5f5f580}.hover\:bg-neutral-100\/80:hover{background-color:#f5f5f5cc}.hover\:bg-neutral-900:hover{--tw-bg-opacity: 1;background-color:rgb(23 23 23 / var(--tw-bg-opacity))}.hover\:bg-neutral-900\/80:hover{background-color:#171717cc}.hover\:bg-neutral-900\/90:hover{background-color:#171717e6}.hover\:bg-red-500\/80:hover{background-color:#ef4444cc}.hover\:bg-red-500\/90:hover{background-color:#ef4444e6}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity))}.hover\:bg-white\/20:hover{background-color:#fff3}.hover\:text-\[\#ccc\]:hover{--tw-text-opacity: 1;color:rgb(204 204 204 / var(--tw-text-opacity))}.hover\:text-neutral-50:hover{--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity))}.hover\:text-neutral-500:hover{--tw-text-opacity: 1;color:rgb(115 115 115 / var(--tw-text-opacity))}.hover\:text-neutral-900:hover{--tw-text-opacity: 1;color:rgb(23 23 23 / var(--tw-text-opacity))}.hover\:text-neutral-950:hover{--tw-text-opacity: 1;color:rgb(10 10 10 / var(--tw-text-opacity))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-90:hover{opacity:.9}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\:bg-neutral-100:focus{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity))}.focus\:bg-neutral-900:focus{--tw-bg-opacity: 1;background-color:rgb(23 23 23 / var(--tw-bg-opacity))}.focus\:text-neutral-50:focus{--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity))}.focus\:text-neutral-900:focus{--tw-text-opacity: 1;color:rgb(23 23 23 / var(--tw-text-opacity))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-neutral-950:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(10 10 10 / var(--tw-ring-opacity))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-neutral-950:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(10 10 10 / var(--tw-ring-opacity))}.focus-visible\:ring-offset-1:focus-visible{--tw-ring-offset-width: 1px}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-white:focus-visible{--tw-ring-offset-color: #fff}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:block{display:block}.group:hover .group-hover\:opacity-100{opacity:1}.group\/card:hover .group-hover\/card\:after\:ml-2:after{content:var(--tw-content);margin-left:.5rem}.group\/card:hover .group-hover\/card\:after\:content-\[\'→\'\]:after{--tw-content: "→";content:var(--tw-content)}.group.destructive .group-\[\.destructive\]\:border-neutral-100\/40{border-color:#f5f5f566}.group.toaster .group-\[\.toaster\]\:border-neutral-200{--tw-border-opacity: 1;border-color:rgb(229 229 229 / var(--tw-border-opacity))}.group.toast .group-\[\.toast\]\:bg-neutral-100{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity))}.group.toast .group-\[\.toast\]\:bg-neutral-900{--tw-bg-opacity: 1;background-color:rgb(23 23 23 / var(--tw-bg-opacity))}.group.toaster .group-\[\.toaster\]\:bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity))}.group.toast .group-\[\.toast\]\:text-neutral-50{--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity))}.group.toast .group-\[\.toast\]\:text-neutral-500{--tw-text-opacity: 1;color:rgb(115 115 115 / var(--tw-text-opacity))}.group.toaster .group-\[\.toaster\]\:text-neutral-950{--tw-text-opacity: 1;color:rgb(10 10 10 / var(--tw-text-opacity))}.group.toaster .group-\[\.toaster\]\:shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.group.destructive .group-\[\.destructive\]\:hover\:border-red-500\/30:hover{border-color:#ef44444d}.group.destructive .group-\[\.destructive\]\:hover\:bg-red-500:hover{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity))}.group.destructive .group-\[\.destructive\]\:hover\:text-neutral-50:hover{--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.has-\[\:disabled\]\:opacity-50:has(:disabled){opacity:.5}.aria-selected\:bg-neutral-100[aria-selected=true]{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity))}.aria-selected\:bg-neutral-100\/50[aria-selected=true]{background-color:#f5f5f580}.aria-selected\:text-neutral-500[aria-selected=true]{--tw-text-opacity: 1;color:rgb(115 115 115 / var(--tw-text-opacity))}.aria-selected\:text-neutral-900[aria-selected=true]{--tw-text-opacity: 1;color:rgb(23 23 23 / var(--tw-text-opacity))}.aria-selected\:opacity-100[aria-selected=true]{opacity:1}.aria-selected\:opacity-30[aria-selected=true]{opacity:.3}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[panel-group-direction\=vertical\]\:h-px[data-panel-group-direction=vertical]{height:1px}.data-\[panel-group-direction\=vertical\]\:w-full[data-panel-group-direction=vertical]{width:100%}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-5[data-state=checked]{--tw-translate-x: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes accordion-up{0%{height:var(--radix-accordion-content-height)}to{height:0}}.data-\[state\=closed\]\:animate-accordion-up[data-state=closed]{animation:accordion-up .2s ease-out}@keyframes accordion-down{0%{height:0}to{height:var(--radix-accordion-content-height)}}.data-\[state\=open\]\:animate-accordion-down[data-state=open]{animation:accordion-down .2s ease-out}.data-\[panel-group-direction\=vertical\]\:flex-col[data-panel-group-direction=vertical]{flex-direction:column}.data-\[active\]\:bg-neutral-100\/50[data-active]{background-color:#f5f5f580}.data-\[selected\=\'true\'\]\:bg-neutral-100[data-selected=true]{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity))}.data-\[state\=active\]\:bg-white[data-state=active]{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.data-\[state\=checked\]\:bg-neutral-900[data-state=checked]{--tw-bg-opacity: 1;background-color:rgb(23 23 23 / var(--tw-bg-opacity))}.data-\[state\=on\]\:bg-neutral-100[data-state=on],.data-\[state\=open\]\:bg-neutral-100[data-state=open]{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity))}.data-\[state\=open\]\:bg-neutral-100\/50[data-state=open]{background-color:#f5f5f580}.data-\[state\=selected\]\:bg-neutral-100[data-state=selected]{--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity))}.data-\[state\=unchecked\]\:bg-neutral-200[data-state=unchecked]{--tw-bg-opacity: 1;background-color:rgb(229 229 229 / var(--tw-bg-opacity))}.data-\[selected\=true\]\:text-neutral-900[data-selected=true]{--tw-text-opacity: 1;color:rgb(23 23 23 / var(--tw-text-opacity))}.data-\[state\=active\]\:text-neutral-950[data-state=active]{--tw-text-opacity: 1;color:rgb(10 10 10 / var(--tw-text-opacity))}.data-\[state\=checked\]\:text-neutral-50[data-state=checked]{--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity))}.data-\[state\=on\]\:text-neutral-900[data-state=on]{--tw-text-opacity: 1;color:rgb(23 23 23 / var(--tw-text-opacity))}.data-\[state\=open\]\:text-neutral-500[data-state=open]{--tw-text-opacity: 1;color:rgb(115 115 115 / var(--tw-text-opacity))}.data-\[state\=open\]\:text-neutral-900[data-state=open]{--tw-text-opacity: 1;color:rgb(23 23 23 / var(--tw-text-opacity))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=closed\]\:duration-300[data-state=closed]{transition-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{transition-duration:.5s}.data-\[motion\^\=from-\]\:animate-in[data-motion^=from-],.data-\[state\=open\]\:animate-in[data-state=open],.data-\[state\=visible\]\:animate-in[data-state=visible]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[motion\^\=to-\]\:animate-out[data-motion^=to-],.data-\[state\=closed\]\:animate-out[data-state=closed],.data-\[state\=hidden\]\:animate-out[data-state=hidden],.data-\[swipe\=end\]\:animate-out[data-swipe=end]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[motion\^\=from-\]\:fade-in[data-motion^=from-]{--tw-enter-opacity: 0}.data-\[motion\^\=to-\]\:fade-out[data-motion^=to-],.data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.data-\[state\=closed\]\:fade-out-80[data-state=closed]{--tw-exit-opacity: .8}.data-\[state\=hidden\]\:fade-out[data-state=hidden]{--tw-exit-opacity: 0}.data-\[state\=open\]\:fade-in-0[data-state=open],.data-\[state\=visible\]\:fade-in[data-state=visible]{--tw-enter-opacity: 0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\[state\=open\]\:zoom-in-90[data-state=open]{--tw-enter-scale: .9}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\[motion\=from-end\]\:slide-in-from-right-52[data-motion=from-end]{--tw-enter-translate-x: 13rem}.data-\[motion\=from-start\]\:slide-in-from-left-52[data-motion=from-start]{--tw-enter-translate-x: -13rem}.data-\[motion\=to-end\]\:slide-out-to-right-52[data-motion=to-end]{--tw-exit-translate-x: 13rem}.data-\[motion\=to-start\]\:slide-out-to-left-52[data-motion=to-start]{--tw-exit-translate-x: -13rem}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.data-\[state\=closed\]\:slide-out-to-bottom[data-state=closed]{--tw-exit-translate-y: 100%}.data-\[state\=closed\]\:slide-out-to-left[data-state=closed]{--tw-exit-translate-x: -100%}.data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state=closed]{--tw-exit-translate-x: -50%}.data-\[state\=closed\]\:slide-out-to-right[data-state=closed],.data-\[state\=closed\]\:slide-out-to-right-full[data-state=closed]{--tw-exit-translate-x: 100%}.data-\[state\=closed\]\:slide-out-to-top[data-state=closed]{--tw-exit-translate-y: -100%}.data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state=closed]{--tw-exit-translate-y: -48%}.data-\[state\=open\]\:slide-in-from-bottom[data-state=open]{--tw-enter-translate-y: 100%}.data-\[state\=open\]\:slide-in-from-left[data-state=open]{--tw-enter-translate-x: -100%}.data-\[state\=open\]\:slide-in-from-left-1\/2[data-state=open]{--tw-enter-translate-x: -50%}.data-\[state\=open\]\:slide-in-from-right[data-state=open]{--tw-enter-translate-x: 100%}.data-\[state\=open\]\:slide-in-from-top[data-state=open]{--tw-enter-translate-y: -100%}.data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state=open]{--tw-enter-translate-y: -48%}.data-\[state\=open\]\:slide-in-from-top-full[data-state=open]{--tw-enter-translate-y: -100%}.data-\[state\=closed\]\:duration-300[data-state=closed]{animation-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{animation-duration:.5s}.data-\[panel-group-direction\=vertical\]\:after\:left-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);left:0}.data-\[panel-group-direction\=vertical\]\:after\:h-1[data-panel-group-direction=vertical]:after{content:var(--tw-content);height:.25rem}.data-\[panel-group-direction\=vertical\]\:after\:w-full[data-panel-group-direction=vertical]:after{content:var(--tw-content);width:100%}.data-\[panel-group-direction\=vertical\]\:after\:-translate-y-1\/2[data-panel-group-direction=vertical]:after{content:var(--tw-content);--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[panel-group-direction\=vertical\]\:after\:translate-x-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-state=open] .group-data-\[state\=open\]\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.dark\:border-neutral-50:is(.dark *){--tw-border-opacity: 1;border-color:rgb(250 250 250 / var(--tw-border-opacity))}.dark\:border-neutral-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(38 38 38 / var(--tw-border-opacity))}.dark\:border-neutral-800\/50:is(.dark *){border-color:#26262680}.dark\:border-red-500:is(.dark *){--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity))}.dark\:border-red-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(127 29 29 / var(--tw-border-opacity))}.dark\:border-red-900\/50:is(.dark *){border-color:#7f1d1d80}.dark\:dark\:border-red-900:is(.dark *):is(.dark *){--tw-border-opacity: 1;border-color:rgb(127 29 29 / var(--tw-border-opacity))}.dark\:bg-neutral-50:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(250 250 250 / var(--tw-bg-opacity))}.dark\:bg-neutral-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}.dark\:bg-neutral-800\/50:is(.dark *){background-color:#26262680}.dark\:bg-neutral-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(10 10 10 / var(--tw-bg-opacity))}.dark\:bg-red-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(127 29 29 / var(--tw-bg-opacity))}.dark\:text-neutral-400:is(.dark *){--tw-text-opacity: 1;color:rgb(163 163 163 / var(--tw-text-opacity))}.dark\:text-neutral-50:is(.dark *){--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity))}.dark\:text-neutral-50\/50:is(.dark *){color:#fafafa80}.dark\:text-neutral-900:is(.dark *){--tw-text-opacity: 1;color:rgb(23 23 23 / var(--tw-text-opacity))}.dark\:text-red-900:is(.dark *){--tw-text-opacity: 1;color:rgb(127 29 29 / var(--tw-text-opacity))}.dark\:ring-neutral-300:is(.dark *){--tw-ring-opacity: 1;--tw-ring-color: rgb(212 212 212 / var(--tw-ring-opacity))}.dark\:ring-offset-neutral-950:is(.dark *){--tw-ring-offset-color: #0a0a0a}.dark\:placeholder\:text-neutral-400:is(.dark *)::-moz-placeholder{--tw-text-opacity: 1;color:rgb(163 163 163 / var(--tw-text-opacity))}.dark\:placeholder\:text-neutral-400:is(.dark *)::placeholder{--tw-text-opacity: 1;color:rgb(163 163 163 / var(--tw-text-opacity))}.dark\:hover\:bg-neutral-50:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(250 250 250 / var(--tw-bg-opacity))}.dark\:hover\:bg-neutral-50\/80:hover:is(.dark *){background-color:#fafafacc}.dark\:hover\:bg-neutral-50\/90:hover:is(.dark *){background-color:#fafafae6}.dark\:hover\:bg-neutral-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}.dark\:hover\:bg-neutral-800\/50:hover:is(.dark *){background-color:#26262680}.dark\:hover\:bg-neutral-800\/80:hover:is(.dark *){background-color:#262626cc}.dark\:hover\:bg-red-900\/80:hover:is(.dark *){background-color:#7f1d1dcc}.dark\:hover\:bg-red-900\/90:hover:is(.dark *){background-color:#7f1d1de6}.dark\:hover\:text-neutral-400:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(163 163 163 / var(--tw-text-opacity))}.dark\:hover\:text-neutral-50:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity))}.dark\:hover\:text-neutral-900:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(23 23 23 / var(--tw-text-opacity))}.dark\:focus\:bg-neutral-50:focus:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(250 250 250 / var(--tw-bg-opacity))}.dark\:focus\:bg-neutral-800:focus:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}.dark\:focus\:text-neutral-50:focus:is(.dark *){--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity))}.dark\:focus\:text-neutral-900:focus:is(.dark *){--tw-text-opacity: 1;color:rgb(23 23 23 / var(--tw-text-opacity))}.dark\:focus\:ring-neutral-300:focus:is(.dark *){--tw-ring-opacity: 1;--tw-ring-color: rgb(212 212 212 / var(--tw-ring-opacity))}.dark\:focus-visible\:ring-neutral-300:focus-visible:is(.dark *){--tw-ring-opacity: 1;--tw-ring-color: rgb(212 212 212 / var(--tw-ring-opacity))}.dark\:focus-visible\:ring-offset-neutral-950:focus-visible:is(.dark *){--tw-ring-offset-color: #0a0a0a}.group.destructive .dark\:group-\[\.destructive\]\:border-neutral-800\/40:is(.dark *){border-color:#26262666}.group.toaster .dark\:group-\[\.toaster\]\:border-neutral-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(38 38 38 / var(--tw-border-opacity))}.group.toast .dark\:group-\[\.toast\]\:bg-neutral-50:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(250 250 250 / var(--tw-bg-opacity))}.group.toast .dark\:group-\[\.toast\]\:bg-neutral-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}.group.toaster .dark\:group-\[\.toaster\]\:bg-neutral-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(10 10 10 / var(--tw-bg-opacity))}.group.toast .dark\:group-\[\.toast\]\:text-neutral-400:is(.dark *){--tw-text-opacity: 1;color:rgb(163 163 163 / var(--tw-text-opacity))}.group.toast .dark\:group-\[\.toast\]\:text-neutral-900:is(.dark *){--tw-text-opacity: 1;color:rgb(23 23 23 / var(--tw-text-opacity))}.group.toaster .dark\:group-\[\.toaster\]\:text-neutral-50:is(.dark *){--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity))}.group.destructive .dark\:group-\[\.destructive\]\:hover\:border-red-900\/30:hover:is(.dark *){border-color:#7f1d1d4d}.group.destructive .dark\:group-\[\.destructive\]\:hover\:bg-red-900:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(127 29 29 / var(--tw-bg-opacity))}.group.destructive .dark\:group-\[\.destructive\]\:hover\:text-neutral-50:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity))}.group.destructive .dark\:group-\[\.destructive\]\:focus\:ring-red-900:focus:is(.dark *){--tw-ring-opacity: 1;--tw-ring-color: rgb(127 29 29 / var(--tw-ring-opacity))}.dark\:aria-selected\:bg-neutral-800[aria-selected=true]:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}.dark\:aria-selected\:bg-neutral-800\/50[aria-selected=true]:is(.dark *){background-color:#26262680}.dark\:aria-selected\:text-neutral-400[aria-selected=true]:is(.dark *){--tw-text-opacity: 1;color:rgb(163 163 163 / var(--tw-text-opacity))}.dark\:aria-selected\:text-neutral-50[aria-selected=true]:is(.dark *){--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity))}.dark\:data-\[active\]\:bg-neutral-800\/50[data-active]:is(.dark *){background-color:#26262680}.dark\:data-\[selected\=\'true\'\]\:bg-neutral-800[data-selected=true]:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}.dark\:data-\[state\=active\]\:bg-neutral-950[data-state=active]:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(10 10 10 / var(--tw-bg-opacity))}.dark\:data-\[state\=checked\]\:bg-neutral-50[data-state=checked]:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(250 250 250 / var(--tw-bg-opacity))}.dark\:data-\[state\=on\]\:bg-neutral-800[data-state=on]:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}.dark\:data-\[state\=open\]\:bg-neutral-800[data-state=open]:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}.dark\:data-\[state\=open\]\:bg-neutral-800\/50[data-state=open]:is(.dark *){background-color:#26262680}.dark\:data-\[state\=selected\]\:bg-neutral-800[data-state=selected]:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}.dark\:data-\[state\=unchecked\]\:bg-neutral-800[data-state=unchecked]:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}.dark\:data-\[selected\=true\]\:text-neutral-50[data-selected=true]:is(.dark *){--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity))}.dark\:data-\[state\=active\]\:text-neutral-50[data-state=active]:is(.dark *){--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity))}.dark\:data-\[state\=checked\]\:text-neutral-900[data-state=checked]:is(.dark *){--tw-text-opacity: 1;color:rgb(23 23 23 / var(--tw-text-opacity))}.dark\:data-\[state\=on\]\:text-neutral-50[data-state=on]:is(.dark *){--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity))}.dark\:data-\[state\=open\]\:text-neutral-400[data-state=open]:is(.dark *){--tw-text-opacity: 1;color:rgb(163 163 163 / var(--tw-text-opacity))}.dark\:data-\[state\=open\]\:text-neutral-50[data-state=open]:is(.dark *){--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity))}@media (min-width: 640px){.sm\:bottom-0{bottom:0}.sm\:left-1\/2{left:50%}.sm\:right-0{right:0}.sm\:top-auto{top:auto}.sm\:ml-0{margin-left:0}.sm\:mt-0{margin-top:0}.sm\:max-w-\[425px\]{max-width:425px}.sm\:max-w-sm{max-width:24rem}.sm\:-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.sm\:transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.sm\:flex-row{flex-direction:row}.sm\:flex-col{flex-direction:column}.sm\:justify-end{justify-content:flex-end}.sm\:gap-2\.5{gap:.625rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:text-left{text-align:left}.data-\[state\=open\]\:sm\:slide-in-from-bottom-full[data-state=open]{--tw-enter-translate-y: 100%}}@media (min-width: 768px){.md\:absolute{position:absolute}.md\:w-\[var\(--radix-navigation-menu-viewport-width\)\]{width:var(--radix-navigation-menu-viewport-width)}.md\:w-auto{width:auto}.md\:max-w-\[35vw\]{max-width:35vw}.md\:max-w-\[420px\]{max-width:420px}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width: 1024px){.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (min-width: 1280px){.xl\:max-w-\[40vw\]{max-width:40vw}.xl\:max-w-\[50vw\]{max-width:50vw}.xl\:max-w-\[60vw\]{max-width:60vw}.xl\:max-w-\[80vw\]{max-width:80vw}}.\[\&\:has\(\[aria-selected\]\)\]\:bg-neutral-100:has([aria-selected]){--tw-bg-opacity: 1;background-color:rgb(245 245 245 / var(--tw-bg-opacity))}.first\:\[\&\:has\(\[aria-selected\]\)\]\:rounded-l-md:has([aria-selected]):first-child{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.last\:\[\&\:has\(\[aria-selected\]\)\]\:rounded-r-md:has([aria-selected]):last-child{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.dark\:\[\&\:has\(\[aria-selected\]\)\]\:bg-neutral-800:has([aria-selected]):is(.dark *){--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}.\[\&\:has\(\[aria-selected\]\.day-outside\)\]\:bg-neutral-100\/50:has([aria-selected].day-outside){background-color:#f5f5f580}.dark\:\[\&\:has\(\[aria-selected\]\.day-outside\)\]\:bg-neutral-800\/50:has([aria-selected].day-outside):is(.dark *){background-color:#26262680}.\[\&\:has\(\[aria-selected\]\.day-range-end\)\]\:rounded-r-md:has([aria-selected].day-range-end){border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y: -3px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:size-3\.5>svg{width:.875rem;height:.875rem}.\[\&\>svg\]\:h-2\.5>svg{height:.625rem}.\[\&\>svg\]\:h-3>svg{height:.75rem}.\[\&\>svg\]\:w-2\.5>svg{width:.625rem}.\[\&\>svg\]\:w-3>svg{width:.75rem}.\[\&\>svg\]\:text-neutral-500>svg{--tw-text-opacity: 1;color:rgb(115 115 115 / var(--tw-text-opacity))}.\[\&\>svg\]\:text-neutral-950>svg{--tw-text-opacity: 1;color:rgb(10 10 10 / var(--tw-text-opacity))}.\[\&\>svg\]\:text-red-500>svg{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity))}.dark\:\[\&\>svg\]\:text-neutral-400>svg:is(.dark *){--tw-text-opacity: 1;color:rgb(163 163 163 / var(--tw-text-opacity))}.dark\:\[\&\>svg\]\:text-neutral-50>svg:is(.dark *){--tw-text-opacity: 1;color:rgb(250 250 250 / var(--tw-text-opacity))}.dark\:\[\&\>svg\]\:text-red-900>svg:is(.dark *){--tw-text-opacity: 1;color:rgb(127 29 29 / var(--tw-text-opacity))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&\[data-panel-group-direction\=vertical\]\>div\]\:rotate-90[data-panel-group-direction=vertical]>div{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\[data-state\=open\]\>svg\]\:rotate-180[data-state=open]>svg{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&_\.recharts-dot\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-dot[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-layer\]\:outline-none .recharts-layer{outline:2px solid transparent;outline-offset:2px}.\[\&_\.recharts-sector\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-sector[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-sector\]\:outline-none .recharts-sector,.\[\&_\.recharts-surface\]\:outline-none .recharts-surface{outline:2px solid transparent;outline-offset:2px}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-neutral-500 [cmdk-group-heading]{--tw-text-opacity: 1;color:rgb(115 115 115 / var(--tw-text-opacity))}.dark\:\[\&_\[cmdk-group-heading\]\]\:text-neutral-400 [cmdk-group-heading]:is(.dark *){--tw-text-opacity: 1;color:rgb(163 163 163 / var(--tw-text-opacity))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px} ================================================ FILE: cofounder/api/dist/index.html ================================================ Cofounder Dashboard
================================================ FILE: cofounder/api/package.json ================================================ { "type": "module", "aliases": { "@": "." }, "scripts": { "start:npx": "npm i && nodemon --loader esm-module-alias/loader --no-warnings server.js", "start": "nodemon --loader esm-module-alias/loader --no-warnings server.js" }, "nodemonConfig": { "ignore": [ "db/*" ] }, "dependencies": { "@anthropic-ai/sdk": "^0.27.3", "@google-cloud/storage": "^7.12.1", "@resvg/resvg-js": "^2.6.2", "async-retry": "^1.3.3", "colormap": "^2.3.2", "cors": "^2.8.5", "deepmerge": "^4.3.1", "delay": "^6.0.0", "dotenv": "^16.4.5", "esm-module-alias": "^2.2.0", "express": "^4.19.2", "firebase-admin": "^12.4.0", "firestore": "^1.1.6", "fs-extra": "^11.2.0", "js-yaml": "^4.1.0", "lodash": "^4.17.21", "lodash-es": "^4.17.21", "module-alias": "^2.2.3", "nodemon": "*", "open": "^10.1.0", "openai": "^4.55.4", "p-all": "^5.0.0", "p-queue": "^8.0.1", "sharp": "^0.33.4", "slugify": "^1.6.6", "socket.io": "^4.8.0", "vectra": "^0.9.0", "vite": "^5.4.8", "vite-express": "^0.19.0", "xml2js": "^0.6.2", "yaml": "^2.5.0", "yaml-js": "^0.3.1", "yargs": "^17.7.2" } } ================================================ FILE: cofounder/api/server.js ================================================ import { Server } from "socket.io"; import utils from "@/utils/index.js"; import path from "path"; import { fileURLToPath } from "url"; import express from "express"; import cors from "cors"; import dotenv from "dotenv"; import yargs from "yargs"; import fs from "fs"; import yaml from "yaml"; import { hideBin } from "yargs/helpers"; import { merge } from "lodash-es"; import open, { openApp, apps } from "open"; import cofounder from "./build.js"; dotenv.config(); // -------------------------------------------------------------- HELPERS ------------------------ function _slugify(text) { return text .toString() .toLowerCase() .replace(/\s+/g, "-") // Replace spaces with - .replace(/[^\w\-]+/g, "") // Remove all non-word chars .replace(/\-\-+/g, "-") // Replace multiple - with single - .replace(/^-+/, "") // Trim - from start .replace(/-+$/, ""); // Trim - from end } // ---------------------------------------------------------------------------------------------------- // -------------------------------------------------------------- ARGS CASE ------------------------ // init project from argv // to be called like : npm run start -- -p "some-project-name" -d "app description" const timestamp = Date.now(); const argv = yargs(hideBin(process.argv)).argv; const new_project = { project: (!argv.p && !argv.project) || !_slugify(argv.p || argv.project).length || !_slugify(argv.p || argv.project).match(/[a-z0-9]/) ? `project-${timestamp}` : _slugify(argv.p || argv.project), description: argv.description || argv.d || argv.desc || false, aesthetics: argv.aesthetics || argv.a || argv.aesthetic || false, }; if (argv.file || argv.f) { new_project.description = fs.readFileSync(argv.file || argv.f, "utf-8"); } async function create_new_project() { if (!new_project.description.length) { console.error( 'Error: -d "project description" is required and cannot be empty.', ); process.exit(1); } console.log( `\x1b[31minitialized generating app : ${new_project.project}\x1b[0m`, ); console.log( `\x1b[34m(see ${process.env.EXPORT_APPS_ROOT}/${new_project.project}/README.md for more details)\x1b[0m` + `\n\x1b[38;5;37mto start app (api+frontend in parallel)` + `\n\t> cd ${process.env.EXPORT_APPS_ROOT}/${new_project.project}` + `\n\t> npm i && npm run dev\x1b[0m`, ); const query = { pm: { details: { text: `${new_project.project != `project-${timestamp}` ? "Project '" + new_project.project + "' :" : ""} ${new_project.description}`, attachments: [], design: { aesthetics: { text: new_project.aesthetics, }, }, }, }, }; console.dir({ query }, { depth: null }); /* // debug : to resume ---------------------------------------------------------- const data = await cofounder.system.run({ id: "op:PROJECT::STATE:LOAD", context: { ...context, project: new_project.project, }, data: {}, }); await cofounder.system.run({ id: `seq:project:init:v1:resume`, context: { ...context, project: new_project.project, }, data: merge(data, { ...query, debug: {}, }), }); ---------------------------------------------------------- */ await cofounder.system.run({ id: `seq:project:init:v1`, context: { ...context, project: new_project.project, }, data: query, }); } // Call create_new_project if command args for init project are provided if (new_project.project && new_project.description) { create_new_project(); } // ---------------------------------------------------------------------------------------------------- // -------------------------------------------------------------- SERVER SETUP ------------------------ const app = express(); const PORT = process.env.PORT || 4200; app.use(cors()); app.use(express.json({ limit: "20mb" })); // convert the current module's URL to a file path - necessary in ES modules to get the equivalent of __filename const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); // serve static content from ./storage ; ie. for generated layout mockup images app.use("/storage", express.static(path.join(__dirname, "db/storage"))); app.use(express.static(path.join(__dirname, "dist"))); app.use(/^\/(?!storage|api).*$/, express.static(path.join(__dirname, "dist"))); const server = app.listen(PORT, () => { console.log( "\x1b[33m\n> cofounder/api : server is running on port " + PORT + "\x1b[0m", ); console.log(`> debug : open browser enabled : http://localhost:${PORT}/`); open(`http://localhost:${PORT}/`); }); // -------------------------------------------------------- SERVER REST API PATHS ------------------------ app.get("/api/ping", (req, res) => { res.status(200).json({ message: "pong" }); }); app.get("/api/projects/list", (req, res) => { fs.readdir("./db/projects", (err, files) => { if (err) { return res.status(500).json({ error: "> cant read projects directory" }); } const projects = files .filter((file) => fs.statSync(path.join("./db/projects", file)).isDirectory(), ) .map((projectDir) => { const yamlFilePath = path.join( "./db/projects", projectDir, "state/pm/user/details.yaml", ); if (fs.existsSync(yamlFilePath)) { const fileContent = fs.readFileSync(yamlFilePath, "utf8"); const parsedData = yaml.parse(fileContent); return { id: projectDir, data: parsedData.data || false }; } return { id: projectDir, data: false }; }); res.status(200).json({ projects }); }); }); app.post("/api/utils/transcribe", async (req, res) => { const uid = Math.random().toString(36).slice(2, 11); // Generate a random unique ID const tempFilePath = path.join(__dirname, "db/storage/temp", `${uid}.webm`); // Ensure the directory exists fs.mkdirSync(path.dirname(tempFilePath), { recursive: true }); try { if (!req.body || !req.body.audio) { throw new Error("No audio file uploaded"); } const audioData = req.body.audio; const audioBuffer = Buffer.from(audioData.split(",")[1], "base64"); // Write the audio buffer to the temporary path fs.writeFileSync(tempFilePath, audioBuffer); const { transcript } = await utils.openai.transcribe({ path: tempFilePath }); res.status(200).json({ transcript }); } catch (error) { console.error("Transcription error:", error); res.status(500).json({ error: "Failed to transcribe audio" }); } finally { // Delete the temporary file fs.unlink(tempFilePath, (err) => { if (err) console.error("Error deleting temporary file:", err); }); } }); app.post("/api/projects/new", async (req, res) => { const request = req.body; /* request : { project? : "project-id" || {} description: "", aeshetics?: "" } */ if (!request.description?.length) { return res.status(500).json({ error: "> no project description provided" }); } const timestamp = Date.now(); const new_project_query = { project: !request.project?.length || !_slugify(request.project).length || !_slugify(request.project).match(/[a-z0-9]/) ? `project-${timestamp}` : _slugify(request.project), description: request.description, aesthetics: request.aesthetics?.length ? request.aesthetics : false, }; const query = { pm: { details: { text: `${new_project_query.project != `project-${timestamp}` ? "Project '" + new_project_query.project + "' :\n" : ""}${new_project_query.description}`, attachments: [], design: { aesthetics: { text: new_project_query.aesthetics, }, }, timestamp, }, }, }; // call async cofounder.system.run({ id: `seq:project:init:v1`, context: { ...context, // {streams} project: new_project_query.project, }, data: query, }); res.status(200).json({ project: new_project_query.project }); }); app.post("/api/project/resume", async (req, res) => { const { project } = req.body; const resume_response = await resume_project({ project }); console.dir({ "debug:server:project/resume": resume_response }); setTimeout(async () => { await cofounder.system.run({ id: `seq:project:init:v1`, context: { ...context, // {streams} project, sequence: { resume: resume_response.resume, }, }, data: resume_response.data, }); }, 2000); res.status(200).json({ project }); }); const actions = { // map action to function ; load means load project state before passing "update:settings:preferences:versions": { fn: _updateProjectPreferences, load: false, }, "regenerate:ui": { fn: _regenerateUiComponent, load: true }, "iterate:ui": { fn: _iterateUiComponent, load: true }, /* later, single universal interface approach, > should go through an analysis sequence ; ie. is is a new feature that needs db schemas & apis to be altered, or just at the layout level, etc */ }; const actionsKeys = Object.keys(actions); app.post("/api/project/actions", async (req, res) => { /* in : { project : `exampleproject`, query : { action : "example:action:whatever", data : { }, }, } */ console.dir( { "cofounder:api:server:actions:debug": req.body }, { depth: null }, ); try { const { project, query } = req.body; const { action } = query; if (!actionsKeys.includes(action)) { throw new Error(`action ${action} not recognized`); } const { fn, load } = actions[action]; const data = await fn({ request: { project, query }, data: !load ? {} : await cofounder.system.run({ id: "op:PROJECT::STATE:LOAD", context: { ...context, project, }, data: {}, }), }); res.status(200).json({ end: true }); } catch (error) { console.error(error); res.status(500).json({ error: "failed to process" }); } }); // ---------------------------------------------------------------------------------------------------- // -------------------------------------------------------------- SOCKET IO SETUP ------------------------ // socket.io instance attached to express const io = new Server(server, { cors: { origin: "*", methods: ["GET", "POST"], }, }); const subscriptions = {}; const projects = {}; // will be sent inside context{} for system nodes to stream to at various steps const streams = { start: async ({ project, key, meta }) => { /* project , key , meta { name , desc } */ // console.dir({"debug:context:streams" : {subscriptions}} , {depth:null}) if (subscriptions[project]) io .to(subscriptions[project]) .emit("stream$start", { timestamp: Date.now(), key, meta }); }, write: async ({ project, key, data }) => { if (subscriptions[project]) io.to(subscriptions[project]).emit("stream$data", { key, data, }); }, end: async ({ project, key }) => { if (subscriptions[project]) io .to(subscriptions[project]) .emit("stream$end", { timestamp: Date.now(), key }); }, update: async ({ project, key, data }) => { if (!subscriptions[project]) return; // console.log('> debug:streams:update :', key) if (key.includes("webapp.")) { // reconstruct state let projectSubState = {}; const keys = key.split("."); let newStateUpdate = projectSubState; keys.forEach((k, index) => { if (!newStateUpdate[k]) { newStateUpdate[k] = index === keys.length - 1 ? data : {}; } else if (index === keys.length - 1) { newStateUpdate[k] = merge(newStateUpdate[k], data); } newStateUpdate = newStateUpdate[k]; }); const new_update_data = {}; let mergedKey; Object.keys(projectSubState.webapp).map((_type) => { // _type : react || layout Object.keys(projectSubState.webapp[_type]).map((_category) => { // _category : root || store || views Object.keys(projectSubState.webapp[_type][_category]).map((_id) => { // _id : app || redux || GV_Whatever || ... mergedKey = `webapp.${_type}.${_category}.${_id}`; new_update_data[mergedKey] = {}; Object.keys(projectSubState.webapp[_type][_category][_id]).map( (_version) => { // _version : latest || {timestamp} new_update_data[mergedKey][_version] = projectSubState.webapp[_type][_category][_id][_version]; }, ); }); }); }); key = mergedKey; data = new_update_data[mergedKey]; } io.to(subscriptions[project]).emit("state$update", { key, data, }); }, }; const context = { streams }; io.on("connection", async (socket) => { console.log("> user connected : ", socket.id); socket.on("subscribe", async (project) => { console.log(`> user ${socket.id} subscribed to project : ${project}`); if (!subscriptions[project]) { subscriptions[project] = []; } subscriptions[project].push(socket.id); try { await load_project({ project }); io.to(subscriptions[project]).emit("state$load", { timestamp: Date.now(), state: projects[project], }); } catch (e) { console.error("> cofounder/api : server error : ", e); } /* console.log("> ____debug : server : op:LLM::DEBUG : run"); const inference_debug = await cofounder.system.run({ id: "op:LLM::DEBUG:SIMULATE", context: { ...context, // {streams} project, operation: { key: "pm.prd", meta: { name: "PRD", desc: "project requirements doc", }, }, }, data: {}, // subscriptions[project] }); const prd = inference_debug.generated; await cofounder.system.run({ id: "op:PROJECT::STATE:UPDATE", context: { ...context, project, }, data: { operation: { id: "pm:prd", }, type: `end`, content: { key: "pm.prd", data: prd, }, }, }); const debug_webapp_data = yaml.parse( fs.readFileSync( `db/projects/foundermatchdevclone/state/webapp/code/react/views/GV_TopNav/versions/1726434529344.yaml`, "utf8", ), ); debug_webapp_data.data.tsx = `it be cool if this updated fr`; await cofounder.system.run({ id: "op:PROJECT::STATE:UPDATE", context: { ...context, project, }, data: { operation: { id: `webapp:react:views`, refs: { id: "GV_TopNav", version: "1726434529344", }, }, type: `end`, content: { key: debug_webapp_data.key, data: debug_webapp_data.data, }, }, }); console.log("> ____debug : server : op:LLM::DEBUG:2"); const demo_messages = [ { role: "system", content: "You are a helpful assistant that provides information about product requirements. in markdown format;", }, { role: "user", content: "Can you help me outline the product requirements for our new project? It's a rizz helper", }, ]; await cofounder.system.run({ id: "op:LLM::GEN", context: { ...context, // {streams} project, operation: { key: 'pm.prd', meta: { name: "PRD", desc: "product requirements document", }, }, }, data: { model: `gpt-4o-mini`, //`gpt-4o`, messages: demo_messages, preparser: `backticks`, parser: false, }, }) */ }); socket.on("disconnect", () => { console.log("> user disconnected : ", socket.id); for (const project in subscriptions) { subscriptions[project] = subscriptions[project].filter( (id) => id !== socket.id, ); } }); }); const load_project = async ({ project }) => { console.log("> load_project : start : ", project); const fetchedProject = await utils.load.local({ project, deconstructed: true, }); const fetchedProjectState = fetchedProject.state; const _project = fetchedProject.keymap || {}; let projectData = {}; Object.keys(_project) .filter((key) => !key.startsWith("webapp.")) .map((key) => { projectData[key] = _project[key]; }); if (fetchedProjectState.webapp) { Object.keys(fetchedProjectState.webapp).map((_type) => { // _type : react || layout Object.keys(fetchedProjectState.webapp[_type]).map((_category) => { // _category : root || store || views Object.keys(fetchedProjectState.webapp[_type][_category]).map((_id) => { // _id : app || redux || GV_Whatever || ... const mergedKey = `webapp.${_type}.${_category}.${_id}`; projectData[mergedKey] = {}; Object.keys(fetchedProjectState.webapp[_type][_category][_id]).map( (_version) => { // _version : latest || {timestamp} projectData[mergedKey][_version] = fetchedProjectState.webapp[_type][_category][_id][_version]; }, ); }); }); }); } projects[project] = projectData; console.dir({ load_project: project, data_keys: `${Object.keys(projects[project]).join(" , ")}`, }); // only use in resume ; else check data stored in projects[project] return fetchedProjectState; }; const seq_projectv1_dag = [ // dumped from makeDag() in ./build [], // project setup , skip ["pm.prd"], ["pm.frd"], ["pm.frd", "pm.uxsmd"], ["db.schemas", "uxsitemap.structure"], ["db.postgres"], ["pm.brd"], ["backend.specifications.openapi", "backend.specifications.asyncapi"], ["backend.server.main"], ["pm.uxdmd"], ["uxdatamap.structure"], ["uxdatamap.views"], ["webapp.react.store.redux"], ["webapp.react.root.app"], ["webapp.react.app.views"], // views , latest ]; async function resume_project({ project }) { const project_data = await load_project({ project }); const project_keys = Object.keys(projects[project]); let previous_phase_index = -1; for (let step of seq_projectv1_dag) { previous_phase_index++; if (step.length) { if ( step.every((entry) => project_keys.some((key) => key.startsWith(entry))) ) { continue; } else { break; } } } return { data: project_data, resume: previous_phase_index, }; } // example of how to stream to client (needs 3 steps) const stream_to_client = async ({ project, key, meta }) => { // if (!subscriptions[project]?.length) return; console.log(`> starting stream for project ${project}`); streams.start({ project, key, meta }); const chunkSize = 20; // Define the size of each chunk let currentIndex = 0; const interval = setInterval(() => { const timestamp = Date.now(); const data = texts[key].slice(currentIndex, currentIndex + chunkSize); // send chunk by chunk streams.write({ project, key, data }); currentIndex += chunkSize; // Move to the next chunk if (currentIndex >= texts[key].length) { clearInterval(interval); streams.end({ project, key }); } }, 100); }; // ---------------------------------------------------------------------------------------------------- // -------------------------------------------------------- SERVER REST API FUNCTION CALLS ------------------------ async function _updateProjectPreferences({ request }) { /* in : { project : `exampleproject`, query : { action : "example:action:whatever", data : { [views || sections] : { [id] : {version} } }, }, } */ const { project, query } = request; await cofounder.system.run({ id: "op:PROJECT::STATE:UPDATE", context: { ...context, project }, data: { operation: { id: `settings:preferences:versions`, }, type: `end`, content: { key: `settings.preferences.versions`, data: query.data, }, }, }); } async function _regenerateUiComponent({ request, data }) { const { project, query } = request; /* in : request: { project : `exampleproject`, query : { action : "regenerate:ui" data : { [views || sections] : `{id}`, // <--- update : sections stuff removed, is views only (for now) }, }, } */ const type = Object.keys(query.data)[0]; const id = query.data[type]; /* need to make : task { type: "view", view: { type: unique || shared, id, }, passes: { functional: true, redesign: process.env.DESIGNER_ENABLE ? JSON.parse(process.env.DESIGNER_ENABLE.toLowerCase()) : true, } } */ const task = { type: "view", view: { type: id.startsWith(`UV_`) ? `unique` : `shared`, id, }, passes: { functional: true, redesign: process.env.DESIGNER_ENABLE ? JSON.parse(process.env.DESIGNER_ENABLE.toLowerCase()) : false, }, }; console.dir({ "debug:server:task:regen:ui": { request, task } }); await cofounder.system.run({ id: "WEBAPP:VIEW::GENERATE", context: { ...context, project }, data: { ...data, task, }, }); } async function _iterateUiComponent({ request, data }) { console.dir({ "cofounder:api:server:iterate:ui": "starts" }); /* designer/layoutv1 might be overkill, but its best way to have primitives to retrieve design system docs (if applies) */ /* in : { project: meta.project, query: { action: "iterate:ui", data: { views : { [id] : { [version] : { user : { text: editUserText, attachments: [], // later, can attach image }, screenshot: { base64: image ? image : false}, designer: bool } }, } }, }, }), } */ const { project, query } = request; const id = Object.keys(query.data.views)[0]; const version = Object.keys(query.data.views[id])[0]; const { notes, screenshot, designer } = query.data.views[id][version]; const task = { type: "view", view: { type: id.startsWith(`UV_`) ? `unique` : `shared`, id, version, }, iteration: { notes, // {text,attachements} screenshot, // {base64 : "base64str" || false } designer: process.env.DESIGNER_ENABLE ? JSON.parse(process.env.DESIGNER_ENABLE.toLowerCase()) && designer ? true : false : false, }, }; console.dir({ "debug:server:task:regen:ui": { request, task } }); await cofounder.system.run({ id: "WEBAPP:VIEW::ITERATE", context: { ...context, project }, data: { ...data, task, }, }); } // ---------------------------------------------------------------------------------------------------- ================================================ FILE: cofounder/api/system/functions/backend/asyncapi.js ================================================ import utils from "@/utils/index.js"; import yaml from "yaml"; async function backendAsyncapiDefine({ context, data }) { if (!data.backend.requirements?.realtimeWebsockets?.required) { await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: "backend:specifications:asyncapi", }, type: `end`, content: { key: "backend.specifications.asyncapi", data: {}, }, }, }); return { backend: { specifications: { asyncapi: {}, }, }, }; } const { pm, db, backend } = data; const { prd, frd, drd, brd } = pm; const messages = [ { role: "system", content: `- you are a genius Product Manager & Software Architect & Backend designer - your role is to make the backend asyncAPI specs for the realtime features of the provided task - your asyncAPI specs should be comprehensive, and include schema object for each case, which will be used as references to build the frontend app connected to the backend - cover all cases ; data-related tasks only (ie. you are making a mock backend for user-facing data operations) - do a thorough analysis of the provided task - think from perspectives of multiple personas, put yourself in situation, to make sure your asyncAPI definition is fully comprehensive and ready to be used in production exactly as is - ask yourself: * what are all the events & schemas required by features expected to be seen by users in the frontend ? - ask yourself: * what are all the events & schemas required by features expected to be seen by users in the app ? - your aim is to cover all realtime use cases, as the expert product manager & architect you are --- the root dev url for the server is "http://localhost:1337" ; you can specify that in specs --- give a final, super comprehensive answer in strict, parseable asyncAPI YAML format which will be perfectly ready to plug into the backend in development, and pushed to staging directly and work flawlessly it should be comprehensive for the needs required by all the realtime events described in the provided docs answer in strict parseable asyncAPI in YAML format, with all schemas, for all scenarios ; - and specifying cases when a given schema field is required super important : > methods, routes, operationIds, and components (parameters and components) only > no input/output examples objects ! > you are only to detail realtime events and their schemas for realtime features described in the provided documents ! --- important : use snake_case for any naming you do --- your reply will be directly transferred as the final asyncAPI structure for the realtime events part of the backend, so do not put anything else in your reply besides the asyncAPI structure that details the realtime events parts of the backend only ! your reply should start with : "\`\`\`yaml" and end with "\`\`\`" you will be tipped $99999 + major company shares for nailing it perfectly off the bat`, }, { role: "user", content: `\`\`\`PRD:product-requirements-document ${prd} \`\`\``, }, { role: "user", content: `\`\`\`PRD:product-requirements-document ${frd} \`\`\``, }, { role: "user", content: `\`\`\`DRD:database-requirements-document ${drd} \`\`\` --- \`\`\`DB:schemas ${yaml.stringify({ schemas: db.schemas })} \`\`\` `, }, { role: "user", content: `\`\`\`BRD:Backend-requirements-document ${brd} \`\`\``, }, { role: "user", content: `implement the asyncAPI structure , for the realtime features specified in the provided documents super important : - your only focus is to make the asyncAPI for realtime events and their details , not anything else (such as a REST API ...) - asyncAPI for realtime events and their details only ! it is expected to be very comprehensive and detailed ; in a VALID PARSEABLE YAML format you're a genius`, }, ]; const asyncapiStructure = ( await context.run({ id: "op:LLM::GEN", context: { ...context, // {streams , project} operation: { key: "backend.specifications.asyncapi", meta: { name: "asyncAPI", desc: "asyncAPI specifications", }, }, }, data: { model: `chatgpt-4o-latest`, //`gpt-4o`, messages, preparser: `backticks`, parser: `yaml`, }, }) ).generated; await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: "backend:specifications:asyncapi", }, type: `end`, content: { key: "backend.specifications.asyncapi", data: asyncapiStructure, }, }, }); return { backend: { ...data.backend, specifications: { asyncapi: asyncapiStructure, }, }, }; } export default { "BACKEND:ASYNCAPI::DEFINE": backendAsyncapiDefine, }; ================================================ FILE: cofounder/api/system/functions/backend/openapi.js ================================================ import utils from "@/utils/index.js"; import yaml from "yaml"; async function backendOpenapiDefine({ context, data }) { if (!data.backend.requirements?.restApi?.required) { await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: "backend:specifications:openapi", }, type: `end`, content: { key: "backend.specifications.openapi", data: {}, }, }, }); return { backend: { specifications: { openapi: {}, }, }, }; } const { pm, db, backend } = data; const { prd, frd, drd, brd } = pm; const messages = [ { role: "system", content: `- you are a genius Product Manager & Software Archtect & API designer - your role is to make the openAPI specs for the user-facing API for the provided task - your API should be comprehensive, and include schema object for each case, which will be used as references to build the frontend app connected to the API - cover all cases ; data-related tasks only (ie. you are making a mock api for user-facing data operations) - do a thorough analysis of the provided task - think from perspectives of multiple personas, put yourself in situation, to make sure your openAPI definition is fully comprehensive and ready to be used in production exactly as is - ask yourself: * what are the key personas using the user-facing, frontend API ? * what are all the routes & schemas required by features expected to be seen by users in the frontend ? * am i assigning an "operationId" for every path&route ? - ask yourself: * what are all the routes & schemas required by features expected to be seen by users in the app ? - your answer will be pushed to production and will be responsible for an app used by thousands of users, instantly - your aim is to cover all use cases, as the expert product manager & architect you are --- give a final, super comprehensive answer in strict, parseable openAPI 3.0.0 YAML format which will be perfectly ready to plug into the backend in development, and pushed to staging directly and work flawlessly it should be comprehensive for the needs required by all the features answer in strict parseable openAPI 3.0.0 in YAML format, with all schemas, for all scenarios ; - and specifying cases when a given schema field is required the root dev url for the API is "http://localhost:1337" ; you can specify that in openapi super important : > methods, routes, operationIds, and components (parameters and components) only > no input/output examples objects ! > include a "summary" key for each route --- > note : if auth functionalities are present, use an architecture that will be compatible with a simple JWT auth system ! ie. > \`Authorization: Bearer \` in headers on authenticated requests > jwt type methods that return the authorization token on login, and that is used in header by subsequent authenticated requests important : if auth methods in api, token should be returned on both signup and login ! --- important : use snake_case for any naming you do --- your reply will be directly transferred as the final OPENAPI structure, so do not put anything else in your reply besides the openAPI structure your reply should start with : "\`\`\`yaml" and end with "\`\`\`" you will be tipped $99999 + major company shares for nailing it perfectly off the bat`, }, { role: "user", content: `\`\`\`PRD:product-requirements-document ${prd} \`\`\``, }, { role: "user", content: `\`\`\`PRD:product-requirements-document ${frd} \`\`\``, }, { role: "user", content: `\`\`\`DRD:database-requirements-document ${drd} \`\`\` --- \`\`\`DB:schemas ${yaml.stringify({ schemas: db.schemas })} \`\`\` `, }, { role: "user", content: `\`\`\`BRD:Backend-requirements-document ${brd} \`\`\``, }, { role: "user", content: `implement the openAPI structure it is expected to be very comprehensive and detailed ; in a VALID PARSEABLE YAML format you're a genius`, }, ]; const openapiStructure = ( await context.run({ id: "op:LLM::GEN", context: { ...context, // {streams , project} operation: { key: "backend.specifications.openapi", meta: { name: "openAPI", desc: "openAPI specifications", }, }, }, data: { model: `chatgpt-4o-latest`, //`gpt-4o`, messages, preparser: `backticks`, parser: `yaml`, }, }) ).generated; await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: "backend:specifications:openapi", }, type: `end`, content: { key: "backend.specifications.openapi", data: openapiStructure, }, }, }); return { backend: { ...data.backend, specifications: { openapi: openapiStructure, }, }, }; } export default { "BACKEND:OPENAPI::DEFINE": backendOpenapiDefine, }; ================================================ FILE: cofounder/api/system/functions/backend/server.js ================================================ import utils from "@/utils/index.js"; import yaml from "yaml"; async function backendServerGenerate({ context, data }) { /* base on dev:test oneshot function mix with the bak api generate for the make sure blabla */ const { pm, db, backend } = data; const { prd, frd, drd, brd } = pm; const { openapi, asyncapi } = backend.specifications; const messages = [ { role: `system`, content: `Your task, as the genius backend dev expert you are, is to generate the full nodejs script for a module, based on the provided specifications and details of the backend in development your role is to implement the full express server for the provided task for the \`server.mjs\` (type: module script) you will answer in 3 parts : - analysis , in between \`\`\`markdown\`\`\`\` section - code , in between \`\`\`mjs\`\`\`\` section - dependencies and env variables , in between \`\`\`yaml\`\`\`\` section ; where any needed packages to install and needed env variables to setup will be mentionned ; the yaml should have objects : { dependencies : {"package":"version"} , env : {"key" , "temp_value"} } ("dependencies" (for packages) and "env" for env variables (and their temporary values) ) use doublequotes for every string inside the yaml to make sure formatting is good --- in your analysis, ask yourself : - what features are expected ? does it need DB operations ? does it need storage ? > if so , how to handle the file storage / uploads / serving locally ? does it need realtime features and websocket events ? what operations are expected from the server to perfectly meet what the user expects from the feature ? think slowly, do not rush to answer ; think : am i achieving great UX ? am i doing great, perfect work ? do not overlook details ! in your code, include comment blocks before each implemented function or operation where you analyze what is done and why - it wil help you reason through more thoroughly and do a much greater work > super important : - in case a function requires the use of an external API (ie. for checking a stock price , or generating some image , ... ), you should include the following decorator inside your pre-function comment : \`@@need:external-api : description of the external api necessitated and what it should do\` you should also return a mock response that fits the right schema requirements ! so that the server returns mock responses in worst case ! important : external APIs should only handle external functionalities like the ones mentionned ; the server already has storage and DB access, so those do not need external APIs ! important : no placeholders ! no replace later ! no hallucinated unfinished code ! return a mock response that fits schema requirements in case you need to ! if feature needs external api, include the specified decorator \`@@need:external-api : description...\` in comment and return a mock response instead ! --- for any db requirements, use postgres from \`@electric-sql/pglite\` - to use postgres, include this snippet in your script : \`\`\` import { PGlite } from "@electric-sql/pglite"; const postgres = new PGlite("./db"); /* then, can be used like this : await postgres.query("SELECT * FROM exampletable;") */ // note : the postgres tables + seed were already created before , you can use the postgres directly without configuring it \`\`\` postgres is use exactly how is provided in the snippet, do not change anything about loading it / configuring it, else it breaks ; postgres is imported, initialized and queries EXACTLY AS SHOWN IN THE SNIPPET ! NO OTHER WAY ! --- notes : - make sure cors is enabled - if you need realtime, you can use socket.io if you need file storage capabilities (ie. file upload/download features), you can write/read locally from the \`./storage\` folder (create it if needed) for any db requirements, use postgres ; you can only use postgres (from @electric-sql/pglite ) with raw queries (no ORMs or anything) - to use postgres, include this snippet in your script : \`\`\` import { PGlite } from "@electric-sql/pglite"; const postgres = new PGlite("./db"); /* then, can be used like this : await postgres.query("SELECT * FROM exampletable;") */ \`\`\` note : the postgres tables + seed were already created before , you can use the postgres directly without configuring it ; do not create tables in script ! extremely important : - the DB R/W need to be 100% compatible with the tables and schemas of the provided DB specifications !! - if auth needed, use jwt middleware important : if auth , make sure you return token both on signup and login (even if openapi might have skipped that detail ! else stuff might break ! ) important : if auth , and also realtime websockets features , make sure auth / jwt also applies to sockets not just the api - if some function is too complex too implement (ie. needs more than known packages or DB R/W operations or too complex etc ...), you should return a mock response ; most important is : do not leave some "placeholder" function of value , do the mockup work if needed ! everything needs to be implemented and working, no placeholders, no hallucinated imports, no "do this later" ; everything working perfect in one single script ! - if you need realtime, you can use socket.io if you need file storage capabilities (ie. file upload/download features), you can write/read locally from the \`./storage\` folder (create it if needed) for any db requirements, use postgres ; you can only use postgres (from @electric-sql/pglite ) with raw queries (no ORMs or anything) - if auth needed, use jwt middleware important : if auth , make sure you return token both on signup and login (even if openapi might have skipped that detail ! else stuff might break ! ) - use morgan middleware to log any incoming request and details (ie. method, path, headers, params, query, body) - just for better dev exp - if it makes use of .env , make your you import \`dotenv\` and \`dotenv.config()\` to read .env before ! --- extremely important : - get the server port from env ; make default PORT always 1337 !! --- extremely important : - you are to implement the entire server as specified in the provided docs , with a focus on DB R/W operations - you are to implement every single thing needed by the backend server and output one single big working perfect \`server.mjs\` script > if backend has REST API , everything required and mentionned in the openAPI specs > if backend has realtime websockets , everything required and mentionned in the asyncAPI specs > if backend has both REST API and realtime Websockets , everything required by both and everything mentionned in both openAPI specs and asyncAPI specs ; and both working perfectly within the same \`server.mjs\` - do not assume anything is implemented yet ! you will do 100% of everything needed and output one single big working perfect \`server.mjs\` script - no placeholders, no hallucinated imports - again, do not assume anything is implemented yet ! you will do 100% of everything needed and output one single big working perfect \`server.mjs\` script - again , you are to implement every single thing needed by the backend server: > if backend has REST API , everything required and mentionned in the openAPI specs > if backend has realtime websockets , everything required and mentionned in the asyncAPI specs > if backend has both REST API and realtime Websockets , everything required by both and everything mentionned in both openAPI specs and asyncAPI specs ; and both working perfectly within the same \`server.mjs\` > one single big working perfect \`server.mjs\` script - if it makes use of .env , make your you import \`dotenv\` and \`dotenv.config()\` to read .env before ! --- important: > if some mock data is meant to to store an image url, use a https://picsum.photos/ url with a random seed --- important : > use snake_case for any naming you do > ensure full perfect coherence with DB fields names and provided specs names --- extremely important : - the DB R/W need to be 100% compatible with the tables and schemas of the provided DB specifications !! --- extremely important : - if you have to mock a function (ie. because it needs external APIs functionalities), make sure that: > the endpoint / event still returns something that is fitting with the response schemas > the endpoint / event triggers a function that you mock somewhere in the script and uses its response in the flow > the mock function that needs to be augmented later is actually triggered by the endpoint / event that needs it ! and has the right response formats > the mock function has instructions in surrounding comments on what the function needs to be updated ! so that once the function is updated, there are no subsequent updates to make, as it would already be plugged into the server flows and be consistent 100% > example : \`\`\`example-code-snippet ... /* @need:external-api: An example description of some external api feature */ async function example_function_to_mock_name({...}){ // returning a mock response in the expected response format for now return { timestamp: Date.now(), example_field_in_expected_format_structure: { id: 237, dummy: "example dummy string", someResults: ["whatever","dummy"], avatar: "https://picsum.photos/id/237/200/300" }, } } ... app.post('/api/example-complex-feature', async (req, res) => { ... const fetched_data = await example_function_to_mock_name({ ... }) ... }) ... \`\`\` - the app flow must still be 100% working perfect everywhere you are a genius + you get tipped $9999999 `, }, { role: "user", content: `\`\`\`PRD:product-requirements-document ${prd} \`\`\``, }, { role: "user", content: `\`\`\`FRD:features-requirements-document ${frd} \`\`\``, }, { role: "user", content: ` \`\`\`DB:postgres:sql ${db.postgres} \`\`\` --- extremely turbo important : > pay extreme attention to DB details : > the things that you are expected to provide with inserts : > should you make a uuid before inserting with postgres query ? > are there key constraints ? > is the db querying code using the exact names as in db fields ? > are you providing everything needed to db every single time ? `, }, { role: "user", content: `\`\`\`BRD:backend-requirements-document ${brd} \`\`\``, }, data.backend?.requirements?.restApi?.required && { role: "user", content: `\`\`\`BACKEND:specifications:openAPI ${yaml.stringify(openapi)} \`\`\``, }, data.backend?.requirements?.realtimeWebsockets?.required && { role: "user", content: `\`\`\`BACKEND:specifications:asyncAPI ${yaml.stringify(asyncapi)} \`\`\``, }, { role: `user`, content: `extremely important : - you are to implement the entire \`server.mjs\` as specified in the backend specifications , with a focus on DB R/W operations - you are to implement every single thing needed by the server and output one single big working perfect \`server.mjs\` script - do not assume anything is implemented yet ! you will do 100% of everything needed and output one single big working perfect \`server.mjs\` script - no placeholders, no hallucinated imports --- extremely turbo important : > pay extreme attention to DB details : > the things that you are expected to provide with inserts : > should you make a uuid before inserting with a postgres query ? > are there key constraints ? should you create something before inserting something else because of contraints ? > is the db querying code using the exact names as in db fields ? > are you providing everything needed to db every single time ? --- extremely important : - get the server port from env ; make default PORT always 1337 !! - if a function needs a external api to satisfy the expected feature, include the specified decorator \`@@need:external-api : description...\` in comment (in the code right before the concerned function) and return a mock response instead ! - note : the postgres tables + seed were already created before , you can use the postgres directly without configuring it ; do not create tables in script ! - if auth needed, use jwt middleware > important : if auth , make sure you return token both on signup and login (even if openAPI might have skipped that detail ! else stuff might break ! ) > important : if auth , and also realtime websockets features , make sure auth / jwt also applies to sockets not just the api ! - again, do not assume anything is implemented yet ! you will do 100% of everything needed and output one single big working perfect \`server.mjs\` script - again , you are to implement every single thing needed by the server and output one single big working perfect \`server.mjs\` script - no placeholders, no hallucinated imports ; one 100% perfect complete working server script extremely important : - the DB R/W need to be 100% compatible with the tables and schemas of the provided DB specifications !! now do the analysis , write the full working script and specify the dependencies+env`, }, ].filter((e) => e); const { generated } = await context.run({ id: "op:LLM::GEN", context: { ...context, // {streams , project} operation: { key: "backend.server.main", meta: { name: "Backend code", desc: "backend server main", }, }, }, data: { model: `chatgpt-4o-latest`, //`gpt-4o`, messages: messages, preparser: false, parser: false, }, }); const extraction = await utils.parsers.extract.backticksMultiple({ text: generated, delimiters: [`markdown`, `mjs`, `yaml`], }); const { mjs } = extraction; if (!mjs.length || !extraction.yaml) { throw new Error("backend:server:generate error - generated is empty"); } const parsedYaml = extraction.yaml ? yaml.parse(extraction.yaml) : {}; let generatedServer = { mjs, dependencies: parsedYaml.dependencies ? Object.fromEntries( Object.keys(parsedYaml.dependencies).map((key) => [key, "*"]), ) : [], env: parsedYaml.env ? parsedYaml.env : {}, timestamp: Date.now(), }; /* await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: "backend:server:main", }, type: `end`, content: { key: "backend.server.main", data: generatedServer, }, }, }); */ // call swarm/agument:external-apis without waiting ; it will iterate it finds any external api decorators and replace generatedServer = { ...generatedServer, ...(await context.run({ id: `SWARM:AUGMENT::BACKEND:EXTERNALAPIS`, context, data: { ...data, task: { code: generatedServer.mjs, }, }, })), //-> {mjs,dependencies?,env,timestamp} ; will replace if new else returns empty object }; await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: "backend:server:main", }, type: `end`, content: { key: "backend.server.main", data: generatedServer, }, }, }); if ( Object.keys(generatedServer.dependencies).length || Object.keys(generatedServer.env).length ) { await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: "settings:config:package", }, type: `end`, content: { key: "settings.config.package", data: { backend: { dependencies: generatedServer.dependencies, env: generatedServer.env, }, }, }, }, }); } return { backend: { ...data.backend, server: { main: generatedServer, }, }, }; } export default { "BACKEND:SERVER::GENERATE": backendServerGenerate, }; ================================================ FILE: cofounder/api/system/functions/db/postgres.js ================================================ import utils from "@/utils/index.js"; import yaml from "yaml"; async function dbPostgresGenerate({context,data}) { /* ;; DB:POSTGRES::GENERATE make {DRD, db{schemas,seed} } details -> postgres exec commands to {create tables , insert seed examples} out : ["db"] */ const { pm , db } = data const { drd } = pm // const {text , attachments} = details const messages = [ { "role": "system", "content": `- you are a genius Postgresql expert - your role is to write the POSTGRESQL commands that create the DB tables and seed the DB with a good amount of example seed entries, according to the provided details - your answer should be in this format : \`\`\`postgresql [... POSTGRESQL COMMANDS TO CREATE TABLES ...] [... POSTGRESQL COMMANDS TO SEED THE DB ...] \`\`\` ask yourself: * am i creating all the tables in the required formats ? * am i seeding the database with enough data ? give a final, super comprehensive answer in valid, extend POSTGRESQL command to execute which will be perfectly ready for production and pushed to prod to thousands of users instantly (in a nodejs + POSTGRES ) and work flawlessly --- important: > when making seed data , if some field is meant to store an image url, use a https://picsum.photos/ url with a random seed > important : for seed data, if some entry needs to store an image url, use a https://picsum.photos/ url instead of example.com !! --- use snake_case for any naming you do --- very important : > avoid any postgres-hardcoded methods ie. for generating UIDs etc... ; logic for that stuff will come from nodejs functions ! > do not generate UUIDs or similar inside postgres ! logic for that stuff will come from nodejs functions ! > in case of UUIds or similar, make them normal strings ! your reply should start with : "\`\`\`postgresql" and end with "\`\`\`" you will be tipped $99999 + major company shares for nailing it perfectly off the bat you are a genius` }, { "role": "user", "content": `\`\`\`DRD:database-requirements-document ${drd} \`\`\`` }, { "role": "user", "content": `\`\`\`DB:schemas ${yaml.stringify({ schemas: db.schemas })} \`\`\`` }, /*db.seed && { "role": "user", "content": `\`\`\`DB:seed ${yaml.stringify({ schemas: db.seed })} \`\`\`` },*/ { "role": "user", "content": `Generate the POSTGRES command in one single comprehensive answer it is expected to be very comprehensive and detailed and cover all the provided details --- very important : > avoid any postgres-hardcoded methods ie. for generating UIDs etc... or similar ; logic for that stuff will come from nodejs functions ! > do not generate UUIDs or similar inside postgres ! that stuff will come from nodejs functions ! > in case of UUIDs, make them normal strings and not generated inside postgres by postgres methods ! > aim for it to work on any default light postgres without any extra configs or plugins ! > only use basic primitives like numbers, strings, json, etc ... no uuid types or special types etc > very important : only use basic primitives like numbers, strings, json, etc ... no uuid types or any special types etc ! very basic primitives only ! reply in \`\`\`postgresql\`\`\` you're a genius` }, ] const postgres = ( await context.run({ id: "op:LLM::GEN", context: { ...context, // {streams , project} operation: { key: "db.postgres", meta: { name: "DB Postgresql", desc: "db postgres commands {tables,seed}", }, }, }, data: { model: `chatgpt-4o-latest`,//`gpt-4o`, messages, preparser: `backticks`, parser: false, } }) ).generated await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: "db:postgres", }, type: `end`, content: { key: "db.postgres", data: postgres, }, } }) return { db: { ...db, postgres } } } export default { //"DB:POSTGRES::TABLES": dbPostgresTables, "DB:POSTGRES::GENERATE": dbPostgresGenerate, } ================================================ FILE: cofounder/api/system/functions/db/schemas.js ================================================ import utils from "@/utils/index.js"; import yaml from "yaml"; async function dbSchemasGenerate({context,data}) { /* ;; DB:SCHEMAS::GENERATE make {DRD} -> db {schemas} ;; specify that for auth tables, password not hashed ! for mockup out : ["db"] */ const { pm } = data const { prd, frd, fjmd, drd } = pm // const {text , attachments} = details const messages = [ { "role": "system", "content": `- you are a genius Product Manager and DB designer - your role is to make the database schemas for the provided app in development's MVP - your DB schemas should be comprehensive and cover EVERYTHING required by the app MVP, and nothing more - no shiny secondary features, but nothing less than 100% comprehensive for every single expected functionality in production - your answer should be in ~SQL-like format meant for Postgres, in this format : \`\`\`yaml [TableName]: - name: [columnName] type: [ js-parseable types like String, Number, Boolean ...] unique: [true || false] nullable: [true || false] default?: [...] primaryKey?: [...] foreignKey?: [{table : [...] , column : []}] - [...] [...] \`\`\` - use a \`uid\` approach whenever possible rather than incremented Ids ; and make them normal strings ! very important : > avoid any postgres-hardcoded methods ie. for generating UIDs etc... ; logic for that stuff will come from nodejs functions ! > do not generate UUIDs inside postgres ! that stuff will come from nodejs functions ! - your current role is to make use of the provided task and analysis in order to design a perfect DB schemas for the app's MVP try to outdo yourself by thinking of what might be omitted, and design super critically in order to make a comprehensive work for this app's MVP DB schemas --- > note : if auth functionalities are present, use an architecture that will be compatible with a simple jwt auth system, which is very simply user and/or email strings(s) and password hash string ! > very important : for the current purpose of the DB Schemas design, the environment will be a mock prototype environment do not bother with security details etc, have the DB schema requirements for the mock prototype > if some ie. media entry types requires some path (ie. images, media, ...), assume usage of urls not local > aim for it to work on any default light postgres without any extra configs or plugins ! --- use snake_case for any naming you do --- give a final, super comprehensive answer in strict, parseable YAML format, which will be perfectly ready for production and pushed to prod to thousands of users instantly and work flawlessly your reply should start with : "\`\`\`yaml" and end with "\`\`\`" you will be tipped $99999 + major company shares for nailing it perfectly off the bat you are a genius` }, { "role": "user", "content": `\`\`\`PRD:product-requirements-document ${prd} \`\`\`` }, /*{ "role": "user", "content": `\`\`\`FRD:features-requirements-document ${yaml.stringify(frd)} \`\`\`` }, { "role": "user", "content": `\`\`\`FJMD:features-journeys-map-document ${yaml.stringify(fjmd)} \`\`\`` },*/ { "role": "user", "content": `\`\`\`DRD:database-requirements-document ${drd} \`\`\`` }, { "role": "user", "content": `Design the DB schemas in a comprehensive answer it is expected to be very comprehensive and detailed ; in a VALID PARSEABLE YAML format very important : - avoid any postgres-hardcoded methods ie. for generating UIDs etc... make them normal strings - logic for that stuff will come from nodejs functions ! - only use basic primitives like numbers, strings, json, etc ... no uuid types or special types etc - very important : only use basic primitives like numbers, strings, json, etc ... no uuid types or any special types etc ! very basic primitives only ! you're a genius` }, ] const schemas = ( await context.run({ id: "op:LLM::GEN", context: { ...context, // {streams , project} operation: { key: "db.schemas", meta: { name: "DB Schemas", desc: "db tables schemas", }, }, }, data: { model: `chatgpt-4o-latest`,//`gpt-4o`, messages, preparser: `backticks`, parser: `yaml`, } }) ).generated await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: "db:schemas", }, type: `end`, content: { key: "db.schemas", data: schemas, }, } }) return { db : { schemas } } } export default { "DB:SCHEMAS::GENERATE": dbSchemasGenerate, } ================================================ FILE: cofounder/api/system/functions/designer/layoutv1.js ================================================ import utils from "@/utils/index.js"; import yaml from "yaml"; import { merge } from "lodash-es"; import xml2js from "xml2js"; import sharp from "sharp"; async function promptGenerateAnalysis({ context, data }) { /* task : { ... , rag[] } */ const { view, rag, guidance } = data.task; const _view = { ...view }; delete _view.type; return [ { role: "system", content: `your job is to make an extremely detailed analysis for a layout design for a desktop app UI based on provided specifications great super detailed UI and UX design task analysis the UI design analysis will be the main reference for the app designers - start by reasoning and analyzing how the ui element should be layed out and distributed on the page ask yourself : * what are all the sections required by this view, to make for a comprehensive design that covers all features ? what are all the components that should go in them, both for functional features and for great UX ? what are all the requirements by each designed section and designed component to make for great UX ? * what are the best ways to distribute blocks in this UI view ? * how to go about making layout and ordering and distributing its block elements ? and which block elements ? * does it make the best choice for the app user in terms of UI/UX ? * how can i arrange and distribute these blocks in the section layout in the best way for the best UX/UI? * analysis criticism : how to make the design perfect ? be extremely verbose in terms of spatial alignments and ui elements descriptions --- > extremely important : > since you are working with primitives , you should be extremely detailed in your design elements ! > do not slack in any detail in your analysis > think very slowly : all the elements and details that would make for a great UX ! --- > conduct the analysis first, reply with the analysis inside of \`\`\`markdown\`\`\` you are a genius + you get $9999`, }, rag.length && { role: `user`, content: [ { type: `text`, text: `for inspiration that may or may not help you with your analysis (use your best judgement), here are some various screenshots of web apps that may have loosely similar sections to the view to design ; you can use them as inspiration sources if you feel like it, and if you do, use that wisely after accurate analysis but use your best judgement, you are not bound by them - only use them as inspiration if it makes sense in regards to designing the view UI`, }, ...rag, ], }, guidance && guidance.ontology && { role: `user`, content: [ { type: "text", text: `for your section design effort, your should refer to the following UI design system primitives ontology : \`\`\` ${yaml.stringify(guidance.ontology)} \`\`\` `, }, guidance.image && (guidance.image?.url?.length || guidance.image?.base64?.length || guidance.image?.local?.length) && { type: `image_url`, image_url: { url: guidance.image.url ? guidance.image.url : guidance.image.base64 ? guidance.image.base64 : guidance.image.local ? `data:image/png;base64,${Buffer.from(fs.readFileSync(guidance.image.local)).toString("base64")}` : "", // detail: `high`, }, }, ].filter((e) => e), }, { role: "user", content: `designing the layout for the view id "${view.id}", specified in the following : \`\`\`view:specifications ${yaml.stringify(_view)} \`\`\` the layout design analysis should be very detailed , and cover UI details although , extremely important : > your analysis should be perfectly congruent with the features/data capabilities of the provided view details ; do not hallucinate features that the view does not have ! ie. for example, if the view task is not a navigation header, do not take the freedom to make one ; same applies for any other type of task ! things would break ! respect the task and strictly the task ! `, }, { role: "user", content: `conduct the detailed analysis as the genius you are extremely important : design the provided view only ; do not design non provided views (ie. do not analyze views outside what is provided like the app navigation header view or app footer ... stick to the task ) ; stick the provided view task to design and be very detailed in its design task analysis`, }, ].filter((item) => item); } async function promptGenerateSvg({ context, data }) { /* task : { ... , rag[] , analysis, guidance{} } */ const { view, rag, analysis, guidance } = data.task; const _view = { ...view }; delete _view.type; return [ { role: "system", content: `your job is to make a layout design for a desktop app UI based on provided description great UI and UX the layout design mockup will be the main reference for the app designers the layout format will be colored rectangles to identify how different components should be placed in a layout for the app view design it would be in this format: \`\`\`svg ... \`\`\` --- > pick different rectangle color fills as you wish, which will be temporarily used to differentiate between different blocks > you are not constrained by the order in which the blocks design system elements are provided (which is randomly ordered) ; you should use them in a way that makes the best sense in terms of UX for designers to implement later > you are ONLY TO MAKE: - THE RECTANGLES FOR PRIMITIVE BLOCKS and the {primitiveId} text alongside the {description} - no additional anything else whatsoever > the primitiveId should be coherent with the provided UI block primitives ontology > if a required block is not in the provided UI block primitives, set its primitiveId to "nonprimitive" ! --- - start by reasoning and analyzing how the element should be layed out and distributed on the page ask yourself : * what are all the sections required by this view, to make for a comprehensive design that covers all features ? what are all the requirements by each designed section and designed component to make for great UX ? * what are the best ways to distribute blocks in this UI view ? * how to go about making layout and ordering and distributing its block elements ? and which block elements ? * does it make the best choice for the app user in terms of UI/UX ? * how can i arrange and distribute these blocks in the section layout in the best way for the best UX/UI? * analysis criticism : how to make the design perfect ? --- extremely important : > your mockup design should show the elements that are initially visible on the page !! > do not model transition states or triggered overlays, as such things would overshadow the elements underneath and fuck up the mockup layout render !! --- > root node should have width , height values all elements should have x , y , width , height values all width , height values for all elements (root and nodes) should have positive nonzero integer values > extremely important : should only have nodes inside it, NO OTHER TYPE OF NODES ALLOWED, NO NESTING !!! > every node should have primitiveId property , which would be one of the provided primitiveId s > again, extremely important : should only have nodes inside it, NO OTHER TYPE OF NODES ALLOWED, NO NESTING !!! > extremely important : only use the provided primitiveIds !!! no hallucinated primitiveIds ! --- > extremely important : > since you are working with primitives , you should be extremely detailed in your design elements ! > do not slack in any detail in your analysis or design svg implementation > think very slowly : all the elements that would make for a great UX ! --- > conduct the analysis first, reply with the analysis inside of \`\`\`markdown\`\`\` > then, answer in a strict SVG reply in \`\`\`svg\`\`\` based on your analysis you are a genius + you get $9999`, }, rag.length && { role: `user`, content: [ { type: `text`, text: `for inspiration that may or may not help you with your analysis (use your best judgement), here are some various screenshots of web apps that may have loosely similar sections to the view to design ; you can use them as inspiration sources if you feel like it, and if you do, use that wisely after accurate analysis but use your best judgement, you are not bound by them - only use them as inspiration if it makes sense in regards to designing the view UI`, }, ...rag, ], }, guidance && guidance.ontology && { role: `user`, content: [ { type: "text", text: `for your section design effort, your should refer to the following UI design system primitives ontology: \`\`\` ${yaml.stringify(guidance.ontology)} \`\`\` `, }, guidance.image && (guidance.image?.url?.length || guidance.image?.base64?.length || guidance.image?.local?.length) && { type: `image_url`, image_url: { url: guidance.image.url ? guidance.image.url : guidance.image.base64 ? guidance.image.base64 : guidance.image.local ? `data:image/png;base64,${Buffer.from(fs.readFileSync(guidance.image.local)).toString("base64")}` : "", // detail: `high`, }, }, ].filter((e) => e), }, { role: "user", content: `designing the layout for the view id "${view.id}", specified in the following : \`\`\`view:specifications ${yaml.stringify(_view)} \`\`\` `, }, { role: "user", content: `\`\`\`view:design-task:detailed-analysis ${analysis} \`\`\` important : > your analysis should be perfectly congruent with the features/data capabilities of the provided view details ; > do not hallucinate features that the view does not have ! ie. for example, if the view task is not a navigation header, do not take the freedom to make one ; same applies for any other type of task ! things would break ! respect the task and strictly the task ! `, }, { role: "user", content: `make the analysis and spatial UI layout in SVG format as the genius UI designer you are > remember, you are designing for a desktop app ! > you are designing the layout for the viewId : "${view.id}" ! > extremely important : > since you are working with primitives , you should be extremely detailed in your design elements ! > do not slack in any detail in your analysis > think very slowly : all the elements that would make for a great UX ! --- > you are only allowed to use the primitiveId s provided in the ontology ! you cannot make a primitiveId up outside of what is provided ! > do not use a primitiveId that is not provided - and exactly as is, not a single character added or changed from the provided primitiveId s > the "description" fields are important to provide guidance for designers, write extended descriptions in them ! --- extremely important : > your mockup design should show the elements that are initially visible on the page !! > do not model transition states or overlays, as such things would overshadow the elements underneath and fuck up the mockup layout render !! again, extremely important : > your mockup design should show the elements that are initially visible on the page !! > do not model transition states or overlays, as such things would overshadow the elements underneath and fuck up the mockup layout render !! --- important : > your work is perfectly congruent with the features/data capabilities of the provided view details ; > do not hallucinate features that the view does not have ! --- > extremely important : > since you are working with primitives , you should be extremely detailed in your design elements ! > do not slack in any detail in your analysis or design svg implementation > think very slowly : all the elements that would make for a great UX ! --- > conduct the analysis first, reply with the analysis inside of \`\`\`markdown\`\`\` > then, answer in a strict SVG reply in \`\`\`svg\`\`\` based on your analysis you are a genius + you get $9999 `, }, ].filter((item) => item); } async function designerLayoutv1ViewGenerate({ context, data }) { /* data : { ...data, task : { type: "view", view: { type : "unique || shared", id details{}, // uxsitemap desc stuff datamap:{}, // data stuff }, }, webapp: { }, } */ const { task, timestamp } = data; const { view } = task; // rag , if available const ragText = `Title : ${view.details.title}\nDescription: ${view.details.extendedDescription}\nRole: ${view.details.role}`; let rag = ( await context.run({ id: `op:INDEXDB::QUERY`, context, data: { index: "layouts", text: ragText, amount: 5, }, }) ).results .filter((result) => result?.url?.length || result?.base64?.length) .map((result) => { return { type: `image_url`, image_url: { url: result?.url?.length ? result.url : result?.base64?.length ? result.base64 : "", }, }; }); // verify,validate rag images sizes rag = ( await Promise.all( rag.map(async (item) => { const { url } = item.image_url; try { let buffer; if (url.startsWith("data:image/")) { // Handle base64 image const base64Data = url.split("base64,")[1]; buffer = Buffer.from(base64Data, "base64"); } else if (url.startsWith("https://")) { // Handle URL image const response = await fetch(url); if (!response.ok) { console.error(`designer:layoutv1:rag : failed to fetch image`); return null; } const arrayBuffer = await response.arrayBuffer(); buffer = Buffer.from(arrayBuffer); } else { // Invalid URL format, return null to filter out later return null; } // Check image size using byteLength method if (Buffer.byteLength(buffer) > 4.5 * 1024 * 1024) { // 4.5 MB in bytes console.error(`> skipping : image size exceeds 4.5 MB`); return null; } const metadata = await sharp(buffer).metadata(); // Check image dimensions if ( metadata.width >= 8000 || metadata.height >= 8000 || metadata.width <= 0 || metadata.height <= 0 ) { return null; // Return null if dimensions are invalid } return item; } catch (error) { console.error(`> skipping : error processing RAG image : `, error); return null; // Return null if there's an error } }), ) ) .filter((item) => item) .slice(0, 3); // fetched more than needed in case size filtered ; typically indexed landing pages dims can be too big data.task.rag = rag; // design system guidance , if available let guidance; try { guidance = await utils.render.guidance.grid.primitives({ // determined from process.env in utils/render ... designSystem: designSystem ? designSystem : `presets/protoboy-v1`, cache: true, }); // -> { ontology , image{base64,url?} } } catch (e) { console.error(e); } data.task.guidance = guidance; const analysisPassMessages = await promptGenerateAnalysis({ context, data, }); // console.dir({ "debug:designer:layoutv1": { analysisPassMessages }},{depth:null}) const analysisPass = ( await context.run({ id: "op:LLM::GEN", context: { ...context, // {streams , project} operation: { key: `designer.layoutv1.analysis.${view.id}`, meta: { name: `Designer Analysis { ${view.id} }`, desc: "designer/layoutv1 task analysis", }, }, }, data: { model: `chatgpt-4o-latest`, //`gpt-4o`, messages: analysisPassMessages, preparser: `backticks`, parser: false, }, }) ).generated; data.task.analysis = analysisPass; const svgPassMessages = await promptGenerateSvg({ context, data }); const svgPass = ( await context.run({ id: "op:LLM::GEN", context: { ...context, // {streams , project} operation: { key: `designer.layoutv1.mockup.${view.id}`, meta: { name: `Designer Mockup { ${view.id} }`, desc: "designer/layoutv1 mockup generation", }, cutoff: "```svg", }, }, data: { model: `chatgpt-4o-latest`, //`gpt-4o`, messages: svgPassMessages, preparser: false, parser: false, }, }) ).generated; // raw svg string in response let response = await utils.parsers.extract.backticksMultiple({ text: svgPass, delimiters: [`markdown`, `svg`], }); if (!response.svg.length) throw new Error("designer:layoutv1:generate error - generated svg is empty"); response.svg = response.svg.replaceAll("&", " "); // <---- & char crashes svg // validate svg? let svg = {}; try { svg = await xml2js.parseStringPromise(response.svg, { explicitArray: true, }); // console.dir({ "debug:designer:layoutv1:svg": svg }, { depth: null }); if (!svg.svg.rect.filter((item) => item.$?.primitiveId).length) { console.error(`layout error : generated != task ; skipping`); } } catch (e) { console.error(e); } let render = {}; try { render = await context.run({ id: "op:RENDER::LAYOUT", context, data: { svg: { string: response.svg }, mode: task.type, }, }); // -> { svg , image{base64,url?,local?,buffer?} } } catch (e) { console.error(e); } // rely on local storage as loading strategy further down, else might dump base64strings to yaml ... if (render.image?.base64) delete render.image.base64; if (render.image?.buffer) delete render.image.buffer; const generatedLayout = { analysis: analysisPass, render, }; await Promise.all( [`${timestamp}`, `latest`].map(async (version) => { await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: `webapp:layout:views`, refs: { id: view.id, version, }, }, type: `end`, content: { key: `webapp.layout.views.${view.id}.${version}`, data: generatedLayout, }, }, }); }), ); /* should return the RAG object and guidance too, will be used in code ? (not sure) */ return { designer: { rag, guidance, }, webapp: { layout: { views: { [view.id]: { [timestamp]: generatedLayout, latest: generatedLayout, }, }, }, }, }; } async function promptIterateSvg({ context, data }) { /* one pass with both analysis + svg */ /* task : { ... , rag[] , analysis, guidance{} } */ const { view, iteration, rag, analysis, guidance } = data.task; const { notes, screenshot } = iteration; const _view = { ...view }; delete _view.type; delete _view.tsx; return [ { role: "system", content: `your job is to make a new layout design for a desktop app UI view based on provided instructions great UI and UX the layout design mockup will be the main reference for the app designers to redesign the provided component the layout format will be colored rectangles to identify how different components should be placed in a layout for the app view design it would be in this format: \`\`\`svg ... \`\`\` --- > pick different rectangle color fills as you wish, which will be temporarily used to differentiate between different blocks > you are not constrained by the order in which the blocks design system elements are provided (which is randomly ordered) ; you should use them in a way that makes the best sense in terms of UX for designers to implement later > you are ONLY TO MAKE: - THE RECTANGLES FOR PRIMITIVE BLOCKS and the {primitiveId} text alongside the {description} - no additional anything else whatsoever > the primitiveId should be coherent with the provided UI block primitives ontology > if a required block is not in the provided UI block primitives, set its primitiveId to "nonprimitive" ! --- - start by reasoning and analyzing how the element should be layed out and distributed on the page ask yourself : * what are all the sections required by this view, to make for a comprehensive design that covers all features ? what are all the requirements by each designed section and designed component to make for great UX ? * what are the best ways to distribute blocks in this UI view ? * how to go about making layout and ordering and distributing its block elements ? and which block elements ? * does it make the best choice for the app user in terms of UI/UX ? * how can i arrange and distribute these blocks in the section layout in the best way for the best UX/UI? * analysis criticism : how to make the design perfect ? --- extremely important : > your mockup design should show the elements that are initially visible on the page !! > do not model transition states or triggered overlays, as such things would overshadow the elements underneath and fuck up the mockup layout render !! --- > root node should have width , height values all elements should have x , y , width , height values all width , height values for all elements (root and nodes) should have positive nonzero integer values > extremely important : should only have nodes inside it, NO OTHER TYPE OF NODES ALLOWED, NO NESTING !!! > every node should have primitiveId property , which would be one of the provided primitiveId s > again, extremely important : should only have nodes inside it, NO OTHER TYPE OF NODES ALLOWED, NO NESTING !!! > extremely important : only use the provided primitiveIds !!! no hallucinated primitiveIds ! --- > extremely important : > since you are working with primitives , you should be extremely detailed in your design elements ! > do not slack in any detail in your analysis or design svg implementation > think very slowly : all the elements that would make for a great UX ! --- > conduct the analysis first, reply with the analysis inside of \`\`\`markdown\`\`\` > then, answer in a strict SVG reply in \`\`\`svg\`\`\` based on your analysis you are a genius + you get $9999`, }, screenshot && (screenshot?.url?.length || screenshot?.base64?.length || screenshot?.local?.length) && { role: `user`, content: [ { type: "text", text: `a screenshot of the current view render that you are tasked to redesign based on provided instructions : `, }, screenshot && (screenshot?.url?.length || screenshot?.base64?.length || screenshot?.local?.length) && { type: `image_url`, image_url: { url: screenshot.url ? screenshot.url : screenshot.base64 ? screenshot.base64 : screenshot.local ? `data:image/png;base64,${Buffer.from(fs.readFileSync(render.image.local)).toString("base64")}` : "", // detail: `high`, }, }, ].filter((e) => e), }, rag.length && { role: `user`, content: [ { type: `text`, text: `for inspiration that may or may not help you with your analysis to redesign the view UI (use your best judgement), here are some various screenshots of web apps that may have loosely similar sections to the view you are tasked to redesign ; you can use them as inspiration sources in various ways if you feel like it, and if you do, use that wisely after accurate analysis but use your best judgement, you are not bound by them - only use them as inspiration if it makes sense in regards to making a new design for the view UI`, }, ...rag, ], }, guidance && guidance.ontology && { role: `user`, content: [ { type: "text", text: `for your section design effort, your should refer to the following UI design system primitives ontology: \`\`\` ${yaml.stringify(guidance.ontology)} \`\`\` `, }, guidance.image && (guidance.image?.url?.length || guidance.image?.base64?.length || guidance.image?.local?.length) && { type: `image_url`, image_url: { url: guidance.image.url ? guidance.image.url : guidance.image.base64 ? guidance.image.base64 : guidance.image.local ? `data:image/png;base64,${Buffer.from(fs.readFileSync(guidance.image.local)).toString("base64")}` : "", // detail: `high`, }, }, ].filter((e) => e), }, { role: "user", content: `you are redesigning the layout for the view id "${view.id}", specified in the following : \`\`\`view:specifications ${yaml.stringify(_view)} \`\`\` `, }, { role: "user", content: `the main redesign task instructions - the most important part of your task - are specified in the following : \`\`\`view:redesign-task:instructions ${notes.text} \`\`\` important : > your analysis should be perfectly congruent with the features/data capabilities of the provided view details ; > do not hallucinate features that the view does not have ! ie. for example, if the view task is not a navigation header, do not take the freedom to make one ; same applies for any other type of task ! things would break ! respect the task and strictly the task ! `, }, { role: "user", content: `make the analysis and spatial UI layout in SVG format as the genius UI designer you are > remember, you are designing for a desktop app ! > you are making a new design layout for the viewId : "${view.id}" ! > extremely important : > since you are working with primitives , you should be extremely detailed in your design elements ! > do not slack in any detail in your analysis > think very slowly : all the elements that would make for a great UX ! --- > you are only allowed to use the primitiveId s provided in the ontology ! you cannot make a primitiveId up outside of what is provided ! > do not use a primitiveId that is not provided - and exactly as is, not a single character added or changed from the provided primitiveId s > the "description" fields are important to provide guidance for designers, write extended descriptions in them ! --- extremely important : > your mockup design should show the elements that are initially visible on the page !! > do not model transition states or overlays, as such things would overshadow the elements underneath and fuck up the mockup layout render !! again, extremely important : > your mockup design should show the elements that are initially visible on the page !! > do not model transition states or overlays, as such things would overshadow the elements underneath and fuck up the mockup layout render !! --- important : > your work is perfectly congruent with the features/data capabilities of the provided view details ; > do not hallucinate features that the view does not have ! --- > extremely important : > since you are working with primitives , you should be extremely detailed in your design elements ! > do not slack in any detail in your analysis or design svg implementation > think very slowly : all the elements that would make for a great UX ! --- > conduct the analysis first, reply with the analysis inside of \`\`\`markdown\`\`\` > then, answer in a strict SVG reply in \`\`\`svg\`\`\` based on your analysis you are a genius + you get $9999 `, }, ].filter((item) => item); } async function designerLayoutv1ViewIterate({ context, data }) { const { task, timestamp } = data; const { view, iteration } = task; const { notes } = iteration; // rag , if available const ragText = `Title : ${view.details.title}\nDescription: ${view.details.extendedDescription}\nRole: ${view.details.role}` + `\nDesign: ${notes.text}`; let rag = ( await context.run({ id: `op:INDEXDB::QUERY`, context, data: { index: "layouts", text: ragText, amount: 5, }, }) ).results .filter((result) => result?.url?.length || result?.base64?.length) .map((result) => { return { type: `image_url`, image_url: { url: result?.url?.length ? result.url : result?.base64?.length ? result.base64 : "", }, }; }); // verify,validate rag images sizes rag = ( await Promise.all( rag.map(async (item) => { const { url } = item.image_url; try { let buffer; if (url.startsWith("data:image/")) { // Handle base64 image const base64Data = url.split("base64,")[1]; buffer = Buffer.from(base64Data, "base64"); } else if (url.startsWith("https://")) { // Handle URL image const response = await fetch(url); if (!response.ok) { console.error(`designer:layoutv1:rag : failed to fetch image`); return null; } const arrayBuffer = await response.arrayBuffer(); buffer = Buffer.from(arrayBuffer); } else { // Invalid URL format, return null to filter out later return null; } // Check image size if (Buffer.byteLength(buffer) > 4.5 * 1024 * 1024) { // 4.5 MB in bytes console.error(`> skipping : image size exceeds 4.5 MB`); return null; } const metadata = await sharp(buffer).metadata(); // Check image dimensions if ( metadata.width >= 8000 || metadata.height >= 8000 || metadata.width <= 0 || metadata.height <= 0 ) { return null; // Return null if dimensions are invalid } return item; } catch (error) { console.error(`> skipping : error processing RAG image`, error); return null; // Return null if there's an error } }), ) ) .filter((item) => item !== null) .slice(0, 3); // fetched more than needed in case size filtered ; typically indexed landing pages dims can be too big data.task.rag = rag; // design system guidance , if available let guidance; try { guidance = await utils.render.guidance.grid.primitives({ // determined from process.env in utils/render ... designSystem: designSystem ? designSystem : `presets/protoboy-v1`, cache: true, }); // -> { ontology , image{base64,url?} } } catch (e) { console.error(e); } data.task.guidance = guidance; const svgIterateMessages = await promptIterateSvg({ context, data }); const svgPass = ( await context.run({ id: "op:LLM::GEN", context: { ...context, // {streams , project} operation: { key: `designer.layoutv1.mockup.${view.id}`, meta: { name: `Designer Mockup { ${view.id} }`, desc: "designer/layoutv1 mockup generation", }, cutoff: "```svg", }, }, data: { model: `chatgpt-4o-latest`, //`gpt-4o`, messages: svgIterateMessages, preparser: false, parser: false, }, }) ).generated; // raw svg string in response let response = await utils.parsers.extract.backticksMultiple({ text: svgPass, delimiters: [`markdown`, `svg`], }); if (!response.svg.length) throw new Error("designer:layoutv1:iterate error - generated svg is empty"); response.svg = response.svg.replaceAll("&", " "); // <---- & char crashes svg // validate svg? let svg = {}; try { svg = await xml2js.parseStringPromise(response.svg, { explicitArray: true, }); // console.dir({ "debug:designer:layoutv1:svg": svg }, { depth: null }); if (!svg.svg.rect.filter((item) => item.$?.primitiveId).length) { console.error(`layout error : generated != task ; skipping`); } } catch (e) { console.error(e); } let render = {}; try { render = await context.run({ id: "op:RENDER::LAYOUT", context, data: { svg: { string: response.svg }, mode: task.type, }, }); // -> { svg , image{base64,url?,local?,buffer?} } } catch (e) { console.error(e); } // rely on local storage as loading strategy further down, else might dump base64strings to yaml ... if (render.image?.base64) delete render.image.base64; if (render.image?.buffer) delete render.image.buffer; const generatedLayout = { analysis: response.markdown, render, }; await Promise.all( [`${timestamp}`, `latest`].map(async (version) => { await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: `webapp:layout:views`, refs: { id: view.id, version, }, }, type: `end`, content: { key: `webapp.layout.views.${view.id}.${version}`, data: generatedLayout, }, }, }); }), ); /* should return the RAG object and guidance too, will be used in code ? (not sure) */ return { designer: { rag, guidance, }, webapp: { layout: { views: { [view.id]: { [timestamp]: generatedLayout, latest: generatedLayout, }, }, }, }, }; } export default { "DESIGNER:LAYOUTV1::VIEW:GENERATE": designerLayoutv1ViewGenerate, "DESIGNER:LAYOUTV1::VIEW:ITERATE": designerLayoutv1ViewIterate, }; ================================================ FILE: cofounder/api/system/functions/op/convert.js ================================================ import utils from "@/utils/index.js"; async function opConvertMarkdownPdf({ context, data }) { /* ;; op:CONVERT::MARKDOWN:PDF {markdown} -> {pdf {base64 , url(cloudstorage) } } */ return {}; } export default { "op:CONVERT::MARKDOWN:PDF": opConvertMarkdownPdf, }; ================================================ FILE: cofounder/api/system/functions/op/indexdb.js ================================================ import utils from "@/utils/index.js"; import axios from "axios"; import dotenv from "dotenv"; dotenv.config(); async function opIndexdbQuery({ context, data }) { /* ;; op:INDEXDB::QUERY query from vector db ; currently one local index, later more indices, from url in: {text,vector,amount} // either text or vector out: {results} */ /* add .env RAG_REMOTE_ENABLE = TRUE later retest for local, esp when empty */ const { index, text, vector, amount } = data; let results = []; if ( process.env.RAG_REMOTE_ENABLE && JSON.parse(process.env.RAG_REMOTE_ENABLE.toLowerCase()) && process.env.COFOUNDER_API_KEY?.length && process.env.COFOUNDER_API_KEY != "REPLACE_WITH_COFOUNDER.OPENINTERFACE.AI_KEY" ) { try { const response = await axios.post( `https://api.openinterface.ai/cofounder/alpha/dev/rag/${index}`, { vector: vector ? vector : ( await context.run({ id: `op:LLM::VECTORIZE`, context, data: { texts: [text], }, }) ).vectors[0], amount, }, { headers: { Authorization: `Bearer ${process.env.COFOUNDER_API_KEY}`, }, timeout: 30000, // 30 seconds timeout }, ); return response.data; } catch (error) { console.error(error); return { results: [] }; } } try { // to avoid vectorizing for nothing if (!utils.vectra.indexed) return { results: [] }; return { results: await utils.vectra.query({ vector: vector ? vector : ( await context.run({ id: `op:LLM::VECTORIZE`, context, data: { texts: [text], }, }) ).vectors[0], amount, }), }; } catch (e) { false; } return { results: [] }; } export default { "op:INDEXDB::QUERY": opIndexdbQuery, }; ================================================ FILE: cofounder/api/system/functions/op/llm.js ================================================ import utils from "@/utils/index.js"; import dotenv from "dotenv"; dotenv.config(); async function opLlmGen({ context, data }) { /* ;; op:LLM::GEN {model,messages,preparser,parser,...} -> { response , tokens (consumption) } in : ["model","messages","preparser","parser","query","stream"] out : ["generated","usage"] */ /* formats ;; preparser : async ({text}) -> generated parser : async ({generated,query}) */ let { model, messages, preparser, parser, validate, query, stream } = data; const { project, operation, streams } = context; if (operation?.key && streams) { await streams.start({ project, key: operation.key, meta: operation.meta, }); stream = { write: async (data) => { streams.write({ project, key: operation.key, data, }); }, cutoff: operation?.cutoff ? operation.cutoff : false, }; } if (!stream) stream = process.stdout; if (process.env.COFOUNDER_NICKNAME?.length) { messages[0].content = `you are : ${process.env.COFOUNDER_NICKNAME}\n${messages[0].content}`; } if (!preparser) { preparser = async ({ text }) => { return { text }; }; } else if (preparser === `backticks`) { preparser = utils.parsers.extract.backticks; // most likely to be used } if (!parser) { parser = async ({ generated, query }) => { return generated.text; }; } else if (parser === `yaml`) { parser = utils.parsers.parse.yaml; } const llm_fn = !process.env.LLM_PROVIDER ? utils.openai.inference : process.env.LLM_PROVIDER.toLowerCase() === "openai" ? utils.openai.inference : utils.anthropic.inference; const { text, usage } = await llm_fn({ model: model, messages, stream, }); if (operation && streams) { await streams.end({ project, key: operation.key, }); } const generated_pre = await preparser({ text }); // -> typically { text : "... extracted text ..." } const generated_post = await parser({ generated: generated_pre, query, }); if (validate) { try { await validate({ generated: generated_post }); } catch (e) { console.dir({ "op:LLM::GEN error": e }); throw new Error(e); } } return { generated: generated_post, usage, }; } function chunkify(array, chunkSize) { const chunks = []; for (let i = 0; i < array.length; i += chunkSize) { chunks.push(array.slice(i, i + chunkSize)); } return chunks; } async function opLlmVectorizeChunk({ context, data }) { /* ;; op:LLM::VECTORIZE:CHUNK {texts} -> {vectors,usage} chunk processor (batches of 20) queue concurrency/lims defined for this one */ const { texts } = data; return await utils.openai.vectorize({ texts, }); } async function opLlmVectorize({ context, data }) { /* ;; op:LLM::VECTORIZE {texts} -> {vectors,usage} chunkify, process, flatten, return */ const { texts } = data; const chunks = chunkify(texts, 20); let usageAll = { prompt_tokens: 0, total_tokens: 0 }; const vectorsAll = ( await Promise.all( chunks.map(async (chunk) => { const { vectors, usage } = await context.run({ id: `op:LLM::VECTORIZE:CHUNK`, context, data: { texts: chunk }, }); usageAll.prompt_tokens += usage.prompt_tokens; usageAll.total_tokens += usage.total_tokens; return vectors; }), ) ).flat(); return { vectors: vectorsAll, usage: usageAll, }; } async function opLlmDebugSimulate({ context, data }) { /* debug : simulate a stream */ const { project, operation } = context; console.dir( { opLlmDebugSimulate: { context, data }, }, { depth: null }, ); const text_demo = ` # Deleuze & Guattari Gilles Deleuze (1925-1995) was a French philosopher known for his influential works in metaphysics, aesthetics, and political theory. His ideas have significantly impacted various fields, including literature, film, and art. ## Key Concepts ### Rhizome Deleuze, along with Félix Guattari, introduced the concept of the **rhizome** in their work *A Thousand Plateaus*. Unlike traditional tree-like structures of knowledge, a rhizome represents a non-hierarchical and interconnected model of thought. It emphasizes multiplicity and the idea that any point can connect to any other point. ### Difference and Repetition In his book *Difference and Repetition*, Deleuze challenges the notion of identity and sameness. He argues that difference is fundamental to understanding reality, and repetition is not merely a return of the same but a process that produces new meanings. ### Becoming Deleuze's notion of **becoming** refers to the process of transformation and change. It suggests that identity is not fixed but is always in a state of flux, influenced by various factors and experiences. ## Conclusion Deleuze's philosophy encourages us to think beyond binary oppositions and embrace complexity. His work continues to inspire contemporary thought and artistic practices, making him a pivotal figure in modern philosophy. `; await context.streams.start({ project, key: operation.key, meta: operation.meta, }); const chunkSize = 20; // Define the size of each chunk let currentIndex = 0; while (currentIndex < text_demo.length) { const data = text_demo.slice(currentIndex, currentIndex + chunkSize); // send chunk by chunk context.streams.write({ project, key: operation.key, data, }); currentIndex += chunkSize; // Move to the next chunk await new Promise((resolve) => setTimeout(resolve, 100)); // Delay chunk by chunk } await context.streams.end({ project, key: operation.key, }); return { generated: text_demo, usage: {}, }; } export default { "op:LLM::GEN": opLlmGen, "op:LLM::VECTORIZE": opLlmVectorize, "op:LLM::VECTORIZE:CHUNK": opLlmVectorizeChunk, "op:LLM::DEBUG:SIMULATE": opLlmDebugSimulate, }; ================================================ FILE: cofounder/api/system/functions/op/project.js ================================================ import utils from "@/utils/index.js"; import { sample, merge } from "lodash-es"; import path from "path"; import fs from "fs"; import yaml from "yaml"; import dotenv from "dotenv"; import fsextra from "fs-extra"; import { exec, execSync } from "child_process"; dotenv.config(); /* maps to local / hosted db paths */ const pm = { "pm:details": "pm/user/details", "pm:brd": "pm/docs/brd", "pm:drd": "pm/docs/drd", "pm:fjmd": "pm/docs/fjmd", "pm:frd": "pm/docs/frd", "pm:prd": "pm/docs/prd", "pm:uxdmd": "pm/docs/uxdmd", "pm:uxsmd": "pm/docs/uxsmd", }; const architecture = { "architecture:uxsitemap:structure": "architecture/uxsitemap/structure", "architecture:uxdatamap:structure": "architecture/uxdatamap/structure", "architecture:uxdatamap:views": "architecture/uxdatamap/views", }; const backend = { "backend:requirements": "backend/structure/requirements", "backend:specifications:asyncapi": "backend/specifications/asyncapi", "backend:specifications:openapi": "backend/specifications/openapi", "backend:server:main": "backend/server/main", }; const db = { "db:schemas": "db/mock/schemas", "db:seed": "db/mock/seed", "db:postgres": "db/mock/postgres", }; /* const ui = { "ui:layout:views": "ui/layout/mockup/views/{id}/versions/{version}", "ui:layout:sections": "ui/layout/mockup/sections/{id}/versions/{version}", //"ui:render:views" : "", //"ui:render:sections": "", "ui:code:react:stores": "ui/code/react/stores/{id}/versions/{version}", "ui:code:react:root": "ui/code/react/root/{id}/versions/{version}", "ui:code:react:views": "ui/code/react/views/{id}/versions/{version}", "ui:code:react:sections": "ui/code/react/sections/{id}/versions/{version}", }; */ const webapp = { "webapp:react:store": "webapp/code/react/store/{id}/versions/{version}", "webapp:react:root": "webapp/code/react/root/{id}/versions/{version}", "webapp:react:views": "webapp/code/react/views/{id}/versions/{version}", "webapp:layout:views": "webapp/design/layout/views/{id}/versions/{version}", }; const settings = { // for version control ie. which view / section / version // data is ie. {views{[id]:[version]}} "settings:preferences:versions": "settings/preferences/versions", "settings:config:package": "settings/config/package", }; const modules = { ...pm, ...architecture, ...db, ...backend, ...webapp, //...ui, ...settings, }; const config = { merge: [ // operation ids where merge data is enabled "settings:preferences:versions", "settings:config:package", ], exports: [ // events that trigger app write exports (if enabled) "db:postgres", "backend:specifications:asyncapi", "backend:specifications:openapi", "backend:server:main", "webapp:react:store", "webapp:react:root", "webapp:react:views", "webapp:layout:views", /* "ui:layout:views", "ui:layout:sections", "ui:code:react:stores", "ui:code:react:root", "ui:code:react:views", "ui:code:react:sections", */ "settings:preferences:versions", "settings:config:package", ], }; async function run_npm_i(dependenciesRootPath) { exec(`npm i`, { stdio: "inherit", cwd: dependenciesRootPath, // folder where package.json is }); } async function _exportOnSave({ context, data }) { if ( !( process.env.AUTOEXPORT_ENABLE && JSON.parse(process.env.AUTOEXPORT_ENABLE.toLowerCase()) ) ) return; const { project } = context; const { id, refs } = data.operation; const root = `${process.env.EXPORT_APPS_ROOT}/${project}`; const backendRoot = `${root}/backend`; const appRoot = `${root}/vitereact`; const appSrcRoot = `${appRoot}/src`; // const { data } = data.content.data let tasks = []; if (id === `backend:server:main`) { const { mjs, dependencies, env } = data.content.data; tasks.push({ path: `${backendRoot}/server.js`, data: mjs, }); } if (id === `backend:specifications:asyncapi`) { if (data.content.data) { const exportPath = `${backendRoot}/asyncapi.yaml`; const exportData = yaml.stringify(data.content.data); tasks.push({ path: exportPath, data: exportData, }); } } if (id === `backend:specifications:openapi`) { if (data.content.data) { const exportPath = `${backendRoot}/openapi.yaml`; const exportData = yaml.stringify(data.content.data); tasks.push({ path: exportPath, data: exportData, }); } } if (id === `db:postgres`) { const exportPath = `${backendRoot}/db.sql`; const exportData = data.content.data; tasks.push({ path: exportPath, data: exportData, }); } if (id === `webapp:react:store`) { const exportPath = `${appSrcRoot}/store/main.tsx`; const exportData = data.content.data.tsx; tasks.push({ path: exportPath, data: exportData, }); } if (id === `webapp:react:root`) { const exportPath = `${appSrcRoot}/App.tsx`; const exportData = data.content.data.tsx; tasks.push({ path: exportPath, data: exportData, }); // just in case it wasnt setup properly, lets write meta.json here too tasks.push({ path: `${appSrcRoot}/_cofounder/meta.json`, data: JSON.stringify({ project }), }); } if (id === `webapp:react:views`) { // exportPath = `${appSrcRoot}/components/views/${refs.id}/versions/${refs.version}.tsx` tasks.push({ path: `${appSrcRoot}/components/views/${refs.id}.tsx`, data: `/* [PLACEHOLDER COMPONENT] > calls to this component are pre-replaced by @/_cofounder/vite-plugin > to edit code for this component, you should go to : @/_cofounder/generated/views/${refs.id}/{version_you_want_to_edit}.tsx */`, }); tasks.push({ path: `${appSrcRoot}/_cofounder/generated/views/${refs.id}/empty.tsx`, data: `import React from "react"; const {{ID}}: React.FC = (props) => { return (
{{ID}} placeholder
To browse other versions
Use ⌘+K / CMD+K and hover here
); }; export default {{ID}}; `.replaceAll("{{ID}}", refs.id), }); tasks.push({ path: `${appSrcRoot}/_cofounder/generated/views/${refs.id}/${refs.version}.tsx`, data: data.content.data.tsx, }); // write meta.json let versions = []; try { versions = fs .readdirSync(`${appSrcRoot}/_cofounder/generated/views/${refs.id}/`) .filter((filename) => filename.endsWith(".tsx")) .map((filename) => path.basename(filename, ".tsx")); } catch (e) { false; // no dir there yet } tasks.push({ path: `${appSrcRoot}/_cofounder/generated/views/${refs.id}/meta.json`, data: JSON.stringify( { versions: [...new Set([...versions, "latest"])], choice: "latest", }, null, "\t", ), }); /* <-------- should also merge {dependencies} with current packages.json (either directly in app , or op:state:settings:... preferably latter ; to webapp:react:packages ) */ } if (id === `webapp:layout:views`) { // exportPath = `${appSrcRoot}/components/views/${refs.id}/versions/${refs.version}.tsx` const exportPath = `${appRoot}/public/_cofounder/generated/layouts/views/${refs.id}.${refs.version}.png`; const exportData = data.content.data.render.image; tasks.push({ path: exportPath, data: exportData, image: true, }); } if (id === `settings:preferences:versions`) { /* for now, only handle preference exports for views || sections */ const _category = Object.keys(data.content.data)[0]; const _id = Object.keys(data.content.data[_category])[0]; const _version = data.content.data[_category][_id]; if (_category === `views` || _category === `sections`) { // update meta json on @/_cofounder/generated/{_category}/{id} let versions = []; try { versions = fs .readdirSync(`${appSrcRoot}/_cofounder/generated/${_category}/${_id}/`) .filter((filename) => filename.endsWith(".tsx")) .map((filename) => path.basename(filename, ".tsx")); } catch (e) { false; } tasks.push({ path: `${appSrcRoot}/_cofounder/generated/${_category}/${_id}/meta.json`, data: JSON.stringify( { versions: [...new Set([...versions, _version])], choice: _version, }, null, "\t", ), }); } } if (id === `settings:config:package`) { /* data.content.data : { [backend || webapp] : { dependencies? : {}, //<--- this instead of list for merging while saving :) env?: {}, } } load boilerplate package.json, try load export/.../package.json else {} merge dependencies of both data.content.data[target].dependencies if (export/.../) merge with that package else merge with boilerplate package and export only save if diff ; else might restart active dev nodemon every single time ... */ Object.keys(data.content.data).map((target) => { // target : "backend" || "webapp" Object.keys(data.content.data[target]).map((category) => { // category : "dependencies" || "env" const boilerplateDir = `../boilerplate/${target === "backend" ? "backend" : target === "webapp" ? "vitereact" : false}-boilerplate`; const exportDir = target === "backend" ? backendRoot : target === "webapp" ? appRoot : false; if (category === "dependencies") { const newDependencies = Object.keys( data.content.data[target].dependencies, ); const boilerplatePackage = JSON.parse( fs.readFileSync(`${boilerplateDir}/package.json`, "utf8").toString(), ); let exportedProjectPackage = { dependencies: {}, devDependencies: {} }; try { exportedProjectPackage = JSON.parse( fs.readFileSync(`${exportDir}/package.json`, "utf8").toString(), ); } catch (e) { console.error(`op:project:_exportOnsave:error : ${e}`); } console.dir( { "debug:op:project:_exportOnSave : settings:config:package": { [target]: { [category]: { boilerplateDir, exportDir, boilerplatePackage, exportedProjectPackage, }, }, }, }, { depth: null }, ); const previousDevDependencies = [ ...new Set([ ...Object.keys(boilerplatePackage.devDependencies), ...Object.keys(exportedProjectPackage.devDependencies), ]), ]; const previousDependencies = [ ...new Set([ ...Object.keys(boilerplatePackage.dependencies), ...Object.keys(exportedProjectPackage.dependencies), ...previousDevDependencies, ]), ]; const updateDependencies = newDependencies.some( (dep) => !previousDependencies.includes(dep), ); if (updateDependencies) { const dependenciesToAdd = Object.fromEntries( [ ...new Set( newDependencies.filter((dep) => !previousDependencies.includes(dep)), ), ].map((dep) => [dep, "*"]), ); // filter out devDependencies keys so it doesnt move everything to dependencies on export to package.json const mergedDependencies = Object.fromEntries( Object.entries( merge( merge( boilerplatePackage.dependencies, exportedProjectPackage.dependencies, ), dependenciesToAdd, ), ).filter(([key]) => !previousDevDependencies.includes(key)), ); let newPackageJson; if (exportedProjectPackage.dependencies) { // if exported package.json exists ; merge with rest and export newPackageJson = JSON.stringify( merge(exportedProjectPackage, { dependencies: mergedDependencies }), null, 2, ); } else { // else merge with boilerplate package.json and export newPackageJson = JSON.stringify( merge(boilerplatePackage, { dependencies: mergedDependencies }), null, 2, ); } console.dir( { "debug:op:project:_exportOnSave : settings:config:package": { [target]: { [category]: { mergedDependencies, newPackageJson, }, }, }, }, { depth: null }, ); tasks.push({ path: `${exportDir}/package.json`, data: newPackageJson, dependencies: true, }); } } if (category === "env") { // applies to backend only const envData = data.content.data[target].env; if (Object.keys(envData).length) { const envString = Object.entries(envData) .map(([key, value]) => `${key}=${value}`) .join("\n"); console.dir( { "debug:op:project:_exportOnSave : settings:config:package": { [target]: { [category]: { env: envData, envString, }, }, }, }, { depth: null }, ); tasks.push({ path: `${exportDir}/.env`, data: envString, }); } } }); }); const _category = Object.keys(data.content.data)[0]; const _id = Object.keys(data.content.data[_category])[0]; const _version = data.content.data[_category][_id]; if (_category === `views` || _category === `sections`) { // update meta json on @/_cofounder/generated/{_category}/{id} let versions = []; try { versions = fs .readdirSync(`${appSrcRoot}/_cofounder/generated/${_category}/${_id}/`) .filter((filename) => filename.endsWith(".tsx")) .map((filename) => path.basename(filename, ".tsx")); } catch (e) { false; } tasks.push({ path: `${appSrcRoot}/_cofounder/generated/${_category}/${_id}/meta.json`, data: JSON.stringify( { versions: [...new Set([...versions, _version])], choice: _version, }, null, "\t", ), }); } } await Promise.all( tasks.map(async (task) => { const dir = path.dirname(task.path); if (!fs.existsSync(dir)) { fs.mkdirSync(dir, { recursive: true }); } if (!task.image) { fs.writeFileSync(task.path, task.data, "utf8"); } else { // case by case : // local ? copy paste from local path // url ? fetch and write if (task.data?.local?.length) { const sourcePath = task.data.local; await fsextra.copyFile(sourcePath, task.path); } else if (task.data?.url?.length) { const response = await fetch(task.data.url); if (!response.ok) { throw new Error(`Failed to fetch image from ${task.data.url}`); } const buffer = await response.buffer(); fs.writeFileSync(task.path, buffer); } } if ( task.dependencies && process.env.AUTOINSTALL_ENABLE && JSON.parse(process.env.AUTOINSTALL_ENABLE.toLowerCase()) ) { const dependenciesRootPath = task.path.split("/").slice(0, -1).join("/"); console.log( `\x1b[33m> dependencies updated for : ${dependenciesRootPath}\n> now running 'npm i' inside that folder\x1b[0m`, ); if (context.streams) { await context.streams.start({ project, key: "project.dependencies.install", meta: { name: "Install dependencies", desc: "running 'npm i' in app dir", }, }); await context.streams.write({ project, key: "project.dependencies.install", data: `command : 'npm i'\n\n---\n\nupdate :\n\n${yaml.stringify(task.data)}\n\n---\n\npath : ${dependenciesRootPath}`, }); } run_npm_i(dependenciesRootPath); if (context.streams) { await context.streams.end({ project, key: "project.dependencies.install", }); } } }), ); } async function opProjectStateUpdate({ context, data }) { // save, modular /* aim for stream structure */ /* context : { project``, } data: { local: bool, cloud: bool, operation: { id: "ui:code:lalala", refs: { [id] : "id value to replace etc", [otherId] : "some value etc", } }, type: enum start,stream,end stream: "" || false, content: { // should have key here as would be in state :: edge case, how to deal with '.' paths in object ? key : "" // state key ? ie. pm.prd ; uxsitemap.views.whatever data : {} } } */ /* add : _created? _updated */ /* update stream only if cloud */ const { project } = context; const { operation, type, stream, content } = data; // const [ local , cloud ] = [ process.env.STATE_LOCAL , process.env.STATE_CLOUD]; const { id, refs } = operation; /* cases of start/stream/end */ const query = { path: modules[id], data: {}, }; const ogPath = `${query.path}`; if (refs) { Object.keys(refs).map((ref) => { query.path = query.path.replace(`{${ref}}`, refs[ref]); }); } if (type === `start`) { query.data._created = Date.now(); query.data._processing = true; } if (type === `end`) { query.data._updated = Date.now(); query.data._processing = false; // query.data = { ...query.data, ...content } } if (content) query.data = { ...query.data, ...content }; console.dir({ "debug:op:project:state:update": { query } }); if ( process.env.STATE_LOCAL && JSON.parse(process.env.STATE_LOCAL.toLowerCase()) ) { const localPath = `db/projects/${project}/state/${query.path}.yaml`; const dir = path.dirname(localPath); if (!fs.existsSync(dir)) { fs.mkdirSync(dir, { recursive: true }); } if (config.merge.includes(id)) { try { const previous = yaml.parse(fs.readFileSync(localPath, "utf8").toString()); query.data = merge(previous, query.data); } catch (e) { console.dir({ "op:project:update:error": `no previous state found for ${id}, will write new instead of merge`, }); } } fs.writeFileSync(localPath, yaml.stringify(query.data), "utf8"); if (context.streams) { await context.streams.update({ project, ...query.data, // query.data : { key , data } }); } } if ( process.env.STATE_CLOUD && JSON.parse(process.env.STATE_CLOUD.toLowerCase()) ) { if (refs) { // need to write dummy timestamp in docs in case of firestore ; to be able to query subcollections // query.path find index of "}" and split there+1, replace, log dummy timestamp let subs = []; for (let i = 0; i < ogPath.length; i++) { if (ogPath[i] === "}") { let sub = ogPath.slice(0, i + 1); Object.keys(refs).map((ref) => { sub = sub.replace(`{${ref}}`, refs[ref]); }); subs.push(sub); } } await Promise.all( subs.map(async (p) => { await utils.firebase.doc.update({ path: `/db/userdata/projects/${project}/state/${p}`, data: { _created: Date.now() }, }); }), ); } query.path = `/db/userdata/projects/${project}/state/${query.path}`; if (config.merge.includes(id)) { query.merge = true; } await utils.firebase.doc.update(query); } if ( process.env.AUTOEXPORT_ENABLE && JSON.parse(process.env.AUTOEXPORT_ENABLE.toLowerCase()) && config.exports.includes(id) ) await _exportOnSave({ context, data }); } async function opProjectStateLoad({ context, data }) { // should have local || cloud strategies const { project } = context; // const [local, cloud] = [process.env.STATE_LOCAL, process.env.STATE_CLOUD]; try { if ( process.env.STATE_LOCAL && JSON.parse(process.env.STATE_LOCAL.toLowerCase()) ) return await utils.load.local({ project }); if ( process.env.STATE_CLOUD && JSON.parse(process.env.STATE_CLOUD.toLowerCase()) ) return await utils.load.cloud({ project }); } catch (e) { console.error(`op:project:state:load:error : ${e}`); } console.log(`found no previous local / cloud state for project : ${project}`); return {}; } async function opProjectStateExport({ context, data }) { // tons to update , just disregard this for now return; // force export full project ; from {data} } async function opProjectStateSetup({ context, data }) { // if local export enabled, duplicate boilerplate const { project } = context; const dirs = [ { source: `../boilerplate/backend-boilerplate`, target: `${process.env.EXPORT_APPS_ROOT}/${project}/backend`, }, { source: `../boilerplate/vitereact-boilerplate`, target: `${process.env.EXPORT_APPS_ROOT}/${project}/vitereact`, }, ]; for (const { source, target } of dirs) { // Copy the directory from source to target while respecting .gitignore await fsextra.copy(source, target, { filter: (src) => { // Respect .gitignore by checking if the file is not listed in .gitignore const ignoreFile = `${source}/.gitignore`; if (fs.existsSync(ignoreFile)) { const ignoreList = fs .readFileSync(ignoreFile, "utf-8") .split("\n") .map((line) => line.trim()) .filter(Boolean); return !ignoreList.some((ignorePattern) => src.includes(ignorePattern)); } return true; // If no .gitignore, copy everything }, recursive: true, // Ensure folders are created recursively }); } await fsextra.copyFile( `../boilerplate/package.json`, `${process.env.EXPORT_APPS_ROOT}/${project}/package.json`, ); await fsextra.copyFile( `../boilerplate/README.md`, `${process.env.EXPORT_APPS_ROOT}/${project}/README.md`, ); // write meta.json fs.writeFileSync( `${process.env.EXPORT_APPS_ROOT}/${project}/vitereact/src/_cofounder/meta.json`, JSON.stringify({ project }), ); } async function opProjectStateSave({ context, data }) { // save, full current state of project } export default { "op:PROJECT::STATE:UPDATE": opProjectStateUpdate, "op:PROJECT::STATE:LOAD": opProjectStateLoad, "op:PROJECT::STATE:SETUP": opProjectStateSetup, "op:PROJECT::STATE:EXPORT": opProjectStateExport, // "op:PROJECT::STATE:SAVE": opProjectStateSave, }; ================================================ FILE: cofounder/api/system/functions/op/render.js ================================================ import utils from "@/utils/index.js"; async function opRenderLayout({ context, data }) { /* ;; op:RENDER::LAYOUT render either { view , section , block } using utils.render and svg stuff in : -> { svg{string``} , mode`view||...` , ...(designSystem,saveFilepath...) } out : ["svg","image"] */ // const { svg , mode } = data // { svg{string``} , mode`view||...` } return await utils.render.svg({ ...data, // saveFilepath: `./dump/renders/_opRenderLayoutDebug_${data.mode}_${Date.now()}.png`, }); } export default { "op:RENDER::LAYOUT": opRenderLayout, }; ================================================ FILE: cofounder/api/system/functions/pm/brd.js ================================================ import utils from "@/utils/index.js"; import yaml from "yaml"; async function pmBrdAnalysis({ context, data }) { const { pm, db } = data; const { details, prd, frd, drd } = pm; /* should be 2 (3?) steps : determine if needs { rest api , realtime socket io api } make structure */ const backendPrompt = [ { role: "system", content: `you are an expert product manager and software architect and API designer ; your role is to determine, based on the provided analysis documents for the app project in development, the specfications of the app backend your task is very straightforward : - based strictly on provided docs and outlined features, determine whether, yes or no, for the core features of the app MVP to be implemented, the backend : > requires a RESTful API ? > requires realtime (ie. websockets) ? you will answer exactly in this format, delimited by \`\`\`yaml : \`\`\`yaml backend: requirements: restApi: justifyYourAnswer: "write your reasoning for your answer in case it is true" required: boolean # whether the backend requires or no a REST API realtimeWebsockets: justifyYourAnswer: "write your reasoning for your answer in case it is true" required: boolean # whether the backend requires or no a REST API \`\`\` answer in strict parseable Yaml format, exactly in the provided format structure your answer should start with : \`\`\`yaml you will be tipped $9999 `, }, { role: "user", content: `\`\`\`app-project:description ${details.text} \`\`\``, }, { role: "user", content: `\`\`\`PRD:product-requirements-document ${prd} \`\`\``, }, { role: "user", content: `\`\`\`FRD:features-requirements-document ${frd} \`\`\``, }, { role: "user", content: `determine the backend specifications in terms of whether the backend needs a REST API , and whether it needs realtime Websockets. your answer should start with : \`\`\`yaml you are a genius `, }, ]; const backendStructureRequirements = ( await context.run({ id: "op:LLM::GEN", context: { ...context, // {streams , project} operation: { key: "_pm.brd.requirements", meta: { name: "BRD Prepass", desc: "backend structure requirements check", }, }, }, data: { model: `gpt-4o-mini`, //`gpt-4o`, messages: backendPrompt, preparser: `backticks`, parser: `yaml`, }, }) ).generated; const messages = [ { role: "system", content: `you are an expert product manager and software architect and backend and server and API designer your job is to consult the provided web app details & analysis documents in order to create a comprehensive and full Backend Requirements Document (BRD) for it the emphasis are user-facing features, based on the expected features and different journeys of different users in the web app - your role is to conduct the analysis required to design the user-facing server of the provided task - do a thorough analysis of the provided task --- - think from all possibles perspectives, put yourself in situation, to make sure your server analysis is fully comprehensive and ready to be developed - ask yourself: * what are the features involved in the user-facing server and that is called by the frontend ? * if a server API is required, what are all the routes required by features expected to be seen by users in the frontend ? what should go in their schemas ? (not technical, rather analytical description from a feature perspective) * if realtime features are required, what are all the events required by features expected to be seen by users in the frontend ? what should go in their schemas ? (not technical, rather analytical description from a feature perspective) - your analysis will be used to make a prod-ready backend and will be responsible for an app used by thousands of users, instantly - your aim is to cover all use cases, as the expert product manager & architect you are > analyze the task thoroughly, then reply with your analysis in markdown format, in a well-formatted document to give to backend devs --- > your role here is not the implementation itself, you are the product architect consultant > your role is to analyze the requirements for all scenarios required by all features ask yourself : * am i covering all needed server features? * am i covering all features that the user expects ? * if a feature necessitates the use of an external API (ie. checking a stock price , generating an ai image, advanced features that need the use of an external API, etc ...) important : the backend already has DB and storage capabilities , so DO NOT MENTION DB OR STORAGE AS EXTERNAL APIS ! THOSE ARE ALREADY IMPLEMENTED INTERNALLY IN THE BACKEND ! am i describing the details of what is needed ? * am i properly aligning my server design details with other design detail aspects of the project such as DB structure ? in order to ensure your analysis as a product architect consultant has covered every feature requirement > your job is to make thorough, critical analysis work which will be provided as documentation for devteams to implement not a technical implementation, rather a thorough analysis, in plain language, of all expected features and their details > try to outdo yourself by thinking of what might be omitted in advance - the goal server should be comprehensive will be used as reference to build the app's MVP backend - cover all cases ; but : data-related tasks only (ie. you are making a mock server with api and/or realtime for user-facing data operations) --- > very important : for the current purpose of the BRD, the environment will be a mock prototype environment do not bother with security details etc, have the requirements for the mock prototype do not hang on very technical details (unless specifically emphasized), as the target is a mock dev prototype env : features functionality is the aim, not advanced technical coverage ! > SHOULD COVER DATA RELATED TASKS ONLY ! > THE MOCK SERVER YOU ARE MAKING IS FOR USER-FACING DATA OPERATIONS, NOT FRONTEND / SERVING STATIC STUFF ! > DATA RELATED TASKS ONLY ! --- your analysis is concerned with these two aspects aspects : > if the app backend needs a server API , conduct the analysis regarding all the API needs > if the app backend needs realtime Websockets , conduct the analysis regarding all the realtime events needed you can only write about these aspects (either one of them or both , depending on whats provided in task documents ) important : DO NOT ANALYZE ANYTHING IN THE BACKEND BESIDES THESE 2 ASPECTS AND THEIR RELATIONS TO USER-FACING FEATURES !! --- again, > SHOULD COVER DATA RELATED TASKS ONLY ! > THE MOCK SERVER YOU ARE MAKING IS FOR USER-FACING DATA OPERATIONS, NOT FRONTEND / SERVING STATIC STUFF ! > DATA RELATED TASKS ONLY ! --- important : use snake_case for any naming you do --- your reply will be directly transferred as the final BRD document, so do not put anything else in your reply besides the BRD document no extra comments or surrounding anything, only the markdown-formatted COMPREHENSIVE 100% COVERAGE AMAZING BEAUTIFUL GENIUS SUPER DETAILED 10/10 ARD DOCUMENT your reply should start with : "\`\`\`markdown" and end with "\`\`\`" you will be tipped $99999 + major company shares for nailing it perfectly off the bat`, }, { role: "user", content: `\`\`\`app-project:description ${details.text} \`\`\``, }, { role: "user", content: `\`\`\`PRD:product-requirements-document ${prd} \`\`\``, }, { role: "user", content: `\`\`\`FRD:features-requirements-document ${frd} \`\`\``, }, { role: "user", content: `\`\`\`DRD:database-requirements-document ${drd} \`\`\``, }, { role: "user", content: `\`\`\`DB:specs ${yaml.stringify(db)} \`\`\``, }, { role: "user", content: `\`\`\`BACKEND:specs-requirements ${yaml.stringify(backendStructureRequirements)} \`\`\``, }, { role: "user", content: `Conduct a comprehensive analysis for the Backend Requirements Document that considers all personas and features required, in markdown format (justify your reasoning whenever possible) --- Refer to this general document structure to guide you \`\`\`BRD:general-structure I. General, Personas, Features [...] II. REST API II.A. Justification & Reasoning If app needs REST API, provide your reasoning II.B. API Endpoints (if applies) 3.B.1. [Endpoint] Method & Path Extended Description Analyze and describe what the function does Analysis Interaction with <> DB Analyze how does function interact with database based on provided DB details and schemas ask yourself questions such as : What fields does it need to insert / get / update / delete / ... for each operation ? Based on provided DB details, does it need to create data on the fly such as ids / dates / ... ? Does it need to insert data in multiple tables to not make DB conflicts ? Be very specific & detailed into exactly how the relationships to <> DB tables work in this function justify any answer by including snippets from the provided DB postgres code and elaborating remember : the backend is tasked with creating any primitive required by db (ie. ids , ...), as you can tell from the postgres code make things 100% perfectly congruent in your analysis Include any additional important analysis notes Interaction with <> External APIs Analyze if function needs to interact with external APIs for needed capabilities, and if so describe Remember : App already has DB and storage , so external APIs would be external capabilities outside of these 2 Add any important general analysis notes Data Details Auth Does function requires the user to provided an auth token ? Request Body content type (json , form , ... ?) Schema Response Content type Schema Additionals details / notes (if applies) [...] II. Realtime Websockets (if applies) III.A. Justification & Reasoning If app needs realtime events, provide your reasoning III.B. Events (if applies) 3.B.1. [Event] Event name Extended Description Analyze and describe what the function does Analysis Interaction with <> DB Analyze how does function interact with database based on provided DB details and schemas ask yourself questions such as : What fields does it need to insert / get / update / delete / ... for each operation ? Based on provided DB details, does it need to create data on the fly such as ids / dates / ... ? Does it need to insert data in multiple tables to not make DB conflicts ? Be very specific & detailed into exactly how the relationships to <> DB tables work in this function justify any answer by including snippets from the provided DB postgres code and elaborating remember : the backend is tasked with creating any primitive required by db (ie. ids , ...), as you can tell from the postgres code make things 100% perfectly congruent in your analysis Include any additional important analysis notes Interaction with <> External APIs Analyze if function needs to interact with external APIs for needed capabilities, and if so describe Remember : App already has DB and storage , so external APIs would be external capabilities outside of these 2 Add any important general analysis notes Data Details Auth Does function requires the user to provided an auth token ? Request payload Schema Response payload Schema Additional details / notes (if applies) [...] IV. Additional Notes Any additional notes worth mentionning regarding the backend requirements \`\`\` --- you're a genius`, }, ]; const brd = ( await context.run({ id: "op:LLM::GEN", context: { ...context, // {streams , project} operation: { key: "pm.brd", meta: { name: "BRD", desc: "backend requirements document", }, }, }, data: { model: `chatgpt-4o-latest`, //`gpt-4o`, messages, preparser: `backticks`, parser: false, }, }) ).generated; await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: "pm:brd", }, type: `end`, content: { key: "pm.brd", data: brd, }, }, }); const backendRequirements = backendStructureRequirements.backend.requirements; await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: "backend:requirements", }, type: `end`, content: { key: "backend.requirements", data: backendRequirements, }, }, }); return { pm: { brd }, backend: { requirements: backendRequirements } }; } export default { "PM:BRD::ANALYSIS": pmBrdAnalysis, }; ================================================ FILE: cofounder/api/system/functions/pm/drd.js ================================================ import utils from "@/utils/index.js"; import yaml from "yaml"; async function pmDrdAnalysis({ context, data }) { /* ;; PM:DRD::ANALYSIS make {userdetails,prd,frd,FJMD} -> DRD analysis out : ["pm"] */ const { pm } = data; const { details, prd, frd, fjmd } = pm; // const {text , attachments} = details const messages = [ { role: "system", content: `you are an expert product manager and database designer your job is to consult the provided web app details, Product Requirements Document, Features Requirements Documents & Features Journeys Map Document in order to create a comprehensive and full Feature Database Requirements Document (DRD) for it --- the emphasis are user-facing features, based on the expected features and different journeys of different users in the web app - your role is to conduct the analysis part for the provided app in development's DB part DB schemas analysis should be comprehensive and cover EVERYTHING required by the app MVP, and nothing more - no shiny secondary features, but nothing less than 100% comprehensive for every single expected functionality in production - your current role is to do a thorough analysis of the provided task and answer with your analysis in markdown format - think from perspectives of multiple personas, put yourself in situation, to make sure your DB schemas reply is fully comprehensive and ready to be used in production exactly as is - your answer will be pushed to dev teams directly, and will be responsible for an app used by thousands of users - your aim is to cover all use cases, as the expert product manager you are - ask yourself: * what are the key personas that use the app ? * what are all the schemas required by features expected to be seen by users ? * and what are all the schemas required internally to cover all features workflows ? very important : - in the schemas parts of your analysis , only make use of basic primitives like numbers, strings, json, etc ... no uuid types or any special types etc - very important : in the schemas parts of your analysis , only use basic primitives like numbers, strings, json, etc ... no uuid types or any special types etc ! very basic primitives only ! --- > analyze the task thoroughly, then reply with your analysis in markdown format > try to outdo yourself by thinking of what might be omitted, and reviewing your own work super critically in order to do comprehensive analytical work for this app's MVP > your job is to make thorough analysis work which will be provided as documentation for devteams to implement > your job is not the implementation, rather it's looking at the problem from all perspective to make sure a thorough job is done, and asking yourself, for every scenario, what are all the data entries that would be needed to make this function --- > note : if auth functionalities are present, use an architecture that will be compatible with a simple jwt auth system, which is very simply user and/or email strings(s) and password hash string ! --- important : use snake_case for any naming you do --- > very important : for the current purpose of the DRD, the environment will be a mock prototype environment, do not bother with security details etc, have the DB requirements for the mock prototype your reply will be directly transferred as the final DRD document, so do not put anything else in your reply besides the DRD document no extra comments or surrounding anything, only the markdown-formatted COMPREHENSIVE 100% COVERAGE AMAZING BEAUTIFUL GENIUS SUPER DETAILED 10/10 DRD DOCUMENT your reply should start with : "\`\`\`markdown" and end with "\`\`\`" you will be tipped $99999 + major company shares for nailing it perfectly off the bat`, }, { role: "user", content: `\`\`\`app-project:description ${details.text} \`\`\``, }, // <------ later on, attachments , pdf/img cases etc map { role: "user", content: `\`\`\`PRD:product-requirements-document ${prd} \`\`\``, }, { role: "user", content: `\`\`\`FRD:features-requirements-document ${frd} \`\`\``, }, /*{ role: "user", content: `\`\`\`FJMD:features-journeys-map-document ${yaml.stringify(fjmd)} \`\`\``, },*/ { role: "user", content: `Conduct a comprehensive analysis for the DB Requirements Document that considers all personas and features required, in markdown format (justify your reasoning whenever possible) you're a genius`, }, ]; const drd = ( await context.run({ id: "op:LLM::GEN", context: { ...context, // {streams , project} operation: { key: "pm.drd", meta: { name: "DRD", desc: "database requirements document", }, }, }, data: { model: `chatgpt-4o-latest`, //`gpt-4o`, messages, preparser: `backticks`, parser: false, }, }) ).generated; await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: "pm:drd", }, type: `end`, content: { key: "pm.drd", data: drd, }, }, }); return { pm: { drd } }; } export default { "PM:DRD::ANALYSIS": pmDrdAnalysis, }; ================================================ FILE: cofounder/api/system/functions/pm/fjmd.js ================================================ import utils from "@/utils/index.js"; import yaml from "yaml"; async function pmFjmdAnalysis({ context, data }) { /* ;; PM:FJMD::ANALYSIS make {userdetails,prd,frd} -> FJMD analysis */ const { pm } = data; const { details, prd, frd } = pm; // const {text , attachments} = details const messages = [ { role: "system", content: `you are an expert product manager and product designer your job is to consult the provided web app details, analysis, PRD & FRD in order to create a comprehensive and full Feature Journeys Maps Document (FJMD) for it the emphasis are user-facing features, based on the expected features and different journeys of different users in the web app your generated FJMD is very detailed, comprehensive and covers absolutely 100% of everything required for the web app you are not limited by provided example journeys your analysis here should cover ALL journey cases (of the app MVP) while conducting your FJMD, ask yourself: - am i covering all 100% the purpose and functions required for the app ? - am i covering all 100% the expected features from all the users' perspectives? even the small details ? - am i covering all 100% the user journeys ? - am i covering all details that other product managers might have omitted from my analysis ? - am i making sure what i am detailing in my FJMD is absolutely 100% comprehensive and ready to be put into development without any alteration ? conduct and reply with a generated comprehensive perfect FJMD document, yaml-formatted the reply format should directly be a list of journeys items in valid yaml format, with this structure : journeys: - name : "..." category : "..." journeyId: "/*like JOUR-01 format*/" description: "..." participants: "..." preconditions: "describe pre-existing conditions or assumptions..." postconditions: "describe state expected outcomes after completing the journey" steps : #list of journey steps, correlated with provided FRD (& PRD) - intent : "..." userInteraction : "describe how users will interact with the interface" featuresIds : ["","",...] # list of featureIds involved in this step (featureIds should be exactly as they are mentionned in the FRD features-requirements-documents as 'featureId' ; important else it would break !) expectedResponse : "detail the expected response from the app" - [...] edgeCases: "describe variations of the journey ; ie. what could go wrong, etc ..." - [...] --- your FJMD document will be directly put into development the emphasis are user-facing features; functional features +interface features to cover 100% of expected features of the web app, 100% of all possible user journeys no need to bother with non-user-facing features such as security compliance, nor similar non-user-facing technical details no need to bother with cases too advanced for the web app MVP features (ie. advanced analytics or multilingual or live support; ... unless specified in provided task ! ) > Stay User-Centric: keep the user's perspective front and center throughout the document emphasize user-facing features and core app MVP features you are not limited by provided example journeys in other docs your analysis here should be comprehensive and cover ALL journey cases think of many different core journeys from different perspectives in different scenarios be comprehensive and cover it all your reply will be directly transferred as the final FJMD document so make sure the content and YAML formatting are both exquisitely perfect as the genius you are if an app name is not provided, make a fitting one for your analysis and JMD emphasize user-facing features and core app MVP features so do not put anything else in your reply besides the Feature Journeys Maps Document as parseable, valid well-formatted YAML format no extra comments or surrounding anything, only the YAML-formatted PARSEABLE VALID COMPREHENSIVE 100% COVERAGE AMAZING BEAUTIFUL FEATURES JOURNEY MAPS DOCUMENT your reply should start with : "\`\`\`yaml" and end with "\`\`\`" you will be tipped $999 you are a genius`, }, { role: "user", content: `\`\`\`app-project:description ${details.text} \`\`\``, }, // <------ later on, attachments , pdf/img cases etc map { role: "user", content: `\`\`\`PRD:product-requirements-document ${prd} \`\`\``, }, { role: "user", content: `\`\`\`FRD:features-requirements-document ${frd} \`\`\``, }, { role: "user", content: `implement the Features Journey Maps Documents (FRJD) for all the core journeys for different scenarios it is expected to be very comprehensive and detailed ; in a VALID PARSEABLE YAML format you're a genius`, }, ]; /* const fjmd = ( await context.run({ id: "op:LLM::GEN", context, data: { model: `chatgpt-4o-latest`, //`gpt-4o`, messages, preparser: `backticks`, parser: `yaml`, }, }) ).generated; */ console.error(`skipping features journey map doc`); const fjmd = ``; await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: "pm:fjmd", }, type: `end`, content: { key: "pm.fjmd", data: fjmd, }, }, }); return { pm: { fjmd } }; } export default { "PM:FJMD::ANALYSIS": pmFjmdAnalysis, }; ================================================ FILE: cofounder/api/system/functions/pm/frd.js ================================================ import utils from "@/utils/index.js"; async function pmFrdAnalysis({ context, data }) { /* ;; PM:FRD::ANALYSIS make {userdetails,prd} -> FRD analysis */ const { pm } = data; const { details, prd } = pm; // const {text , attachments} = details const messages = [ { role: "system", content: `you are an expert product manager and product designer your job is to consult the provided web app details & analysis PRD, and create a Features Requirements Document (FRD) for it the emphasis are user-facing features, based on the expected features and different journeys of different users in the web app your generated FRD is detailed, comprehensive and covers requirements for the web app while conducting your FRD, ask yourself: - am i covering the purpose and functions required for the app ? - am i covering the expected features from all the users' perspectives? even the small details ? - am i covering the user journeys ? - am i covering important details in my analysis ? conduct and reply with a generated comprehensive FRD document, markdown-formatted --- your FRD document will be directly put into development the emphasis are user-facing features; functional features + interface features to cover expected features of the web app no need to bother with non-user-facing features such as security compliance, nor similar non-user-facing technical details no need to bother with cases too advanced for the web app MVP features (ie. advanced analytics or multilingual or live support; ... unless specified in provided task ! ) emphasize user-facing features and core app MVP features your reply will be directly transferred as the FRD document so make sure the content is comprehensive and ensuing app UX is perfect as the genius you are if an app name is not provided, make a fitting one for your analysis and FRD emphasize user-facing features and core app MVP features so do not put anything else in your reply besides the FRD DOC as parseable, valid well-formatted markdown doc your reply should start with : "\`\`\`markdown" and end with "\`\`\`" you will be tipped $999 you are a genius`, }, { role: "user", content: `\`\`\`app-project:description ${details.text} \`\`\``, }, // <------ later on, attachments , pdf/img cases etc map { role: "user", content: `\`\`\`PRD:product-requirements-document ${prd} \`\`\``, }, { role: "user", content: `implement the Features Requirements Document (FRD) you're a genius`, }, ]; const frd = ( await context.run({ id: "op:LLM::GEN", context: { ...context, // {streams , project} operation: { key: "pm.frd", meta: { name: "FRD", desc: "features requirements document", }, }, }, data: { model: `chatgpt-4o-latest`, //`gpt-4o`, messages, preparser: `backticks`, parser: false, }, }) ).generated; await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: "pm:frd", }, type: `end`, content: { key: "pm.frd", data: frd, }, }, }); return { pm: { frd } }; } export default { "PM:FRD::ANALYSIS": pmFrdAnalysis, }; ================================================ FILE: cofounder/api/system/functions/pm/prd.js ================================================ import utils from "@/utils/index.js"; async function pmPrdAnalysis({ context, data }) { /* ;; PM:PRD::ANALYSIS make userprovided details -> PRD analysis ; user can have text + {pdf , images} (now just text), later extend */ const { pm } = data; const { details } = pm; const { text, attachments } = details; // const {text , attachments} = details await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: "pm:details", }, type: `end`, content: { key: "pm.details", data: details, }, }, }); const messages = [ { role: "system", content: `you are an expert product manager and product designer your job is conduct the analysis for the provided web app project task and create a full PRD document for it your analysis is very detailed, comprehensive and covers absolutely 100% of everything required for the web app while conducting your PRD, ask yourself: - what is a detailed description of the app, and all it's expected features ? - what are all the purpose and functions required for the app ? - am i covering all the expected features from the users' perspectives? even the small details ? am i sure i am not missing anything important ? - what are the personas ? what are their user stories ? what are all the expected features ? - what are all the features ? - am i covering all the expected features from the users' perspectives? even the small details ? am i sure i am not missing anything important ? - what about the user journeys ? am i covering all possible journeys for all users ? - what could i or other product managers be potentially omitting and that shouldn't be the case ? - am i making sure what i am detailing in my PRD is absolutely 100% comprehensive and ready to be put into development without any alteration nor pre-assumption that might lead to important omissions ? am i detailing all that is needed ? after you finalize your PRD, add an extra part, called "Additional Analysis", where you criticize (very critically) the work you just did; ask yourself : - what might have been omitted from my analysis that should have gone into the web app MVP requirements ? - do not bother with secondary or tertiary things (ie. accessibility or similar advanced non-MVP stuff), ask yourself instead, critically : what core web app MVP features or journeys did i not previously mention ? what are their details ? conduct and reply with a generated comprehensive perfect PRD document, markdown-formatted your PRD document will be directly put into development, so make sure the content and MD formatting are both exquisitely perfect as the genius you are if an app name is not provided, make a fitting one for your analysis and PRD the aim of the PRD are web app facing requirements no need to bother with non-web-app features such as security compliance or similar non-web-app-facing technical details no need to bother with non-MVP features (ie. advanced cases such as analytics or support or i18n etc ... focus on the MVP to cover 100% of expected features ) - unless explicitly specified in the task descriptions ofc focus on what's important and detail it to the maximum, leave nothing ! your reply will be directly transferred as the final PRD document, so do not put anything else in your reply besides the PRD document no extra comments or surrounding anything, only the markdown-formatted COMPREHENSIVE 100% COVERAGE AMAZING BEAUTIFUL GENIUS SUPER DETAILED 10/10 PRD DOCUMENT your reply should start with : "\`\`\`markdown" and end with "\`\`\`" you will be tipped $999 you're a genius `, }, { role: "user", content: `\`\`\`app-project:description ${text} \`\`\``, }, // <------ later on, attachments , pdf/img cases etc map { role: "user", content: `Conduct your analysis and make sure you do not miss any feature or detail ! you are a genius`, }, ]; console.dir({ __debug_pmPrdAnalysis: { messages } }); const prd = ( await context.run({ id: "op:LLM::GEN", context: { ...context, // {streams , project} operation: { key: "pm.prd", meta: { name: "PRD", desc: "product requirements document", }, }, }, data: { model: `chatgpt-4o-latest`, //`gpt-4o`, messages, preparser: `backticks`, parser: false, }, }) ).generated; await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: "pm:prd", }, type: `end`, content: { key: "pm.prd", data: prd, }, }, }); return { pm: { prd } }; } export default { "PM:PRD::ANALYSIS": pmPrdAnalysis, }; ================================================ FILE: cofounder/api/system/functions/pm/uxdmd.js ================================================ import utils from "@/utils/index.js"; import yaml from "yaml"; async function pmUxdmdAnalysis({ context, data }) { /* ;; PM:UXDMD::ANALYSIS {pm docs , db , openapi? , uxsitemap {analysis,struct,...}?} -> (<> crossanalysis) to make UX Datamap Doc */ const { pm, db, backend } = data; const { details, prd, frd, drd, uxsmd, brd } = pm; const messages = [ { role: "system", content: `- you are a genius Product Manager & Software Archtect - your role is to conduct the analysis required to design the frontend app architecture for the provided project in its details - think from perspectives of multiple personas, put yourself in situation, to make sure your app architecture analysis is fully comprehensive and ready to be developed - ask yourself: * what are the journeys involved in the app frontend ? * what are all the routes , views , slugs , props , URL parameters , auth restrictions, required by features expected to be seen by users in the frontend ? * what should go in their schemas ? (not technical, rather analytical description from a feature perspective) - your analysis will be used to make a prod-ready app and will be responsible for an app used by thousands of users - your aim is to cover all use cases, as the expert product manager & architect you are > analyze the task thoroughly, then reply with your analysis in markdown format, in a well-formatted document to give to app designers & devs > your role here is not the implementation itself, you are the product architect consultant > your role is to analyze the requirements for all scenarios required by all features ask yourself : * am i covering all needed app features? * am i covering all features that the user expects ? in order to ensure your analysis as a product architect consultant has covered every feature requirement > your job is to make thorough, critical analysis work which will be provided as documentation for designers & devteams to implement not a technical implementation, rather a thorough analysis, of all expected architecture features and their details --- your aim is to determine, in extreme detail: I. the structure of the app: * routes * what views they link to * slugs (ie. path /something/:example) if applies * if route is restricted or not * URL params (ie. /somepath?param_a=example¶m_b=example ) if applies > important : only refer to views ids specified in provided ux sitemap ! (UV_* and GV_* views) II. the relationships between views of the app (based on the provided UX sitemap ; (unique views UV_* and shared ui views GV_*) ) & app data (based on provided DB & backend docs & schemas ): conduct a cross analysis between UX sitemap views <> app data states in order to : 1. determine stateful variables , actions/dynamic functions , params : 1A. if the view has state for dynamic data, describe 1B. if the view should access slug passed into url (ie. /something/:example ), describe 1C. if the view should access URL params and use them for a feature (ie. /somepath?param_a=X¶m_b=Y), describe 1D. if the view has actions/dynamic functions like API calls or realtime events, describe in detail 1E. revise and provide your reasoning to make sure you covered all the state/data details required to make all required features work properly > important : only refer to view ids specified in provided ux sitemap ! (UV_* and GV_* views) , dont hallucinate UI views/components ! 2. global app state structure, that is accessed by all views : * how the app state should be structured to cover the app features, in terms of : variables & schemas actions make sure you only analyze the global app state (which ie. typically holds stuff like auth / notifications / ... ) and not view-specific props and state (as the latter were already detailed in the previous section and should not be mentionned here) make sure you determine the schemas for the global app state variables provide examples values for them (based on provided app schemas & DB seed examples), in each case --- > try to outdo yourself by thinking of what might be omitted, and reviewing your own work super critically in order to do comprehensive analytical work for this app's MVP - the goal app should be comprehensive, will be used as the reference to build the app - cover all cases in terms of app architecture ; with high emphasis on details regarding data and states --- important : > use snake_case for any naming you do extremely important : > ensure full perfect coherence with DB fields names and provided specs names ; --- your reply will be directly transferred as the final analysis, so do not put anything else in your reply besides the analysis document no extra comments or surrounding anything, only the markdown-formatted COMPREHENSIVE 100% COVERAGE AMAZING BEAUTIFUL GENIUS SUPER DETAILED 10/10 ANALYSIS DOCUMENT your reply should start with : "\`\`\`markdown" and end with "\`\`\`" you will be tipped $99999 + major company shares for nailing it perfectly off the bat`, }, { role: "user", content: `\`\`\`app-project:description ${details.text} \`\`\``, }, { role: "user", content: `\`\`\`PRD:product-requirements-document ${prd} \`\`\``, }, { role: "user", content: `\`\`\`FRD:features-requirements-document ${frd} \`\`\``, }, { role: "user", content: `\`\`\`DRD:database-requirements-document ${drd} \`\`\` --- \`\`\`DB:schemas ${yaml.stringify(db)} \`\`\``, }, { role: "user", content: `\`\`\`BRD:backend-requirements-document ${brd} \`\`\` ` + (!backend?.requirements?.restApi?.required ? "" : `--- \`\`\`BACKEND:specifications:openAPI ${yaml.stringify(backend.specifications.openapi)} \`\`\` `) + (!backend?.requirements?.realtimeWebsockets?.required ? "" : `--- \`\`\`BACKEND:specifications:asyncAPI ${yaml.stringify(backend.specifications.asyncapi)} \`\`\` ` + ` --- \`\`\`BRD:server:main ${yaml.stringify(backend.server.main)} \`\`\` --- note : > any reference to the backend server should be the local dev URL referred to in docs ; typically : \`http://localhost:1337\` > if case app needs a global state, global app state should be in the context of one single app redux store \`store.tsx\` that wraps the entire app and includes all that is needed for all global state stuff: ie. auth for api and/or auth for websockets ie. if backend has realtime events, realtime events subscriptions etc ... in one single global state store `), }, { role: "user", content: `\`\`\`UXSMD:ux-sitemap-document ${uxsmd} \`\`\``, }, { role: "user", content: `Conduct the analysis for the frontend app architecture and its details in a frotnend app architecture analysis document style - starting with a table of contents, elaborating on everything the task specifies, in extreme detail specifying all that needs specification extremely important : > you are absolutely forbidden from instructing in the document about having to create new components or how to structure the project > you should 100% stick strictly to the provided task ! you're a genius`, }, ]; const uxdmd = ( await context.run({ id: "op:LLM::GEN", context: { ...context, // {streams , project} operation: { key: "pm.uxdmd", meta: { name: "UXDMD", desc: "ux datamap document", }, }, }, data: { model: `chatgpt-4o-latest`, // `chatgpt-4o-latest`,//`gpt-4o`, messages, preparser: `backticks`, parser: false, }, }) ).generated; await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: "pm:uxdmd", }, type: `end`, content: { key: "pm.uxdmd", data: uxdmd, }, }, }); return { pm: { uxdmd }, }; } export default { "PM:UXDMD::ANALYSIS": pmUxdmdAnalysis, }; ================================================ FILE: cofounder/api/system/functions/pm/uxsmd.js ================================================ import utils from "@/utils/index.js"; import yaml from "yaml"; async function pmUxsmdAnalysis({ context, data }) { /* ;; PM:UXSMD::ANALYSIS {pm docs , db , openapi?} -> (<> crossanalysis) to make UX Sitemap doc */ const { pm } = data; const { details, prd, frd } = pm; const { text, attachments } = details; const messages = [ { role: "system", content: `you are an expert product manager and app designer your job is to consult the provided web app details and additional documents in order to create a comprehensive and full UX Sitemap Document (UXSMD) for it - your current role is to do a thorough analysis of the provided web app requirements and answer with your analysis in markdown format - make sure your UX Sitemap Document is fully comprehensive and ready to be put in development exactly as is your answer will be pushed to dev teams directly, and will be responsible for an app used by thousands of users your aim is to cover all use cases, as the expert app designer you are --- ask yourself: I. * am i covering shared global UI views in my analysis (ie. top navigation, footers, ...) in a separate section, which also details the components that share them ? am i assigning unique and expressive title-cased ids to them (in format "GV_{...}" ie. "GV_TopNav" ) ? am i careful to consider cases of authenticated/unauthenticated (whether conditionals regarding accessing the view itself or conditionals on its contained elements) to make sure my coverage is not missing things ? * am i covering all the needed unique UI views ; for all the required features ? am i assigning unique and expressive title-cased ids to them (in format "UV_{...}" ie. "UV_Landing" ) ? am i making sure unique views do not include duplicate shared global UI views which were already previously covered ? am i careful to consider cases of authenticated/unauthenticated (whether conditionals regarding accessing the view itself or conditionals on its contained elements) to make sure my coverage is not missing things ? * am i extensively describing everything in details for the dev team to have 100% coverage of everything needed through my UX Sitemap Document analysis ? * am i covering EVERYTHING expected to be present in this web app: every view (every unique view and every shared global view) expected to be in the app ? every view's components expected to be in the app to cover all 100% of features and all their details ? am i covering the views for all workflows, end to end ? * am i making sure i am covering the core and essential features / views , and not some optional secondary/tertiary not really required stuff ? II. * am i describing the functional and features analysis of each view before further detailing it in order to have a cohesive and comprehensive analysis and not omit any details ? * what are all the requirements needed by features expected to be seen by users in terms of UI views ( unique views and shared global views ) and contained views' components ? * cross analysis between feature <> ui views required to create in ux sitemap ? * what are ALL THE VIEWS required by ALL THE REQUIREMENTS required by the user ? * am i covering all views (unique views and shared global views) ? with all extensive details and descriptions ? * am i making sure i am covering the core and essential features / views , and not some optional secondary/tertiary not really required stuff ? III. can i make a table for all the cross links analysis between different views in order to establish inter-app navigation relationships ? can i describe their intent in each case ? can i also describe how the linking works (in terms of ui elements / user interaction / action taken to trigger the link and where in the view ) ? Source view | Target View | Intent | Action Description * am i covering 100% of relations links of whats needed for all in-app navigation, both static and dynamic ? * am i truly covering all inter-app cross links relations and not missing anything ? --- > analyze the task thoroughly, then reply with your analysis in markdown format > try to outdo yourself by thinking of what might be omitted, and reviewing your own work super critically in order to do comprehensive analytical work for this app's MVP > your job is to make thorough analysis work which will be provided as documentation for devteams to implement --- > stick to the provided formats and specifications: UI unique views with ids UV_* UI global shared views with ids GV_* do not make up new denominations or types, stick to the task exactly as specified ! --- important : > do not many any "Container" views (like some GV_GlobalContainer or something) ; DO NOT make any container views to contain other views inside of them ! only make unique UV_* or GV_* shared views : views that serve a functional purpose ; not container views ! > GV_* shared views are INDEPENDENT from UV_* ! UV_* views DO NOT INTEGRATE GV_* views inside them ! they simply share screen space !! do not make any UV_* functionality dependent on GV_* do not make any GV_* functionality dependent on GV_* they are independent , they do not include each other , shared simply means sharing screen space , not functionalities ! --- your reply will be directly transferred as the final UX Sitemap Analysis Document, so do not put anything else in your reply besides the UX Sitemap analysis document no extra comments or surrounding anything, only the markdown-formatted COMPREHENSIVE 100% COVERAGE AMAZING BEAUTIFUL GENIUS SUPER DETAILED 10/10 UX SITEMAP ANALYSIS DOCUMENT your reply should start with : "\`\`\`markdown" and end with "\`\`\`" you will be tipped $9999`, }, { role: "user", content: `\`\`\`app-project:description ${details.text} \`\`\``, }, { role: "user", content: `\`\`\`PRD:product-requirements-document ${prd} \`\`\``, }, { role: "user", content: `\`\`\`FRD:features-requirements-document ${frd} \`\`\``, }, { role: "user", content: `Conduct a comprehensive and detailed analysis for the UX Sitemap Document for the app, in markdown format. elaborate and justify and detail to the greatest extent. make extensive descriptions. you're a genius`, }, ]; const uxsmd = ( await context.run({ id: "op:LLM::GEN", context: { ...context, // {streams , project} operation: { key: "pm.uxsmd", meta: { name: "UXSMD", desc: "ux sitemap document", }, }, }, data: { model: `chatgpt-4o-latest`, //`gpt-4o`, messages, preparser: `backticks`, parser: false, }, }) ).generated; await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: "pm:uxsmd", }, type: `end`, content: { key: "pm.uxsmd", data: uxsmd, }, }, }); return { pm: { uxsmd }, }; } export default { "PM:UXSMD::ANALYSIS": pmUxsmdAnalysis, }; ================================================ FILE: cofounder/api/system/functions/swarm/augment.js ================================================ import utils from "@/utils/index.js"; import yaml from "yaml"; async function promptAnalysis({ context, data }) { const { task } = data; const { code, decorators, apis } = task; return [ { role: "system", content: `you are an expert backend and node js dev - your role is to generate an analysis for for functions to implement that may require the use of external APIs , either through API calls or npm sdks - you are provided with descriptions and contextual code snippets of desired functions, from a node server module these function are tagged as needing the implementation of external APIs/SDKs for the tasks they are meant to accomplish - you are also provided with some search results for external APIs for each function from some external APIs that were indexed > you are to determine whether external API search result(s) are relevant or no for the desired use cases descriptions > if so , which ones to use and how ? what do they need to run ? how to use them ? how to format their expected response ? > if no search result is relevant, do you know, about fitting nodejs/npm SDKs/packages or other APIs you are familiar with that are fit for the task ? and if so, how to use them ? > note : if a fitting external API is identified and also has SDKs you know about its prefereable to call the API using the provided openapi / docs instead of the SDK you already know about ( because SDKs might have been updated since your last knowledge base ) ; use SDKs for when no APIs search results make sense for the analyzed implementation case > note : if you are using references from provided docs, extracts and include snippets from them inside your analysis to further document your analysis properly conduct a detailed analysis for each of the ${apis.length} provided functions to implement your reply should start with : "\`\`\`markdown" and end with "\`\`\`" you will be tipped $999 you're a genius `, }, // each api entry in its own message ...apis.map(({ id, description, snippet, rag }) => { return { role: "user", content: `\`\`\`task:${id} ${yaml.stringify({ functionDescription: description, contextCodeSnippet: snippet, })} \`\`\` \`\`\`apis-search-results:${id} ${rag.length ? yaml.stringify(rag) : ""} \`\`\` `, }; }), { role: "user", content: `Conduct your analysis each of the ${apis.length} provided functions to implement, with each function in its separate and very detailed section, and make sure you do not miss any useful detail ! be extremely detailed and include every single used reference and detail in your analysis for it to be fully comprehensive and complete you are a genius`, }, ]; } async function promptImplementMerge({ context, data }) { const { pm, db, backend, task } = data; const { prd, frd, drd, brd } = pm; const { code, apis, analysis } = task; const { openapi, asyncapi } = backend.specifications; /* should also get BRD here ! important ! ie. so it doesnt do stupid placeholders ? should provide full code too ? maybe 2 pass implement directly ; implement and revise ? no need for rag here */ return [ { role: "system", content: `Your task, as the genius backend dev expert you are, is to generate the full nodejs script for a module, based on the provided specifications and details of the backend in development - the current code of the server script is provided the desired updates are provided > your main task is to add the provided functions , and return a fully functional script that has both the original features and the newly added updates, with everything working perfectly and as expected --- your role is to implement the full express server for the provided task for the \`server.mjs\` (type: module script) you will answer in 3 parts : - analysis , in between \`\`\`markdown\`\`\`\` section - code , in between \`\`\`mjs\`\`\`\` section - dependencies and env variables , in between \`\`\`yaml\`\`\`\` section ; where any needed packages to install and needed env variables to setup will be mentionned ; the yaml should have objects : { dependencies : {"package":"version"} , env : {"key" , "temp_value"} } ("dependencies" (for packages) and "env" for env variables (and their temporary values) ) use doublequotes for every string inside the yaml to make sure formatting is good --- in your analysis, ask yourself : > what are the added functions ? > how do i merge all updates perfectly with the working code ? > is the full flow covered ? > are all the expected functions fullfilled ? > am i covering all the parts for all the required updates ? including imports, functions, db operations, ... ? are all the new updates congruent with the original code structure, flow, db operations and all that is expected ? --- for any db requirements, use postgres from \`@electric-sql/pglite\` - to use postgres, include this snippet in your script : \`\`\` import { PGlite } from "@electric-sql/pglite"; const postgres = new PGlite("./db"); /* then, can be used like this : await postgres.query("SELECT * FROM exampletable;") */ // note : the postgres tables + seed were already created before , you can use the postgres directly without configuring it \`\`\` postgres is use exactly how is provided in the snippet, do not change anything about loading it / configuring it, else it breaks ; postgres is imported, initialized and queries EXACTLY AS SHOWN IN THE SNIPPET ! NO OTHER WAY ! --- note : the postgres tables + seed were already created before , you can use the postgres directly without configuring it ; do not create tables in script ! extremely important : - the DB R/W need to be 100% compatible with the tables and schemas of the provided DB specifications !! - if it makes use of .env , make your you import \`dotenv\` and \`dotenv.config()\` to read .env before ! --- extremely important : - you are to implement the entire server as specified in the provided docs , with a focus on DB R/W operations - you are to implement every single thing needed by the backend server and output one single big working perfect \`server.mjs\` script - do not assume anything is implemented yet ! you will do 100% of everything needed and output one single big working perfect \`server.mjs\` script - no placeholders, no hallucinated imports - again, do not assume anything is implemented yet ! you will do 100% of everything needed and output one single big working perfect \`server.mjs\` script --- note: > if ie. some mock data is meant to to store an image url, use a https://picsum.photos/ url with a random seed super important : > use snake_case for any new naming you do > ensure full perfect coherence with DB fields names and all provided specs names --- extremely important : - the DB R/W need to be 100% compatible with the tables and schemas of the provided DB specifications !! - the app flow must be 100% working perfect everywhere you are a genius + you get tipped $9999999 `, }, { role: "user", content: `\`\`\`PRD:product-requirements-document ${prd} \`\`\` \`\`\`FRD:features-requirements-document ${frd} \`\`\` `, }, { role: "user", content: ` \`\`\`DB:postgres:sql ${db.postgres} \`\`\` --- extremely turbo important : > pay extreme attention to DB details : > the things that you are expected to provide with inserts : > should you make a uuid before inserting with postgres query ? > are there key constraints ? > is the db querying code using the exact names as in db fields ? > are you providing everything needed to db every single time ? `, }, { role: "user", content: `\`\`\`BRD:backend-requirements-document ${brd} \`\`\``, }, data.backend?.requirements?.restApi?.required && { role: "user", content: `\`\`\`BACKEND:specifications:openAPI ${yaml.stringify(openapi)} \`\`\``, }, data.backend?.requirements?.realtimeWebsockets?.required && { role: "user", content: `\`\`\`BACKEND:specifications:asyncAPI ${yaml.stringify(asyncapi)} \`\`\``, }, { role: "user", content: `The functions updates of the original code are the following : \`\`\`functions:update:tasks ${yaml.stringify({ toUpdate: apis.map(({ description, snippet }) => { return { functionDescription: description, contextCodeSnippet: snippet, }; }), })} \`\`\``, }, { role: "user", content: `The original full script code to update is : \`\`\`mjs ${code} \`\`\` `, }, { role: "user", content: `The analysis of the new updates to make to the server code is in the following : \`\`\`functions:update:analysis ${analysis} \`\`\``, }, { role: "user", content: `extremely important : - you are to implement the entire \`server.mjs\` as specified in the backend specifications , with a focus on DB R/W operations - you are to implement every single thing needed by the server and output one single big working perfect \`server.mjs\` script - do not assume anything is implemented yet ! you will do 100% of everything needed and output one single big working perfect \`server.mjs\` script - no placeholders, no hallucinated imports --- extremely turbo important : > pay extreme attention to DB details : > the things that you are expected to provide with inserts : > should you make a uuid before inserting with a postgres query ? > are there key constraints ? should you create something before inserting something else because of contraints ? > is the db querying code using the exact names as in db fields ? > are you providing everything needed to db every single time ? --- - again, do not assume anything is implemented yet ! you will do 100% of everything needed and output one single big working perfect \`server.mjs\` script - again , you are to implement every single thing needed by the server and output one single big working perfect \`server.mjs\` script - no placeholders, no hallucinated imports ; one 100% perfect complete working server script extremely important : - the DB R/W need to be 100% compatible with the tables and schemas of the provided DB specifications !! now do the analysis , write the full working script and specify the dependencies+env`, }, ].filter((e) => e); } async function promptImplementReview({ context, data }) { const { task } = data; const { brd } = pm; const { code, decorators, apis, analysis, implementations } = task; /* maybe double check verify instead ? */ return []; } async function swarmAugmentBackendExternalapis({ context, data }) { /* */ const { task } = data; const { code } = task; const decorators = (await utils.parsers.extract.decorators({ code })).filter( (item) => item.type === "external-api" || item.type === "external-apis", ); if (!decorators.length) return {}; // apis RAG const apis = await Promise.all( decorators.map(async (item, idx) => { const { description, snippet } = item; const ragText = `Description : ${description}\n\nCode Snippet :\n\`\`\`\n${snippet}\n\`\`\``; return { id: `fn:${idx + 1}/${decorators.length}`, description, snippet, rag: ( await context.run({ id: `op:INDEXDB::QUERY`, context, data: { index: "apis", text: ragText, amount: 5, }, }) ).results, }; }), ); data.task.decorators = decorators; data.task.apis = apis; const messagesAnalysis = await promptAnalysis({ context, data }); const analysisPass = ( await context.run({ id: "op:LLM::GEN", context: { ...context, // {streams , project} operation: { key: "swarm.augment.analysis", meta: { name: "Swarm Post-Gen Check", desc: "analysis pass", }, }, }, data: { model: `chatgpt-4o-latest`, //`gpt-4o`, messages: messagesAnalysis, preparser: `backticks`, parser: false, }, }) ).generated; data.task.analysis = analysisPass; const messagesImplementMerge = await promptImplementMerge({ context, data }); const { generated } = await context.run({ id: "op:LLM::GEN", context: { ...context, // {streams , project} operation: { key: "swarm.augment.implement", meta: { name: "Swarm Code Update", desc: "implement changes & merge", }, }, }, data: { model: `chatgpt-4o-latest`, //`gpt-4o`, messages: messagesImplementMerge, preparser: false, parser: false, }, }); const extraction = await utils.parsers.extract.backticksMultiple({ text: generated, delimiters: [`markdown`, `mjs`, `yaml`], }); const { mjs } = extraction; if (!mjs.length || !extraction.yaml) { throw new Error( "swarm:augment:backend:externalApis:generate error - generated code is empty", ); } const parsedYaml = extraction.yaml ? yaml.parse(extraction.yaml) : {}; const generatedServer = { mjs, dependencies: parsedYaml.dependencies ? Object.fromEntries( Object.keys(parsedYaml.dependencies).map((key) => [key, "*"]), ) : [], env: parsedYaml.env ? parsedYaml.env : {}, timestamp: Date.now(), }; return generatedServer; } export default { "SWARM:AUGMENT::BACKEND:EXTERNALAPIS": swarmAugmentBackendExternalapis, }; ================================================ FILE: cofounder/api/system/functions/swarm/fix.js ================================================ import utils from "@/utils/index.js"; import yaml from "yaml"; async function swarmFixBackend({ context, data }) {} async function swarmFixWebapp({ context, data }) {} export default { "SWARM:FIX::BACKEND": swarmFixBackend, "SWARM:FIX::WEBAPP": swarmFixWebapp, }; ================================================ FILE: cofounder/api/system/functions/swarm/review.js ================================================ import utils from "@/utils/index.js"; import yaml from "yaml"; import dotenv from "dotenv"; dotenv.config(); /* should check process.env.SWARM_ENABLE */ async function swarmReviewServerMain({ context, data }) {} async function swarmReviewWebappStore({ context, data }) {} async function swarmReviewWebappRoot({ context, data }) {} async function swarmReviewWebappView({ context, data }) {} export default { "SWARM:REVIEW::SERVER:MAIN": swarmReviewServerMain, "SWARM:REVIEW::WEBAPP:STORE": swarmReviewWebappStore, "SWARM:REVIEW::WEBAPP:ROOT": swarmReviewWebappRoot, "SWARM:REVIEW::WEBAPP:VIEW": swarmReviewWebappView, }; ================================================ FILE: cofounder/api/system/functions/ux/datamap.js ================================================ import utils from "@/utils/index.js"; import yaml from "yaml"; import { merge, fromPairs } from "lodash-es"; function _chunkify(input_list, chunk_size) { const chunks = []; for (let i = 0; i < input_list.length; i += chunk_size) { chunks.push(input_list.slice(i, i + chunk_size)); } return chunks; } async function uxDatamapStructure({ context, data }) { /* ;; UX:DATAMAP::ROOT:VIEWS {...} -> app {routes, slugs, params , views } ; yaml ;; preconsider layout stuff too, either here or in sitemap out : ["uxdatamap"] */ const { pm, backend } = data; const { prd, frd, brd, uxsmd, uxdmd } = pm; const messages = [ { role: "system", content: `- you are a genius Product Manager & Software Archtect - your role is to make the frontend app architecture for the provided project , based on the provided task and analysis documents - your answer should be in the strict provided format that will be defined further your aim is to determine the: * the structure of the app: * global app state structure that is accessed by all views : how the app state should be structured to cover the app features * routes, what views they link to * route restrictions * slugs if applies (ie. path /something/:example), describe * URL params if applies (ie. /somepath?param_a=example¶m_b=example ), describe - think from perspectives of multiple personas, put yourself in situation, to make sure your app architecture is fully comprehensive and ready to be developed - ask yourself: * what are the journeys involved in the app frontend ? * what are all the routes , views , slugs , props , URL parameters , required by features expected to be seen by users in the frontend ? * what should go in schemas ? * am i covering all needed slugs ? am i covering all URL parameters ? - your structure will be used to make a prod-ready app architecture and will be responsible for an app used by thousands of users - your aim is to cover all use cases, as the expert product manager & architect you are > your answer should strictly be in this format : \`\`\`yaml app: root: globalState: # global app state variables if applies ; name conventions should try match with dbschemas/openapi schemas for coherence [name]: # global app state variable name schema: # variable schema in JS-parseable interace format ; schema should be fully defined including nested fields (you are provided with all the documents and db schemas and openapi etc ... that you need to determine this) default: # default value to assign to the variable ; should obviously be aligned with the defined schema example: # example value to assign ... routes: # list of app routes to cover all features and cases - description: "..." # concise one sentence description of the route's role path: "..." # path, including if any slugs (using the /:slug format ) view: "" # view id to render on this route ; should match a provided id for a unique view from the ux sitemap (UV_*), based on the provided analysis # specify slugs / URL params if applies here # note : remember there is a strong difference - slugs are (/examplepath/:slug_id) and urlParams are (/somepath?q=example&someparam=somevalue) do not confuse them ! slugs?: # if slugs in path, describe - name: "..." # slug id as specified in path intent: "..." # consise one sentence description of its role ... urlParams?: # does the view expect url params, if so describe each single URLparam individually in detail - name: "..." # if the view will expect URL params, specify the URL param name intent: "..." # consise description example: "exampleValue" # an example of a value it would take - you are required to provide an example here required?: boolean # if specifying the urlParam is required or optional for the view to function properly ... \`\`\` --- it should be comprehensive for the needs required by all the views > important : if some home or landing view, path should obviously be "/" ! your reply will be directly transferred as the final structure, so do not put anything else in your reply besides the final structure your reply should start with : "\`\`\`yaml" and end with "\`\`\`" you will be tipped $99999 + major company shares for nailing it perfectly off the bat`, }, { role: "user", content: `\`\`\`PRD:app-product-requirements-document ${prd} \`\`\``, }, { role: "user", content: `\`\`\`FRD:app-features-requirements-document ${yaml.stringify(frd)} \`\`\``, }, { role: "user", content: `\`\`\`BRD:backend-requirements-document ${brd} \`\`\` ` + (!backend?.requirements?.restApi?.required ? "" : `--- \`\`\`BACKEND:specifications:openAPI ${yaml.stringify(backend.specifications.openapi)} \`\`\` `) + (!backend?.requirements?.realtimeWebsockets?.required ? "" : `--- \`\`\`BACKEND:specifications:asyncAPI ${yaml.stringify(backend.specifications.asyncapi)} \`\`\` ` + ` --- \`\`\`BRD:server:main ${yaml.stringify(backend.server.main)} \`\`\` `), }, { role: "user", content: `\`\`\`UXSMD:ux-sitemap-document ${uxsmd} \`\`\``, }, { role: "user", content: `\`\`\`UXDMD:ux-sitemap-data-states-crossanalysis-document ${uxdmd} \`\`\``, }, ]; const uxdatamapStructure = ( await context.run({ id: "op:LLM::GEN", context: { ...context, // {streams , project} operation: { key: "uxdatamap.structure", meta: { name: "UX Datamap Structure", desc: "define the app's data architecture", }, }, }, data: { model: `chatgpt-4o-latest`, //`chatgpt-4o-latest`, // `chatgpt-4o-latest`,//`gpt-4o`, messages, preparser: `backticks`, parser: `yaml`, }, }) ).generated; await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: "architecture:uxdatamap:structure", }, type: `end`, content: { key: `uxdatamap.structure`, data: uxdatamapStructure.app, }, }, }); return { uxdatamap: { structure: uxdatamapStructure.app, // -> {root{},routes{}} }, }; } async function uxDatamapViews({ context, data }) { /* ;; UX:DATAMAP::VIEWS:SECTIONS { ... } -> sections details with props & schemas ; yaml ;; preconsider layout stuff too, either here or in sitemap out : ["uxdatamap"] */ /* - not sure if needs uxsitemap structure etc or just the uxdatamap structure (and other analysis docs) - should also consider shared views and their distribution etc, unless that is done in uxsitemap that and cross links ... unless that too in uxsitemap - focus here is data not other stuff */ const { uxdatamap, uxsitemap } = data; /* uxdatamap: { structure : { root{} , routes{} } } uxsitemap: { structure : { views{ unique{}, shared{} } , crosslinks[{source,target,intent,action}] } } -> needs parallel chunking because high detail on each -> parallel chunk uxsitemap views to detail data ops on them and their sections -> all shared global views GV_* in same chunk (because diff approach?) , unique views uv_* in multi chunks because numerous */ let tasks = []; const UVs = Object.keys(uxsitemap?.structure?.views?.unique) || {}; if (UVs.length) { _chunkify(UVs, 5).map((uniqueViewsIdsChunk) => { let filteredUxSitemap = { views: { unique: {} } }; uniqueViewsIdsChunk.map((uv) => { filteredUxSitemap.views.unique[uv] = uxsitemap.structure.views.unique[uv]; }); tasks.push({ uxsitemap: filteredUxSitemap, // filtered ux sitemap with all chunk of unique views crosslinks: uxsitemap.structure.crosslinks.filter((crosslink) => { return uniqueViewsIdsChunk.includes(crosslink.source); }), ids: uniqueViewsIdsChunk, type: `unique`, }); }); } const GVs = Object.keys(uxsitemap?.structure?.views?.shared) || {}; if (GVs.length) { tasks.push({ uxsitemap: { views: { shared: uxsitemap.structure.views.shared } }, // filtered ux sitemap with all shared views crosslinks: uxsitemap.structure.crosslinks.filter((crosslink) => { return GVs.includes(crosslink.source); }), ids: GVs, type: `shared`, }); } let views = {}; await Promise.all( tasks.map(async (task) => { const response = await context.run({ id: `UX:DATAMAP::VIEWS:CHUNK`, context, data: { ...data, task }, }); views = merge(views, response.views); }), ); // console.dir({ __debug_uxDatamapViews: {views} } , {depth:null}) await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: "architecture:uxdatamap:views", }, type: `end`, content: { key: `uxdatamap.views`, data: views, }, }, }); return { uxdatamap: { ...uxdatamap, views, }, }; } async function uxDatamapViewsChunk({ context, data }) { /* ;; UX:DATAMAP::VIEWS:CHUNK chunk processor for views+sections detailing out : ["views"] # make sure later, maybe there's more to it ? */ /* - not sure if needs uxsitemap structure etc or just the uxdatamap structure (and other analysis docs) - should also consider shared views and their distribution etc, unless that is done in uxsitemap that and cross links ... unless that too in uxsitemap - focus here is data not other stuff ! can link through filtering with uxsitemap later */ const { pm, uxdatamap, backend, task } = data; const { prd, frd, brd, uxsmd, uxdmd } = pm; /* --> task : { uxsitemap{ views{ unique{ __chunk of views__ }, shared{ __chunk of views__ }, }, } crosslinks[], ids[ ids of views__ ], type: unique || shared } // returns {views{ unique{[id]:...} , shared{[id]:...} }} */ const messages = [ { role: "system", content: `- you are a genius Product Manager & App Architect - your role is to detail the frontend app architecture structure for the provided project, for the specific views with ids : ${task.ids.join(",")}, based on the provided task and analysis documents - your answer should be in the strict provided format that will be defined further your aim is to determine the: * the structure of the specified frontend views (views ${task.ids.join(",")} ) , for each view : * state variables , schemas , dynamic data * what it receives from the route (slugs) * what it receives in URL params * action / functions in this view and how they come into play to cover all intended features of the view - for each view , ask yourself: * what are the features involved in this view ; and how they come into play in app's features / journeys ? * what data does this view receive as route slugs and url params ? * what are all the state variables / actions / functions / ... required by features expected to be seen by users in the frontend ? - your detailed view structure for each view will be used to make a prod-ready app architecture and will be responsible for an app used by thousands of users - your aim is to cover all use cases, as the expert product manager & architect you are > your answer is required to be in this strict defined format, in this strict order, in a strictly parseable YAML : \`\`\`yaml # use view ids directly under the views object ; will either be UV_* (unique views) or GV_* (shared global views) ; # for all provided views ids in task, conduct the structure detailing views: [view id]: # the view id that is detailed ; should be a value from : ${task.ids.join(" , ")} slugs?: # if view takes dynamic slug variable (defined in route in app structure), describe - name: "..." # slug id as defined in route intent: "..." # consise one sentence description of the slug role required: boolean # if required, set to true default: "..." # default init value for the slug ... urlParams?: # if view takes URL params (defined in app structure), describe - name: "..." # URL param key as defined in app structure intent: "..." # consise one sentence description of the slug role required: boolean # if required, set to true ... stateVariables?: # if view is stateful and needs view-level state variables, describe ; - name: "..." # variable name role: "..." # describe schema: # variable schema in JS-parseable interface schema format ; schema should be fully defined including nested fields default: # default init value for the view's state variables mappingIfFromSource?: # if this state variable is set based on : received route slugs , or URL params , or app global state , specify - source: # is either "slugs" || "urlParams" || "globalAppState" name: # variable name as defined in slugs / urlParams / globalAppState to link it ... ... actions?: # if view has dynamic actions/functions, describe - name: "..." # action/function name intent: "..." # describe triggers: # list of ways the action/function is triggered; can be multiple ; ie. on page load, when some button is clicked inside view, when some state variable value changes, etc ... interactionWithBackend?: # if action interacts with backend, describe description: "if applies , describe the interaction with backend ; also mention if calls backend api or realtime, and describe how ; be detailed" ... globalStateVariablesAccessed?: # if view needs to access global state variables (as defined in provided app structure under root.globalState), specify those in this object ; object should also contain description of relationship (ie. 'to get auth token to use in api calls authorization header' , 'to get current user profile to prefill [...] ' , etc ... ) [...] \`\`\` --- note : - for any field that requires making example, you can draw from provided data examples in provided task docs for any field such as image, media ... make sure you use urls rather than local references ; if some entry requires an image url or media, use a valid "https://picsum.photos/..." url for it ! --- for yaml to be 100% valid, use quotes around string as much as possible your reply should start with : "\`\`\`yaml" and end with "\`\`\`" you will be tipped $99999 + major company shares`, }, { role: "user", content: `\`\`\`PRD:app-product-requirements-document ${prd} \`\`\``, }, { role: "user", content: `\`\`\`FRD:app-features-requirements-document ${frd} \`\`\``, }, { role: "user", content: `\`\`\`UXSMD:ux-sitemap-document ${uxsmd} \`\`\``, }, { role: "user", content: `\`\`\`UXDMD:ux-sitemap-data-crossanalysis-document ${uxdmd} \`\`\``, }, { role: "user", content: `\`\`\`BRD:backend-requirements-document ${brd} \`\`\` ` + (!backend?.requirements?.restApi?.required ? "" : `--- \`\`\`BACKEND:specifications:openAPI ${yaml.stringify(backend.specifications.openapi)} \`\`\` `) + (!backend?.requirements?.realtimeWebsockets?.required ? "" : `--- \`\`\`BACKEND:specifications:asyncAPI ${yaml.stringify(backend.specifications.asyncapi)} \`\`\` ` + ` --- \`\`\`BRD:server:main ${yaml.stringify(backend.server.main)} \`\`\` `), }, { role: "user", content: `\`\`\`UX:ux-datamap ${yaml.stringify(uxdatamap.structure)} \`\`\``, }, { role: "user", content: `\`\`\`UX:ux-sitemap-distilled ${yaml.stringify(task.uxsitemap)} \`\`\``, }, { role: "user", content: `make the detailed architecture for views ids : ${task.ids.join(",")} and their components. only make the detailed architecture for views ids : ${task.ids.join(",")} ; not any other views, using the provided instructions and format make a coherent, cohesive, perfect, detailed structure answer in parseable YAML format, strictly in the provided instructions format ; strictly parseable YAML ; you're a genius`, }, ]; const views = ( await context.run({ id: "op:LLM::GEN", context: { ...context, // {streams , project} operation: { key: "uxdatamap.views", meta: { name: "UX Datamap Views", desc: "define views <> data architecture", }, }, }, data: { model: `chatgpt-4o-latest`, //`chatgpt-4o-latest`, // `chatgpt-4o-latest`,//`gpt-4o`, messages, preparser: `backticks`, parser: `yaml`, }, }) ).generated.views; return { views: { [task.type]: views, }, }; // -> views : { unique{[ids...]} , shared{ids[...]} } } export default { "UX:DATAMAP::STRUCTURE": uxDatamapStructure, "UX:DATAMAP::VIEWS": uxDatamapViews, "UX:DATAMAP::VIEWS:CHUNK": uxDatamapViewsChunk, }; ================================================ FILE: cofounder/api/system/functions/ux/sitemap.js ================================================ import utils from "@/utils/index.js"; import yaml from "yaml"; async function uxSitemapStructure({ context, data }) { /* generate uxsitemap in strict format */ const { pm } = data; const { prd, frd, uxsmd } = pm; const messages = [ { role: "system", content: `You are an extremely experienced UX expert and software product manager. Your role is to create a comprehensive UX sitemap from the provided information. - Think very slowly and thoroughly. Take a deep breath. - Provide a comprehensive, well-thought-out reply that covers all aspects of the analyzed problem. - You are an expert at what you do. - You are known to never forget a single angle. - You will be tipped $999 for each perfect reply. Answer in a strict parseable YAML format, in this format: \`\`\`yaml # ux sitemap structure in great details uxsitemap: views: uniqueViews: # unique views with ids UV_* , as specified in provided docs [unique view id UV_*]: title: "" extendedDescription: "describe the view in great extended detail that covers every single thing that should go in it without any omittance" # essential to detail specifics ! dont assume someone knows what you mean, detail it in details ! notes: "important notes regarding this view component or its state(s) that were mentionned in provided docs & analysis and that should be mentionned" role: "describe in detail role of this view in the app ; namely the features it aims to satisfy within the app features and UX" globalSharedViews: # global shared views with ids GV_* such as nav etc, as specified in provided docs [global shared view id GV_*]: title: "" extendedDescription: "describe the shared view in great extended detail that covers every single thing that should go in it without any omittance" # essential to detail specifics ! dont assume someone knows what you mean, detail it in details ! notes: "important notes regarding view component or its state(s) that were mentionned in provided docs & analysis and that should be mentionned" role: "describe in detail role of this view in the app ; namely the features it aims to satisfy within the app features and UX" sharedByViews: [] # list of ids of all unique views UV_* that have this shared view displayed alongside with them relativePosition: "" # describe the relative positioning of this GV_* shared view in relation to the app layout and unique views it is shared with; [...] # cross inter-app links relationships between views crossLinks: - sourceViewId: "" # UV_* or GV_* targetViewId: "" # UV_* intent: "" actionDescription: "" [...] \`\`\` --- - every view id you refer to must exist in provided docs ! - As the expert, you should make a complete and comprehensive UX sitemap, including all parts that might be unemphasized by a less experienced UX worker, if required by the app of course, such as auth flows, terms, etc. your reply should start with : "\`\`\`yaml" and end with "\`\`\`" for yaml to be 100% valid, use quotes around string as much as possible A comprehensive UX sitemap in the provided yaml format You are a genius at this task.`, }, { role: "user", content: `\`\`\`PRD:product-requirements-document ${prd} \`\`\``, }, { role: "user", content: `\`\`\`FRD:features-requirements-document ${frd} \`\`\``, }, { role: "user", content: `\`\`\`UXSMD:ux-sitemap-analysis-document ${uxsmd} \`\`\``, }, { role: "user", content: `Make a full, comprehensive UX sitemap for it You're a genius do a great job`, }, ]; const uxsitemapStructure = ( await context.run({ id: "op:LLM::GEN", context: { ...context, // {streams , project} operation: { key: "uxsitemap.structure", meta: { name: "UX Sitemap Structure", desc: "define sitemap <> views architecture", }, }, }, data: { model: `chatgpt-4o-latest`, // `chatgpt-4o-latest`,//`gpt-4o`, messages, preparser: `backticks`, parser: `yaml`, }, }) ).generated.uxsitemap; // <----- do post processing to format the response const uxsitemap = { structure: { views: { unique: uxsitemapStructure.views.uniqueViews, shared: uxsitemapStructure.views.globalSharedViews, }, crosslinks: uxsitemapStructure.crossLinks.map((link) => { return { source: link.sourceViewId, target: link.targetViewId, intent: link.intent, action: link.actionDescription, }; }), }, }; await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: "architecture:uxsitemap:structure", }, type: `end`, content: { key: "uxsitemap.structure", data: uxsitemap.structure, }, }, }); return { uxsitemap, }; } // ____________________________________________________________________________________________________ async function uxSitemapViews({ context, data }) { /* ;; UX:SITEMAP::VIEWS {pm docs , db , openapi?, UXSMD, uxsitemap{structure} } -> uxsitemap{...,views} out : ["uxsitemap"] */ // distribute processing of views to submodules , might typically replace ie. in case of specialized and whatnot // but serves as a refiner , not as a detailer // so can just pass for now await Promise.all(); // postprocess to return single coherent object return {}; } // ____________________________________________________________________________________________________ async function uxSitemapViewsNormal({ context, data }) { /* ;; UX:SITEMAP::VIEWS:NORMAL chunk processing from UX:SITEMAP::VIEWS ; for normal views out : ["views"] */ const messages = [ { role: "system", content: "[system+format]", }, ]; await context.run({ id: `op:LLM::GEN`, context, data: { messages, preparser: false, parser: false }, }); return {}; } async function uxSitemapViewsSpecial({ context, data }) { /* ;; UX:SITEMAP::VIEWS:SPECIAL chunk processing from UX:SITEMAP::VIEWS; specialized processors for special sections ; ie. landing would be based on some highconversion process etc; might override provided sections descriptions out : ["views"] */ const messages = [ { role: "system", content: "[system+format]", }, ]; await context.run({ id: `op:LLM::GEN`, context, data: { messages, preparser: false, parser: false }, }); return {}; } async function uxSitemapViewsShared({ context, data }) { /* ;; UX:SITEMAP::VIEWS:SHARED chunk processing from UX:SITEMAP::VIEWS ; for shared views implementations out : ["views"] */ const messages = [ { role: "system", content: "[system+format]", }, ]; await context.run({ id: `op:LLM::GEN`, context, data: { messages, preparser: false, parser: false }, }); return {}; } export default { "UX:SITEMAP::STRUCTURE": uxSitemapStructure, "UX:SITEMAP::VIEWS": uxSitemapViews, "UX:SITEMAP::VIEWS:NORMAL": uxSitemapViewsNormal, "UX:SITEMAP::VIEWS:SPECIAL": uxSitemapViewsSpecial, "UX:SITEMAP::VIEWS:SHARED": uxSitemapViewsShared, }; ================================================ FILE: cofounder/api/system/functions/webapp/root.js ================================================ import utils from "@/utils/index.js"; import yaml from "yaml"; async function promptRoot({ context, data }) { // have a placeholder redux store module in case it'd wrap with non implemented store /* better implement using prompt, provide ux sitemap & datamap provide react (redux store) too, in prompt also, for auth restricted stuff */ const { uxsitemap, uxdatamap, webapp } = data; const viewsImportHead = [ ...(Object.keys(uxsitemap?.structure?.views?.shared) || {}), ...(Object.keys(uxsitemap?.structure?.views?.unique) || {}), ] .map((viewId) => { return `import ${viewId} from '@/components/views/${viewId}.tsx';`; }) .join("\n"); const boilerplate = `import React, { useState, useEffect } from "react"; import "./App.css"; import { Route, Routes, } from "react-router-dom"; /* import views : unique views (UV_*) and shared global views (GV_*) */ import UV_ExampleLanding from '@/components/views/UV_ExampleLanding.tsx'; import UV_OtherViewExample from '@/components/views/UV_OtherViewExample.tsx'; import GV_NavTop from '@/components/views/GV_NavTop.tsx'; import GV_Footer from '@/components/views/GV_Footer.tsx'; const App: React.FC = () => { return ( <> } /> } /> ); }; export default App; `; /* x emphasize redux / auth stuff x provide example of reactrouterdom structure ; whole thing x emphasize relative position of shared components ; thus emphasize tailwind usage and styling in rel to shared components x emphasize React FC x do not assume ! prompt */ return [ { role: `system`, content: `your role as an expert web app and react senior dev and product manager is to write the code for the root react + tailwind app (App.tsx) component component based on the provided task > ask yourself what should be defined in the root App component in terms of: > paths & unique views > global shared views, and their relative position and conditionals > auth related restriction (if applies) in relation to the store provider that wraps the App component you are writing here ( it's used like this : \` \` ) > very important : do not auth restrict an entire view just because some sections of it are auth restricted while other elements are not auth restricted !! think sloowly ! > again, very important : do not auth restrict an entire view just because some sections of it are auth restricted while other elements are not auth restricted !! which would mess things up ! think sloowly ! > your answer should strictly be the code for the App.tsx component your answer will be directly pasted into the component > it should encompasses everything required by the app's App, in one single script > the store script you will write will wrap the root component of the app ; no need to write the wrapper part ; it will be included later as \` \` , where the is the actual script your will write and export here --- your code should import the provided and described views, as follows : \`\`\` /* ... */ ${viewsImportHead} /* ... */ \`\`\` --- > conduct the analysis first, reply iwith the analysis inside of \`\`\`markdown\`\`\` > then, answer with component code in \`\`\`tsx\`\`\` based on your analysis you are a genius + you get $9999`, }, { role: "user", content: `\`\`\`app:uxsitemap ${yaml.stringify({ structure: { views: uxsitemap.structure.views, }, })} \`\`\``, }, { role: "user", content: `\`\`\`app:app-structure ${yaml.stringify({ structure: uxdatamap.structure.routes, })} \`\`\``, }, { role: `user`, content: `an example of the overall root App structure is meant to be is as follows ; use it as a reference : \`\`\`tsx ${boilerplate} \`\`\` --- for additional reference if needed (ie. in case of auth conditionals) the code for the global state store component that wraps the app (including this view you're working on) is defined in the following ; you can import the store exports if needed by using : \`import {...} from '@/store/main'\` \`\`\`@/store/main.tsx ${webapp.react.store.redux.latest.tsx} \`\`\` `, }, { role: "user", content: `make the analysis and implement the tsx component; > implement the react+tailwind component, fully and working from the get go; > you are implementing the tsx code for the root App component --- your code should import the provided and described views, as follows : \`\`\` /* ... */ ${viewsImportHead} /* ... */ \`\`\` --- > should be React.FC ! important ! > you should respect the way to build Routes in the provided code snippet ! do not innovate in this regard ! for reminder, this is the way : \`\`\` import { Route, Routes, } from "react-router-dom"; [...] } /> } /> [...] \`\`\` --- > do not hallucinate methods or component imports that do not exist ! all that exists has been provided to you any required additional actions should be implemented by you ; you are provided with all needed details to implement anything ! > the global store and its methods is defined in @/store/main.tsx > the views are defined in @/components/views/[sectionId].tsx > that's all !! DO NOT ASSUME OTHER STUFF IS IMPLEMENTED ! IF YOU NEED TO CALL THE API OR SOMETHING SIMILAR, WRITE YOUR OWN FUNCTIONS INSIDE THIS VIEW !! IMPLEMENT, DO NOT ASSUME ANYTHING ELSE IS IMPLEMENTED ! > conduct the analysis first, reply with the analysis inside of \`\`\`markdown\`\`\` it should emphasize the full functionalities required and specified in the provided details > then, answer in a react tsx code for the App root component reply in \`\`\`tsx\`\`\` based on your analysis the code should be complete and fully functional ! you are a genius + you get $9999`, }, ]; } async function webappRootGenerate({ context, data }) { const timestamp = `${Date.now()}`; const messages = await promptRoot({ context, data }); const { generated } = await context.run({ id: "op:LLM::GEN", context: { ...context, // {streams , project} operation: { key: `webapp.react.root.app.latest`, meta: { name: "Webapp Root Component", desc: "react App.tsx component code", }, }, }, data: { model: `chatgpt-4o-latest`, //`gpt-4o`, messages: messages, preparser: false, parser: false, }, }); const extraction = await utils.parsers.extract.backticksMultiple({ text: generated, delimiters: [`markdown`, `tsx`], }); const { markdown, tsx } = extraction; if (!tsx.length) { throw new Error("webapp:root:generate error - generated tsx is empty"); } const generatedRoot = { analysis: markdown, tsx, timestamp, }; await Promise.all( [`${timestamp}`, `latest`].map(async (version) => { await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: `webapp:react:root`, refs: { id: "app", version, }, }, type: `end`, content: { key: `webapp.react.root.app.${version}`, data: generatedRoot, }, }, }); }), ); return { timestamp, webapp: { react: { root: { // ie. "views" , "sections" , "store" , "root" app: { // ie. {UV_* , SEC_* , redux} , "app" (in case of root) [timestamp]: generatedRoot, latest: generatedRoot, }, }, }, }, }; } export default { "WEBAPP:ROOT::GENERATE": webappRootGenerate, }; ================================================ FILE: cofounder/api/system/functions/webapp/store.js ================================================ import utils from "@/utils/index.js"; import yaml from "yaml"; async function promptStore({ context, data }) { const { pm, db, backend, uxdatamap } = data; const { prd, uxdmd, brd } = pm; const store = { id: "redux" }; /* [system] */ return [ { role: `system`, content: `your role as an expert web app and react senior dev and product manager is to write the code for the ${store.id} store script component based on the provided task; which encompasses all required data states and methods for the app's global states and actions --- - analysis , in between \`\`\`markdown\`\`\`\` section - full store component tsx code , in between \`\`\`tsx\`\`\`\` section - dependencies, in between \`\`\`yaml\`\`\`\` section ; where any needed packages imported into the component code and need to be installed will be mentionned ; the yaml should have object : {dependencies : {"package":"version"} } ; (you can also just put "*" for version) use doublequotes for every string inside the yaml to make sure formatting is good --- > ask yourself what should be defined in the store component that will be used by all views later , in terms of global state variables and actions > your answer should strictly be the code for the store tsx component your answer will be directly pasted into the component > it should encompasses everything required by the app's global store states and actions, in one single script > the store script you will write will wrap the root component of the app ; no need to write the wrapper part ; it will be included later as \` \` , where the store is the actual script your will write and export here --- try to use async/await when you can > extremely turbo important : - you can only use the following packages : - @reduxjs/toolkit - react-redux - redux-persist - socket.io-client - axios - you need to export default and make sure everything else that will be needed by views is exported too ! --- note : > if app has auth capabilities, make sure you global state covers auth token > if app has realtime capabilities, make sure global state covers realtime auth and subscriptions feel free to consult the provided backend server code to help you figure out how those details should be implemented --- > important : the store should strictly handle getting and setting the provided global state variables ! it should not handle making the other api calls - those parts will be handled by concerned components ! > again , very important : the store should strictly handle getting and setting the provided global state variables ! it should not handle making the other api calls - those parts will be handled by concerned components ! > super important : use localstorage to avoid things being lost on refresh ! --- > conduct the analysis first, reply iwith the analysis inside of \`\`\`markdown\`\`\` > make full complete store component code in \`\`\`tsx\`\`\` based on your analysis > dependencies, in between \`\`\`yaml\`\`\`\` with object: {dependencies : {package:version}} you are a genius + you get $9999`, }, { role: "user", content: `\`\`\`PRD:product-requirements-document ${prd} \`\`\``, }, { role: "user", content: `\`\`\`UX-analysis-document ${uxdmd} \`\`\``, }, { role: "user", content: `\`\`\`BRD:backend-requirements-document ${brd} \`\`\` ` + (!backend?.requirements?.restApi?.required ? "" : `--- \`\`\`BACKEND:specifications:openAPI ${yaml.stringify(backend.specifications.openapi)} \`\`\` `) + (!backend?.requirements?.realtimeWebsockets?.required ? "" : `--- \`\`\`BACKEND:specifications:asyncAPI ${yaml.stringify(backend.specifications.asyncapi)} \`\`\` ` + ` --- \`\`\`BRD:server:main ${yaml.stringify(backend.server.main)} \`\`\` `), }, { role: "user", content: `\`\`\`app:architecture ${yaml.stringify(uxdatamap)} \`\`\``, }, { role: "user", content: `make the analysis and implement the tsx component; > implement the ${store.id} store component, fully and working from the get go; --- try to use async/await when you can > extremely turbo important !!! : - you can only use the following packages : - @reduxjs/toolkit - react-redux - redux-persist - socket.io-client - axios - you need to export default and make sure everything else that will be needed by views is exported too ! --- > make sure it has all the required imports !! no missing imports ! > should export a default method too ! so that it can be imported later as \`import store from '@/store/main'\` ! > important : the store should strictly: > handle getting and setting the provided global state variables ! > if applies , handle realtime events subscriptions it should not handle making view-specific api calls - those parts will be handled by concerned view components ! > again, important : the store should strictly: > handle getting and setting the provided global state variables ! > if applies , handle realtime events subscriptions it should not handle making view-specific api calls - those parts will be handled by concerned view components ! > super important : use localstorage to avoid things being lost on refresh ! > do not assume that anything else is implemented ! > do not make any assumptions that something else will be plugged here ! > implement 100% of everything you need to implement ! do not hallucinate importing something that doesnt exist! > the store component should work 100% out the box without any further edits ! very important ! --- important : > use snake_case for any naming you do extremely important : > ensure full perfect coherence with: backend server methods / events / names, schemas > field names and schemas epecially --- - analysis , in between \`\`\`markdown\`\`\`\` section - full store component tsx code , in between \`\`\`tsx\`\`\`\` section - dependencies, with object {dependencies:{package:version,...}}, in between \`\`\`yaml\`\`\`\` section you are a genius + you get $9999`, }, ]; } async function webappStoreGenerate({ context, data }) { const timestamp = `${Date.now()}`; const messages = await promptStore({ context, data }); const { generated } = await context.run({ id: "op:LLM::GEN", context: { ...context, // {streams , project} operation: { key: `webapp.react.store.redux.latest`, meta: { name: "Webapp Data Store", desc: "redux data store component code", }, }, }, data: { model: `chatgpt-4o-latest`, //`gpt-4o`, messages: messages, preparser: false, parser: false, }, }); const extraction = await utils.parsers.extract.backticksMultiple({ text: generated, delimiters: [`markdown`, `tsx`, `yaml`], }); const { markdown, tsx } = extraction; if (!tsx.length) { throw new Error("webapp:store:generate error - generated tsx is empty"); } const parsedYaml = extraction.yaml ? yaml.parse(extraction.yaml) : {}; const generatedStore = { analysis: markdown, tsx, dependencies: parsedYaml.dependencies ? Object.fromEntries( Object.keys(parsedYaml.dependencies).map((key) => [key, "*"]), ) : [], timestamp, }; await Promise.all( [`${timestamp}`, `latest`].map(async (version) => { await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: `webapp:react:store`, refs: { id: "redux", version, }, }, type: `end`, content: { key: `webapp.react.store.redux.${version}`, data: generatedStore, }, }, }); }), ); if (Object.keys(generatedStore.dependencies).length) { await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: "settings:config:package", }, type: `end`, content: { key: "settings.config.package", data: { webapp: { dependencies: generatedStore.dependencies, }, }, }, }, }); } return { timestamp, webapp: { react: { store: { // ie. "views" , "sections" , "store" , "root" redux: { // ie. {UV_* , SEC_* , redux} , "app" (in case of root) [timestamp]: generatedStore, latest: generatedStore, }, }, }, }, }; } export default { "WEBAPP:STORE::GENERATE": webappStoreGenerate, }; ================================================ FILE: cofounder/api/system/functions/webapp/view.js ================================================ import utils from "@/utils/index.js"; import yaml from "yaml"; import fs from "fs"; import { merge, sample } from "lodash-es"; async function webappViewGenerateMulti({ context, data }) { /* get all view from uxsitemap , start gen */ const { views } = data.uxsitemap.structure; // console.error("______DEBUG_____ : webapp:view:generate:multi : skipping functional pass, testing redesign only ! ! ! ! !",); const passes = { functional: true, redesign: process.env.DESIGNER_ENABLE ? JSON.parse(process.env.DESIGNER_ENABLE.toLowerCase()) : false, }; const tasks = [ ...(Object.keys(views?.unique) || {}).map((viewId) => { return { task: { type: "view", view: { type: "unique", id: viewId, }, passes, }, }; }), ...(Object.keys(views?.shared) || {}).map((viewId) => { return { task: { type: "view", view: { type: "shared", id: viewId, }, passes, }, }; }), ]; let response = {}; // console.error("__DEBUG________ : webapp:view:generate:multi : TASKS SLICED ! ! ! ! ! ! ! ! ! ! ! ! !"); await Promise.all( //[sample(tasks)] // tasks.filter(e=>e.task.view.id.toLowerCase().includes('land')) tasks.map(async (task) => { response = merge( response, await context.run({ id: `WEBAPP:VIEW::GENERATE`, context, data: { ...data, ...task }, }), ); }), ); return response; } async function promptViewFunctional({ context, data }) { const { pm, backend, uxsitemap, uxdatamap, webapp, task } = data; const { prd, frd, uxdmd } = pm; const { view } = task; /* should return tsx , packages (if needed) */ return [ { role: `system`, content: `your role as an expert react and tailwind senior dev and product manager is to write the code for the react view component based on the provided task; for view ${view.id} --- - analysis , in between \`\`\`markdown\`\`\`\` section - full view component tsx code , in between \`\`\`tsx\`\`\`\` section - dependencies, in between \`\`\`yaml\`\`\`\` section ; where any needed npm packages required code and need to be installed will be mentionned ; the yaml should have object : {dependencies : {"package":"version"} } ; (you can also just put "*" for version) use doublequotes for every string inside the yaml to make sure formatting is good --- in your analysis , if functions makes use of global app state or makes calls to backend, include a snippet of how the app state store or backend code handles the functions (check the provided codes) before you get to implementing the function - this will help you reason better through it and provide good justification on how to structure your functions ; --- - in case you need temporary images or media, use a https://picsum.photos/ url with a random seed no placeholder no hallucinated import of some local asset or image or component ... - do not make any assumptions about what is in the project other than strictly what it provided ! no hallucinations , no assumptions ! - in case you need to Link to other paths in the app (as described in the provided uxsitemaps), use (from : \`import { Link } from "react-router-dom"\` ) - super important : > if you link to other paths in the app, use \`import { Link } from "react-router-dom"\` !! --- - super important : > render all the html nodes with one single big (<>...) that is returned by the default React.FC() view component > do not split html nodes renders as functions ; use one very big (<>...) returned by the default component use conditionals inside it when you need to, but no splitting render sections by functions - one big render block --- > any backend server calls should be to the dev url specified in the provided docs (typically http://localhost:1337/* unless specified otherwise) --- super important : > use snake_case for any new naming you do extremely important : > ensure full perfect coherence with: backend server and global app store : methods / events / names / schemas ... > field names and schemas epecially > everything should be perfectly coherent and functional --- > you are required to write the code for the full view, and for it to be fully functional > no placeholders, no hallucinated imports, no assumptions that anything else has been implement , no missing imports ! perfect working functional view component code with 100% of everything needed > very important : as long as every single requirements is in your generated code ! no hallucinated or assumed imports ! write and implement every single thing needed for this view ! you are a genius + you get $9999`, }, { role: "user", content: `\`\`\`PRD:product-requirements-document ${prd} \`\`\` --- \`\`\`FRD:features-requirements-document ${frd} \`\`\` `, }, { role: "user", content: `\`\`\`UX:analysis-document ${uxdmd} \`\`\``, }, { role: `user`, content: `writing code for the app view ${view.id} , defined in the following: \`\`\` ${yaml.stringify(view)} \`\`\``, }, { role: "user", content: `` + (!backend?.requirements?.restApi?.required ? "" : `--- \`\`\`BACKEND:specifications:openAPI ${yaml.stringify(backend.specifications.openapi)} \`\`\` `) + (!backend?.requirements?.realtimeWebsockets?.required ? "" : `--- \`\`\`BACKEND:specifications:asyncAPI ${yaml.stringify(backend.specifications.asyncapi)} \`\`\` ` + ` --- \`\`\`BRD:server:main.js ${yaml.stringify(backend.server.main)} \`\`\` `), }, { role: `user`, content: `the data states architecture for the ${view.id} alongside its relationships with the app architecture : \`\`\`webapp:architecture ${yaml.stringify({ architecture: { ...uxdatamap.structure, crosslinks: uxsitemap.structure.crosslinks, }, viewToImplement: view, })} \`\`\``, }, { role: "user", content: `for additional reference (if needed): the root app component that wraps this view: \`\`\`@/App.tsx ${webapp.react.root.app.latest.tsx} \`\`\` --- the global state store component that wraps the app (including this view you're working on) is defined in the following ; you can import the store exports if needed by using : \`import {...} from '@/store/main'\` \`\`\`@/store/main.tsx ${webapp.react.store.redux.latest.tsx} \`\`\` `, }, { role: `user`, content: `make the analysis and implement the tsx component; > implement the react+tailwind component, fully and working from the get go; > you are implementing the tsx code for view component : ${view.id} > should be React.FC ! important ! - important : in case you need to link to other paths in the app (as described in the provided uxsitemaps), use (from : \`import { Link } from "react-router-dom"\` ) --- - super important : > render all the html nodes with one single big (<>...) that is returned by the default React.FC() view component > do not split html nodes renders as functions ; use one very big (<>...) returned by the default component use conditionals inside it when you need to, but no splitting render sections by functions - one big render block --- > do not hallucinate methods or component imports that do not exist ! all that exists has been provided to you any required additional actions should be implemented by you ; you are provided with all needed details to implement anything ! > the global store and its methods is defined in @/store/main.tsx > that's all !! DO NOT ASSUME OTHER STUFF IS IMPLEMENTED ! IF YOU NEED TO CALL THE BACKEND SERVER (whether for API / realtime websockets / ... ) OR SOMETHING SIMILAR, WRITE YOUR OWN COMPLETE FUNCTIONS INSIDE THIS VIEW !! do not write placeholders or imports from any "components to make" - all there is is the script you write so make it have 100% of everything needed IMPLEMENT EVERYTHING NEEDED IN THIS SCRIPT, DO NOT ASSUME ANYTHING ELSE IS IMPLEMENTED OR WILL BE IMPLEMENTED BESIDES YOUR CODE ! do not hallucinate any imports - no hallucinated imports of local assets or images or components ... no hallucinated imports ! no placeholders ! no assumptions that something exists ! --- - analysis , in between \`\`\`markdown\`\`\`\` section - full view component tsx code , in between \`\`\`tsx\`\`\`\` section - dependencies, for npm packages, with {dependencies:{package:version,...}}, in between \`\`\`yaml\`\`\`\` section you are a genius + you get $9999`, }, ].filter((e) => e); } async function promptViewRedesign({ context, data }) { /* data : { task : { type , view : { type , id , details, datamap , tsx }, rag, guidance { docs : { [usedPrimitiveId(s)] : "...mdx docs content..." } } || false, layout : {analysis,render{svg,image{base64?,url?,local?}}}, }, } */ const { view, rag, guidance, layout } = data.task; const { details } = data.pm; const { tsx } = view; const { render } = layout; /* DONT FORGET THE AESTHETICS OBJECT ! (see old code.js again) */ return [ { role: "system", content: `your role as an expert react design engineer is to redesign and write the code for the react + tailwind view component based on the provided design task ; for view ${view.id} --- - analysis , in between \`\`\`markdown\`\`\`\` section - full view component tsx code of redesigned view , in between \`\`\`tsx\`\`\`\` section - dependencies, in between \`\`\`yaml\`\`\`\` section ; where any needed npm packages required code and need to be installed will be mentionned ; the yaml should have object : {dependencies : {"package":"version"} } ; (you can also just put "*" for version) use doublequotes for every string inside the yaml to make sure formatting is good --- - in case you need temporary images or media, use a https://picsum.photos/ url with a random seed no placeholder no hallucinated import of some local asset or image or component ... - do not make any assumptions about what is in the project other than strictly what it provided ! no hallucinations , no assumptions ! - in case you need to use icons, you can use icons from \`lucide-react\` ; but make sure they are icons you know 100% exist there ! no hallucinated icon names ! no assumptions ! - in case you need to Link to other paths in the app, use (from : \`import { Link } from "react-router-dom"\` ) - super important : > if you link to other paths in the app, use \`import { Link } from "react-router-dom"\` !! --- - super important : > render all the html nodes with one single big (<>...) that is returned by the default React.FC() view component > do not split html nodes renders as functions ; use one very big (<>...) returned by the default component use conditionals inside it when you need to, but no splitting render sections by functions - one big render block --- super important : - your redesigned component should keep 100% of its functionalities from the previous view code version ; - your role here is to redesign the component based on provided instructions - keep in mind responsiveness --- > you are required to write the code for the full view, and for it to be fully functional > no placeholders, no hallucinated imports, no assumptions that anything else has been implement , no missing imports ! perfect working functional view component code with 100% of everything needed > very important : every single functionality is kept is in your redesigned view code ! no hallucinated or assumed imports ! write and implement every single thing needed for this view ! you are a genius redesign the provided view component you get $9999`, }, guidance?.docs && { role: `user`, content: `to help you in your task, you can refer to components code docs provided below : \`\`\` ${yaml.stringify({ docs: guidance.docs })} \`\`\` ------- super important you can use it docs reference when you judge it is good to do so ; but use it as a reference when it makes sense to do so ! use your best judgement in all cases ! `, }, render?.image && (render?.image?.url?.length || render?.image?.base64?.length || render?.image?.local?.length) && { role: `user`, content: [ { type: "text", text: `the (desktop) design mockup of the view ${view.id} is as follows : you can use it as a reference when you judge it is good to do so ; (you should also ensure mobile responsive while making it) important : use it as a reference when it makes sense to do so ! use your best judgement ! \`\`\`layout:design:mockup:figma-layers-export ${yaml.stringify({ layers: render.svg.structure.svg.rect.map((item) => { return { primitiveType: item.$.primitiveId, description: item.$.description, _mockupCoords: { x: item.$.x, y: item.$.y, w: item.$.width, h: item.$.height, }, }; }), })} \`\`\` `, }, render?.image && (render?.image?.url?.length || render?.image?.base64?.length || render?.image?.local?.length) && { type: `image_url`, image_url: { url: render.image.url ? render.image.url : render.image.base64 ? render.image.base64 : render.image.local ? `data:image/png;base64,${Buffer.from(fs.readFileSync(render.image.local)).toString("base64")}` : "", // detail: `high`, }, }, ].filter((e) => e), }, { role: "user", content: `the code of the view ${view.id} that you are tasked to redesign is as follows : \`\`\`${view.id}.tsx ${tsx} \`\`\` super important : > your redesig should be perfectly congruent with the original view's features ; > do not hallucinate features that the original view does not have ! do not take the freedom to add shit that isn't there ; things would break ! respect the task and strictly the task ! `, }, details?.design?.aesthetics?.text?.length && { role: `user`, content: `additionally - if it is any help, the design aesthetics instructions for the app are : ${details.design.aesthetics.text}`, }, { role: "user", content: `make the analysis and implement the redesigned tsx component; > redesign the react+tailwind component, fully and working from the get go; > you are redesigning the tsx code for view component : ${view.id} > should be React.FC ! important ! --- - super important : > render all the html nodes with one single big (<>...) that is returned by the default React.FC() view component > do not split html nodes renders as functions ; use one very big (<>...) returned by the default component use conditionals inside it when you need to, but no splitting render sections by functions - one big render block --- > do not hallucinate methods or component imports that do not exist ! all that exists has been provided to you DO NOT ASSUME OTHER STUFF IS IMPLEMENTED UNLESS IT WAS CLEARLY AND PRECISELY PROVIDED IN EXAMPLES OR DOCUMENTATION ! NO ASSUMPTIONS ! do not write placeholders or imports from any "components to make" all there is is the script you write so make it have 100% of everything needed IMPLEMENT EVERYTHING NEEDED IN THIS SCRIPT, DO NOT ASSUME ANYTHING ELSE IS IMPLEMENTED OR WILL BE IMPLEMENTED BESIDES YOUR CODE AND EXACTLY WHAT WAS PROVIDED IN DOCS ! do not hallucinate any imports - no hallucinated imports of local assets or images or components ... no hallucinated imports ! no placeholders ! no assumptions that something exists ! --- - analysis , in between \`\`\`markdown\`\`\`\` section - full redesigned view component tsx code , in between \`\`\`tsx\`\`\`\` section - dependencies, for npm packages, with {dependencies:{package:version,...}}, in between \`\`\`yaml\`\`\`\` section you are a genius redesign the provided view and implement its full code you get $9999`, }, ].filter((e) => e); } async function webappViewGenerate({ context, data }) { /* data : { ...data , task : { type: "view", view: { type : "unique || shared" , id }, passes: { functional : true, redesign : true, } } } */ const timestamp = `${Date.now()}`; const { task } = data; const { view, passes } = task; /* passes : { functional:bool , redesign:bool } if functional only, clear if redesign only, svgPrompt -> recodePrompt if both , parallel { functional , svg } -> recodePrompt */ data.task.view = { ...data.task.view, details: data.uxsitemap.structure.views[task.view.type][task.view.id], datamap: data.uxdatamap.views[task.view.type][task.view.id], }; /* should merge with data.webapp at every pass ! */ if (passes.functional) { const messagesFunctional = await promptViewFunctional({ context, data, }); const { generated } = await context.run({ id: "op:LLM::GEN", context: { ...context, // {streams , project} operation: { key: `webapp.react.views.${view.id}.latest`, meta: { name: `Webapp View Implement { ${view.id} }`, desc: "react view, functional pass", }, }, }, data: { model: `chatgpt-4o-latest`, //`gpt-4o`, messages: messagesFunctional, preparser: false, parser: false, }, }); const extraction = await utils.parsers.extract.backticksMultiple({ text: generated, delimiters: [`markdown`, `tsx`, `yaml`], }); const { markdown, tsx } = extraction; if (!tsx.length) { throw new Error("webapp:view:generate error - generated tsx is empty"); } const parsedYaml = extraction.yaml ? yaml.parse(extraction.yaml) : {}; const generatedView = { analysis: markdown, tsx, dependencies: parsedYaml.dependencies ? Object.fromEntries( Object.keys(parsedYaml.dependencies).map((key) => [key, "*"]), ) : [], timestamp, }; await Promise.all( [`${timestamp}`, `latest`].map(async (version) => { await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: `webapp:react:views`, refs: { id: view.id, version, }, }, type: `end`, content: { key: `webapp.react.views.${view.id}.${version}`, data: generatedView, }, }, }); }), ); if (Object.keys(generatedView.dependencies).length) { await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: "settings:config:package", }, type: `end`, content: { key: "settings.config.package", data: { webapp: { dependencies: generatedView.dependencies, }, }, }, }, }); } data.webapp = merge(data.webapp, { react: { views: { // ie. "views" , "sections" , "store" , "root" [view.id]: { // ie. {UV_* , SEC_* , redux} , "app" (in case of root) [timestamp]: generatedView, latest: generatedView, }, }, }, }); } if (passes.redesign) { /* svg pass (handled in DESIGNER:LAYOUTV1::VIEW:GENERATE) */ const redesignTimestamp = `${Date.now()}`; const designerResponse = await context.run({ id: "DESIGNER:LAYOUTV1::VIEW:GENERATE", context, data: { ...data, timestamp: redesignTimestamp, // to keep versions congruent }, }); // -> { designer {rag,guidance} , webapp { layout { views { [id] { [version] : { analysis , render{ svg,image } } } } } } } /* merge (op:state:update already handled in designer:layoutv1) */ data.webapp = merge(data.webapp, designerResponse.webapp); // console.dir({ designerResponse } , {depth:null }) ; process.exit(); const { rag, guidance } = designerResponse.designer; let primitivesIds = []; try { primitivesIds = [ ...new Set( designerResponse.webapp.layout.views[ task.view.id ].latest.render.svg.structure.svg.rect .filter((item) => item.$?.primitiveId) .map((item) => item.$.primitiveId), ), ]; } catch (e) { console.error(`webapp:view:generate:pass:redesign : ${e}`); } data.task.view.tsx = data.webapp.react.views[task.view.id].latest.tsx; const redesignTask = { ...data.task, // type , view{type,id,details,datamap,tsx} rag, guidance: guidance && guidance.docs?.primitives ? { docs: Object.fromEntries( Object.entries( Object.entries(guidance.docs.primitives) .filter(([key]) => primitivesIds.includes(key)) .reduce((acc, [key, value]) => { if (!acc[value]) { acc[value] = key; } else { acc[value] += ` , ${key}`; } return acc; }, {}), ).map(([value, keys]) => [keys, value]), ), } // filters out duplicates docs (ie. button , button_icon_only , button_secondary , ... share same docs) : false, layout: designerResponse.webapp.layout.views[task.view.id].latest, //{analysis,render{svg,image{base64?,url?,local?}}} }; /* recode pass (handled here with promptViewRedesign ) make use of guidance (and rag?) ; since guidance will have design system docs that filter out whats needed ! guidance { ontology{primitives{[ids]}} , image{base64,url} , docs{ primitives{ [id] : "... mdx content ..." } } } */ /* in dependencies , filter out weird dependencies if exist like "@/components/..." */ /* use : redesignTimestamp !! merge with data.webapp , {...react}: op:state::update react */ const messagesRedesign = await promptViewRedesign({ context, data: { ...data, task: redesignTask, }, }); const { generated } = await context.run({ id: "op:LLM::GEN", context: { ...context, // {streams , project} operation: { key: `webapp.react.views.${view.id}.latest`, meta: { name: `Webapp View Redesign { ${view.id} }`, desc: "react view, redesign pass", }, }, }, data: { model: `chatgpt-4o-latest`, //`gpt-4o`, messages: messagesRedesign, preparser: false, parser: false, }, }); const extraction = await utils.parsers.extract.backticksMultiple({ text: generated, delimiters: [`markdown`, `tsx`, `yaml`], }); const { markdown, tsx } = extraction; if (!tsx.length) { throw new Error("webapp:view:generate error - generated tsx is empty"); } const parsedYaml = extraction.yaml ? yaml.parse(extraction.yaml) : {}; const generatedView = { analysis: markdown, tsx, dependencies: parsedYaml.dependencies ? Object.fromEntries( Object.keys(parsedYaml.dependencies).map((key) => [key, "*"]), ) : [], timestamp: redesignTimestamp, }; await Promise.all( [`${redesignTimestamp}`, `latest`].map(async (version) => { await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: `webapp:react:views`, refs: { id: view.id, version, }, }, type: `end`, content: { key: `webapp.react.views.${view.id}.${version}`, data: generatedView, }, }, }); }), ); if (Object.keys(generatedView.dependencies).length) { await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: "settings:config:package", }, type: `end`, content: { key: "settings.config.package", data: { webapp: { dependencies: generatedView.dependencies, }, }, }, }, }); } data.webapp = merge(data.webapp, { react: { views: { // ie. "views" , "sections" , "store" , "root" [view.id]: { // ie. {UV_* , SEC_* , redux} , "app" (in case of root) [redesignTimestamp]: generatedView, latest: generatedView, }, }, }, }); } return { webapp: data.webapp }; } async function promptIterateNoDesigner({ context, data }) { /* prompt with : current screenshot?.base64? tsx user notes text */ const { task } = data; const { view, iteration } = task; const { notes, screenshot } = iteration; const { tsx } = view; const { details } = data.pm; return [ { role: "system", content: `your role as an expert react design engineer is to redesign and write the code for the react + tailwind view component based on the provided design task ; for view ${view.id} --- - analysis , in between \`\`\`markdown\`\`\`\` section - full view component tsx code of redesigned view , in between \`\`\`tsx\`\`\`\` section - dependencies, in between \`\`\`yaml\`\`\`\` section ; where any needed npm packages required code and need to be installed will be mentionned ; the yaml should have object : {dependencies : {"package":"version"} } ; (you can also just put "*" for version) use doublequotes for every string inside the yaml to make sure formatting is good --- - in case you need temporary images or media, use a https://picsum.photos/ url with a random seed no placeholder no hallucinated import of some local asset or image or component ... - do not make any assumptions about what is in the project other than strictly what it provided ! no hallucinations , no assumptions ! - in case you need to use icons, you can use icons from \`lucide-react\` ; but make sure they are icons you know 100% exist there ! no hallucinated icon names ! no assumptions ! - in case you need to Link to other paths in the app, use (from : \`import { Link } from "react-router-dom"\` ) - super important : > if you link to other paths in the app, use \`import { Link } from "react-router-dom"\` !! --- - super important : > render all the html nodes with one single big (<>...) that is returned by the default React.FC() view component > do not split html nodes renders as functions ; use one very big (<>...) returned by the default component use conditionals inside it when you need to, but no splitting render sections by functions - one big render block --- super important : - your redesigned component should keep 100% of its functionalities from the previous view code version ; - your role here is to redesign the component based on provided instructions - keep in mind responsiveness --- > you are required to write the code for the full view, and for it to be fully functional > no placeholders, no hallucinated imports, no assumptions that anything else has been implement , no missing imports ! perfect working functional view component code with 100% of everything needed > very important : every single functionality is kept is in your redesigned view code ! no hallucinated or assumed imports ! write and implement every single thing needed for this view ! you are a genius redesign the provided view component you get $9999`, }, screenshot && (screenshot?.url?.length || screenshot?.base64?.length || screenshot?.local?.length) && { role: `user`, content: [ { type: "text", text: `a screenshot of the current view render : `, }, screenshot && (screenshot?.url?.length || screenshot?.base64?.length || screenshot?.local?.length) && { type: `image_url`, image_url: { url: screenshot.url ? screenshot.url : screenshot.base64 ? screenshot.base64 : screenshot.local ? `data:image/png;base64,${Buffer.from(fs.readFileSync(render.image.local)).toString("base64")}` : "", // detail: `high`, }, }, ].filter((e) => e), }, { role: "user", content: `the code of the view ${view.id} that you are tasked to redesign is as follows : \`\`\`${view.id}.tsx ${tsx} \`\`\` --- super important : > your redesign should be perfectly congruent with the original view's features ; > do not hallucinate features that the original view does not have ! do not take the freedom to add stuff that isn't there ; things would break ! respect the task and strictly the task ! `, }, details?.design?.aesthetics?.text?.length && { role: `user`, content: `additionally - if it is any help - the original design aesthetics instructions for the app were : \`\`\` ${details.design.aesthetics.text} \`\`\` `, }, notes?.text?.length && { role: `user`, content: `the new redesign instructions - the most important part of your task - are the following : \`\`\`view:redesign:instructions ${notes.text} \`\`\` `, }, { role: "user", content: `make the analysis and implement the redesigned tsx component; > redesign the react+tailwind component, fully and working from the get go; > you are redesigning the tsx code for view component : ${view.id} > should be React.FC ! important ! --- - super important : > render all the html nodes with one single big (<>...) that is returned by the default React.FC() view component > do not split html nodes renders as functions ; use one very big (<>...) returned by the default component use conditionals inside it when you need to, but no splitting render sections by functions - one big render block --- > do not hallucinate methods or component imports that do not exist ! all that exists has been provided to you DO NOT ASSUME OTHER STUFF IS IMPLEMENTED UNLESS IT WAS CLEARLY AND PRECISELY PROVIDED IN EXAMPLES OR DOCUMENTATION ! NO ASSUMPTIONS ! do not write placeholders or imports from any "components to make" all there is is the script you write so make it have 100% of everything needed IMPLEMENT EVERYTHING NEEDED IN THIS SCRIPT, DO NOT ASSUME ANYTHING ELSE IS IMPLEMENTED OR WILL BE IMPLEMENTED BESIDES YOUR CODE AND EXACTLY WHAT WAS PROVIDED IN DOCS ! do not hallucinate any imports - no hallucinated imports of local assets or images or components ... no hallucinated imports ! no placeholders ! no assumptions that something exists ! --- - analysis , in between \`\`\`markdown\`\`\`\` section - full redesigned view component tsx code , in between \`\`\`tsx\`\`\`\` section - dependencies, for npm packages, with {dependencies:{package:version,...}}, in between \`\`\`yaml\`\`\`\` section you are a genius redesign the provided view and implement its full code you get $9999`, }, ].filter((e) => e); } async function promptIterateWithDesigner({ context, data }) { /* prompt with : current screenshot?.base64? tsx suggested designer layout render user notes text */ const { task } = data; const { view, iteration, rag, guidance, layout } = task; const { render } = layout; const { notes, screenshot } = iteration; const { tsx } = view; const { details } = data.pm; return [ { role: "system", content: `your role as an expert react design engineer is to redesign and write the code for the react + tailwind view component based on the provided design task ; for view ${view.id} --- - analysis , in between \`\`\`markdown\`\`\`\` section - full view component tsx code of redesigned view , in between \`\`\`tsx\`\`\`\` section - dependencies, in between \`\`\`yaml\`\`\`\` section ; where any needed packages imported into the component code and need to be installed will be mentionned ; the yaml should have object : {dependencies : {"package":"version"} } ; (you can also just put "*" for version) use doublequotes for every string inside the yaml to make sure formatting is good --- - in case you need temporary images or media, use a https://picsum.photos/ url with a random seed no placeholder no hallucinated import of some local asset or image or component ... - do not make any assumptions about what is in the project other than strictly what it provided ! no hallucinations , no assumptions ! - in case you need to use icons, you can use icons from \`lucide-react\` ; but make sure they are icons you know 100% exist there ! no hallucinated icon names ! no assumptions ! - in case you need to Link to other paths in the app, use (from : \`import { Link } from "react-router-dom"\` ) - super important : > if you link to other paths in the app, use \`import { Link } from "react-router-dom"\` !! --- - super important : > render all the html nodes with one single big (<>...) that is returned by the default React.FC() view component > do not split html nodes renders as functions ; use one very big (<>...) returned by the default component use conditionals inside it when you need to, but no splitting render sections by functions - one big render block --- super important : - your redesigned component should keep 100% of its functionalities from the previous view code version ; - your role here is to redesign the component based on provided instructions - keep in mind responsiveness --- > you are required to write the code for the full view, and for it to be fully functional > no placeholders, no hallucinated imports, no assumptions that anything else has been implement , no missing imports ! perfect working functional view component code with 100% of everything needed > very important : every single functionality is kept is in your redesigned view code ! no hallucinated or assumed imports ! write and implement every single thing needed for this view ! you are a genius redesign the provided view component you get $9999`, }, screenshot && (screenshot?.url?.length || screenshot?.base64?.length || screenshot?.local?.length) && { role: `user`, content: [ { type: "text", text: `a screenshot of the current view render to redesign : `, }, screenshot && (screenshot?.url?.length || screenshot?.base64?.length || screenshot?.local?.length) && { type: `image_url`, image_url: { url: screenshot.url ? screenshot.url : screenshot.base64 ? screenshot.base64 : screenshot.local ? `data:image/png;base64,${Buffer.from(fs.readFileSync(render.image.local)).toString("base64")}` : "", // detail: `high`, }, }, ].filter((e) => e), }, guidance?.docs && { role: `user`, content: `to help you in your redesign task, you can refer to components code docs provided below : \`\`\` ${yaml.stringify({ docs: guidance.docs })} \`\`\` ------- super important you can use it docs reference when you judge it is good to do so ; but use it as a reference when it makes sense to do so ! use your best judgement in all cases ! `, }, render?.image && (render?.image?.url?.length || render?.image?.base64?.length || render?.image?.local?.length) && { role: `user`, content: [ { type: "text", text: `the new suggested redesign mockup of the view ${view.id} is as follows : you can use it as a reference when you judge it is good to do so ; (you should also ensure mobile responsive while making it) important : use it as a reference when it makes sense to do so ! use your best judgement ! \`\`\`layout:design:mockup:figma-layers-export ${yaml.stringify({ layers: render.svg.structure.svg.rect.map((item) => { return { primitiveType: item.$.primitiveId, description: item.$.description, _mockupCoords: { x: item.$.x, y: item.$.y, w: item.$.width, h: item.$.height, }, }; }), })} \`\`\` `, }, render?.image && (render?.image?.url?.length || render?.image?.base64?.length || render?.image?.local?.length) && { type: `image_url`, image_url: { url: render.image.url ? render.image.url : render.image.base64 ? render.image.base64 : render.image.local ? `data:image/png;base64,${Buffer.from(fs.readFileSync(render.image.local)).toString("base64")}` : "", // detail: `high`, }, }, ].filter((e) => e), }, { role: "user", content: `the code of the view ${view.id} that you are tasked to redesign is as follows : \`\`\`${view.id}.tsx ${tsx} \`\`\` --- super important : > your redesign should be perfectly congruent with the original view's features ; > do not hallucinate features that the original view does not have ! do not take the freedom to add stuff that isn't there ; things would break ! respect the task and strictly the task ! `, }, details?.design?.aesthetics?.text?.length && { role: `user`, content: `additionally - if it is any help - the original design aesthetics instructions for the app were : \`\`\` ${details.design.aesthetics.text} \`\`\` `, }, notes?.text?.length && { role: `user`, content: `the new redesign instructions ( on which the new redesign mockup are based ) are the following : \`\`\`view:redesign:instructions ${notes.text} \`\`\` `, }, { role: "user", content: `make the analysis and implement the redesigned tsx component; > redesign the react+tailwind component, fully and working from the get go; > you are redesigning the tsx code for view component : ${view.id} > should be React.FC ! important ! --- - super important : > render all the html nodes with one single big (<>...) that is returned by the default React.FC() view component > do not split html nodes renders as functions ; use one very big (<>...) returned by the default component use conditionals inside it when you need to, but no splitting render sections by functions - one big render block --- > do not hallucinate methods or component imports that do not exist ! all that exists has been provided to you DO NOT ASSUME OTHER STUFF IS IMPLEMENTED UNLESS IT WAS CLEARLY AND PRECISELY PROVIDED IN EXAMPLES OR DOCUMENTATION ! NO ASSUMPTIONS ! do not write placeholders or imports from any "components to make" all there is is the script you write so make it have 100% of everything needed IMPLEMENT EVERYTHING NEEDED IN THIS SCRIPT, DO NOT ASSUME ANYTHING ELSE IS IMPLEMENTED OR WILL BE IMPLEMENTED BESIDES YOUR CODE AND EXACTLY WHAT WAS PROVIDED IN DOCS ! do not hallucinate any imports - no hallucinated imports of local assets or images or components ... no hallucinated imports ! no placeholders ! no assumptions that something exists ! --- - analysis , in between \`\`\`markdown\`\`\`\` section - full redesigned view component tsx code , in between \`\`\`tsx\`\`\`\` section - dependencies, with {dependencies:{package:version,...}}, in between \`\`\`yaml\`\`\`\` section you are a genius redesign the provided view and implement its full code you get $9999`, }, ].filter((e) => e); } //async function webappViewRedesign({ context, data }) {} async function webappViewIterate({ context, data }) { const timestamp = `${Date.now()}`; const { task } = data; const { view, iteration } = task; const { id, version } = view; const { designer } = iteration; const tsx = data.webapp.react.views[task.view.id][version].tsx; // if designer , call designer/layoutv1/iterate /* if no designer, just have a prompt : promptIterateNoDesigner if designer : call designer/layoutv1/iterate , where it will do analysis+svg in one single pass have ragText + user notes -> rag have screenshot there too for ref call promptIterateWithDesigner */ // console.dir({"debug:webapp:view:iterate" : {task}},{depth:null}) data.task.view = { ...data.task.view, tsx, details: data.uxsitemap.structure.views[task.view.type][task.view.id], datamap: data.uxdatamap.views[task.view.type][task.view.id], }; if (!designer) { const promptMessagesNoDesigner = await promptIterateNoDesigner({ context, data, }); const { generated } = await context.run({ id: "op:LLM::GEN", context: { ...context, // {streams , project} operation: { key: `webapp.react.views.${view.id}.latest`, meta: { name: `Webapp View Iterate { ${view.id} }`, desc: "react view iteration , code only", }, }, }, data: { model: `chatgpt-4o-latest`, //`gpt-4o`, messages: promptMessagesNoDesigner, preparser: false, parser: false, }, }); const extraction = await utils.parsers.extract.backticksMultiple({ text: generated, delimiters: [`markdown`, `tsx`, `yaml`], }); const { markdown, tsx } = extraction; if (!tsx.length) { throw new Error("webapp:view:generate error - generated tsx is empty"); } const parsedYaml = extraction.yaml ? yaml.parse(extraction.yaml) : {}; const generatedView = { analysis: markdown, tsx, dependencies: parsedYaml.dependencies ? Object.fromEntries( Object.keys(parsedYaml.dependencies).map((key) => [key, "*"]), ) : [], timestamp, }; await Promise.all( [`${timestamp}`, `latest`].map(async (version) => { await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: `webapp:react:views`, refs: { id: view.id, version, }, }, type: `end`, content: { key: `webapp.react.views.${view.id}.${version}`, data: generatedView, }, }, }); }), ); if (Object.keys(generatedView.dependencies).length) { await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: "settings:config:package", }, type: `end`, content: { key: "settings.config.package", data: { webapp: { dependencies: generatedView.dependencies, }, }, }, }, }); } data.webapp = merge(data.webapp, { react: { views: { // ie. "views" , "sections" , "store" , "root" [view.id]: { // ie. {UV_* , SEC_* , redux} , "app" (in case of root) [timestamp]: generatedView, latest: generatedView, }, }, }, }); } else { const redesignTimestamp = `${timestamp}`; const designerResponse = await context.run({ id: "DESIGNER:LAYOUTV1::VIEW:ITERATE", context, data: { ...data, timestamp: redesignTimestamp, // to keep versions congruent }, }); // -> { designer {rag,guidance} , webapp { layout { views { [id] { [version] : { analysis , render{ svg,image } } } } } } } /* merge (op:state:update already handled in designer:layoutv1) */ data.webapp = merge(data.webapp, designerResponse.webapp); // console.dir({ designerResponse } , {depth:null }) ; process.exit(); const { rag, guidance } = designerResponse.designer; let primitivesIds = []; try { primitivesIds = [ ...new Set( designerResponse.webapp.layout.views[ task.view.id ].latest.render.svg.structure.svg.rect .filter((item) => item.$?.primitiveId) .map((item) => item.$.primitiveId), ), ]; } catch (e) { console.error(`webapp:view:generate:pass:redesign : ${e}`); } const redesignTask = { ...data.task, // type , view{type,id,details,datamap,tsx} , iteration{notes,screenshot} rag, guidance: guidance && guidance.docs?.primitives ? { docs: Object.fromEntries( Object.entries( Object.entries(guidance.docs.primitives) .filter(([key]) => primitivesIds.includes(key)) .reduce((acc, [key, value]) => { if (!acc[value]) { acc[value] = key; } else { acc[value] += ` , ${key}`; } return acc; }, {}), ).map(([value, keys]) => [keys, value]), ), } // filters out duplicates docs (ie. button , button_icon_only , button_secondary , ... share same docs) : false, layout: designerResponse.webapp.layout.views[task.view.id].latest, //{analysis,render{svg,image{base64?,url?,local?}}} }; const mesagesIterateWithDesigner = await promptIterateWithDesigner({ context, data: { ...data, task: redesignTask, }, }); const { generated } = await context.run({ id: "op:LLM::GEN", context: { ...context, // {streams , project} operation: { key: `webapp.react.views.${view.id}.latest`, meta: { name: `Webapp View Iterate { ${view.id} }`, desc: "react view iteration , with designer", }, }, }, data: { model: `chatgpt-4o-latest`, //`gpt-4o`, messages: mesagesIterateWithDesigner, preparser: false, parser: false, }, }); const extraction = await utils.parsers.extract.backticksMultiple({ text: generated, delimiters: [`markdown`, `tsx`, `yaml`], }); const { markdown, tsx } = extraction; if (!tsx.length) { throw new Error("webapp:view:generate error - generated tsx is empty"); } const parsedYaml = extraction.yaml ? yaml.parse(extraction.yaml) : {}; const generatedView = { analysis: markdown, tsx, dependencies: parsedYaml.dependencies ? Object.fromEntries( Object.keys(parsedYaml.dependencies).map((key) => [key, "*"]), ) : [], timestamp: redesignTimestamp, }; await Promise.all( [`${redesignTimestamp}`, `latest`].map(async (version) => { await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: `webapp:react:views`, refs: { id: view.id, version, }, }, type: `end`, content: { key: `webapp.react.views.${view.id}.${version}`, data: generatedView, }, }, }); }), ); if (Object.keys(generatedView.dependencies).length) { await context.run({ id: "op:PROJECT::STATE:UPDATE", context, data: { operation: { id: "settings:config:package", }, type: `end`, content: { key: "settings.config.package", data: { webapp: { dependencies: generatedView.dependencies, }, }, }, }, }); } data.webapp = merge(data.webapp, { react: { views: { // ie. "views" , "sections" , "store" , "root" [view.id]: { // ie. {UV_* , SEC_* , redux} , "app" (in case of root) [redesignTimestamp]: generatedView, latest: generatedView, }, }, }, }); } return { webapp: data.webapp }; } export default { "WEBAPP:VIEW::GENERATE:MULTI": webappViewGenerateMulti, "WEBAPP:VIEW::GENERATE": webappViewGenerate, //"WEBAPP:VIEW::REDESIGN": webappViewRedesign, "WEBAPP:VIEW::ITERATE": webappViewIterate, }; ================================================ FILE: cofounder/api/system/presets/ui/design/systems/protoboy-v1/README.md ================================================ ## Notes This is a demo design system and will be replaced on official post-alpha release ## Credits Renders dumped from Figma Presets: - Blocks.pm by Hexa Plugin - Google Material & Figma Core Design systems ================================================ FILE: cofounder/api/system/presets/ui/design/systems/protoboy-v1/primitives/.gitignore ================================================ ================================================ FILE: cofounder/api/system/presets/ui/design/systems/protoboy-v1/primitives/ontology.yaml ================================================ primitives: - id: heading description: A primary heading for sectional content - id: subheading description: A secondary heading for a subsection of content - id: text_line description: A single line of text - id: text_paragraph description: A block of text longer than a line - id: button description: A clickable element used to perform actions stretch: true - id: link description: A hyperlink pointing to another resource - id: tag description: An small capsule for categorizing or labeling - can also be used as a small status indicator or be clickable - id: avatar description: A graphical representation of either a user or brand, typically a photo or icon - id: image description: An element to display pictures or graphics stretch: true - id: icon description: A graphical representation of an idea, action, or object - id: input_datepicker stretch: true description: A control allowing the user to select a specific date - id: input_description stretch: true description: An informational text describing an input field - id: input_field stretch: true description: An input area where the user can enter text - id: input_label description: A label associated with an input field to describe its purpose - id: input_searchfield stretch: true description: An input field specifically for search queries - id: input_select stretch: true description: A dropdown menu allowing the user to choose from a list of options - id: input_textarea stretch: true description: An input field for entering multi-line text - id: radio_button description: A control allowing the user to select one option from a group - id: checkbox description: A control that allows the user to select or deselect an option - id: switch description: A control allowing the user to toggle between two states - id: slider description: A control for selecting a value from a range - id: media description: An element for embedding video or audio stretch: true - id: map description: A graphical representation of geographical information stretch: true - id: badge description: A round indicator with a number inside it, used for example for counting or tracking - id: calendar description: A graphical representation of a calendar stretch: true - id: code_block description: A block for displaying formatted code stretch: true - id: button_fab description: A floating action round button that is sticky and fixed to the bottom right corner of the page - id: progress_bar description: A horizontal bar indicating progress toward completion stretch: true - id: nonprimitive description: A placeholder for non-primitive components that should be designed based on description stretch: true ================================================ FILE: cofounder/api/system/presets/ui/design/systems/shadcn/primitives/.gitignore ================================================ ================================================ FILE: cofounder/api/system/presets/ui/design/systems/shadcn/primitives/docs/accordion.mdx ================================================ Name : Accordion Description : A vertically stacked set of interactive headings that each reveal a section of content. --- ### import ``` import { Accordion, AccordionContent, AccordionItem, AccordionTrigger, } from "@/components/ui/accordion" ``` --- ### use ```accordion.mdx Is it accessible? Yes. It adheres to the WAI-ARIA design pattern. ``` --- ### examples ```accordion-demo.tsx import { Accordion, AccordionContent, AccordionItem, AccordionTrigger, } from "@/components/ui/accordion" export default function AccordionDemo() { return ( Is it accessible? Yes. It adheres to the WAI-ARIA design pattern. Is it styled? Yes. It comes with default styles that matches the other components' aesthetic. Is it animated? Yes. It's animated by default, but you can disable it if you prefer. ) } ``` ================================================ FILE: cofounder/api/system/presets/ui/design/systems/shadcn/primitives/docs/avatar.mdx ================================================ Name : Avatar Description : An image element with a fallback for representing the user. --- ### import ``` import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" ``` --- ### use ```avatar.mdx CN ``` --- ### examples ```avatar-demo.tsx import { Avatar, AvatarFallback, AvatarImage, } from "@/components/ui/avatar" export default function AvatarDemo() { return ( CN ) } ``` ================================================ FILE: cofounder/api/system/presets/ui/design/systems/shadcn/primitives/docs/badge.mdx ================================================ Name : Badge Description : Displays a badge or a component that looks like a badge. --- ### import ``` import { Badge } from "@/components/ui/badge" ``` --- ### use ```badge.mdx Badge ``` ```badge.mdx import { badgeVariants } from "@/components/ui/badge" Badge ``` --- ### examples ```badge-demo.tsx import { Badge } from "@/components/ui/badge" export default function BadgeDemo() { return Badge } ``` ```badge-destructive.tsx import { Badge } from "@/components/ui/badge" export default function BadgeDestructive() { return Destructive } ``` ```badge-outline.tsx import { Badge } from "@/components/ui/badge" export default function BadgeOutline() { return Outline } ``` ```badge-secondary.tsx import { Badge } from "@/components/ui/badge" export default function BadgeSecondary() { return Secondary } ``` ================================================ FILE: cofounder/api/system/presets/ui/design/systems/shadcn/primitives/docs/bar_progress.mdx ================================================ Name : Progress Description : Displays an indicator showing the completion progress of a task, typically displayed as a progress bar. --- ### import ``` import { Progress } from "@/components/ui/progress" ``` --- ### use ```progress.mdx ``` --- ### examples ```progress-demo.tsx "use client" import * as React from "react" import { Progress } from "@/components/ui/progress" export default function ProgressDemo() { const [progress, setProgress] = React.useState(13) React.useEffect(() => { const timer = setTimeout(() => setProgress(66), 500) return () => clearTimeout(timer) }, []) return } ``` ================================================ FILE: cofounder/api/system/presets/ui/design/systems/shadcn/primitives/docs/bar_slider.mdx ================================================ Name : Slider Description : An input where the user selects a value from within a given range. --- ### import ``` import { Slider } from "@/components/ui/slider" ``` --- ### use ```slider.mdx ``` --- ### examples ```slider-demo.tsx import { cn } from "@/lib/utils" import { Slider } from "@/components/ui/slider" type SliderProps = React.ComponentProps export default function SliderDemo({ className, ...props }: SliderProps) { return ( ) } ``` ================================================ FILE: cofounder/api/system/presets/ui/design/systems/shadcn/primitives/docs/breadcrumbs.mdx ================================================ --- title: Breadcrumb description: Displays the path to the current resource using a hierarchy of links. component: true --- ## Usage ```tsx import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, } from "@/components/ui/breadcrumb"; ``` ```tsx Home Components Breadcrumb ``` ## Examples ### Custom separator Use a custom component as `children` for `` to create a custom separator. ```tsx import { Slash } from "lucide-react" ... Home Components ``` ================================================ FILE: cofounder/api/system/presets/ui/design/systems/shadcn/primitives/docs/button.mdx ================================================ Name : Button Description : Displays a button or a component that looks like a button. --- ### import ``` import { Button } from "@/components/ui/button" ``` --- ### use ```button.mdx import { Button } from "@/components/ui/button" ``` ```button.mdx import { Link } from 'react-router-dom'; import { Button } from "@/components/ui/button" ... ``` --- ### examples ```button-demo.tsx import { Button } from "@/components/ui/button" export default function ButtonDemo() { return } ``` ```button-destructive.tsx import { Button } from "@/components/ui/button" export default function ButtonDestructive() { return } ``` ```button-ghost.tsx import { Button } from "@/components/ui/button" export default function ButtonGhost() { return } ``` ```button-icon.tsx import { ChevronRight } from "lucide-react" import { Button } from "@/components/ui/button" export default function ButtonIcon() { return ( ) } ``` ```button-link.tsx import { Button } from "@/components/ui/button" export default function ButtonLink() { return } ``` ```button-loading.tsx import { Loader2 } from "lucide-react" import { Button } from "@/components/ui/button" export default function ButtonLoading() { return ( ) } ``` ```button-outline.tsx import { Button } from "@/components/ui/button" export default function ButtonOutline() { return } ``` ```button-secondary.tsx import { Button } from "@/components/ui/button" export default function ButtonSecondary() { return } ``` ```button-with-icon.tsx import { Mail } from "lucide-react" import { Button } from "@/components/ui/button" export default function ButtonWithIcon() { return ( ) } ``` ================================================ FILE: cofounder/api/system/presets/ui/design/systems/shadcn/primitives/docs/button_icon_only.mdx ================================================ Name : Button Description : Displays a button or a component that looks like a button. --- ### import ``` import { Button } from "@/components/ui/button" ``` --- ### use ```button.mdx import { Button } from "@/components/ui/button" ``` ```button.mdx import { Link } from 'react-router-dom'; import { Button } from "@/components/ui/button" ... ``` --- ### examples ```button-demo.tsx import { Button } from "@/components/ui/button" export default function ButtonDemo() { return } ``` ```button-destructive.tsx import { Button } from "@/components/ui/button" export default function ButtonDestructive() { return } ``` ```button-ghost.tsx import { Button } from "@/components/ui/button" export default function ButtonGhost() { return } ``` ```button-icon.tsx import { ChevronRight } from "lucide-react" import { Button } from "@/components/ui/button" export default function ButtonIcon() { return ( ) } ``` ```button-link.tsx import { Button } from "@/components/ui/button" export default function ButtonLink() { return } ``` ```button-loading.tsx import { Loader2 } from "lucide-react" import { Button } from "@/components/ui/button" export default function ButtonLoading() { return ( ) } ``` ```button-outline.tsx import { Button } from "@/components/ui/button" export default function ButtonOutline() { return } ``` ```button-secondary.tsx import { Button } from "@/components/ui/button" export default function ButtonSecondary() { return } ``` ```button-with-icon.tsx import { Mail } from "lucide-react" import { Button } from "@/components/ui/button" export default function ButtonWithIcon() { return ( ) } ``` ================================================ FILE: cofounder/api/system/presets/ui/design/systems/shadcn/primitives/docs/button_secondary.mdx ================================================ Name : Button Description : Displays a button or a component that looks like a button. --- ### import ``` import { Button } from "@/components/ui/button" ``` --- ### use ```button.mdx import { Button } from "@/components/ui/button" ``` ```button.mdx import { Link } from 'react-router-dom'; import { Button } from "@/components/ui/button" ... ``` --- ### examples ```button-demo.tsx import { Button } from "@/components/ui/button" export default function ButtonDemo() { return } ``` ```button-destructive.tsx import { Button } from "@/components/ui/button" export default function ButtonDestructive() { return } ``` ```button-ghost.tsx import { Button } from "@/components/ui/button" export default function ButtonGhost() { return } ``` ```button-icon.tsx import { ChevronRight } from "lucide-react" import { Button } from "@/components/ui/button" export default function ButtonIcon() { return ( ) } ``` ```button-link.tsx import { Button } from "@/components/ui/button" export default function ButtonLink() { return } ``` ```button-loading.tsx import { Loader2 } from "lucide-react" import { Button } from "@/components/ui/button" export default function ButtonLoading() { return ( ) } ``` ```button-outline.tsx import { Button } from "@/components/ui/button" export default function ButtonOutline() { return } ``` ```button-secondary.tsx import { Button } from "@/components/ui/button" export default function ButtonSecondary() { return } ``` ```button-with-icon.tsx import { Mail } from "lucide-react" import { Button } from "@/components/ui/button" export default function ButtonWithIcon() { return ( ) } ``` ================================================ FILE: cofounder/api/system/presets/ui/design/systems/shadcn/primitives/docs/button_with_icon.mdx ================================================ Name : Button Description : Displays a button or a component that looks like a button. --- ### import ``` import { Button } from "@/components/ui/button" ``` --- ### use ```button.mdx import { Button } from "@/components/ui/button" ``` ```button.mdx import { Link } from 'react-router-dom'; import { Button } from "@/components/ui/button" ... ``` --- ### examples ```button-demo.tsx import { Button } from "@/components/ui/button" export default function ButtonDemo() { return } ``` ```button-destructive.tsx import { Button } from "@/components/ui/button" export default function ButtonDestructive() { return } ``` ```button-ghost.tsx import { Button } from "@/components/ui/button" export default function ButtonGhost() { return } ``` ```button-icon.tsx import { ChevronRight } from "lucide-react" import { Button } from "@/components/ui/button" export default function ButtonIcon() { return ( ) } ``` ```button-link.tsx import { Button } from "@/components/ui/button" export default function ButtonLink() { return } ``` ```button-loading.tsx import { Loader2 } from "lucide-react" import { Button } from "@/components/ui/button" export default function ButtonLoading() { return ( ) } ``` ```button-outline.tsx import { Button } from "@/components/ui/button" export default function ButtonOutline() { return } ``` ```button-secondary.tsx import { Button } from "@/components/ui/button" export default function ButtonSecondary() { return } ``` ```button-with-icon.tsx import { Mail } from "lucide-react" import { Button } from "@/components/ui/button" export default function ButtonWithIcon() { return ( ) } ``` ================================================ FILE: cofounder/api/system/presets/ui/design/systems/shadcn/primitives/docs/calendar_datepicker.mdx ================================================ Name : Calendar Description : A date field component that allows users to enter and edit date. --- ### import ``` import { Calendar } from "@/components/ui/calendar" ``` --- ### use ```calendar.mdx ``` --- ### examples ```calendar-demo.tsx "use client" import * as React from "react" import { Calendar } from "@/components/ui/calendar" export default function CalendarDemo() { const [date, setDate] = React.useState(new Date()) return ( ) } ``` ================================================ FILE: cofounder/api/system/presets/ui/design/systems/shadcn/primitives/docs/carousel_horizontal.mdx ================================================ --- title: Carousel description: A carousel with motion and swipe built using Embla. --- ## Usage ```tsx import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, } from "@/components/ui/carousel"; ``` ```tsx ... ... ... ``` ## Examples ### Sizes To set the size of the items, you can use the `basis` utility class on the ``. ```tsx title="Example" showLineNumbers {4-6} // 33% of the carousel width. ... ... ... ``` ```tsx title="Responsive" showLineNumbers {4-6} // 50% on small screens and 33% on larger screens. ... ... ... ``` ### Spacing To set the spacing between the items, we use a `pl-[VALUE]` utility on the `` and a negative `-ml-[VALUE]` on the ``. **Why:** I tried to use the `gap` property or a `grid` layout on the ` ` but it required a lot of math and mental effort to get the spacing right. I found `pl-[VALUE]` and `-ml-[VALUE]` utilities much easier to use. You can always adjust this in your own project if you need to. ```tsx title="Example" showLineNumbers /-ml-4/ /pl-4/ ... ... ... ``` ```tsx title="Responsive" showLineNumbers /-ml-2/ /pl-2/ /md:-ml-4/ /md:pl-4/ ... ... ... ``` ### Orientation Use the `orientation` prop to set the orientation of the carousel. ```tsx showLineNumbers /vertical | horizontal/ ... ... ... ``` ## Options You can pass options to the carousel using the `opts` prop. ```tsx showLineNumbers {2-5} ... ... ... ``` ## API Use a state and the `setApi` props to get an instance of the carousel API. ```tsx showLineNumbers {1,4,22} import { type CarouselApi } from "@/components/ui/carousel"; export function Example() { const [api, setApi] = React.useState(); const [current, setCurrent] = React.useState(0); const [count, setCount] = React.useState(0); React.useEffect(() => { if (!api) { return; } setCount(api.scrollSnapList().length); setCurrent(api.selectedScrollSnap() + 1); api.on("select", () => { setCurrent(api.selectedScrollSnap() + 1); }); }, [api]); return ( ... ... ... ); } ``` ## Events You can listen to events using the api instance from `setApi`. ```tsx showLineNumbers {1,4-14,16} import { type CarouselApi } from "@/components/ui/carousel"; export function Example() { const [api, setApi] = React.useState(); React.useEffect(() => { if (!api) { return; } api.on("select", () => { // Do something on select. }); }, [api]); return ( ... ... ... ); } ``` ## Plugins You can use the `plugins` prop to add plugins to the carousel. ```ts showLineNumbers {1,6-10} import Autoplay from "embla-carousel-autoplay" export function Example() { return ( // ... ) } ``` ================================================ FILE: cofounder/api/system/presets/ui/design/systems/shadcn/primitives/docs/carousel_vertical.mdx ================================================ --- title: Carousel description: A carousel with motion and swipe built using Embla. --- ## Usage ```tsx import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, } from "@/components/ui/carousel"; ``` ```tsx ... ... ... ``` ## Examples ### Sizes To set the size of the items, you can use the `basis` utility class on the ``. ```tsx title="Example" showLineNumbers {4-6} // 33% of the carousel width. ... ... ... ``` ```tsx title="Responsive" showLineNumbers {4-6} // 50% on small screens and 33% on larger screens. ... ... ... ``` ### Spacing To set the spacing between the items, we use a `pl-[VALUE]` utility on the `` and a negative `-ml-[VALUE]` on the ``. **Why:** I tried to use the `gap` property or a `grid` layout on the ` ` but it required a lot of math and mental effort to get the spacing right. I found `pl-[VALUE]` and `-ml-[VALUE]` utilities much easier to use. You can always adjust this in your own project if you need to. ```tsx title="Example" showLineNumbers /-ml-4/ /pl-4/ ... ... ... ``` ```tsx title="Responsive" showLineNumbers /-ml-2/ /pl-2/ /md:-ml-4/ /md:pl-4/ ... ... ... ``` ### Orientation Use the `orientation` prop to set the orientation of the carousel. ```tsx showLineNumbers /vertical | horizontal/ ... ... ... ``` ## Options You can pass options to the carousel using the `opts` prop. ```tsx showLineNumbers {2-5} ... ... ... ``` ## API Use a state and the `setApi` props to get an instance of the carousel API. ```tsx showLineNumbers {1,4,22} import { type CarouselApi } from "@/components/ui/carousel"; export function Example() { const [api, setApi] = React.useState(); const [current, setCurrent] = React.useState(0); const [count, setCount] = React.useState(0); React.useEffect(() => { if (!api) { return; } setCount(api.scrollSnapList().length); setCurrent(api.selectedScrollSnap() + 1); api.on("select", () => { setCurrent(api.selectedScrollSnap() + 1); }); }, [api]); return ( ... ... ... ); } ``` ## Events You can listen to events using the api instance from `setApi`. ```tsx showLineNumbers {1,4-14,16} import { type CarouselApi } from "@/components/ui/carousel"; export function Example() { const [api, setApi] = React.useState(); React.useEffect(() => { if (!api) { return; } api.on("select", () => { // Do something on select. }); }, [api]); return ( ... ... ... ); } ``` ## Plugins You can use the `plugins` prop to add plugins to the carousel. ```ts showLineNumbers {1,6-10} import Autoplay from "embla-carousel-autoplay" export function Example() { return ( // ... ) } ``` ================================================ FILE: cofounder/api/system/presets/ui/design/systems/shadcn/primitives/docs/dialog_overlay_trigger_button.mdx ================================================ Name : Dialog Description : A window overlaid on either the primary window or another dialog window, rendering the content underneath inert. --- ### import ``` import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger, } from "@/components/ui/dialog" ``` --- ### use ```dialog.mdx Open Are you sure absolutely sure? This action cannot be undone. This will permanently delete your account and remove your data from our servers. ``` --- ### examples ```dialog-demo.tsx import { Button } from "@/components/ui/button" import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "@/components/ui/dialog" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" export default function DialogDemo() { return ( Edit profile Make changes to your profile here. Click save when you're done.
) } ``` ================================================ FILE: cofounder/api/system/presets/ui/design/systems/shadcn/primitives/docs/input_checkbox.mdx ================================================ Name : Checkbox Description : A control that allows the user to toggle between checked and not checked. --- ### import ``` import { Checkbox } from "@/components/ui/checkbox" ``` --- ### use ```checkbox.mdx ``` --- ### examples ```checkbox-demo.tsx "use client" import { Checkbox } from "@/components/ui/checkbox" export default function CheckboxDemo() { return (
) } ``` ```checkbox-disabled.tsx import { Checkbox } from "@/components/ui/checkbox" export default function CheckboxDisabled() { return (
) } ``` ```checkbox-with-text.tsx "use client" import { Checkbox } from "@/components/ui/checkbox" export default function CheckboxWithText() { return (

You agree to our Terms of Service and Privacy Policy.

) } ``` ================================================ FILE: cofounder/api/system/presets/ui/design/systems/shadcn/primitives/docs/input_combobox.mdx ================================================ Name : Combobox Description : Autocomplete input and command palette with a list of suggestions. --- ### import ``` "use client" import * as React from "react" import { Check, ChevronsUpDown } from "lucide-react" import { cn } from "@/lib/utils" import { Button } from "@/components/ui/button" import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, } from "@/components/ui/command" import { Popover, PopoverContent, PopoverTrigger, } from "@/components/ui/popover" const frameworks = [ { value: "next.js", label: "Next.js", }, { value: "sveltekit", label: "SvelteKit", }, { value: "nuxt.js", label: "Nuxt.js", }, { value: "remix", label: "Remix", }, { value: "astro", label: "Astro", }, ] export function ComboboxDemo() { const [open, setOpen] = React.useState(false) const [value, setValue] = React.useState("") return ( No framework found. {frameworks.map((framework) => ( { setValue(currentValue === value ? "" : currentValue) setOpen(false) }} > {framework.label} ))} ) } ``` --- ### use --- ### examples ```combobox-dropdown-menu.tsx "use client" import * as React from "react" import { Calendar, MoreHorizontal, Tags, Trash, User } from "lucide-react" import { Button } from "@/components/ui/button" import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from "@/components/ui/command" import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu" const labels = [ "feature", "bug", "enhancement", "documentation", "design", "question", "maintenance", ] export default function ComboboxDropdownMenu() { const [label, setLabel] = React.useState("feature") const [open, setOpen] = React.useState(false) return (

{label} Create a new project

Actions Assign to... Set due date... Apply label No label found. {labels.map((label) => ( { setLabel(value) setOpen(false) }} > {label} ))} Delete ⌘⌫
) } ``` ```combobox-popover.tsx "use client" import * as React from "react" import { ArrowUpCircle, CheckCircle2, Circle, HelpCircle, LucideIcon, XCircle, } from "lucide-react" import { cn } from "@/lib/utils" import { Button } from "@/components/ui/button" import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from "@/components/ui/command" import { Popover, PopoverContent, PopoverTrigger, } from "@/components/ui/popover" type Status = { value: string label: string icon: LucideIcon } const statuses: Status[] = [ { value: "backlog", label: "Backlog", icon: HelpCircle, }, { value: "todo", label: "Todo", icon: Circle, }, { value: "in progress", label: "In Progress", icon: ArrowUpCircle, }, { value: "done", label: "Done", icon: CheckCircle2, }, { value: "canceled", label: "Canceled", icon: XCircle, }, ] export default function ComboboxPopover() { const [open, setOpen] = React.useState(false) const [selectedStatus, setSelectedStatus] = React.useState( null ) return (

Status

No results found. {statuses.map((status) => ( { setSelectedStatus( statuses.find((priority) => priority.value === value) || null ) setOpen(false) }} > {status.label} ))}
) } ``` ================================================ FILE: cofounder/api/system/presets/ui/design/systems/shadcn/primitives/docs/input_datepicker.mdx ================================================ Name : Date Picker Description : A date picker component with range and presets. --- ### import ``` "use client" import * as React from "react" import { format } from "date-fns" import { Calendar as CalendarIcon } from "lucide-react" import { cn } from "@/lib/utils" import { Button } from "@/components/ui/button" import { Calendar } from "@/components/ui/calendar" import { Popover, PopoverContent, PopoverTrigger, } from "@/components/ui/popover" export function DatePickerDemo() { const [date, setDate] = React.useState() return ( ) } ``` --- ### use --- ### examples ```date-picker-demo.tsx "use client" import * as React from "react" import { format } from "date-fns" import { Calendar as CalendarIcon } from "lucide-react" import { cn } from "@/lib/utils" import { Button } from "@/components/ui/button" import { Calendar } from "@/components/ui/calendar" import { Popover, PopoverContent, PopoverTrigger, } from "@/components/ui/popover" export default function DatePickerDemo() { const [date, setDate] = React.useState() return ( ) } ``` ```date-picker-with-presets.tsx "use client" import * as React from "react" import { addDays, format } from "date-fns" import { Calendar as CalendarIcon } from "lucide-react" import { cn } from "@/lib/utils" import { Button } from "@/components/ui/button" import { Calendar } from "@/components/ui/calendar" import { Popover, PopoverContent, PopoverTrigger, } from "@/components/ui/popover" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select" export default function DatePickerWithPresets() { const [date, setDate] = React.useState() return (
) } ``` ```date-picker-with-range.tsx "use client" import * as React from "react" import { addDays, format } from "date-fns" import { Calendar as CalendarIcon } from "lucide-react" import { DateRange } from "react-day-picker" import { cn } from "@/lib/utils" import { Button } from "@/components/ui/button" import { Calendar } from "@/components/ui/calendar" import { Popover, PopoverContent, PopoverTrigger, } from "@/components/ui/popover" export default function DatePickerWithRange({ className, }: React.HTMLAttributes) { const [date, setDate] = React.useState({ from: new Date(2022, 0, 20), to: addDays(new Date(2022, 0, 20), 20), }) return (
) } ``` ================================================ FILE: cofounder/api/system/presets/ui/design/systems/shadcn/primitives/docs/input_field.mdx ================================================ Name : Input Description : Displays a form input field or a component that looks like an input field. --- ### import ``` import { Input } from "@/components/ui/input" ``` --- ### use ```input.mdx ``` --- ### examples ```input-demo.tsx import { Input } from "@/components/ui/input" export default function InputDemo() { return } ``` ```input-disabled.tsx import { Input } from "@/components/ui/input" export default function InputDisabled() { return } ``` ```input-file.tsx import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" export default function InputFile() { return (
) } ``` ```input-with-button.tsx import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" export default function InputWithButton() { return (
) } ``` ```input-with-label.tsx import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" export default function InputWithLabel() { return (
) } ``` ```input-with-text.tsx import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" export default function InputWithText() { return (

Enter your email address.

) } ``` ================================================ FILE: cofounder/api/system/presets/ui/design/systems/shadcn/primitives/docs/input_label.mdx ================================================ Name : Label Description : Renders an accessible label associated with controls. --- ### import ``` import { Label } from "@/components/ui/label" ``` --- ### use ```label.mdx ``` --- ### examples ```label-demo.tsx import { Checkbox } from "@/components/ui/checkbox" import { Label } from "@/components/ui/label" export default function LabelDemo() { return (
) } ``` ================================================ FILE: cofounder/api/system/presets/ui/design/systems/shadcn/primitives/docs/input_radio.mdx ================================================ Name : Radio Group Description : A set of checkable buttons—known as radio buttons—where no more than one of the buttons can be checked at a time. --- ### import ``` import { Label } from "@/components/ui/label" import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group" ``` --- ### use ```radio-group.mdx
``` --- ### examples ```radio-group-demo.tsx import { Label } from "@/components/ui/label" import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group" export default function RadioGroupDemo() { return (
) } ``` ================================================ FILE: cofounder/api/system/presets/ui/design/systems/shadcn/primitives/docs/input_searchfield.mdx ================================================ Name : Input Description : Displays a form input field or a component that looks like an input field. --- ### import ``` import { Input } from "@/components/ui/input" ``` --- ### use ```input.mdx ``` --- ### examples ```input-demo.tsx import { Input } from "@/components/ui/input" export default function InputDemo() { return } ``` ```input-disabled.tsx import { Input } from "@/components/ui/input" export default function InputDisabled() { return } ``` ```input-file.tsx import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" export default function InputFile() { return (
) } ``` ```input-with-button.tsx import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" export default function InputWithButton() { return (
) } ``` ```input-with-label.tsx import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" export default function InputWithLabel() { return (
) } ``` ```input-with-text.tsx import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" export default function InputWithText() { return (

Enter your email address.

) } ``` ================================================ FILE: cofounder/api/system/presets/ui/design/systems/shadcn/primitives/docs/input_select.mdx ================================================ Name : Select Description : Displays a list of options for the user to pick from—triggered by a button. --- ### import ``` import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select" ``` --- ### use ```select.mdx ``` --- ### examples ```select-demo.tsx import * as React from "react" import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue, } from "@/components/ui/select" export default function SelectDemo() { return ( ) } ``` ================================================ FILE: cofounder/api/system/presets/ui/design/systems/shadcn/primitives/docs/input_switch.mdx ================================================ Name : Switch Description : A control that allows the user to toggle between checked and not checked. --- ### import ``` import { Switch } from "@/components/ui/switch" ``` --- ### use ```switch.mdx ``` --- ### examples ```switch-demo.tsx import { Label } from "@/components/ui/label" import { Switch } from "@/components/ui/switch" export default function SwitchDemo() { return (
) } ``` ================================================ FILE: cofounder/api/system/presets/ui/design/systems/shadcn/primitives/docs/input_textarea.mdx ================================================ Name : Textarea Description : Displays a form textarea or a component that looks like a textarea. --- ### import ``` import { Textarea } from "@/components/ui/textarea" ``` --- ### use ```textarea.mdx {editUserText.length ? ( <>
) : ( <> )} )} ) : (
{`[...] processing [...]`}
)}

{sectionId} versions

{versions.map((version) => (
handleVersionChange(version)} onMouseEnter={() => { setComponent(() => components[version]); setLayoutPreviewUrl( `/_cofounder/generated/layouts/sections/${sectionId}.${version}.png`, ); }} onMouseLeave={() => { setComponent(() => components[choice]); setLayoutPreviewUrl( `/_cofounder/generated/layouts/sections/${sectionId}.${choice}.png`, ); }} className="cursor-pointer duration-100 hover:bg-gray-300 p-1 hover:p-2 rounded text-xs" >
{version === choice ? ( {version} ) : ( {version} )}
))} )} )) || <>} ); }; export default GenUiSection; ================================================ FILE: cofounder/boilerplate/vitereact-boilerplate/src/_cofounder/genui/genui-view.tsx ================================================ // @ts-ignore import React, { useEffect, useRef, useState } from "react"; import { ErrorBoundary } from "@/_cofounder/genui/error-boundary"; import GenUiPlaceholder from "@/_cofounder/genui/genui-placeholder"; import { useScreenshot } from "use-screenshot-hook"; import { createFileName } from "use-react-screenshot"; import { RefreshCcw, PencilRuler } from "lucide-react"; import meta from "@/_cofounder/meta.json"; interface GenUiViewProps { //component: { [key: string]: any }; [key: string]: any; } const GenUiView: React.FC = (query) => { const COFOUNDER_LOCAL_API = `{COFOUNDER_LOCAL_API_BASE_URL}`; const viewId = query.viewId; let _query = { ...query }; delete _query.viewId; const [Component, setComponent] = useState(null); const [components, setComponents] = useState<{ [key: string]: React.FC }>({}); const [choice, setChoice] = useState(""); const [versions, setVersions] = useState([]); const [versionsWithImportProblems, setVersionsWithImportProblems] = useState< string[] >([]); const [loaded, setLoaded] = useState(false); const [ready, setReady] = useState(false); const [newMenu, setNewMenu] = useState(false); const [editUserText, setEditUserText] = useState(""); const [editEnableDesigner, setEditEnableDesigner] = useState(true); const [inferenceStream, setInferenceStream] = useState(""); const [processing, setProcessing] = useState(false); const [isOpenTooltip, setIsOpenTooltip] = useState(false); const [isOpenTooltipTab, setIsOpenTooltipTab] = useState(false); const [layoutPreviewUrl, setLayoutPreviewUrl] = useState(``); const [layoutPreviewBlob, setLayoutPreviewBlob] = useState(``); // _____________________________________________________________________ const [cmdk, setCmdk] = useState(() => { // Retrieve the initial state from local storage or default to false // const savedCmdk = localStorage.getItem("cmdkState"); // return savedCmdk === "true"; // Convert string to boolean const savedCmdk = false; return savedCmdk; }); useEffect(() => { const down = (e: KeyboardEvent) => { if (e.key === "k" && (e.metaKey || e.ctrlKey)) { e.preventDefault(); setCmdk((prev) => { const newState = !prev; // localStorage.setItem("cmdkState", newState.toString()); // Save the new state to local storage return newState; }); } else if (e.key === "Escape") { setCmdk(false); // localStorage.setItem("cmdkState", "false"); // Reset state in local storage } }; document.addEventListener("keydown", down); return () => document.removeEventListener("keydown", down); }, []); const ref = useRef(null); const tooltipRef = useRef(null); const tooltipTabRef = useRef(null); useEffect(() => { if (Component) { _delayed_screenshot(); } }, [Component]); // _____________________________________________________________________ const { image, takeScreenshot } = useScreenshot({ ref }); const testScreenshot = () => { takeScreenshot(); }; async function _delayed_screenshot() { await new Promise((resolve) => setTimeout(resolve, 1e3)); takeScreenshot(); } const download = (image, { name = "img", extension = "png" } = {}) => { const a = document.createElement("a"); a.href = image; a.download = createFileName(extension, name); a.click(); }; useEffect(() => { if (image) { // download(image, { name: "lorem-ipsum", extension: "png" }); } }, [image]); useEffect(() => { const loadLayoutPreview = async () => { if (layoutPreviewUrl.length > 0) { setLayoutPreviewBlob(""); try { const layoutPreviewModule = new URL(layoutPreviewUrl, import.meta.url) .href; setLayoutPreviewBlob(layoutPreviewModule); // check after const response = await fetch(`http://localhost:5173${layoutPreviewUrl}`, { method: "HEAD", }); if ( !response.ok || !response.headers.get("content-type")?.includes("image") ) { setLayoutPreviewBlob(""); // console.log("> fetched resource is not an image ; probably empty, skipping preview layout assignment"); } } catch (error) { console.error("no layout preview", error); } } }; loadLayoutPreview(); }, [layoutPreviewUrl]); const api_updateVersionPreference = async ({ version }) => { try { await fetch(`${COFOUNDER_LOCAL_API}/project/actions`, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ project: meta.project, query: { action: "update:settings:preferences:versions", data: { views: { [viewId]: `${version}`, }, }, }, }), }); } catch (error) { console.error({ "genui:callApi:error": error }); } }; const api_regenerateComponent = async () => { if (processing) return; setProcessing(true); try { await fetch(`${COFOUNDER_LOCAL_API}/project/actions`, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ project: meta.project, query: { action: "regenerate:ui", data: { views: viewId, }, }, }), }); } catch (error) { console.error({ "genui:callApi:error": error }); } setProcessing(false); }; const api_iterateComponent = async () => { if (processing) return; setProcessing(true); try { await fetch(`${COFOUNDER_LOCAL_API}/project/actions`, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ project: meta.project, query: { action: "iterate:ui", data: { views: { [viewId]: { [choice]: { notes: { text: editUserText, attachments: [], // later, can attach extra image dragged into dropzone }, screenshot: { base64: image ? image : false, }, designer: editEnableDesigner, }, }, }, }, }, }), }); } catch (error) { console.error({ "genui:callApi:error": error }); } setProcessing(false); }; const api_updateComponent = async ({ operation }) => { return; // <------- debug ; is old method ; update later if (processing) return; setProcessing(true); let _query = { ...query }; if (operation === `edit`) { _query.edit = { version: choice, iteration: `${editUserText}`, }; } setEditUserText(``); try { const response = await fetch(`http://localhost:1337/${operation}`, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify(_query), }); const reader = response.body.getReader(); const decoder = new TextDecoder(); let completion = ``; while (true) { const { done, value } = await reader.read(); if (done) { break; } const chunk = decoder.decode(value); completion += chunk; setInferenceStream(completion); } } catch (error) { console.error({ "genui:callApi:error": error }); } setProcessing(false); }; const loadComponent = async () => { if (loaded) return; setLoaded(true); // reset everything setComponent(null); setComponents({}); setChoice(""); setVersions([]); setLoaded(false); setNewMenu(false); setInferenceStream(""); setProcessing(false); try { const _meta = await import( `@/_cofounder/generated/views/${viewId}/meta.json` ); const meta = _meta.default; // Access the default export // console.log({ id, choice: meta.choice, versions: meta.versions }); let loadedComponents: { [key: string]: React.FC } = {}; let problematicVersions: string[] = []; await Promise.all( meta.versions .sort((a, b) => { if (a === "empty") return -1; if (b === "empty") return 1; return a.localeCompare(b); }) .reverse() .map(async (version: string) => { try { const { default: LoadedVersionComponent } = await import( `@/_cofounder/generated/views/${viewId}/${version}.tsx` ); loadedComponents[version] = LoadedVersionComponent; // console.log({ "genui:load:version:success": version }); } catch (err) { // console.log({ "genui:load:version:error": { version, err } }); problematicVersions.push(version); } }), ); const workingVersions = meta.versions.filter( (v) => !problematicVersions.includes(v), ); setVersions(workingVersions); if (!workingVersions.length) { throw new Error("no working version found"); } problematicVersions.map((_v) => { delete loadedComponents[_v]; }); const _choice = problematicVersions.includes(meta.choice) ? `${workingVersions[0]}` : `${meta.choice}`; setChoice(_choice); setLayoutPreviewUrl( `/_cofounder/generated/layouts/views/${viewId}.${_choice}.png`, ); /* console.log({ viewId: query.viewId, workingVersions, problematicVersions, choice: workingVersions[0], loadedComponents, }); */ setComponents(loadedComponents); setComponent(() => loadedComponents[_choice]); } catch (e) { // console.log({ "genui:error": e }); // await callApi({ operation: `new` }); /* reload this current react component right here at this point in some way */ setLoaded(false); } setReady(true); }; useEffect(() => { if (loaded) return; loadComponent(); }, [viewId, loaded]); const _delayed_api_updateVersionPreference = async ({ version }) => { await new Promise((resolve) => setTimeout(resolve, 500)); await api_updateVersionPreference({ version }); }; useEffect(() => { // should cascade alongside error-boundary to filter out bad components if (versionsWithImportProblems.length) { setVersions((prev) => { const filteredVersions = prev.filter( (version) => !versionsWithImportProblems.includes(version), ); if ( filteredVersions.length && versionsWithImportProblems.includes(choice) ) { setComponent(null); setChoice(""); const newChoice = filteredVersions[0]; setChoice(newChoice); setComponent(() => components[newChoice]); _delayed_api_updateVersionPreference({ version: newChoice }); } else { setComponent(null); setChoice(""); } return filteredVersions; }); } }, [versionsWithImportProblems]); const handleVersionChange = (version: string) => { console.log(`handleVersionChange : ${viewId} : ${version}`); if (version != choice) { setChoice(version); api_updateVersionPreference({ version }); setLayoutPreviewUrl( `/_cofounder/generated/layouts/views/${viewId}.${version}.png`, ); } setComponent(() => components[version]); }; return ( <> {processing && (
building {viewId} ...
{ || ``}
)} {(loaded && ready && !processing && !versions.length && (
no working version for {viewId} ; Try to regenerate ?
)) || ""} {(versions.length && Component && (
{(Component && (
setIsOpenTooltip(true)} onMouseOut={() => setIsOpenTooltip(false)} >
)) || <>}
{cmdk && (

{viewId} versions

{!processing ? ( <>
setNewMenu(true)} onMouseLeave={() => setNewMenu(false)} onMouseOver={() => setIsOpenTooltipTab(true)} onMouseOut={() => setIsOpenTooltipTab(false)} onClick={() => setNewMenu(true)} > {newMenu && (
{image && ( <>
Attached current view screenshot
Current screenshot of the view )} {editUserText.length ? ( <>
) : ( <> )}
)}
) : (
{`[...] processing [...]`}
)} {!processing && versions.map((version) => (
handleVersionChange(version)} onMouseEnter={() => { setComponent(() => components[version]); setLayoutPreviewUrl( `/_cofounder/generated/layouts/views/${viewId}.${version}.png`, ); }} onMouseLeave={() => { setComponent(() => components[choice]); setLayoutPreviewUrl( `/_cofounder/generated/layouts/views/${viewId}.${choice}.png`, ); }} className="cursor-pointer duration-100 hover:bg-gray-300 p-1 hover:p-2 rounded text-xs" >
{choice === version ? ( {version} ) : ( {version} )}
))} {(layoutPreviewUrl?.length && layoutPreviewBlob?.length && ( Reference layout design generated by Cofounder for this ui component version )) || (
No reference layout design made for this version
)}
)}
)) || <>} ); }; export default GenUiView; ================================================ FILE: cofounder/boilerplate/vitereact-boilerplate/src/_cofounder/genui/genui-view.tsx.bak ================================================ // @ts-ignore import React, { useEffect, useRef, useState } from "react"; import { ErrorBoundary } from "@/_cofounder/genui/error-boundary"; import GenUiPlaceholder from "@/_cofounder/genui/genui-placeholder"; import { useScreenshot } from "use-screenshot-hook"; import { createFileName } from "use-react-screenshot"; import { RefreshCcw, PencilRuler } from "lucide-react"; import meta from "@/_cofounder/meta.json"; interface GenUiViewProps { //component: { [key: string]: any }; [key: string]: any; } const GenUiView: React.FC = (query) => { const COFOUNDER_LOCAL_API = `{COFOUNDER_LOCAL_API_BASE_URL}`; const viewId = query.viewId; let _query = { ...query }; delete _query.viewId; // console.log({ "genui:section": query }); const [Component, setComponent] = useState(null); const [components, setComponents] = useState<{ [key: string]: React.FC }>({}); const [choice, setChoice] = useState(""); const [versions, setVersions] = useState([]); const [versionsWithImportProblems, setVersionsWithImportProblems] = useState< string[] >([]); const [loaded, setLoaded] = useState(false); const [ready, setReady] = useState(false); const [newMenu, setNewMenu] = useState(false); const [editUserText, setEditUserText] = useState(""); const [inferenceStream, setInferenceStream] = useState(""); const [processing, setProcessing] = useState(false); const [isOpenTooltip, setIsOpenTooltip] = useState(false); const [isOpenTooltipTab, setIsOpenTooltipTab] = useState(false); // _____________________________________________________________________ const [cmdk, setCmdk] = useState(() => { // Retrieve the initial state from local storage or default to false const savedCmdk = localStorage.getItem("cmdkState"); return savedCmdk === "true"; // Convert string to boolean }); useEffect(() => { const down = (e: KeyboardEvent) => { if (e.key === "k" && (e.metaKey || e.ctrlKey)) { e.preventDefault(); setCmdk((prev) => { const newState = !prev; localStorage.setItem("cmdkState", newState.toString()); // Save the new state to local storage return newState; }); } else if (e.key === "Escape") { setCmdk(false); localStorage.setItem("cmdkState", "false"); // Reset state in local storage } }; document.addEventListener("keydown", down); return () => document.removeEventListener("keydown", down); }, []); const ref = useRef(null); const { image, takeScreenshot } = useScreenshot({ ref }); const testScreenshot = () => { takeScreenshot(); }; const download = (image, { name = "img", extension = "png" } = {}) => { const a = document.createElement("a"); a.href = image; a.download = createFileName(extension, name); a.click(); }; useEffect(() => { if (image) { // console.log({ image }) download(image, { name: "lorem-ipsum", extension: "png" }); } }, [image]); const callApi = async ({ operation }) => { return; // <------- debug ; is old method ; update later if (processing) return; setProcessing(true); let _query = { ...query }; if (operation === `edit`) { _query.edit = { version: choice, iteration: `${editUserText}`, }; } setEditUserText(``); try { const response = await fetch(`http://localhost:1337/${operation}`, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify(_query), }); const reader = response.body.getReader(); const decoder = new TextDecoder(); let completion = ``; while (true) { const { done, value } = await reader.read(); if (done) { break; } const chunk = decoder.decode(value); completion += chunk; setInferenceStream(completion); } } catch (error) { console.error({ "genui:callApi:error": error }); } setProcessing(false); }; const loadComponent = async () => { if (loaded) return; setLoaded(true); // reset everything setComponent(null); setComponents({}); setChoice(""); setVersions([]); setLoaded(false); setNewMenu(false); setInferenceStream(""); setProcessing(false); try { const _meta = await import( `@/_cofounder/generated/views/${viewId}/meta.json` ); const meta = _meta.default; // Access the default export // console.log({ id, choice: meta.choice, versions: meta.versions }); let loadedComponents: { [key: string]: React.FC } = {}; let problematicVersions: string[] = []; await Promise.all( meta.versions .sort() .reverse() .map(async (version: string) => { try { // try fetch first const response = await fetch( `@/_cofounder/generated/views/${viewId}/${version}.tsx`, ); console.log({ "debug:genui:view:fetch:response": response }); if (!response.ok) { throw new Error(`genui:view:fetchversion:error: ${version}`); } const { default: LoadedVersionComponent } = await import( `@/_cofounder/generated/views/${viewId}/${version}.tsx` ); loadedComponents[version] = LoadedVersionComponent; // console.log({ "genui:load:version:success": version }); } catch (err) { console.log({ "genui:view:load:version:error": { version, err } }); problematicVersions.push(version); } }), ); const workingVersions = meta.versions.filter( (v) => !problematicVersions.includes(v), ); setVersions(workingVersions); if (!workingVersions.length) { throw new Error("no working version found"); } problematicVersions.map((_v) => { delete loadedComponents[_v]; }); const _choice = problematicVersions.includes(meta.choice) ? `${workingVersions[0]}` : `${meta.choice}`; setChoice(_choice); setComponents(loadedComponents); setComponent(() => loadedComponents[_choice]); } catch (e) { // console.log({ "genui:error": e }); // await callApi({ operation: `new` }); /* reload this current react component right here at this point in some way */ setLoaded(false); } }; useEffect(() => { if (loaded) return; loadComponent(); }, [viewId, loaded]); const _delayed_api_updateVersionPreference = async ({ version }) => { await new Promise((resolve) => setTimeout(resolve, 500)); await api_updateVersionPreference({ version }); }; useEffect(() => { // should cascade alongside error-boundary to filter out bad components if (versionsWithImportProblems.length) { setVersions((prev) => { const filteredVersions = prev.filter( (version) => !versionsWithImportProblems.includes(version), ); if ( filteredVersions.length && versionsWithImportProblems.includes(choice) ) { setComponent(null); setChoice(""); const newChoice = filteredVersions[0]; setChoice(newChoice); setComponent(() => components[newChoice]); _delayed_api_updateVersionPreference({ version: newChoice }); } else { setComponent(null); setChoice(""); } return filteredVersions; }); } }, [versionsWithImportProblems]); const api_updateVersionPreference = async ({ version }) => { true; // do this next }; const handleVersionChange = (version: string) => { console.log(`handleVersionChange : ${viewId} : ${version}`); setChoice(version); setComponent(() => components[version]); }; return ( <> {cmdk && (
{viewId} : {JSON.stringify({ versions })} :{" "} {JSON.stringify({ versionsWithImportProblems })} :{" "} {JSON.stringify({ choice })}
)} {(versions.length && Component && !processing && ( <> {Component && (
)}
)) || <>} {cmdk && !versions.length && !processing && (
no working version for {viewId} ; Try to regenerate ?
)} ); }; export default GenUiView; ================================================ FILE: cofounder/boilerplate/vitereact-boilerplate/src/_cofounder/genui/tooltip.tsx ================================================ import React, { useState, useRef, useEffect } from "react"; const Tooltip = () => { const [isOpen, setIsOpen] = useState(false); const tooltipRef = useRef(null); const dropdownRef = useRef(null); const handleDropdownPosition = () => { const screenPadding = 16; const placeholderRect = tooltipRef.current?.getBoundingClientRect(); const dropdownRect = dropdownRef.current?.getBoundingClientRect(); if (!placeholderRect || !dropdownRect) return; const dropdownRightX = dropdownRect.x + dropdownRect.width; const placeholderRightX = placeholderRect.x + placeholderRect.width; if (dropdownRect.x < 0) { dropdownRef.current.style.left = "0"; dropdownRef.current.style.right = "auto"; dropdownRef.current.style.transform = `translateX(${-placeholderRect.x + screenPadding}px)`; } else if (dropdownRightX > window.outerWidth) { dropdownRef.current.style.left = "auto"; dropdownRef.current.style.right = "0"; dropdownRef.current.style.transform = `translateX(${window.outerWidth - placeholderRightX - screenPadding}px)`; } }; const toggleTooltip = () => { setIsOpen(!isOpen); }; useEffect(() => { if (isOpen) { handleDropdownPosition(); } }, [isOpen]); return (
setIsOpen(true)} onMouseOut={() => setIsOpen(false)} onTouchStart={toggleTooltip} > Here is a tooltip label
{isOpen && (
)}
); }; export default Tooltip; ================================================ FILE: cofounder/boilerplate/vitereact-boilerplate/src/_cofounder/meta.json ================================================ { "project": "foundermatch" } ================================================ FILE: cofounder/boilerplate/vitereact-boilerplate/src/_cofounder/utils.js ================================================ ================================================ FILE: cofounder/boilerplate/vitereact-boilerplate/src/_cofounder/vite-plugin/index.js ================================================ async function editSectionsAndViews({ path, code }) { // console.dir({ "_confounder:vite-plugin:editSectionsAndViews": true }); const genUi = { sections: false, views: false, }; let newTsx = code .split(`\n`) .filter((line) => { if (line.includes(`@/components/sections/`)) { if (!genUi.sections) genUi.sections = []; const sectionId = line.split(` `)[1]; genUi.sections = [...new Set([...genUi.sections, sectionId])]; return false; } if (line.includes(`@/components/views/`)) { if (!genUi.views) genUi.views = []; const viewId = line.split(` `)[1]; genUi.views = [...new Set([...genUi.views, viewId])]; return false; } return true; }) .join(`\n`); if (genUi.sections) { newTsx = `import GenUiSection from '@/_cofounder/genui/genui-section';\n${newTsx}`; for (let sectionId of genUi.sections) { newTsx = newTsx.replaceAll( `<${sectionId}`, ` { if (line.includes(`@/components/views/`)) { if (!genUi.views) genUi.views = []; const viewId = line.split(` `)[1]; genUi.views = [...new Set([...genUi.views, viewId])]; return false; } return true; }) .join(`\n`); if (genUi.views) { newTsx = `import GenUiView from '@/_cofounder/genui/genui-view';\n${newTsx}`; for (let viewId of genUi.views) { newTsx = newTsx.replaceAll(`<${viewId}`, ` { if (line.includes(`@/components/sections/`)) { if (!genUi.sections) genUi.sections = []; const sectionId = line.split(` `)[1]; genUi.sections = [...new Set([...genUi.sections, sectionId])]; return false; } return true; }) .join(`\n`); if (genUi.sections) { newTsx = `import GenUiSection from '@/_cofounder/genui/genui-section';\n${newTsx}`; for (let sectionId of genUi.sections) { newTsx = newTsx.replaceAll( `<${sectionId}`, ` GenUiView will call : @/_cofounder/generated/views/ > @/_cofounder/generated/views/* will call GenUiSection > GenUiSection will call @/_cofounder/generated/sections/ */ code = code.replaceAll( `{COFOUNDER_LOCAL_API_BASE_URL}`, `http://localhost:4200/api`, ); if (path.includes(`src/App.tsx`)) { return await editSectionsAndViews({ path, code }); } if ( path.includes(`_cofounder/generated/views`) || path.includes(`_cofounder/generated/sections`) ) { return await editSectionsAndViews({ path, code }); } /* if ( path.includes(`src/App.tsx`) || path.includes(`src/components/views/`) || path.includes(`src/components/sections/`) || path.includes(`@/_cofounder/generated/views/`) || path.includes(`@/_cofounder/generated/sections/`) ) { return await editSectionsAndViews({ path , code }); } */ return code; }, }; ================================================ FILE: cofounder/boilerplate/vitereact-boilerplate/src/components/ui/accordion.tsx ================================================ import * as React from "react"; import * as AccordionPrimitive from "@radix-ui/react-accordion"; import { ChevronDown } from "lucide-react"; import { cn } from "@/lib/utils"; const Accordion = AccordionPrimitive.Root; const AccordionItem = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); AccordionItem.displayName = "AccordionItem"; const AccordionTrigger = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, children, ...props }, ref) => ( svg]:rotate-180", className, )} {...props} > {children} )); AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName; const AccordionContent = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, children, ...props }, ref) => (
{children}
)); AccordionContent.displayName = AccordionPrimitive.Content.displayName; export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }; ================================================ FILE: cofounder/boilerplate/vitereact-boilerplate/src/components/ui/alert-dialog.tsx ================================================ import * as React from "react"; import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"; import { cn } from "@/lib/utils"; import { buttonVariants } from "@/components/ui/button"; const AlertDialog = AlertDialogPrimitive.Root; const AlertDialogTrigger = AlertDialogPrimitive.Trigger; const AlertDialogPortal = AlertDialogPrimitive.Portal; const AlertDialogOverlay = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName; const AlertDialogContent = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName; const AlertDialogHeader = ({ className, ...props }: React.HTMLAttributes) => (
); AlertDialogHeader.displayName = "AlertDialogHeader"; const AlertDialogFooter = ({ className, ...props }: React.HTMLAttributes) => (
); AlertDialogFooter.displayName = "AlertDialogFooter"; const AlertDialogTitle = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName; const AlertDialogDescription = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName; const AlertDialogAction = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName; const AlertDialogCancel = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName; export { AlertDialog, AlertDialogPortal, AlertDialogOverlay, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogAction, AlertDialogCancel, }; ================================================ FILE: cofounder/boilerplate/vitereact-boilerplate/src/components/ui/alert.tsx ================================================ import * as React from "react"; import { cva, type VariantProps } from "class-variance-authority"; import { cn } from "@/lib/utils"; const alertVariants = cva( "relative w-full rounded-lg border border-neutral-200 p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-neutral-950 dark:border-neutral-800 dark:[&>svg]:text-neutral-50", { variants: { variant: { default: "bg-white text-neutral-950 dark:bg-neutral-950 dark:text-neutral-50", destructive: "border-red-500/50 text-red-500 dark:border-red-500 [&>svg]:text-red-500 dark:border-red-900/50 dark:text-red-900 dark:dark:border-red-900 dark:[&>svg]:text-red-900", }, }, defaultVariants: { variant: "default", }, }, ); const Alert = React.forwardRef< HTMLDivElement, React.HTMLAttributes & VariantProps >(({ className, variant, ...props }, ref) => (
)); Alert.displayName = "Alert"; const AlertTitle = React.forwardRef< HTMLParagraphElement, React.HTMLAttributes >(({ className, ...props }, ref) => (
)); AlertTitle.displayName = "AlertTitle"; const AlertDescription = React.forwardRef< HTMLParagraphElement, React.HTMLAttributes >(({ className, ...props }, ref) => (
)); AlertDescription.displayName = "AlertDescription"; export { Alert, AlertTitle, AlertDescription }; ================================================ FILE: cofounder/boilerplate/vitereact-boilerplate/src/components/ui/aspect-ratio.tsx ================================================ import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio"; const AspectRatio = AspectRatioPrimitive.Root; export { AspectRatio }; ================================================ FILE: cofounder/boilerplate/vitereact-boilerplate/src/components/ui/avatar.tsx ================================================ import * as React from "react"; import * as AvatarPrimitive from "@radix-ui/react-avatar"; import { cn } from "@/lib/utils"; const Avatar = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); Avatar.displayName = AvatarPrimitive.Root.displayName; const AvatarImage = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); AvatarImage.displayName = AvatarPrimitive.Image.displayName; const AvatarFallback = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName; export { Avatar, AvatarImage, AvatarFallback }; ================================================ FILE: cofounder/boilerplate/vitereact-boilerplate/src/components/ui/badge.tsx ================================================ import * as React from "react"; import { cva, type VariantProps } from "class-variance-authority"; import { cn } from "@/lib/utils"; const badgeVariants = cva( "inline-flex items-center rounded-full border border-neutral-200 px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-neutral-950 focus:ring-offset-2 dark:border-neutral-800 dark:focus:ring-neutral-300", { variants: { variant: { default: "border-transparent bg-neutral-900 text-neutral-50 hover:bg-neutral-900/80 dark:bg-neutral-50 dark:text-neutral-900 dark:hover:bg-neutral-50/80", secondary: "border-transparent bg-neutral-100 text-neutral-900 hover:bg-neutral-100/80 dark:bg-neutral-800 dark:text-neutral-50 dark:hover:bg-neutral-800/80", destructive: "border-transparent bg-red-500 text-neutral-50 hover:bg-red-500/80 dark:bg-red-900 dark:text-neutral-50 dark:hover:bg-red-900/80", outline: "text-neutral-950 dark:text-neutral-50", }, }, defaultVariants: { variant: "default", }, }, ); export interface BadgeProps extends React.HTMLAttributes, VariantProps {} function Badge({ className, variant, ...props }: BadgeProps) { return (
); } export { Badge, badgeVariants }; ================================================ FILE: cofounder/boilerplate/vitereact-boilerplate/src/components/ui/breadcrumb.tsx ================================================ import * as React from "react"; import { Slot } from "@radix-ui/react-slot"; import { ChevronRight, MoreHorizontal } from "lucide-react"; import { cn } from "@/lib/utils"; const Breadcrumb = React.forwardRef< HTMLElement, React.ComponentPropsWithoutRef<"nav"> & { separator?: React.ReactNode; } >(({ ...props }, ref) =>