@c9up/orbit 0.0.0-stage → 0.1.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 (95) hide show
  1. package/Cargo.lock +146 -0
  2. package/Cargo.toml +16 -0
  3. package/LICENSE +21 -0
  4. package/README.md +314 -2
  5. package/android/orbit.cmake +31 -0
  6. package/android/src/main/cpp/NativeOrbit.cpp +309 -0
  7. package/android/src/main/cpp/NativeOrbit.h +35 -0
  8. package/android/src/main/cpp/orbit_host.h +34 -0
  9. package/android/src/main/java/com/c9up/orbit/OrbitEffects.kt +286 -0
  10. package/android/src/main/java/com/c9up/orbit/OrbitHost.kt +258 -0
  11. package/android/src/main/java/com/c9up/orbit/OrbitImage.kt +346 -0
  12. package/android/src/main/java/com/c9up/orbit/OrbitInput.kt +145 -0
  13. package/android/src/main/java/com/c9up/orbit/OrbitPress.kt +110 -0
  14. package/android/src/main/java/com/c9up/orbit/OrbitVector.kt +115 -0
  15. package/android/src/main/java/com/c9up/orbit/OrbitViews.kt +362 -0
  16. package/crates/orbit-host/Cargo.toml +14 -0
  17. package/crates/orbit-host/src/gesture.rs +561 -0
  18. package/crates/orbit-host/src/lib.rs +1608 -0
  19. package/crates/orbit-host/src/motion.rs +328 -0
  20. package/crates/orbit-host/src/vector.rs +917 -0
  21. package/dist/color.d.ts +10 -0
  22. package/dist/color.d.ts.map +1 -0
  23. package/dist/color.js +62 -0
  24. package/dist/color.js.map +1 -0
  25. package/dist/commit.d.ts +45 -0
  26. package/dist/commit.d.ts.map +1 -0
  27. package/dist/commit.js +172 -0
  28. package/dist/commit.js.map +1 -0
  29. package/dist/errors.d.ts +42 -0
  30. package/dist/errors.d.ts.map +1 -0
  31. package/dist/errors.js +15 -0
  32. package/dist/errors.js.map +1 -0
  33. package/dist/host.d.ts +49 -0
  34. package/dist/host.d.ts.map +1 -0
  35. package/dist/host.js +18 -0
  36. package/dist/host.js.map +1 -0
  37. package/dist/index.d.ts +29 -0
  38. package/dist/index.d.ts.map +1 -0
  39. package/dist/index.js +29 -0
  40. package/dist/index.js.map +1 -0
  41. package/dist/motion.d.ts +18 -0
  42. package/dist/motion.d.ts.map +1 -0
  43. package/dist/motion.js +66 -0
  44. package/dist/motion.js.map +1 -0
  45. package/dist/node.d.ts +46 -0
  46. package/dist/node.d.ts.map +1 -0
  47. package/dist/node.js +110 -0
  48. package/dist/node.js.map +1 -0
  49. package/dist/pages.d.ts +56 -0
  50. package/dist/pages.d.ts.map +1 -0
  51. package/dist/pages.js +157 -0
  52. package/dist/pages.js.map +1 -0
  53. package/dist/react-native/index.d.ts +25 -0
  54. package/dist/react-native/index.d.ts.map +1 -0
  55. package/dist/react-native/index.js +43 -0
  56. package/dist/react-native/index.js.map +1 -0
  57. package/dist/server.d.ts +85 -0
  58. package/dist/server.d.ts.map +1 -0
  59. package/dist/server.js +282 -0
  60. package/dist/server.js.map +1 -0
  61. package/dist/stack.d.ts +117 -0
  62. package/dist/stack.d.ts.map +1 -0
  63. package/dist/stack.js +299 -0
  64. package/dist/stack.js.map +1 -0
  65. package/dist/styles.d.ts +138 -0
  66. package/dist/styles.d.ts.map +1 -0
  67. package/dist/styles.js +920 -0
  68. package/dist/styles.js.map +1 -0
  69. package/dist/template.d.ts +27 -0
  70. package/dist/template.d.ts.map +1 -0
  71. package/dist/template.js +1392 -0
  72. package/dist/template.js.map +1 -0
  73. package/dist/url.d.ts +45 -0
  74. package/dist/url.d.ts.map +1 -0
  75. package/dist/url.js +302 -0
  76. package/dist/url.js.map +1 -0
  77. package/package.json +90 -3
  78. package/scripts/build-android.sh +27 -0
  79. package/scripts/test-styles.mjs +31 -0
  80. package/specs/NativeOrbit.ts +34 -0
  81. package/src/color.ts +73 -0
  82. package/src/commit.ts +206 -0
  83. package/src/errors.ts +48 -0
  84. package/src/host.ts +92 -0
  85. package/src/index.ts +60 -0
  86. package/src/motion.ts +86 -0
  87. package/src/node.ts +133 -0
  88. package/src/pages.ts +210 -0
  89. package/src/react-native/index.ts +76 -0
  90. package/src/react-native/react-native.d.ts +31 -0
  91. package/src/server.ts +359 -0
  92. package/src/stack.ts +434 -0
  93. package/src/styles.ts +1024 -0
  94. package/src/template.ts +1657 -0
  95. package/src/url.ts +326 -0
@@ -0,0 +1,10 @@
1
+ /**
2
+ * A CSS colour as the 32-bit ARGB integer the native host reads (signed, as
3
+ * Android's `Color` int), without React Native's `processColor`: the core of
4
+ * orbit runs and is tested without React Native.
5
+ *
6
+ * Reads `#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`, `rgb()` / `rgba()` with
7
+ * comma or space syntax, and `transparent`.
8
+ */
9
+ export declare function colorToArgb(css: string): number;
10
+ //# sourceMappingURL=color.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../src/color.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAU/C"}
package/dist/color.js ADDED
@@ -0,0 +1,62 @@
1
+ import { OrbitError } from "./errors.js";
2
+ /**
3
+ * A CSS colour as the 32-bit ARGB integer the native host reads (signed, as
4
+ * Android's `Color` int), without React Native's `processColor`: the core of
5
+ * orbit runs and is tested without React Native.
6
+ *
7
+ * Reads `#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`, `rgb()` / `rgba()` with
8
+ * comma or space syntax, and `transparent`.
9
+ */
10
+ export function colorToArgb(css) {
11
+ const value = css.trim().toLowerCase();
12
+ if (value === "transparent")
13
+ return 0;
14
+ if (value.startsWith("#"))
15
+ return fromHex(value.slice(1), css);
16
+ const fn = /^rgba?\(\s*([^)]+)\)$/.exec(value);
17
+ if (fn)
18
+ return fromRgb(fn[1] ?? "", css);
19
+ throw new OrbitError("E_ORBIT_INVALID_COLOR", `[orbit] cannot read the colour "${css}"`);
20
+ }
21
+ function pack(r, g, b, a) {
22
+ const byte = (n) => Math.max(0, Math.min(255, Math.round(n)));
23
+ return (byte(a) << 24) | (byte(r) << 16) | (byte(g) << 8) | byte(b) | 0;
24
+ }
25
+ function fromHex(hex, css) {
26
+ if (!/^[0-9a-f]+$/.test(hex))
27
+ throw invalid(css);
28
+ const at = (i, len) => Number.parseInt(len === 1 ? hex.charAt(i).repeat(2) : hex.slice(i, i + 2), 16);
29
+ switch (hex.length) {
30
+ case 3:
31
+ return pack(at(0, 1), at(1, 1), at(2, 1), 255);
32
+ case 4:
33
+ return pack(at(0, 1), at(1, 1), at(2, 1), at(3, 1));
34
+ case 6:
35
+ return pack(at(0, 2), at(2, 2), at(4, 2), 255);
36
+ case 8:
37
+ return pack(at(0, 2), at(2, 2), at(4, 2), at(6, 2));
38
+ default:
39
+ throw invalid(css);
40
+ }
41
+ }
42
+ function fromRgb(args, css) {
43
+ const parts = args.split(/[\s,/]+/).filter(Boolean);
44
+ if (parts.length !== 3 && parts.length !== 4)
45
+ throw invalid(css);
46
+ const channel = (p) => p.endsWith("%") ? (Number.parseFloat(p) * 255) / 100 : Number.parseFloat(p);
47
+ const alpha = (p) => {
48
+ if (p === undefined)
49
+ return 255;
50
+ return ((p.endsWith("%") ? Number.parseFloat(p) / 100 : Number.parseFloat(p)) *
51
+ 255);
52
+ };
53
+ const [r, g, b] = parts.map(channel);
54
+ const a = alpha(parts[3]);
55
+ if ([r, g, b, a].some((n) => n === undefined || Number.isNaN(n)))
56
+ throw invalid(css);
57
+ return pack(r ?? 0, g ?? 0, b ?? 0, a);
58
+ }
59
+ function invalid(css) {
60
+ return new OrbitError("E_ORBIT_INVALID_COLOR", `[orbit] cannot read the colour "${css}"`);
61
+ }
62
+ //# sourceMappingURL=color.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color.js","sourceRoot":"","sources":["../src/color.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,GAAW;IACtC,MAAM,KAAK,GAAG,GAAG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C3B,OAAO,IAAI,UAAU,CACpB,uBAAuB,EACvB,mCAAmC,GAAG,GAAG,CACzC,CAAC;AACH,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { type OrbitHost } from "./host.js";
2
+ import { type NativeNode } from "./node.js";
3
+ /**
4
+ * Committing the JS tree to the Rust host: one JSON batch per commit over JSI
5
+ * (create, props patch, children, root). Layout, diffing and mounting happen in
6
+ * Rust and on the platform side. Commits are batched to a microtask, so many
7
+ * signal writes in one turn cost one commit.
8
+ */
9
+ export interface OrbitReport {
10
+ deleted: number[];
11
+ parseUs: number;
12
+ layoutUs: number;
13
+ diffUs: number;
14
+ measures: number;
15
+ nodes: number;
16
+ opsBytes: number;
17
+ }
18
+ /** Run `listener` after every commit; returns what stops it. */
19
+ export declare function onEveryCommit(listener: () => void): () => void;
20
+ /** The host the mounted tree commits to (layout reads, scrolling). */
21
+ export declare function treeHost(): OrbitHost;
22
+ /** Run `hook` once the next commit has reached the host (aurora's onMount timing). */
23
+ export declare function afterCommit(hook: () => void): void;
24
+ export declare class Root {
25
+ #private;
26
+ /** Every commit's report, newest last (development and benchmarks). */
27
+ readonly reports: OrbitReport[];
28
+ constructor(host: OrbitHost, tree: NativeNode);
29
+ schedule(): void;
30
+ /** Commit what changed now, instead of at the end of the turn. */
31
+ flush(): OrbitReport;
32
+ commit(): OrbitReport;
33
+ }
34
+ export interface MountOptions {
35
+ /** The root's size in dp (React Native: `Dimensions.get("window")`). */
36
+ viewport: {
37
+ width: number;
38
+ height: number;
39
+ };
40
+ /** Defaults to the host given to `useHost`. */
41
+ host?: OrbitHost;
42
+ }
43
+ /** Mount a native tree; returns its root (`flush()` commits synchronously). */
44
+ export declare function mountTree(tree: NativeNode, options: MountOptions): Root;
45
+ //# sourceMappingURL=commit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commit.d.ts","sourceRoot":"","sources":["../src/commit.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,WAAW,CAAC;AAG9D;;;;;GAKG;AAEH,MAAM,WAAW,WAAW;IAC3B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CACjB;AAiBD,gEAAgE;AAChE,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAG9D;AAED,sEAAsE;AACtE,wBAAgB,QAAQ,IAAI,SAAS,CAEpC;AAED,sFAAsF;AACtF,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,IAAI,GAAG,IAAI,CAElD;AAqDD,qBAAa,IAAI;;IAKhB,uEAAuE;IACvE,QAAQ,CAAC,OAAO,EAAE,WAAW,EAAE,CAAM;gBAEzB,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU;IAK7C,QAAQ,IAAI,IAAI;IAShB,kEAAkE;IAClE,KAAK,IAAI,WAAW;IAIpB,MAAM,IAAI,WAAW;CA8BrB;AAED,MAAM,WAAW,YAAY;IAC5B,wEAAwE;IACxE,QAAQ,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,+CAA+C;IAC/C,IAAI,CAAC,EAAE,SAAS,CAAC;CACjB;AAED,+EAA+E;AAC/E,wBAAgB,SAAS,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI,CAkCvE"}
package/dist/commit.js ADDED
@@ -0,0 +1,172 @@
1
+ import { OrbitError } from "./errors.js";
2
+ import { currentHost } from "./host.js";
3
+ import { setDirtyListener } from "./node.js";
4
+ import { viewportSize } from "./styles.js";
5
+ function isReport(value) {
6
+ return (typeof value === "object" &&
7
+ value !== null &&
8
+ Array.isArray(Reflect.get(value, "deleted")));
9
+ }
10
+ const created = new WeakSet();
11
+ const byTag = new Map();
12
+ const lastChildren = new WeakMap();
13
+ const afterCommitHooks = [];
14
+ const commitListeners = new Set();
15
+ let mountedHost = null;
16
+ /** Run `listener` after every commit; returns what stops it. */
17
+ export function onEveryCommit(listener) {
18
+ commitListeners.add(listener);
19
+ return () => commitListeners.delete(listener);
20
+ }
21
+ /** The host the mounted tree commits to (layout reads, scrolling). */
22
+ export function treeHost() {
23
+ return mountedHost ?? currentHost();
24
+ }
25
+ /** Run `hook` once the next commit has reached the host (aurora's onMount timing). */
26
+ export function afterCommit(hook) {
27
+ afterCommitHooks.push(hook);
28
+ }
29
+ function sameTags(a, b) {
30
+ if (!a || a.length !== b.length)
31
+ return false;
32
+ for (let i = 0; i < a.length; i++)
33
+ if (a[i] !== b[i])
34
+ return false;
35
+ return true;
36
+ }
37
+ // Only nodes the commit reaches hand their bytes over: the host drops them
38
+ // with the node, so bytes of a node it never saw would stay behind.
39
+ function takeBytes(node, bytes) {
40
+ if (node.pendingBytes) {
41
+ bytes.push([node.tag, node.pendingBytes]);
42
+ node.pendingBytes = null;
43
+ }
44
+ }
45
+ function visit(node, ops, bytes) {
46
+ takeBytes(node, bytes);
47
+ if (!created.has(node)) {
48
+ ops.push(["c", node.tag, node.viewName, node.props]);
49
+ created.add(node);
50
+ byTag.set(node.tag, node);
51
+ node.pendingProps = null;
52
+ const kids = node.flatChildren();
53
+ for (const kid of kids)
54
+ visit(kid, ops, bytes);
55
+ const tags = kids.map((kid) => kid.tag);
56
+ if (tags.length > 0)
57
+ ops.push(["k", node.tag, tags]);
58
+ lastChildren.set(node, tags);
59
+ node.childrenDirty = false;
60
+ return;
61
+ }
62
+ if (node.pendingProps) {
63
+ ops.push(["u", node.tag, node.pendingProps]);
64
+ node.pendingProps = null;
65
+ }
66
+ if (node.childrenDirty) {
67
+ const kids = node.flatChildren();
68
+ for (const kid of kids)
69
+ visit(kid, ops, bytes);
70
+ const tags = kids.map((kid) => kid.tag);
71
+ if (!sameTags(lastChildren.get(node), tags)) {
72
+ ops.push(["k", node.tag, tags]);
73
+ lastChildren.set(node, tags);
74
+ }
75
+ node.childrenDirty = false;
76
+ }
77
+ }
78
+ export class Root {
79
+ #host;
80
+ #tree;
81
+ #scheduled = false;
82
+ #rootSent = false;
83
+ /** Every commit's report, newest last (development and benchmarks). */
84
+ reports = [];
85
+ constructor(host, tree) {
86
+ this.#host = host;
87
+ this.#tree = tree;
88
+ }
89
+ schedule() {
90
+ if (this.#scheduled)
91
+ return;
92
+ this.#scheduled = true;
93
+ void Promise.resolve().then(() => {
94
+ // A synchronous flush() may already have committed this batch.
95
+ if (this.#scheduled)
96
+ this.commit();
97
+ });
98
+ }
99
+ /** Commit what changed now, instead of at the end of the turn. */
100
+ flush() {
101
+ return this.commit();
102
+ }
103
+ commit() {
104
+ this.#scheduled = false;
105
+ const ops = [];
106
+ const bytes = [];
107
+ visit(this.#tree, ops, bytes);
108
+ if (!this.#rootSent) {
109
+ ops.push(["r", this.#tree.tag]);
110
+ this.#rootSent = true;
111
+ }
112
+ // Before the ops that show them: the host reads them when it mounts.
113
+ for (const [tag, data] of bytes)
114
+ this.#host.imageBytes(tag, data);
115
+ const answer = JSON.parse(this.#host.commit(JSON.stringify(ops)));
116
+ if (!isReport(answer)) {
117
+ throw new OrbitError("E_ORBIT_COMMIT_FAILED", `[orbit] the host refused a commit: ${JSON.stringify(answer)}`);
118
+ }
119
+ for (const tag of answer.deleted) {
120
+ const node = byTag.get(tag);
121
+ if (!node)
122
+ continue;
123
+ byTag.delete(tag);
124
+ created.delete(node);
125
+ lastChildren.delete(node);
126
+ }
127
+ this.reports.push(answer);
128
+ for (const hook of afterCommitHooks.splice(0))
129
+ hook();
130
+ for (const listener of [...commitListeners])
131
+ listener();
132
+ return answer;
133
+ }
134
+ }
135
+ /** Mount a native tree; returns its root (`flush()` commits synchronously). */
136
+ export function mountTree(tree, options) {
137
+ const host = options.host ?? currentHost();
138
+ const root = new Root(host, tree);
139
+ mountedHost = host;
140
+ setDirtyListener(() => root.schedule());
141
+ host.setViewport(options.viewport.width, options.viewport.height);
142
+ host.setEventHandler((tag, type, x, y, data) => {
143
+ if (type === "topScroll") {
144
+ for (const listener of byTag.get(tag)?.scrollListeners ?? [])
145
+ listener(y);
146
+ return;
147
+ }
148
+ if (type === "topViewport") {
149
+ // The window resized (the keyboard came or went): lay out again.
150
+ host.setViewport(x, y);
151
+ viewportSize({ width: x, height: y });
152
+ root.commit();
153
+ return;
154
+ }
155
+ const payload = {
156
+ pageX: x,
157
+ pageY: y,
158
+ locationX: x,
159
+ locationY: y,
160
+ text: data,
161
+ };
162
+ for (let node = byTag.get(tag) ?? null; node; node = node.parent) {
163
+ if (node.onEvent) {
164
+ node.onEvent(type, payload);
165
+ return;
166
+ }
167
+ }
168
+ });
169
+ root.commit();
170
+ return root;
171
+ }
172
+ //# sourceMappingURL=commit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commit.js","sourceRoot":"","sources":["../src/commit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAkB,MAAM,WAAW,CAAC;AACxD,OAAO,EAAmB,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAmB3C,SAAS,QAAQ,CAAC,KAAc;IAC/B,OAAO,CACN,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAC5C,CAAC;AACH,CAAC;AAED,MAAM,OAAO,GAAG,IAAI,OAAO,EAAc,CAAC;AAC1C,MAAM,KAAK,GAAG,IAAI,GAAG,EAAsB,CAAC;AAC5C,MAAM,YAAY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YACR,KAAK,EAAE,CAAC;YACR,SAAS,EAAE,CAAC;YACZ,SAAS,EAAE,CAAC;YACZ,IAAI,EAAE,IAAI;SACV,CAAC;QACF,KAAK,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;YAClE,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBAClB,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;gBAC5B,OAAO;YACR,CAAC;QACF,CAAC;IACF,CAAC,CAAC,CAAC;IACH,IAAI,CAAC,MAAM,EAAE,CAAC;IACd,OAAO,IAAI,CAAC;AACb,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Orbit's errors.
3
+ *
4
+ * Every failure carries a stable `code` (`E_ORBIT_<REASON>`), so a caller
5
+ * branches on what went wrong rather than on a message.
6
+ */
7
+ export type OrbitErrorCode =
8
+ /** `mount` ran before `useHost` gave orbit a native host. */
9
+ "E_ORBIT_NO_HOST"
10
+ /** The native host refused a commit; the message carries its report. */
11
+ | "E_ORBIT_COMMIT_FAILED"
12
+ /** An element with no native mapping yet (`<select>`, `<canvas>`, or `<text>` / a gradient inside an `<svg>`). */
13
+ | "E_ORBIT_UNSUPPORTED_ELEMENT"
14
+ /** A block element inside text: native text holds only inline runs. */
15
+ | "E_ORBIT_BLOCK_IN_TEXT"
16
+ /** `motion=${…}` was not an object of motion values. */
17
+ | "E_ORBIT_INVALID_MOTION"
18
+ /** `scroll-y=${…}` was not a motion value. */
19
+ | "E_ORBIT_INVALID_SCROLL_BINDING"
20
+ /** A colour orbit cannot read (named colours other than `transparent`, `hsl()`…). */
21
+ | "E_ORBIT_INVALID_COLOR"
22
+ /** `<img src>` over plain http: images are fetched over https only. */
23
+ | "E_ORBIT_INSECURE_IMAGE_URL"
24
+ /** `<img src>` with a scheme that is not an image source (`data:`, `javascript:`…). */
25
+ | "E_ORBIT_IMAGE_SOURCE"
26
+ /** Two elements of an `each` list share a key: a key names one row. */
27
+ | "E_ORBIT_DUPLICATE_KEY"
28
+ /** `useScreen()` in a component no screen of a stack built. */
29
+ | "E_ORBIT_NO_SCREEN"
30
+ /** One stack put in two places: a stack is shown once. */
31
+ | "E_ORBIT_STACK_SHOWN"
32
+ /** `useStyles` got something other than a table `ream css:compile` wrote. */
33
+ | "E_ORBIT_STYLE_TABLE"
34
+ /** `serverPages({ server })` over plain http to a host that is not this machine or the emulator's. */
35
+ | "E_ORBIT_INSECURE_SERVER"
36
+ /** The server named a page the app does not have (`serverPages({ pages })`). */
37
+ | "E_ORBIT_UNKNOWN_PAGE";
38
+ export declare class OrbitError extends Error {
39
+ readonly code: OrbitErrorCode;
40
+ constructor(code: OrbitErrorCode, message: string, options?: ErrorOptions);
41
+ }
42
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,cAAc;AACzB,6DAA6D;AAC3D,iBAAiB;AACnB,wEAAwE;GACtE,uBAAuB;AACzB,kHAAkH;GAChH,6BAA6B;AAC/B,uEAAuE;GACrE,uBAAuB;AACzB,wDAAwD;GACtD,wBAAwB;AAC1B,8CAA8C;GAC5C,gCAAgC;AAClC,qFAAqF;GACnF,uBAAuB;AACzB,uEAAuE;GACrE,4BAA4B;AAC9B,uFAAuF;GACrF,sBAAsB;AACxB,uEAAuE;GACrE,uBAAuB;AACzB,+DAA+D;GAC7D,mBAAmB;AACrB,0DAA0D;GACxD,qBAAqB;AACvB,6EAA6E;GAC3E,qBAAqB;AACvB,sGAAsG;GACpG,yBAAyB;AAC3B,gFAAgF;GAC9E,sBAAsB,CAAC;AAE1B,qBAAa,UAAW,SAAQ,KAAK;IACpC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;gBAElB,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAKzE"}
package/dist/errors.js ADDED
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Orbit's errors.
3
+ *
4
+ * Every failure carries a stable `code` (`E_ORBIT_<REASON>`), so a caller
5
+ * branches on what went wrong rather than on a message.
6
+ */
7
+ export class OrbitError extends Error {
8
+ code;
9
+ constructor(code, message, options) {
10
+ super(message, options);
11
+ this.name = new.target.name;
12
+ this.code = code;
13
+ }
14
+ }
15
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAkCH,MAAM,OAAO,UAAW,SAAQ,KAAK;IAC3B,IAAI,CAAiB;IAE9B,YAAY,IAAoB,EAAE,OAAe,EAAE,OAAsB;QACxE,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;CACD"}
package/dist/host.d.ts ADDED
@@ -0,0 +1,49 @@
1
+ /**
2
+ * What orbit needs from the native side: the Rust host behind JSI (the
3
+ * `NativeOrbit` TurboModule, see `specs/NativeOrbit.ts`), or a fake in tests.
4
+ * Structural on purpose: orbit's core imports nothing from React Native.
5
+ */
6
+ export interface OrbitHost {
7
+ /** The root's size in dp. */
8
+ setViewport(width: number, height: number): void;
9
+ /** Apply a JSON batch of tree operations; returns the host's JSON report. */
10
+ commit(ops: string): string;
11
+ /**
12
+ * The bytes an image node shows (`<img src=${bytes}>`): copied into the
13
+ * host's memory, never to disk, and dropped (zeroed) with the node.
14
+ */
15
+ imageBytes(tag: number, bytes: Uint8Array): void;
16
+ /**
17
+ * Where nodes were laid out: a JSON array of tags in, a JSON array of
18
+ * `[x, y, width, height]` (dp, the root's coordinates, scroll offsets left
19
+ * out) or null per tag out.
20
+ */
21
+ layout(tags: string): string;
22
+ /** Scroll a scroll view by `by` dp, or to its end. */
23
+ scroll(tag: number, by: number, toEnd: boolean): void;
24
+ /**
25
+ * Events from host views: touches (React Native's touch event types, in dp),
26
+ * text fields (`topChange`, `topFocus`, `topBlur`, `topSubmit`, with the
27
+ * text in `data`), `topScroll` from a scroll view with its offset in `y`
28
+ * (dp), and `topViewport` on tag 0 when the window resized (the keyboard),
29
+ * with `x`/`y` the new size in dp.
30
+ */
31
+ setEventHandler(handler: (tag: number, type: string, x: number, y: number, data: string) => void): void;
32
+ motionValue(tag: number, initial: number): void;
33
+ motionInterpolate(tag: number, input: number, from: readonly number[], to: readonly number[]): void;
34
+ motionSet(tag: number, value: number): void;
35
+ motionStop(tag: number): void;
36
+ motionFrames(tag: number, frames: readonly number[], to: number, loop: boolean): void;
37
+ motionSpring(tag: number, to: number, stiffness: number, damping: number, mass: number): void;
38
+ /** Forget a motion value or interpolation, its animation and its bindings. */
39
+ motionDispose(tag: number): void;
40
+ /** prop: 0 opacity, 1 translateX, 2 translateY, 3 scale, 4 visible (> 0.5). */
41
+ motionBind(view: number, prop: number, node: number): void;
42
+ motionBindScroll(scrollView: number, value: number): void;
43
+ }
44
+ /** The TurboModule name the native side registers. */
45
+ export declare const NATIVE_MODULE_NAME = "NativeOrbit";
46
+ /** Give orbit its native host, once, before `mount`. */
47
+ export declare function useHost(next: OrbitHost): void;
48
+ export declare function currentHost(): OrbitHost;
49
+ //# sourceMappingURL=host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACzB,6BAA6B;IAC7B,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACjD,6EAA6E;IAC7E,MAAM,CAAC,GAAG,EAAE,MAAM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,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3D,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1D;AAED,sDAAsD;AACtD,eAAO,MAAM,kBAAkB,gBAAgB,CAAC;AAIhD,wDAAwD;AACxD,wBAAgB,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAI7C;AAED,wBAAgB,WAAW,IAAI,SAAS,CAQvC"}
package/dist/host.js ADDED
@@ -0,0 +1,18 @@
1
+ import { OrbitError } from "./errors.js";
2
+ import { useNativeMotion } from "./motion.js";
3
+ /** The TurboModule name the native side registers. */
4
+ export const NATIVE_MODULE_NAME = "NativeOrbit";
5
+ let host = null;
6
+ /** Give orbit its native host, once, before `mount`. */
7
+ export function useHost(next) {
8
+ host = next;
9
+ // aurora's motion values made from now on live in this host.
10
+ useNativeMotion();
11
+ }
12
+ export function currentHost() {
13
+ if (host === null) {
14
+ throw new OrbitError("E_ORBIT_NO_HOST", `[orbit] no native host: call useHost(TurboModuleRegistry.getEnforcing("${NATIVE_MODULE_NAME}")) before mount()`);
15
+ }
16
+ return host;
17
+ }
18
+ //# sourceMappingURL=host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.js","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAsE9C,sDAAsD;AACtD,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAC;AAEhD,IAAI,IAAI,GAAqB,IAAI,CAAC;AAElC,wDAAwD;AACxD,MAAM,UAAU,OAAO,CAAC,IAAe;IACtC,IAAI,GAAG,IAAI,CAAC;IACZ,6DAA6D;IAC7D,eAAe,EAAE,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,WAAW;IAC1B,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QACnB,MAAM,IAAI,UAAU,CACnB,iBAAiB,EACjB,0EAA0E,kBAAkB,oBAAoB,CAChH,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * `@c9up/orbit` — aurora components as native views on a phone.
3
+ *
4
+ * The JS side keeps a tree of native nodes that aurora's signals patch; each
5
+ * commit goes over JSI to a Rust host that lays it out (taffy), diffs it and
6
+ * hands mount operations to the platform's views. Animations and scroll-driven
7
+ * values run on the UI thread, without JS.
8
+ *
9
+ * useHost(TurboModuleRegistry.getEnforcing("NativeOrbit"))
10
+ * mount(App(), { viewport: Dimensions.get("window") })
11
+ *
12
+ * Screens: `createStack(Home)` in the root, `useScreen().push(Detail, props)`
13
+ * in a screen; the Android back button pops (see `@c9up/orbit/react-native`).
14
+ */
15
+ export { colorToArgb } from "./color.js";
16
+ export { afterCommit, type MountOptions, type OrbitReport, type Root, } from "./commit.js";
17
+ export { OrbitError, type OrbitErrorCode } from "./errors.js";
18
+ export { NATIVE_MODULE_NAME, type OrbitHost, useHost } from "./host.js";
19
+ export { bindMotion, bindScrollY, MotionNode, type MotionStyle, MotionValue, type SpringOptions, type TimingOptions, } from "./motion.js";
20
+ /** The app's ream server, one connection for pages, comet and relay. */
21
+ export { connectServer, type ServerConnection, type ServerEvent, ServerEventStream, } from "./server.js";
22
+ export { createStack,
23
+ /** What the back button does: pop the innermost shown stack (false: nothing to pop). */
24
+ goBack, type Navigator, type Screen, type ScreenComponent, type Stack, type StackOptions, useScreen, } from "./stack.js";
25
+ export { colorScheme, type StyleTable, unknownClasses, useStyles, } from "./styles.js";
26
+ export { type GestureEvent, mount } from "./template.js";
27
+ /** A standard `URL` in place of the platform's, when it is not one (React Native's). */
28
+ export { installStandardUrl, StandardURL } from "./url.js";
29
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EACN,WAAW,EACX,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,IAAI,GACT,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,KAAK,SAAS,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,EACN,UAAU,EACV,WAAW,EACX,UAAU,EACV,KAAK,WAAW,EAChB,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,aAAa,GAClB,MAAM,aAAa,CAAC;AACrB,wEAAwE;AACxE,OAAO,EACN,aAAa,EACb,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,iBAAiB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,WAAW;AACX,wFAAwF;AACxF,MAAM,EACN,KAAK,SAAS,EACd,KAAK,MAAM,EACX,KAAK,eAAe,EACpB,KAAK,KAAK,EACV,KAAK,YAAY,EACjB,SAAS,GACT,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,WAAW,EACX,KAAK,UAAU,EACf,cAAc,EACd,SAAS,GACT,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACzD,wFAAwF;AACxF,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,29 @@
1
+ /**
2
+ * `@c9up/orbit` — aurora components as native views on a phone.
3
+ *
4
+ * The JS side keeps a tree of native nodes that aurora's signals patch; each
5
+ * commit goes over JSI to a Rust host that lays it out (taffy), diffs it and
6
+ * hands mount operations to the platform's views. Animations and scroll-driven
7
+ * values run on the UI thread, without JS.
8
+ *
9
+ * useHost(TurboModuleRegistry.getEnforcing("NativeOrbit"))
10
+ * mount(App(), { viewport: Dimensions.get("window") })
11
+ *
12
+ * Screens: `createStack(Home)` in the root, `useScreen().push(Detail, props)`
13
+ * in a screen; the Android back button pops (see `@c9up/orbit/react-native`).
14
+ */
15
+ export { colorToArgb } from "./color.js";
16
+ export { afterCommit, } from "./commit.js";
17
+ export { OrbitError } from "./errors.js";
18
+ export { NATIVE_MODULE_NAME, useHost } from "./host.js";
19
+ export { bindMotion, bindScrollY, MotionNode, MotionValue, } from "./motion.js";
20
+ /** The app's ream server, one connection for pages, comet and relay. */
21
+ export { connectServer, ServerEventStream, } from "./server.js";
22
+ export { createStack,
23
+ /** What the back button does: pop the innermost shown stack (false: nothing to pop). */
24
+ goBack, useScreen, } from "./stack.js";
25
+ export { colorScheme, unknownClasses, useStyles, } from "./styles.js";
26
+ export { mount } from "./template.js";
27
+ /** A standard `URL` in place of the platform's, when it is not one (React Native's). */
28
+ export { installStandardUrl, StandardURL } from "./url.js";
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EACN,WAAW,GAIX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAuB,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAkB,OAAO,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,EACN,UAAU,EACV,WAAW,EACX,UAAU,EAEV,WAAW,GAGX,MAAM,aAAa,CAAC;AACrB,wEAAwE;AACxE,OAAO,EACN,aAAa,EAGb,iBAAiB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,WAAW;AACX,wFAAwF;AACxF,MAAM,EAMN,SAAS,GACT,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,WAAW,EAEX,cAAc,EACd,SAAS,GACT,MAAM,aAAa,CAAC;AACrB,OAAO,EAAqB,KAAK,EAAE,MAAM,eAAe,CAAC;AACzD,wFAAwF;AACxF,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Motion values on the phone: aurora's `MotionValue`, driven by the Rust host
3
+ * on the UI thread. JS declares values, curves and bindings once, and a
4
+ * blocked JS thread stops none of it. The same component file animates in the
5
+ * browser, where aurora's DOM renderer hands the curves to the Web Animations
6
+ * API.
7
+ */
8
+ import { type MotionStyle, type MotionValue } from "@c9up/aurora/core";
9
+ export { MotionNode, type MotionStyle, MotionValue, type SpringOptions, type TimingOptions, } from "@c9up/aurora/core";
10
+ /** @internal `useHost` installs it: motion values made from then on live in the host. */
11
+ export declare function useNativeMotion(): void;
12
+ /** Wire `style` to the view `viewTag`; call once the view is committed. */
13
+ export declare function bindMotion(viewTag: number, style: MotionStyle): void;
14
+ /** Feed `value` from the scroll offset of the scroll view `scrollViewTag`. */
15
+ export declare function bindScrollY(scrollViewTag: number, value: MotionValue): void;
16
+ /** Read a `motion=${…}` attribute value, as aurora reads it on the web. */
17
+ export declare function readMotion(value: unknown): MotionStyle;
18
+ //# sourceMappingURL=motion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"motion.d.ts","sourceRoot":"","sources":["../src/motion.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAGN,KAAK,WAAW,EAChB,KAAK,WAAW,EAGhB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EACN,UAAU,EACV,KAAK,WAAW,EAChB,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,aAAa,GAClB,MAAM,mBAAmB,CAAC;AAgB3B,yFAAyF;AACzF,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAiBD,2EAA2E;AAC3E,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,CAKpE;AAED,8EAA8E;AAC9E,wBAAgB,WAAW,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,CAE3E;AAED,2EAA2E;AAC3E,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,CAWtD"}
package/dist/motion.js ADDED
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Motion values on the phone: aurora's `MotionValue`, driven by the Rust host
3
+ * on the UI thread. JS declares values, curves and bindings once, and a
4
+ * blocked JS thread stops none of it. The same component file animates in the
5
+ * browser, where aurora's DOM renderer hands the curves to the Web Animations
6
+ * API.
7
+ */
8
+ import { AuroraError, readMotionStyle, setMotionDriver, } from "@c9up/aurora/core";
9
+ import { OrbitError } from "./errors.js";
10
+ import { currentHost } from "./host.js";
11
+ export { MotionNode, MotionValue, } from "@c9up/aurora/core";
12
+ /** aurora's motion values, held and played by orbit's native host. */
13
+ const nativeDriver = {
14
+ value: (tag, initial) => currentHost().motionValue(tag, initial),
15
+ set: (tag, value) => currentHost().motionSet(tag, value),
16
+ stop: (tag) => currentHost().motionStop(tag),
17
+ frames: (tag, frames, to, loop) => currentHost().motionFrames(tag, [...frames], to, loop),
18
+ spring: (tag, to, stiffness, damping, mass) => currentHost().motionSpring(tag, to, stiffness, damping, mass),
19
+ interpolate: (tag, input, from, to) => currentHost().motionInterpolate(tag, input, from, to),
20
+ dispose: (tag) => currentHost().motionDispose(tag),
21
+ };
22
+ /** @internal `useHost` installs it: motion values made from then on live in the host. */
23
+ export function useNativeMotion() {
24
+ setMotionDriver(nativeDriver);
25
+ }
26
+ const PROPS = {
27
+ opacity: 0,
28
+ translateX: 1,
29
+ translateY: 2,
30
+ scale: 3,
31
+ visible: 4,
32
+ };
33
+ const KEYS = [
34
+ "opacity",
35
+ "translateX",
36
+ "translateY",
37
+ "scale",
38
+ "visible",
39
+ ];
40
+ /** Wire `style` to the view `viewTag`; call once the view is committed. */
41
+ export function bindMotion(viewTag, style) {
42
+ for (const key of KEYS) {
43
+ const node = style[key];
44
+ if (node)
45
+ currentHost().motionBind(viewTag, PROPS[key], node.tag);
46
+ }
47
+ }
48
+ /** Feed `value` from the scroll offset of the scroll view `scrollViewTag`. */
49
+ export function bindScrollY(scrollViewTag, value) {
50
+ currentHost().motionBindScroll(scrollViewTag, value.tag);
51
+ }
52
+ /** Read a `motion=${…}` attribute value, as aurora reads it on the web. */
53
+ export function readMotion(value) {
54
+ try {
55
+ return readMotionStyle(value);
56
+ }
57
+ catch (error) {
58
+ if (error instanceof AuroraError) {
59
+ throw new OrbitError("E_ORBIT_INVALID_MOTION", error.message, {
60
+ cause: error,
61
+ });
62
+ }
63
+ throw error;
64
+ }
65
+ }
66
+ //# sourceMappingURL=motion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"motion.js","sourceRoot":"","sources":["../src/motion.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACN,WAAW,EAIX,eAAe,EACf,eAAe,GACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,EACN,UAAU,EAEV,WAAW,GAGX,MAAM,mBAAmB,CAAC;AAE3B,sEAAsE;AACtE,MAAM,YAAY,GAAiB;IAClC,KAAK,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC;IAChE,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,WAAW,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,KAAK,CAAC;IACxD,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC;IAC5C,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,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