@01.software/sdk 0.5.3 → 0.5.5

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 (45) hide show
  1. package/dist/auth.cjs +22 -46
  2. package/dist/auth.cjs.map +1 -1
  3. package/dist/auth.js +22 -47
  4. package/dist/auth.js.map +1 -1
  5. package/dist/index.cjs +922 -1069
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.js +922 -1072
  8. package/dist/index.js.map +1 -1
  9. package/dist/realtime.cjs +75 -101
  10. package/dist/realtime.cjs.map +1 -1
  11. package/dist/realtime.js +75 -102
  12. package/dist/realtime.js.map +1 -1
  13. package/dist/ui/code-block.cjs +13 -35
  14. package/dist/ui/code-block.cjs.map +1 -1
  15. package/dist/ui/code-block.js +13 -35
  16. package/dist/ui/code-block.js.map +1 -1
  17. package/dist/ui/flow/server.cjs +26 -68
  18. package/dist/ui/flow/server.cjs.map +1 -1
  19. package/dist/ui/flow/server.js +26 -71
  20. package/dist/ui/flow/server.js.map +1 -1
  21. package/dist/ui/flow.cjs +244 -238
  22. package/dist/ui/flow.cjs.map +1 -1
  23. package/dist/ui/flow.js +244 -240
  24. package/dist/ui/flow.js.map +1 -1
  25. package/dist/ui/form.cjs +40 -84
  26. package/dist/ui/form.cjs.map +1 -1
  27. package/dist/ui/form.js +40 -86
  28. package/dist/ui/form.js.map +1 -1
  29. package/dist/ui/image.cjs +27 -40
  30. package/dist/ui/image.cjs.map +1 -1
  31. package/dist/ui/image.js +27 -42
  32. package/dist/ui/image.js.map +1 -1
  33. package/dist/ui/rich-text.cjs +33 -67
  34. package/dist/ui/rich-text.cjs.map +1 -1
  35. package/dist/ui/rich-text.js +33 -69
  36. package/dist/ui/rich-text.js.map +1 -1
  37. package/dist/ui/video.cjs +32 -50
  38. package/dist/ui/video.cjs.map +1 -1
  39. package/dist/ui/video.js +32 -52
  40. package/dist/ui/video.js.map +1 -1
  41. package/dist/webhook.cjs +48 -73
  42. package/dist/webhook.cjs.map +1 -1
  43. package/dist/webhook.js +48 -74
  44. package/dist/webhook.js.map +1 -1
  45. package/package.json +3 -3
package/dist/ui/flow.js CHANGED
@@ -1,55 +1,4 @@
1
1
  "use client";
2
- var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
- var __spreadValues = (a, b) => {
10
- for (var prop in b || (b = {}))
11
- if (__hasOwnProp.call(b, prop))
12
- __defNormalProp(a, prop, b[prop]);
13
- if (__getOwnPropSymbols)
14
- for (var prop of __getOwnPropSymbols(b)) {
15
- if (__propIsEnum.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- }
18
- return a;
19
- };
20
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
- var __objRest = (source, exclude) => {
22
- var target = {};
23
- for (var prop in source)
24
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
25
- target[prop] = source[prop];
26
- if (source != null && __getOwnPropSymbols)
27
- for (var prop of __getOwnPropSymbols(source)) {
28
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
29
- target[prop] = source[prop];
30
- }
31
- return target;
32
- };
33
- var __async = (__this, __arguments, generator) => {
34
- return new Promise((resolve, reject) => {
35
- var fulfilled = (value) => {
36
- try {
37
- step(generator.next(value));
38
- } catch (e) {
39
- reject(e);
40
- }
41
- };
42
- var rejected = (value) => {
43
- try {
44
- step(generator.throw(value));
45
- } catch (e) {
46
- reject(e);
47
- }
48
- };
49
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
50
- step((generator = generator.apply(__this, __arguments)).next());
51
- });
52
- };
53
2
 
54
3
  // src/ui/Flow/types.ts
55
4
  function isDynamicNode(node) {
@@ -116,133 +65,128 @@ function collectionKeys(collection) {
116
65
 
117
66
  // src/ui/Flow/query-options.ts
118
67
  function flowQueryOptions(client, slug, id) {
119
- var _a;
120
- const identifier = (_a = id != null ? id : slug) != null ? _a : "";
68
+ const identifier = id ?? slug ?? "";
121
69
  return {
122
70
  queryKey: collectionKeys("flows").detail(identifier),
123
- queryFn: () => __async(null, null, function* () {
71
+ queryFn: async () => {
124
72
  if (id) return client.from("flows").findById(id);
125
- const result = yield client.from("flows").find({
73
+ const result = await client.from("flows").find({
126
74
  where: { slug: { equals: slug } },
127
75
  limit: 1
128
76
  });
129
77
  const doc = result.docs[0];
130
78
  if (!doc) throw new Error(`Flow not found: ${slug}`);
131
79
  return doc;
132
- })
80
+ }
133
81
  };
134
82
  }
135
83
  function nodeTypesQueryOptions(client) {
136
84
  return {
137
85
  queryKey: collectionKeys("flow-node-types").lists(),
138
- queryFn: () => __async(null, null, function* () {
139
- const result = yield client.from("flow-node-types").find({ limit: 0 });
86
+ queryFn: async () => {
87
+ const result = await client.from("flow-node-types").find({ limit: 0 });
140
88
  return result.docs;
141
- })
89
+ }
142
90
  };
143
91
  }
144
92
  function edgeTypesQueryOptions(client) {
145
93
  return {
146
94
  queryKey: collectionKeys("flow-edge-types").lists(),
147
- queryFn: () => __async(null, null, function* () {
148
- const result = yield client.from("flow-edge-types").find({ limit: 0 });
95
+ queryFn: async () => {
96
+ const result = await client.from("flow-edge-types").find({ limit: 0 });
149
97
  return result.docs;
150
- })
98
+ }
151
99
  };
152
100
  }
153
101
 
154
102
  // src/ui/Flow/useFlow.ts
155
103
  function toNodeTypeDef(doc) {
156
- var _a, _b, _c, _d, _e, _f;
157
104
  return {
158
- slug: String((_a = doc.slug) != null ? _a : ""),
159
- name: String((_b = doc.title) != null ? _b : ""),
160
- color: String((_c = doc.color) != null ? _c : "#e5e7eb"),
161
- defaultSize: (_d = doc.defaultSize) != null ? _d : {
105
+ slug: String(doc.slug ?? ""),
106
+ name: String(doc.title ?? ""),
107
+ color: String(doc.color ?? "#e5e7eb"),
108
+ defaultSize: doc.defaultSize ?? {
162
109
  width: 200,
163
110
  height: 200
164
111
  },
165
112
  fields: Array.isArray(doc.fields) ? doc.fields : [],
166
113
  transparentBackground: Boolean(doc.transparentBackground),
167
- template: (_e = doc.template) != null ? _e : null,
168
- customCSS: (_f = doc.customCSS) != null ? _f : null
114
+ template: doc.template ?? null,
115
+ customCSS: doc.customCSS ?? null
169
116
  };
170
117
  }
171
118
  function toEdgeTypeDef(doc) {
172
- var _a, _b, _c, _d, _e, _f, _g, _h;
173
119
  return {
174
- slug: String((_a = doc.slug) != null ? _a : ""),
175
- name: String((_b = doc.title) != null ? _b : ""),
176
- color: String((_c = doc.color) != null ? _c : ""),
177
- strokeWidth: (_d = doc.strokeWidth) != null ? _d : 2,
178
- animated: (_e = doc.animated) != null ? _e : false,
179
- lineStyle: String((_f = doc.lineStyle) != null ? _f : "default"),
180
- markerStart: String((_g = doc.markerStart) != null ? _g : "none"),
181
- markerEnd: String((_h = doc.markerEnd) != null ? _h : "arrow"),
120
+ slug: String(doc.slug ?? ""),
121
+ name: String(doc.title ?? ""),
122
+ color: String(doc.color ?? ""),
123
+ strokeWidth: doc.strokeWidth ?? 2,
124
+ animated: doc.animated ?? false,
125
+ lineStyle: String(doc.lineStyle ?? "default"),
126
+ markerStart: String(doc.markerStart ?? "none"),
127
+ markerEnd: String(doc.markerEnd ?? "arrow"),
182
128
  fields: Array.isArray(doc.fields) ? doc.fields : []
183
129
  };
184
130
  }
185
131
  function useFlow(options) {
186
- var _a, _b;
187
132
  const { client, slug, id, enabled = true } = options;
188
133
  const hasIdentifier = !!(slug || id);
189
134
  const flowQuery = useQuery(
190
- __spreadProps(__spreadValues({}, flowQueryOptions(client, slug, id)), {
135
+ {
136
+ ...flowQueryOptions(client, slug, id),
191
137
  enabled: enabled && hasIdentifier
192
- }),
138
+ },
193
139
  client.queryClient
194
140
  );
195
141
  const nodeTypesQuery = useQuery(
196
- __spreadProps(__spreadValues({}, nodeTypesQueryOptions(client)), {
142
+ {
143
+ ...nodeTypesQueryOptions(client),
197
144
  enabled
198
- }),
145
+ },
199
146
  client.queryClient
200
147
  );
201
148
  const edgeTypesQuery = useQuery(
202
- __spreadProps(__spreadValues({}, edgeTypesQueryOptions(client)), {
149
+ {
150
+ ...edgeTypesQueryOptions(client),
203
151
  enabled
204
- }),
152
+ },
205
153
  client.queryClient
206
154
  );
207
155
  const nodeTypeDefs = useMemo(() => {
208
- var _a2;
209
- const apiDefs = ((_a2 = nodeTypesQuery.data) != null ? _a2 : []).map(toNodeTypeDef);
156
+ const apiDefs = (nodeTypesQuery.data ?? []).map(toNodeTypeDef);
210
157
  const builtInSlugs = new Set(BUILT_IN_NODE_TYPES.map((t) => t.slug));
211
158
  const customDefs = apiDefs.filter((d) => !builtInSlugs.has(d.slug));
212
159
  return [...BUILT_IN_NODE_TYPES, ...customDefs];
213
160
  }, [nodeTypesQuery.data]);
214
161
  const edgeTypeDefs = useMemo(() => {
215
- var _a2;
216
- const apiDefs = ((_a2 = edgeTypesQuery.data) != null ? _a2 : []).map(toEdgeTypeDef);
162
+ const apiDefs = (edgeTypesQuery.data ?? []).map(toEdgeTypeDef);
217
163
  const builtInSlugs = new Set(BUILT_IN_EDGE_TYPES.map((t) => t.slug));
218
164
  const customDefs = apiDefs.filter((d) => !builtInSlugs.has(d.slug));
219
165
  return [...BUILT_IN_EDGE_TYPES, ...customDefs];
220
166
  }, [edgeTypesQuery.data]);
221
167
  const flow = flowQuery.data;
222
- const canvas = flow == null ? void 0 : flow.canvas;
168
+ const canvas = flow?.canvas;
223
169
  return {
224
170
  data: canvas,
225
171
  nodeTypeDefs,
226
172
  edgeTypeDefs,
227
173
  flow,
228
174
  isLoading: flowQuery.isLoading || nodeTypesQuery.isLoading || edgeTypesQuery.isLoading,
229
- error: (_b = (_a = flowQuery.error) != null ? _a : nodeTypesQuery.error) != null ? _b : edgeTypesQuery.error
175
+ error: flowQuery.error ?? nodeTypesQuery.error ?? edgeTypesQuery.error
230
176
  };
231
177
  }
232
178
 
233
179
  // src/ui/Flow/prefetchFlow.ts
234
- function prefetchFlow(options) {
235
- return __async(this, null, function* () {
236
- const { client, slug, id } = options;
237
- if (!slug && !id) {
238
- throw new Error("prefetchFlow requires either slug or id");
239
- }
240
- yield Promise.all([
241
- client.queryClient.prefetchQuery(flowQueryOptions(client, slug, id)),
242
- client.queryClient.prefetchQuery(nodeTypesQueryOptions(client)),
243
- client.queryClient.prefetchQuery(edgeTypesQueryOptions(client))
244
- ]);
245
- });
180
+ async function prefetchFlow(options) {
181
+ const { client, slug, id } = options;
182
+ if (!slug && !id) {
183
+ throw new Error("prefetchFlow requires either slug or id");
184
+ }
185
+ await Promise.all([
186
+ client.queryClient.prefetchQuery(flowQueryOptions(client, slug, id)),
187
+ client.queryClient.prefetchQuery(nodeTypesQueryOptions(client)),
188
+ client.queryClient.prefetchQuery(edgeTypesQueryOptions(client))
189
+ ]);
246
190
  }
247
191
 
248
192
  // src/ui/Flow/useFlowData.ts
@@ -250,21 +194,15 @@ import { useMemo as useMemo2 } from "react";
250
194
  function useFlowData(options) {
251
195
  const { data, nodeTypeDefs: inputNodeDefs, edgeTypeDefs: inputEdgeDefs } = options;
252
196
  const nodeTypeDefsMap = useMemo2(() => {
253
- const allDefs = inputNodeDefs != null ? inputNodeDefs : BUILT_IN_NODE_TYPES;
197
+ const allDefs = inputNodeDefs ?? BUILT_IN_NODE_TYPES;
254
198
  return new Map(allDefs.map((d) => [d.slug, d]));
255
199
  }, [inputNodeDefs]);
256
200
  const edgeTypeDefsMap = useMemo2(() => {
257
- const allDefs = inputEdgeDefs != null ? inputEdgeDefs : BUILT_IN_EDGE_TYPES;
201
+ const allDefs = inputEdgeDefs ?? BUILT_IN_EDGE_TYPES;
258
202
  return new Map(allDefs.map((d) => [d.slug, d]));
259
203
  }, [inputEdgeDefs]);
260
- const nodes = useMemo2(() => {
261
- var _a;
262
- return (_a = data == null ? void 0 : data.nodes) != null ? _a : [];
263
- }, [data == null ? void 0 : data.nodes]);
264
- const edges = useMemo2(() => {
265
- var _a;
266
- return (_a = data == null ? void 0 : data.edges) != null ? _a : [];
267
- }, [data == null ? void 0 : data.edges]);
204
+ const nodes = useMemo2(() => data?.nodes ?? [], [data?.nodes]);
205
+ const edges = useMemo2(() => data?.edges ?? [], [data?.edges]);
268
206
  return {
269
207
  nodes,
270
208
  edges,
@@ -275,10 +213,9 @@ function useFlowData(options) {
275
213
 
276
214
  // src/ui/Flow/utils.ts
277
215
  function getNodeSize(node) {
278
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
279
216
  return {
280
- width: (_e = (_d = (_c = (_a = node.style) == null ? void 0 : _a.width) != null ? _c : (_b = node.measured) == null ? void 0 : _b.width) != null ? _d : node.width) != null ? _e : 200,
281
- height: (_j = (_i = (_h = (_f = node.style) == null ? void 0 : _f.height) != null ? _h : (_g = node.measured) == null ? void 0 : _g.height) != null ? _i : node.height) != null ? _j : 200
217
+ width: node.style?.width ?? node.measured?.width ?? node.width ?? 200,
218
+ height: node.style?.height ?? node.measured?.height ?? node.height ?? 200
282
219
  };
283
220
  }
284
221
  function getAbsolutePosition(node, nodeMap) {
@@ -350,13 +287,12 @@ function getFrames(nodes) {
350
287
  if (frames.length === 0) return [];
351
288
  const nodeMap = new Map(nodes.map((n) => [n.id, n]));
352
289
  return frames.map((f) => {
353
- var _a;
354
290
  const data = f.data;
355
291
  const abs = getAbsolutePosition(f, nodeMap);
356
292
  const { width: w, height: h } = getNodeSize(f);
357
293
  return {
358
294
  id: f.id,
359
- label: (_a = data.label) != null ? _a : "",
295
+ label: data.label ?? "",
360
296
  bounds: { x: abs.x, y: abs.y, width: w, height: h }
361
297
  };
362
298
  }).sort((a, b) => a.bounds.y - b.bounds.y || a.bounds.x - b.bounds.x);
@@ -365,13 +301,13 @@ function getFrameData(data, frameId) {
365
301
  const frame = data.nodes.find((n) => n.id === frameId);
366
302
  if (!frame || frame.type !== "frame") return void 0;
367
303
  const descendantIds = collectDescendants(data.nodes, frameId);
368
- const childNodes = data.nodes.filter((n) => descendantIds.has(n.id)).map((n) => __spreadProps(__spreadValues({}, n), { draggable: false }));
304
+ const childNodes = data.nodes.filter((n) => descendantIds.has(n.id)).map((n) => ({ ...n, draggable: false }));
369
305
  const childEdges = data.edges.filter(
370
306
  (e) => descendantIds.has(e.source) && descendantIds.has(e.target)
371
307
  );
372
308
  const frameBounds = getNodeBounds(data.nodes, [frameId]);
373
309
  const { width: w, height: h } = getNodeSize(frame);
374
- const clampBounds = frameBounds != null ? frameBounds : {
310
+ const clampBounds = frameBounds ?? {
375
311
  x: frame.position.x,
376
312
  y: frame.position.y,
377
313
  width: w,
@@ -379,7 +315,7 @@ function getFrameData(data, frameId) {
379
315
  };
380
316
  const contentNodeIds = childNodes.filter((n) => n.id !== frameId).map((n) => n.id);
381
317
  const contentBounds = contentNodeIds.length > 0 ? getNodeBounds(data.nodes, contentNodeIds) : void 0;
382
- const fitBounds = contentBounds != null ? contentBounds : clampBounds;
318
+ const fitBounds = contentBounds ?? clampBounds;
383
319
  return {
384
320
  data: {
385
321
  nodes: childNodes,
@@ -420,6 +356,7 @@ function ensureQuickJSLoaded() {
420
356
  _notify();
421
357
  }).catch(() => {
422
358
  _state = { status: "failed", module: null };
359
+ _notify();
423
360
  });
424
361
  }
425
362
  function useQuickJS() {
@@ -429,6 +366,13 @@ function useQuickJS() {
429
366
  // src/ui/Flow/template-compiler.ts
430
367
  var MAX_CACHE_SIZE = 100;
431
368
  var MAX_MATERIALIZE_DEPTH = 20;
369
+ var IFRAME_BLOCKED_PROPS = /* @__PURE__ */ new Set([
370
+ "srcdoc",
371
+ "allow",
372
+ "allowpaymentrequest",
373
+ "name",
374
+ "sandbox"
375
+ ]);
432
376
  var ALLOWED_ELEMENTS = /* @__PURE__ */ new Set([
433
377
  "div",
434
378
  "span",
@@ -462,7 +406,8 @@ var ALLOWED_ELEMENTS = /* @__PURE__ */ new Set([
462
406
  "path",
463
407
  "g",
464
408
  "circle",
465
- "rect"
409
+ "rect",
410
+ "iframe"
466
411
  ]);
467
412
  var BLOCKED_PATTERNS = [
468
413
  /\bdocument\s*\./,
@@ -542,7 +487,7 @@ function isSafeUrl(value) {
542
487
  try {
543
488
  const url = new URL(value);
544
489
  return url.protocol === "http:" || url.protocol === "https:";
545
- } catch (e) {
490
+ } catch {
546
491
  return false;
547
492
  }
548
493
  }
@@ -564,13 +509,16 @@ function sanitizeStyle(style) {
564
509
  for (const [k, v] of Object.entries(style)) {
565
510
  if (BLOCKED_STYLE_PROPS.has(k)) continue;
566
511
  if (typeof v === "string" && /url\s*\(/i.test(v)) continue;
567
- if (k === "position" && typeof v === "string" && /fixed|absolute/i.test(v)) continue;
512
+ if (k === "position" && typeof v === "string" && /fixed|sticky/i.test(v)) continue;
513
+ if (k === "zIndex") {
514
+ const n = typeof v === "number" ? v : parseInt(String(v), 10);
515
+ if (isNaN(n) || n > 9998) continue;
516
+ }
568
517
  safe[k] = v;
569
518
  }
570
519
  return safe;
571
520
  }
572
521
  function materialize(node, depth = 0) {
573
- var _a;
574
522
  if (depth > MAX_MATERIALIZE_DEPTH) return null;
575
523
  if (node == null) return null;
576
524
  if (typeof node === "string" || typeof node === "number") return node;
@@ -592,7 +540,7 @@ function materialize(node, depth = 0) {
592
540
  );
593
541
  }
594
542
  if (d.$$t === "el") {
595
- const type = String((_a = d.type) != null ? _a : "");
543
+ const type = String(d.type ?? "");
596
544
  const props = d.props && typeof d.props === "object" ? d.props : {};
597
545
  const ch = Array.isArray(d.ch) ? d.ch : [];
598
546
  if (!ALLOWED_ELEMENTS.has(type.toLowerCase())) return null;
@@ -600,6 +548,7 @@ function materialize(node, depth = 0) {
600
548
  for (const [k, v] of Object.entries(props)) {
601
549
  if (k.startsWith("on")) continue;
602
550
  if (k === "dangerouslySetInnerHTML" || k === "ref") continue;
551
+ if (type === "iframe" && IFRAME_BLOCKED_PROPS.has(k)) continue;
603
552
  if ((k === "src" || k === "href") && !isSafeUrl(v)) continue;
604
553
  if (k === "style") {
605
554
  safeProps[k] = sanitizeStyle(v);
@@ -607,6 +556,9 @@ function materialize(node, depth = 0) {
607
556
  }
608
557
  safeProps[k] = v;
609
558
  }
559
+ if (type === "iframe") {
560
+ safeProps["sandbox"] = "allow-scripts allow-same-origin";
561
+ }
610
562
  const children = ch.map((c) => materialize(c, depth + 1));
611
563
  return React.createElement(type, safeProps, ...children);
612
564
  }
@@ -640,7 +592,7 @@ function makeRenderer(jsCode) {
640
592
  const raw = vm.dump(callResult.handle);
641
593
  callResult.handle.dispose();
642
594
  return materialize(JSON.parse(String(raw)));
643
- } catch (e) {
595
+ } catch {
644
596
  return null;
645
597
  } finally {
646
598
  vm.dispose();
@@ -649,8 +601,7 @@ function makeRenderer(jsCode) {
649
601
  }
650
602
  function makeReactFC(renderer, qjs) {
651
603
  return function QuickJSTemplateComponent(props) {
652
- var _a;
653
- return (_a = renderer(qjs, props)) != null ? _a : null;
604
+ return renderer(qjs, props) ?? null;
654
605
  };
655
606
  }
656
607
  function compileTemplate(code, slug) {
@@ -660,10 +611,10 @@ function compileTemplate(code, slug) {
660
611
  if (!qjs) return null;
661
612
  const cacheKey = `${slug}:${code.length}:${hashCode(code)}`;
662
613
  if (rendererCache.has(cacheKey)) {
663
- const renderer2 = rendererCache.get(cacheKey);
614
+ const entry = rendererCache.get(cacheKey);
664
615
  rendererCache.delete(cacheKey);
665
- rendererCache.set(cacheKey, renderer2);
666
- return makeReactFC(renderer2, qjs);
616
+ rendererCache.set(cacheKey, entry);
617
+ return entry.fc;
667
618
  }
668
619
  let jsCode;
669
620
  try {
@@ -674,16 +625,17 @@ function compileTemplate(code, slug) {
674
625
  jsxFragmentPragma: "React.Fragment"
675
626
  });
676
627
  jsCode = result.code;
677
- } catch (e) {
628
+ } catch {
678
629
  return null;
679
630
  }
680
631
  const renderer = makeRenderer(jsCode);
632
+ const fc = makeReactFC(renderer, qjs);
681
633
  if (rendererCache.size >= MAX_CACHE_SIZE) {
682
634
  const oldest = rendererCache.keys().next().value;
683
635
  if (oldest) rendererCache.delete(oldest);
684
636
  }
685
- rendererCache.set(cacheKey, renderer);
686
- return makeReactFC(renderer, qjs);
637
+ rendererCache.set(cacheKey, { renderer, fc });
638
+ return fc;
687
639
  }
688
640
  function clearTemplateCache() {
689
641
  rendererCache.clear();
@@ -697,15 +649,15 @@ function sanitizeUrl(url) {
697
649
  const parsed = new URL(url);
698
650
  if (parsed.protocol === "http:" || parsed.protocol === "https:") return url;
699
651
  return void 0;
700
- } catch (e) {
652
+ } catch {
701
653
  return void 0;
702
654
  }
703
655
  }
704
656
  function renderFieldValue(key, val, fieldDef) {
705
657
  if (val == null || val === "") return null;
706
- const fieldType = fieldDef == null ? void 0 : fieldDef.fieldType;
658
+ const fieldType = fieldDef?.fieldType;
707
659
  if (fieldType === "image" || typeof val === "object" && val !== null && "url" in val) {
708
- const imgUrl = typeof val === "string" ? val : val == null ? void 0 : val.url;
660
+ const imgUrl = typeof val === "string" ? val : val?.url;
709
661
  const safeUrl = sanitizeUrl(imgUrl);
710
662
  if (!safeUrl) return null;
711
663
  return /* @__PURE__ */ React2.createElement(
@@ -818,12 +770,11 @@ function EnhancedDynamicNode({
818
770
  );
819
771
  }
820
772
  function DefaultFrameNode({ data }) {
821
- var _a, _b, _c, _d;
822
773
  const d = data;
823
- const baseColor = (_a = d.color) != null ? _a : "rgb(128,128,128)";
824
- const padding = (_b = d.padding) != null ? _b : 20;
825
- const borderStyle = (_c = d.borderStyle) != null ? _c : "dashed";
826
- const opacity = (_d = d.opacity) != null ? _d : 0.15;
774
+ const baseColor = d.color ?? "rgb(128,128,128)";
775
+ const padding = d.padding ?? 20;
776
+ const borderStyle = d.borderStyle ?? "dashed";
777
+ const opacity = d.opacity ?? 0.15;
827
778
  const bgColor = (() => {
828
779
  const m = baseColor.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);
829
780
  if (m) return `rgba(${m[1]},${m[2]},${m[3]},${opacity})`;
@@ -857,21 +808,21 @@ function DefaultFrameNode({ data }) {
857
808
 
858
809
  // src/ui/Flow/field-helpers.ts
859
810
  function getImageField(fields, name) {
860
- const val = fields == null ? void 0 : fields[name];
811
+ const val = fields?.[name];
861
812
  if (val && typeof val === "object" && val !== null && "url" in val)
862
813
  return val;
863
814
  return void 0;
864
815
  }
865
816
  function getTextField(fields, name) {
866
- const val = fields == null ? void 0 : fields[name];
817
+ const val = fields?.[name];
867
818
  return typeof val === "string" ? val : void 0;
868
819
  }
869
820
  function getNumberField(fields, name) {
870
- const val = fields == null ? void 0 : fields[name];
821
+ const val = fields?.[name];
871
822
  return typeof val === "number" ? val : void 0;
872
823
  }
873
824
  function getBooleanField(fields, name) {
874
- const val = fields == null ? void 0 : fields[name];
825
+ const val = fields?.[name];
875
826
  return typeof val === "boolean" ? val : void 0;
876
827
  }
877
828
 
@@ -880,21 +831,77 @@ import postcss from "postcss";
880
831
  var ALLOWED_AT_RULES = /* @__PURE__ */ new Set(["keyframes", "media", "supports", "container", "layer"]);
881
832
  var BLOCKED_VALUE_PATTERNS = [/url\s*\(/i, /expression\s*\(/i, /paint\s*\(/i, /-moz-binding/i];
882
833
  var DANGEROUS_SELECTOR = /(?:^|[\s,])(?::root|html|body)\b/;
834
+ var BLOCKED_PROPERTY_VALUES = {
835
+ // absolute is allowed — contained by nearest positioned ancestor (node wrapper)
836
+ position: /fixed|sticky/i
837
+ };
838
+ var Z_INDEX_MAX = 9998;
883
839
  function sanitizeCSS(css, scopeClass) {
884
840
  let root;
885
841
  try {
886
842
  root = postcss.parse(css);
887
- } catch (e) {
843
+ } catch {
888
844
  return "";
889
845
  }
846
+ const safeScopeClass = scopeClass ? scopeClass.replace(/[{}()[\];,'"\\<>\s]/g, "") : "";
847
+ const keyframeNameMap = /* @__PURE__ */ new Map();
848
+ if (safeScopeClass) {
849
+ root.walkAtRules(/^keyframes$/i, (node) => {
850
+ const rawName = node.params.trim().replace(/^['"]|['"]$/g, "");
851
+ const originalName = rawName;
852
+ const scopedName = `${safeScopeClass}__${rawName.replace(/\s+/g, "_")}`;
853
+ keyframeNameMap.set(originalName, scopedName);
854
+ node.params = scopedName;
855
+ });
856
+ }
857
+ if (safeScopeClass && keyframeNameMap.size > 0) {
858
+ const ANIM_KEYWORDS = /* @__PURE__ */ new Set(["none", "initial", "inherit", "unset", "revert"]);
859
+ const replaceAnimName = (token) => {
860
+ const t = token.trim().replace(/^['"]|['"]$/g, "");
861
+ return ANIM_KEYWORDS.has(t) ? token : keyframeNameMap.get(t) ?? token;
862
+ };
863
+ root.walkDecls(/^animation-name$/i, (node) => {
864
+ node.value = node.value.split(",").map(replaceAnimName).join(", ");
865
+ });
866
+ root.walkDecls(/^animation$/i, (node) => {
867
+ node.value = node.value.split(",").map(
868
+ (anim) => anim.split(/(\s+)/).map((token) => /\s/.test(token) ? token : replaceAnimName(token)).join("")
869
+ ).join(",");
870
+ });
871
+ }
890
872
  root.walkAtRules((node) => {
891
873
  if (!ALLOWED_AT_RULES.has(node.name.toLowerCase())) {
892
874
  node.remove();
893
875
  }
894
876
  });
895
877
  root.walkDecls((node) => {
896
- if (BLOCKED_VALUE_PATTERNS.some((p) => p.test(node.value))) {
878
+ const normalizedValue = node.value.replace(/\/\*[\s\S]*?\*\//g, "");
879
+ if (BLOCKED_VALUE_PATTERNS.some((p) => p.test(normalizedValue))) {
897
880
  node.remove();
881
+ return;
882
+ }
883
+ const propLower = node.prop.toLowerCase();
884
+ const blockedValuePattern = BLOCKED_PROPERTY_VALUES[propLower];
885
+ if (blockedValuePattern) {
886
+ const deescaped = normalizedValue.replace(
887
+ /\\([0-9a-fA-F]{1,6})\s?/g,
888
+ (_, hex) => String.fromCodePoint(parseInt(hex, 16))
889
+ );
890
+ if (blockedValuePattern.test(deescaped)) {
891
+ node.remove();
892
+ return;
893
+ }
894
+ }
895
+ if (propLower === "z-index") {
896
+ const zv = node.value.trim();
897
+ if (zv === "auto" || zv === "initial" || zv === "inherit" || zv === "unset" || zv === "revert") {
898
+ } else {
899
+ const val = parseInt(zv, 10);
900
+ if (isNaN(val) || String(val) !== zv || val > Z_INDEX_MAX) {
901
+ node.remove();
902
+ return;
903
+ }
904
+ }
898
905
  }
899
906
  });
900
907
  root.walkRules((rule) => {
@@ -904,13 +911,12 @@ function sanitizeCSS(css, scopeClass) {
904
911
  return;
905
912
  }
906
913
  if (scopeClass) {
907
- const safeScopeClass = scopeClass.replace(/[{}()[\];,'"\\<>]/g, "");
908
914
  if (!safeScopeClass) {
909
915
  rule.remove();
910
916
  return;
911
917
  }
912
918
  const parent = rule.parent;
913
- if ((parent == null ? void 0 : parent.type) === "atrule" && parent.name.toLowerCase() === "keyframes") {
919
+ if (parent?.type === "atrule" && parent.name.toLowerCase() === "keyframes") {
914
920
  return;
915
921
  }
916
922
  rule.selectors = rule.selectors.map((sel) => `.${safeScopeClass} ${sel}`);
@@ -943,7 +949,7 @@ function getImageSrcSet(image) {
943
949
  if (sizes) {
944
950
  for (const size of IMAGE_SIZES) {
945
951
  const entry = sizes[String(size)];
946
- if ((entry == null ? void 0 : entry.url) && entry.width) {
952
+ if (entry?.url && entry.width) {
947
953
  parts.push(`${entry.url} ${entry.width}w`);
948
954
  }
949
955
  }
@@ -954,11 +960,10 @@ function getImageSrcSet(image) {
954
960
  return parts.join(", ");
955
961
  }
956
962
  function getImagePlaceholderStyle(image, options) {
957
- var _a, _b, _c;
958
- const type = (_a = options == null ? void 0 : options.type) != null ? _a : "blur";
959
- const paletteColor = (_b = options == null ? void 0 : options.paletteColor) != null ? _b : "muted";
963
+ const type = options?.type ?? "blur";
964
+ const paletteColor = options?.paletteColor ?? "muted";
960
965
  if (type === "none") return {};
961
- const color = (_c = image.palette) == null ? void 0 : _c[paletteColor];
966
+ const color = image.palette?.[paletteColor];
962
967
  if (type === "blur") {
963
968
  const lqip = image.lqip;
964
969
  if (lqip) {
@@ -997,15 +1002,14 @@ function Image({
997
1002
  fill = false,
998
1003
  imageRendering
999
1004
  }) {
1000
- var _a, _b;
1001
1005
  const [loaded, setLoaded] = useState(false);
1002
1006
  const firedRef = useRef(false);
1003
1007
  const isPixelRendering = imageRendering === "pixelated" || imageRendering === "crisp-edges";
1004
- const placeholder = placeholderProp != null ? placeholderProp : isPixelRendering ? "none" : "blur";
1005
- const loading = priority ? "eager" : loadingProp != null ? loadingProp : "lazy";
1008
+ const placeholder = placeholderProp ?? (isPixelRendering ? "none" : "blur");
1009
+ const loading = priority ? "eager" : loadingProp ?? "lazy";
1006
1010
  const aspectRatio = !fill && image.width && image.height ? `${image.width} / ${image.height}` : void 0;
1007
1011
  const srcSet = getImageSrcSet(image);
1008
- const src = (_a = image.url) != null ? _a : void 0;
1012
+ const src = image.url ?? void 0;
1009
1013
  const hasLqip = placeholder === "blur" && !!image.lqip;
1010
1014
  const placeholderStyle = getImagePlaceholderStyle(image, {
1011
1015
  type: placeholder
@@ -1015,7 +1019,7 @@ function Image({
1015
1019
  if (firedRef.current) return;
1016
1020
  firedRef.current = true;
1017
1021
  setLoaded(true);
1018
- onLoad == null ? void 0 : onLoad();
1022
+ onLoad?.();
1019
1023
  }, [onLoad]);
1020
1024
  const imgRef = useCallback(
1021
1025
  (node) => {
@@ -1025,10 +1029,13 @@ function Image({
1025
1029
  },
1026
1030
  [fireLoad]
1027
1031
  );
1028
- const containerStyle = __spreadValues(__spreadValues(__spreadValues({
1032
+ const containerStyle = {
1029
1033
  position: "relative",
1030
- overflow: "hidden"
1031
- }, fill ? { width: "100%", height: "100%" } : {}), aspectRatio ? { aspectRatio } : {}), style);
1034
+ overflow: "hidden",
1035
+ ...fill ? { width: "100%", height: "100%" } : {},
1036
+ ...aspectRatio ? { aspectRatio } : {},
1037
+ ...style
1038
+ };
1032
1039
  const overlayBase = {
1033
1040
  position: "absolute",
1034
1041
  top: 0,
@@ -1039,41 +1046,44 @@ function Image({
1039
1046
  transition: "opacity 0.3s ease",
1040
1047
  pointerEvents: "none"
1041
1048
  };
1042
- const mainImgStyle = __spreadValues(__spreadProps(__spreadValues({
1049
+ const mainImgStyle = {
1043
1050
  display: "block",
1044
1051
  width: "100%",
1045
1052
  height: "100%",
1046
- objectFit
1047
- }, imageRendering ? { imageRendering } : {}), {
1053
+ objectFit,
1054
+ ...imageRendering ? { imageRendering } : {},
1048
1055
  opacity: loaded ? 1 : 0,
1049
- transition: "opacity 0.3s ease"
1050
- }), imgStyle);
1056
+ transition: "opacity 0.3s ease",
1057
+ ...imgStyle
1058
+ };
1051
1059
  return /* @__PURE__ */ React3.createElement("div", { className, style: containerStyle }, hasLqip && /* @__PURE__ */ React3.createElement(
1052
1060
  "img",
1053
1061
  {
1054
1062
  "aria-hidden": true,
1055
1063
  alt: "",
1056
1064
  src: image.lqip,
1057
- style: __spreadProps(__spreadValues({}, overlayBase), {
1065
+ style: {
1066
+ ...overlayBase,
1058
1067
  display: "block",
1059
1068
  objectFit,
1060
1069
  filter: "blur(20px)",
1061
1070
  transform: "scale(1.1)"
1062
- })
1071
+ }
1063
1072
  }
1064
1073
  ), placeholderColor && /* @__PURE__ */ React3.createElement(
1065
1074
  "div",
1066
1075
  {
1067
1076
  "aria-hidden": true,
1068
- style: __spreadProps(__spreadValues({}, overlayBase), {
1077
+ style: {
1078
+ ...overlayBase,
1069
1079
  backgroundColor: placeholderColor
1070
- })
1080
+ }
1071
1081
  }
1072
1082
  ), /* @__PURE__ */ React3.createElement(
1073
1083
  "img",
1074
1084
  {
1075
1085
  ref: imgRef,
1076
- alt: (_b = image.alt) != null ? _b : "",
1086
+ alt: image.alt ?? "",
1077
1087
  src,
1078
1088
  srcSet: srcSet || void 0,
1079
1089
  sizes,
@@ -1092,10 +1102,9 @@ function Image({
1092
1102
  function createNodeTypes(nodeRenderers, nodeTypeDefsMap, frameRenderer, nodeWrapper, renderNode) {
1093
1103
  const types = {};
1094
1104
  types.dynamic = ((props) => {
1095
- var _a;
1096
1105
  const d = props.data;
1097
- const typeDef = nodeTypeDefsMap == null ? void 0 : nodeTypeDefsMap.get(d.nodeTypeSlug);
1098
- const CustomRenderer = nodeRenderers == null ? void 0 : nodeRenderers[d.nodeTypeSlug];
1106
+ const typeDef = nodeTypeDefsMap?.get(d.nodeTypeSlug);
1107
+ const CustomRenderer = nodeRenderers?.[d.nodeTypeSlug];
1099
1108
  const defaultRender = typeDef ? /* @__PURE__ */ React4.createElement(
1100
1109
  EnhancedDynamicNode,
1101
1110
  {
@@ -1104,7 +1113,7 @@ function createNodeTypes(nodeRenderers, nodeTypeDefsMap, frameRenderer, nodeWrap
1104
1113
  width: props.width,
1105
1114
  height: props.height
1106
1115
  }
1107
- ) : /* @__PURE__ */ React4.createElement(DefaultDynamicNode, __spreadValues({}, props));
1116
+ ) : /* @__PURE__ */ React4.createElement(DefaultDynamicNode, { ...props });
1108
1117
  const slotProps = {
1109
1118
  id: props.id,
1110
1119
  nodeTypeSlug: d.nodeTypeSlug,
@@ -1118,9 +1127,9 @@ function createNodeTypes(nodeRenderers, nodeTypeDefsMap, frameRenderer, nodeWrap
1118
1127
  };
1119
1128
  let content;
1120
1129
  if (CustomRenderer) {
1121
- content = /* @__PURE__ */ React4.createElement(CustomRenderer, __spreadValues({}, slotProps));
1130
+ content = /* @__PURE__ */ React4.createElement(CustomRenderer, { ...slotProps });
1122
1131
  } else if (d.nodeTypeSlug === "image") {
1123
- const imageVal = (_a = d.fields) == null ? void 0 : _a.image;
1132
+ const imageVal = d.fields?.image;
1124
1133
  if (imageVal && typeof imageVal === "object" && "url" in imageVal) {
1125
1134
  content = /* @__PURE__ */ React4.createElement(
1126
1135
  Image,
@@ -1183,8 +1192,7 @@ function createEdgeTypes(edgeRenderers, edgeTypeDefsMap) {
1183
1192
  const types = {};
1184
1193
  for (const [slug, Renderer] of Object.entries(edgeRenderers)) {
1185
1194
  types[slug] = ((props) => {
1186
- var _a;
1187
- const def = edgeTypeDefsMap == null ? void 0 : edgeTypeDefsMap.get(slug);
1195
+ const def = edgeTypeDefsMap?.get(slug);
1188
1196
  return /* @__PURE__ */ React4.createElement(
1189
1197
  Renderer,
1190
1198
  {
@@ -1193,7 +1201,7 @@ function createEdgeTypes(edgeRenderers, edgeTypeDefsMap) {
1193
1201
  source: props.source,
1194
1202
  target: props.target,
1195
1203
  label: props.label,
1196
- fields: (_a = props.data) == null ? void 0 : _a.fields,
1204
+ fields: props.data?.fields,
1197
1205
  edgeTypeDef: def,
1198
1206
  style: props.style
1199
1207
  }
@@ -1217,33 +1225,38 @@ var EDGE_TYPE_MAP = {
1217
1225
  default: "default"
1218
1226
  };
1219
1227
  function applyEdgeStyles(edges, edgeTypeDefsMap) {
1220
- if (!(edgeTypeDefsMap == null ? void 0 : edgeTypeDefsMap.size)) return edges;
1228
+ if (!edgeTypeDefsMap?.size) return edges;
1221
1229
  return edges.map((edge) => {
1222
- var _a;
1223
1230
  const slug = edge.edgeTypeSlug;
1224
1231
  if (!slug) return edge;
1225
1232
  const def = edgeTypeDefsMap.get(slug);
1226
1233
  if (!def) return edge;
1227
- const styled = __spreadValues({}, edge);
1234
+ const styled = { ...edge };
1228
1235
  if (!styled.type && def.lineStyle) {
1229
- styled.type = (_a = EDGE_TYPE_MAP[def.lineStyle]) != null ? _a : "default";
1236
+ styled.type = EDGE_TYPE_MAP[def.lineStyle] ?? "default";
1230
1237
  }
1231
- styled.style = __spreadValues(__spreadValues(__spreadValues({}, def.color ? { stroke: def.color } : void 0), def.strokeWidth ? { strokeWidth: def.strokeWidth } : void 0), edge.style);
1238
+ styled.style = {
1239
+ ...def.color ? { stroke: def.color } : void 0,
1240
+ ...def.strokeWidth ? { strokeWidth: def.strokeWidth } : void 0,
1241
+ ...edge.style
1242
+ };
1232
1243
  if (styled.animated == null && def.animated) styled.animated = true;
1233
1244
  if (!styled.markerStart) {
1234
1245
  const startType = toMarkerType(def.markerStart);
1235
1246
  if (startType) {
1236
- styled.markerStart = __spreadValues({
1237
- type: startType
1238
- }, def.color ? { color: def.color } : void 0);
1247
+ styled.markerStart = {
1248
+ type: startType,
1249
+ ...def.color ? { color: def.color } : void 0
1250
+ };
1239
1251
  }
1240
1252
  }
1241
1253
  if (!styled.markerEnd) {
1242
1254
  const endType = toMarkerType(def.markerEnd);
1243
1255
  if (endType) {
1244
- styled.markerEnd = __spreadValues({
1245
- type: endType
1246
- }, def.color ? { color: def.color } : void 0);
1256
+ styled.markerEnd = {
1257
+ type: endType,
1258
+ ...def.color ? { color: def.color } : void 0
1259
+ };
1247
1260
  }
1248
1261
  }
1249
1262
  return styled;
@@ -1318,7 +1331,7 @@ function FocusHandler({
1318
1331
  if (bw === 0 || bh === 0) return;
1319
1332
  const zoomFn = mode === "cover" ? Math.max : Math.min;
1320
1333
  const zoom = zoomFn(containerSize.w / bw, containerSize.h / bh);
1321
- const centerTarget = clampBounds != null ? clampBounds : b;
1334
+ const centerTarget = clampBounds ?? b;
1322
1335
  const cx = centerTarget.x + centerTarget.width / 2;
1323
1336
  const cy = centerTarget.y + centerTarget.height / 2;
1324
1337
  const x = containerSize.w / 2 - cx * zoom;
@@ -1328,9 +1341,9 @@ function FocusHandler({
1328
1341
  containerSize.w / clampBounds.width,
1329
1342
  containerSize.h / clampBounds.height
1330
1343
  );
1331
- store.getState().setMinZoom(Math.max(Math.min(coverZoom, zoom), minZoomProp != null ? minZoomProp : 0));
1344
+ store.getState().setMinZoom(Math.max(Math.min(coverZoom, zoom), minZoomProp ?? 0));
1332
1345
  } else {
1333
- store.getState().setMinZoom(minZoomProp != null ? minZoomProp : 0.5);
1346
+ store.getState().setMinZoom(minZoomProp ?? 0.5);
1334
1347
  }
1335
1348
  let vp = { x, y, zoom };
1336
1349
  if (isInitial || isBoundsChange) {
@@ -1338,12 +1351,12 @@ function FocusHandler({
1338
1351
  if (extent) {
1339
1352
  const visW = containerSize.w / zoom;
1340
1353
  const visH = containerSize.h / zoom;
1341
- onInitialFit == null ? void 0 : onInitialFit([
1354
+ onInitialFit?.([
1342
1355
  [Math.min(extent[0][0], cx - visW / 2), Math.min(extent[0][1], cy - visH / 2)],
1343
1356
  [Math.max(extent[1][0], cx + visW / 2), Math.max(extent[1][1], cy + visH / 2)]
1344
1357
  ]);
1345
1358
  } else {
1346
- onInitialFit == null ? void 0 : onInitialFit();
1359
+ onInitialFit?.();
1347
1360
  }
1348
1361
  } else {
1349
1362
  if (extent) {
@@ -1419,14 +1432,13 @@ function FlowRenderer({
1419
1432
  minZoom: minZoomProp,
1420
1433
  maxZoom: maxZoomProp
1421
1434
  }) {
1422
- var _a, _b;
1423
1435
  const resolvedFrameRenderer = hideFrames ? NullFrameRenderer : frameRenderer;
1424
1436
  const nodeTypeDefsMap = React6.useMemo(() => {
1425
- if (!(nodeTypeDefs == null ? void 0 : nodeTypeDefs.length)) return void 0;
1437
+ if (!nodeTypeDefs?.length) return void 0;
1426
1438
  return new Map(nodeTypeDefs.map((d) => [d.slug, d]));
1427
1439
  }, [nodeTypeDefs]);
1428
1440
  const edgeTypeDefsMap = React6.useMemo(() => {
1429
- if (!(edgeTypeDefs == null ? void 0 : edgeTypeDefs.length)) return void 0;
1441
+ if (!edgeTypeDefs?.length) return void 0;
1430
1442
  return new Map(edgeTypeDefs.map((d) => [d.slug, d]));
1431
1443
  }, [edgeTypeDefs]);
1432
1444
  const nodeTypes = React6.useMemo(
@@ -1444,28 +1456,27 @@ function FlowRenderer({
1444
1456
  [edgeRenderers, edgeTypeDefsMap]
1445
1457
  );
1446
1458
  const mergedCSS = React6.useMemo(() => {
1447
- if (!(nodeTypeDefs == null ? void 0 : nodeTypeDefs.length)) return "";
1459
+ if (!nodeTypeDefs?.length) return "";
1448
1460
  return nodeTypeDefs.filter((d) => d.customCSS).map((d) => sanitizeCSS(d.customCSS, `flow-node--${d.slug}`)).join("\n");
1449
1461
  }, [nodeTypeDefs]);
1450
1462
  const styledEdges = React6.useMemo(() => {
1451
- var _a2;
1452
- let edges = applyEdgeStyles((_a2 = data == null ? void 0 : data.edges) != null ? _a2 : [], edgeTypeDefsMap);
1463
+ let edges = applyEdgeStyles(data?.edges ?? [], edgeTypeDefsMap);
1453
1464
  if (edgeRenderers) {
1454
1465
  edges = edges.map((edge) => {
1455
1466
  const slug = edge.edgeTypeSlug;
1456
1467
  if (slug && edgeRenderers[slug]) {
1457
- return __spreadProps(__spreadValues({}, edge), { type: slug });
1468
+ return { ...edge, type: slug };
1458
1469
  }
1459
1470
  return edge;
1460
1471
  });
1461
1472
  }
1462
1473
  return edges;
1463
- }, [data == null ? void 0 : data.edges, edgeTypeDefsMap, edgeRenderers]);
1474
+ }, [data?.edges, edgeTypeDefsMap, edgeRenderers]);
1464
1475
  const translateExtent = React6.useMemo(() => {
1465
1476
  if (translateExtentProp) return translateExtentProp;
1466
- const es = clampBounds != null ? clampBounds : bounds;
1477
+ const es = clampBounds ?? bounds;
1467
1478
  if (!es) return void 0;
1468
- const ep = clampBounds ? 0 : focusPadding != null ? focusPadding : 0.1;
1479
+ const ep = clampBounds ? 0 : focusPadding ?? 0.1;
1469
1480
  return [
1470
1481
  [es.x - ep * es.width, es.y - ep * es.height],
1471
1482
  [es.x + es.width * (1 + ep), es.y + es.height * (1 + ep)]
@@ -1489,23 +1500,24 @@ function FlowRenderer({
1489
1500
  },
1490
1501
  []
1491
1502
  );
1492
- const activeExtent = !bounds || extentReadyRef.current ? (_a = expandedExtentRef.current) != null ? _a : translateExtent : void 0;
1503
+ const activeExtent = !bounds || extentReadyRef.current ? expandedExtentRef.current ?? translateExtent : void 0;
1493
1504
  if (!data) return null;
1494
- const resolvedDefaultViewport = defaultViewportProp != null ? defaultViewportProp : !fitView && data.viewport ? data.viewport : void 0;
1505
+ const resolvedDefaultViewport = defaultViewportProp ?? (!fitView && data.viewport ? data.viewport : void 0);
1495
1506
  return /* @__PURE__ */ React6.createElement(ReactFlowProvider, null, /* @__PURE__ */ React6.createElement(
1496
1507
  "div",
1497
1508
  {
1498
1509
  className,
1499
- style: __spreadValues({
1510
+ style: {
1500
1511
  width: "100%",
1501
1512
  height: "100%",
1502
- background: "transparent"
1503
- }, style)
1513
+ background: "transparent",
1514
+ ...style
1515
+ }
1504
1516
  },
1505
1517
  /* @__PURE__ */ React6.createElement(
1506
1518
  ReactFlow,
1507
1519
  {
1508
- nodes: (_b = data.nodes) != null ? _b : [],
1520
+ nodes: data.nodes ?? [],
1509
1521
  edges: styledEdges,
1510
1522
  nodeTypes,
1511
1523
  edgeTypes: customEdgeTypes,
@@ -1545,10 +1557,10 @@ function FlowRenderer({
1545
1557
  FocusHandler,
1546
1558
  {
1547
1559
  bounds,
1548
- padding: focusPadding != null ? focusPadding : 0.1,
1549
- animation: focusAnimation != null ? focusAnimation : true,
1560
+ padding: focusPadding ?? 0.1,
1561
+ animation: focusAnimation ?? true,
1550
1562
  mode: focusMode,
1551
- responsive: responsiveFit != null ? responsiveFit : true,
1563
+ responsive: responsiveFit ?? true,
1552
1564
  extent: translateExtent,
1553
1565
  clampBounds,
1554
1566
  minZoomProp,
@@ -1562,24 +1574,16 @@ function FlowRenderer({
1562
1574
 
1563
1575
  // src/ui/Flow/FlowFrame.tsx
1564
1576
  import React7, { useMemo as useMemo3, useEffect, useRef as useRef2 } from "react";
1565
- function FlowFrame(_a) {
1566
- var _b = _a, {
1567
- client,
1568
- slug,
1569
- id,
1570
- frameId,
1571
- loading = null,
1572
- error: renderError,
1573
- onDataReady
1574
- } = _b, rendererProps = __objRest(_b, [
1575
- "client",
1576
- "slug",
1577
- "id",
1578
- "frameId",
1579
- "loading",
1580
- "error",
1581
- "onDataReady"
1582
- ]);
1577
+ function FlowFrame({
1578
+ client,
1579
+ slug,
1580
+ id,
1581
+ frameId,
1582
+ loading = null,
1583
+ error: renderError,
1584
+ onDataReady,
1585
+ ...rendererProps
1586
+ }) {
1583
1587
  const { data, nodeTypeDefs, edgeTypeDefs, flow, isLoading, error } = useFlow({
1584
1588
  client,
1585
1589
  slug,
@@ -1592,9 +1596,8 @@ function FlowFrame(_a) {
1592
1596
  const onDataReadyRef = useRef2(onDataReady);
1593
1597
  onDataReadyRef.current = onDataReady;
1594
1598
  useEffect(() => {
1595
- var _a2;
1596
1599
  if (frameData && flow) {
1597
- (_a2 = onDataReadyRef.current) == null ? void 0 : _a2.call(onDataReadyRef, frameData, flow);
1600
+ onDataReadyRef.current?.(frameData, flow);
1598
1601
  }
1599
1602
  }, [frameData, flow]);
1600
1603
  if (process.env.NODE_ENV !== "production" && !slug && !id) {
@@ -1613,14 +1616,15 @@ function FlowFrame(_a) {
1613
1616
  }
1614
1617
  return /* @__PURE__ */ React7.createElement(
1615
1618
  FlowRenderer,
1616
- __spreadProps(__spreadValues({}, rendererProps), {
1619
+ {
1620
+ ...rendererProps,
1617
1621
  data: frameData.data,
1618
1622
  nodeTypeDefs,
1619
1623
  edgeTypeDefs,
1620
1624
  bounds: frameData.fitBounds,
1621
1625
  clampBounds: frameData.clampBounds,
1622
1626
  hideFrames: true
1623
- })
1627
+ }
1624
1628
  );
1625
1629
  }
1626
1630
  export {