@updog/data-editor-wc 0.1.52 → 0.1.53

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 (2) hide show
  1. package/index.js +289 -291
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -45815,7 +45815,7 @@ var gj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(ot, {
45815
45815
  return this.state.hasError ? /* @__PURE__ */ (0, O.jsx)(Dj, { error: Oj }) : this.props.children;
45816
45816
  }
45817
45817
  }, Aj = ({ leftSlot: e }) => {
45818
- let { variant: t, setShowUploader: n } = th(), { t: r } = j(), { isFirstStep: i, isLastStep: a, nextStep: o, prevStep: s, onImport: c, parsedCsv: l, xlsxFile: u, isParsing: d, isImporting: f, steps: p, activeStepIndex: m, selectedSheet: h, handleSheetConfirmed: g, remoteSourceLoading: _ } = XN(), v = i && t === "editor", b = (0, y.useCallback)(() => {
45818
+ let { variant: t, setShowUploader: n } = th(), { t: r } = j(), { isFirstStep: i, isLastStep: a, nextStep: o, prevStep: s, onImport: c, parsedCsv: l, xlsxFile: u, isParsing: d, isImporting: f, steps: p, activeStepIndex: m, selectedSheet: h, handleSheetConfirmed: g, remoteSourceLoading: _ } = ZN(), v = i && t === "editor", b = (0, y.useCallback)(() => {
45819
45819
  n(!1);
45820
45820
  }, [n]), x = p[m]?.id === "sheet-selection", S = (0, y.useCallback)(() => {
45821
45821
  a ? c() : x ? g() : o();
@@ -46584,7 +46584,7 @@ var gj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(ot, {
46584
46584
  }
46585
46585
  return i;
46586
46586
  }, Qj = () => {
46587
- let { columns: e, enableCreateColumn: t, synonyms: n } = th(), { t: r } = j(), { headers: i, columnMapping: a, updateColumnMapping: o, pendingColumns: s, setPendingColumns: c } = XN(), [l, u] = (0, y.useState)(null), d = (0, y.useRef)(null), f = (0, y.useMemo)(() => Zj(i, e, n), [
46587
+ let { columns: e, enableCreateColumn: t, synonyms: n } = th(), { t: r } = j(), { headers: i, columnMapping: a, updateColumnMapping: o, pendingColumns: s, setPendingColumns: c } = ZN(), [l, u] = (0, y.useState)(null), d = (0, y.useRef)(null), f = (0, y.useMemo)(() => Zj(i, e, n), [
46588
46588
  i,
46589
46589
  e,
46590
46590
  n
@@ -46803,99 +46803,93 @@ var tM = () => {
46803
46803
  /* @__PURE__ */ (0, O.jsx)(aM, {})
46804
46804
  ]
46805
46805
  }), sM = () => {
46806
- let { parsedCsv: e } = XN();
46806
+ let { parsedCsv: e } = ZN();
46807
46807
  return e ? /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsxs)(ah, { children: [/* @__PURE__ */ (0, O.jsx)("div", {
46808
46808
  className: "updog__step-column-matching__content updog__scrollbar",
46809
46809
  children: /* @__PURE__ */ (0, O.jsx)(eM, { children: /* @__PURE__ */ (0, O.jsx)(oM, {}) })
46810
46810
  }), /* @__PURE__ */ (0, O.jsx)(Aj, {})] }) }) : null;
46811
- }, cM = new Set([
46811
+ }, cM = .5, lM = new Set([
46812
46812
  "true",
46813
46813
  "false",
46814
46814
  "yes",
46815
46815
  "no"
46816
- ]), lM = /^\d{1,4}[-/.]\d{1,2}[-/.]\d{1,4}$/, uM = /^[-+]?(\d{1,3}([ ,.]\d{3})+|\d+)([.,]\d+)?%?$/, dM = new Set([
46816
+ ]), uM = /^\d{1,4}[-/.]\d{1,2}[-/.]\d{1,4}$/, dM = /^[-+]?(\d{1,3}([ ,.]\d{3})+|\d+)([.,]\d+)?%?$/, fM = new Set([
46817
46817
  "number",
46818
46818
  "date",
46819
46819
  "bool"
46820
46820
  ]);
46821
- function fM(e) {
46821
+ function pM(e) {
46822
46822
  if (e == null) return "empty";
46823
46823
  let t = String(e).trim();
46824
- return t.length === 0 ? "empty" : cM.has(t.toLowerCase()) ? "bool" : lM.test(t) ? "date" : uM.test(t) ? "number" : "text";
46824
+ return t.length === 0 ? "empty" : lM.has(t.toLowerCase()) ? "bool" : uM.test(t) ? "date" : dM.test(t) ? "number" : "text";
46825
46825
  }
46826
- function pM(e) {
46826
+ function mM(e) {
46827
46827
  return e.filter((e) => e != null && String(e).trim().length > 0).length;
46828
46828
  }
46829
- function mM(e) {
46829
+ function hM(e) {
46830
+ let t = 0;
46831
+ for (let n of e) t = Math.max(t, n.length);
46832
+ return t;
46833
+ }
46834
+ function gM(e) {
46830
46835
  let t = /* @__PURE__ */ new Map(), n = 0, r = 0;
46831
46836
  for (let i of e) {
46832
- let e = pM(i);
46837
+ let e = i.length;
46833
46838
  if (e === 0) continue;
46834
46839
  let a = (t.get(e) ?? 0) + 1;
46835
46840
  t.set(e, a), a > n && (n = a, r = e);
46836
46841
  }
46837
46842
  return r;
46838
46843
  }
46839
- function hM(e) {
46840
- let t = 0;
46841
- for (let n of e) t = Math.max(t, n.length);
46842
- return t;
46843
- }
46844
- function gM(e, t, n) {
46844
+ function _M(e, t, n) {
46845
46845
  if (t <= 0) return 0;
46846
- let r = -1, i = 0;
46847
- for (let a = 0; a < e.length; a++) if (pM(e[a]) === t) {
46848
- if (r < 0 && (r = a), i++, i >= n) return r;
46849
- } else r = -1, i = 0;
46850
- for (let n = 0; n < e.length; n++) if (pM(e[n]) === t) return n;
46846
+ for (let r = 0; r < e.length; r++) if (mM(e[r]) / t >= n) return r;
46851
46847
  return 0;
46852
46848
  }
46853
- function _M(e, t, n, r) {
46849
+ function vM(e, t, n, r) {
46854
46850
  let i = /* @__PURE__ */ new Map();
46855
46851
  for (let a = t; a < n; a++) {
46856
- let t = fM(e[a]?.[r]);
46852
+ let t = pM(e[a]?.[r]);
46857
46853
  t !== "empty" && i.set(t, (i.get(t) ?? 0) + 1);
46858
46854
  }
46859
46855
  let a = "empty", o = 0;
46860
46856
  for (let [e, t] of i) t > o && (o = t, a = e);
46861
46857
  return a;
46862
46858
  }
46863
- function vM(e, t, n, r) {
46859
+ function yM(e, t, n, r) {
46864
46860
  let i = 0, a = 0;
46865
46861
  for (let o = 0; o < r; o++) {
46866
- let r = _M(e, t + 1, n, o);
46867
- r !== "empty" && (a++, fM(e[t]?.[o]) === "text" && dM.has(r) && i++);
46862
+ let r = vM(e, t + 1, n, o);
46863
+ r !== "empty" && (a++, pM(e[t]?.[o]) === "text" && fM.has(r) && i++);
46868
46864
  }
46869
46865
  return a === 0 ? 0 : i / a;
46870
46866
  }
46871
- function yM(e, t, n, r) {
46867
+ function bM(e, t, n, r) {
46872
46868
  let i = 0, a = 0;
46873
46869
  for (let o = 0; o < r; o++) {
46874
- let r = _M(e, t, n, o);
46870
+ let r = vM(e, t, n, o);
46875
46871
  if (r !== "empty") for (let s = t; s < n; s++) {
46876
- let t = fM(e[s]?.[o]);
46872
+ let t = pM(e[s]?.[o]);
46877
46873
  t !== "empty" && (a++, t === r && i++);
46878
46874
  }
46879
46875
  }
46880
46876
  return a === 0 ? 0 : i / a;
46881
46877
  }
46882
- function bM(e) {
46883
- let t = e.map(fM).filter((e) => e !== "empty");
46878
+ function xM(e) {
46879
+ let t = e.map(pM).filter((e) => e !== "empty");
46884
46880
  return t.length === 0 ? 0 : 1 - t.filter((e) => e !== "text").length / t.length;
46885
46881
  }
46886
- function xM(e, t) {
46887
- if (t <= 0) return 0;
46888
- let n = pM(e);
46889
- return Math.max(0, 1 - Math.abs(n - t) / t);
46882
+ function SM(e, t) {
46883
+ return t <= 0 ? 0 : Math.min(1, mM(e) / t);
46890
46884
  }
46891
- function SM(e) {
46885
+ function CM(e) {
46892
46886
  let t = e.map((e) => String(e ?? "").trim().toLowerCase()).filter((e) => e.length > 0);
46893
46887
  return t.length === 0 ? 0 : new Set(t).size / t.length;
46894
46888
  }
46895
- function CM(e, t, n, r, i) {
46896
- return .45 * vM(e, t, n, r) + .25 * yM(e, t + 1, n, r) + .15 * bM(e[t] ?? []) + .1 * xM(e[t] ?? [], i) + .05 * SM(e[t] ?? []);
46889
+ function wM(e, t, n, r, i) {
46890
+ return .45 * yM(e, t, n, r) + .25 * bM(e, t + 1, n, r) + .15 * xM(e[t] ?? []) + .1 * SM(e[t] ?? [], i) + .05 * CM(e[t] ?? []);
46897
46891
  }
46898
- function wM(e, t = 100) {
46892
+ function TM(e, t = 100) {
46899
46893
  if (e.length === 0) return {
46900
46894
  headerRowIndex: 0,
46901
46895
  dataStartIndex: 0,
@@ -46903,7 +46897,7 @@ function wM(e, t = 100) {
46903
46897
  mode: "header",
46904
46898
  review: { kind: "none" }
46905
46899
  };
46906
- let n = Math.min(t, e.length), r = e.slice(0, n), i = hM(r), a = mM(r), o = gM(r, a, 3), s = e[o] ?? [], c = vM(e, o, n, i), l = yM(e, o + 1, n, i), u = pM(s) > 0 && bM(s) === 0, d = Math.round(Math.max(0, CM(e, o, n, i, a)) * 100) / 100;
46900
+ let n = Math.min(t, e.length), r = e.slice(0, n), i = hM(r), a = gM(r), o = _M(r, a, cM), s = e[o] ?? [], c = yM(e, o, n, i), l = bM(e, o + 1, n, i), u = mM(s) > 0 && xM(s) === 0, d = Math.round(Math.max(0, wM(e, o, n, i, a)) * 100) / 100;
46907
46901
  if (u && c <= .15 && l >= .7) return {
46908
46902
  headerRowIndex: -1,
46909
46903
  dataStartIndex: o,
@@ -46923,7 +46917,7 @@ function wM(e, t = 100) {
46923
46917
  review: f
46924
46918
  };
46925
46919
  }
46926
- function TM(e) {
46920
+ function EM(e) {
46927
46921
  let t = /* @__PURE__ */ new Set();
46928
46922
  return e.map((e) => {
46929
46923
  let n = e, r = 2;
@@ -46933,7 +46927,7 @@ function TM(e) {
46933
46927
  }
46934
46928
  //#endregion
46935
46929
  //#region src/components/DataUploader/components/StepHeaderSelection/context/useViewModel.tsx
46936
- function EM(e, t, n, r) {
46930
+ function DM(e, t, n, r) {
46937
46931
  return (0, y.useMemo)(() => ({
46938
46932
  sample: e,
46939
46933
  selectedRow: t,
@@ -46948,20 +46942,20 @@ function EM(e, t, n, r) {
46948
46942
  }
46949
46943
  //#endregion
46950
46944
  //#region src/components/DataUploader/components/StepHeaderSelection/context/index.tsx
46951
- var DM = (0, y.createContext)(null);
46952
- function OM({ sample: e, selectedRow: t, selectRow: n, noHeader: r, children: i }) {
46953
- let a = EM(e, t, n, r);
46954
- return /* @__PURE__ */ (0, O.jsx)(DM.Provider, {
46945
+ var OM = (0, y.createContext)(null);
46946
+ function kM({ sample: e, selectedRow: t, selectRow: n, noHeader: r, children: i }) {
46947
+ let a = DM(e, t, n, r);
46948
+ return /* @__PURE__ */ (0, O.jsx)(OM.Provider, {
46955
46949
  value: a,
46956
46950
  children: i
46957
46951
  });
46958
46952
  }
46959
- var kM = () => {
46960
- let e = (0, y.useContext)(DM);
46953
+ var AM = () => {
46954
+ let e = (0, y.useContext)(OM);
46961
46955
  if (!e) throw Error("useHeaderSelection must be used within HeaderSelectionProvider");
46962
46956
  return e;
46963
- }, AM = () => {
46964
- let { sample: e, selectedRow: t, selectRow: n, noHeader: r } = kM(), { headers: i } = XN(), { headers: a, rows: o } = (0, y.useMemo)(() => {
46957
+ }, jM = () => {
46958
+ let { sample: e, selectedRow: t, selectRow: n, noHeader: r } = AM(), { headers: i } = ZN(), { headers: a, rows: o } = (0, y.useMemo)(() => {
46965
46959
  let t = i.length;
46966
46960
  return {
46967
46961
  headers: i.map((e) => r ? e : ""),
@@ -46981,13 +46975,13 @@ var kM = () => {
46981
46975
  selectedRow: r ? void 0 : t,
46982
46976
  onSelectRow: r ? void 0 : n
46983
46977
  });
46984
- }, jM = () => {
46985
- let { t: e } = j(), { parsedCsv: t, headerRowIndex: n, setHeaderRowIndex: r } = XN(), i = (0, y.useCallback)((e) => {
46978
+ }, MM = () => {
46979
+ let { t: e } = j(), { parsedCsv: t, headerRowIndex: n, setHeaderRowIndex: r } = ZN(), i = (0, y.useCallback)((e) => {
46986
46980
  r(e ? -1 : Math.max(0, t?.detection.headerRowIndex ?? 0));
46987
46981
  }, [r, t]);
46988
46982
  if (!t) return null;
46989
46983
  let a = t.rawRows.slice(0, 50), o = n < 0;
46990
- return /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsx)(ah, { children: /* @__PURE__ */ (0, O.jsxs)(OM, {
46984
+ return /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsx)(ah, { children: /* @__PURE__ */ (0, O.jsxs)(kM, {
46991
46985
  sample: a,
46992
46986
  selectedRow: o ? void 0 : n,
46993
46987
  selectRow: r,
@@ -47001,10 +46995,10 @@ var kM = () => {
47001
46995
  onChange: i,
47002
46996
  label: e("dataEditor.uploader.headerSelection.noHeaderLabel")
47003
46997
  })
47004
- }), /* @__PURE__ */ (0, O.jsx)(AM, {})]
46998
+ }), /* @__PURE__ */ (0, O.jsx)(jM, {})]
47005
46999
  }), /* @__PURE__ */ (0, O.jsx)(Aj, {})]
47006
47000
  }) }) });
47007
- }, MM = ({ open: e, existingOptions: t, initialName: n, onClose: r, onSubmit: i }) => {
47001
+ }, NM = ({ open: e, existingOptions: t, initialName: n, onClose: r, onSubmit: i }) => {
47008
47002
  let { t: a } = j();
47009
47003
  return /* @__PURE__ */ (0, O.jsx)(vs, {
47010
47004
  open: e,
@@ -47017,13 +47011,13 @@ var kM = () => {
47017
47011
  onSubmit: i
47018
47012
  })
47019
47013
  });
47020
- }, NM = [
47014
+ }, PM = [
47021
47015
  ",",
47022
47016
  ";",
47023
47017
  "|",
47024
47018
  "\n",
47025
47019
  " "
47026
- ], PM = (e, t, n) => {
47020
+ ], FM = (e, t, n) => {
47027
47021
  let r = new Set(n.map((e) => e.trim().toLowerCase())), i = (e) => r.has(e.trim().toLowerCase());
47028
47022
  if (e.trim() === "") return [];
47029
47023
  if (i(e)) return [e.trim()];
@@ -47035,31 +47029,31 @@ var kM = () => {
47035
47029
  a.push(e);
47036
47030
  continue;
47037
47031
  }
47038
- a.push(...FM(e, t, i));
47032
+ a.push(...IM(e, t, i));
47039
47033
  }
47040
47034
  }
47041
47035
  return a;
47042
- }, FM = (e, t, n) => {
47043
- for (let r of NM) {
47036
+ }, IM = (e, t, n) => {
47037
+ for (let r of PM) {
47044
47038
  if (r === t || !e.includes(r)) continue;
47045
47039
  let i = e.split(r).map((e) => e.trim()).filter((e) => e !== "");
47046
47040
  if (i.length >= 2 && i.every(n)) return i;
47047
47041
  }
47048
47042
  return [e];
47049
- }, IM = (e, t, n) => {
47043
+ }, LM = (e, t, n) => {
47050
47044
  let r = /* @__PURE__ */ new Set();
47051
- for (let i of e) if (i !== "") if (n) for (let e of PM(i, n, t)) r.add(e);
47045
+ for (let i of e) if (i !== "") if (n) for (let e of FM(i, n, t)) r.add(e);
47052
47046
  else r.add(i);
47053
47047
  return [...r];
47054
- }, LM = (e) => !e.some((e) => e != null && String(e).trim() !== ""), RM = (e, t) => {
47048
+ }, RM = (e) => !e.some((e) => e != null && String(e).trim() !== ""), zM = (e, t) => {
47055
47049
  let n = 0;
47056
47050
  for (let r = t; r < e.length; r++) n = Math.max(n, e[r].length);
47057
47051
  return n;
47058
- }, zM = 50, BM = (e, t, n) => {
47059
- let r = Math.min(e.length, t + zM);
47052
+ }, BM = 50, VM = (e, t, n) => {
47053
+ let r = Math.min(e.length, t + BM);
47060
47054
  for (let i = t; i < r; i++) {
47061
47055
  let t = e[i];
47062
- if (!t || LM(t)) continue;
47056
+ if (!t || RM(t)) continue;
47063
47057
  let r = !0;
47064
47058
  for (let e = 0; e < n; e++) {
47065
47059
  let n = t[e];
@@ -47073,60 +47067,64 @@ var kM = () => {
47073
47067
  return Array.from({ length: n }, (n, i) => {
47074
47068
  for (let n = t; n < r; n++) {
47075
47069
  let t = e[n];
47076
- if (!t || LM(t)) continue;
47070
+ if (!t || RM(t)) continue;
47077
47071
  let r = t[i], a = r == null ? "" : String(r).trim();
47078
47072
  if (a !== "") return a;
47079
47073
  }
47080
47074
  return "";
47081
47075
  });
47082
- }, VM = (e, t) => t === e.headerRowIndex ? e.dataStartIndex : t + 1, HM = (e, t, n, r) => {
47076
+ }, HM = (e, t) => t === e.headerRowIndex ? e.dataStartIndex : t + 1, UM = (e, t, n, r) => {
47083
47077
  if (t < 0) {
47084
- let t = RM(e, n), i = BM(e, n, t);
47078
+ let t = zM(e, n), i = VM(e, n, t);
47085
47079
  return Array.from({ length: t }, (e, t) => r(t, i[t]));
47086
47080
  }
47087
- return TM((e[t] ?? []).map((e) => String(e ?? "").trim()));
47088
- }, UM = () => ({
47081
+ let i = e[t] ?? [], a = Math.max(i.length, zM(e, n)), o = VM(e, n, a);
47082
+ return EM(Array.from({ length: a }, (e, t) => {
47083
+ let n = String(i[t] ?? "").trim();
47084
+ return n === "" ? r(t, o[t]) : n;
47085
+ }));
47086
+ }, WM = () => ({
47089
47087
  headerRowIndex: 0,
47090
47088
  dataStartIndex: 1,
47091
47089
  confidence: 1,
47092
47090
  mode: "header",
47093
47091
  review: { kind: "none" }
47094
- }), WM = (e, t) => {
47092
+ }), GM = (e, t) => {
47095
47093
  let n = [e];
47096
47094
  for (let r of t) n.push(e.map((e) => r[e] ?? ""));
47097
47095
  return n;
47098
- }, GM = (e) => {
47096
+ }, KM = (e) => {
47099
47097
  let t = /* @__PURE__ */ new Map();
47100
47098
  for (let n = 0; n < e.length; n++) t.set(e[n], n);
47101
47099
  return t;
47102
- }, KM = (e, t, n) => {
47100
+ }, qM = (e, t, n) => {
47103
47101
  let r = [];
47104
47102
  for (let i = t; i < e.length; i++) {
47105
47103
  let t = e[i];
47106
- if (LM(t)) continue;
47104
+ if (RM(t)) continue;
47107
47105
  let a = t[n], o = a == null ? "" : String(a);
47108
47106
  o !== "" && r.push(o);
47109
47107
  }
47110
47108
  return r;
47111
- }, qM = (e, t) => {
47109
+ }, JM = (e, t) => {
47112
47110
  let n = {};
47113
47111
  for (let r = 0; r < t.length; r++) n[t[r]] = String(e[r] ?? "");
47114
47112
  return n;
47115
- }, JM = (e, t, n, r) => {
47113
+ }, YM = (e, t, n, r) => {
47116
47114
  let i = [];
47117
- for (let a = n; a < e.length && i.length < r; a++) LM(e[a]) || i.push(qM(e[a], t));
47115
+ for (let a = n; a < e.length && i.length < r; a++) RM(e[a]) || i.push(JM(e[a], t));
47118
47116
  return i;
47119
- }, YM = () => {
47120
- let { columns: e } = th(), { t } = j(), { parsedCsv: n, headers: r, dataStartIndex: i, columnMapping: a, valueMapping: o, autoValueMapping: s, updateValueMapping: c, multiselectDelimiters: l, setMultiselectDelimiter: u, reapplyMultiselectDelimiter: d, pendingOptions: f, addPendingOption: p } = XN(), [m, h] = (0, y.useState)({}), [g, _] = (0, y.useState)({}), [v, b] = (0, y.useState)(null), x = (0, y.useRef)(!1), S = (0, y.useMemo)(() => {
47117
+ }, XM = () => {
47118
+ let { columns: e } = th(), { t } = j(), { parsedCsv: n, headers: r, dataStartIndex: i, columnMapping: a, valueMapping: o, autoValueMapping: s, updateValueMapping: c, multiselectDelimiters: l, setMultiselectDelimiter: u, reapplyMultiselectDelimiter: d, pendingOptions: f, addPendingOption: p } = ZN(), [m, h] = (0, y.useState)({}), [g, _] = (0, y.useState)({}), [v, b] = (0, y.useState)(null), x = (0, y.useRef)(!1), S = (0, y.useMemo)(() => {
47121
47119
  if (!n) return [];
47122
- let t = [], s = GM(r);
47120
+ let t = [], s = KM(r);
47123
47121
  for (let [r, c] of Object.entries(a)) {
47124
47122
  if (!c) continue;
47125
47123
  let a = e.find((e) => e.id === c);
47126
47124
  if (!a?.editor) continue;
47127
47125
  let u = a.editor.type;
47128
47126
  if (u !== "select" && u !== "multiselect") continue;
47129
- let d = a.editor.options, f = o[c] ?? {}, p = u === "multiselect", m = p ? l[c] ?? null : null, h = s.get(r), g = IM(h === void 0 ? [] : KM(n.rawRows, i, h), d, m).map((e) => ({
47127
+ let d = a.editor.options, f = o[c] ?? {}, p = u === "multiselect", m = p ? l[c] ?? null : null, h = s.get(r), g = LM(h === void 0 ? [] : qM(n.rawRows, i, h), d, m).map((e) => ({
47130
47128
  imported: e,
47131
47129
  mapped: f[e]
47132
47130
  }));
@@ -47249,20 +47247,20 @@ var kM = () => {
47249
47247
  submitCreate: F,
47250
47248
  closeCreate: I
47251
47249
  };
47252
- }, XM = (0, y.createContext)(null);
47253
- function ZM({ children: e }) {
47254
- let t = YM();
47255
- return /* @__PURE__ */ (0, O.jsx)(XM.Provider, {
47250
+ }, ZM = (0, y.createContext)(null);
47251
+ function QM({ children: e }) {
47252
+ let t = XM();
47253
+ return /* @__PURE__ */ (0, O.jsx)(ZM.Provider, {
47256
47254
  value: t,
47257
47255
  children: e
47258
47256
  });
47259
47257
  }
47260
- var QM = () => {
47261
- let e = (0, y.useContext)(XM);
47258
+ var $M = () => {
47259
+ let e = (0, y.useContext)(ZM);
47262
47260
  if (!e) throw Error("useValueMatching must be used within ValueMatchingProvider");
47263
47261
  return e;
47264
- }, $M = ({ section: e }) => {
47265
- let { t } = j(), { isShowMatched: n, isCollapsed: r, setShowMatched: i, toggleCollapsed: a } = QM(), o = r(e.columnId), s = t(o ? "dataEditor.common.expand" : "dataEditor.common.collapse"), c = (0, y.useCallback)((t) => i(e.columnId, t), [i, e.columnId]), l = (0, y.useCallback)(() => a(e.columnId), [a, e.columnId]);
47262
+ }, eN = ({ section: e }) => {
47263
+ let { t } = j(), { isShowMatched: n, isCollapsed: r, setShowMatched: i, toggleCollapsed: a } = $M(), o = r(e.columnId), s = t(o ? "dataEditor.common.expand" : "dataEditor.common.collapse"), c = (0, y.useCallback)((t) => i(e.columnId, t), [i, e.columnId]), l = (0, y.useCallback)(() => a(e.columnId), [a, e.columnId]);
47266
47264
  return /* @__PURE__ */ (0, O.jsxs)("header", {
47267
47265
  className: "updog__value-matching__section-header",
47268
47266
  children: [/* @__PURE__ */ (0, O.jsx)("div", {
@@ -47306,14 +47304,14 @@ var QM = () => {
47306
47304
  })
47307
47305
  })]
47308
47306
  });
47309
- }, eN = {
47307
+ }, tN = {
47310
47308
  ",": ",",
47311
47309
  ";": ";",
47312
47310
  "|": "|",
47313
47311
  "\n": "\\n",
47314
47312
  " ": "\\t"
47315
- }, tN = (e) => e === null ? "" : eN[e] ?? e, nN = ({ section: e }) => {
47316
- let { t } = j(), { changeDelimiter: n, reapplyDelimiter: r } = QM(), i = (0, y.useRef)(e.delimiter), a = tN(e.delimiter), [o, s] = (0, y.useState)(a), { debouncedValue: c } = gc(o, 300), l = (0, y.useRef)(a);
47313
+ }, nN = (e) => e === null ? "" : tN[e] ?? e, rN = ({ section: e }) => {
47314
+ let { t } = j(), { changeDelimiter: n, reapplyDelimiter: r } = $M(), i = (0, y.useRef)(e.delimiter), a = nN(e.delimiter), [o, s] = (0, y.useState)(a), { debouncedValue: c } = gc(o, 300), l = (0, y.useRef)(a);
47317
47315
  (0, y.useEffect)(() => {
47318
47316
  s(a), l.current = a;
47319
47317
  }, [a]), (0, y.useEffect)(() => {
@@ -47356,8 +47354,8 @@ var QM = () => {
47356
47354
  })
47357
47355
  ]
47358
47356
  });
47359
- }, rN = ({ section: e, val: t }) => {
47360
- let { t: n } = j(), { getSelectOptions: r, selectValue: i } = QM(), a = t.mapped === void 0, o = (0, y.useCallback)((n) => i(e.columnId, t.imported, n), [
47357
+ }, iN = ({ section: e, val: t }) => {
47358
+ let { t: n } = j(), { getSelectOptions: r, selectValue: i } = $M(), a = t.mapped === void 0, o = (0, y.useCallback)((n) => i(e.columnId, t.imported, n), [
47361
47359
  i,
47362
47360
  e.columnId,
47363
47361
  t.imported
@@ -47409,8 +47407,8 @@ var QM = () => {
47409
47407
  })
47410
47408
  ]
47411
47409
  });
47412
- }, iN = ({ section: e }) => {
47413
- let { t } = j(), { getVisibleValues: n } = QM(), r = n(e);
47410
+ }, aN = ({ section: e }) => {
47411
+ let { t } = j(), { getVisibleValues: n } = $M(), r = n(e);
47414
47412
  return /* @__PURE__ */ (0, O.jsxs)("div", {
47415
47413
  className: "updog__value-matching__table",
47416
47414
  children: [r.length === 0 ? /* @__PURE__ */ (0, O.jsx)("div", {
@@ -47430,7 +47428,7 @@ var QM = () => {
47430
47428
  size: "sm",
47431
47429
  weight: "medium",
47432
47430
  children: t("dataEditor.uploader.matchValues.importedValues")
47433
- }), e.isMultiselect && /* @__PURE__ */ (0, O.jsx)(nN, { section: e })]
47431
+ }), e.isMultiselect && /* @__PURE__ */ (0, O.jsx)(rN, { section: e })]
47434
47432
  }),
47435
47433
  /* @__PURE__ */ (0, O.jsx)("div", { className: "updog__value-matching__arrow-spacer" }),
47436
47434
  /* @__PURE__ */ (0, O.jsx)(W, {
@@ -47442,25 +47440,25 @@ var QM = () => {
47442
47440
  }),
47443
47441
  /* @__PURE__ */ (0, O.jsx)("div", { className: "updog__value-matching__action" })
47444
47442
  ]
47445
- }), r.map((t) => /* @__PURE__ */ (0, O.jsx)(rN, {
47443
+ }), r.map((t) => /* @__PURE__ */ (0, O.jsx)(iN, {
47446
47444
  section: e,
47447
47445
  val: t
47448
47446
  }, t.imported))]
47449
47447
  });
47450
- }, aN = ({ section: e }) => {
47451
- let { isCollapsed: t } = QM(), n = !t(e.columnId);
47448
+ }, oN = ({ section: e }) => {
47449
+ let { isCollapsed: t } = $M(), n = !t(e.columnId);
47452
47450
  return /* @__PURE__ */ (0, O.jsxs)("div", {
47453
47451
  className: "updog__value-matching__section",
47454
- children: [/* @__PURE__ */ (0, O.jsx)($M, { section: e }), /* @__PURE__ */ (0, O.jsx)("div", {
47452
+ children: [/* @__PURE__ */ (0, O.jsx)(eN, { section: e }), /* @__PURE__ */ (0, O.jsx)("div", {
47455
47453
  className: N("updog__value-matching__collapsible", n && "updog__value-matching__collapsible--expanded"),
47456
- children: /* @__PURE__ */ (0, O.jsx)(iN, { section: e })
47454
+ children: /* @__PURE__ */ (0, O.jsx)(aN, { section: e })
47457
47455
  })]
47458
47456
  });
47459
- }, oN = () => {
47460
- let { sections: e, hasCreateTarget: t, createForOptions: n, createInitialName: r, submitCreate: i, closeCreate: a } = QM();
47457
+ }, sN = () => {
47458
+ let { sections: e, hasCreateTarget: t, createForOptions: n, createInitialName: r, submitCreate: i, closeCreate: a } = $M();
47461
47459
  return /* @__PURE__ */ (0, O.jsxs)("div", {
47462
47460
  className: "updog__value-matching",
47463
- children: [e.map((e) => /* @__PURE__ */ (0, O.jsx)(aN, { section: e }, e.columnId)), t && /* @__PURE__ */ (0, O.jsx)(MM, {
47461
+ children: [e.map((e) => /* @__PURE__ */ (0, O.jsx)(oN, { section: e }, e.columnId)), t && /* @__PURE__ */ (0, O.jsx)(NM, {
47464
47462
  open: !0,
47465
47463
  existingOptions: n,
47466
47464
  initialName: r,
@@ -47468,15 +47466,15 @@ var QM = () => {
47468
47466
  onSubmit: i
47469
47467
  })]
47470
47468
  });
47471
- }, sN = () => /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsxs)(ah, { children: [/* @__PURE__ */ (0, O.jsx)("div", {
47469
+ }, cN = () => /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsxs)(ah, { children: [/* @__PURE__ */ (0, O.jsx)("div", {
47472
47470
  className: "updog__step-match-values__content updog__scrollbar",
47473
- children: /* @__PURE__ */ (0, O.jsx)(ZM, { children: /* @__PURE__ */ (0, O.jsx)(oN, {}) })
47474
- }), /* @__PURE__ */ (0, O.jsx)(Aj, {})] }) }), cN = 20, lN = () => {
47475
- let { store: e } = th(), { t } = j(), { primaryKey: n, onPrimaryKeyChange: r, parsedCsv: i, headers: a, dataStartIndex: o, columnMapping: s, primaryKeyColumns: c } = XN(), l = e.isClient(), u = (0, y.useCallback)(() => r(null), [r]), d = (0, y.useMemo)(() => {
47471
+ children: /* @__PURE__ */ (0, O.jsx)(QM, { children: /* @__PURE__ */ (0, O.jsx)(sN, {}) })
47472
+ }), /* @__PURE__ */ (0, O.jsx)(Aj, {})] }) }), lN = 20, uN = () => {
47473
+ let { store: e } = th(), { t } = j(), { primaryKey: n, onPrimaryKeyChange: r, parsedCsv: i, headers: a, dataStartIndex: o, columnMapping: s, primaryKeyColumns: c } = ZN(), l = e.isClient(), u = (0, y.useCallback)(() => r(null), [r]), d = (0, y.useMemo)(() => {
47476
47474
  let e = {};
47477
47475
  for (let [t, n] of Object.entries(s)) n && (e[n] = t);
47478
47476
  return e;
47479
- }, [s]), f = (0, y.useMemo)(() => i ? JM(i.rawRows, a, o, cN) : [], [
47477
+ }, [s]), f = (0, y.useMemo)(() => i ? YM(i.rawRows, a, o, lN) : [], [
47480
47478
  i,
47481
47479
  a,
47482
47480
  o
@@ -47528,8 +47526,8 @@ var QM = () => {
47528
47526
  }, e.id);
47529
47527
  })]
47530
47528
  });
47531
- }, uN = () => /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsxs)(ah, { children: [/* @__PURE__ */ (0, O.jsx)(lN, {}), /* @__PURE__ */ (0, O.jsx)(Aj, {})] }) }), dN = () => {
47532
- let { columns: e, importFormats: t, remoteSources: n, sampleData: r } = th(), i = t === !1 ? [] : t, { t: a } = j(), { parsedCsv: o, xlsxFile: s, handleFileRemoved: c, parseFile: l, isParsing: u, remoteSourceLoading: d, remoteSourceError: f, handleRemoteSourceSelect: p } = XN(), m = [
47529
+ }, dN = () => /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsxs)(ah, { children: [/* @__PURE__ */ (0, O.jsx)(uN, {}), /* @__PURE__ */ (0, O.jsx)(Aj, {})] }) }), fN = () => {
47530
+ let { columns: e, importFormats: t, remoteSources: n, sampleData: r } = th(), i = t === !1 ? [] : t, { t: a } = j(), { parsedCsv: o, xlsxFile: s, handleFileRemoved: c, parseFile: l, isParsing: u, remoteSourceLoading: d, remoteSourceError: f, handleRemoteSourceSelect: p } = ZN(), m = [
47533
47531
  {
47534
47532
  id: "csv",
47535
47533
  format: "csv",
@@ -47587,20 +47585,20 @@ var QM = () => {
47587
47585
  }, [c]),
47588
47586
  handleRemoteSourceSelect: p
47589
47587
  };
47590
- }, fN = (0, y.createContext)(null);
47591
- function pN({ children: e }) {
47592
- let t = dN();
47593
- return /* @__PURE__ */ (0, O.jsx)(fN.Provider, {
47588
+ }, pN = (0, y.createContext)(null);
47589
+ function mN({ children: e }) {
47590
+ let t = fN();
47591
+ return /* @__PURE__ */ (0, O.jsx)(pN.Provider, {
47594
47592
  value: t,
47595
47593
  children: e
47596
47594
  });
47597
47595
  }
47598
- var mN = () => {
47599
- let e = (0, y.useContext)(fN);
47596
+ var hN = () => {
47597
+ let e = (0, y.useContext)(pN);
47600
47598
  if (!e) throw Error("useSelectFiles must be used within SelectFilesProvider");
47601
47599
  return e;
47602
- }, hN = () => {
47603
- let { t: e } = j(), { exampleMenuOptions: t, onExampleDownload: n } = mN();
47600
+ }, gN = () => {
47601
+ let { t: e } = j(), { exampleMenuOptions: t, onExampleDownload: n } = hN();
47604
47602
  return /* @__PURE__ */ (0, O.jsx)(fc, {
47605
47603
  options: t,
47606
47604
  onSelect: n,
@@ -47612,7 +47610,7 @@ var mN = () => {
47612
47610
  children: e("dataEditor.uploader.uploadFile.downloadExample")
47613
47611
  })
47614
47612
  });
47615
- }, gN = ({ source: e }) => e.icon.trimStart().startsWith("<") ? /* @__PURE__ */ (0, O.jsx)("span", {
47613
+ }, _N = ({ source: e }) => e.icon.trimStart().startsWith("<") ? /* @__PURE__ */ (0, O.jsx)("span", {
47616
47614
  className: "updog__remote-source-btn__icon",
47617
47615
  dangerouslySetInnerHTML: { __html: e.icon }
47618
47616
  }) : /* @__PURE__ */ (0, O.jsx)("span", {
@@ -47621,7 +47619,7 @@ var mN = () => {
47621
47619
  src: e.icon,
47622
47620
  alt: e.label
47623
47621
  })
47624
- }), _N = ({ source: e, loading: t, disabled: n, onSelect: r }) => /* @__PURE__ */ (0, O.jsx)(ot, {
47622
+ }), vN = ({ source: e, loading: t, disabled: n, onSelect: r }) => /* @__PURE__ */ (0, O.jsx)(ot, {
47625
47623
  variant: "filled",
47626
47624
  color: "neutral",
47627
47625
  size: "sm",
@@ -47631,11 +47629,11 @@ var mN = () => {
47631
47629
  disabled: !t && n,
47632
47630
  loading: t,
47633
47631
  spinnerPosition: "start",
47634
- startIcon: /* @__PURE__ */ (0, O.jsx)(gN, { source: e }),
47632
+ startIcon: /* @__PURE__ */ (0, O.jsx)(_N, { source: e }),
47635
47633
  title: e.description,
47636
47634
  children: e.label
47637
- }), vN = () => {
47638
- let { t: e } = j(), { importFormats: t, remoteSources: n, remoteSourceLoading: r, remoteSourceError: i, handleRemoteSourceSelect: a } = mN(), o = n.length > 0;
47635
+ }), yN = () => {
47636
+ let { t: e } = j(), { importFormats: t, remoteSources: n, remoteSourceLoading: r, remoteSourceError: i, handleRemoteSourceSelect: a } = hN(), o = n.length > 0;
47639
47637
  return /* @__PURE__ */ (0, O.jsxs)("div", {
47640
47638
  className: "updog__source-picker",
47641
47639
  children: [
@@ -47662,7 +47660,7 @@ var mN = () => {
47662
47660
  }),
47663
47661
  o && /* @__PURE__ */ (0, O.jsxs)(O.Fragment, { children: [/* @__PURE__ */ (0, O.jsx)(ac, {}), /* @__PURE__ */ (0, O.jsx)("div", {
47664
47662
  className: "updog__source-picker__sources-list",
47665
- children: n.map((e) => /* @__PURE__ */ (0, O.jsx)(_N, {
47663
+ children: n.map((e) => /* @__PURE__ */ (0, O.jsx)(vN, {
47666
47664
  source: e,
47667
47665
  loading: r === e.id,
47668
47666
  disabled: !!r,
@@ -47676,7 +47674,7 @@ var mN = () => {
47676
47674
  })
47677
47675
  ]
47678
47676
  });
47679
- }, yN = () => {
47677
+ }, bN = () => {
47680
47678
  let { t: e } = j();
47681
47679
  return /* @__PURE__ */ (0, O.jsxs)("div", {
47682
47680
  className: "updog__uploading-state",
@@ -47689,12 +47687,12 @@ var mN = () => {
47689
47687
  children: e("dataEditor.uploader.uploadFile.uploading")
47690
47688
  })]
47691
47689
  });
47692
- }, bN = () => {
47693
- let { t: e } = j(), { isBlocked: t, isParsing: n, hasFile: r, fileName: i, open: a, onRemoveClick: o } = mN();
47690
+ }, xN = () => {
47691
+ let { t: e } = j(), { isBlocked: t, isParsing: n, hasFile: r, fileName: i, open: a, onRemoveClick: o } = hN();
47694
47692
  return /* @__PURE__ */ (0, O.jsx)("div", {
47695
47693
  className: N("updog__step-select-files__upload-area", t && "updog__step-select-files__upload-area--disabled"),
47696
47694
  onClick: t ? void 0 : a,
47697
- children: n ? /* @__PURE__ */ (0, O.jsx)(yN, {}) : /* @__PURE__ */ (0, O.jsxs)(O.Fragment, { children: [
47695
+ children: n ? /* @__PURE__ */ (0, O.jsx)(bN, {}) : /* @__PURE__ */ (0, O.jsxs)(O.Fragment, { children: [
47698
47696
  /* @__PURE__ */ (0, O.jsx)("div", {
47699
47697
  className: "updog__step-select-files__icon-container",
47700
47698
  children: r ? /* @__PURE__ */ (0, O.jsx)(oe, {
@@ -47705,7 +47703,7 @@ var mN = () => {
47705
47703
  className: "updog__step-select-files__icon"
47706
47704
  })
47707
47705
  }),
47708
- !r && /* @__PURE__ */ (0, O.jsx)(vN, {}),
47706
+ !r && /* @__PURE__ */ (0, O.jsx)(yN, {}),
47709
47707
  r && /* @__PURE__ */ (0, O.jsxs)("div", {
47710
47708
  className: "updog__step-select-files__info",
47711
47709
  children: [/* @__PURE__ */ (0, O.jsx)(W, {
@@ -47722,19 +47720,19 @@ var mN = () => {
47722
47720
  })
47723
47721
  ] })
47724
47722
  });
47725
- }, xN = () => {
47726
- let { getRootProps: e, getInputProps: t, isDragActive: n } = mN();
47723
+ }, SN = () => {
47724
+ let { getRootProps: e, getInputProps: t, isDragActive: n } = hN();
47727
47725
  return /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsxs)("div", {
47728
47726
  className: "updog__step-select-files__dropzone",
47729
47727
  ...e(),
47730
47728
  children: [
47731
47729
  /* @__PURE__ */ (0, O.jsx)("input", { ...t() }),
47732
- /* @__PURE__ */ (0, O.jsxs)(ah, { children: [/* @__PURE__ */ (0, O.jsx)(bN, {}), /* @__PURE__ */ (0, O.jsx)(Aj, { leftSlot: /* @__PURE__ */ (0, O.jsx)(hN, {}) })] }),
47730
+ /* @__PURE__ */ (0, O.jsxs)(ah, { children: [/* @__PURE__ */ (0, O.jsx)(xN, {}), /* @__PURE__ */ (0, O.jsx)(Aj, { leftSlot: /* @__PURE__ */ (0, O.jsx)(gN, {}) })] }),
47733
47731
  n && /* @__PURE__ */ (0, O.jsx)(oh, {})
47734
47732
  ]
47735
47733
  }) });
47736
- }, SN = () => /* @__PURE__ */ (0, O.jsx)(pN, { children: /* @__PURE__ */ (0, O.jsx)(xN, {}) }), CN = ({ preview: e }) => {
47737
- let { selectedSheet: t, setSelectedSheet: n } = XN(), { t: r } = j(), i = Math.max(0, e.totalRows), a = t === e.name, o = (0, y.useMemo)(() => {
47734
+ }, CN = () => /* @__PURE__ */ (0, O.jsx)(mN, { children: /* @__PURE__ */ (0, O.jsx)(SN, {}) }), wN = ({ preview: e }) => {
47735
+ let { selectedSheet: t, setSelectedSheet: n } = ZN(), { t: r } = j(), i = Math.max(0, e.totalRows), a = t === e.name, o = (0, y.useMemo)(() => {
47738
47736
  let { headers: t, rows: n } = e;
47739
47737
  return [t, ...n.map((e) => t.map((t) => e[t] ?? ""))];
47740
47738
  }, [e]);
@@ -47770,16 +47768,16 @@ var mN = () => {
47770
47768
  })]
47771
47769
  })
47772
47770
  });
47773
- }, wN = () => {
47774
- let { sheetPreviews: e } = XN();
47771
+ }, TN = () => {
47772
+ let { sheetPreviews: e } = ZN();
47775
47773
  return /* @__PURE__ */ (0, O.jsx)(sh, { children: /* @__PURE__ */ (0, O.jsxs)(ah, { children: [/* @__PURE__ */ (0, O.jsx)("div", {
47776
47774
  className: "updog__sheet-preview-wrapper updog__scrollbar",
47777
47775
  children: /* @__PURE__ */ (0, O.jsx)("div", {
47778
47776
  className: "updog__sheet-preview-grid",
47779
- children: e.map((e) => /* @__PURE__ */ (0, O.jsx)(CN, { preview: e }, e.name))
47777
+ children: e.map((e) => /* @__PURE__ */ (0, O.jsx)(wN, { preview: e }, e.name))
47780
47778
  })
47781
47779
  }), /* @__PURE__ */ (0, O.jsx)(Aj, {})] }) });
47782
- }, TN = (e, t, n) => {
47780
+ }, EN = (e, t, n) => {
47783
47781
  let r = new Map(t.map((e) => [e.id, e])), i = [];
47784
47782
  for (let [t, a] of Object.entries(e)) a && i.push({
47785
47783
  csvHeader: t,
@@ -47787,11 +47785,11 @@ var mN = () => {
47787
47785
  column: n.has(a) ? void 0 : r.get(a)
47788
47786
  });
47789
47787
  return i;
47790
- }, EN = (e) => {
47788
+ }, DN = (e) => {
47791
47789
  let t = [];
47792
47790
  for (let { csvHeader: n, column: r } of e) r?.editor?.type === "number" && t.push(n);
47793
47791
  return t;
47794
- }, DN = (e, t, n) => {
47792
+ }, ON = (e, t, n) => {
47795
47793
  let r = {};
47796
47794
  for (let { csvHeader: i, columnId: a, column: o } of t) {
47797
47795
  let t = e[i] ?? "";
@@ -47806,7 +47804,7 @@ var mN = () => {
47806
47804
  continue;
47807
47805
  }
47808
47806
  if (s === "multiselect") {
47809
- let e = n.multiselectDelimiters[a], i = o.editor.options ?? [], s = e ? PM(t, e, i) : t === "" ? [] : [t], c = [], l = /* @__PURE__ */ new Set();
47807
+ let e = n.multiselectDelimiters[a], i = o.editor.options ?? [], s = e ? FM(t, e, i) : t === "" ? [] : [t], c = [], l = /* @__PURE__ */ new Set();
47810
47808
  for (let e of s) {
47811
47809
  let t = n.valueMapping[a]?.[e.trim()];
47812
47810
  t !== void 0 && !l.has(t) && (l.add(t), c.push(t));
@@ -47818,16 +47816,16 @@ var mN = () => {
47818
47816
  r[a] = o.transformer ? o.transformer(c) : c;
47819
47817
  }
47820
47818
  return r;
47821
- }, ON = 200, kN = (e, t, n) => {
47819
+ }, kN = 200, AN = (e, t, n) => {
47822
47820
  if (n) return n;
47823
47821
  let r = new Set(t.map((e) => e.trim().toLowerCase())), i = (e) => r.has(e.trim().toLowerCase()), a = /* @__PURE__ */ new Set(), o = [];
47824
47822
  for (let t of e) {
47825
47823
  let e = t.trim();
47826
- if (!(e === "" || a.has(e)) && (a.add(e), o.push(e), o.length >= ON)) break;
47824
+ if (!(e === "" || a.has(e)) && (a.add(e), o.push(e), o.length >= kN)) break;
47827
47825
  }
47828
47826
  if (o.length === 0) return null;
47829
47827
  let s = null, c = 0, l = 0;
47830
- for (let e of NM) {
47828
+ for (let e of PM) {
47831
47829
  let n = 0, r = 0;
47832
47830
  for (let a of o) {
47833
47831
  if (i(a) || !a.includes(e)) continue;
@@ -47840,7 +47838,7 @@ var mN = () => {
47840
47838
  (n > c || n === c && n > 0 && r > l) && (s = e, c = n, l = r);
47841
47839
  }
47842
47840
  return c > 0 ? s : null;
47843
- }, AN = (e) => {
47841
+ }, jN = (e) => {
47844
47842
  let t = /* @__PURE__ */ new Map();
47845
47843
  for (let [n, r] of Object.entries(e)) {
47846
47844
  let e = Pj(n), i = t.get(e) ?? /* @__PURE__ */ new Set();
@@ -47848,8 +47846,8 @@ var mN = () => {
47848
47846
  t.set(e, i);
47849
47847
  }
47850
47848
  return t;
47851
- }, jN = (e, t, n, r) => {
47852
- let i = AN(r), a = (e, t) => i.get(Pj(e))?.has(Pj(t)) ?? !1, o = new Map(n.map((e) => [e.id, e])), s = (e, t) => (n, r) => {
47849
+ }, MN = (e, t, n, r) => {
47850
+ let i = jN(r), a = (e, t) => i.get(Pj(e))?.has(Pj(t)) ?? !1, o = new Map(n.map((e) => [e.id, e])), s = (e, t) => (n, r) => {
47853
47851
  if (Pj(n) === Pj(r) || a(r, n)) return;
47854
47852
  let i = `${n} ${r}`;
47855
47853
  t.has(i) || (t.add(i), e.push({
@@ -47869,16 +47867,16 @@ var mN = () => {
47869
47867
  for (let e of Object.values(t)) for (let [t, n] of Object.entries(e)) n && u(t, n);
47870
47868
  return c;
47871
47869
  };
47872
- function MN(e, t, n) {
47870
+ function NN(e, t, n) {
47873
47871
  let r = e.length, i = t;
47874
- return i <= 0 ? [] : r === i ? [{ cells: [...e] }] : (r < i ? NN(i, i - r) : NN(r - 1, i - 1)) > 1e3 ? [] : r < i ? PN(e, i) : FN(e, i, n);
47872
+ return i <= 0 ? [] : r === i ? [{ cells: [...e] }] : (r < i ? PN(i, i - r) : PN(r - 1, i - 1)) > 1e3 ? [] : r < i ? FN(e, i) : IN(e, i, n);
47875
47873
  }
47876
- function NN(e, t) {
47874
+ function PN(e, t) {
47877
47875
  let n = Math.min(t, e - t), r = 1;
47878
47876
  for (let t = 1; t <= n; t++) if (r = r * (e - n + t) / t, r > 1e3) return r;
47879
47877
  return r;
47880
47878
  }
47881
- function PN(e, t) {
47879
+ function FN(e, t) {
47882
47880
  let n = e.length, r = [], i = [], a = (o) => {
47883
47881
  if (i.length === n) {
47884
47882
  let a = Array(t).fill("");
@@ -47890,7 +47888,7 @@ function PN(e, t) {
47890
47888
  };
47891
47889
  return a(0), r;
47892
47890
  }
47893
- function FN(e, t, n) {
47891
+ function IN(e, t, n) {
47894
47892
  let r = e.length, i = [], a = [], o = (s) => {
47895
47893
  if (a.length === t - 1) {
47896
47894
  let o = [
@@ -47908,27 +47906,27 @@ function FN(e, t, n) {
47908
47906
  }
47909
47907
  //#endregion
47910
47908
  //#region src/components/DataUploader/utils/raggedRows/pruneByValidators.ts
47911
- var IN = {};
47912
- function LN(e, t) {
47909
+ var LN = {};
47910
+ function RN(e, t) {
47913
47911
  for (let n of t.validators ?? []) if (n.type !== "expression") {
47914
47912
  if (n.type === "function") {
47915
- if (n.fn(e, IN) != null) return !1;
47913
+ if (n.fn(e, LN) != null) return !1;
47916
47914
  continue;
47917
47915
  }
47918
- if (Bm(n, e, IN) != null) return !1;
47916
+ if (Bm(n, e, LN) != null) return !1;
47919
47917
  }
47920
47918
  return !0;
47921
47919
  }
47922
- function RN(e, t) {
47923
- for (let n = 0; n < t.length; n++) if (!LN(e.cells[n] ?? "", t[n])) return !1;
47920
+ function zN(e, t) {
47921
+ for (let n = 0; n < t.length; n++) if (!RN(e.cells[n] ?? "", t[n])) return !1;
47924
47922
  return !0;
47925
47923
  }
47926
- function zN(e, t) {
47927
- return e.filter((e) => RN(e, t));
47924
+ function BN(e, t) {
47925
+ return e.filter((e) => zN(e, t));
47928
47926
  }
47929
47927
  //#endregion
47930
47928
  //#region src/components/DataUploader/utils/raggedRows/computeDisputeSpans.ts
47931
- function BN(e) {
47929
+ function VN(e) {
47932
47930
  if (e.length <= 1) return [];
47933
47931
  let t = e[0].cells.length, n = [], r = -1;
47934
47932
  for (let i = 0; i < t; i++) {
@@ -47945,25 +47943,25 @@ function BN(e) {
47945
47943
  }
47946
47944
  //#endregion
47947
47945
  //#region src/components/DataUploader/utils/raggedRows/alignRow.ts
47948
- function VN(e, t, n) {
47949
- let r = MN(e, t.length, n), i = zN(r, t);
47946
+ function HN(e, t, n) {
47947
+ let r = NN(e, t.length, n), i = BN(r, t);
47950
47948
  return i.length === 1 ? {
47951
47949
  kind: "confident",
47952
47950
  alignment: i[0]
47953
47951
  } : i.length > 1 ? {
47954
47952
  kind: "ambiguous",
47955
47953
  candidates: i,
47956
- disputeSpans: BN(i)
47954
+ disputeSpans: VN(i)
47957
47955
  } : {
47958
47956
  kind: "invalid",
47959
47957
  candidates: r,
47960
- disputeSpans: BN(r)
47958
+ disputeSpans: VN(r)
47961
47959
  };
47962
47960
  }
47963
47961
  //#endregion
47964
47962
  //#region src/components/DataUploader/utils/raggedRows/resolveRaggedRow.ts
47965
- function HN(e, t, n) {
47966
- let r = VN(e, t, n);
47963
+ function UN(e, t, n) {
47964
+ let r = HN(e, t, n);
47967
47965
  if (r.kind === "confident") return {
47968
47966
  cells: r.alignment.cells,
47969
47967
  conflictColumns: []
@@ -47982,20 +47980,20 @@ function HN(e, t, n) {
47982
47980
  }
47983
47981
  //#endregion
47984
47982
  //#region src/components/DataUploader/context/useViewModel.tsx
47985
- var UN = 5e3, WN = 15, GN = 20, KN = new Set([
47983
+ var WN = 5e3, GN = 15, KN = 20, qN = new Set([
47986
47984
  "xlsx",
47987
47985
  "xls",
47988
47986
  "xlsb",
47989
47987
  "ods"
47990
47988
  ]);
47991
- function qN() {
47989
+ function JN() {
47992
47990
  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 } = th(), { t: f } = j(), [p, m] = (0, y.useState)(0), [h, g] = (0, y.useState)(0), [_, v] = (0, y.useState)(null), [b, x] = (0, y.useState)({}), S = (0, y.useMemo)(() => {
47993
47991
  let e = new Set(Object.values(b).filter(Boolean));
47994
47992
  return n.filter((t) => t.unique && e.has(t.id));
47995
47993
  }, [b, n]), [C, w] = (0, y.useState)(() => r), [T, E] = (0, y.useState)(!1), [D, k] = (0, y.useState)(!1), [A, M] = (0, y.useState)(null), [N, P] = (0, y.useState)([]), [F, I] = (0, y.useState)(null), [L, R] = (0, y.useState)([]), [ee, z] = (0, y.useState)({}), [B, V] = (0, y.useState)([]), [H, te] = (0, y.useState)({}), ne = (0, y.useRef)(null), [re, ie] = (0, y.useState)(-1), ae = (0, y.useCallback)((e, t) => t ? f("dataEditor.uploader.matchColumns.syntheticColumnValue", {
47996
47994
  index: e + 1,
47997
47995
  value: t
47998
- }) : f("dataEditor.uploader.matchColumns.syntheticColumn", { index: e + 1 }), [f]), oe = (0, y.useMemo)(() => _ ? VM(_.detection, re) : 0, [_, re]), U = (0, y.useMemo)(() => _ ? HM(_.rawRows, re, oe, ae) : [], [
47996
+ }) : f("dataEditor.uploader.matchColumns.syntheticColumn", { index: e + 1 }), [f]), oe = (0, y.useMemo)(() => _ ? HM(_.detection, re) : 0, [_, re]), U = (0, y.useMemo)(() => _ ? UM(_.rawRows, re, oe, ae) : [], [
47999
47997
  _,
48000
47998
  re,
48001
47999
  oe,
@@ -48013,16 +48011,16 @@ function qN() {
48013
48011
  let e = [{
48014
48012
  id: "select-files",
48015
48013
  title: f("dataEditor.uploader.steps.selectFiles"),
48016
- content: /* @__PURE__ */ (0, O.jsx)(SN, {})
48014
+ content: /* @__PURE__ */ (0, O.jsx)(CN, {})
48017
48015
  }];
48018
48016
  return N.length > 1 && e.push({
48019
48017
  id: "sheet-selection",
48020
48018
  title: f("dataEditor.uploader.steps.sheetSelection"),
48021
- content: /* @__PURE__ */ (0, O.jsx)(wN, {})
48019
+ content: /* @__PURE__ */ (0, O.jsx)(TN, {})
48022
48020
  }), _ && _.detection.review.kind !== "none" && e.push({
48023
48021
  id: "header-selection",
48024
48022
  title: f("dataEditor.uploader.steps.headerSelection"),
48025
- content: /* @__PURE__ */ (0, O.jsx)(jM, {})
48023
+ content: /* @__PURE__ */ (0, O.jsx)(MM, {})
48026
48024
  }), e.push({
48027
48025
  id: "column-matching",
48028
48026
  title: f("dataEditor.uploader.steps.matchColumns"),
@@ -48030,11 +48028,11 @@ function qN() {
48030
48028
  }), ue && e.push({
48031
48029
  id: "match-values",
48032
48030
  title: f("dataEditor.uploader.steps.matchValues"),
48033
- content: /* @__PURE__ */ (0, O.jsx)(sN, {})
48031
+ content: /* @__PURE__ */ (0, O.jsx)(cN, {})
48034
48032
  }), S.length > 0 && de && e.push({
48035
48033
  id: "primary-key",
48036
48034
  title: f("dataEditor.uploader.steps.primaryKey"),
48037
- content: /* @__PURE__ */ (0, O.jsx)(uN, {})
48035
+ content: /* @__PURE__ */ (0, O.jsx)(dN, {})
48038
48036
  }), e;
48039
48037
  }, [
48040
48038
  S.length,
@@ -48078,7 +48076,7 @@ function qN() {
48078
48076
  sheetName: F
48079
48077
  }).then((e) => {
48080
48078
  if (e.kind !== "rows") return;
48081
- let t = wM(e.rows);
48079
+ let t = TM(e.rows);
48082
48080
  ie(t.headerRowIndex), ve({
48083
48081
  fileName: A.name,
48084
48082
  rawRows: e.rows,
@@ -48102,7 +48100,7 @@ function qN() {
48102
48100
  E(!1);
48103
48101
  return;
48104
48102
  }
48105
- let n = wM(e.rows);
48103
+ let n = TM(e.rows);
48106
48104
  if (ie(n.headerRowIndex), ve({
48107
48105
  fileName: t.name,
48108
48106
  rawRows: e.rows,
@@ -48136,8 +48134,8 @@ function qN() {
48136
48134
  if (e.kind !== "records") return;
48137
48135
  ie(0), ve({
48138
48136
  fileName: t.name,
48139
- rawRows: WM(e.headers, e.rows),
48140
- detection: UM()
48137
+ rawRows: GM(e.headers, e.rows),
48138
+ detection: WM()
48141
48139
  });
48142
48140
  } catch (t) {
48143
48141
  E(!1), e.errorHandler.handleError({
@@ -48158,8 +48156,8 @@ function qN() {
48158
48156
  if (e.kind !== "records") return;
48159
48157
  ie(0), ve({
48160
48158
  fileName: t.name,
48161
- rawRows: WM(e.headers, e.rows),
48162
- detection: UM()
48159
+ rawRows: GM(e.headers, e.rows),
48160
+ detection: WM()
48163
48161
  });
48164
48162
  } catch (t) {
48165
48163
  E(!1), e.errorHandler.handleError({
@@ -48178,11 +48176,11 @@ function qN() {
48178
48176
  le.parse(t, { format: "xlsx" }).then((e) => {
48179
48177
  if (e.kind === "sheets") {
48180
48178
  let n = e.sheets.map((e) => {
48181
- let t = wM(e.rows), n = VM(t, t.headerRowIndex), r = HM(e.rows, t.headerRowIndex, n, ae);
48179
+ let t = TM(e.rows), n = HM(t, t.headerRowIndex), r = UM(e.rows, t.headerRowIndex, n, ae);
48182
48180
  return {
48183
48181
  name: e.name,
48184
48182
  headers: r,
48185
- rows: JM(e.rows, r, n, WN),
48183
+ rows: YM(e.rows, r, n, GN),
48186
48184
  totalRows: e.totalRows - 1
48187
48185
  };
48188
48186
  });
@@ -48190,7 +48188,7 @@ function qN() {
48190
48188
  return;
48191
48189
  }
48192
48190
  if (e.kind !== "rows") return;
48193
- let n = wM(e.rows);
48191
+ let n = TM(e.rows);
48194
48192
  ie(n.headerRowIndex), ve({
48195
48193
  fileName: t.name,
48196
48194
  rawRows: e.rows,
@@ -48215,7 +48213,7 @@ function qN() {
48215
48213
  ]), De = (0, y.useCallback)((e) => {
48216
48214
  E(!0), ne.current = e;
48217
48215
  let t = e.name.split(".").pop()?.toLowerCase();
48218
- t && KN.has(t) ? Ee(e) : t === "json" ? we(e) : t === "xml" ? Te(e) : Ce(e);
48216
+ t && qN.has(t) ? Ee(e) : t === "json" ? we(e) : t === "xml" ? Te(e) : Ce(e);
48219
48217
  }, [
48220
48218
  Ce,
48221
48219
  we,
@@ -48252,8 +48250,8 @@ function qN() {
48252
48250
  });
48253
48251
  ie(0), ve({
48254
48252
  fileName: e.label,
48255
- rawRows: WM(n, r),
48256
- detection: UM()
48253
+ rawRows: GM(n, r),
48254
+ detection: WM()
48257
48255
  });
48258
48256
  }
48259
48257
  } catch (e) {
@@ -48281,7 +48279,7 @@ function qN() {
48281
48279
  return;
48282
48280
  }
48283
48281
  if (D) return;
48284
- let e = {}, t = {}, r = GM(U);
48282
+ let e = {}, t = {}, r = KM(U);
48285
48283
  for (let [i, a] of Object.entries(b)) {
48286
48284
  if (!a) continue;
48287
48285
  let o = n.find((e) => e.id === a);
@@ -48290,9 +48288,9 @@ function qN() {
48290
48288
  if (s !== "select" && s !== "multiselect") continue;
48291
48289
  let c = o.editor.options, l = r.get(i);
48292
48290
  if (l === void 0) continue;
48293
- let u = KM(_.rawRows, oe, l);
48291
+ let u = qM(_.rawRows, oe, l);
48294
48292
  if (s === "multiselect") {
48295
- let n = o.editor.delimiter, r = kN(u, c, n);
48293
+ let n = o.editor.delimiter, r = AN(u, c, n);
48296
48294
  t[a] = r;
48297
48295
  let i = new Set(c.map((e) => e.trim().toLowerCase())), s = /* @__PURE__ */ new Set();
48298
48296
  for (let e of u) {
@@ -48355,10 +48353,10 @@ function qN() {
48355
48353
  if (!t) return;
48356
48354
  let r = n.find((t) => t.id === e);
48357
48355
  if (r?.editor?.type !== "multiselect") return;
48358
- let i = GM(U).get(t);
48356
+ let i = KM(U).get(t);
48359
48357
  if (i === void 0) return;
48360
- let a = KM(_.rawRows, oe, i), o = r.editor.delimiter;
48361
- He(e, kN(a, r.editor.options, o));
48358
+ let a = qM(_.rawRows, oe, i), o = r.editor.delimiter;
48359
+ He(e, AN(a, r.editor.options, o));
48362
48360
  }, [
48363
48361
  _,
48364
48362
  b,
@@ -48379,7 +48377,7 @@ function qN() {
48379
48377
  for (let [r, i] of Object.entries(b)) !i || e.has(i) || n.find((e) => e.id === i)?.editor?.type === "date" && t.push(r);
48380
48378
  return t;
48381
48379
  }, [b, n]), Ke = (0, y.useCallback)(() => {
48382
- let e = new Set(B.map((e) => e.id)), t = TN(b, n, e), i = _ ? JM(_.rawRows, U, oe, 1e3) : [], a = rp(i, EN(t)), o = cp(i, Ge(e));
48380
+ let e = new Set(B.map((e) => e.id)), t = EN(b, n, e), i = _ ? YM(_.rawRows, U, oe, 1e3) : [], a = rp(i, DN(t)), o = cp(i, Ge(e));
48383
48381
  return {
48384
48382
  columnMapping: b,
48385
48383
  valueMapping: Be,
@@ -48420,7 +48418,7 @@ function qN() {
48420
48418
  if (!_ || !d?.onRowsImport) return;
48421
48419
  let t = _;
48422
48420
  v(null);
48423
- let r = crypto.randomUUID(), i = Ke(), a = new AbortController(), o = d.importChunkSize ?? UN, s = TN(b, n, new Set(B.map((e) => e.id))), c = {
48421
+ let r = crypto.randomUUID(), i = Ke(), a = new AbortController(), o = d.importChunkSize ?? WN, s = EN(b, n, new Set(B.map((e) => e.id))), c = {
48424
48422
  numberFormat: i.numberFormat,
48425
48423
  dateFormat: i.dateFormat,
48426
48424
  monthTable: op(f),
@@ -48429,14 +48427,14 @@ function qN() {
48429
48427
  }, l = U, u = t.rawRows, p = [];
48430
48428
  for (let e = oe; e < u.length; e++) {
48431
48429
  let t = u[e];
48432
- t && !LM(t) && p.push(e);
48430
+ t && !RM(t) && p.push(e);
48433
48431
  }
48434
48432
  let m = 0;
48435
48433
  for (; m < p.length;) {
48436
48434
  let e = Math.min(m + o, p.length), n = [];
48437
48435
  for (let t = m; t < e; t++) {
48438
- let e = qM(u[p[t]] ?? [], l);
48439
- n.push(DN(e, s, c));
48436
+ let e = JM(u[p[t]] ?? [], l);
48437
+ n.push(ON(e, s, c));
48440
48438
  }
48441
48439
  let f = e >= p.length, h = Math.floor(m / o);
48442
48440
  await d.onRowsImport({
@@ -48477,14 +48475,14 @@ function qN() {
48477
48475
  B.length > 0 && u(B);
48478
48476
  for (let [t, n] of Object.entries(H)) e.addColumnOptions(t, n);
48479
48477
  let o = e.registerSource({ name: i.fileName });
48480
- e.setSourceLoading(o, !0), e.recordLearnedSynonyms(jN(b, Be, [...n, ...B], Mj(jj, l)));
48478
+ e.setSourceLoading(o, !0), e.recordLearnedSynonyms(MN(b, Be, [...n, ...B], Mj(jj, l)));
48481
48479
  let s = U, c = i.delimiter ?? ",", d = i.rawRows, p = [];
48482
48480
  for (let e = oe; e < d.length; e++) {
48483
48481
  let t = d[e];
48484
- t && !LM(t) && p.push(e);
48482
+ t && !RM(t) && p.push(e);
48485
48483
  }
48486
- let m = JM(i.rawRows, s, oe, 1e3), h = TN(b, n, a), g = {
48487
- numberFormat: rp(m, EN(h)),
48484
+ let m = YM(i.rawRows, s, oe, 1e3), h = EN(b, n, a), g = {
48485
+ numberFormat: rp(m, DN(h)),
48488
48486
  dateFormat: cp(m, Ge(a)),
48489
48487
  monthTable: op(f),
48490
48488
  valueMapping: Be,
@@ -48496,11 +48494,11 @@ function qN() {
48496
48494
  title: e
48497
48495
  };
48498
48496
  }), v = 0, y = () => {
48499
- let n = Math.min(v + UN, p.length), i = [], a = [];
48497
+ let n = Math.min(v + WN, p.length), i = [], a = [];
48500
48498
  for (let e = v; e < n; e++) {
48501
- let t = d[p[e]] ?? [], n = qM(t, s);
48499
+ let t = d[p[e]] ?? [], n = JM(t, s);
48502
48500
  if (t.length !== s.length) {
48503
- let { cells: r, conflictColumns: i } = HN(t.map((e) => String(e ?? "")), _, c);
48501
+ let { cells: r, conflictColumns: i } = UN(t.map((e) => String(e ?? "")), _, c);
48504
48502
  if (r.length) {
48505
48503
  let e = {};
48506
48504
  for (let t = 0; t < s.length; t++) e[s[t]] = r[t] ?? "";
@@ -48518,10 +48516,10 @@ function qN() {
48518
48516
  });
48519
48517
  }
48520
48518
  }
48521
- i.push(DN(n, h, g));
48519
+ i.push(ON(n, h, g));
48522
48520
  }
48523
48521
  let { rows: l, rowIds: u } = e.upsertRows(o, i, { anchorKey: C ?? void 0 });
48524
- for (let e = v; e < n; e++) e < GN || (d[p[e]] = void 0);
48522
+ for (let e = v; e < n; e++) e < KN || (d[p[e]] = void 0);
48525
48523
  v = n, setTimeout(() => {
48526
48524
  t.validateRows(l, u);
48527
48525
  for (let { localIndex: t, columnIds: n } of a) {
@@ -48629,20 +48627,20 @@ function qN() {
48629
48627
  }
48630
48628
  //#endregion
48631
48629
  //#region src/components/DataUploader/context/index.tsx
48632
- var JN = (0, y.createContext)(null);
48633
- function YN({ children: e }) {
48634
- let t = qN();
48635
- return /* @__PURE__ */ (0, O.jsx)(JN.Provider, {
48630
+ var YN = (0, y.createContext)(null);
48631
+ function XN({ children: e }) {
48632
+ let t = JN();
48633
+ return /* @__PURE__ */ (0, O.jsx)(YN.Provider, {
48636
48634
  value: t,
48637
48635
  children: e
48638
48636
  });
48639
48637
  }
48640
- var XN = () => {
48641
- let e = (0, y.useContext)(JN);
48638
+ var ZN = () => {
48639
+ let e = (0, y.useContext)(YN);
48642
48640
  if (!e) throw Error("useDataUploaderContext must be used within DataUploaderProvider");
48643
48641
  return e;
48644
- }, ZN = () => {
48645
- let { steps: e, activeStepIndex: t, currentStepIndex: n, goToStep: r } = XN();
48642
+ }, QN = () => {
48643
+ let { steps: e, activeStepIndex: t, currentStepIndex: n, goToStep: r } = ZN();
48646
48644
  return /* @__PURE__ */ (0, O.jsx)(zc, {
48647
48645
  steps: e,
48648
48646
  activeStepIndex: t,
@@ -48650,79 +48648,79 @@ var XN = () => {
48650
48648
  onStepChange: r,
48651
48649
  isProgressive: !0
48652
48650
  });
48653
- }, QN = () => /* @__PURE__ */ (0, O.jsx)(YN, { children: /* @__PURE__ */ (0, O.jsx)(ZN, {}) }), $N = {
48651
+ }, $N = () => /* @__PURE__ */ (0, O.jsx)(XN, { children: /* @__PURE__ */ (0, O.jsx)(QN, {}) }), eP = {
48654
48652
  kty: "EC",
48655
48653
  crv: "P-256",
48656
48654
  x: "wZO1Jxr21FEBDsVMzbTbF8blU2CP17c_eQY7gorO13U",
48657
48655
  y: "Nwr-tXatJZ3DxZqpUG_gOWzmpU6szTqrEL7Gnh5UGwo"
48658
- }, eP = "updog_license_grant", tP = new Set([
48656
+ }, tP = "updog_license_grant", nP = new Set([
48659
48657
  "updog.tech",
48660
48658
  "landing.updog.tech",
48661
48659
  "demo.updog.tech"
48662
48660
  ]);
48663
- function nP() {
48664
- return tP.has(window.location.hostname);
48665
- }
48666
48661
  function rP() {
48667
- return !1;
48662
+ return nP.has(window.location.hostname);
48668
48663
  }
48669
48664
  function iP() {
48665
+ return !1;
48666
+ }
48667
+ function aP() {
48670
48668
  return "https://api.updog.tech";
48671
48669
  }
48672
- function aP(e) {
48670
+ function oP(e) {
48673
48671
  let t = e.replace(/-/g, "+").replace(/_/g, "/"), n = t + "=".repeat((4 - t.length % 4) % 4), r = atob(n), i = new Uint8Array(r.length);
48674
48672
  for (let e = 0; e < r.length; e++) i[e] = r.charCodeAt(e);
48675
48673
  return i;
48676
48674
  }
48677
- async function oP(e) {
48675
+ async function sP(e) {
48678
48676
  let t = new TextEncoder().encode(e), n = await crypto.subtle.digest("SHA-256", t);
48679
48677
  return Array.from(new Uint8Array(n)).map((e) => e.toString(16).padStart(2, "0")).join("");
48680
48678
  }
48681
- var sP = null;
48682
- async function cP() {
48683
- return sP || (sP = await crypto.subtle.importKey("jwk", $N, {
48679
+ var cP = null;
48680
+ async function lP() {
48681
+ return cP || (cP = await crypto.subtle.importKey("jwk", eP, {
48684
48682
  name: "ECDSA",
48685
48683
  namedCurve: "P-256"
48686
- }, !1, ["verify"]), sP);
48684
+ }, !1, ["verify"]), cP);
48687
48685
  }
48688
- function lP() {
48686
+ function uP() {
48689
48687
  try {
48690
- return localStorage.getItem(eP);
48688
+ return localStorage.getItem(tP);
48691
48689
  } catch {
48692
48690
  return null;
48693
48691
  }
48694
48692
  }
48695
- function uP(e) {
48693
+ function dP(e) {
48696
48694
  try {
48697
- localStorage.setItem(eP, e);
48695
+ localStorage.setItem(tP, e);
48698
48696
  } catch {}
48699
48697
  }
48700
- function dP() {
48698
+ function fP() {
48701
48699
  try {
48702
- localStorage.removeItem(eP);
48700
+ localStorage.removeItem(tP);
48703
48701
  } catch {}
48704
48702
  }
48705
- async function fP(e, t, n) {
48703
+ async function pP(e, t, n) {
48706
48704
  let r = e.indexOf(".");
48707
48705
  if (r === -1) return !1;
48708
- let i = e.slice(0, r), a = e.slice(r + 1), o = aP(i), s = aP(a), c = await cP();
48706
+ let i = e.slice(0, r), a = e.slice(r + 1), o = oP(i), s = oP(a), c = await lP();
48709
48707
  if (!await crypto.subtle.verify({
48710
48708
  name: "ECDSA",
48711
48709
  hash: "SHA-256"
48712
48710
  }, c, new Uint8Array(s), new Uint8Array(o))) return !1;
48713
48711
  let l = JSON.parse(new TextDecoder().decode(o));
48714
48712
  if (l.exp <= Math.floor(Date.now() / 1e3)) return !1;
48715
- let u = await oP(t);
48713
+ let u = await sP(t);
48716
48714
  return !(l.key !== u || l.domain !== n);
48717
48715
  }
48718
- async function pP(e) {
48719
- let t = lP();
48716
+ async function mP(e) {
48717
+ let t = uP();
48720
48718
  if (!t) return {
48721
48719
  valid: !1,
48722
48720
  errorCode: "license.invalid"
48723
48721
  };
48724
48722
  try {
48725
- if (await fP(t, e, window.location.hostname.toLowerCase().trim())) return {
48723
+ if (await pP(t, e, window.location.hostname.toLowerCase().trim())) return {
48726
48724
  valid: !0,
48727
48725
  errorCode: null
48728
48726
  };
@@ -48732,23 +48730,23 @@ async function pP(e) {
48732
48730
  errorCode: "license.invalid"
48733
48731
  };
48734
48732
  }
48735
- async function mP(e, t = !0) {
48736
- if (nP() || rP()) return {
48733
+ async function hP(e, t = !0) {
48734
+ if (rP() || iP()) return {
48737
48735
  valid: !0,
48738
48736
  errorCode: null
48739
48737
  };
48740
- let n = iP();
48738
+ let n = aP();
48741
48739
  try {
48742
48740
  let r = await fetch(`${n}/v1/validate`, { headers: { "X-API-Key": e } });
48743
48741
  if (r.ok) {
48744
48742
  let e = await r.json();
48745
- return t && e.grant && uP(e.grant), {
48743
+ return t && e.grant && dP(e.grant), {
48746
48744
  valid: !0,
48747
48745
  errorCode: null
48748
48746
  };
48749
48747
  }
48750
48748
  if (r.status >= 400 && r.status < 500) {
48751
- t && dP();
48749
+ t && fP();
48752
48750
  try {
48753
48751
  return await r.json();
48754
48752
  } catch {
@@ -48760,7 +48758,7 @@ async function mP(e, t = !0) {
48760
48758
  }
48761
48759
  throw Error(`Server error: ${r.status}`);
48762
48760
  } catch {
48763
- return t ? pP(e) : {
48761
+ return t ? mP(e) : {
48764
48762
  valid: !1,
48765
48763
  errorCode: "license.invalid"
48766
48764
  };
@@ -48768,7 +48766,7 @@ async function mP(e, t = !0) {
48768
48766
  }
48769
48767
  //#endregion
48770
48768
  //#region src/hooks/useLicenseValidation.ts
48771
- function hP(e, t, n = !0) {
48769
+ function gP(e, t, n = !0) {
48772
48770
  let [r, i] = (0, y.useState)({
48773
48771
  isValidating: t,
48774
48772
  isValid: !1,
@@ -48788,7 +48786,7 @@ function hP(e, t, n = !0) {
48788
48786
  isValidating: !0,
48789
48787
  isValid: !1,
48790
48788
  errorCode: null
48791
- }), mP(e, n).then((e) => {
48789
+ }), hP(e, n).then((e) => {
48792
48790
  r || i({
48793
48791
  isValidating: !1,
48794
48792
  isValid: e.valid,
@@ -48811,7 +48809,7 @@ function hP(e, t, n = !0) {
48811
48809
  }
48812
48810
  //#endregion
48813
48811
  //#region src/server/auth/AuthState.ts
48814
- var gP = class {
48812
+ var _P = class {
48815
48813
  token = null;
48816
48814
  get() {
48817
48815
  return this.token;
@@ -48822,13 +48820,13 @@ var gP = class {
48822
48820
  clear() {
48823
48821
  this.token = null;
48824
48822
  }
48825
- }, _P = class extends Error {
48823
+ }, vP = class extends Error {
48826
48824
  status;
48827
48825
  code;
48828
48826
  constructor(e) {
48829
48827
  super(e.message), this.name = "ScaleHttpError", this.status = e.status, this.code = e.code;
48830
48828
  }
48831
- }, vP = class {
48829
+ }, yP = class {
48832
48830
  baseUrl;
48833
48831
  apiKey;
48834
48832
  auth;
@@ -48858,7 +48856,7 @@ var gP = class {
48858
48856
  signal: r?.signal
48859
48857
  });
48860
48858
  } catch (e) {
48861
- this.notify(new _P({
48859
+ this.notify(new vP({
48862
48860
  status: 0,
48863
48861
  code: "network",
48864
48862
  message: e instanceof Error ? e.message : String(e)
@@ -48869,7 +48867,7 @@ var gP = class {
48869
48867
  try {
48870
48868
  e = await s.json();
48871
48869
  } catch {}
48872
- this.notify(new _P({
48870
+ this.notify(new vP({
48873
48871
  status: s.status,
48874
48872
  code: e.error ?? `http_${s.status}`,
48875
48873
  message: e.message ?? s.statusText
@@ -48880,23 +48878,23 @@ var gP = class {
48880
48878
  };
48881
48879
  //#endregion
48882
48880
  //#region src/server/endpoints/workspaces.ts
48883
- async function yP(e, t) {
48881
+ async function bP(e, t) {
48884
48882
  return e.post("/workspaces", {
48885
48883
  primaryKey: t.primaryKey,
48886
48884
  columns: t.columns
48887
48885
  }, { signal: t.signal });
48888
48886
  }
48889
- async function bP(e) {
48887
+ async function xP(e) {
48890
48888
  try {
48891
48889
  await e.http.delete(`/workspaces/${e.workspaceId}`, { signal: e.signal });
48892
48890
  } catch (e) {
48893
- if (e instanceof _P && e.status === 404) return;
48891
+ if (e instanceof vP && e.status === 404) return;
48894
48892
  throw e;
48895
48893
  }
48896
48894
  }
48897
48895
  //#endregion
48898
48896
  //#region src/server/endpoints/query.ts
48899
- async function xP(e, t) {
48897
+ async function SP(e, t) {
48900
48898
  let n = await e.http.post(`/workspaces/${e.workspaceId}/query`, {
48901
48899
  page: {
48902
48900
  limit: t.limit,
@@ -48914,12 +48912,12 @@ async function xP(e, t) {
48914
48912
  }
48915
48913
  //#endregion
48916
48914
  //#region src/server/ScaleClient.ts
48917
- var SP = class {
48915
+ var CP = class {
48918
48916
  disposed = !1;
48919
48917
  constructor(e) {
48920
48918
  this.deps = e;
48921
48919
  }
48922
- onQuery = (e) => xP(this.deps, e);
48920
+ onQuery = (e) => SP(this.deps, e);
48923
48921
  onEdit = async (e) => ({
48924
48922
  rejected: !0,
48925
48923
  reason: "Edits are not yet supported in server mode (v0)."
@@ -48936,7 +48934,7 @@ var SP = class {
48936
48934
  pageSize = void 0;
48937
48935
  scrollSensitivity = void 0;
48938
48936
  dispose = async () => {
48939
- this.disposed || (this.disposed = !0, await bP({
48937
+ this.disposed || (this.disposed = !0, await xP({
48940
48938
  http: this.deps.http,
48941
48939
  workspaceId: this.deps.workspaceId
48942
48940
  }));
@@ -48944,25 +48942,25 @@ var SP = class {
48944
48942
  };
48945
48943
  //#endregion
48946
48944
  //#region src/server/createScaleClient.ts
48947
- async function CP(e) {
48948
- let t = new gP(), n = new vP({
48945
+ async function wP(e) {
48946
+ let t = new _P(), n = new yP({
48949
48947
  baseUrl: e.url,
48950
48948
  apiKey: e.apiKey,
48951
48949
  auth: t,
48952
48950
  onDegraded: e.onDegraded
48953
- }), { workspaceId: r, accessToken: i } = await yP(n, {
48951
+ }), { workspaceId: r, accessToken: i } = await bP(n, {
48954
48952
  primaryKey: e.primaryKey,
48955
48953
  columns: e.columns,
48956
48954
  signal: e.signal
48957
48955
  });
48958
- return t.set(i), new SP({
48956
+ return t.set(i), new CP({
48959
48957
  workspaceId: r,
48960
48958
  http: n
48961
48959
  });
48962
48960
  }
48963
48961
  //#endregion
48964
48962
  //#region src/server/errors.ts
48965
- function wP(e, t, n) {
48963
+ function TP(e, t, n) {
48966
48964
  return {
48967
48965
  code: e,
48968
48966
  message: t,
@@ -48972,7 +48970,7 @@ function wP(e, t, n) {
48972
48970
  }
48973
48971
  //#endregion
48974
48972
  //#region src/hooks/useScaleClient.ts
48975
- function TP(e) {
48973
+ function EP(e) {
48976
48974
  let [t, n] = (0, y.useState)({ status: "idle" }), r = (0, y.useRef)(e.columns), i = (0, y.useRef)(e.primaryKey);
48977
48975
  return (0, y.useEffect)(() => {
48978
48976
  if (!e.enabled) {
@@ -48981,7 +48979,7 @@ function TP(e) {
48981
48979
  }
48982
48980
  n({ status: "bootstrapping" });
48983
48981
  let t = new AbortController(), a = null;
48984
- return CP({
48982
+ return wP({
48985
48983
  url: e.url,
48986
48984
  apiKey: e.apiKey,
48987
48985
  primaryKey: i.current,
@@ -48990,7 +48988,7 @@ function TP(e) {
48990
48988
  onDegraded: (e) => {
48991
48989
  t.signal.aborted || n({
48992
48990
  status: "failed",
48993
- error: DP(e)
48991
+ error: OP(e)
48994
48992
  });
48995
48993
  }
48996
48994
  }).then((e) => {
@@ -49005,7 +49003,7 @@ function TP(e) {
49005
49003
  }).catch((e) => {
49006
49004
  t.signal.aborted || n({
49007
49005
  status: "failed",
49008
- error: EP(e)
49006
+ error: DP(e)
49009
49007
  });
49010
49008
  }), () => {
49011
49009
  t.abort(), a?.dispose().catch(() => {});
@@ -49016,30 +49014,30 @@ function TP(e) {
49016
49014
  e.apiKey
49017
49015
  ]), t;
49018
49016
  }
49019
- function EP(e) {
49020
- return e instanceof _P ? e.status === 401 ? wP(e.code.startsWith("license.") ? e.code : "license.invalid", e.message, e) : e.status === 0 ? wP("scale.unreachable", e.message, e) : e.status >= 500 ? wP("scale.server_error", e.message, e) : wP("scale.bootstrap_failed", e.message, e) : wP("scale.bootstrap_failed", e instanceof Error ? e.message : String(e), e);
49021
- }
49022
49017
  function DP(e) {
49023
- return e.status === 0 ? wP("scale.unreachable", e.message, e) : e.status === 404 ? wP("scale.workspace_lost", e.message, e) : wP("scale.server_error", e.message, e);
49018
+ return e instanceof vP ? e.status === 401 ? TP(e.code.startsWith("license.") ? e.code : "license.invalid", e.message, e) : e.status === 0 ? TP("scale.unreachable", e.message, e) : e.status >= 500 ? TP("scale.server_error", e.message, e) : TP("scale.bootstrap_failed", e.message, e) : TP("scale.bootstrap_failed", e instanceof Error ? e.message : String(e), e);
49019
+ }
49020
+ function OP(e) {
49021
+ return e.status === 0 ? TP("scale.unreachable", e.message, e) : e.status === 404 ? TP("scale.workspace_lost", e.message, e) : TP("scale.server_error", e.message, e);
49024
49022
  }
49025
49023
  //#endregion
49026
49024
  //#region src/index.tsx
49027
- function OP(e) {
49025
+ function kP(e) {
49028
49026
  return e === !1 ? { licenseGrant: !1 } : { licenseGrant: e?.licenseGrant ?? !0 };
49029
49027
  }
49030
- function kP(e) {
49028
+ function AP(e) {
49031
49029
  let t = (0, y.useMemo)(() => new ed(e.onError), [e.onError]);
49032
49030
  return /* @__PURE__ */ (0, O.jsx)(kj, {
49033
49031
  errorHandler: t,
49034
49032
  children: /* @__PURE__ */ (0, O.jsx)(eh, {
49035
49033
  ...e,
49036
49034
  errorHandler: t,
49037
- children: e.showUploader ? /* @__PURE__ */ (0, O.jsx)(QN, {}) : /* @__PURE__ */ (0, O.jsx)(Tj, {})
49035
+ children: e.showUploader ? /* @__PURE__ */ (0, O.jsx)($N, {}) : /* @__PURE__ */ (0, O.jsx)(Tj, {})
49038
49036
  })
49039
49037
  });
49040
49038
  }
49041
- function AP(e) {
49042
- let t = e.mode ?? "modal", { t: n, rtl: r } = j(), i = r ? "rtl" : "ltr", a = OP(e.localStorage), o = t === "modal" ? e.open : !0, { isValidating: s, isValid: c, errorCode: l } = hP(e.apiKey, t === "modal" ? o : !0, a.licenseGrant), u = e.__server != null, d = TP({
49039
+ function jP(e) {
49040
+ let t = e.mode ?? "modal", { t: n, rtl: r } = j(), i = r ? "rtl" : "ltr", a = kP(e.localStorage), o = t === "modal" ? e.open : !0, { isValidating: s, isValid: c, errorCode: l } = gP(e.apiKey, t === "modal" ? o : !0, a.licenseGrant), u = e.__server != null, d = EP({
49043
49041
  enabled: !s && c && u,
49044
49042
  url: e.__server?.url ?? "",
49045
49043
  apiKey: e.apiKey,
@@ -49094,7 +49092,7 @@ function AP(e) {
49094
49092
  code: e,
49095
49093
  message: "License validation failed",
49096
49094
  source: "license"
49097
- } }), E = () => s ? w(n("dataEditor.license.loading")) : c ? u && d.status === "bootstrapping" ? w(n("dataEditor.connecting.label")) : u && d.status === "failed" ? /* @__PURE__ */ (0, O.jsx)(Dj, { error: d.error }) : /* @__PURE__ */ (0, O.jsx)(kP, { ...C }) : T(l ?? "license.invalid");
49095
+ } }), E = () => s ? w(n("dataEditor.license.loading")) : c ? u && d.status === "bootstrapping" ? w(n("dataEditor.connecting.label")) : u && d.status === "failed" ? /* @__PURE__ */ (0, O.jsx)(Dj, { error: d.error }) : /* @__PURE__ */ (0, O.jsx)(AP, { ...C }) : T(l ?? "license.invalid");
49098
49096
  return t === "inline" ? /* @__PURE__ */ (0, O.jsx)("div", {
49099
49097
  className: "updog__data-editor updog__data-editor-inline",
49100
49098
  dir: i,
@@ -49114,18 +49112,18 @@ function AP(e) {
49114
49112
  submitText: n("dataEditor.confirmClose.action")
49115
49113
  })] });
49116
49114
  }
49117
- function jP(e) {
49115
+ function MP(e) {
49118
49116
  let { translations: t, rtl: n = !1, locale: r = "en", className: i, ...a } = e;
49119
49117
  return /* @__PURE__ */ (0, O.jsx)(A, {
49120
49118
  translations: t,
49121
49119
  rtl: n,
49122
49120
  locale: r,
49123
- children: /* @__PURE__ */ (0, O.jsx)(AP, { ...a })
49121
+ children: /* @__PURE__ */ (0, O.jsx)(jP, { ...a })
49124
49122
  });
49125
49123
  }
49126
49124
  //#endregion
49127
49125
  //#region src/wc.ts
49128
- var MP = {
49126
+ var NP = {
49129
49127
  "api-key": {
49130
49128
  prop: "apiKey",
49131
49129
  type: "string"
@@ -49158,12 +49156,12 @@ var MP = {
49158
49156
  prop: "mode",
49159
49157
  type: "string"
49160
49158
  }
49161
- }, NP = class extends HTMLElement {
49159
+ }, PP = class extends HTMLElement {
49162
49160
  _root = null;
49163
49161
  _props = {};
49164
49162
  _renderScheduled = !1;
49165
49163
  static get observedAttributes() {
49166
- return Object.keys(MP);
49164
+ return Object.keys(NP);
49167
49165
  }
49168
49166
  connectedCallback() {
49169
49167
  this._root = (0, v.createRoot)(this), this._props.mode !== "inline" && (this._props.onClose = () => {
@@ -49174,7 +49172,7 @@ var MP = {
49174
49172
  this._root?.unmount(), this._root = null;
49175
49173
  }
49176
49174
  attributeChangedCallback(e, t, n) {
49177
- let r = MP[e];
49175
+ let r = NP[e];
49178
49176
  r && (this._props[r.prop] = r.type === "boolean" ? n !== null : n, e === "mode" && (n === "inline" ? delete this._props.onClose : this._props.onClose = () => {
49179
49177
  this.dispatchEvent(new CustomEvent("close", { bubbles: !0 }));
49180
49178
  }), this._scheduleRender());
@@ -49191,11 +49189,11 @@ var MP = {
49191
49189
  }
49192
49190
  _scheduleRender() {
49193
49191
  this._renderScheduled || (this._renderScheduled = !0, queueMicrotask(() => {
49194
- this._renderScheduled = !1, this._root && this._root.render((0, y.createElement)(jP, this._props));
49192
+ this._renderScheduled = !1, this._root && this._root.render((0, y.createElement)(MP, this._props));
49195
49193
  }));
49196
49194
  }
49197
49195
  };
49198
- for (let e of /* @__PURE__ */ "columns.primaryKey.apiKey.className.localStorage.loadData.__server.onComplete.translations.importFormats.exportFormats.remoteSources.enableDeleteRow.enableAddRow.enableCreateColumn.onColumnMatch.onValueMatch.synonyms.sampleData.rowHeight.headerHeight.locale.variant.rtl.readonly.mode.chat".split(".")) Object.defineProperty(NP.prototype, e, {
49196
+ for (let e of /* @__PURE__ */ "columns.primaryKey.apiKey.className.localStorage.loadData.__server.onComplete.translations.importFormats.exportFormats.remoteSources.enableDeleteRow.enableAddRow.enableCreateColumn.onColumnMatch.onValueMatch.synonyms.sampleData.rowHeight.headerHeight.locale.variant.rtl.readonly.mode.chat".split(".")) Object.defineProperty(PP.prototype, e, {
49199
49197
  get() {
49200
49198
  return this._props[e];
49201
49199
  },
@@ -49205,7 +49203,7 @@ for (let e of /* @__PURE__ */ "columns.primaryKey.apiKey.className.localStorage.
49205
49203
  enumerable: !0,
49206
49204
  configurable: !0
49207
49205
  });
49208
- Object.defineProperty(NP.prototype, "open", {
49206
+ Object.defineProperty(PP.prototype, "open", {
49209
49207
  get() {
49210
49208
  return this.hasAttribute("open");
49211
49209
  },
@@ -49214,5 +49212,5 @@ Object.defineProperty(NP.prototype, "open", {
49214
49212
  },
49215
49213
  enumerable: !0,
49216
49214
  configurable: !0
49217
- }), customElements.define("updog-editor", NP);
49215
+ }), customElements.define("updog-editor", PP);
49218
49216
  //#endregion