@powerhousedao/connect 2.5.0-dev.38 → 2.5.0-dev.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AddDriveModal.C2jFkqlM.js → AddDriveModal.ClyOmoNl.js} +2 -2
- package/dist/assets/{AddDriveModal.C2jFkqlM.js.map → AddDriveModal.ClyOmoNl.js.map} +1 -1
- package/dist/assets/{CreateDocumentModal.BN9jEB6s.js → CreateDocumentModal.C-dIIoAc.js} +2 -2
- package/dist/assets/{CreateDocumentModal.BN9jEB6s.js.map → CreateDocumentModal.C-dIIoAc.js.map} +1 -1
- package/dist/assets/{DebugSettingsModal.MHQV13SN.js → DebugSettingsModal.BmsXRyaa.js} +2 -2
- package/dist/assets/{DebugSettingsModal.MHQV13SN.js.map → DebugSettingsModal.BmsXRyaa.js.map} +1 -1
- package/dist/assets/{SettingsModal.dqb0rf3j.js → SettingsModal.tKRgQHY2.js} +2 -2
- package/dist/assets/{SettingsModal.dqb0rf3j.js.map → SettingsModal.tKRgQHY2.js.map} +1 -1
- package/dist/assets/{app.DrXBoFks.js → app.CpeFY5rY.js} +5 -5
- package/dist/assets/{app.DrXBoFks.js.map → app.CpeFY5rY.js.map} +1 -1
- package/dist/assets/{atlas-import.UpGo33xm.js → atlas-import.dgJlCu0x.js} +2 -2
- package/dist/assets/{atlas-import.UpGo33xm.js.map → atlas-import.dgJlCu0x.js.map} +1 -1
- package/dist/assets/{connect.config.Dr3jwnbD.js → connect.config.CsS69d7S.js} +2 -2
- package/dist/assets/{connect.config.Dr3jwnbD.js.map → connect.config.CsS69d7S.js.map} +1 -1
- package/dist/assets/{content.D9JrACxO.js → content.nsIWmaqg.js} +2 -2
- package/dist/assets/{content.D9JrACxO.js.map → content.nsIWmaqg.js.map} +1 -1
- package/dist/assets/{cookie-banner.DbJFAd1l.js → cookie-banner.CH-4WYW8.js} +2 -2
- package/dist/assets/{cookie-banner.DbJFAd1l.js.map → cookie-banner.CH-4WYW8.js.map} +1 -1
- package/dist/assets/{home.Dxy4GJJc.js → home.CXX5wh5C.js} +2 -2
- package/dist/assets/{home.Dxy4GJJc.js.map → home.CXX5wh5C.js.map} +1 -1
- package/dist/assets/{index.DjIeOyYc.js → index.85PJp-MP.js} +2 -2
- package/dist/assets/{index.DjIeOyYc.js.map → index.85PJp-MP.js.map} +1 -1
- package/dist/assets/{index.aw8Dkcoo.js → index.BA0NCObB.js} +2 -2
- package/dist/assets/{index.aw8Dkcoo.js.map → index.BA0NCObB.js.map} +1 -1
- package/dist/assets/{index.C_Opl5Jz.js → index.CmHc6x2H.js} +3 -3
- package/dist/assets/{index.C_Opl5Jz.js.map → index.CmHc6x2H.js.map} +1 -1
- package/dist/assets/{index.B-bl6CSh.js → index.bZV5kgeZ.js} +2 -2
- package/dist/assets/{index.B-bl6CSh.js.map → index.bZV5kgeZ.js.map} +1 -1
- package/dist/assets/{index.DQWvmcmc.js → index.uc3usMhB.js} +2 -2
- package/dist/assets/{index.DQWvmcmc.js.map → index.uc3usMhB.js.map} +1 -1
- package/dist/assets/{index.CrSJSfya.js → index.z0N70rjQ.js} +2 -2
- package/dist/assets/{index.CrSJSfya.js.map → index.z0N70rjQ.js.map} +1 -1
- package/dist/assets/{main.DmyTV79D.js → main.DbOsE3cz.js} +3 -3
- package/dist/assets/{main.DmyTV79D.js.map → main.DbOsE3cz.js.map} +1 -1
- package/dist/assets/{modal.DWe5ZuCx.js → modal.D6zdsVyJ.js} +3 -3
- package/dist/assets/{modal.DWe5ZuCx.js.map → modal.D6zdsVyJ.js.map} +1 -1
- package/dist/assets/{modals.DZa77UnD.js → modals.BzgOoo66.js} +2 -2
- package/dist/assets/{modals.DZa77UnD.js.map → modals.BzgOoo66.js.map} +1 -1
- package/dist/assets/nodefs.B9Vec_z3.js +2 -0
- package/dist/assets/{nodefs.Cjnx5dOq.js.map → nodefs.B9Vec_z3.js.map} +1 -1
- package/dist/assets/{opfs-ahp.vRbjblaS.js → opfs-ahp.C4v24Fhq.js} +2 -2
- package/dist/assets/{opfs-ahp.vRbjblaS.js.map → opfs-ahp.C4v24Fhq.js.map} +1 -1
- package/dist/assets/{registerServiceWorker.BsAY1XHb.js → registerServiceWorker.g4Vxzt7g.js} +2 -2
- package/dist/assets/{registerServiceWorker.BsAY1XHb.js.map → registerServiceWorker.g4Vxzt7g.js.map} +1 -1
- package/dist/assets/{root.CRH-5Gt-.js → root.fl2DxaIu.js} +2 -2
- package/dist/assets/{root.CRH-5Gt-.js.map → root.fl2DxaIu.js.map} +1 -1
- package/dist/assets/{useAcceptedCookies.BVqKxZSR.js → useAcceptedCookies.CrV6VEGC.js} +2 -2
- package/dist/assets/{useAcceptedCookies.BVqKxZSR.js.map → useAcceptedCookies.CrV6VEGC.js.map} +1 -1
- package/dist/assets/useConnectConfig.u8S3n32G.js +2 -0
- package/dist/assets/{useConnectConfig.Zn_MntZZ.js.map → useConnectConfig.u8S3n32G.js.map} +1 -1
- package/dist/assets/{useDefaultDocumentModelEditor.D11Q2Rj6.js → useDefaultDocumentModelEditor.C6jEKsTO.js} +2 -2
- package/dist/assets/{useDefaultDocumentModelEditor.D11Q2Rj6.js.map → useDefaultDocumentModelEditor.C6jEKsTO.js.map} +1 -1
- package/dist/assets/{useDocumentDriveServer.BixtbLpu.js → useDocumentDriveServer.CMrRrp49.js} +2 -2
- package/dist/assets/{useDocumentDriveServer.BixtbLpu.js.map → useDocumentDriveServer.CMrRrp49.js.map} +1 -1
- package/dist/assets/{useFeatureFlags.DJE4z8ME.js → useFeatureFlags.Bilmeti_.js} +2 -2
- package/dist/assets/{useFeatureFlags.DJE4z8ME.js.map → useFeatureFlags.Bilmeti_.js.map} +1 -1
- package/dist/assets/{user.CyjN9f72.js → user.BgiQzVBB.js} +3 -3
- package/dist/assets/{user.CyjN9f72.js.map → user.BgiQzVBB.js.map} +1 -1
- package/dist/index.html +1 -1
- package/dist/vite-envs.sh +1 -1
- package/nginx.conf +1 -1
- package/package.json +9 -9
- package/dist/assets/nodefs.Cjnx5dOq.js +0 -2
- package/dist/assets/useConnectConfig.Zn_MntZZ.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFeatureFlags.DJE4z8ME.js","sources":["../../src/store/utils.ts","../../../../node_modules/.pnpm/jotai-effect@1.1.6_jotai@2.12.4_@types+react@18.3.22_react@18.3.1_/node_modules/jotai-effect/dist/atomEffect.js","../../../../node_modules/.pnpm/jotai-effect@1.1.6_jotai@2.12.4_@types+react@18.3.22_react@18.3.1_/node_modules/jotai-effect/dist/observe.js","../../src/services/renown/constants.ts","../../src/store/document-model.ts","../../src/utils/reactor.ts","../../src/store/reactor.tsx","../../src/store/index.ts","../../src/hooks/useDocumentDrives.ts","../../src/hooks/useLogin.ts","../../src/hooks/useAllowList.ts","../../src/hooks/useUserPermissions.ts","../../src/hooks/useFeatureFlags/default-config.ts","../../src/hooks/useFeatureFlags/atom.ts","../../src/hooks/useFeatureFlags/useFeatureFlags.ts"],"sourcesContent":["import connectConfig from '#connect-config';\n\nimport { atomWithStorage as _atomWithStorage } from 'jotai/utils';\nimport type { SyncStorage } from 'jotai/vanilla/utils/atomWithStorage';\n\nconst namespace = connectConfig.routerBasename;\n\nexport const atomWithStorage = <T>(\n key: string,\n initialValue: T,\n storage?: SyncStorage<T>,\n options?: {\n getOnInit?: boolean;\n },\n) =>\n _atomWithStorage<T>(\n `${namespace}:${key}`,\n initialValue,\n storage ? storage : undefined,\n options,\n );\n\nexport const atomWithStorageCallback = <T>(\n key: string,\n initialValue: T,\n callback: (value: T) => void,\n) =>\n _atomWithStorage<T>(key, initialValue, {\n getItem(key, initialValue) {\n const value = localStorage.getItem(`${namespace}:${key}`);\n return value ? (JSON.parse(value) as T) : initialValue;\n },\n setItem(key, value) {\n localStorage.setItem(`${namespace}:${key}`, JSON.stringify(value));\n callback(value);\n },\n removeItem(key) {\n localStorage.removeItem(`${namespace}:${key}`);\n },\n subscribe(key, callback) {\n if (typeof window.addEventListener === 'undefined') {\n return () => null;\n }\n\n function listener(e: StorageEvent) {\n if (\n e.storageArea === localStorage &&\n e.key === `${namespace}:${key}`\n ) {\n callback((e.newValue ?? '') as T);\n }\n }\n window.addEventListener('storage', listener);\n\n return () => window.removeEventListener('storage', listener);\n },\n });\n","import { atom } from 'jotai/vanilla';\nexport function atomEffect(effect) {\n const refreshAtom = atom(0);\n const refAtom = atom(() => ({ i: 0 }), (get, set) => {\n const ref = get(refAtom);\n Object.assign(ref, { m: true, peek: get, set });\n set(refreshAtom, (c) => c + 1);\n return () => {\n ref.m = false;\n cleanup(ref);\n throwPendingError(ref);\n };\n });\n refAtom.onMount = (mount) => mount();\n const baseAtom = atom((get) => {\n get(refreshAtom);\n const ref = get(refAtom);\n if (!ref.m || ref.irc || (ref.i && !ref.irf)) {\n return ref.p;\n }\n throwPendingError(ref);\n const currDeps = new Map();\n const getter = (a) => {\n const value = get(a);\n currDeps.set(a, value);\n return value;\n };\n getter.peek = ref.peek;\n const setter = (...args) => {\n try {\n ++ref.i;\n return ref.set(...args);\n }\n finally {\n Array.from(currDeps.keys(), get);\n --ref.i;\n }\n };\n setter.recurse = (anAtom, ...args) => {\n if (ref.fc) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('set.recurse is not allowed in cleanup');\n }\n return undefined;\n }\n try {\n ref.irc = true;\n return ref.set(anAtom, ...args);\n }\n finally {\n ref.irc = false;\n const depsChanged = Array.from(currDeps).some(areDifferent);\n if (depsChanged) {\n refresh(ref);\n }\n }\n };\n function areDifferent([a, v]) {\n return get(a) !== v;\n }\n ++ref.i;\n function runEffect() {\n try {\n ref.irf = false;\n if (!ref.m)\n return;\n cleanup(ref);\n ref.c = effectAtom.effect(getter, setter);\n }\n catch (error) {\n ref.e = error;\n refresh(ref);\n }\n finally {\n ref.p = undefined;\n --ref.i;\n }\n }\n return ref.irf ? runEffect() : (ref.p = Promise.resolve().then(runEffect));\n });\n if (process.env.NODE_ENV !== 'production') {\n function setLabel(atom, label) {\n Object.defineProperty(atom, 'debugLabel', {\n get: () => `${effectAtom.debugLabel ?? 'effect'}:${label}`,\n });\n atom.debugPrivate = true;\n }\n setLabel(refreshAtom, 'refresh');\n setLabel(refAtom, 'ref');\n setLabel(baseAtom, 'base');\n }\n const effectAtom = atom((get) => void get(baseAtom));\n effectAtom.effect = effect;\n return effectAtom;\n function refresh(ref) {\n try {\n ref.irf = true;\n ref.set(refreshAtom, (c) => c + 1);\n }\n finally {\n ref.irf = false;\n }\n }\n function cleanup(ref) {\n if (typeof ref.c !== 'function')\n return;\n try {\n ref.fc = true;\n ref.c();\n }\n finally {\n ref.fc = false;\n ref.c = undefined;\n }\n }\n function throwPendingError(ref) {\n if ('e' in ref) {\n const error = ref.e;\n delete ref.e;\n throw error;\n }\n }\n}\n//# sourceMappingURL=atomEffect.js.map","import { getDefaultStore } from 'jotai/vanilla';\nimport { atomEffect } from './atomEffect.js';\nconst storeEffects = new WeakMap();\nexport function observe(effect, store = getDefaultStore()) {\n if (!storeEffects.has(store)) {\n storeEffects.set(store, new Map());\n }\n const effectSubscriptions = storeEffects.get(store);\n let unobserve = effectSubscriptions.get(effect);\n if (!unobserve) {\n const effectAtom = atomEffect(effect);\n let unsubscribe = store.sub(effectAtom, () => { });\n unobserve = () => {\n if (unsubscribe) {\n effectSubscriptions.delete(effect);\n if (effectSubscriptions.size === 0) {\n storeEffects.delete(store);\n }\n unsubscribe = void unsubscribe();\n }\n };\n effectSubscriptions.set(effect, unobserve);\n }\n return unobserve;\n}\n//# sourceMappingURL=observe.js.map","export const RENOWN_URL =\n import.meta.env.PH_CONNECT_RENOWN_URL || 'https://www.renown.id';\nexport const RENOWN_NETWORK_ID =\n import.meta.env.PH_CONNECT_RENOWN_NETWORK_ID || 'eip155';\nexport const RENOWN_CHAIN_ID =\n import.meta.env.PH_CONNECT_RENOWN_CHAIN_ID || '1';\n\nexport const DOMAIN_TYPE = [\n { name: 'name', type: 'string' },\n { name: 'version', type: 'string' },\n { name: 'chainId', type: 'uint256' },\n { name: 'verifyingContract', type: 'address' },\n] as const;\n\nexport const VERIFIABLE_CREDENTIAL_EIP712_TYPE = [\n { name: '@context', type: 'string[]' },\n { name: 'type', type: 'string[]' },\n { name: 'id', type: 'string' },\n { name: 'issuer', type: 'Issuer' },\n { name: 'credentialSubject', type: 'CredentialSubject' },\n { name: 'credentialSchema', type: 'CredentialSchema' },\n { name: 'issuanceDate', type: 'string' },\n { name: 'expirationDate', type: 'string' },\n] as const;\n\nexport const CREDENTIAL_SCHEMA_EIP712_TYPE = [\n { name: 'id', type: 'string' },\n { name: 'type', type: 'string' },\n] as const;\n\nexport const CREDENTIAL_SUBJECT_TYPE = [\n { name: 'app', type: 'string' },\n { name: 'id', type: 'string' },\n { name: 'name', type: 'string' },\n] as const;\n\nexport const ISSUER_TYPE = [\n { name: 'id', type: 'string' },\n { name: 'ethereumAddress', type: 'string' },\n] as const;\n\nexport const CREDENTIAL_TYPES = {\n EIP712Domain: DOMAIN_TYPE,\n VerifiableCredential: VERIFIABLE_CREDENTIAL_EIP712_TYPE,\n CredentialSchema: CREDENTIAL_SCHEMA_EIP712_TYPE,\n CredentialSubject: CREDENTIAL_SUBJECT_TYPE,\n Issuer: ISSUER_TYPE,\n} as const;\n","import { useFeatureFlag } from '#hooks';\nimport { driveDocumentModelModule } from 'document-drive';\nimport {\n documentModelDocumentModelModule,\n type DocumentModelLib,\n type DocumentModelModule,\n type PHDocument,\n} from 'document-model';\nimport { atom, useAtomValue } from 'jotai';\nimport { observe } from 'jotai-effect';\nimport { unwrap } from 'jotai/utils';\nimport { externalPackagesAtom } from './external-packages.js';\nimport { atomStore } from './index.js';\n\nexport const baseDocumentModels = [\n driveDocumentModelModule,\n documentModelDocumentModelModule,\n] as DocumentModelModule[];\n\n// removes document models with the same id, keeping the one that appears later\nfunction getUniqueDocumentModels(\n ...documentModels: DocumentModelModule[]\n): DocumentModelModule[] {\n const uniqueModels = new Map<string, DocumentModelModule>();\n\n for (const model of documentModels) {\n uniqueModels.set(model.documentModel.id, model);\n }\n\n return Array.from(uniqueModels.values());\n}\n\nfunction getDocumentModelsFromModules(modules: DocumentModelLib[]) {\n return modules\n .map(module => module.documentModels)\n .reduce((acc, val) => acc.concat(val), []);\n}\n\nexport const documentModelsAtom = atom(async get => {\n const externalModules = (await get(\n externalPackagesAtom,\n )) as DocumentModelLib[];\n const externalDocumentModels =\n getDocumentModelsFromModules(externalModules);\n\n const result = getUniqueDocumentModels(\n ...baseDocumentModels,\n ...externalDocumentModels,\n );\n return result;\n});\n\n// blocks rendering until document models are loaded.\nexport const useDocumentModels = () => useAtomValue(documentModelsAtom);\n\nconst unrappedDocumentModelsAtom = unwrap(documentModelsAtom);\n\n// will return undefined until document models are initialized. Does not block rendering.\nexport const useUnwrappedDocumentModelModules = () =>\n useAtomValue(unrappedDocumentModelsAtom);\n\nexport const subscribeDocumentModels = function (\n listener: (documentModels: DocumentModelModule[]) => void,\n) {\n // activate the effect on the default store\n const unobserve = observe(get => {\n const documentModels = get(documentModelsAtom);\n documentModels.then(listener).catch(e => {\n throw e;\n });\n }, atomStore);\n\n // Clean up the effect\n return () => unobserve();\n};\n\nfunction getDocumentModelModule<TDocument extends PHDocument>(\n documentType: string,\n documentModels: DocumentModelModule[] | undefined,\n) {\n return documentModels?.find(d => d.documentModel.id === documentType) as\n | DocumentModelModule<TDocument>\n | undefined;\n}\n\nexport function useDocumentModelModule<TDocument extends PHDocument>(\n documentType: string,\n) {\n const documentModelModules = useUnwrappedDocumentModelModules();\n return getDocumentModelModule<TDocument>(\n documentType,\n documentModelModules,\n );\n}\n\nexport const useGetDocumentModelModule = <TDocument extends PHDocument>() => {\n const documentModelModules = useUnwrappedDocumentModelModules();\n return (documentType: string) =>\n getDocumentModelModule<TDocument>(documentType, documentModelModules);\n};\n\n/**\n * Returns an array of filtered document models based on the enabled and disabled editors (feature flag).\n * If enabledEditors is set to '*', returns all document models.\n * If disabledEditors is set to '*', returns an empty array.\n * If disabledEditors is an array, filters out document models whose IDs are included in the disabledEditors array.\n * If enabledEditors is an array, filters document models whose IDs are included in the enabledEditors array.\n * @returns {Array<DocumentModel>} The filtered document models.\n */\nexport const useFilteredDocumentModels = () => {\n const documentModels = useUnwrappedDocumentModelModules();\n const { config } = useFeatureFlag();\n const { enabledEditors, disabledEditors } = config.editors;\n\n if (!documentModels) {\n return undefined;\n }\n\n const filteredDocumentModels = documentModels.filter(\n model => model.documentModel.id !== 'powerhouse/document-drive',\n );\n\n if (enabledEditors === '*') {\n return documentModels;\n }\n\n if (disabledEditors === '*') {\n return [];\n }\n\n if (disabledEditors) {\n return filteredDocumentModels.filter(\n d => !disabledEditors.includes(d.documentModel.id),\n );\n }\n\n if (enabledEditors) {\n return filteredDocumentModels.filter(d =>\n enabledEditors.includes(d.documentModel.id),\n );\n }\n\n return filteredDocumentModels;\n};\n","import {\n BaseQueueManager,\n type DefaultRemoteDriveInput,\n type DocumentDriveServerOptions,\n type IDocumentDriveServer,\n InMemoryCache,\n ReactorBuilder,\n} from 'document-drive';\nimport { BrowserStorage } from 'document-drive/storage/browser';\nimport {\n IDocumentAdminStorage,\n IDocumentOperationStorage,\n IDocumentStorage,\n IDriveOperationStorage,\n} from 'document-drive/storage/types';\nimport { type DocumentModelModule } from 'document-model';\n\nconst DEFAULT_DRIVES_URL =\n (import.meta.env.PH_CONNECT_DEFAULT_DRIVES_URL as string | undefined) ||\n undefined;\nconst defaultDrivesUrl = DEFAULT_DRIVES_URL\n ? DEFAULT_DRIVES_URL.split(',')\n : [];\n\nexport const getReactorDefaultDrivesConfig = (): Pick<\n DocumentDriveServerOptions,\n 'defaultDrives'\n> => {\n const remoteDrives: DefaultRemoteDriveInput[] = defaultDrivesUrl.map(\n driveUrl => ({\n url: driveUrl,\n options: {\n sharingType: 'PUBLIC',\n availableOffline: true,\n listeners: [\n {\n block: true,\n callInfo: {\n data: driveUrl,\n name: 'switchboard-push',\n transmitterType: 'SwitchboardPush',\n },\n filter: {\n branch: ['main'],\n documentId: ['*'],\n documentType: ['*'],\n scope: ['global'],\n },\n label: 'Switchboard Sync',\n listenerId: '1',\n system: true,\n },\n ],\n triggers: [],\n },\n }),\n );\n\n return {\n defaultDrives: {\n remoteDrives,\n removeOldRemoteDrives:\n defaultDrivesUrl.length > 0\n ? {\n strategy: 'preserve-by-url-and-detach',\n urls: defaultDrivesUrl,\n }\n : { strategy: 'preserve-all' },\n },\n };\n};\n\nexport function createBrowserStorage(\n routerBasename: string,\n): IDriveOperationStorage &\n IDocumentOperationStorage &\n IDocumentStorage &\n IDocumentAdminStorage {\n return new BrowserStorage(routerBasename);\n}\n\nexport function createBrowserDocumentDriveServer(\n documentModels: DocumentModelModule[],\n storage: IDriveOperationStorage,\n): IDocumentDriveServer {\n return new ReactorBuilder(documentModels)\n .withStorage(storage)\n .withCache(new InMemoryCache())\n .withQueueManager(new BaseQueueManager(1, 10))\n .withOptions({ ...getReactorDefaultDrivesConfig() })\n .build();\n}\n","import connectConfig from '#connect-config';\nimport { createBrowserDocumentDriveServer, createBrowserStorage } from '#utils';\nimport { type IDocumentDriveServer, logger } from 'document-drive';\nimport {\n type IDocumentAdminStorage,\n type IDocumentOperationStorage,\n type IDocumentStorage,\n type IDriveOperationStorage,\n} from 'document-drive/storage/types';\nimport { generateId } from 'document-model';\nimport { atom, useAtomValue } from 'jotai';\nimport { observe } from 'jotai-effect';\nimport { atomWithLazy, unwrap } from 'jotai/utils';\nimport { getConnectCrypto } from '../hooks/useConnectCrypto.js';\nimport { renownAtom, renownStatusAtom } from '../hooks/useRenown.js';\nimport {\n documentModelsAtom,\n subscribeDocumentModels,\n} from './document-model.js';\nimport { atomStore } from './index.js';\n\nasync function initReactor(reactor: IDocumentDriveServer) {\n await initJwtHandler(reactor);\n\n const errors = await reactor.initialize();\n const error = errors?.at(0);\n if (error) {\n throw error;\n }\n\n const drives = await reactor.getDrives();\n if (!drives.length && connectConfig.drives.sections.LOCAL.enabled) {\n return reactor\n .addDrive({\n id: generateId(),\n slug: 'my-local-drive',\n global: {\n name: 'My Local Drive',\n icon: null,\n },\n local: {\n availableOffline: false,\n sharingType: 'private',\n listeners: [],\n triggers: [],\n },\n })\n .catch(logger.error);\n }\n}\n\nasync function initJwtHandler(server: IDocumentDriveServer) {\n const renown = await atomStore.get(renownAtom);\n const user = await renown?.user();\n const crypto = await getConnectCrypto();\n\n if (user?.address) {\n server.setGenerateJwtHandler(async driveUrl => {\n return crypto.getBearerToken(driveUrl, user.address);\n });\n }\n}\n\n// Helper function to wait for renown to be initialized\nasync function waitForRenown(): Promise<void> {\n let unsubscribe: (() => void) | undefined;\n\n // Wait for renown status to be 'finished'\n return Promise.race([\n new Promise<void>((resolve, reject) => {\n unsubscribe = observe(get => {\n try {\n const status = get(renownStatusAtom);\n if (status === 'finished' || status === 'error') {\n resolve();\n }\n } catch (err) {\n // In case of any error during the observation, proceed with reactor initialization\n reject(\n new Error(\n `Error observing renown status: ${\n err instanceof Error\n ? err.message\n : 'Unknown error'\n }`,\n ),\n );\n }\n }, atomStore);\n return () => unsubscribe?.();\n }),\n new Promise<void>((_, reject) => {\n // Set a maximum timeout (5 seconds) to avoid blocking indefinitely\n setTimeout(() => {\n unsubscribe?.();\n reject(new Error('Timed out waiting for renown to initialize'));\n }, 5000);\n }),\n ]).catch((error: unknown) => {\n unsubscribe?.();\n logger.warn(error);\n });\n}\n\nasync function createReactor() {\n await waitForRenown();\n // get storage\n const storage = atomStore.get(storageAtom);\n\n // waits for document models to be loaded\n const documentModels = await atomStore.get(documentModelsAtom);\n const server =\n (window.electronAPI?.documentDrive as\n | IDocumentDriveServer\n | undefined) ??\n createBrowserDocumentDriveServer(documentModels, storage);\n await initReactor(server);\n return server;\n}\n\nexport const storageAtom = atom<\n IDriveOperationStorage &\n IDocumentOperationStorage &\n IDocumentStorage &\n IDocumentAdminStorage\n>(createBrowserStorage(connectConfig.routerBasename));\nexport const reactorAtom = atomWithLazy<Promise<IDocumentDriveServer>>(() =>\n createReactor(),\n);\nexport const unwrappedReactor = unwrap(reactorAtom);\n\n// blocks rendering until reactor is initialized.\nexport const useReactor = (): IDocumentDriveServer | undefined =>\n useAtomValue(reactorAtom);\n\nexport const useDocumentAdminStorage = (): IDocumentAdminStorage =>\n useAtomValue(storageAtom);\n\n// will return undefined until reactor is initialized. Does not block rendering.\nexport const useUnwrappedReactor = (): IDocumentDriveServer | undefined =>\n useAtomValue(unwrappedReactor);\n\n// will return undefined until reactor is initialized. Does not block rendering or trigger the reactor to be initialized.\nexport const useAsyncReactor = (): IDocumentDriveServer | undefined =>\n useAtomValue(reactorAsyncAtom);\n\nconst reactorAsyncAtom = atom<IDocumentDriveServer | undefined>(undefined);\nreactorAsyncAtom.onMount = setAtom => {\n subscribeReactor(setAtom);\n};\n\n// updates the reactor when the available document models change\nlet documentModelsSubscripion: (() => void) | undefined;\nreactorAtom.onMount = setAtom => {\n if (documentModelsSubscripion) return;\n setAtom(async prevReactor => {\n const reactor = await prevReactor;\n\n if (!documentModelsSubscripion) {\n documentModelsSubscripion = subscribeDocumentModels(\n documentModels => {\n reactor.setDocumentModelModules(documentModels);\n },\n );\n }\n return reactor;\n });\n};\n\nexport const subscribeReactor = function (\n listener: (reactor: IDocumentDriveServer) => void,\n) {\n // activate the effect on the default store\n const unobserve = observe(get => {\n const reactor = get(reactorAtom);\n reactor.then(listener).catch(e => {\n throw e;\n });\n }, atomStore);\n\n // Clean up the effect\n return () => unobserve();\n};\n","import { atom, createStore } from 'jotai';\nimport { themeAtom } from './theme.js';\n\nexport type Store = ReturnType<typeof createStore>;\n\nexport const atomStore: Store = createStore();\n\nexport const sidebarDisableHoverStyles = atom(false);\n\nexport const atoms = {\n themeAtom,\n};\n\nexport * from './document-drive.js';\nexport * from './document-model.js';\nexport * from './editor.js';\nexport * from './external-packages.js';\nexport * from './reactor.js';\nexport * from './theme.js';\nexport * from './user.js';\nexport * from './utils.js';\n\n","import { useUnwrappedReactor } from '#store';\nimport type { IDocumentDriveServer } from 'document-drive';\nimport { type DocumentDriveDocument, logger } from 'document-drive';\nimport { type OperationScope, type PHDocument } from 'document-model';\nimport { atom, useAtom } from 'jotai';\nimport { atomFamily } from 'jotai/utils';\nimport { useCallback, useMemo } from 'react';\nimport { type ClientErrorHandler } from './useClientErrorHandler.js';\n\n// map of DocumentDriveServer objects and their Document Drives\nconst documentDrivesAtom = atom(\n new Map<IDocumentDriveServer, DocumentDriveDocument[]>(),\n);\n\nexport function documentToHash(drive: PHDocument): string {\n return Object.keys(drive.operations)\n .map(\n key =>\n `${key}:${drive.operations[key as OperationScope].length}:${drive.operations[key as OperationScope].at(-1)?.hash}`,\n )\n .join(':');\n}\n\nexport function drivesToHash(drives: DocumentDriveDocument[]): string {\n return drives.map(documentToHash).join('&');\n}\n\n// creates a derived atom that encapsulates the Map of Document Drives\nconst readWriteDocumentDrivesAtom = (server?: IDocumentDriveServer) => () =>\n atom(\n get => (server ? (get(documentDrivesAtom).get(server) ?? []) : []),\n (_get, set, newDrives: DocumentDriveDocument[]) => {\n set(documentDrivesAtom, map => {\n if (!server) {\n return new Map();\n }\n const currentDrives = map.get(server) ?? [];\n if (\n currentDrives.length !== newDrives.length ||\n drivesToHash(currentDrives) !== drivesToHash(newDrives)\n ) {\n return new Map(map).set(server, newDrives);\n } else {\n return map;\n }\n });\n },\n );\n// keeps track of document drives that have been initialized\nexport type IDrivesState = 'INITIAL' | 'LOADING' | 'LOADED' | 'ERROR';\nexport const documentDrivesInitializedMapAtomFamily = atomFamily(() =>\n atom<IDrivesState>('INITIAL'),\n);\n\n// returns an array with the document drives of a\n// server and a method to fetch the document drives\nexport function useDocumentDrives() {\n const reactor = useUnwrappedReactor();\n const [documentDrives, setDocumentDrives] = useAtom(\n useMemo(readWriteDocumentDrivesAtom(reactor), [reactor]),\n );\n\n const refreshDocumentDrives = useCallback(async () => {\n if (!reactor) {\n return;\n }\n\n const documentDrives: DocumentDriveDocument[] = [];\n try {\n const driveIds = await reactor.getDrives();\n for (const id of driveIds) {\n try {\n const drive = await reactor.getDrive(id);\n documentDrives.push(drive);\n } catch (error) {\n logger.error(error);\n }\n }\n } catch (error) {\n logger.error(error);\n } finally {\n setDocumentDrives(documentDrives);\n }\n }, [reactor]);\n\n // if the server has not been initialized then\n // fetches the drives for the first time\n const [status, setStatus] = useAtom(\n documentDrivesInitializedMapAtomFamily(reactor),\n );\n\n if (status === 'INITIAL' && reactor) {\n setStatus('LOADING');\n refreshDocumentDrives()\n .then(() => setStatus('LOADED'))\n .catch(() => setStatus('ERROR'));\n }\n\n const serverSubscribeUpdates = useCallback(\n (clientErrorhandler: ClientErrorHandler) => {\n if (!reactor) {\n return;\n }\n const unsub1 = reactor.on(\n 'syncStatus',\n async (_event, _status, error) => {\n if (error) {\n logger.error(error);\n }\n await refreshDocumentDrives();\n },\n );\n const unsub2 = reactor.on('strandUpdate', () =>\n refreshDocumentDrives(),\n );\n const unsubOnSyncError = reactor.on(\n 'clientStrandsError',\n clientErrorhandler.strandsErrorHandler,\n );\n\n const unsub3 = reactor.on('defaultRemoteDrive', () =>\n refreshDocumentDrives(),\n );\n\n return () => {\n unsub1();\n unsub2();\n unsubOnSyncError();\n unsub3();\n };\n },\n [reactor, refreshDocumentDrives],\n );\n\n return useMemo(\n () =>\n [\n documentDrives,\n refreshDocumentDrives,\n serverSubscribeUpdates,\n status,\n ] as const,\n [documentDrives, status],\n );\n}\n","import { RENOWN_CHAIN_ID, RENOWN_NETWORK_ID, RENOWN_URL } from '#services';\nimport { atomStore, reactorAtom, useUser } from '#store';\nimport { logger } from 'document-drive';\nimport { atom, useAtom } from 'jotai';\nimport { useCallback, useEffect, useMemo } from 'react';\nimport { useConnectCrypto } from './useConnectCrypto.js';\nimport { useRenown } from './useRenown.js';\n\ntype LoginStatus = 'initial' | 'checking' | 'not-authorized' | 'authorized';\n\nconst loginStatusAtom = atom<LoginStatus>('initial');\n\nexport const useLogin = () => {\n const [status, setStatus] = useAtom(loginStatusAtom);\n const user = useUser();\n const renown = useRenown();\n const { did, getBearerToken } = useConnectCrypto();\n\n const openRenown = useCallback(async () => {\n const connectId = await did();\n const url = new URL(RENOWN_URL);\n url.searchParams.set('connect', connectId);\n url.searchParams.set('network', RENOWN_NETWORK_ID);\n url.searchParams.set('chain', RENOWN_CHAIN_ID);\n\n if (window.electronAPI) {\n const protocol = await window.electronAPI.protocol();\n url.searchParams.set('deeplink', protocol);\n await window.electronAPI.openURL(url.toString());\n } else {\n const returnUrl = new URL(\n window.location.pathname,\n window.location.origin,\n );\n url.searchParams.set('returnUrl', returnUrl.toJSON());\n window.open(url, '_self')?.focus();\n }\n }, [did]);\n\n const login = useCallback(\n async (userDid: string) => {\n if (!renown) {\n return;\n }\n try {\n setStatus('checking');\n const user = await renown.user();\n\n if (user?.did === userDid) {\n setStatus('authorized');\n return user;\n }\n const newUser = await renown.login(userDid);\n if (newUser) {\n setStatus('authorized');\n\n atomStore\n .get(reactorAtom)\n .then(reactor => {\n reactor.setGenerateJwtHandler(async driveUrl =>\n getBearerToken(driveUrl, newUser.address),\n );\n })\n .catch(err => console.error(err));\n\n return newUser;\n } else {\n setStatus('not-authorized');\n }\n } catch (error) {\n setStatus('not-authorized');\n logger.error(error);\n }\n },\n [renown],\n );\n\n useEffect(() => {\n if (user && status !== 'authorized') {\n setStatus('authorized');\n }\n }, [user, status]);\n\n const logout = useCallback(async () => {\n setStatus('initial');\n await renown?.logout();\n atomStore\n .get(reactorAtom)\n .then(reactor => {\n reactor.removeJwtHandler();\n })\n .catch(err => console.error(err));\n }, [renown]);\n\n return useMemo(\n () =>\n ({\n openRenown,\n user,\n status: user ? 'authorized' : status,\n login: renown ? login : undefined,\n logout,\n }) as const,\n [renown, openRenown, user, status, login, logout],\n );\n};\n","import { useLogin } from './useLogin.js';\n\ntype AllowListType = 'arbitrum' | 'rwa' | 'none';\nexport function useAllowList():\n | {\n isAllowed: boolean;\n allowListType: AllowListType;\n }\n | undefined {\n const { user, status } = useLogin();\n\n const arbitrumAllowListEnvString = import.meta.env\n .PH_CONNECT_ARBITRUM_ALLOW_LIST;\n const rwaAllowListEnvString = import.meta.env.PH_CONNECT_RWA_ALLOW_LIST;\n\n const arbitrumAllowListIsDefined =\n !!arbitrumAllowListEnvString && arbitrumAllowListEnvString !== '';\n const rwaAllowListIsDefined =\n !!rwaAllowListEnvString && rwaAllowListEnvString !== '';\n\n if (arbitrumAllowListIsDefined && rwaAllowListIsDefined) {\n throw new Error(\n 'Both Arbitrum and RWA allow lists are defined. Please only define one.',\n );\n }\n\n // if none of the lists are defined then allow all\n if (!arbitrumAllowListIsDefined && !rwaAllowListIsDefined) {\n return {\n isAllowed: true,\n allowListType: 'none',\n };\n }\n\n // if the user is not yet loaded then wait\n if (user === undefined) {\n return undefined;\n }\n\n if (arbitrumAllowListIsDefined) {\n const arbitrumAllowList = arbitrumAllowListEnvString.split(',');\n\n if (status !== 'authorized' || !user)\n return {\n isAllowed: false,\n allowListType: 'arbitrum',\n };\n\n const userAddressIsOnAllowList = arbitrumAllowList.includes(\n user.address,\n );\n\n if (userAddressIsOnAllowList)\n return {\n isAllowed: true,\n allowListType: 'arbitrum',\n };\n\n return {\n isAllowed: false,\n allowListType: 'arbitrum',\n };\n }\n\n if (rwaAllowListIsDefined) {\n const rwaAllowList = rwaAllowListEnvString.split(',');\n\n if (status !== 'authorized' || !user)\n return {\n isAllowed: false,\n allowListType: 'rwa',\n };\n\n const userAddressIsOnAllowList = rwaAllowList.includes(user.address);\n\n if (userAddressIsOnAllowList)\n return {\n isAllowed: true,\n allowListType: 'rwa',\n };\n\n return {\n isAllowed: false,\n allowListType: 'rwa',\n };\n }\n\n return {\n isAllowed: true,\n allowListType: 'none',\n };\n}\n","import { useAllowList } from './useAllowList.js';\n\nexport function useUserPermissions() {\n const allowList = useAllowList();\n\n if (!allowList) {\n return undefined;\n }\n\n const { allowListType, isAllowed } = allowList;\n\n if (allowListType === 'arbitrum') {\n return {\n isAllowedToCreateDocuments: isAllowed,\n isAllowedToEditDocuments: true,\n };\n }\n\n if (allowListType === 'rwa') {\n return {\n isAllowedToCreateDocuments: isAllowed,\n isAllowedToEditDocuments: isAllowed,\n };\n }\n\n return {\n isAllowedToCreateDocuments: true,\n isAllowedToEditDocuments: true,\n };\n}\n","export const FEATURE_FLAG_KEY_STORAGE = 'feature-flags-config';\n\nconst ENABLED_EDITORS = import.meta.env.PH_CONNECT_ENABLED_EDITORS || undefined;\nconst enabledEditors = ENABLED_EDITORS?.split(',');\n\nconst DISABLED_EDITORS =\n import.meta.env.PH_CONNECT_DISABLED_EDITORS || 'powerhouse/document-drive';\nconst disabledEditors = DISABLED_EDITORS?.split(',');\n\nexport interface FeatureFlag {\n editors: {\n enabledEditors?: '*' | string[];\n disabledEditors?: '*' | string[];\n };\n}\n\nconst defaultConfig: FeatureFlag = {\n editors: {\n enabledEditors: ENABLED_EDITORS === '*' ? '*' : enabledEditors,\n disabledEditors: DISABLED_EDITORS === '*' ? '*' : disabledEditors,\n },\n};\n\nexport default defaultConfig;\n","import { atomWithStorage } from '#store';\nimport defaultConfig, {\n FEATURE_FLAG_KEY_STORAGE,\n type FeatureFlag,\n} from './default-config.js';\n\nexport const featureFlagAtom = atomWithStorage<FeatureFlag>(\n FEATURE_FLAG_KEY_STORAGE,\n defaultConfig,\n);\n","import { useAtom } from 'jotai';\nimport { featureFlagAtom } from './atom.js';\nimport defaultConfig from './default-config.js';\n\nexport const useFeatureFlag = () => {\n const [config, setConfig] = useAtom(featureFlagAtom);\n\n return {\n config: {\n ...defaultConfig,\n ...config,\n },\n setConfig,\n };\n};\n"],"names":["namespace","connectConfig","atomWithStorage","key","initialValue","storage","options","_atomWithStorage","atomWithStorageCallback","callback","value","listener","e","atomEffect","effect","refreshAtom","atom","refAtom","get","set","ref","c","cleanup","throwPendingError","mount","baseAtom","currDeps","getter","a","setter","args","anAtom","areDifferent","refresh","v","runEffect","effectAtom","error","storeEffects","observe","store","getDefaultStore","effectSubscriptions","unobserve","unsubscribe","RENOWN_URL","RENOWN_NETWORK_ID","RENOWN_CHAIN_ID","baseDocumentModels","driveDocumentModelModule","documentModelDocumentModelModule","getUniqueDocumentModels","documentModels","uniqueModels","model","getDocumentModelsFromModules","modules","module","acc","val","documentModelsAtom","externalModules","externalPackagesAtom","externalDocumentModels","unrappedDocumentModelsAtom","unwrap","useUnwrappedDocumentModelModules","useAtomValue","subscribeDocumentModels","atomStore","getDocumentModelModule","documentType","d","useGetDocumentModelModule","documentModelModules","useFilteredDocumentModels","config","useFeatureFlag","enabledEditors","disabledEditors","filteredDocumentModels","DEFAULT_DRIVES_URL","defaultDrivesUrl","getReactorDefaultDrivesConfig","driveUrl","createBrowserStorage","routerBasename","BrowserStorage","createBrowserDocumentDriveServer","ReactorBuilder","InMemoryCache","BaseQueueManager","initReactor","reactor","initJwtHandler","errors","generateId","logger","server","renown","renownAtom","user","crypto","getConnectCrypto","waitForRenown","resolve","reject","status","renownStatusAtom","err","_","createReactor","storageAtom","_a","reactorAtom","atomWithLazy","unwrappedReactor","useDocumentAdminStorage","useUnwrappedReactor","useAsyncReactor","reactorAsyncAtom","setAtom","subscribeReactor","documentModelsSubscripion","prevReactor","createStore","documentDrivesAtom","documentToHash","drive","drivesToHash","drives","readWriteDocumentDrivesAtom","_get","newDrives","map","currentDrives","documentDrivesInitializedMapAtomFamily","atomFamily","useDocumentDrives","documentDrives","setDocumentDrives","useAtom","useMemo","refreshDocumentDrives","useCallback","driveIds","id","setStatus","serverSubscribeUpdates","clientErrorhandler","unsub1","_event","_status","unsub2","unsubOnSyncError","unsub3","loginStatusAtom","useLogin","useUser","useRenown","did","getBearerToken","useConnectCrypto","openRenown","connectId","url","protocol","returnUrl","login","userDid","newUser","useEffect","logout","useAllowList","arbitrumAllowListEnvString","rwaAllowListEnvString","arbitrumAllowListIsDefined","rwaAllowListIsDefined","arbitrumAllowList","rwaAllowList","useUserPermissions","allowList","allowListType","isAllowed","FEATURE_FLAG_KEY_STORAGE","ENABLED_EDITORS","DISABLED_EDITORS","defaultConfig","featureFlagAtom","setConfig"],"mappings":"+WAKA,MAAMA,EAAYC,EAAc,eAEnBC,GAAkB,CAC3BC,EACAC,EACA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BAA0B,EAC9B,CACJ,CC7BO,MAAMC,GAA2B,uBAElCC,EAAkB,+CAA8C,OAChE3G,GAAiB2G,GAAA,YAAAA,EAAiB,MAAM,KAExCC,EACF,OAA+C,YAAA,6BAAA,4BAC7C3G,GAAkB2G,GAAA,YAAAA,EAAkB,MAAM,KAS1CC,EAA6B,CAC/B,QAAS,CACL,eAAgBF,IAAoB,IAAM,IAAM3G,GAChD,gBAAiB4G,IAAqB,IAAM,IAAM3G,EAAA,CAE1D,ECfa6G,GAAkB1L,GAC3BsL,GACAG,CACJ,ECLa9G,GAAiB,IAAM,CAChC,KAAM,CAACD,EAAQiH,CAAS,EAAIhD,EAAQ+C,EAAe,EAE5C,MAAA,CACH,OAAQ,CACJ,GAAGD,EACH,GAAG/G,CACP,EACA,UAAAiH,CACJ,CACJ","x_google_ignoreList":[1,2]}
|
|
1
|
+
{"version":3,"file":"useFeatureFlags.Bilmeti_.js","sources":["../../src/store/utils.ts","../../../../node_modules/.pnpm/jotai-effect@1.1.6_jotai@2.12.4_@types+react@18.3.22_react@18.3.1_/node_modules/jotai-effect/dist/atomEffect.js","../../../../node_modules/.pnpm/jotai-effect@1.1.6_jotai@2.12.4_@types+react@18.3.22_react@18.3.1_/node_modules/jotai-effect/dist/observe.js","../../src/services/renown/constants.ts","../../src/store/document-model.ts","../../src/utils/reactor.ts","../../src/store/reactor.tsx","../../src/store/index.ts","../../src/hooks/useDocumentDrives.ts","../../src/hooks/useLogin.ts","../../src/hooks/useAllowList.ts","../../src/hooks/useUserPermissions.ts","../../src/hooks/useFeatureFlags/default-config.ts","../../src/hooks/useFeatureFlags/atom.ts","../../src/hooks/useFeatureFlags/useFeatureFlags.ts"],"sourcesContent":["import connectConfig from '#connect-config';\n\nimport { atomWithStorage as _atomWithStorage } from 'jotai/utils';\nimport type { SyncStorage } from 'jotai/vanilla/utils/atomWithStorage';\n\nconst namespace = connectConfig.routerBasename;\n\nexport const atomWithStorage = <T>(\n key: string,\n initialValue: T,\n storage?: SyncStorage<T>,\n options?: {\n getOnInit?: boolean;\n },\n) =>\n _atomWithStorage<T>(\n `${namespace}:${key}`,\n initialValue,\n storage ? storage : undefined,\n options,\n );\n\nexport const atomWithStorageCallback = <T>(\n key: string,\n initialValue: T,\n callback: (value: T) => void,\n) =>\n _atomWithStorage<T>(key, initialValue, {\n getItem(key, initialValue) {\n const value = localStorage.getItem(`${namespace}:${key}`);\n return value ? (JSON.parse(value) as T) : initialValue;\n },\n setItem(key, value) {\n localStorage.setItem(`${namespace}:${key}`, JSON.stringify(value));\n callback(value);\n },\n removeItem(key) {\n localStorage.removeItem(`${namespace}:${key}`);\n },\n subscribe(key, callback) {\n if (typeof window.addEventListener === 'undefined') {\n return () => null;\n }\n\n function listener(e: StorageEvent) {\n if (\n e.storageArea === localStorage &&\n e.key === `${namespace}:${key}`\n ) {\n callback((e.newValue ?? '') as T);\n }\n }\n window.addEventListener('storage', listener);\n\n return () => window.removeEventListener('storage', listener);\n },\n });\n","import { atom } from 'jotai/vanilla';\nexport function atomEffect(effect) {\n const refreshAtom = atom(0);\n const refAtom = atom(() => ({ i: 0 }), (get, set) => {\n const ref = get(refAtom);\n Object.assign(ref, { m: true, peek: get, set });\n set(refreshAtom, (c) => c + 1);\n return () => {\n ref.m = false;\n cleanup(ref);\n throwPendingError(ref);\n };\n });\n refAtom.onMount = (mount) => mount();\n const baseAtom = atom((get) => {\n get(refreshAtom);\n const ref = get(refAtom);\n if (!ref.m || ref.irc || (ref.i && !ref.irf)) {\n return ref.p;\n }\n throwPendingError(ref);\n const currDeps = new Map();\n const getter = (a) => {\n const value = get(a);\n currDeps.set(a, value);\n return value;\n };\n getter.peek = ref.peek;\n const setter = (...args) => {\n try {\n ++ref.i;\n return ref.set(...args);\n }\n finally {\n Array.from(currDeps.keys(), get);\n --ref.i;\n }\n };\n setter.recurse = (anAtom, ...args) => {\n if (ref.fc) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('set.recurse is not allowed in cleanup');\n }\n return undefined;\n }\n try {\n ref.irc = true;\n return ref.set(anAtom, ...args);\n }\n finally {\n ref.irc = false;\n const depsChanged = Array.from(currDeps).some(areDifferent);\n if (depsChanged) {\n refresh(ref);\n }\n }\n };\n function areDifferent([a, v]) {\n return get(a) !== v;\n }\n ++ref.i;\n function runEffect() {\n try {\n ref.irf = false;\n if (!ref.m)\n return;\n cleanup(ref);\n ref.c = effectAtom.effect(getter, setter);\n }\n catch (error) {\n ref.e = error;\n refresh(ref);\n }\n finally {\n ref.p = undefined;\n --ref.i;\n }\n }\n return ref.irf ? runEffect() : (ref.p = Promise.resolve().then(runEffect));\n });\n if (process.env.NODE_ENV !== 'production') {\n function setLabel(atom, label) {\n Object.defineProperty(atom, 'debugLabel', {\n get: () => `${effectAtom.debugLabel ?? 'effect'}:${label}`,\n });\n atom.debugPrivate = true;\n }\n setLabel(refreshAtom, 'refresh');\n setLabel(refAtom, 'ref');\n setLabel(baseAtom, 'base');\n }\n const effectAtom = atom((get) => void get(baseAtom));\n effectAtom.effect = effect;\n return effectAtom;\n function refresh(ref) {\n try {\n ref.irf = true;\n ref.set(refreshAtom, (c) => c + 1);\n }\n finally {\n ref.irf = false;\n }\n }\n function cleanup(ref) {\n if (typeof ref.c !== 'function')\n return;\n try {\n ref.fc = true;\n ref.c();\n }\n finally {\n ref.fc = false;\n ref.c = undefined;\n }\n }\n function throwPendingError(ref) {\n if ('e' in ref) {\n const error = ref.e;\n delete ref.e;\n throw error;\n }\n }\n}\n//# sourceMappingURL=atomEffect.js.map","import { getDefaultStore } from 'jotai/vanilla';\nimport { atomEffect } from './atomEffect.js';\nconst storeEffects = new WeakMap();\nexport function observe(effect, store = getDefaultStore()) {\n if (!storeEffects.has(store)) {\n storeEffects.set(store, new Map());\n }\n const effectSubscriptions = storeEffects.get(store);\n let unobserve = effectSubscriptions.get(effect);\n if (!unobserve) {\n const effectAtom = atomEffect(effect);\n let unsubscribe = store.sub(effectAtom, () => { });\n unobserve = () => {\n if (unsubscribe) {\n effectSubscriptions.delete(effect);\n if (effectSubscriptions.size === 0) {\n storeEffects.delete(store);\n }\n unsubscribe = void unsubscribe();\n }\n };\n effectSubscriptions.set(effect, unobserve);\n }\n return unobserve;\n}\n//# sourceMappingURL=observe.js.map","export const RENOWN_URL =\n import.meta.env.PH_CONNECT_RENOWN_URL || 'https://www.renown.id';\nexport const RENOWN_NETWORK_ID =\n import.meta.env.PH_CONNECT_RENOWN_NETWORK_ID || 'eip155';\nexport const RENOWN_CHAIN_ID =\n import.meta.env.PH_CONNECT_RENOWN_CHAIN_ID || '1';\n\nexport const DOMAIN_TYPE = [\n { name: 'name', type: 'string' },\n { name: 'version', type: 'string' },\n { name: 'chainId', type: 'uint256' },\n { name: 'verifyingContract', type: 'address' },\n] as const;\n\nexport const VERIFIABLE_CREDENTIAL_EIP712_TYPE = [\n { name: '@context', type: 'string[]' },\n { name: 'type', type: 'string[]' },\n { name: 'id', type: 'string' },\n { name: 'issuer', type: 'Issuer' },\n { name: 'credentialSubject', type: 'CredentialSubject' },\n { name: 'credentialSchema', type: 'CredentialSchema' },\n { name: 'issuanceDate', type: 'string' },\n { name: 'expirationDate', type: 'string' },\n] as const;\n\nexport const CREDENTIAL_SCHEMA_EIP712_TYPE = [\n { name: 'id', type: 'string' },\n { name: 'type', type: 'string' },\n] as const;\n\nexport const CREDENTIAL_SUBJECT_TYPE = [\n { name: 'app', type: 'string' },\n { name: 'id', type: 'string' },\n { name: 'name', type: 'string' },\n] as const;\n\nexport const ISSUER_TYPE = [\n { name: 'id', type: 'string' },\n { name: 'ethereumAddress', type: 'string' },\n] as const;\n\nexport const CREDENTIAL_TYPES = {\n EIP712Domain: DOMAIN_TYPE,\n VerifiableCredential: VERIFIABLE_CREDENTIAL_EIP712_TYPE,\n CredentialSchema: CREDENTIAL_SCHEMA_EIP712_TYPE,\n CredentialSubject: CREDENTIAL_SUBJECT_TYPE,\n Issuer: ISSUER_TYPE,\n} as const;\n","import { useFeatureFlag } from '#hooks';\nimport { driveDocumentModelModule } from 'document-drive';\nimport {\n documentModelDocumentModelModule,\n type DocumentModelLib,\n type DocumentModelModule,\n type PHDocument,\n} from 'document-model';\nimport { atom, useAtomValue } from 'jotai';\nimport { observe } from 'jotai-effect';\nimport { unwrap } from 'jotai/utils';\nimport { externalPackagesAtom } from './external-packages.js';\nimport { atomStore } from './index.js';\n\nexport const baseDocumentModels = [\n driveDocumentModelModule,\n documentModelDocumentModelModule,\n] as DocumentModelModule[];\n\n// removes document models with the same id, keeping the one that appears later\nfunction getUniqueDocumentModels(\n ...documentModels: DocumentModelModule[]\n): DocumentModelModule[] {\n const uniqueModels = new Map<string, DocumentModelModule>();\n\n for (const model of documentModels) {\n uniqueModels.set(model.documentModel.id, model);\n }\n\n return Array.from(uniqueModels.values());\n}\n\nfunction getDocumentModelsFromModules(modules: DocumentModelLib[]) {\n return modules\n .map(module => module.documentModels)\n .reduce((acc, val) => acc.concat(val), []);\n}\n\nexport const documentModelsAtom = atom(async get => {\n const externalModules = (await get(\n externalPackagesAtom,\n )) as DocumentModelLib[];\n const externalDocumentModels =\n getDocumentModelsFromModules(externalModules);\n\n const result = getUniqueDocumentModels(\n ...baseDocumentModels,\n ...externalDocumentModels,\n );\n return result;\n});\n\n// blocks rendering until document models are loaded.\nexport const useDocumentModels = () => useAtomValue(documentModelsAtom);\n\nconst unrappedDocumentModelsAtom = unwrap(documentModelsAtom);\n\n// will return undefined until document models are initialized. Does not block rendering.\nexport const useUnwrappedDocumentModelModules = () =>\n useAtomValue(unrappedDocumentModelsAtom);\n\nexport const subscribeDocumentModels = function (\n listener: (documentModels: DocumentModelModule[]) => void,\n) {\n // activate the effect on the default store\n const unobserve = observe(get => {\n const documentModels = get(documentModelsAtom);\n documentModels.then(listener).catch(e => {\n throw e;\n });\n }, atomStore);\n\n // Clean up the effect\n return () => unobserve();\n};\n\nfunction getDocumentModelModule<TDocument extends PHDocument>(\n documentType: string,\n documentModels: DocumentModelModule[] | undefined,\n) {\n return documentModels?.find(d => d.documentModel.id === documentType) as\n | DocumentModelModule<TDocument>\n | undefined;\n}\n\nexport function useDocumentModelModule<TDocument extends PHDocument>(\n documentType: string,\n) {\n const documentModelModules = useUnwrappedDocumentModelModules();\n return getDocumentModelModule<TDocument>(\n documentType,\n documentModelModules,\n );\n}\n\nexport const useGetDocumentModelModule = <TDocument extends PHDocument>() => {\n const documentModelModules = useUnwrappedDocumentModelModules();\n return (documentType: string) =>\n getDocumentModelModule<TDocument>(documentType, documentModelModules);\n};\n\n/**\n * Returns an array of filtered document models based on the enabled and disabled editors (feature flag).\n * If enabledEditors is set to '*', returns all document models.\n * If disabledEditors is set to '*', returns an empty array.\n * If disabledEditors is an array, filters out document models whose IDs are included in the disabledEditors array.\n * If enabledEditors is an array, filters document models whose IDs are included in the enabledEditors array.\n * @returns {Array<DocumentModel>} The filtered document models.\n */\nexport const useFilteredDocumentModels = () => {\n const documentModels = useUnwrappedDocumentModelModules();\n const { config } = useFeatureFlag();\n const { enabledEditors, disabledEditors } = config.editors;\n\n if (!documentModels) {\n return undefined;\n }\n\n const filteredDocumentModels = documentModels.filter(\n model => model.documentModel.id !== 'powerhouse/document-drive',\n );\n\n if (enabledEditors === '*') {\n return documentModels;\n }\n\n if (disabledEditors === '*') {\n return [];\n }\n\n if (disabledEditors) {\n return filteredDocumentModels.filter(\n d => !disabledEditors.includes(d.documentModel.id),\n );\n }\n\n if (enabledEditors) {\n return filteredDocumentModels.filter(d =>\n enabledEditors.includes(d.documentModel.id),\n );\n }\n\n return filteredDocumentModels;\n};\n","import {\n BaseQueueManager,\n type DefaultRemoteDriveInput,\n type DocumentDriveServerOptions,\n type IDocumentDriveServer,\n InMemoryCache,\n ReactorBuilder,\n} from 'document-drive';\nimport { BrowserStorage } from 'document-drive/storage/browser';\nimport {\n IDocumentAdminStorage,\n IDocumentOperationStorage,\n IDocumentStorage,\n IDriveOperationStorage,\n} from 'document-drive/storage/types';\nimport { type DocumentModelModule } from 'document-model';\n\nconst DEFAULT_DRIVES_URL =\n (import.meta.env.PH_CONNECT_DEFAULT_DRIVES_URL as string | undefined) ||\n undefined;\nconst defaultDrivesUrl = DEFAULT_DRIVES_URL\n ? DEFAULT_DRIVES_URL.split(',')\n : [];\n\nexport const getReactorDefaultDrivesConfig = (): Pick<\n DocumentDriveServerOptions,\n 'defaultDrives'\n> => {\n const remoteDrives: DefaultRemoteDriveInput[] = defaultDrivesUrl.map(\n driveUrl => ({\n url: driveUrl,\n options: {\n sharingType: 'PUBLIC',\n availableOffline: true,\n listeners: [\n {\n block: true,\n callInfo: {\n data: driveUrl,\n name: 'switchboard-push',\n transmitterType: 'SwitchboardPush',\n },\n filter: {\n branch: ['main'],\n documentId: ['*'],\n documentType: ['*'],\n scope: ['global'],\n },\n label: 'Switchboard Sync',\n listenerId: '1',\n system: true,\n },\n ],\n triggers: [],\n },\n }),\n );\n\n return {\n defaultDrives: {\n remoteDrives,\n removeOldRemoteDrives:\n defaultDrivesUrl.length > 0\n ? {\n strategy: 'preserve-by-url-and-detach',\n urls: defaultDrivesUrl,\n }\n : { strategy: 'preserve-all' },\n },\n };\n};\n\nexport function createBrowserStorage(\n routerBasename: string,\n): IDriveOperationStorage &\n IDocumentOperationStorage &\n IDocumentStorage &\n IDocumentAdminStorage {\n return new BrowserStorage(routerBasename);\n}\n\nexport function createBrowserDocumentDriveServer(\n documentModels: DocumentModelModule[],\n storage: IDriveOperationStorage,\n): IDocumentDriveServer {\n return new ReactorBuilder(documentModels)\n .withStorage(storage)\n .withCache(new InMemoryCache())\n .withQueueManager(new BaseQueueManager(1, 10))\n .withOptions({ ...getReactorDefaultDrivesConfig() })\n .build();\n}\n","import connectConfig from '#connect-config';\nimport { createBrowserDocumentDriveServer, createBrowserStorage } from '#utils';\nimport { type IDocumentDriveServer, logger } from 'document-drive';\nimport {\n type IDocumentAdminStorage,\n type IDocumentOperationStorage,\n type IDocumentStorage,\n type IDriveOperationStorage,\n} from 'document-drive/storage/types';\nimport { generateId } from 'document-model';\nimport { atom, useAtomValue } from 'jotai';\nimport { observe } from 'jotai-effect';\nimport { atomWithLazy, unwrap } from 'jotai/utils';\nimport { getConnectCrypto } from '../hooks/useConnectCrypto.js';\nimport { renownAtom, renownStatusAtom } from '../hooks/useRenown.js';\nimport {\n documentModelsAtom,\n subscribeDocumentModels,\n} from './document-model.js';\nimport { atomStore } from './index.js';\n\nasync function initReactor(reactor: IDocumentDriveServer) {\n await initJwtHandler(reactor);\n\n const errors = await reactor.initialize();\n const error = errors?.at(0);\n if (error) {\n throw error;\n }\n\n const drives = await reactor.getDrives();\n if (!drives.length && connectConfig.drives.sections.LOCAL.enabled) {\n return reactor\n .addDrive({\n id: generateId(),\n slug: 'my-local-drive',\n global: {\n name: 'My Local Drive',\n icon: null,\n },\n local: {\n availableOffline: false,\n sharingType: 'private',\n listeners: [],\n triggers: [],\n },\n })\n .catch(logger.error);\n }\n}\n\nasync function initJwtHandler(server: IDocumentDriveServer) {\n const renown = await atomStore.get(renownAtom);\n const user = await renown?.user();\n const crypto = await getConnectCrypto();\n\n if (user?.address) {\n server.setGenerateJwtHandler(async driveUrl => {\n return crypto.getBearerToken(driveUrl, user.address);\n });\n }\n}\n\n// Helper function to wait for renown to be initialized\nasync function waitForRenown(): Promise<void> {\n let unsubscribe: (() => void) | undefined;\n\n // Wait for renown status to be 'finished'\n return Promise.race([\n new Promise<void>((resolve, reject) => {\n unsubscribe = observe(get => {\n try {\n const status = get(renownStatusAtom);\n if (status === 'finished' || status === 'error') {\n resolve();\n }\n } catch (err) {\n // In case of any error during the observation, proceed with reactor initialization\n reject(\n new Error(\n `Error observing renown status: ${\n err instanceof Error\n ? err.message\n : 'Unknown error'\n }`,\n ),\n );\n }\n }, atomStore);\n return () => unsubscribe?.();\n }),\n new Promise<void>((_, reject) => {\n // Set a maximum timeout (5 seconds) to avoid blocking indefinitely\n setTimeout(() => {\n unsubscribe?.();\n reject(new Error('Timed out waiting for renown to initialize'));\n }, 5000);\n }),\n ]).catch((error: unknown) => {\n unsubscribe?.();\n logger.warn(error);\n });\n}\n\nasync function createReactor() {\n await waitForRenown();\n // get storage\n const storage = atomStore.get(storageAtom);\n\n // waits for document models to be loaded\n const documentModels = await atomStore.get(documentModelsAtom);\n const server =\n (window.electronAPI?.documentDrive as\n | IDocumentDriveServer\n | undefined) ??\n createBrowserDocumentDriveServer(documentModels, storage);\n await initReactor(server);\n return server;\n}\n\nexport const storageAtom = atom<\n IDriveOperationStorage &\n IDocumentOperationStorage &\n IDocumentStorage &\n IDocumentAdminStorage\n>(createBrowserStorage(connectConfig.routerBasename));\nexport const reactorAtom = atomWithLazy<Promise<IDocumentDriveServer>>(() =>\n createReactor(),\n);\nexport const unwrappedReactor = unwrap(reactorAtom);\n\n// blocks rendering until reactor is initialized.\nexport const useReactor = (): IDocumentDriveServer | undefined =>\n useAtomValue(reactorAtom);\n\nexport const useDocumentAdminStorage = (): IDocumentAdminStorage =>\n useAtomValue(storageAtom);\n\n// will return undefined until reactor is initialized. Does not block rendering.\nexport const useUnwrappedReactor = (): IDocumentDriveServer | undefined =>\n useAtomValue(unwrappedReactor);\n\n// will return undefined until reactor is initialized. Does not block rendering or trigger the reactor to be initialized.\nexport const useAsyncReactor = (): IDocumentDriveServer | undefined =>\n useAtomValue(reactorAsyncAtom);\n\nconst reactorAsyncAtom = atom<IDocumentDriveServer | undefined>(undefined);\nreactorAsyncAtom.onMount = setAtom => {\n subscribeReactor(setAtom);\n};\n\n// updates the reactor when the available document models change\nlet documentModelsSubscripion: (() => void) | undefined;\nreactorAtom.onMount = setAtom => {\n if (documentModelsSubscripion) return;\n setAtom(async prevReactor => {\n const reactor = await prevReactor;\n\n if (!documentModelsSubscripion) {\n documentModelsSubscripion = subscribeDocumentModels(\n documentModels => {\n reactor.setDocumentModelModules(documentModels);\n },\n );\n }\n return reactor;\n });\n};\n\nexport const subscribeReactor = function (\n listener: (reactor: IDocumentDriveServer) => void,\n) {\n // activate the effect on the default store\n const unobserve = observe(get => {\n const reactor = get(reactorAtom);\n reactor.then(listener).catch(e => {\n throw e;\n });\n }, atomStore);\n\n // Clean up the effect\n return () => unobserve();\n};\n","import { atom, createStore } from 'jotai';\nimport { themeAtom } from './theme.js';\n\nexport type Store = ReturnType<typeof createStore>;\n\nexport const atomStore: Store = createStore();\n\nexport const sidebarDisableHoverStyles = atom(false);\n\nexport const atoms = {\n themeAtom,\n};\n\nexport * from './document-drive.js';\nexport * from './document-model.js';\nexport * from './editor.js';\nexport * from './external-packages.js';\nexport * from './reactor.js';\nexport * from './theme.js';\nexport * from './user.js';\nexport * from './utils.js';\n\n","import { useUnwrappedReactor } from '#store';\nimport type { IDocumentDriveServer } from 'document-drive';\nimport { type DocumentDriveDocument, logger } from 'document-drive';\nimport { type OperationScope, type PHDocument } from 'document-model';\nimport { atom, useAtom } from 'jotai';\nimport { atomFamily } from 'jotai/utils';\nimport { useCallback, useMemo } from 'react';\nimport { type ClientErrorHandler } from './useClientErrorHandler.js';\n\n// map of DocumentDriveServer objects and their Document Drives\nconst documentDrivesAtom = atom(\n new Map<IDocumentDriveServer, DocumentDriveDocument[]>(),\n);\n\nexport function documentToHash(drive: PHDocument): string {\n return Object.keys(drive.operations)\n .map(\n key =>\n `${key}:${drive.operations[key as OperationScope].length}:${drive.operations[key as OperationScope].at(-1)?.hash}`,\n )\n .join(':');\n}\n\nexport function drivesToHash(drives: DocumentDriveDocument[]): string {\n return drives.map(documentToHash).join('&');\n}\n\n// creates a derived atom that encapsulates the Map of Document Drives\nconst readWriteDocumentDrivesAtom = (server?: IDocumentDriveServer) => () =>\n atom(\n get => (server ? (get(documentDrivesAtom).get(server) ?? []) : []),\n (_get, set, newDrives: DocumentDriveDocument[]) => {\n set(documentDrivesAtom, map => {\n if (!server) {\n return new Map();\n }\n const currentDrives = map.get(server) ?? [];\n if (\n currentDrives.length !== newDrives.length ||\n drivesToHash(currentDrives) !== drivesToHash(newDrives)\n ) {\n return new Map(map).set(server, newDrives);\n } else {\n return map;\n }\n });\n },\n );\n// keeps track of document drives that have been initialized\nexport type IDrivesState = 'INITIAL' | 'LOADING' | 'LOADED' | 'ERROR';\nexport const documentDrivesInitializedMapAtomFamily = atomFamily(() =>\n atom<IDrivesState>('INITIAL'),\n);\n\n// returns an array with the document drives of a\n// server and a method to fetch the document drives\nexport function useDocumentDrives() {\n const reactor = useUnwrappedReactor();\n const [documentDrives, setDocumentDrives] = useAtom(\n useMemo(readWriteDocumentDrivesAtom(reactor), [reactor]),\n );\n\n const refreshDocumentDrives = useCallback(async () => {\n if (!reactor) {\n return;\n }\n\n const documentDrives: DocumentDriveDocument[] = [];\n try {\n const driveIds = await reactor.getDrives();\n for (const id of driveIds) {\n try {\n const drive = await reactor.getDrive(id);\n documentDrives.push(drive);\n } catch (error) {\n logger.error(error);\n }\n }\n } catch (error) {\n logger.error(error);\n } finally {\n setDocumentDrives(documentDrives);\n }\n }, [reactor]);\n\n // if the server has not been initialized then\n // fetches the drives for the first time\n const [status, setStatus] = useAtom(\n documentDrivesInitializedMapAtomFamily(reactor),\n );\n\n if (status === 'INITIAL' && reactor) {\n setStatus('LOADING');\n refreshDocumentDrives()\n .then(() => setStatus('LOADED'))\n .catch(() => setStatus('ERROR'));\n }\n\n const serverSubscribeUpdates = useCallback(\n (clientErrorhandler: ClientErrorHandler) => {\n if (!reactor) {\n return;\n }\n const unsub1 = reactor.on(\n 'syncStatus',\n async (_event, _status, error) => {\n if (error) {\n logger.error(error);\n }\n await refreshDocumentDrives();\n },\n );\n const unsub2 = reactor.on('strandUpdate', () =>\n refreshDocumentDrives(),\n );\n const unsubOnSyncError = reactor.on(\n 'clientStrandsError',\n clientErrorhandler.strandsErrorHandler,\n );\n\n const unsub3 = reactor.on('defaultRemoteDrive', () =>\n refreshDocumentDrives(),\n );\n\n return () => {\n unsub1();\n unsub2();\n unsubOnSyncError();\n unsub3();\n };\n },\n [reactor, refreshDocumentDrives],\n );\n\n return useMemo(\n () =>\n [\n documentDrives,\n refreshDocumentDrives,\n serverSubscribeUpdates,\n status,\n ] as const,\n [documentDrives, status],\n );\n}\n","import { RENOWN_CHAIN_ID, RENOWN_NETWORK_ID, RENOWN_URL } from '#services';\nimport { atomStore, reactorAtom, useUser } from '#store';\nimport { logger } from 'document-drive';\nimport { atom, useAtom } from 'jotai';\nimport { useCallback, useEffect, useMemo } from 'react';\nimport { useConnectCrypto } from './useConnectCrypto.js';\nimport { useRenown } from './useRenown.js';\n\ntype LoginStatus = 'initial' | 'checking' | 'not-authorized' | 'authorized';\n\nconst loginStatusAtom = atom<LoginStatus>('initial');\n\nexport const useLogin = () => {\n const [status, setStatus] = useAtom(loginStatusAtom);\n const user = useUser();\n const renown = useRenown();\n const { did, getBearerToken } = useConnectCrypto();\n\n const openRenown = useCallback(async () => {\n const connectId = await did();\n const url = new URL(RENOWN_URL);\n url.searchParams.set('connect', connectId);\n url.searchParams.set('network', RENOWN_NETWORK_ID);\n url.searchParams.set('chain', RENOWN_CHAIN_ID);\n\n if (window.electronAPI) {\n const protocol = await window.electronAPI.protocol();\n url.searchParams.set('deeplink', protocol);\n await window.electronAPI.openURL(url.toString());\n } else {\n const returnUrl = new URL(\n window.location.pathname,\n window.location.origin,\n );\n url.searchParams.set('returnUrl', returnUrl.toJSON());\n window.open(url, '_self')?.focus();\n }\n }, [did]);\n\n const login = useCallback(\n async (userDid: string) => {\n if (!renown) {\n return;\n }\n try {\n setStatus('checking');\n const user = await renown.user();\n\n if (user?.did === userDid) {\n setStatus('authorized');\n return user;\n }\n const newUser = await renown.login(userDid);\n if (newUser) {\n setStatus('authorized');\n\n atomStore\n .get(reactorAtom)\n .then(reactor => {\n reactor.setGenerateJwtHandler(async driveUrl =>\n getBearerToken(driveUrl, newUser.address),\n );\n })\n .catch(err => console.error(err));\n\n return newUser;\n } else {\n setStatus('not-authorized');\n }\n } catch (error) {\n setStatus('not-authorized');\n logger.error(error);\n }\n },\n [renown],\n );\n\n useEffect(() => {\n if (user && status !== 'authorized') {\n setStatus('authorized');\n }\n }, [user, status]);\n\n const logout = useCallback(async () => {\n setStatus('initial');\n await renown?.logout();\n atomStore\n .get(reactorAtom)\n .then(reactor => {\n reactor.removeJwtHandler();\n })\n .catch(err => console.error(err));\n }, [renown]);\n\n return useMemo(\n () =>\n ({\n openRenown,\n user,\n status: user ? 'authorized' : status,\n login: renown ? login : undefined,\n logout,\n }) as const,\n [renown, openRenown, user, status, login, logout],\n );\n};\n","import { useLogin } from './useLogin.js';\n\ntype AllowListType = 'arbitrum' | 'rwa' | 'none';\nexport function useAllowList():\n | {\n isAllowed: boolean;\n allowListType: AllowListType;\n }\n | undefined {\n const { user, status } = useLogin();\n\n const arbitrumAllowListEnvString = import.meta.env\n .PH_CONNECT_ARBITRUM_ALLOW_LIST;\n const rwaAllowListEnvString = import.meta.env.PH_CONNECT_RWA_ALLOW_LIST;\n\n const arbitrumAllowListIsDefined =\n !!arbitrumAllowListEnvString && arbitrumAllowListEnvString !== '';\n const rwaAllowListIsDefined =\n !!rwaAllowListEnvString && rwaAllowListEnvString !== '';\n\n if (arbitrumAllowListIsDefined && rwaAllowListIsDefined) {\n throw new Error(\n 'Both Arbitrum and RWA allow lists are defined. Please only define one.',\n );\n }\n\n // if none of the lists are defined then allow all\n if (!arbitrumAllowListIsDefined && !rwaAllowListIsDefined) {\n return {\n isAllowed: true,\n allowListType: 'none',\n };\n }\n\n // if the user is not yet loaded then wait\n if (user === undefined) {\n return undefined;\n }\n\n if (arbitrumAllowListIsDefined) {\n const arbitrumAllowList = arbitrumAllowListEnvString.split(',');\n\n if (status !== 'authorized' || !user)\n return {\n isAllowed: false,\n allowListType: 'arbitrum',\n };\n\n const userAddressIsOnAllowList = arbitrumAllowList.includes(\n user.address,\n );\n\n if (userAddressIsOnAllowList)\n return {\n isAllowed: true,\n allowListType: 'arbitrum',\n };\n\n return {\n isAllowed: false,\n allowListType: 'arbitrum',\n };\n }\n\n if (rwaAllowListIsDefined) {\n const rwaAllowList = rwaAllowListEnvString.split(',');\n\n if (status !== 'authorized' || !user)\n return {\n isAllowed: false,\n allowListType: 'rwa',\n };\n\n const userAddressIsOnAllowList = rwaAllowList.includes(user.address);\n\n if (userAddressIsOnAllowList)\n return {\n isAllowed: true,\n allowListType: 'rwa',\n };\n\n return {\n isAllowed: false,\n allowListType: 'rwa',\n };\n }\n\n return {\n isAllowed: true,\n allowListType: 'none',\n };\n}\n","import { useAllowList } from './useAllowList.js';\n\nexport function useUserPermissions() {\n const allowList = useAllowList();\n\n if (!allowList) {\n return undefined;\n }\n\n const { allowListType, isAllowed } = allowList;\n\n if (allowListType === 'arbitrum') {\n return {\n isAllowedToCreateDocuments: isAllowed,\n isAllowedToEditDocuments: true,\n };\n }\n\n if (allowListType === 'rwa') {\n return {\n isAllowedToCreateDocuments: isAllowed,\n isAllowedToEditDocuments: isAllowed,\n };\n }\n\n return {\n isAllowedToCreateDocuments: true,\n isAllowedToEditDocuments: true,\n };\n}\n","export const FEATURE_FLAG_KEY_STORAGE = 'feature-flags-config';\n\nconst ENABLED_EDITORS = import.meta.env.PH_CONNECT_ENABLED_EDITORS || undefined;\nconst enabledEditors = ENABLED_EDITORS?.split(',');\n\nconst DISABLED_EDITORS =\n import.meta.env.PH_CONNECT_DISABLED_EDITORS || 'powerhouse/document-drive';\nconst disabledEditors = DISABLED_EDITORS?.split(',');\n\nexport interface FeatureFlag {\n editors: {\n enabledEditors?: '*' | string[];\n disabledEditors?: '*' | string[];\n };\n}\n\nconst defaultConfig: FeatureFlag = {\n editors: {\n enabledEditors: ENABLED_EDITORS === '*' ? '*' : enabledEditors,\n disabledEditors: DISABLED_EDITORS === '*' ? '*' : disabledEditors,\n },\n};\n\nexport default defaultConfig;\n","import { atomWithStorage } from '#store';\nimport defaultConfig, {\n FEATURE_FLAG_KEY_STORAGE,\n type FeatureFlag,\n} from './default-config.js';\n\nexport const featureFlagAtom = atomWithStorage<FeatureFlag>(\n FEATURE_FLAG_KEY_STORAGE,\n defaultConfig,\n);\n","import { useAtom } from 'jotai';\nimport { featureFlagAtom } from './atom.js';\nimport defaultConfig from './default-config.js';\n\nexport const useFeatureFlag = () => {\n const [config, setConfig] = useAtom(featureFlagAtom);\n\n return {\n config: {\n ...defaultConfig,\n ...config,\n },\n setConfig,\n };\n};\n"],"names":["namespace","connectConfig","atomWithStorage","key","initialValue","storage","options","_atomWithStorage","atomWithStorageCallback","callback","value","listener","e","atomEffect","effect","refreshAtom","atom","refAtom","get","set","ref","c","cleanup","throwPendingError","mount","baseAtom","currDeps","getter","a","setter","args","anAtom","areDifferent","refresh","v","runEffect","effectAtom","error","storeEffects","observe","store","getDefaultStore","effectSubscriptions","unobserve","unsubscribe","RENOWN_URL","RENOWN_NETWORK_ID","RENOWN_CHAIN_ID","baseDocumentModels","driveDocumentModelModule","documentModelDocumentModelModule","getUniqueDocumentModels","documentModels","uniqueModels","model","getDocumentModelsFromModules","modules","module","acc","val","documentModelsAtom","externalModules","externalPackagesAtom","externalDocumentModels","unrappedDocumentModelsAtom","unwrap","useUnwrappedDocumentModelModules","useAtomValue","subscribeDocumentModels","atomStore","getDocumentModelModule","documentType","d","useGetDocumentModelModule","documentModelModules","useFilteredDocumentModels","config","useFeatureFlag","enabledEditors","disabledEditors","filteredDocumentModels","DEFAULT_DRIVES_URL","defaultDrivesUrl","getReactorDefaultDrivesConfig","driveUrl","createBrowserStorage","routerBasename","BrowserStorage","createBrowserDocumentDriveServer","ReactorBuilder","InMemoryCache","BaseQueueManager","initReactor","reactor","initJwtHandler","errors","generateId","logger","server","renown","renownAtom","user","crypto","getConnectCrypto","waitForRenown","resolve","reject","status","renownStatusAtom","err","_","createReactor","storageAtom","_a","reactorAtom","atomWithLazy","unwrappedReactor","useDocumentAdminStorage","useUnwrappedReactor","useAsyncReactor","reactorAsyncAtom","setAtom","subscribeReactor","documentModelsSubscripion","prevReactor","createStore","documentDrivesAtom","documentToHash","drive","drivesToHash","drives","readWriteDocumentDrivesAtom","_get","newDrives","map","currentDrives","documentDrivesInitializedMapAtomFamily","atomFamily","useDocumentDrives","documentDrives","setDocumentDrives","useAtom","useMemo","refreshDocumentDrives","useCallback","driveIds","id","setStatus","serverSubscribeUpdates","clientErrorhandler","unsub1","_event","_status","unsub2","unsubOnSyncError","unsub3","loginStatusAtom","useLogin","useUser","useRenown","did","getBearerToken","useConnectCrypto","openRenown","connectId","url","protocol","returnUrl","login","userDid","newUser","useEffect","logout","useAllowList","arbitrumAllowListEnvString","rwaAllowListEnvString","arbitrumAllowListIsDefined","rwaAllowListIsDefined","arbitrumAllowList","rwaAllowList","useUserPermissions","allowList","allowListType","isAllowed","FEATURE_FLAG_KEY_STORAGE","ENABLED_EDITORS","DISABLED_EDITORS","defaultConfig","featureFlagAtom","setConfig"],"mappings":"+WAKA,MAAMA,EAAYC,EAAc,eAEnBC,GAAkB,CAC3BC,EACAC,EACAC,EACAC,IAIAC,EACI,GAAGP,CAAS,IAAIG,CAAG,GACnBC,EACoB,MAExB,EAESI,GAA0B,CACnCL,EACAC,EACAK,IAEAF,EAAoBJ,EAAKC,EAAc,CACnC,QAAQD,EAAKC,EAAc,CACvB,MAAMM,EAAQ,aAAa,QAAQ,GAAGV,CAAS,IAAIG,CAAG,EAAE,EACxD,OAAOO,EAAS,KAAK,MAAMA,CAAK,EAAUN,CAC9C,EACA,QAAQD,EAAKO,EAAO,CACH,aAAA,QAAQ,GAAGV,CAAS,IAAIG,CAAG,GAAI,KAAK,UAAUO,CAAK,CAAC,EACjED,EAASC,CAAK,CAClB,EACA,WAAWP,EAAK,CACZ,aAAa,WAAW,GAAGH,CAAS,IAAIG,CAAG,EAAE,CACjD,EACA,UAAUA,EAAKM,EAAU,CACjB,GAAA,OAAO,OAAO,iBAAqB,IACnC,MAAO,IAAM,KAGjB,SAASE,EAASC,EAAiB,CAE3BA,EAAE,cAAgB,cAClBA,EAAE,MAAQ,GAAGZ,CAAS,IAAIG,CAAG,IAE7BM,EAAUG,EAAE,UAAY,EAAQ,CACpC,CAEG,cAAA,iBAAiB,UAAWD,CAAQ,EAEpC,IAAM,OAAO,oBAAoB,UAAWA,CAAQ,CAAA,CAEnE,CAAC,ECvDE,SAASE,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ACnB,EAE6B8E,EAAa,SAAS9E,EAAK,OAAO,EAGxD,CACH,UAAW,GACX,cAAe,KACnB,EAEG,CACH,UAAW,GACX,cAAe,KACnB,CAAA,CAGG,MAAA,CACH,UAAW,GACX,cAAe,MACnB,EACJ,CCzFO,SAAS+E,IAAqB,CACjC,MAAMC,EAAYR,GAAa,EAE/B,GAAI,CAACQ,EACM,OAGL,KAAA,CAAE,cAAAC,EAAe,UAAAC,CAAA,EAAcF,EAErC,OAAIC,IAAkB,WACX,CACH,2BAA4BC,EAC5B,yBAA0B,EAC9B,EAGAD,IAAkB,MACX,CACH,2BAA4BC,EAC5B,yBAA0BA,CAC9B,EAGG,CACH,2BAA4B,GAC5B,yBAA0B,EAC9B,CACJ,CC7BO,MAAMC,GAA2B,uBAElCC,EAAkB,+CAA8C,OAChE3G,GAAiB2G,GAAA,YAAAA,EAAiB,MAAM,KAExCC,EACF,OAA+C,YAAA,6BAAA,4BAC7C3G,GAAkB2G,GAAA,YAAAA,EAAkB,MAAM,KAS1CC,EAA6B,CAC/B,QAAS,CACL,eAAgBF,IAAoB,IAAM,IAAM3G,GAChD,gBAAiB4G,IAAqB,IAAM,IAAM3G,EAAA,CAE1D,ECfa6G,GAAkB1L,GAC3BsL,GACAG,CACJ,ECLa9G,GAAiB,IAAM,CAChC,KAAM,CAACD,EAAQiH,CAAS,EAAIhD,EAAQ+C,EAAe,EAE5C,MAAA,CACH,OAAQ,CACJ,GAAGD,EACH,GAAG/G,CACP,EACA,UAAAiH,CACJ,CACJ","x_google_ignoreList":[1,2]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index.
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index.BA0NCObB.js","./index.BK4XEUxp.js","./index.uc3usMhB.js","./useFeatureFlags.Bilmeti_.js","./connect.config.CsS69d7S.js","./browser.BkwNmV2Z.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{_ as I,h as nt,v as R,i as zt,t as U,l as Vt}from"./index.BK4XEUxp.js";import{useCallback as qt,useMemo as xt,useEffect as Q}from"react";async function H(){if(import.meta.hot)return import.meta.hot;try{return(await I(()=>import("../hmr.js"),[],import.meta.url)).hmr}catch{return}}async function bn(e){const t=await H();if(!t)throw new Error("HMR not available.");return new Promise(n=>{function r(s){e===s.name&&(n(),t==null||t.off("studio:external-package-added",r))}t.on("studio:external-package-added",r),t.send("studio:add-external-package",{name:e})})}async function xn(e){const t=await H();if(!t)throw new Error("HMR not available.");return new Promise(n=>{function r(s){e===s.name&&(n(),t==null||t.off("studio:external-package-removed",r))}t.on("studio:external-package-removed",r),t.send("studio:remove-external-package",{name:e})})}async function Jt(e){const t=await H(),n=r=>{const s=I(()=>import(`${r.url}?t=${r.timestamp}`),[],import.meta.url);e(s.then(i=>i.default))};return t==null||t.on("studio:external-packages-updated",n),()=>{t==null||t.off("studio:external-packages-updated",n)}}const Tt=Object.prototype.toString;function Kt(e){switch(Tt.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return Y(e,Error)}}function k(e,t){return Tt.call(e)===`[object ${t}]`}function Tn(e){return k(e,"ErrorEvent")}function Cn(e){return k(e,"DOMError")}function wn(e){return k(e,"DOMException")}function B(e){return k(e,"String")}function Wt(e){return typeof e=="object"&&e!==null&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function On(e){return e===null||Wt(e)||typeof e!="object"&&typeof e!="function"}function rt(e){return k(e,"Object")}function Xt(e){return typeof Event<"u"&&Y(e,Event)}function Qt(e){return typeof Element<"u"&&Y(e,Element)}function Zt(e){return k(e,"RegExp")}function st(e){return!!(e&&e.then&&typeof e.then=="function")}function te(e){return rt(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e}function ee(e){return typeof e=="number"&&e!==e}function Y(e,t){try{return e instanceof t}catch{return!1}}function Ct(e){return!!(typeof e=="object"&&e!==null&&(e.__isVue||e._isVue))}function N(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function K(e,t){let n=e;const r=n.length;if(r<=150)return n;t>r&&(t=r);let s=Math.max(t-60,0);s<5&&(s=0);let i=Math.min(s+140,r);return i>r-5&&(i=r),i===r&&(s=Math.max(i-140,0)),n=n.slice(s,i),s>0&&(n=`'{snip} ${n}`),i<r&&(n+=" {snip}"),n}function Dn(e,t){if(!Array.isArray(e))return"";const n=[];for(let r=0;r<e.length;r++){const s=e[r];try{Ct(s)?n.push("[VueViewModel]"):n.push(String(s))}catch{n.push("[value cannot be serialized]")}}return n.join(t)}function ne(e,t,n=!1){return B(e)?Zt(t)?t.test(e):B(t)?n?e===t:e.includes(t):!1:!1}function In(e,t=[],n=!1){return t.some(r=>ne(e,r,n))}function j(e){return e&&e.Math==Math?e:void 0}const h=typeof globalThis=="object"&&j(globalThis)||typeof window=="object"&&j(window)||typeof self=="object"&&j(self)||typeof global=="object"&&j(global)||function(){return this}()||{};function re(){return h}function wt(e,t,n){const r=n||h,s=r.__SENTRY__=r.__SENTRY__||{};return s[e]||(s[e]=t())}const O=re(),se=80;function ie(e,t={}){if(!e)return"<unknown>";try{let n=e;const r=5,s=[];let i=0,o=0;const a=" > ",c=a.length;let u;const l=Array.isArray(t)?t:t.keyAttrs,f=!Array.isArray(t)&&t.maxStringLength||se;for(;n&&i++<r&&(u=oe(n,l),!(u==="html"||i>1&&o+s.length*c+u.length>=f));)s.push(u),o+=u.length,n=n.parentNode;return s.reverse().join(a)}catch{return"<unknown>"}}function oe(e,t){const n=e,r=[];let s,i,o,a,c;if(!n||!n.tagName)return"";if(O.HTMLElement&&n instanceof HTMLElement&&n.dataset&&n.dataset.sentryComponent)return n.dataset.sentryComponent;r.push(n.tagName.toLowerCase());const u=t&&t.length?t.filter(f=>n.getAttribute(f)).map(f=>[f,n.getAttribute(f)]):null;if(u&&u.length)u.forEach(f=>{r.push(`[${f[0]}="${f[1]}"]`)});else if(n.id&&r.push(`#${n.id}`),s=n.className,s&&B(s))for(i=s.split(/\s+/),c=0;c<i.length;c++)r.push(`.${i[c]}`);const l=["aria-label","type","name","title","alt"];for(c=0;c<l.length;c++)o=l[c],a=n.getAttribute(o),a&&r.push(`[${o}="${a}"]`);return r.join("")}function Rn(){try{return O.document.location.href}catch{return""}}function kn(e){return O.document&&O.document.querySelector?O.document.querySelector(e):null}function An(e){if(!O.HTMLElement)return null;let t=e;const n=5;for(let r=0;r<n;r++){if(!t)return null;if(t instanceof HTMLElement&&t.dataset.sentryComponent)return t.dataset.sentryComponent;t=t.parentNode}return null}const it=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,ae="Sentry Logger ",ut=["debug","info","warn","error","log","assert","trace"],ft={};function Ot(e){if(!("console"in h))return e();const t=h.console,n={},r=Object.keys(ft);r.forEach(s=>{const i=ft[s];n[s]=t[s],t[s]=i});try{return e()}finally{r.forEach(s=>{t[s]=n[s]})}}function ce(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return it?ut.forEach(n=>{t[n]=(...r)=>{e&&Ot(()=>{h.console[n](`${ae}[${n}]:`,...r)})}}):ut.forEach(n=>{t[n]=()=>{}}),t}const m=ce();function Pn(e,t,n){if(!(t in e))return;const r=e[t],s=n(r);typeof s=="function"&&ue(s,r),e[t]=s}function Dt(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{it&&m.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function ue(e,t){try{const n=t.prototype||{};e.prototype=t.prototype=n,Dt(e,"__sentry_original__",t)}catch{}}function Nn(e){return e.__sentry_original__}function Mn(e){return Object.keys(e).map(t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`).join("&")}function It(e){if(Kt(e))return{message:e.message,name:e.name,stack:e.stack,...dt(e)};if(Xt(e)){const t={type:e.type,target:lt(e.target),currentTarget:lt(e.currentTarget),...dt(e)};return typeof CustomEvent<"u"&&Y(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function lt(e){try{return Qt(e)?ie(e):Object.prototype.toString.call(e)}catch{return"<unknown>"}}function dt(e){if(typeof e=="object"&&e!==null){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}else return{}}function vn(e,t=40){const n=Object.keys(It(e));if(n.sort(),!n.length)return"[object has no keys]";if(n[0].length>=t)return N(n[0],t);for(let r=n.length;r>0;r--){const s=n.slice(0,r).join(", ");if(!(s.length>t))return r===n.length?s:N(s,t)}return""}function T(e){return Z(e,new Map)}function Z(e,t){if(fe(e)){const n=t.get(e);if(n!==void 0)return n;const r={};t.set(e,r);for(const s of Object.keys(e))typeof e[s]<"u"&&(r[s]=Z(e[s],t));return r}if(Array.isArray(e)){const n=t.get(e);if(n!==void 0)return n;const r=[];return t.set(e,r),e.forEach(s=>{r.push(Z(s,t))}),r}return e}function fe(e){if(!rt(e))return!1;try{const t=Object.getPrototypeOf(e).constructor.name;return!t||t==="Object"}catch{return!0}}const Rt=50,pt=/\(error: (.*)\)/,gt=/captureMessage|captureException/;function le(...e){const t=e.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0)=>{const s=[],i=n.split(`
|
|
3
3
|
`);for(let o=r;o<i.length;o++){const a=i[o];if(a.length>1024)continue;const c=pt.test(a)?a.replace(pt,"$1"):a;if(!c.match(/\S*Error: /)){for(const u of t){const l=u(c);if(l){s.push(l);break}}if(s.length>=Rt)break}}return de(s)}}function Ln(e){return Array.isArray(e)?le(...e):e}function de(e){if(!e.length)return[];const t=Array.from(e);return/sentryWrapped/.test(t[t.length-1].function||"")&&t.pop(),t.reverse(),gt.test(t[t.length-1].function||"")&&(t.pop(),gt.test(t[t.length-1].function||"")&&t.pop()),t.slice(0,Rt).map(n=>({...n,filename:n.filename||t[t.length-1].filename,function:n.function||"?"}))}const W="<anonymous>";function pe(e){try{return!e||typeof e!="function"?W:e.name||W}catch{return W}}function d(){const e=h,t=e.crypto||e.msCrypto;let n=()=>Math.random()*16;try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t&&t.getRandomValues&&(n=()=>{const r=new Uint8Array(1);return t.getRandomValues(r),r[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,r=>(r^(n()&15)>>r/4).toString(16))}function kt(e){return e.exception&&e.exception.values?e.exception.values[0]:void 0}function jn(e){const{message:t,event_id:n}=e;if(t)return t;const r=kt(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function $n(e,t,n){const r=e.exception=e.exception||{},s=r.values=r.values||[],i=s[0]=s[0]||{};i.value||(i.value=t||""),i.type||(i.type="Error")}function ge(e,t){const n=kt(e);if(!n)return;const r={type:"generic",handled:!0},s=n.mechanism;if(n.mechanism={...r,...s,...t},t&&"data"in t){const i={...s&&s.data,...t.data};n.mechanism.data=i}}function Gn(e,t,n=5){if(t.lineno===void 0)return;const r=e.length,s=Math.max(Math.min(r-1,t.lineno-1),0);t.pre_context=e.slice(Math.max(0,s-n),s).map(i=>K(i,0)),t.context_line=K(e[Math.min(r-1,s)],t.colno||0),t.post_context=e.slice(Math.min(s+1,r),s+1+n).map(i=>K(i,0))}function Un(e){if(e&&e.__sentry_captured__)return!0;try{Dt(e,"__sentry_captured__",!0)}catch{}return!1}function _e(e){return Array.isArray(e)?e:[e]}function he(){const e=typeof WeakSet=="function",t=e?new WeakSet:[];function n(s){if(e)return t.has(s)?!0:(t.add(s),!1);for(let i=0;i<t.length;i++)if(t[i]===s)return!0;return t.push(s),!1}function r(s){if(e)t.delete(s);else for(let i=0;i<t.length;i++)if(t[i]===s){t.splice(i,1);break}}return[n,r]}function x(e,t=100,n=1/0){try{return tt("",e,t,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function me(e,t=3,n=100*1024){const r=x(e,t);return be(r)>n?me(e,t-1,n):r}function tt(e,t,n=1/0,r=1/0,s=he()){const[i,o]=s;if(t==null||["number","boolean","string"].includes(typeof t)&&!ee(t))return t;const a=Se(e,t);if(!a.startsWith("[object "))return a;if(t.__sentry_skip_normalization__)return t;const c=typeof t.__sentry_override_normalization_depth__=="number"?t.__sentry_override_normalization_depth__:n;if(c===0)return a.replace("object ","");if(i(t))return"[Circular ~]";const u=t;if(u&&typeof u.toJSON=="function")try{const g=u.toJSON();return tt("",g,c-1,r,s)}catch{}const l=Array.isArray(t)?[]:{};let f=0;const _=It(t);for(const g in _){if(!Object.prototype.hasOwnProperty.call(_,g))continue;if(f>=r){l[g]="[MaxProperties ~]";break}const C=_[g];l[g]=tt(g,C,c-1,r,s),f++}return o(t),l}function Se(e,t){try{if(e==="domain"&&t&&typeof t=="object"&&t._events)return"[Domain]";if(e==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&t===global)return"[Global]";if(typeof window<"u"&&t===window)return"[Window]";if(typeof document<"u"&&t===document)return"[Document]";if(Ct(t))return"[VueViewModel]";if(te(t))return"[SyntheticEvent]";if(typeof t=="number"&&t!==t)return"[NaN]";if(typeof t=="function")return`[Function: ${pe(t)}]`;if(typeof t=="symbol")return`[${String(t)}]`;if(typeof t=="bigint")return`[BigInt: ${String(t)}]`;const n=ye(t);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function ye(e){const t=Object.getPrototypeOf(e);return t?t.constructor.name:"null prototype"}function Ee(e){return~-encodeURI(e).split(/%..|./).length}function be(e){return Ee(JSON.stringify(e))}var E;(function(e){e[e.PENDING=0]="PENDING";const n=1;e[e.RESOLVED=n]="RESOLVED";const r=2;e[e.REJECTED=r]="REJECTED"})(E||(E={}));function Bn(e){return new y(t=>{t(e)})}function Fn(e){return new y((t,n)=>{n(e)})}class y{constructor(t){y.prototype.__init.call(this),y.prototype.__init2.call(this),y.prototype.__init3.call(this),y.prototype.__init4.call(this),this._state=E.PENDING,this._handlers=[];try{t(this._resolve,this._reject)}catch(n){this._reject(n)}}then(t,n){return new y((r,s)=>{this._handlers.push([!1,i=>{if(!t)r(i);else try{r(t(i))}catch(o){s(o)}},i=>{if(!n)s(i);else try{r(n(i))}catch(o){s(o)}}]),this._executeHandlers()})}catch(t){return this.then(n=>n,t)}finally(t){return new y((n,r)=>{let s,i;return this.then(o=>{i=!1,s=o,t&&t()},o=>{i=!0,s=o,t&&t()}).then(()=>{if(i){r(s);return}n(s)})})}__init(){this._resolve=t=>{this._setResult(E.RESOLVED,t)}}__init2(){this._reject=t=>{this._setResult(E.REJECTED,t)}}__init3(){this._setResult=(t,n)=>{if(this._state===E.PENDING){if(st(n)){n.then(this._resolve,this._reject);return}this._state=t,this._value=n,this._executeHandlers()}}}__init4(){this._executeHandlers=()=>{if(this._state===E.PENDING)return;const t=this._handlers.slice();this._handlers=[],t.forEach(n=>{n[0]||(this._state===E.RESOLVED&&n[1](this._value),this._state===E.REJECTED&&n[2](this._value),n[0]=!0)})}}}const At=1e3;function z(){return Date.now()/At}function xe(){const{performance:e}=h;if(!e||!e.now)return z;const t=Date.now()-e.now(),n=e.timeOrigin==null?t:e.timeOrigin;return()=>(n+e.now())/At}const ot=xe(),Hn=(()=>{const{performance:e}=h;if(!e||!e.now)return;const t=3600*1e3,n=e.now(),r=Date.now(),s=e.timeOrigin?Math.abs(e.timeOrigin+n-r):t,i=s<t,o=e.timing&&e.timing.navigationStart,c=typeof o=="number"?Math.abs(o+n-r):t,u=c<t;return i||u?s<=c?e.timeOrigin:o:r})(),Yn="baggage",Pt="sentry-",Te=/^sentry-/,Ce=8192;function Nt(e){if(!B(e)&&!Array.isArray(e))return;let t={};if(Array.isArray(e))t=e.reduce((r,s)=>{const i=_t(s);for(const o of Object.keys(i))r[o]=i[o];return r},{});else{if(!e)return;t=_t(e)}const n=Object.entries(t).reduce((r,[s,i])=>{if(s.match(Te)){const o=s.slice(Pt.length);r[o]=i}return r},{});if(Object.keys(n).length>0)return n}function zn(e){if(!e)return;const t=Object.entries(e).reduce((n,[r,s])=>(s&&(n[`${Pt}${r}`]=s),n),{});return we(t)}function _t(e){return e.split(",").map(t=>t.split("=").map(n=>decodeURIComponent(n.trim()))).reduce((t,[n,r])=>(t[n]=r,t),{})}function we(e){if(Object.keys(e).length!==0)return Object.entries(e).reduce((t,[n,r],s)=>{const i=`${encodeURIComponent(n)}=${encodeURIComponent(r)}`,o=s===0?i:`${t},${i}`;return o.length>Ce?(it&&m.warn(`Not adding key: ${n} with val: ${r} to baggage header due to exceeding baggage size limits.`),t):o},"")}const Oe=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function Mt(e){if(!e)return;const t=e.match(Oe);if(!t)return;let n;return t[3]==="1"?n=!0:t[3]==="0"&&(n=!1),{traceId:t[1],parentSampled:n,parentSpanId:t[2]}}function Vn(e,t){const n=Mt(e),r=Nt(t),{traceId:s,parentSpanId:i,parentSampled:o}=n||{};return n?{traceparentData:n,dynamicSamplingContext:r||{},propagationContext:{traceId:s||d(),parentSpanId:i||d().substring(16),spanId:d().substring(16),sampled:o,dsc:r||{}}}:{traceparentData:n,dynamicSamplingContext:void 0,propagationContext:{traceId:s||d(),spanId:d().substring(16)}}}function qn(e,t){const n=Mt(e),r=Nt(t),{traceId:s,parentSpanId:i,parentSampled:o}=n||{};return n?{traceId:s||d(),parentSpanId:i||d().substring(16),spanId:d().substring(16),sampled:o,dsc:r||{}}:{traceId:s||d(),spanId:d().substring(16)}}function De(e=d(),t=d().substring(16),n){let r="";return n!==void 0&&(r=n?"-1":"-0"),`${e}-${t}${r}`}const D=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,V="production";function at(){return wt("globalEventProcessors",()=>[])}function Jn(e){at().push(e)}function F(e,t,n,r=0){return new y((s,i)=>{const o=e[r];if(t===null||typeof o!="function")s(t);else{const a=o({...t},n);D&&o.id&&a===null&&m.log(`Event processor "${o.id}" dropped event`),st(a)?a.then(c=>F(e,c,n,r+1).then(s)).then(null,i):F(e,a,n,r+1).then(s).then(null,i)}})}function vt(e){const t=ot(),n={sid:d(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>Ie(n)};return e&&v(n,e),n}function v(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||ot(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:d()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started=="number"&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration=="number")e.duration=t.duration;else{const n=e.timestamp-e.started;e.duration=n>=0?n:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),typeof t.errors=="number"&&(e.errors=t.errors),t.status&&(e.status=t.status)}function Lt(e,t){let n={};e.status==="ok"&&(n={status:"exited"}),v(e,n)}function Ie(e){return T({sid:`${e.sid}`,init:e.init,started:new Date(e.started*1e3).toISOString(),timestamp:new Date(e.timestamp*1e3).toISOString(),status:e.status,errors:e.errors,did:typeof e.did=="number"||typeof e.did=="string"?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}})}const Kn=0,Re=1;function ke(e){const{spanId:t,traceId:n}=e.spanContext(),{data:r,op:s,parent_span_id:i,status:o,tags:a,origin:c}=M(e);return T({data:r,op:s,parent_span_id:i,span_id:t,status:o,tags:a,trace_id:n,origin:c})}function Wn(e){const{traceId:t,spanId:n}=e.spanContext(),r=jt(e);return De(t,n,r)}function Xn(e){return typeof e=="number"?ht(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?ht(e.getTime()):ot()}function ht(e){return e>9999999999?e/1e3:e}function M(e){return Ae(e)?e.getSpanJSON():typeof e.toJSON=="function"?e.toJSON():{}}function Ae(e){return typeof e.getSpanJSON=="function"}function jt(e){const{traceFlags:t}=e.spanContext();return!!(t&Re)}function Qn(e,t,n,r,s,i){const{normalizeDepth:o=3,normalizeMaxBreadth:a=1e3}=e,c={...t,event_id:t.event_id||n.event_id||d(),timestamp:t.timestamp||z()},u=n.integrations||e.integrations.map(S=>S.name);Pe(c,e),ve(c,u),t.type===void 0&&Ne(c,e.stackParser);const l=je(r,n.captureContext);n.mechanism&&ge(c,n.mechanism);const f=s&&s.getEventProcessors?s.getEventProcessors():[],_=Qe().getScopeData();if(i){const S=i.getScopeData();St(_,S)}if(l){const S=l.getScopeData();St(_,S)}const g=[...n.attachments||[],..._.attachments];g.length&&(n.attachments=g),Bt(c,_);const C=[...f,...at(),..._.eventProcessors];return F(C,c,n).then(S=>(S&&Me(S),typeof o=="number"&&o>0?Le(S,o,a):S))}function Pe(e,t){const{environment:n,release:r,dist:s,maxValueLength:i=250}=t;"environment"in e||(e.environment="environment"in t?n:V),e.release===void 0&&r!==void 0&&(e.release=r),e.dist===void 0&&s!==void 0&&(e.dist=s),e.message&&(e.message=N(e.message,i));const o=e.exception&&e.exception.values&&e.exception.values[0];o&&o.value&&(o.value=N(o.value,i));const a=e.request;a&&a.url&&(a.url=N(a.url,i))}const mt=new WeakMap;function Ne(e,t){const n=h._sentryDebugIds;if(!n)return;let r;const s=mt.get(t);s?r=s:(r=new Map,mt.set(t,r));const i=Object.keys(n).reduce((o,a)=>{let c;const u=r.get(a);u?c=u:(c=t(a),r.set(a,c));for(let l=c.length-1;l>=0;l--){const f=c[l];if(f.filename){o[f.filename]=n[a];break}}return o},{});try{e.exception.values.forEach(o=>{o.stacktrace.frames.forEach(a=>{a.filename&&(a.debug_id=i[a.filename])})})}catch{}}function Me(e){const t={};try{e.exception.values.forEach(r=>{r.stacktrace.frames.forEach(s=>{s.debug_id&&(s.abs_path?t[s.abs_path]=s.debug_id:s.filename&&(t[s.filename]=s.debug_id),delete s.debug_id)})})}catch{}if(Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];const n=e.debug_meta.images;Object.keys(t).forEach(r=>{n.push({type:"sourcemap",code_file:r,debug_id:t[r]})})}function ve(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function Le(e,t,n){if(!e)return null;const r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(s=>({...s,...s.data&&{data:x(s.data,t,n)}}))},...e.user&&{user:x(e.user,t,n)},...e.contexts&&{contexts:x(e.contexts,t,n)},...e.extra&&{extra:x(e.extra,t,n)}};return e.contexts&&e.contexts.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=x(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(s=>{const i=M(s).data;return i&&(s.data=x(i,t,n)),s})),r}function je(e,t){if(!t)return e;const n=e?e.clone():new b;return n.update(t),n}function $e(e){if(e)return Ge(e)?{captureContext:e}:Be(e)?{captureContext:e}:e}function Ge(e){return e instanceof b||typeof e=="function"}const Ue=["user","level","extra","contexts","tags","fingerprint","requestSession","propagationContext"];function Be(e){return Object.keys(e).some(t=>Ue.includes(t))}function Zn(e,t){return p().captureException(e,$e(t))}function tr(e,t){const n=typeof t=="string"?t:void 0,r=typeof t!="string"?{captureContext:t}:void 0;return p().captureMessage(e,n,r)}function er(e,t){return p().captureEvent(e,t)}function nr(e){p().configureScope(e)}function rr(e,t){p().addBreadcrumb(e,t)}function sr(e,t){p().setContext(e,t)}function ir(e){p().setExtras(e)}function or(e,t){p().setExtra(e,t)}function ar(e){p().setTags(e)}function cr(e,t){p().setTag(e,t)}function Fe(e){p().setUser(e)}function He(...e){const t=p();if(e.length===2){const[n,r]=e;return n?t.withScope(()=>(t.getStackTop().scope=n,r(n))):t.withScope(r)}return t.withScope(e[0])}function ur(e){return nn(()=>e(J()))}function fr(e,t){return He(n=>(n.setSpan(e),t(n)))}function lr(e,t){return p().startTransaction({...e},t)}async function dr(e){const t=A();return t?t.flush(e):(D&&m.warn("Cannot flush events. No client defined."),Promise.resolve(!1))}async function pr(e){const t=A();return t?t.close(e):(D&&m.warn("Cannot flush events and disable SDK. No client defined."),Promise.resolve(!1))}function gr(){return p().lastEventId()}function A(){return p().getClient()}function _r(){return!!A()}function q(){return p().getScope()}function hr(e){const t=A(),n=J(),r=q(),{release:s,environment:i=V}=t&&t.getOptions()||{},{userAgent:o}=h.navigator||{},a=vt({release:s,environment:i,user:r.getUser()||n.getUser(),...o&&{userAgent:o},...e}),c=n.getSession();return c&&c.status==="ok"&&v(c,{status:"exited"}),$t(),n.setSession(a),r.setSession(a),a}function $t(){const e=J(),t=q(),n=t.getSession()||e.getSession();n&&Lt(n),Gt(),e.setSession(),t.setSession()}function Gt(){const e=J(),t=q(),n=A(),r=t.getSession()||e.getSession();r&&n&&n.captureSession&&n.captureSession(r)}function mr(e=!1){if(e){$t();return}Gt()}function Ut(e){return e.transaction}function Ye(e,t,n){const r=t.getOptions(),{publicKey:s}=t.getDsn()||{},{segment:i}=n&&n.getUser()||{},o=T({environment:r.environment||V,release:r.release,user_segment:i,public_key:s,trace_id:e});return t.emit&&t.emit("createDsc",o),o}function ze(e){const t=A();if(!t)return{};const n=Ye(M(e).trace_id||"",t,q()),r=Ut(e);if(!r)return n;const s=r&&r._frozenDynamicSamplingContext;if(s)return s;const{sampleRate:i,source:o}=r.metadata;i!=null&&(n.sample_rate=`${i}`);const a=M(r);return o&&o!=="url"&&(n.transaction=a.description),n.sampled=String(jt(r)),t.emit&&t.emit("createDsc",n),n}function Bt(e,t){const{fingerprint:n,span:r,breadcrumbs:s,sdkProcessingMetadata:i}=t;Ve(e,t),r&&Ke(e,r),We(e,n),qe(e,s),Je(e,i)}function St(e,t){const{extra:n,tags:r,user:s,contexts:i,level:o,sdkProcessingMetadata:a,breadcrumbs:c,fingerprint:u,eventProcessors:l,attachments:f,propagationContext:_,transactionName:g,span:C}=t;P(e,"extra",n),P(e,"tags",r),P(e,"user",s),P(e,"contexts",i),P(e,"sdkProcessingMetadata",a),o&&(e.level=o),g&&(e.transactionName=g),C&&(e.span=C),c.length&&(e.breadcrumbs=[...e.breadcrumbs,...c]),u.length&&(e.fingerprint=[...e.fingerprint,...u]),l.length&&(e.eventProcessors=[...e.eventProcessors,...l]),f.length&&(e.attachments=[...e.attachments,...f]),e.propagationContext={...e.propagationContext,..._}}function P(e,t,n){if(n&&Object.keys(n).length){e[t]={...e[t]};for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[t][r]=n[r])}}function Ve(e,t){const{extra:n,tags:r,user:s,contexts:i,level:o,transactionName:a}=t,c=T(n);c&&Object.keys(c).length&&(e.extra={...c,...e.extra});const u=T(r);u&&Object.keys(u).length&&(e.tags={...u,...e.tags});const l=T(s);l&&Object.keys(l).length&&(e.user={...l,...e.user});const f=T(i);f&&Object.keys(f).length&&(e.contexts={...f,...e.contexts}),o&&(e.level=o),a&&(e.transaction=a)}function qe(e,t){const n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function Je(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function Ke(e,t){e.contexts={trace:ke(t),...e.contexts};const n=Ut(t);if(n){e.sdkProcessingMetadata={dynamicSamplingContext:ze(t),...e.sdkProcessingMetadata};const r=M(n).description;r&&(e.tags={transaction:r,...e.tags})}}function We(e,t){e.fingerprint=e.fingerprint?_e(e.fingerprint):[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint&&!e.fingerprint.length&&delete e.fingerprint}const Xe=100;let X;class b{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=yt()}static clone(t){return t?t.clone():new b}clone(){const t=new b;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._extra={...this._extra},t._contexts={...this._contexts},t._user=this._user,t._level=this._level,t._span=this._span,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._requestSession=this._requestSession,t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t}setClient(t){this._client=t}getClient(){return this._client}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{email:void 0,id:void 0,ip_address:void 0,segment:void 0,username:void 0},this._session&&v(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(t){return this._requestSession=t,this}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,n){return this._tags={...this._tags,[t]:n},this._notifyScopeListeners(),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,n){return this._extra={...this._extra,[t]:n},this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,n){return n===null?delete this._contexts[t]:this._contexts[t]=n,this._notifyScopeListeners(),this}setSpan(t){return this._span=t,this._notifyScopeListeners(),this}getSpan(){return this._span}getTransaction(){const t=this._span;return t&&t.transaction}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;const n=typeof t=="function"?t(this):t;if(n instanceof b){const r=n.getScopeData();this._tags={...this._tags,...r.tags},this._extra={...this._extra,...r.extra},this._contexts={...this._contexts,...r.contexts},r.user&&Object.keys(r.user).length&&(this._user=r.user),r.level&&(this._level=r.level),r.fingerprint.length&&(this._fingerprint=r.fingerprint),n.getRequestSession()&&(this._requestSession=n.getRequestSession()),r.propagationContext&&(this._propagationContext=r.propagationContext)}else if(rt(n)){const r=t;this._tags={...this._tags,...r.tags},this._extra={...this._extra,...r.extra},this._contexts={...this._contexts,...r.contexts},r.user&&(this._user=r.user),r.level&&(this._level=r.level),r.fingerprint&&(this._fingerprint=r.fingerprint),r.requestSession&&(this._requestSession=r.requestSession),r.propagationContext&&(this._propagationContext=r.propagationContext)}return this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._span=void 0,this._session=void 0,this._notifyScopeListeners(),this._attachments=[],this._propagationContext=yt(),this}addBreadcrumb(t,n){const r=typeof n=="number"?n:Xe;if(r<=0)return this;const s={timestamp:z(),...t},i=this._breadcrumbs;return i.push(s),this._breadcrumbs=i.length>r?i.slice(-r):i,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(t){return this._attachments.push(t),this}getAttachments(){return this.getScopeData().attachments}clearAttachments(){return this._attachments=[],this}getScopeData(){const{_breadcrumbs:t,_attachments:n,_contexts:r,_tags:s,_extra:i,_user:o,_level:a,_fingerprint:c,_eventProcessors:u,_propagationContext:l,_sdkProcessingMetadata:f,_transactionName:_,_span:g}=this;return{breadcrumbs:t,attachments:n,contexts:r,tags:s,extra:i,user:o,level:a,fingerprint:c||[],eventProcessors:u,propagationContext:l,sdkProcessingMetadata:f,transactionName:_,span:g}}applyToEvent(t,n={},r=[]){Bt(t,this.getScopeData());const s=[...r,...at(),...this._eventProcessors];return F(s,t,n)}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata={...this._sdkProcessingMetadata,...t},this}setPropagationContext(t){return this._propagationContext=t,this}getPropagationContext(){return this._propagationContext}captureException(t,n){const r=n&&n.event_id?n.event_id:d();if(!this._client)return m.warn("No client configured on scope - will not capture exception!"),r;const s=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:s,...n,event_id:r},this),r}captureMessage(t,n,r){const s=r&&r.event_id?r.event_id:d();if(!this._client)return m.warn("No client configured on scope - will not capture message!"),s;const i=new Error(t);return this._client.captureMessage(t,n,{originalException:t,syntheticException:i,...r,event_id:s},this),s}captureEvent(t,n){const r=n&&n.event_id?n.event_id:d();return this._client?(this._client.captureEvent(t,{...n,event_id:r},this),r):(m.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(t=>{t(this)}),this._notifyingListeners=!1)}}function Qe(){return X||(X=new b),X}function yt(){return{traceId:d(),spanId:d().substring(16)}}const Ze="7.120.3",Ft=parseFloat(Ze),tn=100;class Ht{constructor(t,n,r,s=Ft){this._version=s;let i;n?i=n:(i=new b,i.setClient(t));let o;r?o=r:(o=new b,o.setClient(t)),this._stack=[{scope:i}],t&&this.bindClient(t),this._isolationScope=o}isOlderThan(t){return this._version<t}bindClient(t){const n=this.getStackTop();n.client=t,n.scope.setClient(t),t&&t.setupIntegrations&&t.setupIntegrations()}pushScope(){const t=this.getScope().clone();return this.getStack().push({client:this.getClient(),scope:t}),t}popScope(){return this.getStack().length<=1?!1:!!this.getStack().pop()}withScope(t){const n=this.pushScope();let r;try{r=t(n)}catch(s){throw this.popScope(),s}return st(r)?r.then(s=>(this.popScope(),s),s=>{throw this.popScope(),s}):(this.popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStack(){return this._stack}getStackTop(){return this._stack[this._stack.length-1]}captureException(t,n){const r=this._lastEventId=n&&n.event_id?n.event_id:d(),s=new Error("Sentry syntheticException");return this.getScope().captureException(t,{originalException:t,syntheticException:s,...n,event_id:r}),r}captureMessage(t,n,r){const s=this._lastEventId=r&&r.event_id?r.event_id:d(),i=new Error(t);return this.getScope().captureMessage(t,n,{originalException:t,syntheticException:i,...r,event_id:s}),s}captureEvent(t,n){const r=n&&n.event_id?n.event_id:d();return t.type||(this._lastEventId=r),this.getScope().captureEvent(t,{...n,event_id:r}),r}lastEventId(){return this._lastEventId}addBreadcrumb(t,n){const{scope:r,client:s}=this.getStackTop();if(!s)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=tn}=s.getOptions&&s.getOptions()||{};if(o<=0)return;const c={timestamp:z(),...t},u=i?Ot(()=>i(c,n)):c;u!==null&&(s.emit&&s.emit("beforeAddBreadcrumb",u,n),r.addBreadcrumb(u,o))}setUser(t){this.getScope().setUser(t),this.getIsolationScope().setUser(t)}setTags(t){this.getScope().setTags(t),this.getIsolationScope().setTags(t)}setExtras(t){this.getScope().setExtras(t),this.getIsolationScope().setExtras(t)}setTag(t,n){this.getScope().setTag(t,n),this.getIsolationScope().setTag(t,n)}setExtra(t,n){this.getScope().setExtra(t,n),this.getIsolationScope().setExtra(t,n)}setContext(t,n){this.getScope().setContext(t,n),this.getIsolationScope().setContext(t,n)}configureScope(t){const{scope:n,client:r}=this.getStackTop();r&&t(n)}run(t){const n=Et(this);try{t(this)}finally{Et(n)}}getIntegration(t){const n=this.getClient();if(!n)return null;try{return n.getIntegration(t)}catch{return D&&m.warn(`Cannot retrieve integration ${t.id} from the current Hub`),null}}startTransaction(t,n){const r=this._callExtensionMethod("startTransaction",t,n);return D&&!r&&(this.getClient()?m.warn(`Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init':
|
|
4
4
|
Sentry.addTracingExtensions();
|
|
5
5
|
Sentry.init({...});
|
|
6
|
-
`):m.warn("Tracing extension 'startTransaction' is missing. You should 'init' the SDK before calling 'startTransaction'")),r}traceHeaders(){return this._callExtensionMethod("traceHeaders")}captureSession(t=!1){if(t)return this.endSession();this._sendSessionUpdate()}endSession(){const n=this.getStackTop().scope,r=n.getSession();r&&Lt(r),this._sendSessionUpdate(),n.setSession()}startSession(t){const{scope:n,client:r}=this.getStackTop(),{release:s,environment:i=V}=r&&r.getOptions()||{},{userAgent:o}=h.navigator||{},a=vt({release:s,environment:i,user:n.getUser(),...o&&{userAgent:o},...t}),c=n.getSession&&n.getSession();return c&&c.status==="ok"&&v(c,{status:"exited"}),this.endSession(),n.setSession(a),a}shouldSendDefaultPii(){const t=this.getClient(),n=t&&t.getOptions();return!!(n&&n.sendDefaultPii)}_sendSessionUpdate(){const{scope:t,client:n}=this.getStackTop(),r=t.getSession();r&&n&&n.captureSession&&n.captureSession(r)}_callExtensionMethod(t,...n){const s=L().__SENTRY__;if(s&&s.extensions&&typeof s.extensions[t]=="function")return s.extensions[t].apply(this,n);D&&m.warn(`Extension method ${t} couldn't be found, doing nothing.`)}}function L(){return h.__SENTRY__=h.__SENTRY__||{extensions:{},hub:void 0},h}function Et(e){const t=L(),n=et(t);return Yt(t,e),n}function p(){const e=L();if(e.__SENTRY__&&e.__SENTRY__.acs){const t=e.__SENTRY__.acs.getCurrentHub();if(t)return t}return en(e)}function J(){return p().getIsolationScope()}function en(e=L()){return(!rn(e)||et(e).isOlderThan(Ft))&&Yt(e,new Ht),et(e)}function nn(e,t={}){const n=L();return n.__SENTRY__&&n.__SENTRY__.acs?n.__SENTRY__.acs.runWithAsyncContext(e,t):e()}function rn(e){return!!(e&&e.__SENTRY__&&e.__SENTRY__.hub)}function et(e){return wt("hub",()=>new Ht,e)}function Yt(e,t){if(!e)return!1;const n=e.__SENTRY__=e.__SENTRY__||{};return n.hub=t,!0}function sn(){return I(()=>import("../external-packages.js"),[],import.meta.url).catch(e=>console.error(e)).then(e=>(e==null?void 0:e.default)??[])}const on=R(async()=>typeof await H()<"u"),Sr=()=>nt(on),ct=zt(sn);let bt;ct.onMount=e=>{bt||(bt=Jt(t=>{e(t)}))};const an=()=>nt(ct),cn={id:"powerhouse/common",name:"Generic Drive Explorer",driveEditor:"GenericDriveExplorer"},un=R(async e=>{const t=await e(ct);return[cn,...t.map(n=>n.manifest.apps).filter(n=>n!==void 0).flat()]}),fn=()=>nt(un),yr=()=>{const e=fn();return qt(t=>{if(!t)return;const n=e.find(r=>r.driveEditor===t);return n==null?void 0:n.name},[e])},Er=e=>{const t=an();return xt(()=>{if(!e)return;const n=t.find(r=>{var s;return(s=r.manifest.apps)==null?void 0:s.find(i=>i.driveEditor===e)});return n==null?void 0:n.editors.find(r=>r.config.id===e)},[t,e])};let $;async function ln(){const{ConnectCrypto:e}=await I(async()=>{const{ConnectCrypto:r}=await import("./index.
|
|
7
|
-
//# sourceMappingURL=user.
|
|
6
|
+
`):m.warn("Tracing extension 'startTransaction' is missing. You should 'init' the SDK before calling 'startTransaction'")),r}traceHeaders(){return this._callExtensionMethod("traceHeaders")}captureSession(t=!1){if(t)return this.endSession();this._sendSessionUpdate()}endSession(){const n=this.getStackTop().scope,r=n.getSession();r&&Lt(r),this._sendSessionUpdate(),n.setSession()}startSession(t){const{scope:n,client:r}=this.getStackTop(),{release:s,environment:i=V}=r&&r.getOptions()||{},{userAgent:o}=h.navigator||{},a=vt({release:s,environment:i,user:n.getUser(),...o&&{userAgent:o},...t}),c=n.getSession&&n.getSession();return c&&c.status==="ok"&&v(c,{status:"exited"}),this.endSession(),n.setSession(a),a}shouldSendDefaultPii(){const t=this.getClient(),n=t&&t.getOptions();return!!(n&&n.sendDefaultPii)}_sendSessionUpdate(){const{scope:t,client:n}=this.getStackTop(),r=t.getSession();r&&n&&n.captureSession&&n.captureSession(r)}_callExtensionMethod(t,...n){const s=L().__SENTRY__;if(s&&s.extensions&&typeof s.extensions[t]=="function")return s.extensions[t].apply(this,n);D&&m.warn(`Extension method ${t} couldn't be found, doing nothing.`)}}function L(){return h.__SENTRY__=h.__SENTRY__||{extensions:{},hub:void 0},h}function Et(e){const t=L(),n=et(t);return Yt(t,e),n}function p(){const e=L();if(e.__SENTRY__&&e.__SENTRY__.acs){const t=e.__SENTRY__.acs.getCurrentHub();if(t)return t}return en(e)}function J(){return p().getIsolationScope()}function en(e=L()){return(!rn(e)||et(e).isOlderThan(Ft))&&Yt(e,new Ht),et(e)}function nn(e,t={}){const n=L();return n.__SENTRY__&&n.__SENTRY__.acs?n.__SENTRY__.acs.runWithAsyncContext(e,t):e()}function rn(e){return!!(e&&e.__SENTRY__&&e.__SENTRY__.hub)}function et(e){return wt("hub",()=>new Ht,e)}function Yt(e,t){if(!e)return!1;const n=e.__SENTRY__=e.__SENTRY__||{};return n.hub=t,!0}function sn(){return I(()=>import("../external-packages.js"),[],import.meta.url).catch(e=>console.error(e)).then(e=>(e==null?void 0:e.default)??[])}const on=R(async()=>typeof await H()<"u"),Sr=()=>nt(on),ct=zt(sn);let bt;ct.onMount=e=>{bt||(bt=Jt(t=>{e(t)}))};const an=()=>nt(ct),cn={id:"powerhouse/common",name:"Generic Drive Explorer",driveEditor:"GenericDriveExplorer"},un=R(async e=>{const t=await e(ct);return[cn,...t.map(n=>n.manifest.apps).filter(n=>n!==void 0).flat()]}),fn=()=>nt(un),yr=()=>{const e=fn();return qt(t=>{if(!t)return;const n=e.find(r=>r.driveEditor===t);return n==null?void 0:n.name},[e])},Er=e=>{const t=an();return xt(()=>{if(!e)return;const n=t.find(r=>{var s;return(s=r.manifest.apps)==null?void 0:s.find(i=>i.driveEditor===e)});return n==null?void 0:n.editors.find(r=>r.config.id===e)},[t,e])};let $;async function ln(){const{ConnectCrypto:e}=await I(async()=>{const{ConnectCrypto:r}=await import("./index.BA0NCObB.js");return{ConnectCrypto:r}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url),{BrowserKeyStorage:t}=await I(async()=>{const{BrowserKeyStorage:r}=await import("./index.BA0NCObB.js");return{BrowserKeyStorage:r}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url),n=new e(new t);return await n.did(),n}function w(){return window.connectCrypto?Promise.resolve(window.connectCrypto):$||($=ln(),$)}function dn(){return xt(()=>({async regenerateDid(){return(await w()).regenerateDid()},async did(){return(await w()).did()},sign:async e=>await(await w()).sign(e),async getIssuer(){return(await w()).getIssuer()},async getBearerToken(e,t,n=!1){return(await w()).getBearerToken(e,t,n)}}),[])}const pn=R(void 0);function br(){const[e,t]=U(pn);return Q(()=>{e||w().then(n=>n.did()).then(n=>t(n)).catch(Vt.error)}),e}const gn=R("idle"),_n=R(window.renown?Promise.resolve(window.renown):void 0);function hn(){const[e,t]=U(_n),[n,r]=U(gn),{did:s}=dn();async function i(o){r("loading");try{const a=await o();if(!a){r("error");return}const{initRenownBrowser:c}=await I(async()=>{const{initRenownBrowser:f}=await import("./index.uc3usMhB.js").then(_=>_.b);return{initRenownBrowser:f}},__vite__mapDeps([2,1,3,4,5]),import.meta.url),u=c(a),l={user:function(){return Promise.resolve(u.user)},login:function(f){return u.login(f)},logout(){return Promise.resolve(u.logout())},on:{user(f){return u.on("user",f)}}};return r("finished"),l}catch(a){console.error("Error initializing renown:",a instanceof Error?a.message:"Unknown error"),r("error");return}}return!e&&n==="idle"&&t(i(s)),e}let G=!1;const mn=R(void 0),xr=()=>{const[e,t]=U(mn),n=hn();return Q(()=>{var s;let r=null;if(e){const{credential:i,...o}=e;r={id:o.did,username:(s=o.ens)==null?void 0:s.name,...o}}Fe(r)},[e]),Q(()=>{if(G)return;G=!0,n==null||n.user().then(s=>{t(s||null)}).catch(()=>{t(null)});const r=n==null?void 0:n.on.user(s=>{t(s||null)});return()=>{r==null||r(),G=!1}},[n,G]),e};export{L as $,x as A,z as B,ut as C,it as D,Mt as E,p as F,h as G,D as H,st as I,A as J,q as K,Vn as L,nn as M,Xn as N,J as O,ze as P,jt as Q,He as R,y as S,M as T,ot as U,Re as V,Kn as W,Ut as X,Wn as Y,ke as Z,ee as _,yr as a,ur as a$,Mn as a0,_e as a1,Jn as a2,Un as a3,On as a4,v as a5,Qn as a6,Ye as a7,Wt as a8,rt as a9,er as aA,Rn as aB,Ln as aC,hr as aD,mr as aE,sr as aF,tr as aG,Gn as aH,V as aI,fr as aJ,Qe as aK,Ht as aL,b as aM,pr as aN,nr as aO,$t as aP,dr as aQ,et as aR,_r as aS,gr as aT,Et as aU,or as aV,ir as aW,cr as aX,ar as aY,Fe as aZ,lr as a_,Ze as aa,jn as ab,In as ac,Nn as ad,Hn as ae,ie as af,An as ag,De as ah,zn as ai,Yn as aj,qn as ak,kn as al,ue as am,$n as an,ge as ao,Zn as ap,Tn as aq,Cn as ar,wn as as,Kt as at,Xt as au,me as av,vn as aw,le as ax,rr as ay,Dn as az,xr as b,an as b0,Sr as b1,_n as b2,w as b3,gn as b4,br as c,dn as d,ct as e,Er as f,fn as g,H as h,bn as i,Y as j,Ot as k,m as l,pe as m,Pn as n,ft as o,Dt as p,d as q,xn as r,Jt as s,N as t,hn as u,re as v,B as w,Bn as x,Fn as y,T as z};
|
|
7
|
+
//# sourceMappingURL=user.BgiQzVBB.js.map
|