@oliasoft-open-source/react-ui-library 5.7.0-beta-2 → 5.7.0-beta-3

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.
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import { AiOutlineMinusSquare, AiOutlinePlusSquare } from "react-icons/ai";
7
7
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
8
  import ResizeObserver$1 from "resize-observer-polyfill";
9
9
  import { Arrow, mergeRefs, useHover, useLayer, useMousePositionAsTrigger } from "react-laag";
10
- import { cloneDeepWith, debounce, get, isArray, isBoolean, isEmpty, isEqual, isFunction, isNil, isNumber, isObject, isPlainObject, isString, noop, set, toLower, toNumber } from "lodash";
10
+ import { cloneDeep, cloneDeepWith, debounce, get, isArray, isBoolean, isEmpty, isEqual, isFunction, isNil, isNumber, isObject, isPlainObject, isString, noop, set, toLower, toNumber } from "lodash";
11
11
  import styled, { css } from "styled-components";
12
12
  import { Resizable } from "react-resizable";
13
13
  import { createPortal } from "react-dom";
@@ -6569,7 +6569,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6569
6569
  } : {
6570
6570
  value: G,
6571
6571
  unit: U
6572
- }), ku = k || K?.value === void 0, [J, Au] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), ju = !!(O || n), Y = C && C.find((e) => {
6572
+ }), Td = k || K?.value === void 0, [J, Ed] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), Dd = !!(O || n), Y = C && C.find((e) => {
6573
6573
  if (!e?.value) return;
6574
6574
  if (E) return E === e.valueKey;
6575
6575
  let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n = l } = convertUnit({
@@ -6578,7 +6578,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6578
6578
  toUnit: t
6579
6579
  });
6580
6580
  return withUnit(n, t) === e.value;
6581
- }), Mu = () => {
6581
+ }), Od = () => {
6582
6582
  let e = l ?? "", t = K.unit;
6583
6583
  if (checkConversion({
6584
6584
  value: e,
@@ -6592,7 +6592,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6592
6592
  return null;
6593
6593
  }
6594
6594
  } else return getAltUnitsListByQuantity(u)?.map((e) => ["", e?.unit]);
6595
- }, Nu = (t) => {
6595
+ }, kd = (t) => {
6596
6596
  let n = getStringName(e), r = t.target, { value: i, selectionStart: a } = r, o = withUnit(i, K?.unit || ""), s = A ? withUnit(convertAndGetValue(o, B), B) : o;
6597
6597
  h({ target: {
6598
6598
  value: s,
@@ -6605,7 +6605,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6605
6605
  }), R(() => {
6606
6606
  r.selectionStart = a, r.selectionEnd = a;
6607
6607
  });
6608
- }, Pu = (e, t) => {
6608
+ }, Ad = (e, t) => {
6609
6609
  t === K.unit || isNaN(Number(e)) || (q({
6610
6610
  value: e,
6611
6611
  unit: t
@@ -6636,7 +6636,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6636
6636
  e !== void 0 && q({
6637
6637
  value: e,
6638
6638
  unit: t
6639
- }), C && Au(Y && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
6639
+ }), C && Ed(Y && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
6640
6640
  }
6641
6641
  }, [
6642
6642
  U,
@@ -6644,7 +6644,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6644
6644
  i,
6645
6645
  T
6646
6646
  ]);
6647
- let X = Mu(), Z = label(K.unit) || K.unit || "", Fu = p || !X || X && X.length === 1, Q = getStringName(e), $, Iu = (t) => {
6647
+ let X = Od(), Z = label(K.unit) || K.unit || "", jd = p || !X || X && X.length === 1, Q = getStringName(e), $, Md = (t) => {
6648
6648
  let r = t?.value ? t.value : "", [i = "", a = ""] = isValueWithUnit(r) ? split(r) : [r], o = withPrettyUnitLabel(r);
6649
6649
  if (checkConversion({
6650
6650
  value: r,
@@ -6664,7 +6664,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6664
6664
  type: MenuType.OPTION,
6665
6665
  inline: !0,
6666
6666
  onClick: () => {
6667
- validateNumber(i).valid && !n && (Au(PredefinedOptionsMenuState.PREDEFINED), h({ target: {
6667
+ validateNumber(i).valid && !n && (Ed(PredefinedOptionsMenuState.PREDEFINED), h({ target: {
6668
6668
  value: r,
6669
6669
  name: typeof e == "string" ? e : e?.fieldName || "",
6670
6670
  predefinedSelected: !0,
@@ -6691,10 +6691,10 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6691
6691
  label: "Custom",
6692
6692
  selected: J === PredefinedOptionsMenuState.CUSTOM
6693
6693
  }], C?.length) {
6694
- let e = C.map(Iu);
6694
+ let e = C.map(Md);
6695
6695
  $ = [...$, ...e];
6696
6696
  }
6697
- let Lu = (e) => {
6697
+ let Nd = (e) => {
6698
6698
  if (isValueWithUnit(e)) {
6699
6699
  let t = getUnit(e), { value: n } = safeConvertValue({
6700
6700
  value: e,
@@ -6706,7 +6706,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6706
6706
  return n;
6707
6707
  }
6708
6708
  return e;
6709
- }, Ru = !C && (!F || F === GroupOrder.FIRST) ? GroupOrder.FIRST : GroupOrder.MIDDLE, zu = !F || F === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
6709
+ }, Pd = !C && (!F || F === GroupOrder.FIRST) ? GroupOrder.FIRST : GroupOrder.MIDDLE, Fd = !F || F === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
6710
6710
  return /* @__PURE__ */ jsx("div", {
6711
6711
  className: J === PredefinedOptionsMenuState.PREDEFINED ? cx(unit_input_module_default.predefinedMenuActive) : "",
6712
6712
  children: /* @__PURE__ */ jsxs(InputGroup, {
@@ -6738,31 +6738,31 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6738
6738
  name: Q,
6739
6739
  testId: x,
6740
6740
  disabled: n,
6741
- placeholder: Lu(t),
6741
+ placeholder: Nd(t),
6742
6742
  value: K.value,
6743
- onChange: Nu,
6743
+ onChange: kd,
6744
6744
  onFocus: v,
6745
6745
  error: i === null ? void 0 : i,
6746
6746
  warning: S === null ? void 0 : S,
6747
6747
  left: a,
6748
- allowEmpty: ku,
6748
+ allowEmpty: Td,
6749
6749
  validationCallback: (e, t) => D(Q, t),
6750
6750
  enableCosmeticRounding: j,
6751
6751
  enableDisplayRounding: M,
6752
6752
  roundDisplayValue: N,
6753
- groupOrder: Ru,
6754
- disableInternalErrorValidationMessages: ju,
6753
+ groupOrder: Pd,
6754
+ disableInternalErrorValidationMessages: Dd,
6755
6755
  small: o,
6756
6756
  selectOnFocus: P,
6757
6757
  tooltip: I
6758
6758
  }, Q)
6759
6759
  }),
6760
- Z && (Fu || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
6761
- groupOrder: zu,
6760
+ Z && (jd || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
6761
+ groupOrder: Fd,
6762
6762
  small: o,
6763
6763
  children: Z
6764
6764
  }) : /* @__PURE__ */ jsx(Menu, {
6765
- groupOrder: zu,
6765
+ groupOrder: Fd,
6766
6766
  maxHeight: 380,
6767
6767
  disabled: r,
6768
6768
  testId: x && `${x}-menu`,
@@ -6778,7 +6778,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6778
6778
  label: j ? safeRoundNumbers(i) : i,
6779
6779
  inline: !0,
6780
6780
  onClick: (n) => {
6781
- n.stopPropagation(), Pu(e, t);
6781
+ n.stopPropagation(), Ad(e, t);
6782
6782
  },
6783
6783
  description: r,
6784
6784
  selected: r === Z,
@@ -7070,7 +7070,1322 @@ function formatDate({ date: e, showTime: t, showSeconds: n, timeZone: r, showTim
7070
7070
  timeZoneName: i ? "short" : void 0
7071
7071
  }) : null;
7072
7072
  }
7073
- var isObj = (e) => !!e && typeof e == "object" && !Array.isArray(e), countOne = (e) => {
7073
+ function cloneRegExp(e) {
7074
+ let t = /^\/(.*)\/([gimyu]*)$/.exec(e.toString());
7075
+ if (!t) throw Error("Invalid RegExp");
7076
+ return new RegExp(t[1] ?? "", t[2]);
7077
+ }
7078
+ function clone(e) {
7079
+ if (typeof e != "object") return e;
7080
+ if (e === null) return null;
7081
+ if (Array.isArray(e)) return e.map(clone);
7082
+ if (e instanceof Date) return new Date(e.getTime());
7083
+ if (e instanceof RegExp) return cloneRegExp(e);
7084
+ let t = {};
7085
+ for (let n in e) Object.prototype.hasOwnProperty.call(e, n) && (t[n] = clone(e[n]));
7086
+ return t;
7087
+ }
7088
+ function assertNonEmptyArray(e, t) {
7089
+ if (e.length === 0) throw Error(t || "Expected a non-empty array");
7090
+ }
7091
+ const lastNonEmpty = (e) => e[e.length - 1];
7092
+ var Context = class {
7093
+ setResult(e) {
7094
+ return this.result = e, this.hasResult = !0, this;
7095
+ }
7096
+ exit() {
7097
+ return this.exiting = !0, this;
7098
+ }
7099
+ push(e, t) {
7100
+ return e.parent = this, t !== void 0 && (e.childName = t), e.root = this.root || this, e.options = e.options || this.options, this.children ? (assertNonEmptyArray(this.children), lastNonEmpty(this.children).next = e, this.children.push(e)) : (this.children = [e], this.nextAfterChildren = this.next || null, this.next = e), e.next = this, this;
7101
+ }
7102
+ }, diff_default = class extends Context {
7103
+ constructor(e, t) {
7104
+ super(), this.left = e, this.right = t, this.pipe = "diff";
7105
+ }
7106
+ prepareDeltaResult(e) {
7107
+ if (typeof e == "object" && (this.options?.omitRemovedValues && Array.isArray(e) && e.length > 1 && (e.length === 2 || e[2] === 0 || e[2] === 3) && (e[0] = 0), this.options?.cloneDiffValues)) {
7108
+ let t = typeof this.options?.cloneDiffValues == "function" ? this.options?.cloneDiffValues : clone;
7109
+ typeof e[0] == "object" && (e[0] = t(e[0])), typeof e[1] == "object" && (e[1] = t(e[1]));
7110
+ }
7111
+ return e;
7112
+ }
7113
+ setResult(e) {
7114
+ return this.prepareDeltaResult(e), super.setResult(e);
7115
+ }
7116
+ }, patch_default = class extends Context {
7117
+ constructor(e, t) {
7118
+ super(), this.left = e, this.delta = t, this.pipe = "patch";
7119
+ }
7120
+ }, reverse_default = class extends Context {
7121
+ constructor(e) {
7122
+ super(), this.delta = e, this.pipe = "reverse";
7123
+ }
7124
+ }, pipe_default = class {
7125
+ constructor(e) {
7126
+ this.name = e, this.filters = [];
7127
+ }
7128
+ process(e) {
7129
+ if (!this.processor) throw Error("add this pipe to a processor before using it");
7130
+ let t = this.debug, n = this.filters.length, r = e;
7131
+ for (let e = 0; e < n; e++) {
7132
+ let n = this.filters[e];
7133
+ if (n && (t && this.log(`filter: ${n.filterName}`), n(r), typeof r == "object" && r.exiting)) {
7134
+ r.exiting = !1;
7135
+ break;
7136
+ }
7137
+ }
7138
+ !r.next && this.resultCheck && this.resultCheck(r);
7139
+ }
7140
+ log(e) {
7141
+ console.log(`[jsondiffpatch] ${this.name} pipe, ${e}`);
7142
+ }
7143
+ append(...e) {
7144
+ return this.filters.push(...e), this;
7145
+ }
7146
+ prepend(...e) {
7147
+ return this.filters.unshift(...e), this;
7148
+ }
7149
+ indexOf(e) {
7150
+ if (!e) throw Error("a filter name is required");
7151
+ for (let t = 0; t < this.filters.length; t++) if (this.filters[t]?.filterName === e) return t;
7152
+ throw Error(`filter not found: ${e}`);
7153
+ }
7154
+ list() {
7155
+ return this.filters.map((e) => e.filterName);
7156
+ }
7157
+ after(e, ...t) {
7158
+ let n = this.indexOf(e);
7159
+ return this.filters.splice(n + 1, 0, ...t), this;
7160
+ }
7161
+ before(e, ...t) {
7162
+ let n = this.indexOf(e);
7163
+ return this.filters.splice(n, 0, ...t), this;
7164
+ }
7165
+ replace(e, ...t) {
7166
+ let n = this.indexOf(e);
7167
+ return this.filters.splice(n, 1, ...t), this;
7168
+ }
7169
+ remove(e) {
7170
+ let t = this.indexOf(e);
7171
+ return this.filters.splice(t, 1), this;
7172
+ }
7173
+ clear() {
7174
+ return this.filters.length = 0, this;
7175
+ }
7176
+ shouldHaveResult(e) {
7177
+ return e === !1 ? (this.resultCheck = null, this) : (this.resultCheck ||= (e) => {
7178
+ if (!e.hasResult) {
7179
+ console.log(e);
7180
+ let t = /* @__PURE__ */ Error(`${this.name} failed`);
7181
+ throw t.noResult = !0, t;
7182
+ }
7183
+ }, this);
7184
+ }
7185
+ }, processor_default = class {
7186
+ constructor(e) {
7187
+ this.selfOptions = e || {}, this.pipes = {};
7188
+ }
7189
+ options(e) {
7190
+ return e && (this.selfOptions = e), this.selfOptions;
7191
+ }
7192
+ pipe(e, t) {
7193
+ let n = t;
7194
+ if (typeof e == "string") {
7195
+ if (n === void 0) return this.pipes[e];
7196
+ this.pipes[e] = n;
7197
+ }
7198
+ if (e && e.name) {
7199
+ if (n = e, n.processor === this) return n;
7200
+ this.pipes[n.name] = n;
7201
+ }
7202
+ if (!n) throw Error(`pipe is not defined: ${e}`);
7203
+ return n.processor = this, n;
7204
+ }
7205
+ process(e, t) {
7206
+ let n = e;
7207
+ n.options = this.options();
7208
+ let r = t || e.pipe || "default", i;
7209
+ for (; r;) n.nextAfterChildren !== void 0 && (n.next = n.nextAfterChildren, n.nextAfterChildren = null), typeof r == "string" && (r = this.pipe(r)), r.process(n), i = r, r = null, n && n.next && (n = n.next, r = n.pipe || i);
7210
+ return n.hasResult ? n.result : void 0;
7211
+ }
7212
+ }, defaultMatch = (e, t, n, r) => e[n] === t[r], lengthMatrix = (e, t, n, r) => {
7213
+ let i = e.length, a = t.length, o, s, c = Array(i + 1);
7214
+ for (o = 0; o < i + 1; o++) {
7215
+ let e = Array(a + 1);
7216
+ for (s = 0; s < a + 1; s++) e[s] = 0;
7217
+ c[o] = e;
7218
+ }
7219
+ for (c.match = n, o = 1; o < i + 1; o++) {
7220
+ let i = c[o];
7221
+ if (i === void 0) throw Error("LCS matrix row is undefined");
7222
+ let l = c[o - 1];
7223
+ if (l === void 0) throw Error("LCS matrix row is undefined");
7224
+ for (s = 1; s < a + 1; s++) n(e, t, o - 1, s - 1, r) ? i[s] = (l[s - 1] ?? 0) + 1 : i[s] = Math.max(l[s] ?? 0, i[s - 1] ?? 0);
7225
+ }
7226
+ return c;
7227
+ }, backtrack = (e, t, n, r) => {
7228
+ let i = t.length, a = n.length, o = {
7229
+ sequence: [],
7230
+ indices1: [],
7231
+ indices2: []
7232
+ };
7233
+ for (; i !== 0 && a !== 0;) {
7234
+ if (e.match === void 0) throw Error("LCS matrix match function is undefined");
7235
+ if (e.match(t, n, i - 1, a - 1, r)) o.sequence.unshift(t[i - 1]), o.indices1.unshift(i - 1), o.indices2.unshift(a - 1), --i, --a;
7236
+ else {
7237
+ let t = e[i];
7238
+ if (t === void 0) throw Error("LCS matrix row is undefined");
7239
+ let n = t[a - 1];
7240
+ if (n === void 0) throw Error("LCS matrix value is undefined");
7241
+ let r = e[i - 1];
7242
+ if (r === void 0) throw Error("LCS matrix row is undefined");
7243
+ let o = r[a];
7244
+ if (o === void 0) throw Error("LCS matrix value is undefined");
7245
+ n > o ? --a : --i;
7246
+ }
7247
+ }
7248
+ return o;
7249
+ }, lcs_default = { get: (e, t, n, r) => {
7250
+ let i = r || {}, a = lengthMatrix(e, t, n || defaultMatch, i);
7251
+ return backtrack(a, e, t, i);
7252
+ } };
7253
+ function arraysHaveMatchByRef(e, t, n, r) {
7254
+ for (let i = 0; i < n; i++) {
7255
+ let n = e[i];
7256
+ for (let e = 0; e < r; e++) {
7257
+ let r = t[e];
7258
+ if (i !== e && n === r) return !0;
7259
+ }
7260
+ }
7261
+ return !1;
7262
+ }
7263
+ function matchItems(e, t, n, r, i) {
7264
+ let a = e[n], o = t[r];
7265
+ if (a === o) return !0;
7266
+ if (typeof a != "object" || typeof o != "object") return !1;
7267
+ let s = i.objectHash;
7268
+ if (!s) return i.matchByPosition && n === r;
7269
+ i.hashCache1 = i.hashCache1 || [];
7270
+ let c = i.hashCache1[n];
7271
+ if (c === void 0 && (i.hashCache1[n] = c = s(a, n)), c === void 0) return !1;
7272
+ i.hashCache2 = i.hashCache2 || [];
7273
+ let l = i.hashCache2[r];
7274
+ return l === void 0 && (i.hashCache2[r] = l = s(o, r)), l === void 0 ? !1 : c === l;
7275
+ }
7276
+ const diffFilter$3 = function(e) {
7277
+ if (!e.leftIsArray) return;
7278
+ let t = {
7279
+ objectHash: e.options?.objectHash,
7280
+ matchByPosition: e.options?.matchByPosition
7281
+ }, n = 0, r = 0, i, a, o, s = e.left, c = e.right, l = s.length, u = c.length, d;
7282
+ for (l > 0 && u > 0 && !t.objectHash && typeof t.matchByPosition != "boolean" && (t.matchByPosition = !arraysHaveMatchByRef(s, c, l, u)); n < l && n < u && matchItems(s, c, n, n, t);) i = n, d = new diff_default(s[i], c[i]), e.push(d, i), n++;
7283
+ for (; r + n < l && r + n < u && matchItems(s, c, l - 1 - r, u - 1 - r, t);) a = l - 1 - r, o = u - 1 - r, d = new diff_default(s[a], c[o]), e.push(d, o), r++;
7284
+ let f;
7285
+ if (n + r === l) {
7286
+ if (l === u) {
7287
+ e.setResult(void 0).exit();
7288
+ return;
7289
+ }
7290
+ for (f ||= { _t: "a" }, i = n; i < u - r; i++) f[i] = [c[i]], e.prepareDeltaResult(f[i]);
7291
+ e.setResult(f).exit();
7292
+ return;
7293
+ }
7294
+ if (n + r === u) {
7295
+ for (f ||= { _t: "a" }, i = n; i < l - r; i++) {
7296
+ let t = `_${i}`;
7297
+ f[t] = [
7298
+ s[i],
7299
+ 0,
7300
+ 0
7301
+ ], e.prepareDeltaResult(f[t]);
7302
+ }
7303
+ e.setResult(f).exit();
7304
+ return;
7305
+ }
7306
+ t.hashCache1 = void 0, t.hashCache2 = void 0;
7307
+ let p = s.slice(n, l - r), m = c.slice(n, u - r), h = lcs_default.get(p, m, matchItems, t), g = [];
7308
+ for (f ||= { _t: "a" }, i = n; i < l - r; i++) if (h.indices1.indexOf(i - n) < 0) {
7309
+ let t = `_${i}`;
7310
+ f[t] = [
7311
+ s[i],
7312
+ 0,
7313
+ 0
7314
+ ], e.prepareDeltaResult(f[t]), g.push(i);
7315
+ }
7316
+ let _ = !0;
7317
+ e.options?.arrays && e.options.arrays.detectMove === !1 && (_ = !1);
7318
+ let v = !1;
7319
+ e.options?.arrays?.includeValueOnMove && (v = !0);
7320
+ let y = g.length;
7321
+ for (i = n; i < u - r; i++) {
7322
+ let r = h.indices2.indexOf(i - n);
7323
+ if (r < 0) {
7324
+ let r = !1;
7325
+ if (_ && y > 0) for (let l = 0; l < y; l++) {
7326
+ a = g[l];
7327
+ let u = a === void 0 ? void 0 : f[`_${a}`];
7328
+ if (a !== void 0 && u && matchItems(p, m, a - n, i - n, t)) {
7329
+ u.splice(1, 2, i, 3), u.splice(1, 2, i, 3), v || (u[0] = ""), o = i, d = new diff_default(s[a], c[o]), e.push(d, o), g.splice(l, 1), r = !0;
7330
+ break;
7331
+ }
7332
+ }
7333
+ r || (f[i] = [c[i]], e.prepareDeltaResult(f[i]));
7334
+ } else {
7335
+ if (h.indices1[r] === void 0) throw Error(`Invalid indexOnArray2: ${r}, seq.indices1: ${h.indices1}`);
7336
+ if (a = h.indices1[r] + n, h.indices2[r] === void 0) throw Error(`Invalid indexOnArray2: ${r}, seq.indices2: ${h.indices2}`);
7337
+ o = h.indices2[r] + n, d = new diff_default(s[a], c[o]), e.push(d, o);
7338
+ }
7339
+ }
7340
+ e.setResult(f).exit();
7341
+ };
7342
+ diffFilter$3.filterName = "arrays";
7343
+ var compare = {
7344
+ numerically(e, t) {
7345
+ return e - t;
7346
+ },
7347
+ numericallyBy(e) {
7348
+ return (t, n) => t[e] - n[e];
7349
+ }
7350
+ };
7351
+ const patchFilter$3 = function(e) {
7352
+ if (!e.nested) return;
7353
+ let t = e.delta;
7354
+ if (t._t !== "a") return;
7355
+ let n, r, i = t, a = e.left, o = [], s = [], c = [];
7356
+ for (n in i) if (n !== "_t") if (n[0] === "_") {
7357
+ let e = n;
7358
+ if (i[e] !== void 0 && (i[e][2] === 0 || i[e][2] === 3)) o.push(Number.parseInt(n.slice(1), 10));
7359
+ else throw Error(`only removal or move can be applied at original array indices, invalid diff type: ${i[e]?.[2]}`);
7360
+ } else {
7361
+ let e = n;
7362
+ i[e].length === 1 ? s.push({
7363
+ index: Number.parseInt(e, 10),
7364
+ value: i[e][0]
7365
+ }) : c.push({
7366
+ index: Number.parseInt(e, 10),
7367
+ delta: i[e]
7368
+ });
7369
+ }
7370
+ for (o = o.sort(compare.numerically), n = o.length - 1; n >= 0; n--) {
7371
+ if (r = o[n], r === void 0) continue;
7372
+ let e = i[`_${r}`], t = a.splice(r, 1)[0];
7373
+ e?.[2] === 3 && s.push({
7374
+ index: e[1],
7375
+ value: t
7376
+ });
7377
+ }
7378
+ s = s.sort(compare.numericallyBy("index"));
7379
+ let l = s.length;
7380
+ for (n = 0; n < l; n++) {
7381
+ let e = s[n];
7382
+ e !== void 0 && a.splice(e.index, 0, e.value);
7383
+ }
7384
+ let u = c.length;
7385
+ if (u > 0) for (n = 0; n < u; n++) {
7386
+ let t = c[n];
7387
+ if (t === void 0) continue;
7388
+ let r = new patch_default(a[t.index], t.delta);
7389
+ e.push(r, t.index);
7390
+ }
7391
+ if (!e.children) {
7392
+ e.setResult(a).exit();
7393
+ return;
7394
+ }
7395
+ e.exit();
7396
+ };
7397
+ patchFilter$3.filterName = "arrays";
7398
+ const collectChildrenPatchFilter$1 = function(e) {
7399
+ if (!e || !e.children || e.delta._t !== "a") return;
7400
+ let t = e.left, n = e.children.length;
7401
+ for (let r = 0; r < n; r++) {
7402
+ let n = e.children[r];
7403
+ if (n === void 0) continue;
7404
+ let i = n.childName;
7405
+ t[i] = n.result;
7406
+ }
7407
+ e.setResult(t).exit();
7408
+ };
7409
+ collectChildrenPatchFilter$1.filterName = "arraysCollectChildren";
7410
+ const reverseFilter$3 = function(e) {
7411
+ if (!e.nested) {
7412
+ let t = e.delta;
7413
+ if (t[2] === 3) {
7414
+ let n = t;
7415
+ e.newName = `_${n[1]}`, e.setResult([
7416
+ n[0],
7417
+ Number.parseInt(e.childName.substring(1), 10),
7418
+ 3
7419
+ ]).exit();
7420
+ }
7421
+ return;
7422
+ }
7423
+ let t = e.delta;
7424
+ if (t._t !== "a") return;
7425
+ let n = t;
7426
+ for (let t in n) {
7427
+ if (t === "_t") continue;
7428
+ let r = new reverse_default(n[t]);
7429
+ e.push(r, t);
7430
+ }
7431
+ e.exit();
7432
+ };
7433
+ reverseFilter$3.filterName = "arrays";
7434
+ var reverseArrayDeltaIndex = (e, t, n) => {
7435
+ if (typeof t == "string" && t[0] === "_") return Number.parseInt(t.substring(1), 10);
7436
+ if (Array.isArray(n) && n[2] === 0) return `_${t}`;
7437
+ let r = +t;
7438
+ for (let n in e) {
7439
+ let i = e[n];
7440
+ if (Array.isArray(i)) if (i[2] === 3) {
7441
+ let e = Number.parseInt(n.substring(1), 10), a = i[1];
7442
+ if (a === +t) return e;
7443
+ e <= r && a > r ? r++ : e >= r && a < r && r--;
7444
+ } else i[2] === 0 ? Number.parseInt(n.substring(1), 10) <= r && r++ : i.length === 1 && Number.parseInt(n, 10) <= r && r--;
7445
+ }
7446
+ return r;
7447
+ };
7448
+ const collectChildrenReverseFilter$1 = (e) => {
7449
+ if (!e || !e.children) return;
7450
+ let t = e.delta;
7451
+ if (t._t !== "a") return;
7452
+ let n = t, r = e.children.length, i = { _t: "a" };
7453
+ for (let t = 0; t < r; t++) {
7454
+ let r = e.children[t];
7455
+ if (r === void 0) continue;
7456
+ let a = r.newName;
7457
+ if (a === void 0) {
7458
+ if (r.childName === void 0) throw Error("child.childName is undefined");
7459
+ a = reverseArrayDeltaIndex(n, r.childName, r.result);
7460
+ }
7461
+ i[a] !== r.result && (i[a] = r.result);
7462
+ }
7463
+ e.setResult(i).exit();
7464
+ };
7465
+ collectChildrenReverseFilter$1.filterName = "arraysCollectChildren";
7466
+ const diffFilter$2 = function(e) {
7467
+ e.left instanceof Date ? (e.right instanceof Date && e.left.getTime() === e.right.getTime() ? e.setResult(void 0) : e.setResult([e.left, e.right]), e.exit()) : e.right instanceof Date && e.setResult([e.left, e.right]).exit();
7468
+ };
7469
+ diffFilter$2.filterName = "dates";
7470
+ const collectChildrenDiffFilter = (e) => {
7471
+ if (!e || !e.children) return;
7472
+ let t = e.children.length, n = e.result;
7473
+ for (let r = 0; r < t; r++) {
7474
+ let t = e.children[r];
7475
+ if (t !== void 0 && t.result !== void 0) {
7476
+ if (n ||= {}, t.childName === void 0) throw Error("diff child.childName is undefined");
7477
+ n[t.childName] = t.result;
7478
+ }
7479
+ }
7480
+ n && e.leftIsArray && (n._t = "a"), e.setResult(n).exit();
7481
+ };
7482
+ collectChildrenDiffFilter.filterName = "collectChildren";
7483
+ const objectsDiffFilter = (e) => {
7484
+ if (e.leftIsArray || e.leftType !== "object") return;
7485
+ let t = e.left, n = e.right, r = e.options?.propertyFilter;
7486
+ for (let i in t) {
7487
+ if (!Object.prototype.hasOwnProperty.call(t, i) || r && !r(i, e)) continue;
7488
+ let a = new diff_default(t[i], n[i]);
7489
+ e.push(a, i);
7490
+ }
7491
+ for (let i in n) {
7492
+ if (!Object.prototype.hasOwnProperty.call(n, i) || r && !r(i, e)) continue;
7493
+ if (t[i] === void 0) {
7494
+ let t = new diff_default(void 0, n[i]);
7495
+ e.push(t, i);
7496
+ }
7497
+ }
7498
+ if (!e.children || e.children.length === 0) {
7499
+ e.setResult(void 0).exit();
7500
+ return;
7501
+ }
7502
+ e.exit();
7503
+ };
7504
+ objectsDiffFilter.filterName = "objects";
7505
+ const patchFilter$2 = function(e) {
7506
+ if (!e.nested) return;
7507
+ let t = e.delta;
7508
+ if (t._t) return;
7509
+ let n = t;
7510
+ for (let t in n) {
7511
+ let r = new patch_default(e.left[t], n[t]);
7512
+ e.push(r, t);
7513
+ }
7514
+ e.exit();
7515
+ };
7516
+ patchFilter$2.filterName = "objects";
7517
+ const collectChildrenPatchFilter = function(e) {
7518
+ if (!e || !e.children || e.delta._t) return;
7519
+ let t = e.left, n = e.children.length;
7520
+ for (let r = 0; r < n; r++) {
7521
+ let n = e.children[r];
7522
+ if (n === void 0) continue;
7523
+ let i = n.childName;
7524
+ Object.prototype.hasOwnProperty.call(e.left, i) && n.result === void 0 ? delete t[i] : t[i] !== n.result && (t[i] = n.result);
7525
+ }
7526
+ e.setResult(t).exit();
7527
+ };
7528
+ collectChildrenPatchFilter.filterName = "collectChildren";
7529
+ const reverseFilter$2 = function(e) {
7530
+ if (!e.nested || e.delta._t) return;
7531
+ let t = e.delta;
7532
+ for (let n in t) {
7533
+ let r = new reverse_default(t[n]);
7534
+ e.push(r, n);
7535
+ }
7536
+ e.exit();
7537
+ };
7538
+ reverseFilter$2.filterName = "objects";
7539
+ const collectChildrenReverseFilter = (e) => {
7540
+ if (!e || !e.children || e.delta._t) return;
7541
+ let t = e.children.length, n = {};
7542
+ for (let r = 0; r < t; r++) {
7543
+ let t = e.children[r];
7544
+ if (t === void 0) continue;
7545
+ let i = t.childName;
7546
+ n[i] !== t.result && (n[i] = t.result);
7547
+ }
7548
+ e.setResult(n).exit();
7549
+ };
7550
+ collectChildrenReverseFilter.filterName = "collectChildren";
7551
+ var cachedDiffPatch = null;
7552
+ function getDiffMatchPatch(e, t) {
7553
+ if (!cachedDiffPatch) {
7554
+ let n;
7555
+ if (e?.textDiff?.diffMatchPatch) n = new e.textDiff.diffMatchPatch();
7556
+ else {
7557
+ if (!t) return null;
7558
+ let e = /* @__PURE__ */ Error("The diff-match-patch library was not provided. Pass the library in through the options or use the `jsondiffpatch/with-text-diffs` entry-point.");
7559
+ throw e.diff_match_patch_not_found = !0, e;
7560
+ }
7561
+ cachedDiffPatch = {
7562
+ diff: (e, t) => n.patch_toText(n.patch_make(e, t)),
7563
+ patch: (e, t) => {
7564
+ let r = n.patch_apply(n.patch_fromText(t), e);
7565
+ for (let e of r[1]) if (!e) {
7566
+ let e = /* @__PURE__ */ Error("text patch failed");
7567
+ throw e.textPatchFailed = !0, e;
7568
+ }
7569
+ return r[0];
7570
+ }
7571
+ };
7572
+ }
7573
+ return cachedDiffPatch;
7574
+ }
7575
+ const diffFilter$1 = function(e) {
7576
+ if (e.leftType !== "string") return;
7577
+ let t = e.left, n = e.right, r = e.options?.textDiff?.minLength || 60;
7578
+ if (t.length < r || n.length < r) {
7579
+ e.setResult([t, n]).exit();
7580
+ return;
7581
+ }
7582
+ let i = getDiffMatchPatch(e.options);
7583
+ if (!i) {
7584
+ e.setResult([t, n]).exit();
7585
+ return;
7586
+ }
7587
+ let a = i.diff;
7588
+ e.setResult([
7589
+ a(t, n),
7590
+ 0,
7591
+ 2
7592
+ ]).exit();
7593
+ };
7594
+ diffFilter$1.filterName = "texts";
7595
+ const patchFilter$1 = function(e) {
7596
+ if (e.nested) return;
7597
+ let t = e.delta;
7598
+ if (t[2] !== 2) return;
7599
+ let n = t, r = getDiffMatchPatch(e.options, !0).patch;
7600
+ e.setResult(r(e.left, n[0])).exit();
7601
+ };
7602
+ patchFilter$1.filterName = "texts";
7603
+ var textDeltaReverse = (e) => {
7604
+ let t = /^@@ +-(\d+),(\d+) +\+(\d+),(\d+) +@@$/, n = e.split("\n");
7605
+ for (let e = 0; e < n.length; e++) {
7606
+ let r = n[e];
7607
+ if (r === void 0) continue;
7608
+ let i = r.slice(0, 1);
7609
+ if (i === "@") {
7610
+ let i = t.exec(r);
7611
+ if (i !== null) {
7612
+ let t = e;
7613
+ n[t] = `@@ -${i[3]},${i[4]} +${i[1]},${i[2]} @@`;
7614
+ }
7615
+ } else if (i === "+") {
7616
+ if (n[e] = `-${n[e]?.slice(1)}`, n[e - 1]?.slice(0, 1) === "+") {
7617
+ let t = n[e];
7618
+ n[e] = n[e - 1], n[e - 1] = t;
7619
+ }
7620
+ } else i === "-" && (n[e] = `+${n[e]?.slice(1)}`);
7621
+ }
7622
+ return n.join("\n");
7623
+ };
7624
+ const reverseFilter$1 = function(e) {
7625
+ if (e.nested) return;
7626
+ let t = e.delta;
7627
+ if (t[2] !== 2) return;
7628
+ let n = t;
7629
+ e.setResult([
7630
+ textDeltaReverse(n[0]),
7631
+ 0,
7632
+ 2
7633
+ ]).exit();
7634
+ };
7635
+ reverseFilter$1.filterName = "texts";
7636
+ const diffFilter = function(e) {
7637
+ if (e.left === e.right) {
7638
+ e.setResult(void 0).exit();
7639
+ return;
7640
+ }
7641
+ if (e.left === void 0) {
7642
+ if (typeof e.right == "function") throw Error("functions are not supported");
7643
+ e.setResult([e.right]).exit();
7644
+ return;
7645
+ }
7646
+ if (e.right === void 0) {
7647
+ e.setResult([
7648
+ e.left,
7649
+ 0,
7650
+ 0
7651
+ ]).exit();
7652
+ return;
7653
+ }
7654
+ if (typeof e.left == "function" || typeof e.right == "function") throw Error("functions are not supported");
7655
+ if (e.leftType = e.left === null ? "null" : typeof e.left, e.rightType = e.right === null ? "null" : typeof e.right, e.leftType !== e.rightType) {
7656
+ e.setResult([e.left, e.right]).exit();
7657
+ return;
7658
+ }
7659
+ if (e.leftType === "boolean" || e.leftType === "number") {
7660
+ e.setResult([e.left, e.right]).exit();
7661
+ return;
7662
+ }
7663
+ if (e.leftType === "object" && (e.leftIsArray = Array.isArray(e.left)), e.rightType === "object" && (e.rightIsArray = Array.isArray(e.right)), e.leftIsArray !== e.rightIsArray) {
7664
+ e.setResult([e.left, e.right]).exit();
7665
+ return;
7666
+ }
7667
+ e.left instanceof RegExp && (e.right instanceof RegExp ? e.setResult([e.left.toString(), e.right.toString()]).exit() : e.setResult([e.left, e.right]).exit());
7668
+ };
7669
+ diffFilter.filterName = "trivial";
7670
+ const patchFilter = function(e) {
7671
+ if (e.delta === void 0) {
7672
+ e.setResult(e.left).exit();
7673
+ return;
7674
+ }
7675
+ if (e.nested = !Array.isArray(e.delta), e.nested) return;
7676
+ let t = e.delta;
7677
+ if (t.length === 1) {
7678
+ e.setResult(t[0]).exit();
7679
+ return;
7680
+ }
7681
+ if (t.length === 2) {
7682
+ if (e.left instanceof RegExp) {
7683
+ let n = /^\/(.*)\/([gimyu]+)$/.exec(t[1]);
7684
+ if (n?.[1]) {
7685
+ e.setResult(new RegExp(n[1], n[2])).exit();
7686
+ return;
7687
+ }
7688
+ }
7689
+ e.setResult(t[1]).exit();
7690
+ return;
7691
+ }
7692
+ t.length === 3 && t[2] === 0 && e.setResult(void 0).exit();
7693
+ };
7694
+ patchFilter.filterName = "trivial";
7695
+ const reverseFilter = function(e) {
7696
+ if (e.delta === void 0) {
7697
+ e.setResult(e.delta).exit();
7698
+ return;
7699
+ }
7700
+ if (e.nested = !Array.isArray(e.delta), e.nested) return;
7701
+ let t = e.delta;
7702
+ if (t.length === 1) {
7703
+ e.setResult([
7704
+ t[0],
7705
+ 0,
7706
+ 0
7707
+ ]).exit();
7708
+ return;
7709
+ }
7710
+ if (t.length === 2) {
7711
+ e.setResult([t[1], t[0]]).exit();
7712
+ return;
7713
+ }
7714
+ t.length === 3 && t[2] === 0 && e.setResult([t[0]]).exit();
7715
+ };
7716
+ reverseFilter.filterName = "trivial";
7717
+ var diffpatcher_default = class {
7718
+ constructor(e) {
7719
+ this.processor = new processor_default(e), this.processor.pipe(new pipe_default("diff").append(collectChildrenDiffFilter, diffFilter, diffFilter$2, diffFilter$1, objectsDiffFilter, diffFilter$3).shouldHaveResult()), this.processor.pipe(new pipe_default("patch").append(collectChildrenPatchFilter, collectChildrenPatchFilter$1, patchFilter, patchFilter$1, patchFilter$2, patchFilter$3).shouldHaveResult()), this.processor.pipe(new pipe_default("reverse").append(collectChildrenReverseFilter, collectChildrenReverseFilter$1, reverseFilter, reverseFilter$1, reverseFilter$2, reverseFilter$3).shouldHaveResult());
7720
+ }
7721
+ options(e) {
7722
+ return this.processor.options(e);
7723
+ }
7724
+ diff(e, t) {
7725
+ return this.processor.process(new diff_default(e, t));
7726
+ }
7727
+ patch(e, t) {
7728
+ return this.processor.process(new patch_default(e, t));
7729
+ }
7730
+ reverse(e) {
7731
+ return this.processor.process(new reverse_default(e));
7732
+ }
7733
+ unpatch(e, t) {
7734
+ return this.patch(e, this.reverse(t));
7735
+ }
7736
+ clone(e) {
7737
+ return clone(e);
7738
+ }
7739
+ };
7740
+ function create(e) {
7741
+ return new diffpatcher_default(e);
7742
+ }
7743
+ const diff_match_patch = function() {
7744
+ this.Diff_Timeout = 1, this.Diff_EditCost = 4, this.Match_Threshold = .5, this.Match_Distance = 1e3, this.Patch_DeleteThreshold = .5, this.Patch_Margin = 4, this.Match_MaxBits = 32;
7745
+ };
7746
+ diff_match_patch.Diff = function(e, t) {
7747
+ this[0] = e, this[1] = t;
7748
+ }, diff_match_patch.Diff.prototype.length = 2, diff_match_patch.Diff.prototype.toString = function() {
7749
+ return this[0] + "," + this[1];
7750
+ }, diff_match_patch.Diff.prototype[Symbol.iterator] = function* () {
7751
+ yield this[0], yield this[1];
7752
+ }, diff_match_patch.prototype.diff_main = function(e, t, n, r) {
7753
+ r === void 0 && (r = this.Diff_Timeout <= 0 ? Number.MAX_VALUE : (/* @__PURE__ */ new Date()).getTime() + this.Diff_Timeout * 1e3);
7754
+ var i = r;
7755
+ if (e == null || t == null) throw Error("Null input. (diff_main)");
7756
+ if (e == t) return e ? [new diff_match_patch.Diff(0, e)] : [];
7757
+ n === void 0 && (n = !0);
7758
+ var a = n, o = this.diff_commonPrefix(e, t), s = e.substring(0, o);
7759
+ e = e.substring(o), t = t.substring(o), o = this.diff_commonSuffix(e, t);
7760
+ var c = e.substring(e.length - o);
7761
+ e = e.substring(0, e.length - o), t = t.substring(0, t.length - o);
7762
+ var l = this.diff_compute_(e, t, a, i);
7763
+ return s && l.unshift(new diff_match_patch.Diff(0, s)), c && l.push(new diff_match_patch.Diff(0, c)), this.diff_cleanupMerge(l), l;
7764
+ }, diff_match_patch.prototype.diff_compute_ = function(e, t, n, r) {
7765
+ var i;
7766
+ if (!e) return [new diff_match_patch.Diff(1, t)];
7767
+ if (!t) return [new diff_match_patch.Diff(-1, e)];
7768
+ var a = e.length > t.length ? e : t, o = e.length > t.length ? t : e, s = a.indexOf(o);
7769
+ if (s != -1) return i = [
7770
+ new diff_match_patch.Diff(1, a.substring(0, s)),
7771
+ new diff_match_patch.Diff(0, o),
7772
+ new diff_match_patch.Diff(1, a.substring(s + o.length))
7773
+ ], e.length > t.length && (i[0][0] = i[2][0] = -1), i;
7774
+ if (o.length == 1) return [new diff_match_patch.Diff(-1, e), new diff_match_patch.Diff(1, t)];
7775
+ var c = this.diff_halfMatch_(e, t);
7776
+ if (c) {
7777
+ var l = c[0], u = c[1], d = c[2], f = c[3], p = c[4], m = this.diff_main(l, d, n, r), h = this.diff_main(u, f, n, r);
7778
+ return m.concat([new diff_match_patch.Diff(0, p)], h);
7779
+ }
7780
+ return n && e.length > 100 && t.length > 100 ? this.diff_lineMode_(e, t, r) : this.diff_bisect_(e, t, r);
7781
+ }, diff_match_patch.prototype.diff_lineMode_ = function(e, t, n) {
7782
+ var r = this.diff_linesToChars_(e, t);
7783
+ e = r.chars1, t = r.chars2;
7784
+ var i = r.lineArray, a = this.diff_main(e, t, !1, n);
7785
+ this.diff_charsToLines_(a, i), this.diff_cleanupSemantic(a), a.push(new diff_match_patch.Diff(0, ""));
7786
+ for (var o = 0, s = 0, c = 0, l = "", u = ""; o < a.length;) {
7787
+ switch (a[o][0]) {
7788
+ case 1:
7789
+ c++, u += a[o][1];
7790
+ break;
7791
+ case -1:
7792
+ s++, l += a[o][1];
7793
+ break;
7794
+ case 0:
7795
+ if (s >= 1 && c >= 1) {
7796
+ a.splice(o - s - c, s + c), o = o - s - c;
7797
+ for (var d = this.diff_main(l, u, !1, n), f = d.length - 1; f >= 0; f--) a.splice(o, 0, d[f]);
7798
+ o += d.length;
7799
+ }
7800
+ c = 0, s = 0, l = "", u = "";
7801
+ break;
7802
+ }
7803
+ o++;
7804
+ }
7805
+ return a.pop(), a;
7806
+ }, diff_match_patch.prototype.diff_bisect_ = function(e, t, n) {
7807
+ for (var r = e.length, i = t.length, a = Math.ceil((r + i) / 2), o = a, s = 2 * a, c = Array(s), l = Array(s), u = 0; u < s; u++) c[u] = -1, l[u] = -1;
7808
+ c[o + 1] = 0, l[o + 1] = 0;
7809
+ for (var d = r - i, f = d % 2 != 0, p = 0, m = 0, h = 0, g = 0, _ = 0; _ < a && !((/* @__PURE__ */ new Date()).getTime() > n); _++) {
7810
+ for (var v = -_ + p; v <= _ - m; v += 2) {
7811
+ for (var y = o + v, b = v == -_ || v != _ && c[y - 1] < c[y + 1] ? c[y + 1] : c[y - 1] + 1, x = b - v; b < r && x < i && e.charAt(b) == t.charAt(x);) b++, x++;
7812
+ if (c[y] = b, b > r) m += 2;
7813
+ else if (x > i) p += 2;
7814
+ else if (f) {
7815
+ var S = o + d - v;
7816
+ if (S >= 0 && S < s && l[S] != -1) {
7817
+ var C = r - l[S];
7818
+ if (b >= C) return this.diff_bisectSplit_(e, t, b, x, n);
7819
+ }
7820
+ }
7821
+ }
7822
+ for (var w = -_ + h; w <= _ - g; w += 2) {
7823
+ for (var S = o + w, C = w == -_ || w != _ && l[S - 1] < l[S + 1] ? l[S + 1] : l[S - 1] + 1, T = C - w; C < r && T < i && e.charAt(r - C - 1) == t.charAt(i - T - 1);) C++, T++;
7824
+ if (l[S] = C, C > r) g += 2;
7825
+ else if (T > i) h += 2;
7826
+ else if (!f) {
7827
+ var y = o + d - w;
7828
+ if (y >= 0 && y < s && c[y] != -1) {
7829
+ var b = c[y], x = o + b - y;
7830
+ if (C = r - C, b >= C) return this.diff_bisectSplit_(e, t, b, x, n);
7831
+ }
7832
+ }
7833
+ }
7834
+ }
7835
+ return [new diff_match_patch.Diff(-1, e), new diff_match_patch.Diff(1, t)];
7836
+ }, diff_match_patch.prototype.diff_bisectSplit_ = function(e, t, n, r, i) {
7837
+ var a = e.substring(0, n), o = t.substring(0, r), s = e.substring(n), c = t.substring(r), l = this.diff_main(a, o, !1, i), u = this.diff_main(s, c, !1, i);
7838
+ return l.concat(u);
7839
+ }, diff_match_patch.prototype.diff_linesToChars_ = function(e, t) {
7840
+ var n = [], r = {};
7841
+ n[0] = "";
7842
+ function i(e) {
7843
+ for (var t = "", i = 0, o = -1, s = n.length; o < e.length - 1;) {
7844
+ o = e.indexOf("\n", i), o == -1 && (o = e.length - 1);
7845
+ var c = e.substring(i, o + 1);
7846
+ (r.hasOwnProperty ? r.hasOwnProperty(c) : r[c] !== void 0) ? t += String.fromCharCode(r[c]) : (s == a && (c = e.substring(i), o = e.length), t += String.fromCharCode(s), r[c] = s, n[s++] = c), i = o + 1;
7847
+ }
7848
+ return t;
7849
+ }
7850
+ var a = 4e4, o = i(e);
7851
+ a = 65535;
7852
+ var s = i(t);
7853
+ return {
7854
+ chars1: o,
7855
+ chars2: s,
7856
+ lineArray: n
7857
+ };
7858
+ }, diff_match_patch.prototype.diff_charsToLines_ = function(e, t) {
7859
+ for (var n = 0; n < e.length; n++) {
7860
+ for (var r = e[n][1], i = [], a = 0; a < r.length; a++) i[a] = t[r.charCodeAt(a)];
7861
+ e[n][1] = i.join("");
7862
+ }
7863
+ }, diff_match_patch.prototype.diff_commonPrefix = function(e, t) {
7864
+ if (!e || !t || e.charAt(0) != t.charAt(0)) return 0;
7865
+ for (var n = 0, r = Math.min(e.length, t.length), i = r, a = 0; n < i;) e.substring(a, i) == t.substring(a, i) ? (n = i, a = n) : r = i, i = Math.floor((r - n) / 2 + n);
7866
+ return i;
7867
+ }, diff_match_patch.prototype.diff_commonSuffix = function(e, t) {
7868
+ if (!e || !t || e.charAt(e.length - 1) != t.charAt(t.length - 1)) return 0;
7869
+ for (var n = 0, r = Math.min(e.length, t.length), i = r, a = 0; n < i;) e.substring(e.length - i, e.length - a) == t.substring(t.length - i, t.length - a) ? (n = i, a = n) : r = i, i = Math.floor((r - n) / 2 + n);
7870
+ return i;
7871
+ }, diff_match_patch.prototype.diff_commonOverlap_ = function(e, t) {
7872
+ var n = e.length, r = t.length;
7873
+ if (n == 0 || r == 0) return 0;
7874
+ n > r ? e = e.substring(n - r) : n < r && (t = t.substring(0, n));
7875
+ var i = Math.min(n, r);
7876
+ if (e == t) return i;
7877
+ for (var a = 0, o = 1;;) {
7878
+ var s = e.substring(i - o), c = t.indexOf(s);
7879
+ if (c == -1) return a;
7880
+ o += c, (c == 0 || e.substring(i - o) == t.substring(0, o)) && (a = o, o++);
7881
+ }
7882
+ }, diff_match_patch.prototype.diff_halfMatch_ = function(e, t) {
7883
+ if (this.Diff_Timeout <= 0) return null;
7884
+ var n = e.length > t.length ? e : t, r = e.length > t.length ? t : e;
7885
+ if (n.length < 4 || r.length * 2 < n.length) return null;
7886
+ var i = this;
7887
+ function a(e, t, n) {
7888
+ for (var r = e.substring(n, n + Math.floor(e.length / 4)), a = -1, o = "", s, c, l, u; (a = t.indexOf(r, a + 1)) != -1;) {
7889
+ var d = i.diff_commonPrefix(e.substring(n), t.substring(a)), f = i.diff_commonSuffix(e.substring(0, n), t.substring(0, a));
7890
+ o.length < f + d && (o = t.substring(a - f, a) + t.substring(a, a + d), s = e.substring(0, n - f), c = e.substring(n + d), l = t.substring(0, a - f), u = t.substring(a + d));
7891
+ }
7892
+ return o.length * 2 >= e.length ? [
7893
+ s,
7894
+ c,
7895
+ l,
7896
+ u,
7897
+ o
7898
+ ] : null;
7899
+ }
7900
+ var o = a(n, r, Math.ceil(n.length / 4)), s = a(n, r, Math.ceil(n.length / 2)), c;
7901
+ if (!o && !s) return null;
7902
+ c = s ? o && o[4].length > s[4].length ? o : s : o;
7903
+ var l, u, d, f;
7904
+ e.length > t.length ? (l = c[0], u = c[1], d = c[2], f = c[3]) : (d = c[0], f = c[1], l = c[2], u = c[3]);
7905
+ var p = c[4];
7906
+ return [
7907
+ l,
7908
+ u,
7909
+ d,
7910
+ f,
7911
+ p
7912
+ ];
7913
+ }, diff_match_patch.prototype.diff_cleanupSemantic = function(e) {
7914
+ for (var t = !1, n = [], r = 0, i = null, a = 0, o = 0, s = 0, c = 0, l = 0; a < e.length;) e[a][0] == 0 ? (n[r++] = a, o = c, s = l, c = 0, l = 0, i = e[a][1]) : (e[a][0] == 1 ? c += e[a][1].length : l += e[a][1].length, i && i.length <= Math.max(o, s) && i.length <= Math.max(c, l) && (e.splice(n[r - 1], 0, new diff_match_patch.Diff(-1, i)), e[n[r - 1] + 1][0] = 1, r--, r--, a = r > 0 ? n[r - 1] : -1, o = 0, s = 0, c = 0, l = 0, i = null, t = !0)), a++;
7915
+ for (t && this.diff_cleanupMerge(e), this.diff_cleanupSemanticLossless(e), a = 1; a < e.length;) {
7916
+ if (e[a - 1][0] == -1 && e[a][0] == 1) {
7917
+ var u = e[a - 1][1], d = e[a][1], f = this.diff_commonOverlap_(u, d), p = this.diff_commonOverlap_(d, u);
7918
+ f >= p ? (f >= u.length / 2 || f >= d.length / 2) && (e.splice(a, 0, new diff_match_patch.Diff(0, d.substring(0, f))), e[a - 1][1] = u.substring(0, u.length - f), e[a + 1][1] = d.substring(f), a++) : (p >= u.length / 2 || p >= d.length / 2) && (e.splice(a, 0, new diff_match_patch.Diff(0, u.substring(0, p))), e[a - 1][0] = 1, e[a - 1][1] = d.substring(0, d.length - p), e[a + 1][0] = -1, e[a + 1][1] = u.substring(p), a++), a++;
7919
+ }
7920
+ a++;
7921
+ }
7922
+ }, diff_match_patch.prototype.diff_cleanupSemanticLossless = function(e) {
7923
+ function t(e, t) {
7924
+ if (!e || !t) return 6;
7925
+ var n = e.charAt(e.length - 1), r = t.charAt(0), i = n.match(diff_match_patch.nonAlphaNumericRegex_), a = r.match(diff_match_patch.nonAlphaNumericRegex_), o = i && n.match(diff_match_patch.whitespaceRegex_), s = a && r.match(diff_match_patch.whitespaceRegex_), c = o && n.match(diff_match_patch.linebreakRegex_), l = s && r.match(diff_match_patch.linebreakRegex_), u = c && e.match(diff_match_patch.blanklineEndRegex_), d = l && t.match(diff_match_patch.blanklineStartRegex_);
7926
+ return u || d ? 5 : c || l ? 4 : i && !o && s ? 3 : o || s ? 2 : i || a ? 1 : 0;
7927
+ }
7928
+ for (var n = 1; n < e.length - 1;) {
7929
+ if (e[n - 1][0] == 0 && e[n + 1][0] == 0) {
7930
+ var r = e[n - 1][1], i = e[n][1], a = e[n + 1][1], o = this.diff_commonSuffix(r, i);
7931
+ if (o) {
7932
+ var s = i.substring(i.length - o);
7933
+ r = r.substring(0, r.length - o), i = s + i.substring(0, i.length - o), a = s + a;
7934
+ }
7935
+ for (var c = r, l = i, u = a, d = t(r, i) + t(i, a); i.charAt(0) === a.charAt(0);) {
7936
+ r += i.charAt(0), i = i.substring(1) + a.charAt(0), a = a.substring(1);
7937
+ var f = t(r, i) + t(i, a);
7938
+ f >= d && (d = f, c = r, l = i, u = a);
7939
+ }
7940
+ e[n - 1][1] != c && (c ? e[n - 1][1] = c : (e.splice(n - 1, 1), n--), e[n][1] = l, u ? e[n + 1][1] = u : (e.splice(n + 1, 1), n--));
7941
+ }
7942
+ n++;
7943
+ }
7944
+ }, diff_match_patch.nonAlphaNumericRegex_ = /[^a-zA-Z0-9]/, diff_match_patch.whitespaceRegex_ = /\s/, diff_match_patch.linebreakRegex_ = /[\r\n]/, diff_match_patch.blanklineEndRegex_ = /\n\r?\n$/, diff_match_patch.blanklineStartRegex_ = /^\r?\n\r?\n/, diff_match_patch.prototype.diff_cleanupEfficiency = function(e) {
7945
+ for (var t = !1, n = [], r = 0, i = null, a = 0, o = !1, s = !1, c = !1, l = !1; a < e.length;) e[a][0] == 0 ? (e[a][1].length < this.Diff_EditCost && (c || l) ? (n[r++] = a, o = c, s = l, i = e[a][1]) : (r = 0, i = null), c = l = !1) : (e[a][0] == -1 ? l = !0 : c = !0, i && (o && s && c && l || i.length < this.Diff_EditCost / 2 && o + s + c + l == 3) && (e.splice(n[r - 1], 0, new diff_match_patch.Diff(-1, i)), e[n[r - 1] + 1][0] = 1, r--, i = null, o && s ? (c = l = !0, r = 0) : (r--, a = r > 0 ? n[r - 1] : -1, c = l = !1), t = !0)), a++;
7946
+ t && this.diff_cleanupMerge(e);
7947
+ }, diff_match_patch.prototype.diff_cleanupMerge = function(e) {
7948
+ e.push(new diff_match_patch.Diff(0, ""));
7949
+ for (var t = 0, n = 0, r = 0, i = "", a = "", o; t < e.length;) switch (e[t][0]) {
7950
+ case 1:
7951
+ r++, a += e[t][1], t++;
7952
+ break;
7953
+ case -1:
7954
+ n++, i += e[t][1], t++;
7955
+ break;
7956
+ case 0:
7957
+ n + r > 1 ? (n !== 0 && r !== 0 && (o = this.diff_commonPrefix(a, i), o !== 0 && (t - n - r > 0 && e[t - n - r - 1][0] == 0 ? e[t - n - r - 1][1] += a.substring(0, o) : (e.splice(0, 0, new diff_match_patch.Diff(0, a.substring(0, o))), t++), a = a.substring(o), i = i.substring(o)), o = this.diff_commonSuffix(a, i), o !== 0 && (e[t][1] = a.substring(a.length - o) + e[t][1], a = a.substring(0, a.length - o), i = i.substring(0, i.length - o))), t -= n + r, e.splice(t, n + r), i.length && (e.splice(t, 0, new diff_match_patch.Diff(-1, i)), t++), a.length && (e.splice(t, 0, new diff_match_patch.Diff(1, a)), t++), t++) : t !== 0 && e[t - 1][0] == 0 ? (e[t - 1][1] += e[t][1], e.splice(t, 1)) : t++, r = 0, n = 0, i = "", a = "";
7958
+ break;
7959
+ }
7960
+ e[e.length - 1][1] === "" && e.pop();
7961
+ var s = !1;
7962
+ for (t = 1; t < e.length - 1;) e[t - 1][0] == 0 && e[t + 1][0] == 0 && (e[t][1].substring(e[t][1].length - e[t - 1][1].length) == e[t - 1][1] ? (e[t][1] = e[t - 1][1] + e[t][1].substring(0, e[t][1].length - e[t - 1][1].length), e[t + 1][1] = e[t - 1][1] + e[t + 1][1], e.splice(t - 1, 1), s = !0) : e[t][1].substring(0, e[t + 1][1].length) == e[t + 1][1] && (e[t - 1][1] += e[t + 1][1], e[t][1] = e[t][1].substring(e[t + 1][1].length) + e[t + 1][1], e.splice(t + 1, 1), s = !0)), t++;
7963
+ s && this.diff_cleanupMerge(e);
7964
+ }, diff_match_patch.prototype.diff_cleanupSplitSurrogates = function(e) {
7965
+ for (var t, n = 0; n < e.length; n++) {
7966
+ var r = e[n], i = r[1][0], a = r[1][r[1].length - 1];
7967
+ if (r[1].length === 0) {
7968
+ e.splice(n--, 1);
7969
+ continue;
7970
+ }
7971
+ if (a && this.isHighSurrogate(a) && (t = a, r[1] = r[1].slice(0, -1)), t && i && this.isHighSurrogate(t) && this.isLowSurrogate(i) && (r[1] = t + r[1]), r[1].length === 0) {
7972
+ e.splice(n--, 1);
7973
+ continue;
7974
+ }
7975
+ }
7976
+ return e;
7977
+ }, diff_match_patch.prototype.isHighSurrogate = function(e) {
7978
+ var t = e.charCodeAt(0);
7979
+ return t >= 55296 && t <= 56319;
7980
+ }, diff_match_patch.prototype.isLowSurrogate = function(e) {
7981
+ var t = e.charCodeAt(0);
7982
+ return t >= 56320 && t <= 57343;
7983
+ }, diff_match_patch.prototype.digit16 = function(e) {
7984
+ switch (e) {
7985
+ case "0": return 0;
7986
+ case "1": return 1;
7987
+ case "2": return 2;
7988
+ case "3": return 3;
7989
+ case "4": return 4;
7990
+ case "5": return 5;
7991
+ case "6": return 6;
7992
+ case "7": return 7;
7993
+ case "8": return 8;
7994
+ case "9": return 9;
7995
+ case "A":
7996
+ case "a": return 10;
7997
+ case "B":
7998
+ case "b": return 11;
7999
+ case "C":
8000
+ case "c": return 12;
8001
+ case "D":
8002
+ case "d": return 13;
8003
+ case "E":
8004
+ case "e": return 14;
8005
+ case "F":
8006
+ case "f": return 15;
8007
+ default: throw Error("Invalid hex-code");
8008
+ }
8009
+ }, diff_match_patch.prototype.decodeURI = function(e) {
8010
+ try {
8011
+ return decodeURI(e);
8012
+ } catch {
8013
+ for (var t = 0, n = ""; t < e.length;) {
8014
+ if (e[t] !== "%") {
8015
+ n += e[t++];
8016
+ continue;
8017
+ }
8018
+ var r = (this.digit16(e[t + 1]) << 4) + this.digit16(e[t + 2]);
8019
+ if (!(r & 128)) {
8020
+ n += String.fromCharCode(r), t += 3;
8021
+ continue;
8022
+ }
8023
+ if (e[t + 3] !== "%") throw URIError("URI malformed");
8024
+ var i = (this.digit16(e[t + 4]) << 4) + this.digit16(e[t + 5]);
8025
+ if ((i & 192) != 128) throw URIError("URI malformed");
8026
+ if (i &= 63, (r & 224) == 192) {
8027
+ n += String.fromCharCode((r & 31) << 6 | i), t += 6;
8028
+ continue;
8029
+ }
8030
+ if (e[t + 6] !== "%") throw URIError("URI malformed");
8031
+ var a = (this.digit16(e[t + 7]) << 4) + this.digit16(e[t + 8]);
8032
+ if ((a & 192) != 128) throw URIError("URI malformed");
8033
+ if (a &= 63, (r & 240) == 224) {
8034
+ n += String.fromCharCode((r & 15) << 12 | i << 6 | a), t += 9;
8035
+ continue;
8036
+ }
8037
+ if (e[t + 9] !== "%") throw URIError("URI malformed");
8038
+ var o = (this.digit16(e[t + 10]) << 4) + this.digit16(e[t + 11]);
8039
+ if ((o & 192) != 128) throw URIError("URI malformed");
8040
+ if (o &= 63, (r & 248) == 240) {
8041
+ var s = (r & 7) << 18 | i << 12 | a << 6 | o;
8042
+ if (s >= 65536 && s <= 1114111) {
8043
+ n += String.fromCharCode((s & 65535) >>> 10 & 1023 | 55296), n += String.fromCharCode(56320 | s & 1023), t += 12;
8044
+ continue;
8045
+ }
8046
+ }
8047
+ throw URIError("URI malformed");
8048
+ }
8049
+ return n;
8050
+ }
8051
+ }, diff_match_patch.prototype.diff_xIndex = function(e, t) {
8052
+ var n = 0, r = 0, i = 0, a = 0, o;
8053
+ for (o = 0; o < e.length && (e[o][0] !== 1 && (n += e[o][1].length), e[o][0] !== -1 && (r += e[o][1].length), !(n > t)); o++) i = n, a = r;
8054
+ return e.length != o && e[o][0] === -1 ? a : a + (t - i);
8055
+ }, diff_match_patch.prototype.diff_prettyHtml = function(e) {
8056
+ e = this.diff_cleanupSplitSurrogates(e);
8057
+ for (var t = [], n = /&/g, r = /</g, i = />/g, a = /\n/g, o = 0; o < e.length; o++) {
8058
+ var s = e[o][0], c = e[o][1].replace(n, "&amp;").replace(r, "&lt;").replace(i, "&gt;").replace(a, "&para;<br>");
8059
+ switch (s) {
8060
+ case 1:
8061
+ t[o] = "<ins style=\"background:#e6ffe6;\">" + c + "</ins>";
8062
+ break;
8063
+ case -1:
8064
+ t[o] = "<del style=\"background:#ffe6e6;\">" + c + "</del>";
8065
+ break;
8066
+ case 0:
8067
+ t[o] = "<span>" + c + "</span>";
8068
+ break;
8069
+ }
8070
+ }
8071
+ return t.join("");
8072
+ }, diff_match_patch.prototype.diff_text1 = function(e) {
8073
+ for (var t = [], n = 0; n < e.length; n++) e[n][0] !== 1 && (t[n] = e[n][1]);
8074
+ return t.join("");
8075
+ }, diff_match_patch.prototype.diff_text2 = function(e) {
8076
+ for (var t = [], n = 0; n < e.length; n++) e[n][0] !== -1 && (t[n] = e[n][1]);
8077
+ return t.join("");
8078
+ }, diff_match_patch.prototype.diff_levenshtein = function(e) {
8079
+ for (var t = 0, n = 0, r = 0, i = 0; i < e.length; i++) {
8080
+ var a = e[i][0], o = e[i][1];
8081
+ switch (a) {
8082
+ case 1:
8083
+ n += o.length;
8084
+ break;
8085
+ case -1:
8086
+ r += o.length;
8087
+ break;
8088
+ case 0:
8089
+ t += Math.max(n, r), n = 0, r = 0;
8090
+ break;
8091
+ }
8092
+ }
8093
+ return t += Math.max(n, r), t;
8094
+ }, diff_match_patch.prototype.diff_toDelta = function(e) {
8095
+ e = this.diff_cleanupSplitSurrogates(e);
8096
+ for (var t = [], n = 0; n < e.length; n++) switch (e[n][0]) {
8097
+ case 1:
8098
+ t[n] = "+" + encodeURI(e[n][1]);
8099
+ break;
8100
+ case -1:
8101
+ t[n] = "-" + e[n][1].length;
8102
+ break;
8103
+ case 0:
8104
+ t[n] = "=" + e[n][1].length;
8105
+ break;
8106
+ }
8107
+ return t.join(" ").replace(/%20/g, " ");
8108
+ }, diff_match_patch.prototype.diff_fromDelta = function(e, t) {
8109
+ for (var n = [], r = 0, i = 0, a = t.split(/\t/g), o = 0; o < a.length; o++) {
8110
+ var s = a[o].substring(1);
8111
+ switch (a[o].charAt(0)) {
8112
+ case "+":
8113
+ try {
8114
+ n[r++] = new diff_match_patch.Diff(1, this.decodeURI(s));
8115
+ } catch {
8116
+ throw Error("Illegal escape in diff_fromDelta: " + s);
8117
+ }
8118
+ break;
8119
+ case "-":
8120
+ case "=":
8121
+ var c = parseInt(s, 10);
8122
+ if (isNaN(c) || c < 0) throw Error("Invalid number in diff_fromDelta: " + s);
8123
+ var l = e.substring(i, i += c);
8124
+ a[o].charAt(0) == "=" ? n[r++] = new diff_match_patch.Diff(0, l) : n[r++] = new diff_match_patch.Diff(-1, l);
8125
+ break;
8126
+ default: if (a[o]) throw Error("Invalid diff operation in diff_fromDelta: " + a[o]);
8127
+ }
8128
+ }
8129
+ if (i != e.length) throw Error("Delta length (" + i + ") does not equal source text length (" + e.length + ").");
8130
+ return n;
8131
+ }, diff_match_patch.prototype.match_main = function(e, t, n) {
8132
+ if (e == null || t == null || n == null) throw Error("Null input. (match_main)");
8133
+ return n = Math.max(0, Math.min(n, e.length)), e == t ? 0 : e.length ? e.substring(n, n + t.length) == t ? n : this.match_bitap_(e, t, n) : -1;
8134
+ }, diff_match_patch.prototype.match_bitap_ = function(e, t, n) {
8135
+ if (t.length > this.Match_MaxBits) throw Error("Pattern too long for this browser.");
8136
+ var r = this.match_alphabet_(t), i = this;
8137
+ function a(e, r) {
8138
+ var a = e / t.length, o = Math.abs(n - r);
8139
+ return i.Match_Distance ? a + o / i.Match_Distance : o ? 1 : a;
8140
+ }
8141
+ var o = this.Match_Threshold, s = e.indexOf(t, n);
8142
+ s != -1 && (o = Math.min(a(0, s), o), s = e.lastIndexOf(t, n + t.length), s != -1 && (o = Math.min(a(0, s), o)));
8143
+ var c = 1 << t.length - 1;
8144
+ s = -1;
8145
+ for (var l, u, d = t.length + e.length, f, p = 0; p < t.length; p++) {
8146
+ for (l = 0, u = d; l < u;) a(p, n + u) <= o ? l = u : d = u, u = Math.floor((d - l) / 2 + l);
8147
+ d = u;
8148
+ var m = Math.max(1, n - u + 1), h = Math.min(n + u, e.length) + t.length, g = Array(h + 2);
8149
+ g[h + 1] = (1 << p) - 1;
8150
+ for (var _ = h; _ >= m; _--) {
8151
+ var v = r[e.charAt(_ - 1)];
8152
+ if (p === 0 ? g[_] = (g[_ + 1] << 1 | 1) & v : g[_] = (g[_ + 1] << 1 | 1) & v | ((f[_ + 1] | f[_]) << 1 | 1) | f[_ + 1], g[_] & c) {
8153
+ var y = a(p, _ - 1);
8154
+ if (y <= o) if (o = y, s = _ - 1, s > n) m = Math.max(1, 2 * n - s);
8155
+ else break;
8156
+ }
8157
+ }
8158
+ if (a(p + 1, n) > o) break;
8159
+ f = g;
8160
+ }
8161
+ return s;
8162
+ }, diff_match_patch.prototype.match_alphabet_ = function(e) {
8163
+ for (var t = {}, n = 0; n < e.length; n++) t[e.charAt(n)] = 0;
8164
+ for (var n = 0; n < e.length; n++) t[e.charAt(n)] |= 1 << e.length - n - 1;
8165
+ return t;
8166
+ }, diff_match_patch.prototype.patch_addContext_ = function(e, t) {
8167
+ if (t.length != 0) {
8168
+ if (e.start2 === null) throw Error("patch not initialized");
8169
+ for (var n = t.substring(e.start2, e.start2 + e.length1), r = 0; t.indexOf(n) != t.lastIndexOf(n) && n.length < this.Match_MaxBits - this.Patch_Margin - this.Patch_Margin;) r += this.Patch_Margin, n = t.substring(e.start2 - r, e.start2 + e.length1 + r);
8170
+ r += this.Patch_Margin, e.start2 - r > 0 && diff_match_patch.prototype.isLowSurrogate(t[e.start2 - r]) && r++;
8171
+ var i = t.substring(e.start2 - r, e.start2);
8172
+ i && e.diffs.unshift(new diff_match_patch.Diff(0, i)), e.start2 + e.length1 + r < t.length && diff_match_patch.prototype.isHighSurrogate(t[e.start2 + e.length1 + r]) && r++;
8173
+ var a = t.substring(e.start2 + e.length1, e.start2 + e.length1 + r);
8174
+ a && e.diffs.push(new diff_match_patch.Diff(0, a)), e.start1 -= i.length, e.start2 -= i.length, e.length1 += i.length + a.length, e.length2 += i.length + a.length;
8175
+ }
8176
+ }, diff_match_patch.prototype.patch_make = function(e, t, n) {
8177
+ var r, i;
8178
+ if (typeof e == "string" && typeof t == "string" && n === void 0) r = e, i = this.diff_main(r, t, !0), i.length > 2 && (this.diff_cleanupSemantic(i), this.diff_cleanupEfficiency(i));
8179
+ else if (e && typeof e == "object" && t === void 0 && n === void 0) i = e, r = this.diff_text1(i);
8180
+ else if (typeof e == "string" && t && typeof t == "object" && n === void 0) r = e, i = t;
8181
+ else if (typeof e == "string" && typeof t == "string" && n && typeof n == "object") r = e, i = n;
8182
+ else throw Error("Unknown call format to patch_make.");
8183
+ if (i.length === 0) return [];
8184
+ i = this.diff_cleanupSplitSurrogates(i);
8185
+ for (var a = [], o = new diff_match_patch.patch_obj(), s = 0, c = 0, l = 0, u = r, d = r, f = 0; f < i.length; f++) {
8186
+ var p = i[f][0], m = i[f][1];
8187
+ switch (!s && p !== 0 && (o.start1 = c, o.start2 = l), p) {
8188
+ case 1:
8189
+ o.diffs[s++] = i[f], o.length2 += m.length, d = d.substring(0, l) + m + d.substring(l);
8190
+ break;
8191
+ case -1:
8192
+ o.length1 += m.length, o.diffs[s++] = i[f], d = d.substring(0, l) + d.substring(l + m.length);
8193
+ break;
8194
+ case 0:
8195
+ m.length <= 2 * this.Patch_Margin && s && i.length != f + 1 ? (o.diffs[s++] = i[f], o.length1 += m.length, o.length2 += m.length) : m.length >= 2 * this.Patch_Margin && s && (this.patch_addContext_(o, u), a.push(o), o = new diff_match_patch.patch_obj(), s = 0, u = d, c = l);
8196
+ break;
8197
+ }
8198
+ p !== 1 && (c += m.length), p !== -1 && (l += m.length);
8199
+ }
8200
+ return s && (this.patch_addContext_(o, u), a.push(o)), a;
8201
+ }, diff_match_patch.prototype.patch_deepCopy = function(e) {
8202
+ for (var t = [], n = 0; n < e.length; n++) {
8203
+ var r = e[n], i = new diff_match_patch.patch_obj();
8204
+ i.diffs = [];
8205
+ for (var a = 0; a < r.diffs.length; a++) i.diffs[a] = new diff_match_patch.Diff(r.diffs[a][0], r.diffs[a][1]);
8206
+ i.start1 = r.start1, i.start2 = r.start2, i.length1 = r.length1, i.length2 = r.length2, t[n] = i;
8207
+ }
8208
+ return t;
8209
+ }, diff_match_patch.prototype.patch_apply = function(e, t) {
8210
+ if (e.length == 0) return [t, []];
8211
+ e = this.patch_deepCopy(e);
8212
+ var n = this.patch_addPadding(e);
8213
+ t = n + t + n, this.patch_splitMax(e);
8214
+ for (var r = 0, i = [], a = 0; a < e.length; a++) {
8215
+ var o = e[a].start2 + r, s = this.diff_text1(e[a].diffs), c, l = -1;
8216
+ if (s.length > this.Match_MaxBits ? (c = this.match_main(t, s.substring(0, this.Match_MaxBits), o), c != -1 && (l = this.match_main(t, s.substring(s.length - this.Match_MaxBits), o + s.length - this.Match_MaxBits), (l == -1 || c >= l) && (c = -1))) : c = this.match_main(t, s, o), c == -1) i[a] = !1, r -= e[a].length2 - e[a].length1;
8217
+ else {
8218
+ i[a] = !0, r = c - o;
8219
+ var u = l == -1 ? t.substring(c, c + s.length) : t.substring(c, l + this.Match_MaxBits);
8220
+ if (s == u) t = t.substring(0, c) + this.diff_text2(e[a].diffs) + t.substring(c + s.length);
8221
+ else {
8222
+ var d = this.diff_main(s, u, !1);
8223
+ if (s.length > this.Match_MaxBits && this.diff_levenshtein(d) / s.length > this.Patch_DeleteThreshold) i[a] = !1;
8224
+ else {
8225
+ this.diff_cleanupSemanticLossless(d);
8226
+ for (var f = 0, p, m = 0; m < e[a].diffs.length; m++) {
8227
+ var h = e[a].diffs[m];
8228
+ h[0] !== 0 && (p = this.diff_xIndex(d, f)), h[0] === 1 ? t = t.substring(0, c + p) + h[1] + t.substring(c + p) : h[0] === -1 && (t = t.substring(0, c + p) + t.substring(c + this.diff_xIndex(d, f + h[1].length))), h[0] !== -1 && (f += h[1].length);
8229
+ }
8230
+ }
8231
+ }
8232
+ }
8233
+ }
8234
+ return t = t.substring(n.length, t.length - n.length), [t, i];
8235
+ }, diff_match_patch.prototype.patch_addPadding = function(e) {
8236
+ for (var t = this.Patch_Margin, n = "", r = 1; r <= t; r++) n += String.fromCharCode(r);
8237
+ for (var r = 0; r < e.length; r++) e[r].start1 += t, e[r].start2 += t;
8238
+ var i = e[0], a = i.diffs;
8239
+ if (a.length == 0 || a[0][0] != 0) a.unshift(new diff_match_patch.Diff(0, n)), i.start1 -= t, i.start2 -= t, i.length1 += t, i.length2 += t;
8240
+ else if (t > a[0][1].length) {
8241
+ var o = t - a[0][1].length;
8242
+ a[0][1] = n.substring(a[0][1].length) + a[0][1], i.start1 -= o, i.start2 -= o, i.length1 += o, i.length2 += o;
8243
+ }
8244
+ if (i = e[e.length - 1], a = i.diffs, a.length == 0 || a[a.length - 1][0] != 0) a.push(new diff_match_patch.Diff(0, n)), i.length1 += t, i.length2 += t;
8245
+ else if (t > a[a.length - 1][1].length) {
8246
+ var o = t - a[a.length - 1][1].length;
8247
+ a[a.length - 1][1] += n.substring(0, o), i.length1 += o, i.length2 += o;
8248
+ }
8249
+ return n;
8250
+ }, diff_match_patch.prototype.patch_splitMax = function(e) {
8251
+ for (var t = this.Match_MaxBits, n = 0; n < e.length; n++) if (!(e[n].length1 <= t)) {
8252
+ var r = e[n];
8253
+ e.splice(n--, 1);
8254
+ for (var i = r.start1, a = r.start2, o = ""; r.diffs.length !== 0;) {
8255
+ var s = new diff_match_patch.patch_obj(), c = !0;
8256
+ for (s.start1 = i - o.length, s.start2 = a - o.length, o !== "" && (s.length1 = s.length2 = o.length, s.diffs.push(new diff_match_patch.Diff(0, o))); r.diffs.length !== 0 && s.length1 < t - this.Patch_Margin;) {
8257
+ var l = r.diffs[0][0], u = r.diffs[0][1];
8258
+ l === 1 ? (s.length2 += u.length, a += u.length, s.diffs.push(r.diffs.shift()), c = !1) : l === -1 && s.diffs.length == 1 && s.diffs[0][0] == 0 && u.length > 2 * t ? (s.length1 += u.length, i += u.length, c = !1, s.diffs.push(new diff_match_patch.Diff(l, u)), r.diffs.shift()) : (u = u.substring(0, t - s.length1 - this.Patch_Margin), s.length1 += u.length, i += u.length, l === 0 ? (s.length2 += u.length, a += u.length) : c = !1, s.diffs.push(new diff_match_patch.Diff(l, u)), u == r.diffs[0][1] ? r.diffs.shift() : r.diffs[0][1] = r.diffs[0][1].substring(u.length));
8259
+ }
8260
+ o = this.diff_text2(s.diffs), o = o.substring(o.length - this.Patch_Margin);
8261
+ var d = this.diff_text1(r.diffs).substring(0, this.Patch_Margin);
8262
+ d !== "" && (s.length1 += d.length, s.length2 += d.length, s.diffs.length !== 0 && s.diffs[s.diffs.length - 1][0] === 0 ? s.diffs[s.diffs.length - 1][1] += d : s.diffs.push(new diff_match_patch.Diff(0, d))), c || e.splice(++n, 0, s);
8263
+ }
8264
+ }
8265
+ }, diff_match_patch.prototype.patch_toText = function(e) {
8266
+ for (var t = [], n = 0; n < e.length; n++) t[n] = e[n];
8267
+ return t.join("");
8268
+ }, diff_match_patch.prototype.patch_fromText = function(e) {
8269
+ var t = [];
8270
+ if (!e) return t;
8271
+ for (var n = e.split("\n"), r = 0, i = /^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/; r < n.length;) {
8272
+ var a = n[r].match(i);
8273
+ if (!a) throw Error("Invalid patch string: " + n[r]);
8274
+ var o = new diff_match_patch.patch_obj();
8275
+ for (t.push(o), o.start1 = parseInt(a[1], 10), a[2] === "" ? (o.start1--, o.length1 = 1) : a[2] == "0" ? o.length1 = 0 : (o.start1--, o.length1 = parseInt(a[2], 10)), o.start2 = parseInt(a[3], 10), a[4] === "" ? (o.start2--, o.length2 = 1) : a[4] == "0" ? o.length2 = 0 : (o.start2--, o.length2 = parseInt(a[4], 10)), r++; r < n.length;) {
8276
+ var s = n[r].charAt(0);
8277
+ try {
8278
+ var c = decodeURI(n[r].substring(1));
8279
+ } catch {
8280
+ throw Error("Illegal escape in patch_fromText: " + c);
8281
+ }
8282
+ if (s == "-") o.diffs.push(new diff_match_patch.Diff(-1, c));
8283
+ else if (s == "+") o.diffs.push(new diff_match_patch.Diff(1, c));
8284
+ else if (s == " ") o.diffs.push(new diff_match_patch.Diff(0, c));
8285
+ else if (s == "@") break;
8286
+ else if (s !== "") throw Error("Invalid patch mode \"" + s + "\" in: " + c);
8287
+ r++;
8288
+ }
8289
+ }
8290
+ return t;
8291
+ }, diff_match_patch.patch_obj = function() {
8292
+ this.diffs = [], this.start1 = null, this.start2 = null, this.length1 = 0, this.length2 = 0;
8293
+ }, diff_match_patch.patch_obj.prototype.toString = function() {
8294
+ var e = this.length1 === 0 ? this.start1 + ",0" : this.length1 == 1 ? this.start1 + 1 : this.start1 + 1 + "," + this.length1, t = this.length2 === 0 ? this.start2 + ",0" : this.length2 == 1 ? this.start2 + 1 : this.start2 + 1 + "," + this.length2, n = ["@@ -" + e + " +" + t + " @@\n"], r;
8295
+ diff_match_patch.prototype.diff_cleanupSplitSurrogates(this.diffs);
8296
+ for (var i = 0; i < this.diffs.length; i++) {
8297
+ switch (this.diffs[i][0]) {
8298
+ case 1:
8299
+ r = "+";
8300
+ break;
8301
+ case -1:
8302
+ r = "-";
8303
+ break;
8304
+ case 0:
8305
+ r = " ";
8306
+ break;
8307
+ }
8308
+ n[i + 1] = r + encodeURI(this.diffs[i][1]) + "\n";
8309
+ }
8310
+ return n.join("").replace(/%20/g, " ");
8311
+ };
8312
+ const createDiffPatcher = (e = {}) => create({
8313
+ ...e,
8314
+ textDiff: {
8315
+ diffMatchPatch: diff_match_patch,
8316
+ minLength: 120
8317
+ },
8318
+ cloneDiffValues: !0
8319
+ }), viewTypes = Object.freeze({
8320
+ summary: {
8321
+ label: "Summary",
8322
+ value: "summary"
8323
+ },
8324
+ compare: {
8325
+ label: "Compare",
8326
+ value: "compare"
8327
+ }
8328
+ });
8329
+ var jsondiffpatcher = createDiffPatcher(), isDeltaArray = (e) => Array.isArray(e), unpatchWith = (e, t) => t ? isDeltaArray(t) ? t.length === 0 ? e : t.reduce((e, t) => jsondiffpatcher.unpatch(cloneDeep(e), cloneDeep(t)), cloneDeep(e)) : jsondiffpatcher.unpatch(cloneDeep(e), cloneDeep(t)) : e;
8330
+ const createDiffJson = (e, t, n) => {
8331
+ let r = t.filter((t) => !!t.diffs && t.createdAt >= e.createdAt), i = Array(r.length + 1);
8332
+ i[0] = cloneDeep(n);
8333
+ let a = "", o = "";
8334
+ try {
8335
+ for (let e = 0; e < r.length; e++) {
8336
+ let t = r[e]?.diffs ?? null;
8337
+ if (!t) {
8338
+ i[e + 1] = i[e];
8339
+ continue;
8340
+ }
8341
+ i[e + 1] = unpatchWith(i[e], t);
8342
+ }
8343
+ let e = r.length > 0 ? i[r.length - 1] : n, t = r.length > 0 ? i[r.length] : n;
8344
+ a = JSON.stringify(t ?? "", null, 2), o = JSON.stringify(e ?? "", null, 2);
8345
+ } catch (e) {
8346
+ console.error("err", e);
8347
+ }
8348
+ return {
8349
+ oldJson: a,
8350
+ newJson: o
8351
+ };
8352
+ };
8353
+ var comparison_view_modal_default = ({ auditLog: e, auditLogs: t, data: n, isOpen: r, onClose: i }) => {
8354
+ let { diffs: a = void 0 } = e || {};
8355
+ if (!a) return null;
8356
+ let o = [viewTypes.summary, viewTypes.compare].map(({ label: e, value: t }) => ({
8357
+ label: e,
8358
+ value: t
8359
+ })), [s, c] = useState(o[0]), { oldJson: l, newJson: u } = createDiffJson(e, t, n);
8360
+ return /* @__PURE__ */ jsx(Modal, {
8361
+ visible: r,
8362
+ centered: !0,
8363
+ children: /* @__PURE__ */ jsx(Dialog, { dialog: {
8364
+ scroll: !0,
8365
+ heading: "Comparison view",
8366
+ content: /* @__PURE__ */ jsxs(Fragment$1, { children: [
8367
+ /* @__PURE__ */ jsx(Tabs, {
8368
+ name: "ViewTab",
8369
+ onChange: (e) => c(e.target.value),
8370
+ options: o,
8371
+ value: s
8372
+ }),
8373
+ /* @__PURE__ */ jsx(Spacer, { height: "15px" }),
8374
+ /* @__PURE__ */ jsx(DiffViewer, {
8375
+ oldJson: l,
8376
+ newJson: u
8377
+ })
8378
+ ] }),
8379
+ footer: /* @__PURE__ */ jsx(Button, {
8380
+ label: "Cancel",
8381
+ onClick: i
8382
+ }),
8383
+ onClose: i,
8384
+ width: "90vw",
8385
+ height: "90vh"
8386
+ } })
8387
+ });
8388
+ }, isObj = (e) => !!e && typeof e == "object" && !Array.isArray(e), countOne = (e) => {
7074
8389
  let t = {
7075
8390
  total: 0,
7076
8391
  added: 0,
@@ -7132,8 +8447,8 @@ function countDeltas(e) {
7132
8447
  text: 0
7133
8448
  });
7134
8449
  }
7135
- function AuditLogTable({ logs: e, onClick: t, loading: n }) {
7136
- let [r, i] = useState(!0), [a, o] = useState(!0), s = [
8450
+ function AuditLogTable({ logs: e, data: t, total: n, loading: r, selectedPage: i, rowsPerPage: a, onChangeRowsPerPage: o, onSelectPage: s }) {
8451
+ let [c, l] = useState(!0), [u, d] = useState(!1), [f, p] = useState(null), [h, g] = useState(!0), _ = [
7137
8452
  {
7138
8453
  label: "10 / page",
7139
8454
  value: 10
@@ -7150,7 +8465,7 @@ function AuditLogTable({ logs: e, onClick: t, loading: n }) {
7150
8465
  label: "Show all",
7151
8466
  value: 0
7152
8467
  }
7153
- ], [c, l] = useState(10), [u, d] = useState(1), f = ({ diffs: e, userName: t, source: n, operation: r, operationMetaData: i }) => {
8468
+ ], v = ({ diffs: e, userName: t, source: n, operation: r, operationMetaData: i }) => {
7154
8469
  let a = countDeltas(e), o = a.total ? `${a.total} change${a.total === 1 ? "" : "s"}` : "no field changes";
7155
8470
  if (n === "API") return r === "Created" ? `Created through API by ${t || "Unknown user"}` : `Changed through API by ${t || "Unknown user"}`;
7156
8471
  switch (r) {
@@ -7161,17 +8476,19 @@ function AuditLogTable({ logs: e, onClick: t, loading: n }) {
7161
8476
  case "Updated": return `Updated by ${t} (${o})`;
7162
8477
  default: return `Change by ${t}`;
7163
8478
  }
7164
- }, p = (u - 1) * (c || e.length || 1), h = c === 0 ? e.length : p + c, g = e.slice(p, h), _ = [{ cells: [
8479
+ }, y = [{ cells: [
7165
8480
  { value: "Change" },
7166
8481
  { value: "Modified by" },
7167
8482
  { value: "Using" },
7168
8483
  { value: "Operation" },
7169
8484
  { value: "Date" }
7170
- ] }], v = g.map((e) => ({ cells: [
8485
+ ] }], b = e.map((e) => ({ cells: [
7171
8486
  {
7172
- value: f(e),
8487
+ value: v(e),
7173
8488
  type: "Link",
7174
- onClick: () => t(e),
8489
+ onClick: () => {
8490
+ d(!0), p(e);
8491
+ },
7175
8492
  breakWord: !0
7176
8493
  },
7177
8494
  {
@@ -7194,7 +8511,7 @@ function AuditLogTable({ logs: e, onClick: t, loading: n }) {
7194
8511
  type: "Static"
7195
8512
  }
7196
8513
  ] }));
7197
- return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Card, {
8514
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Card, {
7198
8515
  heading: /* @__PURE__ */ jsxs(Flex, {
7199
8516
  gap: !0,
7200
8517
  wrap: !0,
@@ -7202,46 +8519,52 @@ function AuditLogTable({ logs: e, onClick: t, loading: n }) {
7202
8519
  /* @__PURE__ */ jsx(Heading, { children: "CHANGES" }),
7203
8520
  /* @__PURE__ */ jsx(Toggle, {
7204
8521
  small: !0,
7205
- checked: r,
7206
- onChange: () => i(!r),
8522
+ checked: c,
8523
+ onChange: () => l(!c),
7207
8524
  label: "Include company settings"
7208
8525
  }),
7209
8526
  /* @__PURE__ */ jsx(Toggle, {
7210
8527
  small: !0,
7211
- checked: a,
7212
- onChange: () => o(!a),
8528
+ checked: h,
8529
+ onChange: () => g(!h),
7213
8530
  label: "Include migrations"
7214
8531
  })
7215
8532
  ]
7216
8533
  }),
7217
8534
  padding: !1,
7218
- children: n ? /* @__PURE__ */ jsx(Loader, {
8535
+ children: r ? /* @__PURE__ */ jsx(Loader, {
7219
8536
  height: "100px",
7220
8537
  cover: !0,
7221
8538
  theme: Theme.WHITE,
7222
8539
  children: /* @__PURE__ */ jsx(Spinner, { dark: !0 })
7223
8540
  }) : /* @__PURE__ */ jsx(Table, { table: {
7224
- headers: _,
7225
- rows: v,
8541
+ headers: y,
8542
+ rows: b,
7226
8543
  fixedWidth: "100%",
7227
8544
  bordered: !1,
7228
8545
  actionsRight: !0,
7229
8546
  footer: { pagination: {
7230
- rowCount: e.length,
7231
- selectedPage: u,
8547
+ rowCount: n,
8548
+ selectedPage: i,
7232
8549
  rowsPerPage: {
7233
8550
  onChange: (e) => {
7234
8551
  let { value: t } = e.target;
7235
- l(Number(t)), d(1);
8552
+ o(Number(t));
7236
8553
  },
7237
- options: s,
7238
- value: c
8554
+ options: _,
8555
+ value: a
7239
8556
  },
7240
- onSelectPage: (e) => d(e),
8557
+ onSelectPage: (e) => s(e),
7241
8558
  small: !0
7242
8559
  } }
7243
8560
  } })
7244
- }) });
8561
+ }), u && f && /* @__PURE__ */ jsx(comparison_view_modal_default, {
8562
+ isOpen: u,
8563
+ onClose: () => d(!1),
8564
+ auditLogs: e,
8565
+ auditLog: f,
8566
+ data: t
8567
+ })] });
7245
8568
  }
7246
8569
  const isPrimitiveValue = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null, initializeGuiLibrary = (e) => {
7247
8570
  setConfig(ConfigKeyType.LanguageKey, e.languageKey), Object.entries(e).forEach(([e, t]) => {