@seedprotocol/mapping 0.6.2 → 0.6.4

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 (37) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +22 -3
  3. package/dist/applyMapping.d.ts +4 -2
  4. package/dist/applyMapping.d.ts.map +1 -1
  5. package/dist/autoMap-Dh9SiWhT.js +631 -0
  6. package/dist/autoMap-Dh9SiWhT.js.map +1 -0
  7. package/dist/edgeMapping.d.ts +21 -0
  8. package/dist/edgeMapping.d.ts.map +1 -0
  9. package/dist/index.d.ts +2 -1
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +34 -34
  12. package/dist/react/FieldMapper.d.ts +12 -2
  13. package/dist/react/FieldMapper.d.ts.map +1 -1
  14. package/dist/react/FieldMapperWires.d.ts.map +1 -1
  15. package/dist/react/PropertyRows.d.ts +4 -2
  16. package/dist/react/PropertyRows.d.ts.map +1 -1
  17. package/dist/react/SourceRows.d.ts +4 -2
  18. package/dist/react/SourceRows.d.ts.map +1 -1
  19. package/dist/react/fieldMapperCore.d.ts +3 -1
  20. package/dist/react/fieldMapperCore.d.ts.map +1 -1
  21. package/dist/react/fieldMapperSlots.d.ts +1 -1
  22. package/dist/react/fieldMapperSlots.d.ts.map +1 -1
  23. package/dist/react/fieldMapperTheme.d.ts +1 -1
  24. package/dist/react/fieldMapperTheme.d.ts.map +1 -1
  25. package/dist/react/fieldMapperTransforms.d.ts +7 -0
  26. package/dist/react/fieldMapperTransforms.d.ts.map +1 -0
  27. package/dist/react/fieldMapperTypes.d.ts +11 -1
  28. package/dist/react/fieldMapperTypes.d.ts.map +1 -1
  29. package/dist/react/useFieldMapper.d.ts.map +1 -1
  30. package/dist/react.d.ts +2 -1
  31. package/dist/react.d.ts.map +1 -1
  32. package/dist/react.js +741 -658
  33. package/dist/react.js.map +1 -1
  34. package/dist/resolvedSources.d.ts.map +1 -1
  35. package/dist/types.d.ts +20 -3
  36. package/dist/types.d.ts.map +1 -1
  37. package/package.json +1 -1
package/dist/react.js CHANGED
@@ -1,9 +1,9 @@
1
- import { S as e, _ as t, b as n, c as r, d as i, h as a, i as o, l as s, m as c, n as l, p as u, t as d, v as f, x as p, y as m } from "./autoMap-OMvtOG0S.js";
2
- import { useCallback as h, useEffect as g, useMemo as _, useRef as v, useState as y } from "react";
3
- import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
1
+ import { A as e, C as t, D as n, E as r, O as i, S as a, T as o, _ as s, a as c, c as l, f as u, g as d, i as f, k as p, l as m, n as h, r as g, s as _, t as v, u as y, x as b, y as x } from "./autoMap-Dh9SiWhT.js";
2
+ import { useCallback as S, useEffect as C, useMemo as w, useRef as T, useState as E } from "react";
3
+ import { Fragment as D, jsx as O, jsxs as k } from "react/jsx-runtime";
4
4
  //#region src/react/fieldMapperControls.tsx
5
- function C({ className: e, value: t, onChange: n, children: r, disabled: i, "aria-label": a }) {
6
- return /* @__PURE__ */ x("select", {
5
+ function A({ className: e, value: t, onChange: n, children: r, disabled: i, "aria-label": a }) {
6
+ return /* @__PURE__ */ O("select", {
7
7
  className: e,
8
8
  "aria-label": a,
9
9
  disabled: i,
@@ -12,8 +12,8 @@ function C({ className: e, value: t, onChange: n, children: r, disabled: i, "ari
12
12
  children: r
13
13
  });
14
14
  }
15
- function w({ className: e, type: t = "button", onClick: n, children: r, disabled: i, "aria-label": a, "aria-pressed": o }) {
16
- return /* @__PURE__ */ x("button", {
15
+ function j({ className: e, type: t = "button", onClick: n, children: r, disabled: i, "aria-label": a, "aria-pressed": o }) {
16
+ return /* @__PURE__ */ O("button", {
17
17
  type: t,
18
18
  className: e,
19
19
  onClick: n,
@@ -23,15 +23,15 @@ function w({ className: e, type: t = "button", onClick: n, children: r, disabled
23
23
  children: r
24
24
  });
25
25
  }
26
- function T({ className: e, children: t }) {
27
- return /* @__PURE__ */ x("span", {
26
+ function M({ className: e, children: t }) {
27
+ return /* @__PURE__ */ O("span", {
28
28
  className: e,
29
29
  children: t
30
30
  });
31
31
  }
32
32
  //#endregion
33
33
  //#region src/react/fieldMapperSlots.ts
34
- var E = {
34
+ var N = {
35
35
  root: "seed-field-mapper",
36
36
  toolbar: "fm-toolbar",
37
37
  filter: "fm-filter",
@@ -50,16 +50,17 @@ var E = {
50
50
  addButton: "fm-btn",
51
51
  inspector: "fm-inspector",
52
52
  lookupEditor: "fm-lookups",
53
+ rowExpansion: "fm-row-expansion",
53
54
  jsonPreview: "fm-preview"
54
55
  };
55
- function D(e, t, n) {
56
+ function P(e, t, n) {
56
57
  return [
57
- E[e],
58
+ N[e],
58
59
  t?.[e],
59
60
  n
60
61
  ].filter(Boolean).join(" ");
61
62
  }
62
- function O(e, t, n) {
63
+ function F(e, t, n) {
63
64
  let r;
64
65
  r = e?.preview === void 0 ? t !== !1 && "both" : e.preview;
65
66
  let i;
@@ -71,85 +72,93 @@ function O(e, t, n) {
71
72
  lookups: i
72
73
  };
73
74
  }
74
- function k(e) {
75
+ function I(e) {
75
76
  return e === "row" || e === "both";
76
77
  }
77
- function A(e) {
78
+ function L(e) {
78
79
  return e === "json" || e === "both";
79
80
  }
80
81
  //#endregion
81
82
  //#region src/react/fieldMapperCore.ts
82
- function j(e, t = 40) {
83
+ function R(e, t = 40) {
83
84
  let n = e.replace(/\s+/g, " ").trim();
84
85
  return n.length <= t ? n : `${n.slice(0, t)}…`;
85
86
  }
86
- function M(e) {
87
- let t = e.subtitle ? `${e.label} · ${e.subtitle}` : e.label, n = j(e.value, 36);
87
+ function z(e) {
88
+ let t = e.subtitle ? `${e.label} · ${e.subtitle}` : e.label, n = R(e.value, 36);
88
89
  return n ? `${t} · "${n}"` : t;
89
90
  }
90
- function N(e) {
91
+ function B(e) {
91
92
  return e.filter((e) => e.kind !== "resolved");
92
93
  }
93
- function P(e) {
94
- return N(e).map((e) => ({
94
+ function V(e) {
95
+ return B(e).map((e) => ({
95
96
  value: e.id,
96
- label: M(e),
97
+ label: z(e),
97
98
  sample: e.value,
98
99
  kind: e.kind
99
100
  }));
100
101
  }
101
- function F(e) {
102
+ function H(e) {
102
103
  return e.map((e) => ({
103
104
  value: e.name,
104
105
  label: e.required ? `${e.name} *` : e.name,
105
106
  dataType: e.dataType
106
107
  }));
107
108
  }
108
- function I(e) {
109
+ function U(e) {
109
110
  if (e.kind === "full" || e.kind === "section") return !1;
110
111
  let t = typeof e.meta?.url == "string" && e.meta.url.trim() ? e.meta.url.trim() : e.value;
111
- return !t.trim().includes("<") && u(t);
112
+ return !t.trim().includes("<") && b(t);
112
113
  }
113
- function L(e, t) {
114
+ function W(e, t) {
114
115
  if (!e || !t) return null;
115
- if (c(t)) return "lookup";
116
- if (I(e)) {
116
+ if (a(t)) return "lookup";
117
+ if (U(e)) {
117
118
  if (t.dataType === "Image" || t.dataType === "File") return "file";
118
119
  if (t.dataType === "Html") return "extract";
119
120
  }
120
121
  return null;
121
122
  }
122
- function R(e, t, r) {
123
+ function G(e, t, n) {
124
+ if (t === "derive") {
125
+ let e = n?.mapping?.derive?.from;
126
+ return e ? `‹derive from ${e}›` : "‹derive›";
127
+ }
128
+ if (t === "assemble") {
129
+ let e = n?.mapping?.assemble?.blocks;
130
+ return e?.length ? `‹assemble ${e.join(", ")}›` : "‹assemble›";
131
+ }
123
132
  if (!e) return "";
124
- if (t === "extract") return `‹extract HTML from ${j(e.value, 48)}›`;
125
- if (t === "file") return `‹file stored from ${j(e.value, 48)}›`;
133
+ if (t === "extract") return `‹extract HTML from ${R(e.value, 48)}›`;
134
+ if (t === "file") return `‹file stored from ${R(e.value, 48)}›`;
126
135
  if (t === "lookup") {
127
- let t = e.value || e.label, i = r?.mapping ?? {
136
+ let t = e.value || e.label, a = n?.mapping ?? {
128
137
  sourceId: e.id,
129
- propertyName: r?.propertyName ?? r?.target?.name ?? "",
138
+ propertyName: n?.propertyName ?? n?.target?.name ?? "",
130
139
  resolve: "lookup"
131
- }, a = f(i, t, r?.lookups);
132
- if (a !== void 0) {
133
- let e = r?.target ? n(a, r.target) : a;
134
- return j(Array.isArray(e) ? e.join(", ") : String(e), 80);
140
+ }, o = r(a, t, n?.lookups);
141
+ if (o !== void 0) {
142
+ let e = n?.target ? i(o, n.target) : o;
143
+ return R(Array.isArray(e) ? e.join(", ") : String(e), 80);
135
144
  }
136
- return `‹lookup ref for "${j(e.value, 48)}"›`;
145
+ return `‹lookup ref for "${R(e.value, 48)}"›`;
137
146
  }
138
- if (r?.target && c(r.target)) return "";
139
- if (r?.target) {
140
- let t = e.value || e.label, n = o(t, r.target.dataType);
141
- if (typeof n == "string") return j(n, 80);
142
- if (typeof n == "number" || typeof n == "boolean") return String(n);
147
+ if (n?.target && a(n.target)) return "";
148
+ if (n?.target) {
149
+ let t = e.value || e.label, r = u(t, n.target.dataType);
150
+ if (typeof r == "string") return R(r, 80);
151
+ if (typeof r == "number" || typeof r == "boolean") return String(r);
143
152
  try {
144
- return j(JSON.stringify(n), 80);
153
+ return R(JSON.stringify(r), 80);
145
154
  } catch {
146
- return j(String(n), 80);
155
+ return R(String(r), 80);
147
156
  }
148
157
  }
149
- return j(e.value, 80);
158
+ return R(e.value, 80);
150
159
  }
151
- function z(e, t, n) {
152
- let r = l(e, t, n), i = t.filter((e) => e.resolve && e.resolve !== "lookup");
160
+ function K(e, t, n) {
161
+ let r = y(e, t, n), i = t.filter((e) => e.resolve && e.resolve !== "lookup");
153
162
  return i.length === 0 ? r : {
154
163
  ...r,
155
164
  _pendingResolve: i.map((e) => ({
@@ -159,26 +168,26 @@ function z(e, t, n) {
159
168
  }))
160
169
  };
161
170
  }
162
- function B(e) {
171
+ function q(e) {
163
172
  if (e.conflict) return "conflict";
164
- if (!e.mapping?.sourceId || !e.mapping.propertyName) return "empty";
173
+ if (!e.mapping || !c(e.mapping)) return "empty";
165
174
  let t = e.mapping.resolve ?? null;
166
- if (e.requiredResolve && t !== e.requiredResolve) return "needsResolve";
175
+ if (e.requiredResolve && t !== e.requiredResolve && (t !== "assemble" || e.requiredResolve !== "extract")) return "needsResolve";
167
176
  if (t === "lookup") {
168
177
  let t = e.sampleValue ?? "";
169
- if (!t || f(e.mapping, t, e.lookups) === void 0) return "needsLookup";
178
+ if (!t || r(e.mapping, t, e.lookups) === void 0) return "needsLookup";
170
179
  }
171
180
  return "mapped";
172
181
  }
173
- function V(e, t) {
174
- let n = new Set(t.filter((e) => e.sourceId && e.propertyName).map((e) => e.propertyName)), r = e.filter((e) => e.required && !n.has(e.name)).map((e) => e.name);
182
+ function J(e, t) {
183
+ let n = new Set(t.filter(c).map((e) => e.propertyName)), r = e.filter((e) => e.required && !n.has(e.name)).map((e) => e.name);
175
184
  return {
176
185
  mapped: n.size,
177
186
  total: e.length,
178
187
  missingRequired: r
179
188
  };
180
189
  }
181
- function H(e) {
190
+ function ee(e) {
182
191
  let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set();
183
192
  for (let r of e) {
184
193
  let e = r.propertyName;
@@ -188,13 +197,41 @@ function H(e) {
188
197
  }
189
198
  return n;
190
199
  }
191
- function U(e, t) {
192
- return e.resolve ? e.resolve === "lookup" ? e : p(e) : t && c(t) ? {
200
+ function Y(e, t) {
201
+ return e.resolve ? e.resolve === "lookup" ? e : p(e) : t && a(t) ? {
193
202
  ...p(e),
194
203
  resolve: "lookup"
195
204
  } : p(e);
196
205
  }
197
- function W(t, n, r, i, a) {
206
+ function X(e, t, n, r, i) {
207
+ let a = t === "property" ? e.findIndex((e) => e.propertyName === n) : r.indexOf(n);
208
+ if (a < 0) return null;
209
+ let o = e[a];
210
+ if (!o || o.resolve !== "assemble") return null;
211
+ let s = [...e];
212
+ return s[a] = _(o, i), s;
213
+ }
214
+ function te(e, t, n, r, i) {
215
+ if (t === "property") {
216
+ let t = e.findIndex((e) => e.propertyName === n);
217
+ if (t >= 0) {
218
+ let n = [...e];
219
+ return n[t] = l(e[t], i), n;
220
+ }
221
+ return i ? Z(e, {
222
+ propertyName: n,
223
+ resolve: "derive",
224
+ derive: i
225
+ }) : null;
226
+ }
227
+ let a = r.indexOf(n);
228
+ if (a < 0) return null;
229
+ let o = e[a];
230
+ if (!o) return null;
231
+ let s = [...e];
232
+ return s[a] = l(o, i), s;
233
+ }
234
+ function ne(t, n, r, i, a) {
198
235
  if (n === "property") {
199
236
  let n = t.findIndex((e) => e.propertyName === r);
200
237
  if (n < 0) return null;
@@ -210,75 +247,77 @@ function W(t, n, r, i, a) {
210
247
  let c = [...t];
211
248
  return c[o] = e(s, a), c;
212
249
  }
213
- function G(e, t) {
250
+ function Z(e, t) {
214
251
  let n = e.filter((e) => e.propertyName !== t.propertyName);
215
252
  return n.push(t), n;
216
253
  }
217
- function K(e, t) {
254
+ function re(e, t) {
218
255
  if (t.length === 0) return null;
219
256
  let n = !1, r = { ...e };
220
257
  for (let e of t) e in r && (delete r[e], n = !0);
221
258
  return n ? r : null;
222
259
  }
223
- function q(e, t, n, i, a) {
224
- let o = new Map(n.map((e) => [e.name, e])), s = r(i, a);
225
- s = U(s, o.get(a)), t.some((e) => e.id === s.sourceId) || !N(t).find((e) => e.id === s.sourceId) && t.some((e) => e.id === i);
226
- let c = e.find((e) => e.propertyName === a), l = G(e, s), u = [];
227
- return c?.resolve === "lookup" && s.resolve !== "lookup" && u.push(a), {
228
- mappings: l,
229
- clearedLookupProps: u
260
+ function ie(e, t, n, r, i) {
261
+ let a = new Map(n.map((e) => [e.name, e])), o = d(r, i);
262
+ o = Y(o, a.get(i)), o.sourceId && !t.some((e) => e.id === o.sourceId) && !B(t).find((e) => e.id === o.sourceId) && t.some((e) => e.id === r);
263
+ let s = e.find((e) => e.propertyName === i);
264
+ o = m(o, s);
265
+ let c = Z(e, o), l = [];
266
+ return s?.resolve === "lookup" && o.resolve !== "lookup" && l.push(i), {
267
+ mappings: c,
268
+ clearedLookupProps: l
230
269
  };
231
270
  }
232
- function ee(e, t) {
271
+ function ae(e, t) {
233
272
  let n = s(t), r = [];
234
273
  return {
235
274
  mappings: e.filter((e) => {
236
275
  let i;
237
- return i = n ? e.sourceId !== n.originId || e.resolve !== n.resolve : e.sourceId !== t, !i && e.resolve === "lookup" && r.push(e.propertyName), i;
276
+ return i = n ? !(e.sourceId && e.sourceId === n.originId && e.resolve === n.resolve) : e.sourceId !== t, !i && e.resolve === "lookup" && r.push(e.propertyName), i;
238
277
  }),
239
278
  clearedLookupProps: r
240
279
  };
241
280
  }
242
- function J(e) {
243
- let { targets: t, mappings: n, sources: r, lookups: i } = e, a = new Map(n.map((e) => [e.propertyName, e])), o = new Map(N(r).map((e) => [e.id, e]));
244
- for (let e of r) o.has(e.id) || o.set(e.id, e);
281
+ function oe(e) {
282
+ let { targets: t, mappings: r, sources: i, lookups: a } = e, o = new Map(r.map((e) => [e.propertyName, e])), s = new Map(B(i).map((e) => [e.id, e]));
283
+ for (let e of i) s.has(e.id) || s.set(e.id, e);
245
284
  return (e.visiblePropertyNames == null ? t : t.filter((t) => e.visiblePropertyNames.has(t.name))).map((e) => {
246
- let t = a.get(e.name), n = t ? o.get(t.sourceId) : void 0, r = L(n, e), s = m(n), c = B({
285
+ let t = o.get(e.name), r = t?.sourceId ? s.get(t.sourceId) : void 0, i = W(r, e), c = n(r), l = q({
247
286
  mapping: t,
248
- requiredResolve: r,
249
- sampleValue: s,
250
- lookups: i
287
+ requiredResolve: i,
288
+ sampleValue: c,
289
+ lookups: a
251
290
  });
252
291
  return {
253
292
  id: e.name,
254
293
  target: e,
255
294
  mapping: t,
256
- source: n,
257
- sampleValue: s,
258
- preview: R(n, t?.resolve, {
295
+ source: r,
296
+ sampleValue: c,
297
+ preview: G(r, t?.resolve, {
259
298
  target: e,
260
- lookups: i,
299
+ lookups: a,
261
300
  propertyName: e.name,
262
301
  mapping: t
263
302
  }),
264
- requiredResolve: r,
265
- state: c
303
+ requiredResolve: i,
304
+ state: l
266
305
  };
267
306
  });
268
307
  }
269
- function te(e) {
270
- let { mappings: t, edgeIds: n, drafts: r, sources: i, targets: a, lookups: o } = e, s = new Map(i.map((e) => [e.id, e])), c = new Map(a.map((e) => [e.name, e])), l = [];
308
+ function se(e) {
309
+ let { mappings: t, edgeIds: r, drafts: i, sources: a, targets: o, lookups: s } = e, l = new Map(a.map((e) => [e.id, e])), u = new Map(o.map((e) => [e.name, e])), d = [];
271
310
  for (let e = 0; e < t.length; e++) {
272
- let r = t[e], i = n[e] ?? `edge-${e}`;
273
- l.push({
311
+ let n = t[e], i = r[e] ?? `edge-${e}`;
312
+ d.push({
274
313
  id: i,
275
- propertyName: r.propertyName,
276
- mapping: r,
277
- source: s.get(r.sourceId),
278
- target: c.get(r.propertyName)
314
+ propertyName: n.propertyName,
315
+ mapping: n,
316
+ source: n.sourceId ? l.get(n.sourceId) : void 0,
317
+ target: u.get(n.propertyName)
279
318
  });
280
319
  }
281
- for (let e of r) l.push({
320
+ for (let e of i) d.push({
282
321
  id: e.id,
283
322
  propertyName: e.propertyName,
284
323
  mapping: e.sourceId && e.propertyName ? {
@@ -290,49 +329,49 @@ function te(e) {
290
329
  propertyName: e.propertyName ?? "",
291
330
  ...e.resolve ? { resolve: e.resolve } : {}
292
331
  } : void 0,
293
- source: e.sourceId ? s.get(e.sourceId) : void 0,
294
- target: e.propertyName ? c.get(e.propertyName) : void 0
332
+ source: e.sourceId ? l.get(e.sourceId) : void 0,
333
+ target: e.propertyName ? u.get(e.propertyName) : void 0
295
334
  });
296
- let u = H(l);
335
+ let f = ee(d);
297
336
  return {
298
- rows: l.map((e) => {
299
- let t = L(e.source, e.target), n = (e.mapping && e.mapping.sourceId && e.mapping.propertyName, e.mapping), r = m(e.source), i = B({
300
- mapping: n && n.sourceId && n.propertyName ? n : void 0,
337
+ rows: d.map((e) => {
338
+ let t = W(e.source, e.target), r = (e.mapping && e.mapping.propertyName, e.mapping), i = n(e.source), a = r && c(r) ? r : void 0, o = q({
339
+ mapping: a,
301
340
  requiredResolve: t,
302
- conflict: u.has(e.id),
303
- sampleValue: r,
304
- lookups: o
305
- }), a = !n?.sourceId || !n?.propertyName ? u.has(e.id) ? "conflict" : "empty" : i, s = n && n.sourceId && n.propertyName ? n : void 0;
341
+ conflict: f.has(e.id),
342
+ sampleValue: i,
343
+ lookups: s
344
+ }), l = a ? o : f.has(e.id) ? "conflict" : "empty";
306
345
  return {
307
346
  id: e.id,
308
347
  target: e.target,
309
- mapping: s,
348
+ mapping: a,
310
349
  source: e.source,
311
- sampleValue: r,
312
- preview: R(e.source, s?.resolve, {
350
+ sampleValue: i,
351
+ preview: G(e.source, a?.resolve, {
313
352
  target: e.target,
314
- lookups: o,
315
- propertyName: s?.propertyName,
316
- mapping: s
353
+ lookups: s,
354
+ propertyName: a?.propertyName,
355
+ mapping: a
317
356
  }),
318
357
  requiredResolve: t,
319
- state: a
358
+ state: l
320
359
  };
321
360
  }),
322
- conflicts: u
361
+ conflicts: f
323
362
  };
324
363
  }
325
- function Y(e) {
364
+ function ce(e) {
326
365
  return `${e}-${Math.random().toString(36).slice(2, 10)}`;
327
366
  }
328
- function ne(e, t) {
367
+ function le(e, t) {
329
368
  if (e.length === t) return e;
330
369
  if (e.length > t) return e.slice(0, t);
331
370
  let n = [...e];
332
- for (; n.length < t;) n.push(Y("edge"));
371
+ for (; n.length < t;) n.push(ce("edge"));
333
372
  return n;
334
373
  }
335
- function re(e, t, n, r) {
374
+ function ue(e, t, n, r) {
336
375
  if (n === "all") return null;
337
376
  let i = new Set(t.map((e) => e.propertyName)), a = new Set(r);
338
377
  for (let t of e) (i.has(t.name) || n === "requiredAndMapped" && t.required) && a.add(t.name);
@@ -340,64 +379,64 @@ function re(e, t, n, r) {
340
379
  }
341
380
  //#endregion
342
381
  //#region src/react/LookupEditor.tsx
343
- function ie(e, n, r) {
344
- let i = t(n), a = r.trim(), o = e.filter((e) => t(e.value) !== i);
345
- return a && o.push({
346
- value: i,
347
- ref: a
348
- }), o;
349
- }
350
- function ae({ mapping: e, sources: n, targetsByName: r, onLookupChange: i, compact: o }) {
351
- let s = n.find((t) => t.id === e.sourceId), c = t(s?.value || s?.label || ""), l = a(e), u = new Set(l.map((e) => t(e.value)).filter(Boolean));
382
+ function de(e, t, n) {
383
+ let r = o(t), i = n.trim(), a = e.filter((e) => o(e.value) !== r);
384
+ return i && a.push({
385
+ value: r,
386
+ ref: i
387
+ }), a;
388
+ }
389
+ function fe({ mapping: e, sources: n, targetsByName: r, onLookupChange: i, compact: a }) {
390
+ let s = n.find((t) => t.id === e.sourceId), c = o(s?.value || s?.label || ""), l = t(e), u = new Set(l.map((e) => o(e.value)).filter(Boolean));
352
391
  c && u.add(c);
353
- let d = [...u], f = r.get(e.propertyName), p = new Map(l.map((e) => [t(e.value), e.ref]));
354
- return /* @__PURE__ */ S("div", {
392
+ let d = [...u], f = r.get(e.propertyName), p = new Map(l.map((e) => [o(e.value), e.ref]));
393
+ return /* @__PURE__ */ k("div", {
355
394
  className: "fm-lookup-block",
356
395
  children: [
357
- !o && /* @__PURE__ */ S("h4", { children: [e.propertyName, f?.ref ? ` → ${f.ref}` : ""] }),
358
- /* @__PURE__ */ x("div", {
396
+ !a && /* @__PURE__ */ k("h4", { children: [e.propertyName, f?.ref ? ` → ${f.ref}` : ""] }),
397
+ /* @__PURE__ */ O("div", {
359
398
  className: "fm-lookup-hint",
360
399
  children: "Map source strings to refs. Host owns Identity search/create."
361
400
  }),
362
- d.length === 0 ? /* @__PURE__ */ x("div", {
401
+ d.length === 0 ? /* @__PURE__ */ O("div", {
363
402
  className: "fm-lookup-hint",
364
403
  children: "No sample value yet — paste a source string key after connecting."
365
- }) : d.map((t) => /* @__PURE__ */ S("div", {
404
+ }) : d.map((t) => /* @__PURE__ */ k("div", {
366
405
  className: "fm-lookup-row",
367
- children: [/* @__PURE__ */ x("div", {
406
+ children: [/* @__PURE__ */ O("div", {
368
407
  className: "fm-lookup-key",
369
408
  title: t,
370
409
  children: t || "(empty)"
371
- }), /* @__PURE__ */ x("input", {
410
+ }), /* @__PURE__ */ O("input", {
372
411
  className: "fm-lookup-input",
373
412
  type: "text",
374
413
  placeholder: "ref",
375
414
  value: p.get(t) ?? "",
376
- onChange: (n) => i(e, ie(l, t, n.target.value)),
415
+ onChange: (n) => i(e, de(l, t, n.target.value)),
377
416
  onClick: (e) => e.stopPropagation()
378
417
  })]
379
418
  }, t))
380
419
  ]
381
420
  });
382
421
  }
383
- function X({ mode: e, mappings: t, sources: n, targets: r, onLookupChange: i, classNames: a, className: o }) {
384
- let s = _(() => t.filter((e) => e.resolve === "lookup"), [t]), c = _(() => {
422
+ function Q({ mode: e, mappings: t, sources: n, targets: r, onLookupChange: i, classNames: a, className: o }) {
423
+ let s = w(() => t.filter((e) => e.resolve === "lookup"), [t]), c = w(() => {
385
424
  let e = /* @__PURE__ */ new Map();
386
425
  for (let t of r) e.set(t.name, t);
387
426
  return e;
388
427
  }, [r]);
389
428
  if (s.length === 0) return null;
390
429
  let l = [
391
- D("lookupEditor", a),
430
+ P("lookupEditor", a),
392
431
  e === "row" ? "fm-lookups--row" : null,
393
432
  o
394
433
  ].filter(Boolean).join(" ");
395
- return /* @__PURE__ */ S("div", {
434
+ return /* @__PURE__ */ k("div", {
396
435
  className: l,
397
- children: [e === "section" && /* @__PURE__ */ x("div", {
436
+ children: [e === "section" && /* @__PURE__ */ O("div", {
398
437
  className: "fm-lookups-title",
399
438
  children: "Relation lookups"
400
- }), s.map((t) => /* @__PURE__ */ x(ae, {
439
+ }), s.map((t) => /* @__PURE__ */ O(fe, {
401
440
  mapping: t,
402
441
  sources: n,
403
442
  targetsByName: c,
@@ -408,21 +447,21 @@ function X({ mode: e, mappings: t, sources: n, targets: r, onLookupChange: i, cl
408
447
  }
409
448
  //#endregion
410
449
  //#region src/react/fieldMapperTheme.ts
411
- var oe = 8, Z = "seed-field-mapper-theme";
412
- function Q(e) {
450
+ var pe = 8, me = "seed-field-mapper-theme";
451
+ function he(e) {
413
452
  return e % 8;
414
453
  }
415
- function se(e, t) {
454
+ function ge(e, t) {
416
455
  if (t && t.length > 0) return t[e % t.length];
417
- let n = Q(e) + 1;
456
+ let n = he(e) + 1;
418
457
  return `var(--fm-map-${n}, var(--map-${n}, currentColor))`;
419
458
  }
420
- function ce(e = "default") {
459
+ function _e(e = "default") {
421
460
  return e === "unstyled" ? "none" : e;
422
461
  }
423
- var le = "\n --sfm-color-ground: #0f172a;\n --sfm-color-ink: #e2e8f0;\n --sfm-color-well: #1e293b;\n --sfm-color-line: #334155;\n --sfm-color-muted: #94a3b8;\n --sfm-color-faint: #64748b;\n --sfm-color-selection: #3b82f6;\n --sfm-color-warning: #fbbf24;\n --sfm-color-danger: #f87171;\n --sfm-color-highlight: #f59e0b;\n --sfm-map-1: #3b82f6;\n --sfm-map-2: #8b5cf6;\n --sfm-map-3: #ec4899;\n --sfm-map-4: #f59e0b;\n --sfm-map-5: #10b981;\n --sfm-map-6: #06b6d4;\n --sfm-map-7: #f97316;\n --sfm-map-8: #14b8a6;\n --fm-ground: var(--sfm-color-ground);\n --fm-ink: var(--sfm-color-ink);\n --fm-well: var(--sfm-color-well);\n --fm-line: var(--sfm-color-line);\n --fm-muted: var(--sfm-color-muted);\n --fm-faint: var(--sfm-color-faint);\n --fm-selection: var(--sfm-color-selection);\n --fm-highlight: var(--sfm-color-highlight);\n --fm-danger: var(--sfm-color-danger);\n --fm-warning: var(--sfm-color-warning);\n --fm-map-1: var(--sfm-map-1);\n --fm-map-2: var(--sfm-map-2);\n --fm-map-3: var(--sfm-map-3);\n --fm-map-4: var(--sfm-map-4);\n --fm-map-5: var(--sfm-map-5);\n --fm-map-6: var(--sfm-map-6);\n --fm-map-7: var(--sfm-map-7);\n --fm-map-8: var(--sfm-map-8);\n", ue = "\n.seed-field-mapper {\n\n --sfm-space-1: 4px;\n --sfm-space-2: 8px;\n --sfm-space-3: 12px;\n --sfm-space-4: 16px;\n --sfm-radius-sm: 4px;\n --sfm-radius-md: 8px;\n --sfm-radius-lg: 12px;\n --sfm-font-family: inherit;\n --sfm-font-mono: ui-monospace, monospace;\n --sfm-font-size-sm: 11px;\n --sfm-font-size-md: 13px;\n --sfm-control-height: 32px;\n --sfm-row-gap: var(--sfm-space-2);\n\n font-family: var(--sfm-font-family);\n border-radius: var(--sfm-radius-lg);\n padding: var(--sfm-space-4);\n}\n.seed-field-mapper * { box-sizing: border-box; }\n.seed-field-mapper .fm-toolbar {\n display: flex;\n gap: var(--sfm-space-2);\n align-items: center;\n margin-bottom: var(--sfm-space-3);\n flex-wrap: wrap;\n}\n.seed-field-mapper .fm-btn {\n border: 1px solid;\n border-radius: var(--sfm-radius-md);\n padding: 6px var(--sfm-space-3);\n cursor: pointer;\n font-size: var(--sfm-font-size-md);\n min-height: var(--sfm-control-height);\n}\n.seed-field-mapper .fm-meta {\n font-size: 12px;\n margin-left: auto;\n}\n.seed-field-mapper .fm-banner {\n font-size: 12px;\n padding: var(--sfm-space-2) 10px;\n border-radius: var(--sfm-radius-md);\n margin-bottom: 10px;\n border: 1px solid;\n}\n.seed-field-mapper .fm-grid {\n position: relative;\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 48px;\n min-height: 240px;\n}\n.seed-field-mapper .fm-col-title {\n font-size: var(--sfm-font-size-sm);\n text-transform: uppercase;\n letter-spacing: 0.06em;\n margin-bottom: var(--sfm-space-2);\n}\n.seed-field-mapper .fm-card {\n border: 1px solid;\n border-radius: var(--sfm-radius-md);\n padding: 10px var(--sfm-space-3);\n margin-bottom: var(--sfm-space-2);\n cursor: pointer;\n transition: border-color 0.15s, box-shadow 0.15s;\n}\n.seed-field-mapper .fm-label {\n font-weight: 600;\n font-size: var(--sfm-font-size-md);\n margin-bottom: var(--sfm-space-1);\n}\n.seed-field-mapper .fm-value {\n font-family: var(--sfm-font-mono);\n font-size: var(--sfm-font-size-sm);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.seed-field-mapper .fm-kind {\n font-size: 10px;\n margin-left: 6px;\n}\n.seed-field-mapper .fm-prop-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--sfm-space-2);\n}\n.seed-field-mapper .fm-dtype {\n font-size: 10px;\n padding: 2px 6px;\n border-radius: var(--sfm-radius-sm);\n border: 1px solid;\n}\n.seed-field-mapper .fm-remove {\n background: transparent;\n border: none;\n cursor: pointer;\n font-size: 14px;\n padding: 0 var(--sfm-space-1);\n}\n.seed-field-mapper .fm-svg {\n position: absolute;\n inset: 0;\n pointer-events: none;\n overflow: visible;\n}\n.seed-field-mapper .fm-preview {\n margin-top: var(--sfm-space-3);\n border: 1px solid;\n border-radius: var(--sfm-radius-md);\n padding: var(--sfm-space-3);\n font-family: var(--sfm-font-mono);\n font-size: var(--sfm-font-size-sm);\n white-space: pre-wrap;\n max-height: 200px;\n overflow: auto;\n}\n.seed-field-mapper details.fm-preview {\n font-family: var(--sfm-font-family);\n white-space: normal;\n max-height: none;\n overflow: visible;\n padding: var(--sfm-space-2) var(--sfm-space-3);\n}\n.seed-field-mapper details.fm-preview > summary {\n cursor: pointer;\n font-size: var(--sfm-font-size-sm);\n list-style: disclosure-closed;\n}\n.seed-field-mapper details.fm-preview[open] > summary {\n list-style: disclosure-open;\n margin-bottom: var(--sfm-space-2);\n}\n.seed-field-mapper .fm-preview-body {\n margin: 0;\n font-family: var(--sfm-font-mono);\n font-size: var(--sfm-font-size-sm);\n white-space: pre-wrap;\n max-height: 200px;\n overflow: auto;\n}\n.seed-field-mapper .fm-lookups {\n margin-top: var(--sfm-space-4);\n border-top: 1px solid;\n padding-top: var(--sfm-space-3);\n}\n.seed-field-mapper .fm-row .fm-lookups,\n.seed-field-mapper .fm-lookups--row {\n margin-top: var(--sfm-space-2);\n border-top: none;\n padding-top: 0;\n}\n.seed-field-mapper .fm-row .fm-lookup-block {\n margin-bottom: 0;\n padding: var(--sfm-space-2);\n}\n.seed-field-mapper .fm-lookups-title {\n font-size: var(--sfm-font-size-sm);\n text-transform: uppercase;\n letter-spacing: 0.06em;\n margin-bottom: var(--sfm-space-2);\n}\n.seed-field-mapper .fm-lookup-block {\n border: 1px solid;\n border-radius: var(--sfm-radius-md);\n padding: 10px var(--sfm-space-3);\n margin-bottom: var(--sfm-space-2);\n}\n.seed-field-mapper .fm-lookup-block h4 {\n margin: 0 0 var(--sfm-space-2);\n font-size: var(--sfm-font-size-md);\n font-weight: 600;\n}\n.seed-field-mapper .fm-lookup-hint {\n font-size: var(--sfm-font-size-sm);\n margin-bottom: var(--sfm-space-2);\n}\n.seed-field-mapper .fm-lookup-row {\n display: grid;\n grid-template-columns: 1fr 1.4fr;\n gap: var(--sfm-space-2);\n align-items: center;\n margin-bottom: 6px;\n}\n.seed-field-mapper .fm-lookup-key {\n font-family: var(--sfm-font-mono);\n font-size: var(--sfm-font-size-sm);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.seed-field-mapper .fm-lookup-input {\n width: 100%;\n border: 1px solid;\n border-radius: 6px;\n font-family: var(--sfm-font-mono);\n font-size: var(--sfm-font-size-sm);\n padding: 6px var(--sfm-space-2);\n}\n.seed-field-mapper .fm-lookup-input:focus {\n outline: none;\n}\n.seed-field-mapper .fm-row-list {\n display: flex;\n flex-direction: column;\n gap: var(--sfm-row-gap);\n}\n.seed-field-mapper .fm-row {\n border: 1px solid;\n border-radius: var(--sfm-radius-md);\n padding: 10px var(--sfm-space-3);\n}\n.seed-field-mapper .fm-row-main {\n display: grid;\n grid-template-columns: minmax(100px, 140px) 1fr auto auto auto;\n gap: var(--sfm-space-2);\n align-items: center;\n}\n.seed-field-mapper .fm-row-main-source {\n grid-template-columns: 1fr auto auto 1fr auto auto;\n}\n.seed-field-mapper .fm-row-accessory {\n display: flex;\n align-items: center;\n min-width: 0;\n}\n.seed-field-mapper .fm-row-accessory:empty {\n display: none;\n}\n.seed-field-mapper .fm-row-prop {\n display: flex;\n flex-direction: column;\n gap: 2px;\n min-width: 0;\n}\n.seed-field-mapper .fm-row-prop-name {\n font-weight: 600;\n font-size: var(--sfm-font-size-md);\n}\n.seed-field-mapper .fm-row-preview {\n margin-top: 6px;\n font-family: var(--sfm-font-mono);\n font-size: var(--sfm-font-size-sm);\n}\n.seed-field-mapper .fm-row-flag {\n font-size: var(--sfm-font-size-sm);\n margin-top: var(--sfm-space-1);\n}\n.seed-field-mapper .fm-select {\n width: 100%;\n border: 1px solid;\n border-radius: 6px;\n font-size: 12px;\n padding: 6px var(--sfm-space-2);\n min-width: 0;\n min-height: var(--sfm-control-height);\n}\n.seed-field-mapper .fm-select:focus {\n outline: none;\n}\n.seed-field-mapper .fm-filter {\n display: flex;\n gap: 6px;\n margin-bottom: 10px;\n flex-wrap: wrap;\n}\n.seed-field-mapper .fm-inspector {\n margin-top: var(--sfm-space-3);\n border-top: 1px solid;\n padding-top: 10px;\n}\n.seed-field-mapper .fm-inspector summary {\n cursor: pointer;\n font-size: 12px;\n margin-bottom: var(--sfm-space-2);\n}\n.seed-field-mapper .fm-inspector-row {\n display: grid;\n grid-template-columns: 1fr 1.5fr auto;\n gap: var(--sfm-space-2);\n align-items: center;\n padding: 6px 0;\n border-bottom: 1px solid;\n font-size: 12px;\n}\n.seed-field-mapper .fm-into {\n font-size: var(--sfm-font-size-sm);\n}\n", de = `
462
+ var ve = "\n --sfm-color-ground: #0f172a;\n --sfm-color-ink: #e2e8f0;\n --sfm-color-well: #1e293b;\n --sfm-color-line: #334155;\n --sfm-color-muted: #94a3b8;\n --sfm-color-faint: #64748b;\n --sfm-color-selection: #3b82f6;\n --sfm-color-warning: #fbbf24;\n --sfm-color-danger: #f87171;\n --sfm-color-highlight: #f59e0b;\n --sfm-map-1: #3b82f6;\n --sfm-map-2: #8b5cf6;\n --sfm-map-3: #ec4899;\n --sfm-map-4: #f59e0b;\n --sfm-map-5: #10b981;\n --sfm-map-6: #06b6d4;\n --sfm-map-7: #f97316;\n --sfm-map-8: #14b8a6;\n --fm-ground: var(--sfm-color-ground);\n --fm-ink: var(--sfm-color-ink);\n --fm-well: var(--sfm-color-well);\n --fm-line: var(--sfm-color-line);\n --fm-muted: var(--sfm-color-muted);\n --fm-faint: var(--sfm-color-faint);\n --fm-selection: var(--sfm-color-selection);\n --fm-highlight: var(--sfm-color-highlight);\n --fm-danger: var(--sfm-color-danger);\n --fm-warning: var(--sfm-color-warning);\n --fm-map-1: var(--sfm-map-1);\n --fm-map-2: var(--sfm-map-2);\n --fm-map-3: var(--sfm-map-3);\n --fm-map-4: var(--sfm-map-4);\n --fm-map-5: var(--sfm-map-5);\n --fm-map-6: var(--sfm-map-6);\n --fm-map-7: var(--sfm-map-7);\n --fm-map-8: var(--sfm-map-8);\n", ye = "\n.seed-field-mapper {\n\n --sfm-space-1: 4px;\n --sfm-space-2: 8px;\n --sfm-space-3: 12px;\n --sfm-space-4: 16px;\n --sfm-radius-sm: 4px;\n --sfm-radius-md: 8px;\n --sfm-radius-lg: 12px;\n --sfm-font-family: inherit;\n --sfm-font-mono: ui-monospace, monospace;\n --sfm-font-size-sm: 11px;\n --sfm-font-size-md: 13px;\n --sfm-control-height: 32px;\n --sfm-row-gap: var(--sfm-space-2);\n\n font-family: var(--sfm-font-family);\n border-radius: var(--sfm-radius-lg);\n padding: var(--sfm-space-4);\n}\n.seed-field-mapper * { box-sizing: border-box; }\n.seed-field-mapper .fm-toolbar {\n display: flex;\n gap: var(--sfm-space-2);\n align-items: center;\n margin-bottom: var(--sfm-space-3);\n flex-wrap: wrap;\n}\n.seed-field-mapper .fm-btn {\n border: 1px solid;\n border-radius: var(--sfm-radius-md);\n padding: 6px var(--sfm-space-3);\n cursor: pointer;\n font-size: var(--sfm-font-size-md);\n min-height: var(--sfm-control-height);\n}\n.seed-field-mapper .fm-meta {\n font-size: 12px;\n margin-left: auto;\n}\n.seed-field-mapper .fm-banner {\n font-size: 12px;\n padding: var(--sfm-space-2) 10px;\n border-radius: var(--sfm-radius-md);\n margin-bottom: 10px;\n border: 1px solid;\n}\n.seed-field-mapper .fm-grid {\n position: relative;\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 48px;\n min-height: 240px;\n}\n.seed-field-mapper .fm-col-title {\n font-size: var(--sfm-font-size-sm);\n text-transform: uppercase;\n letter-spacing: 0.06em;\n margin-bottom: var(--sfm-space-2);\n}\n.seed-field-mapper .fm-card {\n border: 1px solid;\n border-radius: var(--sfm-radius-md);\n padding: 10px var(--sfm-space-3);\n margin-bottom: var(--sfm-space-2);\n cursor: pointer;\n transition: border-color 0.15s, box-shadow 0.15s;\n}\n.seed-field-mapper .fm-label {\n font-weight: 600;\n font-size: var(--sfm-font-size-md);\n margin-bottom: var(--sfm-space-1);\n}\n.seed-field-mapper .fm-value {\n font-family: var(--sfm-font-mono);\n font-size: var(--sfm-font-size-sm);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.seed-field-mapper .fm-kind {\n font-size: 10px;\n margin-left: 6px;\n}\n.seed-field-mapper .fm-prop-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--sfm-space-2);\n}\n.seed-field-mapper .fm-dtype {\n font-size: 10px;\n padding: 2px 6px;\n border-radius: var(--sfm-radius-sm);\n border: 1px solid;\n}\n.seed-field-mapper .fm-remove {\n background: transparent;\n border: none;\n cursor: pointer;\n font-size: 14px;\n padding: 0 var(--sfm-space-1);\n}\n.seed-field-mapper .fm-svg {\n position: absolute;\n inset: 0;\n pointer-events: none;\n overflow: visible;\n}\n.seed-field-mapper .fm-preview {\n margin-top: var(--sfm-space-3);\n border: 1px solid;\n border-radius: var(--sfm-radius-md);\n padding: var(--sfm-space-3);\n font-family: var(--sfm-font-mono);\n font-size: var(--sfm-font-size-sm);\n white-space: pre-wrap;\n max-height: 200px;\n overflow: auto;\n}\n.seed-field-mapper details.fm-preview {\n font-family: var(--sfm-font-family);\n white-space: normal;\n max-height: none;\n overflow: visible;\n padding: var(--sfm-space-2) var(--sfm-space-3);\n}\n.seed-field-mapper details.fm-preview > summary {\n cursor: pointer;\n font-size: var(--sfm-font-size-sm);\n list-style: disclosure-closed;\n}\n.seed-field-mapper details.fm-preview[open] > summary {\n list-style: disclosure-open;\n margin-bottom: var(--sfm-space-2);\n}\n.seed-field-mapper .fm-preview-body {\n margin: 0;\n font-family: var(--sfm-font-mono);\n font-size: var(--sfm-font-size-sm);\n white-space: pre-wrap;\n max-height: 200px;\n overflow: auto;\n}\n.seed-field-mapper .fm-lookups {\n margin-top: var(--sfm-space-4);\n border-top: 1px solid;\n padding-top: var(--sfm-space-3);\n}\n.seed-field-mapper .fm-row .fm-lookups,\n.seed-field-mapper .fm-lookups--row {\n margin-top: var(--sfm-space-2);\n border-top: none;\n padding-top: 0;\n}\n.seed-field-mapper .fm-row .fm-lookup-block {\n margin-bottom: 0;\n padding: var(--sfm-space-2);\n}\n.seed-field-mapper .fm-lookups-title {\n font-size: var(--sfm-font-size-sm);\n text-transform: uppercase;\n letter-spacing: 0.06em;\n margin-bottom: var(--sfm-space-2);\n}\n.seed-field-mapper .fm-lookup-block {\n border: 1px solid;\n border-radius: var(--sfm-radius-md);\n padding: 10px var(--sfm-space-3);\n margin-bottom: var(--sfm-space-2);\n}\n.seed-field-mapper .fm-lookup-block h4 {\n margin: 0 0 var(--sfm-space-2);\n font-size: var(--sfm-font-size-md);\n font-weight: 600;\n}\n.seed-field-mapper .fm-lookup-hint {\n font-size: var(--sfm-font-size-sm);\n margin-bottom: var(--sfm-space-2);\n}\n.seed-field-mapper .fm-lookup-row {\n display: grid;\n grid-template-columns: 1fr 1.4fr;\n gap: var(--sfm-space-2);\n align-items: center;\n margin-bottom: 6px;\n}\n.seed-field-mapper .fm-lookup-key {\n font-family: var(--sfm-font-mono);\n font-size: var(--sfm-font-size-sm);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.seed-field-mapper .fm-lookup-input {\n width: 100%;\n border: 1px solid;\n border-radius: 6px;\n font-family: var(--sfm-font-mono);\n font-size: var(--sfm-font-size-sm);\n padding: 6px var(--sfm-space-2);\n}\n.seed-field-mapper .fm-lookup-input:focus {\n outline: none;\n}\n.seed-field-mapper .fm-row-list {\n display: flex;\n flex-direction: column;\n gap: var(--sfm-row-gap);\n}\n.seed-field-mapper .fm-row {\n border: 1px solid;\n border-radius: var(--sfm-radius-md);\n padding: 10px var(--sfm-space-3);\n}\n.seed-field-mapper .fm-row-main {\n display: grid;\n grid-template-columns: minmax(100px, 140px) 1fr auto auto auto;\n gap: var(--sfm-space-2);\n align-items: center;\n}\n.seed-field-mapper .fm-row-main-source {\n grid-template-columns: 1fr auto auto 1fr auto auto;\n}\n.seed-field-mapper .fm-row-accessory {\n display: flex;\n align-items: center;\n min-width: 0;\n}\n.seed-field-mapper .fm-row-accessory:empty {\n display: none;\n}\n.seed-field-mapper .fm-row-prop {\n display: flex;\n flex-direction: column;\n gap: 2px;\n min-width: 0;\n}\n.seed-field-mapper .fm-row-prop-name {\n font-weight: 600;\n font-size: var(--sfm-font-size-md);\n}\n.seed-field-mapper .fm-row-preview {\n margin-top: 6px;\n font-family: var(--sfm-font-mono);\n font-size: var(--sfm-font-size-sm);\n}\n.seed-field-mapper .fm-row-expansion {\n margin-top: 8px;\n}\n.seed-field-mapper .fm-row-expansion:empty {\n display: none;\n}\n.seed-field-mapper .fm-row-flag {\n font-size: var(--sfm-font-size-sm);\n margin-top: var(--sfm-space-1);\n}\n.seed-field-mapper .fm-select {\n width: 100%;\n border: 1px solid;\n border-radius: 6px;\n font-size: 12px;\n padding: 6px var(--sfm-space-2);\n min-width: 0;\n min-height: var(--sfm-control-height);\n}\n.seed-field-mapper .fm-select:focus {\n outline: none;\n}\n.seed-field-mapper .fm-filter {\n display: flex;\n gap: 6px;\n margin-bottom: 10px;\n flex-wrap: wrap;\n}\n.seed-field-mapper .fm-inspector {\n margin-top: var(--sfm-space-3);\n border-top: 1px solid;\n padding-top: 10px;\n}\n.seed-field-mapper .fm-inspector summary {\n cursor: pointer;\n font-size: 12px;\n margin-bottom: var(--sfm-space-2);\n}\n.seed-field-mapper .fm-inspector-row {\n display: grid;\n grid-template-columns: 1fr 1.5fr auto;\n gap: var(--sfm-space-2);\n align-items: center;\n padding: 6px 0;\n border-bottom: 1px solid;\n font-size: 12px;\n}\n.seed-field-mapper .fm-into {\n font-size: var(--sfm-font-size-sm);\n}\n", be = `
424
463
  .seed-field-mapper {
425
- ${le}
464
+ ${ve}
426
465
  color: var(--sfm-color-ink);
427
466
  background: var(--sfm-color-ground);
428
467
  }
@@ -557,66 +596,69 @@ ${le}
557
596
  color: var(--sfm-color-faint);
558
597
  }
559
598
  `;
560
- function fe(e) {
599
+ function xe(e) {
561
600
  return `@layer seed-field-mapper {\n${e}\n}`;
562
601
  }
563
- function pe(e) {
564
- return e === "none" ? "" : fe(e === "structural" ? ue : `${ue}\n${de}`);
602
+ function Se(e) {
603
+ return e === "none" ? "" : xe(e === "structural" ? ye : `${ye}\n${be}`);
565
604
  }
566
- var me = pe("default"), he = null;
567
- function ge(e) {
605
+ var Ce = Se("default"), we = null;
606
+ function Te(e) {
568
607
  if (typeof document > "u" || e === "none") return;
569
- let t = pe(e), n = document.getElementById(Z);
608
+ let t = Se(e), n = document.getElementById(me);
570
609
  if (n) {
571
- he !== e && (n.textContent = t, he = e);
610
+ we !== e && (n.textContent = t, we = e);
572
611
  return;
573
612
  }
574
613
  let r = document.createElement("style");
575
- r.id = Z, r.textContent = t, document.head.appendChild(r), he = e;
614
+ r.id = me, r.textContent = t, document.head.appendChild(r), we = e;
576
615
  }
577
- function _e() {
578
- if (he = null, typeof document > "u") return;
579
- let e = document.getElementById(Z);
616
+ function Ee() {
617
+ if (we = null, typeof document > "u") return;
618
+ let e = document.getElementById(me);
580
619
  e && (typeof e.remove == "function" ? e.remove() : e.parentNode && e.parentNode.removeChild(e));
581
620
  }
582
621
  //#endregion
583
622
  //#region src/react/FieldMapperWires.tsx
584
623
  function $(e, t) {
624
+ if (!e.sourceId) return "";
585
625
  if (!e.resolve) return e.sourceId;
586
- let n = i(e.sourceId, e.resolve);
626
+ let n = x(e.sourceId, e.resolve);
587
627
  return t.some((e) => e.id === n) ? n : e.sourceId;
588
628
  }
589
- function ve(e, t) {
629
+ function De(e, t) {
590
630
  let n = e.replace(/\s+/g, " ").trim();
591
631
  return n.length <= t ? n : `${n.slice(0, t)}…`;
592
632
  }
593
- function ye({ sources: e, targets: t, mappings: n, mapper: r, onLookupsChange: i, renderLookup: a, connectionColors: o, slots: c, classNames: l, ui: u = {
594
- Select: C,
595
- Button: w,
596
- Pill: T
633
+ function Oe({ sources: e, targets: t, mappings: n, mapper: r, onLookupsChange: i, renderLookup: a, connectionColors: o, slots: c, classNames: l, ui: u = {
634
+ Select: A,
635
+ Button: j,
636
+ Pill: M
597
637
  } }) {
598
- let d = u.Button, [f, p] = y(null), [m, E] = y(null), [O, k] = y(null), [j, M] = y(!1), [N, P] = y({
638
+ let d = u.Button, [f, p] = E(null), [m, h] = E(null), [g, _] = E(null), [v, y] = E(!1), [b, x] = E({
599
639
  width: 0,
600
640
  height: 0
601
- }), [F, I] = y([]), L = v(null), R = v({}), B = v({}), V = _(() => {
641
+ }), [N, F] = E([]), I = T(null), R = T({}), z = T({}), B = w(() => {
602
642
  let e = /* @__PURE__ */ new Map();
603
643
  return n.forEach((t, n) => {
604
644
  e.set(t.propertyName, n);
605
645
  }), e;
606
- }, [n]), H = _(() => {
646
+ }, [n]), V = w(() => {
607
647
  let t = /* @__PURE__ */ new Map();
608
648
  return n.forEach((n, r) => {
649
+ if (!n.sourceId) return;
609
650
  let i = $(n, e);
610
651
  for (let e of /* @__PURE__ */ new Set([n.sourceId, i])) {
611
652
  let n = t.get(e) ?? [];
612
653
  n.push(r), t.set(e, n);
613
654
  }
614
655
  }), t;
615
- }, [n, e]), U = h(() => {
616
- if (!L.current) return [];
617
- let t = L.current.getBoundingClientRect();
656
+ }, [n, e]), H = S(() => {
657
+ if (!I.current) return [];
658
+ let t = I.current.getBoundingClientRect();
618
659
  return n.map((n, r) => {
619
- let i = $(n, e), a = R.current[i] ?? R.current[n.sourceId], s = B.current[n.propertyName];
660
+ if (!n.sourceId) return null;
661
+ let i = $(n, e), a = R.current[i] ?? R.current[n.sourceId], s = z.current[n.propertyName];
620
662
  if (!a || !s) return null;
621
663
  let c = a.getBoundingClientRect(), l = s.getBoundingClientRect();
622
664
  return {
@@ -624,7 +666,7 @@ function ye({ sources: e, targets: t, mappings: n, mapper: r, onLookupsChange: i
624
666
  y1: c.top + c.height / 2 - t.top,
625
667
  x2: l.left - t.left,
626
668
  y2: l.top + l.height / 2 - t.top,
627
- stroke: se(r, o),
669
+ stroke: ge(r, o),
628
670
  mappingIndex: r,
629
671
  mapping: n
630
672
  };
@@ -634,16 +676,16 @@ function ye({ sources: e, targets: t, mappings: n, mapper: r, onLookupsChange: i
634
676
  o,
635
677
  e
636
678
  ]);
637
- g(() => {
679
+ C(() => {
638
680
  let e = () => {
639
- if (L.current) {
640
- let e = L.current.getBoundingClientRect();
641
- P({
681
+ if (I.current) {
682
+ let e = I.current.getBoundingClientRect();
683
+ x({
642
684
  width: e.width,
643
685
  height: e.height
644
686
  });
645
687
  }
646
- I(U());
688
+ F(H());
647
689
  };
648
690
  e(), window.addEventListener("resize", e);
649
691
  let t = setInterval(e, 200);
@@ -651,80 +693,80 @@ function ye({ sources: e, targets: t, mappings: n, mapper: r, onLookupsChange: i
651
693
  window.removeEventListener("resize", e), clearInterval(t);
652
694
  };
653
695
  }, [
654
- U,
696
+ H,
655
697
  n,
656
698
  e,
657
699
  t
658
700
  ]);
659
- let W = (e) => {
701
+ let U = (e) => {
660
702
  p((t) => t === e ? null : e);
661
- }, G = (e) => {
703
+ }, W = (e) => {
662
704
  f && r.connect(f, e);
663
- }, K = (e) => {
705
+ }, G = (e) => {
664
706
  let t = s(e);
665
707
  return t ? n.some((e) => e.sourceId === t.originId && e.resolve === t.resolve) : n.some((t) => t.sourceId === e);
666
- }, q = (e) => n.find((t) => t.propertyName === e), ee = (t) => {
708
+ }, q = (e) => n.find((t) => t.propertyName === e), J = (t) => {
667
709
  if (m) return t.propertyName === m;
668
- if (O) {
710
+ if (g) {
669
711
  let n = $(t, e);
670
- return t.sourceId === O || n === O;
712
+ return t.sourceId === g || n === g;
671
713
  }
672
714
  return !1;
673
- }, J = m != null || O != null, te = _(() => z(e, n, t), [
715
+ }, ee = m != null || g != null, Y = w(() => K(e, n, t), [
674
716
  e,
675
717
  n,
676
718
  t
677
- ]), { coverage: Y } = r, ne = A(c.preview);
678
- return /* @__PURE__ */ S(b, { children: [
679
- /* @__PURE__ */ S("div", {
680
- className: D("toolbar", l),
681
- children: [c.autoMap && /* @__PURE__ */ x(d, {
682
- className: D("autoMapButton", l),
719
+ ]), { coverage: X } = r, te = L(c.preview);
720
+ return /* @__PURE__ */ k(D, { children: [
721
+ /* @__PURE__ */ k("div", {
722
+ className: P("toolbar", l),
723
+ children: [c.autoMap && /* @__PURE__ */ O(d, {
724
+ className: P("autoMapButton", l),
683
725
  onClick: () => r.autoMap(),
684
726
  children: "Auto-map"
685
- }), /* @__PURE__ */ S("span", {
686
- className: D("coverage", l),
727
+ }), /* @__PURE__ */ k("span", {
728
+ className: P("coverage", l),
687
729
  children: [
688
- Y.mapped,
730
+ X.mapped,
689
731
  " / ",
690
- Y.total,
732
+ X.total,
691
733
  " mapped",
692
- Y.missingRequired.length > 0 ? ` · ${Y.missingRequired.length} required missing` : "",
734
+ X.missingRequired.length > 0 ? ` · ${X.missingRequired.length} required missing` : "",
693
735
  f ? " · click properties (source stays selected)" : " · click a source"
694
736
  ]
695
737
  })]
696
738
  }),
697
- /* @__PURE__ */ S("div", {
739
+ /* @__PURE__ */ k("div", {
698
740
  className: "fm-grid",
699
- ref: L,
741
+ ref: I,
700
742
  children: [
701
- /* @__PURE__ */ x("svg", {
743
+ /* @__PURE__ */ O("svg", {
702
744
  className: "fm-svg",
703
- width: N.width,
704
- height: N.height,
705
- children: F.map((e) => {
706
- let t = ee(e.mapping), n = (e.x1 + e.x2) / 2;
707
- return /* @__PURE__ */ x("path", {
745
+ width: b.width,
746
+ height: b.height,
747
+ children: N.map((e) => {
748
+ let t = J(e.mapping), n = (e.x1 + e.x2) / 2;
749
+ return /* @__PURE__ */ O("path", {
708
750
  className: "fm-connector",
709
751
  "data-mapping-index": e.mappingIndex,
710
- "data-pair": Q(e.mappingIndex),
752
+ "data-pair": he(e.mappingIndex),
711
753
  d: `M ${e.x1} ${e.y1} C ${n} ${e.y1}, ${n} ${e.y2}, ${e.x2} ${e.y2}`,
712
754
  stroke: e.stroke,
713
755
  strokeWidth: t ? 3 : 2,
714
756
  fill: "none",
715
- opacity: J && !t ? .25 : .85
757
+ opacity: ee && !t ? .25 : .85
716
758
  }, `${e.mapping.sourceId}-${e.mapping.propertyName}-${e.mapping.resolve ?? "copy"}`);
717
759
  })
718
760
  }),
719
- /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("div", {
761
+ /* @__PURE__ */ k("div", { children: [/* @__PURE__ */ O("div", {
720
762
  className: "fm-col-title",
721
763
  children: "Sources"
722
764
  }), e.map((t) => {
723
- let i = K(t.id), a = f === t.id, o = H.get(t.id) ?? [], s = o[0], c = O === t.id || m != null && n.some((n) => {
765
+ let i = G(t.id), a = f === t.id, o = V.get(t.id) ?? [], s = o[0], c = g === t.id || m != null && n.some((n) => {
724
766
  let r = $(n, e);
725
767
  return (n.sourceId === t.id || r === t.id) && n.propertyName === m;
726
768
  });
727
- return /* @__PURE__ */ S("div", {
769
+ return /* @__PURE__ */ k("div", {
728
770
  ref: (e) => {
729
771
  R.current[t.id] = e;
730
772
  },
@@ -732,74 +774,74 @@ function ye({ sources: e, targets: t, mappings: n, mapper: r, onLookupsChange: i
732
774
  "data-source-id": t.id,
733
775
  ...o.length > 0 ? {
734
776
  "data-mapping-index": o.join(" "),
735
- "data-pair": String(Q(s))
777
+ "data-pair": String(he(s))
736
778
  } : {},
737
- onClick: () => W(t.id),
738
- onMouseEnter: () => k(t.id),
739
- onMouseLeave: () => k(null),
740
- children: [/* @__PURE__ */ S("div", {
779
+ onClick: () => U(t.id),
780
+ onMouseEnter: () => _(t.id),
781
+ onMouseLeave: () => _(null),
782
+ children: [/* @__PURE__ */ k("div", {
741
783
  className: "fm-prop-row",
742
- children: [/* @__PURE__ */ S("div", {
784
+ children: [/* @__PURE__ */ k("div", {
743
785
  className: "fm-label",
744
786
  children: [
745
787
  t.label,
746
- t.subtitle ? /* @__PURE__ */ x("span", {
788
+ t.subtitle ? /* @__PURE__ */ O("span", {
747
789
  className: "fm-kind",
748
790
  children: t.subtitle
749
791
  }) : null,
750
- /* @__PURE__ */ x("span", {
792
+ /* @__PURE__ */ O("span", {
751
793
  className: "fm-kind",
752
794
  children: t.kind
753
795
  })
754
796
  ]
755
- }), i && /* @__PURE__ */ x(d, {
756
- className: D("removeButton", l),
797
+ }), i && /* @__PURE__ */ O(d, {
798
+ className: P("removeButton", l),
757
799
  "aria-label": "Remove all mappings for source",
758
800
  onClick: (e) => {
759
801
  e.stopPropagation(), r.removeBySource(t.id);
760
802
  },
761
803
  children: "×"
762
804
  })]
763
- }), /* @__PURE__ */ x("div", {
805
+ }), /* @__PURE__ */ O("div", {
764
806
  className: "fm-value",
765
- children: ve(t.value, 80)
807
+ children: De(t.value, 80)
766
808
  })]
767
809
  }, t.id);
768
810
  })] }),
769
- /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("div", {
811
+ /* @__PURE__ */ k("div", { children: [/* @__PURE__ */ O("div", {
770
812
  className: "fm-col-title",
771
813
  children: "Model properties"
772
814
  }), t.map((t) => {
773
- let n = q(t.name), i = V.get(t.name), a = m === t.name || O != null && n != null && (n.sourceId === O || $(n, e) === O);
774
- return /* @__PURE__ */ S("div", {
815
+ let n = q(t.name), i = B.get(t.name), a = m === t.name || g != null && n != null && (n.sourceId === g || $(n, e) === g);
816
+ return /* @__PURE__ */ k("div", {
775
817
  ref: (e) => {
776
- B.current[t.name] = e;
818
+ z.current[t.name] = e;
777
819
  },
778
820
  className: `fm-card${n ? " mapped" : ""}${a ? " highlight" : ""}`,
779
821
  "data-property-name": t.name,
780
822
  ...i == null ? {} : {
781
823
  "data-mapping-index": String(i),
782
- "data-pair": String(Q(i))
824
+ "data-pair": String(he(i))
783
825
  },
784
- onClick: () => G(t.name),
785
- onMouseEnter: () => E(t.name),
786
- onMouseLeave: () => E(null),
787
- children: [/* @__PURE__ */ S("div", {
826
+ onClick: () => W(t.name),
827
+ onMouseEnter: () => h(t.name),
828
+ onMouseLeave: () => h(null),
829
+ children: [/* @__PURE__ */ k("div", {
788
830
  className: "fm-prop-row",
789
- children: [/* @__PURE__ */ x("div", {
831
+ children: [/* @__PURE__ */ O("div", {
790
832
  className: "fm-label",
791
833
  children: t.name
792
- }), /* @__PURE__ */ S("div", {
834
+ }), /* @__PURE__ */ k("div", {
793
835
  style: {
794
836
  display: "flex",
795
837
  alignItems: "center",
796
838
  gap: 4
797
839
  },
798
- children: [/* @__PURE__ */ S("span", {
840
+ children: [/* @__PURE__ */ k("span", {
799
841
  className: "fm-dtype",
800
842
  children: [t.dataType, t.ref ? ` → ${t.ref}` : ""]
801
- }), n && /* @__PURE__ */ x(d, {
802
- className: D("removeButton", l),
843
+ }), n && /* @__PURE__ */ O(d, {
844
+ className: P("removeButton", l),
803
845
  "aria-label": "Remove mapping for property",
804
846
  onClick: (e) => {
805
847
  e.stopPropagation(), r.removeRow(t.name);
@@ -807,7 +849,7 @@ function ye({ sources: e, targets: t, mappings: n, mapper: r, onLookupsChange: i
807
849
  children: "×"
808
850
  })]
809
851
  })]
810
- }), n && /* @__PURE__ */ S("div", {
852
+ }), n && /* @__PURE__ */ k("div", {
811
853
  className: "fm-value",
812
854
  children: [
813
855
  "← ",
@@ -819,15 +861,15 @@ function ye({ sources: e, targets: t, mappings: n, mapper: r, onLookupsChange: i
819
861
  })] })
820
862
  ]
821
863
  }),
822
- c.lookups === "section" && a && r.rows.filter((e) => e.mapping?.resolve === "lookup").map((e) => /* @__PURE__ */ x("div", {
823
- className: D("lookupEditor", l),
864
+ c.lookups === "section" && a && r.rows.filter((e) => e.mapping?.resolve === "lookup").map((e) => /* @__PURE__ */ O("div", {
865
+ className: P("lookupEditor", l),
824
866
  children: a({
825
867
  ...e,
826
868
  sampleValue: e.sampleValue ?? "",
827
869
  onLookupChange: (t) => r.setLookupEntries(e.id, t)
828
870
  })
829
871
  }, e.id)),
830
- c.lookups === "section" && !a && i && /* @__PURE__ */ x(X, {
872
+ c.lookups === "section" && !a && i && /* @__PURE__ */ O(Q, {
831
873
  mode: "section",
832
874
  mappings: n,
833
875
  sources: e,
@@ -838,96 +880,126 @@ function ye({ sources: e, targets: t, mappings: n, mapper: r, onLookupsChange: i
838
880
  },
839
881
  classNames: l
840
882
  }),
841
- ne && /* @__PURE__ */ S("details", {
842
- className: D("jsonPreview", l),
843
- open: j,
844
- onToggle: (e) => M(e.target.open),
845
- children: [/* @__PURE__ */ x("summary", { children: "Preview JSON" }), /* @__PURE__ */ x("pre", {
883
+ te && /* @__PURE__ */ k("details", {
884
+ className: P("jsonPreview", l),
885
+ open: v,
886
+ onToggle: (e) => y(e.target.open),
887
+ children: [/* @__PURE__ */ O("summary", { children: "Preview JSON" }), /* @__PURE__ */ O("pre", {
846
888
  className: "fm-preview-body",
847
- children: JSON.stringify(te, null, 2)
889
+ children: JSON.stringify(Y, null, 2)
848
890
  })]
849
891
  })
850
892
  ] });
851
893
  }
852
894
  //#endregion
895
+ //#region src/react/fieldMapperTransforms.ts
896
+ function ke(e) {
897
+ let t = [
898
+ {
899
+ value: "",
900
+ label: "copy"
901
+ },
902
+ {
903
+ value: "extract",
904
+ label: "extract"
905
+ },
906
+ {
907
+ value: "file",
908
+ label: "file"
909
+ },
910
+ {
911
+ value: "lookup",
912
+ label: "lookup"
913
+ }
914
+ ];
915
+ e.target?.dataType === "Html" && t.push({
916
+ value: "assemble",
917
+ label: "assemble"
918
+ });
919
+ let n = e.mapping?.resolve;
920
+ return n && !t.some((e) => e.value === n) && t.push({
921
+ value: n,
922
+ label: n
923
+ }), t;
924
+ }
925
+ function Ae(e, t) {
926
+ let n = ke(e);
927
+ return t ? t(e, n) : n;
928
+ }
929
+ function je(e, t) {
930
+ return e.mapping?.sourceId || e.mapping?.resolve === "derive" ? !0 : t.some((e) => e.value === "derive");
931
+ }
932
+ function Me(e) {
933
+ return !e.mapping?.sourceId && e.mapping?.resolve === "derive";
934
+ }
935
+ //#endregion
853
936
  //#region src/react/PropertyRows.tsx
854
- var be = [
855
- {
856
- value: "",
857
- label: "copy"
858
- },
859
- {
860
- value: "extract",
861
- label: "extract"
862
- },
863
- {
864
- value: "file",
865
- label: "file"
866
- },
867
- {
868
- value: "lookup",
869
- label: "lookup"
870
- }
871
- ];
872
- function xe({ sources: e, targets: t, mappings: n, mapper: r, defaultRows: i = "requiredAndMapped", onLookupsChange: a, slots: o, classNames: s, ui: c = {
873
- Select: C,
874
- Button: w,
875
- Pill: T
876
- }, renderRowAccessory: l, renderLookup: u }) {
877
- let d = c.Select, f = c.Button, p = c.Pill, [m, h] = y(i), [g, v] = y(() => /* @__PURE__ */ new Set()), [E, O] = y(!1), [M, P] = y(!1), [F, I] = y(null), [L, R] = y(!1), B = _(() => re(t, n, m, g), [
937
+ function Ne({ sources: e, targets: t, mappings: n, mapper: r, defaultRows: i = "requiredAndMapped", onLookupsChange: a, slots: o, classNames: s, ui: c = {
938
+ Select: A,
939
+ Button: j,
940
+ Pill: M
941
+ }, renderRowAccessory: l, renderLookup: u, renderRowExpansion: d, transformOptions: f }) {
942
+ let p = c.Select, m = c.Button, h = c.Pill, [g, _] = E(i), [v, y] = E(() => /* @__PURE__ */ new Set()), [b, x] = E(!1), [S, C] = E(!1), [T, N] = E(null), [F, z] = E(!1), V = w(() => ue(t, n, g, v), [
878
943
  t,
879
944
  n,
880
- m,
881
- g
882
- ]), V = _(() => B == null ? r.rows : r.rows.filter((e) => B.has(e.id)), [r.rows, B]), H = _(() => {
945
+ g,
946
+ v
947
+ ]), H = w(() => V == null ? r.rows : r.rows.filter((e) => V.has(e.id)), [r.rows, V]), U = w(() => {
883
948
  let e = /* @__PURE__ */ new Map();
884
949
  for (let t of n) {
950
+ if (!t.sourceId) continue;
885
951
  let n = e.get(t.sourceId) ?? [];
886
952
  n.push(t.propertyName), e.set(t.sourceId, n);
887
953
  }
888
954
  return e;
889
- }, [n]), U = _(() => z(e, n, t), [
955
+ }, [n]), W = w(() => K(e, n, t), [
890
956
  e,
891
957
  n,
892
958
  t
893
- ]), { coverage: W, sourceOptions: G, addableProperties: K } = r, q = A(o.preview), ee = k(o.preview), J = o.lookups === "row" && (!!u || !!a), te = o.lookups === "section" && !u && !!a, Y = (e) => {
894
- r.addRow(e), v((t) => new Set(t).add(e)), P(!1);
895
- }, ne = (e) => {
896
- I(e), P(!0);
959
+ ]), { coverage: G, sourceOptions: q, addableProperties: J } = r, ee = L(o.preview), Y = I(o.preview), X = o.lookups === "row" && (!!u || !!a), te = o.lookups === "section" && !u && !!a, ne = (e) => {
960
+ r.addRow(e), y((t) => new Set(t).add(e)), C(!1);
961
+ }, Z = (e) => {
962
+ r.removeRow(e), y((t) => {
963
+ if (!t.has(e)) return t;
964
+ let n = new Set(t);
965
+ return n.delete(e), n;
966
+ });
967
+ }, re = (e) => {
968
+ N(e), C(!0);
897
969
  }, ie = (e) => {
898
- Y(e), F && (r.setSource(e, F), I(null));
970
+ ne(e), T && (r.setSource(e, T), N(null));
899
971
  };
900
- return /* @__PURE__ */ S(b, { children: [
901
- /* @__PURE__ */ S("div", {
902
- className: D("toolbar", s),
903
- children: [o.autoMap && /* @__PURE__ */ x(f, {
904
- className: D("autoMapButton", s),
972
+ return /* @__PURE__ */ k(D, { children: [
973
+ /* @__PURE__ */ k("div", {
974
+ className: P("toolbar", s),
975
+ children: [o.autoMap && /* @__PURE__ */ O(m, {
976
+ className: P("autoMapButton", s),
905
977
  onClick: () => r.autoMap(),
906
978
  children: "Auto-map"
907
- }), /* @__PURE__ */ S("span", {
908
- className: D("coverage", s),
979
+ }), /* @__PURE__ */ k("span", {
980
+ className: P("coverage", s),
909
981
  children: [
910
- W.mapped,
982
+ G.mapped,
911
983
  " of ",
912
- W.total,
984
+ G.total,
913
985
  " properties mapped",
914
- W.missingRequired.length > 0 ? ` · ${W.missingRequired.length} required missing` : ""
986
+ G.missingRequired.length > 0 ? ` · ${G.missingRequired.length} required missing` : ""
915
987
  ]
916
988
  })]
917
989
  }),
918
- o.filter && /* @__PURE__ */ S("div", {
919
- className: D("filter", s),
990
+ o.filter && /* @__PURE__ */ k("div", {
991
+ className: P("filter", s),
920
992
  role: "group",
921
993
  "aria-label": "Row filter",
922
- children: [/* @__PURE__ */ x(f, {
994
+ children: [/* @__PURE__ */ O(m, {
923
995
  className: "fm-btn",
924
- "aria-pressed": m === "requiredAndMapped",
925
- onClick: () => h("requiredAndMapped"),
996
+ "aria-pressed": g === "requiredAndMapped",
997
+ onClick: () => _("requiredAndMapped"),
926
998
  children: "Mapped + required"
927
- }), /* @__PURE__ */ S(f, {
999
+ }), /* @__PURE__ */ k(m, {
928
1000
  className: "fm-btn",
929
- "aria-pressed": m === "all",
930
- onClick: () => h("all"),
1001
+ "aria-pressed": g === "all",
1002
+ onClick: () => _("all"),
931
1003
  children: [
932
1004
  "All ",
933
1005
  t.length,
@@ -935,117 +1007,123 @@ function xe({ sources: e, targets: t, mappings: n, mapper: r, defaultRows: i = "
935
1007
  ]
936
1008
  })]
937
1009
  }),
938
- /* @__PURE__ */ x("div", {
939
- className: D("rowList", s),
940
- children: V.map((n) => {
941
- let i = n.mapping?.resolve ?? "";
942
- return /* @__PURE__ */ S("div", {
943
- className: D("row", s),
1010
+ /* @__PURE__ */ O("div", {
1011
+ className: P("rowList", s),
1012
+ children: H.map((n) => {
1013
+ let i = n.mapping?.resolve ?? "", a = Ae(n, f), o = je(n, a);
1014
+ return /* @__PURE__ */ k("div", {
1015
+ className: P("row", s),
944
1016
  "data-state": n.state,
945
1017
  "data-property-name": n.id,
946
1018
  "data-required": n.target?.required ? "true" : void 0,
947
1019
  "data-resolve": n.mapping?.resolve,
948
1020
  "data-source-kind": n.source?.kind,
949
1021
  children: [
950
- /* @__PURE__ */ S("div", {
1022
+ /* @__PURE__ */ k("div", {
951
1023
  className: "fm-row-main",
952
1024
  children: [
953
- /* @__PURE__ */ S("div", {
1025
+ /* @__PURE__ */ k("div", {
954
1026
  className: "fm-row-prop",
955
- children: [/* @__PURE__ */ S("div", {
956
- className: D("propertyLabel", s),
1027
+ children: [/* @__PURE__ */ k("div", {
1028
+ className: P("propertyLabel", s),
957
1029
  children: [n.target?.name, n.target?.required ? " *" : ""]
958
- }), /* @__PURE__ */ x(p, {
959
- className: D("dataType", s),
1030
+ }), /* @__PURE__ */ O(h, {
1031
+ className: P("dataType", s),
960
1032
  children: n.target?.dataType
961
1033
  })]
962
1034
  }),
963
- /* @__PURE__ */ S(d, {
964
- className: D("sourceSelect", s),
1035
+ /* @__PURE__ */ k(p, {
1036
+ className: P("sourceSelect", s),
965
1037
  "aria-label": `Source for ${n.id}`,
966
1038
  value: n.mapping?.sourceId ?? "",
967
1039
  onChange: (e) => {
968
1040
  r.setSource(n.id, e || null);
969
1041
  },
970
- children: [/* @__PURE__ */ x("option", {
1042
+ children: [/* @__PURE__ */ O("option", {
971
1043
  value: "",
972
1044
  children: "Choose a source field…"
973
- }), G.map((e) => /* @__PURE__ */ x("option", {
1045
+ }), q.map((e) => /* @__PURE__ */ O("option", {
974
1046
  value: e.value,
975
1047
  children: e.label
976
1048
  }, e.value))]
977
1049
  }),
978
- n.mapping?.sourceId ? /* @__PURE__ */ x(d, {
979
- className: D("transformSelect", s),
1050
+ o ? /* @__PURE__ */ O(p, {
1051
+ className: P("transformSelect", s),
980
1052
  "aria-label": `Transform for ${n.id}`,
981
1053
  value: i,
1054
+ disabled: Me(n),
982
1055
  onChange: (e) => {
983
1056
  r.setTransform(n.id, e || null);
984
1057
  },
985
- children: be.map((e) => /* @__PURE__ */ x("option", {
1058
+ children: a.map((e) => /* @__PURE__ */ O("option", {
986
1059
  value: e.value,
1060
+ disabled: e.disabled,
987
1061
  children: e.label
988
1062
  }, e.label))
989
- }) : /* @__PURE__ */ x(p, {
990
- className: D("dataType", s),
1063
+ }) : /* @__PURE__ */ O(h, {
1064
+ className: P("dataType", s),
991
1065
  children: n.target?.dataType
992
1066
  }),
993
- /* @__PURE__ */ x("div", {
994
- className: D("rowAccessory", s),
1067
+ /* @__PURE__ */ O("div", {
1068
+ className: P("rowAccessory", s),
995
1069
  children: l?.(n) ?? null
996
1070
  }),
997
- /* @__PURE__ */ x(f, {
998
- className: D("removeButton", s),
1071
+ /* @__PURE__ */ O(m, {
1072
+ className: P("removeButton", s),
999
1073
  "aria-label": `Remove mapping for ${n.id}`,
1000
- onClick: () => r.removeRow(n.id),
1074
+ onClick: () => Z(n.id),
1001
1075
  children: "×"
1002
1076
  })
1003
1077
  ]
1004
1078
  }),
1005
- ee && n.preview && /* @__PURE__ */ x("div", {
1006
- className: D("preview", s),
1079
+ Y && n.preview && /* @__PURE__ */ O("div", {
1080
+ className: P("preview", s),
1007
1081
  children: n.preview
1008
1082
  }),
1009
- n.state === "needsResolve" && n.requiredResolve && /* @__PURE__ */ S("div", {
1010
- className: D("validation", s),
1083
+ n.state === "needsResolve" && n.requiredResolve && /* @__PURE__ */ k("div", {
1084
+ className: P("validation", s),
1011
1085
  children: ["needs ", n.requiredResolve]
1012
1086
  }),
1013
- n.state === "needsLookup" && /* @__PURE__ */ x("div", {
1014
- className: D("validation", s),
1087
+ n.state === "needsLookup" && /* @__PURE__ */ O("div", {
1088
+ className: P("validation", s),
1015
1089
  children: "needs lookup"
1016
1090
  }),
1017
- J && n.mapping?.resolve === "lookup" && n.mapping && (u ? /* @__PURE__ */ x("div", {
1018
- className: D("lookupEditor", s),
1091
+ X && n.mapping?.resolve === "lookup" && n.mapping && (u ? /* @__PURE__ */ O("div", {
1092
+ className: P("lookupEditor", s),
1019
1093
  children: u({
1020
1094
  ...n,
1021
1095
  sampleValue: n.sampleValue ?? "",
1022
1096
  onLookupChange: (e) => r.setLookupEntries(n.id, e)
1023
1097
  })
1024
- }) : /* @__PURE__ */ x(X, {
1098
+ }) : /* @__PURE__ */ O(Q, {
1025
1099
  mode: "row",
1026
1100
  mappings: [n.mapping],
1027
1101
  sources: e,
1028
1102
  targets: t,
1029
1103
  onLookupChange: (e, t) => r.setLookupEntries(n.id, t),
1030
1104
  classNames: s
1031
- }))
1105
+ })),
1106
+ /* @__PURE__ */ O("div", {
1107
+ className: P("rowExpansion", s),
1108
+ children: d?.(n) ?? null
1109
+ })
1032
1110
  ]
1033
1111
  }, n.id);
1034
1112
  })
1035
1113
  }),
1036
- /* @__PURE__ */ x("div", {
1114
+ /* @__PURE__ */ O("div", {
1037
1115
  style: { marginTop: 10 },
1038
- children: M ? /* @__PURE__ */ S(d, {
1039
- className: D("sourceSelect", s),
1116
+ children: S ? /* @__PURE__ */ k(p, {
1117
+ className: P("sourceSelect", s),
1040
1118
  "aria-label": "Add property mapping",
1041
1119
  value: "",
1042
1120
  onChange: (e) => {
1043
1121
  e && ie(e);
1044
1122
  },
1045
- children: [/* @__PURE__ */ x("option", {
1123
+ children: [/* @__PURE__ */ O("option", {
1046
1124
  value: "",
1047
1125
  children: "Choose a property…"
1048
- }), K.map((e) => /* @__PURE__ */ S("option", {
1126
+ }), J.map((e) => /* @__PURE__ */ k("option", {
1049
1127
  value: e.name,
1050
1128
  children: [
1051
1129
  e.name,
@@ -1055,51 +1133,51 @@ function xe({ sources: e, targets: t, mappings: n, mapper: r, defaultRows: i = "
1055
1133
  ")"
1056
1134
  ]
1057
1135
  }, e.name))]
1058
- }) : /* @__PURE__ */ x(f, {
1059
- className: D("addButton", s),
1060
- onClick: () => P(!0),
1061
- disabled: K.length === 0,
1136
+ }) : /* @__PURE__ */ O(m, {
1137
+ className: P("addButton", s),
1138
+ onClick: () => C(!0),
1139
+ disabled: J.length === 0,
1062
1140
  children: "+ Add mapping"
1063
1141
  })
1064
1142
  }),
1065
- o.inspector && /* @__PURE__ */ S("details", {
1066
- className: D("inspector", s),
1067
- open: E,
1068
- onToggle: (e) => O(e.target.open),
1069
- children: [/* @__PURE__ */ S("summary", { children: [
1143
+ o.inspector && /* @__PURE__ */ k("details", {
1144
+ className: P("inspector", s),
1145
+ open: b,
1146
+ onToggle: (e) => x(e.target.open),
1147
+ children: [/* @__PURE__ */ k("summary", { children: [
1070
1148
  "Source fields (",
1071
- N(e).length,
1149
+ B(e).length,
1072
1150
  ")"
1073
- ] }), N(e).map((e) => {
1074
- let t = H.get(e.id) ?? [];
1075
- return /* @__PURE__ */ S("div", {
1151
+ ] }), B(e).map((e) => {
1152
+ let t = U.get(e.id) ?? [];
1153
+ return /* @__PURE__ */ k("div", {
1076
1154
  className: "fm-inspector-row",
1077
1155
  children: [
1078
- /* @__PURE__ */ S("div", { children: [
1079
- /* @__PURE__ */ x("strong", { children: e.label }),
1080
- e.subtitle ? /* @__PURE__ */ x("div", {
1156
+ /* @__PURE__ */ k("div", { children: [
1157
+ /* @__PURE__ */ O("strong", { children: e.label }),
1158
+ e.subtitle ? /* @__PURE__ */ O("div", {
1081
1159
  className: "fm-value",
1082
1160
  children: e.subtitle
1083
1161
  }) : null,
1084
- /* @__PURE__ */ x("div", {
1162
+ /* @__PURE__ */ O("div", {
1085
1163
  className: "fm-value",
1086
- children: j(e.value, 60)
1164
+ children: R(e.value, 60)
1087
1165
  })
1088
1166
  ] }),
1089
- /* @__PURE__ */ x("div", {
1167
+ /* @__PURE__ */ O("div", {
1090
1168
  className: "fm-value",
1091
1169
  children: t.length > 0 ? `→ ${t.join(", ")}` : "unused"
1092
1170
  }),
1093
- /* @__PURE__ */ x(f, {
1171
+ /* @__PURE__ */ O(m, {
1094
1172
  className: "fm-btn",
1095
- onClick: () => ne(e.id),
1173
+ onClick: () => re(e.id),
1096
1174
  children: "Map this"
1097
1175
  })
1098
1176
  ]
1099
1177
  }, e.id);
1100
1178
  })]
1101
1179
  }),
1102
- te && /* @__PURE__ */ x(X, {
1180
+ te && /* @__PURE__ */ O(Q, {
1103
1181
  mode: "section",
1104
1182
  mappings: n,
1105
1183
  sources: e,
@@ -1110,198 +1188,186 @@ function xe({ sources: e, targets: t, mappings: n, mapper: r, defaultRows: i = "
1110
1188
  },
1111
1189
  classNames: s
1112
1190
  }),
1113
- q && /* @__PURE__ */ S("details", {
1114
- className: D("jsonPreview", s),
1115
- open: L,
1116
- onToggle: (e) => R(e.target.open),
1117
- children: [/* @__PURE__ */ x("summary", { children: "Preview JSON" }), /* @__PURE__ */ x("pre", {
1191
+ ee && /* @__PURE__ */ k("details", {
1192
+ className: P("jsonPreview", s),
1193
+ open: F,
1194
+ onToggle: (e) => z(e.target.open),
1195
+ children: [/* @__PURE__ */ O("summary", { children: "Preview JSON" }), /* @__PURE__ */ O("pre", {
1118
1196
  className: "fm-preview-body",
1119
- children: JSON.stringify(U, null, 2)
1197
+ children: JSON.stringify(W, null, 2)
1120
1198
  })]
1121
1199
  })
1122
1200
  ] });
1123
1201
  }
1124
1202
  //#endregion
1125
1203
  //#region src/react/SourceRows.tsx
1126
- var Se = [
1127
- {
1128
- value: "",
1129
- label: "copy"
1130
- },
1131
- {
1132
- value: "extract",
1133
- label: "extract"
1134
- },
1135
- {
1136
- value: "file",
1137
- label: "file"
1138
- },
1139
- {
1140
- value: "lookup",
1141
- label: "lookup"
1142
- }
1143
- ];
1144
- function Ce({ sources: e, targets: t, mappings: n, mapper: r, onLookupsChange: i, slots: a, classNames: o, ui: s = {
1145
- Select: C,
1146
- Button: w,
1147
- Pill: T
1148
- }, renderRowAccessory: c, renderLookup: l }) {
1149
- let u = s.Select, d = s.Button, [f, p] = y(!1), { rows: m, sourceOptions: h, propertyOptions: g, coverage: v, conflicts: E, setSource: O, setProperty: j, setTransform: M, addRow: N, removeRow: P, autoMap: F } = r, I = _(() => z(e, n, t), [
1204
+ function Pe({ sources: e, targets: t, mappings: n, mapper: r, onLookupsChange: i, slots: a, classNames: o, ui: s = {
1205
+ Select: A,
1206
+ Button: j,
1207
+ Pill: M
1208
+ }, renderRowAccessory: c, renderLookup: l, renderRowExpansion: u, transformOptions: d }) {
1209
+ let f = s.Select, p = s.Button, [m, h] = E(!1), { rows: g, sourceOptions: _, propertyOptions: v, coverage: y, conflicts: b, setSource: x, setProperty: S, setTransform: C, addRow: T, removeRow: N, autoMap: F } = r, R = w(() => K(e, n, t), [
1150
1210
  e,
1151
1211
  n,
1152
1212
  t
1153
- ]), L = A(a.preview), R = k(a.preview), B = a.lookups === "row" && (!!l || !!i), V = a.lookups === "section" && !l && !!i;
1154
- return /* @__PURE__ */ S(b, { children: [
1155
- /* @__PURE__ */ S("div", {
1156
- className: D("toolbar", o),
1157
- children: [a.autoMap && /* @__PURE__ */ x(d, {
1158
- className: D("autoMapButton", o),
1213
+ ]), z = L(a.preview), B = I(a.preview), V = a.lookups === "row" && (!!l || !!i), H = a.lookups === "section" && !l && !!i;
1214
+ return /* @__PURE__ */ k(D, { children: [
1215
+ /* @__PURE__ */ k("div", {
1216
+ className: P("toolbar", o),
1217
+ children: [a.autoMap && /* @__PURE__ */ O(p, {
1218
+ className: P("autoMapButton", o),
1159
1219
  onClick: () => F(),
1160
1220
  children: "Auto-map"
1161
- }), /* @__PURE__ */ S("span", {
1162
- className: D("coverage", o),
1221
+ }), /* @__PURE__ */ k("span", {
1222
+ className: P("coverage", o),
1163
1223
  children: [
1164
- v.mapped,
1224
+ y.mapped,
1165
1225
  " of ",
1166
- v.total,
1226
+ y.total,
1167
1227
  " mapped",
1168
- v.missingRequired.length > 0 ? ` · ${v.missingRequired.length} required missing: ${v.missingRequired.join(", ")}` : ""
1228
+ y.missingRequired.length > 0 ? ` · ${y.missingRequired.length} required missing: ${y.missingRequired.join(", ")}` : ""
1169
1229
  ]
1170
1230
  })]
1171
1231
  }),
1172
- E.size > 0 && /* @__PURE__ */ S("div", {
1232
+ b.size > 0 && /* @__PURE__ */ k("div", {
1173
1233
  className: "fm-banner fm-banner-danger",
1174
1234
  role: "alert",
1175
1235
  children: [
1176
- E.size,
1236
+ b.size,
1177
1237
  " row",
1178
- E.size === 1 ? "" : "s",
1238
+ b.size === 1 ? "" : "s",
1179
1239
  " claim the same property — each property can only have one source."
1180
1240
  ]
1181
1241
  }),
1182
- v.missingRequired.length > 0 && /* @__PURE__ */ S("div", {
1242
+ y.missingRequired.length > 0 && /* @__PURE__ */ k("div", {
1183
1243
  className: "fm-banner fm-banner-warn",
1184
1244
  role: "status",
1185
- children: ["Required missing: ", v.missingRequired.join(", ")]
1245
+ children: ["Required missing: ", y.missingRequired.join(", ")]
1186
1246
  }),
1187
- /* @__PURE__ */ x("div", {
1188
- className: D("rowList", o),
1189
- children: m.map((n) => {
1190
- let i = n.mapping?.resolve ?? "", a = n.source?.id ?? n.mapping?.sourceId ?? "", s = n.target?.name ?? n.mapping?.propertyName ?? "";
1191
- return /* @__PURE__ */ S("div", {
1192
- className: D("row", o),
1247
+ /* @__PURE__ */ O("div", {
1248
+ className: P("rowList", o),
1249
+ children: g.map((n) => {
1250
+ let i = n.mapping?.resolve ?? "", a = n.source?.id ?? n.mapping?.sourceId ?? "", s = n.target?.name ?? n.mapping?.propertyName ?? "", m = Ae(n, d), h = je(n, m);
1251
+ return /* @__PURE__ */ k("div", {
1252
+ className: P("row", o),
1193
1253
  "data-state": n.state,
1194
1254
  "data-property-name": s || void 0,
1195
1255
  "data-required": n.target?.required ? "true" : void 0,
1196
1256
  "data-resolve": n.mapping?.resolve,
1197
1257
  "data-source-kind": n.source?.kind,
1198
1258
  children: [
1199
- /* @__PURE__ */ S("div", {
1259
+ /* @__PURE__ */ k("div", {
1200
1260
  className: "fm-row-main fm-row-main-source",
1201
1261
  children: [
1202
- /* @__PURE__ */ S(u, {
1203
- className: D("sourceSelect", o),
1262
+ /* @__PURE__ */ k(f, {
1263
+ className: P("sourceSelect", o),
1204
1264
  "aria-label": "Source field",
1205
1265
  value: a,
1206
1266
  onChange: (e) => {
1207
- O(n.id, e || null);
1267
+ x(n.id, e || null);
1208
1268
  },
1209
- children: [/* @__PURE__ */ x("option", {
1269
+ children: [/* @__PURE__ */ O("option", {
1210
1270
  value: "",
1211
1271
  children: "Choose a source field…"
1212
- }), h.map((e) => /* @__PURE__ */ x("option", {
1272
+ }), _.map((e) => /* @__PURE__ */ O("option", {
1213
1273
  value: e.value,
1214
1274
  children: e.label
1215
1275
  }, e.value))]
1216
1276
  }),
1217
- a ? /* @__PURE__ */ x(u, {
1218
- className: D("transformSelect", o),
1277
+ h ? /* @__PURE__ */ O(f, {
1278
+ className: P("transformSelect", o),
1219
1279
  "aria-label": "Transform",
1220
1280
  value: i,
1281
+ disabled: Me(n),
1221
1282
  onChange: (e) => {
1222
- M(n.id, e || null);
1283
+ C(n.id, e || null);
1223
1284
  },
1224
- children: Se.map((e) => /* @__PURE__ */ x("option", {
1285
+ children: m.map((e) => /* @__PURE__ */ O("option", {
1225
1286
  value: e.value,
1287
+ disabled: e.disabled,
1226
1288
  children: e.label
1227
1289
  }, e.label))
1228
- }) : /* @__PURE__ */ x("span", { className: "fm-into" }),
1229
- /* @__PURE__ */ x("span", {
1290
+ }) : /* @__PURE__ */ O("span", { className: "fm-into" }),
1291
+ /* @__PURE__ */ O("span", {
1230
1292
  className: "fm-into",
1231
1293
  children: "into"
1232
1294
  }),
1233
- /* @__PURE__ */ S(u, {
1234
- className: D("sourceSelect", o),
1295
+ /* @__PURE__ */ k(f, {
1296
+ className: P("sourceSelect", o),
1235
1297
  "aria-label": "Target property",
1236
1298
  value: s,
1237
1299
  onChange: (e) => {
1238
- e && j(n.id, e);
1300
+ e && S(n.id, e);
1239
1301
  },
1240
- children: [/* @__PURE__ */ x("option", {
1302
+ children: [/* @__PURE__ */ O("option", {
1241
1303
  value: "",
1242
1304
  children: "Choose a property…"
1243
- }), g.map((e) => /* @__PURE__ */ x("option", {
1305
+ }), v.map((e) => /* @__PURE__ */ O("option", {
1244
1306
  value: e.value,
1245
1307
  children: e.label
1246
1308
  }, e.value))]
1247
1309
  }),
1248
- /* @__PURE__ */ x("div", {
1249
- className: D("rowAccessory", o),
1310
+ /* @__PURE__ */ O("div", {
1311
+ className: P("rowAccessory", o),
1250
1312
  children: c?.(n) ?? null
1251
1313
  }),
1252
- /* @__PURE__ */ x(d, {
1253
- className: D("removeButton", o),
1314
+ /* @__PURE__ */ O(p, {
1315
+ className: P("removeButton", o),
1254
1316
  "aria-label": "Remove row",
1255
- onClick: () => P(n.id),
1317
+ onClick: () => N(n.id),
1256
1318
  children: "×"
1257
1319
  })
1258
1320
  ]
1259
1321
  }),
1260
- R && n.preview && /* @__PURE__ */ x("div", {
1261
- className: D("preview", o),
1322
+ B && n.preview && /* @__PURE__ */ O("div", {
1323
+ className: P("preview", o),
1262
1324
  children: n.preview
1263
1325
  }),
1264
- n.state === "needsResolve" && n.requiredResolve && /* @__PURE__ */ S("div", {
1265
- className: D("validation", o),
1326
+ n.state === "needsResolve" && n.requiredResolve && /* @__PURE__ */ k("div", {
1327
+ className: P("validation", o),
1266
1328
  children: ["needs ", n.requiredResolve]
1267
1329
  }),
1268
- n.state === "needsLookup" && /* @__PURE__ */ x("div", {
1269
- className: D("validation", o),
1330
+ n.state === "needsLookup" && /* @__PURE__ */ O("div", {
1331
+ className: P("validation", o),
1270
1332
  children: "needs lookup"
1271
1333
  }),
1272
- n.state === "conflict" && /* @__PURE__ */ x("div", {
1273
- className: D("validation", o),
1334
+ n.state === "conflict" && /* @__PURE__ */ O("div", {
1335
+ className: P("validation", o),
1274
1336
  style: { color: "var(--fm-danger)" },
1275
1337
  children: "property already mapped by another row"
1276
1338
  }),
1277
- B && n.mapping?.resolve === "lookup" && n.mapping && (l ? /* @__PURE__ */ x("div", {
1278
- className: D("lookupEditor", o),
1339
+ V && n.mapping?.resolve === "lookup" && n.mapping && (l ? /* @__PURE__ */ O("div", {
1340
+ className: P("lookupEditor", o),
1279
1341
  children: l({
1280
1342
  ...n,
1281
1343
  sampleValue: n.sampleValue ?? "",
1282
1344
  onLookupChange: (e) => r.setLookupEntries(n.id, e)
1283
1345
  })
1284
- }) : /* @__PURE__ */ x(X, {
1346
+ }) : /* @__PURE__ */ O(Q, {
1285
1347
  mode: "row",
1286
1348
  mappings: [n.mapping],
1287
1349
  sources: e,
1288
1350
  targets: t,
1289
1351
  onLookupChange: (e, t) => r.setLookupEntries(n.id, t),
1290
1352
  classNames: o
1291
- }))
1353
+ })),
1354
+ /* @__PURE__ */ O("div", {
1355
+ className: P("rowExpansion", o),
1356
+ children: u?.(n) ?? null
1357
+ })
1292
1358
  ]
1293
1359
  }, n.id);
1294
1360
  })
1295
1361
  }),
1296
- /* @__PURE__ */ x("div", {
1362
+ /* @__PURE__ */ O("div", {
1297
1363
  style: { marginTop: 10 },
1298
- children: /* @__PURE__ */ x(d, {
1299
- className: D("addButton", o),
1300
- onClick: () => N(),
1364
+ children: /* @__PURE__ */ O(p, {
1365
+ className: P("addButton", o),
1366
+ onClick: () => T(),
1301
1367
  children: "+ Add mapping"
1302
1368
  })
1303
1369
  }),
1304
- V && /* @__PURE__ */ x(X, {
1370
+ H && /* @__PURE__ */ O(Q, {
1305
1371
  mode: "section",
1306
1372
  mappings: n,
1307
1373
  sources: e,
@@ -1312,31 +1378,35 @@ function Ce({ sources: e, targets: t, mappings: n, mapper: r, onLookupsChange: i
1312
1378
  },
1313
1379
  classNames: o
1314
1380
  }),
1315
- L && /* @__PURE__ */ S("details", {
1316
- className: D("jsonPreview", o),
1317
- open: f,
1318
- onToggle: (e) => p(e.target.open),
1319
- children: [/* @__PURE__ */ x("summary", { children: "Preview JSON" }), /* @__PURE__ */ x("pre", {
1381
+ z && /* @__PURE__ */ k("details", {
1382
+ className: P("jsonPreview", o),
1383
+ open: m,
1384
+ onToggle: (e) => h(e.target.open),
1385
+ children: [/* @__PURE__ */ O("summary", { children: "Preview JSON" }), /* @__PURE__ */ O("pre", {
1320
1386
  className: "fm-preview-body",
1321
- children: JSON.stringify(I, null, 2)
1387
+ children: JSON.stringify(R, null, 2)
1322
1388
  })]
1323
1389
  })
1324
1390
  ] });
1325
1391
  }
1326
1392
  //#endregion
1327
1393
  //#region src/react/useFieldMapper.ts
1328
- function we({ sources: e, targets: t, mappings: n, onChange: r, lookups: i = {}, onLookupsChange: a, rowKey: o = "property", onAutoMap: s }) {
1329
- let [c, l] = y(() => /* @__PURE__ */ new Set()), [u, f] = y([]), m = v([]);
1330
- m.current = ne(m.current, n.length);
1331
- let g = m.current, b = h((e) => {
1394
+ function Fe({ sources: e, targets: t, mappings: n, onChange: r, lookups: i = {}, onLookupsChange: a, rowKey: o = "property", onAutoMap: s }) {
1395
+ let [c, l] = E(() => /* @__PURE__ */ new Set()), [u, d] = E([]), p = T(n), _ = T(n);
1396
+ _.current !== n && (_.current = n, p.current = n);
1397
+ let y = T([]);
1398
+ y.current = le(y.current, p.current.length);
1399
+ let b = y.current, x = S((e) => {
1400
+ p.current = e, y.current = le(y.current, e.length), r(e);
1401
+ }, [r]), C = S((e) => {
1332
1402
  if (!a || e.length === 0) return;
1333
- let t = K(i, e);
1403
+ let t = re(i, e);
1334
1404
  t && a(t);
1335
- }, [i, a]), x = _(() => P(e), [e]), S = _(() => F(t), [t]), C = _(() => V(t, n), [t, n]), w = _(() => new Set(n.map((e) => e.propertyName)), [n]), T = _(() => t.filter((e) => !w.has(e.name) && !c.has(e.name)), [
1405
+ }, [i, a]), D = w(() => V(e), [e]), O = w(() => H(t), [t]), k = w(() => J(t, n), [t, n]), A = w(() => new Set(n.map((e) => e.propertyName)), [n]), j = w(() => t.filter((e) => !A.has(e.name) && !c.has(e.name)), [
1336
1406
  t,
1337
- w,
1407
+ A,
1338
1408
  c
1339
- ]), E = _(() => J({
1409
+ ]), M = w(() => oe({
1340
1410
  targets: t,
1341
1411
  mappings: n,
1342
1412
  sources: e,
@@ -1346,274 +1416,283 @@ function we({ sources: e, targets: t, mappings: n, onChange: r, lookups: i = {},
1346
1416
  n,
1347
1417
  e,
1348
1418
  i
1349
- ]), D = _(() => te({
1419
+ ]), N = w(() => se({
1350
1420
  mappings: n,
1351
- edgeIds: g,
1421
+ edgeIds: b,
1352
1422
  drafts: u,
1353
1423
  sources: e,
1354
1424
  targets: t,
1355
1425
  lookups: i
1356
1426
  }), [
1357
1427
  n,
1358
- g,
1428
+ b,
1359
1429
  u,
1360
1430
  e,
1361
1431
  t,
1362
1432
  i
1363
- ]), O = o === "property" ? E : D.rows, k = o === "property" ? /* @__PURE__ */ new Set() : D.conflicts, A = h((i, a) => {
1364
- let o = q(n, e, t, i, a);
1365
- r(o.mappings), b(o.clearedLookupProps);
1433
+ ]), P = o === "property" ? M : N.rows, F = o === "property" ? /* @__PURE__ */ new Set() : N.conflicts, I = S((n, r) => {
1434
+ let i = ie(p.current, e, t, n, r);
1435
+ x(i.mappings), C(i.clearedLookupProps);
1366
1436
  }, [
1367
- n,
1368
1437
  e,
1369
1438
  t,
1370
- r,
1371
- b
1372
- ]), j = h((e) => {
1373
- let t = ee(n, e);
1374
- r(t.mappings), b(t.clearedLookupProps);
1375
- }, [
1376
- n,
1377
- r,
1378
- b
1379
- ]), M = h(() => {
1380
- r(s ? s() : d(e, t)), f([]), l(/* @__PURE__ */ new Set());
1439
+ x,
1440
+ C
1441
+ ]), L = S((e) => {
1442
+ let t = ae(p.current, e);
1443
+ x(t.mappings), C(t.clearedLookupProps);
1444
+ }, [x, C]), R = S(() => {
1445
+ let n = s ? s() : v(e, t);
1446
+ x(n), d([]), l(/* @__PURE__ */ new Set());
1381
1447
  }, [
1382
1448
  s,
1383
1449
  e,
1384
1450
  t,
1385
- r
1386
- ]), I = h((i, a) => {
1451
+ x
1452
+ ]), z = S((n, r) => {
1453
+ let i = p.current;
1387
1454
  if (o === "property") {
1388
- if (!a) {
1389
- let e = n.find((e) => e.propertyName === i);
1390
- r(n.filter((e) => e.propertyName !== i)), e?.resolve === "lookup" && b([i]);
1455
+ if (!r) {
1456
+ let e = i.find((e) => e.propertyName === n);
1457
+ if (e && f(e)) {
1458
+ x(Z(i, g(e))), e.resolve === "lookup" && C([n]);
1459
+ return;
1460
+ }
1461
+ x(i.filter((e) => e.propertyName !== n)), e?.resolve === "lookup" && C([n]);
1391
1462
  return;
1392
1463
  }
1393
- let o = q(n, e, t, a, i), s = t.find((e) => e.name === i), c = N(e).find((e) => e.id === a), l = o.mappings.find((e) => e.propertyName === i);
1394
- if (!l.resolve) {
1395
- let e = L(c, s);
1464
+ let a = ie(i, e, t, r, n), o = t.find((e) => e.name === n), s = B(e).find((e) => e.id === r), c = a.mappings.find((e) => e.propertyName === n);
1465
+ if (!c.resolve) {
1466
+ let e = W(s, o);
1396
1467
  if (e) {
1397
- l = {
1398
- ...l,
1468
+ c = {
1469
+ ...c,
1399
1470
  resolve: e
1400
- }, r(G(o.mappings, l)), b(o.clearedLookupProps);
1471
+ }, x(Z(a.mappings, c)), C(a.clearedLookupProps);
1401
1472
  return;
1402
1473
  }
1403
1474
  }
1404
- r(o.mappings), b(o.clearedLookupProps);
1475
+ x(a.mappings), C(a.clearedLookupProps);
1405
1476
  return;
1406
1477
  }
1407
- let s = g.indexOf(i);
1408
- if (s >= 0) {
1409
- if (!a) {
1410
- let e = n[s];
1411
- r(n.filter((e, t) => t !== s)), e?.resolve === "lookup" && b([e.propertyName]);
1478
+ let a = y.current.indexOf(n);
1479
+ if (a >= 0) {
1480
+ if (!r) {
1481
+ let e = i[a];
1482
+ if (e && f(e)) {
1483
+ let t = [...i];
1484
+ t[a] = g(e), x(t), e.resolve === "lookup" && C([e.propertyName]);
1485
+ return;
1486
+ }
1487
+ let t = i.filter((e, t) => t !== a);
1488
+ x(t), e?.resolve === "lookup" && C([e.propertyName]);
1412
1489
  return;
1413
1490
  }
1414
- let i = n[s], o = t.find((e) => e.name === i.propertyName), c = {
1415
- sourceId: a,
1416
- propertyName: i.propertyName
1491
+ let n = i[a], o = t.find((e) => e.name === n.propertyName), s = {
1492
+ sourceId: r,
1493
+ propertyName: n.propertyName
1417
1494
  };
1418
- if (c = U(c, o), !c.resolve) {
1419
- let t = L(N(e).find((e) => e.id === a), o);
1420
- t && (c = {
1421
- ...c,
1495
+ if (s = Y(s, o), s = m(s, n), !s.resolve) {
1496
+ let t = W(B(e).find((e) => e.id === r), o);
1497
+ t && (s = {
1498
+ ...s,
1422
1499
  resolve: t
1423
1500
  });
1424
1501
  }
1425
- let l = [...n];
1426
- l[s] = c, r(l), i.resolve === "lookup" && c.resolve !== "lookup" && b([i.propertyName]);
1502
+ let c = [...i];
1503
+ c[a] = s, x(c), n.resolve === "lookup" && s.resolve !== "lookup" && C([n.propertyName]);
1427
1504
  return;
1428
1505
  }
1429
- f((o) => {
1430
- let s = o.map((n) => {
1431
- if (n.id !== i) return n;
1432
- if (!a) return {
1433
- id: n.id,
1434
- propertyName: n.propertyName
1506
+ d((i) => {
1507
+ let a = i.map((i) => {
1508
+ if (i.id !== n) return i;
1509
+ if (!r) return {
1510
+ id: i.id,
1511
+ propertyName: i.propertyName
1435
1512
  };
1436
- let r = n.propertyName ? t.find((e) => e.name === n.propertyName) : void 0, o = L(N(e).find((e) => e.id === a), r), s = r && U({
1437
- sourceId: a,
1438
- propertyName: n.propertyName ?? ""
1439
- }, r).resolve || o || void 0;
1513
+ let a = i.propertyName ? t.find((e) => e.name === i.propertyName) : void 0, o = W(B(e).find((e) => e.id === r), a), s = a && Y({
1514
+ sourceId: r,
1515
+ propertyName: i.propertyName ?? ""
1516
+ }, a).resolve || o || void 0;
1440
1517
  return {
1441
- id: n.id,
1442
- sourceId: a,
1443
- propertyName: n.propertyName,
1518
+ id: i.id,
1519
+ sourceId: r,
1520
+ propertyName: i.propertyName,
1444
1521
  resolve: s
1445
1522
  };
1446
- }), c = s.filter((e) => e.sourceId && e.propertyName), l = s.filter((e) => !(e.sourceId && e.propertyName));
1447
- return c.length > 0 ? (r([...n, ...c.map((e) => ({
1448
- sourceId: e.sourceId,
1523
+ }), o = a.filter((e) => e.propertyName && (e.sourceId || e.resolve === "derive")), s = a.filter((e) => !e.propertyName || !e.sourceId && e.resolve !== "derive");
1524
+ return o.length > 0 ? (x([...p.current, ...o.map((e) => ({
1525
+ ...e.sourceId ? { sourceId: e.sourceId } : {},
1449
1526
  propertyName: e.propertyName,
1450
1527
  ...e.resolve ? { resolve: e.resolve } : {}
1451
- }))]), l) : s;
1528
+ }))]), s) : a;
1452
1529
  });
1453
1530
  }, [
1454
1531
  o,
1455
- n,
1456
1532
  e,
1457
1533
  t,
1458
- r,
1459
- b,
1460
- g
1461
- ]), R = h((i, a) => {
1534
+ x,
1535
+ C
1536
+ ]), U = S((n, r) => {
1462
1537
  if (o === "property") return;
1463
- let s = g.indexOf(i);
1464
- if (s >= 0) {
1465
- let i = n[s], o = t.find((e) => e.name === a), c = N(e).find((e) => e.id === i.sourceId), l = {
1466
- sourceId: i.sourceId,
1467
- propertyName: a
1538
+ let i = p.current, a = y.current.indexOf(n);
1539
+ if (a >= 0) {
1540
+ let n = i[a], o = t.find((e) => e.name === r), s = B(e).find((e) => e.id === n.sourceId), c = {
1541
+ ...n.sourceId ? { sourceId: n.sourceId } : {},
1542
+ propertyName: r
1468
1543
  };
1469
- if (l = U(l, o), !l.resolve) {
1470
- let e = L(c, o);
1471
- e && (l = {
1472
- ...l,
1544
+ if (c = Y(c, o), c = m(c, n), !c.resolve) {
1545
+ let e = W(s, o);
1546
+ e && (c = {
1547
+ ...c,
1473
1548
  resolve: e
1474
1549
  });
1475
1550
  }
1476
- let u = [...n];
1477
- u[s] = l, r(u), i.resolve === "lookup" && l.resolve !== "lookup" && b([i.propertyName]), i.propertyName !== a && i.resolve === "lookup" && l.resolve === "lookup" && b([i.propertyName]);
1551
+ let l = [...i];
1552
+ l[a] = c, x(l), n.resolve === "lookup" && c.resolve !== "lookup" && C([n.propertyName]), n.propertyName !== r && n.resolve === "lookup" && c.resolve === "lookup" && C([n.propertyName]);
1478
1553
  return;
1479
1554
  }
1480
- f((o) => {
1481
- let s = o.map((n) => {
1482
- if (n.id !== i) return n;
1483
- let r = t.find((e) => e.name === a), o = n.sourceId ? N(e).find((e) => e.id === n.sourceId) : void 0, s = n.resolve;
1484
- n.sourceId && r && (s = U({
1485
- sourceId: n.sourceId,
1486
- propertyName: a
1487
- }, r).resolve ?? L(o, r) ?? void 0);
1555
+ d((i) => {
1556
+ let a = i.map((i) => {
1557
+ if (i.id !== n) return i;
1558
+ let a = t.find((e) => e.name === r), o = i.sourceId ? B(e).find((e) => e.id === i.sourceId) : void 0, s = i.resolve;
1559
+ i.sourceId && a && (s = Y({
1560
+ sourceId: i.sourceId,
1561
+ propertyName: r
1562
+ }, a).resolve ?? W(o, a) ?? void 0);
1488
1563
  let c = {
1489
- id: n.id,
1490
- sourceId: n.sourceId,
1491
- propertyName: a,
1564
+ id: i.id,
1565
+ sourceId: i.sourceId,
1566
+ propertyName: r,
1492
1567
  resolve: s
1493
1568
  };
1494
1569
  return c.sourceId && c.propertyName, c;
1495
- }), c = s.filter((e) => e.sourceId && e.propertyName), l = s.filter((e) => !(e.sourceId && e.propertyName));
1496
- if (c.length > 0) {
1497
- let e = c.map((e) => ({
1498
- sourceId: e.sourceId,
1570
+ }), o = a.filter((e) => e.propertyName && (e.sourceId || e.resolve === "derive")), s = a.filter((e) => !e.propertyName || !e.sourceId && e.resolve !== "derive");
1571
+ if (o.length > 0) {
1572
+ let e = o.map((e) => ({
1573
+ ...e.sourceId ? { sourceId: e.sourceId } : {},
1499
1574
  propertyName: e.propertyName,
1500
1575
  ...e.resolve ? { resolve: e.resolve } : {}
1501
1576
  }));
1502
- return r([...n, ...e]), l;
1577
+ return x([...p.current, ...e]), s;
1503
1578
  }
1504
- return s;
1579
+ return a;
1505
1580
  });
1506
1581
  }, [
1507
1582
  o,
1508
- g,
1509
- n,
1510
1583
  t,
1511
1584
  e,
1512
- r,
1513
- b
1514
- ]), z = h((e, t) => {
1515
- let s = W(n, o, e, g, t);
1516
- if (!s || (r(s), !a)) return;
1517
- let c = o === "property" ? s.find((t) => t.propertyName === e) : s[g.indexOf(e)];
1518
- if (!c) return;
1519
- let l = Object.fromEntries((c.lookup?.entries ?? []).map((e) => [e.value, e.ref])), u = { ...i };
1520
- Object.keys(l).length === 0 ? delete u[c.propertyName] : u[c.propertyName] = l, a(u);
1585
+ x,
1586
+ C
1587
+ ]), G = S((e, t) => {
1588
+ let n = ne(p.current, o, e, y.current, t);
1589
+ if (!n || (x(n), !a)) return;
1590
+ let r = o === "property" ? n.find((t) => t.propertyName === e) : n[y.current.indexOf(e)];
1591
+ if (!r) return;
1592
+ let s = Object.fromEntries((r.lookup?.entries ?? []).map((e) => [e.value, e.ref])), c = { ...i };
1593
+ Object.keys(s).length === 0 ? delete c[r.propertyName] : c[r.propertyName] = s, a(c);
1521
1594
  }, [
1522
- n,
1523
1595
  o,
1524
- g,
1525
- r,
1596
+ x,
1526
1597
  a,
1527
1598
  i
1528
- ]);
1599
+ ]), K = S((e, t) => {
1600
+ let n = X(p.current, o, e, y.current, t);
1601
+ n && x(n);
1602
+ }, [o, x]), q = S((e, t) => {
1603
+ let n = te(p.current, o, e, y.current, t);
1604
+ n && x(n);
1605
+ }, [o, x]);
1529
1606
  return {
1530
- rows: O,
1531
- sourceOptions: x,
1532
- propertyOptions: S,
1533
- addableProperties: T,
1534
- coverage: C,
1535
- conflicts: k,
1536
- setSource: I,
1537
- setProperty: R,
1538
- setTransform: h((e, t) => {
1539
- let i = (e, t) => t ? t === "lookup" ? {
1540
- ...e,
1541
- resolve: t
1542
- } : p({
1543
- sourceId: e.sourceId,
1544
- propertyName: e.propertyName,
1545
- resolve: t
1546
- }) : {
1547
- sourceId: e.sourceId,
1548
- propertyName: e.propertyName
1549
- };
1607
+ rows: P,
1608
+ sourceOptions: D,
1609
+ propertyOptions: O,
1610
+ addableProperties: j,
1611
+ coverage: k,
1612
+ conflicts: F,
1613
+ setSource: z,
1614
+ setProperty: U,
1615
+ setTransform: S((e, t) => {
1616
+ let n = p.current;
1550
1617
  if (o === "property") {
1551
- let a = n.find((t) => t.propertyName === e);
1552
- if (!a) return;
1553
- r(G(n, i(a, t))), a.resolve === "lookup" && t !== "lookup" && b([e]);
1618
+ let r = n.find((t) => t.propertyName === e);
1619
+ if (!r) {
1620
+ t === "derive" && x(Z(n, {
1621
+ propertyName: e,
1622
+ resolve: "derive"
1623
+ }));
1624
+ return;
1625
+ }
1626
+ x(Z(n, h(r, t))), r.resolve === "lookup" && t !== "lookup" && C([e]);
1554
1627
  return;
1555
1628
  }
1556
- let a = g.indexOf(e);
1557
- if (a >= 0) {
1558
- let e = n[a], o = [...n];
1559
- o[a] = i(e, t), r(o), e.resolve === "lookup" && t !== "lookup" && b([e.propertyName]);
1629
+ let r = y.current.indexOf(e);
1630
+ if (r >= 0) {
1631
+ let e = n[r], i = [...n];
1632
+ i[r] = h(e, t), x(i), e.resolve === "lookup" && t !== "lookup" && C([e.propertyName]);
1560
1633
  return;
1561
1634
  }
1562
- f((n) => n.map((n) => n.id === e ? {
1563
- ...n,
1564
- resolve: t ?? void 0
1565
- } : n));
1635
+ d((n) => {
1636
+ let r = n.map((n) => n.id === e ? {
1637
+ ...n,
1638
+ resolve: t ?? void 0
1639
+ } : n), i = r.filter((e) => e.propertyName && (e.sourceId || e.resolve === "derive")), a = r.filter((e) => !e.propertyName || !e.sourceId && e.resolve !== "derive");
1640
+ return i.length > 0 ? (x([...p.current, ...i.map((e) => ({
1641
+ ...e.sourceId ? { sourceId: e.sourceId } : {},
1642
+ propertyName: e.propertyName,
1643
+ ...e.resolve ? { resolve: e.resolve } : {}
1644
+ }))]), a) : r;
1645
+ });
1566
1646
  }, [
1567
1647
  o,
1568
- n,
1569
- g,
1570
- r,
1571
- b
1648
+ x,
1649
+ C
1572
1650
  ]),
1573
- setLookupEntries: z,
1574
- addRow: h((e) => {
1651
+ setLookupEntries: G,
1652
+ setAssembleBlocks: K,
1653
+ setDerive: q,
1654
+ addRow: S((e) => {
1575
1655
  if (o === "property") {
1576
1656
  e && l((t) => new Set(t).add(e));
1577
1657
  return;
1578
1658
  }
1579
- f((t) => [...t, {
1580
- id: Y("draft"),
1659
+ d((t) => [...t, {
1660
+ id: ce("draft"),
1581
1661
  ...e ? { propertyName: e } : {}
1582
1662
  }]);
1583
1663
  }, [o]),
1584
- removeRow: h((e) => {
1664
+ removeRow: S((e) => {
1665
+ let t = p.current;
1585
1666
  if (o === "property") {
1586
- let t = n.find((t) => t.propertyName === e);
1587
- r(n.filter((t) => t.propertyName !== e)), t?.resolve === "lookup" && b([e]), l((t) => {
1667
+ let n = t.find((t) => t.propertyName === e);
1668
+ x(t.filter((t) => t.propertyName !== e)), n?.resolve === "lookup" && C([e]), l((t) => {
1588
1669
  if (!t.has(e)) return t;
1589
1670
  let n = new Set(t);
1590
1671
  return n.delete(e), n;
1591
1672
  });
1592
1673
  return;
1593
1674
  }
1594
- let t = g.indexOf(e);
1595
- if (t >= 0) {
1596
- let e = n[t];
1597
- r(n.filter((e, n) => n !== t)), e?.resolve === "lookup" && b([e.propertyName]);
1675
+ let n = y.current.indexOf(e);
1676
+ if (n >= 0) {
1677
+ let e = t[n];
1678
+ x(t.filter((e, t) => t !== n)), e?.resolve === "lookup" && C([e.propertyName]);
1598
1679
  return;
1599
1680
  }
1600
- f((t) => t.filter((t) => t.id !== e));
1681
+ d((t) => t.filter((t) => t.id !== e));
1601
1682
  }, [
1602
1683
  o,
1603
- n,
1604
- g,
1605
- r,
1606
- b
1684
+ x,
1685
+ C
1607
1686
  ]),
1608
- autoMap: M,
1609
- connect: A,
1610
- removeBySource: j
1687
+ autoMap: R,
1688
+ connect: I,
1689
+ removeBySource: L
1611
1690
  };
1612
1691
  }
1613
1692
  //#endregion
1614
1693
  //#region src/react/FieldMapper.tsx
1615
- function Te({ sources: e, targets: t, mappings: n, onChange: r, lookups: i = {}, onLookupsChange: a, onAutoMap: o, className: s, theme: c = "default", connectionColors: l, showPreview: u, layout: d = "rows", rowKey: f = "property", defaultRows: p = "requiredAndMapped", classNames: m, components: h, slots: v, renderRowAccessory: y, renderLookup: b }) {
1616
- let S = we({
1694
+ function Ie({ sources: e, targets: t, mappings: n, onChange: r, lookups: i = {}, onLookupsChange: a, onAutoMap: o, className: s, theme: c = "default", connectionColors: l, showPreview: u, layout: d = "rows", rowKey: f = "property", defaultRows: p = "requiredAndMapped", classNames: m, components: h, slots: g, renderRowAccessory: _, renderLookup: v, renderRowExpansion: y, transformOptions: b }) {
1695
+ let x = Fe({
1617
1696
  sources: e,
1618
1697
  targets: t,
1619
1698
  mappings: n,
@@ -1622,69 +1701,73 @@ function Te({ sources: e, targets: t, mappings: n, onChange: r, lookups: i = {},
1622
1701
  onLookupsChange: a,
1623
1702
  rowKey: d === "rows" ? f : "property",
1624
1703
  onAutoMap: o
1625
- }), E = ce(c), k = _(() => O(v, u, { layout: d }), [
1626
- v,
1704
+ }), S = _e(c), T = w(() => F(g, u, { layout: d }), [
1705
+ g,
1627
1706
  u,
1628
1707
  d
1629
- ]), A = _(() => ({
1630
- Select: h?.Select ?? C,
1631
- Button: h?.Button ?? w,
1632
- Pill: h?.Pill ?? T
1708
+ ]), E = w(() => ({
1709
+ Select: h?.Select ?? A,
1710
+ Button: h?.Button ?? j,
1711
+ Pill: h?.Pill ?? M
1633
1712
  }), [h]);
1634
- g(() => {
1635
- ge(E);
1636
- }, [E]);
1637
- let j = D("root", m, [
1638
- E === "none" || c === "unstyled" || c === "none" ? "seed-field-mapper--unstyled" : null,
1713
+ C(() => {
1714
+ Te(S);
1715
+ }, [S]);
1716
+ let D = P("root", m, [
1717
+ S === "none" || c === "unstyled" || c === "none" ? "seed-field-mapper--unstyled" : null,
1639
1718
  d === "rows" ? "seed-field-mapper--rows" : "seed-field-mapper--wires",
1640
1719
  s
1641
1720
  ].filter(Boolean).join(" ") || null);
1642
- return /* @__PURE__ */ x("div", {
1643
- className: j,
1644
- "data-theme": E,
1721
+ return /* @__PURE__ */ O("div", {
1722
+ className: D,
1723
+ "data-theme": S,
1645
1724
  "data-layout": d,
1646
1725
  "data-row-key": d === "rows" ? f : void 0,
1647
- children: d === "wires" ? /* @__PURE__ */ x(ye, {
1726
+ children: d === "wires" ? /* @__PURE__ */ O(Oe, {
1648
1727
  sources: e,
1649
1728
  targets: t,
1650
1729
  mappings: n,
1651
- mapper: S,
1730
+ mapper: x,
1652
1731
  lookups: i,
1653
1732
  onLookupsChange: a,
1654
- renderLookup: b,
1733
+ renderLookup: v,
1655
1734
  connectionColors: l,
1656
- slots: k,
1735
+ slots: T,
1657
1736
  classNames: m,
1658
- ui: A
1659
- }) : f === "source" ? /* @__PURE__ */ x(Ce, {
1737
+ ui: E
1738
+ }) : f === "source" ? /* @__PURE__ */ O(Pe, {
1660
1739
  sources: e,
1661
1740
  targets: t,
1662
1741
  mappings: n,
1663
- mapper: S,
1742
+ mapper: x,
1664
1743
  lookups: i,
1665
1744
  onLookupsChange: a,
1666
- slots: k,
1745
+ slots: T,
1667
1746
  classNames: m,
1668
- ui: A,
1669
- renderRowAccessory: y,
1670
- renderLookup: b
1671
- }) : /* @__PURE__ */ x(xe, {
1747
+ ui: E,
1748
+ renderRowAccessory: _,
1749
+ renderLookup: v,
1750
+ renderRowExpansion: y,
1751
+ transformOptions: b
1752
+ }) : /* @__PURE__ */ O(Ne, {
1672
1753
  sources: e,
1673
1754
  targets: t,
1674
1755
  mappings: n,
1675
- mapper: S,
1756
+ mapper: x,
1676
1757
  defaultRows: p,
1677
1758
  lookups: i,
1678
1759
  onLookupsChange: a,
1679
- slots: k,
1760
+ slots: T,
1680
1761
  classNames: m,
1681
- ui: A,
1682
- renderRowAccessory: y,
1683
- renderLookup: b
1762
+ ui: E,
1763
+ renderRowAccessory: _,
1764
+ renderLookup: v,
1765
+ renderRowExpansion: y,
1766
+ transformOptions: b
1684
1767
  })
1685
1768
  });
1686
1769
  }
1687
1770
  //#endregion
1688
- export { me as DEFAULT_THEME_CSS, oe as FIELD_MAPPER_PAIR_SLOTS, Te as FieldMapper, de as PAINT_THEME_CSS, E as SLOT_BASE_CLASS, ue as STRUCTURAL_THEME_CSS, Z as THEME_STYLE_ID, J as buildPropertyModeRows, P as buildSourceOptions, z as buildSyncPreviewBag, pe as buildThemeCss, V as computeCoverage, L as computeRequiredResolve, q as connectSourceToProperty, se as connectionStrokeForIndex, ge as ensureThemeInjected, re as filterPropertyNames, H as findConflicts, R as previewForEdge, _e as resetThemeInjectionForTests, O as resolveSlots, ce as resolveTheme, A as showJsonPreview, k as showRowPreview, D as slotClass, we as useFieldMapper, fe as wrapInThemeLayer };
1771
+ export { Ce as DEFAULT_THEME_CSS, pe as FIELD_MAPPER_PAIR_SLOTS, Ie as FieldMapper, be as PAINT_THEME_CSS, N as SLOT_BASE_CLASS, ye as STRUCTURAL_THEME_CSS, me as THEME_STYLE_ID, oe as buildPropertyModeRows, V as buildSourceOptions, K as buildSyncPreviewBag, Se as buildThemeCss, J as computeCoverage, W as computeRequiredResolve, ie as connectSourceToProperty, ge as connectionStrokeForIndex, ke as defaultTransformOptions, Te as ensureThemeInjected, ue as filterPropertyNames, ee as findConflicts, Me as isTransformSelectDisabled, G as previewForEdge, Ee as resetThemeInjectionForTests, F as resolveSlots, _e as resolveTheme, Ae as resolveTransformOptions, L as showJsonPreview, I as showRowPreview, je as showTransformSelect, P as slotClass, Fe as useFieldMapper, xe as wrapInThemeLayer };
1689
1772
 
1690
1773
  //# sourceMappingURL=react.js.map