@updog/data-editor 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 +282 -284
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -20908,7 +20908,7 @@ var ov = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(J, {
20908
20908
  return this.state.hasError ? /* @__PURE__ */ C(_v, { error: vv }) : this.props.children;
20909
20909
  }
20910
20910
  }, 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(() => {
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 } = Vb(), y = i && t === "editor", b = f(() => {
20912
20912
  n(!1);
20913
20913
  }, [n]), x = m[h]?.id === "sheet-selection", S = f(() => {
20914
20914
  a ? c() : x ? _() : o();
@@ -21677,7 +21677,7 @@ var ov = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(J, {
21677
21677
  }
21678
21678
  return i;
21679
21679
  }, 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), [
21680
+ 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 = y(null), p = v(() => Vv(i, e, n), [
21681
21681
  i,
21682
21682
  e,
21683
21683
  n
@@ -21896,99 +21896,93 @@ var Gv = () => {
21896
21896
  /* @__PURE__ */ C(Yv, {})
21897
21897
  ]
21898
21898
  }), Zv = () => {
21899
- let { parsedCsv: e } = Bb();
21899
+ let { parsedCsv: e } = Vb();
21900
21900
  return e ? /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ w(Jl, { children: [/* @__PURE__ */ C("div", {
21901
21901
  className: "updog__step-column-matching__content updog__scrollbar",
21902
21902
  children: /* @__PURE__ */ C(Wv, { children: /* @__PURE__ */ C(Xv, {}) })
21903
21903
  }), /* @__PURE__ */ C(bv, {})] }) }) : null;
21904
- }, Qv = new Set([
21904
+ }, Qv = .5, $v = new Set([
21905
21905
  "true",
21906
21906
  "false",
21907
21907
  "yes",
21908
21908
  "no"
21909
- ]), $v = /^\d{1,4}[-/.]\d{1,2}[-/.]\d{1,4}$/, ey = /^[-+]?(\d{1,3}([ ,.]\d{3})+|\d+)([.,]\d+)?%?$/, ty = new Set([
21909
+ ]), ey = /^\d{1,4}[-/.]\d{1,2}[-/.]\d{1,4}$/, ty = /^[-+]?(\d{1,3}([ ,.]\d{3})+|\d+)([.,]\d+)?%?$/, ny = new Set([
21910
21910
  "number",
21911
21911
  "date",
21912
21912
  "bool"
21913
21913
  ]);
21914
- function ny(e) {
21914
+ function ry(e) {
21915
21915
  if (e == null) return "empty";
21916
21916
  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";
21917
+ return t.length === 0 ? "empty" : $v.has(t.toLowerCase()) ? "bool" : ey.test(t) ? "date" : ty.test(t) ? "number" : "text";
21918
21918
  }
21919
- function ry(e) {
21919
+ function iy(e) {
21920
21920
  return e.filter((e) => e != null && String(e).trim().length > 0).length;
21921
21921
  }
21922
- function iy(e) {
21922
+ function ay(e) {
21923
+ let t = 0;
21924
+ for (let n of e) t = Math.max(t, n.length);
21925
+ return t;
21926
+ }
21927
+ function oy(e) {
21923
21928
  let t = /* @__PURE__ */ new Map(), n = 0, r = 0;
21924
21929
  for (let i of e) {
21925
- let e = ry(i);
21930
+ let e = i.length;
21926
21931
  if (e === 0) continue;
21927
21932
  let a = (t.get(e) ?? 0) + 1;
21928
21933
  t.set(e, a), a > n && (n = a, r = e);
21929
21934
  }
21930
21935
  return r;
21931
21936
  }
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) {
21937
+ function sy(e, t, n) {
21938
21938
  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;
21939
+ for (let r = 0; r < e.length; r++) if (iy(e[r]) / t >= n) return r;
21944
21940
  return 0;
21945
21941
  }
21946
- function sy(e, t, n, r) {
21942
+ function cy(e, t, n, r) {
21947
21943
  let i = /* @__PURE__ */ new Map();
21948
21944
  for (let a = t; a < n; a++) {
21949
- let t = ny(e[a]?.[r]);
21945
+ let t = ry(e[a]?.[r]);
21950
21946
  t !== "empty" && i.set(t, (i.get(t) ?? 0) + 1);
21951
21947
  }
21952
21948
  let a = "empty", o = 0;
21953
21949
  for (let [e, t] of i) t > o && (o = t, a = e);
21954
21950
  return a;
21955
21951
  }
21956
- function cy(e, t, n, r) {
21952
+ function ly(e, t, n, r) {
21957
21953
  let i = 0, a = 0;
21958
21954
  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++);
21955
+ let r = cy(e, t + 1, n, o);
21956
+ r !== "empty" && (a++, ry(e[t]?.[o]) === "text" && ny.has(r) && i++);
21961
21957
  }
21962
21958
  return a === 0 ? 0 : i / a;
21963
21959
  }
21964
- function ly(e, t, n, r) {
21960
+ function uy(e, t, n, r) {
21965
21961
  let i = 0, a = 0;
21966
21962
  for (let o = 0; o < r; o++) {
21967
- let r = sy(e, t, n, o);
21963
+ let r = cy(e, t, n, o);
21968
21964
  if (r !== "empty") for (let s = t; s < n; s++) {
21969
- let t = ny(e[s]?.[o]);
21965
+ let t = ry(e[s]?.[o]);
21970
21966
  t !== "empty" && (a++, t === r && i++);
21971
21967
  }
21972
21968
  }
21973
21969
  return a === 0 ? 0 : i / a;
21974
21970
  }
21975
- function uy(e) {
21976
- let t = e.map(ny).filter((e) => e !== "empty");
21971
+ function dy(e) {
21972
+ let t = e.map(ry).filter((e) => e !== "empty");
21977
21973
  return t.length === 0 ? 0 : 1 - t.filter((e) => e !== "text").length / t.length;
21978
21974
  }
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);
21975
+ function fy(e, t) {
21976
+ return t <= 0 ? 0 : Math.min(1, iy(e) / t);
21983
21977
  }
21984
- function fy(e) {
21978
+ function py(e) {
21985
21979
  let t = e.map((e) => String(e ?? "").trim().toLowerCase()).filter((e) => e.length > 0);
21986
21980
  return t.length === 0 ? 0 : new Set(t).size / t.length;
21987
21981
  }
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] ?? []);
21982
+ function my(e, t, n, r, i) {
21983
+ 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
21984
  }
21991
- function my(e, t = 100) {
21985
+ function hy(e, t = 100) {
21992
21986
  if (e.length === 0) return {
21993
21987
  headerRowIndex: 0,
21994
21988
  dataStartIndex: 0,
@@ -21996,7 +21990,7 @@ function my(e, t = 100) {
21996
21990
  mode: "header",
21997
21991
  review: { kind: "none" }
21998
21992
  };
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;
21993
+ 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
21994
  if (u && c <= .15 && l >= .7) return {
22001
21995
  headerRowIndex: -1,
22002
21996
  dataStartIndex: o,
@@ -22016,7 +22010,7 @@ function my(e, t = 100) {
22016
22010
  review: f
22017
22011
  };
22018
22012
  }
22019
- function hy(e) {
22013
+ function gy(e) {
22020
22014
  let t = /* @__PURE__ */ new Set();
22021
22015
  return e.map((e) => {
22022
22016
  let n = e, r = 2;
@@ -22026,7 +22020,7 @@ function hy(e) {
22026
22020
  }
22027
22021
  //#endregion
22028
22022
  //#region src/components/DataUploader/components/StepHeaderSelection/context/useViewModel.tsx
22029
- function gy(e, t, n, r) {
22023
+ function _y(e, t, n, r) {
22030
22024
  return v(() => ({
22031
22025
  sample: e,
22032
22026
  selectedRow: t,
@@ -22041,20 +22035,20 @@ function gy(e, t, n, r) {
22041
22035
  }
22042
22036
  //#endregion
22043
22037
  //#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, {
22038
+ var vy = s(null);
22039
+ function yy({ sample: e, selectedRow: t, selectRow: n, noHeader: r, children: i }) {
22040
+ let a = _y(e, t, n, r);
22041
+ return /* @__PURE__ */ C(vy.Provider, {
22048
22042
  value: a,
22049
22043
  children: i
22050
22044
  });
22051
22045
  }
22052
- var yy = () => {
22053
- let e = p(_y);
22046
+ var by = () => {
22047
+ let e = p(vy);
22054
22048
  if (!e) throw Error("useHeaderSelection must be used within HeaderSelectionProvider");
22055
22049
  return e;
22056
- }, by = () => {
22057
- let { sample: e, selectedRow: t, selectRow: n, noHeader: r } = yy(), { headers: i } = Bb(), { headers: a, rows: o } = v(() => {
22050
+ }, xy = () => {
22051
+ let { sample: e, selectedRow: t, selectRow: n, noHeader: r } = by(), { headers: i } = Vb(), { headers: a, rows: o } = v(() => {
22058
22052
  let t = i.length;
22059
22053
  return {
22060
22054
  headers: i.map((e) => r ? e : ""),
@@ -22074,13 +22068,13 @@ var yy = () => {
22074
22068
  selectedRow: r ? void 0 : t,
22075
22069
  onSelectRow: r ? void 0 : n
22076
22070
  });
22077
- }, xy = () => {
22078
- let { t: e } = K(), { parsedCsv: t, headerRowIndex: n, setHeaderRowIndex: r } = Bb(), i = f((e) => {
22071
+ }, Sy = () => {
22072
+ let { t: e } = K(), { parsedCsv: t, headerRowIndex: n, setHeaderRowIndex: r } = Vb(), i = f((e) => {
22079
22073
  r(e ? -1 : Math.max(0, t?.detection.headerRowIndex ?? 0));
22080
22074
  }, [r, t]);
22081
22075
  if (!t) return null;
22082
22076
  let a = t.rawRows.slice(0, 50), o = n < 0;
22083
- return /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ C(Jl, { children: /* @__PURE__ */ w(vy, {
22077
+ return /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ C(Jl, { children: /* @__PURE__ */ w(yy, {
22084
22078
  sample: a,
22085
22079
  selectedRow: o ? void 0 : n,
22086
22080
  selectRow: r,
@@ -22094,10 +22088,10 @@ var yy = () => {
22094
22088
  onChange: i,
22095
22089
  label: e("dataEditor.uploader.headerSelection.noHeaderLabel")
22096
22090
  })
22097
- }), /* @__PURE__ */ C(by, {})]
22091
+ }), /* @__PURE__ */ C(xy, {})]
22098
22092
  }), /* @__PURE__ */ C(bv, {})]
22099
22093
  }) }) });
22100
- }, Sy = ({ open: e, existingOptions: t, initialName: n, onClose: r, onSubmit: i }) => {
22094
+ }, Cy = ({ open: e, existingOptions: t, initialName: n, onClose: r, onSubmit: i }) => {
22101
22095
  let { t: a } = K();
22102
22096
  return /* @__PURE__ */ C(Vi, {
22103
22097
  open: e,
@@ -22110,13 +22104,13 @@ var yy = () => {
22110
22104
  onSubmit: i
22111
22105
  })
22112
22106
  });
22113
- }, Cy = [
22107
+ }, wy = [
22114
22108
  ",",
22115
22109
  ";",
22116
22110
  "|",
22117
22111
  "\n",
22118
22112
  " "
22119
- ], wy = (e, t, n) => {
22113
+ ], Ty = (e, t, n) => {
22120
22114
  let r = new Set(n.map((e) => e.trim().toLowerCase())), i = (e) => r.has(e.trim().toLowerCase());
22121
22115
  if (e.trim() === "") return [];
22122
22116
  if (i(e)) return [e.trim()];
@@ -22128,31 +22122,31 @@ var yy = () => {
22128
22122
  a.push(e);
22129
22123
  continue;
22130
22124
  }
22131
- a.push(...Ty(e, t, i));
22125
+ a.push(...Ey(e, t, i));
22132
22126
  }
22133
22127
  }
22134
22128
  return a;
22135
- }, Ty = (e, t, n) => {
22136
- for (let r of Cy) {
22129
+ }, Ey = (e, t, n) => {
22130
+ for (let r of wy) {
22137
22131
  if (r === t || !e.includes(r)) continue;
22138
22132
  let i = e.split(r).map((e) => e.trim()).filter((e) => e !== "");
22139
22133
  if (i.length >= 2 && i.every(n)) return i;
22140
22134
  }
22141
22135
  return [e];
22142
- }, Ey = (e, t, n) => {
22136
+ }, Dy = (e, t, n) => {
22143
22137
  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);
22138
+ for (let i of e) if (i !== "") if (n) for (let e of Ty(i, n, t)) r.add(e);
22145
22139
  else r.add(i);
22146
22140
  return [...r];
22147
- }, Dy = (e) => !e.some((e) => e != null && String(e).trim() !== ""), Oy = (e, t) => {
22141
+ }, Oy = (e) => !e.some((e) => e != null && String(e).trim() !== ""), ky = (e, t) => {
22148
22142
  let n = 0;
22149
22143
  for (let r = t; r < e.length; r++) n = Math.max(n, e[r].length);
22150
22144
  return n;
22151
- }, ky = 50, Ay = (e, t, n) => {
22152
- let r = Math.min(e.length, t + ky);
22145
+ }, Ay = 50, jy = (e, t, n) => {
22146
+ let r = Math.min(e.length, t + Ay);
22153
22147
  for (let i = t; i < r; i++) {
22154
22148
  let t = e[i];
22155
- if (!t || Dy(t)) continue;
22149
+ if (!t || Oy(t)) continue;
22156
22150
  let r = !0;
22157
22151
  for (let e = 0; e < n; e++) {
22158
22152
  let n = t[e];
@@ -22166,60 +22160,64 @@ var yy = () => {
22166
22160
  return Array.from({ length: n }, (n, i) => {
22167
22161
  for (let n = t; n < r; n++) {
22168
22162
  let t = e[n];
22169
- if (!t || Dy(t)) continue;
22163
+ if (!t || Oy(t)) continue;
22170
22164
  let r = t[i], a = r == null ? "" : String(r).trim();
22171
22165
  if (a !== "") return a;
22172
22166
  }
22173
22167
  return "";
22174
22168
  });
22175
- }, jy = (e, t) => t === e.headerRowIndex ? e.dataStartIndex : t + 1, My = (e, t, n, r) => {
22169
+ }, My = (e, t) => t === e.headerRowIndex ? e.dataStartIndex : t + 1, Ny = (e, t, n, r) => {
22176
22170
  if (t < 0) {
22177
- let t = Oy(e, n), i = Ay(e, n, t);
22171
+ let t = ky(e, n), i = jy(e, n, t);
22178
22172
  return Array.from({ length: t }, (e, t) => r(t, i[t]));
22179
22173
  }
22180
- return hy((e[t] ?? []).map((e) => String(e ?? "").trim()));
22181
- }, Ny = () => ({
22174
+ let i = e[t] ?? [], a = Math.max(i.length, ky(e, n)), o = jy(e, n, a);
22175
+ return gy(Array.from({ length: a }, (e, t) => {
22176
+ let n = String(i[t] ?? "").trim();
22177
+ return n === "" ? r(t, o[t]) : n;
22178
+ }));
22179
+ }, Py = () => ({
22182
22180
  headerRowIndex: 0,
22183
22181
  dataStartIndex: 1,
22184
22182
  confidence: 1,
22185
22183
  mode: "header",
22186
22184
  review: { kind: "none" }
22187
- }), Py = (e, t) => {
22185
+ }), Fy = (e, t) => {
22188
22186
  let n = [e];
22189
22187
  for (let r of t) n.push(e.map((e) => r[e] ?? ""));
22190
22188
  return n;
22191
- }, Fy = (e) => {
22189
+ }, Iy = (e) => {
22192
22190
  let t = /* @__PURE__ */ new Map();
22193
22191
  for (let n = 0; n < e.length; n++) t.set(e[n], n);
22194
22192
  return t;
22195
- }, Iy = (e, t, n) => {
22193
+ }, Ly = (e, t, n) => {
22196
22194
  let r = [];
22197
22195
  for (let i = t; i < e.length; i++) {
22198
22196
  let t = e[i];
22199
- if (Dy(t)) continue;
22197
+ if (Oy(t)) continue;
22200
22198
  let a = t[n], o = a == null ? "" : String(a);
22201
22199
  o !== "" && r.push(o);
22202
22200
  }
22203
22201
  return r;
22204
- }, Ly = (e, t) => {
22202
+ }, Ry = (e, t) => {
22205
22203
  let n = {};
22206
22204
  for (let r = 0; r < t.length; r++) n[t[r]] = String(e[r] ?? "");
22207
22205
  return n;
22208
- }, Ry = (e, t, n, r) => {
22206
+ }, zy = (e, t, n, r) => {
22209
22207
  let i = [];
22210
- for (let a = n; a < e.length && i.length < r; a++) Dy(e[a]) || i.push(Ly(e[a], t));
22208
+ for (let a = n; a < e.length && i.length < r; a++) Oy(e[a]) || i.push(Ry(e[a], t));
22211
22209
  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(() => {
22210
+ }, By = () => {
22211
+ 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
22212
  if (!n) return [];
22215
- let t = [], s = Fy(r);
22213
+ let t = [], s = Iy(r);
22216
22214
  for (let [r, c] of Object.entries(a)) {
22217
22215
  if (!c) continue;
22218
22216
  let a = e.find((e) => e.id === c);
22219
22217
  if (!a?.editor) continue;
22220
22218
  let u = a.editor.type;
22221
22219
  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) => ({
22220
+ 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
22221
  imported: e,
22224
22222
  mapped: f[e]
22225
22223
  }));
@@ -22342,20 +22340,20 @@ var yy = () => {
22342
22340
  submitCreate: R,
22343
22341
  closeCreate: z
22344
22342
  };
22345
- }, By = s(null);
22346
- function Vy({ children: e }) {
22347
- let t = zy();
22348
- return /* @__PURE__ */ C(By.Provider, {
22343
+ }, Vy = s(null);
22344
+ function Hy({ children: e }) {
22345
+ let t = By();
22346
+ return /* @__PURE__ */ C(Vy.Provider, {
22349
22347
  value: t,
22350
22348
  children: e
22351
22349
  });
22352
22350
  }
22353
- var Hy = () => {
22354
- let e = p(By);
22351
+ var Uy = () => {
22352
+ let e = p(Vy);
22355
22353
  if (!e) throw Error("useValueMatching must be used within ValueMatchingProvider");
22356
22354
  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]);
22355
+ }, Wy = ({ section: e }) => {
22356
+ 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
22357
  return /* @__PURE__ */ w("header", {
22360
22358
  className: "updog__value-matching__section-header",
22361
22359
  children: [/* @__PURE__ */ C("div", {
@@ -22399,14 +22397,14 @@ var Hy = () => {
22399
22397
  })
22400
22398
  })]
22401
22399
  });
22402
- }, Wy = {
22400
+ }, Gy = {
22403
22401
  ",": ",",
22404
22402
  ";": ";",
22405
22403
  "|": "|",
22406
22404
  "\n": "\\n",
22407
22405
  " ": "\\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);
22406
+ }, Ky = (e) => e === null ? "" : Gy[e] ?? e, qy = ({ section: e }) => {
22407
+ 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
22408
  m(() => {
22411
22409
  s(a), l.current = a;
22412
22410
  }, [a]), m(() => {
@@ -22449,8 +22447,8 @@ var Hy = () => {
22449
22447
  })
22450
22448
  ]
22451
22449
  });
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), [
22450
+ }, Jy = ({ section: e, val: t }) => {
22451
+ let { t: n } = K(), { getSelectOptions: r, selectValue: i } = Uy(), a = t.mapped === void 0, o = f((n) => i(e.columnId, t.imported, n), [
22454
22452
  i,
22455
22453
  e.columnId,
22456
22454
  t.imported
@@ -22502,8 +22500,8 @@ var Hy = () => {
22502
22500
  })
22503
22501
  ]
22504
22502
  });
22505
- }, Jy = ({ section: e }) => {
22506
- let { t } = K(), { getVisibleValues: n } = Hy(), r = n(e);
22503
+ }, Yy = ({ section: e }) => {
22504
+ let { t } = K(), { getVisibleValues: n } = Uy(), r = n(e);
22507
22505
  return /* @__PURE__ */ w("div", {
22508
22506
  className: "updog__value-matching__table",
22509
22507
  children: [r.length === 0 ? /* @__PURE__ */ C("div", {
@@ -22523,7 +22521,7 @@ var Hy = () => {
22523
22521
  size: "sm",
22524
22522
  weight: "medium",
22525
22523
  children: t("dataEditor.uploader.matchValues.importedValues")
22526
- }), e.isMultiselect && /* @__PURE__ */ C(Ky, { section: e })]
22524
+ }), e.isMultiselect && /* @__PURE__ */ C(qy, { section: e })]
22527
22525
  }),
22528
22526
  /* @__PURE__ */ C("div", { className: "updog__value-matching__arrow-spacer" }),
22529
22527
  /* @__PURE__ */ C(q, {
@@ -22535,25 +22533,25 @@ var Hy = () => {
22535
22533
  }),
22536
22534
  /* @__PURE__ */ C("div", { className: "updog__value-matching__action" })
22537
22535
  ]
22538
- }), r.map((t) => /* @__PURE__ */ C(qy, {
22536
+ }), r.map((t) => /* @__PURE__ */ C(Jy, {
22539
22537
  section: e,
22540
22538
  val: t
22541
22539
  }, t.imported))]
22542
22540
  });
22543
- }, Yy = ({ section: e }) => {
22544
- let { isCollapsed: t } = Hy(), n = !t(e.columnId);
22541
+ }, Xy = ({ section: e }) => {
22542
+ let { isCollapsed: t } = Uy(), n = !t(e.columnId);
22545
22543
  return /* @__PURE__ */ w("div", {
22546
22544
  className: "updog__value-matching__section",
22547
- children: [/* @__PURE__ */ C(Uy, { section: e }), /* @__PURE__ */ C("div", {
22545
+ children: [/* @__PURE__ */ C(Wy, { section: e }), /* @__PURE__ */ C("div", {
22548
22546
  className: E("updog__value-matching__collapsible", n && "updog__value-matching__collapsible--expanded"),
22549
- children: /* @__PURE__ */ C(Jy, { section: e })
22547
+ children: /* @__PURE__ */ C(Yy, { section: e })
22550
22548
  })]
22551
22549
  });
22552
- }, Xy = () => {
22553
- let { sections: e, hasCreateTarget: t, createForOptions: n, createInitialName: r, submitCreate: i, closeCreate: a } = Hy();
22550
+ }, Zy = () => {
22551
+ let { sections: e, hasCreateTarget: t, createForOptions: n, createInitialName: r, submitCreate: i, closeCreate: a } = Uy();
22554
22552
  return /* @__PURE__ */ w("div", {
22555
22553
  className: "updog__value-matching",
22556
- children: [e.map((e) => /* @__PURE__ */ C(Yy, { section: e }, e.columnId)), t && /* @__PURE__ */ C(Sy, {
22554
+ children: [e.map((e) => /* @__PURE__ */ C(Xy, { section: e }, e.columnId)), t && /* @__PURE__ */ C(Cy, {
22557
22555
  open: !0,
22558
22556
  existingOptions: n,
22559
22557
  initialName: r,
@@ -22561,15 +22559,15 @@ var Hy = () => {
22561
22559
  onSubmit: i
22562
22560
  })]
22563
22561
  });
22564
- }, Zy = () => /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ w(Jl, { children: [/* @__PURE__ */ C("div", {
22562
+ }, Qy = () => /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ w(Jl, { children: [/* @__PURE__ */ C("div", {
22565
22563
  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(() => {
22564
+ children: /* @__PURE__ */ C(Hy, { children: /* @__PURE__ */ C(Zy, {}) })
22565
+ }), /* @__PURE__ */ C(bv, {})] }) }), $y = 20, eb = () => {
22566
+ 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
22567
  let e = {};
22570
22568
  for (let [t, n] of Object.entries(s)) n && (e[n] = t);
22571
22569
  return e;
22572
- }, [s]), p = v(() => i ? Ry(i.rawRows, a, o, Qy) : [], [
22570
+ }, [s]), p = v(() => i ? zy(i.rawRows, a, o, $y) : [], [
22573
22571
  i,
22574
22572
  a,
22575
22573
  o
@@ -22621,8 +22619,8 @@ var Hy = () => {
22621
22619
  }, e.id);
22622
22620
  })]
22623
22621
  });
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 = [
22622
+ }, tb = () => /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ w(Jl, { children: [/* @__PURE__ */ C(eb, {}), /* @__PURE__ */ C(bv, {})] }) }), nb = () => {
22623
+ 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
22624
  {
22627
22625
  id: "csv",
22628
22626
  format: "csv",
@@ -22680,20 +22678,20 @@ var Hy = () => {
22680
22678
  }, [c]),
22681
22679
  handleRemoteSourceSelect: m
22682
22680
  };
22683
- }, nb = s(null);
22684
- function rb({ children: e }) {
22685
- let t = tb();
22686
- return /* @__PURE__ */ C(nb.Provider, {
22681
+ }, rb = s(null);
22682
+ function ib({ children: e }) {
22683
+ let t = nb();
22684
+ return /* @__PURE__ */ C(rb.Provider, {
22687
22685
  value: t,
22688
22686
  children: e
22689
22687
  });
22690
22688
  }
22691
- var ib = () => {
22692
- let e = p(nb);
22689
+ var ab = () => {
22690
+ let e = p(rb);
22693
22691
  if (!e) throw Error("useSelectFiles must be used within SelectFilesProvider");
22694
22692
  return e;
22695
- }, ab = () => {
22696
- let { t: e } = K(), { exampleMenuOptions: t, onExampleDownload: n } = ib();
22693
+ }, ob = () => {
22694
+ let { t: e } = K(), { exampleMenuOptions: t, onExampleDownload: n } = ab();
22697
22695
  return /* @__PURE__ */ C(Fa, {
22698
22696
  options: t,
22699
22697
  onSelect: n,
@@ -22705,7 +22703,7 @@ var ib = () => {
22705
22703
  children: e("dataEditor.uploader.uploadFile.downloadExample")
22706
22704
  })
22707
22705
  });
22708
- }, ob = ({ source: e }) => e.icon.trimStart().startsWith("<") ? /* @__PURE__ */ C("span", {
22706
+ }, sb = ({ source: e }) => e.icon.trimStart().startsWith("<") ? /* @__PURE__ */ C("span", {
22709
22707
  className: "updog__remote-source-btn__icon",
22710
22708
  dangerouslySetInnerHTML: { __html: e.icon }
22711
22709
  }) : /* @__PURE__ */ C("span", {
@@ -22714,7 +22712,7 @@ var ib = () => {
22714
22712
  src: e.icon,
22715
22713
  alt: e.label
22716
22714
  })
22717
- }), sb = ({ source: e, loading: t, disabled: n, onSelect: r }) => /* @__PURE__ */ C(J, {
22715
+ }), cb = ({ source: e, loading: t, disabled: n, onSelect: r }) => /* @__PURE__ */ C(J, {
22718
22716
  variant: "filled",
22719
22717
  color: "neutral",
22720
22718
  size: "sm",
@@ -22724,11 +22722,11 @@ var ib = () => {
22724
22722
  disabled: !t && n,
22725
22723
  loading: t,
22726
22724
  spinnerPosition: "start",
22727
- startIcon: /* @__PURE__ */ C(ob, { source: e }),
22725
+ startIcon: /* @__PURE__ */ C(sb, { source: e }),
22728
22726
  title: e.description,
22729
22727
  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;
22728
+ }), lb = () => {
22729
+ let { t: e } = K(), { importFormats: t, remoteSources: n, remoteSourceLoading: r, remoteSourceError: i, handleRemoteSourceSelect: a } = ab(), o = n.length > 0;
22732
22730
  return /* @__PURE__ */ w("div", {
22733
22731
  className: "updog__source-picker",
22734
22732
  children: [
@@ -22755,7 +22753,7 @@ var ib = () => {
22755
22753
  }),
22756
22754
  o && /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(Oa, {}), /* @__PURE__ */ C("div", {
22757
22755
  className: "updog__source-picker__sources-list",
22758
- children: n.map((e) => /* @__PURE__ */ C(sb, {
22756
+ children: n.map((e) => /* @__PURE__ */ C(cb, {
22759
22757
  source: e,
22760
22758
  loading: r === e.id,
22761
22759
  disabled: !!r,
@@ -22769,7 +22767,7 @@ var ib = () => {
22769
22767
  })
22770
22768
  ]
22771
22769
  });
22772
- }, lb = () => {
22770
+ }, ub = () => {
22773
22771
  let { t: e } = K();
22774
22772
  return /* @__PURE__ */ w("div", {
22775
22773
  className: "updog__uploading-state",
@@ -22782,12 +22780,12 @@ var ib = () => {
22782
22780
  children: e("dataEditor.uploader.uploadFile.uploading")
22783
22781
  })]
22784
22782
  });
22785
- }, ub = () => {
22786
- let { t: e } = K(), { isBlocked: t, isParsing: n, hasFile: r, fileName: i, open: a, onRemoveClick: o } = ib();
22783
+ }, db = () => {
22784
+ let { t: e } = K(), { isBlocked: t, isParsing: n, hasFile: r, fileName: i, open: a, onRemoveClick: o } = ab();
22787
22785
  return /* @__PURE__ */ C("div", {
22788
22786
  className: E("updog__step-select-files__upload-area", t && "updog__step-select-files__upload-area--disabled"),
22789
22787
  onClick: t ? void 0 : a,
22790
- children: n ? /* @__PURE__ */ C(lb, {}) : /* @__PURE__ */ w(S, { children: [
22788
+ children: n ? /* @__PURE__ */ C(ub, {}) : /* @__PURE__ */ w(S, { children: [
22791
22789
  /* @__PURE__ */ C("div", {
22792
22790
  className: "updog__step-select-files__icon-container",
22793
22791
  children: r ? /* @__PURE__ */ C(I, {
@@ -22798,7 +22796,7 @@ var ib = () => {
22798
22796
  className: "updog__step-select-files__icon"
22799
22797
  })
22800
22798
  }),
22801
- !r && /* @__PURE__ */ C(cb, {}),
22799
+ !r && /* @__PURE__ */ C(lb, {}),
22802
22800
  r && /* @__PURE__ */ w("div", {
22803
22801
  className: "updog__step-select-files__info",
22804
22802
  children: [/* @__PURE__ */ C(q, {
@@ -22815,19 +22813,19 @@ var ib = () => {
22815
22813
  })
22816
22814
  ] })
22817
22815
  });
22818
- }, db = () => {
22819
- let { getRootProps: e, getInputProps: t, isDragActive: n } = ib();
22816
+ }, fb = () => {
22817
+ let { getRootProps: e, getInputProps: t, isDragActive: n } = ab();
22820
22818
  return /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ w("div", {
22821
22819
  className: "updog__step-select-files__dropzone",
22822
22820
  ...e(),
22823
22821
  children: [
22824
22822
  /* @__PURE__ */ C("input", { ...t() }),
22825
- /* @__PURE__ */ w(Jl, { children: [/* @__PURE__ */ C(ub, {}), /* @__PURE__ */ C(bv, { leftSlot: /* @__PURE__ */ C(ab, {}) })] }),
22823
+ /* @__PURE__ */ w(Jl, { children: [/* @__PURE__ */ C(db, {}), /* @__PURE__ */ C(bv, { leftSlot: /* @__PURE__ */ C(ob, {}) })] }),
22826
22824
  n && /* @__PURE__ */ C(Yl, {})
22827
22825
  ]
22828
22826
  }) });
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(() => {
22827
+ }, pb = () => /* @__PURE__ */ C(ib, { children: /* @__PURE__ */ C(fb, {}) }), mb = ({ preview: e }) => {
22828
+ let { selectedSheet: t, setSelectedSheet: n } = Vb(), { t: r } = K(), i = Math.max(0, e.totalRows), a = t === e.name, o = v(() => {
22831
22829
  let { headers: t, rows: n } = e;
22832
22830
  return [t, ...n.map((e) => t.map((t) => e[t] ?? ""))];
22833
22831
  }, [e]);
@@ -22863,16 +22861,16 @@ var ib = () => {
22863
22861
  })]
22864
22862
  })
22865
22863
  });
22866
- }, mb = () => {
22867
- let { sheetPreviews: e } = Bb();
22864
+ }, hb = () => {
22865
+ let { sheetPreviews: e } = Vb();
22868
22866
  return /* @__PURE__ */ C(Xl, { children: /* @__PURE__ */ w(Jl, { children: [/* @__PURE__ */ C("div", {
22869
22867
  className: "updog__sheet-preview-wrapper updog__scrollbar",
22870
22868
  children: /* @__PURE__ */ C("div", {
22871
22869
  className: "updog__sheet-preview-grid",
22872
- children: e.map((e) => /* @__PURE__ */ C(pb, { preview: e }, e.name))
22870
+ children: e.map((e) => /* @__PURE__ */ C(mb, { preview: e }, e.name))
22873
22871
  })
22874
22872
  }), /* @__PURE__ */ C(bv, {})] }) });
22875
- }, hb = (e, t, n) => {
22873
+ }, gb = (e, t, n) => {
22876
22874
  let r = new Map(t.map((e) => [e.id, e])), i = [];
22877
22875
  for (let [t, a] of Object.entries(e)) a && i.push({
22878
22876
  csvHeader: t,
@@ -22880,11 +22878,11 @@ var ib = () => {
22880
22878
  column: n.has(a) ? void 0 : r.get(a)
22881
22879
  });
22882
22880
  return i;
22883
- }, gb = (e) => {
22881
+ }, _b = (e) => {
22884
22882
  let t = [];
22885
22883
  for (let { csvHeader: n, column: r } of e) r?.editor?.type === "number" && t.push(n);
22886
22884
  return t;
22887
- }, _b = (e, t, n) => {
22885
+ }, vb = (e, t, n) => {
22888
22886
  let r = {};
22889
22887
  for (let { csvHeader: i, columnId: a, column: o } of t) {
22890
22888
  let t = e[i] ?? "";
@@ -22899,7 +22897,7 @@ var ib = () => {
22899
22897
  continue;
22900
22898
  }
22901
22899
  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();
22900
+ let e = n.multiselectDelimiters[a], i = o.editor.options ?? [], s = e ? Ty(t, e, i) : t === "" ? [] : [t], c = [], l = /* @__PURE__ */ new Set();
22903
22901
  for (let e of s) {
22904
22902
  let t = n.valueMapping[a]?.[e.trim()];
22905
22903
  t !== void 0 && !l.has(t) && (l.add(t), c.push(t));
@@ -22911,16 +22909,16 @@ var ib = () => {
22911
22909
  r[a] = o.transformer ? o.transformer(c) : c;
22912
22910
  }
22913
22911
  return r;
22914
- }, vb = 200, yb = (e, t, n) => {
22912
+ }, yb = 200, bb = (e, t, n) => {
22915
22913
  if (n) return n;
22916
22914
  let r = new Set(t.map((e) => e.trim().toLowerCase())), i = (e) => r.has(e.trim().toLowerCase()), a = /* @__PURE__ */ new Set(), o = [];
22917
22915
  for (let t of e) {
22918
22916
  let e = t.trim();
22919
- if (!(e === "" || a.has(e)) && (a.add(e), o.push(e), o.length >= vb)) break;
22917
+ if (!(e === "" || a.has(e)) && (a.add(e), o.push(e), o.length >= yb)) break;
22920
22918
  }
22921
22919
  if (o.length === 0) return null;
22922
22920
  let s = null, c = 0, l = 0;
22923
- for (let e of Cy) {
22921
+ for (let e of wy) {
22924
22922
  let n = 0, r = 0;
22925
22923
  for (let a of o) {
22926
22924
  if (i(a) || !a.includes(e)) continue;
@@ -22933,7 +22931,7 @@ var ib = () => {
22933
22931
  (n > c || n === c && n > 0 && r > l) && (s = e, c = n, l = r);
22934
22932
  }
22935
22933
  return c > 0 ? s : null;
22936
- }, bb = (e) => {
22934
+ }, xb = (e) => {
22937
22935
  let t = /* @__PURE__ */ new Map();
22938
22936
  for (let [n, r] of Object.entries(e)) {
22939
22937
  let e = wv(n), i = t.get(e) ?? /* @__PURE__ */ new Set();
@@ -22941,8 +22939,8 @@ var ib = () => {
22941
22939
  t.set(e, i);
22942
22940
  }
22943
22941
  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) => {
22942
+ }, Sb = (e, t, n, r) => {
22943
+ 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
22944
  if (wv(n) === wv(r) || a(r, n)) return;
22947
22945
  let i = `${n} ${r}`;
22948
22946
  t.has(i) || (t.add(i), e.push({
@@ -22962,16 +22960,16 @@ var ib = () => {
22962
22960
  for (let e of Object.values(t)) for (let [t, n] of Object.entries(e)) n && u(t, n);
22963
22961
  return c;
22964
22962
  };
22965
- function Sb(e, t, n) {
22963
+ function Cb(e, t, n) {
22966
22964
  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);
22965
+ 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
22966
  }
22969
- function Cb(e, t) {
22967
+ function wb(e, t) {
22970
22968
  let n = Math.min(t, e - t), r = 1;
22971
22969
  for (let t = 1; t <= n; t++) if (r = r * (e - n + t) / t, r > 1e3) return r;
22972
22970
  return r;
22973
22971
  }
22974
- function wb(e, t) {
22972
+ function Tb(e, t) {
22975
22973
  let n = e.length, r = [], i = [], a = (o) => {
22976
22974
  if (i.length === n) {
22977
22975
  let a = Array(t).fill("");
@@ -22983,7 +22981,7 @@ function wb(e, t) {
22983
22981
  };
22984
22982
  return a(0), r;
22985
22983
  }
22986
- function Tb(e, t, n) {
22984
+ function Eb(e, t, n) {
22987
22985
  let r = e.length, i = [], a = [], o = (s) => {
22988
22986
  if (a.length === t - 1) {
22989
22987
  let o = [
@@ -23001,27 +22999,27 @@ function Tb(e, t, n) {
23001
22999
  }
23002
23000
  //#endregion
23003
23001
  //#region src/components/DataUploader/utils/raggedRows/pruneByValidators.ts
23004
- var Eb = {};
23005
- function Db(e, t) {
23002
+ var Db = {};
23003
+ function Ob(e, t) {
23006
23004
  for (let n of t.validators ?? []) if (n.type !== "expression") {
23007
23005
  if (n.type === "function") {
23008
- if (n.fn(e, Eb) != null) return !1;
23006
+ if (n.fn(e, Db) != null) return !1;
23009
23007
  continue;
23010
23008
  }
23011
- if (Al(n, e, Eb) != null) return !1;
23009
+ if (Al(n, e, Db) != null) return !1;
23012
23010
  }
23013
23011
  return !0;
23014
23012
  }
23015
- function Ob(e, t) {
23016
- for (let n = 0; n < t.length; n++) if (!Db(e.cells[n] ?? "", t[n])) return !1;
23013
+ function kb(e, t) {
23014
+ for (let n = 0; n < t.length; n++) if (!Ob(e.cells[n] ?? "", t[n])) return !1;
23017
23015
  return !0;
23018
23016
  }
23019
- function kb(e, t) {
23020
- return e.filter((e) => Ob(e, t));
23017
+ function Ab(e, t) {
23018
+ return e.filter((e) => kb(e, t));
23021
23019
  }
23022
23020
  //#endregion
23023
23021
  //#region src/components/DataUploader/utils/raggedRows/computeDisputeSpans.ts
23024
- function Ab(e) {
23022
+ function jb(e) {
23025
23023
  if (e.length <= 1) return [];
23026
23024
  let t = e[0].cells.length, n = [], r = -1;
23027
23025
  for (let i = 0; i < t; i++) {
@@ -23038,25 +23036,25 @@ function Ab(e) {
23038
23036
  }
23039
23037
  //#endregion
23040
23038
  //#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);
23039
+ function Mb(e, t, n) {
23040
+ let r = Cb(e, t.length, n), i = Ab(r, t);
23043
23041
  return i.length === 1 ? {
23044
23042
  kind: "confident",
23045
23043
  alignment: i[0]
23046
23044
  } : i.length > 1 ? {
23047
23045
  kind: "ambiguous",
23048
23046
  candidates: i,
23049
- disputeSpans: Ab(i)
23047
+ disputeSpans: jb(i)
23050
23048
  } : {
23051
23049
  kind: "invalid",
23052
23050
  candidates: r,
23053
- disputeSpans: Ab(r)
23051
+ disputeSpans: jb(r)
23054
23052
  };
23055
23053
  }
23056
23054
  //#endregion
23057
23055
  //#region src/components/DataUploader/utils/raggedRows/resolveRaggedRow.ts
23058
- function Mb(e, t, n) {
23059
- let r = jb(e, t, n);
23056
+ function Nb(e, t, n) {
23057
+ let r = Mb(e, t, n);
23060
23058
  if (r.kind === "confident") return {
23061
23059
  cells: r.alignment.cells,
23062
23060
  conflictColumns: []
@@ -23075,20 +23073,20 @@ function Mb(e, t, n) {
23075
23073
  }
23076
23074
  //#endregion
23077
23075
  //#region src/components/DataUploader/context/useViewModel.tsx
23078
- var Nb = 5e3, Pb = 15, Fb = 20, Ib = new Set([
23076
+ var Pb = 5e3, Fb = 15, Ib = 20, Lb = new Set([
23079
23077
  "xlsx",
23080
23078
  "xls",
23081
23079
  "xlsb",
23082
23080
  "ods"
23083
23081
  ]);
23084
- function Lb() {
23082
+ function Rb() {
23085
23083
  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
23084
  let e = new Set(Object.values(T).filter(Boolean));
23087
23085
  return n.filter((t) => t.unique && e.has(t.id));
23088
23086
  }, [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
23087
  index: e + 1,
23090
23088
  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) : [], [
23089
+ }) : 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
23090
  S,
23093
23091
  oe,
23094
23092
  le,
@@ -23106,16 +23104,16 @@ function Lb() {
23106
23104
  let e = [{
23107
23105
  id: "select-files",
23108
23106
  title: p("dataEditor.uploader.steps.selectFiles"),
23109
- content: /* @__PURE__ */ C(fb, {})
23107
+ content: /* @__PURE__ */ C(pb, {})
23110
23108
  }];
23111
23109
  return I.length > 1 && e.push({
23112
23110
  id: "sheet-selection",
23113
23111
  title: p("dataEditor.uploader.steps.sheetSelection"),
23114
- content: /* @__PURE__ */ C(mb, {})
23112
+ content: /* @__PURE__ */ C(hb, {})
23115
23113
  }), S && S.detection.review.kind !== "none" && e.push({
23116
23114
  id: "header-selection",
23117
23115
  title: p("dataEditor.uploader.steps.headerSelection"),
23118
- content: /* @__PURE__ */ C(xy, {})
23116
+ content: /* @__PURE__ */ C(Sy, {})
23119
23117
  }), e.push({
23120
23118
  id: "column-matching",
23121
23119
  title: p("dataEditor.uploader.steps.matchColumns"),
@@ -23123,11 +23121,11 @@ function Lb() {
23123
23121
  }), me && e.push({
23124
23122
  id: "match-values",
23125
23123
  title: p("dataEditor.uploader.steps.matchValues"),
23126
- content: /* @__PURE__ */ C(Zy, {})
23124
+ content: /* @__PURE__ */ C(Qy, {})
23127
23125
  }), D.length > 0 && he && e.push({
23128
23126
  id: "primary-key",
23129
23127
  title: p("dataEditor.uploader.steps.primaryKey"),
23130
- content: /* @__PURE__ */ C(eb, {})
23128
+ content: /* @__PURE__ */ C(tb, {})
23131
23129
  }), e;
23132
23130
  }, [
23133
23131
  D.length,
@@ -23171,7 +23169,7 @@ function Lb() {
23171
23169
  sheetName: R
23172
23170
  }).then((e) => {
23173
23171
  if (e.kind !== "rows") return;
23174
- let t = my(e.rows);
23172
+ let t = hy(e.rows);
23175
23173
  se(t.headerRowIndex), Se({
23176
23174
  fileName: P.name,
23177
23175
  rawRows: e.rows,
@@ -23195,7 +23193,7 @@ function Lb() {
23195
23193
  j(!1);
23196
23194
  return;
23197
23195
  }
23198
- let n = my(e.rows);
23196
+ let n = hy(e.rows);
23199
23197
  if (se(n.headerRowIndex), Se({
23200
23198
  fileName: t.name,
23201
23199
  rawRows: e.rows,
@@ -23229,8 +23227,8 @@ function Lb() {
23229
23227
  if (e.kind !== "records") return;
23230
23228
  se(0), Se({
23231
23229
  fileName: t.name,
23232
- rawRows: Py(e.headers, e.rows),
23233
- detection: Ny()
23230
+ rawRows: Fy(e.headers, e.rows),
23231
+ detection: Py()
23234
23232
  });
23235
23233
  } catch (t) {
23236
23234
  j(!1), e.errorHandler.handleError({
@@ -23251,8 +23249,8 @@ function Lb() {
23251
23249
  if (e.kind !== "records") return;
23252
23250
  se(0), Se({
23253
23251
  fileName: t.name,
23254
- rawRows: Py(e.headers, e.rows),
23255
- detection: Ny()
23252
+ rawRows: Fy(e.headers, e.rows),
23253
+ detection: Py()
23256
23254
  });
23257
23255
  } catch (t) {
23258
23256
  j(!1), e.errorHandler.handleError({
@@ -23271,11 +23269,11 @@ function Lb() {
23271
23269
  pe.parse(t, { format: "xlsx" }).then((e) => {
23272
23270
  if (e.kind === "sheets") {
23273
23271
  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);
23272
+ let t = hy(e.rows), n = My(t, t.headerRowIndex), r = Ny(e.rows, t.headerRowIndex, n, ce);
23275
23273
  return {
23276
23274
  name: e.name,
23277
23275
  headers: r,
23278
- rows: Ry(e.rows, r, n, Pb),
23276
+ rows: zy(e.rows, r, n, Fb),
23279
23277
  totalRows: e.totalRows - 1
23280
23278
  };
23281
23279
  });
@@ -23283,7 +23281,7 @@ function Lb() {
23283
23281
  return;
23284
23282
  }
23285
23283
  if (e.kind !== "rows") return;
23286
- let n = my(e.rows);
23284
+ let n = hy(e.rows);
23287
23285
  se(n.headerRowIndex), Se({
23288
23286
  fileName: t.name,
23289
23287
  rawRows: e.rows,
@@ -23308,7 +23306,7 @@ function Lb() {
23308
23306
  ]), je = f((e) => {
23309
23307
  j(!0), ae.current = e;
23310
23308
  let t = e.name.split(".").pop()?.toLowerCase();
23311
- t && Ib.has(t) ? Ae(e) : t === "json" ? Oe(e) : t === "xml" ? ke(e) : De(e);
23309
+ t && Lb.has(t) ? Ae(e) : t === "json" ? Oe(e) : t === "xml" ? ke(e) : De(e);
23312
23310
  }, [
23313
23311
  De,
23314
23312
  Oe,
@@ -23345,8 +23343,8 @@ function Lb() {
23345
23343
  });
23346
23344
  se(0), Se({
23347
23345
  fileName: e.label,
23348
- rawRows: Py(n, r),
23349
- detection: Ny()
23346
+ rawRows: Fy(n, r),
23347
+ detection: Py()
23350
23348
  });
23351
23349
  }
23352
23350
  } catch (e) {
@@ -23374,7 +23372,7 @@ function Lb() {
23374
23372
  return;
23375
23373
  }
23376
23374
  if (M) return;
23377
- let e = {}, t = {}, r = Fy(ue);
23375
+ let e = {}, t = {}, r = Iy(ue);
23378
23376
  for (let [i, a] of Object.entries(T)) {
23379
23377
  if (!a) continue;
23380
23378
  let o = n.find((e) => e.id === a);
@@ -23383,9 +23381,9 @@ function Lb() {
23383
23381
  if (s !== "select" && s !== "multiselect") continue;
23384
23382
  let c = o.editor.options, l = r.get(i);
23385
23383
  if (l === void 0) continue;
23386
- let u = Iy(S.rawRows, le, l);
23384
+ let u = Ly(S.rawRows, le, l);
23387
23385
  if (s === "multiselect") {
23388
- let n = o.editor.delimiter, r = yb(u, c, n);
23386
+ let n = o.editor.delimiter, r = bb(u, c, n);
23389
23387
  t[a] = r;
23390
23388
  let i = new Set(c.map((e) => e.trim().toLowerCase())), s = /* @__PURE__ */ new Set();
23391
23389
  for (let e of u) {
@@ -23448,10 +23446,10 @@ function Lb() {
23448
23446
  if (!t) return;
23449
23447
  let r = n.find((t) => t.id === e);
23450
23448
  if (r?.editor?.type !== "multiselect") return;
23451
- let i = Fy(ue).get(t);
23449
+ let i = Iy(ue).get(t);
23452
23450
  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));
23451
+ let a = Ly(S.rawRows, le, i), o = r.editor.delimiter;
23452
+ Ke(e, bb(a, r.editor.options, o));
23455
23453
  }, [
23456
23454
  S,
23457
23455
  T,
@@ -23472,7 +23470,7 @@ function Lb() {
23472
23470
  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
23471
  return t;
23474
23472
  }, [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));
23473
+ 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
23474
  return {
23477
23475
  columnMapping: T,
23478
23476
  valueMapping: We,
@@ -23513,7 +23511,7 @@ function Lb() {
23513
23511
  if (!S || !d?.onRowsImport) return;
23514
23512
  let t = S;
23515
23513
  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 = {
23514
+ 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
23515
  numberFormat: i.numberFormat,
23518
23516
  dateFormat: i.dateFormat,
23519
23517
  monthTable: ic(p),
@@ -23522,14 +23520,14 @@ function Lb() {
23522
23520
  }, l = ue, u = t.rawRows, f = [];
23523
23521
  for (let e = le; e < u.length; e++) {
23524
23522
  let t = u[e];
23525
- t && !Dy(t) && f.push(e);
23523
+ t && !Oy(t) && f.push(e);
23526
23524
  }
23527
23525
  let m = 0;
23528
23526
  for (; m < f.length;) {
23529
23527
  let e = Math.min(m + o, f.length), n = [];
23530
23528
  for (let t = m; t < e; t++) {
23531
- let e = Ly(u[f[t]] ?? [], l);
23532
- n.push(_b(e, s, c));
23529
+ let e = Ry(u[f[t]] ?? [], l);
23530
+ n.push(vb(e, s, c));
23533
23531
  }
23534
23532
  let p = e >= f.length, h = Math.floor(m / o);
23535
23533
  await d.onRowsImport({
@@ -23570,14 +23568,14 @@ function Lb() {
23570
23568
  H.length > 0 && u(H);
23571
23569
  for (let [t, n] of Object.entries(re)) e.addColumnOptions(t, n);
23572
23570
  let o = e.registerSource({ name: i.fileName });
23573
- e.setSourceLoading(o, !0), e.recordLearnedSynonyms(xb(T, We, [...n, ...H], Sv(xv, l)));
23571
+ e.setSourceLoading(o, !0), e.recordLearnedSynonyms(Sb(T, We, [...n, ...H], Sv(xv, l)));
23574
23572
  let s = ue, c = i.delimiter ?? ",", d = i.rawRows, f = [];
23575
23573
  for (let e = le; e < d.length; e++) {
23576
23574
  let t = d[e];
23577
- t && !Dy(t) && f.push(e);
23575
+ t && !Oy(t) && f.push(e);
23578
23576
  }
23579
- let m = Ry(i.rawRows, s, le, 1e3), h = hb(T, n, a), g = {
23580
- numberFormat: tc(m, gb(h)),
23577
+ let m = zy(i.rawRows, s, le, 1e3), h = gb(T, n, a), g = {
23578
+ numberFormat: tc(m, _b(h)),
23581
23579
  dateFormat: oc(m, Ye(a)),
23582
23580
  monthTable: ic(p),
23583
23581
  valueMapping: We,
@@ -23589,11 +23587,11 @@ function Lb() {
23589
23587
  title: e
23590
23588
  };
23591
23589
  }), v = 0, y = () => {
23592
- let n = Math.min(v + Nb, f.length), i = [], a = [];
23590
+ let n = Math.min(v + Pb, f.length), i = [], a = [];
23593
23591
  for (let e = v; e < n; e++) {
23594
- let t = d[f[e]] ?? [], n = Ly(t, s);
23592
+ let t = d[f[e]] ?? [], n = Ry(t, s);
23595
23593
  if (t.length !== s.length) {
23596
- let { cells: r, conflictColumns: i } = Mb(t.map((e) => String(e ?? "")), _, c);
23594
+ let { cells: r, conflictColumns: i } = Nb(t.map((e) => String(e ?? "")), _, c);
23597
23595
  if (r.length) {
23598
23596
  let e = {};
23599
23597
  for (let t = 0; t < s.length; t++) e[s[t]] = r[t] ?? "";
@@ -23611,10 +23609,10 @@ function Lb() {
23611
23609
  });
23612
23610
  }
23613
23611
  }
23614
- i.push(_b(n, h, g));
23612
+ i.push(vb(n, h, g));
23615
23613
  }
23616
23614
  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);
23615
+ for (let e = v; e < n; e++) e < Ib || (d[f[e]] = void 0);
23618
23616
  v = n, setTimeout(() => {
23619
23617
  t.validateRows(l, u);
23620
23618
  for (let { localIndex: t, columnIds: n } of a) {
@@ -23722,20 +23720,20 @@ function Lb() {
23722
23720
  }
23723
23721
  //#endregion
23724
23722
  //#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, {
23723
+ var zb = s(null);
23724
+ function Bb({ children: e }) {
23725
+ let t = Rb();
23726
+ return /* @__PURE__ */ C(zb.Provider, {
23729
23727
  value: t,
23730
23728
  children: e
23731
23729
  });
23732
23730
  }
23733
- var Bb = () => {
23734
- let e = p(Rb);
23731
+ var Vb = () => {
23732
+ let e = p(zb);
23735
23733
  if (!e) throw Error("useDataUploaderContext must be used within DataUploaderProvider");
23736
23734
  return e;
23737
- }, Vb = () => {
23738
- let { steps: e, activeStepIndex: t, currentStepIndex: n, goToStep: r } = Bb();
23735
+ }, Hb = () => {
23736
+ let { steps: e, activeStepIndex: t, currentStepIndex: n, goToStep: r } = Vb();
23739
23737
  return /* @__PURE__ */ C(co, {
23740
23738
  steps: e,
23741
23739
  activeStepIndex: t,
@@ -23743,79 +23741,79 @@ var Bb = () => {
23743
23741
  onStepChange: r,
23744
23742
  isProgressive: !0
23745
23743
  });
23746
- }, Hb = () => /* @__PURE__ */ C(zb, { children: /* @__PURE__ */ C(Vb, {}) }), Ub = {
23744
+ }, Ub = () => /* @__PURE__ */ C(Bb, { children: /* @__PURE__ */ C(Hb, {}) }), Wb = {
23747
23745
  kty: "EC",
23748
23746
  crv: "P-256",
23749
23747
  x: "wZO1Jxr21FEBDsVMzbTbF8blU2CP17c_eQY7gorO13U",
23750
23748
  y: "Nwr-tXatJZ3DxZqpUG_gOWzmpU6szTqrEL7Gnh5UGwo"
23751
- }, Wb = "updog_license_grant", Gb = new Set([
23749
+ }, Gb = "updog_license_grant", Kb = new Set([
23752
23750
  "updog.tech",
23753
23751
  "landing.updog.tech",
23754
23752
  "demo.updog.tech"
23755
23753
  ]);
23756
- function Kb() {
23757
- return Gb.has(window.location.hostname);
23758
- }
23759
23754
  function qb() {
23760
- return !1;
23755
+ return Kb.has(window.location.hostname);
23761
23756
  }
23762
23757
  function Jb() {
23758
+ return !1;
23759
+ }
23760
+ function Yb() {
23763
23761
  return "https://api.updog.tech";
23764
23762
  }
23765
- function Yb(e) {
23763
+ function Xb(e) {
23766
23764
  let t = e.replace(/-/g, "+").replace(/_/g, "/"), n = t + "=".repeat((4 - t.length % 4) % 4), r = atob(n), i = new Uint8Array(r.length);
23767
23765
  for (let e = 0; e < r.length; e++) i[e] = r.charCodeAt(e);
23768
23766
  return i;
23769
23767
  }
23770
- async function Xb(e) {
23768
+ async function Zb(e) {
23771
23769
  let t = new TextEncoder().encode(e), n = await crypto.subtle.digest("SHA-256", t);
23772
23770
  return Array.from(new Uint8Array(n)).map((e) => e.toString(16).padStart(2, "0")).join("");
23773
23771
  }
23774
- var Zb = null;
23775
- async function Qb() {
23776
- return Zb || (Zb = await crypto.subtle.importKey("jwk", Ub, {
23772
+ var Qb = null;
23773
+ async function $b() {
23774
+ return Qb || (Qb = await crypto.subtle.importKey("jwk", Wb, {
23777
23775
  name: "ECDSA",
23778
23776
  namedCurve: "P-256"
23779
- }, !1, ["verify"]), Zb);
23777
+ }, !1, ["verify"]), Qb);
23780
23778
  }
23781
- function $b() {
23779
+ function ex() {
23782
23780
  try {
23783
- return localStorage.getItem(Wb);
23781
+ return localStorage.getItem(Gb);
23784
23782
  } catch {
23785
23783
  return null;
23786
23784
  }
23787
23785
  }
23788
- function ex(e) {
23786
+ function tx(e) {
23789
23787
  try {
23790
- localStorage.setItem(Wb, e);
23788
+ localStorage.setItem(Gb, e);
23791
23789
  } catch {}
23792
23790
  }
23793
- function tx() {
23791
+ function nx() {
23794
23792
  try {
23795
- localStorage.removeItem(Wb);
23793
+ localStorage.removeItem(Gb);
23796
23794
  } catch {}
23797
23795
  }
23798
- async function nx(e, t, n) {
23796
+ async function rx(e, t, n) {
23799
23797
  let r = e.indexOf(".");
23800
23798
  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();
23799
+ let i = e.slice(0, r), a = e.slice(r + 1), o = Xb(i), s = Xb(a), c = await $b();
23802
23800
  if (!await crypto.subtle.verify({
23803
23801
  name: "ECDSA",
23804
23802
  hash: "SHA-256"
23805
23803
  }, c, new Uint8Array(s), new Uint8Array(o))) return !1;
23806
23804
  let l = JSON.parse(new TextDecoder().decode(o));
23807
23805
  if (l.exp <= Math.floor(Date.now() / 1e3)) return !1;
23808
- let u = await Xb(t);
23806
+ let u = await Zb(t);
23809
23807
  return !(l.key !== u || l.domain !== n);
23810
23808
  }
23811
- async function rx(e) {
23812
- let t = $b();
23809
+ async function ix(e) {
23810
+ let t = ex();
23813
23811
  if (!t) return {
23814
23812
  valid: !1,
23815
23813
  errorCode: "license.invalid"
23816
23814
  };
23817
23815
  try {
23818
- if (await nx(t, e, window.location.hostname.toLowerCase().trim())) return {
23816
+ if (await rx(t, e, window.location.hostname.toLowerCase().trim())) return {
23819
23817
  valid: !0,
23820
23818
  errorCode: null
23821
23819
  };
@@ -23825,23 +23823,23 @@ async function rx(e) {
23825
23823
  errorCode: "license.invalid"
23826
23824
  };
23827
23825
  }
23828
- async function ix(e, t = !0) {
23829
- if (Kb() || qb()) return {
23826
+ async function ax(e, t = !0) {
23827
+ if (qb() || Jb()) return {
23830
23828
  valid: !0,
23831
23829
  errorCode: null
23832
23830
  };
23833
- let n = Jb();
23831
+ let n = Yb();
23834
23832
  try {
23835
23833
  let r = await fetch(`${n}/v1/validate`, { headers: { "X-API-Key": e } });
23836
23834
  if (r.ok) {
23837
23835
  let e = await r.json();
23838
- return t && e.grant && ex(e.grant), {
23836
+ return t && e.grant && tx(e.grant), {
23839
23837
  valid: !0,
23840
23838
  errorCode: null
23841
23839
  };
23842
23840
  }
23843
23841
  if (r.status >= 400 && r.status < 500) {
23844
- t && tx();
23842
+ t && nx();
23845
23843
  try {
23846
23844
  return await r.json();
23847
23845
  } catch {
@@ -23853,7 +23851,7 @@ async function ix(e, t = !0) {
23853
23851
  }
23854
23852
  throw Error(`Server error: ${r.status}`);
23855
23853
  } catch {
23856
- return t ? rx(e) : {
23854
+ return t ? ix(e) : {
23857
23855
  valid: !1,
23858
23856
  errorCode: "license.invalid"
23859
23857
  };
@@ -23861,7 +23859,7 @@ async function ix(e, t = !0) {
23861
23859
  }
23862
23860
  //#endregion
23863
23861
  //#region src/hooks/useLicenseValidation.ts
23864
- function ax(e, t, n = !0) {
23862
+ function ox(e, t, n = !0) {
23865
23863
  let [r, i] = b({
23866
23864
  isValidating: t,
23867
23865
  isValid: !1,
@@ -23881,7 +23879,7 @@ function ax(e, t, n = !0) {
23881
23879
  isValidating: !0,
23882
23880
  isValid: !1,
23883
23881
  errorCode: null
23884
- }), ix(e, n).then((e) => {
23882
+ }), ax(e, n).then((e) => {
23885
23883
  r || i({
23886
23884
  isValidating: !1,
23887
23885
  isValid: e.valid,
@@ -23904,7 +23902,7 @@ function ax(e, t, n = !0) {
23904
23902
  }
23905
23903
  //#endregion
23906
23904
  //#region src/server/auth/AuthState.ts
23907
- var ox = class {
23905
+ var sx = class {
23908
23906
  token = null;
23909
23907
  get() {
23910
23908
  return this.token;
@@ -23915,13 +23913,13 @@ var ox = class {
23915
23913
  clear() {
23916
23914
  this.token = null;
23917
23915
  }
23918
- }, sx = class extends Error {
23916
+ }, cx = class extends Error {
23919
23917
  status;
23920
23918
  code;
23921
23919
  constructor(e) {
23922
23920
  super(e.message), this.name = "ScaleHttpError", this.status = e.status, this.code = e.code;
23923
23921
  }
23924
- }, cx = class {
23922
+ }, lx = class {
23925
23923
  baseUrl;
23926
23924
  apiKey;
23927
23925
  auth;
@@ -23951,7 +23949,7 @@ var ox = class {
23951
23949
  signal: r?.signal
23952
23950
  });
23953
23951
  } catch (e) {
23954
- this.notify(new sx({
23952
+ this.notify(new cx({
23955
23953
  status: 0,
23956
23954
  code: "network",
23957
23955
  message: e instanceof Error ? e.message : String(e)
@@ -23962,7 +23960,7 @@ var ox = class {
23962
23960
  try {
23963
23961
  e = await s.json();
23964
23962
  } catch {}
23965
- this.notify(new sx({
23963
+ this.notify(new cx({
23966
23964
  status: s.status,
23967
23965
  code: e.error ?? `http_${s.status}`,
23968
23966
  message: e.message ?? s.statusText
@@ -23973,23 +23971,23 @@ var ox = class {
23973
23971
  };
23974
23972
  //#endregion
23975
23973
  //#region src/server/endpoints/workspaces.ts
23976
- async function lx(e, t) {
23974
+ async function ux(e, t) {
23977
23975
  return e.post("/workspaces", {
23978
23976
  primaryKey: t.primaryKey,
23979
23977
  columns: t.columns
23980
23978
  }, { signal: t.signal });
23981
23979
  }
23982
- async function ux(e) {
23980
+ async function dx(e) {
23983
23981
  try {
23984
23982
  await e.http.delete(`/workspaces/${e.workspaceId}`, { signal: e.signal });
23985
23983
  } catch (e) {
23986
- if (e instanceof sx && e.status === 404) return;
23984
+ if (e instanceof cx && e.status === 404) return;
23987
23985
  throw e;
23988
23986
  }
23989
23987
  }
23990
23988
  //#endregion
23991
23989
  //#region src/server/endpoints/query.ts
23992
- async function dx(e, t) {
23990
+ async function fx(e, t) {
23993
23991
  let n = await e.http.post(`/workspaces/${e.workspaceId}/query`, {
23994
23992
  page: {
23995
23993
  limit: t.limit,
@@ -24007,12 +24005,12 @@ async function dx(e, t) {
24007
24005
  }
24008
24006
  //#endregion
24009
24007
  //#region src/server/ScaleClient.ts
24010
- var fx = class {
24008
+ var px = class {
24011
24009
  disposed = !1;
24012
24010
  constructor(e) {
24013
24011
  this.deps = e;
24014
24012
  }
24015
- onQuery = (e) => dx(this.deps, e);
24013
+ onQuery = (e) => fx(this.deps, e);
24016
24014
  onEdit = async (e) => ({
24017
24015
  rejected: !0,
24018
24016
  reason: "Edits are not yet supported in server mode (v0)."
@@ -24029,7 +24027,7 @@ var fx = class {
24029
24027
  pageSize = void 0;
24030
24028
  scrollSensitivity = void 0;
24031
24029
  dispose = async () => {
24032
- this.disposed || (this.disposed = !0, await ux({
24030
+ this.disposed || (this.disposed = !0, await dx({
24033
24031
  http: this.deps.http,
24034
24032
  workspaceId: this.deps.workspaceId
24035
24033
  }));
@@ -24037,25 +24035,25 @@ var fx = class {
24037
24035
  };
24038
24036
  //#endregion
24039
24037
  //#region src/server/createScaleClient.ts
24040
- async function px(e) {
24041
- let t = new ox(), n = new cx({
24038
+ async function mx(e) {
24039
+ let t = new sx(), n = new lx({
24042
24040
  baseUrl: e.url,
24043
24041
  apiKey: e.apiKey,
24044
24042
  auth: t,
24045
24043
  onDegraded: e.onDegraded
24046
- }), { workspaceId: r, accessToken: i } = await lx(n, {
24044
+ }), { workspaceId: r, accessToken: i } = await ux(n, {
24047
24045
  primaryKey: e.primaryKey,
24048
24046
  columns: e.columns,
24049
24047
  signal: e.signal
24050
24048
  });
24051
- return t.set(i), new fx({
24049
+ return t.set(i), new px({
24052
24050
  workspaceId: r,
24053
24051
  http: n
24054
24052
  });
24055
24053
  }
24056
24054
  //#endregion
24057
24055
  //#region src/server/errors.ts
24058
- function mx(e, t, n) {
24056
+ function hx(e, t, n) {
24059
24057
  return {
24060
24058
  code: e,
24061
24059
  message: t,
@@ -24065,7 +24063,7 @@ function mx(e, t, n) {
24065
24063
  }
24066
24064
  //#endregion
24067
24065
  //#region src/hooks/useScaleClient.ts
24068
- function hx(e) {
24066
+ function gx(e) {
24069
24067
  let [t, n] = b({ status: "idle" }), r = y(e.columns), i = y(e.primaryKey);
24070
24068
  return m(() => {
24071
24069
  if (!e.enabled) {
@@ -24074,7 +24072,7 @@ function hx(e) {
24074
24072
  }
24075
24073
  n({ status: "bootstrapping" });
24076
24074
  let t = new AbortController(), a = null;
24077
- return px({
24075
+ return mx({
24078
24076
  url: e.url,
24079
24077
  apiKey: e.apiKey,
24080
24078
  primaryKey: i.current,
@@ -24083,7 +24081,7 @@ function hx(e) {
24083
24081
  onDegraded: (e) => {
24084
24082
  t.signal.aborted || n({
24085
24083
  status: "failed",
24086
- error: _x(e)
24084
+ error: vx(e)
24087
24085
  });
24088
24086
  }
24089
24087
  }).then((e) => {
@@ -24098,7 +24096,7 @@ function hx(e) {
24098
24096
  }).catch((e) => {
24099
24097
  t.signal.aborted || n({
24100
24098
  status: "failed",
24101
- error: gx(e)
24099
+ error: _x(e)
24102
24100
  });
24103
24101
  }), () => {
24104
24102
  t.abort(), a?.dispose().catch(() => {});
@@ -24109,30 +24107,30 @@ function hx(e) {
24109
24107
  e.apiKey
24110
24108
  ]), t;
24111
24109
  }
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
24110
  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);
24111
+ 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);
24112
+ }
24113
+ function vx(e) {
24114
+ 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
24115
  }
24118
24116
  //#endregion
24119
24117
  //#region src/index.tsx
24120
- function vx(e) {
24118
+ function yx(e) {
24121
24119
  return e === !1 ? { licenseGrant: !1 } : { licenseGrant: e?.licenseGrant ?? !0 };
24122
24120
  }
24123
- function yx(e) {
24121
+ function bx(e) {
24124
24122
  let t = v(() => new Bo(e.onError), [e.onError]);
24125
24123
  return /* @__PURE__ */ C(yv, {
24126
24124
  errorHandler: t,
24127
24125
  children: /* @__PURE__ */ C(Wl, {
24128
24126
  ...e,
24129
24127
  errorHandler: t,
24130
- children: e.showUploader ? /* @__PURE__ */ C(Hb, {}) : /* @__PURE__ */ C(hv, {})
24128
+ children: e.showUploader ? /* @__PURE__ */ C(Ub, {}) : /* @__PURE__ */ C(hv, {})
24131
24129
  })
24132
24130
  });
24133
24131
  }
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({
24132
+ function xx(e) {
24133
+ 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
24134
  enabled: !s && c && u,
24137
24135
  url: e.__server?.url ?? "",
24138
24136
  apiKey: e.apiKey,
@@ -24187,7 +24185,7 @@ function bx(e) {
24187
24185
  code: e,
24188
24186
  message: "License validation failed",
24189
24187
  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");
24188
+ } }), 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
24189
  return t === "inline" ? /* @__PURE__ */ C("div", {
24192
24190
  className: "updog__data-editor updog__data-editor-inline",
24193
24191
  dir: i,
@@ -24207,14 +24205,14 @@ function bx(e) {
24207
24205
  submitText: n("dataEditor.confirmClose.action")
24208
24206
  })] });
24209
24207
  }
24210
- function xx(e) {
24208
+ function Sx(e) {
24211
24209
  let { translations: t, rtl: n = !1, locale: r = "en", className: i, ...a } = e;
24212
24210
  return /* @__PURE__ */ C(Zr, {
24213
24211
  translations: t,
24214
24212
  rtl: n,
24215
24213
  locale: r,
24216
- children: /* @__PURE__ */ C(bx, { ...a })
24214
+ children: /* @__PURE__ */ C(xx, { ...a })
24217
24215
  });
24218
24216
  }
24219
24217
  //#endregion
24220
- export { xx as DataEditor, ou as downloadExampleFile, su as exportDataEditor };
24218
+ export { Sx as DataEditor, ou as downloadExampleFile, su as exportDataEditor };