@powerhousedao/connect 5.1.0 → 5.2.0-staging.1
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.
- package/.env +1 -0
- package/dist/assets/AddDriveModal-CMhY7EXt.js +1 -0
- package/dist/assets/ClearStorageModal-DFtnMF37.js +1 -0
- package/dist/assets/CookiesPolicyModal-wKn_crAz.js +1 -0
- package/dist/assets/CreateDocumentModal-axk-Gv87.js +1 -0
- package/dist/assets/{DebugSettingsModal-CooFY-Go.js → DebugSettingsModal-B8EImEik.js} +1 -1
- package/dist/assets/{DeleteDriveModal-BOdu1bg5.js → DeleteDriveModal-CDBGjFVT.js} +1 -1
- package/dist/assets/DeleteItemModal--lW49X7Z.js +1 -0
- package/dist/assets/DisclaimerModal-Cwlnu4SD.js +1 -0
- package/dist/assets/DriveSettingsModal-DLSYwH01.js +1 -0
- package/dist/assets/{ExportDocumentWithErrorsModal-BzgGSmxg.js → ExportDocumentWithErrorsModal-sNmpWNiL.js} +1 -1
- package/dist/assets/SettingsModal-BI_PIj3P.js +1 -0
- package/dist/assets/UpgradeDriveModal-fS2KcP5T.js +1 -0
- package/dist/assets/{design_system-DGYPpUGa.js → design_system-DRiFz7P7.js} +1 -1
- package/dist/assets/design_system_connect-D7mJC7XF.js +45 -0
- package/dist/assets/design_system_ui-7P3ayrQ9.js +1 -0
- package/dist/assets/{document_drive-BEIKnuGM.js → document_drive-BuVpBb4l.js} +25 -14
- package/dist/assets/{document_engineering-B49PhCDR.js → document_engineering-CXK5S1hf.js} +1 -1
- package/dist/assets/{document_model-DXcLJEjZ.js → document_model-DB4SzBSe.js} +3 -3
- package/dist/assets/document_model_editor-C7-Rcfye.js +23 -0
- package/dist/assets/{drive_explorer-d0kn77Nx.js → drive_explorer-xuI0xiNd.js} +2 -2
- package/dist/assets/{graphql-editor-CSkqTexL.js → graphql-editor-BpQTpuKO.js} +2 -2
- package/dist/assets/{hooks-D4Uas2SG.js → hooks-CAyBWwxg.js} +1 -1
- package/dist/assets/index-BchTCSNf.js +20 -0
- package/dist/assets/index-BilHslhO.css +1 -0
- package/dist/assets/index-CJrSFr5V.js +25 -0
- package/dist/assets/json-editor-CtpJfU25.js +1 -0
- package/dist/assets/nodefs-CNM_9qdV.js +1 -0
- package/dist/assets/opfs-ahp-D-CiKXE2.js +3 -0
- package/dist/assets/pg_dump-CW0pN9tG.wasm +0 -0
- package/dist/assets/postgres-CkP7QCDB.data +0 -0
- package/dist/assets/postgres-CyuUVpXN.wasm +0 -0
- package/dist/assets/reactor_browser-CV2asu7c.js +127 -0
- package/dist/assets/state-schemas-DXZotcNp.js +2 -0
- package/dist/assets/zod-BpTyxkjy.js +20 -0
- package/dist/index.html +11 -11
- package/heroku/Dockerfile +4 -1
- package/lib/package.copy.json +14 -8
- package/lib/src/components/app-skeleton.js +1 -1
- package/lib/src/components/app-skeleton.js.map +1 -1
- package/lib/src/components/modal/modals/AddDriveModal.d.ts.map +1 -1
- package/lib/src/components/modal/modals/AddDriveModal.js +35 -27
- package/lib/src/components/modal/modals/AddDriveModal.js.map +1 -1
- package/lib/src/components/modal/modals/InspectorModal/InspectorModal.d.ts +2 -0
- package/lib/src/components/modal/modals/InspectorModal/InspectorModal.d.ts.map +1 -0
- package/lib/src/components/modal/modals/InspectorModal/InspectorModal.js +26 -0
- package/lib/src/components/modal/modals/InspectorModal/InspectorModal.js.map +1 -0
- package/lib/src/components/modal/modals/InspectorModal/index.d.ts +2 -0
- package/lib/src/components/modal/modals/InspectorModal/index.d.ts.map +1 -0
- package/lib/src/components/modal/modals/InspectorModal/index.js +2 -0
- package/lib/src/components/modal/modals/InspectorModal/index.js.map +1 -0
- package/lib/src/components/modal/modals/InspectorModal/useDbExplorer.d.ts +32 -0
- package/lib/src/components/modal/modals/InspectorModal/useDbExplorer.d.ts.map +1 -0
- package/lib/src/components/modal/modals/InspectorModal/useDbExplorer.js +108 -0
- package/lib/src/components/modal/modals/InspectorModal/useDbExplorer.js.map +1 -0
- package/lib/src/components/modal/modals/InspectorModal/useRemotesInspector.d.ts +4 -0
- package/lib/src/components/modal/modals/InspectorModal/useRemotesInspector.d.ts.map +1 -0
- package/lib/src/components/modal/modals/InspectorModal/useRemotesInspector.js +12 -0
- package/lib/src/components/modal/modals/InspectorModal/useRemotesInspector.js.map +1 -0
- package/lib/src/components/modal/modals-container.d.ts.map +1 -1
- package/lib/src/components/modal/modals-container.js +4 -0
- package/lib/src/components/modal/modals-container.js.map +1 -1
- package/lib/src/components/root.js +1 -1
- package/lib/src/components/root.js.map +1 -1
- package/lib/src/components/sidebar.d.ts.map +1 -1
- package/lib/src/components/sidebar.js +6 -2
- package/lib/src/components/sidebar.js.map +1 -1
- package/lib/src/connect.config.d.ts +2 -0
- package/lib/src/connect.config.d.ts.map +1 -1
- package/lib/src/connect.config.js +1 -0
- package/lib/src/connect.config.js.map +1 -1
- package/lib/src/feature-flags.d.ts +22 -3
- package/lib/src/feature-flags.d.ts.map +1 -1
- package/lib/src/feature-flags.js +48 -3
- package/lib/src/feature-flags.js.map +1 -1
- package/lib/src/hooks/useClientErrorHandler.d.ts.map +1 -1
- package/lib/src/hooks/useClientErrorHandler.js +13 -2
- package/lib/src/hooks/useClientErrorHandler.js.map +1 -1
- package/lib/src/pages/demo/atlas-import.js +2 -2
- package/lib/src/pages/demo/atlas-import.js.map +1 -1
- package/lib/src/store/reactor.d.ts.map +1 -1
- package/lib/src/store/reactor.js +102 -51
- package/lib/src/store/reactor.js.map +1 -1
- package/lib/src/utils/reactor.d.ts +7 -0
- package/lib/src/utils/reactor.d.ts.map +1 -1
- package/lib/src/utils/reactor.js +35 -2
- package/lib/src/utils/reactor.js.map +1 -1
- package/lib/src/utils/signer.d.ts +18 -0
- package/lib/src/utils/signer.d.ts.map +1 -0
- package/lib/src/utils/signer.js +215 -0
- package/lib/src/utils/signer.js.map +1 -0
- package/lib/test/utils/signer.test.d.ts +2 -0
- package/lib/test/utils/signer.test.d.ts.map +1 -0
- package/lib/test/utils/signer.test.js +319 -0
- package/lib/test/utils/signer.test.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/vite.config.d.ts.map +1 -1
- package/lib/vite.config.js +4 -0
- package/lib/vite.config.js.map +1 -1
- package/lib/vitest.config.d.ts +3 -0
- package/lib/vitest.config.d.ts.map +1 -0
- package/lib/vitest.config.js +8 -0
- package/lib/vitest.config.js.map +1 -0
- package/nginx.conf +7 -0
- package/package.copy.json +14 -8
- package/package.json +21 -15
- package/dist/assets/AddDriveModal-_XSf2ZlN.js +0 -1
- package/dist/assets/ClearStorageModal-CbfJTlAo.js +0 -1
- package/dist/assets/CookiesPolicyModal-DTRuUeM_.js +0 -1
- package/dist/assets/CreateDocumentModal-DUTbfZYr.js +0 -1
- package/dist/assets/DeleteItemModal-D8MlQS3W.js +0 -1
- package/dist/assets/DisclaimerModal-RBBaiKyO.js +0 -1
- package/dist/assets/DriveSettingsModal-BHBZfzaY.js +0 -1
- package/dist/assets/SettingsModal-BXDXscnR.js +0 -1
- package/dist/assets/UpgradeDriveModal-15TBzq11.js +0 -1
- package/dist/assets/design_system_connect-Vb8XBnLs.js +0 -45
- package/dist/assets/design_system_ui-Dnwc_Xm9.js +0 -1
- package/dist/assets/document_model_editor-lmHQ6HZy.js +0 -23
- package/dist/assets/index-Br7E7qjt.css +0 -1
- package/dist/assets/index-CK2Jk_ho.js +0 -18
- package/dist/assets/json-editor-CQKAVxat.js +0 -1
- package/dist/assets/reactor_browser-BGn_P-dn.js +0 -25
- package/dist/assets/state-schemas-36mF-wEI.js +0 -2
- package/dist/assets/zod-C6yxFxyo.js +0 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sentry_react-cODD7zWc.js","assets/react-DQSxOgtG.js","assets/sentry_browser-B4YoBIIG.js","assets/AddDriveModal-CMhY7EXt.js","assets/document_model_editor-C7-Rcfye.js","assets/graphql-BS4Brs_E.js","assets/drive_explorer-xuI0xiNd.js","assets/react/jsx-runtime-DldvXD6N.js","assets/document_model-DB4SzBSe.js","assets/zod-BpTyxkjy.js","assets/design_system-DRiFz7P7.js","assets/tailwind_merge-Dr4f9Rms.js","assets/reactor_browser-CV2asu7c.js","assets/document_drive-BuVpBb4l.js","assets/config-CU-aFfVJ.js","assets/react-dom-D6zQJsh6.js","assets/design_system_connect-D7mJC7XF.js","assets/design_system_ui-7P3ayrQ9.js","assets/react-dom/client-BVPiT_FE.js","assets/graphql_request-9RNJ00DB.js","assets/ClearStorageModal-DFtnMF37.js","assets/CookiesPolicyModal-wKn_crAz.js","assets/CreateDocumentModal-axk-Gv87.js","assets/DebugSettingsModal-B8EImEik.js","assets/DeleteDriveModal-CDBGjFVT.js","assets/DeleteItemModal--lW49X7Z.js","assets/DisclaimerModal-Cwlnu4SD.js","assets/DriveSettingsModal-DLSYwH01.js","assets/ExportDocumentWithErrorsModal-sNmpWNiL.js","assets/SettingsModal-BI_PIj3P.js","assets/UpgradeDriveModal-fS2KcP5T.js","assets/index-CJrSFr5V.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as Ae,h as Bo,s as ie,i as Fo,n as bi,k as Ri,j as y,l as xi,E as Di}from"./document_model_editor-C7-Rcfye.js";import{d as wi}from"./design_system_ui-7P3ayrQ9.js";import{r as g,R as Oi,a as Vo}from"./sentry_react-cODD7zWc.js";import{q as Li,l as Y,t as Uo,B as Pi,R as Ai,I as Ti,E as Ii,v as Ut,w as ki}from"./document_drive-BuVpBb4l.js";import{_ as pe,G as Mi}from"./drive_explorer-xuI0xiNd.js";import{t as Hi,c as $o,H as zo,A as ji,W as Bi,d as Fi,e as Vi,f as Ui,g as $i,h as zi,i as Nn,F as Ki,j as Ko,k as Wi,B as Yi,l as Gi,m as Ji,S as Xi,n as qi}from"./design_system_connect-D7mJC7XF.js";import{x as Wo,y as Jr,U as Zi,R as Qi,z as es,A as ts,G as rs,K as ns,P as os,w as Be,B as Yo,i as Xr,j as as,C as is,D as ss,E as ls,F as qr,H as cs,f as Go,I as us,J as ds,L as Jo,M as fs,N as hs,O as ps,Q as gs,h as ms,T as vs,V as Es,W as ys,X as _s,Y as Cs,Z as Ss,b as Ns,_ as bs,$ as Rs,a0 as Xo,a1 as xs,a2 as qo,a3 as Ds,a4 as ws,a5 as Os,a6 as Ls,a7 as Ps,a8 as As,a9 as Ts,aa as Is,ab as ks,ac as Ms,ad as bn,ae as Hs,af as js,ag as Bs,ah as Fs,ai as Vs,aj as Us,ak as $s,al as zs,am as Ks,an as Ws,ao as Ys,ap as Gs,aq as Js,ar as Xs,as as qs,at as Zs,s as Rt,au as Qs,av as it,aw as Qe,ax as el,c as Zo,ay as tl,az as rl,aA as Qo,aB as nl,aC as Rn,aD as ol,aE as al,aF as il}from"./reactor_browser-CV2asu7c.js";import{I as kr,l as ea,Q as sl,c as At}from"./design_system-DRiFz7P7.js";import{a5 as ll,a4 as cl,a6 as $t,j as ta,h as ra,g as ul}from"./document_model-DB4SzBSe.js";import{g as dl,r as fl}from"./graphql_request-9RNJ00DB.js";import{g as hl,r as pl}from"./react-DQSxOgtG.js";import{t as gl}from"./tailwind_merge-Dr4f9Rms.js";import{an as ml}from"./sentry_browser-B4YoBIIG.js";import"./graphql-BS4Brs_E.js";import"./react/jsx-runtime-DldvXD6N.js";import"./zod-BpTyxkjy.js";import"./react-dom-D6zQJsh6.js";import"./react-dom/client-BVPiT_FE.js";import"./config-CU-aFfVJ.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const i of a.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&n(i)}).observe(document,{childList:!0,subtree:!0});function r(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(o){if(o.ep)return;o.ep=!0;const a=r(o);fetch(o.href,a)}})();const ee=Bo([Ri(),Fo(["true","false"])]).transform(t=>typeof t=="boolean"?t:t==="true"),qt=Bo([bi(),ie()]).transform(t=>typeof t=="number"?t:parseInt(t,10)),vl=Ae({PH_CONFIG_PATH:ie().optional(),PH_PACKAGES:ie().optional(),PH_LOCAL_PACKAGE:ie().optional(),PH_DISABLE_LOCAL_PACKAGE:ee.default(!1),PH_WATCH_TIMEOUT:qt.default(300),PH_SENTRY_AUTH_TOKEN:ie().optional(),PH_SENTRY_ORG:ie().optional(),PH_SENTRY_PROJECT:ie().optional()}),El=Ae({PH_CONNECT_VERSION:ie().default("unknown"),PH_CONNECT_LOG_LEVEL:Fo(["debug","info","warn","error"]).default("info"),PH_CONNECT_REQUIRES_HARD_REFRESH:ee.default(!0),PH_CONNECT_WARN_OUTDATED_APP:ee.default(!1),PH_CONNECT_STUDIO_MODE:ee.default(!1),PH_CONNECT_BASE_PATH:ie().optional(),PH_CONNECT_DEFAULT_DRIVES_URL:ie().optional(),PH_CONNECT_DRIVES_PRESERVE_STRATEGY:ie().optional(),PH_CONNECT_VERSION_CHECK_INTERVAL:qt.default(3600*1e3),PH_CONNECT_CLI_VERSION:ie().optional(),PH_CONNECT_FILE_UPLOAD_OPERATIONS_CHUNK_SIZE:qt.default(50)}),yl=Ae({PH_CONNECT_DISABLE_ADD_DRIVE:ee.default(!1),PH_CONNECT_SEARCH_BAR_ENABLED:ee.default(!1),PH_CONNECT_INSPECTOR_ENABLED:ee.default(!1),PH_CONNECT_HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS:ee.default(!0),PH_CONNECT_ENABLED_EDITORS:ie().optional(),PH_CONNECT_DISABLED_EDITORS:ie().default("powerhouse/document-drive"),PH_CONNECT_GA_TRACKING_ID:ie().optional(),PH_CONNECT_EXTERNAL_PACKAGES_DISABLED:ee.default(!1)}),_l=Ae({PH_CONNECT_PUBLIC_DRIVES_ENABLED:ee.default(!0),PH_CONNECT_DISABLE_ADD_PUBLIC_DRIVES:ee.default(!1),PH_CONNECT_DISABLE_DELETE_PUBLIC_DRIVES:ee.default(!1),PH_CONNECT_CLOUD_DRIVES_ENABLED:ee.default(!0),PH_CONNECT_DISABLE_ADD_CLOUD_DRIVES:ee.default(!1),PH_CONNECT_DISABLE_DELETE_CLOUD_DRIVES:ee.default(!1),PH_CONNECT_LOCAL_DRIVES_ENABLED:ee.default(!0),PH_CONNECT_DISABLE_ADD_LOCAL_DRIVES:ee.default(!1),PH_CONNECT_DISABLE_DELETE_LOCAL_DRIVES:ee.default(!1)}),Cl=Ae({PH_CONNECT_ANALYTICS_ENABLED:ee.default(!0),PH_CONNECT_ANALYTICS_DATABASE_NAME:ie().optional(),PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED:ee.default(!0),PH_CONNECT_DIFF_ANALYTICS_ENABLED:ee.default(!1),PH_CONNECT_DRIVE_ANALYTICS_ENABLED:ee.default(!0),PH_CONNECT_EXTERNAL_ANALYTICS_PROCESSORS_ENABLED:ee.default(!0)}),Sl=Ae({PH_CONNECT_RELATIONAL_PROCESSORS_ENABLED:ee.default(!0),PH_CONNECT_EXTERNAL_RELATIONAL_PROCESSORS_ENABLED:ee.default(!0)}),Nl=Ae({PH_CONNECT_PROCESSORS_ENABLED:ee.default(!0),PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED:ee.default(!0)}),bl=Nl.merge(Cl).merge(Sl),Rl=Ae({PH_CONNECT_SENTRY_RELEASE:ie().optional(),PH_CONNECT_SENTRY_DSN:ie().optional(),PH_CONNECT_SENTRY_ENV:ie().default("dev"),PH_CONNECT_SENTRY_TRACING_ENABLED:ee.default(!1)}),xl=Ae({PH_CONNECT_RENOWN_URL:ie().default("https://www.renown.id"),PH_CONNECT_RENOWN_NETWORK_ID:ie().default("eip155"),PH_CONNECT_RENOWN_CHAIN_ID:qt.default(1)}),Wt=El.merge(yl).merge(_l).merge(bl).merge(Rl).merge(xl);vl.merge(Wt);function Dl(t,e,r){const{processEnv:n={},optionsEnv:o={},fileEnv:a={}}=t,i={};for(const s of e){const l=[{name:"process.env",value:n[s]},{name:"options",value:o[s]},{name:"fileEnv",value:a[s]}];for(const c of l){const u=c.value;if(!(u===void 0||u===""))try{const d=r.shape[s];if(d){d.parse(u),i[s]=u;break}console.warn(`Unknown environment variable: '${s}'`),i[s]=u;break}catch{const d=u===null?"null":typeof u=="object"?JSON.stringify(u):u;console.warn(`Invalid value for ${s} from ${c.name}: ${d}. Trying next source.`)}}}return i}function wl(t={}){const e=new Set(Object.keys(Wt.shape)),r=Dl(t,e,Wt);return Wt.parse(r)}function Ol(t){let e=t;return e.startsWith(".")&&(e=e.slice(1)),e.startsWith("/")||(e=`/${e}`),e.endsWith("/")||(e=`${e}/`),e}const Ll={BASE_URL:"/",DEV:!1,MODE:"production",PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED:"true",PH_CONNECT_ANALYTICS_ENABLED:"true",PH_CONNECT_CLOUD_DRIVES_ENABLED:"true",PH_CONNECT_DIFF_ANALYTICS_ENABLED:"false",PH_CONNECT_DISABLED_EDITORS:"powerhouse/document-drive",PH_CONNECT_DISABLE_ADD_CLOUD_DRIVES:"false",PH_CONNECT_DISABLE_ADD_DRIVE:"false",PH_CONNECT_DISABLE_ADD_LOCAL_DRIVES:"false",PH_CONNECT_DISABLE_ADD_PUBLIC_DRIVES:"false",PH_CONNECT_DISABLE_DELETE_CLOUD_DRIVES:"false",PH_CONNECT_DISABLE_DELETE_LOCAL_DRIVES:"false",PH_CONNECT_DISABLE_DELETE_PUBLIC_DRIVES:"false",PH_CONNECT_DRIVE_ANALYTICS_ENABLED:"true",PH_CONNECT_EXTERNAL_ANALYTICS_PROCESSORS_ENABLED:"true",PH_CONNECT_EXTERNAL_PACKAGES_DISABLED:"false",PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED:"true",PH_CONNECT_EXTERNAL_RELATIONAL_PROCESSORS_ENABLED:"true",PH_CONNECT_FILE_UPLOAD_OPERATIONS_CHUNK_SIZE:"50",PH_CONNECT_HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS:"true",PH_CONNECT_INSPECTOR_ENABLED:"false",PH_CONNECT_LOCAL_DRIVES_ENABLED:"true",PH_CONNECT_LOG_LEVEL:"info",PH_CONNECT_PROCESSORS_ENABLED:"true",PH_CONNECT_PUBLIC_DRIVES_ENABLED:"true",PH_CONNECT_RELATIONAL_PROCESSORS_ENABLED:"true",PH_CONNECT_RENOWN_CHAIN_ID:"1",PH_CONNECT_RENOWN_NETWORK_ID:"eip155",PH_CONNECT_RENOWN_URL:"https://auth.renown.id",PH_CONNECT_REQUIRES_HARD_REFRESH:"true",PH_CONNECT_SEARCH_BAR_ENABLED:"false",PH_CONNECT_SENTRY_ENV:"prod",PH_CONNECT_SENTRY_TRACING_ENABLED:"false",PH_CONNECT_STUDIO_MODE:"false",PH_CONNECT_VERSION:"5.1.0-dev.23",PH_CONNECT_VERSION_CHECK_INTERVAL:"3600000",PH_CONNECT_WARN_OUTDATED_APP:"false",PROD:!0,SSR:!1},O=wl({processEnv:Ll});function Pl(t){return t.endsWith("/")?t:t+"/"}function Al(){const t=O.PH_CONNECT_BASE_PATH||"/",e=Pl(t);return{basePath:t,routerBasename:e,allowList:void 0,allowedDocumentTypes:[],isDragAndDropEnabled:!0,isEditorDebugModeEnabled:!1,isEditorReadModeEnabled:!1,isExternalControlsEnabled:!1,version:O.PH_CONNECT_VERSION,logLevel:O.PH_CONNECT_LOG_LEVEL,requiresHardRefresh:O.PH_CONNECT_REQUIRES_HARD_REFRESH,warnOutdatedApp:O.PH_CONNECT_WARN_OUTDATED_APP,studioMode:O.PH_CONNECT_STUDIO_MODE,versionCheckInterval:O.PH_CONNECT_VERSION_CHECK_INTERVAL,cliVersion:O.PH_CONNECT_CLI_VERSION,fileUploadOperationsChunkSize:O.PH_CONNECT_FILE_UPLOAD_OPERATIONS_CHUNK_SIZE,gaTrackingId:O.PH_CONNECT_GA_TRACKING_ID,defaultDrivesUrl:O.PH_CONNECT_DEFAULT_DRIVES_URL,drivesPreserveStrategy:O.PH_CONNECT_DRIVES_PRESERVE_STRATEGY,enabledEditors:O.PH_CONNECT_ENABLED_EDITORS?.split(","),disabledEditors:O.PH_CONNECT_DISABLED_EDITORS.split(","),isExternalProcessorsEnabled:O.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED,isAnalyticsEnabled:O.PH_CONNECT_ANALYTICS_ENABLED,isAnalyticsExternalProcessorsEnabled:O.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED&&O.PH_CONNECT_EXTERNAL_ANALYTICS_PROCESSORS_ENABLED,analyticsDatabaseName:O.PH_CONNECT_ANALYTICS_DATABASE_NAME,isRelationalProcessorsEnabled:O.PH_CONNECT_RELATIONAL_PROCESSORS_ENABLED,isExternalRelationalProcessorsEnabled:O.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED&&O.PH_CONNECT_EXTERNAL_RELATIONAL_PROCESSORS_ENABLED,renownUrl:O.PH_CONNECT_RENOWN_URL,renownNetworkId:O.PH_CONNECT_RENOWN_NETWORK_ID,renownChainId:O.PH_CONNECT_RENOWN_CHAIN_ID,sentryRelease:O.PH_CONNECT_SENTRY_RELEASE,sentryDsn:O.PH_CONNECT_SENTRY_DSN,sentryEnv:O.PH_CONNECT_SENTRY_ENV,isDiffAnalyticsEnabled:O.PH_CONNECT_DIFF_ANALYTICS_ENABLED,isDriveAnalyticsEnabled:O.PH_CONNECT_DRIVE_ANALYTICS_ENABLED,isPublicDrivesEnabled:O.PH_CONNECT_PUBLIC_DRIVES_ENABLED,isCloudDrivesEnabled:O.PH_CONNECT_CLOUD_DRIVES_ENABLED,isLocalDrivesEnabled:O.PH_CONNECT_LOCAL_DRIVES_ENABLED,isSentryTracingEnabled:O.PH_CONNECT_SENTRY_TRACING_ENABLED,isDocumentModelSelectionSettingsEnabled:!O.PH_CONNECT_HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS,isAddDriveEnabled:!O.PH_CONNECT_DISABLE_ADD_DRIVE,isAddPublicDrivesEnabled:!O.PH_CONNECT_DISABLE_ADD_PUBLIC_DRIVES,isDeletePublicDrivesEnabled:!O.PH_CONNECT_DISABLE_DELETE_PUBLIC_DRIVES,isAddCloudDrivesEnabled:!O.PH_CONNECT_DISABLE_ADD_CLOUD_DRIVES,isDeleteCloudDrivesEnabled:!O.PH_CONNECT_DISABLE_DELETE_CLOUD_DRIVES,isAddLocalDrivesEnabled:!O.PH_CONNECT_DISABLE_ADD_LOCAL_DRIVES,isDeleteLocalDrivesEnabled:!O.PH_CONNECT_DISABLE_DELETE_LOCAL_DRIVES,isAnalyticsDatabaseWorkerEnabled:!O.PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED,isExternalPackagesEnabled:!O.PH_CONNECT_EXTERNAL_PACKAGES_DISABLED}}const ht=Al(),Tl={isExternalControlsEnabled:ht.isExternalControlsEnabled},Il={allowedDocumentTypes:ht.allowedDocumentTypes,isDragAndDropEnabled:ht.isDragAndDropEnabled};Li(O.PH_CONNECT_LOG_LEVEL);Y.debug(`Setting log level to ${O.PH_CONNECT_LOG_LEVEL}.`);const na=Ol(O.PH_CONNECT_BASE_PATH||"/"),kl=O.PH_CONNECT_ANALYTICS_DATABASE_NAME||`${na.replace(/\//g,"")}:analytics`,se={appVersion:O.PH_CONNECT_VERSION,studioMode:O.PH_CONNECT_STUDIO_MODE,warnOutdatedApp:O.PH_CONNECT_WARN_OUTDATED_APP,appVersionCheckInterval:O.PH_CONNECT_VERSION_CHECK_INTERVAL,routerBasename:na,externalPackagesEnabled:!O.PH_CONNECT_EXTERNAL_PACKAGES_DISABLED,processors:{enabled:O.PH_CONNECT_PROCESSORS_ENABLED,externalProcessorsEnabled:O.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED},analytics:{enabled:O.PH_CONNECT_ANALYTICS_ENABLED,databaseName:kl,useWorker:!O.PH_CONNECT_ANALYTICS_DATABASE_WORKER_DISABLED,driveAnalyticsEnabled:O.PH_CONNECT_DRIVE_ANALYTICS_ENABLED,diffProcessorEnabled:O.PH_CONNECT_DIFF_ANALYTICS_ENABLED,externalProcessorsEnabled:O.PH_CONNECT_EXTERNAL_PROCESSORS_ENABLED},relational:{enabled:O.PH_CONNECT_RELATIONAL_PROCESSORS_ENABLED,externalProcessorsEnabled:O.PH_CONNECT_EXTERNAL_RELATIONAL_PROCESSORS_ENABLED},renown:{url:O.PH_CONNECT_RENOWN_URL,networkId:O.PH_CONNECT_RENOWN_NETWORK_ID,chainId:O.PH_CONNECT_RENOWN_CHAIN_ID},sentry:{release:O.PH_CONNECT_SENTRY_RELEASE,dsn:O.PH_CONNECT_SENTRY_DSN,env:O.PH_CONNECT_SENTRY_ENV,tracing:O.PH_CONNECT_SENTRY_TRACING_ENABLED},content:{showSearchBar:O.PH_CONNECT_SEARCH_BAR_ENABLED,showDocumentModelSelectionSetting:!O.PH_CONNECT_HIDE_DOCUMENT_MODEL_SELECTION_SETTINGS,inspectorEnabled:O.PH_CONNECT_INSPECTOR_ENABLED},drives:{addDriveEnabled:!O.PH_CONNECT_DISABLE_ADD_DRIVE,preserveStrategy:O.PH_CONNECT_DRIVES_PRESERVE_STRATEGY,sections:{LOCAL:{enabled:O.PH_CONNECT_LOCAL_DRIVES_ENABLED,allowAdd:!O.PH_CONNECT_DISABLE_ADD_LOCAL_DRIVES,allowDelete:!O.PH_CONNECT_DISABLE_DELETE_LOCAL_DRIVES},CLOUD:{enabled:O.PH_CONNECT_CLOUD_DRIVES_ENABLED,allowAdd:!O.PH_CONNECT_DISABLE_ADD_CLOUD_DRIVES,allowDelete:!O.PH_CONNECT_DISABLE_DELETE_CLOUD_DRIVES},PUBLIC:{enabled:O.PH_CONNECT_PUBLIC_DRIVES_ENABLED,allowAdd:!O.PH_CONNECT_DISABLE_ADD_PUBLIC_DRIVES,allowDelete:!O.PH_CONNECT_DISABLE_DELETE_PUBLIC_DRIVES}}},gaTrackingId:O.PH_CONNECT_GA_TRACKING_ID,phCliVersion:O.PH_CONNECT_CLI_VERSION},Ml=se.routerBasename,oa=`${Ml}:acceptedCookies`,Mr=new Set;let Yt=Hl();function Hl(){try{const t=localStorage.getItem(oa);return t?JSON.parse(t):{analytics:!1,marketing:!1,functional:!1}}catch{return{analytics:!1,marketing:!1,functional:!1}}}function xn(){return Yt}function jl(t){Yt=t(Yt),localStorage.setItem(oa,JSON.stringify(Yt)),Mr.forEach(e=>e())}function Bl(t){return Mr.add(t),()=>Mr.delete(t)}const Zr=()=>[g.useSyncExternalStore(Bl,xn,xn),jl];async function Qr(){try{return(await pe(()=>import("./hmr-LMNkvzP7.js"),[])).hmr}catch{return}}async function Xp(t){const e=await Qr();if(!e)throw new Error("HMR not available.");return new Promise(r=>{function n(o){t===o.name&&(r(),e?.off("studio:external-package-added",n))}e.on("studio:external-package-added",n),e.send("studio:add-external-package",{name:t})})}async function qp(t){const e=await Qr();if(!e)throw new Error("HMR not available.");return new Promise(r=>{function n(o){t===o.name&&(r(),e?.off("studio:external-package-removed",n))}e.on("studio:external-package-removed",n),e.send("studio:remove-external-package",{name:t})})}function Fl(){const t=g.useRef(void 0);g.useEffect(()=>{const e=async n=>{const o=window.ph?.vetraPackages||[],l=(await pe(()=>import(`${n.url}?t=${n.timestamp}`),[])).default.map(Wo),u=[...o.filter(d=>d.id==="powerhouse/common"),...l];Jr(u)};async function r(){const n=await Qr();t.current=n,n?.on("studio:external-packages-updated",e)}return r().catch(Y.error),()=>{t.current?.off("studio:external-packages-updated",e)}},[])}const Vl="connect";function en(t,e){const{type:r="default",containerId:n=Vl,...o}=e||{};return Hi(t,{type:r,containerId:n,...o})}const U=t=>typeof t=="string",yt=()=>{let t,e;const r=new Promise((n,o)=>{t=n,e=o});return r.resolve=t,r.reject=e,r},Dn=t=>t==null?"":""+t,Ul=(t,e,r)=>{t.forEach(n=>{e[n]&&(r[n]=e[n])})},$l=/###/g,wn=t=>t&&t.indexOf("###")>-1?t.replace($l,"."):t,On=t=>!t||U(t),xt=(t,e,r)=>{const n=U(e)?e.split("."):e;let o=0;for(;o<n.length-1;){if(On(t))return{};const a=wn(n[o]);!t[a]&&r&&(t[a]=new r),Object.prototype.hasOwnProperty.call(t,a)?t=t[a]:t={},++o}return On(t)?{}:{obj:t,k:wn(n[o])}},Ln=(t,e,r)=>{const{obj:n,k:o}=xt(t,e,Object);if(n!==void 0||e.length===1){n[o]=r;return}let a=e[e.length-1],i=e.slice(0,e.length-1),s=xt(t,i,Object);for(;s.obj===void 0&&i.length;)a=`${i[i.length-1]}.${a}`,i=i.slice(0,i.length-1),s=xt(t,i,Object),s?.obj&&typeof s.obj[`${s.k}.${a}`]<"u"&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=r},zl=(t,e,r,n)=>{const{obj:o,k:a}=xt(t,e,Object);o[a]=o[a]||[],o[a].push(r)},Zt=(t,e)=>{const{obj:r,k:n}=xt(t,e);if(r&&Object.prototype.hasOwnProperty.call(r,n))return r[n]},Kl=(t,e,r)=>{const n=Zt(t,r);return n!==void 0?n:Zt(e,r)},aa=(t,e,r)=>{for(const n in e)n!=="__proto__"&&n!=="constructor"&&(n in t?U(t[n])||t[n]instanceof String||U(e[n])||e[n]instanceof String?r&&(t[n]=e[n]):aa(t[n],e[n],r):t[n]=e[n]);return t},st=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Wl={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const Yl=t=>U(t)?t.replace(/[&<>"'\/]/g,e=>Wl[e]):t;class Gl{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const r=this.regExpMap.get(e);if(r!==void 0)return r;const n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}}const Jl=[" ",",","?","!",";"],Xl=new Gl(20),ql=(t,e,r)=>{e=e||"",r=r||"";const n=Jl.filter(i=>e.indexOf(i)<0&&r.indexOf(i)<0);if(n.length===0)return!0;const o=Xl.getRegExp(`(${n.map(i=>i==="?"?"\\?":i).join("|")})`);let a=!o.test(t);if(!a){const i=t.indexOf(r);i>0&&!o.test(t.substring(0,i))&&(a=!0)}return a},Hr=(t,e,r=".")=>{if(!t)return;if(t[e])return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;const n=e.split(r);let o=t;for(let a=0;a<n.length;){if(!o||typeof o!="object")return;let i,s="";for(let l=a;l<n.length;++l)if(l!==a&&(s+=r),s+=n[l],i=o[s],i!==void 0){if(["string","number","boolean"].indexOf(typeof i)>-1&&l<n.length-1)continue;a+=l-a+1;break}o=i}return o},Dt=t=>t?.replace("_","-"),Zl={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){console?.[t]?.apply?.(console,e)}};class Qt{constructor(e,r={}){this.init(e,r)}init(e,r={}){this.prefix=r.prefix||"i18next:",this.logger=e||Zl,this.options=r,this.debug=r.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,r,n,o){return o&&!this.debug?null:(U(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[r](e))}create(e){return new Qt(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new Qt(this.logger,e)}}var De=new Qt;class ir{constructor(){this.observers={}}on(e,r){return e.split(" ").forEach(n=>{this.observers[n]||(this.observers[n]=new Map);const o=this.observers[n].get(r)||0;this.observers[n].set(r,o+1)}),this}off(e,r){if(this.observers[e]){if(!r){delete this.observers[e];return}this.observers[e].delete(r)}}emit(e,...r){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([o,a])=>{for(let i=0;i<a;i++)o(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([o,a])=>{for(let i=0;i<a;i++)o.apply(o,[e,...r])})}}class Pn extends ir{constructor(e,r={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const r=this.options.ns.indexOf(e);r>-1&&this.options.ns.splice(r,1)}getResource(e,r,n,o={}){const a=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,i=o.ignoreJSONStructure!==void 0?o.ignoreJSONStructure:this.options.ignoreJSONStructure;let s;e.indexOf(".")>-1?s=e.split("."):(s=[e,r],n&&(Array.isArray(n)?s.push(...n):U(n)&&a?s.push(...n.split(a)):s.push(n)));const l=Zt(this.data,s);return!l&&!r&&!n&&e.indexOf(".")>-1&&(e=s[0],r=s[1],n=s.slice(2).join(".")),l||!i||!U(n)?l:Hr(this.data?.[e]?.[r],n,a)}addResource(e,r,n,o,a={silent:!1}){const i=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator;let s=[e,r];n&&(s=s.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(s=e.split("."),o=r,r=s[1]),this.addNamespaces(r),Ln(this.data,s,o),a.silent||this.emit("added",e,r,n,o)}addResources(e,r,n,o={silent:!1}){for(const a in n)(U(n[a])||Array.isArray(n[a]))&&this.addResource(e,r,a,n[a],{silent:!0});o.silent||this.emit("added",e,r,n)}addResourceBundle(e,r,n,o,a,i={silent:!1,skipCopy:!1}){let s=[e,r];e.indexOf(".")>-1&&(s=e.split("."),o=n,n=r,r=s[1]),this.addNamespaces(r);let l=Zt(this.data,s)||{};i.skipCopy||(n=JSON.parse(JSON.stringify(n))),o?aa(l,n,a):l={...l,...n},Ln(this.data,s,l),i.silent||this.emit("added",e,r,n)}removeResourceBundle(e,r){this.hasResourceBundle(e,r)&&delete this.data[e][r],this.removeNamespaces(r),this.emit("removed",e,r)}hasResourceBundle(e,r){return this.getResource(e,r)!==void 0}getResourceBundle(e,r){return r||(r=this.options.defaultNS),this.getResource(e,r)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const r=this.getDataByLanguage(e);return!!(r&&Object.keys(r)||[]).find(o=>r[o]&&Object.keys(r[o]).length>0)}toJSON(){return this.data}}var ia={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,r,n,o){return t.forEach(a=>{e=this.processors[a]?.process(e,r,n,o)??e}),e}};const sa=Symbol("i18next/PATH_KEY");function Ql(){const t=[],e=Object.create(null);let r;return e.get=(n,o)=>(r?.revoke?.(),o===sa?t:(t.push(o),r=Proxy.revocable(n,e),r.proxy)),Proxy.revocable(Object.create(null),e).proxy}function er(t,e){const{[sa]:r}=t(Ql());return r.join(e?.keySeparator??".")}const An={},vr=t=>!U(t)&&typeof t!="boolean"&&typeof t!="number";class tr extends ir{constructor(e,r={}){super(),Ul(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=De.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,r={interpolation:{}}){const n={...r};if(e==null)return!1;const o=this.resolve(e,n);if(o?.res===void 0)return!1;const a=vr(o.res);return!(n.returnObjects===!1&&a)}extractFromKey(e,r){let n=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;n===void 0&&(n=":");const o=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator;let a=r.ns||this.options.defaultNS||[];const i=n&&e.indexOf(n)>-1,s=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!ql(e,n,o);if(i&&!s){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:U(a)?[a]:a};const c=e.split(n);(n!==o||n===o&&this.options.ns.indexOf(c[0])>-1)&&(a=c.shift()),e=c.join(o)}return{key:e,namespaces:U(a)?[a]:a}}translate(e,r,n){let o=typeof r=="object"?{...r}:r;if(typeof o!="object"&&this.options.overloadTranslationOptionHandler&&(o=this.options.overloadTranslationOptionHandler(arguments)),typeof o=="object"&&(o={...o}),o||(o={}),e==null)return"";typeof e=="function"&&(e=er(e,{...this.options,...o})),Array.isArray(e)||(e=[String(e)]);const a=o.returnDetails!==void 0?o.returnDetails:this.options.returnDetails,i=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,{key:s,namespaces:l}=this.extractFromKey(e[e.length-1],o),c=l[l.length-1];let u=o.nsSeparator!==void 0?o.nsSeparator:this.options.nsSeparator;u===void 0&&(u=":");const d=o.lng||this.language,h=o.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d?.toLowerCase()==="cimode")return h?a?{res:`${c}${u}${s}`,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:c,usedParams:this.getUsedParamsDetails(o)}:`${c}${u}${s}`:a?{res:s,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:c,usedParams:this.getUsedParamsDetails(o)}:s;const f=this.resolve(e,o);let m=f?.res;const _=f?.usedKey||s,N=f?.exactUsedKey||s,C=["[object Number]","[object Function]","[object RegExp]"],b=o.joinArrays!==void 0?o.joinArrays:this.options.joinArrays,T=!this.i18nFormat||this.i18nFormat.handleAsObject,R=o.count!==void 0&&!U(o.count),w=tr.hasDefaultValue(o),P=R?this.pluralResolver.getSuffix(d,o.count,o):"",E=o.ordinal&&R?this.pluralResolver.getSuffix(d,o.count,{ordinal:!1}):"",D=R&&!o.ordinal&&o.count===0,j=D&&o[`defaultValue${this.options.pluralSeparator}zero`]||o[`defaultValue${P}`]||o[`defaultValue${E}`]||o.defaultValue;let M=m;T&&!m&&w&&(M=j);const $=vr(M),F=Object.prototype.toString.apply(M);if(T&&M&&$&&C.indexOf(F)<0&&!(U(b)&&Array.isArray(M))){if(!o.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const G=this.options.returnedObjectHandler?this.options.returnedObjectHandler(_,M,{...o,ns:l}):`key '${s} (${this.language})' returned an object instead of string.`;return a?(f.res=G,f.usedParams=this.getUsedParamsDetails(o),f):G}if(i){const G=Array.isArray(M),J=G?[]:{},me=G?N:_;for(const de in M)if(Object.prototype.hasOwnProperty.call(M,de)){const Z=`${me}${i}${de}`;w&&!m?J[de]=this.translate(Z,{...o,defaultValue:vr(j)?j[de]:void 0,joinArrays:!1,ns:l}):J[de]=this.translate(Z,{...o,joinArrays:!1,ns:l}),J[de]===Z&&(J[de]=M[de])}m=J}}else if(T&&U(b)&&Array.isArray(m))m=m.join(b),m&&(m=this.extendTranslation(m,e,o,n));else{let G=!1,J=!1;!this.isValidLookup(m)&&w&&(G=!0,m=j),this.isValidLookup(m)||(J=!0,m=s);const de=(o.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&J?void 0:m,Z=w&&j!==m&&this.options.updateMissing;if(J||G||Z){if(this.logger.log(Z?"updateKey":"missingKey",d,c,s,Z?j:m),i){const le=this.resolve(s,{...o,keySeparator:!1});le&&le.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let re=[];const we=this.languageUtils.getFallbackCodes(this.options.fallbackLng,o.lng||this.language);if(this.options.saveMissingTo==="fallback"&&we&&we[0])for(let le=0;le<we.length;le++)re.push(we[le]);else this.options.saveMissingTo==="all"?re=this.languageUtils.toResolveHierarchy(o.lng||this.language):re.push(o.lng||this.language);const Te=(le,fe,_e)=>{const Ie=w&&_e!==m?_e:de;this.options.missingKeyHandler?this.options.missingKeyHandler(le,c,fe,Ie,Z,o):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(le,c,fe,Ie,Z,o),this.emit("missingKey",le,c,fe,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&R?re.forEach(le=>{const fe=this.pluralResolver.getSuffixes(le,o);D&&o[`defaultValue${this.options.pluralSeparator}zero`]&&fe.indexOf(`${this.options.pluralSeparator}zero`)<0&&fe.push(`${this.options.pluralSeparator}zero`),fe.forEach(_e=>{Te([le],s+_e,o[`defaultValue${_e}`]||j)})}):Te(re,s,j))}m=this.extendTranslation(m,e,o,f,n),J&&m===s&&this.options.appendNamespaceToMissingKey&&(m=`${c}${u}${s}`),(J||G)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}${u}${s}`:s,G?m:void 0,o))}return a?(f.res=m,f.usedParams=this.getUsedParamsDetails(o),f):m}extendTranslation(e,r,n,o,a){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});const l=U(e)&&(n?.interpolation?.skipOnVariables!==void 0?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let c;if(l){const d=e.match(this.interpolator.nestingRegexp);c=d&&d.length}let u=n.replace&&!U(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(u={...this.options.interpolation.defaultVariables,...u}),e=this.interpolator.interpolate(e,u,n.lng||this.language||o.usedLng,n),l){const d=e.match(this.interpolator.nestingRegexp),h=d&&d.length;c<h&&(n.nest=!1)}!n.lng&&o&&o.res&&(n.lng=this.language||o.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...d)=>a?.[0]===d[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${d[0]} in key: ${r[0]}`),null):this.translate(...d,r),n)),n.interpolation&&this.interpolator.reset()}const i=n.postProcess||this.options.postProcess,s=U(i)?[i]:i;return e!=null&&s?.length&&n.applyPostProcessor!==!1&&(e=ia.handle(s,e,r,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...o,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,r={}){let n,o,a,i,s;return U(e)&&(e=[e]),e.forEach(l=>{if(this.isValidLookup(n))return;const c=this.extractFromKey(l,r),u=c.key;o=u;let d=c.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const h=r.count!==void 0&&!U(r.count),f=h&&!r.ordinal&&r.count===0,m=r.context!==void 0&&(U(r.context)||typeof r.context=="number")&&r.context!=="",_=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);d.forEach(N=>{this.isValidLookup(n)||(s=N,!An[`${_[0]}-${N}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(s)&&(An[`${_[0]}-${N}`]=!0,this.logger.warn(`key "${o}" for languages "${_.join(", ")}" won't get resolved as namespace "${s}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),_.forEach(C=>{if(this.isValidLookup(n))return;i=C;const b=[u];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(b,u,C,N,r);else{let R;h&&(R=this.pluralResolver.getSuffix(C,r.count,r));const w=`${this.options.pluralSeparator}zero`,P=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(h&&(r.ordinal&&R.indexOf(P)===0&&b.push(u+R.replace(P,this.options.pluralSeparator)),b.push(u+R),f&&b.push(u+w)),m){const E=`${u}${this.options.contextSeparator||"_"}${r.context}`;b.push(E),h&&(r.ordinal&&R.indexOf(P)===0&&b.push(E+R.replace(P,this.options.pluralSeparator)),b.push(E+R),f&&b.push(E+w))}}let T;for(;T=b.pop();)this.isValidLookup(n)||(a=T,n=this.getResource(C,N,T,r))}))})}),{res:n,usedKey:o,exactUsedKey:a,usedLng:i,usedNS:s}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,r,n,o={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,r,n,o):this.resourceStore.getResource(e,r,n,o)}getUsedParamsDetails(e={}){const r=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],n=e.replace&&!U(e.replace);let o=n?e.replace:e;if(n&&typeof e.count<"u"&&(o.count=e.count),this.options.interpolation.defaultVariables&&(o={...this.options.interpolation.defaultVariables,...o}),!n){o={...o};for(const a of r)delete o[a]}return o}static hasDefaultValue(e){const r="defaultValue";for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&r===n.substring(0,r.length)&&e[n]!==void 0)return!0;return!1}}class Tn{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=De.create("languageUtils")}getScriptPartFromCode(e){if(e=Dt(e),!e||e.indexOf("-")<0)return null;const r=e.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}getLanguagePartFromCode(e){if(e=Dt(e),!e||e.indexOf("-")<0)return e;const r=e.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(e){if(U(e)&&e.indexOf("-")>-1){let r;try{r=Intl.getCanonicalLocales(e)[0]}catch{}return r&&this.options.lowerCaseLng&&(r=r.toLowerCase()),r||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let r;return e.forEach(n=>{if(r)return;const o=this.formatLanguageCode(n);(!this.options.supportedLngs||this.isSupportedCode(o))&&(r=o)}),!r&&this.options.supportedLngs&&e.forEach(n=>{if(r)return;const o=this.getScriptPartFromCode(n);if(this.isSupportedCode(o))return r=o;const a=this.getLanguagePartFromCode(n);if(this.isSupportedCode(a))return r=a;r=this.options.supportedLngs.find(i=>{if(i===a)return i;if(!(i.indexOf("-")<0&&a.indexOf("-")<0)&&(i.indexOf("-")>0&&a.indexOf("-")<0&&i.substring(0,i.indexOf("-"))===a||i.indexOf(a)===0&&a.length>1))return i})}),r||(r=this.getFallbackCodes(this.options.fallbackLng)[0]),r}getFallbackCodes(e,r){if(!e)return[];if(typeof e=="function"&&(e=e(r)),U(e)&&(e=[e]),Array.isArray(e))return e;if(!r)return e.default||[];let n=e[r];return n||(n=e[this.getScriptPartFromCode(r)]),n||(n=e[this.formatLanguageCode(r)]),n||(n=e[this.getLanguagePartFromCode(r)]),n||(n=e.default),n||[]}toResolveHierarchy(e,r){const n=this.getFallbackCodes((r===!1?[]:r)||this.options.fallbackLng||[],e),o=[],a=i=>{i&&(this.isSupportedCode(i)?o.push(i):this.logger.warn(`rejecting language code not found in supportedLngs: ${i}`))};return U(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&a(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&a(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&a(this.getLanguagePartFromCode(e))):U(e)&&a(this.formatLanguageCode(e)),n.forEach(i=>{o.indexOf(i)<0&&a(this.formatLanguageCode(i))}),o}}const In={zero:0,one:1,two:2,few:3,many:4,other:5},kn={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class ec{constructor(e,r={}){this.languageUtils=e,this.options=r,this.logger=De.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,r){this.rules[e]=r}clearCache(){this.pluralRulesCache={}}getRule(e,r={}){const n=Dt(e==="dev"?"en":e),o=r.ordinal?"ordinal":"cardinal",a=JSON.stringify({cleanedCode:n,type:o});if(a in this.pluralRulesCache)return this.pluralRulesCache[a];let i;try{i=new Intl.PluralRules(n,{type:o})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),kn;if(!e.match(/-|_/))return kn;const l=this.languageUtils.getLanguagePartFromCode(e);i=this.getRule(l,r)}return this.pluralRulesCache[a]=i,i}needsPlural(e,r={}){let n=this.getRule(e,r);return n||(n=this.getRule("dev",r)),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,r,n={}){return this.getSuffixes(e,n).map(o=>`${r}${o}`)}getSuffixes(e,r={}){let n=this.getRule(e,r);return n||(n=this.getRule("dev",r)),n?n.resolvedOptions().pluralCategories.sort((o,a)=>In[o]-In[a]).map(o=>`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${o}`):[]}getSuffix(e,r,n={}){const o=this.getRule(e,n);return o?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${o.select(r)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",r,n))}}const Mn=(t,e,r,n=".",o=!0)=>{let a=Kl(t,e,r);return!a&&o&&U(r)&&(a=Hr(t,r,n),a===void 0&&(a=Hr(e,r,n))),a},Er=t=>t.replace(/\$/g,"$$$$");class tc{constructor(e={}){this.logger=De.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(r=>r),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:r,escapeValue:n,useRawValueToEscape:o,prefix:a,prefixEscaped:i,suffix:s,suffixEscaped:l,formatSeparator:c,unescapeSuffix:u,unescapePrefix:d,nestingPrefix:h,nestingPrefixEscaped:f,nestingSuffix:m,nestingSuffixEscaped:_,nestingOptionsSeparator:N,maxReplaces:C,alwaysFormat:b}=e.interpolation;this.escape=r!==void 0?r:Yl,this.escapeValue=n!==void 0?n:!0,this.useRawValueToEscape=o!==void 0?o:!1,this.prefix=a?st(a):i||"{{",this.suffix=s?st(s):l||"}}",this.formatSeparator=c||",",this.unescapePrefix=u?"":d||"-",this.unescapeSuffix=this.unescapePrefix?"":u||"",this.nestingPrefix=h?st(h):f||st("$t("),this.nestingSuffix=m?st(m):_||st(")"),this.nestingOptionsSeparator=N||",",this.maxReplaces=C||1e3,this.alwaysFormat=b!==void 0?b:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(r,n)=>r?.source===n?(r.lastIndex=0,r):new RegExp(n,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,r,n,o){let a,i,s;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=f=>{if(f.indexOf(this.formatSeparator)<0){const C=Mn(r,l,f,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(C,void 0,n,{...o,...r,interpolationkey:f}):C}const m=f.split(this.formatSeparator),_=m.shift().trim(),N=m.join(this.formatSeparator).trim();return this.format(Mn(r,l,_,this.options.keySeparator,this.options.ignoreJSONStructure),N,n,{...o,...r,interpolationkey:_})};this.resetRegExp();const u=o?.missingInterpolationHandler||this.options.missingInterpolationHandler,d=o?.interpolation?.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:f=>Er(f)},{regex:this.regexp,safeValue:f=>this.escapeValue?Er(this.escape(f)):Er(f)}].forEach(f=>{for(s=0;a=f.regex.exec(e);){const m=a[1].trim();if(i=c(m),i===void 0)if(typeof u=="function"){const N=u(e,a,o);i=U(N)?N:""}else if(o&&Object.prototype.hasOwnProperty.call(o,m))i="";else if(d){i=a[0];continue}else this.logger.warn(`missed to pass in variable ${m} for interpolating ${e}`),i="";else!U(i)&&!this.useRawValueToEscape&&(i=Dn(i));const _=f.safeValue(i);if(e=e.replace(a[0],_),d?(f.regex.lastIndex+=i.length,f.regex.lastIndex-=a[0].length):f.regex.lastIndex=0,s++,s>=this.maxReplaces)break}}),e}nest(e,r,n={}){let o,a,i;const s=(l,c)=>{const u=this.nestingOptionsSeparator;if(l.indexOf(u)<0)return l;const d=l.split(new RegExp(`${u}[ ]*{`));let h=`{${d[1]}`;l=d[0],h=this.interpolate(h,i);const f=h.match(/'/g),m=h.match(/"/g);((f?.length??0)%2===0&&!m||m.length%2!==0)&&(h=h.replace(/'/g,'"'));try{i=JSON.parse(h),c&&(i={...c,...i})}catch(_){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,_),`${l}${u}${h}`}return i.defaultValue&&i.defaultValue.indexOf(this.prefix)>-1&&delete i.defaultValue,l};for(;o=this.nestingRegexp.exec(e);){let l=[];i={...n},i=i.replace&&!U(i.replace)?i.replace:i,i.applyPostProcessor=!1,delete i.defaultValue;const c=/{.*}/.test(o[1])?o[1].lastIndexOf("}")+1:o[1].indexOf(this.formatSeparator);if(c!==-1&&(l=o[1].slice(c).split(this.formatSeparator).map(u=>u.trim()).filter(Boolean),o[1]=o[1].slice(0,c)),a=r(s.call(this,o[1].trim(),i),i),a&&o[0]===e&&!U(a))return a;U(a)||(a=Dn(a)),a||(this.logger.warn(`missed to resolve ${o[1]} for nesting ${e}`),a=""),l.length&&(a=l.reduce((u,d)=>this.format(u,d,n.lng,{...n,interpolationkey:o[1].trim()}),a.trim())),e=e.replace(o[0],a),this.regexp.lastIndex=0}return e}}const rc=t=>{let e=t.toLowerCase().trim();const r={};if(t.indexOf("(")>-1){const n=t.split("(");e=n[0].toLowerCase().trim();const o=n[1].substring(0,n[1].length-1);e==="currency"&&o.indexOf(":")<0?r.currency||(r.currency=o.trim()):e==="relativetime"&&o.indexOf(":")<0?r.range||(r.range=o.trim()):o.split(";").forEach(i=>{if(i){const[s,...l]=i.split(":"),c=l.join(":").trim().replace(/^'+|'+$/g,""),u=s.trim();r[u]||(r[u]=c),c==="false"&&(r[u]=!1),c==="true"&&(r[u]=!0),isNaN(c)||(r[u]=parseInt(c,10))}})}return{formatName:e,formatOptions:r}},Hn=t=>{const e={};return(r,n,o)=>{let a=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(a={...a,[o.interpolationkey]:void 0});const i=n+JSON.stringify(a);let s=e[i];return s||(s=t(Dt(n),o),e[i]=s),s(r)}},nc=t=>(e,r,n)=>t(Dt(r),n)(e);class oc{constructor(e={}){this.logger=De.create("formatter"),this.options=e,this.init(e)}init(e,r={interpolation:{}}){this.formatSeparator=r.interpolation.formatSeparator||",";const n=r.cacheInBuiltFormats?Hn:nc;this.formats={number:n((o,a)=>{const i=new Intl.NumberFormat(o,{...a});return s=>i.format(s)}),currency:n((o,a)=>{const i=new Intl.NumberFormat(o,{...a,style:"currency"});return s=>i.format(s)}),datetime:n((o,a)=>{const i=new Intl.DateTimeFormat(o,{...a});return s=>i.format(s)}),relativetime:n((o,a)=>{const i=new Intl.RelativeTimeFormat(o,{...a});return s=>i.format(s,a.range||"day")}),list:n((o,a)=>{const i=new Intl.ListFormat(o,{...a});return s=>i.format(s)})}}add(e,r){this.formats[e.toLowerCase().trim()]=r}addCached(e,r){this.formats[e.toLowerCase().trim()]=Hn(r)}format(e,r,n,o={}){const a=r.split(this.formatSeparator);if(a.length>1&&a[0].indexOf("(")>1&&a[0].indexOf(")")<0&&a.find(s=>s.indexOf(")")>-1)){const s=a.findIndex(l=>l.indexOf(")")>-1);a[0]=[a[0],...a.splice(1,s)].join(this.formatSeparator)}return a.reduce((s,l)=>{const{formatName:c,formatOptions:u}=rc(l);if(this.formats[c]){let d=s;try{const h=o?.formatParams?.[o.interpolationkey]||{},f=h.locale||h.lng||o.locale||o.lng||n;d=this.formats[c](s,f,{...u,...o,...h})}catch(h){this.logger.warn(h)}return d}else this.logger.warn(`there was no format function for ${c}`);return s},e)}}const ac=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class ic extends ir{constructor(e,r,n,o={}){super(),this.backend=e,this.store=r,this.services=n,this.languageUtils=n.languageUtils,this.options=o,this.logger=De.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=o.maxParallelReads||10,this.readingCalls=0,this.maxRetries=o.maxRetries>=0?o.maxRetries:5,this.retryTimeout=o.retryTimeout>=1?o.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,o.backend,o)}queueLoad(e,r,n,o){const a={},i={},s={},l={};return e.forEach(c=>{let u=!0;r.forEach(d=>{const h=`${c}|${d}`;!n.reload&&this.store.hasResourceBundle(c,d)?this.state[h]=2:this.state[h]<0||(this.state[h]===1?i[h]===void 0&&(i[h]=!0):(this.state[h]=1,u=!1,i[h]===void 0&&(i[h]=!0),a[h]===void 0&&(a[h]=!0),l[d]===void 0&&(l[d]=!0)))}),u||(s[c]=!0)}),(Object.keys(a).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:o}),{toLoad:Object.keys(a),pending:Object.keys(i),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(l)}}loaded(e,r,n){const o=e.split("|"),a=o[0],i=o[1];r&&this.emit("failedLoading",a,i,r),!r&&n&&this.store.addResourceBundle(a,i,n,void 0,void 0,{skipCopy:!0}),this.state[e]=r?-1:2,r&&n&&(this.state[e]=0);const s={};this.queue.forEach(l=>{zl(l.loaded,[a],i),ac(l,e),r&&l.errors.push(r),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(c=>{s[c]||(s[c]={});const u=l.loaded[c];u.length&&u.forEach(d=>{s[c][d]===void 0&&(s[c][d]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",s),this.queue=this.queue.filter(l=>!l.done)}read(e,r,n,o=0,a=this.retryTimeout,i){if(!e.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:r,fcName:n,tried:o,wait:a,callback:i});return}this.readingCalls++;const s=(c,u)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(c&&u&&o<this.maxRetries){setTimeout(()=>{this.read.call(this,e,r,n,o+1,a*2,i)},a);return}i(c,u)},l=this.backend[n].bind(this.backend);if(l.length===2){try{const c=l(e,r);c&&typeof c.then=="function"?c.then(u=>s(null,u)).catch(s):s(null,c)}catch(c){s(c)}return}return l(e,r,s)}prepareLoading(e,r,n={},o){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();U(e)&&(e=this.languageUtils.toResolveHierarchy(e)),U(r)&&(r=[r]);const a=this.queueLoad(e,r,n,o);if(!a.toLoad.length)return a.pending.length||o(),null;a.toLoad.forEach(i=>{this.loadOne(i)})}load(e,r,n){this.prepareLoading(e,r,{},n)}reload(e,r,n){this.prepareLoading(e,r,{reload:!0},n)}loadOne(e,r=""){const n=e.split("|"),o=n[0],a=n[1];this.read(o,a,"read",void 0,void 0,(i,s)=>{i&&this.logger.warn(`${r}loading namespace ${a} for language ${o} failed`,i),!i&&s&&this.logger.log(`${r}loaded namespace ${a} for language ${o}`,s),this.loaded(e,i,s)})}saveMissing(e,r,n,o,a,i={},s=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(r)){this.logger.warn(`did not save key "${n}" as the namespace "${r}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(n==null||n==="")){if(this.backend?.create){const l={...i,isUpdate:a},c=this.backend.create.bind(this.backend);if(c.length<6)try{let u;c.length===5?u=c(e,r,n,o,l):u=c(e,r,n,o),u&&typeof u.then=="function"?u.then(d=>s(null,d)).catch(s):s(null,u)}catch(u){s(u)}else c(e,r,n,o,s,l)}!e||!e[0]||this.store.addResource(e[0],r,n,o)}}}const jn=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:t=>{let e={};if(typeof t[1]=="object"&&(e=t[1]),U(t[1])&&(e.defaultValue=t[1]),U(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const r=t[3]||t[2];Object.keys(r).forEach(n=>{e[n]=r[n]})}return e},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Bn=t=>(U(t.ns)&&(t.ns=[t.ns]),U(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),U(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs?.indexOf?.("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),typeof t.initImmediate=="boolean"&&(t.initAsync=t.initImmediate),t),zt=()=>{},sc=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(r=>{typeof t[r]=="function"&&(t[r]=t[r].bind(t))})};class wt extends ir{constructor(e={},r){if(super(),this.options=Bn(e),this.services={},this.logger=De,this.modules={external:[]},sc(this),r&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,r),this;setTimeout(()=>{this.init(e,r)},0)}}init(e={},r){this.isInitializing=!0,typeof e=="function"&&(r=e,e={}),e.defaultNS==null&&e.ns&&(U(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const n=jn();this.options={...n,...this.options,...Bn(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator);const o=c=>c?typeof c=="function"?new c:c:null;if(!this.options.isClone){this.modules.logger?De.init(o(this.modules.logger),this.options):De.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:c=oc;const u=new Tn(this.options);this.store=new Pn(this.options.resources,this.options);const d=this.services;d.logger=De,d.resourceStore=this.store,d.languageUtils=u,d.pluralResolver=new ec(u,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),c&&(!this.options.interpolation.format||this.options.interpolation.format===n.interpolation.format)&&(d.formatter=o(c),d.formatter.init&&d.formatter.init(d,this.options),this.options.interpolation.format=d.formatter.format.bind(d.formatter)),d.interpolator=new tc(this.options),d.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},d.backendConnector=new ic(o(this.modules.backend),d.resourceStore,d,this.options),d.backendConnector.on("*",(f,...m)=>{this.emit(f,...m)}),this.modules.languageDetector&&(d.languageDetector=o(this.modules.languageDetector),d.languageDetector.init&&d.languageDetector.init(d,this.options.detection,this.options)),this.modules.i18nFormat&&(d.i18nFormat=o(this.modules.i18nFormat),d.i18nFormat.init&&d.i18nFormat.init(this)),this.translator=new tr(this.services,this.options),this.translator.on("*",(f,...m)=>{this.emit(f,...m)}),this.modules.external.forEach(f=>{f.init&&f.init(this)})}if(this.format=this.options.interpolation.format,r||(r=zt),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&c[0]!=="dev"&&(this.options.lng=c[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(c=>{this[c]=(...u)=>this.store[c](...u)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=(...u)=>(this.store[c](...u),this)});const s=yt(),l=()=>{const c=(u,d)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),s.resolve(d),r(u,d)};if(this.languages&&!this.isInitialized)return c(null,this.t.bind(this));this.changeLanguage(this.options.lng,c)};return this.options.resources||!this.options.initAsync?l():setTimeout(l,0),s}loadResources(e,r=zt){let n=r;const o=U(e)?e:this.language;if(typeof e=="function"&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(o?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return n();const a=[],i=s=>{if(!s||s==="cimode")return;this.services.languageUtils.toResolveHierarchy(s).forEach(c=>{c!=="cimode"&&a.indexOf(c)<0&&a.push(c)})};o?i(o):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>i(l)),this.options.preload?.forEach?.(s=>i(s)),this.services.backendConnector.load(a,this.options.ns,s=>{!s&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(s)})}else n(null)}reloadResources(e,r,n){const o=yt();return typeof e=="function"&&(n=e,e=void 0),typeof r=="function"&&(n=r,r=void 0),e||(e=this.languages),r||(r=this.options.ns),n||(n=zt),this.services.backendConnector.reload(e,r,a=>{o.resolve(),n(a)}),o}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&ia.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!(["cimode","dev"].indexOf(e)>-1)){for(let r=0;r<this.languages.length;r++){const n=this.languages[r];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,r){this.isLanguageChangingTo=e;const n=yt();this.emit("languageChanging",e);const o=s=>{this.language=s,this.languages=this.services.languageUtils.toResolveHierarchy(s),this.resolvedLanguage=void 0,this.setResolvedLanguage(s)},a=(s,l)=>{l?this.isLanguageChangingTo===e&&(o(l),this.translator.changeLanguage(l),this.isLanguageChangingTo=void 0,this.emit("languageChanged",l),this.logger.log("languageChanged",l)):this.isLanguageChangingTo=void 0,n.resolve((...c)=>this.t(...c)),r&&r(s,(...c)=>this.t(...c))},i=s=>{!e&&!s&&this.services.languageDetector&&(s=[]);const l=U(s)?s:s&&s[0],c=this.store.hasLanguageSomeTranslations(l)?l:this.services.languageUtils.getBestMatchFromCodes(U(s)?[s]:s);c&&(this.language||o(c),this.translator.language||this.translator.changeLanguage(c),this.services.languageDetector?.cacheUserLanguage?.(c)),this.loadResources(c,u=>{a(u,c)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?i(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(i):this.services.languageDetector.detect(i):i(e),n}getFixedT(e,r,n){const o=(a,i,...s)=>{let l;typeof i!="object"?l=this.options.overloadTranslationOptionHandler([a,i].concat(s)):l={...i},l.lng=l.lng||o.lng,l.lngs=l.lngs||o.lngs,l.ns=l.ns||o.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||n||o.keyPrefix);const c=this.options.keySeparator||".";let u;return l.keyPrefix&&Array.isArray(a)?u=a.map(d=>(typeof d=="function"&&(d=er(d,{...this.options,...i})),`${l.keyPrefix}${c}${d}`)):(typeof a=="function"&&(a=er(a,{...this.options,...i})),u=l.keyPrefix?`${l.keyPrefix}${c}${a}`:a),this.t(u,l)};return U(e)?o.lng=e:o.lngs=e,o.ns=r,o.keyPrefix=n,o}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,r={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const n=r.lng||this.resolvedLanguage||this.languages[0],o=this.options?this.options.fallbackLng:!1,a=this.languages[this.languages.length-1];if(n.toLowerCase()==="cimode")return!0;const i=(s,l)=>{const c=this.services.backendConnector.state[`${s}|${l}`];return c===-1||c===0||c===2};if(r.precheck){const s=r.precheck(this,i);if(s!==void 0)return s}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||i(n,e)&&(!o||i(a,e)))}loadNamespaces(e,r){const n=yt();return this.options.ns?(U(e)&&(e=[e]),e.forEach(o=>{this.options.ns.indexOf(o)<0&&this.options.ns.push(o)}),this.loadResources(o=>{n.resolve(),r&&r(o)}),n):(r&&r(),Promise.resolve())}loadLanguages(e,r){const n=yt();U(e)&&(e=[e]);const o=this.options.preload||[],a=e.filter(i=>o.indexOf(i)<0&&this.services.languageUtils.isSupportedCode(i));return a.length?(this.options.preload=o.concat(a),this.loadResources(i=>{n.resolve(),r&&r(i)}),n):(r&&r(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";try{const o=new Intl.Locale(e);if(o&&o.getTextInfo){const a=o.getTextInfo();if(a&&a.direction)return a.direction}}catch{}const r=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],n=this.services?.languageUtils||new Tn(jn());return e.toLowerCase().indexOf("-latn")>1?"ltr":r.indexOf(n.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},r){return new wt(e,r)}cloneInstance(e={},r=zt){const n=e.forkResourceStore;n&&delete e.forkResourceStore;const o={...this.options,...e,isClone:!0},a=new wt(o);if((e.debug!==void 0||e.prefix!==void 0)&&(a.logger=a.logger.clone(e)),["store","services","language"].forEach(s=>{a[s]=this[s]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},n){const s=Object.keys(this.store.data).reduce((l,c)=>(l[c]={...this.store.data[c]},l[c]=Object.keys(l[c]).reduce((u,d)=>(u[d]={...l[c][d]},u),l[c]),l),{});a.store=new Pn(s,o),a.services.resourceStore=a.store}return a.translator=new tr(a.services,o),a.translator.on("*",(s,...l)=>{a.emit(s,...l)}),a.init(o,r),a.translator.options=o,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const ge=wt.createInstance();ge.createInstance=wt.createInstance;ge.createInstance;ge.dir;ge.init;ge.loadResources;ge.reloadResources;ge.use;ge.changeLanguage;ge.getFixedT;const Zp=ge.t;ge.exists;ge.setDefaultNamespace;ge.hasLoadedNamespace;ge.loadNamespaces;ge.loadLanguages;var yr,Fn;function lc(){return Fn||(Fn=1,yr={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}),yr}var cc=lc();const uc=hl(cc);var dc=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function Vn(t){var e={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},r=t.match(/<\/?([^\s]+?)[/\s>]/);if(r&&(e.name=r[1],(uc[r[1]]||t.charAt(t.length-2)==="/")&&(e.voidElement=!0),e.name.startsWith("!--"))){var n=t.indexOf("-->");return{type:"comment",comment:n!==-1?t.slice(4,n):""}}for(var o=new RegExp(dc),a=null;(a=o.exec(t))!==null;)if(a[0].trim())if(a[1]){var i=a[1].trim(),s=[i,""];i.indexOf("=")>-1&&(s=i.split("=")),e.attrs[s[0]]=s[1],o.lastIndex--}else a[2]&&(e.attrs[a[2]]=a[3].trim().substring(1,a[3].length-1));return e}var fc=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,hc=/^\s*$/,pc=Object.create(null);function la(t,e){switch(e.type){case"text":return t+e.content;case"tag":return t+="<"+e.name+(e.attrs?(function(r){var n=[];for(var o in r)n.push(o+'="'+r[o]+'"');return n.length?" "+n.join(" "):""})(e.attrs):"")+(e.voidElement?"/>":">"),e.voidElement?t:t+e.children.reduce(la,"")+"</"+e.name+">";case"comment":return t+"<!--"+e.comment+"-->"}}var gc={parse:function(t,e){e||(e={}),e.components||(e.components=pc);var r,n=[],o=[],a=-1,i=!1;if(t.indexOf("<")!==0){var s=t.indexOf("<");n.push({type:"text",content:s===-1?t:t.substring(0,s)})}return t.replace(fc,function(l,c){if(i){if(l!=="</"+r.name+">")return;i=!1}var u,d=l.charAt(1)!=="/",h=l.startsWith("<!--"),f=c+l.length,m=t.charAt(f);if(h){var _=Vn(l);return a<0?(n.push(_),n):((u=o[a]).children.push(_),n)}if(d&&(a++,(r=Vn(l)).type==="tag"&&e.components[r.name]&&(r.type="component",i=!0),r.voidElement||i||!m||m==="<"||r.children.push({type:"text",content:t.slice(f,t.indexOf("<",f))}),a===0&&n.push(r),(u=o[a-1])&&u.children.push(r),o[a]=r),(!d||r.voidElement)&&(a>-1&&(r.voidElement||r.name===l.slice(2,-1))&&(a--,r=a===-1?n:o[a]),!i&&m!=="<"&&m)){u=a===-1?n:o[a].children;var N=t.indexOf("<",f),C=t.slice(f,N===-1?void 0:N);hc.test(C)&&(C=" "),(N>-1&&a+u.length>=0||C!==" ")&&u.push({type:"text",content:C})}}),n},stringify:function(t){return t.reduce(function(e,r){return e+la("",r)},"")}};const Gt=(t,e,r,n)=>{const o=[r,{code:e,...n||{}}];if(t?.services?.logger?.forward)return t.services.logger.forward(o,"warn","react-i18next::",!0);Ne(o[0])&&(o[0]=`react-i18next:: ${o[0]}`),t?.services?.logger?.warn?t.services.logger.warn(...o):console?.warn&&console.warn(...o)},Un={},sr=(t,e,r,n)=>{Ne(r)&&Un[r]||(Ne(r)&&(Un[r]=new Date),Gt(t,e,r,n))},ca=(t,e)=>()=>{if(t.isInitialized)e();else{const r=()=>{setTimeout(()=>{t.off("initialized",r)},0),e()};t.on("initialized",r)}},jr=(t,e,r)=>{t.loadNamespaces(e,ca(t,r))},$n=(t,e,r,n)=>{if(Ne(r)&&(r=[r]),t.options.preload&&t.options.preload.indexOf(e)>-1)return jr(t,r,n);r.forEach(o=>{t.options.ns.indexOf(o)<0&&t.options.ns.push(o)}),t.loadLanguages(e,ca(t,n))},mc=(t,e,r={})=>!e.languages||!e.languages.length?(sr(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(t,{lng:r.lng,precheck:(n,o)=>{if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&n.services.backendConnector.backend&&n.isLanguageChangingTo&&!o(n.isLanguageChangingTo,t))return!1}}),Ne=t=>typeof t=="string",Fe=t=>typeof t=="object"&&t!==null,vc=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Ec={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},yc=t=>Ec[t],_c=t=>t.replace(vc,yc);let Br={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:_c};const Cc=(t={})=>{Br={...Br,...t}},ua=()=>Br;let da;const Sc=t=>{da=t},tn=()=>da,_r=(t,e)=>{if(!t)return!1;const r=t.props?.children??t.children;return e?r.length>0:!!r},Cr=t=>{if(!t)return[];const e=t.props?.children??t.children;return t.props?.i18nIsDynamicList?ft(e):e},Nc=t=>Array.isArray(t)&&t.every(g.isValidElement),ft=t=>Array.isArray(t)?t:[t],bc=(t,e)=>{const r={...e};return r.props=Object.assign(t.props,e.props),r},fa=(t,e,r,n)=>{if(!t)return"";let o="";const a=ft(t),i=e?.transSupportBasicHtmlNodes?e.transKeepBasicHtmlNodesFor??[]:[];return a.forEach((s,l)=>{if(Ne(s)){o+=`${s}`;return}if(g.isValidElement(s)){const{props:c,type:u}=s,d=Object.keys(c).length,h=i.indexOf(u)>-1,f=c.children;if(!f&&h&&!d){o+=`<${u}/>`;return}if(!f&&(!h||d)||c.i18nIsDynamicList){o+=`<${l}></${l}>`;return}if(h&&d===1&&Ne(f)){o+=`<${u}>${f}</${u}>`;return}const m=fa(f,e,r,n);o+=`<${l}>${m}</${l}>`;return}if(s===null){Gt(r,"TRANS_NULL_VALUE","Passed in a null value as child",{i18nKey:n});return}if(Fe(s)){const{format:c,...u}=s,d=Object.keys(u);if(d.length===1){const h=c?`${d[0]}, ${c}`:d[0];o+=`{{${h}}}`;return}Gt(r,"TRANS_INVALID_OBJ","Invalid child - Object should only have keys {{ value, format }} (format is optional).",{i18nKey:n,child:s});return}Gt(r,"TRANS_INVALID_VAR","Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.",{i18nKey:n,child:s})}),o},Rc=(t,e=[],r={})=>{if(!t)return t;const n=Object.keys(r),o=[...e,...n];let a="",i=0;for(;i<t.length;)if(t[i]==="<"){let s=!1;const l=t.slice(i).match(/^<\/(\d+|[a-zA-Z][a-zA-Z0-9-]*)>/);if(l){const c=l[1];(/^\d+$/.test(c)||o.includes(c))&&(s=!0,a+=l[0],i+=l[0].length)}if(!s){const c=t.slice(i).match(/^<(\d+|[a-zA-Z][a-zA-Z0-9-]*)(\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s*(\/)?>/);if(c){const u=c[1];(/^\d+$/.test(u)||o.includes(u))&&(s=!0,a+=c[0],i+=c[0].length)}}s||(a+="<",i+=1)}else a+=t[i],i+=1;return a},xc=(t,e,r,n,o,a,i)=>{if(r==="")return[];const s=o.transKeepBasicHtmlNodesFor||[],l=r&&new RegExp(s.map(b=>`<${b}`).join("|")).test(r);if(!t&&!e&&!l&&!i)return[r];const c=e??{},u=b=>{ft(b).forEach(R=>{Ne(R)||(_r(R)?u(Cr(R)):Fe(R)&&!g.isValidElement(R)&&Object.assign(c,R))})};u(t);const d=Rc(r,s,c),h=gc.parse(`<0>${d}</0>`),f={...c,...a},m=(b,T,R)=>{const w=Cr(b),P=N(w,T.children,R);return Nc(w)&&P.length===0||b.props?.i18nIsDynamicList?w:P},_=(b,T,R,w,P)=>{b.dummy?(b.children=T,R.push(g.cloneElement(b,{key:w},P?void 0:T))):R.push(...g.Children.map([b],E=>{const D={...E.props};return delete D.i18nIsDynamicList,g.createElement(E.type,{...D,key:w,ref:E.props.ref??E.ref},P?null:T)}))},N=(b,T,R)=>{const w=ft(b);return ft(T).reduce((E,D,j)=>{const M=D.children?.[0]?.content&&n.services.interpolator.interpolate(D.children[0].content,f,n.language);if(D.type==="tag"){let $=w[parseInt(D.name,10)];!$&&e&&($=e[D.name]),R.length===1&&!$&&($=R[0][D.name]),$||($={});const F=Object.keys(D.attrs).length!==0?bc({props:D.attrs},$):$,G=g.isValidElement(F),J=G&&_r(D,!0)&&!D.voidElement,me=l&&Fe(F)&&F.dummy&&!G,de=Fe(e)&&Object.hasOwnProperty.call(e,D.name);if(Ne(F)){const Z=n.services.interpolator.interpolate(F,f,n.language);E.push(Z)}else if(_r(F)||J){const Z=m(F,D,R);_(F,Z,E,j)}else if(me){const Z=N(w,D.children,R);_(F,Z,E,j)}else if(Number.isNaN(parseFloat(D.name)))if(de){const Z=m(F,D,R);_(F,Z,E,j,D.voidElement)}else if(o.transSupportBasicHtmlNodes&&s.indexOf(D.name)>-1)if(D.voidElement)E.push(g.createElement(D.name,{key:`${D.name}-${j}`}));else{const Z=N(w,D.children,R);E.push(g.createElement(D.name,{key:`${D.name}-${j}`},Z))}else if(D.voidElement)E.push(`<${D.name} />`);else{const Z=N(w,D.children,R);E.push(`<${D.name}>${Z}</${D.name}>`)}else if(Fe(F)&&!G){const Z=D.children[0]?M:null;Z&&E.push(Z)}else _(F,M,E,j,D.children.length!==1||!M)}else if(D.type==="text"){const $=o.transWrapTextNodes,F=i?o.unescape(n.services.interpolator.interpolate(D.content,f,n.language)):n.services.interpolator.interpolate(D.content,f,n.language);$?E.push(g.createElement($,{key:`${D.name}-${j}`},F)):E.push(F)}return E},[])},C=N([{dummy:!0,children:t||[]}],h,ft(t||[]));return Cr(C[0])},ha=(t,e,r)=>{const n=t.key||e,o=g.cloneElement(t,{key:n});if(!o.props||!o.props.children||r.indexOf(`${e}/>`)<0&&r.indexOf(`${e} />`)<0)return o;function a(){return g.createElement(g.Fragment,null,o)}return g.createElement(a,{key:n})},Dc=(t,e)=>t.map((r,n)=>ha(r,n,e)),wc=(t,e)=>{const r={};return Object.keys(t).forEach(n=>{Object.assign(r,{[n]:ha(t[n],n,e)})}),r},Oc=(t,e,r,n)=>t?Array.isArray(t)?Dc(t,e):Fe(t)?wc(t,e):(sr(r,"TRANS_INVALID_COMPONENTS",'<Trans /> "components" prop expects an object or array',{i18nKey:n}),null):null,Lc=t=>!Fe(t)||Array.isArray(t)?!1:Object.keys(t).reduce((e,r)=>e&&Number.isNaN(Number.parseFloat(r)),!0);function Pc({children:t,count:e,parent:r,i18nKey:n,context:o,tOptions:a={},values:i,defaults:s,components:l,ns:c,i18n:u,t:d,shouldUnescape:h,...f}){const m=u||tn();if(!m)return sr(m,"NO_I18NEXT_INSTANCE","Trans: You need to pass in an i18next instance using i18nextReactModule",{i18nKey:n}),t;const _=d||m.t.bind(m)||(J=>J),N={...ua(),...m.options?.react};let C=c||_.ns||m.options?.defaultNS;C=Ne(C)?[C]:C||["translation"];const b=fa(t,N,m,n),T=s||a?.defaultValue||b||N.transEmptyNodeValue||(typeof n=="function"?er(n):n),{hashTransKey:R}=N,w=n||(R?R(b||T):b||T);m.options?.interpolation?.defaultVariables&&(i=i&&Object.keys(i).length>0?{...i,...m.options.interpolation.defaultVariables}:{...m.options.interpolation.defaultVariables});const P=i||e!==void 0&&!m.options?.interpolation?.alwaysFormat||!t?a.interpolation:{interpolation:{...a.interpolation,prefix:"#$?",suffix:"?$#"}},E={...a,context:o||a.context,count:e,...i,...P,defaultValue:s||a?.defaultValue,ns:C};let D=w?_(w,E):T;D===w&&T&&(D=T);const j=Oc(l,D,m,n);let M=j||t,$=null;Lc(j)&&($=j,M=t);const F=xc(M,$,D,m,N,E,h),G=r??N.defaultTransParent;return G?g.createElement(G,f,F):F}const Ac={type:"3rdParty",init(t){Cc(t.options.react),Sc(t)}},pa=g.createContext();class Tc{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}function Ic({children:t,count:e,parent:r,i18nKey:n,context:o,tOptions:a={},values:i,defaults:s,components:l,ns:c,i18n:u,t:d,shouldUnescape:h,...f}){const{i18n:m,defaultNS:_}=g.useContext(pa)||{},N=u||m||tn(),C=d||N?.t.bind(N);return Pc({children:t,count:e,parent:r,i18nKey:n,context:o,tOptions:a,values:i,defaults:s,components:l,ns:c||C?.ns||_||N?.options?.defaultNS,i18n:N,t:d,shouldUnescape:h,...f})}var Sr={exports:{}},Nr={};var zn;function kc(){if(zn)return Nr;zn=1;var t=pl();function e(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var r=typeof Object.is=="function"?Object.is:e,n=t.useState,o=t.useEffect,a=t.useLayoutEffect,i=t.useDebugValue;function s(d,h){var f=h(),m=n({inst:{value:f,getSnapshot:h}}),_=m[0].inst,N=m[1];return a(function(){_.value=f,_.getSnapshot=h,l(_)&&N({inst:_})},[d,f,h]),o(function(){return l(_)&&N({inst:_}),d(function(){l(_)&&N({inst:_})})},[d]),i(f),f}function l(d){var h=d.getSnapshot;d=d.value;try{var f=h();return!r(d,f)}catch{return!0}}function c(d,h){return h()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:s;return Nr.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,Nr}var Kn;function Mc(){return Kn||(Kn=1,Sr.exports=kc()),Sr.exports}var Hc=Mc();const jc=(t,e)=>Ne(e)?e:Fe(e)&&Ne(e.defaultValue)?e.defaultValue:Array.isArray(t)?t[t.length-1]:t,Bc={t:jc,ready:!1},Fc=()=>()=>{},ga=(t,e={})=>{const{i18n:r}=e,{i18n:n,defaultNS:o}=g.useContext(pa)||{},a=r||n||tn();a&&!a.reportNamespaces&&(a.reportNamespaces=new Tc),a||sr(a,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const i=g.useMemo(()=>({...ua(),...a?.options?.react,...e}),[a,e]),{useSuspense:s,keyPrefix:l}=i,c=g.useMemo(()=>{const R=o||a?.options?.defaultNS;return Ne(R)?[R]:R||["translation"]},[t,o,a]);a?.reportNamespaces?.addUsedNamespaces?.(c);const u=g.useRef(0),d=g.useCallback(R=>{if(!a)return Fc;const{bindI18n:w,bindI18nStore:P}=i,E=()=>{u.current+=1,R()};return w&&a.on(w,E),P&&a.store.on(P,E),()=>{w&&w.split(" ").forEach(D=>a.off(D,E)),P&&P.split(" ").forEach(D=>a.store.off(D,E))}},[a,i]),h=g.useRef(),f=g.useCallback(()=>{if(!a)return Bc;const R=!!(a.isInitialized||a.initializedStoreOnce)&&c.every(M=>mc(M,a,i)),w=e.lng||a.language,P=u.current,E=h.current;if(E&&E.ready===R&&E.lng===w&&E.keyPrefix===l&&E.revision===P)return E;const j={t:a.getFixedT(w,i.nsMode==="fallback"?c:c[0],l),ready:R,lng:w,keyPrefix:l,revision:P};return h.current=j,j},[a,c,l,i,e.lng]),[m,_]=g.useState(0),{t:N,ready:C}=Hc.useSyncExternalStore(d,f,f);g.useEffect(()=>{if(a&&!C&&!s){const R=()=>_(w=>w+1);e.lng?$n(a,e.lng,c,R):jr(a,c,R)}},[a,e.lng,c,C,s,m]);const b=a||{},T=g.useMemo(()=>{const R=[N,b,C];return R.t=N,R.i18n=b,R.ready=C,R},[N,b,C]);if(a&&s&&!C)throw new Promise(R=>{const w=()=>R();e.lng?$n(a,e.lng,c,w):jr(a,c,w)});return T},Vc=()=>{const{t}=ga();return y.jsxs("div",{children:[y.jsx("p",{className:"font-medium",children:t("notifications.reloadApp")}),y.jsxs("button",{onClick:()=>location.reload(),className:"underline decoration-solid underline-offset-2",children:[t("common.reloadConnect")," 🔄"]})]})},Uc=()=>{async function t(){const e=await Yd();if(e!==null){if(e.isLatest||e.currentVersion.includes("-"))return!0;se.studioMode||!se.warnOutdatedApp?Y.warn(`Connect is outdated:
|
|
3
|
+
Current: ${e.currentVersion}
|
|
4
|
+
Latest: ${e.latestVersion}`):en(g.createElement(Vc),{type:"connect-warning",toastId:"outdated-app",autoClose:!1})}}g.useEffect(()=>{t().catch(console.error)},[])},$c=se.routerBasename,ma=`${$c}:display-cookie-banner`,Wn=new Set;let va=zc();function zc(){try{return localStorage.getItem(ma)!=="false"}catch(t){return console.error(t),!0}}function Yn(){return va}function Kc(t){va=t,localStorage.setItem(ma,JSON.stringify(t))}function Wc(t){return Wn.add(t),()=>Wn.delete(t)}const Yc=()=>[g.useSyncExternalStore(Wc,Yn,Yn),Kc];function ne(){return ne=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},ne.apply(this,arguments)}var ue;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(ue||(ue={}));const Gn="popstate";function Gc(t){t===void 0&&(t={});function e(n,o){let{pathname:a,search:i,hash:s}=n.location;return Ot("",{pathname:a,search:i,hash:s},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function r(n,o){return typeof o=="string"?o:Tt(o)}return Xc(e,r,null,t)}function K(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function pt(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function Jc(){return Math.random().toString(36).substr(2,8)}function Jn(t,e){return{usr:t.state,key:t.key,idx:e}}function Ot(t,e,r,n){return r===void 0&&(r=null),ne({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Ke(e):e,{state:r,key:e&&e.key||n||Jc()})}function Tt(t){let{pathname:e="/",search:r="",hash:n=""}=t;return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Ke(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));let n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function Xc(t,e,r,n){n===void 0&&(n={});let{window:o=document.defaultView,v5Compat:a=!1}=n,i=o.history,s=ue.Pop,l=null,c=u();c==null&&(c=0,i.replaceState(ne({},i.state,{idx:c}),""));function u(){return(i.state||{idx:null}).idx}function d(){s=ue.Pop;let N=u(),C=N==null?null:N-c;c=N,l&&l({action:s,location:_.location,delta:C})}function h(N,C){s=ue.Push;let b=Ot(_.location,N,C);c=u()+1;let T=Jn(b,c),R=_.createHref(b);try{i.pushState(T,"",R)}catch(w){if(w instanceof DOMException&&w.name==="DataCloneError")throw w;o.location.assign(R)}a&&l&&l({action:s,location:_.location,delta:1})}function f(N,C){s=ue.Replace;let b=Ot(_.location,N,C);c=u();let T=Jn(b,c),R=_.createHref(b);i.replaceState(T,"",R),a&&l&&l({action:s,location:_.location,delta:0})}function m(N){let C=o.location.origin!=="null"?o.location.origin:o.location.href,b=typeof N=="string"?N:Tt(N);return b=b.replace(/ $/,"%20"),K(C,"No window.location.(origin|href) available to create URL for href: "+b),new URL(b,C)}let _={get action(){return s},get location(){return t(o,i)},listen(N){if(l)throw new Error("A history only accepts one active listener");return o.addEventListener(Gn,d),l=N,()=>{o.removeEventListener(Gn,d),l=null}},createHref(N){return e(o,N)},createURL:m,encodeLocation(N){let C=m(N);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:h,replace:f,go(N){return i.go(N)}};return _}var Q;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Q||(Q={}));const qc=new Set(["lazy","caseSensitive","path","id","index","children"]);function Zc(t){return t.index===!0}function rr(t,e,r,n){return r===void 0&&(r=[]),n===void 0&&(n={}),t.map((o,a)=>{let i=[...r,String(a)],s=typeof o.id=="string"?o.id:i.join("-");if(K(o.index!==!0||!o.children,"Cannot specify children on an index route"),K(!n[s],'Found a route id collision on id "'+s+`". Route id's must be globally unique within Data Router usages`),Zc(o)){let l=ne({},o,e(o),{id:s});return n[s]=l,l}else{let l=ne({},o,e(o),{id:s,children:void 0});return n[s]=l,o.children&&(l.children=rr(o.children,e,i,n)),l}})}function je(t,e,r){return r===void 0&&(r="/"),Jt(t,e,r,!1)}function Jt(t,e,r,n){let o=typeof e=="string"?Ke(e):e,a=It(o.pathname||"/",r);if(a==null)return null;let i=Ea(t);eu(i);let s=null;for(let l=0;s==null&&l<i.length;++l){let c=du(a);s=cu(i[l],c,n)}return s}function Qc(t,e){let{route:r,pathname:n,params:o}=t;return{id:r.id,pathname:n,params:o,data:e[r.id],handle:r.handle}}function Ea(t,e,r,n){e===void 0&&(e=[]),r===void 0&&(r=[]),n===void 0&&(n="");let o=(a,i,s)=>{let l={relativePath:s===void 0?a.path||"":s,caseSensitive:a.caseSensitive===!0,childrenIndex:i,route:a};l.relativePath.startsWith("/")&&(K(l.relativePath.startsWith(n),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(n.length));let c=ze([n,l.relativePath]),u=r.concat(l);a.children&&a.children.length>0&&(K(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),Ea(a.children,e,u,c)),!(a.path==null&&!a.index)&&e.push({path:c,score:su(c,a.index),routesMeta:u})};return t.forEach((a,i)=>{var s;if(a.path===""||!((s=a.path)!=null&&s.includes("?")))o(a,i);else for(let l of ya(a.path))o(a,i,l)}),e}function ya(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,o=r.endsWith("?"),a=r.replace(/\?$/,"");if(n.length===0)return o?[a,""]:[a];let i=ya(n.join("/")),s=[];return s.push(...i.map(l=>l===""?a:[a,l].join("/"))),o&&s.push(...i),s.map(l=>t.startsWith("/")&&l===""?"/":l)}function eu(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:lu(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const tu=/^:[\w-]+$/,ru=3,nu=2,ou=1,au=10,iu=-2,Xn=t=>t==="*";function su(t,e){let r=t.split("/"),n=r.length;return r.some(Xn)&&(n+=iu),e&&(n+=nu),r.filter(o=>!Xn(o)).reduce((o,a)=>o+(tu.test(a)?ru:a===""?ou:au),n)}function lu(t,e){return t.length===e.length&&t.slice(0,-1).every((n,o)=>n===e[o])?t[t.length-1]-e[e.length-1]:0}function cu(t,e,r){r===void 0&&(r=!1);let{routesMeta:n}=t,o={},a="/",i=[];for(let s=0;s<n.length;++s){let l=n[s],c=s===n.length-1,u=a==="/"?e:e.slice(a.length)||"/",d=qn({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},u),h=l.route;if(!d&&c&&r&&!n[n.length-1].route.index&&(d=qn({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},u)),!d)return null;Object.assign(o,d.params),i.push({params:o,pathname:ze([a,d.pathname]),pathnameBase:pu(ze([a,d.pathnameBase])),route:h}),d.pathnameBase!=="/"&&(a=ze([a,d.pathnameBase]))}return i}function qn(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[r,n]=uu(t.path,t.caseSensitive,t.end),o=e.match(r);if(!o)return null;let a=o[0],i=a.replace(/(.)\/+$/,"$1"),s=o.slice(1);return{params:n.reduce((c,u,d)=>{let{paramName:h,isOptional:f}=u;if(h==="*"){let _=s[d]||"";i=a.slice(0,a.length-_.length).replace(/(.)\/+$/,"$1")}const m=s[d];return f&&!m?c[h]=void 0:c[h]=(m||"").replace(/%2F/g,"/"),c},{}),pathname:a,pathnameBase:i,pattern:t}}function uu(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),pt(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let n=[],o="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,s,l)=>(n.push({paramName:s,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),o+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":t!==""&&t!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,e?void 0:"i"),n]}function du(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return pt(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function It(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,n=t.charAt(r);return n&&n!=="/"?null:t.slice(r)||"/"}function fu(t,e){e===void 0&&(e="/");let{pathname:r,search:n="",hash:o=""}=typeof t=="string"?Ke(t):t;return{pathname:r?r.startsWith("/")?r:hu(r,e):e,search:gu(n),hash:mu(o)}}function hu(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(o=>{o===".."?r.length>1&&r.pop():o!=="."&&r.push(o)}),r.length>1?r.join("/"):"/"}function br(t,e,r,n){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function _a(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function Ca(t,e){let r=_a(t);return e?r.map((n,o)=>o===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function Sa(t,e,r,n){n===void 0&&(n=!1);let o;typeof t=="string"?o=Ke(t):(o=ne({},t),K(!o.pathname||!o.pathname.includes("?"),br("?","pathname","search",o)),K(!o.pathname||!o.pathname.includes("#"),br("#","pathname","hash",o)),K(!o.search||!o.search.includes("#"),br("#","search","hash",o)));let a=t===""||o.pathname==="",i=a?"/":o.pathname,s;if(i==null)s=r;else{let d=e.length-1;if(!n&&i.startsWith("..")){let h=i.split("/");for(;h[0]==="..";)h.shift(),d-=1;o.pathname=h.join("/")}s=d>=0?e[d]:"/"}let l=fu(o,s),c=i&&i!=="/"&&i.endsWith("/"),u=(a||i===".")&&r.endsWith("/");return!l.pathname.endsWith("/")&&(c||u)&&(l.pathname+="/"),l}const ze=t=>t.join("/").replace(/\/\/+/g,"/"),pu=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),gu=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,mu=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;class nr{constructor(e,r,n,o){o===void 0&&(o=!1),this.status=e,this.statusText=r||"",this.internal=o,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}}function Lt(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const Na=["post","put","patch","delete"],vu=new Set(Na),Eu=["get",...Na],yu=new Set(Eu),_u=new Set([301,302,303,307,308]),Cu=new Set([307,308]),Rr={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Su={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},_t={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},rn=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Nu=t=>({hasErrorBoundary:!!t.hasErrorBoundary}),ba="remix-router-transitions";function bu(t){const e=t.window?t.window:typeof window<"u"?window:void 0,r=typeof e<"u"&&typeof e.document<"u"&&typeof e.document.createElement<"u",n=!r;K(t.routes.length>0,"You must provide a non-empty routes array to createRouter");let o;if(t.mapRouteProperties)o=t.mapRouteProperties;else if(t.detectErrorBoundary){let p=t.detectErrorBoundary;o=v=>({hasErrorBoundary:p(v)})}else o=Nu;let a={},i=rr(t.routes,o,void 0,a),s,l=t.basename||"/",c=t.dataStrategy||wu,u=t.patchRoutesOnNavigation,d=ne({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},t.future),h=null,f=new Set,m=null,_=null,N=null,C=t.hydrationData!=null,b=je(i,t.history.location,l),T=!1,R=null;if(b==null&&!u){let p=Ee(404,{pathname:t.history.location.pathname}),{matches:v,route:S}=lo(i);b=v,R={[S.id]:p}}b&&!t.hydrationData&&jt(b,i,t.history.location.pathname).active&&(b=null);let w;if(b)if(b.some(p=>p.route.lazy))w=!1;else if(!b.some(p=>p.route.loader))w=!0;else if(d.v7_partialHydration){let p=t.hydrationData?t.hydrationData.loaderData:null,v=t.hydrationData?t.hydrationData.errors:null;if(v){let S=b.findIndex(x=>v[x.route.id]!==void 0);w=b.slice(0,S+1).every(x=>!Vr(x.route,p,v))}else w=b.every(S=>!Vr(S.route,p,v))}else w=t.hydrationData!=null;else if(w=!1,b=[],d.v7_partialHydration){let p=jt(null,i,t.history.location.pathname);p.active&&p.matches&&(T=!0,b=p.matches)}let P,E={historyAction:t.history.action,location:t.history.location,matches:b,initialized:w,navigation:Rr,restoreScrollPosition:t.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:t.hydrationData&&t.hydrationData.loaderData||{},actionData:t.hydrationData&&t.hydrationData.actionData||null,errors:t.hydrationData&&t.hydrationData.errors||R,fetchers:new Map,blockers:new Map},D=ue.Pop,j=!1,M,$=!1,F=new Map,G=null,J=!1,me=!1,de=[],Z=new Set,re=new Map,we=0,Te=-1,le=new Map,fe=new Set,_e=new Map,Ie=new Map,be=new Set,Ge=new Map,Je=new Map,kt;function si(){if(h=t.history.listen(p=>{let{action:v,location:S,delta:x}=p;if(kt){kt(),kt=void 0;return}pt(Je.size===0||x!=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 L=yn({currentLocation:E.location,nextLocation:S,historyAction:v});if(L&&x!=null){let B=new Promise(V=>{kt=V});t.history.go(x*-1),Ht(L,{state:"blocked",location:S,proceed(){Ht(L,{state:"proceeding",proceed:void 0,reset:void 0,location:S}),B.then(()=>t.history.go(x))},reset(){let V=new Map(E.blockers);V.set(L,_t),ve({blockers:V})}});return}return Xe(v,S)}),r){Uu(e,F);let p=()=>$u(e,F);e.addEventListener("pagehide",p),G=()=>e.removeEventListener("pagehide",p)}return E.initialized||Xe(ue.Pop,E.location,{initialHydration:!0}),P}function li(){h&&h(),G&&G(),f.clear(),M&&M.abort(),E.fetchers.forEach((p,v)=>Mt(v)),E.blockers.forEach((p,v)=>En(v))}function ci(p){return f.add(p),()=>f.delete(p)}function ve(p,v){v===void 0&&(v={}),E=ne({},E,p);let S=[],x=[];d.v7_fetcherPersist&&E.fetchers.forEach((L,B)=>{L.state==="idle"&&(be.has(B)?x.push(B):S.push(B))}),be.forEach(L=>{!E.fetchers.has(L)&&!re.has(L)&&x.push(L)}),[...f].forEach(L=>L(E,{deletedFetchers:x,viewTransitionOpts:v.viewTransitionOpts,flushSync:v.flushSync===!0})),d.v7_fetcherPersist?(S.forEach(L=>E.fetchers.delete(L)),x.forEach(L=>Mt(L))):x.forEach(L=>be.delete(L))}function rt(p,v,S){var x,L;let{flushSync:B}=S===void 0?{}:S,V=E.actionData!=null&&E.navigation.formMethod!=null&&Re(E.navigation.formMethod)&&E.navigation.state==="loading"&&((x=p.state)==null?void 0:x._isRedirect)!==!0,I;v.actionData?Object.keys(v.actionData).length>0?I=v.actionData:I=null:V?I=E.actionData:I=null;let k=v.loaderData?io(E.loaderData,v.loaderData,v.matches||[],v.errors):E.loaderData,A=E.blockers;A.size>0&&(A=new Map(A),A.forEach((W,he)=>A.set(he,_t)));let H=j===!0||E.navigation.formMethod!=null&&Re(E.navigation.formMethod)&&((L=p.state)==null?void 0:L._isRedirect)!==!0;s&&(i=s,s=void 0),J||D===ue.Pop||(D===ue.Push?t.history.push(p,p.state):D===ue.Replace&&t.history.replace(p,p.state));let z;if(D===ue.Pop){let W=F.get(E.location.pathname);W&&W.has(p.pathname)?z={currentLocation:E.location,nextLocation:p}:F.has(p.pathname)&&(z={currentLocation:p,nextLocation:E.location})}else if($){let W=F.get(E.location.pathname);W?W.add(p.pathname):(W=new Set([p.pathname]),F.set(E.location.pathname,W)),z={currentLocation:E.location,nextLocation:p}}ve(ne({},v,{actionData:I,loaderData:k,historyAction:D,location:p,initialized:!0,navigation:Rr,revalidation:"idle",restoreScrollPosition:Cn(p,v.matches||E.matches),preventScrollReset:H,blockers:A}),{viewTransitionOpts:z,flushSync:B===!0}),D=ue.Pop,j=!1,$=!1,J=!1,me=!1,de=[]}async function dn(p,v){if(typeof p=="number"){t.history.go(p);return}let S=Fr(E.location,E.matches,l,d.v7_prependBasename,p,d.v7_relativeSplatPath,v?.fromRouteId,v?.relative),{path:x,submission:L,error:B}=Zn(d.v7_normalizeFormMethod,!1,S,v),V=E.location,I=Ot(E.location,x,v&&v.state);I=ne({},I,t.history.encodeLocation(I));let k=v&&v.replace!=null?v.replace:void 0,A=ue.Push;k===!0?A=ue.Replace:k===!1||L!=null&&Re(L.formMethod)&&L.formAction===E.location.pathname+E.location.search&&(A=ue.Replace);let H=v&&"preventScrollReset"in v?v.preventScrollReset===!0:void 0,z=(v&&v.flushSync)===!0,W=yn({currentLocation:V,nextLocation:I,historyAction:A});if(W){Ht(W,{state:"blocked",location:I,proceed(){Ht(W,{state:"proceeding",proceed:void 0,reset:void 0,location:I}),dn(p,v)},reset(){let he=new Map(E.blockers);he.set(W,_t),ve({blockers:he})}});return}return await Xe(A,I,{submission:L,pendingError:B,preventScrollReset:H,replace:v&&v.replace,enableViewTransition:v&&v.viewTransition,flushSync:z})}function ui(){if(hr(),ve({revalidation:"loading"}),E.navigation.state!=="submitting"){if(E.navigation.state==="idle"){Xe(E.historyAction,E.location,{startUninterruptedRevalidation:!0});return}Xe(D||E.historyAction,E.navigation.location,{overrideNavigation:E.navigation,enableViewTransition:$===!0})}}async function Xe(p,v,S){M&&M.abort(),M=null,D=p,J=(S&&S.startUninterruptedRevalidation)===!0,_i(E.location,E.matches),j=(S&&S.preventScrollReset)===!0,$=(S&&S.enableViewTransition)===!0;let x=s||i,L=S&&S.overrideNavigation,B=S!=null&&S.initialHydration&&E.matches&&E.matches.length>0&&!T?E.matches:je(x,v,l),V=(S&&S.flushSync)===!0;if(B&&E.initialized&&!me&&Iu(E.location,v)&&!(S&&S.submission&&Re(S.submission.formMethod))){rt(v,{matches:B},{flushSync:V});return}let I=jt(B,x,v.pathname);if(I.active&&I.matches&&(B=I.matches),!B){let{error:te,notFoundMatches:q,route:oe}=pr(v.pathname);rt(v,{matches:q,loaderData:{},errors:{[oe.id]:te}},{flushSync:V});return}M=new AbortController;let k=lt(t.history,v,M.signal,S&&S.submission),A;if(S&&S.pendingError)A=[et(B).route.id,{type:Q.error,error:S.pendingError}];else if(S&&S.submission&&Re(S.submission.formMethod)){let te=await di(k,v,S.submission,B,I.active,{replace:S.replace,flushSync:V});if(te.shortCircuited)return;if(te.pendingActionResult){let[q,oe]=te.pendingActionResult;if(ye(oe)&&Lt(oe.error)&&oe.error.status===404){M=null,rt(v,{matches:te.matches,loaderData:{},errors:{[q]:oe.error}});return}}B=te.matches||B,A=te.pendingActionResult,L=xr(v,S.submission),V=!1,I.active=!1,k=lt(t.history,k.url,k.signal)}let{shortCircuited:H,matches:z,loaderData:W,errors:he}=await fi(k,v,B,I.active,L,S&&S.submission,S&&S.fetcherSubmission,S&&S.replace,S&&S.initialHydration===!0,V,A);H||(M=null,rt(v,ne({matches:z||B},so(A),{loaderData:W,errors:he})))}async function di(p,v,S,x,L,B){B===void 0&&(B={}),hr();let V=Fu(v,S);if(ve({navigation:V},{flushSync:B.flushSync===!0}),L){let A=await Bt(x,v.pathname,p.signal);if(A.type==="aborted")return{shortCircuited:!0};if(A.type==="error"){let H=et(A.partialMatches).route.id;return{matches:A.partialMatches,pendingActionResult:[H,{type:Q.error,error:A.error}]}}else if(A.matches)x=A.matches;else{let{notFoundMatches:H,error:z,route:W}=pr(v.pathname);return{matches:H,pendingActionResult:[W.id,{type:Q.error,error:z}]}}}let I,k=bt(x,v);if(!k.route.action&&!k.route.lazy)I={type:Q.error,error:Ee(405,{method:p.method,pathname:v.pathname,routeId:k.route.id})};else if(I=(await gt("action",E,p,[k],x,null))[k.route.id],p.signal.aborted)return{shortCircuited:!0};if(tt(I)){let A;return B&&B.replace!=null?A=B.replace:A=no(I.response.headers.get("Location"),new URL(p.url),l)===E.location.pathname+E.location.search,await qe(p,I,!0,{submission:S,replace:A}),{shortCircuited:!0}}if(Ve(I))throw Ee(400,{type:"defer-action"});if(ye(I)){let A=et(x,k.route.id);return(B&&B.replace)!==!0&&(D=ue.Push),{matches:x,pendingActionResult:[A.route.id,I]}}return{matches:x,pendingActionResult:[k.route.id,I]}}async function fi(p,v,S,x,L,B,V,I,k,A,H){let z=L||xr(v,B),W=B||V||uo(z),he=!J&&(!d.v7_partialHydration||!k);if(x){if(he){let ae=fn(H);ve(ne({navigation:z},ae!==void 0?{actionData:ae}:{}),{flushSync:A})}let X=await Bt(S,v.pathname,p.signal);if(X.type==="aborted")return{shortCircuited:!0};if(X.type==="error"){let ae=et(X.partialMatches).route.id;return{matches:X.partialMatches,loaderData:{},errors:{[ae]:X.error}}}else if(X.matches)S=X.matches;else{let{error:ae,notFoundMatches:ot,route:Et}=pr(v.pathname);return{matches:ot,loaderData:{},errors:{[Et.id]:ae}}}}let te=s||i,[q,oe]=eo(t.history,E,S,W,v,d.v7_partialHydration&&k===!0,d.v7_skipActionErrorRevalidation,me,de,Z,be,_e,fe,te,l,H);if(gr(X=>!(S&&S.some(ae=>ae.route.id===X))||q&&q.some(ae=>ae.route.id===X)),Te=++we,q.length===0&&oe.length===0){let X=mn();return rt(v,ne({matches:S,loaderData:{},errors:H&&ye(H[1])?{[H[0]]:H[1].error}:null},so(H),X?{fetchers:new Map(E.fetchers)}:{}),{flushSync:A}),{shortCircuited:!0}}if(he){let X={};if(!x){X.navigation=z;let ae=fn(H);ae!==void 0&&(X.actionData=ae)}oe.length>0&&(X.fetchers=hi(oe)),ve(X,{flushSync:A})}oe.forEach(X=>{Me(X.key),X.controller&&re.set(X.key,X.controller)});let nt=()=>oe.forEach(X=>Me(X.key));M&&M.signal.addEventListener("abort",nt);let{loaderResults:mt,fetcherResults:Le}=await hn(E,S,q,oe,p);if(p.signal.aborted)return{shortCircuited:!0};M&&M.signal.removeEventListener("abort",nt),oe.forEach(X=>re.delete(X.key));let xe=Kt(mt);if(xe)return await qe(p,xe.result,!0,{replace:I}),{shortCircuited:!0};if(xe=Kt(Le),xe)return fe.add(xe.key),await qe(p,xe.result,!0,{replace:I}),{shortCircuited:!0};let{loaderData:mr,errors:vt}=ao(E,S,mt,H,oe,Le,Ge);Ge.forEach((X,ae)=>{X.subscribe(ot=>{(ot||X.done)&&Ge.delete(ae)})}),d.v7_partialHydration&&k&&E.errors&&(vt=ne({},E.errors,vt));let Ze=mn(),Ft=vn(Te),Vt=Ze||Ft||oe.length>0;return ne({matches:S,loaderData:mr,errors:vt},Vt?{fetchers:new Map(E.fetchers)}:{})}function fn(p){if(p&&!ye(p[1]))return{[p[0]]:p[1].data};if(E.actionData)return Object.keys(E.actionData).length===0?null:E.actionData}function hi(p){return p.forEach(v=>{let S=E.fetchers.get(v.key),x=Ct(void 0,S?S.data:void 0);E.fetchers.set(v.key,x)}),new Map(E.fetchers)}function pi(p,v,S,x){if(n)throw new 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.");Me(p);let L=(x&&x.flushSync)===!0,B=s||i,V=Fr(E.location,E.matches,l,d.v7_prependBasename,S,d.v7_relativeSplatPath,v,x?.relative),I=je(B,V,l),k=jt(I,B,V);if(k.active&&k.matches&&(I=k.matches),!I){Oe(p,v,Ee(404,{pathname:V}),{flushSync:L});return}let{path:A,submission:H,error:z}=Zn(d.v7_normalizeFormMethod,!0,V,x);if(z){Oe(p,v,z,{flushSync:L});return}let W=bt(I,A),he=(x&&x.preventScrollReset)===!0;if(H&&Re(H.formMethod)){gi(p,v,A,W,I,k.active,L,he,H);return}_e.set(p,{routeId:v,path:A}),mi(p,v,A,W,I,k.active,L,he,H)}async function gi(p,v,S,x,L,B,V,I,k){hr(),_e.delete(p);function A(ce){if(!ce.route.action&&!ce.route.lazy){let at=Ee(405,{method:k.formMethod,pathname:S,routeId:v});return Oe(p,v,at,{flushSync:V}),!0}return!1}if(!B&&A(x))return;let H=E.fetchers.get(p);ke(p,Vu(k,H),{flushSync:V});let z=new AbortController,W=lt(t.history,S,z.signal,k);if(B){let ce=await Bt(L,new URL(W.url).pathname,W.signal,p);if(ce.type==="aborted")return;if(ce.type==="error"){Oe(p,v,ce.error,{flushSync:V});return}else if(ce.matches){if(L=ce.matches,x=bt(L,S),A(x))return}else{Oe(p,v,Ee(404,{pathname:S}),{flushSync:V});return}}re.set(p,z);let he=we,q=(await gt("action",E,W,[x],L,p))[x.route.id];if(W.signal.aborted){re.get(p)===z&&re.delete(p);return}if(d.v7_fetcherPersist&&be.has(p)){if(tt(q)||ye(q)){ke(p,He(void 0));return}}else{if(tt(q))if(re.delete(p),Te>he){ke(p,He(void 0));return}else return fe.add(p),ke(p,Ct(k)),qe(W,q,!1,{fetcherSubmission:k,preventScrollReset:I});if(ye(q)){Oe(p,v,q.error);return}}if(Ve(q))throw Ee(400,{type:"defer-action"});let oe=E.navigation.location||E.location,nt=lt(t.history,oe,z.signal),mt=s||i,Le=E.navigation.state!=="idle"?je(mt,E.navigation.location,l):E.matches;K(Le,"Didn't find any matches after fetcher action");let xe=++we;le.set(p,xe);let mr=Ct(k,q.data);E.fetchers.set(p,mr);let[vt,Ze]=eo(t.history,E,Le,k,oe,!1,d.v7_skipActionErrorRevalidation,me,de,Z,be,_e,fe,mt,l,[x.route.id,q]);Ze.filter(ce=>ce.key!==p).forEach(ce=>{let at=ce.key,Sn=E.fetchers.get(at),Ni=Ct(void 0,Sn?Sn.data:void 0);E.fetchers.set(at,Ni),Me(at),ce.controller&&re.set(at,ce.controller)}),ve({fetchers:new Map(E.fetchers)});let Ft=()=>Ze.forEach(ce=>Me(ce.key));z.signal.addEventListener("abort",Ft);let{loaderResults:Vt,fetcherResults:X}=await hn(E,Le,vt,Ze,nt);if(z.signal.aborted)return;z.signal.removeEventListener("abort",Ft),le.delete(p),re.delete(p),Ze.forEach(ce=>re.delete(ce.key));let ae=Kt(Vt);if(ae)return qe(nt,ae.result,!1,{preventScrollReset:I});if(ae=Kt(X),ae)return fe.add(ae.key),qe(nt,ae.result,!1,{preventScrollReset:I});let{loaderData:ot,errors:Et}=ao(E,Le,Vt,void 0,Ze,X,Ge);if(E.fetchers.has(p)){let ce=He(q.data);E.fetchers.set(p,ce)}vn(xe),E.navigation.state==="loading"&&xe>Te?(K(D,"Expected pending action"),M&&M.abort(),rt(E.navigation.location,{matches:Le,loaderData:ot,errors:Et,fetchers:new Map(E.fetchers)})):(ve({errors:Et,loaderData:io(E.loaderData,ot,Le,Et),fetchers:new Map(E.fetchers)}),me=!1)}async function mi(p,v,S,x,L,B,V,I,k){let A=E.fetchers.get(p);ke(p,Ct(k,A?A.data:void 0),{flushSync:V});let H=new AbortController,z=lt(t.history,S,H.signal);if(B){let q=await Bt(L,new URL(z.url).pathname,z.signal,p);if(q.type==="aborted")return;if(q.type==="error"){Oe(p,v,q.error,{flushSync:V});return}else if(q.matches)L=q.matches,x=bt(L,S);else{Oe(p,v,Ee(404,{pathname:S}),{flushSync:V});return}}re.set(p,H);let W=we,te=(await gt("loader",E,z,[x],L,p))[x.route.id];if(Ve(te)&&(te=await nn(te,z.signal,!0)||te),re.get(p)===H&&re.delete(p),!z.signal.aborted){if(be.has(p)){ke(p,He(void 0));return}if(tt(te))if(Te>W){ke(p,He(void 0));return}else{fe.add(p),await qe(z,te,!1,{preventScrollReset:I});return}if(ye(te)){Oe(p,v,te.error);return}K(!Ve(te),"Unhandled fetcher deferred data"),ke(p,He(te.data))}}async function qe(p,v,S,x){let{submission:L,fetcherSubmission:B,preventScrollReset:V,replace:I}=x===void 0?{}:x;v.response.headers.has("X-Remix-Revalidate")&&(me=!0);let k=v.response.headers.get("Location");K(k,"Expected a Location header on the redirect Response"),k=no(k,new URL(p.url),l);let A=Ot(E.location,k,{_isRedirect:!0});if(r){let q=!1;if(v.response.headers.has("X-Remix-Reload-Document"))q=!0;else if(rn.test(k)){const oe=t.history.createURL(k);q=oe.origin!==e.location.origin||It(oe.pathname,l)==null}if(q){I?e.location.replace(k):e.location.assign(k);return}}M=null;let H=I===!0||v.response.headers.has("X-Remix-Replace")?ue.Replace:ue.Push,{formMethod:z,formAction:W,formEncType:he}=E.navigation;!L&&!B&&z&&W&&he&&(L=uo(E.navigation));let te=L||B;if(Cu.has(v.response.status)&&te&&Re(te.formMethod))await Xe(H,A,{submission:ne({},te,{formAction:k}),preventScrollReset:V||j,enableViewTransition:S?$:void 0});else{let q=xr(A,L);await Xe(H,A,{overrideNavigation:q,fetcherSubmission:B,preventScrollReset:V||j,enableViewTransition:S?$:void 0})}}async function gt(p,v,S,x,L,B){let V,I={};try{V=await Ou(c,p,v,S,x,L,B,a,o)}catch(k){return x.forEach(A=>{I[A.route.id]={type:Q.error,error:k}}),I}for(let[k,A]of Object.entries(V))if(ku(A)){let H=A.result;I[k]={type:Q.redirect,response:Au(H,S,k,L,l,d.v7_relativeSplatPath)}}else I[k]=await Pu(A);return I}async function hn(p,v,S,x,L){let B=p.matches,V=gt("loader",p,L,S,v,null),I=Promise.all(x.map(async H=>{if(H.matches&&H.match&&H.controller){let W=(await gt("loader",p,lt(t.history,H.path,H.controller.signal),[H.match],H.matches,H.key))[H.match.route.id];return{[H.key]:W}}else return Promise.resolve({[H.key]:{type:Q.error,error:Ee(404,{pathname:H.path})}})})),k=await V,A=(await I).reduce((H,z)=>Object.assign(H,z),{});return await Promise.all([ju(v,k,L.signal,B,p.loaderData),Bu(v,A,x)]),{loaderResults:k,fetcherResults:A}}function hr(){me=!0,de.push(...gr()),_e.forEach((p,v)=>{re.has(v)&&Z.add(v),Me(v)})}function ke(p,v,S){S===void 0&&(S={}),E.fetchers.set(p,v),ve({fetchers:new Map(E.fetchers)},{flushSync:(S&&S.flushSync)===!0})}function Oe(p,v,S,x){x===void 0&&(x={});let L=et(E.matches,v);Mt(p),ve({errors:{[L.route.id]:S},fetchers:new Map(E.fetchers)},{flushSync:(x&&x.flushSync)===!0})}function pn(p){return Ie.set(p,(Ie.get(p)||0)+1),be.has(p)&&be.delete(p),E.fetchers.get(p)||Su}function Mt(p){let v=E.fetchers.get(p);re.has(p)&&!(v&&v.state==="loading"&&le.has(p))&&Me(p),_e.delete(p),le.delete(p),fe.delete(p),d.v7_fetcherPersist&&be.delete(p),Z.delete(p),E.fetchers.delete(p)}function vi(p){let v=(Ie.get(p)||0)-1;v<=0?(Ie.delete(p),be.add(p),d.v7_fetcherPersist||Mt(p)):Ie.set(p,v),ve({fetchers:new Map(E.fetchers)})}function Me(p){let v=re.get(p);v&&(v.abort(),re.delete(p))}function gn(p){for(let v of p){let S=pn(v),x=He(S.data);E.fetchers.set(v,x)}}function mn(){let p=[],v=!1;for(let S of fe){let x=E.fetchers.get(S);K(x,"Expected fetcher: "+S),x.state==="loading"&&(fe.delete(S),p.push(S),v=!0)}return gn(p),v}function vn(p){let v=[];for(let[S,x]of le)if(x<p){let L=E.fetchers.get(S);K(L,"Expected fetcher: "+S),L.state==="loading"&&(Me(S),le.delete(S),v.push(S))}return gn(v),v.length>0}function Ei(p,v){let S=E.blockers.get(p)||_t;return Je.get(p)!==v&&Je.set(p,v),S}function En(p){E.blockers.delete(p),Je.delete(p)}function Ht(p,v){let S=E.blockers.get(p)||_t;K(S.state==="unblocked"&&v.state==="blocked"||S.state==="blocked"&&v.state==="blocked"||S.state==="blocked"&&v.state==="proceeding"||S.state==="blocked"&&v.state==="unblocked"||S.state==="proceeding"&&v.state==="unblocked","Invalid blocker state transition: "+S.state+" -> "+v.state);let x=new Map(E.blockers);x.set(p,v),ve({blockers:x})}function yn(p){let{currentLocation:v,nextLocation:S,historyAction:x}=p;if(Je.size===0)return;Je.size>1&&pt(!1,"A router only supports one blocker at a time");let L=Array.from(Je.entries()),[B,V]=L[L.length-1],I=E.blockers.get(B);if(!(I&&I.state==="proceeding")&&V({currentLocation:v,nextLocation:S,historyAction:x}))return B}function pr(p){let v=Ee(404,{pathname:p}),S=s||i,{matches:x,route:L}=lo(S);return gr(),{notFoundMatches:x,route:L,error:v}}function gr(p){let v=[];return Ge.forEach((S,x)=>{(!p||p(x))&&(S.cancel(),v.push(x),Ge.delete(x))}),v}function yi(p,v,S){if(m=p,N=v,_=S||null,!C&&E.navigation===Rr){C=!0;let x=Cn(E.location,E.matches);x!=null&&ve({restoreScrollPosition:x})}return()=>{m=null,N=null,_=null}}function _n(p,v){return _&&_(p,v.map(x=>Qc(x,E.loaderData)))||p.key}function _i(p,v){if(m&&N){let S=_n(p,v);m[S]=N()}}function Cn(p,v){if(m){let S=_n(p,v),x=m[S];if(typeof x=="number")return x}return null}function jt(p,v,S){if(u)if(p){if(Object.keys(p[0].params).length>0)return{active:!0,matches:Jt(v,S,l,!0)}}else return{active:!0,matches:Jt(v,S,l,!0)||[]};return{active:!1,matches:null}}async function Bt(p,v,S,x){if(!u)return{type:"success",matches:p};let L=p;for(;;){let B=s==null,V=s||i,I=a;try{await u({signal:S,path:v,matches:L,fetcherKey:x,patch:(H,z)=>{S.aborted||ro(H,z,V,I,o)}})}catch(H){return{type:"error",error:H,partialMatches:L}}finally{B&&!S.aborted&&(i=[...i])}if(S.aborted)return{type:"aborted"};let k=je(V,v,l);if(k)return{type:"success",matches:k};let A=Jt(V,v,l,!0);if(!A||L.length===A.length&&L.every((H,z)=>H.route.id===A[z].route.id))return{type:"success",matches:null};L=A}}function Ci(p){a={},s=rr(p,o,void 0,a)}function Si(p,v){let S=s==null;ro(p,v,s||i,a,o),S&&(i=[...i],ve({}))}return P={get basename(){return l},get future(){return d},get state(){return E},get routes(){return i},get window(){return e},initialize:si,subscribe:ci,enableScrollRestoration:yi,navigate:dn,fetch:pi,revalidate:ui,createHref:p=>t.history.createHref(p),encodeLocation:p=>t.history.encodeLocation(p),getFetcher:pn,deleteFetcher:vi,dispose:li,getBlocker:Ei,deleteBlocker:En,patchRoutes:Si,_internalFetchControllers:re,_internalActiveDeferreds:Ge,_internalSetRoutes:Ci},P}function Ru(t){return t!=null&&("formData"in t&&t.formData!=null||"body"in t&&t.body!==void 0)}function Fr(t,e,r,n,o,a,i,s){let l,c;if(i){l=[];for(let d of e)if(l.push(d),d.route.id===i){c=d;break}}else l=e,c=e[e.length-1];let u=Sa(o||".",Ca(l,a),It(t.pathname,r)||t.pathname,s==="path");if(o==null&&(u.search=t.search,u.hash=t.hash),(o==null||o===""||o===".")&&c){let d=on(u.search);if(c.route.index&&!d)u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index";else if(!c.route.index&&d){let h=new URLSearchParams(u.search),f=h.getAll("index");h.delete("index"),f.filter(_=>_).forEach(_=>h.append("index",_));let m=h.toString();u.search=m?"?"+m:""}}return n&&r!=="/"&&(u.pathname=u.pathname==="/"?r:ze([r,u.pathname])),Tt(u)}function Zn(t,e,r,n){if(!n||!Ru(n))return{path:r};if(n.formMethod&&!Hu(n.formMethod))return{path:r,error:Ee(405,{method:n.formMethod})};let o=()=>({path:r,error:Ee(400,{type:"invalid-body"})}),a=n.formMethod||"get",i=t?a.toUpperCase():a.toLowerCase(),s=Da(r);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!Re(i))return o();let h=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((f,m)=>{let[_,N]=m;return""+f+_+"="+N+`
|
|
5
|
+
`},""):String(n.body);return{path:r,submission:{formMethod:i,formAction:s,formEncType:n.formEncType,formData:void 0,json:void 0,text:h}}}else if(n.formEncType==="application/json"){if(!Re(i))return o();try{let h=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:r,submission:{formMethod:i,formAction:s,formEncType:n.formEncType,formData:void 0,json:h,text:void 0}}}catch{return o()}}}K(typeof FormData=="function","FormData is not available in this environment");let l,c;if(n.formData)l=Ur(n.formData),c=n.formData;else if(n.body instanceof FormData)l=Ur(n.body),c=n.body;else if(n.body instanceof URLSearchParams)l=n.body,c=oo(l);else if(n.body==null)l=new URLSearchParams,c=new FormData;else try{l=new URLSearchParams(n.body),c=oo(l)}catch{return o()}let u={formMethod:i,formAction:s,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:c,json:void 0,text:void 0};if(Re(u.formMethod))return{path:r,submission:u};let d=Ke(r);return e&&d.search&&on(d.search)&&l.append("index",""),d.search="?"+l,{path:Tt(d),submission:u}}function Qn(t,e,r){r===void 0&&(r=!1);let n=t.findIndex(o=>o.route.id===e);return n>=0?t.slice(0,r?n+1:n):t}function eo(t,e,r,n,o,a,i,s,l,c,u,d,h,f,m,_){let N=_?ye(_[1])?_[1].error:_[1].data:void 0,C=t.createURL(e.location),b=t.createURL(o),T=r;a&&e.errors?T=Qn(r,Object.keys(e.errors)[0],!0):_&&ye(_[1])&&(T=Qn(r,_[0]));let R=_?_[1].statusCode:void 0,w=i&&R&&R>=400,P=T.filter((D,j)=>{let{route:M}=D;if(M.lazy)return!0;if(M.loader==null)return!1;if(a)return Vr(M,e.loaderData,e.errors);if(xu(e.loaderData,e.matches[j],D)||l.some(G=>G===D.route.id))return!0;let $=e.matches[j],F=D;return to(D,ne({currentUrl:C,currentParams:$.params,nextUrl:b,nextParams:F.params},n,{actionResult:N,actionStatus:R,defaultShouldRevalidate:w?!1:s||C.pathname+C.search===b.pathname+b.search||C.search!==b.search||Ra($,F)}))}),E=[];return d.forEach((D,j)=>{if(a||!r.some(J=>J.route.id===D.routeId)||u.has(j))return;let M=je(f,D.path,m);if(!M){E.push({key:j,routeId:D.routeId,path:D.path,matches:null,match:null,controller:null});return}let $=e.fetchers.get(j),F=bt(M,D.path),G=!1;h.has(j)?G=!1:c.has(j)?(c.delete(j),G=!0):$&&$.state!=="idle"&&$.data===void 0?G=s:G=to(F,ne({currentUrl:C,currentParams:e.matches[e.matches.length-1].params,nextUrl:b,nextParams:r[r.length-1].params},n,{actionResult:N,actionStatus:R,defaultShouldRevalidate:w?!1:s})),G&&E.push({key:j,routeId:D.routeId,path:D.path,matches:M,match:F,controller:new AbortController})}),[P,E]}function Vr(t,e,r){if(t.lazy)return!0;if(!t.loader)return!1;let n=e!=null&&e[t.id]!==void 0,o=r!=null&&r[t.id]!==void 0;return!n&&o?!1:typeof t.loader=="function"&&t.loader.hydrate===!0?!0:!n&&!o}function xu(t,e,r){let n=!e||r.route.id!==e.route.id,o=t[r.route.id]===void 0;return n||o}function Ra(t,e){let r=t.route.path;return t.pathname!==e.pathname||r!=null&&r.endsWith("*")&&t.params["*"]!==e.params["*"]}function to(t,e){if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate(e);if(typeof r=="boolean")return r}return e.defaultShouldRevalidate}function ro(t,e,r,n,o){var a;let i;if(t){let c=n[t];K(c,"No route found to patch children into: routeId = "+t),c.children||(c.children=[]),i=c.children}else i=r;let s=e.filter(c=>!i.some(u=>xa(c,u))),l=rr(s,o,[t||"_","patch",String(((a=i)==null?void 0:a.length)||"0")],n);i.push(...l)}function xa(t,e){return"id"in t&&"id"in e&&t.id===e.id?!0:t.index===e.index&&t.path===e.path&&t.caseSensitive===e.caseSensitive?(!t.children||t.children.length===0)&&(!e.children||e.children.length===0)?!0:t.children.every((r,n)=>{var o;return(o=e.children)==null?void 0:o.some(a=>xa(r,a))}):!1}async function Du(t,e,r){if(!t.lazy)return;let n=await t.lazy();if(!t.lazy)return;let o=r[t.id];K(o,"No route found in manifest");let a={};for(let i in n){let l=o[i]!==void 0&&i!=="hasErrorBoundary";pt(!l,'Route "'+o.id+'" has a static property "'+i+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+i+'" will be ignored.')),!l&&!qc.has(i)&&(a[i]=n[i])}Object.assign(o,a),Object.assign(o,ne({},e(o),{lazy:void 0}))}async function wu(t){let{matches:e}=t,r=e.filter(o=>o.shouldLoad);return(await Promise.all(r.map(o=>o.resolve()))).reduce((o,a,i)=>Object.assign(o,{[r[i].route.id]:a}),{})}async function Ou(t,e,r,n,o,a,i,s,l,c){let u=a.map(f=>f.route.lazy?Du(f.route,l,s):void 0),d=a.map((f,m)=>{let _=u[m],N=o.some(b=>b.route.id===f.route.id);return ne({},f,{shouldLoad:N,resolve:async b=>(b&&n.method==="GET"&&(f.route.lazy||f.route.loader)&&(N=!0),N?Lu(e,n,f,_,b,c):Promise.resolve({type:Q.data,result:void 0}))})}),h=await t({matches:d,request:n,params:a[0].params,fetcherKey:i,context:c});try{await Promise.all(u)}catch{}return h}async function Lu(t,e,r,n,o,a){let i,s,l=c=>{let u,d=new Promise((m,_)=>u=_);s=()=>u(),e.signal.addEventListener("abort",s);let h=m=>typeof c!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+t+'" [routeId: '+r.route.id+"]"))):c({request:e,params:r.params,context:a},...m!==void 0?[m]:[]),f=(async()=>{try{return{type:"data",result:await(o?o(_=>h(_)):h())}}catch(m){return{type:"error",result:m}}})();return Promise.race([f,d])};try{let c=r.route[t];if(n)if(c){let u,[d]=await Promise.all([l(c).catch(h=>{u=h}),n]);if(u!==void 0)throw u;i=d}else if(await n,c=r.route[t],c)i=await l(c);else if(t==="action"){let u=new URL(e.url),d=u.pathname+u.search;throw Ee(405,{method:e.method,pathname:d,routeId:r.route.id})}else return{type:Q.data,result:void 0};else if(c)i=await l(c);else{let u=new URL(e.url),d=u.pathname+u.search;throw Ee(404,{pathname:d})}K(i.result!==void 0,"You defined "+(t==="action"?"an action":"a loader")+" for route "+('"'+r.route.id+"\" but didn't return anything from your `"+t+"` ")+"function. Please return a value or `null`.")}catch(c){return{type:Q.error,result:c}}finally{s&&e.signal.removeEventListener("abort",s)}return i}async function Pu(t){let{result:e,type:r}=t;if(wa(e)){let d;try{let h=e.headers.get("Content-Type");h&&/\bapplication\/json\b/.test(h)?e.body==null?d=null:d=await e.json():d=await e.text()}catch(h){return{type:Q.error,error:h}}return r===Q.error?{type:Q.error,error:new nr(e.status,e.statusText,d),statusCode:e.status,headers:e.headers}:{type:Q.data,data:d,statusCode:e.status,headers:e.headers}}if(r===Q.error){if(co(e)){var n,o;if(e.data instanceof Error){var a,i;return{type:Q.error,error:e.data,statusCode:(a=e.init)==null?void 0:a.status,headers:(i=e.init)!=null&&i.headers?new Headers(e.init.headers):void 0}}return{type:Q.error,error:new nr(((n=e.init)==null?void 0:n.status)||500,void 0,e.data),statusCode:Lt(e)?e.status:void 0,headers:(o=e.init)!=null&&o.headers?new Headers(e.init.headers):void 0}}return{type:Q.error,error:e,statusCode:Lt(e)?e.status:void 0}}if(Mu(e)){var s,l;return{type:Q.deferred,deferredData:e,statusCode:(s=e.init)==null?void 0:s.status,headers:((l=e.init)==null?void 0:l.headers)&&new Headers(e.init.headers)}}if(co(e)){var c,u;return{type:Q.data,data:e.data,statusCode:(c=e.init)==null?void 0:c.status,headers:(u=e.init)!=null&&u.headers?new Headers(e.init.headers):void 0}}return{type:Q.data,data:e}}function Au(t,e,r,n,o,a){let i=t.headers.get("Location");if(K(i,"Redirects returned/thrown from loaders/actions must have a Location header"),!rn.test(i)){let s=n.slice(0,n.findIndex(l=>l.route.id===r)+1);i=Fr(new URL(e.url),s,o,!0,i,a),t.headers.set("Location",i)}return t}function no(t,e,r){if(rn.test(t)){let n=t,o=n.startsWith("//")?new URL(e.protocol+n):new URL(n),a=It(o.pathname,r)!=null;if(o.origin===e.origin&&a)return o.pathname+o.search+o.hash}return t}function lt(t,e,r,n){let o=t.createURL(Da(e)).toString(),a={signal:r};if(n&&Re(n.formMethod)){let{formMethod:i,formEncType:s}=n;a.method=i.toUpperCase(),s==="application/json"?(a.headers=new Headers({"Content-Type":s}),a.body=JSON.stringify(n.json)):s==="text/plain"?a.body=n.text:s==="application/x-www-form-urlencoded"&&n.formData?a.body=Ur(n.formData):a.body=n.formData}return new Request(o,a)}function Ur(t){let e=new URLSearchParams;for(let[r,n]of t.entries())e.append(r,typeof n=="string"?n:n.name);return e}function oo(t){let e=new FormData;for(let[r,n]of t.entries())e.append(r,n);return e}function Tu(t,e,r,n,o){let a={},i=null,s,l=!1,c={},u=r&&ye(r[1])?r[1].error:void 0;return t.forEach(d=>{if(!(d.route.id in e))return;let h=d.route.id,f=e[h];if(K(!tt(f),"Cannot handle redirect results in processLoaderData"),ye(f)){let m=f.error;u!==void 0&&(m=u,u=void 0),i=i||{};{let _=et(t,h);i[_.route.id]==null&&(i[_.route.id]=m)}a[h]=void 0,l||(l=!0,s=Lt(f.error)?f.error.status:500),f.headers&&(c[h]=f.headers)}else Ve(f)?(n.set(h,f.deferredData),a[h]=f.deferredData.data,f.statusCode!=null&&f.statusCode!==200&&!l&&(s=f.statusCode),f.headers&&(c[h]=f.headers)):(a[h]=f.data,f.statusCode&&f.statusCode!==200&&!l&&(s=f.statusCode),f.headers&&(c[h]=f.headers))}),u!==void 0&&r&&(i={[r[0]]:u},a[r[0]]=void 0),{loaderData:a,errors:i,statusCode:s||200,loaderHeaders:c}}function ao(t,e,r,n,o,a,i){let{loaderData:s,errors:l}=Tu(e,r,n,i);return o.forEach(c=>{let{key:u,match:d,controller:h}=c,f=a[u];if(K(f,"Did not find corresponding fetcher result"),!(h&&h.signal.aborted))if(ye(f)){let m=et(t.matches,d?.route.id);l&&l[m.route.id]||(l=ne({},l,{[m.route.id]:f.error})),t.fetchers.delete(u)}else if(tt(f))K(!1,"Unhandled fetcher revalidation redirect");else if(Ve(f))K(!1,"Unhandled fetcher deferred data");else{let m=He(f.data);t.fetchers.set(u,m)}}),{loaderData:s,errors:l}}function io(t,e,r,n){let o=ne({},e);for(let a of r){let i=a.route.id;if(e.hasOwnProperty(i)?e[i]!==void 0&&(o[i]=e[i]):t[i]!==void 0&&a.route.loader&&(o[i]=t[i]),n&&n.hasOwnProperty(i))break}return o}function so(t){return t?ye(t[1])?{actionData:{}}:{actionData:{[t[0]]:t[1].data}}:{}}function et(t,e){return(e?t.slice(0,t.findIndex(n=>n.route.id===e)+1):[...t]).reverse().find(n=>n.route.hasErrorBoundary===!0)||t[0]}function lo(t){let e=t.length===1?t[0]:t.find(r=>r.index||!r.path||r.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:e}],route:e}}function Ee(t,e){let{pathname:r,routeId:n,method:o,type:a,message:i}=e===void 0?{}:e,s="Unknown Server Error",l="Unknown @remix-run/router error";return t===400?(s="Bad Request",o&&r&&n?l="You made a "+o+' request to "'+r+'" but '+('did not provide a `loader` for route "'+n+'", ')+"so there is no way to handle the request.":a==="defer-action"?l="defer() is not supported in actions":a==="invalid-body"&&(l="Unable to encode submission body")):t===403?(s="Forbidden",l='Route "'+n+'" does not match URL "'+r+'"'):t===404?(s="Not Found",l='No route matches URL "'+r+'"'):t===405&&(s="Method Not Allowed",o&&r&&n?l="You made a "+o.toUpperCase()+' request to "'+r+'" but '+('did not provide an `action` for route "'+n+'", ')+"so there is no way to handle the request.":o&&(l='Invalid request method "'+o.toUpperCase()+'"')),new nr(t||500,s,new Error(l),!0)}function Kt(t){let e=Object.entries(t);for(let r=e.length-1;r>=0;r--){let[n,o]=e[r];if(tt(o))return{key:n,result:o}}}function Da(t){let e=typeof t=="string"?Ke(t):t;return Tt(ne({},e,{hash:""}))}function Iu(t,e){return t.pathname!==e.pathname||t.search!==e.search?!1:t.hash===""?e.hash!=="":t.hash===e.hash?!0:e.hash!==""}function ku(t){return wa(t.result)&&_u.has(t.result.status)}function Ve(t){return t.type===Q.deferred}function ye(t){return t.type===Q.error}function tt(t){return(t&&t.type)===Q.redirect}function co(t){return typeof t=="object"&&t!=null&&"type"in t&&"data"in t&&"init"in t&&t.type==="DataWithResponseInit"}function Mu(t){let e=t;return e&&typeof e=="object"&&typeof e.data=="object"&&typeof e.subscribe=="function"&&typeof e.cancel=="function"&&typeof e.resolveData=="function"}function wa(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.headers=="object"&&typeof t.body<"u"}function Hu(t){return yu.has(t.toLowerCase())}function Re(t){return vu.has(t.toLowerCase())}async function ju(t,e,r,n,o){let a=Object.entries(e);for(let i=0;i<a.length;i++){let[s,l]=a[i],c=t.find(h=>h?.route.id===s);if(!c)continue;let u=n.find(h=>h.route.id===c.route.id),d=u!=null&&!Ra(u,c)&&(o&&o[c.route.id])!==void 0;Ve(l)&&d&&await nn(l,r,!1).then(h=>{h&&(e[s]=h)})}}async function Bu(t,e,r){for(let n=0;n<r.length;n++){let{key:o,routeId:a,controller:i}=r[n],s=e[o];t.find(c=>c?.route.id===a)&&Ve(s)&&(K(i,"Expected an AbortController for revalidating fetcher deferred result"),await nn(s,i.signal,!0).then(c=>{c&&(e[o]=c)}))}}async function nn(t,e,r){if(r===void 0&&(r=!1),!await t.deferredData.resolveData(e)){if(r)try{return{type:Q.data,data:t.deferredData.unwrappedData}}catch(o){return{type:Q.error,error:o}}return{type:Q.data,data:t.deferredData.data}}}function on(t){return new URLSearchParams(t).getAll("index").some(e=>e==="")}function bt(t,e){let r=typeof e=="string"?Ke(e).search:e.search;if(t[t.length-1].route.index&&on(r||""))return t[t.length-1];let n=_a(t);return n[n.length-1]}function uo(t){let{formMethod:e,formAction:r,formEncType:n,text:o,formData:a,json:i}=t;if(!(!e||!r||!n)){if(o!=null)return{formMethod:e,formAction:r,formEncType:n,formData:void 0,json:void 0,text:o};if(a!=null)return{formMethod:e,formAction:r,formEncType:n,formData:a,json:void 0,text:void 0};if(i!==void 0)return{formMethod:e,formAction:r,formEncType:n,formData:void 0,json:i,text:void 0}}}function xr(t,e){return e?{state:"loading",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}:{state:"loading",location:t,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Fu(t,e){return{state:"submitting",location:t,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text}}function Ct(t,e){return t?{state:"loading",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function Vu(t,e){return{state:"submitting",formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text,data:e?e.data:void 0}}function He(t){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function Uu(t,e){try{let r=t.sessionStorage.getItem(ba);if(r){let n=JSON.parse(r);for(let[o,a]of Object.entries(n||{}))a&&Array.isArray(a)&&e.set(o,new Set(a||[]))}}catch{}}function $u(t,e){if(e.size>0){let r={};for(let[n,o]of e)r[n]=[...o];try{t.sessionStorage.setItem(ba,JSON.stringify(r))}catch(n){pt(!1,"Failed to save applied view transitions in sessionStorage ("+n+").")}}}function or(){return or=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},or.apply(this,arguments)}const lr=g.createContext(null),Oa=g.createContext(null),cr=g.createContext(null),ur=g.createContext(null),We=g.createContext({outlet:null,matches:[],isDataRoute:!1}),La=g.createContext(null);function dr(){return g.useContext(ur)!=null}function fr(){return dr()||K(!1),g.useContext(ur).location}function zu(){return g.useContext(ur).navigationType}function Pa(t){g.useContext(cr).static||g.useLayoutEffect(t)}function Ku(){let{isDataRoute:t}=g.useContext(We);return t?id():Wu()}function Wu(){dr()||K(!1);let t=g.useContext(lr),{basename:e,future:r,navigator:n}=g.useContext(cr),{matches:o}=g.useContext(We),{pathname:a}=fr(),i=JSON.stringify(Ca(o,r.v7_relativeSplatPath)),s=g.useRef(!1);return Pa(()=>{s.current=!0}),g.useCallback(function(c,u){if(u===void 0&&(u={}),!s.current)return;if(typeof c=="number"){n.go(c);return}let d=Sa(c,JSON.parse(i),a,u.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:ze([e,d.pathname])),(u.replace?n.replace:n.push)(d,u.state,u)},[e,n,i,a,t])}const Yu=g.createContext(null);function Gu(t){let e=g.useContext(We).outlet;return e&&g.createElement(Yu.Provider,{value:t},e)}function Ju(){let{matches:t}=g.useContext(We),e=t[t.length-1];return e?e.params:{}}function Xu(t,e,r,n){dr()||K(!1);let{navigator:o}=g.useContext(cr),{matches:a}=g.useContext(We),i=a[a.length-1],s=i?i.params:{};i&&i.pathname;let l=i?i.pathnameBase:"/";i&&i.route;let c=fr(),u;u=c;let d=u.pathname||"/",h=d;if(l!=="/"){let _=l.replace(/^\//,"").split("/");h="/"+d.replace(/^\//,"").split("/").slice(_.length).join("/")}let f=je(t,{pathname:h});return td(f&&f.map(_=>Object.assign({},_,{params:Object.assign({},s,_.params),pathname:ze([l,o.encodeLocation?o.encodeLocation(_.pathname).pathname:_.pathname]),pathnameBase:_.pathnameBase==="/"?l:ze([l,o.encodeLocation?o.encodeLocation(_.pathnameBase).pathname:_.pathnameBase])})),a,r,n)}function qu(){let t=ad(),e=Lt(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,o={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},e),r?g.createElement("pre",{style:o},r):null,null)}const Zu=g.createElement(qu,null);class Qu extends g.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,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){console.error("React Router caught the following error during render",e,r)}render(){return this.state.error!==void 0?g.createElement(We.Provider,{value:this.props.routeContext},g.createElement(La.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function ed(t){let{routeContext:e,match:r,children:n}=t,o=g.useContext(lr);return o&&o.static&&o.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=r.route.id),g.createElement(We.Provider,{value:e},n)}function td(t,e,r,n){var o;if(e===void 0&&(e=[]),r===void 0&&(r=null),n===void 0&&(n=null),t==null){var a;if(!r)return null;if(r.errors)t=r.matches;else if((a=n)!=null&&a.v7_partialHydration&&e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let i=t,s=(o=r)==null?void 0:o.errors;if(s!=null){let u=i.findIndex(d=>d.route.id&&s?.[d.route.id]!==void 0);u>=0||K(!1),i=i.slice(0,Math.min(i.length,u+1))}let l=!1,c=-1;if(r&&n&&n.v7_partialHydration)for(let u=0;u<i.length;u++){let d=i[u];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(c=u),d.route.id){let{loaderData:h,errors:f}=r,m=d.route.loader&&h[d.route.id]===void 0&&(!f||f[d.route.id]===void 0);if(d.route.lazy||m){l=!0,c>=0?i=i.slice(0,c+1):i=[i[0]];break}}}return i.reduceRight((u,d,h)=>{let f,m=!1,_=null,N=null;r&&(f=s&&d.route.id?s[d.route.id]:void 0,_=d.route.errorElement||Zu,l&&(c<0&&h===0?(sd("route-fallback"),m=!0,N=null):c===h&&(m=!0,N=d.route.hydrateFallbackElement||null)));let C=e.concat(i.slice(0,h+1)),b=()=>{let T;return f?T=_:m?T=N:d.route.Component?T=g.createElement(d.route.Component,null):d.route.element?T=d.route.element:T=u,g.createElement(ed,{match:d,routeContext:{outlet:u,matches:C,isDataRoute:r!=null},children:T})};return r&&(d.route.ErrorBoundary||d.route.errorElement||h===0)?g.createElement(Qu,{location:r.location,revalidation:r.revalidation,component:_,error:f,children:b(),routeContext:{outlet:null,matches:C,isDataRoute:!0}}):b()},null)}var Aa=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(Aa||{}),Ta=(function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t})(Ta||{});function rd(t){let e=g.useContext(lr);return e||K(!1),e}function nd(t){let e=g.useContext(Oa);return e||K(!1),e}function od(t){let e=g.useContext(We);return e||K(!1),e}function Ia(t){let e=od(),r=e.matches[e.matches.length-1];return r.route.id||K(!1),r.route.id}function ad(){var t;let e=g.useContext(La),r=nd(Ta.UseRouteError),n=Ia();return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}function id(){let{router:t}=rd(Aa.UseNavigateStable),e=Ia(),r=g.useRef(!1);return Pa(()=>{r.current=!0}),g.useCallback(function(o,a){a===void 0&&(a={}),r.current&&(typeof o=="number"?t.navigate(o):t.navigate(o,or({fromRouteId:e},a)))},[t,e])}const fo={};function sd(t,e,r){fo[t]||(fo[t]=!0)}function ld(t,e){t?.v7_startTransition,t?.v7_relativeSplatPath===void 0&&(!e||e.v7_relativeSplatPath),e&&(e.v7_fetcherPersist,e.v7_normalizeFormMethod,e.v7_partialHydration,e.v7_skipActionErrorRevalidation)}function cd(t){return Gu(t.context)}function ud(t){K(!1)}function dd(t){let{basename:e="/",children:r=null,location:n,navigationType:o=ue.Pop,navigator:a,static:i=!1,future:s}=t;dr()&&K(!1);let l=e.replace(/^\/*/,"/"),c=g.useMemo(()=>({basename:l,navigator:a,static:i,future:or({v7_relativeSplatPath:!1},s)}),[l,s,a,i]);typeof n=="string"&&(n=Ke(n));let{pathname:u="/",search:d="",hash:h="",state:f=null,key:m="default"}=n,_=g.useMemo(()=>{let N=It(u,l);return N==null?null:{location:{pathname:N,search:d,hash:h,state:f,key:m},navigationType:o}},[l,u,d,h,f,m,o]);return _==null?null:g.createElement(cr.Provider,{value:c},g.createElement(ur.Provider,{children:r,value:_}))}new Promise(()=>{});function $r(t,e){e===void 0&&(e=[]);let r=[];return g.Children.forEach(t,(n,o)=>{if(!g.isValidElement(n))return;let a=[...e,o];if(n.type===g.Fragment){r.push.apply(r,$r(n.props.children,a));return}n.type!==ud&&K(!1),!n.props.index||!n.props.children||K(!1);let i={id:n.props.id||a.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(i.children=$r(n.props.children,a)),r.push(i)}),r}function fd(t){let e={hasErrorBoundary:t.ErrorBoundary!=null||t.errorElement!=null};return t.Component&&Object.assign(e,{element:g.createElement(t.Component),Component:void 0}),t.HydrateFallback&&Object.assign(e,{hydrateFallbackElement:g.createElement(t.HydrateFallback),HydrateFallback:void 0}),t.ErrorBoundary&&Object.assign(e,{errorElement:g.createElement(t.ErrorBoundary),ErrorBoundary:void 0}),e}function ar(){return ar=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},ar.apply(this,arguments)}const hd="6";try{window.__reactRouterVersion=hd}catch{}function pd(t,e){return bu({basename:e?.basename,future:ar({},e?.future,{v7_prependBasename:!0}),history:Gc({window:e?.window}),hydrationData:e?.hydrationData||gd(),routes:t,mapRouteProperties:fd,dataStrategy:e?.dataStrategy,patchRoutesOnNavigation:e?.patchRoutesOnNavigation,window:e?.window}).initialize()}function gd(){var t;let e=(t=window)==null?void 0:t.__staticRouterHydrationData;return e&&e.errors&&(e=ar({},e,{errors:md(e.errors)})),e}function md(t){if(!t)return null;let e=Object.entries(t),r={};for(let[n,o]of e)if(o&&o.__type==="RouteErrorResponse")r[n]=new nr(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(o.__subType){let a=window[o.__subType];if(typeof a=="function")try{let i=new a(o.message);i.stack="",r[n]=i}catch{}}if(r[n]==null){let a=new Error(o.message);a.stack="",r[n]=a}}else r[n]=o;return r}const vd=g.createContext({isTransitioning:!1}),Ed=g.createContext(new Map),yd="startTransition",ho=Oi[yd],_d="flushSync",po=xi[_d];function Cd(t){ho?ho(t):t()}function St(t){po?po(t):t()}class Sd{constructor(){this.status="pending",this.promise=new Promise((e,r)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",e(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",r(n))}})}}function Nd(t){let{fallbackElement:e,router:r,future:n}=t,[o,a]=g.useState(r.state),[i,s]=g.useState(),[l,c]=g.useState({isTransitioning:!1}),[u,d]=g.useState(),[h,f]=g.useState(),[m,_]=g.useState(),N=g.useRef(new Map),{v7_startTransition:C}=n||{},b=g.useCallback(D=>{C?Cd(D):D()},[C]),T=g.useCallback((D,j)=>{let{deletedFetchers:M,flushSync:$,viewTransitionOpts:F}=j;D.fetchers.forEach((J,me)=>{J.data!==void 0&&N.current.set(me,J.data)}),M.forEach(J=>N.current.delete(J));let G=r.window==null||r.window.document==null||typeof r.window.document.startViewTransition!="function";if(!F||G){$?St(()=>a(D)):b(()=>a(D));return}if($){St(()=>{h&&(u&&u.resolve(),h.skipTransition()),c({isTransitioning:!0,flushSync:!0,currentLocation:F.currentLocation,nextLocation:F.nextLocation})});let J=r.window.document.startViewTransition(()=>{St(()=>a(D))});J.finished.finally(()=>{St(()=>{d(void 0),f(void 0),s(void 0),c({isTransitioning:!1})})}),St(()=>f(J));return}h?(u&&u.resolve(),h.skipTransition(),_({state:D,currentLocation:F.currentLocation,nextLocation:F.nextLocation})):(s(D),c({isTransitioning:!0,flushSync:!1,currentLocation:F.currentLocation,nextLocation:F.nextLocation}))},[r.window,h,u,N,b]);g.useLayoutEffect(()=>r.subscribe(T),[r,T]),g.useEffect(()=>{l.isTransitioning&&!l.flushSync&&d(new Sd)},[l]),g.useEffect(()=>{if(u&&i&&r.window){let D=i,j=u.promise,M=r.window.document.startViewTransition(async()=>{b(()=>a(D)),await j});M.finished.finally(()=>{d(void 0),f(void 0),s(void 0),c({isTransitioning:!1})}),f(M)}},[b,i,u,r.window]),g.useEffect(()=>{u&&i&&o.location.key===i.location.key&&u.resolve()},[u,h,o.location,i]),g.useEffect(()=>{!l.isTransitioning&&m&&(s(m.state),c({isTransitioning:!0,flushSync:!1,currentLocation:m.currentLocation,nextLocation:m.nextLocation}),_(void 0))},[l.isTransitioning,m]),g.useEffect(()=>{},[]);let R=g.useMemo(()=>({createHref:r.createHref,encodeLocation:r.encodeLocation,go:D=>r.navigate(D),push:(D,j,M)=>r.navigate(D,{state:j,preventScrollReset:M?.preventScrollReset}),replace:(D,j,M)=>r.navigate(D,{replace:!0,state:j,preventScrollReset:M?.preventScrollReset})}),[r]),w=r.basename||"/",P=g.useMemo(()=>({router:r,navigator:R,static:!1,basename:w}),[r,R,w]),E=g.useMemo(()=>({v7_relativeSplatPath:r.future.v7_relativeSplatPath}),[r.future.v7_relativeSplatPath]);return g.useEffect(()=>ld(n,r.future),[n,r.future]),g.createElement(g.Fragment,null,g.createElement(lr.Provider,{value:P},g.createElement(Oa.Provider,{value:o},g.createElement(Ed.Provider,{value:N.current},g.createElement(vd.Provider,{value:l},g.createElement(dd,{basename:w,location:o.location,navigationType:o.historyAction,navigator:R,future:E},o.initialized||r.future.v7_partialHydration?g.createElement(bd,{routes:r.routes,future:r.future,state:o}):e))))),null)}const bd=g.memo(Rd);function Rd(t){let{routes:e,future:r,state:n}=t;return Xu(e,void 0,n,r)}var go;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(go||(go={}));var mo;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(mo||(mo={}));const vo=Uo(["sentry"]);let an=!1;async function ka(){return await pe(()=>import("./sentry_react-cODD7zWc.js").then(t=>t.i),__vite__mapDeps([0,1,2]))}async function xd(){const t=await ka(),e=[t.httpClientIntegration(),t.extraErrorDataIntegration({depth:5}),t.replayIntegration(),t.captureConsoleIntegration({levels:["error"]})];se.sentry.tracing&&e.push(t.reactRouterV6BrowserTracingIntegration({useEffect:Vo.useEffect,useLocation:fr,useNavigationType:zu,createRoutesFromChildren:$r,matchRoutes:je})),t.init({release:se.sentry.release,dsn:se.sentry.dsn,environment:se.sentry.env,integrations:e,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(r,n){const o=n.originalException;return o instanceof TypeError&&o.message.includes("Failed to fetch")&&!navigator.onLine?null:r}}),an=!0}async function Dd(){return an?(await ka()).getClient()?.close():void 0}function wd(){const[t]=Zr(),{analytics:e}=t;g.useEffect(()=>{if(!e){Dd().catch(r=>vo.error(r));return}an||!se.sentry.dsn||se.sentry.dsn===""||xd().catch(r=>vo.error(r))},[e])}function zr(){return zr=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},zr.apply(null,arguments)}var Ma=["shift","alt","meta","mod","ctrl"],Od={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 Ue(t){return(t&&Od[t]||t||"").trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function Ld(t){return Ma.includes(t)}function Dr(t,e){return e===void 0&&(e=","),t.split(e)}function wr(t,e,r){e===void 0&&(e="+");var n=t.toLocaleLowerCase().split(e).map(function(i){return Ue(i)}),o={alt:n.includes("alt"),ctrl:n.includes("ctrl")||n.includes("control"),shift:n.includes("shift"),meta:n.includes("meta"),mod:n.includes("mod")},a=n.filter(function(i){return!Ma.includes(i)});return zr({},o,{keys:a,description:r,hotkey:t})}(function(){typeof document<"u"&&(document.addEventListener("keydown",function(t){t.key!==void 0&&Ha([Ue(t.key),Ue(t.code)])}),document.addEventListener("keyup",function(t){t.key!==void 0&&ja([Ue(t.key),Ue(t.code)])})),typeof window<"u"&&window.addEventListener("blur",function(){$e.clear()})})();var $e=new Set;function sn(t){return Array.isArray(t)}function Pd(t,e){e===void 0&&(e=",");var r=sn(t)?t:t.split(e);return r.every(function(n){return $e.has(n.trim().toLowerCase())})}function Ha(t){var e=Array.isArray(t)?t:[t];$e.has("meta")&&$e.forEach(function(r){return!Ld(r)&&$e.delete(r.toLowerCase())}),e.forEach(function(r){return $e.add(r.toLowerCase())})}function ja(t){var e=Array.isArray(t)?t:[t];t==="meta"?$e.clear():e.forEach(function(r){return $e.delete(r.toLowerCase())})}function Ad(t,e,r){(typeof r=="function"&&r(t,e)||r===!0)&&t.preventDefault()}function Td(t,e,r){return typeof r=="function"?r(t,e):r===!0||r===void 0}function Id(t){return Ba(t,["input","textarea","select"])}function Ba(t,e){e===void 0&&(e=!1);var r=t.target,n=t.composed,o=null;return kd(r)&&n?o=t.composedPath()[0]&&t.composedPath()[0].tagName:o=r&&r.tagName,sn(e)?!!(o&&e&&e.some(function(a){var i;return a.toLowerCase()===((i=o)==null?void 0:i.toLowerCase())})):!!(o&&e&&e)}function kd(t){return!!t.tagName&&!t.tagName.startsWith("-")&&t.tagName.includes("-")}function Md(t,e){return t.length===0&&e?(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):e?t.some(function(r){return e.includes(r)})||t.includes("*"):!0}var Hd=function(e,r,n){n===void 0&&(n=!1);var o=r.alt,a=r.meta,i=r.mod,s=r.shift,l=r.ctrl,c=r.keys,u=e.key,d=e.code,h=e.ctrlKey,f=e.metaKey,m=e.shiftKey,_=e.altKey,N=Ue(d),C=u.toLowerCase();if(!(c!=null&&c.includes(N))&&!(c!=null&&c.includes(C))&&!["ctrl","control","unknown","meta","alt","shift","os"].includes(N))return!1;if(!n){if(o===!_&&C!=="alt"||s===!m&&C!=="shift")return!1;if(i){if(!f&&!h)return!1}else if(a===!f&&C!=="meta"&&C!=="os"||l===!h&&C!=="ctrl"&&C!=="control")return!1}return c&&c.length===1&&(c.includes(C)||c.includes(N))?!0:c?Pd(c):!c},jd=g.createContext(void 0),Bd=function(){return g.useContext(jd)};function Fa(t,e){return t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(t).length===Object.keys(e).length&&Object.keys(t).reduce(function(r,n){return r&&Fa(t[n],e[n])},!0):t===e}var Fd=g.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),Vd=function(){return g.useContext(Fd)};function Ud(t){var e=g.useRef(void 0);return Fa(e.current,t)||(e.current=t),e.current}var Eo=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},$d=typeof window<"u"?g.useLayoutEffect:g.useEffect;function yo(t,e,r,n){var o=g.useState(null),a=o[0],i=o[1],s=g.useRef(!1),l=r instanceof Array?n instanceof Array?void 0:n:r,c=sn(t)?t.join(l?.splitKey):t,u=r instanceof Array?r:n instanceof Array?n:void 0,d=g.useCallback(e,u??[]),h=g.useRef(d);u?h.current=d:h.current=e;var f=Ud(l),m=Vd(),_=m.enabledScopes,N=Bd();return $d(function(){if(!(f?.enabled===!1||!Md(_,f?.scopes))){var C=function(P,E){var D;if(E===void 0&&(E=!1),!(Id(P)&&!Ba(P,f?.enableOnFormTags))){if(a!==null){var j=a.getRootNode();if((j instanceof Document||j instanceof ShadowRoot)&&j.activeElement!==a&&!a.contains(j.activeElement)){Eo(P);return}}(D=P.target)!=null&&D.isContentEditable&&!(f!=null&&f.enableOnContentEditable)||Dr(c,f?.splitKey).forEach(function(M){var $,F=wr(M,f?.combinationKey);if(Hd(P,F,f?.ignoreModifiers)||($=F.keys)!=null&&$.includes("*")){if(f!=null&&f.ignoreEventWhen!=null&&f.ignoreEventWhen(P)||E&&s.current)return;if(Ad(P,F,f?.preventDefault),!Td(P,F,f?.enabled)){Eo(P);return}h.current(P,F),E||(s.current=!0)}})}},b=function(P){P.key!==void 0&&(Ha(Ue(P.code)),(f?.keydown===void 0&&f?.keyup!==!0||f!=null&&f.keydown)&&C(P))},T=function(P){P.key!==void 0&&(ja(Ue(P.code)),s.current=!1,f!=null&&f.keyup&&C(P,!0))},R=a||l?.document||document;return R.addEventListener("keyup",T,l?.eventListenerOptions),R.addEventListener("keydown",b,l?.eventListenerOptions),N&&Dr(c,f?.splitKey).forEach(function(w){return N.addHotkey(wr(w,f?.combinationKey,f?.description))}),function(){R.removeEventListener("keyup",T,l?.eventListenerOptions),R.removeEventListener("keydown",b,l?.eventListenerOptions),N&&Dr(c,f?.splitKey).forEach(function(w){return N.removeHotkey(wr(w,f?.combinationKey,f?.description))})}}},[a,c,f,_]),i}const zd=t=>{const{undo:e,redo:r,canRedo:n,canUndo:o}=t,a=window.navigator.userAgent.includes("Mac");let i="ctrl+z",s="ctrl+y";a&&(i="mod+z",s="mod+shift+z"),yo(i,l=>{l.preventDefault(),o&&e()},{},[o,e]),yo(s,l=>{l.preventDefault(),n&&r()},{},[n,r])};window.navigator.appVersion.includes("Mac");const _o={"staging/makerdao":"deployments/staging/makerdao","staging/arbitrum":"arb-ltip","staging/powerhouse":"staging",makerdao:"deployments/makerdao",arbitrum:"deployments/arbitrum",arbgrants:"deployments/arbitrum",localhost:"develop"},Kd=()=>{const t="https://raw.githubusercontent.com/powerhouse-inc/connect",e=window.location.href,r=Object.keys(_o).find(o=>e.includes(o)),n=r?_o[r]:void 0;if(n)return`${t}/${n}/package.json`},Wd=async()=>{const t=Kd();if(!t)return;const r=await(await fetch(t)).json(),{version:n}=r;return n},Yd=async()=>{const t=se.appVersion,e=await Wd();return e?{isLatest:e===t,currentVersion:t,latestVersion:e}:null};function Co(...t){window.dataLayer?.push(...t)}const Gd=()=>{const t=se.gaTrackingId,[{analytics:e}]=Zr(),r=t&&e;return g.useEffect(()=>{if(r){const n=document.createElement("script");return n.src=`https://www.googletagmanager.com/gtag/js?id=${t}`,n.async=!0,document.head.appendChild(n),window.dataLayer=window.dataLayer||[],Co("js",new Date),Co("config",t),()=>{document.head.removeChild(n)}}},[r,t]),null};function Jd(){return typeof document>"u"?"/":document.querySelector("base")?.getAttribute("href")||"/"}const Xd=["preserve-all","preserve-by-url-and-detach"],qd=()=>{const t=se.drives.preserveStrategy;return t&&(r=>Xd.includes(r))(t)?t:"preserve-by-url-and-detach"},Zd=t=>{if(t.length===0)return{strategy:"preserve-all"};switch(qd()){case"preserve-all":return{strategy:"preserve-all"};case"preserve-by-url-and-detach":return{strategy:"preserve-by-url-and-detach",urls:t};default:return{strategy:"preserve-by-url-and-detach",urls:t}}},Qd=t=>window.open(t,"_blank"),ef=Qd;class tf{constructor(e){this.connectCrypto=e}async sign(e,r){if(r?.aborted)throw new Error("Signing aborted");const n=(new Date().getTime()/1e3).toFixed(0),o=await this.connectCrypto.did();if(r?.aborted)throw new Error("Signing aborted");const a=await this.hashAction(e);if(r?.aborted)throw new Error("Signing aborted");const i=e.context?.prevOpHash??"",s=[n,o,a,i],l=this.buildSignatureMessage(s),c=await this.connectCrypto.sign(l),u=`0x${this.arrayBufferToHex(c)}`;if(r?.aborted)throw new Error("Signing aborted");return[...s,u]}async hashAction(e){const r=[e.scope,e.type,JSON.stringify(e.input)].join(""),o=new TextEncoder().encode(r),a=await crypto.subtle.digest("SHA-256",o);return this.arrayBufferToBase64(a)}buildSignatureMessage(e){const r=e.join(""),n=`Signed Operation:
|
|
6
|
+
`+r.length.toString();return new TextEncoder().encode(n+r)}arrayBufferToHex(e){const r=e instanceof Uint8Array?e:new Uint8Array(e);return Array.from(r).map(n=>n.toString(16).padStart(2,"0")).join("")}arrayBufferToBase64(e){const r=new Uint8Array(e);let n="";for(let o=0;o<r.length;o++)n+=String.fromCharCode(r[o]);return btoa(n)}}function rf(){return async(t,e)=>{const r=t.action.context?.signer;if(!r)return!0;const n=r.signatures;if(n.length===0)return!1;const o=n[n.length-1],[a,i,s,l,c]=o;if(i!==e)return!1;const d=nf([a,i,s,l]),h=of(c),f=await af(e);return await crypto.subtle.verify({name:"ECDSA",hash:"SHA-256"},f,h.buffer,d.buffer)}}function nf(t){const e=t.join(""),r=`Signed Operation:
|
|
7
|
+
`+e.length.toString();return new TextEncoder().encode(r+e)}function of(t){const e=t.startsWith("0x")?t.slice(2):t,r=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)r[n/2]=parseInt(e.substring(n,n+2),16);return r}async function af(t){const e=sf(t);return crypto.subtle.importKey("raw",e.buffer,{name:"ECDSA",namedCurve:"P-256"},!0,["verify"])}function sf(t){const e=t.split(":");if(e.length<3||e[0]!=="did"||e[1]!=="key")throw new Error(`Invalid DID format: ${t}`);const r=e[2];if(!r.startsWith("z"))throw new Error(`Unsupported multibase encoding: ${r[0]}`);const n=lf(r.slice(1));if(n[0]!==128||n[1]!==36)throw new Error("Not a P-256 public key multicodec");const o=n.slice(2);return cf(o)}function lf(t){const e="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",r=new Map;for(let o=0;o<e.length;o++)r.set(e[o],o);if(t.length===0)return new Uint8Array(0);const n=[0];for(const o of t){const a=r.get(o);if(a===void 0)throw new Error(`Invalid base58 character: ${o}`);let i=a;for(let s=0;s<n.length;s++)i+=n[s]*58,n[s]=i&255,i>>=8;for(;i>0;)n.push(i&255),i>>=8}for(const o of t){if(o!=="1")break;n.push(0)}return new Uint8Array(n.reverse())}function cf(t){if(t.length!==33)throw new Error(`Invalid compressed key length: ${t.length}`);const e=t[0];if(e!==2&&e!==3)throw new Error(`Invalid compression prefix: ${e}`);const r=BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n=BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),o=BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b");let a=BigInt(0);for(let f=1;f<t.length;f++)a=a<<BigInt(8)|BigInt(t[f]);const i=(So(a,BigInt(3),r)+n*a+o)%r;let s=So(i,(r+BigInt(1))/BigInt(4),r);s%BigInt(2)===BigInt(0)!==(e===2)&&(s=r-s);const u=new Uint8Array(65);u[0]=4;const d=No(a,32),h=No(s,32);return u.set(d,1),u.set(h,33),u}function So(t,e,r){let n=BigInt(1);for(t=t%r;e>BigInt(0);)e%BigInt(2)===BigInt(1)&&(n=n*t%r),e=e>>BigInt(1),t=t*t%r;return n}function No(t,e){const r=new Uint8Array(e);for(let n=e-1;n>=0;n--)r[n]=Number(t&BigInt(255)),t=t>>BigInt(8);return r}const bo=[],uf=()=>({defaultDrives:{remoteDrives:bo.map(e=>({url:e,options:{sharingType:"PUBLIC",availableOffline:!0,listeners:[{block:!0,callInfo:{data:e,name:"switchboard-push",transmitterType:"SwitchboardPush"},filter:{branch:["main"],documentId:["*"],documentType:["*"],scope:["global"]},label:"Switchboard Sync",listenerId:"1",system:!0}],triggers:[]}})),removeOldRemoteDrives:Zd(bo)}});function df(t){return new Pi(t)}function ff(t,e,r){return new Ai(t).withStorage(e).withCache(new Ti).withQueueManager(new Ii).withOptions({...r,...uf()}).build()}async function hf(t,e,r){const n={signer:new tf(r),verifier:rf()},o=new Zi("idb://reactor",{relaxedDurability:!0});return{...await new Qi().withSigner(n).withReactorBuilder(new es().withDocumentModels(t).withLegacyStorage(e).withSync(new ts().withChannelFactory(new rs)).withFeatures({legacyStorageEnabled:!0}).withKysely(new ns({dialect:new os(o)}))).buildModule(),pg:o}}const pf=se.routerBasename,gf=[pf,"service-worker.js"].join("/").replace(/\/{2,}/gm,"/");class mf{ready=!1;debug=!1;registration=null;constructor(e=!1){this.debug=e}setDebug(e){this.debug=e}#t(e){this.debug&&console.log("ServiceWorker message: ",e);const r="type"in e.data?e:null;switch(r?.data.type){case"NEW_VERSION_AVAILABLE":{if(r.data.version===se.appVersion)return;r.data.requiresHardRefresh&&(this.debug&&console.log("New version available"),window.location.reload());break}default:{console.warn("Unhandled message:",r);break}}}#e(e){this.debug&&console.log("ServiceWorker registered: ",e),navigator.serviceWorker.addEventListener("message",this.#t.bind(this)),this.registration=e,this.ready=!0}async#r(){try{const e=await navigator.serviceWorker.getRegistration();if(e)await e.update(),this.#e(e);else{const n=await navigator.serviceWorker.register(gf);this.#e(n),n.addEventListener("updatefound",()=>{this.#e(n)})}const r=setInterval(async()=>{const n=await navigator.serviceWorker.getRegistration();n?await n.update():(clearInterval(r),this.registerServiceWorker())},se.appVersionCheckInterval)}catch(e){console.error("ServiceWorker registration failed: ",e)}}registerServiceWorker(e=!1){if(this.debug=e,!("serviceWorker"in navigator)){console.warn("Service Worker not available");return}window.addEventListener("load",()=>{this.#r().catch(console.error)})}}const vf=new mf,Ef=250,yf=({delay:t=Ef})=>{const e=typeof window>"u",r=typeof document<"u"&&document.body.getAttribute("data-show-loader")==="true",[n,o]=g.useState(!t||r);return g.useEffect(()=>{const a=setTimeout(()=>{o(!0)},t);return()=>clearTimeout(a)},[]),y.jsxs("div",{className:`skeleton-loader absolute inset-0 z-10 flex items-center justify-center ${n?"":"hidden"}`,children:[y.jsx("div",{className:"animate-pulse overflow-hidden rounded-full shadow-lg",children:y.jsx(ji,{})}),e?y.jsx("script",{dangerouslySetInnerHTML:{__html:`setTimeout(() => {
|
|
8
|
+
document.querySelector('.skeleton-loader')?.classList.remove('hidden');
|
|
9
|
+
document.body.setAttribute('data-show-loader', 'true');
|
|
10
|
+
}, ${t})`}}):null]})},_f=()=>{const t=typeof window>"u",e=!t&&window.location.pathname===Jd();return y.jsxs("div",{className:"flex h-screen",children:[y.jsx($o,{className:"animate-pulse",onLogin:void 0,onDisconnect:void 0,onClickSettings:void 0,address:void 0}),y.jsx(zo,{containerClassName:t||!e?"hidden home-screen":void 0,children:null}),t?y.jsx("script",{dangerouslySetInnerHTML:{__html:`
|
|
11
|
+
const baseEl = document.querySelector('base');
|
|
12
|
+
const href = baseEl?.getAttribute('href');
|
|
13
|
+
const basePath = href || '/';
|
|
14
|
+
if (window.location.pathname === basePath) {
|
|
15
|
+
document.querySelector('.home-screen')?.classList.remove('hidden')
|
|
16
|
+
}`}}):null,y.jsx(yf,{})]})};function Cf({children:t}){return y.jsx(y.Fragment,{children:t})}const Sf=({children:t})=>(wd(),t),Nf=()=>(g.useEffect(()=>{vf.registerServiceWorker(!1)},[]),y.jsx(Sf,{children:y.jsx(Bi,{children:y.jsxs(Cf,{children:[y.jsx(Fi,{position:"bottom-right",containerId:"connect"}),y.jsx(Dp,{}),y.jsx(Gd,{})]})})})),bf={cancel:"Cancel",delete:"Delete",continue:"Continue",empty:"Empty",create:"Create",save:"Save",export:"Export",reload:"Reload",reloadConnect:"Click here to reload Connect"},Rf={placeholder:"Search Powerhouse",filterLabel:"File type"},xf={sections:{folders:{title:"Folders",empty:"No folders 🗂️"},documents:{title:"Documents and files",empty:"No documents or files 📄"}}},Df={options:{switchboardLink:"Switchboard Link"}},wf={deleteItem:{folder:{header:"Delete “{{item}}” folder?",body:"Are you sure you want to delete this folder? All files and subfolders within it will be removed."},file:{header:"Delete “{{item}}” file?",body:"Are you sure you want to delete this file?"}},deleteDrive:{title:'Delete "{{label}}" drive?',body:"Are you sure you want to delete this drive? All files and subfolders within it will be removed. Do you want to proceed?",inputPlaceholder:"Enter drive name..."},upgradeDrive:{header:"Upgrade to cloud drive",body:"You are moving files from a private to a shared drive. These files will become accessible to others in the shared drive.Do you want to proceed?"},createDocument:{header:"Create a new document",placeholder:"Document name"},connectSettings:{title:"Settings",body:"These settings will apply to all drives.",clearStorage:{button:"Clear Storage",description:"Delete previous session data",confirmation:{title:"Clear Storage",body:"Are you sure you want to clear the storage? This will remove all previous session data.",clearButton:"Clear Storage"}},enabledDocumentTypes:{title:"Document Models",description:"Documents enabled",allSelected:"All documents are selected"}},exportDocumentWithErrors:{title:"Your document contains errors",body:"Your document contains structure errors. Do you want to export it anyway?"},disclaimer:{title:"Disclaimer",body:"All content provided herein our website, hyperlinked sites, associated applications, forums, blogs, social media accounts and other platforms (“Site”) is for your general information only, procured from third party sources. We make no warranties of any kind in relation to our content, including but not limited to accuracy and updatedness. No part of the content that we provide constitutes financial advice, legal advice or any other form of advice meant for your specific reliance for any purpose. Any use or reliance on our content is solely at your own risk and discretion. You should conduct your own research, review, analyse and verify our content before relying on them. Trading is a highly risky activity that can lead to major losses, please therefore consult your financial advisor before making any decision. No content on our Site is meant to be a solicitation or offer."},cookiesPolicy:{title:"Cookies Policy",body:"<subtitle>Use of Cookies and Similar Technologies</subtitle><p>The Site is using cookies. Cookies are small text files that are placed on your computer by websites that you visit. They are widely used in order to make websites work, or work more efficiently, as well as to provide information to the owners of the site. Cookies are typically stored on your computer´s hard drive.Information collected from cookies is used by us to evaluate the effectiveness of our Site and analyze trends. The information collected from cookies allows us to determine such things as which parts of the Site are most visited and difficulties our visitors may experience in accessing the SIte. With this knowledge, we can improve the quality of your experience on the Site by recognizing and delivering more of the most desired features and information, as well as by resolving access difficulties.</p><p>We use third party service providers, to assist us in better understanding the use of our Site. Our service providers will place cookies on the hard drive of your computer (or use similar technologies) and will receive information that we select that will educate us on such things as how visitors navigate around our Site. This information is aggregated to provide statistical data about our users browsing actions and patterns, and does not personally identify individuals. This information may include:</p><p>Computer or mobile device information, Website usage information, such as:<list></p><bullet>Page views,</bullet><bullet>Button clicks,</bullet><bullet>Input form changes (without the values being entered),</bullet><bullet>Errors.</bullet></list><p>Our service providers analyses this information and provides us with aggregate reports. The information and analysis provided by our service providers will be used to assist us in better understanding our visitors interests in our Site and how to better serve those interests. If you want to avoid using cookies altogether, you can disable cookies in your browser. However, disabling cookies might make it impossible for you to use certain features of the Site. Your use of the Site with a browser that is configured to accept cookies constitutes an acceptance of our and third-party cookies.</p>"}},Of={deleteDriveSuccess:"Drive successfully deleted",deleteFolderSuccess:"Folder deleted",fileDeleteSuccess:"File deleted",addDriveSuccess:"New drive successfully added",driveSyncSuccess:"Drive synced successfully",driveSyncError:"Error synchronizing drive {{drive}}",driveSyncConflict:"Conflict error detected in {{drive}}",reloadApp:"It seems like you're running an outdated version of the app. Please reload Connect to get the latest version."},Lf={cookiePolicy:"Cookie Policy",termsOfUse:"Terms of Use",disclaimer:"Disclaimer",builtWith:"Built with <icon /> Powerhouse"},Pf={message:"This website uses cookies for analytic purposes only. Cookies are anonymous and do not link to user data. We collect information to improve the user experience and validate UI changes. You can still use the page without cookies. For more information, please read our <a>cookies policy.</a>",accept:"Accept configured cookies",reject:"Reject all cookies",cookies:{functional:"Functional cookies",analytics:"Analytics cookies"}},Af={common:bf,searchbar:Rf,folderView:xf,files:Df,modals:wf,notifications:Of,footer:Lf,cookieBanner:Pf},Tf={en:{code:"en",name:"English",translation:Af}};ge.use(Ac).init({resources:Tf,fallbackLng:"en",debug:!1,interpolation:{escapeValue:!1}}).catch(t=>{console.error(t)});const If=(t,e)=>t.some(r=>r.id===e&&r.value),kf=()=>{const{t}=ga(void 0,{useSuspense:!0,i18n:ge}),[e,r]=Yc(),[,n]=Zr(),o=[{id:"analytics-cookie",label:t("cookieBanner.cookies.analytics"),value:!0}],a=s=>{r(!1),If(s,"analytics-cookie")&&n(l=>({...l,analytics:!0}))},i=()=>{r(!1),n(()=>({analytics:!1,functional:!1,marketing:!1}))};return e?y.jsxs("div",{className:"absolute inset-0 z-[10000] backdrop-blur-sm",children:[y.jsx("div",{className:"absolute inset-0 bg-black opacity-15"}),y.jsx("div",{className:"absolute inset-x-0 bottom-0 flex justify-center bg-white px-10 pb-16 pt-10 shadow-lg",children:y.jsx(Vi,{className:"max-w-[1024px]",cookies:o,onSubmit:a,onReject:i,submitLabel:t("cookieBanner.accept"),rejectLabel:t("cookieBanner.reject"),children:y.jsx("p",{className:"font-semibold text-gray-500",children:y.jsx(Ic,{i18nKey:"cookieBanner.message",components:{a:y.jsx("a",{onClick:()=>Be({type:"cookiesPolicy"}),className:"cursor-pointer text-gray-900 hover:underline"},"cookieBanner.message-link")}},"cookieBanner.message")})})})]}):null};function Mf(){const[t]=Yo(),[e]=Xr(),r=as(e?.header.id),n=is(t),o=ss(t),a=ls(),i=qr(),s=u=>{if(us(u).length)Be({type:"exportDocumentWithErrors",documentId:u.header.id});else return ds(u)},l=()=>{if(e)return s(e)},c=g.useMemo(()=>n?async()=>{if(!e?.header.id){console.error("No selected document");return}if(!o){console.error("No remote drive url found");return}const u=i?.address?await a?.getBearerToken(o,i.address,!1,{expiresIn:600}):void 0,d=cs(o,e.header.id,u);try{ef(d)}catch(h){console.error("Error opening switchboard link",h)}}:void 0,[n,o,e]);return e?y.jsx("div",{id:"document-editor-container",className:"flex-1 rounded-2xl bg-gray-50 p-4",children:y.jsx(Uf,{document:e,onClose:()=>Go(r),onExport:l,onOpenSwitchboardLink:c})}):null}const Hf=g.createContext(null),Or={didCatch:!1,error:null};class ln extends g.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Or}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){const{error:e}=this.state;if(e!==null){for(var r,n,o=arguments.length,a=new Array(o),i=0;i<o;i++)a[i]=arguments[i];(r=(n=this.props).onReset)===null||r===void 0||r.call(n,{args:a,reason:"imperative-api"}),this.setState(Or)}}componentDidCatch(e,r){var n,o;(n=(o=this.props).onError)===null||n===void 0||n.call(o,e,r)}componentDidUpdate(e,r){const{didCatch:n}=this.state,{resetKeys:o}=this.props;if(n&&r.error!==null&&jf(e.resetKeys,o)){var a,i;(a=(i=this.props).onReset)===null||a===void 0||a.call(i,{next:o,prev:e.resetKeys,reason:"keys"}),this.setState(Or)}}render(){const{children:e,fallbackRender:r,FallbackComponent:n,fallback:o}=this.props,{didCatch:a,error:i}=this.state;let s=e;if(a){const l={error:i,resetErrorBoundary:this.resetErrorBoundary};if(typeof r=="function")s=r(l);else if(n)s=g.createElement(n,l);else if(o!==void 0)s=o;else throw i}return g.createElement(Hf.Provider,{value:{didCatch:a,error:i,resetErrorBoundary:this.resetErrorBoundary}},s)}}function jf(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return t.length!==e.length||t.some((r,n)=>!Object.is(r,e[n]))}function Xt(t){const[e,r]=g.useState(!1);if(g.useEffect(()=>{setTimeout(()=>{r(!0)},t.loadingTimeout??200)},[t]),!e)return null;const{customEditorLoader:n,...o}=t;return n?y.jsx(y.Fragment,{children:n}):y.jsx(Ui,{...o})}function Bf({error:t}){return y.jsxs("div",{className:"mx-auto flex max-w-[80%] flex-1 flex-col items-center justify-center",children:[y.jsx("h1",{className:"mb-2 text-xl font-semibold",children:"Error"}),y.jsx("i",{children:t instanceof Error?t.message:t}),y.jsx("pre",{children:JSON.stringify(t,null,2)})]})}function Ff(){const[t]=Yo(),[e]=Xr(),r=Jo(t?.header.meta?.preferredEditor),n=fs(),o=r?.Component??n?.Component??Mi.Component;if(!o)throw new Error("No drive editor component found");return y.jsx(ln,{fallbackRender:Bf,children:y.jsx(g.Suspense,{fallback:y.jsx(Xt,{}),children:y.jsx($i,{className:"flex h-full flex-col overflow-auto",children:y.jsx(o,{children:e?y.jsx(Mf,{}):null})})})},t.header.id)}function Va({drive:t}){const e=hs(t),r=t?.state.global.icon;return r?y.jsx("img",{src:r,alt:t.header.name,height:32,width:32}):e==="LOCAL"?y.jsx(kr,{name:"Hdd",size:32}):y.jsx(kr,{name:"Server",size:32})}function Kr({message:t}){return y.jsx("div",{className:"flex size-full items-center justify-center",children:y.jsx("h3",{className:"text-lg font-semibold",children:t})})}function Vf(t){const e=t.error instanceof Error?t.error.message:t.error;return y.jsx(Kr,{message:e})}const Uf=t=>{const{document:e,onClose:r,onExport:n,onOpenSwitchboardLink:o}=t,a=ps(),i=gs(),[s,l]=ms(e.header.id),c=s?.header.id??void 0,u=s?.header.name??void 0,d=s?.header.documentType??void 0,h=s?.header.meta?.preferredEditor??void 0,f=s?.operations.global??[],m=s?.operations.local??[],_=s?.header.revision.global??0,N=s?.header.revision.local??0,C=vs(d),b=Es(h),T=ys(d),R=b??T,w=!s,P=R&&d&&!R.documentTypes.includes(d)&&!R.documentTypes.includes("*"),E=_>0||N>0,D=!!s?.clipboard.length;zd({undo:()=>l(ll()),redo:()=>l(cl()),canUndo:E,canRedo:D}),g.useEffect(()=>()=>{window.documentEditorDebugTools?.clear()},[]);const[$,F]=g.useState(void 0);g.useEffect(()=>{$&&$.documentId!==c&&F(void 0)},[$,c]);const G=(me,de)=>{F({error:me,documentId:c,info:de})};if(P)return y.jsx(Xt,{message:"Loading editor"});if(w)return y.jsx(Xt,{message:"Loading document"});if(!C)return y.jsx(Kr,{message:y.jsxs("div",{className:"text-center leading-10",children:[y.jsxs("p",{children:['Unable to open the document because the document model "',d,'" is not supported.']}),y.jsxs("p",{children:["Go to the"," ",y.jsx("button",{type:"button",className:"cursor-pointer underline",onClick:()=>{Be({type:"settings"})},children:"package manager"})," ","to install this document model"]})]})});if(!R)return y.jsx(Kr,{message:y.jsxs("div",{className:"text-center leading-10",children:[y.jsx("p",{children:"Unable to open the document because no editor has been found"}),y.jsxs("p",{children:["Go to the"," ",y.jsx("button",{type:"button",className:"cursor-pointer underline",onClick:()=>{Be({type:"settings"})},children:"package manager"})," ",'an editor for the "$',d,'" document type']})]})});const J=R.Component;return y.jsx("div",{className:"relative h-full",id:"document-editor-context",children:i?y.jsx(zi,{documentTitle:u??"",documentId:c??"",globalOperations:f,localOperations:m,onClose:()=>_s(!1),documentState:s.state,onCopyState:()=>{en("Copied document state to clipboard",{type:"success"})}},c):y.jsx(g.Suspense,{fallback:y.jsx(Xt,{message:"Loading editor"}),name:"EditorLoader",children:y.jsx(ln,{fallbackRender:Vf,onError:G,children:!$?.error&&y.jsx(J,{context:{readMode:!!a,selectedTimelineRevision:Cs(a?.startDate,a?.endDate,f)},documentId:s.header.id},c)},c)})})},$f=Uo(["Connect","Modals"]);class zf extends g.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,r){$f.error(e,r)}render(){return this.state.hasError?null:this.props.children}}const Kf=g.lazy(()=>pe(()=>import("./AddDriveModal-CMhY7EXt.js"),__vite__mapDeps([3,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.AddDriveModal}))),Wf=g.lazy(()=>pe(()=>import("./ClearStorageModal-DFtnMF37.js"),__vite__mapDeps([20,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.ClearStorageModal}))),Yf=g.lazy(()=>pe(()=>import("./CookiesPolicyModal-wKn_crAz.js"),__vite__mapDeps([21,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.CookiesPolicyModal}))),Gf=g.lazy(()=>pe(()=>import("./CreateDocumentModal-axk-Gv87.js"),__vite__mapDeps([22,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18])).then(t=>({default:t.CreateDocumentModal}))),Jf=g.lazy(()=>pe(()=>import("./DebugSettingsModal-B8EImEik.js"),__vite__mapDeps([23,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.DebugSettingsModal}))),Xf=g.lazy(()=>pe(()=>import("./DeleteDriveModal-CDBGjFVT.js"),__vite__mapDeps([24,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.DeleteDriveModal}))),qf=g.lazy(()=>pe(()=>import("./DeleteItemModal--lW49X7Z.js"),__vite__mapDeps([25,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.DeleteItemModal}))),Zf=g.lazy(()=>pe(()=>import("./DisclaimerModal-Cwlnu4SD.js"),__vite__mapDeps([26,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.DisclaimerModal}))),Qf=g.lazy(()=>pe(()=>import("./DriveSettingsModal-DLSYwH01.js"),__vite__mapDeps([27,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18])).then(t=>({default:t.DriveSettingsModal}))),eh=g.lazy(()=>pe(()=>import("./ExportDocumentWithErrorsModal-sNmpWNiL.js"),__vite__mapDeps([28,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.ExportDocumentWithErrorsModal}))),th=g.lazy(()=>pe(()=>import("./SettingsModal-BI_PIj3P.js"),__vite__mapDeps([29,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.SettingsModal}))),rh=g.lazy(()=>pe(()=>import("./UpgradeDriveModal-fS2KcP5T.js"),__vite__mapDeps([30,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.UpgradeDriveModal}))),nh=g.lazy(()=>pe(()=>import("./index-CJrSFr5V.js"),__vite__mapDeps([31,4,5,6,0,1,2,7,8,9,10,11,12,13,14,15,16,17,18])).then(t=>({default:t.InspectorModal}))),oh={addDrive:Kf,clearStorage:Wf,cookiesPolicy:Yf,createDocument:Gf,debugSettings:Jf,deleteDrive:Xf,deleteItem:qf,disclaimer:Zf,driveSettings:Qf,exportDocumentWithErrors:eh,inspector:nh,settings:th,upgradeDrive:rh};function ah(){const t=Ss();if(!t?.type)return null;const e=oh[t.type];return e?y.jsx(zf,{children:y.jsx(g.Suspense,{fallback:null,children:y.jsx(e,{})})}):null}function ih(t){return t.documentModel.global}function sh(){const{isAllowedToCreateDocuments:t}=Ns(),r=bs()?.filter(n=>n.documentModel.global.id!=="powerhouse/document-drive");return t?y.jsxs("div",{className:"px-6 py-4",children:[y.jsx("h3",{className:"mb-3 text-xl font-bold text-gray-600",children:"New document"}),y.jsx("div",{className:"flex w-full flex-wrap gap-4",children:r?.map(n=>{const o=ih(n);return y.jsx(ea,{color:"light",title:o.name,"aria-description":o.description,onClick:()=>Rs(o.id),children:y.jsx("span",{className:"text-sm",children:o.name})},o.id)})})]}):null}const Nt=8,Lr=256,Ro=48,lh=420;function ch(){const t=g.useRef(null),r=sl().innerWidth-lh,o=Xo().filter(h=>xs(h)),a=Math.floor(r/(Lr+Nt))||1,i=Math.ceil(o.length/a),s=Nn({count:i,getScrollElement:()=>t.current,estimateSize:h=>h>0?Ro+Nt:Ro,overscan:5}),l=Nn({horizontal:!0,count:a,getScrollElement:()=>t.current,estimateSize:h=>h>0?Lr+Nt:Lr,overscan:5}),c=(h,f)=>h*a+f,u=(h,f)=>{const m=c(h,f);return o[m]||null};if(o.length===0)return y.jsx("div",{className:"mb-8 text-sm text-gray-400",children:"No documents or files 📄"});const d=(h,f)=>{const m=u(h,f);return m?y.jsx("div",{style:{marginLeft:f===0?0:Nt},children:y.jsx(Ki,{fileNode:m},m.id)}):null};return y.jsx("div",{ref:t,style:{width:"100%",overflow:"auto"},children:y.jsx("div",{style:{height:`${s.getTotalSize()}px`,width:`${l.getTotalSize()}px`,position:"relative"},children:s.getVirtualItems().map(h=>y.jsx(Vo.Fragment,{children:l.getVirtualItems().map(f=>y.jsx("div",{style:{position:"absolute",top:0,left:0,marginTop:h.index===0?0:Nt,width:`${f.size}px`,height:`${h.size}px`,transform:`translateX(${f.start}px) translateY(${h.start}px)`},children:d(h.index,f.index)},f.key))},h.key))})})}function Se({children:t,className:e,...r}){return y.jsx(Se.Container,{className:e,...r,children:t})}Se.Container=function({children:e,className:r,containerProps:n,...o}){return y.jsx("div",{className:At("flex grow flex-col overflow-auto rounded-2xl bg-gray-50 p-2",r),...n,...o,children:e})};Se.Header=function({children:e,className:r,containerProps:n,...o}){return y.jsx("div",{className:At("flex-0",r),...n,...o,children:e})};Se.Content=function({children:e,className:r,containerProps:n,...o}){return y.jsx("div",{className:At("mb-5 flex-1 px-4",r),...n,...o,children:e})};Se.ContentSection=function({title:e,children:r,className:n,containerProps:o,...a}){return y.jsxs("div",{className:At(n),...o,...a,children:[e&&y.jsx("div",{className:"mb-4 text-base font-semibold text-gray-600",children:e}),y.jsx("div",{className:"flex flex-wrap gap-2",children:r})]})};Se.Footer=function({children:e,className:r,containerProps:n,...o}){return y.jsx("div",{className:At("flex-0",r),...n,...o,children:e})};function uh(t){const{className:e}=t,r=Xo(),n=qo(),o=r.filter(s=>Ds(s)),{isDropTarget:a,dropProps:i}=Ko({target:n});return y.jsxs("div",{className:gl("rounded-md border-2 border-transparent p-2",a&&"border-dashed border-blue-100",e),...i,children:[y.jsx(Se.ContentSection,{title:"Folders",className:"mb-4",children:o.length>0?o.map(s=>y.jsx(Wi,{folderNode:s},s.id)):y.jsx("div",{className:"mb-8 text-sm text-gray-400",children:"No documents or files 📄"})}),y.jsx(Se.ContentSection,{title:"Documents and files",children:y.jsx("div",{className:"w-full",children:y.jsx(ch,{})})})]})}const dh={allowedDocumentTypes:[],isDragAndDropEnabled:!0};function Ua(t){ws(dh);const{className:e,children:r}=t,{isDropTarget:n,dropProps:o}=Ko(),a=!!r;return y.jsxs(Se,{className:e,children:[!a&&y.jsx(Se.Header,{children:y.jsx(Yi,{})}),a?r:y.jsx(Se.Content,{...o,className:n?"rounded-xl bg-blue-100":"",children:y.jsx(uh,{})}),!a&&y.jsx(Se.Footer,{children:y.jsx(sh,{})})]})}const Qp=Object.freeze(Object.defineProperty({__proto__:null,default:Ua},Symbol.toStringTag,{value:"Module"}));function fh(){return{id:Os,name:"Generic Drive Explorer",documentTypes:["powerhouse/document-drive"],Component:Ua}}function hh(){return{id:"document-model-editor-v2",name:"Document Model Editor",documentTypes:["powerhouse/document-model"],Component:Di}}async function ph(){const t=$t.documentModel.global,e=t.name,r=t.id,n=r,o=t.extension,a=t.specifications,i=$t.reducer,s=$t.actions,l=$t.utils;return{id:n,name:e,documentType:r,extension:o,specifications:a,reducer:i,actions:s,utils:l,documentModel:ta(ra(),t)}}async function gh(){const t=Ut.documentModel.global,e=t.name,r=t.id,n=r,o=t.extension,a=t.specifications,i=Ut.reducer,s=Ut.actions,l=Ut.utils;return{id:n,name:e,documentType:r,extension:o,specifications:a,reducer:i,actions:s,utils:l,documentModel:ta(ra(),t)}}async function mh(){const t=await ph(),e=await gh(),r=hh(),n=fh();return{id:Ls,name:"Common",description:"Common",category:"Common",author:{name:"Powerhouse",website:"https://powerhousedao.com"},modules:{documentModelModules:[t,e],editorModules:[r,n]}}}const{externalPackagesEnabled:vh}=se;function Eh(t){return t.loadExternalPackages().then(e=>e.map(Wo))}async function yh(){try{if(!vh)return[];const t=await pe(()=>import("./_virtual_ph_external-packages-CM1tCR4L.js"),[]);return Eh(t)}catch(t){return console.error(t),[]}}var _h=Object.defineProperty,Ch=Object.defineProperties,Sh=Object.getOwnPropertyDescriptors,xo=Object.getOwnPropertySymbols,Nh=Object.prototype.hasOwnProperty,bh=Object.prototype.propertyIsEnumerable,Do=(t,e,r)=>e in t?_h(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Pr=(t,e)=>{for(var r in e||(e={}))Nh.call(e,r)&&Do(t,r,e[r]);if(xo)for(var r of xo(e))bh.call(e,r)&&Do(t,r,e[r]);return t},Ar=(t,e)=>Ch(t,Sh(e)),ut=(t,e,r)=>new Promise((n,o)=>{var a=l=>{try{s(r.next(l))}catch(c){o(c)}},i=l=>{try{s(r.throw(l))}catch(c){o(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(a,i);s((r=r.apply(t,e)).next())}),Rh=class{constructor(){this.data=new Map}set(t,e){this.data.set(t,e)}get(t){return this.data.get(t)}has(t){return this.data.has(t)}delete(t){return this.data.delete(t)}clear(){this.data.clear()}},xh={ERROR:"ERROR"},$a=(t=>(t.PROVIDER_NOT_READY="PROVIDER_NOT_READY",t.PROVIDER_FATAL="PROVIDER_FATAL",t.FLAG_NOT_FOUND="FLAG_NOT_FOUND",t.PARSE_ERROR="PARSE_ERROR",t.TYPE_MISMATCH="TYPE_MISMATCH",t.TARGETING_KEY_MISSING="TARGETING_KEY_MISSING",t.INVALID_CONTEXT="INVALID_CONTEXT",t.GENERAL="GENERAL",t))($a||{}),Ye=class za extends Error{constructor(e,r){super(e),Object.setPrototypeOf(this,za.prototype),this.name="OpenFeatureError",this.cause=r?.cause}},Dh=class Ka extends Ye{constructor(e,r){super(e,r),Object.setPrototypeOf(this,Ka.prototype),this.name="FlagNotFoundError",this.code="FLAG_NOT_FOUND"}},Wa=class Ya extends Ye{constructor(e,r){super(e,r),Object.setPrototypeOf(this,Ya.prototype),this.name="GeneralError",this.code="GENERAL"}},wh=class Ga extends Ye{constructor(e,r){super(e,r),Object.setPrototypeOf(this,Ga.prototype),this.name="InvalidContextError",this.code="INVALID_CONTEXT"}},Oh=class Ja extends Ye{constructor(e,r){super(e,r),Object.setPrototypeOf(this,Ja.prototype),this.name="ParseError",this.code="PARSE_ERROR"}},Xa=class qa extends Ye{constructor(e,r){super(e,r),Object.setPrototypeOf(this,qa.prototype),this.name="ProviderFatalError",this.code="PROVIDER_FATAL"}},Za=class Qa extends Ye{constructor(e,r){super(e,r),Object.setPrototypeOf(this,Qa.prototype),this.name="ProviderNotReadyError",this.code="PROVIDER_NOT_READY"}},Lh=class ei extends Ye{constructor(e,r){super(e,r),Object.setPrototypeOf(this,ei.prototype),this.name="TargetingKeyMissingError",this.code="TARGETING_KEY_MISSING"}},Ph=class ti extends Ye{constructor(e,r){super(e,r),Object.setPrototypeOf(this,ti.prototype),this.name="TypeMismatchError",this.code="TYPE_MISMATCH"}},Ah=(t,e)=>{switch(t){case"FLAG_NOT_FOUND":return new Dh(e);case"PARSE_ERROR":return new Oh(e);case"TYPE_MISMATCH":return new Ph(e);case"TARGETING_KEY_MISSING":return new Lh(e);case"INVALID_CONTEXT":return new wh(e);case"PROVIDER_NOT_READY":return new Za(e);case"PROVIDER_FATAL":return new Xa(e);default:return new Wa(e)}},Pt=(t=>(t.NOT_READY="NOT_READY",t.READY="READY",t.ERROR="ERROR",t.STALE="STALE",t.FATAL="FATAL",t.RECONCILING="RECONCILING",t))(Pt||{}),Pe=(t=>(t.Ready="PROVIDER_READY",t.Error="PROVIDER_ERROR",t.ConfigurationChanged="PROVIDER_CONFIGURATION_CHANGED",t.ContextChanged="PROVIDER_CONTEXT_CHANGED",t.Reconciling="PROVIDER_RECONCILING",t.Stale="PROVIDER_STALE",t))(Pe||{}),Th={READY:"PROVIDER_READY",ERROR:"PROVIDER_ERROR",FATAL:"PROVIDER_ERROR",STALE:"PROVIDER_STALE",RECONCILING:"PROVIDER_RECONCILING",NOT_READY:void 0},ri=(t,e)=>!e&&t==="PROVIDER_READY"||Th[e]===t,ni=class{error(...t){console.error(...t)}warn(...t){console.warn(...t)}info(){}debug(){}},Ih=["error","warn","info","debug"],cn=class{constructor(t){this.fallbackLogger=new ni;try{for(const e of Ih)if(!t[e]||typeof t[e]!="function")throw new Error(`The provided logger is missing the ${e} method.`);this.logger=t}catch(e){console.error(e),console.error("Falling back to the default logger."),this.logger=this.fallbackLogger}}error(...t){this.log("error",...t)}warn(...t){this.log("warn",...t)}info(...t){this.log("info",...t)}debug(...t){this.log("debug",...t)}log(t,...e){try{this.logger[t](...e)}catch{this.fallbackLogger[t](...e)}}},kh=class{constructor(t){this.globalLogger=t,this._handlers={PROVIDER_CONFIGURATION_CHANGED:new WeakMap,PROVIDER_CONTEXT_CHANGED:new WeakMap,PROVIDER_READY:new WeakMap,PROVIDER_ERROR:new WeakMap,PROVIDER_STALE:new WeakMap,PROVIDER_RECONCILING:new WeakMap}}emit(t,e){this.eventEmitter.emit(t,e)}addHandler(t,e){const r=o=>ut(this,null,function*(){var a;try{yield e(o)}catch(i){(a=this._logger)==null||a.error("Error running event handler:",i)}}),n=this._handlers[t].get(e);this._handlers[t].set(e,[...n||[],r]),this.eventEmitter.on(t,r)}removeHandler(t,e){const r=this._handlers[t].get(e);if(r){const n=r.pop();n&&this.eventEmitter.removeListener(t,n)}}removeAllHandlers(t){t?this.eventEmitter.removeAllListeners(t):this.eventEmitter.removeAllListeners()}getHandlers(t){return this.eventEmitter.listeners(t)}setLogger(t){return this._eventLogger=new cn(t),this}get _logger(){var t,e;return(e=this._eventLogger)!=null?e:(t=this.globalLogger)==null?void 0:t.call(this)}};function Mh(t){return typeof t=="string"}function dt(t){return Mh(t)?t:void 0}function Hh(t){return typeof t=="object"}function Ce(t){return Hh(t)?t:void 0}function wo(t){return typeof t<"u"&&t!==null}var Wr=class{constructor(t,e,r){this._provider=t,this._status=e,this._pendingContextChanges=0;var n,o,a;(n=t.events)==null||n.addHandler("PROVIDER_READY",()=>{this._status=r.READY}),(o=t.events)==null||o.addHandler("PROVIDER_STALE",()=>{this._status=r.STALE}),(a=t.events)==null||a.addHandler("PROVIDER_ERROR",i=>{i?.errorCode==="PROVIDER_FATAL"?this._status=r.FATAL:this._status=r.ERROR})}get provider(){return this._provider}set provider(t){this._provider=t}get status(){return this._status}set status(t){this._status=t}get allContextChangesSettled(){return this._pendingContextChanges===0}incrementPendingContextChanges(){this._pendingContextChanges++}decrementPendingContextChanges(){this._pendingContextChanges--}},jh=class{constructor(t){this._hooks=[],this._context={},this._logger=new ni,this._clientEventHandlers=new Map,this._domainScopedContext=new Map,this._clientEvents=new Map,this._runsOn=t}addHooks(...t){return this._hooks=[...this._hooks,...t],this}getHooks(){return this._hooks}clearHooks(){return this._hooks=[],this}setLogger(t){return this._logger=new cn(t),this}get providerMetadata(){return this.getProviderMetadata()}getProviderMetadata(t){return this.getProviderForClient(t).metadata}addHandler(t,e,r){[...new Map([[void 0,this._defaultProvider]]),...this._domainScopedProviders].forEach(n=>{var o;const a=n[0],i=n[1].provider,s=n[1].status;if(ri(t,s))try{e({domain:a,providerName:i.metadata.name})}catch(c){(o=this._logger)==null||o.error("Error running event handler:",c)}}),this._apiEmitter.addHandler(t,e),r?.signal&&typeof r.signal.addEventListener=="function"&&r.signal.addEventListener("abort",()=>{this.removeHandler(t,e)})}removeHandler(t,e){this._apiEmitter.removeHandler(t,e)}clearHandlers(){this._apiEmitter.removeAllHandlers()}getHandlers(t){return this._apiEmitter.getHandlers(t)}setAwaitableProvider(t,e){var r,n,o,a,i,s,l,c;const u=dt(t),d=(r=Ce(t))!=null?r:Ce(e);if(!d){this._logger.debug("No provider defined, ignoring setProvider call");return}const h=this.getProviderForClient(u),f=d.metadata.name;if(h===d){this._logger.debug("Provider is already set, ignoring setProvider call");return}if(!d.runsOn)this._logger.debug(`Provider '${d.metadata.name}' has not defined its intended use.`);else if(d.runsOn!==this._runsOn)throw new Wa(`Provider '${d.metadata.name}' is intended for use on the ${d.runsOn}.`);const m=this.getAssociatedEventEmitters(u);let _;const N=new Wr(d,this._statusEnumType.NOT_READY,this._statusEnumType);return typeof d.initialize=="function"&&!this.allProviders.includes(d)?_=(i=(a=(o=d.initialize)==null?void 0:o.call(d,u?(n=this._domainScopedContext.get(u))!=null?n:this._context:this._context))==null?void 0:a.then(()=>{var C;N.status=this._statusEnumType.READY,this.getAssociatedEventEmitters(u).forEach(b=>{b?.emit("PROVIDER_READY",{clientName:u,domain:u,providerName:f})}),(C=this._apiEmitter)==null||C.emit("PROVIDER_READY",{clientName:u,domain:u,providerName:f})}))==null?void 0:i.catch(C=>{var b;throw C?.code==="PROVIDER_FATAL"?N.status=this._statusEnumType.FATAL:N.status=this._statusEnumType.ERROR,this.getAssociatedEventEmitters(u).forEach(T=>{T?.emit("PROVIDER_ERROR",{clientName:u,domain:u,providerName:f,message:C?.message})}),(b=this._apiEmitter)==null||b.emit("PROVIDER_ERROR",{clientName:u,domain:u,providerName:f,message:C?.message}),C}):(N.status=this._statusEnumType.READY,m.forEach(C=>{C?.emit("PROVIDER_READY",{clientName:u,domain:u,providerName:f})}),(s=this._apiEmitter)==null||s.emit("PROVIDER_READY",{clientName:u,domain:u,providerName:f})),u?this._domainScopedProviders.set(u,N):this._defaultProvider=N,this.transferListeners(h,d,u,m),this.allProviders.includes(h)||(c=(l=h?.onClose)==null?void 0:l.call(h))==null||c.catch(C=>{this._logger.error(`error closing provider: ${C?.message}, ${C?.stack}`)}),_}getProviderForClient(t){var e,r;return t?(r=(e=this._domainScopedProviders.get(t))==null?void 0:e.provider)!=null?r:this._defaultProvider.provider:this._defaultProvider.provider}buildAndCacheEventEmitterForClient(t){const e=this._clientEvents.get(t);if(e)return e;const r=this._createEventEmitter();this._clientEvents.set(t,r);const n=this.getProviderForClient(t);return Object.values(Pe).forEach(o=>{var a;return(a=n.events)==null?void 0:a.addHandler(o,i=>ut(this,null,function*(){r.emit(o,Ar(Pr({},i),{clientName:t,domain:t,providerName:n.metadata.name}))}))}),r}getUnboundEmitters(){const t=[...this._domainScopedProviders.keys()];return[...[...this._clientEvents.keys()].filter(wo).filter(n=>!t.includes(n)).map(n=>this._clientEvents.get(n)),this._clientEvents.get(void 0)].filter(wo)}getAssociatedEventEmitters(t){return t?[this.buildAndCacheEventEmitterForClient(t)]:this.getUnboundEmitters()}transferListeners(t,e,r,n){var o;(o=this._clientEventHandlers.get(r))==null||o.forEach(i=>{var s;return(s=t.events)==null?void 0:s.removeHandler(...i)});const a=Object.values(Pe).map(i=>[i,l=>ut(this,null,function*(){n.forEach(c=>{c?.emit(i,Ar(Pr({},l),{clientName:r,domain:r,providerName:e.metadata.name}))}),this._apiEmitter.emit(i,Ar(Pr({},l),{clientName:r,domain:r,providerName:e.metadata.name}))})]);this._clientEventHandlers.set(r,a),a.forEach(i=>{var s;return(s=e.events)==null?void 0:s.addHandler(...i)})}close(){return ut(this,null,function*(){var t,e;try{yield(e=(t=this==null?void 0:this._defaultProvider.provider)==null?void 0:t.onClose)==null?void 0:e.call(t)}catch(n){this.handleShutdownError(this._defaultProvider.provider,n)}const r=Array.from(this._domainScopedProviders);yield Promise.all(r.map(n=>ut(this,[n],function*([,o]){var a,i;try{yield(i=o==null?void 0:(a=o.provider).onClose)==null?void 0:i.call(a)}catch(s){this.handleShutdownError(o?.provider,s)}})))})}clearProvidersAndSetDefault(t){return ut(this,null,function*(){try{yield this.close()}catch{this._logger.error("Unable to cleanly close providers. Resetting to the default configuration.")}finally{this._domainScopedProviders.clear(),this._defaultProvider=new Wr(t,this._statusEnumType.NOT_READY,this._statusEnumType)}})}get allProviders(){return[...[...this._domainScopedProviders.values()].map(t=>t.provider),this._defaultProvider.provider]}handleShutdownError(t,e){this._logger.error(`Error during shutdown of provider ${t.metadata.name}: ${e}`),this._logger.error(e?.stack)}},Bh=Object.create,un=Object.defineProperty,Fh=Object.defineProperties,Vh=Object.getOwnPropertyDescriptor,Uh=Object.getOwnPropertyDescriptors,oi=Object.getOwnPropertyNames,Oo=Object.getOwnPropertySymbols,ai=Object.getPrototypeOf,ii=Object.prototype.hasOwnProperty,$h=Object.prototype.propertyIsEnumerable,zh=Reflect.get,Lo=(t,e,r)=>e in t?un(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Tr=(t,e)=>{for(var r in e||(e={}))ii.call(e,r)&&Lo(t,r,e[r]);if(Oo)for(var r of Oo(e))$h.call(e,r)&&Lo(t,r,e[r]);return t},Kh=(t,e)=>Fh(t,Uh(e)),Wh=(t,e)=>function(){return e||(0,t[oi(t)[0]])((e={exports:{}}).exports,e),e.exports},Yh=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of oi(e))!ii.call(t,o)&&o!==r&&un(t,o,{get:()=>e[o],enumerable:!(n=Vh(e,o))||n.enumerable});return t},Gh=(t,e,r)=>(r=t!=null?Bh(ai(t)):{},Yh(un(r,"default",{value:t,enumerable:!0}),t)),Jh=(t,e,r)=>zh(ai(t),r,e),ct=(t,e,r)=>new Promise((n,o)=>{var a=l=>{try{s(r.next(l))}catch(c){o(c)}},i=l=>{try{s(r.throw(l))}catch(c){o(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(a,i);s((r=r.apply(t,e)).next())}),Xh=Wh({"../../node_modules/eventemitter3/index.js"(t,e){var r=Object.prototype.hasOwnProperty,n="~";function o(){}Object.create&&(o.prototype=Object.create(null),new o().__proto__||(n=!1));function a(c,u,d){this.fn=c,this.context=u,this.once=d||!1}function i(c,u,d,h,f){if(typeof d!="function")throw new TypeError("The listener must be a function");var m=new a(d,h||c,f),_=n?n+u:u;return c._events[_]?c._events[_].fn?c._events[_]=[c._events[_],m]:c._events[_].push(m):(c._events[_]=m,c._eventsCount++),c}function s(c,u){--c._eventsCount===0?c._events=new o:delete c._events[u]}function l(){this._events=new o,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],d,h;if(this._eventsCount===0)return u;for(h in d=this._events)r.call(d,h)&&u.push(n?h.slice(1):h);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},l.prototype.listeners=function(u){var d=n?n+u:u,h=this._events[d];if(!h)return[];if(h.fn)return[h.fn];for(var f=0,m=h.length,_=new Array(m);f<m;f++)_[f]=h[f].fn;return _},l.prototype.listenerCount=function(u){var d=n?n+u:u,h=this._events[d];return h?h.fn?1:h.length:0},l.prototype.emit=function(u,d,h,f,m,_){var N=n?n+u:u;if(!this._events[N])return!1;var C=this._events[N],b=arguments.length,T,R;if(C.fn){switch(C.once&&this.removeListener(u,C.fn,void 0,!0),b){case 1:return C.fn.call(C.context),!0;case 2:return C.fn.call(C.context,d),!0;case 3:return C.fn.call(C.context,d,h),!0;case 4:return C.fn.call(C.context,d,h,f),!0;case 5:return C.fn.call(C.context,d,h,f,m),!0;case 6:return C.fn.call(C.context,d,h,f,m,_),!0}for(R=1,T=new Array(b-1);R<b;R++)T[R-1]=arguments[R];C.fn.apply(C.context,T)}else{var w=C.length,P;for(R=0;R<w;R++)switch(C[R].once&&this.removeListener(u,C[R].fn,void 0,!0),b){case 1:C[R].fn.call(C[R].context);break;case 2:C[R].fn.call(C[R].context,d);break;case 3:C[R].fn.call(C[R].context,d,h);break;case 4:C[R].fn.call(C[R].context,d,h,f);break;default:if(!T)for(P=1,T=new Array(b-1);P<b;P++)T[P-1]=arguments[P];C[R].fn.apply(C[R].context,T)}}return!0},l.prototype.on=function(u,d,h){return i(this,u,d,h,!1)},l.prototype.once=function(u,d,h){return i(this,u,d,h,!0)},l.prototype.removeListener=function(u,d,h,f){var m=n?n+u:u;if(!this._events[m])return this;if(!d)return s(this,m),this;var _=this._events[m];if(_.fn)_.fn===d&&(!f||_.once)&&(!h||_.context===h)&&s(this,m);else{for(var N=0,C=[],b=_.length;N<b;N++)(_[N].fn!==d||f&&!_[N].once||h&&_[N].context!==h)&&C.push(_[N]);C.length?this._events[m]=C.length===1?C[0]:C:s(this,m)}return this},l.prototype.removeAllListeners=function(u){var d;return u?(d=n?n+u:u,this._events[d]&&s(this,d)):(this._events=new o,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,typeof e<"u"&&(e.exports=l)}}),qh="No-op",Zh=class{constructor(){this.metadata={name:"No-op Provider"}}resolveBooleanEvaluation(t,e){return this.noOp(e)}resolveStringEvaluation(t,e){return this.noOp(e)}resolveNumberEvaluation(t,e){return this.noOp(e)}resolveObjectEvaluation(t,e){return this.noOp(e)}noOp(t){return{value:t,reason:qh}}},Po=new Zh,Qh=Gh(Xh()),Ao=class extends kh{constructor(){super(),this.eventEmitter=new Qh.default}},ep=class{constructor(t,e,r,n,o,a,i){this.providerAccessor=t,this.providerStatusAccessor=e,this.emitterAccessor=r,this.apiContextAccessor=n,this.apiHooksAccessor=o,this.globalLogger=a,this.options=i,this._hooks=[]}get metadata(){var t,e;return{name:(t=this.options.domain)!=null?t:this.options.name,domain:(e=this.options.domain)!=null?e:this.options.name,version:this.options.version,providerMetadata:this.providerAccessor().metadata}}get providerStatus(){return this.providerStatusAccessor()}addHandler(t,e,r){var n;if(this.emitterAccessor().addHandler(t,e),ri(t,this.providerStatus))try{e({clientName:this.metadata.name,domain:this.metadata.domain,providerName:this._provider.metadata.name})}catch(a){(n=this._logger)==null||n.error("Error running event handler:",a)}r?.signal&&typeof r.signal.addEventListener=="function"&&r.signal.addEventListener("abort",()=>{this.removeHandler(t,e)})}removeHandler(t,e){this.emitterAccessor().removeHandler(t,e)}getHandlers(t){return this.emitterAccessor().getHandlers(t)}setLogger(t){return this._clientLogger=new cn(t),this}addHooks(...t){return this._hooks=[...this._hooks,...t],this}getHooks(){return this._hooks}clearHooks(){return this._hooks=[],this}getBooleanValue(t,e,r){return this.getBooleanDetails(t,e,r).value}getBooleanDetails(t,e,r){return this.evaluate(t,this._provider.resolveBooleanEvaluation,e,"boolean",r)}getStringValue(t,e,r){return this.getStringDetails(t,e,r).value}getStringDetails(t,e,r){return this.evaluate(t,this._provider.resolveStringEvaluation,e,"string",r)}getNumberValue(t,e,r){return this.getNumberDetails(t,e,r).value}getNumberDetails(t,e,r){return this.evaluate(t,this._provider.resolveNumberEvaluation,e,"number",r)}getObjectValue(t,e,r){return this.getObjectDetails(t,e,r).value}getObjectDetails(t,e,r){return this.evaluate(t,this._provider.resolveObjectEvaluation,e,"object",r)}track(t,e={}){var r,n,o;try{if(this.shortCircuitIfNotReady(),typeof this._provider.track=="function"){const a=Object.freeze(Tr({},this.apiContextAccessor((r=this==null?void 0:this.options)==null?void 0:r.domain)));return(o=(n=this._provider).track)==null?void 0:o.call(n,t,a,e)}else this._logger.debug("Provider does not support the track function; will no-op.")}catch(a){this._logger.debug("Error recording tracking event.",a)}}evaluate(t,e,r,n,o={}){var a,i;const s=[...this.apiHooksAccessor(),...this.getHooks(),...o.hooks||[],...this._provider.hooks||[]],l=[...s].reverse(),c=Tr({},this.apiContextAccessor((a=this==null?void 0:this.options)==null?void 0:a.domain)),u=l.map(()=>Object.freeze({flagKey:t,defaultValue:r,flagValueType:n,clientMetadata:this.metadata,providerMetadata:this._provider.metadata,context:c,logger:this._logger,hookData:new Rh}));let d;try{this.beforeHooks(s,u,o),this.shortCircuitIfNotReady();const h=e.call(this._provider,t,r,c,this._logger),f=Kh(Tr({},h),{flagMetadata:Object.freeze((i=h.flagMetadata)!=null?i:{}),flagKey:t});if(f.errorCode){const m=Ah(f.errorCode,f.errorMessage);this.errorHooks(l,u,m,o),d=this.getErrorEvaluationDetails(t,r,m,f.flagMetadata)}else this.afterHooks(l,u,f,o),d=f}catch(h){this.errorHooks(l,u,h,o),d=this.getErrorEvaluationDetails(t,r,h)}return this.finallyHooks(l,u,d,o),d}beforeHooks(t,e,r){var n;for(const[o,a]of t.entries()){const i=t.length-1-o,s=e[i];Object.freeze(s),Object.freeze(s.context),(n=a?.before)==null||n.call(a,s,Object.freeze(r.hookHints))}}afterHooks(t,e,r,n){var o;for(const[a,i]of t.entries()){const s=e[a];(o=i?.after)==null||o.call(i,s,r,n.hookHints)}}errorHooks(t,e,r,n){var o;for(const[a,i]of t.entries())try{const s=e[a];(o=i?.error)==null||o.call(i,s,r,n.hookHints)}catch(s){this._logger.error(`Unhandled error during 'error' hook: ${s}`),s instanceof Error&&this._logger.error(s.stack),this._logger.error(s?.stack)}}finallyHooks(t,e,r,n){var o;for(const[a,i]of t.entries())try{const s=e[a];(o=i?.finally)==null||o.call(i,s,r,n.hookHints)}catch(s){this._logger.error(`Unhandled error during 'finally' hook: ${s}`),s instanceof Error&&this._logger.error(s.stack),this._logger.error(s?.stack)}}get _provider(){return this.providerAccessor()}get _logger(){return this._clientLogger||this.globalLogger()}shortCircuitIfNotReady(){if(this.providerStatus===Pt.NOT_READY)throw new Za("provider has not yet initialized");if(this.providerStatus===Pt.FATAL)throw new Xa("provider is in an irrecoverable error state")}getErrorEvaluationDetails(t,e,r,n={}){const o=r?.message;return{errorCode:r?.code||$a.GENERAL,errorMessage:o,value:e,reason:xh.ERROR,flagMetadata:Object.freeze(n),flagKey:t}}},To=Symbol.for("@openfeature/web-sdk/api"),Io=globalThis,tp=class Yr extends jh{constructor(){super("client"),this._statusEnumType=Pt,this._apiEmitter=new Ao,this._defaultProvider=new Wr(Po,Pt.NOT_READY,this._statusEnumType),this._domainScopedProviders=new Map,this._createEventEmitter=()=>new Ao}static getInstance(){const e=Io[To];if(e)return e;const r=new Yr;return Io[To]=r,r}getProviderStatus(e){var r,n;return e?(n=(r=this._domainScopedProviders.get(e))==null?void 0:r.status)!=null?n:this._defaultProvider.status:this._defaultProvider.status}setProviderAndWait(e,r,n){return ct(this,null,function*(){const o=dt(e),a=Ce(o?r:e),i=Ce(o?n:r);i&&(o?this._domainScopedContext.set(o,i):this._context=i),yield this.setAwaitableProvider(o,a)})}setProvider(e,r,n){const o=dt(e),a=Ce(o?r:e),i=Ce(o?n:r);i&&(o?this._domainScopedContext.set(o,i):this._context=i);const s=this.setAwaitableProvider(o,a);return Promise.resolve(s).catch(l=>{this._logger.error("Error during provider initialization:",l)}),this}getProvider(e){return this.getProviderForClient(e)}setContext(e,r){return ct(this,null,function*(){var n,o;const a=dt(e),i=(o=(n=Ce(e))!=null?n:Ce(r))!=null?o:{};if(a){const s=this._domainScopedProviders.get(a);if(s){const l=this.getContext(a);this._domainScopedContext.set(a,i),yield this.runProviderContextChangeHandler(a,s,l,i)}else this._domainScopedContext.set(a,i)}else{const s=this._context;this._context=i;const l=Array.from(this._domainScopedProviders.entries()).filter(([u])=>!this._domainScopedContext.has(u)).reduce((u,[d,h])=>(u.push({domain:d,wrapper:h}),u),[]),c=[{domain:void 0,wrapper:this._defaultProvider},...l];yield Promise.all(c.map(u=>this.runProviderContextChangeHandler(u.domain,u.wrapper,s,i)))}})}getContext(e){const r=dt(e);if(r){const n=this._domainScopedContext.get(r);if(n)return n;this._logger.debug(`Unable to find context for '${r}'.`)}return this._context}clearContext(e){return ct(this,null,function*(){const r=dt(e);if(r){const n=this._domainScopedProviders.get(r);if(n){const o=this.getContext(r);this._domainScopedContext.delete(r);const a=this.getContext();yield this.runProviderContextChangeHandler(r,n,o,a)}else this._domainScopedContext.delete(r)}else return this.setContext({})})}clearContexts(){return ct(this,null,function*(){yield this.clearContext(),yield Promise.allSettled(Array.from(this._domainScopedProviders.keys()).map(e=>this.clearContext(e)))})}getClient(e,r){return new ep(()=>this.getProviderForClient(e),()=>this.getProviderStatus(e),()=>this.buildAndCacheEventEmitterForClient(e),n=>this.getContext(n),()=>this.getHooks(),()=>this._logger,{domain:e,version:r})}clearProviders(){return ct(this,null,function*(){yield Jh(Yr.prototype,this,"clearProvidersAndSetDefault").call(this,Po),this._domainScopedContext.clear()})}runProviderContextChangeHandler(e,r,n,o){return ct(this,null,function*(){var a,i,s,l,c,u;const d=((i=(a=r.provider)==null?void 0:a.metadata)==null?void 0:i.name)||"unnamed-provider";try{if(typeof r.provider.onContextChange=="function"){const h=r.provider.onContextChange(n,o);h&&typeof h?.then=="function"&&(r.incrementPendingContextChanges(),r.status=this._statusEnumType.RECONCILING,this.getAssociatedEventEmitters(e).forEach(f=>{f?.emit(Pe.Reconciling,{domain:e,providerName:d})}),(s=this._apiEmitter)==null||s.emit(Pe.Reconciling,{domain:e,providerName:d}),yield h,r.decrementPendingContextChanges())}r.status=this._statusEnumType.READY,r.allContextChangesSettled&&(this.getAssociatedEventEmitters(e).forEach(h=>{h?.emit(Pe.ContextChanged,{clientName:e,domain:e,providerName:d})}),(l=this._apiEmitter)==null||l.emit(Pe.ContextChanged,{clientName:e,domain:e,providerName:d}))}catch(h){if(r.decrementPendingContextChanges(),r.status=this._statusEnumType.ERROR,r.allContextChangesSettled){const f=h,m=`Error running ${d}'s context change handler: ${f?.message}`;(c=this._logger)==null||c.error(`${m}`,h),this.getAssociatedEventEmitters(e).forEach(_=>{_?.emit(Pe.Error,{clientName:e,domain:e,providerName:d,message:m})}),(u=this._apiEmitter)==null||u.emit(Pe.Error,{clientName:e,domain:e,providerName:d,message:m})}}})}},ko=tp.getInstance();class rp{runsOn="client";metadata={name:"QueryParamProvider"};flags;constructor(e){this.flags=new Map;for(const[r,n]of e.entries())this.flags.set(r,n)}resolveBooleanEvaluation(e,r){const n=this.flags.get(e);return n===void 0?{value:r,reason:"DEFAULT"}:{value:n.toLowerCase()==="true"||n==="1",reason:"STATIC",variant:n}}resolveStringEvaluation(e,r){const n=this.flags.get(e);return n===void 0?{value:r,reason:"DEFAULT"}:{value:n,reason:"STATIC",variant:n}}resolveNumberEvaluation(e,r){const n=this.flags.get(e);if(n===void 0)return{value:r,reason:"DEFAULT"};const o=Number(n);return isNaN(o)?{value:r,reason:"ERROR",errorCode:"PARSE_ERROR",errorMessage:`Failed to parse "${n}" as a number`}:{value:o,reason:"STATIC",variant:n}}resolveObjectEvaluation(e,r){const n=this.flags.get(e);if(n===void 0)return{value:r,reason:"DEFAULT"};try{return{value:JSON.parse(n),reason:"STATIC",variant:n}}catch(o){return{value:r,reason:"ERROR",errorCode:"PARSE_ERROR",errorMessage:`Failed to parse JSON: ${o instanceof Error?o.message:String(o)}`}}}}async function np(t){const e=typeof window<"u"?new URLSearchParams(window.location.search):new URLSearchParams,r=new rp(e);await ko.setProviderAndWait(r);const n=new Map,o=ko.getClient();n.set(Mo,o.getBooleanValue(Mo,!0)),n.set(Ho,o.getBooleanValue(Ho,!0)),n.set(jo,o.getBooleanValue(jo,!1));const i=e.has(Ir)?o.getBooleanValue(Ir,!1):se.content.inspectorEnabled;return n.set(Ir,i),n}const Mo="FEATURE_LEGACY_READ_ENABLED",Ho="FEATURE_LEGACY_WRITE_ENABLED",jo="FEATURE_CHANNEL_SYNC_ENABLED",Ir="FEATURE_INSPECTOR_ENABLED";let Gr;function op(t){Gr=t}async function eg(){await Gr?.clear();const t=window.ph?.reactorClientModule?.pg;return t&&await el(t),!!Gr}async function ap(t){const e=await mh(),r=[e,...t];return Jr([e,...t]),r}async function ip(t,e,r){const n=r.find(o=>o.state.local.triggers.find(a=>a.type==="PullResponder"&&a.data?.url===t));if(n)return n;try{return await e.addRemoteDrive(t,{sharingType:"PUBLIC",availableOffline:!0,listeners:[{block:!0,callInfo:{data:t,name:"switchboard-push",transmitterType:"SwitchboardPush"},filter:{branch:["main"],documentId:["*"],documentType:["*"],scope:["global"]},label:"Switchboard Sync",listenerId:ul(),system:!0}],triggers:[]})}catch(o){Y.error("Error adding remote drive",o)}}async function sp(){if(window.ph||(window.ph={}),window.ph.legacyReactor||window.ph.loading)return;window.ph.loading=!0,Ps();const t=await np();Y.info(`Features: ${JSON.stringify(Object.fromEntries(t),null,2)}`);const e=await As(),r=await e.did(),n=Ts(r,ht.routerBasename),o=df(ht.routerBasename);op(o);const a=await yh(),i=await ap(a),s=i.flatMap(w=>w.modules.documentModelModules).filter(w=>w!==void 0),l=Is(),c=ff(s,o,{...l,featureFlags:{enableDualActionCreate:!0}}),u=await hf(s,o,e);await ks(c,n,e);const d=Ms(c),h=new ki(c.listeners,c);let f=await bn(c);const m=cp(),_=m?await ip(m,c,f):void 0;_&&(f=await bn(c));const N=window.location.pathname,C=_?.header.slug??Hs(N),b=_?"":js(N),T=lp();await Bs(T,c,n,e),Fs(ht),Vs(c),Us(u),$s(u.client),zs(u.reactorModule?.syncModule?.syncManager),Ks(u.reactorModule?.database),Ws(u.pg),Ys(d),Gs(e),Js(r),Xs(n),qs(h),Zs(f),Jr(i),Rt(C),Go(b),Qs(t),t.get("FEATURE_LEGACY_READ_ENABLED")??!0?(c.on("defaultRemoteDrive",(...w)=>{Y.verbose("defaultRemoteDrive",...w),it(c).catch(Y.error)}),c.on("clientStrandsError",(...w)=>{Y.verbose("clientStrandsError",...w),it(c).catch(Y.error)}),c.on("driveAdded",(...w)=>{Y.verbose("driveAdded",...w),h.registerDrive(w[0].header.id).catch(Y.error),it(c).catch(Y.error)}),c.on("driveDeleted",(...w)=>{Y.verbose("driveDeleted",...w),it(c).catch(Y.error)}),c.on("documentModelModules",(...w)=>{Y.verbose("documentModelModules",...w),it(c).catch(Y.error)}),c.on("driveOperationsAdded",(...w)=>{Y.verbose("driveOperationsAdded",...w),it(c).catch(Y.error)})):(c.on("defaultRemoteDrive",(...P)=>{Y.verbose("future:defaultRemoteDrive",...P),Qe(u.client).catch(Y.error)}),c.on("clientStrandsError",(...P)=>{Y.verbose("future:clientStrandsError",...P),Qe(u.client).catch(Y.error)}),c.on("driveAdded",(...P)=>{Y.verbose("future:driveAdded",...P),h.registerDrive(P[0].header.id).catch(Y.error),Qe(u.client).catch(Y.error)}),c.on("driveDeleted",(...P)=>{Y.verbose("future:driveDeleted",...P),Qe(u.client).catch(Y.error)}),c.on("documentModelModules",(...P)=>{Y.verbose("future:documentModelModules",...P),Qe(u.client).catch(Y.error)}),c.on("driveOperationsAdded",(...P)=>{Y.verbose("future:driveOperationsAdded",...P),Qe(u.client).catch(Y.error)}),u.client.subscribe({type:"powerhouse/document-drive"},P=>{Y.verbose("ReactorClient subscription event",P),Qe(u.client).catch(Y.error)})),window.ph.loading=!1}function lp(){const e=new URLSearchParams(window.location.search).get("user");return e?decodeURIComponent(e):void 0}function cp(){const e=new URLSearchParams(window.location.search).get("driveUrl");return e?decodeURIComponent(e):void 0}function up(){const t=qr();g.useEffect(()=>{let e=null;if(t){const{credential:r,...n}=t;e={id:n.did,username:n.ens?.name,...n}}ml(e)},[t])}function dp(){return y.jsx("div",{className:"h-screen",children:y.jsx("div",{className:"flex h-screen items-stretch overflow-auto",role:"presentation",tabIndex:0,children:y.jsxs(g.Suspense,{name:"Root",children:[y.jsx(wp,{}),y.jsx("div",{className:"relative flex-1 overflow-auto",children:y.jsx(cd,{})})]})})})}function fp(){const[t]=Zo(),e=qo(),[r]=Xr();g.useEffect(()=>{r||tl(Tl)},[r]),g.useEffect(()=>{t||rl(Il)},[t]);const n=!r&&!t&&!e;return y.jsx(hp,{children:n?y.jsx(gp,{}):y.jsx(Ff,{})})}function hp({children:t}){return y.jsx("div",{className:"flex h-full flex-col overflow-auto",id:"content-view",children:t})}function pp({drive:t}){const r=Jo(t.header.meta?.preferredEditor)?.name||"Drive Explorer App";return y.jsx(Ji,{title:t.state.global.name,description:r,icon:y.jsx(Va,{drive:t}),onClick:()=>Rt(t)},t.header.id)}function gp(){const t=Qo(),e=se;return y.jsxs(zo,{children:[t?.map(r=>y.jsx(pp,{drive:r},r.header.id)),e.drives.addDriveEnabled&&y.jsx(Gi,{})]})}const mp=t=>g.createElement("svg",{width:28,height:32,viewBox:"0 0 28 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},g.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.05092 23.7286L0.000163347 23.9993L0 23.9995L0.207853 24.067L27.6823 24.067L27.9995 23.9995L27.9161 23.6913L14.2182 0.209032L13.9998 0L13.749 0.246353L0.05092 23.7286ZM20.9994 11.9999L7.0003 11.9999L13.9998 23.999L20.9994 11.9999Z",fill:"url(#paint0_radial_319_20865)"}),g.createElement("path",{d:"M14 0L0 23.9998V7.99993L14 0Z",fill:"url(#paint1_linear_319_20865)"}),g.createElement("path",{d:"M28 24L7.82013e-05 24L14 31.9999L28 24Z",fill:"url(#paint2_linear_319_20865)"}),g.createElement("path",{d:"M14 0L28 23.9998V7.99993L14 0Z",fill:"url(#paint3_linear_319_20865)"}),g.createElement("defs",null,g.createElement("radialGradient",{id:"paint0_radial_319_20865",cx:0,cy:0,r:1,gradientUnits:"userSpaceOnUse",gradientTransform:"translate(13.9994 16.0344) rotate(-89.9988) scale(16.0344 16.201)"},g.createElement("stop",{offset:.181008,stopColor:"#FFCD6B"}),g.createElement("stop",{offset:1,stopColor:"#EB5EDF"})),g.createElement("linearGradient",{id:"paint1_linear_319_20865",x1:-.031454,y1:24.041,x2:13.801,y2:-.142908,gradientUnits:"userSpaceOnUse"},g.createElement("stop",{stopColor:"#4331E9"}),g.createElement("stop",{offset:1,stopColor:"#A273FF"})),g.createElement("linearGradient",{id:"paint2_linear_319_20865",x1:-.0310093,y1:24,x2:28.0444,y2:24,gradientUnits:"userSpaceOnUse"},g.createElement("stop",{stopColor:"#A273FF"}),g.createElement("stop",{offset:1,stopColor:"#4331E9"})),g.createElement("linearGradient",{id:"paint3_linear_319_20865",x1:28.0315,y1:24.041,x2:14.199,y2:-.142908,gradientUnits:"userSpaceOnUse"},g.createElement("stop",{stopColor:"#A273FF"}),g.createElement("stop",{offset:1,stopColor:"#4331E9"})))),vp=t=>g.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},g.createElement("path",{d:"M15.6867 8.03333C15.4933 7.83999 15.1733 7.83999 14.98 8.03333L14.6733 8.34001V8C14.6733 4.32 11.68 1.32666 7.99999 1.32666C5.96666 1.32666 4.06666 2.23999 2.79333 3.82666C2.61999 4.03999 2.65332 4.35999 2.87332 4.52665C3.08666 4.69999 3.40666 4.66666 3.57332 4.44666C4.65999 3.09332 6.27332 2.31999 7.99999 2.31999C11.1267 2.31999 13.6733 4.86666 13.6733 7.99333V8.32666L13.3667 8.02002C13.1733 7.82669 12.8533 7.82669 12.66 8.02002C12.4667 8.21335 12.4667 8.53335 12.66 8.72668L13.82 9.88668C13.8667 9.93334 13.92 9.96666 13.98 9.99333C14.04 10.02 14.1067 10.0333 14.1733 10.0333C14.24 10.0333 14.3 10.02 14.3667 9.99333C14.4267 9.96666 14.48 9.93334 14.5267 9.88668L15.6867 8.72668C15.88 8.54668 15.88 8.22666 15.6867 8.03333Z",fill:"#6C7275"}),g.createElement("path",{d:"M13.1267 11.4666C12.9133 11.2933 12.5933 11.3266 12.4267 11.5466C11.34 12.9 9.72665 13.6733 7.99998 13.6733C4.87332 13.6733 2.32665 11.1266 2.32665 7.99996V7.66663L2.63332 7.97331C2.73332 8.07331 2.85999 8.11996 2.98665 8.11996C3.11332 8.11996 3.23999 8.07331 3.33999 7.97331C3.53332 7.77998 3.53332 7.45998 3.33999 7.26664L2.17998 6.10661C2.13332 6.05994 2.07998 6.02663 2.01998 5.99996C1.89998 5.94663 1.75998 5.94663 1.63998 5.99996C1.57998 6.02663 1.52665 6.05994 1.47999 6.10661L0.319988 7.26664C0.126654 7.45998 0.126654 7.77998 0.319988 7.97331C0.513321 8.16664 0.833319 8.16664 1.02665 7.97331L1.33332 7.66663V7.99996C1.33332 11.68 4.32665 14.6733 8.00665 14.6733C10.04 14.6733 11.94 13.76 13.2133 12.1733C13.38 11.96 13.3467 11.64 13.1267 11.4666Z",fill:"#6C7275"})),Ep="https://apps.powerhouse.io/sky-atlas/staging/switchboard",yp=2e3;function _p(){const{search:t}=fr();return g.useMemo(()=>{const r=new URLSearchParams(t).get("reactorUrl")??Ep;return r.endsWith("/")?r:`${r}/`},[t])}async function Cp(t,e){const r=dl`
|
|
17
|
+
mutation ForkAtlas($docId: PHID) {
|
|
18
|
+
ForkAtlas(docId: $docId)
|
|
19
|
+
}
|
|
20
|
+
`;return await fl(`${e}graphql`,r,{docId:t})}function Sp(){const t=g.useRef("initial"),e=nl(),{documentId:r}=Ju(),n=_p(),o=Ku(),[a,i]=g.useState(void 0),[s,l]=g.useState(void 0),[c,u]=g.useState(!0),d=t.current==="error";g.useEffect(()=>{s&&(console.error("Error forking Atlas:",s),en("Error forking Atlas",{type:"error"}))},[s]);async function h(_){const C=(await Cp(_,n)).ForkAtlas;t.current="forked",i(C)}const f=g.useCallback(()=>{a&&!c&&o(`/d/${a}`,{replace:!0})},[a,o,c]),m=g.useCallback(async _=>{console.log("Adding remote drive:",_);const N=`${n}d/${_}`;try{const C=await Rn(N,{sharingType:"PUBLIC",availableOffline:!0,listeners:[{block:!0,callInfo:{data:N,name:"switchboard-push",transmitterType:"SwitchboardPush"},filter:{branch:["main"],documentId:["*"],documentType:["*"],scope:["global"]},label:"Switchboard Sync",listenerId:"1",system:!0}],triggers:[]});t.current="done",console.log("Added remote drive:",C),setTimeout(()=>{u(!1)},yp)}catch(C){t.current="error",u(!1),l(C)}},[Rn,o,n]);return g.useEffect(()=>{!r||t.current!=="initial"||(t.current="forking",h(r).catch(_=>{t.current="error",l(_)}))},[r,t]),g.useEffect(()=>{!a||!e||t.current!=="forked"||(t.current="addingDrive",new Promise(_=>{setTimeout(_,500)}).then(()=>m(a)).catch(_=>{t.current="error",l(_)}))},[a,e,t]),y.jsx("div",{className:"flex size-full justify-center gap-x-4 bg-gray-50",children:y.jsxs("div",{className:"w-full max-w-[850px] rounded-2xl bg-white p-6 drop-shadow-sm",children:[y.jsx("h1",{className:"text-lg font-medium text-gray-900",children:"Welcome to the Atlas Explorer"}),y.jsx("div",{className:"mt-4 rounded-xl border border-gray-200 bg-gray-50 p-6",children:y.jsxs("div",{className:"flex min-h-80 flex-col items-center justify-center rounded-2xl bg-slate-50",children:[y.jsx("div",{children:y.jsx(mp,{})}),d?y.jsx("div",{className:"mt-3 text-sm text-gray-800",children:"Error forking Atlas scope. Please try again."}):y.jsx("div",{className:"mt-3 text-sm text-gray-500",children:"Forking Atlas scope..."}),y.jsx(ea,{onClick:d?window.location.reload.bind(window.location):f,size:"small",color:"light",className:"mt-4 h-9 border border-gray-200 bg-white px-3 text-gray-600",children:d?"Retry":c?y.jsxs(y.Fragment,{children:[y.jsx(vp,{className:"animate-spin"}),"Loading"]}):"Continue"})]})})]})})}function Np(t){const e=se.routerBasename;return pd(t,{basename:e,future:{v7_fetcherPersist:!0,v7_relativeSplatPath:!0}})}function bp(){const t=[{index:!0,path:"d?/:driveId?/*?",element:y.jsx(g.Suspense,{name:"Drive",children:y.jsx(fp,{})})},{path:"import/:documentId",element:y.jsx(g.Suspense,{name:"AtlasImport",children:y.jsx(Sp,{})})}];return[{element:y.jsx(g.Suspense,{name:"RouteRoot",children:y.jsx(dp,{})}),children:t}]}const Rp=bp(),xp=Np(Rp),Dp=()=>y.jsx(Nd,{router:xp});function wp(){const t=qr(),e=Qo(),[r]=Zo(),n=ol(),o=localStorage.getItem("CONNECT_DEBUG")==="true",a=()=>{Be({type:"settings"})},i=()=>{Be({type:"addDrive"})},s=()=>{Be({type:"inspector"})},l=y.jsxs("div",{className:"flex h-full items-center",children:[y.jsx(kr,{name:"Connect",className:"!h-[30px] !w-[100px] cursor-pointer",onClick:()=>Rt(void 0)}),o&&y.jsx("button",{"aria-label":"Home",id:"connect-debug-button",className:"ml-6",onClick:()=>Be({type:"debugSettings"}),children:y.jsx("img",{src:"settings.png",className:"h-5 text-gray-600"})})]}),c=t?.address?`https://etherscan.io/address/${t.address}`:"";return y.jsx($o,{id:"sidebar",onClick:()=>Rt(void 0),onClickSettings:a,onInspectorClick:n?s:void 0,headerContent:l,address:t?.address,onLogin:il,onDisconnect:al,etherscanUrl:c,children:y.jsxs(ln,{fallback:y.jsx("div",{className:"text-center",children:"There was an error loading drives"}),onError:Y.error,children:[e?.map((u,d)=>y.jsx(Xi,{title:u.header.name,onClick:()=>Rt(u),active:r?.header.id===u.header.id,icon:y.jsx(Va,{drive:u})},d)),se.drives.addDriveEnabled&&y.jsx(qi,{onClick:i})]})})}const Op=g.lazy(async()=>(await sp(),{default:({children:t})=>(Fl(),up(),Uc(),t)})),Lp=()=>y.jsxs(g.StrictMode,{children:[y.jsx(g.Suspense,{fallback:y.jsx(_f,{}),name:"AppLoader",children:y.jsx(Op,{children:y.jsx(Nf,{})})}),y.jsx(g.Suspense,{name:"CookieBanner",children:y.jsx(kf,{})}),y.jsx(ah,{})]});wi.createRoot(document.getElementById("root")).render(y.jsx(Lp,{}));export{Ic as T,Zp as a,se as b,eg as c,Xp as d,Qp as e,qp as r,vf as s,en as t,ga as u};
|