react-monaco-json-merge 1.1.17 → 1.2.1

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.mjs CHANGED
@@ -1,44 +1,44 @@
1
- import { jsx as st, Fragment as On } from "react/jsx-runtime";
2
- import { useState as _e, useRef as le, useCallback as Ee, useEffect as Se } from "react";
3
- function Wt(e, t) {
1
+ import { jsx as gt, Fragment as Pn } from "react/jsx-runtime";
2
+ import { useState as _e, useRef as se, useCallback as Ne, useEffect as Se } from "react";
3
+ function tn(e, t) {
4
4
  (t == null || t > e.length) && (t = e.length);
5
5
  for (var r = 0, n = Array(t); r < t; r++) n[r] = e[r];
6
6
  return n;
7
7
  }
8
- function wn(e) {
8
+ function _n(e) {
9
9
  if (Array.isArray(e)) return e;
10
10
  }
11
- function An(e, t, r) {
12
- return (t = kn(t)) in e ? Object.defineProperty(e, t, {
11
+ function Rn(e, t, r) {
12
+ return (t = Fn(t)) in e ? Object.defineProperty(e, t, {
13
13
  value: r,
14
14
  enumerable: !0,
15
15
  configurable: !0,
16
16
  writable: !0
17
17
  }) : e[t] = r, e;
18
18
  }
19
- function Nn(e, t) {
19
+ function jn(e, t) {
20
20
  var r = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
21
21
  if (r != null) {
22
- var n, o, i, s, c = [], a = !0, u = !1;
22
+ var n, o, i, s, c = [], a = !0, f = !1;
23
23
  try {
24
24
  if (i = (r = r.call(e)).next, t !== 0) for (; !(a = (n = i.call(r)).done) && (c.push(n.value), c.length !== t); a = !0) ;
25
25
  } catch (l) {
26
- u = !0, o = l;
26
+ f = !0, o = l;
27
27
  } finally {
28
28
  try {
29
29
  if (!a && r.return != null && (s = r.return(), Object(s) !== s)) return;
30
30
  } finally {
31
- if (u) throw o;
31
+ if (f) throw o;
32
32
  }
33
33
  }
34
34
  return c;
35
35
  }
36
36
  }
37
- function En() {
37
+ function Dn() {
38
38
  throw new TypeError(`Invalid attempt to destructure non-iterable instance.
39
39
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
40
40
  }
41
- function qt(e, t) {
41
+ function nn(e, t) {
42
42
  var r = Object.keys(e);
43
43
  if (Object.getOwnPropertySymbols) {
44
44
  var n = Object.getOwnPropertySymbols(e);
@@ -48,27 +48,27 @@ function qt(e, t) {
48
48
  }
49
49
  return r;
50
50
  }
51
- function Yt(e) {
51
+ function rn(e) {
52
52
  for (var t = 1; t < arguments.length; t++) {
53
53
  var r = arguments[t] != null ? arguments[t] : {};
54
- t % 2 ? qt(Object(r), !0).forEach(function(n) {
55
- An(e, n, r[n]);
56
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : qt(Object(r)).forEach(function(n) {
54
+ t % 2 ? nn(Object(r), !0).forEach(function(n) {
55
+ Rn(e, n, r[n]);
56
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : nn(Object(r)).forEach(function(n) {
57
57
  Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
58
58
  });
59
59
  }
60
60
  return e;
61
61
  }
62
- function Tn(e, t) {
62
+ function xn(e, t) {
63
63
  if (e == null) return {};
64
- var r, n, o = In(e, t);
64
+ var r, n, o = Mn(e, t);
65
65
  if (Object.getOwnPropertySymbols) {
66
66
  var i = Object.getOwnPropertySymbols(e);
67
67
  for (n = 0; n < i.length; n++) r = i[n], t.indexOf(r) === -1 && {}.propertyIsEnumerable.call(e, r) && (o[r] = e[r]);
68
68
  }
69
69
  return o;
70
70
  }
71
- function In(e, t) {
71
+ function Mn(e, t) {
72
72
  if (e == null) return {};
73
73
  var r = {};
74
74
  for (var n in e) if ({}.hasOwnProperty.call(e, n)) {
@@ -77,10 +77,10 @@ function In(e, t) {
77
77
  }
78
78
  return r;
79
79
  }
80
- function Ln(e, t) {
81
- return wn(e) || Nn(e, t) || _n(e, t) || En();
80
+ function $n(e, t) {
81
+ return _n(e) || jn(e, t) || Un(e, t) || Dn();
82
82
  }
83
- function Sn(e, t) {
83
+ function Bn(e, t) {
84
84
  if (typeof e != "object" || !e) return e;
85
85
  var r = e[Symbol.toPrimitive];
86
86
  if (r !== void 0) {
@@ -90,18 +90,18 @@ function Sn(e, t) {
90
90
  }
91
91
  return (t === "string" ? String : Number)(e);
92
92
  }
93
- function kn(e) {
94
- var t = Sn(e, "string");
93
+ function Fn(e) {
94
+ var t = Bn(e, "string");
95
95
  return typeof t == "symbol" ? t : t + "";
96
96
  }
97
- function _n(e, t) {
97
+ function Un(e, t) {
98
98
  if (e) {
99
- if (typeof e == "string") return Wt(e, t);
99
+ if (typeof e == "string") return tn(e, t);
100
100
  var r = {}.toString.call(e).slice(8, -1);
101
- return r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set" ? Array.from(e) : r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? Wt(e, t) : void 0;
101
+ return r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set" ? Array.from(e) : r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? tn(e, t) : void 0;
102
102
  }
103
103
  }
104
- function Pn(e, t, r) {
104
+ function Vn(e, t, r) {
105
105
  return t in e ? Object.defineProperty(e, t, {
106
106
  value: r,
107
107
  enumerable: !0,
@@ -109,7 +109,7 @@ function Pn(e, t, r) {
109
109
  writable: !0
110
110
  }) : e[t] = r, e;
111
111
  }
112
- function zt(e, t) {
112
+ function on(e, t) {
113
113
  var r = Object.keys(e);
114
114
  if (Object.getOwnPropertySymbols) {
115
115
  var n = Object.getOwnPropertySymbols(e);
@@ -119,18 +119,18 @@ function zt(e, t) {
119
119
  }
120
120
  return r;
121
121
  }
122
- function Xt(e) {
122
+ function sn(e) {
123
123
  for (var t = 1; t < arguments.length; t++) {
124
124
  var r = arguments[t] != null ? arguments[t] : {};
125
- t % 2 ? zt(Object(r), !0).forEach(function(n) {
126
- Pn(e, n, r[n]);
127
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : zt(Object(r)).forEach(function(n) {
125
+ t % 2 ? on(Object(r), !0).forEach(function(n) {
126
+ Vn(e, n, r[n]);
127
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : on(Object(r)).forEach(function(n) {
128
128
  Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
129
129
  });
130
130
  }
131
131
  return e;
132
132
  }
133
- function Rn() {
133
+ function Jn() {
134
134
  for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
135
135
  t[r] = arguments[r];
136
136
  return function(n) {
@@ -139,7 +139,7 @@ function Rn() {
139
139
  }, n);
140
140
  };
141
141
  }
142
- function Ce(e) {
142
+ function ct(e) {
143
143
  return function t() {
144
144
  for (var r = this, n = arguments.length, o = new Array(n), i = 0; i < n; i++)
145
145
  o[i] = arguments[i];
@@ -150,38 +150,38 @@ function Ce(e) {
150
150
  };
151
151
  };
152
152
  }
153
- function lt(e) {
153
+ function vt(e) {
154
154
  return {}.toString.call(e).includes("Object");
155
155
  }
156
- function jn(e) {
156
+ function Hn(e) {
157
157
  return !Object.keys(e).length;
158
158
  }
159
- function Ke(e) {
159
+ function at(e) {
160
160
  return typeof e == "function";
161
161
  }
162
- function Dn(e, t) {
162
+ function Gn(e, t) {
163
163
  return Object.prototype.hasOwnProperty.call(e, t);
164
164
  }
165
- function Mn(e, t) {
166
- return lt(t) || Re("changeType"), Object.keys(t).some(function(r) {
167
- return !Dn(e, r);
168
- }) && Re("changeField"), t;
165
+ function Wn(e, t) {
166
+ return vt(t) || Me("changeType"), Object.keys(t).some(function(r) {
167
+ return !Gn(e, r);
168
+ }) && Me("changeField"), t;
169
169
  }
170
- function xn(e) {
171
- Ke(e) || Re("selectorType");
170
+ function qn(e) {
171
+ at(e) || Me("selectorType");
172
172
  }
173
- function $n(e) {
174
- Ke(e) || lt(e) || Re("handlerType"), lt(e) && Object.values(e).some(function(t) {
175
- return !Ke(t);
176
- }) && Re("handlersType");
173
+ function Yn(e) {
174
+ at(e) || vt(e) || Me("handlerType"), vt(e) && Object.values(e).some(function(t) {
175
+ return !at(t);
176
+ }) && Me("handlersType");
177
177
  }
178
- function Bn(e) {
179
- e || Re("initialIsRequired"), lt(e) || Re("initialType"), jn(e) && Re("initialContent");
178
+ function zn(e) {
179
+ e || Me("initialIsRequired"), vt(e) || Me("initialType"), Hn(e) && Me("initialContent");
180
180
  }
181
- function Fn(e, t) {
181
+ function Cn(e, t) {
182
182
  throw new Error(e[t] || e.default);
183
183
  }
184
- var Un = {
184
+ var Xn = {
185
185
  initialIsRequired: "initial state is required",
186
186
  initialType: "initial state should be an object",
187
187
  initialContent: "initial state shouldn't be an empty object",
@@ -191,49 +191,49 @@ var Un = {
191
191
  changeType: "provided value of changes should be an object",
192
192
  changeField: 'it seams you want to change a field in the state which is not specified in the "initial" state',
193
193
  default: "an unknown error accured in `state-local` package"
194
- }, Re = Ce(Fn)(Un), it = {
195
- changes: Mn,
196
- selector: xn,
197
- handler: $n,
198
- initial: Bn
194
+ }, Me = ct(Cn)(Xn), ht = {
195
+ changes: Wn,
196
+ selector: qn,
197
+ handler: Yn,
198
+ initial: zn
199
199
  };
200
- function Vn(e) {
200
+ function Kn(e) {
201
201
  var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
202
- it.initial(e), it.handler(t);
202
+ ht.initial(e), ht.handler(t);
203
203
  var r = {
204
204
  current: e
205
- }, n = Ce(Gn)(r, t), o = Ce(Hn)(r), i = Ce(it.changes)(e), s = Ce(Jn)(r);
205
+ }, n = ct(er)(r, t), o = ct(Zn)(r), i = ct(ht.changes)(e), s = ct(Qn)(r);
206
206
  function c() {
207
- var u = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function(l) {
207
+ var f = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function(l) {
208
208
  return l;
209
209
  };
210
- return it.selector(u), u(r.current);
210
+ return ht.selector(f), f(r.current);
211
211
  }
212
- function a(u) {
213
- Rn(n, o, i, s)(u);
212
+ function a(f) {
213
+ Jn(n, o, i, s)(f);
214
214
  }
215
215
  return [c, a];
216
216
  }
217
- function Jn(e, t) {
218
- return Ke(t) ? t(e.current) : t;
217
+ function Qn(e, t) {
218
+ return at(t) ? t(e.current) : t;
219
219
  }
220
- function Hn(e, t) {
221
- return e.current = Xt(Xt({}, e.current), t), t;
220
+ function Zn(e, t) {
221
+ return e.current = sn(sn({}, e.current), t), t;
222
222
  }
223
- function Gn(e, t, r) {
224
- return Ke(t) ? t(e.current) : Object.keys(r).forEach(function(n) {
223
+ function er(e, t, r) {
224
+ return at(t) ? t(e.current) : Object.keys(r).forEach(function(n) {
225
225
  var o;
226
226
  return (o = t[n]) === null || o === void 0 ? void 0 : o.call(t, e.current[n]);
227
227
  }), r;
228
228
  }
229
- var Wn = {
230
- create: Vn
231
- }, qn = {
229
+ var tr = {
230
+ create: Kn
231
+ }, nr = {
232
232
  paths: {
233
233
  vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs"
234
234
  }
235
235
  };
236
- function Yn(e) {
236
+ function rr(e) {
237
237
  return function t() {
238
238
  for (var r = this, n = arguments.length, o = new Array(n), i = 0; i < n; i++)
239
239
  o[i] = arguments[i];
@@ -244,23 +244,23 @@ function Yn(e) {
244
244
  };
245
245
  };
246
246
  }
247
- function zn(e) {
247
+ function or(e) {
248
248
  return {}.toString.call(e).includes("Object");
249
249
  }
250
- function Xn(e) {
251
- return e || Qt("configIsRequired"), zn(e) || Qt("configType"), e.urls ? (Qn(), {
250
+ function ir(e) {
251
+ return e || cn("configIsRequired"), or(e) || cn("configType"), e.urls ? (sr(), {
252
252
  paths: {
253
253
  vs: e.urls.monacoBase
254
254
  }
255
255
  }) : e;
256
256
  }
257
- function Qn() {
258
- console.warn(on.deprecation);
257
+ function sr() {
258
+ console.warn(gn.deprecation);
259
259
  }
260
- function Zn(e, t) {
260
+ function cr(e, t) {
261
261
  throw new Error(e[t] || e.default);
262
262
  }
263
- var on = {
263
+ var gn = {
264
264
  configIsRequired: "the configuration object is required",
265
265
  configType: "the configuration object should be an object",
266
266
  default: "an unknown error accured in `@monaco-editor/loader` package",
@@ -274,9 +274,9 @@ var on = {
274
274
 
275
275
  For more please check the link https://github.com/suren-atoyan/monaco-loader#config
276
276
  `
277
- }, Qt = Yn(Zn)(on), Cn = {
278
- config: Xn
279
- }, Kn = function() {
277
+ }, cn = rr(cr)(gn), ar = {
278
+ config: ir
279
+ }, lr = function() {
280
280
  for (var t = arguments.length, r = new Array(t), n = 0; n < t; n++)
281
281
  r[n] = arguments[n];
282
282
  return function(o) {
@@ -285,43 +285,43 @@ var on = {
285
285
  }, o);
286
286
  };
287
287
  };
288
- function sn(e, t) {
288
+ function mn(e, t) {
289
289
  return Object.keys(t).forEach(function(r) {
290
- t[r] instanceof Object && e[r] && Object.assign(t[r], sn(e[r], t[r]));
291
- }), Yt(Yt({}, e), t);
290
+ t[r] instanceof Object && e[r] && Object.assign(t[r], mn(e[r], t[r]));
291
+ }), rn(rn({}, e), t);
292
292
  }
293
- var er = {
293
+ var ur = {
294
294
  type: "cancelation",
295
295
  msg: "operation is manually canceled"
296
296
  };
297
- function vt(e) {
297
+ function Lt(e) {
298
298
  var t = !1, r = new Promise(function(n, o) {
299
299
  e.then(function(i) {
300
- return t ? o(er) : n(i);
300
+ return t ? o(ur) : n(i);
301
301
  }), e.catch(o);
302
302
  });
303
303
  return r.cancel = function() {
304
304
  return t = !0;
305
305
  }, r;
306
306
  }
307
- var tr = ["monaco"], nr = Wn.create({
308
- config: qn,
307
+ var fr = ["monaco"], pr = tr.create({
308
+ config: nr,
309
309
  isInitialized: !1,
310
310
  resolve: null,
311
311
  reject: null,
312
312
  monaco: null
313
- }), cn = Ln(nr, 2), tt = cn[0], dt = cn[1];
314
- function rr(e) {
315
- var t = Cn.config(e), r = t.monaco, n = Tn(t, tr);
316
- dt(function(o) {
313
+ }), yn = $n(pr, 2), ut = yn[0], At = yn[1];
314
+ function dr(e) {
315
+ var t = ar.config(e), r = t.monaco, n = xn(t, fr);
316
+ At(function(o) {
317
317
  return {
318
- config: sn(o.config, n),
318
+ config: mn(o.config, n),
319
319
  monaco: r
320
320
  };
321
321
  });
322
322
  }
323
- function or() {
324
- var e = tt(function(t) {
323
+ function hr() {
324
+ var e = ut(function(t) {
325
325
  var r = t.monaco, n = t.isInitialized, o = t.resolve;
326
326
  return {
327
327
  monaco: r,
@@ -330,37 +330,37 @@ function or() {
330
330
  };
331
331
  });
332
332
  if (!e.isInitialized) {
333
- if (dt({
333
+ if (At({
334
334
  isInitialized: !0
335
335
  }), e.monaco)
336
- return e.resolve(e.monaco), vt(bt);
336
+ return e.resolve(e.monaco), Lt(kt);
337
337
  if (window.monaco && window.monaco.editor)
338
- return an(window.monaco), e.resolve(window.monaco), vt(bt);
339
- Kn(ir, cr)(ar);
338
+ return vn(window.monaco), e.resolve(window.monaco), Lt(kt);
339
+ lr(gr, yr)(vr);
340
340
  }
341
- return vt(bt);
341
+ return Lt(kt);
342
342
  }
343
- function ir(e) {
343
+ function gr(e) {
344
344
  return document.body.appendChild(e);
345
345
  }
346
- function sr(e) {
346
+ function mr(e) {
347
347
  var t = document.createElement("script");
348
348
  return e && (t.src = e), t;
349
349
  }
350
- function cr(e) {
351
- var t = tt(function(n) {
350
+ function yr(e) {
351
+ var t = ut(function(n) {
352
352
  var o = n.config, i = n.reject;
353
353
  return {
354
354
  config: o,
355
355
  reject: i
356
356
  };
357
- }), r = sr("".concat(t.config.paths.vs, "/loader.js"));
357
+ }), r = mr("".concat(t.config.paths.vs, "/loader.js"));
358
358
  return r.onload = function() {
359
359
  return e();
360
360
  }, r.onerror = t.reject, r;
361
361
  }
362
- function ar() {
363
- var e = tt(function(r) {
362
+ function vr() {
363
+ var e = ut(function(r) {
364
364
  var n = r.config, o = r.resolve, i = r.reject;
365
365
  return {
366
366
  config: n,
@@ -370,154 +370,154 @@ function ar() {
370
370
  }), t = window.require;
371
371
  t.config(e.config), t(["vs/editor/editor.main"], function(r) {
372
372
  var n = r.m;
373
- an(n), e.resolve(n);
373
+ vn(n), e.resolve(n);
374
374
  }, function(r) {
375
375
  e.reject(r);
376
376
  });
377
377
  }
378
- function an(e) {
379
- tt().monaco || dt({
378
+ function vn(e) {
379
+ ut().monaco || At({
380
380
  monaco: e
381
381
  });
382
382
  }
383
- function lr() {
384
- return tt(function(e) {
383
+ function br() {
384
+ return ut(function(e) {
385
385
  var t = e.monaco;
386
386
  return t;
387
387
  });
388
388
  }
389
- var bt = new Promise(function(e, t) {
390
- return dt({
389
+ var kt = new Promise(function(e, t) {
390
+ return At({
391
391
  resolve: e,
392
392
  reject: t
393
393
  });
394
- }), ur = {
395
- config: rr,
396
- init: or,
397
- __getMonacoInstance: lr
398
- }, te = /* @__PURE__ */ ((e) => (e[e.excluded = 0] = "excluded", e[e.first = 1] = "first", e[e.second = 2] = "second", e))(te || {}), D = /* @__PURE__ */ ((e) => (e.SAME_CHANGE = "same_change", e.INPUT1_ONLY = "input1_only", e.INPUT2_ONLY = "input2_only", e.TRUE_CONFLICT = "true_conflict", e))(D || {});
399
- function fr(e, t = !1) {
394
+ }), wr = {
395
+ config: dr,
396
+ init: hr,
397
+ __getMonacoInstance: br
398
+ }, oe = /* @__PURE__ */ ((e) => (e[e.excluded = 0] = "excluded", e[e.first = 1] = "first", e[e.second = 2] = "second", e))(oe || {}), $ = /* @__PURE__ */ ((e) => (e.SAME_CHANGE = "same_change", e.INPUT1_ONLY = "input1_only", e.INPUT2_ONLY = "input2_only", e.TRUE_CONFLICT = "true_conflict", e))($ || {});
399
+ function Or(e, t = !1) {
400
400
  const r = e.length;
401
- let n = 0, o = "", i = 0, s = 16, c = 0, a = 0, u = 0, l = 0, y = 0;
402
- function p(f, E) {
403
- let S = 0, g = 0;
404
- for (; S < f; ) {
405
- let b = e.charCodeAt(n);
406
- if (b >= 48 && b <= 57)
407
- g = g * 16 + b - 48;
408
- else if (b >= 65 && b <= 70)
409
- g = g * 16 + b - 65 + 10;
410
- else if (b >= 97 && b <= 102)
411
- g = g * 16 + b - 97 + 10;
401
+ let n = 0, o = "", i = 0, s = 16, c = 0, a = 0, f = 0, l = 0, y = 0;
402
+ function d(u, A) {
403
+ let S = 0, p = 0;
404
+ for (; S < u; ) {
405
+ let v = e.charCodeAt(n);
406
+ if (v >= 48 && v <= 57)
407
+ p = p * 16 + v - 48;
408
+ else if (v >= 65 && v <= 70)
409
+ p = p * 16 + v - 65 + 10;
410
+ else if (v >= 97 && v <= 102)
411
+ p = p * 16 + v - 97 + 10;
412
412
  else
413
413
  break;
414
414
  n++, S++;
415
415
  }
416
- return S < f && (g = -1), g;
416
+ return S < u && (p = -1), p;
417
417
  }
418
- function d(f) {
419
- n = f, o = "", i = 0, s = 16, y = 0;
418
+ function h(u) {
419
+ n = u, o = "", i = 0, s = 16, y = 0;
420
420
  }
421
- function L() {
422
- let f = n;
421
+ function T() {
422
+ let u = n;
423
423
  if (e.charCodeAt(n) === 48)
424
424
  n++;
425
425
  else
426
- for (n++; n < e.length && Je(e.charCodeAt(n)); )
426
+ for (n++; n < e.length && Ce(e.charCodeAt(n)); )
427
427
  n++;
428
428
  if (n < e.length && e.charCodeAt(n) === 46)
429
- if (n++, n < e.length && Je(e.charCodeAt(n)))
430
- for (n++; n < e.length && Je(e.charCodeAt(n)); )
429
+ if (n++, n < e.length && Ce(e.charCodeAt(n)))
430
+ for (n++; n < e.length && Ce(e.charCodeAt(n)); )
431
431
  n++;
432
432
  else
433
- return y = 3, e.substring(f, n);
434
- let E = n;
433
+ return y = 3, e.substring(u, n);
434
+ let A = n;
435
435
  if (n < e.length && (e.charCodeAt(n) === 69 || e.charCodeAt(n) === 101))
436
- if (n++, (n < e.length && e.charCodeAt(n) === 43 || e.charCodeAt(n) === 45) && n++, n < e.length && Je(e.charCodeAt(n))) {
437
- for (n++; n < e.length && Je(e.charCodeAt(n)); )
436
+ if (n++, (n < e.length && e.charCodeAt(n) === 43 || e.charCodeAt(n) === 45) && n++, n < e.length && Ce(e.charCodeAt(n))) {
437
+ for (n++; n < e.length && Ce(e.charCodeAt(n)); )
438
438
  n++;
439
- E = n;
439
+ A = n;
440
440
  } else
441
441
  y = 3;
442
- return e.substring(f, E);
442
+ return e.substring(u, A);
443
443
  }
444
444
  function N() {
445
- let f = "", E = n;
445
+ let u = "", A = n;
446
446
  for (; ; ) {
447
447
  if (n >= r) {
448
- f += e.substring(E, n), y = 2;
448
+ u += e.substring(A, n), y = 2;
449
449
  break;
450
450
  }
451
451
  const S = e.charCodeAt(n);
452
452
  if (S === 34) {
453
- f += e.substring(E, n), n++;
453
+ u += e.substring(A, n), n++;
454
454
  break;
455
455
  }
456
456
  if (S === 92) {
457
- if (f += e.substring(E, n), n++, n >= r) {
457
+ if (u += e.substring(A, n), n++, n >= r) {
458
458
  y = 2;
459
459
  break;
460
460
  }
461
461
  switch (e.charCodeAt(n++)) {
462
462
  case 34:
463
- f += '"';
463
+ u += '"';
464
464
  break;
465
465
  case 92:
466
- f += "\\";
466
+ u += "\\";
467
467
  break;
468
468
  case 47:
469
- f += "/";
469
+ u += "/";
470
470
  break;
471
471
  case 98:
472
- f += "\b";
472
+ u += "\b";
473
473
  break;
474
474
  case 102:
475
- f += "\f";
475
+ u += "\f";
476
476
  break;
477
477
  case 110:
478
- f += `
478
+ u += `
479
479
  `;
480
480
  break;
481
481
  case 114:
482
- f += "\r";
482
+ u += "\r";
483
483
  break;
484
484
  case 116:
485
- f += " ";
485
+ u += " ";
486
486
  break;
487
487
  case 117:
488
- const b = p(4);
489
- b >= 0 ? f += String.fromCharCode(b) : y = 4;
488
+ const v = d(4);
489
+ v >= 0 ? u += String.fromCharCode(v) : y = 4;
490
490
  break;
491
491
  default:
492
492
  y = 5;
493
493
  }
494
- E = n;
494
+ A = n;
495
495
  continue;
496
496
  }
497
497
  if (S >= 0 && S <= 31)
498
- if (Qe(S)) {
499
- f += e.substring(E, n), y = 2;
498
+ if (it(S)) {
499
+ u += e.substring(A, n), y = 2;
500
500
  break;
501
501
  } else
502
502
  y = 6;
503
503
  n++;
504
504
  }
505
- return f;
505
+ return u;
506
506
  }
507
- function v() {
508
- if (o = "", y = 0, i = n, a = c, l = u, n >= r)
507
+ function m() {
508
+ if (o = "", y = 0, i = n, a = c, l = f, n >= r)
509
509
  return i = r, s = 17;
510
- let f = e.charCodeAt(n);
511
- if (Ot(f)) {
510
+ let u = e.charCodeAt(n);
511
+ if (St(u)) {
512
512
  do
513
- n++, o += String.fromCharCode(f), f = e.charCodeAt(n);
514
- while (Ot(f));
513
+ n++, o += String.fromCharCode(u), u = e.charCodeAt(n);
514
+ while (St(u));
515
515
  return s = 15;
516
516
  }
517
- if (Qe(f))
518
- return n++, o += String.fromCharCode(f), f === 13 && e.charCodeAt(n) === 10 && (n++, o += `
519
- `), c++, u = n, s = 14;
520
- switch (f) {
517
+ if (it(u))
518
+ return n++, o += String.fromCharCode(u), u === 13 && e.charCodeAt(n) === 10 && (n++, o += `
519
+ `), c++, f = n, s = 14;
520
+ switch (u) {
521
521
  // tokens: []{}:,
522
522
  case 123:
523
523
  return n++, s = 1;
@@ -536,30 +536,30 @@ function fr(e, t = !1) {
536
536
  return n++, o = N(), s = 10;
537
537
  // comments
538
538
  case 47:
539
- const E = n - 1;
539
+ const A = n - 1;
540
540
  if (e.charCodeAt(n + 1) === 47) {
541
- for (n += 2; n < r && !Qe(e.charCodeAt(n)); )
541
+ for (n += 2; n < r && !it(e.charCodeAt(n)); )
542
542
  n++;
543
- return o = e.substring(E, n), s = 12;
543
+ return o = e.substring(A, n), s = 12;
544
544
  }
545
545
  if (e.charCodeAt(n + 1) === 42) {
546
546
  n += 2;
547
547
  const S = r - 1;
548
- let g = !1;
548
+ let p = !1;
549
549
  for (; n < S; ) {
550
- const b = e.charCodeAt(n);
551
- if (b === 42 && e.charCodeAt(n + 1) === 47) {
552
- n += 2, g = !0;
550
+ const v = e.charCodeAt(n);
551
+ if (v === 42 && e.charCodeAt(n + 1) === 47) {
552
+ n += 2, p = !0;
553
553
  break;
554
554
  }
555
- n++, Qe(b) && (b === 13 && e.charCodeAt(n) === 10 && n++, c++, u = n);
555
+ n++, it(v) && (v === 13 && e.charCodeAt(n) === 10 && n++, c++, f = n);
556
556
  }
557
- return g || (n++, y = 1), o = e.substring(E, n), s = 13;
557
+ return p || (n++, y = 1), o = e.substring(A, n), s = 13;
558
558
  }
559
- return o += String.fromCharCode(f), n++, s = 16;
559
+ return o += String.fromCharCode(u), n++, s = 16;
560
560
  // numbers
561
561
  case 45:
562
- if (o += String.fromCharCode(f), n++, n === r || !Je(e.charCodeAt(n)))
562
+ if (o += String.fromCharCode(u), n++, n === r || !Ce(e.charCodeAt(n)))
563
563
  return s = 16;
564
564
  // found a minus, followed by a number so
565
565
  // we fall through to proceed with scanning
@@ -574,11 +574,11 @@ function fr(e, t = !1) {
574
574
  case 55:
575
575
  case 56:
576
576
  case 57:
577
- return o += L(), s = 11;
577
+ return o += T(), s = 11;
578
578
  // literals and unknown symbols
579
579
  default:
580
- for (; n < r && h(f); )
581
- n++, f = e.charCodeAt(n);
580
+ for (; n < r && g(u); )
581
+ n++, u = e.charCodeAt(n);
582
582
  if (i !== n) {
583
583
  switch (o = e.substring(i, n), o) {
584
584
  case "true":
@@ -590,13 +590,13 @@ function fr(e, t = !1) {
590
590
  }
591
591
  return s = 16;
592
592
  }
593
- return o += String.fromCharCode(f), n++, s = 16;
593
+ return o += String.fromCharCode(u), n++, s = 16;
594
594
  }
595
595
  }
596
- function h(f) {
597
- if (Ot(f) || Qe(f))
596
+ function g(u) {
597
+ if (St(u) || it(u))
598
598
  return !1;
599
- switch (f) {
599
+ switch (u) {
600
600
  case 125:
601
601
  case 93:
602
602
  case 123:
@@ -609,17 +609,17 @@ function fr(e, t = !1) {
609
609
  }
610
610
  return !0;
611
611
  }
612
- function m() {
613
- let f;
612
+ function O() {
613
+ let u;
614
614
  do
615
- f = v();
616
- while (f >= 12 && f <= 15);
617
- return f;
615
+ u = m();
616
+ while (u >= 12 && u <= 15);
617
+ return u;
618
618
  }
619
619
  return {
620
- setPosition: d,
620
+ setPosition: h,
621
621
  getPosition: () => n,
622
- scan: t ? m : v,
622
+ scan: t ? O : m,
623
623
  getToken: () => s,
624
624
  getTokenValue: () => o,
625
625
  getTokenOffset: () => i,
@@ -629,33 +629,33 @@ function fr(e, t = !1) {
629
629
  getTokenError: () => y
630
630
  };
631
631
  }
632
- function Ot(e) {
632
+ function St(e) {
633
633
  return e === 32 || e === 9;
634
634
  }
635
- function Qe(e) {
635
+ function it(e) {
636
636
  return e === 10 || e === 13;
637
637
  }
638
- function Je(e) {
638
+ function Ce(e) {
639
639
  return e >= 48 && e <= 57;
640
640
  }
641
- var Zt;
641
+ var an;
642
642
  (function(e) {
643
643
  e[e.lineFeed = 10] = "lineFeed", e[e.carriageReturn = 13] = "carriageReturn", e[e.space = 32] = "space", e[e._0 = 48] = "_0", e[e._1 = 49] = "_1", e[e._2 = 50] = "_2", e[e._3 = 51] = "_3", e[e._4 = 52] = "_4", e[e._5 = 53] = "_5", e[e._6 = 54] = "_6", e[e._7 = 55] = "_7", e[e._8 = 56] = "_8", e[e._9 = 57] = "_9", e[e.a = 97] = "a", e[e.b = 98] = "b", e[e.c = 99] = "c", e[e.d = 100] = "d", e[e.e = 101] = "e", e[e.f = 102] = "f", e[e.g = 103] = "g", e[e.h = 104] = "h", e[e.i = 105] = "i", e[e.j = 106] = "j", e[e.k = 107] = "k", e[e.l = 108] = "l", e[e.m = 109] = "m", e[e.n = 110] = "n", e[e.o = 111] = "o", e[e.p = 112] = "p", e[e.q = 113] = "q", e[e.r = 114] = "r", e[e.s = 115] = "s", e[e.t = 116] = "t", e[e.u = 117] = "u", e[e.v = 118] = "v", e[e.w = 119] = "w", e[e.x = 120] = "x", e[e.y = 121] = "y", e[e.z = 122] = "z", e[e.A = 65] = "A", e[e.B = 66] = "B", e[e.C = 67] = "C", e[e.D = 68] = "D", e[e.E = 69] = "E", e[e.F = 70] = "F", e[e.G = 71] = "G", e[e.H = 72] = "H", e[e.I = 73] = "I", e[e.J = 74] = "J", e[e.K = 75] = "K", e[e.L = 76] = "L", e[e.M = 77] = "M", e[e.N = 78] = "N", e[e.O = 79] = "O", e[e.P = 80] = "P", e[e.Q = 81] = "Q", e[e.R = 82] = "R", e[e.S = 83] = "S", e[e.T = 84] = "T", e[e.U = 85] = "U", e[e.V = 86] = "V", e[e.W = 87] = "W", e[e.X = 88] = "X", e[e.Y = 89] = "Y", e[e.Z = 90] = "Z", e[e.asterisk = 42] = "asterisk", e[e.backslash = 92] = "backslash", e[e.closeBrace = 125] = "closeBrace", e[e.closeBracket = 93] = "closeBracket", e[e.colon = 58] = "colon", e[e.comma = 44] = "comma", e[e.dot = 46] = "dot", e[e.doubleQuote = 34] = "doubleQuote", e[e.minus = 45] = "minus", e[e.openBrace = 123] = "openBrace", e[e.openBracket = 91] = "openBracket", e[e.plus = 43] = "plus", e[e.slash = 47] = "slash", e[e.formFeed = 12] = "formFeed", e[e.tab = 9] = "tab";
644
- })(Zt || (Zt = {}));
644
+ })(an || (an = {}));
645
645
  new Array(20).fill(0).map((e, t) => " ".repeat(t));
646
- const He = 200;
647
- new Array(He).fill(0).map((e, t) => `
648
- ` + " ".repeat(t)), new Array(He).fill(0).map((e, t) => "\r" + " ".repeat(t)), new Array(He).fill(0).map((e, t) => `\r
649
- ` + " ".repeat(t)), new Array(He).fill(0).map((e, t) => `
650
- ` + " ".repeat(t)), new Array(He).fill(0).map((e, t) => "\r" + " ".repeat(t)), new Array(He).fill(0).map((e, t) => `\r
646
+ const Xe = 200;
647
+ new Array(Xe).fill(0).map((e, t) => `
648
+ ` + " ".repeat(t)), new Array(Xe).fill(0).map((e, t) => "\r" + " ".repeat(t)), new Array(Xe).fill(0).map((e, t) => `\r
649
+ ` + " ".repeat(t)), new Array(Xe).fill(0).map((e, t) => `
650
+ ` + " ".repeat(t)), new Array(Xe).fill(0).map((e, t) => "\r" + " ".repeat(t)), new Array(Xe).fill(0).map((e, t) => `\r
651
651
  ` + " ".repeat(t));
652
- var ut;
652
+ var bt;
653
653
  (function(e) {
654
654
  e.DEFAULT = {
655
655
  allowTrailingComma: !1
656
656
  };
657
- })(ut || (ut = {}));
658
- function pr(e, t = [], r = ut.DEFAULT) {
657
+ })(bt || (bt = {}));
658
+ function Ar(e, t = [], r = bt.DEFAULT) {
659
659
  let n = { type: "array", offset: -1, length: -1, children: [], parent: void 0 };
660
660
  function o(a) {
661
661
  n.type === "property" && (n.length = a - n.offset, n = n.parent);
@@ -663,36 +663,36 @@ function pr(e, t = [], r = ut.DEFAULT) {
663
663
  function i(a) {
664
664
  return n.children.push(a), a;
665
665
  }
666
- hr(e, {
666
+ Er(e, {
667
667
  onObjectBegin: (a) => {
668
668
  n = i({ type: "object", offset: a, length: -1, parent: n, children: [] });
669
669
  },
670
- onObjectProperty: (a, u, l) => {
671
- n = i({ type: "property", offset: u, length: -1, parent: n, children: [] }), n.children.push({ type: "string", value: a, offset: u, length: l, parent: n });
670
+ onObjectProperty: (a, f, l) => {
671
+ n = i({ type: "property", offset: f, length: -1, parent: n, children: [] }), n.children.push({ type: "string", value: a, offset: f, length: l, parent: n });
672
672
  },
673
- onObjectEnd: (a, u) => {
674
- o(a + u), n.length = a + u - n.offset, n = n.parent, o(a + u);
673
+ onObjectEnd: (a, f) => {
674
+ o(a + f), n.length = a + f - n.offset, n = n.parent, o(a + f);
675
675
  },
676
- onArrayBegin: (a, u) => {
676
+ onArrayBegin: (a, f) => {
677
677
  n = i({ type: "array", offset: a, length: -1, parent: n, children: [] });
678
678
  },
679
- onArrayEnd: (a, u) => {
680
- n.length = a + u - n.offset, n = n.parent, o(a + u);
679
+ onArrayEnd: (a, f) => {
680
+ n.length = a + f - n.offset, n = n.parent, o(a + f);
681
681
  },
682
- onLiteralValue: (a, u, l) => {
683
- i({ type: gr(a), offset: u, length: l, parent: n, value: a }), o(u + l);
682
+ onLiteralValue: (a, f, l) => {
683
+ i({ type: Tr(a), offset: f, length: l, parent: n, value: a }), o(f + l);
684
684
  },
685
- onSeparator: (a, u, l) => {
686
- n.type === "property" && (a === ":" ? n.colonOffset = u : a === "," && o(u));
685
+ onSeparator: (a, f, l) => {
686
+ n.type === "property" && (a === ":" ? n.colonOffset = f : a === "," && o(f));
687
687
  },
688
- onError: (a, u, l) => {
689
- t.push({ error: a, offset: u, length: l });
688
+ onError: (a, f, l) => {
689
+ t.push({ error: a, offset: f, length: l });
690
690
  }
691
691
  }, r);
692
692
  const c = n.children[0];
693
693
  return c && delete c.parent, c;
694
694
  }
695
- function dr(e, t) {
695
+ function Nr(e, t) {
696
696
  if (!e)
697
697
  return;
698
698
  let r = e;
@@ -716,80 +716,80 @@ function dr(e, t) {
716
716
  }
717
717
  return r;
718
718
  }
719
- function hr(e, t, r = ut.DEFAULT) {
720
- const n = fr(e, !1), o = [];
719
+ function Er(e, t, r = bt.DEFAULT) {
720
+ const n = Or(e, !1), o = [];
721
721
  let i = 0;
722
- function s(A) {
723
- return A ? () => i === 0 && A(n.getTokenOffset(), n.getTokenLength(), n.getTokenStartLine(), n.getTokenStartCharacter()) : () => !0;
722
+ function s(L) {
723
+ return L ? () => i === 0 && L(n.getTokenOffset(), n.getTokenLength(), n.getTokenStartLine(), n.getTokenStartCharacter()) : () => !0;
724
724
  }
725
- function c(A) {
726
- return A ? (w) => i === 0 && A(w, n.getTokenOffset(), n.getTokenLength(), n.getTokenStartLine(), n.getTokenStartCharacter()) : () => !0;
725
+ function c(L) {
726
+ return L ? (I) => i === 0 && L(I, n.getTokenOffset(), n.getTokenLength(), n.getTokenStartLine(), n.getTokenStartCharacter()) : () => !0;
727
727
  }
728
- function a(A) {
729
- return A ? (w) => i === 0 && A(w, n.getTokenOffset(), n.getTokenLength(), n.getTokenStartLine(), n.getTokenStartCharacter(), () => o.slice()) : () => !0;
728
+ function a(L) {
729
+ return L ? (I) => i === 0 && L(I, n.getTokenOffset(), n.getTokenLength(), n.getTokenStartLine(), n.getTokenStartCharacter(), () => o.slice()) : () => !0;
730
730
  }
731
- function u(A) {
732
- return A ? () => {
733
- i > 0 ? i++ : A(n.getTokenOffset(), n.getTokenLength(), n.getTokenStartLine(), n.getTokenStartCharacter(), () => o.slice()) === !1 && (i = 1);
731
+ function f(L) {
732
+ return L ? () => {
733
+ i > 0 ? i++ : L(n.getTokenOffset(), n.getTokenLength(), n.getTokenStartLine(), n.getTokenStartCharacter(), () => o.slice()) === !1 && (i = 1);
734
734
  } : () => !0;
735
735
  }
736
- function l(A) {
737
- return A ? () => {
738
- i > 0 && i--, i === 0 && A(n.getTokenOffset(), n.getTokenLength(), n.getTokenStartLine(), n.getTokenStartCharacter());
736
+ function l(L) {
737
+ return L ? () => {
738
+ i > 0 && i--, i === 0 && L(n.getTokenOffset(), n.getTokenLength(), n.getTokenStartLine(), n.getTokenStartCharacter());
739
739
  } : () => !0;
740
740
  }
741
- const y = u(t.onObjectBegin), p = a(t.onObjectProperty), d = l(t.onObjectEnd), L = u(t.onArrayBegin), N = l(t.onArrayEnd), v = a(t.onLiteralValue), h = c(t.onSeparator), m = s(t.onComment), f = c(t.onError), E = r && r.disallowComments, S = r && r.allowTrailingComma;
742
- function g() {
741
+ const y = f(t.onObjectBegin), d = a(t.onObjectProperty), h = l(t.onObjectEnd), T = f(t.onArrayBegin), N = l(t.onArrayEnd), m = a(t.onLiteralValue), g = c(t.onSeparator), O = s(t.onComment), u = c(t.onError), A = r && r.disallowComments, S = r && r.allowTrailingComma;
742
+ function p() {
743
743
  for (; ; ) {
744
- const A = n.scan();
744
+ const L = n.scan();
745
745
  switch (n.getTokenError()) {
746
746
  case 4:
747
- b(
747
+ v(
748
748
  14
749
749
  /* ParseErrorCode.InvalidUnicode */
750
750
  );
751
751
  break;
752
752
  case 5:
753
- b(
753
+ v(
754
754
  15
755
755
  /* ParseErrorCode.InvalidEscapeCharacter */
756
756
  );
757
757
  break;
758
758
  case 3:
759
- b(
759
+ v(
760
760
  13
761
761
  /* ParseErrorCode.UnexpectedEndOfNumber */
762
762
  );
763
763
  break;
764
764
  case 1:
765
- E || b(
765
+ A || v(
766
766
  11
767
767
  /* ParseErrorCode.UnexpectedEndOfComment */
768
768
  );
769
769
  break;
770
770
  case 2:
771
- b(
771
+ v(
772
772
  12
773
773
  /* ParseErrorCode.UnexpectedEndOfString */
774
774
  );
775
775
  break;
776
776
  case 6:
777
- b(
777
+ v(
778
778
  16
779
779
  /* ParseErrorCode.InvalidCharacter */
780
780
  );
781
781
  break;
782
782
  }
783
- switch (A) {
783
+ switch (L) {
784
784
  case 12:
785
785
  case 13:
786
- E ? b(
786
+ A ? v(
787
787
  10
788
788
  /* ParseErrorCode.InvalidCommentToken */
789
- ) : m();
789
+ ) : O();
790
790
  break;
791
791
  case 16:
792
- b(
792
+ v(
793
793
  1
794
794
  /* ParseErrorCode.InvalidSymbol */
795
795
  );
@@ -798,119 +798,119 @@ function hr(e, t, r = ut.DEFAULT) {
798
798
  case 14:
799
799
  break;
800
800
  default:
801
- return A;
801
+ return L;
802
802
  }
803
803
  }
804
804
  }
805
- function b(A, w = [], R = []) {
806
- if (f(A), w.length + R.length > 0) {
807
- let X = n.getToken();
808
- for (; X !== 17; ) {
809
- if (w.indexOf(X) !== -1) {
810
- g();
805
+ function v(L, I = [], D = []) {
806
+ if (u(L), I.length + D.length > 0) {
807
+ let K = n.getToken();
808
+ for (; K !== 17; ) {
809
+ if (I.indexOf(K) !== -1) {
810
+ p();
811
811
  break;
812
- } else if (R.indexOf(X) !== -1)
812
+ } else if (D.indexOf(K) !== -1)
813
813
  break;
814
- X = g();
814
+ K = p();
815
815
  }
816
816
  }
817
817
  }
818
- function j(A) {
819
- const w = n.getTokenValue();
820
- return A ? v(w) : (p(w), o.push(w)), g(), !0;
818
+ function R(L) {
819
+ const I = n.getTokenValue();
820
+ return L ? m(I) : (d(I), o.push(I)), p(), !0;
821
821
  }
822
- function T() {
822
+ function P() {
823
823
  switch (n.getToken()) {
824
824
  case 11:
825
- const A = n.getTokenValue();
826
- let w = Number(A);
827
- isNaN(w) && (b(
825
+ const L = n.getTokenValue();
826
+ let I = Number(L);
827
+ isNaN(I) && (v(
828
828
  2
829
829
  /* ParseErrorCode.InvalidNumberFormat */
830
- ), w = 0), v(w);
830
+ ), I = 0), m(I);
831
831
  break;
832
832
  case 7:
833
- v(null);
833
+ m(null);
834
834
  break;
835
835
  case 8:
836
- v(!0);
836
+ m(!0);
837
837
  break;
838
838
  case 9:
839
- v(!1);
839
+ m(!1);
840
840
  break;
841
841
  default:
842
842
  return !1;
843
843
  }
844
- return g(), !0;
844
+ return p(), !0;
845
845
  }
846
- function F() {
847
- return n.getToken() !== 10 ? (b(3, [], [
846
+ function x() {
847
+ return n.getToken() !== 10 ? (v(3, [], [
848
848
  2,
849
849
  5
850
850
  /* SyntaxKind.CommaToken */
851
- ]), !1) : (j(!1), n.getToken() === 6 ? (h(":"), g(), V() || b(4, [], [
851
+ ]), !1) : (R(!1), n.getToken() === 6 ? (g(":"), p(), F() || v(4, [], [
852
852
  2,
853
853
  5
854
854
  /* SyntaxKind.CommaToken */
855
- ])) : b(5, [], [
855
+ ])) : v(5, [], [
856
856
  2,
857
857
  5
858
858
  /* SyntaxKind.CommaToken */
859
859
  ]), o.pop(), !0);
860
860
  }
861
861
  function M() {
862
- y(), g();
863
- let A = !1;
862
+ y(), p();
863
+ let L = !1;
864
864
  for (; n.getToken() !== 2 && n.getToken() !== 17; ) {
865
865
  if (n.getToken() === 5) {
866
- if (A || b(4, [], []), h(","), g(), n.getToken() === 2 && S)
866
+ if (L || v(4, [], []), g(","), p(), n.getToken() === 2 && S)
867
867
  break;
868
- } else A && b(6, [], []);
869
- F() || b(4, [], [
868
+ } else L && v(6, [], []);
869
+ x() || v(4, [], [
870
870
  2,
871
871
  5
872
872
  /* SyntaxKind.CommaToken */
873
- ]), A = !0;
873
+ ]), L = !0;
874
874
  }
875
- return d(), n.getToken() !== 2 ? b(7, [
875
+ return h(), n.getToken() !== 2 ? v(7, [
876
876
  2
877
877
  /* SyntaxKind.CloseBraceToken */
878
- ], []) : g(), !0;
878
+ ], []) : p(), !0;
879
879
  }
880
- function x() {
881
- L(), g();
882
- let A = !0, w = !1;
880
+ function B() {
881
+ T(), p();
882
+ let L = !0, I = !1;
883
883
  for (; n.getToken() !== 4 && n.getToken() !== 17; ) {
884
884
  if (n.getToken() === 5) {
885
- if (w || b(4, [], []), h(","), g(), n.getToken() === 4 && S)
885
+ if (I || v(4, [], []), g(","), p(), n.getToken() === 4 && S)
886
886
  break;
887
- } else w && b(6, [], []);
888
- A ? (o.push(0), A = !1) : o[o.length - 1]++, V() || b(4, [], [
887
+ } else I && v(6, [], []);
888
+ L ? (o.push(0), L = !1) : o[o.length - 1]++, F() || v(4, [], [
889
889
  4,
890
890
  5
891
891
  /* SyntaxKind.CommaToken */
892
- ]), w = !0;
892
+ ]), I = !0;
893
893
  }
894
- return N(), A || o.pop(), n.getToken() !== 4 ? b(8, [
894
+ return N(), L || o.pop(), n.getToken() !== 4 ? v(8, [
895
895
  4
896
896
  /* SyntaxKind.CloseBracketToken */
897
- ], []) : g(), !0;
897
+ ], []) : p(), !0;
898
898
  }
899
- function V() {
899
+ function F() {
900
900
  switch (n.getToken()) {
901
901
  case 3:
902
- return x();
902
+ return B();
903
903
  case 1:
904
904
  return M();
905
905
  case 10:
906
- return j(!0);
906
+ return R(!0);
907
907
  default:
908
- return T();
908
+ return P();
909
909
  }
910
910
  }
911
- return g(), n.getToken() === 17 ? r.allowEmptyContent ? !0 : (b(4, [], []), !1) : V() ? (n.getToken() !== 17 && b(9, [], []), !0) : (b(4, [], []), !1);
911
+ return p(), n.getToken() === 17 ? r.allowEmptyContent ? !0 : (v(4, [], []), !1) : F() ? (n.getToken() !== 17 && v(9, [], []), !0) : (v(4, [], []), !1);
912
912
  }
913
- function gr(e) {
913
+ function Tr(e) {
914
914
  switch (typeof e) {
915
915
  case "boolean":
916
916
  return "boolean";
@@ -929,25 +929,25 @@ function gr(e) {
929
929
  return "null";
930
930
  }
931
931
  }
932
- var Ct;
932
+ var ln;
933
933
  (function(e) {
934
934
  e[e.None = 0] = "None", e[e.UnexpectedEndOfComment = 1] = "UnexpectedEndOfComment", e[e.UnexpectedEndOfString = 2] = "UnexpectedEndOfString", e[e.UnexpectedEndOfNumber = 3] = "UnexpectedEndOfNumber", e[e.InvalidUnicode = 4] = "InvalidUnicode", e[e.InvalidEscapeCharacter = 5] = "InvalidEscapeCharacter", e[e.InvalidCharacter = 6] = "InvalidCharacter";
935
- })(Ct || (Ct = {}));
936
- var Kt;
935
+ })(ln || (ln = {}));
936
+ var un;
937
937
  (function(e) {
938
938
  e[e.OpenBraceToken = 1] = "OpenBraceToken", e[e.CloseBraceToken = 2] = "CloseBraceToken", e[e.OpenBracketToken = 3] = "OpenBracketToken", e[e.CloseBracketToken = 4] = "CloseBracketToken", e[e.CommaToken = 5] = "CommaToken", e[e.ColonToken = 6] = "ColonToken", e[e.NullKeyword = 7] = "NullKeyword", e[e.TrueKeyword = 8] = "TrueKeyword", e[e.FalseKeyword = 9] = "FalseKeyword", e[e.StringLiteral = 10] = "StringLiteral", e[e.NumericLiteral = 11] = "NumericLiteral", e[e.LineCommentTrivia = 12] = "LineCommentTrivia", e[e.BlockCommentTrivia = 13] = "BlockCommentTrivia", e[e.LineBreakTrivia = 14] = "LineBreakTrivia", e[e.Trivia = 15] = "Trivia", e[e.Unknown = 16] = "Unknown", e[e.EOF = 17] = "EOF";
939
- })(Kt || (Kt = {}));
940
- const ln = pr, un = dr;
941
- var en;
939
+ })(un || (un = {}));
940
+ const bn = Ar, wn = Nr;
941
+ var fn;
942
942
  (function(e) {
943
943
  e[e.InvalidSymbol = 1] = "InvalidSymbol", e[e.InvalidNumberFormat = 2] = "InvalidNumberFormat", e[e.PropertyNameExpected = 3] = "PropertyNameExpected", e[e.ValueExpected = 4] = "ValueExpected", e[e.ColonExpected = 5] = "ColonExpected", e[e.CommaExpected = 6] = "CommaExpected", e[e.CloseBraceExpected = 7] = "CloseBraceExpected", e[e.CloseBracketExpected = 8] = "CloseBracketExpected", e[e.EndOfFileExpected = 9] = "EndOfFileExpected", e[e.InvalidCommentToken = 10] = "InvalidCommentToken", e[e.UnexpectedEndOfComment = 11] = "UnexpectedEndOfComment", e[e.UnexpectedEndOfString = 12] = "UnexpectedEndOfString", e[e.UnexpectedEndOfNumber = 13] = "UnexpectedEndOfNumber", e[e.InvalidUnicode = 14] = "InvalidUnicode", e[e.InvalidEscapeCharacter = 15] = "InvalidEscapeCharacter", e[e.InvalidCharacter = 16] = "InvalidCharacter";
944
- })(en || (en = {}));
945
- function mr(e) {
944
+ })(fn || (fn = {}));
945
+ function Ir(e) {
946
946
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
947
947
  }
948
- var wt, tn;
949
- function yr() {
950
- return tn || (tn = 1, wt = function e(t, r) {
948
+ var Pt, pn;
949
+ function Lr() {
950
+ return pn || (pn = 1, Pt = function e(t, r) {
951
951
  if (t === r) return !0;
952
952
  if (t && r && typeof t == "object" && typeof r == "object") {
953
953
  if (t.constructor !== r.constructor) return !1;
@@ -971,10 +971,84 @@ function yr() {
971
971
  return !0;
972
972
  }
973
973
  return t !== t && r !== r;
974
- }), wt;
974
+ }), Pt;
975
+ }
976
+ var kr = Lr();
977
+ const he = /* @__PURE__ */ Ir(kr);
978
+ function _t(e) {
979
+ if (typeof e != "object" || e === null)
980
+ return !1;
981
+ const t = Object.getPrototypeOf(e);
982
+ return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(Symbol.toStringTag in e) && !(Symbol.iterator in e);
983
+ }
984
+ function Rt(e, t) {
985
+ return Array.isArray(e) && e.length > 0 ? [...e, t] : [t];
986
+ }
987
+ function Sr(e, t = {}) {
988
+ if (!_t(e) && !Array.isArray(e))
989
+ throw new TypeError("Expected a plain object or array");
990
+ const { deep: r = !1, compare: n, ignoreKeys: o } = t, i = /* @__PURE__ */ new WeakMap(), s = (l) => Array.isArray(o) ? o.includes(l.key) : typeof o == "function" ? o(l) : !1, c = (l) => typeof r == "boolean" ? r : typeof r == "function" ? r(l) : !1, a = (l, y, d) => {
991
+ const h = i.get(l);
992
+ if (h !== void 0)
993
+ return h;
994
+ const T = [];
995
+ T.length = l.length, i.set(l, T);
996
+ for (const N of l.keys()) {
997
+ if (!(N in l))
998
+ continue;
999
+ const m = l[N], g = String(N), O = Rt(y, g), u = {
1000
+ key: g,
1001
+ value: m,
1002
+ path: O,
1003
+ depth: d + 1
1004
+ };
1005
+ if (Array.isArray(m)) {
1006
+ T[N] = c(u) ? a(m, O, d + 1) : m;
1007
+ continue;
1008
+ }
1009
+ if (_t(m)) {
1010
+ T[N] = c(u) ? f(m, O, d + 1) : m;
1011
+ continue;
1012
+ }
1013
+ T[N] = m;
1014
+ }
1015
+ return T;
1016
+ }, f = (l, y = [], d = 0) => {
1017
+ const h = i.get(l);
1018
+ if (h !== void 0)
1019
+ return h;
1020
+ const T = {}, N = Object.keys(l), m = [], g = [];
1021
+ for (const A of N) {
1022
+ const S = l[A], p = Rt(y, A);
1023
+ s({
1024
+ key: A,
1025
+ value: S,
1026
+ path: p,
1027
+ depth: d
1028
+ }) ? m.push(A) : g.push(A);
1029
+ }
1030
+ const O = g.sort(n), u = [...m, ...O];
1031
+ i.set(l, T);
1032
+ for (const A of u) {
1033
+ const S = l[A], p = Rt(y, A), v = {
1034
+ key: A,
1035
+ value: S,
1036
+ path: p,
1037
+ depth: d
1038
+ };
1039
+ let R = S;
1040
+ c(v) && (Array.isArray(S) ? R = a(S, p, d) : _t(S) && (R = f(S, p, d + 1)));
1041
+ const P = Object.getOwnPropertyDescriptor(l, A);
1042
+ P.get || P.set ? Object.defineProperty(T, A, P) : Object.defineProperty(T, A, {
1043
+ ...P,
1044
+ value: R
1045
+ });
1046
+ }
1047
+ return T;
1048
+ };
1049
+ return Array.isArray(e) ? a(e, [], -1) : f(e, [], 0);
975
1050
  }
976
- var vr = yr();
977
- const de = /* @__PURE__ */ mr(vr), W = (e, t) => {
1051
+ const J = (e, t) => {
978
1052
  if (!e) return;
979
1053
  const r = t.replace(/^\//, "").replace(/\[/g, ".").replace(/\]/g, "").split(/[./#]/).filter(Boolean);
980
1054
  let n = e;
@@ -998,7 +1072,7 @@ const de = /* @__PURE__ */ mr(vr), W = (e, t) => {
998
1072
  * (c) 2017-2022 Joachim Wester
999
1073
  * MIT licensed
1000
1074
  */
1001
- var br = /* @__PURE__ */ (function() {
1075
+ var Pr = /* @__PURE__ */ (function() {
1002
1076
  var e = function(t, r) {
1003
1077
  return e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, o) {
1004
1078
  n.__proto__ = o;
@@ -1013,11 +1087,11 @@ var br = /* @__PURE__ */ (function() {
1013
1087
  }
1014
1088
  t.prototype = r === null ? Object.create(r) : (n.prototype = r.prototype, new n());
1015
1089
  };
1016
- })(), Or = Object.prototype.hasOwnProperty;
1017
- function Et(e, t) {
1018
- return Or.call(e, t);
1090
+ })(), _r = Object.prototype.hasOwnProperty;
1091
+ function xt(e, t) {
1092
+ return _r.call(e, t);
1019
1093
  }
1020
- function Tt(e) {
1094
+ function Mt(e) {
1021
1095
  if (Array.isArray(e)) {
1022
1096
  for (var t = new Array(e.length), r = 0; r < t.length; r++)
1023
1097
  t[r] = "" + r;
@@ -1027,10 +1101,10 @@ function Tt(e) {
1027
1101
  return Object.keys(e);
1028
1102
  var n = [];
1029
1103
  for (var o in e)
1030
- Et(e, o) && n.push(o);
1104
+ xt(e, o) && n.push(o);
1031
1105
  return n;
1032
1106
  }
1033
- function we(e) {
1107
+ function Oe(e) {
1034
1108
  switch (typeof e) {
1035
1109
  case "object":
1036
1110
  return JSON.parse(JSON.stringify(e));
@@ -1042,7 +1116,7 @@ function we(e) {
1042
1116
  return e;
1043
1117
  }
1044
1118
  }
1045
- function It(e) {
1119
+ function $t(e) {
1046
1120
  for (var t = 0, r = e.length, n; t < r; ) {
1047
1121
  if (n = e.charCodeAt(t), n >= 48 && n <= 57) {
1048
1122
  t++;
@@ -1052,29 +1126,29 @@ function It(e) {
1052
1126
  }
1053
1127
  return !0;
1054
1128
  }
1055
- function Me(e) {
1129
+ function Je(e) {
1056
1130
  return e.indexOf("/") === -1 && e.indexOf("~") === -1 ? e : e.replace(/~/g, "~0").replace(/\//g, "~1");
1057
1131
  }
1058
- function fn(e) {
1132
+ function On(e) {
1059
1133
  return e.replace(/~1/g, "/").replace(/~0/g, "~");
1060
1134
  }
1061
- function Lt(e) {
1135
+ function Bt(e) {
1062
1136
  if (e === void 0)
1063
1137
  return !0;
1064
1138
  if (e) {
1065
1139
  if (Array.isArray(e)) {
1066
1140
  for (var t = 0, r = e.length; t < r; t++)
1067
- if (Lt(e[t]))
1141
+ if (Bt(e[t]))
1068
1142
  return !0;
1069
1143
  } else if (typeof e == "object") {
1070
- for (var n = Tt(e), o = n.length, i = 0; i < o; i++)
1071
- if (Lt(e[n[i]]))
1144
+ for (var n = Mt(e), o = n.length, i = 0; i < o; i++)
1145
+ if (Bt(e[n[i]]))
1072
1146
  return !0;
1073
1147
  }
1074
1148
  }
1075
1149
  return !1;
1076
1150
  }
1077
- function nn(e, t) {
1151
+ function dn(e, t) {
1078
1152
  var r = [e];
1079
1153
  for (var n in t) {
1080
1154
  var o = typeof t[n] == "object" ? JSON.stringify(t[n], null, 2) : t[n];
@@ -1083,17 +1157,17 @@ function nn(e, t) {
1083
1157
  return r.join(`
1084
1158
  `);
1085
1159
  }
1086
- var pn = (
1160
+ var An = (
1087
1161
  /** @class */
1088
1162
  (function(e) {
1089
- br(t, e);
1163
+ Pr(t, e);
1090
1164
  function t(r, n, o, i, s) {
1091
- var c = this.constructor, a = e.call(this, nn(r, { name: n, index: o, operation: i, tree: s })) || this;
1092
- return a.name = n, a.index = o, a.operation = i, a.tree = s, Object.setPrototypeOf(a, c.prototype), a.message = nn(r, { name: n, index: o, operation: i, tree: s }), a;
1165
+ var c = this.constructor, a = e.call(this, dn(r, { name: n, index: o, operation: i, tree: s })) || this;
1166
+ return a.name = n, a.index = o, a.operation = i, a.tree = s, Object.setPrototypeOf(a, c.prototype), a.message = dn(r, { name: n, index: o, operation: i, tree: s }), a;
1093
1167
  }
1094
1168
  return t;
1095
1169
  })(Error)
1096
- ), ce = pn, wr = we, Ge = {
1170
+ ), ce = An, Rr = Oe, Ke = {
1097
1171
  add: function(e, t, r) {
1098
1172
  return e[t] = this.value, { newDocument: r };
1099
1173
  },
@@ -1106,24 +1180,24 @@ var pn = (
1106
1180
  return e[t] = this.value, { newDocument: r, removed: n };
1107
1181
  },
1108
1182
  move: function(e, t, r) {
1109
- var n = ft(r, this.path);
1110
- n && (n = we(n));
1111
- var o = xe(r, { op: "remove", path: this.from }).removed;
1112
- return xe(r, { op: "add", path: this.path, value: o }), { newDocument: r, removed: n };
1183
+ var n = wt(r, this.path);
1184
+ n && (n = Oe(n));
1185
+ var o = He(r, { op: "remove", path: this.from }).removed;
1186
+ return He(r, { op: "add", path: this.path, value: o }), { newDocument: r, removed: n };
1113
1187
  },
1114
1188
  copy: function(e, t, r) {
1115
- var n = ft(r, this.from);
1116
- return xe(r, { op: "add", path: this.path, value: we(n) }), { newDocument: r };
1189
+ var n = wt(r, this.from);
1190
+ return He(r, { op: "add", path: this.path, value: Oe(n) }), { newDocument: r };
1117
1191
  },
1118
1192
  test: function(e, t, r) {
1119
- return { newDocument: r, test: et(e[t], this.value) };
1193
+ return { newDocument: r, test: lt(e[t], this.value) };
1120
1194
  },
1121
1195
  _get: function(e, t, r) {
1122
1196
  return this.value = e[t], { newDocument: r };
1123
1197
  }
1124
- }, Ar = {
1198
+ }, jr = {
1125
1199
  add: function(e, t, r) {
1126
- return It(t) ? e.splice(t, 0, this.value) : e[t] = this.value, { newDocument: r, index: t };
1200
+ return $t(t) ? e.splice(t, 0, this.value) : e[t] = this.value, { newDocument: r, index: t };
1127
1201
  },
1128
1202
  remove: function(e, t, r) {
1129
1203
  var n = e.splice(t, 1);
@@ -1133,28 +1207,28 @@ var pn = (
1133
1207
  var n = e[t];
1134
1208
  return e[t] = this.value, { newDocument: r, removed: n };
1135
1209
  },
1136
- move: Ge.move,
1137
- copy: Ge.copy,
1138
- test: Ge.test,
1139
- _get: Ge._get
1210
+ move: Ke.move,
1211
+ copy: Ke.copy,
1212
+ test: Ke.test,
1213
+ _get: Ke._get
1140
1214
  };
1141
- function ft(e, t) {
1215
+ function wt(e, t) {
1142
1216
  if (t == "")
1143
1217
  return e;
1144
1218
  var r = { op: "_get", path: t };
1145
- return xe(e, r), r.value;
1219
+ return He(e, r), r.value;
1146
1220
  }
1147
- function xe(e, t, r, n, o, i) {
1148
- if (r === void 0 && (r = !1), n === void 0 && (n = !0), o === void 0 && (o = !0), i === void 0 && (i = 0), r && (typeof r == "function" ? r(t, 0, e, t.path) : pt(t, 0)), t.path === "") {
1221
+ function He(e, t, r, n, o, i) {
1222
+ if (r === void 0 && (r = !1), n === void 0 && (n = !0), o === void 0 && (o = !0), i === void 0 && (i = 0), r && (typeof r == "function" ? r(t, 0, e, t.path) : Ot(t, 0)), t.path === "") {
1149
1223
  var s = { newDocument: e };
1150
1224
  if (t.op === "add")
1151
1225
  return s.newDocument = t.value, s;
1152
1226
  if (t.op === "replace")
1153
1227
  return s.newDocument = t.value, s.removed = e, s;
1154
1228
  if (t.op === "move" || t.op === "copy")
1155
- return s.newDocument = ft(e, t.from), t.op === "move" && (s.removed = e), s;
1229
+ return s.newDocument = wt(e, t.from), t.op === "move" && (s.removed = e), s;
1156
1230
  if (t.op === "test") {
1157
- if (s.test = et(e, t.value), s.test === !1)
1231
+ if (s.test = lt(e, t.value), s.test === !1)
1158
1232
  throw new ce("Test operation failed", "TEST_OPERATION_FAILED", i, t, e);
1159
1233
  return s.newDocument = e, s;
1160
1234
  } else {
@@ -1167,56 +1241,56 @@ function xe(e, t, r, n, o, i) {
1167
1241
  return s;
1168
1242
  }
1169
1243
  } else {
1170
- n || (e = we(e));
1171
- var c = t.path || "", a = c.split("/"), u = e, l = 1, y = a.length, p = void 0, d = void 0, L = void 0;
1172
- for (typeof r == "function" ? L = r : L = pt; ; ) {
1173
- if (d = a[l], d && d.indexOf("~") != -1 && (d = fn(d)), o && (d == "__proto__" || d == "prototype" && l > 0 && a[l - 1] == "constructor"))
1244
+ n || (e = Oe(e));
1245
+ var c = t.path || "", a = c.split("/"), f = e, l = 1, y = a.length, d = void 0, h = void 0, T = void 0;
1246
+ for (typeof r == "function" ? T = r : T = Ot; ; ) {
1247
+ if (h = a[l], h && h.indexOf("~") != -1 && (h = On(h)), o && (h == "__proto__" || h == "prototype" && l > 0 && a[l - 1] == "constructor"))
1174
1248
  throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");
1175
- if (r && p === void 0 && (u[d] === void 0 ? p = a.slice(0, l).join("/") : l == y - 1 && (p = t.path), p !== void 0 && L(t, 0, e, p)), l++, Array.isArray(u)) {
1176
- if (d === "-")
1177
- d = u.length;
1249
+ if (r && d === void 0 && (f[h] === void 0 ? d = a.slice(0, l).join("/") : l == y - 1 && (d = t.path), d !== void 0 && T(t, 0, e, d)), l++, Array.isArray(f)) {
1250
+ if (h === "-")
1251
+ h = f.length;
1178
1252
  else {
1179
- if (r && !It(d))
1253
+ if (r && !$t(h))
1180
1254
  throw new ce("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index", "OPERATION_PATH_ILLEGAL_ARRAY_INDEX", i, t, e);
1181
- It(d) && (d = ~~d);
1255
+ $t(h) && (h = ~~h);
1182
1256
  }
1183
1257
  if (l >= y) {
1184
- if (r && t.op === "add" && d > u.length)
1258
+ if (r && t.op === "add" && h > f.length)
1185
1259
  throw new ce("The specified index MUST NOT be greater than the number of elements in the array", "OPERATION_VALUE_OUT_OF_BOUNDS", i, t, e);
1186
- var s = Ar[t.op].call(t, u, d, e);
1260
+ var s = jr[t.op].call(t, f, h, e);
1187
1261
  if (s.test === !1)
1188
1262
  throw new ce("Test operation failed", "TEST_OPERATION_FAILED", i, t, e);
1189
1263
  return s;
1190
1264
  }
1191
1265
  } else if (l >= y) {
1192
- var s = Ge[t.op].call(t, u, d, e);
1266
+ var s = Ke[t.op].call(t, f, h, e);
1193
1267
  if (s.test === !1)
1194
1268
  throw new ce("Test operation failed", "TEST_OPERATION_FAILED", i, t, e);
1195
1269
  return s;
1196
1270
  }
1197
- if (u = u[d], r && l < y && (!u || typeof u != "object"))
1271
+ if (f = f[h], r && l < y && (!f || typeof f != "object"))
1198
1272
  throw new ce("Cannot perform operation at the desired path", "OPERATION_PATH_UNRESOLVABLE", i, t, e);
1199
1273
  }
1200
1274
  }
1201
1275
  }
1202
- function _t(e, t, r, n, o) {
1276
+ function Vt(e, t, r, n, o) {
1203
1277
  if (n === void 0 && (n = !0), o === void 0 && (o = !0), r && !Array.isArray(t))
1204
1278
  throw new ce("Patch sequence must be an array", "SEQUENCE_NOT_AN_ARRAY");
1205
- n || (e = we(e));
1279
+ n || (e = Oe(e));
1206
1280
  for (var i = new Array(t.length), s = 0, c = t.length; s < c; s++)
1207
- i[s] = xe(e, t[s], r, !0, o, s), e = i[s].newDocument;
1281
+ i[s] = He(e, t[s], r, !0, o, s), e = i[s].newDocument;
1208
1282
  return i.newDocument = e, i;
1209
1283
  }
1210
- function Nr(e, t, r) {
1211
- var n = xe(e, t);
1284
+ function Dr(e, t, r) {
1285
+ var n = He(e, t);
1212
1286
  if (n.test === !1)
1213
1287
  throw new ce("Test operation failed", "TEST_OPERATION_FAILED", r, t, e);
1214
1288
  return n.newDocument;
1215
1289
  }
1216
- function pt(e, t, r, n) {
1290
+ function Ot(e, t, r, n) {
1217
1291
  if (typeof e != "object" || e === null || Array.isArray(e))
1218
1292
  throw new ce("Operation is not an object", "OPERATION_NOT_AN_OBJECT", t, e, r);
1219
- if (Ge[e.op]) {
1293
+ if (Ke[e.op]) {
1220
1294
  if (typeof e.path != "string")
1221
1295
  throw new ce("Operation `path` property is not a string", "OPERATION_PATH_INVALID", t, e, r);
1222
1296
  if (e.path.indexOf("/") !== 0 && e.path.length > 0)
@@ -1225,7 +1299,7 @@ function pt(e, t, r, n) {
1225
1299
  throw new ce("Operation `from` property is not present (applicable in `move` and `copy` operations)", "OPERATION_FROM_REQUIRED", t, e, r);
1226
1300
  if ((e.op === "add" || e.op === "replace" || e.op === "test") && e.value === void 0)
1227
1301
  throw new ce("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_REQUIRED", t, e, r);
1228
- if ((e.op === "add" || e.op === "replace" || e.op === "test") && Lt(e.value))
1302
+ if ((e.op === "add" || e.op === "replace" || e.op === "test") && Bt(e.value))
1229
1303
  throw new ce("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED", t, e, r);
1230
1304
  if (r) {
1231
1305
  if (e.op == "add") {
@@ -1236,21 +1310,21 @@ function pt(e, t, r, n) {
1236
1310
  if (e.path !== n)
1237
1311
  throw new ce("Cannot perform the operation at a path that does not exist", "OPERATION_PATH_UNRESOLVABLE", t, e, r);
1238
1312
  } else if (e.op === "move" || e.op === "copy") {
1239
- var s = { op: "_get", path: e.from, value: void 0 }, c = dn([s], r);
1313
+ var s = { op: "_get", path: e.from, value: void 0 }, c = Nn([s], r);
1240
1314
  if (c && c.name === "OPERATION_PATH_UNRESOLVABLE")
1241
1315
  throw new ce("Cannot perform the operation from a path that does not exist", "OPERATION_FROM_UNRESOLVABLE", t, e, r);
1242
1316
  }
1243
1317
  }
1244
1318
  } else throw new ce("Operation `op` property is not one of operations defined in RFC-6902", "OPERATION_OP_INVALID", t, e, r);
1245
1319
  }
1246
- function dn(e, t, r) {
1320
+ function Nn(e, t, r) {
1247
1321
  try {
1248
1322
  if (!Array.isArray(e))
1249
1323
  throw new ce("Patch sequence must be an array", "SEQUENCE_NOT_AN_ARRAY");
1250
1324
  if (t)
1251
- _t(we(t), we(e), r || !0);
1325
+ Vt(Oe(t), Oe(e), r || !0);
1252
1326
  else {
1253
- r = r || pt;
1327
+ r = r || Ot;
1254
1328
  for (var n = 0; n < e.length; n++)
1255
1329
  r(e[n], n, t, void 0);
1256
1330
  }
@@ -1260,7 +1334,7 @@ function dn(e, t, r) {
1260
1334
  throw o;
1261
1335
  }
1262
1336
  }
1263
- function et(e, t) {
1337
+ function lt(e, t) {
1264
1338
  if (e === t)
1265
1339
  return !0;
1266
1340
  if (e && t && typeof e == "object" && typeof t == "object") {
@@ -1269,7 +1343,7 @@ function et(e, t) {
1269
1343
  if (i = e.length, i != t.length)
1270
1344
  return !1;
1271
1345
  for (o = i; o-- !== 0; )
1272
- if (!et(e[o], t[o]))
1346
+ if (!lt(e[o], t[o]))
1273
1347
  return !1;
1274
1348
  return !0;
1275
1349
  }
@@ -1282,30 +1356,30 @@ function et(e, t) {
1282
1356
  if (!t.hasOwnProperty(c[o]))
1283
1357
  return !1;
1284
1358
  for (o = i; o-- !== 0; )
1285
- if (s = c[o], !et(e[s], t[s]))
1359
+ if (s = c[o], !lt(e[s], t[s]))
1286
1360
  return !1;
1287
1361
  return !0;
1288
1362
  }
1289
1363
  return e !== e && t !== t;
1290
1364
  }
1291
- const Er = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1365
+ const xr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1292
1366
  __proto__: null,
1293
1367
  JsonPatchError: ce,
1294
- _areEquals: et,
1295
- applyOperation: xe,
1296
- applyPatch: _t,
1297
- applyReducer: Nr,
1298
- deepClone: wr,
1299
- getValueByPointer: ft,
1300
- validate: dn,
1301
- validator: pt
1368
+ _areEquals: lt,
1369
+ applyOperation: He,
1370
+ applyPatch: Vt,
1371
+ applyReducer: Dr,
1372
+ deepClone: Rr,
1373
+ getValueByPointer: wt,
1374
+ validate: Nn,
1375
+ validator: Ot
1302
1376
  }, Symbol.toStringTag, { value: "Module" }));
1303
1377
  /*!
1304
1378
  * https://github.com/Starcounter-Jack/JSON-Patch
1305
1379
  * (c) 2017-2021 Joachim Wester
1306
1380
  * MIT license
1307
1381
  */
1308
- var Pt = /* @__PURE__ */ new WeakMap(), Tr = (
1382
+ var Jt = /* @__PURE__ */ new WeakMap(), Mr = (
1309
1383
  /** @class */
1310
1384
  /* @__PURE__ */ (function() {
1311
1385
  function e(t) {
@@ -1313,7 +1387,7 @@ var Pt = /* @__PURE__ */ new WeakMap(), Tr = (
1313
1387
  }
1314
1388
  return e;
1315
1389
  })()
1316
- ), Ir = (
1390
+ ), $r = (
1317
1391
  /** @class */
1318
1392
  /* @__PURE__ */ (function() {
1319
1393
  function e(t, r) {
@@ -1322,95 +1396,95 @@ var Pt = /* @__PURE__ */ new WeakMap(), Tr = (
1322
1396
  return e;
1323
1397
  })()
1324
1398
  );
1325
- function Lr(e) {
1326
- return Pt.get(e);
1399
+ function Br(e) {
1400
+ return Jt.get(e);
1327
1401
  }
1328
- function Sr(e, t) {
1402
+ function Fr(e, t) {
1329
1403
  return e.observers.get(t);
1330
1404
  }
1331
- function kr(e, t) {
1405
+ function Ur(e, t) {
1332
1406
  e.observers.delete(t.callback);
1333
1407
  }
1334
- function _r(e, t) {
1408
+ function Vr(e, t) {
1335
1409
  t.unobserve();
1336
1410
  }
1337
- function Pr(e, t) {
1338
- var r = [], n, o = Lr(e);
1411
+ function Jr(e, t) {
1412
+ var r = [], n, o = Br(e);
1339
1413
  if (!o)
1340
- o = new Tr(e), Pt.set(e, o);
1414
+ o = new Mr(e), Jt.set(e, o);
1341
1415
  else {
1342
- var i = Sr(o, t);
1416
+ var i = Fr(o, t);
1343
1417
  n = i && i.observer;
1344
1418
  }
1345
1419
  if (n)
1346
1420
  return n;
1347
- if (n = {}, o.value = we(e), t) {
1421
+ if (n = {}, o.value = Oe(e), t) {
1348
1422
  n.callback = t, n.next = null;
1349
1423
  var s = function() {
1350
- St(n);
1424
+ Ft(n);
1351
1425
  }, c = function() {
1352
1426
  clearTimeout(n.next), n.next = setTimeout(s);
1353
1427
  };
1354
1428
  typeof window < "u" && (window.addEventListener("mouseup", c), window.addEventListener("keyup", c), window.addEventListener("mousedown", c), window.addEventListener("keydown", c), window.addEventListener("change", c));
1355
1429
  }
1356
1430
  return n.patches = r, n.object = e, n.unobserve = function() {
1357
- St(n), clearTimeout(n.next), kr(o, n), typeof window < "u" && (window.removeEventListener("mouseup", c), window.removeEventListener("keyup", c), window.removeEventListener("mousedown", c), window.removeEventListener("keydown", c), window.removeEventListener("change", c));
1358
- }, o.observers.set(t, new Ir(t, n)), n;
1431
+ Ft(n), clearTimeout(n.next), Ur(o, n), typeof window < "u" && (window.removeEventListener("mouseup", c), window.removeEventListener("keyup", c), window.removeEventListener("mousedown", c), window.removeEventListener("keydown", c), window.removeEventListener("change", c));
1432
+ }, o.observers.set(t, new $r(t, n)), n;
1359
1433
  }
1360
- function St(e, t) {
1434
+ function Ft(e, t) {
1361
1435
  t === void 0 && (t = !1);
1362
- var r = Pt.get(e.object);
1363
- Rt(r.value, e.object, e.patches, "", t), e.patches.length && _t(r.value, e.patches);
1436
+ var r = Jt.get(e.object);
1437
+ Ht(r.value, e.object, e.patches, "", t), e.patches.length && Vt(r.value, e.patches);
1364
1438
  var n = e.patches;
1365
1439
  return n.length > 0 && (e.patches = [], e.callback && e.callback(n)), n;
1366
1440
  }
1367
- function Rt(e, t, r, n, o) {
1441
+ function Ht(e, t, r, n, o) {
1368
1442
  if (t !== e) {
1369
1443
  typeof t.toJSON == "function" && (t = t.toJSON());
1370
- for (var i = Tt(t), s = Tt(e), c = !1, a = s.length - 1; a >= 0; a--) {
1371
- var u = s[a], l = e[u];
1372
- if (Et(t, u) && !(t[u] === void 0 && l !== void 0 && Array.isArray(t) === !1)) {
1373
- var y = t[u];
1374
- typeof l == "object" && l != null && typeof y == "object" && y != null && Array.isArray(l) === Array.isArray(y) ? Rt(l, y, r, n + "/" + Me(u), o) : l !== y && (o && r.push({ op: "test", path: n + "/" + Me(u), value: we(l) }), r.push({ op: "replace", path: n + "/" + Me(u), value: we(y) }));
1375
- } else Array.isArray(e) === Array.isArray(t) ? (o && r.push({ op: "test", path: n + "/" + Me(u), value: we(l) }), r.push({ op: "remove", path: n + "/" + Me(u) }), c = !0) : (o && r.push({ op: "test", path: n, value: e }), r.push({ op: "replace", path: n, value: t }));
1444
+ for (var i = Mt(t), s = Mt(e), c = !1, a = s.length - 1; a >= 0; a--) {
1445
+ var f = s[a], l = e[f];
1446
+ if (xt(t, f) && !(t[f] === void 0 && l !== void 0 && Array.isArray(t) === !1)) {
1447
+ var y = t[f];
1448
+ typeof l == "object" && l != null && typeof y == "object" && y != null && Array.isArray(l) === Array.isArray(y) ? Ht(l, y, r, n + "/" + Je(f), o) : l !== y && (o && r.push({ op: "test", path: n + "/" + Je(f), value: Oe(l) }), r.push({ op: "replace", path: n + "/" + Je(f), value: Oe(y) }));
1449
+ } else Array.isArray(e) === Array.isArray(t) ? (o && r.push({ op: "test", path: n + "/" + Je(f), value: Oe(l) }), r.push({ op: "remove", path: n + "/" + Je(f) }), c = !0) : (o && r.push({ op: "test", path: n, value: e }), r.push({ op: "replace", path: n, value: t }));
1376
1450
  }
1377
1451
  if (!(!c && i.length == s.length))
1378
1452
  for (var a = 0; a < i.length; a++) {
1379
- var u = i[a];
1380
- !Et(e, u) && t[u] !== void 0 && r.push({ op: "add", path: n + "/" + Me(u), value: we(t[u]) });
1453
+ var f = i[a];
1454
+ !xt(e, f) && t[f] !== void 0 && r.push({ op: "add", path: n + "/" + Je(f), value: Oe(t[f]) });
1381
1455
  }
1382
1456
  }
1383
1457
  }
1384
- function We(e, t, r) {
1458
+ function Qe(e, t, r) {
1385
1459
  r === void 0 && (r = !1);
1386
1460
  var n = [];
1387
- return Rt(e, t, n, "", r), n;
1461
+ return Ht(e, t, n, "", r), n;
1388
1462
  }
1389
- const Rr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1463
+ const Hr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1390
1464
  __proto__: null,
1391
- compare: We,
1392
- generate: St,
1393
- observe: Pr,
1394
- unobserve: _r
1465
+ compare: Qe,
1466
+ generate: Ft,
1467
+ observe: Jr,
1468
+ unobserve: Vr
1395
1469
  }, Symbol.toStringTag, { value: "Module" }));
1396
- Object.assign({}, Er, Rr, {
1397
- JsonPatchError: pn,
1398
- deepClone: we,
1399
- escapePathComponent: Me,
1400
- unescapePathComponent: fn
1470
+ Object.assign({}, xr, Hr, {
1471
+ JsonPatchError: An,
1472
+ deepClone: Oe,
1473
+ escapePathComponent: Je,
1474
+ unescapePathComponent: On
1401
1475
  });
1402
- const ht = "oneOf", jt = "anyOf", Dt = "allOf";
1403
- function Mt(e) {
1404
- return !!(e[ht] || e[jt] || e[Dt]);
1476
+ const Nt = "oneOf", Gt = "anyOf", Wt = "allOf";
1477
+ function qt(e) {
1478
+ return !!(e[Nt] || e[Gt] || e[Wt]);
1405
1479
  }
1406
- function hn(e) {
1407
- const t = e[ht] || e[jt] || e[Dt];
1480
+ function En(e) {
1481
+ const t = e[Nt] || e[Gt] || e[Wt];
1408
1482
  return Array.isArray(t) ? t : void 0;
1409
1483
  }
1410
- function ct(e) {
1411
- return e.oneOf ? ht : e.anyOf ? jt : e.allOf ? Dt : "";
1484
+ function mt(e) {
1485
+ return e.oneOf ? Nt : e.anyOf ? Gt : e.allOf ? Wt : "";
1412
1486
  }
1413
- function jr(e, t) {
1487
+ function Gr(e, t) {
1414
1488
  if (typeof t != "object" || t === null || Array.isArray(t))
1415
1489
  return null;
1416
1490
  const r = t, n = /* @__PURE__ */ new Set();
@@ -1425,7 +1499,7 @@ function jr(e, t) {
1425
1499
  return { field: o, value: r[o] };
1426
1500
  return null;
1427
1501
  }
1428
- function at(e, t, r = ht) {
1502
+ function yt(e, t, r = Nt) {
1429
1503
  var n;
1430
1504
  if (t.length === 0)
1431
1505
  throw new Error("No variants provided to chooseSubschemaSync");
@@ -1436,7 +1510,7 @@ function at(e, t, r = ht) {
1436
1510
  return { selectedIndex: o, schema: i };
1437
1511
  }
1438
1512
  if (typeof e == "object" && e !== null && !Array.isArray(e)) {
1439
- const o = e, i = jr(t, e);
1513
+ const o = e, i = Gr(t, e);
1440
1514
  if (i)
1441
1515
  for (let s = 0; s < t.length; s++) {
1442
1516
  const c = t[s], a = (n = c.properties) == null ? void 0 : n[i.field];
@@ -1449,10 +1523,10 @@ function at(e, t, r = ht) {
1449
1523
  const a = c.required || [];
1450
1524
  if (a.every((l) => l in o) && a.length > 0) {
1451
1525
  let l = !0;
1452
- for (const [y, p] of Object.entries(c.properties))
1453
- if (p && typeof p == "object" && "const" in p) {
1454
- const d = p.const;
1455
- if (o[y] !== d) {
1526
+ for (const [y, d] of Object.entries(c.properties))
1527
+ if (d && typeof d == "object" && "const" in d) {
1528
+ const h = d.const;
1529
+ if (o[y] !== h) {
1456
1530
  l = !1;
1457
1531
  break;
1458
1532
  }
@@ -1478,32 +1552,39 @@ function at(e, t, r = ht) {
1478
1552
  }
1479
1553
  return { selectedIndex: 0, schema: t[0] };
1480
1554
  }
1481
- function kt(e, t, r) {
1482
- const n = !de(e, t), o = !de(e, r);
1483
- return n && o ? de(t, r) ? D.SAME_CHANGE : D.TRUE_CONFLICT : n ? D.INPUT1_ONLY : o ? D.INPUT2_ONLY : D.SAME_CHANGE;
1555
+ function Wr(e) {
1556
+ if (typeof e == "object" && e !== null) {
1557
+ const t = Sr(e, { deep: !0 });
1558
+ return JSON.stringify(t, null, 2);
1559
+ }
1560
+ return JSON.stringify(e, null, 2);
1561
+ }
1562
+ function Ut(e, t, r) {
1563
+ const n = !he(e, t), o = !he(e, r);
1564
+ return n && o ? he(t, r) ? $.SAME_CHANGE : $.TRUE_CONFLICT : n ? $.INPUT1_ONLY : o ? $.INPUT2_ONLY : $.SAME_CHANGE;
1484
1565
  }
1485
- function Pe(e, t) {
1566
+ function xe(e, t) {
1486
1567
  try {
1487
- const r = ln(e);
1568
+ const r = bn(e);
1488
1569
  if (!r)
1489
1570
  return { start: 1, end: 1 };
1490
1571
  const n = t.split("/").filter(Boolean).map((s) => {
1491
1572
  const c = Number.parseInt(s, 10);
1492
1573
  return !Number.isNaN(c) && String(c) === s ? c : s;
1493
- }), o = n.length === 0 ? r : un(r, n);
1574
+ }), o = n.length === 0 ? r : wn(r, n);
1494
1575
  return o ? {
1495
- start: rn(e, o.offset),
1496
- end: rn(e, o.offset + o.length)
1576
+ start: hn(e, o.offset),
1577
+ end: hn(e, o.offset + o.length)
1497
1578
  } : { start: 1, end: 1 };
1498
1579
  } catch {
1499
1580
  return { start: 1, end: 1 };
1500
1581
  }
1501
1582
  }
1502
- function rn(e, t) {
1583
+ function hn(e, t) {
1503
1584
  return e.substring(0, t).split(`
1504
1585
  `).length;
1505
1586
  }
1506
- function Dr(e, t) {
1587
+ function qr(e, t) {
1507
1588
  const r = /* @__PURE__ */ new Map(), n = (o) => {
1508
1589
  const i = o.split("/").filter(Boolean);
1509
1590
  return i.length > 0 ? `/${i[0]}` : "/";
@@ -1522,150 +1603,150 @@ function Dr(e, t) {
1522
1603
  }
1523
1604
  return r;
1524
1605
  }
1525
- function Mr(e, t, r, n, o, i) {
1526
- const s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), u = [], l = [];
1527
- for (const v of e) {
1528
- const h = v.path.match(/^(\/[^/]+(?:\/[^/]+)*)\/(\d+)(?:\/|$)/);
1529
- if (h) {
1530
- const m = h[1];
1531
- c.has(m) || c.set(m, []);
1532
- const f = c.get(m);
1533
- f && f.push(v);
1606
+ function Yr(e, t, r, n, o, i) {
1607
+ const s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), f = [], l = [];
1608
+ for (const m of e) {
1609
+ const g = m.path.match(/^(\/[^/]+(?:\/[^/]+)*)\/(\d+)(?:\/|$)/);
1610
+ if (g) {
1611
+ const O = g[1];
1612
+ c.has(O) || c.set(O, []);
1613
+ const u = c.get(O);
1614
+ u && u.push(m);
1534
1615
  } else
1535
- u.push(v);
1536
- }
1537
- for (const v of t) {
1538
- const h = v.path.match(/^(\/[^/]+(?:\/[^/]+)*)\/(\d+)(?:\/|$)/);
1539
- if (h) {
1540
- const m = h[1];
1541
- a.has(m) || a.set(m, []);
1542
- const f = a.get(m);
1543
- f && f.push(v);
1616
+ f.push(m);
1617
+ }
1618
+ for (const m of t) {
1619
+ const g = m.path.match(/^(\/[^/]+(?:\/[^/]+)*)\/(\d+)(?:\/|$)/);
1620
+ if (g) {
1621
+ const O = g[1];
1622
+ a.has(O) || a.set(O, []);
1623
+ const u = a.get(O);
1624
+ u && u.push(m);
1544
1625
  } else
1545
- l.push(v);
1626
+ l.push(m);
1546
1627
  }
1547
1628
  const y = /* @__PURE__ */ new Set([...c.keys(), ...a.keys()]);
1548
- for (const v of y) {
1549
- const h = W(r, v), m = W(n, v), f = W(o, v);
1550
- if (!Array.isArray(h) || !Array.isArray(m) || !Array.isArray(f)) {
1551
- const T = c.get(v) || [], F = a.get(v) || [];
1552
- for (const M of T) {
1553
- const x = M.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);
1554
- if (x) {
1555
- const V = x[1];
1556
- s.has(V) || s.set(V, { patches1: [], patches2: [] });
1557
- const A = s.get(V);
1558
- A && A.patches1.push(M);
1629
+ for (const m of y) {
1630
+ const g = J(r, m), O = J(n, m), u = J(o, m);
1631
+ if (!Array.isArray(g) || !Array.isArray(O) || !Array.isArray(u)) {
1632
+ const P = c.get(m) || [], x = a.get(m) || [];
1633
+ for (const M of P) {
1634
+ const B = M.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);
1635
+ if (B) {
1636
+ const F = B[1];
1637
+ s.has(F) || s.set(F, { patches1: [], patches2: [] });
1638
+ const L = s.get(F);
1639
+ L && L.patches1.push(M);
1559
1640
  }
1560
1641
  }
1561
- for (const M of F) {
1562
- const x = M.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);
1563
- if (x) {
1564
- const V = x[1];
1565
- s.has(V) || s.set(V, { patches1: [], patches2: [] });
1566
- const A = s.get(V);
1567
- A && A.patches2.push(M);
1642
+ for (const M of x) {
1643
+ const B = M.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);
1644
+ if (B) {
1645
+ const F = B[1];
1646
+ s.has(F) || s.set(F, { patches1: [], patches2: [] });
1647
+ const L = s.get(F);
1648
+ L && L.patches2.push(M);
1568
1649
  }
1569
1650
  }
1570
1651
  continue;
1571
1652
  }
1572
- const E = qe(i, v, r), S = E != null && E.items ? Array.isArray(E.items) && E.items[0] ? E.items[0] : Array.isArray(E.items) ? null : E.items : null, g = S && typeof S == "object" ? S : null;
1573
- if (g) {
1574
- const T = Br(h, m, f, g);
1575
- if (T.size > 0) {
1576
- const F = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map();
1577
- for (const [w, R] of T.entries())
1578
- R.base !== void 0 && F.set(R.base, w), R.input1 !== void 0 && M.set(R.input1, w), R.input2 !== void 0 && x.set(R.input2, w);
1579
- const V = c.get(v) || [], A = a.get(v) || [];
1580
- for (const w of V) {
1581
- const R = w.path.match(/^\/[^/]+(?:\/[^/]+)*\/(\d+)(?:\/|$)/);
1582
- if (R) {
1583
- const X = Number.parseInt(R[1], 10), ne = M.get(X);
1584
- if (ne !== void 0) {
1585
- const ae = `${v}#${ne}`;
1653
+ const A = Ze(i, m, r), S = A != null && A.items ? Array.isArray(A.items) && A.items[0] ? A.items[0] : Array.isArray(A.items) ? null : A.items : null, p = S && typeof S == "object" ? S : null;
1654
+ if (p) {
1655
+ const P = Xr(g, O, u, p);
1656
+ if (P.size > 0) {
1657
+ const x = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map(), B = /* @__PURE__ */ new Map();
1658
+ for (const [I, D] of P.entries())
1659
+ D.base !== void 0 && x.set(D.base, I), D.input1 !== void 0 && M.set(D.input1, I), D.input2 !== void 0 && B.set(D.input2, I);
1660
+ const F = c.get(m) || [], L = a.get(m) || [];
1661
+ for (const I of F) {
1662
+ const D = I.path.match(/^\/[^/]+(?:\/[^/]+)*\/(\d+)(?:\/|$)/);
1663
+ if (D) {
1664
+ const K = Number.parseInt(D[1], 10), ie = M.get(K);
1665
+ if (ie !== void 0) {
1666
+ const ae = `${m}#${ie}`;
1586
1667
  s.has(ae) || s.set(ae, { patches1: [], patches2: [] });
1587
- const me = s.get(ae);
1588
- me && me.patches1.push(w);
1668
+ const ge = s.get(ae);
1669
+ ge && ge.patches1.push(I);
1589
1670
  }
1590
1671
  }
1591
1672
  }
1592
- for (const w of A) {
1593
- const R = w.path.match(/^\/[^/]+(?:\/[^/]+)*\/(\d+)(?:\/|$)/);
1594
- if (R) {
1595
- const X = Number.parseInt(R[1], 10), ne = x.get(X);
1596
- if (ne !== void 0) {
1597
- const ae = `${v}#${ne}`;
1673
+ for (const I of L) {
1674
+ const D = I.path.match(/^\/[^/]+(?:\/[^/]+)*\/(\d+)(?:\/|$)/);
1675
+ if (D) {
1676
+ const K = Number.parseInt(D[1], 10), ie = B.get(K);
1677
+ if (ie !== void 0) {
1678
+ const ae = `${m}#${ie}`;
1598
1679
  s.has(ae) || s.set(ae, { patches1: [], patches2: [] });
1599
- const me = s.get(ae);
1600
- me && me.patches2.push(w);
1680
+ const ge = s.get(ae);
1681
+ ge && ge.patches2.push(I);
1601
1682
  }
1602
1683
  }
1603
1684
  }
1604
1685
  continue;
1605
1686
  }
1606
1687
  }
1607
- const b = c.get(v) || [], j = a.get(v) || [];
1608
- for (const T of b) {
1609
- const F = T.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);
1610
- if (F) {
1611
- const M = F[1];
1688
+ const v = c.get(m) || [], R = a.get(m) || [];
1689
+ for (const P of v) {
1690
+ const x = P.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);
1691
+ if (x) {
1692
+ const M = x[1];
1612
1693
  s.has(M) || s.set(M, { patches1: [], patches2: [] });
1613
- const x = s.get(M);
1614
- x && x.patches1.push(T);
1694
+ const B = s.get(M);
1695
+ B && B.patches1.push(P);
1615
1696
  }
1616
1697
  }
1617
- for (const T of j) {
1618
- const F = T.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);
1619
- if (F) {
1620
- const M = F[1];
1698
+ for (const P of R) {
1699
+ const x = P.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);
1700
+ if (x) {
1701
+ const M = x[1];
1621
1702
  s.has(M) || s.set(M, { patches1: [], patches2: [] });
1622
- const x = s.get(M);
1623
- x && x.patches2.push(T);
1624
- }
1625
- }
1626
- }
1627
- const p = (v, h) => {
1628
- if (!h) return null;
1629
- const m = v.split("/").filter(Boolean);
1630
- if (m.length < 2) return null;
1631
- const f = `/${m[0]}`, E = qe(h, f);
1632
- return E && Mt(E) ? f : null;
1633
- }, d = [...u], L = [...l], N = /* @__PURE__ */ new Set();
1634
- for (const v of d) {
1635
- const h = p(v.path, i);
1636
- h && N.add(h);
1637
- }
1638
- for (const v of L) {
1639
- const h = p(v.path, i);
1640
- h && N.add(h);
1641
- }
1642
- for (const v of N)
1643
- s.has(v) || s.set(v, { patches1: [], patches2: [] });
1644
- for (const v of d) {
1645
- const h = v.path, m = p(h, i);
1646
- if (m) {
1647
- const f = s.get(m);
1648
- f && f.patches1.push(v);
1703
+ const B = s.get(M);
1704
+ B && B.patches2.push(P);
1705
+ }
1706
+ }
1707
+ }
1708
+ const d = (m, g) => {
1709
+ if (!g) return null;
1710
+ const O = m.split("/").filter(Boolean);
1711
+ if (O.length < 2) return null;
1712
+ const u = `/${O[0]}`, A = Ze(g, u);
1713
+ return A && qt(A) ? u : null;
1714
+ }, h = [...f], T = [...l], N = /* @__PURE__ */ new Set();
1715
+ for (const m of h) {
1716
+ const g = d(m.path, i);
1717
+ g && N.add(g);
1718
+ }
1719
+ for (const m of T) {
1720
+ const g = d(m.path, i);
1721
+ g && N.add(g);
1722
+ }
1723
+ for (const m of N)
1724
+ s.has(m) || s.set(m, { patches1: [], patches2: [] });
1725
+ for (const m of h) {
1726
+ const g = m.path, O = d(g, i);
1727
+ if (O) {
1728
+ const u = s.get(O);
1729
+ u && u.patches1.push(m);
1649
1730
  } else {
1650
- s.has(h) || s.set(h, { patches1: [], patches2: [] });
1651
- const f = s.get(h);
1652
- f && f.patches1.push(v);
1731
+ s.has(g) || s.set(g, { patches1: [], patches2: [] });
1732
+ const u = s.get(g);
1733
+ u && u.patches1.push(m);
1653
1734
  }
1654
1735
  }
1655
- for (const v of L) {
1656
- const h = v.path, m = p(h, i);
1657
- if (m) {
1658
- const f = s.get(m);
1659
- f && f.patches2.push(v);
1736
+ for (const m of T) {
1737
+ const g = m.path, O = d(g, i);
1738
+ if (O) {
1739
+ const u = s.get(O);
1740
+ u && u.patches2.push(m);
1660
1741
  } else {
1661
- s.has(h) || s.set(h, { patches1: [], patches2: [] });
1662
- const f = s.get(h);
1663
- f && f.patches2.push(v);
1742
+ s.has(g) || s.set(g, { patches1: [], patches2: [] });
1743
+ const u = s.get(g);
1744
+ u && u.patches2.push(m);
1664
1745
  }
1665
1746
  }
1666
1747
  return s;
1667
1748
  }
1668
- function qe(e, t, r) {
1749
+ function Ze(e, t, r) {
1669
1750
  if (!e)
1670
1751
  return null;
1671
1752
  const n = t.split("/").filter(Boolean);
@@ -1673,14 +1754,14 @@ function qe(e, t, r) {
1673
1754
  return e;
1674
1755
  let o = e, i = "";
1675
1756
  for (let s = 0; s < n.length; s++) {
1676
- const c = n[s], a = Number.parseInt(c, 10), u = !Number.isNaN(a) && String(a) === c;
1677
- if (o && Mt(o)) {
1678
- const l = hn(o), y = ct(o), p = r ? W(r, i || "/") : void 0;
1757
+ const c = n[s], a = Number.parseInt(c, 10), f = !Number.isNaN(a) && String(a) === c;
1758
+ if (o && qt(o)) {
1759
+ const l = En(o), y = mt(o), d = r ? J(r, i || "/") : void 0;
1679
1760
  if (l && l.length > 0)
1680
- if (p !== void 0)
1761
+ if (d !== void 0)
1681
1762
  try {
1682
- const { schema: d } = at(p, l, y);
1683
- o = d;
1763
+ const { schema: h } = yt(d, l, y);
1764
+ o = h;
1684
1765
  } catch {
1685
1766
  l.length > 0 && l[0] && (o = l[0]);
1686
1767
  }
@@ -1689,7 +1770,7 @@ function qe(e, t, r) {
1689
1770
  }
1690
1771
  if (!o)
1691
1772
  return null;
1692
- if (u)
1773
+ if (f)
1693
1774
  if (o.items)
1694
1775
  if (Array.isArray(o.items)) {
1695
1776
  const l = a < o.items.length ? o.items[a] : null;
@@ -1707,7 +1788,7 @@ function qe(e, t, r) {
1707
1788
  }
1708
1789
  return o;
1709
1790
  }
1710
- function gn(e) {
1791
+ function Tn(e) {
1711
1792
  if (!e || typeof e != "object")
1712
1793
  return [];
1713
1794
  const t = [];
@@ -1727,115 +1808,115 @@ function gn(e) {
1727
1808
  }
1728
1809
  return t;
1729
1810
  }
1730
- function xr(e) {
1731
- const t = gn(e);
1811
+ function zr(e) {
1812
+ const t = Tn(e);
1732
1813
  return t.length > 0 ? t[0] : null;
1733
1814
  }
1734
- function $r(e, t, r) {
1735
- const n = /* @__PURE__ */ new Map(), o = gn(r);
1815
+ function Cr(e, t, r) {
1816
+ const n = /* @__PURE__ */ new Map(), o = Tn(r);
1736
1817
  if (o.length === 0)
1737
1818
  return n;
1738
1819
  const i = (c) => {
1739
1820
  if (typeof c != "object" || c === null)
1740
1821
  return null;
1741
- const a = c, u = [];
1822
+ const a = c, f = [];
1742
1823
  for (const l of o) {
1743
1824
  const y = a[l];
1744
- y != null && u.push(`${l}:${JSON.stringify(y)}`);
1825
+ y != null && f.push(`${l}:${JSON.stringify(y)}`);
1745
1826
  }
1746
- return u.length > 0 ? u.join("|") : null;
1827
+ return f.length > 0 ? f.join("|") : null;
1747
1828
  }, s = (c, a) => {
1748
- c.forEach((u, l) => {
1749
- const y = i(u);
1829
+ c.forEach((f, l) => {
1830
+ const y = i(f);
1750
1831
  if (y) {
1751
1832
  n.has(y) || n.set(y, {});
1752
- const p = n.get(y);
1753
- p && (p[a] = l);
1833
+ const d = n.get(y);
1834
+ d && (d[a] = l);
1754
1835
  }
1755
1836
  });
1756
1837
  };
1757
1838
  return s(e, "input1"), s(t, "input2"), n;
1758
1839
  }
1759
- function Br(e, t, r, n) {
1760
- const o = /* @__PURE__ */ new Map(), i = xr(n);
1840
+ function Xr(e, t, r, n) {
1841
+ const o = /* @__PURE__ */ new Map(), i = zr(n);
1761
1842
  if (!i)
1762
1843
  return o;
1763
1844
  const s = (c, a) => {
1764
- c.forEach((u, l) => {
1765
- if (typeof u == "object" && u !== null) {
1766
- const y = u[i];
1845
+ c.forEach((f, l) => {
1846
+ if (typeof f == "object" && f !== null) {
1847
+ const y = f[i];
1767
1848
  if (y != null) {
1768
- const p = String(y);
1769
- o.has(p) || o.set(p, {});
1770
- const d = o.get(p);
1771
- d && (d[a] = l);
1849
+ const d = String(y);
1850
+ o.has(d) || o.set(d, {});
1851
+ const h = o.get(d);
1852
+ h && (h[a] = l);
1772
1853
  }
1773
1854
  }
1774
1855
  });
1775
1856
  };
1776
1857
  return s(e, "base"), s(t, "input1"), s(r, "input2"), o;
1777
1858
  }
1778
- function Fr(e, t, r, n) {
1779
- const o = typeof e == "object" && e !== null || Array.isArray(e) ? e : {}, i = typeof t == "object" && t !== null || Array.isArray(t) ? t : {}, s = typeof r == "object" && r !== null || Array.isArray(r) ? r : {}, c = We(o, i), a = We(o, s);
1780
- let u = Dr(c, a);
1781
- n && (u = Mr(c, a, e, t, r, n));
1782
- const l = [], y = /* @__PURE__ */ new Set(), p = (d, L, N, v) => {
1783
- if (!n || typeof L != "object" || L === null || Array.isArray(L) || typeof N != "object" || N === null || Array.isArray(N) || typeof v != "object" || v === null || Array.isArray(v)) return !1;
1784
- const h = qe(n, d, L);
1785
- if (!h || !Mt(h)) return !1;
1786
- const m = hn(h);
1787
- if (!m || m.length < 2) return !1;
1788
- const f = at(L, m, ct(h)), E = at(N, m, ct(h)), S = at(v, m, ct(h));
1789
- return E.selectedIndex !== S.selectedIndex && (f.selectedIndex !== E.selectedIndex || f.selectedIndex !== S.selectedIndex);
1859
+ function Kr(e, t, r, n) {
1860
+ const o = typeof e == "object" && e !== null || Array.isArray(e) ? e : {}, i = typeof t == "object" && t !== null || Array.isArray(t) ? t : {}, s = typeof r == "object" && r !== null || Array.isArray(r) ? r : {}, c = Qe(o, i), a = Qe(o, s);
1861
+ let f = qr(c, a);
1862
+ n && (f = Yr(c, a, e, t, r, n));
1863
+ const l = [], y = /* @__PURE__ */ new Set(), d = (h, T, N, m) => {
1864
+ if (!n || typeof T != "object" || T === null || Array.isArray(T) || typeof N != "object" || N === null || Array.isArray(N) || typeof m != "object" || m === null || Array.isArray(m)) return !1;
1865
+ const g = Ze(n, h, T);
1866
+ if (!g || !qt(g)) return !1;
1867
+ const O = En(g);
1868
+ if (!O || O.length < 2) return !1;
1869
+ const u = yt(T, O, mt(g)), A = yt(N, O, mt(g)), S = yt(m, O, mt(g));
1870
+ return A.selectedIndex !== S.selectedIndex && (u.selectedIndex !== A.selectedIndex || u.selectedIndex !== S.selectedIndex);
1790
1871
  };
1791
- for (const [d, { patches1: L, patches2: N }] of u) {
1792
- y.add(d);
1793
- let v = d;
1794
- L.length > 0 ? v = L[0].path : N.length > 0 ? v = N[0].path : d.includes("#") && (v = d.split("#")[0]);
1795
- let h = d;
1796
- if (d.includes("#"))
1797
- h = d.split("#")[0];
1872
+ for (const [h, { patches1: T, patches2: N }] of f) {
1873
+ y.add(h);
1874
+ let m = h;
1875
+ T.length > 0 ? m = T[0].path : N.length > 0 ? m = N[0].path : h.includes("#") && (m = h.split("#")[0]);
1876
+ let g = h;
1877
+ if (h.includes("#"))
1878
+ g = h.split("#")[0];
1798
1879
  else {
1799
- const M = d.split("/").filter(Boolean);
1800
- M.length > 1 && (h = `/${M[0]}`);
1801
- }
1802
- if ([...L, ...N].every((M) => (M.path.split("/").slice(0, 2).join("/") || `/${M.path.split("/")[1]}`) === h) && h !== v) {
1803
- const M = W(e, h), x = W(t, h), V = W(r, h);
1804
- if (p(h, M, x, V)) {
1805
- const w = M, R = x, X = V;
1806
- let ne = kt(w, R, X);
1807
- !de(w, R) && !de(w, X) && !de(R, X) && (ne = D.TRUE_CONFLICT);
1808
- const ae = [...L, ...N].filter(
1809
- (Te) => Te.path.startsWith(`${h}/`) || Te.path === h
1810
- ), me = [], je = [];
1811
- for (const Te of ae) {
1812
- const C = Te.path, re = e !== void 0 ? W(e, C) : void 0, K = W(t, C), $ = W(r, C);
1813
- let fe = !1, Ie = !1;
1814
- Te.op === "replace" ? re !== void 0 && (fe = !de(re, K), Ie = !de(re, $)) : Te.op === "add" ? (fe = re === void 0 && K !== void 0, Ie = re === void 0 && $ !== void 0) : Te.op === "remove" && (fe = re !== void 0 && K === void 0, Ie = re !== void 0 && $ === void 0), re !== void 0 && (K !== void 0 && de(re, K) && (fe = !1), $ !== void 0 && de(re, $) && (Ie = !1)), fe && me.push(Te), Ie && je.push(Te);
1880
+ const M = h.split("/").filter(Boolean);
1881
+ M.length > 1 && (g = `/${M[0]}`);
1882
+ }
1883
+ if ([...T, ...N].every((M) => (M.path.split("/").slice(0, 2).join("/") || `/${M.path.split("/")[1]}`) === g) && g !== m) {
1884
+ const M = J(e, g), B = J(t, g), F = J(r, g);
1885
+ if (d(g, M, B, F)) {
1886
+ const I = M, D = B, K = F;
1887
+ let ie = Ut(I, D, K);
1888
+ !he(I, D) && !he(I, K) && !he(D, K) && (ie = $.TRUE_CONFLICT);
1889
+ const ae = [...T, ...N].filter(
1890
+ (Ae) => Ae.path.startsWith(`${g}/`) || Ae.path === g
1891
+ ), ge = [], Pe = [];
1892
+ for (const Ae of ae) {
1893
+ const $e = Ae.path, Ee = e !== void 0 ? J(e, $e) : void 0, Be = J(t, $e), Z = J(r, $e);
1894
+ let pe = !1, ee = !1;
1895
+ Ae.op === "replace" ? Ee !== void 0 && (pe = !he(Ee, Be), ee = !he(Ee, Z)) : Ae.op === "add" ? (pe = Ee === void 0 && Be !== void 0, ee = Ee === void 0 && Z !== void 0) : Ae.op === "remove" && (pe = Ee !== void 0 && Be === void 0, ee = Ee !== void 0 && Z === void 0), Ee !== void 0 && (Be !== void 0 && he(Ee, Be) && (pe = !1), Z !== void 0 && he(Ee, Z) && (ee = !1)), pe && ge.push(Ae), ee && Pe.push(Ae);
1815
1896
  }
1816
1897
  l.push({
1817
- path: h,
1818
- baseValue: w,
1819
- input1Value: R,
1820
- input2Value: X,
1821
- conflictType: ne,
1822
- patches1: me,
1823
- patches2: je
1898
+ path: g,
1899
+ baseValue: I,
1900
+ input1Value: D,
1901
+ input2Value: K,
1902
+ conflictType: ie,
1903
+ patches1: ge,
1904
+ patches2: Pe
1824
1905
  });
1825
1906
  continue;
1826
1907
  }
1827
1908
  }
1828
- const f = W(e, v), E = W(t, v), S = W(r, v);
1829
- let g = kt(f, E, S);
1830
- const b = f != null, j = E != null, T = S != null;
1831
- !b && j && T && g !== D.SAME_CHANGE && (g = D.TRUE_CONFLICT), b && de(f, E) && de(f, S) || l.push({
1832
- path: v,
1909
+ const u = J(e, m), A = J(t, m), S = J(r, m);
1910
+ let p = Ut(u, A, S);
1911
+ const v = u != null, R = A != null, P = S != null;
1912
+ !v && R && P && p !== $.SAME_CHANGE && (p = $.TRUE_CONFLICT), v && he(u, A) && he(u, S) || l.push({
1913
+ path: m,
1833
1914
  // Use representative path for conflict (actual patch paths are in patches1/patches2)
1834
- baseValue: f,
1835
- input1Value: E,
1915
+ baseValue: u,
1916
+ input1Value: A,
1836
1917
  input2Value: S,
1837
- conflictType: g,
1838
- patches1: L,
1918
+ conflictType: p,
1919
+ patches1: T,
1839
1920
  // JSON Patch operations for base?input1 (contain actual paths with indices)
1840
1921
  patches2: N
1841
1922
  // JSON Patch operations for base?input2 (contain actual paths with indices)
@@ -1843,105 +1924,105 @@ function Fr(e, t, r, n) {
1843
1924
  }
1844
1925
  return l;
1845
1926
  }
1846
- function Ur(e, t, r) {
1847
- var y, p, d, L;
1848
- const n = typeof e == "object" && e !== null || Array.isArray(e) ? e : {}, o = typeof t == "object" && t !== null || Array.isArray(t) ? t : {}, i = We(n, o);
1927
+ function Qr(e, t, r) {
1928
+ var y, d, h, T;
1929
+ const n = typeof e == "object" && e !== null || Array.isArray(e) ? e : {}, o = typeof t == "object" && t !== null || Array.isArray(t) ? t : {}, i = Qe(n, o);
1849
1930
  if (i.length === 0)
1850
1931
  return [];
1851
- const s = [], c = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map(), u = [];
1932
+ const s = [], c = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map(), f = [];
1852
1933
  for (const N of i) {
1853
- const v = N.path.match(/^(\/[^/]+(?:\/[^/]+)*)\/(\d+)(?:\/|$)/);
1854
- if (v) {
1855
- const h = v[1];
1856
- a.has(h) || a.set(h, []);
1857
- const m = a.get(h);
1858
- m && m.push(N);
1934
+ const m = N.path.match(/^(\/[^/]+(?:\/[^/]+)*)\/(\d+)(?:\/|$)/);
1935
+ if (m) {
1936
+ const g = m[1];
1937
+ a.has(g) || a.set(g, []);
1938
+ const O = a.get(g);
1939
+ O && O.push(N);
1859
1940
  } else
1860
- u.push(N);
1861
- }
1862
- for (const [N, v] of a) {
1863
- const h = W(e, N), m = W(t, N);
1864
- if (!Array.isArray(h) || !Array.isArray(m)) {
1865
- const g = /* @__PURE__ */ new Map();
1866
- for (const b of v) {
1867
- const j = b.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);
1868
- if (j) {
1869
- const T = j[1];
1870
- g.has(T) || g.set(T, []), (y = g.get(T)) == null || y.push(b);
1941
+ f.push(N);
1942
+ }
1943
+ for (const [N, m] of a) {
1944
+ const g = J(e, N), O = J(t, N);
1945
+ if (!Array.isArray(g) || !Array.isArray(O)) {
1946
+ const p = /* @__PURE__ */ new Map();
1947
+ for (const v of m) {
1948
+ const R = v.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);
1949
+ if (R) {
1950
+ const P = R[1];
1951
+ p.has(P) || p.set(P, []), (y = p.get(P)) == null || y.push(v);
1871
1952
  }
1872
1953
  }
1873
- for (const [b, j] of g)
1874
- s.push(...Ze(b, j, e, t, void 0)), c.add(b);
1954
+ for (const [v, R] of p)
1955
+ s.push(...st(v, R, e, t, void 0)), c.add(v);
1875
1956
  continue;
1876
1957
  }
1877
- const f = r ? qe(r, N, e) : null, E = f != null && f.items ? Array.isArray(f.items) && f.items[0] ? f.items[0] : Array.isArray(f.items) ? null : f.items : null, S = E && typeof E == "object" ? E : null;
1958
+ const u = r ? Ze(r, N, e) : null, A = u != null && u.items ? Array.isArray(u.items) && u.items[0] ? u.items[0] : Array.isArray(u.items) ? null : u.items : null, S = A && typeof A == "object" ? A : null;
1878
1959
  if (S) {
1879
- const g = $r(h, m, S), b = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new Map();
1880
- for (const [x, V] of g.entries())
1881
- V.input1 !== void 0 && b.set(V.input1, x), V.input2 !== void 0 && j.set(V.input2, x);
1882
- const T = /* @__PURE__ */ new Map(), F = [];
1883
- for (const x of v) {
1884
- const V = x.path.match(/^\/[^/]+(?:\/[^/]+)*\/(\d+)(?:\/|$)/);
1885
- if (V) {
1886
- const A = Number.parseInt(V[1], 10);
1887
- let w;
1888
- if (x.op === "add" ? w = j.get(A) : w = b.get(A), w) {
1889
- T.has(w) || T.set(w, []);
1890
- const R = T.get(w);
1891
- R && R.push(x);
1960
+ const p = Cr(g, O, S), v = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map();
1961
+ for (const [B, F] of p.entries())
1962
+ F.input1 !== void 0 && v.set(F.input1, B), F.input2 !== void 0 && R.set(F.input2, B);
1963
+ const P = /* @__PURE__ */ new Map(), x = [];
1964
+ for (const B of m) {
1965
+ const F = B.path.match(/^\/[^/]+(?:\/[^/]+)*\/(\d+)(?:\/|$)/);
1966
+ if (F) {
1967
+ const L = Number.parseInt(F[1], 10);
1968
+ let I;
1969
+ if (B.op === "add" ? I = R.get(L) : I = v.get(L), I) {
1970
+ P.has(I) || P.set(I, []);
1971
+ const D = P.get(I);
1972
+ D && D.push(B);
1892
1973
  } else
1893
- F.push(x);
1974
+ x.push(B);
1894
1975
  }
1895
1976
  }
1896
- for (const [x, V] of T) {
1897
- const A = g.get(x);
1898
- if (!A) continue;
1899
- const w = A.input1 !== void 0 ? `${N}/${A.input1}` : `${N}/${A.input2}`;
1900
- s.push(...Ze(w, V, e, t, void 0)), c.add(w);
1977
+ for (const [B, F] of P) {
1978
+ const L = p.get(B);
1979
+ if (!L) continue;
1980
+ const I = L.input1 !== void 0 ? `${N}/${L.input1}` : `${N}/${L.input2}`;
1981
+ s.push(...st(I, F, e, t, void 0)), c.add(I);
1901
1982
  }
1902
1983
  const M = /* @__PURE__ */ new Map();
1903
- for (const x of F) {
1904
- const V = x.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);
1905
- if (V) {
1906
- const A = V[1];
1907
- M.has(A) || M.set(A, []), (p = M.get(A)) == null || p.push(x);
1984
+ for (const B of x) {
1985
+ const F = B.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);
1986
+ if (F) {
1987
+ const L = F[1];
1988
+ M.has(L) || M.set(L, []), (d = M.get(L)) == null || d.push(B);
1908
1989
  }
1909
1990
  }
1910
- for (const [x, V] of M)
1911
- c.has(x) || (s.push(...Ze(x, V, e, t, void 0)), c.add(x));
1991
+ for (const [B, F] of M)
1992
+ c.has(B) || (s.push(...st(B, F, e, t, void 0)), c.add(B));
1912
1993
  } else {
1913
- const g = /* @__PURE__ */ new Map();
1914
- for (const b of v) {
1915
- const j = b.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);
1916
- if (j) {
1917
- const T = j[1];
1918
- g.has(T) || g.set(T, []), (d = g.get(T)) == null || d.push(b);
1994
+ const p = /* @__PURE__ */ new Map();
1995
+ for (const v of m) {
1996
+ const R = v.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);
1997
+ if (R) {
1998
+ const P = R[1];
1999
+ p.has(P) || p.set(P, []), (h = p.get(P)) == null || h.push(v);
1919
2000
  }
1920
2001
  }
1921
- for (const [b, j] of g)
1922
- s.push(...Ze(b, j, e, t, void 0)), c.add(b);
2002
+ for (const [v, R] of p)
2003
+ s.push(...st(v, R, e, t, void 0)), c.add(v);
1923
2004
  }
1924
2005
  }
1925
2006
  const l = /* @__PURE__ */ new Map();
1926
- for (const N of u) {
1927
- const v = N.path.split("/").filter(Boolean), h = v.length > 0 ? `/${v[0]}` : "/";
1928
- l.has(h) || l.set(h, []), (L = l.get(h)) == null || L.push(N);
2007
+ for (const N of f) {
2008
+ const m = N.path.split("/").filter(Boolean), g = m.length > 0 ? `/${m[0]}` : "/";
2009
+ l.has(g) || l.set(g, []), (T = l.get(g)) == null || T.push(N);
1929
2010
  }
1930
- for (const [N, v] of l)
1931
- s.push(...Ze(N, v, e, t, void 0));
2011
+ for (const [N, m] of l)
2012
+ s.push(...st(N, m, e, t, void 0));
1932
2013
  return s;
1933
2014
  }
1934
- function Ze(e, t, r, n, o) {
1935
- const i = o !== void 0 ? W(o, e) : void 0, s = W(r, e), c = W(n, e), a = [], u = [];
1936
- for (const f of t) {
1937
- const E = f.path, S = W(r, E), g = W(n, E);
1938
- let b = !1, j = !1;
1939
- f.op === "add" ? (b = !1, j = g !== void 0) : f.op === "remove" ? (b = S !== void 0, j = !1) : f.op === "replace" && (b = S !== void 0 && !de(S, g), j = g !== void 0 && !de(S, g)), E === e && (b = !0, j = !0), b && a.push(f), j && u.push(f);
2015
+ function st(e, t, r, n, o) {
2016
+ const i = o !== void 0 ? J(o, e) : void 0, s = J(r, e), c = J(n, e), a = [], f = [];
2017
+ for (const u of t) {
2018
+ const A = u.path, S = J(r, A), p = J(n, A);
2019
+ let v = !1, R = !1;
2020
+ u.op === "add" ? (v = !1, R = p !== void 0) : u.op === "remove" ? (v = S !== void 0, R = !1) : u.op === "replace" && (v = S !== void 0 && !he(S, p), R = p !== void 0 && !he(S, p)), A === e && (v = !0, R = !0), v && a.push(u), R && f.push(u);
1940
2021
  }
1941
- if (a.length === 0 && u.length === 0 && i !== void 0 && s !== void 0 && c !== void 0 && de(i, s) && de(i, c))
2022
+ if (a.length === 0 && f.length === 0 && i !== void 0 && s !== void 0 && c !== void 0 && he(i, s) && he(i, c))
1942
2023
  return [];
1943
- const l = a.length > 0 ? a : t, y = u.length > 0 ? u : t, p = [...l, ...y], d = p.some((f) => f.op === "add"), L = p.some((f) => f.op === "remove"), N = p.some((f) => f.op === "replace");
1944
- if (d && !N && !L) {
2024
+ const l = a.length > 0 ? a : t, y = f.length > 0 ? f : t, d = [...l, ...y], h = d.some((u) => u.op === "add"), T = d.some((u) => u.op === "remove"), N = d.some((u) => u.op === "replace");
2025
+ if (h && !N && !T) {
1945
2026
  if (s !== void 0 && c === void 0)
1946
2027
  return [
1947
2028
  {
@@ -1949,7 +2030,7 @@ function Ze(e, t, r, n, o) {
1949
2030
  baseValue: void 0,
1950
2031
  input1Value: s,
1951
2032
  input2Value: void 0,
1952
- conflictType: D.INPUT1_ONLY,
2033
+ conflictType: $.INPUT1_ONLY,
1953
2034
  patches1: l,
1954
2035
  // Highlight on input1 (new content) - use filtered patches1
1955
2036
  patches2: []
@@ -1963,7 +2044,7 @@ function Ze(e, t, r, n, o) {
1963
2044
  baseValue: void 0,
1964
2045
  input1Value: void 0,
1965
2046
  input2Value: c,
1966
- conflictType: D.INPUT2_ONLY,
2047
+ conflictType: $.INPUT2_ONLY,
1967
2048
  patches1: [],
1968
2049
  // No highlighting on input1 (doesn't exist there)
1969
2050
  patches2: y
@@ -1971,7 +2052,7 @@ function Ze(e, t, r, n, o) {
1971
2052
  }
1972
2053
  ];
1973
2054
  }
1974
- if (L && !d && !N) {
2055
+ if (T && !h && !N) {
1975
2056
  if (s !== void 0 && c === void 0)
1976
2057
  return [
1977
2058
  {
@@ -1979,7 +2060,7 @@ function Ze(e, t, r, n, o) {
1979
2060
  baseValue: s,
1980
2061
  input1Value: s,
1981
2062
  input2Value: void 0,
1982
- conflictType: D.INPUT1_ONLY,
2063
+ conflictType: $.INPUT1_ONLY,
1983
2064
  patches1: l,
1984
2065
  // Highlight on input1 (removed content) - use filtered patches1
1985
2066
  patches2: []
@@ -1993,7 +2074,7 @@ function Ze(e, t, r, n, o) {
1993
2074
  baseValue: c,
1994
2075
  input1Value: void 0,
1995
2076
  input2Value: c,
1996
- conflictType: D.INPUT2_ONLY,
2077
+ conflictType: $.INPUT2_ONLY,
1997
2078
  patches1: [],
1998
2079
  // No highlighting on input1 (doesn't exist there)
1999
2080
  patches2: y
@@ -2001,20 +2082,20 @@ function Ze(e, t, r, n, o) {
2001
2082
  }
2002
2083
  ];
2003
2084
  }
2004
- const v = kt(i, s, c);
2005
- let h = [], m = [];
2006
- switch (v) {
2007
- case D.INPUT1_ONLY:
2008
- h = l, m = [];
2085
+ const m = Ut(i, s, c);
2086
+ let g = [], O = [];
2087
+ switch (m) {
2088
+ case $.INPUT1_ONLY:
2089
+ g = l, O = [];
2009
2090
  break;
2010
- case D.INPUT2_ONLY:
2011
- h = [], m = y;
2091
+ case $.INPUT2_ONLY:
2092
+ g = [], O = y;
2012
2093
  break;
2013
- case D.SAME_CHANGE:
2014
- h = l, m = y;
2094
+ case $.SAME_CHANGE:
2095
+ g = l, O = y;
2015
2096
  break;
2016
- case D.TRUE_CONFLICT:
2017
- h = l, m = y;
2097
+ case $.TRUE_CONFLICT:
2098
+ g = l, O = y;
2018
2099
  break;
2019
2100
  }
2020
2101
  return [
@@ -2023,194 +2104,194 @@ function Ze(e, t, r, n, o) {
2023
2104
  baseValue: i,
2024
2105
  input1Value: s,
2025
2106
  input2Value: c,
2026
- conflictType: v,
2027
- patches1: h,
2028
- patches2: m
2107
+ conflictType: m,
2108
+ patches1: g,
2109
+ patches2: O
2029
2110
  }
2030
2111
  ];
2031
2112
  }
2032
- function At(e, t) {
2113
+ function jt(e, t) {
2033
2114
  if (!t || t.length === 0)
2034
2115
  return { start: 1, end: 1 };
2035
2116
  let r = Number.MAX_SAFE_INTEGER, n = 0, o = !1;
2036
2117
  for (const i of t) {
2037
- const s = Pe(e, i.path);
2118
+ const s = xe(e, i.path);
2038
2119
  s.start === 1 && s.end === 1 || (r = Math.min(r, s.start), n = Math.max(n, s.end), o = !0);
2039
2120
  }
2040
2121
  return !o || r === Number.MAX_SAFE_INTEGER || n === 0 ? { start: 1, end: 1 } : { start: r, end: n };
2041
2122
  }
2042
- function Vr(e, t, r, n) {
2043
- var i, s, c, a, u, l;
2123
+ function Zr(e, t, r, n) {
2124
+ var i, s, c, a, f, l;
2044
2125
  const o = [];
2045
2126
  for (let y = 0; y < e.length; y++) {
2046
- const p = e[y];
2047
- let d, L, N;
2048
- (((i = p.patches1) == null ? void 0 : i.length) ?? 0) === 0 && (((s = p.patches2) == null ? void 0 : s.length) ?? 0) === 0 ? (d = t ? Pe(t, p.path) : { start: 1, end: 1 }, L = Pe(r, p.path), N = Pe(n, p.path)) : (d = At(t, [...p.patches1 || [], ...p.patches2 || []]), L = At(r, p.patches1 || []), N = At(n, p.patches2 || []));
2049
- const v = p.conflictType === D.TRUE_CONFLICT;
2050
- let h = te.excluded, m = te.excluded;
2051
- switch (p.conflictType) {
2052
- case D.SAME_CHANGE:
2053
- h = te.first, m = te.first;
2127
+ const d = e[y];
2128
+ let h, T, N;
2129
+ (((i = d.patches1) == null ? void 0 : i.length) ?? 0) === 0 && (((s = d.patches2) == null ? void 0 : s.length) ?? 0) === 0 ? (h = t ? xe(t, d.path) : { start: 1, end: 1 }, T = xe(r, d.path), N = xe(n, d.path)) : (h = jt(t, [...d.patches1 || [], ...d.patches2 || []]), T = jt(r, d.patches1 || []), N = jt(n, d.patches2 || []));
2130
+ const m = d.conflictType === $.TRUE_CONFLICT;
2131
+ let g = oe.excluded, O = oe.excluded;
2132
+ switch (d.conflictType) {
2133
+ case $.SAME_CHANGE:
2134
+ g = oe.first, O = oe.first;
2054
2135
  break;
2055
- case D.INPUT1_ONLY:
2056
- h = te.first;
2136
+ case $.INPUT1_ONLY:
2137
+ g = oe.first;
2057
2138
  break;
2058
- case D.INPUT2_ONLY:
2059
- m = te.first;
2139
+ case $.INPUT2_ONLY:
2140
+ O = oe.first;
2060
2141
  break;
2061
- case D.TRUE_CONFLICT:
2062
- m = te.first;
2142
+ case $.TRUE_CONFLICT:
2143
+ O = oe.first;
2063
2144
  break;
2064
2145
  }
2065
- const f = [], E = [];
2066
- if (p.patches1 && (p.patches1.length ?? 0) > 0)
2067
- for (const g of p.patches1) {
2068
- const b = !t || t.trim() === "";
2069
- if (g.op === "remove" && !b)
2146
+ const u = [], A = [];
2147
+ if (d.patches1 && (d.patches1.length ?? 0) > 0)
2148
+ for (const p of d.patches1) {
2149
+ const v = !t || t.trim() === "";
2150
+ if (p.op === "remove" && !v)
2070
2151
  continue;
2071
- const j = Pe(r, g.path);
2072
- if (j.start !== 1 || j.end !== 1)
2073
- for (let T = j.start; T <= j.end; T++)
2074
- f.push({ line: T });
2075
- }
2076
- else if ((((c = p.patches1) == null ? void 0 : c.length) ?? 0) === 0 && (((a = p.patches2) == null ? void 0 : a.length) ?? 0) === 0) {
2077
- const g = Pe(r, p.path);
2078
- (g.start !== 1 || g.end !== 1) && f.push({ line: g.start });
2079
- }
2080
- if (p.patches2 && (p.patches2.length ?? 0) > 0)
2081
- for (const g of p.patches2) {
2082
- if (g.op === "remove")
2152
+ const R = xe(r, p.path);
2153
+ if (R.start !== 1 || R.end !== 1)
2154
+ for (let P = R.start; P <= R.end; P++)
2155
+ u.push({ line: P });
2156
+ }
2157
+ else if ((((c = d.patches1) == null ? void 0 : c.length) ?? 0) === 0 && (((a = d.patches2) == null ? void 0 : a.length) ?? 0) === 0) {
2158
+ const p = xe(r, d.path);
2159
+ (p.start !== 1 || p.end !== 1) && u.push({ line: p.start });
2160
+ }
2161
+ if (d.patches2 && (d.patches2.length ?? 0) > 0)
2162
+ for (const p of d.patches2) {
2163
+ if (p.op === "remove")
2083
2164
  continue;
2084
- const b = Pe(n, g.path);
2085
- if (b.start !== 1 || b.end !== 1)
2086
- for (let j = b.start; j <= b.end; j++)
2087
- E.push({ line: j });
2165
+ const v = xe(n, p.path);
2166
+ if (v.start !== 1 || v.end !== 1)
2167
+ for (let R = v.start; R <= v.end; R++)
2168
+ A.push({ line: R });
2088
2169
  }
2089
- else if ((((u = p.patches1) == null ? void 0 : u.length) ?? 0) === 0 && (((l = p.patches2) == null ? void 0 : l.length) ?? 0) === 0) {
2090
- const g = Pe(n, p.path);
2091
- (g.start !== 1 || g.end !== 1) && E.push({ line: g.start });
2170
+ else if ((((f = d.patches1) == null ? void 0 : f.length) ?? 0) === 0 && (((l = d.patches2) == null ? void 0 : l.length) ?? 0) === 0) {
2171
+ const p = xe(n, d.path);
2172
+ (p.start !== 1 || p.end !== 1) && A.push({ line: p.start });
2092
2173
  }
2093
2174
  const S = {
2094
2175
  id: `conflict-${y}`,
2095
- path: p.path,
2176
+ path: d.path,
2096
2177
  // Include path for value extraction during resolution
2097
2178
  baseRange: {
2098
- startLineNumber: d.start,
2099
- endLineNumberExclusive: d.end + 1
2179
+ startLineNumber: h.start,
2180
+ endLineNumberExclusive: h.end + 1
2100
2181
  },
2101
2182
  input1Range: {
2102
- startLineNumber: L.start,
2103
- endLineNumberExclusive: L.end + 1
2183
+ startLineNumber: T.start,
2184
+ endLineNumberExclusive: T.end + 1
2104
2185
  },
2105
2186
  input2Range: {
2106
2187
  startLineNumber: N.start,
2107
2188
  endLineNumberExclusive: N.end + 1
2108
2189
  },
2109
- input1Diffs: f,
2110
- input2Diffs: E,
2111
- isConflicting: v,
2112
- conflictType: p.conflictType,
2113
- input1State: h,
2114
- input2State: m,
2115
- handled: p.conflictType === D.SAME_CHANGE,
2190
+ input1Diffs: u,
2191
+ input2Diffs: A,
2192
+ isConflicting: m,
2193
+ conflictType: d.conflictType,
2194
+ input1State: g,
2195
+ input2State: O,
2196
+ handled: d.conflictType === $.SAME_CHANGE,
2116
2197
  focused: !1
2117
2198
  };
2118
2199
  o.push(S);
2119
2200
  }
2120
2201
  return o;
2121
2202
  }
2122
- function Jr(e, t, r, n = {}) {
2203
+ function eo(e, t, r, n = {}) {
2123
2204
  const { comparisonMode: o = "split", schema: i } = n;
2124
2205
  if (!t || !r)
2125
2206
  throw new Error("JSON Patch diff requires non-empty input1 and input2 strings");
2126
2207
  try {
2127
2208
  const s = e ? JSON.parse(e) : void 0, c = JSON.parse(t), a = JSON.parse(r);
2128
- let u;
2209
+ let f;
2129
2210
  if (s === void 0)
2130
- u = Ur(c, a, i);
2211
+ f = Qr(c, a, i);
2131
2212
  else if (o === "split")
2132
- u = Fr(s, c, a, i);
2213
+ f = Kr(s, c, a, i);
2133
2214
  else {
2134
- const l = We(s, c), y = We(c, a), p = /* @__PURE__ */ new Set();
2135
- l.forEach((d) => {
2136
- p.add(d.path);
2137
- }), y.forEach((d) => {
2138
- p.add(d.path);
2139
- }), u = Array.from(p).map((d) => {
2140
- const L = W(s, d), N = W(c, d), v = W(a, d), h = !de(L, N), m = !de(N, v);
2141
- let f;
2142
- return h && m ? f = D.TRUE_CONFLICT : h ? f = D.INPUT1_ONLY : m ? f = D.INPUT2_ONLY : f = D.SAME_CHANGE, {
2143
- path: d,
2144
- baseValue: L,
2215
+ const l = Qe(s, c), y = Qe(c, a), d = /* @__PURE__ */ new Set();
2216
+ l.forEach((h) => {
2217
+ d.add(h.path);
2218
+ }), y.forEach((h) => {
2219
+ d.add(h.path);
2220
+ }), f = Array.from(d).map((h) => {
2221
+ const T = J(s, h), N = J(c, h), m = J(a, h), g = !he(T, N), O = !he(N, m);
2222
+ let u;
2223
+ return g && O ? u = $.TRUE_CONFLICT : g ? u = $.INPUT1_ONLY : O ? u = $.INPUT2_ONLY : u = $.SAME_CHANGE, {
2224
+ path: h,
2225
+ baseValue: T,
2145
2226
  input1Value: N,
2146
- input2Value: v,
2147
- conflictType: f
2227
+ input2Value: m,
2228
+ conflictType: u
2148
2229
  };
2149
2230
  });
2150
2231
  }
2151
- return Vr(u, e, t, r);
2232
+ return Zr(f, e, t, r);
2152
2233
  } catch (s) {
2153
2234
  const c = s instanceof Error ? s.message : String(s);
2154
2235
  throw new Error(`JSON Patch diff computation failed: ${c}`);
2155
2236
  }
2156
2237
  }
2157
- function Hr(e, t, r) {
2238
+ function to(e, t, r) {
2158
2239
  const n = e !== t, o = e !== r;
2159
2240
  let i;
2160
- return n && o ? t === r ? i = D.SAME_CHANGE : i = D.TRUE_CONFLICT : n ? i = D.INPUT1_ONLY : i = D.INPUT2_ONLY, { conflictType: i, input1Changed: n, input2Changed: o };
2241
+ return n && o ? t === r ? i = $.SAME_CHANGE : i = $.TRUE_CONFLICT : n ? i = $.INPUT1_ONLY : i = $.INPUT2_ONLY, { conflictType: i, input1Changed: n, input2Changed: o };
2161
2242
  }
2162
- function no(e, t, r) {
2163
- var u, l, y;
2243
+ function yo(e, t, r) {
2244
+ var f, l, y;
2164
2245
  const n = [], o = [];
2165
- for (let p = 0; p < Math.max(e.length, t.length, r.length); p++) {
2166
- const d = e[p] !== void 0 ? e[p] : "", L = t[p] !== void 0 ? t[p] : "", N = r[p] !== void 0 ? r[p] : "", { conflictType: v, input1Changed: h, input2Changed: m } = Hr(d, L, N);
2167
- (h || m) && o.push({
2168
- line: p + 1,
2169
- input1Changed: h,
2170
- input2Changed: m,
2171
- baseLine: d,
2172
- input1Line: L,
2246
+ for (let d = 0; d < Math.max(e.length, t.length, r.length); d++) {
2247
+ const h = e[d] !== void 0 ? e[d] : "", T = t[d] !== void 0 ? t[d] : "", N = r[d] !== void 0 ? r[d] : "", { conflictType: m, input1Changed: g, input2Changed: O } = to(h, T, N);
2248
+ (g || O) && o.push({
2249
+ line: d + 1,
2250
+ input1Changed: g,
2251
+ input2Changed: O,
2252
+ baseLine: h,
2253
+ input1Line: T,
2173
2254
  input2Line: N,
2174
- conflictType: v
2255
+ conflictType: m
2175
2256
  });
2176
2257
  }
2177
2258
  if (o.length === 0)
2178
2259
  return [];
2179
- let i = ((u = o[0]) == null ? void 0 : u.line) ?? 1, s = (l = o[0]) == null ? void 0 : l.conflictType, c = [], a = [];
2180
- for (let p = 0; p <= o.length; p++) {
2181
- const d = o[p], L = p === o.length, N = !L && d && o[p - 1] && d.line > (((y = o[p - 1]) == null ? void 0 : y.line) ?? 0) + 1, v = !L && d && d.conflictType !== s;
2182
- if (L || N || v) {
2183
- const h = o[p - 1], m = h ? h.line + 1 : i + 1, f = c.length > 0, E = a.length > 0, S = s === D.TRUE_CONFLICT, g = {
2260
+ let i = ((f = o[0]) == null ? void 0 : f.line) ?? 1, s = (l = o[0]) == null ? void 0 : l.conflictType, c = [], a = [];
2261
+ for (let d = 0; d <= o.length; d++) {
2262
+ const h = o[d], T = d === o.length, N = !T && h && o[d - 1] && h.line > (((y = o[d - 1]) == null ? void 0 : y.line) ?? 0) + 1, m = !T && h && h.conflictType !== s;
2263
+ if (T || N || m) {
2264
+ const g = o[d - 1], O = g ? g.line + 1 : i + 1, u = c.length > 0, A = a.length > 0, S = s === $.TRUE_CONFLICT, p = {
2184
2265
  id: `conflict-${n.length}`,
2185
2266
  baseRange: {
2186
2267
  startLineNumber: i,
2187
- endLineNumberExclusive: m
2268
+ endLineNumberExclusive: O
2188
2269
  },
2189
2270
  input1Range: {
2190
2271
  startLineNumber: i,
2191
- endLineNumberExclusive: m
2272
+ endLineNumberExclusive: O
2192
2273
  },
2193
2274
  input2Range: {
2194
2275
  startLineNumber: i,
2195
- endLineNumberExclusive: m
2276
+ endLineNumberExclusive: O
2196
2277
  },
2197
2278
  input1Diffs: c,
2198
2279
  input2Diffs: a,
2199
2280
  isConflicting: S,
2200
2281
  conflictType: s,
2201
2282
  // Default: accept input2 (ours) by default, or both if same change
2202
- input1State: s === D.SAME_CHANGE && f ? te.first : te.excluded,
2203
- input2State: E ? te.first : te.excluded,
2204
- handled: s === D.SAME_CHANGE,
2283
+ input1State: s === $.SAME_CHANGE && u ? oe.first : oe.excluded,
2284
+ input2State: A ? oe.first : oe.excluded,
2285
+ handled: s === $.SAME_CHANGE,
2205
2286
  focused: !1
2206
2287
  };
2207
- n.push(g), !L && d && (i = d.line, s = d.conflictType, c = [], a = []);
2288
+ n.push(p), !T && h && (i = h.line, s = h.conflictType, c = [], a = []);
2208
2289
  }
2209
- !L && d && (d.input1Changed && c.push({ line: d.line }), d.input2Changed && a.push({ line: d.line }));
2290
+ !T && h && (h.input1Changed && c.push({ line: h.line }), h.input2Changed && a.push({ line: h.line }));
2210
2291
  }
2211
2292
  return n;
2212
2293
  }
2213
- function Gr(e, t, r) {
2294
+ function no(e, t, r) {
2214
2295
  if (!t || t === "/") {
2215
2296
  if (typeof e == "object" && e !== null && !Array.isArray(e) && typeof r == "object" && r !== null && !Array.isArray(r)) {
2216
2297
  Object.assign(e, r);
@@ -2221,11 +2302,11 @@ function Gr(e, t, r) {
2221
2302
  const n = t.split("/").filter((c) => c !== "");
2222
2303
  let o = e;
2223
2304
  for (let c = 0; c < n.length - 1; c++) {
2224
- const a = n[c], u = Number.parseInt(a, 10);
2225
- if (!Number.isNaN(u) && String(u) === a) {
2305
+ const a = n[c], f = Number.parseInt(a, 10);
2306
+ if (!Number.isNaN(f) && String(f) === a) {
2226
2307
  if (!Array.isArray(o))
2227
2308
  throw new Error(`Path ${t}: segment ${a} expects array but got ${typeof o}`);
2228
- o = o[u];
2309
+ o = o[f];
2229
2310
  } else {
2230
2311
  if (!o || typeof o != "object" || Array.isArray(o))
2231
2312
  throw new Error(`Path ${t}: segment ${a} expects object but got ${typeof o}`);
@@ -2244,43 +2325,43 @@ function Gr(e, t, r) {
2244
2325
  o[i] = r;
2245
2326
  }
2246
2327
  }
2247
- function Wr(e, t) {
2328
+ function ro(e, t) {
2248
2329
  try {
2249
- const r = ln(e);
2330
+ const r = bn(e);
2250
2331
  if (!r) return null;
2251
2332
  const n = t.split("/").filter((l) => l !== "").map((l) => {
2252
2333
  const y = Number.parseInt(l, 10);
2253
2334
  return !Number.isNaN(y) && String(y) === l ? y : l;
2254
- }), o = un(r, n);
2335
+ }), o = wn(r, n);
2255
2336
  if (!o) return null;
2256
2337
  const s = e.substring(0, o.offset).split(`
2257
- `).length, c = o.offset + o.length, u = e.substring(0, c).split(`
2338
+ `).length, c = o.offset + o.length, f = e.substring(0, c).split(`
2258
2339
  `).length;
2259
- return { startLine: s, endLine: u };
2340
+ return { startLine: s, endLine: f };
2260
2341
  } catch {
2261
2342
  return null;
2262
2343
  }
2263
2344
  }
2264
- function mn(e, t, r, n = "") {
2345
+ function In(e, t, r, n = "") {
2265
2346
  if (JSON.stringify(e) === JSON.stringify(t))
2266
2347
  return e;
2267
2348
  if (e !== null && t !== null && typeof e == "object" && typeof t == "object" && !Array.isArray(e) && !Array.isArray(t)) {
2268
- const o = e, i = t, s = { ...o }, c = r ? qe(r, n, e) : null, a = c != null && c.properties && typeof c.properties == "object" && !Array.isArray(c.properties) ? c.properties : void 0, u = c == null ? void 0 : c.additionalProperties;
2349
+ const o = e, i = t, s = { ...o }, c = r ? Ze(r, n, e) : null, a = c != null && c.properties && typeof c.properties == "object" && !Array.isArray(c.properties) ? c.properties : void 0, f = c == null ? void 0 : c.additionalProperties;
2269
2350
  for (const l of Object.keys(i))
2270
2351
  if (l in s) {
2271
2352
  if (JSON.stringify(s[l]) !== JSON.stringify(i[l])) {
2272
- const y = a == null ? void 0 : a[l], p = n ? `${n}/${l}` : `/${l}`, d = mn(s[l], i[l], y, p);
2273
- if (d !== null)
2274
- s[l] = d;
2353
+ const y = a == null ? void 0 : a[l], d = n ? `${n}/${l}` : `/${l}`, h = In(s[l], i[l], y, d);
2354
+ if (h !== null)
2355
+ s[l] = h;
2275
2356
  else
2276
2357
  return null;
2277
2358
  }
2278
- } else if (u === !0 || u === void 0 || (a == null ? void 0 : a[l]) !== void 0)
2359
+ } else if (f === !0 || f === void 0 || (a == null ? void 0 : a[l]) !== void 0)
2279
2360
  s[l] = i[l];
2280
2361
  else {
2281
- if (u === !1)
2362
+ if (f === !1)
2282
2363
  return null;
2283
- if (typeof u == "object")
2364
+ if (typeof f == "object")
2284
2365
  s[l] = i[l];
2285
2366
  else
2286
2367
  return null;
@@ -2289,169 +2370,169 @@ function mn(e, t, r, n = "") {
2289
2370
  }
2290
2371
  return null;
2291
2372
  }
2292
- function qr(e, t, r, n, o) {
2373
+ function oo(e, t, r, n, o) {
2293
2374
  var S;
2294
2375
  const i = [], s = [], c = e.join(`
2295
2376
  `), a = t.join(`
2296
- `), u = r.join(`
2377
+ `), f = r.join(`
2297
2378
  `);
2298
- let l, y, p;
2379
+ let l, y, d;
2299
2380
  try {
2300
- l = c ? JSON.parse(c) : {}, y = a ? JSON.parse(a) : {}, p = u ? JSON.parse(u) : {};
2301
- } catch (g) {
2381
+ l = c ? JSON.parse(c) : {}, y = a ? JSON.parse(a) : {}, d = f ? JSON.parse(f) : {};
2382
+ } catch (p) {
2302
2383
  return {
2303
2384
  content: c || "",
2304
2385
  isValid: !1,
2305
- validationError: `Failed to parse input JSON: ${g instanceof Error ? g.message : String(g)}`,
2386
+ validationError: `Failed to parse input JSON: ${p instanceof Error ? p.message : String(p)}`,
2306
2387
  warnings: i
2307
2388
  };
2308
2389
  }
2309
- let d;
2310
- !l || typeof l == "object" && l !== null && Object.keys(l).length === 0 ? d = JSON.parse(JSON.stringify(p)) : d = JSON.parse(JSON.stringify(l));
2311
- const L = /* @__PURE__ */ new Set(), N = /* @__PURE__ */ new Set(), v = /* @__PURE__ */ new Set(), h = (g, b, j) => null;
2312
- for (const g of n) {
2313
- const b = g.input1State === te.first || g.input1State === te.second, j = g.input2State === te.first || g.input2State === te.second;
2314
- let T = g.path;
2315
- if (!T && (T = h(g.baseRange.startLineNumber, g.baseRange.endLineNumberExclusive) || void 0, !T)) {
2316
- g.conflictType === D.INPUT2_ONLY && j ? d = JSON.parse(JSON.stringify(p)) : g.conflictType === D.INPUT1_ONLY && b ? d = JSON.parse(JSON.stringify(y)) : g.conflictType === D.SAME_CHANGE && (b || j) || j ? d = JSON.parse(JSON.stringify(p)) : b && (d = JSON.parse(JSON.stringify(y)));
2390
+ let h;
2391
+ !l || typeof l == "object" && l !== null && Object.keys(l).length === 0 ? h = JSON.parse(JSON.stringify(d)) : h = JSON.parse(JSON.stringify(l));
2392
+ const T = /* @__PURE__ */ new Set(), N = /* @__PURE__ */ new Set(), m = /* @__PURE__ */ new Set(), g = (p, v, R) => null;
2393
+ for (const p of n) {
2394
+ const v = p.input1State === oe.first || p.input1State === oe.second, R = p.input2State === oe.first || p.input2State === oe.second;
2395
+ let P = p.path;
2396
+ if (!P && (P = g(p.baseRange.startLineNumber, p.baseRange.endLineNumberExclusive) || void 0, !P)) {
2397
+ p.conflictType === $.INPUT2_ONLY && R ? h = JSON.parse(JSON.stringify(d)) : p.conflictType === $.INPUT1_ONLY && v ? h = JSON.parse(JSON.stringify(y)) : p.conflictType === $.SAME_CHANGE && (v || R) || R ? h = JSON.parse(JSON.stringify(d)) : v && (h = JSON.parse(JSON.stringify(y)));
2317
2398
  continue;
2318
2399
  }
2319
2400
  try {
2320
- let F, M = T;
2321
- const x = (S = g.path) == null ? void 0 : S.match(/^(.*\/\d+)(?:\/.*)?$/);
2322
- let V = !1, A = "";
2323
- if (x) {
2324
- const R = x[1].split("/").filter((X) => X !== "");
2325
- if (R.length >= 2) {
2326
- const X = R[R.length - 1];
2327
- /^\d+$/.test(X) && (V = !0, A = `/${R.slice(0, -1).join("/")}`);
2401
+ let x, M = P;
2402
+ const B = (S = p.path) == null ? void 0 : S.match(/^(.*\/\d+)(?:\/.*)?$/);
2403
+ let F = !1, L = "";
2404
+ if (B) {
2405
+ const D = B[1].split("/").filter((K) => K !== "");
2406
+ if (D.length >= 2) {
2407
+ const K = D[D.length - 1];
2408
+ /^\d+$/.test(K) && (F = !0, L = `/${D.slice(0, -1).join("/")}`);
2328
2409
  }
2329
2410
  }
2330
- if (b && j)
2331
- if (g.conflictType === D.SAME_CHANGE)
2332
- V ? (F = W(p, A), M = A) : F = W(p, T);
2411
+ if (v && R)
2412
+ if (p.conflictType === $.SAME_CHANGE)
2413
+ F ? (x = J(d, L), M = L) : x = J(d, P);
2333
2414
  else {
2334
- const w = V ? A : T, R = W(y, w), X = W(p, w), ne = o && l && typeof l == "object" && qe(o, w, l) || void 0, ae = mn(R, X, ne, w);
2335
- ae !== null ? (F = ae, M = w, i.push(`Smart-merged conflict at path ${w}`)) : (F = X, M = w, i.push(`Merge failed at path ${w}, using input2 value`));
2415
+ const I = F ? L : P, D = J(y, I), K = J(d, I), ie = o && l && typeof l == "object" && Ze(o, I, l) || void 0, ae = In(D, K, ie, I);
2416
+ ae !== null ? (x = ae, M = I, i.push(`Smart-merged conflict at path ${I}`)) : (x = K, M = I, i.push(`Merge failed at path ${I}, using input2 value`));
2336
2417
  }
2337
- else if (b)
2338
- if (V)
2339
- F = W(y, A), M = A;
2418
+ else if (v)
2419
+ if (F)
2420
+ x = J(y, L), M = L;
2340
2421
  else {
2341
- const w = T.split("/").filter(Boolean);
2342
- if (w.length > 1) {
2343
- const R = `/${w.slice(0, -1).join("/")}`;
2344
- if (!v.has(R)) {
2345
- const X = W(y, R);
2346
- if (typeof X == "object" && X !== null && !Array.isArray(X)) {
2347
- const ne = W(d, R);
2348
- if (typeof ne == "object" && ne !== null && !Array.isArray(ne)) {
2349
- for (const [ae, me] of Object.entries(X)) {
2350
- const je = `${R}/${ae}`;
2351
- N.has(je) || (ne[ae] = me);
2422
+ const I = P.split("/").filter(Boolean);
2423
+ if (I.length > 1) {
2424
+ const D = `/${I.slice(0, -1).join("/")}`;
2425
+ if (!m.has(D)) {
2426
+ const K = J(y, D);
2427
+ if (typeof K == "object" && K !== null && !Array.isArray(K)) {
2428
+ const ie = J(h, D);
2429
+ if (typeof ie == "object" && ie !== null && !Array.isArray(ie)) {
2430
+ for (const [ae, ge] of Object.entries(K)) {
2431
+ const Pe = `${D}/${ae}`;
2432
+ N.has(Pe) || (ie[ae] = ge);
2352
2433
  }
2353
- v.add(R);
2434
+ m.add(D);
2354
2435
  }
2355
2436
  }
2356
2437
  }
2357
- F = W(y, T);
2438
+ x = J(y, P);
2358
2439
  } else
2359
- F = W(y, T);
2440
+ x = J(y, P);
2360
2441
  }
2361
- else if (j)
2362
- if (V)
2363
- F = W(p, A), M = A;
2442
+ else if (R)
2443
+ if (F)
2444
+ x = J(d, L), M = L;
2364
2445
  else {
2365
- const w = T.split("/").filter(Boolean);
2366
- if (w.length > 1) {
2367
- const R = `/${w.slice(0, -1).join("/")}`;
2368
- if (!v.has(R)) {
2369
- const X = W(p, R);
2370
- if (typeof X == "object" && X !== null && !Array.isArray(X)) {
2371
- const ne = W(d, R);
2372
- if (typeof ne == "object" && ne !== null && !Array.isArray(ne)) {
2373
- for (const [ae, me] of Object.entries(X)) {
2374
- const je = `${R}/${ae}`;
2375
- N.has(je) || (ne[ae] = me);
2446
+ const I = P.split("/").filter(Boolean);
2447
+ if (I.length > 1) {
2448
+ const D = `/${I.slice(0, -1).join("/")}`;
2449
+ if (!m.has(D)) {
2450
+ const K = J(d, D);
2451
+ if (typeof K == "object" && K !== null && !Array.isArray(K)) {
2452
+ const ie = J(h, D);
2453
+ if (typeof ie == "object" && ie !== null && !Array.isArray(ie)) {
2454
+ for (const [ae, ge] of Object.entries(K)) {
2455
+ const Pe = `${D}/${ae}`;
2456
+ N.has(Pe) || (ie[ae] = ge);
2376
2457
  }
2377
- v.add(R);
2458
+ m.add(D);
2378
2459
  }
2379
2460
  }
2380
2461
  }
2381
- F = W(p, T);
2462
+ x = J(d, P);
2382
2463
  } else
2383
- F = W(p, T);
2464
+ x = J(d, P);
2384
2465
  }
2385
2466
  else {
2386
- const w = V ? A : T, R = W(l, w);
2387
- if (R !== void 0)
2388
- F = R, M = w;
2467
+ const I = F ? L : P, D = J(l, I);
2468
+ if (D !== void 0)
2469
+ x = D, M = I;
2389
2470
  else
2390
2471
  continue;
2391
2472
  }
2392
- F !== void 0 && (Gr(d, M, F), L.add(M), N.add(M));
2393
- } catch (F) {
2394
- i.push(`Failed to apply conflict at path ${T || g.id}: ${F instanceof Error ? F.message : String(F)}`);
2395
- }
2396
- }
2397
- const m = JSON.stringify(d, null, 2);
2398
- for (const g of n) {
2399
- const b = g.path;
2400
- if (!b) continue;
2401
- const j = g.input1State === te.first || g.input1State === te.second, T = g.input2State === te.first || g.input2State === te.second;
2402
- if (j && T && g.conflictType === D.TRUE_CONFLICT) {
2403
- const F = Wr(m, b);
2404
- F && s.push({
2405
- conflictId: g.id,
2406
- conflictPath: b,
2473
+ x !== void 0 && (no(h, M, x), T.add(M), N.add(M));
2474
+ } catch (x) {
2475
+ i.push(`Failed to apply conflict at path ${P || p.id}: ${x instanceof Error ? x.message : String(x)}`);
2476
+ }
2477
+ }
2478
+ const O = JSON.stringify(h, null, 2);
2479
+ for (const p of n) {
2480
+ const v = p.path;
2481
+ if (!v) continue;
2482
+ const R = p.input1State === oe.first || p.input1State === oe.second, P = p.input2State === oe.first || p.input2State === oe.second;
2483
+ if (R && P && p.conflictType === $.TRUE_CONFLICT) {
2484
+ const x = ro(O, v);
2485
+ x && s.push({
2486
+ conflictId: p.id,
2487
+ conflictPath: v,
2407
2488
  type: "warning",
2408
2489
  message: "Both conflicting changes were accepted - please review and manually resolve",
2409
- startLine: F.startLine,
2410
- endLine: F.endLine
2490
+ startLine: x.startLine,
2491
+ endLine: x.endLine
2411
2492
  });
2412
2493
  }
2413
2494
  }
2414
- let f = !0, E;
2495
+ let u = !0, A;
2415
2496
  try {
2416
- JSON.parse(m);
2417
- } catch (g) {
2418
- f = !1, E = g instanceof Error ? g.message : "Invalid JSON", s.push({
2497
+ JSON.parse(O);
2498
+ } catch (p) {
2499
+ u = !1, A = p instanceof Error ? p.message : "Invalid JSON", s.push({
2419
2500
  conflictId: "validation-error",
2420
2501
  conflictPath: "/",
2421
2502
  type: "error",
2422
- message: E,
2503
+ message: A,
2423
2504
  startLine: 1,
2424
- endLine: m.split(`
2505
+ endLine: O.split(`
2425
2506
  `).length
2426
2507
  });
2427
2508
  }
2428
2509
  return {
2429
- content: m,
2430
- isValid: f,
2431
- validationError: E,
2510
+ content: O,
2511
+ isValid: u,
2512
+ validationError: A,
2432
2513
  warnings: i.length > 0 ? i : void 0,
2433
2514
  conflictIssues: s.length > 0 ? s : void 0
2434
2515
  };
2435
2516
  }
2436
- function Yr(e, t, r) {
2437
- let n = "", o = "", i = "", s = "", c = "", a = "", u = "", l = "";
2517
+ function io(e, t, r) {
2518
+ let n = "", o = "", i = "", s = "", c = "", a = "", f = "", l = "";
2438
2519
  switch (e.conflictType) {
2439
- case D.SAME_CHANGE: {
2520
+ case $.SAME_CHANGE: {
2440
2521
  const y = e.baseRange.startLineNumber === 1 && e.baseRange.endLineNumberExclusive === 2 && // Default "not found" range
2441
2522
  e.input1Range.startLineNumber !== 1 && e.input2Range.startLineNumber !== 1;
2442
- t ? y ? (n = "merge-2way-deletion", o = "merge-same-change", s = r.baseOverviewColor, c = r.changeOverviewColor, a = "", u = "-", l = "+") : (n = "merge-2way-deletion", o = "merge-same-change", i = "merge-change-base", s = r.baseOverviewColor, c = r.changeOverviewColor, a = "", u = "-", l = "") : y ? (n = "merge-same-change", o = "merge-same-change", i = "", s = r.changeOverviewColor, c = r.changeOverviewColor, a = "", u = "+", l = "+") : (n = "merge-change-incoming", o = "merge-same-change", i = "merge-change-base", s = r.changeOverviewColor, c = r.changeOverviewColor, a = r.baseOverviewColor, u = "", l = "");
2523
+ t ? y ? (n = "merge-2way-deletion", o = "merge-same-change", s = r.baseOverviewColor, c = r.changeOverviewColor, a = "", f = "-", l = "+") : (n = "merge-2way-deletion", o = "merge-same-change", i = "merge-change-base", s = r.baseOverviewColor, c = r.changeOverviewColor, a = "", f = "-", l = "") : y ? (n = "merge-same-change", o = "merge-same-change", i = "", s = r.changeOverviewColor, c = r.changeOverviewColor, a = "", f = "+", l = "+") : (n = "merge-change-incoming", o = "merge-same-change", i = "merge-change-base", s = r.changeOverviewColor, c = r.changeOverviewColor, a = r.baseOverviewColor, f = "", l = "");
2443
2524
  break;
2444
2525
  }
2445
- case D.INPUT1_ONLY:
2446
- t ? (n = "merge-2way-deletion", o = "", s = r.baseOverviewColor, c = "", u = "-", l = "") : (n = "merge-change-incoming", o = "", i = "merge-change-base", s = r.conflictOverviewColor, c = "", a = r.baseOverviewColor, u = "-", l = "");
2526
+ case $.INPUT1_ONLY:
2527
+ t ? (n = "merge-2way-deletion", o = "", s = r.baseOverviewColor, c = "", f = "-", l = "") : (n = "merge-change-incoming", o = "", i = "merge-change-base", s = r.conflictOverviewColor, c = "", a = r.baseOverviewColor, f = "-", l = "");
2447
2528
  break;
2448
- case D.INPUT2_ONLY:
2449
- n = "", o = "merge-change-current", i = t ? "" : "merge-change-base", s = "", c = r.changeOverviewColor, a = t ? "" : r.baseOverviewColor, u = "", l = "+";
2529
+ case $.INPUT2_ONLY:
2530
+ n = "", o = "merge-change-current", i = t ? "" : "merge-change-base", s = "", c = r.changeOverviewColor, a = t ? "" : r.baseOverviewColor, f = "", l = "+";
2450
2531
  break;
2451
- case D.TRUE_CONFLICT: {
2532
+ case $.TRUE_CONFLICT: {
2452
2533
  const y = e.baseRange.startLineNumber === 1 && e.baseRange.endLineNumberExclusive === 2 && // Default "not found" range
2453
2534
  e.input1Range.startLineNumber !== 1 && e.input2Range.startLineNumber !== 1;
2454
- t ? y ? (n = "merge-2way-deletion", o = "merge-change-current", s = r.baseOverviewColor, c = r.changeOverviewColor, a = "", u = "-", l = "+") : (n = "merge-2way-deletion", o = "merge-conflict-current", i = "merge-conflict-base", s = r.baseOverviewColor, c = r.conflictOverviewColor, a = r.baseOverviewColor, u = "-", l = "+") : y ? (n = "merge-change-incoming", o = "merge-change-current", i = "", s = r.changeOverviewColor, c = r.changeOverviewColor, a = "", u = "+", l = "+") : (n = "merge-conflict-incoming", o = "merge-conflict-current", i = "merge-conflict-base", s = r.conflictOverviewColor, c = r.conflictOverviewColor, a = r.baseOverviewColor, u = "", l = "");
2535
+ t ? y ? (n = "merge-2way-deletion", o = "merge-change-current", s = r.baseOverviewColor, c = r.changeOverviewColor, a = "", f = "-", l = "+") : (n = "merge-2way-deletion", o = "merge-conflict-current", i = "merge-conflict-base", s = r.baseOverviewColor, c = r.conflictOverviewColor, a = r.baseOverviewColor, f = "-", l = "+") : y ? (n = "merge-change-incoming", o = "merge-change-current", i = "", s = r.changeOverviewColor, c = r.changeOverviewColor, a = "", f = "+", l = "+") : (n = "merge-conflict-incoming", o = "merge-conflict-current", i = "merge-conflict-base", s = r.conflictOverviewColor, c = r.conflictOverviewColor, a = r.baseOverviewColor, f = "", l = "");
2455
2536
  break;
2456
2537
  }
2457
2538
  }
@@ -2462,11 +2543,11 @@ function Yr(e, t, r) {
2462
2543
  input1OverviewColor: s,
2463
2544
  input2OverviewColor: c,
2464
2545
  baseOverviewColor: a,
2465
- input1Symbol: u,
2546
+ input1Symbol: f,
2466
2547
  input2Symbol: l
2467
2548
  };
2468
2549
  }
2469
- function yn(e) {
2550
+ function Ln(e) {
2470
2551
  const t = /* @__PURE__ */ new Set();
2471
2552
  for (const r of e)
2472
2553
  if (r && typeof r == "object" && "line" in r) {
@@ -2475,11 +2556,11 @@ function yn(e) {
2475
2556
  }
2476
2557
  return Array.from(t).sort((r, n) => r - n);
2477
2558
  }
2478
- function zr(e, t, r) {
2559
+ function so(e, t, r) {
2479
2560
  const n = [];
2480
2561
  if (t.input1Class) {
2481
2562
  if (e.input1Diffs.length > 0) {
2482
- const o = yn(e.input1Diffs);
2563
+ const o = Ln(e.input1Diffs);
2483
2564
  for (const i of o)
2484
2565
  n.push({
2485
2566
  range: new r.Range(i, 1, i, Number.MAX_SAFE_INTEGER),
@@ -2497,7 +2578,7 @@ function zr(e, t, r) {
2497
2578
  } : void 0
2498
2579
  }
2499
2580
  });
2500
- } else if (e.conflictType === D.INPUT1_ONLY) {
2581
+ } else if (e.conflictType === $.INPUT1_ONLY) {
2501
2582
  const o = e.input1Range.startLineNumber, i = e.input1Range.endLineNumberExclusive - 1;
2502
2583
  for (let s = o; s <= i; s++)
2503
2584
  n.push({
@@ -2520,10 +2601,10 @@ function zr(e, t, r) {
2520
2601
  }
2521
2602
  return n;
2522
2603
  }
2523
- function Xr(e, t, r) {
2604
+ function co(e, t, r) {
2524
2605
  const n = [];
2525
2606
  if (e.input2Diffs.length > 0 && t.input2Class) {
2526
- const o = yn(e.input2Diffs);
2607
+ const o = Ln(e.input2Diffs);
2527
2608
  for (const i of o)
2528
2609
  n.push({
2529
2610
  range: new r.Range(i, 1, i, Number.MAX_SAFE_INTEGER),
@@ -2544,7 +2625,7 @@ function Xr(e, t, r) {
2544
2625
  }
2545
2626
  return n;
2546
2627
  }
2547
- function Qr(e, t, r) {
2628
+ function ao(e, t, r) {
2548
2629
  const n = [], o = e.baseRange.startLineNumber === 1 && e.baseRange.endLineNumberExclusive === 2;
2549
2630
  return (e.input1Diffs.length > 0 || e.input2Diffs.length > 0) && !o && n.push({
2550
2631
  range: new r.Range(
@@ -2567,18 +2648,18 @@ function Qr(e, t, r) {
2567
2648
  }
2568
2649
  }), n;
2569
2650
  }
2570
- function Zr(e, t, r, n) {
2571
- const o = Yr(e, t, r);
2651
+ function lo(e, t, r, n) {
2652
+ const o = io(e, t, r);
2572
2653
  return {
2573
- input1Decorations: zr(e, o, n),
2574
- input2Decorations: Xr(e, o, n),
2575
- baseDecorations: Qr(e, o, n)
2654
+ input1Decorations: so(e, o, n),
2655
+ input2Decorations: co(e, o, n),
2656
+ baseDecorations: ao(e, o, n)
2576
2657
  };
2577
2658
  }
2578
- function Cr(e, t, r, n) {
2659
+ function uo(e, t, r, n) {
2579
2660
  const o = [], i = [], s = [];
2580
2661
  for (const c of e) {
2581
- const a = Zr(c, t, r, n);
2662
+ const a = lo(c, t, r, n);
2582
2663
  o.push(...a.input1Decorations), i.push(...a.input2Decorations), s.push(...a.baseDecorations);
2583
2664
  }
2584
2665
  return {
@@ -2587,8 +2668,8 @@ function Cr(e, t, r, n) {
2587
2668
  baseDecorations: s
2588
2669
  };
2589
2670
  }
2590
- const Kr = () => /* @__PURE__ */ st("div", { style: { padding: "20px", textAlign: "center", color: "#888" }, children: "Loading Monaco Editor..." }), Nt = "⚠";
2591
- function ro(e) {
2671
+ const fo = () => /* @__PURE__ */ gt("div", { style: { padding: "20px", textAlign: "center", color: "#888" }, children: "Loading Monaco Editor..." }), Dt = "⚠";
2672
+ function vo(e) {
2592
2673
  const {
2593
2674
  original: t = "",
2594
2675
  modified: r = "",
@@ -2598,333 +2679,334 @@ function ro(e) {
2598
2679
  width: s = "100%",
2599
2680
  height: c = "100%",
2600
2681
  className: a,
2601
- loading: u,
2682
+ loading: f,
2602
2683
  onMount: l,
2603
2684
  onMergeResolve: y,
2604
- showResultColumn: p,
2605
- baseIndex: d = 1,
2606
- comparisonMode: L = "split",
2685
+ showResultColumn: d,
2686
+ baseIndex: h = 1,
2687
+ comparisonMode: T = "split",
2607
2688
  schema: N,
2608
- patches: v,
2609
- labels: h
2610
- } = e, m = n ? p : !1, f = !n || n === "", E = "json", [S, g] = _e(!1), [b, j] = _e(!0), [T, F] = _e([]), [M, x] = _e(null), [V, A] = _e([]), [w, R] = _e([]), [X, ne] = _e(!1), ae = le(""), me = Ee((k, O, I, B) => {
2611
- const P = document.createElement("div");
2612
- P.className = "native-checkbox-container";
2689
+ patches: m,
2690
+ labels: g,
2691
+ sortKeys: O = !1
2692
+ } = e, u = n ? d : !1, A = !n || n === "", S = "json", [p, v] = _e(!1), [R, P] = _e(!0), [x, M] = _e([]), [B, F] = _e(null), [L, I] = _e([]), [D, K] = _e([]), [ie, ae] = _e(!1), [ge, Pe] = _e(/* @__PURE__ */ new Set()), Ae = se(""), $e = Ne((_, b, E, w) => {
2693
+ const k = document.createElement("div");
2694
+ k.className = "native-checkbox-container";
2613
2695
  const U = document.createElement("input");
2614
- return U.type = "checkbox", U.className = "native-checkbox", U.checked = k === te.first || k === te.second, U.setAttribute("aria-label", U.checked ? "Undo accept" : "Accept change"), U.addEventListener("click", (Q) => {
2615
- Q.preventDefault(), Q.stopPropagation(), requestAnimationFrame(() => {
2616
- B();
2696
+ return U.type = "checkbox", U.className = "native-checkbox", U.checked = _ === oe.first || _ === oe.second, U.setAttribute("aria-label", U.checked ? "Undo accept" : "Accept change"), U.addEventListener("click", (X) => {
2697
+ X.preventDefault(), X.stopPropagation(), requestAnimationFrame(() => {
2698
+ w();
2617
2699
  });
2618
- }), P.appendChild(U), P;
2619
- }, []), [je, Te] = _e(0), C = le(null), re = le(null), K = le(null), $ = le(null), fe = le(null), Ie = le(null), De = le(!1), gt = le(!1), $e = le(null), Ye = le(null), ke = le(null), Be = le(/* @__PURE__ */ new Map()), Le = le(null), Fe = le(null), Ue = le(null), Ve = le(null);
2700
+ }), k.appendChild(U), k;
2701
+ }, []), [Ee, Be] = _e(0), Z = se(null), pe = se(null), ee = se(null), G = se(null), be = se(null), et = se(null), Fe = se(!1), Et = se(!1), Ge = se(null), tt = se(null), Re = se(null), We = se(/* @__PURE__ */ new Map()), Te = se(null), je = se(/* @__PURE__ */ new Map()), qe = se(null), Ye = se(null), ze = se(null);
2620
2702
  Se(() => {
2621
- let k = !0;
2622
- const O = ur.init();
2623
- return O.then((I) => {
2624
- k && (fe.current = I, j(!1), g(!0));
2625
- }).catch((I) => {
2626
- k && (I == null ? void 0 : I.type) !== "cancelation" && console.error("Monaco initialization: error:", I);
2703
+ let _ = !0;
2704
+ const b = wr.init();
2705
+ return b.then((E) => {
2706
+ _ && (be.current = E, P(!1), v(!0));
2707
+ }).catch((E) => {
2708
+ _ && (E == null ? void 0 : E.type) !== "cancelation" && console.error("Monaco initialization: error:", E);
2627
2709
  }), () => {
2628
- k = !1, De.current || O.cancel();
2710
+ _ = !1, Fe.current || b.cancel();
2629
2711
  };
2630
2712
  }, []);
2631
- const xt = Ee(
2632
- (k, O, I) => {
2633
- if (!fe.current) return [];
2634
- const B = (k == null ? void 0 : k.getValue()) || "", P = O.getValue(), U = I.getValue();
2713
+ const Yt = Ne(
2714
+ (_, b, E) => {
2715
+ if (!be.current) return [];
2716
+ const w = (_ == null ? void 0 : _.getValue()) || "", k = b.getValue(), U = E.getValue();
2635
2717
  try {
2636
- const Q = performance.now(), Y = Jr(B, P, U, {
2637
- comparisonMode: L,
2718
+ const X = performance.now(), Y = eo(w, k, U, {
2719
+ comparisonMode: T,
2638
2720
  schema: N,
2639
- patches: v
2640
- }), _ = performance.now() - Q;
2641
- return _ > 100 && console.warn(`JSON Patch diff took ${_.toFixed(2)}ms`), Y;
2642
- } catch (Q) {
2643
- const Y = Q instanceof Error ? Q.message : String(Q);
2721
+ patches: m
2722
+ }), j = performance.now() - X;
2723
+ return j > 100 && console.warn(`JSON Patch diff took ${j.toFixed(2)}ms`), Y;
2724
+ } catch (X) {
2725
+ const Y = X instanceof Error ? X.message : String(X);
2644
2726
  return console.error("JSON Patch diff error:", Y), [];
2645
2727
  }
2646
2728
  },
2647
- [L, N, v]
2648
- ), ze = Ee((k) => {
2729
+ [T, N, m]
2730
+ ), nt = Ne((_) => {
2649
2731
  try {
2650
- return k.getLayoutInfo().decorationsLeft || 0;
2732
+ return _.getLayoutInfo().decorationsLeft || 0;
2651
2733
  } catch {
2652
2734
  return 0;
2653
2735
  }
2654
- }, []), Xe = Ee((k) => {
2736
+ }, []), rt = Ne((_) => {
2655
2737
  try {
2656
- return k.getLayoutInfo().decorationsWidth || 0;
2738
+ return _.getLayoutInfo().decorationsWidth || 0;
2657
2739
  } catch {
2658
2740
  return 0;
2659
2741
  }
2660
- }, []), nt = Ee(
2661
- (k) => {
2662
- if (!m || !$.current || !ke.current)
2742
+ }, []), ft = Ne(
2743
+ (_) => {
2744
+ if (!u || !G.current || !Re.current)
2663
2745
  return;
2664
- const O = fe.current;
2665
- if (!O) return;
2666
- const I = o === "vs-dark" || typeof o == "string" && o.includes("dark"), B = ze($.current), P = Xe($.current);
2667
- ke.current.style.left = `${B}px`, ke.current.style.width = `${P}px`;
2668
- const U = $.current.getScrollTop();
2669
- if ($.current.getModel()) {
2670
- ke.current.innerHTML = "";
2671
- for (const Y of k) {
2672
- const _ = Y.startLine, ue = Y.endLine, Z = $.current.getTopForLineNumber(_) - U, H = $.current.getTopForLineNumber(ue) - U, J = $.current.getOption(O.editor.EditorOption.lineHeight), oe = ue > _ ? H - Z + J : J, G = document.createElement("div");
2673
- G.className = `conflict-issue-marker conflict-issue-${Y.type}`, G.setAttribute("data-conflict-id", Y.conflictId), G.setAttribute("data-issue-type", Y.type), G.title = Y.message, G.style.position = "absolute", G.style.top = `${Math.max(0, Z)}px`, G.style.height = `${oe}px`, G.style.width = "26px", G.style.display = "flex", G.style.alignItems = "center", G.style.justifyContent = "center", G.style.cursor = "help", G.style.pointerEvents = "auto";
2674
- const ie = document.createElement("div");
2675
- ie.className = "issue-icon", Y.type === "error" ? (ie.textContent = "✗", ie.style.color = I ? "#ff6666" : "#cc0000") : Y.type === "warning" ? (ie.textContent = Nt, ie.style.color = I ? "#ffaa00" : "#ff8800") : Y.type === "smart-merge" && (ie.textContent = "↕", ie.style.color = I ? "#0096ff" : "#0078d4"), ie.style.fontSize = "14px", ie.style.fontWeight = "bold", G.appendChild(ie), ke.current.appendChild(G);
2746
+ const b = be.current;
2747
+ if (!b) return;
2748
+ const E = o === "vs-dark" || typeof o == "string" && o.includes("dark"), w = nt(G.current), k = rt(G.current);
2749
+ Re.current.style.left = `${w}px`, Re.current.style.width = `${k}px`;
2750
+ const U = G.current.getScrollTop();
2751
+ if (G.current.getModel()) {
2752
+ Re.current.innerHTML = "";
2753
+ for (const Y of _) {
2754
+ const j = Y.startLine, ue = Y.endLine, ne = G.current.getTopForLineNumber(j) - U, W = G.current.getTopForLineNumber(ue) - U, V = G.current.getOption(b.editor.EditorOption.lineHeight), le = ue > j ? W - ne + V : V, H = document.createElement("div");
2755
+ H.className = `conflict-issue-marker conflict-issue-${Y.type}`, H.setAttribute("data-conflict-id", Y.conflictId), H.setAttribute("data-issue-type", Y.type), H.title = Y.message, H.style.position = "absolute", H.style.top = `${Math.max(0, ne)}px`, H.style.height = `${le}px`, H.style.width = "26px", H.style.display = "flex", H.style.alignItems = "center", H.style.justifyContent = "center", H.style.cursor = "help", H.style.pointerEvents = "auto";
2756
+ const te = document.createElement("div");
2757
+ te.className = "issue-icon", Y.type === "error" ? (te.textContent = "✗", te.style.color = E ? "#ff6666" : "#cc0000") : Y.type === "warning" ? (te.textContent = Dt, te.style.color = E ? "#ffaa00" : "#ff8800") : Y.type === "smart-merge" && (te.textContent = "↕", te.style.color = E ? "#0096ff" : "#0078d4"), te.style.fontSize = "14px", te.style.fontWeight = "bold", H.appendChild(te), Re.current.appendChild(H);
2676
2758
  }
2677
2759
  }
2678
2760
  },
2679
- [m, o, ze, Xe]
2680
- ), rt = Ee(
2681
- (k) => {
2682
- var se, oe, G, ie;
2683
- if (!$.current || X)
2761
+ [u, o, nt, rt]
2762
+ ), pt = Ne(
2763
+ (_) => {
2764
+ var re, le, H, te;
2765
+ if (!G.current || ie)
2684
2766
  return;
2685
- const O = $.current.getModel(), I = (se = C.current) == null ? void 0 : se.getModel(), B = (oe = K.current) == null ? void 0 : oe.getModel(), P = (G = re.current) == null ? void 0 : G.getModel();
2686
- if (!O || !I || !B || !P)
2767
+ const b = G.current.getModel(), E = (re = Z.current) == null ? void 0 : re.getModel(), w = (le = ee.current) == null ? void 0 : le.getModel(), k = (H = pe.current) == null ? void 0 : H.getModel();
2768
+ if (!b || !E || !w || !k)
2687
2769
  return;
2688
- const U = P.getLinesContent(), Q = I.getLinesContent(), Y = B.getLinesContent(), _ = qr(U, Q, Y, k, N);
2689
- if (x(_.isValid ? null : _.validationError || "Invalid JSON"), A(_.warnings || []), R(_.conflictIssues || []), Le.current) {
2690
- const z = (h == null ? void 0 : h.result) || "Result";
2691
- _.isValid ? _.warnings && _.warnings.length > 0 ? (Le.current.textContent = `${z} ${Nt}`, Le.current.title = _.warnings.join(`
2692
- `)) : (Le.current.textContent = z, Le.current.style.color = "", Le.current.title = "") : (Le.current.textContent = `${z} ${Nt} Invalid JSON`, Le.current.style.color = "#ff4444", Le.current.title = _.validationError || "Invalid JSON - please fix manually");
2693
- }
2694
- if (O.getValue() !== _.content) {
2695
- const z = $.current.getPosition(), q = $.current.getSelection();
2696
- if (gt.current = !0, O.setValue(_.content), gt.current = !1, z) {
2697
- const he = O.getLineCount(), ee = O.getLineLength(he), ve = {
2698
- lineNumber: Math.min(z.lineNumber, he),
2699
- column: z.lineNumber <= he ? Math.min(z.column, O.getLineLength(z.lineNumber) + 1) : ee + 1
2770
+ const U = k.getLinesContent(), X = E.getLinesContent(), Y = w.getLinesContent(), j = oo(U, X, Y, _, N);
2771
+ if (F(j.isValid ? null : j.validationError || "Invalid JSON"), I(j.warnings || []), K(j.conflictIssues || []), Te.current) {
2772
+ const z = (g == null ? void 0 : g.result) || "Result";
2773
+ j.isValid ? j.warnings && j.warnings.length > 0 ? (Te.current.textContent = `${z} ${Dt}`, Te.current.title = j.warnings.join(`
2774
+ `)) : (Te.current.textContent = z, Te.current.style.color = "", Te.current.title = "") : (Te.current.textContent = `${z} ${Dt} Invalid JSON`, Te.current.style.color = "#ff4444", Te.current.title = j.validationError || "Invalid JSON - please fix manually");
2775
+ }
2776
+ if (b.getValue() !== j.content) {
2777
+ const z = G.current.getPosition(), q = G.current.getSelection();
2778
+ if (Et.current = !0, b.setValue(j.content), Et.current = !1, z) {
2779
+ const de = b.getLineCount(), me = b.getLineLength(de), C = {
2780
+ lineNumber: Math.min(z.lineNumber, de),
2781
+ column: z.lineNumber <= de ? Math.min(z.column, b.getLineLength(z.lineNumber) + 1) : me + 1
2700
2782
  };
2701
- $.current.setPosition(ve), q && !q.isEmpty() && $.current.setSelection(q);
2783
+ G.current.setPosition(C), q && !q.isEmpty() && G.current.setSelection(q);
2702
2784
  }
2703
2785
  }
2704
- const Z = fe.current, H = O;
2705
- let J = H._invalidDecorations;
2706
- if (!_.isValid && $.current && Z ? (J || (J = $.current.createDecorationsCollection([]), H._invalidDecorations = J), J.set([
2786
+ const ne = be.current, W = b;
2787
+ let V = W._invalidDecorations;
2788
+ if (!j.isValid && G.current && ne ? (V || (V = G.current.createDecorationsCollection([]), W._invalidDecorations = V), V.set([
2707
2789
  {
2708
- range: new Z.Range(1, 1, O.getLineCount(), Number.MAX_SAFE_INTEGER),
2790
+ range: new ne.Range(1, 1, b.getLineCount(), Number.MAX_SAFE_INTEGER),
2709
2791
  options: {
2710
2792
  isWholeLine: !1,
2711
2793
  className: "merge-result-invalid",
2712
- hoverMessage: { value: _.validationError || "Invalid JSON - please fix manually" }
2794
+ hoverMessage: { value: j.validationError || "Invalid JSON - please fix manually" }
2713
2795
  }
2714
2796
  }
2715
- ])) : _.isValid && J && $.current && J.set([]), _.conflictIssues && _.conflictIssues.length > 0) {
2716
- if (nt(_.conflictIssues), $.current && Z) {
2717
- const z = O;
2797
+ ])) : j.isValid && V && G.current && V.set([]), j.conflictIssues && j.conflictIssues.length > 0) {
2798
+ if (ft(j.conflictIssues), G.current && ne) {
2799
+ const z = b;
2718
2800
  if (!z._conflictIssueDecorations) {
2719
- const ee = $.current.createDecorationsCollection(
2801
+ const me = G.current.createDecorationsCollection(
2720
2802
  []
2721
2803
  );
2722
- z._conflictIssueDecorations = ee;
2804
+ z._conflictIssueDecorations = me;
2723
2805
  }
2724
- const q = z._conflictIssueDecorations, he = _.conflictIssues.map((ee) => {
2725
- let ve, Ae;
2726
- return ee.type === "error" ? (ve = o === "vs-dark" ? "rgba(255, 0, 0, 0.1)" : "rgba(255, 0, 0, 0.05)", Ae = o === "vs-dark" ? "#ff6666" : "#cc0000") : ee.type === "warning" ? (ve = o === "vs-dark" ? "rgba(255, 170, 0, 0.1)" : "rgba(255, 136, 0, 0.05)", Ae = o === "vs-dark" ? "#ffaa00" : "#ff8800") : (ve = o === "vs-dark" ? "rgba(0, 150, 255, 0.1)" : "rgba(0, 120, 212, 0.05)", Ae = o === "vs-dark" ? "#0096ff" : "#0078d4"), {
2727
- range: new Z.Range(ee.startLine, 1, ee.endLine, Number.MAX_SAFE_INTEGER),
2806
+ const q = z._conflictIssueDecorations, de = j.conflictIssues.map((me) => {
2807
+ let C, ye;
2808
+ return me.type === "error" ? (C = o === "vs-dark" ? "rgba(255, 0, 0, 0.1)" : "rgba(255, 0, 0, 0.05)", ye = o === "vs-dark" ? "#ff6666" : "#cc0000") : me.type === "warning" ? (C = o === "vs-dark" ? "rgba(255, 170, 0, 0.1)" : "rgba(255, 136, 0, 0.05)", ye = o === "vs-dark" ? "#ffaa00" : "#ff8800") : (C = o === "vs-dark" ? "rgba(0, 150, 255, 0.1)" : "rgba(0, 120, 212, 0.05)", ye = o === "vs-dark" ? "#0096ff" : "#0078d4"), {
2809
+ range: new ne.Range(me.startLine, 1, me.endLine, Number.MAX_SAFE_INTEGER),
2728
2810
  options: {
2729
2811
  isWholeLine: !0,
2730
- className: `conflict-issue-line conflict-issue-${ee.type}`,
2731
- linesDecorationsClassName: `conflict-issue-line-decoration conflict-issue-${ee.type}`,
2732
- backgroundColor: ve,
2812
+ className: `conflict-issue-line conflict-issue-${me.type}`,
2813
+ linesDecorationsClassName: `conflict-issue-line-decoration conflict-issue-${me.type}`,
2814
+ backgroundColor: C,
2733
2815
  overviewRuler: {
2734
- color: Ae,
2735
- position: Z.editor.OverviewRulerLane.Right
2816
+ color: ye,
2817
+ position: ne.editor.OverviewRulerLane.Right
2736
2818
  },
2737
2819
  minimap: {
2738
- color: Ae,
2739
- position: Z.editor.MinimapPosition.Inline
2820
+ color: ye,
2821
+ position: ne.editor.MinimapPosition.Inline
2740
2822
  }
2741
2823
  }
2742
2824
  };
2743
2825
  });
2744
- q.set(he);
2826
+ q.set(de);
2745
2827
  }
2746
- } else if ($.current) {
2747
- const z = O;
2748
- z._conflictIssueDecorations && z._conflictIssueDecorations.set([]), ke.current && m && (ke.current.innerHTML = "");
2828
+ } else if (G.current) {
2829
+ const z = b;
2830
+ z._conflictIssueDecorations && z._conflictIssueDecorations.set([]), Re.current && u && (Re.current.innerHTML = "");
2749
2831
  }
2750
2832
  if (y) {
2751
- const z = `${_.content}|${_.isValid}|${(ie = _.warnings) == null ? void 0 : ie.join(",")}`;
2752
- ae.current !== z && (ae.current = z, queueMicrotask(() => {
2753
- y(_.content, {
2754
- isValid: _.isValid,
2755
- validationError: _.validationError,
2756
- warnings: _.warnings,
2757
- conflictIssues: _.conflictIssues
2833
+ const z = `${j.content}|${j.isValid}|${(te = j.warnings) == null ? void 0 : te.join(",")}`;
2834
+ Ae.current !== z && (Ae.current = z, queueMicrotask(() => {
2835
+ y(j.content, {
2836
+ isValid: j.isValid,
2837
+ validationError: j.validationError,
2838
+ warnings: j.warnings,
2839
+ conflictIssues: j.conflictIssues
2758
2840
  });
2759
2841
  }));
2760
2842
  }
2761
2843
  },
2762
- [y, N, h, o, nt, m, X]
2763
- ), mt = Ee(
2764
- (k, O) => {
2765
- ne(!1), F((I) => {
2766
- const B = I.map((P) => {
2767
- if (P.id !== k) return P;
2768
- const Q = (O === 1 ? P.input1State : P.input2State) === te.excluded ? te.first : te.excluded;
2769
- return O === 1 ? { ...P, input1State: Q } : { ...P, input2State: Q };
2844
+ [y, N, g, o, ft, u, ie]
2845
+ ), Tt = Ne(
2846
+ (_, b) => {
2847
+ ae(!1), M((E) => {
2848
+ const w = E.map((k) => {
2849
+ if (k.id !== _) return k;
2850
+ const X = (b === 1 ? k.input1State : k.input2State) === oe.excluded ? oe.first : oe.excluded;
2851
+ return b === 1 ? { ...k, input1State: X } : { ...k, input2State: X };
2770
2852
  });
2771
- return m && $.current && rt(B), B;
2853
+ return u && G.current && pt(w), w;
2772
2854
  });
2773
2855
  },
2774
- [m, rt]
2775
- ), yt = Ee(
2776
- (k, O, I, B, P, U, Q) => {
2777
- if (!fe.current) return;
2778
- const _ = B === 1 ? C.current : K.current;
2779
- if (!_) return;
2780
- const ue = B === 1 ? I.input1Range : I.input2Range, Z = B === 1 ? I.input1State : I.input2State, H = _.getModel();
2781
- if (!H) return;
2782
- const J = H.getLineCount(), se = Math.max(1, Math.min(ue.startLineNumber, J)), oe = Math.max(1, Math.min(ue.endLineNumberExclusive - 1, J));
2783
- if (se > J || oe < 1 || se > oe)
2856
+ [u, pt]
2857
+ ), It = Ne(
2858
+ (_, b, E, w, k, U, X) => {
2859
+ if (!be.current) return;
2860
+ const j = w === 1 ? Z.current : ee.current;
2861
+ if (!j) return;
2862
+ const ue = w === 1 ? E.input1Range : E.input2Range, ne = w === 1 ? E.input1State : E.input2State, W = j.getModel();
2863
+ if (!W) return;
2864
+ const V = W.getLineCount(), re = Math.max(1, Math.min(ue.startLineNumber, V)), le = Math.max(1, Math.min(ue.endLineNumberExclusive - 1, V));
2865
+ if (re > V || le < 1 || re > le)
2784
2866
  return;
2785
- const G = _.getTopForLineNumber(se) - P, z = _.getBottomForLineNumber(oe) - P - G;
2786
- let q = Be.current.get(O);
2867
+ const H = j.getTopForLineNumber(re) - k, z = j.getBottomForLineNumber(le) - k - H;
2868
+ let q = We.current.get(b);
2787
2869
  if (!q) {
2788
2870
  q = document.createElement("div"), q.className = "merge-accept-gutter-marker";
2789
- const ge = document.createElement("div");
2790
- ge.className = "background", q.appendChild(ge);
2791
- const pe = document.createElement("div");
2792
- pe.className = "checkbox";
2793
- const ye = document.createElement("div");
2794
- ye.className = "checkbox-background";
2795
- const Ne = me(Z, B, I.id, () => mt(I.id, B));
2796
- ye.appendChild(Ne), pe.appendChild(ye), q.appendChild(pe), k.appendChild(q), Be.current.set(O, q);
2797
- }
2798
- q.style.top = `${G}px`, q.style.height = `${z}px`;
2799
- const he = q.querySelector(".checkbox-background");
2800
- if (he) {
2801
- he.innerHTML = "";
2802
- const ge = me(Z, B, I.id, () => mt(I.id, B));
2803
- he.appendChild(ge);
2804
- }
2805
- const ee = I.handled, ve = I.focused, Ae = z > 30;
2806
- q.className = "merge-accept-gutter-marker", ee && q.classList.add("handled"), ve && q.classList.add("focused"), Ae ? q.classList.add("multi-line") : q.classList.add("single-line");
2807
- const Oe = q.querySelector(".checkbox");
2808
- if (Oe) {
2809
- const pe = z / 2 - 12, ye = 24;
2810
- let Ne = pe;
2811
- const vn = ye, bn = U - ye - 24, Ht = ye, Gt = z - 24 - ye;
2812
- Ht < Gt && (Ne = Math.max(vn, Math.min(Ne + G, bn)) - G, Ne = Math.max(Ht, Math.min(Ne, Gt))), Oe.style.top = `${Ne + 5}px`;
2871
+ const Ie = document.createElement("div");
2872
+ Ie.className = "background", q.appendChild(Ie);
2873
+ const fe = document.createElement("div");
2874
+ fe.className = "checkbox";
2875
+ const Q = document.createElement("div");
2876
+ Q.className = "checkbox-background";
2877
+ const ve = $e(ne, w, E.id, () => Tt(E.id, w));
2878
+ Q.appendChild(ve), fe.appendChild(Q), q.appendChild(fe), _.appendChild(q), We.current.set(b, q);
2879
+ }
2880
+ q.style.top = `${H}px`, q.style.height = `${z}px`;
2881
+ const de = q.querySelector(".checkbox-background");
2882
+ if (de) {
2883
+ de.innerHTML = "";
2884
+ const Ie = $e(ne, w, E.id, () => Tt(E.id, w));
2885
+ de.appendChild(Ie);
2886
+ }
2887
+ const me = E.handled, C = E.focused, ye = z > 30;
2888
+ q.className = "merge-accept-gutter-marker", me && q.classList.add("handled"), C && q.classList.add("focused"), ye ? q.classList.add("multi-line") : q.classList.add("single-line");
2889
+ const Ue = q.querySelector(".checkbox");
2890
+ if (Ue) {
2891
+ const fe = z / 2 - 12, Q = 24;
2892
+ let ve = fe;
2893
+ const De = Q, Le = U - Q - 24, ke = Q, Ve = z - 24 - Q;
2894
+ ke < Ve && (ve = Math.max(De, Math.min(ve + H, Le)) - H, ve = Math.max(ke, Math.min(ve, Ve))), Ue.style.top = `${ve + 5}px`;
2813
2895
  }
2814
2896
  },
2815
- [mt, me]
2816
- ), ot = Ee(() => {
2817
- if (!m) {
2818
- const H = Be.current;
2819
- for (const [J, se] of H.entries())
2820
- se.remove(), H.delete(J);
2897
+ [Tt, $e]
2898
+ ), dt = Ne(() => {
2899
+ if (!u) {
2900
+ const W = We.current;
2901
+ for (const [V, re] of W.entries())
2902
+ re.remove(), W.delete(V);
2821
2903
  return;
2822
2904
  }
2823
- if (!C.current || !K.current || !$e.current || !Ye.current || !fe.current)
2905
+ if (!Z.current || !ee.current || !Ge.current || !tt.current || !be.current)
2824
2906
  return;
2825
- const O = o === "vs-dark" || typeof o == "string" && o.includes("dark"), I = ze(C.current), B = Xe(C.current), P = ze(K.current), U = Xe(K.current);
2826
- $e.current.style.left = `${I}px`, $e.current.style.width = `${B}px`, Ye.current.style.left = `${P}px`, Ye.current.style.width = `${U}px`;
2827
- const Q = C.current.getVisibleRanges();
2828
- if (!Q || Q.length === 0) return;
2829
- const Y = C.current.getScrollTop(), _ = $e.current.clientHeight, ue = /* @__PURE__ */ new Set();
2830
- for (const H of T)
2831
- if (!(H.input1Diffs.length === 0 && H.input2Diffs.length === 0)) {
2832
- if (H.input1Diffs.length > 0) {
2833
- const J = `${H.id}-input1`;
2834
- ue.add(J), yt($e.current, J, H, 1, Y, _, O);
2907
+ const b = o === "vs-dark" || typeof o == "string" && o.includes("dark"), E = nt(Z.current), w = rt(Z.current), k = nt(ee.current), U = rt(ee.current);
2908
+ Ge.current.style.left = `${E}px`, Ge.current.style.width = `${w}px`, tt.current.style.left = `${k}px`, tt.current.style.width = `${U}px`;
2909
+ const X = Z.current.getVisibleRanges();
2910
+ if (!X || X.length === 0) return;
2911
+ const Y = Z.current.getScrollTop(), j = Ge.current.clientHeight, ue = /* @__PURE__ */ new Set();
2912
+ for (const W of x)
2913
+ if (!(W.input1Diffs.length === 0 && W.input2Diffs.length === 0)) {
2914
+ if (W.input1Diffs.length > 0) {
2915
+ const V = `${W.id}-input1`;
2916
+ ue.add(V), It(Ge.current, V, W, 1, Y, j, b);
2835
2917
  }
2836
- if (H.input2Diffs.length > 0) {
2837
- const J = `${H.id}-input2`;
2838
- ue.add(J), yt(Ye.current, J, H, 2, Y, _, O);
2918
+ if (W.input2Diffs.length > 0) {
2919
+ const V = `${W.id}-input2`;
2920
+ ue.add(V), It(tt.current, V, W, 2, Y, j, b);
2839
2921
  }
2840
2922
  }
2841
- const Z = Be.current;
2842
- for (const [H, J] of Z.entries())
2843
- ue.has(H) || (J.remove(), Z.delete(H));
2844
- }, [T, o, m, ze, Xe, yt]), be = Ee((k, O) => {
2845
- var I, B, P;
2923
+ const ne = We.current;
2924
+ for (const [W, V] of ne.entries())
2925
+ ue.has(W) || (V.remove(), ne.delete(W));
2926
+ }, [x, o, u, nt, rt, It]), we = Ne((_, b) => {
2927
+ var E, w, k;
2846
2928
  try {
2847
- if (fe.current) {
2848
- const U = (B = (I = fe.current.editor).getTheme) == null ? void 0 : B.call(I);
2849
- if ((P = U == null ? void 0 : U.colors) != null && P[k])
2850
- return U.colors[k];
2929
+ if (be.current) {
2930
+ const U = (w = (E = be.current.editor).getTheme) == null ? void 0 : w.call(E);
2931
+ if ((k = U == null ? void 0 : U.colors) != null && k[_])
2932
+ return U.colors[_];
2851
2933
  }
2852
2934
  } catch {
2853
2935
  }
2854
- return O;
2855
- }, []), $t = Ee(() => {
2856
- if (!fe.current || !C.current || !K.current)
2936
+ return b;
2937
+ }, []), zt = Ne(() => {
2938
+ if (!be.current || !Z.current || !ee.current)
2857
2939
  return;
2858
- const k = fe.current, O = o === "vs-dark" || typeof o == "string" && o.includes("dark"), I = be("mergeEditor.change.background", O ? "rgba(255, 166, 0, 0.2)" : "rgba(255, 166, 0, 0.15)"), B = be(
2940
+ const _ = be.current, b = o === "vs-dark" || typeof o == "string" && o.includes("dark"), E = we("mergeEditor.change.background", b ? "rgba(255, 166, 0, 0.2)" : "rgba(255, 166, 0, 0.15)"), w = we(
2859
2941
  "diffEditor.insertedTextBackground",
2860
- O ? "rgba(155, 185, 85, 0.2)" : "rgba(155, 185, 85, 0.15)"
2861
- ), P = be(
2942
+ b ? "rgba(155, 185, 85, 0.2)" : "rgba(155, 185, 85, 0.15)"
2943
+ ), k = we(
2862
2944
  "mergeEditor.changeBase.background",
2863
- O ? "rgba(255, 100, 100, 0.2)" : "rgba(255, 100, 100, 0.15)"
2864
- ), U = be(
2945
+ b ? "rgba(255, 100, 100, 0.2)" : "rgba(255, 100, 100, 0.15)"
2946
+ ), U = we(
2865
2947
  "editorOverviewRuler.modifiedForeground",
2866
- O ? "rgba(255, 166, 0, 0.8)" : "rgba(255, 166, 0, 1)"
2867
- ), Q = be(
2948
+ b ? "rgba(255, 166, 0, 0.8)" : "rgba(255, 166, 0, 1)"
2949
+ ), X = we(
2868
2950
  "editorOverviewRuler.addedForeground",
2869
- O ? "rgba(155, 185, 85, 0.8)" : "rgba(155, 185, 85, 1)"
2870
- ), Y = be(
2951
+ b ? "rgba(155, 185, 85, 0.8)" : "rgba(155, 185, 85, 1)"
2952
+ ), Y = we(
2871
2953
  "editorOverviewRuler.deletedForeground",
2872
- O ? "rgba(255, 100, 100, 0.8)" : "rgba(255, 100, 100, 1)"
2873
- ), _ = f, ue = {
2954
+ b ? "rgba(255, 100, 100, 0.8)" : "rgba(255, 100, 100, 1)"
2955
+ ), j = A, ue = {
2874
2956
  conflictOverviewColor: U,
2875
- changeOverviewColor: Q,
2957
+ changeOverviewColor: X,
2876
2958
  baseOverviewColor: Y
2877
- }, { input1Decorations: Z, input2Decorations: H, baseDecorations: J } = Cr(
2878
- T,
2879
- _,
2959
+ }, { input1Decorations: ne, input2Decorations: W, baseDecorations: V } = uo(
2960
+ x,
2961
+ j,
2880
2962
  ue,
2881
- k
2882
- ), se = be("input.background", O ? "#3c3c3c" : "#f3f3f3"), oe = be("input.border", O ? "#6b6b6b" : "#c8c8c8"), G = be("focusBorder", O ? "#007acc" : "#0078d4"), ie = be("inputOption.activeForeground", O ? "#3794ff" : "#0078d4"), z = "monaco-three-way-diff-dynamic";
2963
+ _
2964
+ ), re = we("input.background", b ? "#3c3c3c" : "#f3f3f3"), le = we("input.border", b ? "#6b6b6b" : "#c8c8c8"), H = we("focusBorder", b ? "#007acc" : "#0078d4"), te = we("inputOption.activeForeground", b ? "#3794ff" : "#0078d4"), z = "monaco-three-way-diff-dynamic";
2883
2965
  let q = document.getElementById(z);
2884
2966
  q || (q = document.createElement("style"), q.id = z, document.head.appendChild(q));
2885
- const he = be(
2967
+ const de = we(
2886
2968
  "diffEditor.insertedTextBackground",
2887
- O ? "rgba(100, 100, 255, 0.15)" : "rgba(100, 100, 255, 0.1)"
2888
- ), ee = be(
2969
+ b ? "rgba(100, 100, 255, 0.15)" : "rgba(100, 100, 255, 0.1)"
2970
+ ), me = we(
2889
2971
  "diffEditor.insertedTextBackground",
2890
- O ? "rgba(155, 185, 85, 0.2)" : "rgba(155, 185, 85, 0.15)"
2972
+ b ? "rgba(155, 185, 85, 0.2)" : "rgba(155, 185, 85, 0.15)"
2891
2973
  );
2892
2974
  q.textContent = `
2893
2975
  /* True conflict - both sides changed differently (orange/amber) */
2894
2976
  .monaco-editor .merge-conflict-incoming,
2895
2977
  .monaco-editor .merge-conflict-current {
2896
- background-color: ${I};
2978
+ background-color: ${E};
2897
2979
  }
2898
2980
 
2899
2981
  /* 2-way diff mode: red for deletions (input1 column) - must override merge-change-incoming */
2900
2982
  .monaco-editor .merge-2way-deletion,
2901
2983
  .monaco-editor .monaco-editor .merge-2way-deletion {
2902
- background-color: ${P} !important;
2984
+ background-color: ${k} !important;
2903
2985
  }
2904
2986
 
2905
2987
  /* Single-side change (green for input2/ours, orange for input1/theirs in 3-way) */
2906
2988
  .monaco-editor .merge-change-incoming {
2907
- background-color: ${ee};
2989
+ background-color: ${me};
2908
2990
  }
2909
2991
  .monaco-editor .merge-change-current {
2910
- background-color: ${B};
2992
+ background-color: ${w};
2911
2993
  }
2912
2994
 
2913
2995
  /* Same change on both sides (blue/purple) */
2914
2996
  .monaco-editor .merge-same-change {
2915
- background-color: ${he};
2997
+ background-color: ${de};
2916
2998
  }
2917
2999
 
2918
3000
  /* Base changes */
2919
3001
  .monaco-editor .merge-conflict-base,
2920
3002
  .monaco-editor .merge-change-base {
2921
- background-color: ${P};
3003
+ background-color: ${k};
2922
3004
  }
2923
3005
 
2924
3006
  /* Invalid JSON in result column */
2925
3007
  .monaco-editor .merge-result-invalid {
2926
- background-color: ${O ? "rgba(255, 0, 0, 0.2)" : "rgba(255, 0, 0, 0.1)"};
2927
- outline: 1px solid ${O ? "rgba(255, 100, 100, 0.5)" : "rgba(255, 0, 0, 0.3)"};
3008
+ background-color: ${b ? "rgba(255, 0, 0, 0.2)" : "rgba(255, 0, 0, 0.1)"};
3009
+ outline: 1px solid ${b ? "rgba(255, 100, 100, 0.5)" : "rgba(255, 0, 0, 0.3)"};
2928
3010
  }
2929
3011
 
2930
3012
  /* Diff symbols (+ and -) in line decorations - positioned in code area */
@@ -2956,7 +3038,7 @@ function ro(e) {
2956
3038
  pointer-events: none;
2957
3039
  font-family: "Courier New", monospace;
2958
3040
  width: 20px;
2959
- color: ${O ? "#9BB955" : "#6A9955"};
3041
+ color: ${b ? "#9BB955" : "#6A9955"};
2960
3042
  }
2961
3043
 
2962
3044
  .monaco-editor .diff-symbol.diff-symbol-minus::before {
@@ -2975,7 +3057,7 @@ function ro(e) {
2975
3057
  pointer-events: none;
2976
3058
  font-family: "Courier New", monospace;
2977
3059
  width: 20px;
2978
- color: ${O ? "#FF6464" : "#CC0000"};
3060
+ color: ${b ? "#FF6464" : "#CC0000"};
2979
3061
  }
2980
3062
 
2981
3063
  /* VSCode-style checkbox gutter - positioned at Monaco's glyph margin */
@@ -3018,12 +3100,12 @@ function ro(e) {
3018
3100
  width: 14px;
3019
3101
  height: 14px;
3020
3102
  border-radius: 3px;
3021
- background-color: ${se};
3022
- border: 1px solid ${oe};
3103
+ background-color: ${re};
3104
+ border: 1px solid ${le};
3023
3105
  }
3024
3106
 
3025
3107
  .merge-accept-gutter-marker.focused .checkbox-background {
3026
- border-color: ${G};
3108
+ border-color: ${H};
3027
3109
  border-width: 2px;
3028
3110
  }
3029
3111
 
@@ -3046,7 +3128,7 @@ function ro(e) {
3046
3128
  height: 16px;
3047
3129
  cursor: pointer;
3048
3130
  margin: 0;
3049
- accent-color: ${ie};
3131
+ accent-color: ${te};
3050
3132
  }
3051
3133
 
3052
3134
  /* Result column status indicator */
@@ -3071,172 +3153,228 @@ function ro(e) {
3071
3153
  }
3072
3154
 
3073
3155
  .native-checkbox:focus {
3074
- outline: 2px solid ${G};
3156
+ outline: 2px solid ${H};
3075
3157
  outline-offset: 2px;
3076
3158
  }
3077
- `, Fe.current || (Fe.current = C.current.createDecorationsCollection([])), Fe.current.set(Z), Ue.current || (Ue.current = K.current.createDecorationsCollection([])), Ue.current.set(H), re.current && (Ve.current || (Ve.current = re.current.createDecorationsCollection([])), Ve.current.set(J));
3078
- }, [T, o, f, be]), Bt = Ee(() => {
3079
- if (!De.current && Ie.current && fe.current && !b) {
3080
- const k = fe.current;
3081
- Ie.current.innerHTML = "";
3082
- const O = document.createElement("div");
3083
- O.style.display = "flex", O.style.height = "100%", O.style.width = "100%";
3084
- const I = o === "vs-dark" || typeof o == "string" && o.includes("dark"), B = I ? "#444" : "#ddd", P = I ? "#fff" : "#333", U = (ee, ve) => {
3085
- var Ae, Oe, ge;
3159
+ `, qe.current || (qe.current = Z.current.createDecorationsCollection([])), qe.current.set(ne), Ye.current || (Ye.current = ee.current.createDecorationsCollection([])), Ye.current.set(W), pe.current && (ze.current || (ze.current = pe.current.createDecorationsCollection([])), ze.current.set(V));
3160
+ }, [x, o, A, we]), Ct = Ne(() => {
3161
+ if (!Fe.current && et.current && be.current && !R) {
3162
+ const _ = be.current, b = (C) => {
3163
+ if (!O || !C) return C;
3086
3164
  try {
3087
- const pe = (Oe = (Ae = k.editor).getTheme) == null ? void 0 : Oe.call(Ae);
3088
- if ((ge = pe == null ? void 0 : pe.colors) != null && ge[ee])
3089
- return pe.colors[ee];
3165
+ const ye = JSON.parse(C);
3166
+ return Wr(ye);
3090
3167
  } catch {
3168
+ return C;
3091
3169
  }
3092
- return ve;
3093
- }, Q = U("mergeEditor.conflict.input1.header.background", I ? "#4B1818" : "#FFE6E6"), Y = U("editorGutter.background", I ? "#333" : "#f0f0f0"), _ = U("mergeEditor.conflict.input2.header.background", I ? "#1B4B18" : "#E6FFE6"), ue = U("mergeEditor.result.header.background", I ? "#7F5F00" : "#FFECB3"), Z = (ee, ve, Ae = !1) => {
3094
- const Oe = document.createElement("div");
3095
- Oe.style.flex = "1", Oe.style.display = "flex", Oe.style.flexDirection = "column", Oe.style.borderRight = `1px solid ${B}`;
3096
- const ge = document.createElement("div");
3097
- ge.textContent = ee, ge.style.padding = "4px 8px", ge.style.fontSize = "11px", ge.style.fontWeight = "500", ge.style.backgroundColor = ve, ge.style.color = P, ge.style.borderBottom = `1px solid ${B}`, Oe.appendChild(ge);
3098
- const pe = document.createElement("div");
3099
- pe.style.flex = "1", pe.style.position = "relative", pe.style.overflow = "hidden";
3100
- const ye = document.createElement("div");
3101
- ye.style.position = "absolute", ye.style.left = "0", ye.style.right = "0", ye.style.top = "0", ye.style.bottom = "0", pe.appendChild(ye);
3102
- let Ne = null;
3103
- return Ae && (Ne = document.createElement("div"), Ne.className = "merge-editor-gutter", pe.appendChild(Ne)), Oe.appendChild(pe), { container: Oe, editorDiv: ye, gutterDiv: Ne };
3104
- }, H = Z((h == null ? void 0 : h.input1) || "Theirs", Q, m), J = Z((h == null ? void 0 : h.input2) || "Ours", _, m);
3105
- H.gutterDiv && ($e.current = H.gutterDiv), J.gutterDiv && (Ye.current = J.gutterDiv);
3106
- const se = !!n;
3107
- let oe = null;
3108
- if (se) {
3109
- oe = Z((h == null ? void 0 : h.base) || "Base", Y, !1);
3110
- const ee = [];
3111
- d === 0 ? ee.push(oe.container, H.container, J.container) : d === 1 ? ee.push(H.container, oe.container, J.container) : d === 2 && ee.push(H.container, J.container, oe.container), ee.forEach((ve) => {
3112
- O.appendChild(ve);
3170
+ };
3171
+ et.current.innerHTML = "", je.current.clear();
3172
+ const E = document.createElement("div");
3173
+ E.style.display = "flex", E.style.height = "100%", E.style.width = "100%";
3174
+ const w = o === "vs-dark" || typeof o == "string" && o.includes("dark"), k = w ? "#444" : "#ddd", U = w ? "#fff" : "#333", X = (C, ye) => {
3175
+ var Ue, Ie, fe;
3176
+ try {
3177
+ const Q = (Ie = (Ue = _.editor).getTheme) == null ? void 0 : Ie.call(Ue);
3178
+ if ((fe = Q == null ? void 0 : Q.colors) != null && fe[C])
3179
+ return Q.colors[C];
3180
+ } catch {
3181
+ }
3182
+ return ye;
3183
+ }, Y = X("mergeEditor.conflict.input1.header.background", w ? "#4B1818" : "#FFE6E6"), j = X("editorGutter.background", w ? "#333" : "#f0f0f0"), ue = X("mergeEditor.conflict.input2.header.background", w ? "#1B4B18" : "#E6FFE6"), ne = X("mergeEditor.result.header.background", w ? "#7F5F00" : "#FFECB3"), W = (C, ye, Ue, Ie = !1) => {
3184
+ const fe = document.createElement("div");
3185
+ fe.style.flex = "1", fe.style.display = "flex", fe.style.flexDirection = "column", fe.style.borderRight = `1px solid ${k}`, fe.style.overflow = "hidden", fe.style.transition = "flex 0.2s ease, min-width 0.2s ease, max-width 0.2s ease", fe.dataset.columnKey = C;
3186
+ const Q = document.createElement("div");
3187
+ Q.style.padding = "4px 8px", Q.style.fontSize = "11px", Q.style.fontWeight = "500", Q.style.backgroundColor = Ue, Q.style.color = U, Q.style.borderBottom = `1px solid ${k}`, Q.style.display = "flex", Q.style.alignItems = "center", Q.style.gap = "4px", Q.style.height = "22px", Q.style.boxSizing = "content-box", Q.style.whiteSpace = "nowrap", Q.style.overflow = "hidden";
3188
+ const ve = document.createElement("span");
3189
+ ve.textContent = ye, ve.style.flex = "1", ve.style.overflow = "hidden", ve.style.textOverflow = "ellipsis", Q.appendChild(ve);
3190
+ const De = document.createElement("div");
3191
+ De.className = "column-collapse-icon", De.title = "Collapse column", De.innerHTML = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" style="display:block"><path d="M8 2L4 6L8 10" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>', De.addEventListener("click", (kn) => {
3192
+ kn.stopPropagation(), Pe((en) => {
3193
+ const ot = new Set(en);
3194
+ if (ot.has(C))
3195
+ ot.delete(C);
3196
+ else {
3197
+ if (Array.from(je.current.keys()).filter((Sn) => !ot.has(Sn)).length <= 1) return en;
3198
+ ot.add(C);
3199
+ }
3200
+ return ot;
3201
+ });
3202
+ }), Q.appendChild(De), fe.appendChild(Q);
3203
+ const Le = document.createElement("div");
3204
+ Le.style.flex = "1", Le.style.position = "relative", Le.style.overflow = "hidden", Le.style.transition = "opacity 0.2s ease";
3205
+ const ke = document.createElement("div");
3206
+ ke.style.position = "absolute", ke.style.left = "0", ke.style.right = "0", ke.style.top = "0", ke.style.bottom = "0", Le.appendChild(ke);
3207
+ let Ve = null;
3208
+ return Ie && (Ve = document.createElement("div"), Ve.className = "merge-editor-gutter", Le.appendChild(Ve)), fe.appendChild(Le), je.current.set(C, { container: fe, editorWrapper: Le, labelDiv: Q, labelText: ve, collapseIcon: De }), { container: fe, editorDiv: ke, gutterDiv: Ve };
3209
+ }, V = W("input1", (g == null ? void 0 : g.input1) || "Theirs", Y, u), re = W("input2", (g == null ? void 0 : g.input2) || "Ours", ue, u);
3210
+ V.gutterDiv && (Ge.current = V.gutterDiv), re.gutterDiv && (tt.current = re.gutterDiv);
3211
+ const le = !!n;
3212
+ let H = null;
3213
+ if (le) {
3214
+ H = W("base", (g == null ? void 0 : g.base) || "Base", j, !1);
3215
+ const C = [];
3216
+ h === 0 ? C.push(H.container, V.container, re.container) : h === 1 ? C.push(V.container, H.container, re.container) : h === 2 && C.push(V.container, re.container, H.container), C.forEach((ye) => {
3217
+ E.appendChild(ye);
3113
3218
  });
3114
3219
  } else
3115
- O.appendChild(H.container), O.appendChild(J.container);
3116
- let G = null;
3117
- m && se && (G = Z((h == null ? void 0 : h.result) || "Result", ue, !0), Le.current = G.container.querySelector("div"), G.gutterDiv && (ke.current = G.gutterDiv), O.appendChild(G.container)), Ie.current.appendChild(O);
3118
- const ie = k.editor.createModel(t || "", E), z = se ? k.editor.createModel(n || "", E) : null, q = k.editor.createModel(r || "", E);
3119
- if (C.current = k.editor.create(H.editorDiv, {
3120
- model: ie,
3220
+ E.appendChild(V.container), E.appendChild(re.container);
3221
+ let te = null;
3222
+ if (u && le) {
3223
+ te = W("result", (g == null ? void 0 : g.result) || "Result", ne, !0);
3224
+ const C = je.current.get("result");
3225
+ Te.current = (C == null ? void 0 : C.labelText) ?? te.container.querySelector("span"), te.gutterDiv && (Re.current = te.gutterDiv), E.appendChild(te.container);
3226
+ }
3227
+ et.current.appendChild(E);
3228
+ const z = _.editor.createModel(b(t || ""), S), q = le ? _.editor.createModel(b(n || ""), S) : null, de = _.editor.createModel(b(r || ""), S);
3229
+ if (Z.current = _.editor.create(V.editorDiv, {
3230
+ model: z,
3121
3231
  readOnly: !0,
3122
3232
  automaticLayout: !0,
3123
- folding: !m,
3233
+ folding: !u,
3124
3234
  glyphMargin: !1,
3125
3235
  ...i,
3126
- lineDecorationsWidth: m ? 26 : 10
3127
- }), se && oe && (re.current = k.editor.create(oe.editorDiv, {
3128
- model: z,
3236
+ lineDecorationsWidth: u ? 26 : 10
3237
+ }), le && H && (pe.current = _.editor.create(H.editorDiv, {
3238
+ model: q,
3129
3239
  readOnly: !0,
3130
3240
  automaticLayout: !0,
3131
- folding: !m,
3241
+ folding: !u,
3132
3242
  glyphMargin: !1,
3133
3243
  ...i,
3134
3244
  lineDecorationsWidth: 10
3135
- })), K.current = k.editor.create(J.editorDiv, {
3136
- model: q,
3245
+ })), ee.current = _.editor.create(re.editorDiv, {
3246
+ model: de,
3137
3247
  readOnly: !0,
3138
3248
  automaticLayout: !0,
3139
- folding: !m,
3249
+ folding: !u,
3140
3250
  glyphMargin: !1,
3141
3251
  ...i,
3142
- lineDecorationsWidth: m ? 26 : 10
3143
- }), m && G) {
3144
- const ee = k.editor.createModel(r || "", E);
3145
- $.current = k.editor.create(G.editorDiv, {
3146
- model: ee,
3252
+ lineDecorationsWidth: u ? 26 : 10
3253
+ }), u && te) {
3254
+ const C = _.editor.createModel(b(r || ""), S);
3255
+ G.current = _.editor.create(te.editorDiv, {
3256
+ model: C,
3147
3257
  automaticLayout: !0,
3148
- folding: !m,
3258
+ folding: !u,
3149
3259
  glyphMargin: !1,
3150
3260
  ...i,
3151
3261
  readOnly: !1,
3152
3262
  lineDecorationsWidth: 26
3153
- }), ee.onDidChangeContent(() => {
3154
- gt.current || ne(!0);
3263
+ }), C.onDidChangeContent(() => {
3264
+ Et.current || ae(!0);
3155
3265
  });
3156
3266
  }
3157
- k.editor.setTheme(o);
3158
- const he = xt(z, ie, q);
3159
- F(he), De.current = !0, l && C.current && K.current && l(
3267
+ _.editor.setTheme(o);
3268
+ const me = Yt(q, z, de);
3269
+ M(me), Fe.current = !0, l && Z.current && ee.current && l(
3160
3270
  {
3161
- input1: C.current,
3162
- input2: K.current,
3163
- base: re.current,
3164
- result: $.current
3271
+ input1: Z.current,
3272
+ input2: ee.current,
3273
+ base: pe.current,
3274
+ result: G.current
3165
3275
  },
3166
- k
3276
+ _
3167
3277
  );
3168
3278
  }
3169
- }, [i, o, t, r, n, m, d, b, xt, l, h]), Ft = le(m), Ut = le(d), Vt = le(L), Jt = le(n);
3279
+ }, [
3280
+ i,
3281
+ o,
3282
+ t,
3283
+ r,
3284
+ n,
3285
+ u,
3286
+ h,
3287
+ R,
3288
+ Yt,
3289
+ l,
3290
+ g,
3291
+ O
3292
+ ]), Xt = se(u), Kt = se(h), Qt = se(T), Zt = se(n);
3170
3293
  return Se(() => {
3171
- var P, U, Q, Y, _, ue, Z, H, J, se, oe;
3172
- const k = Ft.current !== m, O = Ut.current !== d, I = Vt.current !== L, B = Jt.current !== n;
3173
- if ((k || O || I || B) && De.current) {
3174
- Ft.current = m, Ut.current = d, Vt.current = L, Jt.current = n, Be.current.forEach((he) => {
3175
- he.remove();
3176
- }), Be.current.clear(), (P = Fe.current) == null || P.set([]), (U = Ue.current) == null || U.set([]), (Q = Ve.current) == null || Q.set([]), Fe.current = null, Ue.current = null, Ve.current = null;
3177
- const G = (Y = C.current) == null ? void 0 : Y.getModel(), ie = (_ = re.current) == null ? void 0 : _.getModel(), z = (ue = K.current) == null ? void 0 : ue.getModel(), q = (Z = $.current) == null ? void 0 : Z.getModel();
3178
- (H = C.current) == null || H.dispose(), (J = re.current) == null || J.dispose(), (se = K.current) == null || se.dispose(), (oe = $.current) == null || oe.dispose(), G == null || G.dispose(), ie == null || ie.dispose(), z == null || z.dispose(), q == null || q.dispose(), De.current = !1, Te((he) => he + 1);
3179
- }
3180
- }, [m, d, L, n]), Se(() => {
3181
- !b && fe.current && Ie.current && !De.current && Bt();
3182
- }, [b, Bt]), Se(() => {
3183
- !S || !i || (C.current && C.current.updateOptions(i), K.current && K.current.updateOptions(i), re.current && re.current.updateOptions(i), $.current && $.current.updateOptions(i));
3184
- }, [i, S]), Se(() => {
3185
- S && T.length > 0 && ($t(), m && ot());
3186
- }, [S, T, $t, ot, m]), Se(() => {
3187
- S && T.length > 0 && m && $.current && rt(T);
3188
- }, [S, T, m, rt]), Se(() => {
3189
- if (!S) return;
3190
- const k = () => {
3191
- w.length > 0 && nt(w);
3192
- }, O = [], I = () => {
3193
- ot();
3294
+ var k, U, X, Y, j, ue, ne, W, V, re, le;
3295
+ const _ = Xt.current !== u, b = Kt.current !== h, E = Qt.current !== T, w = Zt.current !== n;
3296
+ if ((_ || b || E || w) && Fe.current) {
3297
+ Xt.current = u, Kt.current = h, Qt.current = T, Zt.current = n, We.current.forEach((de) => {
3298
+ de.remove();
3299
+ }), We.current.clear(), je.current.clear(), Pe(/* @__PURE__ */ new Set()), (k = qe.current) == null || k.set([]), (U = Ye.current) == null || U.set([]), (X = ze.current) == null || X.set([]), qe.current = null, Ye.current = null, ze.current = null;
3300
+ const H = (Y = Z.current) == null ? void 0 : Y.getModel(), te = (j = pe.current) == null ? void 0 : j.getModel(), z = (ue = ee.current) == null ? void 0 : ue.getModel(), q = (ne = G.current) == null ? void 0 : ne.getModel();
3301
+ (W = Z.current) == null || W.dispose(), (V = pe.current) == null || V.dispose(), (re = ee.current) == null || re.dispose(), (le = G.current) == null || le.dispose(), H == null || H.dispose(), te == null || te.dispose(), z == null || z.dispose(), q == null || q.dispose(), Fe.current = !1, Be((de) => de + 1);
3302
+ }
3303
+ }, [u, h, T, n]), Se(() => {
3304
+ !R && be.current && et.current && !Fe.current && Ct();
3305
+ }, [R, Ct]), Se(() => {
3306
+ !p || !i || (Z.current && Z.current.updateOptions(i), ee.current && ee.current.updateOptions(i), pe.current && pe.current.updateOptions(i), G.current && G.current.updateOptions(i));
3307
+ }, [i, p]), Se(() => {
3308
+ p && x.length > 0 && (zt(), u && dt());
3309
+ }, [p, x, zt, dt, u]), Se(() => {
3310
+ p && x.length > 0 && u && G.current && pt(x);
3311
+ }, [p, x, u, pt]), Se(() => {
3312
+ if (!p) return;
3313
+ const _ = () => {
3314
+ D.length > 0 && ft(D);
3315
+ }, b = [], E = () => {
3316
+ dt();
3194
3317
  };
3195
- return C.current && O.push(C.current.onDidScrollChange(I)), K.current && O.push(K.current.onDidScrollChange(I)), $.current && m && (O.push($.current.onDidScrollChange(k)), O.push($.current.onDidLayoutChange(k))), C.current && O.push(C.current.onDidLayoutChange(I)), K.current && O.push(K.current.onDidLayoutChange(I)), () => {
3196
- O.forEach((B) => {
3197
- B == null || B.dispose();
3318
+ return Z.current && b.push(Z.current.onDidScrollChange(E)), ee.current && b.push(ee.current.onDidScrollChange(E)), G.current && u && (b.push(G.current.onDidScrollChange(_)), b.push(G.current.onDidLayoutChange(_))), Z.current && b.push(Z.current.onDidLayoutChange(E)), ee.current && b.push(ee.current.onDidLayoutChange(E)), () => {
3319
+ b.forEach((w) => {
3320
+ w == null || w.dispose();
3198
3321
  });
3199
3322
  };
3200
- }, [S, ot, nt, m, w]), Se(() => {
3201
- if (!S) return;
3202
- const k = [C.current, re.current, K.current];
3203
- m && $.current && k.push($.current);
3204
- const O = [];
3205
- let I = !1;
3206
- const B = (P) => {
3207
- if (I) return;
3208
- I = !0;
3209
- const U = P.getScrollTop(), Q = P.getScrollLeft();
3210
- k.forEach((Y) => {
3211
- Y && Y !== P && (Y.setScrollTop(U), Y.setScrollLeft(Q));
3323
+ }, [p, dt, ft, u, D]), Se(() => {
3324
+ if (!p) return;
3325
+ const _ = [Z.current, pe.current, ee.current];
3326
+ u && G.current && _.push(G.current);
3327
+ const b = [];
3328
+ let E = !1;
3329
+ const w = (k) => {
3330
+ if (E) return;
3331
+ E = !0;
3332
+ const U = k.getScrollTop(), X = k.getScrollLeft();
3333
+ _.forEach((Y) => {
3334
+ Y && Y !== k && (Y.setScrollTop(U), Y.setScrollLeft(X));
3212
3335
  }), setTimeout(() => {
3213
- I = !1;
3336
+ E = !1;
3214
3337
  }, 10);
3215
3338
  };
3216
- return k.forEach((P) => {
3217
- P && O.push(
3218
- P.onDidScrollChange(() => {
3219
- B(P);
3339
+ return _.forEach((k) => {
3340
+ k && b.push(
3341
+ k.onDidScrollChange(() => {
3342
+ w(k);
3220
3343
  })
3221
3344
  );
3222
3345
  }), () => {
3223
- O.forEach((P) => {
3224
- P == null || P.dispose();
3346
+ b.forEach((k) => {
3347
+ k == null || k.dispose();
3225
3348
  });
3226
3349
  };
3227
- }, [S, m]), Se(() => () => {
3228
- var P, U, Q, Y, _, ue, Z, H, J, se, oe;
3229
- (P = Fe.current) == null || P.set([]), (U = Ue.current) == null || U.set([]), (Q = Ve.current) == null || Q.set([]);
3230
- const k = (Y = C.current) == null ? void 0 : Y.getModel(), O = (_ = re.current) == null ? void 0 : _.getModel(), I = (ue = K.current) == null ? void 0 : ue.getModel(), B = (Z = $.current) == null ? void 0 : Z.getModel();
3231
- (H = C.current) == null || H.dispose(), (J = re.current) == null || J.dispose(), (se = K.current) == null || se.dispose(), (oe = $.current) == null || oe.dispose(), k == null || k.dispose(), O == null || O.dispose(), I == null || I.dispose(), B == null || B.dispose(), De.current = !1, g(!1);
3232
- }, []), b || !S ? /* @__PURE__ */ st(On, { children: u ?? /* @__PURE__ */ st(Kr, {}) }) : /* @__PURE__ */ st("div", { ref: Ie, style: { width: s, height: c }, className: a });
3350
+ }, [p, u]), Se(() => {
3351
+ if (!p) return;
3352
+ const b = Array.from(je.current.keys()).filter((E) => !ge.has(E)).length;
3353
+ for (const [E, w] of je.current.entries()) {
3354
+ const k = ge.has(E), U = b > 1 || k;
3355
+ k ? (w.container.style.flex = "0 0 28px", w.container.style.minWidth = "28px", w.container.style.maxWidth = "28px", w.editorWrapper.style.opacity = "0", w.editorWrapper.style.pointerEvents = "none", w.labelDiv.style.justifyContent = "center", w.labelText.style.display = "none", w.collapseIcon.style.transform = "rotate(180deg)", w.collapseIcon.title = "Expand column") : (w.container.style.flex = "1", w.container.style.minWidth = "", w.container.style.maxWidth = "", w.editorWrapper.style.opacity = "1", w.editorWrapper.style.pointerEvents = "", w.labelDiv.style.justifyContent = "", w.labelText.style.display = "", w.collapseIcon.style.transform = "", w.collapseIcon.title = "Collapse column"), !k && !U ? (w.collapseIcon.classList.add("column-collapse-icon--disabled"), w.collapseIcon.title = "Cannot collapse last column") : w.collapseIcon.classList.remove("column-collapse-icon--disabled");
3356
+ }
3357
+ requestAnimationFrame(() => {
3358
+ var E;
3359
+ for (const [w] of je.current.entries())
3360
+ if (!ge.has(w)) {
3361
+ const k = w === "input1" ? Z : w === "input2" ? ee : w === "base" ? pe : w === "result" ? G : null;
3362
+ (E = k == null ? void 0 : k.current) == null || E.layout();
3363
+ }
3364
+ });
3365
+ }, [p, ge]), Se(() => () => {
3366
+ var k, U, X, Y, j, ue, ne, W, V, re, le;
3367
+ (k = qe.current) == null || k.set([]), (U = Ye.current) == null || U.set([]), (X = ze.current) == null || X.set([]);
3368
+ const _ = (Y = Z.current) == null ? void 0 : Y.getModel(), b = (j = pe.current) == null ? void 0 : j.getModel(), E = (ue = ee.current) == null ? void 0 : ue.getModel(), w = (ne = G.current) == null ? void 0 : ne.getModel();
3369
+ (W = Z.current) == null || W.dispose(), (V = pe.current) == null || V.dispose(), (re = ee.current) == null || re.dispose(), (le = G.current) == null || le.dispose(), _ == null || _.dispose(), b == null || b.dispose(), E == null || E.dispose(), w == null || w.dispose(), Fe.current = !1, v(!1);
3370
+ }, []), R || !p ? /* @__PURE__ */ gt(Pn, { children: f ?? /* @__PURE__ */ gt(fo, {}) }) : /* @__PURE__ */ gt("div", { ref: et, style: { width: s, height: c }, className: a });
3233
3371
  }
3234
3372
  export {
3235
- ro as JsonDiffMergeEditor,
3236
- Fr as analyzeConflicts,
3237
- Ur as analyzeTwoWayConflicts,
3238
- no as computeDiffs,
3239
- Jr as computeDiffsJsonPatch,
3240
- Hr as computeLineConflictType
3373
+ vo as JsonDiffMergeEditor,
3374
+ Kr as analyzeConflicts,
3375
+ Qr as analyzeTwoWayConflicts,
3376
+ yo as computeDiffs,
3377
+ eo as computeDiffsJsonPatch,
3378
+ to as computeLineConflictType
3241
3379
  };
3242
3380
  //# sourceMappingURL=index.mjs.map