@powerhousedao/powerhouse-vetra-packages 6.2.0-dev.1 → 6.2.0-dev.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/browser/{connect-ZnLjvmRt.js → connect-DPNyOTBV.js} +4 -4
  2. package/dist/browser/{connect-ZnLjvmRt.js.map → connect-DPNyOTBV.js.map} +1 -1
  3. package/dist/browser/{dist-C1nRM9t2.js → dist-Bha1Om6O.js} +4 -25
  4. package/dist/browser/dist-Bha1Om6O.js.map +1 -0
  5. package/dist/browser/{dist-DLFI75Zd.js → dist-DnQpckQ8.js} +2 -2
  6. package/dist/browser/{dist-DLFI75Zd.js.map → dist-DnQpckQ8.js.map} +1 -1
  7. package/dist/browser/{document-drive-oqv68jDU.js → document-drive-CDaY4aIj.js} +5 -7
  8. package/dist/browser/document-drive-CDaY4aIj.js.map +1 -0
  9. package/dist/browser/document-models/index.js +1 -1
  10. package/dist/browser/{editor-DC3bigBu.js → editor-BtOSWTjb.js} +5 -5
  11. package/dist/browser/{editor-DC3bigBu.js.map → editor-BtOSWTjb.js.map} +1 -1
  12. package/dist/browser/{editor-CoTq6fqT.js → editor-CJFM1rC9.js} +6 -6
  13. package/dist/browser/{editor-CoTq6fqT.js.map → editor-CJFM1rC9.js.map} +1 -1
  14. package/dist/browser/editors/document-model-editor/module.js +1 -1
  15. package/dist/browser/editors/generic-drive-explorer/index.js +4 -4
  16. package/dist/browser/editors/generic-drive-explorer/module.js +1 -1
  17. package/dist/browser/{folder-view-DmYBf2pP.js → folder-view-DAhpWssS.js} +3 -3
  18. package/dist/browser/{folder-view-DmYBf2pP.js.map → folder-view-DAhpWssS.js.map} +1 -1
  19. package/dist/browser/{graphql-editor-CiGd_Li7.js → graphql-editor-Dwgpm08w.js} +3 -3
  20. package/dist/browser/{graphql-editor-CiGd_Li7.js.map → graphql-editor-Dwgpm08w.js.map} +1 -1
  21. package/dist/browser/index.js +2 -2
  22. package/dist/browser/{json-editor-sEqd5piI.js → json-editor-SKLjwlux.js} +3 -3
  23. package/dist/browser/{json-editor-sEqd5piI.js.map → json-editor-SKLjwlux.js.map} +1 -1
  24. package/dist/browser/{state-schemas-DJmzG_M8.js → state-schemas-S69fnpVk.js} +3 -3
  25. package/dist/browser/{state-schemas-DJmzG_M8.js.map → state-schemas-S69fnpVk.js.map} +1 -1
  26. package/dist/node/{connect-BLC4PXD9.mjs → connect-5a3Nx0Jd.mjs} +4 -4
  27. package/dist/node/{connect-BLC4PXD9.mjs.map → connect-5a3Nx0Jd.mjs.map} +1 -1
  28. package/dist/node/{dist-Cn3iExnV.mjs → dist-C7ZmTHz4.mjs} +2 -2
  29. package/dist/node/{dist-Cn3iExnV.mjs.map → dist-C7ZmTHz4.mjs.map} +1 -1
  30. package/dist/node/{dist-Bm05eoTg.mjs → dist-QOGgRb-y.mjs} +4 -25
  31. package/dist/node/dist-QOGgRb-y.mjs.map +1 -0
  32. package/dist/node/{document-drive-sM33juXr.mjs → document-drive-BK2-EDni.mjs} +5 -7
  33. package/dist/node/document-drive-BK2-EDni.mjs.map +1 -0
  34. package/dist/node/document-models/index.mjs +1 -1
  35. package/dist/node/{editor-BFBa9nsO.mjs → editor-BNOTRmUU.mjs} +6 -6
  36. package/dist/node/{editor-BFBa9nsO.mjs.map → editor-BNOTRmUU.mjs.map} +1 -1
  37. package/dist/node/{editor-BrS98lEH.mjs → editor-C_Gchmop.mjs} +5 -5
  38. package/dist/node/{editor-BrS98lEH.mjs.map → editor-C_Gchmop.mjs.map} +1 -1
  39. package/dist/node/editors/document-model-editor/module.mjs +1 -1
  40. package/dist/node/editors/generic-drive-explorer/index.mjs +4 -4
  41. package/dist/node/editors/generic-drive-explorer/module.mjs +1 -1
  42. package/dist/node/{folder-view-DHph3Yuu.mjs → folder-view-af4hVjjx.mjs} +3 -3
  43. package/dist/node/{folder-view-DHph3Yuu.mjs.map → folder-view-af4hVjjx.mjs.map} +1 -1
  44. package/dist/node/{graphql-editor-CPq7oIbf.mjs → graphql-editor-BoTCyC9n.mjs} +3 -3
  45. package/dist/node/{graphql-editor-CPq7oIbf.mjs.map → graphql-editor-BoTCyC9n.mjs.map} +1 -1
  46. package/dist/node/index.mjs +2 -2
  47. package/dist/node/{json-editor-L32CP7TS.mjs → json-editor-Bk4_b03g.mjs} +3 -3
  48. package/dist/node/{json-editor-L32CP7TS.mjs.map → json-editor-Bk4_b03g.mjs.map} +1 -1
  49. package/dist/node/{state-schemas-XTTjQZOe.mjs → state-schemas-DMw1UvT8.mjs} +3 -3
  50. package/dist/node/{state-schemas-XTTjQZOe.mjs.map → state-schemas-DMw1UvT8.mjs.map} +1 -1
  51. package/package.json +6 -6
  52. package/dist/browser/dist-C1nRM9t2.js.map +0 -1
  53. package/dist/browser/document-drive-oqv68jDU.js.map +0 -1
  54. package/dist/node/dist-Bm05eoTg.mjs.map +0 -1
  55. package/dist/node/document-drive-sM33juXr.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dist-Bha1Om6O.js","names":["isServer","e","t","e","t","e","n","e","t","n","e","t","e","n","e","t","n","e","e","e","e","e","isPlainObj","conditional","isNot","isDefined","constant","isStrictEqual","funnel","isTruthy","allPass","isString","once","hasAtLeast","lzString","driveCollectionId$1"],"sources":["../../../reactor-browser/dist/make-ph-event-functions-DwiD1zH9.js","../../../reactor-browser/dist/document-by-id-BrIy0iHX.js","../../../reactor-browser/dist/client-CvgFU1Dv.js","../../../reactor-browser/dist/renown-Dzmo1gJD.js","../../../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/lazyDataLastImpl-DtF3cihj.js","../../../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/purry.js","../../../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/allPass.js","../../../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/conditional-CTEJD5TX.js","../../../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/constant.js","../../../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/hasAtLeast.js","../../../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/funnel.js","../../../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isDefined.js","../../../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isNot.js","../../../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isStrictEqual.js","../../../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isString.js","../../../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/isTruthy.js","../../../../node_modules/.pnpm/remeda@2.33.7/node_modules/remeda/dist/once.js","../../../../node_modules/.pnpm/slug@11.0.1/node_modules/slug/slug.js","../../../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/descriptors.js","../../../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/aggregate.js","../../../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/cause.js","../../../../node_modules/.pnpm/is-error-instance@3.0.1/node_modules/is-error-instance/build/src/main.js","../../../../node_modules/.pnpm/is-plain-obj@4.1.0/node_modules/is-plain-obj/index.js","../../../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/create/modifiable.js","../../../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/stack.js","../../../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/create/copy.js","../../../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/create/object.js","../../../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/create/string.js","../../../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/create/main.js","../../../../node_modules/.pnpm/normalize-exception@4.0.1/node_modules/normalize-exception/build/src/main.js","../../../../node_modules/.pnpm/lz-string@1.5.0/node_modules/lz-string/libs/lz-string.js","../../../reactor-browser/dist/index.js"],"sourcesContent":["import { useSyncExternalStore } from \"react\";\nimport { capitalCase } from \"change-case\";\n//#region src/hooks/make-ph-event-functions.ts\nconst isServer = typeof window === \"undefined\";\nfunction makePHEventFunctions(key) {\n\tconst setEventName = `ph:set${capitalCase(key)}`;\n\tconst updateEventName = `ph:${key}Updated`;\n\tfunction setValue(value) {\n\t\tif (isServer) return;\n\t\tconst event = new CustomEvent(setEventName, { detail: { [key]: value } });\n\t\twindow.dispatchEvent(event);\n\t}\n\tfunction dispatchUpdatedEvent() {\n\t\tif (isServer) return;\n\t\tconst event = new CustomEvent(updateEventName);\n\t\twindow.dispatchEvent(event);\n\t}\n\tfunction handleSetValueEvent(event) {\n\t\tif (isServer) return;\n\t\tconst value = event.detail[key];\n\t\tif (!window.ph) window.ph = {};\n\t\twindow.ph[key] = value;\n\t\tdispatchUpdatedEvent();\n\t}\n\tfunction addEventHandler() {\n\t\tif (isServer) return;\n\t\twindow.addEventListener(setEventName, handleSetValueEvent);\n\t}\n\tfunction subscribeToValue(onStoreChange) {\n\t\tif (isServer) return () => {};\n\t\twindow.addEventListener(updateEventName, onStoreChange);\n\t\treturn () => {\n\t\t\twindow.removeEventListener(updateEventName, onStoreChange);\n\t\t};\n\t}\n\tfunction getSnapshot() {\n\t\tif (isServer) return;\n\t\treturn window.ph?.[key];\n\t}\n\tfunction getServerSnapshot() {}\n\tfunction useValue() {\n\t\treturn useSyncExternalStore(subscribeToValue, getSnapshot, getServerSnapshot);\n\t}\n\treturn {\n\t\tuseValue,\n\t\tsetValue,\n\t\taddEventHandler\n\t};\n}\n//#endregion\nexport { makePHEventFunctions as t };\n\n//# sourceMappingURL=make-ph-event-functions-DwiD1zH9.js.map","import { t as makePHEventFunctions } from \"./make-ph-event-functions-DwiD1zH9.js\";\nimport { logger } from \"document-model\";\nimport { buildSignedAction } from \"@powerhousedao/shared/document-model\";\nimport { DocumentChangeType } from \"@powerhousedao/reactor\";\nimport { BrowserAnalyticsStore } from \"@powerhousedao/analytics-engine-browser\";\nimport { AnalyticsQueryEngine } from \"@powerhousedao/analytics-engine-core\";\nimport { use, useCallback, useSyncExternalStore } from \"react\";\n//#region src/actions/queue.ts\nasync function queueActions(document, actionOrActions) {\n\tif (!document) throw new Error(\"No document provided\");\n\tif (!actionOrActions) throw new Error(\"No actions provided\");\n\tconst actions = Array.isArray(actionOrActions) ? actionOrActions : [actionOrActions];\n\tif (actions.length === 0) throw new Error(\"No actions provided\");\n\tconst reactorClient = window.ph?.reactorClient;\n\tif (!reactorClient) throw new Error(\"ReactorClient not initialized\");\n\treturn await reactorClient.execute(document.header.id, \"main\", actions);\n}\nasync function queueOperations(documentId, operationOrOperations) {\n\tif (!documentId) throw new Error(\"No documentId provided\");\n\tif (!operationOrOperations) throw new Error(\"No operations provided\");\n\tconst operations = Array.isArray(operationOrOperations) ? operationOrOperations : [operationOrOperations];\n\tif (operations.length === 0) throw new Error(\"No operations provided\");\n\tconst reactorClient = window.ph?.reactorClient;\n\tif (!reactorClient) throw new Error(\"ReactorClient not initialized\");\n\tconst actions = operations.map((op) => op.action);\n\treturn await reactorClient.execute(documentId, \"main\", actions);\n}\nasync function uploadOperations(documentId, allOperations, pushOperations, options) {\n\tconst operationsLimit = options?.operationsLimit || 50;\n\tconst onProgress = options?.onProgress;\n\tlogger.verbose(`uploadDocumentOperations(documentId:${documentId}, ops: ${Object.keys(allOperations).join(\",\")}, limit:${operationsLimit})`);\n\tconst allOperationsArray = Object.values(allOperations).filter((ops) => ops !== void 0);\n\tconst totalOperations = allOperationsArray.reduce((total, operations) => total + operations.length, 0);\n\tlet uploadedOperations = 0;\n\tfor (const operations of allOperationsArray) for (let i = 0; i < operations.length; i += operationsLimit) {\n\t\tlogger.verbose(`uploadDocumentOperations:for(i:${i}, ops:${operations.length}, limit:${operationsLimit}): START`);\n\t\tconst chunk = operations.slice(i, i + operationsLimit);\n\t\tconst operation = chunk.at(-1);\n\t\tif (!operation) break;\n\t\tconst scope = operation.action.scope;\n\t\tawait pushOperations(documentId, chunk);\n\t\tuploadedOperations += chunk.length;\n\t\tif (onProgress) onProgress({\n\t\t\tstage: \"uploading\",\n\t\t\tprogress: Math.round(uploadedOperations / totalOperations * 100),\n\t\t\ttotalOperations,\n\t\t\tuploadedOperations\n\t\t});\n\t\tlogger.verbose(`uploadDocumentOperations:for:waitForUpdate(${documentId}:${scope} rev ${operation.index}): NEXT`);\n\t}\n\tlogger.verbose(`uploadDocumentOperations:for:waitForUpdate(${documentId}): END`);\n}\n//#endregion\n//#region src/actions/sign.ts\nasync function signAction(action, document) {\n\tconst reactor = window.ph?.reactorClient;\n\tif (!reactor) return action;\n\tconst reducer = (await reactor.getDocumentModelModule(document.header.documentType)).reducer;\n\tconst renown = window.ph?.renown;\n\tif (!renown?.user) return action;\n\tif (!action.context?.signer) return action;\n\tconst actionSigner = action.context.signer;\n\treturn await buildSignedAction(action, reducer, document, actionSigner, renown.crypto.sign);\n}\nfunction addActionContext(action) {\n\tconst renown = window.ph?.renown;\n\tif (!renown?.user) return action;\n\treturn {\n\t\tcontext: { signer: {\n\t\t\tapp: {\n\t\t\t\tname: \"Connect\",\n\t\t\t\tkey: renown.did\n\t\t\t},\n\t\t\tuser: {\n\t\t\t\taddress: renown.user.address,\n\t\t\t\tnetworkId: renown.user.networkId,\n\t\t\t\tchainId: renown.user.chainId\n\t\t\t},\n\t\t\tsignatures: []\n\t\t} },\n\t\t...action\n\t};\n}\nasync function makeSignedActionWithContext(action, document) {\n\tif (!action) {\n\t\tlogger.error(\"No action found\");\n\t\treturn;\n\t}\n\tif (!document) {\n\t\tlogger.error(\"No document found\");\n\t\treturn;\n\t}\n\treturn addActionContext(await signAction(action, document));\n}\nasync function makeSignedActionsWithContext(actionOrActions, document) {\n\tif (!actionOrActions) {\n\t\tlogger.error(\"No actions found\");\n\t\treturn;\n\t}\n\tconst actions = Array.isArray(actionOrActions) ? actionOrActions : [actionOrActions];\n\treturn (await Promise.all(actions.map((action) => makeSignedActionWithContext(action, document)))).filter((a) => a !== void 0);\n}\n//#endregion\n//#region src/actions/dispatch.ts\nasync function getDocument(documentId) {\n\ttry {\n\t\treturn await window.ph?.reactorClient?.get(documentId);\n\t} catch (error) {\n\t\tlogger.debug(`Failed to get document with id ${documentId}:`, error);\n\t\treturn;\n\t}\n}\nfunction getActionErrors(result, actions) {\n\treturn actions.reduce((errors, a) => {\n\t\tconst scopeOperations = result.operations[a.scope];\n\t\tif (!scopeOperations) return errors;\n\t\tconst op = scopeOperations.findLast((op) => op.action.id === a.id);\n\t\tif (op?.error) errors.push(new Error(op.error));\n\t\treturn errors;\n\t}, new Array());\n}\nasync function dispatchActions(actionOrActions, documentOrDocumentId, onErrors, onSuccess) {\n\tconst document = typeof documentOrDocumentId === \"string\" ? await getDocument(documentOrDocumentId) : documentOrDocumentId;\n\tif (!document) {\n\t\tlogger.error(`Document with id ${JSON.stringify(documentOrDocumentId)} not found`);\n\t\treturn;\n\t}\n\tconst signedActionsWithContext = await makeSignedActionsWithContext(actionOrActions, document);\n\tif (!signedActionsWithContext) {\n\t\tlogger.error(\"No signed actions with context found\");\n\t\treturn;\n\t}\n\tconst result = await queueActions(document, signedActionsWithContext);\n\tif (onErrors && result) {\n\t\tconst errors = getActionErrors(result, signedActionsWithContext);\n\t\tif (errors.length) onErrors(errors);\n\t}\n\tif (onSuccess && result) onSuccess(result);\n\treturn result;\n}\n//#endregion\n//#region src/global/core.ts\nfunction getGlobal(namespace) {\n\tif (typeof window === \"undefined\") return void 0;\n\treturn window.powerhouse?.[namespace];\n}\nfunction setGlobal(namespace, value) {\n\tif (typeof window === \"undefined\") return;\n\twindow.powerhouse = window.powerhouse || {};\n\twindow.powerhouse[namespace] = value;\n}\nfunction clearGlobal(namespace) {\n\tif (typeof window === \"undefined\") return;\n\tif (window.powerhouse?.[namespace]) {\n\t\tdelete window.powerhouse[namespace];\n\t\tif (Object.keys(window.powerhouse).length === 0) delete window.powerhouse;\n\t}\n}\n//#endregion\n//#region src/analytics/store.ts\nasync function createAnalyticsStore(options) {\n\tconst store = new BrowserAnalyticsStore(options);\n\tawait store.init();\n\treturn {\n\t\tstore,\n\t\tengine: new AnalyticsQueryEngine(store),\n\t\toptions\n\t};\n}\nasync function getAnalyticsStore() {\n\treturn (await getGlobal(\"analytics\"))?.store ?? null;\n}\n//#endregion\n//#region src/document-cache.ts\nfunction addPromiseState(promise) {\n\tif (\"status\" in promise) return promise;\n\tconst promiseWithState = promise;\n\tpromiseWithState.status = \"pending\";\n\tpromiseWithState.then((value) => {\n\t\tpromiseWithState.status = \"fulfilled\";\n\t\tpromiseWithState.value = value;\n\t}, (reason) => {\n\t\tpromiseWithState.status = \"rejected\";\n\t\tpromiseWithState.reason = reason;\n\t\tthrow reason;\n\t});\n\treturn promiseWithState;\n}\nfunction readPromiseState(promise) {\n\treturn \"status\" in promise ? promise : { status: \"pending\" };\n}\n/**\n* Resolves an array of document promises using `Promise.allSettled`,\n* returning only the fulfilled values. A single missing/rejected\n* document does not poison the whole batch. Rejected entries are\n* logged at warn level so developers can see dangling references.\n*/\nfunction fulfilledOnly(promises) {\n\treturn Promise.allSettled(promises).then((results) => {\n\t\tconst documents = [];\n\t\tfor (const result of results) if (result.status === \"fulfilled\") documents.push(result.value);\n\t\telse console.warn(\"[DocumentCache] Skipped unavailable document:\", result.reason);\n\t\treturn documents;\n\t});\n}\n/**\n* Document cache implementation that uses the new ReactorClient API.\n*\n* This cache subscribes to document change events via IReactorClient.subscribe()\n* and automatically updates the cache when documents are created, updated, or deleted.\n*/\nvar DocumentCache = class {\n\tdocuments = /* @__PURE__ */ new Map();\n\tbatchPromises = /* @__PURE__ */ new Map();\n\tlisteners = /* @__PURE__ */ new Map();\n\tunsubscribe = null;\n\tconstructor(client) {\n\t\tthis.client = client;\n\t\tthis.unsubscribe = client.subscribe({}, (event) => {\n\t\t\tthis.handleDocumentChange(event);\n\t\t});\n\t}\n\thandleDocumentChange(event) {\n\t\tif (event.type === DocumentChangeType.Deleted) {\n\t\t\tconst documentId = event.context?.childId;\n\t\t\tif (documentId) this.handleDocumentDeleted(documentId);\n\t\t} else if (event.type === DocumentChangeType.Updated) for (const doc of event.documents) this.handleDocumentUpdated(doc.header.id).catch(console.warn);\n\t}\n\thandleDocumentDeleted(documentId) {\n\t\tconst listeners = this.listeners.get(documentId);\n\t\tthis.documents.delete(documentId);\n\t\tthis.invalidateBatchesContaining(documentId);\n\t\tif (listeners) listeners.forEach((listener) => listener());\n\t\tthis.listeners.delete(documentId);\n\t}\n\tasync handleDocumentUpdated(documentId) {\n\t\tif (this.documents.has(documentId)) {\n\t\t\tawait this.get(documentId, true);\n\t\t\tconst listeners = this.listeners.get(documentId);\n\t\t\tif (listeners) listeners.forEach((listener) => listener());\n\t\t}\n\t}\n\tinvalidateBatchesContaining(documentId) {\n\t\tfor (const key of this.batchPromises.keys()) if (key.split(\",\").includes(documentId)) this.batchPromises.delete(key);\n\t}\n\tget(id, refetch) {\n\t\tconst currentData = this.documents.get(id);\n\t\tif (currentData) {\n\t\t\tif (currentData.status === \"pending\") return currentData;\n\t\t\tif (!refetch) return currentData;\n\t\t}\n\t\tconst documentPromise = this.client.get(id);\n\t\tthis.documents.set(id, addPromiseState(documentPromise));\n\t\treturn documentPromise;\n\t}\n\tgetBatch(ids) {\n\t\tconst key = ids.join(\",\");\n\t\tconst cached = this.batchPromises.get(key);\n\t\tconst hasDeletedDocuments = ids.some((id) => !this.documents.has(id));\n\t\tconst currentPromises = ids.map((id) => this.get(id));\n\t\tif (hasDeletedDocuments) {\n\t\t\tconst batchPromise = fulfilledOnly(currentPromises);\n\t\t\tthis.batchPromises.set(key, {\n\t\t\t\tpromises: currentPromises,\n\t\t\t\tpromise: batchPromise\n\t\t\t});\n\t\t\treturn batchPromise;\n\t\t}\n\t\tif (cached) {\n\t\t\tif (currentPromises.every((p, i) => p === cached.promises[i])) return cached.promise;\n\t\t}\n\t\tconst states = currentPromises.map((p) => readPromiseState(p));\n\t\tif (states.every((s) => s.status !== \"pending\")) {\n\t\t\tconst values = states.filter((s) => s.status === \"fulfilled\").map((s) => s.value);\n\t\t\tconst batchPromise = Promise.resolve(values);\n\t\t\tbatchPromise.status = \"fulfilled\";\n\t\t\tbatchPromise.value = values;\n\t\t\tthis.batchPromises.set(key, {\n\t\t\t\tpromises: currentPromises,\n\t\t\t\tpromise: batchPromise\n\t\t\t});\n\t\t\treturn batchPromise;\n\t\t}\n\t\tif (cached) return cached.promise;\n\t\tconst batchPromise = fulfilledOnly(currentPromises);\n\t\tthis.batchPromises.set(key, {\n\t\t\tpromises: currentPromises,\n\t\t\tpromise: batchPromise\n\t\t});\n\t\treturn batchPromise;\n\t}\n\tsubscribe(id, callback) {\n\t\tconst ids = Array.isArray(id) ? id : [id];\n\t\tfor (const docId of ids) {\n\t\t\tconst listeners = this.listeners.get(docId) ?? [];\n\t\t\tthis.listeners.set(docId, [...listeners, callback]);\n\t\t}\n\t\treturn () => {\n\t\t\tfor (const docId of ids) {\n\t\t\t\tconst listeners = this.listeners.get(docId) ?? [];\n\t\t\t\tthis.listeners.set(docId, listeners.filter((listener) => listener !== callback));\n\t\t\t}\n\t\t};\n\t}\n\t/**\n\t* Disposes of the cache and unsubscribes from document change events.\n\t*/\n\tdispose() {\n\t\tif (this.unsubscribe) {\n\t\t\tthis.unsubscribe();\n\t\t\tthis.unsubscribe = null;\n\t\t}\n\t}\n};\n//#endregion\n//#region src/hooks/document-cache.ts\nconst documentEventFunctions = makePHEventFunctions(\"documentCache\");\n/** Returns all documents in the reactor. */\nconst useDocumentCache = documentEventFunctions.useValue;\n/** Sets all of the documents in the reactor. */\nconst setDocumentCache = documentEventFunctions.setValue;\n/** Adds an event handler for all of the documents in the reactor. */\nconst addDocumentCacheEventHandler = documentEventFunctions.addEventHandler;\n/**\n* Reads the state of a document promise and converts it to a query state object.\n* @param promise - The document promise to read\n* @returns An object containing the status, data, error, and isPending flag\n*/\nfunction getDocumentQueryState(promise) {\n\tconst state = readPromiseState(promise);\n\tswitch (state.status) {\n\t\tcase \"pending\": return {\n\t\t\tstatus: \"pending\",\n\t\t\tisPending: true,\n\t\t\terror: void 0,\n\t\t\tdata: void 0\n\t\t};\n\t\tcase \"fulfilled\": return {\n\t\t\tstatus: \"success\",\n\t\t\tisPending: false,\n\t\t\terror: void 0,\n\t\t\tdata: state.value\n\t\t};\n\t\tcase \"rejected\": return {\n\t\t\tstatus: \"error\",\n\t\t\tisPending: false,\n\t\t\terror: state.reason,\n\t\t\tdata: void 0\n\t\t};\n\t}\n}\n/**\n* Retrieves a document from the reactor and subscribes to changes using React Suspense.\n* This hook will suspend rendering while the document is loading.\n* @param id - The document ID to retrieve, or null/undefined to skip retrieval\n* @returns The document if found, or undefined if id is null/undefined\n*/\nfunction useDocument(id) {\n\tconst documentCache = useDocumentCache();\n\tconst document = useSyncExternalStore((cb) => id && documentCache ? documentCache.subscribe(id, cb) : () => {}, () => id ? documentCache?.get(id) : void 0);\n\treturn document ? use(document) : void 0;\n}\n/**\n* Retrieves a document from the reactor and subscribes to changes without\n* suspending or throwing. Use this when the ID might be stale (e.g., a\n* previously selected node that has since been deleted) and the consumer\n* wants to render a placeholder instead of crashing.\n*\n* Unlike {@link useGetDocumentAsync}, this hook subscribes to cache\n* updates, so the returned state stays in sync with reactor changes.\n*\n* @param id - The document ID to retrieve, or null/undefined to skip retrieval\n* @returns An object containing:\n* - status: \"initial\" | \"pending\" | \"success\" | \"error\"\n* - data: The document if successfully loaded\n* - isPending: Whether the document is currently loading\n* - error: Any error that occurred during loading (e.g., document not found)\n* - reload: Function to force a refetch, or undefined when no id is supplied\n*/\nfunction useDocumentSafe(id) {\n\tconst documentCache = useDocumentCache();\n\tconst promise = useSyncExternalStore((cb) => id && documentCache ? documentCache.subscribe(id, cb) : () => {}, () => id ? documentCache?.get(id) : void 0);\n\tif (!promise || !documentCache || !id) return {\n\t\tstatus: \"initial\",\n\t\tisPending: false,\n\t\terror: void 0,\n\t\tdata: void 0,\n\t\treload: void 0\n\t};\n\treturn {\n\t\t...getDocumentQueryState(promise),\n\t\treload: () => documentCache.get(id, true)\n\t};\n}\n/**\n* Retrieves multiple documents from the reactor using React Suspense.\n* This hook will suspend rendering while any of the documents are loading.\n*\n* Uses getBatch from the document cache which handles promise caching internally,\n* ensuring stable references for useSyncExternalStore.\n*\n* @param ids - Array of document IDs to retrieve, or null/undefined to skip retrieval\n* @returns An array of documents if found, or empty array if ids is null/undefined\n*/\nfunction useDocuments(ids) {\n\tconst documentCache = useDocumentCache();\n\tconst documents = useSyncExternalStore((cb) => ids?.length && documentCache ? documentCache.subscribe(ids, cb) : () => {}, () => ids?.length && documentCache ? documentCache.getBatch(ids) : void 0);\n\treturn documents ? use(documents) : [];\n}\n/**\n* Returns a function to retrieve a document from the cache.\n* The returned function fetches and returns a document by ID.\n* @returns A function that takes a document ID and returns a Promise of the document\n*/\nfunction useGetDocument() {\n\tconst documentCache = useDocumentCache();\n\treturn useCallback((id) => {\n\t\tif (!documentCache) return Promise.reject(/* @__PURE__ */ new Error(\"Document cache not initialized\"));\n\t\treturn documentCache.get(id);\n\t}, [documentCache]);\n}\n/**\n* Returns a function to retrieve multiple documents from the cache.\n* The returned function fetches and returns documents by their IDs.\n* @returns A function that takes an array of document IDs and returns a Promise of the documents\n*/\nfunction useGetDocuments() {\n\tconst documentCache = useDocumentCache();\n\treturn useCallback((ids) => {\n\t\tif (!documentCache) return Promise.reject(/* @__PURE__ */ new Error(\"Document cache not initialized\"));\n\t\treturn documentCache.getBatch(ids);\n\t}, [documentCache]);\n}\n/**\n* Retrieves a document from the reactor without suspending rendering.\n* Returns the current state of the document loading operation.\n* @param id - The document ID to retrieve, or null/undefined to skip retrieval\n* @returns An object containing:\n* - status: \"initial\" | \"pending\" | \"success\" | \"error\"\n* - data: The document if successfully loaded\n* - isPending: Boolean indicating if the document is currently loading\n* - error: Any error that occurred during loading\n* - reload: Function to force reload the document from cache\n*/\nfunction useGetDocumentAsync(id) {\n\tconst documentCache = useDocumentCache();\n\tif (!id || !documentCache) return {\n\t\tstatus: \"initial\",\n\t\tdata: void 0,\n\t\tisPending: false,\n\t\terror: void 0,\n\t\treload: void 0\n\t};\n\treturn {\n\t\t...getDocumentQueryState(documentCache.get(id)),\n\t\treload: () => documentCache.get(id, true)\n\t};\n}\n//#endregion\n//#region src/hooks/dispatch.ts\nfunction useDispatch(document) {\n\t/**\n\t* Dispatches actions to the document.\n\t* @param actionOrActions - The action or actions to dispatch.\n\t* @param onErrors - Callback invoked with any errors that occurred during action execution.\n\t*/\n\tfunction dispatch(actionOrActions, onErrors, onSuccess) {\n\t\tdispatchActions(actionOrActions, document, onErrors, onSuccess).catch(logger.error);\n\t}\n\treturn [document, dispatch];\n}\n//#endregion\n//#region src/hooks/document-by-id.ts\n/** Returns a document by id. */\nfunction useDocumentById(id) {\n\tconst document = useDocument(id);\n\tconst [, dispatch] = useDispatch(document);\n\treturn [document, dispatch];\n}\n/** Returns documents by ids. */\nfunction useDocumentsByIds(ids) {\n\treturn useDocuments(ids);\n}\n//#endregion\nexport { queueOperations as C, queueActions as S, getAnalyticsStore as _, setDocumentCache as a, setGlobal as b, useDocumentSafe as c, useGetDocumentAsync as d, useGetDocuments as f, createAnalyticsStore as g, readPromiseState as h, addDocumentCacheEventHandler as i, useDocuments as l, addPromiseState as m, useDocumentsByIds as n, useDocument as o, DocumentCache as p, useDispatch as r, useDocumentCache as s, useDocumentById as t, useGetDocument as u, clearGlobal as v, uploadOperations as w, dispatchActions as x, getGlobal as y };\n\n//# sourceMappingURL=document-by-id-BrIy0iHX.js.map","import { GraphQLClient } from \"graphql-request\";\nimport { gql } from \"graphql-tag\";\n//#region src/graphql/gen/schema.ts\nlet PropagationMode = /* @__PURE__ */ function(PropagationMode) {\n\tPropagationMode[\"Cascade\"] = \"CASCADE\";\n\tPropagationMode[\"Orphan\"] = \"ORPHAN\";\n\treturn PropagationMode;\n}({});\nconst PhDocumentFieldsFragmentDoc = gql`\n fragment PHDocumentFields on PHDocument {\n id\n slug\n name\n documentType\n state\n revisionsList {\n scope\n revision\n }\n createdAtUtcIso\n lastModifiedAtUtcIso\n }\n`;\nconst GetDocumentModelsDocument = gql`\n query GetDocumentModels($namespace: String, $paging: PagingInput) {\n documentModels(namespace: $namespace, paging: $paging) {\n items {\n id\n name\n namespace\n version\n specification\n }\n totalCount\n hasNextPage\n hasPreviousPage\n cursor\n }\n }\n`;\nconst GetDocumentDocument = gql`\n query GetDocument($identifier: String!, $view: ViewFilterInput) {\n document(identifier: $identifier, view: $view) {\n document {\n ...PHDocumentFields\n }\n childIds\n }\n }\n ${PhDocumentFieldsFragmentDoc}\n`;\nconst GetDocumentWithOperationsDocument = gql`\n query GetDocumentWithOperations(\n $identifier: String!\n $view: ViewFilterInput\n $operationsFilter: DocumentOperationsFilterInput\n $operationsPaging: PagingInput\n ) {\n document(identifier: $identifier, view: $view) {\n document {\n ...PHDocumentFields\n operations(filter: $operationsFilter, paging: $operationsPaging) {\n items {\n index\n timestampUtcMs\n hash\n skip\n error\n id\n action {\n id\n type\n timestampUtcMs\n input\n scope\n context {\n signer {\n user {\n address\n networkId\n chainId\n }\n app {\n name\n key\n }\n signatures\n }\n }\n }\n }\n totalCount\n hasNextPage\n hasPreviousPage\n cursor\n }\n }\n childIds\n }\n }\n ${PhDocumentFieldsFragmentDoc}\n`;\nconst GetDocumentOutgoingRelationshipsDocument = gql`\n query GetDocumentOutgoingRelationships(\n $sourceIdentifier: String!\n $relationshipType: String!\n $view: ViewFilterInput\n $paging: PagingInput\n ) {\n documentOutgoingRelationships(\n sourceIdentifier: $sourceIdentifier\n relationshipType: $relationshipType\n view: $view\n paging: $paging\n ) {\n items {\n ...PHDocumentFields\n }\n totalCount\n hasNextPage\n hasPreviousPage\n cursor\n }\n }\n ${PhDocumentFieldsFragmentDoc}\n`;\nconst GetDocumentIncomingRelationshipsDocument = gql`\n query GetDocumentIncomingRelationships(\n $targetIdentifier: String!\n $relationshipType: String!\n $view: ViewFilterInput\n $paging: PagingInput\n ) {\n documentIncomingRelationships(\n targetIdentifier: $targetIdentifier\n relationshipType: $relationshipType\n view: $view\n paging: $paging\n ) {\n items {\n ...PHDocumentFields\n }\n totalCount\n hasNextPage\n hasPreviousPage\n cursor\n }\n }\n ${PhDocumentFieldsFragmentDoc}\n`;\nconst FindDocumentsDocument = gql`\n query FindDocuments(\n $search: SearchFilterInput\n $view: ViewFilterInput\n $paging: PagingInput\n ) {\n findDocuments(search: $search, view: $view, paging: $paging) {\n items {\n ...PHDocumentFields\n }\n totalCount\n hasNextPage\n hasPreviousPage\n cursor\n }\n }\n ${PhDocumentFieldsFragmentDoc}\n`;\nconst GetDocumentOperationsDocument = gql`\n query GetDocumentOperations(\n $filter: OperationsFilterInput!\n $paging: PagingInput\n ) {\n documentOperations(filter: $filter, paging: $paging) {\n items {\n index\n timestampUtcMs\n hash\n skip\n error\n id\n action {\n id\n type\n timestampUtcMs\n input\n scope\n context {\n signer {\n user {\n address\n networkId\n chainId\n }\n app {\n name\n key\n }\n signatures\n }\n }\n }\n }\n totalCount\n hasNextPage\n hasPreviousPage\n cursor\n }\n }\n`;\nconst GetJobStatusDocument = gql`\n query GetJobStatus($jobId: String!) {\n jobStatus(jobId: $jobId) {\n id\n status\n result\n error\n createdAt\n completedAt\n }\n }\n`;\nconst CreateDocumentDocument = gql`\n mutation CreateDocument($document: JSONObject!, $parentIdentifier: String) {\n createDocument(document: $document, parentIdentifier: $parentIdentifier) {\n ...PHDocumentFields\n }\n }\n ${PhDocumentFieldsFragmentDoc}\n`;\nconst CreateEmptyDocumentDocument = gql`\n mutation CreateEmptyDocument(\n $documentType: String!\n $parentIdentifier: String\n ) {\n createEmptyDocument(\n documentType: $documentType\n parentIdentifier: $parentIdentifier\n ) {\n ...PHDocumentFields\n }\n }\n ${PhDocumentFieldsFragmentDoc}\n`;\nconst MutateDocumentDocument = gql`\n mutation MutateDocument(\n $documentIdentifier: String!\n $actions: [JSONObject!]!\n $view: ViewFilterInput\n ) {\n mutateDocument(\n documentIdentifier: $documentIdentifier\n actions: $actions\n view: $view\n ) {\n ...PHDocumentFields\n }\n }\n ${PhDocumentFieldsFragmentDoc}\n`;\nconst MutateDocumentAsyncDocument = gql`\n mutation MutateDocumentAsync(\n $documentIdentifier: String!\n $actions: [JSONObject!]!\n $view: ViewFilterInput\n ) {\n mutateDocumentAsync(\n documentIdentifier: $documentIdentifier\n actions: $actions\n view: $view\n )\n }\n`;\nconst RenameDocumentDocument = gql`\n mutation RenameDocument(\n $documentIdentifier: String!\n $name: String!\n $branch: String\n ) {\n renameDocument(\n documentIdentifier: $documentIdentifier\n name: $name\n branch: $branch\n ) {\n ...PHDocumentFields\n }\n }\n ${PhDocumentFieldsFragmentDoc}\n`;\nconst SetPreferredEditorDocument = gql`\n mutation SetPreferredEditor(\n $documentIdentifier: String!\n $preferredEditor: String\n $branch: String\n ) {\n setPreferredEditor(\n documentIdentifier: $documentIdentifier\n preferredEditor: $preferredEditor\n branch: $branch\n ) {\n ...PHDocumentFields\n }\n }\n ${PhDocumentFieldsFragmentDoc}\n`;\nconst AddRelationshipDocument = gql`\n mutation AddRelationship(\n $sourceIdentifier: String!\n $targetIdentifier: String!\n $relationshipType: String!\n $branch: String\n ) {\n addRelationship(\n sourceIdentifier: $sourceIdentifier\n targetIdentifier: $targetIdentifier\n relationshipType: $relationshipType\n branch: $branch\n ) {\n ...PHDocumentFields\n }\n }\n ${PhDocumentFieldsFragmentDoc}\n`;\nconst RemoveRelationshipDocument = gql`\n mutation RemoveRelationship(\n $sourceIdentifier: String!\n $targetIdentifier: String!\n $relationshipType: String!\n $branch: String\n ) {\n removeRelationship(\n sourceIdentifier: $sourceIdentifier\n targetIdentifier: $targetIdentifier\n relationshipType: $relationshipType\n branch: $branch\n ) {\n ...PHDocumentFields\n }\n }\n ${PhDocumentFieldsFragmentDoc}\n`;\nconst MoveRelationshipDocument = gql`\n mutation MoveRelationship(\n $sourceParentIdentifier: String!\n $targetParentIdentifier: String!\n $targetIdentifier: String!\n $relationshipType: String!\n $branch: String\n ) {\n moveRelationship(\n sourceParentIdentifier: $sourceParentIdentifier\n targetParentIdentifier: $targetParentIdentifier\n targetIdentifier: $targetIdentifier\n relationshipType: $relationshipType\n branch: $branch\n ) {\n source {\n ...PHDocumentFields\n }\n target {\n ...PHDocumentFields\n }\n }\n }\n ${PhDocumentFieldsFragmentDoc}\n`;\nconst DeleteDocumentDocument = gql`\n mutation DeleteDocument($identifier: String!, $propagate: PropagationMode) {\n deleteDocument(identifier: $identifier, propagate: $propagate)\n }\n`;\nconst DeleteDocumentsDocument = gql`\n mutation DeleteDocuments(\n $identifiers: [String!]!\n $propagate: PropagationMode\n ) {\n deleteDocuments(identifiers: $identifiers, propagate: $propagate)\n }\n`;\nconst DocumentChangesDocument = gql`\n subscription DocumentChanges(\n $search: SearchFilterInput\n $view: ViewFilterInput\n ) {\n documentChanges(search: $search, view: $view) {\n type\n documents {\n ...PHDocumentFields\n }\n context {\n parentId\n childId\n }\n }\n }\n ${PhDocumentFieldsFragmentDoc}\n`;\nconst JobChangesDocument = gql`\n subscription JobChanges($jobId: String!) {\n jobChanges(jobId: $jobId) {\n jobId\n status\n result\n error\n }\n }\n`;\nconst PollSyncEnvelopesDocument = gql`\n query PollSyncEnvelopes(\n $channelId: String!\n $outboxAck: Int!\n $outboxLatest: Int!\n ) {\n pollSyncEnvelopes(\n channelId: $channelId\n outboxAck: $outboxAck\n outboxLatest: $outboxLatest\n ) {\n envelopes {\n type\n channelMeta {\n id\n }\n operations {\n operation {\n index\n timestampUtcMs\n hash\n skip\n error\n id\n action {\n id\n type\n timestampUtcMs\n input\n scope\n context {\n signer {\n user {\n address\n networkId\n chainId\n }\n app {\n name\n key\n }\n signatures\n }\n }\n }\n }\n context {\n documentId\n documentType\n scope\n branch\n }\n }\n cursor {\n remoteName\n cursorOrdinal\n lastSyncedAtUtcMs\n }\n key\n dependsOn\n }\n ackOrdinal\n deadLetters {\n documentId\n error\n }\n hasMore\n }\n }\n`;\nconst TouchChannelDocument = gql`\n mutation TouchChannel($input: TouchChannelInput!) {\n touchChannel(input: $input) {\n success\n ackOrdinal\n }\n }\n`;\nconst PushSyncEnvelopesDocument = gql`\n mutation PushSyncEnvelopes($envelopes: [SyncEnvelopeInput!]!) {\n pushSyncEnvelopes(envelopes: $envelopes)\n }\n`;\nconst defaultWrapper = (action, _operationName, _operationType, _variables) => action();\nfunction getSdk(client, withWrapper = defaultWrapper) {\n\treturn {\n\t\tGetDocumentModels(variables, requestHeaders, signal) {\n\t\t\treturn withWrapper((wrappedRequestHeaders) => client.request({\n\t\t\t\tdocument: GetDocumentModelsDocument,\n\t\t\t\tvariables,\n\t\t\t\trequestHeaders: {\n\t\t\t\t\t...requestHeaders,\n\t\t\t\t\t...wrappedRequestHeaders\n\t\t\t\t},\n\t\t\t\tsignal\n\t\t\t}), \"GetDocumentModels\", \"query\", variables);\n\t\t},\n\t\tGetDocument(variables, requestHeaders, signal) {\n\t\t\treturn withWrapper((wrappedRequestHeaders) => client.request({\n\t\t\t\tdocument: GetDocumentDocument,\n\t\t\t\tvariables,\n\t\t\t\trequestHeaders: {\n\t\t\t\t\t...requestHeaders,\n\t\t\t\t\t...wrappedRequestHeaders\n\t\t\t\t},\n\t\t\t\tsignal\n\t\t\t}), \"GetDocument\", \"query\", variables);\n\t\t},\n\t\tGetDocumentWithOperations(variables, requestHeaders, signal) {\n\t\t\treturn withWrapper((wrappedRequestHeaders) => client.request({\n\t\t\t\tdocument: GetDocumentWithOperationsDocument,\n\t\t\t\tvariables,\n\t\t\t\trequestHeaders: {\n\t\t\t\t\t...requestHeaders,\n\t\t\t\t\t...wrappedRequestHeaders\n\t\t\t\t},\n\t\t\t\tsignal\n\t\t\t}), \"GetDocumentWithOperations\", \"query\", variables);\n\t\t},\n\t\tGetDocumentOutgoingRelationships(variables, requestHeaders, signal) {\n\t\t\treturn withWrapper((wrappedRequestHeaders) => client.request({\n\t\t\t\tdocument: GetDocumentOutgoingRelationshipsDocument,\n\t\t\t\tvariables,\n\t\t\t\trequestHeaders: {\n\t\t\t\t\t...requestHeaders,\n\t\t\t\t\t...wrappedRequestHeaders\n\t\t\t\t},\n\t\t\t\tsignal\n\t\t\t}), \"GetDocumentOutgoingRelationships\", \"query\", variables);\n\t\t},\n\t\tGetDocumentIncomingRelationships(variables, requestHeaders, signal) {\n\t\t\treturn withWrapper((wrappedRequestHeaders) => client.request({\n\t\t\t\tdocument: GetDocumentIncomingRelationshipsDocument,\n\t\t\t\tvariables,\n\t\t\t\trequestHeaders: {\n\t\t\t\t\t...requestHeaders,\n\t\t\t\t\t...wrappedRequestHeaders\n\t\t\t\t},\n\t\t\t\tsignal\n\t\t\t}), \"GetDocumentIncomingRelationships\", \"query\", variables);\n\t\t},\n\t\tFindDocuments(variables, requestHeaders, signal) {\n\t\t\treturn withWrapper((wrappedRequestHeaders) => client.request({\n\t\t\t\tdocument: FindDocumentsDocument,\n\t\t\t\tvariables,\n\t\t\t\trequestHeaders: {\n\t\t\t\t\t...requestHeaders,\n\t\t\t\t\t...wrappedRequestHeaders\n\t\t\t\t},\n\t\t\t\tsignal\n\t\t\t}), \"FindDocuments\", \"query\", variables);\n\t\t},\n\t\tGetDocumentOperations(variables, requestHeaders, signal) {\n\t\t\treturn withWrapper((wrappedRequestHeaders) => client.request({\n\t\t\t\tdocument: GetDocumentOperationsDocument,\n\t\t\t\tvariables,\n\t\t\t\trequestHeaders: {\n\t\t\t\t\t...requestHeaders,\n\t\t\t\t\t...wrappedRequestHeaders\n\t\t\t\t},\n\t\t\t\tsignal\n\t\t\t}), \"GetDocumentOperations\", \"query\", variables);\n\t\t},\n\t\tGetJobStatus(variables, requestHeaders, signal) {\n\t\t\treturn withWrapper((wrappedRequestHeaders) => client.request({\n\t\t\t\tdocument: GetJobStatusDocument,\n\t\t\t\tvariables,\n\t\t\t\trequestHeaders: {\n\t\t\t\t\t...requestHeaders,\n\t\t\t\t\t...wrappedRequestHeaders\n\t\t\t\t},\n\t\t\t\tsignal\n\t\t\t}), \"GetJobStatus\", \"query\", variables);\n\t\t},\n\t\tCreateDocument(variables, requestHeaders, signal) {\n\t\t\treturn withWrapper((wrappedRequestHeaders) => client.request({\n\t\t\t\tdocument: CreateDocumentDocument,\n\t\t\t\tvariables,\n\t\t\t\trequestHeaders: {\n\t\t\t\t\t...requestHeaders,\n\t\t\t\t\t...wrappedRequestHeaders\n\t\t\t\t},\n\t\t\t\tsignal\n\t\t\t}), \"CreateDocument\", \"mutation\", variables);\n\t\t},\n\t\tCreateEmptyDocument(variables, requestHeaders, signal) {\n\t\t\treturn withWrapper((wrappedRequestHeaders) => client.request({\n\t\t\t\tdocument: CreateEmptyDocumentDocument,\n\t\t\t\tvariables,\n\t\t\t\trequestHeaders: {\n\t\t\t\t\t...requestHeaders,\n\t\t\t\t\t...wrappedRequestHeaders\n\t\t\t\t},\n\t\t\t\tsignal\n\t\t\t}), \"CreateEmptyDocument\", \"mutation\", variables);\n\t\t},\n\t\tMutateDocument(variables, requestHeaders, signal) {\n\t\t\treturn withWrapper((wrappedRequestHeaders) => client.request({\n\t\t\t\tdocument: MutateDocumentDocument,\n\t\t\t\tvariables,\n\t\t\t\trequestHeaders: {\n\t\t\t\t\t...requestHeaders,\n\t\t\t\t\t...wrappedRequestHeaders\n\t\t\t\t},\n\t\t\t\tsignal\n\t\t\t}), \"MutateDocument\", \"mutation\", variables);\n\t\t},\n\t\tMutateDocumentAsync(variables, requestHeaders, signal) {\n\t\t\treturn withWrapper((wrappedRequestHeaders) => client.request({\n\t\t\t\tdocument: MutateDocumentAsyncDocument,\n\t\t\t\tvariables,\n\t\t\t\trequestHeaders: {\n\t\t\t\t\t...requestHeaders,\n\t\t\t\t\t...wrappedRequestHeaders\n\t\t\t\t},\n\t\t\t\tsignal\n\t\t\t}), \"MutateDocumentAsync\", \"mutation\", variables);\n\t\t},\n\t\tRenameDocument(variables, requestHeaders, signal) {\n\t\t\treturn withWrapper((wrappedRequestHeaders) => client.request({\n\t\t\t\tdocument: RenameDocumentDocument,\n\t\t\t\tvariables,\n\t\t\t\trequestHeaders: {\n\t\t\t\t\t...requestHeaders,\n\t\t\t\t\t...wrappedRequestHeaders\n\t\t\t\t},\n\t\t\t\tsignal\n\t\t\t}), \"RenameDocument\", \"mutation\", variables);\n\t\t},\n\t\tSetPreferredEditor(variables, requestHeaders, signal) {\n\t\t\treturn withWrapper((wrappedRequestHeaders) => client.request({\n\t\t\t\tdocument: SetPreferredEditorDocument,\n\t\t\t\tvariables,\n\t\t\t\trequestHeaders: {\n\t\t\t\t\t...requestHeaders,\n\t\t\t\t\t...wrappedRequestHeaders\n\t\t\t\t},\n\t\t\t\tsignal\n\t\t\t}), \"SetPreferredEditor\", \"mutation\", variables);\n\t\t},\n\t\tAddRelationship(variables, requestHeaders, signal) {\n\t\t\treturn withWrapper((wrappedRequestHeaders) => client.request({\n\t\t\t\tdocument: AddRelationshipDocument,\n\t\t\t\tvariables,\n\t\t\t\trequestHeaders: {\n\t\t\t\t\t...requestHeaders,\n\t\t\t\t\t...wrappedRequestHeaders\n\t\t\t\t},\n\t\t\t\tsignal\n\t\t\t}), \"AddRelationship\", \"mutation\", variables);\n\t\t},\n\t\tRemoveRelationship(variables, requestHeaders, signal) {\n\t\t\treturn withWrapper((wrappedRequestHeaders) => client.request({\n\t\t\t\tdocument: RemoveRelationshipDocument,\n\t\t\t\tvariables,\n\t\t\t\trequestHeaders: {\n\t\t\t\t\t...requestHeaders,\n\t\t\t\t\t...wrappedRequestHeaders\n\t\t\t\t},\n\t\t\t\tsignal\n\t\t\t}), \"RemoveRelationship\", \"mutation\", variables);\n\t\t},\n\t\tMoveRelationship(variables, requestHeaders, signal) {\n\t\t\treturn withWrapper((wrappedRequestHeaders) => client.request({\n\t\t\t\tdocument: MoveRelationshipDocument,\n\t\t\t\tvariables,\n\t\t\t\trequestHeaders: {\n\t\t\t\t\t...requestHeaders,\n\t\t\t\t\t...wrappedRequestHeaders\n\t\t\t\t},\n\t\t\t\tsignal\n\t\t\t}), \"MoveRelationship\", \"mutation\", variables);\n\t\t},\n\t\tDeleteDocument(variables, requestHeaders, signal) {\n\t\t\treturn withWrapper((wrappedRequestHeaders) => client.request({\n\t\t\t\tdocument: DeleteDocumentDocument,\n\t\t\t\tvariables,\n\t\t\t\trequestHeaders: {\n\t\t\t\t\t...requestHeaders,\n\t\t\t\t\t...wrappedRequestHeaders\n\t\t\t\t},\n\t\t\t\tsignal\n\t\t\t}), \"DeleteDocument\", \"mutation\", variables);\n\t\t},\n\t\tDeleteDocuments(variables, requestHeaders, signal) {\n\t\t\treturn withWrapper((wrappedRequestHeaders) => client.request({\n\t\t\t\tdocument: DeleteDocumentsDocument,\n\t\t\t\tvariables,\n\t\t\t\trequestHeaders: {\n\t\t\t\t\t...requestHeaders,\n\t\t\t\t\t...wrappedRequestHeaders\n\t\t\t\t},\n\t\t\t\tsignal\n\t\t\t}), \"DeleteDocuments\", \"mutation\", variables);\n\t\t},\n\t\tDocumentChanges(variables, requestHeaders, signal) {\n\t\t\treturn withWrapper((wrappedRequestHeaders) => client.request({\n\t\t\t\tdocument: DocumentChangesDocument,\n\t\t\t\tvariables,\n\t\t\t\trequestHeaders: {\n\t\t\t\t\t...requestHeaders,\n\t\t\t\t\t...wrappedRequestHeaders\n\t\t\t\t},\n\t\t\t\tsignal\n\t\t\t}), \"DocumentChanges\", \"subscription\", variables);\n\t\t},\n\t\tJobChanges(variables, requestHeaders, signal) {\n\t\t\treturn withWrapper((wrappedRequestHeaders) => client.request({\n\t\t\t\tdocument: JobChangesDocument,\n\t\t\t\tvariables,\n\t\t\t\trequestHeaders: {\n\t\t\t\t\t...requestHeaders,\n\t\t\t\t\t...wrappedRequestHeaders\n\t\t\t\t},\n\t\t\t\tsignal\n\t\t\t}), \"JobChanges\", \"subscription\", variables);\n\t\t},\n\t\tPollSyncEnvelopes(variables, requestHeaders, signal) {\n\t\t\treturn withWrapper((wrappedRequestHeaders) => client.request({\n\t\t\t\tdocument: PollSyncEnvelopesDocument,\n\t\t\t\tvariables,\n\t\t\t\trequestHeaders: {\n\t\t\t\t\t...requestHeaders,\n\t\t\t\t\t...wrappedRequestHeaders\n\t\t\t\t},\n\t\t\t\tsignal\n\t\t\t}), \"PollSyncEnvelopes\", \"query\", variables);\n\t\t},\n\t\tTouchChannel(variables, requestHeaders, signal) {\n\t\t\treturn withWrapper((wrappedRequestHeaders) => client.request({\n\t\t\t\tdocument: TouchChannelDocument,\n\t\t\t\tvariables,\n\t\t\t\trequestHeaders: {\n\t\t\t\t\t...requestHeaders,\n\t\t\t\t\t...wrappedRequestHeaders\n\t\t\t\t},\n\t\t\t\tsignal\n\t\t\t}), \"TouchChannel\", \"mutation\", variables);\n\t\t},\n\t\tPushSyncEnvelopes(variables, requestHeaders, signal) {\n\t\t\treturn withWrapper((wrappedRequestHeaders) => client.request({\n\t\t\t\tdocument: PushSyncEnvelopesDocument,\n\t\t\t\tvariables,\n\t\t\t\trequestHeaders: {\n\t\t\t\t\t...requestHeaders,\n\t\t\t\t\t...wrappedRequestHeaders\n\t\t\t\t},\n\t\t\t\tsignal\n\t\t\t}), \"PushSyncEnvelopes\", \"mutation\", variables);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/graphql/batch-queries.ts\n/** Get the source string from a GraphQL document (string or DocumentNode). */\nfunction getDocumentSource(doc) {\n\treturn typeof doc === \"string\" ? doc : doc.loc?.source.body ?? \"\";\n}\n/**\n* Extract the inner selection set of a named field from a GraphQL document source.\n* Returns the `{ ... }` block including braces.\n*/\nfunction extractSelectionSet(doc, fieldName, fallback) {\n\tconst source = getDocumentSource(doc);\n\treturn new RegExp(`${fieldName}\\\\([^)]*\\\\)\\\\s*(\\\\{[\\\\s\\\\S]*\\\\})\\\\s*\\\\}`).exec(source)?.[1] ?? fallback;\n}\n/**\n* Extract the query body and any fragment definitions from a GraphQL document.\n* Returns { body, fragments } where body is the content inside the query `{ ... }`\n* and fragments are any trailing fragment definitions.\n*/\nfunction extractQueryParts(doc, fallbackBody) {\n\tconst source = getDocumentSource(doc);\n\tconst queryMatch = /^[^{]*\\{([\\s\\S]*?)\\}\\s*(fragment[\\s\\S]*)?$/.exec(source);\n\treturn {\n\t\tbody: queryMatch?.[1]?.trim() ?? fallbackBody,\n\t\tfragments: queryMatch?.[2]?.trim() ?? \"\"\n\t};\n}\nconst operationsSelectionSet = extractSelectionSet(GetDocumentOperationsDocument, \"documentOperations\", \"{ items { index } }\");\nconst documentParts = extractQueryParts(GetDocumentDocument, \"document(identifier: $identifier) { document { id name documentType state revisionsList { scope revision } createdAtUtcIso lastModifiedAtUtcIso } childIds }\");\n/**\n* Build a single GraphQL query that fetches documentOperations for\n* multiple filters using aliases. Each filter gets its own alias\n* (`scope_0`, `scope_1`, …) so all scopes are fetched in one HTTP request.\n*/\nfunction buildBatchOperationsQuery(filters, pagings) {\n\tconst query = `query BatchGetDocumentOperations(${filters.flatMap((_, i) => [`$filter_${i}: OperationsFilterInput!`, `$paging_${i}: PagingInput`]).join(\", \")}) {\n ${filters.map((_, i) => `scope_${i}: documentOperations(filter: $filter_${i}, paging: $paging_${i}) ${operationsSelectionSet}`).join(\"\\n \")}\n }`;\n\tconst variables = {};\n\tfor (let i = 0; i < filters.length; i++) {\n\t\tvariables[`filter_${i}`] = filters[i];\n\t\tvariables[`paging_${i}`] = pagings[i] ?? null;\n\t}\n\treturn {\n\t\tquery,\n\t\tvariables\n\t};\n}\n/**\n* Build a single GraphQL query that fetches a document AND\n* documentOperations for multiple filters, all in one HTTP request.\n*/\nfunction buildBatchDocumentWithOperationsQuery(identifier, view, filters, pagings) {\n\tconst docVarDefs = \"$identifier: String!, $view: ViewFilterInput\";\n\tconst opsVarDefs = filters.flatMap((_, i) => [`$filter_${i}: OperationsFilterInput!`, `$paging_${i}: PagingInput`]).join(\", \");\n\tconst opsFields = filters.map((_, i) => `scope_${i}: documentOperations(filter: $filter_${i}, paging: $paging_${i}) ${operationsSelectionSet}`).join(\"\\n \");\n\tconst query = `query BatchGetDocumentWithOperations(${docVarDefs}, ${opsVarDefs}) {\n ${documentParts.body}\n ${opsFields}\n }\n ${documentParts.fragments}`;\n\tconst variables = {\n\t\tidentifier,\n\t\tview: view ?? null\n\t};\n\tfor (let i = 0; i < filters.length; i++) {\n\t\tvariables[`filter_${i}`] = filters[i];\n\t\tvariables[`paging_${i}`] = pagings[i] ?? null;\n\t}\n\treturn {\n\t\tquery,\n\t\tvariables\n\t};\n}\n//#endregion\n//#region src/graphql/client.ts\n/**\n* Creates a GraphQL client for the Reactor Subgraph API.\n* @param urlOrGQLClient The URL of the GraphQL API or a GraphQL client instance.\n* @param middleware An optional middleware function to wrap the GraphQL client calls.\n* @returns A GraphQL client for the Reactor Subgraph API.\n*/\nfunction createClient(urlOrGQLClient, middleware) {\n\tconst client = typeof urlOrGQLClient === \"string\" ? new GraphQLClient(urlOrGQLClient) : urlOrGQLClient;\n\tconst runWithMiddleware = async (operationName, run) => {\n\t\tif (!middleware) return run();\n\t\treturn middleware(run, operationName, \"query\");\n\t};\n\treturn {\n\t\t...getSdk(client, middleware),\n\t\tasync BatchGetDocumentOperations(filters, pagings) {\n\t\t\tconst { query, variables } = buildBatchOperationsQuery(filters, pagings);\n\t\t\tconst data = await runWithMiddleware(\"BatchGetDocumentOperations\", (requestHeaders) => client.request(query, variables, requestHeaders));\n\t\t\treturn filters.map((_, i) => data[`scope_${i}`]);\n\t\t},\n\t\tasync BatchGetDocumentWithOperations(identifier, view, filters, pagings) {\n\t\t\tconst { query, variables } = buildBatchDocumentWithOperationsQuery(identifier, view, filters, pagings);\n\t\t\tconst data = await runWithMiddleware(\"BatchGetDocumentWithOperations\", (requestHeaders) => client.request(query, variables, requestHeaders));\n\t\t\treturn {\n\t\t\t\tdocument: data.document ?? null,\n\t\t\t\toperations: filters.map((_, i) => data[`scope_${i}`])\n\t\t\t};\n\t\t}\n\t};\n}\n//#endregion\nexport { GetDocumentWithOperationsDocument as n, PropagationMode as r, createClient as t };\n\n//# sourceMappingURL=client-CvgFU1Dv.js.map","import { t as makePHEventFunctions } from \"./make-ph-event-functions-DwiD1zH9.js\";\nimport { logger } from \"document-model\";\nimport { Children, cloneElement, forwardRef, isValidElement, useCallback, useEffect, useRef, useState, useSyncExternalStore } from \"react\";\nimport { BrowserKeyStorage, CREDENTIAL_SCHEMA_EIP712_TYPE, CREDENTIAL_SUBJECT_TYPE, CREDENTIAL_TYPES, DOMAIN_TYPE, ISSUER_TYPE, RenownBuilder, RenownCryptoBuilder, VERIFIABLE_CREDENTIAL_EIP712_TYPE } from \"@renown/sdk\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\n//#region src/hooks/loading.ts\nconst { useValue: useLoading, setValue: setLoading, addEventHandler: addLoadingEventHandler } = makePHEventFunctions(\"loading\");\nconst loading = null;\n//#endregion\n//#region src/hooks/renown.ts\nconst renownEventFunctions = makePHEventFunctions(\"renown\");\n/** Adds an event handler for the renown instance */\nconst addRenownEventHandler = renownEventFunctions.addEventHandler;\n/** Returns the renown instance */\nconst useRenown = renownEventFunctions.useValue;\n/** Sets the renown instance */\nconst setRenown = renownEventFunctions.setValue;\n/** Returns the DID from the renown instance */\nfunction useDid() {\n\treturn useRenown()?.did;\n}\n/** Returns the current user from the renown instance, subscribing to user events */\nfunction useUser() {\n\tconst renown = useRenown();\n\tconst [user, setUser] = useState(renown?.user);\n\tuseEffect(() => {\n\t\tsetUser(renown?.user);\n\t\tif (!renown) return;\n\t\treturn renown.on(\"user\", setUser);\n\t}, [renown]);\n\treturn user;\n}\n/** Returns the login status, subscribing to renown status events */\nfunction useLoginStatus() {\n\tconst renown = useRenown();\n\treturn useSyncExternalStore((cb) => {\n\t\tif (!renown) return () => {};\n\t\treturn renown.on(\"status\", cb);\n\t}, () => renown === null ? \"loading\" : renown?.status, () => void 0);\n}\n//#endregion\n//#region src/renown/constants.ts\nconst RENOWN_URL = \"https://www.renown.id\";\nconst RENOWN_NETWORK_ID = \"eip155\";\nconst RENOWN_CHAIN_ID = \"1\";\n//#endregion\n//#region src/renown/utils.ts\nfunction openRenown(documentId) {\n\tconst renown = window.ph?.renown;\n\tlet renownUrl = renown?.baseUrl;\n\tif (!renownUrl) {\n\t\tlogger.warn(\"Renown instance not found, falling back to: @url\", RENOWN_URL);\n\t\trenownUrl = RENOWN_URL;\n\t}\n\tif (documentId) {\n\t\twindow.open(`${renownUrl}/profile/${documentId}`, \"_blank\")?.focus();\n\t\treturn;\n\t}\n\tconst url = new URL(renownUrl);\n\turl.searchParams.set(\"app\", renown?.did ?? \"\");\n\turl.searchParams.set(\"connect\", renown?.did ?? \"\");\n\turl.searchParams.set(\"network\", RENOWN_NETWORK_ID);\n\turl.searchParams.set(\"chain\", \"1\");\n\tconst returnUrl = new URL(window.location.pathname, window.location.origin);\n\turl.searchParams.set(\"returnUrl\", returnUrl.toJSON());\n\twindow.open(url, \"_self\")?.focus();\n}\n/**\n* Reads the `?user=` DID from the URL if present.\n* Returns the DID and cleans up the URL parameter.\n*/\nfunction consumeDidFromUrl() {\n\tif (typeof window === \"undefined\") return;\n\tconst userParam = new URLSearchParams(window.location.search).get(\"user\");\n\tif (!userParam) return;\n\tconst userDid = decodeURIComponent(userParam);\n\tconst cleanUrl = new URL(window.location.href);\n\tcleanUrl.searchParams.delete(\"user\");\n\twindow.history.replaceState({}, \"\", cleanUrl.toString());\n\treturn userDid;\n}\n/**\n* Log in the user. Resolves the user DID from (in order):\n* 1. Explicit `userDid` argument\n* 2. `?user=` URL parameter (from Renown portal redirect)\n* 3. Previously stored session in the Renown instance\n*/\nasync function login(userDid, renown) {\n\tif (!renown) return;\n\tconst did = userDid ?? consumeDidFromUrl();\n\ttry {\n\t\tconst user = renown.user;\n\t\tif (user?.did && (user.did === did || !did)) return user;\n\t\tif (!did) return;\n\t\treturn await renown.login(did);\n\t} catch (error) {\n\t\tlogger.error(error instanceof Error ? error.message : JSON.stringify(error));\n\t}\n}\nasync function logout() {\n\tawait (window.ph?.renown)?.logout();\n\tconst url = new URL(window.location.href);\n\tif (url.searchParams.has(\"user\")) {\n\t\turl.searchParams.delete(\"user\");\n\t\twindow.history.replaceState(null, \"\", url.toString());\n\t}\n}\n//#endregion\n//#region src/renown/use-renown-auth.ts\nfunction truncateAddress$1(address) {\n\tif (address.length <= 13) return address;\n\treturn `${address.slice(0, 7)}...${address.slice(-5)}`;\n}\nfunction toRenownAuthStatus(loginStatus, user) {\n\tif (loginStatus === \"authorized\") return user ? \"authorized\" : \"checking\";\n\treturn loginStatus;\n}\nfunction useRenownAuth() {\n\tconst user = useUser();\n\tconst status = toRenownAuthStatus(useLoginStatus(), user);\n\tconst address = user?.address;\n\tconst ensName = user?.ens?.name;\n\tconst avatarUrl = user?.profile?.userImage ?? user?.ens?.avatarUrl;\n\tconst profileId = user?.profile?.documentId;\n\treturn {\n\t\tstatus,\n\t\tuser,\n\t\taddress,\n\t\tensName,\n\t\tavatarUrl,\n\t\tprofileId,\n\t\tdisplayName: ensName ?? user?.profile?.username ?? void 0,\n\t\tdisplayAddress: address ? truncateAddress$1(address) : void 0,\n\t\tlogin: useCallback(() => {\n\t\t\topenRenown();\n\t\t}, []),\n\t\tlogout: useCallback(async () => {\n\t\t\tawait logout();\n\t\t}, []),\n\t\topenProfile: useCallback(() => {\n\t\t\tif (profileId) openRenown(profileId);\n\t\t}, [profileId])\n\t};\n}\n//#endregion\n//#region src/renown/components/icons.tsx\nfunction RenownLogo({ width = 71, height = 19, hovered = false, color = \"currentColor\", className }) {\n\treturn /* @__PURE__ */ jsxs(\"svg\", {\n\t\twidth,\n\t\theight,\n\t\tviewBox: \"0 0 71 19\",\n\t\tfill: color,\n\t\txmlns: \"http://www.w3.org/2000/svg\",\n\t\tclassName,\n\t\tchildren: [\n\t\t\t/* @__PURE__ */ jsx(\"path\", { d: \"M53.6211 18.4887V9.0342H56.435V10.8096H56.4923C56.7377 10.181 57.1085 9.70244 57.6047 9.37398C58.101 9.03986 58.6981 8.8728 59.3962 8.8728C60.4105 8.8728 61.2039 9.1871 61.7765 9.8157C62.3546 10.4443 62.6436 11.3164 62.6436 12.432V18.4887H59.7397V13.0776C59.7397 12.5283 59.6007 12.1007 59.3225 11.7949C59.0499 11.4835 58.6654 11.3277 58.1692 11.3277C57.6784 11.3277 57.2803 11.4976 56.9749 11.8374C56.6695 12.1772 56.5168 12.6161 56.5168 13.1541V18.4887H53.6211Z\" }),\n\t\t\t/* @__PURE__ */ jsx(\"path\", { d: \"M53.097 9.03394L50.7412 18.4884H47.6164L46.1522 12.075H46.0949L44.6389 18.4884H41.5632L39.1992 9.03394H42.1195L43.3056 15.7532H43.3628L44.7861 9.03394H47.551L48.9906 15.7532H49.0479L50.234 9.03394H53.097Z\" }),\n\t\t\t/* @__PURE__ */ jsx(\"path\", { d: \"M37.8661 17.3926C37.0427 18.2591 35.9084 18.6923 34.4632 18.6923C33.0181 18.6923 31.8838 18.2591 31.0604 17.3926C30.2369 16.5205 29.8252 15.3086 29.8252 13.7569C29.8252 12.2336 30.2424 11.033 31.0767 10.1552C31.9111 9.2718 33.0399 8.83008 34.4632 8.83008C35.892 8.83008 37.0208 9.26896 37.8497 10.1467C38.6841 11.0188 39.1013 12.2222 39.1013 13.7569C39.1013 15.3143 38.6896 16.5262 37.8661 17.3926ZM33.2117 15.7702C33.5116 16.2402 33.9288 16.4752 34.4632 16.4752C34.9977 16.4752 35.4148 16.2402 35.7148 15.7702C36.0147 15.2945 36.1647 14.6234 36.1647 13.7569C36.1647 12.9131 36.012 12.2506 35.7066 11.7692C35.4012 11.2878 34.9868 11.0472 34.4632 11.0472C33.9343 11.0472 33.5171 11.2878 33.2117 11.7692C32.9118 12.2449 32.7618 12.9075 32.7618 13.7569C32.7618 14.6234 32.9118 15.2945 33.2117 15.7702Z\" }),\n\t\t\t/* @__PURE__ */ jsx(\"path\", { d: \"M20.0088 18.4887V9.0342H22.8227V10.8096H22.88C23.1254 10.181 23.4962 9.70244 23.9924 9.37398C24.4887 9.03986 25.0858 8.8728 25.7838 8.8728C26.7982 8.8728 27.5916 9.1871 28.1642 9.8157C28.7423 10.4443 29.0313 11.3164 29.0313 12.432V18.4887H26.1274V13.0776C26.1274 12.5283 25.9883 12.1007 25.7102 11.7949C25.4376 11.4835 25.0531 11.3277 24.5569 11.3277C24.0661 11.3277 23.668 11.4976 23.3626 11.8374C23.0572 12.1772 22.9045 12.6161 22.9045 13.1541V18.4887H20.0088Z\" }),\n\t\t\t/* @__PURE__ */ jsx(\"path\", { d: \"M14.7486 10.9707C14.2851 10.9707 13.8952 11.1321 13.5789 11.4549C13.2626 11.7777 13.0854 12.1911 13.0472 12.6951H16.4337C16.4064 12.1741 16.2374 11.7579 15.9265 11.4464C15.6212 11.1293 15.2285 10.9707 14.7486 10.9707ZM16.4991 15.5153H19.1167C18.9749 16.4837 18.5141 17.2567 17.7343 17.8343C16.9599 18.4063 15.9838 18.6923 14.8059 18.6923C13.3662 18.6923 12.2374 18.2591 11.4194 17.3926C10.6014 16.5262 10.1924 15.3313 10.1924 13.8079C10.1924 12.2845 10.5987 11.0755 11.4112 10.1807C12.2237 9.28029 13.3226 8.83008 14.7077 8.83008C16.0656 8.83008 17.1481 9.26047 17.9552 10.1213C18.7677 10.9764 19.174 12.1231 19.174 13.5616V14.4195H13.0145V14.6064C13.0145 15.184 13.1835 15.6541 13.5216 16.0165C13.8597 16.3733 14.3015 16.5517 14.8468 16.5517C15.2503 16.5517 15.5993 16.461 15.8938 16.2798C16.1883 16.0929 16.3901 15.8381 16.4991 15.5153Z\" }),\n\t\t\t/* @__PURE__ */ jsx(\"path\", { d: \"M3.00205 8.58396V12.0667H4.7771C5.32789 12.0667 5.7587 11.911 6.06954 11.5995C6.38038 11.2881 6.5358 10.8662 6.5358 10.3338C6.5358 9.80718 6.37492 9.38528 6.05318 9.06815C5.73143 8.74535 5.30335 8.58396 4.76892 8.58396H3.00205ZM3.00205 14.1989V18.4886H0V6.23096H5.07158C6.53307 6.23096 7.65373 6.5849 8.43355 7.29278C9.21337 8.00066 9.60328 8.99453 9.60328 10.2744C9.60328 11.0446 9.42605 11.7439 9.07159 12.3725C8.71712 12.9955 8.2236 13.4514 7.59101 13.7402L9.94684 18.4886H6.5767L4.55624 14.1989H3.00205Z\" }),\n\t\t\t/* @__PURE__ */ jsx(\"path\", {\n\t\t\t\td: \"M65.7255 0.211478C65.0841 2.46724 63.3737 4.2455 61.2041 4.90969C60.932 4.99366 60.932 5.39096 61.2041 5.47492C63.3725 6.13912 65.0841 7.91738 65.7255 10.1731C65.8056 10.4551 66.1932 10.4551 66.2745 10.1731C66.9159 7.91738 68.6263 6.13912 70.7959 5.47492C71.068 5.39096 71.068 4.99366 70.7959 4.90969C68.6276 4.2455 66.9159 2.46724 66.2745 0.211478C66.1944 -0.0704925 65.8068 -0.0704925 65.7255 0.211478Z\",\n\t\t\t\tfill: hovered ? \"#21FFB4\" : color\n\t\t\t})\n\t\t]\n\t});\n}\nfunction CopyIcon({ size = 14, color = \"#9EA0A1\" }) {\n\treturn /* @__PURE__ */ jsxs(\"svg\", {\n\t\twidth: size,\n\t\theight: size,\n\t\tviewBox: \"0 0 16 16\",\n\t\tfill: \"none\",\n\t\txmlns: \"http://www.w3.org/2000/svg\",\n\t\tchildren: [/* @__PURE__ */ jsx(\"rect\", {\n\t\t\tx: \"5\",\n\t\t\ty: \"5\",\n\t\t\twidth: \"9\",\n\t\t\theight: \"9\",\n\t\t\trx: \"1\",\n\t\t\tstroke: color,\n\t\t\tstrokeWidth: \"1.5\"\n\t\t}), /* @__PURE__ */ jsx(\"path\", {\n\t\t\td: \"M11 5V3C11 2.44772 10.5523 2 10 2H3C2.44772 2 2 2.44772 2 3V10C2 10.5523 2.44772 11 3 11H5\",\n\t\t\tstroke: color,\n\t\t\tstrokeWidth: \"1.5\"\n\t\t})]\n\t});\n}\nfunction DisconnectIcon({ size = 14, color = \"#EA4335\" }) {\n\treturn /* @__PURE__ */ jsxs(\"svg\", {\n\t\twidth: size,\n\t\theight: size,\n\t\tviewBox: \"0 0 16 16\",\n\t\tfill: \"none\",\n\t\txmlns: \"http://www.w3.org/2000/svg\",\n\t\tchildren: [\n\t\t\t/* @__PURE__ */ jsx(\"path\", {\n\t\t\t\td: \"M6 14H3.33333C2.97971 14 2.64057 13.8595 2.39052 13.6095C2.14048 13.3594 2 13.0203 2 12.6667V3.33333C2 2.97971 2.14048 2.64057 2.39052 2.39052C2.64057 2.14048 2.97971 2 3.33333 2H6\",\n\t\t\t\tstroke: color,\n\t\t\t\tstrokeWidth: \"1.5\",\n\t\t\t\tstrokeLinecap: \"round\",\n\t\t\t\tstrokeLinejoin: \"round\"\n\t\t\t}),\n\t\t\t/* @__PURE__ */ jsx(\"path\", {\n\t\t\t\td: \"M10.6667 11.3333L14 8L10.6667 4.66667\",\n\t\t\t\tstroke: color,\n\t\t\t\tstrokeWidth: \"1.5\",\n\t\t\t\tstrokeLinecap: \"round\",\n\t\t\t\tstrokeLinejoin: \"round\"\n\t\t\t}),\n\t\t\t/* @__PURE__ */ jsx(\"path\", {\n\t\t\t\td: \"M14 8H6\",\n\t\t\t\tstroke: color,\n\t\t\t\tstrokeWidth: \"1.5\",\n\t\t\t\tstrokeLinecap: \"round\",\n\t\t\t\tstrokeLinejoin: \"round\"\n\t\t\t})\n\t\t]\n\t});\n}\nfunction SpinnerIcon({ size = 14, color = \"currentColor\" }) {\n\treturn /* @__PURE__ */ jsxs(\"svg\", {\n\t\twidth: size,\n\t\theight: size,\n\t\tviewBox: \"0 0 16 16\",\n\t\tfill: \"none\",\n\t\txmlns: \"http://www.w3.org/2000/svg\",\n\t\tstyle: { animation: \"spin 1s linear infinite\" },\n\t\tchildren: [\n\t\t\t/* @__PURE__ */ jsx(\"style\", { children: `@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }` }),\n\t\t\t/* @__PURE__ */ jsx(\"path\", {\n\t\t\t\td: \"M8 1V4\",\n\t\t\t\tstroke: color,\n\t\t\t\tstrokeWidth: \"1.5\",\n\t\t\t\tstrokeLinecap: \"round\"\n\t\t\t}),\n\t\t\t/* @__PURE__ */ jsx(\"path\", {\n\t\t\t\td: \"M8 12V15\",\n\t\t\t\tstroke: color,\n\t\t\t\tstrokeWidth: \"1.5\",\n\t\t\t\tstrokeLinecap: \"round\",\n\t\t\t\topacity: \"0.3\"\n\t\t\t}),\n\t\t\t/* @__PURE__ */ jsx(\"path\", {\n\t\t\t\td: \"M3.05 3.05L5.17 5.17\",\n\t\t\t\tstroke: color,\n\t\t\t\tstrokeWidth: \"1.5\",\n\t\t\t\tstrokeLinecap: \"round\",\n\t\t\t\topacity: \"0.9\"\n\t\t\t}),\n\t\t\t/* @__PURE__ */ jsx(\"path\", {\n\t\t\t\td: \"M10.83 10.83L12.95 12.95\",\n\t\t\t\tstroke: color,\n\t\t\t\tstrokeWidth: \"1.5\",\n\t\t\t\tstrokeLinecap: \"round\",\n\t\t\t\topacity: \"0.4\"\n\t\t\t}),\n\t\t\t/* @__PURE__ */ jsx(\"path\", {\n\t\t\t\td: \"M1 8H4\",\n\t\t\t\tstroke: color,\n\t\t\t\tstrokeWidth: \"1.5\",\n\t\t\t\tstrokeLinecap: \"round\",\n\t\t\t\topacity: \"0.8\"\n\t\t\t}),\n\t\t\t/* @__PURE__ */ jsx(\"path\", {\n\t\t\t\td: \"M12 8H15\",\n\t\t\t\tstroke: color,\n\t\t\t\tstrokeWidth: \"1.5\",\n\t\t\t\tstrokeLinecap: \"round\",\n\t\t\t\topacity: \"0.5\"\n\t\t\t}),\n\t\t\t/* @__PURE__ */ jsx(\"path\", {\n\t\t\t\td: \"M3.05 12.95L5.17 10.83\",\n\t\t\t\tstroke: color,\n\t\t\t\tstrokeWidth: \"1.5\",\n\t\t\t\tstrokeLinecap: \"round\",\n\t\t\t\topacity: \"0.7\"\n\t\t\t}),\n\t\t\t/* @__PURE__ */ jsx(\"path\", {\n\t\t\t\td: \"M10.83 5.17L12.95 3.05\",\n\t\t\t\tstroke: color,\n\t\t\t\tstrokeWidth: \"1.5\",\n\t\t\t\tstrokeLinecap: \"round\",\n\t\t\t\topacity: \"0.6\"\n\t\t\t})\n\t\t]\n\t});\n}\nfunction ChevronDownIcon({ size = 14, color = \"currentColor\", style }) {\n\treturn /* @__PURE__ */ jsx(\"svg\", {\n\t\twidth: size,\n\t\theight: size,\n\t\tviewBox: \"0 0 16 16\",\n\t\tfill: \"none\",\n\t\txmlns: \"http://www.w3.org/2000/svg\",\n\t\tstyle,\n\t\tchildren: /* @__PURE__ */ jsx(\"path\", {\n\t\t\td: \"M4 6L8 10L12 6\",\n\t\t\tstroke: color,\n\t\t\tstrokeWidth: \"1.5\",\n\t\t\tstrokeLinecap: \"round\",\n\t\t\tstrokeLinejoin: \"round\"\n\t\t})\n\t});\n}\nfunction UserIcon({ size = 24, color = \"#6366f1\" }) {\n\treturn /* @__PURE__ */ jsxs(\"svg\", {\n\t\twidth: size,\n\t\theight: size,\n\t\tviewBox: \"0 0 24 24\",\n\t\tfill: \"none\",\n\t\txmlns: \"http://www.w3.org/2000/svg\",\n\t\tchildren: [/* @__PURE__ */ jsx(\"circle\", {\n\t\t\tcx: \"12\",\n\t\t\tcy: \"8\",\n\t\t\tr: \"4\",\n\t\t\tstroke: color,\n\t\t\tstrokeWidth: \"2\"\n\t\t}), /* @__PURE__ */ jsx(\"path\", {\n\t\t\td: \"M4 20C4 16.6863 7.58172 14 12 14C16.4183 14 20 16.6863 20 20\",\n\t\t\tstroke: color,\n\t\t\tstrokeWidth: \"2\",\n\t\t\tstrokeLinecap: \"round\"\n\t\t})]\n\t});\n}\n//#endregion\n//#region src/renown/components/slot.tsx\nfunction mergeProps(parentProps, childProps) {\n\tconst merged = { ...parentProps };\n\tfor (const key of Object.keys(childProps)) {\n\t\tconst parentValue = parentProps[key];\n\t\tconst childValue = childProps[key];\n\t\tif (key === \"style\") merged[key] = {\n\t\t\t...parentValue,\n\t\t\t...childValue\n\t\t};\n\t\telse if (key === \"className\") merged[key] = [parentValue, childValue].filter(Boolean).join(\" \");\n\t\telse if (typeof parentValue === \"function\" && typeof childValue === \"function\") merged[key] = (...args) => {\n\t\t\tchildValue(...args);\n\t\t\tparentValue(...args);\n\t\t};\n\t\telse if (childValue !== void 0) merged[key] = childValue;\n\t}\n\treturn merged;\n}\nconst Slot = forwardRef(({ children, ...props }, ref) => {\n\tconst child = Children.only(children);\n\tif (!isValidElement(child)) return null;\n\tconst childElement = child;\n\tconst mergedProps = mergeProps(props, childElement.props);\n\tif (ref) mergedProps.ref = ref;\n\treturn cloneElement(childElement, mergedProps);\n});\nSlot.displayName = \"Slot\";\n//#endregion\n//#region src/renown/components/RenownLoginButton.tsx\nconst lightStyles = {\n\ttrigger: {\n\t\tbackgroundColor: \"#ffffff\",\n\t\tborderWidth: \"1px\",\n\t\tborderStyle: \"solid\",\n\t\tborderColor: \"#d1d5db\",\n\t\tcolor: \"#111827\"\n\t},\n\ttriggerHover: {\n\t\tbackgroundColor: \"#ecf3f8\",\n\t\tborderColor: \"#9ca3af\"\n\t}\n};\nconst darkStyles = {\n\ttrigger: {\n\t\tbackgroundColor: \"#1f2937\",\n\t\tborderWidth: \"1px\",\n\t\tborderStyle: \"solid\",\n\t\tborderColor: \"#4b5563\",\n\t\tcolor: \"#ecf3f8\"\n\t},\n\ttriggerHover: {\n\t\tbackgroundColor: \"#374151\",\n\t\tborderColor: \"#6b7280\"\n\t}\n};\nconst styles$1 = {\n\twrapper: {\n\t\tposition: \"relative\",\n\t\tdisplay: \"inline-block\"\n\t},\n\ttrigger: {\n\t\tdisplay: \"flex\",\n\t\talignItems: \"center\",\n\t\tjustifyContent: \"center\",\n\t\tgap: \"8px\",\n\t\tpadding: \"8px 32px\",\n\t\tborderRadius: \"8px\",\n\t\tcursor: \"pointer\",\n\t\tfontSize: \"14px\",\n\t\tfontWeight: 500,\n\t\tfontFamily: \"inherit\",\n\t\tlineHeight: \"20px\",\n\t\ttransition: \"background-color 150ms, border-color 150ms\"\n\t}\n};\nfunction RenownLoginButton({ onLogin: onLoginProp, darkMode = false, style, className, asChild = false, children }) {\n\tconst onLogin = onLoginProp ?? (() => openRenown());\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [isHovered, setIsHovered] = useState(false);\n\tconst handleMouseEnter = useCallback(() => setIsHovered(true), []);\n\tconst handleMouseLeave = useCallback(() => setIsHovered(false), []);\n\tconst handleClick = () => {\n\t\tif (!isLoading) {\n\t\t\tsetIsLoading(true);\n\t\t\tonLogin();\n\t\t}\n\t};\n\tconst themeStyles = darkMode ? darkStyles : lightStyles;\n\tconst triggerStyle = {\n\t\t...styles$1.trigger,\n\t\t...themeStyles.trigger,\n\t\t...isHovered && !isLoading ? themeStyles.triggerHover : {},\n\t\tcursor: isLoading ? \"wait\" : \"pointer\",\n\t\t...style\n\t};\n\tconst triggerElement = asChild ? /* @__PURE__ */ jsx(Slot, {\n\t\tonClick: handleClick,\n\t\t\"data-renown-state\": \"login\",\n\t\t...isLoading ? { \"data-loading\": \"\" } : {},\n\t\tchildren\n\t}) : /* @__PURE__ */ jsx(\"button\", {\n\t\ttype: \"button\",\n\t\tstyle: triggerStyle,\n\t\t\"aria-label\": \"Log in with Renown\",\n\t\tonClick: handleClick,\n\t\t\"data-renown-state\": \"login\",\n\t\t...isLoading ? { \"data-loading\": \"\" } : {},\n\t\tchildren: isLoading ? /* @__PURE__ */ jsx(SpinnerIcon, { size: 16 }) : /* @__PURE__ */ jsx(\"span\", { children: \"Log in\" })\n\t});\n\treturn /* @__PURE__ */ jsx(\"div\", {\n\t\tstyle: styles$1.wrapper,\n\t\tclassName,\n\t\tonMouseEnter: handleMouseEnter,\n\t\tonMouseLeave: handleMouseLeave,\n\t\tchildren: triggerElement\n\t});\n}\n//#endregion\n//#region src/renown/components/RenownUserButton.tsx\nconst POPOVER_GAP = 4;\nconst POPOVER_HEIGHT = 150;\nconst styles = {\n\twrapper: {\n\t\tposition: \"relative\",\n\t\tdisplay: \"inline-block\"\n\t},\n\ttrigger: {\n\t\tdisplay: \"flex\",\n\t\talignItems: \"center\",\n\t\tgap: \"8px\",\n\t\tpadding: \"6px 12px\",\n\t\tborderWidth: \"1px\",\n\t\tborderStyle: \"solid\",\n\t\tborderColor: \"#e5e7eb\",\n\t\tbackgroundColor: \"#ffffff\",\n\t\tcursor: \"pointer\",\n\t\tborderRadius: \"8px\",\n\t\tfontSize: \"12px\",\n\t\tfontWeight: 500,\n\t\tfontFamily: \"inherit\",\n\t\tcolor: \"#111827\",\n\t\ttransition: \"background-color 150ms, border-color 150ms\"\n\t},\n\ttriggerHover: {\n\t\tbackgroundColor: \"#f9fafb\",\n\t\tborderColor: \"#9ca3af\"\n\t},\n\tavatar: {\n\t\twidth: \"28px\",\n\t\theight: \"28px\",\n\t\tborderRadius: \"50%\",\n\t\tobjectFit: \"cover\",\n\t\tflexShrink: 0\n\t},\n\tavatarPlaceholder: {\n\t\twidth: \"28px\",\n\t\theight: \"28px\",\n\t\tborderRadius: \"50%\",\n\t\tbackground: \"linear-gradient(135deg, #8b5cf6, #3b82f6)\",\n\t\tdisplay: \"flex\",\n\t\talignItems: \"center\",\n\t\tjustifyContent: \"center\",\n\t\tflexShrink: 0\n\t},\n\tavatarInitial: {\n\t\tfontSize: \"12px\",\n\t\tfontWeight: 700,\n\t\tcolor: \"#ffffff\",\n\t\tlineHeight: 1\n\t},\n\tdisplayName: {\n\t\tmaxWidth: \"120px\",\n\t\toverflow: \"hidden\",\n\t\ttextOverflow: \"ellipsis\",\n\t\twhiteSpace: \"nowrap\"\n\t},\n\tchevron: {\n\t\tflexShrink: 0,\n\t\ttransition: \"transform 150ms\",\n\t\tcolor: \"#6b7280\"\n\t},\n\tchevronOpen: { transform: \"rotate(180deg)\" },\n\tpopoverBase: {\n\t\tposition: \"absolute\",\n\t\tright: 0,\n\t\tbackgroundColor: \"#ffffff\",\n\t\tborderRadius: \"8px\",\n\t\tboxShadow: \"0 4px 12px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08)\",\n\t\twidth: \"100%\",\n\t\tzIndex: 1e3,\n\t\tcolor: \"#111827\",\n\t\tborderWidth: \"1px\",\n\t\tborderStyle: \"solid\",\n\t\tborderColor: \"#e5e7eb\",\n\t\toverflow: \"hidden\"\n\t},\n\theader: {\n\t\tpadding: \"12px 16px\",\n\t\tborderBottom: \"1px solid #e5e7eb\"\n\t},\n\theaderUsername: {\n\t\tfontSize: \"14px\",\n\t\tfontWeight: 600,\n\t\tcolor: \"#111827\",\n\t\tmargin: 0\n\t},\n\taddressRow: {\n\t\tdisplay: \"flex\",\n\t\talignItems: \"center\",\n\t\tgap: \"4px\",\n\t\tmarginTop: \"4px\"\n\t},\n\taddressButton: {\n\t\tdisplay: \"flex\",\n\t\talignItems: \"center\",\n\t\tgap: \"4px\",\n\t\tpadding: 0,\n\t\tborder: \"none\",\n\t\tbackgroundColor: \"transparent\",\n\t\tcursor: \"pointer\",\n\t\tfontSize: \"12px\",\n\t\tcolor: \"#6b7280\",\n\t\tfontFamily: \"inherit\",\n\t\tposition: \"relative\",\n\t\twidth: \"100%\"\n\t},\n\tcopiedText: {\n\t\tfontSize: \"12px\",\n\t\tcolor: \"#059669\",\n\t\tposition: \"absolute\",\n\t\tleft: 0,\n\t\ttransition: \"opacity 150ms\",\n\t\tfontWeight: 500\n\t},\n\taddressText: {\n\t\tdisplay: \"flex\",\n\t\talignItems: \"center\",\n\t\tgap: \"4px\",\n\t\ttransition: \"opacity 150ms\"\n\t},\n\tmenuSection: { padding: \"4px 0\" },\n\tmenuItem: {\n\t\tdisplay: \"flex\",\n\t\talignItems: \"center\",\n\t\tgap: \"8px\",\n\t\twidth: \"100%\",\n\t\tpadding: \"8px 16px\",\n\t\tborder: \"none\",\n\t\tbackgroundColor: \"transparent\",\n\t\tcursor: \"pointer\",\n\t\tfontSize: \"14px\",\n\t\tcolor: \"#374151\",\n\t\ttextDecoration: \"none\",\n\t\tfontFamily: \"inherit\",\n\t\ttransition: \"background-color 150ms\"\n\t},\n\tmenuItemHover: { backgroundColor: \"#f3f4f6\" },\n\tdisconnectItem: { color: \"#dc2626\" },\n\tseparator: {\n\t\theight: \"1px\",\n\t\tbackgroundColor: \"#e5e7eb\",\n\t\tmargin: 0,\n\t\tborder: \"none\"\n\t}\n};\nfunction truncateAddress(address) {\n\tif (address.length <= 13) return address;\n\treturn `${address.slice(0, 7)}...${address.slice(-5)}`;\n}\nfunction RenownUserButton({ address: addressProp, username: usernameProp, avatarUrl: avatarUrlProp, userId: userIdProp, onDisconnect: onDisconnectProp, style, className, asChild = false, children, menuItems }) {\n\tconst user = useUser();\n\tconst address = addressProp ?? user?.address ?? \"\";\n\tconst username = usernameProp ?? user?.profile?.username ?? user?.ens?.name;\n\tconst avatarUrl = avatarUrlProp ?? user?.profile?.userImage ?? user?.ens?.avatarUrl;\n\tconst userId = userIdProp ?? user?.profile?.documentId;\n\tconst onDisconnect = onDisconnectProp ?? (() => void logout());\n\tconst displayName = username ?? (address ? truncateAddress(address) : \"Account\");\n\tconst profileId = userId ?? address;\n\tconst [isOpen, setIsOpen] = useState(false);\n\tconst [isHovered, setIsHovered] = useState(false);\n\tconst [isCopied, setIsCopied] = useState(false);\n\tconst [showAbove, setShowAbove] = useState(true);\n\tconst [hoveredItem, setHoveredItem] = useState(null);\n\tconst wrapperRef = useRef(null);\n\tconst closeTimeoutRef = useRef(null);\n\tconst calculatePosition = useCallback(() => {\n\t\tif (!wrapperRef.current) return;\n\t\tconst spaceAbove = wrapperRef.current.getBoundingClientRect().top;\n\t\tsetShowAbove(spaceAbove >= POPOVER_HEIGHT + POPOVER_GAP);\n\t}, []);\n\tconst handleMouseEnter = useCallback(() => {\n\t\tsetIsHovered(true);\n\t\tif (closeTimeoutRef.current) {\n\t\t\tclearTimeout(closeTimeoutRef.current);\n\t\t\tcloseTimeoutRef.current = null;\n\t\t}\n\t\tcalculatePosition();\n\t\tsetIsOpen(true);\n\t}, [calculatePosition]);\n\tconst handleMouseLeave = useCallback(() => {\n\t\tcloseTimeoutRef.current = setTimeout(() => {\n\t\t\tsetIsOpen(false);\n\t\t\tsetIsHovered(false);\n\t\t\tsetHoveredItem(null);\n\t\t}, 150);\n\t}, []);\n\tuseEffect(() => {\n\t\treturn () => {\n\t\t\tif (closeTimeoutRef.current) clearTimeout(closeTimeoutRef.current);\n\t\t};\n\t}, []);\n\tconst copyToClipboard = useCallback(async () => {\n\t\ttry {\n\t\t\tawait navigator.clipboard.writeText(address);\n\t\t\tsetIsCopied(true);\n\t\t\tsetTimeout(() => setIsCopied(false), 2e3);\n\t\t} catch (err) {\n\t\t\tconsole.error(\"Failed to copy address:\", err);\n\t\t}\n\t}, [address]);\n\tconst triggerElement = asChild ? /* @__PURE__ */ jsx(Slot, {\n\t\t\"data-renown-state\": \"authenticated\",\n\t\tchildren\n\t}) : /* @__PURE__ */ jsxs(\"button\", {\n\t\ttype: \"button\",\n\t\tstyle: {\n\t\t\t...styles.trigger,\n\t\t\t...isHovered ? styles.triggerHover : {},\n\t\t\t...style\n\t\t},\n\t\t\"aria-label\": \"Open account menu\",\n\t\t\"data-renown-state\": \"authenticated\",\n\t\tchildren: [\n\t\t\tavatarUrl ? /* @__PURE__ */ jsx(\"img\", {\n\t\t\t\tsrc: avatarUrl,\n\t\t\t\talt: \"Avatar\",\n\t\t\t\tstyle: styles.avatar\n\t\t\t}) : /* @__PURE__ */ jsx(\"div\", {\n\t\t\t\tstyle: styles.avatarPlaceholder,\n\t\t\t\tchildren: /* @__PURE__ */ jsx(\"span\", {\n\t\t\t\t\tstyle: styles.avatarInitial,\n\t\t\t\t\tchildren: (displayName || \"U\")[0].toUpperCase()\n\t\t\t\t})\n\t\t\t}),\n\t\t\t/* @__PURE__ */ jsx(\"span\", {\n\t\t\t\tstyle: styles.displayName,\n\t\t\t\tchildren: displayName\n\t\t\t}),\n\t\t\t/* @__PURE__ */ jsx(ChevronDownIcon, {\n\t\t\t\tsize: 14,\n\t\t\t\tstyle: {\n\t\t\t\t\t...styles.chevron,\n\t\t\t\t\t...isOpen ? styles.chevronOpen : {}\n\t\t\t\t}\n\t\t\t})\n\t\t]\n\t});\n\treturn /* @__PURE__ */ jsxs(\"div\", {\n\t\tref: wrapperRef,\n\t\tstyle: styles.wrapper,\n\t\tclassName,\n\t\tonMouseEnter: handleMouseEnter,\n\t\tonMouseLeave: handleMouseLeave,\n\t\tchildren: [triggerElement, isOpen && /* @__PURE__ */ jsxs(\"div\", {\n\t\t\tstyle: {\n\t\t\t\t...styles.popoverBase,\n\t\t\t\t...showAbove ? { bottom: `calc(100% + ${POPOVER_GAP}px)` } : { top: `calc(100% + ${POPOVER_GAP}px)` }\n\t\t\t},\n\t\t\tchildren: [\n\t\t\t\t/* @__PURE__ */ jsxs(\"div\", {\n\t\t\t\t\tstyle: styles.header,\n\t\t\t\t\tchildren: [username && /* @__PURE__ */ jsx(\"div\", {\n\t\t\t\t\t\tstyle: styles.headerUsername,\n\t\t\t\t\t\tchildren: username\n\t\t\t\t\t}), address && /* @__PURE__ */ jsx(\"div\", {\n\t\t\t\t\t\tstyle: styles.addressRow,\n\t\t\t\t\t\tchildren: /* @__PURE__ */ jsx(\"button\", {\n\t\t\t\t\t\t\ttype: \"button\",\n\t\t\t\t\t\t\tonClick: () => void copyToClipboard(),\n\t\t\t\t\t\t\tstyle: styles.addressButton,\n\t\t\t\t\t\t\tchildren: /* @__PURE__ */ jsxs(\"div\", {\n\t\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t\tposition: \"relative\",\n\t\t\t\t\t\t\t\t\tdisplay: \"flex\",\n\t\t\t\t\t\t\t\t\talignItems: \"center\",\n\t\t\t\t\t\t\t\t\tgap: \"4px\",\n\t\t\t\t\t\t\t\t\twidth: \"100%\"\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tchildren: [/* @__PURE__ */ jsxs(\"div\", {\n\t\t\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t\t\t...styles.addressText,\n\t\t\t\t\t\t\t\t\t\topacity: isCopied ? 0 : 1\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tchildren: [/* @__PURE__ */ jsx(\"span\", { children: truncateAddress(address) }), /* @__PURE__ */ jsx(CopyIcon, {\n\t\t\t\t\t\t\t\t\t\tsize: 12,\n\t\t\t\t\t\t\t\t\t\tcolor: \"#9ca3af\"\n\t\t\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t\t\t}), /* @__PURE__ */ jsx(\"div\", {\n\t\t\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t\t\t...styles.copiedText,\n\t\t\t\t\t\t\t\t\t\topacity: isCopied ? 1 : 0\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tchildren: \"Copied!\"\n\t\t\t\t\t\t\t\t})]\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t})\n\t\t\t\t\t})]\n\t\t\t\t}),\n\t\t\t\t/* @__PURE__ */ jsxs(\"div\", {\n\t\t\t\t\tstyle: styles.menuSection,\n\t\t\t\t\tchildren: [profileId && /* @__PURE__ */ jsxs(\"button\", {\n\t\t\t\t\t\ttype: \"button\",\n\t\t\t\t\t\tonClick: () => openRenown(profileId),\n\t\t\t\t\t\tonMouseEnter: () => setHoveredItem(\"profile\"),\n\t\t\t\t\t\tonMouseLeave: () => setHoveredItem(null),\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t...styles.menuItem,\n\t\t\t\t\t\t\t...hoveredItem === \"profile\" ? styles.menuItemHover : {}\n\t\t\t\t\t\t},\n\t\t\t\t\t\tchildren: [/* @__PURE__ */ jsx(UserIcon, {\n\t\t\t\t\t\t\tsize: 14,\n\t\t\t\t\t\t\tcolor: \"#6b7280\"\n\t\t\t\t\t\t}), \"View Profile\"]\n\t\t\t\t\t}), menuItems?.map((item) => /* @__PURE__ */ jsxs(\"button\", {\n\t\t\t\t\t\ttype: \"button\",\n\t\t\t\t\t\tonClick: item.onClick,\n\t\t\t\t\t\tonMouseEnter: () => setHoveredItem(item.label),\n\t\t\t\t\t\tonMouseLeave: () => setHoveredItem(null),\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t...styles.menuItem,\n\t\t\t\t\t\t\t...hoveredItem === item.label ? styles.menuItemHover : {},\n\t\t\t\t\t\t\t...item.style\n\t\t\t\t\t\t},\n\t\t\t\t\t\tchildren: [item.icon, item.label]\n\t\t\t\t\t}, item.label))]\n\t\t\t\t}),\n\t\t\t\t/* @__PURE__ */ jsx(\"hr\", { style: styles.separator }),\n\t\t\t\t/* @__PURE__ */ jsx(\"div\", {\n\t\t\t\t\tstyle: styles.menuSection,\n\t\t\t\t\tchildren: /* @__PURE__ */ jsxs(\"button\", {\n\t\t\t\t\t\ttype: \"button\",\n\t\t\t\t\t\tonClick: onDisconnect,\n\t\t\t\t\t\tonMouseEnter: () => setHoveredItem(\"disconnect\"),\n\t\t\t\t\t\tonMouseLeave: () => setHoveredItem(null),\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t...styles.menuItem,\n\t\t\t\t\t\t\t...styles.disconnectItem,\n\t\t\t\t\t\t\t...hoveredItem === \"disconnect\" ? styles.menuItemHover : {}\n\t\t\t\t\t\t},\n\t\t\t\t\t\tchildren: [/* @__PURE__ */ jsx(DisconnectIcon, {\n\t\t\t\t\t\t\tsize: 14,\n\t\t\t\t\t\t\tcolor: \"#dc2626\"\n\t\t\t\t\t\t}), \"Log out\"]\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t]\n\t\t})]\n\t});\n}\n//#endregion\n//#region src/renown/components/RenownAuthButton.tsx\nfunction RenownAuthButton({ className = \"\", darkMode, loginContent, userContent, loadingContent, children }) {\n\tconst auth = useRenownAuth();\n\tif (children) return /* @__PURE__ */ jsx(Fragment, { children: children(auth) });\n\tif (auth.status === \"loading\" || auth.status === \"checking\") {\n\t\tif (loadingContent) return /* @__PURE__ */ jsx(\"div\", {\n\t\t\tclassName,\n\t\t\tchildren: loadingContent\n\t\t});\n\t\treturn /* @__PURE__ */ jsxs(\"div\", {\n\t\t\tclassName,\n\t\t\tchildren: [/* @__PURE__ */ jsxs(\"div\", {\n\t\t\t\tstyle: {\n\t\t\t\t\tdisplay: \"flex\",\n\t\t\t\t\talignItems: \"center\",\n\t\t\t\t\tgap: \"8px\",\n\t\t\t\t\tpadding: \"6px 12px\",\n\t\t\t\t\tborderRadius: \"8px\",\n\t\t\t\t\tborder: \"1px solid #e5e7eb\",\n\t\t\t\t\tanimation: \"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite\"\n\t\t\t\t},\n\t\t\t\tchildren: [/* @__PURE__ */ jsx(\"div\", { style: {\n\t\t\t\t\twidth: \"28px\",\n\t\t\t\t\theight: \"28px\",\n\t\t\t\t\tborderRadius: \"50%\",\n\t\t\t\t\tbackgroundColor: \"#e5e7eb\"\n\t\t\t\t} }), /* @__PURE__ */ jsx(\"div\", { style: {\n\t\t\t\t\twidth: \"80px\",\n\t\t\t\t\theight: \"14px\",\n\t\t\t\t\tborderRadius: \"4px\",\n\t\t\t\t\tbackgroundColor: \"#e5e7eb\"\n\t\t\t\t} })]\n\t\t\t}), /* @__PURE__ */ jsx(\"style\", { children: `@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }` })]\n\t\t});\n\t}\n\tif (auth.status === \"authorized\") {\n\t\tif (userContent) return /* @__PURE__ */ jsx(\"div\", {\n\t\t\tclassName,\n\t\t\tchildren: userContent\n\t\t});\n\t\treturn /* @__PURE__ */ jsx(\"div\", {\n\t\t\tclassName,\n\t\t\tchildren: /* @__PURE__ */ jsx(RenownUserButton, {})\n\t\t});\n\t}\n\tif (loginContent) return /* @__PURE__ */ jsx(\"div\", {\n\t\tclassName,\n\t\tchildren: loginContent\n\t});\n\treturn /* @__PURE__ */ jsx(\"div\", {\n\t\tclassName,\n\t\tchildren: /* @__PURE__ */ jsx(RenownLoginButton, { darkMode })\n\t});\n}\n//#endregion\n//#region src/renown/crypto.ts\n/**\n* @deprecated Use {@link initRenownCrypto} instead\n*\n* Initialize ConnectCrypto\n* @returns ConnectCrypto instance\n*/\nasync function initConnectCrypto() {\n\treturn initRenownCrypto();\n}\n/**\n* Initialize RenownCrypto\n* @returns RenownCrypto instance\n*/\nasync function initRenownCrypto() {\n\tconst keyStorage = await BrowserKeyStorage.create();\n\treturn await new RenownCryptoBuilder().withKeyPairStorage(keyStorage).build();\n}\n//#endregion\n//#region src/renown/use-renown-init.ts\nasync function initRenown(appName, namespace, url) {\n\taddRenownEventHandler();\n\tsetRenown(null);\n\tconst renown = await new RenownBuilder(appName, {\n\t\tbasename: namespace,\n\t\tbaseUrl: url\n\t}).build();\n\tsetRenown(renown);\n\tawait login(void 0, renown);\n\treturn renown;\n}\n/**\n* Hook that initializes the Renown SDK.\n* Call once at the top of your app. Options are read only on first mount.\n* Returns a promise that resolves with the Renown instance.\n*\n* @example\n* ```tsx\n* function App() {\n* const renownPromise = useRenownInit({ appName: \"my-app\" });\n* return <MyApp />;\n* }\n* ```\n*/\nfunction useRenownInit({ appName, namespace, url }) {\n\tconst promiseRef = useRef(null);\n\tpromiseRef.current ??= Promise.withResolvers();\n\tconst initRef = useRef(false);\n\tuseEffect(() => {\n\t\tif (initRef.current) return;\n\t\tinitRef.current = true;\n\t\tinitRenown(appName, namespace, url).then(promiseRef.current.resolve).catch(promiseRef.current.reject);\n\t}, []);\n\treturn promiseRef.current.promise;\n}\n//#endregion\n//#region src/renown/renown-init.tsx\n/**\n* Side-effect component that initializes the Renown SDK.\n* Renders nothing — place it alongside your app tree.\n*\n* @example\n* ```tsx\n* function App() {\n* return (\n* <>\n* <Renown appName=\"my-app\" onError={console.error} />\n* <MyApp />\n* </>\n* );\n* }\n* ```\n*/\nfunction Renown({ onError, ...initOptions }) {\n\tuseRenownInit(initOptions).catch(onError ?? console.error);\n\treturn null;\n}\n//#endregion\nexport { useLoginStatus as A, RENOWN_CHAIN_ID as C, addRenownEventHandler as D, VERIFIABLE_CREDENTIAL_EIP712_TYPE as E, setLoading as F, useLoading as I, useUser as M, addLoadingEventHandler as N, setRenown as O, loading as P, ISSUER_TYPE as S, RENOWN_URL as T, openRenown as _, RenownAuthButton as a, CREDENTIAL_TYPES as b, ChevronDownIcon as c, RenownLogo as d, SpinnerIcon as f, logout as g, login as h, initRenownCrypto as i, useRenown as j, useDid as k, CopyIcon as l, useRenownAuth as m, useRenownInit as n, RenownUserButton as o, UserIcon as p, initConnectCrypto as r, RenownLoginButton as s, Renown as t, DisconnectIcon as u, CREDENTIAL_SCHEMA_EIP712_TYPE as v, RENOWN_NETWORK_ID as w, DOMAIN_TYPE as x, CREDENTIAL_SUBJECT_TYPE as y };\n\n//# sourceMappingURL=renown-Dzmo1gJD.js.map","function e(e,t,n){let r=n=>e(n,...t);return n===void 0?r:Object.assign(r,{lazy:n,lazyArgs:t})}export{e as t};\n//# sourceMappingURL=lazyDataLastImpl-DtF3cihj.js.map","import{t as e}from\"./lazyDataLastImpl-DtF3cihj.js\";function t(t,n,r){let i=t.length-n.length;if(i===0)return t(...n);if(i===1)return e(t,n,r);throw Error(`Wrong number of arguments`)}export{t as purry};\n//# sourceMappingURL=purry.js.map","import{purry as e}from\"./purry.js\";function t(...t){return e(n,t)}const n=(e,t)=>t.every(t=>t(e));export{t as allPass};\n//# sourceMappingURL=allPass.js.map","function e(e,t,n){return e(n[0])?e=>t(e,...n):t(...n)}function t(...t){return e(r,n,t)}function n(e,...t){for(let n of t){if(typeof n==`function`)return n(e);let[t,r]=n;if(t(e))return r(e)}throw Error(`conditional: data failed for all cases`)}function r(e){if(!Array.isArray(e))return!1;let[t,n,...r]=e;return typeof t==`function`&&t.length<=1&&typeof n==`function`&&n.length<=1&&r.length===0}export{t};\n//# sourceMappingURL=conditional-CTEJD5TX.js.map","function e(e){return()=>e}export{e as constant};\n//# sourceMappingURL=constant.js.map","import{purry as e}from\"./purry.js\";function t(...t){return e(n,t)}const n=(e,t)=>e.length>=t;export{t as hasAtLeast};\n//# sourceMappingURL=hasAtLeast.js.map","const e=Symbol(`funnel/voidReducer`),t=()=>e;function n(n,{triggerAt:r=`end`,minQuietPeriodMs:i,maxBurstDurationMs:a,minGapMs:o,reducer:s=t}){let c,l,u,d,f=()=>{let t=u;t!==void 0&&(u=void 0,t===e?n():n(t),o!==void 0&&(l=setTimeout(p,o)))},p=()=>{clearTimeout(l),l=void 0,c===void 0&&f()},m=()=>{clearTimeout(c),c=void 0,d=void 0,l===void 0&&f()};return{call:(...e)=>{let t=c===void 0&&l===void 0;if((r!==`start`||t)&&(u=s(u,...e)),!(c===void 0&&!t)){if(i!==void 0||a!==void 0||o===void 0){clearTimeout(c);let e=Date.now();d??=e;let t=a===void 0?i??0:Math.min(i??a,Math.max(0,a-(e-d)));c=setTimeout(m,t)}r!==`end`&&t&&f()}},cancel:()=>{clearTimeout(c),c=void 0,d=void 0,clearTimeout(l),l=void 0,u=void 0},flush:()=>{m(),p()},get isIdle(){return c===void 0&&l===void 0}}}export{n as funnel};\n//# sourceMappingURL=funnel.js.map","function e(e){return e!==void 0}export{e as isDefined};\n//# sourceMappingURL=isDefined.js.map","function e(e){return t=>!e(t)}export{e as isNot};\n//# sourceMappingURL=isNot.js.map","import{purry as e}from\"./purry.js\";function t(...t){return e(n,t)}const n=(e,t)=>e===t||Object.is(e,t);export{t as isStrictEqual};\n//# sourceMappingURL=isStrictEqual.js.map","function e(e){return typeof e==`string`}export{e as isString};\n//# sourceMappingURL=isString.js.map","function e(e){return!!e}export{e as isTruthy};\n//# sourceMappingURL=isTruthy.js.map","function e(e){let t=!1,n;return()=>(t||=(n=e(),!0),n)}export{e as once};\n//# sourceMappingURL=once.js.map","/* global btoa */\nlet base64\n\nif (typeof window !== 'undefined') {\n if (window.btoa) {\n base64 = function (input) {\n return btoa(unescape(encodeURIComponent(input)))\n }\n } else {\n // Polyfill for environments that don't have btoa or Buffer class (notably, React Native).\n // Based on https://github.com/davidchambers/Base64.js/blob/a121f75bb10c8dd5d557886c4b1069b31258d230/base64.js\n base64 = function (input) {\n const str = unescape(encodeURIComponent(input + ''))\n let output = ''\n for (\n let block, charCode, idx = 0, map = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n str.charAt(idx | 0) || (map = '=', idx % 1);\n output += map.charAt(63 & block >> 8 - idx % 1 * 8)\n ) {\n charCode = str.charCodeAt(idx += 3 / 4)\n // This is a coherence check. The result of unescape(encodeURIComponent()) should always be\n // characters with code points that fit into two bytes.\n /* c8 ignore next 3 */\n if (charCode > 0xFF) {\n throw new Error(\"'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.\")\n }\n block = block << 8 | charCode\n }\n return output\n }\n }\n} else {\n base64 = function (input) {\n return Buffer.from(input).toString('base64')\n }\n}\n\nfunction slug (string, opts) {\n let result = slugify(string, opts)\n const fallback = opts && opts.fallback !== undefined ? opts.fallback : slug.defaults.fallback\n // If output is an empty string, try slug for base64 of string.\n if (fallback === true && result === '') {\n result = slugify(base64(string), opts)\n }\n return result\n}\n\nconst locales = {\n // http://www.eki.ee/wgrs/rom1_bg.pdf\n bg: { Й: 'Y', й: 'y', X: 'H', x: 'h', Ц: 'Ts', ц: 'ts', Щ: 'Sht', щ: 'sht', Ъ: 'A', ъ: 'a', Ь: 'Y', ь: 'y' },\n // Need a reference URL for German, although this is pretty well-known.\n de: { Ä: 'AE', ä: 'ae', Ö: 'OE', ö: 'oe', Ü: 'UE', ü: 'ue' },\n // Need a reference URL for Serbian.\n sr: { đ: 'dj', Đ: 'DJ' },\n // https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/864314/ROMANIZATION_OF_UKRAINIAN.pdf\n uk: { И: 'Y', и: 'y', Й: 'Y', й: 'y', Ц: 'Ts', ц: 'ts', Х: 'Kh', х: 'kh', Щ: 'Shch', щ: 'shch', Г: 'H', г: 'h' }\n}\n\nlet defaultLocale = {}\n\nfunction slugify (string, opts) {\n if (typeof string !== 'string') {\n throw new Error('slug() requires a string argument, received ' + typeof string)\n }\n if (!string.isWellFormed()) {\n throw new Error('slug() received a malformed string with lone surrogates')\n }\n if (typeof opts === 'string') { opts = { replacement: opts } }\n opts = opts ? Object.assign({}, opts) : {}\n opts.mode = opts.mode || slug.defaults.mode\n const defaults = slug.defaults.modes[opts.mode]\n const keys = ['replacement', 'multicharmap', 'charmap', 'remove', 'lower', 'trim']\n for (let key, i = 0, l = keys.length; i < l; i++) {\n key = keys[i]\n opts[key] = (key in opts) ? opts[key] : defaults[key]\n }\n const localeMap = locales[opts.locale] || defaultLocale\n\n let lengths = []\n for (const key in opts.multicharmap) {\n if (!Object.prototype.hasOwnProperty.call(opts.multicharmap, key)) { continue }\n\n const len = key.length\n if (lengths.indexOf(len) === -1) { lengths.push(len) }\n }\n\n // We want to match the longest string if there are multiple matches, so\n // sort lengths in descending order.\n lengths = lengths.sort(function (a, b) { return b - a })\n\n const disallowedChars = opts.mode === 'rfc3986' ? /[^\\w\\s\\-.~]/ : /[^A-Za-z0-9\\s]/\n\n let result = ''\n for (let char, i = 0, l = string.length; i < l; i++) {\n char = string[i]\n let matchedMultichar = false\n for (let j = 0; j < lengths.length; j++) {\n const len = lengths[j]\n const str = string.substr(i, len)\n if (opts.multicharmap[str]) {\n i += len - 1\n char = opts.multicharmap[str]\n matchedMultichar = true\n break\n }\n }\n if (!matchedMultichar) {\n if (localeMap[char]) {\n char = localeMap[char]\n } else if (opts.charmap[char]) {\n char = opts.charmap[char].replace(opts.replacement, ' ')\n } else if (char.includes(opts.replacement)) {\n // preserve the replacement character in case it is excluded by disallowedChars\n char = char.replace(opts.replacement, ' ')\n } else {\n char = char.replace(disallowedChars, '')\n }\n }\n result += char\n }\n\n if (opts.remove) {\n result = result.replace(opts.remove, '')\n }\n if (opts.trim) {\n result = result.trim()\n }\n result = result.replace(/\\s+/g, opts.replacement) // convert spaces\n if (opts.lower) {\n result = result.toLowerCase()\n }\n return result\n}\n\nconst initialMulticharmap = {\n // multibyte devanagari characters (hindi, sanskrit, etc.)\n फ़: 'Fi',\n ग़: 'Ghi',\n ख़: 'Khi',\n क़: 'Qi',\n ड़: 'ugDha',\n ढ़: 'ugDhha',\n य़: 'Yi',\n ज़: 'Za',\n // hebrew\n // Refs: http://www.eki.ee/wgrs/rom1_he.pdf\n // Refs: https://en.wikipedia.org/wiki/Niqqud\n בִי: 'i',\n בֵ: 'e',\n בֵי: 'e',\n בֶ: 'e',\n בַ: 'a',\n בָ: 'a',\n בֹ: 'o',\n וֹ: 'o',\n בֻ: 'u',\n וּ: 'u',\n בּ: 'b',\n כּ: 'k',\n ךּ: 'k',\n פּ: 'p',\n שׁ: 'sh',\n שׂ: 's',\n בְ: 'e',\n חֱ: 'e',\n חֲ: 'a',\n חֳ: 'o',\n בִ: 'i'\n}\n\n// https://github.com/django/django/blob/master/django/contrib/admin/static/admin/js/urlify.js\nconst initialCharmap = {\n // latin\n À: 'A',\n Á: 'A',\n Â: 'A',\n Ã: 'A',\n Ä: 'A',\n Å: 'A',\n Æ: 'AE',\n Ç: 'C',\n È: 'E',\n É: 'E',\n Ê: 'E',\n Ë: 'E',\n Ì: 'I',\n Í: 'I',\n Î: 'I',\n Ï: 'I',\n Ð: 'D',\n Ñ: 'N',\n Ò: 'O',\n Ó: 'O',\n Ô: 'O',\n Õ: 'O',\n Ö: 'O',\n Ő: 'O',\n Ø: 'O',\n Ō: 'O',\n Ù: 'U',\n Ú: 'U',\n Û: 'U',\n Ü: 'U',\n Ű: 'U',\n Ý: 'Y',\n Þ: 'TH',\n ß: 'ss',\n à: 'a',\n á: 'a',\n â: 'a',\n ã: 'a',\n ä: 'a',\n å: 'a',\n æ: 'ae',\n ç: 'c',\n è: 'e',\n é: 'e',\n ê: 'e',\n ë: 'e',\n ì: 'i',\n í: 'i',\n î: 'i',\n ï: 'i',\n ð: 'd',\n ñ: 'n',\n ò: 'o',\n ó: 'o',\n ô: 'o',\n õ: 'o',\n ö: 'o',\n ő: 'o',\n ø: 'o',\n ō: 'o',\n Œ: 'OE',\n œ: 'oe',\n ù: 'u',\n ú: 'u',\n û: 'u',\n ü: 'u',\n ű: 'u',\n ý: 'y',\n þ: 'th',\n ÿ: 'y',\n ẞ: 'SS',\n // greek\n α: 'a',\n β: 'b',\n γ: 'g',\n δ: 'd',\n ε: 'e',\n ζ: 'z',\n η: 'h',\n θ: 'th',\n ι: 'i',\n κ: 'k',\n λ: 'l',\n μ: 'm',\n ν: 'n',\n ξ: '3',\n ο: 'o',\n π: 'p',\n ρ: 'r',\n σ: 's',\n τ: 't',\n υ: 'y',\n φ: 'f',\n χ: 'x',\n ψ: 'ps',\n ω: 'w',\n ά: 'a',\n έ: 'e',\n ί: 'i',\n ό: 'o',\n ύ: 'y',\n ή: 'h',\n ώ: 'w',\n ς: 's',\n ϊ: 'i',\n ΰ: 'y',\n ϋ: 'y',\n ΐ: 'i',\n Α: 'A',\n Β: 'B',\n Γ: 'G',\n Δ: 'D',\n Ε: 'E',\n Ζ: 'Z',\n Η: 'H',\n Θ: 'Th',\n Ι: 'I',\n Κ: 'K',\n Λ: 'L',\n Μ: 'M',\n Ν: 'N',\n Ξ: '3',\n Ο: 'O',\n Π: 'P',\n Ρ: 'R',\n Σ: 'S',\n Τ: 'T',\n Υ: 'Y',\n Φ: 'F',\n Χ: 'X',\n Ψ: 'PS',\n Ω: 'W',\n Ά: 'A',\n Έ: 'E',\n Ί: 'I',\n Ό: 'O',\n Ύ: 'Y',\n Ή: 'H',\n Ώ: 'W',\n Ϊ: 'I',\n Ϋ: 'Y',\n // turkish\n ş: 's',\n Ş: 'S',\n ı: 'i',\n İ: 'I',\n ğ: 'g',\n Ğ: 'G',\n // russian\n а: 'a',\n б: 'b',\n в: 'v',\n г: 'g',\n д: 'd',\n е: 'e',\n ё: 'yo',\n ж: 'zh',\n з: 'z',\n и: 'i',\n й: 'j',\n к: 'k',\n л: 'l',\n м: 'm',\n н: 'n',\n о: 'o',\n п: 'p',\n р: 'r',\n с: 's',\n т: 't',\n у: 'u',\n ф: 'f',\n х: 'h',\n ц: 'c',\n ч: 'ch',\n ш: 'sh',\n щ: 'sh',\n ъ: 'u',\n ы: 'y',\n ь: '',\n э: 'e',\n ю: 'yu',\n я: 'ya',\n А: 'A',\n Б: 'B',\n В: 'V',\n Г: 'G',\n Д: 'D',\n Е: 'E',\n Ё: 'Yo',\n Ж: 'Zh',\n З: 'Z',\n И: 'I',\n Й: 'J',\n К: 'K',\n Л: 'L',\n М: 'M',\n Н: 'N',\n О: 'O',\n П: 'P',\n Р: 'R',\n С: 'S',\n Т: 'T',\n У: 'U',\n Ф: 'F',\n Х: 'H',\n Ц: 'C',\n Ч: 'Ch',\n Ш: 'Sh',\n Щ: 'Sh',\n Ъ: 'U',\n Ы: 'Y',\n Ь: '',\n Э: 'E',\n Ю: 'Yu',\n Я: 'Ya',\n // ukranian\n Є: 'Ye',\n І: 'I',\n Ї: 'Yi',\n Ґ: 'G',\n є: 'ye',\n і: 'i',\n ї: 'yi',\n ґ: 'g',\n // czech\n č: 'c',\n ď: 'd',\n ě: 'e',\n ň: 'n',\n ř: 'r',\n š: 's',\n ť: 't',\n ů: 'u',\n ž: 'z',\n Č: 'C',\n Ď: 'D',\n Ě: 'E',\n Ň: 'N',\n Ř: 'R',\n Š: 'S',\n Ť: 'T',\n Ů: 'U',\n Ž: 'Z',\n // slovak\n ľ: 'l',\n ĺ: 'l',\n ŕ: 'r',\n Ľ: 'L',\n Ĺ: 'L',\n Ŕ: 'R',\n // polish\n ą: 'a',\n ć: 'c',\n ę: 'e',\n ł: 'l',\n ń: 'n',\n ś: 's',\n ź: 'z',\n ż: 'z',\n Ą: 'A',\n Ć: 'C',\n Ę: 'E',\n Ł: 'L',\n Ń: 'N',\n Ś: 'S',\n Ź: 'Z',\n Ż: 'Z',\n // latvian\n ā: 'a',\n ē: 'e',\n ģ: 'g',\n ī: 'i',\n ķ: 'k',\n ļ: 'l',\n ņ: 'n',\n ū: 'u',\n Ā: 'A',\n Ē: 'E',\n Ģ: 'G',\n Ī: 'I',\n Ķ: 'K',\n Ļ: 'L',\n Ņ: 'N',\n Ū: 'U',\n // arabic\n أ: 'a',\n إ: 'i',\n ب: 'b',\n ت: 't',\n ث: 'th',\n ج: 'g',\n ح: 'h',\n خ: 'kh',\n د: 'd',\n ذ: 'th',\n ر: 'r',\n ز: 'z',\n س: 's',\n ش: 'sh',\n ص: 's',\n ض: 'd',\n ط: 't',\n ظ: 'th',\n ع: 'aa',\n غ: 'gh',\n ف: 'f',\n ق: 'k',\n ك: 'k',\n ل: 'l',\n م: 'm',\n ن: 'n',\n ه: 'h',\n و: 'o',\n ي: 'y',\n ء: 'aa',\n ة: 'a',\n // farsi\n آ: 'a',\n ا: 'a',\n پ: 'p',\n ژ: 'zh',\n گ: 'g',\n چ: 'ch',\n ک: 'k',\n ی: 'i',\n // lithuanian\n ė: 'e',\n į: 'i',\n ų: 'u',\n Ė: 'E',\n Į: 'I',\n Ų: 'U',\n // romanian\n ț: 't',\n Ț: 'T',\n ţ: 't',\n Ţ: 'T',\n ș: 's',\n Ș: 'S',\n ă: 'a',\n Ă: 'A',\n // vietnamese\n Ạ: 'A',\n Ả: 'A',\n Ầ: 'A',\n Ấ: 'A',\n Ậ: 'A',\n Ẩ: 'A',\n Ẫ: 'A',\n Ằ: 'A',\n Ắ: 'A',\n Ặ: 'A',\n Ẳ: 'A',\n Ẵ: 'A',\n Ẹ: 'E',\n Ẻ: 'E',\n Ẽ: 'E',\n Ề: 'E',\n Ế: 'E',\n Ệ: 'E',\n Ể: 'E',\n Ễ: 'E',\n Ị: 'I',\n Ỉ: 'I',\n Ĩ: 'I',\n Ọ: 'O',\n Ỏ: 'O',\n Ồ: 'O',\n Ố: 'O',\n Ộ: 'O',\n Ổ: 'O',\n Ỗ: 'O',\n Ơ: 'O',\n Ờ: 'O',\n Ớ: 'O',\n Ợ: 'O',\n Ở: 'O',\n Ỡ: 'O',\n Ụ: 'U',\n Ủ: 'U',\n Ũ: 'U',\n Ư: 'U',\n Ừ: 'U',\n Ứ: 'U',\n Ự: 'U',\n Ử: 'U',\n Ữ: 'U',\n Ỳ: 'Y',\n Ỵ: 'Y',\n Ỷ: 'Y',\n Ỹ: 'Y',\n Đ: 'D',\n ạ: 'a',\n ả: 'a',\n ầ: 'a',\n ấ: 'a',\n ậ: 'a',\n ẩ: 'a',\n ẫ: 'a',\n ằ: 'a',\n ắ: 'a',\n ặ: 'a',\n ẳ: 'a',\n ẵ: 'a',\n ẹ: 'e',\n ẻ: 'e',\n ẽ: 'e',\n ề: 'e',\n ế: 'e',\n ệ: 'e',\n ể: 'e',\n ễ: 'e',\n ị: 'i',\n ỉ: 'i',\n ĩ: 'i',\n ọ: 'o',\n ỏ: 'o',\n ồ: 'o',\n ố: 'o',\n ộ: 'o',\n ổ: 'o',\n ỗ: 'o',\n ơ: 'o',\n ờ: 'o',\n ớ: 'o',\n ợ: 'o',\n ở: 'o',\n ỡ: 'o',\n ụ: 'u',\n ủ: 'u',\n ũ: 'u',\n ư: 'u',\n ừ: 'u',\n ứ: 'u',\n ự: 'u',\n ử: 'u',\n ữ: 'u',\n ỳ: 'y',\n ỵ: 'y',\n ỷ: 'y',\n ỹ: 'y',\n đ: 'd',\n // kazakh\n Ә: 'AE',\n ә: 'ae',\n Ғ: 'GH',\n ғ: 'gh',\n Қ: 'KH',\n қ: 'kh',\n Ң: 'NG',\n ң: 'ng',\n Ү: 'UE',\n ү: 'ue',\n Ұ: 'U',\n ұ: 'u',\n Һ: 'H',\n һ: 'h',\n Ө: 'OE',\n ө: 'oe',\n // serbian\n ђ: 'dj',\n ј: 'j',\n љ: 'lj',\n њ: 'nj',\n ћ: 'c',\n џ: 'dz',\n Ђ: 'Dj',\n Ј: 'j',\n Љ: 'Lj',\n Њ: 'Nj',\n Ћ: 'C',\n Џ: 'Dz',\n nj: 'nj',\n lj: 'lj',\n Nj: 'NJ',\n Lj: 'LJ',\n // hindi\n अ: 'a',\n आ: 'aa',\n ए: 'e',\n ई: 'ii',\n ऍ: 'ei',\n ऎ: 'ae',\n ऐ: 'ai',\n इ: 'i',\n ओ: 'o',\n ऑ: 'oi',\n ऒ: 'oii',\n ऊ: 'uu',\n औ: 'ou',\n उ: 'u',\n ब: 'B',\n भ: 'Bha',\n च: 'Ca',\n छ: 'Chha',\n ड: 'Da',\n ढ: 'Dha',\n फ: 'Fa',\n ग: 'Ga',\n घ: 'Gha',\n ग़: 'Ghi',\n ह: 'Ha',\n ज: 'Ja',\n झ: 'Jha',\n क: 'Ka',\n ख: 'Kha',\n ख़: 'Khi',\n ल: 'L',\n ळ: 'Li',\n ऌ: 'Li',\n ऴ: 'Lii',\n ॡ: 'Lii',\n म: 'Ma',\n न: 'Na',\n ङ: 'Na',\n ञ: 'Nia',\n ण: 'Nae',\n ऩ: 'Ni',\n ॐ: 'oms',\n प: 'Pa',\n क़: 'Qi',\n र: 'Ra',\n ऋ: 'Ri',\n ॠ: 'Ri',\n ऱ: 'Ri',\n स: 'Sa',\n श: 'Sha',\n ष: 'Shha',\n ट: 'Ta',\n त: 'Ta',\n ठ: 'Tha',\n द: 'Tha',\n थ: 'Tha',\n ध: 'Thha',\n ड़: 'ugDha',\n ढ़: 'ugDhha',\n व: 'Va',\n य: 'Ya',\n य़: 'Yi',\n ज़: 'Za',\n // azerbaijani\n ə: 'e',\n Ə: 'E',\n // georgian\n ა: 'a',\n ბ: 'b',\n გ: 'g',\n დ: 'd',\n ე: 'e',\n ვ: 'v',\n ზ: 'z',\n თ: 't',\n ი: 'i',\n კ: 'k',\n ლ: 'l',\n მ: 'm',\n ნ: 'n',\n ო: 'o',\n პ: 'p',\n ჟ: 'zh',\n რ: 'r',\n ს: 's',\n ტ: 't',\n უ: 'u',\n ფ: 'p',\n ქ: 'k',\n ღ: 'gh',\n ყ: 'q',\n შ: 'sh',\n ჩ: 'ch',\n ც: 'ts',\n ძ: 'dz',\n წ: 'ts',\n ჭ: 'ch',\n ხ: 'kh',\n ჯ: 'j',\n ჰ: 'h',\n // hebrew\n ב: 'v',\n גּ: 'g',\n ג: 'g',\n ד: 'd',\n דּ: 'd',\n ה: 'h',\n ו: 'v',\n ז: 'z',\n ח: 'h',\n ט: 't',\n י: 'y',\n כ: 'kh',\n ך: 'kh',\n ל: 'l',\n מ: 'm',\n ם: 'm',\n נ: 'n',\n ן: 'n',\n ס: 's',\n פ: 'f',\n ף: 'f',\n ץ: 'ts',\n צ: 'ts',\n ק: 'k',\n ר: 'r',\n תּ: 't',\n ת: 't'\n}\n\nslug.charmap = Object.assign({}, initialCharmap)\nslug.multicharmap = Object.assign({}, initialMulticharmap)\nslug.defaults = {\n charmap: slug.charmap,\n mode: 'pretty',\n modes: {\n rfc3986: {\n replacement: '-',\n remove: null,\n lower: true,\n charmap: slug.charmap,\n multicharmap: slug.multicharmap,\n trim: true\n },\n pretty: {\n replacement: '-',\n remove: null,\n lower: true,\n charmap: slug.charmap,\n multicharmap: slug.multicharmap,\n trim: true\n }\n },\n multicharmap: slug.multicharmap,\n fallback: true\n}\n\nslug.reset = function () {\n slug.defaults.modes.rfc3986.charmap = slug.defaults.modes.pretty.charmap = slug.charmap = slug.defaults.charmap = Object.assign({}, initialCharmap)\n slug.defaults.modes.rfc3986.multicharmap = slug.defaults.modes.pretty.multicharmap = slug.multicharmap = slug.defaults.multicharmap = Object.assign({}, initialMulticharmap)\n defaultLocale = ''\n}\n\nslug.extend = function (customMap) {\n const keys = Object.keys(customMap)\n const multi = {}\n const single = {}\n for (let i = 0; i < keys.length; i++) {\n if (keys[i].length > 1) {\n multi[keys[i]] = customMap[keys[i]]\n } else {\n single[keys[i]] = customMap[keys[i]]\n }\n }\n Object.assign(slug.charmap, single)\n Object.assign(slug.multicharmap, multi)\n}\n\nslug.setLocale = function (locale) {\n defaultLocale = locales[locale] || {}\n}\n\nexport default slug\n","\nexport const normalizeDescriptors=(error)=>{\nCORE_ERROR_PROPS.forEach((propName)=>{\nnormalizeDescriptor(error,propName)\n})\n};\n\nexport const CORE_ERROR_PROPS=[\"name\",\"message\",\"stack\",\"cause\",\"errors\"];\n\nconst normalizeDescriptor=(error,propName)=>{\nconst descriptor=getDescriptor(error,propName);\n\nif(descriptor===undefined){\nreturn\n}\n\nif(isReadonlyGetter(descriptor)){\nsetErrorProperty(error,propName,error[propName]);\nreturn\n}\n\nif(isInvalidDescriptor(descriptor)){\nsetErrorDescriptor(error,propName,descriptor)\n}\n};\n\n\nexport const getDescriptor=(value,propName)=>{\nconst descriptor=Object.getOwnPropertyDescriptor(value,propName);\n\nif(descriptor!==undefined){\nreturn descriptor\n}\n\nconst prototype=Object.getPrototypeOf(value);\nreturn prototype===null?undefined:getDescriptor(prototype,propName)\n};\n\n\nconst isReadonlyGetter=({get,set})=>\nget!==undefined&&set===undefined;\n\nconst isInvalidDescriptor=({enumerable,writable})=>\nenumerable||!writable;\n\n\nexport const setErrorProperty=(error,propName,value)=>{\nsetErrorDescriptor(error,propName,{value})\n};\n\n\nconst setErrorDescriptor=(error,propName,descriptor)=>{\n\nObject.defineProperty(error,propName,{\n...descriptor,\n...(\"get\"in descriptor||\"set\"in descriptor?{}:{writable:true}),\nenumerable:false,\nconfigurable:true\n})\n};","import{setErrorProperty}from\"./descriptors.js\";\n\n\n\n\n\n\nexport const normalizeAggregate=(error,recurse)=>{\nif(Array.isArray(error.errors)){\nconst aggregateErrors=error.errors.\nfilter(isDefined).\nmap(recurse).\nfilter(Boolean);\nsetErrorProperty(error,\"errors\",aggregateErrors)\n}else if(isAggregateError(error)){\nsetErrorProperty(error,\"errors\",[])\n}else if(error.errors!==undefined){\ndeleteAggregateErrors(error)\n}\n};\n\nconst isDefined=(error)=>error!==undefined;\n\nconst isAggregateError=(error)=>\n\"AggregateError\"in globalThis&&(\nerror.name===\"AggregateError\"||error instanceof AggregateError);\n\nconst deleteAggregateErrors=(error)=>{\n\ndelete error.errors;\n\nif(error.errors!==undefined){\nsetErrorProperty(error,\"errors\",[])\n}\n};","import{setErrorProperty}from\"./descriptors.js\";\n\n\n\n\n\n\n\n\n\n\n\n\nexport const normalizeCause=(error,recurse)=>{\nif(!(\"cause\"in error)){\nreturn\n}\n\nconst cause=error.cause===undefined?error.cause:recurse(error.cause);\n\nif(cause===undefined){\n\ndelete error.cause\n}else{\nsetErrorProperty(error,\"cause\",cause)\n}\n};","\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst isErrorInstance=(value)=>\nisInstanceOfError(value)||hasErrorTag(value);\n\nexport default isErrorInstance;\n\n\n\nconst isInstanceOfError=(value)=>{\ntry{\nreturn value instanceof Error\n}catch{\nreturn false\n}\n};\n\nconst hasErrorTag=(value)=>{\ntry{\nreturn ERROR_TAGS.has(Object.prototype.toString.call(value))\n}catch{\nreturn false\n}\n};\n\nconst ERROR_TAGS=new Set([\n\n\"[object Error]\",\n\n\"[object DOMException]\",\n\n\"[object DOMError]\",\n\n\"[object Exception]\"]\n);","export default function isPlainObject(value) {\n\tif (typeof value !== 'object' || value === null) {\n\t\treturn false;\n\t}\n\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);\n}\n","import{CORE_ERROR_PROPS}from\"../descriptors.js\";\n\n\nexport const isNonModifiableError=(error)=>\n!Object.isExtensible(error)||\nCORE_ERROR_PROPS.some(\n(propName)=>\nisNonConfigurableProp(error,propName)||isThrowingProp(error,propName)\n);\n\n\n\nconst isNonConfigurableProp=(error,propName)=>{\nconst descriptor=Object.getOwnPropertyDescriptor(error,propName);\nreturn descriptor!==undefined&&!descriptor.configurable\n};\n\n\nconst isThrowingProp=(error,propName)=>{\ntry{\n\nerror[propName];\nreturn false\n}catch{\nreturn true\n}\n};","import{setErrorProperty}from\"./descriptors.js\";\n\n\n\n\n\n\n\n\n\n\nexport const setStack=(error)=>{\nconst stack=getStack(error.message,error.name);\nsetErrorProperty(error,\"stack\",stack)\n};\n\n\n\n\n\n\n\nconst getStack=(message=\"\",name=\"Error\")=>{\nconst StackError=getErrorClass(name);\nconst{stack}=new StackError(message);\nreturn typeof stack===\"string\"&&stack!==\"\"?\nstack:\n`${name}: ${message}`\n};\n\n\n\n\n\nconst getErrorClass=(name)=>{\nconst descriptor={\nvalue:name,\nenumerable:false,\nwritable:true,\nconfigurable:true\n};\n\nconst StackError=Object.defineProperty(\nclass extends Error{},\n\"name\",\ndescriptor\n);\n\nObject.defineProperty(StackError.prototype,\"name\",descriptor);\nreturn StackError\n};","import{CORE_ERROR_PROPS,getDescriptor}from\"../descriptors.js\";\n\n\n\n\nexport const copyObject=(object)=>{\nconst objectCopy={};\n\n\nfor(const propName of getPropsToCopy(object)){\n\ntry{\nconst value=object[propName];\nconst{\nenumerable,\nconfigurable,\nwritable=true\n}=getDescriptor(object,propName);\n\nObject.defineProperty(objectCopy,propName,{\nvalue,\nenumerable,\nconfigurable,\nwritable\n})\n}catch{}\n}\n\nreturn objectCopy\n};\n\n\n\n\n\nconst getPropsToCopy=(object)=>{\nconst propNames=getOwnKeys(object);\n\n\nfor(const propName of CORE_ERROR_PROPS){\n\nif(isInheritedProp(object,propName)){\n\npropNames.push(propName)\n}\n}\n\nreturn propNames\n};\n\n\nconst getOwnKeys=(object)=>{\ntry{\nreturn Reflect.ownKeys(object)\n}catch{\nreturn[]\n}\n};\n\n\nconst isInheritedProp=(object,propName)=>{\ntry{\nreturn propName in object&&!Object.hasOwn(object,propName)\n}catch{\nreturn false\n}\n};","import{setErrorProperty}from\"../descriptors.js\";\nimport{setStack}from\"../stack.js\";\n\nimport{copyObject}from\"./copy.js\";\n\n\nexport const objectifyError=(object)=>{\nconst{name,message,stack,cause,errors,...objectA}=copyObject(object);\nconst messageA=getMessage(message,objectA);\nconst error=newError(name,messageA);\n\nif(message===messageA){\nassignObjectProps(error,objectA)\n}\n\nObject.entries({name,stack,cause,errors}).forEach(\n([propName,propValue])=>{\nsetNewErrorProperty(error,propName,propValue)\n}\n);\n\nif(stack===undefined){\nsetStack(error)\n}\n\nreturn error\n};\n\n\nconst getMessage=(message,object)=>\ntypeof message===\"string\"&&message!==\"\"?\nmessage:\ntruncateMessage(safeJsonStringify(object));\n\nconst safeJsonStringify=(object)=>{\ntry{\nreturn JSON.stringify(object)\n}catch{\nreturn safeStringify(object)\n}\n};\n\nconst safeStringify=(object)=>{\ntry{\nreturn String(object)\n}catch{\nreturn\"Invalid error\"\n}\n};\n\nconst truncateMessage=(message)=>\nmessage.length<MESSAGE_MAX_SIZE?\nmessage:\n`${message.slice(0,MESSAGE_MAX_SIZE)}...`;\n\nconst MESSAGE_MAX_SIZE=1e3;\n\nconst newError=(name,message)=>{\nif(name===\"AggregateError\"&&\"AggregateError\"in globalThis){\nreturn new AggregateError([],message)\n}\n\nif(name in NATIVE_ERRORS){\nreturn new NATIVE_ERRORS[name](message)\n}\n\nreturn new Error(message)\n};\n\nconst NATIVE_ERRORS={\nError,\nReferenceError,\nTypeError,\nSyntaxError,\nRangeError,\nURIError,\nEvalError\n};\n\n\nconst assignObjectProps=(error,object)=>{\n\nfor(const propName in object){\n\nif(!(propName in error)){\nerror[propName]=object[propName]\n}\n}\n};\n\nconst setNewErrorProperty=(error,propName,propValue)=>{\nif(propValue!==undefined){\nsetErrorProperty(error,propName,propValue)\n}\n};","import{setStack}from\"../stack.js\";\n\n\nexport const stringifyError=(value)=>{\ntry{\nconst error=new Error(String(value));\nsetStack(error);\nreturn error\n}catch(error_){\nreturn error_\n}\n};","import isErrorInstance from\"is-error-instance\";\nimport isPlainObj from\"is-plain-obj\";\n\nimport{isNonModifiableError}from\"./modifiable.js\";\nimport{objectifyError}from\"./object.js\";\nimport{stringifyError}from\"./string.js\";\n\nconst{toString:objectToString}=Object.prototype;\n\n\nexport const createError=(value)=>{\nif(isErrorPlainObj(value)){\nreturn objectifyError(value)\n}\n\nif(!isErrorInstance(value)){\nreturn stringifyError(value)\n}\n\nif(isInvalidError(value)){\nreturn objectifyError(value)\n}\n\nreturn value\n};\n\n\nconst isErrorPlainObj=(value)=>{\ntry{\nreturn isPlainObj(value)\n}catch{\nreturn false\n}\n};\n\nconst isInvalidError=(value)=>\nisProxy(value)||isNonModifiableError(value)||hasInvalidConstructor(value);\n\n\n\n\nconst isProxy=(value)=>{\ntry{\nreturn objectToString.call(value)===\"[object Object]\"\n}catch{\nreturn true\n}\n};\n\n\n\nconst hasInvalidConstructor=(error)=>\ntypeof error.constructor!==\"function\"||\ntypeof error.constructor.name!==\"string\"||\nerror.constructor.name===\"\"||\nerror.constructor.prototype!==Object.getPrototypeOf(error);","import{normalizeAggregate}from\"./aggregate.js\";\nimport{normalizeCause}from\"./cause.js\";\nimport{createError}from\"./create/main.js\";\nimport{normalizeDescriptors,setErrorProperty}from\"./descriptors.js\";\nimport{setStack}from\"./stack.js\";\n\n\nconst normalizeException=(error,{shallow=false}={})=>\nrecurseException(error,[],shallow);\n\nexport default normalizeException;\n\nconst recurseException=(error,parents,shallow)=>{\nif(parents.includes(error)){\nreturn\n}\n\nconst recurse=shallow?\nidentity:\n(innerError)=>recurseException(innerError,[...parents,error],shallow);\n\nconst errorA=createError(error);\nnormalizeProps(errorA,recurse);\nreturn errorA\n};\n\nconst identity=(error)=>error;\n\nconst normalizeProps=(error,recurse)=>{\nnormalizeName(error);\nnormalizeMessage(error);\nnormalizeStack(error);\nnormalizeCause(error,recurse);\nnormalizeAggregate(error,recurse);\nnormalizeDescriptors(error)\n};\n\n\n\n\n\n\nconst normalizeName=(error)=>{\nif(isDefinedString(error.name)){\nreturn\n}\n\nconst prototypeName=Object.getPrototypeOf(error).name;\nconst name=isDefinedString(prototypeName)?\nprototypeName:\nerror.constructor.name;\nsetErrorProperty(error,\"name\",name)\n};\n\n\nconst normalizeMessage=(error)=>{\nif(!isDefinedString(error.message)){\nsetErrorProperty(error,\"message\",\"\")\n}\n};\n\n\nconst normalizeStack=(error)=>{\nif(!isDefinedString(error.stack)){\nsetStack(error)\n}\n};\n\nconst isDefinedString=(value)=>typeof value===\"string\"&&value!==\"\";","// Copyright (c) 2013 Pieroxy <pieroxy@pieroxy.net>\n// This work is free. You can redistribute it and/or modify it\n// under the terms of the WTFPL, Version 2\n// For more information see LICENSE.txt or http://www.wtfpl.net/\n//\n// For more information, the home page:\n// http://pieroxy.net/blog/pages/lz-string/testing.html\n//\n// LZ-based compression algorithm, version 1.4.5\nvar LZString = (function() {\n\n// private property\nvar f = String.fromCharCode;\nvar keyStrBase64 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\nvar keyStrUriSafe = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$\";\nvar baseReverseDic = {};\n\nfunction getBaseValue(alphabet, character) {\n if (!baseReverseDic[alphabet]) {\n baseReverseDic[alphabet] = {};\n for (var i=0 ; i<alphabet.length ; i++) {\n baseReverseDic[alphabet][alphabet.charAt(i)] = i;\n }\n }\n return baseReverseDic[alphabet][character];\n}\n\nvar LZString = {\n compressToBase64 : function (input) {\n if (input == null) return \"\";\n var res = LZString._compress(input, 6, function(a){return keyStrBase64.charAt(a);});\n switch (res.length % 4) { // To produce valid Base64\n default: // When could this happen ?\n case 0 : return res;\n case 1 : return res+\"===\";\n case 2 : return res+\"==\";\n case 3 : return res+\"=\";\n }\n },\n\n decompressFromBase64 : function (input) {\n if (input == null) return \"\";\n if (input == \"\") return null;\n return LZString._decompress(input.length, 32, function(index) { return getBaseValue(keyStrBase64, input.charAt(index)); });\n },\n\n compressToUTF16 : function (input) {\n if (input == null) return \"\";\n return LZString._compress(input, 15, function(a){return f(a+32);}) + \" \";\n },\n\n decompressFromUTF16: function (compressed) {\n if (compressed == null) return \"\";\n if (compressed == \"\") return null;\n return LZString._decompress(compressed.length, 16384, function(index) { return compressed.charCodeAt(index) - 32; });\n },\n\n //compress into uint8array (UCS-2 big endian format)\n compressToUint8Array: function (uncompressed) {\n var compressed = LZString.compress(uncompressed);\n var buf=new Uint8Array(compressed.length*2); // 2 bytes per character\n\n for (var i=0, TotalLen=compressed.length; i<TotalLen; i++) {\n var current_value = compressed.charCodeAt(i);\n buf[i*2] = current_value >>> 8;\n buf[i*2+1] = current_value % 256;\n }\n return buf;\n },\n\n //decompress from uint8array (UCS-2 big endian format)\n decompressFromUint8Array:function (compressed) {\n if (compressed===null || compressed===undefined){\n return LZString.decompress(compressed);\n } else {\n var buf=new Array(compressed.length/2); // 2 bytes per character\n for (var i=0, TotalLen=buf.length; i<TotalLen; i++) {\n buf[i]=compressed[i*2]*256+compressed[i*2+1];\n }\n\n var result = [];\n buf.forEach(function (c) {\n result.push(f(c));\n });\n return LZString.decompress(result.join(''));\n\n }\n\n },\n\n\n //compress into a string that is already URI encoded\n compressToEncodedURIComponent: function (input) {\n if (input == null) return \"\";\n return LZString._compress(input, 6, function(a){return keyStrUriSafe.charAt(a);});\n },\n\n //decompress from an output of compressToEncodedURIComponent\n decompressFromEncodedURIComponent:function (input) {\n if (input == null) return \"\";\n if (input == \"\") return null;\n input = input.replace(/ /g, \"+\");\n return LZString._decompress(input.length, 32, function(index) { return getBaseValue(keyStrUriSafe, input.charAt(index)); });\n },\n\n compress: function (uncompressed) {\n return LZString._compress(uncompressed, 16, function(a){return f(a);});\n },\n _compress: function (uncompressed, bitsPerChar, getCharFromInt) {\n if (uncompressed == null) return \"\";\n var i, value,\n context_dictionary= {},\n context_dictionaryToCreate= {},\n context_c=\"\",\n context_wc=\"\",\n context_w=\"\",\n context_enlargeIn= 2, // Compensate for the first entry which should not count\n context_dictSize= 3,\n context_numBits= 2,\n context_data=[],\n context_data_val=0,\n context_data_position=0,\n ii;\n\n for (ii = 0; ii < uncompressed.length; ii += 1) {\n context_c = uncompressed.charAt(ii);\n if (!Object.prototype.hasOwnProperty.call(context_dictionary,context_c)) {\n context_dictionary[context_c] = context_dictSize++;\n context_dictionaryToCreate[context_c] = true;\n }\n\n context_wc = context_w + context_c;\n if (Object.prototype.hasOwnProperty.call(context_dictionary,context_wc)) {\n context_w = context_wc;\n } else {\n if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate,context_w)) {\n if (context_w.charCodeAt(0)<256) {\n for (i=0 ; i<context_numBits ; i++) {\n context_data_val = (context_data_val << 1);\n if (context_data_position == bitsPerChar-1) {\n context_data_position = 0;\n context_data.push(getCharFromInt(context_data_val));\n context_data_val = 0;\n } else {\n context_data_position++;\n }\n }\n value = context_w.charCodeAt(0);\n for (i=0 ; i<8 ; i++) {\n context_data_val = (context_data_val << 1) | (value&1);\n if (context_data_position == bitsPerChar-1) {\n context_data_position = 0;\n context_data.push(getCharFromInt(context_data_val));\n context_data_val = 0;\n } else {\n context_data_position++;\n }\n value = value >> 1;\n }\n } else {\n value = 1;\n for (i=0 ; i<context_numBits ; i++) {\n context_data_val = (context_data_val << 1) | value;\n if (context_data_position ==bitsPerChar-1) {\n context_data_position = 0;\n context_data.push(getCharFromInt(context_data_val));\n context_data_val = 0;\n } else {\n context_data_position++;\n }\n value = 0;\n }\n value = context_w.charCodeAt(0);\n for (i=0 ; i<16 ; i++) {\n context_data_val = (context_data_val << 1) | (value&1);\n if (context_data_position == bitsPerChar-1) {\n context_data_position = 0;\n context_data.push(getCharFromInt(context_data_val));\n context_data_val = 0;\n } else {\n context_data_position++;\n }\n value = value >> 1;\n }\n }\n context_enlargeIn--;\n if (context_enlargeIn == 0) {\n context_enlargeIn = Math.pow(2, context_numBits);\n context_numBits++;\n }\n delete context_dictionaryToCreate[context_w];\n } else {\n value = context_dictionary[context_w];\n for (i=0 ; i<context_numBits ; i++) {\n context_data_val = (context_data_val << 1) | (value&1);\n if (context_data_position == bitsPerChar-1) {\n context_data_position = 0;\n context_data.push(getCharFromInt(context_data_val));\n context_data_val = 0;\n } else {\n context_data_position++;\n }\n value = value >> 1;\n }\n\n\n }\n context_enlargeIn--;\n if (context_enlargeIn == 0) {\n context_enlargeIn = Math.pow(2, context_numBits);\n context_numBits++;\n }\n // Add wc to the dictionary.\n context_dictionary[context_wc] = context_dictSize++;\n context_w = String(context_c);\n }\n }\n\n // Output the code for w.\n if (context_w !== \"\") {\n if (Object.prototype.hasOwnProperty.call(context_dictionaryToCreate,context_w)) {\n if (context_w.charCodeAt(0)<256) {\n for (i=0 ; i<context_numBits ; i++) {\n context_data_val = (context_data_val << 1);\n if (context_data_position == bitsPerChar-1) {\n context_data_position = 0;\n context_data.push(getCharFromInt(context_data_val));\n context_data_val = 0;\n } else {\n context_data_position++;\n }\n }\n value = context_w.charCodeAt(0);\n for (i=0 ; i<8 ; i++) {\n context_data_val = (context_data_val << 1) | (value&1);\n if (context_data_position == bitsPerChar-1) {\n context_data_position = 0;\n context_data.push(getCharFromInt(context_data_val));\n context_data_val = 0;\n } else {\n context_data_position++;\n }\n value = value >> 1;\n }\n } else {\n value = 1;\n for (i=0 ; i<context_numBits ; i++) {\n context_data_val = (context_data_val << 1) | value;\n if (context_data_position == bitsPerChar-1) {\n context_data_position = 0;\n context_data.push(getCharFromInt(context_data_val));\n context_data_val = 0;\n } else {\n context_data_position++;\n }\n value = 0;\n }\n value = context_w.charCodeAt(0);\n for (i=0 ; i<16 ; i++) {\n context_data_val = (context_data_val << 1) | (value&1);\n if (context_data_position == bitsPerChar-1) {\n context_data_position = 0;\n context_data.push(getCharFromInt(context_data_val));\n context_data_val = 0;\n } else {\n context_data_position++;\n }\n value = value >> 1;\n }\n }\n context_enlargeIn--;\n if (context_enlargeIn == 0) {\n context_enlargeIn = Math.pow(2, context_numBits);\n context_numBits++;\n }\n delete context_dictionaryToCreate[context_w];\n } else {\n value = context_dictionary[context_w];\n for (i=0 ; i<context_numBits ; i++) {\n context_data_val = (context_data_val << 1) | (value&1);\n if (context_data_position == bitsPerChar-1) {\n context_data_position = 0;\n context_data.push(getCharFromInt(context_data_val));\n context_data_val = 0;\n } else {\n context_data_position++;\n }\n value = value >> 1;\n }\n\n\n }\n context_enlargeIn--;\n if (context_enlargeIn == 0) {\n context_enlargeIn = Math.pow(2, context_numBits);\n context_numBits++;\n }\n }\n\n // Mark the end of the stream\n value = 2;\n for (i=0 ; i<context_numBits ; i++) {\n context_data_val = (context_data_val << 1) | (value&1);\n if (context_data_position == bitsPerChar-1) {\n context_data_position = 0;\n context_data.push(getCharFromInt(context_data_val));\n context_data_val = 0;\n } else {\n context_data_position++;\n }\n value = value >> 1;\n }\n\n // Flush the last char\n while (true) {\n context_data_val = (context_data_val << 1);\n if (context_data_position == bitsPerChar-1) {\n context_data.push(getCharFromInt(context_data_val));\n break;\n }\n else context_data_position++;\n }\n return context_data.join('');\n },\n\n decompress: function (compressed) {\n if (compressed == null) return \"\";\n if (compressed == \"\") return null;\n return LZString._decompress(compressed.length, 32768, function(index) { return compressed.charCodeAt(index); });\n },\n\n _decompress: function (length, resetValue, getNextValue) {\n var dictionary = [],\n next,\n enlargeIn = 4,\n dictSize = 4,\n numBits = 3,\n entry = \"\",\n result = [],\n i,\n w,\n bits, resb, maxpower, power,\n c,\n data = {val:getNextValue(0), position:resetValue, index:1};\n\n for (i = 0; i < 3; i += 1) {\n dictionary[i] = i;\n }\n\n bits = 0;\n maxpower = Math.pow(2,2);\n power=1;\n while (power!=maxpower) {\n resb = data.val & data.position;\n data.position >>= 1;\n if (data.position == 0) {\n data.position = resetValue;\n data.val = getNextValue(data.index++);\n }\n bits |= (resb>0 ? 1 : 0) * power;\n power <<= 1;\n }\n\n switch (next = bits) {\n case 0:\n bits = 0;\n maxpower = Math.pow(2,8);\n power=1;\n while (power!=maxpower) {\n resb = data.val & data.position;\n data.position >>= 1;\n if (data.position == 0) {\n data.position = resetValue;\n data.val = getNextValue(data.index++);\n }\n bits |= (resb>0 ? 1 : 0) * power;\n power <<= 1;\n }\n c = f(bits);\n break;\n case 1:\n bits = 0;\n maxpower = Math.pow(2,16);\n power=1;\n while (power!=maxpower) {\n resb = data.val & data.position;\n data.position >>= 1;\n if (data.position == 0) {\n data.position = resetValue;\n data.val = getNextValue(data.index++);\n }\n bits |= (resb>0 ? 1 : 0) * power;\n power <<= 1;\n }\n c = f(bits);\n break;\n case 2:\n return \"\";\n }\n dictionary[3] = c;\n w = c;\n result.push(c);\n while (true) {\n if (data.index > length) {\n return \"\";\n }\n\n bits = 0;\n maxpower = Math.pow(2,numBits);\n power=1;\n while (power!=maxpower) {\n resb = data.val & data.position;\n data.position >>= 1;\n if (data.position == 0) {\n data.position = resetValue;\n data.val = getNextValue(data.index++);\n }\n bits |= (resb>0 ? 1 : 0) * power;\n power <<= 1;\n }\n\n switch (c = bits) {\n case 0:\n bits = 0;\n maxpower = Math.pow(2,8);\n power=1;\n while (power!=maxpower) {\n resb = data.val & data.position;\n data.position >>= 1;\n if (data.position == 0) {\n data.position = resetValue;\n data.val = getNextValue(data.index++);\n }\n bits |= (resb>0 ? 1 : 0) * power;\n power <<= 1;\n }\n\n dictionary[dictSize++] = f(bits);\n c = dictSize-1;\n enlargeIn--;\n break;\n case 1:\n bits = 0;\n maxpower = Math.pow(2,16);\n power=1;\n while (power!=maxpower) {\n resb = data.val & data.position;\n data.position >>= 1;\n if (data.position == 0) {\n data.position = resetValue;\n data.val = getNextValue(data.index++);\n }\n bits |= (resb>0 ? 1 : 0) * power;\n power <<= 1;\n }\n dictionary[dictSize++] = f(bits);\n c = dictSize-1;\n enlargeIn--;\n break;\n case 2:\n return result.join('');\n }\n\n if (enlargeIn == 0) {\n enlargeIn = Math.pow(2, numBits);\n numBits++;\n }\n\n if (dictionary[c]) {\n entry = dictionary[c];\n } else {\n if (c === dictSize) {\n entry = w + w.charAt(0);\n } else {\n return null;\n }\n }\n result.push(entry);\n\n // Add w+entry[0] to the dictionary.\n dictionary[dictSize++] = w + entry.charAt(0);\n enlargeIn--;\n\n w = entry;\n\n if (enlargeIn == 0) {\n enlargeIn = Math.pow(2, numBits);\n numBits++;\n }\n\n }\n }\n};\n return LZString;\n})();\n\nif (typeof define === 'function' && define.amd) {\n define(function () { return LZString; });\n} else if( typeof module !== 'undefined' && module != null ) {\n module.exports = LZString\n} else if( typeof angular !== 'undefined' && angular != null ) {\n angular.module('LZString', [])\n .factory('LZString', function () {\n return LZString;\n });\n}\n","import { C as queueOperations, S as queueActions, _ as getAnalyticsStore, a as setDocumentCache, b as setGlobal, c as useDocumentSafe, d as useGetDocumentAsync, f as useGetDocuments, g as createAnalyticsStore, h as readPromiseState, i as addDocumentCacheEventHandler, l as useDocuments, m as addPromiseState, n as useDocumentsByIds, o as useDocument, p as DocumentCache, r as useDispatch, s as useDocumentCache, t as useDocumentById, u as useGetDocument, v as clearGlobal, w as uploadOperations, x as dispatchActions, y as getGlobal } from \"./document-by-id-BrIy0iHX.js\";\nimport { n as GetDocumentWithOperationsDocument, r as PropagationMode, t as createClient } from \"./client-CvgFU1Dv.js\";\nimport { t as makePHEventFunctions } from \"./make-ph-event-functions-DwiD1zH9.js\";\nimport { A as useLoginStatus, C as RENOWN_CHAIN_ID, D as addRenownEventHandler, E as VERIFIABLE_CREDENTIAL_EIP712_TYPE, F as setLoading, I as useLoading, M as useUser, N as addLoadingEventHandler, O as setRenown, P as loading, S as ISSUER_TYPE, T as RENOWN_URL, _ as openRenown, a as RenownAuthButton, b as CREDENTIAL_TYPES, c as ChevronDownIcon, d as RenownLogo, f as SpinnerIcon, g as logout, h as login, i as initRenownCrypto, j as useRenown, k as useDid, l as CopyIcon, m as useRenownAuth, n as useRenownInit, o as RenownUserButton, p as UserIcon, r as initConnectCrypto, s as RenownLoginButton, t as Renown, u as DisconnectIcon, v as CREDENTIAL_SCHEMA_EIP712_TYPE, w as RENOWN_NETWORK_ID, x as DOMAIN_TYPE, y as CREDENTIAL_SUBJECT_TYPE } from \"./renown-Dzmo1gJD.js\";\nimport { n as useRelationalQuery, r as useRelationalDb, t as createProcessorQuery } from \"./relational-4_LVwp8p.js\";\nimport { documentModelDocumentModelModule, logger } from \"document-model\";\nimport { baseLoadFromInput, baseSaveToFileHandle, createPresignedHeader, createZip, documentModelDocumentType, generateId, replayDocument, setName, validateInitialState, validateModules, validateStateSchemaName } from \"@powerhousedao/shared/document-model\";\nimport { DriveDocumentSchema, addFolder as addFolder$1, copyNode, driveCreateDocument, driveDocumentModelModule, generateNodesCopy, handleTargetNameCollisions, isFileNode, isFolderNode, moveNode, setAvailableOffline, setDriveIcon, setDriveName, setSharingType, updateNode } from \"@powerhousedao/shared/document-drive\";\nimport { allPass, conditional, constant, filter, find, forEach, forEachObj, funnel, hasAtLeast, isArray, isDefined, isIncludedIn, isNot, isStrictEqual, isString, isTruthy, last, map, mapToObj, once, pipe, prop, split, unique } from \"remeda\";\nimport { ChannelScheme, DocumentChangeType, DocumentChangeType as DocumentChangeType$1, DocumentIntegrityService, DuplicateManifestError, DuplicateModuleError, GqlRequestChannel, InMemoryQueue, IntervalPollTimer, ModuleNotFoundError, PollBehavior, PropagationMode as PropagationMode$1, REACTOR_SCHEMA, REACTOR_SCHEMA as REACTOR_SCHEMA$1, ReactorBuilder, ReactorClientBuilder, RelationalDbProcessor, SyncOperationStatus, SyncStatus, driveCollectionId, driveCollectionId as driveCollectionId$1, driveIdFromUrl, parseDriveUrl } from \"@powerhousedao/reactor\";\nimport { reactorDriveDocumentModelModule } from \"@powerhousedao/reactor-drive\";\nimport { z } from \"zod\";\nimport { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from \"react\";\nimport slug from \"slug\";\nimport normalizeException from \"normalize-exception\";\nimport * as lzString from \"lz-string\";\nimport { createAttachmentClient } from \"@powerhousedao/reactor-attachments/client\";\n//#region src/errors.ts\nvar UnsupportedDocumentTypeError = class extends Error {\n\tconstructor(documentType) {\n\t\tsuper(`Document type ${documentType} is not supported`);\n\t\tthis.name = \"UnsupportedDocumentTypeError\";\n\t}\n\tstatic isError(error) {\n\t\treturn Error.isError(error) && error.name === \"UnsupportedDocumentTypeError\";\n\t}\n};\nvar DocumentModelNotFoundError = class extends Error {\n\tdocumentType;\n\tname = \"DocumentModelNotFoundError\";\n\tconstructor(documentType) {\n\t\tsuper(`Document model module for type ${documentType} not found`);\n\t\tthis.documentType = documentType;\n\t}\n\tstatic isError(error) {\n\t\treturn Error.isError(error) && error.name === \"DocumentModelNotFoundError\";\n\t}\n};\nvar DocumentTypeMismatchError = class extends Error {\n\tconstructor(documentId, expectedType, actualType) {\n\t\tsuper(`Document ${documentId} is not of type ${expectedType}. Actual type: ${actualType}`);\n\t}\n};\nvar NoSelectedDocumentError = class extends Error {\n\tconstructor() {\n\t\tsuper(\"There is no selected document. Did you mean to call 'useSelectedDocumentSafe' instead?\");\n\t}\n};\n//#endregion\n//#region src/utils/documents.ts\nfunction isDocumentTypeSupported(documentType, supportedDocuments) {\n\tif (!supportedDocuments?.length) return true;\n\treturn supportedDocuments.some((pattern) => {\n\t\tif (pattern.endsWith(\"/*\")) {\n\t\t\tconst prefix = pattern.slice(0, -2);\n\t\t\treturn documentType.startsWith(prefix + \"/\");\n\t\t}\n\t\tif (pattern.endsWith(\"*\") && !pattern.endsWith(\"/*\")) {\n\t\t\tconst prefix = pattern.slice(0, -1);\n\t\t\treturn documentType.startsWith(prefix);\n\t\t}\n\t\treturn pattern === documentType;\n\t});\n}\n//#endregion\n//#region src/utils/user.ts\nfunction getUserPermissions() {\n\tconst user = window.ph?.renown?.user;\n\tconst allowList = window.ph?.allowList;\n\tif (!allowList) return {\n\t\tisAllowedToCreateDocuments: true,\n\t\tisAllowedToEditDocuments: true\n\t};\n\treturn {\n\t\tisAllowedToCreateDocuments: allowList.includes(user?.address ?? \"\"),\n\t\tisAllowedToEditDocuments: allowList.includes(user?.address ?? \"\")\n\t};\n}\n//#endregion\n//#region src/actions/document.ts\nconst BASE_STATE_KEYS = new Set([\"auth\"]);\nconst NON_DOMAIN_SCOPES = new Set([\"auth\", \"document\"]);\nasync function isDocumentInLocation(document, driveId, parentFolder) {\n\tconst reactorClient = window.ph?.reactorClient;\n\tif (!reactorClient) return { isDuplicate: false };\n\tlet drive;\n\ttry {\n\t\tdrive = await reactorClient.get(driveId);\n\t} catch {\n\t\treturn { isDuplicate: false };\n\t}\n\tconst nodeById = drive.state.global.nodes.find((node) => node.id === document.header.id);\n\tif (nodeById && nodeById.parentFolder === (parentFolder ?? null)) return {\n\t\tisDuplicate: true,\n\t\tduplicateType: \"id\",\n\t\tnodeId: nodeById.id\n\t};\n\tconst nodeByNameAndType = drive.state.global.nodes.find((node) => isFileNode(node) && node.name === document.header.name && node.documentType === document.header.documentType && node.parentFolder === (parentFolder ?? null));\n\tif (nodeByNameAndType) return {\n\t\tisDuplicate: true,\n\t\tduplicateType: \"name\",\n\t\tnodeId: nodeByNameAndType.id\n\t};\n\treturn { isDuplicate: false };\n}\nfunction getDocumentTypeIcon(document) {\n\tswitch (document.header.documentType) {\n\t\tcase \"powerhouse/document-model\": return \"document-model\";\n\t\tcase \"powerhouse/app\": return \"app\";\n\t\tcase \"powerhouse/document-editor\": return \"editor\";\n\t\tcase \"powerhouse/subgraph\": return \"subgraph\";\n\t\tcase \"powerhouse/package\": return \"package\";\n\t\tcase \"powerhouse/processor\": {\n\t\t\tconst processorType = document.state.global?.type;\n\t\t\tif (processorType === \"analytics\") return \"analytics-processor\";\n\t\t\tif (processorType === \"relational\") return \"relational-processor\";\n\t\t\tif (processorType === \"codegen\") return \"codegen-processor\";\n\t\t\treturn;\n\t\t}\n\t\tdefault: return;\n\t}\n}\nasync function downloadFile(document, fileName) {\n\ttry {\n\t\tconst data = await createZip(document);\n\t\tconst blob = new Blob([new Uint8Array(data)], { type: \"application/zip\" });\n\t\tconst link = window.document.createElement(\"a\");\n\t\tlink.style.display = \"none\";\n\t\tlink.href = URL.createObjectURL(blob);\n\t\tlink.download = fileName;\n\t\twindow.document.body.appendChild(link);\n\t\tlink.click();\n\t\twindow.document.body.removeChild(link);\n\t} catch (e) {\n\t\tlogger.error(e instanceof Error ? e.message : String(e));\n\t}\n}\nasync function getDocumentExtension(document) {\n\tconst documentType = document.header.documentType;\n\tlet rawExtension;\n\tif (documentType === documentModelDocumentType) rawExtension = document.state.global?.extension;\n\telse {\n\t\tconst reactorClient = window.ph?.reactorClient;\n\t\tif (reactorClient) {\n\t\t\tconst { results: documentModelModules } = await reactorClient.getDocumentModelModules();\n\t\t\trawExtension = documentModelModules.find((m) => m.documentModel.global.id === documentType)?.utils.fileExtension;\n\t\t}\n\t}\n\treturn (rawExtension ?? \"\").replace(/^\\.+|\\.+$/g, \"\");\n}\n/**\n* Fetches all operations for a document using cursor-based pagination.\n* The reactor client handles multi-scope cursors transparently via\n* composite cursors, so all scopes are fetched in a single paginated stream.\n*/\nasync function fetchDocumentOperations(reactorClient, document, pageSize = 100) {\n\tconst scopes = Object.keys(document.state).filter((k) => !BASE_STATE_KEYS.has(k));\n\tconst operations = {};\n\tfor (const scope of scopes) operations[scope] = [];\n\tlet cursor = \"\";\n\tdo {\n\t\tconst page = await reactorClient.getOperations(document.header.id, { scopes }, void 0, {\n\t\t\tcursor,\n\t\t\tlimit: pageSize\n\t\t});\n\t\tfor (const op of page.results) {\n\t\t\tconst scope = op.action.scope ?? \"global\";\n\t\t\tif (operations[scope]) operations[scope].push(op);\n\t\t}\n\t\tcursor = page.nextCursor ?? \"\";\n\t} while (cursor);\n\treturn operations;\n}\nfunction extractInitialState(documentScopeOps) {\n\tconst upgradeOp = documentScopeOps.find((op) => op.action.type === \"UPGRADE_DOCUMENT\");\n\tif (!upgradeOp) throw new Error(\"No UPGRADE_DOCUMENT operation found — document is invalid\");\n\tconst input = upgradeOp.action.input;\n\tconst initialState = input.initialState ?? input.state;\n\tif (!initialState) throw new Error(\"UPGRADE_DOCUMENT operation has no initialState — document is invalid\");\n\treturn initialState;\n}\nfunction filterDomainOperations(operations) {\n\treturn Object.fromEntries(Object.entries(operations).filter(([scope]) => !NON_DOMAIN_SCOPES.has(scope)));\n}\nasync function exportFile(document, suggestedName) {\n\tconst reactorClient = window.ph?.reactorClient;\n\tif (!reactorClient) throw new Error(\"ReactorClient not initialized\");\n\tconst operations = await fetchDocumentOperations(reactorClient, document);\n\tconst initialState = extractInitialState(operations[\"document\"] ?? []);\n\tconst documentWithOps = {\n\t\t...document,\n\t\toperations,\n\t\tinitialState\n\t};\n\tconst extension = await getDocumentExtension(documentWithOps);\n\tconst baseName = suggestedName || documentWithOps.header.name || \"Untitled\";\n\tconst name = extension ? `${baseName}.${extension}.phd` : `${baseName}.phd`;\n\tif (!window.showSaveFilePicker) return await downloadFile(documentWithOps, name);\n\ttry {\n\t\tconst fileHandle = await window.showSaveFilePicker({ suggestedName: name });\n\t\tawait baseSaveToFileHandle(documentWithOps, fileHandle);\n\t\treturn fileHandle;\n\t} catch (e) {\n\t\tif (!(e instanceof DOMException && e.name === \"AbortError\")) throw e;\n\t}\n}\nasync function loadFile(path) {\n\tconst baseDocument = await baseLoadFromInput(path, (state) => state, { checkHashes: true });\n\tconst reactorClient = window.ph?.reactorClient;\n\tif (!reactorClient) throw new Error(\"ReactorClient not initialized\");\n\tconst { results: documentModelModules } = await reactorClient.getDocumentModelModules();\n\tconst documentModelModule = documentModelModules.find((module) => module.documentModel.global.id === baseDocument.header.documentType);\n\tif (!documentModelModule) throw new DocumentModelNotFoundError(baseDocument.header.documentType);\n\treturn documentModelModule.utils.loadFromInput(path);\n}\nasync function addDocument(driveId, name, documentType, parentFolder, document, id, preferredEditor) {\n\tconst { isAllowedToCreateDocuments } = getUserPermissions();\n\tif (!isAllowedToCreateDocuments) throw new Error(\"User is not allowed to create documents\");\n\tconst reactorClient = window.ph?.reactorClient;\n\tif (!reactorClient) throw new Error(\"ReactorClient not initialized\");\n\tconst documentModelModule = await reactorClient.getDocumentModelModule(documentType);\n\tconst newDocument = document ?? documentModelModule.utils.createDocument();\n\tnewDocument.header.name = name;\n\tif (preferredEditor) newDocument.header.meta = {\n\t\t...newDocument.header.meta,\n\t\tpreferredEditor\n\t};\n\tlet newDoc;\n\ttry {\n\t\tnewDoc = await reactorClient.drives.addFile(driveId, newDocument, parentFolder);\n\t} catch (e) {\n\t\tlogger.error(\"Error adding document: @error\", e);\n\t\tthrow new Error(\"There was an error adding document\", { cause: e });\n\t}\n\treturn {\n\t\tid: newDoc.header.id,\n\t\tname: newDoc.header.name,\n\t\tdocumentType,\n\t\tparentFolder: parentFolder ?? null,\n\t\tkind: \"file\"\n\t};\n}\nasync function addFile(file, driveId, name, parentFolder) {\n\tlogger.verbose(`addFile(drive: ${driveId}, name: ${name}, folder: ${parentFolder})`);\n\tconst { isAllowedToCreateDocuments } = getUserPermissions();\n\tif (!isAllowedToCreateDocuments) throw new Error(\"User is not allowed to create files\");\n\tconst document = await loadFile(file);\n\tlet duplicateId = false;\n\tconst reactorClient = window.ph?.reactorClient;\n\tif (!reactorClient) throw new Error(\"ReactorClient not initialized\");\n\ttry {\n\t\tawait reactorClient.get(document.header.id);\n\t\tduplicateId = true;\n\t} catch {}\n\tconst documentId = duplicateId ? generateId() : document.header.id;\n\tconst header = createPresignedHeader(documentId, document.header.documentType);\n\theader.lastModifiedAtUtcIso = document.header.createdAtUtcIso;\n\theader.meta = document.header.meta;\n\theader.name = name || document.header.name;\n\tconst initialDocument = {\n\t\t...document,\n\t\theader,\n\t\tstate: document.initialState,\n\t\toperations: Object.keys(document.operations).reduce((acc, key) => {\n\t\t\tacc[key] = [];\n\t\t\treturn acc;\n\t\t}, {})\n\t};\n\tawait addDocument(driveId, name || document.header.name, document.header.documentType, parentFolder, initialDocument, documentId, document.header.meta?.preferredEditor);\n\tawait uploadOperations(documentId, filterDomainOperations(document.operations), queueOperations);\n}\nasync function addFileWithProgress(file, driveId, name, parentFolder, onProgress, documentTypes, resolveConflict) {\n\tlogger.verbose(`addFileWithProgress(drive: ${driveId}, name: ${name}, folder: ${parentFolder})`);\n\tconst reactor = window.ph?.reactorClient;\n\tif (!reactor) return;\n\tconst { isAllowedToCreateDocuments } = getUserPermissions();\n\tif (!isAllowedToCreateDocuments) throw new Error(\"User is not allowed to create files\");\n\ttry {\n\t\tonProgress?.({\n\t\t\tstage: \"loading\",\n\t\t\tprogress: 0\n\t\t});\n\t\tlet document;\n\t\ttry {\n\t\t\tdocument = await loadFile(file);\n\t\t} catch (loadError) {\n\t\t\tconst discoveryService = window.ph?.packageDiscoveryService;\n\t\t\tif (discoveryService && DocumentModelNotFoundError.isError(loadError)) {\n\t\t\t\tretryAfterDiscovery(discoveryService, loadError.documentType, file, driveId, name, parentFolder, onProgress, documentTypes, resolveConflict);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthrow loadError;\n\t\t}\n\t\tconst duplicateCheck = await isDocumentInLocation(document, driveId, parentFolder);\n\t\tif (duplicateCheck.isDuplicate && !resolveConflict) {\n\t\t\tonProgress?.({\n\t\t\t\tstage: \"conflict\",\n\t\t\t\tprogress: 0,\n\t\t\t\tduplicateType: duplicateCheck.duplicateType\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst documentType = getDocumentTypeIcon(document);\n\t\tif (documentType) onProgress?.({\n\t\t\tstage: \"loading\",\n\t\t\tprogress: 10,\n\t\t\tdocumentType\n\t\t});\n\t\telse onProgress?.({\n\t\t\tstage: \"loading\",\n\t\t\tprogress: 10\n\t\t});\n\t\tif (!isDocumentTypeSupported(document.header.documentType, documentTypes)) {\n\t\t\tonProgress?.({\n\t\t\t\tstage: \"unsupported-document-type\",\n\t\t\t\tprogress: 100,\n\t\t\t\terror: `Document type ${document.header.documentType} is not supported`\n\t\t\t});\n\t\t\tthrow new UnsupportedDocumentTypeError(document.header.documentType);\n\t\t}\n\t\tawait reactor.getDocumentModelModule(document.header.documentType);\n\t\tonProgress?.({\n\t\t\tstage: \"initializing\",\n\t\t\tprogress: 10\n\t\t});\n\t\tlet duplicateId = false;\n\t\ttry {\n\t\t\tawait reactor.get(document.header.id);\n\t\t\tduplicateId = true;\n\t\t} catch {}\n\t\tconst documentId = duplicateId ? generateId() : document.header.id;\n\t\tconst header = createPresignedHeader(documentId, document.header.documentType);\n\t\theader.lastModifiedAtUtcIso = document.header.createdAtUtcIso;\n\t\theader.meta = document.header.meta;\n\t\theader.name = name || document.header.name;\n\t\tconst initialDocument = {\n\t\t\t...document,\n\t\t\theader,\n\t\t\tstate: document.initialState,\n\t\t\toperations: Object.keys(document.operations).reduce((acc, key) => {\n\t\t\t\tacc[key] = [];\n\t\t\t\treturn acc;\n\t\t\t}, {})\n\t\t};\n\t\tconst fileNode = await addDocument(driveId, name || document.header.name, document.header.documentType, parentFolder, initialDocument, documentId, document.header.meta?.preferredEditor);\n\t\tif (!fileNode) throw new Error(\"There was an error adding file\");\n\t\tonProgress?.({\n\t\t\tstage: \"initializing\",\n\t\t\tprogress: 20\n\t\t});\n\t\tawait reactor.get(documentId);\n\t\tconsole.log(\"Document created, starting upload of operations\");\n\t\tawait uploadOperations(documentId, filterDomainOperations(document.operations), queueOperations, { onProgress: (uploadProgress) => {\n\t\t\tif (uploadProgress.totalOperations && uploadProgress.uploadedOperations !== void 0) {\n\t\t\t\tconst uploadPercent = uploadProgress.totalOperations > 0 ? uploadProgress.uploadedOperations / uploadProgress.totalOperations : 0;\n\t\t\t\tconst overallProgress = 20 + Math.round(uploadPercent * 80);\n\t\t\t\tonProgress?.({\n\t\t\t\t\tstage: \"uploading\",\n\t\t\t\t\tprogress: overallProgress,\n\t\t\t\t\ttotalOperations: uploadProgress.totalOperations,\n\t\t\t\t\tuploadedOperations: uploadProgress.uploadedOperations\n\t\t\t\t});\n\t\t\t}\n\t\t} });\n\t\tonProgress?.({\n\t\t\tstage: \"complete\",\n\t\t\tprogress: 100,\n\t\t\tfileNode\n\t\t});\n\t\treturn fileNode;\n\t} catch (error) {\n\t\tif (!UnsupportedDocumentTypeError.isError(error)) {\n\t\t\tconst errorMessage = error instanceof Error ? error.message : \"Unknown error occurred\";\n\t\t\tonProgress?.({\n\t\t\t\tstage: \"failed\",\n\t\t\t\tprogress: 100,\n\t\t\t\terror: errorMessage\n\t\t\t});\n\t\t}\n\t\tthrow error;\n\t}\n}\nasync function retryAfterDiscovery(discoveryService, documentType, file, driveId, name, parentFolder, onProgress, documentTypes, resolveConflict) {\n\tif (!discoveryService) return;\n\ttry {\n\t\tawait discoveryService.load(documentType);\n\t} catch {\n\t\tonProgress?.({\n\t\t\tstage: \"unsupported-document-type\",\n\t\t\tprogress: 100,\n\t\t\terror: `Document type ${documentType} is not supported`\n\t\t});\n\t\treturn;\n\t}\n\tawait addFileWithProgress(file, driveId, name, parentFolder, onProgress, documentTypes, resolveConflict);\n}\nasync function addFolder(driveId, name, parentFolder) {\n\tconst { isAllowedToCreateDocuments } = getUserPermissions();\n\tif (!isAllowedToCreateDocuments) throw new Error(\"User is not allowed to create folders\");\n\tconst reactorClient = window.ph?.reactorClient;\n\tif (!reactorClient) throw new Error(\"ReactorClient not initialized\");\n\tawait reactorClient.get(driveId);\n\tconst folderId = generateId();\n\tconst node = (await reactorClient.execute(driveId, \"main\", [addFolder$1({\n\t\tid: folderId,\n\t\tname,\n\t\tparentFolder\n\t})])).state.global.nodes.find((node) => node.id === folderId);\n\tif (!node || !isFolderNode(node)) throw new Error(\"There was an error adding folder\");\n\treturn node;\n}\nasync function deleteNode(driveId, nodeId) {\n\tconst { isAllowedToCreateDocuments } = getUserPermissions();\n\tif (!isAllowedToCreateDocuments) throw new Error(\"User is not allowed to delete documents\");\n\tconst reactorClient = window.ph?.reactorClient;\n\tif (!reactorClient) throw new Error(\"ReactorClient not initialized\");\n\tawait reactorClient.drives.removeNode(driveId, nodeId);\n}\nasync function renameNode(driveId, nodeId, name) {\n\tconst { isAllowedToCreateDocuments } = getUserPermissions();\n\tif (!isAllowedToCreateDocuments) throw new Error(\"User is not allowed to rename documents\");\n\tconst reactorClient = window.ph?.reactorClient;\n\tif (!reactorClient) throw new Error(\"ReactorClient not initialized\");\n\tif ((await reactorClient.execute(nodeId, \"main\", [setName({ name })])).header.name !== name) throw new Error(\"There was an error renaming the node\");\n\tconst node = (await reactorClient.execute(driveId, \"main\", [updateNode({\n\t\tid: nodeId,\n\t\tname\n\t})])).state.global.nodes.find((n) => n.id === nodeId);\n\tif (!node) throw new Error(\"There was an error renaming node in the drive\");\n\treturn node;\n}\nasync function renameDriveNode(driveId, nodeId, name) {\n\tconst { isAllowedToCreateDocuments } = getUserPermissions();\n\tif (!isAllowedToCreateDocuments) throw new Error(\"User is not allowed to rename documents\");\n\tconst reactorClient = window.ph?.reactorClient;\n\tif (!reactorClient) throw new Error(\"ReactorClient not initialized\");\n\tif ((await reactorClient.execute(nodeId, \"main\", [setName({ name })])).header.name !== name) throw new Error(\"There was an error renaming the node\");\n\tawait reactorClient.execute(driveId, \"main\", [updateNode({\n\t\tid: nodeId,\n\t\tname\n\t})]);\n\treturn (await reactorClient.get(driveId)).state.global.nodes.find((n) => n.id === nodeId);\n}\nasync function moveNodeById(args) {\n\tconst { driveId, srcId, targetId } = args;\n\tif (!driveId || !srcId) return;\n\tconst { isAllowedToCreateDocuments } = getUserPermissions();\n\tif (!isAllowedToCreateDocuments) throw new Error(\"User is not allowed to move documents\");\n\tconst reactorClient = window.ph?.reactorClient;\n\tif (!reactorClient) throw new Error(\"ReactorClient not initialized\");\n\tconst targetParentFolder = conditional(targetId, [isNot(isDefined), constant(void 0)], [isStrictEqual(driveId), constant(void 0)], constant(targetId));\n\tif (isStrictEqual(targetParentFolder, srcId)) return;\n\treturn await reactorClient.execute(driveId, \"main\", [moveNode({\n\t\tsrcFolder: srcId,\n\t\ttargetParentFolder\n\t})]);\n}\nasync function moveNode$1(driveId, src, target) {\n\tconst { isAllowedToCreateDocuments } = getUserPermissions();\n\tif (!isAllowedToCreateDocuments) throw new Error(\"User is not allowed to move documents\");\n\tconst reactorClient = window.ph?.reactorClient;\n\tif (!reactorClient) throw new Error(\"ReactorClient not initialized\");\n\treturn await reactorClient.execute(driveId, \"main\", [moveNode({\n\t\tsrcFolder: src.id,\n\t\ttargetParentFolder: target?.id\n\t})]);\n}\nasync function _duplicateDocument(reactor, document, newId = generateId()) {\n\tconst documentModule = await reactor.getDocumentModelModule(document.header.documentType);\n\treturn replayDocument(document.initialState, document.operations, documentModule.reducer, createPresignedHeader(newId, document.header.documentType));\n}\nasync function copyNode$1(driveId, src, target) {\n\tconst reactor = window.ph?.reactorClient;\n\tif (!reactor) return;\n\tconst { isAllowedToCreateDocuments } = getUserPermissions();\n\tif (!isAllowedToCreateDocuments) throw new Error(\"User is not allowed to copy documents\");\n\tconst drive = await reactor.get(driveId);\n\tconst copyNodesInput = generateNodesCopy({\n\t\tsrcId: src.id,\n\t\ttargetParentFolder: target?.id,\n\t\ttargetName: src.name\n\t}, () => generateId(), drive.state.global.nodes);\n\tconst resolvedNamesMap = /* @__PURE__ */ new Map();\n\tfor (const copyNodeInput of copyNodesInput) {\n\t\tconst node = drive.state.global.nodes.find((n) => n.id === copyNodeInput.srcId);\n\t\tif (node) {\n\t\t\tconst resolvedName = handleTargetNameCollisions({\n\t\t\t\tnodes: drive.state.global.nodes,\n\t\t\t\tsrcName: copyNodeInput.targetName || node.name,\n\t\t\t\tsrcKind: isFileNode(node) ? \"file\" : \"folder\",\n\t\t\t\ttargetParentFolder: copyNodeInput.targetParentFolder || null\n\t\t\t});\n\t\t\tresolvedNamesMap.set(copyNodeInput.targetId, resolvedName);\n\t\t}\n\t}\n\tconst fileNodesToCopy = copyNodesInput.filter((copyNodeInput) => {\n\t\tconst node = drive.state.global.nodes.find((node) => node.id === copyNodeInput.srcId);\n\t\treturn node !== void 0 && isFileNode(node);\n\t});\n\tfor (const fileNodeToCopy of fileNodesToCopy) try {\n\t\tconst duplicatedDocument = await _duplicateDocument(reactor, await reactor.get(fileNodeToCopy.srcId), fileNodeToCopy.targetId);\n\t\tconst resolvedName = resolvedNamesMap.get(fileNodeToCopy.targetId);\n\t\tif (resolvedName) duplicatedDocument.header.name = resolvedName;\n\t\tawait reactor.drives.addFile(driveId, duplicatedDocument, target?.id);\n\t} catch (e) {\n\t\tlogger.error(`Error copying document ${fileNodeToCopy.srcId}: ${String(e)}`);\n\t}\n\treturn await queueActions(drive, copyNodesInput.map((copyNodeInput) => copyNode(copyNodeInput)));\n}\n//#endregion\n//#region src/actions/drive.ts\nconst DEFAULT_INITIAL_SYNC_TIMEOUT_MS = 3e4;\nconst inFlightRemoteRegistrations = /* @__PURE__ */ new Map();\n/**\n* Resolves once a document with the given id is queryable through the\n* reactor client. Subscribes to Created events filtered by id and\n* short-circuits if the document already exists.\n*/\nasync function waitForDocumentReady(reactorClient, documentId, options) {\n\tconst timeoutMs = options?.timeoutMs ?? DEFAULT_INITIAL_SYNC_TIMEOUT_MS;\n\tconst signal = options?.signal;\n\treturn new Promise((resolve, reject) => {\n\t\tlet settled = false;\n\t\tlet unsubscribe;\n\t\tlet timer;\n\t\tlet abortHandler;\n\t\tconst settle = (action) => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tunsubscribe?.();\n\t\t\tif (timer) clearTimeout(timer);\n\t\t\tif (abortHandler && signal) signal.removeEventListener(\"abort\", abortHandler);\n\t\t\taction();\n\t\t};\n\t\tunsubscribe = reactorClient.subscribe({ ids: [documentId] }, (event) => {\n\t\t\tif (event.type === DocumentChangeType$1.Created) settle(() => resolve());\n\t\t});\n\t\treactorClient.find({ ids: [documentId] }).then((existing) => {\n\t\t\tif (existing.results.length > 0) settle(() => resolve());\n\t\t}).catch(() => {});\n\t\tif (signal) {\n\t\t\tif (signal.aborted) {\n\t\t\t\tsettle(() => reject(new DOMException(\"Aborted\", \"AbortError\")));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tabortHandler = () => {\n\t\t\t\tsettle(() => reject(new DOMException(\"Aborted\", \"AbortError\")));\n\t\t\t};\n\t\t\tsignal.addEventListener(\"abort\", abortHandler);\n\t\t}\n\t\ttimer = setTimeout(() => {\n\t\t\tsettle(() => reject(/* @__PURE__ */ new Error(`Timed out after ${timeoutMs}ms waiting for document ${documentId}`)));\n\t\t}, timeoutMs);\n\t});\n}\nasync function addDrive(input, preferredEditor) {\n\tconst { isAllowedToCreateDocuments } = getUserPermissions();\n\tif (!isAllowedToCreateDocuments) throw new Error(\"User is not allowed to create drives\");\n\tconst reactorClient = window.ph?.reactorClient;\n\tif (!reactorClient) throw new Error(\"ReactorClient not initialized\");\n\tconst driveDoc = driveCreateDocument({ global: {\n\t\tname: input.global.name || \"\",\n\t\ticon: input.global.icon ?? null,\n\t\tnodes: []\n\t} });\n\tif (preferredEditor) driveDoc.header.meta = { preferredEditor };\n\treturn await reactorClient.create(driveDoc);\n}\nasync function addRemoteDrive(url, driveId, options) {\n\tconst reactorClient = window.ph?.reactorClient;\n\tif (!reactorClient) throw new Error(\"ReactorClient not initialized\");\n\tconst sync = window.ph?.reactorClientModule?.reactorModule?.syncModule?.syncManager;\n\tif (!sync) throw new Error(\"Sync not initialized\");\n\tconst response = await fetch(url);\n\tif (!response.ok) throw new Error(`Failed to resolve drive info from ${url}`);\n\tconst driveInfo = await response.json();\n\tconst resolvedDriveId = driveId ?? driveInfo.id;\n\tconst collectionId = driveCollectionId$1(\"main\", resolvedDriveId);\n\tconst inFlight = inFlightRemoteRegistrations.get(collectionId);\n\tif (inFlight) await inFlight;\n\telse if (!sync.list().find((remote) => remote.collectionId === collectionId)) {\n\t\tconst remoteName = crypto.randomUUID();\n\t\tconst registration = sync.add(remoteName, collectionId, {\n\t\t\ttype: \"gql\",\n\t\t\tparameters: { url: driveInfo.graphqlEndpoint }\n\t\t}, void 0, options?.pollBehavior ? { pollBehavior: options.pollBehavior } : void 0).finally(() => inFlightRemoteRegistrations.delete(collectionId));\n\t\tinFlightRemoteRegistrations.set(collectionId, registration);\n\t\tawait registration;\n\t}\n\tif (options?.awaitInitialSync) await waitForDocumentReady(reactorClient, resolvedDriveId, {\n\t\ttimeoutMs: options.initialSyncTimeoutMs,\n\t\tsignal: options.signal\n\t});\n\treturn resolvedDriveId;\n}\nasync function deleteDrive(driveId) {\n\tconst { isAllowedToCreateDocuments } = getUserPermissions();\n\tif (!isAllowedToCreateDocuments) throw new Error(\"User is not allowed to delete drives\");\n\tconst reactorClient = window.ph?.reactorClient;\n\tif (!reactorClient) throw new Error(\"ReactorClient not initialized\");\n\tconst sync = window.ph?.reactorClientModule?.reactorModule?.syncModule?.syncManager;\n\tif (sync) {\n\t\tconst collectionId = driveCollectionId$1(\"main\", driveId);\n\t\tconst remotes = sync.list().filter((remote) => remote.collectionId === collectionId);\n\t\tfor (const remote of remotes) await sync.remove(remote.name);\n\t}\n\tawait reactorClient.deleteDocument(driveId, PropagationMode$1.Cascade);\n}\nasync function renameDrive(driveId, name) {\n\tconst { isAllowedToCreateDocuments } = getUserPermissions();\n\tif (!isAllowedToCreateDocuments) throw new Error(\"User is not allowed to rename drives\");\n\tconst reactorClient = window.ph?.reactorClient;\n\tif (!reactorClient) throw new Error(\"ReactorClient not initialized\");\n\treturn await reactorClient.rename(driveId, name);\n}\nasync function setDriveAvailableOffline(driveId, availableOffline) {\n\tconst { isAllowedToCreateDocuments } = getUserPermissions();\n\tif (!isAllowedToCreateDocuments) throw new Error(\"User is not allowed to change drive availability\");\n\tconst reactorClient = window.ph?.reactorClient;\n\tif (!reactorClient) throw new Error(\"ReactorClient not initialized\");\n\treturn await reactorClient.execute(driveId, \"main\", [setAvailableOffline({ availableOffline })]);\n}\nasync function setDriveSharingType(driveId, sharingType) {\n\tconst { isAllowedToCreateDocuments } = getUserPermissions();\n\tif (!isAllowedToCreateDocuments) throw new Error(\"User is not allowed to change drive sharing type\");\n\tconst reactorClient = window.ph?.reactorClient;\n\tif (!reactorClient) throw new Error(\"ReactorClient not initialized\");\n\treturn await reactorClient.execute(driveId, \"main\", [setSharingType({ type: sharingType })]);\n}\nasync function setDriveMetadata(driveId, metadata) {\n\tconst { isAllowedToCreateDocuments } = getUserPermissions();\n\tif (!isAllowedToCreateDocuments) throw new Error(\"User is not allowed to update drive metadata\");\n\tconst reactorClient = window.ph?.reactorClient;\n\tif (!reactorClient) throw new Error(\"ReactorClient not initialized\");\n\tconst actions = [];\n\tif (metadata.name) actions.push(setDriveName({ name: metadata.name }));\n\tif (metadata.icon !== void 0 && metadata.icon !== null) actions.push(setDriveIcon({ icon: metadata.icon }));\n\tif (actions.length === 0) return;\n\treturn await reactorClient.execute(driveId, \"main\", actions);\n}\n//#endregion\n//#region src/constants.ts\nconst DEFAULT_DRIVE_EDITOR_ID = \"powerhouse/generic-drive-explorer\";\nconst COMMON_PACKAGE_ID = \"powerhouse/common\";\n//#endregion\n//#region src/document-model.ts\nconst baseDocumentModelsMap = {\n\tDocumentModel: documentModelDocumentModelModule,\n\tDocumentDrive: driveDocumentModelModule,\n\tReactorDrive: reactorDriveDocumentModelModule\n};\nconst baseDocumentModels = Object.values(baseDocumentModelsMap);\n//#endregion\n//#region src/graphql/adapters.ts\nfunction phDocumentFromQuery(document, documentSchema) {\n\tconst phDocument = {\n\t\theader: phDocumentHeaderFromQuery(document),\n\t\tstate: phDocumentStateFromQuery(document),\n\t\tinitialState: phDocumentStateFromQuery(document),\n\t\toperations: phDocumentOperationsFromGetDocumentWithOperationsQuery(document),\n\t\tclipboard: []\n\t};\n\tif (documentSchema !== void 0) documentSchema.parse(phDocument);\n\treturn phDocument;\n}\nfunction phDocumentsFromQuery(items, documentSchema) {\n\treturn pipe(items, map((document) => phDocumentFromQuery(document, documentSchema)));\n}\nfunction phDocumentHeaderFromQuery(queryDocument) {\n\treturn {\n\t\tbranch: \"main\",\n\t\tid: queryDocument.id,\n\t\tname: queryDocument.name,\n\t\tdocumentType: queryDocument.documentType,\n\t\tcreatedAtUtcIso: queryDocument.createdAtUtcIso instanceof Date ? queryDocument.createdAtUtcIso.toUTCString() : queryDocument.createdAtUtcIso,\n\t\tlastModifiedAtUtcIso: queryDocument.lastModifiedAtUtcIso instanceof Date ? queryDocument.lastModifiedAtUtcIso.toUTCString() : queryDocument.lastModifiedAtUtcIso,\n\t\tslug: queryDocument.slug ?? \"\"\n\t};\n}\nfunction phDocumentStateFromQuery(queryDocument, documentSchema) {\n\tif (documentSchema !== void 0) return documentSchema.shape.state.parse(queryDocument.state);\n\treturn queryDocument.state;\n}\nfunction phDocumentOperationsFromGetDocumentWithOperationsQuery(queryDocument) {\n\tif (queryDocument.operations === null || queryDocument.operations === void 0) return { global: [] };\n\treturn { global: [...queryDocument.operations.items] };\n}\nfunction identifierFromMutateDocumentOperationVariables(variables) {\n\treturn z.object({ documentIdentifier: z.string() }).parse(variables).documentIdentifier;\n}\n//#endregion\n//#region src/graphql/constants.ts\nconst DEFAULT_DRIVE_ID = \"powerhouse\";\nconst DEFAULT_SWITCHBOARD_URL = \"http://localhost:4001/graphql\";\nconst graphqlEventsToSyncDrive = [\n\t\"CreateEmptyDocument\",\n\t\"CreateDocument\",\n\t\"AddChildren\",\n\t\"RemoveChildren\",\n\t\"MoveChildren\",\n\t\"DeleteDocument\",\n\t\"DeleteDocuments\"\n];\nconst graphqlDocumentEvents = [\n\t\"MutateDocument\",\n\t\"MutateDocumentAsync\",\n\t\"DeleteDocument\"\n];\nconst graphqlDocumentsEvents = [\"DeleteDocuments\"];\n//#endregion\n//#region src/graphql/fetchers.ts\nasync function reactorGraphqlFetchDocument(identifier, documentSchema) {\n\tconst client = window.ph?.reactorGraphQLClient;\n\tif (!client) throw new Error(\"Please call `useInitReactorGraphqlClient` to use its functions\");\n\ttry {\n\t\tconst document = (await client.GetDocument({ identifier })).document?.document;\n\t\tif (!document) return void 0;\n\t\treturn phDocumentFromQuery(document, documentSchema);\n\t} catch {\n\t\treturn;\n\t}\n}\nasync function reactorGraphqlBatchFetchDocuments(identifiers) {\n\tif (!window.ph?.reactorGraphQLClient) throw new Error(\"Please call `useInitReactorGraphqlClient` to use its functions\");\n\tconst promises = map(identifiers, (identifier) => reactorGraphqlFetchDocument(identifier));\n\treturn await Promise.all(promises);\n}\n//#endregion\n//#region src/graphql/batch.ts\n/**\n* A reference implementation for an async batching utility function built on\n* top of the `funnel` general purpose execution utility function. It will\n* accumulate all params passed to an async `call` method within the defined\n* burst duration and then use an async executor to process them in one\n* invocation. It then extracts an individual result for each call which is\n* used to resolve the original call.\n*\n* This allows synchronizing multiple async calls while keeping each call site\n* isolated from the rest (for example, as react components).\n*\n* This reference implementation can be copied into your project as-is, or you\n* can use it as the basis for a more complex implementation with additional\n* features.\n*\n* @param callback - The main function that takes a batch and returns an\n* aggregated response. The typing for the it's parameters will derive the\n* typing for the extractor and the `call` method.\n* @param extractor - A function that takes the aggregated response and extracts\n* from it the result for each individual call. The function is called with both\n* the index in the batch, and the params passed to the `call` method. This\n* allows handling APIs that return batch results as both objects and arrays.\n* @param maxBurstDurationMs - The period of time where the batcher would\n* collect params before triggering the executor. When set to 0 the batcher\n* does not incur any additional delays to the execution and would trigger at\n* the next tick, just like a regular async function would. This is also the\n* default value.\n* @returns A Funnel object with the `call` method augmented to support async\n* response.\n*/\nfunction batch(callback, extractor, maxBurstDurationMs = 0) {\n\tconst batchFunnel = funnel((requests) => {\n\t\tcallback(requests.map(({ params }) => params)).then((response) => {\n\t\t\tfor (const [index, { params, promiseCallbacks: [resolve, reject] }] of requests.entries()) try {\n\t\t\t\tresolve(extractor(response, index, ...params));\n\t\t\t} catch (error) {\n\t\t\t\treject(error);\n\t\t\t}\n\t\t}).catch((error) => {\n\t\t\tfor (const { promiseCallbacks: [, reject] } of requests) reject(error);\n\t\t});\n\t}, {\n\t\treducer: (requests, request) => [...requests ?? [], request],\n\t\tmaxBurstDurationMs,\n\t\ttriggerAt: \"end\"\n\t});\n\treturn {\n\t\t...batchFunnel,\n\t\tcall: (...params) => new Promise((...promiseCallbacks) => {\n\t\t\tbatchFunnel.call({\n\t\t\t\tpromiseCallbacks,\n\t\t\t\tparams\n\t\t\t});\n\t\t})\n\t};\n}\n//#endregion\n//#region src/graphql/document-fetcher.ts\nfunction makeDocumentsById(documents = []) {\n\treturn pipe(documents, filter(isTruthy), mapToObj((document) => [document.header.id, document]));\n}\nvar DocumentFetcher = class {\n\tbatchGetDocuments;\n\tconstructor() {\n\t\tthis.batchGetDocuments = batch(async (requests) => {\n\t\t\treturn makeDocumentsById(await reactorGraphqlBatchFetchDocuments(unique(map(requests, ([id]) => id))));\n\t\t}, (documentsById, _, id) => {\n\t\t\treturn prop(documentsById, id);\n\t\t});\n\t}\n\tget(id) {\n\t\treturn this.batchGetDocuments.call(id);\n\t}\n\tgetBatch(ids) {\n\t\treturn Promise.all(map(ids, (id) => this.get(id)));\n\t}\n};\n//#endregion\n//#region src/graphql/graphql-client-document-cache.ts\nvar GraphQLClientDocumentCache = class {\n\tfetcher;\n\tdocuments = /* @__PURE__ */ new Map();\n\tbatchPromises = /* @__PURE__ */ new Map();\n\tlisteners = /* @__PURE__ */ new Map();\n\tconstructor() {\n\t\tthis.fetcher = new DocumentFetcher();\n\t\twindow.addEventListener(\"MutateDocument\", (event) => {\n\t\t\tthis.handleDocumentMutated(event.detail.identifier).catch(console.error);\n\t\t});\n\t\twindow.addEventListener(\"MutateDocumentAsync\", (event) => {\n\t\t\tthis.handleDocumentMutated(event.detail.identifier).catch(console.error);\n\t\t});\n\t}\n\tget(id, refetch) {\n\t\tconst current = this.documents.get(id);\n\t\tif (current) {\n\t\t\tif (current.status === \"pending\") return current;\n\t\t\tif (!refetch) return current;\n\t\t}\n\t\tconst promise = addPromiseState(this.fetcher.get(id).then((document) => {\n\t\t\tthis.invalidateBatchesContaining(id);\n\t\t\treturn document;\n\t\t}));\n\t\tthis.documents.set(id, promise);\n\t\treturn promise;\n\t}\n\tgetBatch(ids) {\n\t\tconst key = ids.join(\",\");\n\t\tconst cached = this.batchPromises.get(key);\n\t\tconst currentPromises = ids.map((id) => this.get(id));\n\t\tif (cached) {\n\t\t\tif (currentPromises.every((promise, index) => promise === cached.promises[index])) return cached.promise;\n\t\t}\n\t\tconst states = currentPromises.map((promise) => readPromiseState(promise));\n\t\tif (states.every((state) => state.status !== \"pending\")) {\n\t\t\tconst values = states.filter((state) => state.status === \"fulfilled\").map((state) => state.value);\n\t\t\tconst batchPromise = Promise.resolve(values);\n\t\t\tbatchPromise.status = \"fulfilled\";\n\t\t\tbatchPromise.value = values;\n\t\t\tthis.batchPromises.set(key, {\n\t\t\t\tpromises: currentPromises,\n\t\t\t\tpromise: batchPromise\n\t\t\t});\n\t\t\treturn batchPromise;\n\t\t}\n\t\tconst batchPromise = addPromiseState(Promise.allSettled(currentPromises).then((results) => {\n\t\t\tconst documents = [];\n\t\t\tfor (const result of results) if (result.status === \"fulfilled\") documents.push(result.value);\n\t\t\telse console.warn(\"[GraphQLClientDocumentCache] Skipped unavailable document:\", result.reason);\n\t\t\treturn documents;\n\t\t}));\n\t\tthis.batchPromises.set(key, {\n\t\t\tpromises: currentPromises,\n\t\t\tpromise: batchPromise\n\t\t});\n\t\treturn batchPromise;\n\t}\n\tinvalidateBatchesContaining(documentId) {\n\t\tfor (const key of this.batchPromises.keys()) if (key.split(\",\").includes(documentId)) this.batchPromises.delete(key);\n\t}\n\tsubscribe(id, callback) {\n\t\tconst ids = Array.isArray(id) ? id : [id];\n\t\tfor (const documentId of ids) {\n\t\t\tconst listeners = this.listeners.get(documentId) ?? [];\n\t\t\tthis.listeners.set(documentId, [...listeners, callback]);\n\t\t}\n\t\treturn () => {\n\t\t\tfor (const documentId of ids) {\n\t\t\t\tconst listeners = this.listeners.get(documentId) ?? [];\n\t\t\t\tthis.listeners.set(documentId, listeners.filter((listener) => listener !== callback));\n\t\t\t}\n\t\t};\n\t}\n\tnotify(id) {\n\t\tconst listeners = this.listeners.get(id) ?? [];\n\t\tfor (const listener of listeners) listener();\n\t}\n\tasync handleDocumentMutated(id) {\n\t\tthis.invalidateBatchesContaining(id);\n\t\tawait this.get(id);\n\t\tthis.notify(id);\n\t}\n\thandleDocumentDeleted(id) {\n\t\tthis.documents.delete(id);\n\t\tthis.invalidateBatchesContaining(id);\n\t\tthis.notify(id);\n\t}\n\thandleDocumentsDeleted(ids) {\n\t\tforEach(ids, (id) => this.handleDocumentDeleted(id));\n\t}\n};\n//#endregion\n//#region src/graphql/mutators.ts\nasync function reactorGraphqlCreateDocument(document, parentIdentifier = DEFAULT_DRIVE_ID) {\n\tconst client = window.ph?.reactorGraphQLClient;\n\tif (!client) throw new Error(\"Please call `useInitReactorGraphqlClient` to use its functions\");\n\treturn await client.CreateDocument({\n\t\tdocument,\n\t\tparentIdentifier\n\t});\n}\nasync function reactorGraphqlDeleteDocument(identifier) {\n\tconst client = window.ph?.reactorGraphQLClient;\n\tif (!client) throw new Error(\"Please call `useInitReactorGraphqlClient` to use its functions\");\n\treturn await client.DeleteDocument({ identifier });\n}\nasync function reactorGraphqlDeleteDocuments(identifiers) {\n\tconst client = window.ph?.reactorGraphQLClient;\n\tif (!client) throw new Error(\"Please call `useInitReactorGraphqlClient` to use its functions\");\n\treturn await client.DeleteDocuments({ identifiers });\n}\nasync function reactorGraphqlMutateDocument(documentIdentifier, ...actions) {\n\tconst client = window.ph?.reactorGraphQLClient;\n\tif (!client) throw new Error(\"Please call `useInitReactorGraphqlClient` to use its functions\");\n\treturn await client.MutateDocument({\n\t\tdocumentIdentifier,\n\t\tactions\n\t});\n}\n//#endregion\n//#region src/hooks/config/editor.ts\nconst isExternalControlsEnabledEventFunctions = makePHEventFunctions(\"isExternalControlsEnabled\");\n/** Sets whether external controls are enabled for a given editor. */\nconst setIsExternalControlsEnabled = isExternalControlsEnabledEventFunctions.setValue;\n/** Gets whether external controls are enabled for a given editor. */\nconst useIsExternalControlsEnabled = isExternalControlsEnabledEventFunctions.useValue;\n/** Adds an event handler for when the external controls enabled state changes. */\nconst addIsExternalControlsEnabledEventHandler = isExternalControlsEnabledEventFunctions.addEventHandler;\nconst isDragAndDropEnabledEventFunctions = makePHEventFunctions(\"isDragAndDropEnabled\");\n/** Sets whether drag and drop is enabled for a given app. */\nconst setIsDragAndDropEnabled = isDragAndDropEnabledEventFunctions.setValue;\n/** Gets whether drag and drop is enabled for a given app. */\nconst useIsDragAndDropEnabled = isDragAndDropEnabledEventFunctions.useValue;\n/** Adds an event handler for when the drag and drop enabled state changes. */\nconst addIsDragAndDropEnabledEventHandler = isDragAndDropEnabledEventFunctions.addEventHandler;\nconst allowedDocumentTypesEventFunctions = makePHEventFunctions(\"allowedDocumentTypes\");\n/** Sets the allowed document types for a given app. */\nconst setAllowedDocumentTypes = allowedDocumentTypesEventFunctions.setValue;\n/** Defines the document types a drive supports.\n*\n* Defaults to all of the document types registered in the reactor.\n*/\nfunction useAllowedDocumentTypes() {\n\treturn allowedDocumentTypesEventFunctions.useValue();\n}\n/** Adds an event handler for when the allowed document types for a given app changes. */\nconst addAllowedDocumentTypesEventHandler = allowedDocumentTypesEventFunctions.addEventHandler;\nconst phAppConfigSetters = {\n\tallowedDocumentTypes: setAllowedDocumentTypes,\n\tisDragAndDropEnabled: setIsDragAndDropEnabled\n};\nconst phDocumentEditorConfigSetters = { isExternalControlsEnabled: setIsExternalControlsEnabled };\nconst phAppConfigHooks = {\n\tallowedDocumentTypes: useAllowedDocumentTypes,\n\tisDragAndDropEnabled: useIsDragAndDropEnabled\n};\nconst phDocumentEditorConfigHooks = { isExternalControlsEnabled: useIsExternalControlsEnabled };\n//#endregion\n//#region src/hooks/config/connect.ts\nconst { useValue: useRouterBasename, setValue: setRouterBasename, addEventHandler: addRouterBasenameEventHandler } = makePHEventFunctions(\"routerBasename\");\nconst { useValue: useVersion, setValue: setVersion, addEventHandler: addVersionEventHandler } = makePHEventFunctions(\"version\");\nconst { useValue: useRequiresHardRefresh, setValue: setRequiresHardRefresh, addEventHandler: addRequiresHardRefreshEventHandler } = makePHEventFunctions(\"requiresHardRefresh\");\nconst { useValue: useWarnOutdatedApp, setValue: setWarnOutdatedApp, addEventHandler: addWarnOutdatedAppEventHandler } = makePHEventFunctions(\"warnOutdatedApp\");\nconst { useValue: useStudioMode, setValue: setStudioMode, addEventHandler: addStudioModeEventHandler } = makePHEventFunctions(\"studioMode\");\nconst { useValue: useBasePath, setValue: setBasePath, addEventHandler: addBasePathEventHandler } = makePHEventFunctions(\"basePath\");\nconst { useValue: useVersionCheckInterval, setValue: setVersionCheckInterval, addEventHandler: addVersionCheckIntervalEventHandler } = makePHEventFunctions(\"versionCheckInterval\");\nconst { useValue: useCliVersion, setValue: setCliVersion, addEventHandler: addCliVersionEventHandler } = makePHEventFunctions(\"cliVersion\");\nconst { useValue: useFileUploadOperationsChunkSize, setValue: setFileUploadOperationsChunkSize, addEventHandler: addFileUploadOperationsChunkSizeEventHandler } = makePHEventFunctions(\"fileUploadOperationsChunkSize\");\nconst { useValue: useIsDocumentModelSelectionSettingsEnabled, setValue: setIsDocumentModelSelectionSettingsEnabled, addEventHandler: addIsDocumentModelSelectionSettingsEnabledEventHandler } = makePHEventFunctions(\"isDocumentModelSelectionSettingsEnabled\");\nconst { useValue: useGaTrackingId, setValue: setGaTrackingId, addEventHandler: addGaTrackingIdEventHandler } = makePHEventFunctions(\"gaTrackingId\");\nconst { useValue: useDefaultDrivesUrl, setValue: setDefaultDrivesUrl, addEventHandler: addDefaultDrivesUrlEventHandler } = makePHEventFunctions(\"defaultDrivesUrl\");\nconst { useValue: useDrivesPreserveStrategy, setValue: setDrivesPreserveStrategy, addEventHandler: addDrivesPreserveStrategyEventHandler } = makePHEventFunctions(\"drivesPreserveStrategy\");\nconst { useValue: useIsLocalDrivesEnabled, setValue: setIsLocalDrivesEnabled, addEventHandler: addIsLocalDrivesEnabledEventHandler } = makePHEventFunctions(\"isLocalDrivesEnabled\");\nconst { useValue: useIsAddDriveEnabled, setValue: setIsAddDriveEnabled, addEventHandler: addIsAddDriveEnabledEventHandler } = makePHEventFunctions(\"isAddDriveEnabled\");\nconst { useValue: useIsPublicDrivesEnabled, setValue: setIsPublicDrivesEnabled, addEventHandler: addIsPublicDrivesEnabledEventHandler } = makePHEventFunctions(\"isPublicDrivesEnabled\");\nconst { useValue: useIsAddPublicDrivesEnabled, setValue: setIsAddPublicDrivesEnabled, addEventHandler: addIsAddPublicDrivesEnabledEventHandler } = makePHEventFunctions(\"isAddPublicDrivesEnabled\");\nconst { useValue: useIsDeletePublicDrivesEnabled, setValue: setIsDeletePublicDrivesEnabled, addEventHandler: addIsDeletePublicDrivesEnabledEventHandler } = makePHEventFunctions(\"isDeletePublicDrivesEnabled\");\nconst { useValue: useIsCloudDrivesEnabled, setValue: setIsCloudDrivesEnabled, addEventHandler: addIsCloudDrivesEnabledEventHandler } = makePHEventFunctions(\"isCloudDrivesEnabled\");\nconst { useValue: useIsAddCloudDrivesEnabled, setValue: setIsAddCloudDrivesEnabled, addEventHandler: addIsAddCloudDrivesEnabledEventHandler } = makePHEventFunctions(\"isAddCloudDrivesEnabled\");\nconst { useValue: useIsDeleteCloudDrivesEnabled, setValue: setIsDeleteCloudDrivesEnabled, addEventHandler: addIsDeleteCloudDrivesEnabledEventHandler } = makePHEventFunctions(\"isDeleteCloudDrivesEnabled\");\nconst { useValue: useLocalDrivesEnabled, setValue: setLocalDrivesEnabled, addEventHandler: addLocalDrivesEnabledEventHandler } = makePHEventFunctions(\"isLocalDrivesEnabled\");\nconst { useValue: useIsAddLocalDrivesEnabled, setValue: setIsAddLocalDrivesEnabled, addEventHandler: addIsAddLocalDrivesEnabledEventHandler } = makePHEventFunctions(\"isAddLocalDrivesEnabled\");\nconst { useValue: useIsDeleteLocalDrivesEnabled, setValue: setIsDeleteLocalDrivesEnabled, addEventHandler: addIsDeleteLocalDrivesEnabledEventHandler } = makePHEventFunctions(\"isDeleteLocalDrivesEnabled\");\nconst { useValue: useIsEditorDebugModeEnabled, setValue: setIsEditorDebugModeEnabled, addEventHandler: addIsEditorDebugModeEnabledEventHandler } = makePHEventFunctions(\"isEditorDebugModeEnabled\");\nconst { useValue: useIsEditorReadModeEnabled, setValue: setIsEditorReadModeEnabled, addEventHandler: addIsEditorReadModeEnabledEventHandler } = makePHEventFunctions(\"isEditorReadModeEnabled\");\nconst { useValue: useIsAnalyticsDatabaseWorkerEnabled, setValue: setIsAnalyticsDatabaseWorkerEnabled, addEventHandler: addIsAnalyticsDatabaseWorkerEnabledEventHandler } = makePHEventFunctions(\"isAnalyticsDatabaseWorkerEnabled\");\nconst { useValue: useIsDiffAnalyticsEnabled, setValue: setIsDiffAnalyticsEnabled, addEventHandler: addIsDiffAnalyticsEnabledEventHandler } = makePHEventFunctions(\"isDiffAnalyticsEnabled\");\nconst { useValue: useIsDriveAnalyticsEnabled, setValue: setIsDriveAnalyticsEnabled, addEventHandler: addIsDriveAnalyticsEnabledEventHandler } = makePHEventFunctions(\"isDriveAnalyticsEnabled\");\nconst { useValue: useRenownUrl, setValue: setRenownUrl, addEventHandler: addRenownUrlEventHandler } = makePHEventFunctions(\"renownUrl\");\nconst { useValue: useRenownNetworkId, setValue: setRenownNetworkId, addEventHandler: addRenownNetworkIdEventHandler } = makePHEventFunctions(\"renownNetworkId\");\nconst { useValue: useRenownChainId, setValue: setRenownChainId, addEventHandler: addRenownChainIdEventHandler } = makePHEventFunctions(\"renownChainId\");\nconst { useValue: useSentryRelease, setValue: setSentryRelease, addEventHandler: addSentryReleaseEventHandler } = makePHEventFunctions(\"sentryRelease\");\nconst { useValue: useSentryDsn, setValue: setSentryDsn, addEventHandler: addSentryDsnEventHandler } = makePHEventFunctions(\"sentryDsn\");\nconst { useValue: useSentryEnv, setValue: setSentryEnv, addEventHandler: addSentryEnvEventHandler } = makePHEventFunctions(\"sentryEnv\");\nconst { useValue: useIsSentryTracingEnabled, setValue: setIsSentryTracingEnabled, addEventHandler: addIsSentryTracingEnabledEventHandler } = makePHEventFunctions(\"isSentryTracingEnabled\");\nconst { useValue: useIsExternalProcessorsEnabled, setValue: setIsExternalProcessorsEnabled, addEventHandler: addIsExternalProcessorsEnabledEventHandler } = makePHEventFunctions(\"isExternalProcessorsEnabled\");\nconst { useValue: useIsExternalPackagesEnabled, setValue: setIsExternalPackagesEnabled, addEventHandler: addIsExternalPackagesEnabledEventHandler } = makePHEventFunctions(\"isExternalPackagesEnabled\");\nconst enabledEditorsEventFunctions = makePHEventFunctions(\"enabledEditors\");\n/** Sets the enabled editors for Connect. */\nconst setEnabledEditors = enabledEditorsEventFunctions.setValue;\n/** Gets the enabled editors for Connect. */\nconst useEnabledEditors = enabledEditorsEventFunctions.useValue;\n/** Adds an event handler for when the enabled editors for Connect changes. */\nconst addEnabledEditorsEventHandler = enabledEditorsEventFunctions.addEventHandler;\nconst disabledEditorsEventFunctions = makePHEventFunctions(\"disabledEditors\");\n/** Sets the disabled editors for Connect. */\nconst setDisabledEditors = disabledEditorsEventFunctions.setValue;\n/** Gets the disabled editors for Connect. */\nconst useDisabledEditors = disabledEditorsEventFunctions.useValue;\n/** Adds an event handler for when the disabled editors for Connect changes. */\nconst addDisabledEditorsEventHandler = disabledEditorsEventFunctions.addEventHandler;\nconst isRelationalProcessorsEnabled = makePHEventFunctions(\"isRelationalProcessorsEnabled\");\n/** Sets the isRelationalProcessorsEnabled for Connect. */\nconst setIsRelationalProcessorsEnabled = isRelationalProcessorsEnabled.setValue;\n/** Gets the isRelationalProcessorsEnabled for Connect. */\nconst useIsRelationalProcessorsEnabled = isRelationalProcessorsEnabled.useValue;\n/** Adds an event handler for when the isRelationalProcessorsEnabled for Connect changes. */\nconst addIsRelationalProcessorsEnabledEventHandler = isRelationalProcessorsEnabled.addEventHandler;\nconst isExternalRelationalProcessorsEnabled = makePHEventFunctions(\"isExternalRelationalProcessorsEnabled\");\n/** Sets the isExternalRelationalProcessorsEnabled for Connect. */\nconst setIsExternalRelationalProcessorsEnabled = isExternalRelationalProcessorsEnabled.setValue;\n/** Gets the isExternalRelationalProcessorsEnabled for Connect. */\nconst useIsExternalRelationalProcessorsEnabled = isExternalRelationalProcessorsEnabled.useValue;\n/** Adds an event handler for when the isExternalRelationalProcessorsEnabled for Connect changes. */\nconst addIsExternalRelationalProcessorsEnabledEventHandler = isExternalRelationalProcessorsEnabled.addEventHandler;\nconst isAnalyticsEnabledEventFunctions = makePHEventFunctions(\"isAnalyticsEnabled\");\n/** Sets the isAnalyticsEnabled for Connect. */\nconst setIsAnalyticsEnabled = isAnalyticsEnabledEventFunctions.setValue;\n/** Gets the isAnalyticsEnabled for Connect. */\nconst useIsAnalyticsEnabled = isAnalyticsEnabledEventFunctions.useValue;\n/** Adds an event handler for when the isAnalyticsEnabled for Connect changes. */\nconst addIsAnalyticsEnabledEventHandler = isAnalyticsEnabledEventFunctions.addEventHandler;\nconst isAnalyticsExternalProcessorsEnabled = makePHEventFunctions(\"isAnalyticsExternalProcessorsEnabled\");\n/** Sets the isAnalyticsExternalProcessorsEnabled for Connect. */\nconst setIsAnalyticsExternalProcessorsEnabled = isAnalyticsExternalProcessorsEnabled.setValue;\n/** Gets the isAnalyticsExternalProcessorsEnabled for Connect. */\nconst useIsAnalyticsExternalProcessorsEnabled = isAnalyticsExternalProcessorsEnabled.useValue;\n/** Adds an event handler for when the isAnalyticsExternalProcessorsEnabled for Connect changes. */\nconst addIsAnalyticsExternalProcessorsEnabledEventHandler = isAnalyticsExternalProcessorsEnabled.addEventHandler;\nconst analyticsDatabaseNameEventFunctions = makePHEventFunctions(\"analyticsDatabaseName\");\n/** Sets the analytics database name for Connect. */\nconst setAnalyticsDatabaseName = analyticsDatabaseNameEventFunctions.setValue;\n/** Gets the analytics database name for Connect. */\nconst useAnalyticsDatabaseName = analyticsDatabaseNameEventFunctions.useValue;\n/** Adds an event handler for when the analytics database name for Connect changes. */\nconst addAnalyticsDatabaseNameEventHandler = analyticsDatabaseNameEventFunctions.addEventHandler;\nconst logLevelEventFunctions = makePHEventFunctions(\"logLevel\");\n/** Sets the log level for Connect. */\nconst setLogLevel = logLevelEventFunctions.setValue;\n/** Gets the log level for Connect. */\nconst useLogLevel = logLevelEventFunctions.useValue;\n/** Adds an event handler for when the log level for Connect changes. */\nconst addLogLevelEventHandler = logLevelEventFunctions.addEventHandler;\nconst allowListEventFunctions = makePHEventFunctions(\"allowList\");\n/** Sets the allow list for Connect. */\nconst setAllowList = allowListEventFunctions.setValue;\n/** Gets the allow list for Connect. */\nconst useAllowList = allowListEventFunctions.useValue;\n/** Adds an event handler for when the allow list for Connect changes. */\nconst addAllowListEventHandler = allowListEventFunctions.addEventHandler;\nconst nonUserConfigSetters = {\n\trouterBasename: setRouterBasename,\n\tversion: setVersion,\n\trequiresHardRefresh: setRequiresHardRefresh,\n\twarnOutdatedApp: setWarnOutdatedApp,\n\tstudioMode: setStudioMode,\n\tbasePath: setBasePath,\n\tversionCheckInterval: setVersionCheckInterval,\n\tcliVersion: setCliVersion,\n\tfileUploadOperationsChunkSize: setFileUploadOperationsChunkSize,\n\tisDocumentModelSelectionSettingsEnabled: setIsDocumentModelSelectionSettingsEnabled,\n\tgaTrackingId: setGaTrackingId,\n\tdefaultDrivesUrl: setDefaultDrivesUrl,\n\tdrivesPreserveStrategy: setDrivesPreserveStrategy,\n\tisLocalDrivesEnabled: setIsLocalDrivesEnabled,\n\tisAddDriveEnabled: setIsAddDriveEnabled,\n\tisPublicDrivesEnabled: setIsPublicDrivesEnabled,\n\tisAddPublicDrivesEnabled: setIsAddPublicDrivesEnabled,\n\tisDeletePublicDrivesEnabled: setIsDeletePublicDrivesEnabled,\n\tisCloudDrivesEnabled: setIsCloudDrivesEnabled,\n\tisAddCloudDrivesEnabled: setIsAddCloudDrivesEnabled,\n\tisDeleteCloudDrivesEnabled: setIsDeleteCloudDrivesEnabled,\n\tisAddLocalDrivesEnabled: setIsAddLocalDrivesEnabled,\n\tisDeleteLocalDrivesEnabled: setIsDeleteLocalDrivesEnabled,\n\tisEditorDebugModeEnabled: setIsEditorDebugModeEnabled,\n\tisEditorReadModeEnabled: setIsEditorReadModeEnabled,\n\tisRelationalProcessorsEnabled: setIsRelationalProcessorsEnabled,\n\tisExternalRelationalProcessorsEnabled: setIsExternalRelationalProcessorsEnabled,\n\tisAnalyticsEnabled: setIsAnalyticsEnabled,\n\tanalyticsDatabaseName: setAnalyticsDatabaseName,\n\tisAnalyticsExternalProcessorsEnabled: setIsAnalyticsExternalProcessorsEnabled,\n\tisAnalyticsDatabaseWorkerEnabled: setIsAnalyticsDatabaseWorkerEnabled,\n\tisDiffAnalyticsEnabled: setIsDiffAnalyticsEnabled,\n\tisDriveAnalyticsEnabled: setIsDriveAnalyticsEnabled,\n\trenownUrl: setRenownUrl,\n\trenownNetworkId: setRenownNetworkId,\n\trenownChainId: setRenownChainId,\n\tsentryRelease: setSentryRelease,\n\tsentryDsn: setSentryDsn,\n\tsentryEnv: setSentryEnv,\n\tisSentryTracingEnabled: setIsSentryTracingEnabled,\n\tisExternalProcessorsEnabled: setIsExternalProcessorsEnabled,\n\tisExternalPackagesEnabled: setIsExternalPackagesEnabled,\n\tallowList: setAllowList,\n\tlogLevel: setLogLevel,\n\tdisabledEditors: setDisabledEditors,\n\tenabledEditors: setEnabledEditors\n};\nconst phGlobalConfigSetters = {\n\t...phAppConfigSetters,\n\t...phDocumentEditorConfigSetters,\n\t...nonUserConfigSetters\n};\nconst nonUserConfigHooks = {\n\trouterBasename: useRouterBasename,\n\tversion: useVersion,\n\trequiresHardRefresh: useRequiresHardRefresh,\n\twarnOutdatedApp: useWarnOutdatedApp,\n\tstudioMode: useStudioMode,\n\tbasePath: useBasePath,\n\tversionCheckInterval: useVersionCheckInterval,\n\tcliVersion: useCliVersion,\n\tfileUploadOperationsChunkSize: useFileUploadOperationsChunkSize,\n\tisDocumentModelSelectionSettingsEnabled: useIsDocumentModelSelectionSettingsEnabled,\n\tgaTrackingId: useGaTrackingId,\n\tdefaultDrivesUrl: useDefaultDrivesUrl,\n\tdrivesPreserveStrategy: useDrivesPreserveStrategy,\n\tisAddDriveEnabled: useIsAddDriveEnabled,\n\tisPublicDrivesEnabled: useIsPublicDrivesEnabled,\n\tisAddPublicDrivesEnabled: useIsAddPublicDrivesEnabled,\n\tisDeletePublicDrivesEnabled: useIsDeletePublicDrivesEnabled,\n\tisCloudDrivesEnabled: useIsCloudDrivesEnabled,\n\tisAddCloudDrivesEnabled: useIsAddCloudDrivesEnabled,\n\tisDeleteCloudDrivesEnabled: useIsDeleteCloudDrivesEnabled,\n\tisLocalDrivesEnabled: useIsLocalDrivesEnabled,\n\tisAddLocalDrivesEnabled: useIsAddLocalDrivesEnabled,\n\tisDeleteLocalDrivesEnabled: useIsDeleteLocalDrivesEnabled,\n\tisEditorDebugModeEnabled: useIsEditorDebugModeEnabled,\n\tisEditorReadModeEnabled: useIsEditorReadModeEnabled,\n\tisAnalyticsDatabaseWorkerEnabled: useIsAnalyticsDatabaseWorkerEnabled,\n\tisDiffAnalyticsEnabled: useIsDiffAnalyticsEnabled,\n\tisDriveAnalyticsEnabled: useIsDriveAnalyticsEnabled,\n\trenownUrl: useRenownUrl,\n\trenownNetworkId: useRenownNetworkId,\n\trenownChainId: useRenownChainId,\n\tsentryRelease: useSentryRelease,\n\tsentryDsn: useSentryDsn,\n\tsentryEnv: useSentryEnv,\n\tisSentryTracingEnabled: useIsSentryTracingEnabled,\n\tisExternalProcessorsEnabled: useIsExternalProcessorsEnabled,\n\tisExternalPackagesEnabled: useIsExternalPackagesEnabled,\n\tallowList: useAllowList,\n\tisAnalyticsEnabled: useIsAnalyticsEnabled,\n\tisAnalyticsExternalProcessorsEnabled: useIsAnalyticsExternalProcessorsEnabled,\n\tisRelationalProcessorsEnabled: useIsRelationalProcessorsEnabled,\n\tisExternalRelationalProcessorsEnabled: useIsExternalRelationalProcessorsEnabled,\n\tanalyticsDatabaseName: useAnalyticsDatabaseName,\n\tlogLevel: useLogLevel,\n\tdisabledEditors: useDisabledEditors,\n\tenabledEditors: useEnabledEditors\n};\nconst phGlobalConfigHooks = {\n\t...phAppConfigHooks,\n\t...phDocumentEditorConfigHooks,\n\t...nonUserConfigHooks\n};\n//#endregion\n//#region src/hooks/attachment-service.ts\nconst attachmentServiceEventFunctions = makePHEventFunctions(\"attachmentService\");\n/** Returns the attachment service from window.ph */\nconst useAttachmentService = attachmentServiceEventFunctions.useValue;\n/** Sets the attachment service on window.ph */\nconst setAttachmentService = attachmentServiceEventFunctions.setValue;\n/** Registers the attachmentService window event handler */\nconst addAttachmentServiceEventHandler = attachmentServiceEventFunctions.addEventHandler;\n//#endregion\n//#region src/hooks/features.ts\nconst featuresEventFunctions = makePHEventFunctions(\"features\");\nconst useFeatures = featuresEventFunctions.useValue;\nconst setFeatures = featuresEventFunctions.setValue;\nconst addFeaturesEventHandler = featuresEventFunctions.addEventHandler;\n//#endregion\n//#region src/utils/url.ts\nfunction resolveUrlPathname(path) {\n\treturn new URL(path.replace(/^\\/+/, \"\"), window.location.origin + (window.ph?.basePath ?? \"/\")).pathname;\n}\n/** Returns the current path without the base path */\nfunction getPathWithoutBase(path) {\n\tconst basePath = window.ph?.basePath ?? \"/\";\n\treturn path.replace(basePath, basePath.endsWith(\"/\") ? \"/\" : \"\");\n}\n/** Makes a URL component for a drive. */\nfunction makeDriveUrlComponent(drive) {\n\tif (!drive) return \"\";\n\treturn `/d/${slug(drive.header.slug)}`;\n}\n/** Makes a URL component for a node. */\nfunction makeNodeSlug(node) {\n\tif (!node) return \"\";\n\tconst nodeName = node.name;\n\tif (!nodeName) return slug(node.id);\n\treturn slug(`${nodeName}-${node.id}`);\n}\n/** Extracts the node slug from a path.\n*\n* The path is expected to be in the format `/d/<drive-slug>/<node-slug>`.\n*/\nfunction extractNodeSlugFromPath(path) {\n\tconst currentPath = getPathWithoutBase(path);\n\treturn /^\\/d\\/[^/]+\\/([^/]+)$/.exec(currentPath)?.[1];\n}\n/** Finds a UUID in a string, used for extracting node ids from node slugs in the URL. */\nfunction findUuid(input) {\n\tif (!input) return void 0;\n\treturn /\\b[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\\b/.exec(input)?.[0];\n}\nfunction extractNodeIdFromSlug(nodeSlug) {\n\treturn findUuid(nodeSlug);\n}\nfunction extractNodeIdFromPath(path) {\n\treturn extractNodeIdFromSlug(extractNodeSlugFromPath(path));\n}\n/** Extracts the drive slug from a path.\n* Used for extracting drive ids from drive slugs in the URL.\n* Expects the path to be in the format `/d/<drive-slug>`.\n*/\nfunction extractDriveSlugFromPath(path) {\n\tconst currentPath = getPathWithoutBase(path);\n\treturn /^\\/d\\/([^/]+)/.exec(currentPath)?.[1] ?? \"\";\n}\nfunction extractDriveIdFromSlug(driveSlug) {\n\treturn findUuid(driveSlug);\n}\nfunction extractDriveIdFromPath(path) {\n\treturn extractDriveIdFromSlug(extractDriveSlugFromPath(path));\n}\n/**\n* Creates a URL string with the given pathname while preserving existing query parameters.\n*/\nfunction createUrlWithPreservedParams(pathname) {\n\tconst search = window.location.search;\n\treturn search ? `${pathname}${search}` : pathname;\n}\n//#endregion\n//#region src/hooks/drives.ts\nconst drivesEventFunctions = makePHEventFunctions(\"drives\");\n/** Returns all of the drives in the reactor */\nconst useDrives = drivesEventFunctions.useValue;\n/** Sets the drives in the reactor */\nconst setDrives = drivesEventFunctions.setValue;\n/** Adds an event handler for the drives */\nconst addDrivesEventHandler = drivesEventFunctions.addEventHandler;\n//#endregion\n//#region src/hooks/set-selected-node.ts\nconst selectedNodeIdEventFunctions = makePHEventFunctions(\"selectedNodeId\");\nconst useSelectedNodeId = selectedNodeIdEventFunctions.useValue;\nconst setSelectedNodeId = selectedNodeIdEventFunctions.setValue;\nconst addSelectedNodeIdEventHandler = selectedNodeIdEventFunctions.addEventHandler;\n/** Sets the selected node (file or folder). */\nfunction setSelectedNode(nodeOrNodeSlug) {\n\tconst nodeSlug = typeof nodeOrNodeSlug === \"string\" ? nodeOrNodeSlug : makeNodeSlug(nodeOrNodeSlug);\n\tsetSelectedNodeId(extractNodeIdFromSlug(nodeSlug));\n\tconst driveSlugFromPath = extractDriveSlugFromPath(window.location.pathname);\n\tif (!driveSlugFromPath) return;\n\tif (!nodeSlug) {\n\t\tconst pathname = resolveUrlPathname(`/d/${driveSlugFromPath}`);\n\t\tif (pathname === window.location.pathname) return;\n\t\twindow.history.pushState(null, \"\", createUrlWithPreservedParams(pathname));\n\t\treturn;\n\t}\n\tconst pathname = resolveUrlPathname(`/d/${driveSlugFromPath}/${nodeSlug}`);\n\tif (pathname === window.location.pathname) return;\n\twindow.history.pushState(null, \"\", createUrlWithPreservedParams(pathname));\n}\nfunction addResetSelectedNodeEventHandler() {\n\twindow.addEventListener(\"ph:selectedDriveIdUpdated\", () => {\n\t\tsetSelectedNodeId(void 0);\n\t});\n}\nfunction addSetSelectedNodeOnPopStateEventHandler() {\n\twindow.addEventListener(\"popstate\", () => {\n\t\tconst pathname = window.location.pathname;\n\t\tconst nodeSlug = extractNodeSlugFromPath(pathname);\n\t\tif (extractNodeIdFromSlug(nodeSlug) !== window.ph?.selectedNodeId) setSelectedNode(nodeSlug);\n\t});\n}\n//#endregion\n//#region src/hooks/selected-drive.ts\nconst selectedDriveIdEventFunctions = makePHEventFunctions(\"selectedDriveId\");\n/** Returns the selected drive id */\nconst useSelectedDriveId = selectedDriveIdEventFunctions.useValue;\n/** Sets the selected drive id */\nconst setSelectedDriveId = selectedDriveIdEventFunctions.setValue;\n/** Adds an event handler for the selected drive id */\nconst addSelectedDriveIdEventHandler = selectedDriveIdEventFunctions.addEventHandler;\n/** Returns the selected drive */\nfunction useSelectedDrive() {\n\tconst drive = useSelectedDriveSafe();\n\tif (!drive[0]) throw new Error(\"There is no drive selected. Did you mean to call 'useSelectedDriveSafe'?\");\n\treturn drive;\n}\n/** Returns the selected drive, or undefined if no drive is selected */\nfunction useSelectedDriveSafe() {\n\tconst selectedDriveId = useSelectedDriveId();\n\tconst selectedDrive = useDrives()?.find((drive) => drive.header.id === selectedDriveId);\n\tconst [drive, dispatch] = useDispatch(selectedDrive);\n\tif (!selectedDrive) return [void 0, void 0];\n\treturn [drive, dispatch];\n}\nfunction setSelectedDrive(driveOrDriveSlug) {\n\tconst driveSlug = typeof driveOrDriveSlug === \"string\" ? driveOrDriveSlug : driveOrDriveSlug?.header.slug;\n\tconst drives = window.ph?.drives;\n\tconst driveId = (typeof driveOrDriveSlug === \"object\" && driveOrDriveSlug !== null ? driveOrDriveSlug : drives?.find((d) => d.header.slug === driveSlug))?.header.id;\n\tif (!driveId && driveSlug && extractDriveSlugFromPath(window.location.pathname) === driveSlug) {\n\t\tif (window.ph?.selectedDriveId) setSelectedDriveId(void 0);\n\t\tdeferDriveSelection(driveSlug);\n\t\treturn;\n\t}\n\tcancelPendingDriveSelection();\n\tsetSelectedDriveId(driveId);\n\tif (!driveId) {\n\t\tconst pathname = resolveUrlPathname(\"/\");\n\t\tif (pathname === window.location.pathname) return;\n\t\twindow.history.pushState(null, \"\", createUrlWithPreservedParams(pathname));\n\t\treturn;\n\t}\n\tconst pathname = resolveUrlPathname(`/d/${driveSlug}`);\n\tif (pathname === window.location.pathname) return;\n\twindow.history.pushState(null, \"\", createUrlWithPreservedParams(pathname));\n}\nconst DEFERRED_DRIVE_TICK_MS = 2e3;\nconst DEFERRED_DRIVE_MAX_WAIT_MS = 15e3;\nfunction isInitialSyncInFlight() {\n\tconst remotes = window.ph?.reactorClientModule?.reactorModule?.syncModule?.syncManager?.list();\n\tif (!remotes?.length) return false;\n\treturn remotes.some((remote) => {\n\t\ttry {\n\t\t\tconst snapshot = remote.channel.getConnectionState();\n\t\t\treturn snapshot.receivingPages || !snapshot.lastSuccessUtcMs && snapshot.state !== \"error\";\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t});\n}\nlet pendingHandler;\nlet pendingTimeout;\nfunction cancelPendingDriveSelection() {\n\tif (pendingHandler) {\n\t\twindow.removeEventListener(\"ph:drivesUpdated\", pendingHandler);\n\t\tpendingHandler = void 0;\n\t}\n\tif (pendingTimeout) {\n\t\tclearTimeout(pendingTimeout);\n\t\tpendingTimeout = void 0;\n\t}\n}\nfunction deferDriveSelection(driveSlug) {\n\tcancelPendingDriveSelection();\n\tconst nodeSlug = extractNodeSlugFromPath(window.location.pathname);\n\tconst handler = () => {\n\t\tif (!window.ph?.drives?.find((d) => d.header.slug === driveSlug)) return;\n\t\tcancelPendingDriveSelection();\n\t\tsetSelectedDrive(driveSlug);\n\t\tsetSelectedNode(nodeSlug);\n\t};\n\tpendingHandler = handler;\n\twindow.addEventListener(\"ph:drivesUpdated\", handler);\n\tconst deadline = Date.now() + DEFERRED_DRIVE_MAX_WAIT_MS;\n\tconst scheduleTick = () => {\n\t\tpendingTimeout = setTimeout(() => {\n\t\t\tif (Date.now() < deadline && isInitialSyncInFlight()) {\n\t\t\t\tscheduleTick();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcancelPendingDriveSelection();\n\t\t\tconst pathname = resolveUrlPathname(\"/\");\n\t\t\tif (pathname === window.location.pathname) return;\n\t\t\twindow.history.pushState(null, \"\", createUrlWithPreservedParams(pathname));\n\t\t}, DEFERRED_DRIVE_TICK_MS);\n\t};\n\tscheduleTick();\n}\nfunction addSetSelectedDriveOnPopStateEventHandler() {\n\twindow.addEventListener(\"popstate\", () => {\n\t\tconst pathname = window.location.pathname;\n\t\tconst driveId = extractDriveIdFromPath(pathname);\n\t\tif (driveId !== window.ph?.selectedDriveId) setSelectedDrive(driveId);\n\t});\n}\n//#endregion\n//#region src/hooks/use-drop-target.ts\nfunction useDropTarget() {\n\tconst [isDropTarget, setIsDropTarget] = useState(false);\n\tconst isDragAndDropEnabled = useIsDragAndDropEnabled();\n\tconst targetSetter = funnel(() => setIsDropTarget(true), {\n\t\ttriggerAt: \"start\",\n\t\tminQuietPeriodMs: 100\n\t});\n\tconst targetUnsetter = funnel(() => setIsDropTarget(false), {\n\t\ttriggerAt: \"start\",\n\t\tminQuietPeriodMs: 100\n\t});\n\tfunction setTarget() {\n\t\tif (!isDragAndDropEnabled) return;\n\t\ttargetUnsetter.cancel();\n\t\ttargetSetter.call();\n\t}\n\tfunction unsetTarget() {\n\t\tif (!isDragAndDropEnabled) return;\n\t\ttargetSetter.cancel();\n\t\ttargetUnsetter.call();\n\t}\n\treturn {\n\t\tisDropTarget,\n\t\tsetTarget,\n\t\tunsetTarget\n\t};\n}\n//#endregion\n//#region src/hooks/node-drag-and-drop.ts\nconst draggingNodeEventFunctions = makePHEventFunctions(\"draggingNode\");\nconst useDraggingNode = draggingNodeEventFunctions.useValue;\nconst setDraggingNode = draggingNodeEventFunctions.setValue;\nconst addDraggingNodeEventHandler = draggingNodeEventFunctions.addEventHandler;\nconst draggingNodeSetter = funnel((node) => setDraggingNode(node), {\n\treducer: (_, newNode) => newNode,\n\ttriggerAt: \"start\",\n\tminQuietPeriodMs: 100\n});\nconst draggingNodeUnsetter = funnel(() => setDraggingNode(void 0), {\n\ttriggerAt: \"start\",\n\tminQuietPeriodMs: 100\n});\nfunction setDragging(node) {\n\tdraggingNodeUnsetter.cancel();\n\tdraggingNodeSetter.call(node);\n}\nfunction unsetDragging() {\n\tdraggingNodeSetter.cancel();\n\tdraggingNodeUnsetter.call();\n}\nconst isNodeDrag = (params) => conditional(params, [({ srcId }) => isNot(isTruthy)(srcId), constant(false)], [({ driveId }) => isNot(isTruthy)(driveId), constant(false)], [({ driveId, srcId }) => isStrictEqual(driveId, srcId), constant(false)], constant(true));\nfunction useDragNode(args) {\n\tconst { srcId, parentId } = args;\n\tconst driveId = useSelectedDriveId();\n\tconst draggingNodeId = useDraggingNode()?.srcId;\n\tconst params = {\n\t\tdriveId,\n\t\tsrcId,\n\t\tparentId\n\t};\n\tconst draggable = isNodeDrag(params);\n\tconst isDragging = allPass({\n\t\tsrcId,\n\t\tdraggingNodeId\n\t}, [\n\t\t() => draggable,\n\t\t({ srcId }) => isString(srcId),\n\t\t({ draggingNodeId }) => isString(draggingNodeId),\n\t\t({ srcId, draggingNodeId }) => isStrictEqual(srcId, draggingNodeId)\n\t]);\n\tconst onDragStart = () => {\n\t\tif (!draggable) return;\n\t\tsetDragging(params);\n\t};\n\tconst onDragEnd = () => {\n\t\tif (!draggable) return;\n\t\tunsetDragging();\n\t};\n\treturn {\n\t\tisDragging,\n\t\tdraggable,\n\t\tonDragStart,\n\t\tonDragEnd\n\t};\n}\nconst isNodeDrop = (params) => conditional(params, [({ srcId }) => isNot(isTruthy)(srcId), constant(false)], [({ driveId }) => isNot(isDefined)(driveId), constant(false)], [({ srcId, targetId }) => isStrictEqual(srcId, targetId), constant(false)], [({ driveId, parentId, targetId }) => isNot(isTruthy)(parentId) && isStrictEqual(targetId, driveId), constant(false)], [({ targetId, parentId }) => isStrictEqual(targetId, parentId), constant(false)], constant(true));\nfunction useDropNode(targetId) {\n\tconst driveId = useSelectedDriveId();\n\tconst { srcId, parentId } = useDraggingNode() ?? {};\n\tconst { isDropTarget, setTarget, unsetTarget } = useDropTarget();\n\tconst params = {\n\t\tdriveId,\n\t\tparentId,\n\t\ttargetId,\n\t\tsrcId\n\t};\n\tfunction handleNodeDrop(event, cb) {\n\t\tif (!isNodeDrop(params)) return;\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t\tcb?.();\n\t}\n\tconst onDragEnter = (event) => handleNodeDrop(event);\n\tconst onDragOver = (event) => handleNodeDrop(event, once(setTarget));\n\tconst onDragLeave = (event) => handleNodeDrop(event, once(unsetTarget));\n\tconst onDrop = (event) => handleNodeDrop(event, once(() => {\n\t\tunsetDragging();\n\t\tunsetTarget();\n\t\tmoveNodeById(params).catch(console.error);\n\t}));\n\treturn {\n\t\tisDropTarget,\n\t\tonDragEnter,\n\t\tonDragOver,\n\t\tonDragLeave,\n\t\tonDrop\n\t};\n}\n//#endregion\n//#region src/hooks/graphql-reactor-client.ts\nconst graphQLReactorClientEventFunctions = makePHEventFunctions(\"reactorGraphQLClient\");\nconst useGraphQLReactorClient = graphQLReactorClientEventFunctions.useValue;\nconst setGraphQLReactorClient = graphQLReactorClientEventFunctions.setValue;\nconst addGraphQLReactorClientEventHandler = graphQLReactorClientEventFunctions.addEventHandler;\n//#endregion\n//#region src/hooks/modals.ts\nconst modalEventFunctions = makePHEventFunctions(\"modal\");\n/** Returns the current modal */\nconst usePHModal = modalEventFunctions.useValue;\n/** Sets the current modal */\nconst setPHModal = modalEventFunctions.setValue;\n/** Adds an event handler for the modal */\nconst addModalEventHandler = modalEventFunctions.addEventHandler;\n/** Shows a modal */\nfunction showPHModal(modal) {\n\tsetPHModal(modal);\n}\n/** Closes the current modal */\nfunction closePHModal() {\n\tsetPHModal(void 0);\n}\n/** Shows the create document modal */\nfunction showCreateDocumentModal(documentType) {\n\tsetPHModal({\n\t\ttype: \"createDocument\",\n\t\tdocumentType\n\t});\n}\n/** Shows the delete node modal */\nfunction showDeleteNodeModal(nodeOrId) {\n\tsetPHModal({\n\t\ttype: \"deleteItem\",\n\t\tid: typeof nodeOrId === \"string\" ? nodeOrId : nodeOrId.id\n\t});\n}\n//#endregion\n//#region src/hooks/package-discovery.ts\nconst packageDiscoveryFunctions = makePHEventFunctions(\"packageDiscoveryService\");\nconst usePackageDiscoveryService = packageDiscoveryFunctions.useValue;\nconst setPackageDiscoveryService = packageDiscoveryFunctions.setValue;\nconst addPackageDiscoveryServiceEventHandler = packageDiscoveryFunctions.addEventHandler;\n//#endregion\n//#region src/hooks/reactor.ts\nconst reactorClientModuleEventFunctions = makePHEventFunctions(\"reactorClientModule\");\nconst reactorClientEventFunctions = makePHEventFunctions(\"reactorClient\");\n/** Returns the reactor client module */\nconst useReactorClientModule = reactorClientModuleEventFunctions.useValue;\n/** Sets the reactor client module */\nconst setReactorClientModule = reactorClientModuleEventFunctions.setValue;\n/** Adds an event handler for the reactor client module */\nconst addReactorClientModuleEventHandler = reactorClientModuleEventFunctions.addEventHandler;\n/** Returns the reactor client */\nconst useReactorClient = reactorClientEventFunctions.useValue;\n/** Sets the reactor client */\nconst setReactorClient = reactorClientEventFunctions.setValue;\n/** Adds an event handler for the reactor client */\nconst addReactorClientEventHandler = reactorClientEventFunctions.addEventHandler;\nconst useSync = () => useReactorClientModule()?.reactorModule?.syncModule?.syncManager;\nconst useSyncList = () => {\n\treturn useSync()?.list() ?? [];\n};\nconst useModelRegistry = () => useReactorClientModule()?.reactorModule?.documentModelRegistry;\nconst useDatabase = () => useReactorClientModule()?.reactorModule?.database;\nconst usePGlite = () => useReactorClientModule()?.pg;\n//#endregion\n//#region src/hooks/revision-history.ts\nconst revisionHistoryEventFunctions = makePHEventFunctions(\"revisionHistoryVisible\");\n/** Returns whether revision history is visible */\nconst useRevisionHistoryVisible = revisionHistoryEventFunctions.useValue;\n/** Sets revision history visibility */\nconst setRevisionHistoryVisible = revisionHistoryEventFunctions.setValue;\n/** Adds event handler for revision history visibility */\nconst addRevisionHistoryVisibleEventHandler = revisionHistoryEventFunctions.addEventHandler;\n/** Shows the revision history */\nfunction showRevisionHistory() {\n\tsetRevisionHistoryVisible(true);\n}\n/** Hides the revision history */\nfunction hideRevisionHistory() {\n\tsetRevisionHistoryVisible(false);\n}\n//#endregion\n//#region src/utils/nodes.ts\n/** Sorts nodes by name. */\nfunction sortNodesByName(nodes) {\n\treturn nodes.toSorted((a, b) => a.name.localeCompare(b.name));\n}\n/** Returns whether a node is a file. */\nfunction isFileNodeKind(node) {\n\tif (!node) return false;\n\treturn node.kind.toUpperCase() === \"FILE\";\n}\n/** Returns whether a node is a folder. */\nfunction isFolderNodeKind(node) {\n\tif (!node) return false;\n\treturn node.kind.toUpperCase() === \"FOLDER\";\n}\n//#endregion\n//#region src/hooks/items-in-selected-drive.ts\n/** Returns the nodes in the selected drive. */\nfunction useNodesInSelectedDrive() {\n\tconst [selectedDrive] = useSelectedDriveSafe();\n\treturn selectedDrive?.state.global.nodes;\n}\n/** Returns the file nodes in the selected drive. */\nfunction useFileNodesInSelectedDrive() {\n\treturn useNodesInSelectedDrive()?.filter((n) => isFileNodeKind(n));\n}\n/** Returns the folder nodes in the selected drive. */\nfunction useFolderNodesInSelectedDrive() {\n\treturn useNodesInSelectedDrive()?.filter((n) => isFolderNodeKind(n));\n}\n/** Returns the documents in the selected drive. */\nfunction useDocumentsInSelectedDrive() {\n\tconst fileNodeIds = useFileNodesInSelectedDrive()?.map((node) => node.id);\n\treturn useDocumentsByIds(fileNodeIds);\n}\n/** Returns the document types supported by the selected drive, as defined by the document model documents present in the drive */\nfunction useDocumentTypesInSelectedDrive() {\n\treturn (useDocumentsInSelectedDrive()?.filter(isDocumentModelDocument))?.map((doc) => doc.state.global.id);\n}\nfunction isDocumentModelDocument(document) {\n\treturn document.header.documentType === \"powerhouse/document-model\";\n}\n//#endregion\n//#region src/hooks/selected-node.ts\n/** Returns the selected node. */\nfunction useSelectedNode() {\n\tconst selectedNodeId = useSelectedNodeId();\n\treturn useNodesInSelectedDrive()?.find((n) => n.id === selectedNodeId);\n}\n//#endregion\n//#region src/hooks/selected-timeline-item.ts\nconst selectedTimelineItemEventFunctions = makePHEventFunctions(\"selectedTimelineItem\");\n/** Returns the selected timeline item */\nconst useSelectedTimelineItem = selectedTimelineItemEventFunctions.useValue;\n/** Sets the selected timeline item */\nconst setSelectedTimelineItem = selectedTimelineItemEventFunctions.setValue;\n/** Adds event handler for selected timeline item */\nconst addSelectedTimelineItemEventHandler = selectedTimelineItemEventFunctions.addEventHandler;\n//#endregion\n//#region src/hooks/timeline-revision.ts\nconst selectedTimelineRevisionEventFunctions = makePHEventFunctions(\"selectedTimelineRevision\");\n/** Returns the selected timeline revision. */\nconst useSelectedTimelineRevision = selectedTimelineRevisionEventFunctions.useValue;\n/** Sets the selected timeline revision. */\nconst setSelectedTimelineRevision = selectedTimelineRevisionEventFunctions.setValue;\n/** Adds an event handler for the selected timeline revision. */\nconst addSelectedTimelineRevisionEventHandler = selectedTimelineRevisionEventFunctions.addEventHandler;\n//#endregion\n//#region src/hooks/toast.ts\nconst toastEventFunctions = makePHEventFunctions(\"toast\");\n/** Returns the toast function */\nconst usePHToast = toastEventFunctions.useValue;\n/** Sets the toast function */\nconst setPHToast = toastEventFunctions.setValue;\n/** Adds an event handler for the toast */\nconst addToastEventHandler = toastEventFunctions.addEventHandler;\n//#endregion\n//#region src/hooks/vetra-packages.ts\nconst vetraPackageManagerFunctions = makePHEventFunctions(\"vetraPackageManager\");\nconst useVetraPackageManager = vetraPackageManagerFunctions.useValue;\n/** Returns all of the Vetra packages loaded by the Connect instance */\nconst useVetraPackages = () => {\n\tconst packageManager = useVetraPackageManager();\n\treturn useSyncExternalStore((cb) => packageManager ? packageManager.subscribe(cb) : () => {}, () => packageManager?.packages ?? []);\n};\n/** Adds the Vetra package manager event handler */\nconst addVetraPackageManagerEventHandler = vetraPackageManagerFunctions.addEventHandler;\n/** Sets the Vetra package manager and registers its packages */\nfunction setVetraPackageManager(packageManager) {\n\tvetraPackageManagerFunctions.setValue(packageManager);\n\tupdateReactorClientDocumentModels(packageManager.packages);\n\tupdateReactorClientUpgradeManifests(packageManager.packages);\n\tpackageManager.subscribe(({ packages }) => {\n\t\tupdateReactorClientDocumentModels(packages);\n\t\tupdateReactorClientUpgradeManifests(packages);\n\t});\n}\nfunction updateReactorClientDocumentModels(packages) {\n\tconst documentModelModules = packages.flatMap((pkg) => pkg.documentModels);\n\tconst registry = window.ph?.reactorClientModule?.reactorModule?.documentModelRegistry;\n\tif (!registry || documentModelModules.length === 0) return;\n\tconst results = registry.registerModules(...documentModelModules);\n\tconst duplicates = [];\n\tfor (const result of results) if (result.status === \"error\") if (DuplicateModuleError.isError(result.error)) duplicates.push(result);\n\telse console.error(\"Failed to register document model module:\", result.error);\n\tif (duplicates.length > 0) {\n\t\tconst duplicateTypes = duplicates.map((r) => r.item.documentModel.global.id);\n\t\tregistry.unregisterModules(...duplicateTypes);\n\t\tregistry.registerModules(...duplicates.map((r) => r.item));\n\t}\n}\nfunction updateReactorClientUpgradeManifests(packages) {\n\tconst upgradeManifests = packages.flatMap((pkg) => pkg.upgradeManifests).filter((u) => u !== void 0);\n\tconst registry = window.ph?.reactorClientModule?.reactorModule?.documentModelRegistry;\n\tif (!registry || upgradeManifests.length === 0) return;\n\tconst results = registry.registerUpgradeManifests(...upgradeManifests);\n\tconst duplicates = [];\n\tfor (const result of results) if (result.status === \"error\") if (DuplicateManifestError.isError(result.error)) duplicates.push(result);\n\telse console.error(\"Failed to register upgrade manifest:\", result.error);\n\tif (duplicates.length > 0) {\n\t\tconst duplicateTypes = duplicates.map((r) => r.item.documentType).filter((t) => !!t);\n\t\tregistry.unregisterUpgradeManifests(...duplicateTypes);\n\t\tregistry.registerUpgradeManifests(...duplicates.map((r) => r.item));\n\t}\n}\n//#endregion\n//#region src/hooks/add-ph-event-handlers.ts\nconst commonGlobalEventHandlerFunctions = {\n\tloading: addLoadingEventHandler,\n\tdrives: addDrivesEventHandler,\n\tselectedDriveId: () => {\n\t\taddSelectedDriveIdEventHandler();\n\t\taddSetSelectedDriveOnPopStateEventHandler();\n\t\taddResetSelectedNodeEventHandler();\n\t},\n\tselectedNodeId: () => {\n\t\taddSelectedNodeIdEventHandler();\n\t\taddSetSelectedNodeOnPopStateEventHandler();\n\t},\n\tdocumentCache: addDocumentCacheEventHandler,\n\treactorGraphQLClient: addGraphQLReactorClientEventHandler,\n\tdraggingNode: addDraggingNodeEventHandler\n};\nconst phGlobalEventHandlerRegisterFunctions = {\n\t...commonGlobalEventHandlerFunctions,\n\treactorClientModule: addReactorClientModuleEventHandler,\n\treactorClient: addReactorClientEventHandler,\n\tattachmentService: addAttachmentServiceEventHandler,\n\tfeatures: addFeaturesEventHandler,\n\tmodal: addModalEventHandler,\n\trenown: addRenownEventHandler,\n\tvetraPackageManager: addVetraPackageManagerEventHandler,\n\tpackageDiscoveryService: addPackageDiscoveryServiceEventHandler,\n\tselectedTimelineRevision: addSelectedTimelineRevisionEventHandler,\n\trevisionHistoryVisible: addRevisionHistoryVisibleEventHandler,\n\tselectedTimelineItem: addSelectedTimelineItemEventHandler,\n\trouterBasename: addRouterBasenameEventHandler,\n\tversion: addVersionEventHandler,\n\tlogLevel: addLogLevelEventHandler,\n\trequiresHardRefresh: addRequiresHardRefreshEventHandler,\n\twarnOutdatedApp: addWarnOutdatedAppEventHandler,\n\tstudioMode: addStudioModeEventHandler,\n\tbasePath: addBasePathEventHandler,\n\tversionCheckInterval: addVersionCheckIntervalEventHandler,\n\tcliVersion: addCliVersionEventHandler,\n\tfileUploadOperationsChunkSize: addFileUploadOperationsChunkSizeEventHandler,\n\tisDocumentModelSelectionSettingsEnabled: addIsDocumentModelSelectionSettingsEnabledEventHandler,\n\tgaTrackingId: addGaTrackingIdEventHandler,\n\tallowList: addAllowListEventHandler,\n\tdefaultDrivesUrl: addDefaultDrivesUrlEventHandler,\n\tdrivesPreserveStrategy: addDrivesPreserveStrategyEventHandler,\n\tallowedDocumentTypes: addAllowedDocumentTypesEventHandler,\n\tenabledEditors: addEnabledEditorsEventHandler,\n\tdisabledEditors: addDisabledEditorsEventHandler,\n\tisAddDriveEnabled: addIsAddDriveEnabledEventHandler,\n\tisLocalDrivesEnabled: addIsLocalDrivesEnabledEventHandler,\n\tisPublicDrivesEnabled: addIsPublicDrivesEnabledEventHandler,\n\tisAddPublicDrivesEnabled: addIsAddPublicDrivesEnabledEventHandler,\n\tisDeletePublicDrivesEnabled: addIsDeletePublicDrivesEnabledEventHandler,\n\tisCloudDrivesEnabled: addIsCloudDrivesEnabledEventHandler,\n\tisAddCloudDrivesEnabled: addIsAddCloudDrivesEnabledEventHandler,\n\tisDeleteCloudDrivesEnabled: addIsDeleteCloudDrivesEnabledEventHandler,\n\tisAddLocalDrivesEnabled: addIsAddLocalDrivesEnabledEventHandler,\n\tisDeleteLocalDrivesEnabled: addIsDeleteLocalDrivesEnabledEventHandler,\n\tisDragAndDropEnabled: addIsDragAndDropEnabledEventHandler,\n\tisExternalControlsEnabled: addIsExternalControlsEnabledEventHandler,\n\tisEditorDebugModeEnabled: addIsEditorDebugModeEnabledEventHandler,\n\tisEditorReadModeEnabled: addIsEditorReadModeEnabledEventHandler,\n\tisRelationalProcessorsEnabled: addIsRelationalProcessorsEnabledEventHandler,\n\tisExternalRelationalProcessorsEnabled: addIsExternalRelationalProcessorsEnabledEventHandler,\n\tisAnalyticsEnabled: addIsAnalyticsEnabledEventHandler,\n\tisAnalyticsExternalProcessorsEnabled: addIsAnalyticsExternalProcessorsEnabledEventHandler,\n\tanalyticsDatabaseName: addAnalyticsDatabaseNameEventHandler,\n\tisAnalyticsDatabaseWorkerEnabled: addIsAnalyticsDatabaseWorkerEnabledEventHandler,\n\tisDiffAnalyticsEnabled: addIsDiffAnalyticsEnabledEventHandler,\n\tisDriveAnalyticsEnabled: addIsDriveAnalyticsEnabledEventHandler,\n\trenownUrl: addRenownUrlEventHandler,\n\trenownNetworkId: addRenownNetworkIdEventHandler,\n\trenownChainId: addRenownChainIdEventHandler,\n\tsentryRelease: addSentryReleaseEventHandler,\n\tsentryDsn: addSentryDsnEventHandler,\n\tsentryEnv: addSentryEnvEventHandler,\n\tisSentryTracingEnabled: addIsSentryTracingEnabledEventHandler,\n\tisExternalProcessorsEnabled: addIsExternalProcessorsEnabledEventHandler,\n\tisExternalPackagesEnabled: addIsExternalPackagesEnabledEventHandler,\n\ttoast: addToastEventHandler\n};\nfunction addPHEventHandlers() {\n\tcallEventHandlerRegisterFunctions(phGlobalEventHandlerRegisterFunctions);\n}\nfunction callEventHandlerRegisterFunctions(registerFunctions) {\n\tforEachObj(registerFunctions, (fn) => fn());\n}\n//#endregion\n//#region src/hooks/document-model-modules.ts\nfunction useDocumentModelModules() {\n\treturn useVetraPackages().flatMap((pkg) => pkg.documentModels).filter((module, index, modules) => modules.findIndex((m) => m.documentModel.global.id === module.documentModel.global.id && m.version === module.version) === index);\n}\nfunction useDocumentModelModuleById(id) {\n\treturn useDocumentModelModules()?.find((module) => module.documentModel.global.id === id);\n}\n//#endregion\n//#region src/hooks/allowed-document-model-modules.ts\nfunction useAllowedDocumentModelModules() {\n\tconst documentModelModules = useDocumentModelModules();\n\tconst allowedDocumentTypes = useAllowedDocumentTypes();\n\tif (!allowedDocumentTypes?.length) return documentModelModules;\n\treturn documentModelModules?.filter((module) => allowedDocumentTypes.includes(module.documentModel.global.id));\n}\n//#endregion\n//#region src/hooks/selected-folder.ts\n/** Returns the selected folder. */\nfunction useSelectedFolder() {\n\tconst selectedNode = useSelectedNode();\n\tif (isFolderNodeKind(selectedNode)) return selectedNode;\n}\n//#endregion\n//#region src/hooks/child-nodes.ts\n/** Returns the child nodes for the selected drive or folder. */\nfunction useNodesInSelectedDriveOrFolder() {\n\tconst nodes = useNodesInSelectedDrive();\n\tconst selectedFolderId = useSelectedFolder()?.id;\n\tif (!nodes) return [];\n\tif (!selectedFolderId) return sortNodesByName(nodes.filter((n) => !n.parentFolder));\n\treturn sortNodesByName(nodes.filter((n) => n.parentFolder === selectedFolderId));\n}\n//#endregion\n//#region src/hooks/config/set-config-by-key.ts\nfunction setPHGlobalConfigByKey(key, value) {\n\tconst setter = phGlobalConfigSetters[key];\n\tsetter(value);\n}\nfunction setPHAppConfigByKey(key, value) {\n\tconst setter = phAppConfigSetters[key];\n\tsetter(value);\n}\nfunction setPHDocumentEditorConfigByKey(key, value) {\n\tconst setter = phDocumentEditorConfigSetters[key];\n\tsetter(value);\n}\n//#endregion\n//#region src/hooks/config/utils.ts\nfunction callGlobalSetterForKey(key, value) {\n\tconst setter = phGlobalConfigSetters[key];\n\tsetter(value);\n}\n//#endregion\n//#region src/hooks/config/set-config-by-object.ts\nfunction setDefaultPHGlobalConfig(config) {\n\tfor (const key of Object.keys(config)) callGlobalSetterForKey(key, config[key]);\n}\nfunction useSetDefaultPHGlobalConfig(config) {\n\tconst [isInitialized, setIsInitialized] = useState(false);\n\tuseEffect(() => {\n\t\tif (isInitialized) return;\n\t\tsetDefaultPHGlobalConfig(config);\n\t\tsetIsInitialized(true);\n\t}, [config, isInitialized]);\n}\nfunction useResetPHGlobalConfig(defaultConfigForReset) {\n\treturn function reset() {\n\t\tsetPHGlobalConfig(defaultConfigForReset);\n\t};\n}\nfunction setPHGlobalConfig(config) {\n\tfor (const key of Object.keys(config)) callGlobalSetterForKey(key, config[key]);\n}\nfunction useSetPHGlobalConfig(config) {\n\tconst [isInitialized, setIsInitialized] = useState(false);\n\tuseEffect(() => {\n\t\tif (isInitialized) return;\n\t\tsetPHGlobalConfig(config);\n\t\tsetIsInitialized(true);\n\t}, [config, isInitialized]);\n}\n/** Sets the global drive config.\n*\n* Pass in a partial object of the global drive config to set.\n*/\nfunction setPHAppConfig(config) {\n\tfor (const key of Object.keys(config)) callGlobalSetterForKey(key, config[key]);\n}\n/** Sets the global document config.\n*\n* Pass in a partial object of the global document config to set.\n*/\nfunction setPHDocumentEditorConfig(config) {\n\tfor (const key of Object.keys(config)) callGlobalSetterForKey(key, config[key]);\n}\n/** Wrapper hook for setting the global app config.\n*\n* Automatically sets the global app config when the component mounts.\n*\n* Pass in a partial object of the global app config to set.\n*/\nfunction useSetPHAppConfig(config) {\n\tconst [isInitialized, setIsInitialized] = useState(false);\n\tuseEffect(() => {\n\t\tif (isInitialized) return;\n\t\tsetPHAppConfig(config);\n\t\tsetIsInitialized(true);\n\t}, [config, isInitialized]);\n}\n/** Wrapper hook for setting the global document editor config.\n*\n* Automatically sets the global document editor config when the component mounts.\n*\n* Pass in a partial object of the global document editor config to set.\n*/\nfunction useSetPHDocumentEditorConfig(config) {\n\tconst [isInitialized, setIsInitialized] = useState(false);\n\tuseEffect(() => {\n\t\tif (isInitialized) return;\n\t\tsetPHDocumentEditorConfig(config);\n\t\tsetIsInitialized(true);\n\t}, [config, isInitialized]);\n}\n//#endregion\n//#region src/hooks/config/use-value-by-key.ts\nfunction usePHGlobalConfigByKey(key) {\n\tconst useValueHook = phGlobalConfigHooks[key];\n\treturn useValueHook();\n}\n/** Gets the value of an item in the global drive config for a given key.\n*\n* Strongly typed, inferred from type definition for the key.\n*/\nfunction usePHAppConfigByKey(key) {\n\tconst useValueHook = phAppConfigHooks[key];\n\treturn useValueHook();\n}\n/** Gets the value of an item in the global document config for a given key.\n*\n* Strongly typed, inferred from type definition for the key.\n*/\nfunction usePHDocumentEditorConfigByKey(key) {\n\tconst useValueHook = phDocumentEditorConfigHooks[key];\n\treturn useValueHook();\n}\n//#endregion\n//#region src/hooks/connection-state.ts\n/**\n* Returns a map of remote name to connection state snapshot for all remotes.\n* Re-renders when any remote's connection state changes.\n*/\nfunction useConnectionStates() {\n\tconst syncManager = useSync();\n\tconst [states, setStates] = useState(() => buildSnapshot(syncManager));\n\tconst unsubscribesRef = useRef([]);\n\tuseEffect(() => {\n\t\tif (!syncManager) return;\n\t\tfunction subscribe() {\n\t\t\tfor (const unsub of unsubscribesRef.current) unsub();\n\t\t\tunsubscribesRef.current = [];\n\t\t\tconst remotes = syncManager.list();\n\t\t\tfor (const remote of remotes) {\n\t\t\t\tconst unsub = remote.channel.onConnectionStateChange(() => {\n\t\t\t\t\tsetStates(buildSnapshot(syncManager));\n\t\t\t\t});\n\t\t\t\tunsubscribesRef.current.push(unsub);\n\t\t\t}\n\t\t\tsetStates(buildSnapshot(syncManager));\n\t\t}\n\t\tsubscribe();\n\t\tconst interval = setInterval(subscribe, 5e3);\n\t\treturn () => {\n\t\t\tclearInterval(interval);\n\t\t\tfor (const unsub of unsubscribesRef.current) unsub();\n\t\t\tunsubscribesRef.current = [];\n\t\t};\n\t}, [syncManager]);\n\treturn states;\n}\n/**\n* Returns the connection state snapshot for a specific remote by name.\n*/\nfunction useConnectionState(remoteName) {\n\treturn useConnectionStates().get(remoteName);\n}\nfunction buildSnapshot(syncManager) {\n\tconst map = /* @__PURE__ */ new Map();\n\tif (!syncManager) return map;\n\tfor (const remote of syncManager.list()) map.set(remote.name, remote.channel.getConnectionState());\n\treturn map;\n}\n//#endregion\n//#region src/hooks/document-of-type.ts\n/** Returns a document of a specific type, throws an error if the found document has a different type */\nfunction useDocumentOfType(documentId, documentType) {\n\tconst [document, dispatch] = useDocumentById(documentId);\n\tconst documentModelModule = useDocumentModelModuleById(documentType);\n\tif (!documentId || !documentType) return [];\n\tif (!document) throw new Error(`Document not found: ${documentId}`);\n\tif (!documentModelModule) throw new ModuleNotFoundError(documentType);\n\tif (document.header.documentType !== documentType) throw new DocumentTypeMismatchError(documentId, documentType, document.header.documentType);\n\treturn [document, dispatch];\n}\n//#endregion\n//#region src/hooks/document-operations.ts\n/**\n* Hook to fetch document operations via the reactor client.\n* Operations are no longer auto-populated on documents and must be fetched explicitly.\n*\n* @param documentId - The document ID to fetch operations for\n* @returns Object containing globalOperations, localOperations, isLoading, and error\n*/\nfunction useDocumentOperations(documentId) {\n\tconst reactorClient = useReactorClient();\n\tconst hasFetchedRef = useRef(false);\n\tconst [state, setState] = useState(() => ({\n\t\tglobalOperations: [],\n\t\tlocalOperations: [],\n\t\tisLoading: !!documentId,\n\t\terror: void 0\n\t}));\n\tconst fetchOperations = useCallback(async (retryCount = 0) => {\n\t\tconst MAX_RETRIES = 5;\n\t\tconst RETRY_DELAY_MS = 500;\n\t\tif (!documentId || !reactorClient) {\n\t\t\tsetState({\n\t\t\t\tglobalOperations: [],\n\t\t\t\tlocalOperations: [],\n\t\t\t\tisLoading: false,\n\t\t\t\terror: void 0\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tsetState((prev) => ({\n\t\t\t...prev,\n\t\t\tisLoading: true,\n\t\t\terror: void 0\n\t\t}));\n\t\tlet globalOps = [];\n\t\tlet localOps = [];\n\t\tlet fetchError;\n\t\ttry {\n\t\t\tglobalOps = (await reactorClient.getOperations(documentId, { scopes: [\"global\"] })).results;\n\t\t} catch (err) {\n\t\t\tfetchError = err instanceof Error ? err : new Error(String(err));\n\t\t}\n\t\tif (!fetchError) try {\n\t\t\tlocalOps = (await reactorClient.getOperations(documentId, { scopes: [\"local\"] })).results;\n\t\t} catch (err) {\n\t\t\tfetchError = err instanceof Error ? err : new Error(String(err));\n\t\t}\n\t\tif (!fetchError && globalOps.length === 0 && localOps.length === 0 && retryCount < MAX_RETRIES) {\n\t\t\tawait new Promise((resolve) => setTimeout(resolve, RETRY_DELAY_MS));\n\t\t\treturn fetchOperations(retryCount + 1);\n\t\t}\n\t\tsetState({\n\t\t\tglobalOperations: globalOps,\n\t\t\tlocalOperations: localOps,\n\t\t\tisLoading: false,\n\t\t\terror: fetchError\n\t\t});\n\t\thasFetchedRef.current = true;\n\t}, [documentId, reactorClient]);\n\tuseEffect(() => {\n\t\tif (documentId && reactorClient) fetchOperations();\n\t\telse if (!documentId) {\n\t\t\tsetState({\n\t\t\t\tglobalOperations: [],\n\t\t\t\tlocalOperations: [],\n\t\t\t\tisLoading: false,\n\t\t\t\terror: void 0\n\t\t\t});\n\t\t\thasFetchedRef.current = false;\n\t\t}\n\t}, [\n\t\tdocumentId,\n\t\treactorClient,\n\t\tfetchOperations\n\t]);\n\tconst refetch = useCallback(() => {\n\t\tfetchOperations(0);\n\t}, [fetchOperations]);\n\treturn {\n\t\t...state,\n\t\trefetch\n\t};\n}\n//#endregion\n//#region src/hooks/supported-document-types.ts\n/** Returns the supported document types for the reactor (derived from the document model modules) */\nfunction useSupportedDocumentTypesInReactor() {\n\treturn useDocumentModelModules()?.map((module) => module.documentModel.global.id);\n}\n//#endregion\n//#region src/hooks/document-types.ts\n/** Returns the document types a app supports.\n*\n* If present, uses the `allowedDocumentTypes` config value.\n* Otherwise, uses the supported document types from the reactor.\n*/\nfunction useDocumentTypes() {\n\tconst allowedDocumentTypes = useAllowedDocumentTypes();\n\tconst supportedDocumentTypes = useSupportedDocumentTypesInReactor();\n\treturn allowedDocumentTypes ?? supportedDocumentTypes;\n}\n//#endregion\n//#region src/utils/validate-document.ts\nconst validateDocument = (document) => {\n\tconst errors = [];\n\tif (document.header.documentType !== \"powerhouse/document-model\") return errors;\n\tconst doc = document;\n\tconst specs = doc.state.global.specifications[0];\n\tconst initialStateErrors = Object.keys(specs.state).reduce((acc, scopeKey) => {\n\t\tconst scope = scopeKey;\n\t\treturn [...acc, ...validateInitialState(specs.state[scope].initialValue, scope !== \"global\").map((err) => ({\n\t\t\t...err,\n\t\t\tmessage: `${err.message}. Scope: ${scope}`,\n\t\t\tdetails: {\n\t\t\t\t...err.details,\n\t\t\t\tscope\n\t\t\t}\n\t\t}))];\n\t}, []);\n\tconst schemaStateErrors = Object.keys(specs.state).reduce((acc, scopeKey) => {\n\t\tconst scope = scopeKey;\n\t\tconst isGlobalScope = scope === \"global\";\n\t\treturn [...acc, ...validateStateSchemaName(specs.state[scope].schema, doc.state.global?.name || doc.header.name || \"\", !isGlobalScope ? scope : \"\", !isGlobalScope).map((err) => ({\n\t\t\t...err,\n\t\t\tmessage: `${err.message}. Scope: ${scope}`,\n\t\t\tdetails: {\n\t\t\t\t...err.details,\n\t\t\t\tscope\n\t\t\t}\n\t\t}))];\n\t}, []);\n\tconst modulesErrors = validateModules(specs.modules);\n\treturn [\n\t\t...initialStateErrors,\n\t\t...schemaStateErrors,\n\t\t...modulesErrors\n\t];\n};\n//#endregion\n//#region src/utils/download-document.ts\nfunction defaultHandleError(error) {\n\tconsole.error(`Failed to export document: ${error.message}`);\n}\nfunction handleDocumentValidation(document) {\n\tif (hasAtLeast(validateDocument(document), 1)) return false;\n\treturn true;\n}\nfunction downloadDocument(document, handleError = defaultHandleError) {\n\tif (!document) return;\n\tif (!handleDocumentValidation(document)) {\n\t\tshowPHModal({\n\t\t\ttype: \"downloadDocumentWithErrors\",\n\t\t\tdocumentId: document.header.id\n\t\t});\n\t\treturn;\n\t}\n\texportFile(document).catch((error) => handleError(normalizeException(error)));\n}\n//#endregion\n//#region src/hooks/download-document.ts\nfunction useDownloadDocument(id) {\n\tconst [document] = useDocumentById(id);\n\tconst toast = usePHToast();\n\treturn () => downloadDocument(document, (error) => toast?.(`Failed to export document: ${error.message}`));\n}\n//#endregion\n//#region src/hooks/drive-by-id.ts\nfunction useDriveById(driveId) {\n\tconst foundDrive = useDrives()?.find((drive) => drive.header.id === driveId);\n\tconst [drive, dispatch] = useDispatch(foundDrive);\n\tif (!foundDrive) throw new Error(`Drive with id ${driveId} not found`);\n\treturn [drive, dispatch];\n}\n//#endregion\n//#region src/hooks/editor-modules.ts\nfunction useEditorModules() {\n\treturn useVetraPackages().flatMap((pkg) => pkg.editors).filter((module) => !module.documentTypes.includes(\"powerhouse/document-drive\"));\n}\nfunction useAppModules() {\n\treturn useVetraPackages().flatMap((pkg) => pkg.editors).filter((module) => module.documentTypes.includes(\"powerhouse/document-drive\"));\n}\nfunction useFallbackEditorModule(documentType) {\n\tconst editorModules = useEditorModules();\n\tif (!documentType) return void 0;\n\tif (editorModules?.length === 0) return void 0;\n\treturn (editorModules?.filter((module) => module.documentTypes.includes(documentType)))?.[0];\n}\nfunction useAppModuleById(id) {\n\treturn useAppModules()?.find((module) => module.config.id === id);\n}\nfunction useDefaultAppModule() {\n\treturn useAppModuleById(DEFAULT_DRIVE_EDITOR_ID);\n}\nfunction useEditorModuleById(id) {\n\treturn useEditorModules()?.find((module) => module.config.id === id);\n}\nfunction useEditorModulesForDocumentType(documentType) {\n\tconst editorModules = useEditorModules();\n\tif (!documentType) return void 0;\n\treturn editorModules?.filter((module) => module.documentTypes.includes(documentType));\n}\n//#endregion\n//#region src/hooks/file-drag-and-drop.ts\nconst allowedExtensions = [\n\t\"zip\",\n\t\"phd\",\n\t\"phdm\"\n];\nconst hasFilesType = (types) => isDefined(find(types, (type) => isStrictEqual(type, \"Files\")));\nconst isFileDrop = (event) => allPass(event.dataTransfer.types, [\n\tisArray,\n\thasAtLeast(1),\n\thasFilesType\n]);\nconst EDITOR_FILE_DROP_OPT_OUT_ATTR = \"data-accepts-files\";\nconst isInsideEditorFileDropOptOut = (event) => {\n\tconst target = event.target;\n\tif (!(target instanceof Element)) return false;\n\treturn target.closest(`[${EDITOR_FILE_DROP_OPT_OUT_ATTR}]`) !== null;\n};\nconst hasAllowedExtension = (file) => pipe(file, (file) => file.name, split(\".\"), last(), isIncludedIn(allowedExtensions));\nconst getFileItems = (event) => pipe([...event.dataTransfer.items], filter((item) => isStrictEqual(item.kind, \"file\")), map((item) => item.getAsFile()), filter(isTruthy));\nfunction useDropFile(handleAddFile) {\n\tconst { isDropTarget, setTarget, unsetTarget } = useDropTarget();\n\tconst isDragAndDropEnabled = useIsDragAndDropEnabled();\n\tconst selectedFolder = useSelectedFolder();\n\tfunction handleDragEvent(event, cb) {\n\t\tif (!isDragAndDropEnabled) return;\n\t\tif (!isFileDrop(event)) return;\n\t\tif (isInsideEditorFileDropOptOut(event)) {\n\t\t\tunsetTarget();\n\t\t\treturn;\n\t\t}\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t\tcb?.();\n\t}\n\tconst handleAddFiles = (event) => Promise.all(pipe(event, getFileItems, filter(hasAllowedExtension), map((file) => handleAddFile(file, selectedFolder))));\n\tconst onDragEnter = (event) => handleDragEvent(event);\n\tconst onDragOver = (event) => handleDragEvent(event, setTarget);\n\tconst onDragLeave = (event) => handleDragEvent(event, unsetTarget);\n\tconst onDrop = (event) => handleDragEvent(event, once(() => {\n\t\tunsetTarget();\n\t\thandleAddFiles(event).catch(console.error);\n\t}));\n\treturn {\n\t\tonDragEnter,\n\t\tonDragOver,\n\t\tonDragLeave,\n\t\tonDrop,\n\t\tisDropTarget\n\t};\n}\n//#endregion\n//#region src/hooks/folder-by-id.ts\nfunction useFolderById(id) {\n\treturn useFolderNodesInSelectedDrive()?.find((n) => n.id === id);\n}\n//#endregion\n//#region src/graphql/events.ts\nfunction dispatchGraphQLClientDocumentEvent(operationName, identifier) {\n\tconst event = new CustomEvent(operationName, { detail: { identifier } });\n\twindow.dispatchEvent(event);\n}\n//#endregion\n//#region src/graphql/document-cache-client-middleware.ts\nconst documentCacheClientMiddleware = async (action, operationName, operationType, variables) => {\n\tconsole.log({\n\t\toperationName,\n\t\toperationType,\n\t\tvariables\n\t});\n\tconst result = await action();\n\tif (isIncludedIn(operationName, graphqlEventsToSyncDrive)) window.dispatchEvent(new CustomEvent(operationName));\n\tif (isStrictEqual(operationName, \"MutateDocument\")) dispatchGraphQLClientDocumentEvent(operationName, identifierFromMutateDocumentOperationVariables(variables));\n\treturn result;\n};\n//#endregion\n//#region src/hooks/init-graphql-reactor-client.ts\nfunction useInitReactorGraphqlClient(switchboardUrl = DEFAULT_SWITCHBOARD_URL, driveId = DEFAULT_DRIVE_ID) {\n\tconst [hasInit, setHasInit] = useState(false);\n\tuseEffect(() => {\n\t\tif (hasInit) return;\n\t\tinitGraphQLReactorClientWithDocumentCache(switchboardUrl, driveId).then(() => setHasInit(true)).catch(console.error);\n\t}, [hasInit]);\n\treturn hasInit;\n}\nasync function reactorGraphqlFetchDrive(identifier) {\n\tconst client = window.ph?.reactorGraphQLClient;\n\tif (!client) throw new Error(\"Please call `useInitReactorGraphqlClient` to use its functions\");\n\tconst result = await client.GetDocument({ identifier });\n\tif (!result.document?.document) throw new Error(\"Could not fetch drive with id: \" + identifier);\n\treturn phDocumentFromQuery(result.document.document, DriveDocumentSchema);\n}\nasync function reactorGraphqlSyncDrive(driveId) {\n\tif (!window.ph?.reactorGraphQLClient) throw new Error(\"Please call `useInitReactorGraphqlClient` to use its functions\");\n\tconst drive = await reactorGraphqlFetchDrive(driveId);\n\tsetDrives([drive]);\n\tsetSelectedDrive(drive);\n}\nasync function initGraphQLReactorClientWithDocumentCache(switchboardUrl, driveId) {\n\tif (!window.ph) window.ph = {};\n\tcallEventHandlerRegisterFunctions(commonGlobalEventHandlerFunctions);\n\tsetGraphQLReactorClient(createClient(switchboardUrl, documentCacheClientMiddleware));\n\tawait reactorGraphqlSyncDrive(driveId);\n\tsetSelectedNode(void 0);\n\tsetDocumentCache(new GraphQLClientDocumentCache());\n\tforEach(graphqlEventsToSyncDrive, (name) => {\n\t\twindow.addEventListener(name, () => {\n\t\t\treactorGraphqlSyncDrive(driveId).catch(console.error);\n\t\t});\n\t});\n}\n//#endregion\n//#region src/hooks/items-in-selected-folder.ts\n/** Returns the nodes in the selected folder. */\nfunction useNodesInSelectedFolder() {\n\tconst selectedFolder = useSelectedFolder();\n\tconst nodes = useNodesInSelectedDrive();\n\tif (!selectedFolder || !nodes) return void 0;\n\treturn nodes.filter((n) => n.parentFolder === selectedFolder.id);\n}\n/** Returns the file nodes in the selected folder. */\nfunction useFileNodesInSelectedFolder() {\n\tconst nodes = useNodesInSelectedFolder();\n\tif (!nodes) return void 0;\n\treturn nodes.filter((n) => isFileNodeKind(n));\n}\n/** Returns the folder nodes in the selected folder. */\nfunction useFolderNodesInSelectedFolder() {\n\tconst nodes = useNodesInSelectedFolder();\n\tif (!nodes) return void 0;\n\treturn nodes.filter((n) => isFolderNodeKind(n));\n}\n/** Returns the documents in the selected folder. */\nfunction useDocumentsInSelectedFolder() {\n\tconst documents = useDocumentsInSelectedDrive();\n\tconst fileNodeIds = useFileNodesInSelectedFolder()?.map((node) => node.id);\n\treturn documents?.filter((d) => fileNodeIds?.includes(d.header.id));\n}\n//#endregion\n//#region src/hooks/node-actions.ts\nfunction resolveNode(driveId, node) {\n\treturn node?.id !== driveId ? node : void 0;\n}\nfunction useNodeActions() {\n\tconst [selectedDrive] = useSelectedDriveSafe();\n\tconst selectedFolder = useSelectedFolder();\n\tconst selectedParentFolder = useFolderById(useSelectedNode()?.parentFolder);\n\tconst selectedDriveId = selectedDrive?.header.id;\n\tconst drives = useDrives();\n\tasync function onAddFile(file, parent) {\n\t\tif (!selectedDriveId) return;\n\t\treturn addFile(file, selectedDriveId, file.name.replace(/\\..+/gim, \"\"), resolveNode(selectedDriveId, parent)?.id);\n\t}\n\tasync function onAddFolder(name, parent) {\n\t\tif (!selectedDriveId) return;\n\t\treturn addFolder(selectedDriveId, name, resolveNode(selectedDriveId, parent)?.id);\n\t}\n\tasync function onRenameNode(newName, node) {\n\t\tif (!selectedDriveId) return;\n\t\tif (!resolveNode(selectedDriveId, node)) {\n\t\t\tconsole.error(`Node ${node.id} not found`);\n\t\t\treturn;\n\t\t}\n\t\treturn await renameNode(selectedDriveId, node.id, newName);\n\t}\n\tasync function onCopyNode(src, target) {\n\t\tif (!selectedDriveId) return;\n\t\tconst resolvedSrc = resolveNode(selectedDriveId, src);\n\t\tif (!resolvedSrc) {\n\t\t\tconsole.error(`Node ${src.id} not found`);\n\t\t\treturn;\n\t\t}\n\t\tawait copyNode$1(selectedDriveId, resolvedSrc, resolveNode(selectedDriveId, target));\n\t}\n\tasync function onMoveNode(src, target) {\n\t\tif (!selectedDriveId) return;\n\t\tconst resolvedSrc = resolveNode(selectedDriveId, src);\n\t\tif (!resolvedSrc) {\n\t\t\tconsole.error(`Node ${src.id} not found`);\n\t\t\treturn;\n\t\t}\n\t\tconst resolvedTarget = resolveNode(selectedDriveId, target);\n\t\tif (!resolvedTarget?.id && !src.parentFolder || resolvedTarget?.id === src.parentFolder) return;\n\t\tawait moveNode$1(selectedDriveId, resolvedSrc, resolvedTarget);\n\t}\n\tasync function onDuplicateNode(src) {\n\t\tif (!selectedDriveId) return;\n\t\tconst resolvedSrc = resolveNode(selectedDriveId, src);\n\t\tif (!resolvedSrc) {\n\t\t\tconsole.error(`Node ${src.id} not found`);\n\t\t\treturn;\n\t\t}\n\t\tawait copyNode$1(selectedDriveId, resolvedSrc, resolveNode(selectedDriveId, selectedFolder ?? selectedParentFolder));\n\t}\n\tasync function onAddAndSelectNewFolder(name) {\n\t\tif (!name) return;\n\t\tif (!selectedDriveId) return;\n\t\tconst resolvedTarget = resolveNode(selectedDriveId, selectedFolder ?? selectedParentFolder);\n\t\tif (!resolvedTarget) return;\n\t\tconst newFolder = await onAddFolder(name, resolvedTarget);\n\t\tif (newFolder) setSelectedNode(newFolder);\n\t}\n\tasync function onRenameDriveNodes(newName, nodeId) {\n\t\tif (!drives) return;\n\t\tconst drivesWithNode = drives.filter((drive) => drive.state.global.nodes.some((n) => n.id === nodeId));\n\t\tawait Promise.all(drivesWithNode.map((drive) => renameDriveNode(drive.header.id, nodeId, newName)));\n\t}\n\treturn {\n\t\tonAddFile,\n\t\tonAddFolder,\n\t\tonRenameNode,\n\t\tonCopyNode,\n\t\tonMoveNode,\n\t\tonDuplicateNode,\n\t\tonAddAndSelectNewFolder,\n\t\tonRenameDriveNodes\n\t};\n}\n//#endregion\n//#region src/hooks/node-by-id.ts\n/** Returns a node in the selected drive by id. */\nfunction useNodeById(id) {\n\treturn useNodesInSelectedDrive()?.find((n) => n.id === id);\n}\n//#endregion\n//#region src/hooks/node-path.ts\n/** Returns the path to a node in the selected drive */\nfunction useNodePathById(id) {\n\tconst nodes = useNodesInSelectedDrive();\n\tif (!nodes) return [];\n\tconst path = [];\n\tlet current = nodes.find((n) => n.id === id);\n\twhile (current) {\n\t\tpath.push(current);\n\t\tif (!current.parentFolder) break;\n\t\tcurrent = nodes.find((n) => n.id === current?.parentFolder);\n\t}\n\treturn path.reverse();\n}\n/** Returns the path to the currently selected node in the selected drive. */\nfunction useSelectedNodePath() {\n\treturn useNodePathById(useSelectedNode()?.id);\n}\n//#endregion\n//#region src/hooks/parent-folder.ts\nfunction useNodeParentFolderById(id) {\n\treturn useFolderById(useNodeById(id)?.parentFolder);\n}\nfunction useParentFolderForSelectedNode() {\n\treturn useNodeParentFolderById(useSelectedNode()?.id);\n}\n//#endregion\n//#region src/hooks/selected-document.ts\n/** Returns the selected document id */\nfunction useSelectedDocumentId() {\n\tconst selectedNode = useSelectedNode();\n\treturn selectedNode && isFileNode(selectedNode) ? selectedNode.id : void 0;\n}\n/** Returns the selected document. */\nfunction useSelectedDocument() {\n\tconst [document, dispatch] = useDocumentById(useSelectedDocumentId());\n\tif (!document) throw new NoSelectedDocumentError();\n\treturn [document, dispatch];\n}\n/** Returns the selected document. */\nfunction useSelectedDocumentSafe() {\n\treturn useDocumentById(useSelectedDocumentId());\n}\nfunction useSelectedDocumentOfType(documentType) {\n\tconst documentId = useSelectedDocumentId();\n\tif (!documentType) return [];\n\tif (!documentId) throw new NoSelectedDocumentError();\n\treturn useDocumentOfType(documentId, documentType);\n}\n//#endregion\n//#region src/hooks/subgraph-modules.ts\nfunction useSubgraphModules() {\n\treturn useVetraPackages().flatMap((pkg) => pkg.subgraphs || []);\n}\n//#endregion\n//#region src/hooks/theme.ts\nconst STORED_THEME_KEY = \"ph:theme\";\nconst UPDATE_STORED_THEME = \"ph:updateStoredTheme\";\nconst STORED_THEME_UPDATED = \"ph:storedThemeUpdated\";\nconst SYSTEM_THEME_UPDATED = \"ph:systemThemeUpdated\";\nconst isServer = typeof window === \"undefined\";\nfunction setStoredTheme(storedTheme) {\n\tif (isServer) return;\n\tlocalStorage.setItem(STORED_THEME_KEY, storedTheme);\n}\nfunction setTheme(storedTheme) {\n\tif (isServer) return;\n\tconst updateStoredThemeEvent = new CustomEvent(UPDATE_STORED_THEME, { detail: { storedTheme } });\n\twindow.dispatchEvent(updateStoredThemeEvent);\n}\nfunction handleUpdateStoredTheme(event) {\n\tif (isServer) return;\n\tconst storedTheme = event.detail.storedTheme;\n\tsetStoredTheme(storedTheme);\n\tconst storedThemeUpdatedEvent = new CustomEvent(STORED_THEME_UPDATED, { detail: { storedTheme } });\n\twindow.dispatchEvent(storedThemeUpdatedEvent);\n}\nfunction getStoredTheme() {\n\tif (isServer) return void 0;\n\treturn localStorage.getItem(STORED_THEME_KEY) ?? void 0;\n}\nfunction getPrefersDarkMediaQuery() {\n\tif (isServer) return;\n\treturn window.matchMedia(\"(prefers-color-scheme: dark)\");\n}\nfunction getPrefersDark() {\n\tif (isServer) return false;\n\tif (getPrefersDarkMediaQuery()?.matches) return true;\n\treturn false;\n}\nfunction getSystemTheme() {\n\tif (isServer) return \"light\";\n\tif (getPrefersDark()) return \"dark\";\n\treturn \"light\";\n}\nfunction handleSystemThemeChange(event) {\n\tconst systemTheme = event.matches ? \"dark\" : \"light\";\n\tconst systemThemeUpdatedEvent = new CustomEvent(SYSTEM_THEME_UPDATED, { detail: { systemTheme } });\n\twindow.dispatchEvent(systemThemeUpdatedEvent);\n}\nfunction toggleDark(isDark) {\n\tif (isServer) return;\n\tdocument.documentElement.classList.toggle(\"dark\", isDark);\n}\nfunction initTheme() {\n\tif (isServer) return;\n\tuseEffect(() => {\n\t\twindow.addEventListener(UPDATE_STORED_THEME, handleUpdateStoredTheme);\n\t\tconst prefersDarkMediaQuery = getPrefersDarkMediaQuery();\n\t\tprefersDarkMediaQuery?.addEventListener(\"change\", handleSystemThemeChange);\n\t\treturn () => {\n\t\t\twindow.removeEventListener(UPDATE_STORED_THEME, handleUpdateStoredTheme);\n\t\t\tprefersDarkMediaQuery?.removeEventListener(\"change\", handleSystemThemeChange);\n\t\t};\n\t}, []);\n}\nfunction subscribeToStoredTheme(onStoreChange) {\n\tif (isServer) return () => {};\n\twindow.addEventListener(STORED_THEME_UPDATED, onStoreChange);\n\treturn () => {\n\t\twindow.removeEventListener(STORED_THEME_UPDATED, onStoreChange);\n\t};\n}\nfunction subscribeToSystemTheme(onStoreChange) {\n\tif (isServer) return () => {};\n\twindow.addEventListener(SYSTEM_THEME_UPDATED, onStoreChange);\n\treturn () => {\n\t\twindow.removeEventListener(SYSTEM_THEME_UPDATED, onStoreChange);\n\t};\n}\nfunction useTheme() {\n\tconst storedTheme = useSyncExternalStore(subscribeToStoredTheme, () => getStoredTheme(), () => \"system\");\n\tconst systemTheme = useSyncExternalStore(subscribeToSystemTheme, () => getSystemTheme(), () => \"light\");\n\tconst isSystem = storedTheme === void 0 || storedTheme === \"system\";\n\tconst theme = isSystem ? systemTheme : storedTheme;\n\tconst isDark = theme === \"dark\";\n\tuseEffect(() => {\n\t\ttoggleDark(isDark);\n\t}, [isDark]);\n\treturn {\n\t\ttheme,\n\t\tisSystem,\n\t\tsetTheme\n\t};\n}\n//#endregion\n//#region src/hooks/use-drive-system-info.ts\nfunction deriveSystemUrl(channelUrl) {\n\ttry {\n\t\tconst url = new URL(channelUrl);\n\t\turl.search = \"\";\n\t\turl.hash = \"\";\n\t\tif (url.pathname.endsWith(\"/graphql/r\")) url.pathname = url.pathname.slice(0, -10) + \"/graphql/system\";\n\t\telse url.pathname = \"/graphql/system\";\n\t\treturn url.toString();\n\t} catch {\n\t\treturn null;\n\t}\n}\nconst cache = /* @__PURE__ */ new Map();\nfunction useDriveSystemInfo(drive) {\n\tconst remotes = useSyncList();\n\tconst driveId = drive?.header.id;\n\tconst systemUrl = useMemo(() => {\n\t\tif (!driveId) return null;\n\t\tconst channelUrl = (remotes.find((r) => r.collectionId === driveCollectionId$1(\"main\", driveId))?.channel)?.config.url;\n\t\tif (typeof channelUrl !== \"string\") return null;\n\t\treturn deriveSystemUrl(channelUrl);\n\t}, [remotes, driveId]);\n\tconst [state, setState] = useState(() => systemUrl ? cache.get(systemUrl) ?? { status: \"loading\" } : { status: \"local\" });\n\tuseEffect(() => {\n\t\tif (!systemUrl) {\n\t\t\tsetState({ status: \"local\" });\n\t\t\treturn;\n\t\t}\n\t\tconst cached = cache.get(systemUrl);\n\t\tif (cached && cached.status !== \"loading\") {\n\t\t\tsetState(cached);\n\t\t\treturn;\n\t\t}\n\t\tsetState({ status: \"loading\" });\n\t\tcache.set(systemUrl, { status: \"loading\" });\n\t\tconst controller = new AbortController();\n\t\tfetch(systemUrl, {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\tbody: JSON.stringify({ query: \"{ system { version gitHash gitUrl } }\" }),\n\t\t\tsignal: controller.signal\n\t\t}).then(async (res) => {\n\t\t\tconst json = await res.json();\n\t\t\tif (json.errors?.length) throw new Error(json.errors.map((e) => e.message).join(\"; \"));\n\t\t\tconst sys = json.data?.system;\n\t\t\tif (!sys) throw new Error(\"Missing system in response\");\n\t\t\tconst next = {\n\t\t\t\tstatus: \"ready\",\n\t\t\t\tversion: sys.version,\n\t\t\t\tgitHash: sys.gitHash,\n\t\t\t\tgitUrl: sys.gitUrl ?? null,\n\t\t\t\thost: new URL(systemUrl).host\n\t\t\t};\n\t\t\tcache.set(systemUrl, next);\n\t\t\tsetState(next);\n\t\t}).catch((err) => {\n\t\t\tif (controller.signal.aborted) return;\n\t\t\tconst message = err instanceof Error ? err.message : String(err);\n\t\t\tconsole.error(message);\n\t\t\tconst next = {\n\t\t\t\tstatus: \"error\",\n\t\t\t\tmessage\n\t\t\t};\n\t\t\tcache.set(systemUrl, next);\n\t\t\tsetState(next);\n\t\t});\n\t\treturn () => controller.abort();\n\t}, [systemUrl]);\n\treturn state;\n}\n//#endregion\n//#region src/hooks/use-editor-file-drop.ts\nconst hasFiles = (event) => event.dataTransfer.types.includes(\"Files\");\nconst filterByExtension = (files, accept) => {\n\tconst all = Array.from(files);\n\tif (!accept || accept.length === 0) return all;\n\tconst lowerAccept = accept.map((ext) => ext.toLowerCase());\n\treturn all.filter((file) => {\n\t\tconst lower = file.name.toLowerCase();\n\t\treturn lowerAccept.some((ext) => lower.endsWith(ext));\n\t});\n};\nfunction useEditorFileDrop(options) {\n\tconst { accept, onFiles } = options;\n\tconst [isDragOver, setIsDragOver] = useState(false);\n\tconst depthRef = useRef(0);\n\tconst onDragOver = useCallback((event) => {\n\t\tif (!hasFiles(event)) return;\n\t\tevent.preventDefault();\n\t}, []);\n\treturn {\n\t\tdragProps: {\n\t\t\tonDragEnter: useCallback((event) => {\n\t\t\t\tif (!hasFiles(event)) return;\n\t\t\t\tdepthRef.current += 1;\n\t\t\t\tif (depthRef.current === 1) setIsDragOver(true);\n\t\t\t}, []),\n\t\t\tonDragOver,\n\t\t\tonDragLeave: useCallback((event) => {\n\t\t\t\tif (!hasFiles(event)) return;\n\t\t\t\tdepthRef.current = Math.max(0, depthRef.current - 1);\n\t\t\t\tif (depthRef.current === 0) setIsDragOver(false);\n\t\t\t}, []),\n\t\t\tonDrop: useCallback((event) => {\n\t\t\t\tif (!hasFiles(event)) return;\n\t\t\t\tevent.preventDefault();\n\t\t\t\tdepthRef.current = 0;\n\t\t\t\tsetIsDragOver(false);\n\t\t\t\tconst accepted = filterByExtension(event.dataTransfer.files, accept);\n\t\t\t\tif (accepted.length === 0) return;\n\t\t\t\tonFiles(accepted);\n\t\t\t}, [accept, onFiles]),\n\t\t\t[EDITOR_FILE_DROP_OPT_OUT_ATTR]: \"\"\n\t\t},\n\t\tisDragOver\n\t};\n}\n//#endregion\n//#region src/utils/drives.ts\nconst syncStatusToUI = {\n\t[SyncStatus.Synced]: \"SUCCESS\",\n\t[SyncStatus.Outgoing]: \"SYNCING\",\n\t[SyncStatus.Incoming]: \"SYNCING\",\n\t[SyncStatus.OutgoingAndIncoming]: \"SYNCING\",\n\t[SyncStatus.Error]: \"ERROR\"\n};\nasync function getDrives(reactor) {\n\treturn (await reactor.find({ type: \"powerhouse/document-drive\" })).results;\n}\nfunction getSyncStatus(documentId, sharingType) {\n\treturn Promise.resolve(getSyncStatusSync(documentId, sharingType));\n}\nfunction getSyncStatusSync(documentId, sharingType) {\n\tif (sharingType === \"LOCAL\") return;\n\tconst syncManager = window.ph?.reactorClientModule?.reactorModule?.syncModule?.syncManager;\n\tif (!syncManager) return;\n\tconst status = syncManager.getSyncStatus(documentId);\n\tif (status === void 0) return;\n\treturn syncStatusToUI[status];\n}\n//#endregion\n//#region src/utils/get-revision-from-date.ts\nconst getRevisionFromDate = (startDate, endDate, operations = []) => {\n\tif (!startDate || !endDate) return 0;\n\tconst operation = operations.find((operation) => {\n\t\tconst operationDate = new Date(operation.timestampUtcMs);\n\t\treturn operationDate >= startDate && operationDate <= endDate;\n\t});\n\treturn operation ? operation.index : 0;\n};\n//#endregion\n//#region src/utils/switchboard.ts\nasync function getDriveIdBySlug(driveUrl, slug) {\n\tif (!driveUrl) return;\n\tconst urlParts = driveUrl.split(\"/\");\n\turlParts.pop();\n\turlParts.pop();\n\turlParts.push(\"drives\");\n\tconst drivesUrl = urlParts.join(\"/\");\n\treturn (await (await fetch(drivesUrl, {\n\t\tmethod: \"POST\",\n\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\tbody: JSON.stringify({\n\t\t\tquery: `\n query getDriveIdBySlug($slug: String!) {\n driveIdBySlug(slug: $slug)\n }\n `,\n\t\t\tvariables: { slug }\n\t\t})\n\t})).json()).data.driveIdBySlug;\n}\nfunction getSlugFromDriveUrl(driveUrl) {\n\treturn driveUrl.split(\"/\").pop();\n}\nfunction getSwitchboardGatewayUrlFromDriveUrl(driveUrl) {\n\tconst urlParts = driveUrl.split(\"/\");\n\turlParts.pop();\n\turlParts.pop();\n\turlParts.push(\"graphql\");\n\treturn urlParts.join(\"/\");\n}\nfunction getDocumentGraphqlQuery() {\n\tconst loc = GetDocumentWithOperationsDocument.loc;\n\tif (!loc) throw new Error(\"GetDocumentWithOperationsDocument is misconfigured, loc is missing.\");\n\treturn loc.source.body;\n}\nfunction buildDocumentSubgraphQuery(identifier, authToken) {\n\tconst query = getDocumentGraphqlQuery();\n\tconst variables = { identifier };\n\tconst headers = authToken ? { Authorization: `Bearer ${authToken}` } : void 0;\n\tconst payload = {\n\t\tdocument: query.trim(),\n\t\tvariables: JSON.stringify(variables, null, 2)\n\t};\n\tif (headers) payload.headers = JSON.stringify(headers);\n\treturn lzString.compressToEncodedURIComponent(JSON.stringify(payload));\n}\nfunction buildDocumentSubgraphUrl(driveUrl, identifier, authToken) {\n\treturn `${driveUrl}?explorerURLState=${buildDocumentSubgraphQuery(identifier, authToken)}`;\n}\n//#endregion\n//#region src/hooks/use-get-switchboard-link.ts\n/**\n* Hook that returns a function to generate a document's switchboard URL.\n* Only returns a function for documents in remote drives.\n* Returns null for local drives or when the document/drive cannot be determined.\n*\n* The returned function generates a fresh bearer token and builds the switchboard URL\n* with authentication when called.\n*\n* @param document - The document to create a switchboard URL generator for\n* @returns An async function that returns the switchboard URL, or null if not applicable\n*/\nfunction useGetSwitchboardLink(document) {\n\tconst [drive] = useSelectedDriveSafe();\n\tconst remotes = useSyncList();\n\tconst isRemoteDrive = useMemo(() => {\n\t\tif (!isDefined(drive)) return false;\n\t\treturn remotes.some((remote) => remote.collectionId === driveCollectionId$1(\"main\", drive.header.id));\n\t}, [remotes, drive]);\n\tconst remoteUrl = useMemo(() => {\n\t\tif (!isDefined(drive)) return null;\n\t\ttry {\n\t\t\tconst channelUrl = (remotes.find((remote) => remote.collectionId === driveCollectionId$1(\"main\", drive.header.id))?.channel)?.config.url;\n\t\t\tif (typeof channelUrl === \"string\") return channelUrl;\n\t\t\treturn null;\n\t\t} catch (error) {\n\t\t\tconsole.error(\"Error determining remote URL:\", error);\n\t\t\treturn null;\n\t\t}\n\t}, [remotes, drive]);\n\tconst renown = useRenown();\n\tconst user = useUser();\n\treturn useMemo(() => {\n\t\tif (!isRemoteDrive || !document?.header.id || !remoteUrl) return null;\n\t\treturn async () => {\n\t\t\tconst token = user?.address ? await renown?.getBearerToken({\n\t\t\t\texpiresIn: 600,\n\t\t\t\taud: remoteUrl\n\t\t\t}) : void 0;\n\t\t\treturn buildDocumentSubgraphUrl(remoteUrl, document.header.id, token);\n\t\t};\n\t}, [\n\t\tisRemoteDrive,\n\t\tremoteUrl,\n\t\tdocument,\n\t\tuser,\n\t\trenown\n\t]);\n}\n//#endregion\n//#region src/hooks/use-on-drop-file.ts\nconst useOnDropFile = (documentTypesOverride) => {\n\tconst selectedDriveId = useSelectedDriveId();\n\tconst selectedFolder = useSelectedFolder();\n\tconst documentTypes = useDocumentTypes();\n\tconst onDropFile = async (file, onProgress, resolveConflict) => {\n\t\tif (!selectedDriveId) {\n\t\t\tconsole.warn(\"No selected drive - upload skipped\");\n\t\t\treturn;\n\t\t}\n\t\tconst fileName = file.name.replace(/\\..+/gim, \"\");\n\t\tconst targetNodeId = selectedFolder?.id;\n\t\treturn await addFileWithProgress(file, selectedDriveId, fileName, targetNodeId, onProgress, documentTypesOverride ?? documentTypes, resolveConflict);\n\t};\n\treturn onDropFile;\n};\n//#endregion\n//#region src/hooks/user-permissions.ts\nfunction useUserPermissions() {\n\tconst user = useUser();\n\tconst allowList = useAllowList();\n\tif (!allowList) return {\n\t\tisAllowedToCreateDocuments: true,\n\t\tisAllowedToEditDocuments: true\n\t};\n\treturn {\n\t\tisAllowedToCreateDocuments: allowList.includes(user?.address ?? \"\"),\n\t\tisAllowedToEditDocuments: allowList.includes(user?.address ?? \"\")\n\t};\n}\n//#endregion\n//#region src/hooks/use-attachments.ts\n/** Returns an IAttachmentClient wrapping the current IAttachmentService, or undefined if none is set. */\nfunction useAttachments() {\n\tconst service = useAttachmentService();\n\treturn useMemo(() => service ? createAttachmentClient(service) : void 0, [service]);\n}\n/** Upload lifecycle status. progress is coarse (0 before/during, 1 on Done) because RemoteAttachmentUpload buffers the full body before issuing a single PUT. */\nlet UploadStatus = /* @__PURE__ */ function(UploadStatus) {\n\tUploadStatus[\"None\"] = \"None\";\n\tUploadStatus[\"Hashing\"] = \"Hashing\";\n\tUploadStatus[\"Uploading\"] = \"Uploading\";\n\tUploadStatus[\"Done\"] = \"Done\";\n\tUploadStatus[\"Error\"] = \"Error\";\n\treturn UploadStatus;\n}({});\n/** Hook for managing the full attachment preprocess + upload lifecycle. preprocess and upload callbacks are stable (useCallback) and depend only on the current IAttachmentClient reference. */\nfunction useAttachmentUpload() {\n\tconst [status, setStatus] = useState(UploadStatus.None);\n\tconst [progress, setProgress] = useState(0);\n\tconst [error, setError] = useState(void 0);\n\tconst client = useAttachments();\n\treturn {\n\t\tpreprocess: useCallback(async (file) => {\n\t\t\tif (!client) throw new Error(\"AttachmentClient not available\");\n\t\t\tsetError(void 0);\n\t\t\tsetStatus(UploadStatus.Hashing);\n\t\t\ttry {\n\t\t\t\treturn await client.preprocess(file);\n\t\t\t} catch (err) {\n\t\t\t\tsetError(err instanceof Error ? err : new Error(String(err)));\n\t\t\t\tsetStatus(UploadStatus.Error);\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t}, [client]),\n\t\tupload: useCallback(async (results) => {\n\t\t\tif (!client) throw new Error(\"AttachmentClient not available\");\n\t\t\tsetError(void 0);\n\t\t\tsetStatus(UploadStatus.Uploading);\n\t\t\tsetProgress(0);\n\t\t\ttry {\n\t\t\t\tawait client.reserve(results.options, (handle) => handle.send(results.stream()));\n\t\t\t} catch (err) {\n\t\t\t\tsetError(err instanceof Error ? err : new Error(String(err)));\n\t\t\t\tsetStatus(UploadStatus.Error);\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tsetProgress(1);\n\t\t\tsetStatus(UploadStatus.Done);\n\t\t}, [client]),\n\t\tstatus,\n\t\tprogress,\n\t\terror\n\t};\n}\n//#endregion\n//#region src/pglite/drop.ts\nasync function dropTablesInSchema(pg, schema) {\n\tawait pg.exec(`\nDO $$\nDECLARE\n _schemaname text := '${schema}';\n _tablename text;\nBEGIN\n FOR _tablename IN SELECT tablename FROM pg_catalog.pg_tables WHERE schemaname = _schemaname LOOP\n RAISE INFO 'Dropping table %.%', _schemaname, _tablename;\n EXECUTE format('DROP TABLE %I.%I CASCADE;', _schemaname, _tablename);\n END LOOP;\n IF NOT FOUND THEN\n RAISE WARNING 'Schema % does not exist', _schemaname;\n END IF;\nEND $$;\n`);\n}\nasync function truncateAllTables(pg, schema = REACTOR_SCHEMA$1) {\n\tawait dropTablesInSchema(pg, schema);\n}\nasync function dropAllReactorStorage(pg) {\n\tawait dropTablesInSchema(pg, REACTOR_SCHEMA$1);\n\tawait dropTablesInSchema(pg, \"public\");\n}\n//#endregion\n//#region src/reactor.ts\nconst DEFAULT_DEBOUNCE_DELAY_MS = 200;\nconst DEFAULT_IMMEDIATE_THRESHOLD_MS = 1e3;\nasync function _refreshReactorData(reactor) {\n\tsetDrives(await getDrives(reactor));\n}\nasync function _refreshReactorDataClient(reactor) {\n\tif (!reactor) return;\n\tsetDrives((await reactor.find({ type: \"powerhouse/document-drive\" })).results);\n}\nfunction createDebouncedRefreshReactorData(debounceDelayMs = DEFAULT_DEBOUNCE_DELAY_MS, immediateThresholdMs = DEFAULT_IMMEDIATE_THRESHOLD_MS) {\n\tlet timeout = null;\n\tlet lastRefreshTime = 0;\n\treturn (reactor, immediate = false) => {\n\t\tconst now = Date.now();\n\t\tconst timeSinceLastRefresh = now - lastRefreshTime;\n\t\tif (timeout !== null) clearTimeout(timeout);\n\t\tif (immediate || timeSinceLastRefresh >= immediateThresholdMs) {\n\t\t\tlastRefreshTime = now;\n\t\t\treturn _refreshReactorData(reactor);\n\t\t}\n\t\treturn new Promise((resolve) => {\n\t\t\ttimeout = setTimeout(() => {\n\t\t\t\tlastRefreshTime = Date.now();\n\t\t\t\t_refreshReactorData(reactor).then(resolve);\n\t\t\t}, debounceDelayMs);\n\t\t});\n\t};\n}\nfunction createDebouncedRefreshReactorDataClient(debounceDelayMs = DEFAULT_DEBOUNCE_DELAY_MS, immediateThresholdMs = DEFAULT_IMMEDIATE_THRESHOLD_MS) {\n\tlet timeout = null;\n\tlet lastRefreshTime = 0;\n\treturn (reactor, immediate = false) => {\n\t\tconst now = Date.now();\n\t\tconst timeSinceLastRefresh = now - lastRefreshTime;\n\t\tif (timeout !== null) clearTimeout(timeout);\n\t\tif (immediate || timeSinceLastRefresh >= immediateThresholdMs) {\n\t\t\tlastRefreshTime = now;\n\t\t\treturn _refreshReactorDataClient(reactor);\n\t\t}\n\t\treturn new Promise((resolve) => {\n\t\t\ttimeout = setTimeout(() => {\n\t\t\t\tlastRefreshTime = Date.now();\n\t\t\t\t_refreshReactorDataClient(reactor).then(resolve);\n\t\t\t}, debounceDelayMs);\n\t\t});\n\t};\n}\nconst refreshReactorData = createDebouncedRefreshReactorData();\nconst refreshReactorDataClient = createDebouncedRefreshReactorDataClient();\n//#endregion\n//#region src/registry/fetchers.ts\nfunction trimTrailingSlash(url) {\n\treturn url.endsWith(\"/\") ? url.slice(0, -1) : url;\n}\nasync function getPackages(registryUrl) {\n\tconst res = await fetch(`${trimTrailingSlash(registryUrl)}/packages`);\n\tif (!res.ok) throw new Error(`Registry error: HTTP ${res.status}`);\n\treturn await res.json();\n}\nasync function getPackagesByDocumentType(registryUrl, documentType) {\n\tconst encodedType = encodeURIComponent(documentType);\n\tconst res = await fetch(`${trimTrailingSlash(registryUrl)}/packages/by-document-type?type=${encodedType}`);\n\tif (!res.ok) throw new Error(`Registry error: HTTP ${res.status}`);\n\treturn await res.json();\n}\n//#endregion\n//#region src/registry/client.ts\nfunction cdnUrlToApiUrl(cdnUrl) {\n\treturn cdnUrl.replace(/\\/-\\/cdn\\/?$/, \"\");\n}\nvar RegistryClient = class {\n\tapiUrl;\n\tconstructor(cdnUrl) {\n\t\tthis.apiUrl = cdnUrlToApiUrl(cdnUrl);\n\t}\n\tasync getPackages() {\n\t\treturn await getPackages(this.apiUrl);\n\t}\n\tasync getPackagesByDocumentType(documentType) {\n\t\treturn await getPackagesByDocumentType(this.apiUrl, documentType);\n\t}\n\tasync searchPackages(query) {\n\t\tconst packages = await this.getPackages();\n\t\tif (!query) return packages;\n\t\tconst lowerQuery = query.toLowerCase();\n\t\treturn packages.filter((pkg) => pkg.name.toLowerCase().includes(lowerQuery) || pkg.manifest?.description?.toLowerCase().includes(lowerQuery));\n\t}\n\tonPublish(callback) {\n\t\tconst eventSource = new EventSource(`${this.apiUrl}/-/events`);\n\t\teventSource.addEventListener(\"publish\", (e) => {\n\t\t\tcallback(JSON.parse(e.data));\n\t\t});\n\t\treturn () => {\n\t\t\teventSource.close();\n\t\t};\n\t}\n};\n//#endregion\n//#region src/remote-controller/action-tracker.ts\n/**\n* Tracks pending actions with their operation context (prevOpHash, prevOpIndex).\n* Actions are accumulated until flushed (on push).\n*/\nvar ActionTracker = class {\n\tpending = [];\n\t/** Track a new action with its operation context. */\n\ttrack(action, prevOpHash, prevOpIndex) {\n\t\tthis.pending.push({\n\t\t\taction,\n\t\t\tprevOpHash,\n\t\t\tprevOpIndex\n\t\t});\n\t}\n\t/** Flush all pending actions and return them. Clears the internal queue. */\n\tflush() {\n\t\tconst actions = this.pending;\n\t\tthis.pending = [];\n\t\treturn actions;\n\t}\n\t/** Number of pending actions. */\n\tget count() {\n\t\treturn this.pending.length;\n\t}\n\t/** Prepend previously flushed actions back to the queue (for retry on failure). */\n\trestore(actions) {\n\t\tthis.pending = [...actions, ...this.pending];\n\t}\n\t/** Clear all pending actions without returning them. */\n\tclear() {\n\t\tthis.pending = [];\n\t}\n};\n//#endregion\n//#region src/remote-controller/remote-client.ts\n/**\n* Thin facade over the GraphQL SDK for remote document operations.\n*/\nconst DEFAULT_PAGE_SIZE = 100;\nvar RemoteClient = class {\n\tpageSize;\n\tconstructor(client, pageSize) {\n\t\tthis.client = client;\n\t\tthis.pageSize = pageSize ?? DEFAULT_PAGE_SIZE;\n\t}\n\t/** Fetch a document by identifier. Returns null if not found. */\n\tasync getDocument(identifier, branch) {\n\t\treturn (await this.client.GetDocument({\n\t\t\tidentifier,\n\t\t\tview: branch ? { branch } : void 0\n\t\t})).document ?? null;\n\t}\n\t/**\n\t* Fetch a document and its operations.\n\t*\n\t* When scopes are provided and BatchGetDocumentWithOperations is available,\n\t* fetches the document and per-scope operations in a single HTTP request.\n\t* Otherwise falls back to GetDocumentWithOperations for the first page,\n\t* then paginates remaining operations per scope.\n\t*/\n\tasync getDocumentWithOperations(identifier, branch, sinceRevision, scopes) {\n\t\tif (this.client.BatchGetDocumentWithOperations && scopes && scopes.length > 0) return this.batchGetDocumentWithOperations(identifier, branch, sinceRevision, scopes);\n\t\tconst result = await this.client.GetDocumentWithOperations({\n\t\t\tidentifier,\n\t\t\tview: branch ? { branch } : void 0,\n\t\t\toperationsPaging: {\n\t\t\t\tlimit: this.pageSize,\n\t\t\t\tcursor: null\n\t\t\t}\n\t\t});\n\t\tif (!result.document) return null;\n\t\tconst doc = result.document.document;\n\t\tconst opsPage = doc.operations;\n\t\tconst operationsByScope = {};\n\t\tif (opsPage) for (const op of opsPage.items) (operationsByScope[op.action.scope] ??= []).push(op);\n\t\tconst expectedTotal = doc.revisionsList.reduce((sum, r) => sum + r.revision, 0);\n\t\tif ((opsPage?.items.length ?? 0) >= expectedTotal) return {\n\t\t\tdocument: doc,\n\t\t\tchildIds: result.document.childIds,\n\t\t\toperations: { operationsByScope }\n\t\t};\n\t\tconst allScopes = doc.revisionsList.map((r) => r.scope);\n\t\tconst allOps = await this.getAllOperations(doc.id, branch, sinceRevision, allScopes);\n\t\treturn {\n\t\t\tdocument: doc,\n\t\t\tchildIds: result.document.childIds,\n\t\t\toperations: allOps\n\t\t};\n\t}\n\t/**\n\t* Fetch document + per-scope operations in a single HTTP request\n\t* via BatchGetDocumentWithOperations, then paginate any remaining pages.\n\t*/\n\tasync batchGetDocumentWithOperations(identifier, branch, sinceRevision, scopes) {\n\t\tconst view = branch ? { branch } : void 0;\n\t\tconst filters = scopes.map((scope) => ({\n\t\t\tdocumentId: identifier,\n\t\t\tbranch: branch ?? null,\n\t\t\tsinceRevision: sinceRevision?.[scope] ?? 0,\n\t\t\tscopes: [scope]\n\t\t}));\n\t\tconst pagings = scopes.map(() => ({\n\t\t\tlimit: this.pageSize,\n\t\t\tcursor: null\n\t\t}));\n\t\tconst result = await this.client.BatchGetDocumentWithOperations(identifier, view, filters, pagings);\n\t\tif (!result.document) return null;\n\t\tconst operationsByScope = {};\n\t\tlet pending = [];\n\t\tfor (let i = 0; i < scopes.length; i++) {\n\t\t\tconst page = result.operations[i];\n\t\t\tfor (const op of page.items) (operationsByScope[op.action.scope] ??= []).push(op);\n\t\t\tif (page.hasNextPage && page.cursor) pending.push({\n\t\t\t\tscope: scopes[i],\n\t\t\t\tfilter: filters[i],\n\t\t\t\tcursor: page.cursor\n\t\t\t});\n\t\t}\n\t\twhile (pending.length > 0) {\n\t\t\tconst pages = await this.fetchOperationPages(pending.map((p) => p.filter), pending.map((p) => ({\n\t\t\t\tlimit: this.pageSize,\n\t\t\t\tcursor: p.cursor\n\t\t\t})));\n\t\t\tconst nextPending = [];\n\t\t\tfor (let i = 0; i < pending.length; i++) {\n\t\t\t\tconst page = pages[i];\n\t\t\t\tfor (const op of page.items) (operationsByScope[op.action.scope] ??= []).push(op);\n\t\t\t\tif (page.hasNextPage && page.cursor) nextPending.push({\n\t\t\t\t\t...pending[i],\n\t\t\t\t\tcursor: page.cursor\n\t\t\t\t});\n\t\t\t}\n\t\t\tpending = nextPending;\n\t\t}\n\t\treturn {\n\t\t\tdocument: result.document.document,\n\t\t\tchildIds: result.document.childIds,\n\t\t\toperations: { operationsByScope }\n\t\t};\n\t}\n\t/**\n\t* Fetch all operations for a document, paginating through all pages.\n\t* Each scope is queried individually because the API only returns\n\t* pagination cursors for single-scope queries.\n\t*/\n\tasync getAllOperations(documentId, branch, sinceRevision, scopes) {\n\t\tif (scopes && scopes.length > 0) {\n\t\t\tconst operationsByScope = {};\n\t\t\tlet pending = scopes.map((scope) => ({\n\t\t\t\tscope,\n\t\t\t\tfilter: {\n\t\t\t\t\tdocumentId,\n\t\t\t\t\tbranch: branch ?? null,\n\t\t\t\t\tsinceRevision: sinceRevision?.[scope] ?? 0,\n\t\t\t\t\tscopes: [scope]\n\t\t\t\t},\n\t\t\t\tcursor: null\n\t\t\t}));\n\t\t\twhile (pending.length > 0) {\n\t\t\t\tconst pages = await this.fetchOperationPages(pending.map((p) => p.filter), pending.map((p) => ({\n\t\t\t\t\tlimit: this.pageSize,\n\t\t\t\t\tcursor: p.cursor\n\t\t\t\t})));\n\t\t\t\tconst nextPending = [];\n\t\t\t\tfor (let i = 0; i < pending.length; i++) {\n\t\t\t\t\tconst page = pages[i];\n\t\t\t\t\tfor (const op of page.items) (operationsByScope[op.action.scope] ??= []).push(op);\n\t\t\t\t\tif (page.hasNextPage && page.cursor) nextPending.push({\n\t\t\t\t\t\t...pending[i],\n\t\t\t\t\t\tcursor: page.cursor\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tpending = nextPending;\n\t\t\t}\n\t\t\treturn { operationsByScope };\n\t\t}\n\t\treturn this.fetchOperationsForScope(documentId, branch);\n\t}\n\t/**\n\t* Fetch one page of operations per filter.\n\t* Uses the composed query (single HTTP request) when available,\n\t* otherwise falls back to parallel individual requests.\n\t*/\n\tasync fetchOperationPages(filters, pagings) {\n\t\tif (this.client.BatchGetDocumentOperations) return this.client.BatchGetDocumentOperations(filters, pagings);\n\t\treturn Promise.all(filters.map((filter, i) => this.client.GetDocumentOperations({\n\t\t\tfilter,\n\t\t\tpaging: pagings[i]\n\t\t}).then((r) => r.documentOperations)));\n\t}\n\t/** Fetch all pages of operations for a single scope (or all scopes if none specified). */\n\tasync fetchOperationsForScope(documentId, branch, sinceRevision, scope) {\n\t\tconst operationsByScope = {};\n\t\tlet cursor;\n\t\tlet hasNextPage = true;\n\t\twhile (hasNextPage) {\n\t\t\tconst page = (await this.client.GetDocumentOperations({\n\t\t\t\tfilter: {\n\t\t\t\t\tdocumentId,\n\t\t\t\t\tbranch: branch ?? null,\n\t\t\t\t\tsinceRevision: sinceRevision ?? 0,\n\t\t\t\t\tscopes: scope ? [scope] : null\n\t\t\t\t},\n\t\t\t\tpaging: {\n\t\t\t\t\tlimit: this.pageSize,\n\t\t\t\t\tcursor: cursor ?? null\n\t\t\t\t}\n\t\t\t})).documentOperations;\n\t\t\tfor (const op of page.items) {\n\t\t\t\tconst s = op.action.scope;\n\t\t\t\t(operationsByScope[s] ??= []).push(op);\n\t\t\t}\n\t\t\thasNextPage = page.hasNextPage;\n\t\t\tcursor = page.cursor;\n\t\t}\n\t\treturn { operationsByScope };\n\t}\n\t/** Push actions to an existing document via MutateDocument. */\n\tasync pushActions(documentIdentifier, actions, branch) {\n\t\treturn (await this.client.MutateDocument({\n\t\t\tdocumentIdentifier,\n\t\t\tactions,\n\t\t\tview: branch ? { branch } : void 0\n\t\t})).mutateDocument;\n\t}\n\t/** Create a new document on the remote. */\n\tasync createDocument(document, parentIdentifier) {\n\t\treturn (await this.client.CreateDocument({\n\t\t\tdocument,\n\t\t\tparentIdentifier: parentIdentifier ?? null\n\t\t})).createDocument;\n\t}\n\t/** Create an empty document of a given type on the remote. */\n\tasync createEmptyDocument(documentType, parentIdentifier) {\n\t\treturn (await this.client.CreateEmptyDocument({\n\t\t\tdocumentType,\n\t\t\tparentIdentifier: parentIdentifier ?? null\n\t\t})).createEmptyDocument;\n\t}\n\t/** Delete a document on the remote. Returns true if successful. */\n\tasync deleteDocument(identifier, propagate) {\n\t\treturn (await this.client.DeleteDocument({\n\t\t\tidentifier,\n\t\t\tpropagate\n\t\t})).deleteDocument;\n\t}\n};\n//#endregion\n//#region src/remote-controller/utils.ts\n/** Convert SCREAMING_SNAKE_CASE to camelCase (e.g. \"SET_MODEL_NAME\" → \"setModelName\"). */\nfunction screamingSnakeToCamel(s) {\n\treturn s.toLowerCase().replace(/_([a-z])/g, (_, c) => c.toUpperCase());\n}\n/** Error thrown when a push conflict is detected with the \"reject\" strategy. */\nvar ConflictError = class extends Error {\n\tconstructor(conflict) {\n\t\tsuper(\"Push conflict: remote has new operations since last pull\");\n\t\tthis.conflict = conflict;\n\t\tthis.name = \"ConflictError\";\n\t}\n};\n/** Convert a remote operation to the local Operation type. */\nfunction remoteOperationToLocal(remote) {\n\treturn {\n\t\tid: remote.id ?? \"\",\n\t\tindex: remote.index,\n\t\tskip: remote.skip,\n\t\ttimestampUtcMs: remote.timestampUtcMs,\n\t\thash: remote.hash,\n\t\terror: remote.error ?? void 0,\n\t\taction: {\n\t\t\tid: remote.action.id,\n\t\t\ttype: remote.action.type,\n\t\t\ttimestampUtcMs: remote.action.timestampUtcMs,\n\t\t\tinput: remote.action.input,\n\t\t\tscope: remote.action.scope,\n\t\t\tcontext: remote.action.context?.signer ? { signer: {\n\t\t\t\tuser: remote.action.context.signer.user ?? {\n\t\t\t\t\taddress: \"\",\n\t\t\t\t\tnetworkId: \"\",\n\t\t\t\t\tchainId: 0\n\t\t\t\t},\n\t\t\t\tapp: remote.action.context.signer.app ?? {\n\t\t\t\t\tname: \"\",\n\t\t\t\t\tkey: \"\"\n\t\t\t\t},\n\t\t\t\tsignatures: remote.action.context.signer.signatures.map((s) => deserializeSignature(s))\n\t\t\t} } : void 0\n\t\t}\n\t};\n}\n/**\n* Deserialize a signature string back to a 5-element tuple.\n* The server serializes tuples via `tuple.join(\", \")`.\n*/\nfunction deserializeSignature(s) {\n\tconst parts = s.split(\", \");\n\treturn [\n\t\tparts[0] ?? \"\",\n\t\tparts[1] ?? \"\",\n\t\tparts[2] ?? \"\",\n\t\tparts[3] ?? \"\",\n\t\tparts[4] ?? \"\"\n\t];\n}\n/** Convert remote operations to local DocumentOperations format. */\nfunction convertRemoteOperations(operationsByScope) {\n\tconst operations = {};\n\tfor (const [scope, remoteOps] of Object.entries(operationsByScope)) operations[scope] = remoteOps.map((op) => remoteOperationToLocal(op));\n\treturn operations;\n}\n/** Reconstruct a PHDocument from remote document data and operations. */\nfunction buildPulledDocument(remoteDoc, operations, initialDoc, branch) {\n\treturn {\n\t\theader: {\n\t\t\t...initialDoc.header,\n\t\t\tid: remoteDoc.id,\n\t\t\tname: remoteDoc.name,\n\t\t\tslug: remoteDoc.slug ?? \"\",\n\t\t\tdocumentType: remoteDoc.documentType,\n\t\t\tcreatedAtUtcIso: typeof remoteDoc.createdAtUtcIso === \"string\" ? remoteDoc.createdAtUtcIso : remoteDoc.createdAtUtcIso.toISOString(),\n\t\t\tlastModifiedAtUtcIso: typeof remoteDoc.lastModifiedAtUtcIso === \"string\" ? remoteDoc.lastModifiedAtUtcIso : remoteDoc.lastModifiedAtUtcIso.toISOString(),\n\t\t\trevision: Object.fromEntries(remoteDoc.revisionsList.map((r) => [r.scope, r.revision])),\n\t\t\tbranch\n\t\t},\n\t\tstate: remoteDoc.state,\n\t\tinitialState: initialDoc.initialState,\n\t\toperations,\n\t\tclipboard: []\n\t};\n}\n/** Extract revision map from a remote document's revisionsList. */\nfunction extractRevisionMap(revisionsList) {\n\treturn Object.fromEntries(revisionsList.map((r) => [r.scope, r.revision]));\n}\n/**\n* Check if any scope in currentRevision is ahead of knownRevision.\n* When `scopes` is provided, only those scopes are checked.\n*/\nfunction hasRevisionConflict(currentRevision, knownRevision, scopes) {\n\tfor (const scope in currentRevision) {\n\t\tif (scopes && !scopes.has(scope)) continue;\n\t\tif ((currentRevision[scope] ?? 0) > (knownRevision[scope] ?? 0)) return true;\n\t}\n\treturn false;\n}\n//#endregion\n//#region src/remote-controller/remote-controller.ts\n/**\n* A controller that wraps a PHDocumentController with remote push/pull capabilities.\n* Composes a local controller and adds GraphQL-based sync with a reactor server.\n*/\nvar RemoteDocumentController = class RemoteDocumentController {\n\tinner;\n\tremoteClient;\n\ttracker = new ActionTracker();\n\toptions;\n\tdocumentId;\n\tremoteRevision = {};\n\thasPulled = false;\n\tpushScheduled = false;\n\tpushQueue = Promise.resolve();\n\tlisteners = [];\n\tconstructor(inner, options) {\n\t\tthis.inner = inner;\n\t\tthis.options = options;\n\t\tthis.documentId = options.documentId ?? \"\";\n\t\tthis.remoteClient = new RemoteClient(options.client, options.operationsPageSize);\n\t\tthis.setupActionInterceptors();\n\t}\n\tget header() {\n\t\treturn this.inner.header;\n\t}\n\tget state() {\n\t\treturn this.inner.state;\n\t}\n\tget operations() {\n\t\treturn this.inner.operations;\n\t}\n\tget document() {\n\t\treturn this.inner.document;\n\t}\n\tget status() {\n\t\treturn {\n\t\t\tpendingActionCount: this.tracker.count,\n\t\t\tconnected: this.documentId !== \"\",\n\t\t\tdocumentId: this.documentId,\n\t\t\tremoteRevision: { ...this.remoteRevision }\n\t\t};\n\t}\n\t/** Register a listener for document changes. Returns an unsubscribe function. */\n\tonChange(listener) {\n\t\tthis.listeners.push(listener);\n\t\treturn () => {\n\t\t\tthis.listeners = this.listeners.filter((l) => l !== listener);\n\t\t};\n\t}\n\tnotifyListeners(source) {\n\t\tif (this.listeners.length === 0) return;\n\t\tconst event = {\n\t\t\tsource,\n\t\t\tdocument: this.document\n\t\t};\n\t\tfor (const listener of this.listeners) listener(event);\n\t}\n\t/** Push all pending actions to remote, then pull latest state. */\n\tasync push() {\n\t\tlet tracked = this.tracker.flush();\n\t\tif (tracked.length === 0 && this.documentId !== \"\") return {\n\t\t\tremoteDocument: await this.pull(),\n\t\t\tactionCount: 0,\n\t\t\toperations: []\n\t\t};\n\t\ttry {\n\t\t\tawait this.ensureRemoteDocument();\n\t\t\tif (this.options.onConflict && tracked.length > 0) tracked = await this.handleConflicts(tracked, this.options.onConflict);\n\t\t} catch (error) {\n\t\t\tthis.tracker.restore(tracked);\n\t\t\tthrow error;\n\t\t}\n\t\tlet pushedActions = [];\n\t\ttry {\n\t\t\tif (tracked.length > 0) {\n\t\t\t\tconst actions = await this.prepareActionsForPush(tracked);\n\t\t\t\tpushedActions = actions;\n\t\t\t\tawait this.remoteClient.pushActions(this.documentId, actions, this.options.branch);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthis.tracker.restore(tracked);\n\t\t\tthrow error;\n\t\t}\n\t\treturn {\n\t\t\tremoteDocument: await this.pull(),\n\t\t\tactionCount: tracked.length,\n\t\t\toperations: pushedActions\n\t\t};\n\t}\n\t/** Delete the document on the remote. */\n\tasync delete(propagate) {\n\t\tif (this.documentId === \"\") throw new Error(\"Cannot delete: no document ID set\");\n\t\treturn await this.remoteClient.deleteDocument(this.documentId, propagate);\n\t}\n\t/** Pull latest state from remote, replacing local document. Returns the remote document data. */\n\tasync pull() {\n\t\tif (this.documentId === \"\") throw new Error(\"Cannot pull: no document ID set\");\n\t\tconst { remoteDoc, operations } = await this.fetchDocumentAndOperations();\n\t\tconst pulledDocument = buildPulledDocument(remoteDoc, operations, this.inner.module.utils.createDocument(), this.options.branch ?? \"main\");\n\t\tconst ControllerClass = this.inner.constructor;\n\t\tthis.inner = new ControllerClass(pulledDocument);\n\t\tthis.setupActionInterceptors();\n\t\tthis.tracker.clear();\n\t\tthis.remoteRevision = extractRevisionMap(remoteDoc.revisionsList);\n\t\tthis.notifyListeners(\"pull\");\n\t\treturn remoteDoc;\n\t}\n\t/**\n\t* Pull an existing document from remote and create a controller for it.\n\t*/\n\tstatic async pull(ControllerClass, options) {\n\t\tconst remote = new RemoteDocumentController(new ControllerClass(), options);\n\t\tif (options.documentId) await remote.pull();\n\t\treturn remote;\n\t}\n\t/**\n\t* Wrap an existing controller instance with remote capabilities.\n\t* Pending local actions on the inner controller are NOT tracked\n\t* (only new actions through the remote controller are tracked).\n\t*/\n\tstatic from(controller, options) {\n\t\treturn new RemoteDocumentController(controller, options);\n\t}\n\t/** Create the document on the remote if it doesn't exist yet. */\n\tasync ensureRemoteDocument() {\n\t\tif (this.documentId !== \"\") return;\n\t\tthis.documentId = (await this.remoteClient.createEmptyDocument(this.inner.header.documentType, this.options.parentIdentifier)).id;\n\t}\n\t/** Set up interceptors for all action methods on the inner controller. */\n\tsetupActionInterceptors() {\n\t\tconst module = this.inner[\"module\"];\n\t\tfor (const actionType in module.actions) {\n\t\t\tif (actionType in RemoteDocumentController.prototype) continue;\n\t\t\tObject.defineProperty(this, actionType, {\n\t\t\t\tvalue: (input) => {\n\t\t\t\t\tconst opCountsBefore = {};\n\t\t\t\t\tfor (const scope in this.inner.operations) opCountsBefore[scope] = this.inner.operations[scope].length;\n\t\t\t\t\tthis.inner[actionType](input);\n\t\t\t\t\tconst newOp = this.findNewOperation(opCountsBefore);\n\t\t\t\t\tconst prevOp = newOp ? this.getLastOperationInScope(newOp.action.scope, newOp) : void 0;\n\t\t\t\t\tconst prevOpHash = prevOp?.hash ?? \"\";\n\t\t\t\t\tconst prevOpIndex = prevOp?.index ?? -1;\n\t\t\t\t\tif (!newOp) return this;\n\t\t\t\t\tthis.tracker.track(newOp.action, prevOpHash, prevOpIndex);\n\t\t\t\t\tthis.notifyListeners(\"action\");\n\t\t\t\t\tif (this.options.mode === \"streaming\") this.schedulePush();\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true\n\t\t\t});\n\t\t}\n\t}\n\t/**\n\t* Find the new operation added after applying an action,\n\t* by comparing current operation counts against a previous snapshot.\n\t*/\n\tfindNewOperation(opCountsBefore) {\n\t\tconst ops = this.inner.operations;\n\t\tfor (const scope in ops) {\n\t\t\tconst scopeOps = ops[scope];\n\t\t\tconst prevCount = opCountsBefore[scope] ?? 0;\n\t\t\tif (scopeOps.length > prevCount) return scopeOps[scopeOps.length - 1];\n\t\t}\n\t}\n\t/**\n\t* Get the last operation in a specific scope, optionally excluding\n\t* a given operation (e.g. the one just added).\n\t*/\n\tgetLastOperationInScope(scope, excludeOp) {\n\t\tconst scopeOps = this.inner.operations[scope];\n\t\tif (scopeOps.length === 0) return void 0;\n\t\tfor (let i = scopeOps.length - 1; i >= 0; i--) if (scopeOps[i] !== excludeOp) return scopeOps[i];\n\t}\n\t/**\n\t* Detect and handle conflicts between local pending actions and remote state.\n\t* Returns the (possibly rebased) tracked actions to push.\n\t*/\n\tasync handleConflicts(localTracked, strategy) {\n\t\tconst remoteResult = await this.remoteClient.getDocument(this.documentId, this.options.branch);\n\t\tif (!remoteResult) throw new Error(`Document \"${this.documentId}\" not found on remote`);\n\t\tconst currentRevision = extractRevisionMap(remoteResult.document.revisionsList);\n\t\tconst localScopes = new Set(localTracked.map((t) => t.action.scope));\n\t\tif (!hasRevisionConflict(currentRevision, this.remoteRevision, localScopes)) return localTracked;\n\t\tconst conflictingScopes = [...localScopes].filter((scope) => (currentRevision[scope] ?? 0) > (this.remoteRevision[scope] ?? 0));\n\t\tconst { operationsByScope } = await this.remoteClient.getAllOperations(this.documentId, this.options.branch, this.remoteRevision, conflictingScopes);\n\t\tconst remoteOperations = {};\n\t\tfor (const [scope, ops] of Object.entries(operationsByScope)) remoteOperations[scope] = ops;\n\t\tconst conflictInfo = {\n\t\t\tremoteOperations,\n\t\t\tlocalActions: localTracked,\n\t\t\tknownRevision: { ...this.remoteRevision },\n\t\t\tcurrentRevision: { ...currentRevision }\n\t\t};\n\t\tif (strategy === \"reject\") throw new ConflictError(conflictInfo);\n\t\tif (strategy === \"rebase\") return this.pullAndReplay(localTracked.map((t) => t.action));\n\t\tconst mergedActions = await strategy(conflictInfo);\n\t\treturn this.pullAndReplay(mergedActions);\n\t}\n\t/**\n\t* Pull latest remote state and replay actions through interceptors.\n\t* Returns newly tracked actions with correct prevOpHash values.\n\t*/\n\tasync pullAndReplay(actions) {\n\t\tawait this.pull();\n\t\tfor (const action of actions) {\n\t\t\tconst methodName = screamingSnakeToCamel(action.type);\n\t\t\tconst method = this[methodName];\n\t\t\tif (typeof method === \"function\") method.call(this, action.input);\n\t\t}\n\t\treturn this.tracker.flush();\n\t}\n\t/** Prepare actions for push, optionally signing them. */\n\tasync prepareActionsForPush(tracked) {\n\t\tconst actions = [];\n\t\tfor (const { action, prevOpHash, prevOpIndex } of tracked) {\n\t\t\tlet prepared = {\n\t\t\t\t...action,\n\t\t\t\tcontext: {\n\t\t\t\t\t...action.context,\n\t\t\t\t\tprevOpHash,\n\t\t\t\t\tprevOpIndex\n\t\t\t\t}\n\t\t\t};\n\t\t\tif (this.options.signer) prepared = await this.signAction(prepared);\n\t\t\tactions.push(prepared);\n\t\t}\n\t\treturn actions;\n\t}\n\t/** Sign an action using the configured signer, preserving existing signatures. */\n\tasync signAction(action) {\n\t\tconst signer = this.options.signer;\n\t\tconst signature = await signer.signAction(action);\n\t\tconst existingSignatures = action.context?.signer?.signatures ?? [];\n\t\treturn {\n\t\t\t...action,\n\t\t\tcontext: {\n\t\t\t\t...action.context,\n\t\t\t\tsigner: {\n\t\t\t\t\tuser: signer.user,\n\t\t\t\t\tapp: signer.app,\n\t\t\t\t\tsignatures: [...existingSignatures, signature]\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n\t/**\n\t* Fetch document and operations from the remote.\n\t*\n\t* On the first pull, uses the combined document+operations query.\n\t* On subsequent pulls, fetches only new operations per scope using\n\t* sinceRevision, then merges with existing local operations.\n\t* Falls back to a full fetch if the merge produces a count mismatch.\n\t*/\n\tasync fetchDocumentAndOperations() {\n\t\tif (this.hasPulled) return this.incrementalFetch();\n\t\tconst result = await this.remoteClient.getDocumentWithOperations(this.documentId, this.options.branch);\n\t\tif (!result) throw new Error(`Document \"${this.documentId}\" not found on remote`);\n\t\tthis.hasPulled = true;\n\t\treturn {\n\t\t\tremoteDoc: result.document,\n\t\t\toperations: convertRemoteOperations(result.operations.operationsByScope)\n\t\t};\n\t}\n\t/**\n\t* Incremental fetch: fetches the document and only new operations per scope\n\t* using sinceRevision in a single request when possible.\n\t* Falls back to a full fetch on count mismatch.\n\t*/\n\tasync incrementalFetch() {\n\t\tconst scopes = Object.keys(this.remoteRevision);\n\t\tconst result = await this.remoteClient.getDocumentWithOperations(this.documentId, this.options.branch, this.remoteRevision, scopes.length > 0 ? scopes : void 0);\n\t\tif (!result) throw new Error(`Document \"${this.documentId}\" not found on remote`);\n\t\tconst remoteDoc = result.document;\n\t\tconst expectedRevision = extractRevisionMap(remoteDoc.revisionsList);\n\t\tconst newOps = convertRemoteOperations(result.operations.operationsByScope);\n\t\tconst merged = this.mergeOperations(this.inner.operations, newOps);\n\t\tif (this.hasExpectedOperationCounts(merged, expectedRevision)) return {\n\t\t\tremoteDoc,\n\t\t\toperations: merged\n\t\t};\n\t\treturn this.fullFetch(remoteDoc);\n\t}\n\t/**\n\t* Full fetch fallback: fetches all operations from the beginning.\n\t* Used when an incremental fetch produces a count mismatch.\n\t*/\n\tasync fullFetch(remoteDoc) {\n\t\tconst { operationsByScope } = await this.remoteClient.getAllOperations(this.documentId, this.options.branch);\n\t\treturn {\n\t\t\tremoteDoc,\n\t\t\toperations: convertRemoteOperations(operationsByScope)\n\t\t};\n\t}\n\t/**\n\t* Validate that the merged operations match the expected revision per scope.\n\t* Each scope's operation count should equal its revision number.\n\t*/\n\thasExpectedOperationCounts(operations, expectedRevision) {\n\t\tfor (const [scope, revision] of Object.entries(expectedRevision)) if ((scope in operations ? operations[scope].length : 0) !== revision) return false;\n\t\treturn true;\n\t}\n\t/**\n\t* Merge existing local operations with newly fetched operations.\n\t* Appends new operations to existing ones per scope.\n\t*/\n\tmergeOperations(existingOps, newOps) {\n\t\tconst merged = {};\n\t\tfor (const [scope, ops] of Object.entries(existingOps)) if (ops.length > 0) merged[scope] = [...ops];\n\t\tfor (const [scope, ops] of Object.entries(newOps)) if (ops.length > 0) (merged[scope] ??= []).push(...ops);\n\t\treturn merged;\n\t}\n\t/** Schedule a push via microtask (for streaming mode coalescing). */\n\tschedulePush() {\n\t\tif (this.pushScheduled) return;\n\t\tthis.pushScheduled = true;\n\t\tqueueMicrotask(() => {\n\t\t\tthis.pushScheduled = false;\n\t\t\tthis.pushQueue = this.pushQueue.then(async () => {\n\t\t\t\ttry {\n\t\t\t\t\tawait this.push();\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.options.onPushError?.(error);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n};\n//#endregion\n//#region src/storage/base-storage.ts\nvar BaseStorage = class {\n\t[Symbol.iterator]() {\n\t\treturn this.entries();\n\t}\n\tforEach(callback) {\n\t\tfor (const [key, value] of this) callback(value, key, this);\n\t}\n};\n//#endregion\n//#region src/storage/local-storage.ts\nvar BrowserLocalStorage = class extends BaseStorage {\n\t#namespace;\n\t#storage = window.localStorage;\n\tconstructor(namespace) {\n\t\tsuper();\n\t\tthis.#namespace = namespace;\n\t}\n\t#readMap() {\n\t\tconst raw = this.#storage.getItem(this.#namespace);\n\t\tif (!raw) return /* @__PURE__ */ new Map();\n\t\treturn new Map(JSON.parse(raw));\n\t}\n\t#writeMap(map) {\n\t\tthis.#storage.setItem(this.#namespace, JSON.stringify(Array.from(map.entries())));\n\t}\n\tget(key) {\n\t\treturn this.#readMap().get(key);\n\t}\n\tset(key, value) {\n\t\tconst map = this.#readMap();\n\t\tmap.set(key, value);\n\t\tthis.#writeMap(map);\n\t}\n\tdelete(key) {\n\t\tconst map = this.#readMap();\n\t\tconst deleted = map.delete(key);\n\t\tif (deleted) this.#writeMap(map);\n\t\treturn deleted;\n\t}\n\thas(key) {\n\t\treturn this.#readMap().has(key);\n\t}\n\tclear() {\n\t\tthis.#storage.removeItem(this.#namespace);\n\t}\n\tentries() {\n\t\treturn this.#readMap().entries();\n\t}\n\tkeys() {\n\t\treturn this.#readMap().keys();\n\t}\n\tvalues() {\n\t\treturn this.#readMap().values();\n\t}\n\t[Symbol.iterator]() {\n\t\treturn this.#readMap().entries();\n\t}\n};\n//#endregion\nexport { ActionTracker, BaseStorage, BrowserLocalStorage, COMMON_PACKAGE_ID, CREDENTIAL_SCHEMA_EIP712_TYPE, CREDENTIAL_SUBJECT_TYPE, CREDENTIAL_TYPES, ChannelScheme, ChevronDownIcon, ConflictError, CopyIcon, DEFAULT_DRIVE_EDITOR_ID, DEFAULT_DRIVE_ID, DEFAULT_SWITCHBOARD_URL, DOMAIN_TYPE, DisconnectIcon, DocumentCache, DocumentChangeType, DocumentIntegrityService, EDITOR_FILE_DROP_OPT_OUT_ATTR, GqlRequestChannel, GraphQLClientDocumentCache, ISSUER_TYPE, InMemoryQueue, IntervalPollTimer, PollBehavior, PropagationMode, REACTOR_SCHEMA, RENOWN_CHAIN_ID, RENOWN_NETWORK_ID, RENOWN_URL, ReactorBuilder, ReactorClientBuilder, RegistryClient, RelationalDbProcessor, RemoteClient, RemoteDocumentController, Renown, RenownAuthButton, RenownLoginButton, RenownLogo, RenownUserButton, SpinnerIcon, SyncOperationStatus, UploadStatus, UserIcon, VERIFIABLE_CREDENTIAL_EIP712_TYPE, addAllowListEventHandler, addAllowedDocumentTypesEventHandler, addAnalyticsDatabaseNameEventHandler, addAttachmentServiceEventHandler, addBasePathEventHandler, addCliVersionEventHandler, addDefaultDrivesUrlEventHandler, addDisabledEditorsEventHandler, addDocument, addDocumentCacheEventHandler, addDraggingNodeEventHandler, addDrive, addDrivesEventHandler, addDrivesPreserveStrategyEventHandler, addEnabledEditorsEventHandler, addFeaturesEventHandler, addFileUploadOperationsChunkSizeEventHandler, addFolder, addGaTrackingIdEventHandler, addGraphQLReactorClientEventHandler, addIsAddCloudDrivesEnabledEventHandler, addIsAddDriveEnabledEventHandler, addIsAddLocalDrivesEnabledEventHandler, addIsAddPublicDrivesEnabledEventHandler, addIsAnalyticsDatabaseWorkerEnabledEventHandler, addIsAnalyticsEnabledEventHandler, addIsAnalyticsExternalProcessorsEnabledEventHandler, addIsCloudDrivesEnabledEventHandler, addIsDeleteCloudDrivesEnabledEventHandler, addIsDeleteLocalDrivesEnabledEventHandler, addIsDeletePublicDrivesEnabledEventHandler, addIsDiffAnalyticsEnabledEventHandler, addIsDocumentModelSelectionSettingsEnabledEventHandler, addIsDragAndDropEnabledEventHandler, addIsDriveAnalyticsEnabledEventHandler, addIsEditorDebugModeEnabledEventHandler, addIsEditorReadModeEnabledEventHandler, addIsExternalControlsEnabledEventHandler, addIsExternalPackagesEnabledEventHandler, addIsExternalProcessorsEnabledEventHandler, addIsExternalRelationalProcessorsEnabledEventHandler, addIsLocalDrivesEnabledEventHandler, addIsPublicDrivesEnabledEventHandler, addIsRelationalProcessorsEnabledEventHandler, addIsSentryTracingEnabledEventHandler, addLoadingEventHandler, addLocalDrivesEnabledEventHandler, addLogLevelEventHandler, addModalEventHandler, addPHEventHandlers, addPackageDiscoveryServiceEventHandler, addPromiseState, addReactorClientEventHandler, addReactorClientModuleEventHandler, addRemoteDrive, addRenownChainIdEventHandler, addRenownEventHandler, addRenownNetworkIdEventHandler, addRenownUrlEventHandler, addRequiresHardRefreshEventHandler, addResetSelectedNodeEventHandler, addRevisionHistoryVisibleEventHandler, addRouterBasenameEventHandler, addSelectedDriveIdEventHandler, addSelectedNodeIdEventHandler, addSelectedTimelineItemEventHandler, addSelectedTimelineRevisionEventHandler, addSentryDsnEventHandler, addSentryEnvEventHandler, addSentryReleaseEventHandler, addSetSelectedDriveOnPopStateEventHandler, addSetSelectedNodeOnPopStateEventHandler, addStudioModeEventHandler, addToastEventHandler, addVersionCheckIntervalEventHandler, addVersionEventHandler, addVetraPackageManagerEventHandler, addWarnOutdatedAppEventHandler, baseDocumentModels, baseDocumentModelsMap, buildDocumentSubgraphQuery, buildDocumentSubgraphUrl, callEventHandlerRegisterFunctions, callGlobalSetterForKey, clearGlobal, closePHModal, commonGlobalEventHandlerFunctions, convertRemoteOperations, createAnalyticsStore, createClient, createProcessorQuery, createUrlWithPreservedParams, deleteDrive, deleteNode, deriveSystemUrl, dispatchActions, downloadDocument, driveCollectionId, driveIdFromUrl, dropAllReactorStorage, exportFile, extractDriveIdFromPath, extractDriveIdFromSlug, extractDriveSlugFromPath, extractNodeIdFromPath, extractNodeIdFromSlug, extractNodeSlugFromPath, findUuid, getAnalyticsStore, getDocumentGraphqlQuery, getDriveIdBySlug, getDrives, getGlobal, getPackages, getPackagesByDocumentType, getPathWithoutBase, getRevisionFromDate, getSlugFromDriveUrl, getSwitchboardGatewayUrlFromDriveUrl, getSyncStatus, getSyncStatusSync, getUserPermissions, graphqlDocumentEvents, graphqlDocumentsEvents, graphqlEventsToSyncDrive, hideRevisionHistory, identifierFromMutateDocumentOperationVariables, initConnectCrypto, initRenownCrypto, initTheme, isDocumentTypeSupported, isExternalControlsEnabledEventFunctions, isFileNodeKind, isFolderNodeKind, loading, login, logout, makeDriveUrlComponent, makeNodeSlug, makePHEventFunctions, openRenown, parseDriveUrl, phAppConfigHooks, phAppConfigSetters, phDocumentEditorConfigHooks, phDocumentEditorConfigSetters, phDocumentFromQuery, phDocumentsFromQuery, phGlobalConfigHooks, phGlobalConfigSetters, reactorGraphqlBatchFetchDocuments, reactorGraphqlCreateDocument, reactorGraphqlDeleteDocument, reactorGraphqlDeleteDocuments, reactorGraphqlFetchDocument, reactorGraphqlMutateDocument, readPromiseState, refreshReactorData, refreshReactorDataClient, renameDrive, renameDriveNode, resolveUrlPathname, setAllowList, setAllowedDocumentTypes, setAnalyticsDatabaseName, setAttachmentService, setBasePath, setCliVersion, setDefaultDrivesUrl, setDefaultPHGlobalConfig, setDisabledEditors, setDocumentCache, setDriveAvailableOffline, setDriveMetadata, setDriveSharingType, setDrives, setDrivesPreserveStrategy, setEnabledEditors, setFeatures, setFileUploadOperationsChunkSize, setGaTrackingId, setGlobal, setGraphQLReactorClient, setIsAddCloudDrivesEnabled, setIsAddDriveEnabled, setIsAddLocalDrivesEnabled, setIsAddPublicDrivesEnabled, setIsAnalyticsDatabaseWorkerEnabled, setIsAnalyticsEnabled, setIsAnalyticsExternalProcessorsEnabled, setIsCloudDrivesEnabled, setIsDeleteCloudDrivesEnabled, setIsDeleteLocalDrivesEnabled, setIsDeletePublicDrivesEnabled, setIsDiffAnalyticsEnabled, setIsDocumentModelSelectionSettingsEnabled, setIsDragAndDropEnabled, setIsDriveAnalyticsEnabled, setIsEditorDebugModeEnabled, setIsEditorReadModeEnabled, setIsExternalControlsEnabled, setIsExternalPackagesEnabled, setIsExternalProcessorsEnabled, setIsExternalRelationalProcessorsEnabled, setIsLocalDrivesEnabled, setIsPublicDrivesEnabled, setIsRelationalProcessorsEnabled, setIsSentryTracingEnabled, setLoading, setLocalDrivesEnabled, setLogLevel, setPHAppConfig, setPHAppConfigByKey, setPHDocumentEditorConfig, setPHDocumentEditorConfigByKey, setPHGlobalConfig, setPHGlobalConfigByKey, setPHModal, setPHToast, setPackageDiscoveryService, setReactorClient, setReactorClientModule, setRenown, setRenownChainId, setRenownNetworkId, setRenownUrl, setRequiresHardRefresh, setRevisionHistoryVisible, setRouterBasename, setSelectedDrive, setSelectedDriveId, setSelectedNode, setSelectedTimelineItem, setSelectedTimelineRevision, setSentryDsn, setSentryEnv, setSentryRelease, setStudioMode, setVersion, setVersionCheckInterval, setVetraPackageManager, setWarnOutdatedApp, showCreateDocumentModal, showDeleteNodeModal, showPHModal, showRevisionHistory, sortNodesByName, trimTrailingSlash, truncateAllTables, useAllowList, useAllowedDocumentModelModules, useAllowedDocumentTypes, useAnalyticsDatabaseName, useAppModuleById, useAppModules, useAttachmentService, useAttachmentUpload, useAttachments, useBasePath, useCliVersion, useConnectionState, useConnectionStates, useDatabase, useDefaultAppModule, useDefaultDrivesUrl, useDid, useDisabledEditors, useDispatch, useDocument, useDocumentById, useDocumentCache, useDocumentModelModuleById, useDocumentModelModules, useDocumentOfType, useDocumentOperations, useDocumentSafe, useDocumentTypes, useDocumentTypesInSelectedDrive, useDocuments, useDocumentsByIds, useDocumentsInSelectedDrive, useDocumentsInSelectedFolder, useDownloadDocument, useDragNode, useDriveById, useDriveSystemInfo, useDrives, useDrivesPreserveStrategy, useDropFile, useDropNode, useEditorFileDrop, useEditorModuleById, useEditorModules, useEditorModulesForDocumentType, useEnabledEditors, useFallbackEditorModule, useFeatures, useFileNodesInSelectedDrive, useFileNodesInSelectedFolder, useFileUploadOperationsChunkSize, useFolderById, useFolderNodesInSelectedDrive, useFolderNodesInSelectedFolder, useGaTrackingId, useGetDocument, useGetDocumentAsync, useGetDocuments, useGetSwitchboardLink, useGraphQLReactorClient, useInitReactorGraphqlClient, useIsAddCloudDrivesEnabled, useIsAddDriveEnabled, useIsAddLocalDrivesEnabled, useIsAddPublicDrivesEnabled, useIsAnalyticsDatabaseWorkerEnabled, useIsAnalyticsEnabled, useIsAnalyticsExternalProcessorsEnabled, useIsCloudDrivesEnabled, useIsDeleteCloudDrivesEnabled, useIsDeleteLocalDrivesEnabled, useIsDeletePublicDrivesEnabled, useIsDiffAnalyticsEnabled, useIsDocumentModelSelectionSettingsEnabled, useIsDragAndDropEnabled, useIsDriveAnalyticsEnabled, useIsEditorDebugModeEnabled, useIsEditorReadModeEnabled, useIsExternalControlsEnabled, useIsExternalPackagesEnabled, useIsExternalProcessorsEnabled, useIsExternalRelationalProcessorsEnabled, useIsLocalDrivesEnabled, useIsPublicDrivesEnabled, useIsRelationalProcessorsEnabled, useIsSentryTracingEnabled, useLoading, useLocalDrivesEnabled, useLogLevel, useLoginStatus, useModelRegistry, useNodeActions, useNodeById, useNodeParentFolderById, useNodePathById, useNodesInSelectedDrive, useNodesInSelectedDriveOrFolder, useNodesInSelectedFolder, useOnDropFile, usePGlite, usePHAppConfigByKey, usePHDocumentEditorConfigByKey, usePHGlobalConfigByKey, usePHModal, usePHToast, usePackageDiscoveryService, useParentFolderForSelectedNode, useReactorClient, useReactorClientModule, useRelationalDb, useRelationalQuery, useRenown, useRenownAuth, useRenownChainId, useRenownInit, useRenownNetworkId, useRenownUrl, useRequiresHardRefresh, useResetPHGlobalConfig, useRevisionHistoryVisible, useRouterBasename, useSelectedDocument, useSelectedDocumentId, useSelectedDocumentOfType, useSelectedDocumentSafe, useSelectedDrive, useSelectedDriveId, useSelectedDriveSafe, useSelectedFolder, useSelectedNode, useSelectedNodePath, useSelectedTimelineItem, useSelectedTimelineRevision, useSentryDsn, useSentryEnv, useSentryRelease, useSetDefaultPHGlobalConfig, useSetPHAppConfig, useSetPHDocumentEditorConfig, useSetPHGlobalConfig, useStudioMode, useSubgraphModules, useSupportedDocumentTypesInReactor, useSync, useSyncList, useTheme, useUser, useUserPermissions, useVersion, useVersionCheckInterval, useVetraPackageManager, useVetraPackages, useWarnOutdatedApp, validateDocument, waitForDocumentReady };\n\n//# sourceMappingURL=index.js.map"],"x_google_ignoreList":[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],"mappings":";;;;;;AAGA,MAAMA,aAAW,OAAO,WAAW;AACnC,SAAS,qBAAqB,KAAK;CAClC,MAAM,eAAe,SAAS,YAAY,IAAI;CAC9C,MAAM,kBAAkB,MAAM,IAAI;CAClC,SAAS,SAAS,OAAO;AACxB,MAAIA,WAAU;EACd,MAAM,QAAQ,IAAI,YAAY,cAAc,EAAE,QAAQ,GAAG,MAAM,OAAO,EAAE,CAAC;AACzE,SAAO,cAAc,MAAM;;CAE5B,SAAS,uBAAuB;AAC/B,MAAIA,WAAU;EACd,MAAM,QAAQ,IAAI,YAAY,gBAAgB;AAC9C,SAAO,cAAc,MAAM;;CAE5B,SAAS,oBAAoB,OAAO;AACnC,MAAIA,WAAU;EACd,MAAM,QAAQ,MAAM,OAAO;AAC3B,MAAI,CAAC,OAAO,GAAI,QAAO,KAAK,EAAE;AAC9B,SAAO,GAAG,OAAO;AACjB,wBAAsB;;CAEvB,SAAS,kBAAkB;AAC1B,MAAIA,WAAU;AACd,SAAO,iBAAiB,cAAc,oBAAoB;;CAE3D,SAAS,iBAAiB,eAAe;AACxC,MAAIA,WA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AG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CAEH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CAEH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CAEH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CAEH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CAEH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CAEH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CAEH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CAEH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CAEH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CAEH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CAEH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CAEH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CAEH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CAEH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CAEH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CAEH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAA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