@updog/data-editor 0.1.52 → 0.1.54

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 (4) hide show
  1. package/index.css +1 -1
  2. package/index.d.ts +2 -0
  3. package/index.js +350 -328
  4. package/package.json +1 -1
package/index.js CHANGED
@@ -435,11 +435,13 @@ var Ur = {
435
435
  },
436
436
  headerSelection: { noHeaderLabel: "My data has no header row" },
437
437
  matchColumns: {
438
+ allMatched: "All columns are matched",
438
439
  banner: "Some columns could not be automatically matched",
439
440
  importedColumns: "Imported columns",
440
441
  matchedCount: "{{matched}}/{{total}} matched",
441
442
  targetColumns: "Target columns",
442
443
  selectColumnPlaceholder: "Select column",
444
+ showMatched: "Show matched",
443
445
  syntheticColumn: "C{{index}}",
444
446
  syntheticColumnValue: "C{{index}}: {{value}}",
445
447
  bestMatch: "Best match",
@@ -20908,7 +20910,7 @@ var ov = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(J, {
20908
20910
  return this.state.hasError ? /* @__PURE__ */ C(_v, { error: vv }) : this.props.children;
20909
20911
  }
20910
20912
  }, bv = ({ leftSlot: e }) => {
20911
- let { variant: t, setShowUploader: n } = X(), { t: r } = K(), { isFirstStep: i, isLastStep: a, nextStep: o, prevStep: s, onImport: c, parsedCsv: l, xlsxFile: u, isParsing: d, isImporting: p, steps: m, activeStepIndex: h, selectedSheet: g, handleSheetConfirmed: _, remoteSourceLoading: v } = Bb(), y = i && t === "editor", b = f(() => {
20913
+ let { variant: t, setShowUploader: n } = X(), { t: r } = K(), { isFirstStep: i, isLastStep: a, nextStep: o, prevStep: s, onImport: c, parsedCsv: l, xlsxFile: u, isParsing: d, isImporting: p, steps: m, activeStepIndex: h, selectedSheet: g, handleSheetConfirmed: _, remoteSourceLoading: v } = Vb(), y = i && t === "editor", b = f(() => {
20912
20914
  n(!1);
20913
20915
  }, [n]), x = m[h]?.id === "sheet-selection", S = f(() => {
20914
20916
  a ? c() : x ? _() : o();
@@ -21677,27 +21679,27 @@ var ov = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(J, {
21677
21679
  }
21678
21680
  return i;
21679
21681
  }, Hv = () => {
21680
- let { columns: e, enableCreateColumn: t, synonyms: n } = X(), { t: r } = K(), { headers: i, columnMapping: a, updateColumnMapping: o, pendingColumns: s, setPendingColumns: c } = Bb(), [l, u] = b(null), d = y(null), p = v(() => Vv(i, e, n), [
21682
+ let { columns: e, enableCreateColumn: t, synonyms: n } = X(), { t: r } = K(), { headers: i, columnMapping: a, updateColumnMapping: o, pendingColumns: s, setPendingColumns: c } = Vb(), [l, u] = b(null), [d, p] = b(!0), m = y(null), h = v(() => Vv(i, e, n), [
21681
21683
  i,
21682
21684
  e,
21683
21685
  n
21684
- ]), m = f((e, t) => {
21686
+ ]), g = f((e, t) => {
21685
21687
  if (t === "action:create") {
21686
- d.current = e, u({ title: e });
21688
+ m.current = e, u({ title: e });
21687
21689
  return;
21688
21690
  }
21689
21691
  o(e, t);
21690
- }, [o]), h = f((e) => {
21691
- if (d.current === null) return;
21692
+ }, [o]), _ = f((e) => {
21693
+ if (m.current === null) return;
21692
21694
  let t = Math.random().toString(36).slice(2, 7), n = `${Go}${e.title}-${t}`;
21693
21695
  c((t) => [...t, {
21694
21696
  ...e,
21695
21697
  id: n,
21696
21698
  size: 150
21697
- }]), o(d.current, n), d.current = null, u(null);
21698
- }, [o, c]), g = f(() => {
21699
- d.current = null, u(null);
21700
- }, []), _ = v(() => [...e.map((e) => e.title), ...s.map((e) => e.title)], [e, s]), x = v(() => {
21699
+ }]), o(m.current, n), m.current = null, u(null);
21700
+ }, [o, c]), x = f(() => {
21701
+ m.current = null, u(null);
21702
+ }, []), S = v(() => [...e.map((e) => e.title), ...s.map((e) => e.title)], [e, s]), w = v(() => {
21701
21703
  let n = {
21702
21704
  text: r("dataEditor.uploader.matchColumns.bestMatch"),
21703
21705
  color: "green"
@@ -21706,7 +21708,7 @@ var ov = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(J, {
21706
21708
  color: "blue"
21707
21709
  }, o = r("dataEditor.uploader.matchColumns.createColumn");
21708
21710
  return Object.fromEntries(i.map((r) => {
21709
- let i = p[r], c = e.map((e) => ({
21711
+ let i = h[r], c = e.map((e) => ({
21710
21712
  id: e.id,
21711
21713
  text: e.title,
21712
21714
  ...e.id === i && { tag: n }
@@ -21731,28 +21733,30 @@ var ov = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(J, {
21731
21733
  s,
21732
21734
  r,
21733
21735
  t,
21734
- p
21735
- ]), S = v(() => i.filter((e) => a[e]).length, [i, a]);
21736
+ h
21737
+ ]), T = v(() => i.filter((e) => a[e]).length, [i, a]);
21736
21738
  return {
21737
21739
  headers: i,
21738
- matchedCount: S,
21739
- allMatched: S === i.length,
21740
+ showMatched: d,
21741
+ setShowMatched: p,
21742
+ matchedCount: T,
21743
+ allMatched: T === i.length,
21740
21744
  placeholder: r("dataEditor.uploader.matchColumns.selectColumnPlaceholder"),
21741
- existingNames: _,
21745
+ existingNames: S,
21742
21746
  createModalValues: l,
21743
21747
  getRowData: f((e) => ({
21744
21748
  mappedValue: a[e],
21745
- options: x[e],
21746
- autoMatchId: p[e]
21749
+ options: w[e],
21750
+ autoMatchId: h[e]
21747
21751
  }), [
21748
21752
  a,
21749
- x,
21750
- p
21753
+ w,
21754
+ h
21751
21755
  ]),
21752
- onSelectChange: m,
21756
+ onSelectChange: g,
21753
21757
  onClear: o,
21754
- submitCreate: h,
21755
- closeCreate: g
21758
+ submitCreate: _,
21759
+ closeCreate: x
21756
21760
  };
21757
21761
  }, Uv = s(null);
21758
21762
  function Wv({ children: e }) {
@@ -21767,7 +21771,7 @@ var Gv = () => {
21767
21771
  if (!e) throw Error("useColumnMatching must be used within ColumnMatchingProvider");
21768
21772
  return e;
21769
21773
  }, Kv = () => {
21770
- let { t: e } = K(), { matchedCount: t, allMatched: n, headers: r } = Gv(), i = n ? "green" : "yellow";
21774
+ let { t: e } = K(), { matchedCount: t, allMatched: n, headers: r, showMatched: i, setShowMatched: a } = Gv(), o = n ? "green" : "yellow", s = f((e) => a(e), [a]);
21771
21775
  return /* @__PURE__ */ C("header", {
21772
21776
  className: "updog__column-matching__header",
21773
21777
  children: /* @__PURE__ */ w("div", {
@@ -21781,7 +21785,7 @@ var Gv = () => {
21781
21785
  weight: "medium",
21782
21786
  children: e("dataEditor.uploader.matchColumns.importedColumns")
21783
21787
  }), /* @__PURE__ */ C(Aa, {
21784
- color: i,
21788
+ color: o,
21785
21789
  text: e("dataEditor.uploader.matchColumns.matchedCount", {
21786
21790
  matched: t,
21787
21791
  total: r.length
@@ -21789,12 +21793,21 @@ var Gv = () => {
21789
21793
  })]
21790
21794
  }),
21791
21795
  /* @__PURE__ */ C("div", { className: "updog__column-matching__header-spacer" }),
21792
- /* @__PURE__ */ C(q, {
21793
- as: "div",
21794
- size: "sm",
21795
- weight: "medium",
21796
- className: "updog__column-matching__header-column",
21797
- children: e("dataEditor.uploader.matchColumns.targetColumns")
21796
+ /* @__PURE__ */ w("div", {
21797
+ className: "updog__column-matching__header-column updog__column-matching__header-column--with-items",
21798
+ children: [/* @__PURE__ */ C(q, {
21799
+ as: "div",
21800
+ size: "sm",
21801
+ weight: "medium",
21802
+ children: e("dataEditor.uploader.matchColumns.targetColumns")
21803
+ }), /* @__PURE__ */ C(Ni, {
21804
+ checked: i,
21805
+ onChange: s,
21806
+ checkboxPosition: "end",
21807
+ label: e("dataEditor.uploader.matchColumns.showMatched"),
21808
+ size: "sm",
21809
+ className: "updog__column-matching__show-matched"
21810
+ })]
21798
21811
  }),
21799
21812
  /* @__PURE__ */ C("div", { className: "updog__column-matching__action" })
21800
21813
  ]
@@ -21860,24 +21873,34 @@ var Gv = () => {
21860
21873
  ]
21861
21874
  });
21862
21875
  }), Jv = () => {
21863
- let { headers: e, placeholder: t, getRowData: n, onSelectChange: r, onClear: i } = Gv();
21864
- return /* @__PURE__ */ C("div", {
21876
+ let { headers: e, showMatched: t, placeholder: n, getRowData: r, onSelectChange: i, onClear: a } = Gv(), { t: o } = K(), s = e.map((e) => ({
21877
+ csvHeader: e,
21878
+ ...r(e)
21879
+ })).filter((e) => t || !e.mappedValue);
21880
+ return s.length === 0 ? /* @__PURE__ */ C("div", {
21865
21881
  className: "updog__column-matching__content",
21866
21882
  children: /* @__PURE__ */ C("div", {
21867
- className: "updog__column-matching__content-inner",
21868
- children: e.map((e) => {
21869
- let { mappedValue: a, options: o, autoMatchId: s } = n(e);
21870
- return /* @__PURE__ */ C(qv, {
21871
- csvHeader: e,
21872
- mappedValue: a,
21873
- options: o,
21874
- autoMatchId: s,
21875
- placeholder: t,
21876
- onSelectChange: r,
21877
- onClear: i
21878
- }, e);
21883
+ className: "updog__column-matching__empty",
21884
+ children: /* @__PURE__ */ C(q, {
21885
+ size: "sm",
21886
+ color: "secondary",
21887
+ children: o("dataEditor.uploader.matchColumns.allMatched")
21879
21888
  })
21880
21889
  })
21890
+ }) : /* @__PURE__ */ C("div", {
21891
+ className: "updog__column-matching__content",
21892
+ children: /* @__PURE__ */ C("div", {
21893
+ className: "updog__column-matching__content-inner",
21894
+ children: s.map(({ csvHeader: e, mappedValue: t, options: r, autoMatchId: o }) => /* @__PURE__ */ C(qv, {
21895
+ csvHeader: e,
21896
+ mappedValue: t,
21897
+ options: r,
21898
+ autoMatchId: o,
21899
+ placeholder: n,
21900
+ onSelectChange: i,
21901
+ onClear: a
21902
+ }, e))
21903
+ })
21881
21904
  });
21882
21905
  }, Yv = () => {
21883
21906
  let { createModalValues: e, existingNames: t, submitCreate: n, closeCreate: r } = Gv();
@@ -21896,99 +21919,93 @@ var Gv = () => {
21896
21919
  /* @__PURE__ */ C(Yv, {})
21897
21920
  ]
21898
21921
  }), Zv = () => {
21899
- let { parsedCsv: e } = Bb();
21922
+ let { parsedCsv: e } = Vb();
21900
21923
  return e ? /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ w(Jl, { children: [/* @__PURE__ */ C("div", {
21901
21924
  className: "updog__step-column-matching__content updog__scrollbar",
21902
21925
  children: /* @__PURE__ */ C(Wv, { children: /* @__PURE__ */ C(Xv, {}) })
21903
21926
  }), /* @__PURE__ */ C(bv, {})] }) }) : null;
21904
- }, Qv = new Set([
21927
+ }, Qv = .5, $v = new Set([
21905
21928
  "true",
21906
21929
  "false",
21907
21930
  "yes",
21908
21931
  "no"
21909
- ]), $v = /^\d{1,4}[-/.]\d{1,2}[-/.]\d{1,4}$/, ey = /^[-+]?(\d{1,3}([ ,.]\d{3})+|\d+)([.,]\d+)?%?$/, ty = new Set([
21932
+ ]), ey = /^\d{1,4}[-/.]\d{1,2}[-/.]\d{1,4}$/, ty = /^[-+]?(\d{1,3}([ ,.]\d{3})+|\d+)([.,]\d+)?%?$/, ny = new Set([
21910
21933
  "number",
21911
21934
  "date",
21912
21935
  "bool"
21913
21936
  ]);
21914
- function ny(e) {
21937
+ function ry(e) {
21915
21938
  if (e == null) return "empty";
21916
21939
  let t = String(e).trim();
21917
- return t.length === 0 ? "empty" : Qv.has(t.toLowerCase()) ? "bool" : $v.test(t) ? "date" : ey.test(t) ? "number" : "text";
21940
+ return t.length === 0 ? "empty" : $v.has(t.toLowerCase()) ? "bool" : ey.test(t) ? "date" : ty.test(t) ? "number" : "text";
21918
21941
  }
21919
- function ry(e) {
21942
+ function iy(e) {
21920
21943
  return e.filter((e) => e != null && String(e).trim().length > 0).length;
21921
21944
  }
21922
- function iy(e) {
21945
+ function ay(e) {
21946
+ let t = 0;
21947
+ for (let n of e) t = Math.max(t, n.length);
21948
+ return t;
21949
+ }
21950
+ function oy(e) {
21923
21951
  let t = /* @__PURE__ */ new Map(), n = 0, r = 0;
21924
21952
  for (let i of e) {
21925
- let e = ry(i);
21953
+ let e = i.length;
21926
21954
  if (e === 0) continue;
21927
21955
  let a = (t.get(e) ?? 0) + 1;
21928
21956
  t.set(e, a), a > n && (n = a, r = e);
21929
21957
  }
21930
21958
  return r;
21931
21959
  }
21932
- function ay(e) {
21933
- let t = 0;
21934
- for (let n of e) t = Math.max(t, n.length);
21935
- return t;
21936
- }
21937
- function oy(e, t, n) {
21960
+ function sy(e, t, n) {
21938
21961
  if (t <= 0) return 0;
21939
- let r = -1, i = 0;
21940
- for (let a = 0; a < e.length; a++) if (ry(e[a]) === t) {
21941
- if (r < 0 && (r = a), i++, i >= n) return r;
21942
- } else r = -1, i = 0;
21943
- for (let n = 0; n < e.length; n++) if (ry(e[n]) === t) return n;
21962
+ for (let r = 0; r < e.length; r++) if (iy(e[r]) / t >= n) return r;
21944
21963
  return 0;
21945
21964
  }
21946
- function sy(e, t, n, r) {
21965
+ function cy(e, t, n, r) {
21947
21966
  let i = /* @__PURE__ */ new Map();
21948
21967
  for (let a = t; a < n; a++) {
21949
- let t = ny(e[a]?.[r]);
21968
+ let t = ry(e[a]?.[r]);
21950
21969
  t !== "empty" && i.set(t, (i.get(t) ?? 0) + 1);
21951
21970
  }
21952
21971
  let a = "empty", o = 0;
21953
21972
  for (let [e, t] of i) t > o && (o = t, a = e);
21954
21973
  return a;
21955
21974
  }
21956
- function cy(e, t, n, r) {
21975
+ function ly(e, t, n, r) {
21957
21976
  let i = 0, a = 0;
21958
21977
  for (let o = 0; o < r; o++) {
21959
- let r = sy(e, t + 1, n, o);
21960
- r !== "empty" && (a++, ny(e[t]?.[o]) === "text" && ty.has(r) && i++);
21978
+ let r = cy(e, t + 1, n, o);
21979
+ r !== "empty" && (a++, ry(e[t]?.[o]) === "text" && ny.has(r) && i++);
21961
21980
  }
21962
21981
  return a === 0 ? 0 : i / a;
21963
21982
  }
21964
- function ly(e, t, n, r) {
21983
+ function uy(e, t, n, r) {
21965
21984
  let i = 0, a = 0;
21966
21985
  for (let o = 0; o < r; o++) {
21967
- let r = sy(e, t, n, o);
21986
+ let r = cy(e, t, n, o);
21968
21987
  if (r !== "empty") for (let s = t; s < n; s++) {
21969
- let t = ny(e[s]?.[o]);
21988
+ let t = ry(e[s]?.[o]);
21970
21989
  t !== "empty" && (a++, t === r && i++);
21971
21990
  }
21972
21991
  }
21973
21992
  return a === 0 ? 0 : i / a;
21974
21993
  }
21975
- function uy(e) {
21976
- let t = e.map(ny).filter((e) => e !== "empty");
21994
+ function dy(e) {
21995
+ let t = e.map(ry).filter((e) => e !== "empty");
21977
21996
  return t.length === 0 ? 0 : 1 - t.filter((e) => e !== "text").length / t.length;
21978
21997
  }
21979
- function dy(e, t) {
21980
- if (t <= 0) return 0;
21981
- let n = ry(e);
21982
- return Math.max(0, 1 - Math.abs(n - t) / t);
21998
+ function fy(e, t) {
21999
+ return t <= 0 ? 0 : Math.min(1, iy(e) / t);
21983
22000
  }
21984
- function fy(e) {
22001
+ function py(e) {
21985
22002
  let t = e.map((e) => String(e ?? "").trim().toLowerCase()).filter((e) => e.length > 0);
21986
22003
  return t.length === 0 ? 0 : new Set(t).size / t.length;
21987
22004
  }
21988
- function py(e, t, n, r, i) {
21989
- return .45 * cy(e, t, n, r) + .25 * ly(e, t + 1, n, r) + .15 * uy(e[t] ?? []) + .1 * dy(e[t] ?? [], i) + .05 * fy(e[t] ?? []);
22005
+ function my(e, t, n, r, i) {
22006
+ return .45 * ly(e, t, n, r) + .25 * uy(e, t + 1, n, r) + .15 * dy(e[t] ?? []) + .1 * fy(e[t] ?? [], i) + .05 * py(e[t] ?? []);
21990
22007
  }
21991
- function my(e, t = 100) {
22008
+ function hy(e, t = 100) {
21992
22009
  if (e.length === 0) return {
21993
22010
  headerRowIndex: 0,
21994
22011
  dataStartIndex: 0,
@@ -21996,7 +22013,7 @@ function my(e, t = 100) {
21996
22013
  mode: "header",
21997
22014
  review: { kind: "none" }
21998
22015
  };
21999
- let n = Math.min(t, e.length), r = e.slice(0, n), i = ay(r), a = iy(r), o = oy(r, a, 3), s = e[o] ?? [], c = cy(e, o, n, i), l = ly(e, o + 1, n, i), u = ry(s) > 0 && uy(s) === 0, d = Math.round(Math.max(0, py(e, o, n, i, a)) * 100) / 100;
22016
+ let n = Math.min(t, e.length), r = e.slice(0, n), i = ay(r), a = oy(r), o = sy(r, a, Qv), s = e[o] ?? [], c = ly(e, o, n, i), l = uy(e, o + 1, n, i), u = iy(s) > 0 && dy(s) === 0, d = Math.round(Math.max(0, my(e, o, n, i, a)) * 100) / 100;
22000
22017
  if (u && c <= .15 && l >= .7) return {
22001
22018
  headerRowIndex: -1,
22002
22019
  dataStartIndex: o,
@@ -22016,7 +22033,7 @@ function my(e, t = 100) {
22016
22033
  review: f
22017
22034
  };
22018
22035
  }
22019
- function hy(e) {
22036
+ function gy(e) {
22020
22037
  let t = /* @__PURE__ */ new Set();
22021
22038
  return e.map((e) => {
22022
22039
  let n = e, r = 2;
@@ -22026,7 +22043,7 @@ function hy(e) {
22026
22043
  }
22027
22044
  //#endregion
22028
22045
  //#region src/components/DataUploader/components/StepHeaderSelection/context/useViewModel.tsx
22029
- function gy(e, t, n, r) {
22046
+ function _y(e, t, n, r) {
22030
22047
  return v(() => ({
22031
22048
  sample: e,
22032
22049
  selectedRow: t,
@@ -22041,20 +22058,20 @@ function gy(e, t, n, r) {
22041
22058
  }
22042
22059
  //#endregion
22043
22060
  //#region src/components/DataUploader/components/StepHeaderSelection/context/index.tsx
22044
- var _y = s(null);
22045
- function vy({ sample: e, selectedRow: t, selectRow: n, noHeader: r, children: i }) {
22046
- let a = gy(e, t, n, r);
22047
- return /* @__PURE__ */ C(_y.Provider, {
22061
+ var vy = s(null);
22062
+ function yy({ sample: e, selectedRow: t, selectRow: n, noHeader: r, children: i }) {
22063
+ let a = _y(e, t, n, r);
22064
+ return /* @__PURE__ */ C(vy.Provider, {
22048
22065
  value: a,
22049
22066
  children: i
22050
22067
  });
22051
22068
  }
22052
- var yy = () => {
22053
- let e = p(_y);
22069
+ var by = () => {
22070
+ let e = p(vy);
22054
22071
  if (!e) throw Error("useHeaderSelection must be used within HeaderSelectionProvider");
22055
22072
  return e;
22056
- }, by = () => {
22057
- let { sample: e, selectedRow: t, selectRow: n, noHeader: r } = yy(), { headers: i } = Bb(), { headers: a, rows: o } = v(() => {
22073
+ }, xy = () => {
22074
+ let { sample: e, selectedRow: t, selectRow: n, noHeader: r } = by(), { headers: i } = Vb(), { headers: a, rows: o } = v(() => {
22058
22075
  let t = i.length;
22059
22076
  return {
22060
22077
  headers: i.map((e) => r ? e : ""),
@@ -22074,13 +22091,13 @@ var yy = () => {
22074
22091
  selectedRow: r ? void 0 : t,
22075
22092
  onSelectRow: r ? void 0 : n
22076
22093
  });
22077
- }, xy = () => {
22078
- let { t: e } = K(), { parsedCsv: t, headerRowIndex: n, setHeaderRowIndex: r } = Bb(), i = f((e) => {
22094
+ }, Sy = () => {
22095
+ let { t: e } = K(), { parsedCsv: t, headerRowIndex: n, setHeaderRowIndex: r } = Vb(), i = f((e) => {
22079
22096
  r(e ? -1 : Math.max(0, t?.detection.headerRowIndex ?? 0));
22080
22097
  }, [r, t]);
22081
22098
  if (!t) return null;
22082
22099
  let a = t.rawRows.slice(0, 50), o = n < 0;
22083
- return /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ C(Jl, { children: /* @__PURE__ */ w(vy, {
22100
+ return /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ C(Jl, { children: /* @__PURE__ */ w(yy, {
22084
22101
  sample: a,
22085
22102
  selectedRow: o ? void 0 : n,
22086
22103
  selectRow: r,
@@ -22094,10 +22111,10 @@ var yy = () => {
22094
22111
  onChange: i,
22095
22112
  label: e("dataEditor.uploader.headerSelection.noHeaderLabel")
22096
22113
  })
22097
- }), /* @__PURE__ */ C(by, {})]
22114
+ }), /* @__PURE__ */ C(xy, {})]
22098
22115
  }), /* @__PURE__ */ C(bv, {})]
22099
22116
  }) }) });
22100
- }, Sy = ({ open: e, existingOptions: t, initialName: n, onClose: r, onSubmit: i }) => {
22117
+ }, Cy = ({ open: e, existingOptions: t, initialName: n, onClose: r, onSubmit: i }) => {
22101
22118
  let { t: a } = K();
22102
22119
  return /* @__PURE__ */ C(Vi, {
22103
22120
  open: e,
@@ -22110,13 +22127,13 @@ var yy = () => {
22110
22127
  onSubmit: i
22111
22128
  })
22112
22129
  });
22113
- }, Cy = [
22130
+ }, wy = [
22114
22131
  ",",
22115
22132
  ";",
22116
22133
  "|",
22117
22134
  "\n",
22118
22135
  " "
22119
- ], wy = (e, t, n) => {
22136
+ ], Ty = (e, t, n) => {
22120
22137
  let r = new Set(n.map((e) => e.trim().toLowerCase())), i = (e) => r.has(e.trim().toLowerCase());
22121
22138
  if (e.trim() === "") return [];
22122
22139
  if (i(e)) return [e.trim()];
@@ -22128,31 +22145,31 @@ var yy = () => {
22128
22145
  a.push(e);
22129
22146
  continue;
22130
22147
  }
22131
- a.push(...Ty(e, t, i));
22148
+ a.push(...Ey(e, t, i));
22132
22149
  }
22133
22150
  }
22134
22151
  return a;
22135
- }, Ty = (e, t, n) => {
22136
- for (let r of Cy) {
22152
+ }, Ey = (e, t, n) => {
22153
+ for (let r of wy) {
22137
22154
  if (r === t || !e.includes(r)) continue;
22138
22155
  let i = e.split(r).map((e) => e.trim()).filter((e) => e !== "");
22139
22156
  if (i.length >= 2 && i.every(n)) return i;
22140
22157
  }
22141
22158
  return [e];
22142
- }, Ey = (e, t, n) => {
22159
+ }, Dy = (e, t, n) => {
22143
22160
  let r = /* @__PURE__ */ new Set();
22144
- for (let i of e) if (i !== "") if (n) for (let e of wy(i, n, t)) r.add(e);
22161
+ for (let i of e) if (i !== "") if (n) for (let e of Ty(i, n, t)) r.add(e);
22145
22162
  else r.add(i);
22146
22163
  return [...r];
22147
- }, Dy = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Oy = (e, t) => {
22164
+ }, Oy = (e) => !e.some((e) => e != null && String(e).trim() !== ""), ky = (e, t) => {
22148
22165
  let n = 0;
22149
22166
  for (let r = t; r < e.length; r++) n = Math.max(n, e[r].length);
22150
22167
  return n;
22151
- }, ky = 50, Ay = (e, t, n) => {
22152
- let r = Math.min(e.length, t + ky);
22168
+ }, Ay = 50, jy = (e, t, n) => {
22169
+ let r = Math.min(e.length, t + Ay);
22153
22170
  for (let i = t; i < r; i++) {
22154
22171
  let t = e[i];
22155
- if (!t || Dy(t)) continue;
22172
+ if (!t || Oy(t)) continue;
22156
22173
  let r = !0;
22157
22174
  for (let e = 0; e < n; e++) {
22158
22175
  let n = t[e];
@@ -22166,60 +22183,64 @@ var yy = () => {
22166
22183
  return Array.from({ length: n }, (n, i) => {
22167
22184
  for (let n = t; n < r; n++) {
22168
22185
  let t = e[n];
22169
- if (!t || Dy(t)) continue;
22186
+ if (!t || Oy(t)) continue;
22170
22187
  let r = t[i], a = r == null ? "" : String(r).trim();
22171
22188
  if (a !== "") return a;
22172
22189
  }
22173
22190
  return "";
22174
22191
  });
22175
- }, jy = (e, t) => t === e.headerRowIndex ? e.dataStartIndex : t + 1, My = (e, t, n, r) => {
22192
+ }, My = (e, t) => t === e.headerRowIndex ? e.dataStartIndex : t + 1, Ny = (e, t, n, r) => {
22176
22193
  if (t < 0) {
22177
- let t = Oy(e, n), i = Ay(e, n, t);
22194
+ let t = ky(e, n), i = jy(e, n, t);
22178
22195
  return Array.from({ length: t }, (e, t) => r(t, i[t]));
22179
22196
  }
22180
- return hy((e[t] ?? []).map((e) => String(e ?? "").trim()));
22181
- }, Ny = () => ({
22197
+ let i = e[t] ?? [], a = Math.max(i.length, ky(e, n)), o = jy(e, n, a);
22198
+ return gy(Array.from({ length: a }, (e, t) => {
22199
+ let n = String(i[t] ?? "").trim();
22200
+ return n === "" ? r(t, o[t]) : n;
22201
+ }));
22202
+ }, Py = () => ({
22182
22203
  headerRowIndex: 0,
22183
22204
  dataStartIndex: 1,
22184
22205
  confidence: 1,
22185
22206
  mode: "header",
22186
22207
  review: { kind: "none" }
22187
- }), Py = (e, t) => {
22208
+ }), Fy = (e, t) => {
22188
22209
  let n = [e];
22189
22210
  for (let r of t) n.push(e.map((e) => r[e] ?? ""));
22190
22211
  return n;
22191
- }, Fy = (e) => {
22212
+ }, Iy = (e) => {
22192
22213
  let t = /* @__PURE__ */ new Map();
22193
22214
  for (let n = 0; n < e.length; n++) t.set(e[n], n);
22194
22215
  return t;
22195
- }, Iy = (e, t, n) => {
22216
+ }, Ly = (e, t, n) => {
22196
22217
  let r = [];
22197
22218
  for (let i = t; i < e.length; i++) {
22198
22219
  let t = e[i];
22199
- if (Dy(t)) continue;
22220
+ if (Oy(t)) continue;
22200
22221
  let a = t[n], o = a == null ? "" : String(a);
22201
22222
  o !== "" && r.push(o);
22202
22223
  }
22203
22224
  return r;
22204
- }, Ly = (e, t) => {
22225
+ }, Ry = (e, t) => {
22205
22226
  let n = {};
22206
22227
  for (let r = 0; r < t.length; r++) n[t[r]] = String(e[r] ?? "");
22207
22228
  return n;
22208
- }, Ry = (e, t, n, r) => {
22229
+ }, zy = (e, t, n, r) => {
22209
22230
  let i = [];
22210
- for (let a = n; a < e.length && i.length < r; a++) Dy(e[a]) || i.push(Ly(e[a], t));
22231
+ for (let a = n; a < e.length && i.length < r; a++) Oy(e[a]) || i.push(Ry(e[a], t));
22211
22232
  return i;
22212
- }, zy = () => {
22213
- let { columns: e } = X(), { t } = K(), { parsedCsv: n, headers: r, dataStartIndex: i, columnMapping: a, valueMapping: o, autoValueMapping: s, updateValueMapping: c, multiselectDelimiters: l, setMultiselectDelimiter: u, reapplyMultiselectDelimiter: d, pendingOptions: p, addPendingOption: h } = Bb(), [g, _] = b({}), [x, S] = b({}), [w, T] = b(null), E = y(!1), D = v(() => {
22233
+ }, By = () => {
22234
+ let { columns: e } = X(), { t } = K(), { parsedCsv: n, headers: r, dataStartIndex: i, columnMapping: a, valueMapping: o, autoValueMapping: s, updateValueMapping: c, multiselectDelimiters: l, setMultiselectDelimiter: u, reapplyMultiselectDelimiter: d, pendingOptions: p, addPendingOption: h } = Vb(), [g, _] = b({}), [x, S] = b({}), [w, T] = b(null), E = y(!1), D = v(() => {
22214
22235
  if (!n) return [];
22215
- let t = [], s = Fy(r);
22236
+ let t = [], s = Iy(r);
22216
22237
  for (let [r, c] of Object.entries(a)) {
22217
22238
  if (!c) continue;
22218
22239
  let a = e.find((e) => e.id === c);
22219
22240
  if (!a?.editor) continue;
22220
22241
  let u = a.editor.type;
22221
22242
  if (u !== "select" && u !== "multiselect") continue;
22222
- let d = a.editor.options, f = o[c] ?? {}, p = u === "multiselect", m = p ? l[c] ?? null : null, h = s.get(r), g = Ey(h === void 0 ? [] : Iy(n.rawRows, i, h), d, m).map((e) => ({
22243
+ let d = a.editor.options, f = o[c] ?? {}, p = u === "multiselect", m = p ? l[c] ?? null : null, h = s.get(r), g = Dy(h === void 0 ? [] : Ly(n.rawRows, i, h), d, m).map((e) => ({
22223
22244
  imported: e,
22224
22245
  mapped: f[e]
22225
22246
  }));
@@ -22342,20 +22363,20 @@ var yy = () => {
22342
22363
  submitCreate: R,
22343
22364
  closeCreate: z
22344
22365
  };
22345
- }, By = s(null);
22346
- function Vy({ children: e }) {
22347
- let t = zy();
22348
- return /* @__PURE__ */ C(By.Provider, {
22366
+ }, Vy = s(null);
22367
+ function Hy({ children: e }) {
22368
+ let t = By();
22369
+ return /* @__PURE__ */ C(Vy.Provider, {
22349
22370
  value: t,
22350
22371
  children: e
22351
22372
  });
22352
22373
  }
22353
- var Hy = () => {
22354
- let e = p(By);
22374
+ var Uy = () => {
22375
+ let e = p(Vy);
22355
22376
  if (!e) throw Error("useValueMatching must be used within ValueMatchingProvider");
22356
22377
  return e;
22357
- }, Uy = ({ section: e }) => {
22358
- let { t } = K(), { isShowMatched: n, isCollapsed: r, setShowMatched: i, toggleCollapsed: a } = Hy(), o = r(e.columnId), s = t(o ? "dataEditor.common.expand" : "dataEditor.common.collapse"), c = f((t) => i(e.columnId, t), [i, e.columnId]), l = f(() => a(e.columnId), [a, e.columnId]);
22378
+ }, Wy = ({ section: e }) => {
22379
+ let { t } = K(), { isShowMatched: n, isCollapsed: r, setShowMatched: i, toggleCollapsed: a } = Uy(), o = r(e.columnId), s = t(o ? "dataEditor.common.expand" : "dataEditor.common.collapse"), c = f((t) => i(e.columnId, t), [i, e.columnId]), l = f(() => a(e.columnId), [a, e.columnId]);
22359
22380
  return /* @__PURE__ */ w("header", {
22360
22381
  className: "updog__value-matching__section-header",
22361
22382
  children: [/* @__PURE__ */ C("div", {
@@ -22380,7 +22401,8 @@ var Hy = () => {
22380
22401
  onChange: c,
22381
22402
  checkboxPosition: "end",
22382
22403
  label: t("dataEditor.uploader.matchValues.showMatched"),
22383
- size: "sm"
22404
+ size: "sm",
22405
+ className: "updog__value-matching__show-matched"
22384
22406
  })]
22385
22407
  })
22386
22408
  }), /* @__PURE__ */ C(da, {
@@ -22399,14 +22421,14 @@ var Hy = () => {
22399
22421
  })
22400
22422
  })]
22401
22423
  });
22402
- }, Wy = {
22424
+ }, Gy = {
22403
22425
  ",": ",",
22404
22426
  ";": ";",
22405
22427
  "|": "|",
22406
22428
  "\n": "\\n",
22407
22429
  " ": "\\t"
22408
- }, Gy = (e) => e === null ? "" : Wy[e] ?? e, Ky = ({ section: e }) => {
22409
- let { t } = K(), { changeDelimiter: n, reapplyDelimiter: r } = Hy(), i = y(e.delimiter), a = Gy(e.delimiter), [o, s] = b(a), { debouncedValue: c } = za(o, 300), l = y(a);
22430
+ }, Ky = (e) => e === null ? "" : Gy[e] ?? e, qy = ({ section: e }) => {
22431
+ let { t } = K(), { changeDelimiter: n, reapplyDelimiter: r } = Uy(), i = y(e.delimiter), a = Ky(e.delimiter), [o, s] = b(a), { debouncedValue: c } = za(o, 300), l = y(a);
22410
22432
  m(() => {
22411
22433
  s(a), l.current = a;
22412
22434
  }, [a]), m(() => {
@@ -22449,8 +22471,8 @@ var Hy = () => {
22449
22471
  })
22450
22472
  ]
22451
22473
  });
22452
- }, qy = ({ section: e, val: t }) => {
22453
- let { t: n } = K(), { getSelectOptions: r, selectValue: i } = Hy(), a = t.mapped === void 0, o = f((n) => i(e.columnId, t.imported, n), [
22474
+ }, Jy = ({ section: e, val: t }) => {
22475
+ let { t: n } = K(), { getSelectOptions: r, selectValue: i } = Uy(), a = t.mapped === void 0, o = f((n) => i(e.columnId, t.imported, n), [
22454
22476
  i,
22455
22477
  e.columnId,
22456
22478
  t.imported
@@ -22502,8 +22524,8 @@ var Hy = () => {
22502
22524
  })
22503
22525
  ]
22504
22526
  });
22505
- }, Jy = ({ section: e }) => {
22506
- let { t } = K(), { getVisibleValues: n } = Hy(), r = n(e);
22527
+ }, Yy = ({ section: e }) => {
22528
+ let { t } = K(), { getVisibleValues: n } = Uy(), r = n(e);
22507
22529
  return /* @__PURE__ */ w("div", {
22508
22530
  className: "updog__value-matching__table",
22509
22531
  children: [r.length === 0 ? /* @__PURE__ */ C("div", {
@@ -22523,7 +22545,7 @@ var Hy = () => {
22523
22545
  size: "sm",
22524
22546
  weight: "medium",
22525
22547
  children: t("dataEditor.uploader.matchValues.importedValues")
22526
- }), e.isMultiselect && /* @__PURE__ */ C(Ky, { section: e })]
22548
+ }), e.isMultiselect && /* @__PURE__ */ C(qy, { section: e })]
22527
22549
  }),
22528
22550
  /* @__PURE__ */ C("div", { className: "updog__value-matching__arrow-spacer" }),
22529
22551
  /* @__PURE__ */ C(q, {
@@ -22535,25 +22557,25 @@ var Hy = () => {
22535
22557
  }),
22536
22558
  /* @__PURE__ */ C("div", { className: "updog__value-matching__action" })
22537
22559
  ]
22538
- }), r.map((t) => /* @__PURE__ */ C(qy, {
22560
+ }), r.map((t) => /* @__PURE__ */ C(Jy, {
22539
22561
  section: e,
22540
22562
  val: t
22541
22563
  }, t.imported))]
22542
22564
  });
22543
- }, Yy = ({ section: e }) => {
22544
- let { isCollapsed: t } = Hy(), n = !t(e.columnId);
22565
+ }, Xy = ({ section: e }) => {
22566
+ let { isCollapsed: t } = Uy(), n = !t(e.columnId);
22545
22567
  return /* @__PURE__ */ w("div", {
22546
22568
  className: "updog__value-matching__section",
22547
- children: [/* @__PURE__ */ C(Uy, { section: e }), /* @__PURE__ */ C("div", {
22569
+ children: [/* @__PURE__ */ C(Wy, { section: e }), /* @__PURE__ */ C("div", {
22548
22570
  className: E("updog__value-matching__collapsible", n && "updog__value-matching__collapsible--expanded"),
22549
- children: /* @__PURE__ */ C(Jy, { section: e })
22571
+ children: /* @__PURE__ */ C(Yy, { section: e })
22550
22572
  })]
22551
22573
  });
22552
- }, Xy = () => {
22553
- let { sections: e, hasCreateTarget: t, createForOptions: n, createInitialName: r, submitCreate: i, closeCreate: a } = Hy();
22574
+ }, Zy = () => {
22575
+ let { sections: e, hasCreateTarget: t, createForOptions: n, createInitialName: r, submitCreate: i, closeCreate: a } = Uy();
22554
22576
  return /* @__PURE__ */ w("div", {
22555
22577
  className: "updog__value-matching",
22556
- children: [e.map((e) => /* @__PURE__ */ C(Yy, { section: e }, e.columnId)), t && /* @__PURE__ */ C(Sy, {
22578
+ children: [e.map((e) => /* @__PURE__ */ C(Xy, { section: e }, e.columnId)), t && /* @__PURE__ */ C(Cy, {
22557
22579
  open: !0,
22558
22580
  existingOptions: n,
22559
22581
  initialName: r,
@@ -22561,15 +22583,15 @@ var Hy = () => {
22561
22583
  onSubmit: i
22562
22584
  })]
22563
22585
  });
22564
- }, Zy = () => /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ w(Jl, { children: [/* @__PURE__ */ C("div", {
22586
+ }, Qy = () => /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ w(Jl, { children: [/* @__PURE__ */ C("div", {
22565
22587
  className: "updog__step-match-values__content updog__scrollbar",
22566
- children: /* @__PURE__ */ C(Vy, { children: /* @__PURE__ */ C(Xy, {}) })
22567
- }), /* @__PURE__ */ C(bv, {})] }) }), Qy = 20, $y = () => {
22568
- let { store: e } = X(), { t } = K(), { primaryKey: n, onPrimaryKeyChange: r, parsedCsv: i, headers: a, dataStartIndex: o, columnMapping: s, primaryKeyColumns: c } = Bb(), l = e.isClient(), u = f(() => r(null), [r]), d = v(() => {
22588
+ children: /* @__PURE__ */ C(Hy, { children: /* @__PURE__ */ C(Zy, {}) })
22589
+ }), /* @__PURE__ */ C(bv, {})] }) }), $y = 20, eb = () => {
22590
+ let { store: e } = X(), { t } = K(), { primaryKey: n, onPrimaryKeyChange: r, parsedCsv: i, headers: a, dataStartIndex: o, columnMapping: s, primaryKeyColumns: c } = Vb(), l = e.isClient(), u = f(() => r(null), [r]), d = v(() => {
22569
22591
  let e = {};
22570
22592
  for (let [t, n] of Object.entries(s)) n && (e[n] = t);
22571
22593
  return e;
22572
- }, [s]), p = v(() => i ? Ry(i.rawRows, a, o, Qy) : [], [
22594
+ }, [s]), p = v(() => i ? zy(i.rawRows, a, o, $y) : [], [
22573
22595
  i,
22574
22596
  a,
22575
22597
  o
@@ -22621,8 +22643,8 @@ var Hy = () => {
22621
22643
  }, e.id);
22622
22644
  })]
22623
22645
  });
22624
- }, eb = () => /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ w(Jl, { children: [/* @__PURE__ */ C($y, {}), /* @__PURE__ */ C(bv, {})] }) }), tb = () => {
22625
- let { columns: e, importFormats: t, remoteSources: n, sampleData: r } = X(), i = t === !1 ? [] : t, { t: a } = K(), { parsedCsv: o, xlsxFile: s, handleFileRemoved: c, parseFile: l, isParsing: u, remoteSourceLoading: d, remoteSourceError: p, handleRemoteSourceSelect: m } = Bb(), h = [
22646
+ }, tb = () => /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ w(Jl, { children: [/* @__PURE__ */ C(eb, {}), /* @__PURE__ */ C(bv, {})] }) }), nb = () => {
22647
+ let { columns: e, importFormats: t, remoteSources: n, sampleData: r } = X(), i = t === !1 ? [] : t, { t: a } = K(), { parsedCsv: o, xlsxFile: s, handleFileRemoved: c, parseFile: l, isParsing: u, remoteSourceLoading: d, remoteSourceError: p, handleRemoteSourceSelect: m } = Vb(), h = [
22626
22648
  {
22627
22649
  id: "csv",
22628
22650
  format: "csv",
@@ -22680,20 +22702,20 @@ var Hy = () => {
22680
22702
  }, [c]),
22681
22703
  handleRemoteSourceSelect: m
22682
22704
  };
22683
- }, nb = s(null);
22684
- function rb({ children: e }) {
22685
- let t = tb();
22686
- return /* @__PURE__ */ C(nb.Provider, {
22705
+ }, rb = s(null);
22706
+ function ib({ children: e }) {
22707
+ let t = nb();
22708
+ return /* @__PURE__ */ C(rb.Provider, {
22687
22709
  value: t,
22688
22710
  children: e
22689
22711
  });
22690
22712
  }
22691
- var ib = () => {
22692
- let e = p(nb);
22713
+ var ab = () => {
22714
+ let e = p(rb);
22693
22715
  if (!e) throw Error("useSelectFiles must be used within SelectFilesProvider");
22694
22716
  return e;
22695
- }, ab = () => {
22696
- let { t: e } = K(), { exampleMenuOptions: t, onExampleDownload: n } = ib();
22717
+ }, ob = () => {
22718
+ let { t: e } = K(), { exampleMenuOptions: t, onExampleDownload: n } = ab();
22697
22719
  return /* @__PURE__ */ C(Fa, {
22698
22720
  options: t,
22699
22721
  onSelect: n,
@@ -22705,7 +22727,7 @@ var ib = () => {
22705
22727
  children: e("dataEditor.uploader.uploadFile.downloadExample")
22706
22728
  })
22707
22729
  });
22708
- }, ob = ({ source: e }) => e.icon.trimStart().startsWith("<") ? /* @__PURE__ */ C("span", {
22730
+ }, sb = ({ source: e }) => e.icon.trimStart().startsWith("<") ? /* @__PURE__ */ C("span", {
22709
22731
  className: "updog__remote-source-btn__icon",
22710
22732
  dangerouslySetInnerHTML: { __html: e.icon }
22711
22733
  }) : /* @__PURE__ */ C("span", {
@@ -22714,7 +22736,7 @@ var ib = () => {
22714
22736
  src: e.icon,
22715
22737
  alt: e.label
22716
22738
  })
22717
- }), sb = ({ source: e, loading: t, disabled: n, onSelect: r }) => /* @__PURE__ */ C(J, {
22739
+ }), cb = ({ source: e, loading: t, disabled: n, onSelect: r }) => /* @__PURE__ */ C(J, {
22718
22740
  variant: "filled",
22719
22741
  color: "neutral",
22720
22742
  size: "sm",
@@ -22724,11 +22746,11 @@ var ib = () => {
22724
22746
  disabled: !t && n,
22725
22747
  loading: t,
22726
22748
  spinnerPosition: "start",
22727
- startIcon: /* @__PURE__ */ C(ob, { source: e }),
22749
+ startIcon: /* @__PURE__ */ C(sb, { source: e }),
22728
22750
  title: e.description,
22729
22751
  children: e.label
22730
- }), cb = () => {
22731
- let { t: e } = K(), { importFormats: t, remoteSources: n, remoteSourceLoading: r, remoteSourceError: i, handleRemoteSourceSelect: a } = ib(), o = n.length > 0;
22752
+ }), lb = () => {
22753
+ let { t: e } = K(), { importFormats: t, remoteSources: n, remoteSourceLoading: r, remoteSourceError: i, handleRemoteSourceSelect: a } = ab(), o = n.length > 0;
22732
22754
  return /* @__PURE__ */ w("div", {
22733
22755
  className: "updog__source-picker",
22734
22756
  children: [
@@ -22755,7 +22777,7 @@ var ib = () => {
22755
22777
  }),
22756
22778
  o && /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(Oa, {}), /* @__PURE__ */ C("div", {
22757
22779
  className: "updog__source-picker__sources-list",
22758
- children: n.map((e) => /* @__PURE__ */ C(sb, {
22780
+ children: n.map((e) => /* @__PURE__ */ C(cb, {
22759
22781
  source: e,
22760
22782
  loading: r === e.id,
22761
22783
  disabled: !!r,
@@ -22769,7 +22791,7 @@ var ib = () => {
22769
22791
  })
22770
22792
  ]
22771
22793
  });
22772
- }, lb = () => {
22794
+ }, ub = () => {
22773
22795
  let { t: e } = K();
22774
22796
  return /* @__PURE__ */ w("div", {
22775
22797
  className: "updog__uploading-state",
@@ -22782,12 +22804,12 @@ var ib = () => {
22782
22804
  children: e("dataEditor.uploader.uploadFile.uploading")
22783
22805
  })]
22784
22806
  });
22785
- }, ub = () => {
22786
- let { t: e } = K(), { isBlocked: t, isParsing: n, hasFile: r, fileName: i, open: a, onRemoveClick: o } = ib();
22807
+ }, db = () => {
22808
+ let { t: e } = K(), { isBlocked: t, isParsing: n, hasFile: r, fileName: i, open: a, onRemoveClick: o } = ab();
22787
22809
  return /* @__PURE__ */ C("div", {
22788
22810
  className: E("updog__step-select-files__upload-area", t && "updog__step-select-files__upload-area--disabled"),
22789
22811
  onClick: t ? void 0 : a,
22790
- children: n ? /* @__PURE__ */ C(lb, {}) : /* @__PURE__ */ w(S, { children: [
22812
+ children: n ? /* @__PURE__ */ C(ub, {}) : /* @__PURE__ */ w(S, { children: [
22791
22813
  /* @__PURE__ */ C("div", {
22792
22814
  className: "updog__step-select-files__icon-container",
22793
22815
  children: r ? /* @__PURE__ */ C(I, {
@@ -22798,7 +22820,7 @@ var ib = () => {
22798
22820
  className: "updog__step-select-files__icon"
22799
22821
  })
22800
22822
  }),
22801
- !r && /* @__PURE__ */ C(cb, {}),
22823
+ !r && /* @__PURE__ */ C(lb, {}),
22802
22824
  r && /* @__PURE__ */ w("div", {
22803
22825
  className: "updog__step-select-files__info",
22804
22826
  children: [/* @__PURE__ */ C(q, {
@@ -22815,19 +22837,19 @@ var ib = () => {
22815
22837
  })
22816
22838
  ] })
22817
22839
  });
22818
- }, db = () => {
22819
- let { getRootProps: e, getInputProps: t, isDragActive: n } = ib();
22840
+ }, fb = () => {
22841
+ let { getRootProps: e, getInputProps: t, isDragActive: n } = ab();
22820
22842
  return /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ w("div", {
22821
22843
  className: "updog__step-select-files__dropzone",
22822
22844
  ...e(),
22823
22845
  children: [
22824
22846
  /* @__PURE__ */ C("input", { ...t() }),
22825
- /* @__PURE__ */ w(Jl, { children: [/* @__PURE__ */ C(ub, {}), /* @__PURE__ */ C(bv, { leftSlot: /* @__PURE__ */ C(ab, {}) })] }),
22847
+ /* @__PURE__ */ w(Jl, { children: [/* @__PURE__ */ C(db, {}), /* @__PURE__ */ C(bv, { leftSlot: /* @__PURE__ */ C(ob, {}) })] }),
22826
22848
  n && /* @__PURE__ */ C(Yl, {})
22827
22849
  ]
22828
22850
  }) });
22829
- }, fb = () => /* @__PURE__ */ C(rb, { children: /* @__PURE__ */ C(db, {}) }), pb = ({ preview: e }) => {
22830
- let { selectedSheet: t, setSelectedSheet: n } = Bb(), { t: r } = K(), i = Math.max(0, e.totalRows), a = t === e.name, o = v(() => {
22851
+ }, pb = () => /* @__PURE__ */ C(ib, { children: /* @__PURE__ */ C(fb, {}) }), mb = ({ preview: e }) => {
22852
+ let { selectedSheet: t, setSelectedSheet: n } = Vb(), { t: r } = K(), i = Math.max(0, e.totalRows), a = t === e.name, o = v(() => {
22831
22853
  let { headers: t, rows: n } = e;
22832
22854
  return [t, ...n.map((e) => t.map((t) => e[t] ?? ""))];
22833
22855
  }, [e]);
@@ -22863,16 +22885,16 @@ var ib = () => {
22863
22885
  })]
22864
22886
  })
22865
22887
  });
22866
- }, mb = () => {
22867
- let { sheetPreviews: e } = Bb();
22888
+ }, hb = () => {
22889
+ let { sheetPreviews: e } = Vb();
22868
22890
  return /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ w(Jl, { children: [/* @__PURE__ */ C("div", {
22869
22891
  className: "updog__sheet-preview-wrapper updog__scrollbar",
22870
22892
  children: /* @__PURE__ */ C("div", {
22871
22893
  className: "updog__sheet-preview-grid",
22872
- children: e.map((e) => /* @__PURE__ */ C(pb, { preview: e }, e.name))
22894
+ children: e.map((e) => /* @__PURE__ */ C(mb, { preview: e }, e.name))
22873
22895
  })
22874
22896
  }), /* @__PURE__ */ C(bv, {})] }) });
22875
- }, hb = (e, t, n) => {
22897
+ }, gb = (e, t, n) => {
22876
22898
  let r = new Map(t.map((e) => [e.id, e])), i = [];
22877
22899
  for (let [t, a] of Object.entries(e)) a && i.push({
22878
22900
  csvHeader: t,
@@ -22880,11 +22902,11 @@ var ib = () => {
22880
22902
  column: n.has(a) ? void 0 : r.get(a)
22881
22903
  });
22882
22904
  return i;
22883
- }, gb = (e) => {
22905
+ }, _b = (e) => {
22884
22906
  let t = [];
22885
22907
  for (let { csvHeader: n, column: r } of e) r?.editor?.type === "number" && t.push(n);
22886
22908
  return t;
22887
- }, _b = (e, t, n) => {
22909
+ }, vb = (e, t, n) => {
22888
22910
  let r = {};
22889
22911
  for (let { csvHeader: i, columnId: a, column: o } of t) {
22890
22912
  let t = e[i] ?? "";
@@ -22899,7 +22921,7 @@ var ib = () => {
22899
22921
  continue;
22900
22922
  }
22901
22923
  if (s === "multiselect") {
22902
- let e = n.multiselectDelimiters[a], i = o.editor.options ?? [], s = e ? wy(t, e, i) : t === "" ? [] : [t], c = [], l = /* @__PURE__ */ new Set();
22924
+ let e = n.multiselectDelimiters[a], i = o.editor.options ?? [], s = e ? Ty(t, e, i) : t === "" ? [] : [t], c = [], l = /* @__PURE__ */ new Set();
22903
22925
  for (let e of s) {
22904
22926
  let t = n.valueMapping[a]?.[e.trim()];
22905
22927
  t !== void 0 && !l.has(t) && (l.add(t), c.push(t));
@@ -22911,16 +22933,16 @@ var ib = () => {
22911
22933
  r[a] = o.transformer ? o.transformer(c) : c;
22912
22934
  }
22913
22935
  return r;
22914
- }, vb = 200, yb = (e, t, n) => {
22936
+ }, yb = 200, bb = (e, t, n) => {
22915
22937
  if (n) return n;
22916
22938
  let r = new Set(t.map((e) => e.trim().toLowerCase())), i = (e) => r.has(e.trim().toLowerCase()), a = /* @__PURE__ */ new Set(), o = [];
22917
22939
  for (let t of e) {
22918
22940
  let e = t.trim();
22919
- if (!(e === "" || a.has(e)) && (a.add(e), o.push(e), o.length >= vb)) break;
22941
+ if (!(e === "" || a.has(e)) && (a.add(e), o.push(e), o.length >= yb)) break;
22920
22942
  }
22921
22943
  if (o.length === 0) return null;
22922
22944
  let s = null, c = 0, l = 0;
22923
- for (let e of Cy) {
22945
+ for (let e of wy) {
22924
22946
  let n = 0, r = 0;
22925
22947
  for (let a of o) {
22926
22948
  if (i(a) || !a.includes(e)) continue;
@@ -22933,7 +22955,7 @@ var ib = () => {
22933
22955
  (n > c || n === c && n > 0 && r > l) && (s = e, c = n, l = r);
22934
22956
  }
22935
22957
  return c > 0 ? s : null;
22936
- }, bb = (e) => {
22958
+ }, xb = (e) => {
22937
22959
  let t = /* @__PURE__ */ new Map();
22938
22960
  for (let [n, r] of Object.entries(e)) {
22939
22961
  let e = wv(n), i = t.get(e) ?? /* @__PURE__ */ new Set();
@@ -22941,8 +22963,8 @@ var ib = () => {
22941
22963
  t.set(e, i);
22942
22964
  }
22943
22965
  return t;
22944
- }, xb = (e, t, n, r) => {
22945
- let i = bb(r), a = (e, t) => i.get(wv(e))?.has(wv(t)) ?? !1, o = new Map(n.map((e) => [e.id, e])), s = (e, t) => (n, r) => {
22966
+ }, Sb = (e, t, n, r) => {
22967
+ let i = xb(r), a = (e, t) => i.get(wv(e))?.has(wv(t)) ?? !1, o = new Map(n.map((e) => [e.id, e])), s = (e, t) => (n, r) => {
22946
22968
  if (wv(n) === wv(r) || a(r, n)) return;
22947
22969
  let i = `${n} ${r}`;
22948
22970
  t.has(i) || (t.add(i), e.push({
@@ -22962,16 +22984,16 @@ var ib = () => {
22962
22984
  for (let e of Object.values(t)) for (let [t, n] of Object.entries(e)) n && u(t, n);
22963
22985
  return c;
22964
22986
  };
22965
- function Sb(e, t, n) {
22987
+ function Cb(e, t, n) {
22966
22988
  let r = e.length, i = t;
22967
- return i <= 0 ? [] : r === i ? [{ cells: [...e] }] : (r < i ? Cb(i, i - r) : Cb(r - 1, i - 1)) > 1e3 ? [] : r < i ? wb(e, i) : Tb(e, i, n);
22989
+ return i <= 0 ? [] : r === i ? [{ cells: [...e] }] : (r < i ? wb(i, i - r) : wb(r - 1, i - 1)) > 1e3 ? [] : r < i ? Tb(e, i) : Eb(e, i, n);
22968
22990
  }
22969
- function Cb(e, t) {
22991
+ function wb(e, t) {
22970
22992
  let n = Math.min(t, e - t), r = 1;
22971
22993
  for (let t = 1; t <= n; t++) if (r = r * (e - n + t) / t, r > 1e3) return r;
22972
22994
  return r;
22973
22995
  }
22974
- function wb(e, t) {
22996
+ function Tb(e, t) {
22975
22997
  let n = e.length, r = [], i = [], a = (o) => {
22976
22998
  if (i.length === n) {
22977
22999
  let a = Array(t).fill("");
@@ -22983,7 +23005,7 @@ function wb(e, t) {
22983
23005
  };
22984
23006
  return a(0), r;
22985
23007
  }
22986
- function Tb(e, t, n) {
23008
+ function Eb(e, t, n) {
22987
23009
  let r = e.length, i = [], a = [], o = (s) => {
22988
23010
  if (a.length === t - 1) {
22989
23011
  let o = [
@@ -23001,27 +23023,27 @@ function Tb(e, t, n) {
23001
23023
  }
23002
23024
  //#endregion
23003
23025
  //#region src/components/DataUploader/utils/raggedRows/pruneByValidators.ts
23004
- var Eb = {};
23005
- function Db(e, t) {
23026
+ var Db = {};
23027
+ function Ob(e, t) {
23006
23028
  for (let n of t.validators ?? []) if (n.type !== "expression") {
23007
23029
  if (n.type === "function") {
23008
- if (n.fn(e, Eb) != null) return !1;
23030
+ if (n.fn(e, Db) != null) return !1;
23009
23031
  continue;
23010
23032
  }
23011
- if (Al(n, e, Eb) != null) return !1;
23033
+ if (Al(n, e, Db) != null) return !1;
23012
23034
  }
23013
23035
  return !0;
23014
23036
  }
23015
- function Ob(e, t) {
23016
- for (let n = 0; n < t.length; n++) if (!Db(e.cells[n] ?? "", t[n])) return !1;
23037
+ function kb(e, t) {
23038
+ for (let n = 0; n < t.length; n++) if (!Ob(e.cells[n] ?? "", t[n])) return !1;
23017
23039
  return !0;
23018
23040
  }
23019
- function kb(e, t) {
23020
- return e.filter((e) => Ob(e, t));
23041
+ function Ab(e, t) {
23042
+ return e.filter((e) => kb(e, t));
23021
23043
  }
23022
23044
  //#endregion
23023
23045
  //#region src/components/DataUploader/utils/raggedRows/computeDisputeSpans.ts
23024
- function Ab(e) {
23046
+ function jb(e) {
23025
23047
  if (e.length <= 1) return [];
23026
23048
  let t = e[0].cells.length, n = [], r = -1;
23027
23049
  for (let i = 0; i < t; i++) {
@@ -23038,25 +23060,25 @@ function Ab(e) {
23038
23060
  }
23039
23061
  //#endregion
23040
23062
  //#region src/components/DataUploader/utils/raggedRows/alignRow.ts
23041
- function jb(e, t, n) {
23042
- let r = Sb(e, t.length, n), i = kb(r, t);
23063
+ function Mb(e, t, n) {
23064
+ let r = Cb(e, t.length, n), i = Ab(r, t);
23043
23065
  return i.length === 1 ? {
23044
23066
  kind: "confident",
23045
23067
  alignment: i[0]
23046
23068
  } : i.length > 1 ? {
23047
23069
  kind: "ambiguous",
23048
23070
  candidates: i,
23049
- disputeSpans: Ab(i)
23071
+ disputeSpans: jb(i)
23050
23072
  } : {
23051
23073
  kind: "invalid",
23052
23074
  candidates: r,
23053
- disputeSpans: Ab(r)
23075
+ disputeSpans: jb(r)
23054
23076
  };
23055
23077
  }
23056
23078
  //#endregion
23057
23079
  //#region src/components/DataUploader/utils/raggedRows/resolveRaggedRow.ts
23058
- function Mb(e, t, n) {
23059
- let r = jb(e, t, n);
23080
+ function Nb(e, t, n) {
23081
+ let r = Mb(e, t, n);
23060
23082
  if (r.kind === "confident") return {
23061
23083
  cells: r.alignment.cells,
23062
23084
  conflictColumns: []
@@ -23075,20 +23097,20 @@ function Mb(e, t, n) {
23075
23097
  }
23076
23098
  //#endregion
23077
23099
  //#region src/components/DataUploader/context/useViewModel.tsx
23078
- var Nb = 5e3, Pb = 15, Fb = 20, Ib = new Set([
23100
+ var Pb = 5e3, Fb = 15, Ib = 20, Lb = new Set([
23079
23101
  "xlsx",
23080
23102
  "xls",
23081
23103
  "xlsb",
23082
23104
  "ods"
23083
23105
  ]);
23084
- function Lb() {
23106
+ function Rb() {
23085
23107
  let { store: e, validator: t, columns: n, primaryKey: r, setShowUploader: i, pendingImportFile: a, setPendingImportFile: o, onColumnMatch: s, onValueMatch: c, synonyms: l, addDynamicColumns: u, scaleClient: d } = X(), { t: p } = K(), [h, g] = b(0), [_, x] = b(0), [S, w] = b(null), [T, E] = b({}), D = v(() => {
23086
23108
  let e = new Set(Object.values(T).filter(Boolean));
23087
23109
  return n.filter((t) => t.unique && e.has(t.id));
23088
23110
  }, [T, n]), [O, k] = b(() => r), [A, j] = b(!1), [M, N] = b(!1), [P, F] = b(null), [I, L] = b([]), [R, z] = b(null), [B, V] = b([]), [ee, te] = b({}), [H, ne] = b([]), [re, ie] = b({}), ae = y(null), [oe, se] = b(-1), ce = f((e, t) => t ? p("dataEditor.uploader.matchColumns.syntheticColumnValue", {
23089
23111
  index: e + 1,
23090
23112
  value: t
23091
- }) : p("dataEditor.uploader.matchColumns.syntheticColumn", { index: e + 1 }), [p]), le = v(() => S ? jy(S.detection, oe) : 0, [S, oe]), ue = v(() => S ? My(S.rawRows, oe, le, ce) : [], [
23113
+ }) : p("dataEditor.uploader.matchColumns.syntheticColumn", { index: e + 1 }), [p]), le = v(() => S ? My(S.detection, oe) : 0, [S, oe]), ue = v(() => S ? Ny(S.rawRows, oe, le, ce) : [], [
23092
23114
  S,
23093
23115
  oe,
23094
23116
  le,
@@ -23106,16 +23128,16 @@ function Lb() {
23106
23128
  let e = [{
23107
23129
  id: "select-files",
23108
23130
  title: p("dataEditor.uploader.steps.selectFiles"),
23109
- content: /* @__PURE__ */ C(fb, {})
23131
+ content: /* @__PURE__ */ C(pb, {})
23110
23132
  }];
23111
23133
  return I.length > 1 && e.push({
23112
23134
  id: "sheet-selection",
23113
23135
  title: p("dataEditor.uploader.steps.sheetSelection"),
23114
- content: /* @__PURE__ */ C(mb, {})
23136
+ content: /* @__PURE__ */ C(hb, {})
23115
23137
  }), S && S.detection.review.kind !== "none" && e.push({
23116
23138
  id: "header-selection",
23117
23139
  title: p("dataEditor.uploader.steps.headerSelection"),
23118
- content: /* @__PURE__ */ C(xy, {})
23140
+ content: /* @__PURE__ */ C(Sy, {})
23119
23141
  }), e.push({
23120
23142
  id: "column-matching",
23121
23143
  title: p("dataEditor.uploader.steps.matchColumns"),
@@ -23123,11 +23145,11 @@ function Lb() {
23123
23145
  }), me && e.push({
23124
23146
  id: "match-values",
23125
23147
  title: p("dataEditor.uploader.steps.matchValues"),
23126
- content: /* @__PURE__ */ C(Zy, {})
23148
+ content: /* @__PURE__ */ C(Qy, {})
23127
23149
  }), D.length > 0 && he && e.push({
23128
23150
  id: "primary-key",
23129
23151
  title: p("dataEditor.uploader.steps.primaryKey"),
23130
- content: /* @__PURE__ */ C(eb, {})
23152
+ content: /* @__PURE__ */ C(tb, {})
23131
23153
  }), e;
23132
23154
  }, [
23133
23155
  D.length,
@@ -23171,7 +23193,7 @@ function Lb() {
23171
23193
  sheetName: R
23172
23194
  }).then((e) => {
23173
23195
  if (e.kind !== "rows") return;
23174
- let t = my(e.rows);
23196
+ let t = hy(e.rows);
23175
23197
  se(t.headerRowIndex), Se({
23176
23198
  fileName: P.name,
23177
23199
  rawRows: e.rows,
@@ -23195,7 +23217,7 @@ function Lb() {
23195
23217
  j(!1);
23196
23218
  return;
23197
23219
  }
23198
- let n = my(e.rows);
23220
+ let n = hy(e.rows);
23199
23221
  if (se(n.headerRowIndex), Se({
23200
23222
  fileName: t.name,
23201
23223
  rawRows: e.rows,
@@ -23229,8 +23251,8 @@ function Lb() {
23229
23251
  if (e.kind !== "records") return;
23230
23252
  se(0), Se({
23231
23253
  fileName: t.name,
23232
- rawRows: Py(e.headers, e.rows),
23233
- detection: Ny()
23254
+ rawRows: Fy(e.headers, e.rows),
23255
+ detection: Py()
23234
23256
  });
23235
23257
  } catch (t) {
23236
23258
  j(!1), e.errorHandler.handleError({
@@ -23251,8 +23273,8 @@ function Lb() {
23251
23273
  if (e.kind !== "records") return;
23252
23274
  se(0), Se({
23253
23275
  fileName: t.name,
23254
- rawRows: Py(e.headers, e.rows),
23255
- detection: Ny()
23276
+ rawRows: Fy(e.headers, e.rows),
23277
+ detection: Py()
23256
23278
  });
23257
23279
  } catch (t) {
23258
23280
  j(!1), e.errorHandler.handleError({
@@ -23271,11 +23293,11 @@ function Lb() {
23271
23293
  pe.parse(t, { format: "xlsx" }).then((e) => {
23272
23294
  if (e.kind === "sheets") {
23273
23295
  let n = e.sheets.map((e) => {
23274
- let t = my(e.rows), n = jy(t, t.headerRowIndex), r = My(e.rows, t.headerRowIndex, n, ce);
23296
+ let t = hy(e.rows), n = My(t, t.headerRowIndex), r = Ny(e.rows, t.headerRowIndex, n, ce);
23275
23297
  return {
23276
23298
  name: e.name,
23277
23299
  headers: r,
23278
- rows: Ry(e.rows, r, n, Pb),
23300
+ rows: zy(e.rows, r, n, Fb),
23279
23301
  totalRows: e.totalRows - 1
23280
23302
  };
23281
23303
  });
@@ -23283,7 +23305,7 @@ function Lb() {
23283
23305
  return;
23284
23306
  }
23285
23307
  if (e.kind !== "rows") return;
23286
- let n = my(e.rows);
23308
+ let n = hy(e.rows);
23287
23309
  se(n.headerRowIndex), Se({
23288
23310
  fileName: t.name,
23289
23311
  rawRows: e.rows,
@@ -23308,7 +23330,7 @@ function Lb() {
23308
23330
  ]), je = f((e) => {
23309
23331
  j(!0), ae.current = e;
23310
23332
  let t = e.name.split(".").pop()?.toLowerCase();
23311
- t && Ib.has(t) ? Ae(e) : t === "json" ? Oe(e) : t === "xml" ? ke(e) : De(e);
23333
+ t && Lb.has(t) ? Ae(e) : t === "json" ? Oe(e) : t === "xml" ? ke(e) : De(e);
23312
23334
  }, [
23313
23335
  De,
23314
23336
  Oe,
@@ -23345,8 +23367,8 @@ function Lb() {
23345
23367
  });
23346
23368
  se(0), Se({
23347
23369
  fileName: e.label,
23348
- rawRows: Py(n, r),
23349
- detection: Ny()
23370
+ rawRows: Fy(n, r),
23371
+ detection: Py()
23350
23372
  });
23351
23373
  }
23352
23374
  } catch (e) {
@@ -23374,7 +23396,7 @@ function Lb() {
23374
23396
  return;
23375
23397
  }
23376
23398
  if (M) return;
23377
- let e = {}, t = {}, r = Fy(ue);
23399
+ let e = {}, t = {}, r = Iy(ue);
23378
23400
  for (let [i, a] of Object.entries(T)) {
23379
23401
  if (!a) continue;
23380
23402
  let o = n.find((e) => e.id === a);
@@ -23383,9 +23405,9 @@ function Lb() {
23383
23405
  if (s !== "select" && s !== "multiselect") continue;
23384
23406
  let c = o.editor.options, l = r.get(i);
23385
23407
  if (l === void 0) continue;
23386
- let u = Iy(S.rawRows, le, l);
23408
+ let u = Ly(S.rawRows, le, l);
23387
23409
  if (s === "multiselect") {
23388
- let n = o.editor.delimiter, r = yb(u, c, n);
23410
+ let n = o.editor.delimiter, r = bb(u, c, n);
23389
23411
  t[a] = r;
23390
23412
  let i = new Set(c.map((e) => e.trim().toLowerCase())), s = /* @__PURE__ */ new Set();
23391
23413
  for (let e of u) {
@@ -23448,10 +23470,10 @@ function Lb() {
23448
23470
  if (!t) return;
23449
23471
  let r = n.find((t) => t.id === e);
23450
23472
  if (r?.editor?.type !== "multiselect") return;
23451
- let i = Fy(ue).get(t);
23473
+ let i = Iy(ue).get(t);
23452
23474
  if (i === void 0) return;
23453
- let a = Iy(S.rawRows, le, i), o = r.editor.delimiter;
23454
- Ke(e, yb(a, r.editor.options, o));
23475
+ let a = Ly(S.rawRows, le, i), o = r.editor.delimiter;
23476
+ Ke(e, bb(a, r.editor.options, o));
23455
23477
  }, [
23456
23478
  S,
23457
23479
  T,
@@ -23472,7 +23494,7 @@ function Lb() {
23472
23494
  for (let [r, i] of Object.entries(T)) !i || e.has(i) || n.find((e) => e.id === i)?.editor?.type === "date" && t.push(r);
23473
23495
  return t;
23474
23496
  }, [T, n]), Xe = f(() => {
23475
- let e = new Set(H.map((e) => e.id)), t = hb(T, n, e), i = S ? Ry(S.rawRows, ue, le, 1e3) : [], a = tc(i, gb(t)), o = oc(i, Ye(e));
23497
+ let e = new Set(H.map((e) => e.id)), t = gb(T, n, e), i = S ? zy(S.rawRows, ue, le, 1e3) : [], a = tc(i, _b(t)), o = oc(i, Ye(e));
23476
23498
  return {
23477
23499
  columnMapping: T,
23478
23500
  valueMapping: We,
@@ -23513,7 +23535,7 @@ function Lb() {
23513
23535
  if (!S || !d?.onRowsImport) return;
23514
23536
  let t = S;
23515
23537
  w(null);
23516
- let r = crypto.randomUUID(), i = Xe(), a = new AbortController(), o = d.importChunkSize ?? Nb, s = hb(T, n, new Set(H.map((e) => e.id))), c = {
23538
+ let r = crypto.randomUUID(), i = Xe(), a = new AbortController(), o = d.importChunkSize ?? Pb, s = gb(T, n, new Set(H.map((e) => e.id))), c = {
23517
23539
  numberFormat: i.numberFormat,
23518
23540
  dateFormat: i.dateFormat,
23519
23541
  monthTable: ic(p),
@@ -23522,14 +23544,14 @@ function Lb() {
23522
23544
  }, l = ue, u = t.rawRows, f = [];
23523
23545
  for (let e = le; e < u.length; e++) {
23524
23546
  let t = u[e];
23525
- t && !Dy(t) && f.push(e);
23547
+ t && !Oy(t) && f.push(e);
23526
23548
  }
23527
23549
  let m = 0;
23528
23550
  for (; m < f.length;) {
23529
23551
  let e = Math.min(m + o, f.length), n = [];
23530
23552
  for (let t = m; t < e; t++) {
23531
- let e = Ly(u[f[t]] ?? [], l);
23532
- n.push(_b(e, s, c));
23553
+ let e = Ry(u[f[t]] ?? [], l);
23554
+ n.push(vb(e, s, c));
23533
23555
  }
23534
23556
  let p = e >= f.length, h = Math.floor(m / o);
23535
23557
  await d.onRowsImport({
@@ -23570,14 +23592,14 @@ function Lb() {
23570
23592
  H.length > 0 && u(H);
23571
23593
  for (let [t, n] of Object.entries(re)) e.addColumnOptions(t, n);
23572
23594
  let o = e.registerSource({ name: i.fileName });
23573
- e.setSourceLoading(o, !0), e.recordLearnedSynonyms(xb(T, We, [...n, ...H], Sv(xv, l)));
23595
+ e.setSourceLoading(o, !0), e.recordLearnedSynonyms(Sb(T, We, [...n, ...H], Sv(xv, l)));
23574
23596
  let s = ue, c = i.delimiter ?? ",", d = i.rawRows, f = [];
23575
23597
  for (let e = le; e < d.length; e++) {
23576
23598
  let t = d[e];
23577
- t && !Dy(t) && f.push(e);
23599
+ t && !Oy(t) && f.push(e);
23578
23600
  }
23579
- let m = Ry(i.rawRows, s, le, 1e3), h = hb(T, n, a), g = {
23580
- numberFormat: tc(m, gb(h)),
23601
+ let m = zy(i.rawRows, s, le, 1e3), h = gb(T, n, a), g = {
23602
+ numberFormat: tc(m, _b(h)),
23581
23603
  dateFormat: oc(m, Ye(a)),
23582
23604
  monthTable: ic(p),
23583
23605
  valueMapping: We,
@@ -23589,11 +23611,11 @@ function Lb() {
23589
23611
  title: e
23590
23612
  };
23591
23613
  }), v = 0, y = () => {
23592
- let n = Math.min(v + Nb, f.length), i = [], a = [];
23614
+ let n = Math.min(v + Pb, f.length), i = [], a = [];
23593
23615
  for (let e = v; e < n; e++) {
23594
- let t = d[f[e]] ?? [], n = Ly(t, s);
23616
+ let t = d[f[e]] ?? [], n = Ry(t, s);
23595
23617
  if (t.length !== s.length) {
23596
- let { cells: r, conflictColumns: i } = Mb(t.map((e) => String(e ?? "")), _, c);
23618
+ let { cells: r, conflictColumns: i } = Nb(t.map((e) => String(e ?? "")), _, c);
23597
23619
  if (r.length) {
23598
23620
  let e = {};
23599
23621
  for (let t = 0; t < s.length; t++) e[s[t]] = r[t] ?? "";
@@ -23611,10 +23633,10 @@ function Lb() {
23611
23633
  });
23612
23634
  }
23613
23635
  }
23614
- i.push(_b(n, h, g));
23636
+ i.push(vb(n, h, g));
23615
23637
  }
23616
23638
  let { rows: l, rowIds: u } = e.upsertRows(o, i, { anchorKey: O ?? void 0 });
23617
- for (let e = v; e < n; e++) e < Fb || (d[f[e]] = void 0);
23639
+ for (let e = v; e < n; e++) e < Ib || (d[f[e]] = void 0);
23618
23640
  v = n, setTimeout(() => {
23619
23641
  t.validateRows(l, u);
23620
23642
  for (let { localIndex: t, columnIds: n } of a) {
@@ -23722,20 +23744,20 @@ function Lb() {
23722
23744
  }
23723
23745
  //#endregion
23724
23746
  //#region src/components/DataUploader/context/index.tsx
23725
- var Rb = s(null);
23726
- function zb({ children: e }) {
23727
- let t = Lb();
23728
- return /* @__PURE__ */ C(Rb.Provider, {
23747
+ var zb = s(null);
23748
+ function Bb({ children: e }) {
23749
+ let t = Rb();
23750
+ return /* @__PURE__ */ C(zb.Provider, {
23729
23751
  value: t,
23730
23752
  children: e
23731
23753
  });
23732
23754
  }
23733
- var Bb = () => {
23734
- let e = p(Rb);
23755
+ var Vb = () => {
23756
+ let e = p(zb);
23735
23757
  if (!e) throw Error("useDataUploaderContext must be used within DataUploaderProvider");
23736
23758
  return e;
23737
- }, Vb = () => {
23738
- let { steps: e, activeStepIndex: t, currentStepIndex: n, goToStep: r } = Bb();
23759
+ }, Hb = () => {
23760
+ let { steps: e, activeStepIndex: t, currentStepIndex: n, goToStep: r } = Vb();
23739
23761
  return /* @__PURE__ */ C(co, {
23740
23762
  steps: e,
23741
23763
  activeStepIndex: t,
@@ -23743,79 +23765,79 @@ var Bb = () => {
23743
23765
  onStepChange: r,
23744
23766
  isProgressive: !0
23745
23767
  });
23746
- }, Hb = () => /* @__PURE__ */ C(zb, { children: /* @__PURE__ */ C(Vb, {}) }), Ub = {
23768
+ }, Ub = () => /* @__PURE__ */ C(Bb, { children: /* @__PURE__ */ C(Hb, {}) }), Wb = {
23747
23769
  kty: "EC",
23748
23770
  crv: "P-256",
23749
23771
  x: "wZO1Jxr21FEBDsVMzbTbF8blU2CP17c_eQY7gorO13U",
23750
23772
  y: "Nwr-tXatJZ3DxZqpUG_gOWzmpU6szTqrEL7Gnh5UGwo"
23751
- }, Wb = "updog_license_grant", Gb = new Set([
23773
+ }, Gb = "updog_license_grant", Kb = new Set([
23752
23774
  "updog.tech",
23753
23775
  "landing.updog.tech",
23754
23776
  "demo.updog.tech"
23755
23777
  ]);
23756
- function Kb() {
23757
- return Gb.has(window.location.hostname);
23758
- }
23759
23778
  function qb() {
23760
- return !1;
23779
+ return Kb.has(window.location.hostname);
23761
23780
  }
23762
23781
  function Jb() {
23782
+ return !1;
23783
+ }
23784
+ function Yb() {
23763
23785
  return "https://api.updog.tech";
23764
23786
  }
23765
- function Yb(e) {
23787
+ function Xb(e) {
23766
23788
  let t = e.replace(/-/g, "+").replace(/_/g, "/"), n = t + "=".repeat((4 - t.length % 4) % 4), r = atob(n), i = new Uint8Array(r.length);
23767
23789
  for (let e = 0; e < r.length; e++) i[e] = r.charCodeAt(e);
23768
23790
  return i;
23769
23791
  }
23770
- async function Xb(e) {
23792
+ async function Zb(e) {
23771
23793
  let t = new TextEncoder().encode(e), n = await crypto.subtle.digest("SHA-256", t);
23772
23794
  return Array.from(new Uint8Array(n)).map((e) => e.toString(16).padStart(2, "0")).join("");
23773
23795
  }
23774
- var Zb = null;
23775
- async function Qb() {
23776
- return Zb || (Zb = await crypto.subtle.importKey("jwk", Ub, {
23796
+ var Qb = null;
23797
+ async function $b() {
23798
+ return Qb || (Qb = await crypto.subtle.importKey("jwk", Wb, {
23777
23799
  name: "ECDSA",
23778
23800
  namedCurve: "P-256"
23779
- }, !1, ["verify"]), Zb);
23801
+ }, !1, ["verify"]), Qb);
23780
23802
  }
23781
- function $b() {
23803
+ function ex() {
23782
23804
  try {
23783
- return localStorage.getItem(Wb);
23805
+ return localStorage.getItem(Gb);
23784
23806
  } catch {
23785
23807
  return null;
23786
23808
  }
23787
23809
  }
23788
- function ex(e) {
23810
+ function tx(e) {
23789
23811
  try {
23790
- localStorage.setItem(Wb, e);
23812
+ localStorage.setItem(Gb, e);
23791
23813
  } catch {}
23792
23814
  }
23793
- function tx() {
23815
+ function nx() {
23794
23816
  try {
23795
- localStorage.removeItem(Wb);
23817
+ localStorage.removeItem(Gb);
23796
23818
  } catch {}
23797
23819
  }
23798
- async function nx(e, t, n) {
23820
+ async function rx(e, t, n) {
23799
23821
  let r = e.indexOf(".");
23800
23822
  if (r === -1) return !1;
23801
- let i = e.slice(0, r), a = e.slice(r + 1), o = Yb(i), s = Yb(a), c = await Qb();
23823
+ let i = e.slice(0, r), a = e.slice(r + 1), o = Xb(i), s = Xb(a), c = await $b();
23802
23824
  if (!await crypto.subtle.verify({
23803
23825
  name: "ECDSA",
23804
23826
  hash: "SHA-256"
23805
23827
  }, c, new Uint8Array(s), new Uint8Array(o))) return !1;
23806
23828
  let l = JSON.parse(new TextDecoder().decode(o));
23807
23829
  if (l.exp <= Math.floor(Date.now() / 1e3)) return !1;
23808
- let u = await Xb(t);
23830
+ let u = await Zb(t);
23809
23831
  return !(l.key !== u || l.domain !== n);
23810
23832
  }
23811
- async function rx(e) {
23812
- let t = $b();
23833
+ async function ix(e) {
23834
+ let t = ex();
23813
23835
  if (!t) return {
23814
23836
  valid: !1,
23815
23837
  errorCode: "license.invalid"
23816
23838
  };
23817
23839
  try {
23818
- if (await nx(t, e, window.location.hostname.toLowerCase().trim())) return {
23840
+ if (await rx(t, e, window.location.hostname.toLowerCase().trim())) return {
23819
23841
  valid: !0,
23820
23842
  errorCode: null
23821
23843
  };
@@ -23825,23 +23847,23 @@ async function rx(e) {
23825
23847
  errorCode: "license.invalid"
23826
23848
  };
23827
23849
  }
23828
- async function ix(e, t = !0) {
23829
- if (Kb() || qb()) return {
23850
+ async function ax(e, t = !0) {
23851
+ if (qb() || Jb()) return {
23830
23852
  valid: !0,
23831
23853
  errorCode: null
23832
23854
  };
23833
- let n = Jb();
23855
+ let n = Yb();
23834
23856
  try {
23835
23857
  let r = await fetch(`${n}/v1/validate`, { headers: { "X-API-Key": e } });
23836
23858
  if (r.ok) {
23837
23859
  let e = await r.json();
23838
- return t && e.grant && ex(e.grant), {
23860
+ return t && e.grant && tx(e.grant), {
23839
23861
  valid: !0,
23840
23862
  errorCode: null
23841
23863
  };
23842
23864
  }
23843
23865
  if (r.status >= 400 && r.status < 500) {
23844
- t && tx();
23866
+ t && nx();
23845
23867
  try {
23846
23868
  return await r.json();
23847
23869
  } catch {
@@ -23853,7 +23875,7 @@ async function ix(e, t = !0) {
23853
23875
  }
23854
23876
  throw Error(`Server error: ${r.status}`);
23855
23877
  } catch {
23856
- return t ? rx(e) : {
23878
+ return t ? ix(e) : {
23857
23879
  valid: !1,
23858
23880
  errorCode: "license.invalid"
23859
23881
  };
@@ -23861,7 +23883,7 @@ async function ix(e, t = !0) {
23861
23883
  }
23862
23884
  //#endregion
23863
23885
  //#region src/hooks/useLicenseValidation.ts
23864
- function ax(e, t, n = !0) {
23886
+ function ox(e, t, n = !0) {
23865
23887
  let [r, i] = b({
23866
23888
  isValidating: t,
23867
23889
  isValid: !1,
@@ -23881,7 +23903,7 @@ function ax(e, t, n = !0) {
23881
23903
  isValidating: !0,
23882
23904
  isValid: !1,
23883
23905
  errorCode: null
23884
- }), ix(e, n).then((e) => {
23906
+ }), ax(e, n).then((e) => {
23885
23907
  r || i({
23886
23908
  isValidating: !1,
23887
23909
  isValid: e.valid,
@@ -23904,7 +23926,7 @@ function ax(e, t, n = !0) {
23904
23926
  }
23905
23927
  //#endregion
23906
23928
  //#region src/server/auth/AuthState.ts
23907
- var ox = class {
23929
+ var sx = class {
23908
23930
  token = null;
23909
23931
  get() {
23910
23932
  return this.token;
@@ -23915,13 +23937,13 @@ var ox = class {
23915
23937
  clear() {
23916
23938
  this.token = null;
23917
23939
  }
23918
- }, sx = class extends Error {
23940
+ }, cx = class extends Error {
23919
23941
  status;
23920
23942
  code;
23921
23943
  constructor(e) {
23922
23944
  super(e.message), this.name = "ScaleHttpError", this.status = e.status, this.code = e.code;
23923
23945
  }
23924
- }, cx = class {
23946
+ }, lx = class {
23925
23947
  baseUrl;
23926
23948
  apiKey;
23927
23949
  auth;
@@ -23951,7 +23973,7 @@ var ox = class {
23951
23973
  signal: r?.signal
23952
23974
  });
23953
23975
  } catch (e) {
23954
- this.notify(new sx({
23976
+ this.notify(new cx({
23955
23977
  status: 0,
23956
23978
  code: "network",
23957
23979
  message: e instanceof Error ? e.message : String(e)
@@ -23962,7 +23984,7 @@ var ox = class {
23962
23984
  try {
23963
23985
  e = await s.json();
23964
23986
  } catch {}
23965
- this.notify(new sx({
23987
+ this.notify(new cx({
23966
23988
  status: s.status,
23967
23989
  code: e.error ?? `http_${s.status}`,
23968
23990
  message: e.message ?? s.statusText
@@ -23973,23 +23995,23 @@ var ox = class {
23973
23995
  };
23974
23996
  //#endregion
23975
23997
  //#region src/server/endpoints/workspaces.ts
23976
- async function lx(e, t) {
23998
+ async function ux(e, t) {
23977
23999
  return e.post("/workspaces", {
23978
24000
  primaryKey: t.primaryKey,
23979
24001
  columns: t.columns
23980
24002
  }, { signal: t.signal });
23981
24003
  }
23982
- async function ux(e) {
24004
+ async function dx(e) {
23983
24005
  try {
23984
24006
  await e.http.delete(`/workspaces/${e.workspaceId}`, { signal: e.signal });
23985
24007
  } catch (e) {
23986
- if (e instanceof sx && e.status === 404) return;
24008
+ if (e instanceof cx && e.status === 404) return;
23987
24009
  throw e;
23988
24010
  }
23989
24011
  }
23990
24012
  //#endregion
23991
24013
  //#region src/server/endpoints/query.ts
23992
- async function dx(e, t) {
24014
+ async function fx(e, t) {
23993
24015
  let n = await e.http.post(`/workspaces/${e.workspaceId}/query`, {
23994
24016
  page: {
23995
24017
  limit: t.limit,
@@ -24007,12 +24029,12 @@ async function dx(e, t) {
24007
24029
  }
24008
24030
  //#endregion
24009
24031
  //#region src/server/ScaleClient.ts
24010
- var fx = class {
24032
+ var px = class {
24011
24033
  disposed = !1;
24012
24034
  constructor(e) {
24013
24035
  this.deps = e;
24014
24036
  }
24015
- onQuery = (e) => dx(this.deps, e);
24037
+ onQuery = (e) => fx(this.deps, e);
24016
24038
  onEdit = async (e) => ({
24017
24039
  rejected: !0,
24018
24040
  reason: "Edits are not yet supported in server mode (v0)."
@@ -24029,7 +24051,7 @@ var fx = class {
24029
24051
  pageSize = void 0;
24030
24052
  scrollSensitivity = void 0;
24031
24053
  dispose = async () => {
24032
- this.disposed || (this.disposed = !0, await ux({
24054
+ this.disposed || (this.disposed = !0, await dx({
24033
24055
  http: this.deps.http,
24034
24056
  workspaceId: this.deps.workspaceId
24035
24057
  }));
@@ -24037,25 +24059,25 @@ var fx = class {
24037
24059
  };
24038
24060
  //#endregion
24039
24061
  //#region src/server/createScaleClient.ts
24040
- async function px(e) {
24041
- let t = new ox(), n = new cx({
24062
+ async function mx(e) {
24063
+ let t = new sx(), n = new lx({
24042
24064
  baseUrl: e.url,
24043
24065
  apiKey: e.apiKey,
24044
24066
  auth: t,
24045
24067
  onDegraded: e.onDegraded
24046
- }), { workspaceId: r, accessToken: i } = await lx(n, {
24068
+ }), { workspaceId: r, accessToken: i } = await ux(n, {
24047
24069
  primaryKey: e.primaryKey,
24048
24070
  columns: e.columns,
24049
24071
  signal: e.signal
24050
24072
  });
24051
- return t.set(i), new fx({
24073
+ return t.set(i), new px({
24052
24074
  workspaceId: r,
24053
24075
  http: n
24054
24076
  });
24055
24077
  }
24056
24078
  //#endregion
24057
24079
  //#region src/server/errors.ts
24058
- function mx(e, t, n) {
24080
+ function hx(e, t, n) {
24059
24081
  return {
24060
24082
  code: e,
24061
24083
  message: t,
@@ -24065,7 +24087,7 @@ function mx(e, t, n) {
24065
24087
  }
24066
24088
  //#endregion
24067
24089
  //#region src/hooks/useScaleClient.ts
24068
- function hx(e) {
24090
+ function gx(e) {
24069
24091
  let [t, n] = b({ status: "idle" }), r = y(e.columns), i = y(e.primaryKey);
24070
24092
  return m(() => {
24071
24093
  if (!e.enabled) {
@@ -24074,7 +24096,7 @@ function hx(e) {
24074
24096
  }
24075
24097
  n({ status: "bootstrapping" });
24076
24098
  let t = new AbortController(), a = null;
24077
- return px({
24099
+ return mx({
24078
24100
  url: e.url,
24079
24101
  apiKey: e.apiKey,
24080
24102
  primaryKey: i.current,
@@ -24083,7 +24105,7 @@ function hx(e) {
24083
24105
  onDegraded: (e) => {
24084
24106
  t.signal.aborted || n({
24085
24107
  status: "failed",
24086
- error: _x(e)
24108
+ error: vx(e)
24087
24109
  });
24088
24110
  }
24089
24111
  }).then((e) => {
@@ -24098,7 +24120,7 @@ function hx(e) {
24098
24120
  }).catch((e) => {
24099
24121
  t.signal.aborted || n({
24100
24122
  status: "failed",
24101
- error: gx(e)
24123
+ error: _x(e)
24102
24124
  });
24103
24125
  }), () => {
24104
24126
  t.abort(), a?.dispose().catch(() => {});
@@ -24109,30 +24131,30 @@ function hx(e) {
24109
24131
  e.apiKey
24110
24132
  ]), t;
24111
24133
  }
24112
- function gx(e) {
24113
- return e instanceof sx ? e.status === 401 ? mx(e.code.startsWith("license.") ? e.code : "license.invalid", e.message, e) : e.status === 0 ? mx("scale.unreachable", e.message, e) : e.status >= 500 ? mx("scale.server_error", e.message, e) : mx("scale.bootstrap_failed", e.message, e) : mx("scale.bootstrap_failed", e instanceof Error ? e.message : String(e), e);
24114
- }
24115
24134
  function _x(e) {
24116
- return e.status === 0 ? mx("scale.unreachable", e.message, e) : e.status === 404 ? mx("scale.workspace_lost", e.message, e) : mx("scale.server_error", e.message, e);
24135
+ return e instanceof cx ? e.status === 401 ? hx(e.code.startsWith("license.") ? e.code : "license.invalid", e.message, e) : e.status === 0 ? hx("scale.unreachable", e.message, e) : e.status >= 500 ? hx("scale.server_error", e.message, e) : hx("scale.bootstrap_failed", e.message, e) : hx("scale.bootstrap_failed", e instanceof Error ? e.message : String(e), e);
24136
+ }
24137
+ function vx(e) {
24138
+ return e.status === 0 ? hx("scale.unreachable", e.message, e) : e.status === 404 ? hx("scale.workspace_lost", e.message, e) : hx("scale.server_error", e.message, e);
24117
24139
  }
24118
24140
  //#endregion
24119
24141
  //#region src/index.tsx
24120
- function vx(e) {
24142
+ function yx(e) {
24121
24143
  return e === !1 ? { licenseGrant: !1 } : { licenseGrant: e?.licenseGrant ?? !0 };
24122
24144
  }
24123
- function yx(e) {
24145
+ function bx(e) {
24124
24146
  let t = v(() => new Bo(e.onError), [e.onError]);
24125
24147
  return /* @__PURE__ */ C(yv, {
24126
24148
  errorHandler: t,
24127
24149
  children: /* @__PURE__ */ C(Wl, {
24128
24150
  ...e,
24129
24151
  errorHandler: t,
24130
- children: e.showUploader ? /* @__PURE__ */ C(Hb, {}) : /* @__PURE__ */ C(hv, {})
24152
+ children: e.showUploader ? /* @__PURE__ */ C(Ub, {}) : /* @__PURE__ */ C(hv, {})
24131
24153
  })
24132
24154
  });
24133
24155
  }
24134
- function bx(e) {
24135
- let t = e.mode ?? "modal", { t: n, rtl: r } = K(), i = r ? "rtl" : "ltr", a = vx(e.localStorage), o = t === "modal" ? e.open : !0, { isValidating: s, isValid: c, errorCode: l } = ax(e.apiKey, t === "modal" ? o : !0, a.licenseGrant), u = e.__server != null, d = hx({
24156
+ function xx(e) {
24157
+ let t = e.mode ?? "modal", { t: n, rtl: r } = K(), i = r ? "rtl" : "ltr", a = yx(e.localStorage), o = t === "modal" ? e.open : !0, { isValidating: s, isValid: c, errorCode: l } = ox(e.apiKey, t === "modal" ? o : !0, a.licenseGrant), u = e.__server != null, d = gx({
24136
24158
  enabled: !s && c && u,
24137
24159
  url: e.__server?.url ?? "",
24138
24160
  apiKey: e.apiKey,
@@ -24187,7 +24209,7 @@ function bx(e) {
24187
24209
  code: e,
24188
24210
  message: "License validation failed",
24189
24211
  source: "license"
24190
- } }), M = () => s ? A(n("dataEditor.license.loading")) : c ? u && d.status === "bootstrapping" ? A(n("dataEditor.connecting.label")) : u && d.status === "failed" ? /* @__PURE__ */ C(_v, { error: d.error }) : /* @__PURE__ */ C(yx, { ...k }) : j(l ?? "license.invalid");
24212
+ } }), M = () => s ? A(n("dataEditor.license.loading")) : c ? u && d.status === "bootstrapping" ? A(n("dataEditor.connecting.label")) : u && d.status === "failed" ? /* @__PURE__ */ C(_v, { error: d.error }) : /* @__PURE__ */ C(bx, { ...k }) : j(l ?? "license.invalid");
24191
24213
  return t === "inline" ? /* @__PURE__ */ C("div", {
24192
24214
  className: "updog__data-editor updog__data-editor-inline",
24193
24215
  dir: i,
@@ -24207,14 +24229,14 @@ function bx(e) {
24207
24229
  submitText: n("dataEditor.confirmClose.action")
24208
24230
  })] });
24209
24231
  }
24210
- function xx(e) {
24232
+ function Sx(e) {
24211
24233
  let { translations: t, rtl: n = !1, locale: r = "en", className: i, ...a } = e;
24212
24234
  return /* @__PURE__ */ C(Zr, {
24213
24235
  translations: t,
24214
24236
  rtl: n,
24215
24237
  locale: r,
24216
- children: /* @__PURE__ */ C(bx, { ...a })
24238
+ children: /* @__PURE__ */ C(xx, { ...a })
24217
24239
  });
24218
24240
  }
24219
24241
  //#endregion
24220
- export { xx as DataEditor, ou as downloadExampleFile, su as exportDataEditor };
24242
+ export { Sx as DataEditor, ou as downloadExampleFile, su as exportDataEditor };