@powerhousedao/reactor-browser 6.2.3-dev.69 → 6.2.3-dev.70

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 (40) hide show
  1. package/dist/{attachment-service-BHS3EJAr.d.ts → attachment-service-CAf9N-15.d.ts} +5 -3
  2. package/dist/{attachment-service-BHS3EJAr.d.ts.map → attachment-service-CAf9N-15.d.ts.map} +1 -1
  3. package/dist/{dispatch-BmdzdTwb.js → dispatch-Dd_WEz35.js} +19 -11
  4. package/dist/{dispatch-BmdzdTwb.js.map → dispatch-Dd_WEz35.js.map} +1 -1
  5. package/dist/{document-by-id-BqNuTx4S.js → document-by-id-DqAyjr9P.js} +2 -2
  6. package/dist/{document-by-id-BqNuTx4S.js.map → document-by-id-DqAyjr9P.js.map} +1 -1
  7. package/dist/{document-model-modules-BwnWiVeC.js → document-model-modules-DROQT_yu.js} +85 -100
  8. package/dist/document-model-modules-DROQT_yu.js.map +1 -0
  9. package/dist/{document-operations-DciiZwkC.js → document-operations-C6khz2If.js} +6 -6
  10. package/dist/{document-operations-DciiZwkC.js.map → document-operations-C6khz2If.js.map} +1 -1
  11. package/dist/{global-Cgi-GJpN.d.ts → global-D-VZTZRz.d.ts} +3 -4
  12. package/dist/global-D-VZTZRz.d.ts.map +1 -0
  13. package/dist/{index-B8MXPz3f.d.ts → index-XfcUiODQ.d.ts} +2 -2
  14. package/dist/{index-B8MXPz3f.d.ts.map → index-XfcUiODQ.d.ts.map} +1 -1
  15. package/dist/index.d.ts +95 -70
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +26 -16
  18. package/dist/index.js.map +1 -1
  19. package/dist/{make-ph-event-functions-C1JTfEw1.js → make-ph-event-functions-B5GU5xcR.js} +4 -75
  20. package/dist/make-ph-event-functions-B5GU5xcR.js.map +1 -0
  21. package/dist/{navigation-BUPIObES.js → navigation-BqphkrOB.js} +3 -20
  22. package/dist/navigation-BqphkrOB.js.map +1 -0
  23. package/dist/{renown-Dem71OWZ.js → renown-BtjgHBjH.js} +4 -4
  24. package/dist/{renown-Dem71OWZ.js.map → renown-BtjgHBjH.js.map} +1 -1
  25. package/dist/{renown-CGQYQsvH.js → renown-BxkZYzbQ.js} +2 -2
  26. package/dist/{renown-CGQYQsvH.js.map → renown-BxkZYzbQ.js.map} +1 -1
  27. package/dist/src/ai/index.js +2 -2
  28. package/dist/src/analytics/index.js +1 -1
  29. package/dist/src/graphql-client/entry.d.ts +2 -2
  30. package/dist/src/graphql-client/entry.js +3 -3
  31. package/dist/src/renown/index.d.ts +1 -1
  32. package/dist/src/renown/index.js +2 -2
  33. package/dist/{switchboard-CiYrfAcM.js → switchboard-cwUp3FxP.js} +44 -11
  34. package/dist/switchboard-cwUp3FxP.js.map +1 -0
  35. package/package.json +9 -9
  36. package/dist/document-model-modules-BwnWiVeC.js.map +0 -1
  37. package/dist/global-Cgi-GJpN.d.ts.map +0 -1
  38. package/dist/make-ph-event-functions-C1JTfEw1.js.map +0 -1
  39. package/dist/navigation-BUPIObES.js.map +0 -1
  40. package/dist/switchboard-CiYrfAcM.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { createContext, useContext, useEffect, useSyncExternalStore } from "react";
1
+ import { createContext, useContext, useSyncExternalStore } from "react";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import { capitalCase } from "change-case";
4
4
  //#region src/hooks/ph-store.tsx
@@ -28,45 +28,6 @@ function createPHStore(initial = {}) {
28
28
  listenersByStore.set(store, listeners);
29
29
  return store;
30
30
  }
31
- /** The keys a scoped store owns; every other key reads and writes its parent. */
32
- const SCOPED_PH_KEYS = [
33
- "selectedDriveId",
34
- "selectedNodeId",
35
- "navigation"
36
- ];
37
- const scopedKeys = new Set(SCOPED_PH_KEYS);
38
- const parentOfScope = /* @__PURE__ */ new WeakMap();
39
- /** A store with its own selection and navigation over `parent`, e.g. for an
40
- * editor shown beside others; provide it with {@link PHStoreProvider}. */
41
- function createScopedPHStore(parent, overrides = {}) {
42
- const listeners = /* @__PURE__ */ new Map();
43
- const own = {};
44
- for (const key of SCOPED_PH_KEYS) if (overrides[key] !== void 0) Reflect.set(own, key, overrides[key]);
45
- const store = new Proxy(own, {
46
- get: (target, key) => scopedKeys.has(key) ? Reflect.get(target, key) : Reflect.get(parent, key),
47
- has: (target, key) => scopedKeys.has(key) ? Reflect.has(target, key) : Reflect.has(parent, key),
48
- set: (target, key, value) => {
49
- if (!scopedKeys.has(key)) return Reflect.set(parent, key, value);
50
- if (Reflect.get(target, key) === value) return true;
51
- Reflect.set(target, key, value);
52
- notifyKey(listeners, key);
53
- return true;
54
- },
55
- deleteProperty: (target, key) => {
56
- if (!scopedKeys.has(key)) return Reflect.deleteProperty(parent, key);
57
- Reflect.deleteProperty(target, key);
58
- notifyKey(listeners, key);
59
- return true;
60
- }
61
- });
62
- listenersByStore.set(store, listeners);
63
- parentOfScope.set(store, parent);
64
- return store;
65
- }
66
- /** Whether `store` was made by {@link createScopedPHStore}. */
67
- function isScopedPHStore(store) {
68
- return !!store && parentOfScope.has(store);
69
- }
70
31
  function listenersOf(store) {
71
32
  const listeners = listenersByStore.get(store);
72
33
  if (!listeners) throw new Error("Not a store made by createPHStore");
@@ -74,16 +35,6 @@ function listenersOf(store) {
74
35
  }
75
36
  /** Subscribes to changes of `key`, or of every key when omitted. */
76
37
  function subscribePHStore(store, listener, key = ALL_KEYS) {
77
- const parent = parentOfScope.get(store);
78
- if (parent && !scopedKeys.has(key)) {
79
- const fromParent = subscribePHStore(parent, listener, key);
80
- if (key !== ALL_KEYS) return fromParent;
81
- const fromScope = subscribeOwn(store, listener, key);
82
- return () => {
83
- fromParent();
84
- fromScope();
85
- };
86
- }
87
38
  return subscribeOwn(store, listener, key);
88
39
  }
89
40
  function subscribeOwn(store, listener, key) {
@@ -97,9 +48,7 @@ function subscribeOwn(store, listener, key) {
97
48
  }
98
49
  /** Notifies `key`'s listeners without a change, as re-setting a value does. */
99
50
  function notifyPHStore(store, key) {
100
- const parent = parentOfScope.get(store);
101
- if (parent && !scopedKeys.has(key)) notifyPHStore(parent, key);
102
- else notifyKey(listenersOf(store), key);
51
+ notifyKey(listenersOf(store), key);
103
52
  }
104
53
  /** A subscribe for `key`, stable per store as useSyncExternalStore expects. */
105
54
  function getPHStoreSubscribe(store, key) {
@@ -147,28 +96,8 @@ function bindPHStoreToWindow(store) {
147
96
  window.ph = store;
148
97
  }
149
98
  const PHStoreContext = createContext(void 0);
150
- let mountedScopes = 0;
151
- const warned = /* @__PURE__ */ new Set();
152
- function isProduction() {
153
- return typeof process !== "undefined" && false;
154
- }
155
- /** Warns once in development when a global setter runs while a scoped store
156
- * is mounted, since it acts on the app's store and not the scope's. */
157
- function warnGlobalSetterInScope(setter, hook) {
158
- if (mountedScopes === 0 || warned.has(setter) || isProduction()) return;
159
- warned.add(setter);
160
- console.warn(`${setter} acts on the app's PH store while a scoped store is mounted; inside a scope, use ${hook}.`);
161
- }
162
99
  /** Hooks below read from `store`; without a provider they read `window.ph`. */
163
100
  function PHStoreProvider(props) {
164
- const scoped = isScopedPHStore(props.store);
165
- useEffect(() => {
166
- if (!scoped) return;
167
- mountedScopes++;
168
- return () => {
169
- mountedScopes--;
170
- };
171
- }, [scoped]);
172
101
  return /* @__PURE__ */ jsx(PHStoreContext.Provider, {
173
102
  value: props.store,
174
103
  children: props.children
@@ -246,6 +175,6 @@ function makePHEventFunctions(key) {
246
175
  };
247
176
  }
248
177
  //#endregion
249
- export { bindPHStoreToWindow as a, ensurePHStore as c, getPHStoreSubscribe as d, isScopedPHStore as f, warnGlobalSetterInScope as g, usePHStore as h, SCOPED_PH_KEYS as i, getActivePHStore as l, subscribePHStore as m, subscribeToPHValue as n, createPHStore as o, notifyPHStore as p, PHStoreProvider as r, createScopedPHStore as s, makePHEventFunctions as t, getPHStore as u };
178
+ export { createPHStore as a, getPHStore as c, subscribePHStore as d, usePHStore as f, bindPHStoreToWindow as i, getPHStoreSubscribe as l, subscribeToPHValue as n, ensurePHStore as o, PHStoreProvider as r, getActivePHStore as s, makePHEventFunctions as t, notifyPHStore as u };
250
179
 
251
- //# sourceMappingURL=make-ph-event-functions-C1JTfEw1.js.map
180
+ //# sourceMappingURL=make-ph-event-functions-B5GU5xcR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"make-ph-event-functions-B5GU5xcR.js","names":[],"sources":["../src/hooks/ph-store.tsx","../src/hooks/make-ph-event-functions.ts"],"sourcesContent":["import type { PHGlobal, PHGlobalKey } from \"@powerhousedao/reactor-browser\";\nimport type { ReactNode } from \"react\";\nimport { createContext, useContext } from \"react\";\n\n/** PH state of one app (or one server request); assigning a key notifies. */\nexport type PHStore = PHGlobal;\n\ntype Listeners = Map<PropertyKey, Set<() => void>>;\n\n// Listeners per key; ALL_KEYS hears every change.\nconst ALL_KEYS = Symbol(\"all keys\");\nconst listenersByStore = new WeakMap<PHStore, Listeners>();\n// Stores bound to window.ph; their changes also fire `ph:<key>Updated`.\nconst windowBound = new WeakSet<Listeners>();\nconst subscribeCache = new WeakMap<\n PHStore,\n Map<PropertyKey, (listener: () => void) => () => void>\n>();\n\nfunction notifyKey(listeners: Listeners, key: PropertyKey) {\n for (const set of [listeners.get(key), listeners.get(ALL_KEYS)]) {\n for (const listener of set ?? []) listener();\n }\n // Another bundled copy of reactor-browser subscribes through window events.\n if (windowBound.has(listeners) && typeof key === \"string\") {\n window.dispatchEvent(new CustomEvent(`ph:${key}Updated`));\n }\n}\n\nexport function createPHStore(initial: PHGlobal = {}): PHStore {\n const listeners: Listeners = new Map();\n const store = new Proxy<PHGlobal>(\n { ...initial },\n {\n set: (target, key, value) => {\n if (Reflect.get(target, key) === value) return true;\n Reflect.set(target, key, value);\n notifyKey(listeners, key);\n return true;\n },\n deleteProperty: (target, key) => {\n Reflect.deleteProperty(target, key);\n notifyKey(listeners, key);\n return true;\n },\n },\n );\n listenersByStore.set(store, listeners);\n return store;\n}\n\nfunction listenersOf(store: PHStore) {\n const listeners = listenersByStore.get(store);\n if (!listeners) throw new Error(\"Not a store made by createPHStore\");\n return listeners;\n}\n\n/** Subscribes to changes of `key`, or of every key when omitted. */\nexport function subscribePHStore(\n store: PHStore,\n listener: () => void,\n key: PHGlobalKey | typeof ALL_KEYS = ALL_KEYS,\n): () => void {\n return subscribeOwn(store, listener, key);\n}\n\nfunction subscribeOwn(store: PHStore, listener: () => void, key: PropertyKey) {\n const listeners = listenersOf(store);\n const set = listeners.get(key) ?? new Set();\n listeners.set(key, set);\n set.add(listener);\n return () => {\n set.delete(listener);\n };\n}\n\n/** Notifies `key`'s listeners without a change, as re-setting a value does. */\nexport function notifyPHStore(store: PHStore, key: PHGlobalKey) {\n notifyKey(listenersOf(store), key);\n}\n\n/** A subscribe for `key`, stable per store as useSyncExternalStore expects. */\nexport function getPHStoreSubscribe(store: PHStore, key?: PHGlobalKey) {\n const cacheKey = key ?? ALL_KEYS;\n const cache =\n subscribeCache.get(store) ??\n new Map<PropertyKey, (listener: () => void) => () => void>();\n subscribeCache.set(store, cache);\n let subscribe = cache.get(cacheKey);\n if (!subscribe) {\n subscribe = (listener: () => void) =>\n subscribePHStore(store, listener, cacheKey);\n cache.set(cacheKey, subscribe);\n }\n return subscribe;\n}\n\nlet activeStore: PHStore | undefined;\n\n/** The store bound with {@link bindPHStoreToWindow}, if any. */\nexport function getActivePHStore() {\n return activeStore;\n}\n\n/** The app's state outside React: the bound store, else `window.ph`. */\nexport function getPHStore(): PHStore | undefined {\n if (activeStore) return activeStore;\n return typeof window === \"undefined\" ? undefined : window.ph;\n}\n\n/** The bound store; otherwise binds `window.ph` if it is a store, else a new\n * store that takes over a plain `window.ph`'s values. */\nexport function ensurePHStore(): PHStore {\n if (activeStore) return activeStore;\n const current = typeof window === \"undefined\" ? undefined : window.ph;\n const store =\n current && listenersByStore.has(current) ? current : createPHStore();\n bindPHStoreToWindow(store);\n return store;\n}\n\n/** Makes `store` the app's state and `window.ph`; values set on a plain\n * `window.ph` carry over where `store` has none. */\nexport function bindPHStoreToWindow(store: PHStore) {\n activeStore = store;\n if (typeof window === \"undefined\") return;\n const previous = window.ph;\n const previousListeners = previous && listenersByStore.get(previous);\n // A previously bound store is replaced, not merged.\n if (previousListeners) windowBound.delete(previousListeners);\n else if (previous) {\n for (const [key, value] of Object.entries(previous)) {\n if (!(key in store)) Reflect.set(store, key, value);\n }\n }\n windowBound.add(listenersOf(store));\n window.ph = store;\n}\n\nconst PHStoreContext = createContext<PHStore | undefined>(undefined);\n\n/** Hooks below read from `store`; without a provider they read `window.ph`. */\nexport function PHStoreProvider(props: {\n store: PHStore;\n children: ReactNode;\n}) {\n return (\n <PHStoreContext.Provider value={props.store}>\n {props.children}\n </PHStoreContext.Provider>\n );\n}\n\nexport function usePHStore() {\n return useContext(PHStoreContext);\n}\n","import type {\n PHGlobal,\n PHGlobalKey,\n SetEvent,\n} from \"@powerhousedao/reactor-browser\";\nimport { capitalCase } from \"change-case\";\nimport { useSyncExternalStore } from \"react\";\nimport {\n getActivePHStore,\n getPHStore,\n getPHStoreSubscribe,\n notifyPHStore,\n subscribePHStore,\n usePHStore,\n} from \"./ph-store.js\";\n\n// guard condition for server side rendering\nconst isServer = typeof window === \"undefined\";\n\nconst updatedEventName = (key: PHGlobalKey) => `ph:${key}Updated`;\n\n/** Calls `onChange` whenever `key` is set: through the bound store, or the\n * `ph:<key>Updated` event on pages that bound none. */\nexport function subscribeToPHValue(key: PHGlobalKey, onChange: () => void) {\n if (isServer) return () => {};\n const store = getActivePHStore();\n if (store) return subscribePHStore(store, onChange, key);\n const eventName = updatedEventName(key);\n window.addEventListener(eventName, onChange);\n return () => window.removeEventListener(eventName, onChange);\n}\n\nexport function makePHEventFunctions<TKey extends PHGlobalKey>(key: TKey) {\n const setEventName = `ph:set${capitalCase(key)}` as const;\n const updateEventName = updatedEventName(key);\n\n function setValue(value: PHGlobal[TKey] | undefined) {\n if (isServer) {\n return;\n }\n const store = getActivePHStore();\n if (store) {\n const unchanged = store[key] === value;\n store[key] = value;\n // Re-setting a value still notifies, as the event path always has.\n if (unchanged) notifyPHStore(store, key);\n return;\n }\n const event = new CustomEvent(setEventName, {\n detail: { [key]: value },\n });\n window.dispatchEvent(event);\n }\n\n function dispatchUpdatedEvent() {\n if (isServer) {\n return;\n }\n const event = new CustomEvent(updateEventName);\n window.dispatchEvent(event);\n }\n\n function handleSetValueEvent(event: SetEvent<TKey>) {\n if (isServer) {\n return;\n }\n if (getActivePHStore()) {\n setValue(event.detail[key]);\n return;\n }\n // No bound store: the page keeps a plain `window.ph`.\n (window.ph ??= {})[key] = event.detail[key];\n dispatchUpdatedEvent();\n }\n\n // Only pages without a bound store need it; `ph:set*` events still apply.\n function addEventHandler() {\n if (isServer) {\n return;\n }\n window.addEventListener(setEventName, handleSetValueEvent as EventListener);\n }\n\n function subscribeToValue(onStoreChange: () => void) {\n return subscribeToPHValue(key, onStoreChange);\n }\n\n function getSnapshot() {\n if (isServer) {\n return undefined;\n }\n // Read before the first setValue is expected: subscribers mount before init.\n return getPHStore()?.[key];\n }\n\n function getServerSnapshot() {\n return undefined;\n }\n\n function useValue() {\n const store = usePHStore();\n const readStore = () => store?.[key];\n return useSyncExternalStore(\n store ? getPHStoreSubscribe(store, key) : subscribeToValue,\n store ? readStore : getSnapshot,\n store ? readStore : getServerSnapshot,\n );\n }\n\n return {\n useValue,\n setValue,\n addEventHandler,\n // Non-React access, e.g. Connect's boot wiring of the reactor worker.\n subscribeToValue,\n getSnapshot,\n };\n}\n"],"mappings":";;;;AAUA,MAAM,WAAW,OAAO,UAAU;AAClC,MAAM,mCAAmB,IAAI,QAA4B;AAEzD,MAAM,8BAAc,IAAI,QAAmB;AAC3C,MAAM,iCAAiB,IAAI,QAGzB;AAEF,SAAS,UAAU,WAAsB,KAAkB;CACzD,KAAK,MAAM,OAAO,CAAC,UAAU,IAAI,GAAG,GAAG,UAAU,IAAI,QAAQ,CAAC,GAC5D,KAAK,MAAM,YAAY,OAAO,CAAC,GAAG,SAAS;CAG7C,IAAI,YAAY,IAAI,SAAS,KAAK,OAA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oB,OAAO,GAAG,IAAI,kBAC1C,QAAQ,YAAY,aACpB,QAAQ,YAAY,iBACtB;CACF;CAEA,OAAO;EACL;EACA;EACA;EAEA;EACA;CACF;AACF"}
@@ -1,4 +1,4 @@
1
- import { f as isScopedPHStore, u as getPHStore } from "./make-ph-event-functions-C1JTfEw1.js";
1
+ import { c as getPHStore } from "./make-ph-event-functions-B5GU5xcR.js";
2
2
  import { useMemo, useSyncExternalStore } from "react";
3
3
  import { isDerivedDocumentId } from "@powerhousedao/shared/document-model";
4
4
  import slug from "slug";
@@ -256,23 +256,6 @@ const browserNavigation = {
256
256
  },
257
257
  useSetSearchParams: () => setBrowserSearchParams
258
258
  };
259
- const NO_PARAMS = {};
260
- const noop = () => {};
261
- const detachedNavigation = {
262
- location: () => ({
263
- pathname: "",
264
- search: ""
265
- }),
266
- open: noop,
267
- setSearch: noop,
268
- useSearchParams: () => NO_PARAMS,
269
- useSetSearchParams: () => noop
270
- };
271
- /** The navigation `store` acts through: a scope's own, else the app's. */
272
- function getNavigationOf(store) {
273
- if (store && isScopedPHStore(store)) return store.navigation ?? detachedNavigation;
274
- return store?.navigation ?? getPHNavigation();
275
- }
276
259
  /** True when the store has a host navigation, not the browser fallback. */
277
260
  function hasHostNavigation() {
278
261
  return !isServer && getPHStore()?.navigation !== void 0;
@@ -314,6 +297,6 @@ function setSearchParams(update, options) {
314
297
  getPHNavigation().setSearch((prev) => resolveSearchUpdate(prev, update), options);
315
298
  }
316
299
  //#endregion
317
- export { extractNodeIdFromPath as A, resolveUrlPathname as B, setBrowserOpenSync as C, extractDriveIdFromPath as D, createUrlWithPreservedParams as E, findUuid as F, getPathWithoutBase as I, makeDriveSlug as L, extractNodeSlugFromPath as M, findDerivedId as N, extractDriveIdFromSlug as O, findDriveBySlug as P, makeDriveUrlComponent as R, searchToRecord as S, targetPathname as T, openedFromIndex as _, SETTINGS_PATH as a, resolveSearchUpdate as b, getCurrentPathname as c, getTargetHref as d, hasHostNavigation as f, openTargetWith as g, openTarget as h, PH_LOCATION_CHANGE_EVENT as i, extractNodeIdFromSlug as j, extractDriveSlugFromPath as k, getNavigationOf as l, isSettingsTarget as m, GLOBAL_SEARCH_PARAMS as n, applySearchUpdate as o, isGlobalSearchParam as p, OPENED_FROM_STATE_KEY as r, browserNavigation as s, FEATURE_FLAG_PARAM_PREFIX as t, getPHNavigation as u, preloadTarget as v, setSearchParams as w, searchParamsToString as x, recordToSearch as y, makeNodeSlug as z };
300
+ export { extractNodeIdFromSlug as A, setSearchParams as C, extractDriveIdFromSlug as D, extractDriveIdFromPath as E, getPathWithoutBase as F, makeDriveSlug as I, makeDriveUrlComponent as L, findDerivedId as M, findDriveBySlug as N, extractDriveSlugFromPath as O, findUuid as P, makeNodeSlug as R, setBrowserOpenSync as S, createUrlWithPreservedParams as T, preloadTarget as _, SETTINGS_PATH as a, searchParamsToString as b, getCurrentPathname as c, hasHostNavigation as d, isGlobalSearchParam as f, openedFromIndex as g, openTargetWith as h, PH_LOCATION_CHANGE_EVENT as i, extractNodeSlugFromPath as j, extractNodeIdFromPath as k, getPHNavigation as l, openTarget as m, GLOBAL_SEARCH_PARAMS as n, applySearchUpdate as o, isSettingsTarget as p, OPENED_FROM_STATE_KEY as r, browserNavigation as s, FEATURE_FLAG_PARAM_PREFIX as t, getTargetHref as u, recordToSearch as v, targetPathname as w, searchToRecord as x, resolveSearchUpdate as y, resolveUrlPathname as z };
318
301
 
319
- //# sourceMappingURL=navigation-BUPIObES.js.map
302
+ //# sourceMappingURL=navigation-BqphkrOB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation-BqphkrOB.js","names":[],"sources":["../src/utils/url.ts","../src/hooks/navigation.ts"],"sourcesContent":["import { getPHStore } from \"../hooks/ph-store.js\";\nimport type {\n DocumentDriveDocument,\n Node,\n} from \"@powerhousedao/shared/document-drive\";\nimport { isDerivedDocumentId } from \"@powerhousedao/shared/document-model\";\nimport slug from \"slug\";\n\n// Length of the base64url id a v2-required document gets.\nconst DERIVED_ID_LENGTH = 43;\n\n// Returns url with base path plus provided path\nexport function resolveUrlPathname(path: string) {\n return new URL(\n path.replace(/^\\/+/, \"\"),\n window.location.origin + (getPHStore()?.basePath ?? \"/\"),\n ).pathname;\n}\n\n/** Returns the path without a leading base path */\nexport function getPathWithoutBase(path: string) {\n const basePath = getPHStore()?.basePath ?? \"/\";\n if (!path.startsWith(basePath)) return path;\n const rest = path.slice(basePath.length);\n if (basePath.endsWith(\"/\")) return `/${rest}`;\n return rest === \"\" || rest.startsWith(\"/\") ? rest : path;\n}\n\n/** Makes a URL component for a drive.\n * @deprecated Open drives through the store's `navigation`; it builds the path. */\nexport function makeDriveUrlComponent(\n drive: DocumentDriveDocument | undefined,\n) {\n if (!drive) return \"\";\n return `/d/${slug(drive.header.slug)}`;\n}\n\n/** A drive's URL component: its slug, else its id, prefixed with the slugged\n * name as `<name>-<id>` when the id is opaque (a UUID or derived id). */\nexport function makeDriveSlug(drive: DocumentDriveDocument) {\n const { id, slug: driveSlug } = drive.header;\n if (driveSlug && driveSlug !== id) return driveSlug;\n return isOpaqueId(id) ? namedDriveSlug(drive) : id;\n}\n\nfunction isOpaqueId(id: string) {\n return findUuid(id) !== undefined || isDerivedDocumentId(id);\n}\n\nfunction namedDriveSlug(drive: DocumentDriveDocument) {\n const name = drive.state.global.name || drive.header.name;\n return namedSlug(drive, name, drive.header.id);\n}\n\nconst namedSlugs = new WeakMap<\n object,\n { name: string; id: string; value: string }\n>();\n\n// `<slugged name>-<id>`, cached per drive or node; inputs are rechecked.\nfunction namedSlug(owner: object, name: string, id: string) {\n const cached = namedSlugs.get(owner);\n if (cached?.name === name && cached.id === id) return cached.value;\n const nameSlug = name ? slug(name) : \"\";\n const value = nameSlug ? `${nameSlug}-${id}` : id;\n namedSlugs.set(owner, { name, id, value });\n return value;\n}\n\n/** The drive a URL slug names: its own slug, its id, or `<name>-<id>`. */\nexport function findDriveBySlug(\n drives: readonly DocumentDriveDocument[] | undefined,\n ref: string | undefined,\n) {\n if (!drives || !ref) return undefined;\n const exact = drives.find(\n (d) => d.header.slug === ref || d.header.id === ref,\n );\n if (exact) return exact;\n const id = extractDriveIdFromSlug(ref);\n if (id !== undefined) {\n const byId = drives.find((d) => d.header.id === id);\n if (byId) return byId;\n }\n // `<name>-<id>` also for a readable id, as older links wrote it.\n return drives.find(\n (d) =>\n (!d.header.slug || d.header.slug === d.header.id) &&\n ref.endsWith(d.header.id) &&\n namedDriveSlug(d) === ref,\n );\n}\n\n/**\n * Makes a URL component for a node: `<slugged name>-<id>`. The id is kept\n * verbatim, since a v2-required id is case-sensitive base64url.\n */\nexport function makeNodeSlug(node: Node | undefined) {\n if (!node) return \"\";\n return namedSlug(node, node.name, node.id);\n}\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 */\nexport function extractNodeSlugFromPath(path: string) {\n const currentPath = getPathWithoutBase(path);\n const match = /^\\/d\\/[^/]+\\/([^/]+)$/.exec(currentPath);\n return match?.[1];\n}\n\n/** Finds a UUID in a string, used for extracting node ids from node slugs in the URL. */\nexport function findUuid(input: string | undefined) {\n if (!input) return undefined;\n const uuidRegex =\n /\\b[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\\b/;\n const match = uuidRegex.exec(input);\n return match?.[0];\n}\n\n/** The v2-required document id a slug ends with, if any. */\nexport function findDerivedId(input: string | undefined) {\n if (!input || input.length < DERIVED_ID_LENGTH) return undefined;\n const start = input.length - DERIVED_ID_LENGTH;\n if (start > 0 && input[start - 1] !== \"-\") return undefined;\n const candidate = input.slice(start);\n return isDerivedDocumentId(candidate) ? candidate : undefined;\n}\n\nexport function extractNodeIdFromSlug(nodeSlug: string | undefined) {\n return findUuid(nodeSlug) ?? findDerivedId(nodeSlug);\n}\n\n/** @deprecated Route loaders resolve the node; use `extractNodeIdFromSlug`. */\nexport function extractNodeIdFromPath(path: string) {\n const nodeSlug = extractNodeSlugFromPath(path);\n const nodeId = extractNodeIdFromSlug(nodeSlug);\n return nodeId;\n}\n\n/** Extracts the drive slug from a path.\n * Used for extracting drive ids from drive slugs in the URL.\n * Expects the path to be in the format `/d/<drive-slug>`.\n */\nexport function extractDriveSlugFromPath(path: string) {\n const currentPath = getPathWithoutBase(path);\n const match = /^\\/d\\/([^/]+)/.exec(currentPath);\n return match?.[1] ?? \"\";\n}\n\nexport function extractDriveIdFromSlug(driveSlug: string | undefined) {\n return findUuid(driveSlug) ?? findDerivedId(driveSlug);\n}\n\n/** @deprecated Route loaders resolve the drive; use `extractDriveIdFromSlug`. */\nexport function extractDriveIdFromPath(path: string) {\n const driveSlug = extractDriveSlugFromPath(path);\n const driveId = extractDriveIdFromSlug(driveSlug);\n return driveId;\n}\n\n/** Creates a URL string with the given pathname, keeping the query string.\n * @deprecated The store's `navigation` keeps global params across navigations. */\nexport function createUrlWithPreservedParams(pathname: string): string {\n const search = window.location.search;\n return search ? `${pathname}${search}` : pathname;\n}\n","import type {\n PHNavigateOptions,\n PHNavigation,\n PHNavigationTarget,\n PHSearchUpdate,\n PHSettingsTarget,\n SearchParamsUpdate,\n} from \"@powerhousedao/reactor-browser\";\nimport { useMemo, useSyncExternalStore } from \"react\";\nimport { resolveUrlPathname } from \"../utils/url.js\";\nimport { getPHStore } from \"./ph-store.js\";\n\nconst isServer = typeof window === \"undefined\";\n\n/** Fired on `window` when the fallback navigator rewrites the URL. */\nexport const PH_LOCATION_CHANGE_EVENT = \"ph:locationchange\";\n\n/** Params read at boot or app-wide; they survive every navigation. Others,\n * e.g. a document's own, are dropped when the target changes. */\nexport const GLOBAL_SEARCH_PARAMS = [\n // A remote drive to add on boot.\n \"driveUrl\",\n // The theme override read by the inline theme boot script.\n \"theme\",\n // Embedded mode, which hides Connect's chrome.\n \"embed\",\n // Log level override for the feature-flag provider.\n \"LOG_LEVEL\",\n // The reactor worker runtime flag override.\n \"reactorWorker\",\n] as const;\n\n/** Feature flags are any `FEATURE_*` param, so they are retained by prefix. */\nexport const FEATURE_FLAG_PARAM_PREFIX = \"FEATURE_\";\n\n/** Whether `key` is a param every navigation keeps. */\nexport function isGlobalSearchParam(key: string) {\n return (\n (GLOBAL_SEARCH_PARAMS as readonly string[]).includes(key) ||\n key.startsWith(FEATURE_FLAG_PARAM_PREFIX)\n );\n}\n\nfunction globalSearch(search: string) {\n return Object.fromEntries(\n Object.entries(searchToRecord(search)).filter(([key]) =>\n isGlobalSearchParam(key),\n ),\n );\n}\n\n/** A query string's params; repeated keys keep their last value. */\nexport function searchToRecord(search: string): Record<string, string> {\n return Object.fromEntries(new URLSearchParams(search));\n}\n\n/** `prev` with `update` applied; an `undefined` value removes the key. */\nexport function applySearchUpdate(\n prev: Record<string, string>,\n update: PHSearchUpdate,\n): Record<string, string> {\n const next = { ...prev };\n for (const [key, value] of Object.entries(update)) {\n if (value === undefined) delete next[key];\n else next[key] = value;\n }\n return next;\n}\n\n/** `params` as a query string, with an empty value as a bare key: `history`, not `history=`. */\nexport function searchParamsToString(params: URLSearchParams) {\n return params.toString().replace(/=(?=&|$)/g, \"\");\n}\n\n/** `?a=1&b=2`, or an empty string for no params. */\nexport function recordToSearch(record: Record<string, string>) {\n const search = searchParamsToString(new URLSearchParams(record));\n return search ? `?${search}` : \"\";\n}\n\n/** The settings page's path; its tabs are below it. */\nexport const SETTINGS_PATH = \"/settings\";\n\nexport function isSettingsTarget(\n target: PHNavigationTarget | undefined,\n): target is PHSettingsTarget {\n return !!target && \"settings\" in target;\n}\n\n/** The pathname a target opens at, base path included. */\nexport function targetPathname(target: PHNavigationTarget | undefined) {\n if (!target) return resolveUrlPathname(\"/\");\n if (isSettingsTarget(target)) {\n const { settings } = target;\n return resolveUrlPathname(\n settings === true ? SETTINGS_PATH : `${SETTINGS_PATH}/${settings}`,\n );\n }\n const { driveSlug, nodeSlug } = target;\n return resolveUrlPathname(\n nodeSlug ? `/d/${driveSlug}/${nodeSlug}` : `/d/${driveSlug}`,\n );\n}\n\n/** History state key: the index of the entry a document was opened from. */\nexport const OPENED_FROM_STATE_KEY = \"phOpenedFrom\";\n\n// The fallback numbers its own entries; a router's history has its own index.\ntype BrowserEntryState = { phIndex?: number; phOpenedFrom?: number };\n\nfunction browserEntryState(): BrowserEntryState {\n const state: unknown = window.history.state;\n return state && typeof state === \"object\" ? (state as BrowserEntryState) : {};\n}\n\n/** The index to go back to from `index`, when it lies before it. */\nexport function openedFromIndex(\n state: object | undefined,\n index: number,\n): number | undefined {\n const from = (state as Record<string, unknown> | undefined)?.[\n OPENED_FROM_STATE_KEY\n ];\n return typeof from === \"number\" && from >= 0 && from < index\n ? from\n : undefined;\n}\n\n// `openedFrom` \"keep\" carries the current entry's, as an in-document write does.\nfunction writeBrowserUrl(\n href: string,\n replace: boolean | undefined,\n openedFrom: number | \"keep\" | undefined,\n) {\n const prev = browserEntryState();\n const index = prev.phIndex ?? 0;\n const from = openedFrom === \"keep\" ? prev.phOpenedFrom : openedFrom;\n // Keeps the entry's state, e.g. a router's history key, on a replace.\n if (replace) {\n window.history.replaceState(\n { ...prev, phIndex: index, phOpenedFrom: from },\n \"\",\n href,\n );\n } else {\n window.history.pushState(\n { phIndex: index + 1, phOpenedFrom: from },\n \"\",\n href,\n );\n }\n window.dispatchEvent(new Event(PH_LOCATION_CHANGE_EVENT));\n}\n\nfunction subscribeToLocation(onChange: () => void) {\n window.addEventListener(\"popstate\", onChange);\n window.addEventListener(PH_LOCATION_CHANGE_EVENT, onChange);\n return () => {\n window.removeEventListener(\"popstate\", onChange);\n window.removeEventListener(PH_LOCATION_CHANGE_EVENT, onChange);\n };\n}\n\nconst readSearch = () => window.location.search;\nconst readPathname = () => window.location.pathname;\nconst readServerPathname = () => \"\";\nconst readServerSearch = () => \"\";\n\nfunction setBrowserSearch(\n update: (prev: Record<string, string>) => PHSearchUpdate,\n options?: { replace?: boolean },\n) {\n const prev = searchToRecord(window.location.search);\n const next = recordToSearch(applySearchUpdate({}, update(prev)));\n if (next === recordToSearch(prev)) return;\n // Like a router's search update, this drops the hash.\n writeBrowserUrl(\n `${window.location.pathname}${next}`,\n options?.replace,\n \"keep\",\n );\n}\n\nfunction setBrowserSearchParams(\n update: SearchParamsUpdate,\n options?: { replace?: boolean },\n) {\n setBrowserSearch((prev) => resolveSearchUpdate(prev, update), options);\n}\n\n/** The fallback without a host: `window.location` and `window.history`. Only\n * the global params carry over to another target, as with a router. */\n// Set by sync-selection.ts, which imports this module: importing it here would be a cycle.\nlet syncSelectionAfterOpen = () => {};\n\n/** @internal Selects what the browser fallback opens; sync-selection.ts sets it. */\nexport function setBrowserOpenSync(sync: () => void) {\n syncSelectionAfterOpen = sync;\n}\n\nexport const browserNavigation: PHNavigation = {\n location: () => window.location,\n hrefFor: (target) =>\n `${targetPathname(target)}${recordToSearch(globalSearch(window.location.search))}`,\n useIsCurrent(target) {\n const pathname = useSyncExternalStore(\n subscribeToLocation,\n readPathname,\n readServerPathname,\n );\n return pathname === targetPathname(target);\n },\n open: (target, options) => {\n const prev = globalSearch(window.location.search);\n const search = options?.search\n ? applySearchUpdate(prev, options.search)\n : prev;\n const entry = browserEntryState();\n writeBrowserUrl(\n `${targetPathname(target)}${recordToSearch(search)}`,\n options?.replace,\n options?.replace ? entry.phOpenedFrom : (entry.phIndex ?? 0),\n );\n // No router selects for it, and pushState fires no popstate.\n syncSelectionAfterOpen();\n },\n closeOpened: () => {\n const entry = browserEntryState();\n const index = entry.phIndex ?? 0;\n const from = openedFromIndex(entry, index);\n if (from === undefined) return false;\n window.history.go(from - index);\n return true;\n },\n setSearch: setBrowserSearch,\n useSearchParams() {\n const search = useSyncExternalStore(\n subscribeToLocation,\n readSearch,\n readServerSearch,\n );\n return useMemo(() => searchToRecord(search), [search]);\n },\n useSetSearchParams: () => setBrowserSearchParams,\n};\n\n/** True when the store has a host navigation, not the browser fallback. */\nexport function hasHostNavigation() {\n return !isServer && getPHStore()?.navigation !== undefined;\n}\n\n/** The app store's navigation, else the browser fallback. */\nexport function getPHNavigation(): PHNavigation {\n return getPHStore()?.navigation ?? browserNavigation;\n}\n\n/** The current pathname as the navigation sees it, base path included. */\nexport function getCurrentPathname() {\n return getPHNavigation().location().pathname;\n}\n\n/** Opens `target`; without `search`, a target already open is left alone. */\nexport function openTarget(\n target: PHNavigationTarget | undefined,\n options?: PHNavigateOptions,\n) {\n openTargetWith(getPHNavigation(), target, options);\n}\n\n/** Opens `target` through `navigation`, unless it is open already. */\nexport function openTargetWith(\n navigation: PHNavigation,\n target: PHNavigationTarget | undefined,\n options?: PHNavigateOptions,\n) {\n const pathname = navigation.location().pathname;\n const targetPath = targetPathname(target);\n // On any tab, the settings page is open.\n const open =\n targetPath === pathname ||\n (isSettingsTarget(target) &&\n target.settings === true &&\n pathname.startsWith(`${targetPath}/`));\n if (!options?.search && open) return;\n navigation.open(target, options);\n}\n\n/** Asks the host navigation to warm `target`; a no-op without one. */\nexport function preloadTarget(target: PHNavigationTarget | undefined) {\n if (!hasHostNavigation()) return;\n getPHNavigation().preload?.(target);\n}\n\n/** The href `target` opens at through `navigation`, base path included. */\nexport function getTargetHref(\n target: PHNavigationTarget | undefined,\n navigation: PHNavigation = getPHNavigation(),\n) {\n return navigation.hrefFor?.(target) ?? targetPathname(target);\n}\n\nexport function resolveSearchUpdate(\n prev: Record<string, string>,\n update: SearchParamsUpdate,\n): Record<string, string> {\n return typeof update === \"function\"\n ? applySearchUpdate({}, update(prev))\n : applySearchUpdate(prev, update);\n}\n\n/** Rewrites the current query params through the app store's navigation. */\nexport function setSearchParams(\n update: SearchParamsUpdate,\n options?: { replace?: boolean },\n) {\n getPHNavigation().setSearch(\n (prev) => resolveSearchUpdate(prev, update),\n options,\n );\n}\n"],"mappings":";;;;;AASA,MAAM,oBAAoB;AAG1B,SAAgB,mBAAmB,MAAc;CAC/C,OAAO,IAAI,IACT,KAAK,QAAQ,QAAQ,EAAE,GACvB,OAAO,SAAS,UAAU,WAAW,CAAC,EAAE,YAAY,IACtD,CAAC,CAAC;AACJ;;AAGA,SAA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AO,CAAC,YAAY,WAAW,CAAC,EAAE,eAAe,KAAA;AACnD;;AAGA,SAAgB,kBAAgC;CAC9C,OAAO,WAAW,CAAC,EAAE,cAAc;AACrC;;AAGA,SAAgB,qBAAqB;CACnC,OAAO,gBAAgB,CAAC,CAAC,SAAS,CAAC,CAAC;AACtC;;AAGA,SAAgB,WACd,QACA,SACA;CACA,eAAe,gBAAgB,GAAG,QAAQ,OAAO;AACnD;;AAGA,SAAgB,eACd,YACA,QACA,SACA;CACA,MAAM,WAAW,WAAW,SAAS,CAAC,CAAC;CACvC,MAAM,aAAa,eAAe,MAAM;CAExC,MAAM,OACJ,eAAe,YACd,iBAAiB,MAAM,KACtB,OAAO,aAAa,QACpB,SAAS,WAAW,GAAG,WAAW,EAAE;CACxC,IAAI,CAAC,SAAS,UAAU,MAAM;CAC9B,WAAW,KAAK,QAAQ,OAAO;AACjC;;AAGA,SAAgB,cAAc,QAAwC;CACpE,IAAI,CAAC,kBAAkB,GAAG;CAC1B,gBAAgB,CAAC,CAAC,UAAU,MAAM;AACpC;;AAGA,SAAgB,cACd,QACA,aAA2B,gBAAgB,GAC3C;CACA,OAAO,WAAW,UAAU,MAAM,KAAK,eAAe,MAAM;AAC9D;AAEA,SAAgB,oBACd,MACA,QACwB;CACxB,OAAO,OAAO,WAAW,aACrB,kBAAkB,CAAC,GAAG,OAAO,IAAI,CAAC,IAClC,kBAAkB,MAAM,MAAM;AACpC;;AAGA,SAAgB,gBACd,QACA,SACA;CACA,gBAAgB,CAAC,CAAC,WACf,SAAS,oBAAoB,MAAM,MAAM,GAC1C,OACF;AACF"}
@@ -1,6 +1,6 @@
1
- import { u as getPHStore } from "./make-ph-event-functions-C1JTfEw1.js";
2
- import { u as getPHNavigation, w as setSearchParams } from "./navigation-BUPIObES.js";
3
- import { a as useRenown, c as RENOWN_INITIAL_UNKNOWN, i as useLoginStatus, l as RenownInitialUserProvider, n as setRenown, o as useUser, s as RENOWN_INITIAL_ANONYMOUS, t as addRenownEventHandler, u as useRenownInitialAuth } from "./renown-CGQYQsvH.js";
1
+ import { c as getPHStore } from "./make-ph-event-functions-B5GU5xcR.js";
2
+ import { C as setSearchParams, l as getPHNavigation } from "./navigation-BqphkrOB.js";
3
+ import { a as useRenown, c as RENOWN_INITIAL_UNKNOWN, i as useLoginStatus, l as RenownInitialUserProvider, n as setRenown, o as useUser, s as RENOWN_INITIAL_ANONYMOUS, t as addRenownEventHandler, u as useRenownInitialAuth } from "./renown-BxkZYzbQ.js";
4
4
  import { Children, cloneElement, createContext, forwardRef, isValidElement, useCallback, useContext, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  import { logger } from "document-model";
@@ -1396,4 +1396,4 @@ function useRenownWalletAdapter(id) {
1396
1396
  //#endregion
1397
1397
  export { RENOWN_CHAIN_ID as A, logout as C, CREDENTIAL_TYPES as D, CREDENTIAL_SUBJECT_TYPE as E, RENOWN_RETURN_URL_STRIPPED_PARAMS as M, RENOWN_URL as N, DOMAIN_TYPE as O, VERIFIABLE_CREDENTIAL_EIP712_TYPE as P, login as S, CREDENTIAL_SCHEMA_EIP712_TYPE as T, RenownLogo as _, Renown as a, useRenownAuth as b, useRenownSessionSynced as c, RenownAuthButton as d, RenownUserButton as f, DisconnectIcon as g, CopyIcon as h, RenownWalletProvider as i, RENOWN_NETWORK_ID as j, ISSUER_TYPE as k, initConnectCrypto as l, ChevronDownIcon as m, useRenownLoginMethods as n, useRenownInit as o, RenownLoginButton as p, RenownProvider as r, useRenownSessionCookie as s, useRenownWalletAdapter as t, initRenownCrypto as u, SpinnerIcon as v, openRenown as w, useRenownAuthAsync as x, UserIcon as y };
1398
1398
 
1399
- //# sourceMappingURL=renown-Dem71OWZ.js.map
1399
+ //# sourceMappingURL=renown-BtjgHBjH.js.map