| 1 |
"use strict";(globalThis.webpackChunktemplately||=[]).push([[903],{4216(e,t,n){n.d(t,{wm:()=>J,yU:()=>ue});var i=n(2701),r=n(9747),o=n(6684);class s{constructor(e,t,n,i){this.state=e,this.pos=t,this.explicit=n,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=(0,o.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),i=t.text.slice(n-t.from,this.pos-t.from),r=i.search(h(e,!1));return r<0?null:{from:n+r,to:this.pos,text:i.slice(r)}}get aborted(){return null==this.abortListeners}addEventListener(e,t,n){"abort"==e&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function a(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,"\\$&")}]`}class l{constructor(e,t,n,i){this.completion=e,this.source=t,this.match=n,this.score=i}}function c(e){return e.selection.main.from}function h(e,t){var n;let{source:i}=e,r=t&&"^"!=i[0],o="$"!=i[i.length-1];return r||o?new RegExp(`${r?"^":""}(?:${i})${o?"$":""}`,null!==(n=e.flags)&&void 0!==n?n:e.ignoreCase?"i":""):e}const u=i.YH.define();function d(e,t,n,r){let{main:o}=e.selection,s=n-o.from,a=r-o.from;return{...e.changeByRange(l=>{if(l!=o&&n!=r&&e.sliceDoc(l.from+s,l.from+a)!=e.sliceDoc(n,r))return{range:l};let c=e.toText(t);return{changes:{from:l.from+s,to:r==o.from?l.to:l.from+a,insert:c},range:i.OF.cursor(l.from+s+c.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const f=new WeakMap;function p(e){if(!Array.isArray(e))return e;let t=f.get(e);return t||f.set(e,t=function(e){let t=e.map(e=>"string"==typeof e?{label:e}:e),[n,i]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:function(e){let t=Object.create(null),n=Object.create(null);for(let{label:i}of e){t[i[0]]=!0;for(let e=1;e<i.length;e++)n[i[e]]=!0}let i=a(t)+a(n)+"*$";return[new RegExp("^"+i),new RegExp(i)]}(t);return e=>{let r=e.matchBefore(i);return r||e.explicit?{from:r?r.from:e.pos,options:t,validFor:n}:null}}(e)),t}const m=i.Pe.define(),g=i.Pe.define();class b{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,i.vS)(e,t),r=(0,i.Fh)(n);this.chars.push(n);let o=e.slice(t,t+r),s=o.toUpperCase();this.folded.push((0,i.vS)(s==o?o.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:o,byWord:s}=this;if(1==t.length){let r=(0,i.vS)(e,0),o=(0,i.Fh)(r),s=o==e.length?0:-100;if(r==t[0]);else{if(r!=n[0])return null;s+=-200}return this.ret(s,[0,o])}let a=e.indexOf(this.pattern);if(0==a)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=t.length,c=0;if(a<0){for(let o=0,s=Math.min(e.length,200);o<s&&c<l;){let s=(0,i.vS)(e,o);s!=t[c]&&s!=n[c]||(r[c++]=o),o+=(0,i.Fh)(s)}if(c<l)return null}let h=0,u=0,d=!1,f=0,p=-1,m=-1,g=/[a-z]/.test(e),b=!0;for(let r=0,c=Math.min(e.length,200),y=0;r<c&&u<l;){let c=(0,i.vS)(e,r);a<0&&(h<l&&c==t[h]&&(o[h++]=r),f<l&&(c==t[f]||c==n[f]?(0==f&&(p=r),m=r+1,f++):f=0));let v,w=c<255?c>=48&&c<=57||c>=97&&c<=122?2:c>=65&&c<=90?1:0:(v=(0,i.MK)(c))!=v.toLowerCase()?1:v!=v.toUpperCase()?2:0;(!r||1==w&&g||0==y&&0!=w)&&(t[u]==c||n[u]==c&&(d=!0)?s[u++]=r:s.length&&(b=!1)),y=w,r+=(0,i.Fh)(c)}return u==l&&0==s[0]&&b?this.result((d?-200:0)-100,s,e):f==l&&0==p?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):f==l?this.ret(-900-e.length,[p,m]):u==l?this.result((d?-200:0)-100-700+(b?0:-1100),s,e):2==t.length?null:this.result((r[0]?-700:0)-200-1100,r,e)}result(e,t,n){let r=[],o=0;for(let e of t){let t=e+(this.astral?(0,i.Fh)((0,i.vS)(n,e)):1);o&&r[o-1]==e?r[o-1]=t:(r[o++]=e,r[o++]=t)}return this.ret(e-n.length,r)}}class y{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 v=i.sj.define({combine:e=>(0,i.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:k,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||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 k(e,t,n,i,o,s){let a,l,c=e.textDirection==r.OP.RTL,h=c,u=!1,d="top",f=t.left-o.left,p=o.right-t.right,m=i.right-i.left,g=i.bottom-i.top;if(h&&f<Math.min(m,p)?h=!1:!h&&p<Math.min(m,f)&&(h=!0),m<=(h?f:p))a=Math.max(o.top,Math.min(n.top,o.bottom-g))-t.top,l=Math.min(400,h?f:p);else{u=!0,l=Math.min(400,(c?t.right:o.right-t.left)-30);let e=o.bottom-t.bottom;e>=g||e>t.top?a=n.bottom-t.top:(d="bottom",a=t.bottom-n.top)}return{style:`${d}: ${a/((t.bottom-t.top)/s.offsetHeight)}px; max-width: ${l/((t.right-t.left)/s.offsetWidth)}px`,class:"cm-completionInfo-"+(u?c?"left-narrow":"right-narrow":h?"left":"right")}}const x=i.Pe.define();function S(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 i=Math.ceil((e-t)/n);return{from:e-i*n,to:e-(i-1)*n}}class C{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 i=e.state.field(t),{options:r,selected:o}=i.open,s=e.state.facet(v);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,i){let r=document.createElement("span");r.className="cm-completionLabel";let o=e.displayLabel||e.label,s=0;for(let e=0;e<i.length;){let t=i[e++],n=i[e++];t>s&&r.appendChild(document.createTextNode(o.slice(s,t)));let a=r.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(o.slice(t,n))),a.className="cm-completionMatchedText",s=n}return s<o.length&&r.appendChild(document.createTextNode(o.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=S(r.length,o,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",n=>{let{options:i}=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]<i.length)return this.applyCompletion(e,i[+t[1]]),void n.preventDefault();if(n.target==this.list){let t=this.list.classList.contains("cm-completionListIncompleteTop")&&n.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&n.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;null!=t&&(e.dispatch({effects:x.of(t)}),n.preventDefault())}}),this.dom.addEventListener("focusout",t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(v).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:g.of(null)})}),this.showOptions(r,i.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),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=i){let{options:r,selected:o,disabled:s}=n.open;i.open&&i.open.options==r||(this.range=S(r.length,o,e.state.facet(v).maxRenderedOptions),this.showOptions(r,n.id)),this.updateSel(),s!=(null===(t=i.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;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=S(t.options.length,t.selected,this.view.state.facet(v).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:i}=t.options[t.selected],{info:o}=i;if(!o)return;let s="string"==typeof o?document.createTextNode(o):o(i);if(!s)return;"then"in s?s.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,i)}).catch(e=>(0,r.c_)(this.view.state,e,"completion info")):(this.addInfoPane(s,i),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(65535*Math.random()).toString(16),null!=e.nodeType)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:i}=e;n.appendChild(t),this.infoDestroy=i||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)"LI"==n.nodeName&&n.id?i==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&(n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby")):i--;return t&&function(e,t){let n=e.getBoundingClientRect(),i=t.getBoundingClientRect(),r=n.height/e.offsetHeight;i.top<n.top?e.scrollTop-=(n.top-i.top)/r:i.bottom>n.bottom&&(e.scrollTop+=(i.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(),i=e.getBoundingClientRect(),r=this.space;if(!r){let e=this.dom.ownerDocument.documentElement;r={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return i.top>Math.min(r.bottom,t.bottom)-10||i.bottom<Math.max(r.top,t.top)+10?null:this.view.state.facet(v).positionInfo(this.view,t,i,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 i=document.createElement("ul");i.id=t,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions")),i.addEventListener("mousedown",e=>{e.target==i&&e.preventDefault()});let r=null;for(let o=n.from;o<n.to;o++){let{completion:s,match:a}=e[o],{section:l}=s;if(l){let e="string"==typeof l?l:l.name;e!=r&&(o>n.from||0==n.from)&&(r=e,"string"!=typeof l&&l.header?i.appendChild(l.header(l)):i.appendChild(document.createElement("completion-section")).textContent=e)}const c=i.appendChild(document.createElement("li"));c.id=t+"-"+o,c.setAttribute("role","option");let h=this.optionClass(s);h&&(c.className=h);for(let e of this.optionContent){let t=e(s,this.view.state,this.view,a);t&&c.appendChild(t)}}return n.from&&i.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function A(e,t){return n=>new C(n,e,t)}function M(e){return 100*(e.boost||0)+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}class T{constructor(e,t,n,i,r,o){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=i,this.selected=r,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new T(this.options,z(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,i,r,o){if(i&&!o&&e.some(e=>e.isPending))return i.setDisabled();let s=function(e,t){let n=[],i=null,r=null,o=e=>{n.push(e);let{section:t}=e.completion;if(t){i||(i=[]);let e="string"==typeof t?t:t.name;i.some(t=>t.name==e)||i.push("string"==typeof t?{name:e}:t)}},s=t.facet(v);for(let i of e)if(i.hasResult()){let e=i.result.getMatch;if(!1===i.result.filter)for(let t of i.result.options)o(new l(t,i.source,e?e(t):[],1e9-n.length));else{let n,a=t.sliceDoc(i.from,i.to),c=s.filterStrict?new y(a):new b(a);for(let t of i.result.options)if(n=c.match(t.label)){let s=t.displayLabel?e?e(t,n.matched):[]:n.matched,a=n.score+(t.boost||0);if(o(new l(t,i.source,s,a)),"object"==typeof t.section&&"dynamic"===t.section.rank){let{name:e}=t.section;r||(r=Object.create(null)),r[e]=Math.max(a,r[e]||-1e9)}}}}if(i){let e=Object.create(null),t=0,o=(e,t)=>("dynamic"===e.rank&&"dynamic"===t.rank?r[t.name]-r[e.name]:0)||("number"==typeof e.rank?e.rank:1e9)-("number"==typeof t.rank?t.rank:1e9)||(e.name<t.name?-1:1);for(let n of i.sort(o))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 a=[],c=null,h=s.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||h(e.completion,t.completion))){let t=e.completion;!c||c.label!=t.label||c.detail!=t.detail||null!=c.type&&null!=t.type&&c.type!=t.type||c.apply!=t.apply||c.boost!=t.boost?a.push(e):M(e.completion)>M(c)&&(a[a.length-1]=e),c=e.completion}return a}(e,t);if(!s.length)return i&&e.some(e=>e.isPending)?i.setDisabled():null;let a=t.facet(v).selectOnOpen?0:-1;if(i&&i.selected!=a&&-1!=i.selected){let e=i.options[i.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){a=t;break}}return new T(s,z(n,a),{pos:e.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:W,above:r.aboveCursor},i?i.timestamp:Date.now(),a,!1)}map(e){return new T(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new T(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class O{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new O(E,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(e){let{state:t}=e,n=t.facet(v),i=(n.override||t.languageDataAt("autocomplete",c(t)).map(p)).map(t=>(this.active.find(e=>e.source==t)||new R(t,this.active.some(e=>0!=e.state)?1:0)).update(e,n));i.length==this.active.length&&i.every((e,t)=>e==this.active[t])&&(i=this.active);let r=this.open,o=e.effects.some(e=>e.is(I));r&&e.docChanged&&(r=r.map(e.changes)),e.selection||i.some(t=>t.hasResult()&&e.changes.touchesRange(t.from,t.to))||!function(e,t){if(e==t)return!0;for(let n=0,i=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;i<t.length&&!t[i].hasResult();)i++;let r=n==e.length,o=i==t.length;if(r||o)return r==o;if(e[n++].result!=t[i++].result)return!1}}(i,this.active)||o?r=T.build(i,t,this.id,r,n,o):r&&r.disabled&&!i.some(e=>e.isPending)&&(r=null),!r&&i.every(e=>!e.isPending)&&i.some(e=>e.hasResult())&&(i=i.map(e=>e.hasResult()?new R(e.source,0):e));for(let t of e.effects)t.is(x)&&(r=r&&r.setSelected(t.value,this.id));return i==this.active&&r==this.open?this:new O(i,this.id,r)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?D:L}}const D={"aria-autocomplete":"list"},L={};function z(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const E=[];function B(e,t){if(e.isUserEvent("input.complete")){let n=e.annotation(u);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class R{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return 1==this.state}update(e,t){let n=B(e,t),i=this;(8&n||16&n&&this.touches(e))&&(i=new R(i.source,0)),4&n&&0==i.state&&(i=new R(this.source,1)),i=i.updateFor(e,n);for(let t of e.effects)if(t.is(m))i=new R(i.source,1,t.value);else if(t.is(g))i=new R(i.source,0);else if(t.is(I))for(let e of t.value)e.source==i.source&&(i=e);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(c(e.state))}}class P extends R{constructor(e,t,n,i,r,o){super(e,3,t),this.limit=n,this.result=i,this.from=r,this.to=o}hasResult(){return!0}updateFor(e,t){var n;if(!(3&t))return this.map(e.changes);let i=this.result;i.map&&!e.changes.empty&&(i=i.map(i,e.changes));let r=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=c(e.state);if(a>o||!i||2&t&&(c(e.startState)==this.from||a<this.limit))return new R(this.source,4&t?1:0);let l=e.changes.mapPos(this.limit);return function(e,t,n,i){if(!e)return!1;let r=t.sliceDoc(n,i);return"function"==typeof e?e(r,n,i,t):h(e,!0).test(r)}(i.validFor,e.state,r,o)?new P(this.source,this.explicit,l,i,r,o):i.update&&(i=i.update(i,r,o,new s(e.state,a,!1)))?new P(this.source,this.explicit,l,i,i.from,null!==(n=i.to)&&void 0!==n?n:c(e.state)):new R(this.source,1,this.explicit)}map(e){if(e.empty)return this;let t=this.result.map?this.result.map(this.result,e):this.result;return t?new P(this.source,this.explicit,e.mapPos(this.limit),t,e.mapPos(this.from),e.mapPos(this.to,1)):new R(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}const I=i.Pe.define({map:(e,t)=>e.map(e=>e.map(t))}),N=i.sU.define({create:()=>O.start(),update:(e,t)=>e.update(t),provide:e=>[r.DK.from(e,e=>e.tooltip),r.Lz.contentAttributes.from(e,e=>e.attrs)]});function F(e,t){const n=t.completion.apply||t.completion.label;let i=e.state.field(N).active.find(e=>e.source==t.source);return i instanceof P&&("string"==typeof n?e.dispatch({...d(e.state,n,i.from,i.to),annotations:u.of(t.completion)}):n(e,t.completion,i.from,i.to),!0)}const W=A(N,F);function H(e,t="option"){return n=>{let i=n.state.field(N,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp<n.state.facet(v).interactionDelay)return!1;let o,s=1;"page"==t&&(o=(0,r.Eg)(n,i.open.tooltip))&&(s=Math.max(2,Math.floor(o.dom.offsetHeight/o.dom.querySelector("li").offsetHeight)-1));let{length:a}=i.open.options,l=i.open.selected>-1?i.open.selected+s*(e?1:-1):e?0:a-1;return l<0?l="page"==t?0:a-1:l>=a&&(l="page"==t?a-1:0),n.dispatch({effects:x.of(l)}),!0}}const q=e=>!!e.state.field(N,!1)&&(e.dispatch({effects:m.of(!0)}),!0);class V{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const j=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)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(N),n=e.state.facet(v);if(!e.selectionSet&&!e.docChanged&&e.startState.field(N)==t)return;let i=e.transactions.some(e=>{let t=B(e,n);return 8&t||(e.selection||e.docChanged)&&!(3&t)});for(let t=0;t<this.running.length;t++){let n=this.running[t];if(i||n.context.abortOnDocChange&&e.docChanged||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(m)))&&(this.pendingStart=!0);let o=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),o):-1,0!=this.composing)for(let t of e.transactions)t.isUserEvent("input.type")?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)e.isPending&&!this.running.some(t=>t.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(v).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=c(t),i=new s(t,n,e.explicit,this.view),o=new V(e,i);this.running.push(o),Promise.resolve(e.source(i)).then(e=>{o.context.aborted||(o.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:g.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(v).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(v),i=this.view.state.field(N);for(let r=0;r<this.running.length;r++){let o=this.running[r];if(void 0===o.done)continue;if(this.running.splice(r--,1),o.done){let i=c(o.updates.length?o.updates[0].startState:this.view.state),r=Math.min(i,o.done.from+(o.active.explicit?0:1)),s=new P(o.active.source,o.active.explicit,r,o.done,o.done.from,null!==(e=o.done.to)&&void 0!==e?e:i);for(let e of o.updates)s=s.update(e,n);if(s.hasResult()){t.push(s);continue}}let s=i.active.find(e=>e.source==o.active.source);if(s&&s.isPending)if(null==o.done){let e=new R(o.active.source,0);for(let t of o.updates)e=e.update(t,n);e.isPending||t.push(e)}else this.startQuery(s)}(t.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:I.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(N,!1);if(t&&t.tooltip&&this.view.state.facet(v).closeOnBlur){let n=t.open&&(0,r.Eg)(this.view,t.open.tooltip);n&&n.dom.contains(e.relatedTarget)||setTimeout(()=>this.view.dispatch({effects:g.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout(()=>this.view.dispatch({effects:m.of(!1)}),20),this.composing=0}}}),K="object"==typeof navigator&&/Win/.test(navigator.platform),_=i.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&&(!K||!e.altKey)||e.metaKey)return!1;let i=n.open.options[n.open.selected],r=n.active.find(e=>e.source==i.source),o=i.completion.commitCharacters||r.result.commitCharacters;return o&&o.indexOf(e.key)>-1&&F(t,i),!1}})),U=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",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".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"}}}),$={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Y=i.Pe.define({map:(e,t)=>t.mapPos(e,-1,i.iR.TrackAfter)??void 0}),G=new class extends i.FB{};G.startSide=1,G.endSide=-1;const X=i.sU.define({create:()=>i.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(Y)&&(e=e.update({add:[G.range(n.value,n.value+1)]}));return e}});function J(){return[ne,X]}const Z="()[]{}<>«»»«[]{}";function Q(e){for(let t=0;t<16;t+=2)if(Z.charCodeAt(t)==e)return Z.charAt(t+1);return(0,i.MK)(e<128?e:e+1)}function ee(e,t){return e.languageDataAt("closeBrackets",t)[0]||$}const te="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),ne=r.Lz.inputHandler.of((e,t,n,r)=>{if((te?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let o=e.state.selection.main;if(r.length>2||2==r.length&&1==(0,i.Fh)((0,i.vS)(r,0))||t!=o.from||n!=o.to)return!1;let s=function(e,t){let n=ee(e,e.selection.main.head),r=n.brackets||$.brackets;for(let o of r){let s=Q((0,i.vS)(o,0));if(t==o)return s==o?le(e,o,r.indexOf(o+o+o)>-1,n):se(e,o,s,n.before||$.before);if(t==s&&re(e,e.selection.main.from))return ae(e,0,s)}return null}(e.state,r);return!!s&&(e.dispatch(s),!0)}),ie=[{key:"Backspace",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=ee(e,e.selection.main.head).brackets||$.brackets,r=null,o=e.changeByRange(t=>{if(t.empty){let r=function(e,t){let n=e.sliceString(t-2,t);return(0,i.Fh)((0,i.vS)(n,0))==n.length?n:n.slice(1)}(e.doc,t.head);for(let o of n)if(o==r&&oe(e.doc,t.head)==Q((0,i.vS)(o,0)))return{changes:{from:t.head-o.length,to:t.head+o.length},range:i.OF.cursor(t.head-o.length)}}return{range:r=t}});return r||t(e.update(o,{scrollIntoView:!0,userEvent:"delete.backward"})),!r}}];function re(e,t){let n=!1;return e.field(X).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function oe(e,t){let n=e.sliceString(t,t+2);return n.slice(0,(0,i.Fh)((0,i.vS)(n,0)))}function se(e,t,n,r){let o=null,s=e.changeByRange(s=>{if(!s.empty)return{changes:[{insert:t,from:s.from},{insert:n,from:s.to}],effects:Y.of(s.to+t.length),range:i.OF.range(s.anchor+t.length,s.head+t.length)};let a=oe(e.doc,s.head);return!a||/\s/.test(a)||r.indexOf(a)>-1?{changes:{insert:t+n,from:s.head},effects:Y.of(s.head+t.length),range:i.OF.cursor(s.head+t.length)}:{range:o=s}});return o?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function ae(e,t,n){let r=null,o=e.changeByRange(t=>t.empty&&oe(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:i.OF.cursor(t.head+n.length)}:r={range:t});return r?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function le(e,t,n,r){let s=r.stringPrefixes||$.stringPrefixes,a=null,l=e.changeByRange(r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:t,from:r.to}],effects:Y.of(r.to+t.length),range:i.OF.range(r.anchor+t.length,r.head+t.length)};let l,c=r.head,h=oe(e.doc,c);if(h==t){if(ce(e,c))return{changes:{insert:t+t,from:c},effects:Y.of(c+t.length),range:i.OF.cursor(c+t.length)};if(re(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:i.OF.cursor(c+r.length)}}}else{if(n&&e.sliceDoc(c-2*t.length,c)==t+t&&(l=he(e,c-2*t.length,s))>-1&&ce(e,l))return{changes:{insert:t+t+t+t,from:c},effects:Y.of(c+t.length),range:i.OF.cursor(c+t.length)};if(e.charCategorizer(c)(h)!=i.Je.Word&&he(e,c,s)>-1&&!function(e,t,n,i){let r=(0,o.mv)(e).resolveInner(t,-1),s=i.reduce((e,t)=>Math.max(e,t.length),0);for(let o=0;o<5;o++){let o=e.sliceDoc(r.from,Math.min(r.to,r.from+n.length+s)),a=o.indexOf(n);if(!a||a>-1&&i.indexOf(o.slice(0,a))>-1){let t=r.firstChild;for(;t&&t.from==r.from&&t.to-t.from>n.length+a;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let l=r.to==t&&r.parent;if(!l)break;r=l}return!1}(e,c,t,s))return{changes:{insert:t+t,from:c},effects:Y.of(c+t.length),range:i.OF.cursor(c+t.length)}}return{range:a=r}});return a?null:e.update(l,{scrollIntoView:!0,userEvent:"input.type"})}function ce(e,t){let n=(0,o.mv)(e).resolveInner(t+1);return n.parent&&n.from==t}function he(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=i.Je.Word)return t;for(let o of n){let n=t-o.length;if(e.sliceDoc(n,t)==o&&r(e.sliceDoc(n-1,n))!=i.Je.Word)return n}return-1}function ue(e={}){return[_,N,v.of(e),j,fe,U]}const de=[{key:"Ctrl-Space",run:q},{mac:"Alt-`",run:q},{mac:"Alt-i",run:q},{key:"Escape",run:e=>{let t=e.state.field(N,!1);return!(!t||!t.active.some(e=>0!=e.state)||(e.dispatch({effects:g.of(null)}),0))}},{key:"ArrowDown",run:H(!0)},{key:"ArrowUp",run:H(!1)},{key:"PageDown",run:H(!0,"page")},{key:"PageUp",run:H(!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(v).interactionDelay)&&F(e,t.open.options[t.open.selected])}}],fe=i.Nb.highest(r.w4.computeN([v],e=>e.facet(v).defaultKeymap?[de]:[]));n.d(t,["Bc",0,ie,"OO",0,de])},4658(e,t,n){n.d(t,{b6:()=>v});var i=n(2701),r=n(9747),o=n(6684),s=n(6411);function a(e,t){return({state:n,dispatch:i})=>{if(n.readOnly)return!1;let r=e(t,n);return!!r&&(i(n.update(r)),!0)}}const l=a(f,0),c=a(d,0),h=a((e,t)=>d(e,t,function(e){let t=[];for(let n of e.selection.ranges){let i=e.doc.lineAt(n.from),r=n.to<=i.to?i:e.doc.lineAt(n.to);r.from>i.from&&r.from==n.to&&(r=n.to==i.to+1?i:e.doc.lineAt(n.to-1));let o=t.length-1;o>=0&&t[o].to>i.from?t[o].to=r.to:t.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:r.to})}return t}(t)),0);function u(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}function d(e,t,n=t.selection.ranges){let i=n.map(e=>u(t,e.from).block);if(!i.every(e=>e))return null;let r=n.map((e,n)=>function(e,{open:t,close:n},i,r){let o,s,a=e.sliceDoc(i-50,i),l=e.sliceDoc(r,r+50),c=/\s*$/.exec(a)[0].length,h=/^\s*/.exec(l)[0].length,u=a.length-c;if(a.slice(u-t.length,u)==t&&l.slice(h,h+n.length)==n)return{open:{pos:i-c,margin:c&&1},close:{pos:r+h,margin:h&&1}};r-i<=100?o=s=e.sliceDoc(i,r):(o=e.sliceDoc(i,i+50),s=e.sliceDoc(r-50,r));let d=/^\s*/.exec(o)[0].length,f=/\s*$/.exec(s)[0].length,p=s.length-f-n.length;return o.slice(d,d+t.length)==t&&s.slice(p,p+n.length)==n?{open:{pos:i+d+t.length,margin:/\s/.test(o.charAt(d+t.length))?1:0},close:{pos:r-f-n.length,margin:/\s/.test(s.charAt(p-1))?1:0}}:null}(t,i[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:i[t].open+" "},{from:e.to,insert:" "+i[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=i[n],{open:o,close:s}=t;e.push({from:o.pos-r.open.length,to:o.pos+o.margin},{from:s.pos-s.margin,to:s.pos+r.close.length})}return{changes:e}}return null}function f(e,t,n=t.selection.ranges){let i=[],r=-1;e:for(let{from:e,to:o}of n){let n,s=i.length,a=1e9;for(let s=e;s<=o;){let l=t.doc.lineAt(s);if(null==n&&(n=u(t,l.from).line,!n))continue e;if(l.from>r&&(e==o||o>l.from)){r=l.from;let e=/^\s*/.exec(l.text)[0].length,t=e==l.length,o=l.text.slice(e,e+n.length)==n?e:-1;e<l.text.length&&e<a&&(a=e),i.push({line:l,comment:o,token:n,indent:e,empty:t,single:!1})}s=l.to+1}if(a<1e9)for(let e=s;e<i.length;e++)i[e].indent<i[e].line.text.length&&(i[e].indent=a);i.length==s+1&&(i[s].single=!0)}if(2!=e&&i.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:r,empty:o,single:s}of i)!s&&o||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&&i.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:r}of i)if(n>=0){let i=t.from+n,o=i+r.length;" "==t.text[o-t.from]&&o++,e.push({from:i,to:o})}return{changes:e}}return null}const p=i.YH.define(),m=i.YH.define(),g=i.sj.define(),b=i.sj.define({combine:e=>(0,i.QR)(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,i)=>e(n,i)||t(n,i)})}),y=i.sU.define({create:()=>R.empty,update(e,t){let n=t.state.facet(b),r=t.annotation(p);if(r){let i=A.fromTransaction(t,r.selection),o=r.side,s=0==o?e.undone:e.done;return s=i?M(s,s.length,n.minDepth,i):D(s,t.startState.selection),new R(0==o?r.rest:s,0==o?s:r.rest)}let o=t.annotation(m);if("full"!=o&&"before"!=o||(e=e.isolate()),!1===t.annotation(i.ZX.addToHistory))return t.changes.empty?e:e.addMapping(t.changes.desc);let s=A.fromTransaction(t),a=t.annotation(i.ZX.time),l=t.annotation(i.ZX.userEvent);return s?e=e.addChanges(s,a,l,n,t):t.selection&&(e=e.addSelection(t.startState.selection,a,l,n.newGroupDelay)),"full"!=o&&"after"!=o||(e=e.isolate()),e},toJSON:e=>({done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}),fromJSON:e=>new R(e.done.map(A.fromJSON),e.undone.map(A.fromJSON))});function v(e={}){return[y,b.of(e),r.Lz.domEventHandlers({beforeinput(e,t){let n="historyUndo"==e.inputType?k:"historyRedo"==e.inputType?x:null;return!!n&&(e.preventDefault(),n(t))}})]}function w(e,t){return function({state:n,dispatch:i}){if(!t&&n.readOnly)return!1;let r=n.field(y,!1);if(!r)return!1;let o=r.pop(e,n,t);return!!o&&(i(o),!0)}}const k=w(0,!1),x=w(1,!1),S=w(0,!0),C=w(1,!0);class A{constructor(e,t,n,i,r){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=i,this.selectionsAfter=r}setSelAfter(e){return new A(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 A(e.changes&&i.VR.fromJSON(e.changes),[],e.mapped&&i.Gu.fromJSON(e.mapped),e.startSelection&&i.OF.fromJSON(e.startSelection),e.selectionsAfter.map(i.OF.fromJSON))}static fromTransaction(e,t){let n=O;for(let t of e.startState.facet(g)){let i=t(e);i.length&&(n=n.concat(i))}return!n.length&&e.changes.empty?null:new A(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,O)}static selection(e){return new A(void 0,O,void 0,void 0,e)}}function M(e,t,n,i){let r=t+1>n+20?t-n-1:0,o=e.slice(r,t);return o.push(i),o}function T(e,t){return e.length?t.length?e.concat(t):e:t}const O=[];function D(e,t){if(e.length){let n=e[e.length-1],i=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-200));return i.length&&i[i.length-1].eq(t)?e:(i.push(t),M(e,e.length-1,1e9,n.setSelAfter(i)))}return[A.selection([t])]}function L(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 z(e,t){if(!e.length)return e;let n=e.length,i=O;for(;n;){let r=E(e[n-1],t,i);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--,i=r.selectionsAfter}return i.length?[A.selection(i)]:O}function E(e,t,n){let r=T(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):O,n);if(!e.changes)return A.selection(r);let o=e.changes.map(t),s=t.mapDesc(e.changes,!0),a=e.mapped?e.mapped.composeDesc(s):s;return new A(o,i.Pe.mapEffects(e.effects,t),a,e.startSelection.map(s),r)}const B=/^(input\.type|delete)($|\.)/;class R{constructor(e,t,n=0,i=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=i}isolate(){return this.prevTime?new R(this.done,this.undone):this}addChanges(e,t,n,r,o){let s=this.done,a=s[s.length-1];return s=a&&a.changes&&!a.changes.empty&&e.changes&&(!n||B.test(n))&&(!a.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(o,function(e,t){let n=[],i=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,r,o)=>{for(let e=0;e<n.length;){let t=n[e++],s=n[e++];o>=t&&r<=s&&(i=!0)}}),i}(a.changes,e.changes))||"input.type.compose"==n)?M(s,s.length-1,r.minDepth,new A(e.changes.compose(a.changes),T(i.Pe.mapEffects(e.effects,a.changes),a.effects),a.mapped,a.startSelection,O)):M(s,s.length,r.minDepth,e),new R(s,O,t,n)}addSelection(e,t,n,i){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:O;return r.length>0&&t-this.prevTime<i&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&(o=r[r.length-1],s=e,o.ranges.length==s.ranges.length&&0===o.ranges.filter((e,t)=>e.empty!=s.ranges[t].empty).length)?this:new R(D(this.done,e),this.undone,t,n);var o,s}addMapping(e){return new R(z(this.done,e),z(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let i=0==e?this.done:this.undone;if(0==i.length)return null;let r=i[i.length-1],o=r.selectionsAfter[0]||(r.startSelection?r.startSelection.map(r.changes.invertedDesc,1):t.selection);if(n&&r.selectionsAfter.length)return t.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:p.of({side:e,rest:L(i),selection:o}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){let n=1==i.length?O:i.slice(0,i.length-1);return r.mapped&&(n=z(n,r.mapped)),t.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:p.of({side:e,rest:n,selection:o}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}return null}}R.empty=new R(O,O);const P=[{key:"Mod-z",run:k,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:S,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:C,preventDefault:!0}];function I(e,t){return i.OF.create(e.ranges.map(t),e.mainIndex)}function N(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function F({state:e,dispatch:t},n){let i=I(e.selection,n);return!i.eq(e.selection,!0)&&(t(N(e,i)),!0)}function W(e,t){return i.OF.cursor(t?e.to:e.from)}function H(e,t){return F(e,n=>n.empty?e.moveByChar(n,t):W(n,t))}function q(e){return e.textDirectionAt(e.state.selection.main.head)==r.OP.LTR}const V=e=>H(e,!q(e)),j=e=>H(e,q(e));function K(e,t){return F(e,n=>n.empty?e.moveByGroup(n,t):W(n,t))}function _(e,t,n){if(t.type.prop(n))return!0;let i=t.to-t.from;return i&&(i>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function U(e,t,n){let r,a,l=(0,o.mv)(e).resolveInner(t.head),c=n?s.uY.closedBy:s.uY.openedBy;for(let i=t.head;;){let t=n?l.childAfter(i):l.childBefore(i);if(!t)break;_(e,t,c)?l=t:i=n?t.to:t.from}return a=l.type.prop(c)&&(r=n?(0,o.jU)(e,l.from,1):(0,o.jU)(e,l.to,-1))&&r.matched?n?r.end.to:r.end.from:n?l.to:l.from,i.OF.cursor(a,n?-1:1)}function $(e,t){return F(e,n=>{if(!n.empty)return W(n,t);let i=e.moveVertically(n,t);return i.head!=n.head?i:e.moveToLineBoundary(n,t)})}"undefined"!=typeof Intl&&Intl.Segmenter;const Y=e=>$(e,!1),G=e=>$(e,!0);function X(e){let t,n=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,i=0,o=0;if(n){for(let t of e.state.facet(r.Lz.scrollMargins)){let n=t(e);(null==n?void 0:n.top)&&(i=Math.max(null==n?void 0:n.top,i)),(null==n?void 0:n.bottom)&&(o=Math.max(null==n?void 0:n.bottom,o))}t=e.scrollDOM.clientHeight-i-o}else t=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:i,marginBottom:o,selfScroll:n,height:Math.max(e.defaultLineHeight,t-5)}}function J(e,t){let n,i=X(e),{state:o}=e,s=I(o.selection,n=>n.empty?e.moveVertically(n,t,i.height):W(n,t));if(s.eq(o.selection))return!1;if(i.selfScroll){let t=e.coordsAtPos(o.selection.main.head),a=e.scrollDOM.getBoundingClientRect(),l=a.top+i.marginTop,c=a.bottom-i.marginBottom;t&&t.top>l&&t.bottom<c&&(n=r.Lz.scrollIntoView(s.main.head,{y:"start",yMargin:t.top-l}))}return e.dispatch(N(o,s),{effects:n}),!0}const Z=e=>J(e,!1),Q=e=>J(e,!0);function ee(e,t,n){let r=e.lineBlockAt(t.head),o=e.moveToLineBoundary(t,n);if(o.head==t.head&&o.head!=(n?r.to:r.from)&&(o=e.moveToLineBoundary(t,n,!1)),!n&&o.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(o=i.OF.cursor(r.from+n))}return o}function te(e,t,n){let r=I(e.state.selection,e=>{e.undirectional&&e.head>=e.anchor!=t&&(e=i.OF.range(e.head,e.anchor));let r=n(e);return i.OF.range(e.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return!r.eq(e.state.selection)&&(e.dispatch(N(e.state,r)),!0)}function ne(e,t){return te(e,t,n=>e.moveByChar(n,t))}const ie=e=>ne(e,!q(e)),re=e=>ne(e,q(e));function oe(e,t){return te(e,t,n=>e.moveByGroup(n,t))}function se(e,t){return te(e,t,n=>e.moveVertically(n,t))}const ae=e=>se(e,!1),le=e=>se(e,!0);function ce(e,t){return te(e,t,n=>e.moveVertically(n,t,X(e).height))}const he=e=>ce(e,!1),ue=e=>ce(e,!0),de=({state:e,dispatch:t})=>(t(N(e,{anchor:0})),!0),fe=({state:e,dispatch:t})=>(t(N(e,{anchor:e.doc.length})),!0),pe=({state:e,dispatch:t})=>(t(N(e,{anchor:e.selection.main.anchor,head:0})),!0),me=({state:e,dispatch:t})=>(t(N(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0);function ge(e,t){let{state:n}=e,r=n.selection,o=n.selection.ranges.slice();for(let i of n.selection.ranges){let r=n.doc.lineAt(i.head);if(t?r.to<e.state.doc.length:r.from>0)for(let n=i;;){let i=e.moveVertically(n,t);if(i.head<r.from||i.head>r.to){o.some(e=>e.head==i.head)||o.push(i);break}if(i.head==n.head)break;n=i}}return o.length!=r.ranges.length&&(e.dispatch(N(n,i.OF.create(o,o.length-1))),!0)}function be(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:o}=e,s=o.changeByRange(r=>{let{from:o,to:s}=r;if(o==s){let i=t(r);i<o?(n="delete.backward",i=ye(e,i,!1)):i>o&&(n="delete.forward",i=ye(e,i,!0)),o=Math.min(o,i),s=Math.max(s,i)}else o=ye(e,o,!1),s=ye(e,s,!0);return o==s?{range:r}:{changes:{from:o,to:s},range:i.OF.cursor(o,o<r.head?-1:1)}});return!s.changes.empty&&(e.dispatch(o.update(s,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?r.Lz.announce.of(o.phrase("Selection deleted")):void 0})),!0)}function ye(e,t,n){if(e instanceof r.Lz)for(let i of e.state.facet(r.Lz.atomicRanges).map(t=>t(e)))i.between(t,t,(e,i)=>{e<t&&i>t&&(t=n?i:e)});return t}const ve=(e,t,n)=>be(e,r=>{let s,a,l=r.from,{state:c}=e,h=c.doc.lineAt(l);if(n&&!t&&l>h.from&&l<h.from+200&&!/[^ \t]/.test(s=h.text.slice(0,l-h.from))){if("\t"==s[s.length-1])return l-1;let e=(0,i.y$)(s,c.tabSize)%(0,o.tp)(c)||(0,o.tp)(c);for(let t=0;t<e&&" "==s[s.length-1-t];t++)l--;a=l}else a=(0,i.zK)(h.text,l-h.from,t,t)+h.from,a==l&&h.number!=(t?c.doc.lines:1)?a+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(h.text.slice(a-h.from,l-h.from))&&(a=(0,i.zK)(h.text,a-h.from,!1,!1)+h.from);return a}),we=e=>ve(e,!1,!0),ke=e=>ve(e,!0,!1),xe=(e,t)=>be(e,n=>{let r=n.head,{state:o}=e,s=o.doc.lineAt(r),a=o.charCategorizer(r);for(let e=null;;){if(r==(t?s.to:s.from)){r==n.head&&s.number!=(t?o.doc.lines:1)&&(r+=t?1:-1);break}let l=(0,i.zK)(s.text,r-s.from,t)+s.from,c=s.text.slice(Math.min(r,l)-s.from,Math.max(r,l)-s.from),h=a(c);if(null!=e&&h!=e)break;" "==c&&r==n.head||(e=h),r=l}return r}),Se=e=>xe(e,!1);function Ce(e){let t=[],n=-1;for(let i of e.selection.ranges){let r=e.doc.lineAt(i.from),o=e.doc.lineAt(i.to);if(i.empty||i.to!=o.from||(o=e.doc.lineAt(i.to-1)),n>=r.number){let e=t[t.length-1];e.to=o.to,e.ranges.push(i)}else t.push({from:r.from,to:o.to,ranges:[i]});n=o.number+1}return t}function Ae(e,t,n){if(e.readOnly)return!1;let r=[],o=[];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),a=s.length+1;if(n){r.push({from:t.to,to:s.to},{from:t.from,insert:s.text+e.lineBreak});for(let n of t.ranges)o.push(i.OF.range(Math.min(e.doc.length,n.anchor+a),Math.min(e.doc.length,n.head+a)))}else{r.push({from:s.from,to:t.from},{from:t.to,insert:e.lineBreak+s.text});for(let e of t.ranges)o.push(i.OF.range(e.anchor-a,e.head-a))}}return!!r.length&&(t(e.update({changes:r,scrollIntoView:!0,selection:i.OF.create(o,e.selection.mainIndex),userEvent:"move.line"})),!0)}function Me(e,t,n){if(e.readOnly)return!1;let i=[];for(let t of Ce(e))n?i.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):i.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let r=e.changes(i);return t(e.update({changes:r,selection:e.selection.map(r,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Te=Oe(!1);function Oe(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:a}=n,l=t.doc.lineAt(r),c=!e&&r==a&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n,i=(0,o.mv)(e).resolveInner(t),r=i.childBefore(t),a=i.childAfter(t);return r&&a&&r.to<=t&&a.from>=t&&(n=r.type.prop(s.uY.closedBy))&&n.indexOf(a.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(a.from).from&&!/\S/.test(e.sliceDoc(r.to,a.from))?{from:r.to,to:a.from}:null}(t,r);e&&(r=a=(a<=l.to?l:t.doc.lineAt(a)).to);let h=new o.KB(t,{simulateBreak:r,simulateDoubleBreak:!!c}),u=(0,o._v)(h,r);for(null==u&&(u=(0,i.y$)(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize));a<l.to&&/\s/.test(l.text[a-l.from]);)a++;c?({from:r,to:a}=c):r>l.from&&r<l.from+100&&!/\S/.test(l.text.slice(0,r))&&(r=l.from);let d=["",(0,o.EI)(t,u)];return c&&d.push((0,o.EI)(t,h.lineIndent(l.from,-1))),{changes:{from:r,to:a,insert:i.EY.of(d)},range:i.OF.cursor(r+1+d[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function De(e,t){let n=-1;return e.changeByRange(r=>{let o=[];for(let i=r.from;i<=r.to;){let s=e.doc.lineAt(i);s.number>n&&(r.empty||r.to>s.from)&&(t(s,o,r),n=s.number),i=s.to+1}let s=e.changes(o);return{changes:o,range:i.OF.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const Le=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(De(e,(t,n)=>{n.push({from:t.from,insert:e.facet(o.Xt)})}),{userEvent:"input.indent"})),!0),ze=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(De(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let s=(0,i.y$)(r,e.tabSize),a=0,l=(0,o.EI)(e,Math.max(0,s-(0,o.tp)(e)));for(;a<r.length&&a<l.length&&r.charCodeAt(a)==l.charCodeAt(a);)a++;n.push({from:t.from+a,to:t.from+r.length,insert:l.slice(a)})}),{userEvent:"delete.dedent"})),!0),Ee=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:e=>F(e,t=>U(e.state,t,!q(e))),shift:e=>{let t=!q(e);return te(e,t,n=>U(e.state,n,t))}},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>F(e,t=>U(e.state,t,q(e))),shift:e=>{let t=q(e);return te(e,t,n=>U(e.state,n,t))}},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>Ae(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>Me(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>Ae(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>Me(e,t,!0)},{key:"Mod-Alt-ArrowUp",run:e=>ge(e,!1)},{key:"Mod-Alt-ArrowDown",run:e=>ge(e,!0)},{key:"Escape",run:({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=i.OF.create([n.main]):n.main.empty||(r=i.OF.create([i.OF.cursor(n.main.head)])),!!r&&(t(N(e,r)),!0)}},{key:"Mod-Enter",run:Oe(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let n=Ce(e).map(({from:t,to:n})=>i.OF.range(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:i.OF.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let n=I(e.selection,t=>{let n=(0,o.mv)(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return i.OF.range(n.to,n.from)}return t});return!n.eq(e.selection)&&(t(N(e,n)),!0)},preventDefault:!0},{key:"Mod-[",run:ze},{key:"Mod-]",run:Le},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),i=new o.KB(e,{overrideIndentation:e=>n[e]??-1}),r=De(e,(t,r,s)=>{let a=(0,o._v)(i,t.from);if(null==a)return;/\S/.test(t.text)||(a=0);let l=/^\s*/.exec(t.text)[0],c=(0,o.EI)(e,a);(l!=c||s.from<t.from+l.length)&&(n[t.from]=a,r.push({from:t.from,to:t.from+l.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}))),i=I(t.selection,t=>{let n;if(e.lineWrapping){let i=e.lineBlockAt(t.head),r=e.coordsAtPos(t.head,t.assoc||1);r&&(n=i.bottom+e.documentTop-r.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>function(e,t,n){let r=!1,s=I(e.selection,t=>{let s=(0,o.jU)(e,t.head,-1)||(0,o.jU)(e,t.head,1)||t.head>0&&(0,o.jU)(e,t.head-1,1)||t.head<e.doc.length&&(0,o.jU)(e,t.head+1,-1);if(!s||!s.end)return t;r=!0;let a=s.start.from==t.head?s.end.to:s.end.from;return n?i.OF.range(t.anchor,a):i.OF.cursor(a)});return!!r&&(t(N(e,s)),!0)}(e,t,!1)},{key:"Mod-/",run:e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),i=u(e.state,n.from);return i.line?l(e):!!i.block&&h(e)}},{key:"Alt-A",run:c},{key:"Ctrl-m",mac:"Shift-Alt-m",run:e=>(e.setTabFocusMode(),!0)}].concat([{key:"ArrowLeft",run:V,shift:ie,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>K(e,!q(e)),shift:e=>oe(e,!q(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>F(e,t=>ee(e,t,!q(e))),shift:e=>{let t=!q(e);return te(e,t,n=>ee(e,n,t))},preventDefault:!0},{key:"ArrowRight",run:j,shift:re,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>K(e,q(e)),shift:e=>oe(e,q(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>F(e,t=>ee(e,t,q(e))),shift:e=>{let t=q(e);return te(e,t,n=>ee(e,n,t))},preventDefault:!0},{key:"ArrowUp",run:Y,shift:ae,preventDefault:!0},{mac:"Cmd-ArrowUp",run:de,shift:pe},{mac:"Ctrl-ArrowUp",run:Z,shift:he},{key:"ArrowDown",run:G,shift:le,preventDefault:!0},{mac:"Cmd-ArrowDown",run:fe,shift:me},{mac:"Ctrl-ArrowDown",run:Q,shift:ue},{key:"PageUp",run:Z,shift:he},{key:"PageDown",run:Q,shift:ue},{key:"Home",run:e=>F(e,t=>ee(e,t,!1)),shift:e=>te(e,!1,t=>ee(e,t,!1)),preventDefault:!0},{key:"Mod-Home",run:de,shift:pe},{key:"End",run:e=>F(e,t=>ee(e,t,!0)),shift:e=>te(e,!0,t=>ee(e,t,!0)),preventDefault:!0},{key:"Mod-End",run:fe,shift:me},{key:"Enter",run:Te,shift: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,preventDefault:!0},{key:"Delete",run:ke,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Se,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>xe(e,!0),preventDefault:!0},{mac:"Mod-Backspace",run:e=>be(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),preventDefault:!0},{mac:"Mod-Delete",run:e=>be(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),preventDefault:!0}].concat([{key:"Ctrl-b",run:V,shift:ie,preventDefault:!0},{key:"Ctrl-f",run:j,shift:re},{key:"Ctrl-p",run:Y,shift:ae},{key:"Ctrl-n",run:G,shift:le},{key:"Ctrl-a",run:e=>F(e,t=>i.OF.cursor(e.lineBlockAt(t.head).from,1)),shift:e=>te(e,!1,t=>i.OF.cursor(e.lineBlockAt(t.head).from))},{key:"Ctrl-e",run:e=>F(e,t=>i.OF.cursor(e.lineBlockAt(t.head).to,-1)),shift:e=>te(e,!0,t=>i.OF.cursor(e.lineBlockAt(t.head).to))},{key:"Ctrl-d",run:ke},{key:"Ctrl-h",run:we},{key:"Ctrl-k",run:e=>be(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:Se},{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:i.EY.of(["",""])},range:i.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,r=e.doc.lineAt(n),o=n==r.from?n-1:(0,i.zK)(r.text,n-r.from,!1)+r.from,s=n==r.to?n+1:(0,i.zK)(r.text,n-r.from,!0)+r.from;return{changes:{from:o,to:s,insert:e.doc.slice(n,s).append(e.doc.slice(o,n))},range:i.OF.cursor(s)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:Q}].map(e=>({mac:e.key,run:e.run,shift:e.shift})))),Be={key:"Tab",run:Le,shift:ze};n.d(t,["Yc",0,Be,"cL",0,P,"pw",0,Ee])},697(e,t,n){n.r(t),n.d(t,{css:()=>k});var i=n(4274),r=n(6684),o=n(6411);let s=null;function a(){if(!s&&"object"==typeof document&&document.body){let{style:e}=document.body,t=[],n=new Set;for(let i in e)"cssText"!=i&&"cssFloat"!=i&&"string"==typeof e[i]&&(/[A-Z]/.test(i)&&(i=i.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())),n.has(i)||(t.push(i),n.add(i)));s=t.sort().map(e=>({type:"property",label:e,apply:e+": "}))}return s||[]}const l=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(e=>({type:"class",label:e})),c=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(e=>({type:"keyword",label:e})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(e=>({type:"constant",label:e}))),h=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(e=>({type:"type",label:e})),u=["@charset","@color-profile","@container","@counter-style","@font-face","@font-feature-values","@font-palette-values","@import","@keyframes","@layer","@media","@namespace","@page","@position-try","@property","@scope","@starting-style","@supports","@view-transition"].map(e=>({type:"keyword",label:e})),d=/^(\w[\w-]*|-\w[\w-]*|)$/,f=/^-(-[\w-]*)?$/,p=new o.RY,m=["Declaration"];function g(e){for(let t=e;;){if(t.type.isTop)return t;if(!(t=t.parent))return e}}function b(e,t,n){if(t.to-t.from>4096){let i=p.get(t);if(i)return i;let r=[],s=new Set,a=t.cursor(o.Qj.IncludeAnonymous);if(a.firstChild())do{for(let t of b(e,a.node,n))s.has(t.label)||(s.add(t.label),r.push(t))}while(a.nextSibling());return p.set(t,r),r}{let i=[],r=new Set;return t.cursor().iterate(t=>{var o;if(n(t)&&t.matchContext(m)&&":"==(null===(o=t.node.nextSibling)||void 0===o?void 0:o.name)){let n=e.sliceString(t.from,t.to);r.has(n)||(r.add(n),i.push({label:n,type:"variable"}))}}),i}}const y=e=>t=>{let{state:n,pos:i}=t,o=(0,r.mv)(n).resolveInner(i,-1),s=o.type.isError&&o.from==o.to-1&&"-"==n.doc.sliceString(o.from,o.to);if("PropertyName"==o.name||(s||"TagName"==o.name)&&/^(Block|Styles)$/.test(o.resolve(o.to).name))return{from:o.from,options:a(),validFor:d};if("ValueName"==o.name)return{from:o.from,options:c,validFor:d};if("PseudoClassName"==o.name)return{from:o.from,options:l,validFor:d};if(e(o)||(t.explicit||s)&&function(e,t){var n;if(("("==e.name||e.type.isError)&&(e=e.parent||e),"ArgList"!=e.name)return!1;let i=null===(n=e.parent)||void 0===n?void 0:n.firstChild;return"Callee"==(null==i?void 0:i.name)&&"var"==t.sliceString(i.from,i.to)}(o,n.doc))return{from:e(o)||s?o.from:i,options:b(n.doc,g(o),e),validFor:f};if("TagName"==o.name){for(let{parent:e}=o;e;e=e.parent)if("Block"==e.name)return{from:o.from,options:a(),validFor:d};return{from:o.from,options:h,validFor:d}}if("AtKeyword"==o.name)return{from:o.from,options:u,validFor:d};if(!t.explicit)return null;let p=o.resolve(i),m=p.childBefore(i);return m&&":"==m.name&&"PseudoClassSelector"==p.name?{from:i,options:l,validFor:d}:m&&":"==m.name&&"Declaration"==p.name||"ArgList"==p.name?{from:i,options:c,validFor:d}:"Block"==p.name||"Styles"==p.name?{from:i,options:a(),validFor:d}:null},v=y(e=>"VariableName"==e.name),w=r.bj.define({name:"css",parser:i.K.configure({props:[r.Oh.add({Declaration:(0,r.mz)()}),r.b_.add({"Block KeyframeList":r.yd})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function k(){return new r.Yy(w,w.data.of({autocomplete:v}))}n.d(t,["cssCompletionSource",0,v,"cssLanguage",0,w,"defineCSSCompletionSource",0,y])},6684(e,t,n){n.d(t,{EI:()=>O,KB:()=>L,Lv:()=>ce,SG:()=>Te,WD:()=>F,Yy:()=>C,_v:()=>D,bj:()=>f,cr:()=>ue,jU:()=>ze,mv:()=>p,mz:()=>N,tp:()=>T,y9:()=>me,yd:()=>q});var i,r=n(6411),o=n(2701),s=n(9747),a=n(1318),l=n(2951);const c=new r.uY;const h=new r.uY;class u{constructor(e,t,n=[],i=""){this.data=e,this.name=i,o.$t.prototype.hasOwnProperty("tree")||Object.defineProperty(o.$t.prototype,"tree",{get(){return p(this)}}),this.parser=t,this.extension=[S.of(this),o.$t.languageData.of((e,t,n)=>{let i=d(e,t,n),r=i.type.prop(c);if(!r)return[];let o=e.facet(r),s=i.type.prop(h);if(s){let r=i.resolve(t-i.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(o)}}return o})].concat(n)}isActiveAt(e,t,n=-1){return d(e,t,n).type.prop(c)==this.data}findRegions(e){let t=e.facet(S);if((null==t?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],i=(e,t)=>{if(e.prop(c)==this.data)return void n.push({from:t,to:t+e.length});let o=e.prop(r.uY.mounted);if(o){if(o.tree.prop(c)==this.data){if(o.overlay)for(let e of o.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(o.overlay){let e=n.length;if(i(o.tree,o.overlay[0].from+t),n.length>e)return}}for(let n=0;n<e.children.length;n++){let o=e.children[n];o instanceof r.PH&&i(o,e.positions[n]+t)}};return i(p(e),0),n}get allowsNesting(){return!0}}function d(e,t,n){let i=e.facet(S),o=p(e).topNode;if(!i||i.allowsNesting)for(let e=o;e;e=e.enter(t,n,r.Qj.ExcludeBuffers|r.Qj.EnterBracketed))e.type.isTop&&(o=e);return o}u.setState=o.Pe.define();class f extends u{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=(n=e.languageData,o.sj.define({combine:n?e=>e.concat(n):void 0}));var n;return new f(t,e.parser.configure({props:[c.add(e=>e.isTop?t:void 0)]}),e.name)}configure(e,t){return new f(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function p(e){let t=e.field(u.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 b{constructor(e,t,n=[],i,r,o,s,a){this.parser=e,this.state=t,this.fragments=n,this.tree=i,this.treeLen=r,this.viewport=o,this.skipped=s,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new b(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 i=this.parse.advance();if(i){if(this.fragments=this.withoutTempSkipped(r.rr.addTree(i,this.fragments,null!=this.parse.stoppedAt)),this.treeLen=null!==(n=this.parse.stoppedAt)&&void 0!==n?n:this.state.doc.length,this.tree=i,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:i,treeLen:o,viewport:s,skipped:a}=this;if(this.takeTree(),!e.empty){let t=[];if(e.iterChangedRanges((e,n,i,r)=>t.push({fromA:e,toA:n,fromB:i,toB:r})),n=r.rr.applyChanges(n,t),i=r.PH.empty,o=0,s={from:e.mapPos(s.from,-1),to:e.mapPos(s.to,1)},this.skipped.length){a=[];for(let t of this.skipped){let n=e.mapPos(t.from,1),i=e.mapPos(t.to,-1);n<i&&a.push({from:n,to:i})}}}return new b(this.parser,t,n,i,o,s,a,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:i}=this.skipped[t];n<e.to&&i>e.from&&(this.fragments=y(this.fragments,n,i),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,i){let o=i[0].from,s=i[i.length-1].to;return{parsedPos:o,advance(){let t=g;if(t){for(let e of i)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-o)},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 v{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 v(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=b.create(e.facet(S).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new v(n)}}u.state=o.sU.define({create:v.init,update(e,t){for(let e of t.effects)if(e.is(u.setState))return e.value;return t.startState.facet(S)!=t.state.facet(S)?v.init(t.state):e.apply(t)}});let w=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};"undefined"!=typeof requestIdleCallback&&(w=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const k="undefined"!=typeof navigator&&(null===(i=navigator.scheduling)||void 0===i?void 0:i.isInputPending)?()=>navigator.scheduling.isInputPending():null,x=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(u.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(u.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=w(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:i}}=this.view,r=n.field(u.state);if(r.tree==r.context.tree&&r.context.isDone(i+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!k?Math.max(25,e.timeRemaining()-5):1e9),s=r.context.treeLen<i&&n.doc.length>i+1e3,a=r.context.work(()=>k&&k()||Date.now()>o,i+(s?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:u.setState.of(new v(r.context))})),this.chunkBudget>0&&(!a||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()}}}),S=o.sj.define({combine:e=>e.length?e[0]:null,enables:e=>[u.state,x,s.Lz.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]});class C{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const A=o.sj.define(),M=o.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 T(e){let t=e.facet(M);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function O(e,t){let n="",i=e.tabSize,r=e.facet(M)[0];if("\t"==r){for(;t>=i;)n+="\t",t-=i;r=" "}for(let e=0;e<t;e++)n+=r;return n}function D(e,t){e instanceof o.$t&&(e=new L(e));for(let n of e.state.facet(A)){let i=n(e,t);if(void 0!==i)return i}let n=p(e.state);return n.length>=t?function(e,t,n){let i=t.resolveStack(n),r=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(r!=i.node){let e=[];for(let t=r;t&&!(t.from<i.node.from||t.to>i.node.to||t.from==i.node.from&&t.type==i.node.type);t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)i={node:e[t],next:i}}return E(i,e,n)}(e,n,t):null}class L{constructor(e,t={}){this.state=e,this.options=t,this.unit=T(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:r}=this.options;return null!=i&&i>=n.from&&i<=n.to?r&&i==e?{text:"",from:e}:(t<0?i<e:i<=e)?{text:n.text.slice(i-n.from),from:i}:{text:n.text.slice(0,i-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:i}=this.lineAt(e,t);return n.slice(e-i,Math.min(n.length,e+100-i))}column(e,t=1){let{text:n,from:i}=this.lineAt(e,t),r=this.countColumn(n,e-i),o=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return o>-1&&(r+=o-this.countColumn(n,n.search(/\S|$/))),r}countColumn(e,t=e.length){return(0,o.y$)(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:i}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let e=r(i);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const z=new r.uY;function E(e,t,n){for(let i=e;i;i=i.next){let e=B(i.node);if(e)return e(P.create(t,n,i))}return 0}function B(e){let t=e.type.prop(z);if(t)return t;let n,i=e.firstChild;if(i&&(n=i.type.prop(r.uY.closedBy))){let t=e.lastChild,i=t&&n.indexOf(t.name)>-1;return e=>function(e,t,n,i,r){let o=e.textAfter,s=o.match(/^\s*/)[0].length,a=i&&o.slice(s,s+i.length)==i||r==e.pos+s,l=t?function(e){let t=e.node,n=t.childAfter(t.from),i=t.lastChild;if(!n)return null;let r=e.options.simulateBreak,o=e.state.doc.lineAt(n.from),s=null==r||r<=o.from?o.to:Math.min(o.to,r);for(let e=n.to;;){let r=t.childAfter(e);if(!r||r==i)return null;if(!r.type.isSkipped){if(r.from>=s)return null;let e=/^ */.exec(o.text.slice(n.to-o.from))[0].length;return{from:n.from,to:n.to+e}}e=r.to}}(e):null;return l?a?e.column(l.from):e.column(l.to):e.baseIndent+(a?0:e.unit*n)}(e,!0,1,void 0,i&&!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 P extends L{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 P(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(I(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return E(this.context.next,this.base,this.pos)}}function I(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 i=e&&e.test(n.textAfter);return n.baseIndent+(i?0:t*n.unit)}}function F(){return o.$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:i}=e.newSelection.main,r=n.lineAt(i);if(i>r.from+200)return e;let o=n.sliceString(r.from,i);if(!t.some(e=>e.test(o)))return e;let{state:s}=e,a=-1,l=[];for(let{head:e}of s.selection.ranges){let t=s.doc.lineAt(e);if(t.from==a)continue;a=t.from;let n=D(s,t.from);if(null==n)continue;let i=/^\s*/.exec(t.text)[0],r=O(s,n);i!=r&&l.push({from:t.from,to:t.from+i.length,insert:r})}return l.length?[e,{changes:l,sequential:!0}]:e})}const W=o.sj.define(),H=new r.uY;function q(e){let t=e.firstChild,n=e.lastChild;return t&&t.to<n.from?{from:t.to,to:n.type.isError?e.to:n.from}:null}function V(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function j(e,t,n){for(let i of e.facet(W)){let r=i(e,t,n);if(r)return r}return function(e,t,n){let i=p(e);if(i.length<n)return null;let r=null;for(let o=i.resolveStack(n,1);o;o=o.next){let s=o.node;if(s.to<=n||s.from>n)continue;if(r&&s.from<t)break;let a=s.type.prop(H);if(a&&(s.to<i.length-50||i.length==e.doc.length||!V(s))){let i=a(s,e);i&&i.from<=n&&i.from>=t&&i.to>n&&(r=i)}}return r}(e,t,n)}function K(e,t){let n=t.mapPos(e.from,1),i=t.mapPos(e.to,-1);return n>=i?void 0:{from:n,to:i}}const _=o.Pe.define({map:K}),U=o.Pe.define({map:K});function $(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 Y=o.sU.define({create:()=>s.NZ.none,update(e,t){t.isUserEvent("delete")&&t.changes.iterChangedRanges((t,n)=>e=G(e,t,n)),e=e.map(t.changes);let n=[];for(let i of t.effects)i.is(_)&&!J(e,i.value.from,i.value.to)?n.push(i.value):i.is(U)&&(e=e.update({filter:(e,t)=>i.value.from!=e||i.value.to!=t,filterFrom:i.value.from,filterTo:i.value.to}));if(n.length){let{preparePlaceholder:i}=t.state.facet(ne),r=n.map(e=>(i?s.NZ.replace({widget:new se(i(t.state,e))}):oe).range(e.from,e.to));e=e.update({add:r})}return t.selection&&(e=G(e,t.selection.main.head)),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 i=e[n++],r=e[n++];if("number"!=typeof i||"number"!=typeof r)throw new RangeError("Invalid JSON for fold state");t.push(oe.range(i,r))}return s.NZ.set(t,!0)}});function G(e,t,n=t){let i=!1;return e.between(t,n,(e,r)=>{e<n&&r>t&&(i=!0)}),i?e.update({filterFrom:t,filterTo:n,filter:(e,i)=>e>=n||i<=t}):e}function X(e,t,n){var i;let r=null;return null===(i=e.field(Y,!1))||void 0===i||i.between(t,n,(e,t)=>{(!r||r.from>e)&&(r={from:e,to:t})}),r}function J(e,t,n){let i=!1;return e.between(t,t,(e,r)=>{e==t&&r==n&&(i=!0)}),i}function Z(e,t){return e.field(Y,!1)?t:t.concat(o.Pe.appendConfig.of(ie()))}function Q(e,t,n=!0){let i=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")} ${i} ${e.state.phrase("to")} ${r}.`)}const ee=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:e=>{for(let t of $(e)){let n=j(e.state,t.from,t.to);if(n)return e.dispatch({effects:Z(e.state,[_.of(n),Q(e,n)])}),!0}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:e=>{if(!e.state.field(Y,!1))return!1;let t=[];for(let n of $(e)){let i=X(e.state,n.from,n.to);i&&t.push(U.of(i),Q(e,i,!1))}return t.length&&e.dispatch({effects:t}),t.length>0}},{key:"Ctrl-Alt-[",run:e=>{let{state:t}=e,n=[];for(let i=0;i<t.doc.length;){let r=e.lineBlockAt(i),o=j(t,r.from,r.to);o&&n.push(_.of(o)),i=(o?e.lineBlockAt(o.to):r).to+1}return n.length&&e.dispatch({effects:Z(e.state,n)}),!!n.length}},{key:"Ctrl-Alt-]",run:e=>{let t=e.state.field(Y,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(e,t)=>{n.push(U.of({from:e,to:t}))}),e.dispatch({effects:n}),!0}}],te={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},ne=o.sj.define({combine:e=>(0,o.QR)(e,te)});function ie(e){let t=[Y,he];return e&&t.push(ne.of(e)),t}function re(e,t){let{state:n}=e,i=n.facet(ne),r=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),i=X(e.state,n.from,n.to);i&&e.dispatch({effects:U.of(i)}),t.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(e,r,t);let o=document.createElement("span");return o.textContent=i.placeholderText,o.setAttribute("aria-label",n.phrase("folded code")),o.title=n.phrase("unfold"),o.className="cm-foldPlaceholder",o.onclick=r,o}const oe=s.NZ.replace({widget:new class extends s.xO{toDOM(e){return re(e,null)}}});class se extends s.xO{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return re(e,this.value)}}const ae={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 ce(e={}){let t={...ae,...e},n=new le(t,!0),i=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(S)!=e.state.facet(S)||e.startState.field(Y,!1)!=e.state.field(Y,!1)||p(e.startState)!=p(e.state)||t.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let t=new o.vB;for(let r of e.viewportLineBlocks){let o=X(e.state,r.from,r.to)?i:j(e.state,r.from,r.to)?n:null;o&&t.add(r.from,r.from,o)}return t.finish()}}),{domEventHandlers:a}=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)||o.om.empty},initialSpacer:()=>new le(t,!1),domEventHandlers:{...a,click:(e,t,n)=>{if(a.click&&a.click(e,t,n))return!0;let i=X(e.state,t.from,t.to);if(i)return e.dispatch({effects:U.of(i)}),!0;let r=j(e.state,t.from,t.to);return!!r&&(e.dispatch({effects:_.of(r)}),!0)}}}),ie()]}const he=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 i(e){let t=l.G.newName();return(n||(n=Object.create(null)))["."+t]=e,t}this.specs=e;const r="string"==typeof t.all?t.all:t.all?i(t.all):void 0,o=t.scope;this.scope=o instanceof u?e=>e.prop(c)==o.data:o?e=>e==o:void 0,this.style=(0,a.az)(e.map(e=>({tag:e.tag,class:e.class||i(Object.assign({},e,{tag:null}))})),{all:r}).style,this.module=n?new l.G(n):null,this.themeType=t.themeType}static define(e,t){return new ue(e,t||{})}}const de=o.sj.define(),fe=o.sj.define({combine:e=>e.length?[e[0]]:null});function pe(e){let t=e.facet(de);return t.length?t:e.facet(fe)}function me(e,t){let n,i=[be];return e instanceof ue&&(e.module&&i.push(s.Lz.styleModule.of(e.module)),n=e.themeType),(null==t?void 0:t.fallback)?i.push(fe.of(e)):n?i.push(de.computeN([s.Lz.darkTheme],t=>t.facet(s.Lz.darkTheme)==("dark"==n)?[e]:[])):i.push(de.of(e)),i}class ge{constructor(e){this.markCache=Object.create(null),this.tree=p(e.state),this.decorations=this.buildDeco(e,pe(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=p(e.state),n=pe(e.state),i=n!=pe(e.startState),{viewport:r}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<r.to&&!i&&t.type==this.tree.type&&o>=r.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||i)&&(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 o.vB;for(let{from:i,to:r}of e.visibleRanges)(0,a.DM)(this.tree,t,(e,t,i)=>{n.add(e,t,this.markCache[i]||(this.markCache[i]=s.NZ.mark({class:i})))},i,r);return n.finish()}}const be=o.Nb.high(s.Z9.fromClass(ge,{decorations:e=>e.decorations})),ye=ue.define([{tag:a._A.meta,color:"#404740"},{tag:a._A.link,textDecoration:"underline"},{tag:a._A.heading,textDecoration:"underline",fontWeight:"bold"},{tag:a._A.emphasis,fontStyle:"italic"},{tag:a._A.strong,fontWeight:"bold"},{tag:a._A.strikethrough,textDecoration:"line-through"},{tag:a._A.keyword,color:"#708"},{tag:[a._A.atom,a._A.bool,a._A.url,a._A.contentSeparator,a._A.labelName],color:"#219"},{tag:[a._A.literal,a._A.inserted],color:"#164"},{tag:[a._A.string,a._A.deleted],color:"#a11"},{tag:[a._A.regexp,a._A.escape,a._A.special(a._A.string)],color:"#e40"},{tag:a._A.definition(a._A.variableName),color:"#00f"},{tag:a._A.local(a._A.variableName),color:"#30a"},{tag:[a._A.typeName,a._A.namespace],color:"#085"},{tag:a._A.className,color:"#167"},{tag:[a._A.special(a._A.variableName),a._A.macroName],color:"#256"},{tag:a._A.definition(a._A.propertyName),color:"#00c"},{tag:a._A.comment,color:"#940"},{tag:a._A.invalid,color:"#f00"}]),ve=s.Lz.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),we="()[]{}",ke=o.sj.define({combine:e=>(0,o.QR)(e,{afterCursor:!0,brackets:we,maxScanDistance:1e4,renderMatch:Ce})}),xe=s.NZ.mark({class:"cm-matchingBracket"}),Se=s.NZ.mark({class:"cm-nonmatchingBracket"});function Ce(e){let t=[],n=e.matched?xe:Se;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}function Ae(e){let t=[],n=e.facet(ke);for(let i of e.selection.ranges){if(!i.empty)continue;let r=ze(e,i.head,-1,n)||i.head>0&&ze(e,i.head-1,1,n)||n.afterCursor&&(ze(e,i.head,1,n)||i.head<e.doc.length&&ze(e,i.head+1,-1,n));r&&(t=t.concat(n.renderMatch(r,e)))}return s.NZ.set(t,!0)}const Me=[s.Z9.fromClass(class{constructor(e){this.paused=!1,this.decorations=Ae(e.state)}update(e){(e.docChanged||e.selectionSet||this.paused)&&(e.view.composing?(this.decorations=this.decorations.map(e.changes),this.paused=!0):(this.decorations=Ae(e.state),this.paused=!1))}},{decorations:e=>e.decorations}),ve];function Te(e={}){return[ke.of(e),Me]}const Oe=new r.uY;function De(e,t,n){let i=e.prop(t<0?r.uY.openedBy:r.uY.closedBy);if(i)return i;if(1==e.name.length){let i=n.indexOf(e.name);if(i>-1&&i%2==(t<0?1:0))return[n[i+t]]}return null}function Le(e){let t=e.type.prop(Oe);return t?t(e.node):e}function ze(e,t,n,i={}){let r=i.maxScanDistance||1e4,o=i.brackets||we,s=p(e),a=s.resolveInner(t,n);for(let e=a;e;e=e.parent){let i=De(e.type,n,o);if(i&&e.from<e.to){let r=Le(e);if(r&&(n>0?t>=r.from&&t<r.to:t>r.from&&t<=r.to))return Ee(0,0,n,e,r,i,o)}}return function(e,t,n,i,r,o,s){if(n<0?!t:t==e.doc.length)return null;let a=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),l=s.indexOf(a);if(l<0||l%2==0!=n>0)return null;let c={from:n<0?t-1:t,to:n>0?t+1:t},h=e.doc.iterRange(t,n>0?e.doc.length:0),u=0;for(let e=0;!h.next().done&&e<=o;){let o=h.value;n<0&&(e+=o.length);let a=t+e*n;for(let e=n>0?0:o.length-1,t=n>0?o.length:-1;e!=t;e+=n){let t=s.indexOf(o[e]);if(!(t<0||i.resolveInner(a+e,1).type!=r))if(t%2==0==n>0)u++;else{if(1==u)return{start:c,end:{from:a+e,to:a+e+1},matched:t>>1==l>>1};u--}}n>0&&(e+=o.length)}return h.done?{start:c,matched:!1}:null}(e,t,n,s,a.type,r,o)}function Ee(e,t,n,i,r,o,s){let a=i.parent,l={from:r.from,to:r.to},c=0,h=null==a?void 0:a.cursor();if(h&&(n<0?h.childBefore(i.from):h.childAfter(i.to)))do{if(n<0?h.to<=i.from:h.from>=i.to){if(0==c&&o.indexOf(h.type.name)>-1&&h.from<h.to){let e=Le(h);return{start:l,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}if(De(h.type,n,s))c++;else if(De(h.type,-n,s)){if(0==c){let e=Le(h);return{start:l,end:e&&e.from<e.to?{from:e.from,to:e.to}:void 0,matched:!1}}c--}}}while(n<0?h.prevSibling():h.nextSibling());return{start:l,matched:!1}}const Be=Object.create(null),Re=[r.Z6.none],Pe=[],Ie=Object.create(null),Ne=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"]])Ne[e]=We(Be,t);function Fe(e,t){Pe.indexOf(e)>-1||(Pe.push(e),console.warn(t))}function We(e,t){let n=[];for(let i of t.split(" ")){let t=[];for(let n of i.split(".")){let i=e[n]||a._A[n];i?"function"==typeof i?t.length?t=t.map(i):Fe(n,`Modifier ${n} used at start of tag`):t.length?Fe(n,`Tag ${n} used as modifier`):t=Array.isArray(i)?i:[i]:Fe(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let i=t.replace(/ /g,"_"),o=i+" "+n.map(e=>e.id),s=Ie[o];if(s)return s.id;let l=Ie[o]=r.Z6.define({id:Re.length,name:i,props:[(0,a.pn)({[i]:n})]});return Re.push(l),l.id}s.OP.RTL,s.OP.LTR,n.d(t,["Oh",0,z,"Xt",0,M,"Zt",0,ye,"b_",0,H,"f7",0,ee])},6949(e,t,n){n.r(t),n.d(t,{diagnosticCount:()=>g,forEachDiagnostic:()=>X,forceLinting:()=>O,lintGutter:()=>G,linter:()=>T,setDiagnostics:()=>u});var i=n(9747),r=n(2701),o=n(9786);class s{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class a{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let o=n.facet(A).markerFilter;o&&(e=o(e,n));let s=e.slice().sort((e,t)=>e.from-t.from||e.to-t.to),c=new r.vB,h=[],u=0,d=n.doc.iter(),f=0,p=n.doc.length;for(let e=0;;){let t,n,r=e==s.length?null:s[e];if(!r&&!h.length)break;if(h.length)t=u,n=h.reduce((e,t)=>Math.min(e,t.to),r&&r.from>t?r.from:1e8);else{if(t=r.from,t>p)break;n=r.to,h.push(r),e++}for(;e<s.length;){let i=s[e];if(i.from!=t||!(i.to>i.from||i.to==t)){n=Math.min(i.from,n);break}h.push(i),e++,n=Math.min(i.to,n)}n=Math.min(n,p);let o=!1;if(h.some(e=>e.from==t&&(e.to==n||n==p))&&(o=t==n,!o&&n-t<10)){let e=t-(f+d.value.length);e>0&&(d.next(e),f=t);for(let e=t;;){if(e>=n){o=!0;break}if(!d.lineBreak&&f+d.value.length>e)break;e=f+d.value.length,f+=d.value.length,d.next()}}let a=F(h);if(o)c.add(t,t,i.NZ.widget({widget:new z(a),diagnostics:h.slice()}));else{let e=h.reduce((e,t)=>t.markClass?e+" "+t.markClass:e,"");c.add(t,n,i.NZ.mark({class:"cm-lintRange cm-lintRange-"+a+e,diagnostics:h.slice(),inclusiveEnd:h.some(e=>e.to>n)}))}if(u=n,u==p)break;for(let e=0;e<h.length;e++)h[e].to<=u&&h.splice(e--,1)}let m=c.finish();return new a(m,t,l(m))}}function l(e,t=null,n=0){let i=null;return e.between(n,1e9,(e,n,{spec:r})=>{if(!(t&&r.diagnostics.indexOf(t)<0))if(i){if(r.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new s(i.from,n,i.diagnostic)}else i=new s(e,n,t||r.diagnostics[0])}),i}function c(e,t){let n=t.pos,i=t.end||n,r=e.state.facet(A).hideOn(e,n,i);if(null!=r)return r;let o=e.startState.doc.lineAt(t.pos);return!(!e.effects.some(e=>e.is(d))&&!e.changes.touchesRange(o.from,Math.max(o.to,i)))}function h(e,t){return e.field(m,!1)?t:t.concat(r.Pe.appendConfig.of($))}function u(e,t){return{effects:h(e,[d.of(t)])}}const d=r.Pe.define(),f=r.Pe.define(),p=r.Pe.define(),m=r.sU.define({create:()=>new a(i.NZ.none,null,null),update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),i=null,r=e.panel;if(e.selected){let r=t.changes.mapPos(e.selected.from,1);i=l(n,e.selected.diagnostic,r)||l(n,null,r)}!n.size&&r&&t.state.facet(A).autoPanel&&(r=null),e=new a(n,r,i)}for(let n of t.effects)if(n.is(d)){let i=t.state.facet(A).autoPanel?n.value.length?B.open:null:e.panel;e=a.init(n.value,i,t.state)}else n.is(f)?e=new a(e.diagnostics,n.value?B.open:null,e.selected):n.is(p)&&(e=new a(e.diagnostics,e.panel,n.value));return e},provide:e=>[i.S7.from(e,e=>e.panel),i.Lz.decorations.from(e,e=>e.diagnostics)]});function g(e){let t=e.field(m,!1);return t?t.diagnostics.size:0}const b=i.NZ.mark({class:"cm-lintRange cm-lintRange-active"});function y(e,t,n){let i,{diagnostics:r}=e.state.field(m),o=-1,s=-1;r.between(t-(n<0?1:0),t+(n>0?1:0),(e,r,{spec:a})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=a.diagnostics,o=e,s=r,!1});let a=e.state.facet(A).tooltipFilter;return i&&a&&(i=a(i,e.state)),i?{pos:o,end:s,above:!0,create:()=>({dom:v(e,i)})}:null}function v(e,t){return(0,o.A)("ul",{class:"cm-tooltip-lint"},t.map(t=>L(e,t,!1)))}const w=e=>{let t=e.state.field(m,!1);t&&t.panel||e.dispatch({effects:h(e.state,[f.of(!0)])});let n=(0,i.ld)(e,B.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},k=e=>{let t=e.state.field(m,!1);return!(!t||!t.panel||(e.dispatch({effects:f.of(!1)}),0))},x=e=>{let t=e.state.field(m,!1);if(!t)return!1;let n=e.state.selection.main,r=l(t.diagnostics,null,n.to+1);return!(!r&&(r=l(t.diagnostics,null,0),!r||r.from==n.from&&r.to==n.to)||(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),(0,i.ab)(e,r.from,1,{tooltip:U,until:e=>e.docChanged||e.newSelection.main.head<r.from||e.newSelection.main.head>r.to}),0))},S=[{key:"Mod-Shift-m",run:w,preventDefault:!0},{key:"F8",run:x}],C=i.Z9.fromClass(class{constructor(e){this.view=e,this.timeout=-1,this.set=!0;let{delay:t}=e.state.facet(A);this.lintTime=Date.now()+t,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,t)}run(){clearTimeout(this.timeout);let e=Date.now();if(e<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-e);else{this.set=!1;let{state:e}=this.view,{sources:t}=e.facet(A);t.length&&function(e,t,n){let i=[],r=-1;for(let o of e)o.then(n=>{i.push(n),clearTimeout(r),i.length==e.length?t(i):r=setTimeout(()=>t(i),200)},n)}(t.map(e=>Promise.resolve(e(this.view))),t=>{this.view.state.doc==e.doc&&this.view.dispatch(u(this.view.state,t.reduce((e,t)=>e.concat(t))))},e=>{(0,i.c_)(this.view.state,e)})}}update(e){let t=e.state.facet(A);(e.docChanged||t!=e.startState.facet(A)||t.needsRefresh&&t.needsRefresh(e))&&(this.lintTime=Date.now()+t.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,t.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}}),A=r.sj.define({combine:e=>({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},{delay:Math.max,markerFilter:M,tooltipFilter:M,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,i,r)=>e(n,i,r)||t(n,i,r):e:t,autoPanel:(e,t)=>e||t})})});function M(e,t){return e?t?(n,i)=>t(e(n,i),i):e:t}function T(e,t={}){return[A.of({source:e,config:t}),C,$]}function O(e){let t=e.plugin(C);t&&t.force()}function D(e){let t=[];if(e)e:for(let{name:n}of e){for(let e=0;e<n.length;e++){let i=n[e];if(/[a-zA-Z]/.test(i)&&!t.some(e=>e.toLowerCase()==i.toLowerCase())){t.push(i);continue e}}t.push("")}return t}function L(e,t,n){var i;let r=n?D(t.actions):[];return(0,o.A)("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},(0,o.A)("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),null===(i=t.actions)||void 0===i?void 0:i.map((n,i)=>{let s=!1,a=i=>{if(i.preventDefault(),s)return;s=!0;let r=l(e.state.field(m).diagnostics,t);r&&n.apply(e,r.from,r.to)},{name:c}=n,h=r[i]?c.indexOf(r[i]):-1,u=h<0?c:[c.slice(0,h),(0,o.A)("u",c.slice(h,h+1)),c.slice(h+1)],d=n.markClass?" "+n.markClass:"";return(0,o.A)("button",{type:"button",class:"cm-diagnosticAction"+d,onclick:a,onmousedown:a,"aria-label":` Action: ${c}${h<0?"":` (access key "${r[i]})"`}.`},u)}),t.source&&(0,o.A)("div",{class:"cm-diagnosticSource"},t.source))}class z extends i.xO{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return(0,o.A)("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class E{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=L(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class B{constructor(e){this.view=e,this.items=[],this.list=(0,o.A)("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t=>{if(!(t.ctrlKey||t.altKey||t.metaKey)){if(27==t.keyCode)k(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],i=D(n.actions);for(let r=0;r<i.length;r++)if(i[r].toUpperCase().charCodeAt(0)==t.keyCode){let t=l(this.view.state.field(m).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,o.A)("div",{class:"cm-panel-lint"},this.list,(0,o.A)("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>k(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(m).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(m),n=0,i=!1,r=null,o=new Set;for(e.between(0,this.view.state.doc.length,(e,s,{spec:a})=>{for(let e of a.diagnostics){if(o.has(e))continue;o.add(e);let s,a=-1;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){a=t;break}a<0?(s=new E(this.view,e),this.items.splice(n,0,s),i=!0):(s=this.items[a],a>n&&(this.items.splice(n,a-n),i=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute("aria-selected")||(s.dom.setAttribute("aria-selected","true"),r=s):s.dom.hasAttribute("aria-selected")&&s.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)i=!0,this.items.pop();0==this.items.length&&(this.items.push(new E(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!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"),i&&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=l(this.view.state.field(m).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:p.of(t)})}static open(e){return new B(e)}}function R(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function P(e){return R(`<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 I=i.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:P("#f11")},".cm-lintRange-warning":{backgroundImage:P("orange")},".cm-lintRange-info":{backgroundImage:P("#999")},".cm-lintRange-hint":{backgroundImage:P("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function N(e){return"error"==e?4:"warning"==e?3:"info"==e?2:1}function F(e){let t="hint",n=1;for(let i of e){let e=N(i.severity);e>n&&(n=e,t=i.severity)}return t}class W extends i.wJ{constructor(e){super(),this.diagnostics=e,this.severity=F(e)}toDOM(e){let t=document.createElement("div");t.className="cm-lint-marker cm-lint-marker-"+this.severity;let n=this.diagnostics,i=e.state.facet(Y).tooltipFilter;return i&&(n=i(n,e.state)),n.length&&(t.onmouseover=()=>function(e,t,n){function i(){let i=e.elementAtHeight(t.getBoundingClientRect().top+5-e.documentTop);e.coordsAtPos(i.from)&&e.dispatch({effects:j.of({pos:i.from,above:!1,clip:!1,create:()=>({dom:v(e,n),getCoords:()=>t.getBoundingClientRect()})})}),t.onmouseout=t.onmousemove=null,function(e,t){let n=i=>{let r=t.getBoundingClientRect();if(!(i.clientX>r.left-10&&i.clientX<r.right+10&&i.clientY>r.top-10&&i.clientY<r.bottom+10)){for(let e=i.target;e;e=e.parentNode)if(1==e.nodeType&&e.classList.contains("cm-tooltip-lint"))return;window.removeEventListener("mousemove",n),e.state.field(K)&&e.dispatch({effects:j.of(null)})}};window.addEventListener("mousemove",n)}(e,t)}let{hoverTime:r}=e.state.facet(Y),o=setTimeout(i,r);t.onmouseout=()=>{clearTimeout(o),t.onmouseout=t.onmousemove=null},t.onmousemove=()=>{clearTimeout(o),o=setTimeout(i,r)}}(e,t,n)),t}}function H(e,t){let n=Object.create(null);for(let i of t){let t=e.lineAt(i.from);(n[t.from]||(n[t.from]=[])).push(i)}let i=[];for(let e in n)i.push(new W(n[e]).range(+e));return r.om.of(i,!0)}const q=(0,i.cU)({class:"cm-gutter-lint",markers:e=>e.state.field(V),widgetMarker:(e,t,n)=>{let i=[];return e.state.field(V).between(n.from,n.to,(e,t,r)=>{e>n.from&&e<n.to&&i.push(...r.diagnostics)}),i.length?new W(i):null}}),V=r.sU.define({create:()=>r.om.empty,update(e,t){e=e.map(t.changes);let n=t.state.facet(Y).markerFilter;for(let i of t.effects)if(i.is(d)){let r=i.value;n&&(r=n(r||[],t.state)),e=H(t.state.doc,r.slice(0))}return e}}),j=r.Pe.define(),K=r.sU.define({create:()=>null,update:(e,t)=>(e&&t.docChanged&&(e=c(t,e)?null:{...e,pos:t.changes.mapPos(e.pos)}),t.effects.reduce((e,t)=>t.is(j)?t.value:e,e)),provide:e=>i.DK.from(e)}),_=i.Lz.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:R('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:R('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:R('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),U=(0,i.Ux)(y,{hideOn:c}),$=[m,i.Lz.decorations.compute([m],e=>{let{selected:t,panel:n}=e.field(m);return t&&n&&t.from!=t.to?i.NZ.set([b.range(t.from,t.to)]):i.NZ.none}),U,I],Y=r.sj.define({combine:e=>(0,r.QR)(e,{hoverTime:300,markerFilter:null,tooltipFilter:null})});function G(e={}){return[Y.of(e),V,q,_,K]}function X(e,t){let n=e.field(m,!1);if(n&&n.diagnostics.size){let e=[],i=[],o=-1;for(let s=r.om.iter([n.diagnostics]);;s.next()){for(let n=0;n<e.length;n++)(!s.value||s.value.spec.diagnostics.indexOf(e[n])<0)&&(t(e[n],i[n],o),e.splice(n,1),i.splice(n--,1));if(!s.value)break;for(let t of s.value.spec.diagnostics)e.indexOf(t)<0&&(e.push(t),i.push(s.from));o=s.to}}}n.d(t,["closeLintPanel",0,k,"lintKeymap",0,S,"nextDiagnostic",0,x,"openLintPanel",0,w,"previousDiagnostic",0,e=>{var t;let{state:n}=e,r=n.field(m,!1);if(!r)return!1;let o,s,a,l,c=n.selection.main;if(r.diagnostics.between(0,n.doc.length,(e,t)=>{t<c.to&&(null==o||o<e)&&(o=e,s=t),(null==a||e>a)&&(a=e,l=t)}),null==a||null==o&&a==c.from)return!1;let h=null!=o?o:a,u=null!==(t=null!=s?s:l)&&void 0!==t?t:h;return e.dispatch({selection:{anchor:h,head:u},scrollIntoView:!0}),(0,i.ab)(e,h,1,{tooltip:U,until:e=>e.docChanged||e.newSelection.main.head<h||e.newSelection.main.head>u}),!0},"setDiagnosticsEffect",0,d])},7969(e,t,n){n.d(t,{gN:()=>b});var i=n(9747),r=n(2701),o=n(9786);const s="function"==typeof String.prototype.normalize?e=>e.normalize("NFKD"):e=>e;class a{constructor(e,t,n=0,i=e.length,r,o){this.test=o,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,i),this.bufferStart=n,this.normalize=r?e=>r(s(e)):s,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return(0,r.vS)(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=(0,r.MK)(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=(0,r.Fh)(e);let i=this.normalize(t);if(i.length)for(let e=0,r=n,o=!0;;e++){let n=i.charCodeAt(e),s=this.match(n,r,o,this.bufferPos+this.bufferStart,e==i.length-1);if(s)return this.value=s,this;if(e==i.length-1)break;o&&e<t.length&&t.charCodeAt(e)==n?r++:o=!1}}}match(e,t,n,i,r){let o=null;for(let t=0;t<this.matches.length;){let n=this.matches[t],s=!1;this.query.charCodeAt(n.index)==e&&(n.index==this.query.length-1?o={from:n.from,to:i,precise:r&&n.precise}:(n.index++,s=!0)),s?t++:this.matches.splice(t,1)}return this.query.charCodeAt(0)==e&&(1==this.query.length?o={from:t,to:i,precise:n&&r}:this.matches.push({from:t,index:1,precise:n})),o&&this.test&&!this.test(o.from,o.to,this.buffer,this.bufferStart)&&(o=null),o}}"undefined"!=typeof Symbol&&(a.prototype[Symbol.iterator]=function(){return this});const l={from:-1,to:-1,match:/.*/.exec(""),precise:!0},c="gm"+(null==/x/.unicode?"":"u");class h{constructor(e,t,n,i=0,r=e.length){if(this.text=e,this.to=r,this.curLine="",this.done=!1,this.value=l,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new f(e,t,n,i,r);this.re=new RegExp(t,c+((null==n?void 0:n.ignoreCase)?"i":"")),this.test=null==n?void 0:n.test,this.iter=e.iter();let o=e.lineAt(i);this.curLineStart=o.from,this.matchPos=p(e,i),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,i=n+t[0].length;if(this.matchPos=p(this.text,i+(n==i?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<i||n>this.value.to)&&(!this.test||this.test(n,i,t)))return this.value={from:n,to:i,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),e=0}}}}const u=new WeakMap;class d{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let i=u.get(e);if(!i||i.from>=n||i.to<=t){let i=new d(t,e.sliceString(t,n));return u.set(e,i),i}if(i.from==t&&i.to==n)return i;let{text:r,from:o}=i;return o>t&&(r=e.sliceString(t,o)+r,o=t),i.to<n&&(r+=e.sliceString(i.to,n)),u.set(e,new d(o,r)),new d(t,r.slice(t-o,n-o))}}class f{constructor(e,t,n,i,r){this.text=e,this.to=r,this.done=!1,this.value=l,this.matchPos=p(e,i),this.re=new RegExp(t,c+((null==n?void 0:n.ignoreCase)?"i":"")),this.test=null==n?void 0:n.test,this.flat=d.get(e,i,this.chunkEnd(i+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,precise:!0,match:t},this.matchPos=p(this.text,n+(e==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=d.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function p(e,t){if(t>=e.length)return t;let n,i=e.lineAt(t);for(;t<i.to&&(n=i.text.charCodeAt(t-i.from))>=56320&&n<57344;)t++;return t}"undefined"!=typeof Symbol&&(h.prototype[Symbol.iterator]=f.prototype[Symbol.iterator]=function(){return this});const m={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},g=r.sj.define({combine:e=>(0,r.QR)(e,m,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})});function b(e){let t=[x,k];return e&&t.push(g.of(e)),t}const y=i.NZ.mark({class:"cm-selectionMatch"}),v=i.NZ.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function w(e,t,n,i){return!(0!=n&&e(t.sliceDoc(n-1,n))==r.Je.Word||i!=t.doc.length&&e(t.sliceDoc(i,i+1))==r.Je.Word)}const k=i.Z9.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(g),{state:n}=e,o=n.selection;if(o.ranges.length>1)return i.NZ.none;let s,l=o.main,c=null;if(l.empty){if(!t.highlightWordAroundCursor)return i.NZ.none;let e=n.wordAt(l.head);if(!e)return i.NZ.none;c=n.charCategorizer(l.head),s=n.sliceDoc(e.from,e.to)}else{let e=l.to-l.from;if(e<t.minSelectionLength||e>200)return i.NZ.none;if(t.wholeWords){if(s=n.sliceDoc(l.from,l.to),c=n.charCategorizer(l.head),!w(c,n,l.from,l.to)||!function(e,t,n,i){return e(t.sliceDoc(n,n+1))==r.Je.Word&&e(t.sliceDoc(i-1,i))==r.Je.Word}(c,n,l.from,l.to))return i.NZ.none}else if(s=n.sliceDoc(l.from,l.to),!s)return i.NZ.none}let h=[];for(let r of e.visibleRanges){let e=new a(n.doc,s,r.from,r.to);for(;!e.next().done;){let{from:r,to:o}=e.value;if((!c||w(c,n,r,o))&&(l.empty&&r<=l.from&&o>=l.to?h.push(v.range(r,o)):(r>=l.to||o<=l.from)&&h.push(y.range(r,o)),h.length>t.maxMatches))return i.NZ.none}}return i.NZ.set(h)}},{decorations:e=>e.decorations}),x=i.Lz.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),S=r.sj.define({combine:e=>(0,r.QR)(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Z(e),scrollToMatch:e=>i.Lz.scrollIntoView(e)})});class C{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||function(e){try{return new RegExp(e,c),!0}catch(e){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>"n"==t?"\n":"r"==t?"\r":"t"==t?"\t":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new z(this):new T(this)}getCursor(e,t=0,n){let i=e.doc?e:r.$t.create({doc:e});return null==n&&(n=i.doc.length),this.regexp?O(this,i,t,n):M(this,i,t,n)}}class A{constructor(e){this.spec=e}}function M(e,t,n,i){let o;var s,l;return e.wholeWord&&(s=t.doc,l=t.charCategorizer(t.selection.main.head),o=(e,t,n,i)=>((i>e||i+n.length<t)&&(i=Math.max(0,e-2),n=s.sliceString(i,Math.min(s.length,t+2))),!(l(D(n,e-i))==r.Je.Word&&l(L(n,e-i))==r.Je.Word||l(L(n,t-i))==r.Je.Word&&l(D(n,t-i))==r.Je.Word))),e.test&&(o=function(e,t,n){return(i,r,o,s)=>{if(n&&!n(i,r,o,s))return!1;let a=i>=s&&r<=s+o.length?o.slice(i-s,r-s):t.doc.sliceString(i,r);return e(a,t,i,r)}}(e.test,t,o)),new a(t.doc,e.unquoted,n,i,e.caseSensitive?void 0:e=>e.toLowerCase(),o)}class T extends A{constructor(e){super(e)}nextMatch(e,t,n){let i=M(this.spec,e,n,e.doc.length).nextOverlapping();if(i.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);i=M(this.spec,e,0,n).nextOverlapping()}return i.done||i.value.from==t&&i.value.to==n?null:i.value}prevMatchInRange(e,t,n){for(let i=n;;){let n=Math.max(t,i-1e4-this.spec.unquoted.length),r=M(this.spec,e,n,i),o=null;for(;!r.nextOverlapping().done;)o=r.value;if(o)return o;if(n==t)return null;i-=1e4}}prevMatch(e,t,n){let i=this.prevMatchInRange(e,0,t);return i||(i=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),!i||i.from==t&&i.to==n?null:i}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=M(this.spec,e,0,e.doc.length),i=[];for(;!n.next().done;){if(i.length>=t)return null;i.push(n.value)}return i}highlight(e,t,n,i){let r=M(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!r.next().done;)i(r.value.from,r.value.to)}}function O(e,t,n,i){let o;var s;return e.wholeWord&&(s=t.charCategorizer(t.selection.main.head),o=(e,t,n)=>!n[0].length||(s(D(n.input,n.index))!=r.Je.Word||s(L(n.input,n.index))!=r.Je.Word)&&(s(L(n.input,n.index+n[0].length))!=r.Je.Word||s(D(n.input,n.index+n[0].length))!=r.Je.Word)),e.test&&(o=function(e,t,n){return(i,r,o)=>(!n||n(i,r,o))&&e(o[0],t,i,r)}(e.test,t,o)),new h(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:o},n,i)}function D(e,t){return e.slice((0,r.zK)(e,t,!1),t)}function L(e,t){return e.slice(t,(0,r.zK)(e,t))}class z extends A{nextMatch(e,t,n){let i=O(this.spec,e,n,e.doc.length).next();return i.done&&(i=O(this.spec,e,0,t).next()),i.done?null:i.value}prevMatchInRange(e,t,n){for(let i=1;;i++){let r=Math.max(t,n-1e4*i),o=O(this.spec,e,r,n),s=null;for(;!o.next().done;)s=o.value;if(s&&(r==t||s.from>r+10))return s;if(r==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if("&"==n)return e.match[0];if("$"==n)return"$";for(let t=n.length;t>0;t--){let i=+n.slice(0,t);if(i>0&&i<e.match.length)return e.match[i]+n.slice(t)}return t})}matchAll(e,t){let n=O(this.spec,e,0,e.doc.length),i=[];for(;!n.next().done;){if(i.length>=t)return null;i.push(n.value)}return i}highlight(e,t,n,i){let r=O(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!r.next().done;)i(r.value.from,r.value.to)}}const E=r.Pe.define(),B=r.Pe.define(),R=r.sU.define({create:e=>new P(U(e).create(),null),update(e,t){for(let n of t.effects)n.is(E)?e=new P(n.value.create(),e.panel):n.is(B)&&(e=new P(e.query,n.value?_:null));return e},provide:e=>i.S7.from(e,e=>e.panel)});class P{constructor(e,t){this.query=e,this.panel=t}}const I=i.NZ.mark({class:"cm-searchMatch"}),N=i.NZ.mark({class:"cm-searchMatch cm-searchMatch-selected"}),F=i.Z9.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(R))}update(e){let t=e.state.field(R);(t!=e.startState.field(R)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return i.NZ.none;let{view:n}=this,o=new r.vB;for(let t=0,i=n.visibleRanges,r=i.length;t<r;t++){let{from:s,to:a}=i[t];for(;t<r-1&&a>i[t+1].from-500;)a=i[++t].to;e.highlight(n.state,s,a,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);o.add(e,t,i?N:I)})}return o.finish()}},{decorations:e=>e.decorations});function W(e){return t=>{let n=t.state.field(R,!1);return n&&n.query.spec.valid?e(t,n):G(t)}}const H=W((e,{query:t})=>{let{to:n}=e.state.selection.main,i=t.nextMatch(e.state,n,n);if(!i)return!1;let o=r.OF.single(i.from,i.to),s=e.state.facet(S);return e.dispatch({selection:o,effects:[te(e,i),s.scrollToMatch(o.main,e)],userEvent:"select.search"}),Y(e),!0}),q=W((e,{query:t})=>{let{state:n}=e,{from:i}=n.selection.main,o=t.prevMatch(n,i,i);if(!o)return!1;let s=r.OF.single(o.from,o.to),a=e.state.facet(S);return e.dispatch({selection:s,effects:[te(e,o),a.scrollToMatch(s.main,e)],userEvent:"select.search"}),Y(e),!0}),V=W((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!(!n||!n.length||(e.dispatch({selection:r.OF.create(n.map(e=>r.OF.range(e.from,e.to))),userEvent:"select.search.matches"}),0))}),j=W((e,{query:t})=>{let{state:n}=e,{from:o,to:s}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,o,o);if(!a)return!1;let l,c,h=a,u=[],d=[];h.precise?h.from==o&&h.to==s&&(c=n.toText(t.getReplacement(h)),u.push({from:h.from,to:h.to,insert:c}),h=t.nextMatch(n,h.from,h.to),d.push(i.Lz.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(o).number)+"."))):h=t.nextMatch(n,h.from,h.to);let f=e.state.changes(u);return h&&(l=r.OF.single(h.from,h.to).map(f),d.push(te(e,h)),d.push(n.facet(S).scrollToMatch(l.main,e))),e.dispatch({changes:f,selection:l,effects:d,userEvent:"input.replace"}),!0}),K=W((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let i of t.matchAll(e.state,1e9)){let{from:e,to:r,precise:o}=i;o&&n.push({from:e,to:r,insert:t.getReplacement(i)})}if(!n.length)return!1;let r=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:i.Lz.announce.of(r),userEvent:"input.replace.all"}),!0});function _(e){return e.state.facet(S).createPanel(e)}function U(e,t){var n,i,r,o,s;let a=e.selection.main,l=a.empty||a.to>a.from+100?"":e.sliceDoc(a.from,a.to);if(t&&!l)return t;let c=e.facet(S);return new C({search:(null!==(n=null==t?void 0:t.literal)&&void 0!==n?n:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:null!==(i=null==t?void 0:t.caseSensitive)&&void 0!==i?i:c.caseSensitive,literal:null!==(r=null==t?void 0:t.literal)&&void 0!==r?r:c.literal,regexp:null!==(o=null==t?void 0:t.regexp)&&void 0!==o?o:c.regexp,wholeWord:null!==(s=null==t?void 0:t.wholeWord)&&void 0!==s?s:c.wholeWord})}function $(e){let t=(0,i.ld)(e,_);return t&&t.dom.querySelector("[main-field]")}function Y(e){let t=$(e);t&&t==e.root.activeElement&&t.select()}const G=e=>{let t=e.state.field(R,!1);if(t&&t.panel){let n=$(e);if(n&&n!=e.root.activeElement){let i=U(e.state,t.query.spec);i.valid&&e.dispatch({effects:E.of(i)}),n.focus(),n.select()}}else e.dispatch({effects:[B.of(!0),t?E.of(U(e.state,t.query.spec)):r.Pe.appendConfig.of(ie)]});return!0},X=e=>{let t=e.state.field(R,!1);if(!t||!t.panel)return!1;let n=(0,i.ld)(e,_);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:B.of(!1)}),!0},J=[{key:"Mod-f",run:G,scope:"editor search-panel"},{key:"F3",run:H,shift:q,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:H,shift:q,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:X,scope:"editor search-panel"},{key:"Mod-Shift-l",run:({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:i,to:o}=n.main,s=[],l=0;for(let t=new a(e.doc,e.sliceDoc(i,o));!t.next().done;){if(s.length>1e3)return!1;t.value.from==i&&(l=s.length),s.push(r.OF.range(t.value.from,t.value.to))}return t(e.update({selection:r.OF.create(s,l),userEvent:"select.search.matches"})),!0}},{key:"Mod-Alt-g",run:e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:o,result:s}=(0,i.ui)(e,{label:t.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:t.phrase("go")});return s.then(n=>{let s=n&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.elements.line.value);if(!s)return void e.dispatch({effects:o});let a=t.doc.lineAt(t.selection.main.head),[,l,c,h,u]=s,d=h?+h.slice(1):0,f=c?+c:a.number;if(c&&u){let e=f/100;l&&(e=e*("-"==l?-1:1)+a.number/t.doc.lines),f=Math.round(t.doc.lines*e)}else c&&l&&(f=f*("-"==l?-1:1)+a.number);let p=t.doc.line(Math.max(1,Math.min(t.doc.lines,f))),m=r.OF.cursor(p.from+Math.max(0,Math.min(d,p.length)));e.dispatch({effects:[o,i.Lz.scrollIntoView(m.from,{y:"center"})],selection:m})}),!0}},{key:"Mod-d",run:({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return(({state:e,dispatch:t})=>{let{selection:n}=e,i=r.OF.create(n.ranges.map(t=>e.wordAt(t.head)||r.OF.cursor(t.head)),n.mainIndex);return!i.eq(n)&&(t(e.update({selection:i})),!0)})({state:e,dispatch:t});let o=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=o))return!1;let s=function(e,t){let{main:n,ranges:i}=e.selection,r=e.wordAt(n.head),o=r&&r.from==n.from&&r.to==n.to;for(let n=!1,r=new a(e.doc,t,i[i.length-1].to);;){if(r.next(),!r.done){if(n&&i.some(e=>e.from==r.value.from))continue;if(o){let t=e.wordAt(r.value.from);if(!t||t.from!=r.value.from||t.to!=r.value.to)continue}return r.value}if(n)return null;r=new a(e.doc,t,0,Math.max(0,i[i.length-1].from-1)),n=!0}}(e,o);return!!s&&(t(e.update({selection:e.selection.addRange(r.OF.range(s.from,s.to),!1),effects:i.Lz.scrollIntoView(s.to)})),!0)},preventDefault:!0}];class Z{constructor(e){this.view=e;let t=this.query=e.state.field(R).query.spec;function n(e,t,n){return(0,o.A)("button",{class:"cm-button",name:e,onclick:t,type:"button"},n)}this.commit=this.commit.bind(this),this.searchField=(0,o.A)("input",{value:t.search,placeholder:Q(e,"Find"),"aria-label":Q(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=(0,o.A)("input",{value:t.replace,placeholder:Q(e,"Replace"),"aria-label":Q(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=(0,o.A)("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=(0,o.A)("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=(0,o.A)("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit}),this.dom=(0,o.A)("div",{onkeydown:e=>this.keydown(e),class:"cm-search"},[this.searchField,n("next",()=>H(e),[Q(e,"next")]),n("prev",()=>q(e),[Q(e,"previous")]),n("select",()=>V(e),[Q(e,"all")]),(0,o.A)("label",null,[this.caseField,Q(e,"match case")]),(0,o.A)("label",null,[this.reField,Q(e,"regexp")]),(0,o.A)("label",null,[this.wordField,Q(e,"by word")]),...e.state.readOnly?[]:[(0,o.A)("br"),this.replaceField,n("replace",()=>j(e),[Q(e,"replace")]),n("replaceAll",()=>K(e),[Q(e,"replace all")])],(0,o.A)("button",{name:"close",onclick:()=>X(e),"aria-label":Q(e,"close"),type:"button"},["×"])])}commit(){let e=new C({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:E.of(e)}))}keydown(e){(0,i.TS)(this.view,e,"search-panel")?e.preventDefault():13==e.keyCode&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?q:H)(this.view)):13==e.keyCode&&e.target==this.replaceField&&(e.preventDefault(),j(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(E)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(S).top}}function Q(e,t){return e.state.phrase(t)}const ee=/[\s\.,:;?!]/;function te(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),o=e.state.doc.lineAt(n).to,s=Math.max(r.from,t-30),a=Math.min(o,n+30),l=e.state.sliceDoc(s,a);if(s!=r.from)for(let e=0;e<30;e++)if(!ee.test(l[e+1])&&ee.test(l[e])){l=l.slice(e);break}if(a!=o)for(let e=l.length-1;e>l.length-30;e--)if(!ee.test(l[e-1])&&ee.test(l[e])){l=l.slice(0,e);break}return i.Lz.announce.of(`${e.state.phrase("current match")}. ${l} ${e.state.phrase("on line")} ${r.number}.`)}const ne=i.Lz.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),ie=[R,r.Nb.low(F),ne];n.d(t,["Eo",0,J])},2701(e,t,n){n.d(t,{$t:()=>me,DA:()=>ie,EY:()=>r,FB:()=>be,Fh:()=>b,Gu:()=>w,Je:()=>de,MK:()=>g,N1:()=>d,OF:()=>D,Pe:()=>re,Q6:()=>ve,QR:()=>ge,UJ:()=>ne,VR:()=>k,YH:()=>te,ZX:()=>oe,iR:()=>v,kn:()=>Pe,om:()=>xe,sU:()=>W,sj:()=>E,vB:()=>Se,vS:()=>m,xx:()=>j,y$:()=>Re,yn:()=>O,zK:()=>p});var i=n(5219);class r{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=f(this,e,t);let i=[];return this.decompose(0,e,i,2),n.length&&n.decompose(0,n.length,i,3),this.decompose(t,this.length,i,1),s.from(i,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=f(this,e,t);let n=[];return this.decompose(e,t,n,0),s.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),i=new c(this),r=new c(e);for(let e=t,o=t;;){if(i.next(e),r.next(e),e=0,i.lineBreak!=r.lineBreak||i.done!=r.done||i.value!=r.value)return!1;if(o+=i.value.length,i.done||o>=n)return!0}}iter(e=1){return new c(this,e)}iterRange(e,t=this.length){return new h(this,e,t)}iterLines(e,t){let n;if(null==e)n=this.iter();else{null==t&&(t=this.lines+1);let i=this.line(e).from;n=this.iterRange(i,Math.max(i,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new u(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(0==e.length)throw new RangeError("A document must have at least one line");return 1!=e.length||e[0]?e.length<=32?new o(e):s.from(o.split(e,[])):r.empty}}class o extends r{constructor(e,t=function(e){let t=-1;for(let n of e)t+=n.length+1;return t}(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,i){for(let r=0;;r++){let o=this.text[r],s=i+o.length;if((t?n:s)>=e)return new d(i,s,n,o);i=s+1,n++}}decompose(e,t,n,i){let r=e<=0&&t>=this.length?this:new o(l(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(1&i){let e=n.pop(),t=a(r.text,e.text.slice(),0,r.length);if(t.length<=32)n.push(new o(t,e.length+r.length));else{let e=t.length>>1;n.push(new o(t.slice(0,e)),new o(t.slice(e)))}}else n.push(r)}replace(e,t,n){if(!(n instanceof o))return super.replace(e,t,n);[e,t]=f(this,e,t);let i=a(this.text,a(n.text,l(this.text,0,e)),t),r=this.length+n.length-(t-e);return i.length<=32?new o(i,r):s.from(o.split(i,[]),r)}sliceString(e,t=this.length,n="\n"){[e,t]=f(this,e,t);let i="";for(let r=0,o=0;r<=t&&o<this.text.length;o++){let s=this.text[o],a=r+s.length;r>e&&o&&(i+=n),e<a&&t>r&&(i+=s.slice(Math.max(0,e-r),t-r)),r=a+1}return i}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],i=-1;for(let r of e)n.push(r),i+=r.length+1,32==n.length&&(t.push(new o(n,i)),n=[],i=-1);return i>-1&&t.push(new o(n,i)),t}}class s extends r{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,i){for(let r=0;;r++){let o=this.children[r],s=i+o.length,a=n+o.lines-1;if((t?a:s)>=e)return o.lineInner(e,t,n,i);i=s+1,n=a+1}}decompose(e,t,n,i){for(let r=0,o=0;o<=t&&r<this.children.length;r++){let s=this.children[r],a=o+s.length;if(e<=a&&t>=o){let r=i&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!r?n.push(s):s.decompose(e-o,t-o,n,r)}o=a+1}}replace(e,t,n){if([e,t]=f(this,e,t),n.lines<this.lines)for(let i=0,r=0;i<this.children.length;i++){let o=this.children[i],a=r+o.length;if(e>=r&&t<=a){let l=o.replace(e-r,t-r,n),c=this.lines-o.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let r=this.children.slice();return r[i]=l,new s(r,this.length-(t-e)+n.length)}return super.replace(r,a,l)}r=a+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n="\n"){[e,t]=f(this,e,t);let i="";for(let r=0,o=0;r<this.children.length&&o<=t;r++){let s=this.children[r],a=o+s.length;o>e&&r&&(i+=n),e<a&&t>o&&(i+=s.sliceString(e-o,t-o,n)),o=a+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof s))return 0;let n=0,[i,r,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,r+=t){if(i==o||r==a)return n;let s=this.children[i],l=e.children[r];if(s!=l)return n+s.scanIdentical(l,t);n+=s.length+1}}static from(e,t=e.reduce((e,t)=>e+t.length+1,-1)){let n=0;for(let t of e)n+=t.lines;if(n<32){let n=[];for(let t of e)t.flatten(n);return new o(n,t)}let i=Math.max(32,n>>5),r=i<<1,a=i>>1,l=[],c=0,h=-1,u=[];function d(e){let t;if(e.lines>r&&e instanceof s)for(let t of e.children)d(t);else e.lines>a&&(c>a||!c)?(f(),l.push(e)):e instanceof o&&c&&(t=u[u.length-1])instanceof o&&e.lines+t.lines<=32?(c+=e.lines,h+=e.length+1,u[u.length-1]=new o(t.text.concat(e.text),t.length+1+e.length)):(c+e.lines>i&&f(),c+=e.lines,h+=e.length+1,u.push(e))}function f(){0!=c&&(l.push(1==u.length?u[0]:s.from(u,h)),h=-1,c=u.length=0)}for(let t of e)d(t);return f(),1==l.length?l[0]:new s(l,t)}}function a(e,t,n=0,i=1e9){for(let r=0,o=0,s=!0;o<e.length&&r<=i;o++){let a=e[o],l=r+a.length;l>=n&&(l>i&&(a=a.slice(0,i-r)),r<n&&(a=a.slice(n-r)),s?(t[t.length-1]+=a,s=!1):t.push(a)),r=l+1}return t}function l(e,t,n){return a(e,[""],t,n)}r.empty=new o([""],0);class c{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof o?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,i=this.nodes[n],r=this.offsets[n],s=r>>1,a=i instanceof o?i.text.length:i.children.length;if(s==(t>0?a:0)){if(0==n)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&r)==(t>0?0:1)){if(this.offsets[n]+=t,0==e)return this.lineBreak=!0,this.value="\n",this;e--}else if(i instanceof o){let r=i.text[s+(t<0?-1:0)];if(this.offsets[n]+=t,r.length>Math.max(0,e))return this.value=0==e?r:t>0?r.slice(e):r.slice(0,r.length-e),this;e-=r.length}else{let r=i.children[s+(t<0?-1:0)];e>r.length?(e-=r.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(r),this.offsets.push(t>0?1:(r instanceof o?r.text.length:r.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class h{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new c(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=n?i:t<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class u{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:i}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(r.prototype[Symbol.iterator]=function(){return this.iter()},c.prototype[Symbol.iterator]=h.prototype[Symbol.iterator]=u.prototype[Symbol.iterator]=function(){return this});class d{constructor(e,t,n,i){this.from=e,this.to=t,this.number=n,this.text=i}get length(){return this.to-this.from}}function f(e,t,n){return[t=Math.max(0,Math.min(e.length,t)),Math.max(t,Math.min(e.length,n))]}function p(e,t,n=!0,r=!0){return(0,i.z)(e,t,n,r)}function m(e,t){let n=e.charCodeAt(t);if(!((i=n)>=55296&&i<56320&&t+1!=e.length))return n;var i;let r=e.charCodeAt(t+1);return function(e){return e>=56320&&e<57344}(r)?r-56320+(n-55296<<10)+65536:n}function g(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}function b(e){return e<65536?1:2}const y=/\r\n?|\n/;var v=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(v||(v={}));class w{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,i=0;t<this.sections.length;){let r=this.sections[t++],o=this.sections[t++];o<0?(e(n,i,r),i+=r):i+=o,n+=r}}iterChangedRanges(e,t=!1){C(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];i<0?e.push(n,i):e.push(i,n)}return new w(e)}composeDesc(e){return this.empty?e:e.empty?this:M(this,e)}mapDesc(e,t=!1){return e.empty?this:A(this,e,t)}mapPos(e,t=-1,n=v.Simple){let i=0,r=0;for(let o=0;o<this.sections.length;){let s=this.sections[o++],a=this.sections[o++],l=i+s;if(a<0){if(l>e)return r+(e-i);r+=s}else{if(n!=v.Simple&&l>=e&&(n==v.TrackDel&&i<e&&l>e||n==v.TrackBefore&&i<e||n==v.TrackAfter&&l>e))return null;if(l>e||l==e&&t<0&&!s)return e==i||t<0?r:r+a;r+=a}i=l}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return r}touchesRange(e,t=e){for(let n=0,i=0;n<this.sections.length&&i<=t;){let r=i+this.sections[n++];if(this.sections[n++]>=0&&i<=t&&r>=e)return!(i<e&&r>t)||"cover";i=r}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];e+=(e?" ":"")+n+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(e=>"number"!=typeof e))throw new RangeError("Invalid JSON representation of ChangeDesc");return new w(e)}static create(e){return new w(e)}}class k extends w{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return C(this,(t,n,i,r,o)=>e=e.replace(i,i+(n-t),o),!1),e}mapDesc(e,t=!1){return A(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let i=0,o=0;i<t.length;i+=2){let s=t[i],a=t[i+1];if(a>=0){t[i]=a,t[i+1]=s;let l=i>>1;for(;n.length<l;)n.push(r.empty);n.push(s?e.slice(o,o+s):r.empty)}o+=s}return new k(t,n)}compose(e){return this.empty?e:e.empty?this:M(this,e,!0)}map(e,t=!1){return e.empty?this:A(this,e,t,!0)}iterChanges(e,t=!1){C(this,e,t)}get desc(){return w.create(this.sections)}filter(e){let t=[],n=[],i=[],r=new T(this);e:for(let o=0,s=0;;){let a=o==e.length?1e9:e[o++];for(;s<a||s==a&&0==r.len;){if(r.done)break e;let e=Math.min(r.len,a-s);x(i,e,-1);let o=-1==r.ins?-1:0==r.off?r.ins:0;x(t,e,o),o>0&&S(n,t,r.text),r.forward(e),s+=e}let l=e[o++];for(;s<l;){if(r.done)break e;let e=Math.min(r.len,l-s);x(t,e,-1),x(i,e,-1==r.ins?-1:0==r.off?r.ins:0),r.forward(e),s+=e}}return{changes:new k(t,n),filtered:w.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],i=this.sections[t+1];i<0?e.push(n):0==i?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let i=[],o=[],s=0,a=null;function l(e=!1){if(!e&&!i.length)return;s<t&&x(i,t-s,-1);let n=new k(i,o);a=a?a.compose(n.map(a)):n,i=[],o=[],s=0}return function e(c){if(Array.isArray(c))for(let t of c)e(t);else if(c instanceof k){if(c.length!=t)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${t})`);l(),a=a?a.compose(c.map(a)):c}else{let{from:e,to:a=e,insert:h}=c;if(e>a||e<0||a>t)throw new RangeError(`Invalid change range ${e} to ${a} (in doc of length ${t})`);let u=h?"string"==typeof h?r.of(h.split(n||y)):h:r.empty,d=u.length;if(e==a&&0==d)return;e<s&&l(),e>s&&x(i,e-s,-1),x(i,a-e,d),S(o,i,u),s=a}}(e),l(!a),a}static empty(e){return new k(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let i=0;i<e.length;i++){let o=e[i];if("number"==typeof o)t.push(o,-1);else{if(!Array.isArray(o)||"number"!=typeof o[0]||o.some((e,t)=>t&&"string"!=typeof e))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==o.length)t.push(o[0],0);else{for(;n.length<i;)n.push(r.empty);n[i]=r.of(o.slice(1)),t.push(o[0],n[i].length)}}}return new k(t,n)}static createSet(e,t){return new k(e,t)}}function x(e,t,n,i=!1){if(0==t&&n<=0)return;let r=e.length-2;r>=0&&n<=0&&n==e[r+1]?e[r]+=t:r>=0&&0==t&&0==e[r]?e[r+1]+=n:i?(e[r]+=t,e[r+1]+=n):e.push(t,n)}function S(e,t,n){if(0==n.length)return;let i=t.length-2>>1;if(i<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<i;)e.push(r.empty);e.push(n)}}function C(e,t,n){let i=e.inserted;for(let o=0,s=0,a=0;a<e.sections.length;){let l=e.sections[a++],c=e.sections[a++];if(c<0)o+=l,s+=l;else{let h=o,u=s,d=r.empty;for(;h+=l,u+=c,c&&i&&(d=d.append(i[a-2>>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)l=e.sections[a++],c=e.sections[a++];t(o,h,s,u,d),o=h,s=u}}}function A(e,t,n,i=!1){let r=[],o=i?[]:null,s=new T(e),a=new T(t);for(let e=-1;;){if(s.done&&a.len||a.done&&s.len)throw new Error("Mismatched change set lengths");if(-1==s.ins&&-1==a.ins){let e=Math.min(s.len,a.len);x(r,e,-1),s.forward(e),a.forward(e)}else if(a.ins>=0&&(s.ins<0||e==s.i||0==s.off&&(a.len<s.len||a.len==s.len&&!n))){let t=a.len;for(x(r,a.ins,-1);t;){let n=Math.min(s.len,t);s.ins>=0&&e<s.i&&s.len<=n&&(x(r,0,s.ins),o&&S(o,r,s.text),e=s.i),s.forward(n),t-=n}a.next()}else{if(!(s.ins>=0)){if(s.done&&a.done)return o?k.createSet(r,o):w.create(r);throw new Error("Mismatched change set lengths")}{let t=0,n=s.len;for(;n;)if(-1==a.ins){let e=Math.min(n,a.len);t+=e,n-=e,a.forward(e)}else{if(!(0==a.ins&&a.len<n))break;n-=a.len,a.next()}x(r,t,e<s.i?s.ins:0),o&&e<s.i&&S(o,r,s.text),e=s.i,s.forward(s.len-n)}}}}function M(e,t,n=!1){let i=[],r=n?[]:null,o=new T(e),s=new T(t);for(let e=!1;;){if(o.done&&s.done)return r?k.createSet(i,r):w.create(i);if(0==o.ins)x(i,o.len,0,e),o.next();else if(0!=s.len||s.done){if(o.done||s.done)throw new Error("Mismatched change set lengths");{let t=Math.min(o.len2,s.len),n=i.length;if(-1==o.ins){let n=-1==s.ins?-1:s.off?0:s.ins;x(i,t,n,e),r&&n&&S(r,i,s.text)}else-1==s.ins?(x(i,o.off?0:o.len,t,e),r&&S(r,i,o.textBit(t))):(x(i,o.off?0:o.len,s.off?0:s.ins,e),r&&!s.off&&S(r,i,s.text));e=(o.ins>t||s.ins>=0&&s.len>t)&&(e||i.length>n),o.forward2(t),s.forward(t)}}else x(i,0,s.ins,e),r&&S(r,i,s.text),s.next()}}class T{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return-2==this.ins}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?r.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?r.empty:t[n].slice(this.off,null==e?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){-1==this.ins?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class O{constructor(e,t,n,i){this.from=e,this.to=t,this.flags=n,this.goalColumn=i}get anchor(){return 32&this.flags?this.to:this.from}get head(){return 32&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 8&this.flags?-1:16&this.flags?1:0}get undirectional(){return(64&this.flags)>0}get bidiLevel(){let e=7&this.flags;return 7==e?null:e}map(e,t=-1){let n,i;return this.empty?n=i=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new O(n,i,this.flags,this.goalColumn)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return D.range(e,t,void 0,void 0,n);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return D.range(this.anchor,i,void 0,void 0,n)}eq(e,t=!1){return!(this.anchor!=e.anchor||this.head!=e.head||this.goalColumn!=e.goalColumn||t&&this.empty&&this.assoc!=e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||"number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid JSON representation for SelectionRange");return D.range(e.anchor,e.head)}static create(e,t,n,i){return new O(e,t,n,i)}}class D{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:D.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return 1==this.ranges.length?this:new D([this.main],0)}addRange(e,t=!0){return D.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,D.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new D(e.ranges.map(e=>O.fromJSON(e)),e.main)}static single(e,t=e){return new D([D.range(e,t)],0)}static create(e,t=0){if(0==e.length)throw new RangeError("A selection needs at least one range");for(let n=0,i=0;i<e.length;i++){let r=e[i];if(r.empty?r.from<=n:r.from<n)return D.normalized(e.slice(),t);n=r.to}return new D(e,t)}static cursor(e,t=0,n,i){return O.create(e,e,(0==t?0:t<0?8:16)|(null==n?7:Math.min(6,n)),i)}static range(e,t,n,i,r){let o=null==i?7:Math.min(6,i);return r||e==t||(r=t<e?1:-1),r&&(o|=r<0?8:16),t<e?O.create(t,e,32|o,n):O.create(e,t,o,n)}static undirectionalRange(e,t){return O.create(e,t,64,void 0)}static normalized(e,t=0){let n=e[t];e.sort((e,t)=>e.from-t.from),t=e.indexOf(n);for(let n=1;n<e.length;n++){let i=e[n],r=e[n-1];if(i.empty?i.from<=r.to:i.from<r.to){let o=r.from,s=Math.max(i.to,r.to);n<=t&&t--,e.splice(--n,2,i.anchor>i.head?D.range(s,o):D.range(o,s))}}return new D(e,t)}}function L(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let z=0;class E{constructor(e,t,n,i,r){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=i,this.id=z++,this.default=e([]),this.extensions="function"==typeof r?r(this):r}get reader(){return this}static define(e={}){return new E(e.combine||(e=>e),e.compareInput||((e,t)=>e===t),e.compare||(e.combine?(e,t)=>e===t:B),!!e.static,e.enables)}of(e){return new R([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new R(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new R(e,this,2,t)}from(e,t){return t||(t=e=>e),this.compute([e],n=>t(n.field(e)))}}function B(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}class R{constructor(e,t,n,i){this.dependencies=e,this.facet=t,this.type=n,this.value=i,this.id=z++}dynamicSlot(e){var t;let n=this.value,i=this.facet.compareInput,r=this.id,o=e[r]>>1,s=2==this.type,a=!1,l=!1,c=[];for(let n of this.dependencies)"doc"==n?a=!0:"selection"==n?l=!0:1&(null!==(t=e[n.id])&&void 0!==t?t:1)||c.push(e[n.id]);return{create:e=>(e.values[o]=n(e),1),update(e,t){if(a&&t.docChanged||l&&(t.docChanged||t.selection)||I(e,c)){let t=n(e);if(s?!P(t,e.values[o],i):!i(t,e.values[o]))return e.values[o]=t,1}return 0},reconfigure:(e,t)=>{let a,l=t.config.address[r];if(null!=l){let r=$(t,l);if(this.dependencies.every(n=>n instanceof E?t.facet(n)===e.facet(n):!(n instanceof W)||t.field(n,!1)==e.field(n,!1))||(s?P(a=n(e),r,i):i(a=n(e),r)))return e.values[o]=r,0}else a=n(e);return e.values[o]=a,1}}}get extension(){return this}}function P(e,t,n){if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++)if(!n(e[i],t[i]))return!1;return!0}function I(e,t){let n=!1;for(let i of t)1&U(e,i)&&(n=!0);return n}function N(e,t,n){let i=n.map(t=>e[t.id]),r=n.map(e=>e.type),o=i.filter(e=>!(1&e)),s=e[t.id]>>1;function a(e){let n=[];for(let t=0;t<i.length;t++){let o=$(e,i[t]);if(2==r[t])for(let e of o)n.push(e);else n.push(o)}return t.combine(n)}return{create(e){for(let t of i)U(e,t);return e.values[s]=a(e),1},update(e,n){if(!I(e,o))return 0;let i=a(e);return t.compare(i,e.values[s])?0:(e.values[s]=i,1)},reconfigure(e,r){let o=I(e,i),l=r.config.facets[t.id],c=r.facet(t);if(l&&!o&&B(n,l))return e.values[s]=c,0;let h=a(e);return t.compare(h,c)?(e.values[s]=c,0):(e.values[s]=h,1)}}}const F=E.define({static:!0});class W{constructor(e,t,n,i,r){this.id=e,this.createF=t,this.updateF=n,this.compareF=i,this.spec=r,this.provides=void 0}static define(e){let t=new W(z++,e.create,e.update,e.compare||((e,t)=>e===t),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(F).find(e=>e.field==this);return((null==t?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let i=e.values[t],r=this.updateF(i,n);return this.compareF(i,r)?0:(e.values[t]=r,1)},reconfigure:(e,n)=>{let i,r=e.facet(F),o=n.facet(F);return(i=r.find(e=>e.field==this))&&i!=o.find(e=>e.field==this)?(e.values[t]=i.create(e),1):null!=n.config.address[this.id]?(e.values[t]=n.field(this),0):(e.values[t]=this.create(e),1)}}}init(e){return[this,F.of({field:this,create:e})]}get extension(){return this}}function H(e){return t=>new V(t,e)}const q={highest:H(0),high:H(1),default:H(2),low:H(3),lowest:H(4)};class V{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}}class j{of(e){return new K(this,e)}reconfigure(e){return j.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class K{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}}class _{constructor(e,t,n,i,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=i,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return null==t?e.default:this.staticValues[t>>1]}static resolve(e,t,n){let i=[],r=Object.create(null),o=new Map;for(let n of function(e,t,n){let i=[[],[],[],[],[]],r=new Map;return function e(o,s){let a=r.get(o);if(null!=a){if(a<=s)return;let e=i[a].indexOf(o);e>-1&&i[a].splice(e,1),o instanceof K&&n.delete(o.compartment)}if(r.set(o,s),Array.isArray(o))for(let t of o)e(t,s);else if(o instanceof K){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let i=t.get(o.compartment)||o.inner;n.set(o.compartment,i),e(i,s)}else if(o instanceof V)e(o.inner,o.prec);else if(o instanceof W)i[s].push(o),o.provides&&e(o.provides,s);else if(o instanceof R)i[s].push(o),o.facet.extensions&&e(o.facet.extensions,2);else{let t=o.extension;if(!t)throw new Error(`Unrecognized extension value in extension set (${o}).`);if(t==o)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);e(t,s)}}(e,2),i.reduce((e,t)=>e.concat(t))}(e,t,o))n instanceof W?i.push(n):(r[n.facet.id]||(r[n.facet.id]=[])).push(n);let s=Object.create(null),a=[],l=[];for(let e of i)s[e.id]=l.length<<1,l.push(t=>e.slot(t));let c=null==n?void 0:n.config.facets;for(let e in r){let t=r[e],i=t[0].facet,o=c&&c[e]||[];if(t.every(e=>0==e.type))if(s[i.id]=a.length<<1|1,B(o,t))a.push(n.facet(i));else{let e=i.combine(t.map(e=>e.value));a.push(n&&i.compare(e,n.facet(i))?n.facet(i):e)}else{for(let e of t)0==e.type?(s[e.id]=a.length<<1|1,a.push(e.value)):(s[e.id]=l.length<<1,l.push(t=>e.dynamicSlot(t)));s[i.id]=l.length<<1,l.push(e=>N(e,i,t))}}let h=l.map(e=>e(s));return new _(e,o,h,s,a,r)}}function U(e,t){if(1&t)return 2;let n=t>>1,i=e.status[n];if(4==i)throw new Error("Cyclic dependency between fields and/or facets");if(2&i)return i;e.status[n]=4;let r=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|r}function $(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}const Y=E.define(),G=E.define({combine:e=>e.some(e=>e),static:!0}),X=E.define({combine:e=>e.length?e[0]:void 0,static:!0}),J=E.define(),Z=E.define(),Q=E.define(),ee=E.define({combine:e=>!!e.length&&e[0]});class te{constructor(e,t){this.type=e,this.value=t}static define(){return new ne}}class ne{of(e){return new te(this,e)}}class ie{constructor(e){this.map=e}of(e){return new re(this,e)}}class re{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return void 0===t?void 0:t==this.value?this:new re(this.type,t)}is(e){return this.type==e}static define(e={}){return new ie(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let i of e){let e=i.map(t);e&&n.push(e)}return n}}re.reconfigure=re.define(),re.appendConfig=re.define();class oe{constructor(e,t,n,i,r,o){this.startState=e,this.changes=t,this.selection=n,this.effects=i,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,n&&L(n,t.newLength),r.some(e=>e.type==oe.time)||(this.annotations=r.concat(oe.time.of(Date.now())))}static create(e,t,n,i,r,o){return new oe(e,t,n,i,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(oe.userEvent);return!(!t||!(t==e||t.length>e.length&&t.slice(0,e.length)==e&&"."==t[e.length]))}}function se(e,t){let n=[];for(let i=0,r=0;;){let o,s;if(i<e.length&&(r==t.length||t[r]>=e[i]))o=e[i++],s=e[i++];else{if(!(r<t.length))return n;o=t[r++],s=t[r++]}!n.length||n[n.length-1]<o?n.push(o,s):n[n.length-1]<s&&(n[n.length-1]=s)}}function ae(e,t,n){var i;let r,o,s;return n?(r=t.changes,o=k.empty(t.changes.length),s=e.changes.compose(t.changes)):(r=t.changes.map(e.changes),o=e.changes.mapDesc(t.changes,!0),s=e.changes.compose(r)),{changes:s,selection:t.selection?t.selection.map(o):null===(i=e.selection)||void 0===i?void 0:i.map(r),effects:re.mapEffects(e.effects,r).concat(re.mapEffects(t.effects,o)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function le(e,t,n){let i=t.selection,r=ue(t.annotations);return t.userEvent&&(r=r.concat(oe.userEvent.of(t.userEvent))),{changes:t.changes instanceof k?t.changes:k.of(t.changes||[],n,e.facet(X)),selection:i&&(i instanceof D?i:D.single(i.anchor,i.head)),effects:ue(t.effects),annotations:r,scrollIntoView:!!t.scrollIntoView}}function ce(e,t,n){let i=le(e,t.length?t[0]:{},e.doc.length);t.length&&!1===t[0].filter&&(n=!1);for(let r=1;r<t.length;r++){!1===t[r].filter&&(n=!1);let o=!!t[r].sequential;i=ae(i,le(e,t[r],o?i.changes.newLength:e.doc.length),o)}let r=oe.create(e,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return function(e){let t=e.startState,n=t.facet(Q),i=e;for(let r=n.length-1;r>=0;r--){let o=n[r](e);o&&Object.keys(o).length&&(i=ae(i,le(t,o,e.changes.newLength),!0))}return i==e?e:oe.create(t,e.changes,e.selection,i.effects,i.annotations,i.scrollIntoView)}(n?function(e){let t=e.startState,n=!0;for(let i of t.facet(J)){let t=i(e);if(!1===t){n=!1;break}Array.isArray(t)&&(n=!0===n?t:se(n,t))}if(!0!==n){let i,r;if(!1===n)r=e.changes.invertedDesc,i=k.empty(t.doc.length);else{let t=e.changes.filter(n);i=t.changes,r=t.filtered.mapDesc(t.changes).invertedDesc}e=oe.create(t,i,e.selection&&e.selection.map(r),re.mapEffects(e.effects,r),e.annotations,e.scrollIntoView)}let i=t.facet(Z);for(let n=i.length-1;n>=0;n--){let r=i[n](e);e=r instanceof oe?r:Array.isArray(r)&&1==r.length&&r[0]instanceof oe?r[0]:ce(t,ue(r),!1)}return e}(r):r)}oe.time=te.define(),oe.userEvent=te.define(),oe.addToHistory=te.define(),oe.remote=te.define();const he=[];function ue(e){return null==e?he:Array.isArray(e)?e:[e]}var de=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(de||(de={}));const fe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let pe;try{pe=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(e){}class me{constructor(e,t,n,i,r,o){this.config=e,this.doc=t,this.selection=n,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let e=0;e<this.config.dynamicSlots.length;e++)U(this,e<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(null!=n)return U(this,n),$(this,n);if(t)throw new RangeError("Field is not present in this state")}update(...e){return ce(this,e,!0)}applyTransaction(e){let t,n=this.config,{base:i,compartments:r}=n;for(let t of e.effects)t.is(j.reconfigure)?(n&&(r=new Map,n.compartments.forEach((e,t)=>r.set(t,e)),n=null),r.set(t.value.compartment,t.value.extension)):t.is(re.reconfigure)?(n=null,i=t.value):t.is(re.appendConfig)&&(n=null,i=ue(i).concat(t.value));n?t=e.startState.values.slice():(n=_.resolve(i,r,this),t=new me(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(e,t)=>t.reconfigure(e,this),null).values);let o=e.startState.facet(G)?e.newSelection:e.newSelection.asSingle();new me(n,e.newDoc,o,t,(t,n)=>n.update(t,e),e)}replaceSelection(e){return"string"==typeof e&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:D.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),i=this.changes(n.changes),r=[n.range],o=ue(n.effects);for(let n=1;n<t.ranges.length;n++){let s=e(t.ranges[n]),a=this.changes(s.changes),l=a.map(i);for(let e=0;e<n;e++)r[e]=r[e].map(l);let c=i.mapDesc(a,!0);r.push(s.range.map(c)),i=i.compose(l),o=re.mapEffects(o,l).concat(re.mapEffects(ue(s.effects),c))}return{changes:i,selection:D.create(r,t.mainIndex),effects:o}}changes(e=[]){return e instanceof k?e:k.of(e,this.doc.length,this.facet(me.lineSeparator))}toText(e){return r.of(e.split(this.facet(me.lineSeparator)||y))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return null==t?e.default:(U(this,t),$(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let i=e[n];i instanceof W&&null!=this.config.address[i.id]&&(t[n]=i.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(e,t={},n){if(!e||"string"!=typeof e.doc)throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(n)for(let t in n)if(Object.prototype.hasOwnProperty.call(e,t)){let r=n[t],o=e[t];i.push(r.init(e=>r.spec.fromJSON(o,e)))}return me.create({doc:e.doc,selection:D.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=_.resolve(e.extensions||[],new Map),n=e.doc instanceof r?e.doc:r.of((e.doc||"").split(t.staticFacet(me.lineSeparator)||y)),i=e.selection?e.selection instanceof D?e.selection:D.single(e.selection.anchor,e.selection.head):D.single(0);return L(i,n.length),t.staticFacet(G)||(i=i.asSingle()),new me(t,n,i,t.dynamicSlots.map(()=>null),(e,t)=>t.create(e),null)}get tabSize(){return this.facet(me.tabSize)}get lineBreak(){return this.facet(me.lineSeparator)||"\n"}get readOnly(){return this.facet(ee)}phrase(e,...t){for(let t of this.facet(me.phrases))if(Object.prototype.hasOwnProperty.call(t,e)){e=t[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(e,n)=>{if("$"==n)return"$";let i=+(n||1);return!i||i>t.length?e:t[i-1]})),e}languageDataAt(e,t,n=-1){let i=[];for(let r of this.facet(Y))for(let o of r(this,t,n))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return n=t.length?t[0]:"",e=>{if(!/\S/.test(e))return de.Space;if(function(e){if(pe)return pe.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||fe.test(n)))return!0}return!1}(e))return de.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return de.Word;return de.Other};var n}wordAt(e){let{text:t,from:n,length:i}=this.doc.lineAt(e),r=this.charCategorizer(e),o=e-n,s=e-n;for(;o>0;){let e=p(t,o,!1);if(r(t.slice(e,o))!=de.Word)break;o=e}for(;s<i;){let e=p(t,s);if(r(t.slice(s,e))!=de.Word)break;s=e}return o==s?null:D.range(o+n,s+n)}}function ge(e,t,n={}){let i={};for(let t of e)for(let e of Object.keys(t)){let r=t[e],o=i[e];if(void 0===o)i[e]=r;else if(o===r||void 0===r);else{if(!Object.hasOwnProperty.call(n,e))throw new Error("Config merge conflict for field "+e);i[e]=n[e](o,r)}}for(let e in t)void 0===i[e]&&(i[e]=t[e]);return i}me.allowMultipleSelections=G,me.tabSize=E.define({combine:e=>e.length?e[0]:4}),me.lineSeparator=X,me.readOnly=ee,me.phrases=E.define({compare(e,t){let n=Object.keys(e),i=Object.keys(t);return n.length==i.length&&n.every(n=>e[n]==t[n])}}),me.languageData=Y,me.changeFilter=J,me.transactionFilter=Z,me.transactionExtender=Q,j.reconfigure=re.define();class be{eq(e){return this==e}range(e,t=e){return ve.create(e,t,this)}}function ye(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}be.prototype.startSide=be.prototype.endSide=0,be.prototype.point=!1,be.prototype.mapMode=v.TrackDel;class ve{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new ve(e,t,n)}}function we(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class ke{constructor(e,t,n,i){this.from=e,this.to=t,this.value=n,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,i=0){let r=n?this.to:this.from;for(let o=i,s=r.length;;){if(o==s)return o;let i=o+s>>1,a=r[i]-e||(n?this.value[i].endSide:this.value[i].startSide)-t;if(i==o)return a>=0?o:s;a>=0?s=i:o=i+1}}between(e,t,n,i){for(let r=this.findIndex(t,-1e9,!0),o=this.findIndex(n,1e9,!1,r);r<o;r++)if(!1===i(this.from[r]+e,this.to[r]+e,this.value[r]))return!1}map(e,t){let n=[],i=[],r=[],o=-1,s=-1;for(let a=0;a<this.value.length;a++){let l,c,h=this.value[a],u=this.from[a]+e,d=this.to[a]+e;if(u==d){let e=t.mapPos(u,h.startSide,h.mapMode);if(null==e)continue;if(l=c=e,h.startSide!=h.endSide&&(c=t.mapPos(u,h.endSide),c<l))continue}else if(l=t.mapPos(u,h.startSide),c=t.mapPos(d,h.endSide),l>c||l==c&&h.startSide>0&&h.endSide<=0)continue;(c-l||h.endSide-h.startSide)<0||(o<0&&(o=l),h.point&&(s=Math.max(s,c-l)),n.push(h),i.push(l-o),r.push(c-o))}return{mapped:n.length?new ke(i,r,n,s):null,pos:o}}}class xe{constructor(e,t,n,i){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=i}static create(e,t,n,i){return new xe(e,t,n,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:i=0,filterTo:r=this.length}=e,o=e.filter;if(0==t.length&&!o)return this;if(n&&(t=t.slice().sort(we)),this.isEmpty)return t.length?xe.of(t):this;let s=new Ae(this,null,-1).goto(0),a=0,l=[],c=new Se;for(;s.value||a<t.length;)if(a<t.length&&(s.from-t[a].from||s.startSide-t[a].value.startSide)>=0){let e=t[a++];c.addInner(e.from,e.to,e.value)||l.push(e)}else 1==s.rangeIndex&&s.chunkIndex<this.chunk.length&&(a==t.length||this.chunkEnd(s.chunkIndex)<t[a].from)&&(!o||i>this.chunkEnd(s.chunkIndex)||r<this.chunkPos[s.chunkIndex])&&c.addChunk(this.chunkPos[s.chunkIndex],this.chunk[s.chunkIndex])?s.nextChunk():((!o||i>s.to||r<s.from||o(s.from,s.to,s.value))&&(c.addInner(s.from,s.to,s.value)||l.push(ve.create(s.from,s.to,s.value))),s.next());return c.finishInner(this.nextLayer.isEmpty&&!l.length?xe.empty:this.nextLayer.update({add:l,filter:o,filterFrom:i,filterTo:r}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],i=-1;for(let r=0;r<this.chunk.length;r++){let o=this.chunkPos[r],s=this.chunk[r],a=e.touchesRange(o,o+s.length);if(!1===a)i=Math.max(i,s.maxPoint),t.push(s),n.push(e.mapPos(o));else if(!0===a){let{mapped:r,pos:a}=s.map(o,e);r&&(i=Math.max(i,r.maxPoint),t.push(r),n.push(a))}}let r=this.nextLayer.map(e);return 0==t.length?r:new xe(n,t,r||xe.empty,i)}between(e,t,n){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let r=this.chunkPos[i],o=this.chunk[i];if(t>=r&&e<=r+o.length&&!1===o.between(r,e-r,t-r,n))return}this.nextLayer.between(e,t,n)}}iter(e=0){return Me.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Me.from(e).goto(t)}static compare(e,t,n,i,r=-1){let o=e.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=r),s=t.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=r),a=Ce(o,s,n),l=new Oe(o,a,r),c=new Oe(s,a,r);n.iterGaps((e,t,n)=>De(l,e,c,t,n,i)),n.empty&&0==n.length&&De(l,0,c,0,0,i)}static eq(e,t,n=0,i){null==i&&(i=999999999);let r=e.filter(e=>!e.isEmpty&&t.indexOf(e)<0),o=t.filter(t=>!t.isEmpty&&e.indexOf(t)<0);if(r.length!=o.length)return!1;if(!r.length)return!0;let s=Ce(r,o),a=new Oe(r,s,0).goto(n),l=new Oe(o,s,0).goto(n);for(;;){if(a.to!=l.to||!Le(a.active,l.active)||a.point&&(!l.point||!ye(a.point,l.point)))return!1;if(a.to>i)return!0;a.next(),l.next()}}static spans(e,t,n,i,r=-1){let o=new Oe(e,null,r).goto(t),s=t,a=o.openStart;for(;;){let e=Math.min(o.to,n);if(o.point){let n=o.activeForPoint(o.to),r=o.pointFrom<t?n.length+1:o.point.startSide<0?n.length:Math.min(n.length,a);i.point(s,e,o.point,n,r,o.pointRank),a=Math.min(o.openEnd(e),n.length)}else e>s&&(i.span(s,e,o.active,a),a=o.openEnd(e));if(o.to>n)return a+(o.point&&o.to>n?1:0);s=o.to,o.next()}}static of(e,t=!1){let n=new Se;for(let i of e instanceof ve?[e]:t?function(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let i=e[n];if(we(t,i)>0)return e.slice().sort(we);t=i}return e}(e):e)n.add(i.from,i.to,i.value);return n.finish()}static join(e){if(!e.length)return xe.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let i=e[n];i!=xe.empty;i=i.nextLayer)t=new xe(i.chunkPos,i.chunk,t,Math.max(i.maxPoint,t.maxPoint));return t}}xe.empty=new xe([],[],null,-1),xe.empty.nextLayer=xe.empty;class Se{finishChunk(e){this.chunks.push(new ke(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new Se)).add(e,t,n)}addInner(e,t,n){let i=e-this.lastTo||n.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(i<0||(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),0))}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(xe.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return e;let t=xe.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Ce(e,t,n){let i=new Map;for(let t of e)for(let e=0;e<t.chunk.length;e++)t.chunk[e].maxPoint<=0&&i.set(t.chunk[e],t.chunkPos[e]);let r=new Set;for(let e of t)for(let t=0;t<e.chunk.length;t++){let o=i.get(e.chunk[t]);null==o||(n?n.mapPos(o):o)!=e.chunkPos[t]||(null==n?void 0:n.touchesRange(o,o+e.chunk[t].length))||r.add(e.chunk[t])}return r}class Ae{constructor(e,t,n,i=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=i}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){for(;this.chunkIndex<this.layer.chunk.length;){let t=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(t)||this.layer.chunkEnd(this.chunkIndex)<e||t.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<i)&&this.setRangeIndex(i)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Me{constructor(e){this.heap=e}static from(e,t=null,n=-1){let i=[];for(let r=0;r<e.length;r++)for(let o=e[r];!o.isEmpty;o=o.nextLayer)o.maxPoint>=n&&i.push(new Ae(o,t,n,r));return 1==i.length?i[0]:new Me(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)Te(this.heap,e);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)Te(this.heap,e);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Te(this.heap,0)}}}function Te(e,t){for(let n=e[t];;){let i=1+(t<<1);if(i>=e.length)break;let r=e[i];if(i+1<e.length&&r.compare(e[i+1])>=0&&(r=e[i+1],i++),n.compare(r)<0)break;e[i]=n,e[t]=r,t=i}}class Oe{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Me.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){ze(this.active,e),ze(this.activeTo,e),ze(this.activeRank,e),this.minActive=Be(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:i,rank:r}=this.cursor;for(;t<this.activeRank.length&&(r-this.activeRank[t]||i-this.activeTo[t])>0;)t++;Ee(this.active,t,n),Ee(this.activeTo,t,i),Ee(this.activeRank,t,r),e&&Ee(e,t,this.cursor.from),this.minActive=Be(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&ze(n,i)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let e=this.cursor.value;if(e.point){if(!(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)){this.point=e,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=e.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}this.cursor.next()}else this.addActive(n),this.cursor.next()}}}if(n){this.openStart=0;for(let t=n.length-1;t>=0&&n[t]<e;t--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function De(e,t,n,i,r,o){e.goto(t),n.goto(i);let s=i+r,a=i,l=i-t,c=!!o.boundChange;for(let t=!1;;){let i=e.to+l-n.to,r=i||e.endSide-n.endSide,h=r<0?e.to+l:n.to,u=Math.min(h,s);if(e.point||n.point?(e.point&&n.point&&ye(e.point,n.point)&&Le(e.activeForPoint(e.to),n.activeForPoint(n.to))||o.comparePoint(a,u,e.point,n.point),t=!1):(t&&o.boundChange(a),u>a&&!Le(e.active,n.active)&&o.compareRange(a,u,e.active,n.active),c&&u<s&&(i||e.openEnd(h)!=n.openEnd(h))&&(t=!0)),h>s)break;a=h,r<=0&&e.next(),r>=0&&n.next()}}function Le(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!ye(e[n],t[n]))return!1;return!0}function ze(e,t){for(let n=t,i=e.length-1;n<i;n++)e[n]=e[n+1];e.pop()}function Ee(e,t,n){for(let n=e.length-1;n>=t;n--)e[n+1]=e[n];e[t]=n}function Be(e,t){let n=-1,i=1e9;for(let r=0;r<t.length;r++)(t[r]-i||e[r].endSide-e[n].endSide)<0&&(n=r,i=t[r]);return n}function Re(e,t,n=e.length){let i=0;for(let r=0;r<n&&r<e.length;)9==e.charCodeAt(r)?(i+=t-i%t,r++):(i++,r=p(e,r));return i}function Pe(e,t,n,i){for(let i=0,r=0;;){if(r>=t)return i;if(i==e.length)break;r+=9==e.charCodeAt(i)?n-r%n:1,i=p(e,i)}return!0===i?-1:e.length}n.d(t,["Nb",0,q])},9747(e,t,n){n.d(t,{$G:()=>Ni,$K:()=>ko,A:()=>$i,BE:()=>sr,C3:()=>jr,D4:()=>pr,Eg:()=>Ir,HJ:()=>br,Hm:()=>ao,Ip:()=>Di,Lz:()=>pi,N$:()=>tr,NZ:()=>M,OP:()=>ne,Pq:()=>qr,TS:()=>Ai,Ux:()=>Rr,VH:()=>Ii,Wu:()=>Ao,X3:()=>tt,Yq:()=>Lo,Z9:()=>qe,_B:()=>A,ab:()=>Pr,cU:()=>oo,c_:()=>Ne,dT:()=>Gi,dz:()=>ar,l_:()=>E,ld:()=>Kr,n6:()=>Nr,qd:()=>Ri,qf:()=>ur,rC:()=>Xr,tF:()=>de,uF:()=>On,ui:()=>Gr,ut:()=>Hr,vX:()=>wr,wJ:()=>eo,wu:()=>Eo,xO:()=>C});var i=n(2701),r=n(2951),o=n(396),s=n(9786);let a="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},l="undefined"!=typeof document?document:{documentElement:{style:{}}};const c=/Edge\/(\d+)/.exec(a.userAgent),h=/MSIE \d/.test(a.userAgent),u=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(a.userAgent),d=!!(h||u||c),f=!d&&/gecko\/(\d+)/i.test(a.userAgent),p=!d&&/Chrome\/(\d+)/.exec(a.userAgent),m="webkitFontSmoothing"in l.documentElement.style,g=!d&&/Apple Computer/.test(a.vendor),b=g&&(/Mobile\/\w+/.test(a.userAgent)||a.maxTouchPoints>2);var y={mac:b||/Mac/.test(a.platform),windows:/Win/.test(a.platform),linux:/Linux|X11/.test(a.platform),ie:d,ie_version:h?l.documentMode||6:u?+u[1]:c?+c[1]:0,gecko:f,gecko_version:f?+(/Firefox\/(\d+)/.exec(a.userAgent)||[0,0])[1]:0,chrome:!!p,chrome_version:p?+p[1]:0,ios:b,android:/Android\b/.test(a.userAgent),webkit:m,webkit_version:m?+(/\bAppleWebKit\/(\d+)/.exec(a.userAgent)||[0,0])[1]:0,safari:g,safari_version:g?+(/\bVersion\/(\d+(\.\d+)?)/.exec(a.userAgent)||[0,0])[1]:0,tabSize:null!=l.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};function v(e,t){for(let n in e)"class"==n&&t.class?t.class+=" "+e.class:"style"==n&&t.style?t.style+=";"+e.style:t[n]=e[n];return t}const w=Object.create(null);function k(e,t,n){if(e==t)return!0;e||(e=w),t||(t=w);let i=Object.keys(e),r=Object.keys(t);if(i.length-(n&&i.indexOf(n)>-1?1:0)!=r.length-(n&&r.indexOf(n)>-1?1:0))return!1;for(let o of i)if(o!=n&&(-1==r.indexOf(o)||e[o]!==t[o]))return!1;return!0}function x(e,t,n){let i=!1;if(t)for(let r in t)n&&r in n||(i=!0,"style"==r?e.style.cssText="":e.removeAttribute(r));if(n)for(let r in n)t&&t[r]==n[r]||(i=!0,"style"==r?e.style.cssText=n[r]:e.setAttribute(r,n[r]));return i}function S(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let i=e.attributes[n];t[i.name]=i.value}return t}class C{eq(e){return!1}updateDOM(e,t,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var A=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(A||(A={}));class M extends i.FB{constructor(e,t,n,i){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=i}get heightRelevant(){return!1}static mark(e){return new T(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new D(e,t,t,n,e.widget||null,!1)}static replace(e){let t,n,i=!!e.block;if(e.isBlockGap)t=-5e8,n=4e8;else{let{start:r,end:o}=L(e,i);t=(r?i?-3e8:-1:5e8)-1,n=1+(o?i?2e8:1:-6e8)}return new D(e,t,n,i,e.widget||null,!0)}static line(e){return new O(e)}static set(e,t=!1){return i.om.of(e,t)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}M.none=i.om.empty;class T extends M{constructor(e){let{start:t,end:n}=L(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?v(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||w}eq(e){return this==e||e instanceof T&&this.tagName==e.tagName&&k(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}T.prototype.point=!1;class O extends M{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof O&&this.spec.class==e.spec.class&&k(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}O.prototype.mapMode=i.iR.TrackBefore,O.prototype.point=!0;class D extends M{constructor(e,t,n,r,o,s){super(t,n,o,e),this.block=r,this.isReplace=s,this.mapMode=r?t<=0?i.iR.TrackBefore:i.iR.TrackAfter:i.iR.TrackDel}get type(){return this.startSide!=this.endSide?A.WidgetRange:this.startSide<=0?A.WidgetBefore:A.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof D&&((t=this.widget)==(n=e.widget)||!!(t&&n&&t.compare(n)))&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide;var t,n}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}function L(e,t=!1){let{inclusiveStart:n,inclusiveEnd:i}=e;return null==n&&(n=e.inclusive),null==i&&(i=e.inclusive),{start:null!=n?n:t,end:null!=i?i:t}}function z(e,t,n,i=0){let r=n.length-1;r>=0&&n[r]+i>=e?n[r]=Math.max(n[r],t):n.push(e,t)}D.prototype.point=!0;class E extends i.FB{constructor(e,t,n){super(),this.tagName=e,this.attributes=t,this.rank=n}eq(e){return e==this||e instanceof E&&this.tagName==e.tagName&&k(this.attributes,e.attributes)}static create(e){return new E(e.tagName,e.attributes||w,null==e.rank?50:Math.max(0,Math.min(e.rank,100)))}static set(e,t=!1){return i.om.of(e,t)}}function B(e){let t;return t=11==e.nodeType?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function R(e,t){return!!t&&(e==t||e.contains(1!=t.nodeType?t.parentNode:t))}function P(e,t){if(!t.anchorNode)return!1;try{return R(e,t.anchorNode)}catch(e){return!1}}function I(e){return 3==e.nodeType?X(e,0,e.nodeValue.length).getClientRects():1==e.nodeType?e.getClientRects():[]}function N(e,t,n,i){return!!n&&(H(e,t,n,i,-1)||H(e,t,n,i,1))}function F(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t}function W(e){return 1==e.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function H(e,t,n,i,r){for(;;){if(e==n&&t==i)return!0;if(t==(r<0?0:q(e))){if("DIV"==e.nodeName)return!1;let n=e.parentNode;if(!n||1!=n.nodeType)return!1;t=F(e)+(r<0?0:1),e=n}else{if(1!=e.nodeType)return!1;if(1==(e=e.childNodes[t+(r<0?-1:0)]).nodeType&&"false"==e.contentEditable)return!1;t=r<0?q(e):0}}}function q(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function V(e,t){let{left:n,right:i}=e;if(n==i)return e;let r=t?n:i;return{left:r,right:r,top:e.top,bottom:e.bottom}}function j(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function K(e,t){let n=t.width/e.offsetWidth,i=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(t.height-e.offsetHeight)<1)&&(i=1),{scaleX:n,scaleY:i}}function _(e,t=!0){let n=e.ownerDocument,i=null,r=null;for(let o=e.parentNode;o&&o!=n.body&&(t&&!i||!r);)if(1==o.nodeType)!r&&o.scrollHeight>o.clientHeight&&(r=o),t&&!i&&o.scrollWidth>o.clientWidth&&(i=o),o=o.assignedSlot||o.parentNode;else{if(11!=o.nodeType)break;o=o.host}return{x:i,y:r}}E.prototype.startSide=E.prototype.endSide=-1;class U{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?q(t):0),n,Math.min(e.focusOffset,n?q(n):0))}set(e,t,n,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=i}}let $,Y=null;function G(e){if(e.setActive)return e.setActive();if(Y)return e.focus(Y);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(null==Y?{get preventScroll(){return Y={preventScroll:!0},!0}}:void 0),!Y){Y=!1;for(let e=0;e<t.length;){let n=t[e++],i=t[e++],r=t[e++];n.scrollTop!=i&&(n.scrollTop=i),n.scrollLeft!=r&&(n.scrollLeft=r)}}}function X(e,t,n=t){let i=$||($=document.createRange());return i.setEnd(e,n),i.setStart(e,t),i}function J(e,t,n,i){let r={key:t,code:t,keyCode:n,which:n,cancelable:!0};i&&({altKey:r.altKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,metaKey:r.metaKey}=i);let o=new KeyboardEvent("keydown",r);o.synthetic=!0,e.dispatchEvent(o);let s=new KeyboardEvent("keyup",r);return s.synthetic=!0,e.dispatchEvent(s),o.defaultPrevented||s.defaultPrevented}function Z(e){return e instanceof Window?e.pageYOffset>Math.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4):e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function Q(e,t){for(let n=e,i=t;;){if(3==n.nodeType&&i>0)return{node:n,offset:i};if(1==n.nodeType&&i>0){if("false"==n.contentEditable)return null;n=n.childNodes[i-1],i=q(n)}else{if(!n.parentNode||W(n))return null;i=F(n),n=n.parentNode}}}function ee(e,t){for(let n=e,i=t;;){if(3==n.nodeType&&i<n.nodeValue.length)return{node:n,offset:i};if(1==n.nodeType&&i<n.childNodes.length){if("false"==n.contentEditable)return null;n=n.childNodes[i],i=0}else{if(!n.parentNode||W(n))return null;i=F(n)+1,n=n.parentNode}}}y.safari&&y.safari_version>=26&&(Y=!1);class te{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new te(e.parentNode,F(e),t)}static after(e,t){return new te(e.parentNode,F(e)+1,t)}}var ne=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(ne||(ne={}));const ie=ne.LTR,re=ne.RTL;function oe(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}const se=oe("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),ae=oe("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),le=Object.create(null),ce=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);le[t]=n,le[n]=-t}function he(e){return e<=247?se[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?ae[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}const ue=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class de{get dir(){return this.level%2?re:ie}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,i){let r=-1;for(let o=0;o<e.length;o++){let s=e[o];if(s.from<=t&&s.to>=t){if(s.level==n)return o;(r<0||(0!=i?i<0?s.from<t:s.to>t:e[r].level>s.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}}function fe(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],r=t[n];if(i.from!=r.from||i.to!=r.to||i.direction!=r.direction||!fe(i.inner,r.inner))return!1}return!0}const pe=[];function me(e,t,n,i,r,o,s){let a=i%2?2:1;if(i%2==r%2)for(let l=t,c=0;l<n;){let t=!0,h=!1;if(c==o.length||l<o[c].from){let e=pe[l];e!=a&&(t=!1,h=16==e)}let u=t||1!=a?null:[],d=t?i:i+1,f=l;e:for(;;)if(c<o.length&&f==o[c].from){if(h)break e;let p=o[c];if(!t)for(let e=p.to,t=c+1;;){if(e==n)break e;if(!(t<o.length&&o[t].from==e)){if(pe[e]==a)break e;break}e=o[t++].to}c++,u?u.push(p):(p.from>l&&s.push(new de(l,p.from,d)),ge(e,p.direction==ie!=!(d%2)?i+1:i,r,p.inner,p.from,p.to,s),l=p.to),f=p.to}else{if(f==n||(t?pe[f]!=a:pe[f]==a))break;f++}u?me(e,l,f,i+1,r,u,s):l<f&&s.push(new de(l,f,d)),l=f}else for(let l=n,c=o.length;l>t;){let n=!0,h=!1;if(!c||l>o[c-1].to){let e=pe[l-1];e!=a&&(n=!1,h=16==e)}let u=n||1!=a?null:[],d=n?i:i+1,f=l;e:for(;;)if(c&&f==o[c-1].to){if(h)break e;let p=o[--c];if(!n)for(let e=p.from,n=c;;){if(e==t)break e;if(!n||o[n-1].to!=e){if(pe[e-1]==a)break e;break}e=o[--n].from}u?u.push(p):(p.to<l&&s.push(new de(p.to,l,d)),ge(e,p.direction==ie!=!(d%2)?i+1:i,r,p.inner,p.from,p.to,s),l=p.from),f=p.from}else{if(f==t||(n?pe[f-1]!=a:pe[f-1]==a))break;f--}u?me(e,f,l,i+1,r,u,s):f<l&&s.push(new de(f,l,d)),l=f}}function ge(e,t,n,i,r,o,s){let a=t%2?2:1;!function(e,t,n,i,r){for(let o=0;o<=i.length;o++){let s=o?i[o-1].to:t,a=o<i.length?i[o].from:n,l=o?256:r;for(let t=s,n=l,i=l;t<a;t++){let r=he(e.charCodeAt(t));512==r?r=n:8==r&&4==i&&(r=16),pe[t]=4==r?2:r,7&r&&(i=r),n=r}for(let e=s,t=l,i=l;e<a;e++){let r=pe[e];if(128==r)e<a-1&&t==pe[e+1]&&24&t?r=pe[e]=t:pe[e]=256;else if(64==r){let r=e+1;for(;r<a&&64==pe[r];)r++;let o=e&&8==t||r<n&&8==pe[r]?1==i?1:8:256;for(let t=e;t<r;t++)pe[t]=o;e=r-1}else 8==r&&1==i&&(pe[e]=1);t=r,7&r&&(i=r)}}}(e,r,o,i,a),function(e,t,n,i,r){let o=1==r?2:1;for(let s=0,a=0,l=0;s<=i.length;s++){let c=s?i[s-1].to:t,h=s<i.length?i[s].from:n;for(let t,n,i,s=c;s<h;s++)if(n=le[t=e.charCodeAt(s)])if(n<0){for(let e=a-3;e>=0;e-=3)if(ce[e+1]==-n){let t=ce[e+2],n=2&t?r:4&t?1&t?o:r:0;n&&(pe[s]=pe[ce[e]]=n),a=e;break}}else{if(189==ce.length)break;ce[a++]=s,ce[a++]=t,ce[a++]=l}else if(2==(i=pe[s])||1==i){let e=i==r;l=e?0:1;for(let t=a-3;t>=0;t-=3){let n=ce[t+2];if(2&n)break;if(e)ce[t+2]|=2;else{if(4&n)break;ce[t+2]|=4}}}}}(e,r,o,i,a),function(e,t,n,i){for(let r=0,o=i;r<=n.length;r++){let s=r?n[r-1].to:e,a=r<n.length?n[r].from:t;for(let l=s;l<a;){let s=pe[l];if(256==s){let s=l+1;for(;;)if(s==a){if(r==n.length)break;s=n[r++].to,a=r<n.length?n[r].from:t}else{if(256!=pe[s])break;s++}let c=1==o,h=c==(1==(s<t?pe[s]:i))?c?1:2:i;for(let t=s,i=r,o=i?n[i-1].to:e;t>l;)t==o&&(t=n[--i].from,o=i?n[i-1].to:e),pe[--t]=h;l=s}else o=s,l++}}}(r,o,i,a),me(e,r,o,t,n,i,s)}function be(e,t,n){if(!e)return[new de(0,0,t==re?1:0)];if(t==ie&&!n.length&&!ue.test(e))return ye(e.length);if(n.length)for(;e.length>pe.length;)pe[pe.length]=256;let i=[],r=t==ie?0:1;return ge(e,r,r,n,0,e.length,i),i}function ye(e){return[new de(0,e,0)]}let ve="";function we(e,t,n,r,o){var s;let a=r.head-e.from,l=de.find(t,a,null!==(s=r.bidiLevel)&&void 0!==s?s:-1,r.assoc),c=t[l],h=c.side(o,n);if(a==h){let e=l+=o?1:-1;if(e<0||e>=t.length)return null;c=t[l=e],a=c.side(!o,n),h=c.side(o,n)}let u=(0,i.zK)(e.text,a,c.forward(o,n));(u<c.from||u>c.to)&&(u=h),ve=e.text.slice(Math.min(a,u),Math.max(a,u));let d=l==(o?t.length-1:0)?null:t[l+(o?1:-1)];return d&&u==h&&d.level+(o?0:1)<c.level?i.OF.cursor(d.side(!o,n)+e.from,d.forward(o,n)?1:-1,d.level):i.OF.cursor(u+e.from,c.forward(o,n)?-1:1,c.level)}function ke(e,t,n){for(let i=t;i<n;i++){let t=he(e.charCodeAt(i));if(1==t)return ie;if(2==t||4==t)return re}return ie}const xe=i.sj.define(),Se=i.sj.define(),Ce=i.sj.define(),Ae=i.sj.define(),Me=i.sj.define(),Te=i.sj.define(),Oe=i.sj.define(),De=i.sj.define(),Le=i.sj.define(),ze=i.sj.define({combine:e=>e.some(e=>e)}),Ee=i.sj.define({combine:e=>e.some(e=>e)}),Be=i.sj.define();class Re{constructor(e,t,n,i,r,o=!1){this.range=e,this.y=t,this.x=n,this.yMargin=i,this.xMargin=r,this.isSnapshot=o}map(e){return e.empty?this:new Re(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Re(i.OF.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Pe=i.Pe.define({map:(e,t)=>e.map(t)}),Ie=i.Pe.define();function Ne(e,t,n){let i=e.facet(Ae);i.length?i[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+":",t):console.error(t))}const Fe=i.sj.define({combine:e=>!e.length||e[0]});let We=0;const He=i.sj.define({combine:e=>e.filter((t,n)=>{for(let i=0;i<n;i++)if(e[i].plugin==t.plugin)return!1;return!0})});class qe{constructor(e,t,n,i,r){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=i,this.baseExtensions=r(this),this.extension=this.baseExtensions.concat(He.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(He.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:n,eventObservers:i,provide:r,decorations:o}=t||{};return new qe(We++,e,n,i,e=>{let t=[];return o&&t.push(_e.of(t=>{let n=t.plugin(e);return n?o(n):M.none})),r&&t.push(r(e)),t})}static fromClass(e,t){return qe.define((t,n)=>new e(t,n),t)}}class Ve{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(Ne(e.state,t,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(e){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Ne(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(null===(t=this.value)||void 0===t?void 0:t.destroy)try{this.value.destroy()}catch(t){Ne(e.state,t,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const je=i.sj.define(),Ke=i.sj.define(),_e=i.sj.define(),Ue=i.sj.define(),$e=i.sj.define(),Ye=i.sj.define(),Ge=i.sj.define();function Xe(e,t){let n=e.state.facet(Ge);if(!n.length)return n;let r=n.map(t=>t instanceof Function?t(e):t),o=[];return i.om.spans(r,t.from,t.to,{point(){},span(e,n,i,r){let s=e-t.from,a=n-t.from,l=o;for(let e=i.length-1;e>=0;e--,r--){let n,o=i[e].spec.bidiIsolate;if(null==o&&(o=ke(t.text,s,a)),r>0&&l.length&&(n=l[l.length-1]).to==s&&n.direction==o)n.to=a,l=n.inner;else{let e={from:s,to:a,direction:o,inner:[]};l.push(e),l=e.inner}}}}),o}const Je=i.sj.define();function Ze(e){let t=0,n=0,i=0,r=0;for(let o of e.state.facet(Je)){let s=o(e);s&&(null!=s.left&&(t=Math.max(t,s.left)),null!=s.right&&(n=Math.max(n,s.right)),null!=s.top&&(i=Math.max(i,s.top)),null!=s.bottom&&(r=Math.max(r,s.bottom)))}return{left:t,right:n,top:i,bottom:r}}const Qe=i.sj.define();class et{constructor(e,t,n,i){this.fromA=e,this.toA=t,this.fromB=n,this.toB=i}join(e){return new et(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let i=e[t-1];if(!(i.fromA>n.toA)){if(i.toA<n.fromA)break;n=n.join(i),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(0==t.length)return e;let n=[];for(let i=0,r=0,o=0;;){let s=i<e.length?e[i].fromB:1e9,a=r<t.length?t[r]:1e9,l=Math.min(s,a);if(1e9==l)break;let c=l+o,h=l,u=c;for(;;)if(r<t.length&&t[r]<=h){let n=t[r+1];r+=2,h=Math.max(h,n);for(let t=i;t<e.length&&e[t].fromB<=h;t++)o=e[t].toA-e[t].toB;u=Math.max(u,n+o)}else{if(!(i<e.length&&e[i].fromB<=h))break;{let t=e[i++];h=Math.max(h,t.toB),u=Math.max(u,t.toA),o=t.toA-t.toB}}n.push(new et(c,u,l,h))}return n}}class tt{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=i.VR.empty(this.startState.doc.length);for(let e of n)this.changes=this.changes.compose(e.changes);let r=[];this.changes.iterChangedRanges((e,t,n,i)=>r.push(new et(e,t,n,i))),this.changedRanges=r}static create(e,t,n){return new tt(e,t,n)}get viewportChanged(){return(4&this.flags)>0}get viewportMoved(){return(8&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(18&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return 0==this.flags&&0==this.transactions.length}}const nt=[];class it{constructor(e,t,n=0){this.dom=e,this.length=t,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return 1&this.flags}get children(){return nt}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,4&this.flags){this.flags&=-5;let e=this.domAttrs;e&&function(e,t){for(let n=e.attributes.length-1;n>=0;n--){let i=e.attributes[n].name;null==t[i]&&e.removeAttribute(i)}for(let n in t){let i=t[n];"style"==n?e.style.cssText=i:e.getAttribute(n)!=i&&e.setAttribute(n,i)}}(this.dom,e)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let n=t;for(let t of this.children){if(t==e)return n;n+=t.length+t.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t,n){return null}domPosFor(e,t){let n=F(this.dom),i=this.length?e>0:t>0;return new te(this.parent.dom,n+(i?1:0),0==e||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&2&this.parent.flags&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof st)return e;return null}static get(e){return e.cmTile}}class rt extends it{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(2&this.flags)return;super.sync(e);let t,n=this.dom,i=null,r=(null==e?void 0:e.node)==n?e:null,o=0;for(let s of this.children){if(s.sync(e),o+=s.length+s.breakAfter,t=i?i.nextSibling:n.firstChild,r&&t!=s.dom&&(r.written=!0),s.dom.parentNode==n)for(;t&&t!=s.dom;)t=ot(t);else n.insertBefore(s.dom,t);i=s.dom}for(t=i?i.nextSibling:n.firstChild,r&&t&&(r.written=!0);t;)t=ot(t);this.length=o}}function ot(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class st extends rt{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=it.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],n=this,i=0,r=0;;)if(i==n.children.length){if(!t.length)return;n=n.parent,n.breakAfter&&r++,i=t.pop()}else{let o=n.children[i++];if(o instanceof at)t.push(i),n=o,i=0;else{let t=r+o.length,n=e(o,r);if(void 0!==n)return n;r=t+o.breakAfter}}}resolveBlock(e,t){let n,i,r=-1,o=-1;if(this.blockTiles((s,a)=>{let l=a+s.length;if(e>=a&&e<=l){if(s.isWidget()&&t>=-1&&t<=1){if(32&s.flags)return!0;16&s.flags&&(n=void 0)}(a<e||e==l&&(t<-1?s.length:s.covers(1)))&&(!n||!s.isWidget()&&n.isWidget())&&(n=s,r=e-a),(l>e||e==a&&(t>1?s.length:s.covers(-1)))&&(!i||!s.isWidget()&&i.isWidget())&&(i=s,o=e-a)}}),!n&&!i)throw new Error("No tile at position "+e);return n&&t<0||!i?{tile:n,offset:r}:{tile:i,offset:o}}}class at extends rt{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return!!this.children.length&&(e<0?this.children[0].covers(-1):this.lastChild.covers(1))}get domAttrs(){return this.wrapper.attributes}static of(e,t){let n=new at(t||document.createElement(e.tagName),e);return t||(n.flags|=4),n}}class lt extends rt{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,n){let i=new lt(t||document.createElement("div"),e);return t&&n||(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,t,n){let i=null,r=-1,o=null,s=-1;!function e(a,l){for(let c=0,h=0;c<a.children.length&&h<=l;c++){let u=a.children[c],d=h+u.length;d>=l&&(u.isComposite()?e(u,l-h):(!o||o.isHidden&&(t>0&&!(32&o.flags)||n&&ct(o,u)))&&(d>l||32&u.flags&&t<=1)?(o=u,s=l-h):(h<l||16&u.flags&&!u.isHidden&&t>=-1)&&(i=u,r=l-h)),h=d}}(this,e);let a=(t<0?i:o)||i||o;return a?{tile:a,offset:a==i?r:s}:null}coordsIn(e,t,n){let i=this.resolveInline(e,t,!0);return i?i.tile.coordsIn(Math.max(0,i.offset),t,n):function(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=I(t);return n[n.length-1]||null}(this)}domIn(e,t){let n=this.resolveInline(e,t);if(n){let{tile:e,offset:i}=n;if(this.dom.contains(e.dom))return e.isText()?new te(e.dom,Math.min(e.dom.nodeValue.length,i)):e.domPosFor(i,16&e.flags?1:32&e.flags?-1:t);let r=n.tile.parent,o=!1;for(let e of r.children){if(o)return new te(e.dom,0);e==n.tile&&(o=!0)}}return new te(this.dom,0)}}function ct(e,t){let n=e.coordsIn(0,1),i=t.coordsIn(0,1);return n&&i&&i.top<n.bottom}class ht extends rt{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let n=new ht(t||document.createElement(e.tagName),e);return t||(n.flags|=4),n}}class ut extends it{constructor(e,t){super(e,t.length),this.text=t}sync(e){2&this.flags||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t,n){let i=this.dom.nodeValue.length;e>i&&(e=i);let r=e,o=e,s=0;0==e&&t<0||e==i&&t>=0?y.chrome||y.gecko||(e?(r--,s=1):o<i&&(o++,s=-1)):t<0?r--:o<i&&o++;let a=X(this.dom,r,o).getClientRects();if(!a.length)return null;let l=a[(s?s<0:t>=0)?0:a.length-1];return y.safari&&!s&&0==l.width&&(l=Array.prototype.find.call(a,e=>e.width)||l),null==n?l:V(l,(s?s>0:t<0)==n)}static of(e,t){let n=new ut(t||document.createTextNode(e),e);return t||(n.flags|=2),n}}class dt extends it{constructor(e,t,n,i){super(e,t,i),this.widget=n}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return!(48&this.flags)&&(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,n){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;if(n)return V(this.dom.getBoundingClientRect(),this.length?0==e:t<=0);{let t=this.dom.getClientRects(),n=null;if(!t.length)return null;let i=!!(16&this.flags)||!(32&this.flags)&&e>0;for(let r=i?t.length-1:0;n=t[r],!(e>0?0==r:r==t.length-1||n.top<n.bottom);r+=i?-1:1);return V(n,!i)}}get overrideDOMText(){if(!this.length)return i.EY.empty;let{root:e}=this;if(!e)return i.EY.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,t,n,i,r){return r||(r=e.toDOM(t),e.editable||(r.contentEditable="false")),new dt(r,n,e,i)}}class ft extends it{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return i.EY.empty}coordsIn(e,t,n){let i=this.dom.getBoundingClientRect();return null==n?i:V(i,t>0==n)}}class pt{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,n){let{tile:i,index:r,beforeBreak:o,parents:s}=this;for(;e||t>0;)if(i.isComposite())if(o){if(!e)break;n&&n.break(),e--,o=!1}else if(r==i.children.length){if(!e&&!s.length)break;n&&n.leave(i),o=!!i.breakAfter,({tile:i,index:r}=s.pop()),r++}else{let a=i.children[r],l=a.breakAfter;!(t>0?a.length<=e:a.length<e)||n&&!1===n.skip(a,0,a.length)&&a.isComposite?(s.push({tile:i,index:r}),i=a,r=0,n&&a.isComposite()&&n.enter(a)):(o=!!l,r++,e-=a.length)}else{let t=i.length;if(r<t&&e){let o=Math.min(e,t-r);n&&n.skip(i,r,r+o),e-=o,r+=o}if(r==t)o=!!i.breakAfter,({tile:i,index:r}=s.pop()),r++;else if(!e)break}return this.tile=i,this.index=r,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class mt{constructor(e,t,n,i){this.from=e,this.to=t,this.wrapper=n,this.rank=i}}class gt{constructor(e,t,n){this.cache=e,this.root=t,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,n,i){var r;this.flushBuffer();let o=this.ensureMarks(t,n),s=o.lastChild;s&&s.isText()&&!(8&s.flags)&&s.length+e.length<512?(this.cache.reused.set(s,2),(o.children[o.children.length-1]=new ut(s.dom,s.text+e)).parent=o):o.append(i||ut.of(e,null===(r=this.cache.find(ut))||void 0===r?void 0:r.dom)),this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let n=this.curLine;n.dom!=t.line.dom&&(n.setDOM(this.cache.reused.has(t.line)?St(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let i=n;for(let e=t.marks.length-1;e>=0;e--){let n=t.marks[e],r=i.lastChild;if(r instanceof ht&&r.mark.eq(n.mark))r.dom!=n.dom&&r.setDOM(St(n.dom)),i=r;else{if(this.cache.reused.get(n)){let e=it.get(n.dom);e&&e.setDOM(St(n.dom))}let e=ht.of(n.mark,n.dom);i.append(e),i=e}this.cache.reused.set(n,2)}let r=it.get(e.text);r&&this.cache.reused.set(r,2);let o=new ut(e.text,e.text.nodeValue);o.flags|=8,this.pos=e.range.toB,i.append(o)}addInlineWidget(e,t,n){let i=this.afterWidget&&48&e.flags&&(48&this.afterWidget.flags)==(48&e.flags);i||this.flushBuffer();let r=this.ensureMarks(t,n);i||16&e.flags||r.append(this.getBuffer(1)),r.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,n){this.flushBuffer(),this.ensureMarks(t,n).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){(this.afterWidget||this.lastBlock).length+=e,this.pos+=e}addLineStart(e,t){var n;e||(e=xt);let i=lt.start(e,t||(null===(n=this.cache.find(lt))||void 0===n?void 0:n.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=i)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var n;let i=this.curLine;for(let r=e.length-1;r>=0;r--){let o,s=e[r];if(t>0&&(o=i.lastChild)&&o instanceof ht&&o.mark.eq(s))i=o,t--;else{let e=ht.of(s,null===(n=this.cache.find(ht,e=>e.mark.eq(s)))||void 0===n?void 0:n.dom);i.append(e),i=e,t=0}}return i}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;e&&kt(this.curLine,!1)&&("BR"==e.dom.nodeName||!e.isWidget()||y.ios&&kt(this.curLine,!0))||this.curLine.append(this.cache.findWidget(At,0,32)||new dt(At.toDOM(),0,At,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=102*e.rank+e.value.rank,n=new mt(e.from,e.to,e.value,t),i=this.wrappers.length;for(;i>0&&(this.wrappers[i-1].rank-n.rank||this.wrappers[i-1].to-n.to)<0;)i--;this.wrappers.splice(i,0,n)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let n of this.wrappers){let i=t.lastChild;if(n.from<this.pos&&i instanceof at&&i.wrapper.eq(n.wrapper))t=i;else{let i=at.of(n.wrapper,null===(e=this.cache.find(at,e=>e.wrapper.eq(n.wrapper)))||void 0===e?void 0:e.dom);t.append(i),t=i}}return t}blockPosCovered(){let e=this.lastBlock;return null!=e&&!e.breakAfter&&(!e.isWidget()||(160&e.flags)>0)}getBuffer(e){let t=2|(e<0?16:32),n=this.cache.find(ft,void 0,1);return n&&(n.flags=t),n||new ft(t)}flushBuffer(){!this.afterWidget||32&this.afterWidget.flags||(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class bt{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:t,lineBreak:n,done:i}=this.cursor.next(this.skipCount);if(this.skipCount=0,i)throw new Error("Ran out of text content when drawing inline views");this.text=t;let r=this.textOff=Math.min(e,t.length);return n?null:t.slice(0,r)}let t=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,t);return this.textOff=t,n}}const yt=[dt,lt,ut,ht,ft,at,st];for(let e=0;e<yt.length;e++)yt[e].bucket=e;class vt{constructor(e){this.view=e,this.buckets=yt.map(()=>[]),this.index=yt.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,n=this.buckets[t];n.length<6?n.push(e):n[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,n=2){let i=e.bucket,r=this.buckets[i],o=this.index[i];for(let e=0;e<r.length;e++){let s=(e+o)%r.length,a=r[s];if((!t||t(a))&&!this.reused.has(a))return r.splice(s,1),s<o&&this.index[i]--,this.reused.set(a,n),a}return null}findWidget(e,t,n){let i=this.buckets[0];if(i.length)for(let r=0,o=0;;r++){if(r==i.length){if(o)return null;o=1,r=0}let s=i[r];if(!this.reused.has(s)&&(0==o?s.widget.compare(e):s.widget.constructor==e.constructor&&e.updateDOM(s.dom,this.view,s.widget)))return i.splice(r,1),r<this.index[0]&&this.index[0]--,s.widget==e&&s.length==t&&(497&s.flags)==n?(this.reused.set(s,1),s):(this.reused.set(s,2),new dt(s.dom,t,e,-498&s.flags|n))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class wt{constructor(e,t,n,r,o){this.view=e,this.decorations=r,this.disallowBlockEffectsFor=o,this.openWidget=!1,this.openMarks=0,this.cache=new vt(e),this.text=new bt(e.state.doc),this.builder=new gt(this.cache,new st(e,e.contentDOM),i.om.iter(n)),this.cache.reused.set(t,2),this.old=new pt(t),this.reuseWalker={skip:(e,t,n)=>{if(this.cache.add(e),e.isComposite())return!1},enter:e=>this.cache.add(e),leave:()=>{},break:()=>{}}}run(e,t){let n=t&&this.getCompositionContext(t.text);for(let i=0,r=0,o=0;;){let s=o<e.length?e[o++]:null,a=s?s.fromA:this.old.root.length;if(a>i){let e=a-i;this.preserve(e,!o,!s),i=a,r+=e}if(!s)break;t&&s.fromA<=t.range.fromA&&s.toA>=t.range.toA?(this.forward(s.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(r,t.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(t,n),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,s.toA),this.emit(t.range.toB,s.toB)):(this.forward(s.fromA,s.toA),this.emit(r,s.toB)),r=s.toB,i=s.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,n){let i=function(e){let t=[];for(let n=e.parents.length;n>1;n--){let i=n==e.parents.length?e.tile:e.parents[n].tile;i instanceof ht&&t.push(i.mark)}return t}(this.old),r=this.openMarks;this.old.advance(e,n?1:-1,{skip:(e,t,n)=>{if(e.isWidget())if(this.openWidget)this.builder.continueWidget(n-t);else{let o=n>0||t<e.length?dt.of(e.widget,this.view,n-t,496&e.flags,this.cache.maybeReuse(e)):this.cache.reuse(e);256&o.flags?(o.flags&=-2,this.builder.addBlockWidget(o)):(this.builder.ensureLine(null),this.builder.addInlineWidget(o,i,r),r=i.length)}else if(e.isText())this.builder.ensureLine(null),t||n!=e.length||this.cache.reused.has(e)?(this.cache.add(e),this.builder.addText(e.text.slice(t,n),i,r)):this.builder.addText(e.text,i,r,this.cache.reuse(e)),r=i.length;else if(e.isLine())e.flags&=-2,this.cache.reused.set(e,1),this.builder.addLine(e);else if(e instanceof ft)this.cache.add(e);else{if(!(e instanceof ht))return!1;this.builder.ensureLine(null),this.builder.addMark(e,i,r),this.cache.reused.set(e,1),r=i.length}this.openWidget=!1},enter:e=>{e.isLine()?this.builder.addLineStart(e.attrs,this.cache.maybeReuse(e)):(this.cache.add(e),e instanceof ht&&i.unshift(e.mark)),this.openWidget=!1},leave:e=>{e.isLine()?i.length&&(i.length=r=0):e instanceof ht&&(i.shift(),r=Math.min(r,i.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let n=null,r=this.builder,o=-1,s=i.om.spans(this.decorations,e,t,{point:(e,t,i,s,a,l)=>{if(i instanceof D){if(this.disallowBlockEffectsFor[l]){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.view.state.doc.lineAt(e).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(o=s.length,a>s.length)r.continueWidget(t-e);else{let o=i.widget||(i.block?Ct.block:Ct.inline),l=function(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;return e.block&&(t|=256),t}(i),c=this.cache.findWidget(o,t-e,l)||dt.of(o,this.view,t-e,l);i.block?(i.startSide>0&&r.addLineStartIfNotCovered(n),r.addBlockWidget(c)):(r.ensureLine(n),r.addInlineWidget(c,s,a))}n=null}else n=function(e,t){let n=t.spec.attributes,i=t.spec.class;return n||i?(e||(e={class:"cm-line"}),n&&v(n,e),i&&(e.class+=" "+i),e):e}(n,i);t>e&&this.text.skip(t-e)},span:(e,t,i,s)=>{for(let o=e;o<t;){let a=this.text.next(Math.min(512,t-o));null==a?(r.addLineStartIfNotCovered(n),r.addBreak(),o++):(r.ensureLine(n),r.addText(a,i,o==e?s:i.length),o+=a.length),n=null}o=i.length}});o>-1&&(this.openWidget=s>o),this.openWidget||r.addLineStartIfNotCovered(n),this.openMarks=s}forward(e,t,n=1){t-e<=10?this.old.advance(t-e,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(e){let t=[],n=null;for(let i=e.parentNode;;i=i.parentNode){let e=it.get(i);if(i==this.view.contentDOM)break;e instanceof ht?t.push(e):(null==e?void 0:e.isLine())?n=e:e instanceof at||("DIV"!=i.nodeName||n||i==this.view.contentDOM?n||t.push(ht.of(new T({tagName:i.nodeName.toLowerCase(),attributes:S(i)}),i)):n=new lt(i,xt))}return{line:n,marks:t}}}function kt(e,t){let n=e=>{for(let i of e.children)if((t?i.isText():i.length)||n(i))return!0;return!1};return n(e)}const xt={class:"cm-line"};function St(e){let t=it.get(e);return t&&t.setDOM(e.cloneNode()),e}class Ct extends C{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Ct.inline=new Ct("span"),Ct.block=new Ct("div");const At=new class extends C{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class Mt{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=M.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new st(e,e.contentDOM),this.updateInner([new et(0,0,0,e.state.doc.length)],null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:e,toA:t})=>t<this.minWidthFrom||e>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let r=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&((null===(t=this.domChanged)||void 0===t?void 0:t.newSel)?r=this.domChanged.newSel.head:function(e,t){let n=!1;return t&&e.iterChangedRanges((e,i)=>{e<t.to&&i>t.from&&(n=!0)}),n}(e.changes,this.hasComposition)||e.selectionSet||(r=e.state.selection.main.head));let o=r>-1?function(e,t,n){let i=Ot(e,n);if(!i)return null;let{node:r,from:o,to:s}=i,a=r.nodeValue;if(/[\n\r]/.test(a))return null;if(e.state.doc.sliceString(i.from,i.to)!=a)return null;let l=t.invertedDesc;return{range:new et(l.mapPos(o),l.mapPos(s),o,s),text:r}}(this.view,e.changes,r):null;if(this.domChanged=null,this.hasComposition){let{from:t,to:i}=this.hasComposition;n=new et(t,i,e.changes.mapPos(t,-1),e.changes.mapPos(i,1)).addToSet(n.slice())}this.hasComposition=o?{from:o.range.fromB,to:o.range.toB}:null,(y.ie||y.chrome)&&!o&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let s=this.decorations,a=this.blockWrappers;this.updateDeco();let l=function(e,t,n){let r=new Dt;return i.om.compare(e,t,n,r),r.changes}(s,this.decorations,e.changes);l.length&&(n=et.extendWithRanges(n,l));let c=function(e,t,n){let r=new Lt;return i.om.compare(e,t,n,r),r.changes}(a,this.blockWrappers,e.changes);return c.length&&(n=et.extendWithRanges(n,c)),o&&!n.some(e=>e.fromA<=o.range.fromA&&e.toA>=o.range.toA)&&(n=o.range.addToSet(n.slice())),!(2&this.tile.flags&&0==n.length||(this.updateInner(n,o),e.transactions.length&&(this.lastUpdate=Date.now()),0))}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(t||e.length){let n=this.tile,i=new wt(this.view,n,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&it.get(t.text)&&i.cache.reused.set(it.get(t.text),2),this.tile=i.run(e,t),Tt(n,i.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let i=y.chrome||y.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(i),!i||!i.written&&n.selectionRange.focusNode==i.node&&this.tile.dom.contains(i.node)||(this.forceSelection=!0),this.tile.dom.style.height=""});let i=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let e of this.tile.children)e.isWidget()&&e.widget instanceof zt&&i.push(e.dom);n.updateGaps(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let e of t.effects)e.is(Ie)&&(this.editContextFormatting=e.value)}updateSelection(e=!1,t=!1){!e&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();let{dom:n}=this.tile,i=this.view.root.activeElement,r=i==n,o=!r&&!(this.view.state.facet(Fe)||n.tabIndex>-1)&&P(n,this.view.observer.selectionRange)&&!(i&&n.contains(i));if(!(r||t||o))return;let s=this.forceSelection;this.forceSelection=!1;let a,l,c=this.view.state.selection.main;if(c.empty?l=a=this.inlineDOMNearPos(c.anchor,c.assoc||1):(l=this.inlineDOMNearPos(c.head,c.head==c.from?1:-1),a=this.inlineDOMNearPos(c.anchor,c.anchor==c.from?1:-1)),y.gecko&&c.empty&&!this.hasComposition&&1==(h=a).node.nodeType&&h.node.firstChild&&(0==h.offset||"false"==h.node.childNodes[h.offset-1].contentEditable)&&(h.offset==h.node.childNodes.length||"false"==h.node.childNodes[h.offset].contentEditable)){let e=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(e,a.node.childNodes[a.offset]||null)),a=l=new te(e,0),s=!0}var h;let u=this.view.observer.selectionRange;!s&&u.focusNode&&(N(a.node,a.offset,u.anchorNode,u.anchorOffset)&&N(l.node,l.offset,u.focusNode,u.focusOffset)||this.suppressWidgetCursorChange(u,c))||(this.view.observer.ignore(()=>{y.android&&y.chrome&&n.contains(u.focusNode)&&function(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(1==n.nodeType&&"false"==n.contentEditable)return!0;return!1}(u.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let e=B(this.view.root);if(e)if(c.empty){if(y.gecko){let e=(t=a.node,r=a.offset,1!=t.nodeType?0:(r&&"false"==t.childNodes[r-1].contentEditable?1:0)|(r<t.childNodes.length&&"false"==t.childNodes[r].contentEditable?2:0));if(e&&3!=e){let t=(1==e?Q:ee)(a.node,a.offset);t&&(a=new te(t.node,t.offset))}}e.collapse(a.node,a.offset),null!=c.bidiLevel&&void 0!==e.caretBidiLevel&&(e.caretBidiLevel=c.bidiLevel)}else if(e.extend){e.collapse(a.node,a.offset);try{e.extend(l.node,l.offset)}catch(e){}}else{let t=document.createRange();c.anchor>c.head&&([a,l]=[l,a]),t.setEnd(l.node,l.offset),t.setStart(a.node,a.offset),e.removeAllRanges(),e.addRange(t)}var t,r;o&&this.view.root.activeElement==n&&(n.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new te(u.anchorNode,u.anchorOffset),this.impreciseHead=l.precise?null:new te(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&N(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=B(e.root),{anchorNode:i,anchorOffset:r}=e.observer.selectionRange;if(!(n&&t.empty&&t.assoc&&n.modify))return;let o=this.lineAt(t.head,t.assoc);if(!o)return;let s=o.posAtStart;if(t.head==s||t.head==s+o.length)return;let a=this.coordsAt(t.head,-1),l=this.coordsAt(t.head,1);if(!a||!l||a.bottom>l.top)return;let c=this.domAtPos(t.head+t.assoc,t.assoc);n.collapse(c.node,c.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let h=e.observer.selectionRange;e.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=t.from&&n.collapse(i,r)}posFromDOM(e,t){let n=this.tile.nearest(e);if(!n)return 2&this.tile.dom.compareDocumentPosition(e)?0:this.view.state.doc.length;let i=n.posAtStart;if(!n.isComposite())return n.isText()?e==n.dom?i+t:i+(t?n.length:0):i;{let r;if(e==n.dom)r=n.dom.childNodes[t];else{let i=0==q(e)?0:0==t?-1:1;for(;;){let t=e.parentNode;if(t==n.dom)break;0==i&&t.firstChild!=t.lastChild&&(i=e==t.firstChild?-1:1),e=t}r=i<0?e:e.nextSibling}if(r==n.dom.firstChild)return i;for(;r&&!it.get(r);)r=r.nextSibling;if(!r)return i+n.length;for(let e=0,t=i;;e++){let i=n.children[e];if(i.dom==r)return t;t+=i.length+i.breakAfter}}}domAtPos(e,t){let{tile:n,offset:i}=this.tile.resolveBlock(e,t);return n.isWidget()?n.domPosFor(i,t):n.domIn(i,t)}inlineDOMNearPos(e,t){let n,i,r=-1,o=!1,s=-1,a=!1;return this.tile.blockTiles((t,l)=>{if(t.isWidget()){if(32&t.flags&&l>=e)return!0;16&t.flags&&(o=!0)}else{let c=l+t.length;if(l<=e&&(n=t,r=e-l,o=c<e),c>=e&&!i&&(i=t,s=e-l,a=l>e),l>e&&i)return!0}}),n||i?(o&&i?n=null:a&&n&&(i=null),n&&t<0||!i?n.domIn(r,t):i.domIn(s,t)):this.domAtPos(e,t)}coordsAt(e,t,n){let{tile:i,offset:r}=this.tile.resolveBlock(e,t);return i.isWidget()?i.widget instanceof zt?null:i.coordsInWidget(r,t,!0):i.coordsIn(r,t,n)}lineAt(e,t){let{tile:n}=this.tile.resolveBlock(e,t);return n.isLine()?n:null}coordsForChar(e){let{tile:t,offset:n}=this.tile.resolveBlock(e,1);return t.isLine()?function e(t,n){if(t.isComposite())for(let i of t.children){if(i.length>=n){let t=e(i,n);if(t)return t}if((n-=i.length)<0)break}else if(t.isText()&&n<t.length){let e=(0,i.zK)(t.text,n);if(e==n)return null;let r=X(t.dom,n,e).getClientRects();for(let e=0;e<r.length;e++){let t=r[e];if(e==r.length-1||t.top<t.bottom&&t.left<t.right)return t}}return null}(t,n):null}measureVisibleLineHeights(e){let t=[],{from:n,to:i}=e,r=this.view.contentDOM.clientWidth,o=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,s=-1,a=this.view.textDirection==ne.LTR,l=0,c=(e,h,u)=>{for(let d=0;d<e.children.length&&!(h>i);d++){let i=e.children[d],f=h+i.length,p=i.dom.getBoundingClientRect(),{height:m}=p;if(u&&!d&&(l+=p.top-u.top),i instanceof at)f>n&&c(i,h,p);else if(h>=n&&(l>0&&t.push(-l),t.push(m+l),l=0,o)){let e=i.dom.lastChild,t=e?I(e):[];if(t.length){let e=t[t.length-1],n=a?e.right-p.left:p.right-e.left;n>s&&(s=n,this.minWidth=r,this.minWidthFrom=h,this.minWidthTo=f)}}u&&d==e.children.length-1&&(l+=u.bottom-p.bottom),h=f+i.breakAfter}};return c(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return"rtl"==getComputedStyle(t.dom).direction?ne.RTL:ne.LTR}measureTextSize(){let e=this.tile.blockTiles(e=>{if(e.isLine()&&e.children.length&&e.length<=20){let t,n=0;for(let i of e.children){if(!i.isText()||/[^ -~]/.test(i.text))return;let e=I(i.dom);if(1!=e.length)return;n+=e[0].width,t=e[0].height}if(n)return{lineHeight:e.dom.getBoundingClientRect().height,charWidth:n/e.length,textHeight:t}}});if(e)return e;let t,n,i,r=document.createElement("div");return r.className="cm-line",r.style.width="99999px",r.style.position="absolute",r.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(r);let e=I(r.firstChild)[0];t=r.getBoundingClientRect().height,n=e&&e.width?e.width/27:7,i=e&&e.height?e.height:t,r.remove()}),{lineHeight:t,charWidth:n,textHeight:i}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,i=0;;i++){let r=i==t.viewports.length?null:t.viewports[i],o=r?r.from-1:this.view.state.doc.length;if(o>n){let i=(t.lineBlockAt(o).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(M.replace({widget:new zt(i),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!r)break;n=r.to+1}return M.set(e)}updateDeco(){let e=1,t=this.view.state.facet(_e).map(t=>(this.dynamicDecorationMap[e++]="function"==typeof t)?t(this.view):t),n=!1,r=this.view.state.facet($e).map((e,t)=>{let i="function"==typeof e;return i&&(n=!0),i?e(this.view):e});for(r.length&&(this.dynamicDecorationMap[e++]=n,t.push(i.om.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(Ue).map(e=>"function"==typeof e?e(this.view):e)}scrollIntoView(e){if(e.isSnapshot){let t=this.view.viewState.lineBlockAt(e.range.head);return this.view.scrollDOM.scrollTop=t.top-e.yMargin,void(this.view.scrollDOM.scrollLeft=e.xMargin)}for(let t of this.view.state.facet(Be))try{if(t(this.view,e.range,e))return!0}catch(e){Ne(this.view.state,e,"scroll handler")}let t,{range:n}=e,i=this.coordsAt(n.head,n.assoc||(n.head>n.anchor?-1:1));if(!i)return;!n.empty&&(t=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(i={left:Math.min(i.left,t.left),top:Math.min(i.top,t.top),right:Math.max(i.right,t.right),bottom:Math.max(i.bottom,t.bottom)});let r=Ze(this.view),o={left:i.left-r.left,top:i.top-r.top,right:i.right+r.right,bottom:i.bottom+r.bottom},{offsetWidth:s,offsetHeight:a}=this.view.scrollDOM;if(function(e,t,n,i,r,o,s,a){let l=e.ownerDocument,c=l.defaultView||window;for(let h=e,u=!1;h&&!u;)if(1==h.nodeType){let e,d=h==l.body,f=1,p=1;if(d)e=j(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(u=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let t=h.getBoundingClientRect();({scaleX:f,scaleY:p}=K(h,t)),e={left:t.left,right:t.left+h.clientWidth*f,top:t.top,bottom:t.top+h.clientHeight*p}}let m=0,g=0;if("nearest"==r)t.top<e.top+s?(g=t.top-(e.top+s),n>0&&t.bottom>e.bottom+g&&(g=t.bottom-e.bottom+s)):t.bottom>e.bottom-s&&(g=t.bottom-e.bottom+s,n<0&&t.top-g<e.top&&(g=t.top-(e.top+s)));else{let i=t.bottom-t.top,o=e.bottom-e.top;g=("center"==r&&i<=o?t.top+i/2-o/2:"start"==r||"center"==r&&n<0?t.top-s:t.bottom-o+s)-e.top}if("nearest"==i?t.left<e.left+o?(m=t.left-(e.left+o),n>0&&t.right>e.right+m&&(m=t.right-e.right+o)):t.right>e.right-o&&(m=t.right-e.right+o,n<0&&t.left<e.left+m&&(m=t.left-(e.left+o))):m=("center"==i?t.left+(t.right-t.left)/2-(e.right-e.left)/2:"start"==i==a?t.left-o:t.right-(e.right-e.left)+o)-e.left,m||g)if(d)c.scrollBy(m,g);else{let e=0,n=0;if(g){let e=h.scrollTop;h.scrollTop+=g/p,n=(h.scrollTop-e)*p}if(m){let t=h.scrollLeft;h.scrollLeft+=m/f,e=(h.scrollLeft-t)*f}t={left:t.left-e,top:t.top-n,right:t.right-e,bottom:t.bottom-n},e&&Math.abs(e-m)<1&&(i="nearest"),n&&Math.abs(n-g)<1&&(r="nearest")}if(d)break;(t.top<e.top||t.bottom>e.bottom||t.left<e.left||t.right>e.right)&&(t={left:Math.max(t.left,e.left),right:Math.min(t.right,e.right),top:Math.max(t.top,e.top),bottom:Math.min(t.bottom,e.bottom)}),h=h.assignedSlot||h.parentNode}else{if(11!=h.nodeType)break;h=h.host}}(this.view.scrollDOM,o,n.head<n.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,s),-s),Math.max(Math.min(e.yMargin,a),-a),this.view.textDirection==ne.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(i.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||i.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let e=this.view.docView.lineAt(n.head,1);e&&e.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(e){let t=e=>e.isWidget()||e.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){Tt(this.tile)}}function Tt(e,t){let n=null==t?void 0:t.get(e);if(1!=n){null==n&&e.destroy();for(let n of e.children)Tt(n,t)}}function Ot(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let i=Q(n.focusNode,n.focusOffset),r=ee(n.focusNode,n.focusOffset),o=i||r;if(r&&i&&r.node!=i.node){let t=it.get(r.node);if(!t||t.isText()&&t.text!=r.node.nodeValue)o=r;else if(e.docView.lastCompositionAfterCursor){let e=it.get(i.node);!e||e.isText()&&e.text!=i.node.nodeValue||(o=r)}}if(e.docView.lastCompositionAfterCursor=o!=i,!o)return null;let s=t-o.offset;return{from:s,to:s+o.node.nodeValue.length,node:o.node}}let Dt=class{constructor(){this.changes=[]}compareRange(e,t){z(e,t,this.changes)}comparePoint(e,t){z(e,t,this.changes)}boundChange(e){z(e,e,this.changes)}};class Lt{constructor(){this.changes=[]}compareRange(e,t){z(e,t,this.changes)}comparePoint(){}boundChange(e){z(e,e,this.changes)}}class zt extends C{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function Et(e,t,n){let i=e.lineBlockAt(t);if(Array.isArray(i.type)){let e;for(let r of i.type){if(r.from>t)break;if(!(r.to<t)){if(r.from<t&&r.to>t)return r;e&&(r.type!=A.Text||e.type==r.type&&!(n<0?r.from<t:r.to>t))||(e=r)}}return e||i}return i}function Bt(e,t,n,i){let r=e.state.doc.lineAt(t.head),o=e.bidiSpans(r),s=e.textDirectionAt(r.from);for(let a=t,l=null;;){let t=we(r,o,s,a,n),c=ve;if(!t){if(r.number==(n?e.state.doc.lines:1))return a;c="\n",r=e.state.doc.line(r.number+(n?1:-1)),o=e.bidiSpans(r),t=e.visualLineSide(r,!n)}if(l){if(!l(c))return a}else{if(!i)return t;l=i(c)}a=t}}function Rt(e,t,n){for(;;){let i=0;for(let r of e)r.between(t-1,t+1,(e,r,o)=>{if(t>e&&t<r){let o=i||n||(t-e<r-t?-1:1);t=o<0?e:r,i=o}});if(!i)return t}}function Pt(e,t){let n=null;for(let r=0;r<t.ranges.length;r++){let o=t.ranges[r],s=null;if(o.empty){let t=Rt(e,o.from,0);t!=o.from&&(s=i.OF.cursor(t,-1))}else{let t=Rt(e,o.from,-1),n=Rt(e,o.to,1);t==o.from&&n==o.to||(s=o.undirectional?i.OF.undirectionalRange(o.from,o.to):i.OF.range(o.from==o.anchor?t:n,o.from==o.head?t:n))}s&&(n||(n=t.ranges.slice()),n[r]=s)}return n?i.OF.create(n,t.mainIndex):t}function It(e,t,n){let r=Rt(e.state.facet(Ye).map(t=>t(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:i.OF.cursor(r,r<n.from?1:-1)}class Nt{constructor(e,t){this.pos=e,this.assoc=t}}function Ft(e,t,n,r){let o,s=e.contentDOM.getBoundingClientRect(),a=s.top+e.viewState.paddingTop,{x:l,y:c}=t,h=c-a;for(;;){if(h<0)return new Nt(0,1);if(h>e.viewState.docHeight)return new Nt(e.state.doc.length,-1);if(o=e.elementAtHeight(h),null==r)break;if(o.type==A.Text){if(r<0?o.to<e.viewport.from:o.from>e.viewport.to)break;let t=e.docView.coordsAt(r<0?o.from:o.to,r>0?-1:1);if(t&&(r<0?t.top<=h+a:t.bottom>=h+a))break}let t=e.viewState.heightOracle.textHeight/2;h=r>0?o.bottom+t:o.top-t}if(e.viewport.from>=o.to||e.viewport.to<=o.from){if(n)return null;if(o.type==A.Text){let t=function(e,t,n,r,o){let s=Math.round((r-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>1.5*e.defaultLineHeight){let t=e.viewState.heightOracle.textHeight;s+=Math.floor((o-n.top-.5*(e.defaultLineHeight-t))/t)*e.viewState.heightOracle.lineLength}let a=e.state.sliceDoc(n.from,n.to);return n.from+(0,i.kn)(a,s,e.state.tabSize)}(e,s,o,l,c);return new Nt(t,t==o.from?1:-1)}}if(o.type!=A.Text)return h<(o.top+o.bottom)/2?new Nt(o.from,1):new Nt(o.to,-1);let u=e.docView.lineAt(o.from,2);return u&&u.length==o.length||(u=e.docView.lineAt(o.from,-2)),new Wt(e,l,c,e.textDirectionAt(o.from)).scanTile(u,o.from)}class Wt{constructor(e,t,n,i){this.view=e,this.x=t,this.y=n,this.baseDir=i,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:n,spans:i}=this.bidiSpansAt(e);return i[de.find(i,e-n.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:n,spans:i}=this.bidiSpansAt(e);return i[de.find(i,e-n.from,-1,t)].dir}bidiIn(e,t){let{spans:n,line:i}=this.bidiSpansAt(e);return n.length>1||n.length&&(n[0].level!=this.baseDir||n[0].to+i.from<t)}scan(e,t,n=!1){let i,r,o,s=0,a=e.length-1,l=new Set,c=this.bidiIn(e[0],e[a]),h=-1,u=1e9;e:for(;s<a;){let n=a-s,d=s+a>>1;t:if(l.has(d)){let e=s+Math.floor(Math.random()*n);for(let t=0;t<n;t++){if(!l.has(e)){d=e;break t}e++,e==a&&(e=s)}break e}l.add(d);let f=t(d);if(f)for(let t=0;t<f.length;t++){let n=f[t],l=0;if(!(0==n.width&&f.length>1)){if(n.bottom<this.y)(!i||i.bottom<n.bottom)&&(i=n),l=1;else if(n.top>this.y)(!r||r.top>n.top)&&(r=n),l=-1;else{let e=n.left>this.x?this.x-n.left:n.right<this.x?this.x-n.right:0,t=Math.abs(e);t<u&&(h=d,u=t,o=n),e&&(l=e<0==(this.baseDir==ne.LTR)?-1:1)}-1!=l||c&&!this.baseDirAt(e[d],1)?1!=l||c&&!this.baseDirAt(e[d+1],-1)||(s=d+1):a=d}}}if(!o){if(!r&&!i)return{i:e[0],after:!1};let n=i&&(!r||this.y-i.bottom<r.top-this.y)?i:r;return this.y=(n.top+n.bottom)/2,this.scan(e,t,!0)}if(u&&!n){let{top:n,bottom:s}=o;if(i&&i.bottom>(n+n+s)/3)return this.y=i.bottom-1,this.scan(e,t,!0);if(r&&r.top<(n+s+s)/3)return this.y=r.top+1,this.scan(e,t,!0)}let d=(c?this.dirAt(e[h],1):this.baseDir)==ne.LTR;return{i:h,after:this.x>(o.left+o.right)/2==d}}scanText(e,t){let n=[];for(let r=0;r<e.length;r=(0,i.zK)(e.text,r))n.push(t+r);n.push(t+e.length);let r=this.scan(n,i=>{let r=n[i]-t,o=n[i+1]-t;return X(e.dom,r,o).getClientRects()});return r.after?new Nt(n[r.i+1],-1):new Nt(n[r.i],1)}scanTile(e,t){if(!e.length)return new Nt(t,1);if(1==e.children.length){let n=e.children[0];if(n.isText())return this.scanText(n,t);if(n.isComposite())return this.scanTile(n,t)}let n=[t];for(let i=0,r=t;i<e.children.length;i++)n.push(r+=e.children[i].length);let i=this.scan(n,t=>{let n=e.children[t];return 48&n.flags?null:(1==n.dom.nodeType?n.dom:X(n.dom,0,n.length)).getClientRects()}),r=e.children[i.i],o=n[i.i];return r.isText()?this.scanText(r,o):r.isComposite()?this.scanTile(r,o):i.after?new Nt(n[i.i+1],-1):new Nt(o,1)}}const Ht="";class qt{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(i.$t.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Ht}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let i=e;;){this.findPointBefore(n,i);let e=this.text.length;this.readNode(i);let r=it.get(i),o=i.nextSibling;if(o==t){(null==r?void 0:r.breakAfter)&&!o&&n!=this.view.contentDOM&&this.lineBreak();break}let s=it.get(o);(r&&s?r.breakAfter:(r?r.breakAfter:W(i))||W(o)&&("BR"!=i.nodeName||(null==r?void 0:r.isWidget()))&&this.text.length>e)&&!jt(o,t)&&this.lineBreak(),i=o}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let r,o=-1,s=1;if(this.lineSeparator?(o=t.indexOf(this.lineSeparator,n),s=this.lineSeparator.length):(r=i.exec(t))&&(o=r.index,s=r[0].length),this.append(t.slice(n,o<0?t.length:o)),o<0)break;if(this.lineBreak(),s>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=s-1);n=o+s}}readNode(e){let t=it.get(e),n=t&&t.overrideDOMText;if(null!=n){this.findPointInside(e,n.length);for(let e=n.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else 3==e.nodeType?this.readTextNode(e):"BR"==e.nodeName?e.nextSibling&&this.lineBreak():1==e.nodeType&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(3==e.nodeType?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(Vt(e,n.node,n.offset)?t:0))}}function Vt(e,t,n){for(;;){if(!t||n<q(t))return!1;if(t==e)return!0;n=F(t)+1,t=t.parentNode}}function jt(e,t){let n;for(;e!=t&&e;e=e.nextSibling){let t=it.get(e);if(!(null==t?void 0:t.isWidget()))return!1;t&&(n||(n=[])).push(t)}if(n)for(let e of n){let t=e.overrideDOMText;if(null==t?void 0:t.length)return!1}return!0}class Kt{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class _t{constructor(e,t,n,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:o,impreciseAnchor:s}=e.docView,a=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=Ut(e.docView.tile,t,n,0))){let t=o||s?[]:function(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:o}=e.observer.selectionRange;return n&&(t.push(new Kt(n,i)),r==n&&o==i||t.push(new Kt(r,o))),t}(e),n=new qt(t,e);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=function(e,t){if(0==e.length)return null;let n=e[0].pos,r=2==e.length?e[1].pos:n;return n>-1&&r>-1?i.OF.single(n+t,r+t):null}(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=o&&o.node==t.focusNode&&o.offset==t.focusOffset||!R(e.contentDOM,t.focusNode)?a.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),r=s&&s.node==t.anchorNode&&s.offset==t.anchorOffset||!R(e.contentDOM,t.anchorNode)?a.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),l=e.viewport;if((y.ios||y.chrome)&&n!=r&&Math.min(n,r)<=a.main.from&&Math.max(n,r)>=a.main.to&&(l.from>0||l.to<e.state.doc.length)){let t=Math.min(n,r),i=Math.max(n,r),o=l.from-t,s=l.to-i;0!=o&&1!=o&&0!=t||0!=s&&-1!=s&&i!=e.state.doc.length||(n=0,r=e.state.doc.length)}if(e.inputState.composing>-1&&a.ranges.length>1)this.newSel=a.replaceRange(i.OF.range(r,n));else if(e.lineWrapping&&r==n&&(!a.main.empty||a.main.head!=n)&&e.inputState.lastTouchTime>Date.now()-100){let t=e.coordsAtPos(n,-1),r=0;t&&(r=e.inputState.lastTouchY<=t.bottom?-1:1),this.newSel=i.OF.create([i.OF.cursor(n,r)])}else this.newSel=i.OF.single(r,n)}}}function Ut(e,t,n,i){if(e.isComposite()){let r=-1,o=-1,s=-1,a=-1;for(let l=0,c=i,h=i;l<e.children.length;l++){let i=e.children[l],u=c+i.length;if(c<t&&u>n)return Ut(i,t,n,c);if(u>=t&&-1==r&&(r=l,o=c),c>n&&i.dom.parentNode==e.dom){s=l,a=h;break}h=u,c=u+i.breakAfter}return{from:o,to:a<0?i+e.length:a,startDOM:(r?e.children[r-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:s<e.children.length&&s>=0?e.children[s].dom:null}}return e.isText()?{from:i,to:i+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function $t(e,t){let n,{newSel:r}=t,{state:o}=e,s=o.selection.main,a=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:e,to:r}=t.bounds,l=s.from,c=null;(8===a||y.android&&t.text.length<r-e)&&(l=s.to,c="end");let h,u,d=o.doc.sliceString(e,r,Ht);!s.empty&&s.from>=e&&s.to<=r&&(t.typeOver||d!=t.text)&&d.slice(0,s.from-e)==t.text.slice(0,s.from-e)&&d.slice(s.to-e)==t.text.slice(h=t.text.length-(d.length-(s.to-e)))?n={from:s.from,to:s.to,insert:i.EY.of(t.text.slice(s.from-e,h).split(Ht))}:(u=Gt(d,t.text,l-e,c))&&(y.chrome&&13==a&&u.toB==u.from+2&&t.text.slice(u.from,u.toB)==Ht+Ht&&u.toB--,n={from:e+u.from,to:e+u.toA,insert:i.EY.of(t.text.slice(u.from,u.toB).split(Ht))})}else r&&(!e.hasFocus&&o.facet(Fe)||Xt(r,s))&&(r=null);if(!n&&!r)return!1;if((y.mac||y.android)&&n&&n.from==n.to&&n.from==s.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(r&&2==n.insert.length&&(r=i.OF.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:i.EY.of([n.insert.toString().replace("."," ")])}):o.doc.lineAt(s.from).to<s.to&&e.docView.lineHasWidget(s.to)&&e.inputState.insertingTextAt>Date.now()-50?n={from:s.from,to:s.to,insert:o.toText(e.inputState.insertingText)}:y.chrome&&n&&n.from==n.to&&n.from==s.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(r&&(r=i.OF.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:i.EY.of([" "])}),n)return Yt(e,n,r,a);if(r&&!Xt(r,s)){let t=!1,n="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(t=!0),n=e.inputState.lastSelectionOrigin,"select.pointer"==n&&(r=Pt(o.facet(Ye).map(t=>t(e)),r))),e.dispatch({selection:r,scrollIntoView:t,userEvent:n}),!0}return!1}function Yt(e,t,n,r=-1){if(y.ios&&e.inputState.flushIOSKey(t))return!0;let o=e.state.selection.main;if(y.android&&(t.to==o.to&&(t.from==o.from||t.from==o.from-1&&" "==e.state.sliceDoc(t.from,o.from))&&1==t.insert.length&&2==t.insert.lines&&J(e.contentDOM,"Enter",13)||(t.from==o.from-1&&t.to==o.to&&0==t.insert.length||8==r&&t.insert.length<t.to-t.from&&t.to>o.head)&&J(e.contentDOM,"Backspace",8)||t.from==o.from&&t.to==o.to+1&&0==t.insert.length&&J(e.contentDOM,"Delete",46)))return!0;let s,a=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let l=()=>s||(s=function(e,t,n){let r,o=e.state,s=o.selection.main,a=-1;if(t.from==t.to&&t.from<s.from||t.from>s.to){let n=t.from<s.from?-1:1,i=n<0?s.from:s.to,r=Rt(o.facet(Ye).map(t=>t(e)),i,n);t.from==r&&(a=r)}if(a>-1)r={changes:t,selection:i.OF.cursor(t.from+t.insert.length,-1)};else if(t.from>=s.from&&t.to<=s.to&&t.to-t.from>=(s.to-s.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=s.from<t.from?o.sliceDoc(s.from,t.from):"",i=s.to>t.to?o.sliceDoc(t.to,s.to):"";r=o.replaceSelection(e.state.toText(n+t.insert.sliceString(0,void 0,e.state.lineBreak)+i))}else{let a=o.changes(t),l=n&&n.main.to<=a.newLength?n.main:void 0;if(o.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=s.to+10&&t.to>=s.to-10){let c,h=e.state.sliceDoc(t.from,t.to),u=n&&Ot(e,n.main.head);if(u){let e=t.insert.length-(t.to-t.from);c={from:u.from,to:u.to-e}}else c=e.state.doc.lineAt(s.head);let d=s.to-t.to;r=o.changeByRange(n=>{if(n.from==s.from&&n.to==s.to)return{changes:a,range:l||n.map(a)};let r=n.to-d,u=r-h.length;if(e.state.sliceDoc(u,r)!=h||r>=c.from&&u<=c.to)return{range:n};let f=o.changes({from:u,to:r,insert:t.insert}),p=n.to-s.to;return{changes:f,range:l?i.OF.range(Math.max(0,l.anchor+p),Math.max(0,l.head+p)):n.map(f)}})}else r={changes:a,selection:l&&o.selection.replaceRange(l)}}let l="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,l+=".compose",e.inputState.compositionFirstChange&&(l+=".start",e.inputState.compositionFirstChange=!1)),o.update(r,{userEvent:l,scrollIntoView:!0})}(e,t,n));return e.state.facet(Te).some(n=>n(e,t.from,t.to,a,l))||e.dispatch(l()),!0}function Gt(e,t,n,i){let r=Math.min(e.length,t.length),o=0;for(;o<r&&e.charCodeAt(o)==t.charCodeAt(o);)o++;if(o==r&&e.length==t.length)return null;let s=e.length,a=t.length;for(;s>0&&a>0&&e.charCodeAt(s-1)==t.charCodeAt(a-1);)s--,a--;return"end"==i&&(n-=s+Math.max(0,o-Math.min(s,a))-o),s<o&&e.length<t.length?(o-=n<=o&&n>=s?o-n:0,a=o+(a-s),s=o):a<o&&(o-=n<=o&&n>=a?o-n:0,s=o+(s-a),a=o),{from:o,toA:s,toB:a}}function Xt(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class Jt{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,y.safari&&e.contentDOM.addEventListener("input",()=>null),y.gecko&&function(e){xn.has(e)||(xn.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}(e.contentDOM.ownerDocument)}handleEvent(e){(function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n,i=t.target;i!=e.contentDOM;i=i.parentNode)if(!i||11==i.nodeType||(n=it.get(i))&&n.isWidget()&&!n.isHidden&&n.widget.ignoreEvent(t))return!1;return!0})(this.view,e)&&!this.ignoreDuringComposition(e)&&("keydown"==e.type&&this.keydown(e)||(0!=this.view.updateState?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e)))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let e of n.observers)e(this.view,t);for(let e of n.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=Qt(e),n=this.handlers,i=this.view.contentDOM;for(let e in t)if("scroll"!=e){let r=!t[e].handlers.length,o=n[e];o&&r!=!o.handlers.length&&(i.removeEventListener(e,this.handleEvent),o=null),o||i.addEventListener(e,this.handleEvent,{passive:r})}for(let e in n)"scroll"==e||t[e]||i.removeEventListener(e,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),9==e.keyCode&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&27!=e.keyCode&&nn.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),y.android&&y.chrome&&!e.synthetic&&(13==e.keyCode||8==e.keyCode))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(y.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(en.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||tn.indexOf(e.key)>-1&&e.ctrlKey)){let n={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};return n.shiftKey&&y.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&(t=this.view.win).visualViewport&&t.visualViewport.height*t.visualViewport.scale/t.document.documentElement.clientHeight<.85&&(n.shiftKey=!1),this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:n},setTimeout(()=>this.flushIOSKey(),250),!0}var t;return 229!=e.keyCode&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let t=this.pendingIOSKey;return!!t&&!("Enter"==t.key&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString()))&&(this.pendingIOSKey=void 0,J(this.view.contentDOM,t.key,t.keyCode,t.mods))}ignoreDuringComposition(e){return!(!/^key/.test(e.type)||e.synthetic)&&(this.composing>0||!!(y.safari&&!y.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Zt(e,t){return(n,i)=>{try{return t.call(e,i,n)}catch(e){Ne(n.state,e)}}}function Qt(e){let t=Object.create(null);function n(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec,i=e&&e.plugin.domEventHandlers,r=e&&e.plugin.domEventObservers;if(i)for(let e in i){let r=i[e];r&&n(e).handlers.push(Zt(t.value,r))}if(r)for(let e in r){let i=r[e];i&&n(e).observers.push(Zt(t.value,i))}}for(let e in sn)n(e).handlers.push(sn[e]);for(let e in an)n(e).observers.push(an[e]);return t}const en=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],tn="dthko",nn=[16,17,18,20,91,92,224,225];function rn(e){return.7*Math.max(0,e)+8}class on{constructor(e,t,n,r){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=_(e.contentDOM),this.atoms=e.state.facet(Ye).map(t=>t(e));let o=e.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(i.$t.allowMultipleSelections)&&function(e,t){let n=e.state.facet(xe);return n.length?n[0](t):y.mac?t.metaKey:t.ctrlKey}(e,t),this.dragging=!(!function(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let i=B(e.root);if(!i||0==i.rangeCount)return!0;let r=i.getRangeAt(0).getClientRects();for(let e=0;e<r.length;e++){let n=r[e];if(n.left<=t.clientX&&n.right>=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}(e,t)||1!=gn(t))&&null}start(e){!1===this.dragging&&this.select(e)}move(e){if(0==e.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(t=this.startEvent,n=e,Math.max(Math.abs(t.clientX-n.clientX),Math.abs(t.clientY-n.clientY))<10))return;var t,n;this.select(this.lastEvent=e);let i=0,r=0,o=0,s=0,a=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:o,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:l}=this.scrollParents.y.getBoundingClientRect());let c=Ze(this.view);e.clientX-c.left<=o+6?i=-rn(o-e.clientX):e.clientX+c.right>=a-6&&(i=rn(e.clientX-a)),e.clientY-c.top<=s+6?r=-rn(s-e.clientY):e.clientY+c.bottom>=l-6&&(r=rn(e.clientY-l)),this.setScrollSpeed(i,r)}up(e){null==this.dragging&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),!1===this.dragging&&this.select(this.lastEvent)}select(e){let{view:t}=this,n=Pt(this.atoms,this.style.get(e,this.extend,this.multiple));!this.mustSelect&&n.eq(t.state.selection,!1===this.dragging)||this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(e=>e.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}const sn=Object.create(null),an=Object.create(null),ln=y.ie&&y.ie_version<15||y.ios&&y.webkit_version<604;function cn(e,t,n){for(let i of e.facet(t))n=i(n,e);return n}function hn(e,t){t=cn(e.state,De,t);let n,{state:r}=e,o=1,s=r.toText(t),a=s.lines==r.selection.ranges.length;if(null!=yn&&r.selection.ranges.every(e=>e.empty)&&yn==s.toString()){let e=-1;n=r.changeByRange(n=>{let l=r.doc.lineAt(n.from);if(l.from==e)return{range:n};e=l.from;let c=r.toText((a?s.line(o++).text:t)+r.lineBreak);return{changes:{from:l.from,insert:c},range:i.OF.cursor(n.from+c.length)}})}else n=a?r.changeByRange(e=>{let t=s.line(o++);return{changes:{from:e.from,to:e.to,insert:t.text},range:i.OF.cursor(e.from+t.length)}}):r.replaceSelection(s);e.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}function un(e,t,n,r){if(1==r)return i.OF.cursor(t,n);if(2==r)return function(e,t,n=1){let r=e.charCategorizer(t),o=e.doc.lineAt(t),s=t-o.from;if(0==o.length)return i.OF.cursor(t);0==s?n=1:s==o.length&&(n=-1);let a=s,l=s;n<0?a=(0,i.zK)(o.text,s,!1):l=(0,i.zK)(o.text,s);let c=r(o.text.slice(a,l));for(;a>0;){let e=(0,i.zK)(o.text,a,!1);if(r(o.text.slice(e,a))!=c)break;a=e}for(;l<o.length;){let e=(0,i.zK)(o.text,l);if(r(o.text.slice(l,e))!=c)break;l=e}return i.OF.undirectionalRange(a+o.from,l+o.from)}(e.state,t,n);{let r=e.docView.lineAt(t,n),o=e.state.doc.lineAt(r?r.posAtEnd:t),s=r?r.posAtStart:o.from,a=r?r.posAtEnd:o.to;return a<e.state.doc.length&&a==o.to&&a++,i.OF.undirectionalRange(s,a)}}an.scroll=e=>{let t=e.inputState;t.lastScrollTop=e.scrollDOM.scrollTop,t.lastScrollLeft=e.scrollDOM.scrollLeft,y.ios&&!t.touchActive&&(t.lastIOSMomentumScroll=Date.now())},an.wheel=an.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()},sn.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),27==t.keyCode&&0!=e.inputState.tabFocusMode&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),an.touchstart=(e,t)=>{let n=e.inputState,i=t.targetTouches[0];n.touchActive=!0,n.lastTouchTime=Date.now(),i&&(n.lastTouchX=i.clientX,n.lastTouchY=i.clientY),n.setSelectionOrigin("select.pointer")},an.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")},an.touchend=(e,t)=>{e.inputState.touchActive=!1},sn.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let i of e.state.facet(Ce))if(n=i(e,t),n)break;if(n||0!=t.button||(n=function(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=gn(t),o=e.state.selection;return{update(e){e.docChanged&&(n.pos=e.changes.mapPos(n.pos),o=o.map(e.changes))},get(t,s,a){let l,c=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),h=un(e,c.pos,c.assoc,r);if(n.pos!=c.pos&&!s){let t=un(e,n.pos,n.assoc,r),o=Math.min(t.from,h.from),s=Math.max(t.to,h.to);h=o<h.from?i.OF.range(o,s,h.assoc):i.OF.range(s,o,h.assoc)}return s?o.replaceRange(o.main.extend(h.from,h.to,h.assoc)):a&&1==r&&o.ranges.length>1&&(l=function(e,t){for(let n=0;n<e.ranges.length;n++){let{from:r,to:o}=e.ranges[n];if(r<=t&&o>=t)return i.OF.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}(o,c.pos))?l:a?o.addRange(h):i.OF.create([h])}}}(e,t)),n){let i=!e.hasFocus;e.inputState.startMouseSelection(new on(e,t,n,i)),i&&e.observer.ignore(()=>{G(e.contentDOM);let t=e.root.activeElement;t&&!t.contains(e.contentDOM)&&t.blur()});let r=e.inputState.mouseSelection;if(r)return r.start(t),!1===r.dragging}else e.inputState.setSelectionOrigin("select.pointer");return!1};const dn=y.ie&&y.ie_version<=11;let fn=null,pn=0,mn=0;function gn(e){if(!dn)return e.detail;let t=fn,n=mn;return fn=e,mn=Date.now(),pn=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(pn+1)%3:1}function bn(e,t,n,i){if(!(n=cn(e.state,De,n)))return;let r=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:o}=e.inputState,s=i&&o&&function(e,t){let n=e.state.facet(Se);return n.length?n[0](t):y.mac?!t.altKey:!t.ctrlKey}(e,t)?{from:o.from,to:o.to}:null,a={from:r,insert:n},l=e.state.changes(s?[s,a]:a);e.focus(),e.dispatch({changes:l,selection:{anchor:l.mapPos(r,-1),head:l.mapPos(r,1)},userEvent:s?"move.drop":"input.drop"}),e.inputState.draggedContent=null}sn.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let r=e.docView.tile.nearest(t.target);if(r&&r.isWidget()){let e=r.posAtStart,t=e+r.length;(e>=n.to||t<=n.from)&&(n=i.OF.undirectionalRange(e,t))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",cn(e.state,Le,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1},sn.dragend=e=>(e.inputState.draggedContent=null,!1),sn.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let i=Array(n.length),r=0,o=()=>{++r==n.length&&bn(e,t,i.filter(e=>null!=e).join(e.state.lineBreak),!1)};for(let e=0;e<n.length;e++){let t=new FileReader;t.onerror=o,t.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(i[e]=t.result),o()},t.readAsText(n[e])}return!0}{let n=t.dataTransfer.getData("Text");if(n)return bn(e,t,n,!0),!0}return!1},sn.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=ln?null:t.clipboardData;return n?(hn(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(function(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{e.focus(),n.remove(),hn(e,n.value)},50)}(e),!1)};let yn=null;sn.copy=sn.cut=(e,t)=>{if(!P(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:i,linewise:r}=function(e){let t=[],n=[],i=!1;for(let i of e.selection.ranges)i.empty||(t.push(e.sliceDoc(i.from,i.to)),n.push(i));if(!t.length){let r=-1;for(let{from:i}of e.selection.ranges){let o=e.doc.lineAt(i);o.number>r&&(t.push(o.text),n.push({from:o.from,to:Math.min(e.doc.length,o.to+1)})),r=o.number}i=!0}return{text:cn(e,Le,t.join(e.lineBreak)),ranges:n,linewise:i}}(e.state);if(!n&&!r)return!1;yn=r?n:null,"cut"!=t.type||e.state.readOnly||e.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let o=ln?null:t.clipboardData;return o?(o.clearData(),o.setData("text/plain",n),!0):(function(e,t){let n=e.dom.parentNode;if(!n)return;let i=n.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=t,i.focus(),i.selectionEnd=t.length,i.selectionStart=0,setTimeout(()=>{i.remove(),e.focus()},50)}(e,n),!1)};const vn=i.YH.define();function wn(e,t){let n=[];for(let i of e.facet(Oe)){let r=i(e,t);r&&n.push(r)}return n.length?e.update({effects:n,annotations:vn.of(!0)}):null}function kn(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=wn(e.state,t);n?e.dispatch(n):e.update([])}},10)}an.focus=e=>{e.inputState.lastFocusTime=Date.now(),e.scrollDOM.scrollTop||!e.inputState.lastScrollTop&&!e.inputState.lastScrollLeft||(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),kn(e)},an.blur=e=>{e.observer.clearSelectionRange(),kn(e)},an.compositionstart=an.compositionupdate=e=>{e.observer.editContext||(null==e.inputState.compositionFirstChange&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))},an.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,y.chrome&&y.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))},an.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},sn.beforeinput=(e,t)=>{var n,i;if("insertText"!=t.inputType&&"insertCompositionText"!=t.inputType||(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),"insertReplacementText"==t.inputType&&e.observer.editContext){let i=null===(n=t.dataTransfer)||void 0===n?void 0:n.getData("text/plain"),r=t.getTargetRanges();if(i&&r.length){let t=r[0],n=e.posAtDOM(t.startContainer,t.startOffset),o=e.posAtDOM(t.endContainer,t.endOffset);return Yt(e,{from:n,to:o,insert:e.state.toText(i)},null),!0}}let r;if(y.chrome&&y.android&&(r=en.find(e=>e.inputType==t.inputType))&&(e.observer.delayAndroidKey(r.key,r.keyCode),"Backspace"==r.key||"Delete"==r.key)){let t=(null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0;setTimeout(()=>{var n;((null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return y.ios&&"deleteContentForward"==t.inputType&&e.observer.flushSoon(),y.safari&&"insertText"==t.inputType&&e.inputState.composing>=0&&setTimeout(()=>an.compositionend(e,t),20),!1};const xn=new Set,Sn=["pre-wrap","normal","pre-line","break-spaces"];let Cn=!1;function An(){Cn=!1}class Mn{constructor(e){this.lineWrapping=e,this.doc=i.EY.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Sn.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let i=e[n];i<0?n++:this.heightSamples[Math.floor(10*i)]||(t=!0,this.heightSamples[Math.floor(10*i)]=!0)}return t}refresh(e,t,n,i,r,o){let s=Sn.indexOf(e)>-1,a=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=s;if(this.lineWrapping=s,this.lineHeight=t,this.charWidth=n,this.textHeight=i,this.lineLength=r,a){this.heightSamples={};for(let e=0;e<o.length;e++){let t=o[e];t<0?e++:this.heightSamples[Math.floor(10*t)]=!0}}return a}}class Tn{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class On{constructor(e,t,n,i,r){this.from=e,this.length=t,this.top=n,this.height=i,this._content=r}get type(){return"number"==typeof this._content?A.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof D?this._content.widget:null}get widgetLineBreaks(){return"number"==typeof this._content?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new On(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var Dn=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(Dn||(Dn={}));const Ln=.001;class zn{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(2&this.flags)>0}set outdated(e){this.flags=(e?2:0)|-3&this.flags}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Ln&&(Cn=!0),this.height=e)}replace(e,t,n){return zn.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,i){let r=this,o=n.doc;for(let s=i.length-1;s>=0;s--){let{fromA:a,toA:l,fromB:c,toB:h}=i[s],u=r.lineAt(a,Dn.ByPosNoHeight,n.setDoc(t),0,0),d=u.to>=l?u:r.lineAt(l,Dn.ByPosNoHeight,n,0,0);for(h+=d.to-l,l=d.to;s>0&&u.from<=i[s-1].toA;)a=i[s-1].fromA,c=i[s-1].fromB,s--,a<u.from&&(u=r.lineAt(a,Dn.ByPosNoHeight,n,0,0));c+=u.from-a,a=u.from;let f=Wn.build(n.setDoc(o),e,c,h);r=En(r,r.replace(a,l,f))}return r.updateHeight(n,0)}static empty(){return new Pn(0,0,0)}static of(e){if(1==e.length)return e[0];let t=0,n=e.length,i=0,r=0;for(;;)if(t==n)if(i>2*r){let r=e[t-1];r.break?e.splice(--t,1,r.left,null,r.right):e.splice(--t,1,r.left,r.right),n+=1+r.break,i-=r.size}else{if(!(r>2*i))break;{let t=e[n];t.break?e.splice(n,1,t.left,null,t.right):e.splice(n,1,t.left,t.right),n+=2+t.break,r-=t.size}}else if(i<r){let n=e[t++];n&&(i+=n.size)}else{let t=e[--n];t&&(r+=t.size)}let o=0;return null==e[t-1]?(o=1,t--):null==e[t]&&(o=1,n++),new Nn(zn.of(e.slice(0,t)),o,zn.of(e.slice(n)))}}function En(e,t){return e==t?e:(e.constructor!=t.constructor&&(Cn=!0),t)}zn.prototype.size=1;const Bn=M.replace({});class Rn extends zn{constructor(e,t,n){super(e,t),this.deco=n,this.spaceAbove=0}mainBlock(e,t){return new On(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,n,i){return this.spaceAbove&&e<n+this.spaceAbove?new On(i,0,n,this.spaceAbove,Bn):this.mainBlock(n,i)}lineAt(e,t,n,i,r){let o=this.mainBlock(i,r);return this.spaceAbove?this.blockAt(0,n,i,r).join(o):o}forEachLine(e,t,n,i,r,o){e<=r+this.length&&t>=r&&o(this.lineAt(0,Dn.ByPos,n,i,r))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more&&this.setMeasuredHeight(i),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Pn extends Rn{constructor(e,t,n){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,t){return new On(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,n){let i=n[0];return 1==n.length&&(i instanceof Pn||i instanceof In&&4&i.flags)&&Math.abs(this.length-i.length)<10?(i instanceof In?i=new Pn(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):zn.of(n)}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more?this.setMeasuredHeight(i):(n||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class In extends zn{constructor(e){super(e,0)}heightMetrics(e,t){let n,i=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number,o=r-i+1,s=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*o);n=t/o,this.length>o+1&&(s=(this.height-t)/(this.length-o-1))}else n=this.height/o;return{firstLine:i,lastLine:r,perLine:n,perChar:s}}blockAt(e,t,n,i){let{firstLine:r,lastLine:o,perLine:s,perChar:a}=this.heightMetrics(t,i);if(t.lineWrapping){let r=i+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),o=t.doc.lineAt(r),l=s+o.length*a,c=Math.max(n,e-l/2);return new On(o.from,o.length,c,l,0)}{let i=Math.max(0,Math.min(o-r,Math.floor((e-n)/s))),{from:a,length:l}=t.doc.line(r+i);return new On(a,l,n+s*i,s,0)}}lineAt(e,t,n,i,r){if(t==Dn.ByHeight)return this.blockAt(e,n,i,r);if(t==Dn.ByPosNoHeight){let{from:t,to:i}=n.doc.lineAt(e);return new On(t,i-t,0,0,0)}let{firstLine:o,perLine:s,perChar:a}=this.heightMetrics(n,r),l=n.doc.lineAt(e),c=s+l.length*a,h=l.number-o,u=i+s*h+a*(l.from-r-h);return new On(l.from,l.length,Math.max(i,Math.min(u,i+this.height-c)),c,0)}forEachLine(e,t,n,i,r,o){e=Math.max(e,r),t=Math.min(t,r+this.length);let{firstLine:s,perLine:a,perChar:l}=this.heightMetrics(n,r);for(let c=e,h=i;c<=t;){let t=n.doc.lineAt(c);if(c==e){let n=t.number-s;h+=a*n+l*(e-r-n)}let i=a+l*t.length;o(new On(t.from,t.length,h,i,0)),h+=i,c=t.to+1}}replace(e,t,n){let i=this.length-t;if(i>0){let e=n[n.length-1];e instanceof In?n[n.length-1]=new In(e.length+i):n.push(null,new In(i-1))}if(e>0){let t=n[0];t instanceof In?n[0]=new In(e+t.length):n.unshift(new In(e-1),null)}return zn.of(n)}decomposeLeft(e,t){t.push(new In(e-1),null)}decomposeRight(e,t){t.push(null,new In(this.length-e-1))}updateHeight(e,t=0,n=!1,i){let r=t+this.length;if(i&&i.from<=t+this.length&&i.more){let n=[],o=Math.max(t,i.from),s=-1;for(i.from>t&&n.push(new In(i.from-t-1).updateHeight(e,t));o<=r&&i.more;){let t=e.doc.lineAt(o).length;n.length&&n.push(null);let r=i.heights[i.index++],a=0;r<0&&(a=-r,r=i.heights[i.index++]),-1==s?s=r:Math.abs(r-s)>=Ln&&(s=-2);let l=new Pn(t,r,a);l.outdated=!1,n.push(l),o+=t+1}o<=r&&n.push(null,new In(r-o).updateHeight(e,o));let a=zn.of(n);return(s<0||Math.abs(a.height-this.height)>=Ln||Math.abs(s-this.heightMetrics(e,t).perLine)>=Ln)&&(Cn=!0),En(this,a)}return(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class Nn extends zn{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return 1&this.flags}blockAt(e,t,n,i){let r=n+this.left.height;return e<r?this.left.blockAt(e,t,n,i):this.right.blockAt(e,t,r,i+this.left.length+this.break)}lineAt(e,t,n,i,r){let o=i+this.left.height,s=r+this.left.length+this.break,a=t==Dn.ByHeight?e<o:e<s,l=a?this.left.lineAt(e,t,n,i,r):this.right.lineAt(e,t,n,o,s);if(this.break||(a?l.to<s:l.from>s))return l;let c=t==Dn.ByPosNoHeight?Dn.ByPosNoHeight:Dn.ByPos;return a?l.join(this.right.lineAt(s,c,n,o,s)):this.left.lineAt(s,c,n,i,r).join(l)}forEachLine(e,t,n,i,r,o){let s=i+this.left.height,a=r+this.left.length+this.break;if(this.break)e<a&&this.left.forEachLine(e,t,n,i,r,o),t>=a&&this.right.forEachLine(e,t,n,s,a,o);else{let l=this.lineAt(a,Dn.ByPos,n,i,r);e<l.from&&this.left.forEachLine(e,l.from-1,n,i,r,o),l.to>=e&&l.from<=t&&o(l),t>l.to&&this.right.forEachLine(l.to+1,t,n,s,a,o)}}replace(e,t,n){let i=this.left.length+this.break;if(t<i)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,t-i,n));let r=[];e>0&&this.decomposeLeft(e,r);let o=r.length;for(let e of n)r.push(e);if(e>0&&Fn(r,o-1),t<this.length){let e=r.length;this.decomposeRight(t,r),Fn(r,e)}return zn.of(r)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,i=n+this.break;if(e>=i)return this.right.decomposeRight(e-i,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<i&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?zn.of(this.break?[e,null,t]:[e,t]):(this.left=En(this.left,e),this.right=En(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,i){let{left:r,right:o}=this,s=t+r.length+this.break,a=null;return i&&i.from<=t+r.length&&i.more?a=r=r.updateHeight(e,t,n,i):r.updateHeight(e,t,n),i&&i.from<=s+o.length&&i.more?a=o=o.updateHeight(e,s,n,i):o.updateHeight(e,s,n),a?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Fn(e,t){let n,i;null==e[t]&&(n=e[t-1])instanceof In&&(i=e[t+1])instanceof In&&e.splice(t-1,3,new In(n.length+1+i.length))}class Wn{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let e=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof Pn?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new Pn(e-this.pos,-1,0)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let i=n.widget?n.widget.estimatedHeight:0,r=n.widget?n.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let o=t-e;n.block?this.addBlock(new Rn(o,i,n)):(o||r||i>=5)&&this.addLineDeco(i,r,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Pn(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let n=new In(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Pn)return e;let t=new Pn(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let i=this.ensureLine();i.length+=n,i.collapsed+=n,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||t instanceof Pn||this.isCovered?(this.writtenTo<this.pos||null==t)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new Pn(0,-1,0));let n=e;for(let e of this.nodes)e instanceof Pn&&e.updateHeight(this.oracle,n),n+=e?e.length:1;return this.nodes}static build(e,t,n,r){let o=new Wn(n,e);return i.om.spans(t,n,r,o,0),o.finish(n)}}class Hn{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,i){(e<t||n&&n.heightRelevant||i&&i.heightRelevant)&&z(e,t,this.changes,5)}}function qn(e,t){let n=e.getBoundingClientRect(),i=e.ownerDocument,r=i.defaultView||window,o=Math.max(0,n.left),s=Math.min(r.innerWidth,n.right),a=Math.max(0,n.top),l=Math.min(r.innerHeight,n.bottom);for(let t=e.parentNode;t&&t!=i.body;)if(1==t.nodeType){let n=t,i=window.getComputedStyle(n);if((n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)&&"visible"!=i.overflow){let i=n.getBoundingClientRect();o=Math.max(o,i.left),s=Math.min(s,i.right),a=Math.max(a,i.top),l=Math.min(t==e.parentNode?r.innerHeight:l,i.bottom)}t="absolute"==i.position||"fixed"==i.position?n.offsetParent:n.parentNode}else{if(11!=t.nodeType)break;t=t.host}return{left:o-n.left,right:Math.max(o,s)-n.left,top:a-(n.top+t),bottom:Math.max(a,l)-(n.top+t)}}function Vn(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class jn{constructor(e,t,n,i){this.from=e,this.to=t,this.size=n,this.displaySize=i}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],r=t[n];if(i.from!=r.from||i.to!=r.to||i.size!=r.size)return!1}return!0}draw(e,t){return M.replace({widget:new Kn(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class Kn extends C{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class Un{constructor(e,t){this.view=e,this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Xn,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=ne.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=t.facet(Ke).some(e=>"function"!=typeof e&&"cm-lineWrapping"==e.class);this.heightOracle=new Mn(n),this.stateDeco=Jn(t),this.heightMap=zn.empty().applyChanges(this.stateDeco,i.EY.empty,this.heightOracle.setDoc(t.doc),[new et(0,0,0,t.doc.length)]);for(let e=0;e<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());e++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=M.set(this.lineGaps.map(e=>e.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let i=n?t.head:t.anchor;if(!e.some(({from:e,to:t})=>i>=e&&i<=t)){let{from:t,to:n}=this.lineBlockAt(i);e.push(new $n(t,n))}}return this.viewports=e.sort((e,t)=>e.from-t.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Xn:new Zn(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Qn(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=Jn(this.state);let r=e.changedRanges,o=et.extendWithRanges(r,function(e,t,n){let r=new Hn;return i.om.compare(e,t,n,r,0),r.changes}(n,this.stateDeco,e?e.changes:i.VR.empty(this.state.doc.length))),s=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);An(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),o),(this.heightMap.height!=s||Cn)&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=s);let l=o.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<l.from||t.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,t));let c=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,e.flags|=this.updateForViewport(),(c||!e.changes.empty||2&e.flags)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Ee)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,n=window.getComputedStyle(t),r=this.heightOracle,o=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?ne.RTL:ne.LTR;let s=this.heightOracle.mustRefreshForWrapping(o)||"refresh"===this.mustMeasureContent,a=t.getBoundingClientRect(),l=s||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let c=0,h=0;if(a.width&&a.height){let{scaleX:e,scaleY:n}=K(t,a);(e>.005&&Math.abs(this.scaleX-e)>.005||n>.005&&Math.abs(this.scaleY-n)>.005)&&(this.scaleX=e,this.scaleY=n,c|=16,s=l=!0)}let u=(parseInt(n.paddingTop)||0)*this.scaleY,d=(parseInt(n.paddingBottom)||0)*this.scaleY;this.paddingTop==u&&this.paddingBottom==d||(this.paddingTop=u,this.paddingBottom=d,c|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=16);let f=_(this.view.contentDOM,!1).y;f!=this.scrollParent&&(this.scrollParent=f,this.scrollAnchorHeight=-1,this.scrollOffset=0);let p=this.getScrollOffset();this.scrollOffset!=p&&(this.scrollAnchorHeight=-1,this.scrollOffset=p),this.scrolledToBottom=Z(this.scrollParent||e.win);let m=(this.printing?Vn:qn)(t,this.paddingTop),g=m.top-this.pixelViewport.top,b=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let y=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(y!=this.inView&&(this.inView=y,y&&(l=!0)),!this.inView&&!this.scrollTarget&&!function(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left<n.innerWidth&&t.right>0&&t.top<n.innerHeight&&t.bottom>0}(e.dom))return 0;let v=a.width;if(this.contentDOMWidth==v&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,c|=16),l){let t=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(t)&&(s=!0),s||r.lineWrapping&&Math.abs(v-this.contentDOMWidth)>r.charWidth){let{lineHeight:n,charWidth:i,textHeight:a}=e.docView.measureTextSize();s=n>0&&r.refresh(o,n,i,a,Math.max(5,v/i),t),s&&(e.docView.minWidth=0,c|=16)}g>0&&b>0?h=Math.max(g,b):g<0&&b<0&&(h=Math.min(g,b)),An();for(let n of this.viewports){let o=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(s?zn.empty().applyChanges(this.stateDeco,i.EY.empty,this.heightOracle,[new et(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,s,new Tn(n.from,o))}Cn&&(c|=2)}let w=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return w&&(2&c&&(c|=this.updateScaler()),this.viewport=this.getViewport(h,this.scrollTarget),c|=this.updateForViewport()),(2&c||w)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(s?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,r=this.heightOracle,{visibleTop:o,visibleBottom:s}=this,a=new $n(i.lineAt(o-1e3*n,Dn.ByHeight,r,0,0).from,i.lineAt(s+1e3*(1-n),Dn.ByHeight,r,0,0).to);if(t){let{head:e}=t.range;if(e<a.from||e>a.to){let n,o=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),s=i.lineAt(e,Dn.ByPos,r,0,0);n="center"==t.y?(s.top+s.bottom)/2-o/2:"start"==t.y||"nearest"==t.y&&e<a.from?s.top:s.bottom-o,a=new $n(i.lineAt(n-500,Dn.ByHeight,r,0,0).from,i.lineAt(n+o+500,Dn.ByHeight,r,0,0).to)}}return a}mapViewport(e,t){let n=t.mapPos(e.from,-1),i=t.mapPos(e.to,1);return new $n(this.heightMap.lineAt(n,Dn.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,Dn.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,Dn.ByPos,this.heightOracle,0,0),{bottom:r}=this.heightMap.lineAt(t,Dn.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:s}=this;return(0==e||i<=o-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||r>=s+Math.max(10,Math.min(n,250)))&&i>o-2e3&&r<s+2e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let i of e)t.touchesRange(i.from,i.to)||n.push(new jn(t.mapPos(i.from),t.mapPos(i.to),i.size,i.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,r=n?1e4:2e3,o=r>>1,s=r<<1;if(this.defaultTextDirection!=ne.LTR&&!n)return[];let a=[],l=(r,s,c,h)=>{if(s-r<o)return;let u=this.state.selection.main,d=[u.from];u.empty||d.push(u.to);for(let e of d)if(e>r&&e<s)return l(r,e-10,c,h),void l(e+10,s,c,h);let f=function(e,t){for(let n of e)if(t(n))return n}(e,e=>e.from>=c.from&&e.to<=c.to&&Math.abs(e.from-r)<o&&Math.abs(e.to-s)<o&&!d.some(t=>e.from<t&&e.to>t));if(!f){if(s<c.to&&t&&n&&t.visibleRanges.some(e=>e.from<=s&&e.to>=s)){let e=t.moveToLineBoundary(i.OF.cursor(s),!1,!0).head;e>r&&(s=e)}let e=this.gapSize(c,r,s,h);f=new jn(r,s,e,n||e<2e6?e:2e6)}a.push(f)},c=t=>{if(t.length<s||t.type!=A.Text)return;let o=function(e,t,n){let r=[],o=e,s=0;return i.om.spans(n,e,t,{span(){},point(e,t){e>o&&(r.push({from:o,to:e}),s+=e-o),o=t}},20),o<t&&(r.push({from:o,to:t}),s+=t-o),{total:s,ranges:r}}(t.from,t.to,this.stateDeco);if(o.total<s)return;let a,c,h=this.scrollTarget?this.scrollTarget.range.head:null;if(n){let e,n,i=r/this.heightOracle.lineLength*this.heightOracle.lineHeight;if(null!=h){let r=Gn(o,h),s=((this.visibleBottom-this.visibleTop)/2+i)/t.height;e=r-s,n=r+s}else e=(this.visibleTop-t.top-i)/t.height,n=(this.visibleBottom-t.top+i)/t.height;a=Yn(o,e),c=Yn(o,n)}else{let n=o.total*this.heightOracle.charWidth,i=r*this.heightOracle.charWidth,s=0;if(n>2e6)for(let n of e)n.from>=t.from&&n.from<t.to&&n.size!=n.displaySize&&n.from*this.heightOracle.charWidth+s<this.pixelViewport.left&&(s=n.size-n.displaySize);let l,u,d=this.pixelViewport.left+s,f=this.pixelViewport.right+s;if(null!=h){let e=Gn(o,h),t=((f-d)/2+i)/n;l=e-t,u=e+t}else l=(d-i)/n,u=(f+i)/n;a=Yn(o,l),c=Yn(o,u)}a>t.from&&l(t.from,a,t,o),c<t.to&&l(c,t.to,t,o)};for(let e of this.viewportLines)Array.isArray(e.type)?e.type.forEach(c):c(e);return a}gapSize(e,t,n,i){let r=Gn(i,n)-Gn(i,t);return this.heightOracle.lineWrapping?e.height*r:i.total*this.heightOracle.charWidth*r}updateLineGaps(e){jn.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=M.set(e.map(e=>e.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];i.om.spans(t,this.viewport.from,this.viewport.to,{span(e,t){n.push({from:e,to:t})},point(){}},20);let r=0;if(n.length!=this.visibleRanges.length)r=12;else for(let t=0;t<n.length&&!(8&r);t++){let i=this.visibleRanges[t],o=n[t];i.from==o.from&&i.to==o.to||(r|=4,e&&e.mapPos(i.from,-1)==o.from&&e.mapPos(i.to,1)==o.to||(r|=8))}return this.visibleRanges=n,r}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Qn(this.heightMap.lineAt(e,Dn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||Qn(this.heightMap.lineAt(this.scaler.fromDOM(e),Dn.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Qn(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class $n{constructor(e,t){this.from=e,this.to=t}}function Yn({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let i=Math.floor(e*n);for(let e=0;;e++){let{from:n,to:r}=t[e],o=r-n;if(i<=o)return n+i;i-=o}}function Gn(e,t){let n=0;for(let{from:i,to:r}of e.ranges){if(t<=r){n+=t-i;break}n+=r-i}return n/e.total}const Xn={toDOM:e=>e,fromDOM:e=>e,scale:1,eq(e){return e==this}};function Jn(e){let t=e.facet(_e).filter(e=>"function"!=typeof e),n=e.facet($e).filter(e=>"function"!=typeof e);return n.length&&t.push(i.om.join(n)),t}class Zn{constructor(e,t,n){let i=0,r=0,o=0;this.viewports=n.map(({from:n,to:r})=>{let o=t.lineAt(n,Dn.ByPos,e,0,0).top,s=t.lineAt(r,Dn.ByPos,e,0,0).bottom;return i+=s-o,{from:n,to:r,top:o,bottom:s,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(t.height-i);for(let e of this.viewports)e.domTop=o+(e.top-r)*this.scale,o=e.domBottom=e.domTop+(e.bottom-e.top),r=e.bottom}toDOM(e){for(let t=0,n=0,i=0;;t++){let r=t<this.viewports.length?this.viewports[t]:null;if(!r||e<r.top)return i+(e-n)*this.scale;if(e<=r.bottom)return r.domTop+(e-r.top);n=r.bottom,i=r.domBottom}}fromDOM(e){for(let t=0,n=0,i=0;;t++){let r=t<this.viewports.length?this.viewports[t]:null;if(!r||e<r.domTop)return n+(e-i)/this.scale;if(e<=r.domBottom)return r.top+(e-r.domTop);n=r.bottom,i=r.domBottom}}eq(e){return e instanceof Zn&&this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,n)=>t.from==e.viewports[n].from&&t.to==e.viewports[n].to)}}function Qn(e,t){if(1==t.scale)return e;let n=t.toDOM(e.top),i=t.toDOM(e.bottom);return new On(e.from,e.length,n,i-n,Array.isArray(e._content)?e._content.map(e=>Qn(e,t)):e._content)}const ei=i.sj.define({combine:e=>e.join(" ")}),ti=i.sj.define({combine:e=>e.indexOf(!0)>-1}),ni=r.G.newName(),ii=r.G.newName(),ri=r.G.newName(),oi={"&light":"."+ii,"&dark":"."+ri};function si(e,t,n){return new r.G(t,{finish:t=>/&/.test(t)?t.replace(/&\w*/,t=>{if("&"==t)return e;if(!n||!n[t])throw new RangeError(`Unsupported selector: ${t}`);return n[t]}):e+" "+t})}const ai=si("."+ni,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{userSelect:"none",position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},".cm-panels-top":{top:"0"},".cm-panels-bottom":{bottom:"0"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},oi),li={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},ci=y.ie&&y.ie_version<=11;class hi{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new U,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let e of t)this.queue.push(e);(y.ie&&y.ie_version<=11||y.ios&&e.composing)&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():this.flush()}),!window.EditContext||!y.android||!1===e.constructor.EDIT_CONTEXT||y.chrome&&y.chrome_version<126||(this.editContext=new fi(e),e.state.facet(Fe)&&(e.contentDOM.editContext=this.editContext.editContext)),ci&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver(()=>{var e;(null===(e=this.view.docView)||void 0===e?void 0:e.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver(e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){("change"!=e.type&&e.type||e.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,n)=>t!=e[n]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,i=this.selectionRange;if(n.state.facet(Fe)?n.root.activeElement!=this.dom:!P(this.dom,i))return;let r=i.anchorNode&&n.docView.tile.nearest(i.anchorNode);r&&r.isWidget()&&r.widget.ignoreEvent(e)?t||(this.selectionChanged=!1):(y.ie&&y.ie_version<=11||y.android&&y.chrome)&&!n.state.selection.main.empty&&i.focusNode&&N(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=B(e.root);if(!t)return!1;let n=y.safari&&11==e.root.nodeType&&e.root.activeElement==this.dom&&function(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return di(e,n)}let n=null;function i(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",i,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",i,!0),n?di(e,n):null}(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let i=P(this.dom,n);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&function(e,t){let n=t.focusNode,i=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=i)return!1;for(i=Math.min(i,q(n));;)if(i){if(1!=n.nodeType)return!1;let e=n.childNodes[i-1];"false"==e.contentEditable?i--:(n=e,i=q(n))}else{if(n==e)return!0;i=F(n),n=n.parentNode}}(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),i&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(1==n.nodeType)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(n),n=n.assignedSlot||n.parentNode;else{if(11!=n.nodeType)break;n=n.host}if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);for(let e of this.scrollTargets=t)e.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,li),ci&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),ci&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;if(!this.delayedAndroidKey){let e=()=>{let e=this.delayedAndroidKey;e&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&J(this.dom,e.key,e.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}this.delayedAndroidKey&&"Enter"!=e||(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(null===(n=this.delayedAndroidKey)||void 0===n?void 0:n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,i=!1;for(let r of e){let e=this.readMutation(r);e&&(e.typeOver&&(i=!0),-1==t?({from:t,to:n}=e):(t=Math.min(e.from,t),n=Math.max(e.to,n)))}return{from:t,to:n,typeOver:i}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),i=this.selectionChanged&&P(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new _t(this.view,e,t,n);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,i=$t(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!Xt(this.view.state.selection,t.newSel.main))&&this.view.update([]),i}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty("attributes"==e.type),"childList"==e.type){let n=ui(t,e.previousSibling||e.target.previousSibling,-1),i=ui(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:i?t.posBefore(i):t.posAtEnd,typeOver:!1}}return"characterData"==e.type?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Fe)!=e.state.facet(Fe)&&(e.view.contentDOM.editContext=e.state.facet(Fe)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),null===(e=this.intersection)||void 0===e||e.disconnect(),null===(t=this.gapIntersection)||void 0===t||t.disconnect(),null===(n=this.resizeScroll)||void 0===n||n.disconnect();for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function ui(e,t,n){for(;t;){let i=it.get(t);if(i&&i.parent==e)return i;let r=t.parentNode;t=r!=e.dom?r:n>0?t.nextSibling:t.previousSibling}return null}function di(e,t){let n=t.startContainer,i=t.startOffset,r=t.endContainer,o=t.endOffset,s=e.docView.domAtPos(e.state.selection.main.anchor,1);return N(s.node,s.offset,r,o)&&([n,i,r,o]=[r,o,n,i]),{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:o}}class fi{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let r=e.state.selection.main,{anchor:o,head:s}=r,a=this.toEditorPos(n.updateRangeStart),l=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:a,drifted:!1});let c=l-a>n.text.length;a==this.from&&o<this.from?a=o:l==this.to&&o>this.to&&(l=o);let h=Gt(e.state.sliceDoc(a,l),n.text,(c?r.from:r.to)-a,c?"end":null);if(!h){let t=i.OF.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));return void(Xt(t,r)||e.dispatch({selection:t,userEvent:"select"}))}let u={from:h.from+a,to:h.toA+a,insert:i.EY.of(n.text.slice(h.from,h.toB).split("\n"))};if((y.mac||y.android)&&u.from==s-1&&/^\. ?$/.test(n.text)&&"off"==e.contentDOM.getAttribute("autocorrect")&&(u={from:a,to:l,insert:i.EY.of([n.text.replace("."," ")])}),this.pendingContextChange=u,!e.state.readOnly){let t=this.to-this.from+(u.to-u.from+u.insert.length);Yt(e,u,i.OF.single(this.toEditorPos(n.selectionStart,t),this.toEditorPos(n.selectionEnd,t)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),u.from<u.to&&!u.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let i=[],r=null;for(let t=this.toEditorPos(n.rangeStart),o=this.toEditorPos(n.rangeEnd);t<o;t++){let n=e.coordsForChar(t);r=n&&new DOMRect(n.left,n.top,n.right-n.left,n.bottom-n.top)||r||new DOMRect,i.push(r)}t.updateCharacterBounds(n.rangeStart,i)},this.handlers.textformatupdate=t=>{let n=[];for(let e of t.getTextFormats()){let t=e.underlineStyle,i=e.underlineThickness;if(!/none/i.test(t)&&!/none/i.test(i)){let r=this.toEditorPos(e.rangeStart),o=this.toEditorPos(e.rangeEnd);if(r<o){let e=`text-decoration: underline ${/^[a-z]/.test(t)?t+" ":"Dashed"==t?"dashed ":"Squiggle"==t?"wavy ":""}${/thin/i.test(i)?1:2}px`;n.push(M.mark({attributes:{style:e}}).range(r,o))}}}e.dispatch({effects:Ie.of(M.set(n))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:t}=this.composing;this.composing=null,t&&this.reset(e.state)}};for(let e in this.handlers)t.addEventListener(e,this.handlers[e]);this.measureReq={read:e=>{let t=B(e.root);t&&t.rangeCount&&this.editContext.updateSelectionBounds(t.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,i=this.pendingContextChange;return e.changes.iterChanges((r,o,s,a,l)=>{if(n)return;let c=l.length-(o-r);if(i&&o>=i.to){if(i.from==r&&i.to==o&&i.insert.eq(l))return i=this.pendingContextChange=null,t+=c,void(this.to+=c);i=null,this.revertPending(e.state)}if(r+=t,(o+=t)<=this.from)this.from+=c,this.to+=c;else if(r<this.to){if(r<this.from||o>this.to||this.to-this.from+l.length>3e4)return void(n=!0);this.editContext.updateText(this.toContextPos(r),this.toContextPos(o),l.toString()),this.to+=c}t+=c}),i&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(e=>!e.isUserEvent("input.type")&&e.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):this.applyEdits(e)&&this.rangeIsValid(e.state)?(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state):(this.pendingContextChange=null,this.reset(e.state)),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),i=this.toContextPos(t.head);this.editContext.selectionStart==n&&this.editContext.selectionEnd==i||this.editContext.updateSelection(n,i)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>3e4)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class pi{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(e=>e.forEach(e=>n(e,this)))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||function(e){for(;e;){if(e&&(9==e.nodeType||11==e.nodeType&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}(e.parent)||document,this.viewState=new Un(this,e.state||i.$t.create(e)),e.scrollTo&&e.scrollTo.is(Pe)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(He).map(e=>new Ve(e));for(let e of this.plugins)e.update(this);this.observer=new hi(this),this.inputState=new Jt(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Mt(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),(null===(t=document.fonts)||void 0===t?void 0:t.ready)&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=1==e.length&&e[0]instanceof i.ZX?e:1==e.length&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t,n=!1,r=!1,o=this.state;for(let t of e){if(t.startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=t.state}if(this.destroyed)return void(this.viewState.state=o);let s=this.hasFocus,a=0,l=null;e.some(e=>e.annotation(vn))?(this.inputState.notifiedFocused=s,a=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,l=wn(o,s),l||(a=1));let c=this.observer.delayedAndroidKey,h=null;if(c?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(h=null)):this.observer.clear(),o.facet(i.$t.phrases)!=this.state.facet(i.$t.phrases))return this.setState(o);t=tt.create(this,o,e),t.flags|=a;let u=this.viewState.scrollTarget;try{this.updateState=2;for(let t of e){if(u&&(u=u.map(t.changes)),t.scrollIntoView){let{main:e}=t.state.selection,{x:n,y:r}=this.state.facet(pi.cursorScrollMargin);u=new Re(e.empty?e:i.OF.cursor(e.head,e.head>e.anchor?-1:1),"nearest","nearest",r,n)}for(let e of t.effects)e.is(Pe)&&(u=e.value.clip(this.state))}this.viewState.update(t,u),this.bidiCache=bi.update(this.bidiCache,t.changes),t.empty||(this.updatePlugins(t),this.inputState.update(t)),n=this.docView.update(t),this.state.facet(Qe)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(e=>e.isUserEvent("select.pointer")))}finally{this.updateState=0}if(t.startState.facet(ei)!=t.state.facet(ei)&&(this.viewState.mustMeasureContent=!0),(n||r||u||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!t.empty)for(let e of this.state.facet(Me))try{e(t)}catch(e){Ne(this.state,e,"update listener")}(l||h)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),h&&!$t(this,h)&&c.force&&J(this.contentDOM,c.key,c.keyCode)})}setState(e){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=e);this.updateState=2;let t=this.hasFocus;try{for(let e of this.plugins)e.destroy(this);this.viewState=new Un(this,e),this.plugins=e.facet(He).map(e=>new Ve(e)),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new Mt(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(He),n=e.state.facet(He);if(t!=n){let i=[];for(let r of n){let n=t.indexOf(r);if(n<0)i.push(new Ve(r));else{let t=this.plugins[n];t.mustUpdate=e,i.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e<this.plugins.length;e++)this.plugins[e].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(e){Ne(this.state,e,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.viewState.scrollParent,i=this.viewState.getScrollOffset(),{scrollAnchorPos:r,scrollAnchorHeight:o}=this.viewState;Math.abs(i-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(o<0)if(Z(n||this.win))r=-1,o=this.viewState.heightMap.height;else{let e=this.viewState.scrollAnchorAt(i);r=e.from,o=e.top}this.updateState=1;let s=this.viewState.measure();if(!s&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(e>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let a=[];4&s||([this.measureRequests,a]=[a,this.measureRequests]);let l=a.map(e=>{try{return e.read(this)}catch(e){return Ne(this.state,e),gi}}),c=tt.create(this,this.state,[]),h=!1;c.flags|=s,t?t.flags|=s:t=c,this.updateState=2,c.empty||(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),h=this.docView.update(c),h&&this.docViewUpdate());for(let e=0;e<a.length;e++)if(l[e]!=gi)try{let t=a[e];t.write&&t.write(l[e],this)}catch(e){Ne(this.state,e)}if(h&&this.docView.updateSelection(!0),!c.viewportChanged&&0==this.measureRequests.length){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}{let e=((r<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(r).top)-o)/this.scaleY;if((e>1||e<-1)&&!(y.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(n==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){i+=e,n?n.scrollTop+=e:this.win.scrollBy(0,e),o=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(Me))e(t)}get themeClasses(){return ni+" "+(this.state.facet(ti)?ri:ii)+" "+this.state.facet(ei)}updateAttrs(){let e=yi(this,je,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Fe)?"true":"false",class:"cm-content",style:`${y.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),yi(this,Ke,t);let n=this.observer.ignore(()=>{let n=x(this.contentDOM,this.contentAttrs,t),i=x(this.dom,this.editorAttrs,e);return n||i});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let e of n.effects)e.is(pi.announce)&&(t&&(this.announceDOM.textContent=""),t=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=e.value)}mountStyles(){this.styleModules=this.state.facet(Qe);let e=this.state.facet(pi.cspNonce);r.G.mount(this.root,this.styleModules.concat(ai).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(null!=e.key)for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key)return void(this.measureRequests[t]=e);this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(void 0===t||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(t=>t.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return It(this,e,Bt(this,e,t,n))}moveByGroup(e,t){return It(this,e,Bt(this,e,t,t=>function(e,t,n){let r=e.state.charCategorizer(t),o=r(n);return e=>{let t=r(e);return o==i.Je.Space&&(o=t),o==t}}(this,e.head,t)))}visualLineSide(e,t){let n=this.bidiSpans(e),r=this.textDirectionAt(e.from),o=n[t?n.length-1:0];return i.OF.cursor(o.side(t,r)+e.from,o.forward(!t,r)?1:-1)}moveToLineBoundary(e,t,n=!0){return function(e,t,n,r){let o=Et(e,t.head,t.assoc||-1),s=r&&o.type==A.Text&&(e.lineWrapping||o.widgetLineBreaks)?e.coordsAtPos(t.assoc<0&&t.head>o.from?t.head-1:t.head):null;if(s){let t=e.dom.getBoundingClientRect(),r=e.textDirectionAt(o.from),a=e.posAtCoords({x:n==(r==ne.LTR)?t.right-1:t.left+1,y:(s.top+s.bottom)/2});if(null!=a)return i.OF.cursor(a,n?-1:1)}return i.OF.cursor(n?o.to:o.from,n?-1:1)}(this,e,t,n)}moveVertically(e,t,n){return It(this,e,function(e,t,n,r){let o=t.head,s=n?1:-1;if(o==(n?e.state.doc.length:0))return i.OF.cursor(o,t.assoc);let a,l=t.goalColumn,c=e.contentDOM.getBoundingClientRect(),h=e.coordsAtPos(o,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),u=e.documentTop;if(h)null==l&&(l=h.left-c.left),a=s<0?h.top:h.bottom;else{let t=e.viewState.lineBlockAt(o);null==l&&(l=Math.min(c.right-c.left,e.defaultCharacterWidth*(o-t.from))),a=(s<0?t.top:t.bottom)+u}let d=c.left+l,f=e.viewState.heightOracle.textHeight>>1,p=null!=r?r:f;for(let t=0;;t+=f){let r=a+(p+t)*s,o=Ft(e,{x:d,y:r},!1,s);if(n?r>c.bottom:r<c.top)return i.OF.cursor(o.pos,o.assoc);let h=e.coordsAtPos(o.pos,o.assoc),u=h?(h.top+h.bottom)/2:0;if(!h||(n?u>a:u<a))return i.OF.cursor(o.pos,o.assoc,void 0,l)}}(this,e,t,n))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let n=Ft(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),Ft(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.state.doc.lineAt(e),i=this.bidiSpans(n),r=i[de.find(i,e-n.from,-1,t)];return this.docView.coordsAt(e,t,r.dir==ne.RTL)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(ze)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>mi)return ye(e.length);let t,n=this.textDirectionAt(e.from);for(let i of this.bidiCache)if(i.from==e.from&&i.dir==n&&(i.fresh||fe(i.isolates,t=Xe(this,e))))return i.order;t||(t=Xe(this,e));let i=be(e.text,n,t);return this.bidiCache.push(new bi(e.from,e.to,n,t,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||y.safari&&(null===(e=this.inputState)||void 0===e?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{G(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((9==e.nodeType?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){var n,r,o,s;return Pe.of(new Re("number"==typeof e?i.OF.cursor(e):e,null!==(n=t.y)&&void 0!==n?n:"nearest",null!==(r=t.x)&&void 0!==r?r:"nearest",null!==(o=t.yMargin)&&void 0!==o?o:5,null!==(s=t.xMargin)&&void 0!==s?s:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return Pe.of(new Re(i.OF.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){null==e?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:"boolean"==typeof e?this.inputState.tabFocusMode=e?0:-1:0!=this.inputState.tabFocusMode&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return qe.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return qe.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=r.G.newName(),i=[ei.of(n),Qe.of(si(`.${n}`,e))];return t&&t.dark&&i.push(ti.of(!0)),i}static baseTheme(e){return i.Nb.lowest(Qe.of(si("."+ni,e,oi)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),i=n&&it.get(n)||it.get(e);return(null===(t=null==i?void 0:i.root)||void 0===t?void 0:t.view)||null}}pi.styleModule=Qe,pi.inputHandler=Te,pi.clipboardInputFilter=De,pi.clipboardOutputFilter=Le,pi.scrollHandler=Be,pi.focusChangeEffect=Oe,pi.perLineTextDirection=ze,pi.exceptionSink=Ae,pi.updateListener=Me,pi.editable=Fe,pi.mouseSelectionStyle=Ce,pi.dragMovesSelection=Se,pi.clickAddsSelectionRange=xe,pi.decorations=_e,pi.blockWrappers=Ue,pi.outerDecorations=$e,pi.atomicRanges=Ye,pi.bidiIsolatedRanges=Ge,pi.cursorScrollMargin=i.sj.define({combine:e=>{let t=5,n=5;for(let i of e)"number"==typeof i?t=n=i:({x:t,y:n}=i);return{x:t,y:n}}}),pi.scrollMargins=Je,pi.darkTheme=ti,pi.cspNonce=i.sj.define({combine:e=>e.length?e[0]:""}),pi.contentAttributes=Ke,pi.editorAttributes=je,pi.lineWrapping=pi.contentAttributes.of({class:"cm-lineWrapping"}),pi.announce=i.Pe.define();const mi=4096,gi={};class bi{constructor(e,t,n,i,r,o){this.from=e,this.to=t,this.dir=n,this.isolates=i,this.fresh=r,this.order=o}static update(e,t){if(t.empty&&!e.some(e=>e.fresh))return e;let n=[],i=e.length?e[e.length-1].dir:ne.LTR;for(let r=Math.max(0,e.length-10);r<e.length;r++){let o=e[r];o.dir!=i||t.touchesRange(o.from,o.to)||n.push(new bi(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function yi(e,t,n){for(let i=e.state.facet(t),r=i.length-1;r>=0;r--){let t=i[r],o="function"==typeof t?t(e):t;o&&v(o,n)}return n}const vi=y.mac?"mac":y.windows?"win":y.linux?"linux":"key";function wi(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),!1!==n&&t.shiftKey&&(e="Shift-"+e),e}const ki=i.Nb.default(pi.domEventHandlers({keydown:(e,t)=>Oi(Ci(t.state),e,t,"editor")})),xi=i.sj.define({enables:ki}),Si=new WeakMap;function Ci(e){let t=e.facet(xi),n=Si.get(t);return n||Si.set(t,n=function(e,t=vi){let n=Object.create(null),i=Object.create(null),r=(e,t)=>{let n=i[e];if(null==n)i[e]=t;else if(n!=t)throw new Error("Key binding "+e+" is used both as a regular binding and as a multi-stroke prefix")},o=(e,i,o,s,a)=>{var l,c;let h=n[e]||(n[e]=Object.create(null)),u=i.split(/ (?!$)/).map(e=>function(e,t){const n=e.split(/-(?!$)/);let i,r,o,s,a=n[n.length-1];"Space"==a&&(a=" ");for(let e=0;e<n.length-1;++e){const a=n[e];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))i=!0;else if(/^(c|ctrl|control)$/i.test(a))r=!0;else if(/^s(hift)?$/i.test(a))o=!0;else{if(!/^mod$/i.test(a))throw new Error("Unrecognized modifier name: "+a);"mac"==t?s=!0:r=!0}}return i&&(a="Alt-"+a),r&&(a="Ctrl-"+a),s&&(a="Meta-"+a),o&&(a="Shift-"+a),a}(e,t));for(let t=1;t<u.length;t++){let n=u.slice(0,t).join(" ");r(n,!0),h[n]||(h[n]={preventDefault:!0,stopPropagation:!1,run:[t=>{let i=Mi={view:t,prefix:n,scope:e};return setTimeout(()=>{Mi==i&&(Mi=null)},4e3),!0}]})}let d=u.join(" ");r(d,!1);let f=h[d]||(h[d]={preventDefault:!1,stopPropagation:!1,run:(null===(c=null===(l=h._any)||void 0===l?void 0:l.run)||void 0===c?void 0:c.slice())||[]});o&&f.run.push(o),s&&(f.preventDefault=!0),a&&(f.stopPropagation=!0)};for(let i of e){let e=i.scope?i.scope.split(" "):["editor"];if(i.any)for(let t of e){let e=n[t]||(n[t]=Object.create(null));e._any||(e._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:r}=i;for(let t in e)e[t].run.push(e=>r(e,Ti))}let r=i[t]||i.key;if(r)for(let t of e)o(t,r,i.run,i.preventDefault,i.stopPropagation),i.shift&&o(t,"Shift-"+r,i.shift,i.preventDefault,i.stopPropagation)}return n}(t.reduce((e,t)=>e.concat(t),[]))),n}function Ai(e,t,n){return Oi(Ci(e.state),t,e,n)}let Mi=null,Ti=null;function Oi(e,t,n,r){Ti=t;let s=(0,o.xT)(t),a=(0,i.vS)(s,0),l=(0,i.Fh)(a)==s.length&&" "!=s,c="",h=!1,u=!1,d=!1;Mi&&Mi.view==n&&Mi.scope==r&&(c=Mi.prefix+" ",nn.indexOf(t.keyCode)<0&&(u=!0,Mi=null));let f,p,m=new Set,g=e=>{if(e){for(let t of e.run)if(!m.has(t)&&(m.add(t),t(n)))return e.stopPropagation&&(d=!0),!0;e.preventDefault&&(e.stopPropagation&&(d=!0),u=!0)}return!1},b=e[r];return b&&(g(b[c+wi(s,t,!l)])?h=!0:!l||!(t.altKey||t.metaKey||t.ctrlKey)||y.windows&&t.ctrlKey&&t.altKey||y.mac&&t.altKey&&!t.ctrlKey&&!t.metaKey||!(f=o.E3[t.keyCode])||f==s?l&&t.shiftKey&&g(b[c+wi(s,t,!0)])&&(h=!0):(g(b[c+wi(f,t,!0)])||t.shiftKey&&(p=o.BN[t.keyCode])!=s&&p!=f&&g(b[c+wi(p,t,!1)]))&&(h=!0),!h&&g(b._any)&&(h=!0)),u&&(h=!0),h&&d&&t.stopPropagation(),Ti=null,h}class Di{constructor(e,t,n,i,r){this.className=e,this.left=t,this.top=n,this.width=i,this.height=r}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className==this.className&&(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",null!=this.width&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,n){if(n.empty){let i=e.coordsAtPos(n.head,n.assoc||1);if(!i)return[];let r=Li(e);return[new Di(t,i.left-r.left,i.top-r.top,null,i.bottom-i.top)]}return function(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let i=Math.max(n.from,e.viewport.from),r=Math.min(n.to,e.viewport.to),o=e.textDirection==ne.LTR,s=e.contentDOM,a=s.getBoundingClientRect(),l=Li(e),c=s.querySelector(".cm-line"),h=c&&window.getComputedStyle(c),u=a.left+(h?parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)):0),d=a.right-(h?parseInt(h.paddingRight):0),f=Et(e,i,1),p=Et(e,r,-1),m=f.type==A.Text?f:null,g=p.type==A.Text?p:null;if(m&&(e.lineWrapping||f.widgetLineBreaks)&&(m=zi(e,i,1,m)),g&&(e.lineWrapping||p.widgetLineBreaks)&&(g=zi(e,r,-1,g)),m&&g&&m.from==g.from&&m.to==g.to)return y(v(n.from,n.to,m));{let t=m?v(n.from,null,m):w(f,!1),i=g?v(null,n.to,g):w(p,!0),r=[];return(m||f).to<(g||p).from-(m&&g?1:0)||f.widgetLineBreaks>1&&t.bottom+e.defaultLineHeight/2<i.top?r.push(b(u,t.bottom,d,i.top)):t.bottom<i.top&&e.elementAtHeight((t.bottom+i.top)/2).type==A.Text&&(t.bottom=i.top=(t.bottom+i.top)/2),y(t).concat(r).concat(y(i))}function b(e,n,i,r){return new Di(t,e-l.left,n-l.top,Math.max(0,i-e),r-n)}function y({top:e,bottom:t,horizontal:n}){let i=[];for(let r=0;r<n.length;r+=2)i.push(b(n[r],e,n[r+1],t));return i}function v(t,n,i){let r=1e9,s=-1e9,a=[];function l(t,n,l,c,h){let f=e.coordsAtPos(t,t==i.to?-2:2),p=e.coordsAtPos(l,l==i.from?2:-2);f&&p&&(r=Math.min(f.top,p.top,r),s=Math.max(f.bottom,p.bottom,s),h==ne.LTR?a.push(o&&n?u:f.left,o&&c?d:p.right):a.push(!o&&c?u:p.left,!o&&n?d:f.right))}let c=null!=t?t:i.from,h=null!=n?n:i.to;for(let i of e.visibleRanges)if(i.to>c&&i.from<h)for(let r=Math.max(i.from,c),o=Math.min(i.to,h);;){let i=e.state.doc.lineAt(r);for(let s of e.bidiSpans(i)){let e=s.from+i.from,a=s.to+i.from;if(e>=o)break;a>r&&l(Math.max(e,r),null==t&&e<=c,Math.min(a,o),null==n&&a>=h,s.dir)}if(r=i.to+1,r>=o)break}return 0==a.length&&l(c,null==t,h,null==n,e.textDirection),{top:r,bottom:s,horizontal:a}}function w(e,t){let n=a.top+(t?e.top:e.bottom);return{top:n,bottom:n,horizontal:[]}}}(e,t,n)}}function Li(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==ne.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function zi(e,t,n,i){let r=e.coordsAtPos(t,2*n);if(!r)return i;let o=e.dom.getBoundingClientRect(),s=(r.top+r.bottom)/2,a=e.posAtCoords({x:o.left+1,y:s}),l=e.posAtCoords({x:o.right-1,y:s});return null==a||null==l?i:{from:Math.max(i.from,Math.min(a,l)),to:Math.min(i.to,Math.max(a,l))}}class Ei{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(Bi)!=e.state.facet(Bi)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){!1!==this.layer.updateOnDocViewUpdate&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,n=e.facet(Bi);for(;t<n.length&&n[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;e==this.scaleX&&t==this.scaleY||(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((e,t)=>{return n=e,i=this.drawn[t],!(n.constructor==i.constructor&&n.eq(i));var n,i})){let t=this.dom.firstChild,n=0;for(let i of e)i.update&&t&&i.constructor&&this.drawn[n].constructor&&i.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(i.draw(),t);for(;t;){let e=t.nextSibling;t.remove(),t=e}this.drawn=e,y.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Bi=i.sj.define();function Ri(e){return[qe.define(t=>new Ei(t,e)),Bi.of(e)]}const Pi=i.sj.define({combine:e=>(0,i.QR)(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})});function Ii(e={}){return[Pi.of(e),Wi,qi,ji,Ee.of(!0)]}function Ni(e){return e.facet(Pi)}function Fi(e){return e.startState.facet(Pi)!=e.state.facet(Pi)}const Wi=Ri({above:!0,markers(e){let{state:t}=e,n=t.facet(Pi),r=[];for(let o of t.selection.ranges){let s=o==t.selection.main;if(o.empty||n.drawRangeCursor&&!(s&&y.ios&&n.iosSelectionHandles)){let t=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",n=o.empty?o:i.OF.cursor(o.head,o.assoc);for(let i of Di.forRange(e,t,n))r.push(i)}}return r},update(e,t){e.transactions.some(e=>e.selection)&&(t.style.animationName="cm-blink"==t.style.animationName?"cm-blink2":"cm-blink");let n=Fi(e);return n&&Hi(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){Hi(t.state,e)},class:"cm-cursorLayer"});function Hi(e,t){t.style.animationDuration=e.facet(Pi).cursorBlinkRate+"ms"}const qi=Ri({above:!1,markers(e){let t=[],{main:n,ranges:r}=e.state.selection;for(let n of r)if(!n.empty)for(let i of Di.forRange(e,"cm-selectionBackground",n))t.push(i);if(y.ios&&!n.empty&&e.state.facet(Pi).iosSelectionHandles){for(let r of Di.forRange(e,"cm-selectionHandle cm-selectionHandle-start",i.OF.cursor(n.from,1)))t.push(r);for(let r of Di.forRange(e,"cm-selectionHandle cm-selectionHandle-end",i.OF.cursor(n.to,1)))t.push(r)}return t},update:(e,t)=>e.docChanged||e.selectionSet||e.viewportChanged||Fi(e),class:"cm-selectionLayer"}),Vi=y.gecko&&y.gecko_version>=153?"#ffffff01":"transparent",ji=i.Nb.highest(pi.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:`${Vi} !important`},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),Ki=i.Pe.define({map:(e,t)=>null==e?null:t.mapPos(e)}),_i=i.sU.define({create:()=>null,update:(e,t)=>(null!=e&&(e=t.changes.mapPos(e)),t.effects.reduce((e,t)=>t.is(Ki)?t.value:e,e))}),Ui=qe.fromClass(class{constructor(e){this.view=e,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(e){var t;let n=e.state.field(_i);null==n?null!=this.cursor&&(null===(t=this.cursor)||void 0===t||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(e.startState.field(_i)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(_i),n=null!=t&&e.coordsAtPos(t);if(!n)return null;let i=e.scrollDOM.getBoundingClientRect();return{left:n.left-i.left+e.scrollDOM.scrollLeft*e.scaleX,top:n.top-i.top+e.scrollDOM.scrollTop*e.scaleY,height:n.bottom-n.top}}drawCursor(e){if(this.cursor){let{scaleX:t,scaleY:n}=this.view;e?(this.cursor.style.left=e.left/t+"px",this.cursor.style.top=e.top/n+"px",this.cursor.style.height=e.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(e){this.view.state.field(_i)!=e&&this.view.dispatch({effects:Ki.of(e)})}},{eventObservers:{dragover(e){this.setDropPos(this.view.posAtCoords({x:e.clientX,y:e.clientY}))},dragleave(e){e.target!=this.view.contentDOM&&this.view.contentDOM.contains(e.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function $i(){return[_i,Ui]}function Yi(e,t,n,i,r){t.lastIndex=0;for(let o,s=e.iterRange(n,i),a=n;!s.next().done;a+=s.value.length)if(!s.lineBreak)for(;o=t.exec(s.value);)r(a+o.index,o)}class Gi{constructor(e){const{regexp:t,decoration:n,decorate:i,boundary:r,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,i)this.addMatch=(e,t,n,r)=>i(r,n,n+e[0].length,e,t);else if("function"==typeof n)this.addMatch=(e,t,i,r)=>{let o=n(e,t,i);o&&r(i,i+e[0].length,o)};else{if(!n)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(e,t,i,r)=>r(i,i+e[0].length,n)}this.boundary=r,this.maxLength=o}createDeco(e){let t=new i.vB,n=t.add.bind(t);for(let{from:t,to:i}of function(e,t){let n=e.visibleRanges;if(1==n.length&&n[0].from==e.viewport.from&&n[0].to==e.viewport.to)return n;let i=[];for(let{from:r,to:o}of n)r=Math.max(e.state.doc.lineAt(r).from,r-t),o=Math.min(e.state.doc.lineAt(o).to,o+t),i.length&&i[i.length-1].to>=r?i[i.length-1].to=o:i.push({from:r,to:o});return i}(e,this.maxLength))Yi(e.state.doc,this.regexp,t,i,(t,i)=>this.addMatch(i,e,t,n));return t.finish()}updateDeco(e,t){let n=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((t,r,o,s)=>{s>=e.view.viewport.from&&o<=e.view.viewport.to&&(n=Math.min(o,n),i=Math.max(s,i))}),e.viewportMoved||i-n>1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,t.map(e.changes),n,i):t}updateRange(e,t,n,i){for(let r of e.visibleRanges){let o=Math.max(r.from,n),s=Math.min(r.to,i);if(s>=o){let n=e.state.doc.lineAt(o),i=n.to<s?e.state.doc.lineAt(s):n,a=Math.max(r.from,n.from),l=Math.min(r.to,i.to);if(this.boundary){for(;o>n.from;o--)if(this.boundary.test(n.text[o-1-n.from])){a=o;break}for(;s<i.to;s++)if(this.boundary.test(i.text[s-i.from])){l=s;break}}let c,h=[],u=(e,t,n)=>h.push(n.range(e,t));if(n==i)for(this.regexp.lastIndex=a-n.from;(c=this.regexp.exec(n.text))&&c.index<l-n.from;)this.addMatch(c,e,c.index+n.from,u);else Yi(e.state.doc,this.regexp,a,l,(t,n)=>this.addMatch(n,e,t,u));t=t.update({filterFrom:a,filterTo:l,filter:(e,t)=>e<a||t>l,add:h})}}return t}}const Xi=null!=/x/.unicode?"gu":"g",Ji=new RegExp("[\0-\b\n--\u2028\u2029\ufeff-]",Xi),Zi={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Qi=null;const er=i.sj.define({combine(e){let t=(0,i.QR)(e,{render:null,specialChars:Ji,addSpecialChars:null});return(t.replaceTabs=!function(){var e;if(null==Qi&&"undefined"!=typeof document&&document.body){let t=document.body.style;Qi=null!=(null!==(e=t.tabSize)&&void 0!==e?e:t.MozTabSize)}return Qi||!1}())&&(t.specialChars=new RegExp("\t|"+t.specialChars.source,Xi)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,Xi)),t}});function tr(e={}){return[er.of(e),nr||(nr=qe.fromClass(class{constructor(e){this.view=e,this.decorations=M.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(er)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new Gi({regexp:e.specialChars,decoration:(t,n,r)=>{let{doc:o}=n.state,s=(0,i.vS)(t[0],0);if(9==s){let e=o.lineAt(r),t=n.state.tabSize,s=(0,i.y$)(e.text,t,r-e.from);return M.replace({widget:new rr((t-s%t)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=M.replace({widget:new ir(e,s)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(er);e.startState.facet(er)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(e.view)):this.decorations=this.decorator.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}))]}let nr=null;class ir extends C{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=(n=this.code)>=32?"•":10==n?"":String.fromCharCode(9216+n);var n;let i=e.state.phrase("Control character")+" "+(Zi[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,i,t);if(r)return r;let o=document.createElement("span");return o.textContent=t,o.title=i,o.setAttribute("aria-label",i),o.className="cm-specialChar",o}ignoreEvent(){return!1}}class rr extends C{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent="\t",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}const or=qe.fromClass(class{constructor(){this.height=1e3,this.attrs={style:"padding-bottom: 1000px"}}update(e){let{view:t}=e,n=t.viewState.editorHeight-t.defaultLineHeight-t.documentPadding.top-.5;n>=0&&n!=this.height&&(this.height=n,this.attrs={style:`padding-bottom: ${n}px`})}});function sr(){return[or,Ke.of(e=>{var t;return(null===(t=e.plugin(or))||void 0===t?void 0:t.attrs)||null})]}function ar(){return cr}const lr=M.line({class:"cm-activeLine"}),cr=qe.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,n=[];for(let i of e.state.selection.ranges){let r=e.lineBlockAt(i.head);r.from>t&&(n.push(lr.range(r.from)),t=r.from)}return M.set(n)}},{decorations:e=>e.decorations});class hr extends C{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):"function"==typeof this.content?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?I(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),i=V(t[0],"rtl"!=n.direction),r=parseInt(n.lineHeight);return i.bottom-i.top>1.5*r?{left:i.left,right:i.right,top:i.top,bottom:i.top+r}:i}ignoreEvent(){return!1}}function ur(e){let t=qe.fromClass(class{constructor(t){this.view=t,this.placeholder=e?M.set([M.widget({widget:new hr(e),side:1}).range(0)]):M.none}get decorations(){return this.view.state.doc.length?M.none:this.placeholder}},{decorations:e=>e.decorations});return"string"==typeof e?[t,pi.contentAttributes.of({"aria-placeholder":e})]:t}const dr=2e3;function fr(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1),r=e.state.doc.lineAt(n),o=n-r.from,s=o>dr?-1:o==r.length?function(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}(e,t.clientX):(0,i.y$)(r.text,e.state.tabSize,n-r.from);return{line:r.number,col:s,off:o}}function pr(e){let t=(null==e?void 0:e.eventFilter)||(e=>e.altKey&&0==e.button);return pi.mouseSelectionStyle.of((e,n)=>t(n)?function(e,t){let n=fr(e,t),r=e.state.selection;return n?{update(e){if(e.docChanged){let t=e.changes.mapPos(e.startState.doc.line(n.line).from),i=e.state.doc.lineAt(t);n={line:i.number,col:n.col,off:Math.min(n.off,i.length)},r=r.map(e.changes)}},get(t,o,s){let a=fr(e,t);if(!a)return r;let l=function(e,t,n){let r=Math.min(t.line,n.line),o=Math.max(t.line,n.line),s=[];if(t.off>dr||n.off>dr||t.col<0||n.col<0){let a=Math.min(t.off,n.off),l=Math.max(t.off,n.off);for(let t=r;t<=o;t++){let n=e.doc.line(t);n.length<=l&&s.push(i.OF.range(n.from+a,n.to+l))}}else{let a=Math.min(t.col,n.col),l=Math.max(t.col,n.col);for(let t=r;t<=o;t++){let n=e.doc.line(t),r=(0,i.kn)(n.text,a,e.tabSize,!0);if(r<0)s.push(i.OF.cursor(n.to));else{let t=(0,i.kn)(n.text,l,e.tabSize);s.push(i.OF.range(n.from+r,n.from+t))}}}return s}(e.state,n,a);return l.length?s?i.OF.create(l.concat(r.ranges)):i.OF.create(l):r}}:null}(e,n):null)}const mr={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},gr={style:"cursor: crosshair"};function br(e={}){let[t,n]=mr[e.key||"Alt"],i=qe.fromClass(class{constructor(e){this.view=e,this.isDown=!1}set(e){this.isDown!=e&&(this.isDown=e,this.view.update([]))}},{eventObservers:{keydown(e){this.set(e.keyCode==t||n(e))},keyup(e){e.keyCode!=t&&n(e)||this.set(!1)},mousemove(e){this.set(n(e))}}});return[i,pi.contentAttributes.of(e=>{var t;return(null===(t=e.plugin(i))||void 0===t?void 0:t.isDown)?gr:null})]}const yr="-10000px";class vr{constructor(e,t,n,i){this.facet=t,this.createTooltipView=n,this.removeTooltipView=i,this.input=e.state.facet(t),this.tooltips=this.input.filter(e=>e);let r=null;this.tooltipViews=this.tooltips.map(e=>r=n(e,r))}update(e,t){var n;let i=e.state.facet(this.facet),r=i.filter(e=>e);if(i===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let o=[],s=t?[]:null;for(let n=0;n<r.length;n++){let i=r[n],a=-1;if(i){for(let e=0;e<this.tooltips.length;e++){let t=this.tooltips[e];t&&t.create==i.create&&(a=e)}if(a<0)o[n]=this.createTooltipView(i,n?o[n-1]:null),s&&(s[n]=!!i.above);else{let i=o[n]=this.tooltipViews[a];s&&(s[n]=t[a]),i.update&&i.update(e)}}}for(let e of this.tooltipViews)o.indexOf(e)<0&&(this.removeTooltipView(e),null===(n=e.destroy)||void 0===n||n.call(e));return t&&(s.forEach((e,n)=>t[n]=e),t.length=s.length),this.input=i,this.tooltips=r,this.tooltipViews=o,!0}}function wr(e={}){return xr.of(e)}function kr(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const xr=i.sj.define({combine:e=>{var t,n,i;return{position:y.ios?"absolute":(null===(t=e.find(e=>e.position))||void 0===t?void 0:t.position)||"fixed",parent:(null===(n=e.find(e=>e.parent))||void 0===n?void 0:n.parent)||null,tooltipSpace:(null===(i=e.find(e=>e.tooltipSpace))||void 0===i?void 0:i.tooltipSpace)||kr}}}),Sr=new WeakMap,Cr=qe.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(xr);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver="function"==typeof ResizeObserver?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new vr(e,Or,(e,t)=>this.createTooltip(e,t),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,i=e.state.facet(xr);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let e of this.manager.tooltipViews)e.dom.style.position=this.position;n=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let e of this.manager.tooltipViews)this.container.appendChild(e.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),i=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let e=document.createElement("div");e.className="cm-tooltip-arrow",n.dom.appendChild(e)}return n.dom.style.position=this.position,n.dom.style.top=yr,n.dom.style.left="0px",this.container.insertBefore(n.dom,i),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),null===(e=t.destroy)||void 0===e||e.call(t);this.parent&&this.container.remove(),null===(t=this.resizeObserver)||void 0===t||t.disconnect(),null===(n=this.intersectionObserver)||void 0===n||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(y.safari){let t=e.getBoundingClientRect();n=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}else n=!!e.offsetParent&&e.offsetParent!=this.container.ownerDocument.body}if(n||"absolute"==this.position)if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(e=n.width/this.parent.offsetWidth,t=n.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),r=Ze(this.view);return{visible:{left:i.left+r.left,top:i.top+r.top,right:i.right-r.right,bottom:i.bottom-r.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((e,t)=>{let n=this.manager.tooltipViews[t];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(xr).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let e of this.manager.tooltipViews)e.dom.style.position="absolute"}let{visible:n,space:i,scaleX:r,scaleY:o}=e,s=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:h}=c,u=e.pos[a],d=e.size[a];if(!u||!1!==l.clip&&(u.bottom<=Math.max(n.top,i.top)||u.top>=Math.min(n.bottom,i.bottom)||u.right<Math.max(n.left,i.left)-.1||u.left>Math.min(n.right,i.right)+.1)){h.style.top=yr;continue}let f=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,p=f?7:0,m=d.right-d.left,g=null!==(t=Sr.get(c))&&void 0!==t?t:d.bottom-d.top,b=c.offset||Tr,y=this.view.textDirection==ne.LTR,v=d.width>i.right-i.left?y?i.left:i.right-d.width:y?Math.max(i.left,Math.min(u.left-(f?14:0)+b.x,i.right-m)):Math.min(Math.max(i.left,u.left-m+(f?14:0)-b.x),i.right-m),w=this.above[a];!l.strictSide&&(w?u.top-g-p-b.y<i.top:u.bottom+g+p+b.y>i.bottom)&&w==i.bottom-u.bottom>u.top-i.top&&(w=this.above[a]=!w);let k=(w?u.top-i.top:i.bottom-u.bottom)-p;if(k<g&&!1!==c.resize){if(k<this.view.defaultLineHeight){h.style.top=yr;continue}Sr.set(c,g),h.style.height=(g=k)/o+"px"}else h.style.height&&(h.style.height="");let x=w?u.top-g-p-b.y:u.bottom+p+b.y,S=v+m;if(!0!==c.overlap)for(let e of s)e.left<S&&e.right>v&&e.top<x+g&&e.bottom>x&&(x=w?e.top-g-2-p:e.bottom+p+2);if("absolute"==this.position?(h.style.top=(x-e.parent.top)/o+"px",Ar(h,(v-e.parent.left)/r)):(h.style.top=x/o+"px",Ar(h,v/r)),f){let e=u.left+(y?b.x:-b.x)-(v+14-7);f.style.left=e/r+"px"}!0!==c.overlap&&s.push({left:v,top:x,right:S,bottom:x+g}),h.classList.toggle("cm-tooltip-above",w),h.classList.toggle("cm-tooltip-below",!w),c.positioned&&c.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=yr}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Ar(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const Mr=pi.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Tr={x:0,y:0},Or=i.sj.define({enables:[Cr,Mr]}),Dr=i.sj.define({combine:e=>e.reduce((e,t)=>e.concat(t),[])});class Lr{static create(e){return new Lr(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new vr(e,Dr,(e,t)=>this.createHostedView(e,t),e=>e.dom.remove())}createHostedView(e,t){let n=e.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)null===(e=t.destroy)||void 0===e||e.call(t)}passProp(e){let t;for(let n of this.manager.tooltipViews){let i=n[e];if(void 0!==i)if(void 0===t)t=i;else if(t!==i)return}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const zr=Or.compute([Dr],e=>{let t=e.facet(Dr);return 0===t.length?null:{pos:Math.min(...t.map(e=>e.pos)),end:Math.max(...t.map(e=>{var t;return null!==(t=e.end)&&void 0!==t?t:e.pos})),create:Lr.create,above:t[0].above,arrow:t.some(e=>e.arrow)}}),Er=i.sj.define();class Br{constructor(e,t,n,i,r,o){this.view=e,this.source=t,this.field=n,this.locked=i,this.setHover=r,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(e){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,n=e.docView.tile.nearest(t.target);if(!n)return;let i,r=1;if(n.isWidget())i=n.posAtStart;else{if(i=e.posAtCoords(t),null==i)return;let n=e.coordsAtPos(i);if(!n||t.y<n.top||t.y>n.bottom||t.x<n.left-e.defaultCharacterWidth||t.x>n.right+e.defaultCharacterWidth)return;let o=e.bidiSpans(e.state.doc.lineAt(i)).find(e=>e.from<=i&&e.to>=i),s=o&&o.dir==ne.RTL?-1:1;r=t.x<n.left?-s:s}this.activateHover(e,i,r)}activateHover(e,t,n,i){let r=this.source(e,t,n),o=t=>{if(t&&(!Array.isArray(t)||t.length)){let n=Array.isArray(t)?t:[t];i&&this.locked.set(n,i),e.dispatch({effects:this.setHover.of(n)})}};if(r&&"then"in r){let n=this.pending={pos:t};r.then(e=>{this.pending==n&&(this.pending=null,o(e))},t=>Ne(e.state,t,"hover tooltip"))}else o(r)}get tooltip(){let e=this.view.plugin(Cr),t=e?e.manager.tooltips.findIndex(e=>e.create==Lr.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,n;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:r}=this;if(i.length&&!this.locked.has(i)&&r&&!function(e,t){let n,{left:i,right:r,top:o,bottom:s}=e.getBoundingClientRect();if(n=e.querySelector(".cm-tooltip-arrow")){let e=n.getBoundingClientRect();o=Math.min(e.top,o),s=Math.max(e.bottom,s)}return t.clientX>=i-4&&t.clientX<=r+4&&t.clientY>=o-4&&t.clientY<=s+4}(r.dom,e)||this.pending){let{pos:r}=i[0]||this.pending,o=null!==(n=null===(t=i[0])||void 0===t?void 0:t.end)&&void 0!==n?n:r;(r==o?this.view.posAtCoords(this.lastMove)==r:function(e,t,n,i,r){let o=e.scrollDOM.getBoundingClientRect(),s=e.documentTop+e.documentPadding.top+e.contentHeight;if(o.left>i||o.right<i||o.top>r||Math.min(o.bottom,s)<r)return!1;let a=e.posAtCoords({x:i,y:r},!1);return a>=t&&a<=n}(this.view,r,o,e.clientX,e.clientY))||(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length&&!this.locked.has(t)){let{tooltip:t}=this;t&&t.dom.contains(e.relatedTarget)?this.watchTooltipLeave(t.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=n=>{e.removeEventListener("mouseleave",t);let{active:i}=this;!i.length||this.locked.has(i)||this.view.dom.contains(n.relatedTarget)||this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}function Rr(e,t={}){let n=i.Pe.define(),r=new WeakMap,o=i.sU.define({create:()=>[],update(e,s){let a=r.get(e);if(e.length&&(t.hideOnChange&&(s.docChanged||s.selection)||a&&a(s)?e=[]:t.hideOn&&(e=e.filter(e=>!t.hideOn(s,e)))),s.docChanged&&e.length){let t=[];for(let n of e){let e=s.changes.mapPos(n.pos,-1,i.iR.TrackDel);if(null!=e){let i=Object.assign(Object.create(null),n);i.pos=e,null!=i.end&&(i.end=s.changes.mapPos(i.end)),t.push(i)}}e=t}for(let t of s.effects)t.is(n)&&(e=t.value,a=void 0),(t.is(Fr)&&!t.value||t.value==o)&&(e=[]);return e.length&&a&&r.set(e,a),e},provide:e=>Dr.from(e)});const s=qe.define(i=>new Br(i,e,o,r,n,t.hoverTime||300));return{active:o,extension:[o,s,Er.of(s),zr]}}function Pr(e,t,n,i={}){var r;let o=e.state.facet(Er).map(t=>e.plugin(t)).filter(e=>!!e);if(i.tooltip&&i.tooltip.active){let e=o.find(e=>e.field==i.tooltip.active);e&&(o=[e])}for(let s of o)s.activateHover(e,t,n,null!==(r=i.until)&&void 0!==r?r:()=>!1)}function Ir(e,t){let n=e.plugin(Cr);if(!n)return null;let i=n.manager.tooltips.indexOf(t);return i<0?null:n.manager.tooltipViews[i]}function Nr(e){return e.facet(Dr).some(e=>e)}const Fr=i.Pe.define(),Wr=Fr.of(null);function Hr(e){return Fr.of(e.active)}function qr(e){let t=e.plugin(Cr);t&&t.maybeMeasure()}const Vr=i.sj.define({combine(e){let t,n;for(let i of e)t=t||i.topContainer,n=n||i.bottomContainer;return{topContainer:t,bottomContainer:n}}});function jr(e){return e?[Vr.of(e)]:[]}function Kr(e,t){let n=e.plugin(_r),i=n?n.specs.indexOf(t):-1;return i>-1?n.panels[i]:null}const _r=qe.fromClass(class{constructor(e){this.input=e.state.facet(Yr),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(t=>t(e));let t=e.state.facet(Vr);this.top=new Ur(e,!0,t.topContainer),this.bottom=new Ur(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top));for(let e of this.panels)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}update(e){let t=e.state.facet(Vr);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new Ur(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ur(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(Yr);if(n!=this.input){let t=n.filter(e=>e),i=[],r=[],o=[],s=[];for(let n of t){let t,a=this.specs.indexOf(n);a<0?(t=n(e.view),s.push(t)):(t=this.panels[a],t.update&&t.update(e)),i.push(t),(t.top?r:o).push(t)}this.specs=t,this.panels=i,this.top.sync(r),this.bottom.sync(o);for(let e of s)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>pi.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class Ur{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=$r(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=$r(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function $r(e){let t=e.nextSibling;return e.remove(),t}const Yr=i.sj.define({enables:_r});function Gr(e,t){let n,r=new Promise(e=>n=e),o=e=>function(e,t,n){let i=t.content?t.content(e,()=>a(null)):null;if(!i){if(i=(0,s.A)("form"),t.input){let e=(0,s.A)("input",t.input);/^(text|password|number|email|tel|url)$/.test(e.type)&&e.classList.add("cm-textfield"),e.name||(e.name="input"),i.appendChild((0,s.A)("label",(t.label||"")+": ",e))}else i.appendChild(document.createTextNode(t.label||""));i.appendChild(document.createTextNode(" ")),i.appendChild((0,s.A)("button",{class:"cm-button",type:"submit"},t.submitLabel||"OK"))}let r="FORM"==i.nodeName?[i]:i.querySelectorAll("form");for(let e=0;e<r.length;e++){let t=r[e];t.addEventListener("keydown",e=>{27==e.keyCode?(e.preventDefault(),a(null)):13==e.keyCode&&(e.preventDefault(),a(t))}),t.addEventListener("submit",e=>{e.preventDefault(),a(t)})}let o=(0,s.A)("div",i,(0,s.A)("button",{onclick:()=>a(null),"aria-label":e.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));function a(t){o.contains(o.ownerDocument.activeElement)&&e.focus(),n(t)}return t.class&&(o.className=t.class),o.classList.add("cm-dialog"),{dom:o,top:t.top,mount:()=>{if(t.focus){let e;e="string"==typeof t.focus?i.querySelector(t.focus):i.querySelector("input")||i.querySelector("button"),e&&"select"in e?e.select():e&&"focus"in e&&e.focus()}}}}(e,t,n);e.state.field(Jr,!1)?e.dispatch({effects:Zr.of(o)}):e.dispatch({effects:i.Pe.appendConfig.of(Jr.init(()=>[o]))});let a=Qr.of(o);return{close:a,result:r.then(t=>((e.win.queueMicrotask||(t=>e.win.setTimeout(t,10)))(()=>{e.state.field(Jr).indexOf(o)>-1&&e.dispatch({effects:a})}),t))}}function Xr(e,t){let n=e.state.field(Jr,!1)||[];for(let i of n){let n=Kr(e,i);if(n&&n.dom.classList.contains(t))return n}return null}const Jr=i.sU.define({create:()=>[],update(e,t){for(let n of t.effects)n.is(Zr)?e=[n.value].concat(e):n.is(Qr)&&(e=e.filter(e=>e!=n.value));return e},provide:e=>Yr.computeN([e],t=>t.field(e))}),Zr=i.Pe.define(),Qr=i.Pe.define();class eo extends i.FB{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}eo.prototype.elementClass="",eo.prototype.toDOM=void 0,eo.prototype.mapMode=i.iR.TrackBefore,eo.prototype.startSide=eo.prototype.endSide=-1,eo.prototype.point=!0;const to=i.sj.define(),no=i.sj.define(),io={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>i.om.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},ro=i.sj.define();function oo(e){return[ao(),ro.of({...io,...e})]}const so=i.sj.define({combine:e=>e.some(e=>e)});function ao(e){let t=[lo];return e&&!1===e.fixed&&t.push(so.of(!0)),t}const lo=qe.fromClass(class{constructor(e){this.view=e,this.domAfter=null,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(ro).map(t=>new fo(e,t)),this.fixed=!e.state.facet(so);for(let e of this.gutters)"after"==e.config.side?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,i=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(i<.8*(n.to-n.from))}if(e.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(so)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=i.om.iter(this.view.state.facet(to),this.view.viewport.from),r=[],o=this.gutters.map(e=>new uo(e,this.view.viewport,-this.view.documentPadding.top));for(let e of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(e.type)){let t=!0;for(let i of e.type)if(i.type==A.Text&&t){ho(n,r,i.from);for(let e of o)e.line(this.view,i,r);t=!1}else if(i.widget)for(let e of o)e.widget(this.view,i)}else if(e.type==A.Text){ho(n,r,e.from);for(let t of o)t.line(this.view,e,r)}else if(e.widget)for(let t of o)t.widget(this.view,e);for(let e of o)e.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let t=e.startState.facet(ro),n=e.state.facet(ro),r=e.docChanged||e.heightChanged||e.viewportChanged||!i.om.eq(e.startState.facet(to),e.state.facet(to),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let t of this.gutters)t.update(e)&&(r=!0);else{r=!0;let i=[];for(let r of n){let n=t.indexOf(r);n<0?i.push(new fo(this.view,r)):(this.gutters[n].update(e),i.push(this.gutters[n]))}for(let e of this.gutters)e.dom.remove(),i.indexOf(e)<0&&e.destroy();for(let e of i)"after"==e.config.side?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.gutters=i}return r}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>pi.scrollMargins.of(t=>{let n=t.plugin(e);if(!n||0==n.gutters.length||!n.fixed)return null;let i=n.dom.offsetWidth*t.scaleX,r=n.domAfter?n.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==ne.LTR?{left:i,right:r}:{right:i,left:r}})});function co(e){return Array.isArray(e)?e:[e]}function ho(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class uo{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=i.om.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:i}=this,r=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==i.elements.length){let t=new po(e,o,r,n);i.elements.push(t),i.dom.appendChild(t.dom)}else i.elements[this.i].update(e,o,r,n);this.height=t.bottom,this.i++}line(e,t,n){let i=[];ho(this.cursor,i,t.from),n.length&&(i=i.concat(n));let r=this.gutter.config.lineMarker(e,t,i);r&&i.unshift(r);let o=this.gutter;(0!=i.length||o.config.renderEmptyElements)&&this.addElement(e,t,i)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),i=n?[n]:null;for(let n of e.state.facet(no)){let r=n(e,t.widget,t);r&&(i||(i=[])).push(r)}i&&this.addElement(e,t,i)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class fo{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in t.domEventHandlers)this.dom.addEventListener(n,i=>{let r,o=i.target;if(o!=this.dom&&this.dom.contains(o)){for(;o.parentNode!=this.dom;)o=o.parentNode;let e=o.getBoundingClientRect();r=(e.top+e.bottom)/2}else r=i.clientY;let s=e.lineBlockAtHeight(r-e.documentTop);t.domEventHandlers[n](e,s,i)&&i.preventDefault()});this.markers=co(t.markers(e)),t.initialSpacer&&(this.spacer=new po(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=co(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let t=this.config.updateSpacer(this.spacer.markers[0],e);t!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[t])}let n=e.view.viewport;return!i.om.eq(this.markers,t,n.from,n.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(e)}destroy(){for(let e of this.elements)e.destroy()}}class po{constructor(e,t,n,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,i)}update(e,t,n,i){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),function(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].compare(t[n]))return!1;return!0}(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,t){let n="cm-gutterElement",i=this.dom.firstChild;for(let r=0,o=0;;){let s=o,a=r<t.length?t[r++]:null,l=!1;if(a){let e=a.elementClass;e&&(n+=" "+e);for(let e=o;e<this.markers.length;e++)if(this.markers[e].compare(a)){s=e,l=!0;break}}else s=this.markers.length;for(;o<s;){let e=this.markers[o++];if(e.toDOM){e.destroy(i);let t=i.nextSibling;i.remove(),i=t}}if(!a)break;a.toDOM&&(l?i=i.nextSibling:this.dom.insertBefore(a.toDOM(e),i)),l&&o++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}}const mo=i.sj.define(),go=i.sj.define(),bo=i.sj.define({combine:e=>(0,i.QR)(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let e in t){let i=n[e],r=t[e];n[e]=i?(e,t,n)=>i(e,t,n)||r(e,t,n):r}return n}})});class yo extends eo{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function vo(e,t){return e.state.facet(bo).formatNumber(t,e.state)}const wo=ro.compute([bo],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:e=>e.state.facet(mo),lineMarker:(e,t,n)=>n.some(e=>e.toDOM)?null:new yo(vo(e,e.state.doc.lineAt(t.from).number)),widgetMarker:(e,t,n)=>{for(let i of e.state.facet(go)){let r=i(e,t,n);if(r)return r}return null},lineMarkerChange:e=>e.startState.facet(bo)!=e.state.facet(bo),initialSpacer:e=>new yo(vo(e,xo(e.state.doc.lines))),updateSpacer(e,t){let n=vo(t.view,xo(t.view.state.doc.lines));return n==e.number?e:new yo(n)},domEventHandlers:e.facet(bo).domEventHandlers,side:"before"}));function ko(e={}){return[bo.of(e),ao(),wo]}function xo(e){let t=9;for(;t<e;)t=10*t+9;return t}const So=new class extends eo{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},Co=to.compute(["selection"],e=>{let t=[],n=-1;for(let i of e.selection.ranges){let r=e.doc.lineAt(i.head).from;r>n&&(n=r,t.push(So.range(r)))}return i.om.of(t)});function Ao(){return Co}function Mo(e){return qe.define(t=>({decorations:e.createDeco(t),update(t){this.decorations=e.updateDeco(t,this.decorations)}}),{decorations:e=>e.decorations})}const To=M.mark({class:"cm-highlightTab"}),Oo=M.mark({class:"cm-highlightSpace"}),Do=Mo(new Gi({regexp:/\t| /g,decoration:e=>"\t"==e[0]?To:Oo,boundary:/\S/}));function Lo(){return Do}const zo=Mo(new Gi({regexp:/\s+$/g,decoration:M.mark({class:"cm-trailingSpace"})}));function Eo(){return zo}const Bo={HeightMap:zn,HeightOracle:Mn,MeasuredHeights:Tn,QueryType:Dn,ChangedRange:et,computeOrder:be,moveVisually:we,clearHeightChangeFlag:An,getHeightChangeFlag:()=>Cn};n.d(t,["DK",0,Or,"EV",0,to,"QO",0,no,"S7",0,Yr,"pK",0,mo,"qy",0,go,"rU",0,Bo,"vo",0,Wr,"w4",0,xi])},2931(e,t,n){n.r(t),n.d(t,{Annotation:()=>s.YH,AnnotationType:()=>s.UJ,BidiSpan:()=>a.tF,BlockInfo:()=>a.uF,BlockType:()=>a._B,BlockWrapper:()=>a.l_,ChangeDesc:()=>s.Gu,ChangeSet:()=>s.VR,CharCategory:()=>s.Je,Compartment:()=>s.xx,Decoration:()=>a.NZ,Direction:()=>a.OP,EditorSelection:()=>s.OF,EditorState:()=>s.$t,EditorView:()=>a.Lz,ExternalChange:()=>q,Facet:()=>s.sj,GutterMarker:()=>a.wJ,Line:()=>s.N1,MapMode:()=>s.iR,MatchDecorator:()=>a.dT,Prec:()=>s.Nb,Range:()=>s.Q6,RangeSet:()=>s.om,RangeSetBuilder:()=>s.vB,RangeValue:()=>s.FB,RectangleMarker:()=>a.Ip,SelectionRange:()=>s.yn,StateEffect:()=>s.Pe,StateEffectType:()=>s.DA,StateField:()=>s.sU,Text:()=>s.EY,Transaction:()=>s.ZX,ViewPlugin:()=>a.Z9,ViewUpdate:()=>a.X3,WidgetType:()=>a.xO,__test:()=>a.rU,activateHover:()=>a.ab,basicSetup:()=>c.o,closeHoverTooltip:()=>a.ut,closeHoverTooltips:()=>a.vo,codePointAt:()=>s.vS,codePointSize:()=>s.Fh,color:()=>O,combineConfig:()=>s.QR,countColumn:()=>s.y$,crosshairCursor:()=>a.HJ,default:()=>$,defaultLightThemeOption:()=>E,drawSelection:()=>a.VH,dropCursor:()=>a.A,findClusterBreak:()=>s.zK,findColumn:()=>s.kn,fromCodePoint:()=>s.MK,getDefaultExtensions:()=>B,getDialog:()=>a.rC,getDrawSelectionConfig:()=>a.$G,getPanel:()=>a.ld,getStatistics:()=>R,getTooltip:()=>a.Eg,gutter:()=>a.cU,gutterLineClass:()=>a.EV,gutterWidgetClass:()=>a.QO,gutters:()=>a.Hm,hasHoverTooltips:()=>a.n6,highlightActiveLine:()=>a.dz,highlightActiveLineGutter:()=>a.Wu,highlightSpecialChars:()=>a.N$,highlightTrailingWhitespace:()=>a.wu,highlightWhitespace:()=>a.Yq,hoverTooltip:()=>a.Ux,keymap:()=>a.w4,layer:()=>a.qd,lineNumberMarkers:()=>a.pK,lineNumberWidgetMarker:()=>a.qy,lineNumbers:()=>a.$K,logException:()=>a.c_,minimalSetup:()=>c.V,oneDark:()=>z,oneDarkHighlightStyle:()=>L,oneDarkTheme:()=>D,panels:()=>a.C3,placeholder:()=>a.qf,rectangularSelection:()=>a.D4,repositionTooltips:()=>a.Pq,runScopeHandlers:()=>a.TS,scrollPastEnd:()=>a.BE,showDialog:()=>a.ui,showPanel:()=>a.S7,showTooltip:()=>a.DK,tooltips:()=>a.vX,useCodeMirror:()=>j});var i=n(5062),r=n(6905),o=n(1609),s=n(2701),a=n(9747),l=n(4658),c=n(6102),h=n(6684),u=n(1318);const d="#e5c07b",f="#e06c75",p="#56b6c2",m="#ffffff",g="#abb2bf",b="#7d8799",y="#61afef",v="#98c379",w="#d19a66",k="#c678dd",x="#21252b",S="#2c313a",C="#282c34",A="#353a42",M="#3E4451",T="#528bff",O={chalky:d,coral:f,cyan:p,invalid:m,ivory:g,stone:b,malibu:y,sage:v,whiskey:w,violet:k,darkBackground:x,highlightBackground:S,background:C,tooltipBackground:A,selection:M,cursor:T},D=a.Lz.theme({"&":{color:g,backgroundColor:C},".cm-content":{caretColor:T},".cm-cursor, .cm-dropCursor":{borderLeftColor:T},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:M},".cm-panels":{backgroundColor:x,color:g},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:C,color:b,border:"none"},".cm-activeLineGutter":{backgroundColor:S},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:A},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:A,borderBottomColor:A},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:S,color:g}}},{dark:!0}),L=h.cr.define([{tag:u._A.keyword,color:k},{tag:[u._A.name,u._A.deleted,u._A.character,u._A.propertyName,u._A.macroName],color:f},{tag:[u._A.function(u._A.variableName),u._A.labelName],color:y},{tag:[u._A.color,u._A.constant(u._A.name),u._A.standard(u._A.name)],color:w},{tag:[u._A.definition(u._A.name),u._A.separator],color:g},{tag:[u._A.typeName,u._A.className,u._A.number,u._A.changed,u._A.annotation,u._A.modifier,u._A.self,u._A.namespace],color:d},{tag:[u._A.operator,u._A.operatorKeyword,u._A.url,u._A.escape,u._A.regexp,u._A.link,u._A.special(u._A.string)],color:p},{tag:[u._A.meta,u._A.comment],color:b},{tag:u._A.strong,fontWeight:"bold"},{tag:u._A.emphasis,fontStyle:"italic"},{tag:u._A.strikethrough,textDecoration:"line-through"},{tag:u._A.link,color:b,textDecoration:"underline"},{tag:u._A.heading,fontWeight:"bold",color:f},{tag:[u._A.atom,u._A.bool,u._A.special(u._A.variableName)],color:w},{tag:[u._A.processingInstruction,u._A.string,u._A.inserted],color:v},{tag:u._A.invalid,color:m}]),z=[D,(0,h.y9)(L)];var E=a.Lz.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),B=function(e){void 0===e&&(e={});var t=e,n=t.indentWithTab,i=void 0===n||n,r=t.editable,o=void 0===r||r,h=t.readOnly,u=void 0!==h&&h,d=t.theme,f=void 0===d?"light":d,p=t.placeholder,m=void 0===p?"":p,g=t.basicSetup,b=void 0===g||g,y=[];switch(i&&y.unshift(a.w4.of([l.Yc])),b&&("boolean"==typeof b?y.unshift((0,c.o)()):y.unshift((0,c.o)(b))),m&&y.unshift((0,a.qf)(m)),f){case"light":y.push(E);break;case"dark":y.push(z);break;case"none":break;default:y.push(f)}return!1===o&&y.push(a.Lz.editable.of(!1)),u&&y.push(s.$t.readOnly.of(!0)),[...y]},R=e=>({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to)),selectedText:e.state.selection.ranges.some(e=>!e.empty)});class P{constructor(e,t){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=t,this.timeoutMS=t,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(e=>{try{e()}catch(e){console.error("TimeoutLatch callback error:",e)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class I{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),0===this.latches.size&&this.stop()}start(){null===this.interval&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){null!==this.interval&&(clearInterval(this.interval),this.interval=null)}}var N=null,F=a.Lz.theme({"& .cm-scroller":{height:"100% !important"}}),W=null,H=null,q=s.YH.define(),V=[];function j(e){var t=e.value,n=e.selection,i=e.onChange,r=e.onStatistics,l=e.onCreateEditor,c=e.onUpdate,h=e.extensions,u=void 0===h?V:h,d=e.autoFocus,f=e.theme,p=void 0===f?"light":f,m=e.height,g=void 0===m?null:m,b=e.minHeight,y=void 0===b?null:b,v=e.maxHeight,w=void 0===v?null:v,k=e.width,x=void 0===k?null:k,S=e.minWidth,C=void 0===S?null:S,A=e.maxWidth,M=void 0===A?null:A,T=e.placeholder,O=void 0===T?"":T,D=e.editable,L=void 0===D||D,z=e.readOnly,E=void 0!==z&&z,j=e.indentWithTab,K=void 0===j||j,_=e.basicSetup,U=void 0===_||_,$=e.root,Y=e.initialState,G=(0,o.useState)(),X=G[0],J=G[1],Z=(0,o.useState)(),Q=Z[0],ee=Z[1],te=(0,o.useState)(),ne=te[0],ie=te[1],re=(0,o.useState)(()=>({current:null}))[0],oe=(0,o.useState)(()=>({current:null}))[0],se=function(e,t,n,i,r,o){if(!(e||t||n||i||r||o))return null;var s=JSON.stringify({height:e,minHeight:t,maxHeight:n,width:i,minWidth:r,maxWidth:o});return s===W?H:(W=s,H=a.Lz.theme({"&":{height:e,minHeight:t,maxHeight:n,width:i,minWidth:r,maxWidth:o}}))}(g,y,w,x,C,M),ae=a.Lz.updateListener.of(e=>{if(e.docChanged&&"function"==typeof i&&!e.transactions.some(e=>e.annotation(q))){re.current?re.current.reset():(re.current=new P(()=>{if(oe.current){var e=oe.current;oe.current=null,e()}re.current=null},200),("undefined"==typeof window?new I:(N||(N=new I),N)).add(re.current));var t=e.state.doc.toString();i(t,e)}r&&r(R(e))}),le=B({theme:p,editable:L,readOnly:E,placeholder:O,indentWithTab:K,basicSetup:U}),ce=[ae,...se?[se]:[],F,...le];return c&&"function"==typeof c&&ce.push(a.Lz.updateListener.of(c)),ce=ce.concat(u),(0,o.useLayoutEffect)(()=>{if(X&&!ne){var e={doc:t,selection:n,extensions:ce},i=Y?s.$t.fromJSON(Y.json,e,Y.fields):s.$t.create(e);if(ie(i),!Q){var r=new a.Lz({state:i,parent:X,root:$});ee(r),l&&l(r,i)}}return()=>{Q&&(ie(void 0),ee(void 0))}},[X,ne]),(0,o.useEffect)(()=>{e.container&&J(e.container)},[e.container]),(0,o.useEffect)(()=>()=>{Q&&(Q.destroy(),ee(void 0)),re.current&&(re.current.cancel(),re.current=null)},[Q]),(0,o.useEffect)(()=>{d&&Q&&Q.focus()},[d,Q]),(0,o.useEffect)(()=>{Q&&Q.dispatch({effects:s.Pe.reconfigure.of(ce)})},[p,u,g,y,w,x,C,M,O,L,E,K,U,i,c]),(0,o.useEffect)(()=>{if(void 0!==t){var e=Q?Q.state.doc.toString():"";if(Q&&t!==e){var n=()=>{Q&&t!==Q.state.doc.toString()&&Q.dispatch({changes:{from:0,to:Q.state.doc.toString().length,insert:t||""},annotations:[q.of(!0)]})};re.current&&!re.current.isDone?oe.current=n:n()}}},[t,Q]),{state:ne,setState:ie,view:Q,setView:ee,container:X,setContainer:J}}var K=n(790),_=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],U=(0,o.forwardRef)((e,t)=>{var n=e.className,s=e.value,a=void 0===s?"":s,l=e.selection,c=e.extensions,h=void 0===c?[]:c,u=e.onChange,d=e.onStatistics,f=e.onCreateEditor,p=e.onUpdate,m=e.autoFocus,g=e.theme,b=void 0===g?"light":g,y=e.height,v=e.minHeight,w=e.maxHeight,k=e.width,x=e.minWidth,S=e.maxWidth,C=e.basicSetup,A=e.placeholder,M=e.indentWithTab,T=e.editable,O=e.readOnly,D=e.root,L=e.initialState,z=(0,r.A)(e,_),E=(0,o.useRef)(null),B=j({root:D,value:a,autoFocus:m,theme:b,height:y,minHeight:v,maxHeight:w,width:k,minWidth:x,maxWidth:S,basicSetup:C,placeholder:A,indentWithTab:M,editable:T,readOnly:O,selection:l,onChange:u,onStatistics:d,onCreateEditor:f,onUpdate:p,extensions:h,initialState:L}),R=B.state,P=B.view,I=B.container,N=B.setContainer;(0,o.useImperativeHandle)(t,()=>({editor:E.current,state:R,view:P}),[E,I,R,P]);var F=(0,o.useCallback)(e=>{E.current=e,N(e)},[N]);if("string"!=typeof a)throw new Error("value must be typeof string but got "+typeof a);var W="string"==typeof b?"cm-theme-"+b:"cm-theme";return(0,K.jsx)("div",(0,i.A)({ref:F,className:W+(n?" "+n:"")},z))});U.displayName="CodeMirror";const $=U},8843(e,t,n){n.r(t),n.d(t,{Lexer:()=>Gi,List:()=>lt,OffsetToLocation:()=>pt,TokenStream:()=>kt,clone:()=>rc,createLexer:()=>uc,createSyntax:()=>tr,definitionSyntax:()=>ae,find:()=>fc,findAll:()=>mc,findLast:()=>pc,fork:()=>yc,fromPlainObject:()=>bc,generate:()=>cc,ident:()=>le,isCustomProperty:()=>rn,keyword:()=>en,lexer:()=>hc,parse:()=>lc,property:()=>tn,string:()=>Y,toPlainObject:()=>gc,tokenNames:()=>mt,tokenTypes:()=>i,tokenize:()=>ac,url:()=>ee,vendorPrefix:()=>nn,version:()=>"3.2.1",walk:()=>dc});var i={};n.r(i),n.d(i,{AtKeyword:()=>de,BadString:()=>me,BadUrl:()=>be,CDC:()=>Ce,CDO:()=>Se,Colon:()=>Ae,Comma:()=>Te,Comment:()=>Re,Delim:()=>ye,Dimension:()=>ke,EOF:()=>ce,Function:()=>ue,Hash:()=>fe,Ident:()=>he,LeftCurlyBracket:()=>Ee,LeftParenthesis:()=>Le,LeftSquareBracket:()=>Oe,Number:()=>ve,Percentage:()=>we,RightCurlyBracket:()=>Be,RightParenthesis:()=>ze,RightSquareBracket:()=>De,Semicolon:()=>Me,String:()=>pe,Url:()=>ge,WhiteSpace:()=>xe});var r={};n.r(r),n.d(r,{safe:()=>Pt,spec:()=>Rt});var o={};n.r(o),n.d(o,{angle:()=>qn,decibel:()=>$n,flex:()=>Un,frequency:()=>jn,length:()=>Hn,resolution:()=>Kn,semitones:()=>Yn,time:()=>Vn});var s={};n.r(s),n.d(s,{getTrace:()=>zi,isKeyword:()=>Ri,isProperty:()=>Bi,isType:()=>Ei});var a={};n.r(a),n.d(a,{generate:()=>fr,name:()=>hr,parse:()=>dr,structure:()=>ur});var l={};n.r(l),n.d(l,{generate:()=>wr,name:()=>gr,parse:()=>vr,structure:()=>yr,walkContext:()=>br});var c={};n.r(c),n.d(c,{generate:()=>Ar,name:()=>kr,parse:()=>Cr,structure:()=>Sr,walkContext:()=>xr});var h={};n.r(h),n.d(h,{generate:()=>zr,name:()=>Or,parse:()=>Lr,structure:()=>Dr});var u={};n.r(u),n.d(u,{generate:()=>Hr,name:()=>Ir,parse:()=>Wr,structure:()=>Fr,walkContext:()=>Nr});var d={};n.r(d),n.d(d,{generate:()=>Kr,name:()=>qr,parse:()=>jr,structure:()=>Vr});var f={};n.r(f),n.d(f,{generate:()=>Yr,name:()=>_r,parse:()=>$r,structure:()=>Ur});var p={};n.r(p),n.d(p,{generate:()=>Zr,name:()=>Gr,parse:()=>Jr,structure:()=>Xr});var m={};n.r(m),n.d(m,{generate:()=>no,name:()=>Qr,parse:()=>to,structure:()=>eo});var g={};n.r(g),n.d(g,{generate:()=>so,name:()=>io,parse:()=>oo,structure:()=>ro});var b={};n.r(b),n.d(b,{generate:()=>ho,name:()=>ao,parse:()=>co,structure:()=>lo});var y={};n.r(y),n.d(y,{generate:()=>yo,name:()=>fo,parse:()=>bo,structure:()=>po});var v={};n.r(v),n.d(v,{generate:()=>Mo,name:()=>xo,parse:()=>Ao,structure:()=>Co,walkContext:()=>So});var w={};n.r(w),n.d(w,{generate:()=>Bo,name:()=>Lo,parse:()=>Eo,structure:()=>zo});var k={};n.r(k),n.d(k,{generate:()=>No,name:()=>Ro,parse:()=>Io,structure:()=>Po});var x={};n.r(x),n.d(x,{generate:()=>qo,name:()=>Fo,parse:()=>Ho,structure:()=>Wo});var S={};n.r(S),n.d(S,{generate:()=>Uo,name:()=>Vo,parse:()=>_o,structure:()=>jo});var C={};n.r(C),n.d(C,{generate:()=>Zo,name:()=>$o,parse:()=>Jo,structure:()=>Yo});var A={};n.r(A),n.d(A,{generate:()=>is,name:()=>Qo,parse:()=>ns,structure:()=>ts,walkContext:()=>es});var M={};n.r(M),n.d(M,{generate:()=>as,name:()=>rs,parse:()=>ss,structure:()=>os});var T={};n.r(T),n.d(T,{generate:()=>ds,name:()=>cs,parse:()=>us,structure:()=>hs,xxx:()=>ls});var O={};n.r(O),n.d(O,{generate:()=>gs,name:()=>fs,parse:()=>ms,structure:()=>ps});var D={};n.r(D),n.d(D,{generate:()=>ws,name:()=>bs,parse:()=>vs,structure:()=>ys});var L={};n.r(L),n.d(L,{generate:()=>Cs,name:()=>ks,parse:()=>Ss,structure:()=>xs});var z={};n.r(z),n.d(z,{generate:()=>Os,name:()=>As,parse:()=>Ts,structure:()=>Ms});var E={};n.r(E),n.d(E,{generate:()=>Es,name:()=>Ds,parse:()=>zs,structure:()=>Ls});var B={};n.r(B),n.d(B,{generate:()=>Is,name:()=>Bs,parse:()=>Ps,structure:()=>Rs});var R={};n.r(R),n.d(R,{generate:()=>Hs,name:()=>Ns,parse:()=>Ws,structure:()=>Fs});var P={};n.r(P),n.d(P,{generate:()=>Ks,name:()=>qs,parse:()=>js,structure:()=>Vs});var I={};n.r(I),n.d(I,{generate:()=>Ys,name:()=>_s,parse:()=>$s,structure:()=>Us});var N={};n.r(N),n.d(N,{generate:()=>Zs,name:()=>Gs,parse:()=>Js,structure:()=>Xs});var F={};n.r(F),n.d(F,{generate:()=>na,name:()=>Qs,parse:()=>ta,structure:()=>ea});var W={};n.r(W),n.d(W,{generate:()=>sa,name:()=>ia,parse:()=>oa,structure:()=>ra});var H={};n.r(H),n.d(H,{generate:()=>ua,name:()=>aa,parse:()=>ha,structure:()=>ca,walkContext:()=>la});var q={};n.r(q),n.d(q,{generate:()=>ga,name:()=>da,parse:()=>ma,structure:()=>pa,walkContext:()=>fa});var V={};n.r(V),n.d(V,{generate:()=>ka,name:()=>ya,parse:()=>wa,structure:()=>va});var j={};n.r(j),n.d(j,{generate:()=>Ma,name:()=>Sa,parse:()=>Aa,structure:()=>Ca});var K={};n.r(K),n.d(K,{generate:()=>Ba,name:()=>Da,parse:()=>Ea,structure:()=>za,walkContext:()=>La});var _={};n.r(_),n.d(_,{generate:()=>Na,name:()=>Ra,parse:()=>Ia,structure:()=>Pa});var U={};n.r(U),n.d(U,{generate:()=>qa,name:()=>Fa,parse:()=>Ha,structure:()=>Wa});var $={};n.r($),n.d($,{generate:()=>Ua,name:()=>Va,parse:()=>_a,structure:()=>Ka,walkContext:()=>ja});var Y={};n.r(Y),n.d(Y,{decode:()=>$a,encode:()=>Ya});var G={};n.r(G),n.d(G,{generate:()=>Za,name:()=>Ga,parse:()=>Ja,structure:()=>Xa});var X={};n.r(X),n.d(X,{generate:()=>rl,name:()=>el,parse:()=>il,structure:()=>nl,walkContext:()=>tl});var J={};n.r(J),n.d(J,{generate:()=>ll,name:()=>ol,parse:()=>al,structure:()=>sl});var Z={};n.r(Z),n.d(Z,{generate:()=>fl,name:()=>hl,parse:()=>dl,structure:()=>ul});var Q={};n.r(Q),n.d(Q,{generate:()=>kl,name:()=>yl,parse:()=>wl,structure:()=>vl});var ee={};n.r(ee),n.d(ee,{decode:()=>xl,encode:()=>Sl});var te={};n.r(te),n.d(te,{generate:()=>Tl,name:()=>Cl,parse:()=>Ml,structure:()=>Al});var ne={};n.r(ne),n.d(ne,{generate:()=>zl,name:()=>Ol,parse:()=>Ll,structure:()=>Dl});var ie={};n.r(ie),n.d(ie,{generate:()=>Il,name:()=>Bl,parse:()=>Pl,structure:()=>Rl});var re={};n.r(re),n.d(re,{AnPlusB:()=>a,Atrule:()=>l,AtrulePrelude:()=>c,AttributeSelector:()=>h,Block:()=>u,Brackets:()=>d,CDC:()=>f,CDO:()=>p,ClassSelector:()=>m,Combinator:()=>g,Comment:()=>b,Condition:()=>y,Declaration:()=>v,DeclarationList:()=>w,Dimension:()=>k,Feature:()=>x,FeatureFunction:()=>S,FeatureRange:()=>C,Function:()=>A,GeneralEnclosed:()=>M,Hash:()=>T,IdSelector:()=>D,Identifier:()=>O,Layer:()=>L,LayerList:()=>z,MediaQuery:()=>E,MediaQueryList:()=>B,NestingSelector:()=>R,Nth:()=>P,Number:()=>I,Operator:()=>N,Parentheses:()=>F,Percentage:()=>W,PseudoClassSelector:()=>H,PseudoElementSelector:()=>q,Ratio:()=>V,Raw:()=>j,Rule:()=>K,Scope:()=>_,Selector:()=>U,SelectorList:()=>$,String:()=>G,StyleSheet:()=>X,SupportsDeclaration:()=>J,TypeSelector:()=>Z,UnicodeRange:()=>Q,Url:()=>te,Value:()=>ne,WhiteSpace:()=>ie});var oe={};n.r(oe),n.d(oe,{AtrulePrelude:()=>Wl,Selector:()=>Hl,Value:()=>Kl});var se={};n.r(se),n.d(se,{AnPlusB:()=>dr,Atrule:()=>vr,AtrulePrelude:()=>Cr,AttributeSelector:()=>Lr,Block:()=>Wr,Brackets:()=>jr,CDC:()=>$r,CDO:()=>Jr,ClassSelector:()=>to,Combinator:()=>oo,Comment:()=>co,Condition:()=>bo,Declaration:()=>Ao,DeclarationList:()=>Eo,Dimension:()=>Io,Feature:()=>Ho,FeatureFunction:()=>_o,FeatureRange:()=>Jo,Function:()=>ns,GeneralEnclosed:()=>ss,Hash:()=>us,IdSelector:()=>vs,Identifier:()=>ms,Layer:()=>Ss,LayerList:()=>Ts,MediaQuery:()=>zs,MediaQueryList:()=>Ps,NestingSelector:()=>Ws,Nth:()=>js,Number:()=>$s,Operator:()=>Js,Parentheses:()=>ta,Percentage:()=>oa,PseudoClassSelector:()=>ha,PseudoElementSelector:()=>ma,Ratio:()=>wa,Raw:()=>Aa,Rule:()=>Ea,Scope:()=>Ia,Selector:()=>Ha,SelectorList:()=>_a,String:()=>Ja,StyleSheet:()=>il,SupportsDeclaration:()=>al,TypeSelector:()=>dl,UnicodeRange:()=>wl,Url:()=>Ml,Value:()=>Ll,WhiteSpace:()=>Pl});var ae={};n.r(ae),n.d(ae,{SyntaxError:()=>Gn,generate:()=>Ut,parse:()=>ai,walk:()=>hi});var le={};n.r(le),n.d(le,{decode:()=>oc,encode:()=>sc});const ce=0,he=1,ue=2,de=3,fe=4,pe=5,me=6,ge=7,be=8,ye=9,ve=10,we=11,ke=12,xe=13,Se=14,Ce=15,Ae=16,Me=17,Te=18,Oe=19,De=20,Le=21,ze=22,Ee=23,Be=24,Re=25;function Pe(e){return e>=48&&e<=57}function Ie(e){return Pe(e)||e>=65&&e<=70||e>=97&&e<=102}function Ne(e){return e>=65&&e<=90}function Fe(e){return function(e){return Ne(e)||function(e){return e>=97&&e<=122}(e)}(e)||function(e){return e>=128}(e)||95===e}function We(e){return Fe(e)||Pe(e)||45===e}function He(e){return e>=0&&e<=8||11===e||e>=14&&e<=31||127===e}function qe(e){return 10===e||13===e||12===e}function Ve(e){return qe(e)||32===e||9===e}function je(e,t){return 92===e&&!qe(t)&&0!==t}function Ke(e,t,n){return 45===e?Fe(t)||45===t||je(t,n):!!Fe(e)||92===e&&je(e,t)}function _e(e,t,n){return 43===e||45===e?Pe(t)?2:46===t&&Pe(n)?3:0:46===e?Pe(t)?2:0:Pe(e)?1:0}function Ue(e){return 65279===e||65534===e?1:0}const $e=new Array(128);for(let e=0;e<$e.length;e++)$e[e]=(Ve(e)?130:Pe(e)&&131)||Fe(e)&&132||He(e)&&133||e||128;function Ye(e){return e<128?$e[e]:132}function Ge(e,t){return t<e.length?e.charCodeAt(t):0}function Xe(e,t,n){return 13===n&&10===Ge(e,t+1)?2:1}function Je(e,t,n){let i=e.charCodeAt(t);return Ne(i)&&(i|=32),i===n}function Ze(e,t,n,i){if(n-t!==i.length)return!1;if(t<0||n>e.length)return!1;for(let r=t;r<n;r++){const n=i.charCodeAt(r-t);let o=e.charCodeAt(r);if(Ne(o)&&(o|=32),o!==n)return!1}return!0}function Qe(e,t){for(;t<e.length&&Ve(e.charCodeAt(t));t++);return t}function et(e,t){for(;t<e.length&&Pe(e.charCodeAt(t));t++);return t}function tt(e,t){if(Ie(Ge(e,(t+=2)-1))){for(const n=Math.min(e.length,t+5);t<n&&Ie(Ge(e,t));t++);const n=Ge(e,t);Ve(n)&&(t+=Xe(e,t,n))}return t}function nt(e,t){for(;t<e.length;t++){const n=e.charCodeAt(t);if(!We(n)){if(!je(n,Ge(e,t+1)))break;t=tt(e,t)-1}}return t}function it(e,t){let n=e.charCodeAt(t);if(43!==n&&45!==n||(n=e.charCodeAt(t+=1)),Pe(n)&&(t=et(e,t+1),n=e.charCodeAt(t)),46===n&&Pe(e.charCodeAt(t+1))&&(t=et(e,t+=2)),Je(e,t,101)){let i=0;n=e.charCodeAt(t+1),45!==n&&43!==n||(i=1,n=e.charCodeAt(t+2)),Pe(n)&&(t=et(e,t+1+i+1))}return t}function rt(e,t){for(;t<e.length;t++){const n=e.charCodeAt(t);if(41===n){t++;break}je(n,Ge(e,t+1))&&(t=tt(e,t))}return t}function ot(e){if(1===e.length&&!Ie(e.charCodeAt(0)))return e[0];let t=parseInt(e,16);return(0===t||t>=55296&&t<=57343||t>1114111)&&(t=65533),String.fromCodePoint(t)}function st(e,t){function n(t){return t<s?e.charCodeAt(t):0}function i(){return c=it(e,c),Ke(n(c),n(c+1),n(c+2))?(a=ke,void(c=nt(e,c))):37===n(c)?(a=we,void c++):void(a=ve)}function r(){const t=c;return c=nt(e,c),Ze(e,t,c,"url")&&40===n(c)?(c=Qe(e,c+1),34===n(c)||39===n(c)?(a=ue,void(c=t+4)):void function(){for(a=ge,c=Qe(e,c);c<e.length;c++){const t=e.charCodeAt(c);switch(Ye(t)){case 41:return void c++;case 130:return c=Qe(e,c),41===n(c)||c>=e.length?void(c<e.length&&c++):(c=rt(e,c),void(a=be));case 34:case 39:case 40:case 133:return c=rt(e,c),void(a=be);case 92:if(je(t,n(c+1))){c=tt(e,c)-1;break}return c=rt(e,c),void(a=be)}}}()):40===n(c)?(a=ue,void c++):void(a=he)}function o(t){for(t||(t=n(c++)),a=pe;c<e.length;c++){const i=e.charCodeAt(c);switch(Ye(i)){case t:return void c++;case 130:if(qe(i))return c+=Xe(e,c,i),void(a=me);break;case 92:if(c===e.length-1)break;const r=n(c+1);qe(r)?c+=Xe(e,c+1,r):je(i,r)&&(c=tt(e,c)-1)}}}const s=(e=String(e||"")).length;let a,l=Ue(n(0)),c=l;for(;c<s;){const s=e.charCodeAt(c);switch(Ye(s)){case 130:a=xe,c=Qe(e,c+1);break;case 34:case 39:o();break;case 35:We(n(c+1))||je(n(c+1),n(c+2))?(a=fe,c=nt(e,c+1)):(a=ye,c++);break;case 40:a=Le,c++;break;case 41:a=ze,c++;break;case 43:case 46:_e(s,n(c+1),n(c+2))?i():(a=ye,c++);break;case 44:a=Te,c++;break;case 45:_e(s,n(c+1),n(c+2))?i():45===n(c+1)&&62===n(c+2)?(a=Ce,c+=3):Ke(s,n(c+1),n(c+2))?r():(a=ye,c++);break;case 47:42===n(c+1)?(a=Re,c=e.indexOf("*/",c+2),c=-1===c?e.length:c+2):(a=ye,c++);break;case 58:a=Ae,c++;break;case 59:a=Me,c++;break;case 60:33===n(c+1)&&45===n(c+2)&&45===n(c+3)?(a=Se,c+=4):(a=ye,c++);break;case 64:Ke(n(c+1),n(c+2),n(c+3))?(a=de,c=nt(e,c+1)):(a=ye,c++);break;case 91:a=Oe,c++;break;case 92:je(s,n(c+1))?r():(a=ye,c++);break;case 93:a=De,c++;break;case 123:a=Ee,c++;break;case 125:a=Be,c++;break;case 131:i();break;case 132:r();break;default:a=ye,c++}t(a,l,l=c)}}let at=null;class lt{static createItem(e){return{prev:null,next:null,data:e}}constructor(){this.head=null,this.tail=null,this.cursor=null}createItem(e){return lt.createItem(e)}allocateCursor(e,t){let n;return null!==at?(n=at,at=at.cursor,n.prev=e,n.next=t,n.cursor=this.cursor):n={prev:e,next:t,cursor:this.cursor},this.cursor=n,n}releaseCursor(){const{cursor:e}=this;this.cursor=e.cursor,e.prev=null,e.next=null,e.cursor=at,at=e}updateCursors(e,t,n,i){let{cursor:r}=this;for(;null!==r;)r.prev===e&&(r.prev=t),r.next===n&&(r.next=i),r=r.cursor}*[Symbol.iterator](){for(let e=this.head;null!==e;e=e.next)yield e.data}get size(){let e=0;for(let t=this.head;null!==t;t=t.next)e++;return e}get isEmpty(){return null===this.head}get first(){return this.head&&this.head.data}get last(){return this.tail&&this.tail.data}fromArray(e){let t=null;this.head=null;for(let n of e){const e=lt.createItem(n);null!==t?t.next=e:this.head=e,e.prev=t,t=e}return this.tail=t,this}toArray(){return[...this]}toJSON(){return[...this]}forEach(e,t=this){const n=this.allocateCursor(null,this.head);for(;null!==n.next;){const i=n.next;n.next=i.next,e.call(t,i.data,i,this)}this.releaseCursor()}forEachRight(e,t=this){const n=this.allocateCursor(this.tail,null);for(;null!==n.prev;){const i=n.prev;n.prev=i.prev,e.call(t,i.data,i,this)}this.releaseCursor()}reduce(e,t,n=this){let i,r=this.allocateCursor(null,this.head),o=t;for(;null!==r.next;)i=r.next,r.next=i.next,o=e.call(n,o,i.data,i,this);return this.releaseCursor(),o}reduceRight(e,t,n=this){let i,r=this.allocateCursor(this.tail,null),o=t;for(;null!==r.prev;)i=r.prev,r.prev=i.prev,o=e.call(n,o,i.data,i,this);return this.releaseCursor(),o}some(e,t=this){for(let n=this.head;null!==n;n=n.next)if(e.call(t,n.data,n,this))return!0;return!1}map(e,t=this){const n=new lt;for(let i=this.head;null!==i;i=i.next)n.appendData(e.call(t,i.data,i,this));return n}filter(e,t=this){const n=new lt;for(let i=this.head;null!==i;i=i.next)e.call(t,i.data,i,this)&&n.appendData(i.data);return n}nextUntil(e,t,n=this){if(null===e)return;const i=this.allocateCursor(null,e);for(;null!==i.next;){const e=i.next;if(i.next=e.next,t.call(n,e.data,e,this))break}this.releaseCursor()}prevUntil(e,t,n=this){if(null===e)return;const i=this.allocateCursor(e,null);for(;null!==i.prev;){const e=i.prev;if(i.prev=e.prev,t.call(n,e.data,e,this))break}this.releaseCursor()}clear(){this.head=null,this.tail=null}copy(){const e=new lt;for(let t of this)e.appendData(t);return e}prepend(e){return this.updateCursors(null,e,this.head,e),null!==this.head?(this.head.prev=e,e.next=this.head):this.tail=e,this.head=e,this}prependData(e){return this.prepend(lt.createItem(e))}append(e){return this.insert(e)}appendData(e){return this.insert(lt.createItem(e))}insert(e,t=null){if(null!==t)if(this.updateCursors(t.prev,e,t,e),null===t.prev){if(this.head!==t)throw new Error("before doesn't belong to list");this.head=e,t.prev=e,e.next=t,this.updateCursors(null,e)}else t.prev.next=e,e.prev=t.prev,t.prev=e,e.next=t;else this.updateCursors(this.tail,e,null,e),null!==this.tail?(this.tail.next=e,e.prev=this.tail):this.head=e,this.tail=e;return this}insertData(e,t){return this.insert(lt.createItem(e),t)}remove(e){if(this.updateCursors(e,e.prev,e,e.next),null!==e.prev)e.prev.next=e.next;else{if(this.head!==e)throw new Error("item doesn't belong to list");this.head=e.next}if(null!==e.next)e.next.prev=e.prev;else{if(this.tail!==e)throw new Error("item doesn't belong to list");this.tail=e.prev}return e.prev=null,e.next=null,e}push(e){this.insert(lt.createItem(e))}pop(){return null!==this.tail?this.remove(this.tail):null}unshift(e){this.prepend(lt.createItem(e))}shift(){return null!==this.head?this.remove(this.head):null}prependList(e){return this.insertList(e,this.head)}appendList(e){return this.insertList(e)}insertList(e,t){return null===e.head||(null!=t?(this.updateCursors(t.prev,e.tail,t,e.head),null!==t.prev?(t.prev.next=e.head,e.head.prev=t.prev):this.head=e.head,t.prev=e.tail,e.tail.next=t):(this.updateCursors(this.tail,e.tail,null,e.head),null!==this.tail?(this.tail.next=e.head,e.head.prev=this.tail):this.head=e.head,this.tail=e.tail),e.head=null,e.tail=null),this}replace(e,t){"head"in t?this.insertList(t,e):this.insert(t,e),this.remove(e)}}function ct(e,t){const n=Object.create(SyntaxError.prototype),i=new Error;return Object.assign(n,{name:e,message:t,get stack(){return(i.stack||"").replace(/^(.+\n){1,3}/,`${e}: ${t}\n`)}})}function ht({source:e,line:t,column:n,baseLine:i,baseColumn:r},o){function s(e,t){return a.slice(e,t).map((t,n)=>String(e+n+1).padStart(h)+" |"+t).join("\n")}const a=("\n".repeat(Math.max(i-1,0))+" ".repeat(Math.max(r-1,0))+e).split(/\r\n?|\n|\f/),l=Math.max(1,t-o)-1,c=Math.min(t+o,a.length+1),h=Math.max(4,String(c).length)+1;let u=0;(n+=3*(a[t-1].substr(0,n-1).match(/\t/g)||[]).length)>100&&(u=n-60+3,n=58);for(let e=l;e<=c;e++)e>=0&&e<a.length&&(a[e]=a[e].replace(/\t/g," "),a[e]=(u>0&&a[e].length>u?"…":"")+a[e].substr(u,98)+(a[e].length>u+100-1?"…":""));return[s(l,t),new Array(n+h+2).join("-")+"^",s(t,c)].filter(Boolean).join("\n").replace(/^(\s+\d+\s+\|\n)+/,"").replace(/\n(\s+\d+\s+\|)+$/,"")}function ut(e,t,n,i,r,o=1,s=1){return Object.assign(ct("SyntaxError",e),{source:t,offset:n,line:i,column:r,sourceFragment:e=>ht({source:t,line:i,column:r,baseLine:o,baseColumn:s},isNaN(e)?0:e),get formattedMessage(){return`Parse error: ${e}\n`+ht({source:t,line:i,column:r,baseLine:o,baseColumn:s},2)}})}function dt(e=null,t){return null===e||e.length<t?new Uint32Array(Math.max(t+1024,16384)):e}function ft(e){const t=e.source,n=t.length,i=t.length>0?Ue(t.charCodeAt(0)):0,r=dt(e.lines,n),o=dt(e.columns,n);let s=e.startLine,a=e.startColumn;for(let e=i;e<n;e++){const i=t.charCodeAt(e);r[e]=s,o[e]=a++,10!==i&&13!==i&&12!==i||(13===i&&e+1<n&&10===t.charCodeAt(e+1)&&(e++,r[e]=s,o[e]=a),s++,a=1)}r[n]=s,o[n]=a,e.lines=r,e.columns=o,e.computed=!0}class pt{constructor(e,t,n,i){this.setSource(e,t,n,i),this.lines=null,this.columns=null}setSource(e="",t=0,n=1,i=1){this.source=e,this.startOffset=t,this.startLine=n,this.startColumn=i,this.computed=!1}getLocation(e,t){return this.computed||ft(this),{source:t,offset:this.startOffset+e,line:this.lines[e],column:this.columns[e]}}getLocationRange(e,t,n){return this.computed||ft(this),{source:n,start:{offset:this.startOffset+e,line:this.lines[e],column:this.columns[e]},end:{offset:this.startOffset+t,line:this.lines[t],column:this.columns[t]}}}}const mt=["EOF-token","ident-token","function-token","at-keyword-token","hash-token","string-token","bad-string-token","url-token","bad-url-token","delim-token","number-token","percentage-token","dimension-token","whitespace-token","CDO-token","CDC-token","colon-token","semicolon-token","comma-token","[-token","]-token","(-token",")-token","{-token","}-token","comment-token"],gt=16777215,bt=24,yt=new Uint8Array(32);yt[ue]=ze,yt[Le]=ze,yt[Oe]=De,yt[Ee]=Be;const vt=new Uint8Array(32);function wt(e,t,n){return e<t?t:e>n?n:e}vt[ue]=1,vt[Le]=1,vt[Oe]=1,vt[Ee]=1,vt[ze]=2,vt[De]=2,vt[Be]=2;class kt{constructor(e,t){this.setSource(e,t)}reset(){this.eof=!1,this.tokenIndex=-1,this.tokenType=0,this.tokenStart=this.firstCharOffset,this.tokenEnd=this.firstCharOffset}setSource(e="",t=()=>{}){const n=(e=String(e||"")).length,i=dt(this.offsetAndType,e.length+1),r=dt(this.balance,e.length+1);let o=0,s=-1,a=0,l=e.length;this.offsetAndType=null,this.balance=null,r.fill(0),t(e,(e,t,n)=>{const c=o++;if(i[c]=e<<bt|n,-1===s&&(s=t),r[c]=l,e===a){const e=r[l];r[l]=c,l=e,a=yt[i[e]>>bt]}else this.isBlockOpenerTokenType(e)&&(l=c,a=yt[e])}),i[o]=ce<<bt|n,r[o]=o;for(let e=0;e<o;e++){const t=r[e];if(t<=e){const n=r[t];n!==e&&(r[e]=n)}else t>o&&(r[e]=o)}this.source=e,this.firstCharOffset=-1===s?0:s,this.tokenCount=o,this.offsetAndType=i,this.balance=r,this.reset(),this.next()}lookupType(e){return(e+=this.tokenIndex)<this.tokenCount?this.offsetAndType[e]>>bt:ce}lookupTypeNonSC(e){for(let t=this.tokenIndex;t<this.tokenCount;t++){const n=this.offsetAndType[t]>>bt;if(n!==xe&&n!==Re&&0===e--)return n}return ce}lookupOffset(e){return(e+=this.tokenIndex)<this.tokenCount?this.offsetAndType[e-1]>:this.source.length}lookupOffsetNonSC(e){for(let t=this.tokenIndex;t<this.tokenCount;t++){const n=this.offsetAndType[t]>>bt;if(n!==xe&&n!==Re&&0===e--)return t-this.tokenIndex}return ce}lookupValue(e,t){return(e+=this.tokenIndex)<this.tokenCount&&Ze(this.source,this.offsetAndType[e-1]>,this.offsetAndType[e]>,t)}getTokenStart(e){return e===this.tokenIndex?this.tokenStart:e>0?e<this.tokenCount?this.offsetAndType[e-1]>:this.offsetAndType[this.tokenCount]>:this.firstCharOffset}getTokenEnd(e){return e===this.tokenIndex?this.tokenEnd:this.offsetAndType[wt(e,0,this.tokenCount)]>}getTokenType(e){return e===this.tokenIndex?this.tokenType:this.offsetAndType[wt(e,0,this.tokenCount)]>>bt}substrToCursor(e){return this.source.substring(e,this.tokenStart)}isBlockOpenerTokenType(e){return 1===vt[e]}isBlockCloserTokenType(e){return 2===vt[e]}getBlockTokenPairIndex(e){const t=this.getTokenType(e);if(1===vt[t]){const n=this.balance[e],i=this.getTokenType(n);return yt[t]===i?n:-1}if(2===vt[t]){const n=this.balance[e],i=this.getTokenType(n);return yt[i]===t?n:-1}return-1}isBalanceEdge(e){return this.balance[this.tokenIndex]<e}isDelim(e,t){return t?this.lookupType(t)===ye&&this.source.charCodeAt(this.lookupOffset(t))===e:this.tokenType===ye&&this.source.charCodeAt(this.tokenStart)===e}skip(e){let t=this.tokenIndex+e;t<this.tokenCount?(this.tokenIndex=t,this.tokenStart=this.offsetAndType[t-1]>,t=this.offsetAndType[t],this.tokenType=t>>bt,this.tokenEnd=t>):(this.tokenIndex=this.tokenCount,this.next())}next(){let e=this.tokenIndex+1;e<this.tokenCount?(this.tokenIndex=e,this.tokenStart=this.tokenEnd,e=this.offsetAndType[e],this.tokenType=e>>bt,this.tokenEnd=e>):(this.eof=!0,this.tokenIndex=this.tokenCount,this.tokenType=ce,this.tokenStart=this.tokenEnd=this.source.length)}skipSC(){for(;this.tokenType===xe||this.tokenType===Re;)this.next()}skipUntilBalanced(e,t){let n=e,i=0,r=0;e:for(;n<this.tokenCount&&(i=this.balance[n],!(i<e));n++)switch(r=n>0?this.offsetAndType[n-1]>:this.firstCharOffset,t(this.source.charCodeAt(r))){case 1:break e;case 2:n++;break e;default:this.isBlockOpenerTokenType(this.offsetAndType[n]>>bt)&&(n=i)}this.skip(n-this.tokenIndex)}forEachToken(e){for(let t=0,n=this.firstCharOffset;t<this.tokenCount;t++){const i=n,r=this.offsetAndType[t],o=r>n=o,e(r>>bt,i,o,t)}}dump(){const e=new Array(this.tokenCount);return this.forEachToken((t,n,i,r)=>{e[r]={idx:r,type:mt[t],chunk:this.source.substring(n,i),balance:this.balance[r]}}),e}}function xt(e){const t=this.createList();let n=!1;const i={recognizer:e};for(;!this.eof;){switch(this.tokenType){case Re:this.next();continue;case xe:n=!0,this.next();continue}let r=e.getNode.call(this,i);if(void 0===r)break;n&&(e.onWhiteSpace&&e.onWhiteSpace.call(this,r,t,i),n=!1),t.push(r)}return n&&e.onWhiteSpace&&e.onWhiteSpace.call(this,null,t,i),t}const St=()=>{},Ct={createList:()=>[],createSingleNodeList:e=>[e],getFirstListNode:e=>e&&e[0]||null,getLastListNode:e=>e&&e.length>0?e[e.length-1]:null},At={createList:()=>new lt,createSingleNodeList:e=>(new lt).appendData(e),getFirstListNode:e=>e&&e.first,getLastListNode:e=>e&&e.last};function Mt(e){return function(){return this[e]()}}function Tt(e){const t=Object.create(null);for(const n of Object.keys(e)){const i=e[n],r=i.parse||i;r&&(t[n]=r)}return t}var Ot=n(241);const Dt=new Set(["Atrule","Selector","Declaration"]),Lt=(e,t)=>(e===ye&&(e=t),"string"==typeof e&&(e=Math.min(e.charCodeAt(0),128)<<6),e<<1),zt=[[he,he],[he,ue],[he,ge],[he,be],[he,"-"],[he,ve],[he,we],[he,ke],[he,Ce],[he,Le],[de,he],[de,ue],[de,ge],[de,be],[de,"-"],[de,ve],[de,we],[de,ke],[de,Ce],[fe,he],[fe,ue],[fe,ge],[fe,be],[fe,"-"],[fe,ve],[fe,we],[fe,ke],[fe,Ce],[ke,he],[ke,ue],[ke,ge],[ke,be],[ke,"-"],[ke,ve],[ke,we],[ke,ke],[ke,Ce],["#",he],["#",ue],["#",ge],["#",be],["#","-"],["#",ve],["#",we],["#",ke],["#",Ce],["-",he],["-",ue],["-",ge],["-",be],["-","-"],["-",ve],["-",we],["-",ke],["-",Ce],[ve,he],[ve,ue],[ve,ge],[ve,be],[ve,ve],[ve,we],[ve,ke],[ve,"%"],[ve,Ce],["@",he],["@",ue],["@",ge],["@",be],["@","-"],["@",Ce],[".",ve],[".",we],[".",ke],["+",ve],["+",we],["+",ke],["/","*"]],Et=zt.concat([[he,fe],[ke,fe],[fe,fe],[de,Le],[de,pe],[de,Ae],[we,we],[we,ke],[we,ue],[we,"-"],[ze,he],[ze,ue],[ze,we],[ze,ke],[ze,fe],[ze,"-"]]);function Bt(e){const t=new Set(e.map(([e,t])=>Lt(e)<<16|Lt(t)));return function(e,n,i){const r=Lt(n,i),o=i.charCodeAt(0);return r|(45===o&&n!==he&&n!==ue&&n!==Ce||43===o?t.has((65534&e)<<16|o<<7):t.has((65534&e)<<16|r))}}const Rt=Bt(zt),Pt=Bt(Et);function It(e,t){if("function"==typeof t){let n=null;return void e.children.forEach(e=>{null!==n&&t.call(this,n),this.node(e),n=e})}e.children.forEach(this.node,this)}const{hasOwnProperty:Nt}=Object.prototype,Ft=function(){};function Wt(e){return"function"==typeof e?e:Ft}function Ht(e,t){return function(n,i,r){n.type===t&&e.call(this,n,i,r)}}function qt(e,t){const n=t.structure,i=[];for(const e in n){if(!1===Nt.call(n,e))continue;let t=n[e];const r={name:e,type:!1,nullable:!1};Array.isArray(t)||(t=[t]);for(const e of t)null===e?r.nullable=!0:"string"==typeof e?r.type="node":Array.isArray(e)&&(r.type="list");r.type&&i.push(r)}return i.length?{context:t.walkContext,fields:i}:null}function Vt(e,t){const n=e.fields.slice(),i=e.context,r="string"==typeof i;return t&&n.reverse(),function(e,o,s,a){let l;r&&(l=o[i],o[i]=e);for(const i of n){const n=e[i.name];if(!i.nullable||n)if("list"===i.type){if(t?n.reduceRight(a,!1):n.reduce(a,!1))return!0}else if(s(n))return!0}r&&(o[i]=l)}}function jt({StyleSheet:e,Atrule:t,Rule:n,Block:i,DeclarationList:r}){return{Atrule:{StyleSheet:e,Atrule:t,Rule:n,Block:i},Rule:{StyleSheet:e,Atrule:t,Rule:n,Block:i},Declaration:{StyleSheet:e,Atrule:t,Rule:n,Block:i,DeclarationList:r}}}function Kt(e){return e}function _t(e,t,n,i){let r;switch(e.type){case"Group":r=function(e,t,n,i){const r=" "===e.combinator||i?e.combinator:" "+e.combinator+" ",o=e.terms.map(e=>_t(e,t,n,i)).join(r);return e.explicit||n?(i||","===o[0]?"[":"[ ")+o+(i?"]":" ]"):o}(e,t,n,i)+(e.disallowEmpty?"!":"");break;case"Multiplier":return _t(e.term,t,n,i)+t(function(e){const{min:t,max:n,comma:i}=e;return 0===t&&0===n?i?"#?":"*":0===t&&1===n?"?":1===t&&0===n?i?"#":"+":1===t&&1===n?"":(i?"#":"")+(t===n?"{"+t+"}":"{"+t+","+(0!==n?n:"")+"}")}(e),e);case"Boolean":r="<boolean-expr["+_t(e.term,t,n,i)+"]>";break;case"Type":r="<"+e.name+(e.opts?t(function(e){if("Range"===e.type)return" ["+(null===e.min?"-∞":e.min)+","+(null===e.max?"∞":e.max)+"]";throw new Error("Unknown node type `"+e.type+"`")}(e.opts),e.opts):"")+">";break;case"Property":r="<'"+e.name+"'>";break;case"Keyword":r=e.name;break;case"AtKeyword":r="@"+e.name;break;case"Function":r=e.name+"(";break;case"String":case"Token":r=e.value;break;case"Comma":r=",";break;default:throw new Error("Unknown node type `"+e.type+"`")}return t(r,e)}function Ut(e,t){let n=Kt,i=!1,r=!1;return"function"==typeof t?n=t:t&&(i=Boolean(t.forceBraces),r=Boolean(t.compact),"function"==typeof t.decorate&&(n=t.decorate)),_t(e,n,i,r)}const $t={offset:0,line:1,column:1};function Yt(e,t){const n=e&&e.loc&&e.loc[t];return n?"line"in n?Gt(n):n:null}function Gt({offset:e,line:t,column:n},i){const r={offset:e,line:t,column:n};if(i){const e=i.split(/\n|\r\n?|\f/);r.offset+=i.length,r.line+=e.length-1,r.column=1===e.length?r.column+i.length:e.pop().length+1}return r}const Xt=function(e,t){const n=ct("SyntaxReferenceError",e+(t?" `"+t+"`":""));return n.reference=t,n},Jt=function(e,t,n,i){const r=ct("SyntaxMatchError",e),{css:o,mismatchOffset:s,mismatchLength:a,start:l,end:c}=function(e,t){const n=e.tokens,i=e.longestMatch,r=i<n.length&&n[i].node||null,o=r!==t?r:null;let s,a,l=0,c=0,h=0,u="";for(let e=0;e<n.length;e++){const t=n[e].value;e===i&&(c=t.length,l=u.length),null!==o&&n[e].node===o&&(e<=i?h++:h=0),u+=t}return i===n.length||h>1?(s=Yt(o||t,"end")||Gt($t,u),a=Gt(s)):(s=Yt(o,"start")||Gt(Yt(t,"start")||$t,u.slice(0,l)),a=Yt(o,"end")||Gt(s,u.substr(l,c))),{css:u,mismatchOffset:l,mismatchLength:c,start:s,end:a}}(i,n);return r.rawMessage=e,r.syntax=t?Ut(t):"<generic>",r.css=o,r.mismatchOffset=s,r.mismatchLength=a,r.message=e+"\n syntax: "+r.syntax+"\n value: "+(o||"<empty string>")+"\n --------"+new Array(r.mismatchOffset+1).join("-")+"^",Object.assign(r,l),r.loc={source:n&&n.loc&&n.loc.source||"<unknown>",start:l,end:c},r},Zt=new Map,Qt=new Map,en=function(e){if(Zt.has(e))return Zt.get(e);const t=e.toLowerCase();let n=Zt.get(t);if(void 0===n){const e=rn(t,0),i=e?"":on(t,0);n=Object.freeze({basename:t.substr(i.length),name:t,prefix:i,vendor:i,custom:e})}return Zt.set(e,n),n},tn=function(e){if(Qt.has(e))return Qt.get(e);let t=e,n=e[0];"/"===n?n="/"===e[1]?"//":"/":"_"!==n&&"*"!==n&&"$"!==n&&"#"!==n&&"+"!==n&&"&"!==n&&(n="");const i=rn(t,n.length);if(!i&&(t=t.toLowerCase(),Qt.has(t))){const n=Qt.get(t);return Qt.set(e,n),n}const r=i?"":on(t,n.length),o=t.substr(0,n.length+r.length),s=Object.freeze({basename:t.substr(o.length),name:t.substr(n.length),hack:n,vendor:r,prefix:o,custom:i});return Qt.set(e,s),s},nn=on;function rn(e,t){return t=t||0,e.length-t>=2&&45===e.charCodeAt(t)&&45===e.charCodeAt(t+1)}function on(e,t){if(t=t||0,e.length-t>=3&&45===e.charCodeAt(t)&&45!==e.charCodeAt(t+1)){const n=e.indexOf("-",t+2);if(-1!==n)return e.substring(t,n+1)}return""}const sn=["initial","inherit","unset","revert","revert-layer"],an=45,ln=!0;function cn(e,t){return null!==e&&e.type===ye&&e.value.charCodeAt(0)===t}function hn(e,t,n){for(;null!==e&&(e.type===xe||e.type===Re);)e=n(++t);return t}function un(e,t,n,i){if(!e)return 0;const r=e.value.charCodeAt(t);if(43===r||r===an){if(n)return 0;t++}for(;t<e.value.length;t++)if(!Pe(e.value.charCodeAt(t)))return 0;return i+1}function dn(e,t,n){let i=!1,r=hn(e,t,n);if(null===(e=n(r)))return t;if(e.type!==ve){if(!cn(e,43)&&!cn(e,an))return t;if(i=!0,r=hn(n(++r),r,n),null===(e=n(r))||e.type!==ve)return 0}if(!i){const t=e.value.charCodeAt(0);if(43!==t&&t!==an)return 0}return un(e,i?0:1,i,r)}function fn(e,t){return null!==e&&e.type===ye&&e.value.charCodeAt(0)===t}function pn(e,t,n){let i=0;for(let r=t;r<e.value.length;r++){const o=e.value.charCodeAt(r);if(45===o&&n&&0!==i)return pn(e,t+i+1,!1),6;if(!Ie(o))return 0;if(++i>6)return 0}return i}function mn(e,t,n){if(!e)return 0;for(;fn(n(t),63);){if(++e>6)return 0;t++}return t}const gn=["calc(","-moz-calc(","-webkit-calc("],bn=["min(","max(","clamp("],yn=["round(","mod(","rem("],vn=["hypot("],wn=["abs("],kn=[...gn,...bn,...yn,"sin(","cos(","tan(","pow(","sqrt(","log(","exp(","sign(",...vn,...wn],xn=[...gn,...bn,...yn,...vn,...wn],Sn=[...gn,...bn,...yn,"asin(","acos(","atan(","atan2(",...vn,...wn],Cn=new Map([[ue,ze],[Le,ze],[Oe,De],[Ee,Be]]);function An(e,t){return t<e.length?e.charCodeAt(t):0}function Mn(e,t){return Ze(e,0,e.length,t)}function Tn(e,t){for(let n=0;n<t.length;n++)if(Mn(e,t[n]))return!0;return!1}function On(e,t){return t===e.length-2&&92===An(e,t)&&Pe(An(e,t+1))}function Dn(e,t,n){if(e&&"Range"===e.type){const i=Number(void 0!==n&&n!==t.length?t.substr(0,n):t);if(isNaN(i))return!0;if(null!==e.min&&i<e.min&&"string"!=typeof e.min)return!0;if(null!==e.max&&i>e.max&&"string"!=typeof e.max)return!0}return!1}function Ln(e,t){return function(n,i,r){return null===n?0:n.type===ue&&Tn(n.value,t)?function(e,t){let n=0,i=[],r=0;e:do{switch(e.type){case Be:case ze:case De:if(e.type!==n)break e;if(n=i.pop(),0===i.length){r++;break e}break;case ue:case Le:case Oe:case Ee:i.push(n),n=Cn.get(e.type)}r++}while(e=t(r));return r}(n,i):e(n,i,r)}}function zn(e){return function(t){return null===t||t.type!==e?0:1}}function En(e){return null===e||e.type!==he||45!==An(e.value,0)||45!==An(e.value,1)?0:1}function Bn(e){return e&&(e=new Set(e)),function(t,n,i){if(null===t||t.type!==ke)return 0;const r=it(t.value,0);if(null!==e){const n=t.value.indexOf("\\",r),i=-1!==n&&On(t.value,n)?t.value.substring(r,n):t.value.substr(r);if(!1===e.has(i.toLowerCase()))return 0}return Dn(i,t.value,r)?0:1}}function Rn(e){return"function"!=typeof e&&(e=function(){return 0}),function(t,n,i){return null!==t&&t.type===ve&&0===Number(t.value)?1:e(t,n,i)}}const Pn={"ident-token":zn(he),"function-token":zn(ue),"at-keyword-token":zn(de),"hash-token":zn(fe),"string-token":zn(pe),"bad-string-token":zn(me),"url-token":zn(ge),"bad-url-token":zn(be),"delim-token":zn(ye),"number-token":zn(ve),"percentage-token":zn(we),"dimension-token":zn(ke),"whitespace-token":zn(xe),"CDO-token":zn(Se),"CDC-token":zn(Ce),"colon-token":zn(Ae),"semicolon-token":zn(Me),"comma-token":zn(Te),"[-token":zn(Oe),"]-token":zn(De),"(-token":zn(Le),")-token":zn(ze),"{-token":zn(Ee),"}-token":zn(Be)},In={string:zn(pe),ident:zn(he),percentage:Ln(function(e,t,n){return null===e||e.type!==we||Dn(n,e.value,e.value.length-1)?0:1},xn),zero:Rn(),number:Ln(function(e,t,n){if(null===e)return 0;const i=it(e.value,0);return i===e.value.length||On(e.value,i)?Dn(n,e.value,i)?0:1:0},kn),integer:Ln(function(e,t,n){if(null===e||e.type!==ve)return 0;let i=43===An(e.value,0)||45===An(e.value,0)?1:0;for(;i<e.value.length;i++)if(!Pe(An(e.value,i)))return 0;return Dn(n,e.value,i)?0:1},kn),"custom-ident":function(e){if(null===e||e.type!==he)return 0;const t=e.value.toLowerCase();return Tn(t,sn)||Mn(t,"default")?0:1},"dashed-ident":En,"custom-property-name":function(e){return En(e)?"--"===e.value?0:1:0},"hex-color":function(e){if(null===e||e.type!==fe)return 0;const t=e.value.length;if(4!==t&&5!==t&&7!==t&&9!==t)return 0;for(let n=1;n<t;n++)if(!Ie(An(e.value,n)))return 0;return 1},"id-selector":function(e){return null===e||e.type!==fe?0:Ke(An(e.value,1),An(e.value,2),An(e.value,3))?1:0},"an-plus-b":function(e,t){let n=0;if(!e)return 0;if(e.type===ve)return un(e,0,!1,n);if(e.type===he&&e.value.charCodeAt(0)===an){if(!Je(e.value,1,110))return 0;switch(e.value.length){case 2:return dn(t(++n),n,t);case 3:return e.value.charCodeAt(2)!==an?0:(n=hn(t(++n),n,t),un(e=t(n),0,ln,n));default:return e.value.charCodeAt(2)!==an?0:un(e,3,ln,n)}}else if(e.type===he||cn(e,43)&&t(n+1).type===he){if(e.type!==he&&(e=t(++n)),null===e||!Je(e.value,0,110))return 0;switch(e.value.length){case 1:return dn(t(++n),n,t);case 2:return e.value.charCodeAt(1)!==an?0:(n=hn(t(++n),n,t),un(e=t(n),0,ln,n));default:return e.value.charCodeAt(1)!==an?0:un(e,2,ln,n)}}else if(e.type===ke){let i=e.value.charCodeAt(0),r=43===i||i===an?1:0,o=r;for(;o<e.value.length&&Pe(e.value.charCodeAt(o));o++);return o===r?0:Je(e.value,o,110)?o+1===e.value.length?dn(t(++n),n,t):e.value.charCodeAt(o+1)!==an?0:o+2===e.value.length?(n=hn(t(++n),n,t),un(e=t(n),0,ln,n)):un(e,o+2,ln,n):0}return 0},urange:function(e,t){let n=0;if(null===e||e.type!==he||!Je(e.value,0,117))return 0;if(null===(e=t(++n)))return 0;if(fn(e,43))return null===(e=t(++n))?0:e.type===he?mn(pn(e,0,!0),++n,t):fn(e,63)?mn(1,++n,t):0;if(e.type===ve){const i=pn(e,1,!0);return 0===i?0:null===(e=t(++n))?n:e.type===ke||e.type===ve?function(e){return 45===e.value.charCodeAt(0)}(e)&&pn(e,1,!1)?n+1:0:mn(i,n,t)}return e.type===ke?mn(pn(e,1,!0),++n,t):0},"declaration-value":function(e,t){if(!e)return 0;let n=0,i=[],r=0;e:do{switch(e.type){case me:case be:break e;case Be:case ze:case De:if(e.type!==n)break e;n=i.pop();break;case Me:if(0===n)break e;break;case ye:if(0===n&&"!"===e.value)break e;break;case ue:case Le:case Oe:case Ee:i.push(n),n=Cn.get(e.type)}r++}while(e=t(r));return r},"any-value":function(e,t){if(!e)return 0;let n=0,i=[],r=0;e:do{switch(e.type){case me:case be:break e;case Be:case ze:case De:if(e.type!==n)break e;n=i.pop();break;case ue:case Le:case Oe:case Ee:i.push(n),n=Cn.get(e.type)}r++}while(e=t(r));return r}},Nn=["length","angle","time","frequency","resolution","flex","decibel","semitones"];function Fn(e){const{angle:t,decibel:n,frequency:i,flex:r,length:o,resolution:s,semitones:a,time:l}=e||{};return{dimension:Ln(Bn(null),Sn),angle:Ln(Bn(t),Sn),decibel:Ln(Bn(n),Sn),frequency:Ln(Bn(i),Sn),flex:Ln(Bn(r),Sn),length:Ln(Rn(Bn(o)),Sn),resolution:Ln(Bn(s),Sn),semitones:Ln(Bn(a),Sn),time:Ln(Bn(l),Sn)}}function Wn(e){const t=new Set;for(const n of Nn)if(Array.isArray(e[n]))for(const i of e[n])t.add(i.toLowerCase());return function(e){return null===e?0:e.type===ye&&"%"===e.value||e.type===he&&t.has(e.value.toLowerCase())?1:0}}const Hn=["cm","mm","q","in","pt","pc","px","em","rem","ex","rex","cap","rcap","ch","rch","ic","ric","lh","rlh","vw","svw","lvw","dvw","vh","svh","lvh","dvh","vi","svi","lvi","dvi","vb","svb","lvb","dvb","vmin","svmin","lvmin","dvmin","vmax","svmax","lvmax","dvmax","cqw","cqh","cqi","cqb","cqmin","cqmax"],qn=["deg","grad","rad","turn"],Vn=["s","ms"],jn=["hz","khz"],Kn=["dpi","dpcm","dppx","x"],Un=["fr"],$n=["db"],Yn=["st"];function Gn(e,t,n){return Object.assign(ct("SyntaxError",e),{input:t,offset:n,rawMessage:e,message:e+"\n "+t+"\n--"+new Array((n||t.length)+1).join("-")+"^"})}const Xn=new Uint8Array(128).map((e,t)=>/[a-zA-Z0-9\-]/.test(String.fromCharCode(t))?1:0);class Jn{constructor(e){this.str=e,this.pos=0}charCodeAt(e){return e<this.str.length?this.str.charCodeAt(e):0}charCode(){return this.charCodeAt(this.pos)}isNameCharCode(e=this.charCode()){return e<128&&1===Xn[e]}nextCharCode(){return this.charCodeAt(this.pos+1)}nextNonWsCode(e){return this.charCodeAt(this.findWsEnd(e))}skipWs(){this.pos=this.findWsEnd(this.pos)}findWsEnd(e){for(;e<this.str.length;e++){const t=this.str.charCodeAt(e);if(13!==t&&10!==t&&12!==t&&32!==t&&9!==t)break}return e}substringToPos(e){return this.str.substring(this.pos,this.pos=e)}eat(e){this.charCode()!==e&&this.error("Expect `"+String.fromCharCode(e)+"`"),this.pos++}peek(){return this.pos<this.str.length?this.str.charAt(this.pos++):""}error(e){throw new Gn(e,this.str,this.pos)}scanSpaces(){return this.substringToPos(this.findWsEnd(this.pos))}scanWord(){let e=this.pos;for(;e<this.str.length;e++){const t=this.str.charCodeAt(e);if(t>=128||0===Xn[t])break}return this.pos===e&&this.error("Expect a keyword"),this.substringToPos(e)}scanNumber(){let e=this.pos;for(;e<this.str.length;e++){const t=this.str.charCodeAt(e);if(t<48||t>57)break}return this.pos===e&&this.error("Expect a number"),this.substringToPos(e)}scanString(){const e=this.str.indexOf("'",this.pos+1);return-1===e&&(this.pos=this.str.length,this.error("Expect an apostrophe")),this.substringToPos(e+1)}}const Zn=93,Qn=123,ei={" ":1,"&&":2,"||":3,"|":4};function ti(e){let t=null,n=null;return e.eat(Qn),e.skipWs(),t=e.scanNumber(e),e.skipWs(),44===e.charCode()?(e.pos++,e.skipWs(),125!==e.charCode()&&(n=e.scanNumber(e),e.skipWs())):n=t,e.eat(125),{min:Number(t),max:n?Number(n):0}}function ni(e,t){const n=function(e){let t=null,n=!1;switch(e.charCode()){case 42:e.pos++,t={min:0,max:0};break;case 43:e.pos++,t={min:1,max:0};break;case 63:e.pos++,t={min:0,max:1};break;case 35:e.pos++,n=!0,e.charCode()===Qn?t=ti(e):63===e.charCode()?(e.pos++,t={min:0,max:0}):t={min:1,max:0};break;case Qn:t=ti(e);break;default:return null}return{type:"Multiplier",comma:n,min:t.min,max:t.max,term:null}}(e);return null!==n?(n.term=t,35===e.charCode()&&43===e.charCodeAt(e.pos-1)||63===e.charCode()&&125===e.charCodeAt(e.pos-1)?ni(e,n):n):t}function ii(e){const t=e.peek();return""===t?null:ni(e,{type:"Token",value:t})}function ri(e,t){function n(e,t){return{type:"Group",terms:e,combinator:t,disallowEmpty:!1,explicit:!1}}let i;for(t=Object.keys(t).sort((e,t)=>ei[e]-ei[t]);t.length>0;){i=t.shift();let r=0,o=0;for(;r<e.length;r++){const t=e[r];"Combinator"===t.type&&(t.value===i?(-1===o&&(o=r-1),e.splice(r,1),r--):(-1!==o&&r-o>1&&(e.splice(o,r-o,n(e.slice(o,r),i)),r=o+1),o=-1))}-1!==o&&t.length&&e.splice(o,r-o,n(e.slice(o,r),i))}return i}function oi(e,t=-1){const n=Object.create(null),i=[];let r=null,o=e.pos,s=!1;for(;e.charCode()!==t;){let t=s?oi(e,41):si(e);if(!t)break;if("Spaces"!==t.type){if(s){if(0===t.terms.length){s=!1;continue}if(" "===t.combinator){for(;t.terms.length>1;)n[" "]=!0,i.push({type:"Combinator",value:" "},t.terms.shift());t=t.terms[0]}}"Combinator"===t.type?(null!==r&&"Combinator"!==r.type||(e.pos=o,e.error("Unexpected combinator")),n[t.value]=!0):null!==r&&"Combinator"!==r.type&&(n[" "]=!0,i.push({type:"Combinator",value:" "})),i.push(t),r=t,o=e.pos,s="Function"===t.type}}return null!==r&&"Combinator"===r.type&&(e.pos-=o,e.error("Unexpected combinator")),{type:"Group",terms:i,combinator:ri(i,n)||" ",disallowEmpty:!1,explicit:!1}}function si(e){let t=e.charCode();switch(t){case Zn:break;case 91:return ni(e,function(e){let t;return e.eat(91),t=oi(e,Zn),e.eat(Zn),t.explicit=!0,33===e.charCode()&&(e.pos++,t.disallowEmpty=!0),t}(e));case 60:return 39===e.nextCharCode()?function(e){let t;return e.eat(60),e.eat(39),t=e.scanWord(),e.eat(39),e.eat(62),ni(e,{type:"Property",name:t})}(e):function(e){let t,n=null;if(e.eat(60),t=e.scanWord(),"boolean-expr"===t){e.eat(91);const t=oi(e,Zn);return e.eat(Zn),e.eat(62),ni(e,{type:"Boolean",term:1===t.terms.length?t.terms[0]:t})}return 40===e.charCode()&&41===e.nextCharCode()&&(e.pos+=2,t+="()"),91===e.charCodeAt(e.findWsEnd(e.pos))&&(e.skipWs(),n=function(e){let t=null,n=null,i=1;return e.eat(91),45===e.charCode()&&(e.peek(),i=-1),-1==i&&8734===e.charCode()?e.peek():(t=i*Number(e.scanNumber(e)),e.isNameCharCode()&&(t+=e.scanWord())),e.skipWs(),e.eat(44),e.skipWs(),8734===e.charCode()?e.peek():(i=1,45===e.charCode()&&(e.peek(),i=-1),n=i*Number(e.scanNumber(e)),e.isNameCharCode()&&(n+=e.scanWord())),e.eat(Zn),{type:"Range",min:t,max:n}}(e)),e.eat(62),ni(e,{type:"Type",name:t,opts:n})}(e);case 124:return{type:"Combinator",value:e.substringToPos(e.pos+(124===e.nextCharCode()?2:1))};case 38:return e.pos++,e.eat(38),{type:"Combinator",value:"&&"};case 44:return e.pos++,{type:"Comma"};case 39:return ni(e,{type:"String",value:e.scanString()});case 32:case 9:case 10:case 13:case 12:return{type:"Spaces",value:e.scanSpaces()};case 64:return t=e.nextCharCode(),e.isNameCharCode(t)?(e.pos++,{type:"AtKeyword",name:e.scanWord()}):ii(e);case 42:case 43:case 63:case 35:case 33:break;case Qn:if(t=e.nextCharCode(),t<48||t>57)return ii(e);break;default:return e.isNameCharCode(t)?function(e){const t=e.scanWord();return 40===e.charCode()?(e.pos++,{type:"Function",name:t}):ni(e,{type:"Keyword",name:t})}(e):ii(e)}}function ai(e){const t=new Jn(e),n=oi(t);return t.pos!==e.length&&t.error("Unexpected input"),1===n.terms.length&&"Group"===n.terms[0].type?n.terms[0]:n}const li=function(){};function ci(e){return"function"==typeof e?e:li}function hi(e,t,n){let i=li,r=li;if("function"==typeof t?i=t:t&&(i=ci(t.enter),r=ci(t.leave)),i===li&&r===li)throw new Error("Neither `enter` nor `leave` walker handler is set or both aren't a function");!function e(t){switch(i.call(n,t),t.type){case"Group":t.terms.forEach(e);break;case"Multiplier":case"Boolean":e(t.term);break;case"Type":case"Property":case"Keyword":case"AtKeyword":case"Function":case"String":case"Token":case"Comma":break;default:throw new Error("Unknown type: "+t.type)}r.call(n,t)}(e)}n.dn(di);const ui={decorator(e){const t=[];let n=null;return{...e,node(t){const i=n;n=t,e.node.call(this,t),n=i},emit(e,i,r){t.push({type:i,value:e,node:r?null:n})},result:()=>t}}};function di(e,t){return"string"==typeof e?function(e){const t=[];return st(e,(n,i,r)=>t.push({type:n,value:e.slice(i,r),node:null})),t}(e):t.generate(e,ui)}const fi={type:"Match"},pi={type:"Mismatch"},mi={type:"DisallowEmpty"};function gi(e,t,n){return t===fi&&n===pi||e===fi&&t===fi&&n===fi?e:("If"===e.type&&e.else===pi&&t===fi&&(t=e.then,e=e.match),{type:"If",match:e,then:t,else:n})}function bi(e){return e.length>2&&40===e.charCodeAt(e.length-2)&&41===e.charCodeAt(e.length-1)}function yi(e){return"Keyword"===e.type||"AtKeyword"===e.type||"Function"===e.type||"Type"===e.type&&bi(e.name)}function vi(e,t=" ",n=!1){return{type:"Group",terms:e,combinator:t,disallowEmpty:!1,explicit:n}}function wi(e,t,n=new Set){if(!n.has(e))switch(n.add(e),e.type){case"If":e.match=wi(e.match,t,n),e.then=wi(e.then,t,n),e.else=wi(e.else,t,n);break;case"Type":return t[e.name]||e}return e}function ki(e,t,n){switch(e){case" ":{let e=fi;for(let n=t.length-1;n>=0;n--)e=gi(t[n],e,pi);return e}case"|":{let e=pi,n=null;for(let i=t.length-1;i>=0;i--){let r=t[i];if(yi(r)&&(null===n&&i>0&&yi(t[i-1])&&(n=Object.create(null),e=gi({type:"Enum",map:n},fi,e)),null!==n)){const e=(bi(r.name)?r.name.slice(0,-1):r.name).toLowerCase();if(e in n==0){n[e]=r;continue}}n=null,e=gi(r,fi,e)}return e}case"&&":{if(t.length>5)return{type:"MatchOnce",terms:t,all:!0};let n=pi;for(let i=t.length-1;i>=0;i--){const r=t[i];let o;o=t.length>1?ki(e,t.filter(function(e){return e!==r}),!1):fi,n=gi(r,o,n)}return n}case"||":{if(t.length>5)return{type:"MatchOnce",terms:t,all:!1};let i=n?fi:pi;for(let n=t.length-1;n>=0;n--){const r=t[n];let o;o=t.length>1?ki(e,t.filter(function(e){return e!==r}),!0):fi,i=gi(r,o,i)}return i}}}function xi(e){if("function"==typeof e)return{type:"Generic",fn:e};switch(e.type){case"Group":{let t=ki(e.combinator,e.terms.map(xi),!1);return e.disallowEmpty&&(t=gi(t,mi,pi)),t}case"Multiplier":return function(e){let t=fi,n=xi(e.term);if(0===e.max)n=gi(n,mi,pi),t=gi(n,null,pi),t.then=gi(fi,fi,t),e.comma&&(t.then.else=gi({type:"Comma",syntax:e},t,pi));else for(let i=e.min||1;i<=e.max;i++)e.comma&&t!==fi&&(t=gi({type:"Comma",syntax:e},t,pi)),t=gi(n,gi(fi,fi,t),pi);if(0===e.min)t=gi(fi,fi,t);else for(let i=0;i<e.min-1;i++)e.comma&&t!==fi&&(t=gi({type:"Comma",syntax:e},t,pi)),t=gi(n,t,pi);return t}(e);case"Boolean":{const t=xi(e.term),n=xi(vi([vi([{type:"Keyword",name:"not"},{type:"Type",name:"!boolean-group"}]),vi([{type:"Type",name:"!boolean-group"},vi([{type:"Multiplier",comma:!1,min:0,max:0,term:vi([{type:"Keyword",name:"and"},{type:"Type",name:"!boolean-group"}])},{type:"Multiplier",comma:!1,min:0,max:0,term:vi([{type:"Keyword",name:"or"},{type:"Type",name:"!boolean-group"}])}],"|")])],"|")),i=xi(vi([{type:"Type",name:"!term"},vi([{type:"Token",value:"("},{type:"Type",name:"!self"},{type:"Token",value:")"}]),{type:"Type",name:"general-enclosed"}],"|"));return wi(i,{"!term":t,"!self":n}),wi(n,{"!boolean-group":i}),n}case"Type":case"Property":return{type:e.type,name:e.name,syntax:e};case"Keyword":return{type:e.type,name:e.name.toLowerCase(),syntax:e};case"AtKeyword":return{type:e.type,name:"@"+e.name.toLowerCase(),syntax:e};case"Function":return{type:e.type,name:e.name.toLowerCase()+"(",syntax:e};case"String":return 3===e.value.length?{type:"Token",value:e.value.charAt(1),syntax:e}:{type:e.type,value:e.value.substr(1,e.value.length-2).replace(/\\'/g,"'"),syntax:e};case"Token":return{type:e.type,value:e.value,syntax:e};case"Comma":return{type:e.type,syntax:e};default:throw new Error("Unknown node type:",e.type)}}function Si(e,t){return"string"==typeof e&&(e=ai(e)),{type:"MatchGraph",match:xi(e),syntax:t||null,source:e}}const{hasOwnProperty:Ci}=Object.prototype,Ai="Match";let Mi=0;function Ti(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const i=t.charCodeAt(n);let r=e.charCodeAt(n);if(r>=65&&r<=90&&(r|=32),r!==i)return!1}return!0}function Oi(e){return null===e||e.type===Te||e.type===ue||e.type===Le||e.type===Oe||e.type===Ee||function(e){return e.type===ye&&"?"!==e.value}(e)}function Di(e){return null===e||e.type===ze||e.type===De||e.type===Be||e.type===ye&&"/"===e.value}function Li(e,t,n){const i=function(e,t,n){function i(){do{y++,b=y<e.length?e[y]:null}while(null!==b&&(b.type===xe||b.type===Re))}function r(t){const n=y+t;return n<e.length?e[n]:null}function o(e,t){return{nextState:e,matchStack:w,syntaxStack:u,thenStack:d,tokenIndex:y,prev:t}}function s(e){d={nextState:e,matchStack:w,syntaxStack:u,prev:d}}function a(e){f=o(e,f)}function l(){w={type:1,syntax:t.syntax,token:b,prev:w},i(),p=null,y>v&&(v=y)}function c(){u={syntax:t.syntax,opts:t.syntax.opts||null!==u&&u.opts||null,prev:u},w={type:2,syntax:t.syntax,token:w.token,prev:w}}function h(){w=2===w.type?w.prev:{type:3,syntax:u.syntax,token:w.token,prev:w},u=u.prev}let u=null,d=null,f=null,p=null,m=0,g=null,b=null,y=-1,v=0,w={type:0,syntax:null,token:null,prev:null};for(i();null===g&&++m<15e3;)switch(t.type){case"Match":if(null===d){if(null!==b&&(y!==e.length-1||"\\0"!==b.value&&"\\9"!==b.value)){t=pi;break}g=Ai;break}if((t=d.nextState)===mi){if(d.matchStack===w){t=pi;break}t=fi}for(;d.syntaxStack!==u;)h();d=d.prev;break;case"Mismatch":if(null!==p&&!1!==p)(null===f||y>f.tokenIndex)&&(f=p,p=!1);else if(null===f){g="Mismatch";break}t=f.nextState,d=f.thenStack,u=f.syntaxStack,w=f.matchStack,y=f.tokenIndex,b=y<e.length?e[y]:null,f=f.prev;break;case"MatchGraph":t=t.match;break;case"If":t.else!==pi&&a(t.else),t.then!==fi&&s(t.then),t=t.match;break;case"MatchOnce":t={type:"MatchOnceBuffer",syntax:t,index:0,mask:0};break;case"MatchOnceBuffer":{const e=t.syntax.terms;if(t.index===e.length){if(0===t.mask||t.syntax.all){t=pi;break}t=fi;break}if(t.mask===(1<<e.length)-1){t=fi;break}for(;t.index<e.length;t.index++){const n=1<<t.index;if(0===(t.mask&n)){a(t),s({type:"AddMatchOnce",syntax:t.syntax,mask:t.mask|n}),t=e[t.index++];break}}break}case"AddMatchOnce":t={type:"MatchOnceBuffer",syntax:t.syntax,index:0,mask:t.mask};break;case"Enum":if(null!==b){let e=b.value.toLowerCase();if(-1!==e.indexOf("\\")&&(e=e.replace(/\\[09].*$/,"")),Ci.call(t.map,e)){t=t.map[e];break}}t=pi;break;case"Generic":{const e=null!==u?u.opts:null,n=y+Math.floor(t.fn(b,r,e));if(!isNaN(n)&&n>y){for(;y<n;)l();t=fi}else t=pi;break}case"Type":case"Property":{const e="Type"===t.type?"types":"properties",i=Ci.call(n,e)?n[e][t.name]:null;if(!i||!i.match)throw new Error("Bad syntax reference: "+("Type"===t.type?"<"+t.name+">":"<'"+t.name+"'>"));if(!1!==p&&null!==b&&"Type"===t.type&&("custom-ident"===t.name&&b.type===he||"length"===t.name&&"0"===b.value)){null===p&&(p=o(t,f)),t=pi;break}c(),t=i.matchRef||i.match;break}case"Keyword":{const e=t.name;if(null!==b){let n=b.value;if(-1!==n.indexOf("\\")&&(n=n.replace(/\\[09].*$/,"")),Ti(n,e)){l(),t=fi;break}}t=pi;break}case"AtKeyword":case"Function":if(null!==b&&Ti(b.value,t.name)){l(),t=fi;break}t=pi;break;case"Token":if(null!==b&&b.value===t.value){l(),t=fi;break}t=pi;break;case"Comma":null!==b&&b.type===Te?Oi(w.token)?t=pi:(l(),t=Di(b)?pi:fi):t=Oi(w.token)||Di(b)?fi:pi;break;case"String":let i="",m=y;for(;m<e.length&&i.length<t.value.length;m++)i+=e[m].value;if(Ti(i,t.value)){for(;y<m;)l();t=fi}else t=pi;break;default:throw new Error("Unknown node type: "+t.type)}switch(Mi+=m,g){case null:console.warn("[csstree-match] BREAK after 15000 iterations"),g="Maximum iteration number exceeded (please fill an issue on https://github.com/csstree/csstree/issues)",w=null;break;case Ai:for(;null!==u;)h();break;default:w=null}return{tokens:e,reason:g,iterations:m,match:w,longestMatch:v}}(e,t,n||{});if(null===i.match)return i;let r=i.match,o=i.match={syntax:t.syntax||null,match:[]};const s=[o];for(r=function(e){let t=null,n=null,i=e;for(;null!==i;)n=i.prev,i.prev=t,t=i,i=n;return t}(r).prev;null!==r;){switch(r.type){case 2:o.match.push(o={syntax:r.syntax,match:[]}),s.push(o);break;case 3:s.pop(),o=s[s.length-1];break;default:o.match.push({syntax:r.syntax||null,token:r.token.value,node:r.token.node})}r=r.prev}return i}function zi(e){function t(e){return null!==e&&("Type"===e.type||"Property"===e.type||"Keyword"===e.type)}let n=null;return null!==this.matched&&function i(r){if(Array.isArray(r.match)){for(let e=0;e<r.match.length;e++)if(i(r.match[e]))return t(r.syntax)&&n.unshift(r.syntax),!0}else if(r.node===e)return n=t(r.syntax)?[r.syntax]:[],!0;return!1}(this.matched),n}function Ei(e,t){return Pi(this,e,e=>"Type"===e.type&&e.name===t)}function Bi(e,t){return Pi(this,e,e=>"Property"===e.type&&e.name===t)}function Ri(e){return Pi(this,e,e=>"Keyword"===e.type)}function Pi(e,t,n){const i=zi.call(e,t);return null!==i&&i.some(n)}function Ii(e){return"node"in e?e.node:Ii(e.match[0])}function Ni(e){return"node"in e?e.node:Ni(e.match[e.match.length-1])}function Fi(e,t,n,i,r){const o=[];return null!==n.matched&&function n(s){if(null!==s.syntax&&s.syntax.type===i&&s.syntax.name===r){const n=Ii(s),i=Ni(s);e.syntax.walk(t,function(e,t,r){if(e===n){const e=new lt;do{if(e.appendData(t.data),t.data===i)break;t=t.next}while(null!==t);o.push({parent:r,nodes:e})}})}Array.isArray(s.match)&&s.match.forEach(n)}(n.matched),o}const{hasOwnProperty:Wi}=Object.prototype;function Hi(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e&&e>=0}function qi(e){return Boolean(e)&&Hi(e.offset)&&Hi(e.line)&&Hi(e.column)}function Vi(e,t){return function(n,i){if(!n||n.constructor!==Object)return i(n,"Type of node should be an Object");for(let r in n){let o=!0;if(!1!==Wi.call(n,r)){if("type"===r)n.type!==e&&i(n,"Wrong node type `"+n.type+"`, expected `"+e+"`");else if("loc"===r){if(null===n.loc)continue;if(n.loc&&n.loc.constructor===Object)if("string"!=typeof n.loc.source)r+=".source";else if(qi(n.loc.start)){if(qi(n.loc.end))continue;r+=".end"}else r+=".start";o=!1}else if(t.hasOwnProperty(r)){o=!1;for(let e=0;!o&&e<t[r].length;e++){const i=t[r][e];switch(i){case String:o="string"==typeof n[r];break;case Boolean:o="boolean"==typeof n[r];break;case null:o=null===n[r];break;default:"string"==typeof i?o=n[r]&&n[r].type===i:Array.isArray(i)&&(o=n[r]instanceof lt)}}}else i(n,"Unknown field `"+r+"` for "+e+" node type");o||i(n,"Bad value for `"+e+"."+r+"`")}}for(const r in t)Wi.call(t,r)&&!1===Wi.call(n,r)&&i(n,"Field `"+e+"."+r+"` is missed")}}function ji(e,t){const n=[];for(let i=0;i<e.length;i++){const r=e[i];if(r===String||r===Boolean)n.push(r.name.toLowerCase());else if(null===r)n.push("null");else if("string"==typeof r)n.push(r);else{if(!Array.isArray(r))throw new Error("Wrong value `"+r+"` in `"+t+"` structure definition");n.push("List<"+(ji(r,t)||"any")+">")}}return n.join(" | ")}function Ki(e,t){const n=t.structure,i={type:String,loc:!0},r={type:'"'+e+'"'};for(const t in n){if(!1===Wi.call(n,t))continue;const o=i[t]=Array.isArray(n[t])?n[t].slice():[n[t]];r[t]=ji(o,e+"."+t)}return{docs:r,check:Vi(e,i)}}function _i(e,t,n){const i={};for(const r in e)e[r].syntax&&(i[r]=n?e[r].syntax:Ut(e[r].syntax,{compact:t}));return i}function Ui(e,t,n){const i={};for(const[r,o]of Object.entries(e))i[r]={prelude:o.prelude&&(n?o.prelude.syntax:Ut(o.prelude.syntax,{compact:t})),descriptors:o.descriptors&&_i(o.descriptors,t,n)};return i}function $i(e,t,n){return{matched:e,iterations:n,error:t,...s}}function Yi(e,t,n,i){const r=di(n,e.syntax);let o;return function(e){for(let t=0;t<e.length;t++)if("var("===e[t].value.toLowerCase())return!0;return!1}(r)?$i(null,new Error("Matching for a tree with var() is not supported")):(i&&(o=Li(r,e.cssWideKeywordsSyntax,e)),i&&o.match||(o=Li(r,t.match,e),o.match)?$i(o.match,null,o.iterations):$i(null,new Jt(o.reason,t.syntax,n,o),o.iterations))}class Gi{constructor(e,t,n){if(this.cssWideKeywords=sn,this.syntax=t,this.generic=!1,this.units={...o},this.atrules=Object.create(null),this.properties=Object.create(null),this.types=Object.create(null),this.structure=n||function(e){const t={};if(e.node)for(const n in e.node)if(Wi.call(e.node,n)){const i=e.node[n];if(!i.structure)throw new Error("Missed `structure` field in `"+n+"` node type definition");t[n]=Ki(n,i)}return t}(e),e){if(e.cssWideKeywords&&(this.cssWideKeywords=e.cssWideKeywords),e.units)for(const t of Object.keys(o))Array.isArray(e.units[t])&&(this.units[t]=e.units[t]);if(e.types)for(const[t,n]of Object.entries(e.types))this.addType_(t,n);if(e.generic){this.generic=!0;for(const[e,t]of Object.entries((i=this.units,{...Pn,...In,...Fn(i),"attr-unit":Wn(i)})))this.addType_(e,t)}if(e.atrules)for(const[t,n]of Object.entries(e.atrules))this.addAtrule_(t,n);if(e.properties)for(const[t,n]of Object.entries(e.properties))this.addProperty_(t,n)}var i;this.cssWideKeywordsSyntax=Si(this.cssWideKeywords.join(" | "))}checkStructure(e){function t(e,t){i.push({node:e,message:t})}const n=this.structure,i=[];return this.syntax.walk(e,function(e){n.hasOwnProperty(e.type)?n[e.type].check(e,t):t(e,"Unknown node type `"+e.type+"`")}),!!i.length&&i}createDescriptor(e,t,n,i=null){const r={type:t,name:n},o={type:t,name:n,parent:i,serializable:"string"==typeof e||e&&"string"==typeof e.type,syntax:null,match:null,matchRef:null};return"function"==typeof e?o.match=Si(e,r):("string"==typeof e?Object.defineProperty(o,"syntax",{get:()=>(Object.defineProperty(o,"syntax",{value:ai(e)}),o.syntax)}):o.syntax=e,Object.defineProperty(o,"match",{get:()=>(Object.defineProperty(o,"match",{value:Si(o.syntax,r)}),o.match)}),"Property"===t&&Object.defineProperty(o,"matchRef",{get(){const e=o.syntax,t=function(e){const t=e.terms[0];return!1===e.explicit&&1===e.terms.length&&"Multiplier"===t.type&&!0===t.comma}(e)?Si({...e,terms:[e.terms[0].term]},r):null;return Object.defineProperty(o,"matchRef",{value:t}),t}})),o}addAtrule_(e,t){t&&(this.atrules[e]={type:"Atrule",name:e,prelude:t.prelude?this.createDescriptor(t.prelude,"AtrulePrelude",e):null,descriptors:t.descriptors?Object.keys(t.descriptors).reduce((n,i)=>(n[i]=this.createDescriptor(t.descriptors[i],"AtruleDescriptor",i,e),n),Object.create(null)):null})}addProperty_(e,t){t&&(this.properties[e]=this.createDescriptor(t,"Property",e))}addType_(e,t){t&&(this.types[e]=this.createDescriptor(t,"Type",e))}checkAtruleName(e){if(!this.getAtrule(e))return new Xt("Unknown at-rule","@"+e)}checkAtrulePrelude(e,t){const n=this.checkAtruleName(e);if(n)return n;const i=this.getAtrule(e);return!i.prelude&&t?new SyntaxError("At-rule `@"+e+"` should not contain a prelude"):!i.prelude||t||Yi(this,i.prelude,"",!1).matched?void 0:new SyntaxError("At-rule `@"+e+"` should contain a prelude")}checkAtruleDescriptorName(e,t){const n=this.checkAtruleName(e);if(n)return n;const i=this.getAtrule(e),r=en(t);return i.descriptors?i.descriptors[r.name]||i.descriptors[r.basename]?void 0:new Xt("Unknown at-rule descriptor",t):new SyntaxError("At-rule `@"+e+"` has no known descriptors")}checkPropertyName(e){if(!this.getProperty(e))return new Xt("Unknown property",e)}matchAtrulePrelude(e,t){const n=this.checkAtrulePrelude(e,t);if(n)return $i(null,n);const i=this.getAtrule(e);return i.prelude?Yi(this,i.prelude,t||"",!1):$i(null,null)}matchAtruleDescriptor(e,t,n){const i=this.checkAtruleDescriptorName(e,t);if(i)return $i(null,i);const r=this.getAtrule(e),o=en(t);return Yi(this,r.descriptors[o.name]||r.descriptors[o.basename],n,!1)}matchDeclaration(e){return"Declaration"!==e.type?$i(null,new Error("Not a Declaration node")):this.matchProperty(e.property,e.value)}matchProperty(e,t){if(tn(e).custom)return $i(null,new Error("Lexer matching doesn't applicable for custom properties"));const n=this.checkPropertyName(e);return n?$i(null,n):Yi(this,this.getProperty(e),t,!0)}matchType(e,t){const n=this.getType(e);return n?Yi(this,n,t,!1):$i(null,new Xt("Unknown type",e))}match(e,t){return"string"==typeof e||e&&e.type?("string"!=typeof e&&e.match||(e=this.createDescriptor(e,"Type","anonymous")),Yi(this,e,t,!1)):$i(null,new Xt("Bad syntax"))}findValueFragments(e,t,n,i){return Fi(this,t,this.matchProperty(e,t),n,i)}findDeclarationValueFragments(e,t,n){return Fi(this,e.value,this.matchDeclaration(e),t,n)}findAllFragments(e,t,n){const i=[];return this.syntax.walk(e,{visit:"Declaration",enter:e=>{i.push.apply(i,this.findDeclarationValueFragments(e,t,n))}}),i}getAtrule(e,t=!0){const n=en(e);return(n.vendor&&t?this.atrules[n.name]||this.atrules[n.basename]:this.atrules[n.name])||null}getAtrulePrelude(e,t=!0){const n=this.getAtrule(e,t);return n&&n.prelude||null}getAtruleDescriptor(e,t){return this.atrules.hasOwnProperty(e)&&this.atrules.declarators&&this.atrules[e].declarators[t]||null}getProperty(e,t=!0){const n=tn(e);return(n.vendor&&t?this.properties[n.name]||this.properties[n.basename]:this.properties[n.name])||null}getType(e){return hasOwnProperty.call(this.types,e)?this.types[e]:null}validate(){function e(e,t){return t?`<${e}>`:`<'${e}'>`}function t(o,s,a,l){if(a.has(s))return a.get(s);a.set(s,!1),null!==l.syntax&&hi(l.syntax,function(l){if("Type"!==l.type&&"Property"!==l.type)return;const c="Type"===l.type?o.types:o.properties,h="Type"===l.type?i:r;hasOwnProperty.call(c,l.name)?t(o,l.name,h,c[l.name])&&(n.push(`${e(s,a===i)} used broken syntax definition ${e(l.name,"Type"===l.type)}`),a.set(s,!0)):(n.push(`${e(s,a===i)} used missed syntax definition ${e(l.name,"Type"===l.type)}`),a.set(s,!0))},this)}const n=[];let i=new Map,r=new Map;for(const e in this.types)t(this,e,i,this.types[e]);for(const e in this.properties)t(this,e,r,this.properties[e]);const o=[...i.keys()].filter(e=>i.get(e)),s=[...r.keys()].filter(e=>r.get(e));return o.length||s.length?{errors:n,types:o,properties:s}:null}dump(e,t){return{generic:this.generic,cssWideKeywords:this.cssWideKeywords,units:this.units,types:_i(this.types,!t,e),properties:_i(this.properties,!t,e),atrules:Ui(this.atrules,!t,e)}}toString(){return JSON.stringify(this.dump())}}function Xi(e,t){return"string"==typeof t&&/^\s*\|/.test(t)?"string"==typeof e?e+t:t.replace(/^\s*\|\s*/,""):t||null}function Ji(e,t){const n=Object.create(null);for(const i of Object.keys(e))t.includes(i)&&(n[i]=e[i]);return n}function Zi(e,t,n){const i={...e};for(const[e,r]of Object.entries(t))i[e]={...i[e],...n?Ji(r,n):r};return i}function Qi(e,t){const n={...e};for(const[i,r]of Object.entries(t))switch(i){case"generic":n[i]=Boolean(r);break;case"cssWideKeywords":n[i]=e[i]?[...e[i],...r]:r||[];break;case"units":n[i]={...e[i]};for(const[e,t]of Object.entries(r))n[i][e]=Array.isArray(t)?t:[];break;case"atrules":n[i]={...e[i]};for(const[e,t]of Object.entries(r)){const r=n[i][e]||{},o=n[i][e]={prelude:r.prelude||null,descriptors:{...r.descriptors}};if(t){o.prelude=t.prelude?Xi(o.prelude,t.prelude):o.prelude||null;for(const[e,n]of Object.entries(t.descriptors||{}))o.descriptors[e]=n?Xi(o.descriptors[e],n):null;Object.keys(o.descriptors).length||(o.descriptors=null)}}break;case"types":case"properties":n[i]={...e[i]};for(const[e,t]of Object.entries(r))n[i][e]=Xi(n[i][e],t);break;case"parseContext":n[i]={...e[i],...r};break;case"scope":case"features":n[i]=Zi(e[i],r);break;case"atrule":case"pseudo":n[i]=Zi(e[i],r,["parse"]);break;case"node":n[i]=Zi(e[i],r,["name","structure","parse","generate","walkContext"])}return n}function er(e){const t=function(e){let t="",n="<unknown>",i=!1,r=St,o=!1;const s=new pt,a=Object.assign(new kt,function(e){const t={context:Object.create(null),features:Object.assign(Object.create(null),e.features),scope:Object.assign(Object.create(null),e.scope),atrule:Tt(e.atrule),pseudo:Tt(e.pseudo),node:Tt(e.node)};for(const[n,i]of Object.entries(e.parseContext))switch(typeof i){case"function":t.context[n]=i;break;case"string":t.context[n]=Mt(i)}return{config:t,...t,...t.node}}(e||{}),{parseAtrulePrelude:!0,parseRulePrelude:!0,parseValue:!0,parseCustomProperty:!1,readSequence:xt,consumeUntilBalanceEnd:()=>0,consumeUntilLeftCurlyBracket:e=>123===e?1:0,consumeUntilLeftCurlyBracketOrSemicolon:e=>123===e||59===e?1:0,consumeUntilExclamationMarkOrSemicolon:e=>33===e||59===e?1:0,consumeUntilSemicolonIncluded:e=>59===e?2:0,createList:St,createSingleNodeList:St,getFirstListNode:St,getLastListNode:St,parseWithFallback(e,t){const n=this.tokenIndex;try{return e.call(this)}catch(e){if(o)throw e;this.skip(n-this.tokenIndex);const i=t.call(this);return o=!0,r(e,i),o=!1,i}},lookupNonWSType(e){let t;do{if(t=this.lookupType(e++),t!==xe&&t!==Re)return t}while(0!==t);return 0},charCodeAt:e=>e>=0&&e<t.length?t.charCodeAt(e):0,substring:(e,n)=>t.substring(e,n),substrToCursor(e){return this.source.substring(e,this.tokenStart)},cmpChar:(e,n)=>Je(t,e,n),cmpStr:(e,n,i)=>Ze(t,e,n,i),consume(e){const t=this.tokenStart;return this.eat(e),this.substrToCursor(t)},consumeFunctionName(){const e=t.substring(this.tokenStart,this.tokenEnd-1);return this.eat(ue),e},consumeNumber(e){const n=t.substring(this.tokenStart,it(t,this.tokenStart));return this.eat(e),n},eat(e){if(this.tokenType!==e){const t=mt[e].slice(0,-6).replace(/-/g," ").replace(/^./,e=>e.toUpperCase());let n=`${/[[\](){}]/.test(t)?`"${t}"`:t} is expected`,i=this.tokenStart;switch(e){case he:this.tokenType===ue||this.tokenType===ge?(i=this.tokenEnd-1,n="Identifier is expected but function found"):n="Identifier is expected";break;case fe:this.isDelim(35)&&(this.next(),i++,n="Name is expected");break;case we:this.tokenType===ve&&(i=this.tokenEnd,n="Percent sign is expected")}this.error(n,i)}this.next()},eatIdent(e){this.tokenType===he&&!1!==this.lookupValue(0,e)||this.error(`Identifier "${e}" is expected`),this.next()},eatDelim(e){this.isDelim(e)||this.error(`Delim "${String.fromCharCode(e)}" is expected`),this.next()},getLocation:(e,t)=>i?s.getLocationRange(e,t,n):null,getLocationFromList(e){if(i){const t=this.getFirstListNode(e),i=this.getLastListNode(e);return s.getLocationRange(null!==t?t.loc.start.offset-s.startOffset:this.tokenStart,null!==i?i.loc.end.offset-s.startOffset:this.tokenStart,n)}return null},error(e,n){const i=void 0!==n&&n<t.length?s.getLocation(n):this.eof?s.getLocation(function(e,t){for(;t>=0&&Ve(e.charCodeAt(t));t--);return t+1}(t,t.length-1)):s.getLocation(this.tokenStart);throw new ut(e||"Unexpected input",t,i.offset,i.line,i.column,s.startLine,s.startColumn)}});return Object.assign(function(e,l){t=e,l=l||{},a.setSource(t,st),s.setSource(t,l.offset,l.line,l.column),n=l.filename||"<unknown>",i=Boolean(l.positions),r="function"==typeof l.onParseError?l.onParseError:St,o=!1,a.parseAtrulePrelude=!("parseAtrulePrelude"in l)||Boolean(l.parseAtrulePrelude),a.parseRulePrelude=!("parseRulePrelude"in l)||Boolean(l.parseRulePrelude),a.parseValue=!("parseValue"in l)||Boolean(l.parseValue),a.parseCustomProperty="parseCustomProperty"in l&&Boolean(l.parseCustomProperty);const{context:c="default",list:h=!0,onComment:u,onToken:d}=l;if(c in a.context==0)throw new Error("Unknown context `"+c+"`");Object.assign(a,h?At:Ct),Array.isArray(d)?a.forEachToken((e,t,n)=>{d.push({type:e,start:t,end:n})}):"function"==typeof d&&a.forEachToken(d.bind({filename:n,source:t,tokenCount:a.tokenCount,getTokenType:e=>a.getTokenType(e),getTokenTypeName:e=>mt[a.getTokenType(e)],getTokenStart:e=>a.getTokenStart(e),getTokenEnd:e=>a.getTokenEnd(e),getTokenValue:e=>a.source.substring(a.getTokenStart(e),a.getTokenEnd(e)),substring:(e,t)=>a.source.substring(e,t),balance:a.balance.subarray(0,a.tokenCount+1),isBlockOpenerTokenType:a.isBlockOpenerTokenType,isBlockCloserTokenType:a.isBlockCloserTokenType,getBlockTokenPairIndex:e=>a.getBlockTokenPairIndex(e),getLocation:e=>s.getLocation(e,n),getRangeLocation:(e,t)=>s.getLocationRange(e,t,n)})),"function"==typeof u&&a.forEachToken((e,n,i)=>{if(e===Re){const e=a.getLocation(n,i),r=Ze(t,i-2,i,"*/")?t.slice(n+2,i-2):t.slice(n+2,i);u(r,e)}});const f=a.context[c].call(a,l);return a.eof||a.error(),f},{SyntaxError:ut,config:a.config})}(e),n=function(e){const t=function(e){const t={};for(const n in e.node)if(Nt.call(e.node,n)){const i=e.node[n];if(!i.structure)throw new Error("Missed `structure` field in `"+n+"` node type definition");t[n]=qt(0,i)}return t}(e),n={},i={},r=Symbol("break-walk"),o=Symbol("skip-node");for(const e in t)Nt.call(t,e)&&null!==t[e]&&(n[e]=Vt(t[e],!1),i[e]=Vt(t[e],!0));const s=jt(n),a=jt(i),l=function(e,l){function c(e,t,n){const i=h.call(p,e,t,n);return i===r||i!==o&&(!(!d.hasOwnProperty(e.type)||!d[e.type](e,p,c,f))||u.call(p,e,t,n)===r)}let h=Ft,u=Ft,d=n,f=(e,t,n,i)=>e||c(t,n,i);const p={break:r,skip:o,root:e,stylesheet:null,atrule:null,atrulePrelude:null,rule:null,selector:null,block:null,declaration:null,function:null};if("function"==typeof l)h=l;else if(l&&(h=Wt(l.enter),u=Wt(l.leave),l.reverse&&(d=i),l.visit)){if(s.hasOwnProperty(l.visit))d=l.reverse?a[l.visit]:s[l.visit];else if(!t.hasOwnProperty(l.visit))throw new Error("Bad value `"+l.visit+"` for `visit` option (should be: "+Object.keys(t).sort().join(", ")+")");h=Ht(h,l.visit),u=Ht(u,l.visit)}if(h===Ft&&u===Ft)throw new Error("Neither `enter` nor `leave` walker handler is set or both aren't a function");c(e)};return l.break=r,l.skip=o,l.find=function(e,t){let n=null;return l(e,function(e,i,o){if(t.call(this,e,i,o))return n=e,r}),n},l.findLast=function(e,t){let n=null;return l(e,{reverse:!0,enter(e,i,o){if(t.call(this,e,i,o))return n=e,r}}),n},l.findAll=function(e,t){const n=[];return l(e,function(e,i,r){t.call(this,e,i,r)&&n.push(e)}),n},l}(e),i=function(e){const t=new Map;for(let[n,i]of Object.entries(e.node))"function"==typeof(i.generate||i)&&t.set(n,i.generate||i);return function(e,n){let i="",o=0,s={node(e){if(!t.has(e.type))throw new Error("Unknown node type: "+e.type);t.get(e.type).call(a,e)},tokenBefore:Pt,token(e,t,n){o=this.tokenBefore(o,e,t),!n&&1&o&&this.emit(" ",xe,!0),this.emit(t,e,!1),e===ye&&92===t.charCodeAt(0)&&this.emit("\n",xe,!0)},emit(e){i+=e},result:()=>i};n&&("function"==typeof n.decorator&&(s=n.decorator(s)),n.sourceMap&&(s=function(e){const t=new Ot.x,n={line:1,column:0},i={line:0,column:0},r={line:1,column:0},o={generated:r};let s=1,a=0,l=!1;const c=e.node;e.node=function(e){if(e.loc&&e.loc.start&&Dt.has(e.type)){const c=e.loc.start.line,h=e.loc.start.column-1;i.line===c&&i.column===h||(i.line=c,i.column=h,n.line=s,n.column=a,l&&(l=!1,n.line===r.line&&n.column===r.column||t.addMapping(o)),l=!0,t.addMapping({source:e.loc.source,original:i,generated:n}))}c.call(this,e),l&&Dt.has(e.type)&&(r.line=s,r.column=a)};const h=e.emit;e.emit=function(e,t,n){for(let t=0;t<e.length;t++)10===e.charCodeAt(t)?(s++,a=0):a++;h(e,t,n)};const u=e.result;return e.result=function(){return l&&t.addMapping(o),{css:u(),map:t}},e}(s)),n.mode in r&&(s.tokenBefore=r[n.mode]));const a={node:e=>s.node(e),children:It,token:(e,t)=>s.token(e,t),tokenize:e=>st(e,(t,n,i)=>{s.token(t,e.slice(n,i),0!==n)})};return s.node(e),s.result()}}(e),{fromPlainObject:o,toPlainObject:s}=function(e){return{fromPlainObject:t=>(e(t,{enter(e){e.children&&e.children instanceof lt==0&&(e.children=(new lt).fromArray(e.children))}}),t),toPlainObject:t=>(e(t,{leave(e){e.children&&e.children instanceof lt&&(e.children=e.children.toArray())}}),t)}}(n),a={lexer:null,createLexer:e=>new Gi(e,a,a.lexer.structure),tokenize:st,parse:t,generate:i,walk:n,find:n.find,findLast:n.findLast,findAll:n.findAll,fromPlainObject:o,toPlainObject:s,fork(t){const n=Qi({},e);return er("function"==typeof t?t(n):Qi(n,t))}};return a.lexer=new Gi({generic:e.generic,cssWideKeywords:e.cssWideKeywords,units:e.units,types:e.types,atrules:e.atrules,properties:e.properties,node:e.node},a),a}const tr=e=>er(Qi({},e));n.dn(tr);const nr=43,ir=45,rr=110,or=!0;function sr(e,t){let n=this.tokenStart+e;const i=this.charCodeAt(n);for(i!==nr&&i!==ir||(t&&this.error("Number sign is not allowed"),n++);n<this.tokenEnd;n++)Pe(this.charCodeAt(n))||this.error("Integer is expected",n)}function ar(e){return sr.call(this,0,e)}function lr(e,t){if(!this.cmpChar(this.tokenStart+e,t)){let n="";switch(t){case rr:n="N is expected";break;case ir:n="HyphenMinus is expected"}this.error(n,this.tokenStart+e)}}function cr(){let e=0,t=0,n=this.tokenType;for(;n===xe||n===Re;)n=this.lookupType(++e);if(n!==ve){if(!this.isDelim(nr,e)&&!this.isDelim(ir,e))return null;t=this.isDelim(nr,e)?nr:ir;do{n=this.lookupType(++e)}while(n===xe||n===Re);n!==ve&&(this.skip(e),ar.call(this,or))}return e>0&&this.skip(e),0===t&&(n=this.charCodeAt(this.tokenStart),n!==nr&&n!==ir&&this.error("Number sign is expected")),ar.call(this,0!==t),t===ir?"-"+this.consume(ve):this.consume(ve)}const hr="AnPlusB",ur={a:[String,null],b:[String,null]};function dr(){const e=this.tokenStart;let t=null,n=null;if(this.tokenType===ve)ar.call(this,!1),n=this.consume(ve);else if(this.tokenType===he&&this.cmpChar(this.tokenStart,ir))switch(t="-1",lr.call(this,1,rr),this.tokenEnd-this.tokenStart){case 2:this.next(),n=cr.call(this);break;case 3:lr.call(this,2,ir),this.next(),this.skipSC(),ar.call(this,or),n="-"+this.consume(ve);break;default:lr.call(this,2,ir),sr.call(this,3,or),this.next(),n=this.substrToCursor(e+2)}else if(this.tokenType===he||this.isDelim(nr)&&this.lookupType(1)===he){let i=0;switch(t="1",this.isDelim(nr)&&(i=1,this.next()),lr.call(this,0,rr),this.tokenEnd-this.tokenStart){case 1:this.next(),n=cr.call(this);break;case 2:lr.call(this,1,ir),this.next(),this.skipSC(),ar.call(this,or),n="-"+this.consume(ve);break;default:lr.call(this,1,ir),sr.call(this,2,or),this.next(),n=this.substrToCursor(e+i+1)}}else if(this.tokenType===ke){const i=this.charCodeAt(this.tokenStart),r=i===nr||i===ir;let o=this.tokenStart+r;for(;o<this.tokenEnd&&Pe(this.charCodeAt(o));o++);o===this.tokenStart+r&&this.error("Integer is expected",this.tokenStart+r),lr.call(this,o-this.tokenStart,rr),t=this.substring(e,o),o+1===this.tokenEnd?(this.next(),n=cr.call(this)):(lr.call(this,o-this.tokenStart+1,ir),o+2===this.tokenEnd?(this.next(),this.skipSC(),ar.call(this,or),n="-"+this.consume(ve)):(sr.call(this,o-this.tokenStart+2,or),this.next(),n=this.substrToCursor(o+1)))}else this.error();return null!==t&&t.charCodeAt(0)===nr&&(t=t.substr(1)),null!==n&&n.charCodeAt(0)===nr&&(n=n.substr(1)),{type:"AnPlusB",loc:this.getLocation(e,this.tokenStart),a:t,b:n}}function fr(e){if(e.a){const t=("+1"===e.a||"1"===e.a?"n":"-1"===e.a&&"-n")||e.a+"n";if(e.b){const n="-"===e.b[0]||"+"===e.b[0]?e.b:"+"+e.b;this.tokenize(t+n)}else this.tokenize(t)}else this.tokenize(e.b)}function pr(){return this.Raw(this.consumeUntilLeftCurlyBracketOrSemicolon,!0)}function mr(){for(let e,t=1;e=this.lookupType(t);t++){if(e===Be)return!0;if(e===Ee||e===de)return!1}return!1}const gr="Atrule",br="atrule",yr={name:String,prelude:["AtrulePrelude","Raw",null],block:["Block",null]};function vr(e=!1){const t=this.tokenStart;let n,i,r=null,o=null;switch(this.eat(de),n=this.substrToCursor(t+1),i=n.toLowerCase(),this.skipSC(),!1===this.eof&&this.tokenType!==Ee&&this.tokenType!==Me&&(r=this.parseAtrulePrelude?this.parseWithFallback(this.AtrulePrelude.bind(this,n,e),pr):pr.call(this,this.tokenIndex),this.skipSC()),this.tokenType){case Me:this.next();break;case Ee:o=hasOwnProperty.call(this.atrule,i)&&"function"==typeof this.atrule[i].block?this.atrule[i].block.call(this,e):this.Block(mr.call(this))}return{type:"Atrule",loc:this.getLocation(t,this.tokenStart),name:n,prelude:r,block:o}}function wr(e){this.token(de,"@"+e.name),null!==e.prelude&&this.node(e.prelude),e.block?this.node(e.block):this.token(Me,";")}const kr="AtrulePrelude",xr="atrulePrelude",Sr={children:[[]]};function Cr(e){let t=null;return null!==e&&(e=e.toLowerCase()),this.skipSC(),t=hasOwnProperty.call(this.atrule,e)&&"function"==typeof this.atrule[e].prelude?this.atrule[e].prelude.call(this):this.readSequence(this.scope.AtrulePrelude),this.skipSC(),!0!==this.eof&&this.tokenType!==Ee&&this.tokenType!==Me&&this.error("Semicolon or block is expected"),{type:"AtrulePrelude",loc:this.getLocationFromList(t),children:t}}function Ar(e){this.children(e)}function Mr(){this.eof&&this.error("Unexpected end of input");const e=this.tokenStart;let t=!1;return this.isDelim(42)?(t=!0,this.next()):this.isDelim(124)||this.eat(he),this.isDelim(124)?61!==this.charCodeAt(this.tokenStart+1)?(this.next(),this.eat(he)):t&&this.error("Identifier is expected",this.tokenEnd):t&&this.error("Vertical line is expected"),{type:"Identifier",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e)}}function Tr(){const e=this.tokenStart,t=this.charCodeAt(e);return 61!==t&&126!==t&&94!==t&&36!==t&&42!==t&&124!==t&&this.error("Attribute selector (=, ~=, ^=, $=, *=, |=) is expected"),this.next(),61!==t&&(this.isDelim(61)||this.error("Equal sign is expected"),this.next()),this.substrToCursor(e)}const Or="AttributeSelector",Dr={name:"Identifier",matcher:[String,null],value:["String","Identifier",null],flags:[String,null]};function Lr(){const e=this.tokenStart;let t,n=null,i=null,r=null;return this.eat(Oe),this.skipSC(),t=Mr.call(this),this.skipSC(),this.tokenType!==De&&(this.tokenType!==he&&(n=Tr.call(this),this.skipSC(),i=this.tokenType===pe?this.String():this.Identifier(),this.skipSC()),this.tokenType===he&&(r=this.consume(he),this.skipSC())),this.eat(De),{type:"AttributeSelector",loc:this.getLocation(e,this.tokenStart),name:t,matcher:n,value:i,flags:r}}function zr(e){this.token(ye,"["),this.node(e.name),null!==e.matcher&&(this.tokenize(e.matcher),this.node(e.value)),null!==e.flags&&this.token(he,e.flags),this.token(ye,"]")}function Er(){return this.Raw(null,!0)}function Br(){return this.parseWithFallback(this.Rule,Er)}function Rr(){return this.Raw(this.consumeUntilSemicolonIncluded,!0)}function Pr(){if(this.tokenType===Me)return Rr.call(this,this.tokenIndex);const e=this.parseWithFallback(this.Declaration,Rr);return this.tokenType===Me&&this.next(),e}const Ir="Block",Nr="block",Fr={children:[["Atrule","Rule","Declaration"]]};function Wr(e){const t=e?Pr:Br,n=this.tokenStart;let i=this.createList();this.eat(Ee);e:for(;!this.eof;)switch(this.tokenType){case Be:break e;case xe:case Re:this.next();break;case de:i.push(this.parseWithFallback(this.Atrule.bind(this,e),Er));break;default:e&&this.isDelim(38)?i.push(Br.call(this)):i.push(t.call(this))}return this.eof||this.eat(Be),{type:"Block",loc:this.getLocation(n,this.tokenStart),children:i}}function Hr(e){this.token(Ee,"{"),this.children(e,e=>{"Declaration"===e.type&&this.token(Me,";")}),this.token(Be,"}")}const qr="Brackets",Vr={children:[[]]};function jr(e,t){const n=this.tokenStart;let i=null;return this.eat(Oe),i=e.call(this,t),this.eof||this.eat(De),{type:"Brackets",loc:this.getLocation(n,this.tokenStart),children:i}}function Kr(e){this.token(ye,"["),this.children(e),this.token(ye,"]")}const _r="CDC",Ur=[];function $r(){const e=this.tokenStart;return this.eat(Ce),{type:"CDC",loc:this.getLocation(e,this.tokenStart)}}function Yr(){this.token(Ce,"--\x3e")}const Gr="CDO",Xr=[];function Jr(){const e=this.tokenStart;return this.eat(Se),{type:"CDO",loc:this.getLocation(e,this.tokenStart)}}function Zr(){this.token(Se,"\x3c!--")}const Qr="ClassSelector",eo={name:String};function to(){return this.eatDelim(46),{type:"ClassSelector",loc:this.getLocation(this.tokenStart-1,this.tokenEnd),name:this.consume(he)}}function no(e){this.token(ye,"."),this.token(he,e.name)}const io="Combinator",ro={name:String};function oo(){const e=this.tokenStart;let t;switch(this.tokenType){case xe:t=" ";break;case ye:switch(this.charCodeAt(this.tokenStart)){case 62:case 43:case 126:this.next();break;case 47:this.next(),this.eatIdent("deep"),this.eatDelim(47);break;default:this.error("Combinator is expected")}t=this.substrToCursor(e)}return{type:"Combinator",loc:this.getLocation(e,this.tokenStart),name:t}}function so(e){this.tokenize(e.name)}const ao="Comment",lo={value:String};function co(){const e=this.tokenStart;let t=this.tokenEnd;return this.eat(Re),t-e+2>=2&&42===this.charCodeAt(t-2)&&47===this.charCodeAt(t-1)&&(t-=2),{type:"Comment",loc:this.getLocation(e,this.tokenStart),value:this.substring(e+2,t)}}function ho(e){this.token(Re,"/*"+e.value+"*/")}const uo=new Set([Ae,ze,ce]),fo="Condition",po={kind:String,children:[["Identifier","Feature","FeatureFunction","FeatureRange","SupportsDeclaration"]]};function mo(e){return this.lookupTypeNonSC(1)===he&&uo.has(this.lookupTypeNonSC(2))?this.Feature(e):this.FeatureRange(e)}const go={media:mo,container:mo,supports(){return this.SupportsDeclaration()}};function bo(e="media"){const t=this.createList();e:for(;!this.eof;)switch(this.tokenType){case Re:case xe:this.next();continue;case he:t.push(this.Identifier());break;case Le:{let n=this.parseWithFallback(()=>go[e].call(this,e),()=>null);n||(n=this.parseWithFallback(()=>{this.eat(Le);const t=this.Condition(e);return this.eat(ze),t},()=>this.GeneralEnclosed(e))),t.push(n);break}case ue:{let n=this.parseWithFallback(()=>this.FeatureFunction(e),()=>null);n||(n=this.GeneralEnclosed(e)),t.push(n);break}default:break e}return t.isEmpty&&this.error("Condition is expected"),{type:"Condition",loc:this.getLocationFromList(t),kind:e,children:t}}function yo(e){e.children.forEach(e=>{"Condition"===e.type?(this.token(Le,"("),this.node(e),this.token(ze,")")):this.node(e)})}function vo(){return this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!0)}function wo(){return this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!1)}function ko(){const e=this.tokenIndex,t=this.Value();return"Raw"!==t.type&&!1===this.eof&&this.tokenType!==Me&&!1===this.isDelim(33)&&!1===this.isBalanceEdge(e)&&this.error(),t}const xo="Declaration",So="declaration",Co={important:[Boolean,String],property:String,value:["Value","Raw"]};function Ao(){const e=this.tokenStart,t=this.tokenIndex,n=To.call(this),i=rn(n),r=i?this.parseCustomProperty:this.parseValue,o=i?wo:vo;let s,a=!1;this.skipSC(),this.eat(Ae);const l=this.tokenIndex;if(i||this.skipSC(),s=r?this.parseWithFallback(ko,o):o.call(this,this.tokenIndex),i&&"Value"===s.type&&s.children.isEmpty)for(let e=l-this.tokenIndex;e<=0;e++)if(this.lookupType(e)===xe){s.children.appendData({type:"WhiteSpace",loc:null,value:" "});break}return this.isDelim(33)&&(a=Oo.call(this),this.skipSC()),!1===this.eof&&this.tokenType!==Me&&!1===this.isBalanceEdge(t)&&this.error(),{type:"Declaration",loc:this.getLocation(e,this.tokenStart),important:a,property:n,value:s}}function Mo(e){this.token(he,e.property),this.token(Ae,":"),this.node(e.value),e.important&&(this.token(ye,"!"),this.token(he,!0===e.important?"important":e.important))}function To(){const e=this.tokenStart;if(this.tokenType===ye)switch(this.charCodeAt(this.tokenStart)){case 42:case 36:case 43:case 35:case 38:this.next();break;case 47:this.next(),this.isDelim(47)&&this.next()}return this.tokenType===fe?this.eat(fe):this.eat(he),this.substrToCursor(e)}function Oo(){this.eat(ye),this.skipSC();const e=this.consume(he);return"important"===e||e}function Do(){return this.Raw(this.consumeUntilSemicolonIncluded,!0)}const Lo="DeclarationList",zo={children:[["Declaration","Atrule","Rule"]]};function Eo(){const e=this.createList();for(;!this.eof;)switch(this.tokenType){case xe:case Re:case Me:this.next();break;case de:e.push(this.parseWithFallback(this.Atrule.bind(this,!0),Do));break;default:this.isDelim(38)?e.push(this.parseWithFallback(this.Rule,Do)):e.push(this.parseWithFallback(this.Declaration,Do))}return{type:"DeclarationList",loc:this.getLocationFromList(e),children:e}}function Bo(e){this.children(e,e=>{"Declaration"===e.type&&this.token(Me,";")})}const Ro="Dimension",Po={value:String,unit:String};function Io(){const e=this.tokenStart,t=this.consumeNumber(ke);return{type:"Dimension",loc:this.getLocation(e,this.tokenStart),value:t,unit:this.substring(e+t.length,this.tokenStart)}}function No(e){this.token(ke,e.value+e.unit)}const Fo="Feature",Wo={kind:String,name:String,value:["Identifier","Number","Dimension","Ratio","Function",null]};function Ho(e){const t=this.tokenStart;let n,i=null;if(this.eat(Le),this.skipSC(),n=this.consume(he),this.skipSC(),this.tokenType!==ze){switch(this.eat(Ae),this.skipSC(),this.tokenType){case ve:i=this.lookupNonWSType(1)===ye?this.Ratio():this.Number();break;case ke:i=this.Dimension();break;case he:i=this.Identifier();break;case ue:i=this.parseWithFallback(()=>{const e=this.Function(this.readSequence,this.scope.Value);return this.skipSC(),this.isDelim(47)&&this.error(),e},()=>this.Ratio());break;default:this.error("Number, dimension, ratio or identifier is expected")}this.skipSC()}return this.eof||this.eat(ze),{type:"Feature",loc:this.getLocation(t,this.tokenStart),kind:e,name:n,value:i}}function qo(e){this.token(Le,"("),this.token(he,e.name),null!==e.value&&(this.token(Ae,":"),this.node(e.value)),this.token(ze,")")}const Vo="FeatureFunction",jo={kind:String,feature:String,value:["Declaration","Selector"]};function Ko(e,t){const n=(this.features[e]||{})[t];return"function"!=typeof n&&this.error(`Unknown feature ${t}()`),n}function _o(e="unknown"){const t=this.tokenStart,n=this.consumeFunctionName(),i=Ko.call(this,e,n.toLowerCase());this.skipSC();const r=this.parseWithFallback(()=>{const e=this.tokenIndex,t=i.call(this);return!1===this.eof&&!1===this.isBalanceEdge(e)&&this.error(),t},()=>this.Raw(null,!1));return this.eof||this.eat(ze),{type:"FeatureFunction",loc:this.getLocation(t,this.tokenStart),kind:e,feature:n,value:r}}function Uo(e){this.token(ue,e.feature+"("),this.node(e.value),this.token(ze,")")}const $o="FeatureRange",Yo={kind:String,left:["Identifier","Number","Dimension","Ratio","Function"],leftComparison:String,middle:["Identifier","Number","Dimension","Ratio","Function"],rightComparison:[String,null],right:["Identifier","Number","Dimension","Ratio","Function",null]};function Go(){switch(this.skipSC(),this.tokenType){case ve:return this.isDelim(47,this.lookupOffsetNonSC(1))?this.Ratio():this.Number();case ke:return this.Dimension();case he:return this.Identifier();case ue:return this.parseWithFallback(()=>{const e=this.Function(this.readSequence,this.scope.Value);return this.skipSC(),this.isDelim(47)&&this.error(),e},()=>this.Ratio());default:this.error("Number, dimension, ratio or identifier is expected")}}function Xo(e){if(this.skipSC(),this.isDelim(60)||this.isDelim(62)){const e=this.source[this.tokenStart];return this.next(),this.isDelim(61)?(this.next(),e+"="):e}if(this.isDelim(61))return"=";this.error(`Expected ${e?'":", ':""}"<", ">", "=" or ")"`)}function Jo(e="unknown"){const t=this.tokenStart;this.skipSC(),this.eat(Le);const n=Go.call(this),i=Xo.call(this,"Identifier"===n.type),r=Go.call(this);let o=null,s=null;return this.lookupNonWSType(0)!==ze&&(o=Xo.call(this),s=Go.call(this)),this.skipSC(),this.eat(ze),{type:"FeatureRange",loc:this.getLocation(t,this.tokenStart),kind:e,left:n,leftComparison:i,middle:r,rightComparison:o,right:s}}function Zo(e){this.token(Le,"("),this.node(e.left),this.tokenize(e.leftComparison),this.node(e.middle),e.right&&(this.tokenize(e.rightComparison),this.node(e.right)),this.token(ze,")")}const Qo="Function",es="function",ts={name:String,children:[[]]};function ns(e,t){const n=this.tokenStart,i=this.consumeFunctionName(),r=i.toLowerCase();let o;return o=t.hasOwnProperty(r)?t[r].call(this,t):e.call(this,t),this.eof||this.eat(ze),{type:"Function",loc:this.getLocation(n,this.tokenStart),name:i,children:o}}function is(e){this.token(ue,e.name+"("),this.children(e),this.token(ze,")")}const rs="GeneralEnclosed",os={kind:String,function:[String,null],children:[[]]};function ss(e){const t=this.tokenStart;let n=null;this.tokenType===ue?n=this.consumeFunctionName():this.eat(Le);const i=this.parseWithFallback(()=>{const e=this.tokenIndex,t=this.readSequence(this.scope.Value);return!1===this.eof&&!1===this.isBalanceEdge(e)&&this.error(),t},()=>this.createSingleNodeList(this.Raw(null,!1)));return this.eof||this.eat(ze),{type:"GeneralEnclosed",loc:this.getLocation(t,this.tokenStart),kind:e,function:n,children:i}}function as(e){e.function?this.token(ue,e.function+"("):this.token(Le,"("),this.children(e),this.token(ze,")")}const ls="XXX",cs="Hash",hs={value:String};function us(){const e=this.tokenStart;return this.eat(fe),{type:"Hash",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e+1)}}function ds(e){this.token(fe,"#"+e.value)}const fs="Identifier",ps={name:String};function ms(){return{type:"Identifier",loc:this.getLocation(this.tokenStart,this.tokenEnd),name:this.consume(he)}}function gs(e){this.token(he,e.name)}const bs="IdSelector",ys={name:String};function vs(){const e=this.tokenStart;return this.eat(fe),{type:"IdSelector",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e+1)}}function ws(e){this.token(ye,"#"+e.name)}const ks="Layer",xs={name:String};function Ss(){let e=this.tokenStart,t=this.consume(he);for(;this.isDelim(46);)this.eat(ye),t+="."+this.consume(he);return{type:"Layer",loc:this.getLocation(e,this.tokenStart),name:t}}function Cs(e){this.tokenize(e.name)}const As="LayerList",Ms={children:[["Layer"]]};function Ts(){const e=this.createList();for(this.skipSC();!this.eof&&(e.push(this.Layer()),this.lookupTypeNonSC(0)===Te);)this.skipSC(),this.next(),this.skipSC();return{type:"LayerList",loc:this.getLocationFromList(e),children:e}}function Os(e){this.children(e,()=>this.token(Te,","))}const Ds="MediaQuery",Ls={modifier:[String,null],mediaType:[String,null],condition:["Condition",null]};function zs(){const e=this.tokenStart;let t=null,n=null,i=null;if(this.skipSC(),this.tokenType===he&&this.lookupTypeNonSC(1)!==Le){const e=this.consume(he),r=e.toLowerCase();switch("not"===r||"only"===r?(this.skipSC(),t=r,n=this.consume(he)):n=e,this.lookupTypeNonSC(0)){case he:this.skipSC(),this.eatIdent("and"),i=this.Condition("media");break;case Ee:case Me:case Te:case ce:break;default:this.error("Identifier or parenthesis is expected")}}else switch(this.tokenType){case he:case Le:case ue:i=this.Condition("media");break;case Ee:case Me:case ce:break;default:this.error("Identifier or parenthesis is expected")}return{type:"MediaQuery",loc:this.getLocation(e,this.tokenStart),modifier:t,mediaType:n,condition:i}}function Es(e){e.mediaType?(e.modifier&&this.token(he,e.modifier),this.token(he,e.mediaType),e.condition&&(this.token(he,"and"),this.node(e.condition))):e.condition&&this.node(e.condition)}const Bs="MediaQueryList",Rs={children:[["MediaQuery"]]};function Ps(){const e=this.createList();for(this.skipSC();!this.eof&&(e.push(this.MediaQuery()),this.tokenType===Te);)this.next();return{type:"MediaQueryList",loc:this.getLocationFromList(e),children:e}}function Is(e){this.children(e,()=>this.token(Te,","))}const Ns="NestingSelector",Fs={};function Ws(){const e=this.tokenStart;return this.eatDelim(38),{type:"NestingSelector",loc:this.getLocation(e,this.tokenStart)}}function Hs(){this.token(ye,"&")}const qs="Nth",Vs={nth:["AnPlusB","Identifier"],selector:["SelectorList",null]};function js(){this.skipSC();const e=this.tokenStart;let t,n=e,i=null;return t=this.lookupValue(0,"odd")||this.lookupValue(0,"even")?this.Identifier():this.AnPlusB(),n=this.tokenStart,this.skipSC(),this.lookupValue(0,"of")&&(this.next(),i=this.SelectorList(),n=this.tokenStart),{type:"Nth",loc:this.getLocation(e,n),nth:t,selector:i}}function Ks(e){this.node(e.nth),null!==e.selector&&(this.token(he,"of"),this.node(e.selector))}const _s="Number",Us={value:String};function $s(){return{type:"Number",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:this.consume(ve)}}function Ys(e){this.token(ve,e.value)}const Gs="Operator",Xs={value:String};function Js(){const e=this.tokenStart;return this.next(),{type:"Operator",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e)}}function Zs(e){this.tokenize(e.value)}const Qs="Parentheses",ea={children:[[]]};function ta(e,t){const n=this.tokenStart;let i=null;return this.eat(Le),i=e.call(this,t),this.eof||this.eat(ze),{type:"Parentheses",loc:this.getLocation(n,this.tokenStart),children:i}}function na(e){this.token(Le,"("),this.children(e),this.token(ze,")")}const ia="Percentage",ra={value:String};function oa(){return{type:"Percentage",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:this.consumeNumber(we)}}function sa(e){this.token(we,e.value+"%")}const aa="PseudoClassSelector",la="function",ca={name:String,children:[["Raw"],null]};function ha(){const e=this.tokenStart;let t,n,i=null;return this.eat(Ae),this.tokenType===ue?(t=this.consumeFunctionName(),n=t.toLowerCase(),this.lookupNonWSType(0)==ze?i=this.createList():hasOwnProperty.call(this.pseudo,n)?(this.skipSC(),i=this.pseudo[n].call(this),this.skipSC()):(i=this.createList(),i.push(this.Raw(null,!1))),this.eat(ze)):t=this.consume(he),{type:"PseudoClassSelector",loc:this.getLocation(e,this.tokenStart),name:t,children:i}}function ua(e){this.token(Ae,":"),null===e.children?this.token(he,e.name):(this.token(ue,e.name+"("),this.children(e),this.token(ze,")"))}const da="PseudoElementSelector",fa="function",pa={name:String,children:[["Raw"],null]};function ma(){const e=this.tokenStart;let t,n,i=null;return this.eat(Ae),this.eat(Ae),this.tokenType===ue?(t=this.consumeFunctionName(),n=t.toLowerCase(),this.lookupNonWSType(0)==ze?i=this.createList():hasOwnProperty.call(this.pseudo,n)?(this.skipSC(),i=this.pseudo[n].call(this),this.skipSC()):(i=this.createList(),i.push(this.Raw(null,!1))),this.eat(ze)):t=this.consume(he),{type:"PseudoElementSelector",loc:this.getLocation(e,this.tokenStart),name:t,children:i}}function ga(e){this.token(Ae,":"),this.token(Ae,":"),null===e.children?this.token(he,e.name):(this.token(ue,e.name+"("),this.children(e),this.token(ze,")"))}function ba(){switch(this.skipSC(),this.tokenType){case ve:return this.Number();case ue:return this.Function(this.readSequence,this.scope.Value);default:this.error("Number of function is expected")}}const ya="Ratio",va={left:["Number","Function"],right:["Number","Function",null]};function wa(){const e=this.tokenStart,t=ba.call(this);let n=null;return this.skipSC(),this.isDelim(47)&&(this.eatDelim(47),n=ba.call(this)),{type:"Ratio",loc:this.getLocation(e,this.tokenStart),left:t,right:n}}function ka(e){this.node(e.left),this.token(ye,"/"),e.right?this.node(e.right):this.node(ve,1)}function xa(){return this.tokenIndex>0&&this.lookupType(-1)===xe?this.tokenIndex>1?this.getTokenStart(this.tokenIndex-1):this.firstCharOffset:this.tokenStart}const Sa="Raw",Ca={value:String};function Aa(e,t){const n=this.getTokenStart(this.tokenIndex);let i;return this.skipUntilBalanced(this.tokenIndex,e||this.consumeUntilBalanceEnd),i=t&&this.tokenStart>n?xa.call(this):this.tokenStart,{type:"Raw",loc:this.getLocation(n,i),value:this.substring(n,i)}}function Ma(e){this.tokenize(e.value)}function Ta(){return this.Raw(this.consumeUntilLeftCurlyBracket,!0)}function Oa(){const e=this.SelectorList();return"Raw"!==e.type&&!1===this.eof&&this.tokenType!==Ee&&this.error(),e}const Da="Rule",La="rule",za={prelude:["SelectorList","Raw"],block:["Block"]};function Ea(){const e=this.tokenIndex,t=this.tokenStart;let n,i;return n=this.parseRulePrelude?this.parseWithFallback(Oa,Ta):Ta.call(this,e),i=this.Block(!0),{type:"Rule",loc:this.getLocation(t,this.tokenStart),prelude:n,block:i}}function Ba(e){this.node(e.prelude),this.node(e.block)}const Ra="Scope",Pa={root:["SelectorList","Raw",null],limit:["SelectorList","Raw",null]};function Ia(){let e=null,t=null;this.skipSC();const n=this.tokenStart;return this.tokenType===Le&&(this.next(),this.skipSC(),e=this.parseWithFallback(this.SelectorList,()=>this.Raw(!1,!0)),this.skipSC(),this.eat(ze)),this.lookupNonWSType(0)===he&&(this.skipSC(),this.eatIdent("to"),this.skipSC(),this.eat(Le),this.skipSC(),t=this.parseWithFallback(this.SelectorList,()=>this.Raw(!1,!0)),this.skipSC(),this.eat(ze)),{type:"Scope",loc:this.getLocation(n,this.tokenStart),root:e,limit:t}}function Na(e){e.root&&(this.token(Le,"("),this.node(e.root),this.token(ze,")")),e.limit&&(this.token(he,"to"),this.token(Le,"("),this.node(e.limit),this.token(ze,")"))}const Fa="Selector",Wa={children:[["TypeSelector","IdSelector","ClassSelector","AttributeSelector","PseudoClassSelector","PseudoElementSelector","Combinator"]]};function Ha(){const e=this.readSequence(this.scope.Selector);return null===this.getFirstListNode(e)&&this.error("Selector is expected"),{type:"Selector",loc:this.getLocationFromList(e),children:e}}function qa(e){this.children(e)}const Va="SelectorList",ja="selector",Ka={children:[["Selector","Raw"]]};function _a(){const e=this.createList();for(;!this.eof&&(e.push(this.Selector()),this.tokenType===Te);)this.next();return{type:"SelectorList",loc:this.getLocationFromList(e),children:e}}function Ua(e){this.children(e,()=>this.token(Te,","))}function $a(e){const t=e.length,n=e.charCodeAt(0),i=34===n||39===n?1:0,r=1===i&&t>1&&e.charCodeAt(t-1)===n?t-2:t-1;let o="";for(let n=i;n<=r;n++){let i=e.charCodeAt(n);if(92===i){if(n===r){n!==t-1&&(o=e.substr(n+1));break}if(i=e.charCodeAt(++n),je(92,i)){const t=n-1,i=tt(e,t);n=i-1,o+=ot(e.substring(t+1,i))}else 13===i&&10===e.charCodeAt(n+1)&&n++}else o+=e[n]}return o}function Ya(e,t){const n=t?"'":'"',i=t?39:34;let r="",o=!1;for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);0!==n?n<=31||127===n?(r+="\\"+n.toString(16),o=!0):n===i||92===n?(r+="\\"+e.charAt(t),o=!1):(o&&(Ie(n)||Ve(n))&&(r+=" "),r+=e.charAt(t),o=!1):r+="�"}return n+r+n}const Ga="String",Xa={value:String};function Ja(){return{type:"String",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:$a(this.consume(pe))}}function Za(e){this.token(pe,Ya(e.value))}function Qa(){return this.Raw(null,!1)}const el="StyleSheet",tl="stylesheet",nl={children:[["Comment","CDO","CDC","Atrule","Rule","Raw"]]};function il(){const e=this.tokenStart,t=this.createList();let n;for(;!this.eof;){switch(this.tokenType){case xe:this.next();continue;case Re:if(33!==this.charCodeAt(this.tokenStart+2)){this.next();continue}n=this.Comment();break;case Se:n=this.CDO();break;case Ce:n=this.CDC();break;case de:n=this.parseWithFallback(this.Atrule,Qa);break;default:n=this.parseWithFallback(this.Rule,Qa)}t.push(n)}return{type:"StyleSheet",loc:this.getLocation(e,this.tokenStart),children:t}}function rl(e){this.children(e)}const ol="SupportsDeclaration",sl={declaration:"Declaration"};function al(){const e=this.tokenStart;this.eat(Le),this.skipSC();const t=this.Declaration();return this.eof||this.eat(ze),{type:"SupportsDeclaration",loc:this.getLocation(e,this.tokenStart),declaration:t}}function ll(e){this.token(Le,"("),this.node(e.declaration),this.token(ze,")")}function cl(){this.tokenType!==he&&!1===this.isDelim(42)&&this.error("Identifier or asterisk is expected"),this.next()}const hl="TypeSelector",ul={name:String};function dl(){const e=this.tokenStart;return this.isDelim(124)?(this.next(),cl.call(this)):(cl.call(this),this.isDelim(124)&&(this.next(),cl.call(this))),{type:"TypeSelector",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e)}}function fl(e){this.tokenize(e.name)}function pl(e,t){let n=0;for(let i=this.tokenStart+e;i<this.tokenEnd;i++){const r=this.charCodeAt(i);if(45===r&&t&&0!==n)return pl.call(this,e+n+1,!1),-1;Ie(r)||this.error(t&&0!==n?"Hyphen minus"+(n<6?" or hex digit":"")+" is expected":n<6?"Hex digit is expected":"Unexpected input",i),++n>6&&this.error("Too many hex digits",i)}return this.next(),n}function ml(e){let t=0;for(;this.isDelim(63);)++t>e&&this.error("Too many question marks"),this.next()}function gl(e){this.charCodeAt(this.tokenStart)!==e&&this.error((43===e?"Plus sign":"Hyphen minus")+" is expected")}function bl(){let e=0;switch(this.tokenType){case ve:if(e=pl.call(this,1,!0),this.isDelim(63)){ml.call(this,6-e);break}if(this.tokenType===ke||this.tokenType===ve){gl.call(this,45),pl.call(this,1,!1);break}break;case ke:e=pl.call(this,1,!0),e>0&&ml.call(this,6-e);break;default:if(this.eatDelim(43),this.tokenType===he){e=pl.call(this,0,!0),e>0&&ml.call(this,6-e);break}if(this.isDelim(63)){this.next(),ml.call(this,5);break}this.error("Hex digit or question mark is expected")}}const yl="UnicodeRange",vl={value:String};function wl(){const e=this.tokenStart;return this.eatIdent("u"),bl.call(this),{type:"UnicodeRange",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e)}}function kl(e){this.tokenize(e.value)}function xl(e){const t=e.length;let n=4,i=41===e.charCodeAt(t-1)?t-2:t-1,r="";for(;n<i&&Ve(e.charCodeAt(n));)n++;for(;n<i&&Ve(e.charCodeAt(i));)i--;for(let o=n;o<=i;o++){let n=e.charCodeAt(o);if(92===n){if(o===i){o!==t-1&&(r=e.substr(o+1));break}if(n=e.charCodeAt(++o),je(92,n)){const t=o-1,n=tt(e,t);o=n-1,r+=ot(e.substring(t+1,n))}else 13===n&&10===e.charCodeAt(o+1)&&o++}else r+=e[o]}return r}function Sl(e){let t="",n=!1;for(let i=0;i<e.length;i++){const r=e.charCodeAt(i);0!==r?r<=31||127===r?(t+="\\"+r.toString(16),n=!0):32===r||92===r||34===r||39===r||40===r||41===r?(t+="\\"+e.charAt(i),n=!1):(n&&Ie(r)&&(t+=" "),t+=e.charAt(i),n=!1):t+="�"}return"url("+t+")"}const Cl="Url",Al={value:String};function Ml(){const e=this.tokenStart;let t;switch(this.tokenType){case ge:t=xl(this.consume(ge));break;case ue:this.cmpStr(this.tokenStart,this.tokenEnd,"url(")||this.error("Function name must be `url`"),this.eat(ue),this.skipSC(),t=$a(this.consume(pe)),this.skipSC(),this.eof||this.eat(ze);break;default:this.error("Url or Function is expected")}return{type:"Url",loc:this.getLocation(e,this.tokenStart),value:t}}function Tl(e){this.token(ge,Sl(e.value))}const Ol="Value",Dl={children:[[]]};function Ll(){const e=this.tokenStart,t=this.readSequence(this.scope.Value);return{type:"Value",loc:this.getLocation(e,this.tokenStart),children:t}}function zl(e){this.children(e)}const El=Object.freeze({type:"WhiteSpace",loc:null,value:" "}),Bl="WhiteSpace",Rl={value:String};function Pl(){return this.eat(xe),El}function Il(e){this.token(xe,e.value)}const Nl={generic:!0,cssWideKeywords:sn,generic:!0,cssWideKeywords:["initial","inherit","unset","revert","revert-layer"],units:{angle:["deg","grad","rad","turn"],decibel:["db"],flex:["fr"],frequency:["hz","khz"],length:["cm","mm","q","in","pt","pc","px","em","rem","ex","rex","cap","rcap","ch","rch","ic","ric","lh","rlh","vw","svw","lvw","dvw","vh","svh","lvh","dvh","vi","svi","lvi","dvi","vb","svb","lvb","dvb","vmin","svmin","lvmin","dvmin","vmax","svmax","lvmax","dvmax","cqw","cqh","cqi","cqb","cqmin","cqmax"],resolution:["dpi","dpcm","dppx","x"],semitones:["st"],time:["s","ms"]},types:{"abs()":"abs( <calc-sum> )","absolute-size":"xx-small|x-small|small|medium|large|x-large|xx-large|xxx-large","acos()":"acos( <calc-sum> )","alpha-value":"<number>|<percentage>","an+b":"odd|even|<integer>|<n-dimension>|'+'? † n|-n|<ndashdigit-dimension>|'+'? † <ndashdigit-ident>|<dashndashdigit-ident>|<n-dimension> <signed-integer>|'+'? † n <signed-integer>|-n <signed-integer>|<ndash-dimension> <signless-integer>|'+'? † n- <signless-integer>|-n- <signless-integer>|<n-dimension> ['+'|'-'] <signless-integer>|'+'? † n ['+'|'-'] <signless-integer>|-n ['+'|'-'] <signless-integer>","anchor()":"anchor( <anchor-name>?&&<anchor-side> , <length-percentage>? )","anchor-name":"<dashed-ident>","anchor-side":"inside|outside|top|left|right|bottom|start|end|self-start|self-end|<percentage>|center","anchor-size":"width|height|block|inline|self-block|self-inline","anchor-size()":"anchor-size( [<anchor-name>||<anchor-size>]? , <length-percentage>? )","angle-percentage":"<angle>|<percentage>","angular-color-hint":"<angle-percentage>|<zero>","angular-color-stop":"<color> <color-stop-angle>?","angular-color-stop-list":"<angular-color-stop> , [<angular-color-hint>? , <angular-color-stop>]#?","animateable-feature":"scroll-position|contents|<custom-ident>","animation-action":"none|play|play-once|play-forwards|play-backwards|pause|reset|replay","asin()":"asin( <calc-sum> )","atan()":"atan( <calc-sum> )","atan2()":"atan2( <calc-sum> , <calc-sum> )",attachment:"scroll|fixed|local","attr()":"attr( <attr-name> <attr-type>? , <declaration-value>? )","attr-matcher":"['~'|'|'|'^'|'$'|'*']? '='","attr-modifier":"i|s","attr-type":"type( <syntax> )|raw-string|number|<attr-unit>","attribute-selector":"'[' <wq-name> ']'|'[' <wq-name> <attr-matcher> [<string-token>|<ident-token>] <attr-modifier>? ']'","auto-repeat":"repeat( [auto-fill|auto-fit] , [<line-names>? <fixed-size>]+ <line-names>? )","auto-track-list":"[<line-names>? [<fixed-size>|<fixed-repeat>]]* <line-names>? <auto-repeat> [<line-names>? [<fixed-size>|<fixed-repeat>]]* <line-names>?",axis:"block|inline|x|y","baseline-position":"[first|last]? baseline","basic-shape":"<inset()>|<xywh()>|<rect()>|<circle()>|<ellipse()>|<polygon()>|<path()>","basic-shape-rect":"<inset()>|<rect()>|<xywh()>","bg-clip":"<visual-box>|border-area|text","bg-image":"<image>|none","bg-layer":"<bg-image>||<bg-position> [/ <bg-size>]?||<repeat-style>||<attachment>||<visual-box>||<visual-box>","bg-position":"[[left|center|right|top|bottom|<length-percentage>]|[left|center|right|<length-percentage>] [top|center|bottom|<length-percentage>]|[center|[left|right] <length-percentage>?]&&[center|[top|bottom] <length-percentage>?]]","bg-size":"[<length-percentage [0,∞]>|auto]{1,2}|cover|contain","blend-mode":"normal|multiply|screen|overlay|darken|lighten|color-dodge|color-burn|hard-light|soft-light|difference|exclusion|hue|saturation|color|luminosity","blur()":"blur( <length>? )","brightness()":"brightness( [<number>|<percentage>]? )","calc()":"calc( <calc-sum> )","calc-constant":"e|pi|infinity|-infinity|NaN","calc-product":"<calc-value> ['*' <calc-value>|'/' <number>]*","calc-size()":"calc-size( <calc-size-basis> , <calc-sum> )","calc-size-basis":"<intrinsic-size-keyword>|<calc-size()>|any|<calc-sum>","calc-sum":"<calc-product> [['+'|'-'] <calc-product>]*","calc-value":"<number>|<dimension>|<percentage>|<calc-constant>|( <calc-sum> )","cf-final-image":"<image>|<color>","cf-mixing-image":"<percentage>?&&<image>","circle()":"circle( <radial-size>? [at <position>]? )","clamp()":"clamp( <calc-sum>#{3} )","class-selector":"'.' <ident-token>","clip-source":"<url>",color:"<color-base>|currentColor|<system-color>|<device-cmyk()>|<light-dark()>|<-non-standard-color>","color()":"color( <colorspace-params> [/ [<alpha-value>|none]]? )","color-base":"<hex-color>|<color-function>|<named-color>|<color-mix()>|transparent","color-function":"<rgb()>|<rgba()>|<hsl()>|<hsla()>|<hwb()>|<lab()>|<lch()>|<oklab()>|<oklch()>|<color()>","color-interpolation-method":"in [<rectangular-color-space>|<polar-color-space> <hue-interpolation-method>?|<custom-color-space>]","color-mix()":"color-mix( <color-interpolation-method> , [<color>&&<percentage [0,100]>?]#{2} )","color-stop":"<color-stop-length>|<color-stop-angle>","color-stop-angle":"[<angle-percentage>|<zero>]{1,2}","color-stop-length":"<length-percentage>{1,2}","color-stop-list":"<linear-color-stop> , [<linear-color-hint>? , <linear-color-stop>]#?","colorspace-params":"[<predefined-rgb-params>|<xyz-params>]",combinator:"'>'|'+'|'~'|['|' '|']","common-lig-values":"[common-ligatures|no-common-ligatures]","compat-auto":"searchfield|textarea|checkbox|radio|menulist|listbox|meter|progress-bar|button","compat-special":"textfield|menulist-button","complex-selector":"<complex-selector-unit> [<combinator>? <complex-selector-unit>]*","complex-selector-list":"<complex-selector>#","composite-style":"clear|copy|source-over|source-in|source-out|source-atop|destination-over|destination-in|destination-out|destination-atop|xor","compositing-operator":"add|subtract|intersect|exclude","compound-selector":"[<type-selector>? <subclass-selector>*]!","compound-selector-list":"<compound-selector>#","conic-gradient()":"conic-gradient( [<conic-gradient-syntax>] )","conic-gradient-syntax":"[[[from [<angle>|<zero>]]? [at <position>]?]||<color-interpolation-method>]? , <angular-color-stop-list>","container-condition":"not <query-in-parens>|<query-in-parens> [[and <query-in-parens>]*|[or <query-in-parens>]*]","container-name":"<custom-ident>","container-query":"not <query-in-parens>|<query-in-parens> [[and <query-in-parens>]*|[or <query-in-parens>]*]","content-distribution":"space-between|space-around|space-evenly|stretch","content-list":"[<string>|contents|<image>|<counter>|<quote>|<target>|<leader()>|<attr()>]+","content-position":"center|start|end|flex-start|flex-end","content-replacement":"<image>","contextual-alt-values":"[contextual|no-contextual]","contrast()":"contrast( [<number>|<percentage>]? )","coord-box":"content-box|padding-box|border-box|fill-box|stroke-box|view-box","corner-shape-value":"round|scoop|bevel|notch|square|squircle|<superellipse()>","cos()":"cos( <calc-sum> )",counter:"<counter()>|<counters()>","counter()":"counter( <counter-name> , <counter-style>? )","counter-name":"<custom-ident>","counter-style":"<counter-style-name>|symbols( )","counter-style-name":"<custom-ident>","counters()":"counters( <counter-name> , <string> , <counter-style>? )","cross-fade()":"cross-fade( <cf-mixing-image> , <cf-final-image>? )","cubic-bezier()":"cubic-bezier( [<number [0,1]> , <number>]#{2} )","cubic-bezier-easing-function":"ease|ease-in|ease-out|ease-in-out|cubic-bezier( <number [0,1]> , <number> , <number [0,1]> , <number> )","cursor-predefined":"auto|default|none|context-menu|help|pointer|progress|wait|cell|crosshair|text|vertical-text|alias|copy|move|no-drop|not-allowed|e-resize|n-resize|ne-resize|nw-resize|s-resize|se-resize|sw-resize|w-resize|ew-resize|ns-resize|nesw-resize|nwse-resize|col-resize|row-resize|all-scroll|zoom-in|zoom-out|grab|grabbing","custom-color-space":"<dashed-ident>","custom-params":"<dashed-ident> [<number>|<percentage>|none]+",dasharray:"[[<length-percentage>|<number>]+]#","dashndashdigit-ident":"<ident-token>","deprecated-system-color":"ActiveBorder|ActiveCaption|AppWorkspace|Background|ButtonHighlight|ButtonShadow|CaptionText|InactiveBorder|InactiveCaption|InactiveCaptionText|InfoBackground|InfoText|Menu|MenuText|Scrollbar|ThreeDDarkShadow|ThreeDFace|ThreeDHighlight|ThreeDLightShadow|ThreeDShadow|Window|WindowFrame|WindowText","discretionary-lig-values":"[discretionary-ligatures|no-discretionary-ligatures]","display-box":"contents|none","display-inside":"flow|flow-root|table|flex|grid|ruby","display-internal":"table-row-group|table-header-group|table-footer-group|table-row|table-cell|table-column-group|table-column|table-caption|ruby-base|ruby-text|ruby-base-container|ruby-text-container","display-legacy":"inline-block|inline-list-item|inline-table|inline-flex|inline-grid","display-listitem":"<display-outside>?&&[flow|flow-root]?&&list-item","display-outside":"block|inline|run-in","drop-shadow()":"drop-shadow( [<color>?&&<length>{2,3}] )","dynamic-range-limit-mix()":"dynamic-range-limit-mix( [<'dynamic-range-limit'>&&<percentage [0,100]>]#{2,} )","easing-function":"<linear-easing-function>|<cubic-bezier-easing-function>|<step-easing-function>","east-asian-variant-values":"[jis78|jis83|jis90|jis04|simplified|traditional]","east-asian-width-values":"[full-width|proportional-width]","element()":"element( <custom-ident> , [first|start|last|first-except]? )|element( <id-selector> )","ellipse()":"ellipse( <radial-size>? [at <position>]? )","env()":"env( <custom-ident> , <declaration-value>? )","exp()":"exp( <calc-sum> )","explicit-track-list":"[<line-names>? <track-size>]+ <line-names>?","family-name":"<string>|<custom-ident>+","feature-tag-value":"<string> [<integer>|on|off]?","feature-type":"@stylistic|@historical-forms|@styleset|@character-variant|@swash|@ornaments|@annotation","feature-value-block":"<feature-type> '{' <feature-value-declaration-list> '}'","feature-value-block-list":"<feature-value-block>+","feature-value-declaration":"<custom-ident> : <integer>+ ;","feature-value-declaration-list":"<feature-value-declaration>","feature-value-name":"<custom-ident>","filter-function":"<blur()>|<brightness()>|<contrast()>|<drop-shadow()>|<grayscale()>|<hue-rotate()>|<invert()>|<opacity()>|<saturate()>|<sepia()>","filter-value-list":"[<filter-function>|<url>]+","final-bg-layer":"<bg-image>||<bg-position> [/ <bg-size>]?||<repeat-style>||<attachment>||<visual-box>||<visual-box>||<'background-color'>","fit-content()":"fit-content( <length-percentage [0,∞]> )","fixed-breadth":"<length-percentage>","fixed-repeat":"repeat( [<integer [1,∞]>] , [<line-names>? <fixed-size>]+ <line-names>? )","fixed-size":"<fixed-breadth>|minmax( <fixed-breadth> , <track-breadth> )|minmax( <inflexible-breadth> , <fixed-breadth> )","font-stretch-absolute":"normal|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded|<percentage>","font-variant-css2":"normal|small-caps","font-weight-absolute":"normal|bold|<number [1,1000]>","font-width-css3":"normal|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded","form-control-identifier":"select","frequency-percentage":"<frequency>|<percentage>","generic-complete":"serif|sans-serif|system-ui|cursive|fantasy|math|monospace","general-enclosed":"[<function-token> <any-value>? )]|[( <any-value>? )]","generic-family":"<generic-script-specific>|<generic-complete>|<generic-incomplete>|<-non-standard-generic-family>","generic-incomplete":"ui-serif|ui-sans-serif|ui-monospace|ui-rounded","geometry-box":"<shape-box>|fill-box|stroke-box|view-box",gradient:"<linear-gradient()>|<repeating-linear-gradient()>|<radial-gradient()>|<repeating-radial-gradient()>|<conic-gradient()>|<repeating-conic-gradient()>|<-legacy-gradient>","grayscale()":"grayscale( [<number>|<percentage>]? )","grid-line":"auto|<custom-ident>|[<integer>&&<custom-ident>?]|[span&&[<integer>||<custom-ident>]]","historical-lig-values":"[historical-ligatures|no-historical-ligatures]","hsl()":"hsl( <hue> , <percentage> , <percentage> , <alpha-value>? )|hsl( [<hue>|none] [<percentage>|<number>|none] [<percentage>|<number>|none] [/ [<alpha-value>|none]]? )","hsla()":"hsla( <hue> , <percentage> , <percentage> , <alpha-value>? )|hsla( [<hue>|none] [<percentage>|<number>|none] [<percentage>|<number>|none] [/ [<alpha-value>|none]]? )",hue:"<number>|<angle>","hue-interpolation-method":"[shorter|longer|increasing|decreasing] hue","hue-rotate()":"hue-rotate( [<angle>|<zero>]? )","hwb()":"hwb( [<hue>|none] [<percentage>|<number>|none] [<percentage>|<number>|none] [/ [<alpha-value>|none]]? )","hypot()":"hypot( <calc-sum># )",image:"<url>|<image()>|<image-set()>|<element()>|<paint()>|<cross-fade()>|<gradient>","image()":"image( <image-tags>? [<image-src>? , <color>?]! )","image-set()":"image-set( <image-set-option># )","image-set-option":"[<image>|<string>] [<resolution>||type( <string> )]","image-src":"<url>|<string>","image-tags":"ltr|rtl","inflexible-breadth":"<length-percentage>|min-content|max-content|auto","inset()":"inset( <length-percentage>{1,4} [round <'border-radius'>]? )","invert()":"invert( [<number>|<percentage>]? )","keyframe-block":"<keyframe-selector># { <declaration-list> }","keyframe-selector":"from|to|<percentage [0,100]>|<timeline-range-name> <percentage>","keyframes-name":"<custom-ident>|<string>","lab()":"lab( [<percentage>|<number>|none] [<percentage>|<number>|none] [<percentage>|<number>|none] [/ [<alpha-value>|none]]? )","layer()":"layer( <layer-name> )","layer-name":"<ident> ['.' <ident>]*","lch()":"lch( [<percentage>|<number>|none] [<percentage>|<number>|none] [<hue>|none] [/ [<alpha-value>|none]]? )","leader()":"leader( <leader-type> )","leader-type":"dotted|solid|space|<string>","length-percentage":"<length>|<percentage>","light-dark()":"light-dark( <color> , <color> )","line-name-list":"[<line-names>|<name-repeat>]+","line-names":"'[' <custom-ident>* ']'","line-style":"none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset","line-width":"<length>|thin|medium|thick","linear()":"linear( [<number>&&<percentage>{0,2}]# )","linear-color-hint":"<length-percentage>","linear-color-stop":"<color> <color-stop-length>?","linear-easing-function":"linear|<linear()>","linear-gradient()":"linear-gradient( [<linear-gradient-syntax>] )","linear-gradient-syntax":"[[<angle>|<zero>|to <side-or-corner>]||<color-interpolation-method>]? , <color-stop-list>","log()":"log( <calc-sum> , <calc-sum>? )","mask-layer":"<mask-reference>||<position> [/ <bg-size>]?||<repeat-style>||<geometry-box>||[<geometry-box>|no-clip]||<compositing-operator>||<masking-mode>","mask-position":"[<length-percentage>|left|center|right] [<length-percentage>|top|center|bottom]?","mask-reference":"none|<image>|<mask-source>","mask-source":"<url>","masking-mode":"alpha|luminance|match-source","matrix()":"matrix( <number>#{6} )","matrix3d()":"matrix3d( <number>#{16} )","max()":"max( <calc-sum># )","media-and":"<media-in-parens> [and <media-in-parens>]+","media-condition":"<media-not>|<media-and>|<media-or>|<media-in-parens>","media-condition-without-or":"<media-not>|<media-and>|<media-in-parens>","media-feature":"( [<mf-plain>|<mf-boolean>|<mf-range>] )","media-in-parens":"( <media-condition> )|<media-feature>|<general-enclosed>","media-not":"not <media-in-parens>","media-or":"<media-in-parens> [or <media-in-parens>]+","media-query":"<media-condition>|[not|only]? <media-type> [and <media-condition-without-or>]?","media-query-list":"<media-query>#","media-type":"<ident>","mf-boolean":"<mf-name>","mf-name":"<ident>","mf-plain":"<mf-name> : <mf-value>","mf-range":"<mf-name> ['<'|'>']? '='? <mf-value>|<mf-value> ['<'|'>']? '='? <mf-name>|<mf-value> '<' '='? <mf-name> '<' '='? <mf-value>|<mf-value> '>' '='? <mf-name> '>' '='? <mf-value>","mf-value":"<number>|<dimension>|<ident>|<ratio>","min()":"min( <calc-sum># )","minmax()":"minmax( [<length-percentage>|min-content|max-content|auto] , [<length-percentage>|<flex>|min-content|max-content|auto] )","mod()":"mod( <calc-sum> , <calc-sum> )","n-dimension":"<dimension-token>","name-repeat":"repeat( [<integer [1,∞]>|auto-fill] , <line-names>+ )","named-color":"aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen","namespace-prefix":"<ident>","ndash-dimension":"<dimension-token>","ndashdigit-dimension":"<dimension-token>","ndashdigit-ident":"<ident-token>","ns-prefix":"[<ident-token>|'*']? '|'","number-percentage":"<number>|<percentage>","numeric-figure-values":"[lining-nums|oldstyle-nums]","numeric-fraction-values":"[diagonal-fractions|stacked-fractions]","numeric-spacing-values":"[proportional-nums|tabular-nums]","offset-path":"<ray()>|<url>|<basic-shape>","oklab()":"oklab( [<percentage>|<number>|none] [<percentage>|<number>|none] [<percentage>|<number>|none] [/ [<alpha-value>|none]]? )","oklch()":"oklch( [<percentage>|<number>|none] [<percentage>|<number>|none] [<hue>|none] [/ [<alpha-value>|none]]? )","opacity()":"opacity( [<number>|<percentage>]? )","opacity-value":"<number>|<percentage>","outline-line-style":"none|dotted|dashed|solid|double|groove|ridge|inset|outset","outline-radius":"<length>|<percentage>","overflow-position":"unsafe|safe","page-body":"<declaration>? [; <page-body>]?|<page-margin-box> <page-body>","page-margin-box":"<page-margin-box-type> '{' <declaration-list> '}'","page-margin-box-type":"@top-left-corner|@top-left|@top-center|@top-right|@top-right-corner|@bottom-left-corner|@bottom-left|@bottom-center|@bottom-right|@bottom-right-corner|@left-top|@left-middle|@left-bottom|@right-top|@right-middle|@right-bottom","page-selector":"<pseudo-page>+|<ident> <pseudo-page>*","page-selector-list":"[<page-selector>#]?","page-size":"A5|A4|A3|B5|B4|JIS-B5|JIS-B4|letter|legal|ledger",paint:"none|<color>|<url> [none|<color>]?|context-fill|context-stroke","paint()":"paint( <ident> , <declaration-value>? )","paint-box":"<visual-box>|fill-box|stroke-box","palette-identifier":"<dashed-ident>","palette-mix()":"palette-mix( <color-interpolation-method> , [[normal|light|dark|<palette-identifier>|<palette-mix()>]&&<percentage [0,100]>?]#{2} )","path()":"path( <'fill-rule'>? , <string> )","perspective()":"perspective( [<length [0,∞]>|none] )","polar-color-space":"hsl|hwb|lch|oklch","polygon()":"polygon( <'fill-rule'>? , [<length-percentage> <length-percentage>]# )",position:"[[left|center|right]||[top|center|bottom]|[left|center|right|<length-percentage>] [top|center|bottom|<length-percentage>]?|[[left|right] <length-percentage>]&&[[top|bottom] <length-percentage>]]","position-area":"[[left|center|right|span-left|span-right|x-start|x-end|span-x-start|span-x-end|x-self-start|x-self-end|span-x-self-start|span-x-self-end|span-all]||[top|center|bottom|span-top|span-bottom|y-start|y-end|span-y-start|span-y-end|y-self-start|y-self-end|span-y-self-start|span-y-self-end|span-all]|[block-start|center|block-end|span-block-start|span-block-end|span-all]||[inline-start|center|inline-end|span-inline-start|span-inline-end|span-all]|[self-block-start|center|self-block-end|span-self-block-start|span-self-block-end|span-all]||[self-inline-start|center|self-inline-end|span-self-inline-start|span-self-inline-end|span-all]|[start|center|end|span-start|span-end|span-all]{1,2}|[self-start|center|self-end|span-self-start|span-self-end|span-all]{1,2}]","pow()":"pow( <calc-sum> , <calc-sum> )","predefined-rgb":"srgb|srgb-linear|display-p3|display-p3-linear|a98-rgb|prophoto-rgb|rec2020","predefined-rgb-params":"<predefined-rgb> [<number>|<percentage>|none]{3}","pseudo-class-selector":"':' <ident-token>|':' <function-token> <any-value> ')'","pseudo-element-selector":"':' <pseudo-class-selector>|<legacy-pseudo-element-selector>","pseudo-page":": [left|right|first|blank]","query-in-parens":"( <container-condition> )|( <size-feature> )|style( <style-query> )|<general-enclosed>",quote:"open-quote|close-quote|no-open-quote|no-close-quote","radial-extent":"closest-corner|closest-side|farthest-corner|farthest-side","radial-gradient()":"radial-gradient( [<radial-gradient-syntax>] )","radial-gradient-syntax":"[[[<radial-shape>||<radial-size>]? [at <position>]?]||<color-interpolation-method>]? , <color-stop-list>","radial-shape":"circle|ellipse","radial-size":"<radial-extent>|<length [0,∞]>|<length-percentage [0,∞]>{2}",ratio:"<number [0,∞]> [/ <number [0,∞]>]?","ray()":"ray( <angle>&&<ray-size>?&&contain?&&[at <position>]? )","ray-size":"closest-side|closest-corner|farthest-side|farthest-corner|sides","rect()":"rect( [<length-percentage>|auto]{4} [round <'border-radius'>]? )","rectangular-color-space":"srgb|srgb-linear|display-p3|display-p3-linear|a98-rgb|prophoto-rgb|rec2020|lab|oklab|xyz|xyz-d50|xyz-d65","relative-selector":"<combinator>? <complex-selector>","relative-selector-list":"<relative-selector>#","relative-size":"larger|smaller","rem()":"rem( <calc-sum> , <calc-sum> )","repeat-style":"repeat-x|repeat-y|[repeat|space|round|no-repeat]{1,2}","repeating-conic-gradient()":"repeating-conic-gradient( [<conic-gradient-syntax>] )","repeating-linear-gradient()":"repeating-linear-gradient( [<linear-gradient-syntax>] )","repeating-radial-gradient()":"repeating-radial-gradient( [<radial-gradient-syntax>] )","reversed-counter-name":"reversed( <counter-name> )","rgb()":"rgb( <percentage>#{3} , <alpha-value>? )|rgb( <number>#{3} , <alpha-value>? )|rgb( [<number>|<percentage>|none]{3} [/ [<alpha-value>|none]]? )","rgba()":"rgba( <percentage>#{3} , <alpha-value>? )|rgba( <number>#{3} , <alpha-value>? )|rgba( [<number>|<percentage>|none]{3} [/ [<alpha-value>|none]]? )","rotate()":"rotate( [<angle>|<zero>] )","rotate3d()":"rotate3d( <number> , <number> , <number> , [<angle>|<zero>] )","rotateX()":"rotateX( [<angle>|<zero>] )","rotateY()":"rotateY( [<angle>|<zero>] )","rotateZ()":"rotateZ( [<angle>|<zero>] )","round()":"round( <rounding-strategy>? , <calc-sum> , <calc-sum> )","rounding-strategy":"nearest|up|down|to-zero","saturate()":"saturate( [<number>|<percentage>]? )","scale()":"scale( [<number>|<percentage>]#{1,2} )","scale3d()":"scale3d( [<number>|<percentage>]#{3} )","scaleX()":"scaleX( [<number>|<percentage>] )","scaleY()":"scaleY( [<number>|<percentage>] )","scaleZ()":"scaleZ( [<number>|<percentage>] )","scope-end":"<forgiving-selector-list>","scope-start":"<forgiving-selector-list>","scroll()":"scroll( [<scroller>||<axis>]? )",scroller:"root|nearest|self","scroll-state-feature":"<media-query-list>","scroll-state-in-parens":"( <scroll-state-query> )|( <scroll-state-feature> )|<general-enclosed>","scroll-state-query":"not <scroll-state-in-parens>|<scroll-state-in-parens> [[and <scroll-state-in-parens>]*|[or <scroll-state-in-parens>]*]|<scroll-state-feature>","selector-list":"<complex-selector-list>","self-position":"center|start|end|self-start|self-end|flex-start|flex-end","sepia()":"sepia( [<number>|<percentage>]? )",shadow:"inset?&&<length>{2,4}&&<color>?","shadow-t":"[<length>{2,3}&&<color>?]",shape:"rect( <top> , <right> , <bottom> , <left> )|rect( <top> <right> <bottom> <left> )","shape-box":"<visual-box>|margin-box","side-or-corner":"[left|right]||[top|bottom]","sign()":"sign( <calc-sum> )","signed-integer":"<number-token>","signless-integer":"<number-token>","sin()":"sin( <calc-sum> )","single-animation":"<'animation-duration'>||<easing-function>||<'animation-delay'>||<single-animation-iteration-count>||<single-animation-direction>||<single-animation-fill-mode>||<single-animation-play-state>||[none|<keyframes-name>]||<single-animation-timeline>","single-animation-composition":"replace|add|accumulate","single-animation-direction":"normal|reverse|alternate|alternate-reverse","single-animation-fill-mode":"none|forwards|backwards|both","single-animation-iteration-count":"infinite|<number>","single-animation-play-state":"running|paused","single-animation-timeline":"auto|none|<dashed-ident>|<scroll()>|<view()>","single-transition":"[none|<single-transition-property>]||<time>||<easing-function>||<time>||<transition-behavior-value>","single-transition-property":"all|<custom-ident>",size:"closest-side|farthest-side|closest-corner|farthest-corner|<length>|<length-percentage>{2}","size-feature":"<mf-plain>|<mf-boolean>|<mf-range>","skew()":"skew( [<angle>|<zero>] , [<angle>|<zero>]? )","skewX()":"skewX( [<angle>|<zero>] )","skewY()":"skewY( [<angle>|<zero>] )","sqrt()":"sqrt( <calc-sum> )","step-position":"jump-start|jump-end|jump-none|jump-both|start|end","step-easing-function":"step-start|step-end|<steps()>","steps()":"steps( <integer> , <step-position>? )","style-feature":"<declaration>","style-in-parens":"( <style-condition> )|( <style-feature> )|<general-enclosed>","style-query":"<style-condition>|<style-feature>","subclass-selector":"<id-selector>|<class-selector>|<attribute-selector>|<pseudo-class-selector>","superellipse()":"superellipse( [<number>|infinity|-infinity] )","supports-condition":"not <supports-in-parens>|<supports-in-parens> [and <supports-in-parens>]*|<supports-in-parens> [or <supports-in-parens>]*","supports-decl":"( <declaration> )","supports-feature":"<supports-decl>|<supports-selector-fn>","supports-in-parens":"( <supports-condition> )|<supports-feature>|<general-enclosed>","supports-selector-fn":"selector( <complex-selector> )",symbol:"<string>|<image>|<custom-ident>","symbols()":"symbols( <symbols-type>? [<string>|<image>]+ )","symbols-type":"cyclic|numeric|alphabetic|symbolic|fixed","system-color":"AccentColor|AccentColorText|ActiveText|ButtonBorder|ButtonFace|ButtonText|Canvas|CanvasText|Field|FieldText|GrayText|Highlight|HighlightText|LinkText|Mark|MarkText|SelectedItem|SelectedItemText|VisitedText","system-family-name":"caption|icon|menu|message-box|small-caption|status-bar","tan()":"tan( <calc-sum> )",target:"<target-counter()>|<target-counters()>|<target-text()>","target-counter()":"target-counter( [<string>|<url>] , <custom-ident> , <counter-style>? )","target-counters()":"target-counters( [<string>|<url>] , <custom-ident> , <string> , <counter-style>? )","target-text()":"target-text( [<string>|<url>] , [content|before|after|first-letter]? )","text-edge":"[text|cap|ex|ideographic|ideographic-ink] [text|alphabetic|ideographic|ideographic-ink]?","time-percentage":"<time>|<percentage>","timeline-range-name":"cover|contain|entry|exit|entry-crossing|exit-crossing","track-breadth":"<length-percentage>|<flex>|min-content|max-content|auto","track-list":"[<line-names>? [<track-size>|<track-repeat>]]+ <line-names>?","track-repeat":"repeat( [<integer [1,∞]>] , [<line-names>? <track-size>]+ <line-names>? )","track-size":"<track-breadth>|minmax( <inflexible-breadth> , <track-breadth> )|fit-content( <length-percentage> )","transform-function":"<matrix()>|<translate()>|<translateX()>|<translateY()>|<scale()>|<scaleX()>|<scaleY()>|<rotate()>|<skew()>|<skewX()>|<skewY()>|<matrix3d()>|<translate3d()>|<translateZ()>|<scale3d()>|<scaleZ()>|<rotate3d()>|<rotateX()>|<rotateY()>|<rotateZ()>|<perspective()>","transform-list":"<transform-function>+","transition-behavior-value":"normal|allow-discrete","translate()":"translate( <length-percentage> , <length-percentage>? )","translate3d()":"translate3d( <length-percentage> , <length-percentage> , <length> )","translateX()":"translateX( <length-percentage> )","translateY()":"translateY( <length-percentage> )","translateZ()":"translateZ( <length> )","try-size":"most-width|most-height|most-block-size|most-inline-size","try-tactic":"flip-block||flip-inline||flip-start","type-or-unit":"string|color|url|integer|number|length|angle|time|frequency|cap|ch|em|ex|ic|lh|rlh|rem|vb|vi|vw|vh|vmin|vmax|mm|Q|cm|in|pt|pc|px|deg|grad|rad|turn|ms|s|Hz|kHz|%","type-selector":"<wq-name>|<ns-prefix>? '*'","var()":"var( <custom-property-name> , <declaration-value>? )","view()":"view( [<axis>||<'view-timeline-inset'>]? )","viewport-length":"auto|<length-percentage>","visual-box":"content-box|padding-box|border-box","wq-name":"<ns-prefix>? <ident-token>","xywh()":"xywh( <length-percentage>{2} <length-percentage [0,∞]>{2} [round <'border-radius'>]? )",xyz:"xyz|xyz-d50|xyz-d65","xyz-params":"<xyz-space> [<number>|<percentage>|none]{3}","-legacy-gradient":"<-webkit-gradient()>|<-legacy-linear-gradient>|<-legacy-repeating-linear-gradient>|<-legacy-radial-gradient>|<-legacy-repeating-radial-gradient>","-legacy-linear-gradient":"-moz-linear-gradient( <-legacy-linear-gradient-arguments> )|-webkit-linear-gradient( <-legacy-linear-gradient-arguments> )|-o-linear-gradient( <-legacy-linear-gradient-arguments> )","-legacy-repeating-linear-gradient":"-moz-repeating-linear-gradient( <-legacy-linear-gradient-arguments> )|-webkit-repeating-linear-gradient( <-legacy-linear-gradient-arguments> )|-o-repeating-linear-gradient( <-legacy-linear-gradient-arguments> )","-legacy-linear-gradient-arguments":"[<angle>|<side-or-corner>]? , <color-stop-list>","-legacy-radial-gradient":"-moz-radial-gradient( <-legacy-radial-gradient-arguments> )|-webkit-radial-gradient( <-legacy-radial-gradient-arguments> )|-o-radial-gradient( <-legacy-radial-gradient-arguments> )","-legacy-repeating-radial-gradient":"-moz-repeating-radial-gradient( <-legacy-radial-gradient-arguments> )|-webkit-repeating-radial-gradient( <-legacy-radial-gradient-arguments> )|-o-repeating-radial-gradient( <-legacy-radial-gradient-arguments> )","-legacy-radial-gradient-arguments":"[<position> ,]? [[[<-legacy-radial-gradient-shape>||<-legacy-radial-gradient-size>]|[<length>|<percentage>]{2}] ,]? <color-stop-list>","-legacy-radial-gradient-size":"closest-side|closest-corner|farthest-side|farthest-corner|contain|cover","-legacy-radial-gradient-shape":"circle|ellipse","-non-standard-font":"-apple-system-body|-apple-system-headline|-apple-system-subheadline|-apple-system-caption1|-apple-system-caption2|-apple-system-footnote|-apple-system-short-body|-apple-system-short-headline|-apple-system-short-subheadline|-apple-system-short-caption1|-apple-system-short-footnote|-apple-system-tall-body","-non-standard-color":"-moz-ButtonDefault|-moz-ButtonHoverFace|-moz-ButtonHoverText|-moz-CellHighlight|-moz-CellHighlightText|-moz-Combobox|-moz-ComboboxText|-moz-Dialog|-moz-DialogText|-moz-dragtargetzone|-moz-EvenTreeRow|-moz-Field|-moz-FieldText|-moz-html-CellHighlight|-moz-html-CellHighlightText|-moz-mac-accentdarkestshadow|-moz-mac-accentdarkshadow|-moz-mac-accentface|-moz-mac-accentlightesthighlight|-moz-mac-accentlightshadow|-moz-mac-accentregularhighlight|-moz-mac-accentregularshadow|-moz-mac-chrome-active|-moz-mac-chrome-inactive|-moz-mac-focusring|-moz-mac-menuselect|-moz-mac-menushadow|-moz-mac-menutextselect|-moz-MenuHover|-moz-MenuHoverText|-moz-MenuBarText|-moz-MenuBarHoverText|-moz-nativehyperlinktext|-moz-OddTreeRow|-moz-win-communicationstext|-moz-win-mediatext|-moz-activehyperlinktext|-moz-default-background-color|-moz-default-color|-moz-hyperlinktext|-moz-visitedhyperlinktext|-webkit-activelink|-webkit-focus-ring-color|-webkit-link|-webkit-text","-non-standard-image-rendering":"optimize-contrast|-moz-crisp-edges|-o-crisp-edges|-webkit-optimize-contrast","-non-standard-overflow":"overlay|-moz-scrollbars-none|-moz-scrollbars-horizontal|-moz-scrollbars-vertical|-moz-hidden-unscrollable","-non-standard-size":"intrinsic|min-intrinsic|-webkit-fill-available|-webkit-fit-content|-webkit-min-content|-webkit-max-content|-moz-available|-moz-fit-content|-moz-min-content|-moz-max-content","-webkit-gradient()":"-webkit-gradient( <-webkit-gradient-type> , <-webkit-gradient-point> [, <-webkit-gradient-point>|, <-webkit-gradient-radius> , <-webkit-gradient-point>] [, <-webkit-gradient-radius>]? [, <-webkit-gradient-color-stop>]* )","-webkit-gradient-color-stop":"from( <color> )|color-stop( [<number-zero-one>|<percentage>] , <color> )|to( <color> )","-webkit-gradient-point":"[left|center|right|<length-percentage>] [top|center|bottom|<length-percentage>]","-webkit-gradient-radius":"<length>|<percentage>","-webkit-gradient-type":"linear|radial","-webkit-mask-box-repeat":"repeat|stretch|round","-ms-filter-function-list":"<-ms-filter-function>+","-ms-filter-function":"<-ms-filter-function-progid>|<-ms-filter-function-legacy>","-ms-filter-function-progid":"'progid:' [<ident-token> '.']* [<ident-token>|<function-token> <any-value>? )]","-ms-filter-function-legacy":"<ident-token>|<function-token> <any-value>? )",age:"child|young|old","attr-name":"<wq-name>","attr-fallback":"<any-value>",autospace:"no-autospace|[ideograph-alpha||ideograph-numeric||punctuation]||[insert|replace]",bottom:"<length>|auto","generic-voice":"[<age>? <gender> <integer>?]",gender:"male|female|neutral","generic-script-specific":"generic( kai )|generic( fangsong )|generic( nastaliq )","-non-standard-generic-family":"-apple-system|BlinkMacSystemFont","intrinsic-size-keyword":"min-content|max-content|fit-content",left:"<length>|auto","device-cmyk()":"<legacy-device-cmyk-syntax>|<modern-device-cmyk-syntax>","legacy-device-cmyk-syntax":"device-cmyk( <number>#{4} )","modern-device-cmyk-syntax":"device-cmyk( <cmyk-component>{4} [/ [<alpha-value>|none]]? )","cmyk-component":"<number>|<percentage>|none","color-space":"<rectangular-color-space>|<polar-color-space>|<custom-color-space>",right:"<length>|auto","forgiving-selector-list":"<complex-real-selector-list>","forgiving-relative-selector-list":"<relative-real-selector-list>","complex-real-selector-list":"<complex-real-selector>#","simple-selector-list":"<simple-selector>#","relative-real-selector-list":"<relative-real-selector>#","complex-selector-unit":"[<compound-selector>? <pseudo-compound-selector>*]!","complex-real-selector":"<compound-selector> [<combinator>? <compound-selector>]*","relative-real-selector":"<combinator>? <complex-real-selector>","pseudo-compound-selector":"<pseudo-element-selector> <pseudo-class-selector>*","simple-selector":"<type-selector>|<subclass-selector>","legacy-pseudo-element-selector":"':' [before|after|first-line|first-letter]","svg-length":"<percentage>|<length>|<number>","svg-writing-mode":"lr-tb|rl-tb|tb-rl|lr|rl|tb",top:"<length>|auto",x:"<number>",y:"<number>",declaration:"<ident-token> : <declaration-value>? ['!' important]?","declaration-list":"[<declaration>? ';']* <declaration>?",url:"url( <string> <url-modifier>* )|<url-token>","url-modifier":"<ident>|<function-token> <any-value> )","number-zero-one":"<number [0,1]>","number-one-or-greater":"<number [1,∞]>","xyz-space":"xyz|xyz-d50|xyz-d65","style-condition":"not <style-in-parens>|<style-in-parens> [[and <style-in-parens>]*|[or <style-in-parens>]*]","-non-standard-display":"-ms-inline-flexbox|-ms-grid|-ms-inline-grid|-webkit-flex|-webkit-inline-flex|-webkit-box|-webkit-inline-box|-moz-inline-stack|-moz-box|-moz-inline-box","inset-area":"[[left|center|right|span-left|span-right|x-start|x-end|span-x-start|span-x-end|x-self-start|x-self-end|span-x-self-start|span-x-self-end|span-all]||[top|center|bottom|span-top|span-bottom|y-start|y-end|span-y-start|span-y-end|y-self-start|y-self-end|span-y-self-start|span-y-self-end|span-all]|[block-start|center|block-end|span-block-start|span-block-end|span-all]||[inline-start|center|inline-end|span-inline-start|span-inline-end|span-all]|[self-block-start|self-block-end|span-self-block-start|span-self-block-end|span-all]||[self-inline-start|self-inline-end|span-self-inline-start|span-self-inline-end|span-all]|[start|center|end|span-start|span-end|span-all]{1,2}|[self-start|center|self-end|span-self-start|span-self-end|span-all]{1,2}]",syntax:"'*'|<syntax-component> [<syntax-combinator> <syntax-component>]*|<syntax-string>","syntax-component":"<syntax-single-component> <syntax-multiplier>?|'<' transform-list '>'","syntax-single-component":"'<' <syntax-type-name> '>'|<ident>","syntax-type-name":"angle|color|custom-ident|image|integer|length|length-percentage|number|percentage|resolution|string|time|url|transform-function","syntax-combinator":"'|'","syntax-multiplier":"'#'|'+'","syntax-string":"<string>"},properties:{"--*":"<declaration-value>","-ms-accelerator":"false|true","-ms-block-progression":"tb|rl|bt|lr","-ms-content-zoom-chaining":"none|chained","-ms-content-zoom-limit":"<'-ms-content-zoom-limit-min'> <'-ms-content-zoom-limit-max'>","-ms-content-zoom-limit-max":"<percentage>","-ms-content-zoom-limit-min":"<percentage>","-ms-content-zoom-snap":"<'-ms-content-zoom-snap-type'>||<'-ms-content-zoom-snap-points'>","-ms-content-zoom-snap-points":"snapInterval( <percentage> , <percentage> )|snapList( <percentage># )","-ms-content-zoom-snap-type":"none|proximity|mandatory","-ms-content-zooming":"none|zoom","-ms-filter":"<string>","-ms-flow-from":"[none|<custom-ident>]#","-ms-flow-into":"[none|<custom-ident>]#","-ms-grid-columns":"none|<track-list>|<auto-track-list>","-ms-grid-rows":"none|<track-list>|<auto-track-list>","-ms-high-contrast-adjust":"auto|none","-ms-hyphenate-limit-chars":"auto|<integer>{1,3}","-ms-hyphenate-limit-lines":"no-limit|<integer>","-ms-hyphenate-limit-zone":"<percentage>|<length>","-ms-ime-align":"auto|after","-ms-overflow-style":"auto|none|scrollbar|-ms-autohiding-scrollbar","-ms-scroll-chaining":"chained|none","-ms-scroll-limit":"<'-ms-scroll-limit-x-min'> <'-ms-scroll-limit-y-min'> <'-ms-scroll-limit-x-max'> <'-ms-scroll-limit-y-max'>","-ms-scroll-limit-x-max":"auto|<length>","-ms-scroll-limit-x-min":"<length>","-ms-scroll-limit-y-max":"auto|<length>","-ms-scroll-limit-y-min":"<length>","-ms-scroll-rails":"none|railed","-ms-scroll-snap-points-x":"snapInterval( <length-percentage> , <length-percentage> )|snapList( <length-percentage># )","-ms-scroll-snap-points-y":"snapInterval( <length-percentage> , <length-percentage> )|snapList( <length-percentage># )","-ms-scroll-snap-type":"none|proximity|mandatory","-ms-scroll-snap-x":"<'-ms-scroll-snap-type'> <'-ms-scroll-snap-points-x'>","-ms-scroll-snap-y":"<'-ms-scroll-snap-type'> <'-ms-scroll-snap-points-y'>","-ms-scroll-translation":"none|vertical-to-horizontal","-ms-scrollbar-3dlight-color":"<color>","-ms-scrollbar-arrow-color":"<color>","-ms-scrollbar-base-color":"<color>","-ms-scrollbar-darkshadow-color":"<color>","-ms-scrollbar-face-color":"<color>","-ms-scrollbar-highlight-color":"<color>","-ms-scrollbar-shadow-color":"<color>","-ms-scrollbar-track-color":"<color>","-ms-text-autospace":"none|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space","-ms-touch-select":"grippers|none","-ms-user-select":"none|element|text","-ms-wrap-flow":"auto|both|start|end|maximum|clear","-ms-wrap-margin":"<length>","-ms-wrap-through":"wrap|none","-moz-appearance":"none|button|button-arrow-down|button-arrow-next|button-arrow-previous|button-arrow-up|button-bevel|button-focus|caret|checkbox|checkbox-container|checkbox-label|checkmenuitem|dualbutton|groupbox|listbox|listitem|menuarrow|menubar|menucheckbox|menuimage|menuitem|menuitemtext|menulist|menulist-button|menulist-text|menulist-textfield|menupopup|menuradio|menuseparator|meterbar|meterchunk|progressbar|progressbar-vertical|progresschunk|progresschunk-vertical|radio|radio-container|radio-label|radiomenuitem|range|range-thumb|resizer|resizerpanel|scale-horizontal|scalethumbend|scalethumb-horizontal|scalethumbstart|scalethumbtick|scalethumb-vertical|scale-vertical|scrollbarbutton-down|scrollbarbutton-left|scrollbarbutton-right|scrollbarbutton-up|scrollbarthumb-horizontal|scrollbarthumb-vertical|scrollbartrack-horizontal|scrollbartrack-vertical|searchfield|separator|sheet|spinner|spinner-downbutton|spinner-textfield|spinner-upbutton|splitter|statusbar|statusbarpanel|tab|tabpanel|tabpanels|tab-scroll-arrow-back|tab-scroll-arrow-forward|textfield|textfield-multiline|toolbar|toolbarbutton|toolbarbutton-dropdown|toolbargripper|toolbox|tooltip|treeheader|treeheadercell|treeheadersortarrow|treeitem|treeline|treetwisty|treetwistyopen|treeview|-moz-mac-unified-toolbar|-moz-win-borderless-glass|-moz-win-browsertabbar-toolbox|-moz-win-communicationstext|-moz-win-communications-toolbox|-moz-win-exclude-glass|-moz-win-glass|-moz-win-mediatext|-moz-win-media-toolbox|-moz-window-button-box|-moz-window-button-box-maximized|-moz-window-button-close|-moz-window-button-maximize|-moz-window-button-minimize|-moz-window-button-restore|-moz-window-frame-bottom|-moz-window-frame-left|-moz-window-frame-right|-moz-window-titlebar|-moz-window-titlebar-maximized","-moz-binding":"<url>|none","-moz-border-bottom-colors":"<color>+|none","-moz-border-left-colors":"<color>+|none","-moz-border-right-colors":"<color>+|none","-moz-border-top-colors":"<color>+|none","-moz-context-properties":"none|[fill|fill-opacity|stroke|stroke-opacity]#","-moz-float-edge":"border-box|content-box|margin-box|padding-box","-moz-force-broken-image-icon":"0|1","-moz-orient":"inline|block|horizontal|vertical","-moz-outline-radius":"<outline-radius>{1,4} [/ <outline-radius>{1,4}]?","-moz-outline-radius-bottomleft":"<outline-radius>","-moz-outline-radius-bottomright":"<outline-radius>","-moz-outline-radius-topleft":"<outline-radius>","-moz-outline-radius-topright":"<outline-radius>","-moz-stack-sizing":"ignore|stretch-to-fit","-moz-text-blink":"none|blink","-moz-user-focus":"ignore|normal|select-after|select-before|select-menu|select-same|select-all|none","-moz-user-input":"auto|none|enabled|disabled","-moz-user-modify":"read-only|read-write|write-only","-moz-window-dragging":"drag|no-drag","-moz-window-shadow":"default|menu|tooltip|sheet|none","-webkit-appearance":"none|button|button-bevel|caps-lock-indicator|caret|checkbox|default-button|inner-spin-button|listbox|listitem|media-controls-background|media-controls-fullscreen-background|media-current-time-display|media-enter-fullscreen-button|media-exit-fullscreen-button|media-fullscreen-button|media-mute-button|media-overlay-play-button|media-play-button|media-seek-back-button|media-seek-forward-button|media-slider|media-sliderthumb|media-time-remaining-display|media-toggle-closed-captions-button|media-volume-slider|media-volume-slider-container|media-volume-sliderthumb|menulist|menulist-button|menulist-text|menulist-textfield|meter|progress-bar|progress-bar-value|push-button|radio|scrollbarbutton-down|scrollbarbutton-left|scrollbarbutton-right|scrollbarbutton-up|scrollbargripper-horizontal|scrollbargripper-vertical|scrollbarthumb-horizontal|scrollbarthumb-vertical|scrollbartrack-horizontal|scrollbartrack-vertical|searchfield|searchfield-cancel-button|searchfield-decoration|searchfield-results-button|searchfield-results-decoration|slider-horizontal|slider-vertical|sliderthumb-horizontal|sliderthumb-vertical|square-button|textarea|textfield|-apple-pay-button","-webkit-border-before":"<'border-width'>||<'border-style'>||<color>","-webkit-border-before-color":"<color>","-webkit-border-before-style":"<'border-style'>","-webkit-border-before-width":"<'border-width'>","-webkit-box-reflect":"[above|below|right|left]? <length>? <image>?","-webkit-line-clamp":"none|<integer>","-webkit-mask":"[<mask-reference>||<position> [/ <bg-size>]?||<repeat-style>||[<visual-box>|border|padding|content|text]||[<visual-box>|border|padding|content]]#","-webkit-mask-attachment":"<attachment>#","-webkit-mask-clip":"[<coord-box>|no-clip|border|padding|content|text]#","-webkit-mask-composite":"<composite-style>#","-webkit-mask-image":"<mask-reference>#","-webkit-mask-origin":"[<coord-box>|border|padding|content]#","-webkit-mask-position":"<position>#","-webkit-mask-position-x":"[<length-percentage>|left|center|right]#","-webkit-mask-position-y":"[<length-percentage>|top|center|bottom]#","-webkit-mask-repeat":"<repeat-style>#","-webkit-mask-repeat-x":"repeat|no-repeat|space|round","-webkit-mask-repeat-y":"repeat|no-repeat|space|round","-webkit-mask-size":"<bg-size>#","-webkit-overflow-scrolling":"auto|touch","-webkit-tap-highlight-color":"<color>","-webkit-text-fill-color":"<color>","-webkit-text-stroke":"<length>||<color>","-webkit-text-stroke-color":"<color>","-webkit-text-stroke-width":"<length>","-webkit-touch-callout":"default|none","-webkit-user-modify":"read-only|read-write|read-write-plaintext-only","-webkit-user-select":"auto|none|text|all","accent-color":"auto|<color>","align-content":"normal|<baseline-position>|<content-distribution>|<overflow-position>? <content-position>","align-items":"normal|stretch|<baseline-position>|[<overflow-position>? <self-position>]|anchor-center","align-self":"auto|normal|stretch|<baseline-position>|<overflow-position>? <self-position>|anchor-center","align-tracks":"[normal|<baseline-position>|<content-distribution>|<overflow-position>? <content-position>]#","alignment-baseline":"auto|baseline|before-edge|text-before-edge|middle|central|after-edge|text-after-edge|ideographic|alphabetic|hanging|mathematical",all:"initial|inherit|unset|revert|revert-layer","anchor-name":"none|<dashed-ident>#","anchor-scope":"none|all|<dashed-ident>#",animation:"<single-animation>#","animation-composition":"<single-animation-composition>#","animation-delay":"<time>#","animation-direction":"<single-animation-direction>#","animation-duration":"[auto|<time [0s,∞]>]#","animation-fill-mode":"<single-animation-fill-mode>#","animation-iteration-count":"<single-animation-iteration-count>#","animation-name":"[none|<keyframes-name>]#","animation-play-state":"<single-animation-play-state>#","animation-range":"[<'animation-range-start'> <'animation-range-end'>?]#","animation-range-end":"[normal|<length-percentage>|<timeline-range-name> <length-percentage>?]#","animation-range-start":"[normal|<length-percentage>|<timeline-range-name> <length-percentage>?]#","animation-timeline":"<single-animation-timeline>#","animation-timing-function":"<easing-function>#","animation-trigger":"[none|[<dashed-ident> <animation-action>+]+]#",appearance:"none|auto|<compat-auto>|<compat-special>","aspect-ratio":"auto||<ratio>","backdrop-filter":"none|<filter-value-list>","backface-visibility":"visible|hidden",background:"<bg-layer>#? , <final-bg-layer>","background-attachment":"<attachment>#","background-blend-mode":"<blend-mode>#","background-clip":"<bg-clip>#","background-color":"<color>","background-image":"<bg-image>#","background-origin":"<visual-box>#","background-position":"<bg-position>#","background-position-x":"[center|[[left|right|x-start|x-end]? <length-percentage>?]!]#","background-position-y":"[center|[[top|bottom|y-start|y-end]? <length-percentage>?]!]#","background-repeat":"<repeat-style>#","background-size":"<bg-size>#","baseline-shift":"baseline|sub|super|<svg-length>","baseline-source":"auto|first|last","block-size":"<'width'>",border:"<line-width>||<line-style>||<color>","border-block":"<'border-block-start'>","border-block-color":"<'border-top-color'>{1,2}","border-block-end":"<'border-top-width'>||<'border-top-style'>||<color>","border-block-end-color":"<'border-top-color'>","border-block-end-style":"<'border-top-style'>","border-block-end-width":"<'border-top-width'>","border-block-start":"<'border-top-width'>||<'border-top-style'>||<color>","border-block-start-color":"<'border-top-color'>","border-block-start-style":"<'border-top-style'>","border-block-start-width":"<'border-top-width'>","border-block-style":"<'border-top-style'>{1,2}","border-block-width":"<'border-top-width'>{1,2}","border-bottom":"<line-width>||<line-style>||<color>","border-bottom-color":"<'border-top-color'>","border-bottom-left-radius":"<length-percentage [0,∞]>{1,2}","border-bottom-right-radius":"<length-percentage [0,∞]>{1,2}","border-bottom-style":"<line-style>","border-bottom-width":"<line-width>","border-collapse":"separate|collapse","border-color":"<color>{1,4}","border-end-end-radius":"<'border-top-left-radius'>","border-end-start-radius":"<'border-top-left-radius'>","border-image":"<'border-image-source'>||<'border-image-slice'> [/ <'border-image-width'>|/ <'border-image-width'>? / <'border-image-outset'>]?||<'border-image-repeat'>","border-image-outset":"[<length [0,∞]>|<number [0,∞]>]{1,4}","border-image-repeat":"[stretch|repeat|round|space]{1,2}","border-image-slice":"[<number [0,∞]>|<percentage [0,∞]>]{1,4}&&fill?","border-image-source":"none|<image>","border-image-width":"[<length-percentage [0,∞]>|<number [0,∞]>|auto]{1,4}","border-inline":"<'border-block-start'>","border-inline-color":"<'border-top-color'>{1,2}","border-inline-end":"<'border-top-width'>||<'border-top-style'>||<color>","border-inline-end-color":"<'border-top-color'>","border-inline-end-style":"<'border-top-style'>","border-inline-end-width":"<'border-top-width'>","border-inline-start":"<'border-top-width'>||<'border-top-style'>||<color>","border-inline-start-color":"<'border-top-color'>","border-inline-start-style":"<'border-top-style'>","border-inline-start-width":"<'border-top-width'>","border-inline-style":"<'border-top-style'>{1,2}","border-inline-width":"<'border-top-width'>{1,2}","border-left":"<line-width>||<line-style>||<color>","border-left-color":"<color>","border-left-style":"<line-style>","border-left-width":"<line-width>","border-radius":"<length-percentage [0,∞]>{1,4} [/ <length-percentage [0,∞]>{1,4}]?","border-right":"<line-width>||<line-style>||<color>","border-right-color":"<color>","border-right-style":"<line-style>","border-right-width":"<line-width>","border-spacing":"<length>{1,2}","border-start-end-radius":"<'border-top-left-radius'>","border-start-start-radius":"<'border-top-left-radius'>","border-style":"<line-style>{1,4}","border-top":"<line-width>||<line-style>||<color>","border-top-color":"<color>","border-top-left-radius":"<length-percentage [0,∞]>{1,2}","border-top-right-radius":"<length-percentage [0,∞]>{1,2}","border-top-style":"<line-style>","border-top-width":"<line-width>","border-width":"<line-width>{1,4}",bottom:"auto|<length-percentage>|<anchor()>|<anchor-size()>","box-align":"start|center|end|baseline|stretch","box-decoration-break":"slice|clone","box-direction":"normal|reverse|inherit","box-flex":"<number>","box-flex-group":"<integer>","box-lines":"single|multiple","box-ordinal-group":"<integer>","box-orient":"horizontal|vertical|inline-axis|block-axis|inherit","box-pack":"start|center|end|justify","box-shadow":"none|<shadow>#","box-sizing":"content-box|border-box","break-after":"auto|avoid|always|all|avoid-page|page|left|right|recto|verso|avoid-column|column|avoid-region|region","break-before":"auto|avoid|always|all|avoid-page|page|left|right|recto|verso|avoid-column|column|avoid-region|region","break-inside":"auto|avoid|avoid-page|avoid-column|avoid-region","caption-side":"top|bottom",caret:"<'caret-color'>||<'caret-animation'>||<'caret-shape'>","caret-animation":"auto|manual","caret-color":"auto|<color>","caret-shape":"auto|bar|block|underscore",clear:"none|left|right|both|inline-start|inline-end",clip:"<shape>|auto","clip-path":"<clip-source>|[<basic-shape>||<geometry-box>]|none","clip-rule":"nonzero|evenodd",color:"<color>","color-interpolation-filters":"auto|sRGB|linearRGB","color-scheme":"normal|[light|dark|<custom-ident>]+&&only?","column-count":"<integer>|auto","column-fill":"auto|balance","column-gap":"normal|<length-percentage>","column-height":"auto|<length [0,∞]>","column-rule":"<'column-rule-width'>||<'column-rule-style'>||<'column-rule-color'>","column-rule-color":"<color>","column-rule-style":"<'border-style'>","column-rule-width":"<'border-width'>","column-span":"none|all","column-width":"auto|<length [0,∞]>","column-wrap":"auto|nowrap|wrap",columns:"[<'column-width'>||<'column-count'>] [/ <'column-height'>]?",contain:"none|strict|content|[[size||inline-size]||layout||style||paint]","contain-intrinsic-block-size":"auto? [none|<length>]","contain-intrinsic-height":"auto? [none|<length>]","contain-intrinsic-inline-size":"auto? [none|<length>]","contain-intrinsic-size":"[auto? [none|<length>]]{1,2}","contain-intrinsic-width":"auto? [none|<length>]",container:"<'container-name'> [/ <'container-type'>]?","container-name":"none|<custom-ident>+","container-type":"normal||[size|inline-size]",content:"normal|none|[<content-replacement>|<content-list>] [/ [<string>|<counter>|<attr()>]+]?","content-visibility":"visible|auto|hidden","corner-block-end-shape":"<corner-shape-value>{1,2}","corner-block-start-shape":"<corner-shape-value>{1,2}","corner-bottom-shape":"<corner-shape-value>{1,2}","corner-bottom-left-shape":"<corner-shape-value>","corner-bottom-right-shape":"<corner-shape-value>","corner-end-end-shape":"<corner-shape-value>","corner-end-start-shape":"<corner-shape-value>","corner-inline-end-shape":"<corner-shape-value>{1,2}","corner-inline-start-shape":"<corner-shape-value>{1,2}","corner-left-shape":"<corner-shape-value>{1,2}","corner-right-shape":"<corner-shape-value>{1,2}","corner-shape":"<corner-shape-value>{1,4}","corner-start-start-shape":"<corner-shape-value>","corner-start-end-shape":"<corner-shape-value>","corner-top-shape":"<corner-shape-value>{1,2}","corner-top-left-shape":"<corner-shape-value>","corner-top-right-shape":"<corner-shape-value>","counter-increment":"[<counter-name> <integer>?]+|none","counter-reset":"[<counter-name> <integer>?|<reversed-counter-name> <integer>?]+|none","counter-set":"[<counter-name> <integer>?]+|none",cursor:"[[<url> [<x> <y>]? ,]* [auto|default|none|context-menu|help|pointer|progress|wait|cell|crosshair|text|vertical-text|alias|copy|move|no-drop|not-allowed|e-resize|n-resize|ne-resize|nw-resize|s-resize|se-resize|sw-resize|w-resize|ew-resize|ns-resize|nesw-resize|nwse-resize|col-resize|row-resize|all-scroll|zoom-in|zoom-out|grab|grabbing|hand|-webkit-grab|-webkit-grabbing|-webkit-zoom-in|-webkit-zoom-out|-moz-grab|-moz-grabbing|-moz-zoom-in|-moz-zoom-out]]",cx:"<length>|<percentage>",cy:"<length>|<percentage>",d:"none|path( <string> )",direction:"ltr|rtl",display:"[<display-outside>||<display-inside>]|<display-listitem>|<display-internal>|<display-box>|<display-legacy>|<-non-standard-display>","dominant-baseline":"auto|use-script|no-change|reset-size|ideographic|alphabetic|hanging|mathematical|central|middle|text-after-edge|text-before-edge","dynamic-range-limit":"standard|no-limit|constrained|<dynamic-range-limit-mix()>","empty-cells":"show|hide","field-sizing":"content|fixed",fill:"<paint>","fill-opacity":"<number-zero-one>|<percentage>","fill-rule":"nonzero|evenodd",filter:"none|<filter-value-list>|<-ms-filter-function-list>",flex:"none|[<'flex-grow'> <'flex-shrink'>?||<'flex-basis'>]","flex-basis":"content|<'width'>","flex-direction":"row|row-reverse|column|column-reverse","flex-flow":"<'flex-direction'>||<'flex-wrap'>","flex-grow":"<number>","flex-shrink":"<number>","flex-wrap":"nowrap|wrap|wrap-reverse",float:"left|right|none|inline-start|inline-end","flood-color":"<color>","flood-opacity":"<'opacity'>",font:"[[<'font-style'>||<font-variant-css2>||<'font-weight'>||<font-width-css3>]? <'font-size'> [/ <'line-height'>]? <'font-family'>#]|<system-family-name>|<-non-standard-font>","font-family":"[<family-name>|<generic-family>]#","font-feature-settings":"normal|<feature-tag-value>#","font-kerning":"auto|normal|none","font-language-override":"normal|<string>","font-optical-sizing":"auto|none","font-palette":"normal|light|dark|<palette-identifier>|<palette-mix()>","font-size":"<absolute-size>|<relative-size>|<length-percentage [0,∞]>|math","font-size-adjust":"none|[ex-height|cap-height|ch-width|ic-width|ic-height]? [from-font|<number>]","font-smooth":"auto|never|always|<absolute-size>|<length>","font-stretch":"<font-stretch-absolute>","font-style":"normal|italic|oblique <angle>?","font-synthesis":"none|[weight||style||small-caps||position]","font-synthesis-position":"auto|none","font-synthesis-small-caps":"auto|none","font-synthesis-style":"auto|none","font-synthesis-weight":"auto|none","font-variant":"normal|none|[<common-lig-values>||<discretionary-lig-values>||<historical-lig-values>||<contextual-alt-values>||stylistic( <feature-value-name> )||historical-forms||styleset( <feature-value-name># )||character-variant( <feature-value-name># )||swash( <feature-value-name> )||ornaments( <feature-value-name> )||annotation( <feature-value-name> )||[small-caps|all-small-caps|petite-caps|all-petite-caps|unicase|titling-caps]||<numeric-figure-values>||<numeric-spacing-values>||<numeric-fraction-values>||ordinal||slashed-zero||<east-asian-variant-values>||<east-asian-width-values>||ruby]","font-variant-alternates":"normal|[stylistic( <feature-value-name> )||historical-forms||styleset( <feature-value-name># )||character-variant( <feature-value-name># )||swash( <feature-value-name> )||ornaments( <feature-value-name> )||annotation( <feature-value-name> )]","font-variant-caps":"normal|small-caps|all-small-caps|petite-caps|all-petite-caps|unicase|titling-caps","font-variant-east-asian":"normal|[<east-asian-variant-values>||<east-asian-width-values>||ruby]","font-variant-emoji":"normal|text|emoji|unicode","font-variant-ligatures":"normal|none|[<common-lig-values>||<discretionary-lig-values>||<historical-lig-values>||<contextual-alt-values>]","font-variant-numeric":"normal|[<numeric-figure-values>||<numeric-spacing-values>||<numeric-fraction-values>||ordinal||slashed-zero]","font-variant-position":"normal|sub|super","font-variation-settings":"normal|[<string> <number>]#","font-weight":"<font-weight-absolute>|bolder|lighter","font-width":"normal|<percentage [0,∞]>|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded","forced-color-adjust":"auto|none|preserve-parent-color",gap:"<'row-gap'> <'column-gap'>?",grid:"<'grid-template'>|<'grid-template-rows'> / [auto-flow&&dense?] <'grid-auto-columns'>?|[auto-flow&&dense?] <'grid-auto-rows'>? / <'grid-template-columns'>","grid-area":"<grid-line> [/ <grid-line>]{0,3}","grid-auto-columns":"<track-size>+","grid-auto-flow":"[row|column]||dense","grid-auto-rows":"<track-size>+","grid-column":"<grid-line> [/ <grid-line>]?","grid-column-end":"<grid-line>","grid-column-gap":"<length-percentage>","grid-column-start":"<grid-line>","grid-gap":"<'grid-row-gap'> <'grid-column-gap'>?","grid-row":"<grid-line> [/ <grid-line>]?","grid-row-end":"<grid-line>","grid-row-gap":"<length-percentage>","grid-row-start":"<grid-line>","grid-template":"none|[<'grid-template-rows'> / <'grid-template-columns'>]|[<line-names>? <string> <track-size>? <line-names>?]+ [/ <explicit-track-list>]?","grid-template-areas":"none|<string>+","grid-template-columns":"none|<track-list>|<auto-track-list>|subgrid <line-name-list>?","grid-template-rows":"none|<track-list>|<auto-track-list>|subgrid <line-name-list>?","hanging-punctuation":"none|[first||[force-end|allow-end]||last]",height:"auto|<length-percentage [0,∞]>|min-content|max-content|fit-content|fit-content( <length-percentage [0,∞]> )|<calc-size()>|<anchor-size()>|stretch|<-non-standard-size>","hyphenate-character":"auto|<string>","hyphenate-limit-chars":"[auto|<integer>]{1,3}",hyphens:"none|manual|auto","image-orientation":"from-image|<angle>|[<angle>? flip]","image-rendering":"auto|crisp-edges|pixelated|smooth|optimizeSpeed|optimizeQuality|<-non-standard-image-rendering>","image-resolution":"[from-image||<resolution>]&&snap?","ime-mode":"auto|normal|active|inactive|disabled","initial-letter":"normal|[<number> <integer>?]","initial-letter-align":"[auto|alphabetic|hanging|ideographic]","inline-size":"<'width'>",inset:"<'top'>{1,4}","inset-block":"<'top'>{1,2}","inset-block-end":"<'top'>","inset-block-start":"<'top'>","inset-inline":"<'top'>{1,2}","inset-inline-end":"<'top'>","inset-inline-start":"<'top'>","interpolate-size":"numeric-only|allow-keywords",isolation:"auto|isolate",interactivity:"auto|inert","interest-delay":"<'interest-delay-start'>{1,2}","interest-delay-end":"normal|<time>","interest-delay-start":"normal|<time>","justify-content":"normal|<content-distribution>|<overflow-position>? [<content-position>|left|right]","justify-items":"normal|stretch|<baseline-position>|<overflow-position>? [<self-position>|left|right]|legacy|legacy&&[left|right|center]|anchor-center","justify-self":"auto|normal|stretch|<baseline-position>|<overflow-position>? [<self-position>|left|right]|anchor-center","justify-tracks":"[normal|<content-distribution>|<overflow-position>? [<content-position>|left|right]]#",left:"auto|<length-percentage>|<anchor()>|<anchor-size()>","letter-spacing":"normal|<length-percentage>","lighting-color":"<color>","line-break":"auto|loose|normal|strict|anywhere","line-clamp":"none|<integer>","line-height":"normal|<number>|<length>|<percentage>","line-height-step":"<length>","list-style":"<'list-style-type'>||<'list-style-position'>||<'list-style-image'>","list-style-image":"<image>|none","list-style-position":"inside|outside","list-style-type":"<counter-style>|<string>|none",margin:"<'margin-top'>{1,4}","margin-block":"<'margin-top'>{1,2}","margin-block-end":"<'margin-top'>","margin-block-start":"<'margin-top'>","margin-bottom":"<length-percentage>|auto|<anchor-size()>","margin-inline":"<'margin-top'>{1,2}","margin-inline-end":"<'margin-top'>","margin-inline-start":"<'margin-top'>","margin-left":"<length-percentage>|auto|<anchor-size()>","margin-right":"<length-percentage>|auto|<anchor-size()>","margin-top":"<length-percentage>|auto|<anchor-size()>","margin-trim":"none|in-flow|all",marker:"none|<url>","marker-end":"none|<url>","marker-mid":"none|<url>","marker-start":"none|<url>",mask:"<mask-layer>#","mask-border":"<'mask-border-source'>||<'mask-border-slice'> [/ <'mask-border-width'>? [/ <'mask-border-outset'>]?]?||<'mask-border-repeat'>||<'mask-border-mode'>","mask-border-mode":"luminance|alpha","mask-border-outset":"[<length>|<number>]{1,4}","mask-border-repeat":"[stretch|repeat|round|space]{1,2}","mask-border-slice":"<number-percentage>{1,4} fill?","mask-border-source":"none|<image>","mask-border-width":"[<length-percentage>|<number>|auto]{1,4}","mask-clip":"[<coord-box>|no-clip]#","mask-composite":"<compositing-operator>#","mask-image":"<mask-reference>#","mask-mode":"<masking-mode>#","mask-origin":"<coord-box>#","mask-position":"<position>#","mask-repeat":"<repeat-style>#","mask-size":"<bg-size>#","mask-type":"luminance|alpha","masonry-auto-flow":"[pack|next]||[definite-first|ordered]","math-depth":"auto-add|add( <integer> )|<integer>","math-shift":"normal|compact","math-style":"normal|compact","max-block-size":"<'max-width'>","max-height":"none|<length-percentage [0,∞]>|min-content|max-content|fit-content|fit-content( <length-percentage [0,∞]> )|<calc-size()>|<anchor-size()>|stretch|<-non-standard-size>","max-inline-size":"<'max-width'>","max-lines":"none|<integer>","max-width":"none|<length-percentage [0,∞]>|min-content|max-content|fit-content|fit-content( <length-percentage [0,∞]> )|<calc-size()>|<anchor-size()>|stretch|<-non-standard-size>","min-block-size":"<'min-width'>","min-height":"auto|<length-percentage [0,∞]>|min-content|max-content|fit-content|fit-content( <length-percentage [0,∞]> )|<calc-size()>|<anchor-size()>|stretch|<-non-standard-size>","min-inline-size":"<'min-width'>","min-width":"auto|<length-percentage [0,∞]>|min-content|max-content|fit-content|fit-content( <length-percentage [0,∞]> )|<calc-size()>|<anchor-size()>|stretch|<-non-standard-size>","mix-blend-mode":"<blend-mode>|plus-darker|plus-lighter","object-fit":"fill|contain|cover|none|scale-down","object-position":"<position>","object-view-box":"none|<basic-shape-rect>",offset:"[<'offset-position'>? [<'offset-path'> [<'offset-distance'>||<'offset-rotate'>]?]?]! [/ <'offset-anchor'>]?","offset-anchor":"auto|<position>","offset-distance":"<length-percentage>","offset-path":"none|<offset-path>||<coord-box>","offset-position":"normal|auto|<position>","offset-rotate":"[auto|reverse]||<angle>",opacity:"<opacity-value>",order:"<integer>",orphans:"<integer>",outline:"<'outline-width'>||<'outline-style'>||<'outline-color'>","outline-color":"auto|<color>","outline-offset":"<length>","outline-style":"auto|<outline-line-style>","outline-width":"<line-width>",overflow:"[visible|hidden|clip|scroll|auto]{1,2}|<-non-standard-overflow>","overflow-anchor":"auto|none","overflow-block":"visible|hidden|clip|scroll|auto|<-non-standard-overflow>","overflow-clip-box":"padding-box|content-box","overflow-clip-margin":"<visual-box>||<length [0,∞]>","overflow-inline":"visible|hidden|clip|scroll|auto|<-non-standard-overflow>","overflow-wrap":"normal|break-word|anywhere","overflow-x":"visible|hidden|clip|scroll|auto|<-non-standard-overflow>","overflow-y":"visible|hidden|clip|scroll|auto|<-non-standard-overflow>",overlay:"none|auto","overscroll-behavior":"[contain|none|auto]{1,2}","overscroll-behavior-block":"contain|none|auto","overscroll-behavior-inline":"contain|none|auto","overscroll-behavior-x":"contain|none|auto","overscroll-behavior-y":"contain|none|auto",padding:"<'padding-top'>{1,4}","padding-block":"<'padding-top'>{1,2}","padding-block-end":"<'padding-top'>","padding-block-start":"<'padding-top'>","padding-bottom":"<length-percentage [0,∞]>","padding-inline":"<'padding-top'>{1,2}","padding-inline-end":"<'padding-top'>","padding-inline-start":"<'padding-top'>","padding-left":"<length-percentage [0,∞]>","padding-right":"<length-percentage [0,∞]>","padding-top":"<length-percentage [0,∞]>",page:"auto|<custom-ident>","page-break-after":"auto|always|avoid|left|right|recto|verso","page-break-before":"auto|always|avoid|left|right|recto|verso","page-break-inside":"auto|avoid","paint-order":"normal|[fill||stroke||markers]",perspective:"none|<length>","perspective-origin":"<position>","place-content":"<'align-content'> <'justify-content'>?","place-items":"<'align-items'> <'justify-items'>?","place-self":"<'align-self'> <'justify-self'>?","pointer-events":"auto|none|visiblePainted|visibleFill|visibleStroke|visible|painted|fill|stroke|all|inherit",position:"static|relative|absolute|sticky|fixed|-webkit-sticky","position-anchor":"auto|none|<anchor-name>","position-area":"none|<position-area>","position-try":"<'position-try-order'>? <'position-try-fallbacks'>","position-try-fallbacks":"none|[[<dashed-ident>||<try-tactic>]|<'position-area'>]#","position-try-order":"normal|<try-size>","position-visibility":"always|[anchors-valid||anchors-visible||no-overflow]","print-color-adjust":"economy|exact",quotes:"none|auto|[<string> <string>]+",r:"<length>|<percentage>","reading-flow":"normal|source-order|flex-visual|flex-flow|grid-rows|grid-columns|grid-order","reading-order":"<integer>",resize:"none|both|horizontal|vertical|block|inline",right:"auto|<length-percentage>|<anchor()>|<anchor-size()>",rotate:"none|<angle>|[x|y|z|<number>{3}]&&<angle>","row-gap":"normal|<length-percentage>","ruby-align":"start|center|space-between|space-around","ruby-merge":"separate|collapse|auto","ruby-overhang":"auto|none","ruby-position":"[alternate||[over|under]]|inter-character",rx:"<length>|<percentage>",ry:"<length>|<percentage>",scale:"none|[<number>|<percentage>]{1,3}","scroll-behavior":"auto|smooth","scroll-initial-target":"none|nearest","scroll-margin":"<length>{1,4}","scroll-margin-block":"<length>{1,2}","scroll-margin-block-end":"<length>","scroll-margin-block-start":"<length>","scroll-margin-bottom":"<length>","scroll-margin-inline":"<length>{1,2}","scroll-margin-inline-end":"<length>","scroll-margin-inline-start":"<length>","scroll-margin-left":"<length>","scroll-margin-right":"<length>","scroll-margin-top":"<length>","scroll-marker-group":"none|before|after","scroll-padding":"[auto|<length-percentage>]{1,4}","scroll-padding-block":"[auto|<length-percentage>]{1,2}","scroll-padding-block-end":"auto|<length-percentage>","scroll-padding-block-start":"auto|<length-percentage>","scroll-padding-bottom":"auto|<length-percentage>","scroll-padding-inline":"[auto|<length-percentage>]{1,2}","scroll-padding-inline-end":"auto|<length-percentage>","scroll-padding-inline-start":"auto|<length-percentage>","scroll-padding-left":"auto|<length-percentage>","scroll-padding-right":"auto|<length-percentage>","scroll-padding-top":"auto|<length-percentage>","scroll-snap-align":"[none|start|end|center]{1,2}","scroll-snap-coordinate":"none|<position>#","scroll-snap-destination":"<position>","scroll-snap-points-x":"none|repeat( <length-percentage> )","scroll-snap-points-y":"none|repeat( <length-percentage> )","scroll-snap-stop":"normal|always","scroll-snap-type":"none|[x|y|block|inline|both] [mandatory|proximity]?","scroll-snap-type-x":"none|mandatory|proximity","scroll-snap-type-y":"none|mandatory|proximity","scroll-target-group":"none|auto","scroll-timeline":"[<'scroll-timeline-name'> <'scroll-timeline-axis'>?]#","scroll-timeline-axis":"[block|inline|x|y]#","scroll-timeline-name":"[none|<dashed-ident>]#","scrollbar-color":"auto|<color>{2}","scrollbar-gutter":"auto|stable&&both-edges?","scrollbar-width":"auto|thin|none","shape-image-threshold":"<opacity-value>","shape-margin":"<length-percentage>","shape-outside":"none|[<shape-box>||<basic-shape>]|<image>","shape-rendering":"auto|optimizeSpeed|crispEdges|geometricPrecision","speak-as":"normal|spell-out||digits||[literal-punctuation|no-punctuation]","stop-color":"<'color'>","stop-opacity":"<'opacity'>",stroke:"<paint>","stroke-color":"<color>","stroke-dasharray":"none|[<svg-length>+]#","stroke-dashoffset":"<svg-length>","stroke-linecap":"butt|round|square","stroke-linejoin":"miter|round|bevel","stroke-miterlimit":"<number-one-or-greater>","stroke-opacity":"<'opacity'>","stroke-width":"<svg-length>","tab-size":"<integer>|<length>","table-layout":"auto|fixed","text-align":"start|end|left|right|center|justify|match-parent","text-align-last":"auto|start|end|left|right|center|justify","text-anchor":"start|middle|end","text-autospace":"normal|<autospace>|auto","text-box":"normal|<'text-box-trim'>||<'text-box-edge'>","text-box-edge":"auto|<text-edge>","text-box-trim":"none|trim-start|trim-end|trim-both","text-combine-upright":"none|all|[digits <integer>?]","text-decoration":"<'text-decoration-line'>||<'text-decoration-style'>||<'text-decoration-color'>||<'text-decoration-thickness'>","text-decoration-color":"<color>","text-decoration-inset":"<length>{1,2}|auto","text-decoration-line":"none|[underline||overline||line-through||blink]|spelling-error|grammar-error","text-decoration-skip":"none|[objects||[spaces|[leading-spaces||trailing-spaces]]||edges||box-decoration]","text-decoration-skip-ink":"auto|all|none","text-decoration-style":"solid|double|dotted|dashed|wavy","text-decoration-thickness":"auto|from-font|<length>|<percentage>","text-emphasis":"<'text-emphasis-style'>||<'text-emphasis-color'>","text-emphasis-color":"<color>","text-emphasis-position":"auto|[over|under]&&[right|left]?","text-emphasis-style":"none|[[filled|open]||[dot|circle|double-circle|triangle|sesame]]|<string>","text-indent":"<length-percentage>&&hanging?&&each-line?","text-justify":"auto|inter-character|inter-word|none","text-orientation":"mixed|upright|sideways","text-overflow":"[clip|ellipsis|<string>]{1,2}","text-rendering":"auto|optimizeSpeed|optimizeLegibility|geometricPrecision","text-shadow":"none|<shadow-t>#","text-size-adjust":"none|auto|<percentage>","text-spacing-trim":"space-all|normal|space-first|trim-start","text-transform":"none|[capitalize|uppercase|lowercase]||full-width||full-size-kana|math-auto","text-underline-offset":"auto|<length>|<percentage>","text-underline-position":"auto|from-font|[under||[left|right]]","text-wrap":"<'text-wrap-mode'>||<'text-wrap-style'>","text-wrap-mode":"wrap|nowrap","text-wrap-style":"auto|balance|stable|pretty","timeline-scope":"none|<dashed-ident>#","timeline-trigger":"none|[<'timeline-trigger-name'> <'timeline-trigger-source'> <'timeline-trigger-range'> ['/' <'timeline-trigger-exit-range'>]?]#","timeline-trigger-name":"none|<dashed-ident>#","timeline-trigger-exit-range":"[<'timeline-trigger-exit-range-start'> <'timeline-trigger-exit-range-end'>?]#","timeline-trigger-exit-range-end":"[auto|normal|<length-percentage>|<timeline-range-name> <length-percentage>?]#","timeline-trigger-exit-range-start":"[auto|normal|<length-percentage>|<timeline-range-name> <length-percentage>?]#","timeline-trigger-range":"[<'timeline-trigger-range-start'> <'timeline-trigger-range-end'>?]#","timeline-trigger-range-end":"[normal|<length-percentage>|<timeline-range-name> <length-percentage>?]#","timeline-trigger-range-start":"[normal|<length-percentage>|<timeline-range-name> <length-percentage>?]#","timeline-trigger-source":"<single-animation-timeline>#",top:"auto|<length-percentage>|<anchor()>|<anchor-size()>","touch-action":"auto|none|[[pan-x|pan-left|pan-right]||[pan-y|pan-up|pan-down]||pinch-zoom]|manipulation",transform:"none|<transform-list>","transform-box":"content-box|border-box|fill-box|stroke-box|view-box","transform-origin":"[<length-percentage>|left|center|right|top|bottom]|[[<length-percentage>|left|center|right]&&[<length-percentage>|top|center|bottom]] <length>?","transform-style":"flat|preserve-3d",transition:"<single-transition>#","transition-behavior":"<transition-behavior-value>#","transition-delay":"<time>#","transition-duration":"<time>#","transition-property":"none|<single-transition-property>#","transition-timing-function":"<easing-function>#",translate:"none|<length-percentage> [<length-percentage> <length>?]?","trigger-scope":"none|all|<dashed-ident>#","unicode-bidi":"normal|embed|isolate|bidi-override|isolate-override|plaintext|-moz-isolate|-moz-isolate-override|-moz-plaintext|-webkit-isolate|-webkit-isolate-override|-webkit-plaintext","user-select":"auto|text|none|all","vector-effect":"none|non-scaling-stroke|non-scaling-size|non-rotation|fixed-position","vertical-align":"baseline|sub|super|text-top|text-bottom|middle|top|bottom|<percentage>|<length>","view-timeline":"[<'view-timeline-name'> [<'view-timeline-axis'>||<'view-timeline-inset'>]?]#","view-timeline-axis":"[block|inline|x|y]#","view-timeline-inset":"[[auto|<length-percentage>]{1,2}]#","view-timeline-name":"[none|<dashed-ident>]#","view-transition-class":"none|<custom-ident>+","view-transition-name":"none|<custom-ident>|match-element",visibility:"visible|hidden|collapse","white-space":"normal|pre|pre-wrap|pre-line|<'white-space-collapse'>||<'text-wrap-mode'>","white-space-collapse":"collapse|preserve|preserve-breaks|preserve-spaces|break-spaces",widows:"<integer>",width:"auto|<length-percentage [0,∞]>|min-content|max-content|fit-content|fit-content( <length-percentage [0,∞]> )|<calc-size()>|<anchor-size()>|stretch|<-non-standard-size>","will-change":"auto|<animateable-feature>#","word-break":"normal|break-all|keep-all|break-word|auto-phrase","word-spacing":"normal|<length>","word-wrap":"normal|break-word","writing-mode":"horizontal-tb|vertical-rl|vertical-lr|sideways-rl|sideways-lr|<svg-writing-mode>",x:"<length>|<percentage>",y:"<length>|<percentage>","z-index":"auto|<integer>",zoom:"normal|reset|<number [0,∞]>||<percentage [0,∞]>","-moz-background-clip":"padding|border","-moz-border-radius-bottomleft":"<'border-bottom-left-radius'>","-moz-border-radius-bottomright":"<'border-bottom-right-radius'>","-moz-border-radius-topleft":"<'border-top-left-radius'>","-moz-border-radius-topright":"<'border-bottom-right-radius'>","-moz-control-character-visibility":"visible|hidden","-moz-osx-font-smoothing":"auto|grayscale","-moz-user-select":"none|text|all|-moz-none","-ms-flex-align":"start|end|center|baseline|stretch","-ms-flex-item-align":"auto|start|end|center|baseline|stretch","-ms-flex-line-pack":"start|end|center|justify|distribute|stretch","-ms-flex-negative":"<'flex-shrink'>","-ms-flex-pack":"start|end|center|justify|distribute","-ms-flex-order":"<integer>","-ms-flex-positive":"<'flex-grow'>","-ms-flex-preferred-size":"<'flex-basis'>","-ms-interpolation-mode":"nearest-neighbor|bicubic","-ms-grid-column-align":"start|end|center|stretch","-ms-grid-row-align":"start|end|center|stretch","-ms-hyphenate-limit-last":"none|always|column|page|spread","-webkit-background-clip":"[<visual-box>|border|padding|content|text]#","-webkit-column-break-after":"always|auto|avoid","-webkit-column-break-before":"always|auto|avoid","-webkit-column-break-inside":"always|auto|avoid","-webkit-font-smoothing":"auto|none|antialiased|subpixel-antialiased","-webkit-mask-box-image":"[<url>|<gradient>|none] [<length-percentage>{4} <-webkit-mask-box-repeat>{2}]?","-webkit-print-color-adjust":"economy|exact","-webkit-text-security":"none|circle|disc|square","-webkit-user-drag":"none|element|auto",behavior:"<url>+",cue:"<'cue-before'> <'cue-after'>?","cue-after":"<url> <decibel>?|none","cue-before":"<url> <decibel>?|none","glyph-orientation-horizontal":"<angle>","glyph-orientation-vertical":"<angle>",kerning:"auto|<svg-length>",pause:"<'pause-before'> <'pause-after'>?","pause-after":"<time>|none|x-weak|weak|medium|strong|x-strong","pause-before":"<time>|none|x-weak|weak|medium|strong|x-strong","position-try-options":"<'position-try-fallbacks'>",rest:"<'rest-before'> <'rest-after'>?","rest-after":"<time>|none|x-weak|weak|medium|strong|x-strong","rest-before":"<time>|none|x-weak|weak|medium|strong|x-strong",speak:"auto|never|always","voice-balance":"<number>|left|center|right|leftwards|rightwards","voice-duration":"auto|<time>","voice-family":"[[<family-name>|<generic-voice>] ,]* [<family-name>|<generic-voice>]|preserve","voice-pitch":"<frequency>&&absolute|[[x-low|low|medium|high|x-high]||[<frequency>|<semitones>|<percentage>]]","voice-range":"<frequency>&&absolute|[[x-low|low|medium|high|x-high]||[<frequency>|<semitones>|<percentage>]]","voice-rate":"[normal|x-slow|slow|medium|fast|x-fast]||<percentage>","voice-stress":"normal|strong|moderate|none|reduced","voice-volume":"silent|[[x-soft|soft|medium|loud|x-loud]||<decibel>]","white-space-trim":"none|discard-before||discard-after||discard-inner"},atrules:{charset:{prelude:"<string>",descriptors:null},"counter-style":{prelude:"<counter-style-name>",descriptors:{"additive-symbols":"[<integer [0,∞]>&&<symbol>]#",fallback:"<counter-style-name>",negative:"<symbol> <symbol>?",pad:"<integer [0,∞]>&&<symbol>",prefix:"<symbol>",range:"[[<integer>|infinite]{2}]#|auto","speak-as":"auto|bullets|numbers|words|spell-out|<counter-style-name>",suffix:"<symbol>",symbols:"<symbol>+",system:"cyclic|numeric|alphabetic|symbolic|additive|[fixed <integer>?]|[extends <counter-style-name>]"}},container:{prelude:"[<container-name>]? <container-condition>",descriptors:null},document:{prelude:"[<url>|url-prefix( <string> )|domain( <string> )|media-document( <string> )|regexp( <string> )]#",descriptors:null},"font-face":{prelude:null,descriptors:{"ascent-override":"normal|<percentage>","descent-override":"normal|<percentage>","font-display":"auto|block|swap|fallback|optional","font-family":"<family-name>","font-feature-settings":"normal|<feature-tag-value>#","font-stretch":"<font-stretch-absolute>{1,2}","font-style":"normal|italic|oblique <angle>{0,2}","font-variation-settings":"normal|[<string> <number>]#","font-weight":"<font-weight-absolute>{1,2}","line-gap-override":"normal|<percentage>","size-adjust":"<percentage>",src:"[<url> [format( <string># )]?|local( <family-name> )]#","unicode-range":"<urange>#"}},"font-feature-values":{prelude:"<family-name>#",descriptors:null},"font-palette-values":{prelude:"<dashed-ident>",descriptors:{"base-palette":"light|dark|<integer [0,∞]>","font-family":"<family-name>#","override-colors":"[<integer [0,∞]> <color>]#"}},import:{prelude:"[<string>|<url>] [layer|layer( <layer-name> )]? [supports( [<supports-condition>|<declaration>] )]? <media-query-list>?",descriptors:null},keyframes:{prelude:"<keyframes-name>",descriptors:null},layer:{prelude:"[<layer-name>#|<layer-name>?]",descriptors:null},media:{prelude:"<media-query-list>",descriptors:null},namespace:{prelude:"<namespace-prefix>? [<string>|<url>]",descriptors:null},page:{prelude:"<page-selector-list>",descriptors:{bleed:"auto|<length>",marks:"none|[crop||cross]","page-orientation":"upright|rotate-left|rotate-right",size:"<length [0,∞]>{1,2}|auto|[<page-size>||[portrait|landscape]]"}},"position-try":{prelude:"<dashed-ident>",descriptors:{top:"<'top'>",left:"<'left'>",bottom:"<'bottom'>",right:"<'right'>","inset-block-start":"<'inset-block-start'>","inset-block-end":"<'inset-block-end'>","inset-inline-start":"<'inset-inline-start'>","inset-inline-end":"<'inset-inline-end'>","inset-block":"<'inset-block'>","inset-inline":"<'inset-inline'>",inset:"<'inset'>","margin-top":"<'margin-top'>","margin-left":"<'margin-left'>","margin-bottom":"<'margin-bottom'>","margin-right":"<'margin-right'>","margin-block-start":"<'margin-block-start'>","margin-block-end":"<'margin-block-end'>","margin-inline-start":"<'margin-inline-start'>","margin-inline-end":"<'margin-inline-end'>",margin:"<'margin'>","margin-block":"<'margin-block'>","margin-inline":"<'margin-inline'>",width:"<'width'>",height:"<'height'>","min-width":"<'min-width'>","min-height":"<'min-height'>","max-width":"<'max-width'>","max-height":"<'max-height'>","block-size":"<'block-size'>","inline-size":"<'inline-size'>","min-block-size":"<'min-block-size'>","min-inline-size":"<'min-inline-size'>","max-block-size":"<'max-block-size'>","max-inline-size":"<'max-inline-size'>","align-self":"<'align-self'>|anchor-center","justify-self":"<'justify-self'>|anchor-center"}},property:{prelude:"<custom-property-name>",descriptors:{inherits:"true|false","initial-value":"<declaration-value>?",syntax:"<string>"}},scope:{prelude:"[( <scope-start> )]? [to ( <scope-end> )]?",descriptors:null},"starting-style":{prelude:null,descriptors:null},supports:{prelude:"<supports-condition>",descriptors:null},"view-transition":{prelude:null,descriptors:{navigation:"auto|none",types:"none|<custom-ident>+"}},"font-features-values":{prelude:"[<string>|<custom-ident>]+",descriptors:{"font-display":"auto|block|swap|fallback|optional"}}},node:re};function Fl(e){switch(this.tokenType){case fe:return this.Hash();case Te:return this.Operator();case Le:return this.Parentheses(this.readSequence,e.recognizer);case Oe:return this.Brackets(this.readSequence,e.recognizer);case pe:return this.String();case ke:return this.Dimension();case we:return this.Percentage();case ve:return this.Number();case ue:return this.cmpStr(this.tokenStart,this.tokenEnd,"url(")?this.Url():this.Function(this.readSequence,e.recognizer);case ge:return this.Url();case he:return this.cmpChar(this.tokenStart,117)&&this.cmpChar(this.tokenStart+1,43)?this.UnicodeRange():this.Identifier();case ye:{const e=this.charCodeAt(this.tokenStart);if(47===e||42===e||43===e||45===e)return this.Operator();35===e&&this.error("Hex or identifier is expected",this.tokenStart+1);break}}}const Wl={getNode:Fl},Hl={onWhiteSpace:function(e,t){null!==t.last&&"Combinator"!==t.last.type&&null!==e&&"Combinator"!==e.type&&t.push({type:"Combinator",loc:null,name:" "})},getNode:function(){switch(this.tokenType){case Oe:return this.AttributeSelector();case fe:return this.IdSelector();case Ae:return this.lookupType(1)===Ae?this.PseudoElementSelector():this.PseudoClassSelector();case he:return this.TypeSelector();case ve:case we:return this.Percentage();case ke:46===this.charCodeAt(this.tokenStart)&&this.error("Identifier is expected",this.tokenStart+1);break;case ye:switch(this.charCodeAt(this.tokenStart)){case 43:case 62:case 126:case 47:return this.Combinator();case 46:return this.ClassSelector();case 42:case 124:return this.TypeSelector();case 35:return this.IdSelector();case 38:return this.NestingSelector()}}}};function ql(){return this.createSingleNodeList(this.Raw(null,!1))}function Vl(){const e=this.createList();if(this.skipSC(),e.push(this.Identifier()),this.skipSC(),this.tokenType===Te){e.push(this.Operator());const t=this.tokenIndex,n=this.parseCustomProperty?this.Value(null):this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!1);if("Value"===n.type&&n.children.isEmpty)for(let e=t-this.tokenIndex;e<=0;e++)if(this.lookupType(e)===xe){n.children.appendData({type:"WhiteSpace",loc:null,value:" "});break}e.push(n)}return e}function jl(e){return null!==e&&"Operator"===e.type&&("-"===e.value[e.value.length-1]||"+"===e.value[e.value.length-1])}n.dn(ql),n.dn(Vl);const Kl={getNode:Fl,onWhiteSpace(e,t){jl(e)&&(e.value=" "+e.value),jl(t.last)&&(t.last.value+=" ")},expression:ql,var:Vl},_l=new Set(["none","and","not","or"]),Ul={parse:{prelude(){const e=this.createList();if(this.tokenType===he){const t=this.substring(this.tokenStart,this.tokenEnd);_l.has(t.toLowerCase())||e.push(this.Identifier())}return e.push(this.Condition("container")),e},block(e=!1){return this.Block(e)}}},$l={parse:{prelude:null,block(){return this.Block(!0)}}};function Yl(e,t){return this.parseWithFallback(()=>{try{return e.call(this)}finally{this.skipSC(),this.lookupNonWSType(0)!==ze&&this.error()}},t||(()=>this.Raw(null,!0)))}const Gl={layer(){this.skipSC();const e=this.createList(),t=Yl.call(this,this.Layer);return"Raw"===t.type&&""===t.value||e.push(t),e},supports(){this.skipSC();const e=this.createList(),t=Yl.call(this,this.Declaration,()=>Yl.call(this,()=>this.Condition("supports")));return"Raw"===t.type&&""===t.value||e.push(t),e}},Xl={container:Ul,"font-face":$l,import:{parse:{prelude(){const e=this.createList();switch(this.tokenType){case pe:e.push(this.String());break;case ge:case ue:e.push(this.Url());break;default:this.error("String or url() is expected")}return this.skipSC(),this.tokenType===he&&this.cmpStr(this.tokenStart,this.tokenEnd,"layer")?e.push(this.Identifier()):this.tokenType===ue&&this.cmpStr(this.tokenStart,this.tokenEnd,"layer(")&&e.push(this.Function(null,Gl)),this.skipSC(),this.tokenType===ue&&this.cmpStr(this.tokenStart,this.tokenEnd,"supports(")&&e.push(this.Function(null,Gl)),this.lookupNonWSType(0)!==he&&this.lookupNonWSType(0)!==Le||e.push(this.MediaQueryList()),e},block:null}},layer:{parse:{prelude(){return this.createSingleNodeList(this.LayerList())},block(){return this.Block(!1)}}},media:{parse:{prelude(){return this.createSingleNodeList(this.MediaQueryList())},block(e=!1){return this.Block(e)}}},nest:{parse:{prelude(){return this.createSingleNodeList(this.SelectorList())},block(){return this.Block(!0)}}},page:{parse:{prelude(){return this.createSingleNodeList(this.SelectorList())},block(){return this.Block(!0)}}},scope:{parse:{prelude(){return this.createSingleNodeList(this.Scope())},block(e=!1){return this.Block(e)}}},"starting-style":{parse:{prelude:null,block(e=!1){return this.Block(e)}}},supports:{parse:{prelude(){return this.createSingleNodeList(this.Condition("supports"))},block(e=!1){return this.Block(e)}}}},Jl={parse(){return this.createSingleNodeList(this.SelectorList())}},Zl={parse(){return this.createSingleNodeList(this.Selector())}},Ql={parse(){return this.createSingleNodeList(this.Identifier())}},ec={parse:function(){const e=this.createList();this.skipSC();e:for(;!this.eof;){switch(this.tokenType){case he:e.push(this.Identifier());break;case pe:e.push(this.String());break;case Te:e.push(this.Operator());break;case ze:break e;default:this.error("Identifier, string or comma is expected")}this.skipSC()}return e}},tc={parse(){return this.createSingleNodeList(this.Nth())}},nc={dir:Ql,has:Jl,lang:ec,matches:Jl,is:Jl,"-moz-any":Jl,"-webkit-any":Jl,where:Jl,not:Jl,"nth-child":tc,"nth-last-child":tc,"nth-last-of-type":tc,"nth-of-type":tc,slotted:Zl,host:Zl,"host-context":Zl},ic=tr({...Nl,parseContext:{default:"StyleSheet",stylesheet:"StyleSheet",atrule:"Atrule",atrulePrelude(e){return this.AtrulePrelude(e.atrule?String(e.atrule):null)},mediaQueryList:"MediaQueryList",mediaQuery:"MediaQuery",condition(e){return this.Condition(e.kind)},rule:"Rule",selectorList:"SelectorList",selector:"Selector",block(){return this.Block(!0)},declarationList:"DeclarationList",declaration:"Declaration",value:"Value"},features:{supports:{selector(){return this.Selector()}},container:{style(){return this.Declaration()}}},scope:oe,atrule:Xl,pseudo:nc,node:se,node:re});function rc(e){const t={};for(const n of Object.keys(e)){let i=e[n];i&&(Array.isArray(i)||i instanceof lt?i=i.map(rc):i.constructor===Object&&(i=rc(i))),t[n]=i}return t}function oc(e){const t=e.length-1;let n="";for(let i=0;i<e.length;i++){let r=e.charCodeAt(i);if(92===r){if(i===t)break;if(r=e.charCodeAt(++i),je(92,r)){const t=i-1,r=tt(e,t);i=r-1,n+=ot(e.substring(t+1,r))}else 13===r&&10===e.charCodeAt(i+1)&&i++}else n+=e[i]}return n}function sc(e){let t="";if(1===e.length&&45===e.charCodeAt(0))return"\\-";for(let n=0;n<e.length;n++){const i=e.charCodeAt(n);0!==i?i<=31||127===i||i>=48&&i<=57&&(0===n||1===n&&45===e.charCodeAt(0))?t+="\\"+i.toString(16)+" ":We(i)?t+=e.charAt(n):t+="\\"+e.charAt(n):t+="�"}return t}const{tokenize:ac,parse:lc,generate:cc,lexer:hc,createLexer:uc,walk:dc,find:fc,findLast:pc,findAll:mc,toPlainObject:gc,fromPlainObject:bc,fork:yc}=ic}}]); |