iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 306 kB
JavaScript
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["93505"],{81646:function(t){var e=RangeError;t.exports=function(t){if(t==t)return t;throw new e("NaN is not allowed")}},2480:function(t,e,i){var n=i(40810),s=i(97934),r=i(71998),o=i(4576),l=i(81646),h=i(31922),a=i(79995),c=i(92288),f=a((function(){for(var t,e=this.iterator,i=this.next;this.remaining;)if(this.remaining--,t=r(s(i,e)),this.done=!!t.done)return;if(t=r(s(i,e)),!(this.done=!!t.done))return t.value}));n({target:"Iterator",proto:!0,real:!0,forced:c},{drop:function(t){r(this);var e=h(l(+t));return new f(o(this),{remaining:e})}})},16132:function(t,e,i){i(13492)("Uint16",(function(t){return function(e,i,n){return t(this,e,i,n)}}))},8877:function(t,e,i){i.a(t,(async function(t,n){try{i.d(e,{at:()=>Ae,f$:()=>K,m8:()=>M,of:()=>R,wQ:()=>Me,xi:()=>Ce});i(71695),i(92745),i(9359),i(68107),i(56475),i(70104),i(52924),i(19134),i(5740),i(47706),i(47021);var s=i(89276),r=i(10857),o=i(51801),l=i(70585),h=t([r,o]);[r,o]=h.then?(await h)():h;const c=t=>{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=g(t.state,i.from);return n.line?u(t):!!n.block&&p(t)};function f(t,e){return({state:i,dispatch:n})=>{if(i.readOnly)return!1;let s=t(e,i);return!!s&&(n(i.update(s)),!0)}}const u=f(b,0),d=f(y,0),p=f(((t,e)=>y(t,e,w(e))),0);function g(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}const m=50;function v(t,{open:e,close:i},n,s){let r,o,l=t.sliceDoc(n-m,n),h=t.sliceDoc(s,s+m),a=/\s*$/.exec(l)[0].length,c=/^\s*/.exec(h)[0].length,f=l.length-a;if(l.slice(f-e.length,f)==e&&h.slice(c,c+i.length)==i)return{open:{pos:n-a,margin:a&&1},close:{pos:s+c,margin:c&&1}};s-n<=2*m?r=o=t.sliceDoc(n,s):(r=t.sliceDoc(n,n+m),o=t.sliceDoc(s-m,s));let u=/^\s*/.exec(r)[0].length,d=/\s*$/.exec(o)[0].length,p=o.length-d-i.length;return r.slice(u,u+e.length)==e&&o.slice(p,p+i.length)==i?{open:{pos:n+u+e.length,margin:/\s/.test(r.charAt(u+e.length))?1:0},close:{pos:s-d-i.length,margin:/\s/.test(o.charAt(p-1))?1:0}}:null}function w(t){let e=[];for(let i of t.selection.ranges){let n=t.doc.lineAt(i.from),s=i.to<=n.to?n:t.doc.lineAt(i.to);s.from>n.from&&s.from==i.to&&(s=i.to==n.to+1?n:t.doc.lineAt(i.to-1));let r=e.length-1;r>=0&&e[r].to>n.from?e[r].to=s.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:s.to})}return e}function y(t,e,i=e.selection.ranges){let n=i.map((t=>g(e,t.from).block));if(!n.every((t=>t)))return null;let s=i.map(((t,i)=>v(e,n[i],t.from,t.to)));if(2!=t&&!s.every((t=>t)))return{changes:e.changes(i.map(((t,e)=>s[e]?[]:[{from:t.from,insert:n[e].open+" "},{from:t.to,insert:" "+n[e].close}])))};if(1!=t&&s.some((t=>t))){let t=[];for(let e,i=0;i<s.length;i++)if(e=s[i]){let s=n[i],{open:r,close:o}=e;t.push({from:r.pos-s.open.length,to:r.pos+r.margin},{from:o.pos-o.margin,to:o.pos+s.close.length})}return{changes:t}}return null}function b(t,e,i=e.selection.ranges){let n=[],s=-1;for(let{from:r,to:o}of i){let t=n.length,i=1e9,l=g(e,r).line;if(l){for(let t=r;t<=o;){let h=e.doc.lineAt(t);if(h.from>s&&(r==o||o>h.from)){s=h.from;let t=/^\s*/.exec(h.text)[0].length,e=t==h.length,r=h.text.slice(t,t+l.length)==l?t:-1;t<h.text.length&&t<i&&(i=t),n.push({line:h,comment:r,token:l,indent:t,empty:e,single:!1})}t=h.to+1}if(i<1e9)for(let e=t;e<n.length;e++)n[e].indent<n[e].line.text.length&&(n[e].indent=i);n.length==t+1&&(n[t].single=!0)}}if(2!=t&&n.some((t=>t.comment<0&&(!t.empty||t.single)))){let t=[];for(let{line:e,token:s,indent:r,empty:o,single:l}of n)!l&&o||t.push({from:e.from+r,insert:s+" "});let i=e.changes(t);return{changes:i,selection:e.selection.map(i,1)}}if(1!=t&&n.some((t=>t.comment>=0))){let t=[];for(let{line:e,comment:i,token:s}of n)if(i>=0){let n=e.from+i,r=n+s.length;" "==e.text[r-e.from]&&r++,t.push({from:n,to:r})}return{changes:t}}return null}const x=s.q6.define(),k=s.q6.define(),S=s.r$.define(),A=s.r$.define({combine(t){return(0,s.BO)(t,{minDepth:100,newGroupDelay:500,joinToEvent:(t,e)=>e},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,e)=>(i,n)=>t(i,n)||e(i,n)})}}),C=s.QQ.define({create(){return $.empty},update(t,e){let i=e.state.facet(A),n=e.annotation(x);if(n){let s=N.fromTransaction(e,n.selection),r=n.side,o=0==r?t.undone:t.done;return o=s?L(o,o.length,i.minDepth,s):F(o,e.startState.selection),new $(0==r?n.rest:o,0==r?o:n.rest)}let r=e.annotation(k);if("full"!=r&&"before"!=r||(t=t.isolate()),!1===e.annotation(s.YW.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let o=N.fromTransaction(e),l=e.annotation(s.YW.time),h=e.annotation(s.YW.userEvent);return o?t=t.addChanges(o,l,h,i,e):e.selection&&(t=t.addSelection(e.startState.selection,l,h,i.newGroupDelay)),"full"!=r&&"after"!=r||(t=t.isolate()),t},toJSON(t){return{done:t.done.map((t=>t.toJSON())),undone:t.undone.map((t=>t.toJSON()))}},fromJSON(t){return new $(t.done.map(N.fromJSON),t.undone.map(N.fromJSON))}});function M(t={}){return[C,A.of(t),r.tk.domEventHandlers({beforeinput(t,e){let i="historyUndo"==t.inputType?O:"historyRedo"==t.inputType?D:null;return!!i&&(t.preventDefault(),i(e))}})]}function T(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let s=i.field(C,!1);if(!s)return!1;let r=s.pop(t,i,e);return!!r&&(n(r),!0)}}const O=T(0,!1),D=T(1,!1),E=T(0,!0),B=T(1,!0);function P(t){return function(e){let i=e.field(C,!1);if(!i)return 0;let n=0==t?i.done:i.undone;return n.length-(n.length&&!n[0].changes?1:0)}}const R=99387==i.j?P(0):null;class N{constructor(t,e,i,n,s){this.changes=t,this.effects=e,this.mapped=i,this.startSelection=n,this.selectionsAfter=s}setSelAfter(t){return new N(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,e,i;return{changes:null===(t=this.changes)||void 0===t?void 0:t.toJSON(),mapped:null===(e=this.mapped)||void 0===e?void 0:e.toJSON(),startSelection:null===(i=this.startSelection)||void 0===i?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map((t=>t.toJSON()))}}static fromJSON(t){return new N(t.changes&&s.as.fromJSON(t.changes),[],t.mapped&&s.n0.fromJSON(t.mapped),t.startSelection&&s.jT.fromJSON(t.startSelection),t.selectionsAfter.map(s.jT.fromJSON))}static fromTransaction(t,e){let i=H;for(let n of t.startState.facet(S)){let e=n(t);e.length&&(i=i.concat(e))}return!i.length&&t.changes.empty?null:new N(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,H)}static selection(t){return new N(void 0,H,void 0,void 0,t)}}function L(t,e,i,n){let s=e+1>i+20?e-i-1:0,r=t.slice(s,e);return r.push(n),r}function I(t,e){let i=[],n=!1;return t.iterChangedRanges(((t,e)=>i.push(t,e))),e.iterChangedRanges(((t,e,s,r)=>{for(let o=0;o<i.length;){let t=i[o++],e=i[o++];r>=t&&s<=e&&(n=!0)}})),n}function V(t,e){return t.length?e.length?t.concat(e):t:e}const H=[],W=200;function F(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-W));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),L(t,t.length-1,1e9,i.setSelAfter(n)))}return[N.selection([e])]}function z(t){let e=t[t.length-1],i=t.slice();return i[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),i}function j(t,e){if(!t.length)return t;let i=t.length,n=H;for(;i;){let s=_(t[i-1],e,n);if(s.changes&&!s.changes.empty||s.effects.length){let e=t.slice(0,i);return e[i-1]=s,e}e=s.mapped,i--,n=s.selectionsAfter}return n.length?[N.selection(n)]:H}function _(t,e,i){let n=V(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):H,i);if(!t.changes)return N.selection(n);let r=t.changes.map(e),o=e.mapDesc(t.changes,!0),l=t.mapped?t.mapped.composeDesc(o):o;return new N(r,s.Py.mapEffects(t.effects,e),l,t.startSelection.map(o),n)}const q=/^(input\.type|delete)($|\.)/;class ${constructor(t,e,i=0,n=void 0){this.done=t,this.undone=e,this.prevTime=i,this.prevUserEvent=n}isolate(){return this.prevTime?new $(this.done,this.undone):this}addChanges(t,e,i,n,r){let o=this.done,l=o[o.length-1];return o=l&&l.changes&&!l.changes.empty&&t.changes&&(!i||q.test(i))&&(!l.selectionsAfter.length&&e-this.prevTime<n.newGroupDelay&&n.joinToEvent(r,I(l.changes,t.changes))||"input.type.compose"==i)?L(o,o.length-1,n.minDepth,new N(t.changes.compose(l.changes),V(s.Py.mapEffects(t.effects,l.changes),l.effects),l.mapped,l.startSelection,H)):L(o,o.length,n.minDepth,t),new $(o,H,e,i)}addSelection(t,e,i,n){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:H;return s.length>0&&e-this.prevTime<n&&i==this.prevUserEvent&&i&&/^select($|\.)/.test(i)&&(r=s[s.length-1],o=t,r.ranges.length==o.ranges.length&&0===r.ranges.filter(((t,e)=>t.empty!=o.ranges[e].empty)).length)?this:new $(F(this.done,t),this.undone,e,i);var r,o}addMapping(t){return new $(j(this.done,t),j(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,e,i){let n=0==t?this.done:this.undone;if(0==n.length)return null;let s=n[n.length-1],r=s.selectionsAfter[0]||e.selection;if(i&&s.selectionsAfter.length)return e.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:x.of({side:t,rest:z(n),selection:r}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let i=1==n.length?H:n.slice(0,n.length-1);return s.mapped&&(i=j(i,s.mapped)),e.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:x.of({side:t,rest:i,selection:r}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}$.empty=new $(H,H);const K=[{key:"Mod-z",run:O,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:D,preventDefault:!0},{linux:"Ctrl-Shift-z",run:D,preventDefault:!0},{key:"Mod-u",run:E,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:B,preventDefault:!0}];function J(t,e){return s.jT.create(t.ranges.map(e),t.mainIndex)}function U(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function G({state:t,dispatch:e},i){let n=J(t.selection,i);return!n.eq(t.selection,!0)&&(e(U(t,n)),!0)}function X(t,e){return s.jT.cursor(e?t.to:t.from)}function Y(t,e){return G(t,(i=>i.empty?t.moveByChar(i,e):X(i,e)))}function Q(t){return t.textDirectionAt(t.state.selection.main.head)==r.Nm.LTR}const Z=t=>Y(t,!Q(t)),tt=t=>Y(t,Q(t));function et(t,e){return G(t,(i=>i.empty?t.moveByGroup(i,e):X(i,e)))}const it=t=>et(t,!Q(t)),nt=t=>et(t,Q(t));"undefined"!=typeof Intl&&Intl.Segmenter;function st(t,e,i){if(e.type.prop(i))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function rt(t,e,i){let n,r,h=(0,o.qz)(t).resolveInner(e.head),a=i?l.md.closedBy:l.md.openedBy;for(let s=e.head;;){let e=i?h.childAfter(s):h.childBefore(s);if(!e)break;st(t,e,a)?h=e:s=i?e.to:e.from}return r=h.type.prop(a)&&(n=i?(0,o.Um)(t,h.from,1):(0,o.Um)(t,h.to,-1))&&n.matched?i?n.end.to:n.end.from:i?h.to:h.from,s.jT.cursor(r,i?-1:1)}const ot=t=>G(t,(e=>rt(t.state,e,!Q(t)))),lt=t=>G(t,(e=>rt(t.state,e,Q(t))));function ht(t,e){return G(t,(i=>{if(!i.empty)return X(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)}))}const at=t=>ht(t,!1),ct=t=>ht(t,!0);function ft(t){let e,i=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,s=0;if(i){for(let e of t.state.facet(r.tk.scrollMargins)){let i=e(t);(null==i?void 0:i.top)&&(n=Math.max(null==i?void 0:i.top,n)),(null==i?void 0:i.bottom)&&(s=Math.max(null==i?void 0:i.bottom,s))}e=t.scrollDOM.clientHeight-n-s}else e=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:s,selfScroll:i,height:Math.max(t.defaultLineHeight,e-5)}}function ut(t,e){let i,n=ft(t),{state:s}=t,o=J(s.selection,(i=>i.empty?t.moveVertically(i,e,n.height):X(i,e)));if(o.eq(s.selection))return!1;if(n.selfScroll){let e=t.coordsAtPos(s.selection.main.head),l=t.scrollDOM.getBoundingClientRect(),h=l.top+n.marginTop,a=l.bottom-n.marginBottom;e&&e.top>h&&e.bottom<a&&(i=r.tk.scrollIntoView(o.main.head,{y:"start",yMargin:e.top-h}))}return t.dispatch(U(s,o),{effects:i}),!0}const dt=t=>ut(t,!1),pt=t=>ut(t,!0);function gt(t,e,i){let n=t.lineBlockAt(e.head),r=t.moveToLineBoundary(e,i);if(r.head==e.head&&r.head!=(i?n.to:n.from)&&(r=t.moveToLineBoundary(e,i,!1)),!i&&r.head==n.from&&n.length){let i=/^\s*/.exec(t.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;i&&e.head!=n.from+i&&(r=s.jT.cursor(n.from+i))}return r}const mt=t=>G(t,(e=>gt(t,e,!0))),vt=t=>G(t,(e=>gt(t,e,!1))),wt=t=>G(t,(e=>gt(t,e,!Q(t)))),yt=t=>G(t,(e=>gt(t,e,Q(t)))),bt=t=>G(t,(e=>s.jT.cursor(t.lineBlockAt(e.head).from,1))),xt=t=>G(t,(e=>s.jT.cursor(t.lineBlockAt(e.head).to,-1)));function kt(t,e,i){let n=!1,r=J(t.selection,(e=>{let r=(0,o.Um)(t,e.head,-1)||(0,o.Um)(t,e.head,1)||e.head>0&&(0,o.Um)(t,e.head-1,1)||e.head<t.doc.length&&(0,o.Um)(t,e.head+1,-1);if(!r||!r.end)return e;n=!0;let l=r.start.from==e.head?r.end.to:r.end.from;return i?s.jT.range(e.anchor,l):s.jT.cursor(l)}));return!!n&&(e(U(t,r)),!0)}const St=({state:t,dispatch:e})=>kt(t,e,!1);function At(t,e){let i=J(t.state.selection,(t=>{let i=e(t);return s.jT.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)}));return!i.eq(t.state.selection)&&(t.dispatch(U(t.state,i)),!0)}function Ct(t,e){return At(t,(i=>t.moveByChar(i,e)))}const Mt=t=>Ct(t,!Q(t)),Tt=t=>Ct(t,Q(t));function Ot(t,e){return At(t,(i=>t.moveByGroup(i,e)))}const Dt=t=>Ot(t,!Q(t)),Et=t=>Ot(t,Q(t));const Bt=t=>At(t,(e=>rt(t.state,e,!Q(t)))),Pt=t=>At(t,(e=>rt(t.state,e,Q(t))));function Rt(t,e){return At(t,(i=>t.moveVertically(i,e)))}const Nt=t=>Rt(t,!1),Lt=t=>Rt(t,!0);function It(t,e){return At(t,(i=>t.moveVertically(i,e,ft(t).height)))}const Vt=t=>It(t,!1),Ht=t=>It(t,!0),Wt=t=>At(t,(e=>gt(t,e,!0))),Ft=t=>At(t,(e=>gt(t,e,!1))),zt=t=>At(t,(e=>gt(t,e,!Q(t)))),jt=t=>At(t,(e=>gt(t,e,Q(t)))),_t=t=>At(t,(e=>s.jT.cursor(t.lineBlockAt(e.head).from))),qt=t=>At(t,(e=>s.jT.cursor(t.lineBlockAt(e.head).to))),$t=({state:t,dispatch:e})=>(e(U(t,{anchor:0})),!0),Kt=({state:t,dispatch:e})=>(e(U(t,{anchor:t.doc.length})),!0),Jt=({state:t,dispatch:e})=>(e(U(t,{anchor:t.selection.main.anchor,head:0})),!0),Ut=({state:t,dispatch:e})=>(e(U(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),Gt=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),Xt=({state:t,dispatch:e})=>{let i=ue(t).map((({from:e,to:i})=>s.jT.range(e,Math.min(i+1,t.doc.length))));return e(t.update({selection:s.jT.create(i),userEvent:"select"})),!0},Yt=({state:t,dispatch:e})=>{let i=J(t.selection,(e=>{let i=(0,o.qz)(t),n=i.resolveStack(e.from,1);if(e.empty){let t=i.resolveStack(e.from,-1);t.node.from>=n.node.from&&t.node.to<=n.node.to&&(n=t)}for(let t=n;t;t=t.next){let{node:i}=t;if((i.from<e.from&&i.to>=e.to||i.to>e.to&&i.from<=e.from)&&t.next)return s.jT.range(i.to,i.from)}return e}));return!i.eq(t.selection)&&(e(U(t,i)),!0)},Qt=({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=s.jT.create([i.main]):i.main.empty||(n=s.jT.create([s.jT.cursor(i.main.head)])),!!n&&(e(U(t,n)),!0)};function Zt(t,e){if(t.state.readOnly)return!1;let i="delete.selection",{state:n}=t,o=n.changeByRange((n=>{let{from:r,to:o}=n;if(r==o){let s=e(n);s<r?(i="delete.backward",s=te(t,s,!1)):s>r&&(i="delete.forward",s=te(t,s,!0)),r=Math.min(r,s),o=Math.max(o,s)}else r=te(t,r,!1),o=te(t,o,!0);return r==o?{range:n}:{changes:{from:r,to:o},range:s.jT.cursor(r,r<n.head?-1:1)}}));return!o.changes.empty&&(t.dispatch(n.update(o,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?r.tk.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function te(t,e,i){if(t instanceof r.tk)for(let n of t.state.facet(r.tk.atomicRanges).map((e=>e(t))))n.between(e,e,((t,n)=>{t<e&&n>e&&(e=i?n:t)}));return e}const ee=(t,e,i)=>Zt(t,(n=>{let r,l,h=n.from,{state:a}=t,c=a.doc.lineAt(h);if(i&&!e&&h>c.from&&h<c.from+200&&!/[^ \t]/.test(r=c.text.slice(0,h-c.from))){if("\t"==r[r.length-1])return h-1;let t=(0,s.IS)(r,a.tabSize)%(0,o.y1)(a)||(0,o.y1)(a);for(let e=0;e<t&&" "==r[r.length-1-e];e++)h--;l=h}else l=(0,s.cp)(c.text,h-c.from,e,e)+c.from,l==h&&c.number!=(e?a.doc.lines:1)?l+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(c.text.slice(l-c.from,h-c.from))&&(l=(0,s.cp)(c.text,l-c.from,!1,!1)+c.from);return l})),ie=t=>ee(t,!1,!0),ne=t=>ee(t,!0,!1),se=(t,e)=>Zt(t,(i=>{let n=i.head,{state:r}=t,o=r.doc.lineAt(n),l=r.charCategorizer(n);for(let t=null;;){if(n==(e?o.to:o.from)){n==i.head&&o.number!=(e?r.doc.lines:1)&&(n+=e?1:-1);break}let h=(0,s.cp)(o.text,n-o.from,e)+o.from,a=o.text.slice(Math.min(n,h)-o.from,Math.max(n,h)-o.from),c=l(a);if(null!=t&&c!=t)break;" "==a&&n==i.head||(t=c),n=h}return n})),re=t=>se(t,!1),oe=t=>se(t,!0),le=t=>Zt(t,(e=>{let i=t.lineBlockAt(e.head).to;return e.head<i?i:Math.min(t.state.doc.length,e.head+1)})),he=t=>Zt(t,(e=>{let i=t.moveToLineBoundary(e,!1).head;return e.head>i?i:Math.max(0,e.head-1)})),ae=t=>Zt(t,(e=>{let i=t.moveToLineBoundary(e,!0).head;return e.head<i?i:Math.min(t.state.doc.length,e.head+1)})),ce=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((t=>({changes:{from:t.from,to:t.to,insert:s.xv.of(["",""])},range:s.jT.cursor(t.from)})));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0},fe=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{if(!e.empty||0==e.from||e.from==t.doc.length)return{range:e};let i=e.from,n=t.doc.lineAt(i),r=i==n.from?i-1:(0,s.cp)(n.text,i-n.from,!1)+n.from,o=i==n.to?i+1:(0,s.cp)(n.text,i-n.from,!0)+n.from;return{changes:{from:r,to:o,insert:t.doc.slice(i,o).append(t.doc.slice(r,i))},range:s.jT.cursor(o)}}));return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function ue(t){let e=[],i=-1;for(let n of t.selection.ranges){let s=t.doc.lineAt(n.from),r=t.doc.lineAt(n.to);if(n.empty||n.to!=r.from||(r=t.doc.lineAt(n.to-1)),i>=s.number){let t=e[e.length-1];t.to=r.to,t.ranges.push(n)}else e.push({from:s.from,to:r.to,ranges:[n]});i=r.number+1}return e}function de(t,e,i){if(t.readOnly)return!1;let n=[],r=[];for(let o of ue(t)){if(i?o.to==t.doc.length:0==o.from)continue;let e=t.doc.lineAt(i?o.to+1:o.from-1),l=e.length+1;if(i){n.push({from:o.to,to:e.to},{from:o.from,insert:e.text+t.lineBreak});for(let e of o.ranges)r.push(s.jT.range(Math.min(t.doc.length,e.anchor+l),Math.min(t.doc.length,e.head+l)))}else{n.push({from:e.from,to:o.from},{from:o.to,insert:t.lineBreak+e.text});for(let t of o.ranges)r.push(s.jT.range(t.anchor-l,t.head-l))}}return!!n.length&&(e(t.update({changes:n,scrollIntoView:!0,selection:s.jT.create(r,t.selection.mainIndex),userEvent:"move.line"})),!0)}const pe=({state:t,dispatch:e})=>de(t,e,!1),ge=({state:t,dispatch:e})=>de(t,e,!0);function me(t,e,i){if(t.readOnly)return!1;let n=[];for(let s of ue(t))i?n.push({from:s.from,insert:t.doc.slice(s.from,s.to)+t.lineBreak}):n.push({from:s.to,insert:t.lineBreak+t.doc.slice(s.from,s.to)});return e(t.update({changes:n,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const ve=({state:t,dispatch:e})=>me(t,e,!1),we=({state:t,dispatch:e})=>me(t,e,!0),ye=t=>{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(ue(e).map((({from:t,to:i})=>(t>0?t--:i<e.doc.length&&i++,{from:t,to:i})))),n=J(e.selection,(e=>{let i;if(t.lineWrapping){let n=t.lineBlockAt(e.head),s=t.coordsAtPos(e.head,e.assoc||1);s&&(i=n.bottom+t.documentTop-s.bottom+t.defaultLineHeight/2)}return t.moveVertically(e,!0,i)})).map(i);return t.dispatch({changes:i,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0};function be(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=(0,o.qz)(t).resolveInner(e),s=n.childBefore(e),r=n.childAfter(e);return s&&r&&s.to<=e&&r.from>=e&&(i=s.type.prop(l.md.closedBy))&&i.indexOf(r.name)>-1&&t.doc.lineAt(s.to).from==t.doc.lineAt(r.from).from&&!/\S/.test(t.sliceDoc(s.to,r.from))?{from:s.to,to:r.from}:null}const xe=ke(!1);function ke(t){return({state:e,dispatch:i})=>{if(e.readOnly)return!1;let n=e.changeByRange((i=>{let{from:n,to:r}=i,l=e.doc.lineAt(n),h=!t&&n==r&&be(e,n);t&&(n=r=(r<=l.to?l:e.doc.lineAt(r)).to);let a=new o.Gn(e,{simulateBreak:n,simulateDoubleBreak:!!h}),c=(0,o.K0)(a,n);for(null==c&&(c=(0,s.IS)(/^\s*/.exec(e.doc.lineAt(n).text)[0],e.tabSize));r<l.to&&/\s/.test(l.text[r-l.from]);)r++;h?({from:n,to:r}=h):n>l.from&&n<l.from+100&&!/\S/.test(l.text.slice(0,n))&&(n=l.from);let f=["",(0,o.SS)(e,c)];return h&&f.push((0,o.SS)(e,a.lineIndent(l.from,-1))),{changes:{from:n,to:r,insert:s.xv.of(f)},range:s.jT.cursor(n+1+f[1].length)}}));return i(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function Se(t,e){let i=-1;return t.changeByRange((n=>{let r=[];for(let s=n.from;s<=n.to;){let o=t.doc.lineAt(s);o.number>i&&(n.empty||n.to>o.from)&&(e(o,r,n),i=o.number),s=o.to+1}let o=t.changes(r);return{changes:r,range:s.jT.range(o.mapPos(n.anchor,1),o.mapPos(n.head,1))}}))}const Ae=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Se(t,((e,i)=>{i.push({from:e.from,insert:t.facet(o.c)})})),{userEvent:"input.indent"})),!0),Ce=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Se(t,((e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let r=(0,s.IS)(n,t.tabSize),l=0,h=(0,o.SS)(t,Math.max(0,r-(0,o.y1)(t)));for(;l<n.length&&l<h.length&&n.charCodeAt(l)==h.charCodeAt(l);)l++;i.push({from:e.from+l,to:e.from+n.length,insert:h.slice(l)})})),{userEvent:"delete.dedent"})),!0),Me=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:ot,shift:Bt},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:lt,shift:Pt},{key:"Alt-ArrowUp",run:pe},{key:"Shift-Alt-ArrowUp",run:ve},{key:"Alt-ArrowDown",run:ge},{key:"Shift-Alt-ArrowDown",run:we},{key:"Escape",run:Qt},{key:"Mod-Enter",run:ke(!0)},{key:"Alt-l",mac:"Ctrl-l",run:Xt},{key:"Mod-i",run:Yt,preventDefault:!0},{key:"Mod-[",run:Ce},{key:"Mod-]",run:Ae},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new o.Gn(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),s=Se(t,((e,s,r)=>{let l=(0,o.K0)(n,e.from);if(null==l)return;/\S/.test(e.text)||(l=0);let h=/^\s*/.exec(e.text)[0],a=(0,o.SS)(t,l);(h!=a||r.from<e.from+h.length)&&(i[e.from]=l,s.push({from:e.from,to:e.from+h.length,insert:a}))}));return s.changes.empty||e(t.update(s,{userEvent:"indent"})),!0}},{key:"Shift-Mod-k",run:ye},{key:"Shift-Mod-\\",run:St},{key:"Mod-/",run:c},{key:"Alt-A",run:d},{key:"Ctrl-m",mac:"Shift-Alt-m",run:t=>(t.setTabFocusMode(),!0)}].concat([{key:"ArrowLeft",run:Z,shift:Mt,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:it,shift:Dt,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:wt,shift:zt,preventDefault:!0},{key:"ArrowRight",run:tt,shift:Tt,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:nt,shift:Et,preventDefault:!0},{mac:"Cmd-ArrowRight",run:yt,shift:jt,preventDefault:!0},{key:"ArrowUp",run:at,shift:Nt,preventDefault:!0},{mac:"Cmd-ArrowUp",run:$t,shift:Jt},{mac:"Ctrl-ArrowUp",run:dt,shift:Vt},{key:"ArrowDown",run:ct,shift:Lt,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Kt,shift:Ut},{mac:"Ctrl-ArrowDown",run:pt,shift:Ht},{key:"PageUp",run:dt,shift:Vt},{key:"PageDown",run:pt,shift:Ht},{key:"Home",run:vt,shift:Ft,preventDefault:!0},{key:"Mod-Home",run:$t,shift:Jt},{key:"End",run:mt,shift:Wt,preventDefault:!0},{key:"Mod-End",run:Kt,shift:Ut},{key:"Enter",run:xe,shift:xe},{key:"Mod-a",run:Gt},{key:"Backspace",run:ie,shift:ie},{key:"Delete",run:ne},{key:"Mod-Backspace",mac:"Alt-Backspace",run:re},{key:"Mod-Delete",mac:"Alt-Delete",run:oe},{mac:"Mod-Backspace",run:he},{mac:"Mod-Delete",run:ae}].concat([{key:"Ctrl-b",run:Z,shift:Mt,preventDefault:!0},{key:"Ctrl-f",run:tt,shift:Tt},{key:"Ctrl-p",run:at,shift:Nt},{key:"Ctrl-n",run:ct,shift:Lt},{key:"Ctrl-a",run:bt,shift:_t},{key:"Ctrl-e",run:xt,shift:qt},{key:"Ctrl-d",run:ne},{key:"Ctrl-h",run:ie},{key:"Ctrl-k",run:le},{key:"Ctrl-Alt-h",run:re},{key:"Ctrl-o",run:ce},{key:"Ctrl-t",run:fe},{key:"Ctrl-v",run:pt}].map((t=>({mac:t.key,run:t.run,shift:t.shift})))));n()}catch(a){n(a)}}))},51801:function(t,e,i){i.a(t,(async function(t,n){try{i.d(e,{Gn:()=>P,K0:()=>B,QN:()=>gt,Qf:()=>ct,SS:()=>E,Um:()=>St,c:()=>O,il:()=>Et,mi:()=>ht,nF:()=>pt,qz:()=>v,rs:()=>_,y1:()=>D});i(52247),i(71695),i(92745),i(9359),i(70104),i(52924),i(77439),i(19423),i(40251),i(69235),i(12385),i(19134),i(5740),i(11740),i(44495),i(97003),i(47706),i(46692),i(47021);var s,r=i(70585),o=i(89276),l=i(10857),h=i(13419),a=i(29933),c=t([l]);l=(c.then?(await c)():c)[0];const u=new r.md;function d(t){return o.r$.define({combine:t?e=>e.concat(t):void 0})}const p=new r.md;class g{constructor(t,e,i=[],n=""){this.data=t,this.name=n,o.yy.prototype.hasOwnProperty("tree")||Object.defineProperty(o.yy.prototype,"tree",{get(){return v(this)}}),this.parser=e,this.extension=[M.of(this),o.yy.languageData.of(((t,e,i)=>{let n=m(t,e,i),s=n.type.prop(u);if(!s)return[];let r=t.facet(s),o=n.type.prop(p);if(o){let s=n.resolve(e-n.from,i);for(let e of o)if(e.test(s,t)){let i=t.facet(e.facet);return"replace"==e.type?i:i.concat(r)}}return r}))].concat(i)}isActiveAt(t,e,i=-1){return m(t,e,i).type.prop(u)==this.data}findRegions(t){let e=t.facet(M);if((null==e?void 0:e.data)==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];let i=[],n=(t,e)=>{if(t.prop(u)==this.data)return void i.push({from:e,to:e+t.length});let s=t.prop(r.md.mounted);if(s){if(s.tree.prop(u)==this.data){if(s.overlay)for(let t of s.overlay)i.push({from:t.from+e,to:t.to+e});else i.push({from:e,to:e+t.length});return}if(s.overlay){let t=i.length;if(n(s.tree,s.overlay[0].from+e),i.length>t)return}}for(let i=0;i<t.children.length;i++){let s=t.children[i];s instanceof r.mp&&n(s,t.positions[i]+e)}};return n(v(t),0),i}get allowsNesting(){return!0}}function m(t,e,i){let n=t.facet(M),s=v(t).topNode;if(!n||n.allowsNesting)for(let o=s;o;o=o.enter(e,i,r.vj.ExcludeBuffers))o.type.isTop&&(s=o);return s}g.setState=o.Py.define();function v(t){let e=t.field(g.state,!1);return e?e.tree:r.mp.empty}class w{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let i=this.cursorPos-this.string.length;return t<i||e>=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}}let y=null;class b{constructor(t,e,i=[],n,s,r,o,l){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=s,this.viewport=r,this.skipped=o,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new b(t,e,[],r.mp.empty,0,i,[],null)}startParse(){return this.parser.startParse(new w(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=r.mp.empty&&this.isDone(null!=e?e:this.state.doc.length)?(this.takeTree(),!0):this.withContext((()=>{var i;if("number"==typeof t){let e=Date.now()+t;t=()=>Date.now()>e}for(this.parse||(this.parse=this.startParse()),null!=e&&(null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&e<this.state.doc.length&&this.parse.stopAt(e);;){let n=this.parse.advance();if(n){if(this.fragments=this.withoutTempSkipped(r.i9.addTree(n,this.fragments,null!=this.parse.stoppedAt)),this.treeLen=null!==(i=this.parse.stoppedAt)&&void 0!==i?i:this.state.doc.length,this.tree=n,this.parse=null,!(this.treeLen<(null!=e?e:this.state.doc.length)))return!0;this.parse=this.startParse()}if(t())return!1}}))}takeTree(){let t,e;this.parse&&(t=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext((()=>{for(;!(e=this.parse.advance()););})),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(r.i9.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=y;y=this;try{return t()}finally{y=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=x(t,e.from,e.to);return t}changes(t,e){let{fragments:i,tree:n,treeLen:s,viewport:o,skipped:l}=this;if(this.takeTree(),!t.empty){let e=[];if(t.iterChangedRanges(((t,i,n,s)=>e.push({fromA:t,toA:i,fromB:n,toB:s}))),i=r.i9.applyChanges(i,e),n=r.mp.empty,s=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){l=[];for(let e of this.skipped){let i=t.mapPos(e.from,1),n=t.mapPos(e.to,-1);i<n&&l.push({from:i,to:n})}}}return new b(this.parser,e,i,n,s,o,l,this.scheduleOn)}updateViewport(t){if(this.viewport.from==t.from&&this.viewport.to==t.to)return!1;this.viewport=t;let e=this.skipped.length;for(let i=0;i<this.skipped.length;i++){let{from:e,to:n}=this.skipped[i];e<t.to&&n>t.from&&(this.fragments=x(this.fragments,e,n),this.skipped.splice(i--,1))}return!(this.skipped.length>=e)&&(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,e){this.skipped.push({from:t,to:e})}static getSkippingParser(t){return new class extends r._b{createParse(e,i,n){let s=n[0].from,o=n[n.length-1].to;return{parsedPos:s,advance(){let e=y;if(e){for(let t of n)e.tempSkipped.push(t);t&&(e.scheduleOn=e.scheduleOn?Promise.all([e.scheduleOn,t]):t)}return this.parsedPos=o,new r.mp(r.Jq.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let e=this.fragments;return this.treeLen>=t&&e.length&&0==e[0].from&&e[0].to>=t}static get(){return y}}function x(t,e,i){return r.i9.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class k{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let e=this.context.changes(t.changes,t.state),i=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),e.viewport.to);return e.work(20,i)||e.takeTree(),new k(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=b.create(t.facet(M).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new k(i)}}g.state=o.QQ.define({create:k.init,update(t,e){for(let i of e.effects)if(i.is(g.setState))return i.value;return e.startState.facet(M)!=e.state.facet(M)?k.init(e.state):t.apply(e)}});let S=t=>{let e=setTimeout((()=>t()),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(S=t=>{let e=-1,i=setTimeout((()=>{e=requestIdleCallback(t,{timeout:400})}),100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const A="undefined"!=typeof navigator&&(null===(s=navigator.scheduling)||void 0===s?void 0:s.isInputPending)?()=>navigator.scheduling.isInputPending():null,C=l.lg.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let e=this.view.state.field(g.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(g.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=S(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEnd<e&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=e+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:i,viewport:{to:n}}=this.view,s=i.field(g.state);if(s.tree==s.context.tree&&s.context.isDone(n+1e5))return;let r=Date.now()+Math.min(this.chunkBudget,100,t&&!A?Math.max(25,t.timeRemaining()-5):1e9),o=s.context.treeLen<n&&i.doc.length>n+1e3,l=s.context.work((()=>A&&A()||Date.now()>r),n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(l||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:g.setState.of(new k(s.context))})),this.chunkBudget>0&&(!l||o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then((()=>this.scheduleWork())).catch((t=>(0,l.OO)(this.view.state,t))).then((()=>this.workScheduled--)),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),M=o.r$.define({combine(t){return t.length?t[0]:null},enables:t=>[g.state,C,l.tk.contentAttributes.compute([t],(e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}}))]});const T=o.r$.define(),O=o.r$.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some((t=>t!=e[0])))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function D(t){let e=t.facet(O);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function E(t,e){let i="",n=t.tabSize,s=t.facet(O)[0];if("\t"==s){for(;e>=n;)i+="\t",e-=n;s=" "}for(let r=0;r<e;r++)i+=s;return i}function B(t,e){t instanceof o.yy&&(t=new P(t));for(let n of t.state.facet(T)){let i=n(t,e);if(void 0!==i)return i}let i=v(t.state);return i.length>=e?N(t,i,e):null}class P{constructor(t,e={}){this.state=t,this.options=e,this.unit=D(t)}lineAt(t,e=1){let i=this.state.doc.lineAt(t),{simulateBreak:n,simulateDoubleBreak:s}=this.options;return null!=n&&n>=i.from&&n<=i.to?s&&n==t?{text:"",from:t}:(e<0?n<t:n<=t)?{text:i.text.slice(n-i.from),from:n}:{text:i.text.slice(0,n-i.from),from:i.from}:i}textAfterPos(t,e=1){if(this.options.simulateDoubleBreak&&t==this.options.simulateBreak)return"";let{text:i,from:n}=this.lineAt(t,e);return i.slice(t-n,Math.min(i.length,t+100-n))}column(t,e=1){let{text:i,from:n}=this.lineAt(t,e),s=this.countColumn(i,t-n),r=this.options.overrideIndentation?this.options.overrideIndentation(n):-1;return r>-1&&(s+=r-this.countColumn(i,i.search(/\S|$/))),s}countColumn(t,e=t.length){return(0,o.IS)(t,this.state.tabSize,e)}lineIndent(t,e=1){let{text:i,from:n}=this.lineAt(t,e),s=this.options.overrideIndentation;if(s){let t=s(n);if(t>-1)return t}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const R=new r.md;function N(t,e,i){let n=e.resolveStack(i),s=e.resolveInner(i,-1).resolve(i,0).enterUnfinishedNodesBefore(i);if(s!=n.node){let t=[];for(let e=s;e&&(e.from!=n.node.from||e.type!=n.node.type);e=e.parent)t.push(e);for(let e=t.length-1;e>=0;e--)n={node:t[e],next:n}}return L(n,t,i)}function L(t,e,i){for(let n=t;n;n=n.next){let t=V(n.node);if(t)return t(W.create(e,i,n))}return 0}function I(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function V(t){let e=t.type.prop(R);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(r.md.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>j(t,!0,1,void 0,n&&!I(t)?e.from:void 0)}return null==t.parent?H:null}function H(){return 0}class W extends P{constructor(t,e,i){super(t.state,t.options),this.base=t,this.pos=e,this.context=i}get node(){return this.context.node}static create(t,e,i){return new W(t,e,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let e=this.state.doc.lineAt(t.from);for(;;){let i=t.resolve(e.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(F(i,t))break;e=this.state.doc.lineAt(i.from)}return this.lineIndent(e.from)}continue(){return L(this.context.next,this.base,this.pos)}}function F(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function z(t){let e=t.node,i=e.childAfter(e.from),n=e.lastChild;if(!i)return null;let s=t.options.simulateBreak,r=t.state.doc.lineAt(i.from),o=null==s||s<=r.from?r.to:Math.min(r.to,s);for(let l=i.to;;){let t=e.childAfter(l);if(!t||t==n)return null;if(!t.type.isSkipped){if(t.from>=o)return null;let e=/^ */.exec(r.text.slice(i.to-r.from))[0].length;return{from:i.from,to:i.to+e}}l=t.to}}function j(t,e,i,n,s){let r=t.textAfter,o=r.match(/^\s*/)[0].length,l=n&&r.slice(o,o+n.length)==n||s==t.pos+o,h=e?z(t):null;return h?l?t.column(h.from):t.column(h.to):t.baseIndent+(l?0:t.unit*i)}const _=o.r$.define(),q=new r.md;function $(t,e,i){let n=v(t);if(n.length<i)return null;let s=null;for(let r=n.resolveStack(i,1);r;r=r.next){let o=r.node;if(o.to<=i||o.from>i)continue;if(s&&o.from<e)break;let l=o.type.prop(q);if(l&&(o.to<n.length-50||n.length==t.doc.length||!K(o))){let n=l(o,t);n&&n.from<=i&&n.from>=e&&n.to>i&&(s=n)}}return s}function K(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function J(t,e,i){for(let n of t.facet(_)){let s=n(t,e,i);if(s)return s}return $(t,e,i)}function U(t,e){let i=e.mapPos(t.from,1),n=e.mapPos(t.to,-1);return i>=n?void 0:{from:i,to:n}}const G=o.Py.define({map:U}),X=o.Py.define({map:U});const Y=o.QQ.define({create(){return l.p.none},update(t,e){t=t.map(e.changes);for(let i of e.effects)if(i.is(G)&&!Z(t,i.value.from,i.value.to)){let{preparePlaceholder:n}=e.state.facet(et),s=n?l.p.replace({widget:new rt(n(e.state,i.value))}):st;t=t.update({add:[s.range(i.value.from,i.value.to)]})}else i.is(X)&&(t=t.update({filter:(t,e)=>i.value.from!=t||i.value.to!=e,filterFrom:i.value.from,filterTo:i.value.to}));if(e.selection){let i=!1,{head:n}=e.selection.main;t.between(n,n,((t,e)=>{t<n&&e>n&&(i=!0)})),i&&(t=t.update({filterFrom:n,filterTo:n,filter:(t,e)=>e<=n||t>=n}))}return t},provide:t=>l.tk.decorations.from(t),toJSON(t,e){let i=[];return t.between(0,e.doc.length,((t,e)=>{i.push(t,e)})),i},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let i=0;i<t.length;){let n=t[i++],s=t[i++];if("number"!=typeof n||"number"!=typeof s)throw new RangeError("Invalid JSON for fold state");e.push(st.range(n,s))}return l.p.set(e,!0)}});function Q(t,e,i){var n;let s=null;return null===(n=t.field(Y,!1))||void 0===n||n.between(e,i,((t,e)=>{(!s||s.from>t)&&(s={from:t,to:e})})),s}function Z(t,e,i){let n=!1;return t.between(e,e,((t,s)=>{t==e&&s==i&&(n=!0)})),n}const tt={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},et=o.r$.define({combine(t){return(0,o.BO)(t,tt)}});function it(t){let e=[Y,at];return t&&e.push(et.of(t)),e}function nt(t,e){let{state:i}=t,n=i.facet(et),s=e=>{let i=t.lineBlockAt(t.posAtDOM(e.target)),n=Q(t.state,i.from,i.to);n&&t.dispatch({effects:X.of(n)}),e.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(t,s,e);let r=document.createElement("span");return r.textContent=n.placeholderText,r.setAttribute("aria-label",i.phrase("folded code")),r.title=i.phrase("unfold"),r.className="cm-foldPlaceholder",r.onclick=s,r}const st=l.p.replace({widget:new class extends l.l9{toDOM(t){return nt(t,null)}}});class rt extends l.l9{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return nt(t,this.value)}}const ot={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class lt extends l.SJ{constructor(t,e){super(),this.config=t,this.open=e}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e}}function ht(t={}){let e=Object.assign(Object.assign({},ot),t),i=new lt(e,!0),n=new lt(e,!1),s=l.lg.fromClass(class{constructor(t){this.from=t.viewport.from,this.markers=this.buildMarkers(t)}update(t){(t.docChanged||t.viewportChanged||t.startState.facet(M)!=t.state.facet(M)||t.startState.field(Y,!1)!=t.state.field(Y,!1)||v(t.startState)!=v(t.state)||e.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view))}buildMarkers(t){let e=new o.f_;for(let s of t.viewportLineBlocks){let r=Q(t.state,s.from,s.to)?n:J(t.state,s.from,s.to)?i:null;r&&e.add(s.from,s.from,r)}return e.finish()}}),{domEventHandlers:r}=e;return[s,(0,l.v5)({class:"cm-foldGutter",markers(t){var e;return(null===(e=t.plugin(s))||void 0===e?void 0:e.markers)||o.Xs.empty},initialSpacer(){return new lt(e,!1)},domEventHandlers:Object.assign(Object.assign({},r),{click:(t,e,i)=>{if(r.click&&r.click(t,e,i))return!0;let n=Q(t.state,e.from,e.to);if(n)return t.dispatch({effects:X.of(n)}),!0;let s=J(t.state,e.from,e.to);return!!s&&(t.dispatch({effects:G.of(s)}),!0)}})}),it()]}const at=l.tk.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 ct{constructor(t,e){let i;function n(t){let e=a.V.newName();return(i||(i=Object.create(null)))["."+e]=t,e}this.specs=t;const s="string"==typeof e.all?e.all:e.all?n(e.all):void 0,r=e.scope;this.scope=r instanceof g?t=>t.prop(u)==r.data:r?t=>t==r:void 0,this.style=(0,h.QR)(t.map((t=>({tag:t.tag,class:t.class||n(Object.assign({},t,{tag:null}))}))),{all:s}).style,this.module=i?new a.V(i):null,this.themeType=e.themeType}static define(t,e){return new ct(t,e||{})}}const ft=o.r$.define(),ut=o.r$.define({combine(t){return t.length?[t[0]]:null}});function dt(t){let e=t.facet(ft);return e.length?e:t.facet(ut)}function pt(t,e){let i,n=[vt];return t instanceof ct&&(t.module&&n.push(l.tk.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?n.push(ut.of(t)):i?n.push(ft.computeN([l.tk.darkTheme],(e=>e.facet(l.tk.darkTheme)==("dark"==i)?[t]:[]))):n.push(ft.of(t)),n}function gt(t,e,i){let n=dt(t),s=null;if(n)for(let r of n)if(!r.scope||i&&r.scope(i)){let t=r.style(e);t&&(s=s?s+" "+t:t)}return s}class mt{constructor(t){this.markCache=Object.create(null),this.tree=v(t.state),this.decorations=this.buildDeco(t,dt(t.state)),this.decoratedTo=t.viewport.to}update(t){let e=v(t.state),i=dt(t.state),n=i!=dt(t.startState),{viewport:s}=t.view,r=t.changes.mapPos(this.decoratedTo,1);e.length<s.to&&!n&&e.type==this.tree.type&&r>=s.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=r):(e!=this.tree||t.viewportChanged||n)&&(this.tree=e,this.decorations=this.buildDeco(t.view,i),this.decoratedTo=s.to)}buildDeco(t,e){if(!e||!this.tree.length)return l.p.none;let i=new o.f_;for(let{from:n,to:s}of t.visibleRanges)(0,h.bW)(this.tree,e,((t,e,n)=>{i.add(t,e,this.markCache[n]||(this.markCache[n]=l.p.mark({class:n})))}),n,s);return i.finish()}}const vt=o.Wl.high(l.lg.fromClass(mt,{decorations:t=>t.decorations})),wt=(h.pJ.meta,h.pJ.link,h.pJ.heading,h.pJ.emphasis,h.pJ.strong,h.pJ.strikethrough,h.pJ.keyword,h.pJ.atom,h.pJ.bool,h.pJ.url,h.pJ.contentSeparator,h.pJ.labelName,h.pJ.literal,h.pJ.inserted,h.pJ.string,h.pJ.deleted,h.pJ.regexp,h.pJ.escape,h.pJ.string,h.pJ.variableName,h.pJ.variableName,h.pJ.typeName,h.pJ.namespace,h.pJ.className,h.pJ.variableName,h.pJ.macroName,h.pJ.propertyName,h.pJ.comment,h.pJ.invalid,1e4),yt="()[]{}";const bt=new r.md;function xt(t,e,i){let n=t.prop(e<0?r.md.openedBy:r.md.closedBy);if(n)return n;if(1==t.name.length){let n=i.indexOf(t.name);if(n>-1&&n%2==(e<0?1:0))return[i[n+e]]}return null}function kt(t){let e=t.type.prop(bt);return e?e(t.node):t}function St(t,e,i,n={}){let s=n.maxScanDistance||wt,r=n.brackets||yt,o=v(t),l=o.resolveInner(e,i);for(let h=l;h;h=h.parent){let n=xt(h.type,i,r);if(n&&h.from<h.to){let s=kt(h);if(s&&(i>0?e>=s.from&&e<s.to:e>s.from&&e<=s.to))return At(t,e,i,h,s,n,r)}}return Ct(t,e,i,o,l.type,s,r)}function At(t,e,i,n,s,r,o){let l=n.parent,h={from:s.from,to:s.to},a=0,c=null==l?void 0:l.cursor();if(c&&(i<0?c.childBefore(n.from):c.childAfter(n.to)))do{if(i<0?c.to<=n.from:c.from>=n.to){if(0==a&&r.indexOf(c.type.name)>-1&&c.from<c.to){let t=kt(c);return{start:h,end:t?{from:t.from,to:t.to}:void 0,matched:!0}}if(xt(c.type,i,o))a++;else if(xt(c.type,-i,o)){if(0==a){let t=kt(c);return{start:h,end:t&&t.from<t.to?{from:t.from,to:t.to}:void 0,matched:!1}}a--}}}while(i<0?c.prevSibling():c.nextSibling());return{start:h,matched:!1}}function Ct(t,e,i,n,s,r,o){let l=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),h=o.indexOf(l);if(h<0||h%2==0!=i>0)return null;let a={from:i<0?e-1:e,to:i>0?e+1:e},c=t.doc.iterRange(e,i>0?t.doc.length:0),f=0;for(let u=0;!c.next().done&&u<=r;){let t=c.value;i<0&&(u+=t.length);let r=e+u*i;for(let e=i>0?0:t.length-1,l=i>0?t.length:-1;e!=l;e+=i){let l=o.indexOf(t[e]);if(!(l<0||n.resolveInner(r+e,1).type!=s))if(l%2==0==i>0)f++;else{if(1==f)return{start:a,end:{from:r+e,to:r+e+1},matched:l>>1==h>>1};f--}}i>0&&(u+=t.length)}return c.done?{start:a,matched:!1}:null}function Mt(t,e,i,n=0,s=0){null==e&&-1==(e=t.search(/[^\s\u00a0]/))&&(e=t.length);let r=s;for(let o=n;o<e;o++)9==t.charCodeAt(o)?r+=i-r%i:r++;return r}class Tt{constructor(t,e,i,n){this.string=t,this.tabSize=e,this.indentUnit=i,this.overrideIndent=n,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return 0==this.pos}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(t){let e,i=this.string.charAt(this.pos);if(e="string"==typeof t?i==t:i&&(t instanceof RegExp?t.test(i):t(i)),e)return++this.pos,i}eatWhile(t){let e=this.pos;for(;this.eat(t););return this.pos>e}eatSpace(){let t=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t}skipToEnd(){this.pos=this.string.length}skipTo(t){let e=this.string.indexOf(t,this.pos);if(e>-1)return this.pos=e,!0}backUp(t){this.pos-=t}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Mt(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){var t;return null!==(t=this.overrideIndent)&&void 0!==t?t:Mt(this.string,null,this.tabSize)}match(t,e,i){if("string"==typeof t){let n=t=>i?t.toLowerCase():t;return n(this.string.substr(this.pos,t.length))==n(t)?(!1!==e&&(this.pos+=t.length),!0):null}{let i=this.string.slice(this.pos).match(t);return i&&i.index>0?null:(i&&!1!==e&&(this.pos+=i[0].length),i)}}current(){return this.string.slice(this.start,this.pos)}}function Ot(t){if("object"!=typeof t)return t;let e={};for(let i in t){let n=t[i];e[i]=n instanceof Array?n.slice():n}return e}const Dt=new WeakMap;class Et extends g{constructor(t){let e,i=d(t.languageData),n={name:(s=t).name||"",token:s.token,blankLine:s.blankLine||(()=>{}),startState:s.startState||(()=>!0),copyState:s.copyState||Ot,indent:s.indent||(()=>null),languageData:s.languageData||{},tokenTable:s.tokenTable||It,mergeTokens:!1!==s.mergeTokens};var s;super(i,new class extends r._b{createParse(t,i,n){return new Nt(e,t,i,n)}},[],t.name),this.topNode=Kt(i,this),e=this,this.streamParser=n,this.stateAfter=new r.md({perNode:!0}),this.tokenTable=t.tokenTable?new jt(n.tokenTable):_t}static define(t){return new Et(t)}getIndent(t){let e,{overrideIndentation:i}=t.options;i&&(e=Dt.get(t.state),null!=e&&e<t.pos-1e4&&(e=void 0));let n,s,r=Bt(this,t.node.tree,t.node.from,t.node.from,null!=e?e:t.pos);if(r?(s=r.state,n=r.pos+1):(s=this.streamParser.startState(t.unit),n=t.node.from),t.pos-n>1e4)return null;for(;n<t.pos;){let e=t.state.doc.lineAt(n),r=Math.min(t.pos,e.to);if(e.length){let n=i?i(e.from):-1,o=new Tt(e.text,t.state.tabSize,t.unit,n<0?void 0:n);for(;o.pos<r-e.from;)Lt(this.streamParser.token,o,s)}else this.streamParser.blankLine(s,t.unit);if(r==t.pos)break;n=e.to+1}let o=t.lineAt(t.pos);return i&&null==e&&Dt.set(t.state,o.from),this.streamParser.indent(s,/^\s*(.*)/.exec(o.text)[1],t)}get allowsNesting(){return!1}}function Bt(t,e,i,n,s){let o=i>=n&&i+e.length<=s&&e.prop(t.stateAfter);if(o)return{state:t.streamParser.copyState(o),pos:i+e.length};for(let l=e.children.length-1;l>=0;l--){let o=e.children[l],h=i+e.positions[l],a=o instanceof r.mp&&h<s&&Bt(t,o,h,n,s);if(a)return a}return null}function Pt(t,e,i,n,s){if(s&&i<=0&&n>=e.length)return e;s||0!=i||e.type!=t.topNode||(s=!0);for(let o=e.children.length-1;o>=0;o--){let l,h=e.positions[o],a=e.children[o];if(h<n&&a instanceof r.mp){if(!(l=Pt(t,a,i-h,n-h,s)))break;return s?new r.mp(e.type,e.children.slice(0,o).concat(l),e.positions.slice(0,o+1),h+l.length):l}}return null}function Rt(t,e,i,n,s){for(let r of e){let e,s=r.from+(r.openStart?25:0),o=r.to-(r.openEnd?25:0),l=s<=i&&o>i&&Bt(t,r.tree,0-r.offset,i,o);if(l&&l.pos<=n&&(e=Pt(t,r.tree,i+r.offset,l.pos+r.offset,!1)))return{state:l.state,tree:e}}return{state:t.streamParser.startState(s?D(s):4),tree:r.mp.empty}}class Nt{constructor(t,e,i,n){this.lang=t,this.input=e,this.fragments=i,this.ranges=n,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=n[n.length-1].to;let s=b.get(),r=n[0].from,{state:o,tree:l}=Rt(t,i,r,this.to,null==s?void 0:s.state);this.state=o,this.parsedPos=this.chunkStart=r+l.length;for(let h=0;h<l.children.length;h++)this.chunks.push(l.children[h]),this.chunkPos.push(l.positions[h]);s&&this.parsedPos<s.viewport.from-1e5&&n.some((t=>t.from<=s.viewport.from&&t.to>=s.viewport.from))&&(this.state=this.lang.streamParser.startState(D(s.state)),s.skipUntilInView(this.parsedPos,s.viewport.from),this.parsedPos=s.viewport.from),this.moveRangeIndex()}advance(){let t=b.get(),e=null==this.stoppedAt?this.to:Math.min(this.to,this.stoppedAt),i=Math.min(e,this.chunkStart+2048);for(t&&(i=Math.min(i,t.viewport.to));this.parsedPos<i;)this.parseLine(t);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=e?this.finish():t&&this.parsedPos>=t.viewport.to?(t.skipUntilInView(this.parsedPos,e),this.finish()):null}stopAt(t){this.stoppedAt=t}lineAfter(t){let e=this.input.chunk(t);if(this.input.lineChunks)"\n"==e&&(e="");else{let t=e.indexOf("\n");t>-1&&(e=e.slice(0,t))}return t+e.length<=this.to?e:e.slice(0,this.to-t)}nextLine(){let t=this.parsedPos,e=this.lineAfter(t),i=t+e.length;for(let n=this.rangeIndex;;){let t=this.ranges[n].to;if(t>=i)break;if(e=e.slice(0,t-(i-e.length)),n++,n==this.ranges.length)break;let s=this.ranges[n].from,r=this.lineAfter(s);e+=r,i=s+r.length}return{line:e,end:i}}skipGapsTo(t,e,i){for(;;){let n=this.ranges[this.rangeIndex].to,s=t+e;if(i>0?n>s:n>=s)break;e+=this.ranges[++this.rangeIndex].from-n}return e}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(t,e,i,n){let s=4;if(this.ranges.length>1){e+=n=this.skipGapsTo(e,n,1);let t=this.chunk.length;i+=n=this.skipGapsTo(i,n,-1),s+=this.chunk.length-t}let r=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&4==s&&r>=0&&this.chunk[r]==t&&this.chunk[r+2]==e?this.chunk[r+2]=i:this.chunk.push(t,e,i,s),n}parseLine(t){let{line:e,end:i}=this.nextLine(),