@harnessio/yaml-editor 0.19.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  var Ze = Object.defineProperty;
2
2
  var Ge = (e, t, r) => t in e ? Ze(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
3
  var je = (e, t, r) => (Ge(e, typeof t != "symbol" ? t + "" : t, r), r);
4
- import K, { memo as ye, useState as V, useRef as O, useCallback as G, useEffect as L, useMemo as B, createContext as Je, useContext as Qe } from "react";
5
- import * as z from "monaco-editor";
4
+ import K, { memo as be, useState as V, useRef as w, useCallback as G, useEffect as I, useMemo as q, createContext as Je, useContext as Qe } from "react";
5
+ import * as R from "monaco-editor";
6
6
  import { languages as ge, Uri as Xe } from "monaco-editor";
7
- import { yamlDefaults as be } from "monaco-yaml";
8
- var Ne = { exports: {} }, ne = {};
7
+ import { yamlDefaults as ye } from "monaco-yaml";
8
+ var De = { exports: {} }, ne = {};
9
9
  /*
10
10
  object-assign
11
11
  (c) Sindre Sorhus
@@ -48,11 +48,11 @@ nt();
48
48
  * This source code is licensed under the MIT license found in the
49
49
  * LICENSE file in the root directory of this source tree.
50
50
  */
51
- var ot = K, Te = 60103;
51
+ var ot = K, Ne = 60103;
52
52
  ne.Fragment = 60107;
53
53
  if (typeof Symbol == "function" && Symbol.for) {
54
54
  var Pe = Symbol.for;
55
- Te = Pe("react.element"), ne.Fragment = Pe("react.fragment");
55
+ Ne = Pe("react.element"), ne.Fragment = Pe("react.fragment");
56
56
  }
57
57
  var it = ot.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, at = Object.prototype.hasOwnProperty, ct = { key: !0, ref: !0, __self: !0, __source: !0 };
58
58
  function ke(e, t, r) {
@@ -63,12 +63,12 @@ function ke(e, t, r) {
63
63
  if (e && e.defaultProps)
64
64
  for (n in t = e.defaultProps, t)
65
65
  o[n] === void 0 && (o[n] = t[n]);
66
- return { $$typeof: Te, type: e, key: i, ref: a, props: o, _owner: it.current };
66
+ return { $$typeof: Ne, type: e, key: i, ref: a, props: o, _owner: it.current };
67
67
  }
68
68
  ne.jsx = ke;
69
69
  ne.jsxs = ke;
70
- Ne.exports = ne;
71
- var F = Ne.exports;
70
+ De.exports = ne;
71
+ var F = De.exports;
72
72
  function ut(e, t, r) {
73
73
  return t in e ? Object.defineProperty(e, t, {
74
74
  value: r,
@@ -172,7 +172,7 @@ function gt(e, t, r) {
172
172
  writable: !0
173
173
  }) : e[t] = r, e;
174
174
  }
175
- function Le(e, t) {
175
+ function Ie(e, t) {
176
176
  var r = Object.keys(e);
177
177
  if (Object.getOwnPropertySymbols) {
178
178
  var n = Object.getOwnPropertySymbols(e);
@@ -182,12 +182,12 @@ function Le(e, t) {
182
182
  }
183
183
  return r;
184
184
  }
185
- function Ie(e) {
185
+ function Le(e) {
186
186
  for (var t = 1; t < arguments.length; t++) {
187
187
  var r = arguments[t] != null ? arguments[t] : {};
188
- t % 2 ? Le(Object(r), !0).forEach(function(n) {
188
+ t % 2 ? Ie(Object(r), !0).forEach(function(n) {
189
189
  gt(e, n, r[n]);
190
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : Le(Object(r)).forEach(function(n) {
190
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : Ie(Object(r)).forEach(function(n) {
191
191
  Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
192
192
  });
193
193
  }
@@ -216,30 +216,30 @@ function X(e) {
216
216
  function ce(e) {
217
217
  return {}.toString.call(e).includes("Object");
218
218
  }
219
- function yt(e) {
219
+ function bt(e) {
220
220
  return !Object.keys(e).length;
221
221
  }
222
222
  function re(e) {
223
223
  return typeof e == "function";
224
224
  }
225
- function bt(e, t) {
225
+ function yt(e, t) {
226
226
  return Object.prototype.hasOwnProperty.call(e, t);
227
227
  }
228
- function Ot(e, t) {
229
- return ce(t) || H("changeType"), Object.keys(t).some(function(r) {
230
- return !bt(e, r);
231
- }) && H("changeField"), t;
228
+ function wt(e, t) {
229
+ return ce(t) || B("changeType"), Object.keys(t).some(function(r) {
230
+ return !yt(e, r);
231
+ }) && B("changeField"), t;
232
232
  }
233
- function wt(e) {
234
- re(e) || H("selectorType");
233
+ function Ot(e) {
234
+ re(e) || B("selectorType");
235
235
  }
236
- function St(e) {
237
- re(e) || ce(e) || H("handlerType"), ce(e) && Object.values(e).some(function(t) {
236
+ function Mt(e) {
237
+ re(e) || ce(e) || B("handlerType"), ce(e) && Object.values(e).some(function(t) {
238
238
  return !re(t);
239
- }) && H("handlersType");
239
+ }) && B("handlersType");
240
240
  }
241
- function Mt(e) {
242
- e || H("initialIsRequired"), ce(e) || H("initialType"), yt(e) && H("initialContent");
241
+ function St(e) {
242
+ e || B("initialIsRequired"), ce(e) || B("initialType"), bt(e) && B("initialContent");
243
243
  }
244
244
  function jt(e, t) {
245
245
  throw new Error(e[t] || e.default);
@@ -254,11 +254,11 @@ var Et = {
254
254
  changeType: "provided value of changes should be an object",
255
255
  changeField: 'it seams you want to change a field in the state which is not specified in the "initial" state',
256
256
  default: "an unknown error accured in `state-local` package"
257
- }, H = X(jt)(Et), ie = {
258
- changes: Ot,
259
- selector: wt,
260
- handler: St,
261
- initial: Mt
257
+ }, B = X(jt)(Et), ie = {
258
+ changes: wt,
259
+ selector: Ot,
260
+ handler: Mt,
261
+ initial: St
262
262
  };
263
263
  function Pt(e) {
264
264
  var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
@@ -281,7 +281,7 @@ function xt(e, t) {
281
281
  return re(t) ? t(e.current) : t;
282
282
  }
283
283
  function Ct(e, t) {
284
- return e.current = Ie(Ie({}, e.current), t), t;
284
+ return e.current = Le(Le({}, e.current), t), t;
285
285
  }
286
286
  function $t(e, t, r) {
287
287
  return re(t) ? t(e.current) : Object.keys(r).forEach(function(n) {
@@ -289,14 +289,14 @@ function $t(e, t, r) {
289
289
  return (o = t[n]) === null || o === void 0 ? void 0 : o.call(t, e.current[n]);
290
290
  }), r;
291
291
  }
292
- var Lt = {
292
+ var It = {
293
293
  create: Pt
294
- }, It = {
294
+ }, Lt = {
295
295
  paths: {
296
296
  vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs"
297
297
  }
298
298
  };
299
- function Dt(e) {
299
+ function Tt(e) {
300
300
  return function t() {
301
301
  for (var r = this, n = arguments.length, o = new Array(n), i = 0; i < n; i++)
302
302
  o[i] = arguments[i];
@@ -307,11 +307,11 @@ function Dt(e) {
307
307
  };
308
308
  };
309
309
  }
310
- function Nt(e) {
310
+ function Dt(e) {
311
311
  return {}.toString.call(e).includes("Object");
312
312
  }
313
- function Tt(e) {
314
- return e || De("configIsRequired"), Nt(e) || De("configType"), e.urls ? (kt(), {
313
+ function Nt(e) {
314
+ return e || Te("configIsRequired"), Dt(e) || Te("configType"), e.urls ? (kt(), {
315
315
  paths: {
316
316
  vs: e.urls.monacoBase
317
317
  }
@@ -337,8 +337,8 @@ var Ae = {
337
337
 
338
338
  For more please check the link https://github.com/suren-atoyan/monaco-loader#config
339
339
  `
340
- }, De = Dt(At)(Ae), Vt = {
341
- config: Tt
340
+ }, Te = Tt(At)(Ae), Vt = {
341
+ config: Nt
342
342
  }, _t = function() {
343
343
  for (var t = arguments.length, r = new Array(t), n = 0; n < t; n++)
344
344
  r[n] = arguments[n];
@@ -367,14 +367,14 @@ function fe(e) {
367
367
  return t = !0;
368
368
  }, r;
369
369
  }
370
- var Ft = Lt.create({
371
- config: It,
370
+ var Ft = It.create({
371
+ config: Lt,
372
372
  isInitialized: !1,
373
373
  resolve: null,
374
374
  reject: null,
375
375
  monaco: null
376
376
  }), _e = dt(Ft, 2), oe = _e[0], ue = _e[1];
377
- function zt(e) {
377
+ function Rt(e) {
378
378
  var t = Vt.config(e), r = t.monaco, n = lt(t, ["monaco"]);
379
379
  ue(function(o) {
380
380
  return {
@@ -383,7 +383,7 @@ function zt(e) {
383
383
  };
384
384
  });
385
385
  }
386
- function Rt() {
386
+ function zt() {
387
387
  var e = oe(function(t) {
388
388
  var r = t.monaco, n = t.isInitialized, o = t.resolve;
389
389
  return {
@@ -399,25 +399,25 @@ function Rt() {
399
399
  return e.resolve(e.monaco), fe(pe);
400
400
  if (window.monaco && window.monaco.editor)
401
401
  return Ue(window.monaco), e.resolve(window.monaco), fe(pe);
402
- _t(qt, Ht)(Wt);
402
+ _t(Ht, Bt)(Wt);
403
403
  }
404
404
  return fe(pe);
405
405
  }
406
- function qt(e) {
406
+ function Ht(e) {
407
407
  return document.body.appendChild(e);
408
408
  }
409
- function Bt(e) {
409
+ function qt(e) {
410
410
  var t = document.createElement("script");
411
411
  return e && (t.src = e), t;
412
412
  }
413
- function Ht(e) {
413
+ function Bt(e) {
414
414
  var t = oe(function(n) {
415
415
  var o = n.config, i = n.reject;
416
416
  return {
417
417
  config: o,
418
418
  reject: i
419
419
  };
420
- }), r = Bt("".concat(t.config.paths.vs, "/loader.js"));
420
+ }), r = qt("".concat(t.config.paths.vs, "/loader.js"));
421
421
  return r.onload = function() {
422
422
  return e();
423
423
  }, r.onerror = t.reject, r;
@@ -454,8 +454,8 @@ var pe = new Promise(function(e, t) {
454
454
  reject: t
455
455
  });
456
456
  }), W = {
457
- config: zt,
458
- init: Rt,
457
+ config: Rt,
458
+ init: zt,
459
459
  __getMonacoInstance: Kt
460
460
  }, Yt = { wrapper: { display: "flex", position: "relative", textAlign: "initial" }, fullWidth: { width: "100%" }, hide: { display: "none" } }, me = Yt, Zt = { container: { display: "flex", height: "100%", width: "100%", justifyContent: "center", alignItems: "center" } }, Gt = Zt;
461
461
  function Jt({ children: e }) {
@@ -465,14 +465,14 @@ var Qt = Jt, Xt = Qt;
465
465
  function er({ width: e, height: t, isEditorReady: r, loading: n, _ref: o, className: i, wrapperProps: a }) {
466
466
  return K.createElement("section", { style: { ...me.wrapper, width: e, height: t }, ...a }, !r && K.createElement(Xt, null, n), K.createElement("div", { ref: o, style: { ...me.fullWidth, ...!r && me.hide }, className: i }));
467
467
  }
468
- var tr = er, Fe = ye(tr);
468
+ var tr = er, Fe = be(tr);
469
469
  function rr(e) {
470
- L(e, []);
470
+ I(e, []);
471
471
  }
472
- var Oe = rr;
472
+ var we = rr;
473
473
  function nr(e, t, r = !0) {
474
- let n = O(!0);
475
- L(n.current || !r ? () => {
474
+ let n = w(!0);
475
+ I(n.current || !r ? () => {
476
476
  n.current = !1;
477
477
  } : e, t);
478
478
  }
@@ -483,38 +483,38 @@ function Z(e, t, r, n) {
483
483
  return or(e, n) || ir(e, t, r, n);
484
484
  }
485
485
  function or(e, t) {
486
- return e.editor.getModel(ze(e, t));
486
+ return e.editor.getModel(Re(e, t));
487
487
  }
488
488
  function ir(e, t, r, n) {
489
- return e.editor.createModel(t, r, n ? ze(e, n) : void 0);
489
+ return e.editor.createModel(t, r, n ? Re(e, n) : void 0);
490
490
  }
491
- function ze(e, t) {
491
+ function Re(e, t) {
492
492
  return e.Uri.parse(t);
493
493
  }
494
- function ar({ original: e, modified: t, language: r, originalLanguage: n, modifiedLanguage: o, originalModelPath: i, modifiedModelPath: a, keepCurrentOriginalModel: u = !1, keepCurrentModifiedModel: l = !1, theme: s = "light", loading: h = "Loading...", options: f = {}, height: m = "100%", width: I = "100%", className: g, wrapperProps: k = {}, beforeMount: C = ee, onMount: w = ee }) {
495
- let [v, T] = V(!1), [x, M] = V(!0), j = O(null), E = O(null), R = O(null), S = O(w), d = O(C), P = O(!1);
496
- Oe(() => {
494
+ function ar({ original: e, modified: t, language: r, originalLanguage: n, modifiedLanguage: o, originalModelPath: i, modifiedModelPath: a, keepCurrentOriginalModel: u = !1, keepCurrentModifiedModel: l = !1, theme: s = "light", loading: h = "Loading...", options: f = {}, height: m = "100%", width: L = "100%", className: g, wrapperProps: k = {}, beforeMount: C = ee, onMount: O = ee }) {
495
+ let [v, N] = V(!1), [x, S] = V(!0), j = w(null), E = w(null), z = w(null), M = w(O), d = w(C), P = w(!1);
496
+ we(() => {
497
497
  let c = W.init();
498
- return c.then((y) => (E.current = y) && M(!1)).catch((y) => (y == null ? void 0 : y.type) !== "cancelation" && console.error("Monaco initialization: error:", y)), () => j.current ? D() : c.cancel();
498
+ return c.then((b) => (E.current = b) && S(!1)).catch((b) => (b == null ? void 0 : b.type) !== "cancelation" && console.error("Monaco initialization: error:", b)), () => j.current ? T() : c.cancel();
499
499
  }), U(() => {
500
500
  if (j.current && E.current) {
501
- let c = j.current.getOriginalEditor(), y = Z(E.current, e || "", n || r || "text", i || "");
502
- y !== c.getModel() && c.setModel(y);
501
+ let c = j.current.getOriginalEditor(), b = Z(E.current, e || "", n || r || "text", i || "");
502
+ b !== c.getModel() && c.setModel(b);
503
503
  }
504
504
  }, [i], v), U(() => {
505
505
  if (j.current && E.current) {
506
- let c = j.current.getModifiedEditor(), y = Z(E.current, t || "", o || r || "text", a || "");
507
- y !== c.getModel() && c.setModel(y);
506
+ let c = j.current.getModifiedEditor(), b = Z(E.current, t || "", o || r || "text", a || "");
507
+ b !== c.getModel() && c.setModel(b);
508
508
  }
509
509
  }, [a], v), U(() => {
510
510
  let c = j.current.getModifiedEditor();
511
511
  c.getOption(E.current.editor.EditorOption.readOnly) ? c.setValue(t || "") : t !== c.getValue() && (c.executeEdits("", [{ range: c.getModel().getFullModelRange(), text: t || "", forceMoveMarkers: !0 }]), c.pushUndoStop());
512
512
  }, [t], v), U(() => {
513
- var c, y;
514
- (y = (c = j.current) == null ? void 0 : c.getModel()) == null || y.original.setValue(e || "");
513
+ var c, b;
514
+ (b = (c = j.current) == null ? void 0 : c.getModel()) == null || b.original.setValue(e || "");
515
515
  }, [e], v), U(() => {
516
- let { original: c, modified: y } = j.current.getModel();
517
- E.current.editor.setModelLanguage(c, n || r || "text"), E.current.editor.setModelLanguage(y, o || r || "text");
516
+ let { original: c, modified: b } = j.current.getModel();
517
+ E.current.editor.setModelLanguage(c, n || r || "text"), E.current.editor.setModelLanguage(b, o || r || "text");
518
518
  }, [r, n, o], v), U(() => {
519
519
  var c;
520
520
  (c = E.current) == null || c.editor.setTheme(s);
@@ -527,28 +527,28 @@ function ar({ original: e, modified: t, language: r, originalLanguage: n, modifi
527
527
  if (!E.current)
528
528
  return;
529
529
  d.current(E.current);
530
- let c = Z(E.current, e || "", n || r || "text", i || ""), y = Z(E.current, t || "", o || r || "text", a || "");
531
- (A = j.current) == null || A.setModel({ original: c, modified: y });
532
- }, [r, t, o, e, n, i, a]), N = G(() => {
530
+ let c = Z(E.current, e || "", n || r || "text", i || ""), b = Z(E.current, t || "", o || r || "text", a || "");
531
+ (A = j.current) == null || A.setModel({ original: c, modified: b });
532
+ }, [r, t, o, e, n, i, a]), D = G(() => {
533
533
  var c;
534
- !P.current && R.current && (j.current = E.current.editor.createDiffEditor(R.current, { automaticLayout: !0, ...f }), p(), (c = E.current) == null || c.editor.setTheme(s), T(!0), P.current = !0);
534
+ !P.current && z.current && (j.current = E.current.editor.createDiffEditor(z.current, { automaticLayout: !0, ...f }), p(), (c = E.current) == null || c.editor.setTheme(s), N(!0), P.current = !0);
535
535
  }, [f, s, p]);
536
- L(() => {
537
- v && S.current(j.current, E.current);
538
- }, [v]), L(() => {
539
- !x && !v && N();
540
- }, [x, v, N]);
541
- function D() {
542
- var y, A, q, J;
543
- let c = (y = j.current) == null ? void 0 : y.getModel();
544
- u || ((A = c == null ? void 0 : c.original) == null || A.dispose()), l || ((q = c == null ? void 0 : c.modified) == null || q.dispose()), (J = j.current) == null || J.dispose();
536
+ I(() => {
537
+ v && M.current(j.current, E.current);
538
+ }, [v]), I(() => {
539
+ !x && !v && D();
540
+ }, [x, v, D]);
541
+ function T() {
542
+ var b, A, H, J;
543
+ let c = (b = j.current) == null ? void 0 : b.getModel();
544
+ u || ((A = c == null ? void 0 : c.original) == null || A.dispose()), l || ((H = c == null ? void 0 : c.modified) == null || H.dispose()), (J = j.current) == null || J.dispose();
545
545
  }
546
- return K.createElement(Fe, { width: I, height: m, isEditorReady: v, loading: h, _ref: R, className: g, wrapperProps: k });
546
+ return K.createElement(Fe, { width: L, height: m, isEditorReady: v, loading: h, _ref: z, className: g, wrapperProps: k });
547
547
  }
548
- var cr = ar, ur = ye(cr);
548
+ var cr = ar, ur = be(cr);
549
549
  function sr() {
550
550
  let [e, t] = V(W.__getMonacoInstance());
551
- return Oe(() => {
551
+ return we(() => {
552
552
  let r;
553
553
  return e || (r = W.init(), r.then((n) => {
554
554
  t(n);
@@ -557,78 +557,78 @@ function sr() {
557
557
  }
558
558
  var se = sr;
559
559
  function lr(e) {
560
- let t = O();
561
- return L(() => {
560
+ let t = w();
561
+ return I(() => {
562
562
  t.current = e;
563
563
  }, [e]), t.current;
564
564
  }
565
565
  var dr = lr, ae = /* @__PURE__ */ new Map();
566
- function fr({ defaultValue: e, defaultLanguage: t, defaultPath: r, value: n, language: o, path: i, theme: a = "light", line: u, loading: l = "Loading...", options: s = {}, overrideServices: h = {}, saveViewState: f = !0, keepCurrentModel: m = !1, width: I = "100%", height: g = "100%", className: k, wrapperProps: C = {}, beforeMount: w = ee, onMount: v = ee, onChange: T, onValidate: x = ee }) {
567
- let [M, j] = V(!1), [E, R] = V(!0), S = O(null), d = O(null), P = O(null), p = O(v), N = O(w), D = O(), c = O(n), y = dr(i), A = O(!1), q = O(!1);
568
- Oe(() => {
569
- let b = W.init();
570
- return b.then(($) => (S.current = $) && R(!1)).catch(($) => ($ == null ? void 0 : $.type) !== "cancelation" && console.error("Monaco initialization: error:", $)), () => d.current ? Ye() : b.cancel();
566
+ function fr({ defaultValue: e, defaultLanguage: t, defaultPath: r, value: n, language: o, path: i, theme: a = "light", line: u, loading: l = "Loading...", options: s = {}, overrideServices: h = {}, saveViewState: f = !0, keepCurrentModel: m = !1, width: L = "100%", height: g = "100%", className: k, wrapperProps: C = {}, beforeMount: O = ee, onMount: v = ee, onChange: N, onValidate: x = ee }) {
567
+ let [S, j] = V(!1), [E, z] = V(!0), M = w(null), d = w(null), P = w(null), p = w(v), D = w(O), T = w(), c = w(n), b = dr(i), A = w(!1), H = w(!1);
568
+ we(() => {
569
+ let y = W.init();
570
+ return y.then(($) => (M.current = $) && z(!1)).catch(($) => ($ == null ? void 0 : $.type) !== "cancelation" && console.error("Monaco initialization: error:", $)), () => d.current ? Ye() : y.cancel();
571
571
  }), U(() => {
572
572
  var $, _, Q, Y;
573
- let b = Z(S.current, e || n || "", t || o || "", i || r || "");
574
- b !== (($ = d.current) == null ? void 0 : $.getModel()) && (f && ae.set(y, (_ = d.current) == null ? void 0 : _.saveViewState()), (Q = d.current) == null || Q.setModel(b), f && ((Y = d.current) == null || Y.restoreViewState(ae.get(i))));
575
- }, [i], M), U(() => {
576
- var b;
577
- (b = d.current) == null || b.updateOptions(s);
578
- }, [s], M), U(() => {
579
- !d.current || n === void 0 || (d.current.getOption(S.current.editor.EditorOption.readOnly) ? d.current.setValue(n) : n !== d.current.getValue() && (q.current = !0, d.current.executeEdits("", [{ range: d.current.getModel().getFullModelRange(), text: n, forceMoveMarkers: !0 }]), d.current.pushUndoStop(), q.current = !1));
580
- }, [n], M), U(() => {
573
+ let y = Z(M.current, e || n || "", t || o || "", i || r || "");
574
+ y !== (($ = d.current) == null ? void 0 : $.getModel()) && (f && ae.set(b, (_ = d.current) == null ? void 0 : _.saveViewState()), (Q = d.current) == null || Q.setModel(y), f && ((Y = d.current) == null || Y.restoreViewState(ae.get(i))));
575
+ }, [i], S), U(() => {
576
+ var y;
577
+ (y = d.current) == null || y.updateOptions(s);
578
+ }, [s], S), U(() => {
579
+ !d.current || n === void 0 || (d.current.getOption(M.current.editor.EditorOption.readOnly) ? d.current.setValue(n) : n !== d.current.getValue() && (H.current = !0, d.current.executeEdits("", [{ range: d.current.getModel().getFullModelRange(), text: n, forceMoveMarkers: !0 }]), d.current.pushUndoStop(), H.current = !1));
580
+ }, [n], S), U(() => {
581
581
  var $, _;
582
- let b = ($ = d.current) == null ? void 0 : $.getModel();
583
- b && o && ((_ = S.current) == null || _.editor.setModelLanguage(b, o));
584
- }, [o], M), U(() => {
585
- var b;
586
- u !== void 0 && ((b = d.current) == null || b.revealLine(u));
587
- }, [u], M), U(() => {
588
- var b;
589
- (b = S.current) == null || b.editor.setTheme(a);
590
- }, [a], M);
582
+ let y = ($ = d.current) == null ? void 0 : $.getModel();
583
+ y && o && ((_ = M.current) == null || _.editor.setModelLanguage(y, o));
584
+ }, [o], S), U(() => {
585
+ var y;
586
+ u !== void 0 && ((y = d.current) == null || y.revealLine(u));
587
+ }, [u], S), U(() => {
588
+ var y;
589
+ (y = M.current) == null || y.editor.setTheme(a);
590
+ }, [a], S);
591
591
  let J = G(() => {
592
- var b;
593
- if (!(!P.current || !S.current) && !A.current) {
594
- N.current(S.current);
595
- let $ = i || r, _ = Z(S.current, n || e || "", t || o || "", $ || "");
596
- d.current = (b = S.current) == null ? void 0 : b.editor.create(P.current, { model: _, automaticLayout: !0, ...s }, h), f && d.current.restoreViewState(ae.get($)), S.current.editor.setTheme(a), u !== void 0 && d.current.revealLine(u), j(!0), A.current = !0;
592
+ var y;
593
+ if (!(!P.current || !M.current) && !A.current) {
594
+ D.current(M.current);
595
+ let $ = i || r, _ = Z(M.current, n || e || "", t || o || "", $ || "");
596
+ d.current = (y = M.current) == null ? void 0 : y.editor.create(P.current, { model: _, automaticLayout: !0, ...s }, h), f && d.current.restoreViewState(ae.get($)), M.current.editor.setTheme(a), u !== void 0 && d.current.revealLine(u), j(!0), A.current = !0;
597
597
  }
598
598
  }, [e, t, r, n, o, i, s, h, f, a, u]);
599
- L(() => {
600
- M && p.current(d.current, S.current);
601
- }, [M]), L(() => {
602
- !E && !M && J();
603
- }, [E, M, J]), c.current = n, L(() => {
604
- var b, $;
605
- M && T && ((b = D.current) == null || b.dispose(), D.current = ($ = d.current) == null ? void 0 : $.onDidChangeModelContent((_) => {
606
- q.current || T(d.current.getValue(), _);
599
+ I(() => {
600
+ S && p.current(d.current, M.current);
601
+ }, [S]), I(() => {
602
+ !E && !S && J();
603
+ }, [E, S, J]), c.current = n, I(() => {
604
+ var y, $;
605
+ S && N && ((y = T.current) == null || y.dispose(), T.current = ($ = d.current) == null ? void 0 : $.onDidChangeModelContent((_) => {
606
+ H.current || N(d.current.getValue(), _);
607
607
  }));
608
- }, [M, T]), L(() => {
609
- if (M) {
610
- let b = S.current.editor.onDidChangeMarkers(($) => {
608
+ }, [S, N]), I(() => {
609
+ if (S) {
610
+ let y = M.current.editor.onDidChangeMarkers(($) => {
611
611
  var Q;
612
612
  let _ = (Q = d.current.getModel()) == null ? void 0 : Q.uri;
613
613
  if (_ && $.find((Y) => Y.path === _.path)) {
614
- let Y = S.current.editor.getModelMarkers({ resource: _ });
614
+ let Y = M.current.editor.getModelMarkers({ resource: _ });
615
615
  x == null || x(Y);
616
616
  }
617
617
  });
618
618
  return () => {
619
- b == null || b.dispose();
619
+ y == null || y.dispose();
620
620
  };
621
621
  }
622
622
  return () => {
623
623
  };
624
- }, [M, x]);
624
+ }, [S, x]);
625
625
  function Ye() {
626
- var b, $;
627
- (b = D.current) == null || b.dispose(), m ? f && ae.set(i, d.current.saveViewState()) : ($ = d.current.getModel()) == null || $.dispose(), d.current.dispose();
626
+ var y, $;
627
+ (y = T.current) == null || y.dispose(), m ? f && ae.set(i, d.current.saveViewState()) : ($ = d.current.getModel()) == null || $.dispose(), d.current.dispose();
628
628
  }
629
- return K.createElement(Fe, { width: I, height: g, isEditorReady: M, loading: l, _ref: P, className: k, wrapperProps: C });
629
+ return K.createElement(Fe, { width: L, height: g, isEditorReady: S, loading: l, _ref: P, className: k, wrapperProps: C });
630
630
  }
631
- var pr = fr, mr = ye(pr), we = mr;
631
+ var pr = fr, mr = be(pr), Oe = mr;
632
632
  const le = {
633
633
  selectOnLineNumbers: !0,
634
634
  scrollBeyondLastLine: !1,
@@ -652,13 +652,13 @@ const le = {
652
652
  automaticLayout: !0
653
653
  }, de = (e) => {
654
654
  const { themeConfig: t, editor: r, theme: n } = e, { defaultTheme: o } = t ?? {}, [i, a] = V(n ?? o ?? "vs-dark");
655
- return L(() => {
655
+ return I(() => {
656
656
  var u;
657
- (u = t == null ? void 0 : t.themes) == null || u.forEach((l) => {
658
- z.editor.defineTheme(l.themeName, l.themeData);
657
+ (u = t == null ? void 0 : t.monacoThemes) == null || u.forEach((l) => {
658
+ R.editor.defineTheme(l.themeName, l.themeData);
659
659
  });
660
- }, [z]), L(() => {
661
- z.editor && n && (z.editor.setTheme(n), a(n));
660
+ }, [R]), I(() => {
661
+ R.editor && n && (R.editor.setTheme(n), a(n));
662
662
  }, [r, n]), { theme: i };
663
663
  };
664
664
  function hr(e) {
@@ -671,7 +671,29 @@ function hr(e) {
671
671
  function gr(e) {
672
672
  return e.replace("'", "&#39;");
673
673
  }
674
- function vr({
674
+ const vr = (e) => {
675
+ const t = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
676
+ if (e < 60)
677
+ return t.format(-e, "second");
678
+ const r = Math.floor(e / 60);
679
+ if (r < 60)
680
+ return t.format(-r, "minute");
681
+ const n = Math.floor(r / 60);
682
+ if (n < 24)
683
+ return t.format(-n, "hour");
684
+ const o = Math.floor(n / 24);
685
+ if (o < 30)
686
+ return t.format(-o, "day");
687
+ const i = Math.floor(o / 30);
688
+ if (i < 12)
689
+ return t.format(-i, "month");
690
+ const a = Math.floor(i / 12);
691
+ return t.format(-a, "year");
692
+ }, br = (e) => {
693
+ const t = new Date(e), n = Math.floor(((/* @__PURE__ */ new Date()).getTime() - t.getTime()) / 1e3), o = Math.abs(n);
694
+ return vr(o);
695
+ };
696
+ function yr({
675
697
  instanceId: e,
676
698
  lineNumbersPosition: t
677
699
  }) {
@@ -701,10 +723,10 @@ function vr({
701
723
 
702
724
  .monaco-editor-${e} .view-line .blame-editor-commit {
703
725
  display: inline-block;
704
- color: var(--canary-foreground-01);
726
+ color: var(--cn-text-1);
705
727
  }`, r;
706
728
  }
707
- function yr({
729
+ function wr({
708
730
  instanceId: e,
709
731
  blameData: t,
710
732
  dateWidth: r,
@@ -712,35 +734,35 @@ function yr({
712
734
  }) {
713
735
  let o = "";
714
736
  return t.forEach((i) => {
715
- var s, h, f, m, I, g, k, C;
716
- const a = (h = (s = i == null ? void 0 : i.commitInfo) == null ? void 0 : s.author) == null ? void 0 : h.avatarUrl, u = (m = (f = i == null ? void 0 : i.commitInfo) == null ? void 0 : f.author) == null ? void 0 : m.initials, l = a ? `background: url('${(g = (I = i == null ? void 0 : i.commitInfo) == null ? void 0 : I.author) == null ? void 0 : g.avatarUrl}');` : "";
717
- for (let w = i.fromLineNumber; w <= i.toLineNumber; w++)
718
- w === i.fromLineNumber ? o += `
719
- .monaco-editor-${e} .view-line .blame-editor-commit-${w}:before {
720
- content: '${gr(((C = (k = i == null ? void 0 : i.commitInfo) == null ? void 0 : k.author) == null ? void 0 : C.when) || "")}';
737
+ var s, h, f, m, L, g, k, C;
738
+ const a = (h = (s = i == null ? void 0 : i.commitInfo) == null ? void 0 : s.author) == null ? void 0 : h.avatarUrl, u = (m = (f = i == null ? void 0 : i.commitInfo) == null ? void 0 : f.author) == null ? void 0 : m.initials, l = a ? `background: url('${(g = (L = i == null ? void 0 : i.commitInfo) == null ? void 0 : L.author) == null ? void 0 : g.avatarUrl}');` : "";
739
+ for (let O = i.fromLineNumber; O <= i.toLineNumber; O++)
740
+ O === i.fromLineNumber ? o += `
741
+ .monaco-editor-${e} .view-line .blame-editor-commit-${O}:before {
742
+ content: '${gr(br(((C = (k = i == null ? void 0 : i.commitInfo) == null ? void 0 : k.author) == null ? void 0 : C.when) || ""))}';
721
743
  position: absolute;
722
744
  left: 10px;
723
745
  top: 0px;
724
- color: hsl(var(--canary-foreground-03));
746
+ color: var(--cn-text-3);
725
747
  }
726
748
 
727
- .monaco-editor-${e} .view-line .blame-editor-commit-${w}:after {
749
+ .monaco-editor-${e} .view-line .blame-editor-commit-${O}:after {
728
750
  content: '${u ?? " "}';
729
751
  position: absolute;
730
752
  border-radius: 50%;
731
753
  padding: 4px;
732
754
  text-align: center;
733
- background: hsl(var(--canary-background-11));
755
+ background: var(--cn-set-gray-soft-bg);
734
756
  line-height: 17px;
735
757
  left: ${r + 10}px;
736
758
  top: -4px;
737
- color: hsl(var(--canary-foreground-03));
759
+ color: var(--cn-text-3);
738
760
  width: ${n}px;
739
761
  height: ${n}px;
740
762
  ${l}
741
763
  background-size: 100% 100%;
742
764
  }` : o += `
743
- .monaco-editor-${e} .view-line .blame-editor-commit-${w}:before {
765
+ .monaco-editor-${e} .view-line .blame-editor-commit-${O}:before {
744
766
  content: ' ';
745
767
  left: 10px;
746
768
  top: 0px;
@@ -748,12 +770,12 @@ function yr({
748
770
  }`;
749
771
  }), o;
750
772
  }
751
- function br(e, t) {
773
+ function Or(e, t) {
752
774
  let r = "";
753
775
  return e.length > t ? r = e.slice(0, t - 3) + "..." : e.length < t ? r = e + " ".repeat(t - e.length) : r = e, " ".repeat(25) + r + " ".repeat(10);
754
776
  }
755
- W.config({ monaco: z });
756
- const he = 450, Or = 30, wr = 140, Sr = 24, Mr = {
777
+ W.config({ monaco: R });
778
+ const he = 450, Mr = 30, Sr = 140, jr = 24, Er = {
757
779
  ...le,
758
780
  readOnly: !0,
759
781
  matchBrackets: "never",
@@ -764,7 +786,7 @@ const he = 450, Or = 30, wr = 140, Sr = 24, Mr = {
764
786
  renderWhitespace: "none",
765
787
  renderLineHighlight: "none"
766
788
  };
767
- function zr({
789
+ function Hr({
768
790
  code: e,
769
791
  language: t,
770
792
  themeConfig: r,
@@ -775,26 +797,26 @@ function zr({
775
797
  height: u = "75vh",
776
798
  options: l
777
799
  }) {
778
- const s = O(o), h = O(hr(5));
800
+ const s = w(o), h = w(hr(5));
779
801
  se();
780
- const [f, m] = V(), [I, g] = V(0), k = O(null), C = O(null);
781
- L(() => {
802
+ const [f, m] = V(), [L, g] = V(0), k = w(null), C = w(null);
803
+ I(() => {
782
804
  s.current = o;
783
805
  }, [o]);
784
- function w() {
785
- const S = C.current, d = k.current;
786
- if (!S || !d)
806
+ function O() {
807
+ const M = C.current, d = k.current;
808
+ if (!M || !d)
787
809
  return;
788
- i && S.changeViewZones(function(p) {
810
+ i && M.changeViewZones(function(p) {
789
811
  p.addZone({
790
812
  afterLineNumber: 0,
791
813
  heightInPx: 10,
792
814
  domNode: document.createElement("div")
793
- }), s.current.forEach((N, D) => {
794
- if (D !== s.current.length - 1) {
815
+ }), s.current.forEach((D, T) => {
816
+ if (T !== s.current.length - 1) {
795
817
  const c = document.createElement("div");
796
- c.style.borderTop = "1px solid hsl(var(--canary-border-01))", c.style.marginTop = "9px", c.className = "blame-editor-separator", p.addZone({
797
- afterLineNumber: N.toLineNumber,
818
+ c.style.borderTop = "1px solid var(--cn-border-2)", c.style.marginTop = "9px", c.className = "blame-editor-separator", p.addZone({
819
+ afterLineNumber: D.toLineNumber,
798
820
  heightInPx: 20,
799
821
  domNode: c
800
822
  });
@@ -803,80 +825,80 @@ function zr({
803
825
  });
804
826
  const P = [];
805
827
  s.current.forEach((p) => {
806
- var N;
807
- for (let D = p.fromLineNumber; D <= p.toLineNumber; D++)
828
+ var D;
829
+ for (let T = p.fromLineNumber; T <= p.toLineNumber; T++)
808
830
  P.push({
809
- range: new d.Range(D, 0, D + 1, 0),
831
+ range: new d.Range(T, 0, T + 1, 0),
810
832
  options: {
811
833
  before: {
812
- content: br(
813
- D === p.fromLineNumber && ((N = p == null ? void 0 : p.commitInfo) == null ? void 0 : N.title) || "",
814
- Or
834
+ content: Or(
835
+ T === p.fromLineNumber && ((D = p == null ? void 0 : p.commitInfo) == null ? void 0 : D.title) || "",
836
+ Mr
815
837
  ),
816
838
  cursorStops: d.editor.InjectedTextCursorStops.None,
817
- inlineClassName: `blame-editor-commit blame-editor-commit-${D}`
839
+ inlineClassName: `blame-editor-commit blame-editor-commit-${T}`
818
840
  }
819
841
  }
820
842
  });
821
- }), S.createDecorationsCollection(P);
843
+ }), M.createDecorationsCollection(P);
822
844
  }
823
- function v(S, d) {
824
- var P, p, N, D, c, y;
825
- C.current = S, k.current = d, S.setValue(e), m(S), (N = (p = (P = d.languages.typescript) == null ? void 0 : P.typescriptDefaults) == null ? void 0 : p.setDiagnosticsOptions) == null || N.call(p, {
845
+ function v(M, d) {
846
+ var P, p, D, T, c, b;
847
+ C.current = M, k.current = d, M.setValue(e), m(M), (D = (p = (P = d.languages.typescript) == null ? void 0 : P.typescriptDefaults) == null ? void 0 : p.setDiagnosticsOptions) == null || D.call(p, {
826
848
  noSuggestionDiagnostics: !0,
827
849
  noSyntaxValidation: !0,
828
850
  noSemanticValidation: !0
829
- }), (y = (c = (D = d.languages.typescript) == null ? void 0 : D.javascriptDefaults) == null ? void 0 : c.setDiagnosticsOptions) == null || y.call(c, {
851
+ }), (b = (c = (T = d.languages.typescript) == null ? void 0 : T.javascriptDefaults) == null ? void 0 : c.setDiagnosticsOptions) == null || b.call(c, {
830
852
  noSuggestionDiagnostics: !0,
831
853
  noSyntaxValidation: !0,
832
854
  noSemanticValidation: !0
833
- }), w();
855
+ }), O();
834
856
  }
835
- L(() => {
857
+ I(() => {
836
858
  f == null || f.setValue(e);
837
859
  }, [e]);
838
- const { theme: T } = de({ monacoRef: k, themeConfig: r, editor: f, theme: a }), x = B(
839
- () => vr({
860
+ const { theme: N } = de({ monacoRef: k, themeConfig: r, editor: f, theme: a }), x = q(
861
+ () => yr({
840
862
  instanceId: h.current,
841
863
  lineNumbersPosition: n
842
864
  }),
843
865
  [o]
844
- ), M = B(
845
- () => yr({
866
+ ), S = q(
867
+ () => wr({
846
868
  instanceId: h.current,
847
869
  blameData: o,
848
- avatarSize: Sr,
849
- dateWidth: wr
870
+ avatarSize: jr,
871
+ dateWidth: Sr
850
872
  }),
851
873
  [o]
852
874
  );
853
- L(() => {
875
+ I(() => {
854
876
  if (n === "center") {
855
- const S = document.getElementsByClassName("lines-content")[0];
856
- if (S) {
857
- const d = { attributes: !0 }, P = (N) => {
858
- for (const D of N) {
859
- const c = parseInt(getComputedStyle(S).left);
877
+ const M = document.getElementsByClassName("lines-content")[0];
878
+ if (M) {
879
+ const d = { attributes: !0 }, P = (D) => {
880
+ for (const T of D) {
881
+ const c = parseInt(getComputedStyle(M).left);
860
882
  g(c);
861
883
  }
862
884
  }, p = new MutationObserver(P);
863
- return p.observe(S, d), () => {
885
+ return p.observe(M, d), () => {
864
886
  p.disconnect();
865
887
  };
866
888
  }
867
889
  }
868
890
  });
869
- const j = B(() => `
891
+ const j = q(() => `
870
892
  .monaco-editor-${h.current} .margin {
871
- left: ${he + 16 + I}px !important;
893
+ left: ${he + 16 + L}px !important;
872
894
  pointer-events: none;
873
- }`, [I]), E = `
895
+ }`, [L]), E = `
874
896
  .monaco-editor-${h.current} .view-overlays {
875
897
  clip-path: polygon(${he + 16}px 0, 100% 0%, 100% 100%, ${he + 16}px 100%);
876
898
  height:100% !important;
877
- }`, R = B(
899
+ }`, z = q(
878
900
  () => ({
879
- ...Mr,
901
+ ...Er,
880
902
  ...l
881
903
  }),
882
904
  [l]
@@ -886,28 +908,28 @@ function zr({
886
908
  "style",
887
909
  {
888
910
  dangerouslySetInnerHTML: {
889
- __html: `${x} ${M} ${j} ${E}`
911
+ __html: `${x} ${S} ${j} ${E}`
890
912
  }
891
913
  }
892
914
  ),
893
915
  /* @__PURE__ */ F.jsx(
894
- we,
916
+ Oe,
895
917
  {
896
918
  className: `monaco-editor-${h.current} overflow-hidden rounded-b-md border-x border-b`,
897
919
  height: u,
898
920
  language: t,
899
- theme: T,
900
- options: R,
921
+ theme: N,
922
+ options: z,
901
923
  onMount: v
902
924
  }
903
925
  )
904
926
  ] });
905
927
  }
906
- W.config({ monaco: z });
907
- const jr = {
928
+ W.config({ monaco: R });
929
+ const Pr = {
908
930
  ...le
909
931
  };
910
- function Rr({
932
+ function qr({
911
933
  codeRevision: e,
912
934
  onCodeRevisionChange: t,
913
935
  language: r,
@@ -918,14 +940,14 @@ function Rr({
918
940
  className: u
919
941
  }) {
920
942
  se();
921
- const [l, s] = V(), h = O(), f = O({ code: "", revisionId: 0 }), m = O(null), I = G(
922
- (C, w) => {
923
- var v, T, x, M, j, E;
924
- m.current = C, h.current = w, C.setValue(e.code), s(C), (x = (T = (v = w.languages.typescript) == null ? void 0 : v.typescriptDefaults) == null ? void 0 : T.setDiagnosticsOptions) == null || x.call(T, {
943
+ const [l, s] = V(), h = w(), f = w({ code: "", revisionId: 0 }), m = w(null), L = G(
944
+ (C, O) => {
945
+ var v, N, x, S, j, E;
946
+ m.current = C, h.current = O, C.setValue(e.code), s(C), (x = (N = (v = O.languages.typescript) == null ? void 0 : v.typescriptDefaults) == null ? void 0 : N.setDiagnosticsOptions) == null || x.call(N, {
925
947
  noSuggestionDiagnostics: !0,
926
948
  noSyntaxValidation: !0,
927
949
  noSemanticValidation: !0
928
- }), (E = (j = (M = w.languages.typescript) == null ? void 0 : M.javascriptDefaults) == null ? void 0 : j.setDiagnosticsOptions) == null || E.call(j, {
950
+ }), (E = (j = (S = O.languages.typescript) == null ? void 0 : S.javascriptDefaults) == null ? void 0 : j.setDiagnosticsOptions) == null || E.call(j, {
929
951
  noSuggestionDiagnostics: !0,
930
952
  noSyntaxValidation: !0,
931
953
  noSemanticValidation: !0
@@ -933,11 +955,11 @@ function Rr({
933
955
  },
934
956
  [e.code]
935
957
  );
936
- L(() => {
937
- var C, w;
958
+ I(() => {
959
+ var C, O;
938
960
  if (m.current && (!e.revisionId || e.revisionId > Number((C = f.current) == null ? void 0 : C.revisionId))) {
939
961
  const v = m.current.getModel();
940
- v && (o != null && o.readOnly ? (w = m.current) == null || w.setValue(e.code) : (m.current.pushUndoStop(), m.current.executeEdits("edit", [
962
+ v && (o != null && o.readOnly ? (O = m.current) == null || O.setValue(e.code) : (m.current.pushUndoStop(), m.current.executeEdits("edit", [
941
963
  {
942
964
  range: v.getFullModelRange(),
943
965
  text: e.code
@@ -945,24 +967,24 @@ function Rr({
945
967
  ]), m.current.pushUndoStop()));
946
968
  }
947
969
  }, [e, m.current]);
948
- const { theme: g } = de({ monacoRef: h, themeConfig: n, editor: l, theme: i }), k = B(() => ({ ...jr, ...o || {} }), [o]);
970
+ const { theme: g } = de({ monacoRef: h, themeConfig: n, editor: l, theme: i }), k = q(() => ({ ...Pr, ...o || {} }), [o]);
949
971
  return /* @__PURE__ */ F.jsx(F.Fragment, { children: /* @__PURE__ */ F.jsx(
950
- we,
972
+ Oe,
951
973
  {
952
974
  className: u,
953
975
  height: a,
954
- onChange: (C, w) => {
955
- f.current = { code: C ?? "", revisionId: w.versionId }, t({ ...f.current }, w);
976
+ onChange: (C, O) => {
977
+ f.current = { code: C ?? "", revisionId: O.versionId }, t({ ...f.current }, O);
956
978
  },
957
979
  language: r,
958
980
  theme: g,
959
981
  options: k,
960
- onMount: I
982
+ onMount: L
961
983
  }
962
984
  ) });
963
985
  }
964
- W.config({ monaco: z });
965
- const Er = {
986
+ W.config({ monaco: R });
987
+ const xr = {
966
988
  ...le,
967
989
  codeLens: !1,
968
990
  smartSelect: {
@@ -971,7 +993,7 @@ const Er = {
971
993
  originalEditable: !1,
972
994
  overviewRulerBorder: !1
973
995
  };
974
- function qr({
996
+ function Br({
975
997
  original: e,
976
998
  modified: t,
977
999
  language: r,
@@ -981,7 +1003,7 @@ function qr({
981
1003
  height: a = "75vh"
982
1004
  }) {
983
1005
  se();
984
- const [u, l] = V(), s = O(), { theme: h } = de({ monacoRef: s, themeConfig: n, editor: u, theme: i }), f = B(() => ({ ...Er, ...o || {} }), [o]);
1006
+ const [u, l] = V(), s = w(), { theme: h } = de({ monacoRef: s, themeConfig: n, editor: u, theme: i }), f = q(() => ({ ...xr, ...o || {} }), [o]);
985
1007
  return /* @__PURE__ */ F.jsx(F.Fragment, { children: /* @__PURE__ */ F.jsx(
986
1008
  ur,
987
1009
  {
@@ -996,14 +1018,14 @@ function qr({
996
1018
  }
997
1019
  ) });
998
1020
  }
999
- var Re = /* @__PURE__ */ ((e) => (e.ContainsPath = "ContainsPath", e))(Re || {});
1000
- function Pr(e) {
1021
+ var ze = /* @__PURE__ */ ((e) => (e.ContainsPath = "ContainsPath", e))(ze || {});
1022
+ function Cr(e) {
1001
1023
  const { pathSymbolMap: t, inlineActions: r = [], commandId: n } = e, o = Object.fromEntries(t.entries()), i = [];
1002
1024
  return r == null || r.forEach((a) => {
1003
1025
  const u = a.actions;
1004
1026
  a.selectors.forEach((s) => {
1005
1027
  switch (s.type) {
1006
- case Re.ContainsPath: {
1028
+ case ze.ContainsPath: {
1007
1029
  s.paths.forEach((h) => {
1008
1030
  let m = Object.keys(o).map((g) => ({
1009
1031
  fullPath: g,
@@ -1014,21 +1036,21 @@ function Pr(e) {
1014
1036
  ...g,
1015
1037
  path: g.path.substring(s.basePath.length)
1016
1038
  })), m.filter((g) => h.test(g.path)).forEach((g) => {
1017
- const k = g.fullPath, C = g.symbol, w = C.range;
1039
+ const k = g.fullPath, C = g.symbol, O = C.range;
1018
1040
  u.forEach((v) => {
1019
- const T = {
1020
- range: w,
1041
+ const N = {
1042
+ range: O,
1021
1043
  symbols: [C],
1022
1044
  onClick: v.onClick,
1023
1045
  data: v.data,
1024
1046
  path: k
1025
1047
  };
1026
1048
  i.push({
1027
- range: w,
1049
+ range: O,
1028
1050
  command: {
1029
1051
  id: n,
1030
1052
  title: v.title,
1031
- arguments: [T]
1053
+ arguments: [N]
1032
1054
  }
1033
1055
  });
1034
1056
  });
@@ -1050,38 +1072,38 @@ const te = class te {
1050
1072
  };
1051
1073
  je(te, "data", {});
1052
1074
  let ve = te;
1053
- async function qe(e) {
1075
+ async function He(e) {
1054
1076
  const t = ve.get(), { documentSymbolProvider: r } = t.StandaloneServices.get(t.ILanguageFeaturesService);
1055
1077
  return await t.OutlineModel.create(r, e);
1056
1078
  }
1057
- function Be(e) {
1079
+ function qe(e) {
1058
1080
  const t = /* @__PURE__ */ new Map();
1059
- return Se({
1081
+ return Me({
1060
1082
  pathSymbolMap: t,
1061
1083
  parentPath: "",
1062
1084
  children: e.children,
1063
1085
  parentKind: ge.SymbolKind.Module
1064
1086
  }), t;
1065
1087
  }
1066
- function Se(e) {
1088
+ function Me(e) {
1067
1089
  switch (e.parentKind) {
1068
1090
  case ge.SymbolKind.Module: {
1069
- xr(e);
1091
+ $r(e);
1070
1092
  break;
1071
1093
  }
1072
1094
  case ge.SymbolKind.Array: {
1073
- Cr(e);
1095
+ Ir(e);
1074
1096
  break;
1075
1097
  }
1076
1098
  default:
1077
- $r(e);
1099
+ Lr(e);
1078
1100
  }
1079
1101
  }
1080
- function xr(e) {
1102
+ function $r(e) {
1081
1103
  e.children.forEach((t) => {
1082
1104
  var n;
1083
1105
  let r = e.parentPath;
1084
- t.symbol && (r = e.parentPath ? `${e.parentPath}.${t.symbol.name}` : t.symbol.name, e.pathSymbolMap.set(r, t.symbol)), Se({
1106
+ t.symbol && (r = e.parentPath ? `${e.parentPath}.${t.symbol.name}` : t.symbol.name, e.pathSymbolMap.set(r, t.symbol)), Me({
1085
1107
  pathSymbolMap: e.pathSymbolMap,
1086
1108
  parentPath: r,
1087
1109
  children: t.children,
@@ -1089,11 +1111,11 @@ function xr(e) {
1089
1111
  });
1090
1112
  });
1091
1113
  }
1092
- function Cr(e) {
1114
+ function Ir(e) {
1093
1115
  let t = 0;
1094
1116
  e.children.forEach((r) => {
1095
1117
  const n = e.parentPath ? `${e.parentPath}.${t}` : `${t}`;
1096
- e.pathSymbolMap.set(n, r.symbol), t += 1, Se({
1118
+ e.pathSymbolMap.set(n, r.symbol), t += 1, Me({
1097
1119
  pathSymbolMap: e.pathSymbolMap,
1098
1120
  parentPath: n,
1099
1121
  children: r.children,
@@ -1101,44 +1123,44 @@ function Cr(e) {
1101
1123
  });
1102
1124
  });
1103
1125
  }
1104
- function $r(e) {
1126
+ function Lr(e) {
1105
1127
  const t = e.children.get("0");
1106
1128
  if (t) {
1107
1129
  const r = e.parentPath ? `${e.parentPath}.${t.symbol.name}` : t == null ? void 0 : t.symbol.name;
1108
1130
  e.pathSymbolMap.set(r, t.symbol);
1109
1131
  }
1110
1132
  }
1111
- function Lr({
1133
+ function Tr({
1112
1134
  editorRef: e,
1113
1135
  inlineActions: t
1114
1136
  }) {
1115
- L(() => z.languages.registerCodeLensProvider("yaml", {
1137
+ I(() => R.languages.registerCodeLensProvider("yaml", {
1116
1138
  provideCodeLenses: async (n) => {
1117
1139
  var l;
1118
- const o = await qe(n), i = Be(o), a = (l = e == null ? void 0 : e.current) == null ? void 0 : l.addCommand(0, (s, { onClick: h, path: f, range: m, data: I }) => {
1119
- h({ path: f, range: m, data: I });
1140
+ const o = await He(n), i = qe(o), a = (l = e == null ? void 0 : e.current) == null ? void 0 : l.addCommand(0, (s, { onClick: h, path: f, range: m, data: L }) => {
1141
+ h({ path: f, range: m, data: L });
1120
1142
  });
1121
1143
  return a ? {
1122
- lenses: Pr({ pathSymbolMap: i, inlineActions: t, commandId: a }),
1144
+ lenses: Cr({ pathSymbolMap: i, inlineActions: t, commandId: a }),
1123
1145
  dispose: () => {
1124
1146
  }
1125
1147
  } : void 0;
1126
1148
  }
1127
1149
  }).dispose, [t, e]);
1128
1150
  }
1129
- const Ir = ({ editorRef: e, selection: t }) => {
1130
- const [r, n] = V(), o = B(
1151
+ const Dr = ({ editorRef: e, selection: t }) => {
1152
+ const [r, n] = V(), o = q(
1131
1153
  () => async (i, a, u) => {
1132
- var m, I, g;
1154
+ var m, L, g;
1133
1155
  const l = (m = e == null ? void 0 : e.current) == null ? void 0 : m.getModel();
1134
1156
  if (!l || !a)
1135
1157
  return n(void 0);
1136
- const s = await qe(l), f = (I = Be(s).get(a)) == null ? void 0 : I.range;
1158
+ const s = await He(l), f = (L = qe(s).get(a)) == null ? void 0 : L.range;
1137
1159
  f && (n(f), u && ((g = e == null ? void 0 : e.current) == null || g.revealLineInCenter(f.startLineNumber)));
1138
1160
  },
1139
1161
  []
1140
1162
  );
1141
- L(() => {
1163
+ I(() => {
1142
1164
  if ("requestIdleCallback" in window) {
1143
1165
  const i = requestIdleCallback(() => {
1144
1166
  o(e, t == null ? void 0 : t.path, t == null ? void 0 : t.revealInCenter);
@@ -1150,7 +1172,7 @@ const Ir = ({ editorRef: e, selection: t }) => {
1150
1172
  }, 100);
1151
1173
  return () => clearTimeout(i);
1152
1174
  }
1153
- }, [t == null ? void 0 : t.path, t == null ? void 0 : t.revealInCenter, e, o]), L(() => {
1175
+ }, [t == null ? void 0 : t.path, t == null ? void 0 : t.revealInCenter, e, o]), I(() => {
1154
1176
  var a;
1155
1177
  if (!r)
1156
1178
  return;
@@ -1166,7 +1188,7 @@ const Ir = ({ editorRef: e, selection: t }) => {
1166
1188
  ]);
1167
1189
  return () => i == null ? void 0 : i.clear();
1168
1190
  }, [r, e, t == null ? void 0 : t.className]);
1169
- }, He = Je({
1191
+ }, Be = Je({
1170
1192
  markers: [],
1171
1193
  setMarkers: () => {
1172
1194
  },
@@ -1176,7 +1198,7 @@ const Ir = ({ editorRef: e, selection: t }) => {
1176
1198
  updateCursorPosition: (e) => {
1177
1199
  }
1178
1200
  });
1179
- function Br({
1201
+ function Wr({
1180
1202
  children: e
1181
1203
  }) {
1182
1204
  const [t, r] = V([]), [n, o] = V(null), i = G(
@@ -1186,7 +1208,7 @@ function Br({
1186
1208
  [n]
1187
1209
  );
1188
1210
  return /* @__PURE__ */ F.jsx(
1189
- He.Provider,
1211
+ Be.Provider,
1190
1212
  {
1191
1213
  value: {
1192
1214
  markers: t,
@@ -1200,11 +1222,11 @@ function Br({
1200
1222
  );
1201
1223
  }
1202
1224
  function We() {
1203
- return Qe(He);
1225
+ return Qe(Be);
1204
1226
  }
1205
- const Dr = ({ monacoRef: e, editorRef: t, instanceId: r }) => {
1227
+ const Nr = ({ monacoRef: e, editorRef: t, instanceId: r }) => {
1206
1228
  const { setMarkers: n } = We();
1207
- L(() => {
1229
+ I(() => {
1208
1230
  let o;
1209
1231
  const i = setTimeout(() => {
1210
1232
  var u;
@@ -1216,7 +1238,7 @@ const Dr = ({ monacoRef: e, editorRef: t, instanceId: r }) => {
1216
1238
  return;
1217
1239
  const h = s.uri.toString();
1218
1240
  if (l.some((m) => m.toString() === h)) {
1219
- const m = z.editor.getModelMarkers({ resource: s.uri });
1241
+ const m = R.editor.getModelMarkers({ resource: s.uri });
1220
1242
  n(m);
1221
1243
  }
1222
1244
  }));
@@ -1226,14 +1248,14 @@ const Dr = ({ monacoRef: e, editorRef: t, instanceId: r }) => {
1226
1248
  };
1227
1249
  }, [e, r, n]);
1228
1250
  };
1229
- function Nr(e) {
1251
+ function kr(e) {
1230
1252
  var n, o;
1231
- const t = ((o = (n = be) == null ? void 0 : n.diagnosticsOptions) == null ? void 0 : o.schemas) ?? [], r = t.findIndex((i) => i.fileMatch[0] === e.fileMatch[0]);
1253
+ const t = ((o = (n = ye) == null ? void 0 : n.diagnosticsOptions) == null ? void 0 : o.schemas) ?? [], r = t.findIndex((i) => i.fileMatch[0] === e.fileMatch[0]);
1232
1254
  r !== -1 ? t[r] = e : t.push(e), Ke(t);
1233
1255
  }
1234
- function Tr(e) {
1256
+ function Ar(e) {
1235
1257
  var n, o;
1236
- const r = (((o = (n = be) == null ? void 0 : n.diagnosticsOptions) == null ? void 0 : o.schemas) ?? []).filter((i) => i.fileMatch[0] !== Me(e));
1258
+ const r = (((o = (n = ye) == null ? void 0 : n.diagnosticsOptions) == null ? void 0 : o.schemas) ?? []).filter((i) => i.fileMatch[0] !== Se(e));
1237
1259
  Ke(r);
1238
1260
  }
1239
1261
  function Ke(e) {
@@ -1244,25 +1266,25 @@ function Ke(e) {
1244
1266
  validate: !0,
1245
1267
  schemas: e
1246
1268
  };
1247
- be.setDiagnosticsOptions({ ...t });
1269
+ ye.setDiagnosticsOptions({ ...t });
1248
1270
  }
1249
- const Me = (e) => Xe.parse(`file://${e}`).toString(), kr = (e) => {
1271
+ const Se = (e) => Xe.parse(`file://${e}`).toString(), Vr = (e) => {
1250
1272
  const { schemaConfig: t, instanceId: r } = e;
1251
- L(() => {
1273
+ I(() => {
1252
1274
  if (t != null && t.schema)
1253
- return Nr({
1254
- fileMatch: [Me(r.toString())],
1275
+ return kr({
1276
+ fileMatch: [Se(r.toString())],
1255
1277
  ...t
1256
1278
  }), () => {
1257
- Tr(r);
1279
+ Ar(r);
1258
1280
  };
1259
1281
  }, [t == null ? void 0 : t.schema, r]);
1260
1282
  };
1261
- W.config({ monaco: z });
1262
- const Ar = {
1283
+ W.config({ monaco: R });
1284
+ const _r = {
1263
1285
  ...le,
1264
1286
  folding: !0
1265
- }, Hr = function(t) {
1287
+ }, Kr = function(t) {
1266
1288
  const {
1267
1289
  yamlRevision: r,
1268
1290
  schemaConfig: n,
@@ -1275,40 +1297,40 @@ const Ar = {
1275
1297
  animateOnUpdate: h = !1,
1276
1298
  onAnimateEnd: f,
1277
1299
  instanceId: m
1278
- } = t, I = se(), [g] = V(m ?? `yaml-editor-${Math.random()}`), { editor: k, setEditor: C } = We(), w = O(null), v = O(), T = O({ yaml: "", revisionId: 0 }), x = O(null), M = O(null), j = G(
1300
+ } = t, L = se(), [g] = V(m ?? `yaml-editor-${Math.random()}`), { editor: k, setEditor: C } = We(), O = w(null), v = w(), N = w({ yaml: "", revisionId: 0 }), x = w(null), S = w(null), j = G(
1279
1301
  (P) => {
1280
- var D, c, y;
1302
+ var T, c, b;
1281
1303
  const p = P.split(`
1282
- `), N = (D = x.current) == null ? void 0 : D.getModel();
1283
- if (N) {
1284
- (c = x.current) == null || c.pushUndoStop(), N.setValue("");
1304
+ `), D = (T = x.current) == null ? void 0 : T.getModel();
1305
+ if (D) {
1306
+ (c = x.current) == null || c.pushUndoStop(), D.setValue("");
1285
1307
  let A = 0;
1286
- M.current = window.setInterval(() => {
1287
- var q;
1288
- A < p.length ? (I && ((q = x.current) == null || q.executeEdits("addLine", [
1308
+ S.current = window.setInterval(() => {
1309
+ var H;
1310
+ A < p.length ? (L && ((H = x.current) == null || H.executeEdits("addLine", [
1289
1311
  {
1290
- range: new I.Range(A + 1, 1, A + 1, 1),
1312
+ range: new L.Range(A + 1, 1, A + 1, 1),
1291
1313
  text: p[A] + `
1292
1314
  `
1293
1315
  }
1294
- ])), A++) : M.current && (clearInterval(M.current), f == null || f());
1295
- }, 100), (y = x.current) == null || y.pushUndoStop();
1316
+ ])), A++) : S.current && (clearInterval(S.current), f == null || f());
1317
+ }, 100), (b = x.current) == null || b.pushUndoStop();
1296
1318
  }
1297
1319
  },
1298
- [I]
1320
+ [L]
1299
1321
  );
1300
- L(() => () => {
1301
- M.current && clearInterval(M.current);
1322
+ I(() => () => {
1323
+ S.current && clearInterval(S.current);
1302
1324
  }, []);
1303
1325
  function E(P, p) {
1304
1326
  x.current = P, v.current = p, P.setValue(r.yaml), C(P), setTimeout(() => {
1305
- var N;
1306
- (N = w.current) != null && N.style && (w.current.style.opacity = "1");
1327
+ var D;
1328
+ (D = O.current) != null && D.style && (O.current.style.opacity = "1");
1307
1329
  }, 50);
1308
1330
  }
1309
- L(() => {
1331
+ I(() => {
1310
1332
  var P;
1311
- if (x.current && (!r.revisionId || r.revisionId > Number((P = T.current) == null ? void 0 : P.revisionId))) {
1333
+ if (x.current && (!r.revisionId || r.revisionId > Number((P = N.current) == null ? void 0 : P.revisionId))) {
1312
1334
  const p = x.current.getModel();
1313
1335
  p && (x.current.executeEdits("edit", [
1314
1336
  {
@@ -1317,39 +1339,39 @@ const Ar = {
1317
1339
  }
1318
1340
  ]), h && j(r.yaml));
1319
1341
  }
1320
- }, [j, r, h]), kr({ schemaConfig: n, instanceId: g }), Lr({ editorRef: x, inlineActions: o });
1321
- const { theme: R } = de({ monacoRef: v, themeConfig: i, editor: k, theme: l });
1322
- Dr({ monacoRef: v, editorRef: x, instanceId: g }), Ir({ editorRef: x, selection: u });
1323
- const S = B(() => Me(g), []), d = B(
1342
+ }, [j, r, h]), Vr({ schemaConfig: n, instanceId: g }), Tr({ editorRef: x, inlineActions: o });
1343
+ const { theme: z } = de({ monacoRef: v, themeConfig: i, editor: k, theme: l });
1344
+ Nr({ monacoRef: v, editorRef: x, instanceId: g }), Dr({ editorRef: x, selection: u });
1345
+ const M = q(() => Se(g), []), d = q(
1324
1346
  () => ({
1325
- ...Ar,
1347
+ ..._r,
1326
1348
  ...s
1327
1349
  }),
1328
1350
  [s]
1329
1351
  );
1330
- return /* @__PURE__ */ F.jsx("div", { style: { width: "100%", height: "100%", opacity: 0 }, ref: w, children: /* @__PURE__ */ F.jsx(
1331
- we,
1352
+ return /* @__PURE__ */ F.jsx("div", { style: { width: "100%", height: "100%", opacity: 0 }, ref: O, children: /* @__PURE__ */ F.jsx(
1353
+ Oe,
1332
1354
  {
1333
1355
  onChange: (P, p) => {
1334
- T.current = { yaml: P ?? "", revisionId: p.versionId }, a({ ...T.current }, p);
1356
+ N.current = { yaml: P ?? "", revisionId: p.versionId }, a({ ...N.current }, p);
1335
1357
  },
1336
1358
  language: "yaml",
1337
- theme: R,
1359
+ theme: z,
1338
1360
  options: d,
1339
- path: S,
1361
+ path: M,
1340
1362
  onMount: E
1341
1363
  }
1342
1364
  ) });
1343
1365
  };
1344
1366
  export {
1345
- zr as BlameEditor,
1346
- qr as CodeDiffEditor,
1347
- Rr as CodeEditor,
1367
+ Hr as BlameEditor,
1368
+ Br as CodeDiffEditor,
1369
+ qr as CodeEditor,
1348
1370
  ve as MonacoGlobals,
1349
- Re as SelectorType,
1350
- Hr as YamlEditor,
1351
- He as YamlEditorContext,
1352
- Br as YamlEditorContextProvider,
1371
+ ze as SelectorType,
1372
+ Kr as YamlEditor,
1373
+ Be as YamlEditorContext,
1374
+ Wr as YamlEditorContextProvider,
1353
1375
  We as useYamlEditorContext
1354
1376
  };
1355
1377
  //# sourceMappingURL=index.js.map