@powerhousedao/ph-clint-app 0.1.0-dev.104 → 0.1.0-dev.105

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/connect/assets/{ClearStorageModal-DyU-FIgY-EmyEVbqJ.js → ClearStorageModal-DyU-FIgY-C2SQvwxh.js} +2 -2
  2. package/dist/connect/assets/{ClearStorageModal-DyU-FIgY-EmyEVbqJ.js.map → ClearStorageModal-DyU-FIgY-C2SQvwxh.js.map} +1 -1
  3. package/dist/connect/assets/{DebugSettingsModal-CwUN9gIr-DU3Ify9i.js → DebugSettingsModal-CwUN9gIr-C27CiPQG.js} +2 -2
  4. package/dist/connect/assets/{DebugSettingsModal-CwUN9gIr-DU3Ify9i.js.map → DebugSettingsModal-CwUN9gIr-C27CiPQG.js.map} +1 -1
  5. package/dist/connect/assets/{InspectorModal-Cd8kbCV8-oAxF19f2.js → InspectorModal-Cd8kbCV8-D9TUaRon.js} +2 -2
  6. package/dist/connect/assets/{InspectorModal-Cd8kbCV8-oAxF19f2.js.map → InspectorModal-Cd8kbCV8-D9TUaRon.js.map} +1 -1
  7. package/dist/connect/assets/{OpenFileDocumentsModal-BQsaBP4x-F5oIaNhF.js → OpenFileDocumentsModal-BQsaBP4x-HmKTWcS8.js} +2 -2
  8. package/dist/connect/assets/{OpenFileDocumentsModal-BQsaBP4x-F5oIaNhF.js.map → OpenFileDocumentsModal-BQsaBP4x-HmKTWcS8.js.map} +1 -1
  9. package/dist/connect/assets/{SettingsModal-CgjW-M2a-cl02gX0W.js → SettingsModal-CgjW-M2a-BbUA87ne.js} +2 -2
  10. package/dist/connect/assets/{SettingsModal-CgjW-M2a-cl02gX0W.js.map → SettingsModal-CgjW-M2a-BbUA87ne.js.map} +1 -1
  11. package/dist/connect/assets/{app-loader-l5wtQh5z-De20QMC5.js → app-loader-l5wtQh5z-BCq0Ui4Q.js} +4 -4
  12. package/dist/connect/assets/{app-loader-l5wtQh5z-De20QMC5.js.map → app-loader-l5wtQh5z-BCq0Ui4Q.js.map} +1 -1
  13. package/dist/connect/assets/{components-BH57lxCU-WIjGNcs_.js → components-BH57lxCU-CXFU4DBE.js} +2 -2
  14. package/dist/connect/assets/{components-BH57lxCU-WIjGNcs_.js.map → components-BH57lxCU-CXFU4DBE.js.map} +1 -1
  15. package/dist/connect/assets/{connect.config-CaXMoB42-VqdFwuy8.js → connect.config-CaXMoB42-DPDK2YJi.js} +2 -2
  16. package/dist/connect/assets/{connect.config-CaXMoB42-VqdFwuy8.js.map → connect.config-CaXMoB42-DPDK2YJi.js.map} +1 -1
  17. package/dist/connect/assets/{connection-state-Eqc2izmt-DTKlEPf8.js → connection-state-Eqc2izmt-DYeEdoBH.js} +2 -2
  18. package/dist/connect/assets/{connection-state-Eqc2izmt-DTKlEPf8.js.map → connection-state-Eqc2izmt-DYeEdoBH.js.map} +1 -1
  19. package/dist/connect/assets/{cookie-banner-BxXvPdIY-CasEfo4n.js → cookie-banner-BxXvPdIY-DciefBm4.js} +2 -2
  20. package/dist/connect/assets/{cookie-banner-BxXvPdIY-CasEfo4n.js.map → cookie-banner-BxXvPdIY-DciefBm4.js.map} +1 -1
  21. package/dist/connect/assets/{index-CgAuDZM-.js → index-CCrGK-st.js} +3 -3
  22. package/dist/connect/assets/{index-CgAuDZM-.js.map → index-CCrGK-st.js.map} +1 -1
  23. package/dist/connect/assets/{load-ftpCX1HI-sPDToliw.js → load-ftpCX1HI-C4L1Z5YI.js} +2 -2
  24. package/dist/connect/assets/{load-ftpCX1HI-sPDToliw.js.map → load-ftpCX1HI-C4L1Z5YI.js.map} +1 -1
  25. package/dist/connect/assets/{pglite-seed-Cl2d-iyl-BBapDDmK.js → pglite-seed-Cl2d-iyl-Abmu_EqV.js} +2 -2
  26. package/dist/connect/assets/{pglite-seed-Cl2d-iyl-BBapDDmK.js.map → pglite-seed-Cl2d-iyl-Abmu_EqV.js.map} +1 -1
  27. package/dist/connect/assets/{preferences-store-DZUIAkHE-BymxR2vb.js → preferences-store-DZUIAkHE-BwJzNFRa.js} +2 -2
  28. package/dist/connect/assets/{preferences-store-DZUIAkHE-BymxR2vb.js.map → preferences-store-DZUIAkHE-BwJzNFRa.js.map} +1 -1
  29. package/dist/connect/assets/{reactor-CItc8KaF-C82-SArQ.js → reactor-CItc8KaF-DIjxfM4l.js} +2 -2
  30. package/dist/connect/assets/{reactor-CItc8KaF-C82-SArQ.js.map → reactor-CItc8KaF-DIjxfM4l.js.map} +1 -1
  31. package/dist/connect/assets/{registerServiceWorker-smkROQhm-5rfjT0ui.js → registerServiceWorker-smkROQhm-Qbc3RMCx.js} +2 -2
  32. package/dist/connect/assets/{registerServiceWorker-smkROQhm-5rfjT0ui.js.map → registerServiceWorker-smkROQhm-Qbc3RMCx.js.map} +1 -1
  33. package/dist/connect/index.html +1 -1
  34. package/dist/connect/powerhouse.config.json +1 -1
  35. package/dist/connect/service-worker.js +1 -1
  36. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-16wyYGXK.js","assets/rolldown-runtime-BcKkbAw3.js","assets/preload-helper-BZ1Pz5am.js","assets/chunk-BTBUZ646--Q_mGPOy.js","assets/chunk-WGR4JCLS-BXpTqGmk.js","assets/chunk-EADU5A67-BqqDB7-A.js","assets/pg_dump-C8BPA2zs.js","assets/factory-CGO-x_eD.js","assets/sha256-Bh9Gbylw.js","assets/sha2-DAzSwLJP.js","assets/utils-N6OADHW2.js","assets/secp256k1-D1r0jdlq.js","assets/utils-oVEYY1QK.js","assets/hmac-DoN68dA-.js","assets/hashTypedData-Qe07TVhG.js","assets/sha3-vjzUNIgY.js","assets/meta-B2fHYlPD-DH_16FtJ.js","assets/types-Dwy6khXb-CDfHDh3D.js","assets/factory-D6WcIdrN.js","assets/useActiveWallet-Dfe47ngf-B18ACUCH.js","assets/_esm-CGtiWYsn.js","assets/formatAbiItem-Bjq8-8gm.js","assets/parseAbiParameters-BbpX-kcc.js","assets/parseAbi-B_rSF87-.js","assets/ccip-BdemGb5U.js","assets/sendTransaction-Dh1UWy6t.js","assets/builtin_esm-external-require-react-DsuPSzCC.js","assets/context-Dwq6DyUX-C4eyEHX9.js","assets/dist-Dl07uGq1.js","assets/index-WprtZQOU-TFWe44Tm.js","assets/prepareAuthorization-DKsNJVCi.js","assets/esm-DJNUAQDg.js","assets/toViemAccount-BR_5iKjn-Cgtf7drW.js","assets/clsx.m-C6O_Nm9n.js","assets/events-CMzhc0tf.js","assets/src-YxlLH438.js","assets/basics-CftvyfTN.js","assets/paths-BH8W4zMc-PrXAwwu3.js","assets/dist-BuSYCEj0.js","assets/index-CGRuuaiW-BZ3zd-UD.js","assets/sha3-CUMSR674.js","assets/index.es-Cuo0_ki8.js","assets/blakejs-LkvNKXlv.js","assets/PrivyPluginContext-DA-yS5vO-BvJVIr5r.js","assets/canonicalize-Dy8EJuht.js","assets/use-deposit-address-B4tiZEpf-DhGcHSQX.js","assets/wallet-api-DpQiCJdN.js","assets/usePrivy-qIjX1Osk-Dqj9EAjd.js","assets/modal-context-DLxHkqSH-B7iUNFw6.js","assets/get-entropy-details-for-user-Bt9cfAv7-Crtsnj5o.js","assets/Error-C0yEZpNv.js","assets/src-B3K9oOFP.js","assets/moonpay-CngcL6Qf.js","assets/store-BlXVHZKu.js","assets/esm-C3DslVJx.js","assets/meta-4NmijIbE-hsuHgIJs.js","assets/factory-CLXw251O.js","assets/eventemitter3-Bk7uC1fD.js","assets/public-DBLoe1Oh.js","assets/encodeFunctionData-DStcK6WF.js","assets/lru-FP8yqY3J.js","assets/slice-BWZhSsuD.js","assets/localBatchGatewayRequest-CP5FVQUW.js","assets/chain-BGCVek5S.js","assets/Value-CyfJx_yS.js","assets/node-FzGyvMvh.js","assets/stringify-Dn8kG6nZ.js","assets/createBatchScheduler-CC6Bx6eO.js","assets/http-DvQVVZ3j.js","assets/mainnet-BBvM3vUS.js","assets/hashTypedData-Dv8EmWze.js","assets/formatUnits-C2PGnOQx.js","assets/Combination-Cdyh3ZyE.js","assets/chunk-JT4N2T7B-DkhyPGN6.js","assets/factory-DR00Q9RG.css","assets/dist-CafobzAC.js","assets/esm-Bnzz5TQ0.js","assets/AddDriveModal-DhNfP94R-Db7-t28c.js","assets/toast-C6WW-_O--BnFrYYYY.js","assets/i18next-CxmwyrLu.js","assets/ClearStorageModal-DyU-FIgY-EmyEVbqJ.js","assets/reactor-CItc8KaF-C82-SArQ.js","assets/runtime-config-DtJIUgYw-yncHpou3.js","assets/p256-Bbmxp9vE.js","assets/connection-state-Eqc2izmt-DTKlEPf8.js","assets/connect.config-CaXMoB42-VqdFwuy8.js","assets/package-manager-BbzIV9aN-ywzOaaLs.js","assets/pwa-manifest-link-DQRJpF0r-BO1ACdnz.js","assets/tslib.es6-Cno80yFJ-RDtbomIe.js","assets/parser-DtbeHA3H-Ch9-6anB.js","assets/module-BX7gA0wo.js","assets/build-info-BV8UtyA4-vnk7Wd-i.js","assets/null-attachment-transport-D53Rz9lE-D9F9p4EE.js","assets/useTranslation-C3rJ2yqu.js","assets/i18nInstance-CZ6SuJbU.js","assets/shim-C9vegLyg.js","assets/CookiesPolicyModal-BLw4pnhn-BMEgw_d9.js","assets/Trans-DlXtcMdH.js","assets/DebugSettingsModal-CwUN9gIr-DU3Ify9i.js","assets/icon-01W_S_9A-7FJRMZYN.js","assets/src-CrUksCLW-DV3pQOMC.js","assets/bundle-mjs-CQyrl5YK.js","assets/registerServiceWorker-smkROQhm-5rfjT0ui.js","assets/DeleteDriveModal-CjGnG0ht-0JiKrM6c.js","assets/DeleteItemModal-BbY_4_xT-Da6nL2oq.js","assets/DisclaimerModal-DuglmEwL-C0NQbt3Z.js","assets/DownloadDocumentWithErrorsModal-BsPQ5qgy-BiMMFbrN.js","assets/ConfirmDocumentUpgradeModal-DcOZy20m-DPTWgs7L.js","assets/SettingsModal-CgjW-M2a-cl02gX0W.js","assets/useRegistryPackages-DuoU75ap-DiEJJFe0.js","assets/UpgradeDriveModal-CXX6D5Au-C-qcQIPL.js","assets/InspectorModal-Cd8kbCV8-oAxF19f2.js","assets/pglite-seed-Cl2d-iyl-BBapDDmK.js","assets/MissingPackageModal-HFUPQMML-C6p8bl1U.js","assets/DriveAuthRequiredModal-CtsB0kwH-Coud7u2c.js","assets/use-renown-login-BzOSQETV-CpwdVFHK.js","assets/OpenFileDocumentsModal-BQsaBP4x-F5oIaNhF.js","assets/LoginModal-CI0ogC2--mRJsXUXd.js","assets/cookie-banner-BxXvPdIY-CasEfo4n.js","assets/i18n-CTgT1HG--BR9YMkIu.js","assets/preferences-store-DZUIAkHE-BymxR2vb.js","assets/useIsEmbedded-BWJ0qb7w-HnNoATlV.js","assets/load-ftpCX1HI-sPDToliw.js","assets/sentry-jfDyrxdX-gJF7KOR3.js"])))=>i.map(i=>d[i]);
2
- import{n as e}from"./runtime-config-DtJIUgYw-yncHpou3.js";import{n as t,t as n}from"./buffer-DNTcuap_-CIvzq80T.js";import{t as r}from"./preload-helper-BZ1Pz5am.js";import{t as i}from"./mainnet-BBvM3vUS.js";import{a,i as o,n as s,r as c,t as l}from"./sepolia-uUWwDsvQ.js";import{t as u}from"./dist-BUqafLq7.js";import{n as d,r as f,t as p}from"./toast-C6WW-_O--BnFrYYYY.js";import{C as m,O as h,_ as g,b as _,c as v,g as y,h as b,p as x,t as S,u as C,v as w,w as T,y as E}from"./connection-state-Eqc2izmt-DTKlEPf8.js";import{a as D,i as ee,r as O}from"./connect.config-CaXMoB42-VqdFwuy8.js";import{t as te}from"./module-BX7gA0wo.js";import{t as k}from"./Trans-DlXtcMdH.js";import{t as A}from"./useTranslation-C3rJ2yqu.js";import"./i18n-CTgT1HG--BR9YMkIu.js";import{t as j}from"./icon-01W_S_9A-7FJRMZYN.js";import{n as M}from"./bundle-mjs-CQyrl5YK.js";import{n as ne,t as re}from"./src-CrUksCLW-DV3pQOMC.js";import{n as N,r as ie,t as ae}from"./registerServiceWorker-smkROQhm-5rfjT0ui.js";import{t as oe}from"./use-renown-login-BzOSQETV-CpwdVFHK.js";import{n as P}from"./useIsEmbedded-BWJ0qb7w-HnNoATlV.js";import{n as F,t as I}from"./app-skeleton--Me5zlSz-v-w_hTKL.js";import{n as L,t as se}from"./preferences-store-DZUIAkHE-BymxR2vb.js";import{t as ce}from"./sentry-jfDyrxdX-gJF7KOR3.js";import{t as le}from"./types-Dwy6khXb-CDfHDh3D.js";import{n as R,t as ue}from"./meta-B2fHYlPD-DH_16FtJ.js";import{n as de,t as fe}from"./meta-4NmijIbE-hsuHgIJs.js";import{Fragment as pe,jsx as z,jsxs as B}from"react/jsx-runtime";import{childLogger as me}from"document-model";import{z as V}from"zod";import{DriveCollectionId as he,RenownWalletProvider as ge,addFileWithProgress as _e,getRevisionFromDate as ve,logout as ye,setPHAppConfig as be,setPHDocumentEditorConfig as xe,setRevisionHistoryVisible as Se,setSelectedDrive as H,setSelectedNode as Ce,showPHModal as U,useAppModuleById as we,useConnectionStates as Te,useDefaultAppModule as Ee,useDocumentById as De,useDocumentModelModuleById as Oe,useDocumentOperations as ke,useDocumentVersionStatus as Ae,useDrives as je,useEditorModuleById as Me,useEditorPreloader as Ne,useFallbackEditorModule as Pe,useIsAddDriveEnabled as Fe,useNodeParentFolderById as Ie,usePHModal as Le,usePackageDiscoveryService as Re,useReactorClientModule as ze,useRevisionHistoryVisible as Be,useSelectedDocument as Ve,useSelectedDocumentId as He,useSelectedDriveId as Ue,useSelectedDriveSafe as We,useSelectedFolder as Ge,useSelectedTimelineItem as Ke,useSync as qe,useSyncList as Je,useTheme as Ye,useUser as Xe,useVetraPackageManager as Ze,useVetraPackages as Qe}from"@powerhousedao/reactor-browser";import*as W from"react";import $e,{Component as et,StrictMode as tt,Suspense as nt,createContext as rt,createElement as it,lazy as G,useCallback as at,useContext as ot,useEffect as K,useLayoutEffect as st,useMemo as ct,useRef as lt,useState as q,useSyncExternalStore as ut}from"react";import{ConnectSearchBar as dt,ConnectSidebar as ft,ConnectTooltipProvider as pt,DefaultEditorLoader as mt,DriveAuthGate as ht,DropZoneWrapper as gt,Footer as _t,FooterLink as vt,HomeScreen as yt,HomeScreenAddDriveItem as bt,HomeScreenItem as xt,PackageInstallModal as St,RevisionHistory as Ct,SidebarAddDriveItem as wt,SidebarItem as Tt,UploadFileListContainer as Et,formatFileSize as Dt,mapProgressStageToStatus as Ot,useEns as kt}from"@powerhousedao/design-system/connect";import{createAction as At,redo as jt,undo as Mt,withSignaturePolicy as Nt}from"@powerhousedao/shared/document-model";import{setAvailableOffline as Pt,setDriveIcon as Ft,setSharingType as It}from"@powerhousedao/shared/document-drive";import*as Lt from"react-dom";import{ReactorChatFab as Rt,createSwitchboardSchemaTool as zt}from"@powerhousedao/reactor-browser/ai";(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`b8f54f63-862e-5017-822c-cf08ac6f7ca2`)}catch{}})();var Bt={16:async()=>{let[{PGlite:e},{pgDump:t}]=await Promise.all([r(()=>import(`./dist-16wyYGXK.js`),__vite__mapDeps([0,1,2,3,4,5])),r(()=>import(`./pg_dump-C8BPA2zs.js`),__vite__mapDeps([6,1,2]))]);return async n=>{let r=n.replace(/^\/pglite\//,``),i=new e(`idb://${r}`);try{return await i.waitReady,await(await t({pg:i})).text()}finally{await i.close()}}}};async function Vt(e){let t=await m(e,21,g);try{await new Promise((n,r)=>{let i=t.transaction(y,`readwrite`);i.oncomplete=()=>n(),i.onerror=()=>r(w(i,`FILE_DATA clear failed for ${e}`)),i.onabort=()=>r(w(i,`FILE_DATA clear aborted for ${e}`)),i.objectStore(y).clear()})}finally{t.close()}}async function Ht(e){let t=await m(e,21,g);try{return await new Promise((n,r)=>{let i=[],a=t.transaction(y,`readonly`).objectStore(y).openCursor();a.onerror=()=>r(w(a,`FILE_DATA read cursor failed for ${e}`)),a.onsuccess=()=>{let e=a.result;if(!e)return n(i);i.push({key:e.key,value:e.value}),e.continue()}})}finally{t.close()}}async function Ut(e,t){let n=await m(e,21,g);try{await new Promise((r,i)=>{let a=n.transaction(y,`readwrite`);a.oncomplete=()=>r(),a.onerror=()=>i(w(a,`FILE_DATA write failed for ${e}`)),a.onabort=()=>i(w(a,`FILE_DATA write aborted for ${e}`));let o=a.objectStore(y);o.clear();for(let{key:e,value:n}of t)o.put(n,e)})}finally{n.close()}}async function Wt(e,t){await Ut(t,await Ht(e))}function Gt(e,t,n){let r=n,i=typeof r.position==`string`?parseInt(r.position,10):typeof r.position==`number`?r.position:NaN;if(console.error(`[pglite-migration] Restore failed for ${e}`,{message:r.message,code:r.code,severity:r.severity,detail:r.detail,where:r.where,position:r.position,sqlLength:t.length}),Number.isFinite(i)&&i>0){let e=i-1,n=Math.max(0,e-200),r=Math.min(t.length,e+200);console.error(`[pglite-migration] SQL context around position ${i}:\n${t.slice(n,e)}»${t.slice(e,e+1)}«${t.slice(e+1,r)}`)}else console.error(`[pglite-migration] No position info. First 2000 chars of dump:\n${t.slice(0,2e3)}`)}async function Kt(e,t){let n=e.replace(/^\/pglite\//,``),r=new u(`idb://${n}`,{relaxedDurability:!1});try{await r.waitReady;try{await r.exec(`SET standard_conforming_strings = off;`)}catch(e){console.warn(`[pglite-migration] Could not force standard_conforming_strings=off`,e)}try{await r.exec(t)}catch(n){throw Gt(e,t,n),n}}finally{await r.close()}}async function qt(e,t,n){let r=await T(e);if(r===null||r===17)return;if(!E(r)){console.warn(`[pglite-migration] Skipping ${e}: unsupported PG_VERSION=${r}; no migration path.`);return}let i=Bt[r];if(!i)throw Error(`No legacy dumper for supported PG_VERSION=${r} (${e}); SUPPORTED_PG_MAJORS and LEGACY_DUMPERS are out of sync.`);t(`clone`);let a=await n.snapshot(e),o;try{t(`dump`),o=await(await i())(e)}catch(e){throw await n.discard(a),e}try{await Vt(e),t(`restore`),await Kt(e,o)}catch(t){throw await n.rollback(a,e,t),t}await n.commit(a)}var Jt=rt(null),Yt={didCatch:!1,error:null},Xt=class extends et{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Yt}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){let{error:e}=this.state;if(e!==null){var t,n,r=[...arguments];(t=(n=this.props).onReset)==null||t.call(n,{args:r,reason:`imperative-api`}),this.setState(Yt)}}componentDidCatch(e,t){var n,r;(n=(r=this.props).onError)==null||n.call(r,e,t)}componentDidUpdate(e,t){let{didCatch:n}=this.state,{resetKeys:r}=this.props;if(n&&t.error!==null&&Zt(e.resetKeys,r)){var i,a;(i=(a=this.props).onReset)==null||i.call(a,{next:r,prev:e.resetKeys,reason:`keys`}),this.setState(Yt)}}render(){let{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:i,error:a}=this.state,o=e;if(i){let e={error:a,resetErrorBoundary:this.resetErrorBoundary};if(typeof t==`function`)o=t(e);else if(n)o=it(n,e);else if(r!==void 0)o=r;else throw a}return it(Jt.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},o)}};function Zt(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))}function J(){return J=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},J.apply(null,arguments)}var Y;(function(e){e.Pop=`POP`,e.Push=`PUSH`,e.Replace=`REPLACE`})(Y||={});var Qt=`popstate`;function $t(e){e===void 0&&(e={});function t(e,t){let{pathname:n,search:r,hash:i}=e.location;return rn(``,{pathname:n,search:r,hash:i},t.state&&t.state.usr||null,t.state&&t.state.key||`default`)}function n(e,t){return typeof t==`string`?t:an(t)}return sn(t,n,null,e)}function X(e,t){if(e===!1||e==null)throw Error(t)}function en(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function tn(){return Math.random().toString(36).substr(2,8)}function nn(e,t){return{usr:e.state,key:e.key,idx:t}}function rn(e,t,n,r){return n===void 0&&(n=null),J({pathname:typeof e==`string`?e:e.pathname,search:``,hash:``},typeof t==`string`?on(t):t,{state:n,key:t&&t.key||r||tn()})}function an(e){let{pathname:t=`/`,search:n=``,hash:r=``}=e;return n&&n!==`?`&&(t+=n.charAt(0)===`?`?n:`?`+n),r&&r!==`#`&&(t+=r.charAt(0)===`#`?r:`#`+r),t}function on(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function sn(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=Y.Pop,c=null,l=u();l??(l=0,o.replaceState(J({},o.state,{idx:l}),``));function u(){return(o.state||{idx:null}).idx}function d(){s=Y.Pop;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=Y.Push;let r=rn(h.location,e,t);n&&n(r,e),l=u()+1;let d=nn(r,l),f=h.createHref(r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=Y.Replace;let r=rn(h.location,e,t);n&&n(r,e),l=u();let i=nn(r,l),d=h.createHref(r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){let t=i.location.origin===`null`?i.location.href:i.location.origin,n=typeof e==`string`?e:an(e);return n=n.replace(/ $/,`%20`),X(t,`No window.location.(origin|href) available to create URL for href: `+n),new URL(n,t)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(Qt,d),c=e,()=>{i.removeEventListener(Qt,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}var Z;(function(e){e.data=`data`,e.deferred=`deferred`,e.redirect=`redirect`,e.error=`error`})(Z||={});var cn=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`children`]);function ln(e){return e.index===!0}function un(e,t,n,r){return n===void 0&&(n=[]),r===void 0&&(r={}),e.map((e,i)=>{let a=[...n,String(i)],o=typeof e.id==`string`?e.id:a.join(`-`);if(X(e.index!==!0||!e.children,`Cannot specify children on an index route`),X(!r[o],`Found a route id collision on id "`+o+`". Route id's must be globally unique within Data Router usages`),ln(e)){let n=J({},e,t(e),{id:o});return r[o]=n,n}{let n=J({},e,t(e),{id:o,children:void 0});return r[o]=n,e.children&&(n.children=un(e.children,t,a,r)),n}})}function dn(e,t,n){return n===void 0&&(n=`/`),fn(e,t,n,!1)}function fn(e,t,n,r){let i=An((typeof t==`string`?on(t):t).pathname||`/`,n);if(i==null)return null;let a=mn(e);gn(a);let o=null,s=kn(i);for(let e=0;o==null&&e<a.length;++e)o=En(a[e],s,r);return o}function pn(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],handle:n.handle}}function mn(e,t,n,r){t===void 0&&(t=[]),n===void 0&&(n=[]),r===void 0&&(r=``);let i=(e,i,a)=>{let o={relativePath:a===void 0?e.path||``:a,caseSensitive:e.caseSensitive===!0,childrenIndex:i,route:e};o.relativePath.startsWith(`/`)&&(X(o.relativePath.startsWith(r),`Absolute route path "`+o.relativePath+`" nested under path `+(`"`+r+`" is not valid. An absolute child route path `)+`must start with the combined path of all its parent routes.`),o.relativePath=o.relativePath.slice(r.length));let s=Rn([r,o.relativePath]),c=n.concat(o);e.children&&e.children.length>0&&(X(e.index!==!0,`Index routes must not have child routes. Please remove `+(`all child routes from route path "`+s+`".`)),mn(e.children,t,c,s)),(e.path!=null||e.index)&&t.push({path:s,score:wn(s,e.index),routesMeta:c})};return e.forEach((e,t)=>{var n;if(e.path===``||!((n=e.path)!=null&&n.includes(`?`)))i(e,t);else for(let n of hn(e.path))i(e,t,n)}),t}function hn(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 o=hn(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function gn(e){e.sort((e,t)=>e.score===t.score?Tn(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var _n=/^:[\w-]+$/,vn=3,yn=2,bn=1,xn=10,Sn=-2,Cn=e=>e===`*`;function wn(e,t){let n=e.split(`/`),r=n.length;return n.some(Cn)&&(r+=Sn),t&&(r+=yn),n.filter(e=>!Cn(e)).reduce((e,t)=>e+(_n.test(t)?vn:t===``?bn:xn),r)}function Tn(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function En(e,t,n){n===void 0&&(n=!1);let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=Dn({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=Dn({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:Rn([a,u.pathname]),pathnameBase:zn(Rn([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=Rn([a,u.pathnameBase]))}return o}function Dn(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=On(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,t,n)=>{let{paramName:r,isOptional:i}=t;if(r===`*`){let e=s[n]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let c=s[n];return e[r]=i&&!c?void 0:(c||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function On(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),en(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,(e,t,n)=>(r.push({paramName:t,isOptional:n!=null}),n?`/?([^\\/]+)?`:`/([^\\/]+)`));return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function kn(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return en(!1,`The URL path "`+e+`" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent `+(`encoding (`+t+`).`)),e}}function An(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function jn(e,t){t===void 0&&(t=`/`);let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?on(e):e,a;return n?(n=Ln(n),a=n.startsWith(`/`)?Mn(n.substring(1),`/`):Mn(n,t)):a=t,{pathname:a,search:Bn(r),hash:Vn(i)}}function Mn(e,t){let n=t.replace(/\/+$/,``).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function Nn(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 <Link to="..."> and the router will parse it for you.`}function Pn(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Fn(e,t){let n=Pn(e);return t?n.map((e,t)=>t===n.length-1?e.pathname:e.pathnameBase):n.map(e=>e.pathnameBase)}function In(e,t,n,r){r===void 0&&(r=!1);let i;typeof e==`string`?i=on(e):(i=J({},e),X(!i.pathname||!i.pathname.includes(`?`),Nn(`?`,`pathname`,`search`,i)),X(!i.pathname||!i.pathname.includes(`#`),Nn(`#`,`pathname`,`hash`,i)),X(!i.search||!i.search.includes(`#`),Nn(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=jn(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Ln=e=>e.replace(/\/\/+/g,`/`),Rn=e=>Ln(e.join(`/`)),zn=e=>e.replace(/\/+$/,``).replace(/^\/*/,`/`),Bn=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Vn=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Hn=class{constructor(e,t,n,r){r===void 0&&(r=!1),this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Un(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}var Wn=[`post`,`put`,`patch`,`delete`],Gn=new Set(Wn),Kn=[`get`,...Wn],qn=new Set(Kn),Jn=new Set([301,302,303,307,308]),Yn=new Set([307,308]),Xn={state:`idle`,location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Zn={state:`idle`,data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Qn={state:`unblocked`,proceed:void 0,reset:void 0,location:void 0},$n=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,er=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),tr=`remix-router-transitions`;function nr(e){let t=e.window?e.window:typeof window<`u`?window:void 0,n=t!==void 0&&t.document!==void 0&&t.document.createElement!==void 0,r=!n;X(e.routes.length>0,`You must provide a non-empty routes array to createRouter`);let i;if(e.mapRouteProperties)i=e.mapRouteProperties;else if(e.detectErrorBoundary){let t=e.detectErrorBoundary;i=e=>({hasErrorBoundary:t(e)})}else i=er;let a={},o=un(e.routes,i,void 0,a),s,c=e.basename||`/`,l=e.dataStrategy||hr,u=e.patchRoutesOnNavigation,d=J({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),f=null,p=new Set,m=null,h=null,g=null,_=e.hydrationData!=null,v=dn(o,e.history.location,c),y=!1,b=null;if(v==null&&!u){let t=Q(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=kr(o);v=n,b={[r.id]:t}}v&&!e.hydrationData&&ze(v,o,e.history.location.pathname).active&&(v=null);let x;if(!v){if(x=!1,v=[],d.v7_partialHydration){let t=ze(null,o,e.history.location.pathname);t.active&&t.matches&&(y=!0,v=t.matches)}}else if(v.some(e=>e.route.lazy))x=!1;else if(!v.some(e=>e.route.loader))x=!0;else if(d.v7_partialHydration){let t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null;if(n){let e=v.findIndex(e=>n[e.route.id]!==void 0);x=v.slice(0,e+1).every(e=>!cr(e.route,t,n))}else x=v.every(e=>!cr(e.route,t,n))}else x=e.hydrationData!=null;let S,C={historyAction:e.history.action,location:e.history.location,matches:v,initialized:x,navigation:Xn,restoreScrollPosition:e.hydrationData==null&&null,preventScrollReset:!1,revalidation:`idle`,loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||b,fetchers:new Map,blockers:new Map},w=Y.Pop,T=!1,E,D=!1,ee=new Map,O=null,te=!1,k=!1,A=[],j=new Set,M=new Map,ne=0,re=-1,N=new Map,ie=new Set,ae=new Map,oe=new Map,P=new Set,F=new Map,I=new Map,L;function se(){if(f=e.history.listen(t=>{let{action:n,location:r,delta:i}=t;if(L){L(),L=void 0;return}en(I.size===0||i!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let a=Me({currentLocation:C.location,nextLocation:r,historyAction:n});if(a&&i!=null){let t=new Promise(e=>{L=e});e.history.go(i*-1),je(a,{state:`blocked`,location:r,proceed(){je(a,{state:`proceeding`,proceed:void 0,reset:void 0,location:r}),t.then(()=>e.history.go(i))},reset(){let e=new Map(C.blockers);e.set(a,Qn),R({blockers:e})}});return}return pe(n,r)}),n){Qr(t,ee);let e=()=>$r(t,ee);t.addEventListener(`pagehide`,e),O=()=>t.removeEventListener(`pagehide`,e)}return C.initialized||pe(Y.Pop,C.location,{initialHydration:!0}),S}function ce(){f&&f(),O&&O(),p.clear(),E&&E.abort(),C.fetchers.forEach((e,t)=>U(t)),C.blockers.forEach((e,t)=>Ae(t))}function le(e){return p.add(e),()=>p.delete(e)}function R(e,t){t===void 0&&(t={}),C=J({},C,e);let n=[],r=[];d.v7_fetcherPersist&&C.fetchers.forEach((e,t)=>{e.state===`idle`&&(P.has(t)?r.push(t):n.push(t))}),P.forEach(e=>{!C.fetchers.has(e)&&!M.has(e)&&r.push(e)}),[...p].forEach(e=>e(C,{deletedFetchers:r,viewTransitionOpts:t.viewTransitionOpts,flushSync:t.flushSync===!0})),d.v7_fetcherPersist?(n.forEach(e=>C.fetchers.delete(e)),r.forEach(e=>U(e))):r.forEach(e=>P.delete(e))}function ue(t,n,r){let{flushSync:i}=r===void 0?{}:r,a=C.actionData!=null&&C.navigation.formMethod!=null&&Br(C.navigation.formMethod)&&C.navigation.state===`loading`&&t.state?._isRedirect!==!0,c;c=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:a?C.actionData:null;let l=n.loaderData?Er(C.loaderData,n.loaderData,n.matches||[],n.errors):C.loaderData,u=C.blockers;u.size>0&&(u=new Map(u),u.forEach((e,t)=>u.set(t,Qn)));let d=T===!0||C.navigation.formMethod!=null&&Br(C.navigation.formMethod)&&t.state?._isRedirect!==!0;s&&=(o=s,void 0),te||w===Y.Pop||(w===Y.Push?e.history.push(t,t.state):w===Y.Replace&&e.history.replace(t,t.state));let f;if(w===Y.Pop){let e=ee.get(C.location.pathname);e&&e.has(t.pathname)?f={currentLocation:C.location,nextLocation:t}:ee.has(t.pathname)&&(f={currentLocation:t,nextLocation:C.location})}else if(D){let e=ee.get(C.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),ee.set(C.location.pathname,e)),f={currentLocation:C.location,nextLocation:t}}R(J({},n,{actionData:c,loaderData:l,historyAction:w,location:t,initialized:!0,navigation:Xn,revalidation:`idle`,restoreScrollPosition:Re(t,n.matches||C.matches),preventScrollReset:d,blockers:u}),{viewTransitionOpts:f,flushSync:i===!0}),w=Y.Pop,T=!1,D=!1,te=!1,k=!1,A=[]}async function de(t,n){if(typeof t==`number`){e.history.go(t);return}let r=ir(C.location,C.matches,c,d.v7_prependBasename,t,d.v7_relativeSplatPath,n?.fromRouteId,n?.relative),{path:i,submission:a,error:o}=ar(d.v7_normalizeFormMethod,!1,r,n),s=C.location,l=rn(C.location,i,n&&n.state);l=J({},l,e.history.encodeLocation(l));let u=n&&n.replace!=null?n.replace:void 0,f=Y.Push;u===!0?f=Y.Replace:u===!1||a!=null&&Br(a.formMethod)&&a.formAction===C.location.pathname+C.location.search&&(f=Y.Replace);let p=n&&`preventScrollReset`in n?n.preventScrollReset===!0:void 0,m=(n&&n.flushSync)===!0,h=Me({currentLocation:s,nextLocation:l,historyAction:f});if(h){je(h,{state:`blocked`,location:l,proceed(){je(h,{state:`proceeding`,proceed:void 0,reset:void 0,location:l}),de(t,n)},reset(){let e=new Map(C.blockers);e.set(h,Qn),R({blockers:e})}});return}return await pe(f,l,{submission:a,pendingError:o,preventScrollReset:p,replace:n&&n.replace,enableViewTransition:n&&n.viewTransition,flushSync:m})}function fe(){if(xe(),R({revalidation:`loading`}),C.navigation.state!==`submitting`){if(C.navigation.state===`idle`){pe(C.historyAction,C.location,{startUninterruptedRevalidation:!0});return}pe(w||C.historyAction,C.navigation.location,{overrideNavigation:C.navigation,enableViewTransition:D===!0})}}async function pe(t,n,r){E&&E.abort(),E=null,w=t,te=(r&&r.startUninterruptedRevalidation)===!0,Le(C.location,C.matches),T=(r&&r.preventScrollReset)===!0,D=(r&&r.enableViewTransition)===!0;let i=s||o,a=r&&r.overrideNavigation,l=r!=null&&r.initialHydration&&C.matches&&C.matches.length>0&&!y?C.matches:dn(i,n,c),u=(r&&r.flushSync)===!0;if(l&&C.initialized&&!k&&Mr(C.location,n)&&!(r&&r.submission&&Br(r.submission.formMethod))){ue(n,{matches:l},{flushSync:u});return}let d=ze(l,i,n.pathname);if(d.active&&d.matches&&(l=d.matches),!l){let{error:e,notFoundMatches:t,route:r}=Ne(n.pathname);ue(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:u});return}E=new AbortController;let f=xr(e.history,n,E.signal,r&&r.submission),p;if(r&&r.pendingError)p=[Or(l).route.id,{type:Z.error,error:r.pendingError}];else if(r&&r.submission&&Br(r.submission.formMethod)){let t=await z(f,n,r.submission,l,d.active,{replace:r.replace,flushSync:u});if(t.shortCircuited)return;if(t.pendingActionResult){let[e,r]=t.pendingActionResult;if($(r)&&Un(r.error)&&r.error.status===404){E=null,ue(n,{matches:t.matches,loaderData:{},errors:{[e]:r.error}});return}}l=t.matches||l,p=t.pendingActionResult,a=qr(n,r.submission),u=!1,d.active=!1,f=xr(e.history,f.url,f.signal)}let{shortCircuited:m,matches:h,loaderData:g,errors:_}=await B(f,n,l,d.active,a,r&&r.submission,r&&r.fetcherSubmission,r&&r.replace,r&&r.initialHydration===!0,u,p);m||(E=null,ue(n,J({matches:h||l},Dr(p),{loaderData:g,errors:_})))}async function z(t,n,r,i,a,o){if(o===void 0&&(o={}),xe(),R({navigation:Jr(n,r)},{flushSync:o.flushSync===!0}),a){let e=await Be(i,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){let t=Or(e.partialMatches).route.id;return{matches:e.partialMatches,pendingActionResult:[t,{type:Z.error,error:e.error}]}}if(e.matches)i=e.matches;else{let{notFoundMatches:e,error:t,route:r}=Ne(n.pathname);return{matches:e,pendingActionResult:[r.id,{type:Z.error,error:t}]}}}let s,l=Gr(i,n);if(!l.route.action&&!l.route.lazy)s={type:Z.error,error:Q(405,{method:t.method,pathname:n.pathname,routeId:l.route.id})};else if(s=(await ye(`action`,C,t,[l],i,null))[l.route.id],t.signal.aborted)return{shortCircuited:!0};if(Fr(s)){let n;return n=o&&o.replace!=null?o.replace:br(s.response.headers.get(`Location`),new URL(t.url),c,e.history)===C.location.pathname+C.location.search,await ve(t,s,!0,{submission:r,replace:n}),{shortCircuited:!0}}if(Pr(s))throw Q(400,{type:`defer-action`});if($(s)){let e=Or(i,l.route.id);return(o&&o.replace)!==!0&&(w=Y.Push),{matches:i,pendingActionResult:[e.route.id,s]}}return{matches:i,pendingActionResult:[l.route.id,s]}}async function B(t,n,r,i,a,l,u,f,p,m,h){let g=a||qr(n,l),_=l||u||Kr(g),v=!te&&(!d.v7_partialHydration||!p);if(i){if(v){let e=me(h);R(J({navigation:g},e===void 0?{}:{actionData:e}),{flushSync:m})}let e=await Be(r,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){let t=Or(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}if(e.matches)r=e.matches;else{let{error:e,notFoundMatches:t,route:r}=Ne(n.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}}let y=s||o,[b,x]=sr(e.history,C,r,_,n,d.v7_partialHydration&&p===!0,d.v7_skipActionErrorRevalidation,k,A,j,P,ae,ie,y,c,h);if(Pe(e=>!(r&&r.some(t=>t.route.id===e))||b&&b.some(t=>t.route.id===e)),re=++ne,b.length===0&&x.length===0){let e=De();return ue(n,J({matches:r,loaderData:{},errors:h&&$(h[1])?{[h[0]]:h[1].error}:null},Dr(h),e?{fetchers:new Map(C.fetchers)}:{}),{flushSync:m}),{shortCircuited:!0}}if(v){let e={};if(!i){e.navigation=g;let t=me(h);t!==void 0&&(e.actionData=t)}x.length>0&&(e.fetchers=V(x)),R(e,{flushSync:m})}x.forEach(e=>{Te(e.key),e.controller&&M.set(e.key,e.controller)});let S=()=>x.forEach(e=>Te(e.key));E&&E.signal.addEventListener(`abort`,S);let{loaderResults:w,fetcherResults:T}=await be(C,r,b,x,t);if(t.signal.aborted)return{shortCircuited:!0};E&&E.signal.removeEventListener(`abort`,S),x.forEach(e=>M.delete(e.key));let D=Ar(w);if(D)return await ve(t,D.result,!0,{replace:f}),{shortCircuited:!0};if(D=Ar(T),D)return ie.add(D.key),await ve(t,D.result,!0,{replace:f}),{shortCircuited:!0};let{loaderData:ee,errors:O}=Tr(C,r,w,h,x,T,F);F.forEach((e,t)=>{e.subscribe(n=>{(n||e.done)&&F.delete(t)})}),d.v7_partialHydration&&p&&C.errors&&(O=J({},C.errors,O));let N=De(),oe=Oe(re),I=N||oe||x.length>0;return J({matches:r,loaderData:ee,errors:O},I?{fetchers:new Map(C.fetchers)}:{})}function me(e){if(e&&!$(e[1]))return{[e[0]]:e[1].data};if(C.actionData)return Object.keys(C.actionData).length===0?null:C.actionData}function V(e){return e.forEach(e=>{let t=C.fetchers.get(e.key),n=Yr(void 0,t?t.data:void 0);C.fetchers.set(e.key,n)}),new Map(C.fetchers)}function he(e,t,n,i){if(r)throw Error(`router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.`);Te(e);let a=(i&&i.flushSync)===!0,l=s||o,u=ir(C.location,C.matches,c,d.v7_prependBasename,n,d.v7_relativeSplatPath,t,i?.relative),f=dn(l,u,c),p=ze(f,l,u);if(p.active&&p.matches&&(f=p.matches),!f){H(e,t,Q(404,{pathname:u}),{flushSync:a});return}let{path:m,submission:h,error:g}=ar(d.v7_normalizeFormMethod,!0,u,i);if(g){H(e,t,g,{flushSync:a});return}let _=Gr(f,m),v=(i&&i.preventScrollReset)===!0;if(h&&Br(h.formMethod)){ge(e,t,m,_,f,p.active,a,v,h);return}ae.set(e,{routeId:t,path:m}),_e(e,t,m,_,f,p.active,a,v,h)}async function ge(t,n,r,i,a,l,u,f,p){xe(),ae.delete(t);function m(e){return!e.route.action&&!e.route.lazy&&(H(t,n,Q(405,{method:p.formMethod,pathname:r,routeId:n}),{flushSync:u}),!0)}if(!l&&m(i))return;Se(t,Xr(p,C.fetchers.get(t)),{flushSync:u});let h=new AbortController,g=xr(e.history,r,h.signal,p);if(l){let e=await Be(a,new URL(g.url).pathname,g.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){H(t,n,e.error,{flushSync:u});return}if(!e.matches){H(t,n,Q(404,{pathname:r}),{flushSync:u});return}if(a=e.matches,i=Gr(a,r),m(i))return}M.set(t,h);let _=ne,v=(await ye(`action`,C,g,[i],a,t))[i.route.id];if(g.signal.aborted){M.get(t)===h&&M.delete(t);return}if(d.v7_fetcherPersist&&P.has(t)){if(Fr(v)||$(v)){Se(t,Zr(void 0));return}}else{if(Fr(v)){if(M.delete(t),re>_){Se(t,Zr(void 0));return}return ie.add(t),Se(t,Yr(p)),ve(g,v,!1,{fetcherSubmission:p,preventScrollReset:f})}if($(v)){H(t,n,v.error);return}}if(Pr(v))throw Q(400,{type:`defer-action`});let y=C.navigation.location||C.location,b=xr(e.history,y,h.signal),x=s||o,S=C.navigation.state===`idle`?C.matches:dn(x,C.navigation.location,c);X(S,`Didn't find any matches after fetcher action`);let T=++ne;N.set(t,T);let D=Yr(p,v.data);C.fetchers.set(t,D);let[ee,O]=sr(e.history,C,S,p,y,!1,d.v7_skipActionErrorRevalidation,k,A,j,P,ae,ie,x,c,[i.route.id,v]);O.filter(e=>e.key!==t).forEach(e=>{let t=e.key,n=C.fetchers.get(t),r=Yr(void 0,n?n.data:void 0);C.fetchers.set(t,r),Te(t),e.controller&&M.set(t,e.controller)}),R({fetchers:new Map(C.fetchers)});let te=()=>O.forEach(e=>Te(e.key));h.signal.addEventListener(`abort`,te);let{loaderResults:oe,fetcherResults:I}=await be(C,S,ee,O,b);if(h.signal.aborted)return;h.signal.removeEventListener(`abort`,te),N.delete(t),M.delete(t),O.forEach(e=>M.delete(e.key));let L=Ar(oe);if(L)return ve(b,L.result,!1,{preventScrollReset:f});if(L=Ar(I),L)return ie.add(L.key),ve(b,L.result,!1,{preventScrollReset:f});let{loaderData:se,errors:ce}=Tr(C,S,oe,void 0,O,I,F);if(C.fetchers.has(t)){let e=Zr(v.data);C.fetchers.set(t,e)}Oe(T),C.navigation.state===`loading`&&T>re?(X(w,`Expected pending action`),E&&E.abort(),ue(C.navigation.location,{matches:S,loaderData:se,errors:ce,fetchers:new Map(C.fetchers)})):(R({errors:ce,loaderData:Er(C.loaderData,se,S,ce),fetchers:new Map(C.fetchers)}),k=!1)}async function _e(t,n,r,i,a,o,s,c,l){let u=C.fetchers.get(t);Se(t,Yr(l,u?u.data:void 0),{flushSync:s});let d=new AbortController,f=xr(e.history,r,d.signal);if(o){let e=await Be(a,new URL(f.url).pathname,f.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){H(t,n,e.error,{flushSync:s});return}if(e.matches)a=e.matches,i=Gr(a,r);else{H(t,n,Q(404,{pathname:r}),{flushSync:s});return}}M.set(t,d);let p=ne,m=(await ye(`loader`,C,f,[i],a,t))[i.route.id];if(Pr(m)&&(m=await Ur(m,f.signal,!0)||m),M.get(t)===d&&M.delete(t),!f.signal.aborted){if(P.has(t)){Se(t,Zr(void 0));return}if(Fr(m)){if(re>p){Se(t,Zr(void 0));return}ie.add(t),await ve(f,m,!1,{preventScrollReset:c});return}if($(m)){H(t,n,m.error);return}X(!Pr(m),`Unhandled fetcher deferred data`),Se(t,Zr(m.data))}}async function ve(r,i,a,o){let{submission:s,fetcherSubmission:l,preventScrollReset:u,replace:d}=o===void 0?{}:o;i.response.headers.has(`X-Remix-Revalidate`)&&(k=!0);let f=i.response.headers.get(`Location`);X(f,`Expected a Location header on the redirect Response`),f=br(f,new URL(r.url),c,e.history);let p=rn(C.location,f,{_isRedirect:!0});if(n){let n=!1;if(i.response.headers.has(`X-Remix-Reload-Document`))n=!0;else if($n.test(f)){let r=e.history.createURL(f);n=r.origin!==t.location.origin||An(r.pathname,c)==null}if(n){d?t.location.replace(f):t.location.assign(f);return}}E=null;let m=d===!0||i.response.headers.has(`X-Remix-Replace`)?Y.Replace:Y.Push,{formMethod:h,formAction:g,formEncType:_}=C.navigation;!s&&!l&&h&&g&&_&&(s=Kr(C.navigation));let v=s||l;Yn.has(i.response.status)&&v&&Br(v.formMethod)?await pe(m,p,{submission:J({},v,{formAction:f}),preventScrollReset:u||T,enableViewTransition:a?D:void 0}):await pe(m,p,{overrideNavigation:qr(p,s),fetcherSubmission:l,preventScrollReset:u||T,enableViewTransition:a?D:void 0})}async function ye(e,t,n,r,o,s){let u,f={};try{u=await gr(l,e,t,n,r,o,s,a,i)}catch(e){return r.forEach(t=>{f[t.route.id]={type:Z.error,error:e}}),f}for(let[e,t]of Object.entries(u))if(Nr(t)){let r=t.result;f[e]={type:Z.redirect,response:yr(r,n,e,o,c,d.v7_relativeSplatPath)}}else f[e]=await vr(t);return f}async function be(t,n,r,i,a){let o=t.matches,s=ye(`loader`,t,a,r,n,null),c=Promise.all(i.map(async n=>{if(n.matches&&n.match&&n.controller){let r=(await ye(`loader`,t,xr(e.history,n.path,n.controller.signal),[n.match],n.matches,n.key))[n.match.route.id];return{[n.key]:r}}return Promise.resolve({[n.key]:{type:Z.error,error:Q(404,{pathname:n.path})}})})),l=await s,u=(await c).reduce((e,t)=>Object.assign(e,t),{});return await Promise.all([Vr(n,l,a.signal,o,t.loaderData),Hr(n,u,i)]),{loaderResults:l,fetcherResults:u}}function xe(){k=!0,A.push(...Pe()),ae.forEach((e,t)=>{M.has(t)&&j.add(t),Te(t)})}function Se(e,t,n){n===void 0&&(n={}),C.fetchers.set(e,t),R({fetchers:new Map(C.fetchers)},{flushSync:(n&&n.flushSync)===!0})}function H(e,t,n,r){r===void 0&&(r={});let i=Or(C.matches,t);U(e),R({errors:{[i.route.id]:n},fetchers:new Map(C.fetchers)},{flushSync:(r&&r.flushSync)===!0})}function Ce(e){return oe.set(e,(oe.get(e)||0)+1),P.has(e)&&P.delete(e),C.fetchers.get(e)||Zn}function U(e){let t=C.fetchers.get(e);M.has(e)&&!(t&&t.state===`loading`&&N.has(e))&&Te(e),ae.delete(e),N.delete(e),ie.delete(e),d.v7_fetcherPersist&&P.delete(e),j.delete(e),C.fetchers.delete(e)}function we(e){let t=(oe.get(e)||0)-1;t<=0?(oe.delete(e),P.add(e),d.v7_fetcherPersist||U(e)):oe.set(e,t),R({fetchers:new Map(C.fetchers)})}function Te(e){let t=M.get(e);t&&(t.abort(),M.delete(e))}function Ee(e){for(let t of e){let e=Zr(Ce(t).data);C.fetchers.set(t,e)}}function De(){let e=[],t=!1;for(let n of ie){let r=C.fetchers.get(n);X(r,`Expected fetcher: `+n),r.state===`loading`&&(ie.delete(n),e.push(n),t=!0)}return Ee(e),t}function Oe(e){let t=[];for(let[n,r]of N)if(r<e){let e=C.fetchers.get(n);X(e,`Expected fetcher: `+n),e.state===`loading`&&(Te(n),N.delete(n),t.push(n))}return Ee(t),t.length>0}function ke(e,t){let n=C.blockers.get(e)||Qn;return I.get(e)!==t&&I.set(e,t),n}function Ae(e){C.blockers.delete(e),I.delete(e)}function je(e,t){let n=C.blockers.get(e)||Qn;X(n.state===`unblocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`proceeding`||n.state===`blocked`&&t.state===`unblocked`||n.state===`proceeding`&&t.state===`unblocked`,`Invalid blocker state transition: `+n.state+` -> `+t.state);let r=new Map(C.blockers);r.set(e,t),R({blockers:r})}function Me(e){let{currentLocation:t,nextLocation:n,historyAction:r}=e;if(I.size===0)return;I.size>1&&en(!1,`A router only supports one blocker at a time`);let i=Array.from(I.entries()),[a,o]=i[i.length-1],s=C.blockers.get(a);if(!(s&&s.state===`proceeding`)&&o({currentLocation:t,nextLocation:n,historyAction:r}))return a}function Ne(e){let t=Q(404,{pathname:e}),{matches:n,route:r}=kr(s||o);return Pe(),{notFoundMatches:n,route:r,error:t}}function Pe(e){let t=[];return F.forEach((n,r)=>{(!e||e(r))&&(n.cancel(),t.push(r),F.delete(r))}),t}function Fe(e,t,n){if(m=e,g=t,h=n||null,!_&&C.navigation===Xn){_=!0;let e=Re(C.location,C.matches);e!=null&&R({restoreScrollPosition:e})}return()=>{m=null,g=null,h=null}}function Ie(e,t){return h&&h(e,t.map(e=>pn(e,C.loaderData)))||e.key}function Le(e,t){if(m&&g){let n=Ie(e,t);m[n]=g()}}function Re(e,t){if(m){let n=Ie(e,t),r=m[n];if(typeof r==`number`)return r}return null}function ze(e,t,n){if(u){if(!e)return{active:!0,matches:fn(t,n,c,!0)||[]};if(Object.keys(e[0].params).length>0)return{active:!0,matches:fn(t,n,c,!0)}}return{active:!1,matches:null}}async function Be(e,t,n,r){if(!u)return{type:`success`,matches:e};let l=e;for(;;){let e=s==null,d=s||o,f=a;try{await u({signal:n,path:t,matches:l,fetcherKey:r,patch:(e,t)=>{n.aborted||fr(e,t,d,f,i)}})}catch(e){return{type:`error`,error:e,partialMatches:l}}finally{e&&!n.aborted&&(o=[...o])}if(n.aborted)return{type:`aborted`};let p=dn(d,t,c);if(p)return{type:`success`,matches:p};let m=fn(d,t,c,!0);if(!m||l.length===m.length&&l.every((e,t)=>e.route.id===m[t].route.id))return{type:`success`,matches:null};l=m}}function Ve(e){a={},s=un(e,i,void 0,a)}function He(e,t){let n=s==null;fr(e,t,s||o,a,i),n&&(o=[...o],R({}))}return S={get basename(){return c},get future(){return d},get state(){return C},get routes(){return o},get window(){return t},initialize:se,subscribe:le,enableScrollRestoration:Fe,navigate:de,fetch:he,revalidate:fe,createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:Ce,deleteFetcher:we,dispose:ce,getBlocker:ke,deleteBlocker:Ae,patchRoutes:He,_internalFetchControllers:M,_internalActiveDeferreds:F,_internalSetRoutes:Ve},S}function rr(e){return e!=null&&(`formData`in e&&e.formData!=null||`body`in e&&e.body!==void 0)}function ir(e,t,n,r,i,a,o,s){let c,l;if(o){c=[];for(let e of t)if(c.push(e),e.route.id===o){l=e;break}}else c=t,l=t[t.length-1];let u=In(i||`.`,Fn(c,a),An(e.pathname,n)||e.pathname,s===`path`);if(i??(u.search=e.search,u.hash=e.hash),(i==null||i===``||i===`.`)&&l){let e=Wr(u.search);if(l.route.index&&!e)u.search=u.search?u.search.replace(/^\?/,`?index&`):`?index`;else if(!l.route.index&&e){let e=new URLSearchParams(u.search),t=e.getAll(`index`);e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();u.search=n?`?`+n:``}}return r&&n!==`/`&&(u.pathname=u.pathname===`/`?n:Rn([n,u.pathname])),an(u)}function ar(e,t,n,r){if(!r||!rr(r))return{path:n};if(r.formMethod&&!zr(r.formMethod))return{path:n,error:Q(405,{method:r.formMethod})};let i=()=>({path:n,error:Q(400,{type:`invalid-body`})}),a=r.formMethod||`get`,o=e?a.toUpperCase():a.toLowerCase(),s=jr(n);if(r.body!==void 0){if(r.formEncType===`text/plain`){if(!Br(o))return i();let e=typeof r.body==`string`?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((e,t)=>{let[n,r]=t;return``+e+n+`=`+r+`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-16wyYGXK.js","assets/rolldown-runtime-BcKkbAw3.js","assets/preload-helper-BZ1Pz5am.js","assets/chunk-BTBUZ646--Q_mGPOy.js","assets/chunk-WGR4JCLS-BXpTqGmk.js","assets/chunk-EADU5A67-BqqDB7-A.js","assets/pg_dump-C8BPA2zs.js","assets/factory-CGO-x_eD.js","assets/sha256-Bh9Gbylw.js","assets/sha2-DAzSwLJP.js","assets/utils-N6OADHW2.js","assets/secp256k1-D1r0jdlq.js","assets/utils-oVEYY1QK.js","assets/hmac-DoN68dA-.js","assets/hashTypedData-Qe07TVhG.js","assets/sha3-vjzUNIgY.js","assets/meta-B2fHYlPD-DH_16FtJ.js","assets/types-Dwy6khXb-CDfHDh3D.js","assets/factory-D6WcIdrN.js","assets/useActiveWallet-Dfe47ngf-B18ACUCH.js","assets/_esm-CGtiWYsn.js","assets/formatAbiItem-Bjq8-8gm.js","assets/parseAbiParameters-BbpX-kcc.js","assets/parseAbi-B_rSF87-.js","assets/ccip-BdemGb5U.js","assets/sendTransaction-Dh1UWy6t.js","assets/builtin_esm-external-require-react-DsuPSzCC.js","assets/context-Dwq6DyUX-C4eyEHX9.js","assets/dist-Dl07uGq1.js","assets/index-WprtZQOU-TFWe44Tm.js","assets/prepareAuthorization-DKsNJVCi.js","assets/esm-DJNUAQDg.js","assets/toViemAccount-BR_5iKjn-Cgtf7drW.js","assets/clsx.m-C6O_Nm9n.js","assets/events-CMzhc0tf.js","assets/src-YxlLH438.js","assets/basics-CftvyfTN.js","assets/paths-BH8W4zMc-PrXAwwu3.js","assets/dist-BuSYCEj0.js","assets/index-CGRuuaiW-BZ3zd-UD.js","assets/sha3-CUMSR674.js","assets/index.es-Cuo0_ki8.js","assets/blakejs-LkvNKXlv.js","assets/PrivyPluginContext-DA-yS5vO-BvJVIr5r.js","assets/canonicalize-Dy8EJuht.js","assets/use-deposit-address-B4tiZEpf-DhGcHSQX.js","assets/wallet-api-DpQiCJdN.js","assets/usePrivy-qIjX1Osk-Dqj9EAjd.js","assets/modal-context-DLxHkqSH-B7iUNFw6.js","assets/get-entropy-details-for-user-Bt9cfAv7-Crtsnj5o.js","assets/Error-C0yEZpNv.js","assets/src-B3K9oOFP.js","assets/moonpay-CngcL6Qf.js","assets/store-BlXVHZKu.js","assets/esm-C3DslVJx.js","assets/meta-4NmijIbE-hsuHgIJs.js","assets/factory-CLXw251O.js","assets/eventemitter3-Bk7uC1fD.js","assets/public-DBLoe1Oh.js","assets/encodeFunctionData-DStcK6WF.js","assets/lru-FP8yqY3J.js","assets/slice-BWZhSsuD.js","assets/localBatchGatewayRequest-CP5FVQUW.js","assets/chain-BGCVek5S.js","assets/Value-CyfJx_yS.js","assets/node-FzGyvMvh.js","assets/stringify-Dn8kG6nZ.js","assets/createBatchScheduler-CC6Bx6eO.js","assets/http-DvQVVZ3j.js","assets/mainnet-BBvM3vUS.js","assets/hashTypedData-Dv8EmWze.js","assets/formatUnits-C2PGnOQx.js","assets/Combination-Cdyh3ZyE.js","assets/chunk-JT4N2T7B-DkhyPGN6.js","assets/factory-DR00Q9RG.css","assets/dist-CafobzAC.js","assets/esm-Bnzz5TQ0.js","assets/AddDriveModal-DhNfP94R-Db7-t28c.js","assets/toast-C6WW-_O--BnFrYYYY.js","assets/i18next-CxmwyrLu.js","assets/ClearStorageModal-DyU-FIgY-C2SQvwxh.js","assets/reactor-CItc8KaF-DIjxfM4l.js","assets/runtime-config-DtJIUgYw-yncHpou3.js","assets/p256-Bbmxp9vE.js","assets/connection-state-Eqc2izmt-DYeEdoBH.js","assets/connect.config-CaXMoB42-DPDK2YJi.js","assets/package-manager-BbzIV9aN-ywzOaaLs.js","assets/pwa-manifest-link-DQRJpF0r-BO1ACdnz.js","assets/tslib.es6-Cno80yFJ-RDtbomIe.js","assets/parser-DtbeHA3H-Ch9-6anB.js","assets/module-BX7gA0wo.js","assets/build-info-BV8UtyA4-vnk7Wd-i.js","assets/null-attachment-transport-D53Rz9lE-D9F9p4EE.js","assets/useTranslation-C3rJ2yqu.js","assets/i18nInstance-CZ6SuJbU.js","assets/shim-C9vegLyg.js","assets/CookiesPolicyModal-BLw4pnhn-BMEgw_d9.js","assets/Trans-DlXtcMdH.js","assets/DebugSettingsModal-CwUN9gIr-C27CiPQG.js","assets/icon-01W_S_9A-7FJRMZYN.js","assets/src-CrUksCLW-DV3pQOMC.js","assets/bundle-mjs-CQyrl5YK.js","assets/registerServiceWorker-smkROQhm-Qbc3RMCx.js","assets/DeleteDriveModal-CjGnG0ht-0JiKrM6c.js","assets/DeleteItemModal-BbY_4_xT-Da6nL2oq.js","assets/DisclaimerModal-DuglmEwL-C0NQbt3Z.js","assets/DownloadDocumentWithErrorsModal-BsPQ5qgy-BiMMFbrN.js","assets/ConfirmDocumentUpgradeModal-DcOZy20m-DPTWgs7L.js","assets/SettingsModal-CgjW-M2a-BbUA87ne.js","assets/useRegistryPackages-DuoU75ap-DiEJJFe0.js","assets/UpgradeDriveModal-CXX6D5Au-C-qcQIPL.js","assets/InspectorModal-Cd8kbCV8-D9TUaRon.js","assets/pglite-seed-Cl2d-iyl-Abmu_EqV.js","assets/MissingPackageModal-HFUPQMML-C6p8bl1U.js","assets/DriveAuthRequiredModal-CtsB0kwH-Coud7u2c.js","assets/use-renown-login-BzOSQETV-CpwdVFHK.js","assets/OpenFileDocumentsModal-BQsaBP4x-HmKTWcS8.js","assets/LoginModal-CI0ogC2--mRJsXUXd.js","assets/cookie-banner-BxXvPdIY-DciefBm4.js","assets/i18n-CTgT1HG--BR9YMkIu.js","assets/preferences-store-DZUIAkHE-BwJzNFRa.js","assets/useIsEmbedded-BWJ0qb7w-HnNoATlV.js","assets/load-ftpCX1HI-C4L1Z5YI.js","assets/sentry-jfDyrxdX-gJF7KOR3.js"])))=>i.map(i=>d[i]);
2
+ import{n as e}from"./runtime-config-DtJIUgYw-yncHpou3.js";import{n as t,t as n}from"./buffer-DNTcuap_-CIvzq80T.js";import{t as r}from"./preload-helper-BZ1Pz5am.js";import{t as i}from"./mainnet-BBvM3vUS.js";import{a,i as o,n as s,r as c,t as l}from"./sepolia-uUWwDsvQ.js";import{t as u}from"./dist-BUqafLq7.js";import{n as d,r as f,t as p}from"./toast-C6WW-_O--BnFrYYYY.js";import{C as m,O as h,_ as g,b as _,c as v,g as y,h as b,p as x,t as S,u as C,v as w,w as T,y as E}from"./connection-state-Eqc2izmt-DYeEdoBH.js";import{a as D,i as ee,r as O}from"./connect.config-CaXMoB42-DPDK2YJi.js";import{t as te}from"./module-BX7gA0wo.js";import{t as k}from"./Trans-DlXtcMdH.js";import{t as A}from"./useTranslation-C3rJ2yqu.js";import"./i18n-CTgT1HG--BR9YMkIu.js";import{t as j}from"./icon-01W_S_9A-7FJRMZYN.js";import{n as M}from"./bundle-mjs-CQyrl5YK.js";import{n as ne,t as re}from"./src-CrUksCLW-DV3pQOMC.js";import{n as N,r as ie,t as ae}from"./registerServiceWorker-smkROQhm-Qbc3RMCx.js";import{t as oe}from"./use-renown-login-BzOSQETV-CpwdVFHK.js";import{n as P}from"./useIsEmbedded-BWJ0qb7w-HnNoATlV.js";import{n as F,t as I}from"./app-skeleton--Me5zlSz-v-w_hTKL.js";import{n as L,t as se}from"./preferences-store-DZUIAkHE-BwJzNFRa.js";import{t as ce}from"./sentry-jfDyrxdX-gJF7KOR3.js";import{t as le}from"./types-Dwy6khXb-CDfHDh3D.js";import{n as R,t as ue}from"./meta-B2fHYlPD-DH_16FtJ.js";import{n as de,t as fe}from"./meta-4NmijIbE-hsuHgIJs.js";import{Fragment as pe,jsx as z,jsxs as B}from"react/jsx-runtime";import{childLogger as me}from"document-model";import{z as V}from"zod";import{DriveCollectionId as he,RenownWalletProvider as ge,addFileWithProgress as _e,getRevisionFromDate as ve,logout as ye,setPHAppConfig as be,setPHDocumentEditorConfig as xe,setRevisionHistoryVisible as Se,setSelectedDrive as H,setSelectedNode as Ce,showPHModal as U,useAppModuleById as we,useConnectionStates as Te,useDefaultAppModule as Ee,useDocumentById as De,useDocumentModelModuleById as Oe,useDocumentOperations as ke,useDocumentVersionStatus as Ae,useDrives as je,useEditorModuleById as Me,useEditorPreloader as Ne,useFallbackEditorModule as Pe,useIsAddDriveEnabled as Fe,useNodeParentFolderById as Ie,usePHModal as Le,usePackageDiscoveryService as Re,useReactorClientModule as ze,useRevisionHistoryVisible as Be,useSelectedDocument as Ve,useSelectedDocumentId as He,useSelectedDriveId as Ue,useSelectedDriveSafe as We,useSelectedFolder as Ge,useSelectedTimelineItem as Ke,useSync as qe,useSyncList as Je,useTheme as Ye,useUser as Xe,useVetraPackageManager as Ze,useVetraPackages as Qe}from"@powerhousedao/reactor-browser";import*as W from"react";import $e,{Component as et,StrictMode as tt,Suspense as nt,createContext as rt,createElement as it,lazy as G,useCallback as at,useContext as ot,useEffect as K,useLayoutEffect as st,useMemo as ct,useRef as lt,useState as q,useSyncExternalStore as ut}from"react";import{ConnectSearchBar as dt,ConnectSidebar as ft,ConnectTooltipProvider as pt,DefaultEditorLoader as mt,DriveAuthGate as ht,DropZoneWrapper as gt,Footer as _t,FooterLink as vt,HomeScreen as yt,HomeScreenAddDriveItem as bt,HomeScreenItem as xt,PackageInstallModal as St,RevisionHistory as Ct,SidebarAddDriveItem as wt,SidebarItem as Tt,UploadFileListContainer as Et,formatFileSize as Dt,mapProgressStageToStatus as Ot,useEns as kt}from"@powerhousedao/design-system/connect";import{createAction as At,redo as jt,undo as Mt,withSignaturePolicy as Nt}from"@powerhousedao/shared/document-model";import{setAvailableOffline as Pt,setDriveIcon as Ft,setSharingType as It}from"@powerhousedao/shared/document-drive";import*as Lt from"react-dom";import{ReactorChatFab as Rt,createSwitchboardSchemaTool as zt}from"@powerhousedao/reactor-browser/ai";(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`b8f54f63-862e-5017-822c-cf08ac6f7ca2`)}catch{}})();var Bt={16:async()=>{let[{PGlite:e},{pgDump:t}]=await Promise.all([r(()=>import(`./dist-16wyYGXK.js`),__vite__mapDeps([0,1,2,3,4,5])),r(()=>import(`./pg_dump-C8BPA2zs.js`),__vite__mapDeps([6,1,2]))]);return async n=>{let r=n.replace(/^\/pglite\//,``),i=new e(`idb://${r}`);try{return await i.waitReady,await(await t({pg:i})).text()}finally{await i.close()}}}};async function Vt(e){let t=await m(e,21,g);try{await new Promise((n,r)=>{let i=t.transaction(y,`readwrite`);i.oncomplete=()=>n(),i.onerror=()=>r(w(i,`FILE_DATA clear failed for ${e}`)),i.onabort=()=>r(w(i,`FILE_DATA clear aborted for ${e}`)),i.objectStore(y).clear()})}finally{t.close()}}async function Ht(e){let t=await m(e,21,g);try{return await new Promise((n,r)=>{let i=[],a=t.transaction(y,`readonly`).objectStore(y).openCursor();a.onerror=()=>r(w(a,`FILE_DATA read cursor failed for ${e}`)),a.onsuccess=()=>{let e=a.result;if(!e)return n(i);i.push({key:e.key,value:e.value}),e.continue()}})}finally{t.close()}}async function Ut(e,t){let n=await m(e,21,g);try{await new Promise((r,i)=>{let a=n.transaction(y,`readwrite`);a.oncomplete=()=>r(),a.onerror=()=>i(w(a,`FILE_DATA write failed for ${e}`)),a.onabort=()=>i(w(a,`FILE_DATA write aborted for ${e}`));let o=a.objectStore(y);o.clear();for(let{key:e,value:n}of t)o.put(n,e)})}finally{n.close()}}async function Wt(e,t){await Ut(t,await Ht(e))}function Gt(e,t,n){let r=n,i=typeof r.position==`string`?parseInt(r.position,10):typeof r.position==`number`?r.position:NaN;if(console.error(`[pglite-migration] Restore failed for ${e}`,{message:r.message,code:r.code,severity:r.severity,detail:r.detail,where:r.where,position:r.position,sqlLength:t.length}),Number.isFinite(i)&&i>0){let e=i-1,n=Math.max(0,e-200),r=Math.min(t.length,e+200);console.error(`[pglite-migration] SQL context around position ${i}:\n${t.slice(n,e)}»${t.slice(e,e+1)}«${t.slice(e+1,r)}`)}else console.error(`[pglite-migration] No position info. First 2000 chars of dump:\n${t.slice(0,2e3)}`)}async function Kt(e,t){let n=e.replace(/^\/pglite\//,``),r=new u(`idb://${n}`,{relaxedDurability:!1});try{await r.waitReady;try{await r.exec(`SET standard_conforming_strings = off;`)}catch(e){console.warn(`[pglite-migration] Could not force standard_conforming_strings=off`,e)}try{await r.exec(t)}catch(n){throw Gt(e,t,n),n}}finally{await r.close()}}async function qt(e,t,n){let r=await T(e);if(r===null||r===17)return;if(!E(r)){console.warn(`[pglite-migration] Skipping ${e}: unsupported PG_VERSION=${r}; no migration path.`);return}let i=Bt[r];if(!i)throw Error(`No legacy dumper for supported PG_VERSION=${r} (${e}); SUPPORTED_PG_MAJORS and LEGACY_DUMPERS are out of sync.`);t(`clone`);let a=await n.snapshot(e),o;try{t(`dump`),o=await(await i())(e)}catch(e){throw await n.discard(a),e}try{await Vt(e),t(`restore`),await Kt(e,o)}catch(t){throw await n.rollback(a,e,t),t}await n.commit(a)}var Jt=rt(null),Yt={didCatch:!1,error:null},Xt=class extends et{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Yt}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){let{error:e}=this.state;if(e!==null){var t,n,r=[...arguments];(t=(n=this.props).onReset)==null||t.call(n,{args:r,reason:`imperative-api`}),this.setState(Yt)}}componentDidCatch(e,t){var n,r;(n=(r=this.props).onError)==null||n.call(r,e,t)}componentDidUpdate(e,t){let{didCatch:n}=this.state,{resetKeys:r}=this.props;if(n&&t.error!==null&&Zt(e.resetKeys,r)){var i,a;(i=(a=this.props).onReset)==null||i.call(a,{next:r,prev:e.resetKeys,reason:`keys`}),this.setState(Yt)}}render(){let{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:i,error:a}=this.state,o=e;if(i){let e={error:a,resetErrorBoundary:this.resetErrorBoundary};if(typeof t==`function`)o=t(e);else if(n)o=it(n,e);else if(r!==void 0)o=r;else throw a}return it(Jt.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},o)}};function Zt(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))}function J(){return J=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},J.apply(null,arguments)}var Y;(function(e){e.Pop=`POP`,e.Push=`PUSH`,e.Replace=`REPLACE`})(Y||={});var Qt=`popstate`;function $t(e){e===void 0&&(e={});function t(e,t){let{pathname:n,search:r,hash:i}=e.location;return rn(``,{pathname:n,search:r,hash:i},t.state&&t.state.usr||null,t.state&&t.state.key||`default`)}function n(e,t){return typeof t==`string`?t:an(t)}return sn(t,n,null,e)}function X(e,t){if(e===!1||e==null)throw Error(t)}function en(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function tn(){return Math.random().toString(36).substr(2,8)}function nn(e,t){return{usr:e.state,key:e.key,idx:t}}function rn(e,t,n,r){return n===void 0&&(n=null),J({pathname:typeof e==`string`?e:e.pathname,search:``,hash:``},typeof t==`string`?on(t):t,{state:n,key:t&&t.key||r||tn()})}function an(e){let{pathname:t=`/`,search:n=``,hash:r=``}=e;return n&&n!==`?`&&(t+=n.charAt(0)===`?`?n:`?`+n),r&&r!==`#`&&(t+=r.charAt(0)===`#`?r:`#`+r),t}function on(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function sn(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=Y.Pop,c=null,l=u();l??(l=0,o.replaceState(J({},o.state,{idx:l}),``));function u(){return(o.state||{idx:null}).idx}function d(){s=Y.Pop;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=Y.Push;let r=rn(h.location,e,t);n&&n(r,e),l=u()+1;let d=nn(r,l),f=h.createHref(r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=Y.Replace;let r=rn(h.location,e,t);n&&n(r,e),l=u();let i=nn(r,l),d=h.createHref(r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){let t=i.location.origin===`null`?i.location.href:i.location.origin,n=typeof e==`string`?e:an(e);return n=n.replace(/ $/,`%20`),X(t,`No window.location.(origin|href) available to create URL for href: `+n),new URL(n,t)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(Qt,d),c=e,()=>{i.removeEventListener(Qt,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}var Z;(function(e){e.data=`data`,e.deferred=`deferred`,e.redirect=`redirect`,e.error=`error`})(Z||={});var cn=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`children`]);function ln(e){return e.index===!0}function un(e,t,n,r){return n===void 0&&(n=[]),r===void 0&&(r={}),e.map((e,i)=>{let a=[...n,String(i)],o=typeof e.id==`string`?e.id:a.join(`-`);if(X(e.index!==!0||!e.children,`Cannot specify children on an index route`),X(!r[o],`Found a route id collision on id "`+o+`". Route id's must be globally unique within Data Router usages`),ln(e)){let n=J({},e,t(e),{id:o});return r[o]=n,n}{let n=J({},e,t(e),{id:o,children:void 0});return r[o]=n,e.children&&(n.children=un(e.children,t,a,r)),n}})}function dn(e,t,n){return n===void 0&&(n=`/`),fn(e,t,n,!1)}function fn(e,t,n,r){let i=An((typeof t==`string`?on(t):t).pathname||`/`,n);if(i==null)return null;let a=mn(e);gn(a);let o=null,s=kn(i);for(let e=0;o==null&&e<a.length;++e)o=En(a[e],s,r);return o}function pn(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],handle:n.handle}}function mn(e,t,n,r){t===void 0&&(t=[]),n===void 0&&(n=[]),r===void 0&&(r=``);let i=(e,i,a)=>{let o={relativePath:a===void 0?e.path||``:a,caseSensitive:e.caseSensitive===!0,childrenIndex:i,route:e};o.relativePath.startsWith(`/`)&&(X(o.relativePath.startsWith(r),`Absolute route path "`+o.relativePath+`" nested under path `+(`"`+r+`" is not valid. An absolute child route path `)+`must start with the combined path of all its parent routes.`),o.relativePath=o.relativePath.slice(r.length));let s=Rn([r,o.relativePath]),c=n.concat(o);e.children&&e.children.length>0&&(X(e.index!==!0,`Index routes must not have child routes. Please remove `+(`all child routes from route path "`+s+`".`)),mn(e.children,t,c,s)),(e.path!=null||e.index)&&t.push({path:s,score:wn(s,e.index),routesMeta:c})};return e.forEach((e,t)=>{var n;if(e.path===``||!((n=e.path)!=null&&n.includes(`?`)))i(e,t);else for(let n of hn(e.path))i(e,t,n)}),t}function hn(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 o=hn(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function gn(e){e.sort((e,t)=>e.score===t.score?Tn(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var _n=/^:[\w-]+$/,vn=3,yn=2,bn=1,xn=10,Sn=-2,Cn=e=>e===`*`;function wn(e,t){let n=e.split(`/`),r=n.length;return n.some(Cn)&&(r+=Sn),t&&(r+=yn),n.filter(e=>!Cn(e)).reduce((e,t)=>e+(_n.test(t)?vn:t===``?bn:xn),r)}function Tn(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function En(e,t,n){n===void 0&&(n=!1);let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=Dn({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=Dn({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:Rn([a,u.pathname]),pathnameBase:zn(Rn([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=Rn([a,u.pathnameBase]))}return o}function Dn(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=On(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,t,n)=>{let{paramName:r,isOptional:i}=t;if(r===`*`){let e=s[n]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let c=s[n];return e[r]=i&&!c?void 0:(c||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function On(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),en(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,(e,t,n)=>(r.push({paramName:t,isOptional:n!=null}),n?`/?([^\\/]+)?`:`/([^\\/]+)`));return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function kn(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return en(!1,`The URL path "`+e+`" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent `+(`encoding (`+t+`).`)),e}}function An(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function jn(e,t){t===void 0&&(t=`/`);let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?on(e):e,a;return n?(n=Ln(n),a=n.startsWith(`/`)?Mn(n.substring(1),`/`):Mn(n,t)):a=t,{pathname:a,search:Bn(r),hash:Vn(i)}}function Mn(e,t){let n=t.replace(/\/+$/,``).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function Nn(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 <Link to="..."> and the router will parse it for you.`}function Pn(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Fn(e,t){let n=Pn(e);return t?n.map((e,t)=>t===n.length-1?e.pathname:e.pathnameBase):n.map(e=>e.pathnameBase)}function In(e,t,n,r){r===void 0&&(r=!1);let i;typeof e==`string`?i=on(e):(i=J({},e),X(!i.pathname||!i.pathname.includes(`?`),Nn(`?`,`pathname`,`search`,i)),X(!i.pathname||!i.pathname.includes(`#`),Nn(`#`,`pathname`,`hash`,i)),X(!i.search||!i.search.includes(`#`),Nn(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=jn(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Ln=e=>e.replace(/\/\/+/g,`/`),Rn=e=>Ln(e.join(`/`)),zn=e=>e.replace(/\/+$/,``).replace(/^\/*/,`/`),Bn=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Vn=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Hn=class{constructor(e,t,n,r){r===void 0&&(r=!1),this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Un(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}var Wn=[`post`,`put`,`patch`,`delete`],Gn=new Set(Wn),Kn=[`get`,...Wn],qn=new Set(Kn),Jn=new Set([301,302,303,307,308]),Yn=new Set([307,308]),Xn={state:`idle`,location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Zn={state:`idle`,data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Qn={state:`unblocked`,proceed:void 0,reset:void 0,location:void 0},$n=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,er=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),tr=`remix-router-transitions`;function nr(e){let t=e.window?e.window:typeof window<`u`?window:void 0,n=t!==void 0&&t.document!==void 0&&t.document.createElement!==void 0,r=!n;X(e.routes.length>0,`You must provide a non-empty routes array to createRouter`);let i;if(e.mapRouteProperties)i=e.mapRouteProperties;else if(e.detectErrorBoundary){let t=e.detectErrorBoundary;i=e=>({hasErrorBoundary:t(e)})}else i=er;let a={},o=un(e.routes,i,void 0,a),s,c=e.basename||`/`,l=e.dataStrategy||hr,u=e.patchRoutesOnNavigation,d=J({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),f=null,p=new Set,m=null,h=null,g=null,_=e.hydrationData!=null,v=dn(o,e.history.location,c),y=!1,b=null;if(v==null&&!u){let t=Q(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=kr(o);v=n,b={[r.id]:t}}v&&!e.hydrationData&&ze(v,o,e.history.location.pathname).active&&(v=null);let x;if(!v){if(x=!1,v=[],d.v7_partialHydration){let t=ze(null,o,e.history.location.pathname);t.active&&t.matches&&(y=!0,v=t.matches)}}else if(v.some(e=>e.route.lazy))x=!1;else if(!v.some(e=>e.route.loader))x=!0;else if(d.v7_partialHydration){let t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null;if(n){let e=v.findIndex(e=>n[e.route.id]!==void 0);x=v.slice(0,e+1).every(e=>!cr(e.route,t,n))}else x=v.every(e=>!cr(e.route,t,n))}else x=e.hydrationData!=null;let S,C={historyAction:e.history.action,location:e.history.location,matches:v,initialized:x,navigation:Xn,restoreScrollPosition:e.hydrationData==null&&null,preventScrollReset:!1,revalidation:`idle`,loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||b,fetchers:new Map,blockers:new Map},w=Y.Pop,T=!1,E,D=!1,ee=new Map,O=null,te=!1,k=!1,A=[],j=new Set,M=new Map,ne=0,re=-1,N=new Map,ie=new Set,ae=new Map,oe=new Map,P=new Set,F=new Map,I=new Map,L;function se(){if(f=e.history.listen(t=>{let{action:n,location:r,delta:i}=t;if(L){L(),L=void 0;return}en(I.size===0||i!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let a=Me({currentLocation:C.location,nextLocation:r,historyAction:n});if(a&&i!=null){let t=new Promise(e=>{L=e});e.history.go(i*-1),je(a,{state:`blocked`,location:r,proceed(){je(a,{state:`proceeding`,proceed:void 0,reset:void 0,location:r}),t.then(()=>e.history.go(i))},reset(){let e=new Map(C.blockers);e.set(a,Qn),R({blockers:e})}});return}return pe(n,r)}),n){Qr(t,ee);let e=()=>$r(t,ee);t.addEventListener(`pagehide`,e),O=()=>t.removeEventListener(`pagehide`,e)}return C.initialized||pe(Y.Pop,C.location,{initialHydration:!0}),S}function ce(){f&&f(),O&&O(),p.clear(),E&&E.abort(),C.fetchers.forEach((e,t)=>U(t)),C.blockers.forEach((e,t)=>Ae(t))}function le(e){return p.add(e),()=>p.delete(e)}function R(e,t){t===void 0&&(t={}),C=J({},C,e);let n=[],r=[];d.v7_fetcherPersist&&C.fetchers.forEach((e,t)=>{e.state===`idle`&&(P.has(t)?r.push(t):n.push(t))}),P.forEach(e=>{!C.fetchers.has(e)&&!M.has(e)&&r.push(e)}),[...p].forEach(e=>e(C,{deletedFetchers:r,viewTransitionOpts:t.viewTransitionOpts,flushSync:t.flushSync===!0})),d.v7_fetcherPersist?(n.forEach(e=>C.fetchers.delete(e)),r.forEach(e=>U(e))):r.forEach(e=>P.delete(e))}function ue(t,n,r){let{flushSync:i}=r===void 0?{}:r,a=C.actionData!=null&&C.navigation.formMethod!=null&&Br(C.navigation.formMethod)&&C.navigation.state===`loading`&&t.state?._isRedirect!==!0,c;c=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:a?C.actionData:null;let l=n.loaderData?Er(C.loaderData,n.loaderData,n.matches||[],n.errors):C.loaderData,u=C.blockers;u.size>0&&(u=new Map(u),u.forEach((e,t)=>u.set(t,Qn)));let d=T===!0||C.navigation.formMethod!=null&&Br(C.navigation.formMethod)&&t.state?._isRedirect!==!0;s&&=(o=s,void 0),te||w===Y.Pop||(w===Y.Push?e.history.push(t,t.state):w===Y.Replace&&e.history.replace(t,t.state));let f;if(w===Y.Pop){let e=ee.get(C.location.pathname);e&&e.has(t.pathname)?f={currentLocation:C.location,nextLocation:t}:ee.has(t.pathname)&&(f={currentLocation:t,nextLocation:C.location})}else if(D){let e=ee.get(C.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),ee.set(C.location.pathname,e)),f={currentLocation:C.location,nextLocation:t}}R(J({},n,{actionData:c,loaderData:l,historyAction:w,location:t,initialized:!0,navigation:Xn,revalidation:`idle`,restoreScrollPosition:Re(t,n.matches||C.matches),preventScrollReset:d,blockers:u}),{viewTransitionOpts:f,flushSync:i===!0}),w=Y.Pop,T=!1,D=!1,te=!1,k=!1,A=[]}async function de(t,n){if(typeof t==`number`){e.history.go(t);return}let r=ir(C.location,C.matches,c,d.v7_prependBasename,t,d.v7_relativeSplatPath,n?.fromRouteId,n?.relative),{path:i,submission:a,error:o}=ar(d.v7_normalizeFormMethod,!1,r,n),s=C.location,l=rn(C.location,i,n&&n.state);l=J({},l,e.history.encodeLocation(l));let u=n&&n.replace!=null?n.replace:void 0,f=Y.Push;u===!0?f=Y.Replace:u===!1||a!=null&&Br(a.formMethod)&&a.formAction===C.location.pathname+C.location.search&&(f=Y.Replace);let p=n&&`preventScrollReset`in n?n.preventScrollReset===!0:void 0,m=(n&&n.flushSync)===!0,h=Me({currentLocation:s,nextLocation:l,historyAction:f});if(h){je(h,{state:`blocked`,location:l,proceed(){je(h,{state:`proceeding`,proceed:void 0,reset:void 0,location:l}),de(t,n)},reset(){let e=new Map(C.blockers);e.set(h,Qn),R({blockers:e})}});return}return await pe(f,l,{submission:a,pendingError:o,preventScrollReset:p,replace:n&&n.replace,enableViewTransition:n&&n.viewTransition,flushSync:m})}function fe(){if(xe(),R({revalidation:`loading`}),C.navigation.state!==`submitting`){if(C.navigation.state===`idle`){pe(C.historyAction,C.location,{startUninterruptedRevalidation:!0});return}pe(w||C.historyAction,C.navigation.location,{overrideNavigation:C.navigation,enableViewTransition:D===!0})}}async function pe(t,n,r){E&&E.abort(),E=null,w=t,te=(r&&r.startUninterruptedRevalidation)===!0,Le(C.location,C.matches),T=(r&&r.preventScrollReset)===!0,D=(r&&r.enableViewTransition)===!0;let i=s||o,a=r&&r.overrideNavigation,l=r!=null&&r.initialHydration&&C.matches&&C.matches.length>0&&!y?C.matches:dn(i,n,c),u=(r&&r.flushSync)===!0;if(l&&C.initialized&&!k&&Mr(C.location,n)&&!(r&&r.submission&&Br(r.submission.formMethod))){ue(n,{matches:l},{flushSync:u});return}let d=ze(l,i,n.pathname);if(d.active&&d.matches&&(l=d.matches),!l){let{error:e,notFoundMatches:t,route:r}=Ne(n.pathname);ue(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:u});return}E=new AbortController;let f=xr(e.history,n,E.signal,r&&r.submission),p;if(r&&r.pendingError)p=[Or(l).route.id,{type:Z.error,error:r.pendingError}];else if(r&&r.submission&&Br(r.submission.formMethod)){let t=await z(f,n,r.submission,l,d.active,{replace:r.replace,flushSync:u});if(t.shortCircuited)return;if(t.pendingActionResult){let[e,r]=t.pendingActionResult;if($(r)&&Un(r.error)&&r.error.status===404){E=null,ue(n,{matches:t.matches,loaderData:{},errors:{[e]:r.error}});return}}l=t.matches||l,p=t.pendingActionResult,a=qr(n,r.submission),u=!1,d.active=!1,f=xr(e.history,f.url,f.signal)}let{shortCircuited:m,matches:h,loaderData:g,errors:_}=await B(f,n,l,d.active,a,r&&r.submission,r&&r.fetcherSubmission,r&&r.replace,r&&r.initialHydration===!0,u,p);m||(E=null,ue(n,J({matches:h||l},Dr(p),{loaderData:g,errors:_})))}async function z(t,n,r,i,a,o){if(o===void 0&&(o={}),xe(),R({navigation:Jr(n,r)},{flushSync:o.flushSync===!0}),a){let e=await Be(i,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){let t=Or(e.partialMatches).route.id;return{matches:e.partialMatches,pendingActionResult:[t,{type:Z.error,error:e.error}]}}if(e.matches)i=e.matches;else{let{notFoundMatches:e,error:t,route:r}=Ne(n.pathname);return{matches:e,pendingActionResult:[r.id,{type:Z.error,error:t}]}}}let s,l=Gr(i,n);if(!l.route.action&&!l.route.lazy)s={type:Z.error,error:Q(405,{method:t.method,pathname:n.pathname,routeId:l.route.id})};else if(s=(await ye(`action`,C,t,[l],i,null))[l.route.id],t.signal.aborted)return{shortCircuited:!0};if(Fr(s)){let n;return n=o&&o.replace!=null?o.replace:br(s.response.headers.get(`Location`),new URL(t.url),c,e.history)===C.location.pathname+C.location.search,await ve(t,s,!0,{submission:r,replace:n}),{shortCircuited:!0}}if(Pr(s))throw Q(400,{type:`defer-action`});if($(s)){let e=Or(i,l.route.id);return(o&&o.replace)!==!0&&(w=Y.Push),{matches:i,pendingActionResult:[e.route.id,s]}}return{matches:i,pendingActionResult:[l.route.id,s]}}async function B(t,n,r,i,a,l,u,f,p,m,h){let g=a||qr(n,l),_=l||u||Kr(g),v=!te&&(!d.v7_partialHydration||!p);if(i){if(v){let e=me(h);R(J({navigation:g},e===void 0?{}:{actionData:e}),{flushSync:m})}let e=await Be(r,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){let t=Or(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}if(e.matches)r=e.matches;else{let{error:e,notFoundMatches:t,route:r}=Ne(n.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}}let y=s||o,[b,x]=sr(e.history,C,r,_,n,d.v7_partialHydration&&p===!0,d.v7_skipActionErrorRevalidation,k,A,j,P,ae,ie,y,c,h);if(Pe(e=>!(r&&r.some(t=>t.route.id===e))||b&&b.some(t=>t.route.id===e)),re=++ne,b.length===0&&x.length===0){let e=De();return ue(n,J({matches:r,loaderData:{},errors:h&&$(h[1])?{[h[0]]:h[1].error}:null},Dr(h),e?{fetchers:new Map(C.fetchers)}:{}),{flushSync:m}),{shortCircuited:!0}}if(v){let e={};if(!i){e.navigation=g;let t=me(h);t!==void 0&&(e.actionData=t)}x.length>0&&(e.fetchers=V(x)),R(e,{flushSync:m})}x.forEach(e=>{Te(e.key),e.controller&&M.set(e.key,e.controller)});let S=()=>x.forEach(e=>Te(e.key));E&&E.signal.addEventListener(`abort`,S);let{loaderResults:w,fetcherResults:T}=await be(C,r,b,x,t);if(t.signal.aborted)return{shortCircuited:!0};E&&E.signal.removeEventListener(`abort`,S),x.forEach(e=>M.delete(e.key));let D=Ar(w);if(D)return await ve(t,D.result,!0,{replace:f}),{shortCircuited:!0};if(D=Ar(T),D)return ie.add(D.key),await ve(t,D.result,!0,{replace:f}),{shortCircuited:!0};let{loaderData:ee,errors:O}=Tr(C,r,w,h,x,T,F);F.forEach((e,t)=>{e.subscribe(n=>{(n||e.done)&&F.delete(t)})}),d.v7_partialHydration&&p&&C.errors&&(O=J({},C.errors,O));let N=De(),oe=Oe(re),I=N||oe||x.length>0;return J({matches:r,loaderData:ee,errors:O},I?{fetchers:new Map(C.fetchers)}:{})}function me(e){if(e&&!$(e[1]))return{[e[0]]:e[1].data};if(C.actionData)return Object.keys(C.actionData).length===0?null:C.actionData}function V(e){return e.forEach(e=>{let t=C.fetchers.get(e.key),n=Yr(void 0,t?t.data:void 0);C.fetchers.set(e.key,n)}),new Map(C.fetchers)}function he(e,t,n,i){if(r)throw Error(`router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.`);Te(e);let a=(i&&i.flushSync)===!0,l=s||o,u=ir(C.location,C.matches,c,d.v7_prependBasename,n,d.v7_relativeSplatPath,t,i?.relative),f=dn(l,u,c),p=ze(f,l,u);if(p.active&&p.matches&&(f=p.matches),!f){H(e,t,Q(404,{pathname:u}),{flushSync:a});return}let{path:m,submission:h,error:g}=ar(d.v7_normalizeFormMethod,!0,u,i);if(g){H(e,t,g,{flushSync:a});return}let _=Gr(f,m),v=(i&&i.preventScrollReset)===!0;if(h&&Br(h.formMethod)){ge(e,t,m,_,f,p.active,a,v,h);return}ae.set(e,{routeId:t,path:m}),_e(e,t,m,_,f,p.active,a,v,h)}async function ge(t,n,r,i,a,l,u,f,p){xe(),ae.delete(t);function m(e){return!e.route.action&&!e.route.lazy&&(H(t,n,Q(405,{method:p.formMethod,pathname:r,routeId:n}),{flushSync:u}),!0)}if(!l&&m(i))return;Se(t,Xr(p,C.fetchers.get(t)),{flushSync:u});let h=new AbortController,g=xr(e.history,r,h.signal,p);if(l){let e=await Be(a,new URL(g.url).pathname,g.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){H(t,n,e.error,{flushSync:u});return}if(!e.matches){H(t,n,Q(404,{pathname:r}),{flushSync:u});return}if(a=e.matches,i=Gr(a,r),m(i))return}M.set(t,h);let _=ne,v=(await ye(`action`,C,g,[i],a,t))[i.route.id];if(g.signal.aborted){M.get(t)===h&&M.delete(t);return}if(d.v7_fetcherPersist&&P.has(t)){if(Fr(v)||$(v)){Se(t,Zr(void 0));return}}else{if(Fr(v)){if(M.delete(t),re>_){Se(t,Zr(void 0));return}return ie.add(t),Se(t,Yr(p)),ve(g,v,!1,{fetcherSubmission:p,preventScrollReset:f})}if($(v)){H(t,n,v.error);return}}if(Pr(v))throw Q(400,{type:`defer-action`});let y=C.navigation.location||C.location,b=xr(e.history,y,h.signal),x=s||o,S=C.navigation.state===`idle`?C.matches:dn(x,C.navigation.location,c);X(S,`Didn't find any matches after fetcher action`);let T=++ne;N.set(t,T);let D=Yr(p,v.data);C.fetchers.set(t,D);let[ee,O]=sr(e.history,C,S,p,y,!1,d.v7_skipActionErrorRevalidation,k,A,j,P,ae,ie,x,c,[i.route.id,v]);O.filter(e=>e.key!==t).forEach(e=>{let t=e.key,n=C.fetchers.get(t),r=Yr(void 0,n?n.data:void 0);C.fetchers.set(t,r),Te(t),e.controller&&M.set(t,e.controller)}),R({fetchers:new Map(C.fetchers)});let te=()=>O.forEach(e=>Te(e.key));h.signal.addEventListener(`abort`,te);let{loaderResults:oe,fetcherResults:I}=await be(C,S,ee,O,b);if(h.signal.aborted)return;h.signal.removeEventListener(`abort`,te),N.delete(t),M.delete(t),O.forEach(e=>M.delete(e.key));let L=Ar(oe);if(L)return ve(b,L.result,!1,{preventScrollReset:f});if(L=Ar(I),L)return ie.add(L.key),ve(b,L.result,!1,{preventScrollReset:f});let{loaderData:se,errors:ce}=Tr(C,S,oe,void 0,O,I,F);if(C.fetchers.has(t)){let e=Zr(v.data);C.fetchers.set(t,e)}Oe(T),C.navigation.state===`loading`&&T>re?(X(w,`Expected pending action`),E&&E.abort(),ue(C.navigation.location,{matches:S,loaderData:se,errors:ce,fetchers:new Map(C.fetchers)})):(R({errors:ce,loaderData:Er(C.loaderData,se,S,ce),fetchers:new Map(C.fetchers)}),k=!1)}async function _e(t,n,r,i,a,o,s,c,l){let u=C.fetchers.get(t);Se(t,Yr(l,u?u.data:void 0),{flushSync:s});let d=new AbortController,f=xr(e.history,r,d.signal);if(o){let e=await Be(a,new URL(f.url).pathname,f.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){H(t,n,e.error,{flushSync:s});return}if(e.matches)a=e.matches,i=Gr(a,r);else{H(t,n,Q(404,{pathname:r}),{flushSync:s});return}}M.set(t,d);let p=ne,m=(await ye(`loader`,C,f,[i],a,t))[i.route.id];if(Pr(m)&&(m=await Ur(m,f.signal,!0)||m),M.get(t)===d&&M.delete(t),!f.signal.aborted){if(P.has(t)){Se(t,Zr(void 0));return}if(Fr(m)){if(re>p){Se(t,Zr(void 0));return}ie.add(t),await ve(f,m,!1,{preventScrollReset:c});return}if($(m)){H(t,n,m.error);return}X(!Pr(m),`Unhandled fetcher deferred data`),Se(t,Zr(m.data))}}async function ve(r,i,a,o){let{submission:s,fetcherSubmission:l,preventScrollReset:u,replace:d}=o===void 0?{}:o;i.response.headers.has(`X-Remix-Revalidate`)&&(k=!0);let f=i.response.headers.get(`Location`);X(f,`Expected a Location header on the redirect Response`),f=br(f,new URL(r.url),c,e.history);let p=rn(C.location,f,{_isRedirect:!0});if(n){let n=!1;if(i.response.headers.has(`X-Remix-Reload-Document`))n=!0;else if($n.test(f)){let r=e.history.createURL(f);n=r.origin!==t.location.origin||An(r.pathname,c)==null}if(n){d?t.location.replace(f):t.location.assign(f);return}}E=null;let m=d===!0||i.response.headers.has(`X-Remix-Replace`)?Y.Replace:Y.Push,{formMethod:h,formAction:g,formEncType:_}=C.navigation;!s&&!l&&h&&g&&_&&(s=Kr(C.navigation));let v=s||l;Yn.has(i.response.status)&&v&&Br(v.formMethod)?await pe(m,p,{submission:J({},v,{formAction:f}),preventScrollReset:u||T,enableViewTransition:a?D:void 0}):await pe(m,p,{overrideNavigation:qr(p,s),fetcherSubmission:l,preventScrollReset:u||T,enableViewTransition:a?D:void 0})}async function ye(e,t,n,r,o,s){let u,f={};try{u=await gr(l,e,t,n,r,o,s,a,i)}catch(e){return r.forEach(t=>{f[t.route.id]={type:Z.error,error:e}}),f}for(let[e,t]of Object.entries(u))if(Nr(t)){let r=t.result;f[e]={type:Z.redirect,response:yr(r,n,e,o,c,d.v7_relativeSplatPath)}}else f[e]=await vr(t);return f}async function be(t,n,r,i,a){let o=t.matches,s=ye(`loader`,t,a,r,n,null),c=Promise.all(i.map(async n=>{if(n.matches&&n.match&&n.controller){let r=(await ye(`loader`,t,xr(e.history,n.path,n.controller.signal),[n.match],n.matches,n.key))[n.match.route.id];return{[n.key]:r}}return Promise.resolve({[n.key]:{type:Z.error,error:Q(404,{pathname:n.path})}})})),l=await s,u=(await c).reduce((e,t)=>Object.assign(e,t),{});return await Promise.all([Vr(n,l,a.signal,o,t.loaderData),Hr(n,u,i)]),{loaderResults:l,fetcherResults:u}}function xe(){k=!0,A.push(...Pe()),ae.forEach((e,t)=>{M.has(t)&&j.add(t),Te(t)})}function Se(e,t,n){n===void 0&&(n={}),C.fetchers.set(e,t),R({fetchers:new Map(C.fetchers)},{flushSync:(n&&n.flushSync)===!0})}function H(e,t,n,r){r===void 0&&(r={});let i=Or(C.matches,t);U(e),R({errors:{[i.route.id]:n},fetchers:new Map(C.fetchers)},{flushSync:(r&&r.flushSync)===!0})}function Ce(e){return oe.set(e,(oe.get(e)||0)+1),P.has(e)&&P.delete(e),C.fetchers.get(e)||Zn}function U(e){let t=C.fetchers.get(e);M.has(e)&&!(t&&t.state===`loading`&&N.has(e))&&Te(e),ae.delete(e),N.delete(e),ie.delete(e),d.v7_fetcherPersist&&P.delete(e),j.delete(e),C.fetchers.delete(e)}function we(e){let t=(oe.get(e)||0)-1;t<=0?(oe.delete(e),P.add(e),d.v7_fetcherPersist||U(e)):oe.set(e,t),R({fetchers:new Map(C.fetchers)})}function Te(e){let t=M.get(e);t&&(t.abort(),M.delete(e))}function Ee(e){for(let t of e){let e=Zr(Ce(t).data);C.fetchers.set(t,e)}}function De(){let e=[],t=!1;for(let n of ie){let r=C.fetchers.get(n);X(r,`Expected fetcher: `+n),r.state===`loading`&&(ie.delete(n),e.push(n),t=!0)}return Ee(e),t}function Oe(e){let t=[];for(let[n,r]of N)if(r<e){let e=C.fetchers.get(n);X(e,`Expected fetcher: `+n),e.state===`loading`&&(Te(n),N.delete(n),t.push(n))}return Ee(t),t.length>0}function ke(e,t){let n=C.blockers.get(e)||Qn;return I.get(e)!==t&&I.set(e,t),n}function Ae(e){C.blockers.delete(e),I.delete(e)}function je(e,t){let n=C.blockers.get(e)||Qn;X(n.state===`unblocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`proceeding`||n.state===`blocked`&&t.state===`unblocked`||n.state===`proceeding`&&t.state===`unblocked`,`Invalid blocker state transition: `+n.state+` -> `+t.state);let r=new Map(C.blockers);r.set(e,t),R({blockers:r})}function Me(e){let{currentLocation:t,nextLocation:n,historyAction:r}=e;if(I.size===0)return;I.size>1&&en(!1,`A router only supports one blocker at a time`);let i=Array.from(I.entries()),[a,o]=i[i.length-1],s=C.blockers.get(a);if(!(s&&s.state===`proceeding`)&&o({currentLocation:t,nextLocation:n,historyAction:r}))return a}function Ne(e){let t=Q(404,{pathname:e}),{matches:n,route:r}=kr(s||o);return Pe(),{notFoundMatches:n,route:r,error:t}}function Pe(e){let t=[];return F.forEach((n,r)=>{(!e||e(r))&&(n.cancel(),t.push(r),F.delete(r))}),t}function Fe(e,t,n){if(m=e,g=t,h=n||null,!_&&C.navigation===Xn){_=!0;let e=Re(C.location,C.matches);e!=null&&R({restoreScrollPosition:e})}return()=>{m=null,g=null,h=null}}function Ie(e,t){return h&&h(e,t.map(e=>pn(e,C.loaderData)))||e.key}function Le(e,t){if(m&&g){let n=Ie(e,t);m[n]=g()}}function Re(e,t){if(m){let n=Ie(e,t),r=m[n];if(typeof r==`number`)return r}return null}function ze(e,t,n){if(u){if(!e)return{active:!0,matches:fn(t,n,c,!0)||[]};if(Object.keys(e[0].params).length>0)return{active:!0,matches:fn(t,n,c,!0)}}return{active:!1,matches:null}}async function Be(e,t,n,r){if(!u)return{type:`success`,matches:e};let l=e;for(;;){let e=s==null,d=s||o,f=a;try{await u({signal:n,path:t,matches:l,fetcherKey:r,patch:(e,t)=>{n.aborted||fr(e,t,d,f,i)}})}catch(e){return{type:`error`,error:e,partialMatches:l}}finally{e&&!n.aborted&&(o=[...o])}if(n.aborted)return{type:`aborted`};let p=dn(d,t,c);if(p)return{type:`success`,matches:p};let m=fn(d,t,c,!0);if(!m||l.length===m.length&&l.every((e,t)=>e.route.id===m[t].route.id))return{type:`success`,matches:null};l=m}}function Ve(e){a={},s=un(e,i,void 0,a)}function He(e,t){let n=s==null;fr(e,t,s||o,a,i),n&&(o=[...o],R({}))}return S={get basename(){return c},get future(){return d},get state(){return C},get routes(){return o},get window(){return t},initialize:se,subscribe:le,enableScrollRestoration:Fe,navigate:de,fetch:he,revalidate:fe,createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:Ce,deleteFetcher:we,dispose:ce,getBlocker:ke,deleteBlocker:Ae,patchRoutes:He,_internalFetchControllers:M,_internalActiveDeferreds:F,_internalSetRoutes:Ve},S}function rr(e){return e!=null&&(`formData`in e&&e.formData!=null||`body`in e&&e.body!==void 0)}function ir(e,t,n,r,i,a,o,s){let c,l;if(o){c=[];for(let e of t)if(c.push(e),e.route.id===o){l=e;break}}else c=t,l=t[t.length-1];let u=In(i||`.`,Fn(c,a),An(e.pathname,n)||e.pathname,s===`path`);if(i??(u.search=e.search,u.hash=e.hash),(i==null||i===``||i===`.`)&&l){let e=Wr(u.search);if(l.route.index&&!e)u.search=u.search?u.search.replace(/^\?/,`?index&`):`?index`;else if(!l.route.index&&e){let e=new URLSearchParams(u.search),t=e.getAll(`index`);e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();u.search=n?`?`+n:``}}return r&&n!==`/`&&(u.pathname=u.pathname===`/`?n:Rn([n,u.pathname])),an(u)}function ar(e,t,n,r){if(!r||!rr(r))return{path:n};if(r.formMethod&&!zr(r.formMethod))return{path:n,error:Q(405,{method:r.formMethod})};let i=()=>({path:n,error:Q(400,{type:`invalid-body`})}),a=r.formMethod||`get`,o=e?a.toUpperCase():a.toLowerCase(),s=jr(n);if(r.body!==void 0){if(r.formEncType===`text/plain`){if(!Br(o))return i();let e=typeof r.body==`string`?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((e,t)=>{let[n,r]=t;return``+e+n+`=`+r+`
3
3
  `},``):String(r.body);return{path:n,submission:{formMethod:o,formAction:s,formEncType:r.formEncType,formData:void 0,json:void 0,text:e}}}if(r.formEncType===`application/json`){if(!Br(o))return i();try{let e=typeof r.body==`string`?JSON.parse(r.body):r.body;return{path:n,submission:{formMethod:o,formAction:s,formEncType:r.formEncType,formData:void 0,json:e,text:void 0}}}catch{return i()}}}X(typeof FormData==`function`,`FormData is not available in this environment`);let c,l;if(r.formData)c=Sr(r.formData),l=r.formData;else if(r.body instanceof FormData)c=Sr(r.body),l=r.body;else if(r.body instanceof URLSearchParams)c=r.body,l=Cr(c);else if(r.body==null)c=new URLSearchParams,l=new FormData;else try{c=new URLSearchParams(r.body),l=Cr(c)}catch{return i()}let u={formMethod:o,formAction:s,formEncType:r&&r.formEncType||`application/x-www-form-urlencoded`,formData:l,json:void 0,text:void 0};if(Br(u.formMethod))return{path:n,submission:u};let d=on(n);return t&&d.search&&Wr(d.search)&&c.append(`index`,``),d.search=`?`+c,{path:an(d),submission:u}}function or(e,t,n){n===void 0&&(n=!1);let r=e.findIndex(e=>e.route.id===t);return r>=0?e.slice(0,n?r+1:r):e}function sr(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=h?$(h[1])?h[1].error:h[1].data:void 0,_=e.createURL(t.location),v=e.createURL(i),y=n;a&&t.errors?y=or(n,Object.keys(t.errors)[0],!0):h&&$(h[1])&&(y=or(n,h[0]));let b=h?h[1].statusCode:void 0,x=o&&b&&b>=400,S=y.filter((e,n)=>{let{route:i}=e;if(i.lazy)return!0;if(i.loader==null)return!1;if(a)return cr(i,t.loaderData,t.errors);if(lr(t.loaderData,t.matches[n],e)||c.some(t=>t===e.route.id))return!0;let o=t.matches[n],l=e;return dr(e,J({currentUrl:_,currentParams:o.params,nextUrl:v,nextParams:l.params},r,{actionResult:g,actionStatus:b,defaultShouldRevalidate:x?!1:s||_.pathname+_.search===v.pathname+v.search||_.search!==v.search||ur(o,l)}))}),C=[];return d.forEach((e,i)=>{if(a||!n.some(t=>t.route.id===e.routeId)||u.has(i))return;let o=dn(p,e.path,m);if(!o){C.push({key:i,routeId:e.routeId,path:e.path,matches:null,match:null,controller:null});return}let c=t.fetchers.get(i),d=Gr(o,e.path),h=!1;f.has(i)?h=!1:l.has(i)?(l.delete(i),h=!0):h=c&&c.state!==`idle`&&c.data===void 0?s:dr(d,J({currentUrl:_,currentParams:t.matches[t.matches.length-1].params,nextUrl:v,nextParams:n[n.length-1].params},r,{actionResult:g,actionStatus:b,defaultShouldRevalidate:!x&&s})),h&&C.push({key:i,routeId:e.routeId,path:e.path,matches:o,match:d,controller:new AbortController})}),[S,C]}function cr(e,t,n){if(e.lazy)return!0;if(!e.loader)return!1;let r=t!=null&&t[e.id]!==void 0,i=n!=null&&n[e.id]!==void 0;return!r&&i?!1:typeof e.loader==`function`&&e.loader.hydrate===!0||!r&&!i}function lr(e,t,n){let r=!t||n.route.id!==t.route.id,i=e[n.route.id]===void 0;return r||i}function ur(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith(`*`)&&e.params[`*`]!==t.params[`*`]}function dr(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n==`boolean`)return n}return t.defaultShouldRevalidate}function fr(e,t,n,r,i){let a;if(e){let t=r[e];X(t,`No route found to patch children into: routeId = `+e),t.children||=[],a=t.children}else a=n;let o=un(t.filter(e=>!a.some(t=>pr(e,t))),i,[e||`_`,`patch`,String(a?.length||`0`)],r);a.push(...o)}function pr(e,t){return`id`in e&&`id`in t&&e.id===t.id?!0:e.index!==t.index||e.path!==t.path||e.caseSensitive!==t.caseSensitive?!1:(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)||e.children.every((e,n)=>t.children?.some(t=>pr(e,t)))}async function mr(e,t,n){if(!e.lazy)return;let r=await e.lazy();if(!e.lazy)return;let i=n[e.id];X(i,`No route found in manifest`);let a={};for(let e in r){let t=i[e]!==void 0&&e!==`hasErrorBoundary`;en(!t,`Route "`+i.id+`" has a static property "`+e+`" defined but its lazy function is also returning a value for this property. `+(`The lazy route property "`+e+`" will be ignored.`)),!t&&!cn.has(e)&&(a[e]=r[e])}Object.assign(i,a),Object.assign(i,J({},t(i),{lazy:void 0}))}async function hr(e){let{matches:t}=e,n=t.filter(e=>e.shouldLoad);return(await Promise.all(n.map(e=>e.resolve()))).reduce((e,t,r)=>Object.assign(e,{[n[r].route.id]:t}),{})}async function gr(e,t,n,r,i,a,o,s,c,l){let u=a.map(e=>e.route.lazy?mr(e.route,c,s):void 0),d=await e({matches:a.map((e,n)=>{let a=u[n],o=i.some(t=>t.route.id===e.route.id);return J({},e,{shouldLoad:o,resolve:async n=>(n&&r.method===`GET`&&(e.route.lazy||e.route.loader)&&(o=!0),o?_r(t,r,e,a,n,l):Promise.resolve({type:Z.data,result:void 0}))})}),request:r,params:a[0].params,fetcherKey:o,context:l});try{await Promise.all(u)}catch{}return d}async function _r(e,t,n,r,i,a){let o,s,c=r=>{let o,c=new Promise((e,t)=>o=t);s=()=>o(),t.signal.addEventListener(`abort`,s);let l=i=>typeof r==`function`?r({request:t,params:n.params,context:a},...i===void 0?[]:[i]):Promise.reject(Error(`You cannot call the handler for a route which defines a boolean `+(`"`+e+`" [routeId: `+n.route.id+`]`))),u=(async()=>{try{return{type:`data`,result:await(i?i(e=>l(e)):l())}}catch(e){return{type:`error`,result:e}}})();return Promise.race([u,c])};try{let i=n.route[e];if(r){if(i){let e,[t]=await Promise.all([c(i).catch(t=>{e=t}),r]);if(e!==void 0)throw e;o=t}else if(await r,i=n.route[e],i)o=await c(i);else if(e===`action`){let e=new URL(t.url),r=e.pathname+e.search;throw Q(405,{method:t.method,pathname:r,routeId:n.route.id})}else return{type:Z.data,result:void 0}}else if(i)o=await c(i);else{let e=new URL(t.url);throw Q(404,{pathname:e.pathname+e.search})}X(o.result!==void 0,`You defined `+(e===`action`?`an action`:`a loader`)+` for route `+(`"`+n.route.id+`" but didn't return anything from your \``+e+"` ")+"function. Please return a value or `null`.")}catch(e){return{type:Z.error,result:e}}finally{s&&t.signal.removeEventListener(`abort`,s)}return o}async function vr(e){let{result:t,type:n}=e;if(Rr(t)){let e;try{let n=t.headers.get(`Content-Type`);e=n&&/\bapplication\/json\b/.test(n)?t.body==null?null:await t.json():await t.text()}catch(e){return{type:Z.error,error:e}}return n===Z.error?{type:Z.error,error:new Hn(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:Z.data,data:e,statusCode:t.status,headers:t.headers}}if(n===Z.error){if(Ir(t)){var r;if(t.data instanceof Error){var i;return{type:Z.error,error:t.data,statusCode:t.init?.status,headers:(i=t.init)!=null&&i.headers?new Headers(t.init.headers):void 0}}return{type:Z.error,error:new Hn(t.init?.status||500,void 0,t.data),statusCode:Un(t)?t.status:void 0,headers:(r=t.init)!=null&&r.headers?new Headers(t.init.headers):void 0}}return{type:Z.error,error:t,statusCode:Un(t)?t.status:void 0}}if(Lr(t))return{type:Z.deferred,deferredData:t,statusCode:t.init?.status,headers:t.init?.headers&&new Headers(t.init.headers)};if(Ir(t)){var a;return{type:Z.data,data:t.data,statusCode:t.init?.status,headers:(a=t.init)!=null&&a.headers?new Headers(t.init.headers):void 0}}return{type:Z.data,data:t}}function yr(e,t,n,r,i,a){let o=e.headers.get(`Location`);if(X(o,`Redirects returned/thrown from loaders/actions must have a Location header`),!$n.test(o)){let s=r.slice(0,r.findIndex(e=>e.route.id===n)+1);o=ir(new URL(t.url),s,i,!0,o,a),e.headers.set(`Location`,o)}return e}function br(e,t,n,r){let i=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];if($n.test(e)){let r=e,a=r.startsWith(`//`)?new URL(t.protocol+r):new URL(r);if(i.includes(a.protocol))throw Error(`Invalid redirect location`);let o=An(a.pathname,n)!=null;if(a.origin===t.origin&&o)return Ln(a.pathname)+a.search+a.hash}try{let t=r.createURL(e);if(i.includes(t.protocol))throw Error(`Invalid redirect location`)}catch{}return e}function xr(e,t,n,r){let i=e.createURL(jr(t)).toString(),a={signal:n};if(r&&Br(r.formMethod)){let{formMethod:e,formEncType:t}=r;a.method=e.toUpperCase(),t===`application/json`?(a.headers=new Headers({"Content-Type":t}),a.body=JSON.stringify(r.json)):a.body=t===`text/plain`?r.text:t===`application/x-www-form-urlencoded`&&r.formData?Sr(r.formData):r.formData}return new Request(i,a)}function Sr(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r==`string`?r:r.name);return t}function Cr(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function wr(e,t,n,r,i){let a={},o=null,s,c=!1,l={},u=n&&$(n[1])?n[1].error:void 0;return e.forEach(n=>{if(!(n.route.id in t))return;let d=n.route.id,f=t[d];if(X(!Fr(f),`Cannot handle redirect results in processLoaderData`),$(f)){let t=f.error;if(u!==void 0&&(t=u,u=void 0),o||={},i)o[d]=t;else{let n=Or(e,d);o[n.route.id]??(o[n.route.id]=t)}a[d]=void 0,c||(c=!0,s=Un(f.error)?f.error.status:500),f.headers&&(l[d]=f.headers)}else Pr(f)?(r.set(d,f.deferredData),a[d]=f.deferredData.data,f.statusCode!=null&&f.statusCode!==200&&!c&&(s=f.statusCode),f.headers&&(l[d]=f.headers)):(a[d]=f.data,f.statusCode&&f.statusCode!==200&&!c&&(s=f.statusCode),f.headers&&(l[d]=f.headers))}),u!==void 0&&n&&(o={[n[0]]:u},a[n[0]]=void 0),{loaderData:a,errors:o,statusCode:s||200,loaderHeaders:l}}function Tr(e,t,n,r,i,a,o){let{loaderData:s,errors:c}=wr(t,n,r,o,!1);return i.forEach(t=>{let{key:n,match:r,controller:i}=t,o=a[n];if(X(o,`Did not find corresponding fetcher result`),!(i&&i.signal.aborted)){if($(o)){let t=Or(e.matches,r?.route.id);c&&c[t.route.id]||(c=J({},c,{[t.route.id]:o.error})),e.fetchers.delete(n)}else if(Fr(o))X(!1,`Unhandled fetcher revalidation redirect`);else if(Pr(o))X(!1,`Unhandled fetcher deferred data`);else{let t=Zr(o.data);e.fetchers.set(n,t)}}}),{loaderData:s,errors:c}}function Er(e,t,n,r){let i=J({},t);for(let a of n){let n=a.route.id;if(t.hasOwnProperty(n)?t[n]!==void 0&&(i[n]=t[n]):e[n]!==void 0&&a.route.loader&&(i[n]=e[n]),r&&r.hasOwnProperty(n))break}return i}function Dr(e){return e?$(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Or(e,t){return(t?e.slice(0,e.findIndex(e=>e.route.id===t)+1):[...e]).reverse().find(e=>e.route.hasErrorBoundary===!0)||e[0]}function kr(e){let t=e.length===1?e[0]:e.find(e=>e.index||!e.path||e.path===`/`)||{id:`__shim-error-route__`};return{matches:[{params:{},pathname:``,pathnameBase:``,route:t}],route:t}}function Q(e,t){let{pathname:n,routeId:r,method:i,type:a,message:o}=t===void 0?{}:t,s=`Unknown Server Error`,c=`Unknown @remix-run/router error`;return e===400?(s=`Bad Request`,i&&n&&r?c=`You made a `+i+` request to "`+n+`" but `+('did not provide a `loader` for route "'+r+`", `)+`so there is no way to handle the request.`:a===`defer-action`?c=`defer() is not supported in actions`:a===`invalid-body`&&(c=`Unable to encode submission body`)):e===403?(s=`Forbidden`,c=`Route "`+r+`" does not match URL "`+n+`"`):e===404?(s=`Not Found`,c=`No route matches URL "`+n+`"`):e===405&&(s=`Method Not Allowed`,i&&n&&r?c=`You made a `+i.toUpperCase()+` request to "`+n+`" but `+('did not provide an `action` for route "'+r+`", `)+`so there is no way to handle the request.`:i&&(c=`Invalid request method "`+i.toUpperCase()+`"`)),new Hn(e||500,s,Error(c),!0)}function Ar(e){let t=Object.entries(e);for(let e=t.length-1;e>=0;e--){let[n,r]=t[e];if(Fr(r))return{key:n,result:r}}}function jr(e){let t=typeof e==`string`?on(e):e;return an(J({},t,{hash:``}))}function Mr(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===``?t.hash!==``:e.hash===t.hash||t.hash!==``}function Nr(e){return Rr(e.result)&&Jn.has(e.result.status)}function Pr(e){return e.type===Z.deferred}function $(e){return e.type===Z.error}function Fr(e){return(e&&e.type)===Z.redirect}function Ir(e){return typeof e==`object`&&!!e&&`type`in e&&`data`in e&&`init`in e&&e.type===`DataWithResponseInit`}function Lr(e){let t=e;return t&&typeof t==`object`&&typeof t.data==`object`&&typeof t.subscribe==`function`&&typeof t.cancel==`function`&&typeof t.resolveData==`function`}function Rr(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.headers==`object`&&e.body!==void 0}function zr(e){return qn.has(e.toLowerCase())}function Br(e){return Gn.has(e.toLowerCase())}async function Vr(e,t,n,r,i){let a=Object.entries(t);for(let o=0;o<a.length;o++){let[s,c]=a[o],l=e.find(e=>e?.route.id===s);if(!l)continue;let u=r.find(e=>e.route.id===l.route.id),d=u!=null&&!ur(u,l)&&(i&&i[l.route.id])!==void 0;Pr(c)&&d&&await Ur(c,n,!1).then(e=>{e&&(t[s]=e)})}}async function Hr(e,t,n){for(let r=0;r<n.length;r++){let{key:i,routeId:a,controller:o}=n[r],s=t[i];e.find(e=>e?.route.id===a)&&Pr(s)&&(X(o,`Expected an AbortController for revalidating fetcher deferred result`),await Ur(s,o.signal,!0).then(e=>{e&&(t[i]=e)}))}}async function Ur(e,t,n){if(n===void 0&&(n=!1),!await e.deferredData.resolveData(t)){if(n)try{return{type:Z.data,data:e.deferredData.unwrappedData}}catch(e){return{type:Z.error,error:e}}return{type:Z.data,data:e.deferredData.data}}}function Wr(e){return new URLSearchParams(e).getAll(`index`).some(e=>e===``)}function Gr(e,t){let n=typeof t==`string`?on(t).search:t.search;if(e[e.length-1].route.index&&Wr(n||``))return e[e.length-1];let r=Pn(e);return r[r.length-1]}function Kr(e){let{formMethod:t,formAction:n,formEncType:r,text:i,formData:a,json:o}=e;if(t&&n&&r){if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i};if(a!=null)return{formMethod:t,formAction:n,formEncType:r,formData:a,json:void 0,text:void 0};if(o!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function qr(e,t){return t?{state:`loading`,location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:`loading`,location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Jr(e,t){return{state:`submitting`,location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function Yr(e,t){return e?{state:`loading`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:`loading`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function Xr(e,t){return{state:`submitting`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function Zr(e){return{state:`idle`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function Qr(e,t){try{let n=e.sessionStorage.getItem(tr);if(n){let e=JSON.parse(n);for(let[n,r]of Object.entries(e||{}))r&&Array.isArray(r)&&t.set(n,new Set(r||[]))}}catch{}}function $r(e,t){if(t.size>0){let n={};for(let[e,r]of t)n[e]=[...r];try{e.sessionStorage.setItem(tr,JSON.stringify(n))}catch(e){en(!1,`Failed to save applied view transitions in sessionStorage (`+e+`).`)}}}function ei(){return ei=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ei.apply(null,arguments)}var ti=W.createContext(null),ni=W.createContext(null),ri=W.createContext(null),ii=W.createContext(null),ai=W.createContext({outlet:null,matches:[],isDataRoute:!1}),oi=W.createContext(null);function si(){return W.useContext(ii)!=null}function ci(){return!si()&&X(!1),W.useContext(ii).location}function li(){return W.useContext(ii).navigationType}var ui=W.createContext(null);function di(e){let t=W.useContext(ai).outlet;return t&&W.createElement(ui.Provider,{value:e},t)}function fi(e,t,n,r){!si()&&X(!1);let{navigator:i}=W.useContext(ri),{matches:a}=W.useContext(ai),o=a[a.length-1],s=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:`/`;o&&o.route;let l=ci(),u;if(t){var d;let e=typeof t==`string`?on(t):t;!(c===`/`||(d=e.pathname)!=null&&d.startsWith(c))&&X(!1),u=e}else u=l;let f=u.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=dn(e,{pathname:p}),h=_i(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},s,e.params),pathname:Rn([c,i.encodeLocation?i.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:Rn([c,i.encodeLocation?i.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])})),a,n,r);return t&&h?W.createElement(ii.Provider,{value:{location:ei({pathname:`/`,search:``,hash:``,state:null,key:`default`},u),navigationType:Y.Pop}},h):h}function pi(){let e=Si(),t=Un(e)?e.status+` `+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return W.createElement(W.Fragment,null,W.createElement(`h2`,null,`Unexpected Application Error!`),W.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?W.createElement(`pre`,{style:{padding:`0.5rem`,backgroundColor:`rgba(200,200,200, 0.5)`}},n):null,null)}var mi=W.createElement(pi,null),hi=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?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error(`React Router caught the following error during render`,e,t)}render(){return this.state.error===void 0?this.props.children:W.createElement(ai.Provider,{value:this.props.routeContext},W.createElement(oi.Provider,{value:this.state.error,children:this.props.component}))}};function gi(e){let{routeContext:t,match:n,children:r}=e,i=W.useContext(ti);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),W.createElement(ai.Provider,{value:t},r)}function _i(e,t,n,r){if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,o=n?.errors;if(o!=null){let e=a.findIndex(e=>e.route.id&&o?.[e.route.id]!==void 0);!(e>=0)&&X(!1),a=a.slice(0,Math.min(a.length,e+1))}let s=!1,c=-1;if(n&&r&&r.v7_partialHydration)for(let e=0;e<a.length;e++){let t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(c=e),t.route.id){let{loaderData:e,errors:r}=n,i=t.route.loader&&e[t.route.id]===void 0&&(!r||r[t.route.id]===void 0);if(t.route.lazy||i){s=!0,a=c>=0?a.slice(0,c+1):[a[0]];break}}}return a.reduceRight((e,r,i)=>{let l,u=!1,d=null,f=null;n&&(l=o&&r.route.id?o[r.route.id]:void 0,d=r.route.errorElement||mi,s&&(c<0&&i===0?(wi(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),u=!0,f=null):c===i&&(u=!0,f=r.route.hydrateFallbackElement||null)));let p=t.concat(a.slice(0,i+1)),m=()=>{let t;return t=l?d:u?f:r.route.Component?W.createElement(r.route.Component,null):r.route.element?r.route.element:e,W.createElement(gi,{match:r,routeContext:{outlet:e,matches:p,isDataRoute:n!=null},children:t})};return n&&(r.route.ErrorBoundary||r.route.errorElement||i===0)?W.createElement(hi,{location:n.location,revalidation:n.revalidation,component:d,error:l,children:m(),routeContext:{outlet:null,matches:p,isDataRoute:!0}}):m()},null)}var vi=function(e){return e.UseBlocker=`useBlocker`,e.UseLoaderData=`useLoaderData`,e.UseActionData=`useActionData`,e.UseRouteError=`useRouteError`,e.UseNavigation=`useNavigation`,e.UseRouteLoaderData=`useRouteLoaderData`,e.UseMatches=`useMatches`,e.UseRevalidator=`useRevalidator`,e.UseNavigateStable=`useNavigate`,e.UseRouteId=`useRouteId`,e}(vi||{});function yi(e){let t=W.useContext(ni);return!t&&X(!1),t}function bi(e){let t=W.useContext(ai);return!t&&X(!1),t}function xi(e){let t=bi(e),n=t.matches[t.matches.length-1];return!n.route.id&&X(!1),n.route.id}function Si(){let e=W.useContext(oi),t=yi(vi.UseRouteError),n=xi(vi.UseRouteError);return e===void 0?t.errors?.[n]:e}var Ci={};function wi(e,t,n){!t&&!Ci[e]&&(Ci[e]=!0)}var Ti=(e,t,n)=>(``+t+("You can use the `"+e+"` future flag to opt-in early. ")+(`For more information, see `+n+`.`),void 0);function Ei(e,t){e?.v7_startTransition===void 0&&Ti(`v7_startTransition`,"React Router will begin wrapping state updates in `React.startTransition` in v7",`https://reactrouter.com/v6/upgrading/future#v7_starttransition`),e?.v7_relativeSplatPath===void 0&&(!t||t.v7_relativeSplatPath===void 0)&&Ti(`v7_relativeSplatPath`,`Relative route resolution within Splat routes is changing in v7`,`https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath`),t&&(t.v7_fetcherPersist===void 0&&Ti(`v7_fetcherPersist`,`The persistence behavior of fetchers is changing in v7`,`https://reactrouter.com/v6/upgrading/future#v7_fetcherpersist`),t.v7_normalizeFormMethod===void 0&&Ti(`v7_normalizeFormMethod`,"Casing of `formMethod` fields is being normalized to uppercase in v7",`https://reactrouter.com/v6/upgrading/future#v7_normalizeformmethod`),t.v7_partialHydration===void 0&&Ti(`v7_partialHydration`,"`RouterProvider` hydration behavior is changing in v7",`https://reactrouter.com/v6/upgrading/future#v7_partialhydration`),t.v7_skipActionErrorRevalidation===void 0&&Ti(`v7_skipActionErrorRevalidation`,"The revalidation behavior after 4xx/5xx `action` responses is changing in v7",`https://reactrouter.com/v6/upgrading/future#v7_skipactionerrorrevalidation`))}function Di(e){return di(e.context)}function Oi(e){X(!1)}function ki(e){let{basename:t=`/`,children:n=null,location:r,navigationType:i=Y.Pop,navigator:a,static:o=!1,future:s}=e;si()&&X(!1);let c=t.replace(/^\/*/,`/`),l=W.useMemo(()=>({basename:c,navigator:a,static:o,future:ei({v7_relativeSplatPath:!1},s)}),[c,s,a,o]);typeof r==`string`&&(r=on(r));let{pathname:u=`/`,search:d=``,hash:f=``,state:p=null,key:m=`default`}=r,h=W.useMemo(()=>{let e=An(u,c);return e==null?null:{location:{pathname:e,search:d,hash:f,state:p,key:m},navigationType:i}},[c,u,d,f,p,m,i]);return h==null?null:W.createElement(ri.Provider,{value:l},W.createElement(ii.Provider,{children:n,value:h}))}var Ai=function(e){return e[e.pending=0]=`pending`,e[e.success=1]=`success`,e[e.error=2]=`error`,e}(Ai||{});new Promise(()=>{}),W.Component;function ji(e,t){t===void 0&&(t=[]);let n=[];return W.Children.forEach(e,(e,r)=>{if(!W.isValidElement(e))return;let i=[...t,r];if(e.type===W.Fragment){n.push.apply(n,ji(e.props.children,i));return}e.type!==Oi&&X(!1),e.props.index&&e.props.children&&X(!1);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,loader:e.props.loader,action:e.props.action,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=ji(e.props.children,i)),n.push(a)}),n}function Mi(e){let t={hasErrorBoundary:e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&Object.assign(t,{element:W.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:W.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:W.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}function Ni(){return Ni=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ni.apply(null,arguments)}var Pi=`6`;try{window.__reactRouterVersion=Pi}catch{}function Fi(e,t){return nr({basename:t?.basename,future:Ni({},t?.future,{v7_prependBasename:!0}),history:$t({window:t?.window}),hydrationData:t?.hydrationData||Ii(),routes:e,mapRouteProperties:Mi,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window}).initialize()}function Ii(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e=Ni({},e,{errors:Li(e.errors)})),e}function Li(e){if(!e)return null;let t=Object.entries(e),n={};for(let[e,r]of t)if(r&&r.__type===`RouteErrorResponse`)n[e]=new Hn(r.status,r.statusText,r.data,r.internal===!0);else if(r&&r.__type===`Error`){if(r.__subType){let t=window[r.__subType];if(typeof t==`function`)try{let i=new t(r.message);i.stack=``,n[e]=i}catch{}}if(n[e]==null){let t=Error(r.message);t.stack=``,n[e]=t}}else n[e]=r;return n}var Ri=W.createContext({isTransitioning:!1}),zi=W.createContext(new Map),Bi=W.startTransition,Vi=Lt.flushSync;function Hi(e){Bi?Bi(e):e()}function Ui(e){Vi?Vi(e):e()}var Wi=class{constructor(){this.status=`pending`,this.promise=new Promise((e,t)=>{this.resolve=t=>{this.status===`pending`&&(this.status=`resolved`,e(t))},this.reject=e=>{this.status===`pending`&&(this.status=`rejected`,t(e))}})}};function Gi(e){let{fallbackElement:t,router:n,future:r}=e,[i,a]=W.useState(n.state),[o,s]=W.useState(),[c,l]=W.useState({isTransitioning:!1}),[u,d]=W.useState(),[f,p]=W.useState(),[m,h]=W.useState(),g=W.useRef(new Map),{v7_startTransition:_}=r||{},v=W.useCallback(e=>{_?Hi(e):e()},[_]),y=W.useCallback((e,t)=>{let{deletedFetchers:r,flushSync:i,viewTransitionOpts:o}=t;e.fetchers.forEach((e,t)=>{e.data!==void 0&&g.current.set(t,e.data)}),r.forEach(e=>g.current.delete(e));let c=n.window==null||n.window.document==null||typeof n.window.document.startViewTransition!=`function`;if(!o||c){i?Ui(()=>a(e)):v(()=>a(e));return}if(i){Ui(()=>{f&&(u&&u.resolve(),f.skipTransition()),l({isTransitioning:!0,flushSync:!0,currentLocation:o.currentLocation,nextLocation:o.nextLocation})});let t=n.window.document.startViewTransition(()=>{Ui(()=>a(e))});t.finished.finally(()=>{Ui(()=>{d(void 0),p(void 0),s(void 0),l({isTransitioning:!1})})}),Ui(()=>p(t));return}f?(u&&u.resolve(),f.skipTransition(),h({state:e,currentLocation:o.currentLocation,nextLocation:o.nextLocation})):(s(e),l({isTransitioning:!0,flushSync:!1,currentLocation:o.currentLocation,nextLocation:o.nextLocation}))},[n.window,f,u,g,v]);W.useLayoutEffect(()=>n.subscribe(y),[n,y]),W.useEffect(()=>{c.isTransitioning&&!c.flushSync&&d(new Wi)},[c]),W.useEffect(()=>{if(u&&o&&n.window){let e=o,t=u.promise,r=n.window.document.startViewTransition(async()=>{v(()=>a(e)),await t});r.finished.finally(()=>{d(void 0),p(void 0),s(void 0),l({isTransitioning:!1})}),p(r)}},[v,o,u,n.window]),W.useEffect(()=>{u&&o&&i.location.key===o.location.key&&u.resolve()},[u,f,i.location,o]),W.useEffect(()=>{!c.isTransitioning&&m&&(s(m.state),l({isTransitioning:!0,flushSync:!1,currentLocation:m.currentLocation,nextLocation:m.nextLocation}),h(void 0))},[c.isTransitioning,m]),W.useEffect(()=>{},[]);let b=W.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:e=>n.navigate(e),push:(e,t,r)=>n.navigate(e,{state:t,preventScrollReset:r?.preventScrollReset}),replace:(e,t,r)=>n.navigate(e,{replace:!0,state:t,preventScrollReset:r?.preventScrollReset})}),[n]),x=n.basename||`/`,S=W.useMemo(()=>({router:n,navigator:b,static:!1,basename:x}),[n,b,x]),C=W.useMemo(()=>({v7_relativeSplatPath:n.future.v7_relativeSplatPath}),[n.future.v7_relativeSplatPath]);return W.useEffect(()=>Ei(r,n.future),[r,n.future]),W.createElement(W.Fragment,null,W.createElement(ti.Provider,{value:S},W.createElement(ni.Provider,{value:i},W.createElement(zi.Provider,{value:g.current},W.createElement(Ri.Provider,{value:c},W.createElement(ki,{basename:x,location:i.location,navigationType:i.historyAction,navigator:b,future:C},i.initialized||n.future.v7_partialHydration?W.createElement(Ki,{routes:n.routes,future:n.future,state:i}):t))))),null)}var Ki=W.memo(qi);function qi(e){let{routes:t,future:n,state:r}=e;return fi(t,void 0,r,n)}typeof window<`u`&&window.document!==void 0&&window.document.createElement;var Ji;(function(e){e.UseScrollRestoration=`useScrollRestoration`,e.UseSubmit=`useSubmit`,e.UseSubmitFetcher=`useSubmitFetcher`,e.UseFetcher=`useFetcher`,e.useViewTransitionState=`useViewTransitionState`})(Ji||={});var Yi;(function(e){e.UseFetcher=`useFetcher`,e.UseFetchers=`useFetchers`,e.UseScrollRestoration=`useScrollRestoration`})(Yi||={});function Xi(){return Xi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Xi.apply(null,arguments)}var Zi=[`shift`,`alt`,`meta`,`mod`,`ctrl`],Qi={esc:`escape`,return:`enter`,".":`period`,",":`comma`,"-":`slash`," ":`space`,"`":`backquote`,"#":`backslash`,"+":`bracketright`,ShiftLeft:`shift`,ShiftRight:`shift`,AltLeft:`alt`,AltRight:`alt`,MetaLeft:`meta`,MetaRight:`meta`,OSLeft:`meta`,OSRight:`meta`,ControlLeft:`ctrl`,ControlRight:`ctrl`};function $i(e){return(e&&Qi[e]||e||``).trim().toLowerCase().replace(/key|digit|numpad|arrow/,``)}function ea(e){return Zi.includes(e)}function ta(e,t){return t===void 0&&(t=`,`),e.split(t)}function na(e,t,n){t===void 0&&(t=`+`);var r=e.toLocaleLowerCase().split(t).map(function(e){return $i(e)}),i={alt:r.includes(`alt`),ctrl:r.includes(`ctrl`)||r.includes(`control`),shift:r.includes(`shift`),meta:r.includes(`meta`),mod:r.includes(`mod`)},a=r.filter(function(e){return!Zi.includes(e)});return Xi({},i,{keys:a,description:n,hotkey:e})}(function(){typeof document<`u`&&(document.addEventListener(`keydown`,function(e){e.key!==void 0&&oa([$i(e.key),$i(e.code)])}),document.addEventListener(`keyup`,function(e){e.key!==void 0&&sa([$i(e.key),$i(e.code)])})),typeof window<`u`&&window.addEventListener(`blur`,function(){ra.clear()})})();var ra=new Set;function ia(e){return Array.isArray(e)}function aa(e,t){return t===void 0&&(t=`,`),(ia(e)?e:e.split(t)).every(function(e){return ra.has(e.trim().toLowerCase())})}function oa(e){var t=Array.isArray(e)?e:[e];ra.has(`meta`)&&ra.forEach(function(e){return!ea(e)&&ra.delete(e.toLowerCase())}),t.forEach(function(e){return ra.add(e.toLowerCase())})}function sa(e){e===`meta`?ra.clear():(Array.isArray(e)?e:[e]).forEach(function(e){return ra.delete(e.toLowerCase())})}function ca(e,t,n){(typeof n==`function`&&n(e,t)||n===!0)&&e.preventDefault()}function la(e,t,n){return typeof n==`function`?n(e,t):n===!0||n===void 0}function ua(e){return da(e,[`input`,`textarea`,`select`])}function da(e,t){t===void 0&&(t=!1);var n=e.target,r=e.composed,i=null;return i=fa(n)&&r?e.composedPath()[0]&&e.composedPath()[0].tagName:n&&n.tagName,ia(t)?!!(i&&t&&t.some(function(e){return e.toLowerCase()===i?.toLowerCase()})):!!(i&&t&&t)}function fa(e){return!!e.tagName&&!e.tagName.startsWith(`-`)&&e.tagName.includes(`-`)}function pa(e,t){return e.length===0&&t?(console.warn(`A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>`),!0):!t||e.some(function(e){return t.includes(e)})||e.includes(`*`)}var ma=function(e,t,n){n===void 0&&(n=!1);var r=t.alt,i=t.meta,a=t.mod,o=t.shift,s=t.ctrl,c=t.keys,l=e.key,u=e.code,d=e.ctrlKey,f=e.metaKey,p=e.shiftKey,m=e.altKey,h=$i(u),g=l.toLowerCase();if(!(c!=null&&c.includes(h))&&!(c!=null&&c.includes(g))&&![`ctrl`,`control`,`unknown`,`meta`,`alt`,`shift`,`os`].includes(h))return!1;if(!n){if(r===!m&&g!==`alt`||o===!p&&g!==`shift`)return!1;if(a){if(!f&&!d)return!1}else if(i===!f&&g!==`meta`&&g!==`os`||s===!d&&g!==`ctrl`&&g!==`control`)return!1}return c&&c.length===1&&(c.includes(g)||c.includes(h))?!0:c?aa(c):!c},ha=rt(void 0),ga=function(){return ot(ha)};function _a(e,t){return e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce(function(n,r){return n&&_a(e[r],t[r])},!0):e===t}var va=rt({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),ya=function(){return ot(va)};function ba(e){var t=lt(void 0);return _a(t.current,e)||(t.current=e),t.current}var xa=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},Sa=typeof window<`u`?st:K;function Ca(e,t,n,r){var i=q(null),a=i[0],o=i[1],s=lt(!1),c=n instanceof Array?r instanceof Array?void 0:r:n,l=ia(e)?e.join(c?.splitKey):e,u=n instanceof Array?n:r instanceof Array?r:void 0,d=at(t,u??[]),f=lt(d);f.current=u?d:t;var p=ba(c),m=ya().enabledScopes,h=ga();return Sa(function(){if(p?.enabled!==!1&&pa(m,p?.scopes)){var e=function(e,t){var n;if(t===void 0&&(t=!1),!ua(e)||da(e,p?.enableOnFormTags)){if(a!==null){var r=a.getRootNode();if((r instanceof Document||r instanceof ShadowRoot)&&r.activeElement!==a&&!a.contains(r.activeElement)){xa(e);return}}((n=e.target)==null||!n.isContentEditable||p!=null&&p.enableOnContentEditable)&&ta(l,p?.splitKey).forEach(function(n){var r,i=na(n,p?.combinationKey);if(ma(e,i,p?.ignoreModifiers)||(r=i.keys)!=null&&r.includes(`*`)){if(p!=null&&p.ignoreEventWhen!=null&&p.ignoreEventWhen(e)||t&&s.current)return;if(ca(e,i,p?.preventDefault),!la(e,i,p?.enabled)){xa(e);return}f.current(e,i),t||(s.current=!0)}})}},t=function(t){t.key!==void 0&&(oa($i(t.code)),(p?.keydown===void 0&&p?.keyup!==!0||p!=null&&p.keydown)&&e(t))},n=function(t){t.key!==void 0&&(sa($i(t.code)),s.current=!1,p!=null&&p.keyup&&e(t,!0))},r=a||c?.document||document;return r.addEventListener(`keyup`,n,c?.eventListenerOptions),r.addEventListener(`keydown`,t,c?.eventListenerOptions),h&&ta(l,p?.splitKey).forEach(function(e){return h.addHotkey(na(e,p?.combinationKey,p?.description))}),function(){r.removeEventListener(`keyup`,n,c?.eventListenerOptions),r.removeEventListener(`keydown`,t,c?.eventListenerOptions),h&&ta(l,p?.splitKey).forEach(function(e){return h.removeHotkey(na(e,p?.combinationKey,p?.description))})}}},[a,l,p,m]),o}var wa=/([\p{Ll}\d])(\p{Lu})/gu,Ta=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,Ea=/(\d)\p{Ll}|(\p{L})\d/u,Da=/[^\p{L}\d]+/giu,Oa=`$1\0$2`,ka=``;function Aa(e){let t=e.trim();t=t.replace(wa,Oa).replace(Ta,Oa),t=t.replace(Da,`\0`);let n=0,r=t.length;for(;t.charAt(n)===`\0`;)n++;if(n===r)return[];for(;t.charAt(r-1)===`\0`;)r--;return t.slice(n,r).split(/\0/g)}function ja(e){let t=Aa(e);for(let e=0;e<t.length;e++){let n=t[e],r=Ea.exec(n);if(r){let i=r.index+(r[1]??r[2]).length;t.splice(e,1,n.slice(0,i),n.slice(i))}}return t}function Ma(e,t){let[n,r,i]=La(e,t),a=Na(t?.locale),o=Pa(t?.locale),s=t?.mergeAmbiguousCharacters?Fa(a,o):Ia(a,o);return n+r.map((e,t)=>t===0?a(e):s(e,t)).join(t?.delimiter??``)+i}function Na(e){return e===!1?e=>e.toLowerCase():t=>t.toLocaleLowerCase(e)}function Pa(e){return e===!1?e=>e.toUpperCase():t=>t.toLocaleUpperCase(e)}function Fa(e,t){return n=>`${t(n[0])}${e(n.slice(1))}`}function Ia(e,t){return(n,r)=>{let i=n[0];return(r>0&&i>=`0`&&i<=`9`?`_`+i:t(i))+e(n.slice(1))}}function La(e,t={}){let n=t.split??(t.separateNumbers?ja:Aa),r=t.prefixCharacters??ka,i=t.suffixCharacters??ka,a=0,o=e.length;for(;a<e.length;){let t=e.charAt(a);if(!r.includes(t))break;a++}for(;o>a;){let t=o-1,n=e.charAt(t);if(!i.includes(n))break;o=t}return[e.slice(0,a),n(e.slice(a,o)),e.slice(o)]}function Ra(e,t){let n=async e=>{try{let n=await t(e);return{content:[{type:`text`,text:JSON.stringify(n)}],structuredContent:n}}catch(e){return{isError:!0,content:[{type:`text`,text:`Error: ${e instanceof Error?e.message:String(e)}`}]}}};return{...e,callback:n}}function za(e,t){let n=[],r=e.documentModel.global;if(!r.specifications||r.specifications.length===0)return n.push(`Document model has no specifications`),{isValid:!1,errors:n};let i=r.specifications[r.specifications.length-1],a=null;for(let e of i.modules){let n=e.operations.find(e=>e.name===t.type);if(n){a=n;break}}if(!a)return n.push(`Operation "${t.type}" is not defined in any module of the document model`),{isValid:!1,errors:n};let o=Ma(t.type),s=e.actions[o];if(!s)return n.push(`Action creator "${o}" for action type "${t.type}" is not defined in documentModelDocumentModelModule.actions`),{isValid:!1,errors:n};let c=null;try{s(t.input)}catch(e){c=e instanceof Error?e:Error(JSON.stringify(e))}return c&&n.push(`Input validation error: ${c.message}`),a.scope&&t.scope!==a.scope&&n.push(`Action scope "${t.scope}" does not match operation scope "${a.scope}"`),{isValid:n.length===0,errors:n}}var Ba=`powerhouse/document-drive`,Va={name:`createDocument`,description:`Create a new document.
4
4
  Unless the user specifies otherwise, and a drive named "vetra" is available, add the document to that drive by providing the drive's ID in the "driveId" parameter.
5
- When "driveId" is provided, the document is created and added to the drive atomically — no separate "addActions" call with "ADD_FILE" is needed.`,inputSchema:{documentType:V.string().describe(`Type of the document to create`),name:V.string().optional().describe(`Optional name for the document. Used as both the document name and the drive node name when driveId is provided.`),driveId:V.string().optional().describe(`Optional drive ID or slug. When provided, the document is created and added to the drive atomically.`),parentFolder:V.string().optional().describe(`Optional folder ID within the drive to place the document in. Only used when driveId is provided.`)},outputSchema:{documentId:V.string().describe(`ID of the created document`)}},Ha={name:`getDocument`,description:`Retrieve a document by its ID`,inputSchema:{id:V.string().describe(`ID of the document to retrieve`)},outputSchema:{document:V.unknown().describe(`The retrieved Document`)}},Ua={name:`getDocuments`,description:`List documents in a drive`,inputSchema:{parentId:V.string().describe(`ID of the drive`)},outputSchema:{documentIds:V.array(V.string()).describe(`Array of document IDs`)}},Wa={name:`deleteDocument`,description:`Delete a document`,inputSchema:{documentId:V.string().describe(`ID of the document to delete`)},outputSchema:{success:V.boolean().describe(`Whether the deletion was successful`)}},Ga={name:`addActions`,description:`Adds actions to a document. Prefer adding multiples actions at once to reduce the number of steps.`,inputSchema:{documentId:V.string().describe(`ID of the document`),actions:V.array(V.object({type:V.string().describe(`The name of the action`),input:V.unknown().describe(`The payload of the action`),scope:V.string().describe(`The scope of the action`),context:V.record(V.string(),V.unknown()).optional().describe(`Optional action context`)}).strict()).describe(`Action to add to the document`)},outputSchema:{success:V.boolean().describe(`Whether the actions were added`)}},Ka={name:`getDrives`,description:`List all drives`,inputSchema:{},outputSchema:{driveIds:V.array(V.string()).describe(`Array of drive IDs`)}},qa={name:`addDrive`,description:`Create a new drive`,inputSchema:{driveInput:V.object({global:V.object({name:V.string().describe(`Name of the drive`),icon:V.string().nullable().optional().describe(`Optional icon for the drive`)}).describe(`Global drive properties`),preferredEditor:V.string().optional().describe(`Optional app/editor module id recorded as the drive's preferred editor`),local:V.object({availableOffline:V.boolean().optional().describe(`Whether drive is available offline`),sharingType:V.string().nullable().optional().describe(`Sharing type`)}).optional().describe(`Optional local state properties`)}).describe(`Drive configuration`)},outputSchema:{driveId:V.string().describe(`ID of the created drive`)}},Ja={name:`getDrive`,description:`Get a specific drive`,inputSchema:{driveId:V.string().describe(`ID of the drive to retrieve`),options:V.object({revisions:V.record(V.string(),V.number()).optional().describe(`Optional revision filter`),checkHashes:V.boolean().optional().describe(`Whether to check hashes`)}).optional().describe(`Optional get document options`)},outputSchema:{drive:V.unknown().describe(`Drive document`)}},Ya={name:`deleteDrive`,description:`Delete a drive`,inputSchema:{driveId:V.string().describe(`ID of the drive to delete`)},outputSchema:{success:V.boolean().describe(`Whether the deletion was successful`)}},Xa={name:`addRemoteDrive`,description:`Connect to a remote drive`,inputSchema:{url:V.string().describe(`URL of the remote drive`),options:V.object({availableOffline:V.boolean().describe(`Whether drive is available offline`),sharingType:V.string().nullable().optional().describe(`Sharing type`),pullFilter:V.object({branch:V.array(V.string()).nullable().optional().describe(`Branch filter`),documentId:V.array(V.string()).nullable().optional().describe(`Document ID filter`),documentType:V.array(V.string()).nullable().optional().describe(`Document type filter`),scope:V.array(V.string()).nullable().optional().describe(`Scope filter`)}).optional().describe(`Optional pull filter`),pullInterval:V.number().optional().describe(`Pull interval in milliseconds`)}).describe(`Remote drive options`)},outputSchema:{driveId:V.string().describe(`ID of the added remote drive`)}},Za={name:`getDocumentModelSchema`,description:`Get the schema of a document model`,inputSchema:{type:V.string().describe(`Type of the document model`)},outputSchema:{schema:V.unknown().describe(`Schema of the document model`)}},Qa={name:`getDocumentModels`,description:`Get the list of document models`,inputSchema:{},outputSchema:{documentModels:V.array(V.object({name:V.string().describe(`Name of the document model`),type:V.string().describe(`Type of the document model`),description:V.string().describe(`Description of the document model`),extension:V.string().describe(`Extension of the document model`),authorName:V.string().describe(`Author name of the document model`),authorWebsite:V.string().describe(`Author website of the document model`)})).describe(`List of available document models`)}};function $a(e){let{client:t,syncManager:n,subject:r}=e,i=r?{subject:r}:void 0;function a(e){return t.getDocumentModelModule(e)}let o={getDocument:Ra(Ha,async e=>{let n=await t.get(e.id,i);return{document:{header:n.header,state:n.state}}}),createDocument:Ra(Va,async e=>{if(e.driveId){let n=await a(e.documentType);if(!n)throw Error(`Document model for type '${e.documentType}' not found`);let r=Nt(n.utils.createDocument(),await t.getCreateSignaturePolicy());return e.name&&(r.header.name=e.name),{documentId:(await t.drives.addFile(e.driveId,r,e.parentFolder)).header.id}}return{documentId:(await t.createEmpty(e.documentType,{})).header.id}}),getDocuments:Ra(Ua,async e=>({documentIds:(await t.getOutgoingRelationships(e.parentId,`child`,i)).results.map(e=>e.header.id)})),deleteDocument:Ra(Wa,async e=>{try{let n=(await t.getIncomingRelationships(e.documentId,`child`)).results.find(e=>e.header.documentType===Ba);return n?await t.drives.removeNode(n.header.id,e.documentId):await t.deleteDocument(e.documentId),{success:!0}}catch{return{success:!1}}}),addActions:Ra(Ga,async e=>{let n=await t.get(e.documentId,i),o=await a(n.header.documentType);if(!o)throw Error(`Document model for document type '${n.header.documentType}' not found`);let s=e.actions.map(e=>{let t=At(e.type,e.input??{},void 0,void 0,e.scope),n=za(o,t);if(!n.isValid)throw Error(`Invalid action ${JSON.stringify(t)}: ${n.errors.join(`, `)}`);return t});return await t.execute(e.documentId,`main`,s,void 0,r),{success:!0}}),getDrives:Ra(Ka,async()=>({driveIds:(await t.find({type:Ba},i)).results.map(e=>e.header.id)})),addDrive:Ra(qa,async e=>{let{driveInput:n}=e,i=(await t.createEmpty(Ba,{})).header.id;n.global.name&&await t.rename(i,n.global.name),n.preferredEditor&&await t.setPreferredEditor(i,n.preferredEditor);let a=[];return n.global.icon&&a.push(Ft({icon:n.global.icon})),n.local?.sharingType&&a.push(It({type:n.local.sharingType})),n.local?.availableOffline!==void 0&&a.push(Pt({availableOffline:n.local.availableOffline})),a.length>0&&await t.execute(i,`main`,a,void 0,r),{driveId:i}}),getDrive:Ra(Ja,async e=>{let n=await t.get(e.driveId,i);return{drive:{header:n.header,state:n.state}}}),deleteDrive:Ra(Ya,async e=>{try{return await t.deleteDocument(e.driveId),{success:!0}}catch{return{success:!1}}}),addRemoteDrive:Ra(Xa,async e=>{if(!n)throw Error(`Remote drive management is not available. SyncManager was not configured for this MCP server.`);let t=await fetch(e.url);if(!t.ok)throw Error(`Failed to resolve drive info from ${e.url}`);let r=await t.json(),i=r.id,a=h.forDrive(i);if(n.list().find(e=>e.meta.collectionId.equals(a)))return{driveId:i};let o=`mcp-remote-${crypto.randomUUID()}`;return await n.add(o,a,{type:`gql`,parameters:{url:r.graphqlEndpoint}}),{driveId:i}}),getDocumentModels:Ra(Qa,async()=>({documentModels:(await t.getDocumentModelModules()).results.map(e=>{let t=e.documentModel.global;return{name:t.name,type:t.id,description:t.description,extension:t.extension,authorName:t.author.name,authorWebsite:t.author.website??``}})})),getDocumentModelSchema:Ra(Za,async e=>{let t=(await a(e.type))?.documentModel.global;if(!t)throw Error(`Document model '${e.type}' not found`);return{schema:t}})};return Promise.resolve({tools:o,resources:{},prompts:{}})}function eo(e){return{meta:{...ue,supportedMethods:R(e.methods)},load:()=>r(()=>import(`./factory-CGO-x_eD.js`).then(t=>t.createMockAdapter(e)),__vite__mapDeps([7,8,9,10,11,12,13,14,15,16,17]))}}function to(e){return{meta:{...fe,supportedMethods:de(e.methods)},load:()=>r(()=>import(`./factory-D6WcIdrN.js`).then(t=>t.createPrivyAdapter(e)),__vite__mapDeps([18,1,19,20,2,21,22,23,24,15,10,12,8,9,11,13,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,17,55]))}}var no={id:`rainbow`,redirectReturnParams:[],supportedMethods:[le.WALLET]};function ro(e){return{meta:no,load:()=>r(()=>import(`./factory-CLXw251O.js`).then(t=>t.createRainbowAdapter(e)),__vite__mapDeps([56,1,2,57,58,21,22,23,15,10,11,9,12,13,59,60,61,62,63,64,65,66,67,68,69,8,70,71,72,26,17,53,73,74]))}}(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`021db84f-f706-5644-9182-2425eb27187c`)}catch{}})();var io=me([`Connect`]);function ao(e){return`fallbackRender`in e}function oo(){return null}function so({message:e=`Something went wrong`}){return z(`div`,{className:`text-center wrap-break-word text-foreground`,children:e})}function co({error:e,resetErrorBoundary:t}){let n=e instanceof Error?e.message:String(e),r=e instanceof Error?e.stack??String(e.cause):JSON.stringify(e,null,2);return z(`div`,{className:`z-10 mx-auto flex max-w-[80%] flex-1 items-center justify-center p-6`,children:B(`div`,{className:`w-full max-w-lg rounded-lg border border-border bg-card p-6 text-foreground shadow-sm`,children:[B(`div`,{className:`mb-3 flex items-center gap-2`,children:[z(j,{name:`Error`,className:`size-5 shrink-0 text-destructive`}),z(`h1`,{className:`text-lg font-semibold text-foreground`,children:`Something went wrong`})]}),z(`p`,{className:`mb-4 text-sm wrap-break-word text-foreground`,children:n}),r!==`{}`&&B(`details`,{className:`group`,children:[z(`summary`,{className:`cursor-pointer text-sm font-medium text-foreground underline select-none hover:hover-effect`,children:`Show details`}),z(`pre`,{className:`mt-2 max-h-48 overflow-auto rounded-sm bg-muted p-3 text-xs text-foreground`,children:r})]}),z(ne,{type:`button`,onClick:t,className:`mt-4 px-3 py-1.5 text-base font-medium`,children:`Try again`})]})})}function lo({error:e}){let t=e instanceof Error?e.message:String(e);return z(`div`,{className:`flex size-full items-center justify-center p-6`,children:z(`h3`,{className:`max-w-lg min-w-0 text-center text-lg font-semibold wrap-break-word text-foreground`,children:t})})}function uo(e,t){switch(e){case`silent`:return oo;case`text`:return()=>z(so,{message:t});case`detailed`:return co;default:return lo}}function fo(e){let{children:t,onError:n,resetKeys:r,loggerContext:i}=e,a=(e,t)=>{if(e.message.includes(`Failed to fetch dynamically imported module`)&&e.message.includes(`node_modules/.vite`)){console.error(e),console.log(`Outdated chunk detected, reloading page...`),window.location.reload();return}(i?me(i):io).error(`@error @info`,e,t),n?.(e,t)},o=ao(e)?e.fallbackRender:uo(e.variant,e.fallbackMessage);return z(Xt,{fallbackRender:o,onError:a,resetKeys:r,children:t})}function po(...e){window.dataLayer?.push(...e)}var mo=()=>{let e=O.gaTrackingId,[{analytics:t}]=L(),n=e&&t;return K(()=>{if(n){let t=document.createElement(`script`);return t.src=`https://www.googletagmanager.com/gtag/js?id=${e}`,t.async=!0,document.head.appendChild(t),window.dataLayer=window.dataLayer||[],po(`js`,new Date),po(`config`,e),()=>{document.head.removeChild(t)}}},[n,e]),null},ho;async function go(e){if(!e.clientId)return;if(ho)return ho;let{OpenPanel:n}=await r(async()=>{let{OpenPanel:e}=await import(`./dist-CafobzAC.js`);return{OpenPanel:e}},__vite__mapDeps([75,2]));return ho=new n({clientId:e.clientId,...e.apiUrl?{apiUrl:e.apiUrl}:{},trackScreenViews:!0,trackOutgoingLinks:!0}),ho.setGlobalProperties({app:`connect`}),t(ho),ho}function _o(){ho=void 0,n()}var vo=[{documentType:`powerhouse/document-drive`,actionTypes:[`ADD_FOLDER`,`DELETE_NODE`,`ADD_FILE`,`UPDATE_FILE`,`COPY_NODE`,`MOVE_NODE`,`SET_DRIVE_NAME`,`SET_DRIVE_ICON`]},{documentType:`powerhouse/document-model`,actionTypes:[`SET_MODEL_NAME`,`SET_MODEL_ID`,`ADD_MODULE`,`DELETE_MODULE`,`ADD_OPERATION`,`DELETE_OPERATION`]},{documentType:`powerhouse/reactor-drive`,actionTypes:[`ADD_FOLDER`,`REMOVE_FOLDER`,`UPDATE_FOLDER`]}],yo=V.object({documentType:V.string().min(1),actionTypes:V.array(V.string().min(1)).min(1),alias:V.string().optional()}).strict(),bo=V.array(yo).readonly();function xo(e=vo){let t=bo.safeParse(e);if(!t.success)throw Error(`Invalid OpenPanel events.json: ${t.error.message}`);let n=t.data,r=new Map;for(let e of n){let t=r.get(e.documentType);t||(t=new Map,r.set(e.documentType,t));for(let n of e.actionTypes){if(t.has(n))throw Error(`Duplicate OpenPanel event mapping for ${e.documentType}/${n}`);t.set(n,e)}}return{mappings:n,lookupMap:r}}var{mappings:So,lookupMap:Co}=xo(),wo=So,To=Co;function Eo(e){return e.toLowerCase().replace(/\//g,`.`).replace(/[^a-z0-9._-]/g,``)}function Do(e,t){return e.alias?e.alias:`${Eo(t.context.documentType)}.${t.operation.action.type.toLowerCase()}`}function Oo(e){return{documentType:e.context.documentType,actionType:e.operation.action.type,documentId:e.context.documentId,scope:e.context.scope,branch:e.context.branch}}var ko=class{client;lookupMap;onError;constructor(e,t,n=e=>console.warn(`[OpenPanelProcessor] Error tracking event:`,e)){this.client=e,this.lookupMap=t,this.onError=n}async onOperations(e){for(let t of e){let e=this.lookupMap.get(t.context.documentType);if(!e)continue;let n=e.get(t.operation.action.type);if(!n)continue;let r=Do(n,t),i=Oo(t);try{await this.client.track(r,i)}catch(e){this.onError(e,t)}}}onDisconnect(){return this.client.flush?.(),Promise.resolve()}};function Ao(e){return function(t){let n=Array.from(e.events.lookupMap.keys());return[{processor:new ko(e.client,e.events.lookupMap,e.onError),filter:{documentType:n},startFrom:e.startFrom??`current`}]}}function jo(e){let{credential:t,...n}=e,r={address:n.address,did:n.did,networkId:n.networkId,chainId:n.chainId,caip2:`${n.networkId}:${n.chainId}`};return n.ens?.name!=null&&(r.ensName=n.ens.name),n.ens?.avatarUrl!=null&&(r.ensAvatar=n.ens.avatarUrl),n.profile?.username!=null&&(r.username=n.profile.username),n.profile?.userImage!=null&&(r.userImage=n.profile.userImage),n.profile?.documentId!=null&&(r.profileDocumentId=n.profile.documentId),n.profile?.createdAt!=null&&(r.profileCreatedAt=n.profile.createdAt),r}function Mo(e){let t=e.profile?.userImage??e.ens?.avatarUrl,n=e.ens?.name??e.profile?.username;return{profileId:e.address,...t==null?{}:{avatar:t},...n==null?{}:{firstName:n},properties:jo(e)}}function No(){let[{analytics:e}]=L(),t=Xe(),n=ze(),r=n?.kind===`browser`?n:void 0,[i,a]=q(),o=lt(void 0),s=e&&!!O.openPanel.clientId,c=r?.reactorModule?.processorManager;return K(()=>{if(!s)return;let e=!1,t=()=>e;return(async()=>{let e;try{e=await go(O.openPanel)}catch(e){console.warn(`[OpenPanel] Failed to build client:`,e);return}if(!t()&&e&&(a(e),window.openPanel=e,O.openPanel.trackOperations&&c))try{await c.registerFactory(`openpanel`,Ao({client:e,events:{mappings:wo,lookupMap:To},startFrom:`current`})),t()&&await c.unregisterFactory(`openpanel`).catch(e=>console.warn(`[OpenPanel] Failed to unregister factory after cancellation:`,e))}catch(e){console.warn(`[OpenPanel] Failed to register processor factory:`,e)}})(),()=>{e=!0,o.current=void 0,O.openPanel.trackOperations&&c&&c.unregisterFactory(`openpanel`).catch(e=>console.warn(`[OpenPanel] Failed to unregister processor factory:`,e)),_o(),window.openPanel=void 0,a(void 0)}},[s,c]),K(()=>{if(!s||!i)return;let e=o.current;if(o.current=t,!e&&t)try{i.identify(Mo(t))}catch(e){console.warn(`[OpenPanel] Failed to identify user:`,e)}else if(e&&!t)try{i.clear()}catch(e){console.warn(`[OpenPanel] Failed to clear user:`,e)}},[i,t,s]),null}function Po(){let[e]=Ve(),t=Ie(e.header.id);return ct(()=>async()=>{},[]),at(()=>{Ce(t)},[t]),z(`div`,{id:`document-editor-container`,className:`flex-1`,"data-document-type":e.header.documentType,children:z(ec,{document:e})})}function Fo(e){let[t,n]=q(!1);if(K(()=>{setTimeout(()=>{n(!0)},e.loadingTimeout??200)},[e]),!t)return null;let{customEditorLoader:r,...i}=e;return r?z(pe,{children:r}):z(mt,{...i})}function Io(){let[e]=We(),t=He(),n=we(e?.header.meta?.preferredEditor),r=Ee();if(!e)return z(Fo,{});let i=n?.Component??r?.Component??te.Component;if(!i)throw Error(`No app component found`);return z(fo,{variant:`detailed`,resetKeys:[e.header.id],loggerContext:[`Connect`,`App`],children:z(nt,{fallback:z(Fo,{}),children:z(gt,{className:`flex h-full flex-col overflow-auto`,children:z(i,{children:t?z(Po,{}):null})})})})}var Lo=[];function Ro(){let e=Re();return ut(t=>e?.subscribeFailed(t)??(()=>{}),()=>e?.getFailedInstallations()??Lo)}var zo=me([`sentry`]),Bo=!1;async function Vo(){return await r(()=>import(`./esm-Bnzz5TQ0.js`),__vite__mapDeps([76,1]))}async function Ho(){let e=await Vo(),t=[e.httpClientIntegration(),e.extraErrorDataIntegration({depth:5}),e.replayIntegration(),e.captureConsoleIntegration({levels:[`error`]})];O.sentry.tracing&&t.push(e.reactRouterV6BrowserTracingIntegration({useEffect:$e.useEffect,useLocation:ci,useNavigationType:li,createRoutesFromChildren:ji,matchRoutes:dn})),e.init({release:O.sentry.release,dsn:O.sentry.dsn??void 0,environment:O.sentry.env,integrations:t,ignoreErrors:[`User is not allowed to create files`,`User is not allowed to move documents`,`The user aborted a request.`],sendDefaultPii:!0,tracesSampleRate:1,replaysSessionSampleRate:.1,replaysOnErrorSampleRate:1,beforeSend(e,t){let n=t.originalException;return n instanceof TypeError&&n.message.includes(`Failed to fetch`)&&!navigator.onLine?null:e}}),ce(e),Bo=!0}async function Uo(){if(!Bo)return;let e=await Vo();return ce(void 0),e.getClient()?.close()}function Wo(){let[e]=L(),{analytics:t}=e;K(()=>{if(!t){Uo().catch(e=>zo.error(`@error`,e));return}Bo||O.sentry.dsn===null||O.sentry.dsn===void 0||O.sentry.dsn===``||Ho().catch(e=>zo.error(`@error`,e))},[t])}var Go=[];function Ko(){let e=Re(),t=lt(Go),n=at(()=>{if(!e)return Go;let n=e.getPendingInstallations()??Go,r=t.current;return n===r||n.length===r.length&&n.every((e,t)=>e===r[t])?r:(t.current=n,n)},[e]);return ut(t=>e?.subscribePending(t)??(()=>{}),n)}var qo=e=>{let{undo:t,redo:n,canRedo:r,canUndo:i}=e,a=window.navigator.userAgent.includes(`Mac`),o=`ctrl+z`,s=`ctrl+y`;a&&(o=`mod+z`,s=`mod+shift+z`),Ca(o,e=>{e.preventDefault(),i&&t()},{},[i,t]),Ca(s,e=>{e.preventDefault(),r&&n()},{},[r,n])},Jo=({children:e})=>(Wo(),e),Yo=[],Xo=new Set;function Zo(){for(let e of Xo)e()}function Qo(){return Yo}function $o(e){return`${e.name}|${e.size}|${e.lastModified}`}function es(e){let t=new Set(Yo.map($o)),n=e.filter(e=>{let n=$o(e);return!t.has(n)&&(t.add(n),!0)});n.length!==0&&(Yo=[...Yo,...n],Zo())}function ts(){Yo.length!==0&&(Yo=[],Zo())}function ns(e){return Xo.add(e),()=>{Xo.delete(e)}}async function rs(e){let t=e.files.filter(e=>e.kind===`file`);if(t.length===0)return;let n=[];for(let e of t)try{n.push(await e.getFile())}catch(t){console.error(`Failed to read launched file:`,e.name,t)}n.length!==0&&(es(n),U({type:`openFileDocuments`}))}function is(){Qo().length!==0&&window.ph?.modal===void 0&&U({type:`openFileDocuments`})}var as=!1;function os(){as||(as=!0,window.addEventListener(`ph:modalUpdated`,is),window.launchQueue?.setConsumer(e=>{rs(e)}))}var ss=[],cs=new Set;function ls(){for(let e of cs)e()}function us(){return ss}function ds(e){return cs.add(e),()=>{cs.delete(e)}}function fs(e){let t=ss.filter(t=>t.id!==e);t.length!==ss.length&&(ss=t,ls())}function ps(){ss.length!==0&&(ss=[],ls())}function ms(e){ss=[...ss,...e],ls()}function hs(e,t){ss=ss.map(n=>n.id===e?{...n,...t}:n),ls()}var gs=0,_s=Promise.resolve();function vs(e,t,n){return new Promise(r=>{let i=!1,a=e=>{i||(i=!0,r(e))};_e(e.file,t,e.name,void 0,t=>{switch(hs(e.id,{status:Ot(t.stage),progress:t.progress,...t.error?{errorDetails:t.error}:{},...t.documentType?{documentType:t.documentType}:{},...t.fileNode?{fileNode:t.fileNode}:{}}),t.stage){case`complete`:a(t.fileNode);break;case`failed`:case`unsupported-document-type`:a(void 0)}},n,`duplicate`).catch(()=>{a(void 0)})})}function ys(e){let{driveId:t,imports:n,documentTypes:r}=e;if(n.length===0)return _s;let i=n.map(({file:e,name:t})=>({id:`open-file-${++gs}`,file:e,name:t}));ms(i.map(e=>({id:e.id,fileName:e.name,fileSize:Dt(e.file.size),status:`pending`,progress:0})));let a=async()=>{let e=[];for(let n of i)e.push(await vs(n,t,r));i.length===1&&e[0]&&Ce(e[0])};return _s=_s.then(a,a),_s}var bs=e=>window.open(e,`_blank`),xs=`ph-pglite-backup::`,Ss=`ph:pglite-backups`,Cs=2592e6;function ws(e,t=15e3){return new Promise((n,r)=>{let i=indexedDB.deleteDatabase(e),a=!1,o=e=>{a||(a=!0,e())},s=setTimeout(()=>o(()=>r(Error(`IDB delete timed out for ${e} after ${t}ms`))),t);i.onsuccess=()=>o(()=>{clearTimeout(s),n()}),i.onerror=()=>o(()=>{clearTimeout(s),r(w(i,`IDB delete failed for ${e}`))})})}function Ts(){try{let e=localStorage.getItem(Ss);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function Es(e){try{localStorage.setItem(Ss,JSON.stringify(e))}catch{}}function Ds(e){Es([...Ts(),e])}function Os(e){Es(Ts().filter(t=>t.name!==e))}async function ks(){let e=Date.now()-Cs,t=[];for(let n of Ts()){if(n.createdAt>=e){t.push(n);continue}try{await ws(n.name)}catch(e){console.warn(`Failed to delete expired pglite backup ${n.name}`,e),t.push(n)}}Es(t)}function As(){return{snapshot:async e=>{let t=`${xs}${e}::${new Date().toISOString()}`;return await Wt(e,t),Ds({name:t,idbName:e,createdAt:Date.now()}),t},rollback:async(e,t,n)=>{let r=e;try{await Wt(r,t)}catch(e){console.error(`PGlite migration rollback failed for ${t}; backup ${r} retained. Primary migration error:`,n,`Rollback error:`,e);return}await ws(r).catch(()=>void 0),Os(r)},discard:async e=>{let t=e;await ws(t).catch(()=>void 0),Os(t)},commit:()=>Promise.resolve()}}async function js(){let e=As();try{for(let t of S)await qt(t,e=>F({idbName:t,phase:e}),e)}finally{F(null)}}async function Ms(){if(ks().catch(e=>console.warn(`PGlite backup janitor failed`,e)),!(typeof navigator<`u`&&`locks`in navigator&&typeof navigator.locks.request==`function`)){await js();return}await navigator.locks.request(`ph-pglite-migration`,{mode:`exclusive`},async()=>{await js()})}function Ns(){let e=window.ph,t=e?.reactorClient;if(!t)return Promise.reject(Error(`The reactor client is not available yet. Try again shortly.`));let n=e?.reactorClientModule?.reactorModule?.syncModule?.syncManager;return $a({client:t,syncManager:n}).then(t=>{let n=Object.values(t.tools).map(e=>({...e,inputSchema:e.inputSchema??{}})),r=new Set(n.map(e=>e.name)),i=(e?.vetraPackageManager?.packages??[]).flatMap(e=>(e.aiTools??[]).filter(e=>r.has(e.name)?(console.warn(`[Connect][AI] Package tool "${e.name}" shadows an existing tool and was ignored.`),!1):(r.add(e.name),!0)));return[...n,zt(),...i]})}function Ps(){return z(Rt,{getTools:Ns})}var Fs={"no-registry":`No package registry is configured.`,"not-in-registry":`No matching package found in the registry.`,"registry-error":`Couldn't reach the package registry.`,"install-failed":`Package failed to install.`,dismissed:`Installation was dismissed.`,offline:`You're offline — this package can't be loaded until you reconnect.`};function Is(e){return e!==`no-registry`}function Ls(){let e=Ro(),t=Re(),[n,r]=q(!1),[i,a]=q(!1);return K(()=>t?.subscribeEvents(e=>{e.type===`load-failed`&&a(!1)}),[t]),e.length===0?null:B(pe,{children:[i?null:z(`div`,{className:`absolute inset-x-0 top-0 z-200 bg-background`,children:B(`div`,{className:`flex items-center justify-between gap-3 bg-warning/10 px-4 py-2 text-sm text-warning`,children:[z(`span`,{children:e.length===1?`1 document type couldn't load (missing model).`:`${e.length} document types couldn't load (missing models).`}),B(`div`,{className:`flex items-center gap-2`,children:[z(`button`,{type:`button`,onClick:()=>r(!0),className:`rounded-md border border-warning bg-background px-3 py-1 text-warning hover:hover-effect`,children:`View`}),z(`button`,{type:`button`,onClick:()=>a(!0),"aria-label":`Dismiss`,className:`flex items-center text-warning hover:hover-effect`,children:z(j,{name:`XmarkLight`,size:16})})]})]})}),z(Rs,{open:n,failed:e,onClose:()=>r(!1)})]})}function Rs(e){let{open:t,failed:n,onClose:r}=e,i=Re(),[a,o]=q(()=>new Set);async function s(e){if(i){o(t=>new Set(t).add(e));try{await i.retryInstallation(e)}finally{o(t=>{let n=new Set(t);return n.delete(e),n})}}}return z(re,{open:t,onOpenChange:e=>{e||r()},contentProps:{className:`rounded-3xl`},children:B(`div`,{className:`w-[520px] max-w-[90vw] bg-background p-6`,children:[z(`div`,{className:`border-b border-border pb-2 text-2xl font-bold text-foreground`,children:`Missing document models`}),z(`div`,{className:`my-4 text-sm text-foreground`,children:`The following document types couldn't be loaded. Documents using them won't display until the underlying package is installed.`}),n.length===0?z(`div`,{className:`rounded-xl bg-background p-4 text-sm text-foreground`,children:`No outstanding failures.`}):z(`div`,{className:`flex max-h-[60vh] flex-col gap-3 overflow-y-auto`,children:n.map(e=>{let t=a.has(e.documentType),n=!Is(e.reason)||t;return B(`div`,{className:`rounded-xl bg-background p-4`,children:[z(`div`,{className:`mb-1 font-mono text-sm font-semibold text-foreground`,children:e.documentType}),z(`div`,{className:`mb-2 text-xs text-foreground`,children:Fs[e.reason]}),e.packageNames.length>0?B(`div`,{className:`mb-2 text-xs text-muted-foreground`,children:[`Package`,e.packageNames.length>1?`s`:``,`:`,` `,e.packageNames.join(`, `)]}):null,e.error?z(`div`,{className:`mb-2 font-mono text-xs wrap-break-word text-destructive`,children:e.error.message}):null,z(`div`,{className:`flex justify-end`,children:z(`button`,{type:`button`,onClick:()=>void s(e.documentType),disabled:n,title:Is(e.reason)?void 0:`No registry is configured; nothing to retry against.`,className:M(`min-h-[32px] rounded-xl px-3 py-1 text-sm font-semibold text-foreground transition-all hover:hover-effect`,n?`cursor-not-allowed bg-secondary hover:hover-effect`:`bg-primary text-primary-foreground active:active-effect`),children:t?`Retrying...`:`Try install again`})})]},e.documentType)})}),z(`div`,{className:`mt-4 flex justify-end`,children:z(`button`,{type:`button`,onClick:r,className:`min-h-[36px] rounded-xl border border-border bg-background px-4 py-2 text-sm font-semibold text-foreground hover:hover-effect`,children:`Close`})})]})})}function zs(){let e=ut(ds,us);return z(Et,{uploadsArray:e,uploadsCount:e.length,removeUpload:fs,clearAllUploads:ps,setSelectedNode:Ce})}function Bs(){let e=Ko(),t=Re();if(!t||e.length===0)return null;let n=e.flatMap(e=>e.packageNames.map(t=>({documentType:e.documentType,packageName:t})));return z(St,{pendingInstallations:n,onInstall:e=>t.approveInstallation(e),onDismiss:e=>t.dismissInstallation(e)})}function Vs(e,t){try{return[t()]}catch(t){return console.error(`[connect] Ignoring the "${e}" wallet adapter: connect.renown.adapters.${e} was rejected.`,t),[]}}var Hs=new Map([i,l,s,c,a,o].map(e=>[e.id,e]));function Us(e){if(e===void 0)return;let t=Hs.get(e);if(!t){console.error(`[connect] connect.renown.chainId ${e} is not a chain Connect can offer, so in-page sign-in will be rejected. Supported: ${[...Hs.keys()].join(`, `)}.`);return}return[t]}function Ws(e,t){if(!e)return[];let{rainbow:n,privy:r,mock:i}=e,a=[],o=Us(t);if(n&&a.push(...Vs(`rainbow`,()=>ro({...n,...o?{chains:o}:{}}))),r){let{appId:e,clientId:t,methods:n}=r;e&&a.push(...Vs(`privy`,()=>to({appId:e,clientId:t,methods:n,chain:o?.[0]})))}return i&&a.push(...Vs(`mock`,()=>eo({...i,methods:i.methods}))),a}function Gs(e,t){if(typeof document>`u`)return t;let n=document.createElement(`span`);n.style.color=t,n.style.color=e,n.style.display=`none`,document.body.appendChild(n);let r=getComputedStyle(n).color;return n.remove(),r||t}function Ks({children:t}){let n=e().connect.renown?.adapters,r=e().connect.renown?.chainId,{theme:i}=Ye(),a=ct(()=>Ws(n,r),[n,r]),o=ct(()=>a.length>0?{mode:i,accentColor:Gs(`var(--primary)`,`#0084ff`),accentColorForeground:Gs(`var(--primary-foreground)`,`#ffffff`)}:void 0,[i,a]);return a.length===0?z(pe,{children:t}):z(ge,{adapters:a,theme:o,children:t})}var qs=()=>(Ye(),Ne(),K(()=>{let e=e=>{let t=e.payload,n=(t instanceof Error?t.message:typeof t==`string`?t:``).match(/https?:\/\/[^\s"']+/)?.[0];if(n&&!n.startsWith(window.location.origin)){console.debug(`[Connect] Skipping reload — vite:preloadError for off-origin URL: ${n}`);return}console.log(`Outdated chunks detected, reloading page...`),window.location.reload()};return window.addEventListener(`vite:preloadError`,e),()=>{window.removeEventListener(`vite:preloadError`,e)}},[]),K(()=>{O.offline?N.registerServiceWorker(!1):N.unregisterAll()},[]),K(()=>{os()},[]),z(Jo,{children:B(Ks,{children:[z(p,{position:`bottom-right`}),O.aiAssistantEnabled&&z(Ps,{}),z(Ls,{}),z(Sc,{}),z(zs,{}),z(Bs,{}),z(mo,{}),z(No,{})]})})),Js=()=>{let[e,t]=q(0);return K(()=>{let e=setInterval(()=>{t(e=>e===3?0:e+1)},200);return()=>{clearInterval(e)}},[]),z(`span`,{children:Array(e).fill(`.`).join(``)})};function Ys({drive:e}){let t=Je(),n=ct(()=>e?t.some(t=>t.meta.collectionId.equals(he.forDrive(e.header.id))):!1,[t,e]),r=e?.state.global.icon;return r?z(`img`,{src:r,alt:e.header.name,height:32,width:32}):n?z(j,{name:`Server`,size:32}):z(j,{name:`Hdd`,size:32})}var Xs=({documentId:e})=>{let{t}=A();return B(`div`,{children:[z(`p`,{className:`font-medium`,children:t(`notifications.documentUpgradeAvailable`)}),z(`button`,{onClick:()=>{U({type:`confirmDocumentUpgrade`,documentId:e})},className:`underline decoration-solid underline-offset-2`,children:t(`common.updateDocument`)})]})};function Zs({title:e,children:t}){return z(`div`,{className:`flex size-full items-center justify-center p-6`,children:B(`div`,{className:`w-full max-w-lg rounded-lg border border-border bg-card p-6 text-foreground shadow-sm`,children:[B(`div`,{className:`mb-3 flex items-center gap-2`,children:[z(j,{name:`Error`,className:`size-5 shrink-0 text-destructive`}),z(`h3`,{className:`min-w-0 text-lg font-semibold wrap-break-word text-foreground`,children:e})]}),z(`div`,{className:`wrap-break-word`,children:t})]})})}function Qs(e){return e.includes(`global`)?`global`:e[0]}function $s(){return z(ne,{className:`px-3 py-1.5 text-base font-medium`,onClick:()=>{U({type:`settings`})},type:`button`,children:`Open package manager`})}var ec=e=>{let{document:t}=e,n=Ke(),r=Be(),[i,a]=De(t.header.id),o=i?.header.id??void 0,s=i?.header.name??void 0,c=i?.header.documentType??void 0,l=i?.header.meta?.preferredEditor??void 0,u=ct(()=>{let e=Object.keys(i?.header.revision??{});return e.length>0?e:[`global`]},[i?.header.revision]),[p,m]=q(()=>Qs(u)),h=u.includes(p)?p:Qs(u),{operations:g,isLoading:_,hasNextPage:v,fetchNextPage:y,error:b}=ke(o,h,{enabled:r,limit:500}),{operations:x,hasNextPage:S,isLoading:C,fetchNextPage:w,error:T}=ke(o,`global`,{enabled:!!n,limit:500});K(()=>{if(!S||C||T)return;let e=window.setTimeout(w,0);return()=>window.clearTimeout(e)},[S,C,w,T]);let E=i?.header.revision.global??0,D=i?.header.revision.local??0,ee=Oe(c),O=Me(l),te=Pe(c),k=O??te,A=Ae(i??void 0),j=A?.kind,M=A?.kind===`upgrade-available`&&A.canUpgrade;K(()=>{M&&o?f(it(Xs,{documentId:o}),{type:`connect-warning`,toastId:`outdated-document-${o}`,autoClose:!1}):j&&j!==`upgrade-available`&&o&&d(`outdated-document-${o}`)},[M,j,o]);let ne=Qe(),re=Ze(),N=k?ne.find(e=>e.editors.includes(k))?.manifest.name:void 0,ie=N&&re?re.getPackageVersion(N):void 0,ae=N?`${N}@${ie??`unknown`}`:k?.config.id??`no-editor`,oe=!i,P=k&&c&&!k.documentTypes.includes(c)&&!k.documentTypes.includes(`*`);qo({undo:()=>a(Mt()),redo:()=>a(jt()),canUndo:E>0||D>0,canRedo:!!i?.clipboard.length}),K(()=>()=>{window.documentEditorDebugTools?.clear()},[]);let[F,I]=q(void 0);K(()=>{F&&F.documentId!==o&&I(void 0)},[F,o]);let L=(e,t)=>{I({error:e,documentId:o,info:t})};if(P)return z(Fo,{message:`Loading editor`});if(oe)return z(Fo,{message:`Loading document`});if(!ee)return B(Zs,{title:`Document type not supported`,children:[B(`p`,{className:`mb-4 text-sm text-foreground`,children:[`This document can't be opened because the "`,c,`" document model isn't installed. Install the package that provides it to open the document.`]}),z($s,{})]});if(A?.kind===`unsupported`)return B(Zs,{title:`Document version not supported`,children:[B(`p`,{className:`mb-4 text-sm text-foreground`,children:[`This document requires version `,A.documentVersion,` of the "`,c,`" document model, but only version`,A.availableVersions.length>1?`s`:``,` `,A.availableVersions.join(`, `),` `,A.availableVersions.length>1?`are`:`is`,` installed. Update the package that provides "`,c,`" to open it.`]}),z($s,{})]});if(!k)return B(Zs,{title:`No editor available`,children:[B(`p`,{className:`mb-4 text-sm text-foreground`,children:[`The "`,c,`" document model is installed, but no editor for it was found. Install a package that provides an editor for this document type.`]}),z($s,{})]});let se=k.Component;return z(`div`,{className:`relative h-full`,id:`document-editor-context`,"data-editor":k.config.id,"data-document-type":c,children:r?z(Ct,{documentTitle:s??``,documentId:o??``,operations:g,isLoading:_,hasNextPage:v,onLoadNextPage:y,error:b,scopes:u,scope:h,onScopeChange:m,onClose:()=>Se(!1),documentState:i.state,onCopyState:()=>{f(`Copied document state to clipboard`,{type:`success`})},onCopyDocId:()=>{f(`Copied document ID to clipboard`,{type:`success`})}},o):z(nt,{fallback:z(Fo,{message:`Loading editor`}),name:`EditorLoader`,children:z(fo,{fallbackRender:lo,resetKeys:[o],onError:L,loggerContext:[`Connect`,`DocumentEditor`],children:!F?.error&&z(se,{context:{readMode:!!n,selectedTimelineRevision:(C||S)&&!T?void 0:ve(n?.startDate,n?.endDate,x)},documentId:i.header.id},`${ae}:${o}`)})})})},tc=()=>B(_t,{children:[z(vt,{onClick:()=>se(!0),children:z(k,{i18nKey:`footer.cookiePolicy`})}),z(vt,{onClick:()=>U({type:`disclaimer`}),children:z(k,{i18nKey:`footer.disclaimer`})}),z(vt,{id:`ph-logo-link`,onClick:()=>bs(`https://www.powerhouse.inc/`),children:z(k,{i18nKey:`footer.builtWith`,components:{icon:z(j,{name:`PowerhouseLogoSmall`,size:16,className:`mx-1`})}})})]});function nc(){let e=P();return z(`div`,{className:`h-screen bg-background`,children:z(`div`,{className:`flex h-screen items-stretch overflow-auto`,role:`presentation`,tabIndex:0,children:B(nt,{name:`Root`,children:[!e&&z(Tc,{}),z(`div`,{className:`relative flex-1 overflow-auto`,children:z(Di,{})})]})})})}function rc(e,t,n){let{selectedDriveId:r,remotes:i}=n;if(!r)return null;let a=!1;for(let e of i){if(e.driveId!==r)continue;let n=t.get(e.name);if(n?.state===`error`&&n.requiresAuth){a=!0;break}}return a?e?`unauthorized`:`login`:null}var ic=new Set,ac=[],oc=new Set;function sc(){ac=[...ic];for(let e of[...oc])e()}function cc(e){return oc.add(e),()=>{oc.delete(e)}}function lc(){return ac}function uc(e){ic.has(e)||(ic.add(e),sc())}function dc(){ic.size!==0&&(ic.clear(),sc())}function fc(){return ut(cc,lc,lc)}function pc(){let e=je(),t=fc();return ct(()=>!e||t.length===0?e:e.filter(e=>!t.includes(e.header.id)),[e,t])}function mc(){let e=Xe(),t=Te(),n=qe(),r=Ue(),i=ct(()=>(n?.list()??[]).map(e=>({name:e.meta.name,driveId:e.meta.collectionId.driveId})),[n,t]),a=e?.address;K(()=>{dc()},[a]);let o=at(()=>{r&&uc(r),H(void 0)},[r]);return{gate:rc(!!e,t,{selectedDriveId:r,remotes:i}),dismiss:o}}function hc(){let{gate:e,dismiss:t}=mc(),n=oe(),[r]=We(),i=Ge(),a=He();return K(()=>{a||xe(D)},[a]),K(()=>{r||be(ee)},[r]),z(gc,{children:e?z(`div`,{className:`flex h-full items-center justify-center p-4`,children:z(ht,{mode:e,onLogin:n,onLogout:()=>void ye(),onClose:t})}):z(!a&&!r&&!i?vc:Io,{})})}function gc({children:e}){return z(`div`,{className:`flex h-full flex-col overflow-auto`,id:`content-view`,children:e})}function _c({drive:e}){let t=we(e.header.meta?.preferredEditor)?.config.name||`Drive Explorer App`;return z(xt,{title:e.state.global.name||e.header.name,description:t,icon:z(Ys,{drive:e}),onClick:()=>H(e)},e.header.id)}function vc(){let t=pc(),n=Fe(),r=e().connect?.branding?.homeBackground;return B(yt,{homeBackground:r,children:[t?.map(e=>z(_c,{drive:e},e.header.id)),n&&z(bt,{})]})}function yc(e){let t=O.routerBasename;return Fi(e,{basename:t,future:{v7_fetcherPersist:!0,v7_relativeSplatPath:!0}})}function bc(){return[{element:z(nt,{name:`RouteRoot`,children:z(nc,{})}),children:[{index:!0,path:`d?/:driveId?/*?`,element:z(nt,{name:`Drive`,children:z(hc,{})})}]}]}var xc=yc(bc()),Sc=()=>z(Gi,{router:xc}),Cc=[{id:`project`,label:`.project`,icon:z(j,{name:`Project`,color:`#FF6A55`,size:16})},{id:`budget`,label:`.budget`,icon:z(j,{name:`BarChart`,color:`#8E55EA`,size:16})},{id:`profile`,label:`.profile`,icon:z(j,{name:`Person`,color:`#3E90F0`,size:16})},{id:`legal`,label:`.legal`,icon:z(j,{name:`Briefcase`,color:`#4BAB71`,size:16})},{id:`atlas`,label:`.Atlas`,icon:z(j,{name:`Globe`,color:`#FF8A00`,size:16})}],wc=()=>{let{t:e}=A();return z(dt,{className:`m-4 shrink-0 bg-muted`,placeholder:e(`searchbar.placeholder`),filterLabel:e(`searchbar.filterLabel`),filterItems:Cc})};function Tc(){let e=Xe(),t=oe(),n=pc(),r=Fe(),[i]=We(),a=localStorage.getItem(`CONNECT_DEBUG`)===`true`,o=e?.ens?.name||e?.profile?.username||void 0,s=e?.ens?.avatarUrl||e?.profile?.userImage||void 0,c=kt(s?void 0:e?.address),l=()=>{U({type:`settings`})},u=()=>{U({type:`addDrive`})},d=e?.address?`https://etherscan.io/address/${e.address}`:``;return z(pt,{children:z(ft,{id:`sidebar`,onClick:()=>H(void 0),onClickSettings:l,address:e?.address,onLogin:t,onDisconnect:()=>{ye()},ensName:o||c.data?.ens,avatarUrl:s||c.data?.avatar_small||c.data?.avatar_url||void 0,etherscanUrl:d,showDebug:a,onDebugClick:()=>U({type:`debugSettings`}),children:B(fo,{variant:`text`,fallbackMessage:`There was an error loading drives`,loggerContext:[`Connect`,`Sidebar`],children:[n?.map(e=>z(Tt,{title:e.header.name,onClick:()=>H(e),active:i?.header.id===e.header.id,icon:z(Ys,{drive:e})},e.header.id)),r&&z(wt,{onClick:u})]})})})}var Ec=`connected`,Dc=()=>ut(b,C,()=>Ec)===`lost`?z(`div`,{className:`absolute inset-x-0 top-0 z-30 flex justify-center p-3`,children:B(`div`,{className:`flex max-w-3xl items-center gap-3 rounded-lg border border-destructive bg-warning px-4 py-3 text-sm text-warning-foreground shadow-lg`,children:[B(`div`,{className:`flex-1`,children:[z(`div`,{className:`font-semibold`,children:`Lost connection to the reactor`}),z(`div`,{className:`text-foreground`,children:`The background worker stopped responding. Reload to reconnect.`})]}),z(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`rounded-sm bg-primary px-3 py-1 text-sm font-medium text-primary-foreground hover:hover-effect`,children:`Reload`})]})}):null;function Oc({title:e,body:t,error:n,children:r}){return z(`div`,{className:`absolute inset-x-0 top-0 z-30 flex justify-center p-3`,children:B(`div`,{className:`flex max-w-3xl items-center gap-3 rounded-lg border border-warning bg-warning px-4 py-3 text-sm text-warning-foreground shadow-lg`,children:[B(`div`,{className:`flex-1`,children:[z(`div`,{className:`font-semibold`,children:e}),z(`div`,{className:`text-foreground`,children:t}),n&&B(`div`,{className:`mt-2 font-medium text-destructive`,children:[`Migration failed: `,n]})]}),r]})})}var kc=`rounded-sm bg-primary px-3 py-1 text-sm font-medium text-primary-foreground hover:hover-effect disabled:disabled-effect`,Ac=`rounded-sm border border-foreground bg-transparent px-3 py-1 text-sm font-medium text-foreground hover:hover-effect disabled:disabled-effect`,jc=!1,Mc=new Set;function Nc({adminClient:e}){let t=ut(t=>e.subscribeMigration(t),()=>e.getMigrationState()),[n,r]=q(!1),[i,a]=q(null);if(t.status===`idle`||t.status===`needed`&&n)return null;let o=t.status===`migrating`;return B(Oc,{title:o?`Migrating to Postgres 17…`:`Your local database uses Postgres ${t.legacyMajor??`?`}.`,body:o?`Working (${t.phase??`starting`}). Your data is backed up first.`:`Migrate to Postgres 17 to pick up the latest features. Your data will be backed up first.`,error:i??(t.status===`failed`?t.error:null),children:[!o&&z(`button`,{type:`button`,onClick:()=>{a(null),e.migrate().catch(e=>{a(e instanceof Error?e.message:String(e))})},className:kc,children:t.status===`failed`?`Retry`:`Migrate now`}),t.status===`needed`&&z(`button`,{type:`button`,onClick:()=>r(!0),className:Ac,children:`Dismiss`})]})}function Pc(){let e=ut(e=>(Mc.add(e),()=>Mc.delete(e)),()=>jc,()=>!1),t=ut(x,v,()=>void 0),[n,r]=q(!1),[i,a]=q(null);return t==null||t===17||e?null:B(Oc,{title:`Your local database uses Postgres ${t}.`,body:`Migrate to Postgres 17 to pick up the latest features. Your data will be backed up first.`,error:i,children:[z(`button`,{type:`button`,disabled:n,onClick:()=>{a(null),r(!0),Ms().then(()=>window.location.reload()).catch(e=>{a(e instanceof Error?e.message:String(e)),r(!1)})},className:kc,children:n?`Migrating…`:`Migrate now`}),z(`button`,{type:`button`,disabled:n,onClick:()=>{jc=!0;for(let e of Mc)e()},className:Ac,children:`Dismiss`})]})}var Fc=()=>{let e=ze();return e?.kind===`worker`?z(Nc,{adminClient:e.adminClient}):z(Pc,{})},Ic=G(()=>r(()=>import(`./AddDriveModal-DhNfP94R-Db7-t28c.js`).then(e=>({default:e.AddDriveModal})),__vite__mapDeps([77,78,79]))),Lc=G(()=>r(()=>import(`./ClearStorageModal-DyU-FIgY-EmyEVbqJ.js`).then(e=>({default:e.ClearStorageModal})),__vite__mapDeps([80,81,1,82,2,10,15,9,8,83,13,78,35,36,44,14,84,85,86,87,88,89,90,91,92,93,94,95,26]))),Rc=G(()=>r(()=>import(`./CookiesPolicyModal-BLw4pnhn-BMEgw_d9.js`).then(e=>({default:e.CookiesPolicyModal})),__vite__mapDeps([96,97,1,79,93,94,95,26]))),zc=G(()=>r(()=>import(`./CreateDocumentModal-Bmv0V-kY-XjnemXEP.js`).then(e=>({default:e.CreateDocumentModal})),[])),Bc=G(()=>r(()=>import(`./DebugSettingsModal-CwUN9gIr-DU3Ify9i.js`).then(e=>({default:e.DebugSettingsModal})),__vite__mapDeps([98,85,82,91,99,100,72,1,101,102,87]))),Vc=G(()=>r(()=>import(`./DeleteDriveModal-CjGnG0ht-0JiKrM6c.js`).then(e=>({default:e.DeleteDriveModal})),__vite__mapDeps([103,78,93,94,95,1,26]))),Hc=G(()=>r(()=>import(`./DeleteItemModal-BbY_4_xT-Da6nL2oq.js`).then(e=>({default:e.DeleteItemModal})),__vite__mapDeps([104,78,93,94,95,1,26]))),Uc=G(()=>r(()=>import(`./DisclaimerModal-DuglmEwL-C0NQbt3Z.js`).then(e=>({default:e.DisclaimerModal})),__vite__mapDeps([105,93,94,95,1,26]))),Wc=G(()=>r(()=>import(`./DriveSettingsModal-d1L0eYof-Cr8EtOJO.js`).then(e=>({default:e.DriveSettingsModal})),[])),Gc=G(()=>r(()=>import(`./DownloadDocumentWithErrorsModal-BsPQ5qgy-BiMMFbrN.js`).then(e=>({default:e.DownloadDocumentWithErrorsModal})),__vite__mapDeps([106,93,94,95,1,26]))),Kc=G(()=>r(()=>import(`./DocumentVersionUnsupportedModal-C4fy7fZ6-BeagMztn.js`).then(e=>({default:e.DocumentVersionUnsupportedModal})),[])),qc=G(()=>r(()=>import(`./ConfirmDocumentUpgradeModal-DcOZy20m-DPTWgs7L.js`).then(e=>({default:e.ConfirmDocumentUpgradeModal})),__vite__mapDeps([107,78,100,72,1,101]))),Jc=G(()=>r(()=>import(`./SettingsModal-CgjW-M2a-cl02gX0W.js`).then(e=>({default:e.SettingsModal})),__vite__mapDeps([108,78,79,85,82,91,99,109,86,1,2,87,88,89,90]))),Yc=G(()=>r(()=>import(`./UpgradeDriveModal-CXX6D5Au-C-qcQIPL.js`).then(e=>({default:e.UpgradeDriveModal})),__vite__mapDeps([110,93,94,95,1,26]))),Xc={addDrive:Ic,clearStorage:Lc,cookiesPolicy:Rc,createDocument:zc,debugSettings:Bc,deleteDrive:Vc,deleteItem:Hc,disclaimer:Uc,driveSettings:Wc,downloadDocumentWithErrors:Gc,documentVersionUnsupported:Kc,confirmDocumentUpgrade:qc,inspector:G(()=>r(()=>import(`./InspectorModal-Cd8kbCV8-oAxF19f2.js`).then(e=>({default:e.InspectorModal})),__vite__mapDeps([111,81,1,82,2,10,15,9,8,83,13,78,35,36,44,14,84,85,86,87,88,89,90,91,92,112]))),settings:Jc,upgradeDrive:Yc,missingPackage:G(()=>r(()=>import(`./MissingPackageModal-HFUPQMML-C6p8bl1U.js`).then(e=>({default:e.ConnectMissingPackageModal})),__vite__mapDeps([113,109,82,86,1,2,87,88,89,90]))),driveAuthRequired:G(()=>r(()=>import(`./DriveAuthRequiredModal-CtsB0kwH-Coud7u2c.js`).then(e=>({default:e.DriveAuthRequiredModal})),__vite__mapDeps([114,115]))),openFileDocuments:G(()=>r(()=>import(`./OpenFileDocumentsModal-BQsaBP4x-F5oIaNhF.js`).then(e=>({default:e.OpenFileDocumentsModal})),__vite__mapDeps([116,93,94,95,1,26,100,72,101]))),login:G(()=>r(()=>import(`./LoginModal-CI0ogC2--mRJsXUXd.js`).then(e=>({default:e.LoginModal})),__vite__mapDeps([117,99,100,72,1,101,115])))},Zc=G(()=>Promise.resolve({default:()=>{let e=Le();if(!e?.type)return null;let t=Xc[e.type];return t?z(fo,{variant:`silent`,loggerContext:[`Connect`,`Modals`],children:z(nt,{fallback:null,children:z(t,{})})}):null}})),Qc=()=>ut(ie,ae,()=>!1)?z(`div`,{className:`absolute inset-x-0 bottom-0 z-30 flex justify-center p-3`,children:B(`div`,{className:`flex max-w-3xl items-center gap-3 rounded-lg border border-foreground bg-primary px-4 py-3 text-sm text-primary-foreground shadow-lg`,children:[z(`div`,{className:`flex-1 font-medium`,children:`A new version of Connect is available.`}),z(`button`,{type:`button`,onClick:()=>N.applyUpdate(),className:`rounded-sm bg-primary-foreground px-3 py-1 text-sm font-medium text-primary hover:hover-effect`,children:`Refresh`})]})}):null;function $c({error:e}){return z(`div`,{className:`z-10 mx-auto flex max-w-[80%] flex-1 items-center justify-center p-6`,children:B(`div`,{role:`alert`,className:`w-full max-w-lg rounded-lg border border-border bg-card p-6 text-foreground shadow-sm`,children:[B(`div`,{className:`mb-3 flex items-center gap-2`,children:[z(j,{name:`Error`,className:`size-5 shrink-0 text-destructive`}),z(`h1`,{className:`text-lg font-semibold text-foreground`,children:`Connect cannot open this browser's documents`})]}),z(`p`,{className:`mb-4 text-sm wrap-break-word text-foreground`,children:e.message}),z(ne,{type:`button`,onClick:()=>{window.location.reload()},className:`px-3 py-1.5 text-base font-medium`,children:`Reload`})]})})}var el=G(()=>r(()=>import(`./cookie-banner-BxXvPdIY-CasEfo4n.js`).then(e=>({default:e.CookieBanner})),__vite__mapDeps([118,79,97,1,93,94,95,26,119,120,85,82,121]))),tl=e=>{let t=G(()=>r(()=>import(`./load-ftpCX1HI-sPDToliw.js`).then(t=>t.loadComponent(e.localPackage)),__vite__mapDeps([122,82,81,1,2,10,15,9,8,83,13,78,35,36,44,14,84,85,86,87,88,89,90,91,92,119,79,94,112,123])));return z(tt,{children:B(fo,{fallbackRender:e=>z(I,{children:_(e.error)?z($c,{error:e.error}):z(co,{...e})}),resetKeys:[e.localPackage],loggerContext:[`Connect`],children:[z(nt,{fallback:z(I,{}),name:`AppLoader`,children:z(t,{...e,children:z(qs,{})})}),z(fo,{variant:`silent`,loggerContext:[`Connect`,`CookieBanner`],children:z(nt,{fallback:null,name:`CookieBanner`,children:z(el,{})})}),z(nt,{name:`ModalsContainer`,children:z(Zc,{})}),z(Fc,{}),z(Qc,{}),z(Dc,{})]})})};export{Qo as _,ec as a,ns as b,Ys as c,No as d,nc as f,ts as g,Tc as h,tl as i,Fo as l,wc as m,qs as n,Po as o,Sc as p,Io as r,Js as s,mo as t,tc as u,$o as v,ys as y};
6
- //# sourceMappingURL=app-loader-l5wtQh5z-De20QMC5.js.map
5
+ When "driveId" is provided, the document is created and added to the drive atomically — no separate "addActions" call with "ADD_FILE" is needed.`,inputSchema:{documentType:V.string().describe(`Type of the document to create`),name:V.string().optional().describe(`Optional name for the document. Used as both the document name and the drive node name when driveId is provided.`),driveId:V.string().optional().describe(`Optional drive ID or slug. When provided, the document is created and added to the drive atomically.`),parentFolder:V.string().optional().describe(`Optional folder ID within the drive to place the document in. Only used when driveId is provided.`)},outputSchema:{documentId:V.string().describe(`ID of the created document`)}},Ha={name:`getDocument`,description:`Retrieve a document by its ID`,inputSchema:{id:V.string().describe(`ID of the document to retrieve`)},outputSchema:{document:V.unknown().describe(`The retrieved Document`)}},Ua={name:`getDocuments`,description:`List documents in a drive`,inputSchema:{parentId:V.string().describe(`ID of the drive`)},outputSchema:{documentIds:V.array(V.string()).describe(`Array of document IDs`)}},Wa={name:`deleteDocument`,description:`Delete a document`,inputSchema:{documentId:V.string().describe(`ID of the document to delete`)},outputSchema:{success:V.boolean().describe(`Whether the deletion was successful`)}},Ga={name:`addActions`,description:`Adds actions to a document. Prefer adding multiples actions at once to reduce the number of steps.`,inputSchema:{documentId:V.string().describe(`ID of the document`),actions:V.array(V.object({type:V.string().describe(`The name of the action`),input:V.unknown().describe(`The payload of the action`),scope:V.string().describe(`The scope of the action`),context:V.record(V.string(),V.unknown()).optional().describe(`Optional action context`)}).strict()).describe(`Action to add to the document`)},outputSchema:{success:V.boolean().describe(`Whether the actions were added`)}},Ka={name:`getDrives`,description:`List all drives`,inputSchema:{},outputSchema:{driveIds:V.array(V.string()).describe(`Array of drive IDs`)}},qa={name:`addDrive`,description:`Create a new drive`,inputSchema:{driveInput:V.object({global:V.object({name:V.string().describe(`Name of the drive`),icon:V.string().nullable().optional().describe(`Optional icon for the drive`)}).describe(`Global drive properties`),preferredEditor:V.string().optional().describe(`Optional app/editor module id recorded as the drive's preferred editor`),local:V.object({availableOffline:V.boolean().optional().describe(`Whether drive is available offline`),sharingType:V.string().nullable().optional().describe(`Sharing type`)}).optional().describe(`Optional local state properties`)}).describe(`Drive configuration`)},outputSchema:{driveId:V.string().describe(`ID of the created drive`)}},Ja={name:`getDrive`,description:`Get a specific drive`,inputSchema:{driveId:V.string().describe(`ID of the drive to retrieve`),options:V.object({revisions:V.record(V.string(),V.number()).optional().describe(`Optional revision filter`),checkHashes:V.boolean().optional().describe(`Whether to check hashes`)}).optional().describe(`Optional get document options`)},outputSchema:{drive:V.unknown().describe(`Drive document`)}},Ya={name:`deleteDrive`,description:`Delete a drive`,inputSchema:{driveId:V.string().describe(`ID of the drive to delete`)},outputSchema:{success:V.boolean().describe(`Whether the deletion was successful`)}},Xa={name:`addRemoteDrive`,description:`Connect to a remote drive`,inputSchema:{url:V.string().describe(`URL of the remote drive`),options:V.object({availableOffline:V.boolean().describe(`Whether drive is available offline`),sharingType:V.string().nullable().optional().describe(`Sharing type`),pullFilter:V.object({branch:V.array(V.string()).nullable().optional().describe(`Branch filter`),documentId:V.array(V.string()).nullable().optional().describe(`Document ID filter`),documentType:V.array(V.string()).nullable().optional().describe(`Document type filter`),scope:V.array(V.string()).nullable().optional().describe(`Scope filter`)}).optional().describe(`Optional pull filter`),pullInterval:V.number().optional().describe(`Pull interval in milliseconds`)}).describe(`Remote drive options`)},outputSchema:{driveId:V.string().describe(`ID of the added remote drive`)}},Za={name:`getDocumentModelSchema`,description:`Get the schema of a document model`,inputSchema:{type:V.string().describe(`Type of the document model`)},outputSchema:{schema:V.unknown().describe(`Schema of the document model`)}},Qa={name:`getDocumentModels`,description:`Get the list of document models`,inputSchema:{},outputSchema:{documentModels:V.array(V.object({name:V.string().describe(`Name of the document model`),type:V.string().describe(`Type of the document model`),description:V.string().describe(`Description of the document model`),extension:V.string().describe(`Extension of the document model`),authorName:V.string().describe(`Author name of the document model`),authorWebsite:V.string().describe(`Author website of the document model`)})).describe(`List of available document models`)}};function $a(e){let{client:t,syncManager:n,subject:r}=e,i=r?{subject:r}:void 0;function a(e){return t.getDocumentModelModule(e)}let o={getDocument:Ra(Ha,async e=>{let n=await t.get(e.id,i);return{document:{header:n.header,state:n.state}}}),createDocument:Ra(Va,async e=>{if(e.driveId){let n=await a(e.documentType);if(!n)throw Error(`Document model for type '${e.documentType}' not found`);let r=Nt(n.utils.createDocument(),await t.getCreateSignaturePolicy());return e.name&&(r.header.name=e.name),{documentId:(await t.drives.addFile(e.driveId,r,e.parentFolder)).header.id}}return{documentId:(await t.createEmpty(e.documentType,{})).header.id}}),getDocuments:Ra(Ua,async e=>({documentIds:(await t.getOutgoingRelationships(e.parentId,`child`,i)).results.map(e=>e.header.id)})),deleteDocument:Ra(Wa,async e=>{try{let n=(await t.getIncomingRelationships(e.documentId,`child`)).results.find(e=>e.header.documentType===Ba);return n?await t.drives.removeNode(n.header.id,e.documentId):await t.deleteDocument(e.documentId),{success:!0}}catch{return{success:!1}}}),addActions:Ra(Ga,async e=>{let n=await t.get(e.documentId,i),o=await a(n.header.documentType);if(!o)throw Error(`Document model for document type '${n.header.documentType}' not found`);let s=e.actions.map(e=>{let t=At(e.type,e.input??{},void 0,void 0,e.scope),n=za(o,t);if(!n.isValid)throw Error(`Invalid action ${JSON.stringify(t)}: ${n.errors.join(`, `)}`);return t});return await t.execute(e.documentId,`main`,s,void 0,r),{success:!0}}),getDrives:Ra(Ka,async()=>({driveIds:(await t.find({type:Ba},i)).results.map(e=>e.header.id)})),addDrive:Ra(qa,async e=>{let{driveInput:n}=e,i=(await t.createEmpty(Ba,{})).header.id;n.global.name&&await t.rename(i,n.global.name),n.preferredEditor&&await t.setPreferredEditor(i,n.preferredEditor);let a=[];return n.global.icon&&a.push(Ft({icon:n.global.icon})),n.local?.sharingType&&a.push(It({type:n.local.sharingType})),n.local?.availableOffline!==void 0&&a.push(Pt({availableOffline:n.local.availableOffline})),a.length>0&&await t.execute(i,`main`,a,void 0,r),{driveId:i}}),getDrive:Ra(Ja,async e=>{let n=await t.get(e.driveId,i);return{drive:{header:n.header,state:n.state}}}),deleteDrive:Ra(Ya,async e=>{try{return await t.deleteDocument(e.driveId),{success:!0}}catch{return{success:!1}}}),addRemoteDrive:Ra(Xa,async e=>{if(!n)throw Error(`Remote drive management is not available. SyncManager was not configured for this MCP server.`);let t=await fetch(e.url);if(!t.ok)throw Error(`Failed to resolve drive info from ${e.url}`);let r=await t.json(),i=r.id,a=h.forDrive(i);if(n.list().find(e=>e.meta.collectionId.equals(a)))return{driveId:i};let o=`mcp-remote-${crypto.randomUUID()}`;return await n.add(o,a,{type:`gql`,parameters:{url:r.graphqlEndpoint}}),{driveId:i}}),getDocumentModels:Ra(Qa,async()=>({documentModels:(await t.getDocumentModelModules()).results.map(e=>{let t=e.documentModel.global;return{name:t.name,type:t.id,description:t.description,extension:t.extension,authorName:t.author.name,authorWebsite:t.author.website??``}})})),getDocumentModelSchema:Ra(Za,async e=>{let t=(await a(e.type))?.documentModel.global;if(!t)throw Error(`Document model '${e.type}' not found`);return{schema:t}})};return Promise.resolve({tools:o,resources:{},prompts:{}})}function eo(e){return{meta:{...ue,supportedMethods:R(e.methods)},load:()=>r(()=>import(`./factory-CGO-x_eD.js`).then(t=>t.createMockAdapter(e)),__vite__mapDeps([7,8,9,10,11,12,13,14,15,16,17]))}}function to(e){return{meta:{...fe,supportedMethods:de(e.methods)},load:()=>r(()=>import(`./factory-D6WcIdrN.js`).then(t=>t.createPrivyAdapter(e)),__vite__mapDeps([18,1,19,20,2,21,22,23,24,15,10,12,8,9,11,13,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,17,55]))}}var no={id:`rainbow`,redirectReturnParams:[],supportedMethods:[le.WALLET]};function ro(e){return{meta:no,load:()=>r(()=>import(`./factory-CLXw251O.js`).then(t=>t.createRainbowAdapter(e)),__vite__mapDeps([56,1,2,57,58,21,22,23,15,10,11,9,12,13,59,60,61,62,63,64,65,66,67,68,69,8,70,71,72,26,17,53,73,74]))}}(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`021db84f-f706-5644-9182-2425eb27187c`)}catch{}})();var io=me([`Connect`]);function ao(e){return`fallbackRender`in e}function oo(){return null}function so({message:e=`Something went wrong`}){return z(`div`,{className:`text-center wrap-break-word text-foreground`,children:e})}function co({error:e,resetErrorBoundary:t}){let n=e instanceof Error?e.message:String(e),r=e instanceof Error?e.stack??String(e.cause):JSON.stringify(e,null,2);return z(`div`,{className:`z-10 mx-auto flex max-w-[80%] flex-1 items-center justify-center p-6`,children:B(`div`,{className:`w-full max-w-lg rounded-lg border border-border bg-card p-6 text-foreground shadow-sm`,children:[B(`div`,{className:`mb-3 flex items-center gap-2`,children:[z(j,{name:`Error`,className:`size-5 shrink-0 text-destructive`}),z(`h1`,{className:`text-lg font-semibold text-foreground`,children:`Something went wrong`})]}),z(`p`,{className:`mb-4 text-sm wrap-break-word text-foreground`,children:n}),r!==`{}`&&B(`details`,{className:`group`,children:[z(`summary`,{className:`cursor-pointer text-sm font-medium text-foreground underline select-none hover:hover-effect`,children:`Show details`}),z(`pre`,{className:`mt-2 max-h-48 overflow-auto rounded-sm bg-muted p-3 text-xs text-foreground`,children:r})]}),z(ne,{type:`button`,onClick:t,className:`mt-4 px-3 py-1.5 text-base font-medium`,children:`Try again`})]})})}function lo({error:e}){let t=e instanceof Error?e.message:String(e);return z(`div`,{className:`flex size-full items-center justify-center p-6`,children:z(`h3`,{className:`max-w-lg min-w-0 text-center text-lg font-semibold wrap-break-word text-foreground`,children:t})})}function uo(e,t){switch(e){case`silent`:return oo;case`text`:return()=>z(so,{message:t});case`detailed`:return co;default:return lo}}function fo(e){let{children:t,onError:n,resetKeys:r,loggerContext:i}=e,a=(e,t)=>{if(e.message.includes(`Failed to fetch dynamically imported module`)&&e.message.includes(`node_modules/.vite`)){console.error(e),console.log(`Outdated chunk detected, reloading page...`),window.location.reload();return}(i?me(i):io).error(`@error @info`,e,t),n?.(e,t)},o=ao(e)?e.fallbackRender:uo(e.variant,e.fallbackMessage);return z(Xt,{fallbackRender:o,onError:a,resetKeys:r,children:t})}function po(...e){window.dataLayer?.push(...e)}var mo=()=>{let e=O.gaTrackingId,[{analytics:t}]=L(),n=e&&t;return K(()=>{if(n){let t=document.createElement(`script`);return t.src=`https://www.googletagmanager.com/gtag/js?id=${e}`,t.async=!0,document.head.appendChild(t),window.dataLayer=window.dataLayer||[],po(`js`,new Date),po(`config`,e),()=>{document.head.removeChild(t)}}},[n,e]),null},ho;async function go(e){if(!e.clientId)return;if(ho)return ho;let{OpenPanel:n}=await r(async()=>{let{OpenPanel:e}=await import(`./dist-CafobzAC.js`);return{OpenPanel:e}},__vite__mapDeps([75,2]));return ho=new n({clientId:e.clientId,...e.apiUrl?{apiUrl:e.apiUrl}:{},trackScreenViews:!0,trackOutgoingLinks:!0}),ho.setGlobalProperties({app:`connect`}),t(ho),ho}function _o(){ho=void 0,n()}var vo=[{documentType:`powerhouse/document-drive`,actionTypes:[`ADD_FOLDER`,`DELETE_NODE`,`ADD_FILE`,`UPDATE_FILE`,`COPY_NODE`,`MOVE_NODE`,`SET_DRIVE_NAME`,`SET_DRIVE_ICON`]},{documentType:`powerhouse/document-model`,actionTypes:[`SET_MODEL_NAME`,`SET_MODEL_ID`,`ADD_MODULE`,`DELETE_MODULE`,`ADD_OPERATION`,`DELETE_OPERATION`]},{documentType:`powerhouse/reactor-drive`,actionTypes:[`ADD_FOLDER`,`REMOVE_FOLDER`,`UPDATE_FOLDER`]}],yo=V.object({documentType:V.string().min(1),actionTypes:V.array(V.string().min(1)).min(1),alias:V.string().optional()}).strict(),bo=V.array(yo).readonly();function xo(e=vo){let t=bo.safeParse(e);if(!t.success)throw Error(`Invalid OpenPanel events.json: ${t.error.message}`);let n=t.data,r=new Map;for(let e of n){let t=r.get(e.documentType);t||(t=new Map,r.set(e.documentType,t));for(let n of e.actionTypes){if(t.has(n))throw Error(`Duplicate OpenPanel event mapping for ${e.documentType}/${n}`);t.set(n,e)}}return{mappings:n,lookupMap:r}}var{mappings:So,lookupMap:Co}=xo(),wo=So,To=Co;function Eo(e){return e.toLowerCase().replace(/\//g,`.`).replace(/[^a-z0-9._-]/g,``)}function Do(e,t){return e.alias?e.alias:`${Eo(t.context.documentType)}.${t.operation.action.type.toLowerCase()}`}function Oo(e){return{documentType:e.context.documentType,actionType:e.operation.action.type,documentId:e.context.documentId,scope:e.context.scope,branch:e.context.branch}}var ko=class{client;lookupMap;onError;constructor(e,t,n=e=>console.warn(`[OpenPanelProcessor] Error tracking event:`,e)){this.client=e,this.lookupMap=t,this.onError=n}async onOperations(e){for(let t of e){let e=this.lookupMap.get(t.context.documentType);if(!e)continue;let n=e.get(t.operation.action.type);if(!n)continue;let r=Do(n,t),i=Oo(t);try{await this.client.track(r,i)}catch(e){this.onError(e,t)}}}onDisconnect(){return this.client.flush?.(),Promise.resolve()}};function Ao(e){return function(t){let n=Array.from(e.events.lookupMap.keys());return[{processor:new ko(e.client,e.events.lookupMap,e.onError),filter:{documentType:n},startFrom:e.startFrom??`current`}]}}function jo(e){let{credential:t,...n}=e,r={address:n.address,did:n.did,networkId:n.networkId,chainId:n.chainId,caip2:`${n.networkId}:${n.chainId}`};return n.ens?.name!=null&&(r.ensName=n.ens.name),n.ens?.avatarUrl!=null&&(r.ensAvatar=n.ens.avatarUrl),n.profile?.username!=null&&(r.username=n.profile.username),n.profile?.userImage!=null&&(r.userImage=n.profile.userImage),n.profile?.documentId!=null&&(r.profileDocumentId=n.profile.documentId),n.profile?.createdAt!=null&&(r.profileCreatedAt=n.profile.createdAt),r}function Mo(e){let t=e.profile?.userImage??e.ens?.avatarUrl,n=e.ens?.name??e.profile?.username;return{profileId:e.address,...t==null?{}:{avatar:t},...n==null?{}:{firstName:n},properties:jo(e)}}function No(){let[{analytics:e}]=L(),t=Xe(),n=ze(),r=n?.kind===`browser`?n:void 0,[i,a]=q(),o=lt(void 0),s=e&&!!O.openPanel.clientId,c=r?.reactorModule?.processorManager;return K(()=>{if(!s)return;let e=!1,t=()=>e;return(async()=>{let e;try{e=await go(O.openPanel)}catch(e){console.warn(`[OpenPanel] Failed to build client:`,e);return}if(!t()&&e&&(a(e),window.openPanel=e,O.openPanel.trackOperations&&c))try{await c.registerFactory(`openpanel`,Ao({client:e,events:{mappings:wo,lookupMap:To},startFrom:`current`})),t()&&await c.unregisterFactory(`openpanel`).catch(e=>console.warn(`[OpenPanel] Failed to unregister factory after cancellation:`,e))}catch(e){console.warn(`[OpenPanel] Failed to register processor factory:`,e)}})(),()=>{e=!0,o.current=void 0,O.openPanel.trackOperations&&c&&c.unregisterFactory(`openpanel`).catch(e=>console.warn(`[OpenPanel] Failed to unregister processor factory:`,e)),_o(),window.openPanel=void 0,a(void 0)}},[s,c]),K(()=>{if(!s||!i)return;let e=o.current;if(o.current=t,!e&&t)try{i.identify(Mo(t))}catch(e){console.warn(`[OpenPanel] Failed to identify user:`,e)}else if(e&&!t)try{i.clear()}catch(e){console.warn(`[OpenPanel] Failed to clear user:`,e)}},[i,t,s]),null}function Po(){let[e]=Ve(),t=Ie(e.header.id);return ct(()=>async()=>{},[]),at(()=>{Ce(t)},[t]),z(`div`,{id:`document-editor-container`,className:`flex-1`,"data-document-type":e.header.documentType,children:z(ec,{document:e})})}function Fo(e){let[t,n]=q(!1);if(K(()=>{setTimeout(()=>{n(!0)},e.loadingTimeout??200)},[e]),!t)return null;let{customEditorLoader:r,...i}=e;return r?z(pe,{children:r}):z(mt,{...i})}function Io(){let[e]=We(),t=He(),n=we(e?.header.meta?.preferredEditor),r=Ee();if(!e)return z(Fo,{});let i=n?.Component??r?.Component??te.Component;if(!i)throw Error(`No app component found`);return z(fo,{variant:`detailed`,resetKeys:[e.header.id],loggerContext:[`Connect`,`App`],children:z(nt,{fallback:z(Fo,{}),children:z(gt,{className:`flex h-full flex-col overflow-auto`,children:z(i,{children:t?z(Po,{}):null})})})})}var Lo=[];function Ro(){let e=Re();return ut(t=>e?.subscribeFailed(t)??(()=>{}),()=>e?.getFailedInstallations()??Lo)}var zo=me([`sentry`]),Bo=!1;async function Vo(){return await r(()=>import(`./esm-Bnzz5TQ0.js`),__vite__mapDeps([76,1]))}async function Ho(){let e=await Vo(),t=[e.httpClientIntegration(),e.extraErrorDataIntegration({depth:5}),e.replayIntegration(),e.captureConsoleIntegration({levels:[`error`]})];O.sentry.tracing&&t.push(e.reactRouterV6BrowserTracingIntegration({useEffect:$e.useEffect,useLocation:ci,useNavigationType:li,createRoutesFromChildren:ji,matchRoutes:dn})),e.init({release:O.sentry.release,dsn:O.sentry.dsn??void 0,environment:O.sentry.env,integrations:t,ignoreErrors:[`User is not allowed to create files`,`User is not allowed to move documents`,`The user aborted a request.`],sendDefaultPii:!0,tracesSampleRate:1,replaysSessionSampleRate:.1,replaysOnErrorSampleRate:1,beforeSend(e,t){let n=t.originalException;return n instanceof TypeError&&n.message.includes(`Failed to fetch`)&&!navigator.onLine?null:e}}),ce(e),Bo=!0}async function Uo(){if(!Bo)return;let e=await Vo();return ce(void 0),e.getClient()?.close()}function Wo(){let[e]=L(),{analytics:t}=e;K(()=>{if(!t){Uo().catch(e=>zo.error(`@error`,e));return}Bo||O.sentry.dsn===null||O.sentry.dsn===void 0||O.sentry.dsn===``||Ho().catch(e=>zo.error(`@error`,e))},[t])}var Go=[];function Ko(){let e=Re(),t=lt(Go),n=at(()=>{if(!e)return Go;let n=e.getPendingInstallations()??Go,r=t.current;return n===r||n.length===r.length&&n.every((e,t)=>e===r[t])?r:(t.current=n,n)},[e]);return ut(t=>e?.subscribePending(t)??(()=>{}),n)}var qo=e=>{let{undo:t,redo:n,canRedo:r,canUndo:i}=e,a=window.navigator.userAgent.includes(`Mac`),o=`ctrl+z`,s=`ctrl+y`;a&&(o=`mod+z`,s=`mod+shift+z`),Ca(o,e=>{e.preventDefault(),i&&t()},{},[i,t]),Ca(s,e=>{e.preventDefault(),r&&n()},{},[r,n])},Jo=({children:e})=>(Wo(),e),Yo=[],Xo=new Set;function Zo(){for(let e of Xo)e()}function Qo(){return Yo}function $o(e){return`${e.name}|${e.size}|${e.lastModified}`}function es(e){let t=new Set(Yo.map($o)),n=e.filter(e=>{let n=$o(e);return!t.has(n)&&(t.add(n),!0)});n.length!==0&&(Yo=[...Yo,...n],Zo())}function ts(){Yo.length!==0&&(Yo=[],Zo())}function ns(e){return Xo.add(e),()=>{Xo.delete(e)}}async function rs(e){let t=e.files.filter(e=>e.kind===`file`);if(t.length===0)return;let n=[];for(let e of t)try{n.push(await e.getFile())}catch(t){console.error(`Failed to read launched file:`,e.name,t)}n.length!==0&&(es(n),U({type:`openFileDocuments`}))}function is(){Qo().length!==0&&window.ph?.modal===void 0&&U({type:`openFileDocuments`})}var as=!1;function os(){as||(as=!0,window.addEventListener(`ph:modalUpdated`,is),window.launchQueue?.setConsumer(e=>{rs(e)}))}var ss=[],cs=new Set;function ls(){for(let e of cs)e()}function us(){return ss}function ds(e){return cs.add(e),()=>{cs.delete(e)}}function fs(e){let t=ss.filter(t=>t.id!==e);t.length!==ss.length&&(ss=t,ls())}function ps(){ss.length!==0&&(ss=[],ls())}function ms(e){ss=[...ss,...e],ls()}function hs(e,t){ss=ss.map(n=>n.id===e?{...n,...t}:n),ls()}var gs=0,_s=Promise.resolve();function vs(e,t,n){return new Promise(r=>{let i=!1,a=e=>{i||(i=!0,r(e))};_e(e.file,t,e.name,void 0,t=>{switch(hs(e.id,{status:Ot(t.stage),progress:t.progress,...t.error?{errorDetails:t.error}:{},...t.documentType?{documentType:t.documentType}:{},...t.fileNode?{fileNode:t.fileNode}:{}}),t.stage){case`complete`:a(t.fileNode);break;case`failed`:case`unsupported-document-type`:a(void 0)}},n,`duplicate`).catch(()=>{a(void 0)})})}function ys(e){let{driveId:t,imports:n,documentTypes:r}=e;if(n.length===0)return _s;let i=n.map(({file:e,name:t})=>({id:`open-file-${++gs}`,file:e,name:t}));ms(i.map(e=>({id:e.id,fileName:e.name,fileSize:Dt(e.file.size),status:`pending`,progress:0})));let a=async()=>{let e=[];for(let n of i)e.push(await vs(n,t,r));i.length===1&&e[0]&&Ce(e[0])};return _s=_s.then(a,a),_s}var bs=e=>window.open(e,`_blank`),xs=`ph-pglite-backup::`,Ss=`ph:pglite-backups`,Cs=2592e6;function ws(e,t=15e3){return new Promise((n,r)=>{let i=indexedDB.deleteDatabase(e),a=!1,o=e=>{a||(a=!0,e())},s=setTimeout(()=>o(()=>r(Error(`IDB delete timed out for ${e} after ${t}ms`))),t);i.onsuccess=()=>o(()=>{clearTimeout(s),n()}),i.onerror=()=>o(()=>{clearTimeout(s),r(w(i,`IDB delete failed for ${e}`))})})}function Ts(){try{let e=localStorage.getItem(Ss);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function Es(e){try{localStorage.setItem(Ss,JSON.stringify(e))}catch{}}function Ds(e){Es([...Ts(),e])}function Os(e){Es(Ts().filter(t=>t.name!==e))}async function ks(){let e=Date.now()-Cs,t=[];for(let n of Ts()){if(n.createdAt>=e){t.push(n);continue}try{await ws(n.name)}catch(e){console.warn(`Failed to delete expired pglite backup ${n.name}`,e),t.push(n)}}Es(t)}function As(){return{snapshot:async e=>{let t=`${xs}${e}::${new Date().toISOString()}`;return await Wt(e,t),Ds({name:t,idbName:e,createdAt:Date.now()}),t},rollback:async(e,t,n)=>{let r=e;try{await Wt(r,t)}catch(e){console.error(`PGlite migration rollback failed for ${t}; backup ${r} retained. Primary migration error:`,n,`Rollback error:`,e);return}await ws(r).catch(()=>void 0),Os(r)},discard:async e=>{let t=e;await ws(t).catch(()=>void 0),Os(t)},commit:()=>Promise.resolve()}}async function js(){let e=As();try{for(let t of S)await qt(t,e=>F({idbName:t,phase:e}),e)}finally{F(null)}}async function Ms(){if(ks().catch(e=>console.warn(`PGlite backup janitor failed`,e)),!(typeof navigator<`u`&&`locks`in navigator&&typeof navigator.locks.request==`function`)){await js();return}await navigator.locks.request(`ph-pglite-migration`,{mode:`exclusive`},async()=>{await js()})}function Ns(){let e=window.ph,t=e?.reactorClient;if(!t)return Promise.reject(Error(`The reactor client is not available yet. Try again shortly.`));let n=e?.reactorClientModule?.reactorModule?.syncModule?.syncManager;return $a({client:t,syncManager:n}).then(t=>{let n=Object.values(t.tools).map(e=>({...e,inputSchema:e.inputSchema??{}})),r=new Set(n.map(e=>e.name)),i=(e?.vetraPackageManager?.packages??[]).flatMap(e=>(e.aiTools??[]).filter(e=>r.has(e.name)?(console.warn(`[Connect][AI] Package tool "${e.name}" shadows an existing tool and was ignored.`),!1):(r.add(e.name),!0)));return[...n,zt(),...i]})}function Ps(){return z(Rt,{getTools:Ns})}var Fs={"no-registry":`No package registry is configured.`,"not-in-registry":`No matching package found in the registry.`,"registry-error":`Couldn't reach the package registry.`,"install-failed":`Package failed to install.`,dismissed:`Installation was dismissed.`,offline:`You're offline — this package can't be loaded until you reconnect.`};function Is(e){return e!==`no-registry`}function Ls(){let e=Ro(),t=Re(),[n,r]=q(!1),[i,a]=q(!1);return K(()=>t?.subscribeEvents(e=>{e.type===`load-failed`&&a(!1)}),[t]),e.length===0?null:B(pe,{children:[i?null:z(`div`,{className:`absolute inset-x-0 top-0 z-200 bg-background`,children:B(`div`,{className:`flex items-center justify-between gap-3 bg-warning/10 px-4 py-2 text-sm text-warning`,children:[z(`span`,{children:e.length===1?`1 document type couldn't load (missing model).`:`${e.length} document types couldn't load (missing models).`}),B(`div`,{className:`flex items-center gap-2`,children:[z(`button`,{type:`button`,onClick:()=>r(!0),className:`rounded-md border border-warning bg-background px-3 py-1 text-warning hover:hover-effect`,children:`View`}),z(`button`,{type:`button`,onClick:()=>a(!0),"aria-label":`Dismiss`,className:`flex items-center text-warning hover:hover-effect`,children:z(j,{name:`XmarkLight`,size:16})})]})]})}),z(Rs,{open:n,failed:e,onClose:()=>r(!1)})]})}function Rs(e){let{open:t,failed:n,onClose:r}=e,i=Re(),[a,o]=q(()=>new Set);async function s(e){if(i){o(t=>new Set(t).add(e));try{await i.retryInstallation(e)}finally{o(t=>{let n=new Set(t);return n.delete(e),n})}}}return z(re,{open:t,onOpenChange:e=>{e||r()},contentProps:{className:`rounded-3xl`},children:B(`div`,{className:`w-[520px] max-w-[90vw] bg-background p-6`,children:[z(`div`,{className:`border-b border-border pb-2 text-2xl font-bold text-foreground`,children:`Missing document models`}),z(`div`,{className:`my-4 text-sm text-foreground`,children:`The following document types couldn't be loaded. Documents using them won't display until the underlying package is installed.`}),n.length===0?z(`div`,{className:`rounded-xl bg-background p-4 text-sm text-foreground`,children:`No outstanding failures.`}):z(`div`,{className:`flex max-h-[60vh] flex-col gap-3 overflow-y-auto`,children:n.map(e=>{let t=a.has(e.documentType),n=!Is(e.reason)||t;return B(`div`,{className:`rounded-xl bg-background p-4`,children:[z(`div`,{className:`mb-1 font-mono text-sm font-semibold text-foreground`,children:e.documentType}),z(`div`,{className:`mb-2 text-xs text-foreground`,children:Fs[e.reason]}),e.packageNames.length>0?B(`div`,{className:`mb-2 text-xs text-muted-foreground`,children:[`Package`,e.packageNames.length>1?`s`:``,`:`,` `,e.packageNames.join(`, `)]}):null,e.error?z(`div`,{className:`mb-2 font-mono text-xs wrap-break-word text-destructive`,children:e.error.message}):null,z(`div`,{className:`flex justify-end`,children:z(`button`,{type:`button`,onClick:()=>void s(e.documentType),disabled:n,title:Is(e.reason)?void 0:`No registry is configured; nothing to retry against.`,className:M(`min-h-[32px] rounded-xl px-3 py-1 text-sm font-semibold text-foreground transition-all hover:hover-effect`,n?`cursor-not-allowed bg-secondary hover:hover-effect`:`bg-primary text-primary-foreground active:active-effect`),children:t?`Retrying...`:`Try install again`})})]},e.documentType)})}),z(`div`,{className:`mt-4 flex justify-end`,children:z(`button`,{type:`button`,onClick:r,className:`min-h-[36px] rounded-xl border border-border bg-background px-4 py-2 text-sm font-semibold text-foreground hover:hover-effect`,children:`Close`})})]})})}function zs(){let e=ut(ds,us);return z(Et,{uploadsArray:e,uploadsCount:e.length,removeUpload:fs,clearAllUploads:ps,setSelectedNode:Ce})}function Bs(){let e=Ko(),t=Re();if(!t||e.length===0)return null;let n=e.flatMap(e=>e.packageNames.map(t=>({documentType:e.documentType,packageName:t})));return z(St,{pendingInstallations:n,onInstall:e=>t.approveInstallation(e),onDismiss:e=>t.dismissInstallation(e)})}function Vs(e,t){try{return[t()]}catch(t){return console.error(`[connect] Ignoring the "${e}" wallet adapter: connect.renown.adapters.${e} was rejected.`,t),[]}}var Hs=new Map([i,l,s,c,a,o].map(e=>[e.id,e]));function Us(e){if(e===void 0)return;let t=Hs.get(e);if(!t){console.error(`[connect] connect.renown.chainId ${e} is not a chain Connect can offer, so in-page sign-in will be rejected. Supported: ${[...Hs.keys()].join(`, `)}.`);return}return[t]}function Ws(e,t){if(!e)return[];let{rainbow:n,privy:r,mock:i}=e,a=[],o=Us(t);if(n&&a.push(...Vs(`rainbow`,()=>ro({...n,...o?{chains:o}:{}}))),r){let{appId:e,clientId:t,methods:n}=r;e&&a.push(...Vs(`privy`,()=>to({appId:e,clientId:t,methods:n,chain:o?.[0]})))}return i&&a.push(...Vs(`mock`,()=>eo({...i,methods:i.methods}))),a}function Gs(e,t){if(typeof document>`u`)return t;let n=document.createElement(`span`);n.style.color=t,n.style.color=e,n.style.display=`none`,document.body.appendChild(n);let r=getComputedStyle(n).color;return n.remove(),r||t}function Ks({children:t}){let n=e().connect.renown?.adapters,r=e().connect.renown?.chainId,{theme:i}=Ye(),a=ct(()=>Ws(n,r),[n,r]),o=ct(()=>a.length>0?{mode:i,accentColor:Gs(`var(--primary)`,`#0084ff`),accentColorForeground:Gs(`var(--primary-foreground)`,`#ffffff`)}:void 0,[i,a]);return a.length===0?z(pe,{children:t}):z(ge,{adapters:a,theme:o,children:t})}var qs=()=>(Ye(),Ne(),K(()=>{let e=e=>{let t=e.payload,n=(t instanceof Error?t.message:typeof t==`string`?t:``).match(/https?:\/\/[^\s"']+/)?.[0];if(n&&!n.startsWith(window.location.origin)){console.debug(`[Connect] Skipping reload — vite:preloadError for off-origin URL: ${n}`);return}console.log(`Outdated chunks detected, reloading page...`),window.location.reload()};return window.addEventListener(`vite:preloadError`,e),()=>{window.removeEventListener(`vite:preloadError`,e)}},[]),K(()=>{O.offline?N.registerServiceWorker(!1):N.unregisterAll()},[]),K(()=>{os()},[]),z(Jo,{children:B(Ks,{children:[z(p,{position:`bottom-right`}),O.aiAssistantEnabled&&z(Ps,{}),z(Ls,{}),z(Sc,{}),z(zs,{}),z(Bs,{}),z(mo,{}),z(No,{})]})})),Js=()=>{let[e,t]=q(0);return K(()=>{let e=setInterval(()=>{t(e=>e===3?0:e+1)},200);return()=>{clearInterval(e)}},[]),z(`span`,{children:Array(e).fill(`.`).join(``)})};function Ys({drive:e}){let t=Je(),n=ct(()=>e?t.some(t=>t.meta.collectionId.equals(he.forDrive(e.header.id))):!1,[t,e]),r=e?.state.global.icon;return r?z(`img`,{src:r,alt:e.header.name,height:32,width:32}):n?z(j,{name:`Server`,size:32}):z(j,{name:`Hdd`,size:32})}var Xs=({documentId:e})=>{let{t}=A();return B(`div`,{children:[z(`p`,{className:`font-medium`,children:t(`notifications.documentUpgradeAvailable`)}),z(`button`,{onClick:()=>{U({type:`confirmDocumentUpgrade`,documentId:e})},className:`underline decoration-solid underline-offset-2`,children:t(`common.updateDocument`)})]})};function Zs({title:e,children:t}){return z(`div`,{className:`flex size-full items-center justify-center p-6`,children:B(`div`,{className:`w-full max-w-lg rounded-lg border border-border bg-card p-6 text-foreground shadow-sm`,children:[B(`div`,{className:`mb-3 flex items-center gap-2`,children:[z(j,{name:`Error`,className:`size-5 shrink-0 text-destructive`}),z(`h3`,{className:`min-w-0 text-lg font-semibold wrap-break-word text-foreground`,children:e})]}),z(`div`,{className:`wrap-break-word`,children:t})]})})}function Qs(e){return e.includes(`global`)?`global`:e[0]}function $s(){return z(ne,{className:`px-3 py-1.5 text-base font-medium`,onClick:()=>{U({type:`settings`})},type:`button`,children:`Open package manager`})}var ec=e=>{let{document:t}=e,n=Ke(),r=Be(),[i,a]=De(t.header.id),o=i?.header.id??void 0,s=i?.header.name??void 0,c=i?.header.documentType??void 0,l=i?.header.meta?.preferredEditor??void 0,u=ct(()=>{let e=Object.keys(i?.header.revision??{});return e.length>0?e:[`global`]},[i?.header.revision]),[p,m]=q(()=>Qs(u)),h=u.includes(p)?p:Qs(u),{operations:g,isLoading:_,hasNextPage:v,fetchNextPage:y,error:b}=ke(o,h,{enabled:r,limit:500}),{operations:x,hasNextPage:S,isLoading:C,fetchNextPage:w,error:T}=ke(o,`global`,{enabled:!!n,limit:500});K(()=>{if(!S||C||T)return;let e=window.setTimeout(w,0);return()=>window.clearTimeout(e)},[S,C,w,T]);let E=i?.header.revision.global??0,D=i?.header.revision.local??0,ee=Oe(c),O=Me(l),te=Pe(c),k=O??te,A=Ae(i??void 0),j=A?.kind,M=A?.kind===`upgrade-available`&&A.canUpgrade;K(()=>{M&&o?f(it(Xs,{documentId:o}),{type:`connect-warning`,toastId:`outdated-document-${o}`,autoClose:!1}):j&&j!==`upgrade-available`&&o&&d(`outdated-document-${o}`)},[M,j,o]);let ne=Qe(),re=Ze(),N=k?ne.find(e=>e.editors.includes(k))?.manifest.name:void 0,ie=N&&re?re.getPackageVersion(N):void 0,ae=N?`${N}@${ie??`unknown`}`:k?.config.id??`no-editor`,oe=!i,P=k&&c&&!k.documentTypes.includes(c)&&!k.documentTypes.includes(`*`);qo({undo:()=>a(Mt()),redo:()=>a(jt()),canUndo:E>0||D>0,canRedo:!!i?.clipboard.length}),K(()=>()=>{window.documentEditorDebugTools?.clear()},[]);let[F,I]=q(void 0);K(()=>{F&&F.documentId!==o&&I(void 0)},[F,o]);let L=(e,t)=>{I({error:e,documentId:o,info:t})};if(P)return z(Fo,{message:`Loading editor`});if(oe)return z(Fo,{message:`Loading document`});if(!ee)return B(Zs,{title:`Document type not supported`,children:[B(`p`,{className:`mb-4 text-sm text-foreground`,children:[`This document can't be opened because the "`,c,`" document model isn't installed. Install the package that provides it to open the document.`]}),z($s,{})]});if(A?.kind===`unsupported`)return B(Zs,{title:`Document version not supported`,children:[B(`p`,{className:`mb-4 text-sm text-foreground`,children:[`This document requires version `,A.documentVersion,` of the "`,c,`" document model, but only version`,A.availableVersions.length>1?`s`:``,` `,A.availableVersions.join(`, `),` `,A.availableVersions.length>1?`are`:`is`,` installed. Update the package that provides "`,c,`" to open it.`]}),z($s,{})]});if(!k)return B(Zs,{title:`No editor available`,children:[B(`p`,{className:`mb-4 text-sm text-foreground`,children:[`The "`,c,`" document model is installed, but no editor for it was found. Install a package that provides an editor for this document type.`]}),z($s,{})]});let se=k.Component;return z(`div`,{className:`relative h-full`,id:`document-editor-context`,"data-editor":k.config.id,"data-document-type":c,children:r?z(Ct,{documentTitle:s??``,documentId:o??``,operations:g,isLoading:_,hasNextPage:v,onLoadNextPage:y,error:b,scopes:u,scope:h,onScopeChange:m,onClose:()=>Se(!1),documentState:i.state,onCopyState:()=>{f(`Copied document state to clipboard`,{type:`success`})},onCopyDocId:()=>{f(`Copied document ID to clipboard`,{type:`success`})}},o):z(nt,{fallback:z(Fo,{message:`Loading editor`}),name:`EditorLoader`,children:z(fo,{fallbackRender:lo,resetKeys:[o],onError:L,loggerContext:[`Connect`,`DocumentEditor`],children:!F?.error&&z(se,{context:{readMode:!!n,selectedTimelineRevision:(C||S)&&!T?void 0:ve(n?.startDate,n?.endDate,x)},documentId:i.header.id},`${ae}:${o}`)})})})},tc=()=>B(_t,{children:[z(vt,{onClick:()=>se(!0),children:z(k,{i18nKey:`footer.cookiePolicy`})}),z(vt,{onClick:()=>U({type:`disclaimer`}),children:z(k,{i18nKey:`footer.disclaimer`})}),z(vt,{id:`ph-logo-link`,onClick:()=>bs(`https://www.powerhouse.inc/`),children:z(k,{i18nKey:`footer.builtWith`,components:{icon:z(j,{name:`PowerhouseLogoSmall`,size:16,className:`mx-1`})}})})]});function nc(){let e=P();return z(`div`,{className:`h-screen bg-background`,children:z(`div`,{className:`flex h-screen items-stretch overflow-auto`,role:`presentation`,tabIndex:0,children:B(nt,{name:`Root`,children:[!e&&z(Tc,{}),z(`div`,{className:`relative flex-1 overflow-auto`,children:z(Di,{})})]})})})}function rc(e,t,n){let{selectedDriveId:r,remotes:i}=n;if(!r)return null;let a=!1;for(let e of i){if(e.driveId!==r)continue;let n=t.get(e.name);if(n?.state===`error`&&n.requiresAuth){a=!0;break}}return a?e?`unauthorized`:`login`:null}var ic=new Set,ac=[],oc=new Set;function sc(){ac=[...ic];for(let e of[...oc])e()}function cc(e){return oc.add(e),()=>{oc.delete(e)}}function lc(){return ac}function uc(e){ic.has(e)||(ic.add(e),sc())}function dc(){ic.size!==0&&(ic.clear(),sc())}function fc(){return ut(cc,lc,lc)}function pc(){let e=je(),t=fc();return ct(()=>!e||t.length===0?e:e.filter(e=>!t.includes(e.header.id)),[e,t])}function mc(){let e=Xe(),t=Te(),n=qe(),r=Ue(),i=ct(()=>(n?.list()??[]).map(e=>({name:e.meta.name,driveId:e.meta.collectionId.driveId})),[n,t]),a=e?.address;K(()=>{dc()},[a]);let o=at(()=>{r&&uc(r),H(void 0)},[r]);return{gate:rc(!!e,t,{selectedDriveId:r,remotes:i}),dismiss:o}}function hc(){let{gate:e,dismiss:t}=mc(),n=oe(),[r]=We(),i=Ge(),a=He();return K(()=>{a||xe(D)},[a]),K(()=>{r||be(ee)},[r]),z(gc,{children:e?z(`div`,{className:`flex h-full items-center justify-center p-4`,children:z(ht,{mode:e,onLogin:n,onLogout:()=>void ye(),onClose:t})}):z(!a&&!r&&!i?vc:Io,{})})}function gc({children:e}){return z(`div`,{className:`flex h-full flex-col overflow-auto`,id:`content-view`,children:e})}function _c({drive:e}){let t=we(e.header.meta?.preferredEditor)?.config.name||`Drive Explorer App`;return z(xt,{title:e.state.global.name||e.header.name,description:t,icon:z(Ys,{drive:e}),onClick:()=>H(e)},e.header.id)}function vc(){let t=pc(),n=Fe(),r=e().connect?.branding?.homeBackground;return B(yt,{homeBackground:r,children:[t?.map(e=>z(_c,{drive:e},e.header.id)),n&&z(bt,{})]})}function yc(e){let t=O.routerBasename;return Fi(e,{basename:t,future:{v7_fetcherPersist:!0,v7_relativeSplatPath:!0}})}function bc(){return[{element:z(nt,{name:`RouteRoot`,children:z(nc,{})}),children:[{index:!0,path:`d?/:driveId?/*?`,element:z(nt,{name:`Drive`,children:z(hc,{})})}]}]}var xc=yc(bc()),Sc=()=>z(Gi,{router:xc}),Cc=[{id:`project`,label:`.project`,icon:z(j,{name:`Project`,color:`#FF6A55`,size:16})},{id:`budget`,label:`.budget`,icon:z(j,{name:`BarChart`,color:`#8E55EA`,size:16})},{id:`profile`,label:`.profile`,icon:z(j,{name:`Person`,color:`#3E90F0`,size:16})},{id:`legal`,label:`.legal`,icon:z(j,{name:`Briefcase`,color:`#4BAB71`,size:16})},{id:`atlas`,label:`.Atlas`,icon:z(j,{name:`Globe`,color:`#FF8A00`,size:16})}],wc=()=>{let{t:e}=A();return z(dt,{className:`m-4 shrink-0 bg-muted`,placeholder:e(`searchbar.placeholder`),filterLabel:e(`searchbar.filterLabel`),filterItems:Cc})};function Tc(){let e=Xe(),t=oe(),n=pc(),r=Fe(),[i]=We(),a=localStorage.getItem(`CONNECT_DEBUG`)===`true`,o=e?.ens?.name||e?.profile?.username||void 0,s=e?.ens?.avatarUrl||e?.profile?.userImage||void 0,c=kt(s?void 0:e?.address),l=()=>{U({type:`settings`})},u=()=>{U({type:`addDrive`})},d=e?.address?`https://etherscan.io/address/${e.address}`:``;return z(pt,{children:z(ft,{id:`sidebar`,onClick:()=>H(void 0),onClickSettings:l,address:e?.address,onLogin:t,onDisconnect:()=>{ye()},ensName:o||c.data?.ens,avatarUrl:s||c.data?.avatar_small||c.data?.avatar_url||void 0,etherscanUrl:d,showDebug:a,onDebugClick:()=>U({type:`debugSettings`}),children:B(fo,{variant:`text`,fallbackMessage:`There was an error loading drives`,loggerContext:[`Connect`,`Sidebar`],children:[n?.map(e=>z(Tt,{title:e.header.name,onClick:()=>H(e),active:i?.header.id===e.header.id,icon:z(Ys,{drive:e})},e.header.id)),r&&z(wt,{onClick:u})]})})})}var Ec=`connected`,Dc=()=>ut(b,C,()=>Ec)===`lost`?z(`div`,{className:`absolute inset-x-0 top-0 z-30 flex justify-center p-3`,children:B(`div`,{className:`flex max-w-3xl items-center gap-3 rounded-lg border border-destructive bg-warning px-4 py-3 text-sm text-warning-foreground shadow-lg`,children:[B(`div`,{className:`flex-1`,children:[z(`div`,{className:`font-semibold`,children:`Lost connection to the reactor`}),z(`div`,{className:`text-foreground`,children:`The background worker stopped responding. Reload to reconnect.`})]}),z(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`rounded-sm bg-primary px-3 py-1 text-sm font-medium text-primary-foreground hover:hover-effect`,children:`Reload`})]})}):null;function Oc({title:e,body:t,error:n,children:r}){return z(`div`,{className:`absolute inset-x-0 top-0 z-30 flex justify-center p-3`,children:B(`div`,{className:`flex max-w-3xl items-center gap-3 rounded-lg border border-warning bg-warning px-4 py-3 text-sm text-warning-foreground shadow-lg`,children:[B(`div`,{className:`flex-1`,children:[z(`div`,{className:`font-semibold`,children:e}),z(`div`,{className:`text-foreground`,children:t}),n&&B(`div`,{className:`mt-2 font-medium text-destructive`,children:[`Migration failed: `,n]})]}),r]})})}var kc=`rounded-sm bg-primary px-3 py-1 text-sm font-medium text-primary-foreground hover:hover-effect disabled:disabled-effect`,Ac=`rounded-sm border border-foreground bg-transparent px-3 py-1 text-sm font-medium text-foreground hover:hover-effect disabled:disabled-effect`,jc=!1,Mc=new Set;function Nc({adminClient:e}){let t=ut(t=>e.subscribeMigration(t),()=>e.getMigrationState()),[n,r]=q(!1),[i,a]=q(null);if(t.status===`idle`||t.status===`needed`&&n)return null;let o=t.status===`migrating`;return B(Oc,{title:o?`Migrating to Postgres 17…`:`Your local database uses Postgres ${t.legacyMajor??`?`}.`,body:o?`Working (${t.phase??`starting`}). Your data is backed up first.`:`Migrate to Postgres 17 to pick up the latest features. Your data will be backed up first.`,error:i??(t.status===`failed`?t.error:null),children:[!o&&z(`button`,{type:`button`,onClick:()=>{a(null),e.migrate().catch(e=>{a(e instanceof Error?e.message:String(e))})},className:kc,children:t.status===`failed`?`Retry`:`Migrate now`}),t.status===`needed`&&z(`button`,{type:`button`,onClick:()=>r(!0),className:Ac,children:`Dismiss`})]})}function Pc(){let e=ut(e=>(Mc.add(e),()=>Mc.delete(e)),()=>jc,()=>!1),t=ut(x,v,()=>void 0),[n,r]=q(!1),[i,a]=q(null);return t==null||t===17||e?null:B(Oc,{title:`Your local database uses Postgres ${t}.`,body:`Migrate to Postgres 17 to pick up the latest features. Your data will be backed up first.`,error:i,children:[z(`button`,{type:`button`,disabled:n,onClick:()=>{a(null),r(!0),Ms().then(()=>window.location.reload()).catch(e=>{a(e instanceof Error?e.message:String(e)),r(!1)})},className:kc,children:n?`Migrating…`:`Migrate now`}),z(`button`,{type:`button`,disabled:n,onClick:()=>{jc=!0;for(let e of Mc)e()},className:Ac,children:`Dismiss`})]})}var Fc=()=>{let e=ze();return e?.kind===`worker`?z(Nc,{adminClient:e.adminClient}):z(Pc,{})},Ic=G(()=>r(()=>import(`./AddDriveModal-DhNfP94R-Db7-t28c.js`).then(e=>({default:e.AddDriveModal})),__vite__mapDeps([77,78,79]))),Lc=G(()=>r(()=>import(`./ClearStorageModal-DyU-FIgY-C2SQvwxh.js`).then(e=>({default:e.ClearStorageModal})),__vite__mapDeps([80,81,1,82,2,10,15,9,8,83,13,78,35,36,44,14,84,85,86,87,88,89,90,91,92,93,94,95,26]))),Rc=G(()=>r(()=>import(`./CookiesPolicyModal-BLw4pnhn-BMEgw_d9.js`).then(e=>({default:e.CookiesPolicyModal})),__vite__mapDeps([96,97,1,79,93,94,95,26]))),zc=G(()=>r(()=>import(`./CreateDocumentModal-Bmv0V-kY-XjnemXEP.js`).then(e=>({default:e.CreateDocumentModal})),[])),Bc=G(()=>r(()=>import(`./DebugSettingsModal-CwUN9gIr-C27CiPQG.js`).then(e=>({default:e.DebugSettingsModal})),__vite__mapDeps([98,85,82,91,99,100,72,1,101,102,87]))),Vc=G(()=>r(()=>import(`./DeleteDriveModal-CjGnG0ht-0JiKrM6c.js`).then(e=>({default:e.DeleteDriveModal})),__vite__mapDeps([103,78,93,94,95,1,26]))),Hc=G(()=>r(()=>import(`./DeleteItemModal-BbY_4_xT-Da6nL2oq.js`).then(e=>({default:e.DeleteItemModal})),__vite__mapDeps([104,78,93,94,95,1,26]))),Uc=G(()=>r(()=>import(`./DisclaimerModal-DuglmEwL-C0NQbt3Z.js`).then(e=>({default:e.DisclaimerModal})),__vite__mapDeps([105,93,94,95,1,26]))),Wc=G(()=>r(()=>import(`./DriveSettingsModal-d1L0eYof-Cr8EtOJO.js`).then(e=>({default:e.DriveSettingsModal})),[])),Gc=G(()=>r(()=>import(`./DownloadDocumentWithErrorsModal-BsPQ5qgy-BiMMFbrN.js`).then(e=>({default:e.DownloadDocumentWithErrorsModal})),__vite__mapDeps([106,93,94,95,1,26]))),Kc=G(()=>r(()=>import(`./DocumentVersionUnsupportedModal-C4fy7fZ6-BeagMztn.js`).then(e=>({default:e.DocumentVersionUnsupportedModal})),[])),qc=G(()=>r(()=>import(`./ConfirmDocumentUpgradeModal-DcOZy20m-DPTWgs7L.js`).then(e=>({default:e.ConfirmDocumentUpgradeModal})),__vite__mapDeps([107,78,100,72,1,101]))),Jc=G(()=>r(()=>import(`./SettingsModal-CgjW-M2a-BbUA87ne.js`).then(e=>({default:e.SettingsModal})),__vite__mapDeps([108,78,79,85,82,91,99,109,86,1,2,87,88,89,90]))),Yc=G(()=>r(()=>import(`./UpgradeDriveModal-CXX6D5Au-C-qcQIPL.js`).then(e=>({default:e.UpgradeDriveModal})),__vite__mapDeps([110,93,94,95,1,26]))),Xc={addDrive:Ic,clearStorage:Lc,cookiesPolicy:Rc,createDocument:zc,debugSettings:Bc,deleteDrive:Vc,deleteItem:Hc,disclaimer:Uc,driveSettings:Wc,downloadDocumentWithErrors:Gc,documentVersionUnsupported:Kc,confirmDocumentUpgrade:qc,inspector:G(()=>r(()=>import(`./InspectorModal-Cd8kbCV8-D9TUaRon.js`).then(e=>({default:e.InspectorModal})),__vite__mapDeps([111,81,1,82,2,10,15,9,8,83,13,78,35,36,44,14,84,85,86,87,88,89,90,91,92,112]))),settings:Jc,upgradeDrive:Yc,missingPackage:G(()=>r(()=>import(`./MissingPackageModal-HFUPQMML-C6p8bl1U.js`).then(e=>({default:e.ConnectMissingPackageModal})),__vite__mapDeps([113,109,82,86,1,2,87,88,89,90]))),driveAuthRequired:G(()=>r(()=>import(`./DriveAuthRequiredModal-CtsB0kwH-Coud7u2c.js`).then(e=>({default:e.DriveAuthRequiredModal})),__vite__mapDeps([114,115]))),openFileDocuments:G(()=>r(()=>import(`./OpenFileDocumentsModal-BQsaBP4x-HmKTWcS8.js`).then(e=>({default:e.OpenFileDocumentsModal})),__vite__mapDeps([116,93,94,95,1,26,100,72,101]))),login:G(()=>r(()=>import(`./LoginModal-CI0ogC2--mRJsXUXd.js`).then(e=>({default:e.LoginModal})),__vite__mapDeps([117,99,100,72,1,101,115])))},Zc=G(()=>Promise.resolve({default:()=>{let e=Le();if(!e?.type)return null;let t=Xc[e.type];return t?z(fo,{variant:`silent`,loggerContext:[`Connect`,`Modals`],children:z(nt,{fallback:null,children:z(t,{})})}):null}})),Qc=()=>ut(ie,ae,()=>!1)?z(`div`,{className:`absolute inset-x-0 bottom-0 z-30 flex justify-center p-3`,children:B(`div`,{className:`flex max-w-3xl items-center gap-3 rounded-lg border border-foreground bg-primary px-4 py-3 text-sm text-primary-foreground shadow-lg`,children:[z(`div`,{className:`flex-1 font-medium`,children:`A new version of Connect is available.`}),z(`button`,{type:`button`,onClick:()=>N.applyUpdate(),className:`rounded-sm bg-primary-foreground px-3 py-1 text-sm font-medium text-primary hover:hover-effect`,children:`Refresh`})]})}):null;function $c({error:e}){return z(`div`,{className:`z-10 mx-auto flex max-w-[80%] flex-1 items-center justify-center p-6`,children:B(`div`,{role:`alert`,className:`w-full max-w-lg rounded-lg border border-border bg-card p-6 text-foreground shadow-sm`,children:[B(`div`,{className:`mb-3 flex items-center gap-2`,children:[z(j,{name:`Error`,className:`size-5 shrink-0 text-destructive`}),z(`h1`,{className:`text-lg font-semibold text-foreground`,children:`Connect cannot open this browser's documents`})]}),z(`p`,{className:`mb-4 text-sm wrap-break-word text-foreground`,children:e.message}),z(ne,{type:`button`,onClick:()=>{window.location.reload()},className:`px-3 py-1.5 text-base font-medium`,children:`Reload`})]})})}var el=G(()=>r(()=>import(`./cookie-banner-BxXvPdIY-DciefBm4.js`).then(e=>({default:e.CookieBanner})),__vite__mapDeps([118,79,97,1,93,94,95,26,119,120,85,82,121]))),tl=e=>{let t=G(()=>r(()=>import(`./load-ftpCX1HI-C4L1Z5YI.js`).then(t=>t.loadComponent(e.localPackage)),__vite__mapDeps([122,82,81,1,2,10,15,9,8,83,13,78,35,36,44,14,84,85,86,87,88,89,90,91,92,119,79,94,112,123])));return z(tt,{children:B(fo,{fallbackRender:e=>z(I,{children:_(e.error)?z($c,{error:e.error}):z(co,{...e})}),resetKeys:[e.localPackage],loggerContext:[`Connect`],children:[z(nt,{fallback:z(I,{}),name:`AppLoader`,children:z(t,{...e,children:z(qs,{})})}),z(fo,{variant:`silent`,loggerContext:[`Connect`,`CookieBanner`],children:z(nt,{fallback:null,name:`CookieBanner`,children:z(el,{})})}),z(nt,{name:`ModalsContainer`,children:z(Zc,{})}),z(Fc,{}),z(Qc,{}),z(Dc,{})]})})};export{Qo as _,ec as a,ns as b,Ys as c,No as d,nc as f,ts as g,Tc as h,tl as i,Fo as l,wc as m,qs as n,Po as o,Sc as p,Io as r,Js as s,mo as t,tc as u,$o as v,ys as y};
6
+ //# sourceMappingURL=app-loader-l5wtQh5z-BCq0Ui4Q.js.map