@graphrefly/ts 0.0.0

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 (210) hide show
  1. package/LICENSE +21 -0
  2. package/dist/adapters/index.cjs +9015 -0
  3. package/dist/adapters/index.cjs.map +1 -0
  4. package/dist/adapters/index.d.cts +678 -0
  5. package/dist/adapters/index.d.ts +678 -0
  6. package/dist/adapters/index.js +2894 -0
  7. package/dist/adapters/index.js.map +1 -0
  8. package/dist/adapters/observe-storage.cjs +260 -0
  9. package/dist/adapters/observe-storage.cjs.map +1 -0
  10. package/dist/adapters/observe-storage.d.cts +77 -0
  11. package/dist/adapters/observe-storage.d.ts +77 -0
  12. package/dist/adapters/observe-storage.js +161 -0
  13. package/dist/adapters/observe-storage.js.map +1 -0
  14. package/dist/append-log-DisvEReb.d.cts +189 -0
  15. package/dist/append-log-DzKMmjxx.d.ts +189 -0
  16. package/dist/chunk-2ILL7HQI.js +1189 -0
  17. package/dist/chunk-2ILL7HQI.js.map +1 -0
  18. package/dist/chunk-4VLAQHZI.js +330 -0
  19. package/dist/chunk-4VLAQHZI.js.map +1 -0
  20. package/dist/chunk-6PHB5CJS.js +229 -0
  21. package/dist/chunk-6PHB5CJS.js.map +1 -0
  22. package/dist/chunk-COHO25CZ.js +2449 -0
  23. package/dist/chunk-COHO25CZ.js.map +1 -0
  24. package/dist/chunk-D6BG7U6A.js +161 -0
  25. package/dist/chunk-D6BG7U6A.js.map +1 -0
  26. package/dist/chunk-DJC4CHLQ.js +818 -0
  27. package/dist/chunk-DJC4CHLQ.js.map +1 -0
  28. package/dist/chunk-DK554R7P.js +67 -0
  29. package/dist/chunk-DK554R7P.js.map +1 -0
  30. package/dist/chunk-DKP56CSW.js +322 -0
  31. package/dist/chunk-DKP56CSW.js.map +1 -0
  32. package/dist/chunk-G4M3NHRJ.js +688 -0
  33. package/dist/chunk-G4M3NHRJ.js.map +1 -0
  34. package/dist/chunk-GAJW5I5P.js +1 -0
  35. package/dist/chunk-GAJW5I5P.js.map +1 -0
  36. package/dist/chunk-GDL26N2T.js +282 -0
  37. package/dist/chunk-GDL26N2T.js.map +1 -0
  38. package/dist/chunk-GTPCOEOZ.js +741 -0
  39. package/dist/chunk-GTPCOEOZ.js.map +1 -0
  40. package/dist/chunk-H2HTHFVN.js +1 -0
  41. package/dist/chunk-H2HTHFVN.js.map +1 -0
  42. package/dist/chunk-HDRL4VQQ.js +218 -0
  43. package/dist/chunk-HDRL4VQQ.js.map +1 -0
  44. package/dist/chunk-I3IHOHCJ.js +2267 -0
  45. package/dist/chunk-I3IHOHCJ.js.map +1 -0
  46. package/dist/chunk-JIMUDQN3.js +965 -0
  47. package/dist/chunk-JIMUDQN3.js.map +1 -0
  48. package/dist/chunk-JR4IKCR2.js +462 -0
  49. package/dist/chunk-JR4IKCR2.js.map +1 -0
  50. package/dist/chunk-K3FXTC3I.js +165 -0
  51. package/dist/chunk-K3FXTC3I.js.map +1 -0
  52. package/dist/chunk-OOEN33FB.js +65 -0
  53. package/dist/chunk-OOEN33FB.js.map +1 -0
  54. package/dist/chunk-PKVBHGBM.js +554 -0
  55. package/dist/chunk-PKVBHGBM.js.map +1 -0
  56. package/dist/chunk-RIIOUTGM.js +1857 -0
  57. package/dist/chunk-RIIOUTGM.js.map +1 -0
  58. package/dist/chunk-SCRFRCGR.js +33 -0
  59. package/dist/chunk-SCRFRCGR.js.map +1 -0
  60. package/dist/chunk-SWTLEQL6.js +53 -0
  61. package/dist/chunk-SWTLEQL6.js.map +1 -0
  62. package/dist/chunk-SZAETNNA.js +1 -0
  63. package/dist/chunk-SZAETNNA.js.map +1 -0
  64. package/dist/chunk-TEW47IVR.js +49 -0
  65. package/dist/chunk-TEW47IVR.js.map +1 -0
  66. package/dist/chunk-Y3ZLRGHC.js +1482 -0
  67. package/dist/chunk-Y3ZLRGHC.js.map +1 -0
  68. package/dist/chunk-Z2ANQ6JW.js +149 -0
  69. package/dist/chunk-Z2ANQ6JW.js.map +1 -0
  70. package/dist/codec-BB7p8fJc.d.cts +38 -0
  71. package/dist/codec-BB7p8fJc.d.ts +38 -0
  72. package/dist/composition/index.cjs +2505 -0
  73. package/dist/composition/index.cjs.map +1 -0
  74. package/dist/composition/index.d.cts +95 -0
  75. package/dist/composition/index.d.ts +95 -0
  76. package/dist/composition/index.js +19 -0
  77. package/dist/composition/index.js.map +1 -0
  78. package/dist/core/index.cjs +2475 -0
  79. package/dist/core/index.cjs.map +1 -0
  80. package/dist/core/index.d.cts +25 -0
  81. package/dist/core/index.d.ts +25 -0
  82. package/dist/core/index.js +74 -0
  83. package/dist/core/index.js.map +1 -0
  84. package/dist/cqrs/index.cjs +595 -0
  85. package/dist/cqrs/index.cjs.map +1 -0
  86. package/dist/cqrs/index.d.cts +200 -0
  87. package/dist/cqrs/index.d.ts +200 -0
  88. package/dist/cqrs/index.js +557 -0
  89. package/dist/cqrs/index.js.map +1 -0
  90. package/dist/data-structures/index.cjs +4277 -0
  91. package/dist/data-structures/index.cjs.map +1 -0
  92. package/dist/data-structures/index.d.cts +22 -0
  93. package/dist/data-structures/index.d.ts +22 -0
  94. package/dist/data-structures/index.js +31 -0
  95. package/dist/data-structures/index.js.map +1 -0
  96. package/dist/describe-BZb7AS2y.d.ts +57 -0
  97. package/dist/describe-Ciu8SUnN.d.cts +57 -0
  98. package/dist/graph/index.cjs +7832 -0
  99. package/dist/graph/index.cjs.map +1 -0
  100. package/dist/graph/index.d.cts +251 -0
  101. package/dist/graph/index.d.ts +251 -0
  102. package/dist/graph/index.js +131 -0
  103. package/dist/graph/index.js.map +1 -0
  104. package/dist/graph-DfdF9zy4.d.ts +666 -0
  105. package/dist/graph-s23RbbFO.d.cts +666 -0
  106. package/dist/index-CAEmLCYF.d.cts +166 -0
  107. package/dist/index-SnzZu3x7.d.ts +166 -0
  108. package/dist/index.cjs +15409 -0
  109. package/dist/index.cjs.map +1 -0
  110. package/dist/index.d.cts +23 -0
  111. package/dist/index.d.ts +23 -0
  112. package/dist/index.js +582 -0
  113. package/dist/index.js.map +1 -0
  114. package/dist/messages-BZqrGGm1.d.cts +55 -0
  115. package/dist/messages-BZqrGGm1.d.ts +55 -0
  116. package/dist/messaging/index.cjs +818 -0
  117. package/dist/messaging/index.cjs.map +1 -0
  118. package/dist/messaging/index.d.cts +235 -0
  119. package/dist/messaging/index.d.ts +235 -0
  120. package/dist/messaging/index.js +767 -0
  121. package/dist/messaging/index.js.map +1 -0
  122. package/dist/observe-event-log-0SVsx7JG.d.cts +88 -0
  123. package/dist/observe-event-log-Dnm76owp.d.ts +88 -0
  124. package/dist/operators/index.cjs +3774 -0
  125. package/dist/operators/index.cjs.map +1 -0
  126. package/dist/operators/index.d.cts +308 -0
  127. package/dist/operators/index.d.ts +308 -0
  128. package/dist/operators/index.js +112 -0
  129. package/dist/operators/index.js.map +1 -0
  130. package/dist/orchestration/index.cjs +3541 -0
  131. package/dist/orchestration/index.cjs.map +1 -0
  132. package/dist/orchestration/index.d.cts +302 -0
  133. package/dist/orchestration/index.d.ts +302 -0
  134. package/dist/orchestration/index.js +1004 -0
  135. package/dist/orchestration/index.js.map +1 -0
  136. package/dist/patterns/index.cjs +1045 -0
  137. package/dist/patterns/index.cjs.map +1 -0
  138. package/dist/patterns/index.d.cts +39 -0
  139. package/dist/patterns/index.d.ts +39 -0
  140. package/dist/patterns/index.js +33 -0
  141. package/dist/patterns/index.js.map +1 -0
  142. package/dist/reactive-collection-BxBqtIOE.d.cts +344 -0
  143. package/dist/reactive-collection-Cb1II1Fi.d.ts +344 -0
  144. package/dist/reactive-collection-storage-BNiEc-Gd.d.ts +217 -0
  145. package/dist/reactive-collection-storage-D-KmjE0J.d.cts +217 -0
  146. package/dist/reactive-map-BcB4KsQR.d.ts +256 -0
  147. package/dist/reactive-map-D-g3dv8I.d.cts +256 -0
  148. package/dist/read-through-B1CYPfq_.d.cts +82 -0
  149. package/dist/read-through-DwyJhGs1.d.ts +82 -0
  150. package/dist/render/index.cjs +250 -0
  151. package/dist/render/index.cjs.map +1 -0
  152. package/dist/render/index.d.cts +58 -0
  153. package/dist/render/index.d.ts +58 -0
  154. package/dist/render/index.js +20 -0
  155. package/dist/render/index.js.map +1 -0
  156. package/dist/resilience-Dig3Q7n0.d.cts +45 -0
  157. package/dist/resilience-Dig3Q7n0.d.ts +45 -0
  158. package/dist/semantic-memory-graph-BYoIlP35.d.cts +356 -0
  159. package/dist/semantic-memory-graph-CxyXLms3.d.ts +356 -0
  160. package/dist/solutions/index.cjs +3249 -0
  161. package/dist/solutions/index.cjs.map +1 -0
  162. package/dist/solutions/index.d.cts +520 -0
  163. package/dist/solutions/index.d.ts +520 -0
  164. package/dist/solutions/index.js +31 -0
  165. package/dist/solutions/index.js.map +1 -0
  166. package/dist/sources/browser.cjs +3095 -0
  167. package/dist/sources/browser.cjs.map +1 -0
  168. package/dist/sources/browser.d.cts +39 -0
  169. package/dist/sources/browser.d.ts +39 -0
  170. package/dist/sources/browser.js +137 -0
  171. package/dist/sources/browser.js.map +1 -0
  172. package/dist/sources/index.cjs +3021 -0
  173. package/dist/sources/index.cjs.map +1 -0
  174. package/dist/sources/index.d.cts +7 -0
  175. package/dist/sources/index.d.ts +7 -0
  176. package/dist/sources/index.js +63 -0
  177. package/dist/sources/index.js.map +1 -0
  178. package/dist/sources/node.cjs +675 -0
  179. package/dist/sources/node.cjs.map +1 -0
  180. package/dist/sources/node.d.cts +109 -0
  181. package/dist/sources/node.d.ts +109 -0
  182. package/dist/sources/node.js +639 -0
  183. package/dist/sources/node.js.map +1 -0
  184. package/dist/storage/browser.cjs +777 -0
  185. package/dist/storage/browser.cjs.map +1 -0
  186. package/dist/storage/browser.d.cts +40 -0
  187. package/dist/storage/browser.d.ts +40 -0
  188. package/dist/storage/browser.js +275 -0
  189. package/dist/storage/browser.js.map +1 -0
  190. package/dist/storage/index.cjs +1989 -0
  191. package/dist/storage/index.cjs.map +1 -0
  192. package/dist/storage/index.d.cts +92 -0
  193. package/dist/storage/index.d.ts +92 -0
  194. package/dist/storage/index.js +161 -0
  195. package/dist/storage/index.js.map +1 -0
  196. package/dist/storage/node.cjs +898 -0
  197. package/dist/storage/node.cjs.map +1 -0
  198. package/dist/storage/node.d.cts +66 -0
  199. package/dist/storage/node.d.ts +66 -0
  200. package/dist/storage/node.js +402 -0
  201. package/dist/storage/node.js.map +1 -0
  202. package/dist/testing/index.cjs +95 -0
  203. package/dist/testing/index.cjs.map +1 -0
  204. package/dist/testing/index.d.cts +20 -0
  205. package/dist/testing/index.d.ts +20 -0
  206. package/dist/testing/index.js +8 -0
  207. package/dist/testing/index.js.map +1 -0
  208. package/dist/types-bNMSWKqF.d.cts +732 -0
  209. package/dist/types-h12mNYbq.d.ts +732 -0
  210. package/package.json +250 -0
@@ -0,0 +1,256 @@
1
+ import { N as Node } from './types-bNMSWKqF.cjs';
2
+ import { J as CollectionCoreOptions, s as ReactiveOpt, L as ListChange, V as ViewCachePolicy, c as LogChange, t as ReactiveView, u as RetentionPolicy, M as MapChange } from './reactive-collection-BxBqtIOE.cjs';
3
+
4
+ /**
5
+ * Reactive positional list (CSP-2.8, D54/D60) — the two-port collection template.
6
+ *
7
+ * Shape (D60 + review #2): a mutable array BACKEND (the single materialized state) + the shared
8
+ * {@link collectionCore} two ports — a DELTA stream ({@link ReactiveList.delta}, one event per
9
+ * mutation, O(1)) and a lazy pull SNAPSHOT ({@link ReactiveList.snapshot}, materialized only on a
10
+ * cone-routed RESUME demand). Mutation input is D54 A3 hybrid: ergonomic imperative methods (the
11
+ * external boundary, state-verb-legitimate, D4) + `appendFrom(src)` widening (an in-graph producer
12
+ * drives the list with zero imperative glue). Synchronous quick-reads (`at`/`size`/`toArray`) are
13
+ * the deliberately-non-reactive peek for cold/imperative reads (D60).
14
+ *
15
+ * Per-language (D6/D24, never in parity, no conformance — the substrate pull is already C-16).
16
+ */
17
+
18
+ type ReactiveListOpt<T> = ReactiveOpt<T>;
19
+ interface ReactiveListOptions extends CollectionCoreOptions {
20
+ /**
21
+ * Head-trim capacity policy (D72). A static number caps the list locally; a Node-valued maxSize
22
+ * must be graph-bound and becomes a declared policy dep that trims on policy changes.
23
+ */
24
+ maxSize?: ReactiveListOpt<number>;
25
+ }
26
+ interface ReactiveList<T> {
27
+ /** DELTA stream: one {@link ListChange} per mutation (O(1)). Subscribe to observe events. */
28
+ readonly delta: Node<ListChange<T>>;
29
+ /** SNAPSHOT pull node: demand via `ctx.upNext([[RESUME, pullId]])` → one `readonly T[]` (lazy O(n)). */
30
+ readonly snapshot: Node<readonly T[]>;
31
+ /** The snapshot node's pullId — write it verbatim into the demander's fn (D59). */
32
+ readonly pullId: symbol;
33
+ /** Current entry count (O(1), synchronous non-reactive read). */
34
+ readonly size: number;
35
+ /** Positional access (O(1)); negative indices Python-style; `undefined` out of range. Sync read. */
36
+ at(index: number): T | undefined;
37
+ /** Full current contents (O(n), fresh defensive copy). Sync non-reactive read (cold-start peek). */
38
+ toArray(): readonly T[];
39
+ append(value: T): void;
40
+ /** Append all values; one delta event + one snapshot-arm. No-op if `values` is empty. */
41
+ appendMany(values: readonly T[]): void;
42
+ /** Insert at `index` (0..size). Throws `RangeError` out of range. */
43
+ insert(index: number, value: T): void;
44
+ /** Insert all at `index` as one op. No-op if `values` is empty. Throws out of range. */
45
+ insertMany(index: number, values: readonly T[]): void;
46
+ /** Remove and return the value at `index` (default last; negative Python-style). Throws if empty/out of range. */
47
+ pop(index?: number): T;
48
+ clear(): void;
49
+ /** D54 widening: every value from `src` is appended. Returns a disposer. */
50
+ appendFrom(src: Node<T>): () => void;
51
+ /** Release the widening subscriptions (idempotent). */
52
+ dispose(): void;
53
+ }
54
+ /**
55
+ * Create a reactive list (D54/D60). The DELTA + SNAPSHOT ports + pullId come from the shared
56
+ * {@link collectionCore}; this layer adds the typed list method surface + backend.
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * const list = reactiveList<number>([1]);
61
+ * // observe events:
62
+ * list.delta.subscribe((m) => { if (m[0] === "DATA") console.log("Δ", m[1]); });
63
+ * list.append(2); // delta: {kind:"append", value:2}
64
+ * // demand the snapshot (a downstream consumer, holding `list.snapshot` upstream, runs):
65
+ * // ctx.upNext([["RESUME", list.pullId]]); → SNAPSHOT delivers [1, 2]
66
+ * list.toArray(); // [1, 2] (synchronous non-reactive read)
67
+ * ```
68
+ */
69
+ declare function reactiveList<T>(initial?: readonly T[], options?: ReactiveListOptions): ReactiveList<T>;
70
+
71
+ /**
72
+ * Reactive append-only log (CSP-2.8, D54/D60) — two-port collection with incremental views.
73
+ *
74
+ * Shape = the shared {@link collectionCore} two ports over an array (or ring-buffer if `maxSize`)
75
+ * BACKEND (D60). Specializations (D60 #5 / review #5):
76
+ * - SNAPSHOT (the full `readonly T[]`) is the lazy pull port like the others, BUT the log's main
77
+ * consumption is INCREMENTAL: `tail()` / `slice()` / `scan()` re-derive on the DELTA backbone
78
+ * (dep=[delta]), folding each appended value as it arrives — NOT re-scanning a pushed full array.
79
+ * - `append(undefined)` throws: `undefined` is the substrate SENTINEL (R-data-payload / R-sentinel),
80
+ * not a valid value.
81
+ * - empty log: the snapshot is `[]` (a real empty array); a never-appended `scan` seeds its initial.
82
+ * There is NO `[[RESOLVED]]`-for-empty dual role (D49 narrowed RESOLVED to undirty-only, D60 #5b).
83
+ * - `attach(upstream)` = the D54 widening (a declared input-fold dep), NOT an imperative subscribe.
84
+ * - {@link mergeReactiveLogs} is a DECLARED-DEP merge (deps=[...delta streams]), NOT the old
85
+ * internal-subscribe island (D45 must-fix, D60 #5e).
86
+ * - storage persistence = D57 (binding-layer observe-sink), out of scope here.
87
+ *
88
+ * Per-language (D6/D24, never in parity, no conformance — the substrate pull is already C-16).
89
+ */
90
+
91
+ interface ReactiveLogOptions extends CollectionCoreOptions {
92
+ /** Ring-buffer cap: appends past `maxSize` evict the oldest (head-trim, append-only-safe). */
93
+ maxSize?: number;
94
+ /** Static D80 memo policy for D121 light views. Eviction does not dispose returned views. */
95
+ viewCache?: ViewCachePolicy;
96
+ }
97
+ interface ReactiveLog<T> {
98
+ readonly delta: Node<LogChange<T>>;
99
+ /** SNAPSHOT pull node: demand → full `readonly T[]` (lazy O(n)). For incremental use {@link tail}, {@link slice}, or {@link scan}. */
100
+ readonly snapshot: Node<readonly T[]>;
101
+ readonly pullId: symbol;
102
+ /** Entry count (O(1)). Sync non-reactive read. */
103
+ readonly size: number;
104
+ /** Positional access (O(1)); negative Python-style; `undefined` out of range. Sync read. */
105
+ at(index: number): T | undefined;
106
+ /** Full contents (O(n) fresh copy). Sync non-reactive read (cold-start peek). */
107
+ toArray(): readonly T[];
108
+ /** Append one value. Throws on `undefined` (substrate SENTINEL, R-data-payload). */
109
+ append(value: T): void;
110
+ /** Append many; one delta event. No-op if empty. Throws if any value is `undefined`. */
111
+ appendMany(values: readonly T[]): void;
112
+ clear(): void;
113
+ /** Remove the first `n` entries (clamped to size). */
114
+ trimHead(n: number): void;
115
+ /**
116
+ * Incremental tail view: a derived node emitting the last `n` entries, recomputed on each delta
117
+ * (dep=[delta], D60 #5a). Memoized per `n` until {@link dispose}; use stable ranges for
118
+ * long-lived logs. Subscribe to keep it live.
119
+ */
120
+ tail(n: number): Node<readonly T[]>;
121
+ /**
122
+ * Incremental positional view: a derived node emitting `toArray().slice(start, stop)`,
123
+ * recomputed on each delta (dep=[delta], D60 #5a). Memoized per `[start, stop]` until
124
+ * {@link dispose}; use stable ranges for long-lived logs.
125
+ */
126
+ slice(start: number, stop?: number): Node<readonly T[]>;
127
+ /**
128
+ * D121 light page view: `delta` forwards parent log mutations, and `snapshot` is a pull node
129
+ * that materializes the current page on demand.
130
+ */
131
+ page(offset: number, limit: number): ReactiveView<LogChange<T>, readonly T[]>;
132
+ /**
133
+ * Incremental running aggregate over appended values (dep=[delta], D60 #5a). O(1) per append —
134
+ * folds only the new values each delta; resets on `clear`/`trimHead` (a non-append delta) via a
135
+ * full re-fold. Emits the current accumulator on every mutation; seeds `initial` on an empty log.
136
+ */
137
+ scan<A>(initial: A, step: (acc: A, value: T) => A): Node<A>;
138
+ /** D54 widening: every value from `src` is appended. Returns a disposer. */
139
+ attach(src: Node<T>): () => void;
140
+ dispose(): void;
141
+ }
142
+ /**
143
+ * Create an append-only reactive log (D54/D60). DELTA + lazy pull SNAPSHOT + pullId via
144
+ * {@link collectionCore}; this layer adds the typed append surface + incremental view/scan.
145
+ */
146
+ declare function reactiveLog<T>(initial?: readonly T[], options?: ReactiveLogOptions): ReactiveLog<T>;
147
+ /**
148
+ * Fan-in N reactive logs into one merged DELTA stream (D60 #5e — a DECLARED-DEP merge, NOT the old
149
+ * internal-subscribe island). The returned node declares each log's `delta` as a dep (`partial`)
150
+ * and re-emits every change it sees — describe shows `log[i].delta → merged` truthfully (D45).
151
+ * For the merged SNAPSHOT, fold the merged delta with {@link ReactiveLog.scan}-style logic, or
152
+ * demand each source's snapshot independently.
153
+ */
154
+ declare function mergeReactiveLogs<T>(logs: readonly ReactiveLog<T>[]): Node<LogChange<T>>;
155
+ /**
156
+ * Standalone incremental scan over a reactive log. Equivalent to `log.scan(initial, step)`;
157
+ * provided for pipe-builder and helper-composition call sites.
158
+ */
159
+ declare function scanLog<T, A>(log: ReactiveLog<T>, initial: A, step: (acc: A, value: T) => A): Node<A>;
160
+
161
+ /**
162
+ * Reactive key–value map (CSP-2.8, D54/D60/D68) — two-port collection with policy opts.
163
+ *
164
+ * Shape = the shared {@link collectionCore} two ports over a `Map` BACKEND (D60). Specializations
165
+ * (D60 #3 / review #3):
166
+ * - TTL/LRU are node-as-opt policies (D68). Static `maxSize` / `defaultTtl` values become constant
167
+ * policy deps; Node-valued opts are declared deps. The graph-visible `reactiveMap.apply` node is
168
+ * the normal backend mutation path and emits the public delta payloads it materializes.
169
+ * - LAZY TTL (no background timer): expiry is checked at read (`get`/`has`) + at synchronous
170
+ * snapshot materialization (`toMap`/`pruneExpired`). A read/prune that deletes an expired key
171
+ * emits the normal delta `delete{reason:"expired"}` (D61). Snapshot demand uses an internal pull
172
+ * `snapshotPrep` node: it prunes expired entries and reads the backend once, then public
173
+ * `snapshot` and `delta` derive from that declared prep payload. No snapshot fn drives its own
174
+ * dep (D37).
175
+ * - delete-reason enum {expired|lru-evict|archived|explicit} on the delta (D60 #3c).
176
+ * - LRU `maxSize`: an over-cap `set` evicts the oldest, emitting a `delete{reason:"lru-evict"}`.
177
+ * A live-key `get`/`has` touches LRU order WITHOUT a version bump (internal, D60 #3d).
178
+ * - retention (score-archive, D72): `retention.maxSize` is a value-or-Node numeric policy and
179
+ * the static scorer selects archive victims through the normal `reactiveMap.apply` path.
180
+ *
181
+ * Per-language (D6/D24, never in parity, no conformance — the substrate pull is already C-16).
182
+ */
183
+
184
+ type ReactiveMapOpt<T> = ReactiveOpt<T>;
185
+ interface ReactiveMapRetentionEntry<K, V> {
186
+ readonly key: K;
187
+ readonly value: V;
188
+ }
189
+ interface ReactiveMapRetentionPolicy<K, V> extends RetentionPolicy<ReactiveMapRetentionEntry<K, V>> {
190
+ /** Archive capacity. Unlike LRU, zero is allowed and archives every live entry. */
191
+ readonly maxSize?: ReactiveMapOpt<number>;
192
+ /** Higher scores are retained; lowest finite scores are archived first. */
193
+ score(entry: ReactiveMapRetentionEntry<K, V>): number;
194
+ }
195
+ interface ReactiveMapOptions<K = unknown, V = unknown> extends CollectionCoreOptions {
196
+ /**
197
+ * LRU cap as a node-as-opt policy (D68). A static number is a constant policy config; a Node must
198
+ * be graph-bound and becomes a declared dep of `reactiveMap.apply`.
199
+ */
200
+ maxSize?: ReactiveMapOpt<number>;
201
+ /**
202
+ * Default TTL in milliseconds as a node-as-opt policy (D68). Per-call `set(...,{ttl})` overrides.
203
+ * Lazy expiry only; no active timer in this cut.
204
+ */
205
+ defaultTtl?: ReactiveMapOpt<number>;
206
+ /**
207
+ * Score-based retention/archive policy (D72). The scorer is static local code; only maxSize can be
208
+ * a Node-valued policy, keeping graph describe data serializable while apply owns the mutation.
209
+ */
210
+ retention?: ReactiveMapRetentionPolicy<K, V>;
211
+ /** Static D80 memo policy for D121 light views. Eviction does not dispose returned views. */
212
+ viewCache?: ViewCachePolicy;
213
+ /** Injectable monotonic-ish clock for TTL (default `Date.now`). Graph-local clock = follow-up (D26). */
214
+ now?: () => number;
215
+ }
216
+ interface ReactiveMap<K, V> {
217
+ readonly delta: Node<MapChange<K, V>>;
218
+ readonly snapshot: Node<ReadonlyMap<K, V>>;
219
+ readonly pullId: symbol;
220
+ /** Raw entry count (O(1)); may include not-yet-pruned expired entries. Sync non-reactive read. */
221
+ readonly size: number;
222
+ /** Get a live value (prunes the key if expired). Sync read. */
223
+ get(key: K): V | undefined;
224
+ /** Live-key existence (prunes if expired). Sync read. */
225
+ has(key: K): boolean;
226
+ /** Current live (non-expired) entries (fresh copy). Sync non-reactive read (cold-start peek). */
227
+ toMap(): ReadonlyMap<K, V>;
228
+ /**
229
+ * D121 light selected-map view. `delta` forwards parent map mutations, and `snapshot` is a pull
230
+ * node that materializes the currently matching live entries on demand.
231
+ */
232
+ select(predicate: (value: V, key: K) => boolean): ReactiveView<MapChange<K, V>, ReadonlyMap<K, V>>;
233
+ set(key: K, value: V, opts?: {
234
+ ttl?: number;
235
+ }): void;
236
+ /** Bulk set; one delta event per entry, one snapshot-arm. No-op if empty. */
237
+ setMany(entries: Iterable<readonly [K, V]>, opts?: {
238
+ ttl?: number;
239
+ }): void;
240
+ delete(key: K): void;
241
+ /** Bulk delete; one delta per removed key. No-op if none present. */
242
+ deleteMany(keys: Iterable<K>): void;
243
+ clear(): void;
244
+ /** Explicitly prune expired entries; every removed key emits `delete{reason:"expired"}` (D61). */
245
+ pruneExpired(): void;
246
+ /** D54 widening: every `[key, value]` from `src` is set. Returns a disposer. */
247
+ setFrom(src: Node<readonly [K, V]>): () => void;
248
+ dispose(): void;
249
+ }
250
+ /**
251
+ * Create a reactive map (D54/D60). DELTA stream of {@link MapChange} + lazy pull SNAPSHOT (a
252
+ * `ReadonlyMap`) + pullId via {@link collectionCore}; this layer adds the typed map surface.
253
+ */
254
+ declare function reactiveMap<K, V>(options?: ReactiveMapOptions<K, V>): ReactiveMap<K, V>;
255
+
256
+ export { type ReactiveList as R, type ReactiveListOpt as a, type ReactiveListOptions as b, type ReactiveLog as c, type ReactiveLogOptions as d, type ReactiveMap as e, type ReactiveMapOpt as f, type ReactiveMapOptions as g, type ReactiveMapRetentionEntry as h, type ReactiveMapRetentionPolicy as i, reactiveLog as j, reactiveMap as k, mergeReactiveLogs as m, reactiveList as r, scanLog as s };
@@ -0,0 +1,82 @@
1
+ import { K as KvGeneration, f as KvStorageTier } from './append-log-DisvEReb.cjs';
2
+
3
+ /** Result tier for read-through output facts. */
4
+ interface ReadThroughLookupTier {
5
+ /** Tier index in the ordered lookup list. `-1` = optional loader fallback. */
6
+ readonly index: number;
7
+ /** Optional human-facing tier name. */
8
+ readonly name?: string;
9
+ }
10
+ /** Ordered lookup result from a single tier or loader attempt. */
11
+ type ReadThroughOutcome = "hit" | "miss" | "error";
12
+ /** Fact for one lookup attempt (one tier or the optional loader fallback). */
13
+ interface ReadThroughLookupFact<T> {
14
+ readonly kind: ReadThroughOutcome;
15
+ readonly key: string;
16
+ readonly tier: ReadThroughLookupTier;
17
+ readonly value?: T;
18
+ readonly generation?: KvGeneration;
19
+ readonly error?: unknown;
20
+ }
21
+ /** Result of one promotion write attempt to an earlier tier. */
22
+ interface ReadThroughPromotionFact {
23
+ readonly tier: ReadThroughLookupTier;
24
+ readonly ok: boolean;
25
+ readonly error?: unknown;
26
+ }
27
+ /** Final read-through outcome, with explicit lookup facts and promotion facts. */
28
+ interface TieredReadThroughResult<T> {
29
+ readonly status: "hit" | "miss" | "error";
30
+ readonly key: string;
31
+ readonly value?: T;
32
+ readonly hitTier?: ReadThroughLookupTier;
33
+ readonly facts: readonly ReadThroughLookupFact<T>[];
34
+ readonly promotions: readonly ReadThroughPromotionFact[];
35
+ }
36
+ /** Optional hook/context for lookup misses. */
37
+ interface ReadThroughMissContext {
38
+ readonly key: string;
39
+ readonly tier: ReadThroughLookupTier;
40
+ }
41
+ /** Optional hook/context for get/load/promotion errors. */
42
+ interface ReadThroughErrorContext {
43
+ readonly key: string;
44
+ readonly tier: ReadThroughLookupTier;
45
+ readonly stage: "lookup" | "promotion";
46
+ readonly error: unknown;
47
+ }
48
+ /** Configuration for `tieredReadThrough`. */
49
+ interface TieredReadThroughOptions<T> {
50
+ /** Lookup key for all tiers. */
51
+ readonly key: string;
52
+ /** Ordered lookup tiers, index 0 = hottest/fastest. */
53
+ readonly tiers: readonly KvStorageTier<T>[];
54
+ /** Optional friendly tier names, matched by index. */
55
+ readonly tierNames?: readonly string[];
56
+ /**
57
+ * Optional loader fallback for cache-miss. If provided and no tier hits, this runs
58
+ * after all tiers are checked and may write-through by promotion logic.
59
+ */
60
+ readonly load?: (key: string) => Promise<T | undefined> | T | undefined;
61
+ /**
62
+ * Optional promotion policy: set hit values to earlier (lower-index) tiers.
63
+ * `false` disables promotion; default promotes to all earlier tiers on any hit.
64
+ * Explicit indices can narrow promotion targets.
65
+ */
66
+ readonly promoteTo?: readonly number[] | false;
67
+ /** Optional callbacks for control-plane observability. */
68
+ readonly onMiss?: (context: ReadThroughMissContext) => void;
69
+ /** Called for lookup/load errors and promotion failures by default. */
70
+ readonly onError?: (context: ReadThroughErrorContext) => void;
71
+ }
72
+ /** Alias for callers that prefer loader-oriented naming. */
73
+ declare function readThroughKv<T>(opts: TieredReadThroughOptions<T>): Promise<TieredReadThroughResult<T>>;
74
+ /**
75
+ * Build explicit lookup facts across tiers plus optional loader fallback (D104 layer 1).
76
+ *
77
+ * This is a passive storage/domain helper: it creates no graph nodes, performs no hydration or
78
+ * restore, and treats promotion writes as facts rather than a graph commit barrier.
79
+ */
80
+ declare function tieredReadThrough<T>(opts: TieredReadThroughOptions<T>): Promise<TieredReadThroughResult<T>>;
81
+
82
+ export { type ReadThroughErrorContext as R, type TieredReadThroughOptions as T, type ReadThroughLookupFact as a, type ReadThroughLookupTier as b, type ReadThroughMissContext as c, type ReadThroughPromotionFact as d, type TieredReadThroughResult as e, readThroughKv as r, tieredReadThrough as t };
@@ -0,0 +1,82 @@
1
+ import { K as KvGeneration, f as KvStorageTier } from './append-log-DzKMmjxx.js';
2
+
3
+ /** Result tier for read-through output facts. */
4
+ interface ReadThroughLookupTier {
5
+ /** Tier index in the ordered lookup list. `-1` = optional loader fallback. */
6
+ readonly index: number;
7
+ /** Optional human-facing tier name. */
8
+ readonly name?: string;
9
+ }
10
+ /** Ordered lookup result from a single tier or loader attempt. */
11
+ type ReadThroughOutcome = "hit" | "miss" | "error";
12
+ /** Fact for one lookup attempt (one tier or the optional loader fallback). */
13
+ interface ReadThroughLookupFact<T> {
14
+ readonly kind: ReadThroughOutcome;
15
+ readonly key: string;
16
+ readonly tier: ReadThroughLookupTier;
17
+ readonly value?: T;
18
+ readonly generation?: KvGeneration;
19
+ readonly error?: unknown;
20
+ }
21
+ /** Result of one promotion write attempt to an earlier tier. */
22
+ interface ReadThroughPromotionFact {
23
+ readonly tier: ReadThroughLookupTier;
24
+ readonly ok: boolean;
25
+ readonly error?: unknown;
26
+ }
27
+ /** Final read-through outcome, with explicit lookup facts and promotion facts. */
28
+ interface TieredReadThroughResult<T> {
29
+ readonly status: "hit" | "miss" | "error";
30
+ readonly key: string;
31
+ readonly value?: T;
32
+ readonly hitTier?: ReadThroughLookupTier;
33
+ readonly facts: readonly ReadThroughLookupFact<T>[];
34
+ readonly promotions: readonly ReadThroughPromotionFact[];
35
+ }
36
+ /** Optional hook/context for lookup misses. */
37
+ interface ReadThroughMissContext {
38
+ readonly key: string;
39
+ readonly tier: ReadThroughLookupTier;
40
+ }
41
+ /** Optional hook/context for get/load/promotion errors. */
42
+ interface ReadThroughErrorContext {
43
+ readonly key: string;
44
+ readonly tier: ReadThroughLookupTier;
45
+ readonly stage: "lookup" | "promotion";
46
+ readonly error: unknown;
47
+ }
48
+ /** Configuration for `tieredReadThrough`. */
49
+ interface TieredReadThroughOptions<T> {
50
+ /** Lookup key for all tiers. */
51
+ readonly key: string;
52
+ /** Ordered lookup tiers, index 0 = hottest/fastest. */
53
+ readonly tiers: readonly KvStorageTier<T>[];
54
+ /** Optional friendly tier names, matched by index. */
55
+ readonly tierNames?: readonly string[];
56
+ /**
57
+ * Optional loader fallback for cache-miss. If provided and no tier hits, this runs
58
+ * after all tiers are checked and may write-through by promotion logic.
59
+ */
60
+ readonly load?: (key: string) => Promise<T | undefined> | T | undefined;
61
+ /**
62
+ * Optional promotion policy: set hit values to earlier (lower-index) tiers.
63
+ * `false` disables promotion; default promotes to all earlier tiers on any hit.
64
+ * Explicit indices can narrow promotion targets.
65
+ */
66
+ readonly promoteTo?: readonly number[] | false;
67
+ /** Optional callbacks for control-plane observability. */
68
+ readonly onMiss?: (context: ReadThroughMissContext) => void;
69
+ /** Called for lookup/load errors and promotion failures by default. */
70
+ readonly onError?: (context: ReadThroughErrorContext) => void;
71
+ }
72
+ /** Alias for callers that prefer loader-oriented naming. */
73
+ declare function readThroughKv<T>(opts: TieredReadThroughOptions<T>): Promise<TieredReadThroughResult<T>>;
74
+ /**
75
+ * Build explicit lookup facts across tiers plus optional loader fallback (D104 layer 1).
76
+ *
77
+ * This is a passive storage/domain helper: it creates no graph nodes, performs no hydration or
78
+ * restore, and treats promotion writes as facts rather than a graph commit barrier.
79
+ */
80
+ declare function tieredReadThrough<T>(opts: TieredReadThroughOptions<T>): Promise<TieredReadThroughResult<T>>;
81
+
82
+ export { type ReadThroughErrorContext as R, type TieredReadThroughOptions as T, type ReadThroughLookupFact as a, type ReadThroughLookupTier as b, type ReadThroughMissContext as c, type ReadThroughPromotionFact as d, type TieredReadThroughResult as e, readThroughKv as r, tieredReadThrough as t };
@@ -0,0 +1,250 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/render/index.ts
21
+ var render_exports = {};
22
+ __export(render_exports, {
23
+ describeToAscii: () => describeToAscii,
24
+ describeToD2: () => describeToD2,
25
+ describeToJson: () => describeToJson,
26
+ describeToMermaid: () => describeToMermaid,
27
+ describeToMermaidUrl: () => describeToMermaidUrl,
28
+ describeToPretty: () => describeToPretty,
29
+ mermaidLiveUrl: () => mermaidLiveUrl
30
+ });
31
+ module.exports = __toCommonJS(render_exports);
32
+
33
+ // src/graph/render.ts
34
+ function describeToMermaid(snapshot, opts = {}) {
35
+ const direction = normalizeDirection(opts.direction);
36
+ const flat = flattenDescribe(snapshot);
37
+ const nodes = sortedNodes(flat.nodes);
38
+ const ids = /* @__PURE__ */ new Map();
39
+ for (let i = 0; i < nodes.length; i += 1) ids.set(nodes[i].id, `n${i}`);
40
+ const lines = [`flowchart ${direction}`];
41
+ for (const node of nodes) {
42
+ lines.push(` ${ids.get(node.id)}["${escapeMermaidLabel(node.id)}"]`);
43
+ }
44
+ for (const edge of sortedEdges(flat.edges)) {
45
+ const from = ids.get(edge.from);
46
+ const to = ids.get(edge.to);
47
+ if (from === void 0 || to === void 0) continue;
48
+ lines.push(` ${from} --> ${to}`);
49
+ }
50
+ return lines.join("\n");
51
+ }
52
+ function mermaidLiveUrl(mermaidSource, opts = {}) {
53
+ const payload = {
54
+ code: mermaidSource,
55
+ mermaid: { theme: opts.theme ?? "default" },
56
+ autoSync: opts.autoSync ?? true
57
+ };
58
+ return `https://mermaid.live/edit#base64:${base64UrlEncode(JSON.stringify(payload))}`;
59
+ }
60
+ function describeToMermaidUrl(snapshot, opts = {}) {
61
+ return mermaidLiveUrl(describeToMermaid(snapshot, opts), opts);
62
+ }
63
+ function describeToD2(snapshot, opts = {}) {
64
+ const direction = normalizeDirection(opts.direction);
65
+ const flat = flattenDescribe(snapshot);
66
+ const nodes = sortedNodes(flat.nodes);
67
+ const ids = /* @__PURE__ */ new Map();
68
+ for (let i = 0; i < nodes.length; i += 1) ids.set(nodes[i].id, `n${i}`);
69
+ const lines = [`direction: ${d2Direction(direction)}`];
70
+ for (const node of nodes) {
71
+ lines.push(`${ids.get(node.id)}: "${escapeD2Label(node.id)}"`);
72
+ }
73
+ for (const edge of sortedEdges(flat.edges)) {
74
+ const from = ids.get(edge.from);
75
+ const to = ids.get(edge.to);
76
+ if (from === void 0 || to === void 0) continue;
77
+ lines.push(`${from} -> ${to}`);
78
+ }
79
+ return lines.join("\n");
80
+ }
81
+ function describeToPretty(snapshot, opts = {}) {
82
+ const flat = flattenDescribe(snapshot);
83
+ const includeEdges = opts.includeEdges ?? true;
84
+ const lines = [`Graph ${flat.name ?? "(anonymous)"}`, "Nodes:"];
85
+ for (const node of sortedNodes(flat.nodes)) {
86
+ lines.push(`- ${node.id} (${node.factory}/${node.status}): ${formatValue(node)}`);
87
+ }
88
+ if (includeEdges) {
89
+ lines.push("Edges:");
90
+ for (const edge of sortedEdges(flat.edges)) lines.push(`- ${edge.from} -> ${edge.to}`);
91
+ }
92
+ return lines.join("\n");
93
+ }
94
+ function describeToAscii(snapshot, opts = {}) {
95
+ const flat = flattenDescribe(snapshot);
96
+ const outgoing = /* @__PURE__ */ new Map();
97
+ for (const edge of sortedEdges(flat.edges)) {
98
+ const list = outgoing.get(edge.from);
99
+ if (list) list.push(edge.to);
100
+ else outgoing.set(edge.from, [edge.to]);
101
+ }
102
+ const lines = [`Graph ${flat.name ?? "(anonymous)"}`];
103
+ for (const node of sortedNodes(flat.nodes)) {
104
+ const value = opts.includeValues ? ` ${formatValue(node)}` : "";
105
+ const to = outgoing.get(node.id)?.join(", ") ?? "-";
106
+ lines.push(`${node.id} [${node.factory}/${node.status}${value}] -> ${to}`);
107
+ }
108
+ return lines.join("\n");
109
+ }
110
+ function describeToJson(snapshot, opts = {}) {
111
+ const includeEdges = opts.includeEdges ?? true;
112
+ const flat = flattenDescribe(snapshot);
113
+ const payload = {
114
+ ...flat.name !== void 0 ? { name: flat.name } : {},
115
+ nodes: sortedNodes(flat.nodes).map((node) => sortJsonValue(node)),
116
+ edges: includeEdges ? sortedEdges(flat.edges) : []
117
+ };
118
+ return JSON.stringify(sortJsonValue(payload), null, opts.indent ?? 2);
119
+ }
120
+ function flattenDescribe(snapshot) {
121
+ const nodes = [];
122
+ const edges = [];
123
+ const visit = (snap) => {
124
+ nodes.push(...snap.nodes);
125
+ edges.push(...snap.edges);
126
+ for (const child of snap.subgraphs ?? []) visit(child);
127
+ };
128
+ visit(snapshot);
129
+ return { ...snapshot.name !== void 0 ? { name: snapshot.name } : {}, nodes, edges };
130
+ }
131
+ function sortedNodes(nodes) {
132
+ return [...nodes].sort((a, b) => compareText(a.id, b.id));
133
+ }
134
+ function sortedEdges(edges) {
135
+ const seen = /* @__PURE__ */ new Set();
136
+ const out = [];
137
+ for (const edge of edges) {
138
+ const key = `${edge.from}\0${edge.to}`;
139
+ if (seen.has(key)) continue;
140
+ seen.add(key);
141
+ out.push(edge);
142
+ }
143
+ return out.sort((a, b) => compareText(a.from, b.from) || compareText(a.to, b.to));
144
+ }
145
+ function compareText(a, b) {
146
+ return a < b ? -1 : a > b ? 1 : 0;
147
+ }
148
+ function normalizeDirection(direction) {
149
+ if (direction === void 0) return "LR";
150
+ if (direction === "TD" || direction === "LR" || direction === "BT" || direction === "RL") {
151
+ return direction;
152
+ }
153
+ throw new Error(
154
+ `invalid diagram direction ${String(direction)}; expected one of: TD, LR, BT, RL`
155
+ );
156
+ }
157
+ function d2Direction(direction) {
158
+ if (direction === "TD") return "down";
159
+ if (direction === "BT") return "up";
160
+ if (direction === "RL") return "left";
161
+ return "right";
162
+ }
163
+ function escapeMermaidLabel(value) {
164
+ return escapeQuotedLabel(value);
165
+ }
166
+ function escapeD2Label(value) {
167
+ return escapeQuotedLabel(value);
168
+ }
169
+ function escapeQuotedLabel(value) {
170
+ return JSON.stringify(value).slice(1, -1);
171
+ }
172
+ function formatValue(node) {
173
+ if (!("value" in node)) return "<SENTINEL>";
174
+ const value = node.value;
175
+ if (typeof value === "string") return JSON.stringify(value);
176
+ if (typeof value === "number" || typeof value === "boolean" || value == null)
177
+ return String(value);
178
+ try {
179
+ return JSON.stringify(value);
180
+ } catch {
181
+ return "[unserializable]";
182
+ }
183
+ }
184
+ function sortJsonValue(value, seen = /* @__PURE__ */ new WeakSet()) {
185
+ if (typeof value === "bigint") return value.toString();
186
+ if (value === null || typeof value !== "object") return value;
187
+ if (seen.has(value)) return "[Circular]";
188
+ seen.add(value);
189
+ if (Array.isArray(value)) {
190
+ const out2 = value.map((item) => sortJsonValue(item, seen));
191
+ seen.delete(value);
192
+ return out2;
193
+ }
194
+ const obj = value;
195
+ const out = {};
196
+ for (const key of Object.keys(obj).sort(compareText)) out[key] = sortJsonValue(obj[key], seen);
197
+ seen.delete(value);
198
+ return out;
199
+ }
200
+ var B64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
201
+ function base64UrlEncode(value) {
202
+ const bytes = utf8Bytes(value);
203
+ let out = "";
204
+ for (let i = 0; i < bytes.length; i += 3) {
205
+ const a = bytes[i];
206
+ const b = bytes[i + 1];
207
+ const c = bytes[i + 2];
208
+ out += B64[a >> 2];
209
+ out += B64[(a & 3) << 4 | (b ?? 0) >> 4];
210
+ out += b === void 0 ? "=" : B64[(b & 15) << 2 | (c ?? 0) >> 6];
211
+ out += c === void 0 ? "=" : B64[c & 63];
212
+ }
213
+ return out.replaceAll("+", "-").replaceAll("/", "_").replace(/=+$/, "");
214
+ }
215
+ function utf8Bytes(value) {
216
+ const bytes = [];
217
+ for (let i = 0; i < value.length; i += 1) {
218
+ let cp = value.charCodeAt(i);
219
+ if (cp >= 55296 && cp <= 56319 && i + 1 < value.length) {
220
+ const lo = value.charCodeAt(i + 1);
221
+ if (lo >= 56320 && lo <= 57343) {
222
+ cp = 65536 + (cp - 55296 << 10) + (lo - 56320);
223
+ i += 1;
224
+ }
225
+ }
226
+ if (cp <= 127) bytes.push(cp);
227
+ else if (cp <= 2047) bytes.push(192 | cp >> 6, 128 | cp & 63);
228
+ else if (cp <= 65535)
229
+ bytes.push(224 | cp >> 12, 128 | cp >> 6 & 63, 128 | cp & 63);
230
+ else
231
+ bytes.push(
232
+ 240 | cp >> 18,
233
+ 128 | cp >> 12 & 63,
234
+ 128 | cp >> 6 & 63,
235
+ 128 | cp & 63
236
+ );
237
+ }
238
+ return bytes;
239
+ }
240
+ // Annotate the CommonJS export names for ESM import in node:
241
+ 0 && (module.exports = {
242
+ describeToAscii,
243
+ describeToD2,
244
+ describeToJson,
245
+ describeToMermaid,
246
+ describeToMermaidUrl,
247
+ describeToPretty,
248
+ mermaidLiveUrl
249
+ });
250
+ //# sourceMappingURL=index.cjs.map