@powerhousedao/connect 4.0.1 → 4.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/assets/{AddDriveModal.Co18Guku.js → AddDriveModal.Dvx49ymn.js} +2 -2
  2. package/dist/assets/{AddDriveModal.Co18Guku.js.map → AddDriveModal.Dvx49ymn.js.map} +1 -1
  3. package/dist/assets/{CreateDocumentModal.CaioRAB5.js → CreateDocumentModal.HxsTTO3O.js} +2 -2
  4. package/dist/assets/{CreateDocumentModal.CaioRAB5.js.map → CreateDocumentModal.HxsTTO3O.js.map} +1 -1
  5. package/dist/assets/{DebugSettingsModal.Dc-lh2p_.js → DebugSettingsModal.FcsYdItm.js} +2 -2
  6. package/dist/assets/{DebugSettingsModal.Dc-lh2p_.js.map → DebugSettingsModal.FcsYdItm.js.map} +1 -1
  7. package/dist/assets/{SettingsModal.PrY-Ocw1.js → SettingsModal.DNuw8Ol8.js} +2 -2
  8. package/dist/assets/{SettingsModal.PrY-Ocw1.js.map → SettingsModal.DNuw8Ol8.js.map} +1 -1
  9. package/dist/assets/{app.p03Jbd-6.js → app.4_SWVXbR.js} +4 -4
  10. package/dist/assets/{app.p03Jbd-6.js.map → app.4_SWVXbR.js.map} +1 -1
  11. package/dist/assets/{atlas-import.CZu-y-lV.js → atlas-import.BcpRC7pw.js} +2 -2
  12. package/dist/assets/{atlas-import.CZu-y-lV.js.map → atlas-import.BcpRC7pw.js.map} +1 -1
  13. package/dist/assets/{connect.config._T1v6EoS.js → connect.config.DUXg7xh4.js} +2 -2
  14. package/dist/assets/{connect.config._T1v6EoS.js.map → connect.config.DUXg7xh4.js.map} +1 -1
  15. package/dist/assets/{content.Bm5SXqTG.js → content.CdBQrvpu.js} +2 -2
  16. package/dist/assets/{content.Bm5SXqTG.js.map → content.CdBQrvpu.js.map} +1 -1
  17. package/dist/assets/{cookie-banner.DHaEPv4f.js → cookie-banner.CFaAyloc.js} +2 -2
  18. package/dist/assets/{cookie-banner.DHaEPv4f.js.map → cookie-banner.CFaAyloc.js.map} +1 -1
  19. package/dist/assets/{home.BOhOCme9.js → home.Dms1SdKb.js} +2 -2
  20. package/dist/assets/{home.BOhOCme9.js.map → home.Dms1SdKb.js.map} +1 -1
  21. package/dist/assets/{index.D1LmSqIY.js → index.9LsxHx9v.js} +2 -2
  22. package/dist/assets/{index.D1LmSqIY.js.map → index.9LsxHx9v.js.map} +1 -1
  23. package/dist/assets/{index.nPXtj_yn.js → index.B0EhmKCF.js} +2 -2
  24. package/dist/assets/{index.nPXtj_yn.js.map → index.B0EhmKCF.js.map} +1 -1
  25. package/dist/assets/{index.CIKNjgvt.js → index.BDEjD6s0.js} +3 -3
  26. package/dist/assets/{index.CIKNjgvt.js.map → index.BDEjD6s0.js.map} +1 -1
  27. package/dist/assets/{index.P5mz_7_c.js → index.BI78I5tG.js} +2 -2
  28. package/dist/assets/{index.P5mz_7_c.js.map → index.BI78I5tG.js.map} +1 -1
  29. package/dist/assets/{index.C9cXurZH.js → index.BspU3wnc.js} +2 -2
  30. package/dist/assets/{index.C9cXurZH.js.map → index.BspU3wnc.js.map} +1 -1
  31. package/dist/assets/{index.Bc5mN9Zd.js → index.DJB97pbh.js} +2 -2
  32. package/dist/assets/{index.Bc5mN9Zd.js.map → index.DJB97pbh.js.map} +1 -1
  33. package/dist/assets/{main.Cvp8g1Yn.js → main.CQ97ZtJ9.js} +3 -3
  34. package/dist/assets/{main.Cvp8g1Yn.js.map → main.CQ97ZtJ9.js.map} +1 -1
  35. package/dist/assets/{modal.ChDGZoHG.js → modal.BurIaDHm.js} +3 -3
  36. package/dist/assets/{modal.ChDGZoHG.js.map → modal.BurIaDHm.js.map} +1 -1
  37. package/dist/assets/{modals.BUDWDdmy.js → modals.BgBl4OEM.js} +2 -2
  38. package/dist/assets/{modals.BUDWDdmy.js.map → modals.BgBl4OEM.js.map} +1 -1
  39. package/dist/assets/{registerServiceWorker.DoRTBtYI.js → registerServiceWorker.D6UhEnk-.js} +2 -2
  40. package/dist/assets/{registerServiceWorker.DoRTBtYI.js.map → registerServiceWorker.D6UhEnk-.js.map} +1 -1
  41. package/dist/assets/{root.-e9qWpwj.js → root.OFkJ3D8n.js} +2 -2
  42. package/dist/assets/{root.-e9qWpwj.js.map → root.OFkJ3D8n.js.map} +1 -1
  43. package/dist/assets/{useAcceptedCookies.szoyvsjl.js → useAcceptedCookies.CxwtiZdL.js} +2 -2
  44. package/dist/assets/{useAcceptedCookies.szoyvsjl.js.map → useAcceptedCookies.CxwtiZdL.js.map} +1 -1
  45. package/dist/assets/useConnectConfig.PFYS-3o2.js +2 -0
  46. package/dist/assets/{useConnectConfig.CYEP32RG.js.map → useConnectConfig.PFYS-3o2.js.map} +1 -1
  47. package/dist/assets/{useDefaultDocumentModelEditor.DNpBOumt.js → useDefaultDocumentModelEditor.CN7iHYLX.js} +2 -2
  48. package/dist/assets/{useDefaultDocumentModelEditor.DNpBOumt.js.map → useDefaultDocumentModelEditor.CN7iHYLX.js.map} +1 -1
  49. package/dist/assets/useDocumentDriveServer.DiA5ncH8.js +2 -0
  50. package/dist/assets/useDocumentDriveServer.DiA5ncH8.js.map +1 -0
  51. package/dist/assets/{useFeatureFlags.B1cQjxLV.js → useFeatureFlags.Dp7X50k3.js} +2 -2
  52. package/dist/assets/{useFeatureFlags.B1cQjxLV.js.map → useFeatureFlags.Dp7X50k3.js.map} +1 -1
  53. package/dist/assets/{user.D5A2C_6c.js → user.BQU9ztVh.js} +4 -4
  54. package/dist/assets/{user.D5A2C_6c.js.map → user.BQU9ztVh.js.map} +1 -1
  55. package/dist/index.html +1 -1
  56. package/dist/vite-envs.sh +1 -1
  57. package/package.json +9 -9
  58. package/dist/assets/useConnectConfig.CYEP32RG.js +0 -2
  59. package/dist/assets/useDocumentDriveServer.DyeegGAO.js +0 -2
  60. package/dist/assets/useDocumentDriveServer.DyeegGAO.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"mappings":";uUAEMA,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WD,CAAO,EAAE,OAAOP,EAAS,CACxC,CAEA,MAAMS,GAAa,SAAS,eAAe,KAAK,EAChD,GAAI,CAACA,GACD,MAAM,IAAI,MAAM,yBAAyB,EAG7CH,GAAUG,EAAU","names":["RESET","__vite_import_meta_env__","isPromiseLike$3","x","createJSONStorage","getStringStorage","e","options","_a","lastStr","lastValue","storage","key","initialValue","_a2","_b","parse","str2","str","newValue","createHandleSubscribe","subscriber2","callback","v","subscriber","storageEventCallback","defaultStorage","atomWithStorage","baseAtom","atom","setAtom","unsub","get","set","update","nextValue","resolvedValue","cache1$1","memo1","create","dep1","isPromiseLike$1","p","LOADING","loadable","anAtom","loadableCache","refreshAtom","derivedAtom","setSelf","value","error","promise","cached1","data","cached2","_get","c","getCached","m","k","cache1","memo2","dep2","cache2","isPromiseLike","defaultFallback","unwrap","fallback","promiseErrorCache","promiseResultCache","promiseAndValueAtom","prev","state","args","atomWithRefresh","read","write","atomWithLazy","makeInitial","a","NOT_SET","suspendUntilSet","extractNodeSlug","path","match","findUuid","input","extractNodeNameOrSlugOrIdFromPath","nodeSlug","nodeId","extractDriveFromPath","makeNodeSlugFromNodeName","name","setSelectedDriveAndNodeFromUrl","reactor","setSelectedDrive","setSelectedNode","shouldNavigate","drive","handleDriveFromUrl","handleNodeFromUrl","driveSlug","driveIds","id","nodeIdOrSlugOrNameFromPath","nodes","node","n","useRefreshDrives","useSetAtom","drivesAtom","isFolderNodeKind","baseReactorAtom","reactorAtom","initializeReactorAtom","loadableReactorAtom","unwrappedReactorAtom","loadableReactor","drives","driveId","loadableDrivesAtom","unwrappedDrivesAtom","baseSelectedDriveIdAtom","selectedDriveAtom","loadableDrives","selectedNodeIdAtom","loadableSelectedDriveAtom","unwrappedSelectedDriveAtom","nodesAtom","loadableSelectedDrive","loadableNodesAtom","unwrappedNodesAtom","setSelectedNodeAtom","selectedFolderAtom","loadableNodes","folderNodes","loadableSelectedFolderAtom","unwrappedSelectedFolderAtom","documentsAtom","loadableDrive","documentIds","loadableDocumentsAtom","unwrappedDocumentsAtom","selectedDocumentAtom","loadableDocuments","document","loadableSelectedDocumentAtom","unwrappedSelectedDocumentAtom","phPackagesAtom","setPhPackagesAtom","phPackages","loadablePhPackagesAtom","unwrappedPhPackagesAtom","documentModelModulesAtom","loadablePhPackages","loadableDocumentModelModulesAtom","unwrappedDocumentModelModulesAtom","editorModulesAtom","loadableEditorModulesAtom","unwrappedEditorModulesAtom","processorManagerAtom","configAtom","useRefreshDocuments","useSyncDrivesAndDocumentsWithReactor","refreshDrives","refreshDocuments","useCallback","logger","childLogger","useUnwrappedReactor","useAtomValue","useInitializeReactor","createReactor","unwrappedReactor","setReactor","refresh","useEffect","initializeReactor","event","status","DevTools","atomStore","createStore","InitReactor","AtomStoreProvider","children","_jsxs","Provider","_jsx","App","lazy","__vitePreload","CookieBanner","ModalManager","AppLoader","jsx","StrictMode","jsxs","Suspense","AppSkeleton","renderApp","element","createRoot","AppElement"],"ignoreList":[0,8],"sources":["../../../../node_modules/.pnpm/jotai@2.12.5_@types+react@18.3.23_react@18.3.1/node_modules/jotai/esm/vanilla/utils.mjs","../../../../packages/common/dist/state/utils.js","../../../../packages/common/dist/state/drives.js","../../../../packages/common/dist/state/nodes.js","../../../../packages/common/dist/state/atoms.js","../../../../packages/common/dist/state/documents.js","../../../../packages/common/dist/state/syncing.js","../../../../packages/common/dist/state/reactor.js","../../../../node_modules/.pnpm/jotai-devtools@0.12.0_@types+react@18.3.23_react-dom@18.3.1_react@18.3.1__react@18.3.1__c8b464b01737ba84c54b4cf01b222909/node_modules/jotai-devtools/dist/index.esm.mjs","../../../../packages/common/dist/state/store.js","../../../../packages/common/dist/state/store-provider.js","../../src/components/app-loader.tsx","../../src/index.ts"],"sourcesContent":["import { atom } from 'jotai/vanilla';\n\nconst RESET = Symbol(\n (import.meta.env ? import.meta.env.MODE : void 0) !== \"production\" ? \"RESET\" : \"\"\n);\n\nfunction atomWithReset(initialValue) {\n const anAtom = atom(\n initialValue,\n (get, set, update) => {\n const nextValue = typeof update === \"function\" ? update(get(anAtom)) : update;\n set(anAtom, nextValue === RESET ? initialValue : nextValue);\n }\n );\n return anAtom;\n}\n\nfunction atomWithReducer(initialValue, reducer) {\n return atom(initialValue, function(get, set, action) {\n set(this, reducer(get(this), action));\n });\n}\n\nfunction atomFamily(initializeAtom, areEqual) {\n let shouldRemove = null;\n const atoms = /* @__PURE__ */ new Map();\n const listeners = /* @__PURE__ */ new Set();\n const createAtom = (param) => {\n let item;\n if (areEqual === void 0) {\n item = atoms.get(param);\n } else {\n for (const [key, value] of atoms) {\n if (areEqual(key, param)) {\n item = value;\n break;\n }\n }\n }\n if (item !== void 0) {\n if (shouldRemove == null ? void 0 : shouldRemove(item[1], param)) {\n createAtom.remove(param);\n } else {\n return item[0];\n }\n }\n const newAtom = initializeAtom(param);\n atoms.set(param, [newAtom, Date.now()]);\n notifyListeners(\"CREATE\", param, newAtom);\n return newAtom;\n };\n const notifyListeners = (type, param, atom) => {\n for (const listener of listeners) {\n listener({ type, param, atom });\n }\n };\n createAtom.unstable_listen = (callback) => {\n listeners.add(callback);\n return () => {\n listeners.delete(callback);\n };\n };\n createAtom.getParams = () => atoms.keys();\n createAtom.remove = (param) => {\n if (areEqual === void 0) {\n if (!atoms.has(param)) return;\n const [atom] = atoms.get(param);\n atoms.delete(param);\n notifyListeners(\"REMOVE\", param, atom);\n } else {\n for (const [key, [atom]] of atoms) {\n if (areEqual(key, param)) {\n atoms.delete(key);\n notifyListeners(\"REMOVE\", key, atom);\n break;\n }\n }\n }\n };\n createAtom.setShouldRemove = (fn) => {\n shouldRemove = fn;\n if (!shouldRemove) return;\n for (const [key, [atom, createdAt]] of atoms) {\n if (shouldRemove(createdAt, key)) {\n atoms.delete(key);\n notifyListeners(\"REMOVE\", key, atom);\n }\n }\n };\n return createAtom;\n}\n\nconst getCached$2 = (c, m, k) => (m.has(k) ? m : m.set(k, c())).get(k);\nconst cache1$3 = /* @__PURE__ */ new WeakMap();\nconst memo3 = (create, dep1, dep2, dep3) => {\n const cache2 = getCached$2(() => /* @__PURE__ */ new WeakMap(), cache1$3, dep1);\n const cache3 = getCached$2(() => /* @__PURE__ */ new WeakMap(), cache2, dep2);\n return getCached$2(create, cache3, dep3);\n};\nfunction selectAtom(anAtom, selector, equalityFn = Object.is) {\n return memo3(\n () => {\n const EMPTY = Symbol();\n const selectValue = ([value, prevSlice]) => {\n if (prevSlice === EMPTY) {\n return selector(value);\n }\n const slice = selector(value, prevSlice);\n return equalityFn(prevSlice, slice) ? prevSlice : slice;\n };\n const derivedAtom = atom((get) => {\n const prev = get(derivedAtom);\n const value = get(anAtom);\n return selectValue([value, prev]);\n });\n derivedAtom.init = EMPTY;\n return derivedAtom;\n },\n anAtom,\n selector,\n equalityFn\n );\n}\n\nconst frozenAtoms = /* @__PURE__ */ new WeakSet();\nconst deepFreeze = (value) => {\n if (typeof value !== \"object\" || value === null) {\n return value;\n }\n Object.freeze(value);\n const propNames = Object.getOwnPropertyNames(value);\n for (const name of propNames) {\n deepFreeze(value[name]);\n }\n return value;\n};\nfunction freezeAtom(anAtom) {\n if (frozenAtoms.has(anAtom)) {\n return anAtom;\n }\n frozenAtoms.add(anAtom);\n const origRead = anAtom.read;\n anAtom.read = function(get, options) {\n return deepFreeze(origRead.call(this, get, options));\n };\n if (\"write\" in anAtom) {\n const origWrite = anAtom.write;\n anAtom.write = function(get, set, ...args) {\n return origWrite.call(\n this,\n get,\n (...setArgs) => {\n if (setArgs[0] === anAtom) {\n setArgs[1] = deepFreeze(setArgs[1]);\n }\n return set(...setArgs);\n },\n ...args\n );\n };\n }\n return anAtom;\n}\nfunction freezeAtomCreator(createAtom) {\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n console.warn(\n \"[DEPRECATED] freezeAtomCreator is deprecated, define it on users end\"\n );\n }\n return (...args) => freezeAtom(createAtom(...args));\n}\n\nconst getCached$1 = (c, m, k) => (m.has(k) ? m : m.set(k, c())).get(k);\nconst cache1$2 = /* @__PURE__ */ new WeakMap();\nconst memo2$1 = (create, dep1, dep2) => {\n const cache2 = getCached$1(() => /* @__PURE__ */ new WeakMap(), cache1$2, dep1);\n return getCached$1(create, cache2, dep2);\n};\nconst cacheKeyForEmptyKeyExtractor = {};\nconst isWritable = (atom2) => !!atom2.write;\nconst isFunction = (x) => typeof x === \"function\";\nfunction splitAtom(arrAtom, keyExtractor) {\n return memo2$1(\n () => {\n const mappingCache = /* @__PURE__ */ new WeakMap();\n const getMapping = (arr, prev) => {\n let mapping = mappingCache.get(arr);\n if (mapping) {\n return mapping;\n }\n const prevMapping = prev && mappingCache.get(prev);\n const atomList = [];\n const keyList = [];\n arr.forEach((item, index) => {\n const key = keyExtractor ? keyExtractor(item) : index;\n keyList[index] = key;\n const cachedAtom = prevMapping && prevMapping.atomList[prevMapping.keyList.indexOf(key)];\n if (cachedAtom) {\n atomList[index] = cachedAtom;\n return;\n }\n const read = (get) => {\n const prev2 = get(mappingAtom);\n const currArr = get(arrAtom);\n const mapping2 = getMapping(currArr, prev2 == null ? void 0 : prev2.arr);\n const index2 = mapping2.keyList.indexOf(key);\n if (index2 < 0 || index2 >= currArr.length) {\n const prevItem = arr[getMapping(arr).keyList.indexOf(key)];\n if (prevItem) {\n return prevItem;\n }\n throw new Error(\"splitAtom: index out of bounds for read\");\n }\n return currArr[index2];\n };\n const write = (get, set, update) => {\n const prev2 = get(mappingAtom);\n const arr2 = get(arrAtom);\n const mapping2 = getMapping(arr2, prev2 == null ? void 0 : prev2.arr);\n const index2 = mapping2.keyList.indexOf(key);\n if (index2 < 0 || index2 >= arr2.length) {\n throw new Error(\"splitAtom: index out of bounds for write\");\n }\n const nextItem = isFunction(update) ? update(arr2[index2]) : update;\n if (!Object.is(arr2[index2], nextItem)) {\n set(arrAtom, [\n ...arr2.slice(0, index2),\n nextItem,\n ...arr2.slice(index2 + 1)\n ]);\n }\n };\n atomList[index] = isWritable(arrAtom) ? atom(read, write) : atom(read);\n });\n if (prevMapping && prevMapping.keyList.length === keyList.length && prevMapping.keyList.every((x, i) => x === keyList[i])) {\n mapping = prevMapping;\n } else {\n mapping = { arr, atomList, keyList };\n }\n mappingCache.set(arr, mapping);\n return mapping;\n };\n const mappingAtom = atom((get) => {\n const prev = get(mappingAtom);\n const arr = get(arrAtom);\n const mapping = getMapping(arr, prev == null ? void 0 : prev.arr);\n return mapping;\n });\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n mappingAtom.debugPrivate = true;\n }\n mappingAtom.init = void 0;\n const splittedAtom = isWritable(arrAtom) ? atom(\n (get) => get(mappingAtom).atomList,\n (get, set, action) => {\n switch (action.type) {\n case \"remove\": {\n const index = get(splittedAtom).indexOf(action.atom);\n if (index >= 0) {\n const arr = get(arrAtom);\n set(arrAtom, [\n ...arr.slice(0, index),\n ...arr.slice(index + 1)\n ]);\n }\n break;\n }\n case \"insert\": {\n const index = action.before ? get(splittedAtom).indexOf(action.before) : get(splittedAtom).length;\n if (index >= 0) {\n const arr = get(arrAtom);\n set(arrAtom, [\n ...arr.slice(0, index),\n action.value,\n ...arr.slice(index)\n ]);\n }\n break;\n }\n case \"move\": {\n const index1 = get(splittedAtom).indexOf(action.atom);\n const index2 = action.before ? get(splittedAtom).indexOf(action.before) : get(splittedAtom).length;\n if (index1 >= 0 && index2 >= 0) {\n const arr = get(arrAtom);\n if (index1 < index2) {\n set(arrAtom, [\n ...arr.slice(0, index1),\n ...arr.slice(index1 + 1, index2),\n arr[index1],\n ...arr.slice(index2)\n ]);\n } else {\n set(arrAtom, [\n ...arr.slice(0, index2),\n arr[index1],\n ...arr.slice(index2, index1),\n ...arr.slice(index1 + 1)\n ]);\n }\n }\n break;\n }\n }\n }\n ) : atom((get) => get(mappingAtom).atomList);\n return splittedAtom;\n },\n arrAtom,\n keyExtractor || cacheKeyForEmptyKeyExtractor\n );\n}\n\nfunction atomWithDefault(getDefault) {\n const EMPTY = Symbol();\n const overwrittenAtom = atom(EMPTY);\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n overwrittenAtom.debugPrivate = true;\n }\n const anAtom = atom(\n (get, options) => {\n const overwritten = get(overwrittenAtom);\n if (overwritten !== EMPTY) {\n return overwritten;\n }\n return getDefault(get, options);\n },\n (get, set, update) => {\n if (update === RESET) {\n set(overwrittenAtom, EMPTY);\n } else if (typeof update === \"function\") {\n const prevValue = get(anAtom);\n set(overwrittenAtom, update(prevValue));\n } else {\n set(overwrittenAtom, update);\n }\n }\n );\n return anAtom;\n}\n\nconst isPromiseLike$3 = (x) => typeof (x == null ? void 0 : x.then) === \"function\";\nfunction withStorageValidator(validator) {\n return (unknownStorage) => {\n const storage = {\n ...unknownStorage,\n getItem: (key, initialValue) => {\n const validate = (value2) => {\n if (!validator(value2)) {\n return initialValue;\n }\n return value2;\n };\n const value = unknownStorage.getItem(key, initialValue);\n if (isPromiseLike$3(value)) {\n return value.then(validate);\n }\n return validate(value);\n }\n };\n return storage;\n };\n}\nfunction createJSONStorage(getStringStorage = () => {\n try {\n return window.localStorage;\n } catch (e) {\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n if (typeof window !== \"undefined\") {\n console.warn(e);\n }\n }\n return void 0;\n }\n}, options) {\n var _a;\n let lastStr;\n let lastValue;\n const storage = {\n getItem: (key, initialValue) => {\n var _a2, _b;\n const parse = (str2) => {\n str2 = str2 || \"\";\n if (lastStr !== str2) {\n try {\n lastValue = JSON.parse(str2, options == null ? void 0 : options.reviver);\n } catch (e) {\n return initialValue;\n }\n lastStr = str2;\n }\n return lastValue;\n };\n const str = (_b = (_a2 = getStringStorage()) == null ? void 0 : _a2.getItem(key)) != null ? _b : null;\n if (isPromiseLike$3(str)) {\n return str.then(parse);\n }\n return parse(str);\n },\n setItem: (key, newValue) => {\n var _a2;\n return (_a2 = getStringStorage()) == null ? void 0 : _a2.setItem(\n key,\n JSON.stringify(newValue, options == null ? void 0 : options.replacer)\n );\n },\n removeItem: (key) => {\n var _a2;\n return (_a2 = getStringStorage()) == null ? void 0 : _a2.removeItem(key);\n }\n };\n const createHandleSubscribe = (subscriber2) => (key, callback, initialValue) => subscriber2(key, (v) => {\n let newValue;\n try {\n newValue = JSON.parse(v || \"\");\n } catch (e) {\n newValue = initialValue;\n }\n callback(newValue);\n });\n let subscriber;\n try {\n subscriber = (_a = getStringStorage()) == null ? void 0 : _a.subscribe;\n } catch (e) {\n }\n if (!subscriber && typeof window !== \"undefined\" && typeof window.addEventListener === \"function\" && window.Storage) {\n subscriber = (key, callback) => {\n if (!(getStringStorage() instanceof window.Storage)) {\n return () => {\n };\n }\n const storageEventCallback = (e) => {\n if (e.storageArea === getStringStorage() && e.key === key) {\n callback(e.newValue);\n }\n };\n window.addEventListener(\"storage\", storageEventCallback);\n return () => {\n window.removeEventListener(\"storage\", storageEventCallback);\n };\n };\n }\n if (subscriber) {\n storage.subscribe = createHandleSubscribe(subscriber);\n }\n return storage;\n}\nconst defaultStorage = createJSONStorage();\nfunction atomWithStorage(key, initialValue, storage = defaultStorage, options) {\n const getOnInit = options == null ? void 0 : options.getOnInit;\n const baseAtom = atom(\n getOnInit ? storage.getItem(key, initialValue) : initialValue\n );\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n baseAtom.debugPrivate = true;\n }\n baseAtom.onMount = (setAtom) => {\n setAtom(storage.getItem(key, initialValue));\n let unsub;\n if (storage.subscribe) {\n unsub = storage.subscribe(key, setAtom, initialValue);\n }\n return unsub;\n };\n const anAtom = atom(\n (get) => get(baseAtom),\n (get, set, update) => {\n const nextValue = typeof update === \"function\" ? update(get(baseAtom)) : update;\n if (nextValue === RESET) {\n set(baseAtom, initialValue);\n return storage.removeItem(key);\n }\n if (isPromiseLike$3(nextValue)) {\n return nextValue.then((resolvedValue) => {\n set(baseAtom, resolvedValue);\n return storage.setItem(key, resolvedValue);\n });\n }\n set(baseAtom, nextValue);\n return storage.setItem(key, nextValue);\n }\n );\n return anAtom;\n}\n\nconst isPromiseLike$2 = (x) => typeof (x == null ? void 0 : x.then) === \"function\";\nfunction atomWithObservable(getObservable, options) {\n const returnResultData = (result) => {\n if (\"e\" in result) {\n throw result.e;\n }\n return result.d;\n };\n const observableResultAtom = atom((get) => {\n var _a;\n let observable = getObservable(get);\n const itself = (_a = observable[Symbol.observable]) == null ? void 0 : _a.call(observable);\n if (itself) {\n observable = itself;\n }\n let resolve;\n const makePending = () => new Promise((r) => {\n resolve = r;\n });\n const initialResult = options && \"initialValue\" in options ? {\n d: typeof options.initialValue === \"function\" ? options.initialValue() : options.initialValue\n } : makePending();\n let setResult;\n let lastResult;\n const listener = (result) => {\n lastResult = result;\n resolve == null ? void 0 : resolve(result);\n setResult == null ? void 0 : setResult(result);\n };\n let subscription;\n let timer;\n const isNotMounted = () => !setResult;\n const unsubscribe = () => {\n if (subscription) {\n subscription.unsubscribe();\n subscription = void 0;\n }\n };\n const start = () => {\n if (subscription) {\n clearTimeout(timer);\n subscription.unsubscribe();\n }\n subscription = observable.subscribe({\n next: (d) => listener({ d }),\n error: (e) => listener({ e }),\n complete: () => {\n }\n });\n if (isNotMounted() && (options == null ? void 0 : options.unstable_timeout)) {\n timer = setTimeout(unsubscribe, options.unstable_timeout);\n }\n };\n start();\n const resultAtom = atom(lastResult || initialResult);\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n resultAtom.debugPrivate = true;\n }\n resultAtom.onMount = (update) => {\n setResult = update;\n if (lastResult) {\n update(lastResult);\n }\n if (subscription) {\n clearTimeout(timer);\n } else {\n start();\n }\n return () => {\n setResult = void 0;\n if (options == null ? void 0 : options.unstable_timeout) {\n timer = setTimeout(unsubscribe, options.unstable_timeout);\n } else {\n unsubscribe();\n }\n };\n };\n return [resultAtom, observable, makePending, start, isNotMounted];\n });\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n observableResultAtom.debugPrivate = true;\n }\n const observableAtom = atom(\n (get) => {\n const [resultAtom] = get(observableResultAtom);\n const result = get(resultAtom);\n if (isPromiseLike$2(result)) {\n return result.then(returnResultData);\n }\n return returnResultData(result);\n },\n (get, set, data) => {\n const [resultAtom, observable, makePending, start, isNotMounted] = get(observableResultAtom);\n if (\"next\" in observable) {\n if (isNotMounted()) {\n set(resultAtom, makePending());\n start();\n }\n observable.next(data);\n } else {\n throw new Error(\"observable is not subject\");\n }\n }\n );\n return observableAtom;\n}\n\nconst cache1$1 = /* @__PURE__ */ new WeakMap();\nconst memo1 = (create, dep1) => (cache1$1.has(dep1) ? cache1$1 : cache1$1.set(dep1, create())).get(dep1);\nconst isPromiseLike$1 = (p) => typeof (p == null ? void 0 : p.then) === \"function\";\nconst LOADING = { state: \"loading\" };\nfunction loadable(anAtom) {\n return memo1(() => {\n const loadableCache = /* @__PURE__ */ new WeakMap();\n const refreshAtom = atom(0);\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n refreshAtom.debugPrivate = true;\n }\n const derivedAtom = atom(\n (get, { setSelf }) => {\n get(refreshAtom);\n let value;\n try {\n value = get(anAtom);\n } catch (error) {\n return { state: \"hasError\", error };\n }\n if (!isPromiseLike$1(value)) {\n return { state: \"hasData\", data: value };\n }\n const promise = value;\n const cached1 = loadableCache.get(promise);\n if (cached1) {\n return cached1;\n }\n promise.then(\n (data) => {\n loadableCache.set(promise, { state: \"hasData\", data });\n setSelf();\n },\n (error) => {\n loadableCache.set(promise, { state: \"hasError\", error });\n setSelf();\n }\n );\n const cached2 = loadableCache.get(promise);\n if (cached2) {\n return cached2;\n }\n loadableCache.set(promise, LOADING);\n return LOADING;\n },\n (_get, set) => {\n set(refreshAtom, (c) => c + 1);\n }\n );\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n derivedAtom.debugPrivate = true;\n }\n return atom((get) => get(derivedAtom));\n }, anAtom);\n}\n\nconst getCached = (c, m, k) => (m.has(k) ? m : m.set(k, c())).get(k);\nconst cache1 = /* @__PURE__ */ new WeakMap();\nconst memo2 = (create, dep1, dep2) => {\n const cache2 = getCached(() => /* @__PURE__ */ new WeakMap(), cache1, dep1);\n return getCached(create, cache2, dep2);\n};\nconst isPromiseLike = (p) => typeof (p == null ? void 0 : p.then) === \"function\";\nconst defaultFallback = () => void 0;\nfunction unwrap(anAtom, fallback = defaultFallback) {\n return memo2(\n () => {\n const promiseErrorCache = /* @__PURE__ */ new WeakMap();\n const promiseResultCache = /* @__PURE__ */ new WeakMap();\n const refreshAtom = atom(0);\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n refreshAtom.debugPrivate = true;\n }\n const promiseAndValueAtom = atom(\n (get, { setSelf }) => {\n get(refreshAtom);\n const prev = get(promiseAndValueAtom);\n const promise = get(anAtom);\n if (!isPromiseLike(promise)) {\n return { v: promise };\n }\n if (promise !== (prev == null ? void 0 : prev.p)) {\n promise.then(\n (v) => {\n promiseResultCache.set(promise, v);\n setSelf();\n },\n (e) => {\n promiseErrorCache.set(promise, e);\n setSelf();\n }\n );\n }\n if (promiseErrorCache.has(promise)) {\n throw promiseErrorCache.get(promise);\n }\n if (promiseResultCache.has(promise)) {\n return {\n p: promise,\n v: promiseResultCache.get(promise)\n };\n }\n if (prev && \"v\" in prev) {\n return { p: promise, f: fallback(prev.v), v: prev.v };\n }\n return { p: promise, f: fallback() };\n },\n (_get, set) => {\n set(refreshAtom, (c) => c + 1);\n }\n );\n promiseAndValueAtom.init = void 0;\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n promiseAndValueAtom.debugPrivate = true;\n }\n return atom(\n (get) => {\n const state = get(promiseAndValueAtom);\n if (\"f\" in state) {\n return state.f;\n }\n return state.v;\n },\n (_get, set, ...args) => set(anAtom, ...args)\n );\n },\n anAtom,\n fallback\n );\n}\n\nfunction atomWithRefresh(read, write) {\n const refreshAtom = atom(0);\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n refreshAtom.debugPrivate = true;\n }\n return atom(\n (get, options) => {\n get(refreshAtom);\n return read(get, options);\n },\n (get, set, ...args) => {\n if (args.length === 0) {\n set(refreshAtom, (c) => c + 1);\n } else if (write) {\n return write(get, set, ...args);\n } else if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n throw new Error(\"refresh must be called without arguments\");\n }\n }\n );\n}\n\nfunction atomWithLazy(makeInitial) {\n const a = atom(void 0);\n delete a.init;\n Object.defineProperty(a, \"init\", {\n get() {\n return makeInitial();\n }\n });\n return a;\n}\n\nexport { RESET, atomFamily, atomWithDefault, atomWithLazy, atomWithObservable, atomWithReducer, atomWithRefresh, atomWithReset, atomWithStorage, createJSONStorage, freezeAtom, freezeAtomCreator, loadable, selectAtom, splitAtom, withStorageValidator as unstable_withStorageValidator, unwrap };\n","import slug from \"slug\";\n/** Sentinel value for atoms that are not set. */\nexport const NOT_SET = \"NOT_SET\";\n/* Will suspend until the atom is set elsewhere.\n * Returns a promise that will never resolve of type T.\n *\n * Makes use of Jotai's \"async forever\" pattern as described here https://jotai.org/docs/guides/async#async-forever\n */\nexport function suspendUntilSet() {\n return new Promise(() => { });\n}\n/** Makes a URL component for a drive. */\nexport function makeDriveUrlComponent(drive) {\n if (!drive)\n return \"\";\n return `/d/${slug(drive.header.slug)}`;\n}\n/** Makes a URL component for a node. */\nexport function makeNodeUrlComponent(node) {\n if (!node)\n return \"\";\n const nodeName = node.name;\n if (!nodeName)\n return slug(node.id);\n return slug(`${nodeName}-${node.id}`);\n}\n/** Extracts the node slug from a path.\n *\n * The path is expected to be in the format `/d/<drive-slug>/<node-slug>`.\n */\nfunction extractNodeSlug(path) {\n const match = /^\\/d\\/[^/]+\\/([^/]+)$/.exec(path);\n return match ? match[1] : undefined;\n}\n/** Finds a UUID in a string, used for extracting node ids from node slugs in the URL. */\nfunction findUuid(input) {\n if (!input)\n return undefined;\n const uuidRegex = /\\b[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\\b/;\n const match = uuidRegex.exec(input);\n return match ? match[0] : undefined;\n}\n/** Extracts the node id from a path. */\nexport function extractNodeFromPath(path) {\n const nodeSlug = extractNodeSlug(path);\n if (!nodeSlug)\n return undefined;\n const uuid = findUuid(nodeSlug);\n if (!uuid)\n return undefined;\n return uuid;\n}\n/** Extracts the node name, slug, or id from a path. */\nexport function extractNodeNameOrSlugOrIdFromPath(path) {\n const nodeSlug = extractNodeSlug(path);\n const nodeId = findUuid(nodeSlug);\n if (nodeId)\n return nodeId;\n return nodeSlug;\n}\n/** Extracts the drive slug from a path.\n * Used for extracting drive ids from drive slugs in the URL.\n * Expects the path to be in the format `/d/<drive-slug>`.\n */\nexport function extractDriveFromPath(path) {\n const match = /^\\/d\\/([^/]+)/.exec(path);\n return match ? match[1] : null;\n}\n/** Legacy function that makes a slug from a node name.\n * Used for compatibility with the old URL structure in Connect.\n */\nexport function makeNodeSlugFromNodeName(name) {\n return name.replaceAll(/\\s/g, \"-\");\n}\n/** Sets the selected drive and node from the URL.\n *\n * Both the selected drive id and selected node id begin in the NOT_SET state, so they will suspend unless set by this function or another implementation.\n *\n * If the URL is in the format `/d/<drive-slug>`, the selected drive will be set.\n * If the URL is in the format `/d/<drive-slug>/<node-slug>`, the selected drive and node will be set.\n */\nexport async function setSelectedDriveAndNodeFromUrl(reactor, setSelectedDrive, setSelectedNode, shouldNavigate) {\n if (typeof window === \"undefined\")\n return;\n if (!shouldNavigate)\n return;\n if (!reactor)\n return;\n const path = window.location.pathname;\n const drive = await handleDriveFromUrl(reactor, path, setSelectedDrive);\n handleNodeFromUrl(drive, path, setSelectedNode);\n}\nasync function handleDriveFromUrl(reactor, path, setSelectedDrive) {\n const driveSlug = extractDriveFromPath(path);\n const driveIds = await reactor.getDrives();\n const drives = await Promise.all(driveIds.map((id) => reactor.getDrive(id)));\n const drive = drives.find((d) => d.header.slug === driveSlug || d.header.id === driveSlug);\n setSelectedDrive(drive?.header.id);\n return drive;\n}\nfunction handleNodeFromUrl(drive, path, setSelectedNode) {\n const nodeIdOrSlugOrNameFromPath = extractNodeNameOrSlugOrIdFromPath(path);\n const nodes = drive?.state.global.nodes;\n const node = nodes?.find((n) => n.id === nodeIdOrSlugOrNameFromPath ||\n makeNodeSlugFromNodeName(n.name) === nodeIdOrSlugOrNameFromPath);\n setSelectedNode(node?.id);\n}\n//# sourceMappingURL=utils.js.map","import { useAtomValue, useSetAtom } from \"jotai\";\nimport { useCallback } from \"react\";\nimport { drivesAtom, loadableDrivesAtom, loadableSelectedDriveAtom, selectedDriveAtom, unwrappedDrivesAtom, unwrappedSelectedDriveAtom, } from \"./atoms.js\";\nimport { makeDriveUrlComponent } from \"./utils.js\";\n/** Returns a loadable of the drives for a reactor. */\nexport function useDrives() {\n return useAtomValue(loadableDrivesAtom);\n}\n/** Returns a resolved promise of the drives for a reactor. */\nexport function useUnwrappedDrives() {\n return useAtomValue(unwrappedDrivesAtom);\n}\n/** Refreshes the drives for a reactor. */\nexport function useRefreshDrives() {\n return useSetAtom(drivesAtom);\n}\n/** Returns a loadable of a drive for a reactor by id. */\nexport function useDriveById(id) {\n const loadableDrives = useDrives();\n if (loadableDrives.state !== \"hasData\")\n return loadableDrives;\n if (!id)\n return { state: \"hasData\", data: undefined };\n const data = loadableDrives.data;\n return {\n state: \"hasData\",\n data: data.find((d) => d.header.id === id),\n };\n}\n/** Returns a resolved promise of a drive for a reactor by id. */\nexport function useUnwrappedDriveById(id) {\n const drives = useUnwrappedDrives();\n if (!id)\n return undefined;\n return drives?.find((d) => d.header.id === id);\n}\n/** Returns a loadable of the selected drive */\nexport function useSelectedDrive() {\n return useAtomValue(loadableSelectedDriveAtom);\n}\n/** Returns a resolved promise of the selected drive */\nexport function useUnwrappedSelectedDrive() {\n return useAtomValue(unwrappedSelectedDriveAtom);\n}\n/** Returns a function that sets the selected drive with a drive id.\n *\n * If `shouldNavigate` is true, the URL will be updated to the new drive.\n * `shouldNavigate` can be overridden by passing a different value to the callback.\n */\nexport function useSetSelectedDrive(shouldNavigate = true) {\n const drives = useUnwrappedDrives();\n const setSelectedDrive = useSetAtom(selectedDriveAtom);\n return useCallback((driveId, _shouldNavigate = shouldNavigate) => {\n setSelectedDrive(driveId);\n const drive = drives?.find((d) => d.header.id === driveId);\n const newPathname = makeDriveUrlComponent(drive);\n if (typeof window !== \"undefined\" && _shouldNavigate) {\n window.history.pushState(null, \"\", newPathname);\n }\n }, [drives, setSelectedDrive]);\n}\n/** Returns a loadable of the remote URL for a drive. */\nexport function useDriveRemoteUrl(driveId) {\n const loadableDrive = useDriveById(driveId);\n const pullResponderUrl = useDrivePullResponderUrl(driveId);\n if (!driveId)\n return { state: \"hasData\", data: undefined };\n if (loadableDrive.state !== \"hasData\")\n return loadableDrive;\n const drive = loadableDrive.data;\n if (!drive)\n return { state: \"hasData\", data: undefined };\n if (\"remoteUrl\" in drive.state.global) {\n const remoteUrl = drive.state.global.remoteUrl;\n if (typeof remoteUrl === \"string\") {\n return {\n state: \"hasData\",\n data: remoteUrl,\n };\n }\n }\n if (pullResponderUrl.state !== \"hasData\")\n return pullResponderUrl;\n return {\n state: \"hasData\",\n data: undefined,\n };\n}\n/** Returns a loadable of the pull responder trigger for a drive. */\nexport function useDrivePullResponderTrigger(driveId) {\n const loadableDrive = useDriveById(driveId);\n if (!driveId)\n return { state: \"hasData\", data: undefined };\n if (loadableDrive.state !== \"hasData\")\n return loadableDrive;\n const drive = loadableDrive.data;\n if (!drive)\n return { state: \"hasData\", data: undefined };\n const pullResponder = drive.state.local.triggers.find((trigger) => trigger.type === \"PullResponder\");\n return {\n state: \"hasData\",\n data: pullResponder,\n };\n}\n/** Returns a loadable of the pull responder URL for a drive. */\nexport function useDrivePullResponderUrl(driveId) {\n const pullResponder = useDrivePullResponderTrigger(driveId);\n if (!driveId)\n return { state: \"hasData\", data: undefined };\n if (pullResponder.state !== \"hasData\")\n return pullResponder;\n const trigger = pullResponder.data;\n return {\n state: \"hasData\",\n data: trigger?.data?.url,\n };\n}\n/** Returns a loadable of whether a drive is remote. */\nexport function useDriveIsRemote(driveId) {\n const remoteUrl = useDriveRemoteUrl(driveId);\n const pullResponder = useDrivePullResponderTrigger(driveId);\n if (!driveId)\n return { state: \"hasData\", data: false };\n if (remoteUrl.state === \"loading\" || pullResponder.state === \"loading\")\n return {\n state: \"loading\",\n };\n if (remoteUrl.state === \"hasError\")\n return {\n state: \"hasError\",\n error: remoteUrl.error,\n };\n if (pullResponder.state === \"hasError\")\n return {\n state: \"hasError\",\n error: pullResponder.error,\n };\n return {\n state: \"hasData\",\n data: remoteUrl.data !== undefined || pullResponder.data !== undefined,\n };\n}\n/** Returns a loadable of the sharing type for a drive. */\nexport function useDriveSharingType(driveId) {\n const loadableDrive = useDriveById(driveId);\n if (!driveId)\n return { state: \"hasData\", data: undefined };\n if (loadableDrive.state !== \"hasData\")\n return loadableDrive;\n const drive = loadableDrive.data;\n if (!drive)\n return { state: \"hasData\", data: undefined };\n return {\n state: \"hasData\",\n data: getDriveSharingType(drive),\n };\n}\n/** Returns a loadable of whether a drive is available offline. */\nexport function useIsDriveAvailableOffline(driveId) {\n const loadableDrive = useDriveById(driveId);\n if (!driveId)\n return { state: \"hasData\", data: false };\n if (loadableDrive.state !== \"hasData\")\n return loadableDrive;\n const drive = loadableDrive.data;\n if (!drive)\n return { state: \"hasData\", data: false };\n return {\n state: \"hasData\",\n data: getDriveAvailableOffline(drive),\n };\n}\n/** Returns the sharing type for a drive. */\nexport function getDriveSharingType(drive) {\n if (!drive)\n return \"PUBLIC\";\n const isReadDrive = \"readContext\" in drive;\n const { sharingType: _sharingType } = !isReadDrive\n ? drive.state.local\n : { sharingType: \"PUBLIC\" };\n const __sharingType = _sharingType?.toUpperCase();\n return (__sharingType === \"PRIVATE\" ? \"LOCAL\" : __sharingType);\n}\n/** Returns whether a drive is available offline. */\nexport function getDriveAvailableOffline(drive) {\n if (!drive)\n return false;\n const isReadDrive = \"readContext\" in drive;\n const { availableOffline: _availableOffline } = !isReadDrive\n ? drive.state.local\n : { availableOffline: false };\n return _availableOffline ?? false;\n}\n//# sourceMappingURL=drives.js.map","import { useAtomValue, useSetAtom } from \"jotai\";\nimport { useCallback } from \"react\";\nimport { loadableNodesAtom, setSelectedNodeAtom, unwrappedNodesAtom, } from \"./atoms.js\";\nimport { useSelectedDrive } from \"./drives.js\";\nimport { useSelectedFolder } from \"./folders.js\";\nimport { extractDriveFromPath, makeNodeUrlComponent } from \"./utils.js\";\n/** Returns a loadable of the nodes for a reactor. */\nexport function useNodes() {\n return useAtomValue(loadableNodesAtom);\n}\n/** Returns a function that sets the selected node with a node id.\n *\n * If `shouldNavigate` is true, the URL will be updated to the new node.\n * `shouldNavigate` can be overridden by passing a different value to the callback.\n */\nexport function useSetSelectedNode(shouldNavigate = true) {\n const nodes = useUnwrappedNodes();\n const setSelectedNode = useSetAtom(setSelectedNodeAtom);\n return useCallback((nodeId, _shouldNavigate = shouldNavigate) => {\n setSelectedNode(nodeId);\n if (typeof window !== \"undefined\" && _shouldNavigate) {\n const driveSlugFromPath = extractDriveFromPath(window.location.pathname);\n const node = nodes?.find((n) => n.id === nodeId);\n if (!node) {\n window.history.pushState(null, \"\", `/d/${driveSlugFromPath}`);\n }\n else {\n const nodeSlug = makeNodeUrlComponent(node);\n window.history.pushState(null, \"\", `/d/${driveSlugFromPath}/${nodeSlug}`);\n }\n }\n }, [setSelectedNode, nodes]);\n}\n/** Returns a resolved promise of the nodes for a reactor. */\nexport function useUnwrappedNodes() {\n return useAtomValue(unwrappedNodesAtom);\n}\n/** Returns a resolved promise of a node for a reactor by id. */\nexport function useNodeById(id) {\n const unwrappedNodes = useUnwrappedNodes();\n return unwrappedNodes?.find((n) => n.id === id);\n}\n/** Returns a resolved promise of the parent folder for a node. */\nexport function useParentFolder(id) {\n const node = useNodeById(id);\n return node?.parentFolder ?? undefined;\n}\n/** Returns a loadable of the path to a node. */\nexport function useNodePath(id) {\n const loadableNodes = useNodes();\n const loadableSelectedDrive = useSelectedDrive();\n if (loadableSelectedDrive.state !== \"hasData\")\n return loadableSelectedDrive;\n if (loadableNodes.state !== \"hasData\")\n return loadableNodes;\n const nodes = loadableNodes.data;\n const selectedDrive = loadableSelectedDrive.data;\n if (!nodes || !selectedDrive)\n return { state: \"hasData\", data: undefined };\n const driveFolderNode = {\n id: selectedDrive.header.id,\n name: selectedDrive.state.global.name,\n kind: \"FOLDER\",\n parentFolder: null,\n };\n const path = [driveFolderNode];\n let current = nodes.find((n) => n.id === id);\n while (current) {\n path.unshift(current);\n if (!current.parentFolder)\n break;\n current = nodes.find((n) => n.id === current?.parentFolder);\n }\n return { state: \"hasData\", data: path.reverse() };\n}\n/** Returns a loadable of the child nodes for the selected drive or folder. */\nexport function useChildNodes() {\n const nodes = useNodes();\n const selectedFolder = useSelectedFolder();\n if (nodes.state !== \"hasData\")\n return nodes;\n if (selectedFolder.state !== \"hasData\")\n return selectedFolder;\n const selectedFolderId = selectedFolder.data?.id;\n if (!selectedFolderId)\n return {\n state: \"hasData\",\n data: sortNodesByName(nodes.data ?? []),\n };\n return {\n state: \"hasData\",\n data: sortNodesByName(nodes.data?.filter((n) => n.parentFolder === selectedFolderId) ?? []),\n };\n}\n/** Returns the kind of a node. */\nexport function useNodeKind(id) {\n const unwrappedNodes = useUnwrappedNodes();\n if (!unwrappedNodes)\n return undefined;\n const node = unwrappedNodes.find((n) => n.id === id);\n if (!node)\n return undefined;\n return node.kind.toUpperCase();\n}\n/** Sorts nodes by name. */\nexport function sortNodesByName(nodes) {\n return nodes.toSorted((a, b) => a.name.localeCompare(b.name));\n}\n/** Returns whether a node is a file. */\nexport function isFileNodeKind(node) {\n if (!node)\n return false;\n return node.kind.toUpperCase() === \"FILE\";\n}\n/** Returns whether a node is a folder. */\nexport function isFolderNodeKind(node) {\n if (!node)\n return false;\n return node.kind.toUpperCase() === \"FOLDER\";\n}\n//# sourceMappingURL=nodes.js.map","import { atom } from \"jotai\";\nimport { atomWithRefresh, loadable, unwrap } from \"jotai/utils\";\nimport { isFolderNodeKind } from \"./nodes.js\";\nimport { NOT_SET, suspendUntilSet } from \"./utils.js\";\n/* Reactor */\n/** Holds the reactor instance.\n *\n * Like all base atoms, it is not meant to be accessed or updated directly.\n * Starts off with the sentinel value NOT_SET.\n */\nconst baseReactorAtom = atom(NOT_SET);\nbaseReactorAtom.debugLabel = \"baseReactorAtom\";\n/** Returns a promise of the reactor instance if it is set, otherwise suspends until it is set. */\nexport const reactorAtom = atom(async (get) => {\n const reactor = get(baseReactorAtom);\n // Suspends until the reactor is set.\n if (reactor === NOT_SET)\n return suspendUntilSet();\n return reactor;\n});\nreactorAtom.debugLabel = \"reactorAtom\";\n/** Sets the reactor instance. Only runs if the baseReactorAtom is NOT_SET. */\nexport const initializeReactorAtom = atom(null, (get, set, reactor) => {\n const baseReactor = get(baseReactorAtom);\n // Only runs if the baseReactorAtom is NOT_SET.\n if (baseReactor === NOT_SET) {\n set(baseReactorAtom, reactor);\n }\n});\ninitializeReactorAtom.debugLabel = \"setReactorAtom\";\n/** Returns a Loadable of the reactor instance. */\nexport const loadableReactorAtom = loadable(reactorAtom);\nloadableReactorAtom.debugLabel = \"loadableReactorAtom\";\n/** Returns a resolved promise of the reactor instance. */\nexport const unwrappedReactorAtom = unwrap(reactorAtom);\nunwrappedReactorAtom.debugLabel = \"unwrappedReactorAtom\";\n/* Drives */\n/** Holds a promise of the drives for a given reactor.\n *\n * Suspends until the reactor is set.\n *\n * Does not provide a direct setter, instead it uses `atomWithRefresh` which will refetch the drives from the reactor when called.\n * See https://jotai.org/docs/utilities/resettable#atomwithrefresh for more details.\n */\nexport const drivesAtom = atomWithRefresh(async (get) => {\n const loadableReactor = get(loadableReactorAtom);\n // Suspends until the reactor is set.\n if (loadableReactor.state !== \"hasData\")\n return suspendUntilSet();\n const reactor = loadableReactor.data;\n // If the reactor is not set, returns an empty array.\n if (!reactor)\n return [];\n const driveIds = await reactor.getDrives();\n const drives = new Array();\n for (const driveId of driveIds) {\n const drive = await reactor.getDrive(driveId);\n drives.push(drive);\n }\n return drives;\n});\ndrivesAtom.debugLabel = \"drivesAtom\";\n/** Returns a Loadable of the drives for a given reactor. */\nexport const loadableDrivesAtom = loadable(drivesAtom);\nloadableDrivesAtom.debugLabel = \"loadableDrivesAtom\";\n/** Returns a resolved promise of the drives for a given reactor. */\nexport const unwrappedDrivesAtom = unwrap(drivesAtom);\nunwrappedDrivesAtom.debugLabel = \"unwrappedDrivesAtom\";\n/** Holds the selected drive id.\n *\n * Like all base atoms, it is not meant to be accessed or updated directly.\n * Starts off with the sentinel value NOT_SET.\n *\n * When this value changes, the data for the selected drive is re-fetched from the drives atom.\n */\nconst baseSelectedDriveIdAtom = atom(NOT_SET);\nbaseSelectedDriveIdAtom.debugLabel = \"baseSelectedDriveIdAtom\";\n/** Returns a promise of the selected drive.\n *\n * Provides a setter which receives a drive id and updates the baseSelectedDriveIdAtom.\n *\n * Suspends until the reactor's drives are set and the selected drive id is set.\n * If the selected drive id is set as undefined, returns a resolved promise of undefined.\n *\n * When the selected drive is set, the selected node id is also set to undefined, since by definition selecting a new drive means navigating to the root of the new drive.\n */\nexport const selectedDriveAtom = atom((get) => {\n const driveId = get(baseSelectedDriveIdAtom);\n const loadableDrives = get(loadableDrivesAtom);\n // Suspends until the reactor's drives are set and the selected drive id is set.\n if (driveId === NOT_SET || loadableDrives.state !== \"hasData\")\n return suspendUntilSet();\n const drives = loadableDrives.data;\n return drives.find((drive) => drive.header.id === driveId);\n}, (_get, set, driveId) => {\n // Updates the baseSelectedDriveIdAtom.\n set(baseSelectedDriveIdAtom, driveId);\n // Resets the selected node id.\n set(selectedNodeIdAtom, undefined);\n});\nselectedDriveAtom.debugLabel = \"selectedDriveAtom\";\n/** Returns a Loadable of the selected drive. */\nexport const loadableSelectedDriveAtom = loadable(selectedDriveAtom);\nloadableSelectedDriveAtom.debugLabel = \"loadableSelectedDriveAtom\";\n/** Returns a resolved promise of the selected drive. */\nexport const unwrappedSelectedDriveAtom = unwrap(selectedDriveAtom);\nunwrappedSelectedDriveAtom.debugLabel = \"unwrappedSelectedDriveAtom\";\n/* Nodes */\n/** Holds a promise of the nodes for the selected drive.\n *\n * Derived from selectedDrive.state.global.nodes.\n *\n * Suspends until the selected drive is set.\n *\n * If the selected drive is set as undefined, returns a resolved promise of undefined.\n *\n * Does not provide a setter, since it is derived from the selected drive.\n */\nexport const nodesAtom = atom(async (get) => {\n const loadableSelectedDrive = get(loadableSelectedDriveAtom);\n // Suspends until the selected drive is set.\n if (loadableSelectedDrive.state !== \"hasData\")\n return suspendUntilSet();\n const drive = loadableSelectedDrive.data;\n return drive?.state.global.nodes;\n});\nnodesAtom.debugLabel = \"nodesAtom\";\nexport const loadableNodesAtom = loadable(nodesAtom);\nloadableNodesAtom.debugLabel = \"loadableNodesAtom\";\nexport const unwrappedNodesAtom = unwrap(nodesAtom);\nunwrappedNodesAtom.debugLabel = \"unwrappedNodesAtom\";\n/** Holds the selected node id.\n *\n * This id comes from the drive's nodes, which can be the id for a document or for a meta item such as a folder.\n *\n * Like all base atoms, it is not meant to be accessed or updated directly.\n * Starts off with the sentinel value NOT_SET.\n *\n * When this value changes, the data for the selected node is re-fetched from the nodes atom.\n */\nexport const selectedNodeIdAtom = atom(NOT_SET);\nselectedNodeIdAtom.debugLabel = \"selectedNodeIdAtom\";\n/** Sets the selected node via a node id. */\nexport const setSelectedNodeAtom = atom(null, (_get, set, nodeId) => {\n set(selectedNodeIdAtom, nodeId);\n});\nsetSelectedNodeAtom.debugLabel = \"setSelectedNodeAtom\";\n/** Returns a promise of the selected folder.\n *\n * A \"folder\" is a meta item that contains other nodes. It is not a document itself. Folder nodes have a `kind` of `folder` or `FOLDER`.\n *\n * Suspends until the nodes are set and the selected node id is set.\n * If the selected node id is set as undefined, returns a resolved promise of undefined.\n *\n * Does not provide a setter, since it is derived from the selected node id.\n */\nexport const selectedFolderAtom = atom((get) => {\n const loadableNodes = get(loadableNodesAtom);\n const nodeId = get(selectedNodeIdAtom);\n // Suspends until the nodes are set and the selected node id is set.\n if (nodeId === NOT_SET || loadableNodes.state !== \"hasData\")\n return suspendUntilSet();\n const nodes = loadableNodes.data;\n // Filters the nodes to only include folder nodes.\n const folderNodes = nodes?.filter(isFolderNodeKind);\n // Returns the folder node with the selected node id.\n return folderNodes?.find((node) => node.id === nodeId);\n});\nselectedFolderAtom.debugLabel = \"selectedFolderAtom\";\n/** Returns a Loadable of the selected folder. */\nexport const loadableSelectedFolderAtom = loadable(selectedFolderAtom);\nloadableSelectedFolderAtom.debugLabel = \"loadableSelectedFolderAtom\";\n/** Returns a resolved promise of the selected folder. */\nexport const unwrappedSelectedFolderAtom = unwrap(selectedFolderAtom);\nunwrappedSelectedFolderAtom.debugLabel = \"unwrappedSelectedFolderAtom\";\n/* Documents */\n/** Holds a promise of the documents for the selected drive.\n *\n * Suspends until the selected drive is set.\n *\n * If the selected drive is set as undefined, returns a resolved promise of undefined.\n *\n * Does not provide a setter, instead it uses `atomWithRefresh` which will refetch the documents from the reactor when called.\n * See https://jotai.org/docs/utilities/resettable#atomwithrefresh for more details.\n */\nexport const documentsAtom = atomWithRefresh(async (get) => {\n const loadableReactor = get(loadableReactorAtom);\n const loadableDrive = get(loadableSelectedDriveAtom);\n // Suspends until the selected drive is set.\n if (loadableReactor.state !== \"hasData\" || loadableDrive.state !== \"hasData\")\n return suspendUntilSet();\n const reactor = loadableReactor.data;\n const driveId = loadableDrive.data?.header.id;\n // If the reactor or drive id is not set, returns an empty array.\n if (!reactor || !driveId)\n return [];\n const documentIds = await reactor.getDocuments(driveId);\n const documents = await Promise.all(documentIds.map((id) => reactor.getDocument(driveId, id)));\n return documents;\n});\ndocumentsAtom.debugLabel = \"documentsAtom\";\n/** Returns a Loadable of the documents for the selected drive. */\nexport const loadableDocumentsAtom = loadable(documentsAtom);\nloadableDocumentsAtom.debugLabel = \"loadableDocumentsAtom\";\n/** Returns a resolved promise of the documents for the selected drive. */\nexport const unwrappedDocumentsAtom = unwrap(documentsAtom);\nunwrappedDocumentsAtom.debugLabel = \"unwrappedDocumentsAtom\";\n/** Returns a promise of the selected document.\n *\n * A \"document\" is a PHDocument. This id is the document's id, and this id will also be found in the drive's nodes. We use the same id for finding a node in a drive and for identifying a document in the reactor.\n *\n * Suspends until the documents are set and the selected node id is set.\n * If the selected node id is set as undefined, returns a resolved promise of undefined.\n *\n * Does not provide a setter, since it is derived from the selected node id.\n */\nexport const selectedDocumentAtom = atom((get) => {\n const loadableDocuments = get(loadableDocumentsAtom);\n const nodeId = get(selectedNodeIdAtom);\n // Suspends until the documents are set and the selected node id is set.\n if (nodeId === NOT_SET || loadableDocuments.state !== \"hasData\")\n return suspendUntilSet();\n const documents = loadableDocuments.data;\n return documents.find((document) => document.header.id === nodeId);\n});\nselectedDocumentAtom.debugLabel = \"selectedDocumentAtom\";\n/** Returns a Loadable of the selected document. */\nexport const loadableSelectedDocumentAtom = loadable(selectedDocumentAtom);\nloadableSelectedDocumentAtom.debugLabel = \"loadableSelectedDocumentAtom\";\n/** Returns a resolved promise of the selected document. */\nexport const unwrappedSelectedDocumentAtom = unwrap(selectedDocumentAtom);\nunwrappedSelectedDocumentAtom.debugLabel = \"unwrappedSelectedDocumentAtom\";\n/* PH Packages */\nexport const phPackagesAtom = atom(Promise.resolve(undefined));\nphPackagesAtom.debugLabel = \"phPackagesAtom\";\nexport const setPhPackagesAtom = atom(null, (_get, set, phPackages) => {\n set(phPackagesAtom, Promise.resolve(phPackages));\n});\nsetPhPackagesAtom.debugLabel = \"setPhPackagesAtom\";\nexport const loadablePhPackagesAtom = loadable(phPackagesAtom);\nloadablePhPackagesAtom.debugLabel = \"loadablePhPackagesAtom\";\nexport const unwrappedPhPackagesAtom = unwrap(phPackagesAtom);\nunwrappedPhPackagesAtom.debugLabel = \"unwrappedPhPackagesAtom\";\n/* Document Model Modules */\nexport const documentModelModulesAtom = atomWithRefresh(async (get) => {\n const loadablePhPackages = get(loadablePhPackagesAtom);\n if (loadablePhPackages.state !== \"hasData\")\n return suspendUntilSet();\n const phPackages = loadablePhPackages.data;\n return phPackages?.map((p) => p.documentModels).flat();\n});\ndocumentModelModulesAtom.debugLabel = \"documentModelModulesAtom\";\nexport const loadableDocumentModelModulesAtom = loadable(documentModelModulesAtom);\nloadableDocumentModelModulesAtom.debugLabel =\n \"loadableDocumentModelModulesAtom\";\nexport const unwrappedDocumentModelModulesAtom = unwrap(documentModelModulesAtom);\nunwrappedDocumentModelModulesAtom.debugLabel =\n \"unwrappedDocumentModelModulesAtom\";\n/* Editors */\nexport const editorModulesAtom = atomWithRefresh(async (get) => {\n const loadablePhPackages = get(loadablePhPackagesAtom);\n if (loadablePhPackages.state !== \"hasData\")\n return suspendUntilSet();\n const phPackages = loadablePhPackages.data;\n return phPackages?.map((p) => p.editors).flat();\n});\neditorModulesAtom.debugLabel = \"editorModulesAtom\";\nexport const loadableEditorModulesAtom = loadable(editorModulesAtom);\nloadableEditorModulesAtom.debugLabel = \"loadableEditorModulesAtom\";\nexport const unwrappedEditorModulesAtom = unwrap(editorModulesAtom);\nunwrappedEditorModulesAtom.debugLabel = \"unwrappedEditorModulesAtom\";\n/* Processor Manager */\nexport const processorManagerAtom = atom(undefined);\nprocessorManagerAtom.debugLabel = \"processorManagerAtom\";\n/* Config */\nexport const configAtom = atom({\n appVersion: undefined,\n studioMode: false,\n warnOutdatedApp: false,\n routerBasename: undefined,\n analyticsDatabaseName: undefined,\n sentry: {\n dsn: undefined,\n env: undefined,\n tracing: undefined,\n },\n content: {\n showSearchBar: true,\n showDocumentModelSelectionSetting: true,\n },\n drives: {\n addDriveEnabled: true,\n sections: {\n LOCAL: {\n enabled: true,\n allowAdd: true,\n allowDelete: true,\n },\n CLOUD: {\n enabled: true,\n allowAdd: true,\n allowDelete: true,\n },\n PUBLIC: {\n enabled: true,\n allowAdd: true,\n allowDelete: true,\n },\n },\n },\n gaTrackingId: undefined,\n phCliVersion: undefined,\n});\nconfigAtom.debugLabel = \"configAtom\";\n//# sourceMappingURL=atoms.js.map","import { useAtomValue, useSetAtom } from \"jotai\";\nimport { documentsAtom, loadableDocumentsAtom, loadableSelectedDocumentAtom, unwrappedDocumentsAtom, unwrappedSelectedDocumentAtom, } from \"./atoms.js\";\n/** Returns a loadable of the documents for a reactor. */\nexport function useDocuments() {\n return useAtomValue(loadableDocumentsAtom);\n}\n/** Returns a resolved promise of the documents for a reactor. */\nexport function useUnwrappedDocuments() {\n return useAtomValue(unwrappedDocumentsAtom);\n}\n/** Refreshes the documents for a reactor. */\nexport function useRefreshDocuments() {\n return useSetAtom(documentsAtom);\n}\n/** Returns a loadable of the selected document. */\nexport function useSelectedDocument() {\n return useAtomValue(loadableSelectedDocumentAtom);\n}\n/** Returns a resolved promise of the selected document. */\nexport function useUnwrappedSelectedDocument() {\n return useAtomValue(unwrappedSelectedDocumentAtom);\n}\n/** Returns a loadable of a document for a reactor by id. */\nexport function useDocumentById(id) {\n const documents = useDocuments();\n if (documents.state !== \"hasData\")\n return documents;\n if (!id)\n return { state: \"hasData\", data: undefined };\n const document = documents.data.find((d) => d.header.id === id);\n return { state: \"hasData\", data: document };\n}\n/** Returns a resolved promise of a document for a reactor by id. */\nexport function useUnwrappedDocumentById(id) {\n const documents = useUnwrappedDocuments();\n if (!id)\n return undefined;\n return documents?.find((d) => d.header.id === id);\n}\n//# sourceMappingURL=documents.js.map","import { useCallback } from \"react\";\nimport { useRefreshDocuments } from \"./documents.js\";\nimport { useRefreshDrives } from \"./drives.js\";\n/** Returns a function that refreshes the drives and documents for a reactor. */\nexport function useSyncDrivesAndDocumentsWithReactor() {\n const refreshDrives = useRefreshDrives();\n const refreshDocuments = useRefreshDocuments();\n return useCallback(() => {\n refreshDrives();\n refreshDocuments();\n }, [refreshDrives, refreshDocuments]);\n}\n//# sourceMappingURL=syncing.js.map","import { childLogger, SynchronizationUnitNotFoundError, } from \"document-drive\";\nimport { useAtomValue, useSetAtom } from \"jotai\";\nimport { useCallback, useEffect } from \"react\";\nimport { initializeReactorAtom, loadableReactorAtom, selectedDriveAtom, setSelectedNodeAtom, unwrappedReactorAtom, } from \"./atoms.js\";\nimport { useSyncDrivesAndDocumentsWithReactor } from \"./syncing.js\";\nimport { setSelectedDriveAndNodeFromUrl } from \"./utils.js\";\nconst logger = childLogger([\"state\", \"reactor\"]);\n/** Returns a loadable of the reactor. */\nexport function useReactor() {\n return useAtomValue(loadableReactorAtom);\n}\n/** Returns the unwrapped reactor. */\nexport function useUnwrappedReactor() {\n return useAtomValue(unwrappedReactorAtom);\n}\n/** Initializes the reactor.\n *\n * Creates the reactor and sets the selected drive and node from the URL if `shouldNavigate` is true.\n * Subscribes to the reactor's events and refreshes the drives and documents when they change.\n *\n * If the reactor is already initialized, does nothing.\n */\nexport function useInitializeReactor(createReactor, shouldNavigate = true) {\n const unwrappedReactor = useUnwrappedReactor();\n const setReactor = useSetAtom(initializeReactorAtom);\n const setSelectedDrive = useSetAtom(selectedDriveAtom);\n const setSelectedNode = useSetAtom(setSelectedNodeAtom);\n const refresh = useSyncDrivesAndDocumentsWithReactor();\n useEffect(() => {\n // If the reactor is already initialized, do nothing.\n if (unwrappedReactor)\n return;\n async function initializeReactor() {\n // Create the reactor instance.\n const reactor = await createReactor();\n // Subscribe to the reactor's events.\n reactor.on(\"syncStatus\", (event, status, error) => {\n logger.verbose(\"syncStatus\", event, status, error);\n refresh();\n });\n reactor.on(\"strandUpdate\", () => {\n logger.verbose(\"strandUpdate\");\n refresh();\n });\n reactor.on(\"defaultRemoteDrive\", () => {\n logger.verbose(\"defaultRemoteDrive\");\n refresh();\n });\n // Set the reactor instance atom.\n setReactor(reactor);\n // Set the selected drive and node from the URL if `shouldNavigate` is true.\n await setSelectedDriveAndNodeFromUrl(reactor, setSelectedDrive, setSelectedNode, shouldNavigate);\n }\n initializeReactor().catch(logger.error);\n }, [setReactor, createReactor, refresh, shouldNavigate]);\n}\nexport function useGetSyncStatusSync() {\n const reactor = useUnwrappedReactor();\n const getSyncStatusSync = useCallback((syncId, sharingType) => {\n if (sharingType === \"LOCAL\")\n return;\n if (!reactor) {\n return \"INITIAL_SYNC\";\n }\n try {\n const syncStatus = reactor.getSyncStatus(syncId);\n if (syncStatus instanceof SynchronizationUnitNotFoundError)\n return \"INITIAL_SYNC\";\n return syncStatus;\n }\n catch (error) {\n logger.error(error);\n return \"ERROR\";\n }\n }, [reactor]);\n return getSyncStatusSync;\n}\n//# sourceMappingURL=reactor.js.map","import {\n InternalDevTools\n} from \"./chunk-HLGSGNDX.esm.mjs\";\nimport {\n useAtomDevtools,\n useAtomsDebugValue,\n useAtomsDevtools,\n useAtomsSnapshot,\n useGotoAtomsSnapshot\n} from \"./chunk-K3M223F4.esm.mjs\";\n\n// src/index.ts\nvar DevTools = process.env.NODE_ENV !== \"production\" ? InternalDevTools : () => null;\nexport {\n DevTools,\n useAtomDevtools,\n useAtomsDebugValue,\n useAtomsDevtools,\n useAtomsSnapshot,\n useGotoAtomsSnapshot\n};\n","import { createStore } from \"jotai\";\n/** The atom store for the app.\n *\n * All derived hooks should use this store.\n */\nexport const atomStore = createStore();\n//# sourceMappingURL=store.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Provider } from \"jotai\";\nimport { DevTools } from \"jotai-devtools\";\nimport \"jotai-devtools/styles.css\";\nimport { useInitializeReactor } from \"./reactor.js\";\nimport { atomStore } from \"./store.js\";\nfunction InitReactor({ reactor }) {\n useInitializeReactor(() => Promise.resolve(reactor));\n return null;\n}\n/** Provides the atom store to the app.\n *\n * This is the top-level provider for the atom store.\n *\n * It is used to provide the atom store to the app.\n *\n * It should only be used once in the app and must appear before any `<Suspense>` boundaries.\n *\n * Includes the Jotai DevTools for debugging.\n */\nexport function AtomStoreProvider({ reactor, children, }) {\n return (_jsxs(Provider, { store: atomStore, children: [_jsx(DevTools, { store: atomStore }), reactor && _jsx(InitReactor, { reactor: reactor }), children] }));\n}\n//# sourceMappingURL=store-provider.js.map","import { lazy, StrictMode, Suspense } from 'react';\nimport '../i18n';\n\nimport { AtomStoreProvider } from '@powerhousedao/common';\nimport { AppSkeleton } from './app-skeleton.js';\n\nconst App = lazy(() => import('./app.js'));\nconst CookieBanner = lazy(() =>\n import('./cookie-banner.js').then(m => ({ default: m.CookieBanner })),\n);\n\nconst ModalManager = lazy(() =>\n import('./modal/modal.js').then(m => ({ default: m.ModalManager })),\n);\n\nexport const AppLoader = (\n <StrictMode>\n <AtomStoreProvider>\n <Suspense fallback={<AppSkeleton />} name=\"AppLoader\">\n <App />\n </Suspense>\n <Suspense name=\"CookieBanner\">\n <ModalManager>\n <CookieBanner />\n </ModalManager>\n </Suspense>\n </AtomStoreProvider>\n </StrictMode>\n);\n","import { createRoot } from 'react-dom/client';\nimport { AppLoader } from './components/app-loader.js';\n\nfunction renderApp(element: HTMLElement) {\n createRoot(element).render(AppLoader);\n}\n\nconst AppElement = document.getElementById('app');\nif (!AppElement) {\n throw new Error('#app element not found!');\n}\n\nrenderApp(AppElement);\n"],"file":"assets/index.CIKNjgvt.js"}
1
+ {"version":3,"mappings":";uUAEMA,GAAQ,QACXC,EAAkB,aAAuB,UAAY,aAAe,QAAU,EACjF,EAgVMC,EAAmBC,GAAM,OAAQA,GAAK,KAAO,OAASA,EAAE,OAAU,WAsBxE,SAASC,GAAkBC,EAAmB,IAAM,CAClD,GAAI,CACF,OAAO,OAAO,mBACPC,EAAG,EACLL,EAAkB,aAAuB,UAAY,cACpD,OAAO,OAAW,KACpB,QAAQ,KAAKK,CAAC,EAGlB,MAAO,CAEX,EAAGC,EAAS,CACV,IAAIC,EACJ,IAAIC,EACAC,EACJ,MAAMC,EAAU,CACd,QAAS,CAACC,EAAKC,IAAiB,CAC9B,IAAIC,EAAKC,EACT,MAAMC,EAASC,GAAS,CAEtB,GADAA,EAAOA,GAAQ,GACXR,IAAYQ,EAAM,CACpB,GAAI,CACFP,EAAY,KAAK,MAAMO,EAAwB,MAAwB,OAC7D,CACV,OAAOJ,CAAA,CAETJ,EAAUQ,CAAA,CAEZ,OAAOP,CAAA,EAEHQ,GAAOH,GAAMD,EAAMT,EAAA,IAAuB,KAAO,OAASS,EAAI,QAAQF,CAAG,IAAM,KAAOG,EAAK,KACjG,OAAIb,EAAgBgB,CAAG,EACdA,EAAI,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AAA,IAAM,OAAO,mBAAU,OAAApF,KAAA,0DAAC,EACnCqF,GAAeF,EAAK,UACtB,OAAO,6BAAoB,6DAAE,SAAW,CAAE,QAASpI,EAAE,cAAe,CACxE,EAEMuI,GAAeH,EAAK,UACtB,OAAO,qBAAkB,2CAAE,SAAW,CAAE,QAASpI,EAAE,cAAe,CACtE,EAEawI,GACTC,EAACC,GAAA,CACG,SAAAC,EAACb,GAAA,CACG,UAAAW,EAACG,EAAA,CAAS,SAAUH,EAACI,GAAA,EAAY,EAAI,KAAK,YACtC,SAAAJ,EAACN,GAAA,EAAI,EACT,EACAM,EAACG,GAAS,KAAK,eACX,WAACL,GAAA,CACG,SAAAE,EAACH,GAAA,EAAa,EAClB,EACJ,GACJ,EACJ,ECxBJ,SAASQ,GAAUC,EAAsB,CACrCC,GAAWD,CAAO,EAAE,OAAOP,EAAS,CACxC,CAEA,MAAMS,GAAa,SAAS,eAAe,KAAK,EAChD,GAAI,CAACA,GACD,MAAM,IAAI,MAAM,yBAAyB,EAG7CH,GAAUG,EAAU","names":["RESET","__vite_import_meta_env__","isPromiseLike$3","x","createJSONStorage","getStringStorage","e","options","_a","lastStr","lastValue","storage","key","initialValue","_a2","_b","parse","str2","str","newValue","createHandleSubscribe","subscriber2","callback","v","subscriber","storageEventCallback","defaultStorage","atomWithStorage","baseAtom","atom","setAtom","unsub","get","set","update","nextValue","resolvedValue","cache1$1","memo1","create","dep1","isPromiseLike$1","p","LOADING","loadable","anAtom","loadableCache","refreshAtom","derivedAtom","setSelf","value","error","promise","cached1","data","cached2","_get","c","getCached","m","k","cache1","memo2","dep2","cache2","isPromiseLike","defaultFallback","unwrap","fallback","promiseErrorCache","promiseResultCache","promiseAndValueAtom","prev","state","args","atomWithRefresh","read","write","atomWithLazy","makeInitial","a","NOT_SET","suspendUntilSet","extractNodeSlug","path","match","findUuid","input","extractNodeNameOrSlugOrIdFromPath","nodeSlug","nodeId","extractDriveFromPath","makeNodeSlugFromNodeName","name","setSelectedDriveAndNodeFromUrl","reactor","setSelectedDrive","setSelectedNode","shouldNavigate","drive","handleDriveFromUrl","handleNodeFromUrl","driveSlug","driveIds","id","nodeIdOrSlugOrNameFromPath","nodes","node","n","useRefreshDrives","useSetAtom","drivesAtom","isFolderNodeKind","baseReactorAtom","reactorAtom","initializeReactorAtom","loadableReactorAtom","unwrappedReactorAtom","loadableReactor","drives","driveId","loadableDrivesAtom","unwrappedDrivesAtom","baseSelectedDriveIdAtom","selectedDriveAtom","loadableDrives","selectedNodeIdAtom","loadableSelectedDriveAtom","unwrappedSelectedDriveAtom","nodesAtom","loadableSelectedDrive","loadableNodesAtom","unwrappedNodesAtom","setSelectedNodeAtom","selectedFolderAtom","loadableNodes","folderNodes","loadableSelectedFolderAtom","unwrappedSelectedFolderAtom","documentsAtom","loadableDrive","documentIds","loadableDocumentsAtom","unwrappedDocumentsAtom","selectedDocumentAtom","loadableDocuments","document","loadableSelectedDocumentAtom","unwrappedSelectedDocumentAtom","phPackagesAtom","setPhPackagesAtom","phPackages","loadablePhPackagesAtom","unwrappedPhPackagesAtom","documentModelModulesAtom","loadablePhPackages","loadableDocumentModelModulesAtom","unwrappedDocumentModelModulesAtom","editorModulesAtom","loadableEditorModulesAtom","unwrappedEditorModulesAtom","processorManagerAtom","configAtom","useRefreshDocuments","useSyncDrivesAndDocumentsWithReactor","refreshDrives","refreshDocuments","useCallback","logger","childLogger","useUnwrappedReactor","useAtomValue","useInitializeReactor","createReactor","unwrappedReactor","setReactor","refresh","useEffect","initializeReactor","event","status","DevTools","atomStore","createStore","InitReactor","AtomStoreProvider","children","_jsxs","Provider","_jsx","App","lazy","__vitePreload","CookieBanner","ModalManager","AppLoader","jsx","StrictMode","jsxs","Suspense","AppSkeleton","renderApp","element","createRoot","AppElement"],"ignoreList":[0,8],"sources":["../../../../node_modules/.pnpm/jotai@2.12.5_@types+react@18.3.23_react@18.3.1/node_modules/jotai/esm/vanilla/utils.mjs","../../../../packages/common/dist/state/utils.js","../../../../packages/common/dist/state/drives.js","../../../../packages/common/dist/state/nodes.js","../../../../packages/common/dist/state/atoms.js","../../../../packages/common/dist/state/documents.js","../../../../packages/common/dist/state/syncing.js","../../../../packages/common/dist/state/reactor.js","../../../../node_modules/.pnpm/jotai-devtools@0.12.0_@types+react@18.3.23_react-dom@18.3.1_react@18.3.1__react@18.3.1__c8b464b01737ba84c54b4cf01b222909/node_modules/jotai-devtools/dist/index.esm.mjs","../../../../packages/common/dist/state/store.js","../../../../packages/common/dist/state/store-provider.js","../../src/components/app-loader.tsx","../../src/index.ts"],"sourcesContent":["import { atom } from 'jotai/vanilla';\n\nconst RESET = Symbol(\n (import.meta.env ? import.meta.env.MODE : void 0) !== \"production\" ? \"RESET\" : \"\"\n);\n\nfunction atomWithReset(initialValue) {\n const anAtom = atom(\n initialValue,\n (get, set, update) => {\n const nextValue = typeof update === \"function\" ? update(get(anAtom)) : update;\n set(anAtom, nextValue === RESET ? initialValue : nextValue);\n }\n );\n return anAtom;\n}\n\nfunction atomWithReducer(initialValue, reducer) {\n return atom(initialValue, function(get, set, action) {\n set(this, reducer(get(this), action));\n });\n}\n\nfunction atomFamily(initializeAtom, areEqual) {\n let shouldRemove = null;\n const atoms = /* @__PURE__ */ new Map();\n const listeners = /* @__PURE__ */ new Set();\n const createAtom = (param) => {\n let item;\n if (areEqual === void 0) {\n item = atoms.get(param);\n } else {\n for (const [key, value] of atoms) {\n if (areEqual(key, param)) {\n item = value;\n break;\n }\n }\n }\n if (item !== void 0) {\n if (shouldRemove == null ? void 0 : shouldRemove(item[1], param)) {\n createAtom.remove(param);\n } else {\n return item[0];\n }\n }\n const newAtom = initializeAtom(param);\n atoms.set(param, [newAtom, Date.now()]);\n notifyListeners(\"CREATE\", param, newAtom);\n return newAtom;\n };\n const notifyListeners = (type, param, atom) => {\n for (const listener of listeners) {\n listener({ type, param, atom });\n }\n };\n createAtom.unstable_listen = (callback) => {\n listeners.add(callback);\n return () => {\n listeners.delete(callback);\n };\n };\n createAtom.getParams = () => atoms.keys();\n createAtom.remove = (param) => {\n if (areEqual === void 0) {\n if (!atoms.has(param)) return;\n const [atom] = atoms.get(param);\n atoms.delete(param);\n notifyListeners(\"REMOVE\", param, atom);\n } else {\n for (const [key, [atom]] of atoms) {\n if (areEqual(key, param)) {\n atoms.delete(key);\n notifyListeners(\"REMOVE\", key, atom);\n break;\n }\n }\n }\n };\n createAtom.setShouldRemove = (fn) => {\n shouldRemove = fn;\n if (!shouldRemove) return;\n for (const [key, [atom, createdAt]] of atoms) {\n if (shouldRemove(createdAt, key)) {\n atoms.delete(key);\n notifyListeners(\"REMOVE\", key, atom);\n }\n }\n };\n return createAtom;\n}\n\nconst getCached$2 = (c, m, k) => (m.has(k) ? m : m.set(k, c())).get(k);\nconst cache1$3 = /* @__PURE__ */ new WeakMap();\nconst memo3 = (create, dep1, dep2, dep3) => {\n const cache2 = getCached$2(() => /* @__PURE__ */ new WeakMap(), cache1$3, dep1);\n const cache3 = getCached$2(() => /* @__PURE__ */ new WeakMap(), cache2, dep2);\n return getCached$2(create, cache3, dep3);\n};\nfunction selectAtom(anAtom, selector, equalityFn = Object.is) {\n return memo3(\n () => {\n const EMPTY = Symbol();\n const selectValue = ([value, prevSlice]) => {\n if (prevSlice === EMPTY) {\n return selector(value);\n }\n const slice = selector(value, prevSlice);\n return equalityFn(prevSlice, slice) ? prevSlice : slice;\n };\n const derivedAtom = atom((get) => {\n const prev = get(derivedAtom);\n const value = get(anAtom);\n return selectValue([value, prev]);\n });\n derivedAtom.init = EMPTY;\n return derivedAtom;\n },\n anAtom,\n selector,\n equalityFn\n );\n}\n\nconst frozenAtoms = /* @__PURE__ */ new WeakSet();\nconst deepFreeze = (value) => {\n if (typeof value !== \"object\" || value === null) {\n return value;\n }\n Object.freeze(value);\n const propNames = Object.getOwnPropertyNames(value);\n for (const name of propNames) {\n deepFreeze(value[name]);\n }\n return value;\n};\nfunction freezeAtom(anAtom) {\n if (frozenAtoms.has(anAtom)) {\n return anAtom;\n }\n frozenAtoms.add(anAtom);\n const origRead = anAtom.read;\n anAtom.read = function(get, options) {\n return deepFreeze(origRead.call(this, get, options));\n };\n if (\"write\" in anAtom) {\n const origWrite = anAtom.write;\n anAtom.write = function(get, set, ...args) {\n return origWrite.call(\n this,\n get,\n (...setArgs) => {\n if (setArgs[0] === anAtom) {\n setArgs[1] = deepFreeze(setArgs[1]);\n }\n return set(...setArgs);\n },\n ...args\n );\n };\n }\n return anAtom;\n}\nfunction freezeAtomCreator(createAtom) {\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n console.warn(\n \"[DEPRECATED] freezeAtomCreator is deprecated, define it on users end\"\n );\n }\n return (...args) => freezeAtom(createAtom(...args));\n}\n\nconst getCached$1 = (c, m, k) => (m.has(k) ? m : m.set(k, c())).get(k);\nconst cache1$2 = /* @__PURE__ */ new WeakMap();\nconst memo2$1 = (create, dep1, dep2) => {\n const cache2 = getCached$1(() => /* @__PURE__ */ new WeakMap(), cache1$2, dep1);\n return getCached$1(create, cache2, dep2);\n};\nconst cacheKeyForEmptyKeyExtractor = {};\nconst isWritable = (atom2) => !!atom2.write;\nconst isFunction = (x) => typeof x === \"function\";\nfunction splitAtom(arrAtom, keyExtractor) {\n return memo2$1(\n () => {\n const mappingCache = /* @__PURE__ */ new WeakMap();\n const getMapping = (arr, prev) => {\n let mapping = mappingCache.get(arr);\n if (mapping) {\n return mapping;\n }\n const prevMapping = prev && mappingCache.get(prev);\n const atomList = [];\n const keyList = [];\n arr.forEach((item, index) => {\n const key = keyExtractor ? keyExtractor(item) : index;\n keyList[index] = key;\n const cachedAtom = prevMapping && prevMapping.atomList[prevMapping.keyList.indexOf(key)];\n if (cachedAtom) {\n atomList[index] = cachedAtom;\n return;\n }\n const read = (get) => {\n const prev2 = get(mappingAtom);\n const currArr = get(arrAtom);\n const mapping2 = getMapping(currArr, prev2 == null ? void 0 : prev2.arr);\n const index2 = mapping2.keyList.indexOf(key);\n if (index2 < 0 || index2 >= currArr.length) {\n const prevItem = arr[getMapping(arr).keyList.indexOf(key)];\n if (prevItem) {\n return prevItem;\n }\n throw new Error(\"splitAtom: index out of bounds for read\");\n }\n return currArr[index2];\n };\n const write = (get, set, update) => {\n const prev2 = get(mappingAtom);\n const arr2 = get(arrAtom);\n const mapping2 = getMapping(arr2, prev2 == null ? void 0 : prev2.arr);\n const index2 = mapping2.keyList.indexOf(key);\n if (index2 < 0 || index2 >= arr2.length) {\n throw new Error(\"splitAtom: index out of bounds for write\");\n }\n const nextItem = isFunction(update) ? update(arr2[index2]) : update;\n if (!Object.is(arr2[index2], nextItem)) {\n set(arrAtom, [\n ...arr2.slice(0, index2),\n nextItem,\n ...arr2.slice(index2 + 1)\n ]);\n }\n };\n atomList[index] = isWritable(arrAtom) ? atom(read, write) : atom(read);\n });\n if (prevMapping && prevMapping.keyList.length === keyList.length && prevMapping.keyList.every((x, i) => x === keyList[i])) {\n mapping = prevMapping;\n } else {\n mapping = { arr, atomList, keyList };\n }\n mappingCache.set(arr, mapping);\n return mapping;\n };\n const mappingAtom = atom((get) => {\n const prev = get(mappingAtom);\n const arr = get(arrAtom);\n const mapping = getMapping(arr, prev == null ? void 0 : prev.arr);\n return mapping;\n });\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n mappingAtom.debugPrivate = true;\n }\n mappingAtom.init = void 0;\n const splittedAtom = isWritable(arrAtom) ? atom(\n (get) => get(mappingAtom).atomList,\n (get, set, action) => {\n switch (action.type) {\n case \"remove\": {\n const index = get(splittedAtom).indexOf(action.atom);\n if (index >= 0) {\n const arr = get(arrAtom);\n set(arrAtom, [\n ...arr.slice(0, index),\n ...arr.slice(index + 1)\n ]);\n }\n break;\n }\n case \"insert\": {\n const index = action.before ? get(splittedAtom).indexOf(action.before) : get(splittedAtom).length;\n if (index >= 0) {\n const arr = get(arrAtom);\n set(arrAtom, [\n ...arr.slice(0, index),\n action.value,\n ...arr.slice(index)\n ]);\n }\n break;\n }\n case \"move\": {\n const index1 = get(splittedAtom).indexOf(action.atom);\n const index2 = action.before ? get(splittedAtom).indexOf(action.before) : get(splittedAtom).length;\n if (index1 >= 0 && index2 >= 0) {\n const arr = get(arrAtom);\n if (index1 < index2) {\n set(arrAtom, [\n ...arr.slice(0, index1),\n ...arr.slice(index1 + 1, index2),\n arr[index1],\n ...arr.slice(index2)\n ]);\n } else {\n set(arrAtom, [\n ...arr.slice(0, index2),\n arr[index1],\n ...arr.slice(index2, index1),\n ...arr.slice(index1 + 1)\n ]);\n }\n }\n break;\n }\n }\n }\n ) : atom((get) => get(mappingAtom).atomList);\n return splittedAtom;\n },\n arrAtom,\n keyExtractor || cacheKeyForEmptyKeyExtractor\n );\n}\n\nfunction atomWithDefault(getDefault) {\n const EMPTY = Symbol();\n const overwrittenAtom = atom(EMPTY);\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n overwrittenAtom.debugPrivate = true;\n }\n const anAtom = atom(\n (get, options) => {\n const overwritten = get(overwrittenAtom);\n if (overwritten !== EMPTY) {\n return overwritten;\n }\n return getDefault(get, options);\n },\n (get, set, update) => {\n if (update === RESET) {\n set(overwrittenAtom, EMPTY);\n } else if (typeof update === \"function\") {\n const prevValue = get(anAtom);\n set(overwrittenAtom, update(prevValue));\n } else {\n set(overwrittenAtom, update);\n }\n }\n );\n return anAtom;\n}\n\nconst isPromiseLike$3 = (x) => typeof (x == null ? void 0 : x.then) === \"function\";\nfunction withStorageValidator(validator) {\n return (unknownStorage) => {\n const storage = {\n ...unknownStorage,\n getItem: (key, initialValue) => {\n const validate = (value2) => {\n if (!validator(value2)) {\n return initialValue;\n }\n return value2;\n };\n const value = unknownStorage.getItem(key, initialValue);\n if (isPromiseLike$3(value)) {\n return value.then(validate);\n }\n return validate(value);\n }\n };\n return storage;\n };\n}\nfunction createJSONStorage(getStringStorage = () => {\n try {\n return window.localStorage;\n } catch (e) {\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n if (typeof window !== \"undefined\") {\n console.warn(e);\n }\n }\n return void 0;\n }\n}, options) {\n var _a;\n let lastStr;\n let lastValue;\n const storage = {\n getItem: (key, initialValue) => {\n var _a2, _b;\n const parse = (str2) => {\n str2 = str2 || \"\";\n if (lastStr !== str2) {\n try {\n lastValue = JSON.parse(str2, options == null ? void 0 : options.reviver);\n } catch (e) {\n return initialValue;\n }\n lastStr = str2;\n }\n return lastValue;\n };\n const str = (_b = (_a2 = getStringStorage()) == null ? void 0 : _a2.getItem(key)) != null ? _b : null;\n if (isPromiseLike$3(str)) {\n return str.then(parse);\n }\n return parse(str);\n },\n setItem: (key, newValue) => {\n var _a2;\n return (_a2 = getStringStorage()) == null ? void 0 : _a2.setItem(\n key,\n JSON.stringify(newValue, options == null ? void 0 : options.replacer)\n );\n },\n removeItem: (key) => {\n var _a2;\n return (_a2 = getStringStorage()) == null ? void 0 : _a2.removeItem(key);\n }\n };\n const createHandleSubscribe = (subscriber2) => (key, callback, initialValue) => subscriber2(key, (v) => {\n let newValue;\n try {\n newValue = JSON.parse(v || \"\");\n } catch (e) {\n newValue = initialValue;\n }\n callback(newValue);\n });\n let subscriber;\n try {\n subscriber = (_a = getStringStorage()) == null ? void 0 : _a.subscribe;\n } catch (e) {\n }\n if (!subscriber && typeof window !== \"undefined\" && typeof window.addEventListener === \"function\" && window.Storage) {\n subscriber = (key, callback) => {\n if (!(getStringStorage() instanceof window.Storage)) {\n return () => {\n };\n }\n const storageEventCallback = (e) => {\n if (e.storageArea === getStringStorage() && e.key === key) {\n callback(e.newValue);\n }\n };\n window.addEventListener(\"storage\", storageEventCallback);\n return () => {\n window.removeEventListener(\"storage\", storageEventCallback);\n };\n };\n }\n if (subscriber) {\n storage.subscribe = createHandleSubscribe(subscriber);\n }\n return storage;\n}\nconst defaultStorage = createJSONStorage();\nfunction atomWithStorage(key, initialValue, storage = defaultStorage, options) {\n const getOnInit = options == null ? void 0 : options.getOnInit;\n const baseAtom = atom(\n getOnInit ? storage.getItem(key, initialValue) : initialValue\n );\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n baseAtom.debugPrivate = true;\n }\n baseAtom.onMount = (setAtom) => {\n setAtom(storage.getItem(key, initialValue));\n let unsub;\n if (storage.subscribe) {\n unsub = storage.subscribe(key, setAtom, initialValue);\n }\n return unsub;\n };\n const anAtom = atom(\n (get) => get(baseAtom),\n (get, set, update) => {\n const nextValue = typeof update === \"function\" ? update(get(baseAtom)) : update;\n if (nextValue === RESET) {\n set(baseAtom, initialValue);\n return storage.removeItem(key);\n }\n if (isPromiseLike$3(nextValue)) {\n return nextValue.then((resolvedValue) => {\n set(baseAtom, resolvedValue);\n return storage.setItem(key, resolvedValue);\n });\n }\n set(baseAtom, nextValue);\n return storage.setItem(key, nextValue);\n }\n );\n return anAtom;\n}\n\nconst isPromiseLike$2 = (x) => typeof (x == null ? void 0 : x.then) === \"function\";\nfunction atomWithObservable(getObservable, options) {\n const returnResultData = (result) => {\n if (\"e\" in result) {\n throw result.e;\n }\n return result.d;\n };\n const observableResultAtom = atom((get) => {\n var _a;\n let observable = getObservable(get);\n const itself = (_a = observable[Symbol.observable]) == null ? void 0 : _a.call(observable);\n if (itself) {\n observable = itself;\n }\n let resolve;\n const makePending = () => new Promise((r) => {\n resolve = r;\n });\n const initialResult = options && \"initialValue\" in options ? {\n d: typeof options.initialValue === \"function\" ? options.initialValue() : options.initialValue\n } : makePending();\n let setResult;\n let lastResult;\n const listener = (result) => {\n lastResult = result;\n resolve == null ? void 0 : resolve(result);\n setResult == null ? void 0 : setResult(result);\n };\n let subscription;\n let timer;\n const isNotMounted = () => !setResult;\n const unsubscribe = () => {\n if (subscription) {\n subscription.unsubscribe();\n subscription = void 0;\n }\n };\n const start = () => {\n if (subscription) {\n clearTimeout(timer);\n subscription.unsubscribe();\n }\n subscription = observable.subscribe({\n next: (d) => listener({ d }),\n error: (e) => listener({ e }),\n complete: () => {\n }\n });\n if (isNotMounted() && (options == null ? void 0 : options.unstable_timeout)) {\n timer = setTimeout(unsubscribe, options.unstable_timeout);\n }\n };\n start();\n const resultAtom = atom(lastResult || initialResult);\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n resultAtom.debugPrivate = true;\n }\n resultAtom.onMount = (update) => {\n setResult = update;\n if (lastResult) {\n update(lastResult);\n }\n if (subscription) {\n clearTimeout(timer);\n } else {\n start();\n }\n return () => {\n setResult = void 0;\n if (options == null ? void 0 : options.unstable_timeout) {\n timer = setTimeout(unsubscribe, options.unstable_timeout);\n } else {\n unsubscribe();\n }\n };\n };\n return [resultAtom, observable, makePending, start, isNotMounted];\n });\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n observableResultAtom.debugPrivate = true;\n }\n const observableAtom = atom(\n (get) => {\n const [resultAtom] = get(observableResultAtom);\n const result = get(resultAtom);\n if (isPromiseLike$2(result)) {\n return result.then(returnResultData);\n }\n return returnResultData(result);\n },\n (get, set, data) => {\n const [resultAtom, observable, makePending, start, isNotMounted] = get(observableResultAtom);\n if (\"next\" in observable) {\n if (isNotMounted()) {\n set(resultAtom, makePending());\n start();\n }\n observable.next(data);\n } else {\n throw new Error(\"observable is not subject\");\n }\n }\n );\n return observableAtom;\n}\n\nconst cache1$1 = /* @__PURE__ */ new WeakMap();\nconst memo1 = (create, dep1) => (cache1$1.has(dep1) ? cache1$1 : cache1$1.set(dep1, create())).get(dep1);\nconst isPromiseLike$1 = (p) => typeof (p == null ? void 0 : p.then) === \"function\";\nconst LOADING = { state: \"loading\" };\nfunction loadable(anAtom) {\n return memo1(() => {\n const loadableCache = /* @__PURE__ */ new WeakMap();\n const refreshAtom = atom(0);\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n refreshAtom.debugPrivate = true;\n }\n const derivedAtom = atom(\n (get, { setSelf }) => {\n get(refreshAtom);\n let value;\n try {\n value = get(anAtom);\n } catch (error) {\n return { state: \"hasError\", error };\n }\n if (!isPromiseLike$1(value)) {\n return { state: \"hasData\", data: value };\n }\n const promise = value;\n const cached1 = loadableCache.get(promise);\n if (cached1) {\n return cached1;\n }\n promise.then(\n (data) => {\n loadableCache.set(promise, { state: \"hasData\", data });\n setSelf();\n },\n (error) => {\n loadableCache.set(promise, { state: \"hasError\", error });\n setSelf();\n }\n );\n const cached2 = loadableCache.get(promise);\n if (cached2) {\n return cached2;\n }\n loadableCache.set(promise, LOADING);\n return LOADING;\n },\n (_get, set) => {\n set(refreshAtom, (c) => c + 1);\n }\n );\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n derivedAtom.debugPrivate = true;\n }\n return atom((get) => get(derivedAtom));\n }, anAtom);\n}\n\nconst getCached = (c, m, k) => (m.has(k) ? m : m.set(k, c())).get(k);\nconst cache1 = /* @__PURE__ */ new WeakMap();\nconst memo2 = (create, dep1, dep2) => {\n const cache2 = getCached(() => /* @__PURE__ */ new WeakMap(), cache1, dep1);\n return getCached(create, cache2, dep2);\n};\nconst isPromiseLike = (p) => typeof (p == null ? void 0 : p.then) === \"function\";\nconst defaultFallback = () => void 0;\nfunction unwrap(anAtom, fallback = defaultFallback) {\n return memo2(\n () => {\n const promiseErrorCache = /* @__PURE__ */ new WeakMap();\n const promiseResultCache = /* @__PURE__ */ new WeakMap();\n const refreshAtom = atom(0);\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n refreshAtom.debugPrivate = true;\n }\n const promiseAndValueAtom = atom(\n (get, { setSelf }) => {\n get(refreshAtom);\n const prev = get(promiseAndValueAtom);\n const promise = get(anAtom);\n if (!isPromiseLike(promise)) {\n return { v: promise };\n }\n if (promise !== (prev == null ? void 0 : prev.p)) {\n promise.then(\n (v) => {\n promiseResultCache.set(promise, v);\n setSelf();\n },\n (e) => {\n promiseErrorCache.set(promise, e);\n setSelf();\n }\n );\n }\n if (promiseErrorCache.has(promise)) {\n throw promiseErrorCache.get(promise);\n }\n if (promiseResultCache.has(promise)) {\n return {\n p: promise,\n v: promiseResultCache.get(promise)\n };\n }\n if (prev && \"v\" in prev) {\n return { p: promise, f: fallback(prev.v), v: prev.v };\n }\n return { p: promise, f: fallback() };\n },\n (_get, set) => {\n set(refreshAtom, (c) => c + 1);\n }\n );\n promiseAndValueAtom.init = void 0;\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n promiseAndValueAtom.debugPrivate = true;\n }\n return atom(\n (get) => {\n const state = get(promiseAndValueAtom);\n if (\"f\" in state) {\n return state.f;\n }\n return state.v;\n },\n (_get, set, ...args) => set(anAtom, ...args)\n );\n },\n anAtom,\n fallback\n );\n}\n\nfunction atomWithRefresh(read, write) {\n const refreshAtom = atom(0);\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n refreshAtom.debugPrivate = true;\n }\n return atom(\n (get, options) => {\n get(refreshAtom);\n return read(get, options);\n },\n (get, set, ...args) => {\n if (args.length === 0) {\n set(refreshAtom, (c) => c + 1);\n } else if (write) {\n return write(get, set, ...args);\n } else if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") {\n throw new Error(\"refresh must be called without arguments\");\n }\n }\n );\n}\n\nfunction atomWithLazy(makeInitial) {\n const a = atom(void 0);\n delete a.init;\n Object.defineProperty(a, \"init\", {\n get() {\n return makeInitial();\n }\n });\n return a;\n}\n\nexport { RESET, atomFamily, atomWithDefault, atomWithLazy, atomWithObservable, atomWithReducer, atomWithRefresh, atomWithReset, atomWithStorage, createJSONStorage, freezeAtom, freezeAtomCreator, loadable, selectAtom, splitAtom, withStorageValidator as unstable_withStorageValidator, unwrap };\n","import slug from \"slug\";\n/** Sentinel value for atoms that are not set. */\nexport const NOT_SET = \"NOT_SET\";\n/* Will suspend until the atom is set elsewhere.\n * Returns a promise that will never resolve of type T.\n *\n * Makes use of Jotai's \"async forever\" pattern as described here https://jotai.org/docs/guides/async#async-forever\n */\nexport function suspendUntilSet() {\n return new Promise(() => { });\n}\n/** Makes a URL component for a drive. */\nexport function makeDriveUrlComponent(drive) {\n if (!drive)\n return \"\";\n return `/d/${slug(drive.header.slug)}`;\n}\n/** Makes a URL component for a node. */\nexport function makeNodeUrlComponent(node) {\n if (!node)\n return \"\";\n const nodeName = node.name;\n if (!nodeName)\n return slug(node.id);\n return slug(`${nodeName}-${node.id}`);\n}\n/** Extracts the node slug from a path.\n *\n * The path is expected to be in the format `/d/<drive-slug>/<node-slug>`.\n */\nfunction extractNodeSlug(path) {\n const match = /^\\/d\\/[^/]+\\/([^/]+)$/.exec(path);\n return match ? match[1] : undefined;\n}\n/** Finds a UUID in a string, used for extracting node ids from node slugs in the URL. */\nfunction findUuid(input) {\n if (!input)\n return undefined;\n const uuidRegex = /\\b[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\\b/;\n const match = uuidRegex.exec(input);\n return match ? match[0] : undefined;\n}\n/** Extracts the node id from a path. */\nexport function extractNodeFromPath(path) {\n const nodeSlug = extractNodeSlug(path);\n if (!nodeSlug)\n return undefined;\n const uuid = findUuid(nodeSlug);\n if (!uuid)\n return undefined;\n return uuid;\n}\n/** Extracts the node name, slug, or id from a path. */\nexport function extractNodeNameOrSlugOrIdFromPath(path) {\n const nodeSlug = extractNodeSlug(path);\n const nodeId = findUuid(nodeSlug);\n if (nodeId)\n return nodeId;\n return nodeSlug;\n}\n/** Extracts the drive slug from a path.\n * Used for extracting drive ids from drive slugs in the URL.\n * Expects the path to be in the format `/d/<drive-slug>`.\n */\nexport function extractDriveFromPath(path) {\n const match = /^\\/d\\/([^/]+)/.exec(path);\n return match ? match[1] : null;\n}\n/** Legacy function that makes a slug from a node name.\n * Used for compatibility with the old URL structure in Connect.\n */\nexport function makeNodeSlugFromNodeName(name) {\n return name.replaceAll(/\\s/g, \"-\");\n}\n/** Sets the selected drive and node from the URL.\n *\n * Both the selected drive id and selected node id begin in the NOT_SET state, so they will suspend unless set by this function or another implementation.\n *\n * If the URL is in the format `/d/<drive-slug>`, the selected drive will be set.\n * If the URL is in the format `/d/<drive-slug>/<node-slug>`, the selected drive and node will be set.\n */\nexport async function setSelectedDriveAndNodeFromUrl(reactor, setSelectedDrive, setSelectedNode, shouldNavigate) {\n if (typeof window === \"undefined\")\n return;\n if (!shouldNavigate)\n return;\n if (!reactor)\n return;\n const path = window.location.pathname;\n const drive = await handleDriveFromUrl(reactor, path, setSelectedDrive);\n handleNodeFromUrl(drive, path, setSelectedNode);\n}\nasync function handleDriveFromUrl(reactor, path, setSelectedDrive) {\n const driveSlug = extractDriveFromPath(path);\n const driveIds = await reactor.getDrives();\n const drives = await Promise.all(driveIds.map((id) => reactor.getDrive(id)));\n const drive = drives.find((d) => d.header.slug === driveSlug || d.header.id === driveSlug);\n setSelectedDrive(drive?.header.id);\n return drive;\n}\nfunction handleNodeFromUrl(drive, path, setSelectedNode) {\n const nodeIdOrSlugOrNameFromPath = extractNodeNameOrSlugOrIdFromPath(path);\n const nodes = drive?.state.global.nodes;\n const node = nodes?.find((n) => n.id === nodeIdOrSlugOrNameFromPath ||\n makeNodeSlugFromNodeName(n.name) === nodeIdOrSlugOrNameFromPath);\n setSelectedNode(node?.id);\n}\n//# sourceMappingURL=utils.js.map","import { useAtomValue, useSetAtom } from \"jotai\";\nimport { useCallback } from \"react\";\nimport { drivesAtom, loadableDrivesAtom, loadableSelectedDriveAtom, selectedDriveAtom, unwrappedDrivesAtom, unwrappedSelectedDriveAtom, } from \"./atoms.js\";\nimport { makeDriveUrlComponent } from \"./utils.js\";\n/** Returns a loadable of the drives for a reactor. */\nexport function useDrives() {\n return useAtomValue(loadableDrivesAtom);\n}\n/** Returns a resolved promise of the drives for a reactor. */\nexport function useUnwrappedDrives() {\n return useAtomValue(unwrappedDrivesAtom);\n}\n/** Refreshes the drives for a reactor. */\nexport function useRefreshDrives() {\n return useSetAtom(drivesAtom);\n}\n/** Returns a loadable of a drive for a reactor by id. */\nexport function useDriveById(id) {\n const loadableDrives = useDrives();\n if (loadableDrives.state !== \"hasData\")\n return loadableDrives;\n if (!id)\n return { state: \"hasData\", data: undefined };\n const data = loadableDrives.data;\n return {\n state: \"hasData\",\n data: data.find((d) => d.header.id === id),\n };\n}\n/** Returns a resolved promise of a drive for a reactor by id. */\nexport function useUnwrappedDriveById(id) {\n const drives = useUnwrappedDrives();\n if (!id)\n return undefined;\n return drives?.find((d) => d.header.id === id);\n}\n/** Returns a loadable of the selected drive */\nexport function useSelectedDrive() {\n return useAtomValue(loadableSelectedDriveAtom);\n}\n/** Returns a resolved promise of the selected drive */\nexport function useUnwrappedSelectedDrive() {\n return useAtomValue(unwrappedSelectedDriveAtom);\n}\n/** Returns a function that sets the selected drive with a drive id.\n *\n * If `shouldNavigate` is true, the URL will be updated to the new drive.\n * `shouldNavigate` can be overridden by passing a different value to the callback.\n */\nexport function useSetSelectedDrive(shouldNavigate = true) {\n const drives = useUnwrappedDrives();\n const setSelectedDrive = useSetAtom(selectedDriveAtom);\n return useCallback((driveId, _shouldNavigate = shouldNavigate) => {\n setSelectedDrive(driveId);\n const drive = drives?.find((d) => d.header.id === driveId);\n const newPathname = makeDriveUrlComponent(drive);\n if (typeof window !== \"undefined\" && _shouldNavigate) {\n window.history.pushState(null, \"\", newPathname);\n }\n }, [drives, setSelectedDrive]);\n}\n/** Returns a loadable of the remote URL for a drive. */\nexport function useDriveRemoteUrl(driveId) {\n const loadableDrive = useDriveById(driveId);\n const pullResponderUrl = useDrivePullResponderUrl(driveId);\n if (!driveId)\n return { state: \"hasData\", data: undefined };\n if (loadableDrive.state !== \"hasData\")\n return loadableDrive;\n const drive = loadableDrive.data;\n if (!drive)\n return { state: \"hasData\", data: undefined };\n if (\"remoteUrl\" in drive.state.global) {\n const remoteUrl = drive.state.global.remoteUrl;\n if (typeof remoteUrl === \"string\") {\n return {\n state: \"hasData\",\n data: remoteUrl,\n };\n }\n }\n if (pullResponderUrl.state !== \"hasData\")\n return pullResponderUrl;\n return {\n state: \"hasData\",\n data: undefined,\n };\n}\n/** Returns a loadable of the pull responder trigger for a drive. */\nexport function useDrivePullResponderTrigger(driveId) {\n const loadableDrive = useDriveById(driveId);\n if (!driveId)\n return { state: \"hasData\", data: undefined };\n if (loadableDrive.state !== \"hasData\")\n return loadableDrive;\n const drive = loadableDrive.data;\n if (!drive)\n return { state: \"hasData\", data: undefined };\n const pullResponder = drive.state.local.triggers.find((trigger) => trigger.type === \"PullResponder\");\n return {\n state: \"hasData\",\n data: pullResponder,\n };\n}\n/** Returns a loadable of the pull responder URL for a drive. */\nexport function useDrivePullResponderUrl(driveId) {\n const pullResponder = useDrivePullResponderTrigger(driveId);\n if (!driveId)\n return { state: \"hasData\", data: undefined };\n if (pullResponder.state !== \"hasData\")\n return pullResponder;\n const trigger = pullResponder.data;\n return {\n state: \"hasData\",\n data: trigger?.data?.url,\n };\n}\n/** Returns a loadable of whether a drive is remote. */\nexport function useDriveIsRemote(driveId) {\n const remoteUrl = useDriveRemoteUrl(driveId);\n const pullResponder = useDrivePullResponderTrigger(driveId);\n if (!driveId)\n return { state: \"hasData\", data: false };\n if (remoteUrl.state === \"loading\" || pullResponder.state === \"loading\")\n return {\n state: \"loading\",\n };\n if (remoteUrl.state === \"hasError\")\n return {\n state: \"hasError\",\n error: remoteUrl.error,\n };\n if (pullResponder.state === \"hasError\")\n return {\n state: \"hasError\",\n error: pullResponder.error,\n };\n return {\n state: \"hasData\",\n data: remoteUrl.data !== undefined || pullResponder.data !== undefined,\n };\n}\n/** Returns a loadable of the sharing type for a drive. */\nexport function useDriveSharingType(driveId) {\n const loadableDrive = useDriveById(driveId);\n if (!driveId)\n return { state: \"hasData\", data: undefined };\n if (loadableDrive.state !== \"hasData\")\n return loadableDrive;\n const drive = loadableDrive.data;\n if (!drive)\n return { state: \"hasData\", data: undefined };\n return {\n state: \"hasData\",\n data: getDriveSharingType(drive),\n };\n}\n/** Returns a loadable of whether a drive is available offline. */\nexport function useIsDriveAvailableOffline(driveId) {\n const loadableDrive = useDriveById(driveId);\n if (!driveId)\n return { state: \"hasData\", data: false };\n if (loadableDrive.state !== \"hasData\")\n return loadableDrive;\n const drive = loadableDrive.data;\n if (!drive)\n return { state: \"hasData\", data: false };\n return {\n state: \"hasData\",\n data: getDriveAvailableOffline(drive),\n };\n}\n/** Returns the sharing type for a drive. */\nexport function getDriveSharingType(drive) {\n if (!drive)\n return \"PUBLIC\";\n const isReadDrive = \"readContext\" in drive;\n const { sharingType: _sharingType } = !isReadDrive\n ? drive.state.local\n : { sharingType: \"PUBLIC\" };\n const __sharingType = _sharingType?.toUpperCase();\n return (__sharingType === \"PRIVATE\" ? \"LOCAL\" : __sharingType);\n}\n/** Returns whether a drive is available offline. */\nexport function getDriveAvailableOffline(drive) {\n if (!drive)\n return false;\n const isReadDrive = \"readContext\" in drive;\n const { availableOffline: _availableOffline } = !isReadDrive\n ? drive.state.local\n : { availableOffline: false };\n return _availableOffline ?? false;\n}\n//# sourceMappingURL=drives.js.map","import { useAtomValue, useSetAtom } from \"jotai\";\nimport { useCallback } from \"react\";\nimport { loadableNodesAtom, setSelectedNodeAtom, unwrappedNodesAtom, } from \"./atoms.js\";\nimport { useSelectedDrive } from \"./drives.js\";\nimport { useSelectedFolder } from \"./folders.js\";\nimport { extractDriveFromPath, makeNodeUrlComponent } from \"./utils.js\";\n/** Returns a loadable of the nodes for a reactor. */\nexport function useNodes() {\n return useAtomValue(loadableNodesAtom);\n}\n/** Returns a function that sets the selected node with a node id.\n *\n * If `shouldNavigate` is true, the URL will be updated to the new node.\n * `shouldNavigate` can be overridden by passing a different value to the callback.\n */\nexport function useSetSelectedNode(shouldNavigate = true) {\n const nodes = useUnwrappedNodes();\n const setSelectedNode = useSetAtom(setSelectedNodeAtom);\n return useCallback((nodeId, _shouldNavigate = shouldNavigate) => {\n setSelectedNode(nodeId);\n if (typeof window !== \"undefined\" && _shouldNavigate) {\n const driveSlugFromPath = extractDriveFromPath(window.location.pathname);\n const node = nodes?.find((n) => n.id === nodeId);\n if (!node) {\n window.history.pushState(null, \"\", `/d/${driveSlugFromPath}`);\n }\n else {\n const nodeSlug = makeNodeUrlComponent(node);\n window.history.pushState(null, \"\", `/d/${driveSlugFromPath}/${nodeSlug}`);\n }\n }\n }, [setSelectedNode, nodes]);\n}\n/** Returns a resolved promise of the nodes for a reactor. */\nexport function useUnwrappedNodes() {\n return useAtomValue(unwrappedNodesAtom);\n}\n/** Returns a resolved promise of a node for a reactor by id. */\nexport function useNodeById(id) {\n const unwrappedNodes = useUnwrappedNodes();\n return unwrappedNodes?.find((n) => n.id === id);\n}\n/** Returns a resolved promise of the parent folder for a node. */\nexport function useParentFolder(id) {\n const node = useNodeById(id);\n return node?.parentFolder ?? undefined;\n}\n/** Returns a loadable of the path to a node. */\nexport function useNodePath(id) {\n const loadableNodes = useNodes();\n const loadableSelectedDrive = useSelectedDrive();\n if (loadableSelectedDrive.state !== \"hasData\")\n return loadableSelectedDrive;\n if (loadableNodes.state !== \"hasData\")\n return loadableNodes;\n const nodes = loadableNodes.data;\n const selectedDrive = loadableSelectedDrive.data;\n if (!nodes || !selectedDrive)\n return { state: \"hasData\", data: undefined };\n const driveFolderNode = {\n id: selectedDrive.header.id,\n name: selectedDrive.state.global.name,\n kind: \"FOLDER\",\n parentFolder: null,\n };\n const path = [driveFolderNode];\n let current = nodes.find((n) => n.id === id);\n while (current) {\n path.unshift(current);\n if (!current.parentFolder)\n break;\n current = nodes.find((n) => n.id === current?.parentFolder);\n }\n return { state: \"hasData\", data: path.reverse() };\n}\n/** Returns a loadable of the child nodes for the selected drive or folder. */\nexport function useChildNodes() {\n const nodes = useNodes();\n const selectedFolder = useSelectedFolder();\n if (nodes.state !== \"hasData\")\n return nodes;\n if (selectedFolder.state !== \"hasData\")\n return selectedFolder;\n const selectedFolderId = selectedFolder.data?.id;\n if (!selectedFolderId)\n return {\n state: \"hasData\",\n data: sortNodesByName(nodes.data ?? []),\n };\n return {\n state: \"hasData\",\n data: sortNodesByName(nodes.data?.filter((n) => n.parentFolder === selectedFolderId) ?? []),\n };\n}\n/** Returns the kind of a node. */\nexport function useNodeKind(id) {\n const unwrappedNodes = useUnwrappedNodes();\n if (!unwrappedNodes)\n return undefined;\n const node = unwrappedNodes.find((n) => n.id === id);\n if (!node)\n return undefined;\n return node.kind.toUpperCase();\n}\n/** Sorts nodes by name. */\nexport function sortNodesByName(nodes) {\n return nodes.toSorted((a, b) => a.name.localeCompare(b.name));\n}\n/** Returns whether a node is a file. */\nexport function isFileNodeKind(node) {\n if (!node)\n return false;\n return node.kind.toUpperCase() === \"FILE\";\n}\n/** Returns whether a node is a folder. */\nexport function isFolderNodeKind(node) {\n if (!node)\n return false;\n return node.kind.toUpperCase() === \"FOLDER\";\n}\n//# sourceMappingURL=nodes.js.map","import { atom } from \"jotai\";\nimport { atomWithRefresh, loadable, unwrap } from \"jotai/utils\";\nimport { isFolderNodeKind } from \"./nodes.js\";\nimport { NOT_SET, suspendUntilSet } from \"./utils.js\";\n/* Reactor */\n/** Holds the reactor instance.\n *\n * Like all base atoms, it is not meant to be accessed or updated directly.\n * Starts off with the sentinel value NOT_SET.\n */\nconst baseReactorAtom = atom(NOT_SET);\nbaseReactorAtom.debugLabel = \"baseReactorAtom\";\n/** Returns a promise of the reactor instance if it is set, otherwise suspends until it is set. */\nexport const reactorAtom = atom(async (get) => {\n const reactor = get(baseReactorAtom);\n // Suspends until the reactor is set.\n if (reactor === NOT_SET)\n return suspendUntilSet();\n return reactor;\n});\nreactorAtom.debugLabel = \"reactorAtom\";\n/** Sets the reactor instance. Only runs if the baseReactorAtom is NOT_SET. */\nexport const initializeReactorAtom = atom(null, (get, set, reactor) => {\n const baseReactor = get(baseReactorAtom);\n // Only runs if the baseReactorAtom is NOT_SET.\n if (baseReactor === NOT_SET) {\n set(baseReactorAtom, reactor);\n }\n});\ninitializeReactorAtom.debugLabel = \"setReactorAtom\";\n/** Returns a Loadable of the reactor instance. */\nexport const loadableReactorAtom = loadable(reactorAtom);\nloadableReactorAtom.debugLabel = \"loadableReactorAtom\";\n/** Returns a resolved promise of the reactor instance. */\nexport const unwrappedReactorAtom = unwrap(reactorAtom);\nunwrappedReactorAtom.debugLabel = \"unwrappedReactorAtom\";\n/* Drives */\n/** Holds a promise of the drives for a given reactor.\n *\n * Suspends until the reactor is set.\n *\n * Does not provide a direct setter, instead it uses `atomWithRefresh` which will refetch the drives from the reactor when called.\n * See https://jotai.org/docs/utilities/resettable#atomwithrefresh for more details.\n */\nexport const drivesAtom = atomWithRefresh(async (get) => {\n const loadableReactor = get(loadableReactorAtom);\n // Suspends until the reactor is set.\n if (loadableReactor.state !== \"hasData\")\n return suspendUntilSet();\n const reactor = loadableReactor.data;\n // If the reactor is not set, returns an empty array.\n if (!reactor)\n return [];\n const driveIds = await reactor.getDrives();\n const drives = new Array();\n for (const driveId of driveIds) {\n const drive = await reactor.getDrive(driveId);\n drives.push(drive);\n }\n return drives;\n});\ndrivesAtom.debugLabel = \"drivesAtom\";\n/** Returns a Loadable of the drives for a given reactor. */\nexport const loadableDrivesAtom = loadable(drivesAtom);\nloadableDrivesAtom.debugLabel = \"loadableDrivesAtom\";\n/** Returns a resolved promise of the drives for a given reactor. */\nexport const unwrappedDrivesAtom = unwrap(drivesAtom);\nunwrappedDrivesAtom.debugLabel = \"unwrappedDrivesAtom\";\n/** Holds the selected drive id.\n *\n * Like all base atoms, it is not meant to be accessed or updated directly.\n * Starts off with the sentinel value NOT_SET.\n *\n * When this value changes, the data for the selected drive is re-fetched from the drives atom.\n */\nconst baseSelectedDriveIdAtom = atom(NOT_SET);\nbaseSelectedDriveIdAtom.debugLabel = \"baseSelectedDriveIdAtom\";\n/** Returns a promise of the selected drive.\n *\n * Provides a setter which receives a drive id and updates the baseSelectedDriveIdAtom.\n *\n * Suspends until the reactor's drives are set and the selected drive id is set.\n * If the selected drive id is set as undefined, returns a resolved promise of undefined.\n *\n * When the selected drive is set, the selected node id is also set to undefined, since by definition selecting a new drive means navigating to the root of the new drive.\n */\nexport const selectedDriveAtom = atom((get) => {\n const driveId = get(baseSelectedDriveIdAtom);\n const loadableDrives = get(loadableDrivesAtom);\n // Suspends until the reactor's drives are set and the selected drive id is set.\n if (driveId === NOT_SET || loadableDrives.state !== \"hasData\")\n return suspendUntilSet();\n const drives = loadableDrives.data;\n return drives.find((drive) => drive.header.id === driveId);\n}, (_get, set, driveId) => {\n // Updates the baseSelectedDriveIdAtom.\n set(baseSelectedDriveIdAtom, driveId);\n // Resets the selected node id.\n set(selectedNodeIdAtom, undefined);\n});\nselectedDriveAtom.debugLabel = \"selectedDriveAtom\";\n/** Returns a Loadable of the selected drive. */\nexport const loadableSelectedDriveAtom = loadable(selectedDriveAtom);\nloadableSelectedDriveAtom.debugLabel = \"loadableSelectedDriveAtom\";\n/** Returns a resolved promise of the selected drive. */\nexport const unwrappedSelectedDriveAtom = unwrap(selectedDriveAtom);\nunwrappedSelectedDriveAtom.debugLabel = \"unwrappedSelectedDriveAtom\";\n/* Nodes */\n/** Holds a promise of the nodes for the selected drive.\n *\n * Derived from selectedDrive.state.global.nodes.\n *\n * Suspends until the selected drive is set.\n *\n * If the selected drive is set as undefined, returns a resolved promise of undefined.\n *\n * Does not provide a setter, since it is derived from the selected drive.\n */\nexport const nodesAtom = atom(async (get) => {\n const loadableSelectedDrive = get(loadableSelectedDriveAtom);\n // Suspends until the selected drive is set.\n if (loadableSelectedDrive.state !== \"hasData\")\n return suspendUntilSet();\n const drive = loadableSelectedDrive.data;\n return drive?.state.global.nodes;\n});\nnodesAtom.debugLabel = \"nodesAtom\";\nexport const loadableNodesAtom = loadable(nodesAtom);\nloadableNodesAtom.debugLabel = \"loadableNodesAtom\";\nexport const unwrappedNodesAtom = unwrap(nodesAtom);\nunwrappedNodesAtom.debugLabel = \"unwrappedNodesAtom\";\n/** Holds the selected node id.\n *\n * This id comes from the drive's nodes, which can be the id for a document or for a meta item such as a folder.\n *\n * Like all base atoms, it is not meant to be accessed or updated directly.\n * Starts off with the sentinel value NOT_SET.\n *\n * When this value changes, the data for the selected node is re-fetched from the nodes atom.\n */\nexport const selectedNodeIdAtom = atom(NOT_SET);\nselectedNodeIdAtom.debugLabel = \"selectedNodeIdAtom\";\n/** Sets the selected node via a node id. */\nexport const setSelectedNodeAtom = atom(null, (_get, set, nodeId) => {\n set(selectedNodeIdAtom, nodeId);\n});\nsetSelectedNodeAtom.debugLabel = \"setSelectedNodeAtom\";\n/** Returns a promise of the selected folder.\n *\n * A \"folder\" is a meta item that contains other nodes. It is not a document itself. Folder nodes have a `kind` of `folder` or `FOLDER`.\n *\n * Suspends until the nodes are set and the selected node id is set.\n * If the selected node id is set as undefined, returns a resolved promise of undefined.\n *\n * Does not provide a setter, since it is derived from the selected node id.\n */\nexport const selectedFolderAtom = atom((get) => {\n const loadableNodes = get(loadableNodesAtom);\n const nodeId = get(selectedNodeIdAtom);\n // Suspends until the nodes are set and the selected node id is set.\n if (nodeId === NOT_SET || loadableNodes.state !== \"hasData\")\n return suspendUntilSet();\n const nodes = loadableNodes.data;\n // Filters the nodes to only include folder nodes.\n const folderNodes = nodes?.filter(isFolderNodeKind);\n // Returns the folder node with the selected node id.\n return folderNodes?.find((node) => node.id === nodeId);\n});\nselectedFolderAtom.debugLabel = \"selectedFolderAtom\";\n/** Returns a Loadable of the selected folder. */\nexport const loadableSelectedFolderAtom = loadable(selectedFolderAtom);\nloadableSelectedFolderAtom.debugLabel = \"loadableSelectedFolderAtom\";\n/** Returns a resolved promise of the selected folder. */\nexport const unwrappedSelectedFolderAtom = unwrap(selectedFolderAtom);\nunwrappedSelectedFolderAtom.debugLabel = \"unwrappedSelectedFolderAtom\";\n/* Documents */\n/** Holds a promise of the documents for the selected drive.\n *\n * Suspends until the selected drive is set.\n *\n * If the selected drive is set as undefined, returns a resolved promise of undefined.\n *\n * Does not provide a setter, instead it uses `atomWithRefresh` which will refetch the documents from the reactor when called.\n * See https://jotai.org/docs/utilities/resettable#atomwithrefresh for more details.\n */\nexport const documentsAtom = atomWithRefresh(async (get) => {\n const loadableReactor = get(loadableReactorAtom);\n const loadableDrive = get(loadableSelectedDriveAtom);\n // Suspends until the selected drive is set.\n if (loadableReactor.state !== \"hasData\" || loadableDrive.state !== \"hasData\")\n return suspendUntilSet();\n const reactor = loadableReactor.data;\n const driveId = loadableDrive.data?.header.id;\n // If the reactor or drive id is not set, returns an empty array.\n if (!reactor || !driveId)\n return [];\n const documentIds = await reactor.getDocuments(driveId);\n const documents = await Promise.all(documentIds.map((id) => reactor.getDocument(driveId, id)));\n return documents;\n});\ndocumentsAtom.debugLabel = \"documentsAtom\";\n/** Returns a Loadable of the documents for the selected drive. */\nexport const loadableDocumentsAtom = loadable(documentsAtom);\nloadableDocumentsAtom.debugLabel = \"loadableDocumentsAtom\";\n/** Returns a resolved promise of the documents for the selected drive. */\nexport const unwrappedDocumentsAtom = unwrap(documentsAtom);\nunwrappedDocumentsAtom.debugLabel = \"unwrappedDocumentsAtom\";\n/** Returns a promise of the selected document.\n *\n * A \"document\" is a PHDocument. This id is the document's id, and this id will also be found in the drive's nodes. We use the same id for finding a node in a drive and for identifying a document in the reactor.\n *\n * Suspends until the documents are set and the selected node id is set.\n * If the selected node id is set as undefined, returns a resolved promise of undefined.\n *\n * Does not provide a setter, since it is derived from the selected node id.\n */\nexport const selectedDocumentAtom = atom((get) => {\n const loadableDocuments = get(loadableDocumentsAtom);\n const nodeId = get(selectedNodeIdAtom);\n // Suspends until the documents are set and the selected node id is set.\n if (nodeId === NOT_SET || loadableDocuments.state !== \"hasData\")\n return suspendUntilSet();\n const documents = loadableDocuments.data;\n return documents.find((document) => document.header.id === nodeId);\n});\nselectedDocumentAtom.debugLabel = \"selectedDocumentAtom\";\n/** Returns a Loadable of the selected document. */\nexport const loadableSelectedDocumentAtom = loadable(selectedDocumentAtom);\nloadableSelectedDocumentAtom.debugLabel = \"loadableSelectedDocumentAtom\";\n/** Returns a resolved promise of the selected document. */\nexport const unwrappedSelectedDocumentAtom = unwrap(selectedDocumentAtom);\nunwrappedSelectedDocumentAtom.debugLabel = \"unwrappedSelectedDocumentAtom\";\n/* PH Packages */\nexport const phPackagesAtom = atom(Promise.resolve(undefined));\nphPackagesAtom.debugLabel = \"phPackagesAtom\";\nexport const setPhPackagesAtom = atom(null, (_get, set, phPackages) => {\n set(phPackagesAtom, Promise.resolve(phPackages));\n});\nsetPhPackagesAtom.debugLabel = \"setPhPackagesAtom\";\nexport const loadablePhPackagesAtom = loadable(phPackagesAtom);\nloadablePhPackagesAtom.debugLabel = \"loadablePhPackagesAtom\";\nexport const unwrappedPhPackagesAtom = unwrap(phPackagesAtom);\nunwrappedPhPackagesAtom.debugLabel = \"unwrappedPhPackagesAtom\";\n/* Document Model Modules */\nexport const documentModelModulesAtom = atomWithRefresh(async (get) => {\n const loadablePhPackages = get(loadablePhPackagesAtom);\n if (loadablePhPackages.state !== \"hasData\")\n return suspendUntilSet();\n const phPackages = loadablePhPackages.data;\n return phPackages?.map((p) => p.documentModels).flat();\n});\ndocumentModelModulesAtom.debugLabel = \"documentModelModulesAtom\";\nexport const loadableDocumentModelModulesAtom = loadable(documentModelModulesAtom);\nloadableDocumentModelModulesAtom.debugLabel =\n \"loadableDocumentModelModulesAtom\";\nexport const unwrappedDocumentModelModulesAtom = unwrap(documentModelModulesAtom);\nunwrappedDocumentModelModulesAtom.debugLabel =\n \"unwrappedDocumentModelModulesAtom\";\n/* Editors */\nexport const editorModulesAtom = atomWithRefresh(async (get) => {\n const loadablePhPackages = get(loadablePhPackagesAtom);\n if (loadablePhPackages.state !== \"hasData\")\n return suspendUntilSet();\n const phPackages = loadablePhPackages.data;\n return phPackages?.map((p) => p.editors).flat();\n});\neditorModulesAtom.debugLabel = \"editorModulesAtom\";\nexport const loadableEditorModulesAtom = loadable(editorModulesAtom);\nloadableEditorModulesAtom.debugLabel = \"loadableEditorModulesAtom\";\nexport const unwrappedEditorModulesAtom = unwrap(editorModulesAtom);\nunwrappedEditorModulesAtom.debugLabel = \"unwrappedEditorModulesAtom\";\n/* Processor Manager */\nexport const processorManagerAtom = atom(undefined);\nprocessorManagerAtom.debugLabel = \"processorManagerAtom\";\n/* Config */\nexport const configAtom = atom({\n appVersion: undefined,\n studioMode: false,\n warnOutdatedApp: false,\n routerBasename: undefined,\n analyticsDatabaseName: undefined,\n sentry: {\n dsn: undefined,\n env: undefined,\n tracing: undefined,\n },\n content: {\n showSearchBar: true,\n showDocumentModelSelectionSetting: true,\n },\n drives: {\n addDriveEnabled: true,\n sections: {\n LOCAL: {\n enabled: true,\n allowAdd: true,\n allowDelete: true,\n },\n CLOUD: {\n enabled: true,\n allowAdd: true,\n allowDelete: true,\n },\n PUBLIC: {\n enabled: true,\n allowAdd: true,\n allowDelete: true,\n },\n },\n },\n gaTrackingId: undefined,\n phCliVersion: undefined,\n});\nconfigAtom.debugLabel = \"configAtom\";\n//# sourceMappingURL=atoms.js.map","import { useAtomValue, useSetAtom } from \"jotai\";\nimport { documentsAtom, loadableDocumentsAtom, loadableSelectedDocumentAtom, unwrappedDocumentsAtom, unwrappedSelectedDocumentAtom, } from \"./atoms.js\";\n/** Returns a loadable of the documents for a reactor. */\nexport function useDocuments() {\n return useAtomValue(loadableDocumentsAtom);\n}\n/** Returns a resolved promise of the documents for a reactor. */\nexport function useUnwrappedDocuments() {\n return useAtomValue(unwrappedDocumentsAtom);\n}\n/** Refreshes the documents for a reactor. */\nexport function useRefreshDocuments() {\n return useSetAtom(documentsAtom);\n}\n/** Returns a loadable of the selected document. */\nexport function useSelectedDocument() {\n return useAtomValue(loadableSelectedDocumentAtom);\n}\n/** Returns a resolved promise of the selected document. */\nexport function useUnwrappedSelectedDocument() {\n return useAtomValue(unwrappedSelectedDocumentAtom);\n}\n/** Returns a loadable of a document for a reactor by id. */\nexport function useDocumentById(id) {\n const documents = useDocuments();\n if (documents.state !== \"hasData\")\n return documents;\n if (!id)\n return { state: \"hasData\", data: undefined };\n const document = documents.data.find((d) => d.header.id === id);\n return { state: \"hasData\", data: document };\n}\n/** Returns a resolved promise of a document for a reactor by id. */\nexport function useUnwrappedDocumentById(id) {\n const documents = useUnwrappedDocuments();\n if (!id)\n return undefined;\n return documents?.find((d) => d.header.id === id);\n}\n//# sourceMappingURL=documents.js.map","import { useCallback } from \"react\";\nimport { useRefreshDocuments } from \"./documents.js\";\nimport { useRefreshDrives } from \"./drives.js\";\n/** Returns a function that refreshes the drives and documents for a reactor. */\nexport function useSyncDrivesAndDocumentsWithReactor() {\n const refreshDrives = useRefreshDrives();\n const refreshDocuments = useRefreshDocuments();\n return useCallback(() => {\n refreshDrives();\n refreshDocuments();\n }, [refreshDrives, refreshDocuments]);\n}\n//# sourceMappingURL=syncing.js.map","import { childLogger, SynchronizationUnitNotFoundError, } from \"document-drive\";\nimport { useAtomValue, useSetAtom } from \"jotai\";\nimport { useCallback, useEffect } from \"react\";\nimport { initializeReactorAtom, loadableReactorAtom, selectedDriveAtom, setSelectedNodeAtom, unwrappedReactorAtom, } from \"./atoms.js\";\nimport { useSyncDrivesAndDocumentsWithReactor } from \"./syncing.js\";\nimport { setSelectedDriveAndNodeFromUrl } from \"./utils.js\";\nconst logger = childLogger([\"state\", \"reactor\"]);\n/** Returns a loadable of the reactor. */\nexport function useReactor() {\n return useAtomValue(loadableReactorAtom);\n}\n/** Returns the unwrapped reactor. */\nexport function useUnwrappedReactor() {\n return useAtomValue(unwrappedReactorAtom);\n}\n/** Initializes the reactor.\n *\n * Creates the reactor and sets the selected drive and node from the URL if `shouldNavigate` is true.\n * Subscribes to the reactor's events and refreshes the drives and documents when they change.\n *\n * If the reactor is already initialized, does nothing.\n */\nexport function useInitializeReactor(createReactor, shouldNavigate = true) {\n const unwrappedReactor = useUnwrappedReactor();\n const setReactor = useSetAtom(initializeReactorAtom);\n const setSelectedDrive = useSetAtom(selectedDriveAtom);\n const setSelectedNode = useSetAtom(setSelectedNodeAtom);\n const refresh = useSyncDrivesAndDocumentsWithReactor();\n useEffect(() => {\n // If the reactor is already initialized, do nothing.\n if (unwrappedReactor)\n return;\n async function initializeReactor() {\n // Create the reactor instance.\n const reactor = await createReactor();\n // Subscribe to the reactor's events.\n reactor.on(\"syncStatus\", (event, status, error) => {\n logger.verbose(\"syncStatus\", event, status, error);\n refresh();\n });\n reactor.on(\"strandUpdate\", () => {\n logger.verbose(\"strandUpdate\");\n refresh();\n });\n reactor.on(\"defaultRemoteDrive\", () => {\n logger.verbose(\"defaultRemoteDrive\");\n refresh();\n });\n // Set the reactor instance atom.\n setReactor(reactor);\n // Set the selected drive and node from the URL if `shouldNavigate` is true.\n await setSelectedDriveAndNodeFromUrl(reactor, setSelectedDrive, setSelectedNode, shouldNavigate);\n }\n initializeReactor().catch(logger.error);\n }, [setReactor, createReactor, refresh, shouldNavigate]);\n}\nexport function useGetSyncStatusSync() {\n const reactor = useUnwrappedReactor();\n const getSyncStatusSync = useCallback((syncId, sharingType) => {\n if (sharingType === \"LOCAL\")\n return;\n if (!reactor) {\n return \"INITIAL_SYNC\";\n }\n try {\n const syncStatus = reactor.getSyncStatus(syncId);\n if (syncStatus instanceof SynchronizationUnitNotFoundError)\n return \"INITIAL_SYNC\";\n return syncStatus;\n }\n catch (error) {\n logger.error(error);\n return \"ERROR\";\n }\n }, [reactor]);\n return getSyncStatusSync;\n}\n//# sourceMappingURL=reactor.js.map","import {\n InternalDevTools\n} from \"./chunk-HLGSGNDX.esm.mjs\";\nimport {\n useAtomDevtools,\n useAtomsDebugValue,\n useAtomsDevtools,\n useAtomsSnapshot,\n useGotoAtomsSnapshot\n} from \"./chunk-K3M223F4.esm.mjs\";\n\n// src/index.ts\nvar DevTools = process.env.NODE_ENV !== \"production\" ? InternalDevTools : () => null;\nexport {\n DevTools,\n useAtomDevtools,\n useAtomsDebugValue,\n useAtomsDevtools,\n useAtomsSnapshot,\n useGotoAtomsSnapshot\n};\n","import { createStore } from \"jotai\";\n/** The atom store for the app.\n *\n * All derived hooks should use this store.\n */\nexport const atomStore = createStore();\n//# sourceMappingURL=store.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Provider } from \"jotai\";\nimport { DevTools } from \"jotai-devtools\";\nimport \"jotai-devtools/styles.css\";\nimport { useInitializeReactor } from \"./reactor.js\";\nimport { atomStore } from \"./store.js\";\nfunction InitReactor({ reactor }) {\n useInitializeReactor(() => Promise.resolve(reactor));\n return null;\n}\n/** Provides the atom store to the app.\n *\n * This is the top-level provider for the atom store.\n *\n * It is used to provide the atom store to the app.\n *\n * It should only be used once in the app and must appear before any `<Suspense>` boundaries.\n *\n * Includes the Jotai DevTools for debugging.\n */\nexport function AtomStoreProvider({ reactor, children, }) {\n return (_jsxs(Provider, { store: atomStore, children: [_jsx(DevTools, { store: atomStore }), reactor && _jsx(InitReactor, { reactor: reactor }), children] }));\n}\n//# sourceMappingURL=store-provider.js.map","import { lazy, StrictMode, Suspense } from 'react';\nimport '../i18n';\n\nimport { AtomStoreProvider } from '@powerhousedao/common';\nimport { AppSkeleton } from './app-skeleton.js';\n\nconst App = lazy(() => import('./app.js'));\nconst CookieBanner = lazy(() =>\n import('./cookie-banner.js').then(m => ({ default: m.CookieBanner })),\n);\n\nconst ModalManager = lazy(() =>\n import('./modal/modal.js').then(m => ({ default: m.ModalManager })),\n);\n\nexport const AppLoader = (\n <StrictMode>\n <AtomStoreProvider>\n <Suspense fallback={<AppSkeleton />} name=\"AppLoader\">\n <App />\n </Suspense>\n <Suspense name=\"CookieBanner\">\n <ModalManager>\n <CookieBanner />\n </ModalManager>\n </Suspense>\n </AtomStoreProvider>\n </StrictMode>\n);\n","import { createRoot } from 'react-dom/client';\nimport { AppLoader } from './components/app-loader.js';\n\nfunction renderApp(element: HTMLElement) {\n createRoot(element).render(AppLoader);\n}\n\nconst AppElement = document.getElementById('app');\nif (!AppElement) {\n throw new Error('#app element not found!');\n}\n\nrenderApp(AppElement);\n"],"file":"assets/index.BDEjD6s0.js"}
@@ -1,4 +1,4 @@
1
- import{j as fn,t as Rl,k as Dt,D as Ms,l as h,m as ze,G as U,C as aa,n as se,o as bi,p as it,q as Lt,v as ca,w as At,S as Os,x as Pt,y as Ns,z as Te,A as gr,B as Cl,E as xl,F as Ie,H as k,I as ua,J as A,K as ae,L as Al,M as Ds,N as _r,O as Gt,P as pn,Q as Ml,R as lt,T as j,U as ot,V as Ol,W as Nl,X as Jn,Y as yr,Z as la,_ as Dl,$ as Ll,a0 as Pl,a1 as Fl,a2 as $l,a3 as Ei,a4 as Ls,a5 as vi,a6 as Ps,a7 as Fs,a8 as da,a9 as Zn,aa as Ti,ab as He,ac as Yt,ad as $s,ae as oe,af as at,ag as fa,ah as pa,ai as ha,aj as rs,ak as ma,al as ga,am as Bl,an as ss,ao as Ft,ap as Sn,aq as Bs,ar as Ii,as as Hl,at as Mt,au as Hs,av as Ul,aw as Wl,ax as zl,ay as je,az as Qn,aA as Sr,aB as _a,aC as jl,aD as wi,aE as ki,aF as ql,aG as is,aH as Gl,aI as Yl,aJ as Ri,aK as Vl}from"./user.D5A2C_6c.js";import{aL as Dv,aM as Lv,aN as Pv,aO as Fv,aP as $v,aQ as Bv,aR as Hv,aS as Uv,aT as Wv,aU as zv,aV as jv,aW as qv,aX as Gv,aY as Yv,aZ as Vv,a_ as Kv,a$ as Xv}from"./user.D5A2C_6c.js";import{p as Ci,aD as br}from"./index.DFyMrewv.js";import*as me from"react";import"./connect.config._T1v6EoS.js";import"./browser.BkwNmV2Z.js";import"./index.CIKNjgvt.js";import"react-dom/client";import"react/jsx-runtime";import"./app-skeleton.js";import"react-dom";function ya(e,t,n=250,r,s,i,o){if(!i.exception||!i.exception.values||!o||!fn(o.originalException,Error))return;const a=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;a&&(i.exception.values=Kl(os(e,t,s,o.originalException,r,i.exception.values,a,0),n))}function os(e,t,n,r,s,i,o,a){if(i.length>=n+1)return i;let c=[...i];if(fn(r[s],Error)){xi(o,a);const u=e(t,r[s]),l=c.length;Ai(u,s,l,a),c=os(e,t,n,r[s],s,[u,...c],u,l)}return Array.isArray(r.errors)&&r.errors.forEach((u,l)=>{if(fn(u,Error)){xi(o,a);const d=e(t,u),f=c.length;Ai(d,`errors[${l}]`,f,a),c=os(e,t,n,u,s,[d,...c],d,f)}}),c}function xi(e,t){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,...e.type==="AggregateError"&&{is_exception_group:!0},exception_id:t}}function Ai(e,t,n,r){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}function Kl(e,t){return e.map(n=>(n.value&&(n.value=Rl(n.value,t)),n))}const Xl=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Jl(e){return e==="http"||e==="https"}function dt(e,t=!1){const{host:n,path:r,pass:s,port:i,projectId:o,protocol:a,publicKey:c}=e;return`${a}://${c}${t&&s?`:${s}`:""}@${n}${i?`:${i}`:""}/${r&&`${r}/`}${o}`}function Sa(e){const t=Xl.exec(e);if(!t){Dt(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}const[n,r,s="",i,o="",a]=t.slice(1);let c="",u=a;const l=u.split("/");if(l.length>1&&(c=l.slice(0,-1).join("/"),u=l.pop()),u){const d=u.match(/^\d+/);d&&(u=d[0])}return ba({host:i,pass:s,path:c,projectId:u,port:o,protocol:n,publicKey:r})}function ba(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function Zl(e){if(!Ms)return!0;const{port:t,projectId:n,protocol:r}=e;return["protocol","publicKey","host","projectId"].find(o=>e[o]?!1:(h.error(`Invalid Sentry Dsn: ${o} missing`),!0))?!1:n.match(/^\d+$/)?Jl(r)?t&&isNaN(parseInt(t,10))?(h.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(h.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(h.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function Ea(e){const t=typeof e=="string"?Sa(e):ba(e);if(!(!t||!Zl(t)))return t}class Ce extends Error{constructor(t,n="warn"){super(t),this.message=t,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=n}}const Gn={},Mi={};function ft(e,t){Gn[e]=Gn[e]||[],Gn[e].push(t)}function pt(e,t){Mi[e]||(t(),Mi[e]=!0)}function ve(e,t){const n=e&&Gn[e];if(n)for(const r of n)try{r(t)}catch(s){Ms&&h.error(`Error while triggering instrumentation handler.
1
+ import{j as fn,t as Rl,k as Dt,D as Ms,l as h,m as ze,G as U,C as aa,n as se,o as bi,p as it,q as Lt,v as ca,w as At,S as Os,x as Pt,y as Ns,z as Te,A as gr,B as Cl,E as xl,F as Ie,H as k,I as ua,J as A,K as ae,L as Al,M as Ds,N as _r,O as Gt,P as pn,Q as Ml,R as lt,T as j,U as ot,V as Ol,W as Nl,X as Jn,Y as yr,Z as la,_ as Dl,$ as Ll,a0 as Pl,a1 as Fl,a2 as $l,a3 as Ei,a4 as Ls,a5 as vi,a6 as Ps,a7 as Fs,a8 as da,a9 as Zn,aa as Ti,ab as He,ac as Yt,ad as $s,ae as oe,af as at,ag as fa,ah as pa,ai as ha,aj as rs,ak as ma,al as ga,am as Bl,an as ss,ao as Ft,ap as Sn,aq as Bs,ar as Ii,as as Hl,at as Mt,au as Hs,av as Ul,aw as Wl,ax as zl,ay as je,az as Qn,aA as Sr,aB as _a,aC as jl,aD as wi,aE as ki,aF as ql,aG as is,aH as Gl,aI as Yl,aJ as Ri,aK as Vl}from"./user.BQU9ztVh.js";import{aL as Dv,aM as Lv,aN as Pv,aO as Fv,aP as $v,aQ as Bv,aR as Hv,aS as Uv,aT as Wv,aU as zv,aV as jv,aW as qv,aX as Gv,aY as Yv,aZ as Vv,a_ as Kv,a$ as Xv}from"./user.BQU9ztVh.js";import{p as Ci,aD as br}from"./index.DFyMrewv.js";import*as me from"react";import"./connect.config.DUXg7xh4.js";import"./browser.BkwNmV2Z.js";import"./index.BDEjD6s0.js";import"react-dom/client";import"react/jsx-runtime";import"./app-skeleton.js";import"react-dom";function ya(e,t,n=250,r,s,i,o){if(!i.exception||!i.exception.values||!o||!fn(o.originalException,Error))return;const a=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;a&&(i.exception.values=Kl(os(e,t,s,o.originalException,r,i.exception.values,a,0),n))}function os(e,t,n,r,s,i,o,a){if(i.length>=n+1)return i;let c=[...i];if(fn(r[s],Error)){xi(o,a);const u=e(t,r[s]),l=c.length;Ai(u,s,l,a),c=os(e,t,n,r[s],s,[u,...c],u,l)}return Array.isArray(r.errors)&&r.errors.forEach((u,l)=>{if(fn(u,Error)){xi(o,a);const d=e(t,u),f=c.length;Ai(d,`errors[${l}]`,f,a),c=os(e,t,n,u,s,[d,...c],d,f)}}),c}function xi(e,t){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,...e.type==="AggregateError"&&{is_exception_group:!0},exception_id:t}}function Ai(e,t,n,r){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}function Kl(e,t){return e.map(n=>(n.value&&(n.value=Rl(n.value,t)),n))}const Xl=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Jl(e){return e==="http"||e==="https"}function dt(e,t=!1){const{host:n,path:r,pass:s,port:i,projectId:o,protocol:a,publicKey:c}=e;return`${a}://${c}${t&&s?`:${s}`:""}@${n}${i?`:${i}`:""}/${r&&`${r}/`}${o}`}function Sa(e){const t=Xl.exec(e);if(!t){Dt(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}const[n,r,s="",i,o="",a]=t.slice(1);let c="",u=a;const l=u.split("/");if(l.length>1&&(c=l.slice(0,-1).join("/"),u=l.pop()),u){const d=u.match(/^\d+/);d&&(u=d[0])}return ba({host:i,pass:s,path:c,projectId:u,port:o,protocol:n,publicKey:r})}function ba(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function Zl(e){if(!Ms)return!0;const{port:t,projectId:n,protocol:r}=e;return["protocol","publicKey","host","projectId"].find(o=>e[o]?!1:(h.error(`Invalid Sentry Dsn: ${o} missing`),!0))?!1:n.match(/^\d+$/)?Jl(r)?t&&isNaN(parseInt(t,10))?(h.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(h.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(h.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function Ea(e){const t=typeof e=="string"?Sa(e):ba(e);if(!(!t||!Zl(t)))return t}class Ce extends Error{constructor(t,n="warn"){super(t),this.message=t,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=n}}const Gn={},Mi={};function ft(e,t){Gn[e]=Gn[e]||[],Gn[e].push(t)}function pt(e,t){Mi[e]||(t(),Mi[e]=!0)}function ve(e,t){const n=e&&Gn[e];if(n)for(const r of n)try{r(t)}catch(s){Ms&&h.error(`Error while triggering instrumentation handler.
2
2
  Type: ${e}
3
3
  Name: ${ze(r)}
4
4
  Error:`,s)}}function va(e){const t="console";ft(t,e),pt(t,Ql)}function Ql(){"console"in U&&aa.forEach(function(e){e in U.console&&se(U.console,e,function(t){return bi[e]=t,function(...n){ve("console",{args:n,level:e});const s=bi[e];s&&s.apply(U.console,n)}})})}const bt=U,ed=1e3;let Oi,as,cs;function Ta(e){const t="dom";ft(t,e),pt(t,td)}function td(){if(!bt.document)return;const e=ve.bind(null,"dom"),t=Ni(e,!0);bt.document.addEventListener("click",t,!1),bt.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(n=>{const r=bt[n]&&bt[n].prototype;!r||!r.hasOwnProperty||!r.hasOwnProperty("addEventListener")||(se(r,"addEventListener",function(s){return function(i,o,a){if(i==="click"||i=="keypress")try{const c=this,u=c.__sentry_instrumentation_handlers__=c.__sentry_instrumentation_handlers__||{},l=u[i]=u[i]||{refCount:0};if(!l.handler){const d=Ni(e);l.handler=d,s.call(this,i,d,a)}l.refCount++}catch{}return s.call(this,i,o,a)}}),se(r,"removeEventListener",function(s){return function(i,o,a){if(i==="click"||i=="keypress")try{const c=this,u=c.__sentry_instrumentation_handlers__||{},l=u[i];l&&(l.refCount--,l.refCount<=0&&(s.call(this,i,l.handler,a),l.handler=void 0,delete u[i]),Object.keys(u).length===0&&delete c.__sentry_instrumentation_handlers__)}catch{}return s.call(this,i,o,a)}}))})}function nd(e){if(e.type!==as)return!1;try{if(!e.target||e.target._sentryId!==cs)return!1}catch{}return!0}function rd(e,t){return e!=="keypress"?!1:!t||!t.tagName?!0:!(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable)}function Ni(e,t=!1){return n=>{if(!n||n._sentryCaptured)return;const r=sd(n);if(rd(n.type,r))return;it(n,"_sentryCaptured",!0),r&&!r._sentryId&&it(r,"_sentryId",Lt());const s=n.type==="keypress"?"input":n.type;nd(n)||(e({event:n,name:s,global:t}),as=n.type,cs=r?r._sentryId:void 0),clearTimeout(Oi),Oi=bt.setTimeout(()=>{cs=void 0,as=void 0},ed)}}function sd(e){try{return e.target}catch{return null}}const er=ca();function Ia(){if(!("fetch"in er))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function us(e){return e&&/^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function wa(){if(typeof EdgeRuntime=="string")return!0;if(!Ia())return!1;if(us(er.fetch))return!0;let e=!1;const t=er.document;if(t&&typeof t.createElement=="function")try{const n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n),n.contentWindow&&n.contentWindow.fetch&&(e=us(n.contentWindow.fetch)),t.head.removeChild(n)}catch(n){Ms&&h.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return e}function id(){return"ReportingObserver"in er}function Er(e){const t="fetch";ft(t,e),pt(t,od)}function od(){wa()&&se(U,"fetch",function(e){return function(...t){const{method:n,url:r}=ad(t),s={args:t,fetchData:{method:n,url:r},startTimestamp:Date.now()};return ve("fetch",{...s}),e.apply(U,t).then(i=>{const o={...s,endTimestamp:Date.now(),response:i};return ve("fetch",o),i},i=>{const o={...s,endTimestamp:Date.now(),error:i};throw ve("fetch",o),i})}})}function ls(e,t){return!!e&&typeof e=="object"&&!!e[t]}function Di(e){return typeof e=="string"?e:e?ls(e,"url")?e.url:e.toString?e.toString():"":""}function ad(e){if(e.length===0)return{method:"GET",url:""};if(e.length===2){const[n,r]=e;return{url:Di(n),method:ls(r,"method")?String(r.method).toUpperCase():"GET"}}const t=e[0];return{url:Di(t),method:ls(t,"method")?String(t.method).toUpperCase():"GET"}}let On=null;function ka(e){const t="error";ft(t,e),pt(t,cd)}function cd(){On=U.onerror,U.onerror=function(e,t,n,r,s){return ve("error",{column:r,error:s,line:n,msg:e,url:t}),On&&!On.__SENTRY_LOADER__?On.apply(this,arguments):!1},U.onerror.__SENTRY_INSTRUMENTED__=!0}let Nn=null;function Ra(e){const t="unhandledrejection";ft(t,e),pt(t,ud)}function ud(){Nn=U.onunhandledrejection,U.onunhandledrejection=function(e){return ve("unhandledrejection",e),Nn&&!Nn.__SENTRY_LOADER__?Nn.apply(this,arguments):!0},U.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const Dn=ca();function ld(){const e=Dn.chrome,t=e&&e.app&&e.app.runtime,n="history"in Dn&&!!Dn.history.pushState&&!!Dn.history.replaceState;return!t&&n}const en=U;let Ln;function bn(e){const t="history";ft(t,e),pt(t,dd)}function dd(){if(!ld())return;const e=en.onpopstate;en.onpopstate=function(...n){const r=en.location.href,s=Ln;if(Ln=r,ve("history",{from:s,to:r}),e)try{return e.apply(this,n)}catch{}};function t(n){return function(...r){const s=r.length>2?r[2]:void 0;if(s){const i=Ln,o=String(s);Ln=o,ve("history",{from:i,to:o})}return n.apply(this,r)}}se(en.history,"pushState",t),se(en.history,"replaceState",t)}const fd=U,Me="__sentry_xhr_v3__";function vr(e){const t="xhr";ft(t,e),pt(t,pd)}function pd(){if(!fd.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;se(e,"open",function(t){return function(...n){const r=Date.now(),s=At(n[0])?n[0].toUpperCase():void 0,i=hd(n[1]);if(!s||!i)return t.apply(this,n);this[Me]={method:s,url:i,request_headers:{}},s==="POST"&&i.match(/sentry_key/)&&(this.__sentry_own_request__=!0);const o=()=>{const a=this[Me];if(a&&this.readyState===4){try{a.status_code=this.status}catch{}const c={args:[s,i],endTimestamp:Date.now(),startTimestamp:r,xhr:this};ve("xhr",c)}};return"onreadystatechange"in this&&typeof this.onreadystatechange=="function"?se(this,"onreadystatechange",function(a){return function(...c){return o(),a.apply(this,c)}}):this.addEventListener("readystatechange",o),se(this,"setRequestHeader",function(a){return function(...c){const[u,l]=c,d=this[Me];return d&&At(u)&&At(l)&&(d.request_headers[u.toLowerCase()]=l),a.apply(this,c)}}),t.apply(this,n)}}),se(e,"send",function(t){return function(...n){const r=this[Me];if(!r)return t.apply(this,n);n[0]!==void 0&&(r.body=n[0]);const s={args:[r.method,r.url],startTimestamp:Date.now(),xhr:this};return ve("xhr",s),t.apply(this,n)}})}function hd(e){if(At(e))return e;try{return e.toString()}catch{}}function md(){return typeof __SENTRY_BROWSER_BUNDLE__<"u"&&!!__SENTRY_BROWSER_BUNDLE__}function gd(){return"npm"}function _d(){return!md()&&Object.prototype.toString.call(typeof Ci<"u"?Ci:0)==="[object process]"}function ds(){return typeof window<"u"&&(!_d()||yd())}function yd(){return U.process!==void 0&&U.process.type==="renderer"}function Sd(e,t){let n=0;for(let r=e.length-1;r>=0;r--){const s=e[r];s==="."?e.splice(r,1):s===".."?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}const bd=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function Ed(e){const t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,n=bd.exec(t);return n?n.slice(1):[]}function Li(...e){let t="",n=!1;for(let r=e.length-1;r>=-1&&!n;r--){const s=r>=0?e[r]:"/";s&&(t=`${s}/${t}`,n=s.charAt(0)==="/")}return t=Sd(t.split("/").filter(r=>!!r),!n).join("/"),(n?"/":"")+t||"."}function Pi(e){let t=0;for(;t<e.length&&e[t]==="";t++);let n=e.length-1;for(;n>=0&&e[n]==="";n--);return t>n?[]:e.slice(t,n-t+1)}function vd(e,t){e=Li(e).slice(1),t=Li(t).slice(1);const n=Pi(e.split("/")),r=Pi(t.split("/")),s=Math.min(n.length,r.length);let i=s;for(let a=0;a<s;a++)if(n[a]!==r[a]){i=a;break}let o=[];for(let a=i;a<n.length;a++)o.push("..");return o=o.concat(r.slice(i)),o.join("/")}function Td(e,t){return Ed(e)[2]}function Id(e){const t=[];function n(){return e===void 0||t.length<e}function r(o){return t.splice(t.indexOf(o),1)[0]}function s(o){if(!n())return Ns(new Ce("Not adding Promise because buffer limit was reached."));const a=o();return t.indexOf(a)===-1&&t.push(a),a.then(()=>r(a)).then(null,()=>r(a).then(null,()=>{})),a}function i(o){return new Os((a,c)=>{let u=t.length;if(!u)return a(!0);const l=setTimeout(()=>{o&&o>0&&a(!1)},o);t.forEach(d=>{Pt(d).then(()=>{--u||(clearTimeout(l),a(!0))},c)})})}return{$:t,add:s,drain:i}}function et(e){if(!e)return{};const t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};const n=t[6]||"",r=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:n,hash:r,relative:t[5]+n+r}}function wd(e){return e.split(/[\?#]/,1)[0]}function Fi(e){return e.split(/\\?\//).filter(t=>t.length>0&&t!==",").length}const kd=["fatal","error","warning","log","info","debug"];function Ca(e){return e==="warn"?"warning":kd.includes(e)?e:"log"}function Ne(e,t=[]){return[e,t]}function Rd(e,t){const[n,r]=e;return[n,[...r,t]]}function $t(e,t){const n=e[1];for(const r of n){const s=r[0].type;if(t(r,s))return!0}return!1}function Cd(e,t){return $t(e,(n,r)=>t.includes(r))}function fs(e,t){return(t||new TextEncoder).encode(e)}function xa(e,t){const[n,r]=e;let s=JSON.stringify(n);function i(o){typeof s=="string"?s=typeof o=="string"?s+o:[fs(s,t),o]:s.push(typeof o=="string"?fs(o,t):o)}for(const o of r){const[a,c]=o;if(i(`
@@ -358,4 +358,4 @@ ${t==="system"?`
358
358
  `),"</html>"];return s.forEach(a=>{const c=a.stacktrace;c&&c.frames&&(c.frames=c.frames.map(u=>Kb(u,o,r,t)))}),e}function Kb(e,t,n,r){return e.filename!==n||!e.lineno||!t.length||Gl(t,e,r),e}function yn(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function Xb(e,t){const n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);const r=yn(n);return s=>r.then(i=>s(i.transaction(t,"readwrite").objectStore(t)))}function al(e){return yn(e.getAllKeys())}function Jb(e,t,n){return e(r=>al(r).then(s=>{if(!(s.length>=n))return r.put(t,Math.max(...s,0)+1),yn(r.transaction)}))}function Zb(e){return e(t=>al(t).then(n=>{if(n.length!==0)return yn(t.get(n[0])).then(r=>(t.delete(n[0]),yn(t.transaction).then(()=>r)))}))}function Qb(e){let t;function n(){return t==null&&(t=Xb(e.dbName||"sentry-offline",e.storeName||"queue")),t}return{insert:async r=>{try{const s=await xa(r,e.textEncoder);await Jb(n(),s,e.maxQueueSize||30)}catch{}},pop:async()=>{try{const r=await Zb(n());if(r)return Ad(r,e.textEncoder||new TextEncoder,e.textDecoder||new TextDecoder)}catch{}}}}function eE(e){return t=>e({...t,createStore:Qb})}function hv(e){return eE(Pf(e))}const ea=1e6,Xn=String(0),tE="main";let cl="",ul="",ll="",Cs=E.navigator&&E.navigator.userAgent||"",dl="";const nE=E.navigator&&E.navigator.language||E.navigator&&E.navigator.languages&&E.navigator.languages[0]||"";function rE(e){return typeof e=="object"&&e!==null&&"getHighEntropyValues"in e}const ta=E.navigator&&E.navigator.userAgentData;rE(ta)&&ta.getHighEntropyValues(["architecture","model","platform","platformVersion","fullVersionList"]).then(e=>{if(cl=e.platform||"",ll=e.architecture||"",dl=e.model||"",ul=e.platformVersion||"",e.fullVersionList&&e.fullVersionList.length>0){const t=e.fullVersionList[e.fullVersionList.length-1];Cs=`${t.brand} ${t.version}`}}).catch(e=>{});function sE(e){return!("thread_metadata"in e)}function iE(e){return sE(e)?cE(e):e}function oE(e){const t=e&&e.contexts&&e.contexts.trace&&e.contexts.trace.trace_id;return typeof t=="string"&&t.length!==32&&F&&h.log(`[Profiling] Invalid traceId: ${t} on profiled event`),typeof t!="string"?"":t}function aE(e,t,n,r){if(r.type!=="transaction")throw new TypeError("Profiling events may only be attached to transactions, this should never occur.");if(n==null)throw new TypeError(`Cannot construct profiling event envelope without a valid profile. Got ${n} instead.`);const s=oE(r),i=iE(n),o=t||(typeof r.start_timestamp=="number"?r.start_timestamp*1e3:Date.now()),a=typeof r.timestamp=="number"?r.timestamp*1e3:Date.now();return{event_id:e,timestamp:new Date(o).toISOString(),platform:"javascript",version:"1",release:r.release||"",environment:r.environment||Yl,runtime:{name:"javascript",version:E.navigator.userAgent},os:{name:cl,version:ul,build_number:Cs},device:{locale:nE,model:dl,manufacturer:Cs,architecture:ll,is_emulator:!1},debug_meta:{images:dE(n.resources)},profile:i,transactions:[{name:r.transaction||"",id:r.event_id||Lt(),trace_id:s,active_thread_id:Xn,relative_start_ns:"0",relative_end_ns:((a-o)*1e6).toFixed(0)}]}}function fl(e){return e.op==="pageload"}function cE(e){let t,n=0;const r={samples:[],stacks:[],frames:[],thread_metadata:{[Xn]:{name:tE}}};if(!e.samples.length)return r;const s=e.samples[0].timestamp,i=typeof performance.timeOrigin=="number"?performance.timeOrigin:oe||0,o=i-(oe||i);for(let a=0;a<e.samples.length;a++){const c=e.samples[a];if(c.stackId===void 0){t===void 0&&(t=n,r.stacks[t]=[],n++),r.samples[a]={elapsed_since_start_ns:((c.timestamp+o-s)*ea).toFixed(0),stack_id:t,thread_id:Xn};continue}let u=e.stacks[c.stackId];const l=[];for(;u;){l.push(u.frameId);const f=e.frames[u.frameId];r.frames[u.frameId]===void 0&&(r.frames[u.frameId]={function:f.name,abs_path:typeof f.resourceId=="number"?e.resources[f.resourceId]:void 0,lineno:f.line,colno:f.column}),u=u.parentId===void 0?void 0:e.stacks[u.parentId]}const d={elapsed_since_start_ns:((c.timestamp+o-s)*ea).toFixed(0),stack_id:n,thread_id:Xn};r.stacks[n]=l,r.samples[a]=d,n++}return r}function uE(e,t){if(!t.length)return e;for(const n of t)e[1].push([{type:"profile"},n]);return e}function lE(e){const t=[];return $t(e,(n,r)=>{if(r==="transaction")for(let s=1;s<n.length;s++){const i=n[s];i&&i.contexts&&i.contexts.profile&&i.contexts.profile.profile_id&&t.push(n[s])}}),t}const na=new WeakMap;function dE(e){const t=U._sentryDebugIds;if(!t)return[];const n=A(),r=n&&n.getOptions(),s=r&&r.stackParser;if(!s)return[];let i;const o=na.get(s);o?i=o:(i=new Map,na.set(s,i));const a=Object.keys(t).reduce((u,l)=>{let d;const f=i.get(l);f?d=f:(d=s(l),i.set(l,d));for(let p=d.length-1;p>=0;p--){const m=d[p],_=m&&m.filename;if(m&&_){u[_]=t[l];break}}return u},{}),c=[];for(const u of e)u&&a[u]&&c.push({type:"sourcemap",code_file:u,debug_id:a[u]});return c}function fE(e){return typeof e!="number"&&typeof e!="boolean"||typeof e=="number"&&isNaN(e)?(F&&h.warn(`[Profiling] Invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(e)} of type ${JSON.stringify(typeof e)}.`),!1):e===!0||e===!1?!0:e<0||e>1?(F&&h.warn(`[Profiling] Invalid sample rate. Sample rate must be between 0 and 1. Got ${e}.`),!1):!0}function pE(e){return e.samples.length<2?(F&&h.log("[Profiling] Discarding profile because it contains less than 2 samples"),!1):e.frames.length?!0:(F&&h.log("[Profiling] Discarding profile because it contains no frames"),!1)}let pl=!1;const hl=3e4;function hE(e){return typeof e=="function"}function mE(){const e=E.Profiler;if(!hE(e)){F&&h.log("[Profiling] Profiling is not supported by this browser, Profiler interface missing on window object.");return}const t=10,n=Math.floor(hl/t);try{return new e({sampleInterval:t,maxBufferSize:n})}catch{F&&(h.log("[Profiling] Failed to initialize the Profiling constructor, this is likely due to a missing 'Document-Policy': 'js-profiling' header."),h.log("[Profiling] Disabling profiling for current user session.")),pl=!0}}function xs(e){if(pl)return F&&h.log("[Profiling] Profiling has been disabled for the duration of the current user session."),!1;if(!e.isRecording())return F&&h.log("[Profiling] Discarding profile because transaction was not sampled."),!1;const t=A(),n=t&&t.getOptions();if(!n)return F&&h.log("[Profiling] Profiling disabled, no options found."),!1;const r=n.profilesSampleRate;return fE(r)?r?(r===!0?!0:Math.random()<r)?!0:(F&&h.log(`[Profiling] Discarding profile because it's not included in the random sample (sampling rate = ${Number(r)})`),!1):(F&&h.log("[Profiling] Discarding profile because a negative sampling decision was inherited or profileSampleRate is set to 0"),!1):(F&&h.warn("[Profiling] Discarding profile because of invalid sample rate."),!1)}function gE(e,t,n,r){return pE(n)?aE(e,t,n,r):null}const Qe=new Map;function _E(){return Qe.size}function yE(e){const t=Qe.get(e);return t&&Qe.delete(e),t}function SE(e,t){if(Qe.set(e,t),Qe.size>30){const n=Qe.keys().next().value;Qe.delete(n)}}function mv(e){return e?xs(e)?As(e):e:(F&&h.log("[Profiling] Transaction is undefined, skipping profiling"),e)}function As(e){let t;fl(e)&&(t=ot()*1e3);const n=mE();if(!n)return e;F&&h.log(`[Profiling] started profiling transaction: ${j(e).description}`);const r=Lt();async function s(){return!e||!n?null:n.stop().then(c=>(i&&(E.clearTimeout(i),i=void 0),F&&h.log(`[Profiling] stopped profiling of transaction: ${j(e).description}`),c?(SE(r,c),null):(F&&h.log(`[Profiling] profiler returned null profile for: ${j(e).description}`,"this may indicate an overlapping transaction or a call to stopProfiling with a profile title that was never started"),null))).catch(c=>(F&&h.log("[Profiling] error while stopping profiler:",c),null))}let i=E.setTimeout(()=>{F&&h.log("[Profiling] max profile duration elapsed, stopping profiling for:",j(e).description),s()},hl);const o=e.end.bind(e);function a(){return e?(s().then(()=>{e.setContext("profile",{profile_id:r,start_timestamp:t}),o()},()=>{o()}),e):o()}return e.end=a,e}const ml="BrowserProfiling",bE=()=>({name:ml,setupOnce(){},setup(e){const n=ae().getTransaction();if(n&&fl(n)&&xs(n)&&As(n),typeof e.on!="function"){h.warn("[Profiling] Client does not support hooks, profiling will be disabled");return}e.on("startTransaction",r=>{xs(r)&&As(r)}),e.on("beforeEnvelope",r=>{if(!_E())return;const s=lE(r);if(!s.length)return;const i=[];for(const o of s){const a=o&&o.contexts,c=a&&a.profile&&a.profile.profile_id,u=a&&a.profile&&a.profile.start_timestamp;if(typeof c!="string"){F&&h.log("[Profiling] cannot find profile for a transaction without a profile context");continue}if(!c){F&&h.log("[Profiling] cannot find profile for a transaction without a profile context");continue}a&&a.profile&&delete a.profile;const l=yE(c);if(!l){F&&h.log(`[Profiling] Could not retrieve profile for transaction: ${c}`);continue}const d=gE(c,u,l,o);d&&i.push(d)}uE(r,i)})}}),EE=bE,gv=Z(ml,EE);let gl={};E.Sentry&&E.Sentry.Integrations&&(gl=E.Sentry.Integrations);const _v={...gl,...Ip,...Jm};function yv(e){const t={...e};nc(t,"react"),Km(t)}const _l="ui.react.render",vE="ui.react.update",yl="ui.react.mount",ra="/home/runner/work/sentry-javascript/sentry-javascript/packages/react/src/profiler.tsx",TE="unknown";class Sl extends me.Component{static __initStatic(){this.defaultProps={disabled:!1,includeRender:!0,includeUpdates:!0}}constructor(t){super(t);const{name:n,disabled:r=!1}=this.props;r||(this._mountSpan=tt({name:`<${n}>`,onlyIfParent:!0,op:yl,origin:"auto.ui.react.profiler",attributes:{"ui.component_name":n}}))}componentDidMount(){this._mountSpan&&this._mountSpan.end()}shouldComponentUpdate({updateProps:t,includeUpdates:n=!0}){if(n&&this._mountSpan&&t!==this.props.updateProps){const r=Object.keys(t).filter(s=>t[s]!==this.props.updateProps[s]);if(r.length>0){const s=ot();this._updateSpan=Ri(this._mountSpan,()=>tt({name:`<${this.props.name}>`,onlyIfParent:!0,op:vE,origin:"auto.ui.react.profiler",startTimestamp:s,attributes:{"ui.component_name":this.props.name,"ui.react.changed_props":r}}))}}return!0}componentDidUpdate(){this._updateSpan&&(this._updateSpan.end(),this._updateSpan=void 0)}componentWillUnmount(){const t=ot(),{name:n,includeRender:r=!0}=this.props;if(this._mountSpan&&r){const s=j(this._mountSpan).timestamp;Ri(this._mountSpan,()=>{const i=tt({onlyIfParent:!0,name:`<${n}>`,op:_l,origin:"auto.ui.react.profiler",startTimestamp:s,attributes:{"ui.component_name":n}});i&&i.end(t)})}}render(){return this.props.children}}Sl.__initStatic();function Sv(e,t){const n=t&&t.name||e.displayName||e.name||TE,r=s=>me.createElement(Sl,{...t,name:n,updateProps:s,__self:this,__source:{fileName:ra,lineNumber:159}},me.createElement(e,{...s,__self:this,__source:{fileName:ra,lineNumber:160}}));return r.displayName=`profiler(${n})`,br(r,e),r}function bv(e,t={disabled:!1,hasRenderSpan:!0}){const[n]=me.useState(()=>{if(!(t&&t.disabled))return tt({name:`<${e}>`,onlyIfParent:!0,op:yl,origin:"auto.ui.react.profiler",attributes:{"ui.component_name":e}})});me.useEffect(()=>(n&&n.end(),()=>{if(n&&t.hasRenderSpan){const r=j(n).timestamp,s=ot(),i=tt({name:`<${e}>`,onlyIfParent:!0,op:_l,origin:"auto.ui.react.profiler",startTimestamp:r,attributes:{"ui.component_name":e}});i&&i.end(s)}}),[])}const fi=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,sa="/home/runner/work/sentry-javascript/sentry-javascript/packages/react/src/errorboundary.tsx";function IE(e){const t=e.match(/^([^.]+)/);return t!==null&&parseInt(t[0])>=17}const wE="unknown",ia={componentStack:null,error:null,eventId:null};function kE(e,t){const n=new WeakMap;function r(s,i){if(!n.has(s)){if(s.cause)return n.set(s,!0),r(s.cause,i);s.cause=i}}r(e,t)}class pi extends me.Component{constructor(t){super(t),pi.prototype.__init.call(this),this.state=ia,this._openFallbackReportDialog=!0;const n=A();n&&n.on&&t.showDialog&&(this._openFallbackReportDialog=!1,n.on("afterSendEvent",r=>{!r.type&&r.event_id===this._lastEventId&&lo({...t.dialogOptions,eventId:this._lastEventId})}))}componentDidCatch(t,{componentStack:n}){const{beforeCapture:r,onError:s,showDialog:i,dialogOptions:o}=this.props;lt(a=>{if(IE(me.version)&&Mt(t)){const u=new Error(t.message);u.name=`React ErrorBoundary ${t.name}`,u.stack=n,kE(t,u)}r&&r(a,t,n);const c=Sn(t,{captureContext:{contexts:{react:{componentStack:n}}},mechanism:{handled:!!this.props.fallback}});s&&s(t,n,c),i&&(this._lastEventId=c,this._openFallbackReportDialog&&lo({...o,eventId:c})),this.setState({error:t,componentStack:n,eventId:c})})}componentDidMount(){const{onMount:t}=this.props;t&&t()}componentWillUnmount(){const{error:t,componentStack:n,eventId:r}=this.state,{onUnmount:s}=this.props;s&&s(t,n,r)}__init(){this.resetErrorBoundary=()=>{const{onReset:t}=this.props,{error:n,componentStack:r,eventId:s}=this.state;t&&t(n,r,s),this.setState(ia)}}render(){const{fallback:t,children:n}=this.props,r=this.state;if(r.error){let s;return typeof t=="function"?s=t({error:r.error,componentStack:r.componentStack,resetError:this.resetErrorBoundary,eventId:r.eventId}):s=t,me.isValidElement(s)?s:(t&&fi&&h.warn("fallback did not produce a valid ReactElement"),null)}return typeof n=="function"?n():n}}function Ev(e,t){const n=e.displayName||e.name||wE,r=s=>me.createElement(pi,{...t,__self:this,__source:{fileName:sa,lineNumber:240}},me.createElement(e,{...s,__self:this,__source:{fileName:sa,lineNumber:241}}));return r.displayName=`errorBoundary(${n})`,br(r,e),r}const RE="redux.action",CE="info",xE={attachReduxState:!0,actionTransformer:e=>e,stateTransformer:e=>e||null};function vv(e){const t={...xE,...e};return n=>(r,s)=>(t.attachReduxState&&Vl().addEventProcessor((o,a)=>{try{o.type===void 0&&o.contexts.state.state.type==="redux"&&(a.attachments=[...a.attachments||[],{filename:"redux_state.json",data:JSON.stringify(o.contexts.state.state.value)}])}catch{}return o}),n((o,a)=>{const c=r(o,a),u=ae(),l=t.actionTransformer(a);typeof l<"u"&&l!==null&&u.addBreadcrumb({category:RE,data:l,type:CE});const d=t.stateTransformer(c);if(typeof d<"u"&&d!==null){const p=A(),m=p&&p.getOptions(),_=m&&m.normalizeDepth||3,S={state:{type:"redux",value:d}};it(S,"__sentry_override_normalization_depth__",3+_),u.setContext("state",S)}else u.setContext("state",null);const{configureScopeWithState:f}=t;return typeof f=="function"&&f(u,c),c},s))}function Tv(e){const t=Cr({...e,instrumentPageLoad:!1,instrumentNavigation:!1}),{history:n,routes:r,match:s,instrumentPageLoad:i=!0,instrumentNavigation:o=!0}=e;return{...t,afterAllSetup(a){t.afterAllSetup(a);const c=d=>{wn(a,d)},u=d=>{kn(a,d)},l=AE(n,r,s);l(c,i,!1),l(u,!1,o)}}}function AE(e,t,n){return(r,s=!0,i=!0)=>{let o,a;s&&E&&E.location&&oa(t,E.location,n,(c,u="url")=>{a=c,o=r({name:a,attributes:{[Ee]:"pageload",[he]:"auto.pageload.react.reactrouter_v3",[ee]:u}})}),i&&e.listen&&e.listen(c=>{(c.action==="PUSH"||c.action==="POP")&&(o&&o.end(),oa(t,c,n,(u,l="url")=>{a=u;const d={[Ee]:"navigation",[he]:"auto.navigation.react.reactrouter_v3",[ee]:l};o=r({name:a,attributes:d})}))})}}function oa(e,t,n,r){let s=t.pathname;n({location:t,routes:e},(i,o,a)=>{if(i||!a)return r(s);const c=ME(a.routes||[]);return c.length===0||c==="/*"?r(s):(s=c,r(s,"route"))})}function ME(e){if(!Array.isArray(e)||e.length===0)return"";const t=e.filter(r=>!!r.path);let n=-1;for(let r=t.length-1;r>=0;r--){const s=t[r];if(s.path&&s.path.startsWith("/")){n=r;break}}return t.slice(n).filter(({path:r})=>!!r).map(({path:r})=>r).join("")}const OE="/home/runner/work/sentry-javascript/sentry-javascript/packages/react/src/reactrouter.tsx";let xt;function Iv(e){const t=Cr({...e,instrumentPageLoad:!1,instrumentNavigation:!1}),{history:n,routes:r,matchPath:s,instrumentPageLoad:i=!0,instrumentNavigation:o=!0}=e;return{...t,afterAllSetup(a){t.afterAllSetup(a);const c=d=>{wn(a,d)},u=d=>{kn(a,d)},l=NE(n,r,s);l(c,i,!1),l(u,!1,o)}}}function wv(e){const t=Cr({...e,instrumentPageLoad:!1,instrumentNavigation:!1}),{history:n,routes:r,matchPath:s}=e;return{...t,afterAllSetup(i){t.afterAllSetup(i);const o=u=>{wn(i,u)},a=u=>{kn(i,u)},c=DE(n,r,s);c(o,e.instrumentPageLoad,!1),c(a,!1,e.instrumentNavigation)}}}function NE(e,t,n){return bl(e,"reactrouter_v4",t,n)}function DE(e,t,n){return bl(e,"reactrouter_v5",t,n)}function bl(e,t,n=[],r){function s(){if(e&&e.location)return e.location.pathname;if(E&&E.location)return E.location.pathname}function i(o){if(n.length===0||!r)return[o,"url"];const a=El(n,o,r);for(let c=0;c<a.length;c++)if(a[c].match.isExact)return[a[c].match.path,"route"];return[o,"url"]}return(o,a=!0,c=!0)=>{const u=s();if(a&&u){const[l,d]=i(u);xt=o({name:l,attributes:{[Ee]:"pageload",[he]:`auto.pageload.react.${t}`,[ee]:d}})}c&&e.listen&&e.listen((l,d)=>{if(d&&(d==="PUSH"||d==="POP")){xt&&xt.end();const[f,p]=i(l.pathname);xt=o({name:f,attributes:{[Ee]:"navigation",[he]:`auto.navigation.react.${t}`,[ee]:p}})}})}}function El(e,t,n,r=[]){return e.some(s=>{const i=s.path?n(t,s):r.length?r[r.length-1].match:LE(t);return i&&(r.push({route:s,match:i}),s.routes&&El(s.routes,t,n,r)),!!i}),r}function LE(e){return{path:"/",url:"/",params:{},isExact:e==="/"}}function kv(e){const t=e.displayName||e.name,n=r=>{if(r&&r.computedMatch&&r.computedMatch.isExact){const s=r.computedMatch.path,i=PE();i&&(i.updateName(s),i.setAttribute(ee,"route"))}return me.createElement(e,{...r,__self:this,__source:{fileName:OE,lineNumber:279}})};return n.displayName=`sentryRoute(${t})`,br(n,e),n}function PE(){if(xt)return xt;const e=Kt(),t=e?Jn(e):void 0;if(!t)return;const n=j(t).op;return n==="navigation"||n==="pageload"?t:void 0}const vl="/home/runner/work/sentry-javascript/sentry-javascript/packages/react/src/reactrouterv6.tsx";let Nt,nt,rt,st,dn,ut,qt,Fr,Je=!1;function Rv(e){const t=Cr({...e,instrumentPageLoad:!1,instrumentNavigation:!1}),{useEffect:n,useLocation:r,useNavigationType:s,createRoutesFromChildren:i,matchRoutes:o,stripBasename:a,instrumentPageLoad:c=!0,instrumentNavigation:u=!0}=e;return{...t,afterAllSetup(l){t.afterAllSetup(l);const d=p=>{kn(l,p)},f=E&&E.location&&E.location.pathname;c&&f&&wn(l,{name:f,attributes:{[ee]:"url",[Ee]:"pageload",[he]:"auto.pageload.react.reactrouter_v6"}}),nt=n,rt=r,st=s,ut=o,dn=i,Je=a||!1,qt=d,Fr=u}}}function Cv(e,t,n,r,s,i){return(o,a=!0,c=!0)=>{const u=E&&E.location&&E.location.pathname;a&&u&&(Nt=o({name:u,attributes:{[ee]:"url",[Ee]:"pageload",[he]:"auto.pageload.react.reactrouter_v6"}})),nt=e,rt=t,st=n,ut=s,dn=r,Je=i||!1,qt=o,Fr=c}}function ns(e,t){if(!t||t==="/"||!e.toLowerCase().startsWith(t.toLowerCase()))return e;const n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?e:e.slice(n)||"/"}function Tl(e,t,n,r=""){if(!e||e.length===0)return[Je?ns(t.pathname,r):t.pathname,"url"];let s="";if(n)for(let i=0;i<n.length;i++){const o=n[i],a=o.route;if(a){if(a.index)return[Je?ns(o.pathname,r):o.pathname,"route"];const c=a.path;if(c){const u=c[0]==="/"||s[s.length-1]==="/"?c:`/${c}`;if(s+=u,r+o.pathname===t.pathname)return Fi(s)!==Fi(o.pathname)&&s.slice(-2)!=="/*"?[(Je?"":r)+u,"route"]:[(Je?"":r)+s,"route"]}}}return[Je?ns(t.pathname,r):t.pathname,"url"]}function hi(e,t,n,r,s){const i=Array.isArray(r)?r:ut(n,t,s);if(e&&i){const[o,a]=Tl(n,t,i,s);e.updateName(o),e.setAttribute(ee,a)}}function mi(e,t,n,r,s){const i=Array.isArray(r)?r:ut(t,e,s);if(Fr&&(n==="PUSH"||n==="POP")&&i){Nt&&Nt.end();const[o,a]=Tl(t,e,i,s);Nt=qt({name:o,attributes:{[ee]:a,[Ee]:"navigation",[he]:"auto.navigation.react.reactrouter_v6"}})}}function xv(e){if(!nt||!rt||!st||!dn||!ut||!qt)return fi&&h.warn(`reactRouterV6Instrumentation was unable to wrap Routes because of one or more missing parameters.
359
359
  useEffect: ${nt}. useLocation: ${rt}. useNavigationType: ${st}.
360
360
  createRoutesFromChildren: ${dn}. matchRoutes: ${ut}. customStartTransaction: ${qt}.`),e;let t=!0;const n=r=>{const s=rt(),i=st();return nt(()=>{const o=dn(r.children);t?(hi(gi(),s,o),t=!1):mi(s,o,i)},[s,i]),me.createElement(e,{...r,__self:this,__source:{fileName:vl,lineNumber:329}})};return br(n,e),n}function Av(e){if(!nt||!rt||!st||!ut||!qt)return fi&&h.warn("reactRouterV6Instrumentation was unable to wrap `useRoutes` because of one or more missing parameters."),e;let t=!0;const n=r=>{const{routes:s,locationArg:i}=r,o=e(s,i),a=rt(),c=st(),u=typeof i=="string"||i&&i.pathname?i:a;return nt(()=>{const l=typeof u=="string"?{pathname:u}:u;t?(hi(gi(),l,s),t=!1):mi(l,s,c)},[c,u]),o};return(r,s)=>me.createElement(n,{routes:r,locationArg:s,__self:this,__source:{fileName:vl,lineNumber:386}})}function Mv(e){return function(t,n){const r=e(t,n),s=n&&n.basename,i=gi();return r.state.historyAction==="POP"&&i&&hi(i,r.state.location,t,void 0,s),r.subscribe(o=>{const a=o.location;Fr&&(o.historyAction==="PUSH"||o.historyAction==="POP")&&mi(a,t,o.historyAction,void 0,s)}),r}}function gi(){if(Nt)return Nt;const e=Kt(),t=e?Jn(e):void 0;if(!t)return;const n=j(t).op;return n==="navigation"||n==="pageload"?t:void 0}export{mm as Breadcrumbs,Hh as BrowserClient,gv as BrowserProfilingIntegration,rv as BrowserTracing,Im as Dedupe,pi as ErrorBoundary,Pr as Feedback,lp as FunctionToString,xm as GlobalHandlers,Pm as HttpContext,Dv as Hub,Qf as InboundFilters,_v as Integrations,Hm as LinkedErrors,tv as ModuleMetadata,Sl as Profiler,Dr as Replay,fv as ReplayCanvas,Ti as SDK_VERSION,Ee as SEMANTIC_ATTRIBUTE_SENTRY_OP,he as SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,Tt as SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,ee as SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,Lv as Scope,zm as TryCatch,E as WINDOW,je as addBreadcrumb,Tf as addEventProcessor,$l as addGlobalEventProcessor,ZE as addIntegration,za as addTracingExtensions,Dc as breadcrumbsIntegration,Vc as browserApiErrorsIntegration,EE as browserProfilingIntegration,Cr as browserTracingIntegration,pb as captureConsoleIntegration,Sr as captureEvent,Sn as captureException,is as captureMessage,ki as captureSession,uv as captureUserFeedback,em as chromeStackLineParser,Pv as close,Fv as configureScope,Yb as contextLinesIntegration,JE as continueTrace,vv as createReduxEnhancer,Qa as createTransport,$h as createUserFeedbackEnvelope,gb as debugIntegration,yb as dedupeIntegration,Ym as defaultIntegrations,ir as defaultRequestInstrumentationOptions,fm as defaultStackLineParsers,pm as defaultStackParser,$v as endSession,Dh as eventFromException,Lh as eventFromMessage,Mc as exceptionFromError,Tb as extraErrorDataIntegration,GE as extractTraceparentData,pv as feedbackIntegration,Bv as flush,ov as forceLoad,cc as functionToStringIntegration,sm as geckoStackLineParser,Kt as getActiveSpan,Oe as getActiveTransaction,A as getClient,Ie as getCurrentHub,ae as getCurrentScope,Vm as getDefaultIntegrations,Hv as getHubFromCarrier,dv as getReplay,Da as getSpanStatusFromHttpCode,Hc as globalHandlersIntegration,Db as httpClientIntegration,jc as httpContextIntegration,oc as inboundFiltersIntegration,yv as init,Cc as instrumentOutgoingRequests,Uv as isInitialized,Wv as lastEventId,Gc as linkedErrorsIntegration,hv as makeBrowserOfflineTransport,zh as makeFetchTransport,zv as makeMain,QE as makeMultiplexedTransport,qh as makeXHRTransport,nv as metrics,Kf as moduleMetadataIntegration,av as onLoad,mv as onProfilingStartRouteTransaction,sv as opera10StackLineParser,iv as opera11StackLineParser,ev as parameterize,Tv as reactRouterV3BrowserTracingIntegration,AE as reactRouterV3Instrumentation,Iv as reactRouterV4BrowserTracingIntegration,NE as reactRouterV4Instrumentation,wv as reactRouterV5BrowserTracingIntegration,DE as reactRouterV5Instrumentation,Rv as reactRouterV6BrowserTracingIntegration,Cv as reactRouterV6Instrumentation,DS as replayCanvasIntegration,lv as replayIntegration,Cb as reportingObserverIntegration,Ab as rewriteFramesIntegration,KS as sendFeedback,Ob as sessionTimingIntegration,ql as setContext,Mf as setCurrentClient,jv as setExtra,qv as setExtras,Ws as setHttpStatus,Xd as setMeasurement,Gv as setTag,Yv as setTags,Vv as setUser,lo as showReportDialog,YE as spanStatusfromHttpCode,kn as startBrowserTracingNavigationSpan,wn as startBrowserTracingPageLoadSpan,tt as startInactiveSpan,wi as startSession,KE as startSpan,XE as startSpanManual,Kv as startTransaction,VE as trace,bv as useProfiler,am as winjsStackLineParser,Ri as withActiveSpan,Ev as withErrorBoundary,Xv as withIsolationScope,Sv as withProfiler,lt as withScope,xv as withSentryReactRouterV6Routing,kv as withSentryRouting,cv as wrap,Mv as wrapCreateBrowserRouter,Av as wrapUseRoutes};
361
- //# sourceMappingURL=index.P5mz_7_c.js.map
361
+ //# sourceMappingURL=index.BI78I5tG.js.map