@harnessio/yaml-editor 0.18.0 → 0.19.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.
@@ -31,5 +31,6 @@ export interface YamlEditorProps<T> {
31
31
  };
32
32
  animateOnUpdate?: boolean;
33
33
  onAnimateEnd?: () => void;
34
+ instanceId?: string;
34
35
  }
35
36
  export declare const YamlEditor: <T>(props: YamlEditorProps<T>) => JSX.Element;
@@ -2,6 +2,8 @@ import { RefObject } from 'react';
2
2
 
3
3
  import * as monaco from 'monaco-editor';
4
4
  export type UseProblems = (arg: {
5
+ instanceId?: string;
5
6
  monacoRef: RefObject<typeof monaco | undefined>;
7
+ editorRef: RefObject<monaco.editor.IStandaloneCodeEditor | null | undefined>;
6
8
  }) => void;
7
9
  export declare const useProblems: UseProblems;
package/dist/index.cjs CHANGED
@@ -1,16 +1,16 @@
1
- "use strict";var Fe=Object.defineProperty;var qe=(e,t,r)=>t in e?Fe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ye=(e,t,r)=>(qe(e,typeof t!="symbol"?t+"":t,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react"),J=require("monaco-editor"),Ye=require("monaco-yaml");function Be(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const V=Be(J);var $e={exports:{}},X={};/*
1
+ "use strict";var qe=Object.defineProperty;var Be=(e,t,r)=>t in e?qe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Se=(e,t,r)=>(Be(e,typeof t!="symbol"?t+"":t,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react"),J=require("monaco-editor"),pe=require("monaco-yaml");function Ye(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const V=Ye(J);var Le={exports:{}},X={};/*
2
2
  object-assign
3
3
  (c) Sindre Sorhus
4
4
  @license MIT
5
- */var Oe=Object.getOwnPropertySymbols,He=Object.prototype.hasOwnProperty,We=Object.prototype.propertyIsEnumerable;function Ke(e){if(e==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function Ge(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de",Object.getOwnPropertyNames(e)[0]==="5")return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;var n=Object.getOwnPropertyNames(t).map(function(a){return t[a]});if(n.join("")!=="0123456789")return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(a){o[a]=a}),Object.keys(Object.assign({},o)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}Ge();/** @license React v17.0.2
5
+ */var we=Object.getOwnPropertySymbols,He=Object.prototype.hasOwnProperty,We=Object.prototype.propertyIsEnumerable;function Ke(e){if(e==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function Ge(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de",Object.getOwnPropertyNames(e)[0]==="5")return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;var n=Object.getOwnPropertyNames(t).map(function(a){return t[a]});if(n.join("")!=="0123456789")return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(a){o[a]=a}),Object.keys(Object.assign({},o)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}Ge();/** @license React v17.0.2
6
6
  * react-jsx-runtime.production.min.js
7
7
  *
8
8
  * Copyright (c) Facebook, Inc. and its affiliates.
9
9
  *
10
10
  * This source code is licensed under the MIT license found in the
11
11
  * LICENSE file in the root directory of this source tree.
12
- */var Ze=i,Le=60103;X.Fragment=60107;if(typeof Symbol=="function"&&Symbol.for){var Se=Symbol.for;Le=Se("react.element"),X.Fragment=Se("react.fragment")}var Je=Ze.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Qe=Object.prototype.hasOwnProperty,Xe={key:!0,ref:!0,__self:!0,__source:!0};function De(e,t,r){var n,o={},a=null,c=null;r!==void 0&&(a=""+r),t.key!==void 0&&(a=""+t.key),t.ref!==void 0&&(c=t.ref);for(n in t)Qe.call(t,n)&&!Xe.hasOwnProperty(n)&&(o[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)o[n]===void 0&&(o[n]=t[n]);return{$$typeof:Le,type:e,key:a,ref:c,props:o,_owner:Je.current}}X.jsx=De;X.jsxs=De;$e.exports=X;var _=$e.exports;function et(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function we(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Me(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?we(Object(r),!0).forEach(function(n){et(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):we(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function tt(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,a;for(a=0;a<n.length;a++)o=n[a],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}function rt(e,t){if(e==null)return{};var r=tt(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function nt(e,t){return ot(e)||at(e,t)||it(e,t)||ct()}function ot(e){if(Array.isArray(e))return e}function at(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var r=[],n=!0,o=!1,a=void 0;try{for(var c=e[Symbol.iterator](),l;!(n=(l=c.next()).done)&&(r.push(l.value),!(t&&r.length===t));n=!0);}catch(d){o=!0,a=d}finally{try{!n&&c.return!=null&&c.return()}finally{if(o)throw a}}return r}}function it(e,t){if(e){if(typeof e=="string")return Ee(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ee(e,t)}}function Ee(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ct(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
13
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ut(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function je(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Pe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?je(Object(r),!0).forEach(function(n){ut(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):je(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function st(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(n){return t.reduceRight(function(o,a){return a(o)},n)}}function K(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return o.length>=e.length?e.apply(this,o):function(){for(var c=arguments.length,l=new Array(c),d=0;d<c;d++)l[d]=arguments[d];return t.apply(r,[].concat(o,l))}}}function ne(e){return{}.toString.call(e).includes("Object")}function lt(e){return!Object.keys(e).length}function Q(e){return typeof e=="function"}function dt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ft(e,t){return ne(t)||z("changeType"),Object.keys(t).some(function(r){return!dt(e,r)})&&z("changeField"),t}function pt(e){Q(e)||z("selectorType")}function mt(e){Q(e)||ne(e)||z("handlerType"),ne(e)&&Object.values(e).some(function(t){return!Q(t)})&&z("handlersType")}function gt(e){e||z("initialIsRequired"),ne(e)||z("initialType"),lt(e)&&z("initialContent")}function ht(e,t){throw new Error(e[t]||e.default)}var vt={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},z=K(ht)(vt),te={changes:ft,selector:pt,handler:mt,initial:gt};function bt(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};te.initial(e),te.handler(t);var r={current:e},n=K(St)(r,t),o=K(Ot)(r),a=K(te.changes)(e),c=K(yt)(r);function l(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(y){return y};return te.selector(p),p(r.current)}function d(p){st(n,o,a,c)(p)}return[l,d]}function yt(e,t){return Q(t)?t(e.current):t}function Ot(e,t){return e.current=Pe(Pe({},e.current),t),t}function St(e,t,r){return Q(t)?t(e.current):Object.keys(r).forEach(function(n){var o;return(o=t[n])===null||o===void 0?void 0:o.call(t,e.current[n])}),r}var wt={create:bt},Mt={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs"}};function Et(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return o.length>=e.length?e.apply(this,o):function(){for(var c=arguments.length,l=new Array(c),d=0;d<c;d++)l[d]=arguments[d];return t.apply(r,[].concat(o,l))}}}function jt(e){return{}.toString.call(e).includes("Object")}function Pt(e){return e||Ce("configIsRequired"),jt(e)||Ce("configType"),e.urls?(Ct(),{paths:{vs:e.urls.monacoBase}}):e}function Ct(){console.warn(Re.deprecation)}function xt(e,t){throw new Error(e[t]||e.default)}var Re={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
12
+ */var Ze=i,De=60103;X.Fragment=60107;if(typeof Symbol=="function"&&Symbol.for){var Me=Symbol.for;De=Me("react.element"),X.Fragment=Me("react.fragment")}var Je=Ze.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Qe=Object.prototype.hasOwnProperty,Xe={key:!0,ref:!0,__self:!0,__source:!0};function Ie(e,t,r){var n,o={},a=null,c=null;r!==void 0&&(a=""+r),t.key!==void 0&&(a=""+t.key),t.ref!==void 0&&(c=t.ref);for(n in t)Qe.call(t,n)&&!Xe.hasOwnProperty(n)&&(o[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)o[n]===void 0&&(o[n]=t[n]);return{$$typeof:De,type:e,key:a,ref:c,props:o,_owner:Je.current}}X.jsx=Ie;X.jsxs=Ie;Le.exports=X;var A=Le.exports;function et(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ee(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function je(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ee(Object(r),!0).forEach(function(n){et(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ee(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function tt(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,a;for(a=0;a<n.length;a++)o=n[a],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}function rt(e,t){if(e==null)return{};var r=tt(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function nt(e,t){return ot(e)||at(e,t)||it(e,t)||ct()}function ot(e){if(Array.isArray(e))return e}function at(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var r=[],n=!0,o=!1,a=void 0;try{for(var c=e[Symbol.iterator](),s;!(n=(s=c.next()).done)&&(r.push(s.value),!(t&&r.length===t));n=!0);}catch(d){o=!0,a=d}finally{try{!n&&c.return!=null&&c.return()}finally{if(o)throw a}}return r}}function it(e,t){if(e){if(typeof e=="string")return Pe(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Pe(e,t)}}function Pe(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ct(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
13
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ut(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ce(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function xe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ce(Object(r),!0).forEach(function(n){ut(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ce(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function st(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(n){return t.reduceRight(function(o,a){return a(o)},n)}}function K(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return o.length>=e.length?e.apply(this,o):function(){for(var c=arguments.length,s=new Array(c),d=0;d<c;d++)s[d]=arguments[d];return t.apply(r,[].concat(o,s))}}}function ne(e){return{}.toString.call(e).includes("Object")}function lt(e){return!Object.keys(e).length}function Q(e){return typeof e=="function"}function dt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ft(e,t){return ne(t)||F("changeType"),Object.keys(t).some(function(r){return!dt(e,r)})&&F("changeField"),t}function pt(e){Q(e)||F("selectorType")}function mt(e){Q(e)||ne(e)||F("handlerType"),ne(e)&&Object.values(e).some(function(t){return!Q(t)})&&F("handlersType")}function gt(e){e||F("initialIsRequired"),ne(e)||F("initialType"),lt(e)&&F("initialContent")}function ht(e,t){throw new Error(e[t]||e.default)}var vt={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},F=K(ht)(vt),te={changes:ft,selector:pt,handler:mt,initial:gt};function bt(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};te.initial(e),te.handler(t);var r={current:e},n=K(St)(r,t),o=K(Ot)(r),a=K(te.changes)(e),c=K(yt)(r);function s(){var l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(h){return h};return te.selector(l),l(r.current)}function d(l){st(n,o,a,c)(l)}return[s,d]}function yt(e,t){return Q(t)?t(e.current):t}function Ot(e,t){return e.current=xe(xe({},e.current),t),t}function St(e,t,r){return Q(t)?t(e.current):Object.keys(r).forEach(function(n){var o;return(o=t[n])===null||o===void 0?void 0:o.call(t,e.current[n])}),r}var wt={create:bt},Mt={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs"}};function Et(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return o.length>=e.length?e.apply(this,o):function(){for(var c=arguments.length,s=new Array(c),d=0;d<c;d++)s[d]=arguments[d];return t.apply(r,[].concat(o,s))}}}function jt(e){return{}.toString.call(e).includes("Object")}function Pt(e){return e||$e("configIsRequired"),jt(e)||$e("configType"),e.urls?(Ct(),{paths:{vs:e.urls.monacoBase}}):e}function Ct(){console.warn(Re.deprecation)}function xt(e,t){throw new Error(e[t]||e.default)}var Re={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
14
14
  You are using deprecated way of configuration.
15
15
 
16
16
  Instead of using
@@ -19,7 +19,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
19
19
  monaco.config({ paths: { vs: '...' } })
20
20
 
21
21
  For more please check the link https://github.com/suren-atoyan/monaco-loader#config
22
- `},Ce=Et(xt)(Re),$t={config:Pt},Lt=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return function(o){return r.reduceRight(function(a,c){return c(a)},o)}};function Te(e,t){return Object.keys(t).forEach(function(r){t[r]instanceof Object&&e[r]&&Object.assign(t[r],Te(e[r],t[r]))}),Me(Me({},e),t)}var Dt={type:"cancelation",msg:"operation is manually canceled"};function se(e){var t=!1,r=new Promise(function(n,o){e.then(function(a){return t?o(Dt):n(a)}),e.catch(o)});return r.cancel=function(){return t=!0},r}var Rt=wt.create({config:Mt,isInitialized:!1,resolve:null,reject:null,monaco:null}),Ie=nt(Rt,2),ee=Ie[0],ae=Ie[1];function Tt(e){var t=$t.config(e),r=t.monaco,n=rt(t,["monaco"]);ae(function(o){return{config:Te(o.config,n),monaco:r}})}function It(){var e=ee(function(t){var r=t.monaco,n=t.isInitialized,o=t.resolve;return{monaco:r,isInitialized:n,resolve:o}});if(!e.isInitialized){if(ae({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),se(le);if(window.monaco&&window.monaco.editor)return Ne(window.monaco),e.resolve(window.monaco),se(le);Lt(Nt,_t)(At)}return se(le)}function Nt(e){return document.body.appendChild(e)}function kt(e){var t=document.createElement("script");return e&&(t.src=e),t}function _t(e){var t=ee(function(n){var o=n.config,a=n.reject;return{config:o,reject:a}}),r=kt("".concat(t.config.paths.vs,"/loader.js"));return r.onload=function(){return e()},r.onerror=t.reject,r}function At(){var e=ee(function(r){var n=r.config,o=r.resolve,a=r.reject;return{config:n,resolve:o,reject:a}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(r){Ne(r),e.resolve(r)},function(r){e.reject(r)})}function Ne(e){ee().monaco||ae({monaco:e})}function Vt(){return ee(function(e){var t=e.monaco;return t})}var le=new Promise(function(e,t){return ae({resolve:e,reject:t})}),F={config:Tt,init:It,__getMonacoInstance:Vt},Ut={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},de=Ut,zt={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},Ft=zt;function qt({children:e}){return i.createElement("div",{style:Ft.container},e)}var Yt=qt,Bt=Yt;function Ht({width:e,height:t,isEditorReady:r,loading:n,_ref:o,className:a,wrapperProps:c}){return i.createElement("section",{style:{...de.wrapper,width:e,height:t},...c},!r&&i.createElement(Bt,null,n),i.createElement("div",{ref:o,style:{...de.fullWidth,...!r&&de.hide},className:a}))}var Wt=Ht,ke=i.memo(Wt);function Kt(e){i.useEffect(e,[])}var pe=Kt;function Gt(e,t,r=!0){let n=i.useRef(!0);i.useEffect(n.current||!r?()=>{n.current=!1}:e,t)}var k=Gt;function G(){}function B(e,t,r,n){return Zt(e,n)||Jt(e,t,r,n)}function Zt(e,t){return e.editor.getModel(_e(e,t))}function Jt(e,t,r,n){return e.editor.createModel(t,r,n?_e(e,n):void 0)}function _e(e,t){return e.Uri.parse(t)}function Qt({original:e,modified:t,language:r,originalLanguage:n,modifiedLanguage:o,originalModelPath:a,modifiedModelPath:c,keepCurrentOriginalModel:l=!1,keepCurrentModifiedModel:d=!1,theme:p="light",loading:y="Loading...",options:m={},height:g="100%",width:L="100%",className:O,wrapperProps:I={},beforeMount:M=G,onMount:S=G}){let[h,E]=i.useState(!1),[R,j]=i.useState(!0),P=i.useRef(null),w=i.useRef(null),A=i.useRef(null),f=i.useRef(S),s=i.useRef(M),D=i.useRef(!1);pe(()=>{let u=F.init();return u.then(v=>(w.current=v)&&j(!1)).catch(v=>(v==null?void 0:v.type)!=="cancelation"&&console.error("Monaco initialization: error:",v)),()=>P.current?$():u.cancel()}),k(()=>{if(P.current&&w.current){let u=P.current.getOriginalEditor(),v=B(w.current,e||"",n||r||"text",a||"");v!==u.getModel()&&u.setModel(v)}},[a],h),k(()=>{if(P.current&&w.current){let u=P.current.getModifiedEditor(),v=B(w.current,t||"",o||r||"text",c||"");v!==u.getModel()&&u.setModel(v)}},[c],h),k(()=>{let u=P.current.getModifiedEditor();u.getOption(w.current.editor.EditorOption.readOnly)?u.setValue(t||""):t!==u.getValue()&&(u.executeEdits("",[{range:u.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),u.pushUndoStop())},[t],h),k(()=>{var u,v;(v=(u=P.current)==null?void 0:u.getModel())==null||v.original.setValue(e||"")},[e],h),k(()=>{let{original:u,modified:v}=P.current.getModel();w.current.editor.setModelLanguage(u,n||r||"text"),w.current.editor.setModelLanguage(v,o||r||"text")},[r,n,o],h),k(()=>{var u;(u=w.current)==null||u.editor.setTheme(p)},[p],h),k(()=>{var u;(u=P.current)==null||u.updateOptions(m)},[m],h);let C=i.useCallback(()=>{var U;if(!w.current)return;s.current(w.current);let u=B(w.current,e||"",n||r||"text",a||""),v=B(w.current,t||"",o||r||"text",c||"");(U=P.current)==null||U.setModel({original:u,modified:v})},[r,t,o,e,n,a,c]),T=i.useCallback(()=>{var u;!D.current&&A.current&&(P.current=w.current.editor.createDiffEditor(A.current,{automaticLayout:!0,...m}),C(),(u=w.current)==null||u.editor.setTheme(p),E(!0),D.current=!0)},[m,p,C]);i.useEffect(()=>{h&&f.current(P.current,w.current)},[h]),i.useEffect(()=>{!R&&!h&&T()},[R,h,T]);function $(){var v,U,q,H;let u=(v=P.current)==null?void 0:v.getModel();l||((U=u==null?void 0:u.original)==null||U.dispose()),d||((q=u==null?void 0:u.modified)==null||q.dispose()),(H=P.current)==null||H.dispose()}return i.createElement(ke,{width:L,height:g,isEditorReady:h,loading:y,_ref:A,className:O,wrapperProps:I})}var Xt=Qt,er=i.memo(Xt);function tr(){let[e,t]=i.useState(F.__getMonacoInstance());return pe(()=>{let r;return e||(r=F.init(),r.then(n=>{t(n)})),()=>r==null?void 0:r.cancel()}),e}var ie=tr;function rr(e){let t=i.useRef();return i.useEffect(()=>{t.current=e},[e]),t.current}var nr=rr,re=new Map;function or({defaultValue:e,defaultLanguage:t,defaultPath:r,value:n,language:o,path:a,theme:c="light",line:l,loading:d="Loading...",options:p={},overrideServices:y={},saveViewState:m=!0,keepCurrentModel:g=!1,width:L="100%",height:O="100%",className:I,wrapperProps:M={},beforeMount:S=G,onMount:h=G,onChange:E,onValidate:R=G}){let[j,P]=i.useState(!1),[w,A]=i.useState(!0),f=i.useRef(null),s=i.useRef(null),D=i.useRef(null),C=i.useRef(h),T=i.useRef(S),$=i.useRef(),u=i.useRef(n),v=nr(a),U=i.useRef(!1),q=i.useRef(!1);pe(()=>{let b=F.init();return b.then(x=>(f.current=x)&&A(!1)).catch(x=>(x==null?void 0:x.type)!=="cancelation"&&console.error("Monaco initialization: error:",x)),()=>s.current?ze():b.cancel()}),k(()=>{var x,N,W,Y;let b=B(f.current,e||n||"",t||o||"",a||r||"");b!==((x=s.current)==null?void 0:x.getModel())&&(m&&re.set(v,(N=s.current)==null?void 0:N.saveViewState()),(W=s.current)==null||W.setModel(b),m&&((Y=s.current)==null||Y.restoreViewState(re.get(a))))},[a],j),k(()=>{var b;(b=s.current)==null||b.updateOptions(p)},[p],j),k(()=>{!s.current||n===void 0||(s.current.getOption(f.current.editor.EditorOption.readOnly)?s.current.setValue(n):n!==s.current.getValue()&&(q.current=!0,s.current.executeEdits("",[{range:s.current.getModel().getFullModelRange(),text:n,forceMoveMarkers:!0}]),s.current.pushUndoStop(),q.current=!1))},[n],j),k(()=>{var x,N;let b=(x=s.current)==null?void 0:x.getModel();b&&o&&((N=f.current)==null||N.editor.setModelLanguage(b,o))},[o],j),k(()=>{var b;l!==void 0&&((b=s.current)==null||b.revealLine(l))},[l],j),k(()=>{var b;(b=f.current)==null||b.editor.setTheme(c)},[c],j);let H=i.useCallback(()=>{var b;if(!(!D.current||!f.current)&&!U.current){T.current(f.current);let x=a||r,N=B(f.current,n||e||"",t||o||"",x||"");s.current=(b=f.current)==null?void 0:b.editor.create(D.current,{model:N,automaticLayout:!0,...p},y),m&&s.current.restoreViewState(re.get(x)),f.current.editor.setTheme(c),l!==void 0&&s.current.revealLine(l),P(!0),U.current=!0}},[e,t,r,n,o,a,p,y,m,c,l]);i.useEffect(()=>{j&&C.current(s.current,f.current)},[j]),i.useEffect(()=>{!w&&!j&&H()},[w,j,H]),u.current=n,i.useEffect(()=>{var b,x;j&&E&&((b=$.current)==null||b.dispose(),$.current=(x=s.current)==null?void 0:x.onDidChangeModelContent(N=>{q.current||E(s.current.getValue(),N)}))},[j,E]),i.useEffect(()=>{if(j){let b=f.current.editor.onDidChangeMarkers(x=>{var W;let N=(W=s.current.getModel())==null?void 0:W.uri;if(N&&x.find(Y=>Y.path===N.path)){let Y=f.current.editor.getModelMarkers({resource:N});R==null||R(Y)}});return()=>{b==null||b.dispose()}}return()=>{}},[j,R]);function ze(){var b,x;(b=$.current)==null||b.dispose(),g?m&&re.set(a,s.current.saveViewState()):(x=s.current.getModel())==null||x.dispose(),s.current.dispose()}return i.createElement(ke,{width:L,height:O,isEditorReady:j,loading:d,_ref:D,className:I,wrapperProps:M})}var ar=or,ir=i.memo(ar),me=ir;const ce={selectOnLineNumbers:!0,scrollBeyondLastLine:!1,padding:{top:16,bottom:16},minimap:{enabled:!1},fontSize:13,fontFamily:'"JetBrains Mono", "monospace"',lineHeight:20,scrollbar:{verticalScrollbarSize:14,horizontalScrollbarSize:14,verticalSliderSize:6,horizontalSliderSize:6},overviewRulerBorder:!1,overviewRulerLanes:0,renderLineHighlight:"none"},ue=e=>{const{themeConfig:t,editor:r,theme:n}=e,{defaultTheme:o}=t??{},[a,c]=i.useState(n??o??"vs-dark");return i.useEffect(()=>{var l;(l=t==null?void 0:t.themes)==null||l.forEach(d=>{V.editor.defineTheme(d.themeName,d.themeData)})},[V]),i.useEffect(()=>{V.editor&&n&&(V.editor.setTheme(n),c(n))},[r,n]),{theme:a}};function cr(e){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let r="";for(let n=0;n<e;n++)r+=t.charAt(Math.floor(Math.random()*t.length));return r}function ur(e){return e.replace("'","&#39;")}function sr({instanceId:e,lineNumbersPosition:t}){let r="";return t==="center"&&(r+=`
22
+ `},$e=Et(xt)(Re),$t={config:Pt},Lt=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return function(o){return r.reduceRight(function(a,c){return c(a)},o)}};function Te(e,t){return Object.keys(t).forEach(function(r){t[r]instanceof Object&&e[r]&&Object.assign(t[r],Te(e[r],t[r]))}),je(je({},e),t)}var Dt={type:"cancelation",msg:"operation is manually canceled"};function se(e){var t=!1,r=new Promise(function(n,o){e.then(function(a){return t?o(Dt):n(a)}),e.catch(o)});return r.cancel=function(){return t=!0},r}var It=wt.create({config:Mt,isInitialized:!1,resolve:null,reject:null,monaco:null}),Ne=nt(It,2),ee=Ne[0],ae=Ne[1];function Rt(e){var t=$t.config(e),r=t.monaco,n=rt(t,["monaco"]);ae(function(o){return{config:Te(o.config,n),monaco:r}})}function Tt(){var e=ee(function(t){var r=t.monaco,n=t.isInitialized,o=t.resolve;return{monaco:r,isInitialized:n,resolve:o}});if(!e.isInitialized){if(ae({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),se(le);if(window.monaco&&window.monaco.editor)return ke(window.monaco),e.resolve(window.monaco),se(le);Lt(Nt,_t)(At)}return se(le)}function Nt(e){return document.body.appendChild(e)}function kt(e){var t=document.createElement("script");return e&&(t.src=e),t}function _t(e){var t=ee(function(n){var o=n.config,a=n.reject;return{config:o,reject:a}}),r=kt("".concat(t.config.paths.vs,"/loader.js"));return r.onload=function(){return e()},r.onerror=t.reject,r}function At(){var e=ee(function(r){var n=r.config,o=r.resolve,a=r.reject;return{config:n,resolve:o,reject:a}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(r){ke(r),e.resolve(r)},function(r){e.reject(r)})}function ke(e){ee().monaco||ae({monaco:e})}function Vt(){return ee(function(e){var t=e.monaco;return t})}var le=new Promise(function(e,t){return ae({resolve:e,reject:t})}),q={config:Rt,init:Tt,__getMonacoInstance:Vt},Ut={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},de=Ut,zt={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},Ft=zt;function qt({children:e}){return i.createElement("div",{style:Ft.container},e)}var Bt=qt,Yt=Bt;function Ht({width:e,height:t,isEditorReady:r,loading:n,_ref:o,className:a,wrapperProps:c}){return i.createElement("section",{style:{...de.wrapper,width:e,height:t},...c},!r&&i.createElement(Yt,null,n),i.createElement("div",{ref:o,style:{...de.fullWidth,...!r&&de.hide},className:a}))}var Wt=Ht,_e=i.memo(Wt);function Kt(e){i.useEffect(e,[])}var me=Kt;function Gt(e,t,r=!0){let n=i.useRef(!0);i.useEffect(n.current||!r?()=>{n.current=!1}:e,t)}var _=Gt;function G(){}function Y(e,t,r,n){return Zt(e,n)||Jt(e,t,r,n)}function Zt(e,t){return e.editor.getModel(Ae(e,t))}function Jt(e,t,r,n){return e.editor.createModel(t,r,n?Ae(e,n):void 0)}function Ae(e,t){return e.Uri.parse(t)}function Qt({original:e,modified:t,language:r,originalLanguage:n,modifiedLanguage:o,originalModelPath:a,modifiedModelPath:c,keepCurrentOriginalModel:s=!1,keepCurrentModifiedModel:d=!1,theme:l="light",loading:h="Loading...",options:p={},height:g="100%",width:L="100%",className:v,wrapperProps:T={},beforeMount:x=G,onMount:S=G}){let[b,R]=i.useState(!1),[C,M]=i.useState(!0),E=i.useRef(null),j=i.useRef(null),U=i.useRef(null),w=i.useRef(S),f=i.useRef(x),P=i.useRef(!1);me(()=>{let u=q.init();return u.then(y=>(j.current=y)&&M(!1)).catch(y=>(y==null?void 0:y.type)!=="cancelation"&&console.error("Monaco initialization: error:",y)),()=>E.current?D():u.cancel()}),_(()=>{if(E.current&&j.current){let u=E.current.getOriginalEditor(),y=Y(j.current,e||"",n||r||"text",a||"");y!==u.getModel()&&u.setModel(y)}},[a],b),_(()=>{if(E.current&&j.current){let u=E.current.getModifiedEditor(),y=Y(j.current,t||"",o||r||"text",c||"");y!==u.getModel()&&u.setModel(y)}},[c],b),_(()=>{let u=E.current.getModifiedEditor();u.getOption(j.current.editor.EditorOption.readOnly)?u.setValue(t||""):t!==u.getValue()&&(u.executeEdits("",[{range:u.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),u.pushUndoStop())},[t],b),_(()=>{var u,y;(y=(u=E.current)==null?void 0:u.getModel())==null||y.original.setValue(e||"")},[e],b),_(()=>{let{original:u,modified:y}=E.current.getModel();j.current.editor.setModelLanguage(u,n||r||"text"),j.current.editor.setModelLanguage(y,o||r||"text")},[r,n,o],b),_(()=>{var u;(u=j.current)==null||u.editor.setTheme(l)},[l],b),_(()=>{var u;(u=E.current)==null||u.updateOptions(p)},[p],b);let m=i.useCallback(()=>{var N;if(!j.current)return;f.current(j.current);let u=Y(j.current,e||"",n||r||"text",a||""),y=Y(j.current,t||"",o||r||"text",c||"");(N=E.current)==null||N.setModel({original:u,modified:y})},[r,t,o,e,n,a,c]),I=i.useCallback(()=>{var u;!P.current&&U.current&&(E.current=j.current.editor.createDiffEditor(U.current,{automaticLayout:!0,...p}),m(),(u=j.current)==null||u.editor.setTheme(l),R(!0),P.current=!0)},[p,l,m]);i.useEffect(()=>{b&&w.current(E.current,j.current)},[b]),i.useEffect(()=>{!C&&!b&&I()},[C,b,I]);function D(){var y,N,z,H;let u=(y=E.current)==null?void 0:y.getModel();s||((N=u==null?void 0:u.original)==null||N.dispose()),d||((z=u==null?void 0:u.modified)==null||z.dispose()),(H=E.current)==null||H.dispose()}return i.createElement(_e,{width:L,height:g,isEditorReady:b,loading:h,_ref:U,className:v,wrapperProps:T})}var Xt=Qt,er=i.memo(Xt);function tr(){let[e,t]=i.useState(q.__getMonacoInstance());return me(()=>{let r;return e||(r=q.init(),r.then(n=>{t(n)})),()=>r==null?void 0:r.cancel()}),e}var ie=tr;function rr(e){let t=i.useRef();return i.useEffect(()=>{t.current=e},[e]),t.current}var nr=rr,re=new Map;function or({defaultValue:e,defaultLanguage:t,defaultPath:r,value:n,language:o,path:a,theme:c="light",line:s,loading:d="Loading...",options:l={},overrideServices:h={},saveViewState:p=!0,keepCurrentModel:g=!1,width:L="100%",height:v="100%",className:T,wrapperProps:x={},beforeMount:S=G,onMount:b=G,onChange:R,onValidate:C=G}){let[M,E]=i.useState(!1),[j,U]=i.useState(!0),w=i.useRef(null),f=i.useRef(null),P=i.useRef(null),m=i.useRef(b),I=i.useRef(S),D=i.useRef(),u=i.useRef(n),y=nr(a),N=i.useRef(!1),z=i.useRef(!1);me(()=>{let O=q.init();return O.then($=>(w.current=$)&&U(!1)).catch($=>($==null?void 0:$.type)!=="cancelation"&&console.error("Monaco initialization: error:",$)),()=>f.current?Fe():O.cancel()}),_(()=>{var $,k,W,B;let O=Y(w.current,e||n||"",t||o||"",a||r||"");O!==(($=f.current)==null?void 0:$.getModel())&&(p&&re.set(y,(k=f.current)==null?void 0:k.saveViewState()),(W=f.current)==null||W.setModel(O),p&&((B=f.current)==null||B.restoreViewState(re.get(a))))},[a],M),_(()=>{var O;(O=f.current)==null||O.updateOptions(l)},[l],M),_(()=>{!f.current||n===void 0||(f.current.getOption(w.current.editor.EditorOption.readOnly)?f.current.setValue(n):n!==f.current.getValue()&&(z.current=!0,f.current.executeEdits("",[{range:f.current.getModel().getFullModelRange(),text:n,forceMoveMarkers:!0}]),f.current.pushUndoStop(),z.current=!1))},[n],M),_(()=>{var $,k;let O=($=f.current)==null?void 0:$.getModel();O&&o&&((k=w.current)==null||k.editor.setModelLanguage(O,o))},[o],M),_(()=>{var O;s!==void 0&&((O=f.current)==null||O.revealLine(s))},[s],M),_(()=>{var O;(O=w.current)==null||O.editor.setTheme(c)},[c],M);let H=i.useCallback(()=>{var O;if(!(!P.current||!w.current)&&!N.current){I.current(w.current);let $=a||r,k=Y(w.current,n||e||"",t||o||"",$||"");f.current=(O=w.current)==null?void 0:O.editor.create(P.current,{model:k,automaticLayout:!0,...l},h),p&&f.current.restoreViewState(re.get($)),w.current.editor.setTheme(c),s!==void 0&&f.current.revealLine(s),E(!0),N.current=!0}},[e,t,r,n,o,a,l,h,p,c,s]);i.useEffect(()=>{M&&m.current(f.current,w.current)},[M]),i.useEffect(()=>{!j&&!M&&H()},[j,M,H]),u.current=n,i.useEffect(()=>{var O,$;M&&R&&((O=D.current)==null||O.dispose(),D.current=($=f.current)==null?void 0:$.onDidChangeModelContent(k=>{z.current||R(f.current.getValue(),k)}))},[M,R]),i.useEffect(()=>{if(M){let O=w.current.editor.onDidChangeMarkers($=>{var W;let k=(W=f.current.getModel())==null?void 0:W.uri;if(k&&$.find(B=>B.path===k.path)){let B=w.current.editor.getModelMarkers({resource:k});C==null||C(B)}});return()=>{O==null||O.dispose()}}return()=>{}},[M,C]);function Fe(){var O,$;(O=D.current)==null||O.dispose(),g?p&&re.set(a,f.current.saveViewState()):($=f.current.getModel())==null||$.dispose(),f.current.dispose()}return i.createElement(_e,{width:L,height:v,isEditorReady:M,loading:d,_ref:P,className:T,wrapperProps:x})}var ar=or,ir=i.memo(ar),ge=ir;const ce={selectOnLineNumbers:!0,scrollBeyondLastLine:!1,padding:{top:16,bottom:16},minimap:{enabled:!1},fontSize:14,fontFamily:'"JetBrains Mono", "monospace"',lineHeight:20,scrollbar:{verticalScrollbarSize:14,horizontalScrollbarSize:14,verticalSliderSize:6,horizontalSliderSize:6},overviewRulerBorder:!1,overviewRulerLanes:0,renderLineHighlight:"none",automaticLayout:!0},ue=e=>{const{themeConfig:t,editor:r,theme:n}=e,{defaultTheme:o}=t??{},[a,c]=i.useState(n??o??"vs-dark");return i.useEffect(()=>{var s;(s=t==null?void 0:t.themes)==null||s.forEach(d=>{V.editor.defineTheme(d.themeName,d.themeData)})},[V]),i.useEffect(()=>{V.editor&&n&&(V.editor.setTheme(n),c(n))},[r,n]),{theme:a}};function cr(e){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let r="";for(let n=0;n<e;n++)r+=t.charAt(Math.floor(Math.random()*t.length));return r}function ur(e){return e.replace("'","&#39;")}function sr({instanceId:e,lineNumbersPosition:t}){let r="";return t==="center"&&(r+=`
23
23
  .monaco-editor-${e} .monaco-scrollable-element.editor-scrollable {
24
24
  width: 100% !important;
25
25
  left: 0px !important;
@@ -45,9 +45,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
45
45
  .monaco-editor-${e} .view-line .blame-editor-commit {
46
46
  display: inline-block;
47
47
  color: var(--canary-foreground-01);
48
- }`,r}function lr({instanceId:e,blameData:t,dateWidth:r,avatarSize:n}){let o="";return t.forEach(a=>{var p,y,m,g,L,O,I,M;const c=(y=(p=a==null?void 0:a.commitInfo)==null?void 0:p.author)==null?void 0:y.avatarUrl,l=(g=(m=a==null?void 0:a.commitInfo)==null?void 0:m.author)==null?void 0:g.initials,d=c?`background: url('${(O=(L=a==null?void 0:a.commitInfo)==null?void 0:L.author)==null?void 0:O.avatarUrl}');`:"";for(let S=a.fromLineNumber;S<=a.toLineNumber;S++)S===a.fromLineNumber?o+=`
48
+ }`,r}function lr({instanceId:e,blameData:t,dateWidth:r,avatarSize:n}){let o="";return t.forEach(a=>{var l,h,p,g,L,v,T,x;const c=(h=(l=a==null?void 0:a.commitInfo)==null?void 0:l.author)==null?void 0:h.avatarUrl,s=(g=(p=a==null?void 0:a.commitInfo)==null?void 0:p.author)==null?void 0:g.initials,d=c?`background: url('${(v=(L=a==null?void 0:a.commitInfo)==null?void 0:L.author)==null?void 0:v.avatarUrl}');`:"";for(let S=a.fromLineNumber;S<=a.toLineNumber;S++)S===a.fromLineNumber?o+=`
49
49
  .monaco-editor-${e} .view-line .blame-editor-commit-${S}:before {
50
- content: '${ur(((M=(I=a==null?void 0:a.commitInfo)==null?void 0:I.author)==null?void 0:M.when)||"")}';
50
+ content: '${ur(((x=(T=a==null?void 0:a.commitInfo)==null?void 0:T.author)==null?void 0:x.when)||"")}';
51
51
  position: absolute;
52
52
  left: 10px;
53
53
  top: 0px;
@@ -55,7 +55,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
55
55
  }
56
56
 
57
57
  .monaco-editor-${e} .view-line .blame-editor-commit-${S}:after {
58
- content: '${l??" "}';
58
+ content: '${s??" "}';
59
59
  position: absolute;
60
60
  border-radius: 50%;
61
61
  padding: 4px;
@@ -75,15 +75,15 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
75
75
  left: 10px;
76
76
  top: 0px;
77
77
  color: gray;
78
- }`}),o}function dr(e,t){let r="";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)}F.config({monaco:V});const fe=450,fr=30,pr=140,mr=24,gr={...ce,readOnly:!0,matchBrackets:"never",renderValidationDecorations:"off",guides:{indentation:!1},folding:!1,stickyScroll:{enabled:!1},renderWhitespace:"none",renderLineHighlight:"none"};function hr({code:e,language:t,themeConfig:r,lineNumbersPosition:n="left",blameData:o,showSeparators:a=!0,theme:c,height:l="75vh",options:d}){const p=i.useRef(o),y=i.useRef(cr(5));ie();const[m,g]=i.useState(),[L,O]=i.useState(0),I=i.useRef(null),M=i.useRef(null);i.useEffect(()=>{p.current=o},[o]);function S(){const f=M.current,s=I.current;if(!f||!s)return;a&&f.changeViewZones(function(C){C.addZone({afterLineNumber:0,heightInPx:10,domNode:document.createElement("div")}),p.current.forEach((T,$)=>{if($!==p.current.length-1){const u=document.createElement("div");u.style.borderTop="1px solid hsl(var(--canary-border-01))",u.style.marginTop="9px",u.className="blame-editor-separator",C.addZone({afterLineNumber:T.toLineNumber,heightInPx:20,domNode:u})}})});const D=[];p.current.forEach(C=>{var T;for(let $=C.fromLineNumber;$<=C.toLineNumber;$++)D.push({range:new s.Range($,0,$+1,0),options:{before:{content:dr($===C.fromLineNumber&&((T=C==null?void 0:C.commitInfo)==null?void 0:T.title)||"",fr),cursorStops:s.editor.InjectedTextCursorStops.None,inlineClassName:`blame-editor-commit blame-editor-commit-${$}`}}})}),f.createDecorationsCollection(D)}function h(f,s){var D,C,T,$,u,v;M.current=f,I.current=s,f.setValue(e),g(f),(T=(C=(D=s.languages.typescript)==null?void 0:D.typescriptDefaults)==null?void 0:C.setDiagnosticsOptions)==null||T.call(C,{noSuggestionDiagnostics:!0,noSyntaxValidation:!0,noSemanticValidation:!0}),(v=(u=($=s.languages.typescript)==null?void 0:$.javascriptDefaults)==null?void 0:u.setDiagnosticsOptions)==null||v.call(u,{noSuggestionDiagnostics:!0,noSyntaxValidation:!0,noSemanticValidation:!0}),S()}i.useEffect(()=>{m==null||m.setValue(e)},[e]);const{theme:E}=ue({monacoRef:I,themeConfig:r,editor:m,theme:c}),R=i.useMemo(()=>sr({instanceId:y.current,lineNumbersPosition:n}),[o]),j=i.useMemo(()=>lr({instanceId:y.current,blameData:o,avatarSize:mr,dateWidth:pr}),[o]);i.useEffect(()=>{if(n==="center"){const f=document.getElementsByClassName("lines-content")[0];if(f){const s={attributes:!0},D=T=>{for(const $ of T){const u=parseInt(getComputedStyle(f).left);O(u)}},C=new MutationObserver(D);return C.observe(f,s),()=>{C.disconnect()}}}});const P=i.useMemo(()=>`
79
- .monaco-editor-${y.current} .margin {
78
+ }`}),o}function dr(e,t){let r="";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)}q.config({monaco:V});const fe=450,fr=30,pr=140,mr=24,gr={...ce,readOnly:!0,matchBrackets:"never",renderValidationDecorations:"off",guides:{indentation:!1},folding:!1,stickyScroll:{enabled:!1},renderWhitespace:"none",renderLineHighlight:"none"};function hr({code:e,language:t,themeConfig:r,lineNumbersPosition:n="left",blameData:o,showSeparators:a=!0,theme:c,height:s="75vh",options:d}){const l=i.useRef(o),h=i.useRef(cr(5));ie();const[p,g]=i.useState(),[L,v]=i.useState(0),T=i.useRef(null),x=i.useRef(null);i.useEffect(()=>{l.current=o},[o]);function S(){const w=x.current,f=T.current;if(!w||!f)return;a&&w.changeViewZones(function(m){m.addZone({afterLineNumber:0,heightInPx:10,domNode:document.createElement("div")}),l.current.forEach((I,D)=>{if(D!==l.current.length-1){const u=document.createElement("div");u.style.borderTop="1px solid hsl(var(--canary-border-01))",u.style.marginTop="9px",u.className="blame-editor-separator",m.addZone({afterLineNumber:I.toLineNumber,heightInPx:20,domNode:u})}})});const P=[];l.current.forEach(m=>{var I;for(let D=m.fromLineNumber;D<=m.toLineNumber;D++)P.push({range:new f.Range(D,0,D+1,0),options:{before:{content:dr(D===m.fromLineNumber&&((I=m==null?void 0:m.commitInfo)==null?void 0:I.title)||"",fr),cursorStops:f.editor.InjectedTextCursorStops.None,inlineClassName:`blame-editor-commit blame-editor-commit-${D}`}}})}),w.createDecorationsCollection(P)}function b(w,f){var P,m,I,D,u,y;x.current=w,T.current=f,w.setValue(e),g(w),(I=(m=(P=f.languages.typescript)==null?void 0:P.typescriptDefaults)==null?void 0:m.setDiagnosticsOptions)==null||I.call(m,{noSuggestionDiagnostics:!0,noSyntaxValidation:!0,noSemanticValidation:!0}),(y=(u=(D=f.languages.typescript)==null?void 0:D.javascriptDefaults)==null?void 0:u.setDiagnosticsOptions)==null||y.call(u,{noSuggestionDiagnostics:!0,noSyntaxValidation:!0,noSemanticValidation:!0}),S()}i.useEffect(()=>{p==null||p.setValue(e)},[e]);const{theme:R}=ue({monacoRef:T,themeConfig:r,editor:p,theme:c}),C=i.useMemo(()=>sr({instanceId:h.current,lineNumbersPosition:n}),[o]),M=i.useMemo(()=>lr({instanceId:h.current,blameData:o,avatarSize:mr,dateWidth:pr}),[o]);i.useEffect(()=>{if(n==="center"){const w=document.getElementsByClassName("lines-content")[0];if(w){const f={attributes:!0},P=I=>{for(const D of I){const u=parseInt(getComputedStyle(w).left);v(u)}},m=new MutationObserver(P);return m.observe(w,f),()=>{m.disconnect()}}}});const E=i.useMemo(()=>`
79
+ .monaco-editor-${h.current} .margin {
80
80
  left: ${fe+16+L}px !important;
81
81
  pointer-events: none;
82
- }`,[L]),w=`
83
- .monaco-editor-${y.current} .view-overlays {
82
+ }`,[L]),j=`
83
+ .monaco-editor-${h.current} .view-overlays {
84
84
  clip-path: polygon(${fe+16}px 0, 100% 0%, 100% 100%, ${fe+16}px 100%);
85
85
  height:100% !important;
86
- }`,A=i.useMemo(()=>({...gr,...d}),[d]);return _.jsxs(_.Fragment,{children:[_.jsx("style",{dangerouslySetInnerHTML:{__html:`${R} ${j} ${P} ${w}`}}),_.jsx(me,{className:`monaco-editor-${y.current} overflow-hidden rounded-b-md border-x border-b`,height:l,language:t,theme:E,options:A,onMount:h})]})}F.config({monaco:V});const vr={...ce};function br({codeRevision:e,onCodeRevisionChange:t,language:r,themeConfig:n,options:o,theme:a,height:c="75vh",className:l}){ie();const[d,p]=i.useState(),y=i.useRef(),m=i.useRef({code:"",revisionId:0}),g=i.useRef(null),L=i.useCallback((M,S)=>{var h,E,R,j,P,w;g.current=M,y.current=S,M.setValue(e.code),p(M),(R=(E=(h=S.languages.typescript)==null?void 0:h.typescriptDefaults)==null?void 0:E.setDiagnosticsOptions)==null||R.call(E,{noSuggestionDiagnostics:!0,noSyntaxValidation:!0,noSemanticValidation:!0}),(w=(P=(j=S.languages.typescript)==null?void 0:j.javascriptDefaults)==null?void 0:P.setDiagnosticsOptions)==null||w.call(P,{noSuggestionDiagnostics:!0,noSyntaxValidation:!0,noSemanticValidation:!0})},[e.code]);i.useEffect(()=>{var M,S;if(g.current&&(!e.revisionId||e.revisionId>Number((M=m.current)==null?void 0:M.revisionId))){const h=g.current.getModel();h&&(o!=null&&o.readOnly?(S=g.current)==null||S.setValue(e.code):(g.current.pushUndoStop(),g.current.executeEdits("edit",[{range:h.getFullModelRange(),text:e.code}]),g.current.pushUndoStop()))}},[e,g.current]);const{theme:O}=ue({monacoRef:y,themeConfig:n,editor:d,theme:a}),I=i.useMemo(()=>({...vr,...o||{}}),[o]);return _.jsx(_.Fragment,{children:_.jsx(me,{className:l,height:c,onChange:(M,S)=>{m.current={code:M??"",revisionId:S.versionId},t({...m.current},S)},language:r,theme:O,options:I,onMount:L})})}F.config({monaco:V});const yr={...ce,codeLens:!1,smartSelect:{selectLeadingAndTrailingWhitespace:!0},originalEditable:!1,overviewRulerBorder:!1};function Or({original:e,modified:t,language:r,themeConfig:n,options:o,theme:a,height:c="75vh"}){ie();const[l,d]=i.useState(),p=i.useRef(),{theme:y}=ue({monacoRef:p,themeConfig:n,editor:l,theme:a}),m=i.useMemo(()=>({...yr,...o||{}}),[o]);return _.jsx(_.Fragment,{children:_.jsx(er,{className:"overflow-hidden rounded-b-md border-x border-b",language:r,theme:y,original:e,modified:t,height:c,options:m,onMount:d})})}var ge=(e=>(e.ContainsPath="ContainsPath",e))(ge||{});function Sr(e){const{pathSymbolMap:t,inlineActions:r=[],commandId:n}=e,o=Object.fromEntries(t.entries()),a=[];return r==null||r.forEach(c=>{const l=c.actions;c.selectors.forEach(p=>{switch(p.type){case ge.ContainsPath:{p.paths.forEach(y=>{let g=Object.keys(o).map(O=>({fullPath:O,path:O,symbol:o[O]})).filter(O=>O.path.startsWith(p.basePath));g=g.map(O=>({...O,path:O.path.substring(p.basePath.length)})),g.filter(O=>y.test(O.path)).forEach(O=>{const I=O.fullPath,M=O.symbol,S=M.range;l.forEach(h=>{const E={range:S,symbols:[M],onClick:h.onClick,data:h.data,path:I};a.push({range:S,command:{id:n,title:h.title,arguments:[E]}})})})});break}}})}),a}const Z=class Z{static set(t){Z.data=t}static get(){return Z.data}};ye(Z,"data",{});let oe=Z;async function Ae(e){const t=oe.get(),{documentSymbolProvider:r}=t.StandaloneServices.get(t.ILanguageFeaturesService);return await t.OutlineModel.create(r,e)}function Ve(e){const t=new Map;return he({pathSymbolMap:t,parentPath:"",children:e.children,parentKind:J.languages.SymbolKind.Module}),t}function he(e){switch(e.parentKind){case J.languages.SymbolKind.Module:{wr(e);break}case J.languages.SymbolKind.Array:{Mr(e);break}default:Er(e)}}function wr(e){e.children.forEach(t=>{var n;let r=e.parentPath;t.symbol&&(r=e.parentPath?`${e.parentPath}.${t.symbol.name}`:t.symbol.name,e.pathSymbolMap.set(r,t.symbol)),he({pathSymbolMap:e.pathSymbolMap,parentPath:r,children:t.children,parentKind:((n=t==null?void 0:t.symbol)==null?void 0:n.kind)??e.parentKind})})}function Mr(e){let t=0;e.children.forEach(r=>{const n=e.parentPath?`${e.parentPath}.${t}`:`${t}`;e.pathSymbolMap.set(n,r.symbol),t+=1,he({pathSymbolMap:e.pathSymbolMap,parentPath:n,children:r.children,parentKind:r.symbol.kind})})}function Er(e){const t=e.children.get("0");if(t){const r=e.parentPath?`${e.parentPath}.${t.symbol.name}`:t==null?void 0:t.symbol.name;e.pathSymbolMap.set(r,t.symbol)}}function jr({editorRef:e,inlineActions:t}){i.useEffect(()=>V.languages.registerCodeLensProvider("yaml",{provideCodeLenses:async n=>{var d;const o=await Ae(n),a=Ve(o),c=(d=e==null?void 0:e.current)==null?void 0:d.addCommand(0,(p,{onClick:y,path:m,range:g,data:L})=>{y({path:m,range:g,data:L})});return c?{lenses:Sr({pathSymbolMap:a,inlineActions:t,commandId:c}),dispose:()=>{}}:void 0}}).dispose,[t,e])}const Pr=({editorRef:e,selection:t})=>{const[r,n]=i.useState(),o=i.useMemo(()=>async(a,c,l)=>{var g,L,O;const d=(g=e==null?void 0:e.current)==null?void 0:g.getModel();if(!d||!c)return n(void 0);const p=await Ae(d),m=(L=Ve(p).get(c))==null?void 0:L.range;m&&(n(m),l&&((O=e==null?void 0:e.current)==null||O.revealLineInCenter(m.startLineNumber)))},[]);i.useEffect(()=>{if("requestIdleCallback"in window){const a=requestIdleCallback(()=>{o(e,t==null?void 0:t.path,t==null?void 0:t.revealInCenter)});return()=>cancelIdleCallback(a)}else{const a=setTimeout(()=>{o(e,t==null?void 0:t.path,t==null?void 0:t.revealInCenter)},100);return()=>clearTimeout(a)}},[t==null?void 0:t.path,t==null?void 0:t.revealInCenter,e,o]),i.useEffect(()=>{var c;if(!r)return;const a=(c=e==null?void 0:e.current)==null?void 0:c.createDecorationsCollection([{range:{...r,startColumn:1},options:{isWholeLine:!1,className:t==null?void 0:t.className}}]);return()=>a==null?void 0:a.clear()},[r,e,t==null?void 0:t.className])},ve=i.createContext({markers:[],setMarkers:()=>{},editor:null,setEditor:e=>{},updateCursorPosition:e=>{}});function Cr({children:e}){const[t,r]=i.useState([]),[n,o]=i.useState(null),a=i.useCallback(c=>{n==null||n.setPosition(c),n==null||n.revealLineInCenterIfOutsideViewport(c.lineNumber),n==null||n.focus()},[n]);return _.jsx(ve.Provider,{value:{markers:t,setMarkers:r,editor:n,setEditor:o,updateCursorPosition:a},children:e})}function be(){return i.useContext(ve)}const xr=({monacoRef:e})=>{const{setMarkers:t}=be();i.useEffect(()=>{let r;const n=setTimeout(()=>{var a;const o=(a=e.current)==null?void 0:a.editor;o&&(r=o.onDidChangeMarkers(([c])=>{const l=o.getModelMarkers({resource:c});t(l)}))},100);return()=>{clearTimeout(n),r==null||r.dispose()}},[e])};let xe=!1;function $r(e){if(xe)return;const t={hover:!0,completion:!0,enableSchemaRequest:!1,validate:!0,schemas:[e]};xe=!0,Ye.yamlDefaults.setDiagnosticsOptions({...t})}const Ue=e=>J.Uri.parse(`file://${e}`).toString(),Lr=e=>{const{schemaConfig:t,instanceId:r}=e;i.useEffect(()=>{t!=null&&t.schema&&$r({fileMatch:[Ue(r.toString())],...t})},[t==null?void 0:t.schema,r])};F.config({monaco:V});const Dr={...ce,folding:!0},Rr=function(t){const{yamlRevision:r,schemaConfig:n,inlineActions:o,themeConfig:a,onYamlRevisionChange:c,selection:l,theme:d,options:p,animateOnUpdate:y=!1,onAnimateEnd:m}=t,g=ie(),[L]=i.useState("yaml"),{editor:O,setEditor:I}=be(),M=i.useRef(null),S=i.useRef(),h=i.useRef({yaml:"",revisionId:0}),E=i.useRef(null),R=i.useRef(null),j=i.useCallback(f=>{var C,T,$;const s=f.split(`
87
- `),D=(C=E.current)==null?void 0:C.getModel();if(D){(T=E.current)==null||T.pushUndoStop(),D.setValue("");let u=0;R.current=window.setInterval(()=>{var v;u<s.length?(g&&((v=E.current)==null||v.executeEdits("addLine",[{range:new g.Range(u+1,1,u+1,1),text:s[u]+`
88
- `}])),u++):R.current&&(clearInterval(R.current),m==null||m())},100),($=E.current)==null||$.pushUndoStop()}},[g]);i.useEffect(()=>()=>{R.current&&clearInterval(R.current)},[]);function P(f,s){E.current=f,S.current=s,f.setValue(r.yaml),I(f),setTimeout(()=>{var D;(D=M.current)!=null&&D.style&&(M.current.style.opacity="1")},50)}i.useEffect(()=>{var f;if(E.current&&(!r.revisionId||r.revisionId>Number((f=h.current)==null?void 0:f.revisionId))){const s=E.current.getModel();s&&(E.current.executeEdits("edit",[{range:s.getFullModelRange(),text:y?"":r.yaml}]),y&&j(r.yaml))}},[j,r,y]),Lr({schemaConfig:n,instanceId:L}),jr({editorRef:E,inlineActions:o});const{theme:w}=ue({monacoRef:S,themeConfig:a,editor:O,theme:d});xr({monacoRef:S}),Pr({editorRef:E,selection:l});const A=i.useMemo(()=>({...Dr,...p}),[p]);return _.jsx("div",{style:{width:"100%",height:"100%",opacity:0},ref:M,children:_.jsx(me,{onChange:(f,s)=>{h.current={yaml:f??"",revisionId:s.versionId},c({...h.current},s)},language:"yaml",theme:w,options:A,path:Ue(L),onMount:P})})};exports.BlameEditor=hr;exports.CodeDiffEditor=Or;exports.CodeEditor=br;exports.MonacoGlobals=oe;exports.SelectorType=ge;exports.YamlEditor=Rr;exports.YamlEditorContext=ve;exports.YamlEditorContextProvider=Cr;exports.useYamlEditorContext=be;
86
+ }`,U=i.useMemo(()=>({...gr,...d}),[d]);return A.jsxs(A.Fragment,{children:[A.jsx("style",{dangerouslySetInnerHTML:{__html:`${C} ${M} ${E} ${j}`}}),A.jsx(ge,{className:`monaco-editor-${h.current} overflow-hidden rounded-b-md border-x border-b`,height:s,language:t,theme:R,options:U,onMount:b})]})}q.config({monaco:V});const vr={...ce};function br({codeRevision:e,onCodeRevisionChange:t,language:r,themeConfig:n,options:o,theme:a,height:c="75vh",className:s}){ie();const[d,l]=i.useState(),h=i.useRef(),p=i.useRef({code:"",revisionId:0}),g=i.useRef(null),L=i.useCallback((x,S)=>{var b,R,C,M,E,j;g.current=x,h.current=S,x.setValue(e.code),l(x),(C=(R=(b=S.languages.typescript)==null?void 0:b.typescriptDefaults)==null?void 0:R.setDiagnosticsOptions)==null||C.call(R,{noSuggestionDiagnostics:!0,noSyntaxValidation:!0,noSemanticValidation:!0}),(j=(E=(M=S.languages.typescript)==null?void 0:M.javascriptDefaults)==null?void 0:E.setDiagnosticsOptions)==null||j.call(E,{noSuggestionDiagnostics:!0,noSyntaxValidation:!0,noSemanticValidation:!0})},[e.code]);i.useEffect(()=>{var x,S;if(g.current&&(!e.revisionId||e.revisionId>Number((x=p.current)==null?void 0:x.revisionId))){const b=g.current.getModel();b&&(o!=null&&o.readOnly?(S=g.current)==null||S.setValue(e.code):(g.current.pushUndoStop(),g.current.executeEdits("edit",[{range:b.getFullModelRange(),text:e.code}]),g.current.pushUndoStop()))}},[e,g.current]);const{theme:v}=ue({monacoRef:h,themeConfig:n,editor:d,theme:a}),T=i.useMemo(()=>({...vr,...o||{}}),[o]);return A.jsx(A.Fragment,{children:A.jsx(ge,{className:s,height:c,onChange:(x,S)=>{p.current={code:x??"",revisionId:S.versionId},t({...p.current},S)},language:r,theme:v,options:T,onMount:L})})}q.config({monaco:V});const yr={...ce,codeLens:!1,smartSelect:{selectLeadingAndTrailingWhitespace:!0},originalEditable:!1,overviewRulerBorder:!1};function Or({original:e,modified:t,language:r,themeConfig:n,options:o,theme:a,height:c="75vh"}){ie();const[s,d]=i.useState(),l=i.useRef(),{theme:h}=ue({monacoRef:l,themeConfig:n,editor:s,theme:a}),p=i.useMemo(()=>({...yr,...o||{}}),[o]);return A.jsx(A.Fragment,{children:A.jsx(er,{className:"overflow-hidden rounded-b-md border-x border-b",language:r,theme:h,original:e,modified:t,height:c,options:p,onMount:d})})}var he=(e=>(e.ContainsPath="ContainsPath",e))(he||{});function Sr(e){const{pathSymbolMap:t,inlineActions:r=[],commandId:n}=e,o=Object.fromEntries(t.entries()),a=[];return r==null||r.forEach(c=>{const s=c.actions;c.selectors.forEach(l=>{switch(l.type){case he.ContainsPath:{l.paths.forEach(h=>{let g=Object.keys(o).map(v=>({fullPath:v,path:v,symbol:o[v]})).filter(v=>v.path.startsWith(l.basePath));g=g.map(v=>({...v,path:v.path.substring(l.basePath.length)})),g.filter(v=>h.test(v.path)).forEach(v=>{const T=v.fullPath,x=v.symbol,S=x.range;s.forEach(b=>{const R={range:S,symbols:[x],onClick:b.onClick,data:b.data,path:T};a.push({range:S,command:{id:n,title:b.title,arguments:[R]}})})})});break}}})}),a}const Z=class Z{static set(t){Z.data=t}static get(){return Z.data}};Se(Z,"data",{});let oe=Z;async function Ve(e){const t=oe.get(),{documentSymbolProvider:r}=t.StandaloneServices.get(t.ILanguageFeaturesService);return await t.OutlineModel.create(r,e)}function Ue(e){const t=new Map;return ve({pathSymbolMap:t,parentPath:"",children:e.children,parentKind:J.languages.SymbolKind.Module}),t}function ve(e){switch(e.parentKind){case J.languages.SymbolKind.Module:{wr(e);break}case J.languages.SymbolKind.Array:{Mr(e);break}default:Er(e)}}function wr(e){e.children.forEach(t=>{var n;let r=e.parentPath;t.symbol&&(r=e.parentPath?`${e.parentPath}.${t.symbol.name}`:t.symbol.name,e.pathSymbolMap.set(r,t.symbol)),ve({pathSymbolMap:e.pathSymbolMap,parentPath:r,children:t.children,parentKind:((n=t==null?void 0:t.symbol)==null?void 0:n.kind)??e.parentKind})})}function Mr(e){let t=0;e.children.forEach(r=>{const n=e.parentPath?`${e.parentPath}.${t}`:`${t}`;e.pathSymbolMap.set(n,r.symbol),t+=1,ve({pathSymbolMap:e.pathSymbolMap,parentPath:n,children:r.children,parentKind:r.symbol.kind})})}function Er(e){const t=e.children.get("0");if(t){const r=e.parentPath?`${e.parentPath}.${t.symbol.name}`:t==null?void 0:t.symbol.name;e.pathSymbolMap.set(r,t.symbol)}}function jr({editorRef:e,inlineActions:t}){i.useEffect(()=>V.languages.registerCodeLensProvider("yaml",{provideCodeLenses:async n=>{var d;const o=await Ve(n),a=Ue(o),c=(d=e==null?void 0:e.current)==null?void 0:d.addCommand(0,(l,{onClick:h,path:p,range:g,data:L})=>{h({path:p,range:g,data:L})});return c?{lenses:Sr({pathSymbolMap:a,inlineActions:t,commandId:c}),dispose:()=>{}}:void 0}}).dispose,[t,e])}const Pr=({editorRef:e,selection:t})=>{const[r,n]=i.useState(),o=i.useMemo(()=>async(a,c,s)=>{var g,L,v;const d=(g=e==null?void 0:e.current)==null?void 0:g.getModel();if(!d||!c)return n(void 0);const l=await Ve(d),p=(L=Ue(l).get(c))==null?void 0:L.range;p&&(n(p),s&&((v=e==null?void 0:e.current)==null||v.revealLineInCenter(p.startLineNumber)))},[]);i.useEffect(()=>{if("requestIdleCallback"in window){const a=requestIdleCallback(()=>{o(e,t==null?void 0:t.path,t==null?void 0:t.revealInCenter)});return()=>cancelIdleCallback(a)}else{const a=setTimeout(()=>{o(e,t==null?void 0:t.path,t==null?void 0:t.revealInCenter)},100);return()=>clearTimeout(a)}},[t==null?void 0:t.path,t==null?void 0:t.revealInCenter,e,o]),i.useEffect(()=>{var c;if(!r)return;const a=(c=e==null?void 0:e.current)==null?void 0:c.createDecorationsCollection([{range:{...r,startColumn:1},options:{isWholeLine:!1,className:t==null?void 0:t.className}}]);return()=>a==null?void 0:a.clear()},[r,e,t==null?void 0:t.className])},be=i.createContext({markers:[],setMarkers:()=>{},editor:null,setEditor:e=>{},updateCursorPosition:e=>{}});function Cr({children:e}){const[t,r]=i.useState([]),[n,o]=i.useState(null),a=i.useCallback(c=>{n==null||n.setPosition(c),n==null||n.revealLineInCenterIfOutsideViewport(c.lineNumber),n==null||n.focus()},[n]);return A.jsx(be.Provider,{value:{markers:t,setMarkers:r,editor:n,setEditor:o,updateCursorPosition:a},children:e})}function ye(){return i.useContext(be)}const xr=({monacoRef:e,editorRef:t,instanceId:r})=>{const{setMarkers:n}=ye();i.useEffect(()=>{let o;const a=setTimeout(()=>{var s;const c=(s=e.current)==null?void 0:s.editor;c&&(o=c.onDidChangeMarkers(d=>{var p;const l=(p=t.current)==null?void 0:p.getModel();if(!l)return;const h=l.uri.toString();if(d.some(g=>g.toString()===h)){const g=V.editor.getModelMarkers({resource:l.uri});n(g)}}))},100);return()=>{clearTimeout(a),o==null||o.dispose()}},[e,r,n])};function $r(e){var n,o;const t=((o=(n=pe.yamlDefaults)==null?void 0:n.diagnosticsOptions)==null?void 0:o.schemas)??[],r=t.findIndex(a=>a.fileMatch[0]===e.fileMatch[0]);r!==-1?t[r]=e:t.push(e),ze(t)}function Lr(e){var n,o;const r=(((o=(n=pe.yamlDefaults)==null?void 0:n.diagnosticsOptions)==null?void 0:o.schemas)??[]).filter(a=>a.fileMatch[0]!==Oe(e));ze(r)}function ze(e){const t={hover:!0,completion:!0,enableSchemaRequest:!1,validate:!0,schemas:e};pe.yamlDefaults.setDiagnosticsOptions({...t})}const Oe=e=>J.Uri.parse(`file://${e}`).toString(),Dr=e=>{const{schemaConfig:t,instanceId:r}=e;i.useEffect(()=>{if(t!=null&&t.schema)return $r({fileMatch:[Oe(r.toString())],...t}),()=>{Lr(r)}},[t==null?void 0:t.schema,r])};q.config({monaco:V});const Ir={...ce,folding:!0},Rr=function(t){const{yamlRevision:r,schemaConfig:n,inlineActions:o,themeConfig:a,onYamlRevisionChange:c,selection:s,theme:d,options:l,animateOnUpdate:h=!1,onAnimateEnd:p,instanceId:g}=t,L=ie(),[v]=i.useState(g??`yaml-editor-${Math.random()}`),{editor:T,setEditor:x}=ye(),S=i.useRef(null),b=i.useRef(),R=i.useRef({yaml:"",revisionId:0}),C=i.useRef(null),M=i.useRef(null),E=i.useCallback(P=>{var D,u,y;const m=P.split(`
87
+ `),I=(D=C.current)==null?void 0:D.getModel();if(I){(u=C.current)==null||u.pushUndoStop(),I.setValue("");let N=0;M.current=window.setInterval(()=>{var z;N<m.length?(L&&((z=C.current)==null||z.executeEdits("addLine",[{range:new L.Range(N+1,1,N+1,1),text:m[N]+`
88
+ `}])),N++):M.current&&(clearInterval(M.current),p==null||p())},100),(y=C.current)==null||y.pushUndoStop()}},[L]);i.useEffect(()=>()=>{M.current&&clearInterval(M.current)},[]);function j(P,m){C.current=P,b.current=m,P.setValue(r.yaml),x(P),setTimeout(()=>{var I;(I=S.current)!=null&&I.style&&(S.current.style.opacity="1")},50)}i.useEffect(()=>{var P;if(C.current&&(!r.revisionId||r.revisionId>Number((P=R.current)==null?void 0:P.revisionId))){const m=C.current.getModel();m&&(C.current.executeEdits("edit",[{range:m.getFullModelRange(),text:h?"":r.yaml}]),h&&E(r.yaml))}},[E,r,h]),Dr({schemaConfig:n,instanceId:v}),jr({editorRef:C,inlineActions:o});const{theme:U}=ue({monacoRef:b,themeConfig:a,editor:T,theme:d});xr({monacoRef:b,editorRef:C,instanceId:v}),Pr({editorRef:C,selection:s});const w=i.useMemo(()=>Oe(v),[]),f=i.useMemo(()=>({...Ir,...l}),[l]);return A.jsx("div",{style:{width:"100%",height:"100%",opacity:0},ref:S,children:A.jsx(ge,{onChange:(P,m)=>{R.current={yaml:P??"",revisionId:m.versionId},c({...R.current},m)},language:"yaml",theme:U,options:f,path:w,onMount:j})})};exports.BlameEditor=hr;exports.CodeDiffEditor=Or;exports.CodeEditor=br;exports.MonacoGlobals=oe;exports.SelectorType=he;exports.YamlEditor=Rr;exports.YamlEditorContext=be;exports.YamlEditorContextProvider=Cr;exports.useYamlEditorContext=ye;
89
89
  //# sourceMappingURL=index.cjs.map