iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 304 kB
JavaScript
export const __webpack_ids__=["93505"];export const __webpack_modules__={81646:function(t){var e=RangeError;t.exports=function(t){if(t==t)return t;throw new e("NaN is not allowed")}},31922:function(t,e,i){var n=i(88045),s=RangeError;t.exports=function(t){var e=n(t);if(e<0)throw new s("The argument can't be less than 0");return e}},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})}})},8877:function(t,e,i){i.d(e,{at:()=>Nt,f$:()=>W,m8:()=>b,of:()=>T,wQ:()=>It,xi:()=>Lt});i(92745),i(9359),i(68107),i(56475),i(70104),i(52924);var n=i(89276),s=i(76641),r=i(51801),o=i(70585);function l(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 h=l(p,0),a=l(d,0),c=l(((t,e)=>d(t,e,function(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}(e))),0);function f(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}const u=50;function d(t,e,i=e.selection.ranges){let n=i.map((t=>f(e,t.from).block));if(!n.every((t=>t)))return null;let s=i.map(((t,i)=>function(t,{open:e,close:i},n,s){let r,o,l=t.sliceDoc(n-u,n),h=t.sliceDoc(s,s+u),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*u?r=o=t.sliceDoc(n,s):(r=t.sliceDoc(n,n+u),o=t.sliceDoc(s-u,s));let d=/^\s*/.exec(r)[0].length,p=/\s*$/.exec(o)[0].length,g=o.length-p-i.length;return r.slice(d,d+e.length)==e&&o.slice(g,g+i.length)==i?{open:{pos:n+d+e.length,margin:/\s/.test(r.charAt(d+e.length))?1:0},close:{pos:s-p-i.length,margin:/\s/.test(o.charAt(g-1))?1:0}}:null}(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 p(t,e,i=e.selection.ranges){let n=[],s=-1;for(let{from:t,to:r}of i){let i=n.length,o=1e9,l=f(e,t).line;if(l){for(let i=t;i<=r;){let h=e.doc.lineAt(i);if(h.from>s&&(t==r||r>h.from)){s=h.from;let t=/^\s*/.exec(h.text)[0].length,e=t==h.length,i=h.text.slice(t,t+l.length)==l?t:-1;t<h.text.length&&t<o&&(o=t),n.push({line:h,comment:i,token:l,indent:t,empty:e,single:!1})}i=h.to+1}if(o<1e9)for(let t=i;t<n.length;t++)n[t].indent<n[t].line.text.length&&(n[t].indent=o);n.length==i+1&&(n[i].single=!0)}}if(2!=t&&n.some((t=>t.comment<0&&(!t.empty||t.single)))){let t=[];for(let{line:e,token:i,indent:s,empty:r,single:o}of n)!o&&r||t.push({from:e.from+s,insert:i+" "});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 g=n.q6.define(),m=n.q6.define(),v=n.r$.define(),w=n.r$.define({combine:t=>(0,n.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)})}),y=n.QQ.define({create:()=>H.empty,update(t,e){let i=e.state.facet(w),s=e.annotation(g);if(s){let n=O.fromTransaction(e,s.selection),r=s.side,o=0==r?t.undone:t.done;return o=n?D(o,o.length,i.minDepth,n):R(o,e.startState.selection),new H(0==r?s.rest:o,0==r?o:s.rest)}let r=e.annotation(m);if("full"!=r&&"before"!=r||(t=t.isolate()),!1===e.annotation(n.YW.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let o=O.fromTransaction(e),l=e.annotation(n.YW.time),h=e.annotation(n.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=>({done:t.done.map((t=>t.toJSON())),undone:t.undone.map((t=>t.toJSON()))}),fromJSON:t=>new H(t.done.map(O.fromJSON),t.undone.map(O.fromJSON))});function b(t={}){return[y,w.of(t),s.tk.domEventHandlers({beforeinput(t,e){let i="historyUndo"==t.inputType?k:"historyRedo"==t.inputType?S:null;return!!i&&(t.preventDefault(),i(e))}})]}function x(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let s=i.field(y,!1);if(!s)return!1;let r=s.pop(t,i,e);return!!r&&(n(r),!0)}}const k=x(0,!1),S=x(1,!1),A=x(0,!0),M=x(1,!0);function C(t){return function(e){let i=e.field(y,!1);if(!i)return 0;let n=0==t?i.done:i.undone;return n.length-(n.length&&!n[0].changes?1:0)}}const T=99387==i.j?C(0):null;class O{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 O(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 O(t.changes&&n.as.fromJSON(t.changes),[],t.mapped&&n.n0.fromJSON(t.mapped),t.startSelection&&n.jT.fromJSON(t.startSelection),t.selectionsAfter.map(n.jT.fromJSON))}static fromTransaction(t,e){let i=B;for(let e of t.startState.facet(v)){let n=e(t);n.length&&(i=i.concat(n))}return!i.length&&t.changes.empty?null:new O(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,B)}static selection(t){return new O(void 0,B,void 0,void 0,t)}}function D(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 E(t,e){return t.length?e.length?t.concat(e):t:e}const B=[],P=200;function R(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-P));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),D(t,t.length-1,1e9,i.setSelAfter(n)))}return[O.selection([e])]}function N(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 L(t,e){if(!t.length)return t;let i=t.length,n=B;for(;i;){let s=I(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?[O.selection(n)]:B}function I(t,e,i){let s=E(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):B,i);if(!t.changes)return O.selection(s);let r=t.changes.map(e),o=e.mapDesc(t.changes,!0),l=t.mapped?t.mapped.composeDesc(o):o;return new O(r,n.Py.mapEffects(t.effects,e),l,t.startSelection.map(o),s)}const V=/^(input\.type|delete)($|\.)/;class H{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 H(this.done,this.undone):this}addChanges(t,e,i,s,r){let o=this.done,l=o[o.length-1];return o=l&&l.changes&&!l.changes.empty&&t.changes&&(!i||V.test(i))&&(!l.selectionsAfter.length&&e-this.prevTime<s.newGroupDelay&&s.joinToEvent(r,function(t,e){let i=[],n=!1;return t.iterChangedRanges(((t,e)=>i.push(t,e))),e.iterChangedRanges(((t,e,s,r)=>{for(let t=0;t<i.length;){let e=i[t++],o=i[t++];r>=e&&s<=o&&(n=!0)}})),n}(l.changes,t.changes))||"input.type.compose"==i)?D(o,o.length-1,s.minDepth,new O(t.changes.compose(l.changes),E(n.Py.mapEffects(t.effects,l.changes),l.effects),l.mapped,l.startSelection,B)):D(o,o.length,s.minDepth,t),new H(o,B,e,i)}addSelection(t,e,i,n){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:B;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 H(R(this.done,t),this.undone,e,i);var r,o}addMapping(t){return new H(L(this.done,t),L(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:g.of({side:t,rest:N(n),selection:r}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let i=1==n.length?B:n.slice(0,n.length-1);return s.mapped&&(i=L(i,s.mapped)),e.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:g.of({side:t,rest:i,selection:r}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}H.empty=new H(B,B);const W=[{key:"Mod-z",run:k,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:S,preventDefault:!0},{linux:"Ctrl-Shift-z",run:S,preventDefault:!0},{key:"Mod-u",run:A,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:M,preventDefault:!0}];function F(t,e){return n.jT.create(t.ranges.map(e),t.mainIndex)}function z(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function j({state:t,dispatch:e},i){let n=F(t.selection,i);return!n.eq(t.selection,!0)&&(e(z(t,n)),!0)}function _(t,e){return n.jT.cursor(e?t.to:t.from)}function q(t,e){return j(t,(i=>i.empty?t.moveByChar(i,e):_(i,e)))}function $(t){return t.textDirectionAt(t.state.selection.main.head)==s.Nm.LTR}const K=t=>q(t,!$(t)),J=t=>q(t,$(t));function U(t,e){return j(t,(i=>i.empty?t.moveByGroup(i,e):_(i,e)))}"undefined"!=typeof Intl&&Intl.Segmenter;function G(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 X(t,e,i){let s,l,h=(0,r.qz)(t).resolveInner(e.head),a=i?o.md.closedBy:o.md.openedBy;for(let n=e.head;;){let e=i?h.childAfter(n):h.childBefore(n);if(!e)break;G(t,e,a)?h=e:n=i?e.to:e.from}return l=h.type.prop(a)&&(s=i?(0,r.Um)(t,h.from,1):(0,r.Um)(t,h.to,-1))&&s.matched?i?s.end.to:s.end.from:i?h.to:h.from,n.jT.cursor(l,i?-1:1)}function Y(t,e){return j(t,(i=>{if(!i.empty)return _(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)}))}const Q=t=>Y(t,!1),Z=t=>Y(t,!0);function tt(t){let e,i=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,r=0;if(i){for(let e of t.state.facet(s.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)&&(r=Math.max(null==i?void 0:i.bottom,r))}e=t.scrollDOM.clientHeight-n-r}else e=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:i,height:Math.max(t.defaultLineHeight,e-5)}}function et(t,e){let i,n=tt(t),{state:r}=t,o=F(r.selection,(i=>i.empty?t.moveVertically(i,e,n.height):_(i,e)));if(o.eq(r.selection))return!1;if(n.selfScroll){let e=t.coordsAtPos(r.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=s.tk.scrollIntoView(o.main.head,{y:"start",yMargin:e.top-h}))}return t.dispatch(z(r,o),{effects:i}),!0}const it=t=>et(t,!1),nt=t=>et(t,!0);function st(t,e,i){let s=t.lineBlockAt(e.head),r=t.moveToLineBoundary(e,i);if(r.head==e.head&&r.head!=(i?s.to:s.from)&&(r=t.moveToLineBoundary(e,i,!1)),!i&&r.head==s.from&&s.length){let i=/^\s*/.exec(t.state.sliceDoc(s.from,Math.min(s.from+100,s.to)))[0].length;i&&e.head!=s.from+i&&(r=n.jT.cursor(s.from+i))}return r}function rt(t,e,i){let s=!1,o=F(t.selection,(e=>{let o=(0,r.Um)(t,e.head,-1)||(0,r.Um)(t,e.head,1)||e.head>0&&(0,r.Um)(t,e.head-1,1)||e.head<t.doc.length&&(0,r.Um)(t,e.head+1,-1);if(!o||!o.end)return e;s=!0;let l=o.start.from==e.head?o.end.to:o.end.from;return i?n.jT.range(e.anchor,l):n.jT.cursor(l)}));return!!s&&(e(z(t,o)),!0)}function ot(t,e){let i=F(t.state.selection,(t=>{let i=e(t);return n.jT.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)}));return!i.eq(t.state.selection)&&(t.dispatch(z(t.state,i)),!0)}function lt(t,e){return ot(t,(i=>t.moveByChar(i,e)))}const ht=t=>lt(t,!$(t)),at=t=>lt(t,$(t));function ct(t,e){return ot(t,(i=>t.moveByGroup(i,e)))}function ft(t,e){return ot(t,(i=>t.moveVertically(i,e)))}const ut=t=>ft(t,!1),dt=t=>ft(t,!0);function pt(t,e){return ot(t,(i=>t.moveVertically(i,e,tt(t).height)))}const gt=t=>pt(t,!1),mt=t=>pt(t,!0),vt=({state:t,dispatch:e})=>(e(z(t,{anchor:0})),!0),wt=({state:t,dispatch:e})=>(e(z(t,{anchor:t.doc.length})),!0),yt=({state:t,dispatch:e})=>(e(z(t,{anchor:t.selection.main.anchor,head:0})),!0),bt=({state:t,dispatch:e})=>(e(z(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function xt(t,e){if(t.state.readOnly)return!1;let i="delete.selection",{state:r}=t,o=r.changeByRange((s=>{let{from:r,to:o}=s;if(r==o){let n=e(s);n<r?(i="delete.backward",n=kt(t,n,!1)):n>r&&(i="delete.forward",n=kt(t,n,!0)),r=Math.min(r,n),o=Math.max(o,n)}else r=kt(t,r,!1),o=kt(t,o,!0);return r==o?{range:s}:{changes:{from:r,to:o},range:n.jT.cursor(r,r<s.head?-1:1)}}));return!o.changes.empty&&(t.dispatch(r.update(o,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?s.tk.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function kt(t,e,i){if(t instanceof s.tk)for(let n of t.state.facet(s.tk.atomicRanges).map((e=>e(t))))n.between(e,e,((t,n)=>{t<e&&n>e&&(e=i?n:t)}));return e}const St=(t,e,i)=>xt(t,(s=>{let o,l,h=s.from,{state:a}=t,c=a.doc.lineAt(h);if(i&&!e&&h>c.from&&h<c.from+200&&!/[^ \t]/.test(o=c.text.slice(0,h-c.from))){if("\t"==o[o.length-1])return h-1;let t=(0,n.IS)(o,a.tabSize)%(0,r.y1)(a)||(0,r.y1)(a);for(let e=0;e<t&&" "==o[o.length-1-e];e++)h--;l=h}else l=(0,n.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,n.cp)(c.text,l-c.from,!1,!1)+c.from);return l})),At=t=>St(t,!1,!0),Mt=t=>St(t,!0,!1),Ct=(t,e)=>xt(t,(i=>{let s=i.head,{state:r}=t,o=r.doc.lineAt(s),l=r.charCategorizer(s);for(let t=null;;){if(s==(e?o.to:o.from)){s==i.head&&o.number!=(e?r.doc.lines:1)&&(s+=e?1:-1);break}let h=(0,n.cp)(o.text,s-o.from,e)+o.from,a=o.text.slice(Math.min(s,h)-o.from,Math.max(s,h)-o.from),c=l(a);if(null!=t&&c!=t)break;" "==a&&s==i.head||(t=c),s=h}return s})),Tt=t=>Ct(t,!1);function Ot(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 Dt(t,e,i){if(t.readOnly)return!1;let s=[],r=[];for(let e of Ot(t)){if(i?e.to==t.doc.length:0==e.from)continue;let o=t.doc.lineAt(i?e.to+1:e.from-1),l=o.length+1;if(i){s.push({from:e.to,to:o.to},{from:e.from,insert:o.text+t.lineBreak});for(let i of e.ranges)r.push(n.jT.range(Math.min(t.doc.length,i.anchor+l),Math.min(t.doc.length,i.head+l)))}else{s.push({from:o.from,to:e.from},{from:e.to,insert:t.lineBreak+o.text});for(let t of e.ranges)r.push(n.jT.range(t.anchor-l,t.head-l))}}return!!s.length&&(e(t.update({changes:s,scrollIntoView:!0,selection:n.jT.create(r,t.selection.mainIndex),userEvent:"move.line"})),!0)}function Et(t,e,i){if(t.readOnly)return!1;let n=[];for(let e of Ot(t))i?n.push({from:e.from,insert:t.doc.slice(e.from,e.to)+t.lineBreak}):n.push({from:e.to,insert:t.lineBreak+t.doc.slice(e.from,e.to)});return e(t.update({changes:n,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Bt=Pt(!1);function Pt(t){return({state:e,dispatch:i})=>{if(e.readOnly)return!1;let s=e.changeByRange((i=>{let{from:s,to:l}=i,h=e.doc.lineAt(s),a=!t&&s==l&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=(0,r.qz)(t).resolveInner(e),s=n.childBefore(e),l=n.childAfter(e);return s&&l&&s.to<=e&&l.from>=e&&(i=s.type.prop(o.md.closedBy))&&i.indexOf(l.name)>-1&&t.doc.lineAt(s.to).from==t.doc.lineAt(l.from).from&&!/\S/.test(t.sliceDoc(s.to,l.from))?{from:s.to,to:l.from}:null}(e,s);t&&(s=l=(l<=h.to?h:e.doc.lineAt(l)).to);let c=new r.Gn(e,{simulateBreak:s,simulateDoubleBreak:!!a}),f=(0,r.K0)(c,s);for(null==f&&(f=(0,n.IS)(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));l<h.to&&/\s/.test(h.text[l-h.from]);)l++;a?({from:s,to:l}=a):s>h.from&&s<h.from+100&&!/\S/.test(h.text.slice(0,s))&&(s=h.from);let u=["",(0,r.SS)(e,f)];return a&&u.push((0,r.SS)(e,c.lineIndent(h.from,-1))),{changes:{from:s,to:l,insert:n.xv.of(u)},range:n.jT.cursor(s+1+u[1].length)}}));return i(e.update(s,{scrollIntoView:!0,userEvent:"input"})),!0}}function Rt(t,e){let i=-1;return t.changeByRange((s=>{let r=[];for(let n=s.from;n<=s.to;){let o=t.doc.lineAt(n);o.number>i&&(s.empty||s.to>o.from)&&(e(o,r,s),i=o.number),n=o.to+1}let o=t.changes(r);return{changes:r,range:n.jT.range(o.mapPos(s.anchor,1),o.mapPos(s.head,1))}}))}const Nt=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Rt(t,((e,i)=>{i.push({from:e.from,insert:t.facet(r.c)})})),{userEvent:"input.indent"})),!0),Lt=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Rt(t,((e,i)=>{let s=/^\s*/.exec(e.text)[0];if(!s)return;let o=(0,n.IS)(s,t.tabSize),l=0,h=(0,r.SS)(t,Math.max(0,o-(0,r.y1)(t)));for(;l<s.length&&l<h.length&&s.charCodeAt(l)==h.charCodeAt(l);)l++;i.push({from:e.from+l,to:e.from+s.length,insert:h.slice(l)})})),{userEvent:"delete.dedent"})),!0),It=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:t=>j(t,(e=>X(t.state,e,!$(t)))),shift:t=>ot(t,(e=>X(t.state,e,!$(t))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>j(t,(e=>X(t.state,e,$(t)))),shift:t=>ot(t,(e=>X(t.state,e,$(t))))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>Dt(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>Et(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>Dt(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>Et(t,e,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let i=t.selection,s=null;return i.ranges.length>1?s=n.jT.create([i.main]):i.main.empty||(s=n.jT.create([n.jT.cursor(i.main.head)])),!!s&&(e(z(t,s)),!0)}},{key:"Mod-Enter",run:Pt(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let i=Ot(t).map((({from:e,to:i})=>n.jT.range(e,Math.min(i+1,t.doc.length))));return e(t.update({selection:n.jT.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let i=F(t.selection,(e=>{let i=(0,r.qz)(t),s=i.resolveStack(e.from,1);if(e.empty){let t=i.resolveStack(e.from,-1);t.node.from>=s.node.from&&t.node.to<=s.node.to&&(s=t)}for(let t=s;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 n.jT.range(i.to,i.from)}return e}));return!i.eq(t.selection)&&(e(z(t,i)),!0)},preventDefault:!0},{key:"Mod-[",run:Lt},{key:"Mod-]",run:Nt},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new r.Gn(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),s=Rt(t,((e,s,o)=>{let l=(0,r.K0)(n,e.from);if(null==l)return;/\S/.test(e.text)||(l=0);let h=/^\s*/.exec(e.text)[0],a=(0,r.SS)(t,l);(h!=a||o.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:t=>{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(Ot(e).map((({from:t,to:i})=>(t>0?t--:i<e.doc.length&&i++,{from:t,to:i})))),n=F(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}},{key:"Shift-Mod-\\",run:({state:t,dispatch:e})=>rt(t,e,!1)},{key:"Mod-/",run:t=>{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=f(t.state,i.from);return n.line?h(t):!!n.block&&c(t)}},{key:"Alt-A",run:a},{key:"Ctrl-m",mac:"Shift-Alt-m",run:t=>(t.setTabFocusMode(),!0)}].concat([{key:"ArrowLeft",run:K,shift:ht,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>U(t,!$(t)),shift:t=>ct(t,!$(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>j(t,(e=>st(t,e,!$(t)))),shift:t=>ot(t,(e=>st(t,e,!$(t)))),preventDefault:!0},{key:"ArrowRight",run:J,shift:at,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>U(t,$(t)),shift:t=>ct(t,$(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>j(t,(e=>st(t,e,$(t)))),shift:t=>ot(t,(e=>st(t,e,$(t)))),preventDefault:!0},{key:"ArrowUp",run:Q,shift:ut,preventDefault:!0},{mac:"Cmd-ArrowUp",run:vt,shift:yt},{mac:"Ctrl-ArrowUp",run:it,shift:gt},{key:"ArrowDown",run:Z,shift:dt,preventDefault:!0},{mac:"Cmd-ArrowDown",run:wt,shift:bt},{mac:"Ctrl-ArrowDown",run:nt,shift:mt},{key:"PageUp",run:it,shift:gt},{key:"PageDown",run:nt,shift:mt},{key:"Home",run:t=>j(t,(e=>st(t,e,!1))),shift:t=>ot(t,(e=>st(t,e,!1))),preventDefault:!0},{key:"Mod-Home",run:vt,shift:yt},{key:"End",run:t=>j(t,(e=>st(t,e,!0))),shift:t=>ot(t,(e=>st(t,e,!0))),preventDefault:!0},{key:"Mod-End",run:wt,shift:bt},{key:"Enter",run:Bt,shift:Bt},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:At,shift:At},{key:"Delete",run:Mt},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Tt},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>Ct(t,!0)},{mac:"Mod-Backspace",run:t=>xt(t,(e=>{let i=t.moveToLineBoundary(e,!1).head;return e.head>i?i:Math.max(0,e.head-1)}))},{mac:"Mod-Delete",run:t=>xt(t,(e=>{let i=t.moveToLineBoundary(e,!0).head;return e.head<i?i:Math.min(t.state.doc.length,e.head+1)}))}].concat([{key:"Ctrl-b",run:K,shift:ht,preventDefault:!0},{key:"Ctrl-f",run:J,shift:at},{key:"Ctrl-p",run:Q,shift:ut},{key:"Ctrl-n",run:Z,shift:dt},{key:"Ctrl-a",run:t=>j(t,(e=>n.jT.cursor(t.lineBlockAt(e.head).from,1))),shift:t=>ot(t,(e=>n.jT.cursor(t.lineBlockAt(e.head).from)))},{key:"Ctrl-e",run:t=>j(t,(e=>n.jT.cursor(t.lineBlockAt(e.head).to,-1))),shift:t=>ot(t,(e=>n.jT.cursor(t.lineBlockAt(e.head).to)))},{key:"Ctrl-d",run:Mt},{key:"Ctrl-h",run:At},{key:"Ctrl-k",run:t=>xt(t,(e=>{let i=t.lineBlockAt(e.head).to;return e.head<i?i:Math.min(t.state.doc.length,e.head+1)}))},{key:"Ctrl-Alt-h",run:Tt},{key:"Ctrl-o",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((t=>({changes:{from:t.from,to:t.to,insert:n.xv.of(["",""])},range:n.jT.cursor(t.from)})));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({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,s=t.doc.lineAt(i),r=i==s.from?i-1:(0,n.cp)(s.text,i-s.from,!1)+s.from,o=i==s.to?i+1:(0,n.cp)(s.text,i-s.from,!0)+s.from;return{changes:{from:r,to:o,insert:t.doc.slice(i,o).append(t.doc.slice(r,i))},range:n.jT.cursor(o)}}));return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:nt}].map((t=>({mac:t.key,run:t.run,shift:t.shift})))))},51801:function(t,e,i){i.d(e,{Gn:()=>D,K0:()=>O,QN:()=>ht,Qf:()=>nt,SS:()=>T,Um:()=>mt,c:()=>M,il:()=>kt,mi:()=>et,nF:()=>lt,qz:()=>p,rs:()=>V,y1:()=>C});i(92745),i(9359),i(70104),i(52924);var n,s=i(70585),r=i(89276),o=i(76641),l=i(13419),h=i(29933);const a=new s.md;function c(t){return r.r$.define({combine:t?e=>e.concat(t):void 0})}const f=new s.md;class u{constructor(t,e,i=[],n=""){this.data=t,this.name=n,r.yy.prototype.hasOwnProperty("tree")||Object.defineProperty(r.yy.prototype,"tree",{get(){return p(this)}}),this.parser=e,this.extension=[S.of(this),r.yy.languageData.of(((t,e,i)=>{let n=d(t,e,i),s=n.type.prop(a);if(!s)return[];let r=t.facet(s),o=n.type.prop(f);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 d(t,e,i).type.prop(a)==this.data}findRegions(t){let e=t.facet(S);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(a)==this.data)return void i.push({from:e,to:e+t.length});let r=t.prop(s.md.mounted);if(r){if(r.tree.prop(a)==this.data){if(r.overlay)for(let t of r.overlay)i.push({from:t.from+e,to:t.to+e});else i.push({from:e,to:e+t.length});return}if(r.overlay){let t=i.length;if(n(r.tree,r.overlay[0].from+e),i.length>t)return}}for(let i=0;i<t.children.length;i++){let r=t.children[i];r instanceof s.mp&&n(r,t.positions[i]+e)}};return n(p(t),0),i}get allowsNesting(){return!0}}function d(t,e,i){let n=t.facet(S),r=p(t).topNode;if(!n||n.allowsNesting)for(let t=r;t;t=t.enter(e,i,s.vj.ExcludeBuffers))t.type.isTop&&(r=t);return r}u.setState=r.Py.define();function p(t){let e=t.field(u.state,!1);return e?e.tree:s.mp.empty}class g{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 m=null;class v{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 v(t,e,[],s.mp.empty,0,i,[],null)}startParse(){return this.parser.startParse(new g(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=s.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(s.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(s.i9.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=m;m=this;try{return t()}finally{m=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=w(t,e.from,e.to);return t}changes(t,e){let{fragments:i,tree:n,treeLen:r,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=s.i9.applyChanges(i,e),n=s.mp.empty,r=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 v(this.parser,e,i,n,r,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 e=0;e<this.skipped.length;e++){let{from:i,to:n}=this.skipped[e];i<t.to&&n>t.from&&(this.fragments=w(this.fragments,i,n),this.skipped.splice(e--,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 s._b{createParse(e,i,n){let r=n[0].from,o=n[n.length-1].to;return{parsedPos:r,advance(){let e=m;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 s.mp(s.Jq.none,[],[],o-r)},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 m}}function w(t,e,i){return s.i9.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class y{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 y(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=v.create(t.facet(S).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new y(i)}}u.state=r.QQ.define({create:y.init,update(t,e){for(let t of e.effects)if(t.is(u.setState))return t.value;return e.startState.facet(S)!=e.state.facet(S)?y.init(e.state):t.apply(e)}});let b=t=>{let e=setTimeout((()=>t()),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(b=t=>{let e=-1,i=setTimeout((()=>{e=requestIdleCallback(t,{timeout:400})}),100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const x="undefined"!=typeof navigator&&(null===(n=navigator.scheduling)||void 0===n?void 0:n.isInputPending)?()=>navigator.scheduling.isInputPending():null,k=o.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(u.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(u.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=b(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(u.state);if(s.tree==s.context.tree&&s.context.isDone(n+1e5))return;let r=Date.now()+Math.min(this.chunkBudget,100,t&&!x?Math.max(25,t.timeRemaining()-5):1e9),o=s.context.treeLen<n&&i.doc.length>n+1e3,l=s.context.work((()=>x&&x()||Date.now()>r),n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(l||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:u.setState.of(new y(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,o.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()}}}),S=r.r$.define({combine:t=>t.length?t[0]:null,enables:t=>[u.state,k,o.tk.contentAttributes.compute([t],(e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}}))]});const A=r.r$.define(),M=r.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 C(t){let e=t.facet(M);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function T(t,e){let i="",n=t.tabSize,s=t.facet(M)[0];if("\t"==s){for(;e>=n;)i+="\t",e-=n;s=" "}for(let t=0;t<e;t++)i+=s;return i}function O(t,e){t instanceof r.yy&&(t=new D(t));for(let i of t.state.facet(A)){let n=i(t,e);if(void 0!==n)return n}let i=p(t.state);return i.length>=e?function(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 B(n,t,i)}(t,i,e):null}class D{constructor(t,e={}){this.state=t,this.options=e,this.unit=C(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,r.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 E=new s.md;function B(t,e,i){for(let n=t;n;n=n.next){let t=P(n.node);if(t)return t(N.create(e,i,n))}return 0}function P(t){let e=t.type.prop(E);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(s.md.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>I(t,!0,1,void 0,n&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}(t)?e.from:void 0)}return null==t.parent?R:null}function R(){return 0}class N extends D{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 N(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(L(i,t))break;e=this.state.doc.lineAt(i.from)}return this.lineIndent(e.from)}continue(){return B(this.context.next,this.base,this.pos)}}function L(t,e){for(let i=e;i;i=i.parent)if(t==i)return!0;return!1}function I(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?function(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 t=i.to;;){let s=e.childAfter(t);if(!s||s==n)return null;if(!s.type.isSkipped){if(s.from>=o)return null;let t=/^ */.exec(r.text.slice(i.to-r.from))[0].length;return{from:i.from,to:i.to+t}}t=s.to}}(t):null;return h?l?t.column(h.from):t.column(h.to):t.baseIndent+(l?0:t.unit*i)}const V=r.r$.define(),H=new s.md;function W(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function F(t,e,i){for(let n of t.facet(V)){let s=n(t,e,i);if(s)return s}return function(t,e,i){let n=p(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(H);if(l&&(o.to<n.length-50||n.length==t.doc.length||!W(o))){let n=l(o,t);n&&n.from<=i&&n.from>=e&&n.to>i&&(s=n)}}return s}(t,e,i)}function z(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 j=r.Py.define({map:z}),_=r.Py.define({map:z});const q=r.QQ.define({create:()=>o.p.none,update(t,e){t=t.map(e.changes);for(let i of e.effects)if(i.is(j)&&!K(t,i.value.from,i.value.to)){let{preparePlaceholder:n}=e.state.facet(U),s=n?o.p.replace({widget:new Q(n(e.state,i.value))}):Y;t=t.update({add:[s.range(i.value.from,i.value.to)]})}else i.is(_)&&(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=>o.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(Y.range(n,s))}return o.p.set(e,!0)}});function $(t,e,i){var n;let s=null;return null===(n=t.field(q,!1))||void 0===n||n.between(e,i,((t,e)=>{(!s||s.from>t)&&(s={from:t,to:e})})),s}function K(t,e,i){let n=!1;return t.between(e,e,((t,s)=>{t==e&&s==i&&(n=!0)})),n}const J={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},U=r.r$.define({combine:t=>(0,r.BO)(t,J)});function G(t){let e=[q,it];return t&&e.push(U.of(t)),e}function X(t,e){let{state:i}=t,n=i.facet(U),s=e=>{let i=t.lineBlockAt(t.posAtDOM(e.target)),n=$(t.state,i.from,i.to);n&&t.dispatch({effects:_.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 Y=o.p.replace({widget:new class extends o.l9{toDOM(t){return X(t,null)}}});class Q extends o.l9{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return X(t,this.value)}}const Z={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class tt extends o.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 et(t={}){let e=Object.assign(Object.assign({},Z),t),i=new tt(e,!0),n=new tt(e,!1),s=o.lg.fromClass(class{constructor(t){this.from=t.viewport.from,this.markers=this.buildMarkers(t)}update(t){(t.docChanged||t.viewportChanged||t.startState.facet(S)!=t.state.facet(S)||t.startState.field(q,!1)!=t.state.field(q,!1)||p(t.startState)!=p(t.state)||e.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view))}buildMarkers(t){let e=new r.f_;for(let s of t.viewportLineBlocks){let r=$(t.state,s.from,s.to)?n:F(t.state,s.from,s.to)?i:null;r&&e.add(s.from,s.from,r)}return e.finish()}}),{domEventHandlers:l}=e;return[s,(0,o.v5)({class:"cm-foldGutter",markers(t){var e;return(null===(e=t.plugin(s))||void 0===e?void 0:e.markers)||r.Xs.empty},initialSpacer:()=>new tt(e,!1),domEventHandlers:Object.assign(Object.assign({},l),{click:(t,e,i)=>{if(l.click&&l.click(t,e,i))return!0;let n=$(t.state,e.from,e.to);if(n)return t.dispatch({effects:_.of(n)}),!0;let s=F(t.state,e.from,e.to);return!!s&&(t.dispatch({effects:j.of(s)}),!0)}})}),G()]}const it=o.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 nt{constructor(t,e){let i;function n(t){let e=h.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 u?t=>t.prop(a)==r.data:r?t=>t==r:void 0,this.style=(0,l.QR)(t.map((t=>({tag:t.tag,class:t.class||n(Object.assign({},t,{tag:null}))}))),{all:s}).style,this.module=i?new h.V(i):null,this.themeType=e.themeType}static define(t,e){return new nt(t,e||{})}}const st=r.r$.define(),rt=r.r$.define({combine:t=>t.length?[t[0]]:null});function ot(t){let e=t.facet(st);return e.length?e:t.facet(rt)}function lt(t,e){let i,n=[ct];return t instanceof nt&&(t.module&&n.push(o.tk.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?n.push(rt.of(t)):i?n.push(st.computeN([o.tk.darkTheme],(e=>e.facet(o.tk.darkTheme)==("dark"==i)?[t]:[]))):n.push(st.of(t)),n}function ht(t,e,i){let n=ot(t),s=null;if(n)for(let t of n)if(!t.scope||i&&t.scope(i)){let i=t.style(e);i&&(s=s?s+" "+i:i)}return s}class at{constructor(t){this.markCache=Object.create(null),this.tree=p(t.state),this.decorations=this.buildDeco(t,ot(t.state)),this.decoratedTo=t.viewport.to}update(t){let e=p(t.state),i=ot(t.state),n=i!=ot(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 o.p.none;let i=new r.f_;for(let{from:n,to:s}of t.visibleRanges)(0,l.bW)(this.tree,e,((t,e,n)=>{i.add(t,e,this.markCache[n]||(this.markCache[n]=o.p.mark({class:n})))}),n,s);return i.finish()}}const ct=r.Wl.high(o.lg.fromClass(at,{decorations:t=>t.decorations})),ft=(l.pJ.meta,l.pJ.link,l.pJ.heading,l.pJ.emphasis,l.pJ.strong,l.pJ.strikethrough,l.pJ.keyword,l.pJ.atom,l.pJ.bool,l.pJ.url,l.pJ.contentSeparator,l.pJ.labelName,l.pJ.literal,l.pJ.inserted,l.pJ.string,l.pJ.deleted,l.pJ.regexp,l.pJ.escape,l.pJ.string,l.pJ.variableName,l.pJ.variableName,l.pJ.typeName,l.pJ.namespace,l.pJ.className,l.pJ.variableName,l.pJ.macroName,l.pJ.propertyName,l.pJ.comment,l.pJ.invalid,1e4),ut="()[]{}";const dt=new s.md;function pt(t,e,i){let n=t.prop(e<0?s.md.openedBy:s.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 gt(t){let e=t.type.prop(dt);return e?e(t.node):t}function mt(t,e,i,n={}){let s=n.maxScanDistance||ft,r=n.brackets||ut,o=p(t),l=o.resolveInner(e,i);for(let n=l;n;n=n.parent){let s=pt(n.type,i,r);if(s&&n.from<n.to){let o=gt(n);if(o&&(i>0?e>=o.from&&e<o.to:e>o.from&&e<=o.to))return vt(t,e,i,n,o,s,r)}}return function(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 t=0;!c.next().done&&t<=r;){let r=c.value;i<0&&(t+=r.length);let l=e+t*i;for(let t=i>0?0:r.length-1,e=i>0?r.length:-1;t!=e;t+=i){let e=o.indexOf(r[t]);if(!(e<0||n.resolveInner(l+t,1).type!=s))if(e%2==0==i>0)f++;else{if(1==f)return{start:a,end:{from:l+t,to:l+t+1},matched:e>>1==h>>1};f--}}i>0&&(t+=r.length)}return c.done?{start:a,matched:!1}:null}(t,e,i,o,l.type,s,r)}function vt(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=gt(c);return{start:h,end:t?{from:t.from,to:t.to}:void 0,matched:!0}}if(pt(c.type,i,o))a++;else if(pt(c.type,-i,o)){if(0==a){let t=gt(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 wt(t,e,i,n=0,s=0){null==e&&-1==(e=t.search(/[^\s\u00a0]/))&&(e=t.length);let r=s;for(let s=n;s<e;s++)9==t.charCodeAt(s)?r+=i-r%i:r++;return r}class yt{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=wt(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:wt(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 bt(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 xt=new WeakMap;class kt extends u{constructor(t){let e,i=c(t.languageData),n={name:(r=t).name||"",token:r.token,blankLine:r.blankLine||(()=>{}),startState:r.startState||(()=>!0),copyState:r.copyState||bt,indent:r.indent||(()=>null),languageData:r.languageData||{},tokenTable:r.tokenTable||Tt,mergeTokens:!1!==r.mergeTokens};var r;super(i,new class extends s._b{createParse(t,i,n){return new Mt(e,t,i,n)}},[],t.name),this.topNode=function(t,e){let i=s.Jq.define({id:Ot.length,name:"Document",props:[a.add((()=>t)),E.add((()=>t=>e.getIndent(t)))],top:!0});return Ot.push(i),i}(i,this),e=this,this.streamParser=n,this.stateAfter=new s.md({perNode:!0}),this.tokenTable=t.tokenTable?new Rt(n.tokenTable):Nt}static define(t){return new kt(t)}getIndent(t){let e,{overrideIndentation:i}=t.options;i&&(e=xt.get(t.state),null!=e&&e<t.pos-1e4&&(e=void 0));let n,s,r=St(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 yt(e.text,t.state.tabSize,t.unit,n<0?void 0:n);for(;o.pos<r-e.from;)Ct(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&&xt.set(t.state,o.from),this.streamParser.indent(s,/^\s*(.*)/.exec(o.text)[1],t)}get allowsNesting(){return!1}}function St(t,e,i,n,r){let o=i>=n&&i+e.length<=r&&e.prop(t.stateAfter);if(o)return{state:t.streamParser.copyState(o),pos:i+e.length};for(let o=e.children.length-1;o>=0;o--){let l=e.children[o],h=i+e.positions[o],a=l instanceof s.mp&&h<r&&St(t,l,h,n,r);if(a)return a}return null}function At(t,e,i,n,r){if(r&&i<=0&&n>=e.length)return e;r||0!=i||e.type!=t.topNode||(r=!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 s.mp){if(!(l=At(t,a,i-h,n-h,r)))break;return r?new s.mp(e.type,e.children.slice(0,o).concat(l),e.positions.slice(0,o+1),h+l.length):l}}return null}class Mt{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 r=v.get(),o=n[0].from,{state:l,tree:h}=function(t,e,i,n,r){for(let s of e){let e,r=s.from+(s.openStart?25:0),o=s.to-(s.openEnd?25:0),l=r<=i&&o>i&&St(t,s.tree,0-s.offset,i,o);if(l&&l.pos<=n&&(e=At(t,s.tree,i+s.offset,l.pos+s.offset,!1)))return{state:l.state,tree:e}}return{state:t.streamParser.startState(r?C(r):4),tree:s.mp.empty}}(t,i,o,this.to,null==r?void 0:r.state);this.state=l,this.parsedPos=this.chunkStart=o+h.length;for(let t=0;t<h.children.length;t++)this.chunks.push(h.children[t]),this.chunkPos.push(h.positions[t]);r&&this.parsedPos<r.viewport.from-1e5&&n.some((t=>t.from<=r.viewport.from&&t.to>=r.viewport.from))&&(this.state=this.lang.streamParser.startState(C(r.state)),r.skipUntilInView(this.parsedPos,r.viewport.from),this.parsedPos=r.viewport.from),this.moveRangeIndex()}advance(){let t=v.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 t=this.rangeIndex;;){let n=this.ranges[t].to;if(n>=i)break;if(e=e.slice(0,n-(i-e.length)),t++,t==this.ranges.length)break;let s=this.ranges[t].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(),n=0,{streamParser:s}=this.lang,r=new yt(e,t?t.state.tabSize:4,t?C(t.state):2);if(r.eol())s.blankLine(this.state,r.indentUnit);else for(;!r.eol();){let t=Ct(s.token,r,this.state);if(t&&(n=this.emitToken(this.lang.tokenTable.resolve(t),this.parsedPos+r.start,this.parsedPos+r.pos,n)),r.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let t=s.mp.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:Dt,topID:0,maxBufferLength:2048,reused:this.chunkReused});t=new s.mp(t.type,t.children,t.positions,t.len