From d1a30abb56e9b5609b6b559ce077d2f2f3c1c1ab Mon Sep 17 00:00:00 2001 From: yash-pouranik Date: Sat, 28 Mar 2026 02:23:41 +0530 Subject: [PATCH 1/5] =?UTF-8?q?=EF=BB=BF=20feat(rls):=20add=20owner-write?= =?UTF-8?q?=20RLS=20flow=20and=20move=20dashboard=20RLS=20config=20to=20mo?= =?UTF-8?q?dal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - add collection-level RLS config support in project model/api - add public-api auth-context + write authorization middleware - allow PATCH in public data routes - replace inline RLS controls with compact RLS button + settings dialog - clarify ownerField help text in English - update README/docs for RLS publishable write behavior and PATCH endpoint - fix users default RLS ownerField consistency to _id --- README.md | 2 + .../src/controllers/project.controller.js | 119 ++++++- apps/dashboard-api/src/routes/projects.js | 8 +- .../middlewares/authorizeWriteOperation.js | 101 ++++++ .../middlewares/resolvePublicAuthContext.js | 25 ++ apps/public-api/src/routes/data.js | 14 +- .../{index-BEgJJAWh.js => index-Bu_-Dcm1.js} | 198 ++++++++---- apps/web-dashboard/dist/index.html | 2 +- apps/web-dashboard/src/pages/Database.jsx | 246 ++++++++++++++- docs/api-reference.md | 3 +- docs/database.md | 12 + docs/getting-started.md | 6 +- docs/rls-implementation-roadmap.md | 291 ++++++++++++++++++ packages/common/src/models/Project.js | 14 +- 14 files changed, 956 insertions(+), 85 deletions(-) create mode 100644 apps/public-api/src/middlewares/authorizeWriteOperation.js create mode 100644 apps/public-api/src/middlewares/resolvePublicAuthContext.js rename apps/web-dashboard/dist/assets/{index-BEgJJAWh.js => index-Bu_-Dcm1.js} (67%) create mode 100644 docs/rls-implementation-roadmap.md diff --git a/README.md b/README.md index af0a716dc..1368b63bc 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,8 @@ const res = await fetch('https://api.urbackend.bitbros.in/api/data/products', { }); ``` +By default, publishable keys are read-focused. Write operations require a secret key unless you enable collection-level RLS (owner-write-only), in which case publishable writes also require `Authorization: Bearer `. + --- ## 🏗️ How it Works (The Visual Flow) diff --git a/apps/dashboard-api/src/controllers/project.controller.js b/apps/dashboard-api/src/controllers/project.controller.js index 63f0e3d28..71d3f3821 100644 --- a/apps/dashboard-api/src/controllers/project.controller.js +++ b/apps/dashboard-api/src/controllers/project.controller.js @@ -25,6 +25,27 @@ const validateUsersSchema = (schema) => { return !!(hasEmail && hasPassword); }; +const getDefaultRlsForCollection = (collectionName, schema = []) => { + const normalizedName = String(collectionName || '').toLowerCase(); + const keys = Array.isArray(schema) ? schema.map(f => f?.key).filter(Boolean) : []; + + let ownerField = 'userId'; + if (normalizedName === 'users') { + ownerField = '_id'; + } else if (keys.includes('userId')) { + ownerField = 'userId'; + } else if (keys.includes('ownerId')) { + ownerField = 'ownerId'; + } + + return { + enabled: false, + mode: 'owner-write-only', + ownerField, + requireAuthForWrite: true + }; +}; + @@ -124,10 +145,24 @@ module.exports.getSingleProject = async (req, res) => { if (col.name === 'users' && col.model) { return { ...col, - model: col.model.filter(m => m.key !== 'password') + model: col.model.filter(m => m.key !== 'password'), + rls: col.rls || { + enabled: false, + mode: 'owner-write-only', + ownerField: '_id', + requireAuthForWrite: true + } }; } - return col; + return { + ...col, + rls: col.rls || { + enabled: false, + mode: 'owner-write-only', + ownerField: 'userId', + requireAuthForWrite: true + } + }; }); } @@ -324,7 +359,11 @@ module.exports.createCollection = async (req, res) => { } } - project.collections.push({ name: collectionName, model: schema }); + project.collections.push({ + name: collectionName, + model: schema, + rls: getDefaultRlsForCollection(collectionName, schema) + }); await project.save(); await deleteProjectById(projectId); @@ -930,10 +969,24 @@ module.exports.toggleAuth = async (req, res) => { if (col.name === 'users' && col.model) { return { ...col, - model: col.model.filter(m => m.key !== 'password') + model: col.model.filter(m => m.key !== 'password'), + rls: col.rls || { + enabled: false, + mode: 'owner-write-only', + ownerField: '_id', + requireAuthForWrite: true + } }; } - return col; + return { + ...col, + rls: col.rls || { + enabled: false, + mode: 'owner-write-only', + ownerField: 'userId', + requireAuthForWrite: true + } + }; }); } @@ -945,4 +998,58 @@ module.exports.toggleAuth = async (req, res) => { } catch (err) { res.status(500).json({ error: err.message }); } -} \ No newline at end of file +} + +// PATCH REQ - UPDATE COLLECTION RLS (V1) +module.exports.updateCollectionRls = async (req, res) => { + try { + const { projectId, collectionName } = req.params; + const { enabled, mode, ownerField, requireAuthForWrite } = req.body || {}; + + const project = await Project.findOne({ _id: projectId, owner: req.user._id }); + if (!project) return res.status(404).json({ error: "Project not found" }); + + const collection = project.collections.find(c => c.name === collectionName); + if (!collection) return res.status(404).json({ error: "Collection not found" }); + + const validMode = mode || collection?.rls?.mode || 'owner-write-only'; + if (validMode !== 'owner-write-only') { + return res.status(400).json({ error: "Unsupported RLS mode. Only 'owner-write-only' is allowed in V1." }); + } + + const modelKeys = (collection.model || []).map(f => f.key); + const nextOwnerField = ownerField || collection?.rls?.ownerField || 'userId'; + + if (nextOwnerField !== '_id' && !modelKeys.includes(nextOwnerField)) { + return res.status(400).json({ + error: "Invalid owner field", + message: `ownerField '${nextOwnerField}' not found in collection schema` + }); + } + + collection.rls = { + enabled: typeof enabled === 'boolean' ? enabled : !!collection?.rls?.enabled, + mode: validMode, + ownerField: nextOwnerField, + requireAuthForWrite: typeof requireAuthForWrite === 'boolean' + ? requireAuthForWrite + : (collection?.rls?.requireAuthForWrite ?? true) + }; + + await project.save(); + + await deleteProjectById(projectId); + await deleteProjectByApiKeyCache(project.publishableKey); + await deleteProjectByApiKeyCache(project.secretKey); + + res.json({ + message: "Collection RLS updated", + collection: { + name: collection.name, + rls: collection.rls + } + }); + } catch (err) { + res.status(500).json({ error: err.message }); + } +} diff --git a/apps/dashboard-api/src/routes/projects.js b/apps/dashboard-api/src/routes/projects.js index 931a48693..1286a3995 100644 --- a/apps/dashboard-api/src/routes/projects.js +++ b/apps/dashboard-api/src/routes/projects.js @@ -27,7 +27,8 @@ const { deleteExternalStorageConfig, analytics, updateAllowedDomains, - toggleAuth + toggleAuth, + updateCollectionRls } = require("../controllers/project.controller") const { createAdminUser, resetPassword, getUserDetails, updateAdminUser } = require('../controllers/userAuth.controller'); @@ -101,6 +102,9 @@ router.get('/:projectId/analytics', authMiddleware, analytics); // PATCH REQ FOR TOGGLE AUTH router.patch('/:projectId/auth/toggle', authMiddleware, verifyEmail, toggleAuth); +// PATCH REQ FOR COLLECTION RLS SETTINGS +router.patch('/:projectId/collections/:collectionName/rls', authMiddleware, verifyEmail, updateCollectionRls); + // ADMIN AUTH ROUTES const {checkAuthEnabled} = require('@urbackend/common'); const {loadProjectForAdmin} = require('@urbackend/common'); @@ -110,4 +114,4 @@ router.patch('/:projectId/admin/users/:userId/password', authMiddleware, loadPro router.get('/:projectId/admin/users/:userId', authMiddleware, loadProjectForAdmin, checkAuthEnabled, getUserDetails); router.put('/:projectId/admin/users/:userId', authMiddleware, loadProjectForAdmin, checkAuthEnabled, updateAdminUser); -module.exports = router; \ No newline at end of file +module.exports = router; diff --git a/apps/public-api/src/middlewares/authorizeWriteOperation.js b/apps/public-api/src/middlewares/authorizeWriteOperation.js new file mode 100644 index 000000000..1abe236fd --- /dev/null +++ b/apps/public-api/src/middlewares/authorizeWriteOperation.js @@ -0,0 +1,101 @@ +const { getConnection } = require('@urbackend/common'); +const { getCompiledModel } = require('@urbackend/common'); +const mongoose = require('mongoose'); + +module.exports = async (req, res, next) => { + try { + if (req.keyRole === 'secret') { + return next(); + } + + const { collectionName, id } = req.params; + const project = req.project; + const collectionConfig = project.collections.find(c => c.name === collectionName); + + if (!collectionConfig) { + return res.status(404).json({ error: 'Collection not found' }); + } + + const rls = collectionConfig.rls || {}; + if (!rls.enabled) { + return res.status(403).json({ + error: 'Write blocked for publishable key', + message: 'Enable RLS for this collection to allow publishable-key writes.' + }); + } + + if (rls.requireAuthForWrite && !req.authUser?.userId) { + return res.status(401).json({ + error: 'Authentication required', + message: 'Provide a valid user Bearer token for write operations.' + }); + } + + if ((rls.mode || 'owner-write-only') !== 'owner-write-only') { + return res.status(403).json({ error: 'Unsupported RLS mode' }); + } + + const ownerField = rls.ownerField || 'userId'; + const authUserId = String(req.authUser.userId); + const method = String(req.method || '').toUpperCase(); + + if (method === 'POST') { + const incomingOwner = req.body?.[ownerField]; + + if (ownerField === '_id') { + return res.status(403).json({ + error: 'Insert denied', + message: "RLS ownerField '_id' is not valid for insert ownership checks." + }); + } + + if (incomingOwner === undefined || incomingOwner === null || incomingOwner === '') { + req.body[ownerField] = authUserId; + return next(); + } + + if (String(incomingOwner) !== authUserId) { + return res.status(403).json({ + error: 'RLS owner mismatch', + message: `You can only create documents with ${ownerField} equal to your user id.` + }); + } + + return next(); + } + + if (method === 'PUT' || method === 'PATCH' || method === 'DELETE') { + if (!id || !mongoose.Types.ObjectId.isValid(id)) { + return res.status(400).json({ error: 'Invalid ID format.' }); + } + + const connection = await getConnection(project._id); + const Model = getCompiledModel(connection, collectionConfig, project._id, project.resources.db.isExternal); + const doc = await Model.findById(id).select(ownerField).lean(); + + if (!doc) { + return res.status(404).json({ error: 'Document not found.' }); + } + + if (ownerField === '_id') { + if (String(doc._id) !== authUserId) { + return res.status(403).json({ error: 'RLS owner mismatch', message: 'You can only modify your own document.' }); + } + } else { + if (req.body && Object.prototype.hasOwnProperty.call(req.body, ownerField) && String(req.body[ownerField]) !== String(doc[ownerField])) { + return res.status(403).json({ error: 'Owner field immutable', message: `${ownerField} cannot be changed under RLS.` }); + } + + if (doc[ownerField] === undefined || doc[ownerField] === null || String(doc[ownerField]) !== authUserId) { + return res.status(403).json({ error: 'RLS owner mismatch', message: 'You can only modify your own document.' }); + } + } + + return next(); + } + + return next(); + } catch (err) { + return res.status(500).json({ error: err.message }); + } +}; diff --git a/apps/public-api/src/middlewares/resolvePublicAuthContext.js b/apps/public-api/src/middlewares/resolvePublicAuthContext.js new file mode 100644 index 000000000..abb1d340d --- /dev/null +++ b/apps/public-api/src/middlewares/resolvePublicAuthContext.js @@ -0,0 +1,25 @@ +const jwt = require('jsonwebtoken'); + +module.exports = (req, res, next) => { + const authHeader = req.header('Authorization'); + req.authUser = null; + + if (!authHeader || !authHeader.startsWith('Bearer ')) { + return next(); + } + + const token = authHeader.slice(7).trim(); + if (!token) return next(); + + try { + const decoded = jwt.verify(token, req.project.jwtSecret); + req.authUser = { + userId: decoded.userId || decoded._id || decoded.id, + claims: decoded + }; + } catch { + req.authUser = null; + } + + next(); +}; diff --git a/apps/public-api/src/routes/data.js b/apps/public-api/src/routes/data.js index ef6668db5..e83732e6d 100644 --- a/apps/public-api/src/routes/data.js +++ b/apps/public-api/src/routes/data.js @@ -1,13 +1,14 @@ const express = require('express'); const router = express.Router(); const verifyApiKey = require('../middlewares/verifyApiKey'); -const requireSecretKey = require('../middlewares/requireSecretKey'); +const resolvePublicAuthContext = require('../middlewares/resolvePublicAuthContext'); +const authorizeWriteOperation = require('../middlewares/authorizeWriteOperation'); const projectRateLimiter = require('../middlewares/projectRateLimiter'); const { insertData, getAllData, getSingleDoc, updateSingleData, deleteSingleDoc } = require("../controllers/data.controller") // POST REQ TO INSERT DATA -router.post('/:collectionName', verifyApiKey, projectRateLimiter, requireSecretKey, insertData); +router.post('/:collectionName', verifyApiKey, resolvePublicAuthContext, projectRateLimiter, authorizeWriteOperation, insertData); // GET REQ ALL DATA @@ -19,12 +20,15 @@ router.get('/:collectionName/:id', verifyApiKey, projectRateLimiter, getSingleDo // DELETE REQ SINGLE DATA -router.delete('/:collectionName/:id', verifyApiKey, projectRateLimiter, requireSecretKey, deleteSingleDoc); +router.delete('/:collectionName/:id', verifyApiKey, resolvePublicAuthContext, projectRateLimiter, authorizeWriteOperation, deleteSingleDoc); // PUT REQ SINGLE DATA -router.put('/:collectionName/:id', verifyApiKey, projectRateLimiter, requireSecretKey, updateSingleData); +router.put('/:collectionName/:id', verifyApiKey, resolvePublicAuthContext, projectRateLimiter, authorizeWriteOperation, updateSingleData); +// PATCH REQ SINGLE DATA +router.patch('/:collectionName/:id', verifyApiKey, resolvePublicAuthContext, projectRateLimiter, authorizeWriteOperation, updateSingleData); -module.exports = router; \ No newline at end of file + +module.exports = router; diff --git a/apps/web-dashboard/dist/assets/index-BEgJJAWh.js b/apps/web-dashboard/dist/assets/index-Bu_-Dcm1.js similarity index 67% rename from apps/web-dashboard/dist/assets/index-BEgJJAWh.js rename to apps/web-dashboard/dist/assets/index-Bu_-Dcm1.js index a676fc9a3..a63234adf 100644 --- a/apps/web-dashboard/dist/assets/index-BEgJJAWh.js +++ b/apps/web-dashboard/dist/assets/index-Bu_-Dcm1.js @@ -1,14 +1,14 @@ -function G9(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 a of i)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();function mi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var k0={exports:{}},Ic={};var nT;function K9(){if(nT)return Ic;nT=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,i,a){var l=null;if(a!==void 0&&(l=""+a),i.key!==void 0&&(l=""+i.key),"key"in i){a={};for(var u in i)u!=="key"&&(a[u]=i[u])}else a=i;return i=a.ref,{$$typeof:e,type:r,key:l,ref:i!==void 0?i:null,props:a}}return Ic.Fragment=t,Ic.jsx=n,Ic.jsxs=n,Ic}var rT;function Y9(){return rT||(rT=1,k0.exports=K9()),k0.exports}var p=Y9(),A0={exports:{}},Ie={};var iT;function X9(){if(iT)return Ie;iT=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),y=Symbol.iterator;function v(L){return L===null||typeof L!="object"?null:(L=y&&L[y]||L["@@iterator"],typeof L=="function"?L:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,C={};function k(L,G,P){this.props=L,this.context=G,this.refs=C,this.updater=P||b}k.prototype.isReactComponent={},k.prototype.setState=function(L,G){if(typeof L!="object"&&typeof L!="function"&&L!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,L,G,"setState")},k.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function E(){}E.prototype=k.prototype;function A(L,G,P){this.props=L,this.context=G,this.refs=C,this.updater=P||b}var R=A.prototype=new E;R.constructor=A,j(R,k.prototype),R.isPureReactComponent=!0;var D=Array.isArray;function O(){}var M={H:null,A:null,T:null,S:null},I=Object.prototype.hasOwnProperty;function $(L,G,P){var he=P.ref;return{$$typeof:e,type:L,key:G,ref:he!==void 0?he:null,props:P}}function N(L,G){return $(L.type,G,L.props)}function F(L){return typeof L=="object"&&L!==null&&L.$$typeof===e}function H(L){var G={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(P){return G[P]})}var ae=/\/+/g;function Z(L,G){return typeof L=="object"&&L!==null&&L.key!=null?H(""+L.key):G.toString(36)}function re(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(O,O):(L.status="pending",L.then(function(G){L.status==="pending"&&(L.status="fulfilled",L.value=G)},function(G){L.status==="pending"&&(L.status="rejected",L.reason=G)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function U(L,G,P,he,xe){var ve=typeof L;(ve==="undefined"||ve==="boolean")&&(L=null);var ce=!1;if(L===null)ce=!0;else switch(ve){case"bigint":case"string":case"number":ce=!0;break;case"object":switch(L.$$typeof){case e:case t:ce=!0;break;case h:return ce=L._init,U(ce(L._payload),G,P,he,xe)}}if(ce)return xe=xe(L),ce=he===""?"."+Z(L,0):he,D(xe)?(P="",ce!=null&&(P=ce.replace(ae,"$&/")+"/"),U(xe,G,P,"",function(ye){return ye})):xe!=null&&(F(xe)&&(xe=N(xe,P+(xe.key==null||L&&L.key===xe.key?"":(""+xe.key).replace(ae,"$&/")+"/")+ce)),G.push(xe)),1;ce=0;var be=he===""?".":he+":";if(D(L))for(var Q=0;Q>>1,z=U[de];if(0>>1;dei(P,ie))hei(xe,P)?(U[de]=xe,U[he]=ie,de=he):(U[de]=P,U[G]=ie,de=G);else if(hei(xe,ie))U[de]=xe,U[he]=ie,de=he;else break e}}return W}function i(U,W){var ie=U.sortIndex-W.sortIndex;return ie!==0?ie:U.id-W.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var c=[],d=[],h=1,m=null,y=3,v=!1,b=!1,j=!1,C=!1,k=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function R(U){for(var W=n(d);W!==null;){if(W.callback===null)r(d);else if(W.startTime<=U)r(d),W.sortIndex=W.expirationTime,t(c,W);else break;W=n(d)}}function D(U){if(j=!1,R(U),!b)if(n(c)!==null)b=!0,O||(O=!0,H());else{var W=n(d);W!==null&&re(D,W.startTime-U)}}var O=!1,M=-1,I=5,$=-1;function N(){return C?!0:!(e.unstable_now()-$U&&N());){var de=m.callback;if(typeof de=="function"){m.callback=null,y=m.priorityLevel;var z=de(m.expirationTime<=U);if(U=e.unstable_now(),typeof z=="function"){m.callback=z,R(U),W=!0;break t}m===n(c)&&r(c),R(U)}else r(c);m=n(c)}if(m!==null)W=!0;else{var L=n(d);L!==null&&re(D,L.startTime-U),W=!1}}break e}finally{m=null,y=ie,v=!1}W=void 0}}finally{W?H():O=!1}}}var H;if(typeof A=="function")H=function(){A(F)};else if(typeof MessageChannel<"u"){var ae=new MessageChannel,Z=ae.port2;ae.port1.onmessage=F,H=function(){Z.postMessage(null)}}else H=function(){k(F,0)};function re(U,W){M=k(function(){U(e.unstable_now())},W)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(U){U.callback=null},e.unstable_forceFrameRate=function(U){0>U||125de?(U.sortIndex=ie,t(d,U),n(c)===null&&U===n(d)&&(j?(E(M),M=-1):j=!0,re(D,ie-de))):(U.sortIndex=z,t(c,U),b||v||(b=!0,O||(O=!0,H()))),U},e.unstable_shouldYield=N,e.unstable_wrapCallback=function(U){var W=y;return function(){var ie=y;y=W;try{return U.apply(this,arguments)}finally{y=ie}}}})(O0)),O0}var lT;function J9(){return lT||(lT=1,T0.exports=Q9()),T0.exports}var R0={exports:{}},Pn={};var sT;function e$(){if(sT)return Pn;sT=1;var e=Cu();function t(c){var d="https://react.dev/errors/"+c;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),R0.exports=e$(),R0.exports}var cT;function t$(){if(cT)return Lc;cT=1;var e=J9(),t=Cu(),n=j5();function r(o){var s="https://react.dev/errors/"+o;if(1z||(o.current=de[z],de[z]=null,z--)}function P(o,s){z++,de[z]=o.current,o.current=s}var he=L(null),xe=L(null),ve=L(null),ce=L(null);function be(o,s){switch(P(ve,s),P(xe,o),P(he,null),s.nodeType){case 9:case 11:o=(o=s.documentElement)&&(o=o.namespaceURI)?kE(o):0;break;default:if(o=s.tagName,s=s.namespaceURI)s=kE(s),o=AE(s,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}G(he),P(he,o)}function Q(){G(he),G(xe),G(ve)}function ye(o){o.memoizedState!==null&&P(ce,o);var s=he.current,f=AE(s,o.type);s!==f&&(P(xe,o),P(he,f))}function pe(o){xe.current===o&&(G(he),G(xe)),ce.current===o&&(G(ce),Mc._currentValue=ie)}var J,Ae;function je(o){if(J===void 0)try{throw Error()}catch(f){var s=f.stack.trim().match(/\n( *(at )?)/);J=s&&s[1]||"",Ae=-1r[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 a of i)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();function wi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var k0={exports:{}},Ic={};var nT;function K9(){if(nT)return Ic;nT=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,i,a){var l=null;if(a!==void 0&&(l=""+a),i.key!==void 0&&(l=""+i.key),"key"in i){a={};for(var u in i)u!=="key"&&(a[u]=i[u])}else a=i;return i=a.ref,{$$typeof:e,type:r,key:l,ref:i!==void 0?i:null,props:a}}return Ic.Fragment=t,Ic.jsx=n,Ic.jsxs=n,Ic}var rT;function Y9(){return rT||(rT=1,k0.exports=K9()),k0.exports}var p=Y9(),A0={exports:{}},Be={};var iT;function X9(){if(iT)return Be;iT=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),y=Symbol.iterator;function v(L){return L===null||typeof L!="object"?null:(L=y&&L[y]||L["@@iterator"],typeof L=="function"?L:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,C={};function k(L,G,P){this.props=L,this.context=G,this.refs=C,this.updater=P||b}k.prototype.isReactComponent={},k.prototype.setState=function(L,G){if(typeof L!="object"&&typeof L!="function"&&L!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,L,G,"setState")},k.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function E(){}E.prototype=k.prototype;function A(L,G,P){this.props=L,this.context=G,this.refs=C,this.updater=P||b}var R=A.prototype=new E;R.constructor=A,j(R,k.prototype),R.isPureReactComponent=!0;var D=Array.isArray;function O(){}var M={H:null,A:null,T:null,S:null},I=Object.prototype.hasOwnProperty;function $(L,G,P){var he=P.ref;return{$$typeof:e,type:L,key:G,ref:he!==void 0?he:null,props:P}}function N(L,G){return $(L.type,G,L.props)}function F(L){return typeof L=="object"&&L!==null&&L.$$typeof===e}function H(L){var G={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(P){return G[P]})}var ie=/\/+/g;function Z(L,G){return typeof L=="object"&&L!==null&&L.key!=null?H(""+L.key):G.toString(36)}function ne(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(O,O):(L.status="pending",L.then(function(G){L.status==="pending"&&(L.status="fulfilled",L.value=G)},function(G){L.status==="pending"&&(L.status="rejected",L.reason=G)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function U(L,G,P,he,xe){var ve=typeof L;(ve==="undefined"||ve==="boolean")&&(L=null);var ue=!1;if(L===null)ue=!0;else switch(ve){case"bigint":case"string":case"number":ue=!0;break;case"object":switch(L.$$typeof){case e:case t:ue=!0;break;case h:return ue=L._init,U(ue(L._payload),G,P,he,xe)}}if(ue)return xe=xe(L),ue=he===""?"."+Z(L,0):he,D(xe)?(P="",ue!=null&&(P=ue.replace(ie,"$&/")+"/"),U(xe,G,P,"",function(ge){return ge})):xe!=null&&(F(xe)&&(xe=N(xe,P+(xe.key==null||L&&L.key===xe.key?"":(""+xe.key).replace(ie,"$&/")+"/")+ue)),G.push(xe)),1;ue=0;var be=he===""?".":he+":";if(D(L))for(var Q=0;Q>>1,z=U[de];if(0>>1;dei(P,re))hei(xe,P)?(U[de]=xe,U[he]=re,de=he):(U[de]=P,U[G]=re,de=G);else if(hei(xe,re))U[de]=xe,U[he]=re,de=he;else break e}}return W}function i(U,W){var re=U.sortIndex-W.sortIndex;return re!==0?re:U.id-W.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var c=[],d=[],h=1,m=null,y=3,v=!1,b=!1,j=!1,C=!1,k=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function R(U){for(var W=n(d);W!==null;){if(W.callback===null)r(d);else if(W.startTime<=U)r(d),W.sortIndex=W.expirationTime,t(c,W);else break;W=n(d)}}function D(U){if(j=!1,R(U),!b)if(n(c)!==null)b=!0,O||(O=!0,H());else{var W=n(d);W!==null&&ne(D,W.startTime-U)}}var O=!1,M=-1,I=5,$=-1;function N(){return C?!0:!(e.unstable_now()-$U&&N());){var de=m.callback;if(typeof de=="function"){m.callback=null,y=m.priorityLevel;var z=de(m.expirationTime<=U);if(U=e.unstable_now(),typeof z=="function"){m.callback=z,R(U),W=!0;break t}m===n(c)&&r(c),R(U)}else r(c);m=n(c)}if(m!==null)W=!0;else{var L=n(d);L!==null&&ne(D,L.startTime-U),W=!1}}break e}finally{m=null,y=re,v=!1}W=void 0}}finally{W?H():O=!1}}}var H;if(typeof A=="function")H=function(){A(F)};else if(typeof MessageChannel<"u"){var ie=new MessageChannel,Z=ie.port2;ie.port1.onmessage=F,H=function(){Z.postMessage(null)}}else H=function(){k(F,0)};function ne(U,W){M=k(function(){U(e.unstable_now())},W)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(U){U.callback=null},e.unstable_forceFrameRate=function(U){0>U||125de?(U.sortIndex=re,t(d,U),n(c)===null&&U===n(d)&&(j?(E(M),M=-1):j=!0,ne(D,re-de))):(U.sortIndex=z,t(c,U),b||v||(b=!0,O||(O=!0,H()))),U},e.unstable_shouldYield=N,e.unstable_wrapCallback=function(U){var W=y;return function(){var re=y;y=W;try{return U.apply(this,arguments)}finally{y=re}}}})(O0)),O0}var lT;function J9(){return lT||(lT=1,T0.exports=Q9()),T0.exports}var R0={exports:{}},Fn={};var sT;function e$(){if(sT)return Fn;sT=1;var e=ku();function t(c){var d="https://react.dev/errors/"+c;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),R0.exports=e$(),R0.exports}var cT;function t$(){if(cT)return Lc;cT=1;var e=J9(),t=ku(),n=j5();function r(o){var s="https://react.dev/errors/"+o;if(1z||(o.current=de[z],de[z]=null,z--)}function P(o,s){z++,de[z]=o.current,o.current=s}var he=L(null),xe=L(null),ve=L(null),ue=L(null);function be(o,s){switch(P(ve,s),P(xe,o),P(he,null),s.nodeType){case 9:case 11:o=(o=s.documentElement)&&(o=o.namespaceURI)?kE(o):0;break;default:if(o=s.tagName,s=s.namespaceURI)s=kE(s),o=AE(s,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}G(he),P(he,o)}function Q(){G(he),G(xe),G(ve)}function ge(o){o.memoizedState!==null&&P(ue,o);var s=he.current,f=AE(s,o.type);s!==f&&(P(xe,o),P(he,f))}function De(o){xe.current===o&&(G(he),G(xe)),ue.current===o&&(G(ue),Mc._currentValue=re)}var fe,ft;function ze(o){if(fe===void 0)try{throw Error()}catch(f){var s=f.stack.trim().match(/\n( *(at )?)/);fe=s&&s[1]||"",ft=-1)":-1x||B[g]!==Y[x]){var oe=` -`+B[g].replace(" at new "," at ");return o.displayName&&oe.includes("")&&(oe=oe.replace("",o.displayName)),oe}while(1<=g&&0<=x);break}}}finally{Be=!1,Error.prepareStackTrace=f}return(f=o?o.displayName||o.name:"")?je(f):""}function Vn(o,s){switch(o.tag){case 26:case 27:case 5:return je(o.type);case 16:return je("Lazy");case 13:return o.child!==s&&s!==null?je("Suspense Fallback"):je("Suspense");case 19:return je("SuspenseList");case 0:case 15:return ft(o.type,!1);case 11:return ft(o.type.render,!1);case 1:return ft(o.type,!0);case 31:return je("Activity");default:return""}}function $i(o){try{var s="",f=null;do s+=Vn(o,f),f=o,o=o.return;while(o);return s}catch(g){return` +`+B[g].replace(" at new "," at ");return o.displayName&&oe.includes("")&&(oe=oe.replace("",o.displayName)),oe}while(1<=g&&0<=x);break}}}finally{lt=!1,Error.prepareStackTrace=f}return(f=o?o.displayName||o.name:"")?ze(f):""}function An(o,s){switch(o.tag){case 26:case 27:case 5:return ze(o.type);case 16:return ze("Lazy");case 13:return o.child!==s&&s!==null?ze("Suspense Fallback"):ze("Suspense");case 19:return ze("SuspenseList");case 0:case 15:return at(o.type,!1);case 11:return at(o.type.render,!1);case 1:return at(o.type,!0);case 31:return ze("Activity");default:return""}}function Gr(o){try{var s="",f=null;do s+=An(o,f),f=o,o=o.return;while(o);return s}catch(g){return` Error generating stack: `+g.message+` -`+g.stack}}var Ui=Object.prototype.hasOwnProperty,Hn=e.unstable_scheduleCallback,Vi=e.unstable_cancelCallback,fo=e.unstable_shouldYield,Jl=e.unstable_requestPaint,un=e.unstable_now,Gu=e.unstable_getCurrentPriorityLevel,le=e.unstable_ImmediatePriority,ge=e.unstable_UserBlockingPriority,Oe=e.unstable_NormalPriority,Le=e.unstable_LowPriority,Ze=e.unstable_IdlePriority,Ot=e.log,Vr=e.unstable_setDisableYieldValue,Sn=null,Pt=null;function cn(o){if(typeof Ot=="function"&&Vr(o),Pt&&typeof Pt.setStrictMode=="function")try{Pt.setStrictMode(Sn,o)}catch{}}var rt=Math.clz32?Math.clz32:my,Hi=Math.log,tr=Math.LN2;function my(o){return o>>>=0,o===0?32:31-(Hi(o)/tr|0)|0}var es=256,ts=262144,Nt=4194304;function zt(o){var s=o&42;if(s!==0)return s;switch(o&-o){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function dn(o,s,f){var g=o.pendingLanes;if(g===0)return 0;var x=0,S=o.suspendedLanes,T=o.pingedLanes;o=o.warmLanes;var _=g&134217727;return _!==0?(g=_&~S,g!==0?x=zt(g):(T&=_,T!==0?x=zt(T):f||(f=_&~o,f!==0&&(x=zt(f))))):(_=g&~S,_!==0?x=zt(_):T!==0?x=zt(T):f||(f=g&~o,f!==0&&(x=zt(f)))),x===0?0:s!==0&&s!==x&&(s&S)===0&&(S=x&-x,f=s&-s,S>=f||S===32&&(f&4194048)!==0)?s:x}function nr(o,s){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&s)===0}function rr(o,s){switch(o){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32: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 s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Mn(){var o=Nt;return Nt<<=1,(Nt&62914560)===0&&(Nt=4194304),o}function ir(o){for(var s=[],f=0;31>f;f++)s.push(o);return s}function Hr(o,s){o.pendingLanes|=s,s!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function Zt(o,s,f,g,x,S){var T=o.pendingLanes;o.pendingLanes=f,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=f,o.entangledLanes&=f,o.errorRecoveryDisabledLanes&=f,o.shellSuspendCounter=0;var _=o.entanglements,B=o.expirationTimes,Y=o.hiddenUpdates;for(f=T&~f;0"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var $8=/[\n"\\]/g;function Kr(o){return o.replace($8,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function xy(o,s,f,g,x,S,T,_){o.name="",T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?o.type=T:o.removeAttribute("type"),s!=null?T==="number"?(s===0&&o.value===""||o.value!=s)&&(o.value=""+Gr(s)):o.value!==""+Gr(s)&&(o.value=""+Gr(s)):T!=="submit"&&T!=="reset"||o.removeAttribute("value"),s!=null?by(o,T,Gr(s)):f!=null?by(o,T,Gr(f)):g!=null&&o.removeAttribute("value"),x==null&&S!=null&&(o.defaultChecked=!!S),x!=null&&(o.checked=x&&typeof x!="function"&&typeof x!="symbol"),_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?o.name=""+Gr(_):o.removeAttribute("name")}function xC(o,s,f,g,x,S,T,_){if(S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(o.type=S),s!=null||f!=null){if(!(S!=="submit"&&S!=="reset"||s!=null)){vy(o);return}f=f!=null?""+Gr(f):"",s=s!=null?""+Gr(s):f,_||s===o.value||(o.value=s),o.defaultValue=s}g=g??x,g=typeof g!="function"&&typeof g!="symbol"&&!!g,o.checked=_?o.checked:!!g,o.defaultChecked=!!g,T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"&&(o.name=T),vy(o)}function by(o,s,f){s==="number"&&Lf(o.ownerDocument)===o||o.defaultValue===""+f||(o.defaultValue=""+f)}function ls(o,s,f,g){if(o=o.options,s){s={};for(var x=0;x"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ky=!1;if(pa)try{var Zu={};Object.defineProperty(Zu,"passive",{get:function(){ky=!0}}),window.addEventListener("test",Zu,Zu),window.removeEventListener("test",Zu,Zu)}catch{ky=!1}var po=null,Ay=null,Ff=null;function AC(){if(Ff)return Ff;var o,s=Ay,f=s.length,g,x="value"in po?po.value:po.textContent,S=x.length;for(o=0;o=ec),_C=" ",MC=!1;function PC(o,s){switch(o){case"keyup":return mF.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function NC(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var ds=!1;function yF(o,s){switch(o){case"compositionend":return NC(s);case"keypress":return s.which!==32?null:(MC=!0,_C);case"textInput":return o=s.data,o===_C&&MC?null:o;default:return null}}function vF(o,s){if(ds)return o==="compositionend"||!Dy&&PC(o,s)?(o=AC(),Ff=Ay=po=null,ds=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1=s)return{node:f,offset:s-o};o=g}e:{for(;f;){if(f.nextSibling){f=f.nextSibling;break e}f=f.parentNode}f=void 0}f=VC(f)}}function qC(o,s){return o&&s?o===s?!0:o&&o.nodeType===3?!1:s&&s.nodeType===3?qC(o,s.parentNode):"contains"in o?o.contains(s):o.compareDocumentPosition?!!(o.compareDocumentPosition(s)&16):!1:!1}function WC(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var s=Lf(o.document);s instanceof o.HTMLIFrameElement;){try{var f=typeof s.contentWindow.location.href=="string"}catch{f=!1}if(f)o=s.contentWindow;else break;s=Lf(o.document)}return s}function Py(o){var s=o&&o.nodeName&&o.nodeName.toLowerCase();return s&&(s==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||s==="textarea"||o.contentEditable==="true")}var AF=pa&&"documentMode"in document&&11>=document.documentMode,fs=null,Ny=null,ic=null,zy=!1;function GC(o,s,f){var g=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;zy||fs==null||fs!==Lf(g)||(g=fs,"selectionStart"in g&&Py(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),ic&&rc(ic,g)||(ic=g,g=Mh(Ny,"onSelect"),0>=T,x-=T,qi=1<<32-rt(s)+x|f<Ue?(Ke=Ee,Ee=null):Ke=Ee.sibling;var Je=X(q,Ee,K[Ue],se);if(Je===null){Ee===null&&(Ee=Ke);break}o&&Ee&&Je.alternate===null&&s(q,Ee),V=S(Je,V,Ue),Qe===null?Re=Je:Qe.sibling=Je,Qe=Je,Ee=Ke}if(Ue===K.length)return f(q,Ee),Ye&&ga(q,Ue),Re;if(Ee===null){for(;UeUe?(Ke=Ee,Ee=null):Ke=Ee.sibling;var zo=X(q,Ee,Je.value,se);if(zo===null){Ee===null&&(Ee=Ke);break}o&&Ee&&zo.alternate===null&&s(q,Ee),V=S(zo,V,Ue),Qe===null?Re=zo:Qe.sibling=zo,Qe=zo,Ee=Ke}if(Je.done)return f(q,Ee),Ye&&ga(q,Ue),Re;if(Ee===null){for(;!Je.done;Ue++,Je=K.next())Je=ue(q,Je.value,se),Je!==null&&(V=S(Je,V,Ue),Qe===null?Re=Je:Qe.sibling=Je,Qe=Je);return Ye&&ga(q,Ue),Re}for(Ee=g(Ee);!Je.done;Ue++,Je=K.next())Je=te(Ee,q,Ue,Je.value,se),Je!==null&&(o&&Je.alternate!==null&&Ee.delete(Je.key===null?Ue:Je.key),V=S(Je,V,Ue),Qe===null?Re=Je:Qe.sibling=Je,Qe=Je);return o&&Ee.forEach(function(W9){return s(q,W9)}),Ye&&ga(q,Ue),Re}function ct(q,V,K,se){if(typeof K=="object"&&K!==null&&K.type===j&&K.key===null&&(K=K.props.children),typeof K=="object"&&K!==null){switch(K.$$typeof){case v:e:{for(var Re=K.key;V!==null;){if(V.key===Re){if(Re=K.type,Re===j){if(V.tag===7){f(q,V.sibling),se=x(V,K.props.children),se.return=q,q=se;break e}}else if(V.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===I&&ml(Re)===V.type){f(q,V.sibling),se=x(V,K.props),cc(se,K),se.return=q,q=se;break e}f(q,V);break}else s(q,V);V=V.sibling}K.type===j?(se=cl(K.props.children,q.mode,se,K.key),se.return=q,q=se):(se=Xf(K.type,K.key,K.props,null,q.mode,se),cc(se,K),se.return=q,q=se)}return T(q);case b:e:{for(Re=K.key;V!==null;){if(V.key===Re)if(V.tag===4&&V.stateNode.containerInfo===K.containerInfo&&V.stateNode.implementation===K.implementation){f(q,V.sibling),se=x(V,K.children||[]),se.return=q,q=se;break e}else{f(q,V);break}else s(q,V);V=V.sibling}se=Vy(K,q.mode,se),se.return=q,q=se}return T(q);case I:return K=ml(K),ct(q,V,K,se)}if(re(K))return Se(q,V,K,se);if(H(K)){if(Re=H(K),typeof Re!="function")throw Error(r(150));return K=Re.call(K),Me(q,V,K,se)}if(typeof K.then=="function")return ct(q,V,rh(K),se);if(K.$$typeof===A)return ct(q,V,Jf(q,K),se);ih(q,K)}return typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint"?(K=""+K,V!==null&&V.tag===6?(f(q,V.sibling),se=x(V,K),se.return=q,q=se):(f(q,V),se=Uy(K,q.mode,se),se.return=q,q=se),T(q)):f(q,V)}return function(q,V,K,se){try{uc=0;var Re=ct(q,V,K,se);return js=null,Re}catch(Ee){if(Ee===Ss||Ee===th)throw Ee;var Qe=Cr(29,Ee,null,q.mode);return Qe.lanes=se,Qe.return=q,Qe}finally{}}}var yl=gk(!0),yk=gk(!1),xo=!1;function tv(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function nv(o,s){o=o.updateQueue,s.updateQueue===o&&(s.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function bo(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function wo(o,s,f){var g=o.updateQueue;if(g===null)return null;if(g=g.shared,(tt&2)!==0){var x=g.pending;return x===null?s.next=s:(s.next=x.next,x.next=s),g.pending=s,s=Yf(o),ek(o,null,f),s}return Kf(o,g,s,f),Yf(o)}function dc(o,s,f){if(s=s.updateQueue,s!==null&&(s=s.shared,(f&4194048)!==0)){var g=s.lanes;g&=o.pendingLanes,f|=g,s.lanes=f,Sr(o,f)}}function rv(o,s){var f=o.updateQueue,g=o.alternate;if(g!==null&&(g=g.updateQueue,f===g)){var x=null,S=null;if(f=f.firstBaseUpdate,f!==null){do{var T={lane:f.lane,tag:f.tag,payload:f.payload,callback:null,next:null};S===null?x=S=T:S=S.next=T,f=f.next}while(f!==null);S===null?x=S=s:S=S.next=s}else x=S=s;f={baseState:g.baseState,firstBaseUpdate:x,lastBaseUpdate:S,shared:g.shared,callbacks:g.callbacks},o.updateQueue=f;return}o=f.lastBaseUpdate,o===null?f.firstBaseUpdate=s:o.next=s,f.lastBaseUpdate=s}var iv=!1;function fc(){if(iv){var o=ws;if(o!==null)throw o}}function hc(o,s,f,g){iv=!1;var x=o.updateQueue;xo=!1;var S=x.firstBaseUpdate,T=x.lastBaseUpdate,_=x.shared.pending;if(_!==null){x.shared.pending=null;var B=_,Y=B.next;B.next=null,T===null?S=Y:T.next=Y,T=B;var oe=o.alternate;oe!==null&&(oe=oe.updateQueue,_=oe.lastBaseUpdate,_!==T&&(_===null?oe.firstBaseUpdate=Y:_.next=Y,oe.lastBaseUpdate=B))}if(S!==null){var ue=x.baseState;T=0,oe=Y=B=null,_=S;do{var X=_.lane&-536870913,te=X!==_.lane;if(te?(Ge&X)===X:(g&X)===X){X!==0&&X===bs&&(iv=!0),oe!==null&&(oe=oe.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var Se=o,Me=_;X=s;var ct=f;switch(Me.tag){case 1:if(Se=Me.payload,typeof Se=="function"){ue=Se.call(ct,ue,X);break e}ue=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=Me.payload,X=typeof Se=="function"?Se.call(ct,ue,X):Se,X==null)break e;ue=m({},ue,X);break e;case 2:xo=!0}}X=_.callback,X!==null&&(o.flags|=64,te&&(o.flags|=8192),te=x.callbacks,te===null?x.callbacks=[X]:te.push(X))}else te={lane:X,tag:_.tag,payload:_.payload,callback:_.callback,next:null},oe===null?(Y=oe=te,B=ue):oe=oe.next=te,T|=X;if(_=_.next,_===null){if(_=x.shared.pending,_===null)break;te=_,_=te.next,te.next=null,x.lastBaseUpdate=te,x.shared.pending=null}}while(!0);oe===null&&(B=ue),x.baseState=B,x.firstBaseUpdate=Y,x.lastBaseUpdate=oe,S===null&&(x.shared.lanes=0),Ao|=T,o.lanes=T,o.memoizedState=ue}}function vk(o,s){if(typeof o!="function")throw Error(r(191,o));o.call(s)}function xk(o,s){var f=o.callbacks;if(f!==null)for(o.callbacks=null,o=0;oS?S:8;var T=U.T,_={};U.T=_,jv(o,!1,s,f);try{var B=x(),Y=U.S;if(Y!==null&&Y(_,B),B!==null&&typeof B=="object"&&typeof B.then=="function"){var oe=NF(B,g);gc(o,s,oe,Or(o))}else gc(o,s,g,Or(o))}catch(ue){gc(o,s,{then:function(){},status:"rejected",reason:ue},Or())}finally{W.p=S,T!==null&&_.types!==null&&(T.types=_.types),U.T=T}}function $F(){}function wv(o,s,f,g){if(o.tag!==5)throw Error(r(476));var x=Zk(o).queue;Xk(o,x,s,ie,f===null?$F:function(){return Qk(o),f(g)})}function Zk(o){var s=o.memoizedState;if(s!==null)return s;s={memoizedState:ie,baseState:ie,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ba,lastRenderedState:ie},next:null};var f={};return s.next={memoizedState:f,baseState:f,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ba,lastRenderedState:f},next:null},o.memoizedState=s,o=o.alternate,o!==null&&(o.memoizedState=s),s}function Qk(o){var s=Zk(o);s.next===null&&(s=o.alternate.memoizedState),gc(o,s.next.queue,{},Or())}function Sv(){return kn(Mc)}function Jk(){return Lt().memoizedState}function eA(){return Lt().memoizedState}function UF(o){for(var s=o.return;s!==null;){switch(s.tag){case 24:case 3:var f=Or();o=bo(f);var g=wo(s,o,f);g!==null&&(dr(g,s,f),dc(g,s,f)),s={cache:Zy()},o.payload=s;return}s=s.return}}function VF(o,s,f){var g=Or();f={lane:g,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},ph(o)?nA(s,f):(f=Fy(o,s,f,g),f!==null&&(dr(f,o,g),rA(f,s,g)))}function tA(o,s,f){var g=Or();gc(o,s,f,g)}function gc(o,s,f,g){var x={lane:g,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null};if(ph(o))nA(s,x);else{var S=o.alternate;if(o.lanes===0&&(S===null||S.lanes===0)&&(S=s.lastRenderedReducer,S!==null))try{var T=s.lastRenderedState,_=S(T,f);if(x.hasEagerState=!0,x.eagerState=_,jr(_,T))return Kf(o,s,x,0),ht===null&&Gf(),!1}catch{}finally{}if(f=Fy(o,s,x,g),f!==null)return dr(f,o,g),rA(f,s,g),!0}return!1}function jv(o,s,f,g){if(g={lane:2,revertLane:t0(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},ph(o)){if(s)throw Error(r(479))}else s=Fy(o,f,g,2),s!==null&&dr(s,o,2)}function ph(o){var s=o.alternate;return o===Fe||s!==null&&s===Fe}function nA(o,s){ks=lh=!0;var f=o.pending;f===null?s.next=s:(s.next=f.next,f.next=s),o.pending=s}function rA(o,s,f){if((f&4194048)!==0){var g=s.lanes;g&=o.pendingLanes,f|=g,s.lanes=f,Sr(o,f)}}var yc={readContext:kn,use:ch,useCallback:Rt,useContext:Rt,useEffect:Rt,useImperativeHandle:Rt,useLayoutEffect:Rt,useInsertionEffect:Rt,useMemo:Rt,useReducer:Rt,useRef:Rt,useState:Rt,useDebugValue:Rt,useDeferredValue:Rt,useTransition:Rt,useSyncExternalStore:Rt,useId:Rt,useHostTransitionStatus:Rt,useFormState:Rt,useActionState:Rt,useOptimistic:Rt,useMemoCache:Rt,useCacheRefresh:Rt};yc.useEffectEvent=Rt;var iA={readContext:kn,use:ch,useCallback:function(o,s){return qn().memoizedState=[o,s===void 0?null:s],o},useContext:kn,useEffect:$k,useImperativeHandle:function(o,s,f){f=f!=null?f.concat([o]):null,fh(4194308,4,qk.bind(null,s,o),f)},useLayoutEffect:function(o,s){return fh(4194308,4,o,s)},useInsertionEffect:function(o,s){fh(4,2,o,s)},useMemo:function(o,s){var f=qn();s=s===void 0?null:s;var g=o();if(vl){cn(!0);try{o()}finally{cn(!1)}}return f.memoizedState=[g,s],g},useReducer:function(o,s,f){var g=qn();if(f!==void 0){var x=f(s);if(vl){cn(!0);try{f(s)}finally{cn(!1)}}}else x=s;return g.memoizedState=g.baseState=x,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:x},g.queue=o,o=o.dispatch=VF.bind(null,Fe,o),[g.memoizedState,o]},useRef:function(o){var s=qn();return o={current:o},s.memoizedState=o},useState:function(o){o=gv(o);var s=o.queue,f=tA.bind(null,Fe,s);return s.dispatch=f,[o.memoizedState,f]},useDebugValue:xv,useDeferredValue:function(o,s){var f=qn();return bv(f,o,s)},useTransition:function(){var o=gv(!1);return o=Xk.bind(null,Fe,o.queue,!0,!1),qn().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,s,f){var g=Fe,x=qn();if(Ye){if(f===void 0)throw Error(r(407));f=f()}else{if(f=s(),ht===null)throw Error(r(349));(Ge&127)!==0||kk(g,s,f)}x.memoizedState=f;var S={value:f,getSnapshot:s};return x.queue=S,$k(Ek.bind(null,g,S,o),[o]),g.flags|=2048,Es(9,{destroy:void 0},Ak.bind(null,g,S,f,s),null),f},useId:function(){var o=qn(),s=ht.identifierPrefix;if(Ye){var f=Wi,g=qi;f=(g&~(1<<32-rt(g)-1)).toString(32)+f,s="_"+s+"R_"+f,f=sh++,0<\/script>",S=S.removeChild(S.firstChild);break;case"select":S=typeof g.is=="string"?T.createElement("select",{is:g.is}):T.createElement("select"),g.multiple?S.multiple=!0:g.size&&(S.size=g.size);break;default:S=typeof g.is=="string"?T.createElement(x,{is:g.is}):T.createElement(x)}}S[jn]=s,S[ar]=g;e:for(T=s.child;T!==null;){if(T.tag===5||T.tag===6)S.appendChild(T.stateNode);else if(T.tag!==4&&T.tag!==27&&T.child!==null){T.child.return=T,T=T.child;continue}if(T===s)break e;for(;T.sibling===null;){if(T.return===null||T.return===s)break e;T=T.return}T.sibling.return=T.return,T=T.sibling}s.stateNode=S;e:switch(En(S,x,g),x){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}g&&Sa(s)}}return wt(s),Iv(s,s.type,o===null?null:o.memoizedProps,s.pendingProps,f),null;case 6:if(o&&s.stateNode!=null)o.memoizedProps!==g&&Sa(s);else{if(typeof g!="string"&&s.stateNode===null)throw Error(r(166));if(o=ve.current,vs(s)){if(o=s.stateNode,f=s.memoizedProps,g=null,x=Cn,x!==null)switch(x.tag){case 27:case 5:g=x.memoizedProps}o[jn]=s,o=!!(o.nodeValue===f||g!==null&&g.suppressHydrationWarning===!0||jE(o.nodeValue,f)),o||yo(s,!0)}else o=Ph(o).createTextNode(g),o[jn]=s,s.stateNode=o}return wt(s),null;case 31:if(f=s.memoizedState,o===null||o.memoizedState!==null){if(g=vs(s),f!==null){if(o===null){if(!g)throw Error(r(318));if(o=s.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(557));o[jn]=s}else dl(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;wt(s),o=!1}else f=Gy(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=f),o=!0;if(!o)return s.flags&256?(Ar(s),s):(Ar(s),null);if((s.flags&128)!==0)throw Error(r(558))}return wt(s),null;case 13:if(g=s.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(x=vs(s),g!==null&&g.dehydrated!==null){if(o===null){if(!x)throw Error(r(318));if(x=s.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(r(317));x[jn]=s}else dl(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;wt(s),x=!1}else x=Gy(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=x),x=!0;if(!x)return s.flags&256?(Ar(s),s):(Ar(s),null)}return Ar(s),(s.flags&128)!==0?(s.lanes=f,s):(f=g!==null,o=o!==null&&o.memoizedState!==null,f&&(g=s.child,x=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(x=g.alternate.memoizedState.cachePool.pool),S=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(S=g.memoizedState.cachePool.pool),S!==x&&(g.flags|=2048)),f!==o&&f&&(s.child.flags|=8192),xh(s,s.updateQueue),wt(s),null);case 4:return Q(),o===null&&a0(s.stateNode.containerInfo),wt(s),null;case 10:return va(s.type),wt(s),null;case 19:if(G(It),g=s.memoizedState,g===null)return wt(s),null;if(x=(s.flags&128)!==0,S=g.rendering,S===null)if(x)xc(g,!1);else{if(Dt!==0||o!==null&&(o.flags&128)!==0)for(o=s.child;o!==null;){if(S=oh(o),S!==null){for(s.flags|=128,xc(g,!1),o=S.updateQueue,s.updateQueue=o,xh(s,o),s.subtreeFlags=0,o=f,f=s.child;f!==null;)tk(f,o),f=f.sibling;return P(It,It.current&1|2),Ye&&ga(s,g.treeForkCount),s.child}o=o.sibling}g.tail!==null&&un()>Ch&&(s.flags|=128,x=!0,xc(g,!1),s.lanes=4194304)}else{if(!x)if(o=oh(S),o!==null){if(s.flags|=128,x=!0,o=o.updateQueue,s.updateQueue=o,xh(s,o),xc(g,!0),g.tail===null&&g.tailMode==="hidden"&&!S.alternate&&!Ye)return wt(s),null}else 2*un()-g.renderingStartTime>Ch&&f!==536870912&&(s.flags|=128,x=!0,xc(g,!1),s.lanes=4194304);g.isBackwards?(S.sibling=s.child,s.child=S):(o=g.last,o!==null?o.sibling=S:s.child=S,g.last=S)}return g.tail!==null?(o=g.tail,g.rendering=o,g.tail=o.sibling,g.renderingStartTime=un(),o.sibling=null,f=It.current,P(It,x?f&1|2:f&1),Ye&&ga(s,g.treeForkCount),o):(wt(s),null);case 22:case 23:return Ar(s),ov(),g=s.memoizedState!==null,o!==null?o.memoizedState!==null!==g&&(s.flags|=8192):g&&(s.flags|=8192),g?(f&536870912)!==0&&(s.flags&128)===0&&(wt(s),s.subtreeFlags&6&&(s.flags|=8192)):wt(s),f=s.updateQueue,f!==null&&xh(s,f.retryQueue),f=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(f=o.memoizedState.cachePool.pool),g=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(g=s.memoizedState.cachePool.pool),g!==f&&(s.flags|=2048),o!==null&&G(pl),null;case 24:return f=null,o!==null&&(f=o.memoizedState.cache),s.memoizedState.cache!==f&&(s.flags|=2048),va(Vt),wt(s),null;case 25:return null;case 30:return null}throw Error(r(156,s.tag))}function KF(o,s){switch(qy(s),s.tag){case 1:return o=s.flags,o&65536?(s.flags=o&-65537|128,s):null;case 3:return va(Vt),Q(),o=s.flags,(o&65536)!==0&&(o&128)===0?(s.flags=o&-65537|128,s):null;case 26:case 27:case 5:return pe(s),null;case 31:if(s.memoizedState!==null){if(Ar(s),s.alternate===null)throw Error(r(340));dl()}return o=s.flags,o&65536?(s.flags=o&-65537|128,s):null;case 13:if(Ar(s),o=s.memoizedState,o!==null&&o.dehydrated!==null){if(s.alternate===null)throw Error(r(340));dl()}return o=s.flags,o&65536?(s.flags=o&-65537|128,s):null;case 19:return G(It),null;case 4:return Q(),null;case 10:return va(s.type),null;case 22:case 23:return Ar(s),ov(),o!==null&&G(pl),o=s.flags,o&65536?(s.flags=o&-65537|128,s):null;case 24:return va(Vt),null;case 25:return null;default:return null}}function TA(o,s){switch(qy(s),s.tag){case 3:va(Vt),Q();break;case 26:case 27:case 5:pe(s);break;case 4:Q();break;case 31:s.memoizedState!==null&&Ar(s);break;case 13:Ar(s);break;case 19:G(It);break;case 10:va(s.type);break;case 22:case 23:Ar(s),ov(),o!==null&&G(pl);break;case 24:va(Vt)}}function bc(o,s){try{var f=s.updateQueue,g=f!==null?f.lastEffect:null;if(g!==null){var x=g.next;f=x;do{if((f.tag&o)===o){g=void 0;var S=f.create,T=f.inst;g=S(),T.destroy=g}f=f.next}while(f!==x)}}catch(_){at(s,s.return,_)}}function Co(o,s,f){try{var g=s.updateQueue,x=g!==null?g.lastEffect:null;if(x!==null){var S=x.next;g=S;do{if((g.tag&o)===o){var T=g.inst,_=T.destroy;if(_!==void 0){T.destroy=void 0,x=s;var B=f,Y=_;try{Y()}catch(oe){at(x,B,oe)}}}g=g.next}while(g!==S)}}catch(oe){at(s,s.return,oe)}}function OA(o){var s=o.updateQueue;if(s!==null){var f=o.stateNode;try{xk(s,f)}catch(g){at(o,o.return,g)}}}function RA(o,s,f){f.props=xl(o.type,o.memoizedProps),f.state=o.memoizedState;try{f.componentWillUnmount()}catch(g){at(o,s,g)}}function wc(o,s){try{var f=o.ref;if(f!==null){switch(o.tag){case 26:case 27:case 5:var g=o.stateNode;break;case 30:g=o.stateNode;break;default:g=o.stateNode}typeof f=="function"?o.refCleanup=f(g):f.current=g}}catch(x){at(o,s,x)}}function Gi(o,s){var f=o.ref,g=o.refCleanup;if(f!==null)if(typeof g=="function")try{g()}catch(x){at(o,s,x)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof f=="function")try{f(null)}catch(x){at(o,s,x)}else f.current=null}function DA(o){var s=o.type,f=o.memoizedProps,g=o.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":f.autoFocus&&g.focus();break e;case"img":f.src?g.src=f.src:f.srcSet&&(g.srcset=f.srcSet)}}catch(x){at(o,o.return,x)}}function Lv(o,s,f){try{var g=o.stateNode;g9(g,o.type,f,s),g[ar]=s}catch(x){at(o,o.return,x)}}function _A(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&Do(o.type)||o.tag===4}function Bv(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||_A(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&Do(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Fv(o,s,f){var g=o.tag;if(g===5||g===6)o=o.stateNode,s?(f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f).insertBefore(o,s):(s=f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f,s.appendChild(o),f=f._reactRootContainer,f!=null||s.onclick!==null||(s.onclick=ha));else if(g!==4&&(g===27&&Do(o.type)&&(f=o.stateNode,s=null),o=o.child,o!==null))for(Fv(o,s,f),o=o.sibling;o!==null;)Fv(o,s,f),o=o.sibling}function bh(o,s,f){var g=o.tag;if(g===5||g===6)o=o.stateNode,s?f.insertBefore(o,s):f.appendChild(o);else if(g!==4&&(g===27&&Do(o.type)&&(f=o.stateNode),o=o.child,o!==null))for(bh(o,s,f),o=o.sibling;o!==null;)bh(o,s,f),o=o.sibling}function MA(o){var s=o.stateNode,f=o.memoizedProps;try{for(var g=o.type,x=s.attributes;x.length;)s.removeAttributeNode(x[0]);En(s,g,f),s[jn]=o,s[ar]=f}catch(S){at(o,o.return,S)}}var ja=!1,Wt=!1,$v=!1,PA=typeof WeakSet=="function"?WeakSet:Set,hn=null;function YF(o,s){if(o=o.containerInfo,s0=$h,o=WC(o),Py(o)){if("selectionStart"in o)var f={start:o.selectionStart,end:o.selectionEnd};else e:{f=(f=o.ownerDocument)&&f.defaultView||window;var g=f.getSelection&&f.getSelection();if(g&&g.rangeCount!==0){f=g.anchorNode;var x=g.anchorOffset,S=g.focusNode;g=g.focusOffset;try{f.nodeType,S.nodeType}catch{f=null;break e}var T=0,_=-1,B=-1,Y=0,oe=0,ue=o,X=null;t:for(;;){for(var te;ue!==f||x!==0&&ue.nodeType!==3||(_=T+x),ue!==S||g!==0&&ue.nodeType!==3||(B=T+g),ue.nodeType===3&&(T+=ue.nodeValue.length),(te=ue.firstChild)!==null;)X=ue,ue=te;for(;;){if(ue===o)break t;if(X===f&&++Y===x&&(_=T),X===S&&++oe===g&&(B=T),(te=ue.nextSibling)!==null)break;ue=X,X=ue.parentNode}ue=te}f=_===-1||B===-1?null:{start:_,end:B}}else f=null}f=f||{start:0,end:0}}else f=null;for(u0={focusedElem:o,selectionRange:f},$h=!1,hn=s;hn!==null;)if(s=hn,o=s.child,(s.subtreeFlags&1028)!==0&&o!==null)o.return=s,hn=o;else for(;hn!==null;){switch(s=hn,S=s.alternate,o=s.flags,s.tag){case 0:if((o&4)!==0&&(o=s.updateQueue,o=o!==null?o.events:null,o!==null))for(f=0;f title"))),En(S,g,f),S[jn]=o,fn(S),g=S;break e;case"link":var T=FE("link","href",x).get(g+(f.href||""));if(T){for(var _=0;_ct&&(T=ct,ct=Me,Me=T);var q=HC(_,Me),V=HC(_,ct);if(q&&V&&(te.rangeCount!==1||te.anchorNode!==q.node||te.anchorOffset!==q.offset||te.focusNode!==V.node||te.focusOffset!==V.offset)){var K=ue.createRange();K.setStart(q.node,q.offset),te.removeAllRanges(),Me>ct?(te.addRange(K),te.extend(V.node,V.offset)):(K.setEnd(V.node,V.offset),te.addRange(K))}}}}for(ue=[],te=_;te=te.parentNode;)te.nodeType===1&&ue.push({element:te,left:te.scrollLeft,top:te.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_f?32:f,U.T=null,f=Kv,Kv=null;var S=To,T=Ta;if(Qt=0,_s=To=null,Ta=0,(tt&6)!==0)throw Error(r(331));var _=tt;if(tt|=4,qA(S.current),UA(S,S.current,T,f),tt=_,Ec(0,!1),Pt&&typeof Pt.onPostCommitFiberRoot=="function")try{Pt.onPostCommitFiberRoot(Sn,S)}catch{}return!0}finally{W.p=x,U.T=g,uE(o,s)}}function dE(o,s,f){s=Xr(f,s),s=Ev(o.stateNode,s,2),o=wo(o,s,2),o!==null&&(Hr(o,2),Ki(o))}function at(o,s,f){if(o.tag===3)dE(o,o,f);else for(;s!==null;){if(s.tag===3){dE(s,o,f);break}else if(s.tag===1){var g=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Eo===null||!Eo.has(g))){o=Xr(f,o),f=fA(2),g=wo(s,f,2),g!==null&&(hA(f,g,s,o),Hr(g,2),Ki(g));break}}s=s.return}}function Qv(o,s,f){var g=o.pingCache;if(g===null){g=o.pingCache=new QF;var x=new Set;g.set(s,x)}else x=g.get(s),x===void 0&&(x=new Set,g.set(s,x));x.has(f)||(Hv=!0,x.add(f),o=r9.bind(null,o,s,f),s.then(o,o))}function r9(o,s,f){var g=o.pingCache;g!==null&&g.delete(s),o.pingedLanes|=o.suspendedLanes&f,o.warmLanes&=~f,ht===o&&(Ge&f)===f&&(Dt===4||Dt===3&&(Ge&62914560)===Ge&&300>un()-jh?(tt&2)===0&&Ms(o,0):qv|=f,Ds===Ge&&(Ds=0)),Ki(o)}function fE(o,s){s===0&&(s=Mn()),o=ul(o,s),o!==null&&(Hr(o,s),Ki(o))}function i9(o){var s=o.memoizedState,f=0;s!==null&&(f=s.retryLane),fE(o,f)}function a9(o,s){var f=0;switch(o.tag){case 31:case 13:var g=o.stateNode,x=o.memoizedState;x!==null&&(f=x.retryLane);break;case 19:g=o.stateNode;break;case 22:g=o.stateNode._retryCache;break;default:throw Error(r(314))}g!==null&&g.delete(s),fE(o,f)}function o9(o,s){return Hn(o,s)}var Rh=null,Ns=null,Jv=!1,Dh=!1,e0=!1,Ro=0;function Ki(o){o!==Ns&&o.next===null&&(Ns===null?Rh=Ns=o:Ns=Ns.next=o),Dh=!0,Jv||(Jv=!0,s9())}function Ec(o,s){if(!e0&&Dh){e0=!0;do for(var f=!1,g=Rh;g!==null;){if(o!==0){var x=g.pendingLanes;if(x===0)var S=0;else{var T=g.suspendedLanes,_=g.pingedLanes;S=(1<<31-rt(42|o)+1)-1,S&=x&~(T&~_),S=S&201326741?S&201326741|1:S?S|2:0}S!==0&&(f=!0,gE(g,S))}else S=Ge,S=dn(g,g===ht?S:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(S&3)===0||nr(g,S)||(f=!0,gE(g,S));g=g.next}while(f);e0=!1}}function l9(){hE()}function hE(){Dh=Jv=!1;var o=0;Ro!==0&&v9()&&(o=Ro);for(var s=un(),f=null,g=Rh;g!==null;){var x=g.next,S=pE(g,s);S===0?(g.next=null,f===null?Rh=x:f.next=x,x===null&&(Ns=f)):(f=g,(o!==0||(S&3)!==0)&&(Dh=!0)),g=x}Qt!==0&&Qt!==5||Ec(o),Ro!==0&&(Ro=0)}function pE(o,s){for(var f=o.suspendedLanes,g=o.pingedLanes,x=o.expirationTimes,S=o.pendingLanes&-62914561;0_)break;var oe=B.transferSize,ue=B.initiatorType;oe&&CE(ue)&&(B=B.responseEnd,T+=oe*(B<_?1:(_-Y)/(B-Y)))}if(--g,s+=8*(S+T)/(x.duration/1e3),o++,10"u"?null:document;function zE(o,s,f){var g=zs;if(g&&typeof s=="string"&&s){var x=Kr(s);x='link[rel="'+o+'"][href="'+x+'"]',typeof f=="string"&&(x+='[crossorigin="'+f+'"]'),NE.has(x)||(NE.add(x),o={rel:o,crossOrigin:f,href:s},g.querySelector(x)===null&&(s=g.createElement("link"),En(s,"link",o),fn(s),g.head.appendChild(s)))}}function E9(o){Oa.D(o),zE("dns-prefetch",o,null)}function T9(o,s){Oa.C(o,s),zE("preconnect",o,s)}function O9(o,s,f){Oa.L(o,s,f);var g=zs;if(g&&o&&s){var x='link[rel="preload"][as="'+Kr(s)+'"]';s==="image"&&f&&f.imageSrcSet?(x+='[imagesrcset="'+Kr(f.imageSrcSet)+'"]',typeof f.imageSizes=="string"&&(x+='[imagesizes="'+Kr(f.imageSizes)+'"]')):x+='[href="'+Kr(o)+'"]';var S=x;switch(s){case"style":S=Is(o);break;case"script":S=Ls(o)}ni.has(S)||(o=m({rel:"preload",href:s==="image"&&f&&f.imageSrcSet?void 0:o,as:s},f),ni.set(S,o),g.querySelector(x)!==null||s==="style"&&g.querySelector(Dc(S))||s==="script"&&g.querySelector(_c(S))||(s=g.createElement("link"),En(s,"link",o),fn(s),g.head.appendChild(s)))}}function R9(o,s){Oa.m(o,s);var f=zs;if(f&&o){var g=s&&typeof s.as=="string"?s.as:"script",x='link[rel="modulepreload"][as="'+Kr(g)+'"][href="'+Kr(o)+'"]',S=x;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":S=Ls(o)}if(!ni.has(S)&&(o=m({rel:"modulepreload",href:o},s),ni.set(S,o),f.querySelector(x)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(f.querySelector(_c(S)))return}g=f.createElement("link"),En(g,"link",o),fn(g),f.head.appendChild(g)}}}function D9(o,s,f){Oa.S(o,s,f);var g=zs;if(g&&o){var x=as(g).hoistableStyles,S=Is(o);s=s||"default";var T=x.get(S);if(!T){var _={loading:0,preload:null};if(T=g.querySelector(Dc(S)))_.loading=5;else{o=m({rel:"stylesheet",href:o,"data-precedence":s},f),(f=ni.get(S))&&g0(o,f);var B=T=g.createElement("link");fn(B),En(B,"link",o),B._p=new Promise(function(Y,oe){B.onload=Y,B.onerror=oe}),B.addEventListener("load",function(){_.loading|=1}),B.addEventListener("error",function(){_.loading|=2}),_.loading|=4,zh(T,s,g)}T={type:"stylesheet",instance:T,count:1,state:_},x.set(S,T)}}}function _9(o,s){Oa.X(o,s);var f=zs;if(f&&o){var g=as(f).hoistableScripts,x=Ls(o),S=g.get(x);S||(S=f.querySelector(_c(x)),S||(o=m({src:o,async:!0},s),(s=ni.get(x))&&y0(o,s),S=f.createElement("script"),fn(S),En(S,"link",o),f.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},g.set(x,S))}}function M9(o,s){Oa.M(o,s);var f=zs;if(f&&o){var g=as(f).hoistableScripts,x=Ls(o),S=g.get(x);S||(S=f.querySelector(_c(x)),S||(o=m({src:o,async:!0,type:"module"},s),(s=ni.get(x))&&y0(o,s),S=f.createElement("script"),fn(S),En(S,"link",o),f.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},g.set(x,S))}}function IE(o,s,f,g){var x=(x=ve.current)?Nh(x):null;if(!x)throw Error(r(446));switch(o){case"meta":case"title":return null;case"style":return typeof f.precedence=="string"&&typeof f.href=="string"?(s=Is(f.href),f=as(x).hoistableStyles,g=f.get(s),g||(g={type:"style",instance:null,count:0,state:null},f.set(s,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(f.rel==="stylesheet"&&typeof f.href=="string"&&typeof f.precedence=="string"){o=Is(f.href);var S=as(x).hoistableStyles,T=S.get(o);if(T||(x=x.ownerDocument||x,T={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},S.set(o,T),(S=x.querySelector(Dc(o)))&&!S._p&&(T.instance=S,T.state.loading=5),ni.has(o)||(f={rel:"preload",as:"style",href:f.href,crossOrigin:f.crossOrigin,integrity:f.integrity,media:f.media,hrefLang:f.hrefLang,referrerPolicy:f.referrerPolicy},ni.set(o,f),S||P9(x,o,f,T.state))),s&&g===null)throw Error(r(528,""));return T}if(s&&g!==null)throw Error(r(529,""));return null;case"script":return s=f.async,f=f.src,typeof f=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=Ls(f),f=as(x).hoistableScripts,g=f.get(s),g||(g={type:"script",instance:null,count:0,state:null},f.set(s,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,o))}}function Is(o){return'href="'+Kr(o)+'"'}function Dc(o){return'link[rel="stylesheet"]['+o+"]"}function LE(o){return m({},o,{"data-precedence":o.precedence,precedence:null})}function P9(o,s,f,g){o.querySelector('link[rel="preload"][as="style"]['+s+"]")?g.loading=1:(s=o.createElement("link"),g.preload=s,s.addEventListener("load",function(){return g.loading|=1}),s.addEventListener("error",function(){return g.loading|=2}),En(s,"link",f),fn(s),o.head.appendChild(s))}function Ls(o){return'[src="'+Kr(o)+'"]'}function _c(o){return"script[async]"+o}function BE(o,s,f){if(s.count++,s.instance===null)switch(s.type){case"style":var g=o.querySelector('style[data-href~="'+Kr(f.href)+'"]');if(g)return s.instance=g,fn(g),g;var x=m({},f,{"data-href":f.href,"data-precedence":f.precedence,href:null,precedence:null});return g=(o.ownerDocument||o).createElement("style"),fn(g),En(g,"style",x),zh(g,f.precedence,o),s.instance=g;case"stylesheet":x=Is(f.href);var S=o.querySelector(Dc(x));if(S)return s.state.loading|=4,s.instance=S,fn(S),S;g=LE(f),(x=ni.get(x))&&g0(g,x),S=(o.ownerDocument||o).createElement("link"),fn(S);var T=S;return T._p=new Promise(function(_,B){T.onload=_,T.onerror=B}),En(S,"link",g),s.state.loading|=4,zh(S,f.precedence,o),s.instance=S;case"script":return S=Ls(f.src),(x=o.querySelector(_c(S)))?(s.instance=x,fn(x),x):(g=f,(x=ni.get(S))&&(g=m({},f),y0(g,x)),o=o.ownerDocument||o,x=o.createElement("script"),fn(x),En(x,"link",g),o.head.appendChild(x),s.instance=x);case"void":return null;default:throw Error(r(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(g=s.instance,s.state.loading|=4,zh(g,f.precedence,o));return s.instance}function zh(o,s,f){for(var g=f.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),x=g.length?g[g.length-1]:null,S=x,T=0;T title"):null)}function N9(o,s,f){if(f===1||s.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return o=s.disabled,typeof s.precedence=="string"&&o==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function UE(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function z9(o,s,f,g){if(f.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(f.state.loading&4)===0){if(f.instance===null){var x=Is(g.href),S=s.querySelector(Dc(x));if(S){s=S._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(o.count++,o=Lh.bind(o),s.then(o,o)),f.state.loading|=4,f.instance=S,fn(S);return}S=s.ownerDocument||s,g=LE(g),(x=ni.get(x))&&g0(g,x),S=S.createElement("link"),fn(S);var T=S;T._p=new Promise(function(_,B){T.onload=_,T.onerror=B}),En(S,"link",g),f.instance=S}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(f,s),(s=f.state.preload)&&(f.state.loading&3)===0&&(o.count++,f=Lh.bind(o),s.addEventListener("load",f),s.addEventListener("error",f))}}var v0=0;function I9(o,s){return o.stylesheets&&o.count===0&&Fh(o,o.stylesheets),0v0?50:800)+s);return o.unsuspend=f,function(){o.unsuspend=null,clearTimeout(g),clearTimeout(x)}}:null}function Lh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Fh(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Bh=null;function Fh(o,s){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Bh=new Map,s.forEach(L9,o),Bh=null,Lh.call(o))}function L9(o,s){if(!(s.state.loading&4)){var f=Bh.get(o);if(f)var g=f.get(null);else{f=new Map,Bh.set(o,f);for(var x=o.querySelectorAll("link[data-precedence],style[data-precedence]"),S=0;S"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),E0.exports=t$(),E0.exports}var r$=n$();const i$=mi(r$);var fT="popstate";function a$(e={}){function t(r,i){let{pathname:a,search:l,hash:u}=r.location;return a1("",{pathname:a,search:l,hash:u},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(r,i){return typeof i=="string"?i:xd(i)}return l$(t,n,null,e)}function Et(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Ir(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function o$(){return Math.random().toString(36).substring(2,10)}function hT(e,t){return{usr:e.state,key:e.key,idx:t}}function a1(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?ku(t):t,state:n,key:t&&t.key||r||o$()}}function xd({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function ku(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function l$(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,l=i.history,u="POP",c=null,d=h();d==null&&(d=0,l.replaceState({...l.state,idx:d},""));function h(){return(l.state||{idx:null}).idx}function m(){u="POP";let C=h(),k=C==null?null:C-d;d=C,c&&c({action:u,location:j.location,delta:k})}function y(C,k){u="PUSH";let E=a1(j.location,C,k);d=h()+1;let A=hT(E,d),R=j.createHref(E);try{l.pushState(A,"",R)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;i.location.assign(R)}a&&c&&c({action:u,location:j.location,delta:1})}function v(C,k){u="REPLACE";let E=a1(j.location,C,k);d=h();let A=hT(E,d),R=j.createHref(E);l.replaceState(A,"",R),a&&c&&c({action:u,location:j.location,delta:0})}function b(C){return s$(C)}let j={get action(){return u},get location(){return e(i,l)},listen(C){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(fT,m),c=C,()=>{i.removeEventListener(fT,m),c=null}},createHref(C){return t(i,C)},createURL:b,encodeLocation(C){let k=b(C);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:y,replace:v,go(C){return l.go(C)}};return j}function s$(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Et(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:xd(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function C5(e,t,n="/"){return u$(e,t,n,!1)}function u$(e,t,n,r){let i=typeof t=="string"?ku(t):t,a=Ua(i.pathname||"/",n);if(a==null)return null;let l=k5(e);c$(l);let u=null;for(let c=0;u==null&&c{let h={relativePath:d===void 0?l.path||"":d,caseSensitive:l.caseSensitive===!0,childrenIndex:u,route:l};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(r)&&c)return;Et(h.relativePath.startsWith(r),`Absolute route path "${h.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(r.length)}let m=La([r,h.relativePath]),y=n.concat(h);l.children&&l.children.length>0&&(Et(l.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),k5(l.children,t,y,m,c)),!(l.path==null&&!l.index)&&t.push({path:m,score:y$(m,l.index),routesMeta:y})};return e.forEach((l,u)=>{if(l.path===""||!l.path?.includes("?"))a(l,u);else for(let c of A5(l.path))a(l,u,!0,c)}),t}function A5(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return i?[a,""]:[a];let l=A5(r.join("/")),u=[];return u.push(...l.map(c=>c===""?a:[a,c].join("/"))),i&&u.push(...l),u.map(c=>e.startsWith("/")&&c===""?"/":c)}function c$(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:v$(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var d$=/^:[\w-]+$/,f$=3,h$=2,p$=1,m$=10,g$=-2,pT=e=>e==="*";function y$(e,t){let n=e.split("/"),r=n.length;return n.some(pT)&&(r+=g$),t&&(r+=h$),n.filter(i=>!pT(i)).reduce((i,a)=>i+(d$.test(a)?f$:a===""?p$:m$),r)}function v$(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 x$(e,t,n=!1){let{routesMeta:r}=e,i={},a="/",l=[];for(let u=0;u{if(h==="*"){let b=u[y]||"";l=a.slice(0,a.length-b.length).replace(/(.)\/+$/,"$1")}const v=u[y];return m&&!v?d[h]=void 0:d[h]=(v||"").replace(/%2F/g,"/"),d},{}),pathname:a,pathnameBase:l,pattern:e}}function b$(e,t=!1,n=!0){Ir(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,(l,u,c)=>(r.push({paramName:u,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function w$(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Ir(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Ua(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)||"/"}var S$=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,j$=e=>S$.test(e);function C$(e,t="/"){let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?ku(e):e,a;if(n)if(j$(n))a=n;else{if(n.includes("//")){let l=n;n=n.replace(/\/\/+/g,"/"),Ir(!1,`Pathnames cannot have embedded double slashes - normalizing ${l} -> ${n}`)}n.startsWith("/")?a=mT(n.substring(1),"/"):a=mT(n,t)}else a=t;return{pathname:a,search:E$(r),hash:T$(i)}}function mT(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 D0(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 k$(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function cS(e){let t=k$(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function dS(e,t,n,r=!1){let i;typeof e=="string"?i=ku(e):(i={...e},Et(!i.pathname||!i.pathname.includes("?"),D0("?","pathname","search",i)),Et(!i.pathname||!i.pathname.includes("#"),D0("#","pathname","hash",i)),Et(!i.search||!i.search.includes("#"),D0("#","search","hash",i)));let a=e===""||i.pathname==="",l=a?"/":i.pathname,u;if(l==null)u=n;else{let m=t.length-1;if(!r&&l.startsWith("..")){let y=l.split("/");for(;y[0]==="..";)y.shift(),m-=1;i.pathname=y.join("/")}u=m>=0?t[m]:"/"}let c=C$(i,u),d=l&&l!=="/"&&l.endsWith("/"),h=(a||l===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(d||h)&&(c.pathname+="/"),c}var La=e=>e.join("/").replace(/\/\/+/g,"/"),A$=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),E$=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,T$=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function O$(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var E5=["POST","PUT","PATCH","DELETE"];new Set(E5);var R$=["GET",...E5];new Set(R$);var Au=w.createContext(null);Au.displayName="DataRouter";var lg=w.createContext(null);lg.displayName="DataRouterState";w.createContext(!1);var T5=w.createContext({isTransitioning:!1});T5.displayName="ViewTransition";var D$=w.createContext(new Map);D$.displayName="Fetchers";var _$=w.createContext(null);_$.displayName="Await";var Ii=w.createContext(null);Ii.displayName="Navigation";var Yd=w.createContext(null);Yd.displayName="Location";var Li=w.createContext({outlet:null,matches:[],isDataRoute:!1});Li.displayName="Route";var fS=w.createContext(null);fS.displayName="RouteError";function M$(e,{relative:t}={}){Et(Eu(),"useHref() may be used only in the context of a component.");let{basename:n,navigator:r}=w.useContext(Ii),{hash:i,pathname:a,search:l}=Xd(e,{relative:t}),u=a;return n!=="/"&&(u=a==="/"?n:La([n,a])),r.createHref({pathname:u,search:l,hash:i})}function Eu(){return w.useContext(Yd)!=null}function $r(){return Et(Eu(),"useLocation() may be used only in the context of a component."),w.useContext(Yd).location}var O5="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function R5(e){w.useContext(Ii).static||w.useLayoutEffect(e)}function _n(){let{isDataRoute:e}=w.useContext(Li);return e?W$():P$()}function P$(){Et(Eu(),"useNavigate() may be used only in the context of a component.");let e=w.useContext(Au),{basename:t,navigator:n}=w.useContext(Ii),{matches:r}=w.useContext(Li),{pathname:i}=$r(),a=JSON.stringify(cS(r)),l=w.useRef(!1);return R5(()=>{l.current=!0}),w.useCallback((c,d={})=>{if(Ir(l.current,O5),!l.current)return;if(typeof c=="number"){n.go(c);return}let h=dS(c,JSON.parse(a),i,d.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:La([t,h.pathname])),(d.replace?n.replace:n.push)(h,d.state,d)},[t,n,a,i,e])}w.createContext(null);function to(){let{matches:e}=w.useContext(Li),t=e[e.length-1];return t?t.params:{}}function Xd(e,{relative:t}={}){let{matches:n}=w.useContext(Li),{pathname:r}=$r(),i=JSON.stringify(cS(n));return w.useMemo(()=>dS(e,JSON.parse(i),r,t==="path"),[e,i,r,t])}function N$(e,t){return D5(e,t)}function D5(e,t,n,r,i){Et(Eu(),"useRoutes() may be used only in the context of a component.");let{navigator:a}=w.useContext(Ii),{matches:l}=w.useContext(Li),u=l[l.length-1],c=u?u.params:{},d=u?u.pathname:"/",h=u?u.pathnameBase:"/",m=u&&u.route;{let E=m&&m.path||"";_5(d,!m||E.endsWith("*")||E.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${d}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. +`+g.stack}}var Kr=Object.prototype.hasOwnProperty,En=e.unstable_scheduleCallback,ye=e.unstable_cancelCallback,Re=e.unstable_shouldYield,_e=e.unstable_requestPaint,qe=e.unstable_now,bt=e.unstable_getCurrentPriorityLevel,ae=e.unstable_ImmediatePriority,me=e.unstable_UserBlockingPriority,Ee=e.unstable_NormalPriority,Fe=e.unstable_LowPriority,Je=e.unstable_IdlePriority,Pt=e.log,Yr=e.unstable_setDisableYieldValue,Tn=null,Bt=null;function pn(o){if(typeof Pt=="function"&&Yr(o),Bt&&typeof Bt.setStrictMode=="function")try{Bt.setStrictMode(Tn,o)}catch{}}var ot=Math.clz32?Math.clz32:my,Ki=Math.log,ar=Math.LN2;function my(o){return o>>>=0,o===0?32:31-(Ki(o)/ar|0)|0}var ts=256,ns=262144,Ft=4194304;function $t(o){var s=o&42;if(s!==0)return s;switch(o&-o){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function mn(o,s,f){var g=o.pendingLanes;if(g===0)return 0;var x=0,S=o.suspendedLanes,T=o.pingedLanes;o=o.warmLanes;var _=g&134217727;return _!==0?(g=_&~S,g!==0?x=$t(g):(T&=_,T!==0?x=$t(T):f||(f=_&~o,f!==0&&(x=$t(f))))):(_=g&~S,_!==0?x=$t(_):T!==0?x=$t(T):f||(f=g&~o,f!==0&&(x=$t(f)))),x===0?0:s!==0&&s!==x&&(s&S)===0&&(S=x&-x,f=s&-s,S>=f||S===32&&(f&4194048)!==0)?s:x}function or(o,s){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&s)===0}function lr(o,s){switch(o){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32: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 s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Bn(){var o=Ft;return Ft<<=1,(Ft&62914560)===0&&(Ft=4194304),o}function sr(o){for(var s=[],f=0;31>f;f++)s.push(o);return s}function Xr(o,s){o.pendingLanes|=s,s!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function nn(o,s,f,g,x,S){var T=o.pendingLanes;o.pendingLanes=f,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=f,o.entangledLanes&=f,o.errorRecoveryDisabledLanes&=f,o.shellSuspendCounter=0;var _=o.entanglements,B=o.expirationTimes,Y=o.hiddenUpdates;for(f=T&~f;0"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var $8=/[\n"\\]/g;function ei(o){return o.replace($8,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function xy(o,s,f,g,x,S,T,_){o.name="",T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?o.type=T:o.removeAttribute("type"),s!=null?T==="number"?(s===0&&o.value===""||o.value!=s)&&(o.value=""+Jr(s)):o.value!==""+Jr(s)&&(o.value=""+Jr(s)):T!=="submit"&&T!=="reset"||o.removeAttribute("value"),s!=null?by(o,T,Jr(s)):f!=null?by(o,T,Jr(f)):g!=null&&o.removeAttribute("value"),x==null&&S!=null&&(o.defaultChecked=!!S),x!=null&&(o.checked=x&&typeof x!="function"&&typeof x!="symbol"),_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?o.name=""+Jr(_):o.removeAttribute("name")}function xC(o,s,f,g,x,S,T,_){if(S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(o.type=S),s!=null||f!=null){if(!(S!=="submit"&&S!=="reset"||s!=null)){vy(o);return}f=f!=null?""+Jr(f):"",s=s!=null?""+Jr(s):f,_||s===o.value||(o.value=s),o.defaultValue=s}g=g??x,g=typeof g!="function"&&typeof g!="symbol"&&!!g,o.checked=_?o.checked:!!g,o.defaultChecked=!!g,T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"&&(o.name=T),vy(o)}function by(o,s,f){s==="number"&&Lf(o.ownerDocument)===o||o.defaultValue===""+f||(o.defaultValue=""+f)}function ss(o,s,f,g){if(o=o.options,s){s={};for(var x=0;x"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ky=!1;if(xa)try{var Zu={};Object.defineProperty(Zu,"passive",{get:function(){ky=!0}}),window.addEventListener("test",Zu,Zu),window.removeEventListener("test",Zu,Zu)}catch{ky=!1}var go=null,Ay=null,Ff=null;function AC(){if(Ff)return Ff;var o,s=Ay,f=s.length,g,x="value"in go?go.value:go.textContent,S=x.length;for(o=0;o=ec),_C=" ",MC=!1;function PC(o,s){switch(o){case"keyup":return mF.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function NC(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var fs=!1;function yF(o,s){switch(o){case"compositionend":return NC(s);case"keypress":return s.which!==32?null:(MC=!0,_C);case"textInput":return o=s.data,o===_C&&MC?null:o;default:return null}}function vF(o,s){if(fs)return o==="compositionend"||!Dy&&PC(o,s)?(o=AC(),Ff=Ay=go=null,fs=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1=s)return{node:f,offset:s-o};o=g}e:{for(;f;){if(f.nextSibling){f=f.nextSibling;break e}f=f.parentNode}f=void 0}f=VC(f)}}function qC(o,s){return o&&s?o===s?!0:o&&o.nodeType===3?!1:s&&s.nodeType===3?qC(o,s.parentNode):"contains"in o?o.contains(s):o.compareDocumentPosition?!!(o.compareDocumentPosition(s)&16):!1:!1}function WC(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var s=Lf(o.document);s instanceof o.HTMLIFrameElement;){try{var f=typeof s.contentWindow.location.href=="string"}catch{f=!1}if(f)o=s.contentWindow;else break;s=Lf(o.document)}return s}function Py(o){var s=o&&o.nodeName&&o.nodeName.toLowerCase();return s&&(s==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||s==="textarea"||o.contentEditable==="true")}var AF=xa&&"documentMode"in document&&11>=document.documentMode,hs=null,Ny=null,ic=null,zy=!1;function GC(o,s,f){var g=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;zy||hs==null||hs!==Lf(g)||(g=hs,"selectionStart"in g&&Py(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),ic&&rc(ic,g)||(ic=g,g=Mh(Ny,"onSelect"),0>=T,x-=T,Yi=1<<32-ot(s)+x|f<Ve?(Xe=ke,ke=null):Xe=ke.sibling;var tt=X(q,ke,K[Ve],le);if(tt===null){ke===null&&(ke=Xe);break}o&&ke&&tt.alternate===null&&s(q,ke),V=S(tt,V,Ve),et===null?Te=tt:et.sibling=tt,et=tt,ke=Xe}if(Ve===K.length)return f(q,ke),Ze&&wa(q,Ve),Te;if(ke===null){for(;VeVe?(Xe=ke,ke=null):Xe=ke.sibling;var Lo=X(q,ke,tt.value,le);if(Lo===null){ke===null&&(ke=Xe);break}o&&ke&&Lo.alternate===null&&s(q,ke),V=S(Lo,V,Ve),et===null?Te=Lo:et.sibling=Lo,et=Lo,ke=Xe}if(tt.done)return f(q,ke),Ze&&wa(q,Ve),Te;if(ke===null){for(;!tt.done;Ve++,tt=K.next())tt=se(q,tt.value,le),tt!==null&&(V=S(tt,V,Ve),et===null?Te=tt:et.sibling=tt,et=tt);return Ze&&wa(q,Ve),Te}for(ke=g(ke);!tt.done;Ve++,tt=K.next())tt=ee(ke,q,Ve,tt.value,le),tt!==null&&(o&&tt.alternate!==null&&ke.delete(tt.key===null?Ve:tt.key),V=S(tt,V,Ve),et===null?Te=tt:et.sibling=tt,et=tt);return o&&ke.forEach(function(W9){return s(q,W9)}),Ze&&wa(q,Ve),Te}function mt(q,V,K,le){if(typeof K=="object"&&K!==null&&K.type===j&&K.key===null&&(K=K.props.children),typeof K=="object"&&K!==null){switch(K.$$typeof){case v:e:{for(var Te=K.key;V!==null;){if(V.key===Te){if(Te=K.type,Te===j){if(V.tag===7){f(q,V.sibling),le=x(V,K.props.children),le.return=q,q=le;break e}}else if(V.elementType===Te||typeof Te=="object"&&Te!==null&&Te.$$typeof===I&&yl(Te)===V.type){f(q,V.sibling),le=x(V,K.props),cc(le,K),le.return=q,q=le;break e}f(q,V);break}else s(q,V);V=V.sibling}K.type===j?(le=fl(K.props.children,q.mode,le,K.key),le.return=q,q=le):(le=Xf(K.type,K.key,K.props,null,q.mode,le),cc(le,K),le.return=q,q=le)}return T(q);case b:e:{for(Te=K.key;V!==null;){if(V.key===Te)if(V.tag===4&&V.stateNode.containerInfo===K.containerInfo&&V.stateNode.implementation===K.implementation){f(q,V.sibling),le=x(V,K.children||[]),le.return=q,q=le;break e}else{f(q,V);break}else s(q,V);V=V.sibling}le=Vy(K,q.mode,le),le.return=q,q=le}return T(q);case I:return K=yl(K),mt(q,V,K,le)}if(ne(K))return Se(q,V,K,le);if(H(K)){if(Te=H(K),typeof Te!="function")throw Error(r(150));return K=Te.call(K),Ne(q,V,K,le)}if(typeof K.then=="function")return mt(q,V,rh(K),le);if(K.$$typeof===A)return mt(q,V,Jf(q,K),le);ih(q,K)}return typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint"?(K=""+K,V!==null&&V.tag===6?(f(q,V.sibling),le=x(V,K),le.return=q,q=le):(f(q,V),le=Uy(K,q.mode,le),le.return=q,q=le),T(q)):f(q,V)}return function(q,V,K,le){try{uc=0;var Te=mt(q,V,K,le);return Cs=null,Te}catch(ke){if(ke===js||ke===th)throw ke;var et=Tr(29,ke,null,q.mode);return et.lanes=le,et.return=q,et}finally{}}}var xl=gk(!0),yk=gk(!1),wo=!1;function tv(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function nv(o,s){o=o.updateQueue,s.updateQueue===o&&(s.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function So(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function jo(o,s,f){var g=o.updateQueue;if(g===null)return null;if(g=g.shared,(rt&2)!==0){var x=g.pending;return x===null?s.next=s:(s.next=x.next,x.next=s),g.pending=s,s=Yf(o),ek(o,null,f),s}return Kf(o,g,s,f),Yf(o)}function dc(o,s,f){if(s=s.updateQueue,s!==null&&(s=s.shared,(f&4194048)!==0)){var g=s.lanes;g&=o.pendingLanes,f|=g,s.lanes=f,Ar(o,f)}}function rv(o,s){var f=o.updateQueue,g=o.alternate;if(g!==null&&(g=g.updateQueue,f===g)){var x=null,S=null;if(f=f.firstBaseUpdate,f!==null){do{var T={lane:f.lane,tag:f.tag,payload:f.payload,callback:null,next:null};S===null?x=S=T:S=S.next=T,f=f.next}while(f!==null);S===null?x=S=s:S=S.next=s}else x=S=s;f={baseState:g.baseState,firstBaseUpdate:x,lastBaseUpdate:S,shared:g.shared,callbacks:g.callbacks},o.updateQueue=f;return}o=f.lastBaseUpdate,o===null?f.firstBaseUpdate=s:o.next=s,f.lastBaseUpdate=s}var iv=!1;function fc(){if(iv){var o=Ss;if(o!==null)throw o}}function hc(o,s,f,g){iv=!1;var x=o.updateQueue;wo=!1;var S=x.firstBaseUpdate,T=x.lastBaseUpdate,_=x.shared.pending;if(_!==null){x.shared.pending=null;var B=_,Y=B.next;B.next=null,T===null?S=Y:T.next=Y,T=B;var oe=o.alternate;oe!==null&&(oe=oe.updateQueue,_=oe.lastBaseUpdate,_!==T&&(_===null?oe.firstBaseUpdate=Y:_.next=Y,oe.lastBaseUpdate=B))}if(S!==null){var se=x.baseState;T=0,oe=Y=B=null,_=S;do{var X=_.lane&-536870913,ee=X!==_.lane;if(ee?(Ye&X)===X:(g&X)===X){X!==0&&X===ws&&(iv=!0),oe!==null&&(oe=oe.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var Se=o,Ne=_;X=s;var mt=f;switch(Ne.tag){case 1:if(Se=Ne.payload,typeof Se=="function"){se=Se.call(mt,se,X);break e}se=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=Ne.payload,X=typeof Se=="function"?Se.call(mt,se,X):Se,X==null)break e;se=m({},se,X);break e;case 2:wo=!0}}X=_.callback,X!==null&&(o.flags|=64,ee&&(o.flags|=8192),ee=x.callbacks,ee===null?x.callbacks=[X]:ee.push(X))}else ee={lane:X,tag:_.tag,payload:_.payload,callback:_.callback,next:null},oe===null?(Y=oe=ee,B=se):oe=oe.next=ee,T|=X;if(_=_.next,_===null){if(_=x.shared.pending,_===null)break;ee=_,_=ee.next,ee.next=null,x.lastBaseUpdate=ee,x.shared.pending=null}}while(!0);oe===null&&(B=se),x.baseState=B,x.firstBaseUpdate=Y,x.lastBaseUpdate=oe,S===null&&(x.shared.lanes=0),To|=T,o.lanes=T,o.memoizedState=se}}function vk(o,s){if(typeof o!="function")throw Error(r(191,o));o.call(s)}function xk(o,s){var f=o.callbacks;if(f!==null)for(o.callbacks=null,o=0;oS?S:8;var T=U.T,_={};U.T=_,jv(o,!1,s,f);try{var B=x(),Y=U.S;if(Y!==null&&Y(_,B),B!==null&&typeof B=="object"&&typeof B.then=="function"){var oe=NF(B,g);gc(o,s,oe,Mr(o))}else gc(o,s,g,Mr(o))}catch(se){gc(o,s,{then:function(){},status:"rejected",reason:se},Mr())}finally{W.p=S,T!==null&&_.types!==null&&(T.types=_.types),U.T=T}}function $F(){}function wv(o,s,f,g){if(o.tag!==5)throw Error(r(476));var x=Zk(o).queue;Xk(o,x,s,re,f===null?$F:function(){return Qk(o),f(g)})}function Zk(o){var s=o.memoizedState;if(s!==null)return s;s={memoizedState:re,baseState:re,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ka,lastRenderedState:re},next:null};var f={};return s.next={memoizedState:f,baseState:f,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ka,lastRenderedState:f},next:null},o.memoizedState=s,o=o.alternate,o!==null&&(o.memoizedState=s),s}function Qk(o){var s=Zk(o);s.next===null&&(s=o.alternate.memoizedState),gc(o,s.next.queue,{},Mr())}function Sv(){return Dn(Mc)}function Jk(){return Vt().memoizedState}function eA(){return Vt().memoizedState}function UF(o){for(var s=o.return;s!==null;){switch(s.tag){case 24:case 3:var f=Mr();o=So(f);var g=jo(s,o,f);g!==null&&(mr(g,s,f),dc(g,s,f)),s={cache:Zy()},o.payload=s;return}s=s.return}}function VF(o,s,f){var g=Mr();f={lane:g,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},ph(o)?nA(s,f):(f=Fy(o,s,f,g),f!==null&&(mr(f,o,g),rA(f,s,g)))}function tA(o,s,f){var g=Mr();gc(o,s,f,g)}function gc(o,s,f,g){var x={lane:g,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null};if(ph(o))nA(s,x);else{var S=o.alternate;if(o.lanes===0&&(S===null||S.lanes===0)&&(S=s.lastRenderedReducer,S!==null))try{var T=s.lastRenderedState,_=S(T,f);if(x.hasEagerState=!0,x.eagerState=_,Er(_,T))return Kf(o,s,x,0),yt===null&&Gf(),!1}catch{}finally{}if(f=Fy(o,s,x,g),f!==null)return mr(f,o,g),rA(f,s,g),!0}return!1}function jv(o,s,f,g){if(g={lane:2,revertLane:t0(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},ph(o)){if(s)throw Error(r(479))}else s=Fy(o,f,g,2),s!==null&&mr(s,o,2)}function ph(o){var s=o.alternate;return o===$e||s!==null&&s===$e}function nA(o,s){As=lh=!0;var f=o.pending;f===null?s.next=s:(s.next=f.next,f.next=s),o.pending=s}function rA(o,s,f){if((f&4194048)!==0){var g=s.lanes;g&=o.pendingLanes,f|=g,s.lanes=f,Ar(o,f)}}var yc={readContext:Dn,use:ch,useCallback:Nt,useContext:Nt,useEffect:Nt,useImperativeHandle:Nt,useLayoutEffect:Nt,useInsertionEffect:Nt,useMemo:Nt,useReducer:Nt,useRef:Nt,useState:Nt,useDebugValue:Nt,useDeferredValue:Nt,useTransition:Nt,useSyncExternalStore:Nt,useId:Nt,useHostTransitionStatus:Nt,useFormState:Nt,useActionState:Nt,useOptimistic:Nt,useMemoCache:Nt,useCacheRefresh:Nt};yc.useEffectEvent=Nt;var iA={readContext:Dn,use:ch,useCallback:function(o,s){return Yn().memoizedState=[o,s===void 0?null:s],o},useContext:Dn,useEffect:$k,useImperativeHandle:function(o,s,f){f=f!=null?f.concat([o]):null,fh(4194308,4,qk.bind(null,s,o),f)},useLayoutEffect:function(o,s){return fh(4194308,4,o,s)},useInsertionEffect:function(o,s){fh(4,2,o,s)},useMemo:function(o,s){var f=Yn();s=s===void 0?null:s;var g=o();if(bl){pn(!0);try{o()}finally{pn(!1)}}return f.memoizedState=[g,s],g},useReducer:function(o,s,f){var g=Yn();if(f!==void 0){var x=f(s);if(bl){pn(!0);try{f(s)}finally{pn(!1)}}}else x=s;return g.memoizedState=g.baseState=x,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:x},g.queue=o,o=o.dispatch=VF.bind(null,$e,o),[g.memoizedState,o]},useRef:function(o){var s=Yn();return o={current:o},s.memoizedState=o},useState:function(o){o=gv(o);var s=o.queue,f=tA.bind(null,$e,s);return s.dispatch=f,[o.memoizedState,f]},useDebugValue:xv,useDeferredValue:function(o,s){var f=Yn();return bv(f,o,s)},useTransition:function(){var o=gv(!1);return o=Xk.bind(null,$e,o.queue,!0,!1),Yn().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,s,f){var g=$e,x=Yn();if(Ze){if(f===void 0)throw Error(r(407));f=f()}else{if(f=s(),yt===null)throw Error(r(349));(Ye&127)!==0||kk(g,s,f)}x.memoizedState=f;var S={value:f,getSnapshot:s};return x.queue=S,$k(Ek.bind(null,g,S,o),[o]),g.flags|=2048,Ts(9,{destroy:void 0},Ak.bind(null,g,S,f,s),null),f},useId:function(){var o=Yn(),s=yt.identifierPrefix;if(Ze){var f=Xi,g=Yi;f=(g&~(1<<32-ot(g)-1)).toString(32)+f,s="_"+s+"R_"+f,f=sh++,0<\/script>",S=S.removeChild(S.firstChild);break;case"select":S=typeof g.is=="string"?T.createElement("select",{is:g.is}):T.createElement("select"),g.multiple?S.multiple=!0:g.size&&(S.size=g.size);break;default:S=typeof g.is=="string"?T.createElement(x,{is:g.is}):T.createElement(x)}}S[On]=s,S[ur]=g;e:for(T=s.child;T!==null;){if(T.tag===5||T.tag===6)S.appendChild(T.stateNode);else if(T.tag!==4&&T.tag!==27&&T.child!==null){T.child.return=T,T=T.child;continue}if(T===s)break e;for(;T.sibling===null;){if(T.return===null||T.return===s)break e;T=T.return}T.sibling.return=T.return,T=T.sibling}s.stateNode=S;e:switch(Mn(S,x,g),x){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}g&&Ea(s)}}return At(s),Iv(s,s.type,o===null?null:o.memoizedProps,s.pendingProps,f),null;case 6:if(o&&s.stateNode!=null)o.memoizedProps!==g&&Ea(s);else{if(typeof g!="string"&&s.stateNode===null)throw Error(r(166));if(o=ve.current,xs(s)){if(o=s.stateNode,f=s.memoizedProps,g=null,x=Rn,x!==null)switch(x.tag){case 27:case 5:g=x.memoizedProps}o[On]=s,o=!!(o.nodeValue===f||g!==null&&g.suppressHydrationWarning===!0||jE(o.nodeValue,f)),o||xo(s,!0)}else o=Ph(o).createTextNode(g),o[On]=s,s.stateNode=o}return At(s),null;case 31:if(f=s.memoizedState,o===null||o.memoizedState!==null){if(g=xs(s),f!==null){if(o===null){if(!g)throw Error(r(318));if(o=s.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(557));o[On]=s}else hl(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;At(s),o=!1}else f=Gy(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=f),o=!0;if(!o)return s.flags&256?(Rr(s),s):(Rr(s),null);if((s.flags&128)!==0)throw Error(r(558))}return At(s),null;case 13:if(g=s.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(x=xs(s),g!==null&&g.dehydrated!==null){if(o===null){if(!x)throw Error(r(318));if(x=s.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(r(317));x[On]=s}else hl(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;At(s),x=!1}else x=Gy(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=x),x=!0;if(!x)return s.flags&256?(Rr(s),s):(Rr(s),null)}return Rr(s),(s.flags&128)!==0?(s.lanes=f,s):(f=g!==null,o=o!==null&&o.memoizedState!==null,f&&(g=s.child,x=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(x=g.alternate.memoizedState.cachePool.pool),S=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(S=g.memoizedState.cachePool.pool),S!==x&&(g.flags|=2048)),f!==o&&f&&(s.child.flags|=8192),xh(s,s.updateQueue),At(s),null);case 4:return Q(),o===null&&a0(s.stateNode.containerInfo),At(s),null;case 10:return ja(s.type),At(s),null;case 19:if(G(Ut),g=s.memoizedState,g===null)return At(s),null;if(x=(s.flags&128)!==0,S=g.rendering,S===null)if(x)xc(g,!1);else{if(zt!==0||o!==null&&(o.flags&128)!==0)for(o=s.child;o!==null;){if(S=oh(o),S!==null){for(s.flags|=128,xc(g,!1),o=S.updateQueue,s.updateQueue=o,xh(s,o),s.subtreeFlags=0,o=f,f=s.child;f!==null;)tk(f,o),f=f.sibling;return P(Ut,Ut.current&1|2),Ze&&wa(s,g.treeForkCount),s.child}o=o.sibling}g.tail!==null&&qe()>Ch&&(s.flags|=128,x=!0,xc(g,!1),s.lanes=4194304)}else{if(!x)if(o=oh(S),o!==null){if(s.flags|=128,x=!0,o=o.updateQueue,s.updateQueue=o,xh(s,o),xc(g,!0),g.tail===null&&g.tailMode==="hidden"&&!S.alternate&&!Ze)return At(s),null}else 2*qe()-g.renderingStartTime>Ch&&f!==536870912&&(s.flags|=128,x=!0,xc(g,!1),s.lanes=4194304);g.isBackwards?(S.sibling=s.child,s.child=S):(o=g.last,o!==null?o.sibling=S:s.child=S,g.last=S)}return g.tail!==null?(o=g.tail,g.rendering=o,g.tail=o.sibling,g.renderingStartTime=qe(),o.sibling=null,f=Ut.current,P(Ut,x?f&1|2:f&1),Ze&&wa(s,g.treeForkCount),o):(At(s),null);case 22:case 23:return Rr(s),ov(),g=s.memoizedState!==null,o!==null?o.memoizedState!==null!==g&&(s.flags|=8192):g&&(s.flags|=8192),g?(f&536870912)!==0&&(s.flags&128)===0&&(At(s),s.subtreeFlags&6&&(s.flags|=8192)):At(s),f=s.updateQueue,f!==null&&xh(s,f.retryQueue),f=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(f=o.memoizedState.cachePool.pool),g=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(g=s.memoizedState.cachePool.pool),g!==f&&(s.flags|=2048),o!==null&&G(gl),null;case 24:return f=null,o!==null&&(f=o.memoizedState.cache),s.memoizedState.cache!==f&&(s.flags|=2048),ja(Kt),At(s),null;case 25:return null;case 30:return null}throw Error(r(156,s.tag))}function KF(o,s){switch(qy(s),s.tag){case 1:return o=s.flags,o&65536?(s.flags=o&-65537|128,s):null;case 3:return ja(Kt),Q(),o=s.flags,(o&65536)!==0&&(o&128)===0?(s.flags=o&-65537|128,s):null;case 26:case 27:case 5:return De(s),null;case 31:if(s.memoizedState!==null){if(Rr(s),s.alternate===null)throw Error(r(340));hl()}return o=s.flags,o&65536?(s.flags=o&-65537|128,s):null;case 13:if(Rr(s),o=s.memoizedState,o!==null&&o.dehydrated!==null){if(s.alternate===null)throw Error(r(340));hl()}return o=s.flags,o&65536?(s.flags=o&-65537|128,s):null;case 19:return G(Ut),null;case 4:return Q(),null;case 10:return ja(s.type),null;case 22:case 23:return Rr(s),ov(),o!==null&&G(gl),o=s.flags,o&65536?(s.flags=o&-65537|128,s):null;case 24:return ja(Kt),null;case 25:return null;default:return null}}function TA(o,s){switch(qy(s),s.tag){case 3:ja(Kt),Q();break;case 26:case 27:case 5:De(s);break;case 4:Q();break;case 31:s.memoizedState!==null&&Rr(s);break;case 13:Rr(s);break;case 19:G(Ut);break;case 10:ja(s.type);break;case 22:case 23:Rr(s),ov(),o!==null&&G(gl);break;case 24:ja(Kt)}}function bc(o,s){try{var f=s.updateQueue,g=f!==null?f.lastEffect:null;if(g!==null){var x=g.next;f=x;do{if((f.tag&o)===o){g=void 0;var S=f.create,T=f.inst;g=S(),T.destroy=g}f=f.next}while(f!==x)}}catch(_){ut(s,s.return,_)}}function Ao(o,s,f){try{var g=s.updateQueue,x=g!==null?g.lastEffect:null;if(x!==null){var S=x.next;g=S;do{if((g.tag&o)===o){var T=g.inst,_=T.destroy;if(_!==void 0){T.destroy=void 0,x=s;var B=f,Y=_;try{Y()}catch(oe){ut(x,B,oe)}}}g=g.next}while(g!==S)}}catch(oe){ut(s,s.return,oe)}}function OA(o){var s=o.updateQueue;if(s!==null){var f=o.stateNode;try{xk(s,f)}catch(g){ut(o,o.return,g)}}}function RA(o,s,f){f.props=wl(o.type,o.memoizedProps),f.state=o.memoizedState;try{f.componentWillUnmount()}catch(g){ut(o,s,g)}}function wc(o,s){try{var f=o.ref;if(f!==null){switch(o.tag){case 26:case 27:case 5:var g=o.stateNode;break;case 30:g=o.stateNode;break;default:g=o.stateNode}typeof f=="function"?o.refCleanup=f(g):f.current=g}}catch(x){ut(o,s,x)}}function Zi(o,s){var f=o.ref,g=o.refCleanup;if(f!==null)if(typeof g=="function")try{g()}catch(x){ut(o,s,x)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof f=="function")try{f(null)}catch(x){ut(o,s,x)}else f.current=null}function DA(o){var s=o.type,f=o.memoizedProps,g=o.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":f.autoFocus&&g.focus();break e;case"img":f.src?g.src=f.src:f.srcSet&&(g.srcset=f.srcSet)}}catch(x){ut(o,o.return,x)}}function Lv(o,s,f){try{var g=o.stateNode;g9(g,o.type,f,s),g[ur]=s}catch(x){ut(o,o.return,x)}}function _A(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&Mo(o.type)||o.tag===4}function Bv(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||_A(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&Mo(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Fv(o,s,f){var g=o.tag;if(g===5||g===6)o=o.stateNode,s?(f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f).insertBefore(o,s):(s=f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f,s.appendChild(o),f=f._reactRootContainer,f!=null||s.onclick!==null||(s.onclick=va));else if(g!==4&&(g===27&&Mo(o.type)&&(f=o.stateNode,s=null),o=o.child,o!==null))for(Fv(o,s,f),o=o.sibling;o!==null;)Fv(o,s,f),o=o.sibling}function bh(o,s,f){var g=o.tag;if(g===5||g===6)o=o.stateNode,s?f.insertBefore(o,s):f.appendChild(o);else if(g!==4&&(g===27&&Mo(o.type)&&(f=o.stateNode),o=o.child,o!==null))for(bh(o,s,f),o=o.sibling;o!==null;)bh(o,s,f),o=o.sibling}function MA(o){var s=o.stateNode,f=o.memoizedProps;try{for(var g=o.type,x=s.attributes;x.length;)s.removeAttributeNode(x[0]);Mn(s,g,f),s[On]=o,s[ur]=f}catch(S){ut(o,o.return,S)}}var Ta=!1,Zt=!1,$v=!1,PA=typeof WeakSet=="function"?WeakSet:Set,yn=null;function YF(o,s){if(o=o.containerInfo,s0=$h,o=WC(o),Py(o)){if("selectionStart"in o)var f={start:o.selectionStart,end:o.selectionEnd};else e:{f=(f=o.ownerDocument)&&f.defaultView||window;var g=f.getSelection&&f.getSelection();if(g&&g.rangeCount!==0){f=g.anchorNode;var x=g.anchorOffset,S=g.focusNode;g=g.focusOffset;try{f.nodeType,S.nodeType}catch{f=null;break e}var T=0,_=-1,B=-1,Y=0,oe=0,se=o,X=null;t:for(;;){for(var ee;se!==f||x!==0&&se.nodeType!==3||(_=T+x),se!==S||g!==0&&se.nodeType!==3||(B=T+g),se.nodeType===3&&(T+=se.nodeValue.length),(ee=se.firstChild)!==null;)X=se,se=ee;for(;;){if(se===o)break t;if(X===f&&++Y===x&&(_=T),X===S&&++oe===g&&(B=T),(ee=se.nextSibling)!==null)break;se=X,X=se.parentNode}se=ee}f=_===-1||B===-1?null:{start:_,end:B}}else f=null}f=f||{start:0,end:0}}else f=null;for(u0={focusedElem:o,selectionRange:f},$h=!1,yn=s;yn!==null;)if(s=yn,o=s.child,(s.subtreeFlags&1028)!==0&&o!==null)o.return=s,yn=o;else for(;yn!==null;){switch(s=yn,S=s.alternate,o=s.flags,s.tag){case 0:if((o&4)!==0&&(o=s.updateQueue,o=o!==null?o.events:null,o!==null))for(f=0;f title"))),Mn(S,g,f),S[On]=o,gn(S),g=S;break e;case"link":var T=FE("link","href",x).get(g+(f.href||""));if(T){for(var _=0;_mt&&(T=mt,mt=Ne,Ne=T);var q=HC(_,Ne),V=HC(_,mt);if(q&&V&&(ee.rangeCount!==1||ee.anchorNode!==q.node||ee.anchorOffset!==q.offset||ee.focusNode!==V.node||ee.focusOffset!==V.offset)){var K=se.createRange();K.setStart(q.node,q.offset),ee.removeAllRanges(),Ne>mt?(ee.addRange(K),ee.extend(V.node,V.offset)):(K.setEnd(V.node,V.offset),ee.addRange(K))}}}}for(se=[],ee=_;ee=ee.parentNode;)ee.nodeType===1&&se.push({element:ee,left:ee.scrollLeft,top:ee.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_f?32:f,U.T=null,f=Kv,Kv=null;var S=Ro,T=Ma;if(rn=0,Ms=Ro=null,Ma=0,(rt&6)!==0)throw Error(r(331));var _=rt;if(rt|=4,qA(S.current),UA(S,S.current,T,f),rt=_,Ec(0,!1),Bt&&typeof Bt.onPostCommitFiberRoot=="function")try{Bt.onPostCommitFiberRoot(Tn,S)}catch{}return!0}finally{W.p=x,U.T=g,uE(o,s)}}function dE(o,s,f){s=ni(f,s),s=Ev(o.stateNode,s,2),o=jo(o,s,2),o!==null&&(Xr(o,2),Qi(o))}function ut(o,s,f){if(o.tag===3)dE(o,o,f);else for(;s!==null;){if(s.tag===3){dE(s,o,f);break}else if(s.tag===1){var g=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Oo===null||!Oo.has(g))){o=ni(f,o),f=fA(2),g=jo(s,f,2),g!==null&&(hA(f,g,s,o),Xr(g,2),Qi(g));break}}s=s.return}}function Qv(o,s,f){var g=o.pingCache;if(g===null){g=o.pingCache=new QF;var x=new Set;g.set(s,x)}else x=g.get(s),x===void 0&&(x=new Set,g.set(s,x));x.has(f)||(Hv=!0,x.add(f),o=r9.bind(null,o,s,f),s.then(o,o))}function r9(o,s,f){var g=o.pingCache;g!==null&&g.delete(s),o.pingedLanes|=o.suspendedLanes&f,o.warmLanes&=~f,yt===o&&(Ye&f)===f&&(zt===4||zt===3&&(Ye&62914560)===Ye&&300>qe()-jh?(rt&2)===0&&Ps(o,0):qv|=f,_s===Ye&&(_s=0)),Qi(o)}function fE(o,s){s===0&&(s=Bn()),o=dl(o,s),o!==null&&(Xr(o,s),Qi(o))}function i9(o){var s=o.memoizedState,f=0;s!==null&&(f=s.retryLane),fE(o,f)}function a9(o,s){var f=0;switch(o.tag){case 31:case 13:var g=o.stateNode,x=o.memoizedState;x!==null&&(f=x.retryLane);break;case 19:g=o.stateNode;break;case 22:g=o.stateNode._retryCache;break;default:throw Error(r(314))}g!==null&&g.delete(s),fE(o,f)}function o9(o,s){return En(o,s)}var Rh=null,zs=null,Jv=!1,Dh=!1,e0=!1,_o=0;function Qi(o){o!==zs&&o.next===null&&(zs===null?Rh=zs=o:zs=zs.next=o),Dh=!0,Jv||(Jv=!0,s9())}function Ec(o,s){if(!e0&&Dh){e0=!0;do for(var f=!1,g=Rh;g!==null;){if(o!==0){var x=g.pendingLanes;if(x===0)var S=0;else{var T=g.suspendedLanes,_=g.pingedLanes;S=(1<<31-ot(42|o)+1)-1,S&=x&~(T&~_),S=S&201326741?S&201326741|1:S?S|2:0}S!==0&&(f=!0,gE(g,S))}else S=Ye,S=mn(g,g===yt?S:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(S&3)===0||or(g,S)||(f=!0,gE(g,S));g=g.next}while(f);e0=!1}}function l9(){hE()}function hE(){Dh=Jv=!1;var o=0;_o!==0&&v9()&&(o=_o);for(var s=qe(),f=null,g=Rh;g!==null;){var x=g.next,S=pE(g,s);S===0?(g.next=null,f===null?Rh=x:f.next=x,x===null&&(zs=f)):(f=g,(o!==0||(S&3)!==0)&&(Dh=!0)),g=x}rn!==0&&rn!==5||Ec(o),_o!==0&&(_o=0)}function pE(o,s){for(var f=o.suspendedLanes,g=o.pingedLanes,x=o.expirationTimes,S=o.pendingLanes&-62914561;0_)break;var oe=B.transferSize,se=B.initiatorType;oe&&CE(se)&&(B=B.responseEnd,T+=oe*(B<_?1:(_-Y)/(B-Y)))}if(--g,s+=8*(S+T)/(x.duration/1e3),o++,10"u"?null:document;function zE(o,s,f){var g=Is;if(g&&typeof s=="string"&&s){var x=ei(s);x='link[rel="'+o+'"][href="'+x+'"]',typeof f=="string"&&(x+='[crossorigin="'+f+'"]'),NE.has(x)||(NE.add(x),o={rel:o,crossOrigin:f,href:s},g.querySelector(x)===null&&(s=g.createElement("link"),Mn(s,"link",o),gn(s),g.head.appendChild(s)))}}function E9(o){Pa.D(o),zE("dns-prefetch",o,null)}function T9(o,s){Pa.C(o,s),zE("preconnect",o,s)}function O9(o,s,f){Pa.L(o,s,f);var g=Is;if(g&&o&&s){var x='link[rel="preload"][as="'+ei(s)+'"]';s==="image"&&f&&f.imageSrcSet?(x+='[imagesrcset="'+ei(f.imageSrcSet)+'"]',typeof f.imageSizes=="string"&&(x+='[imagesizes="'+ei(f.imageSizes)+'"]')):x+='[href="'+ei(o)+'"]';var S=x;switch(s){case"style":S=Ls(o);break;case"script":S=Bs(o)}si.has(S)||(o=m({rel:"preload",href:s==="image"&&f&&f.imageSrcSet?void 0:o,as:s},f),si.set(S,o),g.querySelector(x)!==null||s==="style"&&g.querySelector(Dc(S))||s==="script"&&g.querySelector(_c(S))||(s=g.createElement("link"),Mn(s,"link",o),gn(s),g.head.appendChild(s)))}}function R9(o,s){Pa.m(o,s);var f=Is;if(f&&o){var g=s&&typeof s.as=="string"?s.as:"script",x='link[rel="modulepreload"][as="'+ei(g)+'"][href="'+ei(o)+'"]',S=x;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":S=Bs(o)}if(!si.has(S)&&(o=m({rel:"modulepreload",href:o},s),si.set(S,o),f.querySelector(x)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(f.querySelector(_c(S)))return}g=f.createElement("link"),Mn(g,"link",o),gn(g),f.head.appendChild(g)}}}function D9(o,s,f){Pa.S(o,s,f);var g=Is;if(g&&o){var x=os(g).hoistableStyles,S=Ls(o);s=s||"default";var T=x.get(S);if(!T){var _={loading:0,preload:null};if(T=g.querySelector(Dc(S)))_.loading=5;else{o=m({rel:"stylesheet",href:o,"data-precedence":s},f),(f=si.get(S))&&g0(o,f);var B=T=g.createElement("link");gn(B),Mn(B,"link",o),B._p=new Promise(function(Y,oe){B.onload=Y,B.onerror=oe}),B.addEventListener("load",function(){_.loading|=1}),B.addEventListener("error",function(){_.loading|=2}),_.loading|=4,zh(T,s,g)}T={type:"stylesheet",instance:T,count:1,state:_},x.set(S,T)}}}function _9(o,s){Pa.X(o,s);var f=Is;if(f&&o){var g=os(f).hoistableScripts,x=Bs(o),S=g.get(x);S||(S=f.querySelector(_c(x)),S||(o=m({src:o,async:!0},s),(s=si.get(x))&&y0(o,s),S=f.createElement("script"),gn(S),Mn(S,"link",o),f.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},g.set(x,S))}}function M9(o,s){Pa.M(o,s);var f=Is;if(f&&o){var g=os(f).hoistableScripts,x=Bs(o),S=g.get(x);S||(S=f.querySelector(_c(x)),S||(o=m({src:o,async:!0,type:"module"},s),(s=si.get(x))&&y0(o,s),S=f.createElement("script"),gn(S),Mn(S,"link",o),f.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},g.set(x,S))}}function IE(o,s,f,g){var x=(x=ve.current)?Nh(x):null;if(!x)throw Error(r(446));switch(o){case"meta":case"title":return null;case"style":return typeof f.precedence=="string"&&typeof f.href=="string"?(s=Ls(f.href),f=os(x).hoistableStyles,g=f.get(s),g||(g={type:"style",instance:null,count:0,state:null},f.set(s,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(f.rel==="stylesheet"&&typeof f.href=="string"&&typeof f.precedence=="string"){o=Ls(f.href);var S=os(x).hoistableStyles,T=S.get(o);if(T||(x=x.ownerDocument||x,T={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},S.set(o,T),(S=x.querySelector(Dc(o)))&&!S._p&&(T.instance=S,T.state.loading=5),si.has(o)||(f={rel:"preload",as:"style",href:f.href,crossOrigin:f.crossOrigin,integrity:f.integrity,media:f.media,hrefLang:f.hrefLang,referrerPolicy:f.referrerPolicy},si.set(o,f),S||P9(x,o,f,T.state))),s&&g===null)throw Error(r(528,""));return T}if(s&&g!==null)throw Error(r(529,""));return null;case"script":return s=f.async,f=f.src,typeof f=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=Bs(f),f=os(x).hoistableScripts,g=f.get(s),g||(g={type:"script",instance:null,count:0,state:null},f.set(s,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,o))}}function Ls(o){return'href="'+ei(o)+'"'}function Dc(o){return'link[rel="stylesheet"]['+o+"]"}function LE(o){return m({},o,{"data-precedence":o.precedence,precedence:null})}function P9(o,s,f,g){o.querySelector('link[rel="preload"][as="style"]['+s+"]")?g.loading=1:(s=o.createElement("link"),g.preload=s,s.addEventListener("load",function(){return g.loading|=1}),s.addEventListener("error",function(){return g.loading|=2}),Mn(s,"link",f),gn(s),o.head.appendChild(s))}function Bs(o){return'[src="'+ei(o)+'"]'}function _c(o){return"script[async]"+o}function BE(o,s,f){if(s.count++,s.instance===null)switch(s.type){case"style":var g=o.querySelector('style[data-href~="'+ei(f.href)+'"]');if(g)return s.instance=g,gn(g),g;var x=m({},f,{"data-href":f.href,"data-precedence":f.precedence,href:null,precedence:null});return g=(o.ownerDocument||o).createElement("style"),gn(g),Mn(g,"style",x),zh(g,f.precedence,o),s.instance=g;case"stylesheet":x=Ls(f.href);var S=o.querySelector(Dc(x));if(S)return s.state.loading|=4,s.instance=S,gn(S),S;g=LE(f),(x=si.get(x))&&g0(g,x),S=(o.ownerDocument||o).createElement("link"),gn(S);var T=S;return T._p=new Promise(function(_,B){T.onload=_,T.onerror=B}),Mn(S,"link",g),s.state.loading|=4,zh(S,f.precedence,o),s.instance=S;case"script":return S=Bs(f.src),(x=o.querySelector(_c(S)))?(s.instance=x,gn(x),x):(g=f,(x=si.get(S))&&(g=m({},f),y0(g,x)),o=o.ownerDocument||o,x=o.createElement("script"),gn(x),Mn(x,"link",g),o.head.appendChild(x),s.instance=x);case"void":return null;default:throw Error(r(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(g=s.instance,s.state.loading|=4,zh(g,f.precedence,o));return s.instance}function zh(o,s,f){for(var g=f.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),x=g.length?g[g.length-1]:null,S=x,T=0;T title"):null)}function N9(o,s,f){if(f===1||s.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return o=s.disabled,typeof s.precedence=="string"&&o==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function UE(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function z9(o,s,f,g){if(f.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(f.state.loading&4)===0){if(f.instance===null){var x=Ls(g.href),S=s.querySelector(Dc(x));if(S){s=S._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(o.count++,o=Lh.bind(o),s.then(o,o)),f.state.loading|=4,f.instance=S,gn(S);return}S=s.ownerDocument||s,g=LE(g),(x=si.get(x))&&g0(g,x),S=S.createElement("link"),gn(S);var T=S;T._p=new Promise(function(_,B){T.onload=_,T.onerror=B}),Mn(S,"link",g),f.instance=S}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(f,s),(s=f.state.preload)&&(f.state.loading&3)===0&&(o.count++,f=Lh.bind(o),s.addEventListener("load",f),s.addEventListener("error",f))}}var v0=0;function I9(o,s){return o.stylesheets&&o.count===0&&Fh(o,o.stylesheets),0v0?50:800)+s);return o.unsuspend=f,function(){o.unsuspend=null,clearTimeout(g),clearTimeout(x)}}:null}function Lh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Fh(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Bh=null;function Fh(o,s){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Bh=new Map,s.forEach(L9,o),Bh=null,Lh.call(o))}function L9(o,s){if(!(s.state.loading&4)){var f=Bh.get(o);if(f)var g=f.get(null);else{f=new Map,Bh.set(o,f);for(var x=o.querySelectorAll("link[data-precedence],style[data-precedence]"),S=0;S"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),E0.exports=t$(),E0.exports}var r$=n$();const i$=wi(r$);var fT="popstate";function a$(e={}){function t(r,i){let{pathname:a,search:l,hash:u}=r.location;return a1("",{pathname:a,search:l,hash:u},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(r,i){return typeof i=="string"?i:xd(i)}return l$(t,n,null,e)}function _t(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function $r(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function o$(){return Math.random().toString(36).substring(2,10)}function hT(e,t){return{usr:e.state,key:e.key,idx:t}}function a1(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Au(t):t,state:n,key:t&&t.key||r||o$()}}function xd({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Au(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function l$(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,l=i.history,u="POP",c=null,d=h();d==null&&(d=0,l.replaceState({...l.state,idx:d},""));function h(){return(l.state||{idx:null}).idx}function m(){u="POP";let C=h(),k=C==null?null:C-d;d=C,c&&c({action:u,location:j.location,delta:k})}function y(C,k){u="PUSH";let E=a1(j.location,C,k);d=h()+1;let A=hT(E,d),R=j.createHref(E);try{l.pushState(A,"",R)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;i.location.assign(R)}a&&c&&c({action:u,location:j.location,delta:1})}function v(C,k){u="REPLACE";let E=a1(j.location,C,k);d=h();let A=hT(E,d),R=j.createHref(E);l.replaceState(A,"",R),a&&c&&c({action:u,location:j.location,delta:0})}function b(C){return s$(C)}let j={get action(){return u},get location(){return e(i,l)},listen(C){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(fT,m),c=C,()=>{i.removeEventListener(fT,m),c=null}},createHref(C){return t(i,C)},createURL:b,encodeLocation(C){let k=b(C);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:y,replace:v,go(C){return l.go(C)}};return j}function s$(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),_t(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:xd(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function C5(e,t,n="/"){return u$(e,t,n,!1)}function u$(e,t,n,r){let i=typeof t=="string"?Au(t):t,a=qa(i.pathname||"/",n);if(a==null)return null;let l=k5(e);c$(l);let u=null;for(let c=0;u==null&&c{let h={relativePath:d===void 0?l.path||"":d,caseSensitive:l.caseSensitive===!0,childrenIndex:u,route:l};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(r)&&c)return;_t(h.relativePath.startsWith(r),`Absolute route path "${h.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(r.length)}let m=Ua([r,h.relativePath]),y=n.concat(h);l.children&&l.children.length>0&&(_t(l.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),k5(l.children,t,y,m,c)),!(l.path==null&&!l.index)&&t.push({path:m,score:y$(m,l.index),routesMeta:y})};return e.forEach((l,u)=>{if(l.path===""||!l.path?.includes("?"))a(l,u);else for(let c of A5(l.path))a(l,u,!0,c)}),t}function A5(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return i?[a,""]:[a];let l=A5(r.join("/")),u=[];return u.push(...l.map(c=>c===""?a:[a,c].join("/"))),i&&u.push(...l),u.map(c=>e.startsWith("/")&&c===""?"/":c)}function c$(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:v$(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var d$=/^:[\w-]+$/,f$=3,h$=2,p$=1,m$=10,g$=-2,pT=e=>e==="*";function y$(e,t){let n=e.split("/"),r=n.length;return n.some(pT)&&(r+=g$),t&&(r+=h$),n.filter(i=>!pT(i)).reduce((i,a)=>i+(d$.test(a)?f$:a===""?p$:m$),r)}function v$(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 x$(e,t,n=!1){let{routesMeta:r}=e,i={},a="/",l=[];for(let u=0;u{if(h==="*"){let b=u[y]||"";l=a.slice(0,a.length-b.length).replace(/(.)\/+$/,"$1")}const v=u[y];return m&&!v?d[h]=void 0:d[h]=(v||"").replace(/%2F/g,"/"),d},{}),pathname:a,pathnameBase:l,pattern:e}}function b$(e,t=!1,n=!0){$r(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,(l,u,c)=>(r.push({paramName:u,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function w$(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return $r(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function qa(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)||"/"}var S$=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,j$=e=>S$.test(e);function C$(e,t="/"){let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?Au(e):e,a;if(n)if(j$(n))a=n;else{if(n.includes("//")){let l=n;n=n.replace(/\/\/+/g,"/"),$r(!1,`Pathnames cannot have embedded double slashes - normalizing ${l} -> ${n}`)}n.startsWith("/")?a=mT(n.substring(1),"/"):a=mT(n,t)}else a=t;return{pathname:a,search:E$(r),hash:T$(i)}}function mT(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 D0(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 k$(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function cS(e){let t=k$(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function dS(e,t,n,r=!1){let i;typeof e=="string"?i=Au(e):(i={...e},_t(!i.pathname||!i.pathname.includes("?"),D0("?","pathname","search",i)),_t(!i.pathname||!i.pathname.includes("#"),D0("#","pathname","hash",i)),_t(!i.search||!i.search.includes("#"),D0("#","search","hash",i)));let a=e===""||i.pathname==="",l=a?"/":i.pathname,u;if(l==null)u=n;else{let m=t.length-1;if(!r&&l.startsWith("..")){let y=l.split("/");for(;y[0]==="..";)y.shift(),m-=1;i.pathname=y.join("/")}u=m>=0?t[m]:"/"}let c=C$(i,u),d=l&&l!=="/"&&l.endsWith("/"),h=(a||l===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(d||h)&&(c.pathname+="/"),c}var Ua=e=>e.join("/").replace(/\/\/+/g,"/"),A$=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),E$=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,T$=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function O$(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var E5=["POST","PUT","PATCH","DELETE"];new Set(E5);var R$=["GET",...E5];new Set(R$);var Eu=w.createContext(null);Eu.displayName="DataRouter";var lg=w.createContext(null);lg.displayName="DataRouterState";w.createContext(!1);var T5=w.createContext({isTransitioning:!1});T5.displayName="ViewTransition";var D$=w.createContext(new Map);D$.displayName="Fetchers";var _$=w.createContext(null);_$.displayName="Await";var Hi=w.createContext(null);Hi.displayName="Navigation";var Yd=w.createContext(null);Yd.displayName="Location";var qi=w.createContext({outlet:null,matches:[],isDataRoute:!1});qi.displayName="Route";var fS=w.createContext(null);fS.displayName="RouteError";function M$(e,{relative:t}={}){_t(Tu(),"useHref() may be used only in the context of a component.");let{basename:n,navigator:r}=w.useContext(Hi),{hash:i,pathname:a,search:l}=Xd(e,{relative:t}),u=a;return n!=="/"&&(u=a==="/"?n:Ua([n,a])),r.createHref({pathname:u,search:l,hash:i})}function Tu(){return w.useContext(Yd)!=null}function qr(){return _t(Tu(),"useLocation() may be used only in the context of a component."),w.useContext(Yd).location}var O5="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function R5(e){w.useContext(Hi).static||w.useLayoutEffect(e)}function Ln(){let{isDataRoute:e}=w.useContext(qi);return e?W$():P$()}function P$(){_t(Tu(),"useNavigate() may be used only in the context of a component.");let e=w.useContext(Eu),{basename:t,navigator:n}=w.useContext(Hi),{matches:r}=w.useContext(qi),{pathname:i}=qr(),a=JSON.stringify(cS(r)),l=w.useRef(!1);return R5(()=>{l.current=!0}),w.useCallback((c,d={})=>{if($r(l.current,O5),!l.current)return;if(typeof c=="number"){n.go(c);return}let h=dS(c,JSON.parse(a),i,d.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:Ua([t,h.pathname])),(d.replace?n.replace:n.push)(h,d.state,d)},[t,n,a,i,e])}w.createContext(null);function io(){let{matches:e}=w.useContext(qi),t=e[e.length-1];return t?t.params:{}}function Xd(e,{relative:t}={}){let{matches:n}=w.useContext(qi),{pathname:r}=qr(),i=JSON.stringify(cS(n));return w.useMemo(()=>dS(e,JSON.parse(i),r,t==="path"),[e,i,r,t])}function N$(e,t){return D5(e,t)}function D5(e,t,n,r,i){_t(Tu(),"useRoutes() may be used only in the context of a component.");let{navigator:a}=w.useContext(Hi),{matches:l}=w.useContext(qi),u=l[l.length-1],c=u?u.params:{},d=u?u.pathname:"/",h=u?u.pathnameBase:"/",m=u&&u.route;{let E=m&&m.path||"";_5(d,!m||E.endsWith("*")||E.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${d}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. -Please change the parent to .`)}let y=$r(),v;if(t){let E=typeof t=="string"?ku(t):t;Et(h==="/"||E.pathname?.startsWith(h),`When overriding the location using \`\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${h}" but pathname "${E.pathname}" was given in the \`location\` prop.`),v=E}else v=y;let b=v.pathname||"/",j=b;if(h!=="/"){let E=h.replace(/^\//,"").split("/");j="/"+b.replace(/^\//,"").split("/").slice(E.length).join("/")}let C=C5(e,{pathname:j});Ir(m||C!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),Ir(C==null||C[C.length-1].route.element!==void 0||C[C.length-1].route.Component!==void 0||C[C.length-1].route.lazy!==void 0,`Matched leaf route at location "${v.pathname}${v.search}${v.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`);let k=F$(C&&C.map(E=>Object.assign({},E,{params:Object.assign({},c,E.params),pathname:La([h,a.encodeLocation?a.encodeLocation(E.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathname]),pathnameBase:E.pathnameBase==="/"?h:La([h,a.encodeLocation?a.encodeLocation(E.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathnameBase])})),l,n,r,i);return t&&k?w.createElement(Yd.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...v},navigationType:"POP"}},k):k}function z$(){let e=q$(),t=O$(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:r},a={padding:"2px 4px",backgroundColor:r},l=null;return console.error("Error handled by React Router default ErrorBoundary:",e),l=w.createElement(w.Fragment,null,w.createElement("p",null,"💿 Hey developer 👋"),w.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",w.createElement("code",{style:a},"ErrorBoundary")," or"," ",w.createElement("code",{style:a},"errorElement")," prop on your route.")),w.createElement(w.Fragment,null,w.createElement("h2",null,"Unexpected Application Error!"),w.createElement("h3",{style:{fontStyle:"italic"}},t),n?w.createElement("pre",{style:i},n):null,l)}var I$=w.createElement(z$,null),L$=class extends w.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){return this.state.error!==void 0?w.createElement(Li.Provider,{value:this.props.routeContext},w.createElement(fS.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function B$({routeContext:e,match:t,children:n}){let r=w.useContext(Au);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),w.createElement(Li.Provider,{value:e},n)}function F$(e,t=[],n=null,r=null,i=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,l=n?.errors;if(l!=null){let h=a.findIndex(m=>m.route.id&&l?.[m.route.id]!==void 0);Et(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),a=a.slice(0,Math.min(a.length,h+1))}let u=!1,c=-1;if(n)for(let h=0;h=0?a=a.slice(0,c+1):a=[a[0]];break}}}let d=n&&r?(h,m)=>{r(h,{location:n.location,params:n.matches?.[0]?.params??{},errorInfo:m})}:void 0;return a.reduceRight((h,m,y)=>{let v,b=!1,j=null,C=null;n&&(v=l&&m.route.id?l[m.route.id]:void 0,j=m.route.errorElement||I$,u&&(c<0&&y===0?(_5("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),b=!0,C=null):c===y&&(b=!0,C=m.route.hydrateFallbackElement||null)));let k=t.concat(a.slice(0,y+1)),E=()=>{let A;return v?A=j:b?A=C:m.route.Component?A=w.createElement(m.route.Component,null):m.route.element?A=m.route.element:A=h,w.createElement(B$,{match:m,routeContext:{outlet:h,matches:k,isDataRoute:n!=null},children:A})};return n&&(m.route.ErrorBoundary||m.route.errorElement||y===0)?w.createElement(L$,{location:n.location,revalidation:n.revalidation,component:j,error:v,children:E(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:d}):E()},null)}function hS(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function $$(e){let t=w.useContext(Au);return Et(t,hS(e)),t}function U$(e){let t=w.useContext(lg);return Et(t,hS(e)),t}function V$(e){let t=w.useContext(Li);return Et(t,hS(e)),t}function pS(e){let t=V$(e),n=t.matches[t.matches.length-1];return Et(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function H$(){return pS("useRouteId")}function q$(){let e=w.useContext(fS),t=U$("useRouteError"),n=pS("useRouteError");return e!==void 0?e:t.errors?.[n]}function W$(){let{router:e}=$$("useNavigate"),t=pS("useNavigate"),n=w.useRef(!1);return R5(()=>{n.current=!0}),w.useCallback(async(i,a={})=>{Ir(n.current,O5),n.current&&(typeof i=="number"?e.navigate(i):await e.navigate(i,{fromRouteId:t,...a}))},[e,t])}var gT={};function _5(e,t,n){!t&&!gT[e]&&(gT[e]=!0,Ir(!1,n))}w.memo(G$);function G$({routes:e,future:t,state:n,unstable_onError:r}){return D5(e,void 0,n,r,t)}function K$({to:e,replace:t,state:n,relative:r}){Et(Eu()," may be used only in the context of a component.");let{static:i}=w.useContext(Ii);Ir(!i," must not be used on the initial render in a . This is a no-op, but you should modify your code so the is only ever rendered in response to some user interaction or state change.");let{matches:a}=w.useContext(Li),{pathname:l}=$r(),u=_n(),c=dS(e,cS(a),l,r==="path"),d=JSON.stringify(c);return w.useEffect(()=>{u(JSON.parse(d),{replace:t,state:n,relative:r})},[u,d,r,t,n]),null}function Jt(e){Et(!1,"A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .")}function Y$({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:i,static:a=!1}){Et(!Eu(),"You cannot render a inside another . You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),u=w.useMemo(()=>({basename:l,navigator:i,static:a,future:{}}),[l,i,a]);typeof n=="string"&&(n=ku(n));let{pathname:c="/",search:d="",hash:h="",state:m=null,key:y="default"}=n,v=w.useMemo(()=>{let b=Ua(c,l);return b==null?null:{location:{pathname:b,search:d,hash:h,state:m,key:y},navigationType:r}},[l,c,d,h,m,y,r]);return Ir(v!=null,` is not able to match the URL "${c}${d}${h}" because it does not start with the basename, so the won't render anything.`),v==null?null:w.createElement(Ii.Provider,{value:u},w.createElement(Yd.Provider,{children:t,value:v}))}function X$({children:e,location:t}){return N$(o1(e),t)}function o1(e,t=[]){let n=[];return w.Children.forEach(e,(r,i)=>{if(!w.isValidElement(r))return;let a=[...t,i];if(r.type===w.Fragment){n.push.apply(n,o1(r.props.children,a));return}Et(r.type===Jt,`[${typeof r.type=="string"?r.type:r.type.name}] is not a component. All component children of must be a or `),Et(!r.props.index||!r.props.children,"An index route cannot have child routes.");let l={id:r.props.id||a.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(l.children=o1(r.props.children,a)),n.push(l)}),n}var Op="get",Rp="application/x-www-form-urlencoded";function sg(e){return e!=null&&typeof e.tagName=="string"}function Z$(e){return sg(e)&&e.tagName.toLowerCase()==="button"}function Q$(e){return sg(e)&&e.tagName.toLowerCase()==="form"}function J$(e){return sg(e)&&e.tagName.toLowerCase()==="input"}function eU(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function tU(e,t){return e.button===0&&(!t||t==="_self")&&!eU(e)}function l1(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function nU(e,t){let n=l1(e);return t&&t.forEach((r,i)=>{n.has(i)||t.getAll(i).forEach(a=>{n.append(i,a)})}),n}var Kh=null;function rU(){if(Kh===null)try{new FormData(document.createElement("form"),0),Kh=!1}catch{Kh=!0}return Kh}var iU=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function _0(e){return e!=null&&!iU.has(e)?(Ir(!1,`"${e}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${Rp}"`),null):e}function aU(e,t){let n,r,i,a,l;if(Q$(e)){let u=e.getAttribute("action");r=u?Ua(u,t):null,n=e.getAttribute("method")||Op,i=_0(e.getAttribute("enctype"))||Rp,a=new FormData(e)}else if(Z$(e)||J$(e)&&(e.type==="submit"||e.type==="image")){let u=e.form;if(u==null)throw new Error('Cannot submit a + + + + +

+ Collection: {activeCollection.name} | Mode: owner-write-only +

+ + + +
+ + +

+ `userId` means the field in each document that stores the logged-in user's id. + Example: `posts.userId` or `orders.ownerId`. For the users collection, `_id` is usually the correct owner field. +

+

+ When RLS is enabled, publishable-key writes also require `Authorization: Bearer <user_jwt>`. +

+
+ +
+ + +
+ + + )} + ); -} \ No newline at end of file +} diff --git a/docs/api-reference.md b/docs/api-reference.md index 62321efe9..14e2d43c7 100644 --- a/docs/api-reference.md +++ b/docs/api-reference.md @@ -9,6 +9,7 @@ | **Data** | `GET` | `/api/data/:collectionName/:id` | Get document by ID | | **Data** | `POST` | `/api/data/:collectionName` | Insert new document | | **Data** | `PUT` | `/api/data/:collectionName/:id` | Update document by ID | +| **Data** | `PATCH` | `/api/data/:collectionName/:id` | Partially update document by ID | | **Data** | `DELETE` | `/api/data/:collectionName/:id` | Delete document by ID | | **Storage** | `POST` | `/api/storage/upload` | Upload a file | | **Storage** | `DELETE` | `/api/storage/file` | Delete a file by path | @@ -19,6 +20,6 @@ - `201 Created`: Document/User/File created successfully. - `400 Bad Request`: Validation failure or malformed JSON. - `401 Unauthorized`: Missing/Invalid API Key or expired JWT. -- `403 Forbidden`: Resource limit (Quota) exceeded. +- `403 Forbidden`: Resource limit (Quota) exceeded or blocked by RLS policy. - `404 Not Found`: Collection, document, or file does not exist. - `500 Server Error`: Unexpected problem on our end. diff --git a/docs/database.md b/docs/database.md index be89702cd..309b98f4d 100644 --- a/docs/database.md +++ b/docs/database.md @@ -13,6 +13,15 @@ Replace `:collectionName` with the name of your collection (e.g., `posts`, `comm **Endpoint**: `POST /api/data/:collectionName` +By default, write operations require your **secret key**. + +If you enable **RLS (owner-write-only)** for a collection from the dashboard, publishable-key writes are also allowed but must include a valid user token: + +- `x-api-key: pk_live_...` +- `Authorization: Bearer ` + +Under RLS, writes are permitted only for documents owned by the authenticated user (based on configured `ownerField`). + ```javascript await fetch('https://api.ub.bitbros.in/api/data/posts', { method: 'POST', @@ -51,6 +60,9 @@ await fetch(`https://api.ub.bitbros.in/api/data/posts/${postId}`, { }); ``` +### Partial Update +**Endpoint**: `PATCH /api/data/:collectionName/:id` + ## 4. Delete a Document **Endpoint**: `DELETE /api/data/:collectionName/:id` diff --git a/docs/getting-started.md b/docs/getting-started.md index c05aa7107..46f2e8e3c 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -8,7 +8,7 @@ urBackend is built for speed and developer freedom. Whether you're using our man Head over to the [urBackend Dashboard](https://urbackend.bitbros.in) and create a new project. You'll instantly receive two keys: -- **Publishable Key (`pk_live_...`)**: Used for frontend requests (Read-Only). +- **Publishable Key (`pk_live_...`)**: Used for frontend-safe requests (Read by default; writes only when collection RLS is enabled and user Bearer token is provided). - **Secret Key (`sk_live_...`)**: Used for server-side or administrative actions (Full Access). ## 2. Your First Request @@ -19,7 +19,9 @@ To get started, navigate to the **Database** tab in your dashboard and click **" > **💡 Pro Tip**: You can define a detailed schema during creation, or simply create the collection and start POSTing arbitrary JSON right away—urBackend will handle the rest. -> **⚠️ Note**: Write operations (POST, PUT, DELETE) require your **Secret Key** and should only be performed from a secure backend environment, never from client-side code. +> **⚠️ Note**: Write operations (POST, PUT, PATCH, DELETE) require your **Secret Key** by default and should be performed from a secure backend environment. +> +> If you enable collection-level **RLS** in the dashboard, publishable-key writes are allowed with `Authorization: Bearer `, but only for the authenticated owner. ### Example: Storing a Product diff --git a/docs/rls-implementation-roadmap.md b/docs/rls-implementation-roadmap.md new file mode 100644 index 000000000..f12b94a21 --- /dev/null +++ b/docs/rls-implementation-roadmap.md @@ -0,0 +1,291 @@ +# RLS Implementation Roadmap (V1 -> Best Version) + +This roadmap explains how to implement Supabase-style Row Level Security (RLS) for `urBackend` in progressive versions. + +Goal: +- Allow **publishable key** to perform `POST/PUT/PATCH/DELETE` only when RLS policy permits. +- Keep **secret key** behavior unchanged (full admin bypass). +- Start simple, safe, low-latency in V1, then evolve to advanced policy engine. + +--- + +## 0) Current State (Baseline) + +Today in `public-api`: +- Read routes (`GET`) work with publishable key. +- Write routes (`POST/PUT/DELETE`) require secret key via `requireSecretKey`. +- No per-row policy evaluation on user identity. + +Implication: +- Public client apps cannot securely do user-scoped writes with publishable key. + +--- + +## 1) V1 (Recommended First Release) + +### 1.1 What V1 Will Support + +For each collection, enable an RLS mode: +- `owner-write-only` policy: + - Publishable key writes are allowed only if authenticated end-user is writing their own document. + - Ownership is checked by a configured field (e.g. `userId`, `ownerId`, `_id` for users collection). + +Write ops covered in V1: +- `POST` +- `PUT` +- `PATCH` +- `DELETE` + +Read behavior in V1: +- Keep existing behavior unchanged initially (to reduce risk). + +### 1.2 Data Model Changes + +Add RLS config to `Project` -> collection level. + +Suggested shape: +```js +collection.rls = { + enabled: Boolean, + mode: "owner-write-only", + ownerField: "userId", + requireAuthForWrite: true +} +``` + +Defaults: +- `enabled: false` for existing projects. +- No behavior change unless explicitly enabled. + +### 1.3 Request Context Changes (public-api) + +Add middleware to resolve end-user auth context for publishable key writes: +- Read `Authorization: Bearer `. +- Verify token using `project.jwtSecret`. +- Set `req.authUser = { userId, ...claims }`. + +Failure behavior: +- If collection RLS write requires auth and token missing/invalid -> `401`. + +### 1.4 Route Guard Changes + +In `apps/public-api/src/routes/data.js`: +- Replace hard `requireSecretKey` on write routes with new `authorizeWriteOperation`. + +`authorizeWriteOperation` logic: +- If key is secret -> allow. +- If key is publishable: + - Ensure collection exists. + - Ensure collection RLS enabled. + - Ensure user token valid. + - Evaluate owner policy for operation. + +### 1.5 Policy Evaluation Rules (V1) + +For `POST`: +- Incoming payload must set `ownerField` equal to `req.authUser.userId`. +- Optionally auto-inject ownerField server-side if missing. + +For `PUT/PATCH/DELETE`: +- Load target doc by id. +- Compare `doc[ownerField]` with `req.authUser.userId`. +- Permit only on match. + +### 1.6 Dashboard UI (V1) + +In web dashboard: +- Add collection-level RLS section: + - Enable/disable RLS toggle. + - Mode selector (only `owner-write-only` in V1). + - Owner field selector (from schema fields). + - Save config. + +UX defaults: +- If user enables RLS but ownerField invalid -> block save with clear error. + +### 1.7 Security Guarantees (V1) + +With publishable key: +- No write without valid user JWT. +- No cross-user writes if owner check fails. + +With secret key: +- Existing admin behavior preserved. + +### 1.8 Performance Impact (V1) + +Expected overhead: +- JWT verify: small (few ms typically). +- For update/delete: one document fetch for owner check. + +Mitigation: +- Keep logic in middleware + targeted DB fetch only for write ops. +- No extra overhead on read routes in V1. + +--- + +## 2) V1.1 Hardening + +After V1 stable: +- Add PATCH route support if not already present everywhere. +- Prevent owner field tampering on update: + - Ignore or reject attempts to change ownerField. +- Add explicit structured error codes: + - `RLS_NOT_ENABLED` + - `RLS_AUTH_REQUIRED` + - `RLS_OWNER_MISMATCH` + - `RLS_OWNER_FIELD_MISSING` +- Add audit logs for denied operations. + +--- + +## 3) V2 (Operation-wise Policies) + +Introduce per-operation allow rules: +```js +rls: { + enabled: true, + write: { + insert: { mode: "owner" }, + update: { mode: "owner" }, + delete: { mode: "owner" } + } +} +``` + +Benefits: +- Allow insert but block delete, etc. +- Better product control without full policy language complexity. + +--- + +## 4) V3 (Role-Based Rules) + +Add role-aware policy checks using JWT claims: +- Example: `admin`, `manager`, `user`. +- Rule examples: + - `admin` can update any doc. + - `user` only own docs. + +Policy shape can support: +```js +allowRoles: ["admin"] +fallbackMode: "owner" +``` + +--- + +## 5) V4 (Field-Level Controls) + +Support column-level restrictions: +- Publishable writes cannot modify protected fields (`role`, `plan`, `isAdmin`, etc). +- Allowlist/denylist by operation. + +Example: +```js +update: { + mode: "owner", + denyFields: ["role", "billingTier"] +} +``` + +--- + +## 6) V5 (Advanced Policy Engine / “Best Version”) + +Supabase-like expressive policy model: +- Separate policies for `select/insert/update/delete`. +- Boolean expressions on: + - `auth` claims + - `doc` fields + - request payload + - optional org/team context + +Examples: +- `auth.userId == doc.ownerId` +- `auth.orgId == doc.orgId && auth.role in ["admin","editor"]` +- `request.data.status != "archived"` + +Implementation approach: +- Build safe expression evaluator (no raw `eval`). +- Precompile policy AST and cache per collection. + +--- + +## 7) Migration Strategy + +### Existing projects +- All existing collections default to `rls.enabled = false`. +- No breaking behavior after deploy. + +### Opt-in rollout +- Users explicitly enable RLS per collection. +- Show warning banner before enable: + - “Publishable key writes will require user auth token.” + +### Backward compatibility +- Secret key flows unchanged in all versions. + +--- + +## 8) Testing Strategy + +### Unit tests +- Middleware token parsing/validation. +- Policy evaluator outcomes for all branches. + +### Integration tests +- Publishable + no token -> denied write. +- Publishable + wrong owner token -> denied write. +- Publishable + correct owner token -> allowed. +- Secret key write -> allowed. + +### Regression checks +- Existing dashboard admin flows unaffected. +- Read endpoints unaffected in V1. + +--- + +## 9) Observability & Ops + +Add metrics counters: +- `rls_allowed_total` +- `rls_denied_total` +- denied reason tags (`owner_mismatch`, `token_missing`, etc.) + +Add request logs for denied writes with: +- project id +- collection +- operation +- denial reason + +--- + +## 10) Recommended Execution Order + +1. V1 backend model + middleware + route guard + controller checks. +2. V1 dashboard toggle/settings UI. +3. Tests + staged rollout on a few projects. +4. V1.1 hardening. +5. V2/V3/V4 in small increments. +6. V5 advanced policy engine when product demand is clear. + +--- + +## 11) Non-Goals for V1 + +To keep V1 low-risk: +- No complex expression parser. +- No read-side row filtering yet. +- No multi-policy conflict resolution engine. + +--- + +## 12) Success Criteria + +V1 is successful when: +- Publishable key can do write ops securely for authenticated owner only. +- Secret key behavior remains fully compatible. +- P95 latency impact stays low and predictable. +- Dashboard UX clearly communicates why a write is denied. + diff --git a/packages/common/src/models/Project.js b/packages/common/src/models/Project.js index 4afd7a2c7..58ea46605 100644 --- a/packages/common/src/models/Project.js +++ b/packages/common/src/models/Project.js @@ -25,7 +25,17 @@ fieldSchema.add({ fields: [fieldSchema] }); const collectionSchema = new mongoose.Schema({ name: { type: String, required: true }, - model: [fieldSchema] + model: [fieldSchema], + rls: { + enabled: { type: Boolean, default: false }, + mode: { + type: String, + enum: ['owner-write-only'], + default: 'owner-write-only' + }, + ownerField: { type: String, default: 'userId' }, + requireAuthForWrite: { type: Boolean, default: true } + } }); const projectSchema = new mongoose.Schema({ @@ -81,4 +91,4 @@ const projectSchema = new mongoose.Schema({ projectSchema.index({ owner: 1 }); -module.exports = mongoose.model('Project', projectSchema); \ No newline at end of file +module.exports = mongoose.model('Project', projectSchema); From c7723f48bb5930c9830528e8096b2c860c30d985 Mon Sep 17 00:00:00 2001 From: yash-pouranik Date: Sat, 28 Mar 2026 02:33:12 +0530 Subject: [PATCH 2/5] fixed user auth bug --- .../src/controllers/userAuth.controller.js | 74 ++++++++++++++----- .../src/controllers/userAuth.controller.js | 74 ++++++++++++++----- 2 files changed, 112 insertions(+), 36 deletions(-) diff --git a/apps/dashboard-api/src/controllers/userAuth.controller.js b/apps/dashboard-api/src/controllers/userAuth.controller.js index 07677cb2b..e4d28ea7b 100644 --- a/apps/dashboard-api/src/controllers/userAuth.controller.js +++ b/apps/dashboard-api/src/controllers/userAuth.controller.js @@ -9,6 +9,47 @@ const { loginSchema, signupSchema, userSignupSchema, resetPasswordSchema, onlyEm const { getConnection } = require('@urbackend/common'); const { getCompiledModel } = require('@urbackend/common'); +const hasRequiredField = (usersColConfig, fieldKey) => { + const model = usersColConfig?.model || []; + return model.some((f) => f?.key === fieldKey && !!f?.required); +}; + +const getVerificationField = (usersColConfig) => { + const modelKeys = (usersColConfig?.model || []).map((f) => f?.key); + if (modelKeys.includes('emailVerified')) return 'emailVerified'; + if (modelKeys.includes('isVerified')) return 'isVerified'; + if (modelKeys.includes('isverified')) return 'isverified'; + return 'emailVerified'; +}; + +const buildAuthUserPayload = (usersColConfig, parsedData, hashedPassword, verifiedValue) => { + const { email, password: _password, username, ...otherData } = parsedData; + + const payload = { + email, + password: hashedPassword, + ...otherData, + createdAt: new Date() + }; + + if (username !== undefined) { + payload.username = username; + } + + const verificationField = getVerificationField(usersColConfig); + payload[verificationField] = verifiedValue; + + if (hasRequiredField(usersColConfig, 'name') && (payload.name === undefined || payload.name === null || payload.name === '')) { + payload.name = username || email.split('@')[0]; + } + + if (hasRequiredField(usersColConfig, 'username') && (payload.username === undefined || payload.username === null || payload.username === '')) { + payload.username = payload.name || email.split('@')[0]; + } + + return payload; +}; + // POST REQ FOR SIGNUP module.exports.signup = async (req, res) => { @@ -34,14 +75,12 @@ module.exports.signup = async (req, res) => { const otp = Math.floor(100000 + Math.random() * 900000).toString(); - const newUserPayload = { - username, - email, - password: hashedPassword, - emailVerified: false, - ...otherData, - createdAt: new Date() - }; + const newUserPayload = buildAuthUserPayload( + usersColConfig, + { email, password, username, ...otherData }, + hashedPassword, + false + ); // Model.create handles validation and default values const result = await Model.create(newUserPayload); @@ -167,14 +206,12 @@ module.exports.createAdminUser = async (req, res) => { const salt = await bcrypt.genSalt(10); const hashedPassword = await bcrypt.hash(password, salt); - const newUserPayload = { - username, - email, - password: hashedPassword, - emailVerified: true, - ...otherData, - createdAt: new Date() - }; + const newUserPayload = buildAuthUserPayload( + usersColConfig, + { email, password, username, ...otherData }, + hashedPassword, + true + ); const result = await Model.create(newUserPayload); @@ -248,9 +285,10 @@ module.exports.verifyEmail = async (req, res) => { const connection = await getConnection(project._id); const Model = getCompiledModel(connection, usersColConfig, project._id, project.resources.db.isExternal); + const verificationField = getVerificationField(usersColConfig); const result = await Model.updateOne( { email }, - { $set: { emailVerified: true } } + { $set: { [verificationField]: true } } ); if (result.matchedCount === 0) return res.status(404).json({ error: "User not found" }); @@ -465,4 +503,4 @@ module.exports.updateAdminUser = async (req, res) => { } catch (err) { res.status(500).json({ error: err.message }); } -}; \ No newline at end of file +}; diff --git a/apps/public-api/src/controllers/userAuth.controller.js b/apps/public-api/src/controllers/userAuth.controller.js index 8dc7fd7ab..9f278c02f 100644 --- a/apps/public-api/src/controllers/userAuth.controller.js +++ b/apps/public-api/src/controllers/userAuth.controller.js @@ -9,6 +9,47 @@ const { loginSchema, userSignupSchema, resetPasswordSchema, onlyEmailSchema, ver const { getConnection } = require('@urbackend/common'); const { getCompiledModel } = require('@urbackend/common'); +const hasRequiredField = (usersColConfig, fieldKey) => { + const model = usersColConfig?.model || []; + return model.some((f) => f?.key === fieldKey && !!f?.required); +}; + +const getVerificationField = (usersColConfig) => { + const modelKeys = (usersColConfig?.model || []).map((f) => f?.key); + if (modelKeys.includes('emailVerified')) return 'emailVerified'; + if (modelKeys.includes('isVerified')) return 'isVerified'; + if (modelKeys.includes('isverified')) return 'isverified'; + return 'emailVerified'; +}; + +const buildAuthUserPayload = (usersColConfig, parsedData, hashedPassword, verifiedValue) => { + const { email, password: _password, username, ...otherData } = parsedData; + + const payload = { + email, + password: hashedPassword, + ...otherData, + createdAt: new Date() + }; + + if (username !== undefined) { + payload.username = username; + } + + const verificationField = getVerificationField(usersColConfig); + payload[verificationField] = verifiedValue; + + if (hasRequiredField(usersColConfig, 'name') && (payload.name === undefined || payload.name === null || payload.name === '')) { + payload.name = username || email.split('@')[0]; + } + + if (hasRequiredField(usersColConfig, 'username') && (payload.username === undefined || payload.username === null || payload.username === '')) { + payload.username = payload.name || email.split('@')[0]; + } + + return payload; +}; + // POST REQ FOR SIGNUP module.exports.signup = async (req, res) => { @@ -34,14 +75,12 @@ module.exports.signup = async (req, res) => { const otp = Math.floor(100000 + Math.random() * 900000).toString(); - const newUserPayload = { - username, - email, - password: hashedPassword, - emailVerified: false, - ...otherData, - createdAt: new Date() - }; + const newUserPayload = buildAuthUserPayload( + usersColConfig, + { email, password, username, ...otherData }, + hashedPassword, + false + ); // Model.create handles validation and default values const result = await Model.create(newUserPayload); @@ -167,14 +206,12 @@ module.exports.createAdminUser = async (req, res) => { const salt = await bcrypt.genSalt(10); const hashedPassword = await bcrypt.hash(password, salt); - const newUserPayload = { - username, - email, - password: hashedPassword, - emailVerified: true, - ...otherData, - createdAt: new Date() - }; + const newUserPayload = buildAuthUserPayload( + usersColConfig, + { email, password, username, ...otherData }, + hashedPassword, + true + ); const result = await Model.create(newUserPayload); @@ -248,9 +285,10 @@ module.exports.verifyEmail = async (req, res) => { const connection = await getConnection(project._id); const Model = getCompiledModel(connection, usersColConfig, project._id, project.resources.db.isExternal); + const verificationField = getVerificationField(usersColConfig); const result = await Model.updateOne( { email }, - { $set: { emailVerified: true } } + { $set: { [verificationField]: true } } ); if (result.matchedCount === 0) return res.status(404).json({ error: "User not found" }); @@ -479,4 +517,4 @@ module.exports.updateAdminUser = async (req, res) => { } catch (err) { res.status(500).json({ error: err.message }); } -}; \ No newline at end of file +}; From 487a3b040d3c6946f1c9ad5c6b0300c9319be137 Mon Sep 17 00:00:00 2001 From: yash-pouranik Date: Sat, 28 Mar 2026 02:38:11 +0530 Subject: [PATCH 3/5] updated vite build --- .../dist/assets/{index-Bu_-Dcm1.js => index-CystpbmR.js} | 2 +- apps/web-dashboard/dist/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename apps/web-dashboard/dist/assets/{index-Bu_-Dcm1.js => index-CystpbmR.js} (97%) diff --git a/apps/web-dashboard/dist/assets/index-Bu_-Dcm1.js b/apps/web-dashboard/dist/assets/index-CystpbmR.js similarity index 97% rename from apps/web-dashboard/dist/assets/index-Bu_-Dcm1.js rename to apps/web-dashboard/dist/assets/index-CystpbmR.js index a63234adf..6db7f478c 100644 --- a/apps/web-dashboard/dist/assets/index-Bu_-Dcm1.js +++ b/apps/web-dashboard/dist/assets/index-CystpbmR.js @@ -189,7 +189,7 @@ to { `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(i=>r.set(i)),r}static accessor(t){const r=(this[jT]=this[jT]={accessors:{}}).accessors,i=this.prototype;function a(l){const u=Fc(l);r[u]||(CH(i,l),r[u]=!0)}return J.isArray(t)?t.forEach(a):a(t),this}};wr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);J.reduceDescriptors(wr.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});J.freezeMethods(wr);function P0(e,t){const n=this||tf,r=t||n,i=wr.from(r.headers);let a=r.data;return J.forEach(e,function(u){a=u.call(n,a,i.normalize(),t?t.status:void 0)}),i.normalize(),a}function oN(e){return!!(e&&e.__CANCEL__)}function Ru(e,t,n){Ue.call(this,e??"canceled",Ue.ERR_CANCELED,t,n),this.name="CanceledError"}J.inherits(Ru,Ue,{__CANCEL__:!0});function lN(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Ue("Request failed with status code "+n.status,[Ue.ERR_BAD_REQUEST,Ue.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function kH(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function AH(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i=0,a=0,l;return t=t!==void 0?t:1e3,function(c){const d=Date.now(),h=r[a];l||(l=d),n[i]=c,r[i]=d;let m=a,y=0;for(;m!==i;)y+=n[m++],m=m%e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),d-l{n=h,i=null,a&&(clearTimeout(a),a=null),e(...d)};return[(...d)=>{const h=Date.now(),m=h-n;m>=r?l(d,h):(i=d,a||(a=setTimeout(()=>{a=null,l(i)},r-m)))},()=>i&&l(i)]}const Xp=(e,t,n=3)=>{let r=0;const i=AH(50,250);return EH(a=>{const l=a.loaded,u=a.lengthComputable?a.total:void 0,c=l-r,d=i(c),h=l<=u;r=l;const m={loaded:l,total:u,progress:u?l/u:void 0,bytes:c,rate:d||void 0,estimated:d&&u&&h?(u-l)/d:void 0,event:a,lengthComputable:u!=null,[t?"download":"upload"]:!0};e(m)},n)},CT=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},kT=e=>(...t)=>J.asap(()=>e(...t)),TH=Hn.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Hn.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Hn.origin),Hn.navigator&&/(msie|trident)/i.test(Hn.navigator.userAgent)):()=>!0,OH=Hn.hasStandardBrowserEnv?{write(e,t,n,r,i,a,l){if(typeof document>"u")return;const u=[`${e}=${encodeURIComponent(t)}`];J.isNumber(n)&&u.push(`expires=${new Date(n).toUTCString()}`),J.isString(r)&&u.push(`path=${r}`),J.isString(i)&&u.push(`domain=${i}`),a===!0&&u.push("secure"),J.isString(l)&&u.push(`SameSite=${l}`),document.cookie=u.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function RH(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function DH(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function sN(e,t,n){let r=!RH(t);return e&&(r||n==!1)?DH(e,t):t}const AT=e=>e instanceof wr?{...e}:e;function Hl(e,t){t=t||{};const n={};function r(d,h,m,y){return J.isPlainObject(d)&&J.isPlainObject(h)?J.merge.call({caseless:y},d,h):J.isPlainObject(h)?J.merge({},h):J.isArray(h)?h.slice():h}function i(d,h,m,y){if(J.isUndefined(h)){if(!J.isUndefined(d))return r(void 0,d,m,y)}else return r(d,h,m,y)}function a(d,h){if(!J.isUndefined(h))return r(void 0,h)}function l(d,h){if(J.isUndefined(h)){if(!J.isUndefined(d))return r(void 0,d)}else return r(void 0,h)}function u(d,h,m){if(m in t)return r(d,h);if(m in e)return r(void 0,d)}const c={url:a,method:a,data:a,baseURL:l,transformRequest:l,transformResponse:l,paramsSerializer:l,timeout:l,timeoutMessage:l,withCredentials:l,withXSRFToken:l,adapter:l,responseType:l,xsrfCookieName:l,xsrfHeaderName:l,onUploadProgress:l,onDownloadProgress:l,decompress:l,maxContentLength:l,maxBodyLength:l,beforeRedirect:l,transport:l,httpAgent:l,httpsAgent:l,cancelToken:l,socketPath:l,responseEncoding:l,validateStatus:u,headers:(d,h,m)=>i(AT(d),AT(h),m,!0)};return J.forEach(Object.keys({...e,...t}),function(h){const m=c[h]||i,y=m(e[h],t[h],h);J.isUndefined(y)&&m!==u||(n[h]=y)}),n}const uN=e=>{const t=Hl({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:a,headers:l,auth:u}=t;if(t.headers=l=wr.from(l),t.url=rN(sN(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),u&&l.set("Authorization","Basic "+btoa((u.username||"")+":"+(u.password?unescape(encodeURIComponent(u.password)):""))),J.isFormData(n)){if(Hn.hasStandardBrowserEnv||Hn.hasStandardBrowserWebWorkerEnv)l.setContentType(void 0);else if(J.isFunction(n.getHeaders)){const c=n.getHeaders(),d=["content-type","content-length"];Object.entries(c).forEach(([h,m])=>{d.includes(h.toLowerCase())&&l.set(h,m)})}}if(Hn.hasStandardBrowserEnv&&(r&&J.isFunction(r)&&(r=r(t)),r||r!==!1&&TH(t.url))){const c=i&&a&&OH.read(a);c&&l.set(i,c)}return t},_H=typeof XMLHttpRequest<"u",MH=_H&&function(e){return new Promise(function(n,r){const i=uN(e);let a=i.data;const l=wr.from(i.headers).normalize();let{responseType:u,onUploadProgress:c,onDownloadProgress:d}=i,h,m,y,v,b;function j(){v&&v(),b&&b(),i.cancelToken&&i.cancelToken.unsubscribe(h),i.signal&&i.signal.removeEventListener("abort",h)}let C=new XMLHttpRequest;C.open(i.method.toUpperCase(),i.url,!0),C.timeout=i.timeout;function k(){if(!C)return;const A=wr.from("getAllResponseHeaders"in C&&C.getAllResponseHeaders()),D={data:!u||u==="text"||u==="json"?C.responseText:C.response,status:C.status,statusText:C.statusText,headers:A,config:e,request:C};lN(function(M){n(M),j()},function(M){r(M),j()},D),C=null}"onloadend"in C?C.onloadend=k:C.onreadystatechange=function(){!C||C.readyState!==4||C.status===0&&!(C.responseURL&&C.responseURL.indexOf("file:")===0)||setTimeout(k)},C.onabort=function(){C&&(r(new Ue("Request aborted",Ue.ECONNABORTED,e,C)),C=null)},C.onerror=function(R){const D=R&&R.message?R.message:"Network Error",O=new Ue(D,Ue.ERR_NETWORK,e,C);O.event=R||null,r(O),C=null},C.ontimeout=function(){let R=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const D=i.transitional||iN;i.timeoutErrorMessage&&(R=i.timeoutErrorMessage),r(new Ue(R,D.clarifyTimeoutError?Ue.ETIMEDOUT:Ue.ECONNABORTED,e,C)),C=null},a===void 0&&l.setContentType(null),"setRequestHeader"in C&&J.forEach(l.toJSON(),function(R,D){C.setRequestHeader(D,R)}),J.isUndefined(i.withCredentials)||(C.withCredentials=!!i.withCredentials),u&&u!=="json"&&(C.responseType=i.responseType),d&&([y,b]=Xp(d,!0),C.addEventListener("progress",y)),c&&C.upload&&([m,v]=Xp(c),C.upload.addEventListener("progress",m),C.upload.addEventListener("loadend",v)),(i.cancelToken||i.signal)&&(h=A=>{C&&(r(!A||A.type?new Ru(null,e,C):A),C.abort(),C=null)},i.cancelToken&&i.cancelToken.subscribe(h),i.signal&&(i.signal.aborted?h():i.signal.addEventListener("abort",h)));const E=kH(i.url);if(E&&Hn.protocols.indexOf(E)===-1){r(new Ue("Unsupported protocol "+E+":",Ue.ERR_BAD_REQUEST,e));return}C.send(a||null)})},PH=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,i;const a=function(d){if(!i){i=!0,u();const h=d instanceof Error?d:this.reason;r.abort(h instanceof Ue?h:new Ru(h instanceof Error?h.message:h))}};let l=t&&setTimeout(()=>{l=null,a(new Ue(`timeout ${t} of ms exceeded`,Ue.ETIMEDOUT))},t);const u=()=>{e&&(l&&clearTimeout(l),l=null,e.forEach(d=>{d.unsubscribe?d.unsubscribe(a):d.removeEventListener("abort",a)}),e=null)};e.forEach(d=>d.addEventListener("abort",a));const{signal:c}=r;return c.unsubscribe=()=>J.asap(u),c}},NH=function*(e,t){let n=e.byteLength;if(n{const i=zH(e,t);let a=0,l,u=c=>{l||(l=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:d,value:h}=await i.next();if(d){u(),c.close();return}let m=h.byteLength;if(n){let y=a+=m;n(y)}c.enqueue(new Uint8Array(h))}catch(d){throw u(d),d}},cancel(c){return u(c),i.return()}},{highWaterMark:2})},TT=64*1024,{isFunction:Xh}=J,LH=(({Request:e,Response:t})=>({Request:e,Response:t}))(J.global),{ReadableStream:OT,TextEncoder:RT}=J.global,DT=(e,...t)=>{try{return!!e(...t)}catch{return!1}},BH=e=>{e=J.merge.call({skipUndefined:!0},LH,e);const{fetch:t,Request:n,Response:r}=e,i=t?Xh(t):typeof fetch=="function",a=Xh(n),l=Xh(r);if(!i)return!1;const u=i&&Xh(OT),c=i&&(typeof RT=="function"?(b=>j=>b.encode(j))(new RT):async b=>new Uint8Array(await new n(b).arrayBuffer())),d=a&&u&&DT(()=>{let b=!1;const j=new n(Hn.origin,{body:new OT,method:"POST",get duplex(){return b=!0,"half"}}).headers.has("Content-Type");return b&&!j}),h=l&&u&&DT(()=>J.isReadableStream(new r("").body)),m={stream:h&&(b=>b.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!m[b]&&(m[b]=(j,C)=>{let k=j&&j[b];if(k)return k.call(j);throw new Ue(`Response type '${b}' is not supported`,Ue.ERR_NOT_SUPPORT,C)})});const y=async b=>{if(b==null)return 0;if(J.isBlob(b))return b.size;if(J.isSpecCompliantForm(b))return(await new n(Hn.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(J.isArrayBufferView(b)||J.isArrayBuffer(b))return b.byteLength;if(J.isURLSearchParams(b)&&(b=b+""),J.isString(b))return(await c(b)).byteLength},v=async(b,j)=>{const C=J.toFiniteNumber(b.getContentLength());return C??y(j)};return async b=>{let{url:j,method:C,data:k,signal:E,cancelToken:A,timeout:R,onDownloadProgress:D,onUploadProgress:O,responseType:M,headers:I,withCredentials:$="same-origin",fetchOptions:N}=uN(b),F=t||fetch;M=M?(M+"").toLowerCase():"text";let H=PH([E,A&&A.toAbortSignal()],R),ie=null;const Z=H&&H.unsubscribe&&(()=>{H.unsubscribe()});let ne;try{if(O&&d&&C!=="get"&&C!=="head"&&(ne=await v(I,k))!==0){let L=new n(j,{method:"POST",body:k,duplex:"half"}),G;if(J.isFormData(k)&&(G=L.headers.get("content-type"))&&I.setContentType(G),L.body){const[P,he]=CT(ne,Xp(kT(O)));k=ET(L.body,TT,P,he)}}J.isString($)||($=$?"include":"omit");const U=a&&"credentials"in n.prototype,W={...N,signal:H,method:C.toUpperCase(),headers:I.normalize().toJSON(),body:k,duplex:"half",credentials:U?$:void 0};ie=a&&new n(j,W);let re=await(a?F(ie,N):F(j,W));const de=h&&(M==="stream"||M==="response");if(h&&(D||de&&Z)){const L={};["status","statusText","headers"].forEach(xe=>{L[xe]=re[xe]});const G=J.toFiniteNumber(re.headers.get("content-length")),[P,he]=D&&CT(G,Xp(kT(D),!0))||[];re=new r(ET(re.body,TT,P,()=>{he&&he(),Z&&Z()}),L)}M=M||"text";let z=await m[J.findKey(m,M)||"text"](re,b);return!de&&Z&&Z(),await new Promise((L,G)=>{lN(L,G,{data:z,headers:wr.from(re.headers),status:re.status,statusText:re.statusText,config:b,request:ie})})}catch(U){throw Z&&Z(),U&&U.name==="TypeError"&&/Load failed|fetch/i.test(U.message)?Object.assign(new Ue("Network Error",Ue.ERR_NETWORK,b,ie),{cause:U.cause||U}):Ue.from(U,U&&U.code,b,ie)}}},FH=new Map,cN=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:i}=t,a=[r,i,n];let l=a.length,u=l,c,d,h=FH;for(;u--;)c=a[u],d=h.get(c),d===void 0&&h.set(c,d=u?new Map:BH(t)),h=d;return d};cN();const wS={http:rH,xhr:MH,fetch:{get:cN}};J.forEach(wS,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const _T=e=>`- ${e}`,$H=e=>J.isFunction(e)||e===null||e===!1;function UH(e,t){e=J.isArray(e)?e:[e];const{length:n}=e;let r,i;const a={};for(let l=0;l`adapter ${c} `+(d===!1?"is not supported by the environment":"is not available in the build"));let u=n?l.length>1?`since : `+l.map(_T).join(` `):" "+_T(l[0]):"as no adapter specified";throw new Ue("There is no suitable adapter to dispatch the request "+u,"ERR_NOT_SUPPORT")}return i}const dN={getAdapter:UH,adapters:wS};function N0(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ru(null,e)}function MT(e){return N0(e),e.headers=wr.from(e.headers),e.data=P0.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),dN.getAdapter(e.adapter||tf.adapter,e)(e).then(function(r){return N0(e),r.data=P0.call(e,e.transformResponse,r),r.headers=wr.from(r.headers),r},function(r){return oN(r)||(N0(e),r&&r.response&&(r.response.data=P0.call(e,e.transformResponse,r.response),r.response.headers=wr.from(r.response.headers))),Promise.reject(r)})}const fN="1.13.2",mg={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{mg[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const PT={};mg.transitional=function(t,n,r){function i(a,l){return"[Axios v"+fN+"] Transitional option '"+a+"'"+l+(r?". "+r:"")}return(a,l,u)=>{if(t===!1)throw new Ue(i(l," has been removed"+(n?" in "+n:"")),Ue.ERR_DEPRECATED);return n&&!PT[l]&&(PT[l]=!0,console.warn(i(l," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(a,l,u):!0}};mg.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function VH(e,t,n){if(typeof e!="object")throw new Ue("options must be an object",Ue.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const a=r[i],l=t[a];if(l){const u=e[a],c=u===void 0||l(u,a,e);if(c!==!0)throw new Ue("option "+a+" must be "+c,Ue.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Ue("Unknown option "+a,Ue.ERR_BAD_OPTION)}}const Pp={assertOptions:VH,validators:mg},Ji=Pp.validators;let Ll=class{constructor(t){this.defaults=t||{},this.interceptors={request:new ST,response:new ST}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const a=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?a&&!String(r.stack).endsWith(a.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+a):r.stack=a}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Hl(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:a}=n;r!==void 0&&Pp.assertOptions(r,{silentJSONParsing:Ji.transitional(Ji.boolean),forcedJSONParsing:Ji.transitional(Ji.boolean),clarifyTimeoutError:Ji.transitional(Ji.boolean)},!1),i!=null&&(J.isFunction(i)?n.paramsSerializer={serialize:i}:Pp.assertOptions(i,{encode:Ji.function,serialize:Ji.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Pp.assertOptions(n,{baseUrl:Ji.spelling("baseURL"),withXsrfToken:Ji.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let l=a&&J.merge(a.common,a[n.method]);a&&J.forEach(["delete","get","head","post","put","patch","common"],b=>{delete a[b]}),n.headers=wr.concat(l,a);const u=[];let c=!0;this.interceptors.request.forEach(function(j){typeof j.runWhen=="function"&&j.runWhen(n)===!1||(c=c&&j.synchronous,u.unshift(j.fulfilled,j.rejected))});const d=[];this.interceptors.response.forEach(function(j){d.push(j.fulfilled,j.rejected)});let h,m=0,y;if(!c){const b=[MT.bind(this),void 0];for(b.unshift(...u),b.push(...d),y=b.length,h=Promise.resolve(n);m{if(!r._listeners)return;let a=r._listeners.length;for(;a-- >0;)r._listeners[a](i);r._listeners=null}),this.promise.then=i=>{let a;const l=new Promise(u=>{r.subscribe(u),a=u}).then(i);return l.cancel=function(){r.unsubscribe(a)},l},t(function(a,l,u){r.reason||(r.reason=new Ru(a,l,u),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new hN(function(i){t=i}),cancel:t}}};function qH(e){return function(n){return e.apply(null,n)}}function WH(e){return J.isObject(e)&&e.isAxiosError===!0}const h1={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(h1).forEach(([e,t])=>{h1[t]=e});function pN(e){const t=new Ll(e),n=q5(Ll.prototype.request,t);return J.extend(n,Ll.prototype,t,{allOwnKeys:!0}),J.extend(n,t,null,{allOwnKeys:!0}),n.create=function(i){return pN(Hl(e,i))},n}const Lt=pN(tf);Lt.Axios=Ll;Lt.CanceledError=Ru;Lt.CancelToken=HH;Lt.isCancel=oN;Lt.VERSION=fN;Lt.toFormData=pg;Lt.AxiosError=Ue;Lt.Cancel=Lt.CanceledError;Lt.all=function(t){return Promise.all(t)};Lt.spread=qH;Lt.isAxiosError=WH;Lt.mergeConfig=Hl;Lt.AxiosHeaders=wr;Lt.formToJSON=e=>aN(J.isHTMLForm(e)?new FormData(e):e);Lt.getAdapter=dN.getAdapter;Lt.HttpStatusCode=h1;Lt.default=Lt;const{Axios:Pwe,AxiosError:Nwe,CanceledError:zwe,isCancel:Iwe,CancelToken:Lwe,VERSION:Bwe,all:Fwe,Cancel:$we,isAxiosError:Uwe,spread:Vwe,toFormData:Hwe,AxiosHeaders:qwe,HttpStatusCode:Wwe,formToJSON:Gwe,getAdapter:Kwe,mergeConfig:Ywe}=Lt,mN="http://localhost:1234",id="http://localhost:1235",SS="yashpouranik124@gmail.com",Me=Lt.create({baseURL:mN,withCredentials:!0});let Ys=null;const GH=async()=>{try{return Ys=(await Lt.get(`${mN}/api/auth/csrf-token`,{withCredentials:!0})).data.csrfToken,Ys}catch(e){return console.error("Failed to fetch CSRF token:",e),null}};Me.interceptors.request.use(async e=>{const t=e.method.toLowerCase();return["post","put","delete","patch"].includes(t)&&(Ys||(Ys=await GH()),Ys&&(e.headers["X-CSRF-Token"]=Ys)),e},e=>Promise.reject(e));Me.interceptors.response.use(e=>e,async e=>{const t=e.config;if(!t)return Promise.reject(e);if(e.response?.status===401&&!t._retry){if(t.url?.includes("/api/auth/refresh-token"))return Promise.reject(e);t._retry=!0;try{return await Me.post("/api/auth/refresh-token",{}),Me(t)}catch(n){return Promise.reject(n)}}return Promise.reject(e)});const gN=w.createContext(null),KH=({children:e})=>{const[t,n]=w.useState(null),[r,i]=w.useState(!0);w.useEffect(()=>{(async()=>{try{const d=await Me.get("/api/auth/me");d.data.success&&n(d.data.user)}catch(d){console.error("Not authenticated:",d.message),n(null)}finally{i(!1)}})()},[]);const u={user:t,login:c=>{n(c)},logout:async()=>{try{await Me.post("/api/auth/logout")}catch(c){console.error("Logout failed:",c)}finally{n(null)}},isAuthenticated:!!t,isLoading:r};return p.jsx(gN.Provider,{value:u,children:e})},qt=()=>w.useContext(gN);const YH=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),XH=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),NT=e=>{const t=XH(e);return t.charAt(0).toUpperCase()+t.slice(1)},yN=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),ZH=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var QH={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"};const JH=w.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:a,iconNode:l,...u},c)=>w.createElement("svg",{ref:c,...QH,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:yN("lucide",i),...!a&&!ZH(u)&&{"aria-hidden":"true"},...u},[...l.map(([d,h])=>w.createElement(d,h)),...Array.isArray(a)?a:[a]]));const Ce=(e,t)=>{const n=w.forwardRef(({className:r,...i},a)=>w.createElement(JH,{ref:a,iconNode:t,className:yN(`lucide-${YH(NT(e))}`,`lucide-${e}`,r),...i}));return n.displayName=NT(e),n};const eq=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],ad=Ce("activity",eq);const tq=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Du=Ce("arrow-left",tq);const nq=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Go=Ce("arrow-right",nq);const rq=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],iq=Ce("arrow-up-down",rq);const aq=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],zT=Ce("book-open",aq);const oq=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],IT=Ce("box",oq);const lq=[["path",{d:"M5 21v-6",key:"1hz6c0"}],["path",{d:"M12 21V3",key:"1lcnhd"}],["path",{d:"M19 21V9",key:"unv183"}]],vN=Ce("chart-no-axes-column",lq);const sq=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],wd=Ce("check",sq);const uq=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Sd=Ce("chevron-down",uq);const cq=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],dq=Ce("chevron-left",cq);const fq=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],jd=Ce("chevron-right",fq);const hq=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],pq=Ce("chevron-up",hq);const mq=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],gg=Ce("circle-alert",mq);const gq=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Xn=Ce("circle-check-big",gq);const yq=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],xN=Ce("clock",yq);const vq=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],xq=Ce("cloud-upload",vq);const bq=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],bN=Ce("code",bq);const wq=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],cu=Ce("copy",wq);const Sq=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],LT=Ce("cpu",Sq);const jq=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Lr=Ce("database",jq);const Cq=[["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"}]],kq=Ce("external-link",Cq);const Aq=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Eq=Ce("eye",Aq);const Tq=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],Oq=Ce("file-braces",Tq);const Rq=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],wN=Ce("file-text",Rq);const Dq=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],_q=Ce("file",Dq);const Mq=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Pq=Ce("folder",Mq);const Nq=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],BT=Ce("funnel",Nq);const zq=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],Iq=Ce("github",zq);const Lq=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Zp=Ce("globe",Lq);const Bq=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Fq=Ce("grip-vertical",Bq);const $q=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],sa=Ce("hard-drive",$q);const Uq=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],Vq=Ce("house",Uq);const Hq=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],ru=Ce("key",Hq);const qq=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],p1=Ce("layers",qq);const Wq=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],m1=Ce("layout-dashboard",Wq);const Gq=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],Kq=Ce("list",Gq);const Yq=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],jS=Ce("lock",Yq);const Xq=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Zq=Ce("log-out",Xq);const Qq=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],Jq=Ce("mail",Qq);const e7=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],Cd=Ce("menu",e7);const t7=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],g1=Ce("pen",t7);const n7=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],r7=Ce("pencil",n7);const i7=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ur=Ce("plus",i7);const a7=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Qp=Ce("refresh-cw",a7);const o7=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],SN=Ce("rocket",o7);const l7=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],nf=Ce("save",l7);const s7=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],u7=Ce("search",s7);const c7=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],d7=Ce("send",c7);const f7=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],yg=Ce("server",f7);const h7=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],p7=Ce("settings-2",h7);const m7=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],CS=Ce("settings",m7);const g7=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],y7=Ce("shield-check",g7);const v7=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],Pi=Ce("shield",v7);const x7=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],FT=Ce("smartphone",x7);const b7=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],w7=Ce("table",b7);const S7=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Ko=Ce("terminal",S7);const j7=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],ao=Ce("trash-2",j7);const C7=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ga=Ce("triangle-alert",C7);const k7=[["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m14.305 16.53.923-.382",key:"1itpsq"}],["path",{d:"m15.228 13.852-.923-.383",key:"eplpkm"}],["path",{d:"m16.852 12.228-.383-.923",key:"13v3q0"}],["path",{d:"m16.852 17.772-.383.924",key:"1i8mnm"}],["path",{d:"m19.148 12.228.383-.923",key:"1q8j1v"}],["path",{d:"m19.53 18.696-.382-.924",key:"vk1qj3"}],["path",{d:"m20.772 13.852.924-.383",key:"n880s0"}],["path",{d:"m20.772 16.148.924.383",key:"1g6xey"}],["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],A7=Ce("user-cog",k7);const E7=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],$T=Ce("user-plus",E7);const T7=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],UT=Ce("user",T7);const O7=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],aa=Ce("x",O7);const R7=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],od=Ce("zap",R7);function D7(){const[e,t]=w.useState({email:"",password:""}),[n,r]=w.useState(!1),i=Ln(),{login:a,isAuthenticated:l,isLoading:u}=qt();if(w.useEffect(()=>{!u&&l&&i("/dashboard",{replace:!0})},[l,u,i]),u)return null;const c=h=>{t({...e,[h.target.name]:h.target.value})},d=async h=>{if(h.preventDefault(),!e.email||!e.password){ce.error("Email and password are required!");return}r(!0);const m=ce.loading("Logging in...");try{const y=await Me.post("/api/auth/login",e);y.data.success&&(a(y.data.user),ce.dismiss(m),ce.success("Welcome back!"),i("/dashboard"))}catch(y){console.error(y),ce.dismiss(m);const v=y.response?.data;let b="Login failed. Check your credentials.";v?.error&&(typeof v.error=="string"?b=v.error:Array.isArray(v.error)&&(b=v.error[0]?.message||"Validation failed")),ce.error(b),r(!1)}};return p.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100vh",padding:"1rem",background:"radial-gradient(circle at top center, #1a1a1a 0%, #000000 100%)"},children:p.jsxs("div",{className:"card",style:{width:"100%",maxWidth:"420px",padding:"2.5rem"},children:[p.jsxs("div",{style:{textAlign:"center",marginBottom:"2rem"},children:[p.jsx("div",{style:{width:"50px",height:"50px",borderRadius:"12px",background:"linear-gradient(135deg, var(--color-primary), #059669)",display:"flex",alignItems:"center",justifyContent:"center",margin:"0 auto 1.5rem auto",boxShadow:"0 4px 20px rgba(16, 185, 129, 0.3)"},children:p.jsx(Ko,{size:28,color:"#000"})}),p.jsx("h2",{style:{fontSize:"1.75rem",fontWeight:700,marginBottom:"0.5rem",letterSpacing:"-0.02em"},children:"Welcome Back"}),p.jsx("p",{style:{color:"var(--color-text-muted)"},children:"Sign in to your dashboard"})]}),p.jsxs("form",{onSubmit:d,children:[p.jsxs("div",{className:"form-group",style:{marginBottom:"1.25rem"},children:[p.jsx("label",{className:"form-label",style:{fontSize:"0.9rem"},children:"Email Address"}),p.jsx("input",{type:"email",name:"email",className:"input-field",placeholder:"name@example.com",onChange:c,required:!0,style:{padding:"12px",background:"var(--color-bg-input)",border:"1px solid var(--color-border)",color:"#fff"}})]}),p.jsxs("div",{className:"form-group",style:{marginBottom:"1.5rem"},children:[p.jsx("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"8px"},children:p.jsx("label",{className:"form-label",style:{marginBottom:0,fontSize:"0.9rem"},children:"Password"})}),p.jsx("input",{type:"password",name:"password",className:"input-field",placeholder:"••••••••",onChange:c,required:!0,style:{padding:"12px",background:"var(--color-bg-input)",border:"1px solid var(--color-border)",color:"#fff"}})]}),p.jsx("button",{type:"submit",className:"btn btn-primary",style:{width:"100%",padding:"12px",fontSize:"1rem",fontWeight:600,justifyContent:"center",marginTop:"0.5rem"},disabled:n,children:n?"Authenticating...":"Sign In"})]}),p.jsx("div",{style:{marginTop:"2rem",textAlign:"center",borderTop:"1px solid var(--color-border)",paddingTop:"1.5rem"},children:p.jsxs("p",{style:{color:"var(--color-text-muted)",fontSize:"0.95rem"},children:["Don't have an account? ",p.jsx(jt,{to:"/signup",style:{color:"var(--color-primary)",fontWeight:500,textDecoration:"none"},children:"Create Account"})]})})]})})}function _7(){const[e,t]=w.useState({email:"",password:"",name:""}),n=Ln(),{isAuthenticated:r,isLoading:i}=qt();if(w.useEffect(()=>{!i&&r&&n("/dashboard",{replace:!0})},[r,i,n]),i)return null;const a=u=>{t({...e,[u.target.name]:u.target.value})},l=async u=>{if(u.preventDefault(),!e.email||!e.password){ce.error("Email and password are required!");return}const c=ce.loading("Creating your account...");try{const d=await Me.post("/api/auth/register",e);ce.dismiss(c),ce.success(d.data.message),n("/verify-otp",{state:{email:e.email}})}catch(d){ce.dismiss(c);const h=d.response?.data;let m="Signup failed. Please try again.";h?.error&&(typeof h.error=="string"?m=h.error:Array.isArray(h.error)?m=h.error[0]?.message||"Validation failed":m=JSON.stringify(h.error)),ce.error(m)}};return p.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100vh",padding:"1rem",background:"radial-gradient(circle at top center, #1a1a1a 0%, #000000 100%)"},children:p.jsxs("div",{className:"card",style:{width:"100%",maxWidth:"420px",padding:"2.5rem"},children:[p.jsxs("div",{style:{textAlign:"center",marginBottom:"2rem"},children:[p.jsx("div",{style:{width:"50px",height:"50px",borderRadius:"12px",border:"1px solid var(--color-border)",background:"var(--color-bg-secondary)",display:"flex",alignItems:"center",justifyContent:"center",margin:"0 auto 1.5rem auto"},children:p.jsx(Ko,{size:24,color:"var(--color-text-main)"})}),p.jsx("h2",{style:{fontSize:"1.75rem",fontWeight:700,marginBottom:"0.5rem",letterSpacing:"-0.02em"},children:"Create Account"}),p.jsx("p",{style:{color:"var(--color-text-muted)"},children:"Start your developer journey"})]}),p.jsxs("form",{onSubmit:l,children:[p.jsxs("div",{className:"form-group",style:{marginBottom:"1.25rem"},children:[p.jsx("label",{className:"form-label",style:{fontSize:"0.9rem"},children:"Full Name (Optional)"}),p.jsx("input",{type:"text",name:"name",value:e.name,onChange:a,className:"input-field",placeholder:"John Doe",style:{padding:"12px",background:"var(--color-bg-input)",border:"1px solid var(--color-border)",color:"#fff"}})]}),p.jsxs("div",{className:"form-group",style:{marginBottom:"1.25rem"},children:[p.jsx("label",{className:"form-label",style:{fontSize:"0.9rem"},children:"Email Address"}),p.jsx("input",{type:"email",name:"email",value:e.email,onChange:a,className:"input-field",placeholder:"name@example.com",required:!0,style:{padding:"12px",background:"var(--color-bg-input)",border:"1px solid var(--color-border)",color:"#fff"}})]}),p.jsxs("div",{className:"form-group",style:{marginBottom:"1.5rem"},children:[p.jsx("label",{className:"form-label",style:{fontSize:"0.9rem"},children:"Password"}),p.jsx("input",{type:"password",name:"password",value:e.password,onChange:a,className:"input-field",placeholder:"Min. 6 characters",required:!0,minLength:6,style:{padding:"12px",background:"var(--color-bg-input)",border:"1px solid var(--color-border)",color:"#fff"}})]}),p.jsx("button",{type:"submit",className:"btn btn-primary",style:{width:"100%",padding:"12px",fontSize:"1rem",fontWeight:600,justifyContent:"center",marginTop:"0.5rem"},children:"Sign Up"})]}),p.jsx("div",{style:{marginTop:"2rem",textAlign:"center",borderTop:"1px solid var(--color-border)",paddingTop:"1.5rem"},children:p.jsxs("p",{style:{color:"var(--color-text-muted)",fontSize:"0.95rem"},children:["Already have an account? ",p.jsx(jt,{to:"/login",style:{color:"var(--color-primary)",fontWeight:500,textDecoration:"none"},children:"Log in"})]})})]})})}function M7({logo:e,isOpen:t,onClose:n}){const r=qr(),{projectId:i}=io(),{logout:a}=qt(),l=c=>r.pathname===c,u=()=>{window.innerWidth<=768&&n()};return p.jsxs("aside",{className:`sidebar ${t?"mobile-open":""}`,children:[p.jsxs("div",{className:"sidebar-header",style:{justifyContent:"space-between"},children:[i?p.jsxs(jt,{to:"/dashboard",onClick:u,className:"nav-item",style:{padding:0,color:"var(--color-text-main)"},children:[p.jsx(Du,{size:20}),p.jsx("span",{style:{marginLeft:"10px",fontWeight:600},children:"Back"})]}):p.jsx("div",{style:{display:"flex",alignItems:"center"},children:p.jsx("img",{src:e,alt:"urBackend Logo",style:{height:"32px",width:"auto"}})}),p.jsx("button",{onClick:n,className:"btn btn-ghost",style:{padding:"4px",display:"none"},children:p.jsx(aa,{size:20})}),p.jsx("style",{children:"@media (max-width: 768px) { .sidebar-header button { display: block !important; } }"})]}),p.jsx("nav",{className:"sidebar-nav",children:i?p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"nav-section-label",children:"Project Modules"}),p.jsxs(jt,{to:`/project/${i}`,onClick:u,className:`nav-item ${l(`/project/${i}`)?"active":""}`,children:[p.jsx(m1,{size:18})," ",p.jsx("span",{children:"Overview"})]}),p.jsxs(jt,{to:`/project/${i}/database`,onClick:u,className:`nav-item ${l(`/project/${i}/database`)?"active":""}`,children:[p.jsx(Lr,{size:18})," ",p.jsx("span",{children:"Database"})]}),p.jsxs(jt,{to:`/project/${i}/auth`,onClick:u,className:`nav-item ${l(`/project/${i}/auth`)?"active":""}`,children:[p.jsx(Pi,{size:18})," ",p.jsx("span",{children:"Authentication"})]}),p.jsxs(jt,{to:`/project/${i}/storage`,onClick:u,className:`nav-item ${l(`/project/${i}/storage`)?"active":""}`,children:[p.jsx(sa,{size:18})," ",p.jsx("span",{children:"Storage"})]}),p.jsxs(jt,{to:`/project/${i}/analytics`,onClick:u,className:`nav-item ${l(`/project/${i}/analytics`)?"active":""}`,children:[p.jsx(vN,{size:18})," ",p.jsx("span",{children:"Analytics"})]}),p.jsxs(jt,{to:`/project/${i}/settings`,onClick:u,className:`nav-item ${l(`/project/${i}/settings`)?"active":""}`,children:[p.jsx(CS,{size:18})," ",p.jsx("span",{children:"Settings"})]})]}):p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"nav-section-label",children:"General"}),p.jsxs(jt,{to:"/dashboard",onClick:u,className:`nav-item ${l("/dashboard")?"active":""}`,children:[p.jsx(m1,{size:18})," ",p.jsx("span",{children:"All Projects"})]}),p.jsxs(jt,{to:"/settings",onClick:u,className:`nav-item ${l("/settings")?"active":""}`,children:[p.jsx(A7,{size:18})," ",p.jsx("span",{children:"Account Settings"})]}),p.jsxs(jt,{to:"/releases",onClick:u,className:`nav-item ${l("/releases")?"active":""}`,children:[p.jsx(SN,{size:18})," ",p.jsx("span",{children:"Changelog"})]})]})}),p.jsx("div",{style:{padding:"1rem",borderTop:"1px solid var(--color-border)"},children:p.jsxs("button",{onClick:a,className:"nav-item",style:{width:"100%",background:"transparent",border:"none",cursor:"pointer",color:"var(--color-danger)",justifyContent:"flex-start"},children:[p.jsx(Zq,{size:18})," ",p.jsx("span",{children:"Logout"})]})})]})}function P7({onToggleSidebar:e,showToggle:t=!0}){const{user:n}=qt(),r=n?.email?n.email[0].toUpperCase():"D";return p.jsxs("header",{style:{height:"var(--header-height)",backgroundColor:"var(--color-bg-main)",borderBottom:"1px solid var(--color-border)",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 1rem",position:"fixed",top:0,right:0,left:0,zIndex:1e3,width:"100%",paddingLeft:t?"calc(var(--sidebar-width) + 1rem)":"1rem"},className:"responsive-header",children:[p.jsx("style",{children:` +`+a):r.stack=a}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Hl(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:a}=n;r!==void 0&&Pp.assertOptions(r,{silentJSONParsing:Ji.transitional(Ji.boolean),forcedJSONParsing:Ji.transitional(Ji.boolean),clarifyTimeoutError:Ji.transitional(Ji.boolean)},!1),i!=null&&(J.isFunction(i)?n.paramsSerializer={serialize:i}:Pp.assertOptions(i,{encode:Ji.function,serialize:Ji.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Pp.assertOptions(n,{baseUrl:Ji.spelling("baseURL"),withXsrfToken:Ji.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let l=a&&J.merge(a.common,a[n.method]);a&&J.forEach(["delete","get","head","post","put","patch","common"],b=>{delete a[b]}),n.headers=wr.concat(l,a);const u=[];let c=!0;this.interceptors.request.forEach(function(j){typeof j.runWhen=="function"&&j.runWhen(n)===!1||(c=c&&j.synchronous,u.unshift(j.fulfilled,j.rejected))});const d=[];this.interceptors.response.forEach(function(j){d.push(j.fulfilled,j.rejected)});let h,m=0,y;if(!c){const b=[MT.bind(this),void 0];for(b.unshift(...u),b.push(...d),y=b.length,h=Promise.resolve(n);m{if(!r._listeners)return;let a=r._listeners.length;for(;a-- >0;)r._listeners[a](i);r._listeners=null}),this.promise.then=i=>{let a;const l=new Promise(u=>{r.subscribe(u),a=u}).then(i);return l.cancel=function(){r.unsubscribe(a)},l},t(function(a,l,u){r.reason||(r.reason=new Ru(a,l,u),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new hN(function(i){t=i}),cancel:t}}};function qH(e){return function(n){return e.apply(null,n)}}function WH(e){return J.isObject(e)&&e.isAxiosError===!0}const h1={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(h1).forEach(([e,t])=>{h1[t]=e});function pN(e){const t=new Ll(e),n=q5(Ll.prototype.request,t);return J.extend(n,Ll.prototype,t,{allOwnKeys:!0}),J.extend(n,t,null,{allOwnKeys:!0}),n.create=function(i){return pN(Hl(e,i))},n}const Lt=pN(tf);Lt.Axios=Ll;Lt.CanceledError=Ru;Lt.CancelToken=HH;Lt.isCancel=oN;Lt.VERSION=fN;Lt.toFormData=pg;Lt.AxiosError=Ue;Lt.Cancel=Lt.CanceledError;Lt.all=function(t){return Promise.all(t)};Lt.spread=qH;Lt.isAxiosError=WH;Lt.mergeConfig=Hl;Lt.AxiosHeaders=wr;Lt.formToJSON=e=>aN(J.isHTMLForm(e)?new FormData(e):e);Lt.getAdapter=dN.getAdapter;Lt.HttpStatusCode=h1;Lt.default=Lt;const{Axios:Pwe,AxiosError:Nwe,CanceledError:zwe,isCancel:Iwe,CancelToken:Lwe,VERSION:Bwe,all:Fwe,Cancel:$we,isAxiosError:Uwe,spread:Vwe,toFormData:Hwe,AxiosHeaders:qwe,HttpStatusCode:Wwe,formToJSON:Gwe,getAdapter:Kwe,mergeConfig:Ywe}=Lt,mN="https://api.urbackend.bitbros.in",id="https://api.ub.bitbros.in",SS="yashpouranik124@gmail.com",Me=Lt.create({baseURL:mN,withCredentials:!0});let Ys=null;const GH=async()=>{try{return Ys=(await Lt.get(`${mN}/api/auth/csrf-token`,{withCredentials:!0})).data.csrfToken,Ys}catch(e){return console.error("Failed to fetch CSRF token:",e),null}};Me.interceptors.request.use(async e=>{const t=e.method.toLowerCase();return["post","put","delete","patch"].includes(t)&&(Ys||(Ys=await GH()),Ys&&(e.headers["X-CSRF-Token"]=Ys)),e},e=>Promise.reject(e));Me.interceptors.response.use(e=>e,async e=>{const t=e.config;if(!t)return Promise.reject(e);if(e.response?.status===401&&!t._retry){if(t.url?.includes("/api/auth/refresh-token"))return Promise.reject(e);t._retry=!0;try{return await Me.post("/api/auth/refresh-token",{}),Me(t)}catch(n){return Promise.reject(n)}}return Promise.reject(e)});const gN=w.createContext(null),KH=({children:e})=>{const[t,n]=w.useState(null),[r,i]=w.useState(!0);w.useEffect(()=>{(async()=>{try{const d=await Me.get("/api/auth/me");d.data.success&&n(d.data.user)}catch(d){console.error("Not authenticated:",d.message),n(null)}finally{i(!1)}})()},[]);const u={user:t,login:c=>{n(c)},logout:async()=>{try{await Me.post("/api/auth/logout")}catch(c){console.error("Logout failed:",c)}finally{n(null)}},isAuthenticated:!!t,isLoading:r};return p.jsx(gN.Provider,{value:u,children:e})},qt=()=>w.useContext(gN);const YH=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),XH=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),NT=e=>{const t=XH(e);return t.charAt(0).toUpperCase()+t.slice(1)},yN=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),ZH=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var QH={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"};const JH=w.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:a,iconNode:l,...u},c)=>w.createElement("svg",{ref:c,...QH,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:yN("lucide",i),...!a&&!ZH(u)&&{"aria-hidden":"true"},...u},[...l.map(([d,h])=>w.createElement(d,h)),...Array.isArray(a)?a:[a]]));const Ce=(e,t)=>{const n=w.forwardRef(({className:r,...i},a)=>w.createElement(JH,{ref:a,iconNode:t,className:yN(`lucide-${YH(NT(e))}`,`lucide-${e}`,r),...i}));return n.displayName=NT(e),n};const eq=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],ad=Ce("activity",eq);const tq=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Du=Ce("arrow-left",tq);const nq=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Go=Ce("arrow-right",nq);const rq=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],iq=Ce("arrow-up-down",rq);const aq=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],zT=Ce("book-open",aq);const oq=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],IT=Ce("box",oq);const lq=[["path",{d:"M5 21v-6",key:"1hz6c0"}],["path",{d:"M12 21V3",key:"1lcnhd"}],["path",{d:"M19 21V9",key:"unv183"}]],vN=Ce("chart-no-axes-column",lq);const sq=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],wd=Ce("check",sq);const uq=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Sd=Ce("chevron-down",uq);const cq=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],dq=Ce("chevron-left",cq);const fq=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],jd=Ce("chevron-right",fq);const hq=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],pq=Ce("chevron-up",hq);const mq=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],gg=Ce("circle-alert",mq);const gq=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Xn=Ce("circle-check-big",gq);const yq=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],xN=Ce("clock",yq);const vq=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],xq=Ce("cloud-upload",vq);const bq=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],bN=Ce("code",bq);const wq=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],cu=Ce("copy",wq);const Sq=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],LT=Ce("cpu",Sq);const jq=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Lr=Ce("database",jq);const Cq=[["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"}]],kq=Ce("external-link",Cq);const Aq=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Eq=Ce("eye",Aq);const Tq=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],Oq=Ce("file-braces",Tq);const Rq=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],wN=Ce("file-text",Rq);const Dq=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],_q=Ce("file",Dq);const Mq=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Pq=Ce("folder",Mq);const Nq=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],BT=Ce("funnel",Nq);const zq=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],Iq=Ce("github",zq);const Lq=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Zp=Ce("globe",Lq);const Bq=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Fq=Ce("grip-vertical",Bq);const $q=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],sa=Ce("hard-drive",$q);const Uq=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],Vq=Ce("house",Uq);const Hq=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],ru=Ce("key",Hq);const qq=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],p1=Ce("layers",qq);const Wq=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],m1=Ce("layout-dashboard",Wq);const Gq=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],Kq=Ce("list",Gq);const Yq=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],jS=Ce("lock",Yq);const Xq=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Zq=Ce("log-out",Xq);const Qq=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],Jq=Ce("mail",Qq);const e7=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],Cd=Ce("menu",e7);const t7=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],g1=Ce("pen",t7);const n7=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],r7=Ce("pencil",n7);const i7=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ur=Ce("plus",i7);const a7=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Qp=Ce("refresh-cw",a7);const o7=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],SN=Ce("rocket",o7);const l7=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],nf=Ce("save",l7);const s7=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],u7=Ce("search",s7);const c7=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],d7=Ce("send",c7);const f7=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],yg=Ce("server",f7);const h7=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],p7=Ce("settings-2",h7);const m7=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],CS=Ce("settings",m7);const g7=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],y7=Ce("shield-check",g7);const v7=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],Pi=Ce("shield",v7);const x7=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],FT=Ce("smartphone",x7);const b7=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],w7=Ce("table",b7);const S7=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Ko=Ce("terminal",S7);const j7=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],ao=Ce("trash-2",j7);const C7=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ga=Ce("triangle-alert",C7);const k7=[["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m14.305 16.53.923-.382",key:"1itpsq"}],["path",{d:"m15.228 13.852-.923-.383",key:"eplpkm"}],["path",{d:"m16.852 12.228-.383-.923",key:"13v3q0"}],["path",{d:"m16.852 17.772-.383.924",key:"1i8mnm"}],["path",{d:"m19.148 12.228.383-.923",key:"1q8j1v"}],["path",{d:"m19.53 18.696-.382-.924",key:"vk1qj3"}],["path",{d:"m20.772 13.852.924-.383",key:"n880s0"}],["path",{d:"m20.772 16.148.924.383",key:"1g6xey"}],["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],A7=Ce("user-cog",k7);const E7=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],$T=Ce("user-plus",E7);const T7=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],UT=Ce("user",T7);const O7=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],aa=Ce("x",O7);const R7=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],od=Ce("zap",R7);function D7(){const[e,t]=w.useState({email:"",password:""}),[n,r]=w.useState(!1),i=Ln(),{login:a,isAuthenticated:l,isLoading:u}=qt();if(w.useEffect(()=>{!u&&l&&i("/dashboard",{replace:!0})},[l,u,i]),u)return null;const c=h=>{t({...e,[h.target.name]:h.target.value})},d=async h=>{if(h.preventDefault(),!e.email||!e.password){ce.error("Email and password are required!");return}r(!0);const m=ce.loading("Logging in...");try{const y=await Me.post("/api/auth/login",e);y.data.success&&(a(y.data.user),ce.dismiss(m),ce.success("Welcome back!"),i("/dashboard"))}catch(y){console.error(y),ce.dismiss(m);const v=y.response?.data;let b="Login failed. Check your credentials.";v?.error&&(typeof v.error=="string"?b=v.error:Array.isArray(v.error)&&(b=v.error[0]?.message||"Validation failed")),ce.error(b),r(!1)}};return p.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100vh",padding:"1rem",background:"radial-gradient(circle at top center, #1a1a1a 0%, #000000 100%)"},children:p.jsxs("div",{className:"card",style:{width:"100%",maxWidth:"420px",padding:"2.5rem"},children:[p.jsxs("div",{style:{textAlign:"center",marginBottom:"2rem"},children:[p.jsx("div",{style:{width:"50px",height:"50px",borderRadius:"12px",background:"linear-gradient(135deg, var(--color-primary), #059669)",display:"flex",alignItems:"center",justifyContent:"center",margin:"0 auto 1.5rem auto",boxShadow:"0 4px 20px rgba(16, 185, 129, 0.3)"},children:p.jsx(Ko,{size:28,color:"#000"})}),p.jsx("h2",{style:{fontSize:"1.75rem",fontWeight:700,marginBottom:"0.5rem",letterSpacing:"-0.02em"},children:"Welcome Back"}),p.jsx("p",{style:{color:"var(--color-text-muted)"},children:"Sign in to your dashboard"})]}),p.jsxs("form",{onSubmit:d,children:[p.jsxs("div",{className:"form-group",style:{marginBottom:"1.25rem"},children:[p.jsx("label",{className:"form-label",style:{fontSize:"0.9rem"},children:"Email Address"}),p.jsx("input",{type:"email",name:"email",className:"input-field",placeholder:"name@example.com",onChange:c,required:!0,style:{padding:"12px",background:"var(--color-bg-input)",border:"1px solid var(--color-border)",color:"#fff"}})]}),p.jsxs("div",{className:"form-group",style:{marginBottom:"1.5rem"},children:[p.jsx("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"8px"},children:p.jsx("label",{className:"form-label",style:{marginBottom:0,fontSize:"0.9rem"},children:"Password"})}),p.jsx("input",{type:"password",name:"password",className:"input-field",placeholder:"••••••••",onChange:c,required:!0,style:{padding:"12px",background:"var(--color-bg-input)",border:"1px solid var(--color-border)",color:"#fff"}})]}),p.jsx("button",{type:"submit",className:"btn btn-primary",style:{width:"100%",padding:"12px",fontSize:"1rem",fontWeight:600,justifyContent:"center",marginTop:"0.5rem"},disabled:n,children:n?"Authenticating...":"Sign In"})]}),p.jsx("div",{style:{marginTop:"2rem",textAlign:"center",borderTop:"1px solid var(--color-border)",paddingTop:"1.5rem"},children:p.jsxs("p",{style:{color:"var(--color-text-muted)",fontSize:"0.95rem"},children:["Don't have an account? ",p.jsx(jt,{to:"/signup",style:{color:"var(--color-primary)",fontWeight:500,textDecoration:"none"},children:"Create Account"})]})})]})})}function _7(){const[e,t]=w.useState({email:"",password:"",name:""}),n=Ln(),{isAuthenticated:r,isLoading:i}=qt();if(w.useEffect(()=>{!i&&r&&n("/dashboard",{replace:!0})},[r,i,n]),i)return null;const a=u=>{t({...e,[u.target.name]:u.target.value})},l=async u=>{if(u.preventDefault(),!e.email||!e.password){ce.error("Email and password are required!");return}const c=ce.loading("Creating your account...");try{const d=await Me.post("/api/auth/register",e);ce.dismiss(c),ce.success(d.data.message),n("/verify-otp",{state:{email:e.email}})}catch(d){ce.dismiss(c);const h=d.response?.data;let m="Signup failed. Please try again.";h?.error&&(typeof h.error=="string"?m=h.error:Array.isArray(h.error)?m=h.error[0]?.message||"Validation failed":m=JSON.stringify(h.error)),ce.error(m)}};return p.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100vh",padding:"1rem",background:"radial-gradient(circle at top center, #1a1a1a 0%, #000000 100%)"},children:p.jsxs("div",{className:"card",style:{width:"100%",maxWidth:"420px",padding:"2.5rem"},children:[p.jsxs("div",{style:{textAlign:"center",marginBottom:"2rem"},children:[p.jsx("div",{style:{width:"50px",height:"50px",borderRadius:"12px",border:"1px solid var(--color-border)",background:"var(--color-bg-secondary)",display:"flex",alignItems:"center",justifyContent:"center",margin:"0 auto 1.5rem auto"},children:p.jsx(Ko,{size:24,color:"var(--color-text-main)"})}),p.jsx("h2",{style:{fontSize:"1.75rem",fontWeight:700,marginBottom:"0.5rem",letterSpacing:"-0.02em"},children:"Create Account"}),p.jsx("p",{style:{color:"var(--color-text-muted)"},children:"Start your developer journey"})]}),p.jsxs("form",{onSubmit:l,children:[p.jsxs("div",{className:"form-group",style:{marginBottom:"1.25rem"},children:[p.jsx("label",{className:"form-label",style:{fontSize:"0.9rem"},children:"Full Name (Optional)"}),p.jsx("input",{type:"text",name:"name",value:e.name,onChange:a,className:"input-field",placeholder:"John Doe",style:{padding:"12px",background:"var(--color-bg-input)",border:"1px solid var(--color-border)",color:"#fff"}})]}),p.jsxs("div",{className:"form-group",style:{marginBottom:"1.25rem"},children:[p.jsx("label",{className:"form-label",style:{fontSize:"0.9rem"},children:"Email Address"}),p.jsx("input",{type:"email",name:"email",value:e.email,onChange:a,className:"input-field",placeholder:"name@example.com",required:!0,style:{padding:"12px",background:"var(--color-bg-input)",border:"1px solid var(--color-border)",color:"#fff"}})]}),p.jsxs("div",{className:"form-group",style:{marginBottom:"1.5rem"},children:[p.jsx("label",{className:"form-label",style:{fontSize:"0.9rem"},children:"Password"}),p.jsx("input",{type:"password",name:"password",value:e.password,onChange:a,className:"input-field",placeholder:"Min. 6 characters",required:!0,minLength:6,style:{padding:"12px",background:"var(--color-bg-input)",border:"1px solid var(--color-border)",color:"#fff"}})]}),p.jsx("button",{type:"submit",className:"btn btn-primary",style:{width:"100%",padding:"12px",fontSize:"1rem",fontWeight:600,justifyContent:"center",marginTop:"0.5rem"},children:"Sign Up"})]}),p.jsx("div",{style:{marginTop:"2rem",textAlign:"center",borderTop:"1px solid var(--color-border)",paddingTop:"1.5rem"},children:p.jsxs("p",{style:{color:"var(--color-text-muted)",fontSize:"0.95rem"},children:["Already have an account? ",p.jsx(jt,{to:"/login",style:{color:"var(--color-primary)",fontWeight:500,textDecoration:"none"},children:"Log in"})]})})]})})}function M7({logo:e,isOpen:t,onClose:n}){const r=qr(),{projectId:i}=io(),{logout:a}=qt(),l=c=>r.pathname===c,u=()=>{window.innerWidth<=768&&n()};return p.jsxs("aside",{className:`sidebar ${t?"mobile-open":""}`,children:[p.jsxs("div",{className:"sidebar-header",style:{justifyContent:"space-between"},children:[i?p.jsxs(jt,{to:"/dashboard",onClick:u,className:"nav-item",style:{padding:0,color:"var(--color-text-main)"},children:[p.jsx(Du,{size:20}),p.jsx("span",{style:{marginLeft:"10px",fontWeight:600},children:"Back"})]}):p.jsx("div",{style:{display:"flex",alignItems:"center"},children:p.jsx("img",{src:e,alt:"urBackend Logo",style:{height:"32px",width:"auto"}})}),p.jsx("button",{onClick:n,className:"btn btn-ghost",style:{padding:"4px",display:"none"},children:p.jsx(aa,{size:20})}),p.jsx("style",{children:"@media (max-width: 768px) { .sidebar-header button { display: block !important; } }"})]}),p.jsx("nav",{className:"sidebar-nav",children:i?p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"nav-section-label",children:"Project Modules"}),p.jsxs(jt,{to:`/project/${i}`,onClick:u,className:`nav-item ${l(`/project/${i}`)?"active":""}`,children:[p.jsx(m1,{size:18})," ",p.jsx("span",{children:"Overview"})]}),p.jsxs(jt,{to:`/project/${i}/database`,onClick:u,className:`nav-item ${l(`/project/${i}/database`)?"active":""}`,children:[p.jsx(Lr,{size:18})," ",p.jsx("span",{children:"Database"})]}),p.jsxs(jt,{to:`/project/${i}/auth`,onClick:u,className:`nav-item ${l(`/project/${i}/auth`)?"active":""}`,children:[p.jsx(Pi,{size:18})," ",p.jsx("span",{children:"Authentication"})]}),p.jsxs(jt,{to:`/project/${i}/storage`,onClick:u,className:`nav-item ${l(`/project/${i}/storage`)?"active":""}`,children:[p.jsx(sa,{size:18})," ",p.jsx("span",{children:"Storage"})]}),p.jsxs(jt,{to:`/project/${i}/analytics`,onClick:u,className:`nav-item ${l(`/project/${i}/analytics`)?"active":""}`,children:[p.jsx(vN,{size:18})," ",p.jsx("span",{children:"Analytics"})]}),p.jsxs(jt,{to:`/project/${i}/settings`,onClick:u,className:`nav-item ${l(`/project/${i}/settings`)?"active":""}`,children:[p.jsx(CS,{size:18})," ",p.jsx("span",{children:"Settings"})]})]}):p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"nav-section-label",children:"General"}),p.jsxs(jt,{to:"/dashboard",onClick:u,className:`nav-item ${l("/dashboard")?"active":""}`,children:[p.jsx(m1,{size:18})," ",p.jsx("span",{children:"All Projects"})]}),p.jsxs(jt,{to:"/settings",onClick:u,className:`nav-item ${l("/settings")?"active":""}`,children:[p.jsx(A7,{size:18})," ",p.jsx("span",{children:"Account Settings"})]}),p.jsxs(jt,{to:"/releases",onClick:u,className:`nav-item ${l("/releases")?"active":""}`,children:[p.jsx(SN,{size:18})," ",p.jsx("span",{children:"Changelog"})]})]})}),p.jsx("div",{style:{padding:"1rem",borderTop:"1px solid var(--color-border)"},children:p.jsxs("button",{onClick:a,className:"nav-item",style:{width:"100%",background:"transparent",border:"none",cursor:"pointer",color:"var(--color-danger)",justifyContent:"flex-start"},children:[p.jsx(Zq,{size:18})," ",p.jsx("span",{children:"Logout"})]})})]})}function P7({onToggleSidebar:e,showToggle:t=!0}){const{user:n}=qt(),r=n?.email?n.email[0].toUpperCase():"D";return p.jsxs("header",{style:{height:"var(--header-height)",backgroundColor:"var(--color-bg-main)",borderBottom:"1px solid var(--color-border)",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 1rem",position:"fixed",top:0,right:0,left:0,zIndex:1e3,width:"100%",paddingLeft:t?"calc(var(--sidebar-width) + 1rem)":"1rem"},className:"responsive-header",children:[p.jsx("style",{children:` @media (max-width: 768px) { .responsive-header { padding-left: 1rem !important; /* Reset padding on mobile */ diff --git a/apps/web-dashboard/dist/index.html b/apps/web-dashboard/dist/index.html index 1e7e3dc7d..e036539bb 100644 --- a/apps/web-dashboard/dist/index.html +++ b/apps/web-dashboard/dist/index.html @@ -12,7 +12,7 @@ href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap" rel="stylesheet" /> - + From 864904ecec835b280f0d89761c4984100ad93602 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 28 Mar 2026 08:36:10 +0000 Subject: [PATCH 4/5] fix(rls): address review feedback - schema-derived defaults, auth guard, accessibility Agent-Logs-Url: https://github.com/yash-pouranik/urBackend/sessions/b3c82297-16e2-48e7-9af8-ba7992227aa8 Co-authored-by: yash-pouranik <172860064+yash-pouranik@users.noreply.github.com> --- .../src/controllers/project.controller.js | 22 ++++----- .../middlewares/authorizeWriteOperation.js | 8 ++++ .../middlewares/resolvePublicAuthContext.js | 7 ++- apps/web-dashboard/src/pages/Database.jsx | 48 ++++++++++++++----- 4 files changed, 60 insertions(+), 25 deletions(-) diff --git a/apps/dashboard-api/src/controllers/project.controller.js b/apps/dashboard-api/src/controllers/project.controller.js index 71d3f3821..dd24feb2e 100644 --- a/apps/dashboard-api/src/controllers/project.controller.js +++ b/apps/dashboard-api/src/controllers/project.controller.js @@ -156,12 +156,7 @@ module.exports.getSingleProject = async (req, res) => { } return { ...col, - rls: col.rls || { - enabled: false, - mode: 'owner-write-only', - ownerField: 'userId', - requireAuthForWrite: true - } + rls: col.rls || getDefaultRlsForCollection(col.name, col.model) }; }); } @@ -980,12 +975,7 @@ module.exports.toggleAuth = async (req, res) => { } return { ...col, - rls: col.rls || { - enabled: false, - mode: 'owner-write-only', - ownerField: 'userId', - requireAuthForWrite: true - } + rls: col.rls || getDefaultRlsForCollection(col.name, col.model) }; }); } @@ -1027,6 +1017,14 @@ module.exports.updateCollectionRls = async (req, res) => { }); } + // Restrict use of '_id' as ownerField to the 'users' collection only. + if (nextOwnerField === '_id' && collection.name !== 'users') { + return res.status(400).json({ + error: "Invalid owner field", + message: "ownerField '_id' is only allowed for the 'users' collection" + }); + } + collection.rls = { enabled: typeof enabled === 'boolean' ? enabled : !!collection?.rls?.enabled, mode: validMode, diff --git a/apps/public-api/src/middlewares/authorizeWriteOperation.js b/apps/public-api/src/middlewares/authorizeWriteOperation.js index 1abe236fd..7bb8c748e 100644 --- a/apps/public-api/src/middlewares/authorizeWriteOperation.js +++ b/apps/public-api/src/middlewares/authorizeWriteOperation.js @@ -36,6 +36,14 @@ module.exports = async (req, res, next) => { } const ownerField = rls.ownerField || 'userId'; + + if (!req.authUser?.userId) { + return res.status(401).json({ + error: 'Authentication required', + message: 'Provide a valid user Bearer token for write operations.' + }); + } + const authUserId = String(req.authUser.userId); const method = String(req.method || '').toUpperCase(); diff --git a/apps/public-api/src/middlewares/resolvePublicAuthContext.js b/apps/public-api/src/middlewares/resolvePublicAuthContext.js index abb1d340d..4d20ed524 100644 --- a/apps/public-api/src/middlewares/resolvePublicAuthContext.js +++ b/apps/public-api/src/middlewares/resolvePublicAuthContext.js @@ -1,9 +1,14 @@ const jwt = require('jsonwebtoken'); module.exports = (req, res, next) => { - const authHeader = req.header('Authorization'); req.authUser = null; + if (req.keyRole === 'secret') { + return next(); + } + + const authHeader = req.header('Authorization'); + if (!authHeader || !authHeader.startsWith('Bearer ')) { return next(); } diff --git a/apps/web-dashboard/src/pages/Database.jsx b/apps/web-dashboard/src/pages/Database.jsx index 42f017a2a..37c84e1ba 100644 --- a/apps/web-dashboard/src/pages/Database.jsx +++ b/apps/web-dashboard/src/pages/Database.jsx @@ -95,15 +95,30 @@ export default function Database() { const fetchProject = async () => { try { const res = await api.get(`/api/projects/${projectId}`); - const withRlsDefaults = (res.data.collections || []).map(c => ({ - ...c, - rls: c.rls || { - enabled: false, - mode: "owner-write-only", - ownerField: c.name === 'users' ? '_id' : 'userId', - requireAuthForWrite: true + const withRlsDefaults = (res.data.collections || []).map(c => { + const schemaKeys = (c.model || []).map(f => f?.key).filter(Boolean); + // Derive a schema-valid ownerField: prefer userId, then ownerId, then the + // first schema key as a prompt for the user to review before saving. + let derivedOwnerField; + if (c.name === 'users') { + derivedOwnerField = '_id'; + } else if (schemaKeys.includes('userId')) { + derivedOwnerField = 'userId'; + } else if (schemaKeys.includes('ownerId')) { + derivedOwnerField = 'ownerId'; + } else { + derivedOwnerField = schemaKeys[0] || ''; } - })); + return { + ...c, + rls: c.rls || { + enabled: false, + mode: "owner-write-only", + ownerField: derivedOwnerField, + requireAuthForWrite: true + } + }; + }); setProject(res.data); setCollections(withRlsDefaults); @@ -216,8 +231,11 @@ export default function Database() { const rlsOwnerFieldOptions = (() => { if (!activeCollection) return []; - const modelKeys = (activeCollection.model || []).map((f) => f.key).filter(Boolean); - return [...new Set(["_id", ...modelKeys, "userId", "ownerId"])]; + const schemaKeys = (activeCollection.model || []).map((f) => f.key).filter(Boolean); + if (activeCollection.name === 'users') { + return ['_id', ...schemaKeys.filter(k => k !== '_id')]; + } + return schemaKeys; })(); const handleDelete = async (id) => { @@ -726,11 +744,17 @@ export default function Database() { {isRlsDialogOpen && activeCollection && (
setIsRlsDialogOpen(false)}> -
e.stopPropagation()}> +
e.stopPropagation()} + >
-

RLS Settings

+

RLS Settings