UNPKG

tressi

Version:

Deterministic load testing for API performance validation.

4 lines 98.8 kB
import{a as Nn}from"./chunk-2NHEPAC5.js";import{a as Ln,b as Ge}from"./chunk-OVBUA5RI.js";import{d as Bn}from"./chunk-BEQIQLT5.js";import{$ as mn,$a as ae,Bb as ue,Db as ee,Eb as An,Fb as wn,Jb as kn,Ka as S,Lb as En,Ob as Fn,Q as Dt,Qb as xe,Ra as Vt,Rb as je,Sb as In,U as fn,W as be,Wb as Tn,aa as pn,e as cn,ec as te,fa as X,fc as L,gb as Cn,i as un,jc as We,ka as Z,kb as _n,kc as De,lb as le,ma as gn,mb as ce,n as dn,na as yn,nc as On,ob as bn,oc as de,pb as xn,qa as vn,qb as Dn,rb as Y,sb as I,sc as H,t as hn,tb as B,ub as Vn,yb as Mn,zb as Sn}from"./chunk-W6IDPYNF.js";import{e as ci,f as ui,g as di,h as hi}from"./chunk-PTIQXOVT.js";import{A as qn,Ba as oi,C as qe,Ca as si,D as y,Da as Xe,E as Me,Ea as re,F as $n,Fa as Et,G as St,Ga as ai,H as zn,I as At,Ia as oe,J as Jn,Ja as li,K as Kn,L as Qn,M as Xn,O as Zn,Q as Se,R as $e,S as Yn,T as ei,U as ti,V as ni,W as ze,a as Mt,b as U,c as Pn,d as Rn,e as jn,ea as f,g as Wn,h as Gn,i as p,j as q,k as he,ka as Je,l as Un,m as G,ma as ii,n as Ve,na as c,o as A,oa as Ke,p as fe,pa as Qe,q as w,qa as Ae,r as ne,ra as wt,s as ie,sa as kt,v as Ue,w as He,x as C,xa as ri,y as Hn,z as x}from"./chunk-ZPCMWKEN.js";import{a as k,b as W}from"./chunk-I4MTPUBM.js";var Qr=["*"];function Xr(e,t){if(e&1&&Vn(0,"app-icon",3),e&2){let n=ee();Y("name",n.icon())}}function Zr(e,t){if(e&1&&(I(0,"p",6),xe(1),B()),e&2){let n=ee();S(),je(n.subtitle())}}function Yr(e,t){if(e&1&&Mn(0,8),e&2){let n=t.$implicit;Y("ngTemplateOutlet",n)}}var fi=class e{title=De.required();subtitle=De();icon=De();collapsed=De.required();collapsedChange=We();headerContent=On(Vt);toggleCollapsed(){this.collapsedChange.emit(!this.collapsed())}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=ae({type:e,selectors:[["app-collapsible-card"]],contentQueries:function(n,i,r){n&1&&kn(r,i.headerContent,Vt,4),n&2&&En()},inputs:{title:[1,"title"],subtitle:[1,"subtitle"],icon:[1,"icon"],collapsed:[1,"collapsed"]},outputs:{collapsedChange:"collapsedChange"},ngContentSelectors:Qr,decls:14,vars:13,consts:[[1,"bg-base-200","border-base-300","hover:border-base-content/10","rounded-xl","border","p-4"],[1,"flex","cursor-pointer","items-center","justify-between","transition-all",3,"click","onKeyDown"],[1,"flex","min-w-0","items-center","gap-2"],[3,"name"],[1,"min-w-0","flex-1"],["data-e2e","collapsible-card-title",1,"truncate","text-xl","font-semibold"],[1,"text-base-content/70","truncate","text-sm"],[1,"flex","items-center","justify-end","gap-4"],[3,"ngTemplateOutlet"],[3,"click","onKeyDown","title","icon","secondaryIcon","toggled","ghost"],[1,"collapse-transition"]],template:function(n,i){n&1&&(An(),I(0,"div",0)(1,"div",1),ue("click",function(){return i.toggleCollapsed()})("onKeyDown",function(){return i.toggleCollapsed()}),I(2,"div",2),le(3,Xr,1,1,"app-icon",3),I(4,"div",4)(5,"h2",5),xe(6),B(),le(7,Zr,2,1,"p",6),B()(),I(8,"div",7),xn(9,Yr,1,1,"ng-container",8,bn),I(11,"app-button",9),ue("click",function(){return i.toggleCollapsed()})("onKeyDown",function(){return i.toggleCollapsed()}),B()()(),I(12,"div",10),wn(13),B()()),n&2&&(S(3),ce(i.icon()?3:-1),S(2),_n("tooltip",i.title()),S(),In(" ",i.title()," "),S(),ce(i.subtitle()?7:-1),S(2),Dn(i.headerContent()),S(2),Y("title",i.collapsed()?"Expand":"Collapse")("icon","keyboard_arrow_up")("secondaryIcon","keyboard_arrow_down")("toggled",i.collapsed())("ghost",!0),S(),Fn("collapse-collapsed",i.collapsed())("collapse-expanded",!i.collapsed()))},dependencies:[Ge,Bn,Ln],styles:[".collapse-transition[_ngcontent-%COMP%]{overflow:hidden;transition:max-height .3s ease-in-out,opacity .2s ease-in-out}.collapse-collapsed[_ngcontent-%COMP%]{max-height:0;pointer-events:none;opacity:0}.collapse-expanded[_ngcontent-%COMP%]{max-height:2048px;opacity:1}"]})};var _i=new fn("");function Tt(e){return e==null||Ot(e)===0}function Ot(e){return e==null?null:Array.isArray(e)||typeof e=="string"?e.length:e instanceof Set?e.size:null}var eo=/^(?=.{1,254}$)(?=.{1,64}@)[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,pi=class{static min(t){return to(t)}static max(t){return no(t)}static required(t){return io(t)}static requiredTrue(t){return ro(t)}static email(t){return oo(t)}static minLength(t){return so(t)}static maxLength(t){return ao(t)}static pattern(t){return lo(t)}static nullValidator(t){return bi()}static compose(t){return Ai(t)}static composeAsync(t){return ki(t)}};function to(e){return t=>{if(t.value==null||e==null)return null;let n=parseFloat(t.value);return!isNaN(n)&&n<e?{min:{min:e,actual:t.value}}:null}}function no(e){return t=>{if(t.value==null||e==null)return null;let n=parseFloat(t.value);return!isNaN(n)&&n>e?{max:{max:e,actual:t.value}}:null}}function io(e){return Tt(e.value)?{required:!0}:null}function ro(e){return e.value===!0?null:{required:!0}}function oo(e){return Tt(e.value)||eo.test(e.value)?null:{email:!0}}function so(e){return t=>{let n=t.value?.length??Ot(t.value);return n===null||n===0?null:n<e?{minlength:{requiredLength:e,actualLength:n}}:null}}function ao(e){return t=>{let n=t.value?.length??Ot(t.value);return n!==null&&n>e?{maxlength:{requiredLength:e,actualLength:n}}:null}}function lo(e){if(!e)return bi;let t,n;return typeof e=="string"?(n="",e.charAt(0)!=="^"&&(n+="^"),n+=e,e.charAt(e.length-1)!=="$"&&(n+="$"),t=new RegExp(n)):(n=e.toString(),t=e),i=>{if(Tt(i.value))return null;let r=i.value;return t.test(r)?null:{pattern:{requiredPattern:n,actualValue:r}}}}function bi(e){return null}function xi(e){return e!=null}function Di(e){return Cn(e)?un(e):e}function Vi(e){let t={};return e.forEach(n=>{t=n!=null?k(k({},t),n):t}),Object.keys(t).length===0?null:t}function Mi(e,t){return t.map(n=>n(e))}function co(e){return!e.validate}function Si(e){return e.map(t=>co(t)?t:n=>t.validate(n))}function Ai(e){if(!e)return null;let t=e.filter(xi);return t.length==0?null:function(n){return Vi(Mi(n,t))}}function wi(e){return e!=null?Ai(Si(e)):null}function ki(e){if(!e)return null;let t=e.filter(xi);return t.length==0?null:function(n){let i=Mi(n,t).map(Di);return hn(i).pipe(dn(Vi))}}function Ei(e){return e!=null?ki(Si(e)):null}function Ft(e){return e?Array.isArray(e)?e:[e]:[]}function Ye(e,t){return Array.isArray(e)?e.includes(t):e===t}function gi(e,t){let n=Ft(t);return Ft(e).forEach(r=>{Ye(n,r)||n.push(r)}),n}function yi(e,t){return Ft(t).filter(n=>!Ye(e,n))}var It=class{get value(){return this.control?this.control.value:null}get valid(){return this.control?this.control.valid:null}get invalid(){return this.control?this.control.invalid:null}get pending(){return this.control?this.control.pending:null}get disabled(){return this.control?this.control.disabled:null}get enabled(){return this.control?this.control.enabled:null}get errors(){return this.control?this.control.errors:null}get pristine(){return this.control?this.control.pristine:null}get dirty(){return this.control?this.control.dirty:null}get touched(){return this.control?this.control.touched:null}get status(){return this.control?this.control.status:null}get untouched(){return this.control?this.control.untouched:null}get statusChanges(){return this.control?this.control.statusChanges:null}get valueChanges(){return this.control?this.control.valueChanges:null}get path(){return null}_composedValidatorFn;_composedAsyncValidatorFn;_rawValidators=[];_rawAsyncValidators=[];_setValidators(t){this._rawValidators=t||[],this._composedValidatorFn=wi(this._rawValidators)}_setAsyncValidators(t){this._rawAsyncValidators=t||[],this._composedAsyncValidatorFn=Ei(this._rawAsyncValidators)}get validator(){return this._composedValidatorFn||null}get asyncValidator(){return this._composedAsyncValidatorFn||null}_onDestroyCallbacks=[];_registerOnDestroy(t){this._onDestroyCallbacks.push(t)}_invokeOnDestroyCallbacks(){this._onDestroyCallbacks.forEach(t=>t()),this._onDestroyCallbacks=[]}reset(t=void 0){this.control?.reset(t)}hasError(t,n){return this.control?this.control.hasError(t,n):!1}getError(t,n){return this.control?this.control.getError(t,n):null}};var vi=class extends It{_parent=null;name=null;valueAccessor=null};var we="VALID",Ze="INVALID",me="PENDING",ke="DISABLED",ge=class{},et=class extends ge{value;source;constructor(t,n){super(),this.value=t,this.source=n}},Ee=class extends ge{pristine;source;constructor(t,n){super(),this.pristine=t,this.source=n}},Fe=class extends ge{touched;source;constructor(t,n){super(),this.touched=t,this.source=n}},pe=class extends ge{status;source;constructor(t,n){super(),this.status=t,this.source=n}};function uo(e){return Array.isArray(e)?wi(e):e||null}function ho(e){return Array.isArray(e)?Ei(e):e||null}function fo(e){return e!=null&&!Array.isArray(e)&&typeof e=="object"}var Ci=class{_pendingDirty=!1;_hasOwnPendingAsyncValidator=null;_pendingTouched=!1;_onCollectionChange=()=>{};_updateOn;_parent=null;_asyncValidationSubscription;_composedValidatorFn;_composedAsyncValidatorFn;_rawValidators;_rawAsyncValidators;value;constructor(t,n){this._assignValidators(t),this._assignAsyncValidators(n)}get validator(){return this._composedValidatorFn}set validator(t){this._rawValidators=this._composedValidatorFn=t}get asyncValidator(){return this._composedAsyncValidatorFn}set asyncValidator(t){this._rawAsyncValidators=this._composedAsyncValidatorFn=t}get parent(){return this._parent}get status(){return te(this.statusReactive)}set status(t){te(()=>this.statusReactive.set(t))}_status=L(()=>this.statusReactive());statusReactive=Z(void 0);get valid(){return this.status===we}get invalid(){return this.status===Ze}get pending(){return this.status==me}get disabled(){return this.status===ke}get enabled(){return this.status!==ke}errors;get pristine(){return te(this.pristineReactive)}set pristine(t){te(()=>this.pristineReactive.set(t))}_pristine=L(()=>this.pristineReactive());pristineReactive=Z(!0);get dirty(){return!this.pristine}get touched(){return te(this.touchedReactive)}set touched(t){te(()=>this.touchedReactive.set(t))}_touched=L(()=>this.touchedReactive());touchedReactive=Z(!1);get untouched(){return!this.touched}_events=new cn;events=this._events.asObservable();valueChanges;statusChanges;get updateOn(){return this._updateOn?this._updateOn:this.parent?this.parent.updateOn:"change"}setValidators(t){this._assignValidators(t)}setAsyncValidators(t){this._assignAsyncValidators(t)}addValidators(t){this.setValidators(gi(t,this._rawValidators))}addAsyncValidators(t){this.setAsyncValidators(gi(t,this._rawAsyncValidators))}removeValidators(t){this.setValidators(yi(t,this._rawValidators))}removeAsyncValidators(t){this.setAsyncValidators(yi(t,this._rawAsyncValidators))}hasValidator(t){return Ye(this._rawValidators,t)}hasAsyncValidator(t){return Ye(this._rawAsyncValidators,t)}clearValidators(){this.validator=null}clearAsyncValidators(){this.asyncValidator=null}markAsTouched(t={}){let n=this.touched===!1;this.touched=!0;let i=t.sourceControl??this;t.onlySelf||this._parent?.markAsTouched(W(k({},t),{sourceControl:i})),n&&t.emitEvent!==!1&&this._events.next(new Fe(!0,i))}markAllAsDirty(t={}){this.markAsDirty({onlySelf:!0,emitEvent:t.emitEvent,sourceControl:this}),this._forEachChild(n=>n.markAllAsDirty(t))}markAllAsTouched(t={}){this.markAsTouched({onlySelf:!0,emitEvent:t.emitEvent,sourceControl:this}),this._forEachChild(n=>n.markAllAsTouched(t))}markAsUntouched(t={}){let n=this.touched===!0;this.touched=!1,this._pendingTouched=!1;let i=t.sourceControl??this;this._forEachChild(r=>{r.markAsUntouched({onlySelf:!0,emitEvent:t.emitEvent,sourceControl:i})}),t.onlySelf||this._parent?._updateTouched(t,i),n&&t.emitEvent!==!1&&this._events.next(new Fe(!1,i))}markAsDirty(t={}){let n=this.pristine===!0;this.pristine=!1;let i=t.sourceControl??this;t.onlySelf||this._parent?.markAsDirty(W(k({},t),{sourceControl:i})),n&&t.emitEvent!==!1&&this._events.next(new Ee(!1,i))}markAsPristine(t={}){let n=this.pristine===!1;this.pristine=!0,this._pendingDirty=!1;let i=t.sourceControl??this;this._forEachChild(r=>{r.markAsPristine({onlySelf:!0,emitEvent:t.emitEvent})}),t.onlySelf||this._parent?._updatePristine(t,i),n&&t.emitEvent!==!1&&this._events.next(new Ee(!0,i))}markAsPending(t={}){this.status=me;let n=t.sourceControl??this;t.emitEvent!==!1&&(this._events.next(new pe(this.status,n)),this.statusChanges.emit(this.status)),t.onlySelf||this._parent?.markAsPending(W(k({},t),{sourceControl:n}))}disable(t={}){let n=this._parentMarkedDirty(t.onlySelf);this.status=ke,this.errors=null,this._forEachChild(r=>{r.disable(W(k({},t),{onlySelf:!0}))}),this._updateValue();let i=t.sourceControl??this;t.emitEvent!==!1&&(this._events.next(new et(this.value,i)),this._events.next(new pe(this.status,i)),this.valueChanges.emit(this.value),this.statusChanges.emit(this.status)),this._updateAncestors(W(k({},t),{skipPristineCheck:n}),this),this._onDisabledChange.forEach(r=>r(!0))}enable(t={}){let n=this._parentMarkedDirty(t.onlySelf);this.status=we,this._forEachChild(i=>{i.enable(W(k({},t),{onlySelf:!0}))}),this.updateValueAndValidity({onlySelf:!0,emitEvent:t.emitEvent}),this._updateAncestors(W(k({},t),{skipPristineCheck:n}),this),this._onDisabledChange.forEach(i=>i(!1))}_updateAncestors(t,n){t.onlySelf||(this._parent?.updateValueAndValidity(t),t.skipPristineCheck||this._parent?._updatePristine({},n),this._parent?._updateTouched({},n))}setParent(t){this._parent=t}getRawValue(){return this.value}updateValueAndValidity(t={}){if(this._setInitialStatus(),this._updateValue(),this.enabled){let i=this._cancelExistingSubscription();this.errors=this._runValidator(),this.status=this._calculateStatus(),(this.status===we||this.status===me)&&this._runAsyncValidator(i,t.emitEvent)}let n=t.sourceControl??this;t.emitEvent!==!1&&(this._events.next(new et(this.value,n)),this._events.next(new pe(this.status,n)),this.valueChanges.emit(this.value),this.statusChanges.emit(this.status)),t.onlySelf||this._parent?.updateValueAndValidity(W(k({},t),{sourceControl:n}))}_updateTreeValidity(t={emitEvent:!0}){this._forEachChild(n=>n._updateTreeValidity(t)),this.updateValueAndValidity({onlySelf:!0,emitEvent:t.emitEvent})}_setInitialStatus(){this.status=this._allControlsDisabled()?ke:we}_runValidator(){return this.validator?this.validator(this):null}_runAsyncValidator(t,n){if(this.asyncValidator){this.status=me,this._hasOwnPendingAsyncValidator={emitEvent:n!==!1,shouldHaveEmitted:t!==!1};let i=Di(this.asyncValidator(this));this._asyncValidationSubscription=i.subscribe(r=>{this._hasOwnPendingAsyncValidator=null,this.setErrors(r,{emitEvent:n,shouldHaveEmitted:t})})}}_cancelExistingSubscription(){if(this._asyncValidationSubscription){this._asyncValidationSubscription.unsubscribe();let t=(this._hasOwnPendingAsyncValidator?.emitEvent||this._hasOwnPendingAsyncValidator?.shouldHaveEmitted)??!1;return this._hasOwnPendingAsyncValidator=null,t}return!1}setErrors(t,n={}){this.errors=t,this._updateControlsErrors(n.emitEvent!==!1,this,n.shouldHaveEmitted)}get(t){let n=t;return n==null||(Array.isArray(n)||(n=n.split(".")),n.length===0)?null:n.reduce((i,r)=>i&&i._find(r),this)}getError(t,n){let i=n?this.get(n):this;return i?.errors?i.errors[t]:null}hasError(t,n){return!!this.getError(t,n)}get root(){let t=this;for(;t._parent;)t=t._parent;return t}_updateControlsErrors(t,n,i){this.status=this._calculateStatus(),t&&this.statusChanges.emit(this.status),(t||i)&&this._events.next(new pe(this.status,n)),this._parent&&this._parent._updateControlsErrors(t,n,i)}_initObservables(){this.valueChanges=new X,this.statusChanges=new X}_calculateStatus(){return this._allControlsDisabled()?ke:this.errors?Ze:this._hasOwnPendingAsyncValidator||this._anyControlsHaveStatus(me)?me:this._anyControlsHaveStatus(Ze)?Ze:we}_anyControlsHaveStatus(t){return this._anyControls(n=>n.status===t)}_anyControlsDirty(){return this._anyControls(t=>t.dirty)}_anyControlsTouched(){return this._anyControls(t=>t.touched)}_updatePristine(t,n){let i=!this._anyControlsDirty(),r=this.pristine!==i;this.pristine=i,t.onlySelf||this._parent?._updatePristine(t,n),r&&this._events.next(new Ee(this.pristine,n))}_updateTouched(t={},n){this.touched=this._anyControlsTouched(),this._events.next(new Fe(this.touched,n)),t.onlySelf||this._parent?._updateTouched(t,n)}_onDisabledChange=[];_registerOnCollectionChange(t){this._onCollectionChange=t}_setUpdateStrategy(t){fo(t)&&t.updateOn!=null&&(this._updateOn=t.updateOn)}_parentMarkedDirty(t){return!t&&!!this._parent?.dirty&&!this._parent._anyControlsDirty()}_find(t){return null}_assignValidators(t){this._rawValidators=Array.isArray(t)?t.slice():t,this._composedValidatorFn=uo(this._rawValidators)}_assignAsyncValidators(t){this._rawAsyncValidators=Array.isArray(t)?t.slice():t,this._composedAsyncValidatorFn=ho(this._rawAsyncValidators)}};var mo=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),i=Gt(e.state,n.from);return i.line?po(e):i.block?yo(e):!1};function Wt(e,t){return({state:n,dispatch:i})=>{if(n.readOnly)return!1;let r=e(t,n);return r?(i(n.update(r)),!0):!1}}var po=Wt(_o,0);var go=Wt(Ri,0);var yo=Wt((e,t)=>Ri(e,t,Co(t)),0);function Gt(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}var Ie=50;function vo(e,{open:t,close:n},i,r){let o=e.sliceDoc(i-Ie,i),s=e.sliceDoc(r,r+Ie),a=/\s*$/.exec(o)[0].length,l=/^\s*/.exec(s)[0].length,d=o.length-a;if(o.slice(d-t.length,d)==t&&s.slice(l,l+n.length)==n)return{open:{pos:i-a,margin:a&&1},close:{pos:r+l,margin:l&&1}};let h,m;r-i<=2*Ie?h=m=e.sliceDoc(i,r):(h=e.sliceDoc(i,i+Ie),m=e.sliceDoc(r-Ie,r));let g=/^\s*/.exec(h)[0].length,v=/\s*$/.exec(m)[0].length,_=m.length-v-n.length;return h.slice(g,g+t.length)==t&&m.slice(_,_+n.length)==n?{open:{pos:i+g+t.length,margin:/\s/.test(h.charAt(g+t.length))?1:0},close:{pos:r-v-n.length,margin:/\s/.test(m.charAt(_-1))?1:0}}:null}function Co(e){let t=[];for(let n of e.selection.ranges){let i=e.doc.lineAt(n.from),r=n.to<=i.to?i:e.doc.lineAt(n.to);r.from>i.from&&r.from==n.to&&(r=n.to==i.to+1?i:e.doc.lineAt(n.to-1));let o=t.length-1;o>=0&&t[o].to>i.from?t[o].to=r.to:t.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:r.to})}return t}function Ri(e,t,n=t.selection.ranges){let i=n.map(o=>Gt(t,o.from).block);if(!i.every(o=>o))return null;let r=n.map((o,s)=>vo(t,i[s],o.from,o.to));if(e!=2&&!r.every(o=>o))return{changes:t.changes(n.map((o,s)=>r[s]?[]:[{from:o.from,insert:i[s].open+" "},{from:o.to,insert:" "+i[s].close}]))};if(e!=1&&r.some(o=>o)){let o=[];for(let s=0,a;s<r.length;s++)if(a=r[s]){let l=i[s],{open:d,close:h}=a;o.push({from:d.pos-l.open.length,to:d.pos+d.margin},{from:h.pos-h.margin,to:h.pos+l.close.length})}return{changes:o}}return null}function _o(e,t,n=t.selection.ranges){let i=[],r=-1;e:for(let{from:o,to:s}of n){let a=i.length,l=1e9,d;for(let h=o;h<=s;){let m=t.doc.lineAt(h);if(d==null&&(d=Gt(t,m.from).line,!d))continue e;if(m.from>r&&(o==s||s>m.from)){r=m.from;let g=/^\s*/.exec(m.text)[0].length,v=g==m.length,_=m.text.slice(g,g+d.length)==d?g:-1;g<m.text.length&&g<l&&(l=g),i.push({line:m,comment:_,token:d,indent:g,empty:v,single:!1})}h=m.to+1}if(l<1e9)for(let h=a;h<i.length;h++)i[h].indent<i[h].line.text.length&&(i[h].indent=l);i.length==a+1&&(i[a].single=!0)}if(e!=2&&i.some(o=>o.comment<0&&(!o.empty||o.single))){let o=[];for(let{line:a,token:l,indent:d,empty:h,single:m}of i)(m||!h)&&o.push({from:a.from+d,insert:l+" "});let s=t.changes(o);return{changes:s,selection:t.selection.map(s,1)}}else if(e!=1&&i.some(o=>o.comment>=0)){let o=[];for(let{line:s,comment:a,token:l}of i)if(a>=0){let d=s.from+a,h=d+l.length;s.text[h-s.from]==" "&&h++,o.push({from:d,to:h})}return{changes:o}}return null}var Nt=Ve.define(),bo=Ve.define(),xo=q.define(),ji=q.define({combine(e){return ie(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(i,r)=>t(i,r)||n(i,r)})}}),Wi=he.define({create(){return Lt.empty},update(e,t){let n=t.state.facet(ji),i=t.annotation(Nt);if(i){let l=N.fromTransaction(t,i.selection),d=i.side,h=d==0?e.undone:e.done;return l?h=nt(h,h.length,n.minDepth,l):h=Hi(h,t.startState.selection),new Lt(d==0?i.rest:h,d==0?h:i.rest)}let r=t.annotation(bo);if((r=="full"||r=="before")&&(e=e.isolate()),t.annotation(fe.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let o=N.fromTransaction(t),s=t.annotation(fe.time),a=t.annotation(fe.userEvent);return o?e=e.addChanges(o,s,a,n,t):t.selection&&(e=e.addSelection(t.startState.selection,s,a,n.newGroupDelay)),(r=="full"||r=="after")&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(t=>t.toJSON()),undone:e.undone.map(t=>t.toJSON())}},fromJSON(e){return new Lt(e.done.map(N.fromJSON),e.undone.map(N.fromJSON))}});function Ut(e={}){return[Wi,ji.of(e),y.domEventHandlers({beforeinput(t,n){let i=t.inputType=="historyUndo"?Gi:t.inputType=="historyRedo"?Pt:null;return i?(t.preventDefault(),i(n)):!1}})]}function it(e,t){return function({state:n,dispatch:i}){if(!t&&n.readOnly)return!1;let r=n.field(Wi,!1);if(!r)return!1;let o=r.pop(e,n,t);return o?(i(o),!0):!1}}var Gi=it(0,!1),Pt=it(1,!1),Do=it(0,!0),Vo=it(1,!0);var N=class e{constructor(t,n,i,r,o){this.changes=t,this.effects=n,this.mapped=i,this.startSelection=r,this.selectionsAfter=o}setSelAfter(t){return new e(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,n,i;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(t){return new e(t.changes&&Gn.fromJSON(t.changes),[],t.mapped&&Wn.fromJSON(t.mapped),t.startSelection&&p.fromJSON(t.startSelection),t.selectionsAfter.map(p.fromJSON))}static fromTransaction(t,n){let i=T;for(let r of t.startState.facet(xo)){let o=r(t);o.length&&(i=i.concat(o))}return!i.length&&t.changes.empty?null:new e(t.changes.invert(t.startState.doc),i,void 0,n||t.startState.selection,T)}static selection(t){return new e(void 0,T,void 0,void 0,t)}};function nt(e,t,n,i){let r=t+1>n+20?t-n-1:0,o=e.slice(r,t);return o.push(i),o}function Mo(e,t){let n=[],i=!1;return e.iterChangedRanges((r,o)=>n.push(r,o)),t.iterChangedRanges((r,o,s,a)=>{for(let l=0;l<n.length;){let d=n[l++],h=n[l++];a>=d&&s<=h&&(i=!0)}}),i}function So(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,i)=>n.empty!=t.ranges[i].empty).length===0}function Ui(e,t){return e.length?t.length?e.concat(t):e:t}var T=[],Ao=200;function Hi(e,t){if(e.length){let n=e[e.length-1],i=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Ao));return i.length&&i[i.length-1].eq(t)?e:(i.push(t),nt(e,e.length-1,1e9,n.setSelAfter(i)))}else return[N.selection([t])]}function wo(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function Bt(e,t){if(!e.length)return e;let n=e.length,i=T;for(;n;){let r=ko(e[n-1],t,i);if(r.changes&&!r.changes.empty||r.effects.length){let o=e.slice(0,n);return o[n-1]=r,o}else t=r.mapped,n--,i=r.selectionsAfter}return i.length?[N.selection(i)]:T}function ko(e,t,n){let i=Ui(e.selectionsAfter.length?e.selectionsAfter.map(a=>a.map(t)):T,n);if(!e.changes)return N.selection(i);let r=e.changes.map(t),o=t.mapDesc(e.changes,!0),s=e.mapped?e.mapped.composeDesc(o):o;return new N(r,A.mapEffects(e.effects,t),s,e.startSelection.map(o),i)}var Eo=/^(input\.type|delete)($|\.)/,Lt=(()=>{class e{constructor(n,i,r=0,o=void 0){this.done=n,this.undone=i,this.prevTime=r,this.prevUserEvent=o}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(n,i,r,o,s){let a=this.done,l=a[a.length-1];return l&&l.changes&&!l.changes.empty&&n.changes&&(!r||Eo.test(r))&&(!l.selectionsAfter.length&&i-this.prevTime<o.newGroupDelay&&o.joinToEvent(s,Mo(l.changes,n.changes))||r=="input.type.compose")?a=nt(a,a.length-1,o.minDepth,new N(n.changes.compose(l.changes),Ui(A.mapEffects(n.effects,l.changes),l.effects),l.mapped,l.startSelection,T)):a=nt(a,a.length,o.minDepth,n),new e(a,T,i,r)}addSelection(n,i,r,o){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:T;return s.length>0&&i-this.prevTime<o&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&So(s[s.length-1],n)?this:new e(Hi(this.done,n),this.undone,i,r)}addMapping(n){return new e(Bt(this.done,n),Bt(this.undone,n),this.prevTime,this.prevUserEvent)}pop(n,i,r){let o=n==0?this.done:this.undone;if(o.length==0)return null;let s=o[o.length-1],a=s.selectionsAfter[0]||(s.startSelection?s.startSelection.map(s.changes.invertedDesc,1):i.selection);if(r&&s.selectionsAfter.length)return i.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:Nt.of({side:n,rest:wo(o),selection:a}),userEvent:n==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let l=o.length==1?T:o.slice(0,o.length-1);return s.mapped&&(l=Bt(l,s.mapped)),i.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:Nt.of({side:n,rest:l,selection:a}),filter:!1,userEvent:n==0?"undo":"redo",scrollIntoView:!0})}else return null}}return e.empty=new e(T,T),e})(),Ht=[{key:"Mod-z",run:Gi,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Pt,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Pt,preventDefault:!0},{key:"Mod-u",run:Do,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Vo,preventDefault:!0}];function ye(e,t){return p.create(e.ranges.map(t),e.mainIndex)}function P(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function R({state:e,dispatch:t},n){let i=ye(e.selection,n);return i.eq(e.selection,!0)?!1:(t(P(e,i)),!0)}function rt(e,t){return p.cursor(t?e.to:e.from)}function qi(e,t){return R(e,n=>n.empty?e.moveByChar(n,t):rt(n,t))}function M(e){return e.textDirectionAt(e.state.selection.main.head)==qn.LTR}var $i=e=>qi(e,!M(e)),zi=e=>qi(e,M(e));function Ji(e,t){return R(e,n=>n.empty?e.moveByGroup(n,t):rt(n,t))}var Fo=e=>Ji(e,!M(e)),Io=e=>Ji(e,M(e));var Ja=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function To(e,t,n){if(t.type.prop(n))return!0;let i=t.to-t.from;return i&&(i>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function ot(e,t,n){let i=Je(e).resolveInner(t.head),r=n?ze.closedBy:ze.openedBy;for(let l=t.head;;){let d=n?i.childAfter(l):i.childBefore(l);if(!d)break;To(e,d,r)?i=d:l=n?d.to:d.from}let o=i.type.prop(r),s,a;return o&&(s=n?oe(e,i.from,1):oe(e,i.to,-1))&&s.matched?a=n?s.end.to:s.end.from:a=n?i.to:i.from,p.cursor(a,n?-1:1)}var Oo=e=>R(e,t=>ot(e.state,t,!M(e))),Bo=e=>R(e,t=>ot(e.state,t,M(e)));function Ki(e,t){return R(e,n=>{if(!n.empty)return rt(n,t);let i=e.moveVertically(n,t);return i.head!=n.head?i:e.moveToLineBoundary(n,t)})}var Qi=e=>Ki(e,!1),Xi=e=>Ki(e,!0);function Zi(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,i=0,r;if(t){for(let o of e.state.facet(y.scrollMargins)){let s=o(e);s?.top&&(n=Math.max(s?.top,n)),s?.bottom&&(i=Math.max(s?.bottom,i))}r=e.scrollDOM.clientHeight-n-i}else r=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:i,selfScroll:t,height:Math.max(e.defaultLineHeight,r-5)}}function Yi(e,t){let n=Zi(e),{state:i}=e,r=ye(i.selection,s=>s.empty?e.moveVertically(s,t,n.height):rt(s,t));if(r.eq(i.selection))return!1;let o;if(n.selfScroll){let s=e.coordsAtPos(i.selection.main.head),a=e.scrollDOM.getBoundingClientRect(),l=a.top+n.marginTop,d=a.bottom-n.marginBottom;s&&s.top>l&&s.bottom<d&&(o=y.scrollIntoView(r.main.head,{y:"start",yMargin:s.top-l}))}return e.dispatch(P(i,r),{effects:o}),!0}var Fi=e=>Yi(e,!1),Rt=e=>Yi(e,!0);function $(e,t,n){let i=e.lineBlockAt(t.head),r=e.moveToLineBoundary(t,n);if(r.head==t.head&&r.head!=(n?i.to:i.from)&&(r=e.moveToLineBoundary(t,n,!1)),!n&&r.head==i.from&&i.length){let o=/^\s*/.exec(e.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;o&&t.head!=i.from+o&&(r=p.cursor(i.from+o))}return r}var Lo=e=>R(e,t=>$(e,t,!0)),No=e=>R(e,t=>$(e,t,!1)),Po=e=>R(e,t=>$(e,t,!M(e))),Ro=e=>R(e,t=>$(e,t,M(e))),jo=e=>R(e,t=>p.cursor(e.lineBlockAt(t.head).from,1)),Wo=e=>R(e,t=>p.cursor(e.lineBlockAt(t.head).to,-1));function Go(e,t,n){let i=!1,r=ye(e.selection,o=>{let s=oe(e,o.head,-1)||oe(e,o.head,1)||o.head>0&&oe(e,o.head-1,1)||o.head<e.doc.length&&oe(e,o.head+1,-1);if(!s||!s.end)return o;i=!0;let a=s.start.from==o.head?s.end.to:s.end.from;return n?p.range(o.anchor,a):p.cursor(a)});return i?(t(P(e,r)),!0):!1}var Uo=({state:e,dispatch:t})=>Go(e,t,!1);function O(e,t){let n=ye(e.state.selection,i=>{let r=t(i);return p.range(i.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return n.eq(e.state.selection)?!1:(e.dispatch(P(e.state,n)),!0)}function er(e,t){return O(e,n=>e.moveByChar(n,t))}var tr=e=>er(e,!M(e)),nr=e=>er(e,M(e));function ir(e,t){return O(e,n=>e.moveByGroup(n,t))}var Ho=e=>ir(e,!M(e)),qo=e=>ir(e,M(e));var $o=e=>O(e,t=>ot(e.state,t,!M(e))),zo=e=>O(e,t=>ot(e.state,t,M(e)));function rr(e,t){return O(e,n=>e.moveVertically(n,t))}var or=e=>rr(e,!1),sr=e=>rr(e,!0);function ar(e,t){return O(e,n=>e.moveVertically(n,t,Zi(e).height))}var Ii=e=>ar(e,!1),Ti=e=>ar(e,!0),Jo=e=>O(e,t=>$(e,t,!0)),Ko=e=>O(e,t=>$(e,t,!1)),Qo=e=>O(e,t=>$(e,t,!M(e))),Xo=e=>O(e,t=>$(e,t,M(e))),Zo=e=>O(e,t=>p.cursor(e.lineBlockAt(t.head).from)),Yo=e=>O(e,t=>p.cursor(e.lineBlockAt(t.head).to)),Oi=({state:e,dispatch:t})=>(t(P(e,{anchor:0})),!0),Bi=({state:e,dispatch:t})=>(t(P(e,{anchor:e.doc.length})),!0),Li=({state:e,dispatch:t})=>(t(P(e,{anchor:e.selection.main.anchor,head:0})),!0),Ni=({state:e,dispatch:t})=>(t(P(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),es=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),ts=({state:e,dispatch:t})=>{let n=st(e).map(({from:i,to:r})=>p.range(i,Math.min(r+1,e.doc.length)));return t(e.update({selection:p.create(n),userEvent:"select"})),!0},ns=({state:e,dispatch:t})=>{let n=ye(e.selection,i=>{let r=Je(e),o=r.resolveStack(i.from,1);if(i.empty){let s=r.resolveStack(i.from,-1);s.node.from>=o.node.from&&s.node.to<=o.node.to&&(o=s)}for(let s=o;s;s=s.next){let{node:a}=s;if((a.from<i.from&&a.to>=i.to||a.to>i.to&&a.from<=i.from)&&s.next)return p.range(a.to,a.from)}return i});return n.eq(e.selection)?!1:(t(P(e,n)),!0)};function lr(e,t){let{state:n}=e,i=n.selection,r=n.selection.ranges.slice();for(let o of n.selection.ranges){let s=n.doc.lineAt(o.head);if(t?s.to<e.state.doc.length:s.from>0)for(let a=o;;){let l=e.moveVertically(a,t);if(l.head<s.from||l.head>s.to){r.some(d=>d.head==l.head)||r.push(l);break}else{if(l.head==a.head)break;a=l}}}return r.length==i.ranges.length?!1:(e.dispatch(P(n,p.create(r,r.length-1))),!0)}var is=e=>lr(e,!1),rs=e=>lr(e,!0),os=({state:e,dispatch:t})=>{let n=e.selection,i=null;return n.ranges.length>1?i=p.create([n.main]):n.main.empty||(i=p.create([p.cursor(n.main.head)])),i?(t(P(e,i)),!0):!1};function Te(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:i}=e,r=i.changeByRange(o=>{let{from:s,to:a}=o;if(s==a){let l=t(o);l<s?(n="delete.backward",l=tt(e,l,!1)):l>s&&(n="delete.forward",l=tt(e,l,!0)),s=Math.min(s,l),a=Math.max(a,l)}else s=tt(e,s,!1),a=tt(e,a,!0);return s==a?{range:o}:{changes:{from:s,to:a},range:p.cursor(s,s<o.head?-1:1)}});return r.changes.empty?!1:(e.dispatch(i.update(r,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?y.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function tt(e,t,n){if(e instanceof y)for(let i of e.state.facet(y.atomicRanges).map(r=>r(e)))i.between(t,t,(r,o)=>{r<t&&o>t&&(t=n?o:r)});return t}var cr=(e,t,n)=>Te(e,i=>{let r=i.from,{state:o}=e,s=o.doc.lineAt(r),a,l;if(n&&!t&&r>s.from&&r<s.from+200&&!/[^ \t]/.test(a=s.text.slice(0,r-s.from))){if(a[a.length-1]=="	")return r-1;let d=He(a,o.tabSize),h=d%Qe(o)||Qe(o);for(let m=0;m<h&&a[a.length-1-m]==" ";m++)r--;l=r}else l=U(s.text,r-s.from,t,t)+s.from,l==r&&s.number!=(t?o.doc.lines:1)?l+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(s.text.slice(l-s.from,r-s.from))&&(l=U(s.text,l-s.from,!1,!1)+s.from);return l}),jt=e=>cr(e,!1,!0);var ur=e=>cr(e,!0,!1),dr=(e,t)=>Te(e,n=>{let i=n.head,{state:r}=e,o=r.doc.lineAt(i),s=r.charCategorizer(i);for(let a=null;;){if(i==(t?o.to:o.from)){i==n.head&&o.number!=(t?r.doc.lines:1)&&(i+=t?1:-1);break}let l=U(o.text,i-o.from,t)+o.from,d=o.text.slice(Math.min(i,l)-o.from,Math.max(i,l)-o.from),h=s(d);if(a!=null&&h!=a)break;(d!=" "||i!=n.head)&&(a=h),i=l}return i}),hr=e=>dr(e,!1),ss=e=>dr(e,!0);var as=e=>Te(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)});var ls=e=>Te(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),cs=e=>Te(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)});var us=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:Mt.of(["",""])},range:p.cursor(i.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},ds=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(i=>{if(!i.empty||i.from==0||i.from==e.doc.length)return{range:i};let r=i.from,o=e.doc.lineAt(r),s=r==o.from?r-1:U(o.text,r-o.from,!1)+o.from,a=r==o.to?r+1:U(o.text,r-o.from,!0)+o.from;return{changes:{from:s,to:a,insert:e.doc.slice(r,a).append(e.doc.slice(s,r))},range:p.cursor(a)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function st(e){let t=[],n=-1;for(let i of e.selection.ranges){let r=e.doc.lineAt(i.from),o=e.doc.lineAt(i.to);if(!i.empty&&i.to==o.from&&(o=e.doc.lineAt(i.to-1)),n>=r.number){let s=t[t.length-1];s.to=o.to,s.ranges.push(i)}else t.push({from:r.from,to:o.to,ranges:[i]});n=o.number+1}return t}function fr(e,t,n){if(e.readOnly)return!1;let i=[],r=[];for(let o of st(e)){if(n?o.to==e.doc.length:o.from==0)continue;let s=e.doc.lineAt(n?o.to+1:o.from-1),a=s.length+1;if(n){i.push({from:o.to,to:s.to},{from:o.from,insert:s.text+e.lineBreak});for(let l of o.ranges)r.push(p.range(Math.min(e.doc.length,l.anchor+a),Math.min(e.doc.length,l.head+a)))}else{i.push({from:s.from,to:o.from},{from:o.to,insert:e.lineBreak+s.text});for(let l of o.ranges)r.push(p.range(l.anchor-a,l.head-a))}}return i.length?(t(e.update({changes:i,scrollIntoView:!0,selection:p.create(r,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}var hs=({state:e,dispatch:t})=>fr(e,t,!1),fs=({state:e,dispatch:t})=>fr(e,t,!0);function mr(e,t,n){if(e.readOnly)return!1;let i=[];for(let o of st(e))n?i.push({from:o.from,insert:e.doc.slice(o.from,o.to)+e.lineBreak}):i.push({from:o.to,insert:e.lineBreak+e.doc.slice(o.from,o.to)});let r=e.changes(i);return t(e.update({changes:r,selection:e.selection.map(r,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}var ms=({state:e,dispatch:t})=>mr(e,t,!1),ps=({state:e,dispatch:t})=>mr(e,t,!0),gs=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(st(t).map(({from:r,to:o})=>(r>0?r--:o<t.doc.length&&o++,{from:r,to:o}))),i=ye(t.selection,r=>{let o;if(e.lineWrapping){let s=e.lineBlockAt(r.head),a=e.coordsAtPos(r.head,r.assoc||1);a&&(o=s.bottom+e.documentTop-a.bottom+e.defaultLineHeight/2)}return e.moveVertically(r,!0,o)}).map(n);return e.dispatch({changes:n,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function ys(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=Je(e).resolveInner(t),i=n.childBefore(t),r=n.childAfter(t),o;return i&&r&&i.to<=t&&r.from>=t&&(o=i.type.prop(ze.closedBy))&&o.indexOf(r.name)>-1&&e.doc.lineAt(i.to).from==e.doc.lineAt(r.from).from&&!/\S/.test(e.sliceDoc(i.to,r.from))?{from:i.to,to:r.from}:null}var Pi=pr(!1),vs=pr(!0);function pr(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let i=t.changeByRange(r=>{let{from:o,to:s}=r,a=t.doc.lineAt(o),l=!e&&o==s&&ys(t,o);e&&(o=s=(s<=a.to?a:t.doc.lineAt(s)).to);let d=new kt(t,{simulateBreak:o,simulateDoubleBreak:!!l}),h=wt(d,o);for(h==null&&(h=He(/^\s*/.exec(t.doc.lineAt(o).text)[0],t.tabSize));s<a.to&&/\s/.test(a.text[s-a.from]);)s++;l?{from:o,to:s}=l:o>a.from&&o<a.from+100&&!/\S/.test(a.text.slice(0,o))&&(o=a.from);let m=["",Ae(t,h)];return l&&m.push(Ae(t,d.lineIndent(a.from,-1))),{changes:{from:o,to:s,insert:Mt.of(m)},range:p.cursor(o+1+m[1].length)}});return n(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}function qt(e,t){let n=-1;return e.changeByRange(i=>{let r=[];for(let s=i.from;s<=i.to;){let a=e.doc.lineAt(s);a.number>n&&(i.empty||i.to>a.from)&&(t(a,r,i),n=a.number),s=a.to+1}let o=e.changes(r);return{changes:r,range:p.range(o.mapPos(i.anchor,1),o.mapPos(i.head,1))}})}var Cs=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),i=new kt(e,{overrideIndentation:o=>{let s=n[o];return s??-1}}),r=qt(e,(o,s,a)=>{let l=wt(i,o.from);if(l==null)return;/\S/.test(o.text)||(l=0);let d=/^\s*/.exec(o.text)[0],h=Ae(e,l);(d!=h||a.from<o.from+d.length)&&(n[o.from]=l,s.push({from:o.from,to:o.from+d.length,insert:h}))});return r.changes.empty||t(e.update(r,{userEvent:"indent"})),!0},gr=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(qt(e,(n,i)=>{i.push({from:n.from,insert:e.facet(Ke)})}),{userEvent:"input.indent"})),!0),yr=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(qt(e,(n,i)=>{let r=/^\s*/.exec(n.text)[0];if(!r)return;let o=He(r,e.tabSize),s=0,a=Ae(e,Math.max(0,o-Qe(e)));for(;s<r.length&&s<a.length&&r.charCodeAt(s)==a.charCodeAt(s);)s++;i.push({from:n.from+s,to:n.from+r.length,insert:a.slice(s)})}),{userEvent:"delete.dedent"})),!0),_s=e=>(e.setTabFocusMode(),!0);var bs=[{key:"Ctrl-b",run:$i,shift:tr,preventDefault:!0},{key:"Ctrl-f",run:zi,shift:nr},{key:"Ctrl-p",run:Qi,shift:or},{key:"Ctrl-n",run:Xi,shift:sr},{key:"Ctrl-a",run:jo,shift:Zo},{key:"Ctrl-e",run:Wo,shift:Yo},{key:"Ctrl-d",run:ur},{key:"Ctrl-h",run:jt},{key:"Ctrl-k",run:as},{key:"Ctrl-Alt-h",run:hr},{key:"Ctrl-o",run:us},{key:"Ctrl-t",run:ds},{key:"Ctrl-v",run:Rt}],xs=[{key:"ArrowLeft",run:$i,shift:tr,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Fo,shift:Ho,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Po,shift:Qo,preventDefault:!0},{key:"ArrowRight",run:zi,shift:nr,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Io,shift:qo,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Ro,shift:Xo,preventDefault:!0},{key:"ArrowUp",run:Qi,shift:or,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Oi,shift:Li},{mac:"Ctrl-ArrowUp",run:Fi,shift:Ii},{key:"ArrowDown",run:Xi,shift:sr,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Bi,shift:Ni},{mac:"Ctrl-ArrowDown",run:Rt,shift:Ti},{key:"PageUp",run:Fi,shift:Ii},{key:"PageDown",run:Rt,shift:Ti},{key:"Home",run:No,shift:Ko,preventDefault:!0},{key:"Mod-Home",run:Oi,shift:Li},{key:"End",run:Lo,shift:Jo,preventDefault:!0},{key:"Mod-End",run:Bi,shift:Ni},{key:"Enter",run:Pi,shift:Pi},{key:"Mod-a",run:es},{key:"Backspace",run:jt,shift:jt,preventDefault:!0},{key:"Delete",run:ur,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:hr,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:ss,preventDefault:!0},{mac:"Mod-Backspace",run:ls,preventDefault:!0},{mac:"Mod-Delete",run:cs,preventDefault:!0}].concat(bs.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),$t=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Oo,shift:$o},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Bo,shift:zo},{key:"Alt-ArrowUp",run:hs},{key:"Shift-Alt-ArrowUp",run:ms},{key:"Alt-ArrowDown",run:fs},{key:"Shift-Alt-ArrowDown",run:ps},{key:"Mod-Alt-ArrowUp",run:is},{key:"Mod-Alt-ArrowDown",run:rs},{key:"Escape",run:os},{key:"Mod-Enter",run:vs},{key:"Alt-l",mac:"Ctrl-l",run:ts},{key:"Mod-i",run:ns,preventDefault:!0},{key:"Mod-[",run:yr},{key:"Mod-]",run:gr},{key:"Mod-Alt-\\",run:Cs},{key:"Shift-Mod-k",run:gs},{key:"Shift-Mod-\\",run:Uo},{key:"Mod-/",run:mo},{key:"Alt-A",run:go},{key:"Ctrl-m",mac:"Shift-Alt-m",run:_s}].concat(xs),vr={key:"Tab",run:gr,shift:yr};var Ds="#e5c07b",Cr="#e06c75",Vs="#56b6c2",Ms="#ffffff",at="#abb2bf",Jt="#7d8799",Ss="#61afef",As="#98c379",_r="#d19a66",ws="#c678dd",ks="#21252b",br="#2c313a",xr="#282c34",zt="#353a42",Es="#3E4451",Dr="#528bff";var Fs=y.theme({"&":{color:at,backgroundColor:xr},".cm-content":{caretColor:Dr},".cm-cursor, .cm-dropCursor":{borderLeftColor:Dr},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Es},".cm-panels":{backgroundColor:ks,color:at},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:xr,color:Jt,border:"none"},".cm-activeLineGutter":{backgroundColor:br},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:zt},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:zt,borderBottomColor:zt},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:br,color:at}}},{dark:!0}),Is=Xe.define([{tag:f.keyword,color:ws},{tag:[f.name,f.deleted,f.character,f.propertyName,f.macroName],color:Cr},{tag:[f.function(f.variableName),f.labelName],color:Ss},{tag:[f.color,f.constant(f.name),f.standard(f.name)],color:_r},{tag:[f.definition(f.name),f.separator],color:at},{tag:[f.typeName,f.className,f.number,f.changed,f.annotation,f.modifier,f.self,f.namespace],color:Ds},{tag:[f.operator,f.operatorKeyword,f.url,f.escape,f.regexp,f.link,f.special(f.string)],color:Vs},{tag:[f.meta,f.comment],color:Jt},{tag:f.strong,fontWeight:"bold"},{tag:f.emphasis,fontStyle:"italic"},{tag:f.strikethrough,textDecoration:"line-through"},{tag:f.link,color:Jt,textDecoration:"underline"},{tag:f.heading,fontWeight:"bold",color:Cr},{tag:[f.atom,f.bool,f.special(f.variableName)],color:_r},{tag:[f.processingInstruction,f.string,f.inserted],color:As},{tag:f.invalid,color:Ms}]),Vr=[Fs,re(Is)];var Mr=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e,J=class{constructor(t,n,i=0,r=t.length,o,s){this.test=s,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(i,r),this.bufferStart=i,this.normalize=o?a=>o(Mr(a)):Mr,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Pn(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let n=Rn(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=jn(t);let r=this.normalize(n);if(r.length)for(let o=0,s=i;;o++){let a=r.charCodeAt(o),l=this.match(a,s,this.bufferPos+this.bufferStart);if(o==r.length-1){if(l)return this.value=l,this;break}s==i&&o<n.length&&n.charCodeAt(o)==a&&s++}}}match(t,n,i){let r=null;for(let o=0;o<this.matches.length;o+=2){let s=this.matches[o],a=!1;this.query.charCodeAt(s)==t&&(s==this.query.length-1?r={from:this.matches[o+1],to:i}:(this.matches[o]++,a=!0)),a||(this.matches.splice(o,2),o-=2)}return this.query.charCodeAt(0)==t&&(this.query.length==1?r={from:n,to:i}:this.matches.push(1,n)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}};typeof Symbol<"u"&&(J.prototype[Symbol.iterator]=function(){return this});var wr={from:-1,to:-1,match:/.*/.exec("")},en="gm"+(/x/.unicode==null?"":"u"),ut=class{constructor(t,n,i,r=0,o=t.length){if(this.text=t,this.to=o,this.curLine="",this.done=!1,this.value=wr,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new ht(t,n,i,r,o);this.re=new RegExp(n,en+(i?.ignoreCase?"i":"")),this.test=i?.test,this.iter=t.iter();let s=t.lineAt(r);this.curLineStart=s.from,this.matchPos=ft(t,r),this.getLine(this.curLineStart)}getLine(t){this.iter.next(t),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let i=this.curLineStart+n.index,r=i+n[0].length;if(this.matchPos=ft(this.text,r+(i==r?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(i<r||i>this.value.to)&&(!this.test||this.test(i,r,n)))return this.value={from:i,to:r,match:n},this;t=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),t=0;else return this.done=!0,this}}},Kt=new WeakMap,dt=class e{constructor(t,n){this.from=t,this.text=n}get to(){return this.from+this.text.length}static get(t,n,i){let r=Kt.get(t);if(!r||r.from>=i||r.to<=n){let a=new e(n,t.sliceString(n,i));return Kt.set(t,a),a}if(r.from==n&&r.to==i)return r;let{text:o,from:s}=r;return s>n&&(o=t.sliceString(n,s)+o,s=n),r.to<i&&(o+=t.sliceString(r.to,i)),Kt.set(t,new e(s,o)),new e(n,o.slice(n-s,i-s))}},ht=class{constructor(t,n,i,r,o){this.text=t,this.to=o,this.done=!1,this.value=wr,this.matchPos=ft(t,r),this.re=new RegExp(n,en+(i?.ignoreCase?"i":"")),this.test=i?.test,this.flat=dt.get(t,r,this.chunkEnd(r+5e3))}chunkEnd(t){return t>=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==t&&(this.re.lastIndex=t+1,n=this.re.exec(this.flat.text)),n){let i=this.flat.from+n.index,r=i+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,r,n)))return this.value={from:i,to:r,match:n},this.matchPos=ft(this.text,r+(i==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=dt.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<"u"&&(ut.prototype[Symbol.iterator]=ht.prototype[Symbol.iterator]=function(){return this});function Ts(e){try{return new RegExp(e,en),!0}catch{return!1}}function ft(e,t){if(t>=e.length)return t;let n=e.lineAt(t),i;for(;t<n.to&&(i=n.text.charCodeAt(t-n.from))>=56320&&i<57344;)t++;return t}var Os=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:i,result:r}=Yn(e,{label:t.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:t.phrase("go")});return r.then(o=>{let s=o&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(o.elements.line.value);if(!s){e.dispatch({effects:i});return}let a=t.doc.lineAt(t.selection.main.head),[,l,d,h,m]=s,g=h?+h.slice(1):0,v=d?+d:a.number;if(d&&m){let D=v/100;l&&(D=D*(l=="-"?-1:1)+a.number/t.doc.lines),v=Math.round(t.doc.lines*D)}else d&&l&&(v=v*(l=="-"?-1:1)+a.number);let _=t.doc.line(Math.max(1,Math.min(t.doc.lines,v))),V=p.cursor(_.from+Math.max(0,Math.min(g,_.length)));e.dispatch({effects:[i,y.scrollIntoView(V.from,{y:"center"})],selection:V})}),!0},Bs={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},kr=q.define({combine(e){return ie(e,Bs,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function Er(e){let t=[js,Rs];return e&&t.push(kr.of(e)),t}var Ls=x.mark({class:"cm-selectionMatch"}),Ns=x.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Sr(e,t,n,i){return(n==0||e(t.sliceDoc(n-1,n))!=w.Word)&&(i==t.doc.length||e(t.sliceDoc(i,i+1))!=w.Word)}function Ps(e,t,n,i){return e(t.sliceDoc(n,n+1))==w.Word&&e(t.sliceDoc(i-1,i))==w.Word}var Rs=qe.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(kr),{state:n}=e,i=n.selection;if(i.ranges.length>1)return x.none;let r=i.main,o,s=null;if(r.empty){if(!t.highlightWordAroundCursor)return x.none;let l=n.wordAt(r.head);if(!l)return x.none;s=n.charCategorizer(r.head),o=n.sliceDoc(l.from,l.to)}else{let l=r.to-r.from;if(l<t.minSelectionLength||l>200)return x.none;if(t.wholeWords){if(o=n.sliceDoc(r.from,r.to),s=n.charCategorizer(r.head),!(Sr(s,n,r.from,r.to)&&Ps(s,n,r.from,r.to)))return x.none}else if(o=n.sliceDoc(r.from,r.to),!o)return x.none}let a=[];for(let l of e.visibleRanges){let d=new J(n.doc,o,l.from,l.to);for(;!d.next().done;){let{from:h,to:m}=d.value;if((!s||Sr(s,n,h,m))&&(r.empty&&h<=r.from&&m>=r.to?a.push(Ns.range(h,m)):(h>=r.to||m<=r.from)&&a.push(Ls.range(h,m)),a.length>t.maxMatches))return x.none}}return x.set(a)}},{decorations:e=>e.decorations}),js=y.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Ws=({state:e,dispatch:t})=>{let{selection:n}=e,i=p.create(n.ranges.map(r=>e.wordAt(r.head)||p.cursor(r.head)),n.mainIndex);return i.eq(n)?!1:(t(e.update({selection:i})),!0)};function Gs(e,t){let{main:n,ranges:i}=e.selection,r=e.wordAt(n.head),o=r&&r.from==n.from&&r.to==n.to;for(let s=!1,a=new J(e.doc,t,i[i.length-1].to);;)if(a.next(),a.done){if(s)return null;a=new J(e.doc,t,0,Math.max(0,i[i.length-1].from-1)),s=!0}else{if(s&&i.some(l=>l.from==a.value.from))continue;if(o){let l=e.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}var Us=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(o=>o.from===o.to))return Ws({state:e,dispatch:t});let i=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(o=>e.sliceDoc(o.from,o.to)!=i))return!1;let r=Gs(e,i);return r?(t(e.update({selection:e.selection.addRange(p.range(r.from,r.to),!1),effects:y.scrollIntoView(r.to)})),!0):!1},_e=q.define({combine(e){return ie(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new Yt(t),scrollToMatch:t=>y.scrollIntoView(t)})}});var mt=class{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||Ts(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord,this.test=t.test}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,(n,i)=>i=="n"?`
`:i=="r"?"\r":i=="t"?"	":"\\")}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord&&this.test==t.test}create(){return this.regexp?new Xt(this):new Qt(this)}getCursor(t,n=0,i){let r=t.doc?t:ne.create({doc:t});return i==null&&(i=r.doc.length),this.regexp?Ce(this,r,n,i):ve(this,r,n,i)}},pt=class{constructor(t){this.spec=t}};function Hs(e,t,n){return(i,r,o,s)=>{if(n&&!n(i,r,o,s))return!1;let a=i>=s&&r<=s+o.length?o.slice(i-s,r-s):t.doc.sliceString(i,r);return e(a,t,i,r)}}function ve(e,t,n,i){let r;return e.wholeWord&&(r=qs(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(r=Hs(e.test,t,r)),new J(t.doc,e.unquoted,n,i,e.caseSensitive?void 0:o=>o.toLowerCase(),r)}function qs(e,t){return(n,i,r,o)=>((o>n||o+r.length<i)&&(o=Math.max(0,n-2),r=e.sliceString(o,Math.min(e.length,i+2))),(t(gt(r,n-o))!=w.Word||t(yt(r,n-o))!=w.Word)&&(t(yt(r,i-o))!=w.Word||t(gt(r,i-o))!=w.Word))}var Qt=class extends pt{constructor(t){super(t)}nextMatch(t,n,i){let r=ve(this.spec,t,i,t.doc.length).nextOverlapping();if(r.done){let o=Math.min(t.doc.length,n+this.spec.unquoted.length);r=ve(this.spec,t,0,o).nextOverlapping()}return r.done||r.value.from==n&&r.value.to==i?null:r.value}prevMatchInRange(t,n,i){for(let r=i;;){let o=Math.max(n,r-1e4-this.spec.unquoted.length),s=ve(this.spec,t,o,r),a=null;for(;!s.nextOverlapping().done;)a=s.value;if(a)return a;if(o==n)return null;r-=1e4}}prevMatch(t,n,i){let r=this.prevMatchInRange(t,0,n);return r||(r=this.prevMatchInRange(t,Math.max(0,i-this.spec.unquoted.length),t.doc.length)),r&&(r.from!=n||r.to!=i)?r:null}getReplacement(t){return this.spec.unquote(this.spec.replace)}matchAll(t,n){let i=ve(this.spec,t,0,t.doc.length),r=[];for(;!i.next().done;){if(r.length>=n)return null;r.push(i.value)}return r}highlight(t,n,i,r){let o=ve(this.spec,t,Math.max(0,n-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,t.doc.length));for(;!o.next().done;)r(o.value.from,o.value.to)}};function $s(e,t,n){return(i,r,o)=>(!n||n(i,r,o))&&e(o[0],t,i,r)}function Ce(e,t,n,i){let r;return e.wholeWord&&(r=zs(t.charCategorizer(t.selection.main.head))),e.test&&(r=$s(e.test,t,r)),new ut(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:r},n,i)}function gt(e,t){return e.slice(U(e,t,!1),t)}function yt(e,t){return e.slice(t,U(e,t))}function zs(e){return(t,n,i)=>!i[0].length||(e(gt(i.input,i.index))!=w.Word||e(yt(i.input,i.index))!=w.Word)&&(e(yt(i.input,i.index+i[0].length))!=w.Word||e(gt(i.input,i.index+i[0].length))!=w.Word)}var Xt=class extends pt{nextMatch(t,n,i){let r=Ce(this.spec,t,i,t.doc.length).next();return r.done&&(r=Ce(this.spec,t,0,n).next()),r.done?null:r.value}prevMatchInRange(t,n,i){for(let r=1;;r++){let o=Math.max(n,i-r*1e4),s=Ce(this.spec,t,o,i),a=null;for(;!s.next().done;)a=s.value;if(a&&(o==n||a.from>o+10))return a;if(o==n)return null}}prevMatch(t,n,i){return this.prevMatchInRange(t,0,n)||this.prevMatchInRange(t,i,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,i)=>{if(i=="&")return t.match[0];if(i=="$")return"$";for(let r=i.length;r>0;r--){let o=+i.slice(0,r);if(o>0&&o<t.match.length)return t.match[o]+i.slice(r)}return n})}matchAll(t,n){let i=Ce(this.spec,t,0,t.doc.length),r=[];for(;!i.next().done;){if(r.length>=n)return null;r.push(i.value)}return r}highlight(t,n,i,r){let o=Ce(this.spec,t,Math.max(0,n-250),Math.min(i+250,t.doc.length));for(;!o.next().done;)r(o.value.from,o.value.to)}},Be=A.define(),tn=A.define(),z=he.define({create(e){return new Oe(Zt(e).create(),null)},update(e,t){for(let n of t.effects)n.is(Be)?e=new Oe(n.value.create(),e.panel):n.is(tn)&&(e=new Oe(e.query,n.value?nn:null));return e},provide:e=>$e.from(e,t=>t.panel)});var Oe=class{constructor(t,n){this.query=t,this.panel=n}},Js=x.mark({class:"cm-searchMatch"}),Ks=x.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Qs=qe.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(z))}update(e){let t=e.state.field(z);(t!=e.startState.field(z)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return x.none;let{view:n}=this,i=new Ue;for(let r=0,o=n.visibleRanges,s=o.length;r<s;r++){let{from:a,to:l}=o[r];for(;r<s-1&&l>o[r+1].from-500;)l=o[++r].to;e.highlight(n.state,a,l,(d,h)=>{let m=n.state.selection.ranges.some(g=>g.from==d&&g.to==h);i.add(d,h,m?Ks:Js)})}return i.finish()}},{decorations:e=>e.decorations});function Le(e){return t=>{let n=t.state.field(z,!1);return n&&n.query.spec.valid?e(t,n):Tr(t)}}var vt=Le((e,{query:t})=>{let{to:n}=e.state.selection.main,i=t.nextMatch(e.state,n,n);if(!i)return!1;let r=p.single(i.from,i.to),o=e.state.facet(_e);return e.dispatch({selection:r,effects:[rn(e,i),o.scrollToMatch(r.main,e)],userEvent:"select.search"}),Ir(e),!0}),Ct=Le((e,{query:t})=>{let{state:n}=e,{from:i}=n.selection.main,r=t.prevMatch(n,i,i);if(!r)return!1;let o=p.single(r.from,r.to),s=e.state.facet(_e);return e.dispatch({selection:o,effects:[rn(e,r),s.scrollToMatch(o.main,e)],userEvent:"select.search"}),Ir(e),!0}),Xs=Le((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:p.create(n.map(i=>p.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),Zs=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:i,to:r}=n.main,o=[],s=0;for(let a=new J(e.doc,e.sliceDoc(i,r));!a.next().done;){if(o.length>1e3)return!1;a.value.from==i&&(s=o.length),o.push(p.range(a.value.from,a.value.to))}return t(e.update({selection:p.create(o,s),userEvent:"select.search.matches"})),!0},Ar=Le((e,{query:t})=>{let{state:n}=e,{from:i,to:r}=n.selection.main;if(n.readOnly)return!1;let o=t.nextMatch(n,i,i);if(!o)return!1;let s=o,a=[],l,d,h=[];s.from==i&&s.to==r&&(d=n.toText(t.getReplacement(s)),a.push({from:s.from,to:s.to,insert:d}),s=t.nextMatch(n,s.from,s.to),h.push(y.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(i).number)+".")));let m=e.state.changes(a);return s&&(l=p.single(s.from,s.to).map(m),h.push(rn(e,s)),h.push(n.facet(_e).scrollToMatch(l.main,e))),e.dispatch({changes:m,selection:l,effects:h,userEvent:"input.replace"}),!0}),Ys=Le((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map(r=>{let{from:o,to:s}=r;return{from:o,to:s,insert:t.getReplacement(r)}});if(!n.length)return!1;let i=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:y.announce.of(i),userEvent:"input.replace.all"}),!0});function nn(e){return e.state.facet(_e).createPanel(e)}function Zt(e,t){var n,i,r,o,s;let a=e.selection.main,l=a.empty||a.to>a.from+100?"":e.sliceDoc(a.from,a.to);if(t&&!l)return t;let d=e.facet(_e);return new mt({search:((n=t?.literal)!==null&&n!==void 0?n:d.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(i=t?.caseSensitive)!==null&&i!==void 0?i:d.caseSensitive,literal:(r=t?.literal)!==null&&r!==void 0?r:d.literal,regexp:(o=t?.regexp)!==null&&o!==void 0?o:d.regexp,wholeWord:(s=t?.wholeWord)!==null&&s!==void 0?s:d.wholeWord})}function Fr(e){let t=Se(e,nn);return t&&t.dom.querySelector("[main-field]")}function Ir(e){let t=Fr(e);t&&t==e.root.activeElement&&t.select()}var Tr=e=>{let t=e.state.field(z,!1);if(t&&t.panel){let n=Fr(e);if(n&&n!=e.root.activeElement){let i=Zt(e.state,t.query.spec);i.valid&&e.dispatch({effects:Be.of(i)}),n.focus(),n.select()}}else e.dispatch({effects:[tn.of(!0),t?Be.of(Zt(e.state,t.query.spec)):A.appendConfig.of(ta)]});return!0},Or=e=>{let t=e.state.field(z,!1);if(!t||!t.panel)return!1;let n=Se(e,nn);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:tn.of(!1)}),!0},Br=[{key:"Mod-f",run:Tr,scope:"editor search-panel"},{key:"F3",run:vt,shift:Ct,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:vt,shift:Ct,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Or,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Zs},{key:"Mod-Alt-g",run:Os},{key:"Mod-d",run:Us,preventDefault:!0}],Yt=class{constructor(t){this.view=t;let n=this.query=t.state.field(z).query.spec;this.commit=this.commit.bind(this),this.searchField=C("input",{value:n.search,placeholder:E(t,"Find"),"aria-label":E(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=C("input",{value:n.replace,placeholder:E(t,"Replace"),"aria-label":E(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=C("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=C("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=C("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function i(r,o,s){return C("button",{class:"cm-button",name:r,onclick:o,type:"button"},s)}this.dom=C("div",{onkeydown:r=>this.keydown(r),class:"cm-search"},[this.searchField,i("next",()=>vt(t),[E(t,"next")]),i("prev",()=>Ct(t),[E(t,"previous")]),i("select",()=>Xs(t),[E(t,"all")]),C("label",null,[this.caseField,E(t,"match case")]),C("label",null,[this.reField,E(t,"regexp")]),C("label",null,[this.wordField,E(t,"by word")]),...t.state.readOnly?[]:[C("br"),this.replaceField,i("replace",()=>Ar(t),[E(t,"replace")]),i("replaceAll",()=>Ys(t),[E(t,"replace all")])],C("button",{name:"close",onclick:()=>Or(t),"aria-label":E(t,"close"),type:"button"},["\xD7"])])}commit(){let t=new mt({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:Be.of(t)}))}keydown(t){$n(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?Ct:vt)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),Ar(this.view))}update(t){for(let n of t.transactions)for(let i of n.effects)i.is(Be)&&!i.value.eq(this.query)&&this.setQuery(i.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(_e).top}};function E(e,t){return e.state.phrase(t)}var lt=30,ct=/[\s\.,:;?!]/;function rn(e,{from:t,to:n}){let i=e.state.doc.lineAt(t),r=e.state.doc.lineAt(n).to,o=Math.max(i.from,t-lt),s=Math.min(r,n+lt),a=e.state.sliceDoc(o,s);if(o!=i.from){for(let l=0;l<lt;l++)if(!ct.test(a[l+1])&&ct.test(a[l])){a=a.slice(l);break}}if(s!=r){for(let l=a.length-1;l>a.length-lt;l--)if(!ct.test(a[l-1])&&ct.test(a[l])){a=a.slice(0,l);break}}return y.announce.of(`${e.state.phrase("current match")}. ${a} ${e.state.phrase("on line")} ${i.number}.`)}var ea=y.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),ta=[z,Un.low(Qs),ea];var bt=class{constructor(t,n,i){this.from=t,this.to=n,this.diagnostic=i}},se=class e{constructor(t,n,i){this.diagnostics=t,this.panel=n,this.selected=i}static init(t,n,i){let r=i.facet(Ne).markerFilter;r&&(t=r(t,i));let o=t.slice().sort((v,_)=>v.from-_.from||v.to-_.to),s=new Ue,a=[],l=0,d=i.doc.iter(),h=0,m=i.doc.length;for(let v=0;;){let _=v==o.length?null:o[v];if(!_&&!a.length)break;let V,D;if(a.length)V=l,D=a.reduce((b,j)=>Math.min(b,j.to),_&&_.from>V?_.from:1e8);else{if(V=_.from,V>m)break;D=_.to,a.push(_),v++}for(;v<o.length;){let b=o[v];if(b.from==V&&(b.to>b.from||b.to==V))a.push(b),v++,D=Math.min(b.to,D);else{D=Math.min(b.from,D);break}}D=Math.min(D,m);let Re=!1;if(a.some(b=>b.from==V&&(b.to==D||D==m))&&(Re=V==D,!Re&&D-V<10)){let b=V-(h+d.value.length);b>0&&(d.next(b),h=V);for(let j=V;;){if(j>=D){Re=!0;break}if(!d.lineBreak&&h+d.value.length>j)break;j=h+d.value.length,h+=d.value.length,d.next()}}let an=ha(a);if(Re)s.add(V,V,x.widget({widget:new on(an),diagnostics:a.slice()}));else{let b=a.reduce((j,ln)=>ln.markClass?j+" "+ln.markClass:j,"");s.add(V,D,x.mark({class:"cm-lintRange cm-lintRange-"+an+b,diagnostics:a.slice(),inclusiveEnd:a.some(j=>j.to>D)}))}if(l=D,l==m)break;for(let b=0;b<a.length;b++)a[b].to<=l&&a.splice(b--,1)}let g=s.finish();return new e(g,n,K(g))}};function K(e,t=null,n=0){let i=null;return e.between(n,1e9,(r,o,{spec:s})=>{if(!(t&&s.diagnostics.indexOf(t)<0))if(!i)i=new bt(r,o,t||s.diagnostics[0]);else{if(s.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new bt(i.from,o,i.diagnostic)}}),i}function na(e,t){let n=t.pos,i=t.end||n,r=e.state.facet(Ne).hideOn(e,n,i);if(r!=null)return r;let o=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(s=>s.is(Pr))||e.changes.touchesRange(o.from,Math.max(o.to,i)))}function ia(e,t){return e.field(F,!1)?t:t.concat(A.appendConfig.of(fa))}var Pr=A.define(),sn=A.define(),Rr=A.define(),F=he.define({create(){return new se(x.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),i=null,r=e.panel;if(e.selected){let o=t.changes.mapPos(e.selected.from,1);i=K(n,e.selected.diagnostic,o)||K(n,null,o)}!n.size&&r&&t.state.facet(Ne).autoPanel&&(r=null),e=new se(n,r,i)}for(let n of t.effects)if(n.is(Pr)){let i=t.state.facet(Ne).autoPanel?n.value.length?Pe.open:null:e.panel;e=se.init(n.value,i,t.state)}else n.is(sn)?e=new se(e.diagnostics,n.value?Pe.open:null,e.selected):n.is(Rr)&&(e=new se(e.diagnostics,e.panel,n.value));return e},provide:e=>[$e.from(e,t=>t.panel),y.decorations.from(e,t=>t.diagnostics)]});var ra=x.mark({class:"cm-lintRange cm-lintRange-active"});function oa(e,t,n){let{diagnostics:i}=e.state.field(F),r,o=-1,s=-1;i.between(t-(n<0?1:0),t+(n>0?1:0),(l,d,{spec:h})=>{if(t>=l&&t<=d&&(l==d||(t>l||n>0)&&(t<d||n<0)))return r=h.diagnostics,o=l,s=d,!1});let a=e.state.facet(Ne).tooltipFilter;return r&&a&&(r=a(r,e.state)),r?{pos:o,end:s,above:e.state.doc.lineAt(o).to<s,create(){return{dom:sa(e,r)}}}:null}function sa(e,t){return C("ul",{class:"cm-tooltip-lint"},t.map(n=>Gr(e,n,!1)))}var aa=e=>{let t=e.state.field(F,!1);(!t||!t.panel)&&e.dispatch({effects:ia(e.state,[sn.of(!0)])});let n=Se(e,Pe.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},Lr=e=>{let t=e.state.field(F,!1);return!t||!t.panel?!1:(e.dispatch({effects:sn.of(!1)}),!0)},la=e=>{let t=e.state.field(F,!1);if(!t)return!1;let n=e.state.selection.main,i=K(t.diagnostics,null,n.to+1);return!i&&(i=K(t.diagnostics,null,0),!i||i.from==n.from&&i.to==n.to)?!1:(e.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),!0)};var jr=[{key:"Mod-Shift-m",run:aa,preventDefault:!0},{key:"F8",run:la}];var Ne=q.define({combine(e){return k({sources:e.map(t=>t.source).filter(t=>t!=null)},ie(e.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Nr,tooltipFilter:Nr,needsRefresh:(t,n)=>t?n?i=>t(i)||n(i):t:n,hideOn:(t,n)=>t?n?(i,r,o)=>t(i,r,o)||n(i,r,o):t:n,autoPanel:(t,n)=>t||n}))}});function Nr(e,t){return e?t?(n,i)=>t(e(n,i),i):e:t}function Wr(e){let t=[];if(e)e:for(let{name:n}of e){for(let i=0;i<n.length;i++){let r=n[i];if(/[a-zA-Z]/.test(r)&&!t.some(o=>o.toLowerCase()==r.toLowerCase())){t.push(r);continue e}}t.push("")}return t}function Gr(e,t,n){var i;let r=n?Wr(t.actions):[];return C("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},C("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),(i=t.actions)===null||i===void 0?void 0:i.map((o,s)=>{let a=!1,l=v=>{if(v.preventDefault(),a)return;a=!0;let _=K(e.state.field(F).diagnostics,t);_&&o.apply(e,_.from,_.to)},{name:d}=o,h=r[s]?d.indexOf(r[s]):-1,m=h<0?d:[d.slice(0,h),C("u",d.slice(h,h+1)),d.slice(h+1)],g=o.markClass?" "+o.markClass:"";return C("button",{type:"button",class:"cm-diagnosticAction"+g,onclick:l,onmousedown:l,"aria-label":` Action: ${d}${h<0?"":` (access key "${r[s]})"`}.`},m)}),t.source&&C("div",{class:"cm-diagnosticSource"},t.source))}var on=class extends Hn{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return C("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}},xt=class{constructor(t,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Gr(t,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}},Pe=class e{constructor(t){this.view=t,this.items=[];let n=r=>{if(!(r.ctrlKey||r.altKey||r.metaKey)){if(r.keyCode==27)Lr(this.view),this.view.focus();else if(r.keyCode==38||r.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(r.keyCode==40||r.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(r.keyCode==36)this.moveSelection(0);else if(r.keyCode==35)this.moveSelection(this.items.length-1);else if(r.keyCode==13)this.view.focus();else if(r.keyCode>=65&&r.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:o}=this.items[this.selectedIndex],s=Wr(o.actions);for(let a=0;a<s.length;a++)if(s[a].toUpperCase().charCodeAt(0)==r.keyCode){let l=K(this.view.state.field(F).diagnostics,o);l&&o.actions[a].apply(t,l.from,l.to)}}else return;r.preventDefault()}},i=r=>{for(let o=0;o<this.items.length;o++)this.items[o].dom.contains(r.target)&&this.moveSelection(o)};this.list=C("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:i}),this.dom=C("div",{class:"cm-panel-lint"},this.list,C("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Lr(this.view)},"\xD7")),this.update()}get selectedIndex(){let t=this.view.state.field(F).selected;if(!t)return-1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==t.diagnostic)return n;return-1}update(){let{diagnostics:t,selected:n}=this.view.state.field(F),i=0,r=!1,o=null,s=new Set;for(t.between(0,this.view.state.doc.length,(a,l,{spec:d})=>{for(let h of d.diagnostics){if(s.has(h))continue;s.add(h);let m=-1,g;for(let v=i;v<this.items.length;v++)if(this.items[v].diagnostic==h){m=v;break}m<0?(g=new xt(this.view,h),this.items.splice(i,0,g),r=!0):(g=this.items[m],m>i&&(this.items.splice(i,m-i),r=!0)),n&&g.diagnostic==n.diagnostic?g.dom.hasAttribute("aria-selected")||(g.dom.setAttribute("aria-selected","true"),o=g):g.dom.hasAttribute("aria-selected")&&g.dom.removeAttribute("aria-selected"),i++}});i<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new xt(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),r=!0),o?(this.list.setAttribute("aria-activedescendant",o.id),this.view.requestMeasure({key:this,read:()=>({sel:o.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:a,panel:l})=>{let d=l.height/this.list.offsetHeight;a.top<l.top?this.list.scrollTop-=(l.top-a.top)/d:a.bottom>l.bottom&&(this.list.scrollTop+=(a.bottom-l.bottom)/d)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let t=this.list.firstChild;function n(){let i=t;t=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;t!=i.dom;)n();t=i.dom.nextSibling}else this.list.insertBefore(i.dom,t);for(;t;)n()}moveSelection(t){if(this.selectedIndex<0)return;let n=this.view.state.field(F),i=K(n.diagnostics,this.items[t].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:Rr.of(i)})}static open(t){return new e(t)}};function ca(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function _t(e){return ca(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}var ua=y.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:_t("#d11")},".cm-lintRange-warning":{backgroundImage:_t("orange")},".cm-lintRange-info":{backgroundImage:_t("#999")},".cm-lintRange-hint":{backgroundImage:_t("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function da(e){return e=="error"?4:e=="warning"?3:e=="info"?2:1}function ha(e){let t="hint",n=1;for(let i of e){let r=da(i.severity);r>n&&(n=r,t=i.severity)}return t}var fa=[F,y.decorations.compute([F],e=>{let{selected:t,panel:n}=e.field(F);return!t||!n||t.from==t.to?x.none:x.set([ra.range(t.from,t.to)])}),Zn(oa,{hideOn:na}),ua];var Ur=[ei(),ti(),At(),Ut(),si(),St(),zn(),ne.allowMultipleSelections.of(!0),ri(),re(Et,{fallback:!0}),ai(),ci(),di(),Qn(),Xn(),Jn(),Er(),Me.of([...ui,...$t,...Br,...Ht,...oi,...hi,...jr])],Hr=[At(),Ut(),St(),re(Et,{fallback:!0}),Me.of([...$t,...Ht])];var qr=Ve.define(),$r=(()=>{class e{constructor(){this._elementRef=be(vn),this.autoFocus=!1,this.value="",this.disabled=!1,this.readonly=!1,this.theme="light",this.placeholder="",this.indentWithTab=!1,this.indentUnit="",this.lineWrapping=!1,this.highlightWhitespace=!1,this.languages=[],this.language="",this.setup="basic",this.extensions=[],this.change=new X,this.focus=new X,this.blur=new X,this._onChange=()=>{},this._onTouched=()=>{},this._updateListener=y.updateListener.of(n=>{if(n.docChanged&&!n.transactions.some(i=>i.annotation(qr))){let i=n.state.doc.toString();this._onChange(i),this.change.emit(i)}}),this._editableConf=new G,this._readonlyConf=new G,this._themeConf=new G,this._placeholderConf=new G,this._indentWithTabConf=new G,this._indentUnitConf=new G,this._lineWrappingConf=new G,this._highlightWhitespaceConf=new G,this._languageConf=new G}_getAllExtensions(){return[this._updateListener,this._editableConf.of([]),this._readonlyConf.of([]),this._themeConf.of([]),this._placeholderConf.of([]),this._indentWithTabConf.of([]),this._indentUnitConf.of([]),this._lineWrappingConf.of([]),this._highlightWhitespaceConf.of([]),this._languageConf.of([]),this.setup==="basic"?Ur:this.setup==="minimal"?Hr:[],...this.extensions]}ngOnChanges(n){this.view&&(n.value&&this.setValue(this.value),n.disabled&&this.setEditable(!this.disabled),n.readonly&&this.setReadonly(this.readonly),n.theme&&this.setTheme(this.theme),n.placeholder&&this.setPlaceholder(this.placeholder),n.indentWithTab&&this.setIndentWithTab(this.indentWithTab),n.indentUnit&&this.setIndentUnit(this.indentUnit),n.lineWrapping&&this.setLineWrapping(this.lineWrapping),n.highlightWhitespace&&this.setHighlightWhitespace(this.highlightWhitespace),n.language&&this.setLanguage(this.language),(n.setup||n.extensions)&&this.setExtensions(this._getAllExtensions()))}ngOnInit(){this.state=ne.create({doc:this.value,extensions:this._getAllExtensions()}),this.view=new y({root:this.root,parent:this._elementRef.nativeElement,state:this.state}),this.autoFocus&&this.view.focus(),this.view.contentDOM.addEventListener("focus",()=>{this._onTouched(),this.focus.emit()}),this.view.contentDOM.addEventListener("blur",()=>{this._onTouched(),this.blur.emit()}),this.setEditable(!this.disabled),this.setReadonly(this.readonly),this.setTheme(this.theme),this.setPlaceholder(this.placeholder),this.setIndentWithTab(this.indentWithTab),this.setIndentUnit(this.indentUnit),this.setLineWrapping(this.lineWrapping),this.setHighlightWhitespace(this.highlightWhitespace),this.setLanguage(this.language)}ngOnDestroy(){this.view.destroy()}writeValue(n){this.view&&this.setValue(n)}registerOnChange(n){this._onChange=n}registerOnTouched(n){this._onTouched=n}setDisabledState(n){this.disabled=n,this.setEditable(!n)}setValue(n){this.view.dispatch({changes:{from:0,to:this.view.state.doc.length,insert:n},annotations:[fe.addToHistory.of(!1),qr.of(!0)]})}_dispatchEffects(n){return this.view.dispatch({effects:n})}setExtensions(n){this._dispatchEffects(A.reconfigure.of(n))}setEditable(n){this._dispatchEffects(this._editableConf.reconfigure(y.editable.of(n)))}setReadonly(n){this._dispatchEffects(this._readonlyConf.reconfigure(ne.readOnly.of(n)))}setTheme(n){this._dispatchEffects(this._themeConf.reconfigure(n==="light"?[]:n==="dark"?Vr:n))}setPlaceholder(n){this._dispatchEffects(this._placeholderConf.reconfigure(n?Kn(n):[]))}setIndentWithTab(n){this._dispatchEffects(this._indentWithTabConf.reconfigure(n?Me.of([vr]):[]))}setIndentUnit(n){this._dispatchEffects(this._indentUnitConf.reconfigure(n?Ke.of(n):[]))}setLineWrapping(n){this._dispatchEffects(this._lineWrappingConf.reconfigure(n?y.lineWrapping:[]))}setHighlightWhitespace(n){this._dispatchEffects(this._highlightWhitespaceConf.reconfigure(n?ni():[]))}setLanguage(n){if(!n||n=="plaintext"){this._dispatchEffects(this._languageConf.reconfigure([]));return}if(this.languages.length===0){this.view&&console.error("No supported languages. Please set the `languages` prop at first.");return}this._findLanguage(n)?.load().then(r=>{this._dispatchEffects(this._languageConf.reconfigure([r]))})}_findLanguage(n){for(let i of this.languages)for(let r of[i.name,...i.alias])if(n.toLowerCase()===r.toLowerCase())return i;return console.error("Language not found:",n),console.info("Supported language names:",this.languages.map(i=>i.name).join(", ")),null}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275cmp=ae({type:e,selectors:[["code-editor"]],hostAttrs:[1,"code-editor"],inputs:{root:"root",autoFocus:[2,"autoFocus","autoFocus",H],value:"value",disabled:[2,"disabled","disabled",H],readonly:[2,"readonly","readonly",H],theme:"theme",placeholder:"placeholder",indentWithTab:[2,"indentWithTab","indentWithTab",H],indentUnit:"indentUnit",lineWrapping:[2,"lineWrapping","lineWrapping",H],highlightWhitespace:[2,"highlightWhitespace","highlightWhitespace",H],languages:"languages",language:"language",setup:"setup",extensions:"extensions"},outputs:{change:"change",focus:"focus",blur:"blur"},features:[Tn([{provide:_i,useExisting:Dt(()=>e),multi:!0}]),yn],decls:0,vars:0,template:function(i,r){},styles:[`.code-editor{display:block}.code-editor .cm-editor{height:100%}
`],encapsulation:2,changeDetection:0})}}return e})();function u(e){return new ii(li.define(e))}function Q(e){return import("./chunk-KGTGQ7UH.js").then(t=>t.sql({dialect:t[e]}))}var zr=[c.of({name:"C",extensions:["c","h","ino"],load(){return import("./chunk-YPSLPQ3J.js").then(e=>e.cpp())}}),c.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return import("./chunk-YPSLPQ3J.js").then(e=>e.cpp())}}),c.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return Q("Cassandra")}}),c.of({name:"CSS",extensions:["css"],load(){return import("./chunk-NFTLHPTQ.js").then(e=>e.css())}}),c.of({name:"Go",extensions:["go"],load(){return import("./chunk-QP3LLQUG.js").then(e=>e.go())}}),c.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return import("./chunk-DSAFEOMX.js").then(e=>e.html())}}),c.of({name:"Java",extensions:["java"],load(){return import("./chunk-3CO2SA7O.js").then(e=>e.java())}}),c.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return import("./chunk-TZ5VYJUQ.js").then(e=>e.javascript())}}),c.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return import("./chunk-JSHNQZL7.js").then(e=>e.jinja())}}),c.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return import("./chunk-X3ULXD6A.js").then(e=>e.json())}}),c.of({name:"JSX",extensions:["jsx"],load(){return import("./chunk-TZ5VYJUQ.js").then(e=>e.javascript({jsx:!0}))}}),c.of({name:"LESS",extensions:["less"],load(){return import("./chunk-LJMTNGOX.js").then(e=>e.less())}}),c.of({name:"Liquid",extensions:["liquid"],load(){return import("./chunk-NU3TX5QG.js").then(e=>e.liquid())}}),c.of({name:"MariaDB SQL",load(){return Q("MariaSQL")}}),c.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return import("./chunk-KKTXWZ5M.js").then(e=>e.markdown())}}),c.of({name:"MS SQL",load(){return Q("MSSQL")}}),c.of({name:"MySQL",load(){return Q("MySQL")}}),c.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return import("./chunk-XX5X32IA.js").then(e=>e.php())}}),c.of({name:"PLSQL",extensions:["pls"],load(){return Q("PLSQL")}}),c.of({name:"PostgreSQL",load(){return Q("PostgreSQL")}}),c.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return import("./chunk-WUOKZVBE.js").then(e=>e.python())}}),c.of({name:"Rust",extensions:["rs"],load(){return import("./chunk-TFRK7ZW3.js").then(e=>e.rust())}}),c.of({name:"Sass",extensions:["sass"],load(){return import("./chunk-MVMMNFH3.js").then(e=>e.sass({indented:!0}))}}),c.of({name:"SCSS",extensions:["scss"],load(){return import("./chunk-MVMMNFH3.js").then(e=>e.sass())}}),c.of({name:"SQL",extensions:["sql"],load(){return Q("StandardSQL")}}),c.of({name:"SQLite",load(){return Q("SQLite")}}),c.of({name:"TSX",extensions:["tsx"],load(){return import("./chunk-TZ5VYJUQ.js").then(e=>e.javascript({jsx:!0,typescript:!0}))}}),c.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return import("./chunk-TZ5VYJUQ.js").then(e=>e.javascript({typescript:!0}))}}),c.of({name:"WebAssembly",extensions:["wat","wast"],load(){return import("./chunk-DT5NOIRF.js").then(e=>e.wast())}}),c.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return import("./chunk-M2KCFDIA.js").then(e=>e.xml())}}),c.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return import("./chunk-YOQHJO37.js").then(e=>e.yaml())}}),c.of({name:"APL",extensions:["dyalog","apl"],load(){return import("./chunk-XX5OU7HC.js").then(e=>u(e.apl))}}),c.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return import("./chunk-OFVDKOBM.js").then(e=>u(e.asciiArmor))}}),c.of({name:"ASN.1",extensions:["asn","asn1"],load(){return import("./chunk-XOXQAXJK.js").then(e=>u(e.asn1({})))}}),c.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return import("./chunk-CU2WVBLG.js").then(e=>u(e.asterisk))}}),c.of({name:"Brainfuck",extensions:["b","bf"],load(){return import("./chunk-EFXWLNRB.js").then(e=>u(e.brainfuck))}}),c.of({name:"Cobol",extensions:["cob","cpy"],load(){return import("./chunk-AZNHEBQL.js").then(e=>u(e.cobol))}}),c.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return import("./chunk-XH7CP3WH.js").then(e=>u(e.csharp))}}),c.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return import("./chunk-JQWSYKOC.js").then(e=>u(e.clojure))}}),c.of({name:"ClojureScript",extensions:["cljs"],load(){return import("./chunk-JQWSYKOC.js").then(e=>u(e.clojure))}}),c.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return import("./chunk-N6A3QOTK.js").then(e=>u(e.gss))}}),c.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return import("./chunk-6NGIXLXD.js").then(e=>u(e.cmake))}}),c.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return import("./chunk-SXVL4Y5Y.js").then(e=>u(e.coffeeScript))}}),c.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return import("./chunk-EIR66H43.js").then(e=>u(e.commonLisp))}}),c.of({name:"Cypher",extensions:["cyp","cypher"],load(){return import("./chunk-DGFSM75Q.js").then(e=>u(e.cypher))}}),c.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return import("./chunk-7COSBY7T.js").then(e=>u(e.cython))}}),c.of({name:"Crystal",extensions:["cr"],load(){return import("./chunk-7KTFWSIL.js").then(e=>u(e.crystal))}}),c.of({name:"D",extensions:["d"],load(){return import("./chunk-5GOVOIYD.js").then(e=>u(e.d))}}),c.of({name:"Dart",extensions:["dart"],load(){return import("./chunk-XH7CP3WH.js").then(e=>u(e.dart))}}),c.of({name:"diff",extensions:["diff","patch"],load(){return import("./chunk-DETGETOV.js").then(e=>u(e.diff))}}),c.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return import("./chunk-PLMJHWIC.js").then(e=>u(e.dockerFile))}}),c.of({name:"DTD",extensions:["dtd"],load(){return import("./chunk-6LDEVTUO.js").then(e=>u(e.dtd))}}),c.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return import("./chunk-WDEINTXJ.js").then(e=>u(e.dylan))}}),c.of({name:"EBNF",load(){return import("./chunk-OTIOKM4J.js").then(e=>u(e.ebnf))}}),c.of({name:"ECL",extensions:["ecl"],load(){return import("./chunk-QCHOGHSX.js").then(e=>u(e.ecl))}}),c.of({name:"edn",extensions:["edn"],load(){return import("./chunk-JQWSYKOC.js").then(e=>u(e.clojure))}}),c.of({name:"Eiffel",extensions:["e"],load(){return import("./chunk-TOP6KVMO.js").then(e=>u(e.eiffel))}}),c.of({name:"Elm",extensions:["elm"],load(){return import("./chunk-74QH4UCA.js").then(e=>u(e.elm))}}),c.of({name:"Erlang",extensions:["erl"],load(){return import("./chunk-I2J6N6TC.js").then(e=>u(e.erlang))}}),c.of({name:"Esper",load(){return import("./chunk-NUBHIZFI.js").then(e=>u(e.esper))}}),c.of({name:"Factor",extensions:["factor"],load(){return import("./chunk-JOQRJ5NG.js").then(e=>u(e.factor))}}),c.of({name:"FCL",load(){return import("./chunk-IESS5P2D.js").then(e=>u(e.fcl))}}),c.of({name:"Forth",extensions:["forth","fth","4th"],load(){return import("./chunk-Y5GFAPCL.js").then(e=>u(e.forth))}}),c.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return import("./chunk-UFMCL7QR.js").then(e=>u(e.fortran))}}),c.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return import("./chunk-TWVGP4MA.js").then(e=>u(e.fSharp))}}),c.of({name:"Gas",extensions:["s"],load(){return import("./chunk-7WSOIXAI.js").then(e=>u(e.gas))}}),c.of({name:"Gherkin",extensions:["feature"],load(){return import("./chunk-GCMIMXCY.js").then(e=>u(e.gherkin))}}),c.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return import("./chunk-QQJVVOHJ.js").then(e=>u(e.groovy))}}),c.of({name:"Haskell",extensions:["hs"],load(){return import("./chunk-VWRKSVIA.js").then(e=>u(e.haskell))}}),c.of({name:"Haxe",extensions:["hx"],load(){return import("./chunk-YMDSXODZ.js").then(e=>u(e.haxe))}}),c.of({name:"HXML",extensions:["hxml"],load(){return import("./chunk-YMDSXODZ.js").then(e=>u(e.hxml))}}),c.of({name:"HTTP",load(){return import("./chunk-FMSB62OQ.js").then(e=>u(e.http))}}),c.of({name:"IDL",extensions:["pro"],load(){return import("./chunk-TELQDE7A.js").then(e=>u(e.idl))}}),c.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return import("./chunk-THVL57GO.js").then(e=>u(e.jsonld))}}),c.of({name:"Julia",extensions:["jl"],load(){return import("./chunk-OXPRNZUC.js").then(e=>u(e.julia))}}),c.of({name:"Kotlin",extensions:["kt","kts"],load(){return import("./chunk-XH7CP3WH.js").then(e=>u(e.kotlin))}}),c.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return import("./chunk-XQD7PEUD.js").then(e=>u(e.liveScript))}}),c.of({name:"Lua",extensions:["lua"],load(){return import("./chunk-NTIBS5SQ.js").then(e=>u(e.lua))}}),c.of({name:"mIRC",extensions:["mrc"],load(){return import("./chunk-JMU2IPLU.js").then(e=>u(e.mirc))}}),c.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return import("./chunk-7P56QSO2.js").then(e=>u(e.mathematica))}}),c.of({name:"Modelica",extensions:["mo"],load(){return import("./chunk-4DGGOARO.js").then(e=>u(e.modelica))}}),c.of({name:"MUMPS",extensions:["mps"],load(){return import("./chunk-VYLAH4WQ.js").then(e=>u(e.mumps))}}),c.of({name:"Mbox",extensions:["mbox"],load(){return import("./chunk-FARRFGAF.js").then(e=>u(e.mbox))}}),c.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return import("./chunk-N3WSMRXD.js").then(e=>u(e.nginx))}}),c.of({name:"NSIS",extensions:["nsh","nsi"],load(){return import("./chunk-VU7A64GC.js").then(e=>u(e.nsis))}}),c.of({name:"NTriples",extensions:["nt","nq"],load(){return import("./chunk-73Y3GHGT.js").then(e=>u(e.ntriples))}}),c.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return import("./chunk-XH7CP3WH.js").then(e=>u(e.objectiveC))}}),c.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return import("./chunk-XH7CP3WH.js").then(e=>u(e.objectiveCpp))}}),c.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return import("./chunk-TWVGP4MA.js").then(e=>u(e.oCaml))}}),c.of({name:"Octave",extensions:["m"],load(){return import("./chunk-SKA4NWML.js").then(e=>u(e.octave))}}),c.of({name:"Oz",extensions:["oz"],load(){return import("./chunk-HMDKSNYE.js").then(e=>u(e.oz))}}),c.of({name:"Pascal",extensions:["p","pas"],load(){return import("./chunk-QIXZXEKO.js").then(e=>u(e.pascal))}}),c.of({name:"Perl",extensions:["pl","pm"],load(){return import("./chunk-3GPS5JDT.js").then(e=>u(e.perl))}}),c.of({name:"Pig",extensions:["pig"],load(){return import("./chunk-BW4KQ3N7.js").then(e=>u(e.pig))}}),c.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return import("./chunk-PZCE32MP.js").then(e=>u(e.powerShell))}}),c.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return import("./chunk-QPYV46ZF.js").then(e=>u(e.properties))}}),c.of({name:"ProtoBuf",extensions:["proto"],load(){return import("./chunk-6XCJUIRZ.js").then(e=>u(e.protobuf))}}),c.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return import("./chunk-QOVX5D3I.js").then(e=>u(e.pug))}}),c.of({name:"Puppet",extensions:["pp"],load(){return import("./chunk-ILLQJHCE.js").then(e=>u(e.puppet))}}),c.of({name:"Q",extensions:["q"],load(){return import("./chunk-SFP44K2U.js").then(e=>u(e.q))}}),c.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return import("./chunk-SSMQKWQ5.js").then(e=>u(e.r))}}),c.of({name:"RPM Changes",load(){return import("./chunk-LBT44344.js").then(e=>u(e.rpmChanges))}}),c.of({name:"RPM Spec",extensions:["spec"],load(){return import("./chunk-LBT44344.js").then(e=>u(e.rpmSpec))}}),c.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return import("./chunk-ZGOHXRID.js").then(e=>u(e.ruby))}}),c.of({name:"SAS",extensions:["sas"],load(){return import("./chunk-U3DYY42Z.js").then(e=>u(e.sas))}}),c.of({name:"Scala",extensions:["scala"],load(){return import("./chunk-XH7CP3WH.js").then(e=>u(e.scala))}}),c.of({name:"Scheme",extensions:["scm","ss"],load(){return import("./chunk-UB4ORQK4.js").then(e=>u(e.scheme))}}),c.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return import("./chunk-VXHGHTNO.js").then(e=>u(e.shell))}}),c.of({name:"Sieve",extensions:["siv","sieve"],load(){return import("./chunk-N3EZEIUM.js").then(e=>u(e.sieve))}}),c.of({name:"Smalltalk",extensions:["st"],load(){return import("./chunk-LCZTITSQ.js").then(e=>u(e.smalltalk))}}),c.of({name:"Solr",load(){return import("./chunk-OOYJXKFL.js").then(e=>u(e.solr))}}),c.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return import("./chunk-TWVGP4MA.js").then(e=>u(e.sml))}}),c.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return import("./chunk-HLPB3J4F.js").then(e=>u(e.sparql))}}),c.of({name:"Spreadsheet",alias:["excel","formula"],load(){return import("./chunk-4INCJP3B.js").then(e=>u(e.spreadsheet))}}),c.of({name:"Squirrel",extensions:["nut"],load(){return import("./chunk-XH7CP3WH.js").then(e=>u(e.squirrel))}}),c.of({name:"Stylus",extensions:["styl"],load(){return import("./chunk-O5S2MB3G.js").then(e=>u(e.stylus))}}),c.of({name:"Swift",extensions:["swift"],load(){return import("./chunk-NLIIFQDM.js").then(e=>u(e.swift))}}),c.of({name:"sTeX",load(){return import("./chunk-4BECLNDT.js").then(e=>u(e.stex))}}),c.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return import("./chunk-4BECLNDT.js").then(e=>u(e.stex))}}),c.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return import("./chunk-VSO4HZ3B.js").then(e=>u(e.verilog))}}),c.of({name:"Tcl",extensions:["tcl"],load(){return import("./chunk-FF3NVLZY.js").then(e=>u(e.tcl))}}),c.of({name:"Textile",extensions:["textile"],load(){return import("./chunk-K4SB6AOV.js").then(e=>u(e.textile))}}),c.of({name:"TiddlyWiki",load(){return import("./chunk-XUG7OQCA.js").then(e=>u(e.tiddlyWiki))}}),c.of({name:"Tiki wiki",load(){return import("./chunk-EPMXD2MS.js").then(e=>u(e.tiki))}}),c.of({name:"TOML",extensions:["toml"],load(){return import("./chunk-TZJMISVN.js").then(e=>u(e.toml))}}),c.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return import("./chunk-SBCXEE75.js").then(e=>u(e.troff))}}),c.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return import("./chunk-CHFCYNIN.js").then(e=>u(e.ttcn))}}),c.of({name:"TTCN_CFG",extensions:["cfg"],load(){return import("./chunk-F6P7S2AZ.js").then(e=>u(e.ttcnCfg))}}),c.of({name:"Turtle",extensions:["ttl"],load(){return import("./chunk-VSWJZU5L.js").then(e=>u(e.turtle))}}),c.of({name:"Web IDL",extensions:["webidl"],load(){return import("./chunk-Y2QWS7UH.js").then(e=>u(e.webIDL))}}),c.of({name:"VB.NET",extensions:["vb"],load(){return import("./chunk-RH6MLXZA.js").then(e=>u(e.vb))}}),c.of({name:"VBScript",extensions:["vbs"],load(){return import("./chunk-N6SWDFB4.js").then(e=>u(e.vbScript))}}),c.of({name:"Velocity",extensions:["vtl"],load(){return import("./chunk-YUGUHN5O.js").then(e=>u(e.velocity))}}),c.of({name:"Verilog",extensions:["v"],load(){return import("./chunk-VSO4HZ3B.js").then(e=>u(e.verilog))}}),c.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return import("./chunk-WXLPMIX2.js").then(e=>u(e.vhdl))}}),c.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load(){return import("./chunk-NMIUFKUS.js").then(e=>u(e.xQuery))}}),c.of({name:"Yacas",extensions:["ys"],load(){return import("./chunk-AJMRYDFD.js").then(e=>u(e.yacas))}}),c.of({name:"Z80",extensions:["z80"],load(){return import("./chunk-ARXB4ZNL.js").then(e=>u(e.z80))}}),c.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return import("./chunk-VVRPMY3Q.js").then(e=>u(e.mscgen))}}),c.of({name:"X\xF9",extensions:["xu"],load(){return import("./chunk-VVRPMY3Q.js").then(e=>u(e.xu))}}),c.of({name:"MsGenny",extensions:["msgenny"],load(){return import("./chunk-VVRPMY3Q.js").then(e=>u(e.msgenny))}}),c.of({name:"Vue",extensions:["vue"],load(){return import("./chunk-4HYJXNZ2.js").then(e=>e.vue())}}),c.of({name:"Angular Template",load(){return import("./chunk-P2NK6DZ2.js").then(e=>e.angular())}})];function ma(e,t){if(e&1){let n=Sn();I(0,"div",2)(1,"app-button",4),ue("click",function(){mn(n);let r=ee();return pn(r.copyToClipboard())}),B()()}if(e&2){let n=ee();S(),Y("title","Copy")("icon","copy_all")("secondaryIcon","check")("toggled",n.copied())("ghost",!0)}}function pa(e,t){if(e&1&&(I(0,"p",3),xe(1),B()),e&2){let n=ee();S(),je(n.error())}}var Jr=class e{value=de({});rows=de(3);placeholder=de("");disabled=de(!1);valueChange=We();copyButton=de("auto");copied=Z(!1);showCopyButton=L(()=>{let t=this.copyButton();return t==="show"?!0:t==="hide"?!1:this.disabled()});error=Z(null);_lastValue="";_themeService=be(Nn);constructor(){gn(()=>{let t=this.value();t!=null?this._lastValue=JSON.stringify(t,null,2):this._lastValue=""})}displayValue=L(()=>{let t=this.value();if(t==null)return"";try{return JSON.stringify(t,null,2)}catch{return String(t)}});languages=zr;daisyThemeBase=L(()=>y.theme({".cm-content":{},".cm-cursor":{borderLeftColor:this._themeService.primary(),borderLeftWidth:"2px"},".cm-gutters":{backgroundColor:this._themeService.base100(),border:"none",color:this._themeService.neutralContent()},".cm-selectionBackground":{backgroundColor:"transparent"},"&.cm-editor":{backgroundColor:this._themeService.base100(),borderRadius:"8px",color:this._themeService.neutralContent(),height:"auto",padding:"8px"},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{backgroundColor:this._themeService.primary(),opacity:.1}},{dark:this._themeService.isDark()}));daisyHighlightStyle=L(()=>Xe.define([{color:this._themeService.secondary(),tag:f.string},{color:this._themeService.success(),tag:f.number},{color:this._themeService.primary(),tag:f.keyword},{color:this._themeService.baseContent(),tag:f.operator},{color:this._themeService.warning(),tag:f.brace},{color:this._themeService.primary(),fontStyle:"italic",tag:f.null},{color:this._themeService.primary(),tag:f.bool},{color:this._themeService.info(),tag:f.propertyName},{color:`${this._themeService.neutral()}aa`,tag:f.comment}]));daisySyntaxHighlighting=L(()=>re(this.daisyHighlightStyle()));daisyTheme=L(()=>[this.daisyThemeBase(),this.daisySyntaxHighlighting(),y.lineWrapping]);handleValueChange(t){if(!this.disabled()){if(this._lastValue=t,!t.trim()){this.error.set(null),this.value.set({}),this.valueChange.emit({});return}try{JSON.parse(t),this.error.set(null)}catch(n){this.error.set(`Invalid JSON: ${n instanceof Error?n.message:"Unknown error"}`)}}}handleBlur(){if(this.disabled()||this.error())return;let t=this._lastValue;if(!t.trim()){let n={};this.value.set(n),this.valueChange.emit(n);return}try{let n=JSON.parse(t);this.value.set(n),this.valueChange.emit(n)}catch{}}async copyToClipboard(){try{await navigator.clipboard.writeText(this.displayValue()),this.copied.set(!0),setTimeout(()=>this.copied.set(!1),2e3)}catch{}}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=ae({type:e,selectors:[["app-json-textarea"]],inputs:{value:[1,"value"],rows:[1,"rows"],placeholder:[1,"placeholder"],disabled:[1,"disabled"],copyButton:[1,"copyButton"]},outputs:{value:"valueChange",rows:"rowsChange",placeholder:"placeholderChange",disabled:"disabledChange",valueChange:"valueChange",copyButton:"copyButtonChange"},decls:4,vars:8,consts:[[1,"relative"],["language","json","setup","minimal",1,"font-mono",3,"change","blur","value","theme","lineWrapping","languages","placeholder","disabled"],[1,"absolute","top-2","right-2","z-10"],[1,"label","text-error","mt-1"],[3,"click","title","icon","secondaryIcon","toggled","ghost"]],template:function(n,i){n&1&&(I(0,"div",0)(1,"code-editor",1),ue("change",function(o){return i.handleValueChange(o)})("blur",function(){return i.handleBlur()}),B(),le(2,ma,2,5,"div",2),B(),le(3,pa,2,1,"p",3)),n&2&&(S(),Y("value",i.displayValue())("theme",i.daisyTheme())("lineWrapping",!0)("languages",i.languages)("placeholder",i.placeholder())("disabled",i.disabled()),S(),ce(i.showCopyButton()?2:-1),S(),ce(i.error()?3:-1))},dependencies:[$r,Ge],encapsulation:2,changeDetection:0})};export{fi as a,_i as b,pi as c,vi as d,Ci as e,Jr as f};