iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 58.6 kB
JavaScript
export const __webpack_ids__=["51403"];export const __webpack_modules__={35709:function(t,e,i){var n=i(27847),s=i(72309),o=i(13465).f,r=n("unscopables"),l=Array.prototype;void 0===l[r]&&o(l,r,{configurable:!0,value:s(null)}),t.exports=function(t){l[r][t]=!0}},17743:function(t,e,i){var n=i(13053);t.exports=function(t,e,i){for(var s=0,o=arguments.length>2?i:n(e),r=new t(o);o>s;)r[s]=e[s++];return r}},37595:function(t,e,i){var n=i(31269),s=i(72878),o=i(25091),r=i(12360),l=i(70273),a=i(13053),c=i(72309),h=i(17743),u=Array,f=s([].push);t.exports=function(t,e,i,s){for(var p,d,m,g=r(t),v=o(g),b=n(e,i),y=c(null),x=a(v),w=0;x>w;w++)m=v[w],(d=l(b(m,w,g)))in y?f(y[d],m):y[d]=[m];if(s&&(p=s(g))!==u)for(d in y)y[d]=h(p,y[d]);return y}},31126:function(t,e,i){var n=i(71998);t.exports=function(){var t=n(this),e="";return t.hasIndices&&(e+="d"),t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.unicodeSets&&(e+="v"),t.sticky&&(e+="y"),e}},68107:function(t,e,i){var n=i(40810),s=i(73994),o=i(63983),r=i(71998),l=i(4576);n({target:"Iterator",proto:!0,real:!0},{every:function(t){r(this),o(t);var e=l(this),i=0;return!s(e,(function(e,n){if(!t(e,i++))return n()}),{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},32517:function(t,e,i){var n=i(1569),s=i(85779),o=i(27803),r=i(31126),l=i(29660),a=n.RegExp,c=a.prototype;s&&l((function(){var t=!0;try{a(".","d")}catch(e){t=!1}var e={},i="",n=t?"dgimsy":"gimsy",s=function(t,n){Object.defineProperty(e,t,{get:function(){return i+=n,!0}})},o={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var r in t&&(o.hasIndices="d"),o)s(r,o[r]);return Object.getOwnPropertyDescriptor(c,"flags").get.call(e)!==n||i!==n}))&&o(c,"flags",{configurable:!0,get:r})},22139:function(t,e,i){var n=i(40810),s=i(37595),o=i(35709);n({target:"Array",proto:!0},{group:function(t){return s(this,t,arguments.length>1?arguments[1]:void 0)}}),o("group")},14688:function(t,e,i){i.d(e,{ys:()=>Z});i(92745),i(9359),i(68107),i(56475),i(1331),i(70104),i(48136),i(52924),i(32517);var n=i(89276),s=i(76641),o=i(51801);class r{constructor(t,e,i,n){this.state=t,this.pos=e,this.explicit=i,this.view=n,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(t){let e=(0,o.qz)(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),i=Math.max(e.from,this.pos-250),n=e.text.slice(i-e.from,this.pos-e.from),s=n.search(u(t,!1));return s<0?null:{from:i+s,to:this.pos,text:n.slice(s)}}get aborted(){return null==this.abortListeners}addEventListener(t,e,i){"abort"==t&&this.abortListeners&&(this.abortListeners.push(e),i&&i.onDocChange&&(this.abortOnDocChange=!0))}}function l(t){let e=Object.keys(t).join(""),i=/\w/.test(e);return i&&(e=e.replace(/\w/g,"")),`[${i?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function a(t){let e=t.map((t=>"string"==typeof t?{label:t}:t)),[i,n]=e.every((t=>/^\w+$/.test(t.label)))?[/\w*$/,/\w+$/]:function(t){let e=Object.create(null),i=Object.create(null);for(let{label:n}of t){e[n[0]]=!0;for(let t=1;t<n.length;t++)i[n[t]]=!0}let n=l(e)+l(i)+"*$";return[new RegExp("^"+n),new RegExp(n)]}(e);return t=>{let s=t.matchBefore(n);return s||t.explicit?{from:s?s.from:t.pos,options:e,validFor:i}:null}}class c{constructor(t,e,i,n){this.completion=t,this.source=e,this.match=i,this.score=n}}function h(t){return t.selection.main.from}function u(t,e){var i;let{source:n}=t,s=e&&"^"!=n[0],o="$"!=n[n.length-1];return s||o?new RegExp(`${s?"^":""}(?:${n})${o?"$":""}`,null!==(i=t.flags)&&void 0!==i?i:t.ignoreCase?"i":""):t}const f=n.q6.define();const p=new WeakMap;function d(t){if(!Array.isArray(t))return t;let e=p.get(t);return e||p.set(t,e=a(t)),e}const m=n.Py.define(),g=n.Py.define();class v{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let e=0;e<t.length;){let i=(0,n.gm)(t,e),s=(0,n.nZ)(i);this.chars.push(i);let o=t.slice(e,e+s),r=o.toUpperCase();this.folded.push((0,n.gm)(r==o?o.toLowerCase():r,0)),e+=s}this.astral=t.length!=this.chars.length}ret(t,e){return this.score=t,this.matched=e,this}match(t){if(0==this.pattern.length)return this.ret(-100,[]);if(t.length<this.pattern.length)return null;let{chars:e,folded:i,any:s,precise:o,byWord:r}=this;if(1==e.length){let s=(0,n.gm)(t,0),o=(0,n.nZ)(s),r=o==t.length?0:-100;if(s==e[0]);else{if(s!=i[0])return null;r+=-200}return this.ret(r,[0,o])}let l=t.indexOf(this.pattern);if(0==l)return this.ret(t.length==this.pattern.length?0:-100,[0,this.pattern.length]);let a=e.length,c=0;if(l<0){for(let o=0,r=Math.min(t.length,200);o<r&&c<a;){let r=(0,n.gm)(t,o);r!=e[c]&&r!=i[c]||(s[c++]=o),o+=(0,n.nZ)(r)}if(c<a)return null}let h=0,u=0,f=!1,p=0,d=-1,m=-1,g=/[a-z]/.test(t),v=!0;for(let s=0,c=Math.min(t.length,200),b=0;s<c&&u<a;){let c=(0,n.gm)(t,s);l<0&&(h<a&&c==e[h]&&(o[h++]=s),p<a&&(c==e[p]||c==i[p]?(0==p&&(d=s),m=s+1,p++):p=0));let y,x=c<255?c>=48&&c<=57||c>=97&&c<=122?2:c>=65&&c<=90?1:0:(y=(0,n.bg)(c))!=y.toLowerCase()?1:y!=y.toUpperCase()?2:0;(!s||1==x&&g||0==b&&0!=x)&&(e[u]==c||i[u]==c&&(f=!0)?r[u++]=s:r.length&&(v=!1)),b=x,s+=(0,n.nZ)(c)}return u==a&&0==r[0]&&v?this.result((f?-200:0)-100,r,t):p==a&&0==d?this.ret(-200-t.length+(m==t.length?0:-100),[0,m]):l>-1?this.ret(-700-t.length,[l,l+this.pattern.length]):p==a?this.ret(-900-t.length,[d,m]):u==a?this.result((f?-200:0)-100-700+(v?0:-1100),r,t):2==e.length?null:this.result((s[0]?-700:0)-200-1100,s,t)}result(t,e,i){let s=[],o=0;for(let t of e){let e=t+(this.astral?(0,n.nZ)((0,n.gm)(i,t)):1);o&&s[o-1]==t?s[o-1]=e:(s[o++]=t,s[o++]=e)}return this.ret(t-i.length,s)}}class b{constructor(t){this.pattern=t,this.matched=[],this.score=0,this.folded=t.toLowerCase()}match(t){if(t.length<this.pattern.length)return null;let e=t.slice(0,this.pattern.length),i=e==this.pattern?0:e.toLowerCase()==this.folded?-200:null;return null==i?null:(this.matched=[0,e.length],this.score=i+(t.length==this.pattern.length?0:-100),this)}}const y=n.r$.define({combine:t=>(0,n.BO)(t,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:w,filterStrict:!1,compareCompletions:(t,e)=>t.label.localeCompare(e.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>i=>x(t(i),e(i)),optionClass:(t,e)=>i=>x(t(i),e(i)),addToOptions:(t,e)=>t.concat(e),filterStrict:(t,e)=>t||e})});function x(t,e){return t?e?t+" "+e:t:e}function w(t,e,i,n,o,r){let l,a,c=t.textDirection==s.Nm.RTL,h=c,u=!1,f="top",p=e.left-o.left,d=o.right-e.right,m=n.right-n.left,g=n.bottom-n.top;if(h&&p<Math.min(m,d)?h=!1:!h&&d<Math.min(m,p)&&(h=!0),m<=(h?p:d))l=Math.max(o.top,Math.min(i.top,o.bottom-g))-e.top,a=Math.min(400,h?p:d);else{u=!0,a=Math.min(400,(c?e.right:o.right-e.left)-30);let t=o.bottom-e.bottom;t>=g||t>e.top?l=i.bottom-e.top:(f="bottom",l=e.bottom-i.top)}return{style:`${f}: ${l/((e.bottom-e.top)/r.offsetHeight)}px; max-width: ${a/((e.right-e.left)/r.offsetWidth)}px`,class:"cm-completionInfo-"+(u?c?"left-narrow":"right-narrow":h?"left":"right")}}function k(t,e,i){if(t<=i)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let t=Math.floor(e/i);return{from:t*i,to:(t+1)*i}}let n=Math.floor((t-e)/i);return{from:t-(n+1)*i,to:t-n*i}}class C{constructor(t,e,i){this.view=t,this.stateField=e,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:t=>this.placeInfo(t),key:this},this.space=null,this.currentClass="";let n=t.state.field(e),{options:s,selected:o}=n.open,r=t.state.facet(y);this.optionContent=function(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(t){let e=document.createElement("div");return e.classList.add("cm-completionIcon"),t.type&&e.classList.add(...t.type.split(/\s+/g).map((t=>"cm-completionIcon-"+t))),e.setAttribute("aria-hidden","true"),e},position:20}),e.push({render(t,e,i,n){let s=document.createElement("span");s.className="cm-completionLabel";let o=t.displayLabel||t.label,r=0;for(let t=0;t<n.length;){let e=n[t++],i=n[t++];e>r&&s.appendChild(document.createTextNode(o.slice(r,e)));let l=s.appendChild(document.createElement("span"));l.appendChild(document.createTextNode(o.slice(e,i))),l.className="cm-completionMatchedText",r=i}return r<o.length&&s.appendChild(document.createTextNode(o.slice(r))),s},position:50},{render(t){if(!t.detail)return null;let e=document.createElement("span");return e.className="cm-completionDetail",e.textContent=t.detail,e},position:80}),e.sort(((t,e)=>t.position-e.position)).map((t=>t.render))}(r),this.optionClass=r.optionClass,this.tooltipClass=r.tooltipClass,this.range=k(s.length,o,r.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",(i=>{let{options:n}=t.state.field(e).open;for(let e,s=i.target;s&&s!=this.dom;s=s.parentNode)if("LI"==s.nodeName&&(e=/-(\d+)$/.exec(s.id))&&+e[1]<n.length)return this.applyCompletion(t,n[+e[1]]),void i.preventDefault()})),this.dom.addEventListener("focusout",(e=>{let i=t.state.field(this.stateField,!1);i&&i.tooltip&&t.state.facet(y).closeOnBlur&&e.relatedTarget!=t.contentDOM&&t.dispatch({effects:g.of(null)})})),this.showOptions(s,n.id)}mount(){this.updateSel()}showOptions(t,e){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t,e,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}update(t){var e;let i=t.state.field(this.stateField),n=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),i!=n){let{options:s,selected:o,disabled:r}=i.open;n.open&&n.open.options==s||(this.range=k(s.length,o,t.state.facet(y).maxRenderedOptions),this.showOptions(s,i.id)),this.updateSel(),r!=(null===(e=n.open)||void 0===e?void 0:e.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!r)}}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let t of this.currentClass.split(" "))t&&this.dom.classList.remove(t);for(let t of e.split(" "))t&&this.dom.classList.add(t);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected<this.range.from||e.selected>=this.range.to)&&(this.range=k(e.options.length,e.selected,this.view.state.facet(y).maxRenderedOptions),this.showOptions(e.options,t.id)),this.updateSelectedOption(e.selected)){this.destroyInfo();let{completion:i}=e.options[e.selected],{info:n}=i;if(!n)return;let o="string"==typeof n?document.createTextNode(n):n(i);if(!o)return;"then"in o?o.then((e=>{e&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(e,i)})).catch((t=>(0,s.OO)(this.view.state,t,"completion info"))):this.addInfoPane(o,i)}}addInfoPane(t,e){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",null!=t.nodeType)i.appendChild(t),this.infoDestroy=null;else{let{dom:e,destroy:n}=t;i.appendChild(e),this.infoDestroy=n||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let i=this.list.firstChild,n=this.range.from;i;i=i.nextSibling,n++)"LI"==i.nodeName&&i.id?n==t?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),e=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected"):n--;return e&&function(t,e){let i=t.getBoundingClientRect(),n=e.getBoundingClientRect(),s=i.height/t.offsetHeight;n.top<i.top?t.scrollTop-=(i.top-n.top)/s:n.bottom>i.bottom&&(t.scrollTop+=(n.bottom-i.bottom)/s)}(this.list,e),e}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),n=t.getBoundingClientRect(),s=this.space;if(!s){let t=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:t.clientWidth,bottom:t.clientHeight}}return n.top>Math.min(s.bottom,e.bottom)-10||n.bottom<Math.max(s.top,e.top)+10?null:this.view.state.facet(y).positionInfo(this.view,e,n,i,s,this.dom)}placeInfo(t){this.info&&(t?(t.style&&(this.info.style.cssText=t.style),this.info.className="cm-tooltip cm-completionInfo "+(t.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(t,e,i){const n=document.createElement("ul");n.id=e,n.setAttribute("role","listbox"),n.setAttribute("aria-expanded","true"),n.setAttribute("aria-label",this.view.state.phrase("Completions")),n.addEventListener("mousedown",(t=>{t.target==n&&t.preventDefault()}));let s=null;for(let o=i.from;o<i.to;o++){let{completion:r,match:l}=t[o],{section:a}=r;if(a){let t="string"==typeof a?a:a.name;if(t!=s&&(o>i.from||0==i.from))if(s=t,"string"!=typeof a&&a.header)n.appendChild(a.header(a));else{n.appendChild(document.createElement("completion-section")).textContent=t}}const c=n.appendChild(document.createElement("li"));c.id=e+"-"+o,c.setAttribute("role","option");let h=this.optionClass(r);h&&(c.className=h);for(let t of this.optionContent){let e=t(r,this.view.state,this.view,l);e&&c.appendChild(e)}}return i.from&&n.classList.add("cm-completionListIncompleteTop"),i.to<t.length&&n.classList.add("cm-completionListIncompleteBottom"),n}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function S(t,e){return i=>new C(i,t,e)}function M(t){return 100*(t.boost||0)+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}class L{constructor(t,e,i,n,s,o){this.options=t,this.attrs=e,this.tooltip=i,this.timestamp=n,this.selected=s,this.disabled=o}setSelected(t,e){return t==this.selected||t>=this.options.length?this:new L(this.options,I(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,i,n,s,o){if(n&&!o&&t.some((t=>t.isPending)))return n.setDisabled();let r=function(t,e){let i=[],n=null,s=t=>{i.push(t);let{section:e}=t.completion;if(e){n||(n=[]);let t="string"==typeof e?e:e.name;n.some((e=>e.name==t))||n.push("string"==typeof e?{name:t}:e)}},o=e.facet(y);for(let n of t)if(n.hasResult()){let t=n.result.getMatch;if(!1===n.result.filter)for(let e of n.result.options)s(new c(e,n.source,t?t(e):[],1e9-i.length));else{let i,r=e.sliceDoc(n.from,n.to),l=o.filterStrict?new b(r):new v(r);for(let e of n.result.options)if(i=l.match(e.label)){let o=e.displayLabel?t?t(e,i.matched):[]:i.matched;s(new c(e,n.source,o,i.score+(e.boost||0)))}}}if(n){let t=Object.create(null),e=0,s=(t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:1e9)-(null!==(n=e.rank)&&void 0!==n?n:1e9)||(t.name<e.name?-1:1)};for(let i of n.sort(s))e-=1e5,t[i.name]=e;for(let e of i){let{section:i}=e.completion;i&&(e.score+=t["string"==typeof i?i:i.name])}}let r=[],l=null,a=o.compareCompletions;for(let t of i.sort(((t,e)=>e.score-t.score||a(t.completion,e.completion)))){let e=t.completion;!l||l.label!=e.label||l.detail!=e.detail||null!=l.type&&null!=e.type&&l.type!=e.type||l.apply!=e.apply||l.boost!=e.boost?r.push(t):M(t.completion)>M(l)&&(r[r.length-1]=t),l=t.completion}return r}(t,e);if(!r.length)return n&&t.some((t=>t.isPending))?n.setDisabled():null;let l=e.facet(y).selectOnOpen?0:-1;if(n&&n.selected!=l&&-1!=n.selected){let t=n.options[n.selected].completion;for(let e=0;e<r.length;e++)if(r[e].completion==t){l=e;break}}return new L(r,I(i,l),{pos:t.reduce(((t,e)=>e.hasResult()?Math.min(t,e.from):t),1e8),create:j,above:s.aboveCursor},n?n.timestamp:Date.now(),l,!1)}map(t){return new L(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}setDisabled(){return new L(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class D{constructor(t,e,i){this.active=t,this.id=e,this.open=i}static start(){return new D(O,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(t){let{state:e}=t,i=e.facet(y),n=(i.override||e.languageDataAt("autocomplete",h(e)).map(d)).map((e=>(this.active.find((t=>t.source==e))||new R(e,this.active.some((t=>0!=t.state))?1:0)).update(t,i)));n.length==this.active.length&&n.every(((t,e)=>t==this.active[e]))&&(n=this.active);let s=this.open,o=t.effects.some((t=>t.is(W)));s&&t.docChanged&&(s=s.map(t.changes)),t.selection||n.some((e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to)))||!function(t,e){if(t==e)return!0;for(let i=0,n=0;;){for(;i<t.length&&!t[i].hasResult();)i++;for(;n<e.length&&!e[n].hasResult();)n++;let s=i==t.length,o=n==e.length;if(s||o)return s==o;if(t[i++].result!=e[n++].result)return!1}}(n,this.active)||o?s=L.build(n,e,this.id,s,i,o):s&&s.disabled&&!n.some((t=>t.isPending))&&(s=null),!s&&n.every((t=>!t.isPending))&&n.some((t=>t.hasResult()))&&(n=n.map((t=>t.hasResult()?new R(t.source,0):t)));for(let e of t.effects)e.is(q)&&(s=s&&s.setSelected(e.value,this.id));return n==this.active&&s==this.open?this:new D(n,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?T:A}}const T={"aria-autocomplete":"list"},A={};function I(t,e){let i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(i["aria-activedescendant"]=t+"-"+e),i}const O=[];function E(t,e){if(t.isUserEvent("input.complete")){let i=t.annotation(f);if(i&&e.activateOnCompletion(i))return 12}let i=t.isUserEvent("input.type");return i&&e.activateOnTyping?5:i?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class R{constructor(t,e,i=!1){this.source=t,this.state=e,this.explicit=i}hasResult(){return!1}get isPending(){return 1==this.state}update(t,e){let i=E(t,e),n=this;(8&i||16&i&&this.touches(t))&&(n=new R(n.source,0)),4&i&&0==n.state&&(n=new R(this.source,1)),n=n.updateFor(t,i);for(let e of t.effects)if(e.is(m))n=new R(n.source,1,e.value);else if(e.is(g))n=new R(n.source,0);else if(e.is(W))for(let t of e.value)t.source==n.source&&(n=t);return n}updateFor(t,e){return this.map(t.changes)}map(t){return this}touches(t){return t.changes.touchesRange(h(t.state))}}class P extends R{constructor(t,e,i,n,s,o){super(t,3,e),this.limit=i,this.result=n,this.from=s,this.to=o}hasResult(){return!0}updateFor(t,e){var i;if(!(3&e))return this.map(t.changes);let n=this.result;n.map&&!t.changes.empty&&(n=n.map(n,t.changes));let s=t.changes.mapPos(this.from),o=t.changes.mapPos(this.to,1),l=h(t.state);if(l>o||!n||2&e&&(h(t.startState)==this.from||l<this.limit))return new R(this.source,4&e?1:0);let a=t.changes.mapPos(this.limit);return function(t,e,i,n){if(!t)return!1;let s=e.sliceDoc(i,n);return"function"==typeof t?t(s,i,n,e):u(t,!0).test(s)}(n.validFor,t.state,s,o)?new P(this.source,this.explicit,a,n,s,o):n.update&&(n=n.update(n,s,o,new r(t.state,l,!1)))?new P(this.source,this.explicit,a,n,n.from,null!==(i=n.to)&&void 0!==i?i:h(t.state)):new R(this.source,1,this.explicit)}map(t){if(t.empty)return this;return(this.result.map?this.result.map(this.result,t):this.result)?new P(this.source,this.explicit,t.mapPos(this.limit),this.result,t.mapPos(this.from),t.mapPos(this.to,1)):new R(this.source,0)}touches(t){return t.changes.touchesRange(this.from,this.to)}}const W=n.Py.define({map:(t,e)=>t.map((t=>t.map(e)))}),q=n.Py.define(),F=n.QQ.define({create:()=>D.start(),update:(t,e)=>t.update(e),provide:t=>[s.hJ.from(t,(t=>t.tooltip)),s.tk.contentAttributes.from(t,(t=>t.attrs))]});function $(t,e){const i=e.completion.apply||e.completion.label;let s=t.state.field(F).active.find((t=>t.source==e.source));return s instanceof P&&("string"==typeof i?t.dispatch(Object.assign(Object.assign({},function(t,e,i,s){let{main:o}=t.selection,r=i-o.from,l=s-o.from;return Object.assign(Object.assign({},t.changeByRange((a=>{if(a!=o&&i!=s&&t.sliceDoc(a.from+r,a.from+l)!=t.sliceDoc(i,s))return{range:a};let c=t.toText(e);return{changes:{from:a.from+r,to:s==o.from?a.to:a.from+l,insert:c},range:n.jT.cursor(a.from+r+c.length)}}))),{scrollIntoView:!0,userEvent:"input.complete"})}(t.state,i,s.from,s.to)),{annotations:f.of(e.completion)})):i(t,e.completion,s.from,s.to),!0)}const j=S(F,$);function B(t,e="option"){return i=>{let n=i.state.field(F,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<i.state.facet(y).interactionDelay)return!1;let o,r=1;"page"==e&&(o=(0,s.gB)(i,n.open.tooltip))&&(r=Math.max(2,Math.floor(o.dom.offsetHeight/o.dom.querySelector("li").offsetHeight)-1));let{length:l}=n.open.options,a=n.open.selected>-1?n.open.selected+r*(t?1:-1):t?0:l-1;return a<0?a="page"==e?0:l-1:a>=l&&(a="page"==e?l-1:0),i.dispatch({effects:q.of(a)}),!0}}const N=t=>!!t.state.field(F,!1)&&(t.dispatch({effects:m.of(!0)}),!0);class z{constructor(t,e){this.active=t,this.context=e,this.time=Date.now(),this.updates=[],this.done=void 0}}const _=s.lg.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(F).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(F),i=t.state.facet(y);if(!t.selectionSet&&!t.docChanged&&t.startState.field(F)==e)return;let n=t.transactions.some((t=>{let e=E(t,i);return 8&e||(t.selection||t.docChanged)&&!(3&e)}));for(let e=0;e<this.running.length;e++){let i=this.running[e];if(n||i.context.abortOnDocChange&&t.docChanged||i.updates.length+t.transactions.length>50&&Date.now()-i.time>1e3){for(let t of i.context.abortListeners)try{t()}catch(t){(0,s.OO)(this.view.state,t)}i.context.abortListeners=null,this.running.splice(e--,1)}else i.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some((t=>t.effects.some((t=>t.is(m)))))&&(this.pendingStart=!0);let o=this.pendingStart?50:i.activateOnTypingDelay;if(this.debounceUpdate=e.active.some((t=>t.isPending&&!this.running.some((e=>e.active.source==t.source))))?setTimeout((()=>this.startUpdate()),o):-1,0!=this.composing)for(let e of t.transactions)e.isUserEvent("input.type")?this.composing=2:2==this.composing&&e.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(F);for(let t of e.active)t.isPending&&!this.running.some((e=>e.active.source==t.source))&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout((()=>this.accept()),this.view.state.facet(y).updateSyncTime))}startQuery(t){let{state:e}=this.view,i=h(e),n=new r(e,i,t.explicit,this.view),o=new z(t,n);this.running.push(o),Promise.resolve(t.source(n)).then((t=>{o.context.aborted||(o.done=t||null,this.scheduleAccept())}),(t=>{this.view.dispatch({effects:g.of(null)}),(0,s.OO)(this.view.state,t)}))}scheduleAccept(){this.running.every((t=>void 0!==t.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),this.view.state.facet(y).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],i=this.view.state.facet(y),n=this.view.state.field(F);for(let s=0;s<this.running.length;s++){let o=this.running[s];if(void 0===o.done)continue;if(this.running.splice(s--,1),o.done){let n=h(o.updates.length?o.updates[0].startState:this.view.state),s=Math.min(n,o.done.from+(o.active.explicit?0:1)),r=new P(o.active.source,o.active.explicit,s,o.done,o.done.from,null!==(t=o.done.to)&&void 0!==t?t:n);for(let t of o.updates)r=r.update(t,i);if(r.hasResult()){e.push(r);continue}}let r=n.active.find((t=>t.source==o.active.source));if(r&&r.isPending)if(null==o.done){let t=new R(o.active.source,0);for(let e of o.updates)t=t.update(e,i);t.isPending||e.push(t)}else this.startQuery(r)}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:W.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(F,!1);if(e&&e.tooltip&&this.view.state.facet(y).closeOnBlur){let i=e.open&&(0,s.gB)(this.view,e.open.tooltip);i&&i.dom.contains(t.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}}}),U="object"==typeof navigator&&/Win/.test(navigator.platform),Q=n.Wl.highest(s.tk.domEventHandlers({keydown(t,e){let i=e.state.field(F,!1);if(!i||!i.open||i.open.disabled||i.open.selected<0||t.key.length>1||t.ctrlKey&&(!U||!t.altKey)||t.metaKey)return!1;let n=i.open.options[i.open.selected],s=i.active.find((t=>t.source==n.source)),o=n.completion.commitCharacters||s.result.commitCharacters;return o&&o.indexOf(t.key)>-1&&$(e,n),!1}})),H=s.tk.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",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"}}});const K=new class extends n.uU{};K.startSide=1,K.endSide=-1;"object"==typeof navigator&&navigator.userAgent;function Z(t={}){return[Q,F,y.of(t),_,G,H]}const V=[{key:"Ctrl-Space",run:N},{mac:"Alt-`",run:N},{key:"Escape",run:t=>{let e=t.state.field(F,!1);return!(!e||!e.active.some((t=>0!=t.state)))&&(t.dispatch({effects:g.of(null)}),!0)}},{key:"ArrowDown",run:B(!0)},{key:"ArrowUp",run:B(!1)},{key:"PageDown",run:B(!0,"page")},{key:"PageUp",run:B(!1,"page")},{key:"Enter",run:t=>{let e=t.state.field(F,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(y).interactionDelay)&&$(t,e.open.options[e.open.selected])}}],G=n.Wl.highest(s.$f.computeN([y],(t=>t.facet(y).defaultKeymap?[V]:[])))},3191:function(t,e,i){i.d(e,{b:()=>c});var n=["and","as","block","endblock","by","cycle","debug","else","elif","extends","filter","endfilter","firstof","do","for","endfor","if","endif","ifchanged","endifchanged","ifequal","endifequal","ifnotequal","set","raw","endraw","endifnotequal","in","include","load","not","now","or","parsed","regroup","reversed","spaceless","call","endcall","macro","endmacro","endspaceless","ssi","templatetag","openblock","closeblock","openvariable","closevariable","without","context","openbrace","closebrace","opencomment","closecomment","widthratio","url","with","endwith","get_current_language","trans","endtrans","noop","blocktrans","endblocktrans","get_available_languages","get_current_language_bidi","pluralize","autoescape","endautoescape"],s=/^[+\-*&%=<>!?|~^]/,o=/^[:\[\(\{]/,r=["true","false"],l=/^(\d[+\-\*\/])?\d+(\.\d+)?/;function a(t,e){var i=t.peek();if(e.incomment)return t.skipTo("#}")?(t.eatWhile(/\#|}/),e.incomment=!1):t.skipToEnd(),"comment";if(e.intag){if(e.operator){if(e.operator=!1,t.match(r))return"atom";if(t.match(l))return"number"}if(e.sign){if(e.sign=!1,t.match(r))return"atom";if(t.match(l))return"number"}if(e.instring)return i==e.instring&&(e.instring=!1),t.next(),"string";if("'"==i||'"'==i)return e.instring=i,t.next(),"string";if(e.inbraces>0&&")"==i)t.next(),e.inbraces--;else if("("==i)t.next(),e.inbraces++;else if(e.inbrackets>0&&"]"==i)t.next(),e.inbrackets--;else if("["==i)t.next(),e.inbrackets++;else{if(!e.lineTag&&(t.match(e.intag+"}")||t.eat("-")&&t.match(e.intag+"}")))return e.intag=!1,"tag";if(t.match(s))return e.operator=!0,"operator";if(t.match(o))e.sign=!0;else{if(1==t.column()&&e.lineTag&&t.match(n))return"keyword";if(t.eat(" ")||t.sol()){if(t.match(n))return"keyword";if(t.match(r))return"atom";if(t.match(l))return"number";t.sol()&&t.next()}else t.next()}}return"variable"}if(t.eat("{")){if(t.eat("#"))return e.incomment=!0,t.skipTo("#}")?(t.eatWhile(/\#|}/),e.incomment=!1):t.skipToEnd(),"comment";if(i=t.eat(/\{|%/))return e.intag=i,e.inbraces=0,e.inbrackets=0,"{"==i&&(e.intag="}"),t.eat("-"),"tag"}else if(t.eat("#")){if("#"==t.peek())return t.skipToEnd(),"comment";if(!t.eol())return e.intag=!0,e.lineTag=!0,e.inbraces=0,e.inbrackets=0,"tag"}t.next()}n=new RegExp("(("+n.join(")|(")+"))\\b"),r=new RegExp("(("+r.join(")|(")+"))\\b");const c={name:"jinja2",startState:function(){return{tokenize:a,inbrackets:0,inbraces:0}},token:function(t,e){var i=e.tokenize(t,e);return t.eol()&&e.lineTag&&!e.instring&&0==e.inbraces&&0==e.inbrackets&&(e.intag=!1,e.lineTag=!1),i},languageData:{commentTokens:{block:{open:"{#",close:"#}",line:"##"}}}}},91847:function(t,e,i){i.d(e,{r:()=>s});var n=new RegExp("\\b(("+["true","false","on","off","yes","no"].join(")|(")+"))$","i");const s={name:"yaml",token:function(t,e){var i=t.peek(),s=e.escaped;if(e.escaped=!1,"#"==i&&(0==t.pos||/\s/.test(t.string.charAt(t.pos-1))))return t.skipToEnd(),"comment";if(t.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))return"string";if(e.literal&&t.indentation()>e.keyCol)return t.skipToEnd(),"string";if(e.literal&&(e.literal=!1),t.sol()){if(e.keyCol=0,e.pair=!1,e.pairStart=!1,t.match("---"))return"def";if(t.match("..."))return"def";if(t.match(/^\s*-\s+/))return"meta"}if(t.match(/^(\{|\}|\[|\])/))return"{"==i?e.inlinePairs++:"}"==i?e.inlinePairs--:"["==i?e.inlineList++:e.inlineList--,"meta";if(e.inlineList>0&&!s&&","==i)return t.next(),"meta";if(e.inlinePairs>0&&!s&&","==i)return e.keyCol=0,e.pair=!1,e.pairStart=!1,t.next(),"meta";if(e.pairStart){if(t.match(/^\s*(\||\>)\s*/))return e.literal=!0,"meta";if(t.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable";if(0==e.inlinePairs&&t.match(/^\s*-?[0-9\.\,]+\s?$/))return"number";if(e.inlinePairs>0&&t.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number";if(t.match(n))return"keyword"}return!e.pair&&t.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)?(e.pair=!0,e.keyCol=t.indentation(),"atom"):e.pair&&t.match(/^:\s*/)?(e.pairStart=!0,"meta"):(e.pairStart=!1,e.escaped="\\"==i,t.next(),null)},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}},languageData:{commentTokens:{line:"#"}}}},86285:function(t,e,i){i.d(e,{sW:()=>k,Lp:()=>it});i(92745),i(9359),i(70104),i(52924);var n=i(76641),s=i(89276);function o(){var t=arguments[0];"string"==typeof t&&(t=document.createElement(t));var e=1,i=arguments[1];if(i&&"object"==typeof i&&null==i.nodeType&&!Array.isArray(i)){for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)){var s=i[n];"string"==typeof s?t.setAttribute(n,s):null!=s&&(t[n]=s)}e++}for(;e<arguments.length;e++)r(t,arguments[e]);return t}function r(t,e){if("string"==typeof e)t.appendChild(document.createTextNode(e));else if(null==e);else if(null!=e.nodeType)t.appendChild(e);else{if(!Array.isArray(e))throw new RangeError("Unsupported child node: "+e);for(var i=0;i<e.length;i++)r(t,e[i])}}const l="function"==typeof String.prototype.normalize?t=>t.normalize("NFKD"):t=>t;class a{constructor(t,e,i=0,n=t.length,s,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(i,n),this.bufferStart=i,this.normalize=s?t=>s(l(t)):l,this.query=this.normalize(e)}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,s.gm)(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let e=(0,s.bg)(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=(0,s.nZ)(t);let n=this.normalize(e);if(n.length)for(let t=0,s=i;;t++){let o=n.charCodeAt(t),r=this.match(o,s,this.bufferPos+this.bufferStart);if(t==n.length-1){if(r)return this.value=r,this;break}s==i&&t<e.length&&e.charCodeAt(t)==o&&s++}}}match(t,e,i){let n=null;for(let e=0;e<this.matches.length;e+=2){let s=this.matches[e],o=!1;this.query.charCodeAt(s)==t&&(s==this.query.length-1?n={from:this.matches[e+1],to:i}:(this.matches[e]++,o=!0)),o||(this.matches.splice(e,2),e-=2)}return this.query.charCodeAt(0)==t&&(1==this.query.length?n={from:e,to:i}:this.matches.push(1,e)),n&&this.test&&!this.test(n.from,n.to,this.buffer,this.bufferStart)&&(n=null),n}}"undefined"!=typeof Symbol&&(a.prototype[Symbol.iterator]=function(){return this});const c={from:-1,to:-1,match:/.*/.exec("")},h="gm"+(null==/x/.unicode?"":"u");class u{constructor(t,e,i,n=0,s=t.length){if(this.text=t,this.to=s,this.curLine="",this.done=!1,this.value=c,/\\[sWDnr]|\n|\r|\[\^/.test(e))return new d(t,e,i,n,s);this.re=new RegExp(e,h+((null==i?void 0:i.ignoreCase)?"i":"")),this.test=null==i?void 0:i.test,this.iter=t.iter();let o=t.lineAt(n);this.curLineStart=o.from,this.matchPos=m(t,n),this.getLine(this.curLineStart)}getLine(t){this.iter.next(t),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let e=this.matchPos<=this.to&&this.re.exec(this.curLine);if(e){let i=this.curLineStart+e.index,n=i+e[0].length;if(this.matchPos=m(this.text,n+(i==n?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(i<n||i>this.value.to)&&(!this.test||this.test(i,n,e)))return this.value={from:i,to:n,match:e},this;t=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),t=0}}}}const f=new WeakMap;class p{constructor(t,e){this.from=t,this.text=e}get to(){return this.from+this.text.length}static get(t,e,i){let n=f.get(t);if(!n||n.from>=i||n.to<=e){let n=new p(e,t.sliceString(e,i));return f.set(t,n),n}if(n.from==e&&n.to==i)return n;let{text:s,from:o}=n;return o>e&&(s=t.sliceString(e,o)+s,o=e),n.to<i&&(s+=t.sliceString(n.to,i)),f.set(t,new p(o,s)),new p(e,s.slice(e-o,i-o))}}class d{constructor(t,e,i,n,s){this.text=t,this.to=s,this.done=!1,this.value=c,this.matchPos=m(t,n),this.re=new RegExp(e,h+((null==i?void 0:i.ignoreCase)?"i":"")),this.test=null==i?void 0:i.test,this.flat=p.get(t,n,this.chunkEnd(n+5e3))}chunkEnd(t){return t>=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,e=this.re.exec(this.flat.text);if(e&&!e[0]&&e.index==t&&(this.re.lastIndex=t+1,e=this.re.exec(this.flat.text)),e){let t=this.flat.from+e.index,i=t+e[0].length;if((this.flat.to>=this.to||e.index+e[0].length<=this.flat.text.length-10)&&(!this.test||this.test(t,i,e)))return this.value={from:t,to:i,match:e},this.matchPos=m(this.text,i+(t==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=p.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function m(t,e){if(e>=t.length)return e;let i,n=t.lineAt(e);for(;e<n.to&&(i=n.text.charCodeAt(e-n.from))>=56320&&i<57344;)e++;return e}function g(t){let e=o("input",{class:"cm-textfield",name:"line",value:String(t.state.doc.lineAt(t.state.selection.main.head).number)});function i(){let i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(e.value);if(!i)return;let{state:o}=t,r=o.doc.lineAt(o.selection.main.head),[,l,a,c,h]=i,u=c?+c.slice(1):0,f=a?+a:r.number;if(a&&h){let t=f/100;l&&(t=t*("-"==l?-1:1)+r.number/o.doc.lines),f=Math.round(o.doc.lines*t)}else a&&l&&(f=f*("-"==l?-1:1)+r.number);let p=o.doc.line(Math.max(1,Math.min(o.doc.lines,f))),d=s.jT.cursor(p.from+Math.max(0,Math.min(u,p.length)));t.dispatch({effects:[v.of(!1),n.tk.scrollIntoView(d.from,{y:"center"})],selection:d}),t.focus()}return{dom:o("form",{class:"cm-gotoLine",onkeydown:e=>{27==e.keyCode?(e.preventDefault(),t.dispatch({effects:v.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i())},onsubmit:t=>{t.preventDefault(),i()}},o("label",t.state.phrase("Go to line"),": ",e)," ",o("button",{class:"cm-button",type:"submit"},t.state.phrase("go")),o("button",{name:"close",onclick:()=>{t.dispatch({effects:v.of(!1)}),t.focus()},"aria-label":t.state.phrase("close"),type:"button"},["×"]))}}"undefined"!=typeof Symbol&&(u.prototype[Symbol.iterator]=d.prototype[Symbol.iterator]=function(){return this});const v=s.Py.define(),b=s.QQ.define({create:()=>!0,update(t,e){for(let i of e.effects)i.is(v)&&(t=i.value);return t},provide:t=>n.mH.from(t,(t=>t?g:null))}),y=n.tk.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),x={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},w=s.r$.define({combine:t=>(0,s.BO)(t,x,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})});function k(t){let e=[D,L];return t&&e.push(w.of(t)),e}const C=n.p.mark({class:"cm-selectionMatch"}),S=n.p.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function M(t,e,i,n){return!(0!=i&&t(e.sliceDoc(i-1,i))==s.D0.Word||n!=e.doc.length&&t(e.sliceDoc(n,n+1))==s.D0.Word)}const L=n.lg.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(w),{state:i}=t,o=i.selection;if(o.ranges.length>1)return n.p.none;let r,l=o.main,c=null;if(l.empty){if(!e.highlightWordAroundCursor)return n.p.none;let t=i.wordAt(l.head);if(!t)return n.p.none;c=i.charCategorizer(l.head),r=i.sliceDoc(t.from,t.to)}else{let t=l.to-l.from;if(t<e.minSelectionLength||t>200)return n.p.none;if(e.wholeWords){if(r=i.sliceDoc(l.from,l.to),c=i.charCategorizer(l.head),!M(c,i,l.from,l.to)||!function(t,e,i,n){return t(e.sliceDoc(i,i+1))==s.D0.Word&&t(e.sliceDoc(n-1,n))==s.D0.Word}(c,i,l.from,l.to))return n.p.none}else if(r=i.sliceDoc(l.from,l.to),!r)return n.p.none}let h=[];for(let s of t.visibleRanges){let t=new a(i.doc,r,s.from,s.to);for(;!t.next().done;){let{from:s,to:o}=t.value;if((!c||M(c,i,s,o))&&(l.empty&&s<=l.from&&o>=l.to?h.push(S.range(s,o)):(s>=l.to||o<=l.from)&&h.push(C.range(s,o)),h.length>e.maxMatches))return n.p.none}}return n.p.set(h)}},{decorations:t=>t.decorations}),D=n.tk.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const T=s.r$.define({combine:t=>(0,s.BO)(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new nt(t),scrollToMatch:t=>n.tk.scrollIntoView(t)})});class A{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||function(t){try{return new RegExp(t,h),!0}catch(t){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,((t,e)=>"n"==e?"\n":"r"==e?"\r":"t"==e?"\t":"\\"))}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord}create(){return this.regexp?new q(this):new E(this)}getCursor(t,e=0,i){let n=t.doc?t:s.yy.create({doc:t});return null==i&&(i=n.doc.length),this.regexp?R(this,n,e,i):O(this,n,e,i)}}class I{constructor(t){this.spec=t}}function O(t,e,i,n){return new a(e.doc,t.unquoted,i,n,t.caseSensitive?void 0:t=>t.toLowerCase(),t.wholeWord?(o=e.doc,r=e.charCategorizer(e.selection.main.head),(t,e,i,n)=>((n>t||n+i.length<e)&&(n=Math.max(0,t-2),i=o.sliceString(n,Math.min(o.length,e+2))),!(r(P(i,t-n))==s.D0.Word&&r(W(i,t-n))==s.D0.Word||r(W(i,e-n))==s.D0.Word&&r(P(i,e-n))==s.D0.Word))):void 0);var o,r}class E extends I{constructor(t){super(t)}nextMatch(t,e,i){let n=O(this.spec,t,i,t.doc.length).nextOverlapping();if(n.done){let i=Math.min(t.doc.length,e+this.spec.unquoted.length);n=O(this.spec,t,0,i).nextOverlapping()}return n.done||n.value.from==e&&n.value.to==i?null:n.value}prevMatchInRange(t,e,i){for(let n=i;;){let i=Math.max(e,n-1e4-this.spec.unquoted.length),s=O(this.spec,t,i,n),o=null;for(;!s.nextOverlapping().done;)o=s.value;if(o)return o;if(i==e)return null;n-=1e4}}prevMatch(t,e,i){let n=this.prevMatchInRange(t,0,e);return n||(n=this.prevMatchInRange(t,Math.max(0,i-this.spec.unquoted.length),t.doc.length)),!n||n.from==e&&n.to==i?null:n}getReplacement(t){return this.spec.unquote(this.spec.replace)}matchAll(t,e){let i=O(this.spec,t,0,t.doc.length),n=[];for(;!i.next().done;){if(n.length>=e)return null;n.push(i.value)}return n}highlight(t,e,i,n){let s=O(this.spec,t,Math.max(0,e-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,t.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}}function R(t,e,i,n){return new u(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(o=e.charCategorizer(e.selection.main.head),(t,e,i)=>!i[0].length||(o(P(i.input,i.index))!=s.D0.Word||o(W(i.input,i.index))!=s.D0.Word)&&(o(W(i.input,i.index+i[0].length))!=s.D0.Word||o(P(i.input,i.index+i[0].length))!=s.D0.Word)):void 0},i,n);var o}function P(t,e){return t.slice((0,s.cp)(t,e,!1),e)}function W(t,e){return t.slice(e,(0,s.cp)(t,e))}class q extends I{nextMatch(t,e,i){let n=R(this.spec,t,i,t.doc.length).next();return n.done&&(n=R(this.spec,t,0,e).next()),n.done?null:n.value}prevMatchInRange(t,e,i){for(let n=1;;n++){let s=Math.max(e,i-1e4*n),o=R(this.spec,t,s,i),r=null;for(;!o.next().done;)r=o.value;if(r&&(s==e||r.from>s+10))return r;if(s==e)return null}}prevMatch(t,e,i){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,i,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,((e,i)=>{if("&"==i)return t.match[0];if("$"==i)return"$";for(let e=i.length;e>0;e--){let n=+i.slice(0,e);if(n>0&&n<t.match.length)return t.match[n]+i.slice(e)}return e}))}matchAll(t,e){let i=R(this.spec,t,0,t.doc.length),n=[];for(;!i.next().done;){if(n.length>=e)return null;n.push(i.value)}return n}highlight(t,e,i,n){let s=R(this.spec,t,Math.max(0,e-250),Math.min(i+250,t.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}}const F=s.Py.define(),$=s.Py.define(),j=s.QQ.define({create:t=>new B(J(t).create(),null),update(t,e){for(let i of e.effects)i.is(F)?t=new B(i.value.create(),t.panel):i.is($)&&(t=new B(t.query,i.value?G:null));return t},provide:t=>n.mH.from(t,(t=>t.panel))});class B{constructor(t,e){this.query=t,this.panel=e}}const N=n.p.mark({class:"cm-searchMatch"}),z=n.p.mark({class:"cm-searchMatch cm-searchMatch-selected"}),_=n.lg.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(j))}update(t){let e=t.state.field(j);(e!=t.startState.field(j)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return n.p.none;let{view:i}=this,o=new s.f_;for(let e=0,n=i.visibleRanges,s=n.length;e<s;e++){let{from:r,to:l}=n[e];for(;e<s-1&&l>n[e+1].from-500;)l=n[++e].to;t.highlight(i.state,r,l,((t,e)=>{let n=i.state.selection.ranges.some((i=>i.from==t&&i.to==e));o.add(t,e,n?z:N)}))}return o.finish()}},{decorations:t=>t.decorations});function U(t){return e=>{let i=e.state.field(j,!1);return i&&i.query.spec.valid?t(e,i):tt(e)}}const Q=U(((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let o=s.jT.single(n.from,n.to),r=t.state.facet(T);return t.dispatch({selection:o,effects:[lt(t,n),r.scrollToMatch(o.main,t)],userEvent:"select.search"}),Y(t),!0})),H=U(((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,o=e.prevMatch(i,n,n);if(!o)return!1;let r=s.jT.single(o.from,o.to),l=t.state.facet(T);return t.dispatch({selection:r,effects:[lt(t,o),l.scrollToMatch(r.main,t)],userEvent:"select.search"}),Y(t),!0})),K=U(((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!(!i||!i.length)&&(t.dispatch({selection:s.jT.create(i.map((t=>s.jT.range(t.from,t.to)))),userEvent:"select.search.matches"}),!0)})),Z=U(((t,{query:e})=>{let{state:i}=t,{from:o,to:r}=i.selection.main;if(i.readOnly)return!1;let l=e.nextMatch(i,o,o);if(!l)return!1;let a,c,h=l,u=[],f=[];if(h.from==o&&h.to==r&&(c=i.toText(e.getReplacement(h)),u.push({from:h.from,to:h.to,insert:c}),h=e.nextMatch(i,h.from,h.to),f.push(n.tk.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(o).number)+"."))),h){let e=0==u.length||u[0].from>=l.to?0:l.to-l.from-c.length;a=s.jT.single(h.from-e,h.to-e),f.push(lt(t,h)),f.push(i.facet(T).scrollToMatch(a.main,t))}return t.dispatch({changes:u,selection:a,effects:f,userEvent:"input.replace"}),!0})),V=U(((t,{query:e})=>{if(t.state.readOnly)return!1;let i=e.matchAll(t.state,1e9).map((t=>{let{from:i,to:n}=t;return{from:i,to:n,insert:e.getReplacement(t)}}));if(!i.length)return!1;let s=t.state.phrase("replaced $ matches",i.length)+".";return t.dispatch({changes:i,effects:n.tk.announce.of(s),userEvent:"input.replace.all"}),!0}));function G(t){return t.state.facet(T).createPanel(t)}function J(t,e){var i,n,s,o,r;let l=t.selection.main,a=l.empty||l.to>l.from+100?"":t.sliceDoc(l.from,l.to);if(e&&!a)return e;let c=t.facet(T);return new A({search:(null!==(i=null==e?void 0:e.literal)&&void 0!==i?i:c.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!==(n=null==e?void 0:e.caseSensitive)&&void 0!==n?n:c.caseSensitive,literal:null!==(s=null==e?void 0:e.literal)&&void 0!==s?s:c.literal,regexp:null!==(o=null==e?void 0:e.regexp)&&void 0!==o?o:c.regexp,wholeWord:null!==(r=null==e?void 0:e.wholeWord)&&void 0!==r?r:c.wholeWord})}function X(t){let e=(0,n.Sd)(t,G);return e&&e.dom.querySelector("[main-field]")}function Y(t){let e=X(t);e&&e==t.root.activeElement&&e.select()}const tt=t=>{let e=t.state.field(j,!1);if(e&&e.panel){let i=X(t);if(i&&i!=t.root.activeElement){let n=J(t.state,e.query.spec);n.valid&&t.dispatch({effects:F.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[$.of(!0),e?F.of(J(t.state,e.query.spec)):s.Py.appendConfig.of(ct)]});return!0},et=t=>{let e=t.state.field(j,!1);if(!e||!e.panel)return!1;let i=(0,n.Sd)(t,G);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:$.of(!1)}),!0},it=[{key:"Mod-f",run:tt,scope:"editor search-panel"},{key:"F3",run:Q,shift:H,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Q,shift:H,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:et,scope:"editor search-panel"},{key:"Mod-Shift-l",run:({state:t,dispatch:e})=>{let i=t.selection;if(i.ranges.length>1||i.main.empty)return!1;let{from:n,to:o}=i.main,r=[],l=0;for(let e=new a(t.doc,t.sliceDoc(n,o));!e.next().done;){if(r.length>1e3)return!1;e.value.from==n&&(l=r.length),r.push(s.jT.range(e.value.from,e.value.to))}return e(t.update({selection:s.jT.create(r,l),userEvent:"select.search.matches"})),!0}},{key:"Mod-Alt-g",run:t=>{let e=(0,n.Sd)(t,g);if(!e){let i=[v.of(!0)];null==t.state.field(b,!1)&&i.push(s.Py.appendConfig.of([b,y])),t.dispatch({effects:i}),e=(0,n.Sd)(t,g)}return e&&e.dom.querySelector("input").select(),!0}},{key:"Mod-d",run:({state:t,dispatch:e})=>{let{ranges:i}=t.selection;if(i.some((t=>t.from===t.to)))return(({state:t,dispatch:e})=>{let{selection:i}=t,n=s.jT.create(i.ranges.map((e=>t.wordAt(e.head)||s.jT.cursor(e.head))),i.mainIndex);return!n.eq(i)&&(e(t.update({selection:n})),!0)})({state:t,dispatch:e});let o=t.sliceDoc(i[0].from,i[0].to);if(t.selection.ranges.some((e=>t.sliceDoc(e.from,e.to)!=o)))return!1;let r=function(t,e){let{main:i,ranges:n}=t.selection,s=t.wordAt(i.head),o=s&&s.from==i.from&&s.to==i.to;for(let i=!1,s=new a(t.doc,e,n[n.length-1].to);;){if(s.next(),!s.done){if(i&&n.some((t=>t.from==s.value.from)))continue