aldehyde 0.2.156 → 0.2.158
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/controls/action/utils.d.ts.map +1 -1
- package/lib/controls/action/utils.js +0 -1
- package/lib/controls/action/utils.js.map +1 -1
- package/lib/controls/entity-select/entity-select.d.ts.map +1 -1
- package/lib/controls/entity-select/entity-select.js +0 -9
- package/lib/controls/entity-select/entity-select.js.map +1 -1
- package/lib/controls/select/index.d.ts.map +1 -1
- package/lib/controls/select/index.js +0 -1
- package/lib/controls/select/index.js.map +1 -1
- package/lib/controls/upload/index.js +1 -1
- package/lib/controls/upload/index.js.map +1 -1
- package/lib/form/criteria-form.d.ts.map +1 -1
- package/lib/form/criteria-form.js +12 -10
- package/lib/form/criteria-form.js.map +1 -1
- package/lib/layout/MainPage.d.ts.map +1 -1
- package/lib/layout/MainPage.js.map +1 -1
- package/lib/tmpl/hc-data-source.d.ts.map +1 -1
- package/lib/tmpl/hc-data-source.js +1 -3
- package/lib/tmpl/hc-data-source.js.map +1 -1
- package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
- package/lib/tmpl/hcservice-v3.js +4 -3
- package/lib/tmpl/hcservice-v3.js.map +1 -1
- package/lib/tmpl/interface.d.ts +1 -0
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tmpl/superagent.d.ts.map +1 -1
- package/lib/tmpl/superagent.js +0 -1
- package/lib/tmpl/superagent.js.map +1 -1
- package/lib/units/index.d.ts +4 -1
- package/lib/units/index.d.ts.map +1 -1
- package/lib/units/index.js +12 -0
- package/lib/units/index.js.map +1 -1
- package/package.json +1 -1
- package/src/aldehyde/controls/action/utils.tsx +0 -1
- package/src/aldehyde/controls/entity-select/entity-select.tsx +1 -10
- package/src/aldehyde/controls/select/index.tsx +0 -1
- package/src/aldehyde/controls/upload/index.tsx +2 -2
- package/src/aldehyde/form/criteria-form.tsx +21 -10
- package/src/aldehyde/layout/MainPage.tsx +1 -0
- package/src/aldehyde/tmpl/hc-data-source.tsx +1 -3
- package/src/aldehyde/tmpl/hcservice-v3.tsx +4 -3
- package/src/aldehyde/tmpl/interface.tsx +6 -0
- package/src/aldehyde/tmpl/superagent.js +0 -1
- package/src/aldehyde/units/index.tsx +18 -1
- package/dist/bundle.01a0b7dbabd823a67a31.js +0 -2
- package/dist/bundle.01a0b7dbabd823a67a31.js.LICENSE.txt +0 -30
- package/dist/bundle.01a0b7dbabd823a67a31.js.gz +0 -0
- package/dist/bundle.021f784b1c84781461d2.js +0 -1
- package/dist/bundle.03c542ca824e205fe307.js +0 -2
- package/dist/bundle.03c542ca824e205fe307.js.LICENSE.txt +0 -27
- package/dist/bundle.03c542ca824e205fe307.js.gz +0 -0
- package/dist/bundle.15cb660c34802f6cccf5.js +0 -1
- package/dist/bundle.15cb660c34802f6cccf5.js.gz +0 -0
- package/dist/bundle.1efe3c525f7cb5289934.js +0 -1
- package/dist/bundle.1efe3c525f7cb5289934.js.gz +0 -0
- package/dist/bundle.23c961ccfebfb418bb3f.js +0 -1
- package/dist/bundle.23c961ccfebfb418bb3f.js.gz +0 -0
- package/dist/bundle.2465eaaa7b912bcdfa45.js +0 -2
- package/dist/bundle.2465eaaa7b912bcdfa45.js.LICENSE.txt +0 -32
- package/dist/bundle.2465eaaa7b912bcdfa45.js.gz +0 -0
- package/dist/bundle.320c02187dd135005102.js +0 -2
- package/dist/bundle.320c02187dd135005102.js.LICENSE.txt +0 -6
- package/dist/bundle.320c02187dd135005102.js.gz +0 -0
- package/dist/bundle.35a4af7e2d0da1942d79.js +0 -10
- package/dist/bundle.35a4af7e2d0da1942d79.js.gz +0 -0
- package/dist/bundle.3b2c7bdbe61a4cf963e4.js +0 -1
- package/dist/bundle.3b2c7bdbe61a4cf963e4.js.gz +0 -0
- package/dist/bundle.3f9072b1629cdb384b46.js +0 -2
- package/dist/bundle.3f9072b1629cdb384b46.js.LICENSE.txt +0 -5
- package/dist/bundle.3f9072b1629cdb384b46.js.gz +0 -0
- package/dist/bundle.46e2295b5360a725bcd5.js +0 -1
- package/dist/bundle.46e2295b5360a725bcd5.js.gz +0 -0
- package/dist/bundle.492530b9d526ae515db6.js +0 -2
- package/dist/bundle.492530b9d526ae515db6.js.LICENSE.txt +0 -7
- package/dist/bundle.492530b9d526ae515db6.js.gz +0 -0
- package/dist/bundle.4c3c988531c3cf360b87.js +0 -1
- package/dist/bundle.4c3c988531c3cf360b87.js.gz +0 -0
- package/dist/bundle.4da1a8a32161584fc0af.js +0 -1
- package/dist/bundle.5a9afb9ee6cceca506fa.js +0 -5
- package/dist/bundle.5a9afb9ee6cceca506fa.js.LICENSE.txt +0 -10
- package/dist/bundle.5a9afb9ee6cceca506fa.js.gz +0 -0
- package/dist/bundle.5e6cccd06b34a0e3a2ff.js +0 -1
- package/dist/bundle.5e6cccd06b34a0e3a2ff.js.gz +0 -0
- package/dist/bundle.61cf0615267bbaa0da3d.js +0 -2
- package/dist/bundle.61cf0615267bbaa0da3d.js.LICENSE.txt +0 -16
- package/dist/bundle.61cf0615267bbaa0da3d.js.gz +0 -0
- package/dist/bundle.66521244df6a9af1f8d7.js +0 -1
- package/dist/bundle.66521244df6a9af1f8d7.js.gz +0 -0
- package/dist/bundle.6fd2dadd29083268c5a6.js +0 -2
- package/dist/bundle.6fd2dadd29083268c5a6.js.LICENSE.txt +0 -17
- package/dist/bundle.6fd2dadd29083268c5a6.js.gz +0 -0
- package/dist/bundle.7fd0f10501de7fdda584.js +0 -1
- package/dist/bundle.7fd0f10501de7fdda584.js.gz +0 -0
- package/dist/bundle.8241d8d05e35988dd480.js +0 -1
- package/dist/bundle.8241d8d05e35988dd480.js.gz +0 -0
- package/dist/bundle.840e28984e710e12f467.js +0 -75
- package/dist/bundle.840e28984e710e12f467.js.LICENSE.txt +0 -8
- package/dist/bundle.840e28984e710e12f467.js.gz +0 -0
- package/dist/bundle.a049dc8814bbbf59160f.js +0 -1
- package/dist/bundle.a049dc8814bbbf59160f.js.gz +0 -0
- package/dist/bundle.a40e498a0d3d2ac8fb3c.js +0 -1
- package/dist/bundle.a40e498a0d3d2ac8fb3c.js.gz +0 -0
- package/dist/bundle.b7b86a025aa95dea0e19.js +0 -2
- package/dist/bundle.b7b86a025aa95dea0e19.js.LICENSE.txt +0 -8
- package/dist/bundle.b7b86a025aa95dea0e19.js.gz +0 -0
- package/dist/bundle.b7e3eb480b649b3de67b.js +0 -2
- package/dist/bundle.b7e3eb480b649b3de67b.js.LICENSE.txt +0 -5
- package/dist/bundle.b7e3eb480b649b3de67b.js.gz +0 -0
- package/dist/bundle.c1c6028fd703ebf78c2e.js +0 -2
- package/dist/bundle.c1c6028fd703ebf78c2e.js.LICENSE.txt +0 -5
- package/dist/bundle.c1c6028fd703ebf78c2e.js.gz +0 -0
- package/dist/bundle.cd10ae07e0e0c36d0dee.js +0 -2
- package/dist/bundle.cd10ae07e0e0c36d0dee.js.LICENSE.txt +0 -22
- package/dist/bundle.cd10ae07e0e0c36d0dee.js.gz +0 -0
- package/dist/bundle.cf6a1933769c2aee4e6e.js +0 -1
- package/dist/bundle.cf6a1933769c2aee4e6e.js.gz +0 -0
- package/dist/bundle.e760a70171cf0ae4567b.js +0 -1
- package/dist/bundle.e760a70171cf0ae4567b.js.gz +0 -0
- package/dist/bundle.f2b373e87dc8616576e5.js +0 -2
- package/dist/bundle.f2b373e87dc8616576e5.js.LICENSE.txt +0 -1
- package/dist/bundle.f2b373e87dc8616576e5.js.gz +0 -0
- package/dist/bundle.f6e1c4fda58154810fe2.js +0 -2
- package/dist/bundle.f6e1c4fda58154810fe2.js.LICENSE.txt +0 -41
- package/dist/bundle.f6e1c4fda58154810fe2.js.gz +0 -0
- package/dist/bundle.fa1e5bf8d58b99ef68e5.js +0 -2
- package/dist/bundle.fa1e5bf8d58b99ef68e5.js.LICENSE.txt +0 -1
- package/dist/bundle.fa1e5bf8d58b99ef68e5.js.gz +0 -0
- package/dist/bundle.fe9c09b8ace9c3117b0a.js +0 -1
- package/dist/bundle.fe9c09b8ace9c3117b0a.js.gz +0 -0
- package/dist/bundle.feaa17bec2057a4ee54f.js +0 -1
- package/dist/bundle.feaa17bec2057a4ee54f.js.gz +0 -0
- package/dist/css/chemstruc-graph-6437e59640f8b99b774f.css +0 -12
- package/dist/css/chemstruc-graph-6437e59640f8b99b774f.css.gz +0 -0
- package/dist/css/common-901df6b21f13391f2a53.css +0 -56
- package/dist/css/html-editor-draft-5e8e152675ab7d201c00.css +0 -886
- package/dist/css/html-editor-draft-5e8e152675ab7d201c00.css.gz +0 -0
- package/dist/css/main-d450a9a253ac65933d37.css +0 -1071
- package/dist/css/main-d450a9a253ac65933d37.css.gz +0 -0
- package/dist/images/logo-54b328b7.png +0 -0
- package/dist/index.html +0 -4
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkaldehyde=self.webpackChunkaldehyde||[]).push([[112],{47404:function(e,t,n){n.d(t,{Ar:function(){return c},Bc:function(){return ne},OO:function(){return he},et:function(){return a},wm:function(){return J},yU:function(){return ue}});var o=n(6585),r=n(1371),i=n(15874);class s{constructor(e,t,n){this.state=e,this.pos=t,this.explicit=n,this.abortListeners=[]}tokenBefore(e){let t=(0,i.mv)(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),o=t.text.slice(n-t.from,this.pos-t.from),r=o.search(f(e,!1));return r<0?null:{from:n+r,to:this.pos,text:o.slice(r)}}get aborted(){return null==this.abortListeners}addEventListener(e,t){"abort"==e&&this.abortListeners&&this.abortListeners.push(t)}}function l(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function a(e){let t=e.map((e=>"string"==typeof e?{label:e}:e)),[n,o]=t.every((e=>/^\w+$/.test(e.label)))?[/\w*$/,/\w+$/]:function(e){let t=Object.create(null),n=Object.create(null);for(let{label:o}of e){t[o[0]]=!0;for(let e=1;e<o.length;e++)n[o[e]]=!0}let o=l(t)+l(n)+"*$";return[new RegExp("^"+o),new RegExp(o)]}(t);return e=>{let r=e.matchBefore(o);return r||e.explicit?{from:r?r.from:e.pos,options:t,validFor:n}:null}}function c(e,t){return n=>{for(let t=(0,i.mv)(n.state).resolveInner(n.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(n)}}class u{constructor(e,t,n,o){this.completion=e,this.source=t,this.match=n,this.score=o}}function h(e){return e.selection.main.from}function f(e,t){var n;let{source:o}=e,r=t&&"^"!=o[0],i="$"!=o[o.length-1];return r||i?new RegExp(`${r?"^":""}(?:${o})${i?"$":""}`,null!==(n=e.flags)&&void 0!==n?n:e.ignoreCase?"i":""):e}const d=o.YH.define(),p=new WeakMap;function m(e){if(!Array.isArray(e))return e;let t=p.get(e);return t||p.set(e,t=a(e)),t}const g=o.Pe.define(),v=o.Pe.define();class y{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=(0,o.vS)(e,t),r=(0,o.Fh)(n);this.chars.push(n);let i=e.slice(t,t+r),s=i.toUpperCase();this.folded.push((0,o.vS)(s==i?i.toLowerCase():s,0)),t+=r}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(0==this.pattern.length)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:r,precise:i,byWord:s}=this;if(1==t.length){let r=(0,o.vS)(e,0),i=(0,o.Fh)(r),s=i==e.length?0:-100;if(r==t[0]);else{if(r!=n[0])return null;s+=-200}return this.ret(s,[0,i])}let l=e.indexOf(this.pattern);if(0==l)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let a=t.length,c=0;if(l<0){for(let i=0,s=Math.min(e.length,200);i<s&&c<a;){let s=(0,o.vS)(e,i);s!=t[c]&&s!=n[c]||(r[c++]=i),i+=(0,o.Fh)(s)}if(c<a)return null}let u=0,h=0,f=!1,d=0,p=-1,m=-1,g=/[a-z]/.test(e),v=!0;for(let r=0,c=Math.min(e.length,200),y=0;r<c&&h<a;){let c=(0,o.vS)(e,r);l<0&&(u<a&&c==t[u]&&(i[u++]=r),d<a&&(c==t[d]||c==n[d]?(0==d&&(p=r),m=r+1,d++):d=0));let k,b=c<255?c>=48&&c<=57||c>=97&&c<=122?2:c>=65&&c<=90?1:0:(k=(0,o.MK)(c))!=k.toLowerCase()?1:k!=k.toUpperCase()?2:0;(!r||1==b&&g||0==y&&0!=b)&&(t[h]==c||n[h]==c&&(f=!0)?s[h++]=r:s.length&&(v=!1)),y=b,r+=(0,o.Fh)(c)}return h==a&&0==s[0]&&v?this.result((f?-200:0)-100,s,e):d==a&&0==p?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):d==a?this.ret(-900-e.length,[p,m]):h==a?this.result((f?-200:0)-100-700+(v?0:-1100),s,e):2==t.length?null:this.result((r[0]?-700:0)-200-1100,r,e)}result(e,t,n){let r=[],i=0;for(let e of t){let t=e+(this.astral?(0,o.Fh)((0,o.vS)(n,e)):1);i&&r[i-1]==e?r[i-1]=t:(r[i++]=e,r[i++]=t)}return this.ret(e-n.length,r)}}class k{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return null==n?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}}const b=o.sj.define({combine(e){return(0,o.QR)(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:O,filterStrict:!1,compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>w(e(n),t(n)),optionClass:(e,t)=>n=>w(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function w(e,t){return e?t?e+" "+t:e:t}function O(e,t,n,o,i,s){let l,a,c=e.textDirection==r.OP.RTL,u=c,h=!1,f="top",d=t.left-i.left,p=i.right-t.right,m=o.right-o.left,g=o.bottom-o.top;if(u&&d<Math.min(m,p)?u=!1:!u&&p<Math.min(m,d)&&(u=!0),m<=(u?d:p))l=Math.max(i.top,Math.min(n.top,i.bottom-g))-t.top,a=Math.min(400,u?d:p);else{h=!0,a=Math.min(400,(c?t.right:i.right-t.left)-30);let e=i.bottom-t.bottom;e>=g||e>t.top?l=n.bottom-t.top:(f="bottom",l=t.bottom-n.top)}return{style:`${f}: ${l/((t.bottom-t.top)/s.offsetHeight)}px; max-width: ${a/((t.right-t.left)/s.offsetWidth)}px`,class:"cm-completionInfo-"+(h?c?"left-narrow":"right-narrow":u?"left":"right")}}function x(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let o=Math.floor((e-t)/n);return{from:e-(o+1)*n,to:e-o*n}}class A{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass="";let o=e.state.field(t),{options:r,selected:i}=o.open,s=e.state.facet(b);this.optionContent=function(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement("div");return t.classList.add("cm-completionIcon"),e.type&&t.classList.add(...e.type.split(/\s+/g).map((e=>"cm-completionIcon-"+e))),t.setAttribute("aria-hidden","true"),t},position:20}),t.push({render(e,t,n,o){let r=document.createElement("span");r.className="cm-completionLabel";let i=e.displayLabel||e.label,s=0;for(let e=0;e<o.length;){let t=o[e++],n=o[e++];t>s&&r.appendChild(document.createTextNode(i.slice(s,t)));let l=r.appendChild(document.createElement("span"));l.appendChild(document.createTextNode(i.slice(t,n))),l.className="cm-completionMatchedText",s=n}return s<i.length&&r.appendChild(document.createTextNode(i.slice(s))),r},position:50},{render(e){if(!e.detail)return null;let t=document.createElement("span");return t.className="cm-completionDetail",t.textContent=e.detail,t},position:80}),t.sort(((e,t)=>e.position-t.position)).map((e=>e.render))}(s),this.optionClass=s.optionClass,this.tooltipClass=s.tooltipClass,this.range=x(r.length,i,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",(n=>{let{options:o}=e.state.field(t).open;for(let t,r=n.target;r&&r!=this.dom;r=r.parentNode)if("LI"==r.nodeName&&(t=/-(\d+)$/.exec(r.id))&&+t[1]<o.length)return this.applyCompletion(e,o[+t[1]]),void n.preventDefault()})),this.dom.addEventListener("focusout",(t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(b).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:v.of(null)})})),this.showOptions(r,o.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}update(e){var t;let n=e.state.field(this.stateField),o=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=o){let{options:r,selected:i,disabled:s}=n.open;o.open&&o.open.options==r||(this.range=x(r.length,i,e.state.facet(b).maxRenderedOptions),this.showOptions(r,n.id)),this.updateSel(),s!=(null===(t=o.open)||void 0===t?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!s)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(" "))e&&this.dom.classList.remove(e);for(let e of t.split(" "))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if((t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=x(t.options.length,t.selected,this.view.state.facet(b).maxRenderedOptions),this.showOptions(t.options,e.id)),this.updateSelectedOption(t.selected)){this.destroyInfo();let{completion:n}=t.options[t.selected],{info:o}=n;if(!o)return;let i="string"==typeof o?document.createTextNode(o):o(n);if(!i)return;"then"in i?i.then((t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,n)})).catch((e=>(0,r.c_)(this.view.state,e,"completion info"))):this.addInfoPane(i,n)}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",null!=e.nodeType)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:o}=e;n.appendChild(t),this.infoDestroy=o||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,o=this.range.from;n;n=n.nextSibling,o++)"LI"==n.nodeName&&n.id?o==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&n.removeAttribute("aria-selected"):o--;return t&&function(e,t){let n=e.getBoundingClientRect(),o=t.getBoundingClientRect(),r=n.height/e.offsetHeight;o.top<n.top?e.scrollTop-=(n.top-o.top)/r:o.bottom>n.bottom&&(e.scrollTop+=(o.bottom-n.bottom)/r)}(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),o=e.getBoundingClientRect(),r=this.space;if(!r){let e=this.dom.ownerDocument.defaultView||window;r={left:0,top:0,right:e.innerWidth,bottom:e.innerHeight}}return o.top>Math.min(r.bottom,t.bottom)-10||o.bottom<Math.max(r.top,t.top)+10?null:this.view.state.facet(b).positionInfo(this.view,t,o,n,r,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,n){const o=document.createElement("ul");o.id=t,o.setAttribute("role","listbox"),o.setAttribute("aria-expanded","true"),o.setAttribute("aria-label",this.view.state.phrase("Completions"));let r=null;for(let i=n.from;i<n.to;i++){let{completion:s,match:l}=e[i],{section:a}=s;if(a){let e="string"==typeof a?a:a.name;e!=r&&(i>n.from||0==n.from)&&(r=e,"string"!=typeof a&&a.header?o.appendChild(a.header(a)):o.appendChild(document.createElement("completion-section")).textContent=e)}const c=o.appendChild(document.createElement("li"));c.id=t+"-"+i,c.setAttribute("role","option");let u=this.optionClass(s);u&&(c.className=u);for(let e of this.optionContent){let t=e(s,this.view.state,this.view,l);t&&c.appendChild(t)}}return n.from&&o.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&o.classList.add("cm-completionListIncompleteBottom"),o}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function C(e,t){return n=>new A(n,e,t)}function S(e){return 100*(e.boost||0)+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}class P{constructor(e,t,n,o,r,i){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=o,this.selected=r,this.disabled=i}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new P(this.options,B(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,o,r){let i=function(e,t){let n=[],o=null,r=e=>{n.push(e);let{section:t}=e.completion;if(t){o||(o=[]);let e="string"==typeof t?t:t.name;o.some((t=>t.name==e))||o.push("string"==typeof t?{name:e}:t)}},i=t.facet(b);for(let o of e)if(o.hasResult()){let e=o.result.getMatch;if(!1===o.result.filter)for(let t of o.result.options)r(new u(t,o.source,e?e(t):[],1e9-n.length));else{let n,s=t.sliceDoc(o.from,o.to),l=i.filterStrict?new k(s):new y(s);for(let t of o.result.options)if(n=l.match(t.label)){let i=t.displayLabel?e?e(t,n.matched):[]:n.matched;r(new u(t,o.source,i,n.score+(t.boost||0)))}}}if(o){let e=Object.create(null),t=0,r=(e,t)=>{var n,o;return(null!==(n=e.rank)&&void 0!==n?n:1e9)-(null!==(o=t.rank)&&void 0!==o?o:1e9)||(e.name<t.name?-1:1)};for(let n of o.sort(r))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e["string"==typeof n?n:n.name])}}let s=[],l=null,a=i.compareCompletions;for(let e of n.sort(((e,t)=>t.score-e.score||a(e.completion,t.completion)))){let t=e.completion;!l||l.label!=t.label||l.detail!=t.detail||null!=l.type&&null!=t.type&&l.type!=t.type||l.apply!=t.apply||l.boost!=t.boost?s.push(e):S(e.completion)>S(l)&&(s[s.length-1]=e),l=e.completion}return s}(e,t);if(!i.length)return o&&e.some((e=>1==e.state))?new P(o.options,o.attrs,o.tooltip,o.timestamp,o.selected,!0):null;let s=t.facet(b).selectOnOpen?0:-1;if(o&&o.selected!=s&&-1!=o.selected){let e=o.options[o.selected].completion;for(let t=0;t<i.length;t++)if(i[t].completion==e){s=t;break}}return new P(i,B(n,s),{pos:e.reduce(((e,t)=>t.hasResult()?Math.min(e,t.from):e),1e8),create:E,above:r.aboveCursor},o?o.timestamp:Date.now(),s,!1)}map(e){return new P(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class T{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new T(I,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(e){let{state:t}=e,n=t.facet(b),o=(n.override||t.languageDataAt("autocomplete",h(t)).map(m)).map((t=>(this.active.find((e=>e.source==t))||new Q(t,this.active.some((e=>0!=e.state))?1:0)).update(e,n)));o.length==this.active.length&&o.every(((e,t)=>e==this.active[t]))&&(o=this.active);let r=this.open;r&&e.docChanged&&(r=r.map(e.changes)),e.selection||o.some((t=>t.hasResult()&&e.changes.touchesRange(t.from,t.to)))||!function(e,t){if(e==t)return!0;for(let n=0,o=0;;){for(;n<e.length&&!e[n].hasResult;)n++;for(;o<t.length&&!t[o].hasResult;)o++;let r=n==e.length,i=o==t.length;if(r||i)return r==i;if(e[n++].result!=t[o++].result)return!1}}(o,this.active)?r=P.build(o,t,this.id,r,n):r&&r.disabled&&!o.some((e=>1==e.state))&&(r=null),!r&&o.every((e=>1!=e.state))&&o.some((e=>e.hasResult()))&&(o=o.map((e=>e.hasResult()?new Q(e.source,0):e)));for(let t of e.effects)t.is(_)&&(r=r&&r.setSelected(t.value,this.id));return o==this.active&&r==this.open?this:new T(o,this.id,r)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:D}}const D={"aria-autocomplete":"list"};function B(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const I=[];function M(e,t){if(e.isUserEvent("input.complete")){let n=e.annotation(d);if(n&&t.activateOnCompletion(n))return"input"}return e.isUserEvent("input.type")?"input":e.isUserEvent("delete.backward")?"delete":null}class Q{constructor(e,t,n=-1){this.source=e,this.state=t,this.explicitPos=n}hasResult(){return!1}update(e,t){let n=M(e,t),o=this;n?o=o.handleUserEvent(e,n,t):e.docChanged?o=o.handleChange(e):e.selection&&0!=o.state&&(o=new Q(o.source,0));for(let t of e.effects)if(t.is(g))o=new Q(o.source,1,t.value?h(e.state):-1);else if(t.is(v))o=new Q(o.source,0);else if(t.is(L))for(let e of t.value)e.source==o.source&&(o=e);return o}handleUserEvent(e,t,n){return"delete"!=t&&n.activateOnTyping?new Q(this.source,1):this.map(e.changes)}handleChange(e){return e.changes.touchesRange(h(e.startState))?new Q(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new Q(this.source,this.state,e.mapPos(this.explicitPos))}}class R extends Q{constructor(e,t,n,o,r){super(e,2,t),this.result=n,this.from=o,this.to=r}hasResult(){return!0}handleUserEvent(e,t,n){var o;let r=this.result;r.map&&!e.changes.empty&&(r=r.map(r,e.changes));let i=e.changes.mapPos(this.from),l=e.changes.mapPos(this.to,1),a=h(e.state);if((this.explicitPos<0?a<=i:a<this.from)||a>l||!r||"delete"==t&&h(e.startState)==this.from)return new Q(this.source,"input"==t&&n.activateOnTyping?1:0);let c=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos);return function(e,t,n,o){if(!e)return!1;let r=t.sliceDoc(n,o);return"function"==typeof e?e(r,n,o,t):f(e,!0).test(r)}(r.validFor,e.state,i,l)?new R(this.source,c,r,i,l):r.update&&(r=r.update(r,i,l,new s(e.state,a,c>=0)))?new R(this.source,c,r,r.from,null!==(o=r.to)&&void 0!==o?o:h(e.state)):new Q(this.source,1,c)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new Q(this.source,0):this.map(e.changes)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new R(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new Q(this.source,0)}}const L=o.Pe.define({map(e,t){return e.map((e=>e.map(t)))}}),_=o.Pe.define(),N=o.sU.define({create(){return T.start()},update(e,t){return e.update(t)},provide:e=>[r.DK.from(e,(e=>e.tooltip)),r.Lz.contentAttributes.from(e,(e=>e.attrs))]});function U(e,t){const n=t.completion.apply||t.completion.label;let r=e.state.field(N).active.find((e=>e.source==t.source));return r instanceof R&&("string"==typeof n?e.dispatch(Object.assign(Object.assign({},function(e,t,n,r){let{main:i}=e.selection,s=n-i.from,l=r-i.from;return Object.assign(Object.assign({},e.changeByRange((a=>a!=i&&n!=r&&e.sliceDoc(a.from+s,a.from+l)!=e.sliceDoc(n,r)?{range:a}:{changes:{from:a.from+s,to:r==i.from?a.to:a.from+l,insert:t},range:o.OF.cursor(a.from+s+t.length)}))),{scrollIntoView:!0,userEvent:"input.complete"})}(e.state,n,r.from,r.to)),{annotations:d.of(t.completion)})):n(e,t.completion,r.from,r.to),!0)}const E=C(N,U);function F(e,t="option"){return n=>{let o=n.state.field(N,!1);if(!o||!o.open||o.open.disabled||Date.now()-o.open.timestamp<n.state.facet(b).interactionDelay)return!1;let i,s=1;"page"==t&&(i=(0,r.Eg)(n,o.open.tooltip))&&(s=Math.max(2,Math.floor(i.dom.offsetHeight/i.dom.querySelector("li").offsetHeight)-1));let{length:l}=o.open.options,a=o.open.selected>-1?o.open.selected+s*(e?1:-1):e?0:l-1;return a<0?a="page"==t?0:l-1:a>=l&&(a="page"==t?l-1:0),n.dispatch({effects:_.of(a)}),!0}}class j{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const z=r.Z9.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(N).active)1==t.state&&this.startQuery(t)}update(e){let t=e.state.field(N),n=e.state.facet(b);if(!e.selectionSet&&!e.docChanged&&e.startState.field(N)==t)return;let o=e.transactions.some((e=>(e.selection||e.docChanged)&&!M(e,n)));for(let t=0;t<this.running.length;t++){let n=this.running[t];if(o||n.updates.length+e.transactions.length>50&&Date.now()-n.time>1e3){for(let e of n.context.abortListeners)try{e()}catch(e){(0,r.c_)(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some((e=>e.effects.some((e=>e.is(g)))))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some((e=>1==e.state&&!this.running.some((t=>t.active.source==e.source))))?setTimeout((()=>this.startUpdate()),i):-1,0!=this.composing)for(let t of e.transactions)"input"==M(t,n)?this.composing=2:2==this.composing&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(N);for(let e of t.active)1!=e.state||this.running.some((t=>t.active.source==e.source))||this.startQuery(e)}startQuery(e){let{state:t}=this.view,n=h(t),o=new s(t,n,e.explicitPos==n),i=new j(e,o);this.running.push(i),Promise.resolve(e.source(o)).then((e=>{i.context.aborted||(i.done=e||null,this.scheduleAccept())}),(e=>{this.view.dispatch({effects:v.of(null)}),(0,r.c_)(this.view.state,e)}))}scheduleAccept(){this.running.every((e=>void 0!==e.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),this.view.state.facet(b).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(b);for(let o=0;o<this.running.length;o++){let r=this.running[o];if(void 0===r.done)continue;if(this.running.splice(o--,1),r.done){let o=new R(r.active.source,r.active.explicitPos,r.done,r.done.from,null!==(e=r.done.to)&&void 0!==e?e:h(r.updates.length?r.updates[0].startState:this.view.state));for(let e of r.updates)o=o.update(e,n);if(o.hasResult()){t.push(o);continue}}let i=this.view.state.field(N).active.find((e=>e.source==r.active.source));if(i&&1==i.state)if(null==r.done){let e=new Q(r.active.source,0);for(let t of r.updates)e=e.update(t,n);1!=e.state&&t.push(e)}else this.startQuery(i)}t.length&&this.view.dispatch({effects:L.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(N,!1);if(t&&t.tooltip&&this.view.state.facet(b).closeOnBlur){let n=t.open&&(0,r.Eg)(this.view,t.open.tooltip);n&&n.dom.contains(e.relatedTarget)||setTimeout((()=>this.view.dispatch({effects:v.of(null)})),10)}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:g.of(!1)})),20),this.composing=0}}}),$="object"==typeof navigator&&/Win/.test(navigator.platform),Z=o.Nb.highest(r.Lz.domEventHandlers({keydown(e,t){let n=t.state.field(N,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&(!$||!e.altKey)||e.metaKey)return!1;let o=n.open.options[n.open.selected],r=n.active.find((e=>e.source==o.source)),i=o.completion.commitCharacters||r.result.commitCharacters;return i&&i.indexOf(e.key)>-1&&U(t,o),!1}})),V=r.Lz.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),q={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},H=o.Pe.define({map(e,t){let n=t.mapPos(e,-1,o.iR.TrackAfter);return null==n?void 0:n}}),W=new class extends o.FB{};W.startSide=1,W.endSide=-1;const X=o.sU.define({create(){return o.om.empty},update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(H)&&(e=e.update({add:[W.range(n.value,n.value+1)]}));return e}});function J(){return[te,X]}const Y="()[]{}<>";function K(e){for(let t=0;t<8;t+=2)if(Y.charCodeAt(t)==e)return Y.charAt(t+1);return(0,o.MK)(e<128?e:e+1)}function G(e,t){return e.languageDataAt("closeBrackets",t)[0]||q}const ee="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),te=r.Lz.inputHandler.of(((e,t,n,r)=>{if((ee?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||2==r.length&&1==(0,o.Fh)((0,o.vS)(r,0))||t!=i.from||n!=i.to)return!1;let s=function(e,t){let n=G(e,e.selection.main.head),r=n.brackets||q.brackets;for(let i of r){let s=K((0,o.vS)(i,0));if(t==i)return s==i?le(e,i,r.indexOf(i+i+i)>-1,n):ie(e,i,s,n.before||q.before);if(t==s&&oe(e,e.selection.main.from))return se(e,0,s)}return null}(e.state,r);return!!s&&(e.dispatch(s),!0)})),ne=[{key:"Backspace",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=G(e,e.selection.main.head).brackets||q.brackets,r=null,i=e.changeByRange((t=>{if(t.empty){let r=function(e,t){let n=e.sliceString(t-2,t);return(0,o.Fh)((0,o.vS)(n,0))==n.length?n:n.slice(1)}(e.doc,t.head);for(let i of n)if(i==r&&re(e.doc,t.head)==K((0,o.vS)(i,0)))return{changes:{from:t.head-i.length,to:t.head+i.length},range:o.OF.cursor(t.head-i.length)}}return{range:r=t}}));return r||t(e.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!r}}];function oe(e,t){let n=!1;return e.field(X).between(0,e.doc.length,(e=>{e==t&&(n=!0)})),n}function re(e,t){let n=e.sliceString(t,t+2);return n.slice(0,(0,o.Fh)((0,o.vS)(n,0)))}function ie(e,t,n,r){let i=null,s=e.changeByRange((s=>{if(!s.empty)return{changes:[{insert:t,from:s.from},{insert:n,from:s.to}],effects:H.of(s.to+t.length),range:o.OF.range(s.anchor+t.length,s.head+t.length)};let l=re(e.doc,s.head);return!l||/\s/.test(l)||r.indexOf(l)>-1?{changes:{insert:t+n,from:s.head},effects:H.of(s.head+t.length),range:o.OF.cursor(s.head+t.length)}:{range:i=s}}));return i?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function se(e,t,n){let r=null,i=e.changeByRange((t=>t.empty&&re(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:o.OF.cursor(t.head+n.length)}:r={range:t}));return r?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function le(e,t,n,r){let s=r.stringPrefixes||q.stringPrefixes,l=null,a=e.changeByRange((r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:t,from:r.to}],effects:H.of(r.to+t.length),range:o.OF.range(r.anchor+t.length,r.head+t.length)};let a,c=r.head,u=re(e.doc,c);if(u==t){if(ae(e,c))return{changes:{insert:t+t,from:c},effects:H.of(c+t.length),range:o.OF.cursor(c+t.length)};if(oe(e,c)){let r=n&&e.sliceDoc(c,c+3*t.length)==t+t+t?t+t+t:t;return{changes:{from:c,to:c+r.length,insert:r},range:o.OF.cursor(c+r.length)}}}else{if(n&&e.sliceDoc(c-2*t.length,c)==t+t&&(a=ce(e,c-2*t.length,s))>-1&&ae(e,a))return{changes:{insert:t+t+t+t,from:c},effects:H.of(c+t.length),range:o.OF.cursor(c+t.length)};if(e.charCategorizer(c)(u)!=o.Je.Word&&ce(e,c,s)>-1&&!function(e,t,n,o){let r=(0,i.mv)(e).resolveInner(t,-1),s=o.reduce(((e,t)=>Math.max(e,t.length)),0);for(let i=0;i<5;i++){let i=e.sliceDoc(r.from,Math.min(r.to,r.from+n.length+s)),l=i.indexOf(n);if(!l||l>-1&&o.indexOf(i.slice(0,l))>-1){let t=r.firstChild;for(;t&&t.from==r.from&&t.to-t.from>n.length+l;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let a=r.to==t&&r.parent;if(!a)break;r=a}return!1}(e,c,t,s))return{changes:{insert:t+t,from:c},effects:H.of(c+t.length),range:o.OF.cursor(c+t.length)}}return{range:l=r}}));return l?null:e.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function ae(e,t){let n=(0,i.mv)(e).resolveInner(t+1);return n.parent&&n.from==t}function ce(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=o.Je.Word)return t;for(let i of n){let n=t-i.length;if(e.sliceDoc(n,t)==i&&r(e.sliceDoc(n-1,n))!=o.Je.Word)return n}return-1}function ue(e={}){return[Z,N,b.of(e),z,fe,V]}const he=[{key:"Ctrl-Space",run:e=>!!e.state.field(N,!1)&&(e.dispatch({effects:g.of(!0)}),!0)},{key:"Escape",run:e=>{let t=e.state.field(N,!1);return!(!t||!t.active.some((e=>0!=e.state))||(e.dispatch({effects:v.of(null)}),0))}},{key:"ArrowDown",run:F(!0)},{key:"ArrowUp",run:F(!1)},{key:"PageDown",run:F(!0,"page")},{key:"PageUp",run:F(!1,"page")},{key:"Enter",run:e=>{let t=e.state.field(N,!1);return!(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(b).interactionDelay)&&U(e,t.open.options[t.open.selected])}}],fe=o.Nb.highest(r.w4.computeN([b],(e=>e.facet(b).defaultKeymap?[he]:[])))},49075:function(e,t,n){n.d(t,{ll:function(){return E}});var o=n(15874),r=n(43720),i=n(48820),s=n(47404);const l=20,a=21;function c(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57}function u(e,t,n){for(let o=!1;;){if(e.next<0)return;if(e.next==t&&!o)return void e.advance();o=n&&!o&&92==e.next,e.advance()}}function h(e,t){for(;95==e.next||c(e.next);)null!=t&&(t+=String.fromCharCode(e.next)),e.advance();return t}function f(e,t){for(;48==e.next||49==e.next;)e.advance();t&&e.next==t&&e.advance()}function d(e,t){for(;;){if(46==e.next){if(t)break;t=!0}else if(e.next<48||e.next>57)break;e.advance()}if(69==e.next||101==e.next)for(e.advance(),43!=e.next&&45!=e.next||e.advance();e.next>=48&&e.next<=57;)e.advance()}function p(e){for(;!(e.next<0||10==e.next);)e.advance()}function m(e,t){for(let n=0;n<t.length;n++)if(t.charCodeAt(n)==e)return!0;return!1}const g=" \t\r\n";function v(e,t,n){let o=Object.create(null);o.true=o.false=5,o.null=o.unknown=6;for(let t of e.split(" "))t&&(o[t]=l);for(let e of t.split(" "))e&&(o[e]=a);for(let e of(n||"").split(" "))e&&(o[e]=24);return o}const y={backslashEscapes:!1,hashComments:!1,spaceAfterDashes:!1,slashComments:!1,doubleQuotedStrings:!1,doubleDollarQuotedStrings:!1,unquotedBitLiterals:!1,treatBitsAsBytes:!1,charSetCasts:!1,plsqlQuotingMechanism:!1,operatorChars:"*+-%<>!=&|~^/",specialVar:"?",identifierQuotes:'"',words:v("absolute action add after all allocate alter and any are as asc assertion at authorization before begin between both breadth by call cascade cascaded case cast catalog check close collate collation column commit condition connect connection constraint constraints constructor continue corresponding count create cross cube current current_date current_default_transform_group current_transform_group_for_type current_path current_role current_time current_timestamp current_user cursor cycle data day deallocate declare default deferrable deferred delete depth deref desc describe descriptor deterministic diagnostics disconnect distinct do domain drop dynamic each else elseif end end-exec equals escape except exception exec execute exists exit external fetch first for foreign found from free full function general get global go goto grant group grouping handle having hold hour identity if immediate in indicator initially inner inout input insert intersect into is isolation join key language last lateral leading leave left level like limit local localtime localtimestamp locator loop map match method minute modifies module month names natural nesting new next no none not of old on only open option or order ordinality out outer output overlaps pad parameter partial path prepare preserve primary prior privileges procedure public read reads recursive redo ref references referencing relative release repeat resignal restrict result return returns revoke right role rollback rollup routine row rows savepoint schema scroll search second section select session session_user set sets signal similar size some space specific specifictype sql sqlexception sqlstate sqlwarning start state static system_user table temporary then timezone_hour timezone_minute to trailing transaction translation treat trigger under undo union unique unnest until update usage user using value values view when whenever where while with without work write year zone ","array binary bit boolean char character clob date decimal double float int integer interval large national nchar nclob numeric object precision real smallint time timestamp varchar varying ")};function k(e){return new i.Lu((t=>{var n;let{next:o}=t;if(t.advance(),m(o,g)){for(;m(t.next,g);)t.advance();t.acceptToken(36)}else if(36==o&&e.doubleDollarQuotedStrings){let e=h(t,"");36==t.next&&(t.advance(),function(e,t){e:for(;;){if(e.next<0)return console.log("exit at end",e.pos);if(36==e.next){e.advance();for(let n=0;n<t.length;n++){if(e.next!=t.charCodeAt(n))continue e;e.advance()}if(36==e.next)return void e.advance()}else e.advance()}}(t,e),t.acceptToken(3))}else if(39==o||34==o&&e.doubleQuotedStrings)u(t,o,e.backslashEscapes),t.acceptToken(3);else if(35==o&&e.hashComments||47==o&&47==t.next&&e.slashComments)p(t),t.acceptToken(1);else if(45!=o||45!=t.next||e.spaceAfterDashes&&32!=t.peek(1))if(47==o&&42==t.next){t.advance();for(let e=1;;){let n=t.next;if(t.next<0)break;if(t.advance(),42==n&&47==t.next){if(e--,t.advance(),!e)break}else 47==n&&42==t.next&&(e++,t.advance())}t.acceptToken(2)}else if(101!=o&&69!=o||39!=t.next)if(110!=o&&78!=o||39!=t.next||!e.charSetCasts)if(95==o&&e.charSetCasts)for(let n=0;;n++){if(39==t.next&&n>1){t.advance(),u(t,39,e.backslashEscapes),t.acceptToken(3);break}if(!c(t.next))break;t.advance()}else if(e.plsqlQuotingMechanism&&(113==o||81==o)&&39==t.next&&t.peek(1)>0&&!m(t.peek(1),g)){let e=t.peek(1);t.advance(2),function(e,t){let n="[{<(".indexOf(String.fromCharCode(t)),o=n<0?t:"]}>)".charCodeAt(n);for(;;){if(e.next<0)return;if(e.next==o&&39==e.peek(1))return void e.advance(2);e.advance()}}(t,e),t.acceptToken(3)}else if(40==o)t.acceptToken(7);else if(41==o)t.acceptToken(8);else if(123==o)t.acceptToken(9);else if(125==o)t.acceptToken(10);else if(91==o)t.acceptToken(11);else if(93==o)t.acceptToken(12);else if(59==o)t.acceptToken(13);else if(e.unquotedBitLiterals&&48==o&&98==t.next)t.advance(),f(t),t.acceptToken(22);else if(98!=o&&66!=o||39!=t.next&&34!=t.next){if(48==o&&(120==t.next||88==t.next)||(120==o||88==o)&&39==t.next){let e=39==t.next;for(t.advance();(r=t.next)>=48&&r<=57||r>=97&&r<=102||r>=65&&r<=70;)t.advance();e&&39==t.next&&t.advance(),t.acceptToken(4)}else if(46==o&&t.next>=48&&t.next<=57)d(t,!0),t.acceptToken(4);else if(46==o)t.acceptToken(14);else if(o>=48&&o<=57)d(t,!1),t.acceptToken(4);else if(m(o,e.operatorChars)){for(;m(t.next,e.operatorChars);)t.advance();t.acceptToken(15)}else if(m(o,e.specialVar))t.next==o&&t.advance(),function(e){if(39==e.next||34==e.next||96==e.next){let t=e.next;e.advance(),u(e,t,!1)}else h(e)}(t),t.acceptToken(17);else if(m(o,e.identifierQuotes))u(t,o,!1),t.acceptToken(19);else if(58==o||44==o)t.acceptToken(16);else if(c(o)){let r=h(t,String.fromCharCode(o));t.acceptToken(46==t.next||46==t.peek(-r.length-1)?18:null!==(n=e.words[r.toLowerCase()])&&void 0!==n?n:18)}}else{const n=t.next;t.advance(),e.treatBitsAsBytes?(u(t,n,e.backslashEscapes),t.acceptToken(23)):(f(t,n),t.acceptToken(22))}else t.advance(),u(t,39,e.backslashEscapes),t.acceptToken(3);else t.advance(),u(t,39,!0);else p(t),t.acceptToken(1);var r}))}const b=k(y),w=i.U1.deserialize({version:14,states:"%vQ]QQOOO#wQRO'#DSO$OQQO'#CwO%eQQO'#CxO%lQQO'#CyO%sQQO'#CzOOQQ'#DS'#DSOOQQ'#C}'#C}O'UQRO'#C{OOQQ'#Cv'#CvOOQQ'#C|'#C|Q]QQOOQOQQOOO'`QQO'#DOO(xQRO,59cO)PQQO,59cO)UQQO'#DSOOQQ,59d,59dO)cQQO,59dOOQQ,59e,59eO)jQQO,59eOOQQ,59f,59fO)qQQO,59fOOQQ-E6{-E6{OOQQ,59b,59bOOQQ-E6z-E6zOOQQ,59j,59jOOQQ-E6|-E6|O+VQRO1G.}O+^QQO,59cOOQQ1G/O1G/OOOQQ1G/P1G/POOQQ1G/Q1G/QP+kQQO'#C}O+rQQO1G.}O)PQQO,59cO,PQQO'#Cw",stateData:",[~OtOSPOSQOS~ORUOSUOTUOUUOVROXSOZTO]XO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O^]ORvXSvXTvXUvXVvXXvXZvX]vX_vX`vXavXbvXcvXdvXevXfvXgvXhvX~OsvX~P!jOa_Ob_Oc_O~ORUOSUOTUOUUOVROXSOZTO^tO_UO`UOa`Ob`Oc`OdUOeUOfUOgUOhUO~OWaO~P$ZOYcO~P$ZO[eO~P$ZORUOSUOTUOUUOVROXSOZTO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O]hOsoX~P%zOajObjOcjO~O^]ORkaSkaTkaUkaVkaXkaZka]ka_ka`kaakabkackadkaekafkagkahka~Oska~P'kO^]O~OWvXYvX[vX~P!jOWnO~P$ZOYoO~P$ZO[pO~P$ZO^]ORkiSkiTkiUkiVkiXkiZki]ki_ki`kiakibkickidkiekifkigkihki~Oski~P)xOWkaYka[ka~P'kO]hO~P$ZOWkiYki[ki~P)xOasObsOcsO~O",goto:"#hwPPPPPPPPPPPPPPPPPPPPPPPPPPx||||!Y!^!d!xPPP#[TYOZeUORSTWZbdfqT[OZQZORiZSWOZQbRQdSQfTZgWbdfqQ^PWk^lmrQl_Qm`RrseVORSTWZbdfq",nodeNames:"⚠ LineComment BlockComment String Number Bool Null ( ) { } [ ] ; . Operator Punctuation SpecialVar Identifier QuotedIdentifier Keyword Type Bits Bytes Builtin Script Statement CompositeIdentifier Parens Braces Brackets Statement",maxTerm:38,nodeProps:[["isolate",-4,1,2,3,19,""]],skippedNodes:[0,1,2],repeatNodeCount:3,tokenData:"RORO",tokenizers:[0,b],topRules:{Script:[0,25]},tokenPrec:0});function O(e){let t=e.cursor().moveTo(e.from,-1);for(;/Comment/.test(t.name);)t.moveTo(t.from,-1);return t.node}function x(e,t){let n=e.sliceString(t.from,t.to),o=/^([`'"])(.*)\1$/.exec(n);return o?o[2]:n}function A(e){return e&&("Identifier"==e.name||"QuotedIdentifier"==e.name)}function C(e,t){if("CompositeIdentifier"==t.name){let n=[];for(let o=t.firstChild;o;o=o.nextSibling)A(o)&&n.push(x(e,o));return n}return[x(e,t)]}function S(e,t){for(let n=[];;){if(!t||"."!=t.name)return n;let o=O(t);if(!A(o))return n;n.unshift(x(e,o)),t=O(o)}}const P=new Set("where group having order union intersect except all distinct limit offset fetch for".split(" ")),T=/^\w*$/,D=/^[`'"]?\w*[`'"]?$/;function B(e){return e.self&&"string"==typeof e.self.label}class I{constructor(e){this.idQuote=e,this.list=[],this.children=void 0}child(e){let t=this.children||(this.children=Object.create(null));return t[e]||(e&&!this.list.some((t=>t.label==e))&&this.list.push(M(e,"type",this.idQuote)),t[e]=new I(this.idQuote))}maybeChild(e){return this.children?this.children[e]:null}addCompletion(e){let t=this.list.findIndex((t=>t.label==e.label));t>-1?this.list[t]=e:this.list.push(e)}addCompletions(e){for(let t of e)this.addCompletion("string"==typeof t?M(t,"property",this.idQuote):t)}addNamespace(e){Array.isArray(e)?this.addCompletions(e):B(e)?this.addNamespace(e.children):this.addNamespaceObject(e)}addNamespaceObject(e){for(let t of Object.keys(e)){let n=e[t],o=null,r=t.replace(/\\?\./g,(e=>"."==e?"\0":e)).split("\0"),i=this;B(n)&&(o=n.self,n=n.children);for(let e=0;e<r.length;e++)o&&e==r.length-1&&i.addCompletion(o),i=i.child(r[e].replace(/\\\./g,"."));i.addNamespace(n)}}}function M(e,t,n){return/^[a-z_][a-z_\d]*$/.test(e)?{label:e,type:t}:{label:e,type:t,apply:n+e+n}}let Q=w.configure({props:[o.Oh.add({Statement:(0,o.mz)()}),o.b_.add({Statement(e,t){return{from:Math.min(e.from+100,t.doc.lineAt(e.from).to),to:e.to}},BlockComment(e){return{from:e.from+2,to:e.to-2}}}),(0,r.pn)({Keyword:r._A.keyword,Type:r._A.typeName,Builtin:r._A.standard(r._A.name),Bits:r._A.number,Bytes:r._A.string,Bool:r._A.bool,Null:r._A.null,Number:r._A.number,String:r._A.string,Identifier:r._A.name,QuotedIdentifier:r._A.special(r._A.string),SpecialVar:r._A.special(r._A.name),LineComment:r._A.lineComment,BlockComment:r._A.blockComment,Operator:r._A.operator,"Semi Punctuation":r._A.punctuation,"( )":r._A.paren,"{ }":r._A.brace,"[ ]":r._A.squareBracket})]});class R{constructor(e,t,n){this.dialect=e,this.language=t,this.spec=n}get extension(){return this.language.extension}static define(e){let t=function(e,t,n,o){let r={};for(let t in y)r[t]=(e.hasOwnProperty(t)?e:y)[t];return t&&(r.words=v(t,n||"",o)),r}(e,e.keywords,e.types,e.builtin),n=o.bj.define({name:"sql",parser:Q.configure({tokenizers:[{from:b,to:k(t)}]}),languageData:{commentTokens:{line:"--",block:{open:"/*",close:"*/"}},closeBrackets:{brackets:["(","[","{","'",'"',"`"]}}});return new R(t,n,e)}}function L(e,t=!1){return function(e,t){let n=Object.keys(e).map((n=>({label:t?n.toUpperCase():n,type:e[n]==a?"type":e[n]==l?"keyword":"variable",boost:-1})));return(0,s.Ar)(["QuotedIdentifier","SpecialVar","String","LineComment","BlockComment","."],(0,s.et)(n))}(e.dialect.words,t)}function _(e,t=!1){return e.language.data.of({autocomplete:L(e,t)})}function N(e){return e.schema?function(e,t,n,r,i,s){var l;let a=(null===(l=null==s?void 0:s.spec.identifierQuotes)||void 0===l?void 0:l[0])||'"',c=new I(a),u=i?c.child(i):null;return c.addNamespace(e),t&&(u||c).addCompletions(t),n&&c.addCompletions(n),u&&c.addCompletions(u.list),r&&c.addCompletions((u||c).child(r).list),e=>{let{parents:t,from:n,quoted:i,empty:s,aliases:l}=function(e,t){let n=(0,o.mv)(e).resolveInner(t,-1),r=function(e,t){let n;for(let e=t;!n;e=e.parent){if(!e)return null;"Statement"==e.name&&(n=e)}let o=null;for(let t=n.firstChild,r=!1,i=null;t;t=t.nextSibling){let n="Keyword"==t.name?e.sliceString(t.from,t.to).toLowerCase():null,s=null;if(r)if("as"==n&&i&&A(t.nextSibling))s=x(e,t.nextSibling);else{if(n&&P.has(n))break;i&&A(t)&&(s=x(e,t))}else r="from"==n;s&&(o||(o=Object.create(null)),o[s]=C(e,i)),i=/Identifier$/.test(t.name)?t:null}return o}(e.doc,n);return"Identifier"==n.name||"QuotedIdentifier"==n.name||"Keyword"==n.name?{from:n.from,quoted:"QuotedIdentifier"==n.name?e.doc.sliceString(n.from,n.from+1):null,parents:S(e.doc,O(n)),aliases:r}:"."==n.name?{from:t,quoted:null,parents:S(e.doc,n),aliases:r}:{from:t,quoted:null,parents:[],empty:!0,aliases:r}}(e.state,e.pos);if(s&&!e.explicit)return null;l&&1==t.length&&(t=l[t[0]]||t);let a=c;for(let e of t){for(;!a.children||!a.children[e];)if(a==c&&u)a=u;else{if(a!=u||!r)return null;a=a.child(r)}let t=a.maybeChild(e);if(!t)return null;a=t}let h=i&&e.state.sliceDoc(e.pos,e.pos+1)==i,f=a.list;return a==c&&l&&(f=f.concat(Object.keys(l).map((e=>({label:e,type:"constant"}))))),{from:n,to:h?e.pos+1:void 0,options:(d=i,p=f,d?p.map((e=>Object.assign(Object.assign({},e),{label:e.label[0]==d?e.label:d+e.label+d,apply:void 0}))):p),validFor:i?D:T};var d,p}}(e.schema,e.tables,e.schemas,e.defaultTable,e.defaultSchema,e.dialect||F):()=>null}function U(e){return e.schema?(e.dialect||F).language.data.of({autocomplete:N(e)}):[]}function E(e={}){let t=e.dialect||F;return new o.Yy(t.language,[U(e),_(t,!!e.upperCaseKeywords)])}const F=R.define({})},15874:function(e,t,n){n.d(t,{EI:function(){return T},KB:function(){return B},Lv:function(){return ae},Oh:function(){return I},SG:function(){return Se},WD:function(){return E},Xt:function(){return S},Yy:function(){return A},Zt:function(){return ve},_v:function(){return D},b_:function(){return j},bj:function(){return d},f7:function(){return G},jU:function(){return Be},mv:function(){return p},mz:function(){return N},tp:function(){return P},y9:function(){return pe}});var o,r=n(90365),i=n(6585),s=n(1371),l=n(43720),a=n(97417);const c=new r.uY;const u=new r.uY;class h{constructor(e,t,n=[],o=""){this.data=e,this.name=o,i.$t.prototype.hasOwnProperty("tree")||Object.defineProperty(i.$t.prototype,"tree",{get(){return p(this)}}),this.parser=t,this.extension=[x.of(this),i.$t.languageData.of(((e,t,n)=>{let o=f(e,t,n),r=o.type.prop(c);if(!r)return[];let i=e.facet(r),s=o.type.prop(u);if(s){let r=o.resolve(t-o.from,n);for(let t of s)if(t.test(r,e)){let n=e.facet(t.facet);return"replace"==t.type?n:n.concat(i)}}return i}))].concat(n)}isActiveAt(e,t,n=-1){return f(e,t,n).type.prop(c)==this.data}findRegions(e){let t=e.facet(x);if((null==t?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],o=(e,t)=>{if(e.prop(c)==this.data)return void n.push({from:t,to:t+e.length});let i=e.prop(r.uY.mounted);if(i){if(i.tree.prop(c)==this.data){if(i.overlay)for(let e of i.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(i.overlay){let e=n.length;if(o(i.tree,i.overlay[0].from+t),n.length>e)return}}for(let n=0;n<e.children.length;n++){let i=e.children[n];i instanceof r.PH&&o(i,e.positions[n]+t)}};return o(p(e),0),n}get allowsNesting(){return!0}}function f(e,t,n){let o=e.facet(x),i=p(e).topNode;if(!o||o.allowsNesting)for(let e=i;e;e=e.enter(t,n,r.Qj.ExcludeBuffers))e.type.isTop&&(i=e);return i}h.setState=i.Pe.define();class d extends h{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=(n=e.languageData,i.sj.define({combine:n?e=>e.concat(n):void 0}));var n;return new d(t,e.parser.configure({props:[c.add((e=>e.isTop?t:void 0))]}),e.name)}configure(e,t){return new d(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function p(e){let t=e.field(h.state,!1);return t?t.tree:r.PH.empty}class m{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let g=null;class v{constructor(e,t,n=[],o,r,i,s,l){this.parser=e,this.state=t,this.fragments=n,this.tree=o,this.treeLen=r,this.viewport=i,this.skipped=s,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new v(e,t,[],r.PH.empty,0,n,[],null)}startParse(){return this.parser.startParse(new m(this.state.doc),this.fragments)}work(e,t){return null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=r.PH.empty&&this.isDone(null!=t?t:this.state.doc.length)?(this.takeTree(),!0):this.withContext((()=>{var n;if("number"==typeof e){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||(this.parse=this.startParse()),null!=t&&(null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let o=this.parse.advance();if(o){if(this.fragments=this.withoutTempSkipped(r.rr.addTree(o,this.fragments,null!=this.parse.stoppedAt)),this.treeLen=null!==(n=this.parse.stoppedAt)&&void 0!==n?n:this.state.doc.length,this.tree=o,this.parse=null,!(this.treeLen<(null!=t?t:this.state.doc.length)))return!0;this.parse=this.startParse()}if(e())return!1}}))}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext((()=>{for(;!(t=this.parse.advance()););})),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(r.rr.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=g;g=this;try{return e()}finally{g=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=y(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:o,treeLen:i,viewport:s,skipped:l}=this;if(this.takeTree(),!e.empty){let t=[];if(e.iterChangedRanges(((e,n,o,r)=>t.push({fromA:e,toA:n,fromB:o,toB:r}))),n=r.rr.applyChanges(n,t),o=r.PH.empty,i=0,s={from:e.mapPos(s.from,-1),to:e.mapPos(s.to,1)},this.skipped.length){l=[];for(let t of this.skipped){let n=e.mapPos(t.from,1),o=e.mapPos(t.to,-1);n<o&&l.push({from:n,to:o})}}}return new v(this.parser,t,n,o,i,s,l,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let t=0;t<this.skipped.length;t++){let{from:n,to:o}=this.skipped[t];n<e.to&&o>e.from&&(this.fragments=y(this.fragments,n,o),this.skipped.splice(t--,1))}return!(this.skipped.length>=t||(this.reset(),0))}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends r.iX{createParse(t,n,o){let i=o[0].from,s=o[o.length-1].to;return{parsedPos:i,advance(){let t=g;if(t){for(let e of o)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=s,new r.PH(r.Z6.none,[],[],s-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&0==t[0].from&&t[0].to>=e}static get(){return g}}function y(e,t,n){return r.rr.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class k{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new k(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=v.create(e.facet(x).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new k(n)}}h.state=i.sU.define({create:k.init,update(e,t){for(let e of t.effects)if(e.is(h.setState))return e.value;return t.startState.facet(x)!=t.state.facet(x)?k.init(t.state):e.apply(t)}});let b=e=>{let t=setTimeout((()=>e()),500);return()=>clearTimeout(t)};"undefined"!=typeof requestIdleCallback&&(b=e=>{let t=-1,n=setTimeout((()=>{t=requestIdleCallback(e,{timeout:400})}),100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const w="undefined"!=typeof navigator&&(null===(o=navigator.scheduling)||void 0===o?void 0:o.isInputPending)?()=>navigator.scheduling.isInputPending():null,O=s.Z9.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(h.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(h.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=b(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:o}}=this.view,r=n.field(h.state);if(r.tree==r.context.tree&&r.context.isDone(o+1e5))return;let i=Date.now()+Math.min(this.chunkBudget,100,e&&!w?Math.max(25,e.timeRemaining()-5):1e9),s=r.context.treeLen<o&&n.doc.length>o+1e3,l=r.context.work((()=>w&&w()||Date.now()>i),o+(s?0:1e5));this.chunkBudget-=Date.now()-t,(l||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:h.setState.of(new k(r.context))})),this.chunkBudget>0&&(!l||s)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then((()=>this.scheduleWork())).catch((e=>(0,s.c_)(this.view.state,e))).then((()=>this.workScheduled--)),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),x=i.sj.define({combine(e){return e.length?e[0]:null},enables:e=>[h.state,O,s.Lz.contentAttributes.compute([e],(t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}}))]});class A{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const C=i.sj.define(),S=i.sj.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some((e=>e!=t[0])))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function P(e){let t=e.facet(S);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function T(e,t){let n="",o=e.tabSize,r=e.facet(S)[0];if("\t"==r){for(;t>=o;)n+="\t",t-=o;r=" "}for(let e=0;e<t;e++)n+=r;return n}function D(e,t){e instanceof i.$t&&(e=new B(e));for(let n of e.state.facet(C)){let o=n(e,t);if(void 0!==o)return o}let n=p(e.state);return n.length>=t?function(e,t,n){let o=t.resolveStack(n),r=o.node.enterUnfinishedNodesBefore(n);if(r!=o.node){let e=[];for(let t=r;t!=o.node;t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)o={node:e[t],next:o}}return M(o,e,n)}(e,n,t):null}class B{constructor(e,t={}){this.state=e,this.options=t,this.unit=P(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:o,simulateDoubleBreak:r}=this.options;return null!=o&&o>=n.from&&o<=n.to?r&&o==e?{text:"",from:e}:(t<0?o<e:o<=e)?{text:n.text.slice(o-n.from),from:o}:{text:n.text.slice(0,o-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:o}=this.lineAt(e,t);return n.slice(e-o,Math.min(n.length,e+100-o))}column(e,t=1){let{text:n,from:o}=this.lineAt(e,t),r=this.countColumn(n,e-o),i=this.options.overrideIndentation?this.options.overrideIndentation(o):-1;return i>-1&&(r+=i-this.countColumn(n,n.search(/\S|$/))),r}countColumn(e,t=e.length){return(0,i.y$)(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:o}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let e=r(o);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const I=new r.uY;function M(e,t,n){for(let o=e;o;o=o.next){let e=Q(o.node);if(e)return e(L.create(t,n,o))}return 0}function Q(e){let t=e.type.prop(I);if(t)return t;let n,o=e.firstChild;if(o&&(n=o.type.prop(r.uY.closedBy))){let t=e.lastChild,o=t&&n.indexOf(t.name)>-1;return e=>function(e,t,n,o,r){let i=e.textAfter,s=i.match(/^\s*/)[0].length,l=o&&i.slice(s,s+o.length)==o||r==e.pos+s,a=t?function(e){let t=e.node,n=t.childAfter(t.from),o=t.lastChild;if(!n)return null;let r=e.options.simulateBreak,i=e.state.doc.lineAt(n.from),s=null==r||r<=i.from?i.to:Math.min(i.to,r);for(let e=n.to;;){let r=t.childAfter(e);if(!r||r==o)return null;if(!r.type.isSkipped)return r.from<s?n:null;e=r.to}}(e):null;return a?l?e.column(a.from):e.column(a.to):e.baseIndent+(l?0:e.unit*n)}(e,!0,1,void 0,o&&!function(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}(e)?t.from:void 0)}return null==e.parent?R:null}function R(){return 0}class L extends B{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new L(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(_(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return M(this.context.next,this.base,this.pos)}}function _(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function N({except:e,units:t=1}={}){return n=>{let o=e&&e.test(n.textAfter);return n.baseIndent+(o?0:t*n.unit)}}const U=200;function E(){return i.$t.transactionFilter.of((e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:o}=e.newSelection.main,r=n.lineAt(o);if(o>r.from+U)return e;let i=n.sliceString(r.from,o);if(!t.some((e=>e.test(i))))return e;let{state:s}=e,l=-1,a=[];for(let{head:e}of s.selection.ranges){let t=s.doc.lineAt(e);if(t.from==l)continue;l=t.from;let n=D(s,t.from);if(null==n)continue;let o=/^\s*/.exec(t.text)[0],r=T(s,n);o!=r&&a.push({from:t.from,to:t.from+o.length,insert:r})}return a.length?[e,{changes:a,sequential:!0}]:e}))}const F=i.sj.define(),j=new r.uY;function z(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function $(e,t,n){for(let o of e.facet(F)){let r=o(e,t,n);if(r)return r}return function(e,t,n){let o=p(e);if(o.length<n)return null;let r=null;for(let i=o.resolveStack(n,1);i;i=i.next){let s=i.node;if(s.to<=n||s.from>n)continue;if(r&&s.from<t)break;let l=s.type.prop(j);if(l&&(s.to<o.length-50||o.length==e.doc.length||!z(s))){let o=l(s,e);o&&o.from<=n&&o.from>=t&&o.to>n&&(r=o)}}return r}(e,t,n)}function Z(e,t){let n=t.mapPos(e.from,1),o=t.mapPos(e.to,-1);return n>=o?void 0:{from:n,to:o}}const V=i.Pe.define({map:Z}),q=i.Pe.define({map:Z});function H(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some((e=>e.from<=n&&e.to>=n))||t.push(e.lineBlockAt(n));return t}const W=i.sU.define({create(){return s.NZ.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)if(n.is(V)&&!J(e,n.value.from,n.value.to)){let{preparePlaceholder:o}=t.state.facet(te),r=o?s.NZ.replace({widget:new ie(o(t.state,n.value))}):re;e=e.update({add:[r.range(n.value.from,n.value.to)]})}else n.is(q)&&(e=e.update({filter:(e,t)=>n.value.from!=e||n.value.to!=t,filterFrom:n.value.from,filterTo:n.value.to}));if(t.selection){let n=!1,{head:o}=t.selection.main;e.between(o,o,((e,t)=>{e<o&&t>o&&(n=!0)})),n&&(e=e.update({filterFrom:o,filterTo:o,filter:(e,t)=>t<=o||e>=o}))}return e},provide:e=>s.Lz.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,((e,t)=>{n.push(e,t)})),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let n=0;n<e.length;){let o=e[n++],r=e[n++];if("number"!=typeof o||"number"!=typeof r)throw new RangeError("Invalid JSON for fold state");t.push(re.range(o,r))}return s.NZ.set(t,!0)}});function X(e,t,n){var o;let r=null;return null===(o=e.field(W,!1))||void 0===o||o.between(t,n,((e,t)=>{(!r||r.from>e)&&(r={from:e,to:t})})),r}function J(e,t,n){let o=!1;return e.between(t,t,((e,r)=>{e==t&&r==n&&(o=!0)})),o}function Y(e,t){return e.field(W,!1)?t:t.concat(i.Pe.appendConfig.of(ne()))}function K(e,t,n=!0){let o=e.state.doc.lineAt(t.from).number,r=e.state.doc.lineAt(t.to).number;return s.Lz.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${o} ${e.state.phrase("to")} ${r}.`)}const G=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:e=>{for(let t of H(e)){let n=$(e.state,t.from,t.to);if(n)return e.dispatch({effects:Y(e.state,[V.of(n),K(e,n)])}),!0}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:e=>{if(!e.state.field(W,!1))return!1;let t=[];for(let n of H(e)){let o=X(e.state,n.from,n.to);o&&t.push(q.of(o),K(e,o,!1))}return t.length&&e.dispatch({effects:t}),t.length>0}},{key:"Ctrl-Alt-[",run:e=>{let{state:t}=e,n=[];for(let o=0;o<t.doc.length;){let r=e.lineBlockAt(o),i=$(t,r.from,r.to);i&&n.push(V.of(i)),o=(i?e.lineBlockAt(i.to):r).to+1}return n.length&&e.dispatch({effects:Y(e.state,n)}),!!n.length}},{key:"Ctrl-Alt-]",run:e=>{let t=e.state.field(W,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,((e,t)=>{n.push(q.of({from:e,to:t}))})),e.dispatch({effects:n}),!0}}],ee={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},te=i.sj.define({combine(e){return(0,i.QR)(e,ee)}});function ne(e){let t=[W,ce];return e&&t.push(te.of(e)),t}function oe(e,t){let{state:n}=e,o=n.facet(te),r=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),o=X(e.state,n.from,n.to);o&&e.dispatch({effects:q.of(o)}),t.preventDefault()};if(o.placeholderDOM)return o.placeholderDOM(e,r,t);let i=document.createElement("span");return i.textContent=o.placeholderText,i.setAttribute("aria-label",n.phrase("folded code")),i.title=n.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=r,i}const re=s.NZ.replace({widget:new class extends s.xO{toDOM(e){return oe(e,null)}}});class ie extends s.xO{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return oe(e,this.value)}}const se={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class le extends s.wJ{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function ae(e={}){let t=Object.assign(Object.assign({},se),e),n=new le(t,!0),o=new le(t,!1),r=s.Z9.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(x)!=e.state.facet(x)||e.startState.field(W,!1)!=e.state.field(W,!1)||p(e.startState)!=p(e.state)||t.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let t=new i.vB;for(let r of e.viewportLineBlocks){let i=X(e.state,r.from,r.to)?o:$(e.state,r.from,r.to)?n:null;i&&t.add(r.from,r.from,i)}return t.finish()}}),{domEventHandlers:l}=t;return[r,(0,s.cU)({class:"cm-foldGutter",markers(e){var t;return(null===(t=e.plugin(r))||void 0===t?void 0:t.markers)||i.om.empty},initialSpacer(){return new le(t,!1)},domEventHandlers:Object.assign(Object.assign({},l),{click:(e,t,n)=>{if(l.click&&l.click(e,t,n))return!0;let o=X(e.state,t.from,t.to);if(o)return e.dispatch({effects:q.of(o)}),!0;let r=$(e.state,t.from,t.to);return!!r&&(e.dispatch({effects:V.of(r)}),!0)}})}),ne()]}const ce=s.Lz.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class ue{constructor(e,t){let n;function o(e){let t=a.G.newName();return(n||(n=Object.create(null)))["."+t]=e,t}this.specs=e;const r="string"==typeof t.all?t.all:t.all?o(t.all):void 0,i=t.scope;this.scope=i instanceof h?e=>e.prop(c)==i.data:i?e=>e==i:void 0,this.style=(0,l.az)(e.map((e=>({tag:e.tag,class:e.class||o(Object.assign({},e,{tag:null}))}))),{all:r}).style,this.module=n?new a.G(n):null,this.themeType=t.themeType}static define(e,t){return new ue(e,t||{})}}const he=i.sj.define(),fe=i.sj.define({combine(e){return e.length?[e[0]]:null}});function de(e){let t=e.facet(he);return t.length?t:e.facet(fe)}function pe(e,t){let n,o=[ge];return e instanceof ue&&(e.module&&o.push(s.Lz.styleModule.of(e.module)),n=e.themeType),(null==t?void 0:t.fallback)?o.push(fe.of(e)):n?o.push(he.computeN([s.Lz.darkTheme],(t=>t.facet(s.Lz.darkTheme)==("dark"==n)?[e]:[]))):o.push(he.of(e)),o}class me{constructor(e){this.markCache=Object.create(null),this.tree=p(e.state),this.decorations=this.buildDeco(e,de(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=p(e.state),n=de(e.state),o=n!=de(e.startState),{viewport:r}=e.view,i=e.changes.mapPos(this.decoratedTo,1);t.length<r.to&&!o&&t.type==this.tree.type&&i>=r.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=i):(t!=this.tree||e.viewportChanged||o)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=r.to)}buildDeco(e,t){if(!t||!this.tree.length)return s.NZ.none;let n=new i.vB;for(let{from:o,to:r}of e.visibleRanges)(0,l.DM)(this.tree,t,((e,t,o)=>{n.add(e,t,this.markCache[o]||(this.markCache[o]=s.NZ.mark({class:o})))}),o,r);return n.finish()}}const ge=i.Nb.high(s.Z9.fromClass(me,{decorations:e=>e.decorations})),ve=ue.define([{tag:l._A.meta,color:"#404740"},{tag:l._A.link,textDecoration:"underline"},{tag:l._A.heading,textDecoration:"underline",fontWeight:"bold"},{tag:l._A.emphasis,fontStyle:"italic"},{tag:l._A.strong,fontWeight:"bold"},{tag:l._A.strikethrough,textDecoration:"line-through"},{tag:l._A.keyword,color:"#708"},{tag:[l._A.atom,l._A.bool,l._A.url,l._A.contentSeparator,l._A.labelName],color:"#219"},{tag:[l._A.literal,l._A.inserted],color:"#164"},{tag:[l._A.string,l._A.deleted],color:"#a11"},{tag:[l._A.regexp,l._A.escape,l._A.special(l._A.string)],color:"#e40"},{tag:l._A.definition(l._A.variableName),color:"#00f"},{tag:l._A.local(l._A.variableName),color:"#30a"},{tag:[l._A.typeName,l._A.namespace],color:"#085"},{tag:l._A.className,color:"#167"},{tag:[l._A.special(l._A.variableName),l._A.macroName],color:"#256"},{tag:l._A.definition(l._A.propertyName),color:"#00c"},{tag:l._A.comment,color:"#940"},{tag:l._A.invalid,color:"#f00"}]),ye=s.Lz.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),ke=1e4,be="()[]{}",we=i.sj.define({combine(e){return(0,i.QR)(e,{afterCursor:!0,brackets:be,maxScanDistance:ke,renderMatch:Ae})}}),Oe=s.NZ.mark({class:"cm-matchingBracket"}),xe=s.NZ.mark({class:"cm-nonmatchingBracket"});function Ae(e){let t=[],n=e.matched?Oe:xe;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}const Ce=[i.sU.define({create(){return s.NZ.none},update(e,t){if(!t.docChanged&&!t.selection)return e;let n=[],o=t.state.facet(we);for(let e of t.state.selection.ranges){if(!e.empty)continue;let r=Be(t.state,e.head,-1,o)||e.head>0&&Be(t.state,e.head-1,1,o)||o.afterCursor&&(Be(t.state,e.head,1,o)||e.head<t.state.doc.length&&Be(t.state,e.head+1,-1,o));r&&(n=n.concat(o.renderMatch(r,t.state)))}return s.NZ.set(n,!0)},provide:e=>s.Lz.decorations.from(e)}),ye];function Se(e={}){return[we.of(e),Ce]}const Pe=new r.uY;function Te(e,t,n){let o=e.prop(t<0?r.uY.openedBy:r.uY.closedBy);if(o)return o;if(1==e.name.length){let o=n.indexOf(e.name);if(o>-1&&o%2==(t<0?1:0))return[n[o+t]]}return null}function De(e){let t=e.type.prop(Pe);return t?t(e.node):e}function Be(e,t,n,o={}){let r=o.maxScanDistance||ke,i=o.brackets||be,s=p(e),l=s.resolveInner(t,n);for(let e=l;e;e=e.parent){let o=Te(e.type,n,i);if(o&&e.from<e.to){let r=De(e);if(r&&(n>0?t>=r.from&&t<r.to:t>r.from&&t<=r.to))return Ie(0,0,n,e,r,o,i)}}return function(e,t,n,o,r,i,s){let l=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),a=s.indexOf(l);if(a<0||a%2==0!=n>0)return null;let c={from:n<0?t-1:t,to:n>0?t+1:t},u=e.doc.iterRange(t,n>0?e.doc.length:0),h=0;for(let e=0;!u.next().done&&e<=i;){let i=u.value;n<0&&(e+=i.length);let l=t+e*n;for(let e=n>0?0:i.length-1,t=n>0?i.length:-1;e!=t;e+=n){let t=s.indexOf(i[e]);if(!(t<0||o.resolveInner(l+e,1).type!=r))if(t%2==0==n>0)h++;else{if(1==h)return{start:c,end:{from:l+e,to:l+e+1},matched:t>>1==a>>1};h--}}n>0&&(e+=i.length)}return u.done?{start:c,matched:!1}:null}(e,t,n,s,l.type,r,i)}function Ie(e,t,n,o,r,i,s){let l=o.parent,a={from:r.from,to:r.to},c=0,u=null==l?void 0:l.cursor();if(u&&(n<0?u.childBefore(o.from):u.childAfter(o.to)))do{if(n<0?u.to<=o.from:u.from>=o.to){if(0==c&&i.indexOf(u.type.name)>-1&&u.from<u.to){let e=De(u);return{start:a,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}if(Te(u.type,n,s))c++;else if(Te(u.type,-n,s)){if(0==c){let e=De(u);return{start:a,end:e&&e.from<e.to?{from:e.from,to:e.to}:void 0,matched:!1}}c--}}}while(n<0?u.prevSibling():u.nextSibling());return{start:a,matched:!1}}const Me=Object.create(null),Qe=[r.Z6.none],Re=[],Le=Object.create(null),_e=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])_e[e]=Ue(Me,t);function Ne(e,t){Re.indexOf(e)>-1||(Re.push(e),console.warn(t))}function Ue(e,t){let n=[];for(let o of t.split(" ")){let t=[];for(let n of o.split(".")){let o=e[n]||l._A[n];o?"function"==typeof o?t.length?t=t.map(o):Ne(n,`Modifier ${n} used at start of tag`):t.length?Ne(n,`Tag ${n} used as modifier`):t=Array.isArray(o)?o:[o]:Ne(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let o=t.replace(/ /g,"_"),i=o+" "+n.map((e=>e.id)),s=Le[i];if(s)return s.id;let a=Le[i]=r.Z6.define({id:Qe.length,name:o,props:[(0,l.pn)({[o]:n})]});return Qe.push(a),a.id}s.OP.RTL,s.OP.LTR},54136:function(e,t,n){n.d(t,{oQ:function(){return nt}});var o=n(1371),r=n(6585),i=n(15874),s=n(90365);function l(e,t){return({state:n,dispatch:o})=>{if(n.readOnly)return!1;let r=e(t,n);return!!r&&(o(n.update(r)),!0)}}const a=l(p,0),c=l(d,0),u=l(((e,t)=>d(e,t,function(e){let t=[];for(let n of e.selection.ranges){let o=e.doc.lineAt(n.from),r=n.to<=o.to?o:e.doc.lineAt(n.to),i=t.length-1;i>=0&&t[i].to>o.from?t[i].to=r.to:t.push({from:o.from+/^\s*/.exec(o.text)[0].length,to:r.to})}return t}(t))),0);function h(e,t){let n=e.languageDataAt("commentTokens",t);return n.length?n[0]:{}}const f=50;function d(e,t,n=t.selection.ranges){let o=n.map((e=>h(t,e.from).block));if(!o.every((e=>e)))return null;let r=n.map(((e,n)=>function(e,{open:t,close:n},o,r){let i,s,l=e.sliceDoc(o-f,o),a=e.sliceDoc(r,r+f),c=/\s*$/.exec(l)[0].length,u=/^\s*/.exec(a)[0].length,h=l.length-c;if(l.slice(h-t.length,h)==t&&a.slice(u,u+n.length)==n)return{open:{pos:o-c,margin:c&&1},close:{pos:r+u,margin:u&&1}};r-o<=2*f?i=s=e.sliceDoc(o,r):(i=e.sliceDoc(o,o+f),s=e.sliceDoc(r-f,r));let d=/^\s*/.exec(i)[0].length,p=/\s*$/.exec(s)[0].length,m=s.length-p-n.length;return i.slice(d,d+t.length)==t&&s.slice(m,m+n.length)==n?{open:{pos:o+d+t.length,margin:/\s/.test(i.charAt(d+t.length))?1:0},close:{pos:r-p-n.length,margin:/\s/.test(s.charAt(m-1))?1:0}}:null}(t,o[n],e.from,e.to)));if(2!=e&&!r.every((e=>e)))return{changes:t.changes(n.map(((e,t)=>r[t]?[]:[{from:e.from,insert:o[t].open+" "},{from:e.to,insert:" "+o[t].close}])))};if(1!=e&&r.some((e=>e))){let e=[];for(let t,n=0;n<r.length;n++)if(t=r[n]){let r=o[n],{open:i,close:s}=t;e.push({from:i.pos-r.open.length,to:i.pos+i.margin},{from:s.pos-s.margin,to:s.pos+r.close.length})}return{changes:e}}return null}function p(e,t,n=t.selection.ranges){let o=[],r=-1;for(let{from:e,to:i}of n){let n=o.length,s=1e9,l=h(t,e).line;if(l){for(let n=e;n<=i;){let a=t.doc.lineAt(n);if(a.from>r&&(e==i||i>a.from)){r=a.from;let e=/^\s*/.exec(a.text)[0].length,t=e==a.length,n=a.text.slice(e,e+l.length)==l?e:-1;e<a.text.length&&e<s&&(s=e),o.push({line:a,comment:n,token:l,indent:e,empty:t,single:!1})}n=a.to+1}if(s<1e9)for(let e=n;e<o.length;e++)o[e].indent<o[e].line.text.length&&(o[e].indent=s);o.length==n+1&&(o[n].single=!0)}}if(2!=e&&o.some((e=>e.comment<0&&(!e.empty||e.single)))){let e=[];for(let{line:t,token:n,indent:r,empty:i,single:s}of o)!s&&i||e.push({from:t.from+r,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&o.some((e=>e.comment>=0))){let e=[];for(let{line:t,comment:n,token:r}of o)if(n>=0){let o=t.from+n,i=o+r.length;" "==t.text[i-t.from]&&i++,e.push({from:o,to:i})}return{changes:e}}return null}const m=r.YH.define(),g=r.YH.define(),v=r.sj.define(),y=r.sj.define({combine(e){return(0,r.QR)(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,o)=>e(n,o)||t(n,o)})}}),k=r.sU.define({create(){return _.empty},update(e,t){let n=t.state.facet(y),o=t.annotation(m);if(o){let r=S.fromTransaction(t,o.selection),i=o.side,s=0==i?e.undone:e.done;return s=r?P(s,s.length,n.minDepth,r):I(s,t.startState.selection),new _(0==i?o.rest:s,0==i?s:o.rest)}let i=t.annotation(g);if("full"!=i&&"before"!=i||(e=e.isolate()),!1===t.annotation(r.ZX.addToHistory))return t.changes.empty?e:e.addMapping(t.changes.desc);let s=S.fromTransaction(t),l=t.annotation(r.ZX.time),a=t.annotation(r.ZX.userEvent);return s?e=e.addChanges(s,l,a,n,t):t.selection&&(e=e.addSelection(t.startState.selection,l,a,n.newGroupDelay)),"full"!=i&&"after"!=i||(e=e.isolate()),e},toJSON(e){return{done:e.done.map((e=>e.toJSON())),undone:e.undone.map((e=>e.toJSON()))}},fromJSON(e){return new _(e.done.map(S.fromJSON),e.undone.map(S.fromJSON))}});function b(e={}){return[k,y.of(e),o.Lz.domEventHandlers({beforeinput(e,t){let n="historyUndo"==e.inputType?O:"historyRedo"==e.inputType?x:null;return!!n&&(e.preventDefault(),n(t))}})]}function w(e,t){return function({state:n,dispatch:o}){if(!t&&n.readOnly)return!1;let r=n.field(k,!1);if(!r)return!1;let i=r.pop(e,n,t);return!!i&&(o(i),!0)}}const O=w(0,!1),x=w(1,!1),A=w(0,!0),C=w(1,!0);class S{constructor(e,t,n,o,r){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=o,this.selectionsAfter=r}setSelAfter(e){return new S(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null===(e=this.changes)||void 0===e?void 0:e.toJSON(),mapped:null===(t=this.mapped)||void 0===t?void 0:t.toJSON(),startSelection:null===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map((e=>e.toJSON()))}}static fromJSON(e){return new S(e.changes&&r.VR.fromJSON(e.changes),[],e.mapped&&r.Gu.fromJSON(e.mapped),e.startSelection&&r.OF.fromJSON(e.startSelection),e.selectionsAfter.map(r.OF.fromJSON))}static fromTransaction(e,t){let n=D;for(let t of e.startState.facet(v)){let o=t(e);o.length&&(n=n.concat(o))}return!n.length&&e.changes.empty?null:new S(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,D)}static selection(e){return new S(void 0,D,void 0,void 0,e)}}function P(e,t,n,o){let r=t+1>n+20?t-n-1:0,i=e.slice(r,t);return i.push(o),i}function T(e,t){return e.length?t.length?e.concat(t):e:t}const D=[],B=200;function I(e,t){if(e.length){let n=e[e.length-1],o=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-B));return o.length&&o[o.length-1].eq(t)?e:(o.push(t),P(e,e.length-1,1e9,n.setSelAfter(o)))}return[S.selection([t])]}function M(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 Q(e,t){if(!e.length)return e;let n=e.length,o=D;for(;n;){let r=R(e[n-1],t,o);if(r.changes&&!r.changes.empty||r.effects.length){let t=e.slice(0,n);return t[n-1]=r,t}t=r.mapped,n--,o=r.selectionsAfter}return o.length?[S.selection(o)]:D}function R(e,t,n){let o=T(e.selectionsAfter.length?e.selectionsAfter.map((e=>e.map(t))):D,n);if(!e.changes)return S.selection(o);let i=e.changes.map(t),s=t.mapDesc(e.changes,!0),l=e.mapped?e.mapped.composeDesc(s):s;return new S(i,r.Pe.mapEffects(e.effects,t),l,e.startSelection.map(s),o)}const L=/^(input\.type|delete)($|\.)/;class _{constructor(e,t,n=0,o=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=o}isolate(){return this.prevTime?new _(this.done,this.undone):this}addChanges(e,t,n,o,r){let i=this.done,s=i[i.length-1];return i=s&&s.changes&&!s.changes.empty&&e.changes&&(!n||L.test(n))&&(!s.selectionsAfter.length&&t-this.prevTime<o.newGroupDelay&&o.joinToEvent(r,function(e,t){let n=[],o=!1;return e.iterChangedRanges(((e,t)=>n.push(e,t))),t.iterChangedRanges(((e,t,r,i)=>{for(let e=0;e<n.length;){let t=n[e++],s=n[e++];i>=t&&r<=s&&(o=!0)}})),o}(s.changes,e.changes))||"input.type.compose"==n)?P(i,i.length-1,o.minDepth,new S(e.changes.compose(s.changes),T(e.effects,s.effects),s.mapped,s.startSelection,D)):P(i,i.length,o.minDepth,e),new _(i,D,t,n)}addSelection(e,t,n,o){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:D;return r.length>0&&t-this.prevTime<o&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&(i=r[r.length-1],s=e,i.ranges.length==s.ranges.length&&0===i.ranges.filter(((e,t)=>e.empty!=s.ranges[t].empty)).length)?this:new _(I(this.done,e),this.undone,t,n);var i,s}addMapping(e){return new _(Q(this.done,e),Q(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let o=0==e?this.done:this.undone;if(0==o.length)return null;let r=o[o.length-1],i=r.selectionsAfter[0]||t.selection;if(n&&r.selectionsAfter.length)return t.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:m.of({side:e,rest:M(o),selection:i}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){let n=1==o.length?D:o.slice(0,o.length-1);return r.mapped&&(n=Q(n,r.mapped)),t.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:m.of({side:e,rest:n,selection:i}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}return null}}_.empty=new _(D,D);const N=[{key:"Mod-z",run:O,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:x,preventDefault:!0},{linux:"Ctrl-Shift-z",run:x,preventDefault:!0},{key:"Mod-u",run:A,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:C,preventDefault:!0}];function U(e,t){return r.OF.create(e.ranges.map(t),e.mainIndex)}function E(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function F({state:e,dispatch:t},n){let o=U(e.selection,n);return!o.eq(e.selection,!0)&&(t(E(e,o)),!0)}function j(e,t){return r.OF.cursor(t?e.to:e.from)}function z(e,t){return F(e,(n=>n.empty?e.moveByChar(n,t):j(n,t)))}function $(e){return e.textDirectionAt(e.state.selection.main.head)==o.OP.LTR}const Z=e=>z(e,!$(e)),V=e=>z(e,$(e));function q(e,t){return F(e,(n=>n.empty?e.moveByGroup(n,t):j(n,t)))}function H(e,t,n){if(t.type.prop(n))return!0;let o=t.to-t.from;return o&&(o>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function W(e,t,n){let o,l,a=(0,i.mv)(e).resolveInner(t.head),c=n?s.uY.closedBy:s.uY.openedBy;for(let o=t.head;;){let t=n?a.childAfter(o):a.childBefore(o);if(!t)break;H(e,t,c)?a=t:o=n?t.to:t.from}return l=a.type.prop(c)&&(o=n?(0,i.jU)(e,a.from,1):(0,i.jU)(e,a.to,-1))&&o.matched?n?o.end.to:o.end.from:n?a.to:a.from,r.OF.cursor(l,n?-1:1)}function X(e,t){return F(e,(n=>{if(!n.empty)return j(n,t);let o=e.moveVertically(n,t);return o.head!=n.head?o:e.moveToLineBoundary(n,t)}))}"undefined"!=typeof Intl&&Intl.Segmenter;const J=e=>X(e,!1),Y=e=>X(e,!0);function K(e){let t,n=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,r=0,i=0;if(n){for(let t of e.state.facet(o.Lz.scrollMargins)){let n=t(e);(null==n?void 0:n.top)&&(r=Math.max(null==n?void 0:n.top,r)),(null==n?void 0:n.bottom)&&(i=Math.max(null==n?void 0:n.bottom,i))}t=e.scrollDOM.clientHeight-r-i}else t=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:r,marginBottom:i,selfScroll:n,height:Math.max(e.defaultLineHeight,t-5)}}function G(e,t){let n,r=K(e),{state:i}=e,s=U(i.selection,(n=>n.empty?e.moveVertically(n,t,r.height):j(n,t)));if(s.eq(i.selection))return!1;if(r.selfScroll){let t=e.coordsAtPos(i.selection.main.head),l=e.scrollDOM.getBoundingClientRect(),a=l.top+r.marginTop,c=l.bottom-r.marginBottom;t&&t.top>a&&t.bottom<c&&(n=o.Lz.scrollIntoView(s.main.head,{y:"start",yMargin:t.top-a}))}return e.dispatch(E(i,s),{effects:n}),!0}const ee=e=>G(e,!1),te=e=>G(e,!0);function ne(e,t,n){let o=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?o.to:o.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==o.from&&o.length){let n=/^\s*/.exec(e.state.sliceDoc(o.from,Math.min(o.from+100,o.to)))[0].length;n&&t.head!=o.from+n&&(i=r.OF.cursor(o.from+n))}return i}function oe(e,t){let n=U(e.state.selection,(e=>{let n=t(e);return r.OF.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)}));return!n.eq(e.state.selection)&&(e.dispatch(E(e.state,n)),!0)}function re(e,t){return oe(e,(n=>e.moveByChar(n,t)))}const ie=e=>re(e,!$(e)),se=e=>re(e,$(e));function le(e,t){return oe(e,(n=>e.moveByGroup(n,t)))}function ae(e,t){return oe(e,(n=>e.moveVertically(n,t)))}const ce=e=>ae(e,!1),ue=e=>ae(e,!0);function he(e,t){return oe(e,(n=>e.moveVertically(n,t,K(e).height)))}const fe=e=>he(e,!1),de=e=>he(e,!0),pe=({state:e,dispatch:t})=>(t(E(e,{anchor:0})),!0),me=({state:e,dispatch:t})=>(t(E(e,{anchor:e.doc.length})),!0),ge=({state:e,dispatch:t})=>(t(E(e,{anchor:e.selection.main.anchor,head:0})),!0),ve=({state:e,dispatch:t})=>(t(E(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0);function ye(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:i}=e,s=i.changeByRange((o=>{let{from:i,to:s}=o;if(i==s){let r=t(o);r<i?(n="delete.backward",r=ke(e,r,!1)):r>i&&(n="delete.forward",r=ke(e,r,!0)),i=Math.min(i,r),s=Math.max(s,r)}else i=ke(e,i,!1),s=ke(e,s,!0);return i==s?{range:o}:{changes:{from:i,to:s},range:r.OF.cursor(i,i<o.head?-1:1)}}));return!s.changes.empty&&(e.dispatch(i.update(s,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?o.Lz.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function ke(e,t,n){if(e instanceof o.Lz)for(let r of e.state.facet(o.Lz.atomicRanges).map((t=>t(e))))r.between(t,t,((e,o)=>{e<t&&o>t&&(t=n?o:e)}));return t}const be=(e,t,n)=>ye(e,(o=>{let s,l,a=o.from,{state:c}=e,u=c.doc.lineAt(a);if(n&&!t&&a>u.from&&a<u.from+200&&!/[^ \t]/.test(s=u.text.slice(0,a-u.from))){if("\t"==s[s.length-1])return a-1;let e=(0,r.y$)(s,c.tabSize)%(0,i.tp)(c)||(0,i.tp)(c);for(let t=0;t<e&&" "==s[s.length-1-t];t++)a--;l=a}else l=(0,r.zK)(u.text,a-u.from,t,t)+u.from,l==a&&u.number!=(t?c.doc.lines:1)?l+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(u.text.slice(l-u.from,a-u.from))&&(l=(0,r.zK)(u.text,l-u.from,!1,!1)+u.from);return l})),we=e=>be(e,!1,!0),Oe=e=>be(e,!0,!1),xe=(e,t)=>ye(e,(n=>{let o=n.head,{state:i}=e,s=i.doc.lineAt(o),l=i.charCategorizer(o);for(let e=null;;){if(o==(t?s.to:s.from)){o==n.head&&s.number!=(t?i.doc.lines:1)&&(o+=t?1:-1);break}let a=(0,r.zK)(s.text,o-s.from,t)+s.from,c=s.text.slice(Math.min(o,a)-s.from,Math.max(o,a)-s.from),u=l(c);if(null!=e&&u!=e)break;" "==c&&o==n.head||(e=u),o=a}return o})),Ae=e=>xe(e,!1);function Ce(e){let t=[],n=-1;for(let o of e.selection.ranges){let r=e.doc.lineAt(o.from),i=e.doc.lineAt(o.to);if(o.empty||o.to!=i.from||(i=e.doc.lineAt(o.to-1)),n>=r.number){let e=t[t.length-1];e.to=i.to,e.ranges.push(o)}else t.push({from:r.from,to:i.to,ranges:[o]});n=i.number+1}return t}function Se(e,t,n){if(e.readOnly)return!1;let o=[],i=[];for(let t of Ce(e)){if(n?t.to==e.doc.length:0==t.from)continue;let s=e.doc.lineAt(n?t.to+1:t.from-1),l=s.length+1;if(n){o.push({from:t.to,to:s.to},{from:t.from,insert:s.text+e.lineBreak});for(let n of t.ranges)i.push(r.OF.range(Math.min(e.doc.length,n.anchor+l),Math.min(e.doc.length,n.head+l)))}else{o.push({from:s.from,to:t.from},{from:t.to,insert:e.lineBreak+s.text});for(let e of t.ranges)i.push(r.OF.range(e.anchor-l,e.head-l))}}return!!o.length&&(t(e.update({changes:o,scrollIntoView:!0,selection:r.OF.create(i,e.selection.mainIndex),userEvent:"move.line"})),!0)}function Pe(e,t,n){if(e.readOnly)return!1;let o=[];for(let t of Ce(e))n?o.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):o.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});return t(e.update({changes:o,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Te=De(!1);function De(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let o=t.changeByRange((n=>{let{from:o,to:l}=n,a=t.doc.lineAt(o),c=!e&&o==l&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n,o=(0,i.mv)(e).resolveInner(t),r=o.childBefore(t),l=o.childAfter(t);return r&&l&&r.to<=t&&l.from>=t&&(n=r.type.prop(s.uY.closedBy))&&n.indexOf(l.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(l.from).from&&!/\S/.test(e.sliceDoc(r.to,l.from))?{from:r.to,to:l.from}:null}(t,o);e&&(o=l=(l<=a.to?a:t.doc.lineAt(l)).to);let u=new i.KB(t,{simulateBreak:o,simulateDoubleBreak:!!c}),h=(0,i._v)(u,o);for(null==h&&(h=(0,r.y$)(/^\s*/.exec(t.doc.lineAt(o).text)[0],t.tabSize));l<a.to&&/\s/.test(a.text[l-a.from]);)l++;c?({from:o,to:l}=c):o>a.from&&o<a.from+100&&!/\S/.test(a.text.slice(0,o))&&(o=a.from);let f=["",(0,i.EI)(t,h)];return c&&f.push((0,i.EI)(t,u.lineIndent(a.from,-1))),{changes:{from:o,to:l,insert:r.EY.of(f)},range:r.OF.cursor(o+1+f[1].length)}}));return n(t.update(o,{scrollIntoView:!0,userEvent:"input"})),!0}}function Be(e,t){let n=-1;return e.changeByRange((o=>{let i=[];for(let r=o.from;r<=o.to;){let s=e.doc.lineAt(r);s.number>n&&(o.empty||o.to>s.from)&&(t(s,i,o),n=s.number),r=s.to+1}let s=e.changes(i);return{changes:i,range:r.OF.range(s.mapPos(o.anchor,1),s.mapPos(o.head,1))}}))}const Ie=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:e=>F(e,(t=>W(e.state,t,!$(e)))),shift:e=>oe(e,(t=>W(e.state,t,!$(e))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>F(e,(t=>W(e.state,t,$(e)))),shift:e=>oe(e,(t=>W(e.state,t,$(e))))},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>Se(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>Pe(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>Se(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>Pe(e,t,!0)},{key:"Escape",run:({state:e,dispatch:t})=>{let n=e.selection,o=null;return n.ranges.length>1?o=r.OF.create([n.main]):n.main.empty||(o=r.OF.create([r.OF.cursor(n.main.head)])),!!o&&(t(E(e,o)),!0)}},{key:"Mod-Enter",run:De(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let n=Ce(e).map((({from:t,to:n})=>r.OF.range(t,Math.min(n+1,e.doc.length))));return t(e.update({selection:r.OF.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let n=U(e.selection,(t=>{var n;for(let o=(0,i.mv)(e).resolveStack(t.from,1);o;o=o.next){let{node:e}=o;if((e.from<t.from&&e.to>=t.to||e.to>t.to&&e.from<=t.from)&&(null===(n=e.parent)||void 0===n?void 0:n.parent))return r.OF.range(e.to,e.from)}return t}));return t(E(e,n)),!0},preventDefault:!0},{key:"Mod-[",run:({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Be(e,((t,n)=>{let o=/^\s*/.exec(t.text)[0];if(!o)return;let s=(0,r.y$)(o,e.tabSize),l=0,a=(0,i.EI)(e,Math.max(0,s-(0,i.tp)(e)));for(;l<o.length&&l<a.length&&o.charCodeAt(l)==a.charCodeAt(l);)l++;n.push({from:t.from+l,to:t.from+o.length,insert:a.slice(l)})})),{userEvent:"delete.dedent"})),!0)},{key:"Mod-]",run:({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Be(e,((t,n)=>{n.push({from:t.from,insert:e.facet(i.Xt)})})),{userEvent:"input.indent"})),!0)},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),o=new i.KB(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),r=Be(e,((t,r,s)=>{let l=(0,i._v)(o,t.from);if(null==l)return;/\S/.test(t.text)||(l=0);let a=/^\s*/.exec(t.text)[0],c=(0,i.EI)(e,l);(a!=c||s.from<t.from+a.length)&&(n[t.from]=l,r.push({from:t.from,to:t.from+a.length,insert:c}))}));return r.changes.empty||t(e.update(r,{userEvent:"indent"})),!0}},{key:"Shift-Mod-k",run:e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(Ce(t).map((({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n})))),o=U(t.selection,(t=>{let n;if(e.lineWrapping){let o=e.lineBlockAt(t.head),r=e.coordsAtPos(t.head,t.assoc||1);r&&(n=o.bottom+e.documentTop-r.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)})).map(n);return e.dispatch({changes:n,selection:o,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>function(e,t,n){let o=!1,s=U(e.selection,(t=>{let s=(0,i.jU)(e,t.head,-1)||(0,i.jU)(e,t.head,1)||t.head>0&&(0,i.jU)(e,t.head-1,1)||t.head<e.doc.length&&(0,i.jU)(e,t.head+1,-1);if(!s||!s.end)return t;o=!0;let l=s.start.from==t.head?s.end.to:s.end.from;return n?r.OF.range(t.anchor,l):r.OF.cursor(l)}));return!!o&&(t(E(e,s)),!0)}(e,t,!1)},{key:"Mod-/",run:e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),o=h(e.state,n.from);return o.line?a(e):!!o.block&&u(e)}},{key:"Alt-A",run:c}].concat([{key:"ArrowLeft",run:Z,shift:ie,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>q(e,!$(e)),shift:e=>le(e,!$(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>F(e,(t=>ne(e,t,!$(e)))),shift:e=>oe(e,(t=>ne(e,t,!$(e)))),preventDefault:!0},{key:"ArrowRight",run:V,shift:se,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>q(e,$(e)),shift:e=>le(e,$(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>F(e,(t=>ne(e,t,$(e)))),shift:e=>oe(e,(t=>ne(e,t,$(e)))),preventDefault:!0},{key:"ArrowUp",run:J,shift:ce,preventDefault:!0},{mac:"Cmd-ArrowUp",run:pe,shift:ge},{mac:"Ctrl-ArrowUp",run:ee,shift:fe},{key:"ArrowDown",run:Y,shift:ue,preventDefault:!0},{mac:"Cmd-ArrowDown",run:me,shift:ve},{mac:"Ctrl-ArrowDown",run:te,shift:de},{key:"PageUp",run:ee,shift:fe},{key:"PageDown",run:te,shift:de},{key:"Home",run:e=>F(e,(t=>ne(e,t,!1))),shift:e=>oe(e,(t=>ne(e,t,!1))),preventDefault:!0},{key:"Mod-Home",run:pe,shift:ge},{key:"End",run:e=>F(e,(t=>ne(e,t,!0))),shift:e=>oe(e,(t=>ne(e,t,!0))),preventDefault:!0},{key:"Mod-End",run:me,shift:ve},{key:"Enter",run:Te},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:we,shift:we},{key:"Delete",run:Oe},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Ae},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>xe(e,!0)},{mac:"Mod-Backspace",run:e=>ye(e,(t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}))},{mac:"Mod-Delete",run:e=>ye(e,(t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}))}].concat([{key:"Ctrl-b",run:Z,shift:ie,preventDefault:!0},{key:"Ctrl-f",run:V,shift:se},{key:"Ctrl-p",run:J,shift:ce},{key:"Ctrl-n",run:Y,shift:ue},{key:"Ctrl-a",run:e=>F(e,(t=>r.OF.cursor(e.lineBlockAt(t.head).from,1))),shift:e=>oe(e,(t=>r.OF.cursor(e.lineBlockAt(t.head).from)))},{key:"Ctrl-e",run:e=>F(e,(t=>r.OF.cursor(e.lineBlockAt(t.head).to,-1))),shift:e=>oe(e,(t=>r.OF.cursor(e.lineBlockAt(t.head).to)))},{key:"Ctrl-d",run:Oe},{key:"Ctrl-h",run:we},{key:"Ctrl-k",run:e=>ye(e,(t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}))},{key:"Ctrl-Alt-h",run:Ae},{key:"Ctrl-o",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:r.EY.of(["",""])},range:r.OF.cursor(e.from)})));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,o=e.doc.lineAt(n),i=n==o.from?n-1:(0,r.zK)(o.text,n-o.from,!1)+o.from,s=n==o.to?n+1:(0,r.zK)(o.text,n-o.from,!0)+o.from;return{changes:{from:i,to:s,insert:e.doc.slice(n,s).append(e.doc.slice(i,n))},range:r.OF.cursor(s)}}));return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:te}].map((e=>({mac:e.key,run:e.run,shift:e.shift})))));var Me=n(54528),Qe=n(47404),Re=n(93748);class Le{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class _e{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let r=e,i=n.facet(He).markerFilter;i&&(r=i(r,n));let s=o.NZ.set(r.map((e=>e.from==e.to||e.from==e.to-1&&n.doc.lineAt(e.from).to==e.from?o.NZ.widget({widget:new Je(e),diagnostic:e}).range(e.from):o.NZ.mark({attributes:{class:"cm-lintRange cm-lintRange-"+e.severity+(e.markClass?" "+e.markClass:"")},diagnostic:e,inclusive:!0}).range(e.from,e.to))),!0);return new _e(s,t,Ne(s))}}function Ne(e,t=null,n=0){let o=null;return e.between(n,1e9,((e,n,{spec:r})=>{if(!t||r.diagnostic==t)return o=new Le(e,n,r.diagnostic),!1})),o}const Ue=r.Pe.define(),Ee=r.Pe.define(),Fe=r.Pe.define(),je=r.sU.define({create(){return new _e(o.NZ.none,null,null)},update(e,t){if(t.docChanged){let n=e.diagnostics.map(t.changes),o=null;if(e.selected){let r=t.changes.mapPos(e.selected.from,1);o=Ne(n,e.selected.diagnostic,r)||Ne(n,null,r)}e=new _e(n,e.panel,o)}for(let n of t.effects)n.is(Ue)?e=_e.init(n.value,e.panel,t.state):n.is(Ee)?e=new _e(e.diagnostics,n.value?Ke.open:null,e.selected):n.is(Fe)&&(e=new _e(e.diagnostics,e.panel,n.value));return e},provide:e=>[o.S7.from(e,(e=>e.panel)),o.Lz.decorations.from(e,(e=>e.diagnostics))]}),ze=o.NZ.mark({class:"cm-lintRange cm-lintRange-active",inclusive:!0});function $e(e,t,n){let{diagnostics:o}=e.state.field(je),r=[],i=2e8,s=0;o.between(t-(n<0?1:0),t+(n>0?1:0),((e,o,{spec:l})=>{t>=e&&t<=o&&(e==o||(t>e||n>0)&&(t<o||n<0))&&(r.push(l.diagnostic),i=Math.min(e,i),s=Math.max(o,s))}));let l=e.state.facet(He).tooltipFilter;return l&&(r=l(r,e.state)),r.length?{pos:i,end:s,above:e.state.doc.lineAt(i).to<s,create(){return{dom:Ze(e,r)}}}:null}function Ze(e,t){return(0,Re.A)("ul",{class:"cm-tooltip-lint"},t.map((t=>Xe(e,t,!1))))}const Ve=e=>{let t=e.state.field(je,!1);return!(!t||!t.panel||(e.dispatch({effects:Ee.of(!1)}),0))},qe=[{key:"Mod-Shift-m",run:e=>{let t=e.state.field(je,!1);var n,i;t&&t.panel||e.dispatch({effects:(n=e.state,i=[Ee.of(!0)],n.field(je,!1)?i:i.concat(r.Pe.appendConfig.of(tt)))});let s=(0,o.ld)(e,Ke.open);return s&&s.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:e=>{let t=e.state.field(je,!1);if(!t)return!1;let n=e.state.selection.main,o=t.diagnostics.iter(n.to+1);return!(!o.value&&(o=t.diagnostics.iter(0),!o.value||o.from==n.from&&o.to==n.to)||(e.dispatch({selection:{anchor:o.from,head:o.to},scrollIntoView:!0}),0))}}],He=r.sj.define({combine(e){return Object.assign({sources:e.map((e=>e.source)).filter((e=>null!=e))},(0,r.QR)(e.map((e=>e.config)),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t}))}});function We(e){let t=[];if(e)e:for(let{name:n}of e){for(let e=0;e<n.length;e++){let o=n[e];if(/[a-zA-Z]/.test(o)&&!t.some((e=>e.toLowerCase()==o.toLowerCase()))){t.push(o);continue e}}t.push("")}return t}function Xe(e,t,n){var o;let r=n?We(t.actions):[];return(0,Re.A)("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},(0,Re.A)("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),null===(o=t.actions)||void 0===o?void 0:o.map(((n,o)=>{let i=!1,s=o=>{if(o.preventDefault(),i)return;i=!0;let r=Ne(e.state.field(je).diagnostics,t);r&&n.apply(e,r.from,r.to)},{name:l}=n,a=r[o]?l.indexOf(r[o]):-1,c=a<0?l:[l.slice(0,a),(0,Re.A)("u",l.slice(a,a+1)),l.slice(a+1)];return(0,Re.A)("button",{type:"button",class:"cm-diagnosticAction",onclick:s,onmousedown:s,"aria-label":` Action: ${l}${a<0?"":` (access key "${r[o]})"`}.`},c)})),t.source&&(0,Re.A)("div",{class:"cm-diagnosticSource"},t.source))}class Je extends o.xO{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return(0,Re.A)("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class Ye{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=Xe(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Ke{constructor(e){this.view=e,this.items=[],this.list=(0,Re.A)("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t=>{if(27==t.keyCode)Ve(this.view),this.view.focus();else if(38==t.keyCode||33==t.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==t.keyCode||34==t.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==t.keyCode)this.moveSelection(0);else if(35==t.keyCode)this.moveSelection(this.items.length-1);else if(13==t.keyCode)this.view.focus();else{if(!(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0))return;{let{diagnostic:n}=this.items[this.selectedIndex],o=We(n.actions);for(let r=0;r<o.length;r++)if(o[r].toUpperCase().charCodeAt(0)==t.keyCode){let t=Ne(this.view.state.field(je).diagnostics,n);t&&n.actions[r].apply(e,t.from,t.to)}}}t.preventDefault()},onclick:e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)}}),this.dom=(0,Re.A)("div",{class:"cm-panel-lint"},this.list,(0,Re.A)("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Ve(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(je).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(je),n=0,o=!1,r=null;for(e.between(0,this.view.state.doc.length,((e,i,{spec:s})=>{let l,a=-1;for(let e=n;e<this.items.length;e++)if(this.items[e].diagnostic==s.diagnostic){a=e;break}a<0?(l=new Ye(this.view,s.diagnostic),this.items.splice(n,0,l),o=!0):(l=this.items[a],a>n&&(this.items.splice(n,a-n),o=!0)),t&&l.diagnostic==t.diagnostic?l.dom.hasAttribute("aria-selected")||(l.dom.setAttribute("aria-selected","true"),r=l):l.dom.hasAttribute("aria-selected")&&l.dom.removeAttribute("aria-selected"),n++}));n<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)o=!0,this.items.pop();0==this.items.length&&(this.items.push(new Ye(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),o=!0),r?(this.list.setAttribute("aria-activedescendant",r.id),this.view.requestMeasure({key:this,read:()=>({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),o&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=Ne(this.view.state.field(je).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:Fe.of(t)})}static open(e){return new Ke(e)}}function Ge(e){return function(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>')`}(`<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"')}const et=o.Lz.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:Ge("#d11")},".cm-lintRange-warning":{backgroundImage:Ge("orange")},".cm-lintRange-info":{backgroundImage:Ge("#999")},".cm-lintRange-hint":{backgroundImage:Ge("#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}}});o.wJ;const tt=[je,o.Lz.decorations.compute([je],(e=>{let{selected:t,panel:n}=e.field(je);return t&&n&&t.from!=t.to?o.NZ.set([ze.range(t.from,t.to)]):o.NZ.none})),(0,o.Ux)($e,{hideOn:function(e,t){let n=t.pos,o=t.end||n,r=e.state.facet(He).hideOn(e,n,o);if(null!=r)return r;let i=e.startState.doc.lineAt(t.pos);return!(!e.effects.some((e=>e.is(Ue)))&&!e.changes.touchesRange(i.from,Math.max(i.to,o)))}}),et],nt=(()=>[(0,o.$K)(),(0,o.Wu)(),(0,o.N$)(),b(),(0,i.Lv)(),(0,o.VH)(),(0,o.A)(),r.$t.allowMultipleSelections.of(!0),(0,i.WD)(),(0,i.y9)(i.Zt,{fallback:!0}),(0,i.SG)(),(0,Qe.wm)(),(0,Qe.yU)(),(0,o.D4)(),(0,o.HJ)(),(0,o.dz)(),(0,Me.gN)(),o.w4.of([...Qe.Bc,...Ie,...Me.Eo,...N,...i.f7,...Qe.OO,...qe])])()}}]);
|
|
Binary file
|