import{E as F,a as q}from"./chunk-TCUK52QT.js";import{D as R,K as j}from"./chunk-UOI75ONS.js";import{Ca as p,E as u,Na as _,Qb as a,Rb as w,Rc as E,Rd as D,Sc as b,Ta as M,Tc as N,Ua as v,Ub as C,jd as O,ma as T,ra as f,ta as g,va as m,ya as d,yc as y}from"./chunk-4HFZZ7HS.js";import{e as z}from"./chunk-SZAW6ZBW.js";function K(i={}){return p([{provide:c,useValue:i}])}var S,c,I,x,A,Z,J,V=z(()=>{D();D();F();T();j();S=["editorContainer"],c=new m("NGX_MONACO_EDITOR_CONFIG"),I=!1,A=(()=>{class i{constructor(){this.config=d(c),this.onInit=new M,this._insideNg=!1}set insideNg(e){this._insideNg=e,this._editor&&(this._editor.dispose(),this.initMonaco(this._options,this.insideNg))}get insideNg(){return this._insideNg}ngAfterViewInit(){I?x.then(()=>{this.initMonaco(this._options,this.insideNg)}):(I=!0,x=new Promise(e=>{let t=this.config.baseUrl;if((t==="assets"||!t)&&(t="./assets/monaco/min/vs"),typeof window.monaco=="object"){this.initMonaco(this._options,this.insideNg),e();return}let o=n=>{let h=n||window.require,l={paths:{vs:`${t}`}};Object.assign(l,this.config.requireConfig||{}),h.config(l),h(["vs/editor/editor.main"],()=>{typeof this.config.onMonacoLoad=="function"&&this.config.onMonacoLoad(),this.initMonaco(this._options,this.insideNg),e()})};if(this.config.monacoRequire)o(this.config.monacoRequire);else if(window.require)if(window.require.config)o();else{var s=`${t}/loader.js`,r=new XMLHttpRequest;r.addEventListener("load",()=>{let n=document.createElement("script");n.type="text/javascript",n.text=["var nodeRequire = require;",r.responseText.replace('"use strict";',""),"var monacoAmdRequire = require;","require = nodeRequire;","require.nodeRequire = require;"].join(`
`),document.body.appendChild(n),o(window.monacoAmdRequire)}),r.open("GET",s),r.send()}else{let n=document.createElement("script");n.type="text/javascript",n.src=`${t}/loader.js`,n.addEventListener("load",()=>{o()}),document.body.appendChild(n)}}))}ngOnDestroy(){this._windowResizeSubscription&&this._windowResizeSubscription.unsubscribe(),this._editor&&(this._editor.dispose(),this._editor=void 0)}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275cmp=a({type:i,selectors:[["ng-component"]],viewQuery:function(t,o){if(t&1&&E(S,7),t&2){let s;b(s=N())&&(o._editorContainer=s.first)}},inputs:{insideNg:"insideNg"},outputs:{onInit:"onInit"},standalone:!1,decls:0,vars:0,template:function(t,o){},encapsulation:2})}}return i})(),Z=(()=>{class i extends A{constructor(){super(...arguments),this.zone=d(v),this._value="",this.propagateChange=e=>{},this.onTouched=()=>{}}set options(e){this._options=Object.assign({},this.config.defaultOptions,e),this._editor&&(this._editor.dispose(),this.initMonaco(e,this.insideNg))}get options(){return this._options}set model(e){this.options.model=e,this._editor&&(this._editor.dispose(),this.initMonaco(this.options,this.insideNg))}writeValue(e){this._value=e||"",setTimeout(()=>{this._editor&&!this.options.model&&this._editor.setValue(this._value)})}registerOnChange(e){this.propagateChange=e}registerOnTouched(e){this.onTouched=e}initMonaco(e,t){let o=!!e.model;if(o){let s=monaco.editor.getModel(e.model.uri||"");s?(e.model=s,e.model.setValue(this._value)):e.model=monaco.editor.createModel(e.model.value,e.model.language,e.model.uri)}t?this._editor=monaco.editor.create(this._editorContainer.nativeElement,e):this.zone.runOutsideAngular(()=>{this._editor=monaco.editor.create(this._editorContainer.nativeElement,e)}),o||this._editor.setValue(this._value),this._editor.onDidChangeModelContent(s=>{let r=this._editor.getValue();this.zone.run(()=>{this.propagateChange(r),this._value=r})}),this._editor.onDidBlurEditorWidget(()=>{this.onTouched()}),this._windowResizeSubscription&&this._windowResizeSubscription.unsubscribe(),this._windowResizeSubscription=u(window,"resize").subscribe(()=>this._editor.layout()),this.onInit.emit(this._editor)}static{this.\u0275fac=(()=>{let e;return function(o){return(e||(e=_(i)))(o||i)}})()}static{this.\u0275cmp=a({type:i,selectors:[["ngx-monaco-editor"]],inputs:{options:"options",model:"model"},features:[O([{provide:q,useExisting:f(()=>i),multi:!0}]),C],decls:2,vars:0,consts:[["editorContainer",""],[1,"editor-container"]],template:function(t,o){t&1&&y(0,"div",1,0)},styles:["[_nghost-%COMP%]{display:block;height:200px}.editor-container[_ngcontent-%COMP%]{width:100%;height:98%}"],changeDetection:0})}}return i})(),J=(()=>{class i{static forRoot(e={}){return{ngModule:i,providers:[{provide:c,useValue:e}]}}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275mod=w({type:i})}static{this.\u0275inj=g({imports:[R]})}}return i})()});export{Z as a,J as b,K as c,V as d};
