diff --git a/4401.index.js b/4401.index.js index fdd08c1a..08562259 100644 --- a/4401.index.js +++ b/4401.index.js @@ -1,2 +1,2 @@ -"use strict";(self.webpackChunkthebe=self.webpackChunkthebe||[]).push([[4401],{4401:(r,e,t)=>{t.r(e),t.d(e,{rpmChanges:()=>o,rpmSpec:()=>h});var a=/^-+$/,n=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ?\d{1,2} \d{2}:\d{2}(:\d{2})? [A-Z]{3,4} \d{4} - /,c=/^[\w+.-]+@[\w.-]+/;const o={name:"rpmchanges",token:function(r){if(r.sol()){if(r.match(a))return"tag";if(r.match(n))return"tag"}return r.match(c)?"string":(r.next(),null)}};var i=/^(i386|i586|i686|x86_64|ppc64le|ppc64|ppc|ia64|s390x|s390|sparc64|sparcv9|sparc|noarch|alphaev6|alpha|hppa|mipsel)/,p=/^[a-zA-Z0-9()]+:/,u=/^%(debug_package|package|description|prep|build|install|files|clean|changelog|preinstall|preun|postinstall|postun|pretrans|posttrans|pre|post|triggerin|triggerun|verifyscript|check|triggerpostun|triggerprein|trigger)/,s=/^%(ifnarch|ifarch|if)/,l=/^%(else|endif)/,m=/^(\!|\?|\<\=|\<|\>\=|\>|\=\=|\&\&|\|\|)/;const h={name:"rpmspec",startState:function(){return{controlFlow:!1,macroParameters:!1,section:!1}},token:function(r,e){if("#"==r.peek())return r.skipToEnd(),"comment";if(r.sol()){if(r.match(p))return"header";if(r.match(u))return"atom"}if(r.match(/^\$\w+/))return"def";if(r.match(/^\$\{\w+\}/))return"def";if(r.match(l))return"keyword";if(r.match(s))return e.controlFlow=!0,"keyword";if(e.controlFlow){if(r.match(m))return"operator";if(r.match(/^(\d+)/))return"number";r.eol()&&(e.controlFlow=!1)}if(r.match(i))return r.eol()&&(e.controlFlow=!1),"number";if(r.match(/^%[\w]+/))return r.match("(")&&(e.macroParameters=!0),"keyword";if(e.macroParameters){if(r.match(/^\d+/))return"number";if(r.match(")"))return e.macroParameters=!1,"keyword"}return r.match(/^%\{\??[\w \-\:\!]+\}/)?(r.eol()&&(e.controlFlow=!1),"def"):(r.next(),null)}}}}]); +"use strict";(self.webpackChunkthebe=self.webpackChunkthebe||[]).push([[4401],{6782:(r,e,t)=>{t.r(e),t.d(e,{rpmChanges:()=>o,rpmSpec:()=>h});var a=/^-+$/,n=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ?\d{1,2} \d{2}:\d{2}(:\d{2})? [A-Z]{3,4} \d{4} - /,c=/^[\w+.-]+@[\w.-]+/;const o={name:"rpmchanges",token:function(r){if(r.sol()){if(r.match(a))return"tag";if(r.match(n))return"tag"}return r.match(c)?"string":(r.next(),null)}};var i=/^(i386|i586|i686|x86_64|ppc64le|ppc64|ppc|ia64|s390x|s390|sparc64|sparcv9|sparc|noarch|alphaev6|alpha|hppa|mipsel)/,p=/^[a-zA-Z0-9()]+:/,u=/^%(debug_package|package|description|prep|build|install|files|clean|changelog|preinstall|preun|postinstall|postun|pretrans|posttrans|pre|post|triggerin|triggerun|verifyscript|check|triggerpostun|triggerprein|trigger)/,s=/^%(ifnarch|ifarch|if)/,l=/^%(else|endif)/,m=/^(\!|\?|\<\=|\<|\>\=|\>|\=\=|\&\&|\|\|)/;const h={name:"rpmspec",startState:function(){return{controlFlow:!1,macroParameters:!1,section:!1}},token:function(r,e){if("#"==r.peek())return r.skipToEnd(),"comment";if(r.sol()){if(r.match(p))return"header";if(r.match(u))return"atom"}if(r.match(/^\$\w+/))return"def";if(r.match(/^\$\{\w+\}/))return"def";if(r.match(l))return"keyword";if(r.match(s))return e.controlFlow=!0,"keyword";if(e.controlFlow){if(r.match(m))return"operator";if(r.match(/^(\d+)/))return"number";r.eol()&&(e.controlFlow=!1)}if(r.match(i))return r.eol()&&(e.controlFlow=!1),"number";if(r.match(/^%[\w]+/))return r.match("(")&&(e.macroParameters=!0),"keyword";if(e.macroParameters){if(r.match(/^\d+/))return"number";if(r.match(")"))return e.macroParameters=!1,"keyword"}return r.match(/^%\{\??[\w \-\:\!]+\}/)?(r.eol()&&(e.controlFlow=!1),"def"):(r.next(),null)}}}}]); //# sourceMappingURL=4401.index.js.map \ No newline at end of file diff --git a/6807.index.js b/6807.index.js index d22ad857..711d5fc2 100644 --- a/6807.index.js +++ b/6807.index.js @@ -1,3 +1,3 @@ /*! For license information please see 6807.index.js.LICENSE.txt */ -(self.webpackChunkthebe=self.webpackChunkthebe||[]).push([[6807],{6807:(e,t,n)=>{"use strict";n.d(t,{Component:()=>zr});var i=n(4830),s=n(3173),r=n(9587),o=n(9066);function a(e,t){return({state:n,dispatch:i})=>{if(n.readOnly)return!1;let s=e(t,n);return!!s&&(i(n.update(s)),!0)}}const l=a(p,0),h=a(d,0),c=a(((e,t)=>d(e,t,function(e){let t=[];for(let n of e.selection.ranges){let i=e.doc.lineAt(n.from),s=n.to<=i.to?i:e.doc.lineAt(n.to),r=t.length-1;r>=0&&t[r].to>i.from?t[r].to=s.to:t.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:s.to})}return t}(t))),0);function u(e,t){let n=e.languageDataAt("commentTokens",t);return n.length?n[0]:{}}const f=50;function d(e,t,n=t.selection.ranges){let i=n.map((e=>u(t,e.from).block));if(!i.every((e=>e)))return null;let s=n.map(((e,n)=>function(e,{open:t,close:n},i,s){let r,o,a=e.sliceDoc(i-f,i),l=e.sliceDoc(s,s+f),h=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(l)[0].length,u=a.length-h;if(a.slice(u-t.length,u)==t&&l.slice(c,c+n.length)==n)return{open:{pos:i-h,margin:h&&1},close:{pos:s+c,margin:c&&1}};s-i<=2*f?r=o=e.sliceDoc(i,s):(r=e.sliceDoc(i,i+f),o=e.sliceDoc(s-f,s));let d=/^\s*/.exec(r)[0].length,p=/\s*$/.exec(o)[0].length,m=o.length-p-n.length;return r.slice(d,d+t.length)==t&&o.slice(m,m+n.length)==n?{open:{pos:i+d+t.length,margin:/\s/.test(r.charAt(d+t.length))?1:0},close:{pos:s-p-n.length,margin:/\s/.test(o.charAt(m-1))?1:0}}:null}(t,i[n],e.from,e.to)));if(2!=e&&!s.every((e=>e)))return{changes:t.changes(n.map(((e,t)=>s[t]?[]:[{from:e.from,insert:i[t].open+" "},{from:e.to,insert:" "+i[t].close}])))};if(1!=e&&s.some((e=>e))){let e=[];for(let t,n=0;ns&&(e==r||r>l.from)){s=l.from;let e=/^\s*/.exec(l.text)[0].length,t=e==l.length,n=l.text.slice(e,e+a.length)==a?e:-1;ee.comment<0&&(!e.empty||e.single)))){let e=[];for(let{line:t,token:n,indent:s,empty:r,single:o}of i)!o&&r||e.push({from:t.from+s,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&i.some((e=>e.comment>=0))){let e=[];for(let{line:t,comment:n,token:s}of i)if(n>=0){let i=t.from+n,r=i+s.length;" "==t.text[r-t.from]&&r++,e.push({from:i,to:r})}return{changes:e}}return null}const m=i.YH.define(),g=i.sj.define();class b{constructor(e,t,n,i,s){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new b(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null===(e=this.changes)||void 0===e?void 0:e.toJSON(),mapped:null===(t=this.mapped)||void 0===t?void 0:t.toJSON(),startSelection:null===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map((e=>e.toJSON()))}}static fromJSON(e){return new b(e.changes&&i.VR.fromJSON(e.changes),[],e.mapped&&i.Gu.fromJSON(e.mapped),e.startSelection&&i.OF.fromJSON(e.startSelection),e.selectionsAfter.map(i.OF.fromJSON))}static fromTransaction(e,t){let n=x;for(let t of e.startState.facet(g)){let i=t(e);i.length&&(n=n.concat(i))}return!n.length&&e.changes.empty?null:new b(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,x)}static selection(e){return new b(void 0,x,void 0,void 0,e)}}function y(e,t,n,i){let s=t+1>n+20?t-n-1:0,r=e.slice(s,t);return r.push(i),r}function v(e,t){return e.length?t.length?e.concat(t):e:t}const x=[];function w(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function k(e,t){if(!e.length)return e;let n=e.length,i=x;for(;n;){let s=S(e[n-1],t,i);if(s.changes&&!s.changes.empty||s.effects.length){let t=e.slice(0,n);return t[n-1]=s,t}t=s.mapped,n--,i=s.selectionsAfter}return i.length?[b.selection(i)]:x}function S(e,t,n){let s=v(e.selectionsAfter.length?e.selectionsAfter.map((e=>e.map(t))):x,n);if(!e.changes)return b.selection(s);let r=e.changes.map(t),o=t.mapDesc(e.changes,!0),a=e.mapped?e.mapped.composeDesc(o):o;return new b(r,i.Pe.mapEffects(e.effects,t),a,e.startSelection.map(o),s)}const C=/^(input\.type|delete)($|\.)/;class A{constructor(e,t,n=0,i=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=i}isolate(){return this.prevTime?new A(this.done,this.undone):this}addChanges(e,t,n,s,r){let o=this.done,a=o[o.length-1];return o=a&&a.changes&&!a.changes.empty&&e.changes&&(!n||C.test(n))&&(!a.selectionsAfter.length&&t-this.prevTimen.push(e,t))),t.iterChangedRanges(((e,t,s,r)=>{for(let e=0;e=t&&s<=o&&(i=!0)}})),i}(a.changes,e.changes))||"input.type.compose"==n)?y(o,o.length-1,s.minDepth,new b(e.changes.compose(a.changes),v(i.Pe.mapEffects(e.effects,a.changes),a.effects),a.mapped,a.startSelection,x)):y(o,o.length,s.minDepth,e),new A(o,x,t,n)}addSelection(e,t,n,i){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:x;return s.length>0&&t-this.prevTimee.empty!=o.ranges[t].empty)).length)?this:new A(function(e,t){if(e.length){let n=e[e.length-1],i=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-200));return i.length&&i[i.length-1].eq(t)?e:(i.push(t),y(e,e.length-1,1e9,n.setSelAfter(i)))}return[b.selection([t])]}(this.done,e),this.undone,t,n);var r,o}addMapping(e){return new A(k(this.done,e),k(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let i=0==e?this.done:this.undone;if(0==i.length)return null;let s=i[i.length-1],r=s.selectionsAfter[0]||t.selection;if(n&&s.selectionsAfter.length)return t.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:m.of({side:e,rest:w(i),selection:r}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let n=1==i.length?x:i.slice(0,i.length-1);return s.mapped&&(n=k(n,s.mapped)),t.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:m.of({side:e,rest:n,selection:r}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}return null}}function O(e,t){return i.OF.create(e.ranges.map(t),e.mainIndex)}function M(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function _({state:e,dispatch:t},n){let i=O(e.selection,n);return!i.eq(e.selection,!0)&&(t(M(e,i)),!0)}function T(e,t){return i.OF.cursor(t?e.to:e.from)}function N(e,t){return _(e,(n=>n.empty?e.moveByChar(n,t):T(n,t)))}function E(e){return e.textDirectionAt(e.state.selection.main.head)==s.OP.LTR}A.empty=new A(x,x);const D=e=>N(e,!E(e)),P=e=>N(e,E(e));function R(e,t){return _(e,(n=>n.empty?e.moveByGroup(n,t):T(n,t)))}function j(e,t,n){if(t.type.prop(n))return!0;let i=t.to-t.from;return i&&(i>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function I(e,t,n){let s,a,l=(0,r.mv)(e).resolveInner(t.head),h=n?o.uY.closedBy:o.uY.openedBy;for(let i=t.head;;){let t=n?l.childAfter(i):l.childBefore(i);if(!t)break;j(e,t,h)?l=t:i=n?t.to:t.from}return a=l.type.prop(h)&&(s=n?(0,r.jU)(e,l.from,1):(0,r.jU)(e,l.to,-1))&&s.matched?n?s.end.to:s.end.from:n?l.to:l.from,i.OF.cursor(a,n?-1:1)}function L(e,t){return _(e,(n=>{if(!n.empty)return T(n,t);let i=e.moveVertically(n,t);return i.head!=n.head?i:e.moveToLineBoundary(n,t)}))}"undefined"!=typeof Intl&&Intl.Segmenter;const B=e=>L(e,!1),F=e=>L(e,!0);function z(e){let t,n=e.scrollDOM.clientHeightn.empty?e.moveVertically(n,t,i.height):T(n,t)));if(o.eq(r.selection))return!1;if(i.selfScroll){let t=e.coordsAtPos(r.selection.main.head),a=e.scrollDOM.getBoundingClientRect(),l=a.top+i.marginTop,h=a.bottom-i.marginBottom;t&&t.top>l&&t.bottom$(e,!1),q=e=>$(e,!0);function V(e,t,n){let s=e.lineBlockAt(t.head),r=e.moveToLineBoundary(t,n);if(r.head==t.head&&r.head!=(n?s.to:s.from)&&(r=e.moveToLineBoundary(t,n,!1)),!n&&r.head==s.from&&s.length){let n=/^\s*/.exec(e.state.sliceDoc(s.from,Math.min(s.from+100,s.to)))[0].length;n&&t.head!=s.from+n&&(r=i.OF.cursor(s.from+n))}return r}function W(e,t){let n=O(e.state.selection,(e=>{let n=t(e);return i.OF.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)}));return!n.eq(e.state.selection)&&(e.dispatch(M(e.state,n)),!0)}function G(e,t){return W(e,(n=>e.moveByChar(n,t)))}const U=e=>G(e,!E(e)),K=e=>G(e,E(e));function Y(e,t){return W(e,(n=>e.moveByGroup(n,t)))}function J(e,t){return W(e,(n=>e.moveVertically(n,t)))}const X=e=>J(e,!1),Z=e=>J(e,!0);function Q(e,t){return W(e,(n=>e.moveVertically(n,t,z(e).height)))}const ee=e=>Q(e,!1),te=e=>Q(e,!0),ne=({state:e,dispatch:t})=>(t(M(e,{anchor:0})),!0),ie=({state:e,dispatch:t})=>(t(M(e,{anchor:e.doc.length})),!0),se=({state:e,dispatch:t})=>(t(M(e,{anchor:e.selection.main.anchor,head:0})),!0),re=({state:e,dispatch:t})=>(t(M(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),oe=({state:e,dispatch:t})=>{let n=e.selection,s=null;return n.ranges.length>1?s=i.OF.create([n.main]):n.main.empty||(s=i.OF.create([i.OF.cursor(n.main.head)])),!!s&&(t(M(e,s)),!0)};function ae(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,o=r.changeByRange((s=>{let{from:r,to:o}=s;if(r==o){let i=t(s);ir&&(n="delete.forward",i=le(e,i,!0)),r=Math.min(r,i),o=Math.max(o,i)}else r=le(e,r,!1),o=le(e,o,!0);return r==o?{range:s}:{changes:{from:r,to:o},range:i.OF.cursor(r,rt(e))))i.between(t,t,((e,i)=>{et&&(t=n?i:e)}));return t}const he=(e,t,n)=>ae(e,(s=>{let o,a,l=s.from,{state:h}=e,c=h.doc.lineAt(l);if(n&&!t&&l>c.from&&lhe(e,!1,!0),ue=e=>he(e,!0,!1),fe=(e,t)=>ae(e,(n=>{let s=n.head,{state:r}=e,o=r.doc.lineAt(s),a=r.charCategorizer(s);for(let e=null;;){if(s==(t?o.to:o.from)){s==n.head&&o.number!=(t?r.doc.lines:1)&&(s+=t?1:-1);break}let l=(0,i.zK)(o.text,s-o.from,t)+o.from,h=o.text.slice(Math.min(s,l)-o.from,Math.max(s,l)-o.from),c=a(h);if(null!=e&&c!=e)break;" "==h&&s==n.head||(e=c),s=l}return s})),de=e=>fe(e,!1);function pe(e){let t=[],n=-1;for(let i of e.selection.ranges){let s=e.doc.lineAt(i.from),r=e.doc.lineAt(i.to);if(i.empty||i.to!=r.from||(r=e.doc.lineAt(i.to-1)),n>=s.number){let e=t[t.length-1];e.to=r.to,e.ranges.push(i)}else t.push({from:s.from,to:r.to,ranges:[i]});n=r.number+1}return t}function me(e,t,n){if(e.readOnly)return!1;let s=[],r=[];for(let t of pe(e)){if(n?t.to==e.doc.length:0==t.from)continue;let o=e.doc.lineAt(n?t.to+1:t.from-1),a=o.length+1;if(n){s.push({from:t.to,to:o.to},{from:t.from,insert:o.text+e.lineBreak});for(let n of t.ranges)r.push(i.OF.range(Math.min(e.doc.length,n.anchor+a),Math.min(e.doc.length,n.head+a)))}else{s.push({from:o.from,to:t.from},{from:t.to,insert:e.lineBreak+o.text});for(let e of t.ranges)r.push(i.OF.range(e.anchor-a,e.head-a))}}return!!s.length&&(t(e.update({changes:s,scrollIntoView:!0,selection:i.OF.create(r,e.selection.mainIndex),userEvent:"move.line"})),!0)}function ge(e,t,n){if(e.readOnly)return!1;let i=[];for(let t of pe(e))n?i.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):i.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});return t(e.update({changes:i,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const be=ve(!1),ye=ve(!0);function ve(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let s=t.changeByRange((n=>{let{from:s,to:a}=n,l=t.doc.lineAt(s),h=!e&&s==a&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n,i=(0,r.mv)(e).resolveInner(t),s=i.childBefore(t),a=i.childAfter(t);return s&&a&&s.to<=t&&a.from>=t&&(n=s.type.prop(o.uY.closedBy))&&n.indexOf(a.name)>-1&&e.doc.lineAt(s.to).from==e.doc.lineAt(a.from).from&&!/\S/.test(e.sliceDoc(s.to,a.from))?{from:s.to,to:a.from}:null}(t,s);e&&(s=a=(a<=l.to?l:t.doc.lineAt(a)).to);let c=new r.KB(t,{simulateBreak:s,simulateDoubleBreak:!!h}),u=(0,r._v)(c,s);for(null==u&&(u=(0,i.y$)(/^\s*/.exec(t.doc.lineAt(s).text)[0],t.tabSize));al.from&&s{let r=[];for(let i=s.from;i<=s.to;){let o=e.doc.lineAt(i);o.number>n&&(s.empty||s.to>o.from)&&(t(o,r,s),n=o.number),i=o.to+1}let o=e.changes(r);return{changes:r,range:i.OF.range(o.mapPos(s.anchor,1),o.mapPos(s.head,1))}}))}const we=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(xe(e,((t,n)=>{n.push({from:t.from,insert:e.facet(r.Xt)})})),{userEvent:"input.indent"})),!0),ke=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(xe(e,((t,n)=>{let s=/^\s*/.exec(t.text)[0];if(!s)return;let o=(0,i.y$)(s,e.tabSize),a=0,l=(0,r.EI)(e,Math.max(0,o-(0,r.tp)(e)));for(;a_(e,(t=>I(e.state,t,!E(e)))),shift:e=>W(e,(t=>I(e.state,t,!E(e))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>_(e,(t=>I(e.state,t,E(e)))),shift:e=>W(e,(t=>I(e.state,t,E(e))))},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>me(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>ge(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>me(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>ge(e,t,!0)},{key:"Escape",run:oe},{key:"Mod-Enter",run:ye},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let n=pe(e).map((({from:t,to:n})=>i.OF.range(t,Math.min(n+1,e.doc.length))));return t(e.update({selection:i.OF.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let n=O(e.selection,(t=>{var n;for(let s=(0,r.mv)(e).resolveStack(t.from,1);s;s=s.next){let{node:e}=s;if((e.from=t.to||e.to>t.to&&e.from<=t.from)&&(null===(n=e.parent)||void 0===n?void 0:n.parent))return i.OF.range(e.to,e.from)}return t}));return t(M(e,n)),!0},preventDefault:!0},{key:"Mod-[",run:ke},{key:"Mod-]",run:we},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),i=new r.KB(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),s=xe(e,((t,s,o)=>{let a=(0,r._v)(i,t.from);if(null==a)return;/\S/.test(t.text)||(a=0);let l=/^\s*/.exec(t.text)[0],h=(0,r.EI)(e,a);(l!=h||o.from{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(pe(t).map((({from:e,to:n})=>(e>0?e--:n{let n;if(e.lineWrapping){let i=e.lineBlockAt(t.head),s=e.coordsAtPos(t.head,t.assoc||1);s&&(n=i.bottom+e.documentTop-s.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)})).map(n);return e.dispatch({changes:n,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>function(e,t,n){let s=!1,o=O(e.selection,(t=>{let o=(0,r.jU)(e,t.head,-1)||(0,r.jU)(e,t.head,1)||t.head>0&&(0,r.jU)(e,t.head-1,1)||t.head{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),i=u(e.state,n.from);return i.line?l(e):!!i.block&&c(e)}},{key:"Alt-A",run:h},{key:"Ctrl-m",mac:"Shift-Alt-m",run:e=>(e.setTabFocusMode(),!0)}].concat([{key:"ArrowLeft",run:D,shift:U,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>R(e,!E(e)),shift:e=>Y(e,!E(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>_(e,(t=>V(e,t,!E(e)))),shift:e=>W(e,(t=>V(e,t,!E(e)))),preventDefault:!0},{key:"ArrowRight",run:P,shift:K,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>R(e,E(e)),shift:e=>Y(e,E(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>_(e,(t=>V(e,t,E(e)))),shift:e=>W(e,(t=>V(e,t,E(e)))),preventDefault:!0},{key:"ArrowUp",run:B,shift:X,preventDefault:!0},{mac:"Cmd-ArrowUp",run:ne,shift:se},{mac:"Ctrl-ArrowUp",run:H,shift:ee},{key:"ArrowDown",run:F,shift:Z,preventDefault:!0},{mac:"Cmd-ArrowDown",run:ie,shift:re},{mac:"Ctrl-ArrowDown",run:q,shift:te},{key:"PageUp",run:H,shift:ee},{key:"PageDown",run:q,shift:te},{key:"Home",run:e=>_(e,(t=>V(e,t,!1))),shift:e=>W(e,(t=>V(e,t,!1))),preventDefault:!0},{key:"Mod-Home",run:ne,shift:se},{key:"End",run:e=>_(e,(t=>V(e,t,!0))),shift:e=>W(e,(t=>V(e,t,!0))),preventDefault:!0},{key:"Mod-End",run:ie,shift:re},{key:"Enter",run:be},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:ce,shift:ce},{key:"Delete",run:ue},{key:"Mod-Backspace",mac:"Alt-Backspace",run:de},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>fe(e,!0)},{mac:"Mod-Backspace",run:e=>ae(e,(t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}))},{mac:"Mod-Delete",run:e=>ae(e,(t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head_(e,(t=>i.OF.cursor(e.lineBlockAt(t.head).from,1))),shift:e=>W(e,(t=>i.OF.cursor(e.lineBlockAt(t.head).from)))},{key:"Ctrl-e",run:e=>_(e,(t=>i.OF.cursor(e.lineBlockAt(t.head).to,-1))),shift:e=>W(e,(t=>i.OF.cursor(e.lineBlockAt(t.head).to)))},{key:"Ctrl-d",run:ue},{key:"Ctrl-h",run:ce},{key:"Ctrl-k",run:e=>ae(e,(t=>{let n=e.lineBlockAt(t.head).to;return t.head{if(e.readOnly)return!1;let n=e.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:i.EY.of(["",""])},range:i.OF.cursor(e.from)})));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,s=e.doc.lineAt(n),r=n==s.from?n-1:(0,i.zK)(s.text,n-s.from,!1)+s.from,o=n==s.to?n+1:(0,i.zK)(s.text,n-s.from,!0)+s.from;return{changes:{from:r,to:o,insert:e.doc.slice(n,o).append(e.doc.slice(r,n))},range:i.OF.cursor(o)}}));return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:q}].map((e=>({mac:e.key,run:e.run,shift:e.shift})))));var Ce=n(5764);new Ce.Token("@jupyterlab/codeeditor:IEditorServices","A service for the text editor provider\n for the application. Use this to create new text editors and host them in your\n UI elements."),new Ce.Token("@jupyterlab/codeeditor:IPositionModel","A service to handle an code editor cursor position.");const Ae="[data-jp-code-runner]";var Oe;!function(e){e.indentMoreOrInsertTab=function(e){var t;if(null===(t=e.dom.parentElement)||void 0===t?void 0:t.classList.contains("jp-mod-completer-enabled"))return!1;const n={state:e.state,dispatch:e.dispatch},i=e.state.selection.main.from;if(i!=e.state.selection.main.to)return we(n);const s=e.state.doc.lineAt(i),r=e.state.doc.slice(s.from,i).toString();return/^\s*$/.test(r)?we(n):(({state:e,dispatch:t})=>e.selection.ranges.some((e=>!e.empty))?we({state:e,dispatch:t}):(t(e.update(e.replaceSelection("\t"),{scrollIntoView:!0,userEvent:"input"})),!0))(n)},e.completerOrInsertNewLine=function(e){var t;if(null===(t=e.dom.parentElement)||void 0===t?void 0:t.classList.contains("jp-mod-completer-active"))return!1;if(e.dom.closest('[data-jp-interaction-mode="terminal"]'))return!1;const n={state:e.state,dispatch:e.dispatch};return be(n)},e.preventNewLineOnRun=function(e){return!!e.dom.closest(Ae)},e.insertBlankLineOnRun=function(e){if(e.dom.closest(Ae))return!1;{const t={state:e.state,dispatch:e.dispatch};return ye(t)}},e.simplifySelectionAndMaybeSwitchToCommandMode=function(e){const t={state:e.state,dispatch:e.dispatch},n=oe(t);return!e.dom.closest(".jp-mod-editMode .jp-Cell.jp-mod-active")&&n},e.dedentIfNotLaunchingTooltip=function(e){return!e.dom.closest(".jp-CodeMirrorEditor:not(.jp-mod-has-primary-selection):not(.jp-mod-in-leading-whitespace):not(.jp-mod-completer-active)")&&ke(e)}}(Oe||(Oe={}));var Me=n(8571),_e=n(7213),Te=n(509);const Ne=i.sj.define({combine:e=>(0,i.QR)(e,{fontFamily:null,fontSize:null,lineHeight:null},{fontFamily:(e,t)=>null!=e?e:t,fontSize:(e,t)=>null!=e?e:t,lineHeight:(e,t)=>null!=e?e:t})});function Ee(e){const{fontFamily:t,fontSize:n,lineHeight:i}=e.state.facet(Ne);let s="";return n&&(s+=`font-size: ${n}px !important;`),t&&(s+=`font-family: ${t} !important;`),i&&(s+=`line-height: ${i.toString()} !important`),{style:s}}var De=n(9913);const Pe="InlineMathDollar",Re="InlineMathBracket",je="BlockMathDollar",Ie="BlockMathBracket",Le={[Pe]:1,[Re]:3,[je]:2,[Ie]:3};Object.keys(Le).reduce(((e,t)=>(e[t]={mark:`${t}Mark`,resolve:t},e)),{});const Be="cm-rulers",Fe=s.Lz.baseTheme({[`.${Be}`]:{borderRight:"1px dotted gray",opacity:.7}}),ze=i.sj.define({combine:e=>e.reduce(((e,t)=>e.concat(t.filter(((n,i)=>!e.includes(n)&&i==t.lastIndexOf(n))))),[])}),$e=s.Z9.fromClass(class{constructor(e){var t,n;this.rulersContainer=e.dom.appendChild(document.createElement("div")),this.rulersContainer.style.cssText="\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n overflow: hidden;\n ";const i=e.defaultCharacterWidth,s=e.state.facet(ze),r=null!==(n=null===(t=e.scrollDOM.querySelector(".cm-gutters"))||void 0===t?void 0:t.clientWidth)&&void 0!==n?n:0;this.rulers=s.map((e=>{const t=this.rulersContainer.appendChild(document.createElement("div"));return t.classList.add(Be),t.style.cssText=`\n position: absolute;\n left: ${r+e*i}px;\n height: 100%;\n `,t.style.width="6px",t}))}update(e){var t,n;const i=e.view.state.facet(ze);if(e.viewportChanged||e.geometryChanged||!Ce.JSONExt.deepEqual(i,e.startState.facet(ze))){const s=null!==(n=null===(t=e.view.scrollDOM.querySelector(".cm-gutters"))||void 0===t?void 0:t.clientWidth)&&void 0!==n?n:0,r=e.view.defaultCharacterWidth;this.rulers.forEach(((e,t)=>{e.style.left=`${s+i[t]*r}px`}))}}destroy(){this.rulers.forEach((e=>{e.remove()})),this.rulersContainer.remove()}}),He=i.sj.define({combine:e=>e[e.length-1]}),qe=i.YH.define();function Ve(){var e=arguments[0];"string"==typeof e&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&"object"==typeof n&&null==n.nodeType&&!Array.isArray(n)){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){var s=n[i];"string"==typeof s?e.setAttribute(i,s):null!=s&&(e[i]=s)}t++}for(;t{var i;if(n.origin!==this.conf){const n=t.delta,s=[];let r=0;for(let e=0;e0&&e.transactions[0].annotation(qe)===this.conf)return;const t=this.conf.ytext;t.doc.transact((()=>{let n=0;e.changes.iterChanges(((e,i,s,r,o)=>{const a=o.sliceString(0,o.length,"\n");e!==i&&t.delete(e+n,i-e),a.length>0&&t.insert(e+n,a),n+=a.length-(i-e)}))}),this.conf)}destroy(){this._ytext.unobserve(this._observer)}});const Ge="function"==typeof String.prototype.normalize?e=>e.normalize("NFKD"):e=>e;class Ue{constructor(e,t,n=0,i=e.length,s,r){this.test=r,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,i),this.bufferStart=n,this.normalize=s?e=>s(Ge(e)):Ge,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return(0,i.vS)(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=(0,i.MK)(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=(0,i.Fh)(e);let s=this.normalize(t);for(let e=0,i=n;;e++){let r=s.charCodeAt(e),o=this.match(r,i,this.bufferPos+this.bufferStart);if(e==s.length-1){if(o)return this.value=o,this;break}i==n&&ethis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,i=n+t[0].length;if(this.matchPos=et(this.text,i+(n==i?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(nthis.value.to)&&(!this.test||this.test(n,i,t)))return this.value={from:n,to:i,match:t},this;e=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length=n||i.to<=t){let i=new Ze(t,e.sliceString(t,n));return Xe.set(e,i),i}if(i.from==t&&i.to==n)return i;let{text:s,from:r}=i;return r>t&&(s=e.sliceString(t,r)+s,r=t),i.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=et(this.text,n+(e==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ze.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function et(e,t){if(t>=e.length)return t;let n,i=e.lineAt(t);for(;t=56320&&n<57344;)t++;return t}"undefined"!=typeof Symbol&&(Je.prototype[Symbol.iterator]=Qe.prototype[Symbol.iterator]=function(){return this});const tt=i.sj.define({combine:e=>(0,i.QR)(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Nt(e),scrollToMatch:e=>s.Lz.scrollIntoView(e)})});class nt{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||function(e){try{return new RegExp(e,Ye),!0}catch(e){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,((e,t)=>"n"==t?"\n":"r"==t?"\r":"t"==t?"\t":"\\"))}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new ht(this):new rt(this)}getCursor(e,t=0,n){let s=e.doc?e:i.$t.create({doc:e});return null==n&&(n=s.doc.length),this.regexp?ot(this,s,t,n):st(this,s,t,n)}}class it{constructor(e){this.spec=e}}function st(e,t,n,s){return new Ue(t.doc,e.unquoted,n,s,e.caseSensitive?void 0:e=>e.toLowerCase(),e.wholeWord?(r=t.doc,o=t.charCategorizer(t.selection.main.head),(e,t,n,s)=>((s>e||s+n.length=t)return null;i.push(n.value)}return i}highlight(e,t,n,i){let s=st(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}function ot(e,t,n,s){return new Je(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:e.wholeWord?(r=t.charCategorizer(t.selection.main.head),(e,t,n)=>!n[0].length||(r(at(n.input,n.index))!=i.Je.Word||r(lt(n.input,n.index))!=i.Je.Word)&&(r(lt(n.input,n.index+n[0].length))!=i.Je.Word||r(at(n.input,n.index+n[0].length))!=i.Je.Word)):void 0},n,s);var r}function at(e,t){return e.slice((0,i.zK)(e,t,!1),t)}function lt(e,t){return e.slice(t,(0,i.zK)(e,t))}class ht extends it{nextMatch(e,t,n){let i=ot(this.spec,e,n,e.doc.length).next();return i.done&&(i=ot(this.spec,e,0,t).next()),i.done?null:i.value}prevMatchInRange(e,t,n){for(let i=1;;i++){let s=Math.max(t,n-1e4*i),r=ot(this.spec,e,s,n),o=null;for(;!r.next().done;)o=r.value;if(o&&(s==t||o.from>s+10))return o;if(s==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,((t,n)=>"$"==n?"$":"&"==n?e.match[0]:"0"!=n&&+n=t)return null;i.push(n.value)}return i}highlight(e,t,n,i){let s=ot(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}const ct=i.Pe.define(),ut=i.Pe.define(),ft=i.sU.define({create:e=>new dt(At(e).create(),null),update(e,t){for(let n of t.effects)n.is(ct)?e=new dt(n.value.create(),e.panel):n.is(ut)&&(e=new dt(e.query,n.value?Ct:null));return e},provide:e=>s.S7.from(e,(e=>e.panel))});class dt{constructor(e,t){this.query=e,this.panel=t}}const pt=s.NZ.mark({class:"cm-searchMatch"}),mt=s.NZ.mark({class:"cm-searchMatch cm-searchMatch-selected"}),gt=s.Z9.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(ft))}update(e){let t=e.state.field(ft);(t!=e.startState.field(ft)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return s.NZ.none;let{view:n}=this,r=new i.vB;for(let t=0,i=n.visibleRanges,s=i.length;ti[t+1].from-500;)a=i[++t].to;e.highlight(n.state,o,a,((e,t)=>{let i=n.state.selection.ranges.some((n=>n.from==e&&n.to==t));r.add(e,t,i?mt:pt)}))}return r.finish()}},{decorations:e=>e.decorations});function bt(e){return t=>{let n=t.state.field(ft,!1);return n&&n.query.spec.valid?e(t,n):_t(t)}}const yt=bt(((e,{query:t})=>{let{to:n}=e.state.selection.main,s=t.nextMatch(e.state,n,n);if(!s)return!1;let r=i.OF.single(s.from,s.to),o=e.state.facet(tt);return e.dispatch({selection:r,effects:[Rt(e,s),o.scrollToMatch(r.main,e)],userEvent:"select.search"}),Mt(e),!0})),vt=bt(((e,{query:t})=>{let{state:n}=e,{from:s}=n.selection.main,r=t.prevMatch(n,s,s);if(!r)return!1;let o=i.OF.single(r.from,r.to),a=e.state.facet(tt);return e.dispatch({selection:o,effects:[Rt(e,r),a.scrollToMatch(o.main,e)],userEvent:"select.search"}),Mt(e),!0})),xt=bt(((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!(!n||!n.length||(e.dispatch({selection:i.OF.create(n.map((e=>i.OF.range(e.from,e.to)))),userEvent:"select.search.matches"}),0))})),wt=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:s,to:r}=n.main,o=[],a=0;for(let t=new Ue(e.doc,e.sliceDoc(s,r));!t.next().done;){if(o.length>1e3)return!1;t.value.from==s&&(a=o.length),o.push(i.OF.range(t.value.from,t.value.to))}return t(e.update({selection:i.OF.create(o,a),userEvent:"select.search.matches"})),!0},kt=bt(((e,{query:t})=>{let{state:n}=e,{from:r,to:o}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let l,h,c=[],u=[];if(a.from==r&&a.to==o&&(h=n.toText(t.getReplacement(a)),c.push({from:a.from,to:a.to,insert:h}),a=t.nextMatch(n,a.from,a.to),u.push(s.Lz.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."))),a){let t=0==c.length||c[0].from>=a.to?0:a.to-a.from-h.length;l=i.OF.single(a.from-t,a.to-t),u.push(Rt(e,a)),u.push(n.facet(tt).scrollToMatch(l.main,e))}return e.dispatch({changes:c,selection:l,effects:u,userEvent:"input.replace"}),!0})),St=bt(((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map((e=>{let{from:n,to:i}=e;return{from:n,to:i,insert:t.getReplacement(e)}}));if(!n.length)return!1;let i=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:s.Lz.announce.of(i),userEvent:"input.replace.all"}),!0}));function Ct(e){return e.state.facet(tt).createPanel(e)}function At(e,t){var n,i,s,r,o;let a=e.selection.main,l=a.empty||a.to>a.from+100?"":e.sliceDoc(a.from,a.to);if(t&&!l)return t;let h=e.facet(tt);return new nt({search:(null!==(n=null==t?void 0:t.literal)&&void 0!==n?n:h.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:null!==(i=null==t?void 0:t.caseSensitive)&&void 0!==i?i:h.caseSensitive,literal:null!==(s=null==t?void 0:t.literal)&&void 0!==s?s:h.literal,regexp:null!==(r=null==t?void 0:t.regexp)&&void 0!==r?r:h.regexp,wholeWord:null!==(o=null==t?void 0:t.wholeWord)&&void 0!==o?o:h.wholeWord})}function Ot(e){let t=(0,s.ld)(e,Ct);return t&&t.dom.querySelector("[main-field]")}function Mt(e){let t=Ot(e);t&&t==e.root.activeElement&&t.select()}const _t=e=>{let t=e.state.field(ft,!1);if(t&&t.panel){let n=Ot(e);if(n&&n!=e.root.activeElement){let i=At(e.state,t.query.spec);i.valid&&e.dispatch({effects:ct.of(i)}),n.focus(),n.select()}}else e.dispatch({effects:[ut.of(!0),t?ct.of(At(e.state,t.query.spec)):i.Pe.appendConfig.of(It)]});return!0},Tt=e=>{let t=e.state.field(ft,!1);if(!t||!t.panel)return!1;let n=(0,s.ld)(e,Ct);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:ut.of(!1)}),!0};class Nt{constructor(e){this.view=e;let t=this.query=e.state.field(ft).query.spec;function n(e,t,n){return Ve("button",{class:"cm-button",name:e,onclick:t,type:"button"},n)}this.commit=this.commit.bind(this),this.searchField=Ve("input",{value:t.search,placeholder:Et(e,"Find"),"aria-label":Et(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Ve("input",{value:t.replace,placeholder:Et(e,"Replace"),"aria-label":Et(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Ve("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=Ve("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=Ve("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit}),this.dom=Ve("div",{onkeydown:e=>this.keydown(e),class:"cm-search"},[this.searchField,n("next",(()=>yt(e)),[Et(e,"next")]),n("prev",(()=>vt(e)),[Et(e,"previous")]),n("select",(()=>xt(e)),[Et(e,"all")]),Ve("label",null,[this.caseField,Et(e,"match case")]),Ve("label",null,[this.reField,Et(e,"regexp")]),Ve("label",null,[this.wordField,Et(e,"by word")]),...e.state.readOnly?[]:[Ve("br"),this.replaceField,n("replace",(()=>kt(e)),[Et(e,"replace")]),n("replaceAll",(()=>St(e)),[Et(e,"replace all")])],Ve("button",{name:"close",onclick:()=>Tt(e),"aria-label":Et(e,"close"),type:"button"},["×"])])}commit(){let e=new nt({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:ct.of(e)}))}keydown(e){(0,s.TS)(this.view,e,"search-panel")?e.preventDefault():13==e.keyCode&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?vt:yt)(this.view)):13==e.keyCode&&e.target==this.replaceField&&(e.preventDefault(),kt(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(ct)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(tt).top}}function Et(e,t){return e.state.phrase(t)}const Dt=30,Pt=/[\s\.,:;?!]/;function Rt(e,{from:t,to:n}){let i=e.state.doc.lineAt(t),r=e.state.doc.lineAt(n).to,o=Math.max(i.from,t-Dt),a=Math.min(r,n+Dt),l=e.state.sliceDoc(o,a);if(o!=i.from)for(let e=0;el.length-Dt;e--)if(!Pt.test(l[e-1])&&Pt.test(l[e])){l=l.slice(0,e);break}return s.Lz.announce.of(`${e.state.phrase("current match")}. ${l} ${e.state.phrase("on line")} ${i.number}.`)}const jt=s.Lz.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),It=[ft,i.Nb.low(gt),jt];class Lt{constructor({baseConfiguration:e,config:t,defaultExtensions:n}={}){this._configChanged=new Me.Signal(this),this._disposed=new Me.Signal(this),this._isDisposed=!1,this._immutables=new Set,this._baseConfig=null!=e?e:{},this._config=null!=t?t:{},this._configurableBuilderMap=new Map(n);const i=Object.keys(this._config).concat(Object.keys(this._baseConfig));this._immutables=new Set([...this._configurableBuilderMap.keys()].filter((e=>!i.includes(e))))}get configChanged(){return this._configChanged}get disposed(){return this._disposed}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,this._disposed.emit(),Me.Signal.clearData(this))}getOption(e){var t;return null!==(t=this._config[e])&&void 0!==t?t:this._baseConfig[e]}hasOption(e){return Object.keys(this._config).includes(e)||Object.keys(this._baseConfig).includes(e)}setOption(e,t){this._config[e]!==t&&(this._config[e]=t,this._configChanged.emit({[e]:t}))}setBaseOptions(e){const t=this._getChangedOptions(e,this._baseConfig);if(t.length>0){this._baseConfig=e;const n=Object.keys(this._config),i=t.filter((e=>!n.includes(e)));i.length>0&&this._configChanged.emit(i.reduce(((e,t)=>(e[t]=this._baseConfig[t],e)),{}))}}setOptions(e){const t=this._getChangedOptions(e,this._config);t.length>0&&(this._config={...e},this._configChanged.emit(t.reduce(((e,t)=>{var n;return e[t]=null!==(n=this._config[t])&&void 0!==n?n:this._baseConfig[t],e}),{})))}reconfigureExtension(e,t,n){const i=this.getEffect(e.state,t,n);i&&e.dispatch({effects:[i]})}reconfigureExtensions(e,t){const n=Object.keys(t).filter((e=>this.has(e))).map((n=>this.getEffect(e.state,n,t[n])));e.dispatch({effects:n.filter((e=>null!==e))})}injectExtension(e,t){e.dispatch({effects:i.Pe.appendConfig.of(t)})}getInitialExtensions(){const e={...this._baseConfig,...this._config},t=[...this._immutables].map((e=>{var t;return null===(t=this.get(e))||void 0===t?void 0:t.instance(void 0)})).filter((e=>e));for(const n of Object.keys(e)){const i=this.get(n);if(i){const s=e[n];t.push(i.instance(s))}}return t}get(e){return this._configurableBuilderMap.get(e)}has(e){return this._configurableBuilderMap.has(e)}getEffect(e,t,n){var i;const s=this.get(t);return null!==(i=null==s?void 0:s.reconfigure(n))&&void 0!==i?i:null}_getChangedOptions(e,t){const n=new Array,i=new Array;for(const[s,r]of Object.entries(e))i.push(s),t[s]!==r&&n.push(s);return n.push(...Object.keys(t).filter((e=>!i.includes(e)))),n}}class Bt{constructor(){this.configurationBuilder=new Map,this.configurationSchema={},this.defaultOptions={},this.handlers=new Set,this.immutableExtensions=new Set,this._baseConfiguration={}}get baseConfiguration(){return{...this.defaultOptions,...this._baseConfiguration}}set baseConfiguration(e){if(!Ce.JSONExt.deepEqual(e,this._baseConfiguration)){this._baseConfiguration=e;for(const e of this.handlers)e.setBaseOptions(this.baseConfiguration)}}get defaultConfiguration(){return Object.freeze({...this.defaultOptions})}get settingsSchema(){return Object.freeze(Ce.JSONExt.deepCopy(this.configurationSchema))}addExtension(e){var t;if(this.configurationBuilder.has(e.name))throw new Error(`Extension named ${e.name} is already registered.`);this.configurationBuilder.set(e.name,e),void 0!==e.default&&(this.defaultOptions[e.name]=e.default),e.schema&&(this.configurationSchema[e.name]={default:null!==(t=e.default)&&void 0!==t?t:null,...e.schema},this.defaultOptions[e.name]=this.configurationSchema[e.name].default)}createNew(e){const t=new Array;for(const[n,i]of this.configurationBuilder.entries()){const s=i.factory(e);s&&t.push([n,s])}const n=new Lt({baseConfiguration:this.baseConfiguration,config:e.config,defaultExtensions:t});return this.handlers.add(n),n.disposed.connect((()=>{this.handlers.delete(n)})),n}}var Ft;!function(e){class t{constructor(e){this._compartment=new i.xx,this._builder=e}instance(e){return this._compartment.of(this._builder(e))}reconfigure(e){return this._compartment.reconfigure(this._builder(e))}}class n{constructor(e){this._extension=e}instance(){return this._extension}reconfigure(){return null}}function o(e){return new t(e)}function a(e,n=[]){return new t((t=>t?e:n))}function l(e){return new n(e)}e.createConfigurableExtension=o,e.createConditionalExtension=a,e.createImmutableExtension=l,e.getDefaultExtensions=function(e={}){const{themes:t,translator:n}=e,h=(null!=n?n:Te.wK).load("jupyterlab"),c=[Object.freeze({name:"autoClosingBrackets",default:!1,factory:()=>a((0,_e.wm)()),schema:{type:"boolean",title:h.__("Auto Closing Brackets")}}),Object.freeze({name:"codeFolding",default:!1,factory:()=>a((0,r.Lv)()),schema:{type:"boolean",title:h.__("Code Folding")}}),Object.freeze({name:"cursorBlinkRate",default:1200,factory:()=>o((e=>(0,s.VH)({cursorBlinkRate:e}))),schema:{type:"number",title:h.__("Cursor blinking rate"),description:h.__("Half-period in milliseconds used for cursor blinking. The default blink rate is 1200ms. By setting this to zero, blinking can be disabled.")}}),Object.freeze({name:"highlightActiveLine",default:!1,factory:()=>a((0,s.dz)()),schema:{type:"boolean",title:h.__("Highlight the active line")}}),Object.freeze({name:"highlightSpecialCharacters",default:!0,factory:()=>a((0,s.N$)()),schema:{type:"boolean",title:h.__("Highlight special characters")}}),Object.freeze({name:"highlightTrailingWhitespace",default:!1,factory:()=>a((0,s.wu)()),schema:{type:"boolean",title:h.__("Highlight trailing white spaces")}}),Object.freeze({name:"highlightWhitespace",default:!1,factory:()=>a((0,s.Yq)()),schema:{type:"boolean",title:h.__("Highlight white spaces")}}),Object.freeze({name:"indentUnit",default:"4",factory:()=>o((e=>"Tab"==e?r.Xt.of("\t"):r.Xt.of(" ".repeat(parseInt(e,10))))),schema:{type:"string",title:h.__("Indentation unit"),description:h.__("The indentation is a `Tab` or the number of spaces. This defaults to 4 spaces."),enum:["Tab","1","2","4","8"]}}),Object.freeze({name:"keymap",default:[{key:"Mod-Enter",run:Oe.insertBlankLineOnRun},{key:"Enter",run:Oe.completerOrInsertNewLine},{key:"Escape",run:Oe.simplifySelectionAndMaybeSwitchToCommandMode},...Se.filter((e=>!["Mod-Enter","Shift-Mod-k","Mod-/","Alt-A","Escape","Enter"].includes(e.key))),{key:"Tab",run:Oe.indentMoreOrInsertTab,shift:Oe.dedentIfNotLaunchingTooltip}],factory:()=>o((e=>s.w4.of(e)))}),Object.freeze({name:"lineNumbers",default:!0,factory:()=>a((0,s.$K)()),schema:{type:"boolean",title:h.__("Line Numbers")}}),Object.freeze({name:"lineWrap",factory:()=>a(s.Lz.lineWrapping),default:!0,schema:{type:"boolean",title:h.__("Line Wrap")}}),Object.freeze({name:"matchBrackets",default:!0,factory:()=>a([(0,r.SG)(),i.Nb.high(s.w4.of(_e.Bc))]),schema:{type:"boolean",title:h.__("Match Brackets")}}),Object.freeze({name:"rectangularSelection",default:!0,factory:()=>a([(0,s.D4)(),(0,s.HJ)()]),schema:{type:"boolean",title:h.__("Rectangular selection"),description:h.__("Rectangular (block) selection can be created by dragging the mouse pointer while holding the left mouse button and the Alt key. When the Alt key is pressed, a crosshair cursor will appear, indicating that the rectangular selection mode is active.")}}),Object.freeze({name:"readOnly",default:!1,factory:()=>o((e=>[i.$t.readOnly.of(e),e?s.Lz.editorAttributes.of({class:"jp-mod-readOnly"}):[]]))}),Object.freeze({name:"rulers",default:[],factory:()=>o((e=>e.length>0?function(e){return[Fe,ze.of(e),$e]}(e):[])),schema:{type:"array",title:h.__("Rulers"),items:{type:"number",minimum:0}}}),Object.freeze({name:"extendSelection",default:!0,factory:()=>a(s.w4.of([{key:"Mod-Shift-l",run:wt,preventDefault:!0}]))}),Object.freeze({name:"searchWithCM",default:!1,factory:()=>a(s.w4.of([{key:"Mod-f",run:_t,scope:"editor search-panel"},{key:"F3",run:yt,shift:vt,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:yt,shift:vt,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Tt,scope:"editor search-panel"}]))}),Object.freeze({name:"scrollPastEnd",default:!1,factory:e=>e.inline?null:a((0,s.BE)())}),Object.freeze({name:"smartIndent",default:!0,factory:()=>a((0,r.WD)()),schema:{type:"boolean",title:h.__("Smart Indentation")}}),Object.freeze({name:"tabFocusable",default:!0,factory:()=>a(s.Lz.contentAttributes.of({tabIndex:"0"}),s.Lz.contentAttributes.of({tabIndex:"-1"}))}),Object.freeze({name:"tabSize",default:4,factory:()=>o((e=>i.$t.tabSize.of(e))),schema:{type:"number",title:h.__("Tab size")}}),Object.freeze({name:"tooltips",factory:()=>l((0,s.vX)({position:"absolute",parent:document.body}))}),Object.freeze({name:"allowMultipleSelections",default:!0,factory:()=>o((e=>i.$t.allowMultipleSelections.of(e))),schema:{type:"boolean",title:h.__("Multiple selections")}}),Object.freeze({name:"customStyles",factory:()=>o((e=>function(e){return[Ne.of(e),s.Lz.editorAttributes.of(Ee)]}(e))),default:{fontFamily:null,fontSize:null,lineHeight:null},schema:{title:h.__("Custom editor styles"),type:"object",properties:{fontFamily:{type:["string","null"],title:h.__("Font Family")},fontSize:{type:["number","null"],minimum:1,maximum:100,title:h.__("Font Size")},lineHeight:{type:["number","null"],title:h.__("Line Height")}},additionalProperties:!1}})];return t&&c.push(Object.freeze({name:"theme",default:"jupyter",factory:()=>o((e=>t.getTheme(e))),schema:{type:"string",title:h.__("Theme"),description:h.__("CodeMirror theme")}})),n&&c.push(Object.freeze({name:"translation",default:{"Control character":h.__("Control character"),"Selection deleted":h.__("Selection deleted"),"Folded lines":h.__("Folded lines"),"Unfolded lines":h.__("Unfolded lines"),to:h.__("to"),"folded code":h.__("folded code"),unfold:h.__("unfold"),"Fold line":h.__("Fold line"),"Unfold line":h.__("Unfold line"),"Go to line":h.__("Go to line"),go:h.__("go"),Find:h.__("Find"),Replace:h.__("Replace"),next:h.__("next"),previous:h.__("previous"),all:h.__("all"),"match case":h.__("match case"),replace:h.__("replace"),"replace all":h.__("replace all"),close:h.__("close"),"current match":h.__("current match"),"replaced $ matches":h.__("replaced $ matches"),"replaced match on line $":h.__("replaced match on line $"),"on line":h.__("on line"),Completions:h.__("Completions"),Diagnostics:h.__("Diagnostics"),"No diagnostics":h.__("No diagnostics")},factory:()=>o((e=>i.$t.phrases.of(e)))})),c}}(Bt||(Bt={})),(Ft||(Ft={})).defaultMimeType="text/plain";var zt=n(8925),$t=n(3643);class Ht{constructor(e){this.start=e}}class qt extends Ht{constructor(e,t,n,i,s,r,o,a,l,h,c,u,f,d,p){super(e),this.rules=t,this.topRules=n,this.tokens=i,this.localTokens=s,this.context=r,this.externalTokens=o,this.externalSpecializers=a,this.externalPropSources=l,this.precedences=h,this.mainSkip=c,this.scopedSkip=u,this.dialects=f,this.externalProps=d,this.autoDelim=p}toString(){return Object.values(this.rules).join("\n")}}class Vt extends Ht{constructor(e,t,n,i,s){super(e),this.id=t,this.props=n,this.params=i,this.expr=s}toString(){return this.id.name+(this.params.length?`<${this.params.join()}>`:"")+" -> "+this.expr}}class Wt extends Ht{constructor(e,t){super(e),this.items=t}}class Gt extends Ht{constructor(e,t){super(e),this.items=t}}class Ut extends Ht{constructor(e,t,n){super(e),this.a=t,this.b=n}}class Kt extends Ht{constructor(e,t,n,i,s){super(e),this.precedences=t,this.conflicts=n,this.rules=i,this.literals=s}}class Yt extends Ht{constructor(e,t,n,i){super(e),this.precedences=t,this.rules=n,this.fallback=i}}class Jt extends Ht{constructor(e,t,n){super(e),this.literal=t,this.props=n}}class Xt extends Ht{constructor(e,t,n){super(e),this.id=t,this.source=n}}class Zt extends Ht{constructor(e,t,n,i){super(e),this.id=t,this.source=n,this.tokens=i}}class Qt extends Ht{constructor(e,t,n,i,s,r){super(e),this.type=t,this.token=n,this.id=i,this.source=s,this.tokens=r}}class en extends Ht{constructor(e,t,n){super(e),this.id=t,this.source=n}}class tn extends Ht{constructor(e,t,n,i){super(e),this.id=t,this.externalID=n,this.source=i}}class nn extends Ht{constructor(e,t){super(e),this.name=t}toString(){return this.name}}class sn extends Ht{walk(e){return e(this)}eq(e){return!1}}sn.prototype.prec=10;class rn extends sn{constructor(e,t,n){super(e),this.id=t,this.args=n}toString(){return this.id.name+(this.args.length?`<${this.args.join()}>`:"")}eq(e){return this.id.name==e.id.name&&vn(this.args,e.args)}walk(e){let t=mn(this.args,e);return e(t==this.args?this:new rn(this.start,this.id,t))}}class on extends sn{constructor(e,t,n,i,s){super(e),this.type=t,this.props=n,this.token=i,this.content=s}toString(){return`@${this.type}[${this.props.join(",")}]<${this.token}, ${this.content}>`}eq(e){return this.type==e.type&&xn.eqProps(this.props,e.props)&&yn(this.token,e.token)&&yn(this.content,e.content)}walk(e){let t=this.token.walk(e),n=this.content.walk(e);return e(t==this.token&&n==this.content?this:new on(this.start,this.type,this.props,t,n))}}class an extends sn{constructor(e,t){super(e),this.rule=t}toString(){let e=this.rule;return`${e.id}${e.props.length?`[${e.props.join(",")}]`:""} { ${e.expr} }`}eq(e){let t=this.rule,n=e.rule;return yn(t.expr,n.expr)&&t.id.name==n.id.name&&xn.eqProps(t.props,n.props)}walk(e){let t=this.rule,n=t.expr.walk(e);return e(n==t.expr?this:new an(this.start,new Vt(t.start,t.id,t.props,[],n)))}}class ln extends sn{constructor(e,t){super(e),this.exprs=t}toString(){return this.exprs.map((e=>kn(e,this))).join(" | ")}eq(e){return vn(this.exprs,e.exprs)}walk(e){let t=mn(this.exprs,e);return e(t==this.exprs?this:new ln(this.start,t))}}ln.prototype.prec=1;class hn extends sn{constructor(e,t,n,i=!1){super(e),this.exprs=t,this.markers=n,this.empty=i}toString(){return this.empty?"()":this.exprs.map((e=>kn(e,this))).join(" ")}eq(e){return vn(this.exprs,e.exprs)&&this.markers.every(((t,n)=>{let i=e.markers[n];return t.length==i.length&&t.every(((e,t)=>e.eq(i[t])))}))}walk(e){let t=mn(this.exprs,e);return e(t==this.exprs?this:new hn(this.start,t,this.markers,this.empty&&!t.length))}}hn.prototype.prec=2;class cn extends Ht{constructor(e,t,n){super(e),this.id=t,this.type=n}toString(){return("ambig"==this.type?"~":"!")+this.id.name}eq(e){return this.id.name==e.id.name&&this.type==e.type}}class un extends sn{constructor(e,t,n){super(e),this.expr=t,this.kind=n}toString(){return kn(this.expr,this)+this.kind}eq(e){return yn(this.expr,e.expr)&&this.kind==e.kind}walk(e){let t=this.expr.walk(e);return e(t==this.expr?this:new un(this.start,t,this.kind))}}un.prototype.prec=3;class fn extends sn{constructor(e,t){super(e),this.value=t}toString(){return JSON.stringify(this.value)}eq(e){return this.value==e.value}}class dn extends sn{constructor(e,t,n){super(e),this.ranges=t,this.inverted=n}toString(){return`[${this.inverted?"^":""}${this.ranges.map((([e,t])=>String.fromCodePoint(e)+(t==e+1?"":"-"+String.fromCodePoint(t))))}]`}eq(e){return this.inverted==e.inverted&&this.ranges.length==e.ranges.length&&this.ranges.every((([t,n],i)=>{let[s,r]=e.ranges[i];return t==s&&n==r}))}}class pn extends sn{constructor(e){super(e)}toString(){return"_"}eq(){return!0}}function mn(e,t){let n=null;for(let i=0;iyn(e,t[n])))}class xn extends Ht{constructor(e,t,n,i){super(e),this.at=t,this.name=n,this.value=i}eq(e){return this.name==e.name&&this.value.length==e.value.length&&this.value.every(((t,n)=>t.value==e.value[n].value&&t.name==e.value[n].name))}toString(){let e=(this.at?"@":"")+this.name;if(this.value.length){e+="=";for(let{name:t,value:n}of this.value)e+=t?`{${t}}`:/[^\w-]/.test(n)?JSON.stringify(n):n}return e}static eqProps(e,t){return e.length==t.length&&e.every(((e,n)=>e.eq(t[n])))}}class wn extends Ht{constructor(e,t,n){super(e),this.value=t,this.name=n}}function kn(e,t){return e.prec0}get eof(){return(4&this.flags)>0}get error(){return"error"in this.props}get top(){return(2&this.flags)>0}get interesting(){return this.flags>0||null!=this.nodeName}get repeated(){return(16&this.flags)>0}set preserve(e){this.flags=e?8|this.flags:-9&this.flags}get preserve(){return(8&this.flags)>0}set inline(e){this.flags=e?32|this.flags:-33&this.flags}get inline(){return(32&this.flags)>0}cmp(e){return this.hash-e.hash}}class Mn{constructor(){this.terms=[],this.names=Object.create(null),this.tops=[],this.eof=this.term("␄",null,5),this.error=this.term("⚠","⚠",8)}term(e,t,n=0,i={}){let s=new On(e,n,t,i);return this.terms.push(s),this.names[e]=s,s}makeTop(e,t){const n=this.term("@top",e,2,t);return this.tops.push(n),n}makeTerminal(e,t,n={}){return this.term(e,t,1,n)}makeNonTerminal(e,t,n={}){return this.term(e,t,0,n)}makeRepeat(e){return this.term(e,null,16)}uniqueName(e){for(let t=0;;t++){let n=t?`${e}-${t}`:e;if(!this.names[n])return n}}finish(e){for(let t of e)t.name.rules.push(t);this.terms=this.terms.filter((t=>t.terminal||t.preserve||e.some((e=>e.name==t||e.parts.includes(t)))));let t={},n=[this.error];this.error.id=0;let i=1;for(let e of this.terms)e.id<0&&e.nodeType&&!e.repeated&&(e.id=i++,n.push(e));let s=i;for(let e of this.terms)e.repeated&&(e.id=i++,n.push(e));this.eof.id=i++;for(let e of this.terms)e.id<0&&(e.id=i++),e.name&&(t[e.id]=e.name);if(i>=65534)throw new Sn("Too many terms");return{nodeTypes:n,names:t,minRepeatTerm:s,maxTerm:i-1}}}function _n(e,t,n){if(e.length!=t.length)return e.length-t.length;for(let i=0;iet?1:0))||this.cut-e.cut}}function En(e,t){if(0==e.length||e==t)return t;if(0==t.length)return e;let n=e.slice();for(let i of t)e.includes(i)||n.push(i);return n.sort()}Nn.none=new Nn(0);let Dn=0;class Pn{constructor(e,t,n,i){this.name=e,this.parts=t,this.conflicts=n,this.skip=i,this.id=Dn++}cmp(e){return this.id-e.id}cmpNoName(e){return this.parts.length-e.parts.length||this.skip.hash-e.skip.hash||this.parts.reduce(((t,n,i)=>t||n.cmp(e.parts[i])),0)||_n(this.conflicts,e.conflicts,((e,t)=>e.cmp(t)))}toString(){return this.name+" -> "+this.parts.join(" ")}get isRepeatWrap(){return this.name.repeated&&2==this.parts.length&&this.parts[0]==this.name}sameReduce(e){return this.name==e.name&&this.parts.length==e.parts.length&&this.isRepeatWrap==e.isRepeatWrap}}class Rn{constructor(e,t,n){this.from=e,this.to=t,this.target=n}toString(){return`-> ${this.target.id}[label=${JSON.stringify(this.from<0?"ε":jn(this.from)+(this.to>this.from+1?"-"+jn(this.to-1):""))}]`}}function jn(e){return e>65535?"∞":10==e?"\\n":13==e?"\\r":e<32||e>=55296&&e<57343?"\\u{"+e.toString(16)+"}":String.fromCharCode(e)}function In(e,t,n){if(e.edges.length!=t.edges.length)return!1;for(let i=0;iEn(e,t.accepting)),[]),n++),o=[];for(let e of s)for(let t of e.edges)t.from>=0&&o.push(t);let a=function(e){let t=[],n=[];for(let n of e)t.includes(n.from)||t.push(n.from),t.includes(n.to)||t.push(n.to);t.sort(((e,t)=>e-t));for(let i=1;is&&t.from65535==e.from&&65535==e.to));if(i.length){let e=[];for(let t of i)for(let n of t.target.closure())e.includes(n)||e.push(n);e.length&&n.push(new qn(65535,65535,e))}return n}(o);for(let e of a){let n=e.targets.sort(((e,t)=>e.id-t.id));r.edge(e.from,e.to,t[Hn(n)]||i(n))}return r}(this.closure().sort(((e,t)=>e.id-t.id)));return function(e,t){let n=Object.create(null),i=Object.create(null);for(let t of e){let e=Hn(t.accepting),s=i[e]||(i[e]=[]);s.push(t),n[t.id]=s}for(;;){let i=!1,s=Object.create(null);for(let t of e){if(s[t.id])continue;let e=n[t.id];if(1==e.length){s[e[0].id]=e;continue}let r=[];e:for(let t of e){for(let e of r)if(In(t,e[0],n)){e.push(t);continue e}r.push([t])}r.length>1&&(i=!0);for(let e of r)for(let t of e)s[t.id]=e}if(!i)return Ln(e,t,n);n=s}}(Object.values(t),i)}closure(){let e=[],t=Object.create(null);return function n(i){if(!t[i.id]){t[i.id]=!0,(i.edges.some((e=>e.from>=0))||i.accepting.length>0&&!i.edges.some((e=>function(e,t){if(e.length!=t.length)return!1;for(let n=0;nt.a==e&&t.b==n));o?o.soft!=i&&(o.soft=0):t.push(new zn(e,n,i,$n(s),r&&$n(r)))}return this.reachable(((t,s)=>{if(0!=t.accepting.length){for(let e=0;e{if(r!=t)for(let a of r.accepting){let r=n.includes(a);for(let l of t.accepting)a!=l&&i(a,l,r||n.includes(l)||!e(a,l)?0:1,s,s.concat(o))}}))}})),t}cycleTerms(){let e=[];this.reachable((t=>{for(let{target:n}of t.edges)e.push(t,n)}));let t=new Map,n=[];for(let i=0;i{t.accepting.length&&(e+=` ${t.id} [label=${JSON.stringify(t.accepting.join())}];\n`);for(let n of t.edges)e+=` ${t.id} ${n};\n`})),e+"}"}toArray(e,t){let n=[],i=[];this.reachable((s=>{let r=i.length,o=r+3+2*s.accepting.length;n[s.id]=r,i.push(s.stateMask(e),o,s.edges.length),s.accepting.sort(((e,n)=>t.indexOf(e.id)-t.indexOf(n.id)));for(let t of s.accepting)i.push(t.id,e[t.id]||65535);for(let e of s.edges)i.push(e.from,e.to,-e.target.id-1)}));for(let e=0;eMath.pow(2,16))throw new Sn("Tokenizer tables too big to represent with 16-bit offsets.");return Uint16Array.from(i)}stateMask(e){let t=0;return this.reachable((n=>{for(let i of n.accepting)t|=e[i.id]||65535})),t}},zn=class{constructor(e,t,n,i,s){this.a=e,this.b=t,this.soft=n,this.exampleA=i,this.exampleB=s}};function $n(e){let t="";for(let n=0;n-1&&i-1){let e=this.lineInfo(t);n+=(n?" ":"")+e.line+":"+e.ch}return n?e+` (${n})`:e}raise(e,t=-1){throw new Sn(this.message(e,t))}match(e,t){let n=t.exec(this.string.slice(e));return n?e+n[0].length:-1}next(){let e=this.match(this.end,/^(\s|\/\/.*|\/\*[^]*?\*\/)*/);if(e==this.string.length)return this.set("eof",null,e,e);let t=this.string[e];if('"'==t){let t=this.match(e+1,/^(\\.|[^"\\])*"/);return-1==t&&this.raise("Unterminated string literal",e),this.set("string",mi(this.string.slice(e+1,t-1)),e,t)}if("'"==t){let t=this.match(e+1,/^(\\.|[^'\\])*'/);return-1==t&&this.raise("Unterminated string literal",e),this.set("string",mi(this.string.slice(e+1,t-1)),e,t)}if("@"==t){Vn.lastIndex=e+1;let t=Vn.exec(this.string);return t?this.set("at",t[0],e,e+1+t[0].length):this.raise("@ without a name",e)}if("$"!=t&&"!"!=t||"["!=this.string[e+1]){if(/[\[\]()!~+*?{}<>\.,|:$=]/.test(t))return this.set(t,null,e,e+1);{Vn.lastIndex=e;let n=Vn.exec(this.string);return n?this.set("id",n[0],e,e+n[0].length):this.raise("Unexpected character "+JSON.stringify(t),e)}}{let t=this.match(e+2,/^(?:\\.|[^\]\\])*\]/);return-1==t&&this.raise("Unterminated character set",e),this.set("set",this.string.slice(e+2,t-1),e,t)}}set(e,t,n,i){this.type=e,this.value=t,this.start=n,this.end=i}eat(e,t=null){return this.type==e&&(null==t||this.value===t)&&(this.next(),!0)}unexpected(){return this.raise(`Unexpected token '${this.string.slice(this.start,this.end)}'`,this.start)}expect(e,t=null){let n=this.value;return(this.type!=e||null!=t&&n!==t)&&this.unexpected(),this.next(),n}parse(){return function(e){let t=e.start,n=[],i=null,s=null,r=[],o=null,a=[],l=[],h=null,c=[],u=[],f=[],d=[],p=[],m=!1,g=!1;for(;"eof"!=e.type;){let t=e.start;if(e.eat("at","top"))"id"!=e.type&&e.raise("Top rules must have a name",e.start),p.push(Un(e,si(e))),m=!0;else if("at"==e.type&&"tokens"==e.value)s?e.raise("Multiple @tokens declaractions",e.start):s=oi(e);else if(e.eat("at","local"))e.expect("id","tokens"),r.push(ai(e,t));else if(e.eat("at","context")){h&&e.raise("Multiple @context declarations",t);let n=si(e);e.expect("id","from");let i=e.expect("string");h=new Xt(t,n,i)}else if(e.eat("at","external"))e.eat("id","tokens")?c.push(ui(e,t)):e.eat("id","prop")?f.push(pi(e,t)):e.eat("id","extend")?u.push(fi(e,"extend",t)):e.eat("id","specialize")?u.push(fi(e,"specialize",t)):e.eat("id","propSource")?d.push(di(e,t)):e.unexpected();else if(e.eat("at","dialects")){e.expect("{");for(let t=!0;!e.eat("}");t=!1)t||e.eat(","),l.push(si(e))}else if("at"==e.type&&"precedence"==e.value)i&&e.raise("Multiple precedence declarations",e.start),i=ri(e);else if(e.eat("at","detectDelim"))g=!0;else if(e.eat("at","skip")){let t=Jn(e);if("{"==e.type){e.next();let n=[],i=[];for(;!e.eat("}");)e.eat("at","top")?(i.push(Un(e,si(e))),m=!0):n.push(Un(e));a.push({expr:t,topRules:i,rules:n})}else o&&e.raise("Multiple top-level skip declarations",e.start),o=t}else n.push(Un(e))}return m?new qt(t,n,p,s,r,h,c,u,d,i,o,a,l,f,g):e.raise("Missing @top declaration")}(this)}}function Un(e,t){let n=t?t.start:e.start,i=t||si(e),s=Kn(e),r=[];if(e.eat("<"))for(;!e.eat(">");)r.length&&e.expect(","),r.push(si(e));let o=Jn(e);return new Vt(n,i,s,r,o)}function Kn(e){if("["!=e.type)return Wn;let t=[];for(e.expect("[");!e.eat("]");)t.length&&e.expect(","),t.push(Yn(e));return t}function Yn(e){let t=e.start,n=[],i=e.value,s="at"==e.type;if(e.eat("at")||e.eat("id")||e.unexpected(),e.eat("="))for(;;)if("string"==e.type||"id"==e.type)n.push(new wn(e.start,e.value,null)),e.next();else if(e.eat("."))n.push(new wn(e.start,".",null));else{if(!e.eat("{"))break;n.push(new wn(e.start,null,e.expect("id"))),e.expect("}")}return new xn(t,s,i,n)}function Jn(e){e.expect("{");let t=ii(e);return e.expect("}"),t}const Xn="﷚";function Zn(e){let t=e.start;if(e.eat("(")){if(e.eat(")"))return new hn(t,Wn,[Wn,Wn]);let n=ii(e);return e.expect(")"),n}if("string"==e.type){let n=e.value;return e.next(),0==n.length?new hn(t,Wn,[Wn,Wn]):new fn(t,n)}if(e.eat("id","_"))return new pn(t);if("set"==e.type){let n=e.value,i="!"==e.string[e.start],s=mi(n.replace(/\\.|-|"/g,(e=>"-"==e?Xn:'"'==e?'\\"':e))),r=[];for(let t=0;t65535?2:1,t65535?3:2,ie[0]-t[0])),i)}if("at"!=e.type||"specialize"!=e.value&&"extend"!=e.value){if("at"==e.type&&gn.hasOwnProperty(e.value)){let t=new bn(e.start,e.value);return e.next(),t}if("["==e.type){let n=Un(e,new nn(t,"_anon"));return n.params.length&&e.raise("Inline rules can't have parameters",n.start),new an(t,n)}{let n=si(e);if("["==e.type||"{"==e.type){let i=Un(e,n);return i.params.length&&e.raise("Inline rules can't have parameters",i.start),new an(t,i)}if(e.eat(".")&&"std"==n.name&&gn.hasOwnProperty(e.value)){let n=new bn(t,e.value);return e.next(),n}return new rn(t,n,function(e){let t=[];if(e.eat("<"))for(;!e.eat(">");)t.length&&e.expect(","),t.push(ii(e));return t}(e))}}{let{start:t,value:n}=e;e.next();let i=Kn(e);e.expect("<");let s,r=ii(e);return e.eat(",")?s=ii(e):r instanceof fn?s=r:e.raise(`@${n} requires two arguments when its first argument isn't a literal string`),e.expect(">"),new on(t,n,i,r,s)}}function Qn(e,t,n,i){t.every((([e,t])=>t<=n||e>=i))||e.raise("Overlapping character range",e.start),t.push([n,i])}function ei(e){let t=e.start,n=Zn(e);for(;;){let i=e.type;if(!(e.eat("*")||e.eat("?")||e.eat("+")))return n;n=new un(t,n,i)}}function ti(e){return"}"==e.type||")"==e.type||"|"==e.type||"/"==e.type||"/\\"==e.type||"{"==e.type||","==e.type||">"==e.type}function ni(e){let t=e.start,n=[],i=[Wn];do{for(;;){let t,n=e.start;if(e.eat("~"))t="ambig";else{if(!e.eat("!"))break;t="prec"}i[i.length-1]=i[i.length-1].concat(new cn(n,si(e),t))}if(ti(e))break;n.push(ei(e)),i.push(Wn)}while(!ti(e));return 1==n.length&&i.every((e=>0==e.length))?n[0]:new hn(t,n,i,!n.length)}function ii(e){let t=e.start,n=ni(e);if(!e.eat("|"))return n;let i=[n];do{i.push(ni(e))}while(e.eat("|"));let s=i.find((e=>e instanceof hn&&e.empty));return s&&e.raise("Empty expression in choice operator. If this is intentional, use () to make it explicit.",s.start),new ln(t,i)}function si(e){"id"!=e.type&&e.unexpected();let t=e.start,n=e.value;return e.next(),new nn(t,n)}function ri(e){let t=e.start;e.next(),e.expect("{");let n=[];for(;!e.eat("}");)n.length&&e.eat(","),n.push({id:si(e),type:e.eat("at","left")?"left":e.eat("at","right")?"right":e.eat("at","cut")?"cut":null});return new Wt(t,n)}function oi(e){let t=e.start;e.next(),e.expect("{");let n=[],i=[],s=[],r=[];for(;!e.eat("}");)"at"==e.type&&"precedence"==e.value?s.push(li(e)):"at"==e.type&&"conflict"==e.value?r.push(hi(e)):"string"==e.type?i.push(new Jt(e.start,e.expect("string"),Kn(e))):n.push(Un(e));return new Kt(t,s,r,n,i)}function ai(e,t){e.expect("{");let n=[],i=[],s=null;for(;!e.eat("}");)"at"==e.type&&"precedence"==e.value?i.push(li(e)):e.eat("at","else")&&!s?s={id:si(e),props:Kn(e)}:n.push(Un(e));return new Yt(t,i,n,s)}function li(e){let t=e.start;e.next(),e.expect("{");let n=[];for(;!e.eat("}");){n.length&&e.eat(",");let t=Zn(e);t instanceof fn||t instanceof rn?n.push(t):e.raise("Invalid expression in token precedences",t.start)}return new Gt(t,n)}function hi(e){let t=e.start;e.next(),e.expect("{");let n=Zn(e);n instanceof fn||n instanceof rn||e.raise("Invalid expression in token conflict",n.start),e.eat(",");let i=Zn(e);return i instanceof fn||i instanceof rn||e.raise("Invalid expression in token conflict",i.start),e.expect("}"),new Ut(t,n,i)}function ci(e){let t=[];for(e.expect("{");!e.eat("}");){t.length&&e.eat(",");let n=si(e),i=Kn(e);t.push({id:n,props:i})}return t}function ui(e,t){let n=si(e);e.expect("id","from");let i=e.expect("string");return new Zt(t,n,i,ci(e))}function fi(e,t,n){let i=Jn(e),s=si(e);e.expect("id","from");let r=e.expect("string");return new Qt(n,t,i,s,r,ci(e))}function di(e,t){let n=si(e);return e.expect("id","from"),new en(t,n,e.expect("string"))}function pi(e,t){let n=si(e),i=e.eat("id","as")?si(e):n;e.expect("id","from");let s=e.expect("string");return new tn(t,i,n,s)}function mi(e){let t,n=/\\(?:u\{([\da-f]+)\}|u([\da-f]{4})|x([\da-f]{2})|([ntbrf0])|(.))|[^]/giy,i="";for(;t=n.exec(e);){let[e,n,s,r,o,a]=t;i+=n||s||r?String.fromCodePoint(parseInt(n||s||r,16)):o?"n"==o?"\n":"t"==o?"\t":"0"==o?"\0":"r"==o?"\r":"f"==o?"\f":"\b":a||e}return i}function gi(e,t){return(e<<5)+e+t}function bi(e,t){for(let n=0;n{let n=Date.now(),i=t();return console.log(`${e} (${((Date.now()-n)/1e3).toFixed(2)}s)`),i}:(e,t)=>t();class wi{constructor(e,t,n,i,s,r){this.rule=e,this.pos=t,this.ahead=n,this.ambigAhead=i,this.skipAhead=s,this.via=r,this.hash=0}finish(){let e=gi(gi(this.rule.id,this.pos),this.skipAhead.hash);for(let t of this.ahead)e=gi(e,t.hash);for(let t of this.ambigAhead)e=bi(e,t);return this.hash=e,this}get next(){return this.pose.cmp(t)))||_n(this.ambigAhead,e.ambigAhead,Ci)}eqSimple(e){return e.rule==this.rule&&e.pos==this.pos}toString(){let e=this.rule.parts.map((e=>e.name));return e.splice(this.pos,0,"·"),`${this.rule.name} -> ${e.join(" ")}`}eq(e){return this==e||this.hash==e.hash&&this.rule==e.rule&&this.pos==e.pos&&this.skipAhead==e.skipAhead&&Mi(this.ahead,e.ahead)&&Mi(this.ambigAhead,e.ambigAhead)}trail(e=60){let t=[];for(let e=this;e;e=e.via)for(let n=e.pos-1;n>=0;n--)t.push(e.rule.parts[n]);let n=t.reverse().join(" ");return n.length>e&&(n=n.slice(n.length-e).replace(/.*? /,"… ")),n}conflicts(e=this.pos){let t=this.rule.conflicts[e];return e==this.rule.parts.length&&this.ambigAhead.length&&(t=t.join(new Nn(0,this.ambigAhead))),t}static addOrigins(e,t){let n=e.slice();for(let e=0;et?1:0}function Ai(e,t,n,i){let s=[];for(let n=t+1;ne.term+"="+e)).join(",")+(this.goto.length?" | "+this.goto.map((e=>e.term+"="+e)).join(","):"");return this.id+": "+this.set.filter((e=>e.pos>0)).join()+(this.defaultReduce?`\n always ${this.defaultReduce.name}(${this.defaultReduce.parts.length})`:e.length?"\n "+e:"")}addActionInner(e,t){e:for(let n=0;n0){this.actions.splice(n,1),this.actionPositions.splice(n,1),n--;continue e}if(l<0)return null;if(o.ambigGroups.some((e=>a.ambigGroups.includes(e))))continue e;return i}}return this.actions.push(e),this.actionPositions.push(t),null}addAction(e,t,n){let i=this.addActionInner(e,t);if(i){let s,r=this.actionPositions[this.actions.indexOf(i)][0],o=[t[0].rule.name,r.rule.name];if(n.conflicts.some((e=>e.rules.some((e=>o.includes(e))))))return;s=i instanceof _i?`shift/reduce conflict between\n ${r}\nand\n ${t[0].rule}`:`reduce/reduce conflict between\n ${r.rule}\nand\n ${t[0].rule}`,s+=`\nWith input:\n ${t[0].trail(70)} · ${e.term} …`,i instanceof _i&&(s+=function(e,t,n){let i=e,s=[];for(;;){for(let e=i.pos-1;e>=0;e--)s.push(i.rule.parts[e]);if(!i.via)break;i=i.via}s.reverse();let r=new Set;return function i(o,a,l){if(a==s.length&&l&&!o.next)return`\nThe reduction of ${e.rule.name} is allowed before ${t} because of this rule:\n ${l}`;for(let e;e=o.next;){if(a"\n"+" ".repeat(n+1)+(e==t?"":"via ")+e)).join("")):""}for(let i=e;i;i=i.via)for(let s=t;s;s=s.via)if(i.eqSimple(s))return"\nShared origin: "+i+n(i,e)+n(i,t);return""}(r,t[0]),n.conflicts.push(new ji(s,o))}}getGoto(e){return this.goto.find((t=>t.term==e))}hasSet(e){return Oi(this.set,e)}actionsByTerm(){let e=this._actionsByTerm;if(!e){this._actionsByTerm=e=Object.create(null);for(let t of this.actions)(e[t.term.id]||(e[t.term.id]=[])).push(t)}return e}finish(){if(this.actions.length){let e=this.actions[0];if(e instanceof Ti){let{rule:t}=e;this.actions.every((e=>e instanceof Ti&&e.rule.sameReduce(t)))&&(this.defaultReduce=t)}}this.actions.sort(((e,t)=>e.cmp(t))),this.goto.sort(((e,t)=>e.cmp(t)))}eq(e){let t=this.defaultReduce,n=e.defaultReduce;return t||n?!(!t||!n)&&t.sameReduce(n):this.skip==e.skip&&this.tokenGroup==e.tokenGroup&&Oi(this.actions,e.actions)&&Oi(this.goto,e.goto)}}function Pi(e,t){t.includes(e)||t.push(e)}class Ri{constructor(e,t){this.set=e,this.state=t}}class ji{constructor(e,t){this.error=e,this.rules=t}}function Ii(e){let t=null,n=1;for(let i of e){let e=i.rule.conflicts[i.pos-1].cut;en)&&(n=e,t=[]),t.push(i))}return t||e}function Li(e,t,n){for(let i of e.goto)for(let e of t.goto)if(i.term==e.term&&n[i.target.id]!=n[e.target.id])return!1;let i=t.actionsByTerm();for(let t of e.actions){let s=i[t.term.id];if(s&&s.some((e=>!e.matches(t,n)))){if(1==s.length)return!1;let i=e.actionsByTerm()[t.term.id];if(i.length!=s.length||i.some((e=>!s.some((t=>e.matches(t,n))))))return!1}}return!0}function Bi(e,t){let n=[];for(let i of e){let e=t[i.id];n[e]||(n[e]=new Di(e,i.set,0,i.skip,i.hash,i.startRule),n[e].tokenGroup=i.tokenGroup,n[e].defaultReduce=i.defaultReduce)}for(let i of e){let e=n[t[i.id]];e.flags|=i.flags;for(let s=0;se.eq(r)))||(e.actions.push(r),e.actionPositions.push(i.actionPositions[s]))}for(let s of i.goto){let i=s.map(t,n);e.goto.some((e=>e.eq(i)))||e.goto.push(i)}}return n}class Fi{constructor(e,t){this.origin=e,this.members=[t]}}function zi(e,t){if(e.length!=t.length)return!1;for(let n=0;n=34&&t++,t>=92&&t++,String.fromCharCode(t)}function qi(e,t=65535){if(e>t)throw new Error("Trying to encode a number that's too big: "+e);if(65535==e)return String.fromCharCode(126);let n="";for(let t=46;;t=0){let i=e%46,s=e-i;if(n=Hi(i+t)+n,0==s)break;e=s/46}return n}function Vi(e,t=65535){let n='"'+qi(e.length,4294967295);for(let i=0;i{this.input=new Gn(e,t.fileName),this.ast=this.input.parse()}));let n=o.uY;for(let e in n)n[e]instanceof o.uY&&!n[e].perNode&&(this.knownProps[e]={prop:n[e],source:{name:e,from:null}});for(let e of this.ast.externalProps)this.knownProps[e.id.name]={prop:this.options.externalProp?this.options.externalProp(e.id.name):new o.uY,source:{name:e.externalID.name,from:e.source}};this.dialects=this.ast.dialects.map((e=>e.name)),this.tokens=new ls(this,this.ast.tokens),this.localTokens=this.ast.localTokens.map((e=>new hs(this,e))),this.externalTokens=this.ast.externalTokens.map((e=>new ws(this,e))),this.externalSpecializers=this.ast.externalSpecializers.map((e=>new ks(this,e))),xi("Build rules",(()=>{let e=this.newName("%noskip",!0);this.defineRule(e,[]);let t=this.ast.mainSkip?this.newName("%mainskip",!0):e,n=[],i=[];for(let e of this.ast.rules)this.astRules.push({skip:t,rule:e});for(let e of this.ast.topRules)i.push({skip:t,rule:e});for(let s of this.ast.scopedSkip){let r=e,o=this.ast.scopedSkip.findIndex(((e,t)=>t-1?r=n[o]:this.ast.mainSkip&&yn(s.expr,this.ast.mainSkip)?r=t:bs(s.expr)||(r=this.newName("%skip",!0)),n.push(r);for(let e of s.rules)this.astRules.push({skip:r,rule:e});for(let e of s.topRules)i.push({skip:r,rule:e})}for(let{rule:e}of this.astRules)this.unique(e.id);this.currentSkip.push(e),this.skipRules=t==e?[t]:[e,t],t!=e&&this.defineRule(t,this.normalizeExpr(this.ast.mainSkip));for(let t=0;te.rule.start-t.rule.start))){this.unique(e.id),this.used(e.id.name),this.currentSkip.push(t);let{name:n,props:i}=this.nodeInfo(e.props,"a",e.id.name,Wi,Wi,e.expr),s=this.terms.makeTop(n,i);this.namedTerms[n]=s,this.defineRule(s,this.normalizeExpr(e.expr)),this.currentSkip.pop()}for(let e of this.externalSpecializers)e.finish();for(let{skip:e,rule:t}of this.astRules)this.ruleNames[t.id.name]&&As(t)&&!t.params.length&&(this.buildRule(t,[],e,!1),t.expr instanceof hn&&0==t.expr.exprs.length&&this.used(t.id.name))}));for(let e in this.ruleNames){let t=this.ruleNames[e];t&&this.warn(`Unused rule '${t.name}'`,t.start)}this.tokens.takePrecedences(),this.tokens.takeConflicts();for(let e of this.localTokens)e.takePrecedences();for(let{name:e,group:t,rule:n}of this.definedGroups)this.defineGroup(e,t,n);this.checkGroups()}unique(e){e.name in this.ruleNames&&this.raise(`Duplicate definition of rule '${e.name}'`,e.start),this.ruleNames[e.name]=e}used(e){this.ruleNames[e]=null}newName(e,t=null,n={}){for(let i=t?0:1;;i++){let s=i?`${e}-${i}`:e;if(!this.terms.names[s])return this.terms.makeNonTerminal(s,!0===t?null:t,n)}}prepareParser(){let e=xi("Simplify rules",(()=>function(e,t){return function(e){let t,n=Object.create(null);for(let i=0;i!n[e.name]))?t:new Pn(t.name,t.parts.map((e=>n[e.name]||e)),t.conflicts,t.skip));return i}(function(e,t){for(let n=0;;n++){let i,s=Object.create(null);if(0==n)for(let o of e)if(o.name.inline&&!s[o.name.name]){let a=e.filter((e=>e.name==o.name));if(a.some((e=>e.parts.includes(o.name))))continue;i=s[o.name.name]=a}for(let l=0;le.skip==h.skip||!e.parts.includes(h.name)))||h.parts.some((e=>!!s[e.name]))||e.some(((e,t)=>t!=l&&e.name==h.name))||(i=s[h.name.name]=[h])}if(!i)return e;let r=[];for(let c of e){function u(e,t,n){if(e==c.parts.length)return void r.push(new Pn(c.name,n,t,c.skip));let i=c.parts[e],o=s[i.name];if(o)for(let i of o)u(e+1,t.slice(0,t.length-1).concat(t[e].join(i.conflicts[0])).concat(i.conflicts.slice(1,i.conflicts.length-1)).concat(c.conflicts[e+1].join(i.conflicts[i.conflicts.length-1])),n.concat(i.parts));else u(e+1,t.concat(c.conflicts[e+1]),n.concat(i))}s[c.name.name]||(c.parts.some((e=>!!s[e.name]))?u(0,[c.conflicts[0]],[]):r.push(c))}e=r}}(e,t))}(this.rules,[...this.skipRules,...this.terms.tops]))),{nodeTypes:t,names:n,minRepeatTerm:i,maxTerm:s}=this.terms.finish(e);for(let e in this.namedTerms)this.termTable[e]=this.namedTerms[e].id;/\bgrammar\b/.test(yi)&&console.log(e.join("\n"));let r=this.terms.tops.slice(),o=function(e){let t=Object.create(null);for(let n of e.terms)n.terminal||(t[n.name]=[]);for(;;){let n=!1;for(let i of e.terms)if(!i.terminal)for(let e of i.rules){let s=t[i.name],r=!1,o=s.length;for(let n of e.parts){if(r=!0,n.terminal)Pi(n,s);else for(let e of t[n.name])null==e?r=!1:Pi(e,s);if(r)break}r||Pi(null,s),s.length>o&&(n=!0)}if(!n)return t}}(this.terms),a=this.skipRules.map(((e,t)=>{let n=[],i=[],s=[];for(let t of e.rules){if(!t.parts.length)continue;let e=t.parts[0];for(let t of e.terminal?[e]:o[e.name]||[])t&&!i.includes(t)&&i.push(t);e.terminal&&1==t.parts.length&&!s.some((n=>n!=t&&n.parts[0]==e))?n.push(e):s.push(t)}return e.rules=s,s.length&&r.push(e),{skip:n,rule:s.length?e:null,startTokens:i,id:t}})),l=xi("Build full automaton",(()=>function(e,t,n){let i=[],s={},r={},o=Date.now();function a(e,t){if(0==e.length)return null;let a,l=Ni(e),h=r[l];for(let t of e)if(a){if(a!=t.skip)throw new Sn("Inconsistent skip sets after "+t.trail())}else a=t.skip;if(h)for(let t of h)if(Oi(e,t.set)){if(t.state.skip!=a)throw new Sn("Inconsistent skip sets after "+t.set[0].trail());return t.state}let c,u=function(e,t){let n=[],i=[];function s(t,s,r,o,a){for(let l of t.rules){let t=n.find((e=>e.rule==l));if(!t){let i=e.find((e=>0==e.pos&&e.rule==l));t=i?new wi(l,0,i.ahead.slice(),i.ambigAhead,i.skipAhead,i.via):new wi(l,0,[],$i,o,a),n.push(t)}if(t.skipAhead!=o)throw new Sn("Inconsistent skip sets after "+a.trail());t.ambigAhead=En(t.ambigAhead,r);for(let e of s)t.ahead.includes(e)||(t.ahead.push(e),t.rule.parts.length&&!t.rule.parts[0].terminal&&Pi(t,i))}}for(let n of e){let e=n.next;e&&!e.terminal&&s(e,Ai(n.rule,n.pos,n.ahead,t),n.conflicts(n.pos+1).ambigGroups,n.pos==n.rule.parts.length-1?n.skipAhead:n.rule.skip,n)}for(;i.length;){let e=i.pop();s(e.rule.parts[0],Ai(e.rule,0,e.ahead,t),En(e.rule.conflicts[1].ambigGroups,1==e.rule.parts.length?e.ambigAhead:$i),1==e.rule.parts.length?e.skipAhead:e.rule.skip,e)}let r=e.slice();for(let t of n){t.ahead.sort(((e,t)=>e.hash-t.hash)),t.finish();let n=e.findIndex((e=>0==e.pos&&e.rule==t.rule));n>-1?r[n]=t:r.push(t)}return r.sort(((e,t)=>e.cmp(t)))}(e,n),f=Ni(u),d=s[f]||(s[f]=[]);if(!t)for(let e of d)e.hasSet(u)&&(c=e);return c||(c=new Di(i.length,u,0,a,f,t),d.push(c),i.push(c),vi&&i.length%500==0&&console.log(`${i.length} states after ${((Date.now()-o)/1e3).toFixed(2)}s`)),(r[l]||(r[l]=[])).push(new Ri(e,c)),c}for(const n of t){const t=n.rules.length?n.rules[0].skip:e.names["%noskip"];a(n.rules.map((n=>new wi(n,0,[e.eof],$i,t,null).finish())),n)}let l=new Ei(n);for(let e=0;ee.advance()));if(n.terminal){let s=a(Ii(i));s&&t.addAction(new _i(n,s),r[e],l)}else{let e=a(i);e&&t.goto.push(new _i(n,e))}}let h=!1;for(let e of o)for(let n of e.ahead){let i=t.actions.length;t.addAction(new Ti(n,e.rule),[e],l),t.actions.length==i&&(h=!0)}if(h)for(let e=0;et.actions.some((t=>t.term==e&&t instanceof _i))))||t.goto.splice(e--,1)}if(l.conflicts.length)throw new Sn(l.conflicts.map((e=>e.error)).join("\n\n"));for(let e of i)e.finish();return vi&&console.log(`${i.length} states total.`),i}(this.terms,r,o))),h=this.localTokens.map(((e,t)=>e.buildLocalGroup(l,a,t))),{tokenGroups:c,tokenPrec:u,tokenData:f}=xi("Build token groups",(()=>this.tokens.buildTokenGroups(l,a,h.length))),d=xi("Finish automaton",(()=>function(e){for(let t=1;;t++){let n=[],i=!1,s=Date.now(),r=[];for(let t=0;ts.eq(e)));if(o<0)n[t]=r.length,r.push(s);else{n[t]=o,i=!0;let e=r[o],a=null;for(let t of s.set)e.set.some((e=>e.eqSimple(t)))||(a||(a=[])).push(t);a&&(e.set=a.concat(e.set).sort(((e,t)=>e.cmp(t))))}}if(vi&&console.log(`Merge identical pass ${t}${i?"":", done"} (${((Date.now()-s)/1e3).toFixed(2)}s)`),!i)return e;for(let e of r)e.defaultReduce||(e.actions=e.actions.map((e=>e.map(n,r))),e.goto=e.goto.map((e=>e.map(n,r))));for(let e=0;eLi(o,e[n],t))))return void n[s].members.push(o.id);t[o.id]=n.length,n.push(new Fi(r.origin,o.id))}for(let s=1;;s++){let r=!1,o=Date.now();for(let s=0,o=n.length;s{n[e.id]||(n[e.id]=!0,i.push(e))};for(let n of e)n.startRule&&t.includes(n.startRule)&&s(n);for(let e=0;e!n[e]}(d,this.terms.tops);/\blr\b/.test(yi)&&console.log(d.join("\n"));let m=[];for(let e of this.externalSpecializers)m.push(e);for(let e in this.specialized)m.push({token:this.terms.names[e],table:Zi(this.specialized[e])});let g=e=>e instanceof ws?e.ast.start:this.tokens.ast?this.tokens.ast.start:-1,b=c.concat(this.externalTokens).sort(((e,t)=>g(e)-g(t))).concat(h),y=new es,v=a.map((e=>{let t=[];for(let n of e.skip)t.push(n.id,0,4);if(e.rule){let n=d.find((t=>t.startRule==e.rule));for(let e of n.actions)t.push(e.term.id,n.id,2)}return t.push(65535,0),y.storeArray(t)})),x=xi("Finish states",(()=>{let e=new Uint32Array(6*d.length),t=this.computeForceReductions(d,a),n=new Ji(b,y,e,v,a,d,this);for(let e of d)n.finish(e,p(e.id),t[e.id]);return e})),w=Object.create(null);for(let e=0;ee.id)).concat(65535));let k=null;if(this.dynamicRulePrecedences.length){k=Object.create(null);for(let{rule:e,prec:t}of this.dynamicRulePrecedences)k[e.id]=t}let S=Object.create(null);for(let e of this.terms.tops)S[e.nodeName]=[d.find((t=>t.startRule==e)).id,e.id];let C=y.storeArray(u.concat(65535)),{nodeProps:A,skippedTypes:O}=this.gatherNodeProps(t);return{states:x,stateData:y.finish(),goto:ts(d),nodeNames:t.filter((e=>e.ide.nodeName)).join(" "),nodeProps:A,skippedTypes:O,maxTerm:s,repeatNodeCount:t.length-i,tokenizers:b,tokenData:f,topRules:S,dialects:w,dynamicPrecedences:k,specialized:m,tokenPrec:C,termNames:n}}getParser(){let{states:e,stateData:t,goto:n,nodeNames:i,nodeProps:s,skippedTypes:r,maxTerm:o,repeatNodeCount:a,tokenizers:l,tokenData:h,topRules:c,dialects:u,dynamicPrecedences:f,specialized:d,tokenPrec:p,termNames:m}=this.prepareParser(),g=d.map((e=>{if(e instanceof ks){let t=this.options.externalSpecializer(e.ast.id.name,this.termTable);return{term:e.term.id,get:(n,i)=>t(n,i)<<1|("extend"==e.ast.type?1:0),external:t,extend:"extend"==e.ast.type}}return{term:e.token.id,get:t=>e.table[t]||-1}}));return $t.U1.deserialize({version:14,states:e,stateData:t,goto:n,nodeNames:i,maxTerm:o,repeatNodeCount:a,nodeProps:s.map((({prop:e,terms:t})=>[this.knownProps[e].prop,...t])),propSources:this.options.externalPropSource?this.ast.externalPropSources.map((e=>this.options.externalPropSource(e.id.name))):void 0,skippedNodes:r,tokenData:h,tokenizers:l.map((e=>e.create())),context:this.ast.context?"function"==typeof this.options.contextTracker?this.options.contextTracker(this.termTable):this.options.contextTracker:void 0,topRules:c,dialects:u,dynamicPrecedences:f,specialized:g,tokenPrec:p,termNames:m})}getParserFile(){let{states:e,stateData:t,goto:n,nodeNames:i,nodeProps:s,skippedTypes:r,maxTerm:o,repeatNodeCount:a,tokenizers:l,tokenData:h,topRules:c,dialects:u,dynamicPrecedences:f,specialized:d,tokenPrec:p,termNames:m}=this.prepareParser(),g=this.options.moduleStyle||"es",b="// This file was generated by lezer-generator. You probably shouldn't edit it.\n",y=b,v={},x=Object.create(null),w=Object.create(null);for(let e of Cs)w[e]=!0;let k=this.options.exportName||"parser";w[k]=!0;let S=e=>{for(let t=0;;t++){let n=e+(t?"_"+t:"");if(!w[n])return n}},C=(e,t,n=e)=>{let i=e+" from "+t;if(x[i])return x[i];let s=JSON.stringify(t),r=e;return e in w&&(r=S(n),e+=`${"cjs"==g?":":" as"} ${r}`),w[r]=!0,(v[s]||(v[s]=[])).push(e),x[i]=r},A=C("LRParser","@lezer/lr"),O=l.map((e=>e.createSource(C))),M=this.ast.context?C(this.ast.context.id.name,this.ast.context.source):null,_=s.map((({prop:e,terms:t})=>{let{source:n}=this.knownProps[e];return`[${n.from?C(n.name,n.from):JSON.stringify(n.name)}, ${t.map(D).join(",")}]`})),T="",N=d.map((e=>{if(e instanceof ks){let t=C(e.ast.id.name,e.ast.source),n=this.options.typeScript?": any":"";return`{term: ${e.term.id}, get: (value${n}, stack${n}) => (${t}(value, stack) << 1)${"extend"==e.ast.type?" | 1":""}, external: ${t}${"extend"==e.ast.type?", extend: true":""}}`}{let n=S("spec_"+e.token.name.replace(/\W/g,""));w[n]=!0,T+=`const ${n} = ${t=e.table,"{__proto__:null,"+Object.keys(t).map((e=>`${/^(\d+|[a-zA-Z_]\w*)$/.test(e)?e:JSON.stringify(e)}:${t[e]}`)).join(", ")+"}"}\n`;let i=this.options.typeScript?`: keyof typeof ${n}`:"";return`{term: ${e.token.id}, get: (value${i}) => ${n}[value] || -1}`}var t})),E=this.ast.externalPropSources.map((e=>C(e.id.name,e.source)));for(let e in v)y+="cjs"==g?`const {${v[e].join(", ")}} = require(${e})\n`:`import {${v[e].join(", ")}} from ${e}\n`;function D(e){return"string"!=typeof e||/^(true|false|\d+(\.\d+)?|\.\d+)$/.test(e)?e:JSON.stringify(e)}y+=T;let P=Object.keys(u).map((e=>`${e}: ${u[e]}`)),R=`${A}.deserialize({\n version: 14,\n states: ${Vi(e,4294967295)},\n stateData: ${Vi(t)},\n goto: ${Vi(n)},\n nodeNames: ${JSON.stringify(i)},\n maxTerm: ${o}${M?`,\n context: ${M}`:""}${_.length?`,\n nodeProps: [\n ${_.join(",\n ")}\n ]`:""}${E.length?`,\n propSources: [${E.join()}]`:""}${r.length?`,\n skippedNodes: ${JSON.stringify(r)}`:""},\n repeatNodeCount: ${a},\n tokenData: ${Vi(h)},\n tokenizers: [${O.join(", ")}],\n topRules: ${JSON.stringify(c)}${P.length?`,\n dialects: {${P.join(", ")}}`:""}${f?`,\n dynamicPrecedences: ${JSON.stringify(f)}`:""}${N.length?`,\n specialized: [${N.join(",")}]`:""},\n tokenPrec: ${p}${this.options.includeNames?`,\n termNames: ${JSON.stringify(m)}`:""}\n})`,j=[];for(let e in this.termTable){let t=e;if(Cs.includes(t))for(let n=1;t="_".repeat(n)+e,t in this.termTable;n++);else if(!/^[\w$]+$/.test(e))continue;j.push(`${t}${"cjs"==g?":":" ="} ${this.termTable[e]}`)}for(let e=0;e{e[n.id]||(e[n.id]=!0,t.push(n))};this.terms.tops.forEach(n);for(let e=0;et.prop==e));n||i.push(n={prop:e,values:{}}),(n.values[s.props[e]]||(n.values[s.props[e]]=[])).push(s.id)}}return{nodeProps:i.map((({prop:e,values:t})=>{let n=[];for(let e in t){let i=t[e];if(1==i.length)n.push(i[0],e);else{n.push(-i.length);for(let e of i)n.push(e);n.push(e)}}return{prop:e,terms:n}})),skippedTypes:n}}makeTerminal(e,t,n){return this.terms.makeTerminal(this.terms.uniqueName(e),t,n)}computeForceReductions(e,t){let n=[],i=[],s=Object.create(null);for(let t of e){n.push(0);for(let e of t.goto){let n=s[e.term.id]||(s[e.term.id]=[]),i=n.find((t=>t.target==e.target.id));i?i.parents.push(t.id):n.push({parents:[t.id],target:e.target.id})}i[t.id]=t.set.filter((e=>e.pos>0&&!e.rule.name.top)).sort(((e,t)=>t.pos-e.pos||e.rule.parts.length-t.rule.parts.length))}let r=Object.create(null);function o(e,t,n=null){let i=s[e];return!!i&&i.some((e=>{let i=n?n.filter((t=>e.parents.includes(t))):e.parents;if(0==i.length)return!1;if(e.target==t)return!0;let s=r[e.target];return null!=s&&o(s,t,i)}))}for(let i of e)i.defaultReduce&&i.defaultReduce.parts.length>0&&(n[i.id]=Qi(i.defaultReduce,t),1==i.defaultReduce.parts.length&&(r[i.id]=i.defaultReduce.name.id));for(let s=1;;s++){let a=!0;for(let l of e){if(l.defaultReduce)continue;let e=i[l.id];if(e.length==s){for(let i of e)if(1!=i.pos||!o(i.rule.name.id,l.id)){n[l.id]=Qi(i.rule,t,i.pos),1==i.pos&&(r[l.id]=i.rule.name.id);break}}else e.length>s&&(a=!1)}if(a)break}return n}substituteArgs(e,t,n){return 0==t.length?e:e.walk((e=>{let i;if(e instanceof rn&&(i=n.findIndex((t=>t.name==e.id.name)))>-1){let n=t[i];if(e.args.length){if(n instanceof rn&&!n.args.length)return new rn(e.start,n.id,e.args);this.raise("Passing arguments to a parameter that already has arguments",e.start)}return n}if(e instanceof an){let i=e.rule,s=this.substituteArgsInProps(i.props,t,n);return s==i.props?e:new an(e.start,new Vt(i.start,i.id,s,i.params,i.expr))}if(e instanceof on){let i=this.substituteArgsInProps(e.props,t,n);return i==e.props?e:new on(e.start,e.type,i,e.token,e.content)}return e}))}substituteArgsInProps(e,t,n){let i=e=>{let i=e;for(let s=0;se.name==r.name));if(o<0)continue;i==e&&(i=e.slice());let a=t[o];a instanceof rn&&!a.args.length?i[s]=new wn(r.start,a.id.name,null):a instanceof fn?i[s]=new wn(r.start,a.value,null):this.raise(`Trying to interpolate expression '${a}' into a prop`,r.start)}return i},s=e;for(let t=0;te.id.name==i.id.name)):-1;s<0&&this.raise(`Reference to unknown precedence: '${i.id.name}'`,i.id.start);let r=e.items[s],o=e.items.length-s;"cut"==r.type?t=t.join(new Nn(0,Wi,o)):(t=t.join(new Nn(o<<2)),n=n.join(new Nn((o<<2)+("left"==r.type?1:"right"==r.type?-1:0))))}return{here:t,atEnd:n}}raise(e,t=1){return this.input.raise(e,t)}warn(e,t=-1){let n=this.input.message(e,t);this.options.warn?this.options.warn(n):console.warn(n)}defineRule(e,t){let n=this.currentSkip[this.currentSkip.length-1];for(let i of t)this.rules.push(new Pn(e,i.terms,i.ensureConflicts(),n))}resolve(e){for(let t of this.built)if(t.matches(e))return[Ui(t.term)];let t=this.tokens.getToken(e);if(t)return[Ui(t)];for(let t of this.localTokens){let n=t.getToken(e);if(n)return[Ui(n)]}for(let t of this.externalTokens){let n=t.getToken(e);if(n)return[Ui(n)]}for(let t of this.externalSpecializers){let n=t.getToken(e);if(n)return[Ui(n)]}let n=this.astRules.find((t=>t.rule.id.name==e.id.name));return n?(n.rule.params.length!=e.args.length&&this.raise(`Wrong number or arguments for '${e.id.name}'`,e.start),this.used(n.rule.id.name),[Ui(this.buildRule(n.rule,e.args,n.skip))]):this.raise(`Reference to undefined rule '${e.id.name}'`,e.start)}normalizeRepeat(e){let t=this.built.find((t=>t.matchesRepeat(e)));if(t)return Ui(t.term);let n=e.expr.precthis.normalizeExpr(e))),n=this;return function i(s,r,o){let{here:a,atEnd:l}=n.conflictsFor(e.markers[r]);if(r==t.length)return[s.withConflicts(s.terms.length,a.join(o))];let h=[];for(let e of t[r])for(let t of i(s.concat(e).withConflicts(s.terms.length,a),r+1,o.join(l)))h.push(t);return h}(Gi.none,0,Nn.none)}normalizeExpr(e){if(e instanceof un&&"?"==e.kind)return[Gi.none,...this.normalizeExpr(e.expr)];if(e instanceof un){let t=this.normalizeRepeat(e);return"+"==e.kind?[t]:[Gi.none,t]}return e instanceof ln?e.exprs.reduce(((e,t)=>e.concat(this.normalizeExpr(t))),[]):e instanceof hn?this.normalizeSequence(e):e instanceof fn?[Ui(this.tokens.getLiteral(e))]:e instanceof rn?this.resolve(e):e instanceof on?[Ui(this.resolveSpecialization(e))]:e instanceof an?[Ui(this.buildRule(e.rule,Wi,this.currentSkip[this.currentSkip.length-1],!0))]:this.raise(`This type of expression ('${e}') may not occur in non-token rules`,e.start)}buildRule(e,t,n,i=!1){let s=this.substituteArgs(e.expr,t,e.params),{name:r,props:o,dynamicPrec:a,inline:l,group:h,exported:c}=this.nodeInfo(e.props||Wi,i?"pg":"pgi",e.id.name,t,e.params,e.expr);c&&e.params.length&&this.warn("Can't export parameterized rules",e.start),c&&i&&this.warn("Can't export inline rule",e.start);let u=this.newName(e.id.name+(t.length?"<"+t.join(",")+">":""),r||!0,o);l&&(u.inline=!0),a&&this.registerDynamicPrec(u,a),(u.nodeType||c)&&0==e.params.length&&(r||(u.preserve=!0),i||(this.namedTerms[c||e.id.name]=u)),i||this.built.push(new Ki(e.id.name,t,u)),this.currentSkip.push(n);let f=this.normalizeExpr(s);return f.length>100*(s instanceof ln?s.exprs.length:1)&&this.warn(`Rule ${e.id.name} is generating a lot (${f.length}) of choices.\n Consider splitting it up or reducing the amount of ? or | operator uses.`,e.start),/\brulesize\b/.test(yi)&&f.length>10&&console.log(`Rule ${e.id.name}: ${f.length} variants`),this.defineRule(u,f),this.currentSkip.pop(),h&&this.definedGroups.push({name:u,group:h,rule:e}),u}nodeInfo(e,t,n=null,i=Wi,s=Wi,r,o){let a={},l=n&&(t.indexOf("a")>-1||!function(e){let t=e[0];return"_"==t||t.toUpperCase()!=t}(n))&&!/ /.test(n)?n:null,h=null,c=0,u=!1,f=null,d=null;for(let r of e)if(r.at)if("name"==r.name)l=this.finishProp(r,i,s),/ /.test(l)&&this.raise(`Node names cannot have spaces ('${l}')`,r.start);else if("dialect"==r.name){t.indexOf("d")<0&&this.raise("Can't specify a dialect on non-token rules",e[0].start),1==r.value.length||r.value[0].value||this.raise("The '@dialect' rule prop must hold a plain string value");let n=this.dialects.indexOf(r.value[0].value);n<0&&this.raise(`Unknown dialect '${r.value[0].value}'`,r.value[0].start),h=n}else"dynamicPrecedence"==r.name?(t.indexOf("p")<0&&this.raise("Dynamic precedence can only be specified on nonterminals"),1==r.value.length&&/^-?(?:10|\d)$/.test(r.value[0].value)||this.raise("The '@dynamicPrecedence' rule prop must hold an integer between -10 and 10"),c=+r.value[0].value):"inline"==r.name?(r.value.length&&this.raise("'@inline' doesn't take a value",r.value[0].start),t.indexOf("i")<0&&this.raise("Inline can only be specified on nonterminals"),u=!0):"isGroup"==r.name?(t.indexOf("g")<0&&this.raise("'@isGroup' can only be specified on nonterminals"),f=r.value.length?this.finishProp(r,i,s):n):"export"==r.name?d=r.value.length?this.finishProp(r,i,s):n:this.raise(`Unknown built-in prop name '@${r.name}'`,r.start);else{if(!this.knownProps[r.name]){let e=["name","dialect","dynamicPrecedence","export","isGroup"].includes(r.name)?` (did you mean '@${r.name}'?)`:"";this.raise(`Unknown prop name '${r.name}'${e}`,r.start)}a[r.name]=this.finishProp(r,i,s)}if(r&&this.ast.autoDelim&&(l||Cn(a))){let e=this.findDelimiters(r);e&&(Xi(e[0],"closedBy",e[1].nodeName),Xi(e[1],"openedBy",e[0].nodeName))}if(o&&Cn(o))for(let e in o)e in a||(a[e]=o[e]);return Cn(a)&&!l&&this.raise("Node has properties but no name",e.length?e[0].start:r.start),u&&(Cn(a)||h||c)&&this.raise("Inline nodes can't have props, dynamic precedence, or a dialect",e[0].start),u&&l&&(l=null),{name:l,props:a,dialect:h,dynamicPrec:c,inline:u,group:f,exported:d}}finishProp(e,t,n){return e.value.map((e=>{if(e.value)return e.value;let i=n.findIndex((t=>t.name==e.name));i<0&&this.raise(`Property refers to '${e.name}', but no parameter by that name is in scope`,e.start);let s=t[i];return s instanceof rn&&!s.args.length?s.id.name:s instanceof fn?s.value:this.raise(`Expression '${s}' can not be used as part of a property value`,e.start)})).join("")}resolveSpecialization(e){let t,n=e.type,{name:i,props:s,dialect:r,exported:o}=this.nodeInfo(e.props,"d"),a=this.normalizeExpr(e.token);if(1==a.length&&1==a[0].terms.length&&a[0].terms[0].terminal||this.raise(`The first argument to '${n}' must resolve to a token`,e.token.start),e.content instanceof fn)t=[e.content.value];else{if(!(e.content instanceof ln&&e.content.exprs.every((e=>e instanceof fn))))return this.raise(`The second argument to '${e.type}' must be a literal or choice of literals`,e.content.start);t=e.content.exprs.map((e=>e.value))}let l=a[0].terms[0],h=null,c=this.specialized[l.name]||(this.specialized[l.name]=[]);for(let a of t){let t=c.find((e=>e.value==a));null==t?(h||(h=this.makeTerminal(l.name+"/"+JSON.stringify(a),i,s),null!=r&&(this.tokens.byDialect[r]||(this.tokens.byDialect[r]=[])).push(h)),c.push({value:a,term:h,type:n,dialect:r,name:i}),this.tokenOrigins[h.name]={spec:l},(i||o)&&(i||(h.preserve=!0),this.namedTerms[o||i]=h)):(t.type!=n&&this.raise(`Conflicting specialization types for ${JSON.stringify(a)} of ${l.name} (${n} vs ${t.type})`,e.start),t.dialect!=r&&this.raise(`Conflicting dialects for specialization ${JSON.stringify(a)} of ${l.name}`,e.start),t.name!=i&&this.raise(`Conflicting names for specialization ${JSON.stringify(a)} of ${l.name}`,e.start),h&&t.term!=h&&this.raise(`Conflicting specialization tokens for ${JSON.stringify(a)} of ${l.name}`,e.start),h=t.term)}return h}findDelimiters(e){if(!(e instanceof hn)||e.exprs.length<2)return null;let t=e=>{if(e instanceof fn)return{term:this.tokens.getLiteral(e),str:e.value};if(e instanceof rn&&0==e.args.length){let n=this.ast.rules.find((t=>t.id.name==e.id.name));if(n)return t(n.expr);let i=this.tokens.rules.find((t=>t.id.name==e.id.name));if(i&&i.expr instanceof fn)return{term:this.tokens.getToken(e),str:i.expr.value}}return null},n=t(e.exprs[e.exprs.length-1]);if(!n||!n.term.nodeName)return null;let i=["()","[]","{}","<>"].find((e=>n.str.indexOf(e[1])>-1&&n.str.indexOf(e[0])<0));if(!i)return null;let s=t(e.exprs[0]);return!s||!s.term.nodeName||s.str.indexOf(i[0])<0||s.str.indexOf(i[1])>-1?null:[s.term,n.term]}registerDynamicPrec(e,t){this.dynamicRulePrecedences.push({rule:e,prec:t}),e.preserve=!0}defineGroup(e,t,n){var i;let s=[],r=e=>{if(e.nodeName)return[e];s.includes(e)&&this.raise(`Rule '${n.id.name}' cannot define a group because it contains a non-named recursive rule ('${e.name}')`,n.start);let t=[];s.push(e);for(let i of this.rules)if(i.name==e){let e=i.parts.map(r).filter((e=>e.length));if(e.length>1&&this.raise(`Rule '${n.id.name}' cannot define a group because some choices produce multiple named nodes`,n.start),1==e.length)for(let n of e[0])t.push(n)}return s.pop(),t};for(let n of r(e))n.props.group=((null===(i=n.props.group)||void 0===i?void 0:i.split(" "))||[]).concat(t).sort().join(" ")}checkGroups(){let e=Object.create(null),t=Object.create(null);for(let n of this.terms.terms)if(n.nodeName&&(t[n.nodeName]=!0,n.props.group))for(let t of n.props.group.split(" "))(e[t]||(e[t]=[])).push(n);let n=Object.keys(e);for(let i=0;ii.includes(e)))&&(r.length>i.length?i.some((e=>!r.includes(e))):r.some((e=>!i.includes(e))))&&this.warn(`Groups '${s}' and '${n[t]}' overlap without one being a superset of the other`)}}}}class Ji{constructor(e,t,n,i,s,r,o){this.tokenizers=e,this.data=t,this.stateArray=n,this.skipData=i,this.skipInfo=s,this.states=r,this.builder=o,this.sharedActions=[]}findSharedActions(e){if(e.actions.length<5)return null;let t=null;for(let n of this.sharedActions)(!t||n.actions.length>t.actions.length)&&n.actions.every((t=>e.actions.some((e=>e.eq(t)))))&&(t=n);if(t)return t;let n=null,i=[];for(let t=e.id+1;t=5&&(!n||n.lengthe.eq(s))))if(s instanceof _i)i.push(s.term.id,s.target.id,0);else{let e=Qi(s.rule,this.skipInfo);e!=t&&i.push(s.term.id,65535&e,e>>16)}return i.push(65535),t>-1?i.push(2,65535&t,t>>16):n?i.push(1,65535&n.addr,n.addr>>16):i.push(0),this.data.storeArray(i)}finish(e,t,n){let i=this.builder,s=i.skipRules.indexOf(e.skip),r=this.skipData[s],o=this.skipInfo[s].startTokens,a=e.defaultReduce?Qi(e.defaultReduce,this.skipInfo):0,l=t?1:0,h=-1,c=null;if(0==a){if(t)for(const t of e.actions)t instanceof Ti&&t.term.eof&&(h=Qi(t.rule,this.skipInfo));h<0&&(c=this.findSharedActions(e))}e.set.some((e=>e.rule.name.top&&e.pos==e.rule.parts.length))&&(l|=2);let u=[];for(let t=0;tt.rule==e.name))?262144:0)|n<<19}class es{constructor(){this.data=[]}storeArray(e){let t=function(e,t){e:for(let n=0;;){let i=e.indexOf(t[0],n);if(-1==i||i+t.length>e.length)break;for(let s=1;s-1)return t;let n=this.data.length;for(let t of e)this.data.push(t);return n}finish(){return Uint16Array.from(this.data)}}function ts(e){let t={},n=0;for(let i of e)for(let e of i.goto){n=Math.max(e.term.id,n);let s=t[e.term.id]||(t[e.term.id]={});(s[e.target.id]||(s[e.target.id]=[])).push(i.id)}let i=new es,s=[],r=n+2;for(let e=0;e<=n;e++){let n=t[e];if(!n){s.push(1);continue}let o=[],a=Object.keys(n);for(let e of a){let t=n[e];o.push((e==a[a.length-1]?1:0)+(t.length<<1)),o.push(+e);for(let e of t)o.push(e)}s.push(i.storeArray(o)+r)}if(s.some((e=>e>65535)))throw new Sn("Goto table too large");return Uint16Array.from([n+1,...s,...i.data])}class ns{constructor(e,t){this.tokens=e,this.groupID=t}create(){return this.groupID}createSource(){return String(this.groupID)}}function is(e,t){e.includes(t)||e.push(t)}function ss(e){let t=Object.create(null);for(let n of e){let e=1<e.id.name==t));if(!n)return null;let{name:i,props:s,dialect:r,exported:o}=this.b.nodeInfo(n.props,"d",t,e.args,n.params.length!=e.args.length?Wi:n.params),a=this.b.makeTerminal(e.toString(),i,s);return null!=r&&(this.byDialect[r]||(this.byDialect[r]=[])).push(a),(a.nodeType||o)&&0==n.params.length&&(a.nodeType||(a.preserve=!0),this.b.namedTerms[o||t]=a),this.buildRule(n,e,this.startState,new Fn([a])),this.built.push(new Ki(t,e.args,a)),a}buildRule(e,t,n,i,s=Wi){let r=t.id.name;e.params.length!=t.args.length&&this.b.raise(`Incorrect number of arguments for token '${r}'`,t.start);let o=this.building.find((e=>e.name==r&&vn(t.args,e.args)));if(o){if(o.to==i)return void n.nullEdge(o.start);let e=this.building.length-1;for(;this.building[e].name!=r;)e--;this.b.raise(`Invalid (non-tail) recursion in token rules: ${this.building.slice(e).map((e=>e.name)).join(" -> ")}`,t.start)}this.b.used(e.id.name);let a=new Fn;n.nullEdge(a),this.building.push(new os(r,a,i,t.args)),this.build(this.b.substituteArgs(e.expr,t.args,e.params),a,i,t.args.map(((t,n)=>new rs(e.params[n].name,t,s)))),this.building.pop()}build(e,t,n,i){if(e instanceof rn){let s,r=e.id.name,o=i.find((e=>e.name==r));if(o)return this.build(o.expr,t,n,o.scope);for(let e=0,t=this.b.localTokens;e<=t.length&&(s=(e==t.length?this.b.tokens:t[e]).rules.find((e=>e.id.name==r)),!s);e++);if(!s)return this.b.raise(`Reference to token rule '${r}', which isn't found`,e.start);this.buildRule(s,e,t,n,i)}else if(e instanceof bn)for(let[i,s]of gn[e.type])t.edge(i,s,n);else if(e instanceof ln)for(let s of e.exprs)this.build(s,t,n,i);else if(bs(e))t.nullEdge(n);else if(e instanceof hn){let s=e.markers.find((e=>e.length>0));s&&this.b.raise("Conflict marker in token expression",s[0].start);for(let s=0;st&&n.push([t,i]),t=s;return t<=ds&&n.push([t,ds+1]),n}(e.ranges):e.ranges)gs(t,n,i,s);else if(e instanceof fn)for(let i=0;it.id==e));n&&t.push(n.term)}t.length||this.b.warn(`Precedence specified for unknown token ${i}`,i.start);for(let i of t)xs(e,i,n);n=n.concat(t)}}}precededBy(e,t){let n=this.precedenceRelations.find((t=>t.term==e));return n&&n.after.includes(t)}buildPrecTable(e){let t=[],n=this.precedenceRelations.slice();for(let{a:t,b:i,soft:s}of e)if(s){if(!n.some((e=>e.term==t))||!n.some((e=>e.term==i)))continue;s<0&&([t,i]=[i,t]),xs(n,i,[t]),xs(n,t,[])}e:for(;n.length;){for(let e=0;et.includes(e.id)))){if(t.push(i.term.id),1==n.length)break e;n[e]=n.pop();continue e}}this.b.raise(`Cyclic token precedence relation between ${n.map((e=>e.term)).join(", ")}`)}return t}}class ls extends as{constructor(){super(...arguments),this.explicitConflicts=[]}getLiteral(e){let t=JSON.stringify(e.value);for(let e of this.built)if(e.id==t)return e.term;let n=null,i={},s=null,r=null,o=this.ast?this.ast.literals.find((t=>t.literal==e.value)):null;o&&({name:n,props:i,dialect:s,exported:r}=this.b.nodeInfo(o.props,"da",e.value));let a=this.b.makeTerminal(t,n,i);return null!=s&&(this.byDialect[s]||(this.byDialect[s]=[])).push(a),r&&(this.b.namedTerms[r]=a),this.build(e,this.startState,new Fn([a]),Wi),this.built.push(new Ki(t,Wi,a)),a}takeConflicts(){var e;let t=e=>{if(e instanceof rn){for(let t of this.built)if(t.matches(e))return t.term}else{let t=JSON.stringify(e.value),n=this.built.find((e=>e.id==t));if(n)return n.term}return this.b.warn(`Precedence specified for unknown token ${e}`,e.start),null};for(let n of(null===(e=this.ast)||void 0===e?void 0:e.conflicts)||[]){let e=t(n.a),i=t(n.b);e&&i&&(e.ide.id.name==i.accepting[0].name)).start),/\btokens\b/.test(yi)&&console.log(i.toString());let s=i.findConflicts(function(e,t,n){let i=Object.create(null);function s(e,i){return e.actions.some((e=>e.term==i))||n[t.skipRules.indexOf(e.skip)].startTokens.includes(i)}return(t,n)=>{t.ids(e,t)&&s(e,n)))}}(e,this.b,t)).filter((({a:e,b:t})=>!this.precededBy(e,t)&&!this.precededBy(t,e)));for(let{a:e,b:t}of this.explicitConflicts)s.some((n=>n.a==e&&n.b==t))||s.push(new zn(e,t,0,"",""));let r=s.filter((e=>e.soft)),o=s.filter((e=>!e.soft)),a=[],l=[];for(let i of e){if(i.defaultReduce||i.tokenGroup>-1)continue;let e=[],s=[],r=t[this.b.skipRules.indexOf(i.skip)].startTokens;for(let e of r)i.actions.some((t=>t.term==e))&&this.b.raise(`Use of token ${e.name} conflicts with skip rule`);let h=[];for(let e=0;ee.conflict==n))){let e=n.exampleA?` (example: ${JSON.stringify(n.exampleA)}${n.exampleB?` vs ${JSON.stringify(n.exampleB)}`:""})`:"";a.push({error:`Overlapping tokens ${t.name} and ${r.name} used in same context${e}\nAfter: ${i.set[0].trail()}`,conflict:n})}is(e,t),is(s,r)}}let c=null;for(let t of l)if(!s.some((e=>t.tokens.includes(e)))){for(let n of e)is(t.tokens,n);c=t;break}c||(c=new ns(e,l.length+n),l.push(c)),i.tokenGroup=c.groupID}a.length&&this.b.raise(a.map((e=>e.error)).join("\n\n")),l.length+n>16&&this.b.raise(`Too many different token groups (${l.length}) to represent them as a 16-bit bitfield`);let h=this.buildPrecTable(r);return{tokenGroups:l,tokenPrec:h,tokenData:i.toArray(ss(l),h)}}}class hs extends as{constructor(e,t){super(e,t),this.fallback=null,t.fallback&&e.unique(t.fallback.id)}getToken(e){let t=null;if(this.ast.fallback&&this.ast.fallback.id.name==e.id.name){if(e.args.length&&this.b.raise(`Incorrect number of arguments for ${e.id.name}`,e.start),!this.fallback){let{name:t,props:n,exported:i}=this.b.nodeInfo(this.ast.fallback.props,"",e.id.name,Wi,Wi),s=this.fallback=this.b.makeTerminal(e.id.name,t,n);(s.nodeType||i)&&(s.nodeType||(s.preserve=!0),this.b.namedTerms[i||e.id.name]=s),this.b.used(e.id.name)}t=this.fallback}else t=super.getToken(e);return t&&!this.b.tokenOrigins[t.name]&&(this.b.tokenOrigins[t.name]={group:this}),t}buildLocalGroup(e,t,n){let i=this.startState.compile();i.accepting.length&&this.b.raise(`Grammar contains zero-length tokens (in '${i.accepting[0].name}')`,this.rules.find((e=>e.id.name==i.accepting[0].name)).start);for(let{a:e,b:t,exampleA:n}of i.findConflicts((()=>!0)))this.precededBy(e,t)||this.precededBy(t,e)||this.b.raise(`Overlapping tokens ${e.name} and ${t.name} in local token group${n?` (example: ${JSON.stringify(n)})`:""}`);for(let i of e){if(i.defaultReduce)continue;let e=null,s=t[this.b.skipRules.indexOf(i.skip)].startTokens[0];for(let{term:t}of i.actions){let n=this.b.tokenOrigins[t.name];(null==n?void 0:n.group)==this?e=t:s=t}e&&(s&&this.b.raise(`Tokens from a local token group used together with other tokens (${e.name} with ${s.name})`),i.tokenGroup=n)}let s=this.buildPrecTable(Wi),r=i.toArray({[n]:65535},s),o=r.length,a=new Uint16Array(r.length+s.length+1);return a.set(r,0),a.set(s,o),a[a.length-1]=65535,{groupID:n,create:()=>new $t.uC(a,o,this.fallback?this.fallback.id:void 0),createSource:e=>`new ${e("LocalTokenGroup","@lezer/lr")}(${Vi(a)}, ${o}${this.fallback?`, ${this.fallback.id}`:""})`}}}const cs=65536,us=55296,fs=57344,ds=1114111,ps=56320,ms=57343;function gs(e,t,n,i){if(nfs&&e.edge(Math.max(n,fs),Math.min(i,65536),t),n=cs),i<=cs)return;let s=String.fromCodePoint(n),r=String.fromCodePoint(i-1),o=s.charCodeAt(0),a=s.charCodeAt(1),l=r.charCodeAt(0),h=r.charCodeAt(1);if(o==l){let n=new Fn;e.edge(o,o+1,n),n.edge(a,h+1,t)}else{let n=o,i=l;if(a>ps){n++;let i=new Fn;e.edge(o,o+1,i),i.edge(a,ms+1,t)}if(he.term==t));i<0?e.push({term:t,after:n}):e[i]={term:t,after:e[i].after.concat(n)}}class ws{constructor(e,t){this.b=e,this.ast=t,this.tokens=ys(e,t.tokens);for(let e in this.tokens)this.b.tokenOrigins[this.tokens[e].name]={external:this}}getToken(e){return vs(this.b,this.tokens,e)}create(){return this.b.options.externalTokenizer(this.ast.id.name,this.b.termTable)}createSource(e){let{source:t,id:{name:n}}=this.ast;return e(n,t)}}class ks{constructor(e,t){this.b=e,this.ast=t,this.term=null,this.tokens=ys(e,t.tokens)}finish(){let e=this.b.normalizeExpr(this.ast.token);1==e.length&&1==e[0].terms.length&&e[0].terms[0].terminal||this.b.raise(`The token expression to '@external ${this.ast.type}' must resolve to a token`,this.ast.token.start),this.term=e[0].terms[0];for(let e in this.tokens)this.b.tokenOrigins[this.tokens[e].name]={spec:this.term,external:this}}getToken(e){return vs(this.b,this.tokens,e)}}function Ss(e,t={}){let n=new Yi(e,t),i=n.getParser();return i.termTable=n.termTable,i}const Cs=["await","break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","while","with","null","true","false","instanceof","typeof","void","delete","new","in","this","const","class","extends","export","import","super","enum","implements","interface","let","package","private","protected","public","static","yield","require"];function As(e){return e.props.some((e=>e.at&&"export"==e.name))}const Os=s.Lz.theme({"&":{background:"var(--jp-layout-color0)",color:"var(--jp-content-font-color1)"},".jp-CodeConsole &, .jp-Notebook &":{background:"transparent"},".cm-content":{caretColor:"var(--jp-editor-cursor-color)"},".cm-scroller":{fontFamily:"inherit"},".cm-cursor, .cm-dropCursor":{borderLeft:"var(--jp-code-cursor-width0) solid var(--jp-editor-cursor-color)"},".cm-selectionBackground, .cm-content ::selection":{backgroundColor:"var(--jp-editor-selected-background)"},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{backgroundColor:"var(--jp-editor-selected-focused-background)"},".cm-gutters":{borderRight:"1px solid var(--jp-border-color2)",backgroundColor:"var(--jp-layout-color2)"},".cm-gutter":{backgroundColor:"var(--jp-layout-color2)"},".cm-activeLine":{backgroundColor:"color-mix(in srgb, var(--jp-layout-color3) 25%, transparent)"},".cm-lineNumbers":{color:"var(--jp-ui-font-color2)"},".cm-searchMatch":{backgroundColor:"var(--jp-search-unselected-match-background-color)",color:"var(--jp-search-unselected-match-color)"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"var(--jp-search-selected-match-background-color) !important",color:"var(--jp-search-selected-match-color) !important"},".cm-tooltip":{backgroundColor:"var(--jp-layout-color1)"},".cm-builtin":{color:"var(--jp-mirror-editor-builtin-color)"}}),Ms=r.cr.define([{tag:De._A.meta,color:"var(--jp-mirror-editor-meta-color)"},{tag:De._A.heading,color:"var(--jp-mirror-editor-header-color)"},{tag:[De._A.heading1,De._A.heading2,De._A.heading3,De._A.heading4],color:"var(--jp-mirror-editor-header-color)",fontWeight:"bold"},{tag:De._A.keyword,color:"var(--jp-mirror-editor-keyword-color)",fontWeight:"bold"},{tag:De._A.atom,color:"var(--jp-mirror-editor-atom-color)"},{tag:De._A.number,color:"var(--jp-mirror-editor-number-color)"},{tag:[De._A.definition(De._A.name),De._A.function(De._A.definition(De._A.variableName))],color:"var(--jp-mirror-editor-def-color)"},{tag:De._A.standard(De._A.variableName),color:"var(--jp-mirror-editor-builtin-color)"},{tag:[De._A.special(De._A.variableName),De._A.self],color:"var(--jp-mirror-editor-variable-2-color)"},{tag:De._A.punctuation,color:"var(--jp-mirror-editor-punctuation-color)"},{tag:De._A.propertyName,color:"var(--jp-mirror-editor-property-color)"},{tag:De._A.operator,color:"var(--jp-mirror-editor-operator-color)",fontWeight:"bold"},{tag:De._A.comment,color:"var(--jp-mirror-editor-comment-color)",fontStyle:"italic"},{tag:De._A.string,color:"var(--jp-mirror-editor-string-color)"},{tag:[De._A.labelName,De._A.monospace,De._A.special(De._A.string)],color:"var(--jp-mirror-editor-string-2-color)"},{tag:De._A.bracket,color:"var(--jp-mirror-editor-bracket-color)"},{tag:De._A.tagName,color:"var(--jp-mirror-editor-tag-color)"},{tag:De._A.attributeName,color:"var(--jp-mirror-editor-attribute-color)"},{tag:De._A.quote,color:"var(--jp-mirror-editor-quote-color)"},{tag:De._A.link,color:"var(--jp-mirror-editor-link-color)",textDecoration:"underline"},{tag:[De._A.separator,De._A.derefOperator,De._A.paren],color:""},{tag:De._A.strong,fontWeight:"bold"},{tag:De._A.emphasis,fontStyle:"italic"},{tag:De._A.strikethrough,textDecoration:"line-through"},{tag:De._A.bool,color:"var(--jp-mirror-editor-keyword-color)",fontWeight:"bold"}]),_s=[Os,(0,r.y9)(Ms)];class Ts{constructor(){this._themeMap=new Map([["jupyter",Object.freeze({name:"jupyter",theme:_s})]])}get themes(){return Array.from(this._themeMap.values())}defaultTheme(){return this._themeMap.get("jupyter").theme}addTheme(e){if(this._themeMap.has(e.name))throw new Error(`A theme named '${e.name}' is already registered.`);this._themeMap.set(e.name,{displayName:e.name,...e})}getTheme(e){var t;const n=null===(t=this._themeMap.get(e))||void 0===t?void 0:t.theme;return null!=n?n:this.defaultTheme()}}!function(e){e.getDefaultThemes=function(e){const t=(null!=e?e:Te.wK).load("jupyterlab");return[Object.freeze({name:"codemirror",displayName:t.__("codemirror"),theme:[s.Lz.baseTheme({}),(0,r.y9)(r.Zt)]})]}}(Ts||(Ts={}));class Ns{constructor(e,t){this.langPython=t,this.tree=(0,r.mv)(e.state),this.mark=s.NZ.mark({class:"cm-builtin"}),this.decorations=this.buildDeco(e),this.decoratedTo=e.viewport.to}update(e){let t=(0,r.mv)(e.state),{viewport:n}=e.view,i=e.changes.mapPos(this.decoratedTo,1);t.length=n.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=i):(t!=this.tree||e.viewportChanged)&&(this.tree=t,this.decorations=this.buildDeco(e.view),this.decoratedTo=n.to)}buildDeco(e){if(!this.tree.length)return s.NZ.none;let t=new i.vB;const n=i=>{var s;const r=i.node.cursor(),a=r.tree&&r.tree.prop(o.uY.mounted);if(a&&a.overlay&&(null===(s=i.node.enter(a.overlay[0].from+i.from,1))||void 0===s||s.cursor().iterate(n)),this.langPython.isActiveAt(e.state,i.from+1)&&"VariableName"===i.name){const n=e.state.sliceDoc(i.from,i.to);Ds.includes(n)&&t.add(i.from,i.to,this.mark)}};for(let{from:t,to:i}of e.visibleRanges)this.tree.iterate({enter:n,from:t,to:i});return t.finish()}}function Es(e){return s.Z9.define((t=>new Ns(t,e)),{decorations:e=>e.decorations})}const Ds=["abs","aiter","all","any","anext","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip","__import__"];class Ps{constructor(){this._modeList=[],this.addLanguage({name:"none",mime:"text/plain",support:new r.Yy(r.bj.define({parser:Ss("@top Program { }")}))})}addLanguage(e){var t;if(null!==(t=this.findByName(e.name))&&void 0!==t?t:this.findByMIME(e.mime,!0))throw new Error(`${e.mime} already registered`);this._modeList.push(this.makeSpec(e))}async getLanguage(e){const t=this.findBest(e);return t&&!t.support&&(t.support=await t.load()),t}getLanguages(){return[...this._modeList]}findByMIME(e,t=!1){if(Array.isArray(e)){for(let t=0;t-1&&t.substring(n+1,t.length);return i?this.findByExtension(i):null}findBest(e,t=!0){var n,i,s,r;const o="string"==typeof e?e:e.name,a="string"!=typeof e?e.mime:o,l="string"!=typeof e&&null!==(n=e.extensions)&&void 0!==n?n:[];return null!==(r=null!==(s=null!==(i=o?this.findByName(o):null)&&void 0!==i?i:a?this.findByMIME(a):null)&&void 0!==s?s:this.findByExtension(l))&&void 0!==r?r:t?this.findByMIME(Ft.defaultMimeType):null}async highlight(e,t,n){var i;t&&await this.getLanguage(t);const s=null===(i=null==t?void 0:t.support)||void 0===i?void 0:i.language;if(!s)return void n.appendChild(document.createTextNode(e));const r=s.parser.parse(e);let o=0;(0,De.DM)(r,Ms,((t,i,s)=>{t>o&&n.appendChild(document.createTextNode(e.slice(o,t)));const r=n.appendChild(document.createElement("span"));r.className=s,r.appendChild(document.createTextNode(e.slice(t,i))),o=i})),o(await n.e(6446).then(n.bind(n,6446))).cpp()},{name:"C++",displayName:s.__("C++"),mime:"text/x-c++src",extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load:async()=>(await n.e(6446).then(n.bind(n,6446))).cpp()},{name:"CQL",displayName:s.__("CQL"),mime:"text/x-cassandra",extensions:["cql"],load:()=>i("Cassandra")},{name:"CSS",displayName:s.__("CSS"),mime:"text/css",extensions:["css"],load:async()=>(await n.e(4448).then(n.bind(n,4448))).css()},{name:"HTML",displayName:s.__("HTML"),alias:["xhtml"],mime:"text/html",extensions:["html","htm","handlebars","hbs"],load:async()=>(await Promise.all([n.e(2e3),n.e(4448),n.e(3242)]).then(n.bind(n,3242))).html()},{name:"Java",displayName:s.__("Java"),mime:"text/x-java",extensions:["java"],load:async()=>(await n.e(1302).then(n.bind(n,1302))).java()},{name:"Javascript",displayName:s.__("Javascript"),alias:["ecmascript","js","node"],mime:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],extensions:["js","mjs","cjs"],load:async()=>(await n.e(2e3).then(n.bind(n,2e3))).javascript()},{name:"JSON",displayName:s.__("JSON"),alias:["json5"],mime:["application/json","application/x-json"],extensions:["json","map"],load:async()=>(await n.e(6367).then(n.bind(n,6367))).json()},{name:"JSX",displayName:s.__("JSX"),mime:"text/jsx",extensions:["jsx"],load:async()=>(await n.e(2e3).then(n.bind(n,2e3))).javascript({jsx:!0})},{name:"MariaDB SQL",displayName:s.__("MariaDB SQL"),mime:"text/x-mariadb",load:()=>i("MariaSQL")},{name:"Markdown",displayName:s.__("Markdown"),mime:"text/x-markdown",extensions:["md","markdown","mkd"],async load(){return(await Promise.all([n.e(2e3),n.e(4448),n.e(3242),n.e(1081)]).then(n.bind(n,1081))).markdown({codeLanguages:this._modeList})}},{name:"MS SQL",displayName:s.__("MS SQL"),mime:"text/x-mssql",load:()=>i("MSSQL")},{name:"MySQL",displayName:s.__("MySQL"),mime:"text/x-mysql",load:()=>i("MySQL")},{name:"PHP",displayName:s.__("PHP"),mime:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],extensions:["php","php3","php4","php5","php7","phtml"],load:async()=>(await Promise.all([n.e(2e3),n.e(4448),n.e(3242),n.e(3543)]).then(n.bind(n,3543))).php()},{name:"PLSQL",displayName:s.__("PLSQL"),mime:"text/x-plsql",extensions:["pls"],load:()=>i("PLSQL")},{name:"PostgreSQL",displayName:s.__("PostgreSQL"),mime:"text/x-pgsql",load:()=>i("PostgreSQL")},{name:"Python",displayName:s.__("Python"),mime:"text/x-python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,async load(){const e=await n.e(2376).then(n.bind(n,2376));return new r.Yy(e.pythonLanguage,Es(e.pythonLanguage))}},{name:"ipython",displayName:s.__("ipython"),mime:"text/x-ipython",async load(){const e=await n.e(2376).then(n.bind(n,2376));return new r.Yy(e.pythonLanguage,Es(e.pythonLanguage))}},{name:"Rust",displayName:s.__("Rust"),mime:"text/x-rustsrc",extensions:["rs"],load:async()=>(await n.e(142).then(n.bind(n,142))).rust()},{name:"SQL",displayName:s.__("SQL"),mime:["application/sql","text/x-sql"],extensions:["sql"],load:()=>i("StandardSQL")},{name:"SQLite",displayName:s.__("SQLite"),mime:"text/x-sqlite",load:()=>i("SQLite")},{name:"TSX",displayName:s.__("TSX"),alias:["TypeScript-JSX"],mime:"text/typescript-jsx",extensions:["tsx"],load:async()=>(await n.e(2e3).then(n.bind(n,2e3))).javascript({jsx:!0,typescript:!0})},{name:"TypeScript",displayName:s.__("TypeScript"),alias:["ts"],mime:"application/typescript",extensions:["ts"],load:async()=>(await n.e(2e3).then(n.bind(n,2e3))).javascript({typescript:!0})},{name:"WebAssembly",displayName:s.__("WebAssembly"),mime:"text/webassembly",extensions:["wat","wast"],load:async()=>(await n.e(8665).then(n.bind(n,8665))).wast()},{name:"XML",displayName:s.__("XML"),alias:["rss","wsdl","xsd"],mime:["application/xml","text/xml"],extensions:["xml","xsl","xsd","svg"],load:async()=>(await n.e(3426).then(n.bind(n,3426))).xml()},{name:"APL",displayName:s.__("APL"),mime:"text/apl",extensions:["dyalog","apl"],load:async()=>t((await n.e(5351).then(n.bind(n,5351))).apl)},{name:"PGP",displayName:s.__("PGP"),alias:["asciiarmor"],mime:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],extensions:["asc","pgp","sig"],load:async()=>t((await n.e(6292).then(n.bind(n,6292))).asciiArmor)},{name:"ASN.1",displayName:s.__("ASN.1"),mime:"text/x-ttcn-asn",extensions:["asn","asn1"],load:async()=>t((await n.e(7727).then(n.bind(n,7727))).asn1({}))},{name:"Asterisk",displayName:s.__("Asterisk"),mime:"text/x-asterisk",filename:/^extensions\.conf$/i,load:async()=>t((await n.e(2682).then(n.bind(n,2682))).asterisk)},{name:"Brainfuck",displayName:s.__("Brainfuck"),mime:"text/x-brainfuck",extensions:["b","bf"],load:async()=>t((await n.e(8955).then(n.bind(n,8955))).brainfuck)},{name:"Cobol",displayName:s.__("Cobol"),mime:"text/x-cobol",extensions:["cob","cpy"],load:async()=>t((await n.e(5595).then(n.bind(n,5595))).cobol)},{name:"C#",displayName:s.__("C#"),alias:["csharp","cs"],mime:"text/x-csharp",extensions:["cs"],load:async()=>t((await n.e(3722).then(n.bind(n,3722))).csharp)},{name:"Clojure",displayName:s.__("Clojure"),mime:"text/x-clojure",extensions:["clj","cljc","cljx"],load:async()=>t((await n.e(3024).then(n.bind(n,3024))).clojure)},{name:"ClojureScript",displayName:s.__("ClojureScript"),mime:"text/x-clojurescript",extensions:["cljs"],load:async()=>t((await n.e(3024).then(n.bind(n,3024))).clojure)},{name:"Closure Stylesheets (GSS)",displayName:s.__("Closure Stylesheets (GSS)"),mime:"text/x-gss",extensions:["gss"],load:async()=>t((await n.e(5687).then(n.bind(n,5687))).gss)},{name:"CMake",displayName:s.__("CMake"),mime:"text/x-cmake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load:async()=>t((await n.e(7951).then(n.bind(n,7951))).cmake)},{name:"CoffeeScript",displayName:s.__("CoffeeScript"),alias:["coffee","coffee-script"],mime:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],extensions:["coffee"],load:async()=>t((await n.e(8137).then(n.bind(n,8137))).coffeeScript)},{name:"Common Lisp",displayName:s.__("Common Lisp"),alias:["lisp"],mime:"text/x-common-lisp",extensions:["cl","lisp","el"],load:async()=>t((await n.e(5455).then(n.bind(n,5455))).commonLisp)},{name:"Cypher",displayName:s.__("Cypher"),mime:"application/x-cypher-query",extensions:["cyp","cypher"],load:async()=>t((await n.e(4501).then(n.bind(n,4501))).cypher)},{name:"Cython",displayName:s.__("Cython"),mime:"text/x-cython",extensions:["pyx","pxd","pxi"],load:async()=>t((await n.e(5260).then(n.bind(n,5260))).cython)},{name:"Crystal",displayName:s.__("Crystal"),mime:"text/x-crystal",extensions:["cr"],load:async()=>t((await n.e(5258).then(n.bind(n,5258))).crystal)},{name:"D",displayName:s.__("D"),mime:"text/x-d",extensions:["d"],load:async()=>t((await n.e(4424).then(n.bind(n,4424))).d)},{name:"Dart",displayName:s.__("Dart"),mime:["application/dart","text/x-dart"],extensions:["dart"],load:async()=>t((await n.e(3722).then(n.bind(n,3722))).dart)},{name:"diff",displayName:s.__("diff"),mime:"text/x-diff",extensions:["diff","patch"],load:async()=>t((await n.e(8421).then(n.bind(n,8421))).diff)},{name:"Dockerfile",displayName:s.__("Dockerfile"),mime:"text/x-dockerfile",filename:/^Dockerfile$/,load:async()=>t((await n.e(6240).then(n.bind(n,6240))).dockerFile)},{name:"DTD",displayName:s.__("DTD"),mime:"application/xml-dtd",extensions:["dtd"],load:async()=>t((await n.e(4872).then(n.bind(n,4872))).dtd)},{name:"Dylan",displayName:s.__("Dylan"),mime:"text/x-dylan",extensions:["dylan","dyl","intr"],load:async()=>t((await n.e(8586).then(n.bind(n,8586))).dylan)},{name:"EBNF",displayName:s.__("EBNF"),mime:"text/x-ebnf",load:async()=>t((await n.e(1653).then(n.bind(n,1653))).ebnf)},{name:"ECL",displayName:s.__("ECL"),mime:"text/x-ecl",extensions:["ecl"],load:async()=>t((await n.e(8820).then(n.bind(n,8820))).ecl)},{name:"edn",displayName:s.__("edn"),mime:"application/edn",extensions:["edn"],load:async()=>t((await n.e(3024).then(n.bind(n,3024))).clojure)},{name:"Eiffel",displayName:s.__("Eiffel"),mime:"text/x-eiffel",extensions:["e"],load:async()=>t((await n.e(7077).then(n.bind(n,7077))).eiffel)},{name:"Elm",displayName:s.__("Elm"),mime:"text/x-elm",extensions:["elm"],load:async()=>t((await n.e(4704).then(n.bind(n,4704))).elm)},{name:"Erlang",displayName:s.__("Erlang"),mime:"text/x-erlang",extensions:["erl"],load:async()=>t((await n.e(29).then(n.bind(n,29))).erlang)},{name:"Esper",displayName:s.__("Esper"),mime:"text/x-esper",load:async()=>t((await n.e(6828).then(n.bind(n,6828))).esper)},{name:"Factor",displayName:s.__("Factor"),mime:"text/x-factor",extensions:["factor"],load:async()=>t((await n.e(5945).then(n.bind(n,5945))).factor)},{name:"FCL",displayName:s.__("FCL"),mime:"text/x-fcl",load:async()=>t((await n.e(2681).then(n.bind(n,2681))).fcl)},{name:"Forth",displayName:s.__("Forth"),mime:"text/x-forth",extensions:["forth","fth","4th"],load:async()=>t((await n.e(899).then(n.bind(n,899))).forth)},{name:"Fortran",displayName:s.__("Fortran"),mime:"text/x-fortran",extensions:["f","for","f77","f90","f95"],load:async()=>t((await n.e(6742).then(n.bind(n,6742))).fortran)},{name:"F#",displayName:s.__("F#"),alias:["fsharp"],mime:"text/x-fsharp",extensions:["fs"],load:async()=>t((await n.e(252).then(n.bind(n,252))).fSharp)},{name:"Gas",displayName:s.__("Gas"),mime:"text/x-gas",extensions:["s"],load:async()=>t((await n.e(2293).then(n.bind(n,2293))).gas)},{name:"Gherkin",displayName:s.__("Gherkin"),mime:"text/x-feature",extensions:["feature"],load:async()=>t((await n.e(8334).then(n.bind(n,8334))).gherkin)},{name:"Go",displayName:s.__("Go"),mime:"text/x-go",extensions:["go"],load:async()=>t((await n.e(1408).then(n.bind(n,1408))).go)},{name:"Groovy",displayName:s.__("Groovy"),mime:"text/x-groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load:async()=>t((await n.e(5292).then(n.bind(n,5292))).groovy)},{name:"Haskell",displayName:s.__("Haskell"),mime:"text/x-haskell",extensions:["hs"],load:async()=>t((await n.e(7220).then(n.bind(n,7220))).haskell)},{name:"Haxe",displayName:s.__("Haxe"),mime:"text/x-haxe",extensions:["hx"],load:async()=>t((await n.e(9602).then(n.bind(n,9602))).haxe)},{name:"HXML",displayName:s.__("HXML"),mime:"text/x-hxml",extensions:["hxml"],load:async()=>t((await n.e(9602).then(n.bind(n,9602))).hxml)},{name:"HTTP",displayName:s.__("HTTP"),mime:"message/http",load:async()=>t((await n.e(9638).then(n.bind(n,9638))).http)},{name:"IDL",displayName:s.__("IDL"),mime:"text/x-idl",extensions:["pro"],load:async()=>t((await n.e(4451).then(n.bind(n,4451))).idl)},{name:"JSON-LD",displayName:s.__("JSON-LD"),alias:["jsonld"],mime:"application/ld+json",extensions:["jsonld"],load:async()=>t((await n.e(7197).then(n.bind(n,7197))).jsonld)},{name:"Jinja2",displayName:s.__("Jinja2"),mime:"text/jinja2",extensions:["j2","jinja","jinja2"],load:async()=>t((await n.e(636).then(n.bind(n,636))).jinja2)},{name:"Julia",displayName:s.__("Julia"),mime:"text/x-julia",extensions:["jl"],load:async()=>t((await n.e(5525).then(n.bind(n,5525))).julia)},{name:"Kotlin",displayName:s.__("Kotlin"),mime:"text/x-kotlin",extensions:["kt"],load:async()=>t((await n.e(3722).then(n.bind(n,3722))).kotlin)},{name:"LESS",displayName:s.__("LESS"),mime:"text/x-less",extensions:["less"],load:async()=>t((await n.e(5687).then(n.bind(n,5687))).less)},{name:"LiveScript",displayName:s.__("LiveScript"),alias:["ls"],mime:"text/x-livescript",extensions:["ls"],load:async()=>t((await n.e(7911).then(n.bind(n,7911))).liveScript)},{name:"Lua",displayName:s.__("Lua"),mime:"text/x-lua",extensions:["lua"],load:async()=>t((await n.e(6162).then(n.bind(n,6162))).lua)},{name:"mIRC",displayName:s.__("mIRC"),mime:"text/mirc",load:async()=>t((await n.e(567).then(n.bind(n,567))).mirc)},{name:"Mathematica",displayName:s.__("Mathematica"),mime:"text/x-mathematica",extensions:["m","nb","wl","wls"],load:async()=>t((await n.e(1524).then(n.bind(n,1524))).mathematica)},{name:"Modelica",displayName:s.__("Modelica"),mime:"text/x-modelica",extensions:["mo"],load:async()=>t((await n.e(8678).then(n.bind(n,8678))).modelica)},{name:"MUMPS",displayName:s.__("MUMPS"),mime:"text/x-mumps",extensions:["mps"],load:async()=>t((await n.e(560).then(n.bind(n,560))).mumps)},{name:"mbox",displayName:s.__("mbox"),mime:"application/mbox",extensions:["mbox"],load:async()=>t((await n.e(9114).then(n.bind(n,9114))).mbox)},{name:"Nginx",displayName:s.__("Nginx"),mime:"text/x-nginx-conf",filename:/nginx.*\.conf$/i,load:async()=>t((await n.e(3180).then(n.bind(n,3180))).nginx)},{name:"NSIS",displayName:s.__("NSIS"),mime:"text/x-nsis",extensions:["nsh","nsi"],load:async()=>t((await n.e(357).then(n.bind(n,357))).nsis)},{name:"NTriples",displayName:s.__("NTriples"),mime:["application/n-triples","application/n-quads","text/n-triples"],extensions:["nt","nq"],load:async()=>t((await n.e(1001).then(n.bind(n,1001))).ntriples)},{name:"Objective-C",displayName:s.__("Objective-C"),alias:["objective-c","objc"],mime:"text/x-objectivec",extensions:["m"],load:async()=>t((await n.e(3722).then(n.bind(n,3722))).objectiveC)},{name:"Objective-C++",displayName:s.__("Objective-C++"),alias:["objective-c++","objc++"],mime:"text/x-objectivec++",extensions:["mm"],load:async()=>t((await n.e(3722).then(n.bind(n,3722))).objectiveCpp)},{name:"OCaml",displayName:s.__("OCaml"),mime:"text/x-ocaml",extensions:["ml","mli","mll","mly"],load:async()=>t((await n.e(252).then(n.bind(n,252))).oCaml)},{name:"Octave",displayName:s.__("Octave"),mime:"text/x-octave",extensions:["m"],load:async()=>t((await n.e(7486).then(n.bind(n,7486))).octave)},{name:"Oz",displayName:s.__("Oz"),mime:"text/x-oz",extensions:["oz"],load:async()=>t((await n.e(8539).then(n.bind(n,8539))).oz)},{name:"Pascal",displayName:s.__("Pascal"),mime:"text/x-pascal",extensions:["p","pas"],load:async()=>t((await n.e(1374).then(n.bind(n,1374))).pascal)},{name:"Perl",displayName:s.__("Perl"),mime:"text/x-perl",extensions:["pl","pm"],load:async()=>t((await n.e(3191).then(n.bind(n,3191))).perl)},{name:"Pig",displayName:s.__("Pig"),mime:"text/x-pig",extensions:["pig"],load:async()=>t((await n.e(8188).then(n.bind(n,8188))).pig)},{name:"PowerShell",displayName:s.__("PowerShell"),mime:"application/x-powershell",extensions:["ps1","psd1","psm1"],load:async()=>t((await n.e(8727).then(n.bind(n,8727))).powerShell)},{name:"Properties files",displayName:s.__("Properties files"),alias:["ini","properties"],mime:"text/x-properties",extensions:["properties","ini","in"],load:async()=>t((await n.e(6099).then(n.bind(n,6099))).properties)},{name:"ProtoBuf",displayName:s.__("ProtoBuf"),mime:"text/x-protobuf",extensions:["proto"],load:async()=>t((await n.e(6473).then(n.bind(n,6473))).protobuf)},{name:"Puppet",displayName:s.__("Puppet"),mime:"text/x-puppet",extensions:["pp"],load:async()=>t((await n.e(7364).then(n.bind(n,7364))).puppet)},{name:"Q",displayName:s.__("Q"),mime:"text/x-q",extensions:["q"],load:async()=>t((await n.e(5515).then(n.bind(n,5515))).q)},{name:"R",displayName:s.__("R"),alias:["rscript"],mime:"text/x-rsrc",extensions:["r","R"],load:async()=>t((await n.e(7838).then(n.bind(n,7838))).r)},{name:"RPM Changes",displayName:s.__("RPM Changes"),mime:"text/x-rpm-changes",load:async()=>t((await n.e(4401).then(n.bind(n,4401))).rpmChanges)},{name:"RPM Spec",displayName:s.__("RPM Spec"),mime:"text/x-rpm-spec",extensions:["spec"],load:async()=>t((await n.e(4401).then(n.bind(n,4401))).rpmSpec)},{name:"Ruby",displayName:s.__("Ruby"),alias:["jruby","macruby","rake","rb","rbx"],mime:"text/x-ruby",extensions:["rb"],load:async()=>t((await n.e(5350).then(n.bind(n,5350))).ruby)},{name:"SAS",displayName:s.__("SAS"),mime:"text/x-sas",extensions:["sas"],load:async()=>t((await n.e(1553).then(n.bind(n,1553))).sas)},{name:"Scala",displayName:s.__("Scala"),mime:"text/x-scala",extensions:["scala"],load:async()=>t((await n.e(3722).then(n.bind(n,3722))).scala)},{name:"Scheme",displayName:s.__("Scheme"),mime:"text/x-scheme",extensions:["scm","ss"],load:async()=>t((await n.e(1405).then(n.bind(n,1405))).scheme)},{name:"SCSS",displayName:s.__("SCSS"),mime:"text/x-scss",extensions:["scss"],load:async()=>t((await n.e(5687).then(n.bind(n,5687))).sCSS)},{name:"Shell",displayName:s.__("Shell"),alias:["bash","sh","zsh"],mime:["text/x-sh","application/x-sh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load:async()=>t((await n.e(4922).then(n.bind(n,4922))).shell)},{name:"Sieve",displayName:s.__("Sieve"),mime:"application/sieve",extensions:["siv","sieve"],load:async()=>t((await n.e(1066).then(n.bind(n,1066))).sieve)},{name:"Smalltalk",displayName:s.__("Smalltalk"),mime:"text/x-stsrc",extensions:["st"],load:async()=>t((await n.e(9981).then(n.bind(n,9981))).smalltalk)},{name:"Solr",displayName:s.__("Solr"),mime:"text/x-solr",load:async()=>t((await n.e(5106).then(n.bind(n,5106))).solr)},{name:"SML",displayName:s.__("SML"),mime:"text/x-sml",extensions:["sml","sig","fun","smackspec"],load:async()=>t((await n.e(252).then(n.bind(n,252))).sml)},{name:"SPARQL",displayName:s.__("SPARQL"),alias:["sparul"],mime:"application/sparql-query",extensions:["rq","sparql"],load:async()=>t((await n.e(8391).then(n.bind(n,8391))).sparql)},{name:"Spreadsheet",displayName:s.__("Spreadsheet"),alias:["excel","formula"],mime:"text/x-spreadsheet",load:async()=>t((await n.e(786).then(n.bind(n,786))).spreadsheet)},{name:"Squirrel",displayName:s.__("Squirrel"),mime:"text/x-squirrel",extensions:["nut"],load:async()=>t((await n.e(3722).then(n.bind(n,3722))).squirrel)},{name:"Stylus",displayName:s.__("Stylus"),mime:"text/x-styl",extensions:["styl"],load:async()=>t((await n.e(4756).then(n.bind(n,4756))).stylus)},{name:"Swift",displayName:s.__("Swift"),mime:"text/x-swift",extensions:["swift"],load:async()=>t((await n.e(647).then(n.bind(n,647))).swift)},{name:"sTeX",displayName:s.__("sTeX"),mime:"text/x-stex",load:async()=>t((await n.e(3220).then(n.bind(n,3220))).stex)},{name:"LaTeX",displayName:s.__("LaTeX"),alias:["tex"],mime:"text/x-latex",extensions:["text","ltx","tex"],load:async()=>t((await n.e(3220).then(n.bind(n,3220))).stex)},{name:"SystemVerilog",displayName:s.__("SystemVerilog"),mime:"text/x-systemverilog",extensions:["v","sv","svh"],load:async()=>t((await n.e(7230).then(n.bind(n,7230))).verilog)},{name:"Tcl",displayName:s.__("Tcl"),mime:"text/x-tcl",extensions:["tcl"],load:async()=>t((await n.e(6643).then(n.bind(n,6643))).tcl)},{name:"Textile",displayName:s.__("Textile"),mime:"text/x-textile",extensions:["textile"],load:async()=>t((await n.e(6205).then(n.bind(n,6205))).textile)},{name:"TiddlyWiki",displayName:s.__("TiddlyWiki"),mime:"text/x-tiddlywiki",load:async()=>t((await n.e(8122).then(n.bind(n,8122))).tiddlyWiki)},{name:"Tiki wiki",displayName:s.__("Tiki wiki"),mime:"text/tiki",load:async()=>t((await n.e(3805).then(n.bind(n,3805))).tiki)},{name:"TOML",displayName:s.__("TOML"),mime:"text/x-toml",extensions:["toml"],load:async()=>t((await n.e(950).then(n.bind(n,950))).toml)},{name:"troff",displayName:s.__("troff"),mime:"text/troff",extensions:["1","2","3","4","5","6","7","8","9"],load:async()=>t((await n.e(615).then(n.bind(n,615))).troff)},{name:"TTCN",displayName:s.__("TTCN"),mime:"text/x-ttcn",extensions:["ttcn","ttcn3","ttcnpp"],load:async()=>t((await n.e(9779).then(n.bind(n,9779))).ttcn)},{name:"TTCN_CFG",displayName:s.__("TTCN_CFG"),mime:"text/x-ttcn-cfg",extensions:["cfg"],load:async()=>t((await n.e(132).then(n.bind(n,132))).ttcnCfg)},{name:"Turtle",displayName:s.__("Turtle"),mime:"text/turtle",extensions:["ttl"],load:async()=>t((await n.e(9684).then(n.bind(n,9684))).turtle)},{name:"Web IDL",displayName:s.__("Web IDL"),mime:"text/x-webidl",extensions:["webidl"],load:async()=>t((await n.e(1911).then(n.bind(n,1911))).webIDL)},{name:"VB.NET",displayName:s.__("VB.NET"),mime:"text/x-vb",extensions:["vb"],load:async()=>t((await n.e(5298).then(n.bind(n,5298))).vb)},{name:"VBScript",displayName:s.__("VBScript"),mime:"text/vbscript",extensions:["vbs"],load:async()=>t((await n.e(9865).then(n.bind(n,9865))).vbScript)},{name:"Velocity",displayName:s.__("Velocity"),mime:"text/velocity",extensions:["vtl"],load:async()=>t((await n.e(4957).then(n.bind(n,4957))).velocity)},{name:"Verilog",displayName:s.__("Verilog"),mime:"text/x-verilog",extensions:["v"],load:async()=>t((await n.e(7230).then(n.bind(n,7230))).verilog)},{name:"VHDL",displayName:s.__("VHDL"),mime:"text/x-vhdl",extensions:["vhd","vhdl"],load:async()=>t((await n.e(1560).then(n.bind(n,1560))).vhdl)},{name:"XQuery",displayName:s.__("XQuery"),mime:"application/xquery",extensions:["xy","xquery"],load:async()=>t((await n.e(6590).then(n.bind(n,6590))).xQuery)},{name:"Yacas",displayName:s.__("Yacas"),mime:"text/x-yacas",extensions:["ys"],load:async()=>t((await n.e(6211).then(n.bind(n,6211))).yacas)},{name:"YAML",displayName:s.__("YAML"),alias:["yml"],mime:["text/x-yaml","text/yaml"],extensions:["yaml","yml"],load:async()=>t((await n.e(9561).then(n.bind(n,9561))).yaml)},{name:"Z80",displayName:s.__("Z80"),mime:"text/x-z80",extensions:["z80"],load:async()=>t((await n.e(822).then(n.bind(n,822))).z80)},{name:"mscgen",displayName:s.__("mscgen"),mime:"text/x-mscgen",extensions:["mscgen","mscin","msc"],load:async()=>t((await n.e(9371).then(n.bind(n,9371))).mscgen)},{name:"xu",displayName:s.__("xu"),mime:"text/x-xu",extensions:["xu"],load:async()=>t((await n.e(9371).then(n.bind(n,9371))).xu)},{name:"msgenny",displayName:s.__("msgenny"),mime:"text/x-msgenny",extensions:["msgenny"],load:async()=>t((await n.e(9371).then(n.bind(n,9371))).msgenny)}]}}(Ps||(Ps={})),function(e){e.createEditor=function(e,t,n,r){const o=t.getInitialExtensions();return o.push(...n),new s.Lz({state:i.$t.create({doc:r,extensions:o}),parent:e})}}(Rs||(Rs={})),function(e){e.findNext=function(e,t,n=0,i=1/0){for(i=Math.min(e.length-1,i);n<=i;){let s=Math.floor(.5*(n+i));const r=e[s].position;if(rt)return n}else{if(!(r>t))return s;if((i=s-1)>0&&e[i].position0?n-1:0;return e[s].position>=t?s:null}}(js||(js={})),new Ce.Token("@jupyterlab/codemirror:IEditorExtensionRegistry","A registry for CodeMirror extension factories."),new Ce.Token("@jupyterlab/codemirror:IEditorLanguageRegistry","A registry for CodeMirror languages."),new Ce.Token("@jupyterlab/codemirror:IEditorThemeRegistry","A registry for CodeMirror theme.");var Is,Ls,Bs=n(4041),Fs=n(1412),zs=n(6823);function $s(...e){return function(e){return e.map((e=>e&&"object"==typeof e?Object.keys(e).map((t=>!!e[t]&&t)):"string"==typeof e?e.split(/\s+/):[])).reduce(((e,t)=>e.concat(t)),[]).filter((e=>!!e))}(e).join(" ")}!function(e){const t={breadCrumb:{container:{$nest:{"&:first-child svg":{bottom:"1px",marginLeft:"0px",position:"relative"},"&:hover":{backgroundColor:"var(--jp-layout-color2)"},".jp-mod-dropTarget&":{backgroundColor:"var(--jp-brand-color2)",opacity:.7}}},element:{borderRadius:"var(--jp-border-radius)",cursor:"pointer",margin:"0px 2px",padding:"0px 2px",height:"16px",width:"16px",verticalAlign:"middle"}},commandPaletteHeader:{container:{height:"14px",margin:"0 14px 0 auto"},element:{height:"14px",width:"14px"},options:{elementPosition:"center"}},commandPaletteItem:{element:{height:"16px",width:"16px"},options:{elementPosition:"center"}},launcherCard:{container:{height:"52px",width:"52px"},element:{height:"52px",width:"52px"},options:{elementPosition:"center"}},launcherSection:{container:{boxSizing:"border-box",marginRight:"12px",height:"32px",width:"32px"},element:{height:"32px",width:"32px"},options:{elementPosition:"center"}},listing:{container:{flex:"0 0 20px",marginRight:"4px",position:"relative"},element:{height:"16px",width:"16px"},options:{elementPosition:"center"}},listingHeaderItem:{container:{display:"inline",height:"16px",width:"16px"},element:{height:"auto",margin:"-2px 0 0 0",width:"20px"},options:{elementPosition:"center"}},mainAreaTab:{container:{$nest:{".lm-DockPanel-tabBar &":{marginRight:"4px"}}},element:{$nest:{".lm-DockPanel-tabBar &":{height:"14px",width:"14px"}}},options:{elementPosition:"center"}},menuItem:{container:{display:"inline-block",verticalAlign:"middle"},element:{height:"16px",width:"16px"},options:{elementPosition:"center"}},runningItem:{container:{margin:"0px 4px 0px 4px"},element:{height:"16px",width:"16px"},options:{elementPosition:"center"}},select:{container:{pointerEvents:"none"},element:{position:"absolute",height:"auto",width:"16px"}},settingsEditor:{container:{display:"flex",flex:"0 0 20px",margin:"0 3px 0 0",position:"relative",height:"20px",width:"20px"},element:{height:"16px",width:"16px"},options:{elementPosition:"center"}},sideBar:{element:{height:"auto",width:"20px"},options:{elementPosition:"center"}},splash:{container:{animation:"0.3s fade-in linear forwards",height:"100%",width:"100%",zIndex:1},element:{width:"100px"},options:{elementPosition:"center"}},statusBar:{element:{left:"0px",top:"0px",height:"18px",width:"20px",position:"relative"}},toolbarButton:{container:{display:"inline-block",verticalAlign:"middle"},element:{height:"16px",width:"16px"},options:{elementPosition:"center"}}};function n(e){return{container:{alignItems:"center",display:"flex"},element:{display:"block",...e}}}const i={center:n({margin:"0 auto",width:"100%"}),top:n({margin:"0 0 auto 0"}),right:n({margin:"0 0 0 auto"}),bottom:n({margin:"auto 0 0 0"}),left:n({margin:"0 auto 0 0"}),"top right":n({margin:"0 0 auto auto"}),"bottom right":n({margin:"auto 0 0 auto"}),"bottom left":n({margin:"auto auto 0 0"}),"top left":n({margin:"0 auto 0 auto"})};function s(e){return{element:{height:e,width:e}}}const r={small:s("14px"),normal:s("16px"),large:s("20px"),xlarge:s("24px")};const o=new Map;e.styleClass=function(e){if(!e||0===Object.keys(e).length)return"";let{elementPosition:n,elementSize:s,stylesheet:a,...l}=e;const h={...n&&{elementPosition:n},...s&&{elementSize:s}},c="string"==typeof a&&0===Object.keys(l).length,u=c?[a,n,s].join(","):"";if(c&&o.has(u))return o.get(u);const f=function(e){return e?(Array.isArray(e)||(e=[e]),e.map((e=>"string"==typeof e?t[e]:e))):[]}(a);f.push({element:l,options:h});const d=function(e){var t;return(0,zs.iF)({...e.container,$nest:{...null===(t=e.container)||void 0===t?void 0:t.$nest,svg:e.element}})}(function(e){const t=Object.assign({},...e.map((e=>e.options)));return t.elementPosition&&e.unshift(i[t.elementPosition]),t.elementSize&&e.unshift(r[t.elementSize]),function(e){return{container:Object.assign({},...e.map((e=>e.container))),element:Object.assign({},...e.map((e=>e.element)))}}(e)}(f));return c&&o.set(u,d),d}}(Is||(Is={}));class Hs{static remove(e){for(;e.firstChild;)e.firstChild.remove();return e.className="",e}static resolve({icon:e}){if(e instanceof Hs)return e;if("string"==typeof e){return Hs._instances.get(e)||(Hs._debug&&console.warn(`Lookup failed for icon, creating loading icon. icon: ${e}`),new Hs({name:e,svgstr:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDE4IDE4Ij4KICAgIDxnIGNsYXNzPSJqcC1pY29uMyIgZmlsbD0iIzYxNjE2MSI+CiAgICAgICAgPHBhdGggZD0iTTkgMTMuNWMtMi40OSAwLTQuNS0yLjAxLTQuNS00LjVTNi41MSA0LjUgOSA0LjVjMS4yNCAwIDIuMzYuNTIgMy4xNyAxLjMzTDEwIDhoNVYzbC0xLjc2IDEuNzZDMTIuMTUgMy42OCAxMC42NiAzIDkgMyA1LjY5IDMgMy4wMSA1LjY5IDMuMDEgOVM1LjY5IDE1IDkgMTVjMi45NyAwIDUuNDMtMi4xNiA1LjktNWgtMS41MmMtLjQ2IDItMi4yNCAzLjUtNC4zOCAzLjV6Ii8+CiAgICA8L2c+Cjwvc3ZnPgo=",_loading:!0}))}return new Hs(e)}static resolveElement({icon:e,iconClass:t,fallback:n,...i}){return Ls.isResolvable(e)?Hs.resolve({icon:e}).element(i):!t&&n?n.element(i):(i.className=$s(t,i.className),Ls.blankElement(i))}static resolveReact({icon:e,iconClass:t,fallback:n,...i}){if(!Ls.isResolvable(e))return!t&&n?Bs.createElement(n.react,{...i}):(i.className=$s(t,i.className),Bs.createElement(Ls.blankReact,{...i}));const s=Hs.resolve({icon:e});return Bs.createElement(s.react,{...i})}static resolveSvg({name:e,svgstr:t}){const n=(new DOMParser).parseFromString(Ls.svgstrShim(t),"image/svg+xml"),i=n.querySelector("parsererror");if(i){const n=`SVG HTML was malformed for LabIcon instance.\nname: ${e}, svgstr: ${t}`;return Hs._debug?(console.error(n),i):(console.warn(n),null)}return n.documentElement}static toggleDebug(e){Hs._debug=null!=e?e:!Hs._debug}constructor({name:e,svgstr:t,render:n,unrender:i,_loading:s=!1}){if(this._props={},this._svgReplaced=new Me.Signal(this),this._svgElement=void 0,this._svgInnerHTML=void 0,this._svgReactAttrs=void 0,!e||!t)return console.error(`When defining a new LabIcon, name and svgstr must both be non-empty strings. name: ${e}, svgstr: ${t}`),qs;if(this._loading=s,Hs._instances.has(e)){const n=Hs._instances.get(e);return this._loading?(n.svgstr=t,this._loading=!1,n):(Hs._debug&&console.warn(`Redefining previously loaded icon svgstr. name: ${e}, svgstrOld: ${n.svgstr}, svgstr: ${t}`),n.svgstr=t,n)}this.name=e,this.react=this._initReact(e),this.svgstr=t,this._initRender({render:n,unrender:i}),Hs._instances.set(this.name,this)}bindprops(e){const t=Object.create(this);return t._props=e,t.react=t._initReact(t.name+"_bind"),t}element(e={}){var t;let{className:n,container:i,label:s,title:r,tag:o="div",...a}={...this._props,...e};const l=null==i?void 0:i.firstChild;if((null===(t=null==l?void 0:l.dataset)||void 0===t?void 0:t.iconId)===this._uuid)return l;if(!this.svgElement)return document.createElement("div");if(i)for(;i.firstChild;)i.firstChild.remove();else o&&(i=document.createElement(o));const h=this.svgElement.cloneNode(!0);return i?(null!=s&&(i.textContent=s),Ls.initContainer({container:i,className:n,styleProps:a,title:r}),i.appendChild(h),i):(s&&console.warn(),h)}render(e,t){var n;let i=null===(n=null==t?void 0:t.children)||void 0===n?void 0:n[0];"string"!=typeof i&&(i=void 0),this.element({container:e,label:i,...null==t?void 0:t.props})}get svgElement(){return void 0===this._svgElement&&(this._svgElement=this._initSvg({uuid:this._uuid})),this._svgElement}get svgInnerHTML(){return void 0===this._svgInnerHTML&&(null===this.svgElement?this._svgInnerHTML=null:this._svgInnerHTML=this.svgElement.innerHTML),this._svgInnerHTML}get svgReactAttrs(){return void 0===this._svgReactAttrs&&(null===this.svgElement?this._svgReactAttrs=null:this._svgReactAttrs=function(e,{ignore:t=[]}={}){return e.getAttributeNames().reduce(((n,i)=>("style"===i||t.includes(i)||(i.startsWith("data")?n[i]=e.getAttribute(i):n[zt.Text.camelCase(i)]=e.getAttribute(i)),n)),{})}(this.svgElement,{ignore:["data-icon-id"]})),this._svgReactAttrs}get svgstr(){return this._svgstr}set svgstr(e){this._svgstr=e;const t=Ce.UUID.uuid4(),n=this._uuid;this._uuid=t,this._svgElement=void 0,this._svgInnerHTML=void 0,this._svgReactAttrs=void 0,document.querySelectorAll(`[data-icon-id="${n}"]`).forEach((e=>{this.svgElement&&e.replaceWith(this.svgElement.cloneNode(!0))})),this._svgReplaced.emit()}_initReact(e){const t=Bs.forwardRef(((e={},t)=>{const{className:n,container:i,label:s,title:r,slot:o,tag:a="div",...l}={...this._props,...e},[,h]=Bs.useState(this._uuid);Bs.useEffect((()=>{const e=()=>{h(this._uuid)};return this._svgReplaced.connect(e),()=>{this._svgReplaced.disconnect(e)}}));const c=null!=a?a:Bs.Fragment;if(!this.svgInnerHTML||!this.svgReactAttrs)return Bs.createElement(Bs.Fragment,null);const u={...this.svgReactAttrs};a||Object.assign(u,{className:n||l?$s(n,Is.styleClass(l)):void 0,title:r,slot:o});const f=Bs.createElement("svg",{...u,...this.svgReactAttrs,dangerouslySetInnerHTML:{__html:this.svgInnerHTML},ref:t});if(i)return Ls.initContainer({container:i,className:n,styleProps:l,title:r}),Bs.createElement(Bs.Fragment,null,f,s);{let e={};return c!==Bs.Fragment&&(e={className:n||l?$s(n,Is.styleClass(l)):void 0,title:r,slot:o}),Bs.createElement(c,{...e},f,s)}}));return t.displayName=`LabIcon_${e}`,t}_initRender({render:e,unrender:t}){e?(this.render=e,t&&(this.unrender=t)):t&&console.warn("In _initRender, ignoring unrender arg since render is undefined")}_initSvg({title:e,uuid:t}={}){const n=Hs.resolveSvg(this);return n?("parsererror"!==n.tagName&&(n.dataset.icon=this.name,t&&(n.dataset.iconId=t),e&&Ls.setTitleSvg(n,e)),n):n}}Hs._debug=!1,Hs._instances=new Map,function(e){function t({container:e,className:t,styleProps:n,title:i}){null!=i&&(e.title=i);const s=Is.styleClass(n);if(null!=t){const n=$s(t,s);return e.className=n,n}return s?(e.classList.add(s),s):""}e.blankElement=function({className:t="",container:n,label:i,title:s,tag:r="div",slot:o,...a}){if((null==n?void 0:n.className)===t)return n;if(n)for(;n.firstChild;)n.firstChild.remove();else n=document.createElement(null!=r?r:"div");return null!=i&&(n.textContent=i),e.initContainer({container:n,className:t,styleProps:a,title:s}),n},e.blankReact=Bs.forwardRef((({className:e="",container:n,label:i,title:s,tag:r="div",...o},a)=>{const l=null!=r?r:"div";return n?(t({container:n,className:e,styleProps:o,title:s}),Bs.createElement(Bs.Fragment,null)):Bs.createElement(l,{className:$s(e,Is.styleClass(o))},a&&Vs.react({ref:a}),i)})),e.blankReact.displayName="BlankReact",e.initContainer=t,e.isResolvable=function(e){return!(!e||!("string"==typeof e||e.name&&e.svgstr))},e.setTitleSvg=function(e,t){const n=e.getElementsByTagName("title");if(n.length)n[0].textContent=t;else{const n=document.createElement("title");n.textContent=t,e.appendChild(n)}},e.svgstrShim=function(e,t=!0){const[,n,i]=decodeURIComponent(e).replace(/>\s*\n\s*<").replace(/\s*\n\s*/g," ").match(t?/^(?:data:.*?(;base64)?,)?(.*)/:/(?:(base64).*)?(3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0;if("Object"===e){let e=Object.getOwnPropertyNames(t);n&&e.sort(!0===n?void 0:n),e=e.slice(s,r+1),i={entries:e.map((e=>({key:e,value:t[e]})))}}else if("Array"===e)i={entries:t.slice(s,r+1).map(((e,t)=>({key:t+s,value:e})))};else{let e=0;const n=[];let o=!0;const a=function(e){return"function"==typeof e.set}(t);for(const i of t){if(e>r){o=!1;break}s<=e&&(a&&Array.isArray(i)?"string"==typeof i[0]||"number"==typeof i[0]?n.push({key:i[0],value:i[1]}):n.push({key:`[entry ${e}]`,value:{"[key]":i[0],"[value]":i[1]}}):n.push({key:e,value:i})),e++}i={hasMore:!o,entries:n}}return i}function Xs(e,t,n){const i=[];for(;t-e>n*n;)n*=n;for(let s=e;s<=t;s+=n)i.push({from:s,to:Math.min(t,s+n-1)});return i}function Zs(e,t,n,i){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1/0;const o=Js.bind(null,e,t,n);if(!i)return o().entries;const a=r<1/0,l=Math.min(r-s,function(e,t){return"Object"===e?Object.keys(t).length:"Array"===e?t.length:1/0}(e,t));if("Iterable"!==e){if(l<=i||i<7)return o(s,r).entries}else if(l<=i&&!a)return o(s,r).entries;let h;if("Iterable"===e){const{hasMore:e,entries:t}=o(s,s+i-1);h=e?[...t,...Xs(s+i,s+2*i-1,i)]:t}else h=a?Xs(s,r,i):[...o(0,i-5).entries,...Xs(i-4,l-5,i),...o(l-4,l-1).entries];return h}function Qs(e){const{styling:t,from:n,to:i,renderChildNodes:s,nodeType:r}=e,[o,a]=(0,Bs.useState)(!1),l=(0,Bs.useCallback)((()=>{a(!o)}),[o]);return o?Bs.createElement("div",t("itemRange",o),s(e,n,i)):Bs.createElement("div",Ks({},t("itemRange",o),{onClick:l}),Bs.createElement(Ys,{nodeType:r,styling:t,expanded:!1,onClick:l,arrowStyle:"double"}),`${n} ... ${i}`)}function er(e,t,n){const{nodeType:i,data:s,collectionLimit:r,circularCache:o,keyPath:a,postprocessValue:l,sortObjectKeys:h}=e,c=[];return Zs(i,s,h,r,t,n).forEach((t=>{if(void 0!==t.to)c.push(Bs.createElement(Qs,Ks({},e,{key:`ItemRange--${t.from}-${t.to}`,from:t.from,to:t.to,renderChildNodes:er})));else{const{key:n,value:i}=t,s=-1!==o.indexOf(i);c.push(Bs.createElement(hr,Ks({},e,{postprocessValue:l,collectionLimit:r,key:`Node--${n}`,keyPath:[n,...a],value:l(i),circularCache:[...o,i],isCircular:s,hideRoot:!1})))}})),c}function tr(e){const{circularCache:t=[],collectionLimit:n,createItemString:i,data:s,expandable:r,getItemString:o,hideRoot:a,isCircular:l,keyPath:h,labelRenderer:c,level:u=0,nodeType:f,nodeTypeIndicator:d,shouldExpandNodeInitially:p,styling:m}=e,[g,b]=(0,Bs.useState)(!l&&p(h,s,u)),y=(0,Bs.useCallback)((()=>{r&&b(!g)}),[r,g]),v=g||a&&0===u?er({...e,circularCache:t,level:u+1}):null,x=o(f,s,Bs.createElement("span",m("nestedNodeItemType",g),d),i(s,n),h),w=[h,f,g,r];return a?Bs.createElement("li",m("rootNode",...w),Bs.createElement("ul",m("rootNodeChildren",...w),v)):Bs.createElement("li",m("nestedNode",...w),r&&Bs.createElement(Ys,{styling:m,nodeType:f,expanded:g,onClick:y}),Bs.createElement("label",Ks({},m(["label","nestedNodeLabel"],...w),{onClick:y}),c(...w)),Bs.createElement("span",Ks({},m("nestedNodeItemString",...w),{onClick:y}),x),Bs.createElement("ul",m("nestedNodeChildren",...w),v))}function nr(e){const t=Object.getOwnPropertyNames(e).length;return`${t} ${1!==t?"keys":"key"}`}function ir(e){let{data:t,...n}=e;return Bs.createElement(tr,Ks({},n,{data:t,nodeType:"Object",nodeTypeIndicator:"Error"===n.nodeType?"Error()":"{}",createItemString:nr,expandable:Object.getOwnPropertyNames(t).length>0}))}function sr(e){return`${e.length} ${1!==e.length?"items":"item"}`}function rr(e){let{data:t,...n}=e;return Bs.createElement(tr,Ks({},n,{data:t,nodeType:"Array",nodeTypeIndicator:"[]",createItemString:sr,expandable:t.length>0}))}function or(e,t){let n=0,i=!1;if(Number.isSafeInteger(e.size))n=e.size;else for(const s of e){if(t&&n+1>t){i=!0;break}n+=1}return`${i?">":""}${n} ${1!==n?"entries":"entry"}`}function ar(e){return Bs.createElement(tr,Ks({},e,{nodeType:"Iterable",nodeTypeIndicator:"()",createItemString:or,expandable:!0}))}function lr(e){let{nodeType:t,styling:n,labelRenderer:i,keyPath:s,valueRenderer:r,value:o,valueGetter:a=e=>e}=e;return Bs.createElement("li",n("value",t,s),Bs.createElement("label",n(["label","valueLabel"],t,s),i(s,t,!1,!1)),Bs.createElement("span",n("valueText",t,s),r(a(o),o,...s)))}function hr(e){let{getItemString:t,keyPath:n,labelRenderer:i,styling:s,value:r,valueRenderer:o,isCustomNode:a,...l}=e;const h=a(r)?"Custom":function(e){const t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&"function"==typeof e[Symbol.iterator]?"Iterable":"Custom"===t&&e.constructor!==Object&&e instanceof Object?"Object":t}(r),c={getItemString:t,key:n[0],keyPath:n,labelRenderer:i,nodeType:h,styling:s,value:r,valueRenderer:o},u={...l,...c,data:r,isCustomNode:a};switch(h){case"Object":case"Error":case"WeakMap":case"WeakSet":return Bs.createElement(ir,u);case"Array":return Bs.createElement(rr,u);case"Iterable":case"Map":case"Set":return Bs.createElement(ar,u);case"String":return Bs.createElement(lr,Ks({},c,{valueGetter:e=>`"${e}"`}));case"Number":case"Custom":return Bs.createElement(lr,c);case"Boolean":return Bs.createElement(lr,Ks({},c,{valueGetter:e=>e?"true":"false"}));case"Date":return Bs.createElement(lr,Ks({},c,{valueGetter:e=>e.toISOString()}));case"Null":return Bs.createElement(lr,Ks({},c,{valueGetter:()=>"null"}));case"Undefined":return Bs.createElement(lr,Ks({},c,{valueGetter:()=>"undefined"}));case"Function":case"Symbol":return Bs.createElement(lr,Ks({},c,{valueGetter:e=>e.toString()}));default:return Bs.createElement(lr,Ks({},c,{valueGetter:()=>`<${h}>`}))}}function cr(e){return cr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cr(e)}function ur(e){var t=function(e){if("object"!=cr(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=cr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==cr(t)?t:t+""}function fr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n2?n-2:0),s=2;s1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=t.defaultBase16,s=void 0===i?wr:i,r=t.base16Themes,o=_r(n,void 0===r?null:r);o&&(n=xr(xr({},o),n));for(var a=kr.reduce((function(e,t){return e[t]=n[t]||s[t],e}),{}),l=function(e,t){var n=Object.keys(t);for(var i in e)-1===n.indexOf(i)&&n.push(i);return n.reduce((function(n,i){return n[i]=function(e,t){if(void 0===e)return t;if(void 0===t)return e;var n=cr(e),i=cr(t);switch(n){case"string":switch(i){case"string":return[t,e].filter(Boolean).join(" ");case"object":return Sr({className:e,style:t});case"function":return function(n){for(var i=arguments.length,s=new Array(i>1?i-1:0),r=1;r1?i-1:0),r=1;r1?i-1:0),r=1;r1?i-1:0),r=1;r1?i-1:0),r=1;r3?h-3:0),u=3;u({String:e.STRING_COLOR,Date:e.DATE_COLOR,Number:e.NUMBER_COLOR,Boolean:e.BOOLEAN_COLOR,Null:e.NULL_COLOR,Undefined:e.UNDEFINED_COLOR,Function:e.FUNCTION_COLOR,Symbol:e.SYMBOL_COLOR}),Nr=Or((e=>{const t=(e=>({BACKGROUND_COLOR:e.base00,TEXT_COLOR:e.base07,STRING_COLOR:e.base0B,DATE_COLOR:e.base0B,NUMBER_COLOR:e.base09,BOOLEAN_COLOR:e.base09,NULL_COLOR:e.base08,UNDEFINED_COLOR:e.base08,FUNCTION_COLOR:e.base08,SYMBOL_COLOR:e.base08,LABEL_COLOR:e.base0D,ARROW_COLOR:e.base0D,ITEM_STRING_COLOR:e.base0B,ITEM_STRING_EXPANDED_COLOR:e.base03}))(e);return{tree:{border:0,padding:0,marginTop:"0.5em",marginBottom:"0.5em",marginLeft:"0.125em",marginRight:0,listStyle:"none",MozUserSelect:"none",WebkitUserSelect:"none",backgroundColor:t.BACKGROUND_COLOR},value:(e,t,n)=>{let{style:i}=e;return{style:{...i,paddingTop:"0.25em",paddingRight:0,marginLeft:"0.875em",WebkitUserSelect:"text",MozUserSelect:"text",wordWrap:"break-word",paddingLeft:n.length>1?"2.125em":"1.25em",textIndent:"-0.5em",wordBreak:"break-all"}}},label:{display:"inline-block",color:t.LABEL_COLOR},valueLabel:{margin:"0 0.5em 0 0"},valueText:(e,n)=>{let{style:i}=e;return{style:{...i,color:Tr(t)[n]}}},itemRange:(e,n)=>({style:{paddingTop:n?0:"0.25em",cursor:"pointer",color:t.LABEL_COLOR}}),arrow:(e,t,n)=>{let{style:i}=e;return{style:{...i,marginLeft:0,transition:"150ms",WebkitTransition:"150ms",MozTransition:"150ms",WebkitTransform:n?"rotateZ(90deg)":"rotateZ(0deg)",MozTransform:n?"rotateZ(90deg)":"rotateZ(0deg)",transform:n?"rotateZ(90deg)":"rotateZ(0deg)",transformOrigin:"45% 50%",WebkitTransformOrigin:"45% 50%",MozTransformOrigin:"45% 50%",position:"relative",lineHeight:"1.1em",fontSize:"0.75em"}}},arrowContainer:(e,t)=>{let{style:n}=e;return{style:{...n,display:"inline-block",paddingRight:"0.5em",paddingLeft:"double"===t?"1em":0,cursor:"pointer"}}},arrowSign:{color:t.ARROW_COLOR},arrowSignInner:{position:"absolute",top:0,left:"-0.4em"},nestedNode:(e,t,n,i,s)=>{let{style:r}=e;return{style:{...r,position:"relative",paddingTop:"0.25em",marginLeft:t.length>1?"0.875em":0,paddingLeft:s?0:"1.125em"}}},rootNode:{padding:0,margin:0},nestedNodeLabel:(e,t,n,i,s)=>{let{style:r}=e;return{style:{...r,margin:0,padding:0,WebkitUserSelect:s?"inherit":"text",MozUserSelect:s?"inherit":"text",cursor:s?"pointer":"default"}}},nestedNodeItemString:(e,n,i,s)=>{let{style:r}=e;return{style:{...r,paddingLeft:"0.5em",cursor:"default",color:s?t.ITEM_STRING_EXPANDED_COLOR:t.ITEM_STRING_COLOR}}},nestedNodeItemType:{marginLeft:"0.3em",marginRight:"0.3em"},nestedNodeChildren:(e,t,n)=>{let{style:i}=e;return{style:{...i,padding:0,margin:0,listStyle:"none",display:n?"block":"none"}}},rootNodeChildren:{padding:0,margin:0,listStyle:"none"}}}),{defaultBase16:{scheme:"solarized",author:"ethan schoonover (http://ethanschoonover.com/solarized)",base00:"#002b36",base01:"#073642",base02:"#586e75",base03:"#657b83",base04:"#839496",base05:"#93a1a1",base06:"#eee8d5",base07:"#fdf6e3",base08:"#dc322f",base09:"#cb4b16",base0A:"#b58900",base0B:"#859900",base0C:"#2aa198",base0D:"#268bd2",base0E:"#6c71c4",base0F:"#d33682"}}),Er=Nr,Dr=e=>e,Pr=(e,t,n)=>0===n,Rr=(e,t,n,i)=>Bs.createElement("span",null,n," ",i),jr=e=>{let[t]=e;return Bs.createElement("span",null,t,":")},Ir=()=>!1;function Lr(e){let{data:t,theme:n,invertTheme:i,keyPath:s=["root"],labelRenderer:r=jr,valueRenderer:o=Dr,shouldExpandNodeInitially:a=Pr,hideRoot:l=!1,getItemString:h=Rr,postprocessValue:c=Dr,isCustomNode:u=Ir,collectionLimit:f=50,sortObjectKeys:d=!1}=e;const p=(0,Bs.useMemo)((()=>Er(i?function(e){return"string"==typeof e?"".concat(e,":inverted"):e&&Mr(e)&&e.extend?"string"==typeof e.extend?xr(xr({},e),{},{extend:"".concat(e.extend,":inverted")}):xr(xr({},e),{},{extend:Ar(e.extend)}):e?Ar(e):e}(n):n)),[n,i]);return Bs.createElement("ul",p("tree"),Bs.createElement(hr,{keyPath:l?[]:s,value:c(t),isCustomNode:u,styling:p,labelRenderer:r,valueRenderer:o,shouldExpandNodeInitially:a,hideRoot:l,getItemString:h,postprocessValue:c,collectionLimit:f,sortObjectKeys:d}))}var Br=n(8104);function Fr(e){var t;return null!==(t=Ms.style([e]))&&void 0!==t?t:""}class zr extends Bs.Component{constructor(){super(...arguments),this.state={filter:"",value:""},this.timer=0,this.handleChange=e=>{const{value:t}=e.target;this.setState({value:t}),window.clearTimeout(this.timer),this.timer=window.setTimeout((()=>{this.setState({filter:t})}),300)}}componentDidMount(){Br.G.mount(document,Ms.module)}render(){const e=(this.props.translator||Te.wK).load("jupyterlab"),{data:t,metadata:n,forwardedRef:i}=this.props,s=n&&n.root?n.root:"root",r=this.state.filter?qr(t,this.state.filter,[s]):[s];return Bs.createElement("div",{className:"container",ref:i},Bs.createElement(Ws,{className:"filter",type:"text",placeholder:e.__("Find…"),onChange:this.handleChange,value:this.state.value,rightIcon:"ui-components:search"}),Bs.createElement(Lr,{data:t,collectionLimit:100,theme:{extend:$r,valueLabel:Fr(De._A.variableName),valueText:Fr(De._A.string),nestedNodeItemString:Fr(De._A.comment)},invertTheme:!1,keyPath:[s],getItemString:(e,t,n,i)=>Array.isArray(t)?Bs.createElement("span",null,n," ",i):0===Object.keys(t).length?Bs.createElement("span",null,n):null,labelRenderer:([e,t])=>Bs.createElement("span",{className:Fr(De._A.keyword)},Bs.createElement(Us(),{searchWords:[this.state.filter],textToHighlight:`${e}`,highlightClassName:"jp-mod-selected"})),valueRenderer:e=>{let t=Fr(De._A.string);return"number"==typeof e&&(t=Fr(De._A.number)),"true"!==e&&"false"!==e||(t=Fr(De._A.keyword)),Bs.createElement("span",{className:t},Bs.createElement(Us(),{searchWords:[this.state.filter],textToHighlight:`${e}`,highlightClassName:"jp-mod-selected"}))},shouldExpandNodeInitially:(e,t,i)=>!(!n||!n.expanded)||r.join(",").includes(e.join(","))}))}}const $r={scheme:"jupyter",base00:"invalid",base01:"invalid",base02:"invalid",base03:"invalid",base04:"invalid",base05:"invalid",base06:"invalid",base07:"invalid",base08:"invalid",base09:"invalid",base0A:"invalid",base0B:"invalid",base0C:"invalid",base0D:"invalid",base0E:"invalid",base0F:"invalid",author:"invalid"};function Hr(e,t){return JSON.stringify(e).includes(t)}function qr(e,t,n=["root"]){return Ce.JSONExt.isArray(e)?e.reduce(((e,i,s)=>i&&"object"==typeof i&&Hr(i,t)?[...e,[s,...n].join(","),...qr(i,t,[s,...n])]:e),[]):Ce.JSONExt.isObject(e)?Object.keys(e).reduce(((i,s)=>{const r=e[s];return r&&"object"==typeof r&&(s.includes(t)||Hr(r,t))?[...i,[s,...n].join(","),...qr(r,t,[s,...n])]:i}),[]):[]}},5869:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"apathy",author:"jannik siebert (https://github.com/janniks)",base00:"#031A16",base01:"#0B342D",base02:"#184E45",base03:"#2B685E",base04:"#5F9C92",base05:"#81B5AC",base06:"#A7CEC8",base07:"#D2E7E4",base08:"#3E9688",base09:"#3E7996",base0A:"#3E4C96",base0B:"#883E96",base0C:"#963E4C",base0D:"#96883E",base0E:"#4C963E",base0F:"#3E965B"},e.exports=t.default},7088:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"ashes",author:"jannik siebert (https://github.com/janniks)",base00:"#1C2023",base01:"#393F45",base02:"#565E65",base03:"#747C84",base04:"#ADB3BA",base05:"#C7CCD1",base06:"#DFE2E5",base07:"#F3F4F5",base08:"#C7AE95",base09:"#C7C795",base0A:"#AEC795",base0B:"#95C7AE",base0C:"#95AEC7",base0D:"#AE95C7",base0E:"#C795AE",base0F:"#C79595"},e.exports=t.default},5067:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"atelier dune",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/dune)",base00:"#20201d",base01:"#292824",base02:"#6e6b5e",base03:"#7d7a68",base04:"#999580",base05:"#a6a28c",base06:"#e8e4cf",base07:"#fefbec",base08:"#d73737",base09:"#b65611",base0A:"#cfb017",base0B:"#60ac39",base0C:"#1fad83",base0D:"#6684e1",base0E:"#b854d4",base0F:"#d43552"},e.exports=t.default},7784:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"atelier forest",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/forest)",base00:"#1b1918",base01:"#2c2421",base02:"#68615e",base03:"#766e6b",base04:"#9c9491",base05:"#a8a19f",base06:"#e6e2e0",base07:"#f1efee",base08:"#f22c40",base09:"#df5320",base0A:"#d5911a",base0B:"#5ab738",base0C:"#00ad9c",base0D:"#407ee7",base0E:"#6666ea",base0F:"#c33ff3"},e.exports=t.default},9859:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"atelier heath",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/heath)",base00:"#1b181b",base01:"#292329",base02:"#695d69",base03:"#776977",base04:"#9e8f9e",base05:"#ab9bab",base06:"#d8cad8",base07:"#f7f3f7",base08:"#ca402b",base09:"#a65926",base0A:"#bb8a35",base0B:"#379a37",base0C:"#159393",base0D:"#516aec",base0E:"#7b59c0",base0F:"#cc33cc"},e.exports=t.default},9525:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"atelier lakeside",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/lakeside/)",base00:"#161b1d",base01:"#1f292e",base02:"#516d7b",base03:"#5a7b8c",base04:"#7195a8",base05:"#7ea2b4",base06:"#c1e4f6",base07:"#ebf8ff",base08:"#d22d72",base09:"#935c25",base0A:"#8a8a0f",base0B:"#568c3b",base0C:"#2d8f6f",base0D:"#257fad",base0E:"#5d5db1",base0F:"#b72dd2"},e.exports=t.default},5789:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"atelier seaside",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/seaside/)",base00:"#131513",base01:"#242924",base02:"#5e6e5e",base03:"#687d68",base04:"#809980",base05:"#8ca68c",base06:"#cfe8cf",base07:"#f0fff0",base08:"#e6193c",base09:"#87711d",base0A:"#c3c322",base0B:"#29a329",base0C:"#1999b3",base0D:"#3d62f5",base0E:"#ad2bee",base0F:"#e619c3"},e.exports=t.default},5363:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"bespin",author:"jan t. sott",base00:"#28211c",base01:"#36312e",base02:"#5e5d5c",base03:"#666666",base04:"#797977",base05:"#8a8986",base06:"#9d9b97",base07:"#baae9e",base08:"#cf6a4c",base09:"#cf7d34",base0A:"#f9ee98",base0B:"#54be0d",base0C:"#afc4db",base0D:"#5ea6ea",base0E:"#9b859d",base0F:"#937121"},e.exports=t.default},2525:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"brewer",author:"timothée poisot (http://github.com/tpoisot)",base00:"#0c0d0e",base01:"#2e2f30",base02:"#515253",base03:"#737475",base04:"#959697",base05:"#b7b8b9",base06:"#dadbdc",base07:"#fcfdfe",base08:"#e31a1c",base09:"#e6550d",base0A:"#dca060",base0B:"#31a354",base0C:"#80b1d3",base0D:"#3182bd",base0E:"#756bb1",base0F:"#b15928"},e.exports=t.default},1986:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"bright",author:"chris kempson (http://chriskempson.com)",base00:"#000000",base01:"#303030",base02:"#505050",base03:"#b0b0b0",base04:"#d0d0d0",base05:"#e0e0e0",base06:"#f5f5f5",base07:"#ffffff",base08:"#fb0120",base09:"#fc6d24",base0A:"#fda331",base0B:"#a1c659",base0C:"#76c7b7",base0D:"#6fb3d2",base0E:"#d381c3",base0F:"#be643c"},e.exports=t.default},5235:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"chalk",author:"chris kempson (http://chriskempson.com)",base00:"#151515",base01:"#202020",base02:"#303030",base03:"#505050",base04:"#b0b0b0",base05:"#d0d0d0",base06:"#e0e0e0",base07:"#f5f5f5",base08:"#fb9fb1",base09:"#eda987",base0A:"#ddb26f",base0B:"#acc267",base0C:"#12cfc0",base0D:"#6fc2ef",base0E:"#e1a3ee",base0F:"#deaf8f"},e.exports=t.default},9635:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"codeschool",author:"brettof86",base00:"#232c31",base01:"#1c3657",base02:"#2a343a",base03:"#3f4944",base04:"#84898c",base05:"#9ea7a6",base06:"#a7cfa3",base07:"#b5d8f6",base08:"#2a5491",base09:"#43820d",base0A:"#a03b1e",base0B:"#237986",base0C:"#b02f30",base0D:"#484d79",base0E:"#c59820",base0F:"#c98344"},e.exports=t.default},2230:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"colors",author:"mrmrs (http://clrs.cc)",base00:"#111111",base01:"#333333",base02:"#555555",base03:"#777777",base04:"#999999",base05:"#bbbbbb",base06:"#dddddd",base07:"#ffffff",base08:"#ff4136",base09:"#ff851b",base0A:"#ffdc00",base0B:"#2ecc40",base0C:"#7fdbff",base0D:"#0074d9",base0E:"#b10dc9",base0F:"#85144b"},e.exports=t.default},8597:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"default",author:"chris kempson (http://chriskempson.com)",base00:"#181818",base01:"#282828",base02:"#383838",base03:"#585858",base04:"#b8b8b8",base05:"#d8d8d8",base06:"#e8e8e8",base07:"#f8f8f8",base08:"#ab4642",base09:"#dc9656",base0A:"#f7ca88",base0B:"#a1b56c",base0C:"#86c1b9",base0D:"#7cafc2",base0E:"#ba8baf",base0F:"#a16946"},e.exports=t.default},4444:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"eighties",author:"chris kempson (http://chriskempson.com)",base00:"#2d2d2d",base01:"#393939",base02:"#515151",base03:"#747369",base04:"#a09f93",base05:"#d3d0c8",base06:"#e8e6df",base07:"#f2f0ec",base08:"#f2777a",base09:"#f99157",base0A:"#ffcc66",base0B:"#99cc99",base0C:"#66cccc",base0D:"#6699cc",base0E:"#cc99cc",base0F:"#d27b53"},e.exports=t.default},6834:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"embers",author:"jannik siebert (https://github.com/janniks)",base00:"#16130F",base01:"#2C2620",base02:"#433B32",base03:"#5A5047",base04:"#8A8075",base05:"#A39A90",base06:"#BEB6AE",base07:"#DBD6D1",base08:"#826D57",base09:"#828257",base0A:"#6D8257",base0B:"#57826D",base0C:"#576D82",base0D:"#6D5782",base0E:"#82576D",base0F:"#825757"},e.exports=t.default},6521:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"flat",author:"chris kempson (http://chriskempson.com)",base00:"#2C3E50",base01:"#34495E",base02:"#7F8C8D",base03:"#95A5A6",base04:"#BDC3C7",base05:"#e0e0e0",base06:"#f5f5f5",base07:"#ECF0F1",base08:"#E74C3C",base09:"#E67E22",base0A:"#F1C40F",base0B:"#2ECC71",base0C:"#1ABC9C",base0D:"#3498DB",base0E:"#9B59B6",base0F:"#be643c"},e.exports=t.default},7469:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"google",author:"seth wright (http://sethawright.com)",base00:"#1d1f21",base01:"#282a2e",base02:"#373b41",base03:"#969896",base04:"#b4b7b4",base05:"#c5c8c6",base06:"#e0e0e0",base07:"#ffffff",base08:"#CC342B",base09:"#F96A38",base0A:"#FBA922",base0B:"#198844",base0C:"#3971ED",base0D:"#3971ED",base0E:"#A36AC7",base0F:"#3971ED"},e.exports=t.default},4011:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"grayscale",author:"alexandre gavioli (https://github.com/alexx2/)",base00:"#101010",base01:"#252525",base02:"#464646",base03:"#525252",base04:"#ababab",base05:"#b9b9b9",base06:"#e3e3e3",base07:"#f7f7f7",base08:"#7c7c7c",base09:"#999999",base0A:"#a0a0a0",base0B:"#8e8e8e",base0C:"#868686",base0D:"#686868",base0E:"#747474",base0F:"#5e5e5e"},e.exports=t.default},1027:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"green screen",author:"chris kempson (http://chriskempson.com)",base00:"#001100",base01:"#003300",base02:"#005500",base03:"#007700",base04:"#009900",base05:"#00bb00",base06:"#00dd00",base07:"#00ff00",base08:"#007700",base09:"#009900",base0A:"#007700",base0B:"#00bb00",base0C:"#005500",base0D:"#009900",base0E:"#00bb00",base0F:"#005500"},e.exports=t.default},8781:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"harmonic16",author:"jannik siebert (https://github.com/janniks)",base00:"#0b1c2c",base01:"#223b54",base02:"#405c79",base03:"#627e99",base04:"#aabcce",base05:"#cbd6e2",base06:"#e5ebf1",base07:"#f7f9fb",base08:"#bf8b56",base09:"#bfbf56",base0A:"#8bbf56",base0B:"#56bf8b",base0C:"#568bbf",base0D:"#8b56bf",base0E:"#bf568b",base0F:"#bf5656"},e.exports=t.default},9453:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"hopscotch",author:"jan t. sott",base00:"#322931",base01:"#433b42",base02:"#5c545b",base03:"#797379",base04:"#989498",base05:"#b9b5b8",base06:"#d5d3d5",base07:"#ffffff",base08:"#dd464c",base09:"#fd8b19",base0A:"#fdcc59",base0B:"#8fc13e",base0C:"#149b93",base0D:"#1290bf",base0E:"#c85e7c",base0F:"#b33508"},e.exports=t.default},1932:(e,t,n)=>{"use strict";function i(e){return e&&e.__esModule?e.default:e}t.__esModule=!0;var s=n(9782);t.threezerotwofour=i(s);var r=n(5869);t.apathy=i(r);var o=n(7088);t.ashes=i(o);var a=n(5067);t.atelierDune=i(a);var l=n(7784);t.atelierForest=i(l);var h=n(9859);t.atelierHeath=i(h);var c=n(9525);t.atelierLakeside=i(c);var u=n(5789);t.atelierSeaside=i(u);var f=n(5363);t.bespin=i(f);var d=n(2525);t.brewer=i(d);var p=n(1986);t.bright=i(p);var m=n(5235);t.chalk=i(m);var g=n(9635);t.codeschool=i(g);var b=n(2230);t.colors=i(b);var y=n(8597);t.default=i(y);var v=n(4444);t.eighties=i(v);var x=n(6834);t.embers=i(x);var w=n(6521);t.flat=i(w);var k=n(7469);t.google=i(k);var S=n(4011);t.grayscale=i(S);var C=n(1027);t.greenscreen=i(C);var A=n(8781);t.harmonic=i(A);var O=n(9453);t.hopscotch=i(O);var M=n(8599);t.isotope=i(M);var _=n(4522);t.marrakesh=i(_);var T=n(1946);t.mocha=i(T);var N=n(10);t.monokai=i(N);var E=n(5942);t.ocean=i(E);var D=n(443);t.paraiso=i(D);var P=n(7339);t.pop=i(P);var R=n(9009);t.railscasts=i(R);var j=n(6870);t.shapeshifter=i(j);var I=n(2783);t.solarized=i(I);var L=n(4925);t.summerfruit=i(L);var B=n(1533);t.tomorrow=i(B);var F=n(5240);t.tube=i(F);var z=n(5822);t.twilight=i(z)},8599:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"isotope",author:"jan t. sott",base00:"#000000",base01:"#404040",base02:"#606060",base03:"#808080",base04:"#c0c0c0",base05:"#d0d0d0",base06:"#e0e0e0",base07:"#ffffff",base08:"#ff0000",base09:"#ff9900",base0A:"#ff0099",base0B:"#33ff00",base0C:"#00ffff",base0D:"#0066ff",base0E:"#cc00ff",base0F:"#3300ff"},e.exports=t.default},4522:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"marrakesh",author:"alexandre gavioli (http://github.com/alexx2/)",base00:"#201602",base01:"#302e00",base02:"#5f5b17",base03:"#6c6823",base04:"#86813b",base05:"#948e48",base06:"#ccc37a",base07:"#faf0a5",base08:"#c35359",base09:"#b36144",base0A:"#a88339",base0B:"#18974e",base0C:"#75a738",base0D:"#477ca1",base0E:"#8868b3",base0F:"#b3588e"},e.exports=t.default},1946:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"mocha",author:"chris kempson (http://chriskempson.com)",base00:"#3B3228",base01:"#534636",base02:"#645240",base03:"#7e705a",base04:"#b8afad",base05:"#d0c8c6",base06:"#e9e1dd",base07:"#f5eeeb",base08:"#cb6077",base09:"#d28b71",base0A:"#f4bc87",base0B:"#beb55b",base0C:"#7bbda4",base0D:"#8ab3b5",base0E:"#a89bb9",base0F:"#bb9584"},e.exports=t.default},10:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"monokai",author:"wimer hazenberg (http://www.monokai.nl)",base00:"#272822",base01:"#383830",base02:"#49483e",base03:"#75715e",base04:"#a59f85",base05:"#f8f8f2",base06:"#f5f4f1",base07:"#f9f8f5",base08:"#f92672",base09:"#fd971f",base0A:"#f4bf75",base0B:"#a6e22e",base0C:"#a1efe4",base0D:"#66d9ef",base0E:"#ae81ff",base0F:"#cc6633"},e.exports=t.default},5942:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"ocean",author:"chris kempson (http://chriskempson.com)",base00:"#2b303b",base01:"#343d46",base02:"#4f5b66",base03:"#65737e",base04:"#a7adba",base05:"#c0c5ce",base06:"#dfe1e8",base07:"#eff1f5",base08:"#bf616a",base09:"#d08770",base0A:"#ebcb8b",base0B:"#a3be8c",base0C:"#96b5b4",base0D:"#8fa1b3",base0E:"#b48ead",base0F:"#ab7967"},e.exports=t.default},443:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"paraiso",author:"jan t. sott",base00:"#2f1e2e",base01:"#41323f",base02:"#4f424c",base03:"#776e71",base04:"#8d8687",base05:"#a39e9b",base06:"#b9b6b0",base07:"#e7e9db",base08:"#ef6155",base09:"#f99b15",base0A:"#fec418",base0B:"#48b685",base0C:"#5bc4bf",base0D:"#06b6ef",base0E:"#815ba4",base0F:"#e96ba8"},e.exports=t.default},7339:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"pop",author:"chris kempson (http://chriskempson.com)",base00:"#000000",base01:"#202020",base02:"#303030",base03:"#505050",base04:"#b0b0b0",base05:"#d0d0d0",base06:"#e0e0e0",base07:"#ffffff",base08:"#eb008a",base09:"#f29333",base0A:"#f8ca12",base0B:"#37b349",base0C:"#00aabb",base0D:"#0e5a94",base0E:"#b31e8d",base0F:"#7a2d00"},e.exports=t.default},9009:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"railscasts",author:"ryan bates (http://railscasts.com)",base00:"#2b2b2b",base01:"#272935",base02:"#3a4055",base03:"#5a647e",base04:"#d4cfc9",base05:"#e6e1dc",base06:"#f4f1ed",base07:"#f9f7f3",base08:"#da4939",base09:"#cc7833",base0A:"#ffc66d",base0B:"#a5c261",base0C:"#519f50",base0D:"#6d9cbe",base0E:"#b6b3eb",base0F:"#bc9458"},e.exports=t.default},6870:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"shapeshifter",author:"tyler benziger (http://tybenz.com)",base00:"#000000",base01:"#040404",base02:"#102015",base03:"#343434",base04:"#555555",base05:"#ababab",base06:"#e0e0e0",base07:"#f9f9f9",base08:"#e92f2f",base09:"#e09448",base0A:"#dddd13",base0B:"#0ed839",base0C:"#23edda",base0D:"#3b48e3",base0E:"#f996e2",base0F:"#69542d"},e.exports=t.default},2783:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"solarized",author:"ethan schoonover (http://ethanschoonover.com/solarized)",base00:"#002b36",base01:"#073642",base02:"#586e75",base03:"#657b83",base04:"#839496",base05:"#93a1a1",base06:"#eee8d5",base07:"#fdf6e3",base08:"#dc322f",base09:"#cb4b16",base0A:"#b58900",base0B:"#859900",base0C:"#2aa198",base0D:"#268bd2",base0E:"#6c71c4",base0F:"#d33682"},e.exports=t.default},4925:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"summerfruit",author:"christopher corley (http://cscorley.github.io/)",base00:"#151515",base01:"#202020",base02:"#303030",base03:"#505050",base04:"#B0B0B0",base05:"#D0D0D0",base06:"#E0E0E0",base07:"#FFFFFF",base08:"#FF0086",base09:"#FD8900",base0A:"#ABA800",base0B:"#00C918",base0C:"#1faaaa",base0D:"#3777E6",base0E:"#AD00A1",base0F:"#cc6633"},e.exports=t.default},9782:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"threezerotwofour",author:"jan t. sott (http://github.com/idleberg)",base00:"#090300",base01:"#3a3432",base02:"#4a4543",base03:"#5c5855",base04:"#807d7c",base05:"#a5a2a2",base06:"#d6d5d4",base07:"#f7f7f7",base08:"#db2d20",base09:"#e8bbd0",base0A:"#fded02",base0B:"#01a252",base0C:"#b5e4f4",base0D:"#01a0e4",base0E:"#a16a94",base0F:"#cdab53"},e.exports=t.default},1533:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"tomorrow",author:"chris kempson (http://chriskempson.com)",base00:"#1d1f21",base01:"#282a2e",base02:"#373b41",base03:"#969896",base04:"#b4b7b4",base05:"#c5c8c6",base06:"#e0e0e0",base07:"#ffffff",base08:"#cc6666",base09:"#de935f",base0A:"#f0c674",base0B:"#b5bd68",base0C:"#8abeb7",base0D:"#81a2be",base0E:"#b294bb",base0F:"#a3685a"},e.exports=t.default},5240:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"london tube",author:"jan t. sott",base00:"#231f20",base01:"#1c3f95",base02:"#5a5758",base03:"#737171",base04:"#959ca1",base05:"#d9d8d8",base06:"#e7e7e8",base07:"#ffffff",base08:"#ee2e24",base09:"#f386a1",base0A:"#ffd204",base0B:"#00853e",base0C:"#85cebc",base0D:"#009ddc",base0E:"#98005d",base0F:"#b06110"},e.exports=t.default},5822:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"twilight",author:"david hart (http://hart-dev.com)",base00:"#1e1e1e",base01:"#323537",base02:"#464b50",base03:"#5f5a60",base04:"#838184",base05:"#a7a7a7",base06:"#c3c3c3",base07:"#ffffff",base08:"#cf6a4c",base09:"#cda869",base0A:"#f9ee98",base0B:"#8f9d6a",base0C:"#afc4db",base0D:"#7587a6",base0E:"#9b859d",base0F:"#9b703f"},e.exports=t.default},6931:e=>{"use strict";e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},8031:(e,t,n)=>{var i=n(6931),s=n(9975),r=Object.hasOwnProperty,o=Object.create(null);for(var a in i)r.call(i,a)&&(o[i[a]]=a);var l=e.exports={to:{},get:{}};function h(e,t,n){return Math.min(Math.max(t,e),n)}function c(e){var t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}l.get=function(e){var t,n;switch(e.substring(0,3).toLowerCase()){case"hsl":t=l.get.hsl(e),n="hsl";break;case"hwb":t=l.get.hwb(e),n="hwb";break;default:t=l.get.rgb(e),n="rgb"}return t?{model:n,value:t}:null},l.get.rgb=function(e){if(!e)return null;var t,n,s,o=[0,0,0,1];if(t=e.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(s=t[2],t=t[1],n=0;n<3;n++){var a=2*n;o[n]=parseInt(t.slice(a,a+2),16)}s&&(o[3]=parseInt(s,16)/255)}else if(t=e.match(/^#([a-f0-9]{3,4})$/i)){for(s=(t=t[1])[3],n=0;n<3;n++)o[n]=parseInt(t[n]+t[n],16);s&&(o[3]=parseInt(s+s,16)/255)}else if(t=e.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(n=0;n<3;n++)o[n]=parseInt(t[n+1],0);t[4]&&(t[5]?o[3]=.01*parseFloat(t[4]):o[3]=parseFloat(t[4]))}else{if(!(t=e.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(t=e.match(/^(\w+)$/))?"transparent"===t[1]?[0,0,0,0]:r.call(i,t[1])?((o=i[t[1]])[3]=1,o):null:null;for(n=0;n<3;n++)o[n]=Math.round(2.55*parseFloat(t[n+1]));t[4]&&(t[5]?o[3]=.01*parseFloat(t[4]):o[3]=parseFloat(t[4]))}for(n=0;n<3;n++)o[n]=h(o[n],0,255);return o[3]=h(o[3],0,1),o},l.get.hsl=function(e){if(!e)return null;var t=e.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){var n=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,h(parseFloat(t[2]),0,100),h(parseFloat(t[3]),0,100),h(isNaN(n)?1:n,0,1)]}return null},l.get.hwb=function(e){if(!e)return null;var t=e.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){var n=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,h(parseFloat(t[2]),0,100),h(parseFloat(t[3]),0,100),h(isNaN(n)?1:n,0,1)]}return null},l.to.hex=function(){var e=s(arguments);return"#"+c(e[0])+c(e[1])+c(e[2])+(e[3]<1?c(Math.round(255*e[3])):"")},l.to.rgb=function(){var e=s(arguments);return e.length<4||1===e[3]?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"},l.to.rgb.percent=function(){var e=s(arguments),t=Math.round(e[0]/255*100),n=Math.round(e[1]/255*100),i=Math.round(e[2]/255*100);return e.length<4||1===e[3]?"rgb("+t+"%, "+n+"%, "+i+"%)":"rgba("+t+"%, "+n+"%, "+i+"%, "+e[3]+")"},l.to.hsl=function(){var e=s(arguments);return e.length<4||1===e[3]?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"},l.to.hwb=function(){var e=s(arguments),t="";return e.length>=4&&1!==e[3]&&(t=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"},l.to.keyword=function(e){return o[e.slice(0,3)]}},465:(e,t,n)=>{"use strict";var i=n(8031),s=n(8754),r=[].slice,o=["keyword","gray","hex"],a={};Object.keys(s).forEach((function(e){a[r.call(s[e].labels).sort().join("")]=e}));var l={};function h(e,t){if(!(this instanceof h))return new h(e,t);if(t&&t in o&&(t=null),t&&!(t in s))throw new Error("Unknown model: "+t);var n,c;if(null==e)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof h)this.model=e.model,this.color=e.color.slice(),this.valpha=e.valpha;else if("string"==typeof e){var u=i.get(e);if(null===u)throw new Error("Unable to parse color from string: "+e);this.model=u.model,c=s[this.model].channels,this.color=u.value.slice(0,c),this.valpha="number"==typeof u.value[c]?u.value[c]:1}else if(e.length){this.model=t||"rgb",c=s[this.model].channels;var d=r.call(e,0,c);this.color=f(d,c),this.valpha="number"==typeof e[c]?e[c]:1}else if("number"==typeof e)e&=16777215,this.model="rgb",this.color=[e>>16&255,e>>8&255,255&e],this.valpha=1;else{this.valpha=1;var p=Object.keys(e);"alpha"in e&&(p.splice(p.indexOf("alpha"),1),this.valpha="number"==typeof e.alpha?e.alpha:0);var m=p.sort().join("");if(!(m in a))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=a[m];var g=s[this.model].labels,b=[];for(n=0;nn?(t+.05)/(n+.05):(n+.05)/(t+.05)},level:function(e){var t=this.contrast(e);return t>=7.1?"AAA":t>=4.5?"AA":""},isDark:function(){var e=this.rgb().color;return(299*e[0]+587*e[1]+114*e[2])/1e3<128},isLight:function(){return!this.isDark()},negate:function(){for(var e=this.rgb(),t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten:function(e){var t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken:function(e){var t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate:function(e){var t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate:function(e){var t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten:function(e){var t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken:function(e){var t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale:function(){var e=this.rgb().color,t=.3*e[0]+.59*e[1]+.11*e[2];return h.rgb(t,t,t)},fade:function(e){return this.alpha(this.valpha-this.valpha*e)},opaquer:function(e){return this.alpha(this.valpha+this.valpha*e)},rotate:function(e){var t=this.hsl(),n=t.color[0];return n=(n=(n+e)%360)<0?360+n:n,t.color[0]=n,t},mix:function(e,t){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);var n=e.rgb(),i=this.rgb(),s=void 0===t?.5:t,r=2*s-1,o=n.alpha()-i.alpha(),a=((r*o==-1?r:(r+o)/(1+r*o))+1)/2,l=1-a;return h.rgb(a*n.red()+l*i.red(),a*n.green()+l*i.green(),a*n.blue()+l*i.blue(),n.alpha()*s+i.alpha()*(1-s))}},Object.keys(s).forEach((function(e){if(-1===o.indexOf(e)){var t=s[e].channels;h.prototype[e]=function(){if(this.model===e)return new h(this);if(arguments.length)return new h(arguments,e);var n,i="number"==typeof arguments[t]?t:this.valpha;return new h((n=s[this.model][e].raw(this.color),Array.isArray(n)?n:[n]).concat(i),e)},h[e]=function(n){return"number"==typeof n&&(n=f(r.call(arguments),t)),new h(n,e)}}})),e.exports=h},5159:(e,t,n)=>{var i=n(3928),s={};for(var r in i)i.hasOwnProperty(r)&&(s[i[r]]=r);var o=e.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var a in o)if(o.hasOwnProperty(a)){if(!("channels"in o[a]))throw new Error("missing channels property: "+a);if(!("labels"in o[a]))throw new Error("missing channel labels property: "+a);if(o[a].labels.length!==o[a].channels)throw new Error("channel and label counts mismatch: "+a);var l=o[a].channels,h=o[a].labels;delete o[a].channels,delete o[a].labels,Object.defineProperty(o[a],"channels",{value:l}),Object.defineProperty(o[a],"labels",{value:h})}o.rgb.hsl=function(e){var t,n,i=e[0]/255,s=e[1]/255,r=e[2]/255,o=Math.min(i,s,r),a=Math.max(i,s,r),l=a-o;return a===o?t=0:i===a?t=(s-r)/l:s===a?t=2+(r-i)/l:r===a&&(t=4+(i-s)/l),(t=Math.min(60*t,360))<0&&(t+=360),n=(o+a)/2,[t,100*(a===o?0:n<=.5?l/(a+o):l/(2-a-o)),100*n]},o.rgb.hsv=function(e){var t,n,i,s,r,o=e[0]/255,a=e[1]/255,l=e[2]/255,h=Math.max(o,a,l),c=h-Math.min(o,a,l),u=function(e){return(h-e)/6/c+.5};return 0===c?s=r=0:(r=c/h,t=u(o),n=u(a),i=u(l),o===h?s=i-n:a===h?s=1/3+t-i:l===h&&(s=2/3+n-t),s<0?s+=1:s>1&&(s-=1)),[360*s,100*r,100*h]},o.rgb.hwb=function(e){var t=e[0],n=e[1],i=e[2];return[o.rgb.hsl(e)[0],1/255*Math.min(t,Math.min(n,i))*100,100*(i=1-1/255*Math.max(t,Math.max(n,i)))]},o.rgb.cmyk=function(e){var t,n=e[0]/255,i=e[1]/255,s=e[2]/255;return[100*((1-n-(t=Math.min(1-n,1-i,1-s)))/(1-t)||0),100*((1-i-t)/(1-t)||0),100*((1-s-t)/(1-t)||0),100*t]},o.rgb.keyword=function(e){var t=s[e];if(t)return t;var n,r,o,a=1/0;for(var l in i)if(i.hasOwnProperty(l)){var h=(r=e,o=i[l],Math.pow(r[0]-o[0],2)+Math.pow(r[1]-o[1],2)+Math.pow(r[2]-o[2],2));h.04045?Math.pow((t+.055)/1.055,2.4):t/12.92)+.3576*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.1805*(i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92)),100*(.2126*t+.7152*n+.0722*i),100*(.0193*t+.1192*n+.9505*i)]},o.rgb.lab=function(e){var t=o.rgb.xyz(e),n=t[0],i=t[1],s=t[2];return i/=100,s/=108.883,n=(n/=95.047)>.008856?Math.pow(n,1/3):7.787*n+16/116,[116*(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116)-16,500*(n-i),200*(i-(s=s>.008856?Math.pow(s,1/3):7.787*s+16/116))]},o.hsl.rgb=function(e){var t,n,i,s,r,o=e[0]/360,a=e[1]/100,l=e[2]/100;if(0===a)return[r=255*l,r,r];t=2*l-(n=l<.5?l*(1+a):l+a-l*a),s=[0,0,0];for(var h=0;h<3;h++)(i=o+1/3*-(h-1))<0&&i++,i>1&&i--,r=6*i<1?t+6*(n-t)*i:2*i<1?n:3*i<2?t+(n-t)*(2/3-i)*6:t,s[h]=255*r;return s},o.hsl.hsv=function(e){var t=e[0],n=e[1]/100,i=e[2]/100,s=n,r=Math.max(i,.01);return n*=(i*=2)<=1?i:2-i,s*=r<=1?r:2-r,[t,100*(0===i?2*s/(r+s):2*n/(i+n)),(i+n)/2*100]},o.hsv.rgb=function(e){var t=e[0]/60,n=e[1]/100,i=e[2]/100,s=Math.floor(t)%6,r=t-Math.floor(t),o=255*i*(1-n),a=255*i*(1-n*r),l=255*i*(1-n*(1-r));switch(i*=255,s){case 0:return[i,l,o];case 1:return[a,i,o];case 2:return[o,i,l];case 3:return[o,a,i];case 4:return[l,o,i];case 5:return[i,o,a]}},o.hsv.hsl=function(e){var t,n,i,s=e[0],r=e[1]/100,o=e[2]/100,a=Math.max(o,.01);return i=(2-r)*o,n=r*a,[s,100*(n=(n/=(t=(2-r)*a)<=1?t:2-t)||0),100*(i/=2)]},o.hwb.rgb=function(e){var t,n,i,s,r,o,a,l=e[0]/360,h=e[1]/100,c=e[2]/100,u=h+c;switch(u>1&&(h/=u,c/=u),i=6*l-(t=Math.floor(6*l)),1&t&&(i=1-i),s=h+i*((n=1-c)-h),t){default:case 6:case 0:r=n,o=s,a=h;break;case 1:r=s,o=n,a=h;break;case 2:r=h,o=n,a=s;break;case 3:r=h,o=s,a=n;break;case 4:r=s,o=h,a=n;break;case 5:r=n,o=h,a=s}return[255*r,255*o,255*a]},o.cmyk.rgb=function(e){var t=e[0]/100,n=e[1]/100,i=e[2]/100,s=e[3]/100;return[255*(1-Math.min(1,t*(1-s)+s)),255*(1-Math.min(1,n*(1-s)+s)),255*(1-Math.min(1,i*(1-s)+s))]},o.xyz.rgb=function(e){var t,n,i,s=e[0]/100,r=e[1]/100,o=e[2]/100;return n=-.9689*s+1.8758*r+.0415*o,i=.0557*s+-.204*r+1.057*o,t=(t=3.2406*s+-1.5372*r+-.4986*o)>.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:12.92*i,[255*(t=Math.min(Math.max(0,t),1)),255*(n=Math.min(Math.max(0,n),1)),255*(i=Math.min(Math.max(0,i),1))]},o.xyz.lab=function(e){var t=e[0],n=e[1],i=e[2];return n/=100,i/=108.883,t=(t/=95.047)>.008856?Math.pow(t,1/3):7.787*t+16/116,[116*(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116)-16,500*(t-n),200*(n-(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116))]},o.lab.xyz=function(e){var t,n,i,s=e[0];t=e[1]/500+(n=(s+16)/116),i=n-e[2]/200;var r=Math.pow(n,3),o=Math.pow(t,3),a=Math.pow(i,3);return n=r>.008856?r:(n-16/116)/7.787,t=o>.008856?o:(t-16/116)/7.787,i=a>.008856?a:(i-16/116)/7.787,[t*=95.047,n*=100,i*=108.883]},o.lab.lch=function(e){var t,n=e[0],i=e[1],s=e[2];return(t=360*Math.atan2(s,i)/2/Math.PI)<0&&(t+=360),[n,Math.sqrt(i*i+s*s),t]},o.lch.lab=function(e){var t,n=e[0],i=e[1];return t=e[2]/360*2*Math.PI,[n,i*Math.cos(t),i*Math.sin(t)]},o.rgb.ansi16=function(e){var t=e[0],n=e[1],i=e[2],s=1 in arguments?arguments[1]:o.rgb.hsv(e)[2];if(0===(s=Math.round(s/50)))return 30;var r=30+(Math.round(i/255)<<2|Math.round(n/255)<<1|Math.round(t/255));return 2===s&&(r+=60),r},o.hsv.ansi16=function(e){return o.rgb.ansi16(o.hsv.rgb(e),e[2])},o.rgb.ansi256=function(e){var t=e[0],n=e[1],i=e[2];return t===n&&n===i?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(i/255*5)},o.ansi16.rgb=function(e){var t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),[t=t/10.5*255,t,t];var n=.5*(1+~~(e>50));return[(1&t)*n*255,(t>>1&1)*n*255,(t>>2&1)*n*255]},o.ansi256.rgb=function(e){if(e>=232){var t=10*(e-232)+8;return[t,t,t]}var n;return e-=16,[Math.floor(e/36)/5*255,Math.floor((n=e%36)/6)/5*255,n%6/5*255]},o.rgb.hex=function(e){var t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},o.hex.rgb=function(e){var t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];var n=t[0];3===t[0].length&&(n=n.split("").map((function(e){return e+e})).join(""));var i=parseInt(n,16);return[i>>16&255,i>>8&255,255&i]},o.rgb.hcg=function(e){var t,n=e[0]/255,i=e[1]/255,s=e[2]/255,r=Math.max(Math.max(n,i),s),o=Math.min(Math.min(n,i),s),a=r-o;return t=a<=0?0:r===n?(i-s)/a%6:r===i?2+(s-n)/a:4+(n-i)/a+4,t/=6,[360*(t%=1),100*a,100*(a<1?o/(1-a):0)]},o.hsl.hcg=function(e){var t,n=e[1]/100,i=e[2]/100,s=0;return(t=i<.5?2*n*i:2*n*(1-i))<1&&(s=(i-.5*t)/(1-t)),[e[0],100*t,100*s]},o.hsv.hcg=function(e){var t=e[1]/100,n=e[2]/100,i=t*n,s=0;return i<1&&(s=(n-i)/(1-i)),[e[0],100*i,100*s]},o.hcg.rgb=function(e){var t=e[0]/360,n=e[1]/100,i=e[2]/100;if(0===n)return[255*i,255*i,255*i];var s,r=[0,0,0],o=t%1*6,a=o%1,l=1-a;switch(Math.floor(o)){case 0:r[0]=1,r[1]=a,r[2]=0;break;case 1:r[0]=l,r[1]=1,r[2]=0;break;case 2:r[0]=0,r[1]=1,r[2]=a;break;case 3:r[0]=0,r[1]=l,r[2]=1;break;case 4:r[0]=a,r[1]=0,r[2]=1;break;default:r[0]=1,r[1]=0,r[2]=l}return s=(1-n)*i,[255*(n*r[0]+s),255*(n*r[1]+s),255*(n*r[2]+s)]},o.hcg.hsv=function(e){var t=e[1]/100,n=t+e[2]/100*(1-t),i=0;return n>0&&(i=t/n),[e[0],100*i,100*n]},o.hcg.hsl=function(e){var t=e[1]/100,n=e[2]/100*(1-t)+.5*t,i=0;return n>0&&n<.5?i=t/(2*n):n>=.5&&n<1&&(i=t/(2*(1-n))),[e[0],100*i,100*n]},o.hcg.hwb=function(e){var t=e[1]/100,n=t+e[2]/100*(1-t);return[e[0],100*(n-t),100*(1-n)]},o.hwb.hcg=function(e){var t=e[1]/100,n=1-e[2]/100,i=n-t,s=0;return i<1&&(s=(n-i)/(1-i)),[e[0],100*i,100*s]},o.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},o.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},o.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},o.gray.hsl=o.gray.hsv=function(e){return[0,0,e[0]]},o.gray.hwb=function(e){return[0,100,e[0]]},o.gray.cmyk=function(e){return[0,0,0,e[0]]},o.gray.lab=function(e){return[e[0],0,0]},o.gray.hex=function(e){var t=255&Math.round(e[0]/100*255),n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(n.length)+n},o.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}},8754:(e,t,n)=>{var i=n(5159),s=n(2695),r={};Object.keys(i).forEach((function(e){r[e]={},Object.defineProperty(r[e],"channels",{value:i[e].channels}),Object.defineProperty(r[e],"labels",{value:i[e].labels});var t=s(e);Object.keys(t).forEach((function(n){var i=t[n];r[e][n]=function(e){var t=function(t){if(null==t)return t;arguments.length>1&&(t=Array.prototype.slice.call(arguments));var n=e(t);if("object"==typeof n)for(var i=n.length,s=0;s1&&(t=Array.prototype.slice.call(arguments)),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}(i)}))})),e.exports=r},2695:(e,t,n)=>{var i=n(5159);function s(e,t){return function(n){return t(e(n))}}function r(e,t){for(var n=[t[e].parent,e],r=i[t[e].parent][e],o=t[e].parent;t[o].parent;)n.unshift(t[o].parent),r=s(i[t[o].parent][o],r),o=t[o].parent;return r.conversion=n,r}e.exports=function(e){for(var t=function(e){var t=function(){for(var e={},t=Object.keys(i),n=t.length,s=0;s{"use strict";e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},8101:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Cache:()=>p,FreeStyle:()=>v,Rule:()=>b,Selector:()=>m,Style:()=>g,create:()=>x});let i=0;const s=Object.create(null),r=["animation-iteration-count","border-image-outset","border-image-slice","border-image-width","box-flex","box-flex-group","box-ordinal-group","column-count","columns","counter-increment","counter-reset","flex","flex-grow","flex-positive","flex-shrink","flex-negative","flex-order","font-weight","grid-area","grid-column","grid-column-end","grid-column-span","grid-column-start","grid-row","grid-row-end","grid-row-span","grid-row-start","line-clamp","line-height","opacity","order","orphans","tab-size","widows","z-index","zoom","fill-opacity","flood-opacity","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-miterlimit","stroke-opacity","stroke-width"];for(const e of r)for(const t of["-webkit-","-ms-","-moz-","-o-",""])s[t+e]=!0;function o(e,t){return t&&"number"==typeof t&&!s[e]?`${e}:${t}px`:`${e}:${t}`}function a(e){return e.sort(((e,t)=>e[0]>t[0]?1:-1))}function l(e){return e.map((([e,t])=>Array.isArray(t)?t.map((t=>o(e,t))).join(";"):o(e,t))).join(";")}function h(e,t){return-1===e.indexOf("&")?`${t} ${e}`:e.replace(/&/g,t)}function c(e,t,n,i,s){const{style:r,nested:o,isUnique:u}=function(e,t){const n=[],i=[];for(const t of Object.keys(e)){const r=t.trim(),o=e[t];36!==r.charCodeAt(0)&&null!=o&&("object"!=typeof o||Array.isArray(o)?n.push([(s=r,s.replace(/[A-Z]/g,(e=>`-${e.toLowerCase()}`)).replace(/^ms-/,"-ms-")),o]):i.push([r,o]))}var s;return{style:l(a(n)),nested:t?i:a(i),isUnique:!!e.$unique}}(t,""!==e);let f=r;if(64===e.charCodeAt(0)){const t={selector:e,styles:[],rules:[],style:s?"":r};n.push(t),r&&s&&t.styles.push({selector:s,style:r,isUnique:u});for(const[e,n]of o)f+=e+c(e,n,t.rules,t.styles,s)}else{const t=s?h(e,s):e;r&&i.push({selector:t,style:r,isUnique:u});for(const[e,s]of o)f+=e+c(e,s,n,i,t)}return f}function u(e,t,n,s,r,o){for(const{selector:n,style:a,isUnique:l}of s){const s=o?h(n,r):n,c=l?`u\0${(++i).toString(36)}`:`s\0${t}\0${a}`,u=new g(a,c);u.add(new m(s,`k\0${t}\0${s}`)),e.add(u)}for(const{selector:i,style:s,rules:a,styles:l}of n){const n=new b(i,s,`r\0${t}\0${i}\0${s}`);u(n,t,a,l,r,o),e.add(n)}}function f(e){let t="";for(let n=0;n{},change:()=>{},remove:()=>{}};class p{constructor(e=d){this.changes=e,this.sheet=[],this.changeId=0,this._keys=[],this._children=Object.create(null),this._counters=Object.create(null)}add(e){const t=this._counters[e.id]||0,n=this._children[e.id]||e.clone();if(this._counters[e.id]=t+1,0===t)this._children[n.id]=n,this._keys.push(n.id),this.sheet.push(n.getStyles()),this.changeId++,this.changes.add(n,this._keys.length-1);else if(n instanceof p&&e instanceof p){const t=this._keys.indexOf(e.id),i=n.changeId;n.merge(e),n.changeId!==i&&(this.sheet.splice(t,1,n.getStyles()),this.changeId++,this.changes.change(n,t,t))}}remove(e){const t=this._counters[e.id];if(t){this._counters[e.id]=t-1;const n=this._children[e.id],i=this._keys.indexOf(n.id);if(1===t)delete this._counters[e.id],delete this._children[e.id],this._keys.splice(i,1),this.sheet.splice(i,1),this.changeId++,this.changes.remove(n,i);else if(n instanceof p&&e instanceof p){const t=n.changeId;n.unmerge(e),n.changeId!==t&&(this.sheet.splice(i,1,n.getStyles()),this.changeId++,this.changes.change(n,i,i))}}}values(){return this._keys.map((e=>this._children[e]))}merge(e){for(const t of e.values())this.add(t);return this}unmerge(e){for(const t of e.values())this.remove(t);return this}clone(){return(new p).merge(this)}}class m{constructor(e,t){this.selector=e,this.id=t}getStyles(){return this.selector}clone(){return this}}class g extends p{constructor(e,t){super(),this.style=e,this.id=t}getStyles(){return`${this.sheet.join(",")}{${this.style}}`}clone(){return new g(this.style,this.id).merge(this)}}class b extends p{constructor(e,t,n){super(),this.rule=e,this.style=t,this.id=n}getStyles(){return`${this.rule}{${this.style}${f(this.sheet)}}`}clone(){return new b(this.rule,this.style,this.id).merge(this)}}function y(e,t){return`f${function(e){let t=5381,n=e.length;for(;n--;)t=33*t^e.charCodeAt(n);return(t>>>0).toString(36)}(e)}`}class v extends p{constructor(e,t){super(t),this.id=e}registerStyle(e){const t=[],n=[],i=c("&",e,t,n),s=y(i);return u(this,i,t,n,`.${s}`,!0),s}registerKeyframes(e){return this.registerHashRule("@keyframes",e)}registerHashRule(e,t){const n=[],i=[],s=c("",t,n,i),r=y(s),o=new b(`${e} ${r}`,"",`h\0${s}\0${e}`);return u(o,s,n,i,"",!1),this.add(o),r}registerRule(e,t){const n=[],i=[];u(this,c(e,t,n,i),n,i,"",!1)}registerCss(e){return this.registerRule("",e)}getStyles(){return f(this.sheet)}clone(){return new v(this.id,this.changes).merge(this)}}function x(e){return new v(`f${(++i).toString(36)}`,e)}},9910:(e,t,n)=>{var i="Expected a function",s="__lodash_placeholder__",r=1,o=2,a=4,l=8,h=16,c=32,u=64,f=128,d=512,p=1/0,m=9007199254740991,g=17976931348623157e292,b=NaN,y=[["ary",f],["bind",r],["bindKey",o],["curry",l],["curryRight",h],["flip",d],["partial",c],["partialRight",u],["rearg",256]],v="[object Function]",x="[object GeneratorFunction]",w="[object Symbol]",k=/^\s+|\s+$/g,S=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,C=/\{\n\/\* \[wrapped with (.+)\] \*/,A=/,? & /,O=/^[-+]0x[0-9a-f]+$/i,M=/^0b[01]+$/i,_=/^\[object .+?Constructor\]$/,T=/^0o[0-7]+$/i,N=/^(?:0|[1-9]\d*)$/,E=parseInt,D="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,P="object"==typeof self&&self&&self.Object===Object&&self,R=D||P||Function("return this")();function j(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function I(e){return e!=e}function L(e,t){for(var n=-1,i=e.length,r=0,o=[];++n2?F:void 0);function Q(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n,i=ce(n=e.prototype)?Y(n):{},s=e.apply(i,t);return ce(s)?s:i}}function ee(e,t,n,i,s,a,c,u,p,m){var g=t&f,b=t&r,y=t&o,v=t&(l|h),x=t&d,w=y?void 0:Q(e);return function r(){for(var o=arguments.length,l=Array(o),h=o;h--;)l[h]=arguments[h];if(v)var f=ne(r),d=function(e,t){for(var n=e.length,i=0;n--;)e[n]===t&&i++;return i}(l,f);if(i&&(l=function(e,t,n,i){for(var s=-1,r=e.length,o=n.length,a=-1,l=t.length,h=J(r-o,0),c=Array(l+h),u=!i;++a1&&l.reverse(),g&&p1?"& ":"")+t[i],t=t.join(n>2?", ":" "),e.replace(S,"{\n/* [wrapped with "+t+"] */\n")}function oe(e,t){return!!(t=null==t?m:t)&&("number"==typeof e||N.test(e))&&e>-1&&e%1==0&&e-1}(e,o)&&e.push(o))););var r,o}(y),e.sort()}function he(e,t,n){var s=function(e,t,n,s,a,f,d,p){var m=t&o;if(!m&&"function"!=typeof e)throw new TypeError(i);var g=s?s.length:0;if(g||(t&=~(c|u),s=a=void 0),d=void 0===d?d:J(ue(d),0),p=void 0===p?p:ue(p),g-=a?a.length:0,t&u){var b=s,y=a;s=a=void 0}var v=[e,t,n,s,a,b,y,f,d,p];if(e=v[0],t=v[1],n=v[2],s=v[3],a=v[4],!(p=v[9]=null==v[9]?m?0:e.length:J(v[9]-g,0))&&t&(l|h)&&(t&=~(l|h)),t&&t!=r)x=t==l||t==h?function(e,t,n){var i=Q(e);return function s(){for(var r=arguments.length,o=Array(r),a=r,l=ne(s);a--;)o[a]=arguments[a];var h=r<3&&o[0]!==l&&o[r-1]!==l?[]:L(o,l);return(r-=h.length){e.exports=function(e){var t={};function n(i){if(t[i])return t[i].exports;var s=t[i]={exports:{},id:i,loaded:!1};return e[i].call(s.exports,s,s.exports,n),s.loaded=!0,s.exports}return n.m=e,n.c=t,n.p="",n(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,s=(i=n(2))&&i.__esModule?i:{default:i};t.default=s.default,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}(e,["activeClassName","activeIndex","activeStyle","autoEscape","caseSensitive","className","findChunks","highlightClassName","highlightStyle","highlightTag","sanitize","searchWords","textToHighlight","unhighlightTag","unhighlightClassName","unhighlightStyle"]),N=(0,r.findAll)({autoEscape:c,caseSensitive:f,findChunks:p,sanitize:w,searchWords:k,textToHighlight:S}),E=x,D=-1,P="",R=void 0,j=(0,l.default)((function(e){var t={};for(var n in e)t[n.toLowerCase()]=e[n];return t}));return(0,a.createElement)("span",i({className:d},T,{children:N.map((function(e,t){var i=S.substr(e.start,e.end-e.start);if(e.highlight){D++;var s;s="object"==typeof g?f?g[i]:(g=j(g))[i.toLowerCase()]:g;var r=D===+o;P=s+" "+(r?n:""),R=!0===r&&null!=h?Object.assign({},y,h):y;var l={children:i,className:P,key:t,style:R};return"string"!=typeof E&&(l.highlightIndex=D),(0,a.createElement)(E,l)}return(0,a.createElement)(A,{children:i,className:M,key:t,style:_})}))}))}h.propTypes={activeClassName:o.default.string,activeIndex:o.default.number,activeStyle:o.default.object,autoEscape:o.default.bool,className:o.default.string,findChunks:o.default.func,highlightClassName:o.default.oneOfType([o.default.object,o.default.string]),highlightStyle:o.default.object,highlightTag:o.default.oneOfType([o.default.node,o.default.func,o.default.string]),sanitize:o.default.func,searchWords:o.default.arrayOf(o.default.oneOfType([o.default.string,o.default.instanceOf(RegExp)])).isRequired,textToHighlight:o.default.string.isRequired,unhighlightTag:o.default.oneOfType([o.default.node,o.default.func,o.default.string]),unhighlightClassName:o.default.string,unhighlightStyle:o.default.object},e.exports=t.default},function(e,t){e.exports=function(e){var t={};function n(i){if(t[i])return t[i].exports;var s=t[i]={exports:{},id:i,loaded:!1};return e[i].call(s.exports,s,s.exports,n),s.loaded=!0,s.exports}return n.m=e,n.c=t,n.p="",n(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(2);Object.defineProperty(t,"combineChunks",{enumerable:!0,get:function(){return i.combineChunks}}),Object.defineProperty(t,"fillInChunks",{enumerable:!0,get:function(){return i.fillInChunks}}),Object.defineProperty(t,"findAll",{enumerable:!0,get:function(){return i.findAll}}),Object.defineProperty(t,"findChunks",{enumerable:!0,get:function(){return i.findChunks}})},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.findAll=function(e){var t=e.autoEscape,r=e.caseSensitive,o=void 0!==r&&r,a=e.findChunks,l=void 0===a?i:a,h=e.sanitize,c=e.searchWords,u=e.textToHighlight;return s({chunksToHighlight:n({chunks:l({autoEscape:t,caseSensitive:o,sanitize:h,searchWords:c,textToHighlight:u})}),totalLength:u?u.length:0})};var n=t.combineChunks=function(e){var t=e.chunks;return t.sort((function(e,t){return e.start-t.start})).reduce((function(e,t){if(0===e.length)return[t];var n=e.pop();if(t.start<=n.end){var i=Math.max(n.end,t.end);e.push({start:n.start,end:i})}else e.push(n,t);return e}),[])},i=function(e){var t=e.autoEscape,n=e.caseSensitive,i=e.sanitize,s=void 0===i?r:i,o=e.searchWords,a=e.textToHighlight;return a=s(a),o.filter((function(e){return e})).reduce((function(e,i){i=s(i),t&&(i=i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"));for(var r=new RegExp(i,n?"g":"gi"),o=void 0;o=r.exec(a);){var l=o.index,h=r.lastIndex;h>l&&e.push({start:l,end:h}),o.index==r.lastIndex&&r.lastIndex++}return e}),[])};t.findChunks=i;var s=t.fillInChunks=function(e){var t=e.chunksToHighlight,n=e.totalLength,i=[],s=function(e,t,n){t-e>0&&i.push({start:e,end:t,highlight:n})};if(0===t.length)s(0,n,!1);else{var r=0;t.forEach((function(e){s(r,e.start,!1),s(e.start,e.end,!0),r=e.end})),s(r,n,!1)}return i};function r(e){return e}}])},function(e,t,n){(function(t){if("production"!==t.env.NODE_ENV){var i="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103;e.exports=n(6)((function(e){return"object"==typeof e&&null!==e&&e.$$typeof===i}),!0)}else e.exports=n(13)()}).call(t,n(5))},function(e,t){var n,i,s=e.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===r||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:r}catch(e){n=r}try{i="function"==typeof clearTimeout?clearTimeout:o}catch(e){i=o}}();var l,h=[],c=!1,u=-1;function f(){c&&l&&(c=!1,l.length?h=l.concat(h):u=-1,h.length&&d())}function d(){if(!c){var e=a(f);c=!0;for(var t=h.length;t;){for(l=h,h=[];++u1)for(var n=1;n1?t-1:0),i=1;i2?n-2:0),r=2;r1&&void 0!==arguments[1]?arguments[1]:n,i=void 0,s=[],r=void 0,o=!1,a=function(e,n){return t(e,s[n])};return function(){for(var t=arguments.length,n=Array(t),l=0;l{"use strict";var i=n(7101),s=Array.prototype.concat,r=Array.prototype.slice,o=e.exports=function(e){for(var t=[],n=0,o=e.length;n{e.exports=function(e){return!(!e||"string"==typeof e)&&(e instanceof Array||Array.isArray(e)||e.length>=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&"String"!==e.constructor.name))}},6823:(e,t,n)=>{"use strict";var i=n(6816);i.TypeStyle,n(4894);var s=n(965);s.extend,s.classes,s.media;var r=new i.TypeStyle({autoGenerateTag:!0});r.setStylesTarget,r.cssRaw,r.cssRule,r.forceRenderStyles,r.fontFace,r.getStyles,r.keyframes,r.reinit,t.iF=r.style,r.stylesheet},1646:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertToStyles=function e(t){var n={};for(var i in t){var s=t[i];if("$nest"===i){var r=s;for(var o in r){var a=r[o];n[o]=e(a)}}else"$debugName"===i?n.$displayName=s:n[i]=s}return n},t.convertToKeyframes=function(e){var t={};for(var n in e)"$debugName"!==n&&(t[n]=e[n]);return e.$debugName&&(t.$displayName=e.$debugName),t}},6816:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(8101),s=n(1646),r=n(965),o=function(){return i.create()},a=function(){function e(e){var t=this,n=e.autoGenerateTag;this.cssRaw=function(e){e&&(t._raw+=e||"",t._pendingRawChange=!0,t._styleUpdated())},this.cssRule=function(e){for(var n=[],i=1;i{"use strict";function n(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},7213:(e,t,n)=>{"use strict";n.d(t,{Ar:()=>h,Bc:()=>F,Gw:()=>M,_5:()=>o,et:()=>l,wm:()=>P});var i=n(4830),s=n(3173),r=n(9587);class o{constructor(e,t,n,i){this.state=e,this.pos=t,this.explicit=n,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=(0,r.mv)(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),i=t.text.slice(n-t.from,this.pos-t.from),s=i.search(function(e,t){var n;let{source:i}=e,s=t&&"^"!=i[0],r="$"!=i[i.length-1];return s||r?new RegExp(`${s?"^":""}(?:${i})${r?"$":""}`,null!==(n=e.flags)&&void 0!==n?n:e.ignoreCase?"i":""):e}(e,!1));return s<0?null:{from:n+s,to:this.pos,text:i.slice(s)}}get aborted(){return null==this.abortListeners}addEventListener(e,t,n){"abort"==e&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function a(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function l(e){let t=e.map((e=>"string"==typeof e?{label:e}:e)),[n,i]=t.every((e=>/^\w+$/.test(e.label)))?[/\w*$/,/\w+$/]:function(e){let t=Object.create(null),n=Object.create(null);for(let{label:i}of e){t[i[0]]=!0;for(let e=1;e{let s=e.matchBefore(i);return s||e.explicit?{from:s?s.from:e.pos,options:t,validFor:n}:null}}function h(e,t){return n=>{for(let t=(0,r.mv)(n.state).resolveInner(n.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(n)}}const c=i.YH.define();"object"==typeof navigator&&navigator.platform;const u=s.Lz.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class f{constructor(e,t,n,i){this.field=e,this.line=t,this.from=n,this.to=i}}class d{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(e){let t=e.mapPos(this.from,-1,i.iR.TrackDel),n=e.mapPos(this.to,1,i.iR.TrackDel);return null==t||null==n?null:new d(this.field,t,n)}}class p{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],i=[t],s=e.doc.lineAt(t),o=/^\s*/.exec(s.text)[0];for(let s of this.lines){if(n.length){let n=o,a=/^\t*/.exec(s)[0].length;for(let t=0;tnew d(e.field,i[e.line]+e.from,i[e.line]+e.to)));return{text:n,ranges:a}}static parse(e){let t,n=[],i=[],s=[];for(let r of e.split(/\r\n?|\n/)){for(;t=/[#$]\{(?:(\d+)(?::([^}]*))?|((?:\\[{}]|[^}])*))\}/.exec(r);){let e=t[1]?+t[1]:null,o=t[2]||t[3]||"",a=-1,l=o.replace(/\\[{}]/g,(e=>e[1]));for(let t=0;t=a&&e.field++}s.push(new f(a,i.length,t.index,t.index+l.length)),r=r.slice(0,t.index)+o+r.slice(t.index+t[0].length)}r=r.replace(/\\([{}])/g,((e,t,n)=>{for(let e of s)e.line==i.length&&e.from>n&&(e.from--,e.to--);return t})),i.push(r)}return new p(i,s)}}let m=s.NZ.widget({widget:new class extends s.xO{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),g=s.NZ.mark({class:"cm-snippetField"});class b{constructor(e,t){this.ranges=e,this.active=t,this.deco=s.NZ.set(e.map((e=>(e.from==e.to?m:g).range(e.from,e.to))))}map(e){let t=[];for(let n of this.ranges){let i=n.map(e);if(!i)return null;t.push(i)}return new b(t,this.active)}selectionInsideField(e){return e.ranges.every((e=>this.ranges.some((t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))))}}const y=i.Pe.define({map:(e,t)=>e&&e.map(t)}),v=i.Pe.define(),x=i.sU.define({create:()=>null,update(e,t){for(let n of t.effects){if(n.is(y))return n.value;if(n.is(v)&&e)return new b(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>s.Lz.decorations.from(e,(e=>e?e.deco:s.NZ.none))});function w(e,t){return i.OF.create(e.filter((e=>e.field==t)).map((e=>i.OF.range(e.from,e.to))))}function k(e){let t=p.parse(e);return(e,n,s,r)=>{let{text:o,ranges:a}=t.instantiate(e.state,s),l={changes:{from:s,to:r,insert:i.EY.of(o)},scrollIntoView:!0,annotations:n?[c.of(n),i.ZX.userEvent.of("input.complete")]:void 0};if(a.length&&(l.selection=w(a,0)),a.some((e=>e.field>0))){let t=new b(a,0),n=l.effects=[y.of(t)];void 0===e.state.field(x,!1)&&n.push(i.Pe.appendConfig.of([x,O,_,u]))}e.dispatch(e.state.update(l))}}function S(e){return({state:t,dispatch:n})=>{let i=t.field(x,!1);if(!i||e<0&&0==i.active)return!1;let s=i.active+e,r=e>0&&!i.ranges.some((t=>t.field==s+e));return n(t.update({selection:w(i.ranges,s),effects:y.of(r?null:new b(i.ranges,s)),scrollIntoView:!0})),!0}}const C=[{key:"Tab",run:S(1),shift:S(-1)},{key:"Escape",run:({state:e,dispatch:t})=>!!e.field(x,!1)&&(t(e.update({effects:y.of(null)})),!0)}],A=i.sj.define({combine:e=>e.length?e[0]:C}),O=i.Nb.highest(s.w4.compute([A],(e=>e.facet(A))));function M(e,t){return Object.assign(Object.assign({},t),{apply:k(e)})}const _=s.Lz.domEventHandlers({mousedown(e,t){let n,i=t.state.field(x,!1);if(!i||null==(n=t.posAtCoords({x:e.clientX,y:e.clientY})))return!1;let s=i.ranges.find((e=>e.from<=n&&e.to>=n));return!(!s||s.field==i.active||(t.dispatch({selection:w(i.ranges,s.field),effects:y.of(i.ranges.some((e=>e.field>s.field))?new b(i.ranges,s.field):null),scrollIntoView:!0}),0))}}),T={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},N=i.Pe.define({map(e,t){let n=t.mapPos(e,-1,i.iR.TrackAfter);return null==n?void 0:n}}),E=new class extends i.FB{};E.startSide=1,E.endSide=-1;const D=i.sU.define({create:()=>i.om.empty,update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(N)&&(e=e.update({add:[E.range(n.value,n.value+1)]}));return e}});function P(){return[B,D]}const R="()[]{}<>";function j(e){for(let t=0;t<8;t+=2)if(R.charCodeAt(t)==e)return R.charAt(t+1);return(0,i.MK)(e<128?e:e+1)}function I(e,t){return e.languageDataAt("closeBrackets",t)[0]||T}const L="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),B=s.Lz.inputHandler.of(((e,t,n,s)=>{if((L?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let r=e.state.selection.main;if(s.length>2||2==s.length&&1==(0,i.Fh)((0,i.vS)(s,0))||t!=r.from||n!=r.to)return!1;let o=function(e,t){let n=I(e,e.selection.main.head),s=n.brackets||T.brackets;for(let r of s){let o=j((0,i.vS)(r,0));if(t==r)return o==r?V(e,r,s.indexOf(r+r+r)>-1,n):H(e,r,o,n.before||T.before);if(t==o&&z(e,e.selection.main.from))return q(e,0,o)}return null}(e.state,s);return!!o&&(e.dispatch(o),!0)})),F=[{key:"Backspace",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=I(e,e.selection.main.head).brackets||T.brackets,s=null,r=e.changeByRange((t=>{if(t.empty){let s=function(e,t){let n=e.sliceString(t-2,t);return(0,i.Fh)((0,i.vS)(n,0))==n.length?n:n.slice(1)}(e.doc,t.head);for(let r of n)if(r==s&&$(e.doc,t.head)==j((0,i.vS)(r,0)))return{changes:{from:t.head-r.length,to:t.head+r.length},range:i.OF.cursor(t.head-r.length)}}return{range:s=t}}));return s||t(e.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!s}}];function z(e,t){let n=!1;return e.field(D).between(0,e.doc.length,(e=>{e==t&&(n=!0)})),n}function $(e,t){let n=e.sliceString(t,t+2);return n.slice(0,(0,i.Fh)((0,i.vS)(n,0)))}function H(e,t,n,s){let r=null,o=e.changeByRange((o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:n,from:o.to}],effects:N.of(o.to+t.length),range:i.OF.range(o.anchor+t.length,o.head+t.length)};let a=$(e.doc,o.head);return!a||/\s/.test(a)||s.indexOf(a)>-1?{changes:{insert:t+n,from:o.head},effects:N.of(o.head+t.length),range:i.OF.cursor(o.head+t.length)}:{range:r=o}}));return r?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function q(e,t,n){let s=null,r=e.changeByRange((t=>t.empty&&$(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:i.OF.cursor(t.head+n.length)}:s={range:t}));return s?null:e.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function V(e,t,n,s){let o=s.stringPrefixes||T.stringPrefixes,a=null,l=e.changeByRange((s=>{if(!s.empty)return{changes:[{insert:t,from:s.from},{insert:t,from:s.to}],effects:N.of(s.to+t.length),range:i.OF.range(s.anchor+t.length,s.head+t.length)};let l,h=s.head,c=$(e.doc,h);if(c==t){if(W(e,h))return{changes:{insert:t+t,from:h},effects:N.of(h+t.length),range:i.OF.cursor(h+t.length)};if(z(e,h)){let s=n&&e.sliceDoc(h,h+3*t.length)==t+t+t?t+t+t:t;return{changes:{from:h,to:h+s.length,insert:s},range:i.OF.cursor(h+s.length)}}}else{if(n&&e.sliceDoc(h-2*t.length,h)==t+t&&(l=G(e,h-2*t.length,o))>-1&&W(e,l))return{changes:{insert:t+t+t+t,from:h},effects:N.of(h+t.length),range:i.OF.cursor(h+t.length)};if(e.charCategorizer(h)(c)!=i.Je.Word&&G(e,h,o)>-1&&!function(e,t,n,i){let s=(0,r.mv)(e).resolveInner(t,-1),o=i.reduce(((e,t)=>Math.max(e,t.length)),0);for(let r=0;r<5;r++){let r=e.sliceDoc(s.from,Math.min(s.to,s.from+n.length+o)),a=r.indexOf(n);if(!a||a>-1&&i.indexOf(r.slice(0,a))>-1){let t=s.firstChild;for(;t&&t.from==s.from&&t.to-t.from>n.length+a;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let l=s.to==t&&s.parent;if(!l)break;s=l}return!1}(e,h,t,o))return{changes:{insert:t+t,from:h},effects:N.of(h+t.length),range:i.OF.cursor(h+t.length)}}return{range:a=s}}));return a?null:e.update(l,{scrollIntoView:!0,userEvent:"input.type"})}function W(e,t){let n=(0,r.mv)(e).resolveInner(t+1);return n.parent&&n.from==t}function G(e,t,n){let s=e.charCategorizer(t);if(s(e.sliceDoc(t-1,t))!=i.Je.Word)return t;for(let r of n){let n=t-r.length;if(e.sliceDoc(n,t)==r&&s(e.sliceDoc(n-1,n))!=i.Je.Word)return n}return-1}},9587:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>F,EI:()=>N,KB:()=>D,Lv:()=>ce,Oh:()=>P,Q0:()=>u,Q_:()=>Te,SG:()=>_e,TM:()=>f,Tg:()=>Be,WD:()=>V,Xt:()=>_,Yy:()=>A,Zt:()=>ve,_Y:()=>$,_v:()=>E,b_:()=>G,bj:()=>p,cr:()=>fe,iB:()=>h,jU:()=>De,mv:()=>m,mz:()=>H,nq:()=>y,p9:()=>c,t:()=>W,t$:()=>O,tp:()=>T,y9:()=>ge,yd:()=>U});var i,s=n(9066),r=n(4830),o=n(3173),a=n(9913),l=n(8104);const h=new s.uY;function c(e){return r.sj.define({combine:e?t=>t.concat(e):void 0})}const u=new s.uY;class f{constructor(e,t,n=[],i=""){this.data=e,this.name=i,r.$t.prototype.hasOwnProperty("tree")||Object.defineProperty(r.$t.prototype,"tree",{get(){return m(this)}}),this.parser=t,this.extension=[C.of(this),r.$t.languageData.of(((e,t,n)=>{let i=d(e,t,n),s=i.type.prop(h);if(!s)return[];let r=e.facet(s),o=i.type.prop(u);if(o){let s=i.resolve(t-i.from,n);for(let t of o)if(t.test(s,e)){let n=e.facet(t.facet);return"replace"==t.type?n:n.concat(r)}}return r}))].concat(n)}isActiveAt(e,t,n=-1){return d(e,t,n).type.prop(h)==this.data}findRegions(e){let t=e.facet(C);if((null==t?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],i=(e,t)=>{if(e.prop(h)==this.data)return void n.push({from:t,to:t+e.length});let r=e.prop(s.uY.mounted);if(r){if(r.tree.prop(h)==this.data){if(r.overlay)for(let e of r.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(r.overlay){let e=n.length;if(i(r.tree,r.overlay[0].from+t),n.length>e)return}}for(let n=0;ne.isTop?t:void 0))]}),e.name)}configure(e,t){return new p(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function m(e){let t=e.field(f.state,!1);return t?t.tree:s.PH.empty}class g{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let b=null;class y{constructor(e,t,n=[],i,s,r,o,a){this.parser=e,this.state=t,this.fragments=n,this.tree=i,this.treeLen=s,this.viewport=r,this.skipped=o,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new y(e,t,[],s.PH.empty,0,n,[],null)}startParse(){return this.parser.startParse(new g(this.state.doc),this.fragments)}work(e,t){return null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=s.PH.empty&&this.isDone(null!=t?t:this.state.doc.length)?(this.takeTree(),!0):this.withContext((()=>{var n;if("number"==typeof e){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||(this.parse=this.startParse()),null!=t&&(null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&t=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext((()=>{for(;!(t=this.parse.advance()););})),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(s.rr.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=b;b=this;try{return e()}finally{b=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=v(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:i,treeLen:r,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let t=[];if(e.iterChangedRanges(((e,n,i,s)=>t.push({fromA:e,toA:n,fromB:i,toB:s}))),n=s.rr.applyChanges(n,t),i=s.PH.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let t of this.skipped){let n=e.mapPos(t.from,1),i=e.mapPos(t.to,-1);ne.from&&(this.fragments=v(this.fragments,n,i),this.skipped.splice(t--,1))}return!(this.skipped.length>=t||(this.reset(),0))}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends s.iX{createParse(t,n,i){let r=i[0].from,o=i[i.length-1].to;return{parsedPos:r,advance(){let t=b;if(t){for(let e of i)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=o,new s.PH(s.Z6.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&0==t[0].from&&t[0].to>=e}static get(){return b}}function v(e,t,n){return s.rr.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class x{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new x(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=y.create(e.facet(C).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new x(n)}}f.state=r.sU.define({create:x.init,update(e,t){for(let e of t.effects)if(e.is(f.setState))return e.value;return t.startState.facet(C)!=t.state.facet(C)?x.init(t.state):e.apply(t)}});let w=e=>{let t=setTimeout((()=>e()),500);return()=>clearTimeout(t)};"undefined"!=typeof requestIdleCallback&&(w=e=>{let t=-1,n=setTimeout((()=>{t=requestIdleCallback(e,{timeout:400})}),100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const k="undefined"!=typeof navigator&&(null===(i=navigator.scheduling)||void 0===i?void 0:i.isInputPending)?()=>navigator.scheduling.isInputPending():null,S=o.Z9.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(f.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(f.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=w(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEndi+1e3,a=s.context.work((()=>k&&k()||Date.now()>r),i+(o?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:f.setState.of(new x(s.context))})),this.chunkBudget>0&&(!a||o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then((()=>this.scheduleWork())).catch((e=>(0,o.c_)(this.view.state,e))).then((()=>this.workScheduled--)),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),C=r.sj.define({combine:e=>e.length?e[0]:null,enables:e=>[f.state,S,o.Lz.contentAttributes.compute([e],(t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}}))]});class A{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}class O{constructor(e,t,n,i,s,r=void 0){this.name=e,this.alias=t,this.extensions=n,this.filename=i,this.loadFunc=s,this.support=r,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then((e=>this.support=e),(e=>{throw this.loading=null,e})))}static of(e){let{load:t,support:n}=e;if(!t){if(!n)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");t=()=>Promise.resolve(n)}return new O(e.name,(e.alias||[]).concat(e.name).map((e=>e.toLowerCase())),e.extensions||[],e.filename,t,n)}static matchFilename(e,t){for(let n of e)if(n.filename&&n.filename.test(t))return n;let n=/\.([^.]+)$/.exec(t);if(n)for(let t of e)if(t.extensions.indexOf(n[1])>-1)return t;return null}static matchLanguageName(e,t,n=!0){t=t.toLowerCase();for(let n of e)if(n.alias.some((e=>e==t)))return n;if(n)for(let n of e)for(let e of n.alias){let i=t.indexOf(e);if(i>-1&&(e.length>2||!/\w/.test(t[i-1])&&!/\w/.test(t[i+e.length])))return n}return null}}const M=r.sj.define(),_=r.sj.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some((e=>e!=t[0])))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function T(e){let t=e.facet(_);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function N(e,t){let n="",i=e.tabSize,s=e.facet(_)[0];if("\t"==s){for(;t>=i;)n+="\t",t-=i;s=" "}for(let e=0;e=t?function(e,t,n){let i=t.resolveStack(n),s=i.node.enterUnfinishedNodesBefore(n);if(s!=i.node){let e=[];for(let t=s;t!=i.node;t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)i={node:e[t],next:i}}return R(i,e,n)}(e,n,t):null}class D{constructor(e,t={}){this.state=e,this.options=t,this.unit=T(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return null!=i&&i>=n.from&&i<=n.to?s&&i==e?{text:"",from:e}:(t<0?i-1&&(s+=r-this.countColumn(n,n.search(/\S|$/))),s}countColumn(e,t=e.length){return(0,r.y$)(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:i}=this.lineAt(e,t),s=this.options.overrideIndentation;if(s){let e=s(i);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const P=new s.uY;function R(e,t,n){for(let i=e;i;i=i.next){let e=j(i.node);if(e)return e(L.create(t,n,i))}return 0}function j(e){let t=e.type.prop(P);if(t)return t;let n,i=e.firstChild;if(i&&(n=i.type.prop(s.uY.closedBy))){let t=e.lastChild,i=t&&n.indexOf(t.name)>-1;return e=>z(e,!0,1,void 0,i&&!function(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}(e)?t.from:void 0)}return null==e.parent?I:null}function I(){return 0}class L extends D{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new L(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(B(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return R(this.context.next,this.base,this.pos)}}function B(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function F({closing:e,align:t=!0,units:n=1}){return i=>z(i,t,n,e)}function z(e,t,n,i,s){let r=e.textAfter,o=r.match(/^\s*/)[0].length,a=i&&r.slice(o,o+i.length)==i||s==e.pos+o,l=t?function(e){let t=e.node,n=t.childAfter(t.from),i=t.lastChild;if(!n)return null;let s=e.options.simulateBreak,r=e.state.doc.lineAt(n.from),o=null==s||s<=r.from?r.to:Math.min(r.to,s);for(let e=n.to;;){let s=t.childAfter(e);if(!s||s==i)return null;if(!s.type.isSkipped)return s.frome.baseIndent;function H({except:e,units:t=1}={}){return n=>{let i=e&&e.test(n.textAfter);return n.baseIndent+(i?0:t*n.unit)}}const q=200;function V(){return r.$t.transactionFilter.of((e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:i}=e.newSelection.main,s=n.lineAt(i);if(i>s.from+q)return e;let r=n.sliceString(s.from,i);if(!t.some((e=>e.test(r))))return e;let{state:o}=e,a=-1,l=[];for(let{head:e}of o.selection.ranges){let t=o.doc.lineAt(e);if(t.from==a)continue;a=t.from;let n=E(o,t.from);if(null==n)continue;let i=/^\s*/.exec(t.text)[0],s=N(o,n);i!=s&&l.push({from:t.from,to:t.from+i.length,insert:s})}return l.length?[e,{changes:l,sequential:!0}]:e}))}const W=r.sj.define(),G=new s.uY;function U(e){let t=e.firstChild,n=e.lastChild;return t&&t.ton)continue;if(s&&o.from=t&&i.to>n&&(s=i)}}return s}(e,t,n)}function J(e,t){let n=t.mapPos(e.from,1),i=t.mapPos(e.to,-1);return n>=i?void 0:{from:n,to:i}}const X=r.Pe.define({map:J}),Z=r.Pe.define({map:J}),Q=r.sU.define({create:()=>o.NZ.none,update(e,t){e=e.map(t.changes);for(let n of t.effects)if(n.is(X)&&!te(e,n.value.from,n.value.to)){let{preparePlaceholder:i}=t.state.facet(ie),s=i?o.NZ.replace({widget:new ae(i(t.state,n.value))}):oe;e=e.update({add:[s.range(n.value.from,n.value.to)]})}else n.is(Z)&&(e=e.update({filter:(e,t)=>n.value.from!=e||n.value.to!=t,filterFrom:n.value.from,filterTo:n.value.to}));if(t.selection){let n=!1,{head:i}=t.selection.main;e.between(i,i,((e,t)=>{ei&&(n=!0)})),n&&(e=e.update({filterFrom:i,filterTo:i,filter:(e,t)=>t<=i||e>=i}))}return e},provide:e=>o.Lz.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,((e,t)=>{n.push(e,t)})),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let n=0;n{(!s||s.from>e)&&(s={from:e,to:t})})),s}function te(e,t,n){let i=!1;return e.between(t,t,((e,s)=>{e==t&&s==n&&(i=!0)})),i}const ne={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},ie=r.sj.define({combine:e=>(0,r.QR)(e,ne)});function se(e){let t=[Q,ue];return e&&t.push(ie.of(e)),t}function re(e,t){let{state:n}=e,i=n.facet(ie),s=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),i=ee(e.state,n.from,n.to);i&&e.dispatch({effects:Z.of(i)}),t.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(e,s,t);let r=document.createElement("span");return r.textContent=i.placeholderText,r.setAttribute("aria-label",n.phrase("folded code")),r.title=n.phrase("unfold"),r.className="cm-foldPlaceholder",r.onclick=s,r}const oe=o.NZ.replace({widget:new class extends o.xO{toDOM(e){return re(e,null)}}});class ae extends o.xO{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return re(e,this.value)}}const le={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class he extends o.wJ{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function ce(e={}){let t=Object.assign(Object.assign({},le),e),n=new he(t,!0),i=new he(t,!1),s=o.Z9.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(C)!=e.state.facet(C)||e.startState.field(Q,!1)!=e.state.field(Q,!1)||m(e.startState)!=m(e.state)||t.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let t=new r.vB;for(let s of e.viewportLineBlocks){let r=ee(e.state,s.from,s.to)?i:Y(e.state,s.from,s.to)?n:null;r&&t.add(s.from,s.from,r)}return t.finish()}}),{domEventHandlers:a}=t;return[s,(0,o.cU)({class:"cm-foldGutter",markers(e){var t;return(null===(t=e.plugin(s))||void 0===t?void 0:t.markers)||r.om.empty},initialSpacer:()=>new he(t,!1),domEventHandlers:Object.assign(Object.assign({},a),{click:(e,t,n)=>{if(a.click&&a.click(e,t,n))return!0;let i=ee(e.state,t.from,t.to);if(i)return e.dispatch({effects:Z.of(i)}),!0;let s=Y(e.state,t.from,t.to);return!!s&&(e.dispatch({effects:X.of(s)}),!0)}})}),se()]}const ue=o.Lz.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class fe{constructor(e,t){let n;function i(e){let t=l.G.newName();return(n||(n=Object.create(null)))["."+t]=e,t}this.specs=e;const s="string"==typeof t.all?t.all:t.all?i(t.all):void 0,r=t.scope;this.scope=r instanceof f?e=>e.prop(h)==r.data:r?e=>e==r:void 0,this.style=(0,a.az)(e.map((e=>({tag:e.tag,class:e.class||i(Object.assign({},e,{tag:null}))}))),{all:s}).style,this.module=n?new l.G(n):null,this.themeType=t.themeType}static define(e,t){return new fe(e,t||{})}}const de=r.sj.define(),pe=r.sj.define({combine:e=>e.length?[e[0]]:null});function me(e){let t=e.facet(de);return t.length?t:e.facet(pe)}function ge(e,t){let n,i=[ye];return e instanceof fe&&(e.module&&i.push(o.Lz.styleModule.of(e.module)),n=e.themeType),(null==t?void 0:t.fallback)?i.push(pe.of(e)):n?i.push(de.computeN([o.Lz.darkTheme],(t=>t.facet(o.Lz.darkTheme)==("dark"==n)?[e]:[]))):i.push(de.of(e)),i}class be{constructor(e){this.markCache=Object.create(null),this.tree=m(e.state),this.decorations=this.buildDeco(e,me(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=m(e.state),n=me(e.state),i=n!=me(e.startState),{viewport:s}=e.view,r=e.changes.mapPos(this.decoratedTo,1);t.length=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=r):(t!=this.tree||e.viewportChanged||i)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=s.to)}buildDeco(e,t){if(!t||!this.tree.length)return o.NZ.none;let n=new r.vB;for(let{from:i,to:s}of e.visibleRanges)(0,a.DM)(this.tree,t,((e,t,i)=>{n.add(e,t,this.markCache[i]||(this.markCache[i]=o.NZ.mark({class:i})))}),i,s);return n.finish()}}const ye=r.Nb.high(o.Z9.fromClass(be,{decorations:e=>e.decorations})),ve=fe.define([{tag:a._A.meta,color:"#404740"},{tag:a._A.link,textDecoration:"underline"},{tag:a._A.heading,textDecoration:"underline",fontWeight:"bold"},{tag:a._A.emphasis,fontStyle:"italic"},{tag:a._A.strong,fontWeight:"bold"},{tag:a._A.strikethrough,textDecoration:"line-through"},{tag:a._A.keyword,color:"#708"},{tag:[a._A.atom,a._A.bool,a._A.url,a._A.contentSeparator,a._A.labelName],color:"#219"},{tag:[a._A.literal,a._A.inserted],color:"#164"},{tag:[a._A.string,a._A.deleted],color:"#a11"},{tag:[a._A.regexp,a._A.escape,a._A.special(a._A.string)],color:"#e40"},{tag:a._A.definition(a._A.variableName),color:"#00f"},{tag:a._A.local(a._A.variableName),color:"#30a"},{tag:[a._A.typeName,a._A.namespace],color:"#085"},{tag:a._A.className,color:"#167"},{tag:[a._A.special(a._A.variableName),a._A.macroName],color:"#256"},{tag:a._A.definition(a._A.propertyName),color:"#00c"},{tag:a._A.comment,color:"#940"},{tag:a._A.invalid,color:"#f00"}]),xe=o.Lz.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),we=1e4,ke="()[]{}",Se=r.sj.define({combine:e=>(0,r.QR)(e,{afterCursor:!0,brackets:ke,maxScanDistance:we,renderMatch:Oe})}),Ce=o.NZ.mark({class:"cm-matchingBracket"}),Ae=o.NZ.mark({class:"cm-nonmatchingBracket"});function Oe(e){let t=[],n=e.matched?Ce:Ae;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}const Me=[r.sU.define({create:()=>o.NZ.none,update(e,t){if(!t.docChanged&&!t.selection)return e;let n=[],i=t.state.facet(Se);for(let e of t.state.selection.ranges){if(!e.empty)continue;let s=De(t.state,e.head,-1,i)||e.head>0&&De(t.state,e.head-1,1,i)||i.afterCursor&&(De(t.state,e.head,1,i)||e.heado.Lz.decorations.from(e)}),xe];function _e(e={}){return[Se.of(e),Me]}const Te=new s.uY;function Ne(e,t,n){let i=e.prop(t<0?s.uY.openedBy:s.uY.closedBy);if(i)return i;if(1==e.name.length){let i=n.indexOf(e.name);if(i>-1&&i%2==(t<0?1:0))return[n[i+t]]}return null}function Ee(e){let t=e.type.prop(Te);return t?t(e.node):e}function De(e,t,n,i={}){let s=i.maxScanDistance||we,r=i.brackets||ke,o=m(e),a=o.resolveInner(t,n);for(let e=a;e;e=e.parent){let i=Ne(e.type,n,r);if(i&&e.from0?t>=s.from&&ts.from&&t<=s.to))return Pe(0,0,n,e,s,i,r)}}return function(e,t,n,i,s,r,o){let a=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),l=o.indexOf(a);if(l<0||l%2==0!=n>0)return null;let h={from:n<0?t-1:t,to:n>0?t+1:t},c=e.doc.iterRange(t,n>0?e.doc.length:0),u=0;for(let e=0;!c.next().done&&e<=r;){let r=c.value;n<0&&(e+=r.length);let a=t+e*n;for(let e=n>0?0:r.length-1,t=n>0?r.length:-1;e!=t;e+=n){let t=o.indexOf(r[e]);if(!(t<0||i.resolveInner(a+e,1).type!=s))if(t%2==0==n>0)u++;else{if(1==u)return{start:h,end:{from:a+e,to:a+e+1},matched:t>>1==l>>1};u--}}n>0&&(e+=r.length)}return c.done?{start:h,matched:!1}:null}(e,t,n,o,a.type,s,r)}function Pe(e,t,n,i,s,r,o){let a=i.parent,l={from:s.from,to:s.to},h=0,c=null==a?void 0:a.cursor();if(c&&(n<0?c.childBefore(i.from):c.childAfter(i.to)))do{if(n<0?c.to<=i.from:c.from>=i.to){if(0==h&&r.indexOf(c.type.name)>-1&&c.from=this.string.length}sol(){return 0==this.pos}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.post}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosn?e.toLowerCase():e;return i(this.string.substr(this.pos,e.length))==i(e)?(!1!==t&&(this.pos+=e.length),!0):null}{let n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&!1!==t&&(this.pos+=n[0].length),n)}}current(){return this.string.slice(this.start,this.pos)}}function Ie(e){if("object"!=typeof e)return e;let t={};for(let n in e){let i=e[n];t[n]=i instanceof Array?i.slice():i}return t}const Le=new WeakMap;class Be extends f{constructor(e){let t,n=c(e.languageData),i={name:(r=e).name||"",token:r.token,blankLine:r.blankLine||(()=>{}),startState:r.startState||(()=>!0),copyState:r.copyState||Ie,indent:r.indent||(()=>null),languageData:r.languageData||{},tokenTable:r.tokenTable||qe};var r;super(n,new class extends s.iX{createParse(e,n,i){return new $e(t,e,n,i)}},[M.of(((e,t)=>this.getIndent(e,t)))],e.name),this.topNode=function(e){let t=s.Z6.define({id:Ve.length,name:"Document",props:[h.add((()=>e))],top:!0});return Ve.push(t),t}(n),t=this,this.streamParser=i,this.stateAfter=new s.uY({perNode:!0}),this.tokenTable=e.tokenTable?new Ye(i.tokenTable):Je}static define(e){return new Be(e)}getIndent(e,t){let n,i=m(e.state),s=i.resolve(t);for(;s&&s.type!=this.topNode;)s=s.parent;if(!s)return null;let{overrideIndentation:r}=e.options;r&&(n=Le.get(e.state),null!=n&&n1e4)return null;for(;o=i&&n+t.length<=r&&t.prop(e.stateAfter);if(o)return{state:e.streamParser.copyState(o),pos:n+t.length};for(let o=t.children.length-1;o>=0;o--){let a=t.children[o],l=n+t.positions[o],h=a instanceof s.PH&&l=t.length)return t;r||t.type!=e.topNode||(r=!0);for(let o=t.children.length-1;o>=0;o--){let a,l=t.positions[o],h=t.children[o];if(ln&&Fe(e,i.tree,0-i.offset,n,r);if(o&&(t=ze(e,i.tree,n+i.offset,o.pos+i.offset,!1)))return{state:o.state,tree:t}}return{state:e.streamParser.startState(i?T(i):4),tree:s.PH.empty}}(e,n,o,null==r?void 0:r.state);this.state=a,this.parsedPos=this.chunkStart=o+l.length;for(let e=0;e=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)"\n"==t&&(t="");else{let e=t.indexOf("\n");e>-1&&(t=t.slice(0,e))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),n=e+t.length;for(let e=this.rangeIndex;;){let i=this.ranges[e].to;if(i>=n)break;if(t=t.slice(0,i-(n-t.length)),e++,e==this.ranges.length)break;let s=this.ranges[e].from,r=this.lineAfter(s);t+=r,n=s+r.length}return{line:t,end:n}}skipGapsTo(e,t,n){for(;;){let i=this.ranges[this.rangeIndex].to,s=e+t;if(n>0?i>s:i>=s)break;t+=this.ranges[++this.rangeIndex].from-i}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){t+=s=this.skipGapsTo(t,s,1);let e=this.chunk.length;n+=s=this.skipGapsTo(n,s,-1),i+=this.chunk.length-e}return this.chunk.push(e,t,n,i),s}parseLine(e){let{line:t,end:n}=this.nextLine(),i=0,{streamParser:s}=this.lang,r=new je(t,e?e.state.tabSize:4,e?T(e.state):2);if(r.eol())s.blankLine(this.state,r.indentUnit);else for(;!r.eol();){let e=He(s.token,r,this.state);if(e&&(i=this.emitToken(this.lang.tokenTable.resolve(e),this.parsedPos+r.start,this.parsedPos+r.pos,4,i)),r.start>1e4)break}this.parsedPos=n,this.moveRangeIndex(),this.parsedPost.start)return i}throw new Error("Stream parser failed to advance stream.")}const qe=Object.create(null),Ve=[s.Z6.none],We=new s.fI(Ve),Ge=[],Ue=Object.create(null),Ke=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Ke[e]=Ze(qe,t);class Ye{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),Ke)}resolve(e){return e?this.table[e]||(this.table[e]=Ze(this.extra,e)):0}}const Je=new Ye(qe);function Xe(e,t){Ge.indexOf(e)>-1||(Ge.push(e),console.warn(t))}function Ze(e,t){let n=[];for(let i of t.split(" ")){let t=[];for(let n of i.split(".")){let i=e[n]||a._A[n];i?"function"==typeof i?t.length?t=t.map(i):Xe(n,`Modifier ${n} used at start of tag`):t.length?Xe(n,`Tag ${n} used as modifier`):t=Array.isArray(i)?i:[i]:Xe(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let i=t.replace(/ /g,"_"),r=i+" "+n.map((e=>e.id)),o=Ue[r];if(o)return o.id;let l=Ue[r]=s.Z6.define({id:Ve.length,name:i,props:[(0,a.pn)({[i]:n})]});return Ve.push(l),l.id}o.OP.RTL,o.OP.LTR},4830:(e,t,n)=>{"use strict";n.d(t,{$t:()=>ke,EY:()=>i,FB:()=>Ce,Fh:()=>C,Gu:()=>M,Je:()=>ve,MK:()=>S,Nb:()=>K,OF:()=>I,Pe:()=>ue,QR:()=>Se,VR:()=>_,YH:()=>le,ZX:()=>fe,iR:()=>O,kn:()=>$e,om:()=>_e,sU:()=>G,sj:()=>F,vB:()=>Te,vS:()=>k,xx:()=>J,y$:()=>ze,zK:()=>b});class i{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=f(this,e,t);let i=[];return this.decompose(0,e,i,2),n.length&&n.decompose(0,n.length,i,3),this.decompose(t,this.length,i,1),r.from(i,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=f(this,e,t);let n=[];return this.decompose(e,t,n,0),r.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),i=new l(this),s=new l(e);for(let e=t,r=t;;){if(i.next(e),s.next(e),e=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(r+=i.value.length,i.done||r>=n)return!0}}iter(e=1){return new l(this,e)}iterRange(e,t=this.length){return new h(this,e,t)}iterLines(e,t){let n;if(null==e)n=this.iter();else{null==t&&(t=this.lines+1);let i=this.line(e).from;n=this.iterRange(i,Math.max(i,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new c(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(0==e.length)throw new RangeError("A document must have at least one line");return 1!=e.length||e[0]?e.length<=32?new s(e):r.from(s.split(e,[])):i.empty}}class s extends i{constructor(e,t=function(e){let t=-1;for(let n of e)t+=n.length+1;return t}(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,i){for(let s=0;;s++){let r=this.text[s],o=i+r.length;if((t?n:o)>=e)return new u(i,o,n,r);i=o+1,n++}}decompose(e,t,n,i){let r=e<=0&&t>=this.length?this:new s(a(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(1&i){let e=n.pop(),t=o(r.text,e.text.slice(),0,r.length);if(t.length<=32)n.push(new s(t,e.length+r.length));else{let e=t.length>>1;n.push(new s(t.slice(0,e)),new s(t.slice(e)))}}else n.push(r)}replace(e,t,n){if(!(n instanceof s))return super.replace(e,t,n);[e,t]=f(this,e,t);let i=o(this.text,o(n.text,a(this.text,0,e)),t),l=this.length+n.length-(t-e);return i.length<=32?new s(i,l):r.from(s.split(i,[]),l)}sliceString(e,t=this.length,n="\n"){[e,t]=f(this,e,t);let i="";for(let s=0,r=0;s<=t&&re&&r&&(i+=n),es&&(i+=o.slice(Math.max(0,e-s),t-s)),s=a+1}return i}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],i=-1;for(let r of e)n.push(r),i+=r.length+1,32==n.length&&(t.push(new s(n,i)),n=[],i=-1);return i>-1&&t.push(new s(n,i)),t}}class r extends i{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,i){for(let s=0;;s++){let r=this.children[s],o=i+r.length,a=n+r.lines-1;if((t?a:o)>=e)return r.lineInner(e,t,n,i);i=o+1,n=a+1}}decompose(e,t,n,i){for(let s=0,r=0;r<=t&&s=r){let s=i&((r<=e?1:0)|(a>=t?2:0));r>=e&&a<=t&&!s?n.push(o):o.decompose(e-r,t-r,n,s)}r=a+1}}replace(e,t,n){if([e,t]=f(this,e,t),n.lines=s&&t<=a){let l=o.replace(e-s,t-s,n),h=this.lines-o.lines+l.lines;if(l.lines>4&&l.lines>h>>6){let s=this.children.slice();return s[i]=l,new r(s,this.length-(t-e)+n.length)}return super.replace(s,a,l)}s=a+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n="\n"){[e,t]=f(this,e,t);let i="";for(let s=0,r=0;se&&s&&(i+=n),er&&(i+=o.sliceString(e-r,t-r,n)),r=a+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof r))return 0;let n=0,[i,s,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,s+=t){if(i==o||s==a)return n;let r=this.children[i],l=e.children[s];if(r!=l)return n+r.scanIdentical(l,t);n+=r.length+1}}static from(e,t=e.reduce(((e,t)=>e+t.length+1),-1)){let n=0;for(let t of e)n+=t.lines;if(n<32){let n=[];for(let t of e)t.flatten(n);return new s(n,t)}let i=Math.max(32,n>>5),o=i<<1,a=i>>1,l=[],h=0,c=-1,u=[];function f(e){let t;if(e.lines>o&&e instanceof r)for(let t of e.children)f(t);else e.lines>a&&(h>a||!h)?(d(),l.push(e)):e instanceof s&&h&&(t=u[u.length-1])instanceof s&&e.lines+t.lines<=32?(h+=e.lines,c+=e.length+1,u[u.length-1]=new s(t.text.concat(e.text),t.length+1+e.length)):(h+e.lines>i&&d(),h+=e.lines,c+=e.length+1,u.push(e))}function d(){0!=h&&(l.push(1==u.length?u[0]:r.from(u,c)),c=-1,h=u.length=0)}for(let t of e)f(t);return d(),1==l.length?l[0]:new r(l,t)}}function o(e,t,n=0,i=1e9){for(let s=0,r=0,o=!0;r=n&&(l>i&&(a=a.slice(0,i-s)),s0?1:(e instanceof s?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,i=this.nodes[n],r=this.offsets[n],o=r>>1,a=i instanceof s?i.text.length:i.children.length;if(o==(t>0?a:0)){if(0==n)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&r)==(t>0?0:1)){if(this.offsets[n]+=t,0==e)return this.lineBreak=!0,this.value="\n",this;e--}else if(i instanceof s){let s=i.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,s.length>Math.max(0,e))return this.value=0==e?s:t>0?s.slice(e):s.slice(0,s.length-e),this;e-=s.length}else{let r=i.children[o+(t<0?-1:0)];e>r.length?(e-=r.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(r),this.offsets.push(t>0?1:(r instanceof s?r.text.length:r.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class h{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new l(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=n?i:t<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class c{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:i}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(i.prototype[Symbol.iterator]=function(){return this.iter()},l.prototype[Symbol.iterator]=h.prototype[Symbol.iterator]=c.prototype[Symbol.iterator]=function(){return this});class u{constructor(e,t,n,i){this.from=e,this.to=t,this.number=n,this.text=i}get length(){return this.to-this.from}}function f(e,t,n){return[t=Math.max(0,Math.min(e.length,t)),Math.max(t,Math.min(e.length,n))]}let d="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((e=>e?parseInt(e,36):1));for(let e=1;ee)return d[t-1]<=e;return!1}function m(e){return e>=127462&&e<=127487}const g=8205;function b(e,t,n=!0,i=!0){return(n?y:v)(e,t,i)}function y(e,t,n){if(t==e.length)return t;t&&x(e.charCodeAt(t))&&w(e.charCodeAt(t-1))&&t--;let i=k(e,t);for(t+=C(i);t=0&&m(k(e,i));)n++,i-=2;if(n%2==0)break;t+=2}}}return t}function v(e,t,n){for(;t>0;){let i=y(e,t-2,n);if(i=56320&&e<57344}function w(e){return e>=55296&&e<56320}function k(e,t){let n=e.charCodeAt(t);if(!w(n)||t+1==e.length)return n;let i=e.charCodeAt(t+1);return x(i)?i-56320+(n-55296<<10)+65536:n}function S(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}function C(e){return e<65536?1:2}const A=/\r\n?|\n/;var O=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(O||(O={}));class M{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return s+(e-i);s+=o}else{if(n!=O.Simple&&l>=e&&(n==O.TrackDel&&ie||n==O.TrackBefore&&ie))return null;if(l>e||l==e&&t<0&&!o)return e==i||t<0?s:s+a;s+=a}i=l}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,t=e){for(let n=0,i=0;n=0&&i<=t&&s>=e)return!(it)||"cover";i=s}return!1}toString(){let e="";for(let t=0;t=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some((e=>"number"!=typeof e)))throw new RangeError("Invalid JSON representation of ChangeDesc");return new M(e)}static create(e){return new M(e)}}class _ extends M{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return E(this,((t,n,i,s,r)=>e=e.replace(i,i+(n-t),r)),!1),e}mapDesc(e,t=!1){return D(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let s=0,r=0;s=0){t[s]=a,t[s+1]=o;let l=s>>1;for(;n.length0&&N(n,t,s.text),s.forward(e),o+=e}let l=e[r++];for(;o>1].toJSON()))}return e}static of(e,t,n){let s=[],r=[],o=0,a=null;function l(e=!1){if(!e&&!s.length)return;oa||e<0||a>t)throw new RangeError(`Invalid change range ${e} to ${a} (in doc of length ${t})`);let u=c?"string"==typeof c?i.of(c.split(n||A)):c:i.empty,f=u.length;if(e==a&&0==f)return;eo&&T(s,e-o,-1),T(s,a-e,f),N(r,s,u),o=a}}(e),l(!a),a}static empty(e){return new _(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let s=0;st&&"string"!=typeof e)))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==r.length)t.push(r[0],0);else{for(;n.length=0&&n<=0&&n==e[s+1]?e[s]+=t:0==t&&0==e[s]?e[s+1]+=n:i?(e[s]+=t,e[s+1]+=n):e.push(t,n)}function N(e,t,n){if(0==n.length)return;let s=t.length-2>>1;if(s>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)l=e.sections[a++],h=e.sections[a++];t(r,c,o,u,f),r=c,o=u}}}function D(e,t,n,i=!1){let s=[],r=i?[]:null,o=new R(e),a=new R(t);for(let e=-1;;)if(-1==o.ins&&-1==a.ins){let e=Math.min(o.len,a.len);T(s,e,-1),o.forward(e),a.forward(e)}else if(a.ins>=0&&(o.ins<0||e==o.i||0==o.off&&(a.len=0&&e=0)){if(o.done&&a.done)return r?_.createSet(s,r):M.create(s);throw new Error("Mismatched change set lengths")}{let t=0,n=o.len;for(;n;)if(-1==a.ins){let e=Math.min(n,a.len);t+=e,n-=e,a.forward(e)}else{if(!(0==a.ins&&a.lent||o.ins>=0&&o.len>t)&&(e||i.length>n),r.forward2(t),o.forward(t)}}else T(i,0,o.ins,e),s&&N(s,i,o.text),o.next()}}class R{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?i.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?i.empty:t[n].slice(this.off,null==e?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){-1==this.ins?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class j{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return 32&this.flags?this.to:this.from}get head(){return 32&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 8&this.flags?-1:16&this.flags?1:0}get bidiLevel(){let e=7&this.flags;return 7==e?null:e}get goalColumn(){let e=this.flags>>6;return 16777215==e?void 0:e}map(e,t=-1){let n,i;return this.empty?n=i=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new j(n,i,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return I.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return I.range(this.anchor,n)}eq(e,t=!1){return!(this.anchor!=e.anchor||this.head!=e.head||t&&this.empty&&this.assoc!=e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||"number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid JSON representation for SelectionRange");return I.range(e.anchor,e.head)}static create(e,t,n){return new j(e,t,n)}}class I{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:I.create(this.ranges.map((n=>n.map(e,t))),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;ne.toJSON())),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new I(e.ranges.map((e=>j.fromJSON(e))),e.main)}static single(e,t=e){return new I([I.range(e,t)],0)}static create(e,t=0){if(0==e.length)throw new RangeError("A selection needs at least one range");for(let n=0,i=0;ie?8:0)|s)}static normalized(e,t=0){let n=e[t];e.sort(((e,t)=>e.from-t.from)),t=e.indexOf(n);for(let n=1;ni.head?I.range(o,r):I.range(r,o))}}return new I(e,t)}}function L(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let B=0;class F{constructor(e,t,n,i,s){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=i,this.id=B++,this.default=e([]),this.extensions="function"==typeof s?s(this):s}get reader(){return this}static define(e={}){return new F(e.combine||(e=>e),e.compareInput||((e,t)=>e===t),e.compare||(e.combine?(e,t)=>e===t:z),!!e.static,e.enables)}of(e){return new $([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new $(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new $(e,this,2,t)}from(e,t){return t||(t=e=>e),this.compute([e],(n=>t(n.field(e))))}}function z(e,t){return e==t||e.length==t.length&&e.every(((e,n)=>e===t[n]))}class ${constructor(e,t,n,i){this.dependencies=e,this.facet=t,this.type=n,this.value=i,this.id=B++}dynamicSlot(e){var t;let n=this.value,i=this.facet.compareInput,s=this.id,r=e[s]>>1,o=2==this.type,a=!1,l=!1,h=[];for(let n of this.dependencies)"doc"==n?a=!0:"selection"==n?l=!0:1&(null!==(t=e[n.id])&&void 0!==t?t:1)||h.push(e[n.id]);return{create:e=>(e.values[r]=n(e),1),update(e,t){if(a&&t.docChanged||l&&(t.docChanged||t.selection)||q(e,h)){let t=n(e);if(o?!H(t,e.values[r],i):!i(t,e.values[r]))return e.values[r]=t,1}return 0},reconfigure:(e,t)=>{let a,l=t.config.address[s];if(null!=l){let s=ee(t,l);if(this.dependencies.every((n=>n instanceof F?t.facet(n)===e.facet(n):!(n instanceof G)||t.field(n,!1)==e.field(n,!1)))||(o?H(a=n(e),s,i):i(a=n(e),s)))return e.values[r]=s,0}else a=n(e);return e.values[r]=a,1}}}}function H(e,t,n){if(e.length!=t.length)return!1;for(let i=0;ie[t.id])),s=n.map((e=>e.type)),r=i.filter((e=>!(1&e))),o=e[t.id]>>1;function a(e){let n=[];for(let t=0;te===t),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(W).find((e=>e.field==this));return((null==t?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let i=e.values[t],s=this.updateF(i,n);return this.compareF(i,s)?0:(e.values[t]=s,1)},reconfigure:(e,n)=>null!=n.config.address[this.id]?(e.values[t]=n.field(this),0):(e.values[t]=this.create(e),1)}}init(e){return[this,W.of({field:this,create:e})]}get extension(){return this}}function U(e){return t=>new Y(t,e)}const K={highest:U(0),high:U(1),default:U(2),low:U(3),lowest:U(4)};class Y{constructor(e,t){this.inner=e,this.prec=t}}class J{of(e){return new X(this,e)}reconfigure(e){return J.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class X{constructor(e,t){this.compartment=e,this.inner=t}}class Z{constructor(e,t,n,i,s,r){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=i,this.staticValues=s,this.facets=r,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,n){let i=[],s=Object.create(null),r=new Map;for(let n of function(e,t,n){let i=[[],[],[],[],[]],s=new Map;return function e(r,o){let a=s.get(r);if(null!=a){if(a<=o)return;let e=i[a].indexOf(r);e>-1&&i[a].splice(e,1),r instanceof X&&n.delete(r.compartment)}if(s.set(r,o),Array.isArray(r))for(let t of r)e(t,o);else if(r instanceof X){if(n.has(r.compartment))throw new RangeError("Duplicate use of compartment in extensions");let i=t.get(r.compartment)||r.inner;n.set(r.compartment,i),e(i,o)}else if(r instanceof Y)e(r.inner,r.prec);else if(r instanceof G)i[o].push(r),r.provides&&e(r.provides,o);else if(r instanceof $)i[o].push(r),r.facet.extensions&&e(r.facet.extensions,2);else{let t=r.extension;if(!t)throw new Error(`Unrecognized extension value in extension set (${r}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);e(t,o)}}(e,2),i.reduce(((e,t)=>e.concat(t)))}(e,t,r))n instanceof G?i.push(n):(s[n.facet.id]||(s[n.facet.id]=[])).push(n);let o=Object.create(null),a=[],l=[];for(let e of i)o[e.id]=l.length<<1,l.push((t=>e.slot(t)));let h=null==n?void 0:n.config.facets;for(let e in s){let t=s[e],i=t[0].facet,r=h&&h[e]||[];if(t.every((e=>0==e.type)))if(o[i.id]=a.length<<1|1,z(r,t))a.push(n.facet(i));else{let e=i.combine(t.map((e=>e.value)));a.push(n&&i.compare(e,n.facet(i))?n.facet(i):e)}else{for(let e of t)0==e.type?(o[e.id]=a.length<<1|1,a.push(e.value)):(o[e.id]=l.length<<1,l.push((t=>e.dynamicSlot(t))));o[i.id]=l.length<<1,l.push((e=>V(e,i,t)))}}let c=l.map((e=>e(o)));return new Z(e,r,c,o,a,s)}}function Q(e,t){if(1&t)return 2;let n=t>>1,i=e.status[n];if(4==i)throw new Error("Cyclic dependency between fields and/or facets");if(2&i)return i;e.status[n]=4;let s=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|s}function ee(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}const te=F.define(),ne=F.define({combine:e=>e.some((e=>e)),static:!0}),ie=F.define({combine:e=>e.length?e[0]:void 0,static:!0}),se=F.define(),re=F.define(),oe=F.define(),ae=F.define({combine:e=>!!e.length&&e[0]});class le{constructor(e,t){this.type=e,this.value=t}static define(){return new he}}class he{of(e){return new le(this,e)}}class ce{constructor(e){this.map=e}of(e){return new ue(this,e)}}class ue{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return void 0===t?void 0:t==this.value?this:new ue(this.type,t)}is(e){return this.type==e}static define(e={}){return new ce(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let i of e){let e=i.map(t);e&&n.push(e)}return n}}ue.reconfigure=ue.define(),ue.appendConfig=ue.define();class fe{constructor(e,t,n,i,s,r){this.startState=e,this.changes=t,this.selection=n,this.effects=i,this.annotations=s,this.scrollIntoView=r,this._doc=null,this._state=null,n&&L(n,t.newLength),s.some((e=>e.type==fe.time))||(this.annotations=s.concat(fe.time.of(Date.now())))}static create(e,t,n,i,s,r){return new fe(e,t,n,i,s,r)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(fe.userEvent);return!(!t||!(t==e||t.length>e.length&&t.slice(0,e.length)==e&&"."==t[e.length]))}}function de(e,t){let n=[];for(let i=0,s=0;;){let r,o;if(i=e[i]))r=e[i++],o=e[i++];else{if(!(s=0;s--){let r=n[s](e);r&&Object.keys(r).length&&(i=pe(i,me(t,r,e.changes.newLength),!0))}return i==e?e:fe.create(t,e.changes,e.selection,i.effects,i.annotations,i.scrollIntoView)}(n?function(e){let t=e.startState,n=!0;for(let i of t.facet(se)){let t=i(e);if(!1===t){n=!1;break}Array.isArray(t)&&(n=!0===n?t:de(n,t))}if(!0!==n){let i,s;if(!1===n)s=e.changes.invertedDesc,i=_.empty(t.doc.length);else{let t=e.changes.filter(n);i=t.changes,s=t.filtered.mapDesc(t.changes).invertedDesc}e=fe.create(t,i,e.selection&&e.selection.map(s),ue.mapEffects(e.effects,s),e.annotations,e.scrollIntoView)}let i=t.facet(re);for(let n=i.length-1;n>=0;n--){let s=i[n](e);e=s instanceof fe?s:Array.isArray(s)&&1==s.length&&s[0]instanceof fe?s[0]:ge(t,ye(s),!1)}return e}(s):s)}fe.time=le.define(),fe.userEvent=le.define(),fe.addToHistory=le.define(),fe.remote=le.define();const be=[];function ye(e){return null==e?be:Array.isArray(e)?e:[e]}var ve=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(ve||(ve={}));const xe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let we;try{we=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(e){}class ke{constructor(e,t,n,i,s,r){this.config=e,this.doc=t,this.selection=n,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=s,r&&(r._state=this);for(let e=0;es.set(t,e))),n=null),s.set(t.value.compartment,t.value.extension)):t.is(ue.reconfigure)?(n=null,i=t.value):t.is(ue.appendConfig)&&(n=null,i=ye(i).concat(t.value));n?t=e.startState.values.slice():(n=Z.resolve(i,s,this),t=new ke(n,this.doc,this.selection,n.dynamicSlots.map((()=>null)),((e,t)=>t.reconfigure(e,this)),null).values);let r=e.startState.facet(ne)?e.newSelection:e.newSelection.asSingle();new ke(n,e.newDoc,r,t,((t,n)=>n.update(t,e)),e)}replaceSelection(e){return"string"==typeof e&&(e=this.toText(e)),this.changeByRange((t=>({changes:{from:t.from,to:t.to,insert:e},range:I.cursor(t.from+e.length)})))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),i=this.changes(n.changes),s=[n.range],r=ye(n.effects);for(let n=1;ns.spec.fromJSON(r,e))))}return ke.create({doc:e.doc,selection:I.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=Z.resolve(e.extensions||[],new Map),n=e.doc instanceof i?e.doc:i.of((e.doc||"").split(t.staticFacet(ke.lineSeparator)||A)),s=e.selection?e.selection instanceof I?e.selection:I.single(e.selection.anchor,e.selection.head):I.single(0);return L(s,n.length),t.staticFacet(ne)||(s=s.asSingle()),new ke(t,n,s,t.dynamicSlots.map((()=>null)),((e,t)=>t.create(e)),null)}get tabSize(){return this.facet(ke.tabSize)}get lineBreak(){return this.facet(ke.lineSeparator)||"\n"}get readOnly(){return this.facet(ae)}phrase(e,...t){for(let t of this.facet(ke.phrases))if(Object.prototype.hasOwnProperty.call(t,e)){e=t[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,((e,n)=>{if("$"==n)return"$";let i=+(n||1);return!i||i>t.length?e:t[i-1]}))),e}languageDataAt(e,t,n=-1){let i=[];for(let s of this.facet(te))for(let r of s(this,t,n))Object.prototype.hasOwnProperty.call(r,e)&&i.push(r[e]);return i}charCategorizer(e){return t=this.languageDataAt("wordChars",e).join(""),e=>{if(!/\S/.test(e))return ve.Space;if(function(e){if(we)return we.test(e);for(let t=0;t"€"&&(n.toUpperCase()!=n.toLowerCase()||xe.test(n)))return!0}return!1}(e))return ve.Word;for(let n=0;n-1)return ve.Word;return ve.Other};var t}wordAt(e){let{text:t,from:n,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),r=e-n,o=e-n;for(;r>0;){let e=b(t,r,!1);if(s(t.slice(e,r))!=ve.Word)break;r=e}for(;oe.length?e[0]:4}),ke.lineSeparator=ie,ke.readOnly=ae,ke.phrases=F.define({compare(e,t){let n=Object.keys(e),i=Object.keys(t);return n.length==i.length&&n.every((n=>e[n]==t[n]))}}),ke.languageData=te,ke.changeFilter=se,ke.transactionFilter=re,ke.transactionExtender=oe,J.reconfigure=ue.define();class Ce{eq(e){return this==e}range(e,t=e){return Ae.create(e,t,this)}}Ce.prototype.startSide=Ce.prototype.endSide=0,Ce.prototype.point=!1,Ce.prototype.mapMode=O.TrackDel;class Ae{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new Ae(e,t,n)}}function Oe(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class Me{constructor(e,t,n,i){this.from=e,this.to=t,this.value=n,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,i=0){let s=n?this.to:this.from;for(let r=i,o=s.length;;){if(r==o)return r;let i=r+o>>1,a=s[i]-e||(n?this.value[i].endSide:this.value[i].startSide)-t;if(i==r)return a>=0?r:o;a>=0?o=i:r=i+1}}between(e,t,n,i){for(let s=this.findIndex(t,-1e9,!0),r=this.findIndex(n,1e9,!1,s);sh||l==h&&c.startSide>0&&c.endSide<=0)continue;(h-l||c.endSide-c.startSide)<0||(r<0&&(r=l),c.point&&(o=Math.max(o,h-l)),n.push(c),i.push(l-r),s.push(h-r))}return{mapped:n.length?new Me(i,s,n,o):null,pos:r}}}class _e{constructor(e,t,n,i){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=i}static create(e,t,n,i){return new _e(e,t,n,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:i=0,filterTo:s=this.length}=e,r=e.filter;if(0==t.length&&!r)return this;if(n&&(t=t.slice().sort(Oe)),this.isEmpty)return t.length?_e.of(t):this;let o=new Ee(this,null,-1).goto(0),a=0,l=[],h=new Te;for(;o.value||a=0){let e=t[a++];h.addInner(e.from,e.to,e.value)||l.push(e)}else 1==o.rangeIndex&&o.chunkIndexthis.chunkEnd(o.chunkIndex)||so.to||s=s&&e<=s+r.length&&!1===r.between(s,e-s,t-s,n))return}this.nextLayer.between(e,t,n)}}iter(e=0){return De.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return De.from(e).goto(t)}static compare(e,t,n,i,s=-1){let r=e.filter((e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=s)),o=t.filter((e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=s)),a=Ne(r,o,n),l=new Re(r,a,s),h=new Re(o,a,s);n.iterGaps(((e,t,n)=>je(l,e,h,t,n,i))),n.empty&&0==n.length&&je(l,0,h,0,0,i)}static eq(e,t,n=0,i){null==i&&(i=999999999);let s=e.filter((e=>!e.isEmpty&&t.indexOf(e)<0)),r=t.filter((t=>!t.isEmpty&&e.indexOf(t)<0));if(s.length!=r.length)return!1;if(!s.length)return!0;let o=Ne(s,r),a=new Re(s,o,0).goto(n),l=new Re(r,o,0).goto(n);for(;;){if(a.to!=l.to||!Ie(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>i)return!0;a.next(),l.next()}}static spans(e,t,n,i,s=-1){let r=new Re(e,null,s).goto(t),o=t,a=r.openStart;for(;;){let e=Math.min(r.to,n);if(r.point){let n=r.activeForPoint(r.to),s=r.pointFromo&&(i.span(o,e,r.active,a),a=r.openEnd(e));if(r.to>n)return a+(r.point&&r.to>n?1:0);o=r.to,r.next()}}static of(e,t=!1){let n=new Te;for(let i of e instanceof Ae?[e]:t?function(e){if(e.length>1)for(let t=e[0],n=1;n0)return e.slice().sort(Oe);t=i}return e}(e):e)n.add(i.from,i.to,i.value);return n.finish()}static join(e){if(!e.length)return _e.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let i=e[n];i!=_e.empty;i=i.nextLayer)t=new _e(i.chunkPos,i.chunk,t,Math.max(i.maxPoint,t.maxPoint));return t}}_e.empty=new _e([],[],null,-1),_e.empty.nextLayer=_e.empty;class Te{finishChunk(e){this.chunks.push(new Me(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new Te)).add(e,t,n)}addInner(e,t,n){let i=e-this.lastTo||n.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(i<0||(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),0))}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(_e.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return e;let t=_e.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Ne(e,t,n){let i=new Map;for(let t of e)for(let e=0;e=this.minPoint)break}}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=n&&i.push(new Ee(r,t,n,s));return 1==i.length?i[0]:new De(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)Pe(this.heap,e);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)Pe(this.heap,e);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Pe(this.heap,0)}}}function Pe(e,t){for(let n=e[t];;){let i=1+(t<<1);if(i>=e.length)break;let s=e[i];if(i+1=0&&(s=e[i+1],i++),n.compare(s)<0)break;e[i]=n,e[t]=s,t=i}}class Re{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=De.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){Le(this.active,e),Le(this.activeTo,e),Le(this.activeRank,e),this.minActive=Fe(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:i,rank:s}=this.cursor;for(;t0;)t++;Be(this.active,t,n),Be(this.activeTo,t,i),Be(this.activeRank,t,s),e&&Be(e,t,this.cursor.from),this.minActive=Fe(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&Le(n,i)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let e=this.cursor.value;if(e.point){if(!(t&&this.cursor.to==this.to&&this.cursor.from=0&&n[t]=0&&!(this.activeRank[n]e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function je(e,t,n,i,s,r){e.goto(t),n.goto(i);let o=i+s,a=i,l=i-t;for(;;){let t=e.to+l-n.to||e.endSide-n.endSide,i=t<0?e.to+l:n.to,s=Math.min(i,o);if(e.point||n.point?e.point&&n.point&&(e.point==n.point||e.point.eq(n.point))&&Ie(e.activeForPoint(e.to),n.activeForPoint(n.to))||r.comparePoint(a,s,e.point,n.point):s>a&&!Ie(e.active,n.active)&&r.compareRange(a,s,e.active,n.active),i>o)break;a=i,t<=0&&e.next(),t>=0&&n.next()}}function Ie(e,t){if(e.length!=t.length)return!1;for(let n=0;n=t;n--)e[n+1]=e[n];e[t]=n}function Fe(e,t){let n=-1,i=1e9;for(let s=0;s=t)return i;if(i==e.length)break;s+=9==e.charCodeAt(i)?n-s%n:1,i=b(e,i)}return!0===i?-1:e.length}},3173:(e,t,n)=>{"use strict";n.d(t,{NZ:()=>fe,OP:()=>Ce,Lz:()=>li,wJ:()=>Cs,Z9:()=>lt,xO:()=>ce,HJ:()=>os,VH:()=>Di,ld:()=>vs,Eg:()=>bs,cU:()=>Ts,dz:()=>Zi,N$:()=>Gi,wu:()=>Xs,Yq:()=>Ys,w4:()=>gi,$K:()=>Vs,c_:()=>st,D4:()=>is,TS:()=>vi,BE:()=>Xi,S7:()=>Ss,DK:()=>gs,vX:()=>hs});for(var i=n(4830),s=n(8104),r={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},o={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},a="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),l="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),h=0;h<10;h++)r[48+h]=r[96+h]=String(h);for(h=1;h<=24;h++)r[h+111]="F"+h;for(h=65;h<=90;h++)r[h]=String.fromCharCode(h+32),o[h]=String.fromCharCode(h);for(var c in r)o.hasOwnProperty(c)||(o[c]=r[c]);function u(e){let t;return t=11==e.nodeType?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function f(e,t){return!!t&&(e==t||e.contains(1!=t.nodeType?t.parentNode:t))}function d(e,t){if(!t.anchorNode)return!1;try{return f(e,t.anchorNode)}catch(e){return!1}}function p(e){return 3==e.nodeType?M(e,0,e.nodeValue.length).getClientRects():1==e.nodeType?e.getClientRects():[]}function m(e,t,n,i){return!!n&&(y(e,t,n,i,-1)||y(e,t,n,i,1))}function g(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t}function b(e){return 1==e.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function y(e,t,n,i,s){for(;;){if(e==n&&t==i)return!0;if(t==(s<0?0:v(e))){if("DIV"==e.nodeName)return!1;let n=e.parentNode;if(!n||1!=n.nodeType)return!1;t=g(e)+(s<0?0:1),e=n}else{if(1!=e.nodeType)return!1;if(1==(e=e.childNodes[t+(s<0?-1:0)]).nodeType&&"false"==e.contentEditable)return!1;t=s<0?v(e):0}}}function v(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function x(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function w(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function k(e,t){let n=t.width/e.offsetWidth,i=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(t.height-e.offsetHeight)<1)&&(i=1),{scaleX:n,scaleY:i}}class S{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?v(t):0),n,Math.min(e.focusOffset,n?v(n):0))}set(e,t,n,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=i}}let C,A=null;function O(e){if(e.setActive)return e.setActive();if(A)return e.focus(A);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(null==A?{get preventScroll(){return A={preventScroll:!0},!0}}:void 0),!A){A=!1;for(let e=0;eMath.max(1,e.scrollHeight-e.clientHeight-4)}function E(e,t){for(let n=e,i=t;;){if(3==n.nodeType&&i>0)return{node:n,offset:i};if(1==n.nodeType&&i>0){if("false"==n.contentEditable)return null;n=n.childNodes[i-1],i=v(n)}else{if(!n.parentNode||b(n))return null;i=g(n),n=n.parentNode}}}function D(e,t){for(let n=e,i=t;;){if(3==n.nodeType&&it)return n.domBoundsAround(e,t,l);if(c>=e&&-1==i&&(i=a,s=l),l>t&&n.dom.parentNode==this.dom){r=a,o=h;break}h=c,l=c+n.breakAfter}return{from:s,to:o<0?n+this.length:o,startDOM:(i?this.children[i-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:r=0?this.children[r].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),1&t.flags)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,7&this.flags&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,n=R){this.markDirty();for(let i=e;ithis.pos||e==this.pos&&(t>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}function B(e,t,n,i,s,r,o,a,l){let{children:h}=e,c=h.length?h[t]:null,u=r.length?r[r.length-1]:null,f=u?u.breakAfter:o;if(!(t==i&&c&&!o&&!f&&r.length<2&&c.merge(n,s,r.length?u:null,0==n,a,l))){if(i0&&(!o&&r.length&&c.merge(n,c.length,r[0],!1,a,0)?c.breakAfter=r.shift().breakAfter:(n2);var X={mac:J||/Mac/.test(z.platform),windows:/Win/.test(z.platform),linux:/Linux|X11/.test(z.platform),ie:W,ie_version:q?$.documentMode||6:V?+V[1]:H?+H[1]:0,gecko:G,gecko_version:G?+(/Firefox\/(\d+)/.exec(z.userAgent)||[0,0])[1]:0,chrome:!!U,chrome_version:U?+U[1]:0,ios:J,android:/Android\b/.test(z.userAgent),webkit:K,safari:Y,webkit_version:K?+(/\bAppleWebKit\/(\d+)/.exec(z.userAgent)||[0,0])[1]:0,tabSize:null!=$.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class Z extends j{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){3==e.nodeType&&this.createDOM(e)}merge(e,t,n){return!(8&this.flags||n&&(!(n instanceof Z)||this.length-(t-e)+n.length>256||8&n.flags)||(this.text=this.text.slice(0,e)+(n?n.text:"")+this.text.slice(t),this.markDirty(),0))}split(e){let t=new Z(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=8&this.flags,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new P(this.dom,e)}domBoundsAround(e,t,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return function(e,t,n){let i=e.nodeValue.length;t>i&&(t=i);let s=t,r=t,o=0;0==t&&n<0||t==i&&n>=0?X.chrome||X.gecko||(t?(s--,o=1):r=0)?0:a.length-1];return X.safari&&!o&&0==l.width&&(l=Array.prototype.find.call(a,(e=>e.width))||l),o?x(l,o<0):l||null}(this.dom,e,t)}}class Q extends j{constructor(e,t=[],n=0){super(),this.mark=e,this.children=t,this.length=n;for(let e of t)e.setParent(this)}setAttrs(e){if(T(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!(8&(this.flags|e.flags))}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?4&this.flags&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,n,i,s,r){return!(n&&(!(n instanceof Q&&n.mark.eq(this.mark))||e&&s<=0||te&&t.push(n=e&&(i=s),n=o,s++}let r=this.length-e;return this.length=e,i>-1&&(this.children.length=i,this.markDirty()),new Q(this.mark,t,r)}domAtPos(e){return ne(this,e)}coordsAt(e,t){return se(this,e,t)}}class ee extends j{static create(e,t,n){return new ee(e,t,n)}constructor(e,t,n){super(),this.widget=e,this.length=t,this.side=n,this.prevWidget=null}split(e){let t=ee.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){this.dom&&this.widget.updateDOM(this.dom,e)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,n,i,s,r){return!(n&&(!(n instanceof ee&&this.widget.compare(n.widget))||e>0&&s<=0||t0)?P.before(this.dom):P.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);if(n)return n;let i=this.dom.getClientRects(),s=null;if(!i.length)return null;let r=this.side?this.side<0:e>0;for(let t=r?i.length-1:0;s=i[t],!(e>0?0==t:t==i.length-1||s.top0?P.before(this.dom):P.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return i.EY.empty}get isHidden(){return!0}}function ne(e,t){let n=e.dom,{children:i}=e,s=0;for(let e=0;se&&t0;e--){let t=i[e-1];if(t.dom.parentNode==n)return t.domAtPos(t.length)}for(let e=s;e0&&t instanceof Q&&s.length&&(i=s[s.length-1])instanceof Q&&i.mark.eq(t.mark)?ie(i,t.children[0],n-1):(s.push(t),t.setParent(e)),e.length+=t.length}function se(e,t,n){let i=null,s=-1,r=null,o=-1;!function e(t,a){for(let l=0,h=0;l=a&&(c.children.length?e(c,a-h):(!r||r.isHidden&&n>0)&&(u>a||h==u&&c.getSide()>0)?(r=c,o=a-h):(h-1?1:0)!=s.length-(n&&s.indexOf(n)>-1?1:0))return!1;for(let r of i)if(r!=n&&(-1==s.indexOf(r)||e[r]!==t[r]))return!1;return!0}function le(e,t,n){let i=!1;if(t)for(let s in t)n&&s in n||(i=!0,"style"==s?e.style.cssText="":e.removeAttribute(s));if(n)for(let s in n)t&&t[s]==n[s]||(i=!0,"style"==s?e.style.cssText=n[s]:e.setAttribute(s,n[s]));return i}function he(e){let t=Object.create(null);for(let n=0;n0?3e8:-4e8:t>0?1e8:-1e8,new me(e,t,t,n,e.widget||null,!1)}static replace(e){let t,n,i=!!e.block;if(e.isBlockGap)t=-5e8,n=4e8;else{let{start:s,end:r}=ge(e,i);t=(s?i?-3e8:-1:5e8)-1,n=1+(r?i?2e8:1:-6e8)}return new me(e,t,n,i,e.widget||null,!0)}static line(e){return new pe(e)}static set(e,t=!1){return i.om.of(e,t)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}fe.none=i.om.empty;class de extends fe{constructor(e){let{start:t,end:n}=ge(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,n;return this==e||e instanceof de&&this.tagName==e.tagName&&(this.class||(null===(t=this.attrs)||void 0===t?void 0:t.class))==(e.class||(null===(n=e.attrs)||void 0===n?void 0:n.class))&&ae(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}de.prototype.point=!1;class pe extends fe{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof pe&&this.spec.class==e.spec.class&&ae(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}pe.prototype.mapMode=i.iR.TrackBefore,pe.prototype.point=!0;class me extends fe{constructor(e,t,n,s,r,o){super(t,n,r,e),this.block=s,this.isReplace=o,this.mapMode=s?t<=0?i.iR.TrackBefore:i.iR.TrackAfter:i.iR.TrackDel}get type(){return this.startSide!=this.endSide?ue.WidgetRange:this.startSide<=0?ue.WidgetBefore:ue.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof me&&((t=this.widget)==(n=e.widget)||!!(t&&n&&t.compare(n)))&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide;var t,n}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}function ge(e,t=!1){let{inclusiveStart:n,inclusiveEnd:i}=e;return null==n&&(n=e.inclusive),null==i&&(i=e.inclusive),{start:null!=n?n:t,end:null!=i?i:t}}function be(e,t,n,i=0){let s=n.length-1;s>=0&&n[s]+i>=e?n[s]=Math.max(n[s],t):n.push(e,t)}me.prototype.point=!0;class ye extends j{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,n,i,s,r){if(n){if(!(n instanceof ye))return!1;this.dom||n.transferDOM(this)}return i&&this.setDeco(n?n.attrs:null),F(this,e,t,n?n.children.slice():[],s,r),!0}split(e){let t=new ye;if(t.breakAfter=this.breakAfter,0==this.length)return t;let{i:n,off:i}=this.childPos(e);i&&(t.append(this.children[n].split(i),0),this.children[n].merge(i,this.children[n].length,null,!1,0,0),n++);for(let e=n;e0&&0==this.children[n-1].length;)this.children[--n].destroy();return this.children.length=n,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){ae(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){ie(this,e,t)}addLineDeco(e){let t=e.spec.attributes,n=e.spec.class;t&&(this.attrs=re(t,this.attrs||{})),n&&(this.attrs=re({class:n},this.attrs||{}))}domAtPos(e){return ne(this,e)}reuseDOM(e){"DIV"==e.nodeName&&(this.setDOM(e),this.flags|=6)}sync(e,t){var n;this.dom?4&this.flags&&(T(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),void 0!==this.prevAttrs&&(le(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let i=this.dom.lastChild;for(;i&&j.get(i)instanceof Q;)i=i.lastChild;if(!(i&&this.length&&("BR"==i.nodeName||0!=(null===(n=j.get(i))||void 0===n?void 0:n.isEditable)||X.ios&&this.children.some((e=>e instanceof Z))))){let e=document.createElement("BR");e.cmIgnore=!0,this.dom.appendChild(e)}}measureTextSize(){if(0==this.children.length||this.length>20)return null;let e,t=0;for(let n of this.children){if(!(n instanceof Z)||/[^ -~]/.test(n.text))return null;let i=p(n.dom);if(1!=i.length)return null;t+=i[0].width,e=i[0].height}return t?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:t/this.length,textHeight:e}:null}coordsAt(e,t){let n=se(this,e,t);if(!this.children.length&&n&&this.parent){let{heightOracle:e}=this.parent.view.viewState,t=n.bottom-n.top;if(Math.abs(t-e.lineHeight)<2&&e.textHeight=t){if(s instanceof ye)return s;if(r>t)break}i=r+s.breakAfter}return null}}class ve extends j{constructor(e,t,n){super(),this.widget=e,this.length=t,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(e,t,n,i,s,r){return!(n&&(!(n instanceof ve&&this.widget.compare(n.widget))||e>0&&s<=0||t0)}}class xe extends ce{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class we{constructor(e,t,n,i){this.doc=e,this.pos=t,this.end=n,this.disallowBlockEffectsFor=i,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(0==this.content.length)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof ve&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new ye),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(ke(new te(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||e&&this.content.length&&this.content[this.content.length-1]instanceof ve||this.getLine()}buildText(e,t,n){for(;e>0;){if(this.textOff==this.text.length){let{value:t,lineBreak:n,done:i}=this.cursor.next(this.skip);if(this.skip=0,i)throw new Error("Ran out of text content when drawing inline views");if(n){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}this.text=t,this.textOff=0}let i=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-n)),this.getLine().append(ke(new Z(this.text.slice(this.textOff,this.textOff+i)),t),n),this.atCursorPos=!0,this.textOff+=i,e-=i,n=0}}span(e,t,n,i){this.buildText(t-e,n,i),this.pos=t,this.openStart<0&&(this.openStart=i)}point(e,t,n,i,s,r){if(this.disallowBlockEffectsFor[r]&&n instanceof me){if(n.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=t-e;if(n instanceof me)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new ve(n.widget||Se.block,o,n));else{let r=ee.create(n.widget||Se.inline,o,o?0:n.startSide),a=this.atCursorPos&&!r.isEditable&&s<=i.length&&(e0),l=!r.isEditable&&(ei.length||n.startSide<=0),h=this.getLine();2!=this.pendingBuffer||a||r.isEditable||(this.pendingBuffer=0),this.flushBuffer(i),a&&(h.append(ke(new te(1),i),s),s=i.length+Math.max(0,s-i.length)),h.append(ke(r,i),s),this.atCursorPos=l,this.pendingBuffer=l?ei.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=i.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);o&&(this.textOff+o<=this.text.length?this.textOff+=o:(this.skip+=o-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=s)}static build(e,t,n,s,r){let o=new we(e,t,n,r);return o.openEnd=i.om.spans(s,t,n,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function ke(e,t){for(let n of t)e=new Q(n,[e],e.length);return e}class Se extends ce{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Se.inline=new Se("span"),Se.block=new Se("div");var Ce=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(Ce||(Ce={}));const Ae=Ce.LTR,Oe=Ce.RTL;function Me(e){let t=[];for(let n=0;n=t){if(o.level==n)return r;(s<0||(0!=i?i<0?o.fromt:e[s].level>o.level))&&(s=r)}}if(s<0)throw new RangeError("Index out of range");return s}}function je(e,t){if(e.length!=t.length)return!1;for(let n=0;nl&&o.push(new Re(l,p.from,f)),Be(e,p.direction==Ae!=!(f%2)?i+1:i,s,p.inner,p.from,p.to,o),l=p.to),d=p.to}else{if(d==n||(t?Ie[d]!=a:Ie[d]==a))break;d++}u?Le(e,l,d,i+1,s,u,o):lt;){let n=!0,c=!1;if(!h||l>r[h-1].to){let e=Ie[l-1];e!=a&&(n=!1,c=16==e)}let u=n||1!=a?null:[],f=n?i:i+1,d=l;e:for(;;)if(h&&d==r[h-1].to){if(c)break e;let p=r[--h];if(!n)for(let e=p.from,n=h;;){if(e==t)break e;if(!n||r[n-1].to!=e){if(Ie[e-1]==a)break e;break}e=r[--n].from}u?u.push(p):(p.to=0;e-=3)if(Ee[e+1]==-n){let t=Ee[e+2],n=2&t?s:4&t?1&t?r:s:0;n&&(Ie[o]=Ie[Ee[e]]=n),a=e;break}}else{if(189==Ee.length)break;Ee[a++]=o,Ee[a++]=t,Ee[a++]=l}else if(2==(i=Ie[o])||1==i){let e=i==s;l=e?0:1;for(let t=a-3;t>=0;t-=3){let n=Ee[t+2];if(2&n)break;if(e)Ee[t+2]|=2;else{if(4&n)break;Ee[t+2]|=4}}}}}(e,s,r,i,a),function(e,t,n,i){for(let s=0,r=i;s<=n.length;s++){let o=s?n[s-1].to:e,a=sl;)t==r&&(t=n[--i].from,r=i?n[i-1].to:e),Ie[--t]=c;l=o}else r=o,l++}}}(s,r,i,a),Le(e,s,r,t,n,i,o)}function Fe(e){return[new Re(0,e,0)]}let ze="";function $e(e,t,n,s,r){var o;let a=s.head-e.from,l=Re.find(t,a,null!==(o=s.bidiLevel)&&void 0!==o?o:-1,s.assoc),h=t[l],c=h.side(r,n);if(a==c){let e=l+=r?1:-1;if(e<0||e>=t.length)return null;h=t[l=e],a=h.side(!r,n),c=h.side(r,n)}let u=(0,i.zK)(e.text,a,h.forward(r,n));(uh.to)&&(u=c),ze=e.text.slice(Math.min(a,u),Math.max(a,u));let f=l==(r?t.length-1:0)?null:t[l+(r?1:-1)];return f&&u==c&&f.level+(r?0:1)e.some((e=>e))}),Qe=i.sj.define({combine:e=>e.some((e=>e))}),et=i.sj.define();class tt{constructor(e,t="nearest",n="nearest",i=5,s=5,r=!1){this.range=e,this.y=t,this.x=n,this.yMargin=i,this.xMargin=s,this.isSnapshot=r}map(e){return e.empty?this:new tt(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new tt(i.OF.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const nt=i.Pe.define({map:(e,t)=>e.map(t)}),it=i.Pe.define();function st(e,t,n){let i=e.facet(Ge);i.length?i[0](t):window.onerror?window.onerror(String(t),n,void 0,void 0,t):n?console.error(n+":",t):console.error(t)}const rt=i.sj.define({combine:e=>!e.length||e[0]});let ot=0;const at=i.sj.define();class lt{constructor(e,t,n,i,s){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=i,this.extension=s(this)}static define(e,t){const{eventHandlers:n,eventObservers:i,provide:s,decorations:r}=t||{};return new lt(ot++,e,n,i,(e=>{let t=[at.of(e)];return r&&t.push(ft.of((t=>{let n=t.plugin(e);return n?r(n):fe.none}))),s&&t.push(s(e)),t}))}static fromClass(e,t){return lt.define((t=>new e(t)),t)}}class ht{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(st(e.state,t,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(e){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(t){st(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(null===(t=this.value)||void 0===t?void 0:t.destroy)try{this.value.destroy()}catch(t){st(e.state,t,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const ct=i.sj.define(),ut=i.sj.define(),ft=i.sj.define(),dt=i.sj.define(),pt=i.sj.define(),mt=i.sj.define();function gt(e,t){let n=e.state.facet(mt);if(!n.length)return n;let s=n.map((t=>t instanceof Function?t(e):t)),r=[];return i.om.spans(s,t.from,t.to,{point(){},span(e,n,i,s){let o=e-t.from,a=n-t.from,l=r;for(let e=i.length-1;e>=0;e--,s--){let n,r=i[e].spec.bidiIsolate;if(null==r&&(r=He(t.text,o,a)),s>0&&l.length&&(n=l[l.length-1]).to==o&&n.direction==r)n.to=a,l=n.inner;else{let e={from:o,to:a,direction:r,inner:[]};l.push(e),l=e.inner}}}}),r}const bt=i.sj.define();function yt(e){let t=0,n=0,i=0,s=0;for(let r of e.state.facet(bt)){let o=r(e);o&&(null!=o.left&&(t=Math.max(t,o.left)),null!=o.right&&(n=Math.max(n,o.right)),null!=o.top&&(i=Math.max(i,o.top)),null!=o.bottom&&(s=Math.max(s,o.bottom)))}return{left:t,right:n,top:i,bottom:s}}const vt=i.sj.define();class xt{constructor(e,t,n,i){this.fromA=e,this.toA=t,this.fromB=n,this.toB=i}join(e){return new xt(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let i=e[t-1];if(!(i.fromA>n.toA)){if(i.toAh)break;s+=2}if(!a)return n;new xt(a.fromA,a.toA,a.fromB,a.toB).addToSet(n),r=a.toA,o=a.toB}}}class wt{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=i.VR.empty(this.startState.doc.length);for(let e of n)this.changes=this.changes.compose(e.changes);let s=[];this.changes.iterChangedRanges(((e,t,n,i)=>s.push(new xt(e,t,n,i)))),this.changedRanges=s}static create(e,t,n){return new wt(e,t,n)}get viewportChanged(){return(4&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(10&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some((e=>e.selection))}get empty(){return 0==this.flags&&0==this.transactions.length}}class kt extends j{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=fe.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new ye],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new xt(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every((({fromA:e,toA:t})=>tthis.minWidthTo))?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&((null===(t=this.domChanged)||void 0===t?void 0:t.newSel)?s=this.domChanged.newSel.head:function(e,t){let n=!1;return t&&e.iterChangedRanges(((e,i)=>{et.from&&(n=!0)})),n}(e.changes,this.hasComposition)||e.selectionSet||(s=e.state.selection.main.head));let r=s>-1?function(e,t,n){let i=St(e,n);if(!i)return null;let{node:s,from:r,to:o}=i,a=s.nodeValue;if(/[\n\r]/.test(a))return null;if(e.state.doc.sliceString(i.from,i.to)!=a)return null;let l=t.invertedDesc,h=new xt(l.mapPos(r),l.mapPos(o),r,o),c=[];for(let t=s.parentNode;;t=t.parentNode){let n=j.get(t);if(n instanceof Q)c.push({node:t,deco:n.mark});else{if(n instanceof ye||"DIV"==t.nodeName&&t.parentNode==e.contentDOM)return{range:h,text:s,marks:c,line:t};if(t==e.contentDOM)return null;c.push({node:t,deco:new de({inclusive:!0,attributes:he(t),tagName:t.tagName.toLowerCase()})})}}}(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:t,to:i}=this.hasComposition;n=new xt(t,i,e.changes.mapPos(t,-1),e.changes.mapPos(i,1)).addToSet(n.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(X.ie||X.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=function(e,t,n){let s=new Ct;return i.om.compare(e,t,n,s),s.changes}(this.decorations,this.updateDeco(),e.changes);return n=xt.extendWithRanges(n,o),!!(7&this.flags||0!=n.length)&&(this.updateInner(n,e.startState.doc.length,r),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,n);let{observer:i}=this.view;i.ignore((()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let e=X.chrome||X.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,e),this.flags&=-8,e&&(e.written||i.selectionRange.focusNode!=e.node)&&(this.forceSelection=!0),this.dom.style.height=""})),this.markedForComposition.forEach((e=>e.flags&=-9));let s=[];if(this.view.viewport.from||this.view.viewport.to=0?i[e]:null;if(!t)break;let r,o,a,l,{fromA:h,toA:c,fromB:u,toB:f}=t;if(n&&n.range.fromBu){let e=we.build(this.view.state.doc,u,n.range.fromB,this.decorations,this.dynamicDecorationMap),t=we.build(this.view.state.doc,n.range.toB,f,this.decorations,this.dynamicDecorationMap);o=e.breakAtStart,a=e.openStart,l=t.openEnd;let i=this.compositionView(n);t.breakAtStart?i.breakAfter=1:t.content.length&&i.merge(i.length,i.length,t.content[0],!1,t.openStart,0)&&(i.breakAfter=t.content[0].breakAfter,t.content.shift()),e.content.length&&i.merge(0,0,e.content[e.content.length-1],!0,0,e.openEnd)&&e.content.pop(),r=e.content.concat(i).concat(t.content)}else({content:r,breakAtStart:o,openStart:a,openEnd:l}=we.build(this.view.state.doc,u,f,this.decorations,this.dynamicDecorationMap));let{i:d,off:p}=s.findPos(c,1),{i:m,off:g}=s.findPos(h,-1);B(this,m,g,d,p,r,o,a,l)}n&&this.fixCompositionDOM(n)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let e of t.effects)e.is(it)&&(this.editContextFormatting=e.value)}compositionView(e){let t=new Z(e.text.nodeValue);t.flags|=8;for(let{deco:n}of e.marks)t=new Q(n,[t],t.length);let n=new ye;return n.append(t,0),n}fixCompositionDOM(e){let t=(e,t)=>{t.flags|=8|(t.children.some((e=>7&e.flags))?1:0),this.markedForComposition.add(t);let n=j.get(e);n&&n!=t&&(n.dom=null),t.setDOM(e)},n=this.childPos(e.range.fromB,1),i=this.children[n.i];t(e.line,i);for(let s=e.marks.length-1;s>=-1;s--)n=i.childPos(n.off,1),i=i.children[n.i],t(s>=0?e.marks[s].node:e.text,i)}updateSelection(e=!1,t=!1){!e&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();let n=this.view.root.activeElement,i=n==this.dom,s=!i&&d(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(i||t||s))return;let r=this.forceSelection;this.forceSelection=!1;let o=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(o.anchor)),l=o.empty?a:this.moveToLine(this.domAtPos(o.head));if(X.gecko&&o.empty&&!this.hasComposition&&1==(h=a).node.nodeType&&h.node.firstChild&&(0==h.offset||"false"==h.node.childNodes[h.offset-1].contentEditable)&&(h.offset==h.node.childNodes.length||"false"==h.node.childNodes[h.offset].contentEditable)){let e=document.createTextNode("");this.view.observer.ignore((()=>a.node.insertBefore(e,a.node.childNodes[a.offset]||null))),a=l=new P(e,0),r=!0}var h;let c=this.view.observer.selectionRange;!r&&c.focusNode&&(m(a.node,a.offset,c.anchorNode,c.anchorOffset)&&m(l.node,l.offset,c.focusNode,c.focusOffset)||this.suppressWidgetCursorChange(c,o))||(this.view.observer.ignore((()=>{X.android&&X.chrome&&this.dom.contains(c.focusNode)&&function(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(1==n.nodeType&&"false"==n.contentEditable)return!0;return!1}(c.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let e=u(this.view.root);if(e)if(o.empty){if(X.gecko){let e=(t=a.node,i=a.offset,1!=t.nodeType?0:(i&&"false"==t.childNodes[i-1].contentEditable?1:0)|(io.head&&([a,l]=[l,a]),t.setEnd(l.node,l.offset),t.setStart(a.node,a.offset),e.removeAllRanges(),e.addRange(t)}var t,i;s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())})),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new P(c.anchorNode,c.anchorOffset),this.impreciseHead=l.precise?null:new P(c.focusNode,c.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&m(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=u(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!(n&&t.empty&&t.assoc&&n.modify))return;let r=ye.find(this,t.head);if(!r)return;let o=r.posAtStart;if(t.head==o||t.head==o+r.length)return;let a=this.coordsAt(t.head,-1),l=this.coordsAt(t.head,1);if(!a||!l||a.bottom>l.top)return;let h=this.domAtPos(t.head+t.assoc);n.collapse(h.node,h.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let c=e.observer.selectionRange;e.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=t.from&&n.collapse(i,s)}moveToLine(e){let t,n=this.dom;if(e.node!=n)return e;for(let i=e.offset;!t&&i=0;i--){let e=j.get(n.childNodes[i]);e instanceof ye&&(t=e.domAtPos(e.length))}return t?new P(t.node,t.offset,!0):e}nearest(e){for(let t=e;t;){let e=j.get(t);if(e&&e.rootView==this)return e;t=t.parentNode}return null}posFromDOM(e,t){let n=this.nearest(e);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(e,t)+n.posAtStart}domAtPos(e){let{i:t,off:n}=this.childCursor().findPos(e,-1);for(;t=0;r--){let o=this.children[r],a=s-o.breakAfter,l=a-o.length;if(ae||o.covers(1))&&(!n||o instanceof ye&&!(n instanceof ye&&t>=0)))n=o,i=l;else if(n&&l==e&&a==e&&o instanceof ve&&Math.abs(t)<2){if(o.deco.startSide<0)break;r&&(n=null)}s=l}return n?n.coordsAt(e-i,t):null}coordsForChar(e){let{i:t,off:n}=this.childPos(e,1),s=this.children[t];if(!(s instanceof ye))return null;for(;s.children.length;){let{i:e,off:t}=s.childPos(n,1);for(;;e++){if(e==s.children.length)return null;if((s=s.children[e]).length)break}n=t}if(!(s instanceof Z))return null;let r=(0,i.zK)(s.text,n);if(r==n)return null;let o=M(s.dom,n,r).getClientRects();for(let e=0;eMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,a=this.view.textDirection==Ce.LTR;for(let e=0,l=0;li)break;if(e>=n){let n=h.dom.getBoundingClientRect();if(t.push(n.height),r){let t=h.dom.lastChild,i=t?p(t):[];if(i.length){let t=i[i.length-1],r=a?t.right-n.left:n.right-t.left;r>o&&(o=r,this.minWidth=s,this.minWidthFrom=e,this.minWidthTo=c)}}}e=c+h.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return"rtl"==getComputedStyle(this.children[t].dom).direction?Ce.RTL:Ce.LTR}measureTextSize(){for(let e of this.children)if(e instanceof ye){let t=e.measureTextSize();if(t)return t}let e,t,n,i=document.createElement("div");return i.className="cm-line",i.style.width="99999px",i.style.position="absolute",i.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(i);let s=p(i.firstChild)[0];e=i.getBoundingClientRect().height,t=s?s.width/27:7,n=s?s.height:e,i.remove()})),{lineHeight:e,charWidth:t,textHeight:n}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new L(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,i=0;;i++){let s=i==t.viewports.length?null:t.viewports[i],r=s?s.from-1:this.length;if(r>n){let i=(t.lineBlockAt(r).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(fe.replace({widget:new xe(i),block:!0,inclusive:!0,isBlockGap:!0}).range(n,r))}if(!s)break;n=s.to+1}return fe.set(e)}updateDeco(){let e=1,t=this.view.state.facet(ft).map((t=>(this.dynamicDecorationMap[e++]="function"==typeof t)?t(this.view):t)),n=!1,s=this.view.state.facet(dt).map(((e,t)=>{let i="function"==typeof e;return i&&(n=!0),i?e(this.view):e}));for(s.length&&(this.dynamicDecorationMap[e++]=n,t.push(i.om.join(s))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];en.anchor?-1:1);if(!i)return;!n.empty&&(t=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(i={left:Math.min(i.left,t.left),top:Math.min(i.top,t.top),right:Math.max(i.right,t.right),bottom:Math.max(i.bottom,t.bottom)});let s=yt(this.view),r={left:i.left-s.left,top:i.top-s.top,right:i.right+s.right,bottom:i.bottom+s.bottom},{offsetWidth:o,offsetHeight:a}=this.view.scrollDOM;!function(e,t,n,i,s,r,o,a){let l=e.ownerDocument,h=l.defaultView||window;for(let c=e,u=!1;c&&!u;)if(1==c.nodeType){let e,f=c==l.body,d=1,p=1;if(f)e=w(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(u=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let t=c.getBoundingClientRect();({scaleX:d,scaleY:p}=k(c,t)),e={left:t.left,right:t.left+c.clientWidth*d,top:t.top,bottom:t.top+c.clientHeight*p}}let m=0,g=0;if("nearest"==s)t.top0&&t.bottom>e.bottom+g&&(g=t.bottom-e.bottom+g+o)):t.bottom>e.bottom&&(g=t.bottom-e.bottom+o,n<0&&t.top-g0&&t.right>e.right+m&&(m=t.right-e.right+m+r)):t.right>e.right&&(m=t.right-e.right+r,n<0&&t.lefte?t.left-e:Math.max(0,e-t.right)}function Ot(e,t){return t.top>e?t.top-e:Math.max(0,e-t.bottom)}function Mt(e,t){return e.topt.top+1}function _t(e,t){return te.bottom?{top:e.top,left:e.left,right:e.right,bottom:t}:e}function Nt(e,t,n){let i,s,r,o,a,l,h,c,u=!1;for(let f=e.firstChild;f;f=f.nextSibling){let e=p(f);for(let d=0;dg||o==g&&r>m){i=f,s=p,r=m,o=g;let a=g?n0?d0)}0==m?n>p.bottom&&(!h||h.bottomp.top)&&(l=f,c=p):h&&Mt(h,p)?h=Tt(h,p.bottom):c&&Mt(c,p)&&(c=_t(c,p.top))}}if(h&&h.bottom>=n?(i=a,s=h):c&&c.top<=n&&(i=l,s=c),!i)return{node:e,offset:0};let f=Math.max(s.left,Math.min(s.right,t));return 3==i.nodeType?Et(i,f,n):u&&"false"!=i.contentEditable?Nt(i,f,n):{node:e,offset:Array.prototype.indexOf.call(e.childNodes,i)+(t>=(s.left+s.right)/2?1:0)}}function Et(e,t,n){let i=e.nodeValue.length,s=-1,r=1e9,o=0;for(let a=0;an?h.top-n:n-h.bottom)-1;if(h.left-1<=t&&h.right+1>=t&&c=(h.left+h.right)/2,i=n;if((X.chrome||X.gecko)&&M(e,a).getBoundingClientRect().left==h.right&&(i=!n),c<=0)return{node:e,offset:a+(i?1:0)};s=a+(i?1:0),r=c}}}return{node:e,offset:s>-1?s:o>0?e.nodeValue.length:0}}function Dt(e,t,n,i=-1){var s,r;let o,a=e.contentDOM.getBoundingClientRect(),l=a.top+e.viewState.paddingTop,{docHeight:h}=e.viewState,{x:c,y:u}=t,f=u-l;if(f<0)return 0;if(f>h)return e.state.doc.length;for(let t=e.viewState.heightOracle.textHeight/2,s=!1;o=e.elementAtHeight(f),o.type!=ue.Text;)for(;f=i>0?o.bottom+t:o.top-t,!(f>=0&&f<=h);){if(s)return n?null:0;s=!0,i=-i}u=l+f;let d=o.from;if(de.viewport.to)return e.viewport.to==e.state.doc.length?e.state.doc.length:n?null:Pt(e,a,o,c,u);let p=e.dom.ownerDocument,m=e.root.elementFromPoint?e.root:p,g=m.elementFromPoint(c,u);g&&!e.contentDOM.contains(g)&&(g=null),g||(c=Math.max(a.left+1,Math.min(a.right-1,c)),g=m.elementFromPoint(c,u),g&&!e.contentDOM.contains(g)&&(g=null));let b,y=-1;if(g&&0!=(null===(s=e.docView.nearest(g))||void 0===s?void 0:s.isEditable))if(p.caretPositionFromPoint){let e=p.caretPositionFromPoint(c,u);e&&({offsetNode:b,offset:y}=e)}else if(p.caretRangeFromPoint){let t=p.caretRangeFromPoint(c,u);t&&(({startContainer:b,startOffset:y}=t),(!e.contentDOM.contains(b)||X.safari&&function(e,t,n){let i;if(3!=e.nodeType||t!=(i=e.nodeValue.length))return!1;for(let t=e.nextSibling;t;t=t.nextSibling)if(1!=t.nodeType||"BR"!=t.nodeName)return!1;return M(e,i-1,i).getBoundingClientRect().left>n}(b,y,c)||X.chrome&&function(e,t,n){if(0!=t)return!1;for(let t=e;;){let e=t.parentNode;if(!e||1!=e.nodeType||e.firstChild!=t)return!1;if(e.classList.contains("cm-line"))break;t=e}return n-(1==e.nodeType?e.getBoundingClientRect():M(e,0,Math.max(e.nodeValue.length,1)).getBoundingClientRect()).left>5}(b,y,c))&&(b=void 0))}if(!b||!e.docView.dom.contains(b)){let t=ye.find(e.docView,d);if(!t)return f>o.top+o.height/2?o.to:o.from;({node:b,offset:y}=Nt(t.dom,c,u))}let v=e.docView.nearest(b);if(!v)return null;if(v.isWidget&&1==(null===(r=v.dom)||void 0===r?void 0:r.nodeType)){let e=v.dom.getBoundingClientRect();return t.y1.5*e.defaultLineHeight){let t=e.viewState.heightOracle.textHeight;o+=Math.floor((r-n.top-.5*(e.defaultLineHeight-t))/t)*e.viewState.heightOracle.lineLength}let a=e.state.sliceDoc(n.from,n.to);return n.from+(0,i.kn)(a,o,e.state.tabSize)}function Rt(e,t){let n=e.lineBlockAt(t);if(Array.isArray(n.type))for(let e of n.type)if(e.to>t||e.to==t&&(e.to==n.to||e.type==ue.Text))return e;return n}function jt(e,t,n,i){let s=e.state.doc.lineAt(t.head),r=e.bidiSpans(s),o=e.textDirectionAt(s.from);for(let a=t,l=null;;){let t=$e(s,r,o,a,n),h=ze;if(!t){if(s.number==(n?e.state.doc.lines:1))return a;h="\n",s=e.state.doc.line(s.number+(n?1:-1)),r=e.bidiSpans(s),t=e.visualLineSide(s,!n)}if(l){if(!l(h))return a}else{if(!i)return t;l=i(h)}a=t}}function It(e,t,n){for(;;){let i=0;for(let s of e)s.between(t-1,t+1,((e,s,r)=>{if(t>e&&tt(e))),n.from,t.head>n.from?-1:1);return s==n.from?n:i.OF.cursor(s,se)&&this.lineBreak(),i=s}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s,r=-1,o=1;if(this.lineSeparator?(r=t.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(s=i.exec(t))&&(r=s.index,o=s[0].length),this.append(t.slice(n,r<0?t.length:r)),r<0)break;if(this.lineBreak(),o>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=o-1);n=r+o}}readNode(e){if(e.cmIgnore)return;let t=j.get(e),n=t&&t.overrideDOMText;if(null!=n){this.findPointInside(e,n.length);for(let e=n.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else 3==e.nodeType?this.readTextNode(e):"BR"==e.nodeName?e.nextSibling&&this.lineBreak():1==e.nodeType&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(3==e.nodeType?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(zt(e,n.node,n.offset)?t:0))}}function zt(e,t,n){for(;;){if(!t||n-1;let{impreciseHead:r,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,n,0))){let t=r||o?[]:function(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:i,focusNode:s,focusOffset:r}=e.observer.selectionRange;return n&&(t.push(new $t(n,i)),s==n&&r==i||t.push(new $t(s,r))),t}(e),n=new Ft(t,e.state);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=function(e,t){if(0==e.length)return null;let n=e[0].pos,s=2==e.length?e[1].pos:n;return n>-1&&s>-1?i.OF.single(n+t,s+t):null}(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=r&&r.node==t.focusNode&&r.offset==t.focusOffset||!f(e.contentDOM,t.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),s=o&&o.node==t.anchorNode&&o.offset==t.anchorOffset||!f(e.contentDOM,t.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),a=e.viewport;if((X.ios||X.chrome)&&e.state.selection.main.empty&&n!=s&&(a.from>0||a.toDate.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:s,to:a}=t.bounds,l=r.from,h=null;(8===o||X.android&&t.text.length0&&a>0&&e.charCodeAt(o-1)==t.charCodeAt(a-1);)o--,a--;return"end"==i&&(n-=o+Math.max(0,r-Math.min(o,a))-r),o=o?r-n:0,a=r+(a-o),o=r):a=a?r-n:0,o=r+(o-a),a=r),{from:r,toA:o,toB:a}}(e.state.doc.sliceString(s,a,Bt),t.text,l-s,h);c&&(X.chrome&&13==o&&c.toB==c.from+2&&t.text.slice(c.from,c.toB)==Bt+Bt&&c.toB--,n={from:s+c.from,to:s+c.toA,insert:i.EY.of(t.text.slice(c.from,c.toB).split(Bt))})}else s&&(!e.hasFocus&&e.state.facet(rt)||s.main.eq(r))&&(s=null);if(!n&&!s)return!1;if(!n&&t.typeOver&&!r.empty&&s&&s.main.empty?n={from:r.from,to:r.to,insert:e.state.doc.slice(r.from,r.to)}:n&&n.from>=r.from&&n.to<=r.to&&(n.from!=r.from||n.to!=r.to)&&r.to-r.from-(n.to-n.from)<=4?n={from:r.from,to:r.to,insert:e.state.doc.slice(r.from,n.from).append(n.insert).append(e.state.doc.slice(n.to,r.to))}:(X.mac||X.android)&&n&&n.from==n.to&&n.from==r.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(s&&2==n.insert.length&&(s=i.OF.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:i.EY.of([" "])}):X.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(s&&(s=i.OF.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:i.EY.of([" "])}),n)return Vt(e,n,s,o);if(s&&!s.main.eq(r)){let t=!1,n="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(t=!0),n=e.inputState.lastSelectionOrigin),e.dispatch({selection:s,scrollIntoView:t,userEvent:n}),!0}return!1}function Vt(e,t,n,s=-1){if(X.ios&&e.inputState.flushIOSKey(t))return!0;let r=e.state.selection.main;if(X.android&&(t.to==r.to&&(t.from==r.from||t.from==r.from-1&&" "==e.state.sliceDoc(t.from,r.from))&&1==t.insert.length&&2==t.insert.lines&&_(e.contentDOM,"Enter",13)||(t.from==r.from-1&&t.to==r.to&&0==t.insert.length||8==s&&t.insert.lengthr.head)&&_(e.contentDOM,"Backspace",8)||t.from==r.from&&t.to==r.to+1&&0==t.insert.length&&_(e.contentDOM,"Delete",46)))return!0;let o,a=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let l=()=>o||(o=function(e,t,n){let s,r=e.state,o=r.selection.main;if(t.from>=o.from&&t.to<=o.to&&t.to-t.from>=(o.to-o.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=o.fromt.to?r.sliceDoc(t.to,o.to):"";s=r.replaceSelection(e.state.toText(n+t.insert.sliceString(0,void 0,e.state.lineBreak)+i))}else{let a=r.changes(t),l=n&&n.main.to<=a.newLength?n.main:void 0;if(r.selection.ranges.length>1&&e.inputState.composing>=0&&t.to<=o.to&&t.to>=o.to-10){let h,c=e.state.sliceDoc(t.from,t.to),u=n&&St(e,n.main.head);if(u){let e=t.insert.length-(t.to-t.from);h={from:u.from,to:u.to-e}}else h=e.state.doc.lineAt(o.head);let f=o.to-t.to,d=o.to-o.from;s=r.changeByRange((n=>{if(n.from==o.from&&n.to==o.to)return{changes:a,range:l||n.map(a)};let s=n.to-f,u=s-c.length;if(n.to-n.from!=d||e.state.sliceDoc(u,s)!=c||n.to>=h.from&&n.from<=h.to)return{range:n};let p=r.changes({from:u,to:s,insert:t.insert}),m=n.to-o.to;return{changes:p,range:l?i.OF.range(Math.max(0,l.anchor+m),Math.max(0,l.head+m)):n.map(p)}}))}else s={changes:a,selection:l&&r.selection.replaceRange(l)}}let a="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1)),r.update(s,{userEvent:a,scrollIntoView:!0})}(e,t,n));return e.state.facet(Ke).some((n=>n(e,t.from,t.to,a,l)))||e.dispatch(l()),!0}class Wt{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,X.safari&&e.contentDOM.addEventListener("input",(()=>null)),X.gecko&&function(e){vn.has(e)||(vn.add(e),e.addEventListener("copy",(()=>{})),e.addEventListener("cut",(()=>{})))}(e.contentDOM.ownerDocument)}handleEvent(e){(function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n,i=t.target;i!=e.contentDOM;i=i.parentNode)if(!i||11==i.nodeType||(n=j.get(i))&&n.ignoreEvent(t))return!1;return!0})(this.view,e)&&!this.ignoreDuringComposition(e)&&("keydown"==e.type&&this.keydown(e)||this.runHandlers(e.type,e))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let e of n.observers)e(this.view,t);for(let e of n.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=Ut(e),n=this.handlers,i=this.view.contentDOM;for(let e in t)if("scroll"!=e){let s=!t[e].handlers.length,r=n[e];r&&s!=!r.handlers.length&&(i.removeEventListener(e,this.handleEvent),r=null),r||i.addEventListener(e,this.handleEvent,{passive:s})}for(let e in n)"scroll"==e||t[e]||i.removeEventListener(e,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),9==e.keyCode&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&27!=e.keyCode&&Jt.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),X.android&&X.chrome&&!e.synthetic&&(13==e.keyCode||8==e.keyCode))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return!X.ios||e.synthetic||e.altKey||e.metaKey||!((t=Kt.find((t=>t.keyCode==e.keyCode)))&&!e.ctrlKey||Yt.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(229!=e.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=t||e,setTimeout((()=>this.flushIOSKey()),250),!0)}flushIOSKey(e){let t=this.pendingIOSKey;return!!t&&!("Enter"==t.key&&e&&e.from0||!!(X.safari&&!X.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Gt(e,t){return(n,i)=>{try{return t.call(e,i,n)}catch(e){st(n.state,e)}}}function Ut(e){let t=Object.create(null);function n(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec;if(e&&e.domEventHandlers)for(let i in e.domEventHandlers){let s=e.domEventHandlers[i];s&&n(i).handlers.push(Gt(t.value,s))}if(e&&e.domEventObservers)for(let i in e.domEventObservers){let s=e.domEventObservers[i];s&&n(i).observers.push(Gt(t.value,s))}}for(let e in Qt)n(e).handlers.push(Qt[e]);for(let e in en)n(e).observers.push(en[e]);return t}const Kt=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Yt="dthko",Jt=[16,17,18,20,91,92,224,225];function Xt(e){return.7*Math.max(0,e)+8}class Zt{constructor(e,t,n,s){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=function(e){let t,n,i=e.ownerDocument;for(let s=e.parentNode;s&&!(s==i.body||t&&n);)if(1==s.nodeType)!n&&s.scrollHeight>s.clientHeight&&(n=s),!t&&s.scrollWidth>s.clientWidth&&(t=s),s=s.assignedSlot||s.parentNode;else{if(11!=s.nodeType)break;s=s.host}return{x:t,y:n}}(e.contentDOM),this.atoms=e.state.facet(pt).map((t=>t(e)));let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(i.$t.allowMultipleSelections)&&function(e,t){let n=e.state.facet(qe);return n.length?n[0](t):X.mac?t.metaKey:t.ctrlKey}(e,t),this.dragging=!(!function(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let i=u(e.root);if(!i||0==i.rangeCount)return!0;let s=i.getRangeAt(0).getClientRects();for(let e=0;e=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}(e,t)||1!=dn(t))&&null}start(e){!1===this.dragging&&this.select(e)}move(e){if(0==e.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(t=this.startEvent,n=e,Math.max(Math.abs(t.clientX-n.clientX),Math.abs(t.clientY-n.clientY))<10))return;var t,n;this.select(this.lastEvent=e);let i=0,s=0,r=0,o=0,a=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:o,bottom:l}=this.scrollParents.y.getBoundingClientRect());let h=yt(this.view);e.clientX-h.left<=r+6?i=-Xt(r-e.clientX):e.clientX+h.right>=a-6&&(i=Xt(e.clientX-a)),e.clientY-h.top<=o+6?s=-Xt(o-e.clientY):e.clientY+h.bottom>=l-6&&(s=Xt(e.clientY-l)),this.setScrollSpeed(i,s)}up(e){null==this.dragging&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval((()=>this.scroll()),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),!1===this.dragging&&this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let n=0;ne.isUserEvent("input.type")))?this.destroy():this.style.update(e)&&setTimeout((()=>this.select(this.lastEvent)),20)}}const Qt=Object.create(null),en=Object.create(null),tn=X.ie&&X.ie_version<15||X.ios&&X.webkit_version<604;function nn(e,t,n){for(let i of e.facet(t))n=i(n,e);return n}function sn(e,t){t=nn(e.state,Je,t);let n,{state:s}=e,r=1,o=s.toText(t),a=o.lines==s.selection.ranges.length;if(null!=mn&&s.selection.ranges.every((e=>e.empty))&&mn==o.toString()){let e=-1;n=s.changeByRange((n=>{let l=s.doc.lineAt(n.from);if(l.from==e)return{range:n};e=l.from;let h=s.toText((a?o.line(r++).text:t)+s.lineBreak);return{changes:{from:l.from,insert:h},range:i.OF.cursor(n.from+h.length)}}))}else n=a?s.changeByRange((e=>{let t=o.line(r++);return{changes:{from:e.from,to:e.to,insert:t.text},range:i.OF.cursor(e.from+t.length)}})):s.replaceSelection(o);e.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}function rn(e,t,n,s){if(1==s)return i.OF.cursor(t,n);if(2==s)return function(e,t,n=1){let s=e.charCategorizer(t),r=e.doc.lineAt(t),o=t-r.from;if(0==r.length)return i.OF.cursor(t);0==o?n=1:o==r.length&&(n=-1);let a=o,l=o;n<0?a=(0,i.zK)(r.text,o,!1):l=(0,i.zK)(r.text,o);let h=s(r.text.slice(a,l));for(;a>0;){let e=(0,i.zK)(r.text,a,!1);if(s(r.text.slice(e,a))!=h)break;a=e}for(;l{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft},Qt.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),27==t.keyCode&&0!=e.inputState.tabFocusMode&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),en.touchstart=(e,t)=>{e.inputState.lastTouchTime=Date.now(),e.inputState.setSelectionOrigin("select.pointer")},en.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")},Qt.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let i of e.state.facet(We))if(n=i(e,t),n)break;if(n||0!=t.button||(n=function(e,t){let n=ln(e,t),s=dn(t),r=e.state.selection;return{update(e){e.docChanged&&(n.pos=e.changes.mapPos(n.pos),r=r.map(e.changes))},get(t,o,a){let l,h=ln(e,t),c=rn(e,h.pos,h.bias,s);if(n.pos!=h.pos&&!o){let t=rn(e,n.pos,n.bias,s),r=Math.min(t.from,c.from),o=Math.max(t.to,c.to);c=r1&&(l=function(e,t){for(let n=0;n=t)return i.OF.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}(r,h.pos))?l:a?r.addRange(c):i.OF.create([c])}}}(e,t)),n){let i=!e.hasFocus;e.inputState.startMouseSelection(new Zt(e,t,n,i)),i&&e.observer.ignore((()=>{O(e.contentDOM);let t=e.root.activeElement;t&&!t.contains(e.contentDOM)&&t.blur()}));let s=e.inputState.mouseSelection;if(s)return s.start(t),!1===s.dragging}return!1};let on=(e,t,n)=>t>=n.top&&t<=n.bottom&&e>=n.left&&e<=n.right;function an(e,t,n,i){let s=ye.find(e.docView,t);if(!s)return 1;let r=t-s.posAtStart;if(0==r)return 1;if(r==s.length)return-1;let o=s.coordsAt(r,-1);if(o&&on(n,i,o))return-1;let a=s.coordsAt(r,1);return a&&on(n,i,a)?1:o&&o.bottom>=i?-1:1}function ln(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1);return{pos:n,bias:an(e,n,t.clientX,t.clientY)}}const hn=X.ie&&X.ie_version<=11;let cn=null,un=0,fn=0;function dn(e){if(!hn)return e.detail;let t=cn,n=fn;return cn=e,fn=Date.now(),un=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(un+1)%3:1}function pn(e,t,n,i){if(!(n=nn(e.state,Je,n)))return;let s=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:r}=e.inputState,o=i&&r&&function(e,t){let n=e.state.facet(Ve);return n.length?n[0](t):X.mac?!t.altKey:!t.ctrlKey}(e,t)?{from:r.from,to:r.to}:null,a={from:s,insert:n},l=e.state.changes(o?[o,a]:a);e.focus(),e.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),e.inputState.draggedContent=null}Qt.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let s=e.docView.nearest(t.target);if(s&&s.isWidget){let e=s.posAtStart,t=e+s.length;(e>=n.to||t<=n.from)&&(n=i.OF.range(e,t))}}let{inputState:s}=e;return s.mouseSelection&&(s.mouseSelection.dragging=!0),s.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",nn(e.state,Xe,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1},Qt.dragend=e=>(e.inputState.draggedContent=null,!1),Qt.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let i=Array(n.length),s=0,r=()=>{++s==n.length&&pn(e,t,i.filter((e=>null!=e)).join(e.state.lineBreak),!1)};for(let e=0;e{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(i[e]=t.result),r()},t.readAsText(n[e])}return!0}{let n=t.dataTransfer.getData("Text");if(n)return pn(e,t,n,!0),!0}return!1},Qt.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=tn?null:t.clipboardData;return n?(sn(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(function(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout((()=>{e.focus(),n.remove(),sn(e,n.value)}),50)}(e),!1)};let mn=null;Qt.copy=Qt.cut=(e,t)=>{let{text:n,ranges:i,linewise:s}=function(e){let t=[],n=[],i=!1;for(let i of e.selection.ranges)i.empty||(t.push(e.sliceDoc(i.from,i.to)),n.push(i));if(!t.length){let s=-1;for(let{from:i}of e.selection.ranges){let r=e.doc.lineAt(i);r.number>s&&(t.push(r.text),n.push({from:r.from,to:Math.min(e.doc.length,r.to+1)})),s=r.number}i=!0}return{text:nn(e,Xe,t.join(e.lineBreak)),ranges:n,linewise:i}}(e.state);if(!n&&!s)return!1;mn=s?n:null,"cut"!=t.type||e.state.readOnly||e.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let r=tn?null:t.clipboardData;return r?(r.clearData(),r.setData("text/plain",n),!0):(function(e,t){let n=e.dom.parentNode;if(!n)return;let i=n.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=t,i.focus(),i.selectionEnd=t.length,i.selectionStart=0,setTimeout((()=>{i.remove(),e.focus()}),50)}(e,n),!1)};const gn=i.YH.define();function bn(e,t){let n=[];for(let i of e.facet(Ye)){let s=i(e,t);s&&n.push(s)}return n?e.update({effects:n,annotations:gn.of(!0)}):null}function yn(e){setTimeout((()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=bn(e.state,t);n?e.dispatch(n):e.update([])}}),10)}en.focus=e=>{e.inputState.lastFocusTime=Date.now(),e.scrollDOM.scrollTop||!e.inputState.lastScrollTop&&!e.inputState.lastScrollLeft||(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),yn(e)},en.blur=e=>{e.observer.clearSelectionRange(),yn(e)},en.compositionstart=en.compositionupdate=e=>{e.observer.editContext||(null==e.inputState.compositionFirstChange&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))},en.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,X.chrome&&X.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then((()=>e.observer.flush())):setTimeout((()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])}),50))},en.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},Qt.beforeinput=(e,t)=>{var n,i;if("insertReplacementText"==t.inputType&&e.observer.editContext){let i=null===(n=t.dataTransfer)||void 0===n?void 0:n.getData("text/plain"),s=t.getTargetRanges();if(i&&s.length){let t=s[0],n=e.posAtDOM(t.startContainer,t.startOffset),r=e.posAtDOM(t.endContainer,t.endOffset);return Vt(e,{from:n,to:r,insert:e.state.toText(i)},null),!0}}let s;if(X.chrome&&X.android&&(s=Kt.find((e=>e.inputType==t.inputType)))&&(e.observer.delayAndroidKey(s.key,s.keyCode),"Backspace"==s.key||"Delete"==s.key)){let t=(null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0;setTimeout((()=>{var n;((null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())}),100)}return X.ios&&"deleteContentForward"==t.inputType&&e.observer.flushSoon(),X.safari&&"insertText"==t.inputType&&e.inputState.composing>=0&&setTimeout((()=>en.compositionend(e,t)),20),!1};const vn=new Set,xn=["pre-wrap","normal","pre-line","break-spaces"];let wn=!1;function kn(){wn=!1}class Sn{constructor(e){this.lineWrapping=e,this.doc=i.EY.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return xn.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n-1,a=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=t,this.charWidth=n,this.textHeight=i,this.lineLength=s,a){this.heightSamples={};for(let e=0;e0}set outdated(e){this.flags=(e?2:0)|-3&this.flags}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Mn&&(wn=!0),this.height=e)}replace(e,t,n){return _n.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,i){let s=this,r=n.doc;for(let o=i.length-1;o>=0;o--){let{fromA:a,toA:l,fromB:h,toB:c}=i[o],u=s.lineAt(a,On.ByPosNoHeight,n.setDoc(t),0,0),f=u.to>=l?u:s.lineAt(l,On.ByPosNoHeight,n,0,0);for(c+=f.to-l,l=f.to;o>0&&u.from<=i[o-1].toA;)a=i[o-1].fromA,h=i[o-1].fromB,o--,a2*s){let s=e[t-1];s.break?e.splice(--t,1,s.left,null,s.right):e.splice(--t,1,s.left,s.right),n+=1+s.break,i-=s.size}else{if(!(s>2*i))break;{let t=e[n];t.break?e.splice(n,1,t.left,null,t.right):e.splice(n,1,t.left,t.right),n+=2+t.break,s-=t.size}}else if(i=s&&r(this.blockAt(0,n,i,s))}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more&&this.setHeight(i.heights[i.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class En extends Nn{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,n,i){return new An(i,this.length,n,this.height,this.breaks)}replace(e,t,n){let i=n[0];return 1==n.length&&(i instanceof En||i instanceof Dn&&4&i.flags)&&Math.abs(this.length-i.length)<10?(i instanceof Dn?i=new En(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):_n.of(n)}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more?this.setHeight(i.heights[i.index++]):(n||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Dn extends _n{constructor(e){super(e,0)}heightMetrics(e,t){let n,i=e.doc.lineAt(t).number,s=e.doc.lineAt(t+this.length).number,r=s-i+1,o=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*r);n=t/r,this.length>r+1&&(o=(this.height-t)/(this.length-r-1))}else n=this.height/r;return{firstLine:i,lastLine:s,perLine:n,perChar:o}}blockAt(e,t,n,i){let{firstLine:s,lastLine:r,perLine:o,perChar:a}=this.heightMetrics(t,i);if(t.lineWrapping){let s=i+(e0){let e=n[n.length-1];e instanceof Dn?n[n.length-1]=new Dn(e.length+i):n.push(null,new Dn(i-1))}if(e>0){let t=n[0];t instanceof Dn?n[0]=new Dn(e+t.length):n.unshift(new Dn(e-1),null)}return _n.of(n)}decomposeLeft(e,t){t.push(new Dn(e-1),null)}decomposeRight(e,t){t.push(null,new Dn(this.length-e-1))}updateHeight(e,t=0,n=!1,i){let s=t+this.length;if(i&&i.from<=t+this.length&&i.more){let n=[],r=Math.max(t,i.from),o=-1;for(i.from>t&&n.push(new Dn(i.from-t-1).updateHeight(e,t));r<=s&&i.more;){let t=e.doc.lineAt(r).length;n.length&&n.push(null);let s=i.heights[i.index++];-1==o?o=s:Math.abs(s-o)>=Mn&&(o=-2);let a=new En(t,s);a.outdated=!1,n.push(a),r+=t+1}r<=s&&n.push(null,new Dn(s-r).updateHeight(e,r));let a=_n.of(n);return(o<0||Math.abs(a.height-this.height)>=Mn||Math.abs(o-this.heightMetrics(e,t).perLine)>=Mn)&&(wn=!0),Tn(this,a)}return(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class Pn extends _n{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return 1&this.flags}blockAt(e,t,n,i){let s=n+this.left.height;return eo))return l;let h=t==On.ByPosNoHeight?On.ByPosNoHeight:On.ByPos;return a?l.join(this.right.lineAt(o,h,n,r,o)):this.left.lineAt(o,h,n,i,s).join(l)}forEachLine(e,t,n,i,s,r){let o=i+this.left.height,a=s+this.left.length+this.break;if(this.break)e=a&&this.right.forEachLine(e,t,n,o,a,r);else{let l=this.lineAt(a,On.ByPos,n,i,s);e=e&&l.from<=t&&r(l),t>l.to&&this.right.forEachLine(l.to+1,t,n,o,a,r)}}replace(e,t,n){let i=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-i,t-i,n));let s=[];e>0&&this.decomposeLeft(e,s);let r=s.length;for(let e of n)s.push(e);if(e>0&&Rn(s,r-1),t=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,i=n+this.break;if(e>=i)return this.right.decomposeRight(e-i,t);e2*t.size||t.size>2*e.size?_n.of(this.break?[e,null,t]:[e,t]):(this.left=Tn(this.left,e),this.right=Tn(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,i){let{left:s,right:r}=this,o=t+s.length+this.break,a=null;return i&&i.from<=t+s.length&&i.more?a=s=s.updateHeight(e,t,n,i):s.updateHeight(e,t,n),i&&i.from<=o+r.length&&i.more?a=r=r.updateHeight(e,o,n,i):r.updateHeight(e,o,n),a?this.balanced(s,r):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Rn(e,t){let n,i;null==e[t]&&(n=e[t-1])instanceof Dn&&(i=e[t+1])instanceof Dn&&e.splice(t-1,3,new Dn(n.length+1+i.length))}class jn{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let e=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof En?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new En(e-this.pos,-1)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e=5)&&this.addLineDeco(i,s,r)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenToe&&this.nodes.push(new En(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let n=new Dn(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof En)return e;let t=new En(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let i=this.ensureLine();i.length+=n,i.collapsed+=n,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||t instanceof En||this.isCovered?(this.writtenTon.clientHeight||n.scrollWidth>n.clientWidth)&&"visible"!=i.overflow){let i=n.getBoundingClientRect();r=Math.max(r,i.left),o=Math.min(o,i.right),a=Math.max(a,i.top),l=Math.min(t==e.parentNode?s.innerHeight:l,i.bottom)}t="absolute"==i.position||"fixed"==i.position?n.offsetParent:n.parentNode}else{if(11!=t.nodeType)break;t=t.host}return{left:r-n.left,right:Math.max(r,o)-n.left,top:a-(n.top+t),bottom:Math.max(a,l)-(n.top+t)}}function Bn(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class Fn{constructor(e,t,n){this.from=e,this.to=t,this.size=n}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n"function"!=typeof e&&"cm-lineWrapping"==e.class));this.heightOracle=new Sn(t),this.stateDeco=e.facet(ft).filter((e=>"function"!=typeof e)),this.heightMap=_n.empty().applyChanges(this.stateDeco,i.EY.empty,this.heightOracle.setDoc(e.doc),[new xt(0,0,0,e.doc.length)]);for(let e=0;e<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());e++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=fe.set(this.lineGaps.map((e=>e.draw(this,!1)))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let i=n?t.head:t.anchor;if(!e.some((({from:e,to:t})=>i>=e&&i<=t))){let{from:t,to:n}=this.lineBlockAt(i);e.push(new Hn(t,n))}}return this.viewports=e.sort(((e,t)=>e.from-t.from)),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Wn:new Gn(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,(e=>{this.viewportLines.push(Un(e,this.scaler))}))}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet(ft).filter((e=>"function"!=typeof e));let s=e.changedRanges,r=xt.extendWithRanges(s,function(e,t,n){let s=new In;return i.om.compare(e,t,n,s,0),s.changes}(n,this.stateDeco,e?e.changes:i.VR.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);kn(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=o||wn)&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let l=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.headl.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,t));let h=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,e.flags|=this.updateForViewport(),(h||!e.changes.empty||2&e.flags)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Qe)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),s=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Ce.RTL:Ce.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),a=t.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let h=0,c=0;if(a.width&&a.height){let{scaleX:e,scaleY:n}=k(t,a);(e>.005&&Math.abs(this.scaleX-e)>.005||n>.005&&Math.abs(this.scaleY-n)>.005)&&(this.scaleX=e,this.scaleY=n,h|=8,o=l=!0)}let u=(parseInt(n.paddingTop)||0)*this.scaleY,f=(parseInt(n.paddingBottom)||0)*this.scaleY;this.paddingTop==u&&this.paddingBottom==f||(this.paddingTop=u,this.paddingBottom=f,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=N(e.scrollDOM);let p=(this.printing?Bn:Ln)(t,this.paddingTop),m=p.top-this.pixelViewport.top,g=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let b=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(b!=this.inView&&(this.inView=b,b&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let y=a.width;if(this.contentDOMWidth==y&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),l){let t=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(t)&&(o=!0),o||s.lineWrapping&&Math.abs(y-this.contentDOMWidth)>s.charWidth){let{lineHeight:n,charWidth:i,textHeight:a}=e.docView.measureTextSize();o=n>0&&s.refresh(r,n,i,a,y/i,t),o&&(e.docView.minWidth=0,h|=8)}m>0&&g>0?c=Math.max(m,g):m<0&&g<0&&(c=Math.min(m,g)),kn();for(let n of this.viewports){let r=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(o?_n.empty().applyChanges(this.stateDeco,i.EY.empty,this.heightOracle,[new xt(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new Cn(n.from,r))}wn&&(h|=2)}let v=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return v&&(2&h&&(h|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),h|=this.updateForViewport()),(2&h||v)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,s=this.heightOracle,{visibleTop:r,visibleBottom:o}=this,a=new Hn(i.lineAt(r-1e3*n,On.ByHeight,s,0,0).from,i.lineAt(o+1e3*(1-n),On.ByHeight,s,0,0).to);if(t){let{head:e}=t.range;if(ea.to){let n,r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=i.lineAt(e,On.ByPos,s,0,0);n="center"==t.y?(o.top+o.bottom)/2-r/2:"start"==t.y||"nearest"==t.y&&e=o+Math.max(10,Math.min(n,250)))&&i>r-2e3&&s>1,o=s<<1;if(this.defaultTextDirection!=Ce.LTR&&!n)return[];let a=[],l=(s,o,h,c)=>{if(o-ss&&ee.from>=h.from&&e.to<=h.to&&Math.abs(e.from-s)e.fromt))));if(!d){if(oe.from<=o&&e.to>=o))){let e=t.moveToLineBoundary(i.OF.cursor(o),!1,!0).head;e>s&&(o=e)}d=new Fn(s,o,this.gapSize(h,s,o,c))}a.push(d)},h=e=>{if(e.lengthr&&(s.push({from:r,to:e}),o+=e-r),r=t}},20),re.from&&l(e.from,r,e,t),ae.draw(this,this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let t=[];i.om.spans(e,this.viewport.from,this.viewport.to,{span(e,n){t.push({from:e,to:n})},point(){}},20);let n=t.length!=this.visibleRanges.length||this.visibleRanges.some(((e,n)=>e.from!=t[n].from||e.to!=t[n].to));return this.visibleRanges=t,n?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find((t=>t.from<=e&&t.to>=e))||Un(this.heightMap.lineAt(e,On.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find((t=>t.top<=e&&t.bottom>=e))||Un(this.heightMap.lineAt(this.scaler.fromDOM(e),On.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Un(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Hn{constructor(e,t){this.from=e,this.to=t}}function qn({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let i=Math.floor(e*n);for(let e=0;;e++){let{from:n,to:s}=t[e],r=s-n;if(i<=r)return n+i;i-=r}}function Vn(e,t){let n=0;for(let{from:i,to:s}of e.ranges){if(t<=s){n+=t-i;break}n+=s-i}return n/e.total}const Wn={toDOM:e=>e,fromDOM:e=>e,scale:1,eq(e){return e==this}};class Gn{constructor(e,t,n){let i=0,s=0,r=0;this.viewports=n.map((({from:n,to:s})=>{let r=t.lineAt(n,On.ByPos,e,0,0).top,o=t.lineAt(s,On.ByPos,e,0,0).bottom;return i+=o-r,{from:n,to:s,top:r,bottom:o,domTop:0,domBottom:0}})),this.scale=(7e6-i)/(t.height-i);for(let e of this.viewports)e.domTop=r+(e.top-s)*this.scale,r=e.domBottom=e.domTop+(e.bottom-e.top),s=e.bottom}toDOM(e){for(let t=0,n=0,i=0;;t++){let s=tt.from==e.viewports[n].from&&t.to==e.viewports[n].to))}}function Un(e,t){if(1==t.scale)return e;let n=t.toDOM(e.top),i=t.toDOM(e.bottom);return new An(e.from,e.length,n,i-n,Array.isArray(e._content)?e._content.map((e=>Un(e,t))):e._content)}const Kn=i.sj.define({combine:e=>e.join(" ")}),Yn=i.sj.define({combine:e=>e.indexOf(!0)>-1}),Jn=s.G.newName(),Xn=s.G.newName(),Zn=s.G.newName(),Qn={"&light":"."+Xn,"&dark":"."+Zn};function ei(e,t,n){return new s.G(t,{finish:t=>/&/.test(t)?t.replace(/&\w*/,(t=>{if("&"==t)return e;if(!n||!n[t])throw new RangeError(`Unsupported selector: ${t}`);return n[t]})):e+" "+t})}const ti=ei("."+Jn,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Qn),ni={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},ii=X.ie&&X.ie_version<=11;class si{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new S,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver((t=>{for(let e of t)this.queue.push(e);(X.ie&&X.ie_version<=11||X.ios&&e.composing)&&t.some((e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length))?this.flushSoon():this.flush()})),!window.EditContext||!1===e.constructor.EDIT_CONTEXT||X.chrome&&X.chrome_version<126||(this.editContext=new ai(e),e.state.facet(rt)&&(e.contentDOM.editContext=this.editContext.editContext)),ii&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver((()=>{var e;(null===(e=this.view.docView)||void 0===e?void 0:e.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))}),{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver((e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))}),{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout((()=>{this.resizeTimeout=-1,this.view.requestMeasure()}),50))}onPrint(e){("change"!=e.type&&e.type||e.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout((()=>{this.view.viewState.printing=!1,this.view.requestMeasure()}),500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some(((t,n)=>t!=e[n])))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,i=this.selectionRange;if(n.state.facet(rt)?n.root.activeElement!=this.dom:!d(n.dom,i))return;let s=i.anchorNode&&n.docView.nearest(i.anchorNode);s&&s.ignoreEvent(e)?t||(this.selectionChanged=!1):(X.ie&&X.ie_version<=11||X.android&&X.chrome)&&!n.state.selection.main.empty&&i.focusNode&&m(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=u(e.root);if(!t)return!1;let n=X.safari&&11==e.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return oi(e,n)}let n=null;function i(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",i,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",i,!0),n?oi(e,n):null}(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let i=d(this.dom,n);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let e=this.delayedAndroidKey;e&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&_(this.dom,e.key,e.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}this.delayedAndroidKey&&"Enter"!=e||(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange{this.delayedFlush=-1,this.flush()})))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,i=!1;for(let s of e){let e=this.readMutation(s);e&&(e.typeOver&&(i=!0),-1==t?({from:t,to:n}=e):(t=Math.min(e.from,t),n=Math.max(e.to,n)))}return{from:t,to:n,typeOver:i}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),i=this.selectionChanged&&d(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new Ht(this.view,e,t,n);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,i=qt(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),i}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty("attributes"==e.type),"attributes"==e.type&&(t.flags|=4),"childList"==e.type){let n=ri(t,e.previousSibling||e.target.previousSibling,-1),i=ri(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:i?t.posBefore(i):t.posAtEnd,typeOver:!1}}return"characterData"==e.type?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(rt)!=e.state.facet(rt)&&(e.view.contentDOM.editContext=e.state.facet(rt)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),null===(e=this.intersection)||void 0===e||e.disconnect(),null===(t=this.gapIntersection)||void 0===t||t.disconnect(),null===(n=this.resizeScroll)||void 0===n||n.disconnect();for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function ri(e,t,n){for(;t;){let i=j.get(t);if(i&&i.parent==e)return i;let s=t.parentNode;t=s!=e.dom?s:n>0?t.nextSibling:t.previousSibling}return null}function oi(e,t){let n=t.startContainer,i=t.startOffset,s=t.endContainer,r=t.endOffset,o=e.docView.domAtPos(e.state.selection.main.anchor);return m(o.node,o.offset,s,r)&&([n,i,s,r]=[s,r,n,i]),{anchorNode:n,anchorOffset:i,focusNode:s,focusOffset:r}}class ai{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=t=>{let{anchor:n}=e.state.selection.main,s={from:this.toEditorPos(t.updateRangeStart),to:this.toEditorPos(t.updateRangeEnd),insert:i.EY.of(t.text.split("\n"))};s.from==this.from&&nthis.to&&(s.to=n),(s.from!=s.to||s.insert.length)&&(this.pendingContextChange=s,e.state.readOnly||Vt(e,s,i.OF.single(this.toEditorPos(t.selectionStart),this.toEditorPos(t.selectionEnd))),this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)))},this.handlers.characterboundsupdate=n=>{let i=[],s=null;for(let t=this.toEditorPos(n.rangeStart),r=this.toEditorPos(n.rangeEnd);t{let n=[];for(let e of t.getTextFormats()){let t=e.underlineStyle,i=e.underlineThickness;if("None"!=t&&"None"!=i){let s=`text-decoration: underline ${"Dashed"==t?"dashed ":"Squiggle"==t?"wavy ":""}${"Thin"==i?1:2}px`;n.push(fe.mark({attributes:{style:s}}).range(this.toEditorPos(e.rangeStart),this.toEditorPos(e.rangeEnd)))}}e.dispatch({effects:it.of(fe.set(n))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{e.inputState.composing=-1,e.inputState.compositionFirstChange=null};for(let e in this.handlers)t.addEventListener(e,this.handlers[e]);this.measureReq={read:e=>{this.editContext.updateControlBounds(e.contentDOM.getBoundingClientRect());let t=u(e.root);t&&t.rangeCount&&this.editContext.updateSelectionBounds(t.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,i=this.pendingContextChange;return e.changes.iterChanges(((s,r,o,a,l)=>{if(n)return;let h=l.length-(r-s);if(i&&r>=i.to){if(i.from==s&&i.to==r&&i.insert.eq(l))return i=this.pendingContextChange=null,t+=h,void(this.to+=h);i=null,this.revertPending(e.state)}if(s+=t,(r+=t)<=this.from)this.from+=h,this.to+=h;else if(sthis.to||this.to-this.from+l.length>3e4)return void(n=!0);this.editContext.updateText(this.toContextPos(s),this.toContextPos(r),l.toString()),this.to+=h}t+=h})),i&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange;this.applyEdits(e)&&this.rangeIsValid(e.state)?(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state):(this.pendingContextChange=null,this.resetRange(e.state),this.editContext.updateText(0,this.editContext.text.length,e.state.doc.sliceString(this.from,this.to)),this.setSelection(e.state)),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),i=this.toContextPos(t.head);this.editContext.selectionStart==n&&this.editContext.selectionEnd==i||this.editContext.updateSelection(n,i)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to3e4)}toEditorPos(e){return e+this.from}toContextPos(e){return e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class li{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(e=>e.forEach((e=>n(e,this))))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||function(e){for(;e;){if(e&&(9==e.nodeType||11==e.nodeType&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}(e.parent)||document,this.viewState=new $n(e.state||i.$t.create(e)),e.scrollTo&&e.scrollTo.is(nt)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(at).map((e=>new ht(e)));for(let e of this.plugins)e.update(this);this.observer=new si(this),this.inputState=new Wt(this),this.inputState.ensureHandlers(this.plugins),this.docView=new kt(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),(null===(t=document.fonts)||void 0===t?void 0:t.ready)&&document.fonts.ready.then((()=>this.requestMeasure()))}dispatch(...e){let t=1==e.length&&e[0]instanceof i.ZX?e:1==e.length&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t,n=!1,s=!1,r=this.state;for(let t of e){if(t.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=t.state}if(this.destroyed)return void(this.viewState.state=r);let o=this.hasFocus,a=0,l=null;e.some((e=>e.annotation(gn)))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=bn(r,o),l||(a=1));let h=this.observer.delayedAndroidKey,c=null;if(h?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(c=null)):this.observer.clear(),r.facet(i.$t.phrases)!=this.state.facet(i.$t.phrases))return this.setState(r);t=wt.create(this,r,e),t.flags|=a;let u=this.viewState.scrollTarget;try{this.updateState=2;for(let t of e){if(u&&(u=u.map(t.changes)),t.scrollIntoView){let{main:e}=t.state.selection;u=new tt(e.empty?e:i.OF.cursor(e.head,e.head>e.anchor?-1:1))}for(let e of t.effects)e.is(nt)&&(u=e.value.clip(this.state))}this.viewState.update(t,u),this.bidiCache=ui.update(this.bidiCache,t.changes),t.empty||(this.updatePlugins(t),this.inputState.update(t)),n=this.docView.update(t),this.state.facet(vt)!=this.styleModules&&this.mountStyles(),s=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some((e=>e.isUserEvent("select.pointer"))))}finally{this.updateState=0}if(t.startState.facet(Kn)!=t.state.facet(Kn)&&(this.viewState.mustMeasureContent=!0),(n||s||u||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!t.empty)for(let e of this.state.facet(Ue))try{e(t)}catch(e){st(this.state,e,"update listener")}(l||c)&&Promise.resolve().then((()=>{l&&this.state==l.startState&&this.dispatch(l),c&&!qt(this,c)&&h.force&&_(this.contentDOM,h.key,h.keyCode)}))}setState(e){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=e);this.updateState=2;let t=this.hasFocus;try{for(let e of this.plugins)e.destroy(this);this.viewState=new $n(e),this.plugins=e.facet(at).map((e=>new ht(e))),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new kt(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(at),n=e.state.facet(at);if(t!=n){let i=[];for(let s of n){let n=t.indexOf(s);if(n<0)i.push(new ht(s));else{let t=this.plugins[n];t.mustUpdate=e,i.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.scrollDOM,i=n.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:r}=this.viewState;Math.abs(i-this.viewState.scrollTop)>1&&(r=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(r<0)if(N(n))s=-1,r=this.viewState.heightMap.height;else{let e=this.viewState.scrollAnchorAt(i);s=e.from,r=e.top}this.updateState=1;let o=this.viewState.measure(this);if(!o&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(e>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let a=[];4&o||([this.measureRequests,a]=[a,this.measureRequests]);let l=a.map((e=>{try{return e.read(this)}catch(e){return st(this.state,e),ci}})),h=wt.create(this,this.state,[]),c=!1;h.flags|=o,t?t.flags|=o:t=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),c=this.docView.update(h),c&&this.docViewUpdate());for(let e=0;e1||e<-1){i+=e,n.scrollTop=i/this.scaleY,r=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(Ue))e(t)}get themeClasses(){return Jn+" "+(this.state.facet(Yn)?Zn:Xn)+" "+this.state.facet(Kn)}updateAttrs(){let e=fi(this,ct,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(rt)?"true":"false",class:"cm-content",style:`${X.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),fi(this,ut,t);let n=this.observer.ignore((()=>{let n=le(this.contentDOM,this.contentAttrs,t),i=le(this.dom,this.editorAttrs,e);return n||i}));return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let e of n.effects)e.is(li.announce)&&(t&&(this.announceDOM.textContent=""),t=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=e.value)}mountStyles(){this.styleModules=this.state.facet(vt);let e=this.state.facet(li.cspNonce);s.G.mount(this.root,this.styleModules.concat(ti).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame((()=>this.measure()))),e){if(this.measureRequests.indexOf(e)>-1)return;if(null!=e.key)for(let t=0;tt.spec==e))||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return Lt(this,e,jt(this,e,t,n))}moveByGroup(e,t){return Lt(this,e,jt(this,e,t,(t=>function(e,t,n){let s=e.state.charCategorizer(t),r=s(n);return e=>{let t=s(e);return r==i.Je.Space&&(r=t),r==t}}(this,e.head,t))))}visualLineSide(e,t){let n=this.bidiSpans(e),s=this.textDirectionAt(e.from),r=n[t?n.length-1:0];return i.OF.cursor(r.side(t,s)+e.from,r.forward(!t,s)?1:-1)}moveToLineBoundary(e,t,n=!0){return function(e,t,n,s){let r=Rt(e,t.head),o=s&&r.type==ue.Text&&(e.lineWrapping||r.widgetLineBreaks)?e.coordsAtPos(t.assoc<0&&t.head>r.from?t.head-1:t.head):null;if(o){let t=e.dom.getBoundingClientRect(),s=e.textDirectionAt(r.from),a=e.posAtCoords({x:n==(s==Ce.LTR)?t.right-1:t.left+1,y:(o.top+o.bottom)/2});if(null!=a)return i.OF.cursor(a,n?-1:1)}return i.OF.cursor(n?r.to:r.from,n?-1:1)}(this,e,t,n)}moveVertically(e,t,n){return Lt(this,e,function(e,t,n,s){let r=t.head,o=n?1:-1;if(r==(n?e.state.doc.length:0))return i.OF.cursor(r,t.assoc);let a,l=t.goalColumn,h=e.contentDOM.getBoundingClientRect(),c=e.coordsAtPos(r,t.assoc||-1),u=e.documentTop;if(c)null==l&&(l=c.left-h.left),a=o<0?c.top:c.bottom;else{let t=e.viewState.lineBlockAt(r);null==l&&(l=Math.min(h.right-h.left,e.defaultCharacterWidth*(r-t.from))),a=(o<0?t.top:t.bottom)+u}let f=h.left+l,d=null!=s?s:e.viewState.heightOracle.textHeight>>1;for(let t=0;;t+=10){let n=a+(d+t)*o,s=Dt(e,{x:f,y:n},!1,o);if(nh.bottom||(o<0?sr)){let t=e.docView.coordsForChar(s),r=!t||n0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(Ze)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>hi)return Fe(e.length);let t,n=this.textDirectionAt(e.from);for(let i of this.bidiCache)if(i.from==e.from&&i.dir==n&&(i.fresh||je(i.isolates,t=gt(this,e))))return i.order;t||(t=gt(this,e));let i=function(e,t,n){if(!e)return[new Re(0,0,t==Oe?1:0)];if(t==Ae&&!n.length&&!Pe.test(e))return Fe(e.length);if(n.length)for(;e.length>Ie.length;)Ie[Ie.length]=256;let i=[],s=t==Ae?0:1;return Be(e,s,s,n,0,e.length,i),i}(e.text,n,t);return this.bidiCache.push(new ui(e.from,e.to,n,t,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||X.safari&&(null===(e=this.inputState)||void 0===e?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{O(this.contentDOM),this.docView.updateSelection()}))}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((9==e.nodeType?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return nt.of(new tt("number"==typeof e?i.OF.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return nt.of(new tt(i.OF.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){null==e?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:"boolean"==typeof e?this.inputState.tabFocusMode=e?0:-1:0!=this.inputState.tabFocusMode&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return lt.define((()=>({})),{eventHandlers:e})}static domEventObservers(e){return lt.define((()=>({})),{eventObservers:e})}static theme(e,t){let n=s.G.newName(),i=[Kn.of(n),vt.of(ei(`.${n}`,e))];return t&&t.dark&&i.push(Yn.of(!0)),i}static baseTheme(e){return i.Nb.lowest(vt.of(ei("."+Jn,e,Qn)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),i=n&&j.get(n)||j.get(e);return(null===(t=null==i?void 0:i.rootView)||void 0===t?void 0:t.view)||null}}li.styleModule=vt,li.inputHandler=Ke,li.clipboardInputFilter=Je,li.clipboardOutputFilter=Xe,li.scrollHandler=et,li.focusChangeEffect=Ye,li.perLineTextDirection=Ze,li.exceptionSink=Ge,li.updateListener=Ue,li.editable=rt,li.mouseSelectionStyle=We,li.dragMovesSelection=Ve,li.clickAddsSelectionRange=qe,li.decorations=ft,li.outerDecorations=dt,li.atomicRanges=pt,li.bidiIsolatedRanges=mt,li.scrollMargins=bt,li.darkTheme=Yn,li.cspNonce=i.sj.define({combine:e=>e.length?e[0]:""}),li.contentAttributes=ut,li.editorAttributes=ct,li.lineWrapping=li.contentAttributes.of({class:"cm-lineWrapping"}),li.announce=i.Pe.define();const hi=4096,ci={};class ui{constructor(e,t,n,i,s,r){this.from=e,this.to=t,this.dir=n,this.isolates=i,this.fresh=s,this.order=r}static update(e,t){if(t.empty&&!e.some((e=>e.fresh)))return e;let n=[],i=e.length?e[e.length-1].dir:Ce.LTR;for(let s=Math.max(0,e.length-10);s=0;s--){let t=i[s],r="function"==typeof t?t(e):t;r&&re(r,n)}return n}const di=X.mac?"mac":X.windows?"win":X.linux?"linux":"key";function pi(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),!1!==n&&t.shiftKey&&(e="Shift-"+e),e}const mi=i.Nb.default(li.domEventHandlers({keydown:(e,t)=>Si(yi(t.state),e,t,"editor")})),gi=i.sj.define({enables:mi}),bi=new WeakMap;function yi(e){let t=e.facet(gi),n=bi.get(t);return n||bi.set(t,n=function(e,t=di){let n=Object.create(null),i=Object.create(null),s=(e,t)=>{let n=i[e];if(null==n)i[e]=t;else if(n!=t)throw new Error("Key binding "+e+" is used both as a regular binding and as a multi-stroke prefix")},r=(e,i,r,o,a)=>{var l,h;let c=n[e]||(n[e]=Object.create(null)),u=i.split(/ (?!$)/).map((e=>function(e,t){const n=e.split(/-(?!$)/);let i,s,r,o,a=n[n.length-1];"Space"==a&&(a=" ");for(let e=0;e{let i=xi={view:t,prefix:n,scope:e};return setTimeout((()=>{xi==i&&(xi=null)}),wi),!0}]})}let f=u.join(" ");s(f,!1);let d=c[f]||(c[f]={preventDefault:!1,stopPropagation:!1,run:(null===(h=null===(l=c._any)||void 0===l?void 0:l.run)||void 0===h?void 0:h.slice())||[]});r&&d.run.push(r),o&&(d.preventDefault=!0),a&&(d.stopPropagation=!0)};for(let i of e){let e=i.scope?i.scope.split(" "):["editor"];if(i.any)for(let t of e){let e=n[t]||(n[t]=Object.create(null));e._any||(e._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:s}=i;for(let t in e)e[t].run.push((e=>s(e,ki)))}let s=i[t]||i.key;if(s)for(let t of e)r(t,s,i.run,i.preventDefault,i.stopPropagation),i.shift&&r(t,"Shift-"+s,i.shift,i.preventDefault,i.stopPropagation)}return n}(t.reduce(((e,t)=>e.concat(t)),[]))),n}function vi(e,t,n){return Si(yi(e.state),t,e,n)}let xi=null;const wi=4e3;let ki=null;function Si(e,t,n,s){ki=t;let h=function(e){var t=!(a&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||l&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?o:r)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(t),c=(0,i.vS)(h,0),u=(0,i.Fh)(c)==h.length&&" "!=h,f="",d=!1,p=!1,m=!1;xi&&xi.view==n&&xi.scope==s&&(f=xi.prefix+" ",Jt.indexOf(t.keyCode)<0&&(p=!0,xi=null));let g,b,y=new Set,v=e=>{if(e){for(let t of e.run)if(!y.has(t)&&(y.add(t),t(n)))return e.stopPropagation&&(m=!0),!0;e.preventDefault&&(e.stopPropagation&&(m=!0),p=!0)}return!1},x=e[s];return x&&(v(x[f+pi(h,t,!u)])?d=!0:u&&(t.altKey||t.metaKey||t.ctrlKey)&&!(X.windows&&t.ctrlKey&&t.altKey)&&(g=r[t.keyCode])&&g!=h?(v(x[f+pi(g,t,!0)])||t.shiftKey&&(b=o[t.keyCode])!=h&&b!=g&&v(x[f+pi(b,t,!1)]))&&(d=!0):u&&t.shiftKey&&v(x[f+pi(h,t,!0)])&&(d=!0),!d&&v(x._any)&&(d=!0)),p&&(d=!0),d&&m&&t.stopPropagation(),ki=null,d}class Ci{constructor(e,t,n,i,s){this.className=e,this.left=t,this.top=n,this.width=i,this.height=s}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className==this.className&&(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",null!=this.width&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,n){if(n.empty){let i=e.coordsAtPos(n.head,n.assoc||1);if(!i)return[];let s=Ai(e);return[new Ci(t,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}return function(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let i=Math.max(n.from,e.viewport.from),s=Math.min(n.to,e.viewport.to),r=e.textDirection==Ce.LTR,o=e.contentDOM,a=o.getBoundingClientRect(),l=Ai(e),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),u=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),f=a.right-(c?parseInt(c.paddingRight):0),d=Rt(e,i),p=Rt(e,s),m=d.type==ue.Text?d:null,g=p.type==ue.Text?p:null;if(m&&(e.lineWrapping||d.widgetLineBreaks)&&(m=Oi(e,i,1,m)),g&&(e.lineWrapping||p.widgetLineBreaks)&&(g=Oi(e,s,-1,g)),m&&g&&m.from==g.from&&m.to==g.to)return y(v(n.from,n.to,m));{let t=m?v(n.from,null,m):x(d,!1),i=g?v(null,n.to,g):x(p,!0),s=[];return(m||d).to<(g||p).from-(m&&g?1:0)||d.widgetLineBreaks>1&&t.bottom+e.defaultLineHeight/2h&&i.from=r)break;a>s&&l(Math.max(e,s),null==t&&e<=h,Math.min(a,r),null==n&&a>=c,o.dir)}if(s=i.to+1,s>=r)break}return 0==a.length&&l(h,null==t,c,null==n,e.textDirection),{top:s,bottom:o,horizontal:a}}function x(e,t){let n=a.top+(t?e.top:e.bottom);return{top:n,bottom:n,horizontal:[]}}}(e,t,n)}}function Ai(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==Ce.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function Oi(e,t,n,i){let s=e.coordsAtPos(t,2*n);if(!s)return i;let r=e.dom.getBoundingClientRect(),o=(s.top+s.bottom)/2,a=e.posAtCoords({x:r.left+1,y:o}),l=e.posAtCoords({x:r.right-1,y:o});return null==a||null==l?i:{from:Math.max(i.from,Math.min(a,l)),to:Math.min(i.to,Math.max(a,l))}}class Mi{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(_i)!=e.state.facet(_i)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){!1!==this.layer.updateOnDocViewUpdate&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,n=e.facet(_i);for(;t{return n=e,i=this.drawn[t],!(n.constructor==i.constructor&&n.eq(i));var n,i}))){let t=this.dom.firstChild,n=0;for(let i of e)i.update&&t&&i.constructor&&this.drawn[n].constructor&&i.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(i.draw(),t);for(;t;){let e=t.nextSibling;t.remove(),t=e}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const _i=i.sj.define();function Ti(e){return[lt.define((t=>new Mi(t,e))),_i.of(e)]}const Ni=!X.ios,Ei=i.sj.define({combine:e=>(0,i.QR)(e,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})});function Di(e={}){return[Ei.of(e),Ri,Ii,Bi,Qe.of(!0)]}function Pi(e){return e.startState.facet(Ei)!=e.state.facet(Ei)}const Ri=Ti({above:!0,markers(e){let{state:t}=e,n=t.facet(Ei),s=[];for(let r of t.selection.ranges){let o=r==t.selection.main;if(r.empty?!o||Ni:n.drawRangeCursor){let t=o?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",n=r.empty?r:i.OF.cursor(r.head,r.head>r.anchor?-1:1);for(let i of Ci.forRange(e,t,n))s.push(i)}}return s},update(e,t){e.transactions.some((e=>e.selection))&&(t.style.animationName="cm-blink"==t.style.animationName?"cm-blink2":"cm-blink");let n=Pi(e);return n&&ji(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){ji(t.state,e)},class:"cm-cursorLayer"});function ji(e,t){t.style.animationDuration=e.facet(Ei).cursorBlinkRate+"ms"}const Ii=Ti({above:!1,markers:e=>e.state.selection.ranges.map((t=>t.empty?[]:Ci.forRange(e,"cm-selectionBackground",t))).reduce(((e,t)=>e.concat(t))),update:(e,t)=>e.docChanged||e.selectionSet||e.viewportChanged||Pi(e),class:"cm-selectionLayer"}),Li={".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"}},".cm-content":{"& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}};Ni&&(Li[".cm-line"].caretColor=Li[".cm-content"].caretColor="transparent !important");const Bi=i.Nb.highest(li.theme(Li));function Fi(e,t,n,i,s){t.lastIndex=0;for(let r,o=e.iterRange(n,i),a=n;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;r=t.exec(o.value);)s(a+r.index,r)}class zi{constructor(e){const{regexp:t,decoration:n,decorate:i,boundary:s,maxLength:r=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,i)this.addMatch=(e,t,n,s)=>i(s,n,n+e[0].length,e,t);else if("function"==typeof n)this.addMatch=(e,t,i,s)=>{let r=n(e,t,i);r&&s(i,i+e[0].length,r)};else{if(!n)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(e,t,i,s)=>s(i,i+e[0].length,n)}this.boundary=s,this.maxLength=r}createDeco(e){let t=new i.vB,n=t.add.bind(t);for(let{from:t,to:i}of function(e,t){let n=e.visibleRanges;if(1==n.length&&n[0].from==e.viewport.from&&n[0].to==e.viewport.to)return n;let i=[];for(let{from:s,to:r}of n)s=Math.max(e.state.doc.lineAt(s).from,s-t),r=Math.min(e.state.doc.lineAt(r).to,r+t),i.length&&i[i.length-1].to>=s?i[i.length-1].to=r:i.push({from:s,to:r});return i}(e,this.maxLength))Fi(e.state.doc,this.regexp,t,i,((t,i)=>this.addMatch(i,e,t,n)));return t.finish()}updateDeco(e,t){let n=1e9,i=-1;return e.docChanged&&e.changes.iterChanges(((t,s,r,o)=>{o>e.view.viewport.from&&r1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,t.map(e.changes),n,i):t}updateRange(e,t,n,i){for(let s of e.visibleRanges){let r=Math.max(s.from,n),o=Math.min(s.to,i);if(o>r){let n=e.state.doc.lineAt(r),i=n.ton.from;r--)if(this.boundary.test(n.text[r-1-n.from])){a=r;break}for(;oc.push(n.range(e,t));if(n==i)for(this.regexp.lastIndex=a-n.from;(h=this.regexp.exec(n.text))&&h.indexthis.addMatch(n,e,t,u)));t=t.update({filterFrom:a,filterTo:l,filter:(e,t)=>el,add:c})}}return t}}const $i=null!=/x/.unicode?"gu":"g",Hi=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",$i),qi={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Vi=null;const Wi=i.sj.define({combine(e){let t=(0,i.QR)(e,{render:null,specialChars:Hi,addSpecialChars:null});return(t.replaceTabs=!function(){var e;if(null==Vi&&"undefined"!=typeof document&&document.body){let t=document.body.style;Vi=null!=(null!==(e=t.tabSize)&&void 0!==e?e:t.MozTabSize)}return Vi||!1}())&&(t.specialChars=new RegExp("\t|"+t.specialChars.source,$i)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,$i)),t}});function Gi(e={}){return[Wi.of(e),Ui||(Ui=lt.fromClass(class{constructor(e){this.view=e,this.decorations=fe.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(Wi)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new zi({regexp:e.specialChars,decoration:(t,n,s)=>{let{doc:r}=n.state,o=(0,i.vS)(t[0],0);if(9==o){let e=r.lineAt(s),t=n.state.tabSize,o=(0,i.y$)(e.text,t,s-e.from);return fe.replace({widget:new Yi((t-o%t)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[o]||(this.decorationCache[o]=fe.replace({widget:new Ki(e,o)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(Wi);e.startState.facet(Wi)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(e.view)):this.decorations=this.decorator.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}))]}let Ui=null;class Ki extends ce{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=function(e){return e>=32?"•":10==e?"␤":String.fromCharCode(9216+e)}(this.code),n=e.state.phrase("Control character")+" "+(qi[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,n,t);if(i)return i;let s=document.createElement("span");return s.textContent=t,s.title=n,s.setAttribute("aria-label",n),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class Yi extends ce{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent="\t",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}const Ji=lt.fromClass(class{constructor(){this.height=1e3,this.attrs={style:"padding-bottom: 1000px"}}update(e){let{view:t}=e,n=t.viewState.editorHeight-t.defaultLineHeight-t.documentPadding.top-.5;n>=0&&n!=this.height&&(this.height=n,this.attrs={style:`padding-bottom: ${n}px`})}});function Xi(){return[Ji,ut.of((e=>{var t;return(null===(t=e.plugin(Ji))||void 0===t?void 0:t.attrs)||null}))]}function Zi(){return es}const Qi=fe.line({class:"cm-activeLine"}),es=lt.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,n=[];for(let i of e.state.selection.ranges){let s=e.lineBlockAt(i.head);s.from>t&&(n.push(Qi.range(s.from)),t=s.from)}return fe.set(n)}},{decorations:e=>e.decorations}),ts=2e3;function ns(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1),s=e.state.doc.lineAt(n),r=n-s.from,o=r>ts?-1:r==s.length?function(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}(e,t.clientX):(0,i.y$)(s.text,e.state.tabSize,n-s.from);return{line:s.number,col:o,off:r}}function is(e){let t=(null==e?void 0:e.eventFilter)||(e=>e.altKey&&0==e.button);return li.mouseSelectionStyle.of(((e,n)=>t(n)?function(e,t){let n=ns(e,t),s=e.state.selection;return n?{update(e){if(e.docChanged){let t=e.changes.mapPos(e.startState.doc.line(n.line).from),i=e.state.doc.lineAt(t);n={line:i.number,col:n.col,off:Math.min(n.off,i.length)},s=s.map(e.changes)}},get(t,r,o){let a=ns(e,t);if(!a)return s;let l=function(e,t,n){let s=Math.min(t.line,n.line),r=Math.max(t.line,n.line),o=[];if(t.off>ts||n.off>ts||t.col<0||n.col<0){let a=Math.min(t.off,n.off),l=Math.max(t.off,n.off);for(let t=s;t<=r;t++){let n=e.doc.line(t);n.length<=l&&o.push(i.OF.range(n.from+a,n.to+l))}}else{let a=Math.min(t.col,n.col),l=Math.max(t.col,n.col);for(let t=s;t<=r;t++){let n=e.doc.line(t),s=(0,i.kn)(n.text,a,e.tabSize,!0);if(s<0)o.push(i.OF.cursor(n.to));else{let t=(0,i.kn)(n.text,l,e.tabSize);o.push(i.OF.range(n.from+s,n.from+t))}}}return o}(e.state,n,a);return l.length?o?i.OF.create(l.concat(s.ranges)):i.OF.create(l):s}}:null}(e,n):null))}const ss={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},rs={style:"cursor: crosshair"};function os(e={}){let[t,n]=ss[e.key||"Alt"],i=lt.fromClass(class{constructor(e){this.view=e,this.isDown=!1}set(e){this.isDown!=e&&(this.isDown=e,this.view.update([]))}},{eventObservers:{keydown(e){this.set(e.keyCode==t||n(e))},keyup(e){e.keyCode!=t&&n(e)||this.set(!1)},mousemove(e){this.set(n(e))}}});return[i,li.contentAttributes.of((e=>{var t;return(null===(t=e.plugin(i))||void 0===t?void 0:t.isDown)?rs:null}))]}const as="-10000px";class ls{constructor(e,t,n,i){this.facet=t,this.createTooltipView=n,this.removeTooltipView=i,this.input=e.state.facet(t),this.tooltips=this.input.filter((e=>e));let s=null;this.tooltipViews=this.tooltips.map((e=>s=n(e,s)))}update(e,t){var n;let i=e.state.facet(this.facet),s=i.filter((e=>e));if(i===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let r=[],o=t?[]:null;for(let n=0;nt[n]=e)),t.length=o.length),this.input=i,this.tooltips=s,this.tooltipViews=r,!0}}function hs(e={}){return us.of(e)}function cs(e){let{win:t}=e;return{top:0,left:0,bottom:t.innerHeight,right:t.innerWidth}}const us=i.sj.define({combine:e=>{var t,n,i;return{position:X.ios?"absolute":(null===(t=e.find((e=>e.position)))||void 0===t?void 0:t.position)||"fixed",parent:(null===(n=e.find((e=>e.parent)))||void 0===n?void 0:n.parent)||null,tooltipSpace:(null===(i=e.find((e=>e.tooltipSpace)))||void 0===i?void 0:i.tooltipSpace)||cs}}}),fs=new WeakMap,ds=lt.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(us);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver="function"==typeof ResizeObserver?new ResizeObserver((()=>this.measureSoon())):null,this.manager=new ls(e,gs,((e,t)=>this.createTooltip(e,t)),(e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()})),this.above=this.manager.tooltips.map((e=>!!e.above)),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,i=e.state.facet(us);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let e of this.manager.tooltipViews)e.dom.style.position=this.position;n=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let e of this.manager.tooltipViews)this.container.appendChild(e.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),i=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let e=document.createElement("div");e.className="cm-tooltip-arrow",n.dom.appendChild(e)}return n.dom.style.position=this.position,n.dom.style.top=as,n.dom.style.left="0px",this.container.insertBefore(n.dom,i),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),null===(e=t.destroy)||void 0===e||e.call(t);this.parent&&this.container.remove(),null===(t=this.resizeObserver)||void 0===t||t.disconnect(),null===(n=this.intersectionObserver)||void 0===n||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=this.view.dom.getBoundingClientRect(),t=1,n=1,i=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(X.gecko)i=e.offsetParent!=this.container.ownerDocument.body;else if(e.style.top==as&&"0px"==e.style.left){let t=e.getBoundingClientRect();i=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}}if(i||"absolute"==this.position)if(this.parent){let e=this.parent.getBoundingClientRect();e.width&&e.height&&(t=e.width/this.parent.offsetWidth,n=e.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:n}=this.view.viewState);return{editor:e,parent:this.parent?this.container.getBoundingClientRect():e,pos:this.manager.tooltips.map(((e,t)=>{let n=this.manager.tooltipViews[t];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)})),size:this.manager.tooltipViews.map((({dom:e})=>e.getBoundingClientRect())),space:this.view.state.facet(us).tooltipSpace(this.view),scaleX:t,scaleY:n,makeAbsolute:i}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let e of this.manager.tooltipViews)e.dom.style.position="absolute"}let{editor:n,space:i,scaleX:s,scaleY:r}=e,o=[];for(let a=0;a=Math.min(n.bottom,i.bottom)||u.rightMath.min(n.right,i.right)+.1){c.style.top=as;continue}let d=l.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,p=d?7:0,m=f.right-f.left,g=null!==(t=fs.get(h))&&void 0!==t?t:f.bottom-f.top,b=h.offset||ms,y=this.view.textDirection==Ce.LTR,v=f.width>i.right-i.left?y?i.left:i.right-f.width:y?Math.max(i.left,Math.min(u.left-(d?14:0)+b.x,i.right-m)):Math.min(Math.max(i.left,u.left-m+(d?14:0)-b.x),i.right-m),x=this.above[a];!l.strictSide&&(x?u.top-(f.bottom-f.top)-b.yi.bottom)&&x==i.bottom-u.bottom>u.top-i.top&&(x=this.above[a]=!x);let w=(x?u.top-i.top:i.bottom-u.bottom)-p;if(wv&&e.topk&&(k=x?e.top-g-2-p:e.bottom+p+2);if("absolute"==this.position?(c.style.top=(k-e.parent.top)/r+"px",c.style.left=(v-e.parent.left)/s+"px"):(c.style.top=k/r+"px",c.style.left=v/s+"px"),d){let e=u.left+(y?b.x:-b.x)-(v+14-7);d.style.left=e/s+"px"}!0!==h.overlap&&o.push({left:v,top:k,right:S,bottom:k+g}),c.classList.toggle("cm-tooltip-above",x),c.classList.toggle("cm-tooltip-below",!x),h.positioned&&h.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=as}},{eventObservers:{scroll(){this.maybeMeasure()}}}),ps=li.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),ms={x:0,y:0},gs=i.sj.define({enables:[ds,ps]});function bs(e,t){let n=e.plugin(ds);if(!n)return null;let i=n.manager.tooltips.indexOf(t);return i<0?null:n.manager.tooltipViews[i]}const ys=i.sj.define({combine(e){let t,n;for(let i of e)t=t||i.topContainer,n=n||i.bottomContainer;return{topContainer:t,bottomContainer:n}}});function vs(e,t){let n=e.plugin(xs),i=n?n.specs.indexOf(t):-1;return i>-1?n.panels[i]:null}const xs=lt.fromClass(class{constructor(e){this.input=e.state.facet(Ss),this.specs=this.input.filter((e=>e)),this.panels=this.specs.map((t=>t(e)));let t=e.state.facet(ys);this.top=new ws(e,!0,t.topContainer),this.bottom=new ws(e,!1,t.bottomContainer),this.top.sync(this.panels.filter((e=>e.top))),this.bottom.sync(this.panels.filter((e=>!e.top)));for(let e of this.panels)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}update(e){let t=e.state.facet(ys);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new ws(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new ws(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(Ss);if(n!=this.input){let t=n.filter((e=>e)),i=[],s=[],r=[],o=[];for(let n of t){let t,a=this.specs.indexOf(n);a<0?(t=n(e.view),o.push(t)):(t=this.panels[a],t.update&&t.update(e)),i.push(t),(t.top?s:r).push(t)}this.specs=t,this.panels=i,this.top.sync(s),this.bottom.sync(r);for(let e of o)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>li.scrollMargins.of((t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}}))});class ws{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=ks(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=ks(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function ks(e){let t=e.nextSibling;return e.remove(),t}const Ss=i.sj.define({enables:xs});class Cs extends i.FB{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Cs.prototype.elementClass="",Cs.prototype.toDOM=void 0,Cs.prototype.mapMode=i.iR.TrackBefore,Cs.prototype.startSide=Cs.prototype.endSide=-1,Cs.prototype.point=!0;const As=i.sj.define(),Os=i.sj.define(),Ms={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>i.om.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},_s=i.sj.define();function Ts(e){return[Es(),_s.of(Object.assign(Object.assign({},Ms),e))]}const Ns=i.sj.define({combine:e=>e.some((e=>e))});function Es(e){let t=[Ds];return e&&!1===e.fixed&&t.push(Ns.of(!0)),t}const Ds=lt.fromClass(class{constructor(e){this.view=e,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(_s).map((t=>new Is(e,t)));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!e.state.facet(Ns),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,i=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(i<.8*(n.to-n.from))}e.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px"),this.view.state.facet(Ns)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&this.dom.remove();let n=i.om.iter(this.view.state.facet(As),this.view.viewport.from),s=[],r=this.gutters.map((e=>new js(e,this.view.viewport,-this.view.documentPadding.top)));for(let e of this.view.viewportLineBlocks)if(s.length&&(s=[]),Array.isArray(e.type)){let t=!0;for(let i of e.type)if(i.type==ue.Text&&t){Rs(n,s,i.from);for(let e of r)e.line(this.view,i,s);t=!1}else if(i.widget)for(let e of r)e.widget(this.view,i)}else if(e.type==ue.Text){Rs(n,s,e.from);for(let t of r)t.line(this.view,e,s)}else if(e.widget)for(let t of r)t.widget(this.view,e);for(let e of r)e.finish();e&&this.view.scrollDOM.insertBefore(this.dom,t)}updateGutters(e){let t=e.startState.facet(_s),n=e.state.facet(_s),s=e.docChanged||e.heightChanged||e.viewportChanged||!i.om.eq(e.startState.facet(As),e.state.facet(As),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let t of this.gutters)t.update(e)&&(s=!0);else{s=!0;let i=[];for(let s of n){let n=t.indexOf(s);n<0?i.push(new Is(this.view,s)):(this.gutters[n].update(e),i.push(this.gutters[n]))}for(let e of this.gutters)e.dom.remove(),i.indexOf(e)<0&&e.destroy();for(let e of i)this.dom.appendChild(e.dom);this.gutters=i}return s}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove()}},{provide:e=>li.scrollMargins.of((t=>{let n=t.plugin(e);return n&&0!=n.gutters.length&&n.fixed?t.textDirection==Ce.LTR?{left:n.dom.offsetWidth*t.scaleX}:{right:n.dom.offsetWidth*t.scaleX}:null}))});function Ps(e){return Array.isArray(e)?e:[e]}function Rs(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class js{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=i.om.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:i}=this,s=(t.top-this.height)/e.scaleY,r=t.height/e.scaleY;if(this.i==i.elements.length){let t=new Ls(e,r,s,n);i.elements.push(t),i.dom.appendChild(t.dom)}else i.elements[this.i].update(e,r,s,n);this.height=t.bottom,this.i++}line(e,t,n){let i=[];Rs(this.cursor,i,t.from),n.length&&(i=i.concat(n));let s=this.gutter.config.lineMarker(e,t,i);s&&i.unshift(s);let r=this.gutter;(0!=i.length||r.config.renderEmptyElements)&&this.addElement(e,t,i)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),i=n?[n]:null;for(let n of e.state.facet(Os)){let s=n(e,t.widget,t);s&&(i||(i=[])).push(s)}i&&this.addElement(e,t,i)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class Is{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in t.domEventHandlers)this.dom.addEventListener(n,(i=>{let s,r=i.target;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let e=r.getBoundingClientRect();s=(e.top+e.bottom)/2}else s=i.clientY;let o=e.lineBlockAtHeight(s-e.documentTop);t.domEventHandlers[n](e,o,i)&&i.preventDefault()}));this.markers=Ps(t.markers(e)),t.initialSpacer&&(this.spacer=new Ls(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=Ps(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let t=this.config.updateSpacer(this.spacer.markers[0],e);t!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[t])}let n=e.view.viewport;return!i.om.eq(this.markers,t,n.from,n.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(e)}destroy(){for(let e of this.elements)e.destroy()}}class Ls{constructor(e,t,n,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,i)}update(e,t,n,i){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),function(e,t){if(e.length!=t.length)return!1;for(let n=0;n(0,i.QR)(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let e in t){let i=n[e],s=t[e];n[e]=i?(e,t,n)=>i(e,t,n)||s(e,t,n):s}return n}})});class $s extends Cs{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Hs(e,t){return e.state.facet(zs).formatNumber(t,e.state)}const qs=_s.compute([zs],(e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:e=>e.state.facet(Bs),lineMarker:(e,t,n)=>n.some((e=>e.toDOM))?null:new $s(Hs(e,e.state.doc.lineAt(t.from).number)),widgetMarker:(e,t,n)=>{for(let i of e.state.facet(Fs)){let s=i(e,t,n);if(s)return s}return null},lineMarkerChange:e=>e.startState.facet(zs)!=e.state.facet(zs),initialSpacer:e=>new $s(Hs(e,Ws(e.state.doc.lines))),updateSpacer(e,t){let n=Hs(t.view,Ws(t.view.state.doc.lines));return n==e.number?e:new $s(n)},domEventHandlers:e.facet(zs).domEventHandlers})));function Vs(e={}){return[zs.of(e),Es(),qs]}function Ws(e){let t=9;for(;t({decorations:e.createDeco(t),update(t){this.decorations=e.updateDeco(t,this.decorations)}})),{decorations:e=>e.decorations})}const Ks=Us(new zi({regexp:/\t| +/g,decoration:e=>function(e){let t=Gs.get(e);return t||Gs.set(e,t=fe.mark({attributes:"\t"===e?{class:"cm-highlightTab"}:{class:"cm-highlightSpace","data-display":e.replace(/ /g,"·")}})),t}(e[0]),boundary:/\S/}));function Ys(){return Ks}const Js=Us(new zi({regexp:/\s+$/g,decoration:fe.mark({class:"cm-trailingSpace"}),boundary:/\S/}));function Xs(){return Js}},9066:(e,t,n)=>{"use strict";n.d(t,{$g:()=>I,PH:()=>p,Qj:()=>d,RY:()=>D,Z6:()=>h,cF:()=>i,fI:()=>c,iX:()=>R,rr:()=>P,uY:()=>o});const i=1024;let s=0;class r{constructor(e,t){this.from=e,this.to=t}}class o{constructor(e={}){this.id=s++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=h.match(e)),t=>{let n=e(t);return void 0===n?null:[this,n]}}}o.closedBy=new o({deserialize:e=>e.split(" ")}),o.openedBy=new o({deserialize:e=>e.split(" ")}),o.group=new o({deserialize:e=>e.split(" ")}),o.isolate=new o({deserialize:e=>{if(e&&"rtl"!=e&&"ltr"!=e&&"auto"!=e)throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}}),o.contextHash=new o({perNode:!0}),o.lookAhead=new o({perNode:!0}),o.mounted=new o({perNode:!0});class a{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[o.mounted.id]}}const l=Object.create(null);class h{constructor(e,t,n,i=0){this.name=e,this.props=t,this.id=n,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):l,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),i=new h(e.name||"",t,e.id,n);if(e.props)for(let n of e.props)if(Array.isArray(n)||(n=n(i)),n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[n[0].id]=n[1]}return i}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if("string"==typeof e){if(this.name==e)return!0;let t=this.prop(o.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let i of n.split(" "))t[i]=e[n];return e=>{for(let n=e.prop(o.group),i=-1;i<(n?n.length:0);i++){let s=t[i<0?e.name:n[i]];if(s)return s}}}}h.none=new h("",Object.create(null),0,8);class c{constructor(e){this.types=e;for(let t=0;t=t){let o=new x(r.tree,r.overlay[0].from+e.from,-1,e);(s||(s=[i])).push(y(o,t,n,!1))}}return s?A(s):i}(this,e,t)}iterate(e){let{enter:t,leave:n,from:i=0,to:s=this.length}=e,r=e.mode||0,o=(r&d.IncludeAnonymous)>0;for(let e=this.cursor(r|d.IncludeAnonymous);;){let r=!1;if(e.from<=s&&e.to>=i&&(!o&&e.type.isAnonymous||!1!==t(e))){if(e.firstChild())continue;r=!0}for(;r&&n&&(o||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;r=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:E(h.none,this.children,this.positions,0,this.children.length,0,this.length,((e,t,n)=>new p(this.type,e,t,n,this.propValues)),e.makeTree||((e,t,n)=>new p(h.none,e,t,n)))}static build(e){return function(e){var t;let{buffer:n,nodeSet:s,maxBufferLength:r=i,reused:a=[],minRepeatType:l=s.types.length}=e,h=Array.isArray(n)?new m(n,n.length):n,c=s.types,u=0,f=0;function d(e,t,n,i,m,w){let{id:k,start:S,end:C,size:A}=h,O=f;for(;A<0;){if(h.next(),-1==A){let t=a[k];return n.push(t),void i.push(S-e)}if(-3==A)return void(u=k);if(-4==A)return void(f=k);throw new RangeError(`Unrecognized record size: ${A}`)}let M,_,T=c[k],N=S-e;if(C-S<=r&&(_=function(e,t){let n=h.fork(),i=0,s=0,o=0,a=n.end-r,c={size:0,start:0,skip:0};e:for(let r=n.pos-e;n.pos>r;){let e=n.size;if(n.id==t&&e>=0){c.size=i,c.start=s,c.skip=o,o+=4,i+=4,n.next();continue}let h=n.pos-e;if(e<0||h=l?4:0,f=n.start;for(n.next();n.pos>h;){if(n.size<0){if(-3!=n.size)break e;u+=4}else n.id>=l&&(u+=4);n.next()}s=f,i+=e,o+=u}return(t<0||i==e)&&(c.size=i,c.start=s,c.skip=o),c.size>4?c:void 0}(h.pos-t,m))){let t=new Uint16Array(_.size-_.skip),n=h.pos-_.size,i=t.length;for(;h.pos>n;)i=x(_.start,t,i);M=new g(t,C-_.start,s),N=_.start-e}else{let e=h.pos-A;h.next();let t=[],n=[],i=k>=l?k:-1,s=0,a=C;for(;h.pos>e;)i>=0&&h.id==i&&h.size>=0?(h.end<=a-r&&(y(t,n,S,s,h.end,a,i,O),s=t.length,a=h.end),h.next()):w>2500?b(S,e,t,n):d(S,e,t,n,i,w+1);if(i>=0&&s>0&&s-1&&s>0){let e=function(e){return(t,n,i)=>{let s,r,a=0,l=t.length-1;if(l>=0&&(s=t[l])instanceof p){if(!l&&s.type==e&&s.length==i)return s;(r=s.prop(o.lookAhead))&&(a=n[l]+s.length+r)}return v(e,t,n,i,a)}}(T);M=E(T,t,n,0,t.length,0,C-S,e,e)}else M=v(T,t,n,C-S,O-C)}n.push(M),i.push(N)}function b(e,t,n,i){let o=[],a=0,l=-1;for(;h.pos>t;){let{id:e,start:t,end:n,size:i}=h;if(i>4)h.next();else{if(l>-1&&t=0;e-=3)t[n++]=o[e],t[n++]=o[e+1]-r,t[n++]=o[e+2]-r,t[n++]=n;n.push(new g(t,o[2]-r,s)),i.push(r-e)}}function y(e,t,n,i,r,o,a,l){let h=[],c=[];for(;e.length>i;)h.push(e.pop()),c.push(t.pop()+n-r);e.push(v(s.types[a],h,c,o-r,l-o)),t.push(r-n)}function v(e,t,n,i,s=0,r){if(u){let e=[o.contextHash,u];r=r?[e].concat(r):[e]}if(s>25){let e=[o.lookAhead,s];r=r?[e].concat(r):[e]}return new p(e,t,n,i,r)}function x(e,t,n){let{id:i,start:s,end:r,size:o}=h;if(h.next(),o>=0&&i4){let i=h.pos-(o-4);for(;h.pos>i;)n=x(e,t,n)}t[--n]=a,t[--n]=r-e,t[--n]=s-e,t[--n]=i}else-3==o?u=i:-4==o&&(f=i);return n}let w=[],k=[];for(;h.pos>0;)d(e.start||0,e.bufferStart||0,w,k,-1,0);let S=null!==(t=e.length)&&void 0!==t?t:w.length?k[0]+w[0].length:0;return new p(c[e.topID],w.reverse(),k.reverse(),S)}(e)}}p.empty=new p(h.none,[],[],0);class m{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new m(this.buffer,this.index)}}class g{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return h.none}toString(){let e=[];for(let t=0;t0));a=r[a+3]);return o}slice(e,t,n){let i=this.buffer,s=new Uint16Array(t-e),r=0;for(let o=e,a=0;o=t&&nt;case 1:return n<=t&&i>t;case 2:return i>t;case 4:return!0}}function y(e,t,n,i){for(var s;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to0?o.length:-1;e!=h;e+=t){let h=o[e],c=l[e]+r.from;if(b(i,n,c,c+h.length))if(h instanceof g){if(s&d.ExcludeBuffers)continue;let o=h.findChild(0,h.buffer.length,t,n-c,i);if(o>-1)return new C(new S(r,h,e,c),null,o)}else if(s&d.IncludeAnonymous||!h.type.isAnonymous||_(h)){let o;if(!(s&d.IgnoreMounts)&&(o=a.get(h))&&!o.overlay)return new x(o.tree,c,e,r);let l=new x(h,c,e,r);return s&d.IncludeAnonymous||!l.type.isAnonymous?l:l.nextChild(t<0?h.children.length-1:0,t,n,i)}}if(s&d.IncludeAnonymous||!r.type.isAnonymous)return null;if(e=r.index>=0?r.index+t:t<0?-1:r._parent._tree.children.length,r=r._parent,!r)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,n=0){let i;if(!(n&d.IgnoreOverlays)&&(i=a.get(this._tree))&&i.overlay){let n=e-this.from;for(let{from:e,to:s}of i.overlay)if((t>0?e<=n:e=n:s>n))return new x(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function w(e,t,n,i){let s=e.cursor(),r=[];if(!s.firstChild())return r;if(null!=n)for(let e=!1;!e;)if(e=s.type.is(n),!s.nextSibling())return r;for(;;){if(null!=i&&s.type.is(i))return r;if(s.type.is(t)&&r.push(s.node),!s.nextSibling())return null==i?r:[]}}function k(e,t,n=t.length-1){for(let i=e.parent;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(t[n]&&t[n]!=i.name)return!1;n--}}return!0}class S{constructor(e,t,n,i){this.parent=e,this.buffer=t,this.index=n,this.start=i}}class C extends v{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,n);return s<0?null:new C(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,n=0){if(n&d.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new C(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new C(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new C(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,i=this.index+4,s=n.buffer[this.index+3];if(s>i){let r=n.buffer[this.index+1];e.push(n.slice(i,s,r)),t.push(0)}return new p(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function A(e){if(!e.length)return null;let t=0,n=e[0];for(let i=1;in.from||s.to0){if(this.index-1)for(let i=t+e,s=e<0?-1:n._tree.children.length;i!=s;i+=e){let e=n._tree.children[i];if(this.mode&d.IncludeAnonymous||e instanceof g||!e.type.isAnonymous||_(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let r=e;r;r=r._parent)if(r.index==i){if(i==this.index)return r;t=r,n=s+1;break e}i=this.stack[--s]}for(let e=n;e=0;s--){if(s<0)return k(this.node,e,i);let r=n[t.buffer[this.stack[s]]];if(!r.isAnonymous){if(e[i]&&e[i]!=r.name)return!1;i--}}return!0}}function _(e){return e.children.some((e=>e instanceof g||!e.type.isAnonymous||_(e)))}const T=new WeakMap;function N(e,t){if(!e.isAnonymous||t instanceof g||t.type!=e)return 1;let n=T.get(t);if(null==n){n=1;for(let i of t.children){if(i.type!=e||!(i instanceof p)){n=1;break}n+=N(e,i)}T.set(t,n)}return n}function E(e,t,n,i,s,r,o,a,l){let h=0;for(let n=i;n=c)break;p+=t}if(h==s+1){if(p>c){let e=n[s];t(e.children,e.positions,0,e.children.length,i[s]+a);continue}u.push(n[s])}else{let t=i[h-1]+n[h-1].length-d;u.push(E(e,n,i,s,h,d,t,null,l))}f.push(d+a-r)}}(t,n,i,s,0),(a||l)(u,f,o)}class D{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let i=this.map.get(e);i||this.map.set(e,i=new Map),i.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof C?this.setBuffer(e.context.buffer,e.index,t):e instanceof x&&this.map.set(e.tree,t)}get(e){return e instanceof C?this.getBuffer(e.context.buffer,e.index):e instanceof x?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class P{constructor(e,t,n,i,s=!1,r=!1){this.from=e,this.to=t,this.tree=n,this.offset=i,this.open=(s?1:0)|(r?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(e,t=[],n=!1){let i=[new P(0,e.length,e,0,!1,n)];for(let n of t)n.to>e.length&&i.push(n);return i}static applyChanges(e,t,n=128){if(!t.length)return e;let i=[],s=1,r=e.length?e[0]:null;for(let o=0,a=0,l=0;;o++){let h=o=n)for(;r&&r.from=t.from||c<=t.to||l){let e=Math.max(t.from,a)-l,n=Math.min(t.to,c)-l;t=e>=n?null:new P(e,n,t.tree,t.offset+l,o>0,!!h)}if(t&&i.push(t),r.to>c)break;r=snew r(e.from,e.to))):[new r(0,0)]:[new r(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let i=this.startParse(e,t,n);for(;;){let e=i.advance();if(e)return e}}}class j{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function I(e){return(t,n,i,s)=>new $(t,e,n,i,s)}class L{constructor(e,t,n,i,s){this.parser=e,this.parse=t,this.overlay=n,this.target=i,this.from=s}}function B(e){if(!e.length||e.some((e=>e.from>=e.to)))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(e))}class F{constructor(e,t,n,i,s,r,o){this.parser=e,this.predicate=t,this.mounts=n,this.index=i,this.start=s,this.target=r,this.prev=o,this.depth=0,this.ranges=[]}}const z=new o({perNode:!0});class ${constructor(e,t,n,i,s){this.nest=t,this.input=n,this.fragments=i,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let e=this.baseParse.advance();if(!e)return null;if(this.baseParse=null,this.baseTree=e,this.startInner(),null!=this.stoppedAt)for(let e of this.inner)e.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let e=this.baseTree;return null!=this.stoppedAt&&(e=new p(e.type,e.children,e.positions,e.length,e.propValues.concat([[z,this.stoppedAt]]))),e}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[o.mounted.id]=new a(t,e.overlay,e.parser),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t=this.stoppedAt)l=!1;else if(e.hasNode(i)){if(t){let e=t.mounts.find((e=>e.frag.from<=i.from&&e.frag.to>=i.to&&e.mount.overlay));if(e)for(let n of e.mount.overlay){let s=n.from+e.pos,r=n.to+e.pos;s>=i.from&&r<=i.to&&!t.ranges.some((e=>e.froms))&&t.ranges.push({from:s,to:r})}}l=!1}else if(n&&(o=H(n.ranges,i.from,i.to)))l=2!=o;else if(!i.type.isAnonymous&&(s=this.nest(i,this.input))&&(i.fromnew r(e.from-i.from,e.to-i.from))):null,i.tree,e.length?e[0].from:i.from)),s.overlay?e.length&&(n={ranges:e,depth:0,prev:n}):l=!1}}else t&&(a=t.predicate(i))&&(!0===a&&(a=new r(i.from,i.to)),a.fromnew r(e.from-t.start,e.to-t.start))),t.target,e[0].from))),t=t.prev}n&&! --n.depth&&(n=n.prev)}}}}function H(e,t,n){for(let i of e){if(i.from>=n)break;if(i.to>t)return i.from<=t&&i.to>=n?2:1}return 0}function q(e,t,n,i,s,r){if(t=e&&t.enter(n,1,d.IgnoreOverlays|d.ExcludeBuffers)||t.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(!(t.children.length&&0==t.positions[0]&&t.children[0]instanceof p))break;t=t.children[0]}return!1}}class G{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let n=this.curFrag=e[0];this.curTo=null!==(t=n.tree.prop(z))&&void 0!==t?t:n.to,this.inner=new W(n.tree,-n.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(e=t.tree.prop(z))&&void 0!==e?e:t.to,this.inner=new W(t.tree,-t.offset)}}findMounts(e,t){var n;let i=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let e=this.inner.cursor.node;e;e=e.parent){let s=null===(n=e.tree)||void 0===n?void 0:n.prop(o.mounted);if(s&&s.parser==t)for(let t=this.fragI;t=e.to)break;n.tree==this.curFrag.tree&&i.push({frag:n,pos:e.from-n.offset,mount:s})}}}return i}}function U(e,t){let n=null,i=t;for(let s=1,o=0;s=l)break;e.to<=a||(n||(i=n=t.slice()),e.froml&&n.splice(o+1,0,new r(l,e.to))):e.to>l?n[o--]=new r(l,e.to):n.splice(o--,1))}}return i}function K(e,t,n,i){let s=0,o=0,a=!1,l=!1,h=-1e9,c=[];for(;;){let u=s==e.length?1e9:a?e[s].to:e[s].from,f=o==t.length?1e9:l?t[o].to:t[o].from;if(a!=l){let e=Math.max(h,n),t=Math.min(u,f,i);enew r(e.from+i,e.to+i))),l,h);for(let t=0,i=l;;t++){let r=t==a.length,l=r?h:a[t].from;if(l>i&&n.push(new P(i,l,s.tree,-e,o.from>=i||o.openStart,o.to<=l||o.openEnd)),r)break;i=a[t].to}}else n.push(new P(l,h,s.tree,-e,o.from>=e||o.openStart,o.to<=a||o.openEnd))}return n}},9913:(e,t,n)=>{"use strict";n.d(t,{DM:()=>f,_A:()=>T,az:()=>u,pn:()=>l,vw:()=>r});var i=n(9066);let s=0;class r{constructor(e,t,n,i){this.name=e,this.set=t,this.base=n,this.modified=i,this.id=s++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n="string"==typeof e?e:"?";if(e instanceof r&&(t=e),null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let i=new r(n,[],null,[]);if(i.set.push(i),t)for(let e of t.set)i.set.push(e);return i}static defineModifier(e){let t=new a(e);return e=>e.modified.indexOf(t)>-1?e:a.get(e.base||e,e.modified.concat(t).sort(((e,t)=>e.id-t.id)))}}let o=0;class a{constructor(e){this.name=e,this.instances=[],this.id=o++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find((n=>{return n.base==e&&(i=t,s=n.modified,i.length==s.length&&i.every(((e,t)=>e==s[t])));var i,s}));if(n)return n;let i=[],s=new r(e.name,i,e,t);for(let e of t)e.instances.push(s);let o=function(e){let t=[[]];for(let n=0;nt.length-e.length))}(t);for(let t of e.set)if(!t.modified.length)for(let e of o)i.push(a.get(t,e));return s}}function l(e){let t=Object.create(null);for(let n in e){let i=e[n];Array.isArray(i)||(i=[i]);for(let e of n.split(" "))if(e){let n=[],s=2,r=e;for(let t=0;;){if("..."==r&&t>0&&t+3==e.length){s=1;break}let i=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(r);if(!i)throw new RangeError("Invalid path: "+e);if(n.push("*"==i[0]?"":'"'==i[0][0]?JSON.parse(i[0]):i[0]),t+=i[0].length,t==e.length)break;let o=e[t++];if(t==e.length&&"!"==o){s=0;break}if("/"!=o)throw new RangeError("Invalid path: "+e);r=e.slice(t)}let o=n.length-1,a=n[o];if(!a)throw new RangeError("Invalid path: "+e);let l=new c(i,s,o>0?n.slice(0,o):null);t[a]=l.sort(t[a])}}return h.add(t)}const h=new i.uY;class c{constructor(e,t,n,i){this.tags=e,this.mode=t,this.context=n,this.next=i}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(e){return!e||e.depth{let t=s;for(let i of e)for(let e of i.set){let i=n[e.id];if(i){t=t?t+" "+i:i;break}}return t},scope:i}}function f(e,t,n,i=0,s=e.length){let r=new d(i,Array.isArray(t)?t:[t],n);r.highlightRange(e.cursor(),i,s,"",r.highlighters),r.flush(s)}c.empty=new c([],2,null);class d{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,s,r){let{type:o,from:a,to:l}=e;if(a>=n||l<=t)return;o.isTop&&(r=this.highlighters.filter((e=>!e.scope||e.scope(o))));let u=s,f=function(e){let t=e.type.prop(h);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}(e)||c.empty,d=function(e,t){let n=null;for(let i of e){let e=i.style(t);e&&(n=n?n+" "+e:e)}return n}(r,f.tags);if(d&&(u&&(u+=" "),u+=d,1==f.mode&&(s+=(s?" ":"")+d)),this.startSpan(Math.max(t,a),u),f.opaque)return;let p=e.tree&&e.tree.prop(i.uY.mounted);if(p&&p.overlay){let i=e.node.enter(p.overlay[0].from+a,1),o=this.highlighters.filter((e=>!e.scope||e.scope(p.tree.type))),h=e.firstChild();for(let c=0,f=a;;c++){let d=c=m)&&e.nextSibling()););if(!d||m>n)break;f=d.to+a,f>t&&(this.highlightRange(i.cursor(),Math.max(t,d.from+a),Math.min(n,f),"",o),this.startSpan(Math.min(n,f),u))}h&&e.parent()}else if(e.firstChild()){p&&(s="");do{if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,s,r),this.startSpan(Math.min(n,e.to),u)}}while(e.nextSibling());e.parent()}}}const p=r.define,m=p(),g=p(),b=p(g),y=p(g),v=p(),x=p(v),w=p(v),k=p(),S=p(k),C=p(),A=p(),O=p(),M=p(O),_=p(),T={comment:m,lineComment:p(m),blockComment:p(m),docComment:p(m),name:g,variableName:p(g),typeName:b,tagName:p(b),propertyName:y,attributeName:p(y),className:p(g),labelName:p(g),namespace:p(g),macroName:p(g),literal:v,string:x,docString:p(x),character:p(x),attributeValue:p(x),number:w,integer:p(w),float:p(w),bool:p(v),regexp:p(v),escape:p(v),color:p(v),url:p(v),keyword:C,self:p(C),null:p(C),atom:p(C),unit:p(C),modifier:p(C),operatorKeyword:p(C),controlKeyword:p(C),definitionKeyword:p(C),moduleKeyword:p(C),operator:A,derefOperator:p(A),arithmeticOperator:p(A),logicOperator:p(A),bitwiseOperator:p(A),compareOperator:p(A),updateOperator:p(A),definitionOperator:p(A),typeOperator:p(A),controlOperator:p(A),punctuation:O,separator:p(O),bracket:M,angleBracket:p(M),squareBracket:p(M),paren:p(M),brace:p(M),content:k,heading:S,heading1:p(S),heading2:p(S),heading3:p(S),heading4:p(S),heading5:p(S),heading6:p(S),contentSeparator:p(k),list:p(k),quote:p(k),emphasis:p(k),strong:p(k),link:p(k),monospace:p(k),strikethrough:p(k),inserted:p(),deleted:p(),changed:p(),invalid:p(),meta:_,documentMeta:p(_),annotation:p(_),processingInstruction:p(_),definition:r.defineModifier("definition"),constant:r.defineModifier("constant"),function:r.defineModifier("function"),standard:r.defineModifier("standard"),local:r.defineModifier("local"),special:r.defineModifier("special")};for(let e in T){let t=T[e];t instanceof r&&(t.name=e)}u([{tag:T.link,class:"tok-link"},{tag:T.heading,class:"tok-heading"},{tag:T.emphasis,class:"tok-emphasis"},{tag:T.strong,class:"tok-strong"},{tag:T.keyword,class:"tok-keyword"},{tag:T.atom,class:"tok-atom"},{tag:T.bool,class:"tok-bool"},{tag:T.url,class:"tok-url"},{tag:T.labelName,class:"tok-labelName"},{tag:T.inserted,class:"tok-inserted"},{tag:T.deleted,class:"tok-deleted"},{tag:T.literal,class:"tok-literal"},{tag:T.string,class:"tok-string"},{tag:T.number,class:"tok-number"},{tag:[T.regexp,T.escape,T.special(T.string)],class:"tok-string2"},{tag:T.variableName,class:"tok-variableName"},{tag:T.local(T.variableName),class:"tok-variableName tok-local"},{tag:T.definition(T.variableName),class:"tok-variableName tok-definition"},{tag:T.special(T.variableName),class:"tok-variableName2"},{tag:T.definition(T.propertyName),class:"tok-propertyName tok-definition"},{tag:T.typeName,class:"tok-typeName"},{tag:T.namespace,class:"tok-namespace"},{tag:T.className,class:"tok-className"},{tag:T.macroName,class:"tok-macroName"},{tag:T.propertyName,class:"tok-propertyName"},{tag:T.operator,class:"tok-operator"},{tag:T.comment,class:"tok-comment"},{tag:T.meta,class:"tok-meta"},{tag:T.invalid,class:"tok-invalid"},{tag:T.punctuation,class:"tok-punctuation"}])},3643:(e,t,n)=>{"use strict";n.d(t,{Aj:()=>M,Lu:()=>p,U1:()=>_,uC:()=>d});var i=n(9066);class s{constructor(e,t,n,i,s,r,o,a,l,h=0,c){this.p=e,this.stack=t,this.state=n,this.reducePos=i,this.pos=s,this.score=r,this.buffer=o,this.bufferBase=a,this.curContext=l,this.lookAhead=h,this.parent=c}toString(){return`[${this.stack.filter(((e,t)=>t%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let i=e.parser.context;return new s(e,[],t,n,n,0,[],0,i?new r(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,i=65535&e,{parser:s}=this.p,r=this.reducePos=2e3&&!(null===(t=this.p.parser.nodeSet.types[i])||void 0===t?void 0:t.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(i,l)}storeNode(e,t,n,i=4,s=!1){if(0==e&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==e.buffer[i-4]&&e.buffer[i-1]>-1){if(t==n)return;if(e.buffer[i-2]>=t)return void(e.buffer[i-2]=n)}}if(s&&this.pos!=n){let s=this.buffer.length;if(s>0&&0!=this.buffer[s-4]){let e=!1;for(let t=s;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;s>0&&this.buffer[s-2]>n;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,i>4&&(i-=4)}this.buffer[s]=e,this.buffer[s+1]=t,this.buffer[s+2]=n,this.buffer[s+3]=i}else this.buffer.push(e,t,n,i)}shift(e,t,n,i){if(131072&e)this.pushState(65535&e,this.pos);else if(262144&e)this.pos=i,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,i,4);else{let s=e,{parser:r}=this.p;(i>this.pos||t<=r.maxNode)&&(this.pos=i,r.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,n),this.shiftContext(t,n),t<=r.maxNode&&this.buffer.push(t,n,i,4)}}apply(e,t,n,i){65536&e?this.reduce(e):this.shift(e,t,n,i)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(t,i),this.buffer.push(n,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),i=e.bufferBase+t;for(;e&&i==e.bufferBase;)e=e.parent;return new s(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new o(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(0==n)return!1;if(!(65536&n))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let i,s=0;s1&t&&e==i))||n.push(t[e],i)}t=n}let n=[];for(let e=0;e>19,i=65535&t,s=this.stack.length-3*n;if(s<0||e.getGoto(this.stack[s],i,!1)<0){let e=this.findForcedReduction();if(null==e)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(i,s)=>{if(!t.includes(i))return t.push(i),e.allActions(i,(t=>{if(393216&t);else if(65536&t){let n=(t>>19)-s;if(n>1){let i=65535&t,s=this.stack.length-3*n;if(s>=0&&e.getGoto(this.stack[s],i,!1)>=0)return n<<19|65536|i}}else{let e=n(t,s+1);if(null!=e)return e}}))};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:e}=this.p;return 65535==e.data[e.stateSlot(this.state,1)]&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;tthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class r{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class o{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=65535&e,n=e>>19;0==n?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(n-1);let i=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=i}}class a{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,0==this.index&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new a(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;null!=e&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new a(this.stack,this.pos,this.index)}}function l(e,t=Uint16Array){if("string"!=typeof e)return e;let n=null;for(let i=0,s=0;i=92&&t--,t>=34&&t--;let s=t-32;if(s>=46&&(s-=46,n=!0),r+=s,n)break;r*=46}n?n[s++]=r:n=new t(r)}return n}class h{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const c=new h;class u{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=c,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,i=this.rangeIndex,s=this.pos+e;for(;sn.to:s>=n.to;){if(i==this.ranges.length-1)return null;let e=this.ranges[++i];s+=e.from-n.to,n=e}return s}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t,n,i=this.chunkOff+e;if(i>=0&&i=this.chunk2Pos&&ti.to&&(this.chunk2=this.chunk2.slice(0,i.to-t)),n=this.chunk2.charCodeAt(0)}}return t>=this.token.lookAhead&&(this.token.lookAhead=t+1),n}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(null==n||n=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=c,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let i of this.ranges){if(i.from>=t)break;i.to>e&&(n+=this.input.read(Math.max(i.from,e),Math.min(i.to,t)))}return n}}class f{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;m(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}f.prototype.contextual=f.prototype.fallback=f.prototype.extend=!1;class d{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data="string"==typeof e?l(e):e}token(e,t){let n=e.pos,i=0;for(;;){let n=e.next<0,s=e.resolveOffset(1,1);if(m(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(null==this.elseToken)return;if(n||i++,null==s)break;e.reset(s,e.token)}i&&(e.reset(n,e.token),e.acceptToken(this.elseToken,i))}}d.prototype.contextual=f.prototype.fallback=f.prototype.extend=!1;class p{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function m(e,t,n,i,s,r){let o=0,a=1<0){let n=e[i];if(l.allows(n)&&(-1==t.token.value||t.token.value==n||b(n,t.token.value,s,r))){t.acceptToken(n);break}}let i=t.next,h=0,c=e[o+2];if(!(t.next<0&&c>h&&65535==e[n+3*c-3])){for(;h>1,r=n+s+(s<<1),a=e[r],l=e[r+1]||65536;if(i=l)){o=e[r+2],t.advance();continue e}h=s+1}}break}o=e[n+3*c-1]}}function g(e,t,n){for(let i,s=t;65535!=(i=e[s]);s++)if(i==n)return s-t;return-1}function b(e,t,n,i){let s=g(n,i,t);return s<0||g(n,i,e)t)&&!s.type.isError)return n<0?Math.max(0,Math.min(s.to-1,t-25)):Math.min(e.length,Math.max(s.from+1,t+25));if(n<0?s.prevSibling():s.nextSibling())break;if(!s.parent())return n<0?0:e.length}}class w{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?x(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?x(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(r instanceof i.PH){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(r),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+r.length}}}class k{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map((e=>new h))}getActions(e){let t=0,n=null,{parser:i}=e.p,{tokenizers:s}=i,r=i.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,a=0;for(let i=0;ih.end+25&&(a=Math.max(h.lookAhead,a)),0!=h.value)){let i=t;if(h.extended>-1&&(t=this.addActions(e,h.extended,h.end,t)),t=this.addActions(e,h.value,h.end,t),!l.extend&&(n=h,t>i))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),n||e.pos!=this.stream.end||(n=new h,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new h,{pos:n,p:i}=e;return t.start=n,t.end=Math.min(n+1,i.stream.end),t.value=n==i.stream.end?i.parser.eofTerm:0,t}updateCachedToken(e,t,n){let i=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(i,e),n),e.value>-1){let{parser:t}=n.p;for(let i=0;i=0&&n.p.parser.dialect.allows(s>>1)){1&s?e.extended=s>>1:e.value=s>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,t,n,i){for(let t=0;t4*e.bufferLength?new w(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e,t,n=this.stacks,i=this.minStackPos,s=this.stacks=[];if(this.bigReductionCount>300&&1==n.length){let[e]=n;for(;e.forceReduce()&&e.stack.length&&e.stack[e.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;ri)s.push(o);else{if(this.advanceStack(o,s,n))continue;{e||(e=[],t=[]),e.push(o);let n=this.tokens.getMainToken(o);t.push(n.value,n.end)}}break}}if(!s.length){let t=e&&function(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||null!=e&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.scorethis.stoppedAt?e[0]:this.runRecovery(e,t,s);if(n)return y&&console.log("Force-finish "+this.stackID(n)),this.stackToTree(n.forceAll())}if(this.recovering){let e=1==this.recovering?1:3*this.recovering;if(s.length>e)for(s.sort(((e,t)=>t.score-e.score));s.length>e;)s.pop();s.some((e=>e.reducePos>i))&&this.recovering--}else if(s.length>1){e:for(let e=0;e500&&i.buffer.length>500){if(!((t.score-i.score||t.buffer.length-i.buffer.length)>0)){s.splice(e--,1);continue e}s.splice(n--,1)}}}s.length>12&&s.splice(12,s.length-12)}this.minStackPos=s[0].pos;for(let e=1;e ":"";if(null!=this.stoppedAt&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,n=t?e.curContext.hash:0;for(let a=this.fragments.nodeAt(s);a;){let s=this.parser.nodeSet.types[a.type.id]==a.type?r.getGoto(e.state,a.type.id):-1;if(s>-1&&a.length&&(!t||(a.prop(i.uY.contextHash)||0)==n))return e.useNode(a,s),y&&console.log(o+this.stackID(e)+` (via reuse of ${r.getName(a.type.id)})`),!0;if(!(a instanceof i.PH)||0==a.children.length||a.positions[0]>0)break;let l=a.children[0];if(!(l instanceof i.PH&&0==a.positions[0]))break;a=l}}let a=r.stateSlot(e.state,4);if(a>0)return e.reduce(a),y&&console.log(o+this.stackID(e)+` (via always-reduce ${r.getName(65535&a)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let i=0;is?t.push(f):n.push(f)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return C(e,t),!0}}runRecovery(e,t,n){let i=null,s=!1;for(let r=0;r ":"";if(o.deadEnd){if(s)continue;if(s=!0,o.restart(),y&&console.log(h+this.stackID(o)+" (restarted)"),this.advanceFully(o,n))continue}let c=o.split(),u=h;for(let e=0;c.forceReduce()&&e<10&&(y&&console.log(u+this.stackID(c)+" (via force-reduce)"),!this.advanceFully(c,n));e++)y&&(u=this.stackID(c)+" -> ");for(let e of o.recoverByInsert(a))y&&console.log(h+this.stackID(e)+" (via recover-insert)"),this.advanceFully(e,n);this.stream.end>o.pos?(l==o.pos&&(l++,a=0),o.recoverByDelete(a,l),y&&console.log(h+this.stackID(o)+` (via recover-delete ${this.parser.getName(a)})`),C(o,n)):(!i||i.scoree;class M{constructor(e){this.start=e.start,this.shift=e.shift||O,this.reduce=e.reduce||O,this.reuse=e.reuse||O,this.hash=e.hash||(()=>0),this.strict=!1!==e.strict}}class _ extends i.iX{constructor(e){if(super(),this.wrappers=[],14!=e.version)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let n=0;ne.topRules[t][1])),s=[];for(let e=0;e=0)r(i,e,t[n++]);else{let s=t[n+-i];for(let o=-i;o>0;o--)r(t[n++],e,s);n++}}}this.nodeSet=new i.fI(t.map(((t,r)=>i.Z6.define({name:r>=this.minRepeatTerm?void 0:t,id:r,props:s[r],top:n.indexOf(r)>-1,error:0==r,skipped:e.skippedNodes&&e.skippedNodes.indexOf(r)>-1})))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=i.cF;let o=l(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e"number"==typeof e?new f(o,e):e)),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let i=new S(this,e,t,n);for(let s of this.wrappers)i=s(i,e,t,n);return i}getGoto(e,t,n=!1){let i=this.goto;if(t>=i[0])return-1;for(let s=i[t+1];;){let t=i[s++],r=1&t,o=i[s++];if(r&&n)return o;for(let n=s+(t>>1);s0}validAction(e,t){return!!this.allActions(e,(e=>e==t||null))}allActions(e,t){let n=this.stateSlot(e,4),i=n?t(n):void 0;for(let n=this.stateSlot(e,1);null==i;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=T(this.data,n+2)}i=t(T(this.data,n+1))}return i}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=T(this.data,n+2)}if(!(1&this.data[n+2])){let e=this.data[n+1];t.some(((t,n)=>1&n&&t==e))||t.push(this.data[n],e)}}return t}configure(e){let t=Object.assign(Object.create(_.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map((t=>{let n=e.tokenizers.find((e=>e.from==t));return n?n.to:t}))),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map(((n,i)=>{let s=e.specializers.find((e=>e.from==n.external));if(!s)return n;let r=Object.assign(Object.assign({},n),{external:s.to});return t.specializers[i]=N(r),r}))),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),null!=e.strict&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),null!=e.bufferLength&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return null==t?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map((()=>!1));if(e)for(let i of e.split(" ")){let e=t.indexOf(i);e>=0&&(n[e]=!0)}let i=null;for(let e=0;ee.external(n,i)<<1|t}return e.get}},8104:(e,t,n)=>{"use strict";n.d(t,{G:()=>o});const i="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),s="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class o{constructor(e,t){this.rules=[];let{finish:n}=t||{};function i(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}function s(e,t,r,o){let a=[],l=/^@(\w+)\b/.exec(e[0]),h=l&&"keyframes"==l[1];if(l&&null==t)return r.push(e[0]+";");for(let n in t){let o=t[n];if(/&/.test(n))s(n.split(/,\s*/).map((t=>e.map((e=>t.replace(/&/,e))))).reduce(((e,t)=>e.concat(t))),o,r);else if(o&&"object"==typeof o){if(!l)throw new RangeError("The value of a property ("+n+") should be a primitive value.");s(i(n),o,a,h)}else null!=o&&a.push(n.replace(/_.*/,"").replace(/[A-Z]/g,(e=>"-"+e.toLowerCase()))+": "+o+";")}(a.length||h)&&r.push((!n||l||o?e:e.map(n)).join(", ")+" {"+a.join(" ")+"}")}for(let t in e)s(i(t),e[t],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let e=r[i]||1;return r[i]=e+1,"ͼ"+e.toString(36)}static mount(e,t,n){let i=e[s],r=n&&n.nonce;i?r&&i.setNonce(r):i=new l(e,r),i.mount(Array.isArray(t)?t:[t],e)}}let a=new Map;class l{constructor(e,t){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let t=a.get(n);if(t)return e[s]=t;this.sheet=new i.CSSStyleSheet,a.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[s]=this}mount(e,t){let n=this.sheet,i=0,s=0;for(let t=0;t-1&&(this.modules.splice(o,1),s--,o=-1),-1==o){if(this.modules.splice(s++,0,r),n)for(let e=0;e{"use strict";n.d(t,{Component:()=>zr});var i=n(4830),s=n(3173),r=n(9587),o=n(9066);function a(e,t){return({state:n,dispatch:i})=>{if(n.readOnly)return!1;let s=e(t,n);return!!s&&(i(n.update(s)),!0)}}const l=a(p,0),h=a(d,0),c=a(((e,t)=>d(e,t,function(e){let t=[];for(let n of e.selection.ranges){let i=e.doc.lineAt(n.from),s=n.to<=i.to?i:e.doc.lineAt(n.to),r=t.length-1;r>=0&&t[r].to>i.from?t[r].to=s.to:t.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:s.to})}return t}(t))),0);function u(e,t){let n=e.languageDataAt("commentTokens",t);return n.length?n[0]:{}}const f=50;function d(e,t,n=t.selection.ranges){let i=n.map((e=>u(t,e.from).block));if(!i.every((e=>e)))return null;let s=n.map(((e,n)=>function(e,{open:t,close:n},i,s){let r,o,a=e.sliceDoc(i-f,i),l=e.sliceDoc(s,s+f),h=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(l)[0].length,u=a.length-h;if(a.slice(u-t.length,u)==t&&l.slice(c,c+n.length)==n)return{open:{pos:i-h,margin:h&&1},close:{pos:s+c,margin:c&&1}};s-i<=2*f?r=o=e.sliceDoc(i,s):(r=e.sliceDoc(i,i+f),o=e.sliceDoc(s-f,s));let d=/^\s*/.exec(r)[0].length,p=/\s*$/.exec(o)[0].length,m=o.length-p-n.length;return r.slice(d,d+t.length)==t&&o.slice(m,m+n.length)==n?{open:{pos:i+d+t.length,margin:/\s/.test(r.charAt(d+t.length))?1:0},close:{pos:s-p-n.length,margin:/\s/.test(o.charAt(m-1))?1:0}}:null}(t,i[n],e.from,e.to)));if(2!=e&&!s.every((e=>e)))return{changes:t.changes(n.map(((e,t)=>s[t]?[]:[{from:e.from,insert:i[t].open+" "},{from:e.to,insert:" "+i[t].close}])))};if(1!=e&&s.some((e=>e))){let e=[];for(let t,n=0;ns&&(e==r||r>l.from)){s=l.from;let e=/^\s*/.exec(l.text)[0].length,t=e==l.length,n=l.text.slice(e,e+a.length)==a?e:-1;ee.comment<0&&(!e.empty||e.single)))){let e=[];for(let{line:t,token:n,indent:s,empty:r,single:o}of i)!o&&r||e.push({from:t.from+s,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&i.some((e=>e.comment>=0))){let e=[];for(let{line:t,comment:n,token:s}of i)if(n>=0){let i=t.from+n,r=i+s.length;" "==t.text[r-t.from]&&r++,e.push({from:i,to:r})}return{changes:e}}return null}const m=i.YH.define(),g=i.sj.define();class b{constructor(e,t,n,i,s){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new b(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null===(e=this.changes)||void 0===e?void 0:e.toJSON(),mapped:null===(t=this.mapped)||void 0===t?void 0:t.toJSON(),startSelection:null===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map((e=>e.toJSON()))}}static fromJSON(e){return new b(e.changes&&i.VR.fromJSON(e.changes),[],e.mapped&&i.Gu.fromJSON(e.mapped),e.startSelection&&i.OF.fromJSON(e.startSelection),e.selectionsAfter.map(i.OF.fromJSON))}static fromTransaction(e,t){let n=x;for(let t of e.startState.facet(g)){let i=t(e);i.length&&(n=n.concat(i))}return!n.length&&e.changes.empty?null:new b(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,x)}static selection(e){return new b(void 0,x,void 0,void 0,e)}}function y(e,t,n,i){let s=t+1>n+20?t-n-1:0,r=e.slice(s,t);return r.push(i),r}function v(e,t){return e.length?t.length?e.concat(t):e:t}const x=[];function w(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function k(e,t){if(!e.length)return e;let n=e.length,i=x;for(;n;){let s=S(e[n-1],t,i);if(s.changes&&!s.changes.empty||s.effects.length){let t=e.slice(0,n);return t[n-1]=s,t}t=s.mapped,n--,i=s.selectionsAfter}return i.length?[b.selection(i)]:x}function S(e,t,n){let s=v(e.selectionsAfter.length?e.selectionsAfter.map((e=>e.map(t))):x,n);if(!e.changes)return b.selection(s);let r=e.changes.map(t),o=t.mapDesc(e.changes,!0),a=e.mapped?e.mapped.composeDesc(o):o;return new b(r,i.Pe.mapEffects(e.effects,t),a,e.startSelection.map(o),s)}const C=/^(input\.type|delete)($|\.)/;class A{constructor(e,t,n=0,i=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=i}isolate(){return this.prevTime?new A(this.done,this.undone):this}addChanges(e,t,n,s,r){let o=this.done,a=o[o.length-1];return o=a&&a.changes&&!a.changes.empty&&e.changes&&(!n||C.test(n))&&(!a.selectionsAfter.length&&t-this.prevTimen.push(e,t))),t.iterChangedRanges(((e,t,s,r)=>{for(let e=0;e=t&&s<=o&&(i=!0)}})),i}(a.changes,e.changes))||"input.type.compose"==n)?y(o,o.length-1,s.minDepth,new b(e.changes.compose(a.changes),v(i.Pe.mapEffects(e.effects,a.changes),a.effects),a.mapped,a.startSelection,x)):y(o,o.length,s.minDepth,e),new A(o,x,t,n)}addSelection(e,t,n,i){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:x;return s.length>0&&t-this.prevTimee.empty!=o.ranges[t].empty)).length)?this:new A(function(e,t){if(e.length){let n=e[e.length-1],i=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-200));return i.length&&i[i.length-1].eq(t)?e:(i.push(t),y(e,e.length-1,1e9,n.setSelAfter(i)))}return[b.selection([t])]}(this.done,e),this.undone,t,n);var r,o}addMapping(e){return new A(k(this.done,e),k(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let i=0==e?this.done:this.undone;if(0==i.length)return null;let s=i[i.length-1],r=s.selectionsAfter[0]||t.selection;if(n&&s.selectionsAfter.length)return t.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:m.of({side:e,rest:w(i),selection:r}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let n=1==i.length?x:i.slice(0,i.length-1);return s.mapped&&(n=k(n,s.mapped)),t.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:m.of({side:e,rest:n,selection:r}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}return null}}function O(e,t){return i.OF.create(e.ranges.map(t),e.mainIndex)}function M(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function _({state:e,dispatch:t},n){let i=O(e.selection,n);return!i.eq(e.selection,!0)&&(t(M(e,i)),!0)}function T(e,t){return i.OF.cursor(t?e.to:e.from)}function N(e,t){return _(e,(n=>n.empty?e.moveByChar(n,t):T(n,t)))}function E(e){return e.textDirectionAt(e.state.selection.main.head)==s.OP.LTR}A.empty=new A(x,x);const D=e=>N(e,!E(e)),P=e=>N(e,E(e));function R(e,t){return _(e,(n=>n.empty?e.moveByGroup(n,t):T(n,t)))}function j(e,t,n){if(t.type.prop(n))return!0;let i=t.to-t.from;return i&&(i>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function I(e,t,n){let s,a,l=(0,r.mv)(e).resolveInner(t.head),h=n?o.uY.closedBy:o.uY.openedBy;for(let i=t.head;;){let t=n?l.childAfter(i):l.childBefore(i);if(!t)break;j(e,t,h)?l=t:i=n?t.to:t.from}return a=l.type.prop(h)&&(s=n?(0,r.jU)(e,l.from,1):(0,r.jU)(e,l.to,-1))&&s.matched?n?s.end.to:s.end.from:n?l.to:l.from,i.OF.cursor(a,n?-1:1)}function L(e,t){return _(e,(n=>{if(!n.empty)return T(n,t);let i=e.moveVertically(n,t);return i.head!=n.head?i:e.moveToLineBoundary(n,t)}))}"undefined"!=typeof Intl&&Intl.Segmenter;const B=e=>L(e,!1),F=e=>L(e,!0);function z(e){let t,n=e.scrollDOM.clientHeightn.empty?e.moveVertically(n,t,i.height):T(n,t)));if(o.eq(r.selection))return!1;if(i.selfScroll){let t=e.coordsAtPos(r.selection.main.head),a=e.scrollDOM.getBoundingClientRect(),l=a.top+i.marginTop,h=a.bottom-i.marginBottom;t&&t.top>l&&t.bottom$(e,!1),q=e=>$(e,!0);function V(e,t,n){let s=e.lineBlockAt(t.head),r=e.moveToLineBoundary(t,n);if(r.head==t.head&&r.head!=(n?s.to:s.from)&&(r=e.moveToLineBoundary(t,n,!1)),!n&&r.head==s.from&&s.length){let n=/^\s*/.exec(e.state.sliceDoc(s.from,Math.min(s.from+100,s.to)))[0].length;n&&t.head!=s.from+n&&(r=i.OF.cursor(s.from+n))}return r}function W(e,t){let n=O(e.state.selection,(e=>{let n=t(e);return i.OF.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)}));return!n.eq(e.state.selection)&&(e.dispatch(M(e.state,n)),!0)}function G(e,t){return W(e,(n=>e.moveByChar(n,t)))}const U=e=>G(e,!E(e)),K=e=>G(e,E(e));function Y(e,t){return W(e,(n=>e.moveByGroup(n,t)))}function J(e,t){return W(e,(n=>e.moveVertically(n,t)))}const X=e=>J(e,!1),Z=e=>J(e,!0);function Q(e,t){return W(e,(n=>e.moveVertically(n,t,z(e).height)))}const ee=e=>Q(e,!1),te=e=>Q(e,!0),ne=({state:e,dispatch:t})=>(t(M(e,{anchor:0})),!0),ie=({state:e,dispatch:t})=>(t(M(e,{anchor:e.doc.length})),!0),se=({state:e,dispatch:t})=>(t(M(e,{anchor:e.selection.main.anchor,head:0})),!0),re=({state:e,dispatch:t})=>(t(M(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),oe=({state:e,dispatch:t})=>{let n=e.selection,s=null;return n.ranges.length>1?s=i.OF.create([n.main]):n.main.empty||(s=i.OF.create([i.OF.cursor(n.main.head)])),!!s&&(t(M(e,s)),!0)};function ae(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,o=r.changeByRange((s=>{let{from:r,to:o}=s;if(r==o){let i=t(s);ir&&(n="delete.forward",i=le(e,i,!0)),r=Math.min(r,i),o=Math.max(o,i)}else r=le(e,r,!1),o=le(e,o,!0);return r==o?{range:s}:{changes:{from:r,to:o},range:i.OF.cursor(r,rt(e))))i.between(t,t,((e,i)=>{et&&(t=n?i:e)}));return t}const he=(e,t,n)=>ae(e,(s=>{let o,a,l=s.from,{state:h}=e,c=h.doc.lineAt(l);if(n&&!t&&l>c.from&&lhe(e,!1,!0),ue=e=>he(e,!0,!1),fe=(e,t)=>ae(e,(n=>{let s=n.head,{state:r}=e,o=r.doc.lineAt(s),a=r.charCategorizer(s);for(let e=null;;){if(s==(t?o.to:o.from)){s==n.head&&o.number!=(t?r.doc.lines:1)&&(s+=t?1:-1);break}let l=(0,i.zK)(o.text,s-o.from,t)+o.from,h=o.text.slice(Math.min(s,l)-o.from,Math.max(s,l)-o.from),c=a(h);if(null!=e&&c!=e)break;" "==h&&s==n.head||(e=c),s=l}return s})),de=e=>fe(e,!1);function pe(e){let t=[],n=-1;for(let i of e.selection.ranges){let s=e.doc.lineAt(i.from),r=e.doc.lineAt(i.to);if(i.empty||i.to!=r.from||(r=e.doc.lineAt(i.to-1)),n>=s.number){let e=t[t.length-1];e.to=r.to,e.ranges.push(i)}else t.push({from:s.from,to:r.to,ranges:[i]});n=r.number+1}return t}function me(e,t,n){if(e.readOnly)return!1;let s=[],r=[];for(let t of pe(e)){if(n?t.to==e.doc.length:0==t.from)continue;let o=e.doc.lineAt(n?t.to+1:t.from-1),a=o.length+1;if(n){s.push({from:t.to,to:o.to},{from:t.from,insert:o.text+e.lineBreak});for(let n of t.ranges)r.push(i.OF.range(Math.min(e.doc.length,n.anchor+a),Math.min(e.doc.length,n.head+a)))}else{s.push({from:o.from,to:t.from},{from:t.to,insert:e.lineBreak+o.text});for(let e of t.ranges)r.push(i.OF.range(e.anchor-a,e.head-a))}}return!!s.length&&(t(e.update({changes:s,scrollIntoView:!0,selection:i.OF.create(r,e.selection.mainIndex),userEvent:"move.line"})),!0)}function ge(e,t,n){if(e.readOnly)return!1;let i=[];for(let t of pe(e))n?i.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):i.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});return t(e.update({changes:i,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const be=ve(!1),ye=ve(!0);function ve(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let s=t.changeByRange((n=>{let{from:s,to:a}=n,l=t.doc.lineAt(s),h=!e&&s==a&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n,i=(0,r.mv)(e).resolveInner(t),s=i.childBefore(t),a=i.childAfter(t);return s&&a&&s.to<=t&&a.from>=t&&(n=s.type.prop(o.uY.closedBy))&&n.indexOf(a.name)>-1&&e.doc.lineAt(s.to).from==e.doc.lineAt(a.from).from&&!/\S/.test(e.sliceDoc(s.to,a.from))?{from:s.to,to:a.from}:null}(t,s);e&&(s=a=(a<=l.to?l:t.doc.lineAt(a)).to);let c=new r.KB(t,{simulateBreak:s,simulateDoubleBreak:!!h}),u=(0,r._v)(c,s);for(null==u&&(u=(0,i.y$)(/^\s*/.exec(t.doc.lineAt(s).text)[0],t.tabSize));al.from&&s{let r=[];for(let i=s.from;i<=s.to;){let o=e.doc.lineAt(i);o.number>n&&(s.empty||s.to>o.from)&&(t(o,r,s),n=o.number),i=o.to+1}let o=e.changes(r);return{changes:r,range:i.OF.range(o.mapPos(s.anchor,1),o.mapPos(s.head,1))}}))}const we=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(xe(e,((t,n)=>{n.push({from:t.from,insert:e.facet(r.Xt)})})),{userEvent:"input.indent"})),!0),ke=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(xe(e,((t,n)=>{let s=/^\s*/.exec(t.text)[0];if(!s)return;let o=(0,i.y$)(s,e.tabSize),a=0,l=(0,r.EI)(e,Math.max(0,o-(0,r.tp)(e)));for(;a_(e,(t=>I(e.state,t,!E(e)))),shift:e=>W(e,(t=>I(e.state,t,!E(e))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>_(e,(t=>I(e.state,t,E(e)))),shift:e=>W(e,(t=>I(e.state,t,E(e))))},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>me(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>ge(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>me(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>ge(e,t,!0)},{key:"Escape",run:oe},{key:"Mod-Enter",run:ye},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let n=pe(e).map((({from:t,to:n})=>i.OF.range(t,Math.min(n+1,e.doc.length))));return t(e.update({selection:i.OF.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let n=O(e.selection,(t=>{var n;for(let s=(0,r.mv)(e).resolveStack(t.from,1);s;s=s.next){let{node:e}=s;if((e.from=t.to||e.to>t.to&&e.from<=t.from)&&(null===(n=e.parent)||void 0===n?void 0:n.parent))return i.OF.range(e.to,e.from)}return t}));return t(M(e,n)),!0},preventDefault:!0},{key:"Mod-[",run:ke},{key:"Mod-]",run:we},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),i=new r.KB(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),s=xe(e,((t,s,o)=>{let a=(0,r._v)(i,t.from);if(null==a)return;/\S/.test(t.text)||(a=0);let l=/^\s*/.exec(t.text)[0],h=(0,r.EI)(e,a);(l!=h||o.from{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(pe(t).map((({from:e,to:n})=>(e>0?e--:n{let n;if(e.lineWrapping){let i=e.lineBlockAt(t.head),s=e.coordsAtPos(t.head,t.assoc||1);s&&(n=i.bottom+e.documentTop-s.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)})).map(n);return e.dispatch({changes:n,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>function(e,t,n){let s=!1,o=O(e.selection,(t=>{let o=(0,r.jU)(e,t.head,-1)||(0,r.jU)(e,t.head,1)||t.head>0&&(0,r.jU)(e,t.head-1,1)||t.head{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),i=u(e.state,n.from);return i.line?l(e):!!i.block&&c(e)}},{key:"Alt-A",run:h},{key:"Ctrl-m",mac:"Shift-Alt-m",run:e=>(e.setTabFocusMode(),!0)}].concat([{key:"ArrowLeft",run:D,shift:U,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>R(e,!E(e)),shift:e=>Y(e,!E(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>_(e,(t=>V(e,t,!E(e)))),shift:e=>W(e,(t=>V(e,t,!E(e)))),preventDefault:!0},{key:"ArrowRight",run:P,shift:K,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>R(e,E(e)),shift:e=>Y(e,E(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>_(e,(t=>V(e,t,E(e)))),shift:e=>W(e,(t=>V(e,t,E(e)))),preventDefault:!0},{key:"ArrowUp",run:B,shift:X,preventDefault:!0},{mac:"Cmd-ArrowUp",run:ne,shift:se},{mac:"Ctrl-ArrowUp",run:H,shift:ee},{key:"ArrowDown",run:F,shift:Z,preventDefault:!0},{mac:"Cmd-ArrowDown",run:ie,shift:re},{mac:"Ctrl-ArrowDown",run:q,shift:te},{key:"PageUp",run:H,shift:ee},{key:"PageDown",run:q,shift:te},{key:"Home",run:e=>_(e,(t=>V(e,t,!1))),shift:e=>W(e,(t=>V(e,t,!1))),preventDefault:!0},{key:"Mod-Home",run:ne,shift:se},{key:"End",run:e=>_(e,(t=>V(e,t,!0))),shift:e=>W(e,(t=>V(e,t,!0))),preventDefault:!0},{key:"Mod-End",run:ie,shift:re},{key:"Enter",run:be},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:ce,shift:ce},{key:"Delete",run:ue},{key:"Mod-Backspace",mac:"Alt-Backspace",run:de},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>fe(e,!0)},{mac:"Mod-Backspace",run:e=>ae(e,(t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}))},{mac:"Mod-Delete",run:e=>ae(e,(t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head_(e,(t=>i.OF.cursor(e.lineBlockAt(t.head).from,1))),shift:e=>W(e,(t=>i.OF.cursor(e.lineBlockAt(t.head).from)))},{key:"Ctrl-e",run:e=>_(e,(t=>i.OF.cursor(e.lineBlockAt(t.head).to,-1))),shift:e=>W(e,(t=>i.OF.cursor(e.lineBlockAt(t.head).to)))},{key:"Ctrl-d",run:ue},{key:"Ctrl-h",run:ce},{key:"Ctrl-k",run:e=>ae(e,(t=>{let n=e.lineBlockAt(t.head).to;return t.head{if(e.readOnly)return!1;let n=e.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:i.EY.of(["",""])},range:i.OF.cursor(e.from)})));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,s=e.doc.lineAt(n),r=n==s.from?n-1:(0,i.zK)(s.text,n-s.from,!1)+s.from,o=n==s.to?n+1:(0,i.zK)(s.text,n-s.from,!0)+s.from;return{changes:{from:r,to:o,insert:e.doc.slice(n,o).append(e.doc.slice(r,n))},range:i.OF.cursor(o)}}));return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:q}].map((e=>({mac:e.key,run:e.run,shift:e.shift})))));var Ce=n(5764);new Ce.Token("@jupyterlab/codeeditor:IEditorServices","A service for the text editor provider\n for the application. Use this to create new text editors and host them in your\n UI elements."),new Ce.Token("@jupyterlab/codeeditor:IPositionModel","A service to handle an code editor cursor position.");const Ae="[data-jp-code-runner]";var Oe;!function(e){e.indentMoreOrInsertTab=function(e){var t;if(null===(t=e.dom.parentElement)||void 0===t?void 0:t.classList.contains("jp-mod-completer-enabled"))return!1;const n={state:e.state,dispatch:e.dispatch},i=e.state.selection.main.from;if(i!=e.state.selection.main.to)return we(n);const s=e.state.doc.lineAt(i),r=e.state.doc.slice(s.from,i).toString();return/^\s*$/.test(r)?we(n):(({state:e,dispatch:t})=>e.selection.ranges.some((e=>!e.empty))?we({state:e,dispatch:t}):(t(e.update(e.replaceSelection("\t"),{scrollIntoView:!0,userEvent:"input"})),!0))(n)},e.completerOrInsertNewLine=function(e){var t;if(null===(t=e.dom.parentElement)||void 0===t?void 0:t.classList.contains("jp-mod-completer-active"))return!1;if(e.dom.closest('[data-jp-interaction-mode="terminal"]'))return!1;const n={state:e.state,dispatch:e.dispatch};return be(n)},e.preventNewLineOnRun=function(e){return!!e.dom.closest(Ae)},e.insertBlankLineOnRun=function(e){if(e.dom.closest(Ae))return!1;{const t={state:e.state,dispatch:e.dispatch};return ye(t)}},e.simplifySelectionAndMaybeSwitchToCommandMode=function(e){const t={state:e.state,dispatch:e.dispatch},n=oe(t);return!e.dom.closest(".jp-mod-editMode .jp-Cell.jp-mod-active")&&n},e.dedentIfNotLaunchingTooltip=function(e){return!e.dom.closest(".jp-CodeMirrorEditor:not(.jp-mod-has-primary-selection):not(.jp-mod-in-leading-whitespace):not(.jp-mod-completer-active)")&&ke(e)}}(Oe||(Oe={}));var Me=n(8571),_e=n(7213),Te=n(509);const Ne=i.sj.define({combine:e=>(0,i.QR)(e,{fontFamily:null,fontSize:null,lineHeight:null},{fontFamily:(e,t)=>null!=e?e:t,fontSize:(e,t)=>null!=e?e:t,lineHeight:(e,t)=>null!=e?e:t})});function Ee(e){const{fontFamily:t,fontSize:n,lineHeight:i}=e.state.facet(Ne);let s="";return n&&(s+=`font-size: ${n}px !important;`),t&&(s+=`font-family: ${t} !important;`),i&&(s+=`line-height: ${i.toString()} !important`),{style:s}}var De=n(9913);const Pe="InlineMathDollar",Re="InlineMathBracket",je="BlockMathDollar",Ie="BlockMathBracket",Le={[Pe]:1,[Re]:3,[je]:2,[Ie]:3};Object.keys(Le).reduce(((e,t)=>(e[t]={mark:`${t}Mark`,resolve:t},e)),{});const Be="cm-rulers",Fe=s.Lz.baseTheme({[`.${Be}`]:{borderRight:"1px dotted gray",opacity:.7}}),ze=i.sj.define({combine:e=>e.reduce(((e,t)=>e.concat(t.filter(((n,i)=>!e.includes(n)&&i==t.lastIndexOf(n))))),[])}),$e=s.Z9.fromClass(class{constructor(e){var t,n;this.rulersContainer=e.dom.appendChild(document.createElement("div")),this.rulersContainer.style.cssText="\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n overflow: hidden;\n ";const i=e.defaultCharacterWidth,s=e.state.facet(ze),r=null!==(n=null===(t=e.scrollDOM.querySelector(".cm-gutters"))||void 0===t?void 0:t.clientWidth)&&void 0!==n?n:0;this.rulers=s.map((e=>{const t=this.rulersContainer.appendChild(document.createElement("div"));return t.classList.add(Be),t.style.cssText=`\n position: absolute;\n left: ${r+e*i}px;\n height: 100%;\n `,t.style.width="6px",t}))}update(e){var t,n;const i=e.view.state.facet(ze);if(e.viewportChanged||e.geometryChanged||!Ce.JSONExt.deepEqual(i,e.startState.facet(ze))){const s=null!==(n=null===(t=e.view.scrollDOM.querySelector(".cm-gutters"))||void 0===t?void 0:t.clientWidth)&&void 0!==n?n:0,r=e.view.defaultCharacterWidth;this.rulers.forEach(((e,t)=>{e.style.left=`${s+i[t]*r}px`}))}}destroy(){this.rulers.forEach((e=>{e.remove()})),this.rulersContainer.remove()}}),He=i.sj.define({combine:e=>e[e.length-1]}),qe=i.YH.define();function Ve(){var e=arguments[0];"string"==typeof e&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&"object"==typeof n&&null==n.nodeType&&!Array.isArray(n)){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){var s=n[i];"string"==typeof s?e.setAttribute(i,s):null!=s&&(e[i]=s)}t++}for(;t{var i;if(n.origin!==this.conf){const n=t.delta,s=[];let r=0;for(let e=0;e0&&e.transactions[0].annotation(qe)===this.conf)return;const t=this.conf.ytext;t.doc.transact((()=>{let n=0;e.changes.iterChanges(((e,i,s,r,o)=>{const a=o.sliceString(0,o.length,"\n");e!==i&&t.delete(e+n,i-e),a.length>0&&t.insert(e+n,a),n+=a.length-(i-e)}))}),this.conf)}destroy(){this._ytext.unobserve(this._observer)}});const Ge="function"==typeof String.prototype.normalize?e=>e.normalize("NFKD"):e=>e;class Ue{constructor(e,t,n=0,i=e.length,s,r){this.test=r,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,i),this.bufferStart=n,this.normalize=s?e=>s(Ge(e)):Ge,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return(0,i.vS)(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=(0,i.MK)(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=(0,i.Fh)(e);let s=this.normalize(t);for(let e=0,i=n;;e++){let r=s.charCodeAt(e),o=this.match(r,i,this.bufferPos+this.bufferStart);if(e==s.length-1){if(o)return this.value=o,this;break}i==n&&ethis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,i=n+t[0].length;if(this.matchPos=et(this.text,i+(n==i?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(nthis.value.to)&&(!this.test||this.test(n,i,t)))return this.value={from:n,to:i,match:t},this;e=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length=n||i.to<=t){let i=new Ze(t,e.sliceString(t,n));return Xe.set(e,i),i}if(i.from==t&&i.to==n)return i;let{text:s,from:r}=i;return r>t&&(s=e.sliceString(t,r)+s,r=t),i.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=et(this.text,n+(e==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ze.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function et(e,t){if(t>=e.length)return t;let n,i=e.lineAt(t);for(;t=56320&&n<57344;)t++;return t}"undefined"!=typeof Symbol&&(Je.prototype[Symbol.iterator]=Qe.prototype[Symbol.iterator]=function(){return this});const tt=i.sj.define({combine:e=>(0,i.QR)(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Nt(e),scrollToMatch:e=>s.Lz.scrollIntoView(e)})});class nt{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||function(e){try{return new RegExp(e,Ye),!0}catch(e){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,((e,t)=>"n"==t?"\n":"r"==t?"\r":"t"==t?"\t":"\\"))}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new ht(this):new rt(this)}getCursor(e,t=0,n){let s=e.doc?e:i.$t.create({doc:e});return null==n&&(n=s.doc.length),this.regexp?ot(this,s,t,n):st(this,s,t,n)}}class it{constructor(e){this.spec=e}}function st(e,t,n,s){return new Ue(t.doc,e.unquoted,n,s,e.caseSensitive?void 0:e=>e.toLowerCase(),e.wholeWord?(r=t.doc,o=t.charCategorizer(t.selection.main.head),(e,t,n,s)=>((s>e||s+n.length=t)return null;i.push(n.value)}return i}highlight(e,t,n,i){let s=st(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}function ot(e,t,n,s){return new Je(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:e.wholeWord?(r=t.charCategorizer(t.selection.main.head),(e,t,n)=>!n[0].length||(r(at(n.input,n.index))!=i.Je.Word||r(lt(n.input,n.index))!=i.Je.Word)&&(r(lt(n.input,n.index+n[0].length))!=i.Je.Word||r(at(n.input,n.index+n[0].length))!=i.Je.Word)):void 0},n,s);var r}function at(e,t){return e.slice((0,i.zK)(e,t,!1),t)}function lt(e,t){return e.slice(t,(0,i.zK)(e,t))}class ht extends it{nextMatch(e,t,n){let i=ot(this.spec,e,n,e.doc.length).next();return i.done&&(i=ot(this.spec,e,0,t).next()),i.done?null:i.value}prevMatchInRange(e,t,n){for(let i=1;;i++){let s=Math.max(t,n-1e4*i),r=ot(this.spec,e,s,n),o=null;for(;!r.next().done;)o=r.value;if(o&&(s==t||o.from>s+10))return o;if(s==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,((t,n)=>"$"==n?"$":"&"==n?e.match[0]:"0"!=n&&+n=t)return null;i.push(n.value)}return i}highlight(e,t,n,i){let s=ot(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}const ct=i.Pe.define(),ut=i.Pe.define(),ft=i.sU.define({create:e=>new dt(At(e).create(),null),update(e,t){for(let n of t.effects)n.is(ct)?e=new dt(n.value.create(),e.panel):n.is(ut)&&(e=new dt(e.query,n.value?Ct:null));return e},provide:e=>s.S7.from(e,(e=>e.panel))});class dt{constructor(e,t){this.query=e,this.panel=t}}const pt=s.NZ.mark({class:"cm-searchMatch"}),mt=s.NZ.mark({class:"cm-searchMatch cm-searchMatch-selected"}),gt=s.Z9.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(ft))}update(e){let t=e.state.field(ft);(t!=e.startState.field(ft)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return s.NZ.none;let{view:n}=this,r=new i.vB;for(let t=0,i=n.visibleRanges,s=i.length;ti[t+1].from-500;)a=i[++t].to;e.highlight(n.state,o,a,((e,t)=>{let i=n.state.selection.ranges.some((n=>n.from==e&&n.to==t));r.add(e,t,i?mt:pt)}))}return r.finish()}},{decorations:e=>e.decorations});function bt(e){return t=>{let n=t.state.field(ft,!1);return n&&n.query.spec.valid?e(t,n):_t(t)}}const yt=bt(((e,{query:t})=>{let{to:n}=e.state.selection.main,s=t.nextMatch(e.state,n,n);if(!s)return!1;let r=i.OF.single(s.from,s.to),o=e.state.facet(tt);return e.dispatch({selection:r,effects:[Rt(e,s),o.scrollToMatch(r.main,e)],userEvent:"select.search"}),Mt(e),!0})),vt=bt(((e,{query:t})=>{let{state:n}=e,{from:s}=n.selection.main,r=t.prevMatch(n,s,s);if(!r)return!1;let o=i.OF.single(r.from,r.to),a=e.state.facet(tt);return e.dispatch({selection:o,effects:[Rt(e,r),a.scrollToMatch(o.main,e)],userEvent:"select.search"}),Mt(e),!0})),xt=bt(((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!(!n||!n.length||(e.dispatch({selection:i.OF.create(n.map((e=>i.OF.range(e.from,e.to)))),userEvent:"select.search.matches"}),0))})),wt=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:s,to:r}=n.main,o=[],a=0;for(let t=new Ue(e.doc,e.sliceDoc(s,r));!t.next().done;){if(o.length>1e3)return!1;t.value.from==s&&(a=o.length),o.push(i.OF.range(t.value.from,t.value.to))}return t(e.update({selection:i.OF.create(o,a),userEvent:"select.search.matches"})),!0},kt=bt(((e,{query:t})=>{let{state:n}=e,{from:r,to:o}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let l,h,c=[],u=[];if(a.from==r&&a.to==o&&(h=n.toText(t.getReplacement(a)),c.push({from:a.from,to:a.to,insert:h}),a=t.nextMatch(n,a.from,a.to),u.push(s.Lz.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."))),a){let t=0==c.length||c[0].from>=a.to?0:a.to-a.from-h.length;l=i.OF.single(a.from-t,a.to-t),u.push(Rt(e,a)),u.push(n.facet(tt).scrollToMatch(l.main,e))}return e.dispatch({changes:c,selection:l,effects:u,userEvent:"input.replace"}),!0})),St=bt(((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map((e=>{let{from:n,to:i}=e;return{from:n,to:i,insert:t.getReplacement(e)}}));if(!n.length)return!1;let i=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:s.Lz.announce.of(i),userEvent:"input.replace.all"}),!0}));function Ct(e){return e.state.facet(tt).createPanel(e)}function At(e,t){var n,i,s,r,o;let a=e.selection.main,l=a.empty||a.to>a.from+100?"":e.sliceDoc(a.from,a.to);if(t&&!l)return t;let h=e.facet(tt);return new nt({search:(null!==(n=null==t?void 0:t.literal)&&void 0!==n?n:h.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:null!==(i=null==t?void 0:t.caseSensitive)&&void 0!==i?i:h.caseSensitive,literal:null!==(s=null==t?void 0:t.literal)&&void 0!==s?s:h.literal,regexp:null!==(r=null==t?void 0:t.regexp)&&void 0!==r?r:h.regexp,wholeWord:null!==(o=null==t?void 0:t.wholeWord)&&void 0!==o?o:h.wholeWord})}function Ot(e){let t=(0,s.ld)(e,Ct);return t&&t.dom.querySelector("[main-field]")}function Mt(e){let t=Ot(e);t&&t==e.root.activeElement&&t.select()}const _t=e=>{let t=e.state.field(ft,!1);if(t&&t.panel){let n=Ot(e);if(n&&n!=e.root.activeElement){let i=At(e.state,t.query.spec);i.valid&&e.dispatch({effects:ct.of(i)}),n.focus(),n.select()}}else e.dispatch({effects:[ut.of(!0),t?ct.of(At(e.state,t.query.spec)):i.Pe.appendConfig.of(It)]});return!0},Tt=e=>{let t=e.state.field(ft,!1);if(!t||!t.panel)return!1;let n=(0,s.ld)(e,Ct);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:ut.of(!1)}),!0};class Nt{constructor(e){this.view=e;let t=this.query=e.state.field(ft).query.spec;function n(e,t,n){return Ve("button",{class:"cm-button",name:e,onclick:t,type:"button"},n)}this.commit=this.commit.bind(this),this.searchField=Ve("input",{value:t.search,placeholder:Et(e,"Find"),"aria-label":Et(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Ve("input",{value:t.replace,placeholder:Et(e,"Replace"),"aria-label":Et(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Ve("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=Ve("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=Ve("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit}),this.dom=Ve("div",{onkeydown:e=>this.keydown(e),class:"cm-search"},[this.searchField,n("next",(()=>yt(e)),[Et(e,"next")]),n("prev",(()=>vt(e)),[Et(e,"previous")]),n("select",(()=>xt(e)),[Et(e,"all")]),Ve("label",null,[this.caseField,Et(e,"match case")]),Ve("label",null,[this.reField,Et(e,"regexp")]),Ve("label",null,[this.wordField,Et(e,"by word")]),...e.state.readOnly?[]:[Ve("br"),this.replaceField,n("replace",(()=>kt(e)),[Et(e,"replace")]),n("replaceAll",(()=>St(e)),[Et(e,"replace all")])],Ve("button",{name:"close",onclick:()=>Tt(e),"aria-label":Et(e,"close"),type:"button"},["×"])])}commit(){let e=new nt({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:ct.of(e)}))}keydown(e){(0,s.TS)(this.view,e,"search-panel")?e.preventDefault():13==e.keyCode&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?vt:yt)(this.view)):13==e.keyCode&&e.target==this.replaceField&&(e.preventDefault(),kt(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(ct)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(tt).top}}function Et(e,t){return e.state.phrase(t)}const Dt=30,Pt=/[\s\.,:;?!]/;function Rt(e,{from:t,to:n}){let i=e.state.doc.lineAt(t),r=e.state.doc.lineAt(n).to,o=Math.max(i.from,t-Dt),a=Math.min(r,n+Dt),l=e.state.sliceDoc(o,a);if(o!=i.from)for(let e=0;el.length-Dt;e--)if(!Pt.test(l[e-1])&&Pt.test(l[e])){l=l.slice(0,e);break}return s.Lz.announce.of(`${e.state.phrase("current match")}. ${l} ${e.state.phrase("on line")} ${i.number}.`)}const jt=s.Lz.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),It=[ft,i.Nb.low(gt),jt];class Lt{constructor({baseConfiguration:e,config:t,defaultExtensions:n}={}){this._configChanged=new Me.Signal(this),this._disposed=new Me.Signal(this),this._isDisposed=!1,this._immutables=new Set,this._baseConfig=null!=e?e:{},this._config=null!=t?t:{},this._configurableBuilderMap=new Map(n);const i=Object.keys(this._config).concat(Object.keys(this._baseConfig));this._immutables=new Set([...this._configurableBuilderMap.keys()].filter((e=>!i.includes(e))))}get configChanged(){return this._configChanged}get disposed(){return this._disposed}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,this._disposed.emit(),Me.Signal.clearData(this))}getOption(e){var t;return null!==(t=this._config[e])&&void 0!==t?t:this._baseConfig[e]}hasOption(e){return Object.keys(this._config).includes(e)||Object.keys(this._baseConfig).includes(e)}setOption(e,t){this._config[e]!==t&&(this._config[e]=t,this._configChanged.emit({[e]:t}))}setBaseOptions(e){const t=this._getChangedOptions(e,this._baseConfig);if(t.length>0){this._baseConfig=e;const n=Object.keys(this._config),i=t.filter((e=>!n.includes(e)));i.length>0&&this._configChanged.emit(i.reduce(((e,t)=>(e[t]=this._baseConfig[t],e)),{}))}}setOptions(e){const t=this._getChangedOptions(e,this._config);t.length>0&&(this._config={...e},this._configChanged.emit(t.reduce(((e,t)=>{var n;return e[t]=null!==(n=this._config[t])&&void 0!==n?n:this._baseConfig[t],e}),{})))}reconfigureExtension(e,t,n){const i=this.getEffect(e.state,t,n);i&&e.dispatch({effects:[i]})}reconfigureExtensions(e,t){const n=Object.keys(t).filter((e=>this.has(e))).map((n=>this.getEffect(e.state,n,t[n])));e.dispatch({effects:n.filter((e=>null!==e))})}injectExtension(e,t){e.dispatch({effects:i.Pe.appendConfig.of(t)})}getInitialExtensions(){const e={...this._baseConfig,...this._config},t=[...this._immutables].map((e=>{var t;return null===(t=this.get(e))||void 0===t?void 0:t.instance(void 0)})).filter((e=>e));for(const n of Object.keys(e)){const i=this.get(n);if(i){const s=e[n];t.push(i.instance(s))}}return t}get(e){return this._configurableBuilderMap.get(e)}has(e){return this._configurableBuilderMap.has(e)}getEffect(e,t,n){var i;const s=this.get(t);return null!==(i=null==s?void 0:s.reconfigure(n))&&void 0!==i?i:null}_getChangedOptions(e,t){const n=new Array,i=new Array;for(const[s,r]of Object.entries(e))i.push(s),t[s]!==r&&n.push(s);return n.push(...Object.keys(t).filter((e=>!i.includes(e)))),n}}class Bt{constructor(){this.configurationBuilder=new Map,this.configurationSchema={},this.defaultOptions={},this.handlers=new Set,this.immutableExtensions=new Set,this._baseConfiguration={}}get baseConfiguration(){return{...this.defaultOptions,...this._baseConfiguration}}set baseConfiguration(e){if(!Ce.JSONExt.deepEqual(e,this._baseConfiguration)){this._baseConfiguration=e;for(const e of this.handlers)e.setBaseOptions(this.baseConfiguration)}}get defaultConfiguration(){return Object.freeze({...this.defaultOptions})}get settingsSchema(){return Object.freeze(Ce.JSONExt.deepCopy(this.configurationSchema))}addExtension(e){var t;if(this.configurationBuilder.has(e.name))throw new Error(`Extension named ${e.name} is already registered.`);this.configurationBuilder.set(e.name,e),void 0!==e.default&&(this.defaultOptions[e.name]=e.default),e.schema&&(this.configurationSchema[e.name]={default:null!==(t=e.default)&&void 0!==t?t:null,...e.schema},this.defaultOptions[e.name]=this.configurationSchema[e.name].default)}createNew(e){const t=new Array;for(const[n,i]of this.configurationBuilder.entries()){const s=i.factory(e);s&&t.push([n,s])}const n=new Lt({baseConfiguration:this.baseConfiguration,config:e.config,defaultExtensions:t});return this.handlers.add(n),n.disposed.connect((()=>{this.handlers.delete(n)})),n}}var Ft;!function(e){class t{constructor(e){this._compartment=new i.xx,this._builder=e}instance(e){return this._compartment.of(this._builder(e))}reconfigure(e){return this._compartment.reconfigure(this._builder(e))}}class n{constructor(e){this._extension=e}instance(){return this._extension}reconfigure(){return null}}function o(e){return new t(e)}function a(e,n=[]){return new t((t=>t?e:n))}function l(e){return new n(e)}e.createConfigurableExtension=o,e.createConditionalExtension=a,e.createImmutableExtension=l,e.getDefaultExtensions=function(e={}){const{themes:t,translator:n}=e,h=(null!=n?n:Te.wK).load("jupyterlab"),c=[Object.freeze({name:"autoClosingBrackets",default:!1,factory:()=>a((0,_e.wm)()),schema:{type:"boolean",title:h.__("Auto Closing Brackets")}}),Object.freeze({name:"codeFolding",default:!1,factory:()=>a((0,r.Lv)()),schema:{type:"boolean",title:h.__("Code Folding")}}),Object.freeze({name:"cursorBlinkRate",default:1200,factory:()=>o((e=>(0,s.VH)({cursorBlinkRate:e}))),schema:{type:"number",title:h.__("Cursor blinking rate"),description:h.__("Half-period in milliseconds used for cursor blinking. The default blink rate is 1200ms. By setting this to zero, blinking can be disabled.")}}),Object.freeze({name:"highlightActiveLine",default:!1,factory:()=>a((0,s.dz)()),schema:{type:"boolean",title:h.__("Highlight the active line")}}),Object.freeze({name:"highlightSpecialCharacters",default:!0,factory:()=>a((0,s.N$)()),schema:{type:"boolean",title:h.__("Highlight special characters")}}),Object.freeze({name:"highlightTrailingWhitespace",default:!1,factory:()=>a((0,s.wu)()),schema:{type:"boolean",title:h.__("Highlight trailing white spaces")}}),Object.freeze({name:"highlightWhitespace",default:!1,factory:()=>a((0,s.Yq)()),schema:{type:"boolean",title:h.__("Highlight white spaces")}}),Object.freeze({name:"indentUnit",default:"4",factory:()=>o((e=>"Tab"==e?r.Xt.of("\t"):r.Xt.of(" ".repeat(parseInt(e,10))))),schema:{type:"string",title:h.__("Indentation unit"),description:h.__("The indentation is a `Tab` or the number of spaces. This defaults to 4 spaces."),enum:["Tab","1","2","4","8"]}}),Object.freeze({name:"keymap",default:[{key:"Mod-Enter",run:Oe.insertBlankLineOnRun},{key:"Enter",run:Oe.completerOrInsertNewLine},{key:"Escape",run:Oe.simplifySelectionAndMaybeSwitchToCommandMode},...Se.filter((e=>!["Mod-Enter","Shift-Mod-k","Mod-/","Alt-A","Escape","Enter"].includes(e.key))),{key:"Tab",run:Oe.indentMoreOrInsertTab,shift:Oe.dedentIfNotLaunchingTooltip}],factory:()=>o((e=>s.w4.of(e)))}),Object.freeze({name:"lineNumbers",default:!0,factory:()=>a((0,s.$K)()),schema:{type:"boolean",title:h.__("Line Numbers")}}),Object.freeze({name:"lineWrap",factory:()=>a(s.Lz.lineWrapping),default:!0,schema:{type:"boolean",title:h.__("Line Wrap")}}),Object.freeze({name:"matchBrackets",default:!0,factory:()=>a([(0,r.SG)(),i.Nb.high(s.w4.of(_e.Bc))]),schema:{type:"boolean",title:h.__("Match Brackets")}}),Object.freeze({name:"rectangularSelection",default:!0,factory:()=>a([(0,s.D4)(),(0,s.HJ)()]),schema:{type:"boolean",title:h.__("Rectangular selection"),description:h.__("Rectangular (block) selection can be created by dragging the mouse pointer while holding the left mouse button and the Alt key. When the Alt key is pressed, a crosshair cursor will appear, indicating that the rectangular selection mode is active.")}}),Object.freeze({name:"readOnly",default:!1,factory:()=>o((e=>[i.$t.readOnly.of(e),e?s.Lz.editorAttributes.of({class:"jp-mod-readOnly"}):[]]))}),Object.freeze({name:"rulers",default:[],factory:()=>o((e=>e.length>0?function(e){return[Fe,ze.of(e),$e]}(e):[])),schema:{type:"array",title:h.__("Rulers"),items:{type:"number",minimum:0}}}),Object.freeze({name:"extendSelection",default:!0,factory:()=>a(s.w4.of([{key:"Mod-Shift-l",run:wt,preventDefault:!0}]))}),Object.freeze({name:"searchWithCM",default:!1,factory:()=>a(s.w4.of([{key:"Mod-f",run:_t,scope:"editor search-panel"},{key:"F3",run:yt,shift:vt,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:yt,shift:vt,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Tt,scope:"editor search-panel"}]))}),Object.freeze({name:"scrollPastEnd",default:!1,factory:e=>e.inline?null:a((0,s.BE)())}),Object.freeze({name:"smartIndent",default:!0,factory:()=>a((0,r.WD)()),schema:{type:"boolean",title:h.__("Smart Indentation")}}),Object.freeze({name:"tabFocusable",default:!0,factory:()=>a(s.Lz.contentAttributes.of({tabIndex:"0"}),s.Lz.contentAttributes.of({tabIndex:"-1"}))}),Object.freeze({name:"tabSize",default:4,factory:()=>o((e=>i.$t.tabSize.of(e))),schema:{type:"number",title:h.__("Tab size")}}),Object.freeze({name:"tooltips",factory:()=>l((0,s.vX)({position:"absolute",parent:document.body}))}),Object.freeze({name:"allowMultipleSelections",default:!0,factory:()=>o((e=>i.$t.allowMultipleSelections.of(e))),schema:{type:"boolean",title:h.__("Multiple selections")}}),Object.freeze({name:"customStyles",factory:()=>o((e=>function(e){return[Ne.of(e),s.Lz.editorAttributes.of(Ee)]}(e))),default:{fontFamily:null,fontSize:null,lineHeight:null},schema:{title:h.__("Custom editor styles"),type:"object",properties:{fontFamily:{type:["string","null"],title:h.__("Font Family")},fontSize:{type:["number","null"],minimum:1,maximum:100,title:h.__("Font Size")},lineHeight:{type:["number","null"],title:h.__("Line Height")}},additionalProperties:!1}})];return t&&c.push(Object.freeze({name:"theme",default:"jupyter",factory:()=>o((e=>t.getTheme(e))),schema:{type:"string",title:h.__("Theme"),description:h.__("CodeMirror theme")}})),n&&c.push(Object.freeze({name:"translation",default:{"Control character":h.__("Control character"),"Selection deleted":h.__("Selection deleted"),"Folded lines":h.__("Folded lines"),"Unfolded lines":h.__("Unfolded lines"),to:h.__("to"),"folded code":h.__("folded code"),unfold:h.__("unfold"),"Fold line":h.__("Fold line"),"Unfold line":h.__("Unfold line"),"Go to line":h.__("Go to line"),go:h.__("go"),Find:h.__("Find"),Replace:h.__("Replace"),next:h.__("next"),previous:h.__("previous"),all:h.__("all"),"match case":h.__("match case"),replace:h.__("replace"),"replace all":h.__("replace all"),close:h.__("close"),"current match":h.__("current match"),"replaced $ matches":h.__("replaced $ matches"),"replaced match on line $":h.__("replaced match on line $"),"on line":h.__("on line"),Completions:h.__("Completions"),Diagnostics:h.__("Diagnostics"),"No diagnostics":h.__("No diagnostics")},factory:()=>o((e=>i.$t.phrases.of(e)))})),c}}(Bt||(Bt={})),(Ft||(Ft={})).defaultMimeType="text/plain";var zt=n(8925),$t=n(3643);class Ht{constructor(e){this.start=e}}class qt extends Ht{constructor(e,t,n,i,s,r,o,a,l,h,c,u,f,d,p){super(e),this.rules=t,this.topRules=n,this.tokens=i,this.localTokens=s,this.context=r,this.externalTokens=o,this.externalSpecializers=a,this.externalPropSources=l,this.precedences=h,this.mainSkip=c,this.scopedSkip=u,this.dialects=f,this.externalProps=d,this.autoDelim=p}toString(){return Object.values(this.rules).join("\n")}}class Vt extends Ht{constructor(e,t,n,i,s){super(e),this.id=t,this.props=n,this.params=i,this.expr=s}toString(){return this.id.name+(this.params.length?`<${this.params.join()}>`:"")+" -> "+this.expr}}class Wt extends Ht{constructor(e,t){super(e),this.items=t}}class Gt extends Ht{constructor(e,t){super(e),this.items=t}}class Ut extends Ht{constructor(e,t,n){super(e),this.a=t,this.b=n}}class Kt extends Ht{constructor(e,t,n,i,s){super(e),this.precedences=t,this.conflicts=n,this.rules=i,this.literals=s}}class Yt extends Ht{constructor(e,t,n,i){super(e),this.precedences=t,this.rules=n,this.fallback=i}}class Jt extends Ht{constructor(e,t,n){super(e),this.literal=t,this.props=n}}class Xt extends Ht{constructor(e,t,n){super(e),this.id=t,this.source=n}}class Zt extends Ht{constructor(e,t,n,i){super(e),this.id=t,this.source=n,this.tokens=i}}class Qt extends Ht{constructor(e,t,n,i,s,r){super(e),this.type=t,this.token=n,this.id=i,this.source=s,this.tokens=r}}class en extends Ht{constructor(e,t,n){super(e),this.id=t,this.source=n}}class tn extends Ht{constructor(e,t,n,i){super(e),this.id=t,this.externalID=n,this.source=i}}class nn extends Ht{constructor(e,t){super(e),this.name=t}toString(){return this.name}}class sn extends Ht{walk(e){return e(this)}eq(e){return!1}}sn.prototype.prec=10;class rn extends sn{constructor(e,t,n){super(e),this.id=t,this.args=n}toString(){return this.id.name+(this.args.length?`<${this.args.join()}>`:"")}eq(e){return this.id.name==e.id.name&&vn(this.args,e.args)}walk(e){let t=mn(this.args,e);return e(t==this.args?this:new rn(this.start,this.id,t))}}class on extends sn{constructor(e,t,n,i,s){super(e),this.type=t,this.props=n,this.token=i,this.content=s}toString(){return`@${this.type}[${this.props.join(",")}]<${this.token}, ${this.content}>`}eq(e){return this.type==e.type&&xn.eqProps(this.props,e.props)&&yn(this.token,e.token)&&yn(this.content,e.content)}walk(e){let t=this.token.walk(e),n=this.content.walk(e);return e(t==this.token&&n==this.content?this:new on(this.start,this.type,this.props,t,n))}}class an extends sn{constructor(e,t){super(e),this.rule=t}toString(){let e=this.rule;return`${e.id}${e.props.length?`[${e.props.join(",")}]`:""} { ${e.expr} }`}eq(e){let t=this.rule,n=e.rule;return yn(t.expr,n.expr)&&t.id.name==n.id.name&&xn.eqProps(t.props,n.props)}walk(e){let t=this.rule,n=t.expr.walk(e);return e(n==t.expr?this:new an(this.start,new Vt(t.start,t.id,t.props,[],n)))}}class ln extends sn{constructor(e,t){super(e),this.exprs=t}toString(){return this.exprs.map((e=>kn(e,this))).join(" | ")}eq(e){return vn(this.exprs,e.exprs)}walk(e){let t=mn(this.exprs,e);return e(t==this.exprs?this:new ln(this.start,t))}}ln.prototype.prec=1;class hn extends sn{constructor(e,t,n,i=!1){super(e),this.exprs=t,this.markers=n,this.empty=i}toString(){return this.empty?"()":this.exprs.map((e=>kn(e,this))).join(" ")}eq(e){return vn(this.exprs,e.exprs)&&this.markers.every(((t,n)=>{let i=e.markers[n];return t.length==i.length&&t.every(((e,t)=>e.eq(i[t])))}))}walk(e){let t=mn(this.exprs,e);return e(t==this.exprs?this:new hn(this.start,t,this.markers,this.empty&&!t.length))}}hn.prototype.prec=2;class cn extends Ht{constructor(e,t,n){super(e),this.id=t,this.type=n}toString(){return("ambig"==this.type?"~":"!")+this.id.name}eq(e){return this.id.name==e.id.name&&this.type==e.type}}class un extends sn{constructor(e,t,n){super(e),this.expr=t,this.kind=n}toString(){return kn(this.expr,this)+this.kind}eq(e){return yn(this.expr,e.expr)&&this.kind==e.kind}walk(e){let t=this.expr.walk(e);return e(t==this.expr?this:new un(this.start,t,this.kind))}}un.prototype.prec=3;class fn extends sn{constructor(e,t){super(e),this.value=t}toString(){return JSON.stringify(this.value)}eq(e){return this.value==e.value}}class dn extends sn{constructor(e,t,n){super(e),this.ranges=t,this.inverted=n}toString(){return`[${this.inverted?"^":""}${this.ranges.map((([e,t])=>String.fromCodePoint(e)+(t==e+1?"":"-"+String.fromCodePoint(t))))}]`}eq(e){return this.inverted==e.inverted&&this.ranges.length==e.ranges.length&&this.ranges.every((([t,n],i)=>{let[s,r]=e.ranges[i];return t==s&&n==r}))}}class pn extends sn{constructor(e){super(e)}toString(){return"_"}eq(){return!0}}function mn(e,t){let n=null;for(let i=0;iyn(e,t[n])))}class xn extends Ht{constructor(e,t,n,i){super(e),this.at=t,this.name=n,this.value=i}eq(e){return this.name==e.name&&this.value.length==e.value.length&&this.value.every(((t,n)=>t.value==e.value[n].value&&t.name==e.value[n].name))}toString(){let e=(this.at?"@":"")+this.name;if(this.value.length){e+="=";for(let{name:t,value:n}of this.value)e+=t?`{${t}}`:/[^\w-]/.test(n)?JSON.stringify(n):n}return e}static eqProps(e,t){return e.length==t.length&&e.every(((e,n)=>e.eq(t[n])))}}class wn extends Ht{constructor(e,t,n){super(e),this.value=t,this.name=n}}function kn(e,t){return e.prec0}get eof(){return(4&this.flags)>0}get error(){return"error"in this.props}get top(){return(2&this.flags)>0}get interesting(){return this.flags>0||null!=this.nodeName}get repeated(){return(16&this.flags)>0}set preserve(e){this.flags=e?8|this.flags:-9&this.flags}get preserve(){return(8&this.flags)>0}set inline(e){this.flags=e?32|this.flags:-33&this.flags}get inline(){return(32&this.flags)>0}cmp(e){return this.hash-e.hash}}class Mn{constructor(){this.terms=[],this.names=Object.create(null),this.tops=[],this.eof=this.term("␄",null,5),this.error=this.term("⚠","⚠",8)}term(e,t,n=0,i={}){let s=new On(e,n,t,i);return this.terms.push(s),this.names[e]=s,s}makeTop(e,t){const n=this.term("@top",e,2,t);return this.tops.push(n),n}makeTerminal(e,t,n={}){return this.term(e,t,1,n)}makeNonTerminal(e,t,n={}){return this.term(e,t,0,n)}makeRepeat(e){return this.term(e,null,16)}uniqueName(e){for(let t=0;;t++){let n=t?`${e}-${t}`:e;if(!this.names[n])return n}}finish(e){for(let t of e)t.name.rules.push(t);this.terms=this.terms.filter((t=>t.terminal||t.preserve||e.some((e=>e.name==t||e.parts.includes(t)))));let t={},n=[this.error];this.error.id=0;let i=1;for(let e of this.terms)e.id<0&&e.nodeType&&!e.repeated&&(e.id=i++,n.push(e));let s=i;for(let e of this.terms)e.repeated&&(e.id=i++,n.push(e));this.eof.id=i++;for(let e of this.terms)e.id<0&&(e.id=i++),e.name&&(t[e.id]=e.name);if(i>=65534)throw new Sn("Too many terms");return{nodeTypes:n,names:t,minRepeatTerm:s,maxTerm:i-1}}}function _n(e,t,n){if(e.length!=t.length)return e.length-t.length;for(let i=0;iet?1:0))||this.cut-e.cut}}function En(e,t){if(0==e.length||e==t)return t;if(0==t.length)return e;let n=e.slice();for(let i of t)e.includes(i)||n.push(i);return n.sort()}Nn.none=new Nn(0);let Dn=0;class Pn{constructor(e,t,n,i){this.name=e,this.parts=t,this.conflicts=n,this.skip=i,this.id=Dn++}cmp(e){return this.id-e.id}cmpNoName(e){return this.parts.length-e.parts.length||this.skip.hash-e.skip.hash||this.parts.reduce(((t,n,i)=>t||n.cmp(e.parts[i])),0)||_n(this.conflicts,e.conflicts,((e,t)=>e.cmp(t)))}toString(){return this.name+" -> "+this.parts.join(" ")}get isRepeatWrap(){return this.name.repeated&&2==this.parts.length&&this.parts[0]==this.name}sameReduce(e){return this.name==e.name&&this.parts.length==e.parts.length&&this.isRepeatWrap==e.isRepeatWrap}}class Rn{constructor(e,t,n){this.from=e,this.to=t,this.target=n}toString(){return`-> ${this.target.id}[label=${JSON.stringify(this.from<0?"ε":jn(this.from)+(this.to>this.from+1?"-"+jn(this.to-1):""))}]`}}function jn(e){return e>65535?"∞":10==e?"\\n":13==e?"\\r":e<32||e>=55296&&e<57343?"\\u{"+e.toString(16)+"}":String.fromCharCode(e)}function In(e,t,n){if(e.edges.length!=t.edges.length)return!1;for(let i=0;iEn(e,t.accepting)),[]),n++),o=[];for(let e of s)for(let t of e.edges)t.from>=0&&o.push(t);let a=function(e){let t=[],n=[];for(let n of e)t.includes(n.from)||t.push(n.from),t.includes(n.to)||t.push(n.to);t.sort(((e,t)=>e-t));for(let i=1;is&&t.from65535==e.from&&65535==e.to));if(i.length){let e=[];for(let t of i)for(let n of t.target.closure())e.includes(n)||e.push(n);e.length&&n.push(new qn(65535,65535,e))}return n}(o);for(let e of a){let n=e.targets.sort(((e,t)=>e.id-t.id));r.edge(e.from,e.to,t[Hn(n)]||i(n))}return r}(this.closure().sort(((e,t)=>e.id-t.id)));return function(e,t){let n=Object.create(null),i=Object.create(null);for(let t of e){let e=Hn(t.accepting),s=i[e]||(i[e]=[]);s.push(t),n[t.id]=s}for(;;){let i=!1,s=Object.create(null);for(let t of e){if(s[t.id])continue;let e=n[t.id];if(1==e.length){s[e[0].id]=e;continue}let r=[];e:for(let t of e){for(let e of r)if(In(t,e[0],n)){e.push(t);continue e}r.push([t])}r.length>1&&(i=!0);for(let e of r)for(let t of e)s[t.id]=e}if(!i)return Ln(e,t,n);n=s}}(Object.values(t),i)}closure(){let e=[],t=Object.create(null);return function n(i){if(!t[i.id]){t[i.id]=!0,(i.edges.some((e=>e.from>=0))||i.accepting.length>0&&!i.edges.some((e=>function(e,t){if(e.length!=t.length)return!1;for(let n=0;nt.a==e&&t.b==n));o?o.soft!=i&&(o.soft=0):t.push(new zn(e,n,i,$n(s),r&&$n(r)))}return this.reachable(((t,s)=>{if(0!=t.accepting.length){for(let e=0;e{if(r!=t)for(let a of r.accepting){let r=n.includes(a);for(let l of t.accepting)a!=l&&i(a,l,r||n.includes(l)||!e(a,l)?0:1,s,s.concat(o))}}))}})),t}cycleTerms(){let e=[];this.reachable((t=>{for(let{target:n}of t.edges)e.push(t,n)}));let t=new Map,n=[];for(let i=0;i{t.accepting.length&&(e+=` ${t.id} [label=${JSON.stringify(t.accepting.join())}];\n`);for(let n of t.edges)e+=` ${t.id} ${n};\n`})),e+"}"}toArray(e,t){let n=[],i=[];this.reachable((s=>{let r=i.length,o=r+3+2*s.accepting.length;n[s.id]=r,i.push(s.stateMask(e),o,s.edges.length),s.accepting.sort(((e,n)=>t.indexOf(e.id)-t.indexOf(n.id)));for(let t of s.accepting)i.push(t.id,e[t.id]||65535);for(let e of s.edges)i.push(e.from,e.to,-e.target.id-1)}));for(let e=0;eMath.pow(2,16))throw new Sn("Tokenizer tables too big to represent with 16-bit offsets.");return Uint16Array.from(i)}stateMask(e){let t=0;return this.reachable((n=>{for(let i of n.accepting)t|=e[i.id]||65535})),t}},zn=class{constructor(e,t,n,i,s){this.a=e,this.b=t,this.soft=n,this.exampleA=i,this.exampleB=s}};function $n(e){let t="";for(let n=0;n-1&&i-1){let e=this.lineInfo(t);n+=(n?" ":"")+e.line+":"+e.ch}return n?e+` (${n})`:e}raise(e,t=-1){throw new Sn(this.message(e,t))}match(e,t){let n=t.exec(this.string.slice(e));return n?e+n[0].length:-1}next(){let e=this.match(this.end,/^(\s|\/\/.*|\/\*[^]*?\*\/)*/);if(e==this.string.length)return this.set("eof",null,e,e);let t=this.string[e];if('"'==t){let t=this.match(e+1,/^(\\.|[^"\\])*"/);return-1==t&&this.raise("Unterminated string literal",e),this.set("string",mi(this.string.slice(e+1,t-1)),e,t)}if("'"==t){let t=this.match(e+1,/^(\\.|[^'\\])*'/);return-1==t&&this.raise("Unterminated string literal",e),this.set("string",mi(this.string.slice(e+1,t-1)),e,t)}if("@"==t){Vn.lastIndex=e+1;let t=Vn.exec(this.string);return t?this.set("at",t[0],e,e+1+t[0].length):this.raise("@ without a name",e)}if("$"!=t&&"!"!=t||"["!=this.string[e+1]){if(/[\[\]()!~+*?{}<>\.,|:$=]/.test(t))return this.set(t,null,e,e+1);{Vn.lastIndex=e;let n=Vn.exec(this.string);return n?this.set("id",n[0],e,e+n[0].length):this.raise("Unexpected character "+JSON.stringify(t),e)}}{let t=this.match(e+2,/^(?:\\.|[^\]\\])*\]/);return-1==t&&this.raise("Unterminated character set",e),this.set("set",this.string.slice(e+2,t-1),e,t)}}set(e,t,n,i){this.type=e,this.value=t,this.start=n,this.end=i}eat(e,t=null){return this.type==e&&(null==t||this.value===t)&&(this.next(),!0)}unexpected(){return this.raise(`Unexpected token '${this.string.slice(this.start,this.end)}'`,this.start)}expect(e,t=null){let n=this.value;return(this.type!=e||null!=t&&n!==t)&&this.unexpected(),this.next(),n}parse(){return function(e){let t=e.start,n=[],i=null,s=null,r=[],o=null,a=[],l=[],h=null,c=[],u=[],f=[],d=[],p=[],m=!1,g=!1;for(;"eof"!=e.type;){let t=e.start;if(e.eat("at","top"))"id"!=e.type&&e.raise("Top rules must have a name",e.start),p.push(Un(e,si(e))),m=!0;else if("at"==e.type&&"tokens"==e.value)s?e.raise("Multiple @tokens declaractions",e.start):s=oi(e);else if(e.eat("at","local"))e.expect("id","tokens"),r.push(ai(e,t));else if(e.eat("at","context")){h&&e.raise("Multiple @context declarations",t);let n=si(e);e.expect("id","from");let i=e.expect("string");h=new Xt(t,n,i)}else if(e.eat("at","external"))e.eat("id","tokens")?c.push(ui(e,t)):e.eat("id","prop")?f.push(pi(e,t)):e.eat("id","extend")?u.push(fi(e,"extend",t)):e.eat("id","specialize")?u.push(fi(e,"specialize",t)):e.eat("id","propSource")?d.push(di(e,t)):e.unexpected();else if(e.eat("at","dialects")){e.expect("{");for(let t=!0;!e.eat("}");t=!1)t||e.eat(","),l.push(si(e))}else if("at"==e.type&&"precedence"==e.value)i&&e.raise("Multiple precedence declarations",e.start),i=ri(e);else if(e.eat("at","detectDelim"))g=!0;else if(e.eat("at","skip")){let t=Jn(e);if("{"==e.type){e.next();let n=[],i=[];for(;!e.eat("}");)e.eat("at","top")?(i.push(Un(e,si(e))),m=!0):n.push(Un(e));a.push({expr:t,topRules:i,rules:n})}else o&&e.raise("Multiple top-level skip declarations",e.start),o=t}else n.push(Un(e))}return m?new qt(t,n,p,s,r,h,c,u,d,i,o,a,l,f,g):e.raise("Missing @top declaration")}(this)}}function Un(e,t){let n=t?t.start:e.start,i=t||si(e),s=Kn(e),r=[];if(e.eat("<"))for(;!e.eat(">");)r.length&&e.expect(","),r.push(si(e));let o=Jn(e);return new Vt(n,i,s,r,o)}function Kn(e){if("["!=e.type)return Wn;let t=[];for(e.expect("[");!e.eat("]");)t.length&&e.expect(","),t.push(Yn(e));return t}function Yn(e){let t=e.start,n=[],i=e.value,s="at"==e.type;if(e.eat("at")||e.eat("id")||e.unexpected(),e.eat("="))for(;;)if("string"==e.type||"id"==e.type)n.push(new wn(e.start,e.value,null)),e.next();else if(e.eat("."))n.push(new wn(e.start,".",null));else{if(!e.eat("{"))break;n.push(new wn(e.start,null,e.expect("id"))),e.expect("}")}return new xn(t,s,i,n)}function Jn(e){e.expect("{");let t=ii(e);return e.expect("}"),t}const Xn="﷚";function Zn(e){let t=e.start;if(e.eat("(")){if(e.eat(")"))return new hn(t,Wn,[Wn,Wn]);let n=ii(e);return e.expect(")"),n}if("string"==e.type){let n=e.value;return e.next(),0==n.length?new hn(t,Wn,[Wn,Wn]):new fn(t,n)}if(e.eat("id","_"))return new pn(t);if("set"==e.type){let n=e.value,i="!"==e.string[e.start],s=mi(n.replace(/\\.|-|"/g,(e=>"-"==e?Xn:'"'==e?'\\"':e))),r=[];for(let t=0;t65535?2:1,t65535?3:2,ie[0]-t[0])),i)}if("at"!=e.type||"specialize"!=e.value&&"extend"!=e.value){if("at"==e.type&&gn.hasOwnProperty(e.value)){let t=new bn(e.start,e.value);return e.next(),t}if("["==e.type){let n=Un(e,new nn(t,"_anon"));return n.params.length&&e.raise("Inline rules can't have parameters",n.start),new an(t,n)}{let n=si(e);if("["==e.type||"{"==e.type){let i=Un(e,n);return i.params.length&&e.raise("Inline rules can't have parameters",i.start),new an(t,i)}if(e.eat(".")&&"std"==n.name&&gn.hasOwnProperty(e.value)){let n=new bn(t,e.value);return e.next(),n}return new rn(t,n,function(e){let t=[];if(e.eat("<"))for(;!e.eat(">");)t.length&&e.expect(","),t.push(ii(e));return t}(e))}}{let{start:t,value:n}=e;e.next();let i=Kn(e);e.expect("<");let s,r=ii(e);return e.eat(",")?s=ii(e):r instanceof fn?s=r:e.raise(`@${n} requires two arguments when its first argument isn't a literal string`),e.expect(">"),new on(t,n,i,r,s)}}function Qn(e,t,n,i){t.every((([e,t])=>t<=n||e>=i))||e.raise("Overlapping character range",e.start),t.push([n,i])}function ei(e){let t=e.start,n=Zn(e);for(;;){let i=e.type;if(!(e.eat("*")||e.eat("?")||e.eat("+")))return n;n=new un(t,n,i)}}function ti(e){return"}"==e.type||")"==e.type||"|"==e.type||"/"==e.type||"/\\"==e.type||"{"==e.type||","==e.type||">"==e.type}function ni(e){let t=e.start,n=[],i=[Wn];do{for(;;){let t,n=e.start;if(e.eat("~"))t="ambig";else{if(!e.eat("!"))break;t="prec"}i[i.length-1]=i[i.length-1].concat(new cn(n,si(e),t))}if(ti(e))break;n.push(ei(e)),i.push(Wn)}while(!ti(e));return 1==n.length&&i.every((e=>0==e.length))?n[0]:new hn(t,n,i,!n.length)}function ii(e){let t=e.start,n=ni(e);if(!e.eat("|"))return n;let i=[n];do{i.push(ni(e))}while(e.eat("|"));let s=i.find((e=>e instanceof hn&&e.empty));return s&&e.raise("Empty expression in choice operator. If this is intentional, use () to make it explicit.",s.start),new ln(t,i)}function si(e){"id"!=e.type&&e.unexpected();let t=e.start,n=e.value;return e.next(),new nn(t,n)}function ri(e){let t=e.start;e.next(),e.expect("{");let n=[];for(;!e.eat("}");)n.length&&e.eat(","),n.push({id:si(e),type:e.eat("at","left")?"left":e.eat("at","right")?"right":e.eat("at","cut")?"cut":null});return new Wt(t,n)}function oi(e){let t=e.start;e.next(),e.expect("{");let n=[],i=[],s=[],r=[];for(;!e.eat("}");)"at"==e.type&&"precedence"==e.value?s.push(li(e)):"at"==e.type&&"conflict"==e.value?r.push(hi(e)):"string"==e.type?i.push(new Jt(e.start,e.expect("string"),Kn(e))):n.push(Un(e));return new Kt(t,s,r,n,i)}function ai(e,t){e.expect("{");let n=[],i=[],s=null;for(;!e.eat("}");)"at"==e.type&&"precedence"==e.value?i.push(li(e)):e.eat("at","else")&&!s?s={id:si(e),props:Kn(e)}:n.push(Un(e));return new Yt(t,i,n,s)}function li(e){let t=e.start;e.next(),e.expect("{");let n=[];for(;!e.eat("}");){n.length&&e.eat(",");let t=Zn(e);t instanceof fn||t instanceof rn?n.push(t):e.raise("Invalid expression in token precedences",t.start)}return new Gt(t,n)}function hi(e){let t=e.start;e.next(),e.expect("{");let n=Zn(e);n instanceof fn||n instanceof rn||e.raise("Invalid expression in token conflict",n.start),e.eat(",");let i=Zn(e);return i instanceof fn||i instanceof rn||e.raise("Invalid expression in token conflict",i.start),e.expect("}"),new Ut(t,n,i)}function ci(e){let t=[];for(e.expect("{");!e.eat("}");){t.length&&e.eat(",");let n=si(e),i=Kn(e);t.push({id:n,props:i})}return t}function ui(e,t){let n=si(e);e.expect("id","from");let i=e.expect("string");return new Zt(t,n,i,ci(e))}function fi(e,t,n){let i=Jn(e),s=si(e);e.expect("id","from");let r=e.expect("string");return new Qt(n,t,i,s,r,ci(e))}function di(e,t){let n=si(e);return e.expect("id","from"),new en(t,n,e.expect("string"))}function pi(e,t){let n=si(e),i=e.eat("id","as")?si(e):n;e.expect("id","from");let s=e.expect("string");return new tn(t,i,n,s)}function mi(e){let t,n=/\\(?:u\{([\da-f]+)\}|u([\da-f]{4})|x([\da-f]{2})|([ntbrf0])|(.))|[^]/giy,i="";for(;t=n.exec(e);){let[e,n,s,r,o,a]=t;i+=n||s||r?String.fromCodePoint(parseInt(n||s||r,16)):o?"n"==o?"\n":"t"==o?"\t":"0"==o?"\0":"r"==o?"\r":"f"==o?"\f":"\b":a||e}return i}function gi(e,t){return(e<<5)+e+t}function bi(e,t){for(let n=0;n{let n=Date.now(),i=t();return console.log(`${e} (${((Date.now()-n)/1e3).toFixed(2)}s)`),i}:(e,t)=>t();class wi{constructor(e,t,n,i,s,r){this.rule=e,this.pos=t,this.ahead=n,this.ambigAhead=i,this.skipAhead=s,this.via=r,this.hash=0}finish(){let e=gi(gi(this.rule.id,this.pos),this.skipAhead.hash);for(let t of this.ahead)e=gi(e,t.hash);for(let t of this.ambigAhead)e=bi(e,t);return this.hash=e,this}get next(){return this.pose.cmp(t)))||_n(this.ambigAhead,e.ambigAhead,Ci)}eqSimple(e){return e.rule==this.rule&&e.pos==this.pos}toString(){let e=this.rule.parts.map((e=>e.name));return e.splice(this.pos,0,"·"),`${this.rule.name} -> ${e.join(" ")}`}eq(e){return this==e||this.hash==e.hash&&this.rule==e.rule&&this.pos==e.pos&&this.skipAhead==e.skipAhead&&Mi(this.ahead,e.ahead)&&Mi(this.ambigAhead,e.ambigAhead)}trail(e=60){let t=[];for(let e=this;e;e=e.via)for(let n=e.pos-1;n>=0;n--)t.push(e.rule.parts[n]);let n=t.reverse().join(" ");return n.length>e&&(n=n.slice(n.length-e).replace(/.*? /,"… ")),n}conflicts(e=this.pos){let t=this.rule.conflicts[e];return e==this.rule.parts.length&&this.ambigAhead.length&&(t=t.join(new Nn(0,this.ambigAhead))),t}static addOrigins(e,t){let n=e.slice();for(let e=0;et?1:0}function Ai(e,t,n,i){let s=[];for(let n=t+1;ne.term+"="+e)).join(",")+(this.goto.length?" | "+this.goto.map((e=>e.term+"="+e)).join(","):"");return this.id+": "+this.set.filter((e=>e.pos>0)).join()+(this.defaultReduce?`\n always ${this.defaultReduce.name}(${this.defaultReduce.parts.length})`:e.length?"\n "+e:"")}addActionInner(e,t){e:for(let n=0;n0){this.actions.splice(n,1),this.actionPositions.splice(n,1),n--;continue e}if(l<0)return null;if(o.ambigGroups.some((e=>a.ambigGroups.includes(e))))continue e;return i}}return this.actions.push(e),this.actionPositions.push(t),null}addAction(e,t,n){let i=this.addActionInner(e,t);if(i){let s,r=this.actionPositions[this.actions.indexOf(i)][0],o=[t[0].rule.name,r.rule.name];if(n.conflicts.some((e=>e.rules.some((e=>o.includes(e))))))return;s=i instanceof _i?`shift/reduce conflict between\n ${r}\nand\n ${t[0].rule}`:`reduce/reduce conflict between\n ${r.rule}\nand\n ${t[0].rule}`,s+=`\nWith input:\n ${t[0].trail(70)} · ${e.term} …`,i instanceof _i&&(s+=function(e,t,n){let i=e,s=[];for(;;){for(let e=i.pos-1;e>=0;e--)s.push(i.rule.parts[e]);if(!i.via)break;i=i.via}s.reverse();let r=new Set;return function i(o,a,l){if(a==s.length&&l&&!o.next)return`\nThe reduction of ${e.rule.name} is allowed before ${t} because of this rule:\n ${l}`;for(let e;e=o.next;){if(a"\n"+" ".repeat(n+1)+(e==t?"":"via ")+e)).join("")):""}for(let i=e;i;i=i.via)for(let s=t;s;s=s.via)if(i.eqSimple(s))return"\nShared origin: "+i+n(i,e)+n(i,t);return""}(r,t[0]),n.conflicts.push(new ji(s,o))}}getGoto(e){return this.goto.find((t=>t.term==e))}hasSet(e){return Oi(this.set,e)}actionsByTerm(){let e=this._actionsByTerm;if(!e){this._actionsByTerm=e=Object.create(null);for(let t of this.actions)(e[t.term.id]||(e[t.term.id]=[])).push(t)}return e}finish(){if(this.actions.length){let e=this.actions[0];if(e instanceof Ti){let{rule:t}=e;this.actions.every((e=>e instanceof Ti&&e.rule.sameReduce(t)))&&(this.defaultReduce=t)}}this.actions.sort(((e,t)=>e.cmp(t))),this.goto.sort(((e,t)=>e.cmp(t)))}eq(e){let t=this.defaultReduce,n=e.defaultReduce;return t||n?!(!t||!n)&&t.sameReduce(n):this.skip==e.skip&&this.tokenGroup==e.tokenGroup&&Oi(this.actions,e.actions)&&Oi(this.goto,e.goto)}}function Pi(e,t){t.includes(e)||t.push(e)}class Ri{constructor(e,t){this.set=e,this.state=t}}class ji{constructor(e,t){this.error=e,this.rules=t}}function Ii(e){let t=null,n=1;for(let i of e){let e=i.rule.conflicts[i.pos-1].cut;en)&&(n=e,t=[]),t.push(i))}return t||e}function Li(e,t,n){for(let i of e.goto)for(let e of t.goto)if(i.term==e.term&&n[i.target.id]!=n[e.target.id])return!1;let i=t.actionsByTerm();for(let t of e.actions){let s=i[t.term.id];if(s&&s.some((e=>!e.matches(t,n)))){if(1==s.length)return!1;let i=e.actionsByTerm()[t.term.id];if(i.length!=s.length||i.some((e=>!s.some((t=>e.matches(t,n))))))return!1}}return!0}function Bi(e,t){let n=[];for(let i of e){let e=t[i.id];n[e]||(n[e]=new Di(e,i.set,0,i.skip,i.hash,i.startRule),n[e].tokenGroup=i.tokenGroup,n[e].defaultReduce=i.defaultReduce)}for(let i of e){let e=n[t[i.id]];e.flags|=i.flags;for(let s=0;se.eq(r)))||(e.actions.push(r),e.actionPositions.push(i.actionPositions[s]))}for(let s of i.goto){let i=s.map(t,n);e.goto.some((e=>e.eq(i)))||e.goto.push(i)}}return n}class Fi{constructor(e,t){this.origin=e,this.members=[t]}}function zi(e,t){if(e.length!=t.length)return!1;for(let n=0;n=34&&t++,t>=92&&t++,String.fromCharCode(t)}function qi(e,t=65535){if(e>t)throw new Error("Trying to encode a number that's too big: "+e);if(65535==e)return String.fromCharCode(126);let n="";for(let t=46;;t=0){let i=e%46,s=e-i;if(n=Hi(i+t)+n,0==s)break;e=s/46}return n}function Vi(e,t=65535){let n='"'+qi(e.length,4294967295);for(let i=0;i{this.input=new Gn(e,t.fileName),this.ast=this.input.parse()}));let n=o.uY;for(let e in n)n[e]instanceof o.uY&&!n[e].perNode&&(this.knownProps[e]={prop:n[e],source:{name:e,from:null}});for(let e of this.ast.externalProps)this.knownProps[e.id.name]={prop:this.options.externalProp?this.options.externalProp(e.id.name):new o.uY,source:{name:e.externalID.name,from:e.source}};this.dialects=this.ast.dialects.map((e=>e.name)),this.tokens=new ls(this,this.ast.tokens),this.localTokens=this.ast.localTokens.map((e=>new hs(this,e))),this.externalTokens=this.ast.externalTokens.map((e=>new ws(this,e))),this.externalSpecializers=this.ast.externalSpecializers.map((e=>new ks(this,e))),xi("Build rules",(()=>{let e=this.newName("%noskip",!0);this.defineRule(e,[]);let t=this.ast.mainSkip?this.newName("%mainskip",!0):e,n=[],i=[];for(let e of this.ast.rules)this.astRules.push({skip:t,rule:e});for(let e of this.ast.topRules)i.push({skip:t,rule:e});for(let s of this.ast.scopedSkip){let r=e,o=this.ast.scopedSkip.findIndex(((e,t)=>t-1?r=n[o]:this.ast.mainSkip&&yn(s.expr,this.ast.mainSkip)?r=t:bs(s.expr)||(r=this.newName("%skip",!0)),n.push(r);for(let e of s.rules)this.astRules.push({skip:r,rule:e});for(let e of s.topRules)i.push({skip:r,rule:e})}for(let{rule:e}of this.astRules)this.unique(e.id);this.currentSkip.push(e),this.skipRules=t==e?[t]:[e,t],t!=e&&this.defineRule(t,this.normalizeExpr(this.ast.mainSkip));for(let t=0;te.rule.start-t.rule.start))){this.unique(e.id),this.used(e.id.name),this.currentSkip.push(t);let{name:n,props:i}=this.nodeInfo(e.props,"a",e.id.name,Wi,Wi,e.expr),s=this.terms.makeTop(n,i);this.namedTerms[n]=s,this.defineRule(s,this.normalizeExpr(e.expr)),this.currentSkip.pop()}for(let e of this.externalSpecializers)e.finish();for(let{skip:e,rule:t}of this.astRules)this.ruleNames[t.id.name]&&As(t)&&!t.params.length&&(this.buildRule(t,[],e,!1),t.expr instanceof hn&&0==t.expr.exprs.length&&this.used(t.id.name))}));for(let e in this.ruleNames){let t=this.ruleNames[e];t&&this.warn(`Unused rule '${t.name}'`,t.start)}this.tokens.takePrecedences(),this.tokens.takeConflicts();for(let e of this.localTokens)e.takePrecedences();for(let{name:e,group:t,rule:n}of this.definedGroups)this.defineGroup(e,t,n);this.checkGroups()}unique(e){e.name in this.ruleNames&&this.raise(`Duplicate definition of rule '${e.name}'`,e.start),this.ruleNames[e.name]=e}used(e){this.ruleNames[e]=null}newName(e,t=null,n={}){for(let i=t?0:1;;i++){let s=i?`${e}-${i}`:e;if(!this.terms.names[s])return this.terms.makeNonTerminal(s,!0===t?null:t,n)}}prepareParser(){let e=xi("Simplify rules",(()=>function(e,t){return function(e){let t,n=Object.create(null);for(let i=0;i!n[e.name]))?t:new Pn(t.name,t.parts.map((e=>n[e.name]||e)),t.conflicts,t.skip));return i}(function(e,t){for(let n=0;;n++){let i,s=Object.create(null);if(0==n)for(let o of e)if(o.name.inline&&!s[o.name.name]){let a=e.filter((e=>e.name==o.name));if(a.some((e=>e.parts.includes(o.name))))continue;i=s[o.name.name]=a}for(let l=0;le.skip==h.skip||!e.parts.includes(h.name)))||h.parts.some((e=>!!s[e.name]))||e.some(((e,t)=>t!=l&&e.name==h.name))||(i=s[h.name.name]=[h])}if(!i)return e;let r=[];for(let c of e){function u(e,t,n){if(e==c.parts.length)return void r.push(new Pn(c.name,n,t,c.skip));let i=c.parts[e],o=s[i.name];if(o)for(let i of o)u(e+1,t.slice(0,t.length-1).concat(t[e].join(i.conflicts[0])).concat(i.conflicts.slice(1,i.conflicts.length-1)).concat(c.conflicts[e+1].join(i.conflicts[i.conflicts.length-1])),n.concat(i.parts));else u(e+1,t.concat(c.conflicts[e+1]),n.concat(i))}s[c.name.name]||(c.parts.some((e=>!!s[e.name]))?u(0,[c.conflicts[0]],[]):r.push(c))}e=r}}(e,t))}(this.rules,[...this.skipRules,...this.terms.tops]))),{nodeTypes:t,names:n,minRepeatTerm:i,maxTerm:s}=this.terms.finish(e);for(let e in this.namedTerms)this.termTable[e]=this.namedTerms[e].id;/\bgrammar\b/.test(yi)&&console.log(e.join("\n"));let r=this.terms.tops.slice(),o=function(e){let t=Object.create(null);for(let n of e.terms)n.terminal||(t[n.name]=[]);for(;;){let n=!1;for(let i of e.terms)if(!i.terminal)for(let e of i.rules){let s=t[i.name],r=!1,o=s.length;for(let n of e.parts){if(r=!0,n.terminal)Pi(n,s);else for(let e of t[n.name])null==e?r=!1:Pi(e,s);if(r)break}r||Pi(null,s),s.length>o&&(n=!0)}if(!n)return t}}(this.terms),a=this.skipRules.map(((e,t)=>{let n=[],i=[],s=[];for(let t of e.rules){if(!t.parts.length)continue;let e=t.parts[0];for(let t of e.terminal?[e]:o[e.name]||[])t&&!i.includes(t)&&i.push(t);e.terminal&&1==t.parts.length&&!s.some((n=>n!=t&&n.parts[0]==e))?n.push(e):s.push(t)}return e.rules=s,s.length&&r.push(e),{skip:n,rule:s.length?e:null,startTokens:i,id:t}})),l=xi("Build full automaton",(()=>function(e,t,n){let i=[],s={},r={},o=Date.now();function a(e,t){if(0==e.length)return null;let a,l=Ni(e),h=r[l];for(let t of e)if(a){if(a!=t.skip)throw new Sn("Inconsistent skip sets after "+t.trail())}else a=t.skip;if(h)for(let t of h)if(Oi(e,t.set)){if(t.state.skip!=a)throw new Sn("Inconsistent skip sets after "+t.set[0].trail());return t.state}let c,u=function(e,t){let n=[],i=[];function s(t,s,r,o,a){for(let l of t.rules){let t=n.find((e=>e.rule==l));if(!t){let i=e.find((e=>0==e.pos&&e.rule==l));t=i?new wi(l,0,i.ahead.slice(),i.ambigAhead,i.skipAhead,i.via):new wi(l,0,[],$i,o,a),n.push(t)}if(t.skipAhead!=o)throw new Sn("Inconsistent skip sets after "+a.trail());t.ambigAhead=En(t.ambigAhead,r);for(let e of s)t.ahead.includes(e)||(t.ahead.push(e),t.rule.parts.length&&!t.rule.parts[0].terminal&&Pi(t,i))}}for(let n of e){let e=n.next;e&&!e.terminal&&s(e,Ai(n.rule,n.pos,n.ahead,t),n.conflicts(n.pos+1).ambigGroups,n.pos==n.rule.parts.length-1?n.skipAhead:n.rule.skip,n)}for(;i.length;){let e=i.pop();s(e.rule.parts[0],Ai(e.rule,0,e.ahead,t),En(e.rule.conflicts[1].ambigGroups,1==e.rule.parts.length?e.ambigAhead:$i),1==e.rule.parts.length?e.skipAhead:e.rule.skip,e)}let r=e.slice();for(let t of n){t.ahead.sort(((e,t)=>e.hash-t.hash)),t.finish();let n=e.findIndex((e=>0==e.pos&&e.rule==t.rule));n>-1?r[n]=t:r.push(t)}return r.sort(((e,t)=>e.cmp(t)))}(e,n),f=Ni(u),d=s[f]||(s[f]=[]);if(!t)for(let e of d)e.hasSet(u)&&(c=e);return c||(c=new Di(i.length,u,0,a,f,t),d.push(c),i.push(c),vi&&i.length%500==0&&console.log(`${i.length} states after ${((Date.now()-o)/1e3).toFixed(2)}s`)),(r[l]||(r[l]=[])).push(new Ri(e,c)),c}for(const n of t){const t=n.rules.length?n.rules[0].skip:e.names["%noskip"];a(n.rules.map((n=>new wi(n,0,[e.eof],$i,t,null).finish())),n)}let l=new Ei(n);for(let e=0;ee.advance()));if(n.terminal){let s=a(Ii(i));s&&t.addAction(new _i(n,s),r[e],l)}else{let e=a(i);e&&t.goto.push(new _i(n,e))}}let h=!1;for(let e of o)for(let n of e.ahead){let i=t.actions.length;t.addAction(new Ti(n,e.rule),[e],l),t.actions.length==i&&(h=!0)}if(h)for(let e=0;et.actions.some((t=>t.term==e&&t instanceof _i))))||t.goto.splice(e--,1)}if(l.conflicts.length)throw new Sn(l.conflicts.map((e=>e.error)).join("\n\n"));for(let e of i)e.finish();return vi&&console.log(`${i.length} states total.`),i}(this.terms,r,o))),h=this.localTokens.map(((e,t)=>e.buildLocalGroup(l,a,t))),{tokenGroups:c,tokenPrec:u,tokenData:f}=xi("Build token groups",(()=>this.tokens.buildTokenGroups(l,a,h.length))),d=xi("Finish automaton",(()=>function(e){for(let t=1;;t++){let n=[],i=!1,s=Date.now(),r=[];for(let t=0;ts.eq(e)));if(o<0)n[t]=r.length,r.push(s);else{n[t]=o,i=!0;let e=r[o],a=null;for(let t of s.set)e.set.some((e=>e.eqSimple(t)))||(a||(a=[])).push(t);a&&(e.set=a.concat(e.set).sort(((e,t)=>e.cmp(t))))}}if(vi&&console.log(`Merge identical pass ${t}${i?"":", done"} (${((Date.now()-s)/1e3).toFixed(2)}s)`),!i)return e;for(let e of r)e.defaultReduce||(e.actions=e.actions.map((e=>e.map(n,r))),e.goto=e.goto.map((e=>e.map(n,r))));for(let e=0;eLi(o,e[n],t))))return void n[s].members.push(o.id);t[o.id]=n.length,n.push(new Fi(r.origin,o.id))}for(let s=1;;s++){let r=!1,o=Date.now();for(let s=0,o=n.length;s{n[e.id]||(n[e.id]=!0,i.push(e))};for(let n of e)n.startRule&&t.includes(n.startRule)&&s(n);for(let e=0;e!n[e]}(d,this.terms.tops);/\blr\b/.test(yi)&&console.log(d.join("\n"));let m=[];for(let e of this.externalSpecializers)m.push(e);for(let e in this.specialized)m.push({token:this.terms.names[e],table:Zi(this.specialized[e])});let g=e=>e instanceof ws?e.ast.start:this.tokens.ast?this.tokens.ast.start:-1,b=c.concat(this.externalTokens).sort(((e,t)=>g(e)-g(t))).concat(h),y=new es,v=a.map((e=>{let t=[];for(let n of e.skip)t.push(n.id,0,4);if(e.rule){let n=d.find((t=>t.startRule==e.rule));for(let e of n.actions)t.push(e.term.id,n.id,2)}return t.push(65535,0),y.storeArray(t)})),x=xi("Finish states",(()=>{let e=new Uint32Array(6*d.length),t=this.computeForceReductions(d,a),n=new Ji(b,y,e,v,a,d,this);for(let e of d)n.finish(e,p(e.id),t[e.id]);return e})),w=Object.create(null);for(let e=0;ee.id)).concat(65535));let k=null;if(this.dynamicRulePrecedences.length){k=Object.create(null);for(let{rule:e,prec:t}of this.dynamicRulePrecedences)k[e.id]=t}let S=Object.create(null);for(let e of this.terms.tops)S[e.nodeName]=[d.find((t=>t.startRule==e)).id,e.id];let C=y.storeArray(u.concat(65535)),{nodeProps:A,skippedTypes:O}=this.gatherNodeProps(t);return{states:x,stateData:y.finish(),goto:ts(d),nodeNames:t.filter((e=>e.ide.nodeName)).join(" "),nodeProps:A,skippedTypes:O,maxTerm:s,repeatNodeCount:t.length-i,tokenizers:b,tokenData:f,topRules:S,dialects:w,dynamicPrecedences:k,specialized:m,tokenPrec:C,termNames:n}}getParser(){let{states:e,stateData:t,goto:n,nodeNames:i,nodeProps:s,skippedTypes:r,maxTerm:o,repeatNodeCount:a,tokenizers:l,tokenData:h,topRules:c,dialects:u,dynamicPrecedences:f,specialized:d,tokenPrec:p,termNames:m}=this.prepareParser(),g=d.map((e=>{if(e instanceof ks){let t=this.options.externalSpecializer(e.ast.id.name,this.termTable);return{term:e.term.id,get:(n,i)=>t(n,i)<<1|("extend"==e.ast.type?1:0),external:t,extend:"extend"==e.ast.type}}return{term:e.token.id,get:t=>e.table[t]||-1}}));return $t.U1.deserialize({version:14,states:e,stateData:t,goto:n,nodeNames:i,maxTerm:o,repeatNodeCount:a,nodeProps:s.map((({prop:e,terms:t})=>[this.knownProps[e].prop,...t])),propSources:this.options.externalPropSource?this.ast.externalPropSources.map((e=>this.options.externalPropSource(e.id.name))):void 0,skippedNodes:r,tokenData:h,tokenizers:l.map((e=>e.create())),context:this.ast.context?"function"==typeof this.options.contextTracker?this.options.contextTracker(this.termTable):this.options.contextTracker:void 0,topRules:c,dialects:u,dynamicPrecedences:f,specialized:g,tokenPrec:p,termNames:m})}getParserFile(){let{states:e,stateData:t,goto:n,nodeNames:i,nodeProps:s,skippedTypes:r,maxTerm:o,repeatNodeCount:a,tokenizers:l,tokenData:h,topRules:c,dialects:u,dynamicPrecedences:f,specialized:d,tokenPrec:p,termNames:m}=this.prepareParser(),g=this.options.moduleStyle||"es",b="// This file was generated by lezer-generator. You probably shouldn't edit it.\n",y=b,v={},x=Object.create(null),w=Object.create(null);for(let e of Cs)w[e]=!0;let k=this.options.exportName||"parser";w[k]=!0;let S=e=>{for(let t=0;;t++){let n=e+(t?"_"+t:"");if(!w[n])return n}},C=(e,t,n=e)=>{let i=e+" from "+t;if(x[i])return x[i];let s=JSON.stringify(t),r=e;return e in w&&(r=S(n),e+=`${"cjs"==g?":":" as"} ${r}`),w[r]=!0,(v[s]||(v[s]=[])).push(e),x[i]=r},A=C("LRParser","@lezer/lr"),O=l.map((e=>e.createSource(C))),M=this.ast.context?C(this.ast.context.id.name,this.ast.context.source):null,_=s.map((({prop:e,terms:t})=>{let{source:n}=this.knownProps[e];return`[${n.from?C(n.name,n.from):JSON.stringify(n.name)}, ${t.map(D).join(",")}]`})),T="",N=d.map((e=>{if(e instanceof ks){let t=C(e.ast.id.name,e.ast.source),n=this.options.typeScript?": any":"";return`{term: ${e.term.id}, get: (value${n}, stack${n}) => (${t}(value, stack) << 1)${"extend"==e.ast.type?" | 1":""}, external: ${t}${"extend"==e.ast.type?", extend: true":""}}`}{let n=S("spec_"+e.token.name.replace(/\W/g,""));w[n]=!0,T+=`const ${n} = ${t=e.table,"{__proto__:null,"+Object.keys(t).map((e=>`${/^(\d+|[a-zA-Z_]\w*)$/.test(e)?e:JSON.stringify(e)}:${t[e]}`)).join(", ")+"}"}\n`;let i=this.options.typeScript?`: keyof typeof ${n}`:"";return`{term: ${e.token.id}, get: (value${i}) => ${n}[value] || -1}`}var t})),E=this.ast.externalPropSources.map((e=>C(e.id.name,e.source)));for(let e in v)y+="cjs"==g?`const {${v[e].join(", ")}} = require(${e})\n`:`import {${v[e].join(", ")}} from ${e}\n`;function D(e){return"string"!=typeof e||/^(true|false|\d+(\.\d+)?|\.\d+)$/.test(e)?e:JSON.stringify(e)}y+=T;let P=Object.keys(u).map((e=>`${e}: ${u[e]}`)),R=`${A}.deserialize({\n version: 14,\n states: ${Vi(e,4294967295)},\n stateData: ${Vi(t)},\n goto: ${Vi(n)},\n nodeNames: ${JSON.stringify(i)},\n maxTerm: ${o}${M?`,\n context: ${M}`:""}${_.length?`,\n nodeProps: [\n ${_.join(",\n ")}\n ]`:""}${E.length?`,\n propSources: [${E.join()}]`:""}${r.length?`,\n skippedNodes: ${JSON.stringify(r)}`:""},\n repeatNodeCount: ${a},\n tokenData: ${Vi(h)},\n tokenizers: [${O.join(", ")}],\n topRules: ${JSON.stringify(c)}${P.length?`,\n dialects: {${P.join(", ")}}`:""}${f?`,\n dynamicPrecedences: ${JSON.stringify(f)}`:""}${N.length?`,\n specialized: [${N.join(",")}]`:""},\n tokenPrec: ${p}${this.options.includeNames?`,\n termNames: ${JSON.stringify(m)}`:""}\n})`,j=[];for(let e in this.termTable){let t=e;if(Cs.includes(t))for(let n=1;t="_".repeat(n)+e,t in this.termTable;n++);else if(!/^[\w$]+$/.test(e))continue;j.push(`${t}${"cjs"==g?":":" ="} ${this.termTable[e]}`)}for(let e=0;e{e[n.id]||(e[n.id]=!0,t.push(n))};this.terms.tops.forEach(n);for(let e=0;et.prop==e));n||i.push(n={prop:e,values:{}}),(n.values[s.props[e]]||(n.values[s.props[e]]=[])).push(s.id)}}return{nodeProps:i.map((({prop:e,values:t})=>{let n=[];for(let e in t){let i=t[e];if(1==i.length)n.push(i[0],e);else{n.push(-i.length);for(let e of i)n.push(e);n.push(e)}}return{prop:e,terms:n}})),skippedTypes:n}}makeTerminal(e,t,n){return this.terms.makeTerminal(this.terms.uniqueName(e),t,n)}computeForceReductions(e,t){let n=[],i=[],s=Object.create(null);for(let t of e){n.push(0);for(let e of t.goto){let n=s[e.term.id]||(s[e.term.id]=[]),i=n.find((t=>t.target==e.target.id));i?i.parents.push(t.id):n.push({parents:[t.id],target:e.target.id})}i[t.id]=t.set.filter((e=>e.pos>0&&!e.rule.name.top)).sort(((e,t)=>t.pos-e.pos||e.rule.parts.length-t.rule.parts.length))}let r=Object.create(null);function o(e,t,n=null){let i=s[e];return!!i&&i.some((e=>{let i=n?n.filter((t=>e.parents.includes(t))):e.parents;if(0==i.length)return!1;if(e.target==t)return!0;let s=r[e.target];return null!=s&&o(s,t,i)}))}for(let i of e)i.defaultReduce&&i.defaultReduce.parts.length>0&&(n[i.id]=Qi(i.defaultReduce,t),1==i.defaultReduce.parts.length&&(r[i.id]=i.defaultReduce.name.id));for(let s=1;;s++){let a=!0;for(let l of e){if(l.defaultReduce)continue;let e=i[l.id];if(e.length==s){for(let i of e)if(1!=i.pos||!o(i.rule.name.id,l.id)){n[l.id]=Qi(i.rule,t,i.pos),1==i.pos&&(r[l.id]=i.rule.name.id);break}}else e.length>s&&(a=!1)}if(a)break}return n}substituteArgs(e,t,n){return 0==t.length?e:e.walk((e=>{let i;if(e instanceof rn&&(i=n.findIndex((t=>t.name==e.id.name)))>-1){let n=t[i];if(e.args.length){if(n instanceof rn&&!n.args.length)return new rn(e.start,n.id,e.args);this.raise("Passing arguments to a parameter that already has arguments",e.start)}return n}if(e instanceof an){let i=e.rule,s=this.substituteArgsInProps(i.props,t,n);return s==i.props?e:new an(e.start,new Vt(i.start,i.id,s,i.params,i.expr))}if(e instanceof on){let i=this.substituteArgsInProps(e.props,t,n);return i==e.props?e:new on(e.start,e.type,i,e.token,e.content)}return e}))}substituteArgsInProps(e,t,n){let i=e=>{let i=e;for(let s=0;se.name==r.name));if(o<0)continue;i==e&&(i=e.slice());let a=t[o];a instanceof rn&&!a.args.length?i[s]=new wn(r.start,a.id.name,null):a instanceof fn?i[s]=new wn(r.start,a.value,null):this.raise(`Trying to interpolate expression '${a}' into a prop`,r.start)}return i},s=e;for(let t=0;te.id.name==i.id.name)):-1;s<0&&this.raise(`Reference to unknown precedence: '${i.id.name}'`,i.id.start);let r=e.items[s],o=e.items.length-s;"cut"==r.type?t=t.join(new Nn(0,Wi,o)):(t=t.join(new Nn(o<<2)),n=n.join(new Nn((o<<2)+("left"==r.type?1:"right"==r.type?-1:0))))}return{here:t,atEnd:n}}raise(e,t=1){return this.input.raise(e,t)}warn(e,t=-1){let n=this.input.message(e,t);this.options.warn?this.options.warn(n):console.warn(n)}defineRule(e,t){let n=this.currentSkip[this.currentSkip.length-1];for(let i of t)this.rules.push(new Pn(e,i.terms,i.ensureConflicts(),n))}resolve(e){for(let t of this.built)if(t.matches(e))return[Ui(t.term)];let t=this.tokens.getToken(e);if(t)return[Ui(t)];for(let t of this.localTokens){let n=t.getToken(e);if(n)return[Ui(n)]}for(let t of this.externalTokens){let n=t.getToken(e);if(n)return[Ui(n)]}for(let t of this.externalSpecializers){let n=t.getToken(e);if(n)return[Ui(n)]}let n=this.astRules.find((t=>t.rule.id.name==e.id.name));return n?(n.rule.params.length!=e.args.length&&this.raise(`Wrong number or arguments for '${e.id.name}'`,e.start),this.used(n.rule.id.name),[Ui(this.buildRule(n.rule,e.args,n.skip))]):this.raise(`Reference to undefined rule '${e.id.name}'`,e.start)}normalizeRepeat(e){let t=this.built.find((t=>t.matchesRepeat(e)));if(t)return Ui(t.term);let n=e.expr.precthis.normalizeExpr(e))),n=this;return function i(s,r,o){let{here:a,atEnd:l}=n.conflictsFor(e.markers[r]);if(r==t.length)return[s.withConflicts(s.terms.length,a.join(o))];let h=[];for(let e of t[r])for(let t of i(s.concat(e).withConflicts(s.terms.length,a),r+1,o.join(l)))h.push(t);return h}(Gi.none,0,Nn.none)}normalizeExpr(e){if(e instanceof un&&"?"==e.kind)return[Gi.none,...this.normalizeExpr(e.expr)];if(e instanceof un){let t=this.normalizeRepeat(e);return"+"==e.kind?[t]:[Gi.none,t]}return e instanceof ln?e.exprs.reduce(((e,t)=>e.concat(this.normalizeExpr(t))),[]):e instanceof hn?this.normalizeSequence(e):e instanceof fn?[Ui(this.tokens.getLiteral(e))]:e instanceof rn?this.resolve(e):e instanceof on?[Ui(this.resolveSpecialization(e))]:e instanceof an?[Ui(this.buildRule(e.rule,Wi,this.currentSkip[this.currentSkip.length-1],!0))]:this.raise(`This type of expression ('${e}') may not occur in non-token rules`,e.start)}buildRule(e,t,n,i=!1){let s=this.substituteArgs(e.expr,t,e.params),{name:r,props:o,dynamicPrec:a,inline:l,group:h,exported:c}=this.nodeInfo(e.props||Wi,i?"pg":"pgi",e.id.name,t,e.params,e.expr);c&&e.params.length&&this.warn("Can't export parameterized rules",e.start),c&&i&&this.warn("Can't export inline rule",e.start);let u=this.newName(e.id.name+(t.length?"<"+t.join(",")+">":""),r||!0,o);l&&(u.inline=!0),a&&this.registerDynamicPrec(u,a),(u.nodeType||c)&&0==e.params.length&&(r||(u.preserve=!0),i||(this.namedTerms[c||e.id.name]=u)),i||this.built.push(new Ki(e.id.name,t,u)),this.currentSkip.push(n);let f=this.normalizeExpr(s);return f.length>100*(s instanceof ln?s.exprs.length:1)&&this.warn(`Rule ${e.id.name} is generating a lot (${f.length}) of choices.\n Consider splitting it up or reducing the amount of ? or | operator uses.`,e.start),/\brulesize\b/.test(yi)&&f.length>10&&console.log(`Rule ${e.id.name}: ${f.length} variants`),this.defineRule(u,f),this.currentSkip.pop(),h&&this.definedGroups.push({name:u,group:h,rule:e}),u}nodeInfo(e,t,n=null,i=Wi,s=Wi,r,o){let a={},l=n&&(t.indexOf("a")>-1||!function(e){let t=e[0];return"_"==t||t.toUpperCase()!=t}(n))&&!/ /.test(n)?n:null,h=null,c=0,u=!1,f=null,d=null;for(let r of e)if(r.at)if("name"==r.name)l=this.finishProp(r,i,s),/ /.test(l)&&this.raise(`Node names cannot have spaces ('${l}')`,r.start);else if("dialect"==r.name){t.indexOf("d")<0&&this.raise("Can't specify a dialect on non-token rules",e[0].start),1==r.value.length||r.value[0].value||this.raise("The '@dialect' rule prop must hold a plain string value");let n=this.dialects.indexOf(r.value[0].value);n<0&&this.raise(`Unknown dialect '${r.value[0].value}'`,r.value[0].start),h=n}else"dynamicPrecedence"==r.name?(t.indexOf("p")<0&&this.raise("Dynamic precedence can only be specified on nonterminals"),1==r.value.length&&/^-?(?:10|\d)$/.test(r.value[0].value)||this.raise("The '@dynamicPrecedence' rule prop must hold an integer between -10 and 10"),c=+r.value[0].value):"inline"==r.name?(r.value.length&&this.raise("'@inline' doesn't take a value",r.value[0].start),t.indexOf("i")<0&&this.raise("Inline can only be specified on nonterminals"),u=!0):"isGroup"==r.name?(t.indexOf("g")<0&&this.raise("'@isGroup' can only be specified on nonterminals"),f=r.value.length?this.finishProp(r,i,s):n):"export"==r.name?d=r.value.length?this.finishProp(r,i,s):n:this.raise(`Unknown built-in prop name '@${r.name}'`,r.start);else{if(!this.knownProps[r.name]){let e=["name","dialect","dynamicPrecedence","export","isGroup"].includes(r.name)?` (did you mean '@${r.name}'?)`:"";this.raise(`Unknown prop name '${r.name}'${e}`,r.start)}a[r.name]=this.finishProp(r,i,s)}if(r&&this.ast.autoDelim&&(l||Cn(a))){let e=this.findDelimiters(r);e&&(Xi(e[0],"closedBy",e[1].nodeName),Xi(e[1],"openedBy",e[0].nodeName))}if(o&&Cn(o))for(let e in o)e in a||(a[e]=o[e]);return Cn(a)&&!l&&this.raise("Node has properties but no name",e.length?e[0].start:r.start),u&&(Cn(a)||h||c)&&this.raise("Inline nodes can't have props, dynamic precedence, or a dialect",e[0].start),u&&l&&(l=null),{name:l,props:a,dialect:h,dynamicPrec:c,inline:u,group:f,exported:d}}finishProp(e,t,n){return e.value.map((e=>{if(e.value)return e.value;let i=n.findIndex((t=>t.name==e.name));i<0&&this.raise(`Property refers to '${e.name}', but no parameter by that name is in scope`,e.start);let s=t[i];return s instanceof rn&&!s.args.length?s.id.name:s instanceof fn?s.value:this.raise(`Expression '${s}' can not be used as part of a property value`,e.start)})).join("")}resolveSpecialization(e){let t,n=e.type,{name:i,props:s,dialect:r,exported:o}=this.nodeInfo(e.props,"d"),a=this.normalizeExpr(e.token);if(1==a.length&&1==a[0].terms.length&&a[0].terms[0].terminal||this.raise(`The first argument to '${n}' must resolve to a token`,e.token.start),e.content instanceof fn)t=[e.content.value];else{if(!(e.content instanceof ln&&e.content.exprs.every((e=>e instanceof fn))))return this.raise(`The second argument to '${e.type}' must be a literal or choice of literals`,e.content.start);t=e.content.exprs.map((e=>e.value))}let l=a[0].terms[0],h=null,c=this.specialized[l.name]||(this.specialized[l.name]=[]);for(let a of t){let t=c.find((e=>e.value==a));null==t?(h||(h=this.makeTerminal(l.name+"/"+JSON.stringify(a),i,s),null!=r&&(this.tokens.byDialect[r]||(this.tokens.byDialect[r]=[])).push(h)),c.push({value:a,term:h,type:n,dialect:r,name:i}),this.tokenOrigins[h.name]={spec:l},(i||o)&&(i||(h.preserve=!0),this.namedTerms[o||i]=h)):(t.type!=n&&this.raise(`Conflicting specialization types for ${JSON.stringify(a)} of ${l.name} (${n} vs ${t.type})`,e.start),t.dialect!=r&&this.raise(`Conflicting dialects for specialization ${JSON.stringify(a)} of ${l.name}`,e.start),t.name!=i&&this.raise(`Conflicting names for specialization ${JSON.stringify(a)} of ${l.name}`,e.start),h&&t.term!=h&&this.raise(`Conflicting specialization tokens for ${JSON.stringify(a)} of ${l.name}`,e.start),h=t.term)}return h}findDelimiters(e){if(!(e instanceof hn)||e.exprs.length<2)return null;let t=e=>{if(e instanceof fn)return{term:this.tokens.getLiteral(e),str:e.value};if(e instanceof rn&&0==e.args.length){let n=this.ast.rules.find((t=>t.id.name==e.id.name));if(n)return t(n.expr);let i=this.tokens.rules.find((t=>t.id.name==e.id.name));if(i&&i.expr instanceof fn)return{term:this.tokens.getToken(e),str:i.expr.value}}return null},n=t(e.exprs[e.exprs.length-1]);if(!n||!n.term.nodeName)return null;let i=["()","[]","{}","<>"].find((e=>n.str.indexOf(e[1])>-1&&n.str.indexOf(e[0])<0));if(!i)return null;let s=t(e.exprs[0]);return!s||!s.term.nodeName||s.str.indexOf(i[0])<0||s.str.indexOf(i[1])>-1?null:[s.term,n.term]}registerDynamicPrec(e,t){this.dynamicRulePrecedences.push({rule:e,prec:t}),e.preserve=!0}defineGroup(e,t,n){var i;let s=[],r=e=>{if(e.nodeName)return[e];s.includes(e)&&this.raise(`Rule '${n.id.name}' cannot define a group because it contains a non-named recursive rule ('${e.name}')`,n.start);let t=[];s.push(e);for(let i of this.rules)if(i.name==e){let e=i.parts.map(r).filter((e=>e.length));if(e.length>1&&this.raise(`Rule '${n.id.name}' cannot define a group because some choices produce multiple named nodes`,n.start),1==e.length)for(let n of e[0])t.push(n)}return s.pop(),t};for(let n of r(e))n.props.group=((null===(i=n.props.group)||void 0===i?void 0:i.split(" "))||[]).concat(t).sort().join(" ")}checkGroups(){let e=Object.create(null),t=Object.create(null);for(let n of this.terms.terms)if(n.nodeName&&(t[n.nodeName]=!0,n.props.group))for(let t of n.props.group.split(" "))(e[t]||(e[t]=[])).push(n);let n=Object.keys(e);for(let i=0;ii.includes(e)))&&(r.length>i.length?i.some((e=>!r.includes(e))):r.some((e=>!i.includes(e))))&&this.warn(`Groups '${s}' and '${n[t]}' overlap without one being a superset of the other`)}}}}class Ji{constructor(e,t,n,i,s,r,o){this.tokenizers=e,this.data=t,this.stateArray=n,this.skipData=i,this.skipInfo=s,this.states=r,this.builder=o,this.sharedActions=[]}findSharedActions(e){if(e.actions.length<5)return null;let t=null;for(let n of this.sharedActions)(!t||n.actions.length>t.actions.length)&&n.actions.every((t=>e.actions.some((e=>e.eq(t)))))&&(t=n);if(t)return t;let n=null,i=[];for(let t=e.id+1;t=5&&(!n||n.lengthe.eq(s))))if(s instanceof _i)i.push(s.term.id,s.target.id,0);else{let e=Qi(s.rule,this.skipInfo);e!=t&&i.push(s.term.id,65535&e,e>>16)}return i.push(65535),t>-1?i.push(2,65535&t,t>>16):n?i.push(1,65535&n.addr,n.addr>>16):i.push(0),this.data.storeArray(i)}finish(e,t,n){let i=this.builder,s=i.skipRules.indexOf(e.skip),r=this.skipData[s],o=this.skipInfo[s].startTokens,a=e.defaultReduce?Qi(e.defaultReduce,this.skipInfo):0,l=t?1:0,h=-1,c=null;if(0==a){if(t)for(const t of e.actions)t instanceof Ti&&t.term.eof&&(h=Qi(t.rule,this.skipInfo));h<0&&(c=this.findSharedActions(e))}e.set.some((e=>e.rule.name.top&&e.pos==e.rule.parts.length))&&(l|=2);let u=[];for(let t=0;tt.rule==e.name))?262144:0)|n<<19}class es{constructor(){this.data=[]}storeArray(e){let t=function(e,t){e:for(let n=0;;){let i=e.indexOf(t[0],n);if(-1==i||i+t.length>e.length)break;for(let s=1;s-1)return t;let n=this.data.length;for(let t of e)this.data.push(t);return n}finish(){return Uint16Array.from(this.data)}}function ts(e){let t={},n=0;for(let i of e)for(let e of i.goto){n=Math.max(e.term.id,n);let s=t[e.term.id]||(t[e.term.id]={});(s[e.target.id]||(s[e.target.id]=[])).push(i.id)}let i=new es,s=[],r=n+2;for(let e=0;e<=n;e++){let n=t[e];if(!n){s.push(1);continue}let o=[],a=Object.keys(n);for(let e of a){let t=n[e];o.push((e==a[a.length-1]?1:0)+(t.length<<1)),o.push(+e);for(let e of t)o.push(e)}s.push(i.storeArray(o)+r)}if(s.some((e=>e>65535)))throw new Sn("Goto table too large");return Uint16Array.from([n+1,...s,...i.data])}class ns{constructor(e,t){this.tokens=e,this.groupID=t}create(){return this.groupID}createSource(){return String(this.groupID)}}function is(e,t){e.includes(t)||e.push(t)}function ss(e){let t=Object.create(null);for(let n of e){let e=1<e.id.name==t));if(!n)return null;let{name:i,props:s,dialect:r,exported:o}=this.b.nodeInfo(n.props,"d",t,e.args,n.params.length!=e.args.length?Wi:n.params),a=this.b.makeTerminal(e.toString(),i,s);return null!=r&&(this.byDialect[r]||(this.byDialect[r]=[])).push(a),(a.nodeType||o)&&0==n.params.length&&(a.nodeType||(a.preserve=!0),this.b.namedTerms[o||t]=a),this.buildRule(n,e,this.startState,new Fn([a])),this.built.push(new Ki(t,e.args,a)),a}buildRule(e,t,n,i,s=Wi){let r=t.id.name;e.params.length!=t.args.length&&this.b.raise(`Incorrect number of arguments for token '${r}'`,t.start);let o=this.building.find((e=>e.name==r&&vn(t.args,e.args)));if(o){if(o.to==i)return void n.nullEdge(o.start);let e=this.building.length-1;for(;this.building[e].name!=r;)e--;this.b.raise(`Invalid (non-tail) recursion in token rules: ${this.building.slice(e).map((e=>e.name)).join(" -> ")}`,t.start)}this.b.used(e.id.name);let a=new Fn;n.nullEdge(a),this.building.push(new os(r,a,i,t.args)),this.build(this.b.substituteArgs(e.expr,t.args,e.params),a,i,t.args.map(((t,n)=>new rs(e.params[n].name,t,s)))),this.building.pop()}build(e,t,n,i){if(e instanceof rn){let s,r=e.id.name,o=i.find((e=>e.name==r));if(o)return this.build(o.expr,t,n,o.scope);for(let e=0,t=this.b.localTokens;e<=t.length&&(s=(e==t.length?this.b.tokens:t[e]).rules.find((e=>e.id.name==r)),!s);e++);if(!s)return this.b.raise(`Reference to token rule '${r}', which isn't found`,e.start);this.buildRule(s,e,t,n,i)}else if(e instanceof bn)for(let[i,s]of gn[e.type])t.edge(i,s,n);else if(e instanceof ln)for(let s of e.exprs)this.build(s,t,n,i);else if(bs(e))t.nullEdge(n);else if(e instanceof hn){let s=e.markers.find((e=>e.length>0));s&&this.b.raise("Conflict marker in token expression",s[0].start);for(let s=0;st&&n.push([t,i]),t=s;return t<=ds&&n.push([t,ds+1]),n}(e.ranges):e.ranges)gs(t,n,i,s);else if(e instanceof fn)for(let i=0;it.id==e));n&&t.push(n.term)}t.length||this.b.warn(`Precedence specified for unknown token ${i}`,i.start);for(let i of t)xs(e,i,n);n=n.concat(t)}}}precededBy(e,t){let n=this.precedenceRelations.find((t=>t.term==e));return n&&n.after.includes(t)}buildPrecTable(e){let t=[],n=this.precedenceRelations.slice();for(let{a:t,b:i,soft:s}of e)if(s){if(!n.some((e=>e.term==t))||!n.some((e=>e.term==i)))continue;s<0&&([t,i]=[i,t]),xs(n,i,[t]),xs(n,t,[])}e:for(;n.length;){for(let e=0;et.includes(e.id)))){if(t.push(i.term.id),1==n.length)break e;n[e]=n.pop();continue e}}this.b.raise(`Cyclic token precedence relation between ${n.map((e=>e.term)).join(", ")}`)}return t}}class ls extends as{constructor(){super(...arguments),this.explicitConflicts=[]}getLiteral(e){let t=JSON.stringify(e.value);for(let e of this.built)if(e.id==t)return e.term;let n=null,i={},s=null,r=null,o=this.ast?this.ast.literals.find((t=>t.literal==e.value)):null;o&&({name:n,props:i,dialect:s,exported:r}=this.b.nodeInfo(o.props,"da",e.value));let a=this.b.makeTerminal(t,n,i);return null!=s&&(this.byDialect[s]||(this.byDialect[s]=[])).push(a),r&&(this.b.namedTerms[r]=a),this.build(e,this.startState,new Fn([a]),Wi),this.built.push(new Ki(t,Wi,a)),a}takeConflicts(){var e;let t=e=>{if(e instanceof rn){for(let t of this.built)if(t.matches(e))return t.term}else{let t=JSON.stringify(e.value),n=this.built.find((e=>e.id==t));if(n)return n.term}return this.b.warn(`Precedence specified for unknown token ${e}`,e.start),null};for(let n of(null===(e=this.ast)||void 0===e?void 0:e.conflicts)||[]){let e=t(n.a),i=t(n.b);e&&i&&(e.ide.id.name==i.accepting[0].name)).start),/\btokens\b/.test(yi)&&console.log(i.toString());let s=i.findConflicts(function(e,t,n){let i=Object.create(null);function s(e,i){return e.actions.some((e=>e.term==i))||n[t.skipRules.indexOf(e.skip)].startTokens.includes(i)}return(t,n)=>{t.ids(e,t)&&s(e,n)))}}(e,this.b,t)).filter((({a:e,b:t})=>!this.precededBy(e,t)&&!this.precededBy(t,e)));for(let{a:e,b:t}of this.explicitConflicts)s.some((n=>n.a==e&&n.b==t))||s.push(new zn(e,t,0,"",""));let r=s.filter((e=>e.soft)),o=s.filter((e=>!e.soft)),a=[],l=[];for(let i of e){if(i.defaultReduce||i.tokenGroup>-1)continue;let e=[],s=[],r=t[this.b.skipRules.indexOf(i.skip)].startTokens;for(let e of r)i.actions.some((t=>t.term==e))&&this.b.raise(`Use of token ${e.name} conflicts with skip rule`);let h=[];for(let e=0;ee.conflict==n))){let e=n.exampleA?` (example: ${JSON.stringify(n.exampleA)}${n.exampleB?` vs ${JSON.stringify(n.exampleB)}`:""})`:"";a.push({error:`Overlapping tokens ${t.name} and ${r.name} used in same context${e}\nAfter: ${i.set[0].trail()}`,conflict:n})}is(e,t),is(s,r)}}let c=null;for(let t of l)if(!s.some((e=>t.tokens.includes(e)))){for(let n of e)is(t.tokens,n);c=t;break}c||(c=new ns(e,l.length+n),l.push(c)),i.tokenGroup=c.groupID}a.length&&this.b.raise(a.map((e=>e.error)).join("\n\n")),l.length+n>16&&this.b.raise(`Too many different token groups (${l.length}) to represent them as a 16-bit bitfield`);let h=this.buildPrecTable(r);return{tokenGroups:l,tokenPrec:h,tokenData:i.toArray(ss(l),h)}}}class hs extends as{constructor(e,t){super(e,t),this.fallback=null,t.fallback&&e.unique(t.fallback.id)}getToken(e){let t=null;if(this.ast.fallback&&this.ast.fallback.id.name==e.id.name){if(e.args.length&&this.b.raise(`Incorrect number of arguments for ${e.id.name}`,e.start),!this.fallback){let{name:t,props:n,exported:i}=this.b.nodeInfo(this.ast.fallback.props,"",e.id.name,Wi,Wi),s=this.fallback=this.b.makeTerminal(e.id.name,t,n);(s.nodeType||i)&&(s.nodeType||(s.preserve=!0),this.b.namedTerms[i||e.id.name]=s),this.b.used(e.id.name)}t=this.fallback}else t=super.getToken(e);return t&&!this.b.tokenOrigins[t.name]&&(this.b.tokenOrigins[t.name]={group:this}),t}buildLocalGroup(e,t,n){let i=this.startState.compile();i.accepting.length&&this.b.raise(`Grammar contains zero-length tokens (in '${i.accepting[0].name}')`,this.rules.find((e=>e.id.name==i.accepting[0].name)).start);for(let{a:e,b:t,exampleA:n}of i.findConflicts((()=>!0)))this.precededBy(e,t)||this.precededBy(t,e)||this.b.raise(`Overlapping tokens ${e.name} and ${t.name} in local token group${n?` (example: ${JSON.stringify(n)})`:""}`);for(let i of e){if(i.defaultReduce)continue;let e=null,s=t[this.b.skipRules.indexOf(i.skip)].startTokens[0];for(let{term:t}of i.actions){let n=this.b.tokenOrigins[t.name];(null==n?void 0:n.group)==this?e=t:s=t}e&&(s&&this.b.raise(`Tokens from a local token group used together with other tokens (${e.name} with ${s.name})`),i.tokenGroup=n)}let s=this.buildPrecTable(Wi),r=i.toArray({[n]:65535},s),o=r.length,a=new Uint16Array(r.length+s.length+1);return a.set(r,0),a.set(s,o),a[a.length-1]=65535,{groupID:n,create:()=>new $t.uC(a,o,this.fallback?this.fallback.id:void 0),createSource:e=>`new ${e("LocalTokenGroup","@lezer/lr")}(${Vi(a)}, ${o}${this.fallback?`, ${this.fallback.id}`:""})`}}}const cs=65536,us=55296,fs=57344,ds=1114111,ps=56320,ms=57343;function gs(e,t,n,i){if(nfs&&e.edge(Math.max(n,fs),Math.min(i,65536),t),n=cs),i<=cs)return;let s=String.fromCodePoint(n),r=String.fromCodePoint(i-1),o=s.charCodeAt(0),a=s.charCodeAt(1),l=r.charCodeAt(0),h=r.charCodeAt(1);if(o==l){let n=new Fn;e.edge(o,o+1,n),n.edge(a,h+1,t)}else{let n=o,i=l;if(a>ps){n++;let i=new Fn;e.edge(o,o+1,i),i.edge(a,ms+1,t)}if(he.term==t));i<0?e.push({term:t,after:n}):e[i]={term:t,after:e[i].after.concat(n)}}class ws{constructor(e,t){this.b=e,this.ast=t,this.tokens=ys(e,t.tokens);for(let e in this.tokens)this.b.tokenOrigins[this.tokens[e].name]={external:this}}getToken(e){return vs(this.b,this.tokens,e)}create(){return this.b.options.externalTokenizer(this.ast.id.name,this.b.termTable)}createSource(e){let{source:t,id:{name:n}}=this.ast;return e(n,t)}}class ks{constructor(e,t){this.b=e,this.ast=t,this.term=null,this.tokens=ys(e,t.tokens)}finish(){let e=this.b.normalizeExpr(this.ast.token);1==e.length&&1==e[0].terms.length&&e[0].terms[0].terminal||this.b.raise(`The token expression to '@external ${this.ast.type}' must resolve to a token`,this.ast.token.start),this.term=e[0].terms[0];for(let e in this.tokens)this.b.tokenOrigins[this.tokens[e].name]={spec:this.term,external:this}}getToken(e){return vs(this.b,this.tokens,e)}}function Ss(e,t={}){let n=new Yi(e,t),i=n.getParser();return i.termTable=n.termTable,i}const Cs=["await","break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","while","with","null","true","false","instanceof","typeof","void","delete","new","in","this","const","class","extends","export","import","super","enum","implements","interface","let","package","private","protected","public","static","yield","require"];function As(e){return e.props.some((e=>e.at&&"export"==e.name))}const Os=s.Lz.theme({"&":{background:"var(--jp-layout-color0)",color:"var(--jp-content-font-color1)"},".jp-CodeConsole &, .jp-Notebook &":{background:"transparent"},".cm-content":{caretColor:"var(--jp-editor-cursor-color)"},".cm-scroller":{fontFamily:"inherit"},".cm-cursor, .cm-dropCursor":{borderLeft:"var(--jp-code-cursor-width0) solid var(--jp-editor-cursor-color)"},".cm-selectionBackground, .cm-content ::selection":{backgroundColor:"var(--jp-editor-selected-background)"},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{backgroundColor:"var(--jp-editor-selected-focused-background)"},".cm-gutters":{borderRight:"1px solid var(--jp-border-color2)",backgroundColor:"var(--jp-layout-color2)"},".cm-gutter":{backgroundColor:"var(--jp-layout-color2)"},".cm-activeLine":{backgroundColor:"color-mix(in srgb, var(--jp-layout-color3) 25%, transparent)"},".cm-lineNumbers":{color:"var(--jp-ui-font-color2)"},".cm-searchMatch":{backgroundColor:"var(--jp-search-unselected-match-background-color)",color:"var(--jp-search-unselected-match-color)"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"var(--jp-search-selected-match-background-color) !important",color:"var(--jp-search-selected-match-color) !important"},".cm-tooltip":{backgroundColor:"var(--jp-layout-color1)"},".cm-builtin":{color:"var(--jp-mirror-editor-builtin-color)"}}),Ms=r.cr.define([{tag:De._A.meta,color:"var(--jp-mirror-editor-meta-color)"},{tag:De._A.heading,color:"var(--jp-mirror-editor-header-color)"},{tag:[De._A.heading1,De._A.heading2,De._A.heading3,De._A.heading4],color:"var(--jp-mirror-editor-header-color)",fontWeight:"bold"},{tag:De._A.keyword,color:"var(--jp-mirror-editor-keyword-color)",fontWeight:"bold"},{tag:De._A.atom,color:"var(--jp-mirror-editor-atom-color)"},{tag:De._A.number,color:"var(--jp-mirror-editor-number-color)"},{tag:[De._A.definition(De._A.name),De._A.function(De._A.definition(De._A.variableName))],color:"var(--jp-mirror-editor-def-color)"},{tag:De._A.standard(De._A.variableName),color:"var(--jp-mirror-editor-builtin-color)"},{tag:[De._A.special(De._A.variableName),De._A.self],color:"var(--jp-mirror-editor-variable-2-color)"},{tag:De._A.punctuation,color:"var(--jp-mirror-editor-punctuation-color)"},{tag:De._A.propertyName,color:"var(--jp-mirror-editor-property-color)"},{tag:De._A.operator,color:"var(--jp-mirror-editor-operator-color)",fontWeight:"bold"},{tag:De._A.comment,color:"var(--jp-mirror-editor-comment-color)",fontStyle:"italic"},{tag:De._A.string,color:"var(--jp-mirror-editor-string-color)"},{tag:[De._A.labelName,De._A.monospace,De._A.special(De._A.string)],color:"var(--jp-mirror-editor-string-2-color)"},{tag:De._A.bracket,color:"var(--jp-mirror-editor-bracket-color)"},{tag:De._A.tagName,color:"var(--jp-mirror-editor-tag-color)"},{tag:De._A.attributeName,color:"var(--jp-mirror-editor-attribute-color)"},{tag:De._A.quote,color:"var(--jp-mirror-editor-quote-color)"},{tag:De._A.link,color:"var(--jp-mirror-editor-link-color)",textDecoration:"underline"},{tag:[De._A.separator,De._A.derefOperator,De._A.paren],color:""},{tag:De._A.strong,fontWeight:"bold"},{tag:De._A.emphasis,fontStyle:"italic"},{tag:De._A.strikethrough,textDecoration:"line-through"},{tag:De._A.bool,color:"var(--jp-mirror-editor-keyword-color)",fontWeight:"bold"}]),_s=[Os,(0,r.y9)(Ms)];class Ts{constructor(){this._themeMap=new Map([["jupyter",Object.freeze({name:"jupyter",theme:_s})]])}get themes(){return Array.from(this._themeMap.values())}defaultTheme(){return this._themeMap.get("jupyter").theme}addTheme(e){if(this._themeMap.has(e.name))throw new Error(`A theme named '${e.name}' is already registered.`);this._themeMap.set(e.name,{displayName:e.name,...e})}getTheme(e){var t;const n=null===(t=this._themeMap.get(e))||void 0===t?void 0:t.theme;return null!=n?n:this.defaultTheme()}}!function(e){e.getDefaultThemes=function(e){const t=(null!=e?e:Te.wK).load("jupyterlab");return[Object.freeze({name:"codemirror",displayName:t.__("codemirror"),theme:[s.Lz.baseTheme({}),(0,r.y9)(r.Zt)]})]}}(Ts||(Ts={}));class Ns{constructor(e,t){this.langPython=t,this.tree=(0,r.mv)(e.state),this.mark=s.NZ.mark({class:"cm-builtin"}),this.decorations=this.buildDeco(e),this.decoratedTo=e.viewport.to}update(e){let t=(0,r.mv)(e.state),{viewport:n}=e.view,i=e.changes.mapPos(this.decoratedTo,1);t.length=n.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=i):(t!=this.tree||e.viewportChanged)&&(this.tree=t,this.decorations=this.buildDeco(e.view),this.decoratedTo=n.to)}buildDeco(e){if(!this.tree.length)return s.NZ.none;let t=new i.vB;const n=i=>{var s;const r=i.node.cursor(),a=r.tree&&r.tree.prop(o.uY.mounted);if(a&&a.overlay&&(null===(s=i.node.enter(a.overlay[0].from+i.from,1))||void 0===s||s.cursor().iterate(n)),this.langPython.isActiveAt(e.state,i.from+1)&&"VariableName"===i.name){const n=e.state.sliceDoc(i.from,i.to);Ds.includes(n)&&t.add(i.from,i.to,this.mark)}};for(let{from:t,to:i}of e.visibleRanges)this.tree.iterate({enter:n,from:t,to:i});return t.finish()}}function Es(e){return s.Z9.define((t=>new Ns(t,e)),{decorations:e=>e.decorations})}const Ds=["abs","aiter","all","any","anext","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip","__import__"];class Ps{constructor(){this._modeList=[],this.addLanguage({name:"none",mime:"text/plain",support:new r.Yy(r.bj.define({parser:Ss("@top Program { }")}))})}addLanguage(e){var t;if(null!==(t=this.findByName(e.name))&&void 0!==t?t:this.findByMIME(e.mime,!0))throw new Error(`${e.mime} already registered`);this._modeList.push(this.makeSpec(e))}async getLanguage(e){const t=this.findBest(e);return t&&!t.support&&(t.support=await t.load()),t}getLanguages(){return[...this._modeList]}findByMIME(e,t=!1){if(Array.isArray(e)){for(let t=0;t-1&&t.substring(n+1,t.length);return i?this.findByExtension(i):null}findBest(e,t=!0){var n,i,s,r;const o="string"==typeof e?e:e.name,a="string"!=typeof e?e.mime:o,l="string"!=typeof e&&null!==(n=e.extensions)&&void 0!==n?n:[];return null!==(r=null!==(s=null!==(i=o?this.findByName(o):null)&&void 0!==i?i:a?this.findByMIME(a):null)&&void 0!==s?s:this.findByExtension(l))&&void 0!==r?r:t?this.findByMIME(Ft.defaultMimeType):null}async highlight(e,t,n){var i;t&&await this.getLanguage(t);const s=null===(i=null==t?void 0:t.support)||void 0===i?void 0:i.language;if(!s)return void n.appendChild(document.createTextNode(e));const r=s.parser.parse(e);let o=0;(0,De.DM)(r,Ms,((t,i,s)=>{t>o&&n.appendChild(document.createTextNode(e.slice(o,t)));const r=n.appendChild(document.createElement("span"));r.className=s,r.appendChild(document.createTextNode(e.slice(t,i))),o=i})),o(await n.e(6446).then(n.bind(n,6446))).cpp()},{name:"C++",displayName:s.__("C++"),mime:"text/x-c++src",extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load:async()=>(await n.e(6446).then(n.bind(n,6446))).cpp()},{name:"CQL",displayName:s.__("CQL"),mime:"text/x-cassandra",extensions:["cql"],load:()=>i("Cassandra")},{name:"CSS",displayName:s.__("CSS"),mime:"text/css",extensions:["css"],load:async()=>(await n.e(4448).then(n.bind(n,4448))).css()},{name:"HTML",displayName:s.__("HTML"),alias:["xhtml"],mime:"text/html",extensions:["html","htm","handlebars","hbs"],load:async()=>(await Promise.all([n.e(2e3),n.e(4448),n.e(3242)]).then(n.bind(n,3242))).html()},{name:"Java",displayName:s.__("Java"),mime:"text/x-java",extensions:["java"],load:async()=>(await n.e(1302).then(n.bind(n,1302))).java()},{name:"Javascript",displayName:s.__("Javascript"),alias:["ecmascript","js","node"],mime:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],extensions:["js","mjs","cjs"],load:async()=>(await n.e(2e3).then(n.bind(n,2e3))).javascript()},{name:"JSON",displayName:s.__("JSON"),alias:["json5"],mime:["application/json","application/x-json"],extensions:["json","map"],load:async()=>(await n.e(6367).then(n.bind(n,6367))).json()},{name:"JSX",displayName:s.__("JSX"),mime:"text/jsx",extensions:["jsx"],load:async()=>(await n.e(2e3).then(n.bind(n,2e3))).javascript({jsx:!0})},{name:"MariaDB SQL",displayName:s.__("MariaDB SQL"),mime:"text/x-mariadb",load:()=>i("MariaSQL")},{name:"Markdown",displayName:s.__("Markdown"),mime:"text/x-markdown",extensions:["md","markdown","mkd"],async load(){return(await Promise.all([n.e(2e3),n.e(4448),n.e(3242),n.e(1081)]).then(n.bind(n,1081))).markdown({codeLanguages:this._modeList})}},{name:"MS SQL",displayName:s.__("MS SQL"),mime:"text/x-mssql",load:()=>i("MSSQL")},{name:"MySQL",displayName:s.__("MySQL"),mime:"text/x-mysql",load:()=>i("MySQL")},{name:"PHP",displayName:s.__("PHP"),mime:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],extensions:["php","php3","php4","php5","php7","phtml"],load:async()=>(await Promise.all([n.e(2e3),n.e(4448),n.e(3242),n.e(3543)]).then(n.bind(n,3543))).php()},{name:"PLSQL",displayName:s.__("PLSQL"),mime:"text/x-plsql",extensions:["pls"],load:()=>i("PLSQL")},{name:"PostgreSQL",displayName:s.__("PostgreSQL"),mime:"text/x-pgsql",load:()=>i("PostgreSQL")},{name:"Python",displayName:s.__("Python"),mime:"text/x-python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,async load(){const e=await n.e(2376).then(n.bind(n,2376));return new r.Yy(e.pythonLanguage,Es(e.pythonLanguage))}},{name:"ipython",displayName:s.__("ipython"),mime:"text/x-ipython",async load(){const e=await n.e(2376).then(n.bind(n,2376));return new r.Yy(e.pythonLanguage,Es(e.pythonLanguage))}},{name:"Rust",displayName:s.__("Rust"),mime:"text/x-rustsrc",extensions:["rs"],load:async()=>(await n.e(142).then(n.bind(n,142))).rust()},{name:"SQL",displayName:s.__("SQL"),mime:["application/sql","text/x-sql"],extensions:["sql"],load:()=>i("StandardSQL")},{name:"SQLite",displayName:s.__("SQLite"),mime:"text/x-sqlite",load:()=>i("SQLite")},{name:"TSX",displayName:s.__("TSX"),alias:["TypeScript-JSX"],mime:"text/typescript-jsx",extensions:["tsx"],load:async()=>(await n.e(2e3).then(n.bind(n,2e3))).javascript({jsx:!0,typescript:!0})},{name:"TypeScript",displayName:s.__("TypeScript"),alias:["ts"],mime:"application/typescript",extensions:["ts"],load:async()=>(await n.e(2e3).then(n.bind(n,2e3))).javascript({typescript:!0})},{name:"WebAssembly",displayName:s.__("WebAssembly"),mime:"text/webassembly",extensions:["wat","wast"],load:async()=>(await n.e(8665).then(n.bind(n,8665))).wast()},{name:"XML",displayName:s.__("XML"),alias:["rss","wsdl","xsd"],mime:["application/xml","text/xml"],extensions:["xml","xsl","xsd","svg"],load:async()=>(await n.e(3426).then(n.bind(n,3426))).xml()},{name:"APL",displayName:s.__("APL"),mime:"text/apl",extensions:["dyalog","apl"],load:async()=>t((await n.e(5351).then(n.bind(n,5351))).apl)},{name:"PGP",displayName:s.__("PGP"),alias:["asciiarmor"],mime:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],extensions:["asc","pgp","sig"],load:async()=>t((await n.e(6292).then(n.bind(n,6292))).asciiArmor)},{name:"ASN.1",displayName:s.__("ASN.1"),mime:"text/x-ttcn-asn",extensions:["asn","asn1"],load:async()=>t((await n.e(7727).then(n.bind(n,7727))).asn1({}))},{name:"Asterisk",displayName:s.__("Asterisk"),mime:"text/x-asterisk",filename:/^extensions\.conf$/i,load:async()=>t((await n.e(2682).then(n.bind(n,2682))).asterisk)},{name:"Brainfuck",displayName:s.__("Brainfuck"),mime:"text/x-brainfuck",extensions:["b","bf"],load:async()=>t((await n.e(8955).then(n.bind(n,8955))).brainfuck)},{name:"Cobol",displayName:s.__("Cobol"),mime:"text/x-cobol",extensions:["cob","cpy"],load:async()=>t((await n.e(5595).then(n.bind(n,5595))).cobol)},{name:"C#",displayName:s.__("C#"),alias:["csharp","cs"],mime:"text/x-csharp",extensions:["cs"],load:async()=>t((await n.e(3722).then(n.bind(n,3722))).csharp)},{name:"Clojure",displayName:s.__("Clojure"),mime:"text/x-clojure",extensions:["clj","cljc","cljx"],load:async()=>t((await n.e(3024).then(n.bind(n,3024))).clojure)},{name:"ClojureScript",displayName:s.__("ClojureScript"),mime:"text/x-clojurescript",extensions:["cljs"],load:async()=>t((await n.e(3024).then(n.bind(n,3024))).clojure)},{name:"Closure Stylesheets (GSS)",displayName:s.__("Closure Stylesheets (GSS)"),mime:"text/x-gss",extensions:["gss"],load:async()=>t((await n.e(5687).then(n.bind(n,5687))).gss)},{name:"CMake",displayName:s.__("CMake"),mime:"text/x-cmake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load:async()=>t((await n.e(7951).then(n.bind(n,7951))).cmake)},{name:"CoffeeScript",displayName:s.__("CoffeeScript"),alias:["coffee","coffee-script"],mime:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],extensions:["coffee"],load:async()=>t((await n.e(8137).then(n.bind(n,8137))).coffeeScript)},{name:"Common Lisp",displayName:s.__("Common Lisp"),alias:["lisp"],mime:"text/x-common-lisp",extensions:["cl","lisp","el"],load:async()=>t((await n.e(5455).then(n.bind(n,5455))).commonLisp)},{name:"Cypher",displayName:s.__("Cypher"),mime:"application/x-cypher-query",extensions:["cyp","cypher"],load:async()=>t((await n.e(4501).then(n.bind(n,4501))).cypher)},{name:"Cython",displayName:s.__("Cython"),mime:"text/x-cython",extensions:["pyx","pxd","pxi"],load:async()=>t((await n.e(5260).then(n.bind(n,5260))).cython)},{name:"Crystal",displayName:s.__("Crystal"),mime:"text/x-crystal",extensions:["cr"],load:async()=>t((await n.e(5258).then(n.bind(n,5258))).crystal)},{name:"D",displayName:s.__("D"),mime:"text/x-d",extensions:["d"],load:async()=>t((await n.e(4424).then(n.bind(n,4424))).d)},{name:"Dart",displayName:s.__("Dart"),mime:["application/dart","text/x-dart"],extensions:["dart"],load:async()=>t((await n.e(3722).then(n.bind(n,3722))).dart)},{name:"diff",displayName:s.__("diff"),mime:"text/x-diff",extensions:["diff","patch"],load:async()=>t((await n.e(8421).then(n.bind(n,8421))).diff)},{name:"Dockerfile",displayName:s.__("Dockerfile"),mime:"text/x-dockerfile",filename:/^Dockerfile$/,load:async()=>t((await n.e(6240).then(n.bind(n,6240))).dockerFile)},{name:"DTD",displayName:s.__("DTD"),mime:"application/xml-dtd",extensions:["dtd"],load:async()=>t((await n.e(4872).then(n.bind(n,4872))).dtd)},{name:"Dylan",displayName:s.__("Dylan"),mime:"text/x-dylan",extensions:["dylan","dyl","intr"],load:async()=>t((await n.e(8586).then(n.bind(n,8586))).dylan)},{name:"EBNF",displayName:s.__("EBNF"),mime:"text/x-ebnf",load:async()=>t((await n.e(1653).then(n.bind(n,1653))).ebnf)},{name:"ECL",displayName:s.__("ECL"),mime:"text/x-ecl",extensions:["ecl"],load:async()=>t((await n.e(8820).then(n.bind(n,8820))).ecl)},{name:"edn",displayName:s.__("edn"),mime:"application/edn",extensions:["edn"],load:async()=>t((await n.e(3024).then(n.bind(n,3024))).clojure)},{name:"Eiffel",displayName:s.__("Eiffel"),mime:"text/x-eiffel",extensions:["e"],load:async()=>t((await n.e(7077).then(n.bind(n,7077))).eiffel)},{name:"Elm",displayName:s.__("Elm"),mime:"text/x-elm",extensions:["elm"],load:async()=>t((await n.e(4704).then(n.bind(n,4704))).elm)},{name:"Erlang",displayName:s.__("Erlang"),mime:"text/x-erlang",extensions:["erl"],load:async()=>t((await n.e(29).then(n.bind(n,29))).erlang)},{name:"Esper",displayName:s.__("Esper"),mime:"text/x-esper",load:async()=>t((await n.e(6828).then(n.bind(n,6828))).esper)},{name:"Factor",displayName:s.__("Factor"),mime:"text/x-factor",extensions:["factor"],load:async()=>t((await n.e(5945).then(n.bind(n,5945))).factor)},{name:"FCL",displayName:s.__("FCL"),mime:"text/x-fcl",load:async()=>t((await n.e(2681).then(n.bind(n,2681))).fcl)},{name:"Forth",displayName:s.__("Forth"),mime:"text/x-forth",extensions:["forth","fth","4th"],load:async()=>t((await n.e(899).then(n.bind(n,899))).forth)},{name:"Fortran",displayName:s.__("Fortran"),mime:"text/x-fortran",extensions:["f","for","f77","f90","f95"],load:async()=>t((await n.e(6742).then(n.bind(n,6742))).fortran)},{name:"F#",displayName:s.__("F#"),alias:["fsharp"],mime:"text/x-fsharp",extensions:["fs"],load:async()=>t((await n.e(252).then(n.bind(n,252))).fSharp)},{name:"Gas",displayName:s.__("Gas"),mime:"text/x-gas",extensions:["s"],load:async()=>t((await n.e(2293).then(n.bind(n,2293))).gas)},{name:"Gherkin",displayName:s.__("Gherkin"),mime:"text/x-feature",extensions:["feature"],load:async()=>t((await n.e(8334).then(n.bind(n,8334))).gherkin)},{name:"Go",displayName:s.__("Go"),mime:"text/x-go",extensions:["go"],load:async()=>t((await n.e(1408).then(n.bind(n,1408))).go)},{name:"Groovy",displayName:s.__("Groovy"),mime:"text/x-groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load:async()=>t((await n.e(5292).then(n.bind(n,5292))).groovy)},{name:"Haskell",displayName:s.__("Haskell"),mime:"text/x-haskell",extensions:["hs"],load:async()=>t((await n.e(7220).then(n.bind(n,7220))).haskell)},{name:"Haxe",displayName:s.__("Haxe"),mime:"text/x-haxe",extensions:["hx"],load:async()=>t((await n.e(9602).then(n.bind(n,9602))).haxe)},{name:"HXML",displayName:s.__("HXML"),mime:"text/x-hxml",extensions:["hxml"],load:async()=>t((await n.e(9602).then(n.bind(n,9602))).hxml)},{name:"HTTP",displayName:s.__("HTTP"),mime:"message/http",load:async()=>t((await n.e(9638).then(n.bind(n,9638))).http)},{name:"IDL",displayName:s.__("IDL"),mime:"text/x-idl",extensions:["pro"],load:async()=>t((await n.e(4451).then(n.bind(n,4451))).idl)},{name:"JSON-LD",displayName:s.__("JSON-LD"),alias:["jsonld"],mime:"application/ld+json",extensions:["jsonld"],load:async()=>t((await n.e(7197).then(n.bind(n,7197))).jsonld)},{name:"Jinja2",displayName:s.__("Jinja2"),mime:"text/jinja2",extensions:["j2","jinja","jinja2"],load:async()=>t((await n.e(636).then(n.bind(n,636))).jinja2)},{name:"Julia",displayName:s.__("Julia"),mime:"text/x-julia",extensions:["jl"],load:async()=>t((await n.e(5525).then(n.bind(n,5525))).julia)},{name:"Kotlin",displayName:s.__("Kotlin"),mime:"text/x-kotlin",extensions:["kt"],load:async()=>t((await n.e(3722).then(n.bind(n,3722))).kotlin)},{name:"LESS",displayName:s.__("LESS"),mime:"text/x-less",extensions:["less"],load:async()=>t((await n.e(5687).then(n.bind(n,5687))).less)},{name:"LiveScript",displayName:s.__("LiveScript"),alias:["ls"],mime:"text/x-livescript",extensions:["ls"],load:async()=>t((await n.e(7911).then(n.bind(n,7911))).liveScript)},{name:"Lua",displayName:s.__("Lua"),mime:"text/x-lua",extensions:["lua"],load:async()=>t((await n.e(6162).then(n.bind(n,6162))).lua)},{name:"mIRC",displayName:s.__("mIRC"),mime:"text/mirc",load:async()=>t((await n.e(567).then(n.bind(n,567))).mirc)},{name:"Mathematica",displayName:s.__("Mathematica"),mime:"text/x-mathematica",extensions:["m","nb","wl","wls"],load:async()=>t((await n.e(1524).then(n.bind(n,1524))).mathematica)},{name:"Modelica",displayName:s.__("Modelica"),mime:"text/x-modelica",extensions:["mo"],load:async()=>t((await n.e(8678).then(n.bind(n,8678))).modelica)},{name:"MUMPS",displayName:s.__("MUMPS"),mime:"text/x-mumps",extensions:["mps"],load:async()=>t((await n.e(560).then(n.bind(n,560))).mumps)},{name:"mbox",displayName:s.__("mbox"),mime:"application/mbox",extensions:["mbox"],load:async()=>t((await n.e(9114).then(n.bind(n,9114))).mbox)},{name:"Nginx",displayName:s.__("Nginx"),mime:"text/x-nginx-conf",filename:/nginx.*\.conf$/i,load:async()=>t((await n.e(3180).then(n.bind(n,3180))).nginx)},{name:"NSIS",displayName:s.__("NSIS"),mime:"text/x-nsis",extensions:["nsh","nsi"],load:async()=>t((await n.e(357).then(n.bind(n,357))).nsis)},{name:"NTriples",displayName:s.__("NTriples"),mime:["application/n-triples","application/n-quads","text/n-triples"],extensions:["nt","nq"],load:async()=>t((await n.e(1001).then(n.bind(n,1001))).ntriples)},{name:"Objective-C",displayName:s.__("Objective-C"),alias:["objective-c","objc"],mime:"text/x-objectivec",extensions:["m"],load:async()=>t((await n.e(3722).then(n.bind(n,3722))).objectiveC)},{name:"Objective-C++",displayName:s.__("Objective-C++"),alias:["objective-c++","objc++"],mime:"text/x-objectivec++",extensions:["mm"],load:async()=>t((await n.e(3722).then(n.bind(n,3722))).objectiveCpp)},{name:"OCaml",displayName:s.__("OCaml"),mime:"text/x-ocaml",extensions:["ml","mli","mll","mly"],load:async()=>t((await n.e(252).then(n.bind(n,252))).oCaml)},{name:"Octave",displayName:s.__("Octave"),mime:"text/x-octave",extensions:["m"],load:async()=>t((await n.e(7486).then(n.bind(n,7486))).octave)},{name:"Oz",displayName:s.__("Oz"),mime:"text/x-oz",extensions:["oz"],load:async()=>t((await n.e(8539).then(n.bind(n,8539))).oz)},{name:"Pascal",displayName:s.__("Pascal"),mime:"text/x-pascal",extensions:["p","pas"],load:async()=>t((await n.e(1374).then(n.bind(n,1374))).pascal)},{name:"Perl",displayName:s.__("Perl"),mime:"text/x-perl",extensions:["pl","pm"],load:async()=>t((await n.e(3191).then(n.bind(n,3191))).perl)},{name:"Pig",displayName:s.__("Pig"),mime:"text/x-pig",extensions:["pig"],load:async()=>t((await n.e(8188).then(n.bind(n,8188))).pig)},{name:"PowerShell",displayName:s.__("PowerShell"),mime:"application/x-powershell",extensions:["ps1","psd1","psm1"],load:async()=>t((await n.e(8727).then(n.bind(n,8727))).powerShell)},{name:"Properties files",displayName:s.__("Properties files"),alias:["ini","properties"],mime:"text/x-properties",extensions:["properties","ini","in"],load:async()=>t((await n.e(6099).then(n.bind(n,6099))).properties)},{name:"ProtoBuf",displayName:s.__("ProtoBuf"),mime:"text/x-protobuf",extensions:["proto"],load:async()=>t((await n.e(6473).then(n.bind(n,6473))).protobuf)},{name:"Puppet",displayName:s.__("Puppet"),mime:"text/x-puppet",extensions:["pp"],load:async()=>t((await n.e(7364).then(n.bind(n,7364))).puppet)},{name:"Q",displayName:s.__("Q"),mime:"text/x-q",extensions:["q"],load:async()=>t((await n.e(5515).then(n.bind(n,5515))).q)},{name:"R",displayName:s.__("R"),alias:["rscript"],mime:"text/x-rsrc",extensions:["r","R"],load:async()=>t((await n.e(7838).then(n.bind(n,7838))).r)},{name:"RPM Changes",displayName:s.__("RPM Changes"),mime:"text/x-rpm-changes",load:async()=>t((await n.e(4401).then(n.bind(n,6782))).rpmChanges)},{name:"RPM Spec",displayName:s.__("RPM Spec"),mime:"text/x-rpm-spec",extensions:["spec"],load:async()=>t((await n.e(4401).then(n.bind(n,6782))).rpmSpec)},{name:"Ruby",displayName:s.__("Ruby"),alias:["jruby","macruby","rake","rb","rbx"],mime:"text/x-ruby",extensions:["rb"],load:async()=>t((await n.e(5350).then(n.bind(n,5350))).ruby)},{name:"SAS",displayName:s.__("SAS"),mime:"text/x-sas",extensions:["sas"],load:async()=>t((await n.e(1553).then(n.bind(n,1553))).sas)},{name:"Scala",displayName:s.__("Scala"),mime:"text/x-scala",extensions:["scala"],load:async()=>t((await n.e(3722).then(n.bind(n,3722))).scala)},{name:"Scheme",displayName:s.__("Scheme"),mime:"text/x-scheme",extensions:["scm","ss"],load:async()=>t((await n.e(1405).then(n.bind(n,1405))).scheme)},{name:"SCSS",displayName:s.__("SCSS"),mime:"text/x-scss",extensions:["scss"],load:async()=>t((await n.e(5687).then(n.bind(n,5687))).sCSS)},{name:"Shell",displayName:s.__("Shell"),alias:["bash","sh","zsh"],mime:["text/x-sh","application/x-sh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load:async()=>t((await n.e(4922).then(n.bind(n,4922))).shell)},{name:"Sieve",displayName:s.__("Sieve"),mime:"application/sieve",extensions:["siv","sieve"],load:async()=>t((await n.e(1066).then(n.bind(n,1066))).sieve)},{name:"Smalltalk",displayName:s.__("Smalltalk"),mime:"text/x-stsrc",extensions:["st"],load:async()=>t((await n.e(9981).then(n.bind(n,9981))).smalltalk)},{name:"Solr",displayName:s.__("Solr"),mime:"text/x-solr",load:async()=>t((await n.e(5106).then(n.bind(n,5106))).solr)},{name:"SML",displayName:s.__("SML"),mime:"text/x-sml",extensions:["sml","sig","fun","smackspec"],load:async()=>t((await n.e(252).then(n.bind(n,252))).sml)},{name:"SPARQL",displayName:s.__("SPARQL"),alias:["sparul"],mime:"application/sparql-query",extensions:["rq","sparql"],load:async()=>t((await n.e(8391).then(n.bind(n,8391))).sparql)},{name:"Spreadsheet",displayName:s.__("Spreadsheet"),alias:["excel","formula"],mime:"text/x-spreadsheet",load:async()=>t((await n.e(786).then(n.bind(n,786))).spreadsheet)},{name:"Squirrel",displayName:s.__("Squirrel"),mime:"text/x-squirrel",extensions:["nut"],load:async()=>t((await n.e(3722).then(n.bind(n,3722))).squirrel)},{name:"Stylus",displayName:s.__("Stylus"),mime:"text/x-styl",extensions:["styl"],load:async()=>t((await n.e(4756).then(n.bind(n,4756))).stylus)},{name:"Swift",displayName:s.__("Swift"),mime:"text/x-swift",extensions:["swift"],load:async()=>t((await n.e(647).then(n.bind(n,647))).swift)},{name:"sTeX",displayName:s.__("sTeX"),mime:"text/x-stex",load:async()=>t((await n.e(3220).then(n.bind(n,3220))).stex)},{name:"LaTeX",displayName:s.__("LaTeX"),alias:["tex"],mime:"text/x-latex",extensions:["text","ltx","tex"],load:async()=>t((await n.e(3220).then(n.bind(n,3220))).stex)},{name:"SystemVerilog",displayName:s.__("SystemVerilog"),mime:"text/x-systemverilog",extensions:["v","sv","svh"],load:async()=>t((await n.e(7230).then(n.bind(n,7230))).verilog)},{name:"Tcl",displayName:s.__("Tcl"),mime:"text/x-tcl",extensions:["tcl"],load:async()=>t((await n.e(6643).then(n.bind(n,6643))).tcl)},{name:"Textile",displayName:s.__("Textile"),mime:"text/x-textile",extensions:["textile"],load:async()=>t((await n.e(6205).then(n.bind(n,6205))).textile)},{name:"TiddlyWiki",displayName:s.__("TiddlyWiki"),mime:"text/x-tiddlywiki",load:async()=>t((await n.e(8122).then(n.bind(n,8122))).tiddlyWiki)},{name:"Tiki wiki",displayName:s.__("Tiki wiki"),mime:"text/tiki",load:async()=>t((await n.e(3805).then(n.bind(n,3805))).tiki)},{name:"TOML",displayName:s.__("TOML"),mime:"text/x-toml",extensions:["toml"],load:async()=>t((await n.e(950).then(n.bind(n,950))).toml)},{name:"troff",displayName:s.__("troff"),mime:"text/troff",extensions:["1","2","3","4","5","6","7","8","9"],load:async()=>t((await n.e(615).then(n.bind(n,615))).troff)},{name:"TTCN",displayName:s.__("TTCN"),mime:"text/x-ttcn",extensions:["ttcn","ttcn3","ttcnpp"],load:async()=>t((await n.e(9779).then(n.bind(n,9779))).ttcn)},{name:"TTCN_CFG",displayName:s.__("TTCN_CFG"),mime:"text/x-ttcn-cfg",extensions:["cfg"],load:async()=>t((await n.e(132).then(n.bind(n,132))).ttcnCfg)},{name:"Turtle",displayName:s.__("Turtle"),mime:"text/turtle",extensions:["ttl"],load:async()=>t((await n.e(9684).then(n.bind(n,9684))).turtle)},{name:"Web IDL",displayName:s.__("Web IDL"),mime:"text/x-webidl",extensions:["webidl"],load:async()=>t((await n.e(1911).then(n.bind(n,1911))).webIDL)},{name:"VB.NET",displayName:s.__("VB.NET"),mime:"text/x-vb",extensions:["vb"],load:async()=>t((await n.e(5298).then(n.bind(n,5298))).vb)},{name:"VBScript",displayName:s.__("VBScript"),mime:"text/vbscript",extensions:["vbs"],load:async()=>t((await n.e(9865).then(n.bind(n,9865))).vbScript)},{name:"Velocity",displayName:s.__("Velocity"),mime:"text/velocity",extensions:["vtl"],load:async()=>t((await n.e(4957).then(n.bind(n,4957))).velocity)},{name:"Verilog",displayName:s.__("Verilog"),mime:"text/x-verilog",extensions:["v"],load:async()=>t((await n.e(7230).then(n.bind(n,7230))).verilog)},{name:"VHDL",displayName:s.__("VHDL"),mime:"text/x-vhdl",extensions:["vhd","vhdl"],load:async()=>t((await n.e(1560).then(n.bind(n,1560))).vhdl)},{name:"XQuery",displayName:s.__("XQuery"),mime:"application/xquery",extensions:["xy","xquery"],load:async()=>t((await n.e(6590).then(n.bind(n,6590))).xQuery)},{name:"Yacas",displayName:s.__("Yacas"),mime:"text/x-yacas",extensions:["ys"],load:async()=>t((await n.e(6211).then(n.bind(n,6211))).yacas)},{name:"YAML",displayName:s.__("YAML"),alias:["yml"],mime:["text/x-yaml","text/yaml"],extensions:["yaml","yml"],load:async()=>t((await n.e(9561).then(n.bind(n,9561))).yaml)},{name:"Z80",displayName:s.__("Z80"),mime:"text/x-z80",extensions:["z80"],load:async()=>t((await n.e(822).then(n.bind(n,822))).z80)},{name:"mscgen",displayName:s.__("mscgen"),mime:"text/x-mscgen",extensions:["mscgen","mscin","msc"],load:async()=>t((await n.e(9371).then(n.bind(n,9371))).mscgen)},{name:"xu",displayName:s.__("xu"),mime:"text/x-xu",extensions:["xu"],load:async()=>t((await n.e(9371).then(n.bind(n,9371))).xu)},{name:"msgenny",displayName:s.__("msgenny"),mime:"text/x-msgenny",extensions:["msgenny"],load:async()=>t((await n.e(9371).then(n.bind(n,9371))).msgenny)}]}}(Ps||(Ps={})),function(e){e.createEditor=function(e,t,n,r){const o=t.getInitialExtensions();return o.push(...n),new s.Lz({state:i.$t.create({doc:r,extensions:o}),parent:e})}}(Rs||(Rs={})),function(e){e.findNext=function(e,t,n=0,i=1/0){for(i=Math.min(e.length-1,i);n<=i;){let s=Math.floor(.5*(n+i));const r=e[s].position;if(rt)return n}else{if(!(r>t))return s;if((i=s-1)>0&&e[i].position0?n-1:0;return e[s].position>=t?s:null}}(js||(js={})),new Ce.Token("@jupyterlab/codemirror:IEditorExtensionRegistry","A registry for CodeMirror extension factories."),new Ce.Token("@jupyterlab/codemirror:IEditorLanguageRegistry","A registry for CodeMirror languages."),new Ce.Token("@jupyterlab/codemirror:IEditorThemeRegistry","A registry for CodeMirror theme.");var Is,Ls,Bs=n(4041),Fs=n(1412),zs=n(6823);function $s(...e){return function(e){return e.map((e=>e&&"object"==typeof e?Object.keys(e).map((t=>!!e[t]&&t)):"string"==typeof e?e.split(/\s+/):[])).reduce(((e,t)=>e.concat(t)),[]).filter((e=>!!e))}(e).join(" ")}!function(e){const t={breadCrumb:{container:{$nest:{"&:first-child svg":{bottom:"1px",marginLeft:"0px",position:"relative"},"&:hover":{backgroundColor:"var(--jp-layout-color2)"},".jp-mod-dropTarget&":{backgroundColor:"var(--jp-brand-color2)",opacity:.7}}},element:{borderRadius:"var(--jp-border-radius)",cursor:"pointer",margin:"0px 2px",padding:"0px 2px",height:"16px",width:"16px",verticalAlign:"middle"}},commandPaletteHeader:{container:{height:"14px",margin:"0 14px 0 auto"},element:{height:"14px",width:"14px"},options:{elementPosition:"center"}},commandPaletteItem:{element:{height:"16px",width:"16px"},options:{elementPosition:"center"}},launcherCard:{container:{height:"52px",width:"52px"},element:{height:"52px",width:"52px"},options:{elementPosition:"center"}},launcherSection:{container:{boxSizing:"border-box",marginRight:"12px",height:"32px",width:"32px"},element:{height:"32px",width:"32px"},options:{elementPosition:"center"}},listing:{container:{flex:"0 0 20px",marginRight:"4px",position:"relative"},element:{height:"16px",width:"16px"},options:{elementPosition:"center"}},listingHeaderItem:{container:{display:"inline",height:"16px",width:"16px"},element:{height:"auto",margin:"-2px 0 0 0",width:"20px"},options:{elementPosition:"center"}},mainAreaTab:{container:{$nest:{".lm-DockPanel-tabBar &":{marginRight:"4px"}}},element:{$nest:{".lm-DockPanel-tabBar &":{height:"14px",width:"14px"}}},options:{elementPosition:"center"}},menuItem:{container:{display:"inline-block",verticalAlign:"middle"},element:{height:"16px",width:"16px"},options:{elementPosition:"center"}},runningItem:{container:{margin:"0px 4px 0px 4px"},element:{height:"16px",width:"16px"},options:{elementPosition:"center"}},select:{container:{pointerEvents:"none"},element:{position:"absolute",height:"auto",width:"16px"}},settingsEditor:{container:{display:"flex",flex:"0 0 20px",margin:"0 3px 0 0",position:"relative",height:"20px",width:"20px"},element:{height:"16px",width:"16px"},options:{elementPosition:"center"}},sideBar:{element:{height:"auto",width:"20px"},options:{elementPosition:"center"}},splash:{container:{animation:"0.3s fade-in linear forwards",height:"100%",width:"100%",zIndex:1},element:{width:"100px"},options:{elementPosition:"center"}},statusBar:{element:{left:"0px",top:"0px",height:"18px",width:"20px",position:"relative"}},toolbarButton:{container:{display:"inline-block",verticalAlign:"middle"},element:{height:"16px",width:"16px"},options:{elementPosition:"center"}}};function n(e){return{container:{alignItems:"center",display:"flex"},element:{display:"block",...e}}}const i={center:n({margin:"0 auto",width:"100%"}),top:n({margin:"0 0 auto 0"}),right:n({margin:"0 0 0 auto"}),bottom:n({margin:"auto 0 0 0"}),left:n({margin:"0 auto 0 0"}),"top right":n({margin:"0 0 auto auto"}),"bottom right":n({margin:"auto 0 0 auto"}),"bottom left":n({margin:"auto auto 0 0"}),"top left":n({margin:"0 auto 0 auto"})};function s(e){return{element:{height:e,width:e}}}const r={small:s("14px"),normal:s("16px"),large:s("20px"),xlarge:s("24px")};const o=new Map;e.styleClass=function(e){if(!e||0===Object.keys(e).length)return"";let{elementPosition:n,elementSize:s,stylesheet:a,...l}=e;const h={...n&&{elementPosition:n},...s&&{elementSize:s}},c="string"==typeof a&&0===Object.keys(l).length,u=c?[a,n,s].join(","):"";if(c&&o.has(u))return o.get(u);const f=function(e){return e?(Array.isArray(e)||(e=[e]),e.map((e=>"string"==typeof e?t[e]:e))):[]}(a);f.push({element:l,options:h});const d=function(e){var t;return(0,zs.iF)({...e.container,$nest:{...null===(t=e.container)||void 0===t?void 0:t.$nest,svg:e.element}})}(function(e){const t=Object.assign({},...e.map((e=>e.options)));return t.elementPosition&&e.unshift(i[t.elementPosition]),t.elementSize&&e.unshift(r[t.elementSize]),function(e){return{container:Object.assign({},...e.map((e=>e.container))),element:Object.assign({},...e.map((e=>e.element)))}}(e)}(f));return c&&o.set(u,d),d}}(Is||(Is={}));class Hs{static remove(e){for(;e.firstChild;)e.firstChild.remove();return e.className="",e}static resolve({icon:e}){if(e instanceof Hs)return e;if("string"==typeof e){return Hs._instances.get(e)||(Hs._debug&&console.warn(`Lookup failed for icon, creating loading icon. icon: ${e}`),new Hs({name:e,svgstr:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgdmlld0JveD0iMCAwIDE4IDE4Ij4KICAgIDxnIGNsYXNzPSJqcC1pY29uMyIgZmlsbD0iIzYxNjE2MSI+CiAgICAgICAgPHBhdGggZD0iTTkgMTMuNWMtMi40OSAwLTQuNS0yLjAxLTQuNS00LjVTNi41MSA0LjUgOSA0LjVjMS4yNCAwIDIuMzYuNTIgMy4xNyAxLjMzTDEwIDhoNVYzbC0xLjc2IDEuNzZDMTIuMTUgMy42OCAxMC42NiAzIDkgMyA1LjY5IDMgMy4wMSA1LjY5IDMuMDEgOVM1LjY5IDE1IDkgMTVjMi45NyAwIDUuNDMtMi4xNiA1LjktNWgtMS41MmMtLjQ2IDItMi4yNCAzLjUtNC4zOCAzLjV6Ii8+CiAgICA8L2c+Cjwvc3ZnPgo=",_loading:!0}))}return new Hs(e)}static resolveElement({icon:e,iconClass:t,fallback:n,...i}){return Ls.isResolvable(e)?Hs.resolve({icon:e}).element(i):!t&&n?n.element(i):(i.className=$s(t,i.className),Ls.blankElement(i))}static resolveReact({icon:e,iconClass:t,fallback:n,...i}){if(!Ls.isResolvable(e))return!t&&n?Bs.createElement(n.react,{...i}):(i.className=$s(t,i.className),Bs.createElement(Ls.blankReact,{...i}));const s=Hs.resolve({icon:e});return Bs.createElement(s.react,{...i})}static resolveSvg({name:e,svgstr:t}){const n=(new DOMParser).parseFromString(Ls.svgstrShim(t),"image/svg+xml"),i=n.querySelector("parsererror");if(i){const n=`SVG HTML was malformed for LabIcon instance.\nname: ${e}, svgstr: ${t}`;return Hs._debug?(console.error(n),i):(console.warn(n),null)}return n.documentElement}static toggleDebug(e){Hs._debug=null!=e?e:!Hs._debug}constructor({name:e,svgstr:t,render:n,unrender:i,_loading:s=!1}){if(this._props={},this._svgReplaced=new Me.Signal(this),this._svgElement=void 0,this._svgInnerHTML=void 0,this._svgReactAttrs=void 0,!e||!t)return console.error(`When defining a new LabIcon, name and svgstr must both be non-empty strings. name: ${e}, svgstr: ${t}`),qs;if(this._loading=s,Hs._instances.has(e)){const n=Hs._instances.get(e);return this._loading?(n.svgstr=t,this._loading=!1,n):(Hs._debug&&console.warn(`Redefining previously loaded icon svgstr. name: ${e}, svgstrOld: ${n.svgstr}, svgstr: ${t}`),n.svgstr=t,n)}this.name=e,this.react=this._initReact(e),this.svgstr=t,this._initRender({render:n,unrender:i}),Hs._instances.set(this.name,this)}bindprops(e){const t=Object.create(this);return t._props=e,t.react=t._initReact(t.name+"_bind"),t}element(e={}){var t;let{className:n,container:i,label:s,title:r,tag:o="div",...a}={...this._props,...e};const l=null==i?void 0:i.firstChild;if((null===(t=null==l?void 0:l.dataset)||void 0===t?void 0:t.iconId)===this._uuid)return l;if(!this.svgElement)return document.createElement("div");if(i)for(;i.firstChild;)i.firstChild.remove();else o&&(i=document.createElement(o));const h=this.svgElement.cloneNode(!0);return i?(null!=s&&(i.textContent=s),Ls.initContainer({container:i,className:n,styleProps:a,title:r}),i.appendChild(h),i):(s&&console.warn(),h)}render(e,t){var n;let i=null===(n=null==t?void 0:t.children)||void 0===n?void 0:n[0];"string"!=typeof i&&(i=void 0),this.element({container:e,label:i,...null==t?void 0:t.props})}get svgElement(){return void 0===this._svgElement&&(this._svgElement=this._initSvg({uuid:this._uuid})),this._svgElement}get svgInnerHTML(){return void 0===this._svgInnerHTML&&(null===this.svgElement?this._svgInnerHTML=null:this._svgInnerHTML=this.svgElement.innerHTML),this._svgInnerHTML}get svgReactAttrs(){return void 0===this._svgReactAttrs&&(null===this.svgElement?this._svgReactAttrs=null:this._svgReactAttrs=function(e,{ignore:t=[]}={}){return e.getAttributeNames().reduce(((n,i)=>("style"===i||t.includes(i)||(i.startsWith("data")?n[i]=e.getAttribute(i):n[zt.Text.camelCase(i)]=e.getAttribute(i)),n)),{})}(this.svgElement,{ignore:["data-icon-id"]})),this._svgReactAttrs}get svgstr(){return this._svgstr}set svgstr(e){this._svgstr=e;const t=Ce.UUID.uuid4(),n=this._uuid;this._uuid=t,this._svgElement=void 0,this._svgInnerHTML=void 0,this._svgReactAttrs=void 0,document.querySelectorAll(`[data-icon-id="${n}"]`).forEach((e=>{this.svgElement&&e.replaceWith(this.svgElement.cloneNode(!0))})),this._svgReplaced.emit()}_initReact(e){const t=Bs.forwardRef(((e={},t)=>{const{className:n,container:i,label:s,title:r,slot:o,tag:a="div",...l}={...this._props,...e},[,h]=Bs.useState(this._uuid);Bs.useEffect((()=>{const e=()=>{h(this._uuid)};return this._svgReplaced.connect(e),()=>{this._svgReplaced.disconnect(e)}}));const c=null!=a?a:Bs.Fragment;if(!this.svgInnerHTML||!this.svgReactAttrs)return Bs.createElement(Bs.Fragment,null);const u={...this.svgReactAttrs};a||Object.assign(u,{className:n||l?$s(n,Is.styleClass(l)):void 0,title:r,slot:o});const f=Bs.createElement("svg",{...u,...this.svgReactAttrs,dangerouslySetInnerHTML:{__html:this.svgInnerHTML},ref:t});if(i)return Ls.initContainer({container:i,className:n,styleProps:l,title:r}),Bs.createElement(Bs.Fragment,null,f,s);{let e={};return c!==Bs.Fragment&&(e={className:n||l?$s(n,Is.styleClass(l)):void 0,title:r,slot:o}),Bs.createElement(c,{...e},f,s)}}));return t.displayName=`LabIcon_${e}`,t}_initRender({render:e,unrender:t}){e?(this.render=e,t&&(this.unrender=t)):t&&console.warn("In _initRender, ignoring unrender arg since render is undefined")}_initSvg({title:e,uuid:t}={}){const n=Hs.resolveSvg(this);return n?("parsererror"!==n.tagName&&(n.dataset.icon=this.name,t&&(n.dataset.iconId=t),e&&Ls.setTitleSvg(n,e)),n):n}}Hs._debug=!1,Hs._instances=new Map,function(e){function t({container:e,className:t,styleProps:n,title:i}){null!=i&&(e.title=i);const s=Is.styleClass(n);if(null!=t){const n=$s(t,s);return e.className=n,n}return s?(e.classList.add(s),s):""}e.blankElement=function({className:t="",container:n,label:i,title:s,tag:r="div",slot:o,...a}){if((null==n?void 0:n.className)===t)return n;if(n)for(;n.firstChild;)n.firstChild.remove();else n=document.createElement(null!=r?r:"div");return null!=i&&(n.textContent=i),e.initContainer({container:n,className:t,styleProps:a,title:s}),n},e.blankReact=Bs.forwardRef((({className:e="",container:n,label:i,title:s,tag:r="div",...o},a)=>{const l=null!=r?r:"div";return n?(t({container:n,className:e,styleProps:o,title:s}),Bs.createElement(Bs.Fragment,null)):Bs.createElement(l,{className:$s(e,Is.styleClass(o))},a&&Vs.react({ref:a}),i)})),e.blankReact.displayName="BlankReact",e.initContainer=t,e.isResolvable=function(e){return!(!e||!("string"==typeof e||e.name&&e.svgstr))},e.setTitleSvg=function(e,t){const n=e.getElementsByTagName("title");if(n.length)n[0].textContent=t;else{const n=document.createElement("title");n.textContent=t,e.appendChild(n)}},e.svgstrShim=function(e,t=!0){const[,n,i]=decodeURIComponent(e).replace(/>\s*\n\s*<").replace(/\s*\n\s*/g," ").match(t?/^(?:data:.*?(;base64)?,)?(.*)/:/(?:(base64).*)?(3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0;if("Object"===e){let e=Object.getOwnPropertyNames(t);n&&e.sort(!0===n?void 0:n),e=e.slice(s,r+1),i={entries:e.map((e=>({key:e,value:t[e]})))}}else if("Array"===e)i={entries:t.slice(s,r+1).map(((e,t)=>({key:t+s,value:e})))};else{let e=0;const n=[];let o=!0;const a=function(e){return"function"==typeof e.set}(t);for(const i of t){if(e>r){o=!1;break}s<=e&&(a&&Array.isArray(i)?"string"==typeof i[0]||"number"==typeof i[0]?n.push({key:i[0],value:i[1]}):n.push({key:`[entry ${e}]`,value:{"[key]":i[0],"[value]":i[1]}}):n.push({key:e,value:i})),e++}i={hasMore:!o,entries:n}}return i}function Xs(e,t,n){const i=[];for(;t-e>n*n;)n*=n;for(let s=e;s<=t;s+=n)i.push({from:s,to:Math.min(t,s+n-1)});return i}function Zs(e,t,n,i){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1/0;const o=Js.bind(null,e,t,n);if(!i)return o().entries;const a=r<1/0,l=Math.min(r-s,function(e,t){return"Object"===e?Object.keys(t).length:"Array"===e?t.length:1/0}(e,t));if("Iterable"!==e){if(l<=i||i<7)return o(s,r).entries}else if(l<=i&&!a)return o(s,r).entries;let h;if("Iterable"===e){const{hasMore:e,entries:t}=o(s,s+i-1);h=e?[...t,...Xs(s+i,s+2*i-1,i)]:t}else h=a?Xs(s,r,i):[...o(0,i-5).entries,...Xs(i-4,l-5,i),...o(l-4,l-1).entries];return h}function Qs(e){const{styling:t,from:n,to:i,renderChildNodes:s,nodeType:r}=e,[o,a]=(0,Bs.useState)(!1),l=(0,Bs.useCallback)((()=>{a(!o)}),[o]);return o?Bs.createElement("div",t("itemRange",o),s(e,n,i)):Bs.createElement("div",Ks({},t("itemRange",o),{onClick:l}),Bs.createElement(Ys,{nodeType:r,styling:t,expanded:!1,onClick:l,arrowStyle:"double"}),`${n} ... ${i}`)}function er(e,t,n){const{nodeType:i,data:s,collectionLimit:r,circularCache:o,keyPath:a,postprocessValue:l,sortObjectKeys:h}=e,c=[];return Zs(i,s,h,r,t,n).forEach((t=>{if(void 0!==t.to)c.push(Bs.createElement(Qs,Ks({},e,{key:`ItemRange--${t.from}-${t.to}`,from:t.from,to:t.to,renderChildNodes:er})));else{const{key:n,value:i}=t,s=-1!==o.indexOf(i);c.push(Bs.createElement(hr,Ks({},e,{postprocessValue:l,collectionLimit:r,key:`Node--${n}`,keyPath:[n,...a],value:l(i),circularCache:[...o,i],isCircular:s,hideRoot:!1})))}})),c}function tr(e){const{circularCache:t=[],collectionLimit:n,createItemString:i,data:s,expandable:r,getItemString:o,hideRoot:a,isCircular:l,keyPath:h,labelRenderer:c,level:u=0,nodeType:f,nodeTypeIndicator:d,shouldExpandNodeInitially:p,styling:m}=e,[g,b]=(0,Bs.useState)(!l&&p(h,s,u)),y=(0,Bs.useCallback)((()=>{r&&b(!g)}),[r,g]),v=g||a&&0===u?er({...e,circularCache:t,level:u+1}):null,x=o(f,s,Bs.createElement("span",m("nestedNodeItemType",g),d),i(s,n),h),w=[h,f,g,r];return a?Bs.createElement("li",m("rootNode",...w),Bs.createElement("ul",m("rootNodeChildren",...w),v)):Bs.createElement("li",m("nestedNode",...w),r&&Bs.createElement(Ys,{styling:m,nodeType:f,expanded:g,onClick:y}),Bs.createElement("label",Ks({},m(["label","nestedNodeLabel"],...w),{onClick:y}),c(...w)),Bs.createElement("span",Ks({},m("nestedNodeItemString",...w),{onClick:y}),x),Bs.createElement("ul",m("nestedNodeChildren",...w),v))}function nr(e){const t=Object.getOwnPropertyNames(e).length;return`${t} ${1!==t?"keys":"key"}`}function ir(e){let{data:t,...n}=e;return Bs.createElement(tr,Ks({},n,{data:t,nodeType:"Object",nodeTypeIndicator:"Error"===n.nodeType?"Error()":"{}",createItemString:nr,expandable:Object.getOwnPropertyNames(t).length>0}))}function sr(e){return`${e.length} ${1!==e.length?"items":"item"}`}function rr(e){let{data:t,...n}=e;return Bs.createElement(tr,Ks({},n,{data:t,nodeType:"Array",nodeTypeIndicator:"[]",createItemString:sr,expandable:t.length>0}))}function or(e,t){let n=0,i=!1;if(Number.isSafeInteger(e.size))n=e.size;else for(const s of e){if(t&&n+1>t){i=!0;break}n+=1}return`${i?">":""}${n} ${1!==n?"entries":"entry"}`}function ar(e){return Bs.createElement(tr,Ks({},e,{nodeType:"Iterable",nodeTypeIndicator:"()",createItemString:or,expandable:!0}))}function lr(e){let{nodeType:t,styling:n,labelRenderer:i,keyPath:s,valueRenderer:r,value:o,valueGetter:a=e=>e}=e;return Bs.createElement("li",n("value",t,s),Bs.createElement("label",n(["label","valueLabel"],t,s),i(s,t,!1,!1)),Bs.createElement("span",n("valueText",t,s),r(a(o),o,...s)))}function hr(e){let{getItemString:t,keyPath:n,labelRenderer:i,styling:s,value:r,valueRenderer:o,isCustomNode:a,...l}=e;const h=a(r)?"Custom":function(e){const t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&"function"==typeof e[Symbol.iterator]?"Iterable":"Custom"===t&&e.constructor!==Object&&e instanceof Object?"Object":t}(r),c={getItemString:t,key:n[0],keyPath:n,labelRenderer:i,nodeType:h,styling:s,value:r,valueRenderer:o},u={...l,...c,data:r,isCustomNode:a};switch(h){case"Object":case"Error":case"WeakMap":case"WeakSet":return Bs.createElement(ir,u);case"Array":return Bs.createElement(rr,u);case"Iterable":case"Map":case"Set":return Bs.createElement(ar,u);case"String":return Bs.createElement(lr,Ks({},c,{valueGetter:e=>`"${e}"`}));case"Number":case"Custom":return Bs.createElement(lr,c);case"Boolean":return Bs.createElement(lr,Ks({},c,{valueGetter:e=>e?"true":"false"}));case"Date":return Bs.createElement(lr,Ks({},c,{valueGetter:e=>e.toISOString()}));case"Null":return Bs.createElement(lr,Ks({},c,{valueGetter:()=>"null"}));case"Undefined":return Bs.createElement(lr,Ks({},c,{valueGetter:()=>"undefined"}));case"Function":case"Symbol":return Bs.createElement(lr,Ks({},c,{valueGetter:e=>e.toString()}));default:return Bs.createElement(lr,Ks({},c,{valueGetter:()=>`<${h}>`}))}}function cr(e){return cr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cr(e)}function ur(e){var t=function(e){if("object"!=cr(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=cr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==cr(t)?t:t+""}function fr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n2?n-2:0),s=2;s1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=t.defaultBase16,s=void 0===i?wr:i,r=t.base16Themes,o=_r(n,void 0===r?null:r);o&&(n=xr(xr({},o),n));for(var a=kr.reduce((function(e,t){return e[t]=n[t]||s[t],e}),{}),l=function(e,t){var n=Object.keys(t);for(var i in e)-1===n.indexOf(i)&&n.push(i);return n.reduce((function(n,i){return n[i]=function(e,t){if(void 0===e)return t;if(void 0===t)return e;var n=cr(e),i=cr(t);switch(n){case"string":switch(i){case"string":return[t,e].filter(Boolean).join(" ");case"object":return Sr({className:e,style:t});case"function":return function(n){for(var i=arguments.length,s=new Array(i>1?i-1:0),r=1;r1?i-1:0),r=1;r1?i-1:0),r=1;r1?i-1:0),r=1;r1?i-1:0),r=1;r3?h-3:0),u=3;u({String:e.STRING_COLOR,Date:e.DATE_COLOR,Number:e.NUMBER_COLOR,Boolean:e.BOOLEAN_COLOR,Null:e.NULL_COLOR,Undefined:e.UNDEFINED_COLOR,Function:e.FUNCTION_COLOR,Symbol:e.SYMBOL_COLOR}),Nr=Or((e=>{const t=(e=>({BACKGROUND_COLOR:e.base00,TEXT_COLOR:e.base07,STRING_COLOR:e.base0B,DATE_COLOR:e.base0B,NUMBER_COLOR:e.base09,BOOLEAN_COLOR:e.base09,NULL_COLOR:e.base08,UNDEFINED_COLOR:e.base08,FUNCTION_COLOR:e.base08,SYMBOL_COLOR:e.base08,LABEL_COLOR:e.base0D,ARROW_COLOR:e.base0D,ITEM_STRING_COLOR:e.base0B,ITEM_STRING_EXPANDED_COLOR:e.base03}))(e);return{tree:{border:0,padding:0,marginTop:"0.5em",marginBottom:"0.5em",marginLeft:"0.125em",marginRight:0,listStyle:"none",MozUserSelect:"none",WebkitUserSelect:"none",backgroundColor:t.BACKGROUND_COLOR},value:(e,t,n)=>{let{style:i}=e;return{style:{...i,paddingTop:"0.25em",paddingRight:0,marginLeft:"0.875em",WebkitUserSelect:"text",MozUserSelect:"text",wordWrap:"break-word",paddingLeft:n.length>1?"2.125em":"1.25em",textIndent:"-0.5em",wordBreak:"break-all"}}},label:{display:"inline-block",color:t.LABEL_COLOR},valueLabel:{margin:"0 0.5em 0 0"},valueText:(e,n)=>{let{style:i}=e;return{style:{...i,color:Tr(t)[n]}}},itemRange:(e,n)=>({style:{paddingTop:n?0:"0.25em",cursor:"pointer",color:t.LABEL_COLOR}}),arrow:(e,t,n)=>{let{style:i}=e;return{style:{...i,marginLeft:0,transition:"150ms",WebkitTransition:"150ms",MozTransition:"150ms",WebkitTransform:n?"rotateZ(90deg)":"rotateZ(0deg)",MozTransform:n?"rotateZ(90deg)":"rotateZ(0deg)",transform:n?"rotateZ(90deg)":"rotateZ(0deg)",transformOrigin:"45% 50%",WebkitTransformOrigin:"45% 50%",MozTransformOrigin:"45% 50%",position:"relative",lineHeight:"1.1em",fontSize:"0.75em"}}},arrowContainer:(e,t)=>{let{style:n}=e;return{style:{...n,display:"inline-block",paddingRight:"0.5em",paddingLeft:"double"===t?"1em":0,cursor:"pointer"}}},arrowSign:{color:t.ARROW_COLOR},arrowSignInner:{position:"absolute",top:0,left:"-0.4em"},nestedNode:(e,t,n,i,s)=>{let{style:r}=e;return{style:{...r,position:"relative",paddingTop:"0.25em",marginLeft:t.length>1?"0.875em":0,paddingLeft:s?0:"1.125em"}}},rootNode:{padding:0,margin:0},nestedNodeLabel:(e,t,n,i,s)=>{let{style:r}=e;return{style:{...r,margin:0,padding:0,WebkitUserSelect:s?"inherit":"text",MozUserSelect:s?"inherit":"text",cursor:s?"pointer":"default"}}},nestedNodeItemString:(e,n,i,s)=>{let{style:r}=e;return{style:{...r,paddingLeft:"0.5em",cursor:"default",color:s?t.ITEM_STRING_EXPANDED_COLOR:t.ITEM_STRING_COLOR}}},nestedNodeItemType:{marginLeft:"0.3em",marginRight:"0.3em"},nestedNodeChildren:(e,t,n)=>{let{style:i}=e;return{style:{...i,padding:0,margin:0,listStyle:"none",display:n?"block":"none"}}},rootNodeChildren:{padding:0,margin:0,listStyle:"none"}}}),{defaultBase16:{scheme:"solarized",author:"ethan schoonover (http://ethanschoonover.com/solarized)",base00:"#002b36",base01:"#073642",base02:"#586e75",base03:"#657b83",base04:"#839496",base05:"#93a1a1",base06:"#eee8d5",base07:"#fdf6e3",base08:"#dc322f",base09:"#cb4b16",base0A:"#b58900",base0B:"#859900",base0C:"#2aa198",base0D:"#268bd2",base0E:"#6c71c4",base0F:"#d33682"}}),Er=Nr,Dr=e=>e,Pr=(e,t,n)=>0===n,Rr=(e,t,n,i)=>Bs.createElement("span",null,n," ",i),jr=e=>{let[t]=e;return Bs.createElement("span",null,t,":")},Ir=()=>!1;function Lr(e){let{data:t,theme:n,invertTheme:i,keyPath:s=["root"],labelRenderer:r=jr,valueRenderer:o=Dr,shouldExpandNodeInitially:a=Pr,hideRoot:l=!1,getItemString:h=Rr,postprocessValue:c=Dr,isCustomNode:u=Ir,collectionLimit:f=50,sortObjectKeys:d=!1}=e;const p=(0,Bs.useMemo)((()=>Er(i?function(e){return"string"==typeof e?"".concat(e,":inverted"):e&&Mr(e)&&e.extend?"string"==typeof e.extend?xr(xr({},e),{},{extend:"".concat(e.extend,":inverted")}):xr(xr({},e),{},{extend:Ar(e.extend)}):e?Ar(e):e}(n):n)),[n,i]);return Bs.createElement("ul",p("tree"),Bs.createElement(hr,{keyPath:l?[]:s,value:c(t),isCustomNode:u,styling:p,labelRenderer:r,valueRenderer:o,shouldExpandNodeInitially:a,hideRoot:l,getItemString:h,postprocessValue:c,collectionLimit:f,sortObjectKeys:d}))}var Br=n(8104);function Fr(e){var t;return null!==(t=Ms.style([e]))&&void 0!==t?t:""}class zr extends Bs.Component{constructor(){super(...arguments),this.state={filter:"",value:""},this.timer=0,this.handleChange=e=>{const{value:t}=e.target;this.setState({value:t}),window.clearTimeout(this.timer),this.timer=window.setTimeout((()=>{this.setState({filter:t})}),300)}}componentDidMount(){Br.G.mount(document,Ms.module)}render(){const e=(this.props.translator||Te.wK).load("jupyterlab"),{data:t,metadata:n,forwardedRef:i}=this.props,s=n&&n.root?n.root:"root",r=this.state.filter?qr(t,this.state.filter,[s]):[s];return Bs.createElement("div",{className:"container",ref:i},Bs.createElement(Ws,{className:"filter",type:"text",placeholder:e.__("Find…"),onChange:this.handleChange,value:this.state.value,rightIcon:"ui-components:search"}),Bs.createElement(Lr,{data:t,collectionLimit:100,theme:{extend:$r,valueLabel:Fr(De._A.variableName),valueText:Fr(De._A.string),nestedNodeItemString:Fr(De._A.comment)},invertTheme:!1,keyPath:[s],getItemString:(e,t,n,i)=>Array.isArray(t)?Bs.createElement("span",null,n," ",i):0===Object.keys(t).length?Bs.createElement("span",null,n):null,labelRenderer:([e,t])=>Bs.createElement("span",{className:Fr(De._A.keyword)},Bs.createElement(Us(),{searchWords:[this.state.filter],textToHighlight:`${e}`,highlightClassName:"jp-mod-selected"})),valueRenderer:e=>{let t=Fr(De._A.string);return"number"==typeof e&&(t=Fr(De._A.number)),"true"!==e&&"false"!==e||(t=Fr(De._A.keyword)),Bs.createElement("span",{className:t},Bs.createElement(Us(),{searchWords:[this.state.filter],textToHighlight:`${e}`,highlightClassName:"jp-mod-selected"}))},shouldExpandNodeInitially:(e,t,i)=>!(!n||!n.expanded)||r.join(",").includes(e.join(","))}))}}const $r={scheme:"jupyter",base00:"invalid",base01:"invalid",base02:"invalid",base03:"invalid",base04:"invalid",base05:"invalid",base06:"invalid",base07:"invalid",base08:"invalid",base09:"invalid",base0A:"invalid",base0B:"invalid",base0C:"invalid",base0D:"invalid",base0E:"invalid",base0F:"invalid",author:"invalid"};function Hr(e,t){return JSON.stringify(e).includes(t)}function qr(e,t,n=["root"]){return Ce.JSONExt.isArray(e)?e.reduce(((e,i,s)=>i&&"object"==typeof i&&Hr(i,t)?[...e,[s,...n].join(","),...qr(i,t,[s,...n])]:e),[]):Ce.JSONExt.isObject(e)?Object.keys(e).reduce(((i,s)=>{const r=e[s];return r&&"object"==typeof r&&(s.includes(t)||Hr(r,t))?[...i,[s,...n].join(","),...qr(r,t,[s,...n])]:i}),[]):[]}},5869:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"apathy",author:"jannik siebert (https://github.com/janniks)",base00:"#031A16",base01:"#0B342D",base02:"#184E45",base03:"#2B685E",base04:"#5F9C92",base05:"#81B5AC",base06:"#A7CEC8",base07:"#D2E7E4",base08:"#3E9688",base09:"#3E7996",base0A:"#3E4C96",base0B:"#883E96",base0C:"#963E4C",base0D:"#96883E",base0E:"#4C963E",base0F:"#3E965B"},e.exports=t.default},7088:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"ashes",author:"jannik siebert (https://github.com/janniks)",base00:"#1C2023",base01:"#393F45",base02:"#565E65",base03:"#747C84",base04:"#ADB3BA",base05:"#C7CCD1",base06:"#DFE2E5",base07:"#F3F4F5",base08:"#C7AE95",base09:"#C7C795",base0A:"#AEC795",base0B:"#95C7AE",base0C:"#95AEC7",base0D:"#AE95C7",base0E:"#C795AE",base0F:"#C79595"},e.exports=t.default},5067:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"atelier dune",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/dune)",base00:"#20201d",base01:"#292824",base02:"#6e6b5e",base03:"#7d7a68",base04:"#999580",base05:"#a6a28c",base06:"#e8e4cf",base07:"#fefbec",base08:"#d73737",base09:"#b65611",base0A:"#cfb017",base0B:"#60ac39",base0C:"#1fad83",base0D:"#6684e1",base0E:"#b854d4",base0F:"#d43552"},e.exports=t.default},7784:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"atelier forest",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/forest)",base00:"#1b1918",base01:"#2c2421",base02:"#68615e",base03:"#766e6b",base04:"#9c9491",base05:"#a8a19f",base06:"#e6e2e0",base07:"#f1efee",base08:"#f22c40",base09:"#df5320",base0A:"#d5911a",base0B:"#5ab738",base0C:"#00ad9c",base0D:"#407ee7",base0E:"#6666ea",base0F:"#c33ff3"},e.exports=t.default},9859:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"atelier heath",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/heath)",base00:"#1b181b",base01:"#292329",base02:"#695d69",base03:"#776977",base04:"#9e8f9e",base05:"#ab9bab",base06:"#d8cad8",base07:"#f7f3f7",base08:"#ca402b",base09:"#a65926",base0A:"#bb8a35",base0B:"#379a37",base0C:"#159393",base0D:"#516aec",base0E:"#7b59c0",base0F:"#cc33cc"},e.exports=t.default},9525:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"atelier lakeside",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/lakeside/)",base00:"#161b1d",base01:"#1f292e",base02:"#516d7b",base03:"#5a7b8c",base04:"#7195a8",base05:"#7ea2b4",base06:"#c1e4f6",base07:"#ebf8ff",base08:"#d22d72",base09:"#935c25",base0A:"#8a8a0f",base0B:"#568c3b",base0C:"#2d8f6f",base0D:"#257fad",base0E:"#5d5db1",base0F:"#b72dd2"},e.exports=t.default},5789:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"atelier seaside",author:"bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/seaside/)",base00:"#131513",base01:"#242924",base02:"#5e6e5e",base03:"#687d68",base04:"#809980",base05:"#8ca68c",base06:"#cfe8cf",base07:"#f0fff0",base08:"#e6193c",base09:"#87711d",base0A:"#c3c322",base0B:"#29a329",base0C:"#1999b3",base0D:"#3d62f5",base0E:"#ad2bee",base0F:"#e619c3"},e.exports=t.default},5363:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"bespin",author:"jan t. sott",base00:"#28211c",base01:"#36312e",base02:"#5e5d5c",base03:"#666666",base04:"#797977",base05:"#8a8986",base06:"#9d9b97",base07:"#baae9e",base08:"#cf6a4c",base09:"#cf7d34",base0A:"#f9ee98",base0B:"#54be0d",base0C:"#afc4db",base0D:"#5ea6ea",base0E:"#9b859d",base0F:"#937121"},e.exports=t.default},2525:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"brewer",author:"timothée poisot (http://github.com/tpoisot)",base00:"#0c0d0e",base01:"#2e2f30",base02:"#515253",base03:"#737475",base04:"#959697",base05:"#b7b8b9",base06:"#dadbdc",base07:"#fcfdfe",base08:"#e31a1c",base09:"#e6550d",base0A:"#dca060",base0B:"#31a354",base0C:"#80b1d3",base0D:"#3182bd",base0E:"#756bb1",base0F:"#b15928"},e.exports=t.default},1986:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"bright",author:"chris kempson (http://chriskempson.com)",base00:"#000000",base01:"#303030",base02:"#505050",base03:"#b0b0b0",base04:"#d0d0d0",base05:"#e0e0e0",base06:"#f5f5f5",base07:"#ffffff",base08:"#fb0120",base09:"#fc6d24",base0A:"#fda331",base0B:"#a1c659",base0C:"#76c7b7",base0D:"#6fb3d2",base0E:"#d381c3",base0F:"#be643c"},e.exports=t.default},5235:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"chalk",author:"chris kempson (http://chriskempson.com)",base00:"#151515",base01:"#202020",base02:"#303030",base03:"#505050",base04:"#b0b0b0",base05:"#d0d0d0",base06:"#e0e0e0",base07:"#f5f5f5",base08:"#fb9fb1",base09:"#eda987",base0A:"#ddb26f",base0B:"#acc267",base0C:"#12cfc0",base0D:"#6fc2ef",base0E:"#e1a3ee",base0F:"#deaf8f"},e.exports=t.default},9635:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"codeschool",author:"brettof86",base00:"#232c31",base01:"#1c3657",base02:"#2a343a",base03:"#3f4944",base04:"#84898c",base05:"#9ea7a6",base06:"#a7cfa3",base07:"#b5d8f6",base08:"#2a5491",base09:"#43820d",base0A:"#a03b1e",base0B:"#237986",base0C:"#b02f30",base0D:"#484d79",base0E:"#c59820",base0F:"#c98344"},e.exports=t.default},2230:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"colors",author:"mrmrs (http://clrs.cc)",base00:"#111111",base01:"#333333",base02:"#555555",base03:"#777777",base04:"#999999",base05:"#bbbbbb",base06:"#dddddd",base07:"#ffffff",base08:"#ff4136",base09:"#ff851b",base0A:"#ffdc00",base0B:"#2ecc40",base0C:"#7fdbff",base0D:"#0074d9",base0E:"#b10dc9",base0F:"#85144b"},e.exports=t.default},8597:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"default",author:"chris kempson (http://chriskempson.com)",base00:"#181818",base01:"#282828",base02:"#383838",base03:"#585858",base04:"#b8b8b8",base05:"#d8d8d8",base06:"#e8e8e8",base07:"#f8f8f8",base08:"#ab4642",base09:"#dc9656",base0A:"#f7ca88",base0B:"#a1b56c",base0C:"#86c1b9",base0D:"#7cafc2",base0E:"#ba8baf",base0F:"#a16946"},e.exports=t.default},4444:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"eighties",author:"chris kempson (http://chriskempson.com)",base00:"#2d2d2d",base01:"#393939",base02:"#515151",base03:"#747369",base04:"#a09f93",base05:"#d3d0c8",base06:"#e8e6df",base07:"#f2f0ec",base08:"#f2777a",base09:"#f99157",base0A:"#ffcc66",base0B:"#99cc99",base0C:"#66cccc",base0D:"#6699cc",base0E:"#cc99cc",base0F:"#d27b53"},e.exports=t.default},6834:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"embers",author:"jannik siebert (https://github.com/janniks)",base00:"#16130F",base01:"#2C2620",base02:"#433B32",base03:"#5A5047",base04:"#8A8075",base05:"#A39A90",base06:"#BEB6AE",base07:"#DBD6D1",base08:"#826D57",base09:"#828257",base0A:"#6D8257",base0B:"#57826D",base0C:"#576D82",base0D:"#6D5782",base0E:"#82576D",base0F:"#825757"},e.exports=t.default},6521:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"flat",author:"chris kempson (http://chriskempson.com)",base00:"#2C3E50",base01:"#34495E",base02:"#7F8C8D",base03:"#95A5A6",base04:"#BDC3C7",base05:"#e0e0e0",base06:"#f5f5f5",base07:"#ECF0F1",base08:"#E74C3C",base09:"#E67E22",base0A:"#F1C40F",base0B:"#2ECC71",base0C:"#1ABC9C",base0D:"#3498DB",base0E:"#9B59B6",base0F:"#be643c"},e.exports=t.default},7469:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"google",author:"seth wright (http://sethawright.com)",base00:"#1d1f21",base01:"#282a2e",base02:"#373b41",base03:"#969896",base04:"#b4b7b4",base05:"#c5c8c6",base06:"#e0e0e0",base07:"#ffffff",base08:"#CC342B",base09:"#F96A38",base0A:"#FBA922",base0B:"#198844",base0C:"#3971ED",base0D:"#3971ED",base0E:"#A36AC7",base0F:"#3971ED"},e.exports=t.default},4011:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"grayscale",author:"alexandre gavioli (https://github.com/alexx2/)",base00:"#101010",base01:"#252525",base02:"#464646",base03:"#525252",base04:"#ababab",base05:"#b9b9b9",base06:"#e3e3e3",base07:"#f7f7f7",base08:"#7c7c7c",base09:"#999999",base0A:"#a0a0a0",base0B:"#8e8e8e",base0C:"#868686",base0D:"#686868",base0E:"#747474",base0F:"#5e5e5e"},e.exports=t.default},1027:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"green screen",author:"chris kempson (http://chriskempson.com)",base00:"#001100",base01:"#003300",base02:"#005500",base03:"#007700",base04:"#009900",base05:"#00bb00",base06:"#00dd00",base07:"#00ff00",base08:"#007700",base09:"#009900",base0A:"#007700",base0B:"#00bb00",base0C:"#005500",base0D:"#009900",base0E:"#00bb00",base0F:"#005500"},e.exports=t.default},8781:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"harmonic16",author:"jannik siebert (https://github.com/janniks)",base00:"#0b1c2c",base01:"#223b54",base02:"#405c79",base03:"#627e99",base04:"#aabcce",base05:"#cbd6e2",base06:"#e5ebf1",base07:"#f7f9fb",base08:"#bf8b56",base09:"#bfbf56",base0A:"#8bbf56",base0B:"#56bf8b",base0C:"#568bbf",base0D:"#8b56bf",base0E:"#bf568b",base0F:"#bf5656"},e.exports=t.default},9453:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"hopscotch",author:"jan t. sott",base00:"#322931",base01:"#433b42",base02:"#5c545b",base03:"#797379",base04:"#989498",base05:"#b9b5b8",base06:"#d5d3d5",base07:"#ffffff",base08:"#dd464c",base09:"#fd8b19",base0A:"#fdcc59",base0B:"#8fc13e",base0C:"#149b93",base0D:"#1290bf",base0E:"#c85e7c",base0F:"#b33508"},e.exports=t.default},1932:(e,t,n)=>{"use strict";function i(e){return e&&e.__esModule?e.default:e}t.__esModule=!0;var s=n(9782);t.threezerotwofour=i(s);var r=n(5869);t.apathy=i(r);var o=n(7088);t.ashes=i(o);var a=n(5067);t.atelierDune=i(a);var l=n(7784);t.atelierForest=i(l);var h=n(9859);t.atelierHeath=i(h);var c=n(9525);t.atelierLakeside=i(c);var u=n(5789);t.atelierSeaside=i(u);var f=n(5363);t.bespin=i(f);var d=n(2525);t.brewer=i(d);var p=n(1986);t.bright=i(p);var m=n(5235);t.chalk=i(m);var g=n(9635);t.codeschool=i(g);var b=n(2230);t.colors=i(b);var y=n(8597);t.default=i(y);var v=n(4444);t.eighties=i(v);var x=n(6834);t.embers=i(x);var w=n(6521);t.flat=i(w);var k=n(7469);t.google=i(k);var S=n(4011);t.grayscale=i(S);var C=n(1027);t.greenscreen=i(C);var A=n(8781);t.harmonic=i(A);var O=n(9453);t.hopscotch=i(O);var M=n(8599);t.isotope=i(M);var _=n(4522);t.marrakesh=i(_);var T=n(1946);t.mocha=i(T);var N=n(10);t.monokai=i(N);var E=n(5942);t.ocean=i(E);var D=n(443);t.paraiso=i(D);var P=n(7339);t.pop=i(P);var R=n(9009);t.railscasts=i(R);var j=n(6870);t.shapeshifter=i(j);var I=n(2783);t.solarized=i(I);var L=n(4925);t.summerfruit=i(L);var B=n(1533);t.tomorrow=i(B);var F=n(5240);t.tube=i(F);var z=n(5822);t.twilight=i(z)},8599:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"isotope",author:"jan t. sott",base00:"#000000",base01:"#404040",base02:"#606060",base03:"#808080",base04:"#c0c0c0",base05:"#d0d0d0",base06:"#e0e0e0",base07:"#ffffff",base08:"#ff0000",base09:"#ff9900",base0A:"#ff0099",base0B:"#33ff00",base0C:"#00ffff",base0D:"#0066ff",base0E:"#cc00ff",base0F:"#3300ff"},e.exports=t.default},4522:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"marrakesh",author:"alexandre gavioli (http://github.com/alexx2/)",base00:"#201602",base01:"#302e00",base02:"#5f5b17",base03:"#6c6823",base04:"#86813b",base05:"#948e48",base06:"#ccc37a",base07:"#faf0a5",base08:"#c35359",base09:"#b36144",base0A:"#a88339",base0B:"#18974e",base0C:"#75a738",base0D:"#477ca1",base0E:"#8868b3",base0F:"#b3588e"},e.exports=t.default},1946:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"mocha",author:"chris kempson (http://chriskempson.com)",base00:"#3B3228",base01:"#534636",base02:"#645240",base03:"#7e705a",base04:"#b8afad",base05:"#d0c8c6",base06:"#e9e1dd",base07:"#f5eeeb",base08:"#cb6077",base09:"#d28b71",base0A:"#f4bc87",base0B:"#beb55b",base0C:"#7bbda4",base0D:"#8ab3b5",base0E:"#a89bb9",base0F:"#bb9584"},e.exports=t.default},10:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"monokai",author:"wimer hazenberg (http://www.monokai.nl)",base00:"#272822",base01:"#383830",base02:"#49483e",base03:"#75715e",base04:"#a59f85",base05:"#f8f8f2",base06:"#f5f4f1",base07:"#f9f8f5",base08:"#f92672",base09:"#fd971f",base0A:"#f4bf75",base0B:"#a6e22e",base0C:"#a1efe4",base0D:"#66d9ef",base0E:"#ae81ff",base0F:"#cc6633"},e.exports=t.default},5942:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"ocean",author:"chris kempson (http://chriskempson.com)",base00:"#2b303b",base01:"#343d46",base02:"#4f5b66",base03:"#65737e",base04:"#a7adba",base05:"#c0c5ce",base06:"#dfe1e8",base07:"#eff1f5",base08:"#bf616a",base09:"#d08770",base0A:"#ebcb8b",base0B:"#a3be8c",base0C:"#96b5b4",base0D:"#8fa1b3",base0E:"#b48ead",base0F:"#ab7967"},e.exports=t.default},443:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"paraiso",author:"jan t. sott",base00:"#2f1e2e",base01:"#41323f",base02:"#4f424c",base03:"#776e71",base04:"#8d8687",base05:"#a39e9b",base06:"#b9b6b0",base07:"#e7e9db",base08:"#ef6155",base09:"#f99b15",base0A:"#fec418",base0B:"#48b685",base0C:"#5bc4bf",base0D:"#06b6ef",base0E:"#815ba4",base0F:"#e96ba8"},e.exports=t.default},7339:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"pop",author:"chris kempson (http://chriskempson.com)",base00:"#000000",base01:"#202020",base02:"#303030",base03:"#505050",base04:"#b0b0b0",base05:"#d0d0d0",base06:"#e0e0e0",base07:"#ffffff",base08:"#eb008a",base09:"#f29333",base0A:"#f8ca12",base0B:"#37b349",base0C:"#00aabb",base0D:"#0e5a94",base0E:"#b31e8d",base0F:"#7a2d00"},e.exports=t.default},9009:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"railscasts",author:"ryan bates (http://railscasts.com)",base00:"#2b2b2b",base01:"#272935",base02:"#3a4055",base03:"#5a647e",base04:"#d4cfc9",base05:"#e6e1dc",base06:"#f4f1ed",base07:"#f9f7f3",base08:"#da4939",base09:"#cc7833",base0A:"#ffc66d",base0B:"#a5c261",base0C:"#519f50",base0D:"#6d9cbe",base0E:"#b6b3eb",base0F:"#bc9458"},e.exports=t.default},6870:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"shapeshifter",author:"tyler benziger (http://tybenz.com)",base00:"#000000",base01:"#040404",base02:"#102015",base03:"#343434",base04:"#555555",base05:"#ababab",base06:"#e0e0e0",base07:"#f9f9f9",base08:"#e92f2f",base09:"#e09448",base0A:"#dddd13",base0B:"#0ed839",base0C:"#23edda",base0D:"#3b48e3",base0E:"#f996e2",base0F:"#69542d"},e.exports=t.default},2783:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"solarized",author:"ethan schoonover (http://ethanschoonover.com/solarized)",base00:"#002b36",base01:"#073642",base02:"#586e75",base03:"#657b83",base04:"#839496",base05:"#93a1a1",base06:"#eee8d5",base07:"#fdf6e3",base08:"#dc322f",base09:"#cb4b16",base0A:"#b58900",base0B:"#859900",base0C:"#2aa198",base0D:"#268bd2",base0E:"#6c71c4",base0F:"#d33682"},e.exports=t.default},4925:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"summerfruit",author:"christopher corley (http://cscorley.github.io/)",base00:"#151515",base01:"#202020",base02:"#303030",base03:"#505050",base04:"#B0B0B0",base05:"#D0D0D0",base06:"#E0E0E0",base07:"#FFFFFF",base08:"#FF0086",base09:"#FD8900",base0A:"#ABA800",base0B:"#00C918",base0C:"#1faaaa",base0D:"#3777E6",base0E:"#AD00A1",base0F:"#cc6633"},e.exports=t.default},9782:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"threezerotwofour",author:"jan t. sott (http://github.com/idleberg)",base00:"#090300",base01:"#3a3432",base02:"#4a4543",base03:"#5c5855",base04:"#807d7c",base05:"#a5a2a2",base06:"#d6d5d4",base07:"#f7f7f7",base08:"#db2d20",base09:"#e8bbd0",base0A:"#fded02",base0B:"#01a252",base0C:"#b5e4f4",base0D:"#01a0e4",base0E:"#a16a94",base0F:"#cdab53"},e.exports=t.default},1533:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"tomorrow",author:"chris kempson (http://chriskempson.com)",base00:"#1d1f21",base01:"#282a2e",base02:"#373b41",base03:"#969896",base04:"#b4b7b4",base05:"#c5c8c6",base06:"#e0e0e0",base07:"#ffffff",base08:"#cc6666",base09:"#de935f",base0A:"#f0c674",base0B:"#b5bd68",base0C:"#8abeb7",base0D:"#81a2be",base0E:"#b294bb",base0F:"#a3685a"},e.exports=t.default},5240:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"london tube",author:"jan t. sott",base00:"#231f20",base01:"#1c3f95",base02:"#5a5758",base03:"#737171",base04:"#959ca1",base05:"#d9d8d8",base06:"#e7e7e8",base07:"#ffffff",base08:"#ee2e24",base09:"#f386a1",base0A:"#ffd204",base0B:"#00853e",base0C:"#85cebc",base0D:"#009ddc",base0E:"#98005d",base0F:"#b06110"},e.exports=t.default},5822:(e,t)=>{"use strict";t.__esModule=!0,t.default={scheme:"twilight",author:"david hart (http://hart-dev.com)",base00:"#1e1e1e",base01:"#323537",base02:"#464b50",base03:"#5f5a60",base04:"#838184",base05:"#a7a7a7",base06:"#c3c3c3",base07:"#ffffff",base08:"#cf6a4c",base09:"#cda869",base0A:"#f9ee98",base0B:"#8f9d6a",base0C:"#afc4db",base0D:"#7587a6",base0E:"#9b859d",base0F:"#9b703f"},e.exports=t.default},6931:e=>{"use strict";e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},8031:(e,t,n)=>{var i=n(6931),s=n(9975),r=Object.hasOwnProperty,o=Object.create(null);for(var a in i)r.call(i,a)&&(o[i[a]]=a);var l=e.exports={to:{},get:{}};function h(e,t,n){return Math.min(Math.max(t,e),n)}function c(e){var t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}l.get=function(e){var t,n;switch(e.substring(0,3).toLowerCase()){case"hsl":t=l.get.hsl(e),n="hsl";break;case"hwb":t=l.get.hwb(e),n="hwb";break;default:t=l.get.rgb(e),n="rgb"}return t?{model:n,value:t}:null},l.get.rgb=function(e){if(!e)return null;var t,n,s,o=[0,0,0,1];if(t=e.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(s=t[2],t=t[1],n=0;n<3;n++){var a=2*n;o[n]=parseInt(t.slice(a,a+2),16)}s&&(o[3]=parseInt(s,16)/255)}else if(t=e.match(/^#([a-f0-9]{3,4})$/i)){for(s=(t=t[1])[3],n=0;n<3;n++)o[n]=parseInt(t[n]+t[n],16);s&&(o[3]=parseInt(s+s,16)/255)}else if(t=e.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(n=0;n<3;n++)o[n]=parseInt(t[n+1],0);t[4]&&(t[5]?o[3]=.01*parseFloat(t[4]):o[3]=parseFloat(t[4]))}else{if(!(t=e.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(t=e.match(/^(\w+)$/))?"transparent"===t[1]?[0,0,0,0]:r.call(i,t[1])?((o=i[t[1]])[3]=1,o):null:null;for(n=0;n<3;n++)o[n]=Math.round(2.55*parseFloat(t[n+1]));t[4]&&(t[5]?o[3]=.01*parseFloat(t[4]):o[3]=parseFloat(t[4]))}for(n=0;n<3;n++)o[n]=h(o[n],0,255);return o[3]=h(o[3],0,1),o},l.get.hsl=function(e){if(!e)return null;var t=e.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){var n=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,h(parseFloat(t[2]),0,100),h(parseFloat(t[3]),0,100),h(isNaN(n)?1:n,0,1)]}return null},l.get.hwb=function(e){if(!e)return null;var t=e.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){var n=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,h(parseFloat(t[2]),0,100),h(parseFloat(t[3]),0,100),h(isNaN(n)?1:n,0,1)]}return null},l.to.hex=function(){var e=s(arguments);return"#"+c(e[0])+c(e[1])+c(e[2])+(e[3]<1?c(Math.round(255*e[3])):"")},l.to.rgb=function(){var e=s(arguments);return e.length<4||1===e[3]?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"},l.to.rgb.percent=function(){var e=s(arguments),t=Math.round(e[0]/255*100),n=Math.round(e[1]/255*100),i=Math.round(e[2]/255*100);return e.length<4||1===e[3]?"rgb("+t+"%, "+n+"%, "+i+"%)":"rgba("+t+"%, "+n+"%, "+i+"%, "+e[3]+")"},l.to.hsl=function(){var e=s(arguments);return e.length<4||1===e[3]?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"},l.to.hwb=function(){var e=s(arguments),t="";return e.length>=4&&1!==e[3]&&(t=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"},l.to.keyword=function(e){return o[e.slice(0,3)]}},465:(e,t,n)=>{"use strict";var i=n(8031),s=n(8754),r=[].slice,o=["keyword","gray","hex"],a={};Object.keys(s).forEach((function(e){a[r.call(s[e].labels).sort().join("")]=e}));var l={};function h(e,t){if(!(this instanceof h))return new h(e,t);if(t&&t in o&&(t=null),t&&!(t in s))throw new Error("Unknown model: "+t);var n,c;if(null==e)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof h)this.model=e.model,this.color=e.color.slice(),this.valpha=e.valpha;else if("string"==typeof e){var u=i.get(e);if(null===u)throw new Error("Unable to parse color from string: "+e);this.model=u.model,c=s[this.model].channels,this.color=u.value.slice(0,c),this.valpha="number"==typeof u.value[c]?u.value[c]:1}else if(e.length){this.model=t||"rgb",c=s[this.model].channels;var d=r.call(e,0,c);this.color=f(d,c),this.valpha="number"==typeof e[c]?e[c]:1}else if("number"==typeof e)e&=16777215,this.model="rgb",this.color=[e>>16&255,e>>8&255,255&e],this.valpha=1;else{this.valpha=1;var p=Object.keys(e);"alpha"in e&&(p.splice(p.indexOf("alpha"),1),this.valpha="number"==typeof e.alpha?e.alpha:0);var m=p.sort().join("");if(!(m in a))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=a[m];var g=s[this.model].labels,b=[];for(n=0;nn?(t+.05)/(n+.05):(n+.05)/(t+.05)},level:function(e){var t=this.contrast(e);return t>=7.1?"AAA":t>=4.5?"AA":""},isDark:function(){var e=this.rgb().color;return(299*e[0]+587*e[1]+114*e[2])/1e3<128},isLight:function(){return!this.isDark()},negate:function(){for(var e=this.rgb(),t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten:function(e){var t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken:function(e){var t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate:function(e){var t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate:function(e){var t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten:function(e){var t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken:function(e){var t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale:function(){var e=this.rgb().color,t=.3*e[0]+.59*e[1]+.11*e[2];return h.rgb(t,t,t)},fade:function(e){return this.alpha(this.valpha-this.valpha*e)},opaquer:function(e){return this.alpha(this.valpha+this.valpha*e)},rotate:function(e){var t=this.hsl(),n=t.color[0];return n=(n=(n+e)%360)<0?360+n:n,t.color[0]=n,t},mix:function(e,t){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);var n=e.rgb(),i=this.rgb(),s=void 0===t?.5:t,r=2*s-1,o=n.alpha()-i.alpha(),a=((r*o==-1?r:(r+o)/(1+r*o))+1)/2,l=1-a;return h.rgb(a*n.red()+l*i.red(),a*n.green()+l*i.green(),a*n.blue()+l*i.blue(),n.alpha()*s+i.alpha()*(1-s))}},Object.keys(s).forEach((function(e){if(-1===o.indexOf(e)){var t=s[e].channels;h.prototype[e]=function(){if(this.model===e)return new h(this);if(arguments.length)return new h(arguments,e);var n,i="number"==typeof arguments[t]?t:this.valpha;return new h((n=s[this.model][e].raw(this.color),Array.isArray(n)?n:[n]).concat(i),e)},h[e]=function(n){return"number"==typeof n&&(n=f(r.call(arguments),t)),new h(n,e)}}})),e.exports=h},5159:(e,t,n)=>{var i=n(3928),s={};for(var r in i)i.hasOwnProperty(r)&&(s[i[r]]=r);var o=e.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var a in o)if(o.hasOwnProperty(a)){if(!("channels"in o[a]))throw new Error("missing channels property: "+a);if(!("labels"in o[a]))throw new Error("missing channel labels property: "+a);if(o[a].labels.length!==o[a].channels)throw new Error("channel and label counts mismatch: "+a);var l=o[a].channels,h=o[a].labels;delete o[a].channels,delete o[a].labels,Object.defineProperty(o[a],"channels",{value:l}),Object.defineProperty(o[a],"labels",{value:h})}o.rgb.hsl=function(e){var t,n,i=e[0]/255,s=e[1]/255,r=e[2]/255,o=Math.min(i,s,r),a=Math.max(i,s,r),l=a-o;return a===o?t=0:i===a?t=(s-r)/l:s===a?t=2+(r-i)/l:r===a&&(t=4+(i-s)/l),(t=Math.min(60*t,360))<0&&(t+=360),n=(o+a)/2,[t,100*(a===o?0:n<=.5?l/(a+o):l/(2-a-o)),100*n]},o.rgb.hsv=function(e){var t,n,i,s,r,o=e[0]/255,a=e[1]/255,l=e[2]/255,h=Math.max(o,a,l),c=h-Math.min(o,a,l),u=function(e){return(h-e)/6/c+.5};return 0===c?s=r=0:(r=c/h,t=u(o),n=u(a),i=u(l),o===h?s=i-n:a===h?s=1/3+t-i:l===h&&(s=2/3+n-t),s<0?s+=1:s>1&&(s-=1)),[360*s,100*r,100*h]},o.rgb.hwb=function(e){var t=e[0],n=e[1],i=e[2];return[o.rgb.hsl(e)[0],1/255*Math.min(t,Math.min(n,i))*100,100*(i=1-1/255*Math.max(t,Math.max(n,i)))]},o.rgb.cmyk=function(e){var t,n=e[0]/255,i=e[1]/255,s=e[2]/255;return[100*((1-n-(t=Math.min(1-n,1-i,1-s)))/(1-t)||0),100*((1-i-t)/(1-t)||0),100*((1-s-t)/(1-t)||0),100*t]},o.rgb.keyword=function(e){var t=s[e];if(t)return t;var n,r,o,a=1/0;for(var l in i)if(i.hasOwnProperty(l)){var h=(r=e,o=i[l],Math.pow(r[0]-o[0],2)+Math.pow(r[1]-o[1],2)+Math.pow(r[2]-o[2],2));h.04045?Math.pow((t+.055)/1.055,2.4):t/12.92)+.3576*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.1805*(i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92)),100*(.2126*t+.7152*n+.0722*i),100*(.0193*t+.1192*n+.9505*i)]},o.rgb.lab=function(e){var t=o.rgb.xyz(e),n=t[0],i=t[1],s=t[2];return i/=100,s/=108.883,n=(n/=95.047)>.008856?Math.pow(n,1/3):7.787*n+16/116,[116*(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116)-16,500*(n-i),200*(i-(s=s>.008856?Math.pow(s,1/3):7.787*s+16/116))]},o.hsl.rgb=function(e){var t,n,i,s,r,o=e[0]/360,a=e[1]/100,l=e[2]/100;if(0===a)return[r=255*l,r,r];t=2*l-(n=l<.5?l*(1+a):l+a-l*a),s=[0,0,0];for(var h=0;h<3;h++)(i=o+1/3*-(h-1))<0&&i++,i>1&&i--,r=6*i<1?t+6*(n-t)*i:2*i<1?n:3*i<2?t+(n-t)*(2/3-i)*6:t,s[h]=255*r;return s},o.hsl.hsv=function(e){var t=e[0],n=e[1]/100,i=e[2]/100,s=n,r=Math.max(i,.01);return n*=(i*=2)<=1?i:2-i,s*=r<=1?r:2-r,[t,100*(0===i?2*s/(r+s):2*n/(i+n)),(i+n)/2*100]},o.hsv.rgb=function(e){var t=e[0]/60,n=e[1]/100,i=e[2]/100,s=Math.floor(t)%6,r=t-Math.floor(t),o=255*i*(1-n),a=255*i*(1-n*r),l=255*i*(1-n*(1-r));switch(i*=255,s){case 0:return[i,l,o];case 1:return[a,i,o];case 2:return[o,i,l];case 3:return[o,a,i];case 4:return[l,o,i];case 5:return[i,o,a]}},o.hsv.hsl=function(e){var t,n,i,s=e[0],r=e[1]/100,o=e[2]/100,a=Math.max(o,.01);return i=(2-r)*o,n=r*a,[s,100*(n=(n/=(t=(2-r)*a)<=1?t:2-t)||0),100*(i/=2)]},o.hwb.rgb=function(e){var t,n,i,s,r,o,a,l=e[0]/360,h=e[1]/100,c=e[2]/100,u=h+c;switch(u>1&&(h/=u,c/=u),i=6*l-(t=Math.floor(6*l)),1&t&&(i=1-i),s=h+i*((n=1-c)-h),t){default:case 6:case 0:r=n,o=s,a=h;break;case 1:r=s,o=n,a=h;break;case 2:r=h,o=n,a=s;break;case 3:r=h,o=s,a=n;break;case 4:r=s,o=h,a=n;break;case 5:r=n,o=h,a=s}return[255*r,255*o,255*a]},o.cmyk.rgb=function(e){var t=e[0]/100,n=e[1]/100,i=e[2]/100,s=e[3]/100;return[255*(1-Math.min(1,t*(1-s)+s)),255*(1-Math.min(1,n*(1-s)+s)),255*(1-Math.min(1,i*(1-s)+s))]},o.xyz.rgb=function(e){var t,n,i,s=e[0]/100,r=e[1]/100,o=e[2]/100;return n=-.9689*s+1.8758*r+.0415*o,i=.0557*s+-.204*r+1.057*o,t=(t=3.2406*s+-1.5372*r+-.4986*o)>.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:12.92*i,[255*(t=Math.min(Math.max(0,t),1)),255*(n=Math.min(Math.max(0,n),1)),255*(i=Math.min(Math.max(0,i),1))]},o.xyz.lab=function(e){var t=e[0],n=e[1],i=e[2];return n/=100,i/=108.883,t=(t/=95.047)>.008856?Math.pow(t,1/3):7.787*t+16/116,[116*(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116)-16,500*(t-n),200*(n-(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116))]},o.lab.xyz=function(e){var t,n,i,s=e[0];t=e[1]/500+(n=(s+16)/116),i=n-e[2]/200;var r=Math.pow(n,3),o=Math.pow(t,3),a=Math.pow(i,3);return n=r>.008856?r:(n-16/116)/7.787,t=o>.008856?o:(t-16/116)/7.787,i=a>.008856?a:(i-16/116)/7.787,[t*=95.047,n*=100,i*=108.883]},o.lab.lch=function(e){var t,n=e[0],i=e[1],s=e[2];return(t=360*Math.atan2(s,i)/2/Math.PI)<0&&(t+=360),[n,Math.sqrt(i*i+s*s),t]},o.lch.lab=function(e){var t,n=e[0],i=e[1];return t=e[2]/360*2*Math.PI,[n,i*Math.cos(t),i*Math.sin(t)]},o.rgb.ansi16=function(e){var t=e[0],n=e[1],i=e[2],s=1 in arguments?arguments[1]:o.rgb.hsv(e)[2];if(0===(s=Math.round(s/50)))return 30;var r=30+(Math.round(i/255)<<2|Math.round(n/255)<<1|Math.round(t/255));return 2===s&&(r+=60),r},o.hsv.ansi16=function(e){return o.rgb.ansi16(o.hsv.rgb(e),e[2])},o.rgb.ansi256=function(e){var t=e[0],n=e[1],i=e[2];return t===n&&n===i?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(i/255*5)},o.ansi16.rgb=function(e){var t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),[t=t/10.5*255,t,t];var n=.5*(1+~~(e>50));return[(1&t)*n*255,(t>>1&1)*n*255,(t>>2&1)*n*255]},o.ansi256.rgb=function(e){if(e>=232){var t=10*(e-232)+8;return[t,t,t]}var n;return e-=16,[Math.floor(e/36)/5*255,Math.floor((n=e%36)/6)/5*255,n%6/5*255]},o.rgb.hex=function(e){var t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},o.hex.rgb=function(e){var t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];var n=t[0];3===t[0].length&&(n=n.split("").map((function(e){return e+e})).join(""));var i=parseInt(n,16);return[i>>16&255,i>>8&255,255&i]},o.rgb.hcg=function(e){var t,n=e[0]/255,i=e[1]/255,s=e[2]/255,r=Math.max(Math.max(n,i),s),o=Math.min(Math.min(n,i),s),a=r-o;return t=a<=0?0:r===n?(i-s)/a%6:r===i?2+(s-n)/a:4+(n-i)/a+4,t/=6,[360*(t%=1),100*a,100*(a<1?o/(1-a):0)]},o.hsl.hcg=function(e){var t,n=e[1]/100,i=e[2]/100,s=0;return(t=i<.5?2*n*i:2*n*(1-i))<1&&(s=(i-.5*t)/(1-t)),[e[0],100*t,100*s]},o.hsv.hcg=function(e){var t=e[1]/100,n=e[2]/100,i=t*n,s=0;return i<1&&(s=(n-i)/(1-i)),[e[0],100*i,100*s]},o.hcg.rgb=function(e){var t=e[0]/360,n=e[1]/100,i=e[2]/100;if(0===n)return[255*i,255*i,255*i];var s,r=[0,0,0],o=t%1*6,a=o%1,l=1-a;switch(Math.floor(o)){case 0:r[0]=1,r[1]=a,r[2]=0;break;case 1:r[0]=l,r[1]=1,r[2]=0;break;case 2:r[0]=0,r[1]=1,r[2]=a;break;case 3:r[0]=0,r[1]=l,r[2]=1;break;case 4:r[0]=a,r[1]=0,r[2]=1;break;default:r[0]=1,r[1]=0,r[2]=l}return s=(1-n)*i,[255*(n*r[0]+s),255*(n*r[1]+s),255*(n*r[2]+s)]},o.hcg.hsv=function(e){var t=e[1]/100,n=t+e[2]/100*(1-t),i=0;return n>0&&(i=t/n),[e[0],100*i,100*n]},o.hcg.hsl=function(e){var t=e[1]/100,n=e[2]/100*(1-t)+.5*t,i=0;return n>0&&n<.5?i=t/(2*n):n>=.5&&n<1&&(i=t/(2*(1-n))),[e[0],100*i,100*n]},o.hcg.hwb=function(e){var t=e[1]/100,n=t+e[2]/100*(1-t);return[e[0],100*(n-t),100*(1-n)]},o.hwb.hcg=function(e){var t=e[1]/100,n=1-e[2]/100,i=n-t,s=0;return i<1&&(s=(n-i)/(1-i)),[e[0],100*i,100*s]},o.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},o.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},o.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},o.gray.hsl=o.gray.hsv=function(e){return[0,0,e[0]]},o.gray.hwb=function(e){return[0,100,e[0]]},o.gray.cmyk=function(e){return[0,0,0,e[0]]},o.gray.lab=function(e){return[e[0],0,0]},o.gray.hex=function(e){var t=255&Math.round(e[0]/100*255),n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(n.length)+n},o.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}},8754:(e,t,n)=>{var i=n(5159),s=n(2695),r={};Object.keys(i).forEach((function(e){r[e]={},Object.defineProperty(r[e],"channels",{value:i[e].channels}),Object.defineProperty(r[e],"labels",{value:i[e].labels});var t=s(e);Object.keys(t).forEach((function(n){var i=t[n];r[e][n]=function(e){var t=function(t){if(null==t)return t;arguments.length>1&&(t=Array.prototype.slice.call(arguments));var n=e(t);if("object"==typeof n)for(var i=n.length,s=0;s1&&(t=Array.prototype.slice.call(arguments)),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}(i)}))})),e.exports=r},2695:(e,t,n)=>{var i=n(5159);function s(e,t){return function(n){return t(e(n))}}function r(e,t){for(var n=[t[e].parent,e],r=i[t[e].parent][e],o=t[e].parent;t[o].parent;)n.unshift(t[o].parent),r=s(i[t[o].parent][o],r),o=t[o].parent;return r.conversion=n,r}e.exports=function(e){for(var t=function(e){var t=function(){for(var e={},t=Object.keys(i),n=t.length,s=0;s{"use strict";e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},8101:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Cache:()=>p,FreeStyle:()=>v,Rule:()=>b,Selector:()=>m,Style:()=>g,create:()=>x});let i=0;const s=Object.create(null),r=["animation-iteration-count","border-image-outset","border-image-slice","border-image-width","box-flex","box-flex-group","box-ordinal-group","column-count","columns","counter-increment","counter-reset","flex","flex-grow","flex-positive","flex-shrink","flex-negative","flex-order","font-weight","grid-area","grid-column","grid-column-end","grid-column-span","grid-column-start","grid-row","grid-row-end","grid-row-span","grid-row-start","line-clamp","line-height","opacity","order","orphans","tab-size","widows","z-index","zoom","fill-opacity","flood-opacity","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-miterlimit","stroke-opacity","stroke-width"];for(const e of r)for(const t of["-webkit-","-ms-","-moz-","-o-",""])s[t+e]=!0;function o(e,t){return t&&"number"==typeof t&&!s[e]?`${e}:${t}px`:`${e}:${t}`}function a(e){return e.sort(((e,t)=>e[0]>t[0]?1:-1))}function l(e){return e.map((([e,t])=>Array.isArray(t)?t.map((t=>o(e,t))).join(";"):o(e,t))).join(";")}function h(e,t){return-1===e.indexOf("&")?`${t} ${e}`:e.replace(/&/g,t)}function c(e,t,n,i,s){const{style:r,nested:o,isUnique:u}=function(e,t){const n=[],i=[];for(const t of Object.keys(e)){const r=t.trim(),o=e[t];36!==r.charCodeAt(0)&&null!=o&&("object"!=typeof o||Array.isArray(o)?n.push([(s=r,s.replace(/[A-Z]/g,(e=>`-${e.toLowerCase()}`)).replace(/^ms-/,"-ms-")),o]):i.push([r,o]))}var s;return{style:l(a(n)),nested:t?i:a(i),isUnique:!!e.$unique}}(t,""!==e);let f=r;if(64===e.charCodeAt(0)){const t={selector:e,styles:[],rules:[],style:s?"":r};n.push(t),r&&s&&t.styles.push({selector:s,style:r,isUnique:u});for(const[e,n]of o)f+=e+c(e,n,t.rules,t.styles,s)}else{const t=s?h(e,s):e;r&&i.push({selector:t,style:r,isUnique:u});for(const[e,s]of o)f+=e+c(e,s,n,i,t)}return f}function u(e,t,n,s,r,o){for(const{selector:n,style:a,isUnique:l}of s){const s=o?h(n,r):n,c=l?`u\0${(++i).toString(36)}`:`s\0${t}\0${a}`,u=new g(a,c);u.add(new m(s,`k\0${t}\0${s}`)),e.add(u)}for(const{selector:i,style:s,rules:a,styles:l}of n){const n=new b(i,s,`r\0${t}\0${i}\0${s}`);u(n,t,a,l,r,o),e.add(n)}}function f(e){let t="";for(let n=0;n{},change:()=>{},remove:()=>{}};class p{constructor(e=d){this.changes=e,this.sheet=[],this.changeId=0,this._keys=[],this._children=Object.create(null),this._counters=Object.create(null)}add(e){const t=this._counters[e.id]||0,n=this._children[e.id]||e.clone();if(this._counters[e.id]=t+1,0===t)this._children[n.id]=n,this._keys.push(n.id),this.sheet.push(n.getStyles()),this.changeId++,this.changes.add(n,this._keys.length-1);else if(n instanceof p&&e instanceof p){const t=this._keys.indexOf(e.id),i=n.changeId;n.merge(e),n.changeId!==i&&(this.sheet.splice(t,1,n.getStyles()),this.changeId++,this.changes.change(n,t,t))}}remove(e){const t=this._counters[e.id];if(t){this._counters[e.id]=t-1;const n=this._children[e.id],i=this._keys.indexOf(n.id);if(1===t)delete this._counters[e.id],delete this._children[e.id],this._keys.splice(i,1),this.sheet.splice(i,1),this.changeId++,this.changes.remove(n,i);else if(n instanceof p&&e instanceof p){const t=n.changeId;n.unmerge(e),n.changeId!==t&&(this.sheet.splice(i,1,n.getStyles()),this.changeId++,this.changes.change(n,i,i))}}}values(){return this._keys.map((e=>this._children[e]))}merge(e){for(const t of e.values())this.add(t);return this}unmerge(e){for(const t of e.values())this.remove(t);return this}clone(){return(new p).merge(this)}}class m{constructor(e,t){this.selector=e,this.id=t}getStyles(){return this.selector}clone(){return this}}class g extends p{constructor(e,t){super(),this.style=e,this.id=t}getStyles(){return`${this.sheet.join(",")}{${this.style}}`}clone(){return new g(this.style,this.id).merge(this)}}class b extends p{constructor(e,t,n){super(),this.rule=e,this.style=t,this.id=n}getStyles(){return`${this.rule}{${this.style}${f(this.sheet)}}`}clone(){return new b(this.rule,this.style,this.id).merge(this)}}function y(e,t){return`f${function(e){let t=5381,n=e.length;for(;n--;)t=33*t^e.charCodeAt(n);return(t>>>0).toString(36)}(e)}`}class v extends p{constructor(e,t){super(t),this.id=e}registerStyle(e){const t=[],n=[],i=c("&",e,t,n),s=y(i);return u(this,i,t,n,`.${s}`,!0),s}registerKeyframes(e){return this.registerHashRule("@keyframes",e)}registerHashRule(e,t){const n=[],i=[],s=c("",t,n,i),r=y(s),o=new b(`${e} ${r}`,"",`h\0${s}\0${e}`);return u(o,s,n,i,"",!1),this.add(o),r}registerRule(e,t){const n=[],i=[];u(this,c(e,t,n,i),n,i,"",!1)}registerCss(e){return this.registerRule("",e)}getStyles(){return f(this.sheet)}clone(){return new v(this.id,this.changes).merge(this)}}function x(e){return new v(`f${(++i).toString(36)}`,e)}},9910:(e,t,n)=>{var i="Expected a function",s="__lodash_placeholder__",r=1,o=2,a=4,l=8,h=16,c=32,u=64,f=128,d=512,p=1/0,m=9007199254740991,g=17976931348623157e292,b=NaN,y=[["ary",f],["bind",r],["bindKey",o],["curry",l],["curryRight",h],["flip",d],["partial",c],["partialRight",u],["rearg",256]],v="[object Function]",x="[object GeneratorFunction]",w="[object Symbol]",k=/^\s+|\s+$/g,S=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,C=/\{\n\/\* \[wrapped with (.+)\] \*/,A=/,? & /,O=/^[-+]0x[0-9a-f]+$/i,M=/^0b[01]+$/i,_=/^\[object .+?Constructor\]$/,T=/^0o[0-7]+$/i,N=/^(?:0|[1-9]\d*)$/,E=parseInt,D="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,P="object"==typeof self&&self&&self.Object===Object&&self,R=D||P||Function("return this")();function j(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function I(e){return e!=e}function L(e,t){for(var n=-1,i=e.length,r=0,o=[];++n2?F:void 0);function Q(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n,i=ce(n=e.prototype)?Y(n):{},s=e.apply(i,t);return ce(s)?s:i}}function ee(e,t,n,i,s,a,c,u,p,m){var g=t&f,b=t&r,y=t&o,v=t&(l|h),x=t&d,w=y?void 0:Q(e);return function r(){for(var o=arguments.length,l=Array(o),h=o;h--;)l[h]=arguments[h];if(v)var f=ne(r),d=function(e,t){for(var n=e.length,i=0;n--;)e[n]===t&&i++;return i}(l,f);if(i&&(l=function(e,t,n,i){for(var s=-1,r=e.length,o=n.length,a=-1,l=t.length,h=J(r-o,0),c=Array(l+h),u=!i;++a1&&l.reverse(),g&&p1?"& ":"")+t[i],t=t.join(n>2?", ":" "),e.replace(S,"{\n/* [wrapped with "+t+"] */\n")}function oe(e,t){return!!(t=null==t?m:t)&&("number"==typeof e||N.test(e))&&e>-1&&e%1==0&&e-1}(e,o)&&e.push(o))););var r,o}(y),e.sort()}function he(e,t,n){var s=function(e,t,n,s,a,f,d,p){var m=t&o;if(!m&&"function"!=typeof e)throw new TypeError(i);var g=s?s.length:0;if(g||(t&=~(c|u),s=a=void 0),d=void 0===d?d:J(ue(d),0),p=void 0===p?p:ue(p),g-=a?a.length:0,t&u){var b=s,y=a;s=a=void 0}var v=[e,t,n,s,a,b,y,f,d,p];if(e=v[0],t=v[1],n=v[2],s=v[3],a=v[4],!(p=v[9]=null==v[9]?m?0:e.length:J(v[9]-g,0))&&t&(l|h)&&(t&=~(l|h)),t&&t!=r)x=t==l||t==h?function(e,t,n){var i=Q(e);return function s(){for(var r=arguments.length,o=Array(r),a=r,l=ne(s);a--;)o[a]=arguments[a];var h=r<3&&o[0]!==l&&o[r-1]!==l?[]:L(o,l);return(r-=h.length){e.exports=function(e){var t={};function n(i){if(t[i])return t[i].exports;var s=t[i]={exports:{},id:i,loaded:!1};return e[i].call(s.exports,s,s.exports,n),s.loaded=!0,s.exports}return n.m=e,n.c=t,n.p="",n(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,s=(i=n(2))&&i.__esModule?i:{default:i};t.default=s.default,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n}(e,["activeClassName","activeIndex","activeStyle","autoEscape","caseSensitive","className","findChunks","highlightClassName","highlightStyle","highlightTag","sanitize","searchWords","textToHighlight","unhighlightTag","unhighlightClassName","unhighlightStyle"]),N=(0,r.findAll)({autoEscape:c,caseSensitive:f,findChunks:p,sanitize:w,searchWords:k,textToHighlight:S}),E=x,D=-1,P="",R=void 0,j=(0,l.default)((function(e){var t={};for(var n in e)t[n.toLowerCase()]=e[n];return t}));return(0,a.createElement)("span",i({className:d},T,{children:N.map((function(e,t){var i=S.substr(e.start,e.end-e.start);if(e.highlight){D++;var s;s="object"==typeof g?f?g[i]:(g=j(g))[i.toLowerCase()]:g;var r=D===+o;P=s+" "+(r?n:""),R=!0===r&&null!=h?Object.assign({},y,h):y;var l={children:i,className:P,key:t,style:R};return"string"!=typeof E&&(l.highlightIndex=D),(0,a.createElement)(E,l)}return(0,a.createElement)(A,{children:i,className:M,key:t,style:_})}))}))}h.propTypes={activeClassName:o.default.string,activeIndex:o.default.number,activeStyle:o.default.object,autoEscape:o.default.bool,className:o.default.string,findChunks:o.default.func,highlightClassName:o.default.oneOfType([o.default.object,o.default.string]),highlightStyle:o.default.object,highlightTag:o.default.oneOfType([o.default.node,o.default.func,o.default.string]),sanitize:o.default.func,searchWords:o.default.arrayOf(o.default.oneOfType([o.default.string,o.default.instanceOf(RegExp)])).isRequired,textToHighlight:o.default.string.isRequired,unhighlightTag:o.default.oneOfType([o.default.node,o.default.func,o.default.string]),unhighlightClassName:o.default.string,unhighlightStyle:o.default.object},e.exports=t.default},function(e,t){e.exports=function(e){var t={};function n(i){if(t[i])return t[i].exports;var s=t[i]={exports:{},id:i,loaded:!1};return e[i].call(s.exports,s,s.exports,n),s.loaded=!0,s.exports}return n.m=e,n.c=t,n.p="",n(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(2);Object.defineProperty(t,"combineChunks",{enumerable:!0,get:function(){return i.combineChunks}}),Object.defineProperty(t,"fillInChunks",{enumerable:!0,get:function(){return i.fillInChunks}}),Object.defineProperty(t,"findAll",{enumerable:!0,get:function(){return i.findAll}}),Object.defineProperty(t,"findChunks",{enumerable:!0,get:function(){return i.findChunks}})},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.findAll=function(e){var t=e.autoEscape,r=e.caseSensitive,o=void 0!==r&&r,a=e.findChunks,l=void 0===a?i:a,h=e.sanitize,c=e.searchWords,u=e.textToHighlight;return s({chunksToHighlight:n({chunks:l({autoEscape:t,caseSensitive:o,sanitize:h,searchWords:c,textToHighlight:u})}),totalLength:u?u.length:0})};var n=t.combineChunks=function(e){var t=e.chunks;return t.sort((function(e,t){return e.start-t.start})).reduce((function(e,t){if(0===e.length)return[t];var n=e.pop();if(t.start<=n.end){var i=Math.max(n.end,t.end);e.push({start:n.start,end:i})}else e.push(n,t);return e}),[])},i=function(e){var t=e.autoEscape,n=e.caseSensitive,i=e.sanitize,s=void 0===i?r:i,o=e.searchWords,a=e.textToHighlight;return a=s(a),o.filter((function(e){return e})).reduce((function(e,i){i=s(i),t&&(i=i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"));for(var r=new RegExp(i,n?"g":"gi"),o=void 0;o=r.exec(a);){var l=o.index,h=r.lastIndex;h>l&&e.push({start:l,end:h}),o.index==r.lastIndex&&r.lastIndex++}return e}),[])};t.findChunks=i;var s=t.fillInChunks=function(e){var t=e.chunksToHighlight,n=e.totalLength,i=[],s=function(e,t,n){t-e>0&&i.push({start:e,end:t,highlight:n})};if(0===t.length)s(0,n,!1);else{var r=0;t.forEach((function(e){s(r,e.start,!1),s(e.start,e.end,!0),r=e.end})),s(r,n,!1)}return i};function r(e){return e}}])},function(e,t,n){(function(t){if("production"!==t.env.NODE_ENV){var i="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103;e.exports=n(6)((function(e){return"object"==typeof e&&null!==e&&e.$$typeof===i}),!0)}else e.exports=n(13)()}).call(t,n(5))},function(e,t){var n,i,s=e.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===r||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:r}catch(e){n=r}try{i="function"==typeof clearTimeout?clearTimeout:o}catch(e){i=o}}();var l,h=[],c=!1,u=-1;function f(){c&&l&&(c=!1,l.length?h=l.concat(h):u=-1,h.length&&d())}function d(){if(!c){var e=a(f);c=!0;for(var t=h.length;t;){for(l=h,h=[];++u1)for(var n=1;n1?t-1:0),i=1;i2?n-2:0),r=2;r1&&void 0!==arguments[1]?arguments[1]:n,i=void 0,s=[],r=void 0,o=!1,a=function(e,n){return t(e,s[n])};return function(){for(var t=arguments.length,n=Array(t),l=0;l{"use strict";var i=n(7101),s=Array.prototype.concat,r=Array.prototype.slice,o=e.exports=function(e){for(var t=[],n=0,o=e.length;n{e.exports=function(e){return!(!e||"string"==typeof e)&&(e instanceof Array||Array.isArray(e)||e.length>=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&"String"!==e.constructor.name))}},6823:(e,t,n)=>{"use strict";var i=n(6816);i.TypeStyle,n(4894);var s=n(965);s.extend,s.classes,s.media;var r=new i.TypeStyle({autoGenerateTag:!0});r.setStylesTarget,r.cssRaw,r.cssRule,r.forceRenderStyles,r.fontFace,r.getStyles,r.keyframes,r.reinit,t.iF=r.style,r.stylesheet},1646:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertToStyles=function e(t){var n={};for(var i in t){var s=t[i];if("$nest"===i){var r=s;for(var o in r){var a=r[o];n[o]=e(a)}}else"$debugName"===i?n.$displayName=s:n[i]=s}return n},t.convertToKeyframes=function(e){var t={};for(var n in e)"$debugName"!==n&&(t[n]=e[n]);return e.$debugName&&(t.$displayName=e.$debugName),t}},6816:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(8101),s=n(1646),r=n(965),o=function(){return i.create()},a=function(){function e(e){var t=this,n=e.autoGenerateTag;this.cssRaw=function(e){e&&(t._raw+=e||"",t._pendingRawChange=!0,t._styleUpdated())},this.cssRule=function(e){for(var n=[],i=1;i{"use strict";function n(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},7213:(e,t,n)=>{"use strict";n.d(t,{Ar:()=>h,Bc:()=>F,Gw:()=>M,_5:()=>o,et:()=>l,wm:()=>P});var i=n(4830),s=n(3173),r=n(9587);class o{constructor(e,t,n,i){this.state=e,this.pos=t,this.explicit=n,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=(0,r.mv)(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),i=t.text.slice(n-t.from,this.pos-t.from),s=i.search(function(e,t){var n;let{source:i}=e,s=t&&"^"!=i[0],r="$"!=i[i.length-1];return s||r?new RegExp(`${s?"^":""}(?:${i})${r?"$":""}`,null!==(n=e.flags)&&void 0!==n?n:e.ignoreCase?"i":""):e}(e,!1));return s<0?null:{from:n+s,to:this.pos,text:i.slice(s)}}get aborted(){return null==this.abortListeners}addEventListener(e,t,n){"abort"==e&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function a(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function l(e){let t=e.map((e=>"string"==typeof e?{label:e}:e)),[n,i]=t.every((e=>/^\w+$/.test(e.label)))?[/\w*$/,/\w+$/]:function(e){let t=Object.create(null),n=Object.create(null);for(let{label:i}of e){t[i[0]]=!0;for(let e=1;e{let s=e.matchBefore(i);return s||e.explicit?{from:s?s.from:e.pos,options:t,validFor:n}:null}}function h(e,t){return n=>{for(let t=(0,r.mv)(n.state).resolveInner(n.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(n)}}const c=i.YH.define();"object"==typeof navigator&&navigator.platform;const u=s.Lz.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class f{constructor(e,t,n,i){this.field=e,this.line=t,this.from=n,this.to=i}}class d{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(e){let t=e.mapPos(this.from,-1,i.iR.TrackDel),n=e.mapPos(this.to,1,i.iR.TrackDel);return null==t||null==n?null:new d(this.field,t,n)}}class p{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],i=[t],s=e.doc.lineAt(t),o=/^\s*/.exec(s.text)[0];for(let s of this.lines){if(n.length){let n=o,a=/^\t*/.exec(s)[0].length;for(let t=0;tnew d(e.field,i[e.line]+e.from,i[e.line]+e.to)));return{text:n,ranges:a}}static parse(e){let t,n=[],i=[],s=[];for(let r of e.split(/\r\n?|\n/)){for(;t=/[#$]\{(?:(\d+)(?::([^}]*))?|((?:\\[{}]|[^}])*))\}/.exec(r);){let e=t[1]?+t[1]:null,o=t[2]||t[3]||"",a=-1,l=o.replace(/\\[{}]/g,(e=>e[1]));for(let t=0;t=a&&e.field++}s.push(new f(a,i.length,t.index,t.index+l.length)),r=r.slice(0,t.index)+o+r.slice(t.index+t[0].length)}r=r.replace(/\\([{}])/g,((e,t,n)=>{for(let e of s)e.line==i.length&&e.from>n&&(e.from--,e.to--);return t})),i.push(r)}return new p(i,s)}}let m=s.NZ.widget({widget:new class extends s.xO{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),g=s.NZ.mark({class:"cm-snippetField"});class b{constructor(e,t){this.ranges=e,this.active=t,this.deco=s.NZ.set(e.map((e=>(e.from==e.to?m:g).range(e.from,e.to))))}map(e){let t=[];for(let n of this.ranges){let i=n.map(e);if(!i)return null;t.push(i)}return new b(t,this.active)}selectionInsideField(e){return e.ranges.every((e=>this.ranges.some((t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))))}}const y=i.Pe.define({map:(e,t)=>e&&e.map(t)}),v=i.Pe.define(),x=i.sU.define({create:()=>null,update(e,t){for(let n of t.effects){if(n.is(y))return n.value;if(n.is(v)&&e)return new b(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>s.Lz.decorations.from(e,(e=>e?e.deco:s.NZ.none))});function w(e,t){return i.OF.create(e.filter((e=>e.field==t)).map((e=>i.OF.range(e.from,e.to))))}function k(e){let t=p.parse(e);return(e,n,s,r)=>{let{text:o,ranges:a}=t.instantiate(e.state,s),l={changes:{from:s,to:r,insert:i.EY.of(o)},scrollIntoView:!0,annotations:n?[c.of(n),i.ZX.userEvent.of("input.complete")]:void 0};if(a.length&&(l.selection=w(a,0)),a.some((e=>e.field>0))){let t=new b(a,0),n=l.effects=[y.of(t)];void 0===e.state.field(x,!1)&&n.push(i.Pe.appendConfig.of([x,O,_,u]))}e.dispatch(e.state.update(l))}}function S(e){return({state:t,dispatch:n})=>{let i=t.field(x,!1);if(!i||e<0&&0==i.active)return!1;let s=i.active+e,r=e>0&&!i.ranges.some((t=>t.field==s+e));return n(t.update({selection:w(i.ranges,s),effects:y.of(r?null:new b(i.ranges,s)),scrollIntoView:!0})),!0}}const C=[{key:"Tab",run:S(1),shift:S(-1)},{key:"Escape",run:({state:e,dispatch:t})=>!!e.field(x,!1)&&(t(e.update({effects:y.of(null)})),!0)}],A=i.sj.define({combine:e=>e.length?e[0]:C}),O=i.Nb.highest(s.w4.compute([A],(e=>e.facet(A))));function M(e,t){return Object.assign(Object.assign({},t),{apply:k(e)})}const _=s.Lz.domEventHandlers({mousedown(e,t){let n,i=t.state.field(x,!1);if(!i||null==(n=t.posAtCoords({x:e.clientX,y:e.clientY})))return!1;let s=i.ranges.find((e=>e.from<=n&&e.to>=n));return!(!s||s.field==i.active||(t.dispatch({selection:w(i.ranges,s.field),effects:y.of(i.ranges.some((e=>e.field>s.field))?new b(i.ranges,s.field):null),scrollIntoView:!0}),0))}}),T={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},N=i.Pe.define({map(e,t){let n=t.mapPos(e,-1,i.iR.TrackAfter);return null==n?void 0:n}}),E=new class extends i.FB{};E.startSide=1,E.endSide=-1;const D=i.sU.define({create:()=>i.om.empty,update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(N)&&(e=e.update({add:[E.range(n.value,n.value+1)]}));return e}});function P(){return[B,D]}const R="()[]{}<>";function j(e){for(let t=0;t<8;t+=2)if(R.charCodeAt(t)==e)return R.charAt(t+1);return(0,i.MK)(e<128?e:e+1)}function I(e,t){return e.languageDataAt("closeBrackets",t)[0]||T}const L="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),B=s.Lz.inputHandler.of(((e,t,n,s)=>{if((L?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let r=e.state.selection.main;if(s.length>2||2==s.length&&1==(0,i.Fh)((0,i.vS)(s,0))||t!=r.from||n!=r.to)return!1;let o=function(e,t){let n=I(e,e.selection.main.head),s=n.brackets||T.brackets;for(let r of s){let o=j((0,i.vS)(r,0));if(t==r)return o==r?V(e,r,s.indexOf(r+r+r)>-1,n):H(e,r,o,n.before||T.before);if(t==o&&z(e,e.selection.main.from))return q(e,0,o)}return null}(e.state,s);return!!o&&(e.dispatch(o),!0)})),F=[{key:"Backspace",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=I(e,e.selection.main.head).brackets||T.brackets,s=null,r=e.changeByRange((t=>{if(t.empty){let s=function(e,t){let n=e.sliceString(t-2,t);return(0,i.Fh)((0,i.vS)(n,0))==n.length?n:n.slice(1)}(e.doc,t.head);for(let r of n)if(r==s&&$(e.doc,t.head)==j((0,i.vS)(r,0)))return{changes:{from:t.head-r.length,to:t.head+r.length},range:i.OF.cursor(t.head-r.length)}}return{range:s=t}}));return s||t(e.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!s}}];function z(e,t){let n=!1;return e.field(D).between(0,e.doc.length,(e=>{e==t&&(n=!0)})),n}function $(e,t){let n=e.sliceString(t,t+2);return n.slice(0,(0,i.Fh)((0,i.vS)(n,0)))}function H(e,t,n,s){let r=null,o=e.changeByRange((o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:n,from:o.to}],effects:N.of(o.to+t.length),range:i.OF.range(o.anchor+t.length,o.head+t.length)};let a=$(e.doc,o.head);return!a||/\s/.test(a)||s.indexOf(a)>-1?{changes:{insert:t+n,from:o.head},effects:N.of(o.head+t.length),range:i.OF.cursor(o.head+t.length)}:{range:r=o}}));return r?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function q(e,t,n){let s=null,r=e.changeByRange((t=>t.empty&&$(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:i.OF.cursor(t.head+n.length)}:s={range:t}));return s?null:e.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function V(e,t,n,s){let o=s.stringPrefixes||T.stringPrefixes,a=null,l=e.changeByRange((s=>{if(!s.empty)return{changes:[{insert:t,from:s.from},{insert:t,from:s.to}],effects:N.of(s.to+t.length),range:i.OF.range(s.anchor+t.length,s.head+t.length)};let l,h=s.head,c=$(e.doc,h);if(c==t){if(W(e,h))return{changes:{insert:t+t,from:h},effects:N.of(h+t.length),range:i.OF.cursor(h+t.length)};if(z(e,h)){let s=n&&e.sliceDoc(h,h+3*t.length)==t+t+t?t+t+t:t;return{changes:{from:h,to:h+s.length,insert:s},range:i.OF.cursor(h+s.length)}}}else{if(n&&e.sliceDoc(h-2*t.length,h)==t+t&&(l=G(e,h-2*t.length,o))>-1&&W(e,l))return{changes:{insert:t+t+t+t,from:h},effects:N.of(h+t.length),range:i.OF.cursor(h+t.length)};if(e.charCategorizer(h)(c)!=i.Je.Word&&G(e,h,o)>-1&&!function(e,t,n,i){let s=(0,r.mv)(e).resolveInner(t,-1),o=i.reduce(((e,t)=>Math.max(e,t.length)),0);for(let r=0;r<5;r++){let r=e.sliceDoc(s.from,Math.min(s.to,s.from+n.length+o)),a=r.indexOf(n);if(!a||a>-1&&i.indexOf(r.slice(0,a))>-1){let t=s.firstChild;for(;t&&t.from==s.from&&t.to-t.from>n.length+a;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let l=s.to==t&&s.parent;if(!l)break;s=l}return!1}(e,h,t,o))return{changes:{insert:t+t,from:h},effects:N.of(h+t.length),range:i.OF.cursor(h+t.length)}}return{range:a=s}}));return a?null:e.update(l,{scrollIntoView:!0,userEvent:"input.type"})}function W(e,t){let n=(0,r.mv)(e).resolveInner(t+1);return n.parent&&n.from==t}function G(e,t,n){let s=e.charCategorizer(t);if(s(e.sliceDoc(t-1,t))!=i.Je.Word)return t;for(let r of n){let n=t-r.length;if(e.sliceDoc(n,t)==r&&s(e.sliceDoc(n-1,n))!=i.Je.Word)return n}return-1}},9587:(e,t,n)=>{"use strict";n.d(t,{Ay:()=>F,EI:()=>N,KB:()=>D,Lv:()=>ce,Oh:()=>P,Q0:()=>u,Q_:()=>Te,SG:()=>_e,TM:()=>f,Tg:()=>Be,WD:()=>V,Xt:()=>_,Yy:()=>A,Zt:()=>ve,_Y:()=>$,_v:()=>E,b_:()=>G,bj:()=>p,cr:()=>fe,iB:()=>h,jU:()=>De,mv:()=>m,mz:()=>H,nq:()=>y,p9:()=>c,t:()=>W,t$:()=>O,tp:()=>T,y9:()=>ge,yd:()=>U});var i,s=n(9066),r=n(4830),o=n(3173),a=n(9913),l=n(8104);const h=new s.uY;function c(e){return r.sj.define({combine:e?t=>t.concat(e):void 0})}const u=new s.uY;class f{constructor(e,t,n=[],i=""){this.data=e,this.name=i,r.$t.prototype.hasOwnProperty("tree")||Object.defineProperty(r.$t.prototype,"tree",{get(){return m(this)}}),this.parser=t,this.extension=[C.of(this),r.$t.languageData.of(((e,t,n)=>{let i=d(e,t,n),s=i.type.prop(h);if(!s)return[];let r=e.facet(s),o=i.type.prop(u);if(o){let s=i.resolve(t-i.from,n);for(let t of o)if(t.test(s,e)){let n=e.facet(t.facet);return"replace"==t.type?n:n.concat(r)}}return r}))].concat(n)}isActiveAt(e,t,n=-1){return d(e,t,n).type.prop(h)==this.data}findRegions(e){let t=e.facet(C);if((null==t?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],i=(e,t)=>{if(e.prop(h)==this.data)return void n.push({from:t,to:t+e.length});let r=e.prop(s.uY.mounted);if(r){if(r.tree.prop(h)==this.data){if(r.overlay)for(let e of r.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(r.overlay){let e=n.length;if(i(r.tree,r.overlay[0].from+t),n.length>e)return}}for(let n=0;ne.isTop?t:void 0))]}),e.name)}configure(e,t){return new p(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function m(e){let t=e.field(f.state,!1);return t?t.tree:s.PH.empty}class g{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let b=null;class y{constructor(e,t,n=[],i,s,r,o,a){this.parser=e,this.state=t,this.fragments=n,this.tree=i,this.treeLen=s,this.viewport=r,this.skipped=o,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new y(e,t,[],s.PH.empty,0,n,[],null)}startParse(){return this.parser.startParse(new g(this.state.doc),this.fragments)}work(e,t){return null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=s.PH.empty&&this.isDone(null!=t?t:this.state.doc.length)?(this.takeTree(),!0):this.withContext((()=>{var n;if("number"==typeof e){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||(this.parse=this.startParse()),null!=t&&(null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&t=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext((()=>{for(;!(t=this.parse.advance()););})),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(s.rr.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=b;b=this;try{return e()}finally{b=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=v(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:i,treeLen:r,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let t=[];if(e.iterChangedRanges(((e,n,i,s)=>t.push({fromA:e,toA:n,fromB:i,toB:s}))),n=s.rr.applyChanges(n,t),i=s.PH.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let t of this.skipped){let n=e.mapPos(t.from,1),i=e.mapPos(t.to,-1);ne.from&&(this.fragments=v(this.fragments,n,i),this.skipped.splice(t--,1))}return!(this.skipped.length>=t||(this.reset(),0))}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends s.iX{createParse(t,n,i){let r=i[0].from,o=i[i.length-1].to;return{parsedPos:r,advance(){let t=b;if(t){for(let e of i)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=o,new s.PH(s.Z6.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&0==t[0].from&&t[0].to>=e}static get(){return b}}function v(e,t,n){return s.rr.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class x{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new x(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=y.create(e.facet(C).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new x(n)}}f.state=r.sU.define({create:x.init,update(e,t){for(let e of t.effects)if(e.is(f.setState))return e.value;return t.startState.facet(C)!=t.state.facet(C)?x.init(t.state):e.apply(t)}});let w=e=>{let t=setTimeout((()=>e()),500);return()=>clearTimeout(t)};"undefined"!=typeof requestIdleCallback&&(w=e=>{let t=-1,n=setTimeout((()=>{t=requestIdleCallback(e,{timeout:400})}),100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const k="undefined"!=typeof navigator&&(null===(i=navigator.scheduling)||void 0===i?void 0:i.isInputPending)?()=>navigator.scheduling.isInputPending():null,S=o.Z9.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(f.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(f.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=w(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEndi+1e3,a=s.context.work((()=>k&&k()||Date.now()>r),i+(o?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:f.setState.of(new x(s.context))})),this.chunkBudget>0&&(!a||o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then((()=>this.scheduleWork())).catch((e=>(0,o.c_)(this.view.state,e))).then((()=>this.workScheduled--)),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),C=r.sj.define({combine:e=>e.length?e[0]:null,enables:e=>[f.state,S,o.Lz.contentAttributes.compute([e],(t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}}))]});class A{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}class O{constructor(e,t,n,i,s,r=void 0){this.name=e,this.alias=t,this.extensions=n,this.filename=i,this.loadFunc=s,this.support=r,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then((e=>this.support=e),(e=>{throw this.loading=null,e})))}static of(e){let{load:t,support:n}=e;if(!t){if(!n)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");t=()=>Promise.resolve(n)}return new O(e.name,(e.alias||[]).concat(e.name).map((e=>e.toLowerCase())),e.extensions||[],e.filename,t,n)}static matchFilename(e,t){for(let n of e)if(n.filename&&n.filename.test(t))return n;let n=/\.([^.]+)$/.exec(t);if(n)for(let t of e)if(t.extensions.indexOf(n[1])>-1)return t;return null}static matchLanguageName(e,t,n=!0){t=t.toLowerCase();for(let n of e)if(n.alias.some((e=>e==t)))return n;if(n)for(let n of e)for(let e of n.alias){let i=t.indexOf(e);if(i>-1&&(e.length>2||!/\w/.test(t[i-1])&&!/\w/.test(t[i+e.length])))return n}return null}}const M=r.sj.define(),_=r.sj.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some((e=>e!=t[0])))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function T(e){let t=e.facet(_);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function N(e,t){let n="",i=e.tabSize,s=e.facet(_)[0];if("\t"==s){for(;t>=i;)n+="\t",t-=i;s=" "}for(let e=0;e=t?function(e,t,n){let i=t.resolveStack(n),s=i.node.enterUnfinishedNodesBefore(n);if(s!=i.node){let e=[];for(let t=s;t!=i.node;t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)i={node:e[t],next:i}}return R(i,e,n)}(e,n,t):null}class D{constructor(e,t={}){this.state=e,this.options=t,this.unit=T(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return null!=i&&i>=n.from&&i<=n.to?s&&i==e?{text:"",from:e}:(t<0?i-1&&(s+=r-this.countColumn(n,n.search(/\S|$/))),s}countColumn(e,t=e.length){return(0,r.y$)(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:i}=this.lineAt(e,t),s=this.options.overrideIndentation;if(s){let e=s(i);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const P=new s.uY;function R(e,t,n){for(let i=e;i;i=i.next){let e=j(i.node);if(e)return e(L.create(t,n,i))}return 0}function j(e){let t=e.type.prop(P);if(t)return t;let n,i=e.firstChild;if(i&&(n=i.type.prop(s.uY.closedBy))){let t=e.lastChild,i=t&&n.indexOf(t.name)>-1;return e=>z(e,!0,1,void 0,i&&!function(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}(e)?t.from:void 0)}return null==e.parent?I:null}function I(){return 0}class L extends D{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new L(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(B(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return R(this.context.next,this.base,this.pos)}}function B(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function F({closing:e,align:t=!0,units:n=1}){return i=>z(i,t,n,e)}function z(e,t,n,i,s){let r=e.textAfter,o=r.match(/^\s*/)[0].length,a=i&&r.slice(o,o+i.length)==i||s==e.pos+o,l=t?function(e){let t=e.node,n=t.childAfter(t.from),i=t.lastChild;if(!n)return null;let s=e.options.simulateBreak,r=e.state.doc.lineAt(n.from),o=null==s||s<=r.from?r.to:Math.min(r.to,s);for(let e=n.to;;){let s=t.childAfter(e);if(!s||s==i)return null;if(!s.type.isSkipped)return s.frome.baseIndent;function H({except:e,units:t=1}={}){return n=>{let i=e&&e.test(n.textAfter);return n.baseIndent+(i?0:t*n.unit)}}const q=200;function V(){return r.$t.transactionFilter.of((e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:i}=e.newSelection.main,s=n.lineAt(i);if(i>s.from+q)return e;let r=n.sliceString(s.from,i);if(!t.some((e=>e.test(r))))return e;let{state:o}=e,a=-1,l=[];for(let{head:e}of o.selection.ranges){let t=o.doc.lineAt(e);if(t.from==a)continue;a=t.from;let n=E(o,t.from);if(null==n)continue;let i=/^\s*/.exec(t.text)[0],s=N(o,n);i!=s&&l.push({from:t.from,to:t.from+i.length,insert:s})}return l.length?[e,{changes:l,sequential:!0}]:e}))}const W=r.sj.define(),G=new s.uY;function U(e){let t=e.firstChild,n=e.lastChild;return t&&t.ton)continue;if(s&&o.from=t&&i.to>n&&(s=i)}}return s}(e,t,n)}function J(e,t){let n=t.mapPos(e.from,1),i=t.mapPos(e.to,-1);return n>=i?void 0:{from:n,to:i}}const X=r.Pe.define({map:J}),Z=r.Pe.define({map:J}),Q=r.sU.define({create:()=>o.NZ.none,update(e,t){e=e.map(t.changes);for(let n of t.effects)if(n.is(X)&&!te(e,n.value.from,n.value.to)){let{preparePlaceholder:i}=t.state.facet(ie),s=i?o.NZ.replace({widget:new ae(i(t.state,n.value))}):oe;e=e.update({add:[s.range(n.value.from,n.value.to)]})}else n.is(Z)&&(e=e.update({filter:(e,t)=>n.value.from!=e||n.value.to!=t,filterFrom:n.value.from,filterTo:n.value.to}));if(t.selection){let n=!1,{head:i}=t.selection.main;e.between(i,i,((e,t)=>{ei&&(n=!0)})),n&&(e=e.update({filterFrom:i,filterTo:i,filter:(e,t)=>t<=i||e>=i}))}return e},provide:e=>o.Lz.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,((e,t)=>{n.push(e,t)})),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let n=0;n{(!s||s.from>e)&&(s={from:e,to:t})})),s}function te(e,t,n){let i=!1;return e.between(t,t,((e,s)=>{e==t&&s==n&&(i=!0)})),i}const ne={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},ie=r.sj.define({combine:e=>(0,r.QR)(e,ne)});function se(e){let t=[Q,ue];return e&&t.push(ie.of(e)),t}function re(e,t){let{state:n}=e,i=n.facet(ie),s=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),i=ee(e.state,n.from,n.to);i&&e.dispatch({effects:Z.of(i)}),t.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(e,s,t);let r=document.createElement("span");return r.textContent=i.placeholderText,r.setAttribute("aria-label",n.phrase("folded code")),r.title=n.phrase("unfold"),r.className="cm-foldPlaceholder",r.onclick=s,r}const oe=o.NZ.replace({widget:new class extends o.xO{toDOM(e){return re(e,null)}}});class ae extends o.xO{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return re(e,this.value)}}const le={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class he extends o.wJ{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function ce(e={}){let t=Object.assign(Object.assign({},le),e),n=new he(t,!0),i=new he(t,!1),s=o.Z9.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(C)!=e.state.facet(C)||e.startState.field(Q,!1)!=e.state.field(Q,!1)||m(e.startState)!=m(e.state)||t.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let t=new r.vB;for(let s of e.viewportLineBlocks){let r=ee(e.state,s.from,s.to)?i:Y(e.state,s.from,s.to)?n:null;r&&t.add(s.from,s.from,r)}return t.finish()}}),{domEventHandlers:a}=t;return[s,(0,o.cU)({class:"cm-foldGutter",markers(e){var t;return(null===(t=e.plugin(s))||void 0===t?void 0:t.markers)||r.om.empty},initialSpacer:()=>new he(t,!1),domEventHandlers:Object.assign(Object.assign({},a),{click:(e,t,n)=>{if(a.click&&a.click(e,t,n))return!0;let i=ee(e.state,t.from,t.to);if(i)return e.dispatch({effects:Z.of(i)}),!0;let s=Y(e.state,t.from,t.to);return!!s&&(e.dispatch({effects:X.of(s)}),!0)}})}),se()]}const ue=o.Lz.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class fe{constructor(e,t){let n;function i(e){let t=l.G.newName();return(n||(n=Object.create(null)))["."+t]=e,t}this.specs=e;const s="string"==typeof t.all?t.all:t.all?i(t.all):void 0,r=t.scope;this.scope=r instanceof f?e=>e.prop(h)==r.data:r?e=>e==r:void 0,this.style=(0,a.az)(e.map((e=>({tag:e.tag,class:e.class||i(Object.assign({},e,{tag:null}))}))),{all:s}).style,this.module=n?new l.G(n):null,this.themeType=t.themeType}static define(e,t){return new fe(e,t||{})}}const de=r.sj.define(),pe=r.sj.define({combine:e=>e.length?[e[0]]:null});function me(e){let t=e.facet(de);return t.length?t:e.facet(pe)}function ge(e,t){let n,i=[ye];return e instanceof fe&&(e.module&&i.push(o.Lz.styleModule.of(e.module)),n=e.themeType),(null==t?void 0:t.fallback)?i.push(pe.of(e)):n?i.push(de.computeN([o.Lz.darkTheme],(t=>t.facet(o.Lz.darkTheme)==("dark"==n)?[e]:[]))):i.push(de.of(e)),i}class be{constructor(e){this.markCache=Object.create(null),this.tree=m(e.state),this.decorations=this.buildDeco(e,me(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=m(e.state),n=me(e.state),i=n!=me(e.startState),{viewport:s}=e.view,r=e.changes.mapPos(this.decoratedTo,1);t.length=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=r):(t!=this.tree||e.viewportChanged||i)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=s.to)}buildDeco(e,t){if(!t||!this.tree.length)return o.NZ.none;let n=new r.vB;for(let{from:i,to:s}of e.visibleRanges)(0,a.DM)(this.tree,t,((e,t,i)=>{n.add(e,t,this.markCache[i]||(this.markCache[i]=o.NZ.mark({class:i})))}),i,s);return n.finish()}}const ye=r.Nb.high(o.Z9.fromClass(be,{decorations:e=>e.decorations})),ve=fe.define([{tag:a._A.meta,color:"#404740"},{tag:a._A.link,textDecoration:"underline"},{tag:a._A.heading,textDecoration:"underline",fontWeight:"bold"},{tag:a._A.emphasis,fontStyle:"italic"},{tag:a._A.strong,fontWeight:"bold"},{tag:a._A.strikethrough,textDecoration:"line-through"},{tag:a._A.keyword,color:"#708"},{tag:[a._A.atom,a._A.bool,a._A.url,a._A.contentSeparator,a._A.labelName],color:"#219"},{tag:[a._A.literal,a._A.inserted],color:"#164"},{tag:[a._A.string,a._A.deleted],color:"#a11"},{tag:[a._A.regexp,a._A.escape,a._A.special(a._A.string)],color:"#e40"},{tag:a._A.definition(a._A.variableName),color:"#00f"},{tag:a._A.local(a._A.variableName),color:"#30a"},{tag:[a._A.typeName,a._A.namespace],color:"#085"},{tag:a._A.className,color:"#167"},{tag:[a._A.special(a._A.variableName),a._A.macroName],color:"#256"},{tag:a._A.definition(a._A.propertyName),color:"#00c"},{tag:a._A.comment,color:"#940"},{tag:a._A.invalid,color:"#f00"}]),xe=o.Lz.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),we=1e4,ke="()[]{}",Se=r.sj.define({combine:e=>(0,r.QR)(e,{afterCursor:!0,brackets:ke,maxScanDistance:we,renderMatch:Oe})}),Ce=o.NZ.mark({class:"cm-matchingBracket"}),Ae=o.NZ.mark({class:"cm-nonmatchingBracket"});function Oe(e){let t=[],n=e.matched?Ce:Ae;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}const Me=[r.sU.define({create:()=>o.NZ.none,update(e,t){if(!t.docChanged&&!t.selection)return e;let n=[],i=t.state.facet(Se);for(let e of t.state.selection.ranges){if(!e.empty)continue;let s=De(t.state,e.head,-1,i)||e.head>0&&De(t.state,e.head-1,1,i)||i.afterCursor&&(De(t.state,e.head,1,i)||e.heado.Lz.decorations.from(e)}),xe];function _e(e={}){return[Se.of(e),Me]}const Te=new s.uY;function Ne(e,t,n){let i=e.prop(t<0?s.uY.openedBy:s.uY.closedBy);if(i)return i;if(1==e.name.length){let i=n.indexOf(e.name);if(i>-1&&i%2==(t<0?1:0))return[n[i+t]]}return null}function Ee(e){let t=e.type.prop(Te);return t?t(e.node):e}function De(e,t,n,i={}){let s=i.maxScanDistance||we,r=i.brackets||ke,o=m(e),a=o.resolveInner(t,n);for(let e=a;e;e=e.parent){let i=Ne(e.type,n,r);if(i&&e.from0?t>=s.from&&ts.from&&t<=s.to))return Pe(0,0,n,e,s,i,r)}}return function(e,t,n,i,s,r,o){let a=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),l=o.indexOf(a);if(l<0||l%2==0!=n>0)return null;let h={from:n<0?t-1:t,to:n>0?t+1:t},c=e.doc.iterRange(t,n>0?e.doc.length:0),u=0;for(let e=0;!c.next().done&&e<=r;){let r=c.value;n<0&&(e+=r.length);let a=t+e*n;for(let e=n>0?0:r.length-1,t=n>0?r.length:-1;e!=t;e+=n){let t=o.indexOf(r[e]);if(!(t<0||i.resolveInner(a+e,1).type!=s))if(t%2==0==n>0)u++;else{if(1==u)return{start:h,end:{from:a+e,to:a+e+1},matched:t>>1==l>>1};u--}}n>0&&(e+=r.length)}return c.done?{start:h,matched:!1}:null}(e,t,n,o,a.type,s,r)}function Pe(e,t,n,i,s,r,o){let a=i.parent,l={from:s.from,to:s.to},h=0,c=null==a?void 0:a.cursor();if(c&&(n<0?c.childBefore(i.from):c.childAfter(i.to)))do{if(n<0?c.to<=i.from:c.from>=i.to){if(0==h&&r.indexOf(c.type.name)>-1&&c.from=this.string.length}sol(){return 0==this.pos}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.post}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosn?e.toLowerCase():e;return i(this.string.substr(this.pos,e.length))==i(e)?(!1!==t&&(this.pos+=e.length),!0):null}{let n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&!1!==t&&(this.pos+=n[0].length),n)}}current(){return this.string.slice(this.start,this.pos)}}function Ie(e){if("object"!=typeof e)return e;let t={};for(let n in e){let i=e[n];t[n]=i instanceof Array?i.slice():i}return t}const Le=new WeakMap;class Be extends f{constructor(e){let t,n=c(e.languageData),i={name:(r=e).name||"",token:r.token,blankLine:r.blankLine||(()=>{}),startState:r.startState||(()=>!0),copyState:r.copyState||Ie,indent:r.indent||(()=>null),languageData:r.languageData||{},tokenTable:r.tokenTable||qe};var r;super(n,new class extends s.iX{createParse(e,n,i){return new $e(t,e,n,i)}},[M.of(((e,t)=>this.getIndent(e,t)))],e.name),this.topNode=function(e){let t=s.Z6.define({id:Ve.length,name:"Document",props:[h.add((()=>e))],top:!0});return Ve.push(t),t}(n),t=this,this.streamParser=i,this.stateAfter=new s.uY({perNode:!0}),this.tokenTable=e.tokenTable?new Ye(i.tokenTable):Je}static define(e){return new Be(e)}getIndent(e,t){let n,i=m(e.state),s=i.resolve(t);for(;s&&s.type!=this.topNode;)s=s.parent;if(!s)return null;let{overrideIndentation:r}=e.options;r&&(n=Le.get(e.state),null!=n&&n1e4)return null;for(;o=i&&n+t.length<=r&&t.prop(e.stateAfter);if(o)return{state:e.streamParser.copyState(o),pos:n+t.length};for(let o=t.children.length-1;o>=0;o--){let a=t.children[o],l=n+t.positions[o],h=a instanceof s.PH&&l=t.length)return t;r||t.type!=e.topNode||(r=!0);for(let o=t.children.length-1;o>=0;o--){let a,l=t.positions[o],h=t.children[o];if(ln&&Fe(e,i.tree,0-i.offset,n,r);if(o&&(t=ze(e,i.tree,n+i.offset,o.pos+i.offset,!1)))return{state:o.state,tree:t}}return{state:e.streamParser.startState(i?T(i):4),tree:s.PH.empty}}(e,n,o,null==r?void 0:r.state);this.state=a,this.parsedPos=this.chunkStart=o+l.length;for(let e=0;e=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)"\n"==t&&(t="");else{let e=t.indexOf("\n");e>-1&&(t=t.slice(0,e))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),n=e+t.length;for(let e=this.rangeIndex;;){let i=this.ranges[e].to;if(i>=n)break;if(t=t.slice(0,i-(n-t.length)),e++,e==this.ranges.length)break;let s=this.ranges[e].from,r=this.lineAfter(s);t+=r,n=s+r.length}return{line:t,end:n}}skipGapsTo(e,t,n){for(;;){let i=this.ranges[this.rangeIndex].to,s=e+t;if(n>0?i>s:i>=s)break;t+=this.ranges[++this.rangeIndex].from-i}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){t+=s=this.skipGapsTo(t,s,1);let e=this.chunk.length;n+=s=this.skipGapsTo(n,s,-1),i+=this.chunk.length-e}return this.chunk.push(e,t,n,i),s}parseLine(e){let{line:t,end:n}=this.nextLine(),i=0,{streamParser:s}=this.lang,r=new je(t,e?e.state.tabSize:4,e?T(e.state):2);if(r.eol())s.blankLine(this.state,r.indentUnit);else for(;!r.eol();){let e=He(s.token,r,this.state);if(e&&(i=this.emitToken(this.lang.tokenTable.resolve(e),this.parsedPos+r.start,this.parsedPos+r.pos,4,i)),r.start>1e4)break}this.parsedPos=n,this.moveRangeIndex(),this.parsedPost.start)return i}throw new Error("Stream parser failed to advance stream.")}const qe=Object.create(null),Ve=[s.Z6.none],We=new s.fI(Ve),Ge=[],Ue=Object.create(null),Ke=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Ke[e]=Ze(qe,t);class Ye{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),Ke)}resolve(e){return e?this.table[e]||(this.table[e]=Ze(this.extra,e)):0}}const Je=new Ye(qe);function Xe(e,t){Ge.indexOf(e)>-1||(Ge.push(e),console.warn(t))}function Ze(e,t){let n=[];for(let i of t.split(" ")){let t=[];for(let n of i.split(".")){let i=e[n]||a._A[n];i?"function"==typeof i?t.length?t=t.map(i):Xe(n,`Modifier ${n} used at start of tag`):t.length?Xe(n,`Tag ${n} used as modifier`):t=Array.isArray(i)?i:[i]:Xe(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let i=t.replace(/ /g,"_"),r=i+" "+n.map((e=>e.id)),o=Ue[r];if(o)return o.id;let l=Ue[r]=s.Z6.define({id:Ve.length,name:i,props:[(0,a.pn)({[i]:n})]});return Ve.push(l),l.id}o.OP.RTL,o.OP.LTR},4830:(e,t,n)=>{"use strict";n.d(t,{$t:()=>ke,EY:()=>i,FB:()=>Ce,Fh:()=>C,Gu:()=>M,Je:()=>ve,MK:()=>S,Nb:()=>K,OF:()=>I,Pe:()=>ue,QR:()=>Se,VR:()=>_,YH:()=>le,ZX:()=>fe,iR:()=>O,kn:()=>$e,om:()=>_e,sU:()=>G,sj:()=>F,vB:()=>Te,vS:()=>k,xx:()=>J,y$:()=>ze,zK:()=>b});class i{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=f(this,e,t);let i=[];return this.decompose(0,e,i,2),n.length&&n.decompose(0,n.length,i,3),this.decompose(t,this.length,i,1),r.from(i,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=f(this,e,t);let n=[];return this.decompose(e,t,n,0),r.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),i=new l(this),s=new l(e);for(let e=t,r=t;;){if(i.next(e),s.next(e),e=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(r+=i.value.length,i.done||r>=n)return!0}}iter(e=1){return new l(this,e)}iterRange(e,t=this.length){return new h(this,e,t)}iterLines(e,t){let n;if(null==e)n=this.iter();else{null==t&&(t=this.lines+1);let i=this.line(e).from;n=this.iterRange(i,Math.max(i,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new c(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(0==e.length)throw new RangeError("A document must have at least one line");return 1!=e.length||e[0]?e.length<=32?new s(e):r.from(s.split(e,[])):i.empty}}class s extends i{constructor(e,t=function(e){let t=-1;for(let n of e)t+=n.length+1;return t}(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,i){for(let s=0;;s++){let r=this.text[s],o=i+r.length;if((t?n:o)>=e)return new u(i,o,n,r);i=o+1,n++}}decompose(e,t,n,i){let r=e<=0&&t>=this.length?this:new s(a(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(1&i){let e=n.pop(),t=o(r.text,e.text.slice(),0,r.length);if(t.length<=32)n.push(new s(t,e.length+r.length));else{let e=t.length>>1;n.push(new s(t.slice(0,e)),new s(t.slice(e)))}}else n.push(r)}replace(e,t,n){if(!(n instanceof s))return super.replace(e,t,n);[e,t]=f(this,e,t);let i=o(this.text,o(n.text,a(this.text,0,e)),t),l=this.length+n.length-(t-e);return i.length<=32?new s(i,l):r.from(s.split(i,[]),l)}sliceString(e,t=this.length,n="\n"){[e,t]=f(this,e,t);let i="";for(let s=0,r=0;s<=t&&re&&r&&(i+=n),es&&(i+=o.slice(Math.max(0,e-s),t-s)),s=a+1}return i}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],i=-1;for(let r of e)n.push(r),i+=r.length+1,32==n.length&&(t.push(new s(n,i)),n=[],i=-1);return i>-1&&t.push(new s(n,i)),t}}class r extends i{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,i){for(let s=0;;s++){let r=this.children[s],o=i+r.length,a=n+r.lines-1;if((t?a:o)>=e)return r.lineInner(e,t,n,i);i=o+1,n=a+1}}decompose(e,t,n,i){for(let s=0,r=0;r<=t&&s=r){let s=i&((r<=e?1:0)|(a>=t?2:0));r>=e&&a<=t&&!s?n.push(o):o.decompose(e-r,t-r,n,s)}r=a+1}}replace(e,t,n){if([e,t]=f(this,e,t),n.lines=s&&t<=a){let l=o.replace(e-s,t-s,n),h=this.lines-o.lines+l.lines;if(l.lines>4&&l.lines>h>>6){let s=this.children.slice();return s[i]=l,new r(s,this.length-(t-e)+n.length)}return super.replace(s,a,l)}s=a+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n="\n"){[e,t]=f(this,e,t);let i="";for(let s=0,r=0;se&&s&&(i+=n),er&&(i+=o.sliceString(e-r,t-r,n)),r=a+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof r))return 0;let n=0,[i,s,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,s+=t){if(i==o||s==a)return n;let r=this.children[i],l=e.children[s];if(r!=l)return n+r.scanIdentical(l,t);n+=r.length+1}}static from(e,t=e.reduce(((e,t)=>e+t.length+1),-1)){let n=0;for(let t of e)n+=t.lines;if(n<32){let n=[];for(let t of e)t.flatten(n);return new s(n,t)}let i=Math.max(32,n>>5),o=i<<1,a=i>>1,l=[],h=0,c=-1,u=[];function f(e){let t;if(e.lines>o&&e instanceof r)for(let t of e.children)f(t);else e.lines>a&&(h>a||!h)?(d(),l.push(e)):e instanceof s&&h&&(t=u[u.length-1])instanceof s&&e.lines+t.lines<=32?(h+=e.lines,c+=e.length+1,u[u.length-1]=new s(t.text.concat(e.text),t.length+1+e.length)):(h+e.lines>i&&d(),h+=e.lines,c+=e.length+1,u.push(e))}function d(){0!=h&&(l.push(1==u.length?u[0]:r.from(u,c)),c=-1,h=u.length=0)}for(let t of e)f(t);return d(),1==l.length?l[0]:new r(l,t)}}function o(e,t,n=0,i=1e9){for(let s=0,r=0,o=!0;r=n&&(l>i&&(a=a.slice(0,i-s)),s0?1:(e instanceof s?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,i=this.nodes[n],r=this.offsets[n],o=r>>1,a=i instanceof s?i.text.length:i.children.length;if(o==(t>0?a:0)){if(0==n)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&r)==(t>0?0:1)){if(this.offsets[n]+=t,0==e)return this.lineBreak=!0,this.value="\n",this;e--}else if(i instanceof s){let s=i.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,s.length>Math.max(0,e))return this.value=0==e?s:t>0?s.slice(e):s.slice(0,s.length-e),this;e-=s.length}else{let r=i.children[o+(t<0?-1:0)];e>r.length?(e-=r.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(r),this.offsets.push(t>0?1:(r instanceof s?r.text.length:r.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class h{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new l(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=n?i:t<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class c{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:i}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(i.prototype[Symbol.iterator]=function(){return this.iter()},l.prototype[Symbol.iterator]=h.prototype[Symbol.iterator]=c.prototype[Symbol.iterator]=function(){return this});class u{constructor(e,t,n,i){this.from=e,this.to=t,this.number=n,this.text=i}get length(){return this.to-this.from}}function f(e,t,n){return[t=Math.max(0,Math.min(e.length,t)),Math.max(t,Math.min(e.length,n))]}let d="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((e=>e?parseInt(e,36):1));for(let e=1;ee)return d[t-1]<=e;return!1}function m(e){return e>=127462&&e<=127487}const g=8205;function b(e,t,n=!0,i=!0){return(n?y:v)(e,t,i)}function y(e,t,n){if(t==e.length)return t;t&&x(e.charCodeAt(t))&&w(e.charCodeAt(t-1))&&t--;let i=k(e,t);for(t+=C(i);t=0&&m(k(e,i));)n++,i-=2;if(n%2==0)break;t+=2}}}return t}function v(e,t,n){for(;t>0;){let i=y(e,t-2,n);if(i=56320&&e<57344}function w(e){return e>=55296&&e<56320}function k(e,t){let n=e.charCodeAt(t);if(!w(n)||t+1==e.length)return n;let i=e.charCodeAt(t+1);return x(i)?i-56320+(n-55296<<10)+65536:n}function S(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}function C(e){return e<65536?1:2}const A=/\r\n?|\n/;var O=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(O||(O={}));class M{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return s+(e-i);s+=o}else{if(n!=O.Simple&&l>=e&&(n==O.TrackDel&&ie||n==O.TrackBefore&&ie))return null;if(l>e||l==e&&t<0&&!o)return e==i||t<0?s:s+a;s+=a}i=l}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,t=e){for(let n=0,i=0;n=0&&i<=t&&s>=e)return!(it)||"cover";i=s}return!1}toString(){let e="";for(let t=0;t=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some((e=>"number"!=typeof e)))throw new RangeError("Invalid JSON representation of ChangeDesc");return new M(e)}static create(e){return new M(e)}}class _ extends M{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return E(this,((t,n,i,s,r)=>e=e.replace(i,i+(n-t),r)),!1),e}mapDesc(e,t=!1){return D(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let s=0,r=0;s=0){t[s]=a,t[s+1]=o;let l=s>>1;for(;n.length0&&N(n,t,s.text),s.forward(e),o+=e}let l=e[r++];for(;o>1].toJSON()))}return e}static of(e,t,n){let s=[],r=[],o=0,a=null;function l(e=!1){if(!e&&!s.length)return;oa||e<0||a>t)throw new RangeError(`Invalid change range ${e} to ${a} (in doc of length ${t})`);let u=c?"string"==typeof c?i.of(c.split(n||A)):c:i.empty,f=u.length;if(e==a&&0==f)return;eo&&T(s,e-o,-1),T(s,a-e,f),N(r,s,u),o=a}}(e),l(!a),a}static empty(e){return new _(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let s=0;st&&"string"!=typeof e)))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==r.length)t.push(r[0],0);else{for(;n.length=0&&n<=0&&n==e[s+1]?e[s]+=t:0==t&&0==e[s]?e[s+1]+=n:i?(e[s]+=t,e[s+1]+=n):e.push(t,n)}function N(e,t,n){if(0==n.length)return;let s=t.length-2>>1;if(s>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)l=e.sections[a++],h=e.sections[a++];t(r,c,o,u,f),r=c,o=u}}}function D(e,t,n,i=!1){let s=[],r=i?[]:null,o=new R(e),a=new R(t);for(let e=-1;;)if(-1==o.ins&&-1==a.ins){let e=Math.min(o.len,a.len);T(s,e,-1),o.forward(e),a.forward(e)}else if(a.ins>=0&&(o.ins<0||e==o.i||0==o.off&&(a.len=0&&e=0)){if(o.done&&a.done)return r?_.createSet(s,r):M.create(s);throw new Error("Mismatched change set lengths")}{let t=0,n=o.len;for(;n;)if(-1==a.ins){let e=Math.min(n,a.len);t+=e,n-=e,a.forward(e)}else{if(!(0==a.ins&&a.lent||o.ins>=0&&o.len>t)&&(e||i.length>n),r.forward2(t),o.forward(t)}}else T(i,0,o.ins,e),s&&N(s,i,o.text),o.next()}}class R{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?i.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?i.empty:t[n].slice(this.off,null==e?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){-1==this.ins?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class j{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return 32&this.flags?this.to:this.from}get head(){return 32&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 8&this.flags?-1:16&this.flags?1:0}get bidiLevel(){let e=7&this.flags;return 7==e?null:e}get goalColumn(){let e=this.flags>>6;return 16777215==e?void 0:e}map(e,t=-1){let n,i;return this.empty?n=i=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new j(n,i,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return I.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return I.range(this.anchor,n)}eq(e,t=!1){return!(this.anchor!=e.anchor||this.head!=e.head||t&&this.empty&&this.assoc!=e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||"number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid JSON representation for SelectionRange");return I.range(e.anchor,e.head)}static create(e,t,n){return new j(e,t,n)}}class I{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:I.create(this.ranges.map((n=>n.map(e,t))),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;ne.toJSON())),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new I(e.ranges.map((e=>j.fromJSON(e))),e.main)}static single(e,t=e){return new I([I.range(e,t)],0)}static create(e,t=0){if(0==e.length)throw new RangeError("A selection needs at least one range");for(let n=0,i=0;ie?8:0)|s)}static normalized(e,t=0){let n=e[t];e.sort(((e,t)=>e.from-t.from)),t=e.indexOf(n);for(let n=1;ni.head?I.range(o,r):I.range(r,o))}}return new I(e,t)}}function L(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let B=0;class F{constructor(e,t,n,i,s){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=i,this.id=B++,this.default=e([]),this.extensions="function"==typeof s?s(this):s}get reader(){return this}static define(e={}){return new F(e.combine||(e=>e),e.compareInput||((e,t)=>e===t),e.compare||(e.combine?(e,t)=>e===t:z),!!e.static,e.enables)}of(e){return new $([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new $(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new $(e,this,2,t)}from(e,t){return t||(t=e=>e),this.compute([e],(n=>t(n.field(e))))}}function z(e,t){return e==t||e.length==t.length&&e.every(((e,n)=>e===t[n]))}class ${constructor(e,t,n,i){this.dependencies=e,this.facet=t,this.type=n,this.value=i,this.id=B++}dynamicSlot(e){var t;let n=this.value,i=this.facet.compareInput,s=this.id,r=e[s]>>1,o=2==this.type,a=!1,l=!1,h=[];for(let n of this.dependencies)"doc"==n?a=!0:"selection"==n?l=!0:1&(null!==(t=e[n.id])&&void 0!==t?t:1)||h.push(e[n.id]);return{create:e=>(e.values[r]=n(e),1),update(e,t){if(a&&t.docChanged||l&&(t.docChanged||t.selection)||q(e,h)){let t=n(e);if(o?!H(t,e.values[r],i):!i(t,e.values[r]))return e.values[r]=t,1}return 0},reconfigure:(e,t)=>{let a,l=t.config.address[s];if(null!=l){let s=ee(t,l);if(this.dependencies.every((n=>n instanceof F?t.facet(n)===e.facet(n):!(n instanceof G)||t.field(n,!1)==e.field(n,!1)))||(o?H(a=n(e),s,i):i(a=n(e),s)))return e.values[r]=s,0}else a=n(e);return e.values[r]=a,1}}}}function H(e,t,n){if(e.length!=t.length)return!1;for(let i=0;ie[t.id])),s=n.map((e=>e.type)),r=i.filter((e=>!(1&e))),o=e[t.id]>>1;function a(e){let n=[];for(let t=0;te===t),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(W).find((e=>e.field==this));return((null==t?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let i=e.values[t],s=this.updateF(i,n);return this.compareF(i,s)?0:(e.values[t]=s,1)},reconfigure:(e,n)=>null!=n.config.address[this.id]?(e.values[t]=n.field(this),0):(e.values[t]=this.create(e),1)}}init(e){return[this,W.of({field:this,create:e})]}get extension(){return this}}function U(e){return t=>new Y(t,e)}const K={highest:U(0),high:U(1),default:U(2),low:U(3),lowest:U(4)};class Y{constructor(e,t){this.inner=e,this.prec=t}}class J{of(e){return new X(this,e)}reconfigure(e){return J.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class X{constructor(e,t){this.compartment=e,this.inner=t}}class Z{constructor(e,t,n,i,s,r){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=i,this.staticValues=s,this.facets=r,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,n){let i=[],s=Object.create(null),r=new Map;for(let n of function(e,t,n){let i=[[],[],[],[],[]],s=new Map;return function e(r,o){let a=s.get(r);if(null!=a){if(a<=o)return;let e=i[a].indexOf(r);e>-1&&i[a].splice(e,1),r instanceof X&&n.delete(r.compartment)}if(s.set(r,o),Array.isArray(r))for(let t of r)e(t,o);else if(r instanceof X){if(n.has(r.compartment))throw new RangeError("Duplicate use of compartment in extensions");let i=t.get(r.compartment)||r.inner;n.set(r.compartment,i),e(i,o)}else if(r instanceof Y)e(r.inner,r.prec);else if(r instanceof G)i[o].push(r),r.provides&&e(r.provides,o);else if(r instanceof $)i[o].push(r),r.facet.extensions&&e(r.facet.extensions,2);else{let t=r.extension;if(!t)throw new Error(`Unrecognized extension value in extension set (${r}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);e(t,o)}}(e,2),i.reduce(((e,t)=>e.concat(t)))}(e,t,r))n instanceof G?i.push(n):(s[n.facet.id]||(s[n.facet.id]=[])).push(n);let o=Object.create(null),a=[],l=[];for(let e of i)o[e.id]=l.length<<1,l.push((t=>e.slot(t)));let h=null==n?void 0:n.config.facets;for(let e in s){let t=s[e],i=t[0].facet,r=h&&h[e]||[];if(t.every((e=>0==e.type)))if(o[i.id]=a.length<<1|1,z(r,t))a.push(n.facet(i));else{let e=i.combine(t.map((e=>e.value)));a.push(n&&i.compare(e,n.facet(i))?n.facet(i):e)}else{for(let e of t)0==e.type?(o[e.id]=a.length<<1|1,a.push(e.value)):(o[e.id]=l.length<<1,l.push((t=>e.dynamicSlot(t))));o[i.id]=l.length<<1,l.push((e=>V(e,i,t)))}}let c=l.map((e=>e(o)));return new Z(e,r,c,o,a,s)}}function Q(e,t){if(1&t)return 2;let n=t>>1,i=e.status[n];if(4==i)throw new Error("Cyclic dependency between fields and/or facets");if(2&i)return i;e.status[n]=4;let s=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|s}function ee(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}const te=F.define(),ne=F.define({combine:e=>e.some((e=>e)),static:!0}),ie=F.define({combine:e=>e.length?e[0]:void 0,static:!0}),se=F.define(),re=F.define(),oe=F.define(),ae=F.define({combine:e=>!!e.length&&e[0]});class le{constructor(e,t){this.type=e,this.value=t}static define(){return new he}}class he{of(e){return new le(this,e)}}class ce{constructor(e){this.map=e}of(e){return new ue(this,e)}}class ue{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return void 0===t?void 0:t==this.value?this:new ue(this.type,t)}is(e){return this.type==e}static define(e={}){return new ce(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let i of e){let e=i.map(t);e&&n.push(e)}return n}}ue.reconfigure=ue.define(),ue.appendConfig=ue.define();class fe{constructor(e,t,n,i,s,r){this.startState=e,this.changes=t,this.selection=n,this.effects=i,this.annotations=s,this.scrollIntoView=r,this._doc=null,this._state=null,n&&L(n,t.newLength),s.some((e=>e.type==fe.time))||(this.annotations=s.concat(fe.time.of(Date.now())))}static create(e,t,n,i,s,r){return new fe(e,t,n,i,s,r)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(fe.userEvent);return!(!t||!(t==e||t.length>e.length&&t.slice(0,e.length)==e&&"."==t[e.length]))}}function de(e,t){let n=[];for(let i=0,s=0;;){let r,o;if(i=e[i]))r=e[i++],o=e[i++];else{if(!(s=0;s--){let r=n[s](e);r&&Object.keys(r).length&&(i=pe(i,me(t,r,e.changes.newLength),!0))}return i==e?e:fe.create(t,e.changes,e.selection,i.effects,i.annotations,i.scrollIntoView)}(n?function(e){let t=e.startState,n=!0;for(let i of t.facet(se)){let t=i(e);if(!1===t){n=!1;break}Array.isArray(t)&&(n=!0===n?t:de(n,t))}if(!0!==n){let i,s;if(!1===n)s=e.changes.invertedDesc,i=_.empty(t.doc.length);else{let t=e.changes.filter(n);i=t.changes,s=t.filtered.mapDesc(t.changes).invertedDesc}e=fe.create(t,i,e.selection&&e.selection.map(s),ue.mapEffects(e.effects,s),e.annotations,e.scrollIntoView)}let i=t.facet(re);for(let n=i.length-1;n>=0;n--){let s=i[n](e);e=s instanceof fe?s:Array.isArray(s)&&1==s.length&&s[0]instanceof fe?s[0]:ge(t,ye(s),!1)}return e}(s):s)}fe.time=le.define(),fe.userEvent=le.define(),fe.addToHistory=le.define(),fe.remote=le.define();const be=[];function ye(e){return null==e?be:Array.isArray(e)?e:[e]}var ve=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(ve||(ve={}));const xe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let we;try{we=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(e){}class ke{constructor(e,t,n,i,s,r){this.config=e,this.doc=t,this.selection=n,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=s,r&&(r._state=this);for(let e=0;es.set(t,e))),n=null),s.set(t.value.compartment,t.value.extension)):t.is(ue.reconfigure)?(n=null,i=t.value):t.is(ue.appendConfig)&&(n=null,i=ye(i).concat(t.value));n?t=e.startState.values.slice():(n=Z.resolve(i,s,this),t=new ke(n,this.doc,this.selection,n.dynamicSlots.map((()=>null)),((e,t)=>t.reconfigure(e,this)),null).values);let r=e.startState.facet(ne)?e.newSelection:e.newSelection.asSingle();new ke(n,e.newDoc,r,t,((t,n)=>n.update(t,e)),e)}replaceSelection(e){return"string"==typeof e&&(e=this.toText(e)),this.changeByRange((t=>({changes:{from:t.from,to:t.to,insert:e},range:I.cursor(t.from+e.length)})))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),i=this.changes(n.changes),s=[n.range],r=ye(n.effects);for(let n=1;ns.spec.fromJSON(r,e))))}return ke.create({doc:e.doc,selection:I.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=Z.resolve(e.extensions||[],new Map),n=e.doc instanceof i?e.doc:i.of((e.doc||"").split(t.staticFacet(ke.lineSeparator)||A)),s=e.selection?e.selection instanceof I?e.selection:I.single(e.selection.anchor,e.selection.head):I.single(0);return L(s,n.length),t.staticFacet(ne)||(s=s.asSingle()),new ke(t,n,s,t.dynamicSlots.map((()=>null)),((e,t)=>t.create(e)),null)}get tabSize(){return this.facet(ke.tabSize)}get lineBreak(){return this.facet(ke.lineSeparator)||"\n"}get readOnly(){return this.facet(ae)}phrase(e,...t){for(let t of this.facet(ke.phrases))if(Object.prototype.hasOwnProperty.call(t,e)){e=t[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,((e,n)=>{if("$"==n)return"$";let i=+(n||1);return!i||i>t.length?e:t[i-1]}))),e}languageDataAt(e,t,n=-1){let i=[];for(let s of this.facet(te))for(let r of s(this,t,n))Object.prototype.hasOwnProperty.call(r,e)&&i.push(r[e]);return i}charCategorizer(e){return t=this.languageDataAt("wordChars",e).join(""),e=>{if(!/\S/.test(e))return ve.Space;if(function(e){if(we)return we.test(e);for(let t=0;t"€"&&(n.toUpperCase()!=n.toLowerCase()||xe.test(n)))return!0}return!1}(e))return ve.Word;for(let n=0;n-1)return ve.Word;return ve.Other};var t}wordAt(e){let{text:t,from:n,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),r=e-n,o=e-n;for(;r>0;){let e=b(t,r,!1);if(s(t.slice(e,r))!=ve.Word)break;r=e}for(;oe.length?e[0]:4}),ke.lineSeparator=ie,ke.readOnly=ae,ke.phrases=F.define({compare(e,t){let n=Object.keys(e),i=Object.keys(t);return n.length==i.length&&n.every((n=>e[n]==t[n]))}}),ke.languageData=te,ke.changeFilter=se,ke.transactionFilter=re,ke.transactionExtender=oe,J.reconfigure=ue.define();class Ce{eq(e){return this==e}range(e,t=e){return Ae.create(e,t,this)}}Ce.prototype.startSide=Ce.prototype.endSide=0,Ce.prototype.point=!1,Ce.prototype.mapMode=O.TrackDel;class Ae{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new Ae(e,t,n)}}function Oe(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class Me{constructor(e,t,n,i){this.from=e,this.to=t,this.value=n,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,i=0){let s=n?this.to:this.from;for(let r=i,o=s.length;;){if(r==o)return r;let i=r+o>>1,a=s[i]-e||(n?this.value[i].endSide:this.value[i].startSide)-t;if(i==r)return a>=0?r:o;a>=0?o=i:r=i+1}}between(e,t,n,i){for(let s=this.findIndex(t,-1e9,!0),r=this.findIndex(n,1e9,!1,s);sh||l==h&&c.startSide>0&&c.endSide<=0)continue;(h-l||c.endSide-c.startSide)<0||(r<0&&(r=l),c.point&&(o=Math.max(o,h-l)),n.push(c),i.push(l-r),s.push(h-r))}return{mapped:n.length?new Me(i,s,n,o):null,pos:r}}}class _e{constructor(e,t,n,i){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=i}static create(e,t,n,i){return new _e(e,t,n,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:i=0,filterTo:s=this.length}=e,r=e.filter;if(0==t.length&&!r)return this;if(n&&(t=t.slice().sort(Oe)),this.isEmpty)return t.length?_e.of(t):this;let o=new Ee(this,null,-1).goto(0),a=0,l=[],h=new Te;for(;o.value||a=0){let e=t[a++];h.addInner(e.from,e.to,e.value)||l.push(e)}else 1==o.rangeIndex&&o.chunkIndexthis.chunkEnd(o.chunkIndex)||so.to||s=s&&e<=s+r.length&&!1===r.between(s,e-s,t-s,n))return}this.nextLayer.between(e,t,n)}}iter(e=0){return De.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return De.from(e).goto(t)}static compare(e,t,n,i,s=-1){let r=e.filter((e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=s)),o=t.filter((e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=s)),a=Ne(r,o,n),l=new Re(r,a,s),h=new Re(o,a,s);n.iterGaps(((e,t,n)=>je(l,e,h,t,n,i))),n.empty&&0==n.length&&je(l,0,h,0,0,i)}static eq(e,t,n=0,i){null==i&&(i=999999999);let s=e.filter((e=>!e.isEmpty&&t.indexOf(e)<0)),r=t.filter((t=>!t.isEmpty&&e.indexOf(t)<0));if(s.length!=r.length)return!1;if(!s.length)return!0;let o=Ne(s,r),a=new Re(s,o,0).goto(n),l=new Re(r,o,0).goto(n);for(;;){if(a.to!=l.to||!Ie(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>i)return!0;a.next(),l.next()}}static spans(e,t,n,i,s=-1){let r=new Re(e,null,s).goto(t),o=t,a=r.openStart;for(;;){let e=Math.min(r.to,n);if(r.point){let n=r.activeForPoint(r.to),s=r.pointFromo&&(i.span(o,e,r.active,a),a=r.openEnd(e));if(r.to>n)return a+(r.point&&r.to>n?1:0);o=r.to,r.next()}}static of(e,t=!1){let n=new Te;for(let i of e instanceof Ae?[e]:t?function(e){if(e.length>1)for(let t=e[0],n=1;n0)return e.slice().sort(Oe);t=i}return e}(e):e)n.add(i.from,i.to,i.value);return n.finish()}static join(e){if(!e.length)return _e.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let i=e[n];i!=_e.empty;i=i.nextLayer)t=new _e(i.chunkPos,i.chunk,t,Math.max(i.maxPoint,t.maxPoint));return t}}_e.empty=new _e([],[],null,-1),_e.empty.nextLayer=_e.empty;class Te{finishChunk(e){this.chunks.push(new Me(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new Te)).add(e,t,n)}addInner(e,t,n){let i=e-this.lastTo||n.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(i<0||(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),0))}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(_e.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return e;let t=_e.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Ne(e,t,n){let i=new Map;for(let t of e)for(let e=0;e=this.minPoint)break}}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=n&&i.push(new Ee(r,t,n,s));return 1==i.length?i[0]:new De(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)Pe(this.heap,e);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)Pe(this.heap,e);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Pe(this.heap,0)}}}function Pe(e,t){for(let n=e[t];;){let i=1+(t<<1);if(i>=e.length)break;let s=e[i];if(i+1=0&&(s=e[i+1],i++),n.compare(s)<0)break;e[i]=n,e[t]=s,t=i}}class Re{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=De.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){Le(this.active,e),Le(this.activeTo,e),Le(this.activeRank,e),this.minActive=Fe(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:i,rank:s}=this.cursor;for(;t0;)t++;Be(this.active,t,n),Be(this.activeTo,t,i),Be(this.activeRank,t,s),e&&Be(e,t,this.cursor.from),this.minActive=Fe(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&Le(n,i)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let e=this.cursor.value;if(e.point){if(!(t&&this.cursor.to==this.to&&this.cursor.from=0&&n[t]=0&&!(this.activeRank[n]e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function je(e,t,n,i,s,r){e.goto(t),n.goto(i);let o=i+s,a=i,l=i-t;for(;;){let t=e.to+l-n.to||e.endSide-n.endSide,i=t<0?e.to+l:n.to,s=Math.min(i,o);if(e.point||n.point?e.point&&n.point&&(e.point==n.point||e.point.eq(n.point))&&Ie(e.activeForPoint(e.to),n.activeForPoint(n.to))||r.comparePoint(a,s,e.point,n.point):s>a&&!Ie(e.active,n.active)&&r.compareRange(a,s,e.active,n.active),i>o)break;a=i,t<=0&&e.next(),t>=0&&n.next()}}function Ie(e,t){if(e.length!=t.length)return!1;for(let n=0;n=t;n--)e[n+1]=e[n];e[t]=n}function Fe(e,t){let n=-1,i=1e9;for(let s=0;s=t)return i;if(i==e.length)break;s+=9==e.charCodeAt(i)?n-s%n:1,i=b(e,i)}return!0===i?-1:e.length}},3173:(e,t,n)=>{"use strict";n.d(t,{NZ:()=>fe,OP:()=>Ce,Lz:()=>li,wJ:()=>Cs,Z9:()=>lt,xO:()=>ce,HJ:()=>os,VH:()=>Di,ld:()=>vs,Eg:()=>bs,cU:()=>Ts,dz:()=>Zi,N$:()=>Gi,wu:()=>Xs,Yq:()=>Ys,w4:()=>gi,$K:()=>Vs,c_:()=>st,D4:()=>is,TS:()=>vi,BE:()=>Xi,S7:()=>Ss,DK:()=>gs,vX:()=>hs});for(var i=n(4830),s=n(8104),r={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},o={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},a="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),l="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),h=0;h<10;h++)r[48+h]=r[96+h]=String(h);for(h=1;h<=24;h++)r[h+111]="F"+h;for(h=65;h<=90;h++)r[h]=String.fromCharCode(h+32),o[h]=String.fromCharCode(h);for(var c in r)o.hasOwnProperty(c)||(o[c]=r[c]);function u(e){let t;return t=11==e.nodeType?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function f(e,t){return!!t&&(e==t||e.contains(1!=t.nodeType?t.parentNode:t))}function d(e,t){if(!t.anchorNode)return!1;try{return f(e,t.anchorNode)}catch(e){return!1}}function p(e){return 3==e.nodeType?M(e,0,e.nodeValue.length).getClientRects():1==e.nodeType?e.getClientRects():[]}function m(e,t,n,i){return!!n&&(y(e,t,n,i,-1)||y(e,t,n,i,1))}function g(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t}function b(e){return 1==e.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function y(e,t,n,i,s){for(;;){if(e==n&&t==i)return!0;if(t==(s<0?0:v(e))){if("DIV"==e.nodeName)return!1;let n=e.parentNode;if(!n||1!=n.nodeType)return!1;t=g(e)+(s<0?0:1),e=n}else{if(1!=e.nodeType)return!1;if(1==(e=e.childNodes[t+(s<0?-1:0)]).nodeType&&"false"==e.contentEditable)return!1;t=s<0?v(e):0}}}function v(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function x(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function w(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function k(e,t){let n=t.width/e.offsetWidth,i=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(t.height-e.offsetHeight)<1)&&(i=1),{scaleX:n,scaleY:i}}class S{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?v(t):0),n,Math.min(e.focusOffset,n?v(n):0))}set(e,t,n,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=i}}let C,A=null;function O(e){if(e.setActive)return e.setActive();if(A)return e.focus(A);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(null==A?{get preventScroll(){return A={preventScroll:!0},!0}}:void 0),!A){A=!1;for(let e=0;eMath.max(1,e.scrollHeight-e.clientHeight-4)}function E(e,t){for(let n=e,i=t;;){if(3==n.nodeType&&i>0)return{node:n,offset:i};if(1==n.nodeType&&i>0){if("false"==n.contentEditable)return null;n=n.childNodes[i-1],i=v(n)}else{if(!n.parentNode||b(n))return null;i=g(n),n=n.parentNode}}}function D(e,t){for(let n=e,i=t;;){if(3==n.nodeType&&it)return n.domBoundsAround(e,t,l);if(c>=e&&-1==i&&(i=a,s=l),l>t&&n.dom.parentNode==this.dom){r=a,o=h;break}h=c,l=c+n.breakAfter}return{from:s,to:o<0?n+this.length:o,startDOM:(i?this.children[i-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:r=0?this.children[r].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),1&t.flags)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,7&this.flags&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,n=R){this.markDirty();for(let i=e;ithis.pos||e==this.pos&&(t>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}function B(e,t,n,i,s,r,o,a,l){let{children:h}=e,c=h.length?h[t]:null,u=r.length?r[r.length-1]:null,f=u?u.breakAfter:o;if(!(t==i&&c&&!o&&!f&&r.length<2&&c.merge(n,s,r.length?u:null,0==n,a,l))){if(i0&&(!o&&r.length&&c.merge(n,c.length,r[0],!1,a,0)?c.breakAfter=r.shift().breakAfter:(n2);var X={mac:J||/Mac/.test(z.platform),windows:/Win/.test(z.platform),linux:/Linux|X11/.test(z.platform),ie:W,ie_version:q?$.documentMode||6:V?+V[1]:H?+H[1]:0,gecko:G,gecko_version:G?+(/Firefox\/(\d+)/.exec(z.userAgent)||[0,0])[1]:0,chrome:!!U,chrome_version:U?+U[1]:0,ios:J,android:/Android\b/.test(z.userAgent),webkit:K,safari:Y,webkit_version:K?+(/\bAppleWebKit\/(\d+)/.exec(z.userAgent)||[0,0])[1]:0,tabSize:null!=$.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class Z extends j{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){3==e.nodeType&&this.createDOM(e)}merge(e,t,n){return!(8&this.flags||n&&(!(n instanceof Z)||this.length-(t-e)+n.length>256||8&n.flags)||(this.text=this.text.slice(0,e)+(n?n.text:"")+this.text.slice(t),this.markDirty(),0))}split(e){let t=new Z(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=8&this.flags,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new P(this.dom,e)}domBoundsAround(e,t,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return function(e,t,n){let i=e.nodeValue.length;t>i&&(t=i);let s=t,r=t,o=0;0==t&&n<0||t==i&&n>=0?X.chrome||X.gecko||(t?(s--,o=1):r=0)?0:a.length-1];return X.safari&&!o&&0==l.width&&(l=Array.prototype.find.call(a,(e=>e.width))||l),o?x(l,o<0):l||null}(this.dom,e,t)}}class Q extends j{constructor(e,t=[],n=0){super(),this.mark=e,this.children=t,this.length=n;for(let e of t)e.setParent(this)}setAttrs(e){if(T(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!(8&(this.flags|e.flags))}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?4&this.flags&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,n,i,s,r){return!(n&&(!(n instanceof Q&&n.mark.eq(this.mark))||e&&s<=0||te&&t.push(n=e&&(i=s),n=o,s++}let r=this.length-e;return this.length=e,i>-1&&(this.children.length=i,this.markDirty()),new Q(this.mark,t,r)}domAtPos(e){return ne(this,e)}coordsAt(e,t){return se(this,e,t)}}class ee extends j{static create(e,t,n){return new ee(e,t,n)}constructor(e,t,n){super(),this.widget=e,this.length=t,this.side=n,this.prevWidget=null}split(e){let t=ee.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){this.dom&&this.widget.updateDOM(this.dom,e)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,n,i,s,r){return!(n&&(!(n instanceof ee&&this.widget.compare(n.widget))||e>0&&s<=0||t0)?P.before(this.dom):P.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);if(n)return n;let i=this.dom.getClientRects(),s=null;if(!i.length)return null;let r=this.side?this.side<0:e>0;for(let t=r?i.length-1:0;s=i[t],!(e>0?0==t:t==i.length-1||s.top0?P.before(this.dom):P.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return i.EY.empty}get isHidden(){return!0}}function ne(e,t){let n=e.dom,{children:i}=e,s=0;for(let e=0;se&&t0;e--){let t=i[e-1];if(t.dom.parentNode==n)return t.domAtPos(t.length)}for(let e=s;e0&&t instanceof Q&&s.length&&(i=s[s.length-1])instanceof Q&&i.mark.eq(t.mark)?ie(i,t.children[0],n-1):(s.push(t),t.setParent(e)),e.length+=t.length}function se(e,t,n){let i=null,s=-1,r=null,o=-1;!function e(t,a){for(let l=0,h=0;l=a&&(c.children.length?e(c,a-h):(!r||r.isHidden&&n>0)&&(u>a||h==u&&c.getSide()>0)?(r=c,o=a-h):(h-1?1:0)!=s.length-(n&&s.indexOf(n)>-1?1:0))return!1;for(let r of i)if(r!=n&&(-1==s.indexOf(r)||e[r]!==t[r]))return!1;return!0}function le(e,t,n){let i=!1;if(t)for(let s in t)n&&s in n||(i=!0,"style"==s?e.style.cssText="":e.removeAttribute(s));if(n)for(let s in n)t&&t[s]==n[s]||(i=!0,"style"==s?e.style.cssText=n[s]:e.setAttribute(s,n[s]));return i}function he(e){let t=Object.create(null);for(let n=0;n0?3e8:-4e8:t>0?1e8:-1e8,new me(e,t,t,n,e.widget||null,!1)}static replace(e){let t,n,i=!!e.block;if(e.isBlockGap)t=-5e8,n=4e8;else{let{start:s,end:r}=ge(e,i);t=(s?i?-3e8:-1:5e8)-1,n=1+(r?i?2e8:1:-6e8)}return new me(e,t,n,i,e.widget||null,!0)}static line(e){return new pe(e)}static set(e,t=!1){return i.om.of(e,t)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}fe.none=i.om.empty;class de extends fe{constructor(e){let{start:t,end:n}=ge(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,n;return this==e||e instanceof de&&this.tagName==e.tagName&&(this.class||(null===(t=this.attrs)||void 0===t?void 0:t.class))==(e.class||(null===(n=e.attrs)||void 0===n?void 0:n.class))&&ae(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}de.prototype.point=!1;class pe extends fe{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof pe&&this.spec.class==e.spec.class&&ae(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}pe.prototype.mapMode=i.iR.TrackBefore,pe.prototype.point=!0;class me extends fe{constructor(e,t,n,s,r,o){super(t,n,r,e),this.block=s,this.isReplace=o,this.mapMode=s?t<=0?i.iR.TrackBefore:i.iR.TrackAfter:i.iR.TrackDel}get type(){return this.startSide!=this.endSide?ue.WidgetRange:this.startSide<=0?ue.WidgetBefore:ue.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof me&&((t=this.widget)==(n=e.widget)||!!(t&&n&&t.compare(n)))&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide;var t,n}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}function ge(e,t=!1){let{inclusiveStart:n,inclusiveEnd:i}=e;return null==n&&(n=e.inclusive),null==i&&(i=e.inclusive),{start:null!=n?n:t,end:null!=i?i:t}}function be(e,t,n,i=0){let s=n.length-1;s>=0&&n[s]+i>=e?n[s]=Math.max(n[s],t):n.push(e,t)}me.prototype.point=!0;class ye extends j{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,n,i,s,r){if(n){if(!(n instanceof ye))return!1;this.dom||n.transferDOM(this)}return i&&this.setDeco(n?n.attrs:null),F(this,e,t,n?n.children.slice():[],s,r),!0}split(e){let t=new ye;if(t.breakAfter=this.breakAfter,0==this.length)return t;let{i:n,off:i}=this.childPos(e);i&&(t.append(this.children[n].split(i),0),this.children[n].merge(i,this.children[n].length,null,!1,0,0),n++);for(let e=n;e0&&0==this.children[n-1].length;)this.children[--n].destroy();return this.children.length=n,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){ae(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){ie(this,e,t)}addLineDeco(e){let t=e.spec.attributes,n=e.spec.class;t&&(this.attrs=re(t,this.attrs||{})),n&&(this.attrs=re({class:n},this.attrs||{}))}domAtPos(e){return ne(this,e)}reuseDOM(e){"DIV"==e.nodeName&&(this.setDOM(e),this.flags|=6)}sync(e,t){var n;this.dom?4&this.flags&&(T(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),void 0!==this.prevAttrs&&(le(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let i=this.dom.lastChild;for(;i&&j.get(i)instanceof Q;)i=i.lastChild;if(!(i&&this.length&&("BR"==i.nodeName||0!=(null===(n=j.get(i))||void 0===n?void 0:n.isEditable)||X.ios&&this.children.some((e=>e instanceof Z))))){let e=document.createElement("BR");e.cmIgnore=!0,this.dom.appendChild(e)}}measureTextSize(){if(0==this.children.length||this.length>20)return null;let e,t=0;for(let n of this.children){if(!(n instanceof Z)||/[^ -~]/.test(n.text))return null;let i=p(n.dom);if(1!=i.length)return null;t+=i[0].width,e=i[0].height}return t?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:t/this.length,textHeight:e}:null}coordsAt(e,t){let n=se(this,e,t);if(!this.children.length&&n&&this.parent){let{heightOracle:e}=this.parent.view.viewState,t=n.bottom-n.top;if(Math.abs(t-e.lineHeight)<2&&e.textHeight=t){if(s instanceof ye)return s;if(r>t)break}i=r+s.breakAfter}return null}}class ve extends j{constructor(e,t,n){super(),this.widget=e,this.length=t,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(e,t,n,i,s,r){return!(n&&(!(n instanceof ve&&this.widget.compare(n.widget))||e>0&&s<=0||t0)}}class xe extends ce{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class we{constructor(e,t,n,i){this.doc=e,this.pos=t,this.end=n,this.disallowBlockEffectsFor=i,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(0==this.content.length)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof ve&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new ye),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(ke(new te(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||e&&this.content.length&&this.content[this.content.length-1]instanceof ve||this.getLine()}buildText(e,t,n){for(;e>0;){if(this.textOff==this.text.length){let{value:t,lineBreak:n,done:i}=this.cursor.next(this.skip);if(this.skip=0,i)throw new Error("Ran out of text content when drawing inline views");if(n){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}this.text=t,this.textOff=0}let i=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-n)),this.getLine().append(ke(new Z(this.text.slice(this.textOff,this.textOff+i)),t),n),this.atCursorPos=!0,this.textOff+=i,e-=i,n=0}}span(e,t,n,i){this.buildText(t-e,n,i),this.pos=t,this.openStart<0&&(this.openStart=i)}point(e,t,n,i,s,r){if(this.disallowBlockEffectsFor[r]&&n instanceof me){if(n.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=t-e;if(n instanceof me)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new ve(n.widget||Se.block,o,n));else{let r=ee.create(n.widget||Se.inline,o,o?0:n.startSide),a=this.atCursorPos&&!r.isEditable&&s<=i.length&&(e0),l=!r.isEditable&&(ei.length||n.startSide<=0),h=this.getLine();2!=this.pendingBuffer||a||r.isEditable||(this.pendingBuffer=0),this.flushBuffer(i),a&&(h.append(ke(new te(1),i),s),s=i.length+Math.max(0,s-i.length)),h.append(ke(r,i),s),this.atCursorPos=l,this.pendingBuffer=l?ei.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=i.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);o&&(this.textOff+o<=this.text.length?this.textOff+=o:(this.skip+=o-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=s)}static build(e,t,n,s,r){let o=new we(e,t,n,r);return o.openEnd=i.om.spans(s,t,n,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function ke(e,t){for(let n of t)e=new Q(n,[e],e.length);return e}class Se extends ce{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Se.inline=new Se("span"),Se.block=new Se("div");var Ce=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(Ce||(Ce={}));const Ae=Ce.LTR,Oe=Ce.RTL;function Me(e){let t=[];for(let n=0;n=t){if(o.level==n)return r;(s<0||(0!=i?i<0?o.fromt:e[s].level>o.level))&&(s=r)}}if(s<0)throw new RangeError("Index out of range");return s}}function je(e,t){if(e.length!=t.length)return!1;for(let n=0;nl&&o.push(new Re(l,p.from,f)),Be(e,p.direction==Ae!=!(f%2)?i+1:i,s,p.inner,p.from,p.to,o),l=p.to),d=p.to}else{if(d==n||(t?Ie[d]!=a:Ie[d]==a))break;d++}u?Le(e,l,d,i+1,s,u,o):lt;){let n=!0,c=!1;if(!h||l>r[h-1].to){let e=Ie[l-1];e!=a&&(n=!1,c=16==e)}let u=n||1!=a?null:[],f=n?i:i+1,d=l;e:for(;;)if(h&&d==r[h-1].to){if(c)break e;let p=r[--h];if(!n)for(let e=p.from,n=h;;){if(e==t)break e;if(!n||r[n-1].to!=e){if(Ie[e-1]==a)break e;break}e=r[--n].from}u?u.push(p):(p.to=0;e-=3)if(Ee[e+1]==-n){let t=Ee[e+2],n=2&t?s:4&t?1&t?r:s:0;n&&(Ie[o]=Ie[Ee[e]]=n),a=e;break}}else{if(189==Ee.length)break;Ee[a++]=o,Ee[a++]=t,Ee[a++]=l}else if(2==(i=Ie[o])||1==i){let e=i==s;l=e?0:1;for(let t=a-3;t>=0;t-=3){let n=Ee[t+2];if(2&n)break;if(e)Ee[t+2]|=2;else{if(4&n)break;Ee[t+2]|=4}}}}}(e,s,r,i,a),function(e,t,n,i){for(let s=0,r=i;s<=n.length;s++){let o=s?n[s-1].to:e,a=sl;)t==r&&(t=n[--i].from,r=i?n[i-1].to:e),Ie[--t]=c;l=o}else r=o,l++}}}(s,r,i,a),Le(e,s,r,t,n,i,o)}function Fe(e){return[new Re(0,e,0)]}let ze="";function $e(e,t,n,s,r){var o;let a=s.head-e.from,l=Re.find(t,a,null!==(o=s.bidiLevel)&&void 0!==o?o:-1,s.assoc),h=t[l],c=h.side(r,n);if(a==c){let e=l+=r?1:-1;if(e<0||e>=t.length)return null;h=t[l=e],a=h.side(!r,n),c=h.side(r,n)}let u=(0,i.zK)(e.text,a,h.forward(r,n));(uh.to)&&(u=c),ze=e.text.slice(Math.min(a,u),Math.max(a,u));let f=l==(r?t.length-1:0)?null:t[l+(r?1:-1)];return f&&u==c&&f.level+(r?0:1)e.some((e=>e))}),Qe=i.sj.define({combine:e=>e.some((e=>e))}),et=i.sj.define();class tt{constructor(e,t="nearest",n="nearest",i=5,s=5,r=!1){this.range=e,this.y=t,this.x=n,this.yMargin=i,this.xMargin=s,this.isSnapshot=r}map(e){return e.empty?this:new tt(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new tt(i.OF.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const nt=i.Pe.define({map:(e,t)=>e.map(t)}),it=i.Pe.define();function st(e,t,n){let i=e.facet(Ge);i.length?i[0](t):window.onerror?window.onerror(String(t),n,void 0,void 0,t):n?console.error(n+":",t):console.error(t)}const rt=i.sj.define({combine:e=>!e.length||e[0]});let ot=0;const at=i.sj.define();class lt{constructor(e,t,n,i,s){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=i,this.extension=s(this)}static define(e,t){const{eventHandlers:n,eventObservers:i,provide:s,decorations:r}=t||{};return new lt(ot++,e,n,i,(e=>{let t=[at.of(e)];return r&&t.push(ft.of((t=>{let n=t.plugin(e);return n?r(n):fe.none}))),s&&t.push(s(e)),t}))}static fromClass(e,t){return lt.define((t=>new e(t)),t)}}class ht{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(st(e.state,t,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(e){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(t){st(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(null===(t=this.value)||void 0===t?void 0:t.destroy)try{this.value.destroy()}catch(t){st(e.state,t,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const ct=i.sj.define(),ut=i.sj.define(),ft=i.sj.define(),dt=i.sj.define(),pt=i.sj.define(),mt=i.sj.define();function gt(e,t){let n=e.state.facet(mt);if(!n.length)return n;let s=n.map((t=>t instanceof Function?t(e):t)),r=[];return i.om.spans(s,t.from,t.to,{point(){},span(e,n,i,s){let o=e-t.from,a=n-t.from,l=r;for(let e=i.length-1;e>=0;e--,s--){let n,r=i[e].spec.bidiIsolate;if(null==r&&(r=He(t.text,o,a)),s>0&&l.length&&(n=l[l.length-1]).to==o&&n.direction==r)n.to=a,l=n.inner;else{let e={from:o,to:a,direction:r,inner:[]};l.push(e),l=e.inner}}}}),r}const bt=i.sj.define();function yt(e){let t=0,n=0,i=0,s=0;for(let r of e.state.facet(bt)){let o=r(e);o&&(null!=o.left&&(t=Math.max(t,o.left)),null!=o.right&&(n=Math.max(n,o.right)),null!=o.top&&(i=Math.max(i,o.top)),null!=o.bottom&&(s=Math.max(s,o.bottom)))}return{left:t,right:n,top:i,bottom:s}}const vt=i.sj.define();class xt{constructor(e,t,n,i){this.fromA=e,this.toA=t,this.fromB=n,this.toB=i}join(e){return new xt(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let i=e[t-1];if(!(i.fromA>n.toA)){if(i.toAh)break;s+=2}if(!a)return n;new xt(a.fromA,a.toA,a.fromB,a.toB).addToSet(n),r=a.toA,o=a.toB}}}class wt{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=i.VR.empty(this.startState.doc.length);for(let e of n)this.changes=this.changes.compose(e.changes);let s=[];this.changes.iterChangedRanges(((e,t,n,i)=>s.push(new xt(e,t,n,i)))),this.changedRanges=s}static create(e,t,n){return new wt(e,t,n)}get viewportChanged(){return(4&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(10&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some((e=>e.selection))}get empty(){return 0==this.flags&&0==this.transactions.length}}class kt extends j{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=fe.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new ye],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new xt(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every((({fromA:e,toA:t})=>tthis.minWidthTo))?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&((null===(t=this.domChanged)||void 0===t?void 0:t.newSel)?s=this.domChanged.newSel.head:function(e,t){let n=!1;return t&&e.iterChangedRanges(((e,i)=>{et.from&&(n=!0)})),n}(e.changes,this.hasComposition)||e.selectionSet||(s=e.state.selection.main.head));let r=s>-1?function(e,t,n){let i=St(e,n);if(!i)return null;let{node:s,from:r,to:o}=i,a=s.nodeValue;if(/[\n\r]/.test(a))return null;if(e.state.doc.sliceString(i.from,i.to)!=a)return null;let l=t.invertedDesc,h=new xt(l.mapPos(r),l.mapPos(o),r,o),c=[];for(let t=s.parentNode;;t=t.parentNode){let n=j.get(t);if(n instanceof Q)c.push({node:t,deco:n.mark});else{if(n instanceof ye||"DIV"==t.nodeName&&t.parentNode==e.contentDOM)return{range:h,text:s,marks:c,line:t};if(t==e.contentDOM)return null;c.push({node:t,deco:new de({inclusive:!0,attributes:he(t),tagName:t.tagName.toLowerCase()})})}}}(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:t,to:i}=this.hasComposition;n=new xt(t,i,e.changes.mapPos(t,-1),e.changes.mapPos(i,1)).addToSet(n.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(X.ie||X.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=function(e,t,n){let s=new Ct;return i.om.compare(e,t,n,s),s.changes}(this.decorations,this.updateDeco(),e.changes);return n=xt.extendWithRanges(n,o),!!(7&this.flags||0!=n.length)&&(this.updateInner(n,e.startState.doc.length,r),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,n);let{observer:i}=this.view;i.ignore((()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let e=X.chrome||X.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,e),this.flags&=-8,e&&(e.written||i.selectionRange.focusNode!=e.node)&&(this.forceSelection=!0),this.dom.style.height=""})),this.markedForComposition.forEach((e=>e.flags&=-9));let s=[];if(this.view.viewport.from||this.view.viewport.to=0?i[e]:null;if(!t)break;let r,o,a,l,{fromA:h,toA:c,fromB:u,toB:f}=t;if(n&&n.range.fromBu){let e=we.build(this.view.state.doc,u,n.range.fromB,this.decorations,this.dynamicDecorationMap),t=we.build(this.view.state.doc,n.range.toB,f,this.decorations,this.dynamicDecorationMap);o=e.breakAtStart,a=e.openStart,l=t.openEnd;let i=this.compositionView(n);t.breakAtStart?i.breakAfter=1:t.content.length&&i.merge(i.length,i.length,t.content[0],!1,t.openStart,0)&&(i.breakAfter=t.content[0].breakAfter,t.content.shift()),e.content.length&&i.merge(0,0,e.content[e.content.length-1],!0,0,e.openEnd)&&e.content.pop(),r=e.content.concat(i).concat(t.content)}else({content:r,breakAtStart:o,openStart:a,openEnd:l}=we.build(this.view.state.doc,u,f,this.decorations,this.dynamicDecorationMap));let{i:d,off:p}=s.findPos(c,1),{i:m,off:g}=s.findPos(h,-1);B(this,m,g,d,p,r,o,a,l)}n&&this.fixCompositionDOM(n)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let e of t.effects)e.is(it)&&(this.editContextFormatting=e.value)}compositionView(e){let t=new Z(e.text.nodeValue);t.flags|=8;for(let{deco:n}of e.marks)t=new Q(n,[t],t.length);let n=new ye;return n.append(t,0),n}fixCompositionDOM(e){let t=(e,t)=>{t.flags|=8|(t.children.some((e=>7&e.flags))?1:0),this.markedForComposition.add(t);let n=j.get(e);n&&n!=t&&(n.dom=null),t.setDOM(e)},n=this.childPos(e.range.fromB,1),i=this.children[n.i];t(e.line,i);for(let s=e.marks.length-1;s>=-1;s--)n=i.childPos(n.off,1),i=i.children[n.i],t(s>=0?e.marks[s].node:e.text,i)}updateSelection(e=!1,t=!1){!e&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();let n=this.view.root.activeElement,i=n==this.dom,s=!i&&d(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(i||t||s))return;let r=this.forceSelection;this.forceSelection=!1;let o=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(o.anchor)),l=o.empty?a:this.moveToLine(this.domAtPos(o.head));if(X.gecko&&o.empty&&!this.hasComposition&&1==(h=a).node.nodeType&&h.node.firstChild&&(0==h.offset||"false"==h.node.childNodes[h.offset-1].contentEditable)&&(h.offset==h.node.childNodes.length||"false"==h.node.childNodes[h.offset].contentEditable)){let e=document.createTextNode("");this.view.observer.ignore((()=>a.node.insertBefore(e,a.node.childNodes[a.offset]||null))),a=l=new P(e,0),r=!0}var h;let c=this.view.observer.selectionRange;!r&&c.focusNode&&(m(a.node,a.offset,c.anchorNode,c.anchorOffset)&&m(l.node,l.offset,c.focusNode,c.focusOffset)||this.suppressWidgetCursorChange(c,o))||(this.view.observer.ignore((()=>{X.android&&X.chrome&&this.dom.contains(c.focusNode)&&function(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(1==n.nodeType&&"false"==n.contentEditable)return!0;return!1}(c.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let e=u(this.view.root);if(e)if(o.empty){if(X.gecko){let e=(t=a.node,i=a.offset,1!=t.nodeType?0:(i&&"false"==t.childNodes[i-1].contentEditable?1:0)|(io.head&&([a,l]=[l,a]),t.setEnd(l.node,l.offset),t.setStart(a.node,a.offset),e.removeAllRanges(),e.addRange(t)}var t,i;s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())})),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new P(c.anchorNode,c.anchorOffset),this.impreciseHead=l.precise?null:new P(c.focusNode,c.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&m(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=u(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!(n&&t.empty&&t.assoc&&n.modify))return;let r=ye.find(this,t.head);if(!r)return;let o=r.posAtStart;if(t.head==o||t.head==o+r.length)return;let a=this.coordsAt(t.head,-1),l=this.coordsAt(t.head,1);if(!a||!l||a.bottom>l.top)return;let h=this.domAtPos(t.head+t.assoc);n.collapse(h.node,h.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let c=e.observer.selectionRange;e.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=t.from&&n.collapse(i,s)}moveToLine(e){let t,n=this.dom;if(e.node!=n)return e;for(let i=e.offset;!t&&i=0;i--){let e=j.get(n.childNodes[i]);e instanceof ye&&(t=e.domAtPos(e.length))}return t?new P(t.node,t.offset,!0):e}nearest(e){for(let t=e;t;){let e=j.get(t);if(e&&e.rootView==this)return e;t=t.parentNode}return null}posFromDOM(e,t){let n=this.nearest(e);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(e,t)+n.posAtStart}domAtPos(e){let{i:t,off:n}=this.childCursor().findPos(e,-1);for(;t=0;r--){let o=this.children[r],a=s-o.breakAfter,l=a-o.length;if(ae||o.covers(1))&&(!n||o instanceof ye&&!(n instanceof ye&&t>=0)))n=o,i=l;else if(n&&l==e&&a==e&&o instanceof ve&&Math.abs(t)<2){if(o.deco.startSide<0)break;r&&(n=null)}s=l}return n?n.coordsAt(e-i,t):null}coordsForChar(e){let{i:t,off:n}=this.childPos(e,1),s=this.children[t];if(!(s instanceof ye))return null;for(;s.children.length;){let{i:e,off:t}=s.childPos(n,1);for(;;e++){if(e==s.children.length)return null;if((s=s.children[e]).length)break}n=t}if(!(s instanceof Z))return null;let r=(0,i.zK)(s.text,n);if(r==n)return null;let o=M(s.dom,n,r).getClientRects();for(let e=0;eMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,a=this.view.textDirection==Ce.LTR;for(let e=0,l=0;li)break;if(e>=n){let n=h.dom.getBoundingClientRect();if(t.push(n.height),r){let t=h.dom.lastChild,i=t?p(t):[];if(i.length){let t=i[i.length-1],r=a?t.right-n.left:n.right-t.left;r>o&&(o=r,this.minWidth=s,this.minWidthFrom=e,this.minWidthTo=c)}}}e=c+h.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return"rtl"==getComputedStyle(this.children[t].dom).direction?Ce.RTL:Ce.LTR}measureTextSize(){for(let e of this.children)if(e instanceof ye){let t=e.measureTextSize();if(t)return t}let e,t,n,i=document.createElement("div");return i.className="cm-line",i.style.width="99999px",i.style.position="absolute",i.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(i);let s=p(i.firstChild)[0];e=i.getBoundingClientRect().height,t=s?s.width/27:7,n=s?s.height:e,i.remove()})),{lineHeight:e,charWidth:t,textHeight:n}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new L(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,i=0;;i++){let s=i==t.viewports.length?null:t.viewports[i],r=s?s.from-1:this.length;if(r>n){let i=(t.lineBlockAt(r).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(fe.replace({widget:new xe(i),block:!0,inclusive:!0,isBlockGap:!0}).range(n,r))}if(!s)break;n=s.to+1}return fe.set(e)}updateDeco(){let e=1,t=this.view.state.facet(ft).map((t=>(this.dynamicDecorationMap[e++]="function"==typeof t)?t(this.view):t)),n=!1,s=this.view.state.facet(dt).map(((e,t)=>{let i="function"==typeof e;return i&&(n=!0),i?e(this.view):e}));for(s.length&&(this.dynamicDecorationMap[e++]=n,t.push(i.om.join(s))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];en.anchor?-1:1);if(!i)return;!n.empty&&(t=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(i={left:Math.min(i.left,t.left),top:Math.min(i.top,t.top),right:Math.max(i.right,t.right),bottom:Math.max(i.bottom,t.bottom)});let s=yt(this.view),r={left:i.left-s.left,top:i.top-s.top,right:i.right+s.right,bottom:i.bottom+s.bottom},{offsetWidth:o,offsetHeight:a}=this.view.scrollDOM;!function(e,t,n,i,s,r,o,a){let l=e.ownerDocument,h=l.defaultView||window;for(let c=e,u=!1;c&&!u;)if(1==c.nodeType){let e,f=c==l.body,d=1,p=1;if(f)e=w(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(u=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let t=c.getBoundingClientRect();({scaleX:d,scaleY:p}=k(c,t)),e={left:t.left,right:t.left+c.clientWidth*d,top:t.top,bottom:t.top+c.clientHeight*p}}let m=0,g=0;if("nearest"==s)t.top0&&t.bottom>e.bottom+g&&(g=t.bottom-e.bottom+g+o)):t.bottom>e.bottom&&(g=t.bottom-e.bottom+o,n<0&&t.top-g0&&t.right>e.right+m&&(m=t.right-e.right+m+r)):t.right>e.right&&(m=t.right-e.right+r,n<0&&t.lefte?t.left-e:Math.max(0,e-t.right)}function Ot(e,t){return t.top>e?t.top-e:Math.max(0,e-t.bottom)}function Mt(e,t){return e.topt.top+1}function _t(e,t){return te.bottom?{top:e.top,left:e.left,right:e.right,bottom:t}:e}function Nt(e,t,n){let i,s,r,o,a,l,h,c,u=!1;for(let f=e.firstChild;f;f=f.nextSibling){let e=p(f);for(let d=0;dg||o==g&&r>m){i=f,s=p,r=m,o=g;let a=g?n0?d0)}0==m?n>p.bottom&&(!h||h.bottomp.top)&&(l=f,c=p):h&&Mt(h,p)?h=Tt(h,p.bottom):c&&Mt(c,p)&&(c=_t(c,p.top))}}if(h&&h.bottom>=n?(i=a,s=h):c&&c.top<=n&&(i=l,s=c),!i)return{node:e,offset:0};let f=Math.max(s.left,Math.min(s.right,t));return 3==i.nodeType?Et(i,f,n):u&&"false"!=i.contentEditable?Nt(i,f,n):{node:e,offset:Array.prototype.indexOf.call(e.childNodes,i)+(t>=(s.left+s.right)/2?1:0)}}function Et(e,t,n){let i=e.nodeValue.length,s=-1,r=1e9,o=0;for(let a=0;an?h.top-n:n-h.bottom)-1;if(h.left-1<=t&&h.right+1>=t&&c=(h.left+h.right)/2,i=n;if((X.chrome||X.gecko)&&M(e,a).getBoundingClientRect().left==h.right&&(i=!n),c<=0)return{node:e,offset:a+(i?1:0)};s=a+(i?1:0),r=c}}}return{node:e,offset:s>-1?s:o>0?e.nodeValue.length:0}}function Dt(e,t,n,i=-1){var s,r;let o,a=e.contentDOM.getBoundingClientRect(),l=a.top+e.viewState.paddingTop,{docHeight:h}=e.viewState,{x:c,y:u}=t,f=u-l;if(f<0)return 0;if(f>h)return e.state.doc.length;for(let t=e.viewState.heightOracle.textHeight/2,s=!1;o=e.elementAtHeight(f),o.type!=ue.Text;)for(;f=i>0?o.bottom+t:o.top-t,!(f>=0&&f<=h);){if(s)return n?null:0;s=!0,i=-i}u=l+f;let d=o.from;if(de.viewport.to)return e.viewport.to==e.state.doc.length?e.state.doc.length:n?null:Pt(e,a,o,c,u);let p=e.dom.ownerDocument,m=e.root.elementFromPoint?e.root:p,g=m.elementFromPoint(c,u);g&&!e.contentDOM.contains(g)&&(g=null),g||(c=Math.max(a.left+1,Math.min(a.right-1,c)),g=m.elementFromPoint(c,u),g&&!e.contentDOM.contains(g)&&(g=null));let b,y=-1;if(g&&0!=(null===(s=e.docView.nearest(g))||void 0===s?void 0:s.isEditable))if(p.caretPositionFromPoint){let e=p.caretPositionFromPoint(c,u);e&&({offsetNode:b,offset:y}=e)}else if(p.caretRangeFromPoint){let t=p.caretRangeFromPoint(c,u);t&&(({startContainer:b,startOffset:y}=t),(!e.contentDOM.contains(b)||X.safari&&function(e,t,n){let i;if(3!=e.nodeType||t!=(i=e.nodeValue.length))return!1;for(let t=e.nextSibling;t;t=t.nextSibling)if(1!=t.nodeType||"BR"!=t.nodeName)return!1;return M(e,i-1,i).getBoundingClientRect().left>n}(b,y,c)||X.chrome&&function(e,t,n){if(0!=t)return!1;for(let t=e;;){let e=t.parentNode;if(!e||1!=e.nodeType||e.firstChild!=t)return!1;if(e.classList.contains("cm-line"))break;t=e}return n-(1==e.nodeType?e.getBoundingClientRect():M(e,0,Math.max(e.nodeValue.length,1)).getBoundingClientRect()).left>5}(b,y,c))&&(b=void 0))}if(!b||!e.docView.dom.contains(b)){let t=ye.find(e.docView,d);if(!t)return f>o.top+o.height/2?o.to:o.from;({node:b,offset:y}=Nt(t.dom,c,u))}let v=e.docView.nearest(b);if(!v)return null;if(v.isWidget&&1==(null===(r=v.dom)||void 0===r?void 0:r.nodeType)){let e=v.dom.getBoundingClientRect();return t.y1.5*e.defaultLineHeight){let t=e.viewState.heightOracle.textHeight;o+=Math.floor((r-n.top-.5*(e.defaultLineHeight-t))/t)*e.viewState.heightOracle.lineLength}let a=e.state.sliceDoc(n.from,n.to);return n.from+(0,i.kn)(a,o,e.state.tabSize)}function Rt(e,t){let n=e.lineBlockAt(t);if(Array.isArray(n.type))for(let e of n.type)if(e.to>t||e.to==t&&(e.to==n.to||e.type==ue.Text))return e;return n}function jt(e,t,n,i){let s=e.state.doc.lineAt(t.head),r=e.bidiSpans(s),o=e.textDirectionAt(s.from);for(let a=t,l=null;;){let t=$e(s,r,o,a,n),h=ze;if(!t){if(s.number==(n?e.state.doc.lines:1))return a;h="\n",s=e.state.doc.line(s.number+(n?1:-1)),r=e.bidiSpans(s),t=e.visualLineSide(s,!n)}if(l){if(!l(h))return a}else{if(!i)return t;l=i(h)}a=t}}function It(e,t,n){for(;;){let i=0;for(let s of e)s.between(t-1,t+1,((e,s,r)=>{if(t>e&&tt(e))),n.from,t.head>n.from?-1:1);return s==n.from?n:i.OF.cursor(s,se)&&this.lineBreak(),i=s}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s,r=-1,o=1;if(this.lineSeparator?(r=t.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(s=i.exec(t))&&(r=s.index,o=s[0].length),this.append(t.slice(n,r<0?t.length:r)),r<0)break;if(this.lineBreak(),o>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=o-1);n=r+o}}readNode(e){if(e.cmIgnore)return;let t=j.get(e),n=t&&t.overrideDOMText;if(null!=n){this.findPointInside(e,n.length);for(let e=n.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else 3==e.nodeType?this.readTextNode(e):"BR"==e.nodeName?e.nextSibling&&this.lineBreak():1==e.nodeType&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(3==e.nodeType?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(zt(e,n.node,n.offset)?t:0))}}function zt(e,t,n){for(;;){if(!t||n-1;let{impreciseHead:r,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,n,0))){let t=r||o?[]:function(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:i,focusNode:s,focusOffset:r}=e.observer.selectionRange;return n&&(t.push(new $t(n,i)),s==n&&r==i||t.push(new $t(s,r))),t}(e),n=new Ft(t,e.state);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=function(e,t){if(0==e.length)return null;let n=e[0].pos,s=2==e.length?e[1].pos:n;return n>-1&&s>-1?i.OF.single(n+t,s+t):null}(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=r&&r.node==t.focusNode&&r.offset==t.focusOffset||!f(e.contentDOM,t.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),s=o&&o.node==t.anchorNode&&o.offset==t.anchorOffset||!f(e.contentDOM,t.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),a=e.viewport;if((X.ios||X.chrome)&&e.state.selection.main.empty&&n!=s&&(a.from>0||a.toDate.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:s,to:a}=t.bounds,l=r.from,h=null;(8===o||X.android&&t.text.length0&&a>0&&e.charCodeAt(o-1)==t.charCodeAt(a-1);)o--,a--;return"end"==i&&(n-=o+Math.max(0,r-Math.min(o,a))-r),o=o?r-n:0,a=r+(a-o),o=r):a=a?r-n:0,o=r+(o-a),a=r),{from:r,toA:o,toB:a}}(e.state.doc.sliceString(s,a,Bt),t.text,l-s,h);c&&(X.chrome&&13==o&&c.toB==c.from+2&&t.text.slice(c.from,c.toB)==Bt+Bt&&c.toB--,n={from:s+c.from,to:s+c.toA,insert:i.EY.of(t.text.slice(c.from,c.toB).split(Bt))})}else s&&(!e.hasFocus&&e.state.facet(rt)||s.main.eq(r))&&(s=null);if(!n&&!s)return!1;if(!n&&t.typeOver&&!r.empty&&s&&s.main.empty?n={from:r.from,to:r.to,insert:e.state.doc.slice(r.from,r.to)}:n&&n.from>=r.from&&n.to<=r.to&&(n.from!=r.from||n.to!=r.to)&&r.to-r.from-(n.to-n.from)<=4?n={from:r.from,to:r.to,insert:e.state.doc.slice(r.from,n.from).append(n.insert).append(e.state.doc.slice(n.to,r.to))}:(X.mac||X.android)&&n&&n.from==n.to&&n.from==r.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(s&&2==n.insert.length&&(s=i.OF.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:i.EY.of([" "])}):X.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(s&&(s=i.OF.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:i.EY.of([" "])}),n)return Vt(e,n,s,o);if(s&&!s.main.eq(r)){let t=!1,n="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(t=!0),n=e.inputState.lastSelectionOrigin),e.dispatch({selection:s,scrollIntoView:t,userEvent:n}),!0}return!1}function Vt(e,t,n,s=-1){if(X.ios&&e.inputState.flushIOSKey(t))return!0;let r=e.state.selection.main;if(X.android&&(t.to==r.to&&(t.from==r.from||t.from==r.from-1&&" "==e.state.sliceDoc(t.from,r.from))&&1==t.insert.length&&2==t.insert.lines&&_(e.contentDOM,"Enter",13)||(t.from==r.from-1&&t.to==r.to&&0==t.insert.length||8==s&&t.insert.lengthr.head)&&_(e.contentDOM,"Backspace",8)||t.from==r.from&&t.to==r.to+1&&0==t.insert.length&&_(e.contentDOM,"Delete",46)))return!0;let o,a=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let l=()=>o||(o=function(e,t,n){let s,r=e.state,o=r.selection.main;if(t.from>=o.from&&t.to<=o.to&&t.to-t.from>=(o.to-o.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=o.fromt.to?r.sliceDoc(t.to,o.to):"";s=r.replaceSelection(e.state.toText(n+t.insert.sliceString(0,void 0,e.state.lineBreak)+i))}else{let a=r.changes(t),l=n&&n.main.to<=a.newLength?n.main:void 0;if(r.selection.ranges.length>1&&e.inputState.composing>=0&&t.to<=o.to&&t.to>=o.to-10){let h,c=e.state.sliceDoc(t.from,t.to),u=n&&St(e,n.main.head);if(u){let e=t.insert.length-(t.to-t.from);h={from:u.from,to:u.to-e}}else h=e.state.doc.lineAt(o.head);let f=o.to-t.to,d=o.to-o.from;s=r.changeByRange((n=>{if(n.from==o.from&&n.to==o.to)return{changes:a,range:l||n.map(a)};let s=n.to-f,u=s-c.length;if(n.to-n.from!=d||e.state.sliceDoc(u,s)!=c||n.to>=h.from&&n.from<=h.to)return{range:n};let p=r.changes({from:u,to:s,insert:t.insert}),m=n.to-o.to;return{changes:p,range:l?i.OF.range(Math.max(0,l.anchor+m),Math.max(0,l.head+m)):n.map(p)}}))}else s={changes:a,selection:l&&r.selection.replaceRange(l)}}let a="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1)),r.update(s,{userEvent:a,scrollIntoView:!0})}(e,t,n));return e.state.facet(Ke).some((n=>n(e,t.from,t.to,a,l)))||e.dispatch(l()),!0}class Wt{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,X.safari&&e.contentDOM.addEventListener("input",(()=>null)),X.gecko&&function(e){vn.has(e)||(vn.add(e),e.addEventListener("copy",(()=>{})),e.addEventListener("cut",(()=>{})))}(e.contentDOM.ownerDocument)}handleEvent(e){(function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n,i=t.target;i!=e.contentDOM;i=i.parentNode)if(!i||11==i.nodeType||(n=j.get(i))&&n.ignoreEvent(t))return!1;return!0})(this.view,e)&&!this.ignoreDuringComposition(e)&&("keydown"==e.type&&this.keydown(e)||this.runHandlers(e.type,e))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let e of n.observers)e(this.view,t);for(let e of n.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=Ut(e),n=this.handlers,i=this.view.contentDOM;for(let e in t)if("scroll"!=e){let s=!t[e].handlers.length,r=n[e];r&&s!=!r.handlers.length&&(i.removeEventListener(e,this.handleEvent),r=null),r||i.addEventListener(e,this.handleEvent,{passive:s})}for(let e in n)"scroll"==e||t[e]||i.removeEventListener(e,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),9==e.keyCode&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&27!=e.keyCode&&Jt.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),X.android&&X.chrome&&!e.synthetic&&(13==e.keyCode||8==e.keyCode))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return!X.ios||e.synthetic||e.altKey||e.metaKey||!((t=Kt.find((t=>t.keyCode==e.keyCode)))&&!e.ctrlKey||Yt.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(229!=e.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=t||e,setTimeout((()=>this.flushIOSKey()),250),!0)}flushIOSKey(e){let t=this.pendingIOSKey;return!!t&&!("Enter"==t.key&&e&&e.from0||!!(X.safari&&!X.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Gt(e,t){return(n,i)=>{try{return t.call(e,i,n)}catch(e){st(n.state,e)}}}function Ut(e){let t=Object.create(null);function n(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec;if(e&&e.domEventHandlers)for(let i in e.domEventHandlers){let s=e.domEventHandlers[i];s&&n(i).handlers.push(Gt(t.value,s))}if(e&&e.domEventObservers)for(let i in e.domEventObservers){let s=e.domEventObservers[i];s&&n(i).observers.push(Gt(t.value,s))}}for(let e in Qt)n(e).handlers.push(Qt[e]);for(let e in en)n(e).observers.push(en[e]);return t}const Kt=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Yt="dthko",Jt=[16,17,18,20,91,92,224,225];function Xt(e){return.7*Math.max(0,e)+8}class Zt{constructor(e,t,n,s){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=function(e){let t,n,i=e.ownerDocument;for(let s=e.parentNode;s&&!(s==i.body||t&&n);)if(1==s.nodeType)!n&&s.scrollHeight>s.clientHeight&&(n=s),!t&&s.scrollWidth>s.clientWidth&&(t=s),s=s.assignedSlot||s.parentNode;else{if(11!=s.nodeType)break;s=s.host}return{x:t,y:n}}(e.contentDOM),this.atoms=e.state.facet(pt).map((t=>t(e)));let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(i.$t.allowMultipleSelections)&&function(e,t){let n=e.state.facet(qe);return n.length?n[0](t):X.mac?t.metaKey:t.ctrlKey}(e,t),this.dragging=!(!function(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let i=u(e.root);if(!i||0==i.rangeCount)return!0;let s=i.getRangeAt(0).getClientRects();for(let e=0;e=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}(e,t)||1!=dn(t))&&null}start(e){!1===this.dragging&&this.select(e)}move(e){if(0==e.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(t=this.startEvent,n=e,Math.max(Math.abs(t.clientX-n.clientX),Math.abs(t.clientY-n.clientY))<10))return;var t,n;this.select(this.lastEvent=e);let i=0,s=0,r=0,o=0,a=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:o,bottom:l}=this.scrollParents.y.getBoundingClientRect());let h=yt(this.view);e.clientX-h.left<=r+6?i=-Xt(r-e.clientX):e.clientX+h.right>=a-6&&(i=Xt(e.clientX-a)),e.clientY-h.top<=o+6?s=-Xt(o-e.clientY):e.clientY+h.bottom>=l-6&&(s=Xt(e.clientY-l)),this.setScrollSpeed(i,s)}up(e){null==this.dragging&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval((()=>this.scroll()),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),!1===this.dragging&&this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let n=0;ne.isUserEvent("input.type")))?this.destroy():this.style.update(e)&&setTimeout((()=>this.select(this.lastEvent)),20)}}const Qt=Object.create(null),en=Object.create(null),tn=X.ie&&X.ie_version<15||X.ios&&X.webkit_version<604;function nn(e,t,n){for(let i of e.facet(t))n=i(n,e);return n}function sn(e,t){t=nn(e.state,Je,t);let n,{state:s}=e,r=1,o=s.toText(t),a=o.lines==s.selection.ranges.length;if(null!=mn&&s.selection.ranges.every((e=>e.empty))&&mn==o.toString()){let e=-1;n=s.changeByRange((n=>{let l=s.doc.lineAt(n.from);if(l.from==e)return{range:n};e=l.from;let h=s.toText((a?o.line(r++).text:t)+s.lineBreak);return{changes:{from:l.from,insert:h},range:i.OF.cursor(n.from+h.length)}}))}else n=a?s.changeByRange((e=>{let t=o.line(r++);return{changes:{from:e.from,to:e.to,insert:t.text},range:i.OF.cursor(e.from+t.length)}})):s.replaceSelection(o);e.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}function rn(e,t,n,s){if(1==s)return i.OF.cursor(t,n);if(2==s)return function(e,t,n=1){let s=e.charCategorizer(t),r=e.doc.lineAt(t),o=t-r.from;if(0==r.length)return i.OF.cursor(t);0==o?n=1:o==r.length&&(n=-1);let a=o,l=o;n<0?a=(0,i.zK)(r.text,o,!1):l=(0,i.zK)(r.text,o);let h=s(r.text.slice(a,l));for(;a>0;){let e=(0,i.zK)(r.text,a,!1);if(s(r.text.slice(e,a))!=h)break;a=e}for(;l{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft},Qt.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),27==t.keyCode&&0!=e.inputState.tabFocusMode&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),en.touchstart=(e,t)=>{e.inputState.lastTouchTime=Date.now(),e.inputState.setSelectionOrigin("select.pointer")},en.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")},Qt.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let i of e.state.facet(We))if(n=i(e,t),n)break;if(n||0!=t.button||(n=function(e,t){let n=ln(e,t),s=dn(t),r=e.state.selection;return{update(e){e.docChanged&&(n.pos=e.changes.mapPos(n.pos),r=r.map(e.changes))},get(t,o,a){let l,h=ln(e,t),c=rn(e,h.pos,h.bias,s);if(n.pos!=h.pos&&!o){let t=rn(e,n.pos,n.bias,s),r=Math.min(t.from,c.from),o=Math.max(t.to,c.to);c=r1&&(l=function(e,t){for(let n=0;n=t)return i.OF.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}(r,h.pos))?l:a?r.addRange(c):i.OF.create([c])}}}(e,t)),n){let i=!e.hasFocus;e.inputState.startMouseSelection(new Zt(e,t,n,i)),i&&e.observer.ignore((()=>{O(e.contentDOM);let t=e.root.activeElement;t&&!t.contains(e.contentDOM)&&t.blur()}));let s=e.inputState.mouseSelection;if(s)return s.start(t),!1===s.dragging}return!1};let on=(e,t,n)=>t>=n.top&&t<=n.bottom&&e>=n.left&&e<=n.right;function an(e,t,n,i){let s=ye.find(e.docView,t);if(!s)return 1;let r=t-s.posAtStart;if(0==r)return 1;if(r==s.length)return-1;let o=s.coordsAt(r,-1);if(o&&on(n,i,o))return-1;let a=s.coordsAt(r,1);return a&&on(n,i,a)?1:o&&o.bottom>=i?-1:1}function ln(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1);return{pos:n,bias:an(e,n,t.clientX,t.clientY)}}const hn=X.ie&&X.ie_version<=11;let cn=null,un=0,fn=0;function dn(e){if(!hn)return e.detail;let t=cn,n=fn;return cn=e,fn=Date.now(),un=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(un+1)%3:1}function pn(e,t,n,i){if(!(n=nn(e.state,Je,n)))return;let s=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:r}=e.inputState,o=i&&r&&function(e,t){let n=e.state.facet(Ve);return n.length?n[0](t):X.mac?!t.altKey:!t.ctrlKey}(e,t)?{from:r.from,to:r.to}:null,a={from:s,insert:n},l=e.state.changes(o?[o,a]:a);e.focus(),e.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),e.inputState.draggedContent=null}Qt.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let s=e.docView.nearest(t.target);if(s&&s.isWidget){let e=s.posAtStart,t=e+s.length;(e>=n.to||t<=n.from)&&(n=i.OF.range(e,t))}}let{inputState:s}=e;return s.mouseSelection&&(s.mouseSelection.dragging=!0),s.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",nn(e.state,Xe,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1},Qt.dragend=e=>(e.inputState.draggedContent=null,!1),Qt.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let i=Array(n.length),s=0,r=()=>{++s==n.length&&pn(e,t,i.filter((e=>null!=e)).join(e.state.lineBreak),!1)};for(let e=0;e{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(i[e]=t.result),r()},t.readAsText(n[e])}return!0}{let n=t.dataTransfer.getData("Text");if(n)return pn(e,t,n,!0),!0}return!1},Qt.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=tn?null:t.clipboardData;return n?(sn(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(function(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout((()=>{e.focus(),n.remove(),sn(e,n.value)}),50)}(e),!1)};let mn=null;Qt.copy=Qt.cut=(e,t)=>{let{text:n,ranges:i,linewise:s}=function(e){let t=[],n=[],i=!1;for(let i of e.selection.ranges)i.empty||(t.push(e.sliceDoc(i.from,i.to)),n.push(i));if(!t.length){let s=-1;for(let{from:i}of e.selection.ranges){let r=e.doc.lineAt(i);r.number>s&&(t.push(r.text),n.push({from:r.from,to:Math.min(e.doc.length,r.to+1)})),s=r.number}i=!0}return{text:nn(e,Xe,t.join(e.lineBreak)),ranges:n,linewise:i}}(e.state);if(!n&&!s)return!1;mn=s?n:null,"cut"!=t.type||e.state.readOnly||e.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let r=tn?null:t.clipboardData;return r?(r.clearData(),r.setData("text/plain",n),!0):(function(e,t){let n=e.dom.parentNode;if(!n)return;let i=n.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=t,i.focus(),i.selectionEnd=t.length,i.selectionStart=0,setTimeout((()=>{i.remove(),e.focus()}),50)}(e,n),!1)};const gn=i.YH.define();function bn(e,t){let n=[];for(let i of e.facet(Ye)){let s=i(e,t);s&&n.push(s)}return n?e.update({effects:n,annotations:gn.of(!0)}):null}function yn(e){setTimeout((()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=bn(e.state,t);n?e.dispatch(n):e.update([])}}),10)}en.focus=e=>{e.inputState.lastFocusTime=Date.now(),e.scrollDOM.scrollTop||!e.inputState.lastScrollTop&&!e.inputState.lastScrollLeft||(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),yn(e)},en.blur=e=>{e.observer.clearSelectionRange(),yn(e)},en.compositionstart=en.compositionupdate=e=>{e.observer.editContext||(null==e.inputState.compositionFirstChange&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))},en.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,X.chrome&&X.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then((()=>e.observer.flush())):setTimeout((()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])}),50))},en.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},Qt.beforeinput=(e,t)=>{var n,i;if("insertReplacementText"==t.inputType&&e.observer.editContext){let i=null===(n=t.dataTransfer)||void 0===n?void 0:n.getData("text/plain"),s=t.getTargetRanges();if(i&&s.length){let t=s[0],n=e.posAtDOM(t.startContainer,t.startOffset),r=e.posAtDOM(t.endContainer,t.endOffset);return Vt(e,{from:n,to:r,insert:e.state.toText(i)},null),!0}}let s;if(X.chrome&&X.android&&(s=Kt.find((e=>e.inputType==t.inputType)))&&(e.observer.delayAndroidKey(s.key,s.keyCode),"Backspace"==s.key||"Delete"==s.key)){let t=(null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0;setTimeout((()=>{var n;((null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())}),100)}return X.ios&&"deleteContentForward"==t.inputType&&e.observer.flushSoon(),X.safari&&"insertText"==t.inputType&&e.inputState.composing>=0&&setTimeout((()=>en.compositionend(e,t)),20),!1};const vn=new Set,xn=["pre-wrap","normal","pre-line","break-spaces"];let wn=!1;function kn(){wn=!1}class Sn{constructor(e){this.lineWrapping=e,this.doc=i.EY.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return xn.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n-1,a=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=t,this.charWidth=n,this.textHeight=i,this.lineLength=s,a){this.heightSamples={};for(let e=0;e0}set outdated(e){this.flags=(e?2:0)|-3&this.flags}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Mn&&(wn=!0),this.height=e)}replace(e,t,n){return _n.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,i){let s=this,r=n.doc;for(let o=i.length-1;o>=0;o--){let{fromA:a,toA:l,fromB:h,toB:c}=i[o],u=s.lineAt(a,On.ByPosNoHeight,n.setDoc(t),0,0),f=u.to>=l?u:s.lineAt(l,On.ByPosNoHeight,n,0,0);for(c+=f.to-l,l=f.to;o>0&&u.from<=i[o-1].toA;)a=i[o-1].fromA,h=i[o-1].fromB,o--,a2*s){let s=e[t-1];s.break?e.splice(--t,1,s.left,null,s.right):e.splice(--t,1,s.left,s.right),n+=1+s.break,i-=s.size}else{if(!(s>2*i))break;{let t=e[n];t.break?e.splice(n,1,t.left,null,t.right):e.splice(n,1,t.left,t.right),n+=2+t.break,s-=t.size}}else if(i=s&&r(this.blockAt(0,n,i,s))}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more&&this.setHeight(i.heights[i.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class En extends Nn{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,n,i){return new An(i,this.length,n,this.height,this.breaks)}replace(e,t,n){let i=n[0];return 1==n.length&&(i instanceof En||i instanceof Dn&&4&i.flags)&&Math.abs(this.length-i.length)<10?(i instanceof Dn?i=new En(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):_n.of(n)}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more?this.setHeight(i.heights[i.index++]):(n||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Dn extends _n{constructor(e){super(e,0)}heightMetrics(e,t){let n,i=e.doc.lineAt(t).number,s=e.doc.lineAt(t+this.length).number,r=s-i+1,o=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*r);n=t/r,this.length>r+1&&(o=(this.height-t)/(this.length-r-1))}else n=this.height/r;return{firstLine:i,lastLine:s,perLine:n,perChar:o}}blockAt(e,t,n,i){let{firstLine:s,lastLine:r,perLine:o,perChar:a}=this.heightMetrics(t,i);if(t.lineWrapping){let s=i+(e0){let e=n[n.length-1];e instanceof Dn?n[n.length-1]=new Dn(e.length+i):n.push(null,new Dn(i-1))}if(e>0){let t=n[0];t instanceof Dn?n[0]=new Dn(e+t.length):n.unshift(new Dn(e-1),null)}return _n.of(n)}decomposeLeft(e,t){t.push(new Dn(e-1),null)}decomposeRight(e,t){t.push(null,new Dn(this.length-e-1))}updateHeight(e,t=0,n=!1,i){let s=t+this.length;if(i&&i.from<=t+this.length&&i.more){let n=[],r=Math.max(t,i.from),o=-1;for(i.from>t&&n.push(new Dn(i.from-t-1).updateHeight(e,t));r<=s&&i.more;){let t=e.doc.lineAt(r).length;n.length&&n.push(null);let s=i.heights[i.index++];-1==o?o=s:Math.abs(s-o)>=Mn&&(o=-2);let a=new En(t,s);a.outdated=!1,n.push(a),r+=t+1}r<=s&&n.push(null,new Dn(s-r).updateHeight(e,r));let a=_n.of(n);return(o<0||Math.abs(a.height-this.height)>=Mn||Math.abs(o-this.heightMetrics(e,t).perLine)>=Mn)&&(wn=!0),Tn(this,a)}return(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class Pn extends _n{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return 1&this.flags}blockAt(e,t,n,i){let s=n+this.left.height;return eo))return l;let h=t==On.ByPosNoHeight?On.ByPosNoHeight:On.ByPos;return a?l.join(this.right.lineAt(o,h,n,r,o)):this.left.lineAt(o,h,n,i,s).join(l)}forEachLine(e,t,n,i,s,r){let o=i+this.left.height,a=s+this.left.length+this.break;if(this.break)e=a&&this.right.forEachLine(e,t,n,o,a,r);else{let l=this.lineAt(a,On.ByPos,n,i,s);e=e&&l.from<=t&&r(l),t>l.to&&this.right.forEachLine(l.to+1,t,n,o,a,r)}}replace(e,t,n){let i=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-i,t-i,n));let s=[];e>0&&this.decomposeLeft(e,s);let r=s.length;for(let e of n)s.push(e);if(e>0&&Rn(s,r-1),t=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,i=n+this.break;if(e>=i)return this.right.decomposeRight(e-i,t);e2*t.size||t.size>2*e.size?_n.of(this.break?[e,null,t]:[e,t]):(this.left=Tn(this.left,e),this.right=Tn(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,i){let{left:s,right:r}=this,o=t+s.length+this.break,a=null;return i&&i.from<=t+s.length&&i.more?a=s=s.updateHeight(e,t,n,i):s.updateHeight(e,t,n),i&&i.from<=o+r.length&&i.more?a=r=r.updateHeight(e,o,n,i):r.updateHeight(e,o,n),a?this.balanced(s,r):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Rn(e,t){let n,i;null==e[t]&&(n=e[t-1])instanceof Dn&&(i=e[t+1])instanceof Dn&&e.splice(t-1,3,new Dn(n.length+1+i.length))}class jn{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let e=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof En?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new En(e-this.pos,-1)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e=5)&&this.addLineDeco(i,s,r)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenToe&&this.nodes.push(new En(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let n=new Dn(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof En)return e;let t=new En(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let i=this.ensureLine();i.length+=n,i.collapsed+=n,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||t instanceof En||this.isCovered?(this.writtenTon.clientHeight||n.scrollWidth>n.clientWidth)&&"visible"!=i.overflow){let i=n.getBoundingClientRect();r=Math.max(r,i.left),o=Math.min(o,i.right),a=Math.max(a,i.top),l=Math.min(t==e.parentNode?s.innerHeight:l,i.bottom)}t="absolute"==i.position||"fixed"==i.position?n.offsetParent:n.parentNode}else{if(11!=t.nodeType)break;t=t.host}return{left:r-n.left,right:Math.max(r,o)-n.left,top:a-(n.top+t),bottom:Math.max(a,l)-(n.top+t)}}function Bn(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class Fn{constructor(e,t,n){this.from=e,this.to=t,this.size=n}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n"function"!=typeof e&&"cm-lineWrapping"==e.class));this.heightOracle=new Sn(t),this.stateDeco=e.facet(ft).filter((e=>"function"!=typeof e)),this.heightMap=_n.empty().applyChanges(this.stateDeco,i.EY.empty,this.heightOracle.setDoc(e.doc),[new xt(0,0,0,e.doc.length)]);for(let e=0;e<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());e++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=fe.set(this.lineGaps.map((e=>e.draw(this,!1)))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let i=n?t.head:t.anchor;if(!e.some((({from:e,to:t})=>i>=e&&i<=t))){let{from:t,to:n}=this.lineBlockAt(i);e.push(new Hn(t,n))}}return this.viewports=e.sort(((e,t)=>e.from-t.from)),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Wn:new Gn(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,(e=>{this.viewportLines.push(Un(e,this.scaler))}))}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet(ft).filter((e=>"function"!=typeof e));let s=e.changedRanges,r=xt.extendWithRanges(s,function(e,t,n){let s=new In;return i.om.compare(e,t,n,s,0),s.changes}(n,this.stateDeco,e?e.changes:i.VR.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);kn(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=o||wn)&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let l=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.headl.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,t));let h=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,e.flags|=this.updateForViewport(),(h||!e.changes.empty||2&e.flags)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Qe)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),s=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Ce.RTL:Ce.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),a=t.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let h=0,c=0;if(a.width&&a.height){let{scaleX:e,scaleY:n}=k(t,a);(e>.005&&Math.abs(this.scaleX-e)>.005||n>.005&&Math.abs(this.scaleY-n)>.005)&&(this.scaleX=e,this.scaleY=n,h|=8,o=l=!0)}let u=(parseInt(n.paddingTop)||0)*this.scaleY,f=(parseInt(n.paddingBottom)||0)*this.scaleY;this.paddingTop==u&&this.paddingBottom==f||(this.paddingTop=u,this.paddingBottom=f,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=N(e.scrollDOM);let p=(this.printing?Bn:Ln)(t,this.paddingTop),m=p.top-this.pixelViewport.top,g=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let b=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(b!=this.inView&&(this.inView=b,b&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let y=a.width;if(this.contentDOMWidth==y&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),l){let t=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(t)&&(o=!0),o||s.lineWrapping&&Math.abs(y-this.contentDOMWidth)>s.charWidth){let{lineHeight:n,charWidth:i,textHeight:a}=e.docView.measureTextSize();o=n>0&&s.refresh(r,n,i,a,y/i,t),o&&(e.docView.minWidth=0,h|=8)}m>0&&g>0?c=Math.max(m,g):m<0&&g<0&&(c=Math.min(m,g)),kn();for(let n of this.viewports){let r=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(o?_n.empty().applyChanges(this.stateDeco,i.EY.empty,this.heightOracle,[new xt(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new Cn(n.from,r))}wn&&(h|=2)}let v=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return v&&(2&h&&(h|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),h|=this.updateForViewport()),(2&h||v)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,s=this.heightOracle,{visibleTop:r,visibleBottom:o}=this,a=new Hn(i.lineAt(r-1e3*n,On.ByHeight,s,0,0).from,i.lineAt(o+1e3*(1-n),On.ByHeight,s,0,0).to);if(t){let{head:e}=t.range;if(ea.to){let n,r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=i.lineAt(e,On.ByPos,s,0,0);n="center"==t.y?(o.top+o.bottom)/2-r/2:"start"==t.y||"nearest"==t.y&&e=o+Math.max(10,Math.min(n,250)))&&i>r-2e3&&s>1,o=s<<1;if(this.defaultTextDirection!=Ce.LTR&&!n)return[];let a=[],l=(s,o,h,c)=>{if(o-ss&&ee.from>=h.from&&e.to<=h.to&&Math.abs(e.from-s)e.fromt))));if(!d){if(oe.from<=o&&e.to>=o))){let e=t.moveToLineBoundary(i.OF.cursor(o),!1,!0).head;e>s&&(o=e)}d=new Fn(s,o,this.gapSize(h,s,o,c))}a.push(d)},h=e=>{if(e.lengthr&&(s.push({from:r,to:e}),o+=e-r),r=t}},20),re.from&&l(e.from,r,e,t),ae.draw(this,this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let t=[];i.om.spans(e,this.viewport.from,this.viewport.to,{span(e,n){t.push({from:e,to:n})},point(){}},20);let n=t.length!=this.visibleRanges.length||this.visibleRanges.some(((e,n)=>e.from!=t[n].from||e.to!=t[n].to));return this.visibleRanges=t,n?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find((t=>t.from<=e&&t.to>=e))||Un(this.heightMap.lineAt(e,On.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find((t=>t.top<=e&&t.bottom>=e))||Un(this.heightMap.lineAt(this.scaler.fromDOM(e),On.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Un(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Hn{constructor(e,t){this.from=e,this.to=t}}function qn({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let i=Math.floor(e*n);for(let e=0;;e++){let{from:n,to:s}=t[e],r=s-n;if(i<=r)return n+i;i-=r}}function Vn(e,t){let n=0;for(let{from:i,to:s}of e.ranges){if(t<=s){n+=t-i;break}n+=s-i}return n/e.total}const Wn={toDOM:e=>e,fromDOM:e=>e,scale:1,eq(e){return e==this}};class Gn{constructor(e,t,n){let i=0,s=0,r=0;this.viewports=n.map((({from:n,to:s})=>{let r=t.lineAt(n,On.ByPos,e,0,0).top,o=t.lineAt(s,On.ByPos,e,0,0).bottom;return i+=o-r,{from:n,to:s,top:r,bottom:o,domTop:0,domBottom:0}})),this.scale=(7e6-i)/(t.height-i);for(let e of this.viewports)e.domTop=r+(e.top-s)*this.scale,r=e.domBottom=e.domTop+(e.bottom-e.top),s=e.bottom}toDOM(e){for(let t=0,n=0,i=0;;t++){let s=tt.from==e.viewports[n].from&&t.to==e.viewports[n].to))}}function Un(e,t){if(1==t.scale)return e;let n=t.toDOM(e.top),i=t.toDOM(e.bottom);return new An(e.from,e.length,n,i-n,Array.isArray(e._content)?e._content.map((e=>Un(e,t))):e._content)}const Kn=i.sj.define({combine:e=>e.join(" ")}),Yn=i.sj.define({combine:e=>e.indexOf(!0)>-1}),Jn=s.G.newName(),Xn=s.G.newName(),Zn=s.G.newName(),Qn={"&light":"."+Xn,"&dark":"."+Zn};function ei(e,t,n){return new s.G(t,{finish:t=>/&/.test(t)?t.replace(/&\w*/,(t=>{if("&"==t)return e;if(!n||!n[t])throw new RangeError(`Unsupported selector: ${t}`);return n[t]})):e+" "+t})}const ti=ei("."+Jn,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Qn),ni={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},ii=X.ie&&X.ie_version<=11;class si{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new S,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver((t=>{for(let e of t)this.queue.push(e);(X.ie&&X.ie_version<=11||X.ios&&e.composing)&&t.some((e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length))?this.flushSoon():this.flush()})),!window.EditContext||!1===e.constructor.EDIT_CONTEXT||X.chrome&&X.chrome_version<126||(this.editContext=new ai(e),e.state.facet(rt)&&(e.contentDOM.editContext=this.editContext.editContext)),ii&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver((()=>{var e;(null===(e=this.view.docView)||void 0===e?void 0:e.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))}),{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver((e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))}),{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout((()=>{this.resizeTimeout=-1,this.view.requestMeasure()}),50))}onPrint(e){("change"!=e.type&&e.type||e.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout((()=>{this.view.viewState.printing=!1,this.view.requestMeasure()}),500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some(((t,n)=>t!=e[n])))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,i=this.selectionRange;if(n.state.facet(rt)?n.root.activeElement!=this.dom:!d(n.dom,i))return;let s=i.anchorNode&&n.docView.nearest(i.anchorNode);s&&s.ignoreEvent(e)?t||(this.selectionChanged=!1):(X.ie&&X.ie_version<=11||X.android&&X.chrome)&&!n.state.selection.main.empty&&i.focusNode&&m(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=u(e.root);if(!t)return!1;let n=X.safari&&11==e.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return oi(e,n)}let n=null;function i(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",i,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",i,!0),n?oi(e,n):null}(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let i=d(this.dom,n);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let e=this.delayedAndroidKey;e&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&_(this.dom,e.key,e.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}this.delayedAndroidKey&&"Enter"!=e||(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange{this.delayedFlush=-1,this.flush()})))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,i=!1;for(let s of e){let e=this.readMutation(s);e&&(e.typeOver&&(i=!0),-1==t?({from:t,to:n}=e):(t=Math.min(e.from,t),n=Math.max(e.to,n)))}return{from:t,to:n,typeOver:i}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),i=this.selectionChanged&&d(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new Ht(this.view,e,t,n);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,i=qt(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),i}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty("attributes"==e.type),"attributes"==e.type&&(t.flags|=4),"childList"==e.type){let n=ri(t,e.previousSibling||e.target.previousSibling,-1),i=ri(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:i?t.posBefore(i):t.posAtEnd,typeOver:!1}}return"characterData"==e.type?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(rt)!=e.state.facet(rt)&&(e.view.contentDOM.editContext=e.state.facet(rt)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),null===(e=this.intersection)||void 0===e||e.disconnect(),null===(t=this.gapIntersection)||void 0===t||t.disconnect(),null===(n=this.resizeScroll)||void 0===n||n.disconnect();for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function ri(e,t,n){for(;t;){let i=j.get(t);if(i&&i.parent==e)return i;let s=t.parentNode;t=s!=e.dom?s:n>0?t.nextSibling:t.previousSibling}return null}function oi(e,t){let n=t.startContainer,i=t.startOffset,s=t.endContainer,r=t.endOffset,o=e.docView.domAtPos(e.state.selection.main.anchor);return m(o.node,o.offset,s,r)&&([n,i,s,r]=[s,r,n,i]),{anchorNode:n,anchorOffset:i,focusNode:s,focusOffset:r}}class ai{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=t=>{let{anchor:n}=e.state.selection.main,s={from:this.toEditorPos(t.updateRangeStart),to:this.toEditorPos(t.updateRangeEnd),insert:i.EY.of(t.text.split("\n"))};s.from==this.from&&nthis.to&&(s.to=n),(s.from!=s.to||s.insert.length)&&(this.pendingContextChange=s,e.state.readOnly||Vt(e,s,i.OF.single(this.toEditorPos(t.selectionStart),this.toEditorPos(t.selectionEnd))),this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)))},this.handlers.characterboundsupdate=n=>{let i=[],s=null;for(let t=this.toEditorPos(n.rangeStart),r=this.toEditorPos(n.rangeEnd);t{let n=[];for(let e of t.getTextFormats()){let t=e.underlineStyle,i=e.underlineThickness;if("None"!=t&&"None"!=i){let s=`text-decoration: underline ${"Dashed"==t?"dashed ":"Squiggle"==t?"wavy ":""}${"Thin"==i?1:2}px`;n.push(fe.mark({attributes:{style:s}}).range(this.toEditorPos(e.rangeStart),this.toEditorPos(e.rangeEnd)))}}e.dispatch({effects:it.of(fe.set(n))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{e.inputState.composing=-1,e.inputState.compositionFirstChange=null};for(let e in this.handlers)t.addEventListener(e,this.handlers[e]);this.measureReq={read:e=>{this.editContext.updateControlBounds(e.contentDOM.getBoundingClientRect());let t=u(e.root);t&&t.rangeCount&&this.editContext.updateSelectionBounds(t.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,i=this.pendingContextChange;return e.changes.iterChanges(((s,r,o,a,l)=>{if(n)return;let h=l.length-(r-s);if(i&&r>=i.to){if(i.from==s&&i.to==r&&i.insert.eq(l))return i=this.pendingContextChange=null,t+=h,void(this.to+=h);i=null,this.revertPending(e.state)}if(s+=t,(r+=t)<=this.from)this.from+=h,this.to+=h;else if(sthis.to||this.to-this.from+l.length>3e4)return void(n=!0);this.editContext.updateText(this.toContextPos(s),this.toContextPos(r),l.toString()),this.to+=h}t+=h})),i&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange;this.applyEdits(e)&&this.rangeIsValid(e.state)?(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state):(this.pendingContextChange=null,this.resetRange(e.state),this.editContext.updateText(0,this.editContext.text.length,e.state.doc.sliceString(this.from,this.to)),this.setSelection(e.state)),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),i=this.toContextPos(t.head);this.editContext.selectionStart==n&&this.editContext.selectionEnd==i||this.editContext.updateSelection(n,i)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to3e4)}toEditorPos(e){return e+this.from}toContextPos(e){return e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class li{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(e=>e.forEach((e=>n(e,this))))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||function(e){for(;e;){if(e&&(9==e.nodeType||11==e.nodeType&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}(e.parent)||document,this.viewState=new $n(e.state||i.$t.create(e)),e.scrollTo&&e.scrollTo.is(nt)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(at).map((e=>new ht(e)));for(let e of this.plugins)e.update(this);this.observer=new si(this),this.inputState=new Wt(this),this.inputState.ensureHandlers(this.plugins),this.docView=new kt(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),(null===(t=document.fonts)||void 0===t?void 0:t.ready)&&document.fonts.ready.then((()=>this.requestMeasure()))}dispatch(...e){let t=1==e.length&&e[0]instanceof i.ZX?e:1==e.length&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t,n=!1,s=!1,r=this.state;for(let t of e){if(t.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=t.state}if(this.destroyed)return void(this.viewState.state=r);let o=this.hasFocus,a=0,l=null;e.some((e=>e.annotation(gn)))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=bn(r,o),l||(a=1));let h=this.observer.delayedAndroidKey,c=null;if(h?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(c=null)):this.observer.clear(),r.facet(i.$t.phrases)!=this.state.facet(i.$t.phrases))return this.setState(r);t=wt.create(this,r,e),t.flags|=a;let u=this.viewState.scrollTarget;try{this.updateState=2;for(let t of e){if(u&&(u=u.map(t.changes)),t.scrollIntoView){let{main:e}=t.state.selection;u=new tt(e.empty?e:i.OF.cursor(e.head,e.head>e.anchor?-1:1))}for(let e of t.effects)e.is(nt)&&(u=e.value.clip(this.state))}this.viewState.update(t,u),this.bidiCache=ui.update(this.bidiCache,t.changes),t.empty||(this.updatePlugins(t),this.inputState.update(t)),n=this.docView.update(t),this.state.facet(vt)!=this.styleModules&&this.mountStyles(),s=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some((e=>e.isUserEvent("select.pointer"))))}finally{this.updateState=0}if(t.startState.facet(Kn)!=t.state.facet(Kn)&&(this.viewState.mustMeasureContent=!0),(n||s||u||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!t.empty)for(let e of this.state.facet(Ue))try{e(t)}catch(e){st(this.state,e,"update listener")}(l||c)&&Promise.resolve().then((()=>{l&&this.state==l.startState&&this.dispatch(l),c&&!qt(this,c)&&h.force&&_(this.contentDOM,h.key,h.keyCode)}))}setState(e){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=e);this.updateState=2;let t=this.hasFocus;try{for(let e of this.plugins)e.destroy(this);this.viewState=new $n(e),this.plugins=e.facet(at).map((e=>new ht(e))),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new kt(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(at),n=e.state.facet(at);if(t!=n){let i=[];for(let s of n){let n=t.indexOf(s);if(n<0)i.push(new ht(s));else{let t=this.plugins[n];t.mustUpdate=e,i.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.scrollDOM,i=n.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:r}=this.viewState;Math.abs(i-this.viewState.scrollTop)>1&&(r=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(r<0)if(N(n))s=-1,r=this.viewState.heightMap.height;else{let e=this.viewState.scrollAnchorAt(i);s=e.from,r=e.top}this.updateState=1;let o=this.viewState.measure(this);if(!o&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(e>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let a=[];4&o||([this.measureRequests,a]=[a,this.measureRequests]);let l=a.map((e=>{try{return e.read(this)}catch(e){return st(this.state,e),ci}})),h=wt.create(this,this.state,[]),c=!1;h.flags|=o,t?t.flags|=o:t=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),c=this.docView.update(h),c&&this.docViewUpdate());for(let e=0;e1||e<-1){i+=e,n.scrollTop=i/this.scaleY,r=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(Ue))e(t)}get themeClasses(){return Jn+" "+(this.state.facet(Yn)?Zn:Xn)+" "+this.state.facet(Kn)}updateAttrs(){let e=fi(this,ct,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(rt)?"true":"false",class:"cm-content",style:`${X.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),fi(this,ut,t);let n=this.observer.ignore((()=>{let n=le(this.contentDOM,this.contentAttrs,t),i=le(this.dom,this.editorAttrs,e);return n||i}));return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let e of n.effects)e.is(li.announce)&&(t&&(this.announceDOM.textContent=""),t=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=e.value)}mountStyles(){this.styleModules=this.state.facet(vt);let e=this.state.facet(li.cspNonce);s.G.mount(this.root,this.styleModules.concat(ti).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame((()=>this.measure()))),e){if(this.measureRequests.indexOf(e)>-1)return;if(null!=e.key)for(let t=0;tt.spec==e))||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return Lt(this,e,jt(this,e,t,n))}moveByGroup(e,t){return Lt(this,e,jt(this,e,t,(t=>function(e,t,n){let s=e.state.charCategorizer(t),r=s(n);return e=>{let t=s(e);return r==i.Je.Space&&(r=t),r==t}}(this,e.head,t))))}visualLineSide(e,t){let n=this.bidiSpans(e),s=this.textDirectionAt(e.from),r=n[t?n.length-1:0];return i.OF.cursor(r.side(t,s)+e.from,r.forward(!t,s)?1:-1)}moveToLineBoundary(e,t,n=!0){return function(e,t,n,s){let r=Rt(e,t.head),o=s&&r.type==ue.Text&&(e.lineWrapping||r.widgetLineBreaks)?e.coordsAtPos(t.assoc<0&&t.head>r.from?t.head-1:t.head):null;if(o){let t=e.dom.getBoundingClientRect(),s=e.textDirectionAt(r.from),a=e.posAtCoords({x:n==(s==Ce.LTR)?t.right-1:t.left+1,y:(o.top+o.bottom)/2});if(null!=a)return i.OF.cursor(a,n?-1:1)}return i.OF.cursor(n?r.to:r.from,n?-1:1)}(this,e,t,n)}moveVertically(e,t,n){return Lt(this,e,function(e,t,n,s){let r=t.head,o=n?1:-1;if(r==(n?e.state.doc.length:0))return i.OF.cursor(r,t.assoc);let a,l=t.goalColumn,h=e.contentDOM.getBoundingClientRect(),c=e.coordsAtPos(r,t.assoc||-1),u=e.documentTop;if(c)null==l&&(l=c.left-h.left),a=o<0?c.top:c.bottom;else{let t=e.viewState.lineBlockAt(r);null==l&&(l=Math.min(h.right-h.left,e.defaultCharacterWidth*(r-t.from))),a=(o<0?t.top:t.bottom)+u}let f=h.left+l,d=null!=s?s:e.viewState.heightOracle.textHeight>>1;for(let t=0;;t+=10){let n=a+(d+t)*o,s=Dt(e,{x:f,y:n},!1,o);if(nh.bottom||(o<0?sr)){let t=e.docView.coordsForChar(s),r=!t||n0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(Ze)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>hi)return Fe(e.length);let t,n=this.textDirectionAt(e.from);for(let i of this.bidiCache)if(i.from==e.from&&i.dir==n&&(i.fresh||je(i.isolates,t=gt(this,e))))return i.order;t||(t=gt(this,e));let i=function(e,t,n){if(!e)return[new Re(0,0,t==Oe?1:0)];if(t==Ae&&!n.length&&!Pe.test(e))return Fe(e.length);if(n.length)for(;e.length>Ie.length;)Ie[Ie.length]=256;let i=[],s=t==Ae?0:1;return Be(e,s,s,n,0,e.length,i),i}(e.text,n,t);return this.bidiCache.push(new ui(e.from,e.to,n,t,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||X.safari&&(null===(e=this.inputState)||void 0===e?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{O(this.contentDOM),this.docView.updateSelection()}))}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((9==e.nodeType?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return nt.of(new tt("number"==typeof e?i.OF.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return nt.of(new tt(i.OF.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){null==e?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:"boolean"==typeof e?this.inputState.tabFocusMode=e?0:-1:0!=this.inputState.tabFocusMode&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return lt.define((()=>({})),{eventHandlers:e})}static domEventObservers(e){return lt.define((()=>({})),{eventObservers:e})}static theme(e,t){let n=s.G.newName(),i=[Kn.of(n),vt.of(ei(`.${n}`,e))];return t&&t.dark&&i.push(Yn.of(!0)),i}static baseTheme(e){return i.Nb.lowest(vt.of(ei("."+Jn,e,Qn)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),i=n&&j.get(n)||j.get(e);return(null===(t=null==i?void 0:i.rootView)||void 0===t?void 0:t.view)||null}}li.styleModule=vt,li.inputHandler=Ke,li.clipboardInputFilter=Je,li.clipboardOutputFilter=Xe,li.scrollHandler=et,li.focusChangeEffect=Ye,li.perLineTextDirection=Ze,li.exceptionSink=Ge,li.updateListener=Ue,li.editable=rt,li.mouseSelectionStyle=We,li.dragMovesSelection=Ve,li.clickAddsSelectionRange=qe,li.decorations=ft,li.outerDecorations=dt,li.atomicRanges=pt,li.bidiIsolatedRanges=mt,li.scrollMargins=bt,li.darkTheme=Yn,li.cspNonce=i.sj.define({combine:e=>e.length?e[0]:""}),li.contentAttributes=ut,li.editorAttributes=ct,li.lineWrapping=li.contentAttributes.of({class:"cm-lineWrapping"}),li.announce=i.Pe.define();const hi=4096,ci={};class ui{constructor(e,t,n,i,s,r){this.from=e,this.to=t,this.dir=n,this.isolates=i,this.fresh=s,this.order=r}static update(e,t){if(t.empty&&!e.some((e=>e.fresh)))return e;let n=[],i=e.length?e[e.length-1].dir:Ce.LTR;for(let s=Math.max(0,e.length-10);s=0;s--){let t=i[s],r="function"==typeof t?t(e):t;r&&re(r,n)}return n}const di=X.mac?"mac":X.windows?"win":X.linux?"linux":"key";function pi(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),!1!==n&&t.shiftKey&&(e="Shift-"+e),e}const mi=i.Nb.default(li.domEventHandlers({keydown:(e,t)=>Si(yi(t.state),e,t,"editor")})),gi=i.sj.define({enables:mi}),bi=new WeakMap;function yi(e){let t=e.facet(gi),n=bi.get(t);return n||bi.set(t,n=function(e,t=di){let n=Object.create(null),i=Object.create(null),s=(e,t)=>{let n=i[e];if(null==n)i[e]=t;else if(n!=t)throw new Error("Key binding "+e+" is used both as a regular binding and as a multi-stroke prefix")},r=(e,i,r,o,a)=>{var l,h;let c=n[e]||(n[e]=Object.create(null)),u=i.split(/ (?!$)/).map((e=>function(e,t){const n=e.split(/-(?!$)/);let i,s,r,o,a=n[n.length-1];"Space"==a&&(a=" ");for(let e=0;e{let i=xi={view:t,prefix:n,scope:e};return setTimeout((()=>{xi==i&&(xi=null)}),wi),!0}]})}let f=u.join(" ");s(f,!1);let d=c[f]||(c[f]={preventDefault:!1,stopPropagation:!1,run:(null===(h=null===(l=c._any)||void 0===l?void 0:l.run)||void 0===h?void 0:h.slice())||[]});r&&d.run.push(r),o&&(d.preventDefault=!0),a&&(d.stopPropagation=!0)};for(let i of e){let e=i.scope?i.scope.split(" "):["editor"];if(i.any)for(let t of e){let e=n[t]||(n[t]=Object.create(null));e._any||(e._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:s}=i;for(let t in e)e[t].run.push((e=>s(e,ki)))}let s=i[t]||i.key;if(s)for(let t of e)r(t,s,i.run,i.preventDefault,i.stopPropagation),i.shift&&r(t,"Shift-"+s,i.shift,i.preventDefault,i.stopPropagation)}return n}(t.reduce(((e,t)=>e.concat(t)),[]))),n}function vi(e,t,n){return Si(yi(e.state),t,e,n)}let xi=null;const wi=4e3;let ki=null;function Si(e,t,n,s){ki=t;let h=function(e){var t=!(a&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||l&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?o:r)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(t),c=(0,i.vS)(h,0),u=(0,i.Fh)(c)==h.length&&" "!=h,f="",d=!1,p=!1,m=!1;xi&&xi.view==n&&xi.scope==s&&(f=xi.prefix+" ",Jt.indexOf(t.keyCode)<0&&(p=!0,xi=null));let g,b,y=new Set,v=e=>{if(e){for(let t of e.run)if(!y.has(t)&&(y.add(t),t(n)))return e.stopPropagation&&(m=!0),!0;e.preventDefault&&(e.stopPropagation&&(m=!0),p=!0)}return!1},x=e[s];return x&&(v(x[f+pi(h,t,!u)])?d=!0:u&&(t.altKey||t.metaKey||t.ctrlKey)&&!(X.windows&&t.ctrlKey&&t.altKey)&&(g=r[t.keyCode])&&g!=h?(v(x[f+pi(g,t,!0)])||t.shiftKey&&(b=o[t.keyCode])!=h&&b!=g&&v(x[f+pi(b,t,!1)]))&&(d=!0):u&&t.shiftKey&&v(x[f+pi(h,t,!0)])&&(d=!0),!d&&v(x._any)&&(d=!0)),p&&(d=!0),d&&m&&t.stopPropagation(),ki=null,d}class Ci{constructor(e,t,n,i,s){this.className=e,this.left=t,this.top=n,this.width=i,this.height=s}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className==this.className&&(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",null!=this.width&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,n){if(n.empty){let i=e.coordsAtPos(n.head,n.assoc||1);if(!i)return[];let s=Ai(e);return[new Ci(t,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}return function(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let i=Math.max(n.from,e.viewport.from),s=Math.min(n.to,e.viewport.to),r=e.textDirection==Ce.LTR,o=e.contentDOM,a=o.getBoundingClientRect(),l=Ai(e),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),u=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),f=a.right-(c?parseInt(c.paddingRight):0),d=Rt(e,i),p=Rt(e,s),m=d.type==ue.Text?d:null,g=p.type==ue.Text?p:null;if(m&&(e.lineWrapping||d.widgetLineBreaks)&&(m=Oi(e,i,1,m)),g&&(e.lineWrapping||p.widgetLineBreaks)&&(g=Oi(e,s,-1,g)),m&&g&&m.from==g.from&&m.to==g.to)return y(v(n.from,n.to,m));{let t=m?v(n.from,null,m):x(d,!1),i=g?v(null,n.to,g):x(p,!0),s=[];return(m||d).to<(g||p).from-(m&&g?1:0)||d.widgetLineBreaks>1&&t.bottom+e.defaultLineHeight/2h&&i.from=r)break;a>s&&l(Math.max(e,s),null==t&&e<=h,Math.min(a,r),null==n&&a>=c,o.dir)}if(s=i.to+1,s>=r)break}return 0==a.length&&l(h,null==t,c,null==n,e.textDirection),{top:s,bottom:o,horizontal:a}}function x(e,t){let n=a.top+(t?e.top:e.bottom);return{top:n,bottom:n,horizontal:[]}}}(e,t,n)}}function Ai(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==Ce.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function Oi(e,t,n,i){let s=e.coordsAtPos(t,2*n);if(!s)return i;let r=e.dom.getBoundingClientRect(),o=(s.top+s.bottom)/2,a=e.posAtCoords({x:r.left+1,y:o}),l=e.posAtCoords({x:r.right-1,y:o});return null==a||null==l?i:{from:Math.max(i.from,Math.min(a,l)),to:Math.min(i.to,Math.max(a,l))}}class Mi{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(_i)!=e.state.facet(_i)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){!1!==this.layer.updateOnDocViewUpdate&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,n=e.facet(_i);for(;t{return n=e,i=this.drawn[t],!(n.constructor==i.constructor&&n.eq(i));var n,i}))){let t=this.dom.firstChild,n=0;for(let i of e)i.update&&t&&i.constructor&&this.drawn[n].constructor&&i.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(i.draw(),t);for(;t;){let e=t.nextSibling;t.remove(),t=e}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const _i=i.sj.define();function Ti(e){return[lt.define((t=>new Mi(t,e))),_i.of(e)]}const Ni=!X.ios,Ei=i.sj.define({combine:e=>(0,i.QR)(e,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})});function Di(e={}){return[Ei.of(e),Ri,Ii,Bi,Qe.of(!0)]}function Pi(e){return e.startState.facet(Ei)!=e.state.facet(Ei)}const Ri=Ti({above:!0,markers(e){let{state:t}=e,n=t.facet(Ei),s=[];for(let r of t.selection.ranges){let o=r==t.selection.main;if(r.empty?!o||Ni:n.drawRangeCursor){let t=o?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",n=r.empty?r:i.OF.cursor(r.head,r.head>r.anchor?-1:1);for(let i of Ci.forRange(e,t,n))s.push(i)}}return s},update(e,t){e.transactions.some((e=>e.selection))&&(t.style.animationName="cm-blink"==t.style.animationName?"cm-blink2":"cm-blink");let n=Pi(e);return n&&ji(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){ji(t.state,e)},class:"cm-cursorLayer"});function ji(e,t){t.style.animationDuration=e.facet(Ei).cursorBlinkRate+"ms"}const Ii=Ti({above:!1,markers:e=>e.state.selection.ranges.map((t=>t.empty?[]:Ci.forRange(e,"cm-selectionBackground",t))).reduce(((e,t)=>e.concat(t))),update:(e,t)=>e.docChanged||e.selectionSet||e.viewportChanged||Pi(e),class:"cm-selectionLayer"}),Li={".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"}},".cm-content":{"& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}};Ni&&(Li[".cm-line"].caretColor=Li[".cm-content"].caretColor="transparent !important");const Bi=i.Nb.highest(li.theme(Li));function Fi(e,t,n,i,s){t.lastIndex=0;for(let r,o=e.iterRange(n,i),a=n;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;r=t.exec(o.value);)s(a+r.index,r)}class zi{constructor(e){const{regexp:t,decoration:n,decorate:i,boundary:s,maxLength:r=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,i)this.addMatch=(e,t,n,s)=>i(s,n,n+e[0].length,e,t);else if("function"==typeof n)this.addMatch=(e,t,i,s)=>{let r=n(e,t,i);r&&s(i,i+e[0].length,r)};else{if(!n)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(e,t,i,s)=>s(i,i+e[0].length,n)}this.boundary=s,this.maxLength=r}createDeco(e){let t=new i.vB,n=t.add.bind(t);for(let{from:t,to:i}of function(e,t){let n=e.visibleRanges;if(1==n.length&&n[0].from==e.viewport.from&&n[0].to==e.viewport.to)return n;let i=[];for(let{from:s,to:r}of n)s=Math.max(e.state.doc.lineAt(s).from,s-t),r=Math.min(e.state.doc.lineAt(r).to,r+t),i.length&&i[i.length-1].to>=s?i[i.length-1].to=r:i.push({from:s,to:r});return i}(e,this.maxLength))Fi(e.state.doc,this.regexp,t,i,((t,i)=>this.addMatch(i,e,t,n)));return t.finish()}updateDeco(e,t){let n=1e9,i=-1;return e.docChanged&&e.changes.iterChanges(((t,s,r,o)=>{o>e.view.viewport.from&&r1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,t.map(e.changes),n,i):t}updateRange(e,t,n,i){for(let s of e.visibleRanges){let r=Math.max(s.from,n),o=Math.min(s.to,i);if(o>r){let n=e.state.doc.lineAt(r),i=n.ton.from;r--)if(this.boundary.test(n.text[r-1-n.from])){a=r;break}for(;oc.push(n.range(e,t));if(n==i)for(this.regexp.lastIndex=a-n.from;(h=this.regexp.exec(n.text))&&h.indexthis.addMatch(n,e,t,u)));t=t.update({filterFrom:a,filterTo:l,filter:(e,t)=>el,add:c})}}return t}}const $i=null!=/x/.unicode?"gu":"g",Hi=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",$i),qi={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Vi=null;const Wi=i.sj.define({combine(e){let t=(0,i.QR)(e,{render:null,specialChars:Hi,addSpecialChars:null});return(t.replaceTabs=!function(){var e;if(null==Vi&&"undefined"!=typeof document&&document.body){let t=document.body.style;Vi=null!=(null!==(e=t.tabSize)&&void 0!==e?e:t.MozTabSize)}return Vi||!1}())&&(t.specialChars=new RegExp("\t|"+t.specialChars.source,$i)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,$i)),t}});function Gi(e={}){return[Wi.of(e),Ui||(Ui=lt.fromClass(class{constructor(e){this.view=e,this.decorations=fe.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(Wi)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new zi({regexp:e.specialChars,decoration:(t,n,s)=>{let{doc:r}=n.state,o=(0,i.vS)(t[0],0);if(9==o){let e=r.lineAt(s),t=n.state.tabSize,o=(0,i.y$)(e.text,t,s-e.from);return fe.replace({widget:new Yi((t-o%t)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[o]||(this.decorationCache[o]=fe.replace({widget:new Ki(e,o)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(Wi);e.startState.facet(Wi)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(e.view)):this.decorations=this.decorator.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}))]}let Ui=null;class Ki extends ce{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=function(e){return e>=32?"•":10==e?"␤":String.fromCharCode(9216+e)}(this.code),n=e.state.phrase("Control character")+" "+(qi[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,n,t);if(i)return i;let s=document.createElement("span");return s.textContent=t,s.title=n,s.setAttribute("aria-label",n),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class Yi extends ce{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent="\t",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}const Ji=lt.fromClass(class{constructor(){this.height=1e3,this.attrs={style:"padding-bottom: 1000px"}}update(e){let{view:t}=e,n=t.viewState.editorHeight-t.defaultLineHeight-t.documentPadding.top-.5;n>=0&&n!=this.height&&(this.height=n,this.attrs={style:`padding-bottom: ${n}px`})}});function Xi(){return[Ji,ut.of((e=>{var t;return(null===(t=e.plugin(Ji))||void 0===t?void 0:t.attrs)||null}))]}function Zi(){return es}const Qi=fe.line({class:"cm-activeLine"}),es=lt.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,n=[];for(let i of e.state.selection.ranges){let s=e.lineBlockAt(i.head);s.from>t&&(n.push(Qi.range(s.from)),t=s.from)}return fe.set(n)}},{decorations:e=>e.decorations}),ts=2e3;function ns(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1),s=e.state.doc.lineAt(n),r=n-s.from,o=r>ts?-1:r==s.length?function(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}(e,t.clientX):(0,i.y$)(s.text,e.state.tabSize,n-s.from);return{line:s.number,col:o,off:r}}function is(e){let t=(null==e?void 0:e.eventFilter)||(e=>e.altKey&&0==e.button);return li.mouseSelectionStyle.of(((e,n)=>t(n)?function(e,t){let n=ns(e,t),s=e.state.selection;return n?{update(e){if(e.docChanged){let t=e.changes.mapPos(e.startState.doc.line(n.line).from),i=e.state.doc.lineAt(t);n={line:i.number,col:n.col,off:Math.min(n.off,i.length)},s=s.map(e.changes)}},get(t,r,o){let a=ns(e,t);if(!a)return s;let l=function(e,t,n){let s=Math.min(t.line,n.line),r=Math.max(t.line,n.line),o=[];if(t.off>ts||n.off>ts||t.col<0||n.col<0){let a=Math.min(t.off,n.off),l=Math.max(t.off,n.off);for(let t=s;t<=r;t++){let n=e.doc.line(t);n.length<=l&&o.push(i.OF.range(n.from+a,n.to+l))}}else{let a=Math.min(t.col,n.col),l=Math.max(t.col,n.col);for(let t=s;t<=r;t++){let n=e.doc.line(t),s=(0,i.kn)(n.text,a,e.tabSize,!0);if(s<0)o.push(i.OF.cursor(n.to));else{let t=(0,i.kn)(n.text,l,e.tabSize);o.push(i.OF.range(n.from+s,n.from+t))}}}return o}(e.state,n,a);return l.length?o?i.OF.create(l.concat(s.ranges)):i.OF.create(l):s}}:null}(e,n):null))}const ss={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},rs={style:"cursor: crosshair"};function os(e={}){let[t,n]=ss[e.key||"Alt"],i=lt.fromClass(class{constructor(e){this.view=e,this.isDown=!1}set(e){this.isDown!=e&&(this.isDown=e,this.view.update([]))}},{eventObservers:{keydown(e){this.set(e.keyCode==t||n(e))},keyup(e){e.keyCode!=t&&n(e)||this.set(!1)},mousemove(e){this.set(n(e))}}});return[i,li.contentAttributes.of((e=>{var t;return(null===(t=e.plugin(i))||void 0===t?void 0:t.isDown)?rs:null}))]}const as="-10000px";class ls{constructor(e,t,n,i){this.facet=t,this.createTooltipView=n,this.removeTooltipView=i,this.input=e.state.facet(t),this.tooltips=this.input.filter((e=>e));let s=null;this.tooltipViews=this.tooltips.map((e=>s=n(e,s)))}update(e,t){var n;let i=e.state.facet(this.facet),s=i.filter((e=>e));if(i===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let r=[],o=t?[]:null;for(let n=0;nt[n]=e)),t.length=o.length),this.input=i,this.tooltips=s,this.tooltipViews=r,!0}}function hs(e={}){return us.of(e)}function cs(e){let{win:t}=e;return{top:0,left:0,bottom:t.innerHeight,right:t.innerWidth}}const us=i.sj.define({combine:e=>{var t,n,i;return{position:X.ios?"absolute":(null===(t=e.find((e=>e.position)))||void 0===t?void 0:t.position)||"fixed",parent:(null===(n=e.find((e=>e.parent)))||void 0===n?void 0:n.parent)||null,tooltipSpace:(null===(i=e.find((e=>e.tooltipSpace)))||void 0===i?void 0:i.tooltipSpace)||cs}}}),fs=new WeakMap,ds=lt.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(us);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver="function"==typeof ResizeObserver?new ResizeObserver((()=>this.measureSoon())):null,this.manager=new ls(e,gs,((e,t)=>this.createTooltip(e,t)),(e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()})),this.above=this.manager.tooltips.map((e=>!!e.above)),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,i=e.state.facet(us);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let e of this.manager.tooltipViews)e.dom.style.position=this.position;n=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let e of this.manager.tooltipViews)this.container.appendChild(e.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),i=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let e=document.createElement("div");e.className="cm-tooltip-arrow",n.dom.appendChild(e)}return n.dom.style.position=this.position,n.dom.style.top=as,n.dom.style.left="0px",this.container.insertBefore(n.dom,i),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),null===(e=t.destroy)||void 0===e||e.call(t);this.parent&&this.container.remove(),null===(t=this.resizeObserver)||void 0===t||t.disconnect(),null===(n=this.intersectionObserver)||void 0===n||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=this.view.dom.getBoundingClientRect(),t=1,n=1,i=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(X.gecko)i=e.offsetParent!=this.container.ownerDocument.body;else if(e.style.top==as&&"0px"==e.style.left){let t=e.getBoundingClientRect();i=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}}if(i||"absolute"==this.position)if(this.parent){let e=this.parent.getBoundingClientRect();e.width&&e.height&&(t=e.width/this.parent.offsetWidth,n=e.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:n}=this.view.viewState);return{editor:e,parent:this.parent?this.container.getBoundingClientRect():e,pos:this.manager.tooltips.map(((e,t)=>{let n=this.manager.tooltipViews[t];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)})),size:this.manager.tooltipViews.map((({dom:e})=>e.getBoundingClientRect())),space:this.view.state.facet(us).tooltipSpace(this.view),scaleX:t,scaleY:n,makeAbsolute:i}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let e of this.manager.tooltipViews)e.dom.style.position="absolute"}let{editor:n,space:i,scaleX:s,scaleY:r}=e,o=[];for(let a=0;a=Math.min(n.bottom,i.bottom)||u.rightMath.min(n.right,i.right)+.1){c.style.top=as;continue}let d=l.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,p=d?7:0,m=f.right-f.left,g=null!==(t=fs.get(h))&&void 0!==t?t:f.bottom-f.top,b=h.offset||ms,y=this.view.textDirection==Ce.LTR,v=f.width>i.right-i.left?y?i.left:i.right-f.width:y?Math.max(i.left,Math.min(u.left-(d?14:0)+b.x,i.right-m)):Math.min(Math.max(i.left,u.left-m+(d?14:0)-b.x),i.right-m),x=this.above[a];!l.strictSide&&(x?u.top-(f.bottom-f.top)-b.yi.bottom)&&x==i.bottom-u.bottom>u.top-i.top&&(x=this.above[a]=!x);let w=(x?u.top-i.top:i.bottom-u.bottom)-p;if(wv&&e.topk&&(k=x?e.top-g-2-p:e.bottom+p+2);if("absolute"==this.position?(c.style.top=(k-e.parent.top)/r+"px",c.style.left=(v-e.parent.left)/s+"px"):(c.style.top=k/r+"px",c.style.left=v/s+"px"),d){let e=u.left+(y?b.x:-b.x)-(v+14-7);d.style.left=e/s+"px"}!0!==h.overlap&&o.push({left:v,top:k,right:S,bottom:k+g}),c.classList.toggle("cm-tooltip-above",x),c.classList.toggle("cm-tooltip-below",!x),h.positioned&&h.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=as}},{eventObservers:{scroll(){this.maybeMeasure()}}}),ps=li.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),ms={x:0,y:0},gs=i.sj.define({enables:[ds,ps]});function bs(e,t){let n=e.plugin(ds);if(!n)return null;let i=n.manager.tooltips.indexOf(t);return i<0?null:n.manager.tooltipViews[i]}const ys=i.sj.define({combine(e){let t,n;for(let i of e)t=t||i.topContainer,n=n||i.bottomContainer;return{topContainer:t,bottomContainer:n}}});function vs(e,t){let n=e.plugin(xs),i=n?n.specs.indexOf(t):-1;return i>-1?n.panels[i]:null}const xs=lt.fromClass(class{constructor(e){this.input=e.state.facet(Ss),this.specs=this.input.filter((e=>e)),this.panels=this.specs.map((t=>t(e)));let t=e.state.facet(ys);this.top=new ws(e,!0,t.topContainer),this.bottom=new ws(e,!1,t.bottomContainer),this.top.sync(this.panels.filter((e=>e.top))),this.bottom.sync(this.panels.filter((e=>!e.top)));for(let e of this.panels)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}update(e){let t=e.state.facet(ys);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new ws(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new ws(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(Ss);if(n!=this.input){let t=n.filter((e=>e)),i=[],s=[],r=[],o=[];for(let n of t){let t,a=this.specs.indexOf(n);a<0?(t=n(e.view),o.push(t)):(t=this.panels[a],t.update&&t.update(e)),i.push(t),(t.top?s:r).push(t)}this.specs=t,this.panels=i,this.top.sync(s),this.bottom.sync(r);for(let e of o)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>li.scrollMargins.of((t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}}))});class ws{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=ks(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=ks(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function ks(e){let t=e.nextSibling;return e.remove(),t}const Ss=i.sj.define({enables:xs});class Cs extends i.FB{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Cs.prototype.elementClass="",Cs.prototype.toDOM=void 0,Cs.prototype.mapMode=i.iR.TrackBefore,Cs.prototype.startSide=Cs.prototype.endSide=-1,Cs.prototype.point=!0;const As=i.sj.define(),Os=i.sj.define(),Ms={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>i.om.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},_s=i.sj.define();function Ts(e){return[Es(),_s.of(Object.assign(Object.assign({},Ms),e))]}const Ns=i.sj.define({combine:e=>e.some((e=>e))});function Es(e){let t=[Ds];return e&&!1===e.fixed&&t.push(Ns.of(!0)),t}const Ds=lt.fromClass(class{constructor(e){this.view=e,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(_s).map((t=>new Is(e,t)));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!e.state.facet(Ns),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,i=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(i<.8*(n.to-n.from))}e.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px"),this.view.state.facet(Ns)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&this.dom.remove();let n=i.om.iter(this.view.state.facet(As),this.view.viewport.from),s=[],r=this.gutters.map((e=>new js(e,this.view.viewport,-this.view.documentPadding.top)));for(let e of this.view.viewportLineBlocks)if(s.length&&(s=[]),Array.isArray(e.type)){let t=!0;for(let i of e.type)if(i.type==ue.Text&&t){Rs(n,s,i.from);for(let e of r)e.line(this.view,i,s);t=!1}else if(i.widget)for(let e of r)e.widget(this.view,i)}else if(e.type==ue.Text){Rs(n,s,e.from);for(let t of r)t.line(this.view,e,s)}else if(e.widget)for(let t of r)t.widget(this.view,e);for(let e of r)e.finish();e&&this.view.scrollDOM.insertBefore(this.dom,t)}updateGutters(e){let t=e.startState.facet(_s),n=e.state.facet(_s),s=e.docChanged||e.heightChanged||e.viewportChanged||!i.om.eq(e.startState.facet(As),e.state.facet(As),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let t of this.gutters)t.update(e)&&(s=!0);else{s=!0;let i=[];for(let s of n){let n=t.indexOf(s);n<0?i.push(new Is(this.view,s)):(this.gutters[n].update(e),i.push(this.gutters[n]))}for(let e of this.gutters)e.dom.remove(),i.indexOf(e)<0&&e.destroy();for(let e of i)this.dom.appendChild(e.dom);this.gutters=i}return s}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove()}},{provide:e=>li.scrollMargins.of((t=>{let n=t.plugin(e);return n&&0!=n.gutters.length&&n.fixed?t.textDirection==Ce.LTR?{left:n.dom.offsetWidth*t.scaleX}:{right:n.dom.offsetWidth*t.scaleX}:null}))});function Ps(e){return Array.isArray(e)?e:[e]}function Rs(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class js{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=i.om.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:i}=this,s=(t.top-this.height)/e.scaleY,r=t.height/e.scaleY;if(this.i==i.elements.length){let t=new Ls(e,r,s,n);i.elements.push(t),i.dom.appendChild(t.dom)}else i.elements[this.i].update(e,r,s,n);this.height=t.bottom,this.i++}line(e,t,n){let i=[];Rs(this.cursor,i,t.from),n.length&&(i=i.concat(n));let s=this.gutter.config.lineMarker(e,t,i);s&&i.unshift(s);let r=this.gutter;(0!=i.length||r.config.renderEmptyElements)&&this.addElement(e,t,i)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),i=n?[n]:null;for(let n of e.state.facet(Os)){let s=n(e,t.widget,t);s&&(i||(i=[])).push(s)}i&&this.addElement(e,t,i)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class Is{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in t.domEventHandlers)this.dom.addEventListener(n,(i=>{let s,r=i.target;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let e=r.getBoundingClientRect();s=(e.top+e.bottom)/2}else s=i.clientY;let o=e.lineBlockAtHeight(s-e.documentTop);t.domEventHandlers[n](e,o,i)&&i.preventDefault()}));this.markers=Ps(t.markers(e)),t.initialSpacer&&(this.spacer=new Ls(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=Ps(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let t=this.config.updateSpacer(this.spacer.markers[0],e);t!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[t])}let n=e.view.viewport;return!i.om.eq(this.markers,t,n.from,n.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(e)}destroy(){for(let e of this.elements)e.destroy()}}class Ls{constructor(e,t,n,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,i)}update(e,t,n,i){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),function(e,t){if(e.length!=t.length)return!1;for(let n=0;n(0,i.QR)(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let e in t){let i=n[e],s=t[e];n[e]=i?(e,t,n)=>i(e,t,n)||s(e,t,n):s}return n}})});class $s extends Cs{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Hs(e,t){return e.state.facet(zs).formatNumber(t,e.state)}const qs=_s.compute([zs],(e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:e=>e.state.facet(Bs),lineMarker:(e,t,n)=>n.some((e=>e.toDOM))?null:new $s(Hs(e,e.state.doc.lineAt(t.from).number)),widgetMarker:(e,t,n)=>{for(let i of e.state.facet(Fs)){let s=i(e,t,n);if(s)return s}return null},lineMarkerChange:e=>e.startState.facet(zs)!=e.state.facet(zs),initialSpacer:e=>new $s(Hs(e,Ws(e.state.doc.lines))),updateSpacer(e,t){let n=Hs(t.view,Ws(t.view.state.doc.lines));return n==e.number?e:new $s(n)},domEventHandlers:e.facet(zs).domEventHandlers})));function Vs(e={}){return[zs.of(e),Es(),qs]}function Ws(e){let t=9;for(;t({decorations:e.createDeco(t),update(t){this.decorations=e.updateDeco(t,this.decorations)}})),{decorations:e=>e.decorations})}const Ks=Us(new zi({regexp:/\t| +/g,decoration:e=>function(e){let t=Gs.get(e);return t||Gs.set(e,t=fe.mark({attributes:"\t"===e?{class:"cm-highlightTab"}:{class:"cm-highlightSpace","data-display":e.replace(/ /g,"·")}})),t}(e[0]),boundary:/\S/}));function Ys(){return Ks}const Js=Us(new zi({regexp:/\s+$/g,decoration:fe.mark({class:"cm-trailingSpace"}),boundary:/\S/}));function Xs(){return Js}},9066:(e,t,n)=>{"use strict";n.d(t,{$g:()=>I,PH:()=>p,Qj:()=>d,RY:()=>D,Z6:()=>h,cF:()=>i,fI:()=>c,iX:()=>R,rr:()=>P,uY:()=>o});const i=1024;let s=0;class r{constructor(e,t){this.from=e,this.to=t}}class o{constructor(e={}){this.id=s++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=h.match(e)),t=>{let n=e(t);return void 0===n?null:[this,n]}}}o.closedBy=new o({deserialize:e=>e.split(" ")}),o.openedBy=new o({deserialize:e=>e.split(" ")}),o.group=new o({deserialize:e=>e.split(" ")}),o.isolate=new o({deserialize:e=>{if(e&&"rtl"!=e&&"ltr"!=e&&"auto"!=e)throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}}),o.contextHash=new o({perNode:!0}),o.lookAhead=new o({perNode:!0}),o.mounted=new o({perNode:!0});class a{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[o.mounted.id]}}const l=Object.create(null);class h{constructor(e,t,n,i=0){this.name=e,this.props=t,this.id=n,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):l,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),i=new h(e.name||"",t,e.id,n);if(e.props)for(let n of e.props)if(Array.isArray(n)||(n=n(i)),n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[n[0].id]=n[1]}return i}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if("string"==typeof e){if(this.name==e)return!0;let t=this.prop(o.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let i of n.split(" "))t[i]=e[n];return e=>{for(let n=e.prop(o.group),i=-1;i<(n?n.length:0);i++){let s=t[i<0?e.name:n[i]];if(s)return s}}}}h.none=new h("",Object.create(null),0,8);class c{constructor(e){this.types=e;for(let t=0;t=t){let o=new x(r.tree,r.overlay[0].from+e.from,-1,e);(s||(s=[i])).push(y(o,t,n,!1))}}return s?A(s):i}(this,e,t)}iterate(e){let{enter:t,leave:n,from:i=0,to:s=this.length}=e,r=e.mode||0,o=(r&d.IncludeAnonymous)>0;for(let e=this.cursor(r|d.IncludeAnonymous);;){let r=!1;if(e.from<=s&&e.to>=i&&(!o&&e.type.isAnonymous||!1!==t(e))){if(e.firstChild())continue;r=!0}for(;r&&n&&(o||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;r=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:E(h.none,this.children,this.positions,0,this.children.length,0,this.length,((e,t,n)=>new p(this.type,e,t,n,this.propValues)),e.makeTree||((e,t,n)=>new p(h.none,e,t,n)))}static build(e){return function(e){var t;let{buffer:n,nodeSet:s,maxBufferLength:r=i,reused:a=[],minRepeatType:l=s.types.length}=e,h=Array.isArray(n)?new m(n,n.length):n,c=s.types,u=0,f=0;function d(e,t,n,i,m,w){let{id:k,start:S,end:C,size:A}=h,O=f;for(;A<0;){if(h.next(),-1==A){let t=a[k];return n.push(t),void i.push(S-e)}if(-3==A)return void(u=k);if(-4==A)return void(f=k);throw new RangeError(`Unrecognized record size: ${A}`)}let M,_,T=c[k],N=S-e;if(C-S<=r&&(_=function(e,t){let n=h.fork(),i=0,s=0,o=0,a=n.end-r,c={size:0,start:0,skip:0};e:for(let r=n.pos-e;n.pos>r;){let e=n.size;if(n.id==t&&e>=0){c.size=i,c.start=s,c.skip=o,o+=4,i+=4,n.next();continue}let h=n.pos-e;if(e<0||h=l?4:0,f=n.start;for(n.next();n.pos>h;){if(n.size<0){if(-3!=n.size)break e;u+=4}else n.id>=l&&(u+=4);n.next()}s=f,i+=e,o+=u}return(t<0||i==e)&&(c.size=i,c.start=s,c.skip=o),c.size>4?c:void 0}(h.pos-t,m))){let t=new Uint16Array(_.size-_.skip),n=h.pos-_.size,i=t.length;for(;h.pos>n;)i=x(_.start,t,i);M=new g(t,C-_.start,s),N=_.start-e}else{let e=h.pos-A;h.next();let t=[],n=[],i=k>=l?k:-1,s=0,a=C;for(;h.pos>e;)i>=0&&h.id==i&&h.size>=0?(h.end<=a-r&&(y(t,n,S,s,h.end,a,i,O),s=t.length,a=h.end),h.next()):w>2500?b(S,e,t,n):d(S,e,t,n,i,w+1);if(i>=0&&s>0&&s-1&&s>0){let e=function(e){return(t,n,i)=>{let s,r,a=0,l=t.length-1;if(l>=0&&(s=t[l])instanceof p){if(!l&&s.type==e&&s.length==i)return s;(r=s.prop(o.lookAhead))&&(a=n[l]+s.length+r)}return v(e,t,n,i,a)}}(T);M=E(T,t,n,0,t.length,0,C-S,e,e)}else M=v(T,t,n,C-S,O-C)}n.push(M),i.push(N)}function b(e,t,n,i){let o=[],a=0,l=-1;for(;h.pos>t;){let{id:e,start:t,end:n,size:i}=h;if(i>4)h.next();else{if(l>-1&&t=0;e-=3)t[n++]=o[e],t[n++]=o[e+1]-r,t[n++]=o[e+2]-r,t[n++]=n;n.push(new g(t,o[2]-r,s)),i.push(r-e)}}function y(e,t,n,i,r,o,a,l){let h=[],c=[];for(;e.length>i;)h.push(e.pop()),c.push(t.pop()+n-r);e.push(v(s.types[a],h,c,o-r,l-o)),t.push(r-n)}function v(e,t,n,i,s=0,r){if(u){let e=[o.contextHash,u];r=r?[e].concat(r):[e]}if(s>25){let e=[o.lookAhead,s];r=r?[e].concat(r):[e]}return new p(e,t,n,i,r)}function x(e,t,n){let{id:i,start:s,end:r,size:o}=h;if(h.next(),o>=0&&i4){let i=h.pos-(o-4);for(;h.pos>i;)n=x(e,t,n)}t[--n]=a,t[--n]=r-e,t[--n]=s-e,t[--n]=i}else-3==o?u=i:-4==o&&(f=i);return n}let w=[],k=[];for(;h.pos>0;)d(e.start||0,e.bufferStart||0,w,k,-1,0);let S=null!==(t=e.length)&&void 0!==t?t:w.length?k[0]+w[0].length:0;return new p(c[e.topID],w.reverse(),k.reverse(),S)}(e)}}p.empty=new p(h.none,[],[],0);class m{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new m(this.buffer,this.index)}}class g{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return h.none}toString(){let e=[];for(let t=0;t0));a=r[a+3]);return o}slice(e,t,n){let i=this.buffer,s=new Uint16Array(t-e),r=0;for(let o=e,a=0;o=t&&nt;case 1:return n<=t&&i>t;case 2:return i>t;case 4:return!0}}function y(e,t,n,i){for(var s;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to0?o.length:-1;e!=h;e+=t){let h=o[e],c=l[e]+r.from;if(b(i,n,c,c+h.length))if(h instanceof g){if(s&d.ExcludeBuffers)continue;let o=h.findChild(0,h.buffer.length,t,n-c,i);if(o>-1)return new C(new S(r,h,e,c),null,o)}else if(s&d.IncludeAnonymous||!h.type.isAnonymous||_(h)){let o;if(!(s&d.IgnoreMounts)&&(o=a.get(h))&&!o.overlay)return new x(o.tree,c,e,r);let l=new x(h,c,e,r);return s&d.IncludeAnonymous||!l.type.isAnonymous?l:l.nextChild(t<0?h.children.length-1:0,t,n,i)}}if(s&d.IncludeAnonymous||!r.type.isAnonymous)return null;if(e=r.index>=0?r.index+t:t<0?-1:r._parent._tree.children.length,r=r._parent,!r)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,n=0){let i;if(!(n&d.IgnoreOverlays)&&(i=a.get(this._tree))&&i.overlay){let n=e-this.from;for(let{from:e,to:s}of i.overlay)if((t>0?e<=n:e=n:s>n))return new x(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function w(e,t,n,i){let s=e.cursor(),r=[];if(!s.firstChild())return r;if(null!=n)for(let e=!1;!e;)if(e=s.type.is(n),!s.nextSibling())return r;for(;;){if(null!=i&&s.type.is(i))return r;if(s.type.is(t)&&r.push(s.node),!s.nextSibling())return null==i?r:[]}}function k(e,t,n=t.length-1){for(let i=e.parent;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(t[n]&&t[n]!=i.name)return!1;n--}}return!0}class S{constructor(e,t,n,i){this.parent=e,this.buffer=t,this.index=n,this.start=i}}class C extends v{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,n);return s<0?null:new C(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,n=0){if(n&d.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new C(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new C(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new C(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,i=this.index+4,s=n.buffer[this.index+3];if(s>i){let r=n.buffer[this.index+1];e.push(n.slice(i,s,r)),t.push(0)}return new p(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function A(e){if(!e.length)return null;let t=0,n=e[0];for(let i=1;in.from||s.to0){if(this.index-1)for(let i=t+e,s=e<0?-1:n._tree.children.length;i!=s;i+=e){let e=n._tree.children[i];if(this.mode&d.IncludeAnonymous||e instanceof g||!e.type.isAnonymous||_(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let r=e;r;r=r._parent)if(r.index==i){if(i==this.index)return r;t=r,n=s+1;break e}i=this.stack[--s]}for(let e=n;e=0;s--){if(s<0)return k(this.node,e,i);let r=n[t.buffer[this.stack[s]]];if(!r.isAnonymous){if(e[i]&&e[i]!=r.name)return!1;i--}}return!0}}function _(e){return e.children.some((e=>e instanceof g||!e.type.isAnonymous||_(e)))}const T=new WeakMap;function N(e,t){if(!e.isAnonymous||t instanceof g||t.type!=e)return 1;let n=T.get(t);if(null==n){n=1;for(let i of t.children){if(i.type!=e||!(i instanceof p)){n=1;break}n+=N(e,i)}T.set(t,n)}return n}function E(e,t,n,i,s,r,o,a,l){let h=0;for(let n=i;n=c)break;p+=t}if(h==s+1){if(p>c){let e=n[s];t(e.children,e.positions,0,e.children.length,i[s]+a);continue}u.push(n[s])}else{let t=i[h-1]+n[h-1].length-d;u.push(E(e,n,i,s,h,d,t,null,l))}f.push(d+a-r)}}(t,n,i,s,0),(a||l)(u,f,o)}class D{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let i=this.map.get(e);i||this.map.set(e,i=new Map),i.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof C?this.setBuffer(e.context.buffer,e.index,t):e instanceof x&&this.map.set(e.tree,t)}get(e){return e instanceof C?this.getBuffer(e.context.buffer,e.index):e instanceof x?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class P{constructor(e,t,n,i,s=!1,r=!1){this.from=e,this.to=t,this.tree=n,this.offset=i,this.open=(s?1:0)|(r?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(e,t=[],n=!1){let i=[new P(0,e.length,e,0,!1,n)];for(let n of t)n.to>e.length&&i.push(n);return i}static applyChanges(e,t,n=128){if(!t.length)return e;let i=[],s=1,r=e.length?e[0]:null;for(let o=0,a=0,l=0;;o++){let h=o=n)for(;r&&r.from=t.from||c<=t.to||l){let e=Math.max(t.from,a)-l,n=Math.min(t.to,c)-l;t=e>=n?null:new P(e,n,t.tree,t.offset+l,o>0,!!h)}if(t&&i.push(t),r.to>c)break;r=snew r(e.from,e.to))):[new r(0,0)]:[new r(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let i=this.startParse(e,t,n);for(;;){let e=i.advance();if(e)return e}}}class j{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function I(e){return(t,n,i,s)=>new $(t,e,n,i,s)}class L{constructor(e,t,n,i,s){this.parser=e,this.parse=t,this.overlay=n,this.target=i,this.from=s}}function B(e){if(!e.length||e.some((e=>e.from>=e.to)))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(e))}class F{constructor(e,t,n,i,s,r,o){this.parser=e,this.predicate=t,this.mounts=n,this.index=i,this.start=s,this.target=r,this.prev=o,this.depth=0,this.ranges=[]}}const z=new o({perNode:!0});class ${constructor(e,t,n,i,s){this.nest=t,this.input=n,this.fragments=i,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let e=this.baseParse.advance();if(!e)return null;if(this.baseParse=null,this.baseTree=e,this.startInner(),null!=this.stoppedAt)for(let e of this.inner)e.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let e=this.baseTree;return null!=this.stoppedAt&&(e=new p(e.type,e.children,e.positions,e.length,e.propValues.concat([[z,this.stoppedAt]]))),e}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[o.mounted.id]=new a(t,e.overlay,e.parser),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t=this.stoppedAt)l=!1;else if(e.hasNode(i)){if(t){let e=t.mounts.find((e=>e.frag.from<=i.from&&e.frag.to>=i.to&&e.mount.overlay));if(e)for(let n of e.mount.overlay){let s=n.from+e.pos,r=n.to+e.pos;s>=i.from&&r<=i.to&&!t.ranges.some((e=>e.froms))&&t.ranges.push({from:s,to:r})}}l=!1}else if(n&&(o=H(n.ranges,i.from,i.to)))l=2!=o;else if(!i.type.isAnonymous&&(s=this.nest(i,this.input))&&(i.fromnew r(e.from-i.from,e.to-i.from))):null,i.tree,e.length?e[0].from:i.from)),s.overlay?e.length&&(n={ranges:e,depth:0,prev:n}):l=!1}}else t&&(a=t.predicate(i))&&(!0===a&&(a=new r(i.from,i.to)),a.fromnew r(e.from-t.start,e.to-t.start))),t.target,e[0].from))),t=t.prev}n&&! --n.depth&&(n=n.prev)}}}}function H(e,t,n){for(let i of e){if(i.from>=n)break;if(i.to>t)return i.from<=t&&i.to>=n?2:1}return 0}function q(e,t,n,i,s,r){if(t=e&&t.enter(n,1,d.IgnoreOverlays|d.ExcludeBuffers)||t.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(!(t.children.length&&0==t.positions[0]&&t.children[0]instanceof p))break;t=t.children[0]}return!1}}class G{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let n=this.curFrag=e[0];this.curTo=null!==(t=n.tree.prop(z))&&void 0!==t?t:n.to,this.inner=new W(n.tree,-n.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(e=t.tree.prop(z))&&void 0!==e?e:t.to,this.inner=new W(t.tree,-t.offset)}}findMounts(e,t){var n;let i=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let e=this.inner.cursor.node;e;e=e.parent){let s=null===(n=e.tree)||void 0===n?void 0:n.prop(o.mounted);if(s&&s.parser==t)for(let t=this.fragI;t=e.to)break;n.tree==this.curFrag.tree&&i.push({frag:n,pos:e.from-n.offset,mount:s})}}}return i}}function U(e,t){let n=null,i=t;for(let s=1,o=0;s=l)break;e.to<=a||(n||(i=n=t.slice()),e.froml&&n.splice(o+1,0,new r(l,e.to))):e.to>l?n[o--]=new r(l,e.to):n.splice(o--,1))}}return i}function K(e,t,n,i){let s=0,o=0,a=!1,l=!1,h=-1e9,c=[];for(;;){let u=s==e.length?1e9:a?e[s].to:e[s].from,f=o==t.length?1e9:l?t[o].to:t[o].from;if(a!=l){let e=Math.max(h,n),t=Math.min(u,f,i);enew r(e.from+i,e.to+i))),l,h);for(let t=0,i=l;;t++){let r=t==a.length,l=r?h:a[t].from;if(l>i&&n.push(new P(i,l,s.tree,-e,o.from>=i||o.openStart,o.to<=l||o.openEnd)),r)break;i=a[t].to}}else n.push(new P(l,h,s.tree,-e,o.from>=e||o.openStart,o.to<=a||o.openEnd))}return n}},9913:(e,t,n)=>{"use strict";n.d(t,{DM:()=>f,_A:()=>T,az:()=>u,pn:()=>l,vw:()=>r});var i=n(9066);let s=0;class r{constructor(e,t,n,i){this.name=e,this.set=t,this.base=n,this.modified=i,this.id=s++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n="string"==typeof e?e:"?";if(e instanceof r&&(t=e),null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let i=new r(n,[],null,[]);if(i.set.push(i),t)for(let e of t.set)i.set.push(e);return i}static defineModifier(e){let t=new a(e);return e=>e.modified.indexOf(t)>-1?e:a.get(e.base||e,e.modified.concat(t).sort(((e,t)=>e.id-t.id)))}}let o=0;class a{constructor(e){this.name=e,this.instances=[],this.id=o++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find((n=>{return n.base==e&&(i=t,s=n.modified,i.length==s.length&&i.every(((e,t)=>e==s[t])));var i,s}));if(n)return n;let i=[],s=new r(e.name,i,e,t);for(let e of t)e.instances.push(s);let o=function(e){let t=[[]];for(let n=0;nt.length-e.length))}(t);for(let t of e.set)if(!t.modified.length)for(let e of o)i.push(a.get(t,e));return s}}function l(e){let t=Object.create(null);for(let n in e){let i=e[n];Array.isArray(i)||(i=[i]);for(let e of n.split(" "))if(e){let n=[],s=2,r=e;for(let t=0;;){if("..."==r&&t>0&&t+3==e.length){s=1;break}let i=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(r);if(!i)throw new RangeError("Invalid path: "+e);if(n.push("*"==i[0]?"":'"'==i[0][0]?JSON.parse(i[0]):i[0]),t+=i[0].length,t==e.length)break;let o=e[t++];if(t==e.length&&"!"==o){s=0;break}if("/"!=o)throw new RangeError("Invalid path: "+e);r=e.slice(t)}let o=n.length-1,a=n[o];if(!a)throw new RangeError("Invalid path: "+e);let l=new c(i,s,o>0?n.slice(0,o):null);t[a]=l.sort(t[a])}}return h.add(t)}const h=new i.uY;class c{constructor(e,t,n,i){this.tags=e,this.mode=t,this.context=n,this.next=i}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(e){return!e||e.depth{let t=s;for(let i of e)for(let e of i.set){let i=n[e.id];if(i){t=t?t+" "+i:i;break}}return t},scope:i}}function f(e,t,n,i=0,s=e.length){let r=new d(i,Array.isArray(t)?t:[t],n);r.highlightRange(e.cursor(),i,s,"",r.highlighters),r.flush(s)}c.empty=new c([],2,null);class d{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,s,r){let{type:o,from:a,to:l}=e;if(a>=n||l<=t)return;o.isTop&&(r=this.highlighters.filter((e=>!e.scope||e.scope(o))));let u=s,f=function(e){let t=e.type.prop(h);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}(e)||c.empty,d=function(e,t){let n=null;for(let i of e){let e=i.style(t);e&&(n=n?n+" "+e:e)}return n}(r,f.tags);if(d&&(u&&(u+=" "),u+=d,1==f.mode&&(s+=(s?" ":"")+d)),this.startSpan(Math.max(t,a),u),f.opaque)return;let p=e.tree&&e.tree.prop(i.uY.mounted);if(p&&p.overlay){let i=e.node.enter(p.overlay[0].from+a,1),o=this.highlighters.filter((e=>!e.scope||e.scope(p.tree.type))),h=e.firstChild();for(let c=0,f=a;;c++){let d=c=m)&&e.nextSibling()););if(!d||m>n)break;f=d.to+a,f>t&&(this.highlightRange(i.cursor(),Math.max(t,d.from+a),Math.min(n,f),"",o),this.startSpan(Math.min(n,f),u))}h&&e.parent()}else if(e.firstChild()){p&&(s="");do{if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,s,r),this.startSpan(Math.min(n,e.to),u)}}while(e.nextSibling());e.parent()}}}const p=r.define,m=p(),g=p(),b=p(g),y=p(g),v=p(),x=p(v),w=p(v),k=p(),S=p(k),C=p(),A=p(),O=p(),M=p(O),_=p(),T={comment:m,lineComment:p(m),blockComment:p(m),docComment:p(m),name:g,variableName:p(g),typeName:b,tagName:p(b),propertyName:y,attributeName:p(y),className:p(g),labelName:p(g),namespace:p(g),macroName:p(g),literal:v,string:x,docString:p(x),character:p(x),attributeValue:p(x),number:w,integer:p(w),float:p(w),bool:p(v),regexp:p(v),escape:p(v),color:p(v),url:p(v),keyword:C,self:p(C),null:p(C),atom:p(C),unit:p(C),modifier:p(C),operatorKeyword:p(C),controlKeyword:p(C),definitionKeyword:p(C),moduleKeyword:p(C),operator:A,derefOperator:p(A),arithmeticOperator:p(A),logicOperator:p(A),bitwiseOperator:p(A),compareOperator:p(A),updateOperator:p(A),definitionOperator:p(A),typeOperator:p(A),controlOperator:p(A),punctuation:O,separator:p(O),bracket:M,angleBracket:p(M),squareBracket:p(M),paren:p(M),brace:p(M),content:k,heading:S,heading1:p(S),heading2:p(S),heading3:p(S),heading4:p(S),heading5:p(S),heading6:p(S),contentSeparator:p(k),list:p(k),quote:p(k),emphasis:p(k),strong:p(k),link:p(k),monospace:p(k),strikethrough:p(k),inserted:p(),deleted:p(),changed:p(),invalid:p(),meta:_,documentMeta:p(_),annotation:p(_),processingInstruction:p(_),definition:r.defineModifier("definition"),constant:r.defineModifier("constant"),function:r.defineModifier("function"),standard:r.defineModifier("standard"),local:r.defineModifier("local"),special:r.defineModifier("special")};for(let e in T){let t=T[e];t instanceof r&&(t.name=e)}u([{tag:T.link,class:"tok-link"},{tag:T.heading,class:"tok-heading"},{tag:T.emphasis,class:"tok-emphasis"},{tag:T.strong,class:"tok-strong"},{tag:T.keyword,class:"tok-keyword"},{tag:T.atom,class:"tok-atom"},{tag:T.bool,class:"tok-bool"},{tag:T.url,class:"tok-url"},{tag:T.labelName,class:"tok-labelName"},{tag:T.inserted,class:"tok-inserted"},{tag:T.deleted,class:"tok-deleted"},{tag:T.literal,class:"tok-literal"},{tag:T.string,class:"tok-string"},{tag:T.number,class:"tok-number"},{tag:[T.regexp,T.escape,T.special(T.string)],class:"tok-string2"},{tag:T.variableName,class:"tok-variableName"},{tag:T.local(T.variableName),class:"tok-variableName tok-local"},{tag:T.definition(T.variableName),class:"tok-variableName tok-definition"},{tag:T.special(T.variableName),class:"tok-variableName2"},{tag:T.definition(T.propertyName),class:"tok-propertyName tok-definition"},{tag:T.typeName,class:"tok-typeName"},{tag:T.namespace,class:"tok-namespace"},{tag:T.className,class:"tok-className"},{tag:T.macroName,class:"tok-macroName"},{tag:T.propertyName,class:"tok-propertyName"},{tag:T.operator,class:"tok-operator"},{tag:T.comment,class:"tok-comment"},{tag:T.meta,class:"tok-meta"},{tag:T.invalid,class:"tok-invalid"},{tag:T.punctuation,class:"tok-punctuation"}])},3643:(e,t,n)=>{"use strict";n.d(t,{Aj:()=>M,Lu:()=>p,U1:()=>_,uC:()=>d});var i=n(9066);class s{constructor(e,t,n,i,s,r,o,a,l,h=0,c){this.p=e,this.stack=t,this.state=n,this.reducePos=i,this.pos=s,this.score=r,this.buffer=o,this.bufferBase=a,this.curContext=l,this.lookAhead=h,this.parent=c}toString(){return`[${this.stack.filter(((e,t)=>t%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let i=e.parser.context;return new s(e,[],t,n,n,0,[],0,i?new r(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,i=65535&e,{parser:s}=this.p,r=this.reducePos=2e3&&!(null===(t=this.p.parser.nodeSet.types[i])||void 0===t?void 0:t.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(i,l)}storeNode(e,t,n,i=4,s=!1){if(0==e&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==e.buffer[i-4]&&e.buffer[i-1]>-1){if(t==n)return;if(e.buffer[i-2]>=t)return void(e.buffer[i-2]=n)}}if(s&&this.pos!=n){let s=this.buffer.length;if(s>0&&0!=this.buffer[s-4]){let e=!1;for(let t=s;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;s>0&&this.buffer[s-2]>n;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,i>4&&(i-=4)}this.buffer[s]=e,this.buffer[s+1]=t,this.buffer[s+2]=n,this.buffer[s+3]=i}else this.buffer.push(e,t,n,i)}shift(e,t,n,i){if(131072&e)this.pushState(65535&e,this.pos);else if(262144&e)this.pos=i,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,i,4);else{let s=e,{parser:r}=this.p;(i>this.pos||t<=r.maxNode)&&(this.pos=i,r.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,n),this.shiftContext(t,n),t<=r.maxNode&&this.buffer.push(t,n,i,4)}}apply(e,t,n,i){65536&e?this.reduce(e):this.shift(e,t,n,i)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(t,i),this.buffer.push(n,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),i=e.bufferBase+t;for(;e&&i==e.bufferBase;)e=e.parent;return new s(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new o(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(0==n)return!1;if(!(65536&n))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let i,s=0;s1&t&&e==i))||n.push(t[e],i)}t=n}let n=[];for(let e=0;e>19,i=65535&t,s=this.stack.length-3*n;if(s<0||e.getGoto(this.stack[s],i,!1)<0){let e=this.findForcedReduction();if(null==e)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(i,s)=>{if(!t.includes(i))return t.push(i),e.allActions(i,(t=>{if(393216&t);else if(65536&t){let n=(t>>19)-s;if(n>1){let i=65535&t,s=this.stack.length-3*n;if(s>=0&&e.getGoto(this.stack[s],i,!1)>=0)return n<<19|65536|i}}else{let e=n(t,s+1);if(null!=e)return e}}))};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:e}=this.p;return 65535==e.data[e.stateSlot(this.state,1)]&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;tthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class r{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class o{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=65535&e,n=e>>19;0==n?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(n-1);let i=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=i}}class a{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,0==this.index&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new a(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;null!=e&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new a(this.stack,this.pos,this.index)}}function l(e,t=Uint16Array){if("string"!=typeof e)return e;let n=null;for(let i=0,s=0;i=92&&t--,t>=34&&t--;let s=t-32;if(s>=46&&(s-=46,n=!0),r+=s,n)break;r*=46}n?n[s++]=r:n=new t(r)}return n}class h{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const c=new h;class u{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=c,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,i=this.rangeIndex,s=this.pos+e;for(;sn.to:s>=n.to;){if(i==this.ranges.length-1)return null;let e=this.ranges[++i];s+=e.from-n.to,n=e}return s}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t,n,i=this.chunkOff+e;if(i>=0&&i=this.chunk2Pos&&ti.to&&(this.chunk2=this.chunk2.slice(0,i.to-t)),n=this.chunk2.charCodeAt(0)}}return t>=this.token.lookAhead&&(this.token.lookAhead=t+1),n}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(null==n||n=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=c,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let i of this.ranges){if(i.from>=t)break;i.to>e&&(n+=this.input.read(Math.max(i.from,e),Math.min(i.to,t)))}return n}}class f{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;m(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}f.prototype.contextual=f.prototype.fallback=f.prototype.extend=!1;class d{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data="string"==typeof e?l(e):e}token(e,t){let n=e.pos,i=0;for(;;){let n=e.next<0,s=e.resolveOffset(1,1);if(m(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(null==this.elseToken)return;if(n||i++,null==s)break;e.reset(s,e.token)}i&&(e.reset(n,e.token),e.acceptToken(this.elseToken,i))}}d.prototype.contextual=f.prototype.fallback=f.prototype.extend=!1;class p{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function m(e,t,n,i,s,r){let o=0,a=1<0){let n=e[i];if(l.allows(n)&&(-1==t.token.value||t.token.value==n||b(n,t.token.value,s,r))){t.acceptToken(n);break}}let i=t.next,h=0,c=e[o+2];if(!(t.next<0&&c>h&&65535==e[n+3*c-3])){for(;h>1,r=n+s+(s<<1),a=e[r],l=e[r+1]||65536;if(i=l)){o=e[r+2],t.advance();continue e}h=s+1}}break}o=e[n+3*c-1]}}function g(e,t,n){for(let i,s=t;65535!=(i=e[s]);s++)if(i==n)return s-t;return-1}function b(e,t,n,i){let s=g(n,i,t);return s<0||g(n,i,e)t)&&!s.type.isError)return n<0?Math.max(0,Math.min(s.to-1,t-25)):Math.min(e.length,Math.max(s.from+1,t+25));if(n<0?s.prevSibling():s.nextSibling())break;if(!s.parent())return n<0?0:e.length}}class w{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?x(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?x(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(r instanceof i.PH){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(r),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+r.length}}}class k{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map((e=>new h))}getActions(e){let t=0,n=null,{parser:i}=e.p,{tokenizers:s}=i,r=i.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,a=0;for(let i=0;ih.end+25&&(a=Math.max(h.lookAhead,a)),0!=h.value)){let i=t;if(h.extended>-1&&(t=this.addActions(e,h.extended,h.end,t)),t=this.addActions(e,h.value,h.end,t),!l.extend&&(n=h,t>i))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),n||e.pos!=this.stream.end||(n=new h,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new h,{pos:n,p:i}=e;return t.start=n,t.end=Math.min(n+1,i.stream.end),t.value=n==i.stream.end?i.parser.eofTerm:0,t}updateCachedToken(e,t,n){let i=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(i,e),n),e.value>-1){let{parser:t}=n.p;for(let i=0;i=0&&n.p.parser.dialect.allows(s>>1)){1&s?e.extended=s>>1:e.value=s>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,t,n,i){for(let t=0;t4*e.bufferLength?new w(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e,t,n=this.stacks,i=this.minStackPos,s=this.stacks=[];if(this.bigReductionCount>300&&1==n.length){let[e]=n;for(;e.forceReduce()&&e.stack.length&&e.stack[e.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;ri)s.push(o);else{if(this.advanceStack(o,s,n))continue;{e||(e=[],t=[]),e.push(o);let n=this.tokens.getMainToken(o);t.push(n.value,n.end)}}break}}if(!s.length){let t=e&&function(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||null!=e&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.scorethis.stoppedAt?e[0]:this.runRecovery(e,t,s);if(n)return y&&console.log("Force-finish "+this.stackID(n)),this.stackToTree(n.forceAll())}if(this.recovering){let e=1==this.recovering?1:3*this.recovering;if(s.length>e)for(s.sort(((e,t)=>t.score-e.score));s.length>e;)s.pop();s.some((e=>e.reducePos>i))&&this.recovering--}else if(s.length>1){e:for(let e=0;e500&&i.buffer.length>500){if(!((t.score-i.score||t.buffer.length-i.buffer.length)>0)){s.splice(e--,1);continue e}s.splice(n--,1)}}}s.length>12&&s.splice(12,s.length-12)}this.minStackPos=s[0].pos;for(let e=1;e ":"";if(null!=this.stoppedAt&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,n=t?e.curContext.hash:0;for(let a=this.fragments.nodeAt(s);a;){let s=this.parser.nodeSet.types[a.type.id]==a.type?r.getGoto(e.state,a.type.id):-1;if(s>-1&&a.length&&(!t||(a.prop(i.uY.contextHash)||0)==n))return e.useNode(a,s),y&&console.log(o+this.stackID(e)+` (via reuse of ${r.getName(a.type.id)})`),!0;if(!(a instanceof i.PH)||0==a.children.length||a.positions[0]>0)break;let l=a.children[0];if(!(l instanceof i.PH&&0==a.positions[0]))break;a=l}}let a=r.stateSlot(e.state,4);if(a>0)return e.reduce(a),y&&console.log(o+this.stackID(e)+` (via always-reduce ${r.getName(65535&a)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let i=0;is?t.push(f):n.push(f)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return C(e,t),!0}}runRecovery(e,t,n){let i=null,s=!1;for(let r=0;r ":"";if(o.deadEnd){if(s)continue;if(s=!0,o.restart(),y&&console.log(h+this.stackID(o)+" (restarted)"),this.advanceFully(o,n))continue}let c=o.split(),u=h;for(let e=0;c.forceReduce()&&e<10&&(y&&console.log(u+this.stackID(c)+" (via force-reduce)"),!this.advanceFully(c,n));e++)y&&(u=this.stackID(c)+" -> ");for(let e of o.recoverByInsert(a))y&&console.log(h+this.stackID(e)+" (via recover-insert)"),this.advanceFully(e,n);this.stream.end>o.pos?(l==o.pos&&(l++,a=0),o.recoverByDelete(a,l),y&&console.log(h+this.stackID(o)+` (via recover-delete ${this.parser.getName(a)})`),C(o,n)):(!i||i.scoree;class M{constructor(e){this.start=e.start,this.shift=e.shift||O,this.reduce=e.reduce||O,this.reuse=e.reuse||O,this.hash=e.hash||(()=>0),this.strict=!1!==e.strict}}class _ extends i.iX{constructor(e){if(super(),this.wrappers=[],14!=e.version)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let n=0;ne.topRules[t][1])),s=[];for(let e=0;e=0)r(i,e,t[n++]);else{let s=t[n+-i];for(let o=-i;o>0;o--)r(t[n++],e,s);n++}}}this.nodeSet=new i.fI(t.map(((t,r)=>i.Z6.define({name:r>=this.minRepeatTerm?void 0:t,id:r,props:s[r],top:n.indexOf(r)>-1,error:0==r,skipped:e.skippedNodes&&e.skippedNodes.indexOf(r)>-1})))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=i.cF;let o=l(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e"number"==typeof e?new f(o,e):e)),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let i=new S(this,e,t,n);for(let s of this.wrappers)i=s(i,e,t,n);return i}getGoto(e,t,n=!1){let i=this.goto;if(t>=i[0])return-1;for(let s=i[t+1];;){let t=i[s++],r=1&t,o=i[s++];if(r&&n)return o;for(let n=s+(t>>1);s0}validAction(e,t){return!!this.allActions(e,(e=>e==t||null))}allActions(e,t){let n=this.stateSlot(e,4),i=n?t(n):void 0;for(let n=this.stateSlot(e,1);null==i;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=T(this.data,n+2)}i=t(T(this.data,n+1))}return i}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=T(this.data,n+2)}if(!(1&this.data[n+2])){let e=this.data[n+1];t.some(((t,n)=>1&n&&t==e))||t.push(this.data[n],e)}}return t}configure(e){let t=Object.assign(Object.create(_.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map((t=>{let n=e.tokenizers.find((e=>e.from==t));return n?n.to:t}))),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map(((n,i)=>{let s=e.specializers.find((e=>e.from==n.external));if(!s)return n;let r=Object.assign(Object.assign({},n),{external:s.to});return t.specializers[i]=N(r),r}))),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),null!=e.strict&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),null!=e.bufferLength&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return null==t?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map((()=>!1));if(e)for(let i of e.split(" ")){let e=t.indexOf(i);e>=0&&(n[e]=!0)}let i=null;for(let e=0;ee.external(n,i)<<1|t}return e.get}},8104:(e,t,n)=>{"use strict";n.d(t,{G:()=>o});const i="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),s="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class o{constructor(e,t){this.rules=[];let{finish:n}=t||{};function i(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}function s(e,t,r,o){let a=[],l=/^@(\w+)\b/.exec(e[0]),h=l&&"keyframes"==l[1];if(l&&null==t)return r.push(e[0]+";");for(let n in t){let o=t[n];if(/&/.test(n))s(n.split(/,\s*/).map((t=>e.map((e=>t.replace(/&/,e))))).reduce(((e,t)=>e.concat(t))),o,r);else if(o&&"object"==typeof o){if(!l)throw new RangeError("The value of a property ("+n+") should be a primitive value.");s(i(n),o,a,h)}else null!=o&&a.push(n.replace(/_.*/,"").replace(/[A-Z]/g,(e=>"-"+e.toLowerCase()))+": "+o+";")}(a.length||h)&&r.push((!n||l||o?e:e.map(n)).join(", ")+" {"+a.join(" ")+"}")}for(let t in e)s(i(t),e[t],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let e=r[i]||1;return r[i]=e+1,"ͼ"+e.toString(36)}static mount(e,t,n){let i=e[s],r=n&&n.nonce;i?r&&i.setNonce(r):i=new l(e,r),i.mount(Array.isArray(t)?t:[t],e)}}let a=new Map;class l{constructor(e,t){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let t=a.get(n);if(t)return e[s]=t;this.sheet=new i.CSSStyleSheet,a.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[s]=this}mount(e,t){let n=this.sheet,i=0,s=0;for(let t=0;t-1&&(this.modules.splice(o,1),s--,o=-1),-1==o){if(this.modules.splice(s++,0,r),n)for(let e=0;e{var __webpack_modules__={7998:(e,t,n)=>{"use strict";n.r(t),n.d(t,{BROKEN_FILE_SVG_ICON:()=>m,DOMWidgetModel:()=>j,DOMWidgetView:()=>N,ErrorWidgetView:()=>K,IJupyterWidgetRegistry:()=>V,JUPYTER_WIDGETS_VERSION:()=>D,JupyterLuminoPanelWidget:()=>R,JupyterLuminoWidget:()=>I,JupyterPhosphorPanelWidget:()=>L,JupyterPhosphorWidget:()=>P,LayoutModel:()=>z,LayoutView:()=>U,PROTOCOL_VERSION:()=>S,StyleModel:()=>H,StyleView:()=>W,ViewList:()=>$,WidgetModel:()=>M,WidgetView:()=>O,assign:()=>l,createErrorWidgetModel:()=>G,createErrorWidgetView:()=>Y,difference:()=>o,isEqual:()=>a,isObject:()=>f,isSerializable:()=>p,pack_models:()=>k,put_buffers:()=>h,reject:()=>c,remove_buffers:()=>g,resolvePromisesDict:()=>d,shims:()=>q,unpack_models:()=>B,uuid:()=>u});var i=n(5764),r=n(6343),s=n.n(r);function o(e,t){return e.filter((e=>-1===t.indexOf(e)))}function a(e,t){return s()(e,t)}const l=Object.assign||function(e,...t){for(let n=1;n{const n={};for(let i=0;i=0&&t.item(n)!==this;);return n>-1};class E extends b.View{_removeElement(){this.undelegateEvents(),this.el.parentNode&&this.el.parentNode.removeChild(this.el)}_setElement(e){this.el=e}_setAttributes(e){for(const t in e)t in this.el?this.el[t]=e[t]:this.el.setAttribute(t,e[t])}delegate(e,t,n){"string"!=typeof t&&(n=t,t=null),void 0===this._domEvents&&(this._domEvents=[]);const i=this.el,r=t?function(e){let r=e.target||e.srcElement;for(;r&&r!==i;r=r.parentNode)if(_.call(r,t))return e.delegateTarget=r,n.handleEvent?n.handleEvent(e):n(e)}:n;return this.el.addEventListener(e,r,!1),this._domEvents.push({eventName:e,handler:r,listener:n,selector:t}),r}undelegate(e,t,n){if("function"==typeof t&&(n=t,t=null),this.el&&this._domEvents){const i=this._domEvents.slice();let r=i.length;for(;r--;){const s=i[r];!(s.eventName!==e||n&&s.listener!==n||t&&s.selector!==t)&&(this.el.removeEventListener(s.eventName,s.handler,!1),this._domEvents.splice(r,1))}}return this}undelegateEvents(){if(this.el&&this._domEvents){const e=this._domEvents.length;for(let t=0;tthis.views[e].then((e=>e.remove()))));return delete this.views,Promise.all(e).then((()=>{}))}return Promise.resolve()}_handle_comm_closed(e){this.trigger("comm:close"),this.close(!0)}_handle_comm_msg(e){const t=e.content.data,n=t.method;switch(n){case"update":case"echo_update":return this.state_change=this.state_change.then((()=>{var i,r,s;const o=t.state,a=null!==(i=t.buffer_paths)&&void 0!==i?i:[],l=null!==(s=null===(r=e.buffers)||void 0===r?void 0:r.slice(0,a.length))&&void 0!==s?s:[];if(h(o,a,l),e.parent_header&&"echo_update"===n){const t=e.parent_header.msg_id;Object.keys(o).filter((e=>this._expectedEchoMsgIds.has(e))).forEach((e=>{this._expectedEchoMsgIds.get(e)!==t?delete o[e]:(this._expectedEchoMsgIds.delete(e),null!==this._msg_buffer&&Object.prototype.hasOwnProperty.call(this._msg_buffer,e)&&delete o[e])}))}return this.constructor._deserialize_state(o,this.widget_manager)})).then((e=>{this.set_state(e)})).catch(c(`Could not process update msg for model id: ${this.model_id}`,!0)),this.state_change;case"custom":return this.trigger("msg:custom",t.content,e.buffers),Promise.resolve()}return Promise.resolve()}set_state(e){this._state_lock=e;try{this.set(e)}catch(e){console.error(`Error setting state: ${e instanceof Error?e.message:e}`)}finally{this._state_lock=null}}get_state(e){const t=this.attributes;if(e){const e=this.defaults,n="function"==typeof e?e.call(this):e,i={};return Object.keys(t).forEach((e=>{a(t[e],n[e])||(i[e]=t[e])})),i}return Object.assign({},t)}_handle_status(e){if(void 0!==this.comm&&"idle"===e.content.execution_state&&(this._pending_msgs--,this._pending_msgs<0&&(console.error(`Jupyter Widgets message throttle: Pending messages < 0 (=${this._pending_msgs}), which is unexpected. Resetting to 0 to continue.`),this._pending_msgs=0),null!==this._msg_buffer&&this._pending_msgs<1)){const e=this.send_sync_message(this._msg_buffer,this._msg_buffer_callbacks);this.rememberLastUpdateFor(e),this._msg_buffer=null,this._msg_buffer_callbacks=null}}callbacks(e){return this.widget_manager.callbacks(e)}set(e,t,n){const i=v.call(this,e,t,n);if(void 0!==this._buffered_state_diff){const e=this.changedAttributes()||{};if(this._state_lock)for(const t of Object.keys(this._state_lock))e[t]===this._state_lock[t]&&delete e[t];if(this._buffered_state_diff_synced)for(const t of Object.keys(this._buffered_state_diff_synced))e[t]===this._buffered_state_diff_synced[t]&&delete e[t];this._buffered_state_diff=l(this._buffered_state_diff,e)}return!1===this._changing&&(this._buffered_state_diff_synced={}),i}sync(e,t,n={}){if(void 0===this.comm)throw"Syncing error: no comm channel defined";const i="patch"===e?n.attrs:t.get_state(n.drop_defaults);if(this._state_lock)for(const e of Object.keys(this._state_lock))i[e]===this._state_lock[e]&&delete i[e];Object.keys(i).forEach((e=>{this._attrsToUpdate.add(e)}));const r=this.serialize(i);if(Object.keys(r).length>0){const t=n.callbacks||this.callbacks();if(this._pending_msgs>=1){switch(e){case"patch":this._msg_buffer=l(this._msg_buffer||{},r);break;case"update":case"create":this._msg_buffer=r;break;default:throw"unrecognized syncing method"}this._msg_buffer_callbacks=t}else{const e=this.send_sync_message(i,t);this.rememberLastUpdateFor(e)}}}rememberLastUpdateFor(e){this._attrsToUpdate.forEach((t=>{this._expectedEchoMsgIds.set(t,e)})),this._attrsToUpdate=new Set}serialize(e){const t=this.constructor.serializers||i.JSONExt.emptyObject;for(const n of Object.keys(e))try{t[n]&&t[n].serialize?e[n]=t[n].serialize(e[n],this):e[n]=JSON.parse(JSON.stringify(e[n])),e[n]&&e[n].toJSON&&(e[n]=e[n].toJSON())}catch(e){throw console.error("Error serializing widget state attribute: ",n),e}return e}send_sync_message(e,t={}){if(!this.comm)return"";try{const n=(t={shell:Object.assign({},t.shell),iopub:Object.assign({},t.iopub),input:t.input}).iopub.status;t.iopub.status=e=>{this._handle_status(e),n&&n(e)};const i=g(e),r=this.comm.send({method:"update",state:i.state,buffer_paths:i.buffer_paths},t,{},i.buffers);return this._pending_msgs++,r}catch(e){console.error("Could not send widget sync message",e)}return""}save_changes(e){if(this.comm_live){const t={patch:!0};e&&(t.callbacks=e),this.save(this._buffered_state_diff,t),this._changing&&l(this._buffered_state_diff_synced,this._buffered_state_diff),this._buffered_state_diff={}}}on_some_change(e,t,n){this.on("change",((...i)=>{e.some(this.hasChanged,this)&&t.apply(n,i)}),this)}toJSON(e){return`IPY_MODEL_${this.model_id}`}static _deserialize_state(e,t){const n=this.serializers;let i;if(n){i={};for(const r in e)n[r]&&n[r].deserialize?i[r]=n[r].deserialize(e[r],t):i[r]=e[r]}else i=e;return d(i)}}class j extends M{defaults(){return l(super.defaults(),{_dom_classes:[],tabbable:null,tooltip:null})}}j.serializers=Object.assign(Object.assign({},M.serializers),{layout:{deserialize:B},style:{deserialize:B}});class O extends E{constructor(e){super(e)}initialize(e){this.listenTo(this.model,"change",((e,t)=>{const n=Object.keys(this.model.changedAttributes()||{});"_view_count"===n[0]&&1===n.length||this.update(t)})),this.options=e.options,this.once("remove",(()=>{"number"==typeof this.model.get("_view_count")&&(this.model.set("_view_count",this.model.get("_view_count")-1),this.model.save_changes())})),this.once("displayed",(()=>{"number"==typeof this.model.get("_view_count")&&(this.model.set("_view_count",this.model.get("_view_count")+1),this.model.save_changes())})),this.displayed=new Promise(((e,t)=>{this.once("displayed",e),this.model.on("msg:custom",this.handle_message.bind(this))}))}handle_message(e){"focus"===e.do?this.el.focus():"blur"===e.do&&this.el.blur()}update(e){}render(){}create_child_view(e,t={}){return t=Object.assign({parent:this},t),this.model.widget_manager.create_view(e,t).catch(c("Could not create child view",!0))}callbacks(){return this.model.callbacks(this)}send(e,t){this.model.send(e,this.callbacks(),t)}touch(){this.model.save_changes(this.callbacks())}remove(){return super.remove(),this.trigger("remove"),this}}class I extends x.x0{constructor(e){const t=e.view;delete e.view,super(e),this._view=t}dispose(){this.isDisposed||(super.dispose(),this._view.remove(),this._view=null)}processMessage(e){super.processMessage(e),this._view.processLuminoMessage(e)}}const P=I;class R extends x.Zk{constructor(e){const t=e.view;delete e.view,super(e),this._view=t}processMessage(e){super.processMessage(e),this._view.processLuminoMessage(e)}dispose(){var e;this.isDisposed||(super.dispose(),null===(e=this._view)||void 0===e||e.remove(),this._view=null)}}const L=R;class N extends O{initialize(e){super.initialize(e),this.listenTo(this.model,"change:_dom_classes",((e,t)=>{const n=e.previous("_dom_classes");this.update_classes(n,t)})),this.layoutPromise=Promise.resolve(),this.listenTo(this.model,"change:layout",((e,t)=>{this.setLayout(t,e.previous("layout"))})),this.stylePromise=Promise.resolve(),this.listenTo(this.model,"change:style",((e,t)=>{this.setStyle(t,e.previous("style"))})),this.displayed.then((()=>{this.update_classes([],this.model.get("_dom_classes")),this.setLayout(this.model.get("layout")),this.setStyle(this.model.get("style"))})),this._comm_live_update(),this.listenTo(this.model,"comm_live_update",(()=>{this._comm_live_update()})),this.listenTo(this.model,"change:tooltip",this.updateTooltip),this.updateTooltip()}setLayout(e,t){e&&(this.layoutPromise=this.layoutPromise.then((t=>(t&&(t.unlayout(),this.stopListening(t.model),t.remove()),this.create_child_view(e).then((e=>this.displayed.then((()=>(e.trigger("displayed"),this.listenTo(e.model,"change",(()=>{C.Mu.postMessage(this.luminoWidget,x.x0.ResizeMessage.UnknownSize)})),C.Mu.postMessage(this.luminoWidget,x.x0.ResizeMessage.UnknownSize),this.trigger("layout-changed"),e))))).catch(c("Could not add LayoutView to DOMWidgetView",!0))))))}setStyle(e,t){e&&(this.stylePromise=this.stylePromise.then((t=>(t&&(t.unstyle(),this.stopListening(t.model),t.remove()),this.create_child_view(e).then((e=>this.displayed.then((()=>(e.trigger("displayed"),this.trigger("style-changed"),e))))).catch(c("Could not add styleView to DOMWidgetView",!0))))))}updateTooltip(){const e=this.model.get("tooltip");e?0===this.model.get("description").length&&this.el.setAttribute("title",e):this.el.removeAttribute("title")}update_classes(e,t,n){void 0===n&&(n=this.el),o(e,t).map((function(e){n.classList?n.classList.remove(e):n.setAttribute("class",n.getAttribute("class").replace(e,""))})),o(t,e).map((function(e){n.classList?n.classList.add(e):n.setAttribute("class",n.getAttribute("class").concat(" ",e))}))}update_mapped_classes(e,t,n){let i=this.model.previous(t);const r=e[i]?e[i]:[];i=this.model.get(t);const s=e[i]?e[i]:[];this.update_classes(r,s,n||this.el)}set_mapped_classes(e,t,n){const i=this.model.get(t),r=e[i]?e[i]:[];this.update_classes([],r,n||this.el)}_setElement(e){this.luminoWidget&&this.luminoWidget.dispose(),this.$el=e instanceof y()?e:y()(e),this.el=this.$el[0],this.luminoWidget=new I({node:e,view:this})}remove(){return this.luminoWidget&&this.luminoWidget.dispose(),super.remove()}processLuminoMessage(e){switch(e.type){case"after-attach":this.trigger("displayed");break;case"show":this.trigger("shown")}}_comm_live_update(){this.model.comm_live?this.luminoWidget.removeClass("jupyter-widgets-disconnected"):this.luminoWidget.addClass("jupyter-widgets-disconnected")}updateTabindex(){const e=this.model.get("tabbable");!0===e?this.el.setAttribute("tabIndex","0"):!1===e?this.el.setAttribute("tabIndex","-1"):null===e&&this.el.removeAttribute("tabIndex")}get pWidget(){return this.luminoWidget}set pWidget(e){this.luminoWidget=e}}const F={align_content:null,align_items:null,align_self:null,border_top:null,border_right:null,border_bottom:null,border_left:null,bottom:null,display:null,flex:null,flex_flow:null,height:null,justify_content:null,justify_items:null,left:null,margin:null,max_height:null,max_width:null,min_height:null,min_width:null,overflow:null,order:null,padding:null,right:null,top:null,visibility:null,width:null,object_fit:null,object_position:null,grid_auto_columns:null,grid_auto_flow:null,grid_auto_rows:null,grid_gap:null,grid_template_rows:null,grid_template_columns:null,grid_template_areas:null,grid_row:null,grid_column:null,grid_area:null};class z extends M{defaults(){return l(super.defaults(),{_model_name:"LayoutModel",_view_name:"LayoutView"},F)}}class U extends O{initialize(e){this._traitNames=[],super.initialize(e);for(const e of Object.keys(F))this.registerTrait(e)}registerTrait(e){this._traitNames.push(e),this.listenTo(this.model,"change:"+e,((t,n)=>{this.handleChange(e,n)})),this.handleChange(e,this.model.get(e))}css_name(e){return e.replace(/_/g,"-")}handleChange(e,t){const n=this.options.parent;n?null===t?n.el.style.removeProperty(this.css_name(e)):n.el.style.setProperty(this.css_name(e),t):console.warn("Style not applied because a parent view does not exist")}unlayout(){const e=this.options.parent;this._traitNames.forEach((t=>{e?e.el.style.removeProperty(this.css_name(t)):console.warn("Style not removed because a parent view does not exist")}),this)}}class H extends M{defaults(){const e=this.constructor;return l(super.defaults(),{_model_name:"StyleModel",_view_name:"StyleView"},Object.keys(e.styleProperties).reduce(((t,n)=>(t[n]=e.styleProperties[n].default,t)),{}))}}H.styleProperties={};class W extends O{initialize(e){this._traitNames=[],super.initialize(e);const t=this.model.constructor;for(const e of Object.keys(t.styleProperties))this.registerTrait(e);this.style()}registerTrait(e){this._traitNames.push(e),this.listenTo(this.model,"change:"+e,((t,n)=>{this.handleChange(e,n)}))}handleChange(e,t){const n=this.options.parent;if(n){const i=this.model.constructor.styleProperties,r=i[e].attribute,s=i[e].selector,o=s?n.el.querySelectorAll(s):[n.el];if(null===t)for(let e=0;e!==o.length;++e)o[e].style.removeProperty(r);else for(let e=0;e!==o.length;++e)o[e].style.setProperty(r,t)}else console.warn("Style not applied because a parent view does not exist")}style(){for(const e of this._traitNames)this.handleChange(e,this.model.get(e))}unstyle(){const e=this.options.parent,t=this.model.constructor.styleProperties;this._traitNames.forEach((n=>{if(e){const i=t[n].attribute,r=t[n].selector,s=r?e.el.querySelectorAll(r):[e.el];for(let e=0;e!==s.length;++e)s[e].style.removeProperty(i)}else console.warn("Style not removed because a parent view does not exist")}),this)}}var q;!function(e){let t;!function(e){e.CommManager=class{constructor(e){this.targets=Object.create(null),this.comms=Object.create(null),this.init_kernel(e)}init_kernel(e){this.kernel=e,this.jsServicesKernel=e}async new_comm(e,n,i,r,s,o){const a=this.jsServicesKernel.createComm(e,s),l=new t(a);return this.register_comm(l),l.open(n,i,r,o),l}register_target(e,n){const i=this.jsServicesKernel.registerCommTarget(e,((e,i)=>{const r=new t(e);this.register_comm(r);try{return n(r,i)}catch(e){r.close(),console.error(e),console.error(new Error("Exception opening new comm"))}}));this.targets[e]=i}unregister_target(e,t){this.targets[e].dispose(),delete this.targets[e]}register_comm(e){return this.comms[e.comm_id]=Promise.resolve(e),e.kernel=this.kernel,e.comm_id}};class t{constructor(e){this.jsServicesComm=e}get comm_id(){return this.jsServicesComm.commId}get target_name(){return this.jsServicesComm.targetName}open(e,t,n,i){const r=this.jsServicesComm.open(e,n,i);return this._hookupCallbacks(r,t),r.msg.header.msg_id}send(e,t,n,i){const r=this.jsServicesComm.send(e,n,i);return this._hookupCallbacks(r,t),r.msg.header.msg_id}close(e,t,n,i){const r=this.jsServicesComm.close(e,n,i);return this._hookupCallbacks(r,t),r.msg.header.msg_id}on_msg(e){this.jsServicesComm.onMsg=e.bind(this)}on_close(e){this.jsServicesComm.onClose=e.bind(this)}_hookupCallbacks(e,t){t&&(e.onReply=function(e){t.shell&&t.shell.reply&&t.shell.reply(e)},e.onStdin=function(e){t.input&&t.input(e)},e.onIOPub=function(e){if(t.iopub)if(t.iopub.status&&"status"===e.header.msg_type)t.iopub.status(e);else if(t.iopub.clear_output&&"clear_output"===e.header.msg_type)t.iopub.clear_output(e);else if(t.iopub.output)switch(e.header.msg_type){case"display_data":case"execute_result":case"stream":case"error":t.iopub.output(e)}})}}e.Comm=t}(t=e.services||(e.services={}))}(q||(q={}));class ${constructor(e,t,n){this.initialize(e,t,n)}initialize(e,t,n){this._handler_context=n||this,this._models=[],this.views=[],this._create_view=e,this._remove_view=t||function(e){e.remove()}}update(e,t,n,i){const r=n||this._remove_view,s=t||this._create_view;i=i||this._handler_context;let o=0;for(;o=this._models.length||e[o]!==this._models[o]);o++);const a=o,l=this.views.splice(a,this.views.length-a);for(let e=0;e{e.forEach((e=>this._remove_view.call(this._handler_context,e))),this.views=[],this._models=[]}))}dispose(){this.views=null,this._models=null}}const V=new i.Token("jupyter.extensions.jupyterWidgetRegistry");function G(e,t){return class extends j{constructor(n,i){super(n=Object.assign(Object.assign({},n),{_view_name:"ErrorWidgetView",_view_module:"@jupyter-widgets/base",_model_module_version:D,_view_module_version:D,msg:t,error:e}),i),this.comm_live=!0}}}class K extends N{generateErrorMessage(){return{msg:this.model.get("msg"),stack:String(this.model.get("error").stack)}}render(){const{msg:e,stack:t}=this.generateErrorMessage();this.el.classList.add("jupyter-widgets");const n=document.createElement("div");n.classList.add("jupyter-widgets-error-widget","icon-error"),n.innerHTML=m;const i=document.createElement("pre");let r,s;i.style.textAlign="center",i.innerText="Click to show javascript error.",n.append(i),this.el.appendChild(n),this.el.onclick=()=>{n.classList.contains("icon-error")&&(s=s||n.clientHeight,r=r||n.clientWidth,n.classList.remove("icon-error"),n.innerHTML=`\n
[Open Browser Console for more detailed log - Double click to close this message]\n${e}\n${t}
\n `,n.style.height=`${s}px`,n.style.width=`${r}px`,n.classList.add("text-error"))},this.el.ondblclick=()=>{n.classList.contains("text-error")&&(n.classList.remove("text-error"),n.innerHTML=m,n.append(i),n.classList.add("icon-error"))}}}function Y(e,t){return class extends K{generateErrorMessage(){return{msg:t,stack:String(e instanceof Error?e.stack:e)}}}}},5803:(e,t,n)=>{"use strict";n.r(t),n.d(t,{AccordionModel:()=>qt,AccordionView:()=>Vt,AudioModel:()=>G,AudioView:()=>K,BaseIntSliderView:()=>Le,BoolModel:()=>y,BoundedFloatModel:()=>Ye,BoundedFloatTextModel:()=>it,BoundedIntModel:()=>Oe,BoundedIntTextModel:()=>Ue,BoxModel:()=>P,BoxView:()=>N,ButtonModel:()=>T,ButtonStyleModel:()=>S,ButtonView:()=>B,CheckboxModel:()=>w,CheckboxStyleModel:()=>b,CheckboxView:()=>_,ColorPickerModel:()=>J,ColorPickerView:()=>X,ColorsInputModel:()=>Nn,ColorsInputView:()=>Fn,ComboboxModel:()=>ci,ComboboxView:()=>hi,ControllerAxisModel:()=>lt,ControllerAxisView:()=>ut,ControllerButtonModel:()=>ot,ControllerButtonView:()=>at,ControllerModel:()=>dt,ControllerView:()=>ct,DatePickerModel:()=>ee,DatePickerView:()=>te,DatetimeModel:()=>ce,DatetimeView:()=>he,DescriptionModel:()=>u,DescriptionStyleModel:()=>l,DescriptionView:()=>d,DirectionalLinkModel:()=>m,DropdownModel:()=>ft,DropdownView:()=>gt,FileUploadModel:()=>pi,FileUploadView:()=>fi,FloatLogSliderModel:()=>Xe,FloatLogSliderView:()=>et,FloatModel:()=>Ke,FloatProgressModel:()=>st,FloatRangeSliderModel:()=>Ze,FloatRangeSliderView:()=>tt,FloatSliderModel:()=>Je,FloatSliderView:()=>Qe,FloatTextModel:()=>nt,FloatTextView:()=>rt,FloatsInputModel:()=>Hn,FloatsInputView:()=>Wn,GridBoxModel:()=>H,GridBoxView:()=>U,HBoxModel:()=>R,HBoxView:()=>F,HTMLMathModel:()=>ti,HTMLMathStyleModel:()=>Kn,HTMLMathView:()=>ni,HTMLModel:()=>Qn,HTMLStyleModel:()=>Gn,HTMLView:()=>ei,ImageModel:()=>W,ImageView:()=>q,IntModel:()=>je,IntProgressModel:()=>qe,IntRangeSliderModel:()=>Re,IntRangeSliderView:()=>Ne,IntSliderModel:()=>Pe,IntSliderView:()=>Fe,IntTextModel:()=>ze,IntTextView:()=>He,IntsInputModel:()=>qn,IntsInputView:()=>$n,JUPYTER_CONTROLS_VERSION:()=>a.A,JupyterLuminoAccordionWidget:()=>$t,JupyterLuminoTabPanelWidget:()=>Kt,LabelModel:()=>ii,LabelStyleModel:()=>Yn,LabelView:()=>ri,LabeledDOMWidgetModel:()=>c,LabeledDOMWidgetView:()=>h,LinkModel:()=>v,MultipleSelectionModel:()=>xt,NaiveDatetimeModel:()=>ve,PasswordModel:()=>ui,PasswordView:()=>di,PlayModel:()=>Ve,PlayView:()=>Ge,ProgressStyleModel:()=>We,ProgressView:()=>$e,RadioButtonsModel:()=>bt,RadioButtonsView:()=>At,SelectModel:()=>mt,SelectMultipleModel:()=>Dt,SelectMultipleView:()=>St,SelectView:()=>vt,SelectionContainerModel:()=>Wt,SelectionModel:()=>ht,SelectionRangeSliderModel:()=>Tt,SelectionRangeSliderView:()=>Bt,SelectionSliderModel:()=>Et,SelectionSliderView:()=>Ct,SelectionView:()=>pt,SliderStyleModel:()=>Ie,StackModel:()=>Jt,StackView:()=>Xt,StringModel:()=>Xn,StringView:()=>Zn,TabModel:()=>Gt,TabView:()=>Yt,TagsInputModel:()=>Rn,TagsInputView:()=>Ln,TextModel:()=>ai,TextStyleModel:()=>Jn,TextView:()=>li,TextareaModel:()=>si,TextareaView:()=>oi,TimeModel:()=>oe,TimeView:()=>ae,ToggleButtonModel:()=>E,ToggleButtonStyleModel:()=>A,ToggleButtonView:()=>C,ToggleButtonsModel:()=>wt,ToggleButtonsStyleModel:()=>yt,ToggleButtonsView:()=>_t,VBoxModel:()=>L,VBoxView:()=>z,ValidModel:()=>x,ValidView:()=>D,VideoModel:()=>$,VideoView:()=>V,datetime_serializers:()=>de,deserialize_date:()=>Q,deserialize_datetime:()=>ue,deserialize_naive:()=>ge,deserialize_time:()=>re,escape_html:()=>s,naive_serializers:()=>me,reject:()=>o,resolvePromisesDict:()=>i.resolvePromisesDict,serialize_date:()=>Z,serialize_datetime:()=>le,serialize_naive:()=>fe,serialize_time:()=>ie,time_serializers:()=>se,typeset:()=>r,uuid:()=>i.uuid,version:()=>gi});var i=n(7998);function r(e,t){void 0!==t&&(e.textContent=t),void 0!==window.MathJax&&MathJax.Hub.Queue(["Typeset",MathJax.Hub,e])}function s(e){const t=document.createElement("div");return t.textContent=e,t.innerHTML}function o(e,t){return function(n){throw t&&console.error(new Error(e)),n}}var a=n(9874);class l extends i.StyleModel{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"DescriptionStyleModel",_model_module:"@jupyter-widgets/controls",_model_module_version:a.A})}}l.styleProperties={description_width:{selector:".widget-label",attribute:"width",default:null}};class u extends i.DOMWidgetModel{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"DescriptionModel",_view_name:"DescriptionView",_view_module:"@jupyter-widgets/controls",_model_module:"@jupyter-widgets/controls",_view_module_version:a.A,_model_module_version:a.A,description:"",description_allow_html:!1})}}class d extends i.DOMWidgetView{render(){this.label=document.createElement("label"),this.el.appendChild(this.label),this.label.className="widget-label",this.label.style.display="none",this.listenTo(this.model,"change:description",this.updateDescription),this.listenTo(this.model,"change:description_allow_html",this.updateDescription),this.listenTo(this.model,"change:tabbable",this.updateTabindex),this.updateDescription(),this.updateTabindex(),this.updateTooltip()}typeset(e,t){this.displayed.then((()=>{var n,i,s;if(null===(i=null===(n=window.MathJax)||void 0===n?void 0:n.Hub)||void 0===i?void 0:i.Queue)return r(e,t);const o=null===(s=this.model.widget_manager._rendermime)||void 0===s?void 0:s.latexTypesetter;o&&(void 0!==t&&(e.textContent=t),o.typeset(e))}))}updateDescription(){const e=this.model.get("description");0===e.length?this.label.style.display="none":(this.model.get("description_allow_html")?this.label.innerHTML=this.model.widget_manager.inline_sanitize(e):this.label.textContent=e,this.typeset(this.label),this.label.style.display="")}updateTooltip(){this.label&&(this.label.title=this.model.get("tooltip"))}}class c extends u{}class h extends d{}class p extends i.WidgetModel{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"CoreWidgetModel",_view_module:"@jupyter-widgets/controls",_model_module:"@jupyter-widgets/controls",_view_module_version:a.A,_model_module_version:a.A})}}class f extends i.DOMWidgetModel{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"CoreDOMWidgetModel",_view_module:"@jupyter-widgets/controls",_model_module:"@jupyter-widgets/controls",_view_module_version:a.A,_model_module_version:a.A})}}class g extends u{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"CoreDescriptionModel",_view_module:"@jupyter-widgets/controls",_model_module:"@jupyter-widgets/controls",_view_module_version:a.A,_model_module_version:a.A})}}class m extends p{defaults(){return Object.assign(Object.assign({},super.defaults()),{target:void 0,source:void 0,_model_name:"DirectionalLinkModel"})}initialize(e,t){super.initialize(e,t),this.on("change",this.updateBindings,this),this.updateBindings()}updateValue(e,t,n,i){if(!this._updating){this._updating=!0;try{n&&(n.set(i,e.get(t)),n.save_changes())}finally{this._updating=!1}}}updateBindings(){this.cleanup(),[this.sourceModel,this.sourceAttr]=this.get("source")||[null,null],[this.targetModel,this.targetAttr]=this.get("target")||[null,null],this.sourceModel&&(this.listenTo(this.sourceModel,"change:"+this.sourceAttr,(()=>{this.updateValue(this.sourceModel,this.sourceAttr,this.targetModel,this.targetAttr)})),this.updateValue(this.sourceModel,this.sourceAttr,this.targetModel,this.targetAttr),this.listenToOnce(this.sourceModel,"destroy",this.cleanup)),this.targetModel&&this.listenToOnce(this.targetModel,"destroy",this.cleanup)}cleanup(){this.sourceModel&&(this.stopListening(this.sourceModel,"change:"+this.sourceAttr,void 0),this.stopListening(this.sourceModel,"destroy",void 0)),this.targetModel&&this.stopListening(this.targetModel,"destroy",void 0)}}m.serializers=Object.assign(Object.assign({},p.serializers),{target:{deserialize:i.unpack_models},source:{deserialize:i.unpack_models}});class v extends m{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"LinkModel"})}updateBindings(){super.updateBindings(),this.targetModel&&this.listenTo(this.targetModel,"change:"+this.targetAttr,(()=>{this.updateValue(this.targetModel,this.targetAttr,this.sourceModel,this.sourceAttr)}))}cleanup(){super.cleanup(),this.targetModel&&this.stopListening(this.targetModel,"change:"+this.targetAttr,void 0)}}class b extends l{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"CheckboxStyleModel"})}}b.styleProperties=Object.assign(Object.assign({},l.styleProperties),{background:{selector:"",attribute:"background",default:null}});class A extends l{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"ToggleButtonStyleModel"})}}A.styleProperties=Object.assign(Object.assign({},l.styleProperties),{font_family:{selector:"",attribute:"font-family",default:""},font_size:{selector:"",attribute:"font-size",default:""},font_style:{selector:"",attribute:"font-style",default:""},font_variant:{selector:"",attribute:"font-variant",default:""},font_weight:{selector:"",attribute:"font-weight",default:""},text_color:{selector:"",attribute:"color",default:""},text_decoration:{selector:"",attribute:"text-decoration",default:""}});class y extends g{defaults(){return Object.assign(Object.assign({},super.defaults()),{value:!1,disabled:!1,_model_name:"BoolModel"})}}class w extends g{defaults(){return Object.assign(Object.assign({},super.defaults()),{indent:!0,style:null,_view_name:"CheckboxView",_model_name:"CheckboxModel"})}}class _ extends d{render(){super.render(),this.el.classList.add("jupyter-widgets"),this.el.classList.add("widget-inline-hbox"),this.el.classList.add("widget-checkbox"),this.label.innerHTML="​",this.checkboxLabel=document.createElement("label"),this.checkboxLabel.classList.add("widget-label-basic"),this.el.appendChild(this.checkboxLabel),this.checkbox=document.createElement("input"),this.checkbox.setAttribute("type","checkbox"),this.checkboxLabel.appendChild(this.checkbox),this.descriptionSpan=document.createElement("span"),this.checkboxLabel.appendChild(this.descriptionSpan),this.listenTo(this.model,"change:indent",this.updateIndent),this.listenTo(this.model,"change:tabbable",this.updateTabindex),this.update(),this.updateDescription(),this.updateIndent(),this.updateTabindex(),this.updateTooltip()}updateDescription(){if(null==this.checkboxLabel)return;const e=this.model.get("description");this.model.get("description_allow_html")?this.descriptionSpan.innerHTML=this.model.widget_manager.inline_sanitize(e):this.descriptionSpan.textContent=e,this.typeset(this.descriptionSpan),this.descriptionSpan.title=e,this.checkbox.title=e}updateIndent(){const e=this.model.get("indent");this.label.style.display=e?"":"none"}updateTabindex(){if(!this.checkbox)return;const e=this.model.get("tabbable");!0===e?this.checkbox.setAttribute("tabIndex","0"):!1===e?this.checkbox.setAttribute("tabIndex","-1"):null===e&&this.checkbox.removeAttribute("tabIndex")}updateTooltip(){if(!this.checkbox)return;const e=this.model.get("tooltip");e?0===this.model.get("description").length&&this.checkbox.setAttribute("title",e):this.checkbox.removeAttribute("title")}events(){return{'click input[type="checkbox"]':"_handle_click"}}_handle_click(){const e=this.model.get("value");this.model.set("value",!e,{updated_view:this}),this.touch()}update(e){return this.checkbox.checked=this.model.get("value"),void 0!==e&&e.updated_view==this||(this.checkbox.disabled=this.model.get("disabled")),super.update()}handle_message(e){"focus"==e.do?this.checkbox.focus():"blur"==e.do&&this.checkbox.blur()}}class E extends y{defaults(){return Object.assign(Object.assign({},super.defaults()),{_view_name:"ToggleButtonView",_model_name:"ToggleButtonModel",tooltip:"",icon:"",button_style:"",style:null})}}class C extends i.DOMWidgetView{render(){super.render(),this.el.classList.add("jupyter-widgets"),this.el.classList.add("jupyter-button"),this.el.classList.add("widget-toggle-button"),this.listenTo(this.model,"change:button_style",this.update_button_style),this.listenTo(this.model,"change:tabbable",this.updateTabindex),this.set_button_style(),this.update()}update_button_style(){this.update_mapped_classes(C.class_map,"button_style")}set_button_style(){this.set_mapped_classes(C.class_map,"button_style")}update(e){if(this.model.get("value")?this.el.classList.add("mod-active"):this.el.classList.remove("mod-active"),void 0===e||e.updated_view!==this){this.el.disabled=this.model.get("disabled"),this.el.setAttribute("tabbable",this.model.get("tabbable")),this.el.setAttribute("title",this.model.get("tooltip"));const e=this.model.get("description"),t=this.model.get("icon");if(0===e.trim().length&&0===t.trim().length)this.el.innerHTML=" ";else{if(this.el.textContent="",t.trim().length){const e=document.createElement("i");this.el.appendChild(e),e.classList.add("fa"),e.classList.add("fa-"+t)}this.el.appendChild(document.createTextNode(e))}}return this.updateTabindex(),super.update()}events(){return{click:"_handle_click"}}_handle_click(e){e.preventDefault();const t=this.model.get("value");this.model.set("value",!t,{updated_view:this}),this.touch()}preinitialize(){this.tagName="button"}}C.class_map={primary:["mod-primary"],success:["mod-success"],info:["mod-info"],warning:["mod-warning"],danger:["mod-danger"]};class x extends y{defaults(){return Object.assign(Object.assign({},super.defaults()),{readout:"Invalid",_view_name:"ValidView",_model_name:"ValidModel"})}}class D extends d{render(){super.render(),this.el.classList.add("jupyter-widgets"),this.el.classList.add("widget-valid"),this.el.classList.add("widget-inline-hbox"),this.icon=document.createElement("i"),this.icon.classList.add("fa","fa-fw"),this.el.appendChild(this.icon),this.readout=document.createElement("span"),this.readout.classList.add("widget-valid-readout"),this.readout.classList.add("widget-readout"),this.el.appendChild(this.readout),this.update()}update(){this.el.classList.remove("mod-valid"),this.el.classList.remove("mod-invalid"),this.icon.classList.remove("fa-check"),this.icon.classList.remove("fa-times"),this.readout.textContent=this.model.get("readout"),this.model.get("value")?(this.el.classList.add("mod-valid"),this.icon.classList.add("fa-check")):(this.el.classList.add("mod-invalid"),this.icon.classList.add("fa-times"))}}class S extends i.StyleModel{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"ButtonStyleModel",_model_module:"@jupyter-widgets/controls",_model_module_version:a.A})}}S.styleProperties={button_color:{selector:"",attribute:"background-color",default:null},font_family:{selector:"",attribute:"font-family",default:""},font_size:{selector:"",attribute:"font-size",default:""},font_style:{selector:"",attribute:"font-style",default:""},font_variant:{selector:"",attribute:"font-variant",default:""},font_weight:{selector:"",attribute:"font-weight",default:""},text_color:{selector:"",attribute:"color",default:""},text_decoration:{selector:"",attribute:"text-decoration",default:""}};class T extends f{defaults(){return Object.assign(Object.assign({},super.defaults()),{description:"",tooltip:"",disabled:!1,icon:"",button_style:"",_view_name:"ButtonView",_model_name:"ButtonModel",style:null})}}class B extends i.DOMWidgetView{render(){super.render(),this.el.classList.add("jupyter-widgets"),this.el.classList.add("jupyter-button"),this.el.classList.add("widget-button"),this.listenTo(this.model,"change:button_style",this.update_button_style),this.listenTo(this.model,"change:tabbable",this.updateTabindex),this.set_button_style(),this.update()}update(){this.el.disabled=this.model.get("disabled"),this.updateTabindex();const e=this.model.get("tooltip"),t=this.model.get("description"),n=this.model.get("icon");if(this.el.setAttribute("title",null!=e?e:t),t.length||n.length){if(this.el.textContent="",n.length){const e=document.createElement("i");e.classList.add("fa"),e.classList.add(...n.split(/[\s]+/).filter(Boolean).map((e=>`fa-${e}`))),0===t.length&&e.classList.add("center"),this.el.appendChild(e)}this.el.appendChild(document.createTextNode(t))}return super.update()}update_button_style(){this.update_mapped_classes(B.class_map,"button_style")}set_button_style(){this.set_mapped_classes(B.class_map,"button_style")}events(){return{click:"_handle_click"}}_handle_click(e){e.preventDefault(),this.send({event:"click"})}preinitialize(){this.tagName="button"}}B.class_map={primary:["mod-primary"],success:["mod-success"],info:["mod-info"],warning:["mod-warning"],danger:["mod-danger"]};var k=n(8135),M=n(3326),j=n(5070),O=n(4651),I=n.n(O);class P extends f{defaults(){return Object.assign(Object.assign({},super.defaults()),{_view_name:"BoxView",_model_name:"BoxModel",children:[],box_style:""})}}P.serializers=Object.assign(Object.assign({},f.serializers),{children:{deserialize:i.unpack_models}});class R extends P{defaults(){return Object.assign(Object.assign({},super.defaults()),{_view_name:"HBoxView",_model_name:"HBoxModel"})}}class L extends P{defaults(){return Object.assign(Object.assign({},super.defaults()),{_view_name:"VBoxView",_model_name:"VBoxModel"})}}class N extends i.DOMWidgetView{_createElement(e){return this.luminoWidget=new i.JupyterLuminoPanelWidget({view:this}),this.luminoWidget.node}_setElement(e){if(this.el||e!==this.luminoWidget.node)throw new Error("Cannot reset the DOM element.");this.el=this.luminoWidget.node,this.$el=I()(this.luminoWidget.node)}initialize(e){super.initialize(e),this.children_views=new i.ViewList(this.add_child_model,null,this),this.listenTo(this.model,"change:children",this.update_children),this.listenTo(this.model,"change:box_style",this.update_box_style),this.luminoWidget.addClass("jupyter-widgets"),this.luminoWidget.addClass("widget-container"),this.luminoWidget.addClass("widget-box")}render(){super.render(),this.update_children(),this.set_box_style()}update_children(){var e;null===(e=this.children_views)||void 0===e||e.update(this.model.get("children")).then((e=>{e.forEach((e=>{M.Mu.postMessage(e.luminoWidget,j.x0.ResizeMessage.UnknownSize)}))}))}update_box_style(){this.update_mapped_classes(N.class_map,"box_style")}set_box_style(){this.set_mapped_classes(N.class_map,"box_style")}add_child_model(e){const t=new j.x0;return this.luminoWidget.addWidget(t),this.create_child_view(e).then((e=>{const n=k.Rw.firstIndexOf(this.luminoWidget.widgets,t);return this.luminoWidget.insertWidget(n,e.luminoWidget),t.dispose(),e})).catch((0,i.reject)("Could not add child view to box",!0))}remove(){this.children_views=null,super.remove()}}N.class_map={success:["alert","alert-success"],info:["alert","alert-info"],warning:["alert","alert-warning"],danger:["alert","alert-danger"]};class F extends N{initialize(e){super.initialize(e),this.luminoWidget.addClass("widget-hbox")}}class z extends N{initialize(e){super.initialize(e),this.luminoWidget.addClass("widget-vbox")}}class U extends N{initialize(e){super.initialize(e),this.luminoWidget.addClass("widget-gridbox"),this.luminoWidget.removeClass("widget-box")}}class H extends P{defaults(){return Object.assign(Object.assign({},super.defaults()),{_view_name:"GridBoxView",_model_name:"GridBoxModel"})}}class W extends f{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"ImageModel",_view_name:"ImageView",format:"png",width:"",height:"",value:new DataView(new ArrayBuffer(0))})}}W.serializers=Object.assign(Object.assign({},f.serializers),{value:{serialize:e=>new DataView(e.buffer.slice(0))}});class q extends i.DOMWidgetView{render(){super.render(),this.luminoWidget.addClass("jupyter-widgets"),this.luminoWidget.addClass("widget-image"),this.update()}update(){let e;const t=this.model.get("format"),n=this.model.get("value");if("url"!==t){const t=new Blob([n],{type:`image/${this.model.get("format")}`});e=URL.createObjectURL(t)}else e=new TextDecoder("utf-8").decode(n.buffer);const i=this.el.src;this.el.src=e,i&&URL.revokeObjectURL(i);const r=this.model.get("width");void 0!==r&&r.length>0?this.el.setAttribute("width",r):this.el.removeAttribute("width");const s=this.model.get("height");return void 0!==s&&s.length>0?this.el.setAttribute("height",s):this.el.removeAttribute("height"),super.update()}remove(){this.el.src&&URL.revokeObjectURL(this.el.src),super.remove()}preinitialize(){this.tagName="img"}}class $ extends f{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"VideoModel",_view_name:"VideoView",format:"mp4",width:"",height:"",autoplay:!0,loop:!0,controls:!0,value:new DataView(new ArrayBuffer(0))})}}$.serializers=Object.assign(Object.assign({},f.serializers),{value:{serialize:e=>new DataView(e.buffer.slice(0))}});class V extends i.DOMWidgetView{render(){super.render(),this.luminoWidget.addClass("jupyter-widgets"),this.luminoWidget.addClass("widget-image"),this.update()}update(){let e;const t=this.model.get("format"),n=this.model.get("value");if("url"!==t){const t=new Blob([n],{type:`video/${this.model.get("format")}`});e=URL.createObjectURL(t)}else e=new TextDecoder("utf-8").decode(n.buffer);const i=this.el.src;this.el.src=e,i&&URL.revokeObjectURL(i);const r=this.model.get("width");void 0!==r&&r.length>0?this.el.setAttribute("width",r):this.el.removeAttribute("width");const s=this.model.get("height");return void 0!==s&&s.length>0?this.el.setAttribute("height",s):this.el.removeAttribute("height"),this.el.loop=this.model.get("loop"),this.el.autoplay=this.model.get("autoplay"),this.el.controls=this.model.get("controls"),super.update()}remove(){this.el.src&&URL.revokeObjectURL(this.el.src),super.remove()}preinitialize(){this.tagName="video"}}class G extends f{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"AudioModel",_view_name:"AudioView",format:"mp3",autoplay:!0,loop:!0,controls:!0,value:new DataView(new ArrayBuffer(0))})}}G.serializers=Object.assign(Object.assign({},f.serializers),{value:{serialize:e=>new DataView(e.buffer.slice(0))}});class K extends i.DOMWidgetView{render(){super.render(),this.luminoWidget.addClass("jupyter-widgets"),this.update()}update(){let e;const t=this.model.get("format"),n=this.model.get("value");if("url"!==t){const t=new Blob([n],{type:`audio/${this.model.get("format")}`});e=URL.createObjectURL(t)}else e=new TextDecoder("utf-8").decode(n.buffer);const i=this.el.src;return this.el.src=e,i&&URL.revokeObjectURL(i),this.el.loop=this.model.get("loop"),this.el.autoplay=this.model.get("autoplay"),this.el.controls=this.model.get("controls"),super.update()}remove(){this.el.src&&URL.revokeObjectURL(this.el.src),super.remove()}preinitialize(){this.tagName="audio"}}const Y={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgrey:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgreen:"#90ee90",lightgray:"#d3d3d3",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};class J extends g{defaults(){return Object.assign(Object.assign({},super.defaults()),{value:"black",concise:!1,_model_name:"ColorPickerModel",_view_name:"ColorPickerView"})}}class X extends d{render(){super.render(),this.el.classList.add("jupyter-widgets"),this.el.classList.add("widget-inline-hbox"),this.el.classList.add("widget-colorpicker"),this._color_container=document.createElement("div"),this._color_container.className="widget-inline-hbox widget-colorpicker-input",this.el.appendChild(this._color_container),this._textbox=document.createElement("input"),this._textbox.setAttribute("type","text"),this._textbox.id=this.label.htmlFor=(0,i.uuid)(),this._color_container.appendChild(this._textbox),this._textbox.value=this.model.get("value"),this._colorpicker=document.createElement("input"),this._colorpicker.setAttribute("type","color"),this._color_container.appendChild(this._colorpicker),this.listenTo(this.model,"change:value",this._update_value),this.listenTo(this.model,"change:concise",this._update_concise),this._update_concise(),this._update_value(),this.update()}update(e){if(void 0===e||e.updated_view!=this){const e=this.model.get("disabled");this._textbox.disabled=e,this._colorpicker.disabled=e}return super.update()}events(){return this._picker_change,this._text_change,{'change [type="color"]':"_picker_change",'change [type="text"]':"_text_change"}}_update_value(){const e=this.model.get("value");var t,n;this._colorpicker.value=Y[(t=e).toLowerCase()]||(7===(n=t).length?n:"#"+n.charAt(1)+n.charAt(1)+n.charAt(2)+n.charAt(2)+n.charAt(3)+n.charAt(3)),this._textbox.value=e}_update_concise(){this.model.get("concise")?(this.el.classList.add("concise"),this._textbox.style.display="none"):(this.el.classList.remove("concise"),this._textbox.style.display="")}_picker_change(){this.model.set("value",this._colorpicker.value),this.touch()}_text_change(){const e=this._validate_color(this._textbox.value,this.model.get("value"));this.model.set("value",e),this.touch()}_validate_color(e,t){return e.match(/#[a-fA-F0-9]{3}(?:[a-fA-F0-9]{3})?$/)||Y[e.toLowerCase()]?e:t}}function Z(e){return null===e?null:{year:e.getUTCFullYear(),month:e.getUTCMonth(),date:e.getUTCDate()}}function Q(e){if(null===e)return null;{const t=new Date;return t.setUTCFullYear(e.year,e.month,e.date),t.setUTCHours(0,0,0,0),t}}class ee extends g{defaults(){return Object.assign(Object.assign({},super.defaults()),{value:null,_model_name:"DatePickerModel",_view_name:"DatePickerView"})}}ee.serializers=Object.assign(Object.assign({},g.serializers),{value:{serialize:Z,deserialize:Q}});class te extends d{render(){super.render(),this.el.classList.add("jupyter-widgets"),this.el.classList.add("widget-inline-hbox"),this.el.classList.add("widget-datepicker"),this._datepicker=document.createElement("input"),this._datepicker.setAttribute("type","date"),this._datepicker.id=this.label.htmlFor=(0,i.uuid)(),this.el.appendChild(this._datepicker),this.listenTo(this.model,"change:value",this._update_value),this._update_value(),this.update()}update(e){return void 0!==e&&e.updated_view===this||(this._datepicker.disabled=this.model.get("disabled")),super.update()}events(){return this._picker_change,this._picker_focusout,{'change [type="date"]':"_picker_change",'focusout [type="date"]':"_picker_focusout"}}_update_value(){const e=this.model.get("value");this._datepicker.valueAsDate=e}_picker_change(){this._datepicker.validity.badInput||(this.model.set("value",this._datepicker.valueAsDate),this.touch())}_picker_focusout(){this._datepicker.validity.badInput&&(this.model.set("value",null),this.touch())}}const ne=/(\d\d):(\d\d)(:(\d\d)(.(\d{1,3})\d*)?)?/;function ie(e){if(null===e)return null;{const t=ne.exec(e);return null===t?null:{hours:Math.min(23,parseInt(t[1],10)),minutes:Math.min(59,parseInt(t[2],10)),seconds:t[4]?Math.min(59,parseInt(t[4],10)):0,milliseconds:t[6]?parseInt(t[6],10):0}}}function re(e){if(null===e)return null;{const t=[`${e.hours.toString().padStart(2,"0")}:${e.minutes.toString().padStart(2,"0")}`];return(e.seconds>0||e.milliseconds>0)&&(t.push(`:${e.seconds.toString().padStart(2,"0")}`),e.milliseconds>0&&t.push(`.${e.milliseconds.toString().padStart(3,"0")}`)),t.join("")}}const se={serialize:ie,deserialize:re};class oe extends g{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:oe.model_name,_view_name:oe.view_name,value:null,disabled:!1,min:null,max:null,step:60})}}oe.serializers=Object.assign(Object.assign({},g.serializers),{value:se,min:se,max:se}),oe.model_name="TimeModel",oe.view_name="TimeView";class ae extends d{render(){super.render(),this.el.classList.add("jupyter-widgets"),this.el.classList.add("widget-inline-hbox"),this.el.classList.add("widget-timepicker"),this._timepicker=document.createElement("input"),this._timepicker.setAttribute("type","time"),this._timepicker.id=this.label.htmlFor=(0,i.uuid)(),this.el.appendChild(this._timepicker),this.listenTo(this.model,"change:value",this._update_value),this.listenTo(this.model,"change",this.update2),this._update_value(),this.update2()}update2(e,t){return void 0!==t&&t.updated_view===this||(this._timepicker.disabled=this.model.get("disabled"),this._timepicker.min=this.model.get("min"),this._timepicker.max=this.model.get("max"),this._timepicker.step=this.model.get("step")),super.update()}events(){return this._picker_change,this._picker_focusout,{'change [type="time"]':"_picker_change",'focusout [type="time"]':"_picker_focusout"}}_update_value(e,t,n){void 0!==n&&n.updated_view===this||(this._timepicker.value=this.model.get("value"))}_picker_change(){this._timepicker.validity.badInput||(this.model.set("value",this._timepicker.value,{updated_view:this}),this.touch())}_picker_focusout(){this._timepicker.validity.badInput&&(this.model.set("value",null,{updated_view:this}),this.touch())}}function le(e){return null===e?null:{year:e.getUTCFullYear(),month:e.getUTCMonth(),date:e.getUTCDate(),hours:e.getUTCHours(),minutes:e.getUTCMinutes(),seconds:e.getUTCSeconds(),milliseconds:e.getUTCMilliseconds()}}function ue(e){if(null===e)return null;{const t=new Date;return t.setUTCFullYear(e.year,e.month,e.date),t.setUTCHours(e.hours,e.minutes,e.seconds,e.milliseconds),t}}const de={serialize:le,deserialize:ue};class ce extends g{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"DatetimeModel",_view_name:"DatetimeView",value:null,disabled:!1,min:null,max:null})}}ce.serializers=Object.assign(Object.assign({},g.serializers),{value:de,min:de,max:de});class he extends d{render(){super.render(),this.el.classList.add("jupyter-widgets"),this.el.classList.add("widget-inline-hbox"),this.el.classList.add("widget-datetimepicker");const e=document.createElement("input");e.type="datetime-local","text"===e.type?(this._datepicker=document.createElement("input"),this._datepicker.setAttribute("type","date"),this._datepicker.id=this.label.htmlFor=(0,i.uuid)(),this._timepicker=document.createElement("input"),this._timepicker.setAttribute("type","time"),this._timepicker.id=(0,i.uuid)(),this.el.appendChild(this._datepicker),this.el.appendChild(this._timepicker)):(this._datetimepicker=e,this._datetimepicker.id=this.label.htmlFor=(0,i.uuid)(),this.el.appendChild(this._datetimepicker)),this.listenTo(this.model,"change:value",this._update_value),this.listenTo(this.model,"change",this.update2),this._update_value(),this.update2()}update2(e,t){if(void 0===t||t.updated_view!==this){const e=this.model.get("min"),t=this.model.get("max");this._datetimepicker?(this._datetimepicker.disabled=this.model.get("disabled"),this._datetimepicker.min=pe.dt_as_dt_string(e),this._datetimepicker.max=pe.dt_as_dt_string(t)):(this._datepicker.disabled=this.model.get("disabled"),this._datepicker.min=pe.dt_as_date_string(e),this._datepicker.max=pe.dt_as_date_string(t),this._timepicker.disabled=this.model.get("disabled"))}}events(){return this._picker_change,this._picker_focusout,{'change [type="date"]':"_picker_change",'change [type="time"]':"_picker_change",'change [type="datetime-local"]':"_picker_change",'focusout [type="date"]':"_picker_focusout",'focusout [type="datetime-local"]':"_picker_focusout",'focusout [type="time"]':"_picker_focusout"}}_update_value(e,t,n){if(void 0===n||n.updated_view!==this){const e=this.model.get("value");this._datetimepicker?this._datetimepicker.value=pe.dt_as_dt_string(e):(this._datepicker.valueAsDate=e,this._timepicker.value=pe.dt_as_time_string(e))}}_picker_change(){if(this._datetimepicker){if(!this._datetimepicker.validity.badInput){const e=this._datetimepicker.value;let t=e?new Date(e):null;t&&isNaN(t.valueOf())&&(t=null),this.model.set("value",t,{updated_view:this}),this.touch()}}else if(!this._datepicker.validity.badInput&&!this._timepicker.validity.badInput){const e=this._datepicker.valueAsDate,t=ie(this._timepicker.value);null!==e&&null!==t&&e.setHours(t.hours,t.minutes,t.seconds,t.milliseconds),this.model.set("value",null!==t&&e,{updated_view:this}),this.touch()}}_picker_focusout(){[this._datetimepicker,this._datepicker,this._timepicker].some((e=>e&&e.validity.badInput))&&(this.model.set("value",null),this.touch())}}var pe;function fe(e){return null===e?null:{year:e.getFullYear(),month:e.getMonth(),date:e.getDate(),hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds(),milliseconds:e.getMilliseconds()}}function ge(e){if(null===e)return null;{const t=new Date;return t.setFullYear(e.year,e.month,e.date),t.setHours(e.hours,e.minutes,e.seconds,e.milliseconds),t}}!function(e){function t(e){if(null===e)return"";const t=[];return t.push(`${e.getFullYear().toString().padStart(4,"0")}`),t.push(`-${(e.getMonth()+1).toString().padStart(2,"0")}`),t.push(`-${e.getDate().toString().padStart(2,"0")}`),t.push(`T${e.getHours().toString().padStart(2,"0")}`),t.push(`:${e.getMinutes().toString().padStart(2,"0")}`),(e.getSeconds()>0||e.getMilliseconds()>0)&&(t.push(`:${e.getSeconds().toString().padStart(2,"0")}`),e.getMilliseconds()>0&&t.push(`.${e.getMilliseconds().toString().padStart(3,"0")}`)),t.join("")}e.dt_as_dt_string=t,e.dt_as_date_string=function(e){return e?t(e).split("T",2)[0]:""},e.dt_as_time_string=function(e){return e?t(e).split("T",2)[1]:""}}(pe||(pe={}));const me={serialize:fe,deserialize:ge};class ve extends ce{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"NaiveDatetimeModel"})}}function be(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,i=e.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+e.slice(n+1)]}ve.serializers=Object.assign(Object.assign({},g.serializers),{value:me,min:me,max:me});var Ae,ye=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function we(e){if(!(t=ye.exec(e)))throw new Error("invalid format: "+e);var t;return new _e({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function _e(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function Ee(e,t){var n=be(e,t);if(!n)return e+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}we.prototype=_e.prototype,_e.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const Ce={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Ee(100*e,t),r:Ee,s:function(e,t){var n=be(e,t);if(!n)return e+"";var i=n[0],r=n[1],s=r-(Ae=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,o=i.length;return s===o?i:s>o?i+new Array(s-o+1).join("0"):s>0?i.slice(0,s)+"."+i.slice(s):"0."+new Array(1-s).join("0")+be(e,Math.max(0,t+s-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function xe(e){return e}var De,Se,Te=Array.prototype.map,Be=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];De=function(e){var t,n,i=void 0===e.grouping||void 0===e.thousands?xe:(t=Te.call(e.grouping,Number),n=e.thousands+"",function(e,i){for(var r=e.length,s=[],o=0,a=t[0],l=0;r>0&&a>0&&(l+a+1>i&&(a=Math.max(1,i-l)),s.push(e.substring(r-=a,r+a)),!((l+=a+1)>i));)a=t[o=(o+1)%t.length];return s.reverse().join(n)}),r=void 0===e.currency?"":e.currency[0]+"",s=void 0===e.currency?"":e.currency[1]+"",o=void 0===e.decimal?".":e.decimal+"",a=void 0===e.numerals?xe:function(e){return function(t){return t.replace(/[0-9]/g,(function(t){return e[+t]}))}}(Te.call(e.numerals,String)),l=void 0===e.percent?"%":e.percent+"",u=void 0===e.minus?"−":e.minus+"",d=void 0===e.nan?"NaN":e.nan+"";function c(e){var t=(e=we(e)).fill,n=e.align,c=e.sign,h=e.symbol,p=e.zero,f=e.width,g=e.comma,m=e.precision,v=e.trim,b=e.type;"n"===b?(g=!0,b="g"):Ce[b]||(void 0===m&&(m=12),v=!0,b="g"),(p||"0"===t&&"="===n)&&(p=!0,t="0",n="=");var A="$"===h?r:"#"===h&&/[boxX]/.test(b)?"0"+b.toLowerCase():"",y="$"===h?s:/[%p]/.test(b)?l:"",w=Ce[b],_=/[defgprs%]/.test(b);function E(e){var r,s,l,h=A,E=y;if("c"===b)E=w(e)+E,e="";else{var C=(e=+e)<0||1/e<0;if(e=isNaN(e)?d:w(Math.abs(e),m),v&&(e=function(e){e:for(var t,n=e.length,i=1,r=-1;i0&&(r=0)}return r>0?e.slice(0,r)+e.slice(t+1):e}(e)),C&&0==+e&&"+"!==c&&(C=!1),h=(C?"("===c?c:u:"-"===c||"("===c?"":c)+h,E=("s"===b?Be[8+Ae/3]:"")+E+(C&&"("===c?")":""),_)for(r=-1,s=e.length;++r(l=e.charCodeAt(r))||l>57){E=(46===l?o+e.slice(r+1):e.slice(r))+E,e=e.slice(0,r);break}}g&&!p&&(e=i(e,1/0));var x=h.length+e.length+E.length,D=x>1)+h+e+E+D.slice(x);break;default:e=D+h+e+E}return a(e)}return m=void 0===m?6:/[gprs]/.test(b)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),E.toString=function(){return e+""},E}return{format:c,formatPrefix:function(e,t){var n,i=c(((e=we(e)).type="f",e)),r=3*Math.max(-8,Math.min(8,Math.floor((n=t,((n=be(Math.abs(n)))?n[1]:NaN)/3)))),s=Math.pow(10,-r),o=Be[8+r/3];return function(e){return i(s*e)+o}}}}({thousands:",",grouping:[3],currency:["$",""]}),Se=De.format,De.formatPrefix;var ke=n(5715),Me=n.n(ke);class je extends g{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"IntModel",value:0})}}class Oe extends je{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"BoundedIntModel",max:100,min:0})}}class Ie extends l{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"SliderStyleModel"})}}Ie.styleProperties=Object.assign(Object.assign({},l.styleProperties),{handle_color:{selector:".noUi-handle",attribute:"background-color",default:null}});class Pe extends Oe{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"IntSliderModel",_view_name:"IntSliderView",step:1,orientation:"horizontal",readout:!0,readout_format:"d",continuous_update:!0,style:null,disabled:!1})}initialize(e,t){super.initialize(e,t),this.on("change:readout_format",this.update_readout_format,this),this.update_readout_format()}update_readout_format(){this.readout_formatter=Se(this.get("readout_format"))}}class Re extends Pe{}class Le extends d{constructor(){super(...arguments),this._parse_value=parseInt}render(){super.render(),this.el.classList.add("jupyter-widgets"),this.el.classList.add("widget-inline-hbox"),this.el.classList.add("widget-slider"),this.el.classList.add("widget-hslider"),this.$slider=document.createElement("div"),this.$slider.classList.add("slider"),this.slider_container=document.createElement("div"),this.slider_container.classList.add("slider-container"),this.slider_container.appendChild(this.$slider),this.el.appendChild(this.slider_container),this.readout=document.createElement("div"),this.el.appendChild(this.readout),this.readout.classList.add("widget-readout"),this.readout.contentEditable="true",this.readout.style.display="none",this.createSlider(),this.model.on("change:orientation",this.regenSlider,this),this.model.on("change:max",this.updateSliderOptions,this),this.model.on("change:min",this.updateSliderOptions,this),this.model.on("change:step",this.updateSliderOptions,this),this.model.on("change:value",this.updateSliderValue,this),this.update()}update(e){return void 0!==e&&e.updated_view===this||(this.model.get("disabled")?(this.readout.contentEditable="false",this.$slider.setAttribute("disabled",!0)):(this.readout.contentEditable="true",this.$slider.removeAttribute("disabled")),"vertical"===this.model.get("orientation")?(this.el.classList.remove("widget-hslider"),this.el.classList.add("widget-vslider"),this.el.classList.remove("widget-inline-hbox"),this.el.classList.add("widget-inline-vbox")):(this.el.classList.remove("widget-vslider"),this.el.classList.add("widget-hslider"),this.el.classList.remove("widget-inline-vbox"),this.el.classList.add("widget-inline-hbox")),this.model.get("readout")?(this.readout.style.display="",this.displayed.then((()=>{this.readout_overflow()?this.readout.classList.add("overflow"):this.readout.classList.remove("overflow")}))):this.readout.style.display="none"),super.update()}readout_overflow(){return this.readout.scrollWidth>this.readout.clientWidth}events(){return{"blur [contentEditable=true]":"handleTextChange","keydown [contentEditable=true]":"handleKeyDown"}}handleKeyDown(e){13===e.keyCode&&(e.preventDefault(),this.handleTextChange())}createSlider(){const e=this.model.get("orientation"),t=this.model.get("behavior");Me().create(this.$slider,{start:this.model.get("value"),connect:!0,behaviour:t,range:{min:this.model.get("min"),max:this.model.get("max")},step:this.model.get("step"),animate:!1,orientation:e,direction:"horizontal"===e?"ltr":"rtl",format:{from:e=>Number(e),to:e=>this._validate_slide_value(e)}}),this.$slider.noUiSlider.on("update",((e,t)=>{this.handleSliderUpdateEvent(e,t)})),this.$slider.noUiSlider.on("change",((e,t)=>{this.handleSliderChangeEvent(e,t)}))}regenSlider(e){this.$slider.noUiSlider.destroy(),this.createSlider()}_validate_slide_value(e){return Math.round(e)}}class Ne extends Le{constructor(){super(...arguments),this._range_regex=/^\s*([+-]?\d+)\s*[-:–]\s*([+-]?\d+)/}update(e){super.update(e);const t=this.model.get("value");this.readout.textContent=this.valueToString(t),this.model.get("value")!==t&&(this.model.set("value",t,{updated_view:this}),this.touch())}valueToString(e){const t=this.model.readout_formatter;return e.map((function(e){return t(e)})).join(" – ")}stringToValue(e){if(null===e)return null;const t=this._range_regex.exec(e);return t?[this._parse_value(t[1]),this._parse_value(t[2])]:null}handleTextChange(){let e=this.stringToValue(this.readout.textContent);const t=this.model.get("min"),n=this.model.get("max");null===e||isNaN(e[0])||isNaN(e[1])||e[0]>e[1]?this.readout.textContent=this.valueToString(this.model.get("value")):(e=[Math.max(Math.min(e[0],n),t),Math.max(Math.min(e[1],n),t)],e[0]!==this.model.get("value")[0]||e[1]!==this.model.get("value")[1]?(this.readout.textContent=this.valueToString(e),this.model.set("value",e),this.touch()):this.readout.textContent=this.valueToString(this.model.get("value")))}handleSliderChangeEvent(e,t){const n=e.map(this._validate_slide_value);this.readout.textContent=this.valueToString(n),this.handleSliderChanged(e,t)}handleSliderUpdateEvent(e,t){const n=e.map(this._validate_slide_value);this.readout.textContent=this.valueToString(n),this.model.get("continuous_update")&&this.handleSliderChanged(e,t)}handleSliderChanged(e,t){const n=e.map(this._validate_slide_value);this.model.set("value",n,{updated_view:this}),this.touch()}updateSliderOptions(e){this.$slider.noUiSlider.updateOptions({start:this.model.get("value"),range:{min:this.model.get("min"),max:this.model.get("max")},step:this.model.get("step")})}updateSliderValue(e,t,n){if(n.updated_view===this)return;const i=this.$slider.noUiSlider.get(),r=this.model.get("value");i[0]===r[0]&&i[1]===r[1]||this.$slider.noUiSlider.set(r)}}class Fe extends Le{update(e){super.update(e);const t=this.model.get("min"),n=this.model.get("max");let i=this.model.get("value");i>n?i=n:i=1){const e=n.substr(1);n=n[0]+e.replace(/[+-]/g,"")}t.value!==n&&(e.preventDefault(),t.value=n)}handleChanging(e){const t=e.target.value.trim();""===t||["-","-.",".","+.","+"].indexOf(t)>=0||this.model.get("continuous_update")&&this.handleChanged(e)}handleChanged(e){const t=e.target;let n=this._parse_value(t.value);if(isNaN(n))t.value=this.model.get("value");else{let e=n;void 0!==this.model.get("max")&&(e=Math.min(this.model.get("max"),e)),void 0!==this.model.get("min")&&(e=Math.max(this.model.get("min"),e)),e!==n&&(t.value=e,n=e),n!==this.model.get("value")&&(this.model.set("value",n,{updated_view:this}),this.touch())}}}class We extends l{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"ProgressStyleModel"})}}We.styleProperties=Object.assign(Object.assign({},l.styleProperties),{bar_color:{selector:".progress-bar",attribute:"background-color",default:null}});class qe extends Oe{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"IntProgressModel",_view_name:"ProgressView",orientation:"horizontal",bar_style:"",style:null})}}class $e extends d{initialize(e){super.initialize(e),this.listenTo(this.model,"change:bar_style",this.update_bar_style),this.luminoWidget.addClass("jupyter-widgets")}render(){super.render();const e="horizontal"===this.model.get("orientation")?"widget-hprogress":"widget-vprogress";this.el.classList.add(e),this.progress=document.createElement("div"),this.progress.classList.add("progress"),this.progress.style.position="relative",this.el.appendChild(this.progress),this.bar=document.createElement("div"),this.bar.classList.add("progress-bar"),this.bar.style.position="absolute",this.bar.style.bottom="0px",this.bar.style.left="0px",this.progress.appendChild(this.bar),this.update(),this.set_bar_style()}update(){const e=this.model.get("value"),t=this.model.get("max"),n=this.model.get("min"),i=100*(e-n)/(t-n);return"horizontal"===this.model.get("orientation")?(this.el.classList.remove("widget-inline-vbox"),this.el.classList.remove("widget-vprogress"),this.el.classList.add("widget-inline-hbox"),this.el.classList.add("widget-hprogress"),this.bar.style.width=i+"%",this.bar.style.height="100%"):(this.el.classList.remove("widget-inline-hbox"),this.el.classList.remove("widget-hprogress"),this.el.classList.add("widget-inline-vbox"),this.el.classList.add("widget-vprogress"),this.bar.style.width="100%",this.bar.style.height=i+"%"),super.update()}update_bar_style(){this.update_mapped_classes($e.class_map,"bar_style",this.bar)}set_bar_style(){this.set_mapped_classes($e.class_map,"bar_style",this.bar)}}$e.class_map={success:["progress-bar-success"],info:["progress-bar-info"],warning:["progress-bar-warning"],danger:["progress-bar-danger"]};class Ve extends Oe{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"PlayModel",_view_name:"PlayView",repeat:!1,playing:!1,show_repeat:!0,interval:100,step:1,disabled:!1})}initialize(e,t){super.initialize(e,t)}loop(){if(!this.get("playing"))return;const e=this.get("value")+this.get("step");e<=this.get("max")?(this.set("value",e),this.schedule_next()):this.get("repeat")?(this.set("value",this.get("min")),this.schedule_next()):this.pause(),this.save_changes()}schedule_next(){this._timerId=window.setTimeout(this.loop.bind(this),this.get("interval"))}stop(){this.pause(),this.set("value",this.get("min")),this.save_changes()}pause(){window.clearTimeout(this._timerId),this._timerId=void 0,this.set("playing",!1),this.save_changes()}animate(){void 0===this._timerId&&(this.get("value")===this.get("max")?(this.set("value",this.get("min")),this.schedule_next(),this.save_changes()):this.loop(),this.save_changes())}play(){this.set("playing",!this.get("playing")),this.save_changes()}repeat(){this.set("repeat",!this.get("repeat")),this.save_changes()}}class Ge extends i.DOMWidgetView{render(){super.render(),this.el.classList.add("jupyter-widgets"),this.el.classList.add("widget-inline-hbox"),this.el.classList.add("widget-play"),this.playPauseButton=document.createElement("button"),this.stopButton=document.createElement("button"),this.repeatButton=document.createElement("button"),this.playPauseButton.className="jupyter-button",this.stopButton.className="jupyter-button",this.repeatButton.className="jupyter-button",this.el.appendChild(this.playPauseButton),this.el.appendChild(this.stopButton),this.el.appendChild(this.repeatButton);const e=document.createElement("i");e.className="fa fa-play",this.playPauseButton.appendChild(e);const t=document.createElement("i");t.className="fa fa-stop",this.stopButton.appendChild(t);const n=document.createElement("i");n.className="fa fa-retweet",this.repeatButton.appendChild(n),this.playPauseButton.onclick=this.model.play.bind(this.model),this.stopButton.onclick=this.model.stop.bind(this.model),this.repeatButton.onclick=this.model.repeat.bind(this.model),this.listenTo(this.model,"change:playing",this.onPlayingChanged),this.listenTo(this.model,"change:repeat",this.updateRepeat),this.listenTo(this.model,"change:show_repeat",this.updateRepeat),this.updatePlaying(),this.updateRepeat(),this.update()}update(){const e=this.model.get("disabled");this.playPauseButton.disabled=e,this.stopButton.disabled=e,this.repeatButton.disabled=e,this.updatePlaying()}onPlayingChanged(){this.updatePlaying();const e=this.model.previous("playing"),t=this.model.get("playing");!e&&t?this.model.animate():this.model.pause()}updatePlaying(){const e=this.model.get("playing");this.playPauseButton.getElementsByTagName("i")[0].className=e?"fa fa-pause":"fa fa-play"}updateRepeat(){const e=this.model.get("repeat");this.repeatButton.style.display=this.model.get("show_repeat")?this.playPauseButton.style.display:"none",e?this.repeatButton.classList.add("mod-active"):this.repeatButton.classList.remove("mod-active")}}class Ke extends g{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"FloatModel",value:0})}}class Ye extends Ke{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"BoundedFloatModel",max:100,min:0})}}class Je extends Ye{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"FloatSliderModel",_view_name:"FloatSliderView",step:1,orientation:"horizontal",_range:!1,readout:!0,readout_format:".2f",slider_color:null,continuous_update:!0,disabled:!1})}initialize(e,t){super.initialize(e,t),this.on("change:readout_format",this.update_readout_format,this),this.update_readout_format()}update_readout_format(){this.readout_formatter=Se(this.get("readout_format"))}}class Xe extends Ye{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"FloatLogSliderModel",_view_name:"FloatLogSliderView",step:.1,orientation:"horizontal",_range:!1,readout:!0,readout_format:".3g",slider_color:null,continuous_update:!0,disabled:!1,base:10,value:1,min:0,max:4})}initialize(e,t){super.initialize(e,t),this.on("change:readout_format",this.update_readout_format,this),this.update_readout_format()}update_readout_format(){this.readout_formatter=Se(this.get("readout_format"))}}class Ze extends Je{}class Qe extends Fe{constructor(){super(...arguments),this._parse_value=parseFloat}_validate_slide_value(e){return e}}class et extends Le{constructor(){super(...arguments),this._parse_value=parseFloat}update(e){super.update(e);const t=this.model.get("value");this.readout.textContent=this.valueToString(t)}logCalc(e){const t=this.model.get("min"),n=this.model.get("max"),i=this.model.get("base");let r=Math.log(e)/Math.log(i);return r>n?r=n:rNumber(e),to:e=>e}}),this.$slider.noUiSlider.on("update",((e,t)=>{this.handleSliderUpdateEvent(e,t)})),this.$slider.noUiSlider.on("change",((e,t)=>{this.handleSliderChangeEvent(e,t)}))}valueToString(e){return(0,this.model.readout_formatter)(e)}stringToValue(e){return null===e?NaN:this._parse_value(e)}handleTextChange(){let e=this.stringToValue(this.readout.textContent);const t=this.model.get("min"),n=this.model.get("max"),i=this.model.get("base");isNaN(e)?this.readout.textContent=this.valueToString(this.model.get("value")):(e=Math.max(Math.min(e,Math.pow(i,n)),Math.pow(i,t)),e!==this.model.get("value")?(this.readout.textContent=this.valueToString(e),this.model.set("value",e),this.touch()):this.readout.textContent=this.valueToString(this.model.get("value")))}handleSliderUpdateEvent(e,t){const n=this.model.get("base"),i=Math.pow(n,this._validate_slide_value(e[0]));this.readout.textContent=this.valueToString(i),this.model.get("continuous_update")&&this.handleSliderChanged(e,t)}handleSliderChangeEvent(e,t){const n=this.model.get("base"),i=Math.pow(n,this._validate_slide_value(e[0]));this.readout.textContent=this.valueToString(i),this.handleSliderChanged(e,t)}handleSliderChanged(e,t){if(this._updating_slider)return;const n=this.model.get("base"),i=Math.pow(n,this._validate_slide_value(e[0]));this.model.set("value",i,{updated_view:this}),this.touch()}updateSliderValue(e,t,n){if(n.updated_view===this)return;const i=this.logCalc(this.model.get("value"));this.$slider.noUiSlider.set(i)}updateSliderOptions(e){this.$slider.noUiSlider.updateOptions({start:this.logCalc(this.model.get("value")),range:{min:this.model.get("min"),max:this.model.get("max")},step:this.model.get("step")})}_validate_slide_value(e){return e}}class tt extends Ne{constructor(){super(...arguments),this._parse_value=parseFloat,this._range_regex=/^\s*([+-]?(?:\d*\.?\d+|\d+\.)(?:[eE][-:]?\d+)?)\s*[-:–]\s*([+-]?(?:\d*\.?\d+|\d+\.)(?:[eE][+-]?\d+)?)/}_validate_slide_value(e){return e}}class nt extends Ke{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"FloatTextModel",_view_name:"FloatTextView",disabled:!1,continuous_update:!1})}}class it extends Ye{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"BoundedFloatTextModel",_view_name:"FloatTextView",disabled:!1,continuous_update:!1,step:.1})}}class rt extends He{constructor(){super(...arguments),this._parse_value=parseFloat,this._default_step="any"}handleKeypress(e){e.stopPropagation()}handleKeyUp(e){}}class st extends Ye{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"FloatProgressModel",_view_name:"ProgressView",orientation:"horizontal",bar_style:"",style:null})}}class ot extends f{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"ControllerButtonModel",_view_name:"ControllerButtonView",value:0,pressed:!1})}}class at extends i.DOMWidgetView{render(){this.el.classList.add("jupyter-widgets"),this.el.classList.add("widget-controller-button"),this.el.style.width="fit-content",this.support=document.createElement("div"),this.support.style.position="relative",this.support.style.margin="1px",this.support.style.width="16px",this.support.style.height="16px",this.support.style.border="1px solid black",this.support.style.background="lightgray",this.el.appendChild(this.support),this.bar=document.createElement("div"),this.bar.style.position="absolute",this.bar.style.width="100%",this.bar.style.bottom="0px",this.bar.style.background="gray",this.support.appendChild(this.bar),this.update(),this.label=document.createElement("div"),this.label.textContent=this.model.get("description"),this.label.style.textAlign="center",this.el.appendChild(this.label)}update(){this.bar.style.height=100*this.model.get("value")+"%"}}class lt extends f{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"ControllerAxisModel",_view_name:"ControllerAxisView",value:0})}}class ut extends i.DOMWidgetView{render(){this.el.classList.add("jupyter-widgets"),this.el.classList.add("widget-controller-axis"),this.el.style.width="16px",this.el.style.padding="4px",this.support=document.createElement("div"),this.support.style.position="relative",this.support.style.margin="1px",this.support.style.width="4px",this.support.style.height="64px",this.support.style.border="1px solid black",this.support.style.background="lightgray",this.bullet=document.createElement("div"),this.bullet.style.position="absolute",this.bullet.style.margin="-3px",this.bullet.style.boxSizing="unset",this.bullet.style.width="10px",this.bullet.style.height="10px",this.bullet.style.background="gray",this.label=document.createElement("div"),this.label.textContent=this.model.get("description"),this.label.style.textAlign="center",this.support.appendChild(this.bullet),this.el.appendChild(this.support),this.el.appendChild(this.label),this.update()}update(){this.bullet.style.top=50*(this.model.get("value")+1)+"%"}}class dt extends f{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"ControllerModel",_view_name:"ControllerView",index:0,name:"",mapping:"",connected:!1,timestamp:0,buttons:[],axes:[]})}initialize(e,t){super.initialize(e,t),void 0===navigator.getGamepads?(this.readout="This browser does not support gamepads.",console.error(this.readout)):(this.readout="Connect gamepad and press any button.",this.get("connected")?this.update_loop():this.wait_loop())}wait_loop(){const e=this.get("index"),t=navigator.getGamepads()[e];t?this.setup(t).then((e=>{this.set(e),this.save_changes(),window.requestAnimationFrame(this.update_loop.bind(this))})):window.requestAnimationFrame(this.wait_loop.bind(this))}setup(e){return this.set({name:e.id,mapping:e.mapping,connected:e.connected,timestamp:e.timestamp}),i.resolvePromisesDict({buttons:Promise.all(e.buttons.map(((e,t)=>this._create_button_model(t)))),axes:Promise.all(e.axes.map(((e,t)=>this._create_axis_model(t))))})}update_loop(){const e=this.get("index"),t=this.get("name"),n=navigator.getGamepads()[e];n&&e===n.index&&t===n.id?(this.set({timestamp:n.timestamp,connected:n.connected}),this.save_changes(),this.get("buttons").forEach((function(e,t){e.set({value:n.buttons[t].value,pressed:n.buttons[t].pressed}),e.save_changes()})),this.get("axes").forEach((function(e,t){e.set("value",n.axes[t]),e.save_changes()})),window.requestAnimationFrame(this.update_loop.bind(this))):this.reset_gamepad()}reset_gamepad(){this.get("buttons").forEach((function(e){e.close()})),this.get("axes").forEach((function(e){e.close()})),this.set({name:"",mapping:"",connected:!1,timestamp:0,buttons:[],axes:[]}),this.save_changes(),window.requestAnimationFrame(this.wait_loop.bind(this))}_create_button_model(e){return this.widget_manager.new_widget({model_name:"ControllerButtonModel",model_module:"@jupyter-widgets/controls",model_module_version:this.get("_model_module_version"),view_name:"ControllerButtonView",view_module:"@jupyter-widgets/controls",view_module_version:this.get("_view_module_version")}).then((function(t){return t.set("description",e),t}))}_create_axis_model(e){return this.widget_manager.new_widget({model_name:"ControllerAxisModel",model_module:"@jupyter-widgets/controls",model_module_version:this.get("_model_module_version"),view_name:"ControllerAxisView",view_module:"@jupyter-widgets/controls",view_module_version:this.get("_view_module_version")}).then((function(t){return t.set("description",e),t}))}}dt.serializers=Object.assign(Object.assign({},f.serializers),{buttons:{deserialize:i.unpack_models},axes:{deserialize:i.unpack_models}});class ct extends i.DOMWidgetView{_createElement(e){return this.luminoWidget=new i.JupyterLuminoPanelWidget({view:this}),this.luminoWidget.node}_setElement(e){if(this.el||e!==this.luminoWidget.node)throw new Error("Cannot reset the DOM element.");this.el=this.luminoWidget.node,this.$el=I()(this.luminoWidget.node)}initialize(e){super.initialize(e),this.button_views=new i.ViewList(this.add_button,null,this),this.listenTo(this.model,"change:buttons",((e,t)=>{this.button_views.update(t)})),this.axis_views=new i.ViewList(this.add_axis,null,this),this.listenTo(this.model,"change:axes",((e,t)=>{this.axis_views.update(t)})),this.listenTo(this.model,"change:name",this.update_label)}render(){this.el.classList.add("jupyter-widgets"),this.el.classList.add("widget-controller"),this.label=document.createElement("div"),this.el.appendChild(this.label),this.axis_box=new j.Zk,this.axis_box.node.style.display="flex",this.luminoWidget.addWidget(this.axis_box),this.button_box=new j.Zk,this.button_box.node.style.display="flex",this.luminoWidget.addWidget(this.button_box),this.button_views.update(this.model.get("buttons")),this.axis_views.update(this.model.get("axes")),this.update_label()}update_label(){this.label.textContent=this.model.get("name")||this.model.readout}add_button(e){const t=new j.x0;return this.button_box.addWidget(t),this.create_child_view(e).then((e=>{const n=k.Rw.firstIndexOf(this.button_box.widgets,t);return this.button_box.insertWidget(n,e.luminoWidget),t.dispose(),e})).catch((0,i.reject)("Could not add child button view to controller",!0))}add_axis(e){const t=new j.x0;return this.axis_box.addWidget(t),this.create_child_view(e).then((e=>{const n=k.Rw.firstIndexOf(this.axis_box.widgets,t);return this.axis_box.insertWidget(n,e.luminoWidget),t.dispose(),e})).catch((0,i.reject)("Could not add child axis view to controller",!0))}remove(){super.remove(),this.button_views.remove(),this.axis_views.remove()}}class ht extends g{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"SelectionModel",index:"",_options_labels:[],disabled:!1})}}class pt extends d{render(){super.render(),this.el.classList.add("jupyter-widgets"),this.el.classList.add("widget-inline-hbox")}update(){super.update(),this.listbox&&(this.listbox.disabled=this.model.get("disabled")),this.updateTabindex(),this.updateTooltip()}updateTabindex(){if(!this.listbox)return;const e=this.model.get("tabbable");!0===e?this.listbox.setAttribute("tabIndex","0"):!1===e?this.listbox.setAttribute("tabIndex","-1"):null===e&&this.listbox.removeAttribute("tabIndex")}updateTooltip(){if(!this.listbox)return;const e=this.model.get("tooltip");e?0===this.model.get("description").length&&this.listbox.setAttribute("title",e):this.listbox.removeAttribute("title")}}class ft extends ht{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"DropdownModel",_view_name:"DropdownView",button_style:""})}}class gt extends pt{render(){super.render(),this.el.classList.add("widget-dropdown"),this.listbox=document.createElement("select"),this.listbox.id=this.label.htmlFor=(0,i.uuid)(),this.el.appendChild(this.listbox),this._updateOptions(),this.update()}update(e){(null==e?void 0:e.updated_view)!==this&&this.model.hasChanged("_options_labels")&&this._updateOptions();const t=this.model.get("index");return this.listbox.selectedIndex=null===t?-1:t,super.update()}_updateOptions(){this.listbox.textContent="";const e=this.model.get("_options_labels");for(let t=0;te.value));let i=t.length!==n.length;if(!i)for(let e=0,r=t.length;e{const n=document.createElement("label");n.textContent=e,this.container.appendChild(n);const i=document.createElement("input");i.setAttribute("type","radio"),i.value=t.toString(),i.setAttribute("data-value",encodeURIComponent(e)),n.appendChild(i)}))),t.forEach(((e,t)=>{const n='input[data-value="'+encodeURIComponent(e)+'"]',i=this.container.querySelectorAll(n);if(i.length>0){const e=i[0];e.checked=this.model.get("index")===t,e.disabled=this.model.get("disabled")}})),setTimeout(this.adjustPadding,0,this),super.update(e)}adjustPadding(e){const t=window.getComputedStyle(e.el),n=parseInt(t.marginTop,10)+parseInt(t.marginBottom,10),i=e.label.offsetHeight+n,r=window.getComputedStyle(e.container),s=parseInt(r.marginBottom,10),o=(e.el.offsetHeight+n-s)%i,a=0===o?0:i-o;e.container.style.marginBottom=a+"px"}events(){return{'click input[type="radio"]':"_handle_click"}}_handle_click(e){const t=e.target;this.model.set("index",parseInt(t.value,10),{updated_view:this}),this.touch()}handle_message(e){if("focus"==e.do)this.container.firstElementChild.focus();else if("blur"==e.do)for(let e=0;ee.value));let d=!1;for(let e=0,r=t.length;e{let i;i=0!==e.trim().length||n[t]&&0!==n[t].trim().length?s(e):" ";const l=document.createElement("i"),u=document.createElement("button");n[t]&&(l.className="fa fa-"+n[t]),u.setAttribute("type","button"),u.className="widget-toggle-button jupyter-button",r&&u.classList.add(r),u.innerHTML=i,u.setAttribute("data-value",encodeURIComponent(e)),u.setAttribute("value",t.toString()),u.appendChild(l),u.disabled=a,o[t]&&u.setAttribute("title",o[t]),this.update_style_traits(u),this.buttongroup.appendChild(u)}))),t.forEach(((e,t)=>{const n='[data-value="'+encodeURIComponent(e)+'"]',i=this.buttongroup.querySelector(n);this.model.get("index")===t?i.classList.add("mod-active"):i.classList.remove("mod-active")})),this.stylePromise.then((function(e){e&&e.style()})),super.update(e)}update_style_traits(e){for(const t in this._css_state)if(Object.prototype.hasOwnProperty.call(this._css_state,"name"))if("margin"===t)this.buttongroup.style[t]=this._css_state[t];else if("width"!==t)if(e)e.style[t]=this._css_state[t];else{const e=this.buttongroup.querySelectorAll("button");e.length&&(e[0].style[t]=this._css_state[t])}}update_button_style(){const e=this.buttongroup.querySelectorAll("button");for(let t=0;tNumber(e),to:e=>Math.round(e)}}),this.$slider.noUiSlider.on("update",((e,t)=>{this.handleSliderUpdateEvent(e,t)})),this.$slider.noUiSlider.on("change",((e,t)=>{this.handleSliderChangeEvent(e,t)}))}events(){return{slide:"handleSliderChange",slidestop:"handleSliderChanged"}}updateSelection(){const e=this.model.get("index");this.updateReadout(e)}updateReadout(e){const t=this.model.get("_options_labels")[e];this.readout.textContent=t}handleSliderUpdateEvent(e,t){const n=e[0];this.updateReadout(n),this.model.get("continuous_update")&&this.handleSliderChanged(e,t)}handleSliderChangeEvent(e,t){const n=e[0];this.updateReadout(n),this.handleSliderChanged(e,t)}handleSliderChanged(e,t){const n=e[0];this.updateReadout(n),this.model.set("index",n,{updated_view:this}),this.touch()}updateSliderOptions(e){const t=this.model.get("_options_labels").length-1;this.$slider.noUiSlider.updateOptions({start:this.model.get("index"),range:{min:0,max:t},step:1})}updateSliderValue(e,t,n){if(n.updated_view===this)return;const i=this.$slider.noUiSlider.get(),r=this.model.get("index");i!==r&&this.$slider.noUiSlider.set(r)}}class xt extends ht{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"MultipleSelectionModel"})}}class Dt extends xt{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"SelectMultipleModel",_view_name:"SelectMultipleView",rows:null})}}class St extends vt{initialize(e){super.initialize(e),this.listbox.multiple=!0}render(){super.render(),this.el.classList.add("widget-select-multiple")}updateSelection(){const e=this.model.get("index")||[],t=this.listbox.options;this.listbox.selectedIndex=-1,e.forEach((e=>{t[e].selected=!0}))}_handle_change(){const e=Array.prototype.map.call(this.listbox.selectedOptions||[],(function(e){return e.index}));this.model.set("index",e,{updated_view:this}),this.touch()}}class Tt extends xt{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"SelectionSliderModel",_view_name:"SelectionSliderView",orientation:"horizontal",readout:!0,continuous_update:!0})}}class Bt extends Ct{render(){super.render()}updateSelection(e){e=e||this.model.get("index"),this.updateReadout(e)}updateReadout(e){const t=this.model.get("_options_labels"),n=t[e[0]],i=t[e[1]];this.readout.textContent=`${n}-${i}`}handleSliderUpdateEvent(e,t){const n=e.map(Math.trunc);this.updateReadout(n),this.model.get("continuous_update")&&this.handleSliderChanged(e,t)}handleSliderChanged(e,t){const n=e.map(Math.round);this.updateReadout(n),this.model.set("index",n.slice(),{updated_view:this}),this.touch()}updateSliderValue(e,t,n){if(n.updated_view===this)return;const i=this.$slider.noUiSlider.get().map(Math.round),r=this.model.get("index").map(Math.round);i[0]===r[0]&&i[1]===r[1]||this.$slider.noUiSlider.set(r)}}var kt,Mt,jt,Ot,It,Pt=n(8571);!function(e){e.copyText=function(e){var t=document.body,n=function(i){i.preventDefault(),i.stopPropagation(),i.clipboardData.setData("text",e),t.removeEventListener("copy",n,!0)};t.addEventListener("copy",n,!0),document.execCommand("copy")}}(kt||(kt={})),function(e){e.boxSizing=function(e){var t=window.getComputedStyle(e),n=parseFloat(t.borderTopWidth)||0,i=parseFloat(t.borderLeftWidth)||0,r=parseFloat(t.borderRightWidth)||0,s=parseFloat(t.borderBottomWidth)||0,o=parseFloat(t.paddingTop)||0,a=parseFloat(t.paddingLeft)||0,l=parseFloat(t.paddingRight)||0,u=parseFloat(t.paddingBottom)||0;return{borderTop:n,borderLeft:i,borderRight:r,borderBottom:s,paddingTop:o,paddingLeft:a,paddingRight:l,paddingBottom:u,horizontalSum:i+a+l+r,verticalSum:n+o+u+s}},e.sizeLimits=function(e){var t=window.getComputedStyle(e),n=parseFloat(t.minWidth)||0,i=parseFloat(t.minHeight)||0,r=parseFloat(t.maxWidth)||1/0,s=parseFloat(t.maxHeight)||1/0;return{minWidth:n,minHeight:i,maxWidth:r=Math.max(n,r),maxHeight:s=Math.max(i,s)}},e.hitTest=function(e,t,n){var i=e.getBoundingClientRect();return t>=i.left&&t=i.top&&n=n.bottom||(i.topn.bottom&&i.height>=n.height?e.scrollTop-=n.top-i.top:(i.topn.height||i.bottom>n.bottom&&i.height0;)if(h(n))t++;else if(h(i))d++;else if(h(r))d++;else if(h(o))c++;else if(h(a))d++;else if(h(s))c++;else if(!h(l))return 0;return(t=Math.min(t,255))<<16|(d=Math.min(d,255))<<8|Math.min(c,255)};var n=/^#[^\s\+>~#\.\[:]+/,i=/^\.[^\s\+>~#\.\[:]+/,r=/^\[[^\]]+\]/,s=/^[^\s\+>~#\.\[:]+/,o=/^(::[^\s\+>~#\.\[:]+|:first-line|:first-letter|:before|:after)/,a=/^:[^\s\+>~#\.\[:]+/,l=/^[\s\+>~\*]+/,u=/:not\(([^\)]+)\)/g}(It||(It={}));class Rt extends j.Zk{constructor(){super(...arguments),this._widgetRemoved=new Pt.Signal(this)}get widgetRemoved(){return this._widgetRemoved}onChildRemoved(e){this._widgetRemoved.emit(e.child)}}class Lt extends j.x0{constructor(e={}){super(),this._currentChanged=new Pt.Signal(this),this.addClass("jupyter-widget-TabPanel"),this.tabBar=new j.VQ(e),this.tabBar.addClass("jupyter-widget-TabPanel-tabBar"),this.tabContents=new Rt,this.tabContents.addClass("jupyter-widget-TabPanel-tabContents"),this.tabBar.tabMoved.connect(this._onTabMoved,this),this.tabBar.currentChanged.connect(this._onCurrentChanged,this),this.tabBar.tabCloseRequested.connect(this._onTabCloseRequested,this),this.tabBar.tabActivateRequested.connect(this._onTabActivateRequested,this),this.tabContents.widgetRemoved.connect(this._onWidgetRemoved,this);const t=new j.DG;t.addWidget(this.tabBar),t.addWidget(this.tabContents),this.layout=t}get currentChanged(){return this._currentChanged}get currentIndex(){const e=this.tabBar.currentIndex;return-1===e?null:e}set currentIndex(e){this.tabBar.currentIndex=null===e?-1:e}get currentWidget(){const e=this.tabBar.currentTitle;return e?e.owner:null}set currentWidget(e){this.tabBar.currentTitle=e?e.title:null}get tabsMovable(){return this.tabBar.tabsMovable}set tabsMovable(e){this.tabBar.tabsMovable=e}get widgets(){return this.tabContents.widgets}addWidget(e){this.insertWidget(this.widgets.length,e)}insertWidget(e,t){t!==this.currentWidget&&t.hide(),this.tabContents.insertWidget(e,t),this.tabBar.insertTab(e,t.title)}_onCurrentChanged(e,t){const{previousIndex:n,previousTitle:i,currentIndex:r,currentTitle:s}=t,o=i?i.owner:null,a=s?s.owner:null;o&&o.hide(),a&&a.show(),this._currentChanged.emit({previousIndex:n,previousWidget:o,currentIndex:r,currentWidget:a}),(jt.IS_EDGE||jt.IS_IE)&&M.Mu.flush()}_onTabActivateRequested(e,t){t.title.owner.activate()}_onTabCloseRequested(e,t){t.title.owner.close()}_onTabMoved(e,t){this.tabContents.insertWidget(t.toIndex,t.title.owner)}_onWidgetRemoved(e,t){this.tabBar.removeTab(t.title)}}class Nt{constructor(e,t={}){this._array=null,this._value=null,this._previousValue=null,this._selectionChanged=new Pt.Signal(this),this._array=e,this._insertBehavior=t.insertBehavior||"select-item-if-needed",this._removeBehavior=t.removeBehavior||"select-item-after"}get selectionChanged(){return this._selectionChanged}adjustSelectionForSet(e){const t=this.index,n=this.value;if(e!==t)return;this._updateSelectedValue();const i=this.value;this._previousValue=null,n!==i&&this._selectionChanged.emit({previousIndex:t,previousValue:n,currentIndex:t,currentValue:i})}get value(){return this._value}set value(e){null===e||null===this._array?this.index=null:this.index=k.Rw.firstIndexOf(this._array,e)}get index(){return this._index}set index(e){let t;if(null!==e&&null!==this._array?(t=Math.floor(e),(t<0||t>=this._array.length)&&(t=null)):t=null,this._index===t)return;const n=this._index,i=this._value;this._index=t,this._updateSelectedValue(),this._previousValue=i,this._selectionChanged.emit({previousIndex:n,previousValue:i,currentIndex:t,currentValue:this._value})}get insertBehavior(){return this._insertBehavior}set insertBehavior(e){this._insertBehavior=e}get removeBehavior(){return this._removeBehavior}set removeBehavior(e){this._removeBehavior=e}adjustSelectionForInsert(e,t){const n=this._value,i=this._index,r=this._insertBehavior;if("select-item"===r||"select-item-if-needed"===r&&null===i)return this._index=e,this._value=t,this._previousValue=n,void this._selectionChanged.emit({previousIndex:i,previousValue:n,currentIndex:e,currentValue:t});null!==i&&i>=e&&this._index++}clearSelection(){const e=this._index,t=this._value;this._index=null,this._value=null,this._previousValue=null,null!==e&&this._selectionChanged.emit({previousIndex:e,previousValue:t,currentIndex:this._index,currentValue:this._value})}adjustSelectionForRemove(e,t){if(null===this._index)return;const n=this._index,i=this._removeBehavior;if(n===e){if(!this._array||0===this._array.length)return this._index=null,this._value=null,this._previousValue=null,void this._selectionChanged.emit({previousIndex:e,previousValue:t,currentIndex:this._index,currentValue:this._value});if("select-item-after"===i)return this._index=Math.min(e,this._array.length-1),this._updateSelectedValue(),this._previousValue=null,void this._selectionChanged.emit({previousIndex:e,previousValue:t,currentIndex:this._index,currentValue:this._value});if("select-item-before"===i)return this._index=Math.max(0,e-1),this._updateSelectedValue(),this._previousValue=null,void this._selectionChanged.emit({previousIndex:e,previousValue:t,currentIndex:this._index,currentValue:this._value});if("select-previous-item"===i)return this._previousValue?this.value=this._previousValue:(this._index=Math.min(e,this._array.length-1),this._updateSelectedValue()),this._previousValue=null,void this._selectionChanged.emit({previousIndex:e,previousValue:t,currentIndex:this._index,currentValue:this.value});this._index=null,this._value=null,this._previousValue=null,this._selectionChanged.emit({previousIndex:e,previousValue:t,currentIndex:this._index,currentValue:this._value})}else n>e&&this._index--}_updateSelectedValue(){const e=this._index;this._value=null!==e&&this._array?this._array[e]:null}}const Ft="jupyter-widget-Collapse-open";class zt extends j.x0{constructor(e){super(e),this._collapseChanged=new Pt.Signal(this),this.addClass("jupyter-widget-Collapse"),this._header=new j.x0,this._header.addClass("jupyter-widget-Collapse-header"),this._header.node.addEventListener("click",this);const t=document.createElement("i");t.classList.add("fa","fa-fw","fa-caret-right"),this._header.node.appendChild(t),this._header.node.appendChild(document.createElement("span")),this._content=new j.Zk,this._content.addClass("jupyter-widget-Collapse-contents");const n=new j.DG;this.layout=n,n.addWidget(this._header),n.addWidget(this._content),e.widget&&(this.widget=e.widget),this.collapsed=!1}dispose(){this.isDisposed||(super.dispose(),this._header=null,this._widget=null,this._content=null)}get widget(){return this._widget}set widget(e){const t=this._widget;t&&(t.disposed.disconnect(this._onChildDisposed,this),t.title.changed.disconnect(this._onTitleChanged,this),t.parent=null),this._widget=e,e.disposed.connect(this._onChildDisposed,this),e.title.changed.connect(this._onTitleChanged,this),this._onTitleChanged(e.title),this._content.addWidget(e)}get collapsed(){return this._collapsed}set collapsed(e){e!==this._collapsed&&(e?this._collapse():this._uncollapse())}toggle(){this.collapsed=!this.collapsed}get collapseChanged(){return this._collapseChanged}_collapse(){this._collapsed=!0,this._content&&this._content.hide(),this.removeClass(Ft),this._header.node.children[0].classList.add("fa-caret-right"),this._header.node.children[0].classList.remove("fa-caret-down"),this._collapseChanged.emit(void 0)}_uncollapse(){this._collapsed=!1,this._content&&this._content.show(),this.addClass(Ft),this._header.node.children[0].classList.add("fa-caret-down"),this._header.node.children[0].classList.remove("fa-caret-right"),this._collapseChanged.emit(void 0)}handleEvent(e){"click"===e.type&&this._evtClick(e)}_evtClick(e){this.toggle()}_onTitleChanged(e){this._header.node.children[1].textContent=this._widget.title.label}_onChildDisposed(e){this.dispose()}}const Ut="jupyter-widget-Accordion-child-active";class Ht extends j.Zk{constructor(e){super(e),this._selection=new Nt(this.widgets),this._selection.selectionChanged.connect(this._onSelectionChanged,this),this.addClass("jupyter-widget-Accordion")}get collapseWidgets(){return this.layout.widgets}get selection(){return this._selection}indexOf(e){return k.Rw.findFirstIndex(this.collapseWidgets,(t=>t.widget===e))}addWidget(e){const t=this._wrapWidget(e);return t.collapsed=!0,super.addWidget(t),this._selection.adjustSelectionForInsert(this.widgets.length-1,t),t}insertWidget(e,t){const n=this._wrapWidget(t);n.collapsed=!0,super.insertWidget(e,n),this._selection.adjustSelectionForInsert(e,n)}removeWidget(e){const t=this.indexOf(e);if(t>=0){const n=this.collapseWidgets[t];e.parent=null,n.dispose(),this._selection.adjustSelectionForRemove(t,null)}}_wrapWidget(e){const t=new zt({widget:e});return t.addClass("jupyter-widget-Accordion-child"),t.collapseChanged.connect(this._onCollapseChange,this),t}_onCollapseChange(e){e.collapsed?this._selection.value===e&&e.collapsed&&(this._selection.value=null):this._selection.value=e}_onSelectionChanged(e,t){const n=t.previousValue,i=t.currentValue;n&&(n.collapsed=!0,n.removeClass(Ut)),i&&(i.collapsed=!1,i.addClass(Ut))}}class Wt extends P{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"SelectionContainerModel",selected_index:null,titles:[]})}}class qt extends Wt{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"AccordionModel",_view_name:"AccordionView"})}}class $t extends Ht{constructor(e){const t=e.view;delete e.view,super(e),this._view=t}processMessage(e){var t;super.processMessage(e),null===(t=this._view)||void 0===t||t.processLuminoMessage(e)}dispose(){this.isDisposed||(super.dispose(),this._view.remove(),this._view=null)}}class Vt extends i.DOMWidgetView{_createElement(e){return this.luminoWidget=new $t({view:this}),this.luminoWidget.node}_setElement(e){if(this.el||e!==this.luminoWidget.node)throw new Error("Cannot reset the DOM element.");this.el=this.luminoWidget.node,this.$el=I()(this.luminoWidget.node)}initialize(e){super.initialize(e),this.children_views=new i.ViewList(this.add_child_view,this.remove_child_view,this),this.listenTo(this.model,"change:children",(()=>this.updateChildren())),this.listenTo(this.model,"change:selected_index",(()=>this.update_selected_index())),this.listenTo(this.model,"change:titles",(()=>this.update_titles()))}render(){var e;super.render();const t=this.luminoWidget;t.addClass("jupyter-widgets"),t.addClass("widget-accordion"),t.addClass("widget-container"),t.selection.selectionChanged.connect((e=>{this.updatingChildren||(this.model.set("selected_index",t.selection.index),this.touch())})),null===(e=this.children_views)||void 0===e||e.update(this.model.get("children")),this.update_titles(),this.update_selected_index()}updateChildren(){var e;this.updatingChildren=!0,this.luminoWidget.selection.index=null,null===(e=this.children_views)||void 0===e||e.update(this.model.get("children")),this.update_selected_index(),this.updatingChildren=!1}update_titles(){const e=this.luminoWidget.collapseWidgets,t=this.model.get("titles");for(let n=0;n{const t=e.luminoWidget;return t.title.label=r.title.label,n.collapseWidgets[n.indexOf(r)].widget=t,r.dispose(),e})).catch((0,i.reject)("Could not add child view to box",!0))}remove(){this.children_views=null,super.remove()}}class Gt extends Wt{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"TabModel",_view_name:"TabView"})}}class Kt extends Lt{constructor(e){const t=e.view;delete e.view,super(e),this._view=t,M.Mu.installMessageHook(this.tabContents,((e,t)=>(this._view.processLuminoMessage(t),!0)))}dispose(){this.isDisposed||(super.dispose(),this._view.remove(),this._view=null)}}class Yt extends i.DOMWidgetView{constructor(){super(...arguments),this.updatingTabs=!1}_createElement(e){return this.luminoWidget=new Kt({view:this}),this.luminoWidget.node}_setElement(e){if(this.el||e!==this.luminoWidget.node)throw new Error("Cannot reset the DOM element.");this.el=this.luminoWidget.node,this.$el=I()(this.luminoWidget.node)}initialize(e){super.initialize(e),this.childrenViews=new i.ViewList(this.addChildView,(e=>{e.remove()}),this),this.listenTo(this.model,"change:children",(()=>this.updateTabs())),this.listenTo(this.model,"change:titles",(()=>this.updateTitles()))}render(){super.render();const e=this.luminoWidget;e.addClass("jupyter-widgets"),e.addClass("widget-container"),e.addClass("jupyter-widget-tab"),e.addClass("widget-tab"),e.tabsMovable=!0,e.tabBar.insertBehavior="none",e.tabBar.currentChanged.connect(this._onTabChanged,this),e.tabBar.tabMoved.connect(this._onTabMoved,this),e.tabBar.addClass("widget-tab-bar"),e.tabContents.addClass("widget-tab-contents"),e.tabBar.tabsMovable=!1,this.updateTabs(),this.update()}updateTabs(){var e;this.updatingTabs=!0,this.luminoWidget.currentIndex=null,null===(e=this.childrenViews)||void 0===e||e.update(this.model.get("children")),this.luminoWidget.currentIndex=this.model.get("selected_index"),this.updatingTabs=!1}addChildView(e,t){const n=this.model.get("titles")[t]||"",r=this.luminoWidget,s=new j.x0;return s.title.label=n,r.addWidget(s),this.create_child_view(e).then((e=>{const t=e.luminoWidget;t.title.label=s.title.label,t.title.closable=!1;const n=k.Rw.firstIndexOf(r.widgets,s);return r.insertWidget(n+1,t),s.dispose(),e})).catch((0,i.reject)("Could not add child view to box",!0))}update(){return this.updateSelectedIndex(),super.update()}updateTitles(){const e=this.model.get("titles")||[];(0,k.__)(this.luminoWidget.widgets,((t,n)=>{t.title.label=e[n]||""}))}updateSelectedIndex(){this.luminoWidget.currentIndex=this.model.get("selected_index")}remove(){this.childrenViews=null,super.remove()}_onTabChanged(e,t){if(!this.updatingTabs){const e=t.currentIndex;this.model.set("selected_index",-1===e?null:e),this.touch()}}_onTabMoved(e,t){const n=this.model.get("children").slice();k.Rw.move(n,t.fromIndex,t.toIndex),this.model.set("children",n),this.touch()}}class Jt extends Wt{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"StackModel",_view_name:"StackView"})}}class Xt extends N{initialize(e){super.initialize(e),this.listenTo(this.model,"change:selected_index",this.update_children)}update_children(){var e;let t;t=null===this.model.get("selected_index")?[]:[this.model.get("children")[this.model.get("selected_index")]],null===(e=this.children_views)||void 0===e||e.update(t).then((e=>{e.forEach((e=>{M.Mu.postMessage(e.luminoWidget,j.x0.ResizeMessage.UnknownSize)}))}))}}function Zt(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Qt(e,t){var n=Object.create(e.prototype);for(var i in t)n[i]=t[i];return n}function en(){}var tn=.7,nn=1/tn,rn="\\s*([+-]?\\d+)\\s*",sn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",on="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",an=/^#([0-9a-f]{3,8})$/,ln=new RegExp(`^rgb\\(${rn},${rn},${rn}\\)$`),un=new RegExp(`^rgb\\(${on},${on},${on}\\)$`),dn=new RegExp(`^rgba\\(${rn},${rn},${rn},${sn}\\)$`),cn=new RegExp(`^rgba\\(${on},${on},${on},${sn}\\)$`),hn=new RegExp(`^hsl\\(${sn},${on},${on}\\)$`),pn=new RegExp(`^hsla\\(${sn},${on},${on},${sn}\\)$`),fn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function gn(){return this.rgb().formatHex()}function mn(){return this.rgb().formatRgb()}function vn(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=an.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?bn(t):3===n?new yn(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?An(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?An(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=ln.exec(e))?new yn(t[1],t[2],t[3],1):(t=un.exec(e))?new yn(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=dn.exec(e))?An(t[1],t[2],t[3],t[4]):(t=cn.exec(e))?An(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=hn.exec(e))?Dn(t[1],t[2]/100,t[3]/100,1):(t=pn.exec(e))?Dn(t[1],t[2]/100,t[3]/100,t[4]):fn.hasOwnProperty(e)?bn(fn[e]):"transparent"===e?new yn(NaN,NaN,NaN,0):null}function bn(e){return new yn(e>>16&255,e>>8&255,255&e,1)}function An(e,t,n,i){return i<=0&&(e=t=n=NaN),new yn(e,t,n,i)}function yn(e,t,n,i){this.r=+e,this.g=+t,this.b=+n,this.opacity=+i}function wn(){return`#${xn(this.r)}${xn(this.g)}${xn(this.b)}`}function _n(){const e=En(this.opacity);return`${1===e?"rgb(":"rgba("}${Cn(this.r)}, ${Cn(this.g)}, ${Cn(this.b)}${1===e?")":`, ${e})`}`}function En(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Cn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function xn(e){return((e=Cn(e))<16?"0":"")+e.toString(16)}function Dn(e,t,n,i){return i<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Tn(e,t,n,i)}function Sn(e){if(e instanceof Tn)return new Tn(e.h,e.s,e.l,e.opacity);if(e instanceof en||(e=vn(e)),!e)return new Tn;if(e instanceof Tn)return e;var t=(e=e.rgb()).r/255,n=e.g/255,i=e.b/255,r=Math.min(t,n,i),s=Math.max(t,n,i),o=NaN,a=s-r,l=(s+r)/2;return a?(o=t===s?(n-i)/a+6*(n0&&l<1?0:o,new Tn(o,a,l,e.opacity)}function Tn(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}function Bn(e){return(e=(e||0)%360)<0?e+360:e}function kn(e){return Math.max(0,Math.min(1,e||0))}function Mn(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}function jn(e){for(;e.firstChild;)e.removeChild(e.firstChild)}Zt(en,vn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:gn,formatHex:gn,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Sn(this).formatHsl()},formatRgb:mn,toString:mn}),Zt(yn,(function(e,t,n,i){return 1===arguments.length?((r=e)instanceof en||(r=vn(r)),r?new yn((r=r.rgb()).r,r.g,r.b,r.opacity):new yn):new yn(e,t,n,null==i?1:i);var r}),Qt(en,{brighter(e){return e=null==e?nn:Math.pow(nn,e),new yn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?tn:Math.pow(tn,e),new yn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new yn(Cn(this.r),Cn(this.g),Cn(this.b),En(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:wn,formatHex:wn,formatHex8:function(){return`#${xn(this.r)}${xn(this.g)}${xn(this.b)}${xn(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:_n,toString:_n})),Zt(Tn,(function(e,t,n,i){return 1===arguments.length?Sn(e):new Tn(e,t,n,null==i?1:i)}),Qt(en,{brighter(e){return e=null==e?nn:Math.pow(nn,e),new Tn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?tn:Math.pow(tn,e),new Tn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*t,r=2*n-i;return new yn(Mn(e>=240?e-240:e+120,r,i),Mn(e,r,i),Mn(e<120?e+240:e-120,r,i),this.opacity)},clamp(){return new Tn(Bn(this.h),kn(this.s),kn(this.l),En(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=En(this.opacity);return`${1===e?"hsl(":"hsla("}${Bn(this.h)}, ${100*kn(this.s)}%, ${100*kn(this.l)}%${1===e?")":`, ${e})`}`}}));class On{constructor(e,t,n){this.start=e,this.dx=t,this.max=n}isSelected(e){let t,n;return this.dx>=0?(t=this.start,n=this.start+this.dx):(t=this.start+this.dx,n=this.start),t<=e&&ethis.max&&(this.dx=this.max-this.start),this.start+this.dx<0&&(this.dx=-this.start)}}class In extends f{defaults(){return Object.assign(Object.assign({},super.defaults()),{value:[],placeholder:"​",allowed_tags:null,allow_duplicates:!0})}}class Pn extends i.DOMWidgetView{constructor(){super(...arguments),this.hoveredTag=null,this.hoveredTagIndex=null}render(){super.render(),this.el.classList.add("jupyter-widgets"),this.el.classList.add("jupyter-widget-tagsinput"),this.taginputWrapper=document.createElement("div"),this.model.get("value").length?this.taginputWrapper.style.display="none":this.taginputWrapper.style.display="inline-block",this.datalistID=(0,i.uuid)(),this.taginput=document.createElement("input"),this.taginput.classList.add("jupyter-widget-tag"),this.taginput.classList.add("jupyter-widget-taginput"),this.taginput.setAttribute("list",this.datalistID),this.taginput.setAttribute("type","text"),this.autocompleteList=document.createElement("datalist"),this.autocompleteList.id=this.datalistID,this.updateAutocomplete(),this.model.on("change:allowed_tags",this.updateAutocomplete.bind(this)),this.updatePlaceholder(),this.model.on("change:placeholder",this.updatePlaceholder.bind(this)),this.taginputWrapper.classList.add("widget-text"),this.taginputWrapper.appendChild(this.taginput),this.taginputWrapper.appendChild(this.autocompleteList),this.el.onclick=this.focus.bind(this),this.el.ondrop=e=>{const t=null==this.hoveredTagIndex?this.tags.length:this.hoveredTagIndex;return this.ondrop(e,t)},this.el.ondragover=this.ondragover.bind(this),this.taginput.onchange=this.handleValueAdded.bind(this),this.taginput.oninput=this.resizeInput.bind(this),this.taginput.onkeydown=this.handleKeyEvent.bind(this),this.taginput.onblur=this.loseFocus.bind(this),this.resizeInput(),this.inputIndex=this.model.get("value").length,this.selection=null,this.preventLoosingFocus=!1,this.update()}update(){this.preventLoosingFocus=!0,jn(this.el),this.tags=[];const e=this.model.get("value");this.inputIndex=e.length;for(const t in e){const n=parseInt(t),i=this.createTag(e[n],n,null!=this.selection&&this.selection.isSelected(n));i.draggable=!0,i.ondragstart=((e,t)=>n=>{this.ondragstart(n,e,t,this.model.model_id)})(n,e[n]),i.ondrop=(e=>t=>{this.ondrop(t,e)})(n),i.ondragover=this.ondragover.bind(this),i.ondragenter=(e=>t=>{this.ondragenter(t,e)})(n),i.ondragend=this.ondragend.bind(this),this.tags.push(i),this.el.appendChild(i)}return this.el.insertBefore(this.taginputWrapper,this.el.children[this.inputIndex]),this.model.get("value").length?this.taginputWrapper.style.display="none":this.taginputWrapper.style.display="inline-block",this.preventLoosingFocus=!1,super.update()}updateAutocomplete(){jn(this.autocompleteList);const e=this.model.get("allowed_tags");for(const t of e){const e=document.createElement("option");e.value=t,this.autocompleteList.appendChild(e)}}updatePlaceholder(){this.taginput.placeholder=this.model.get("placeholder"),this.resizeInput()}updateTags(){const e=this.model.get("value");for(const t in this.tags){const n=parseInt(t);this.updateTag(this.tags[n],e[n],n,null!=this.selection&&this.selection.isSelected(n))}}handleValueAdded(e){const t=this.taginput.value.replace(/^\s+|\s+$/g,""),n=this.inputIndex;""!=t&&(this.inputIndex++,this.addTag(n,t)&&(this.taginput.value="",this.resizeInput(),this.focus()))}addTag(e,t){const n=this.model.get("value");let i;try{i=this.validateValue(t)}catch(e){return!1}const r=this.model.get("allowed_tags");if(r.length&&!r.includes(i))return!1;if(!this.model.get("allow_duplicates")&&n.includes(i))return!1;this.selection=null;const s=[...n];return s.splice(e,0,i),this.model.set("value",s),this.model.save_changes(),!0}resizeInput(){let e;e=0!=this.taginput.value.length?this.taginput.value:this.model.get("placeholder");const t=e.length+1;this.taginput.setAttribute("size",String(t))}handleKeyEvent(e){const t=this.model.get("value").length;if(this.taginput.value.length)return;const n=this.inputIndex;switch(e.key){case"ArrowLeft":e.ctrlKey&&e.shiftKey&&this.select(n,-n),!e.ctrlKey&&e.shiftKey&&this.select(n,-1),e.ctrlKey?this.inputIndex=0:this.inputIndex--;break;case"ArrowRight":e.ctrlKey&&e.shiftKey&&this.select(n,t-n),!e.ctrlKey&&e.shiftKey&&this.select(n,1),e.ctrlKey?this.inputIndex=t:this.inputIndex++;break;case"Backspace":this.selection?this.removeSelectedTags():this.removeTag(this.inputIndex-1);break;case"Delete":this.selection?this.removeSelectedTags():this.removeTag(this.inputIndex);break;default:return}var i,r;e.shiftKey||(this.selection=null),this.inputIndex=(i=this.inputIndex,r=t,Math.min(Math.max(i,0),r)),this.update(),this.focus()}ondragstart(e,t,n,i){null!=e.dataTransfer&&(e.dataTransfer.setData("index",String(t)),e.dataTransfer.setData("tagValue",String(n)),e.dataTransfer.setData("origin",i))}ondrop(e,t){if(null==e.dataTransfer)return;e.preventDefault(),e.stopPropagation();const n=e.dataTransfer.getData("tagValue"),i=parseInt(e.dataTransfer.getData("index")),r=e.dataTransfer.getData("origin")==this.model.model_id;if(!isNaN(i)){if(r){const e=[...this.model.get("value")];return i=0;t--)null!=this.selection&&this.selection.isSelected(t)&&(e.splice(t,1),t()=>{this.removeTag(e),this.loseFocus()})(t),i}getTagText(e){return e}updateTag(e,t,n,i){i?e.classList.add("mod-active"):e.classList.remove("mod-active")}}Ln.class_map={primary:"mod-primary",success:"mod-success",info:"mod-info",warning:"mod-warning",danger:"mod-danger"};class Nn extends In{defaults(){return Object.assign(Object.assign({},super.defaults()),{value:[],_view_name:"ColorsInputView",_model_name:"ColorsInputModel"})}}class Fn extends Pn{createTag(e,t,n){const i=document.createElement("div"),r=e,s=vn(e).darker().toString();i.classList.add("jupyter-widget-tag"),i.classList.add("jupyter-widget-colortag"),n?(i.classList.add("mod-active"),i.style.backgroundColor=s):i.style.backgroundColor=r;const o=document.createElement("i");return o.classList.add("fa"),o.classList.add("fa-times"),o.classList.add("jupyter-widget-tag-close"),i.appendChild(o),o.onmousedown=(e=>()=>{this.removeTag(e),this.loseFocus()})(t),i}updateTag(e,t,n,i){const r=t,s=vn(t).darker().toString();i?(e.classList.add("mod-active"),e.style.backgroundColor=s):(e.classList.remove("mod-active"),e.style.backgroundColor=r)}validateValue(e){if(null==vn(e))throw e+" is not a valid Color";return e}}class zn extends Rn{defaults(){return Object.assign(Object.assign({},super.defaults()),{min:null,max:null})}}class Un extends Ln{render(){this.model.on("change:format",(()=>{this.formatter=Se(this.model.get("format")),this.update()})),this.formatter=Se(this.model.get("format")),super.render()}getTagText(e){return this.formatter(this.parseNumber(e))}validateValue(e){const t=this.parseNumber(e),n=this.model.get("min"),i=this.model.get("max");if(isNaN(t)||null!=n&&ti)throw e+" is not a valid number, it should be in the range ["+n+", "+i+"]";return t}}class Hn extends zn{defaults(){return Object.assign(Object.assign({},super.defaults()),{_view_name:"FloatsInputView",_model_name:"FloatsInputModel",format:".1f"})}}class Wn extends Un{parseNumber(e){return parseFloat(e)}}class qn extends zn{defaults(){return Object.assign(Object.assign({},super.defaults()),{_view_name:"IntsInputView",_model_name:"IntsInputModel",format:"d"})}}class $n extends Un{parseNumber(e){const t=parseInt(e);if(t!=parseFloat(e))throw e+" should be an integer";return t}}class Vn extends l{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"StringStyleModel",_model_module:"@jupyter-widgets/controls",_model_module_version:a.A})}}Vn.styleProperties=Object.assign(Object.assign({},l.styleProperties),{background:{selector:"",attribute:"background",default:null},font_size:{selector:"",attribute:"font-size",default:""},text_color:{selector:"",attribute:"color",default:""}});class Gn extends Vn{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"HTMLStyleModel",_model_module:"@jupyter-widgets/controls",_model_module_version:a.A})}}Gn.styleProperties=Object.assign({},Vn.styleProperties);class Kn extends Vn{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"HTMLMathStyleModel",_model_module:"@jupyter-widgets/controls",_model_module_version:a.A})}}Kn.styleProperties=Object.assign({},Vn.styleProperties);class Yn extends Vn{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"LabelStyleModel",_model_module:"@jupyter-widgets/controls",_model_module_version:a.A})}}Yn.styleProperties=Object.assign(Object.assign({},Vn.styleProperties),{font_family:{selector:"",attribute:"font-family",default:""},font_style:{selector:"",attribute:"font-style",default:""},font_variant:{selector:"",attribute:"font-variant",default:""},font_weight:{selector:"",attribute:"font-weight",default:""},text_decoration:{selector:"",attribute:"text-decoration",default:""}});class Jn extends l{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"TextStyleModel",_model_module:"@jupyter-widgets/controls",_model_module_version:a.A})}}Jn.styleProperties=Object.assign(Object.assign({},l.styleProperties),{background:{selector:".widget-input",attribute:"background",default:null},font_size:{selector:".widget-input",attribute:"font-size",default:""},text_color:{selector:".widget-input",attribute:"color",default:""}});class Xn extends g{defaults(){return Object.assign(Object.assign({},super.defaults()),{value:"",disabled:!1,placeholder:"​",_model_name:"StringModel"})}}class Zn extends d{render(){super.render(),this.el.classList.add("jupyter-widgets"),this.el.classList.add("widget-inline-hbox")}}class Qn extends Xn{defaults(){return Object.assign(Object.assign({},super.defaults()),{_view_name:"HTMLView",_model_name:"HTMLModel"})}}class ei extends Zn{render(){super.render(),this.el.classList.add("widget-html"),this.content=document.createElement("div"),this.content.classList.add("widget-html-content"),this.el.appendChild(this.content),this.update()}update(){return this.content.innerHTML=this.model.get("value"),super.update()}handle_message(e){"focus"===e.do?this.content.focus():"blur"===e.do&&this.content.blur()}}class ti extends Xn{defaults(){return Object.assign(Object.assign({},super.defaults()),{_view_name:"HTMLMathView",_model_name:"HTMLMathModel"})}}class ni extends Zn{render(){super.render(),this.el.classList.add("widget-htmlmath"),this.content=document.createElement("div"),this.content.classList.add("widget-htmlmath-content"),this.el.appendChild(this.content),this.update()}update(){return this.content.innerHTML=this.model.get("value"),this.typeset(this.content),super.update()}handle_message(e){"focus"===e.do?this.content.focus():"blur"===e.do&&this.content.blur()}}class ii extends Xn{defaults(){return Object.assign(Object.assign({},super.defaults()),{_view_name:"LabelView",_model_name:"LabelModel"})}}class ri extends Zn{render(){super.render(),this.el.classList.add("widget-label"),this.update()}update(){return this.typeset(this.el,this.model.get("value")),super.update()}}class si extends Xn{defaults(){return Object.assign(Object.assign({},super.defaults()),{_view_name:"TextareaView",_model_name:"TextareaModel",rows:null,continuous_update:!0})}}class oi extends Zn{render(){super.render(),this.el.classList.add("widget-textarea"),this.textbox=document.createElement("textarea"),this.textbox.setAttribute("rows","5"),this.textbox.id=this.label.htmlFor=(0,i.uuid)(),this.textbox.classList.add("widget-input"),this.el.appendChild(this.textbox),this.update(),this.listenTo(this.model,"change:placeholder",((e,t,n)=>{this.update_placeholder(t)})),this.update_placeholder(),this.updateTooltip()}update_placeholder(e){const t=e||this.model.get("placeholder");this.textbox.setAttribute("placeholder",t.toString())}update(e){if(void 0===e||e.updated_view!==this){this.textbox.value=this.model.get("value");let e=this.model.get("rows");null===e&&(e=""),this.textbox.setAttribute("rows",e),this.textbox.disabled=this.model.get("disabled")}return this.updateTabindex(),this.updateTooltip(),super.update()}updateTabindex(){if(!this.textbox)return;const e=this.model.get("tabbable");!0===e?this.textbox.setAttribute("tabIndex","0"):!1===e?this.textbox.setAttribute("tabIndex","-1"):null===e&&this.textbox.removeAttribute("tabIndex")}updateTooltip(){if(!this.textbox)return;const e=this.model.get("tooltip");e?0===this.model.get("description").length&&this.textbox.setAttribute("title",e):this.textbox.removeAttribute("title")}events(){return{"keydown input":"handleKeyDown","keypress input":"handleKeypress","input textarea":"handleChanging","change textarea":"handleChanged"}}handleKeyDown(e){e.stopPropagation()}handleKeypress(e){e.stopPropagation()}handleChanging(e){this.model.get("continuous_update")&&this.handleChanged(e)}handleChanged(e){const t=e.target;this.model.set("value",t.value,{updated_view:this}),this.touch()}handle_message(e){"focus"===e.do?this.textbox.focus():"blur"===e.do&&this.textbox.blur()}}class ai extends Xn{defaults(){return Object.assign(Object.assign({},super.defaults()),{_view_name:"TextView",_model_name:"TextModel",continuous_update:!0})}}class li extends Zn{constructor(){super(...arguments),this.inputType="text"}render(){super.render(),this.el.classList.add("widget-text"),this.textbox=document.createElement("input"),this.textbox.setAttribute("type",this.inputType),this.textbox.id=this.label.htmlFor=(0,i.uuid)(),this.textbox.classList.add("widget-input"),this.el.appendChild(this.textbox),this.update(),this.listenTo(this.model,"change:placeholder",((e,t,n)=>{this.update_placeholder(t)})),this.update_placeholder(),this.updateTabindex(),this.updateTooltip()}update_placeholder(e){this.textbox.setAttribute("placeholder",e||this.model.get("placeholder"))}updateTabindex(){if(!this.textbox)return;const e=this.model.get("tabbable");!0===e?this.textbox.setAttribute("tabIndex","0"):!1===e?this.textbox.setAttribute("tabIndex","-1"):null===e&&this.textbox.removeAttribute("tabIndex")}updateTooltip(){if(!this.textbox)return;const e=this.model.get("tooltip");e?0===this.model.get("description").length&&this.textbox.setAttribute("title",e):this.textbox.removeAttribute("title")}update(e){return void 0!==e&&e.updated_view===this||(this.textbox.value!==this.model.get("value")&&(this.textbox.value=this.model.get("value")),this.textbox.disabled=this.model.get("disabled")),super.update()}events(){return{"keydown input":"handleKeyDown","keypress input":"handleKeypress","input input":"handleChanging","change input":"handleChanged"}}handleKeyDown(e){e.stopPropagation()}handleKeypress(e){e.stopPropagation(),13===e.keyCode&&this.send({event:"submit"})}handleChanging(e){this.model.get("continuous_update")&&this.handleChanged(e)}handleChanged(e){const t=e.target;this.model.set("value",t.value,{updated_view:this}),this.touch()}handle_message(e){"focus"===e.do?this.textbox.focus():"blur"===e.do&&this.textbox.blur()}}class ui extends ai{defaults(){return Object.assign(Object.assign({},super.defaults()),{_view_name:"PasswordView",_model_name:"PasswordModel"})}}class di extends li{constructor(){super(...arguments),this.inputType="password"}}class ci extends ai{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"ComboboxModel",_view_name:"ComboboxView",options:[],ensure_options:!1})}}class hi extends li{constructor(){super(...arguments),this.isInitialRender=!0}render(){this.datalist=document.createElement("datalist"),this.datalist.id=(0,i.uuid)(),super.render(),this.textbox.setAttribute("list",this.datalist.id),this.el.appendChild(this.datalist),this.updateTooltip()}update(e){if(super.update(e),!this.datalist)return;const t=this.isValid(this.model.get("value"));if(this.highlightValidState(t),void 0!==e&&e.updated_view||!this.model.hasChanged("options")&&!this.isInitialRender)return;this.isInitialRender=!1;const n=this.model.get("options"),i=document.createDocumentFragment();for(const e of n){const t=document.createElement("option");t.value=e,i.appendChild(t)}this.datalist.replaceChildren(...i.children)}isValid(e){return!0!==this.model.get("ensure_option")||-1!==this.model.get("options").indexOf(e)}handleChanging(e){const t=e.target,n=this.isValid(t.value);this.highlightValidState(n),n&&super.handleChanging(e)}handleChanged(e){const t=e.target,n=this.isValid(t.value);this.highlightValidState(n),n&&super.handleChanged(e)}handle_message(e){"focus"===e.do?this.textbox.focus():"blur"===e.do&&this.textbox.blur()}highlightValidState(e){this.textbox.classList.toggle("jpwidgets-invalidComboValue",!e)}}class pi extends f{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"FileUploadModel",_view_name:"FileUploadView",accept:"",description:"Upload",disabled:!1,icon:"upload",button_style:"",multiple:!1,value:[],error:"",style:null})}}pi.serializers=Object.assign(Object.assign({},f.serializers),{value:{serialize:e=>e}});class fi extends i.DOMWidgetView{preinitialize(){this.tagName="button"}render(){super.render(),this.el.classList.add("jupyter-widgets"),this.el.classList.add("widget-upload"),this.el.classList.add("jupyter-button"),this.fileInput=document.createElement("input"),this.fileInput.type="file",this.fileInput.style.display="none",this.el.addEventListener("click",(()=>{this.fileInput.click()})),this.fileInput.addEventListener("click",(()=>{this.fileInput.value=""})),this.fileInput.addEventListener("change",(()=>{var e;const t=[];Array.from(null!==(e=this.fileInput.files)&&void 0!==e?e:[]).forEach((e=>{t.push(new Promise(((t,n)=>{const i=new FileReader;i.onload=()=>{const n=i.result;t({content:n,name:e.name,type:e.type,size:e.size,last_modified:e.lastModified})},i.onerror=()=>{n()},i.onabort=i.onerror,i.readAsArrayBuffer(e)})))})),Promise.all(t).then((e=>{this.model.set({value:e,error:""}),this.touch()})).catch((e=>{console.error("error in file upload: %o",e),this.model.set({error:e}),this.touch()}))})),this.listenTo(this.model,"change:button_style",this.update_button_style),this.set_button_style(),this.update()}update(){this.el.disabled=this.model.get("disabled"),this.el.setAttribute("title",this.model.get("tooltip"));const e=this.model.get("value"),t=`${this.model.get("description")} (${e.length})`,n=this.model.get("icon");if(t.length||n.length){if(this.el.textContent="",n.length){const e=document.createElement("i");e.classList.add("fa"),e.classList.add("fa-"+n),0===t.length&&e.classList.add("center"),this.el.appendChild(e)}this.el.appendChild(document.createTextNode(t))}return this.fileInput.accept=this.model.get("accept"),this.fileInput.multiple=this.model.get("multiple"),super.update()}update_button_style(){this.update_mapped_classes(fi.class_map,"button_style",this.el)}set_button_style(){this.set_mapped_classes(fi.class_map,"button_style",this.el)}}fi.class_map={primary:["mod-primary"],success:["mod-success"],info:["mod-info"],warning:["mod-warning"],danger:["mod-danger"]};const gi=n(7093).rE},9874:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});const i="2.0.0"},1137:(e,t,n)=>{"use strict";n.r(t),n.d(t,{KernelWidgetManager:()=>g.zS,LabWidgetManager:()=>g.tl,WidgetManager:()=>g.SS,WidgetRenderer:()=>f.u,default:()=>z,output:()=>m,registerWidgetManager:()=>k});var i=n(5764);const r=new i.Token("@jupyterlab/coreutils:ISettingRegistry",'A service for the JupyterLab settings system.\n Use this if you want to store settings for your application.\n See "schemaDir" for more information.'),s=new i.Token("@jupyterlab/console:IConsoleTracker","A widget tracker for code consoles.\n Use this if you want to be able to iterate over and interact with code consoles\n created by the application."),o=(new i.Token("@jupyterlab/console:IConsoleCellExecutor","The console cell executor"),new i.Token("@jupyterlab/notebook:INotebookWidgetFactory","A service to create the notebook viewer."),new i.Token("@jupyterlab/notebook:INotebookTools",'A service for the "Notebook Tools" panel in the\n right sidebar. Use this to add your own functionality to the panel.'),new i.Token("@jupyterlab/notebook:INotebookTracker","A widget tracker for notebooks.\n Use this if you want to be able to iterate over and interact with notebooks\n created by the application.")),a=(new i.Token("@jupyterlab/notebook:INotebookCellExecutor","The notebook cell executor"),new i.Token("@jupyterlab/mainmenu:IMainMenu","A service for the main menu bar for the application.\n Use this if you want to add your own menu items or provide implementations for standardized menu items for specific activities.")),l=new i.Token("@jupyterlab/rendermime:IRenderMimeRegistry",'A service for the rendermime registry for the application. Use this to create renderers for various mime-types in your extension. Many times it will be easier to create a "mime renderer extension" rather than using this service directly.'),u=(new i.Token("@jupyterlab/rendermime:ILatexTypesetter","A service for the LaTeX typesetter for the application. Use this if you want to typeset math in your extension."),new i.Token("@jupyterlab/rendermime:IMarkdownParser","A service for rendering markdown syntax as HTML content."),new i.Token("@jupyterlab/logconsole:ILoggerRegistry","A service providing a logger infrastructure."));var d,c,h;!function(e){function t(e,t,n=0,i=-1){let r,s=e.length;if(0===s)return-1;n=n<0?Math.max(0,n+s):Math.min(n,s-1),r=(i=i<0?Math.max(0,i+s):Math.min(i,s-1))=n)return;let i=e[t];for(let i=t+1;i0;){let i=a>>1,r=o+i;n(e[r],t)<0?(o=r+1,a-=i+1):a=i}return o},e.upperBound=function(e,t,n,i=0,r=-1){let s=e.length;if(0===s)return 0;let o=i=i<0?Math.max(0,i+s):Math.min(i,s-1),a=(r=r<0?Math.max(0,r+s):Math.min(r,s-1))-i+1;for(;a>0;){let i=a>>1,r=o+i;n(e[r],t)>0?a=i:(o=r+1,a-=i+1)}return o},e.shallowEqual=function(e,t,n){if(e===t)return!0;if(e.length!==t.length)return!1;for(let i=0,r=e.length;i=o&&(n=r<0?o-1:o),void 0===i?i=r<0?-1:o:i<0?i=Math.max(i+o,r<0?-1:0):i>=o&&(i=r<0?o-1:o),s=r<0&&i>=n||r>0&&n>=i?0:r<0?Math.floor((i-n+1)/r+1):Math.floor((i-n-1)/r+1);let a=[];for(let t=0;t=(i=i<0?Math.max(0,i+r):Math.min(i,r-1)))return;let o=i-n+1;if(t>0?t%=o:t<0&&(t=(t%o+o)%o),0===t)return;let a=n+t;s(e,n,a-1),s(e,a,i),s(e,n,i)},e.fill=function(e,t,n=0,i=-1){let r,s=e.length;if(0!==s){n=n<0?Math.max(0,n+s):Math.min(n,s-1),r=(i=i<0?Math.max(0,i+s):Math.min(i,s-1))t;--n)e[n]=e[n-1];e[t]=n},e.removeAt=o,e.removeFirstOf=function(e,n,i=0,r=-1){let s=t(e,n,i,r);return-1!==s&&o(e,s),s},e.removeLastOf=function(e,t,i=-1,r=0){let s=n(e,t,i,r);return-1!==s&&o(e,s),s},e.removeAllOf=function(e,t,n=0,i=-1){let r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);let s=0;for(let o=0;o=n&&o<=i&&e[o]===t||i=n)&&e[o]===t?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s},e.removeFirstWhere=function(e,t,n=0,r=-1){let s,a=i(e,t,n,r);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeLastWhere=function(e,t,n=-1,i=0){let s,a=r(e,t,n,i);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeAllWhere=function(e,t,n=0,i=-1){let r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);let s=0;for(let o=0;o=n&&o<=i&&t(e[o],o)||i=n)&&t(e[o],o)?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s}}(d||(d={})),function(e){e.rangeLength=function(e,t,n){return 0===n?1/0:e>t&&n>0||et?1:0}}(h||(h={}));var p=n(7556),f=n(603),g=n(1043),m=n(6278),v=n(7998),b=n(9874),A=n(5072),y=n.n(A),w=n(698);y()(w.A,{insert:"head",singleton:!1}),w.A.locals;var _=n(5584);y()(_.A,{insert:"head",singleton:!1}),_.A.locals;var E=n(7883),C=n(509);const x=[],D={saveState:!1};function*S(...e){for(const t of e)yield*t}async function T(e){return await e.ready,e.session.kernel.id}async function B(e,t,n,i,r){const s=await T(t);let o,a=F.widgetManagerProperty.get(s);a||(a=r(),x.forEach((e=>a.register(e))),F.widgetManagerProperty.set(s,a),o=s,e.disposed.connect((e=>{F.widgetManagerProperty.get(o)&&F.widgetManagerProperty.delete(o)})),t.kernelChanged.connect(((e,t)=>{const{newValue:n}=t;if(n){const e=n.id,t=F.widgetManagerProperty.get(o);t&&(F.widgetManagerProperty.delete(o),F.widgetManagerProperty.set(e,t)),o=e}})));for(const e of i)e.manager=a;return n.removeMimeType(g.kn),n.addFactory({safe:!1,mimeTypes:[g.kn],createRenderer:e=>new f.u(e,a)},-10),new p.DisposableDelegate((()=>{n&&n.removeMimeType(g.kn),a.dispose()}))}function k(e,t,n){let i;const r=T(e.sessionContext).then((r=>{const s=F.widgetManagerProperty.get(r);s?i=s:(i=new g.SS(e,t,D),x.forEach((e=>i.register(e))),F.widgetManagerProperty.set(r,i));for(const e of n)e.manager=i;t.removeMimeType(g.kn),t.addFactory({safe:!1,mimeTypes:[g.kn],createRenderer:e=>new f.u(e,i)},-10)}));return new p.DisposableDelegate((async()=>{await r,t&&t.removeMimeType(g.kn),i.dispose()}))}async function M(e,t){const n=e.content,i=e.context,r=i.sessionContext,s=n.rendermime;return B(n,r,s,t,(()=>new g.SS(i,s,D)))}async function j(e,t){const n=e.console,i=n.sessionContext,r=n.rendermime;return B(n,i,r,t,(()=>new g.zS(i.session.kernel,r)))}const O={id:"@jupyter-widgets/jupyterlab-manager:plugin",requires:[l],optional:[o,s,r,a,u,C.sQ],provides:v.IJupyterWidgetRegistry,activate:function(e,t,n,i,r,s,o,a){const{commands:l}=e,u=(null!=a?a:C.wK).load("jupyterlab_widgets"),d=async e=>{if(!o)return;const t=await T(e.context.sessionContext),n=F.widgetManagerProperty.get(t);n&&n.onUnhandledIOPubMessage.connect(((t,n)=>{const i=o.getLogger(e.context.path);let r="warning";(E.KernelMessage.isErrorMsg(n)||E.KernelMessage.isStreamMsg(n)&&"stderr"===n.content.name)&&(r="error");const s=Object.assign(Object.assign({},n.content),{output_type:n.header.msg_type});i.rendermime=e.content.rendermime,i.log({type:"output",data:s,level:r})}))};if(null!==r&&r.load(O.id).then((e=>{e.changed.connect(I),I(e)})).catch((e=>{console.error(e.message)})),t.addFactory({safe:!1,mimeTypes:[g.kn],createRenderer:e=>new f.u(e)},-10),null!==n){const t=t=>S(function*(e){for(const t of e.widgets)if("code"===t.model.type)for(const e of t.outputArea.widgets)for(const t of Array.from(e.children()))t instanceof f.u&&(yield t)}(t.content),function*(e,t){const n=function*(e){for(const i of e)(n=i).id.startsWith("LinkedOutputView-")&&n.path===t&&(yield i);var n}(e.shell.widgets());for(const e of Array.from(n))for(const t of Array.from(e.children()))for(const e of Array.from(t.children()))e instanceof f.u&&(yield e)}(e,t.context.path));n.forEach((async e=>{await M(e,t(e)),d(e)})),n.widgetAdded.connect((async(e,n)=>{await M(n,t(n)),d(n)}))}if(null!==i){const e=e=>S(function*(e){for(const t of Array.from(e.cells))if("code"===t.model.type)for(const e of t.outputArea.widgets)for(const t of Array.from(e.children()))t instanceof f.u&&(yield t)}(e.console));i.forEach((async t=>{await j(t,e(t))})),i.widgetAdded.connect((async(t,n)=>{await j(n,e(n))}))}return null!==r&&l.addCommand("@jupyter-widgets/jupyterlab-manager:saveWidgetState",{label:u.__("Save Widget State Automatically"),execute:e=>r.set(O.id,"saveState",!D.saveState).catch((e=>{console.error(`Failed to set ${O.id}: ${e.message}`)})),isToggled:()=>D.saveState}),s&&s.settingsMenu.addGroup([{command:"@jupyter-widgets/jupyterlab-manager:saveWidgetState"}]),{registerWidget(e){x.push(e)}}},autoStart:!0};function I(e){D.saveState=e.get("saveState").composite}const P={id:`@jupyter-widgets/jupyterlab-manager:base-${v.JUPYTER_WIDGETS_VERSION}`,requires:[v.IJupyterWidgetRegistry],autoStart:!0,activate:(e,t)=>{t.registerWidget({name:"@jupyter-widgets/base",version:v.JUPYTER_WIDGETS_VERSION,exports:{WidgetModel:v.WidgetModel,WidgetView:v.WidgetView,DOMWidgetView:v.DOMWidgetView,DOMWidgetModel:v.DOMWidgetModel,LayoutModel:v.LayoutModel,LayoutView:v.LayoutView,StyleModel:v.StyleModel,StyleView:v.StyleView,ErrorWidgetView:v.ErrorWidgetView}})}},R={id:`@jupyter-widgets/jupyterlab-manager:controls-${b.A}`,requires:[v.IJupyterWidgetRegistry],autoStart:!0,activate:(e,t)=>{t.registerWidget({name:"@jupyter-widgets/controls",version:b.A,exports:()=>new Promise(((e,t)=>{Promise.resolve().then((t=>{e(n(5803))}).bind(null,n)).catch((e=>{t(e)}))}))})}},L={id:`@jupyter-widgets/jupyterlab-manager:output-${m.OUTPUT_WIDGET_VERSION}`,requires:[v.IJupyterWidgetRegistry],autoStart:!0,activate:(e,t)=>{t.registerWidget({name:"@jupyter-widgets/output",version:m.OUTPUT_WIDGET_VERSION,exports:{OutputModel:m.OutputModel,OutputView:m.OutputView}})}},N=[O,P,R,L];var F;!function(e){e.widgetManagerProperty=new Map}(F||(F={}));const z=N},1043:(e,t,n)=>{"use strict";n.d(t,{zS:()=>_,tl:()=>w,kn:()=>A,SS:()=>E});var i=n(7998),r=n(5764),s=n(7991);function o(e){const t=new Uint8Array(e.length/2);for(let n=0;n/g,">");for(navigator&&"Microsoft Internet Explorer"===navigator.appName&&(s=s.replace(/(%[^\n]*)\n/g,"$1
\n"));t>e;)r[t]="",t--;return r[e]="@@"+i.length+"@@",n&&(s=n(s)),i.push(s),r}var c=n(7521),h=n.n(c);const p=i.PROTOCOL_VERSION.split(".",1)[0];class f{constructor(){this.comm_target_name="jupyter.widget",this._models=Object.create(null)}setViewOptions(e={}){return e}create_view(e,t={}){const n=(0,i.uuid)(),r=e.state_change=e.state_change.then((async()=>{const r=e.get("_view_name"),s=e.get("_view_module");try{const i=new(await this.loadViewClass(r,s,e.get("_view_module_version")))({model:e,options:this.setViewOptions(t)});return i.listenTo(e,"destroy",i.remove),await i.render(),i.once("remove",(()=>{e.views&&delete e.views[n]})),i}catch(n){console.error(`Could not create a view for model id ${e.model_id}`);const o=`Failed to create view for '${r}' from module '${s}' with model '${e.name}' from module '${e.module}'`,a=new(i.createErrorWidgetModel(n,o)),l=new i.ErrorWidgetView({model:a,options:this.setViewOptions(t)});return await l.render(),l}}));return e.views&&(e.views[n]=r),r}callbacks(e){return{}}async get_model(e){const t=this._models[e];if(void 0===t)throw new Error("widget model not found");return t}has_model(e){return void 0!==this._models[e]}handle_comm_open(e,t){const n=(t.metadata||{}).version||"";if(n.split(".",1)[0]!==p){const e=`Wrong widget protocol version: received protocol version '${n}', but was expecting major version '${p}'`;return console.error(e),Promise.reject(e)}const r=t.content.data,s=r.buffer_paths||[],o=t.buffers||[];return(0,i.put_buffers)(r.state,s,o),this.new_model({model_name:r.state._model_name,model_module:r.state._model_module,model_module_version:r.state._model_module_version,comm:e},r.state).catch((0,i.reject)("Could not create a model.",!0))}new_widget(e,t={}){let n;if(void 0===e.view_name||void 0===e.view_module||void 0===e.view_module_version)return Promise.reject("new_widget(...) must be given view information in the options.");n=e.comm?Promise.resolve(e.comm):this._create_comm(this.comm_target_name,e.model_id,{state:{_model_module:e.model_module,_model_module_version:e.model_module_version,_model_name:e.model_name,_view_module:e.view_module,_view_module_version:e.view_module_version,_view_name:e.view_name}},{version:i.PROTOCOL_VERSION});const r=Object.assign({},e);return n.then((e=>(r.comm=e,this.new_model(r,t).then((e=>(e.sync("create",e),e))))),(()=>(r.model_id||(r.model_id=(0,i.uuid)()),this.new_model(r,t))))}register_model(e,t){this._models[e]=t,t.then((t=>{t.once("comm:close",(()=>{delete this._models[e]}))}))}async new_model(e,t={}){var n,i;const r=null!==(n=e.model_id)&&void 0!==n?n:null===(i=e.comm)||void 0===i?void 0:i.comm_id;if(!r)throw new Error("Neither comm nor model_id provided in options object. At least one must exist.");e.model_id=r;const s=this._make_model(e,t);return this.register_model(r,s),await s}async _loadFromKernel(){let e,t;try{const n=await this._create_comm("jupyter.widget.control",(0,i.uuid)(),{},{version:"1.0.0"});await new Promise(((i,r)=>{n.on_msg((n=>{e=n.content.data,"update_states"===e.method?(t=(n.buffers||[]).map((e=>e instanceof DataView?e:new DataView(e instanceof ArrayBuffer?e:e.buffer))),i(null)):console.warn(`\n Unknown ${e.method} message on the Control channel\n `)})),n.on_close((()=>r("Control comm was closed too early"))),n.send({method:"request_states"},{}),setTimeout((()=>r("Control comm did not respond in time")),4e3)})),n.close()}catch(e){return this._loadFromKernelModels()}const n=e.states,r={},s={};for(let n=0;n({widget_id:e,comm:this.has_model(e)?void 0:await this._create_comm("jupyter.widget",e)}))));await Promise.all(o.map((async({widget_id:e,comm:t})=>{const o=n[e];e in r&&(0,i.put_buffers)(o,r[e],s[e]);try{if(t)await this.new_model({model_name:o.model_name,model_module:o.model_module,model_module_version:o.model_module_version,model_id:e,comm:t},o.state);else{const t=await this.get_model(e),n=await t.constructor._deserialize_state(o.state,this);t.set_state(n)}}catch(e){console.error(e)}})))}async _loadFromKernelModels(){const e=await this._get_comm_info(),t=await Promise.all(Object.keys(e).map((async e=>{if(this.has_model(e))return;const t=await this._create_comm(this.comm_target_name,e);let n="";const s=new r.PromiseDelegate;return t.on_msg((e=>{if(e.parent_header.msg_id===n&&"comm_msg"===e.header.msg_type&&"update"===e.content.data.method){const n=e.content.data,r=n.buffer_paths||[],o=e.buffers||[];(0,i.put_buffers)(n.state,r,o),s.resolve({comm:t,msg:e})}})),n=t.send({method:"request_state"},this.callbacks(void 0)),s.promise})));await Promise.all(t.map((async e=>{if(!e)return;const t=e.msg.content;await this.new_model({model_name:t.data.state._model_name,model_module:t.data.state._model_module,model_module_version:t.data.state._model_module_version,comm:e.comm},t.data.state)})))}async _make_model(e,t={}){const n=e.model_id,r=this.loadModelClass(e.model_name,e.model_module,e.model_module_version);let s;const o=(e,t)=>new(i.createErrorWidgetModel(e,t));try{s=await r}catch(e){const t="Could not instantiate widget";return console.error(t),o(e,t)}if(!s){const t="Could not instantiate widget";return console.error(t),o(new Error(`Cannot find model module ${e.model_module}@${e.model_module_version}, ${e.model_name}`),t)}let a;try{const i=await s._deserialize_state(t,this);a=new s(i,{widget_manager:this,model_id:n,comm:e.comm})}catch(t){console.error(t),a=o(t,`Model class '${e.model_name}' from module '${e.model_module}' is loaded but can not be instantiated`)}return a.name=e.model_name,a.module=e.model_module,a}clear_state(){return(0,i.resolvePromisesDict)(this._models).then((e=>{Object.keys(e).forEach((t=>e[t].close())),this._models=Object.create(null)}))}get_state(e={}){const t=Object.keys(this._models).map((e=>this._models[e]));return Promise.all(t).then((t=>g(t,e)))}set_state(e){if(!(e.version_major&&e.version_major<=2))throw"Unsupported widget state format";const t=e.state;return this._get_comm_info().then((e=>Promise.all(Object.keys(t).map((n=>{const r={base64:l,hex:o},s=t[n],a=s.state;if(s.buffers){const e=s.buffers.map((e=>e.path)),t=s.buffers.map((e=>new DataView(r[e.encoding](e.data))));(0,i.put_buffers)(s.state,e,t)}if(this.has_model(n))return this.get_model(n).then((e=>e.constructor._deserialize_state(a||{},this).then((t=>(e.set_state(t),e)))));const u={model_id:n,model_name:s.model_name,model_module:s.model_module,model_module_version:s.model_module_version};return Object.prototype.hasOwnProperty.call(e,"model_id")?this._create_comm(this.comm_target_name,n).then((e=>(u.comm=e,this.new_model(u)))):this.new_model(u,a)})))))}disconnect(){Object.keys(this._models).forEach((e=>{this._models[e].then((e=>{e.comm_live=!1}))}))}resolveUrl(e){return Promise.resolve(e)}inline_sanitize(e){const t=function(e){const t=[];let n,i=null,r=null,s=null,o=0;/`/.test(e)?(e=e.replace(/~/g,"~T").replace(/(^|[^\\])(`+)([^\n]*?[^`\n])\2(?!`)/gm,(e=>e.replace(/\$/g,"~D"))),n=e=>e.replace(/~([TD])/g,((e,t)=>"T"===t?"~":"$"))):n=e=>e;let a=e.replace(/\r\n?/g,"\n").split(u);for(let e=1,l=a.length;e{let n=r[t];return"\\\\("===n.substr(0,3)&&"\\\\)"===n.substr(n.length-3)?n="\\("+n.substring(3,n.length-3)+"\\)":"\\\\["===n.substr(0,3)&&"\\\\]"===n.substr(n.length-3)&&(n="\\["+n.substring(3,n.length-3)+"\\]"),n}))}async loadModelClass(e,t,n){try{const i=this.loadClass(e,t,n);return await i,i}catch(n){console.error(n);const r=`Failed to load model class '${e}' from module '${t}'`;return i.createErrorWidgetModel(n,r)}}async loadViewClass(e,t,n){try{const i=this.loadClass(e,t,n);return await i,i}catch(n){console.error(n);const r=`Failed to load view class '${e}' from module '${t}'`;return i.createErrorWidgetView(n,r)}}filterExistingModelState(e){let t=e.state;return t=Object.keys(t).filter((e=>!this.has_model(e))).reduce(((e,n)=>(e[n]=t[n],e)),{}),Object.assign(Object.assign({},e),{state:t})}}function g(e,t={}){const n={};return e.forEach((e=>{const r=e.model_id,s=(0,i.remove_buffers)(e.serialize(e.get_state(t.drop_defaults))),o=s.buffers.map(((e,t)=>({data:a(e),path:s.buffer_paths[t],encoding:"base64"})));n[r]={model_name:e.name,model_module:e.module,model_module_version:e.get("_model_module_version"),state:s.state},o.length>0&&(n[r].buffers=o)})),{version_major:2,version_minor:0,state:n}}var m=n(8571),v=n(2722);class b{constructor(){this._cache=Object.create(null)}set(e,t,n){if(e in this._cache||(this._cache[e]=Object.create(null)),t in this._cache[e])throw`Version ${t} of key ${e} already registered.`;this._cache[e][t]=n}get(e,t){if(e in this._cache){const n=this._cache[e],i=(0,v.maxSatisfying)(Object.keys(n),t);if(null!==i)return n[i]}}getAllVersions(e){if(e in this._cache)return this._cache[e]}}const A="application/vnd.jupyter.widget-view+json",y="application/vnd.jupyter.widget-state+json";class w extends f{constructor(e){super(),this._handleCommOpen=async(e,t)=>{const n=new i.shims.services.Comm(e);await this.handle_comm_open(n,t)},this._restored=new m.Signal(this),this._restoredStatus=!1,this._kernelRestoreInProgress=!1,this._isDisposed=!1,this._registry=new b,this._modelsSync=new Map,this._onUnhandledIOPubMessage=new m.Signal(this),this._rendermime=e}callbacks(e){return{iopub:{output:e=>{this._onUnhandledIOPubMessage.emit(e)}}}}_handleKernelChanged({oldValue:e,newValue:t}){e&&e.removeCommTarget(this.comm_target_name,this._handleCommOpen),t&&t.registerCommTarget(this.comm_target_name,this._handleCommOpen)}disconnect(){super.disconnect(),this._restoredStatus=!1}async _loadFromKernel(){var e;if(!this.kernel)throw new Error("Kernel not set");if(!1!==(null===(e=this.kernel)||void 0===e?void 0:e.handleComms))return super._loadFromKernel()}async _create_comm(e,t,n,r,s){const o=this.kernel;if(!o)throw new Error("No current kernel");const a=o.createComm(e,t);return(n||r)&&a.open(n,r,s),new i.shims.services.Comm(a)}async _get_comm_info(){const e=this.kernel;if(!e)throw new Error("No current kernel");const t=await e.requestCommInfo({target_name:this.comm_target_name});return"ok"===t.content.status?t.content.comms:{}}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,this._commRegistration&&this._commRegistration.dispose())}async resolveUrl(e){return e}async loadClass(e,t,n){"@jupyter-widgets/base"!==t&&"@jupyter-widgets/controls"!==t||!(0,v.valid)(n)||(n=`^${n}`);const i=this._registry.getAllVersions(t);if(!i)throw new Error(`No version of module ${t} is registered`);const r=this._registry.get(t,n);if(!r){const e=Object.keys(i);throw new Error(`Module ${t}, version ${n} is not registered, however, ${e.join(",")} ${e.length>1?"are":"is"}`)}let s;s="function"==typeof r?await r():await r;const o=s[e];if(!o)throw new Error(`Class ${e} not found in module ${t}`);return o}get rendermime(){return this._rendermime}get restored(){return this._restored}get restoredStatus(){return this._restoredStatus}get onUnhandledIOPubMessage(){return this._onUnhandledIOPubMessage}register(e){this._registry.set(e.name,e.version,e.exports)}register_model(e,t){super.register_model(e,t),t.then((t=>{this._modelsSync.set(e,t),t.once("comm:close",(()=>{this._modelsSync.delete(e)}))}))}async clear_state(){await super.clear_state(),this._modelsSync=new Map}get_state_sync(e={}){const t=[];for(const e of this._modelsSync.values())e.comm_live&&t.push(e);return g(t,e)}}class _ extends w{constructor(e,t){super(t),this._kernel=e,e.statusChanged.connect(((e,t)=>{this._handleKernelStatusChange(t)})),e.connectionStatusChanged.connect(((e,t)=>{this._handleKernelConnectionStatusChange(t)})),this._handleKernelChanged({name:"kernel",oldValue:null,newValue:e}),this.restoreWidgets()}_handleKernelConnectionStatusChange(e){"connected"===e&&(this._kernelRestoreInProgress||this.restoreWidgets())}_handleKernelStatusChange(e){"restarting"===e&&this.disconnect()}async restoreWidgets(){try{this._kernelRestoreInProgress=!0,await this._loadFromKernel(),this._restoredStatus=!0,this._restored.emit()}catch(e){}this._kernelRestoreInProgress=!1}dispose(){this.isDisposed||(this._kernel=null,super.dispose())}get kernel(){return this._kernel}}class E extends w{constructor(e,t,n){var i,r;super(t),this._context=e,e.sessionContext.kernelChanged.connect(((e,t)=>{this._handleKernelChanged(t)})),e.sessionContext.statusChanged.connect(((e,t)=>{this._handleKernelStatusChange(t)})),e.sessionContext.connectionStatusChanged.connect(((e,t)=>{this._handleKernelConnectionStatusChange(t)})),(null===(i=e.sessionContext.session)||void 0===i?void 0:i.kernel)&&this._handleKernelChanged({name:"kernel",oldValue:null,newValue:null===(r=e.sessionContext.session)||void 0===r?void 0:r.kernel}),this.restoreWidgets(this._context.model),this._settings=n,e.saveState.connect(((e,t)=>{"started"===t&&n.saveState&&this._saveState()}))}_saveState(){const e=this.get_state_sync({drop_defaults:!0});this._context.model.setMetadata?this._context.model.setMetadata("widgets",{"application/vnd.jupyter.widget-state+json":e}):this._context.model.metadata.set("widgets",{"application/vnd.jupyter.widget-state+json":e})}_handleKernelConnectionStatusChange(e){"connected"===e&&(this._kernelRestoreInProgress||this.restoreWidgets(this._context.model,{loadKernel:!0,loadNotebook:!1}))}_handleKernelStatusChange(e){"restarting"===e&&this.disconnect()}async restoreWidgets(e,{loadKernel:t,loadNotebook:n}={loadKernel:!0,loadNotebook:!0}){try{if(await this.context.sessionContext.ready,t)try{this._kernelRestoreInProgress=!0,await this._loadFromKernel()}finally{this._kernelRestoreInProgress=!1}n&&await this._loadFromNotebook(e),this._restoredStatus=!0,this._restored.emit()}catch(e){}}async _loadFromNotebook(e){const t=e.getMetadata?e.getMetadata("widgets"):e.metadata.get("widgets");if(t&&t[y]){let e=t[y];e=this.filterExistingModelState(e),await this.set_state(e)}}dispose(){this.isDisposed||(this._context=null,super.dispose())}async resolveUrl(e){const t=await this.context.urlResolver.resolveUrl(e);return this.context.urlResolver.getDownloadUrl(t)}get context(){return this._context}get kernel(){var e,t,n;return null!==(n=null===(t=null===(e=this._context.sessionContext)||void 0===e?void 0:e.session)||void 0===t?void 0:t.kernel)&&void 0!==n?n:null}register_model(e,t){super.register_model(e,t),this.setDirty()}async clear_state(){await super.clear_state(),this.setDirty()}setDirty(){this._settings.saveState&&(this._context.model.dirty=!0)}}},6278:(e,t,n)=>{"use strict";n.r(t),n.d(t,{OUTPUT_WIDGET_VERSION:()=>h,OutputModel:()=>p,OutputView:()=>f});var i=n(7998);const r="1.0.0";class s extends i.DOMWidgetModel{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"OutputModel",_view_name:"OutputView",_model_module:"@jupyter-widgets/output",_view_module:"@jupyter-widgets/output",_model_module_version:r,_view_module_version:r})}}class o extends i.DOMWidgetView{}var a=n(1043),l=n(478),u=n(8044),d=n(4651),c=n.n(d);const h=r;class p extends s{defaults(){return Object.assign(Object.assign({},super.defaults()),{msg_id:"",outputs:[]})}initialize(e,t){super.initialize(e,t),this._outputs=new l.c({trusted:!0}),this._msgHook=e=>(this.add(e),!1),this.widget_manager instanceof a.SS&&this.widget_manager.context.sessionContext.kernelChanged.connect(((e,t)=>{this._handleKernelChanged(t)})),this.listenTo(this,"change:msg_id",this.reset_msg_id),this.listenTo(this,"change:outputs",this.setOutputs),this.setOutputs()}_handleKernelChanged({oldValue:e}){const t=this.get("msg_id");t&&e&&(e.removeMessageHook(t,this._msgHook),this.set("msg_id",null))}reset_msg_id(){const e=this.widget_manager.kernel,t=this.get("msg_id"),n=this.previous("msg_id");n&&e&&e.removeMessageHook(n,this._msgHook),t&&e&&e.registerMessageHook(t,this._msgHook)}add(e){const t=e.header.msg_type;switch(t){case"execute_result":case"display_data":case"stream":case"error":{const n=e.content;n.output_type=t,this._outputs.add(n);break}case"clear_output":this.clear_output(e.content.wait)}this.set("outputs",this._outputs.toJSON(),{newMessage:!0}),this.save_changes()}clear_output(e=!1){this._outputs.clear(e)}get outputs(){return this._outputs}setOutputs(e,t,n){n&&n.newMessage||(this.clear_output(),this._outputs.fromJSON(JSON.parse(JSON.stringify(this.get("outputs")))))}}class f extends o{_createElement(e){return this.luminoWidget=new i.JupyterLuminoPanelWidget({view:this}),this.luminoWidget.node}_setElement(e){if(this.el||e!==this.luminoWidget.node)throw new Error("Cannot reset the DOM element.");this.el=this.luminoWidget.node,this.$el=c()(this.luminoWidget.node)}render(){super.render(),this._outputView=new u.Bw({rendermime:this.model.widget_manager.rendermime,contentFactory:u.Bw.defaultContentFactory,model:this.model.outputs}),this.luminoWidget.insertWidget(0,this._outputView),this.luminoWidget.addClass("jupyter-widgets"),this.luminoWidget.addClass("widget-output"),this.update()}remove(){return this._outputView.dispose(),super.remove()}}},603:(e,t,n)=>{"use strict";n.d(t,{u:()=>s});var i=n(5764),r=n(5070);class s extends r.Zk{constructor(e,t){super(),this._manager=new i.PromiseDelegate,this._rerenderMimeModel=null,this.mimeType=e.mimeType,t&&(this.manager=t)}set manager(e){e.restored.connect(this._rerender,this),this._manager.resolve(e)}async renderModel(e){const t=e.data[this.mimeType];this.node.textContent="Loading widget...";const n=await this._manager.promise;if(""===t.model_id)return this.hide(),Promise.resolve();let i,r;try{i=await n.get_model(t.model_id)}catch(t){return n.restoredStatus?(this.node.textContent="Error displaying widget: model not found",this.addClass("jupyter-widgets"),void console.error(t)):void(this._rerenderMimeModel=e)}this._rerenderMimeModel=null;try{const e=await n.create_view(i);r=e.luminoWidget||e.pWidget}catch(e){return this.node.textContent="Error displaying widget",this.addClass("jupyter-widgets"),void console.error(e)}this.node.textContent="",this.addWidget(r),r.disposed.connect((()=>{this.hide(),t.model_id=""}))}dispose(){this.isDisposed||(this._manager=null,super.dispose())}_rerender(){this._rerenderMimeModel&&(this.node.textContent="",this.removeClass("jupyter-widgets"),this.renderModel(this._rerenderMimeModel))}}},1530:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.attributeNames=t.elementNames=void 0,t.elementNames=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map((function(e){return[e.toLowerCase(),e]}))),t.attributeNames=new Map(["definitionURL","attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map((function(e){return[e.toLowerCase(),e]})))},5552:function(e,t,n){"use strict";var i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,n=1,i=arguments.length;n");case a.Comment:return"\x3c!--".concat(e.data,"--\x3e");case a.CDATA:return function(e){return"")}(e);case a.Script:case a.Style:case a.Tag:return function(e,t){var n;"foreign"===t.xmlMode&&(e.name=null!==(n=u.elementNames.get(e.name))&&void 0!==n?n:e.name,e.parent&&g.has(e.parent.name)&&(t=i(i({},t),{xmlMode:!1}))),!t.xmlMode&&m.has(e.name)&&(t=i(i({},t),{xmlMode:"foreign"}));var r="<".concat(e.name),s=function(e,t){var n;if(e){var i=!1===(null!==(n=t.encodeEntities)&&void 0!==n?n:t.decodeEntities)?c:t.xmlMode||"utf8"!==t.encodeEntities?l.encodeXML:l.escapeAttribute;return Object.keys(e).map((function(n){var r,s,o=null!==(r=e[n])&&void 0!==r?r:"";return"foreign"===t.xmlMode&&(n=null!==(s=u.attributeNames.get(n))&&void 0!==s?s:n),t.emptyAttrs||t.xmlMode||""!==o?"".concat(n,'="').concat(i(o),'"'):n})).join(" ")}}(e.attribs,t);return s&&(r+=" ".concat(s)),0===e.children.length&&(t.xmlMode?!1!==t.selfClosingTags:t.selfClosingTags&&h.has(e.name))?(t.xmlMode||(r+=" "),r+="/>"):(r+=">",e.children.length>0&&(r+=p(e.children,t)),!t.xmlMode&&h.has(e.name)||(r+=""))),r}(e,t);case a.Text:return function(e,t){var n,i=e.data||"";return!1===(null!==(n=t.encodeEntities)&&void 0!==n?n:t.decodeEntities)||!t.xmlMode&&e.parent&&d.has(e.parent.name)||(i=t.xmlMode||"utf8"!==t.encodeEntities?(0,l.encodeXML)(i):(0,l.escapeText)(i)),i}(e,t)}}t.render=p,t.default=p;var g=new Set(["mi","mo","mn","ms","mtext","annotation-xml","foreignObject","desc","title"]),m=new Set(["svg","math"])},2159:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.DomHandler=void 0;var s=n(3338),o=n(4879);r(n(4879),t);var a={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},l=function(){function e(e,t,n){this.dom=[],this.root=new o.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,"function"==typeof t&&(n=t,t=a),"object"==typeof e&&(t=e,e=void 0),this.callback=null!=e?e:null,this.options=null!=t?t:a,this.elementCB=null!=n?n:null}return e.prototype.onparserinit=function(e){this.parser=e},e.prototype.onreset=function(){this.dom=[],this.root=new o.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null},e.prototype.onend=function(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))},e.prototype.onerror=function(e){this.handleCallback(e)},e.prototype.onclosetag=function(){this.lastNode=null;var e=this.tagStack.pop();this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(e)},e.prototype.onopentag=function(e,t){var n=this.options.xmlMode?s.ElementType.Tag:void 0,i=new o.Element(e,t,void 0,n);this.addNode(i),this.tagStack.push(i)},e.prototype.ontext=function(e){var t=this.lastNode;if(t&&t.type===s.ElementType.Text)t.data+=e,this.options.withEndIndices&&(t.endIndex=this.parser.endIndex);else{var n=new o.Text(e);this.addNode(n),this.lastNode=n}},e.prototype.oncomment=function(e){if(this.lastNode&&this.lastNode.type===s.ElementType.Comment)this.lastNode.data+=e;else{var t=new o.Comment(e);this.addNode(t),this.lastNode=t}},e.prototype.oncommentend=function(){this.lastNode=null},e.prototype.oncdatastart=function(){var e=new o.Text(""),t=new o.CDATA([e]);this.addNode(t),e.parent=t,this.lastNode=e},e.prototype.oncdataend=function(){this.lastNode=null},e.prototype.onprocessinginstruction=function(e,t){var n=new o.ProcessingInstruction(e,t);this.addNode(n)},e.prototype.handleCallback=function(e){if("function"==typeof this.callback)this.callback(e,this.dom);else if(e)throw e},e.prototype.addNode=function(e){var t=this.tagStack[this.tagStack.length-1],n=t.children[t.children.length-1];this.options.withStartIndices&&(e.startIndex=this.parser.startIndex),this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),t.children.push(e),n&&(e.prev=n,n.next=e),e.parent=t,this.lastNode=null},e}();t.DomHandler=l,t.default=l},4879:function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},i(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=this&&this.__assign||function(){return s=Object.assign||function(e){for(var t,n=1,i=arguments.length;n0?this.children[this.children.length-1]:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"childNodes",{get:function(){return this.children},set:function(e){this.children=e},enumerable:!1,configurable:!0}),t}(a);t.NodeWithChildren=h;var p=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=o.ElementType.CDATA,t}return r(t,e),Object.defineProperty(t.prototype,"nodeType",{get:function(){return 4},enumerable:!1,configurable:!0}),t}(h);t.CDATA=p;var f=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=o.ElementType.Root,t}return r(t,e),Object.defineProperty(t.prototype,"nodeType",{get:function(){return 9},enumerable:!1,configurable:!0}),t}(h);t.Document=f;var g=function(e){function t(t,n,i,r){void 0===i&&(i=[]),void 0===r&&(r="script"===t?o.ElementType.Script:"style"===t?o.ElementType.Style:o.ElementType.Tag);var s=e.call(this,i)||this;return s.name=t,s.attribs=n,s.type=r,s}return r(t,e),Object.defineProperty(t.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tagName",{get:function(){return this.name},set:function(e){this.name=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributes",{get:function(){var e=this;return Object.keys(this.attribs).map((function(t){var n,i;return{name:t,value:e.attribs[t],namespace:null===(n=e["x-attribsNamespace"])||void 0===n?void 0:n[t],prefix:null===(i=e["x-attribsPrefix"])||void 0===i?void 0:i[t]}}))},enumerable:!1,configurable:!0}),t}(h);function m(e){return(0,o.isTag)(e)}function v(e){return e.type===o.ElementType.CDATA}function b(e){return e.type===o.ElementType.Text}function A(e){return e.type===o.ElementType.Comment}function y(e){return e.type===o.ElementType.Directive}function w(e){return e.type===o.ElementType.Root}function _(e,t){var n;if(void 0===t&&(t=!1),b(e))n=new u(e.data);else if(A(e))n=new d(e.data);else if(m(e)){var i=t?E(e.children):[],r=new g(e.name,s({},e.attribs),i);i.forEach((function(e){return e.parent=r})),null!=e.namespace&&(r.namespace=e.namespace),e["x-attribsNamespace"]&&(r["x-attribsNamespace"]=s({},e["x-attribsNamespace"])),e["x-attribsPrefix"]&&(r["x-attribsPrefix"]=s({},e["x-attribsPrefix"])),n=r}else if(v(e)){i=t?E(e.children):[];var o=new p(i);i.forEach((function(e){return e.parent=o})),n=o}else if(w(e)){i=t?E(e.children):[];var a=new f(i);i.forEach((function(e){return e.parent=a})),e["x-mode"]&&(a["x-mode"]=e["x-mode"]),n=a}else{if(!y(e))throw new Error("Not implemented yet: ".concat(e.type));var l=new c(e.name,e.data);null!=e["x-name"]&&(l["x-name"]=e["x-name"],l["x-publicId"]=e["x-publicId"],l["x-systemId"]=e["x-systemId"]),n=l}return n.startIndex=e.startIndex,n.endIndex=e.endIndex,null!=e.sourceCodeLocation&&(n.sourceCodeLocation=e.sourceCodeLocation),n}function E(e){for(var t=e.map((function(e){return _(e,!0)})),n=1;n{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getFeed=void 0;var i=n(1523),r=n(2839);t.getFeed=function(e){var t=l(c,e);return t?"feed"===t.name?function(e){var t,n=e.children,i={type:"atom",items:(0,r.getElementsByTagName)("entry",n).map((function(e){var t,n=e.children,i={media:a(n)};d(i,"id","id",n),d(i,"title","title",n);var r=null===(t=l("link",n))||void 0===t?void 0:t.attribs.href;r&&(i.link=r);var s=u("summary",n)||u("content",n);s&&(i.description=s);var o=u("updated",n);return o&&(i.pubDate=new Date(o)),i}))};d(i,"id","id",n),d(i,"title","title",n);var s=null===(t=l("link",n))||void 0===t?void 0:t.attribs.href;s&&(i.link=s),d(i,"description","subtitle",n);var o=u("updated",n);return o&&(i.updated=new Date(o)),d(i,"author","email",n,!0),i}(t):function(e){var t,n,i=null!==(n=null===(t=l("channel",e.children))||void 0===t?void 0:t.children)&&void 0!==n?n:[],s={type:e.name.substr(0,3),id:"",items:(0,r.getElementsByTagName)("item",e.children).map((function(e){var t=e.children,n={media:a(t)};d(n,"id","guid",t),d(n,"title","title",t),d(n,"link","link",t),d(n,"description","description",t);var i=u("pubDate",t)||u("dc:date",t);return i&&(n.pubDate=new Date(i)),n}))};d(s,"title","title",i),d(s,"link","link",i),d(s,"description","description",i);var o=u("lastBuildDate",i);return o&&(s.updated=new Date(o)),d(s,"author","managingEditor",i,!0),s}(t):null};var s=["url","type","lang"],o=["fileSize","bitrate","framerate","samplingrate","channels","duration","height","width"];function a(e){return(0,r.getElementsByTagName)("media:content",e).map((function(e){for(var t=e.attribs,n={medium:t.medium,isDefault:!!t.isDefault},i=0,r=s;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uniqueSort=t.compareDocumentPosition=t.DocumentPosition=t.removeSubsets=void 0;var i,r=n(2159);function s(e,t){var n=[],s=[];if(e===t)return 0;for(var o=(0,r.hasChildren)(e)?e:e.parent;o;)n.unshift(o),o=o.parent;for(o=(0,r.hasChildren)(t)?t:t.parent;o;)s.unshift(o),o=o.parent;for(var a=Math.min(n.length,s.length),l=0;ld.indexOf(h)?u===t?i.FOLLOWING|i.CONTAINED_BY:i.FOLLOWING:u===e?i.PRECEDING|i.CONTAINS:i.PRECEDING}t.removeSubsets=function(e){for(var t=e.length;--t>=0;){var n=e[t];if(t>0&&e.lastIndexOf(n,t-1)>=0)e.splice(t,1);else for(var i=n.parent;i;i=i.parent)if(e.includes(i)){e.splice(t,1);break}}return e},function(e){e[e.DISCONNECTED=1]="DISCONNECTED",e[e.PRECEDING=2]="PRECEDING",e[e.FOLLOWING=4]="FOLLOWING",e[e.CONTAINS=8]="CONTAINS",e[e.CONTAINED_BY=16]="CONTAINED_BY"}(i=t.DocumentPosition||(t.DocumentPosition={})),t.compareDocumentPosition=s,t.uniqueSort=function(e){return(e=e.filter((function(e,t,n){return!n.includes(e,t+1)}))).sort((function(e,t){var n=s(e,t);return n&i.PRECEDING?-1:n&i.FOLLOWING?1:0})),e}},9086:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.hasChildren=t.isDocument=t.isComment=t.isText=t.isCDATA=t.isTag=void 0,r(n(1523),t),r(n(4484),t),r(n(7549),t),r(n(1480),t),r(n(2839),t),r(n(2591),t),r(n(2615),t);var s=n(2159);Object.defineProperty(t,"isTag",{enumerable:!0,get:function(){return s.isTag}}),Object.defineProperty(t,"isCDATA",{enumerable:!0,get:function(){return s.isCDATA}}),Object.defineProperty(t,"isText",{enumerable:!0,get:function(){return s.isText}}),Object.defineProperty(t,"isComment",{enumerable:!0,get:function(){return s.isComment}}),Object.defineProperty(t,"isDocument",{enumerable:!0,get:function(){return s.isDocument}}),Object.defineProperty(t,"hasChildren",{enumerable:!0,get:function(){return s.hasChildren}})},2839:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getElementsByTagType=t.getElementsByTagName=t.getElementById=t.getElements=t.testElement=void 0;var i=n(2159),r=n(1480),s={tag_name:function(e){return"function"==typeof e?function(t){return(0,i.isTag)(t)&&e(t.name)}:"*"===e?i.isTag:function(t){return(0,i.isTag)(t)&&t.name===e}},tag_type:function(e){return"function"==typeof e?function(t){return e(t.type)}:function(t){return t.type===e}},tag_contains:function(e){return"function"==typeof e?function(t){return(0,i.isText)(t)&&e(t.data)}:function(t){return(0,i.isText)(t)&&t.data===e}}};function o(e,t){return"function"==typeof t?function(n){return(0,i.isTag)(n)&&t(n.attribs[e])}:function(n){return(0,i.isTag)(n)&&n.attribs[e]===t}}function a(e,t){return function(n){return e(n)||t(n)}}function l(e){var t=Object.keys(e).map((function(t){var n=e[t];return Object.prototype.hasOwnProperty.call(s,t)?s[t](n):o(t,n)}));return 0===t.length?null:t.reduce(a)}t.testElement=function(e,t){var n=l(e);return!n||n(t)},t.getElements=function(e,t,n,i){void 0===i&&(i=1/0);var s=l(e);return s?(0,r.filter)(s,t,n,i):[]},t.getElementById=function(e,t,n){return void 0===n&&(n=!0),Array.isArray(t)||(t=[t]),(0,r.findOne)(o("id",e),t,n)},t.getElementsByTagName=function(e,t,n,i){return void 0===n&&(n=!0),void 0===i&&(i=1/0),(0,r.filter)(s.tag_name(e),t,n,i)},t.getElementsByTagType=function(e,t,n,i){return void 0===n&&(n=!0),void 0===i&&(i=1/0),(0,r.filter)(s.tag_type(e),t,n,i)}},7549:(e,t)=>{"use strict";function n(e){if(e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),e.parent){var t=e.parent.children,n=t.lastIndexOf(e);n>=0&&t.splice(n,1)}e.next=null,e.prev=null,e.parent=null}Object.defineProperty(t,"__esModule",{value:!0}),t.prepend=t.prependChild=t.append=t.appendChild=t.replaceElement=t.removeElement=void 0,t.removeElement=n,t.replaceElement=function(e,t){var n=t.prev=e.prev;n&&(n.next=t);var i=t.next=e.next;i&&(i.prev=t);var r=t.parent=e.parent;if(r){var s=r.children;s[s.lastIndexOf(e)]=t,e.parent=null}},t.appendChild=function(e,t){if(n(t),t.next=null,t.parent=e,e.children.push(t)>1){var i=e.children[e.children.length-2];i.next=t,t.prev=i}else t.prev=null},t.append=function(e,t){n(t);var i=e.parent,r=e.next;if(t.next=r,t.prev=e,e.next=t,t.parent=i,r){if(r.prev=t,i){var s=i.children;s.splice(s.lastIndexOf(r),0,t)}}else i&&i.children.push(t)},t.prependChild=function(e,t){if(n(t),t.parent=e,t.prev=null,1!==e.children.unshift(t)){var i=e.children[1];i.prev=t,t.next=i}else t.next=null},t.prepend=function(e,t){n(t);var i=e.parent;if(i){var r=i.children;r.splice(r.indexOf(e),0,t)}e.prev&&(e.prev.next=t),t.parent=i,t.prev=e.prev,t.next=e,e.prev=t}},1480:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.findAll=t.existsOne=t.findOne=t.findOneChild=t.find=t.filter=void 0;var i=n(2159);function r(e,t,n,r){for(var s=[],o=[t],a=[0];;)if(a[0]>=o[0].length){if(1===a.length)return s;o.shift(),a.shift()}else{var l=o[0][a[0]++];if(e(l)&&(s.push(l),--r<=0))return s;n&&(0,i.hasChildren)(l)&&l.children.length>0&&(a.unshift(0),o.unshift(l.children))}}t.filter=function(e,t,n,i){return void 0===n&&(n=!0),void 0===i&&(i=1/0),r(e,Array.isArray(t)?t:[t],n,i)},t.find=r,t.findOneChild=function(e,t){return t.find(e)},t.findOne=function e(t,n,r){void 0===r&&(r=!0);for(var s=null,o=0;o0&&(s=e(t,a.children,!0)))}return s},t.existsOne=function e(t,n){return n.some((function(n){return(0,i.isTag)(n)&&(t(n)||e(t,n.children))}))},t.findAll=function(e,t){for(var n=[],r=[t],s=[0];;)if(s[0]>=r[0].length){if(1===r.length)return n;r.shift(),s.shift()}else{var o=r[0][s[0]++];(0,i.isTag)(o)&&(e(o)&&n.push(o),o.children.length>0&&(s.unshift(0),r.unshift(o.children)))}}},1523:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.innerText=t.textContent=t.getText=t.getInnerHTML=t.getOuterHTML=void 0;var r=n(2159),s=i(n(5552)),o=n(3338);function a(e,t){return(0,s.default)(e,t)}t.getOuterHTML=a,t.getInnerHTML=function(e,t){return(0,r.hasChildren)(e)?e.children.map((function(e){return a(e,t)})).join(""):""},t.getText=function e(t){return Array.isArray(t)?t.map(e).join(""):(0,r.isTag)(t)?"br"===t.name?"\n":e(t.children):(0,r.isCDATA)(t)?e(t.children):(0,r.isText)(t)?t.data:""},t.textContent=function e(t){return Array.isArray(t)?t.map(e).join(""):(0,r.hasChildren)(t)&&!(0,r.isComment)(t)?e(t.children):(0,r.isText)(t)?t.data:""},t.innerText=function e(t){return Array.isArray(t)?t.map(e).join(""):(0,r.hasChildren)(t)&&(t.type===o.ElementType.Tag||(0,r.isCDATA)(t))?e(t.children):(0,r.isText)(t)?t.data:""}},4484:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.prevElementSibling=t.nextElementSibling=t.getName=t.hasAttrib=t.getAttributeValue=t.getSiblings=t.getParent=t.getChildren=void 0;var i=n(2159);function r(e){return(0,i.hasChildren)(e)?e.children:[]}function s(e){return e.parent||null}t.getChildren=r,t.getParent=s,t.getSiblings=function(e){var t=s(e);if(null!=t)return r(t);for(var n=[e],i=e.prev,o=e.next;null!=i;)n.unshift(i),i=i.prev;for(;null!=o;)n.push(o),o=o.next;return n},t.getAttributeValue=function(e,t){var n;return null===(n=e.attribs)||void 0===n?void 0:n[t]},t.hasAttrib=function(e,t){return null!=e.attribs&&Object.prototype.hasOwnProperty.call(e.attribs,t)&&null!=e.attribs[t]},t.getName=function(e){return e.name},t.nextElementSibling=function(e){for(var t=e.next;null!==t&&!(0,i.isTag)(t);)t=t.next;return t},t.prevElementSibling=function(e){for(var t=e.prev;null!==t&&!(0,i.isTag)(t);)t=t.prev;return t}},2978:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Parser=void 0;var o=s(n(8544)),a=n(3379),l=new Set(["input","option","optgroup","select","button","datalist","textarea"]),u=new Set(["p"]),d=new Set(["thead","tbody"]),c=new Set(["dd","dt"]),h=new Set(["rt","rp"]),p=new Map([["tr",new Set(["tr","th","td"])],["th",new Set(["th"])],["td",new Set(["thead","th","td"])],["body",new Set(["head","link","script"])],["li",new Set(["li"])],["p",u],["h1",u],["h2",u],["h3",u],["h4",u],["h5",u],["h6",u],["select",l],["input",l],["output",l],["button",l],["datalist",l],["textarea",l],["option",new Set(["option"])],["optgroup",new Set(["optgroup","option"])],["dd",c],["dt",c],["address",u],["article",u],["aside",u],["blockquote",u],["details",u],["div",u],["dl",u],["fieldset",u],["figcaption",u],["figure",u],["footer",u],["form",u],["header",u],["hr",u],["main",u],["nav",u],["ol",u],["pre",u],["section",u],["table",u],["ul",u],["rt",h],["rp",h],["tbody",d],["tfoot",d]]),f=new Set(["area","base","basefont","br","col","command","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr"]),g=new Set(["math","svg"]),m=new Set(["mi","mo","mn","ms","mtext","annotation-xml","foreignobject","desc","title"]),v=/\s|\//,b=function(){function e(e,t){var n,i,r,s,a;void 0===t&&(t={}),this.options=t,this.startIndex=0,this.endIndex=0,this.openTagStart=0,this.tagname="",this.attribname="",this.attribvalue="",this.attribs=null,this.stack=[],this.foreignContext=[],this.buffers=[],this.bufferOffset=0,this.writeIndex=0,this.ended=!1,this.cbs=null!=e?e:{},this.lowerCaseTagNames=null!==(n=t.lowerCaseTags)&&void 0!==n?n:!t.xmlMode,this.lowerCaseAttributeNames=null!==(i=t.lowerCaseAttributeNames)&&void 0!==i?i:!t.xmlMode,this.tokenizer=new(null!==(r=t.Tokenizer)&&void 0!==r?r:o.default)(this.options,this),null===(a=(s=this.cbs).onparserinit)||void 0===a||a.call(s,this)}return e.prototype.ontext=function(e,t){var n,i,r=this.getSlice(e,t);this.endIndex=t-1,null===(i=(n=this.cbs).ontext)||void 0===i||i.call(n,r),this.startIndex=t},e.prototype.ontextentity=function(e){var t,n,i=this.tokenizer.getSectionStart();this.endIndex=i-1,null===(n=(t=this.cbs).ontext)||void 0===n||n.call(t,(0,a.fromCodePoint)(e)),this.startIndex=i},e.prototype.isVoidElement=function(e){return!this.options.xmlMode&&f.has(e)},e.prototype.onopentagname=function(e,t){this.endIndex=t;var n=this.getSlice(e,t);this.lowerCaseTagNames&&(n=n.toLowerCase()),this.emitOpenTag(n)},e.prototype.emitOpenTag=function(e){var t,n,i,r;this.openTagStart=this.startIndex,this.tagname=e;var s=!this.options.xmlMode&&p.get(e);if(s)for(;this.stack.length>0&&s.has(this.stack[this.stack.length-1]);){var o=this.stack.pop();null===(n=(t=this.cbs).onclosetag)||void 0===n||n.call(t,o,!0)}this.isVoidElement(e)||(this.stack.push(e),g.has(e)?this.foreignContext.push(!0):m.has(e)&&this.foreignContext.push(!1)),null===(r=(i=this.cbs).onopentagname)||void 0===r||r.call(i,e),this.cbs.onopentag&&(this.attribs={})},e.prototype.endOpenTag=function(e){var t,n;this.startIndex=this.openTagStart,this.attribs&&(null===(n=(t=this.cbs).onopentag)||void 0===n||n.call(t,this.tagname,this.attribs,e),this.attribs=null),this.cbs.onclosetag&&this.isVoidElement(this.tagname)&&this.cbs.onclosetag(this.tagname,!0),this.tagname=""},e.prototype.onopentagend=function(e){this.endIndex=e,this.endOpenTag(!1),this.startIndex=e+1},e.prototype.onclosetag=function(e,t){var n,i,r,s,o,a;this.endIndex=t;var l=this.getSlice(e,t);if(this.lowerCaseTagNames&&(l=l.toLowerCase()),(g.has(l)||m.has(l))&&this.foreignContext.pop(),this.isVoidElement(l))this.options.xmlMode||"br"!==l||(null===(i=(n=this.cbs).onopentagname)||void 0===i||i.call(n,"br"),null===(s=(r=this.cbs).onopentag)||void 0===s||s.call(r,"br",{},!0),null===(a=(o=this.cbs).onclosetag)||void 0===a||a.call(o,"br",!1));else{var u=this.stack.lastIndexOf(l);if(-1!==u)if(this.cbs.onclosetag)for(var d=this.stack.length-u;d--;)this.cbs.onclosetag(this.stack.pop(),0!==d);else this.stack.length=u;else this.options.xmlMode||"p"!==l||(this.emitOpenTag("p"),this.closeCurrentTag(!0))}this.startIndex=t+1},e.prototype.onselfclosingtag=function(e){this.endIndex=e,this.options.xmlMode||this.options.recognizeSelfClosing||this.foreignContext[this.foreignContext.length-1]?(this.closeCurrentTag(!1),this.startIndex=e+1):this.onopentagend(e)},e.prototype.closeCurrentTag=function(e){var t,n,i=this.tagname;this.endOpenTag(e),this.stack[this.stack.length-1]===i&&(null===(n=(t=this.cbs).onclosetag)||void 0===n||n.call(t,i,!e),this.stack.pop())},e.prototype.onattribname=function(e,t){this.startIndex=e;var n=this.getSlice(e,t);this.attribname=this.lowerCaseAttributeNames?n.toLowerCase():n},e.prototype.onattribdata=function(e,t){this.attribvalue+=this.getSlice(e,t)},e.prototype.onattribentity=function(e){this.attribvalue+=(0,a.fromCodePoint)(e)},e.prototype.onattribend=function(e,t){var n,i;this.endIndex=t,null===(i=(n=this.cbs).onattribute)||void 0===i||i.call(n,this.attribname,this.attribvalue,e===o.QuoteType.Double?'"':e===o.QuoteType.Single?"'":e===o.QuoteType.NoValue?void 0:null),this.attribs&&!Object.prototype.hasOwnProperty.call(this.attribs,this.attribname)&&(this.attribs[this.attribname]=this.attribvalue),this.attribvalue=""},e.prototype.getInstructionName=function(e){var t=e.search(v),n=t<0?e:e.substr(0,t);return this.lowerCaseTagNames&&(n=n.toLowerCase()),n},e.prototype.ondeclaration=function(e,t){this.endIndex=t;var n=this.getSlice(e,t);if(this.cbs.onprocessinginstruction){var i=this.getInstructionName(n);this.cbs.onprocessinginstruction("!".concat(i),"!".concat(n))}this.startIndex=t+1},e.prototype.onprocessinginstruction=function(e,t){this.endIndex=t;var n=this.getSlice(e,t);if(this.cbs.onprocessinginstruction){var i=this.getInstructionName(n);this.cbs.onprocessinginstruction("?".concat(i),"?".concat(n))}this.startIndex=t+1},e.prototype.oncomment=function(e,t,n){var i,r,s,o;this.endIndex=t,null===(r=(i=this.cbs).oncomment)||void 0===r||r.call(i,this.getSlice(e,t-n)),null===(o=(s=this.cbs).oncommentend)||void 0===o||o.call(s),this.startIndex=t+1},e.prototype.oncdata=function(e,t,n){var i,r,s,o,a,l,u,d,c,h;this.endIndex=t;var p=this.getSlice(e,t-n);this.options.xmlMode||this.options.recognizeCDATA?(null===(r=(i=this.cbs).oncdatastart)||void 0===r||r.call(i),null===(o=(s=this.cbs).ontext)||void 0===o||o.call(s,p),null===(l=(a=this.cbs).oncdataend)||void 0===l||l.call(a)):(null===(d=(u=this.cbs).oncomment)||void 0===d||d.call(u,"[CDATA[".concat(p,"]]")),null===(h=(c=this.cbs).oncommentend)||void 0===h||h.call(c)),this.startIndex=t+1},e.prototype.onend=function(){var e,t;if(this.cbs.onclosetag){this.endIndex=this.startIndex;for(var n=this.stack.length;n>0;this.cbs.onclosetag(this.stack[--n],!0));}null===(t=(e=this.cbs).onend)||void 0===t||t.call(e)},e.prototype.reset=function(){var e,t,n,i;null===(t=(e=this.cbs).onreset)||void 0===t||t.call(e),this.tokenizer.reset(),this.tagname="",this.attribname="",this.attribs=null,this.stack.length=0,this.startIndex=0,this.endIndex=0,null===(i=(n=this.cbs).onparserinit)||void 0===i||i.call(n,this),this.buffers.length=0,this.bufferOffset=0,this.writeIndex=0,this.ended=!1},e.prototype.parseComplete=function(e){this.reset(),this.end(e)},e.prototype.getSlice=function(e,t){for(;e-this.bufferOffset>=this.buffers[0].length;)this.shiftBuffer();for(var n=this.buffers[0].slice(e-this.bufferOffset,t-this.bufferOffset);t-this.bufferOffset>this.buffers[0].length;)this.shiftBuffer(),n+=this.buffers[0].slice(0,t-this.bufferOffset);return n},e.prototype.shiftBuffer=function(){this.bufferOffset+=this.buffers[0].length,this.writeIndex--,this.buffers.shift()},e.prototype.write=function(e){var t,n;this.ended?null===(n=(t=this.cbs).onerror)||void 0===n||n.call(t,new Error(".write() after done!")):(this.buffers.push(e),this.tokenizer.running&&(this.tokenizer.write(e),this.writeIndex++))},e.prototype.end=function(e){var t,n;this.ended?null===(n=(t=this.cbs).onerror)||void 0===n||n.call(t,new Error(".end() after done!")):(e&&this.write(e),this.ended=!0,this.tokenizer.end())},e.prototype.pause=function(){this.tokenizer.pause()},e.prototype.resume=function(){for(this.tokenizer.resume();this.tokenizer.running&&this.writeIndex{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.QuoteType=void 0;var i,r,s,o=n(3379);function a(e){return e===i.Space||e===i.NewLine||e===i.Tab||e===i.FormFeed||e===i.CarriageReturn}function l(e){return e===i.Slash||e===i.Gt||a(e)}function u(e){return e>=i.Zero&&e<=i.Nine}!function(e){e[e.Tab=9]="Tab",e[e.NewLine=10]="NewLine",e[e.FormFeed=12]="FormFeed",e[e.CarriageReturn=13]="CarriageReturn",e[e.Space=32]="Space",e[e.ExclamationMark=33]="ExclamationMark",e[e.Number=35]="Number",e[e.Amp=38]="Amp",e[e.SingleQuote=39]="SingleQuote",e[e.DoubleQuote=34]="DoubleQuote",e[e.Dash=45]="Dash",e[e.Slash=47]="Slash",e[e.Zero=48]="Zero",e[e.Nine=57]="Nine",e[e.Semi=59]="Semi",e[e.Lt=60]="Lt",e[e.Eq=61]="Eq",e[e.Gt=62]="Gt",e[e.Questionmark=63]="Questionmark",e[e.UpperA=65]="UpperA",e[e.LowerA=97]="LowerA",e[e.UpperF=70]="UpperF",e[e.LowerF=102]="LowerF",e[e.UpperZ=90]="UpperZ",e[e.LowerZ=122]="LowerZ",e[e.LowerX=120]="LowerX",e[e.OpeningSquareBracket=91]="OpeningSquareBracket"}(i||(i={})),function(e){e[e.Text=1]="Text",e[e.BeforeTagName=2]="BeforeTagName",e[e.InTagName=3]="InTagName",e[e.InSelfClosingTag=4]="InSelfClosingTag",e[e.BeforeClosingTagName=5]="BeforeClosingTagName",e[e.InClosingTagName=6]="InClosingTagName",e[e.AfterClosingTagName=7]="AfterClosingTagName",e[e.BeforeAttributeName=8]="BeforeAttributeName",e[e.InAttributeName=9]="InAttributeName",e[e.AfterAttributeName=10]="AfterAttributeName",e[e.BeforeAttributeValue=11]="BeforeAttributeValue",e[e.InAttributeValueDq=12]="InAttributeValueDq",e[e.InAttributeValueSq=13]="InAttributeValueSq",e[e.InAttributeValueNq=14]="InAttributeValueNq",e[e.BeforeDeclaration=15]="BeforeDeclaration",e[e.InDeclaration=16]="InDeclaration",e[e.InProcessingInstruction=17]="InProcessingInstruction",e[e.BeforeComment=18]="BeforeComment",e[e.CDATASequence=19]="CDATASequence",e[e.InSpecialComment=20]="InSpecialComment",e[e.InCommentLike=21]="InCommentLike",e[e.BeforeSpecialS=22]="BeforeSpecialS",e[e.SpecialStartSequence=23]="SpecialStartSequence",e[e.InSpecialTag=24]="InSpecialTag",e[e.BeforeEntity=25]="BeforeEntity",e[e.BeforeNumericEntity=26]="BeforeNumericEntity",e[e.InNamedEntity=27]="InNamedEntity",e[e.InNumericEntity=28]="InNumericEntity",e[e.InHexEntity=29]="InHexEntity"}(r||(r={})),function(e){e[e.NoValue=0]="NoValue",e[e.Unquoted=1]="Unquoted",e[e.Single=2]="Single",e[e.Double=3]="Double"}(s=t.QuoteType||(t.QuoteType={}));var d={Cdata:new Uint8Array([67,68,65,84,65,91]),CdataEnd:new Uint8Array([93,93,62]),CommentEnd:new Uint8Array([45,45,62]),ScriptEnd:new Uint8Array([60,47,115,99,114,105,112,116]),StyleEnd:new Uint8Array([60,47,115,116,121,108,101]),TitleEnd:new Uint8Array([60,47,116,105,116,108,101])},c=function(){function e(e,t){var n=e.xmlMode,i=void 0!==n&&n,s=e.decodeEntities,a=void 0===s||s;this.cbs=t,this.state=r.Text,this.buffer="",this.sectionStart=0,this.index=0,this.baseState=r.Text,this.isSpecial=!1,this.running=!0,this.offset=0,this.currentSequence=void 0,this.sequenceIndex=0,this.trieIndex=0,this.trieCurrent=0,this.entityResult=0,this.entityExcess=0,this.xmlMode=i,this.decodeEntities=a,this.entityTrie=i?o.xmlDecodeTree:o.htmlDecodeTree}return e.prototype.reset=function(){this.state=r.Text,this.buffer="",this.sectionStart=0,this.index=0,this.baseState=r.Text,this.currentSequence=void 0,this.running=!0,this.offset=0},e.prototype.write=function(e){this.offset+=this.buffer.length,this.buffer=e,this.parse()},e.prototype.end=function(){this.running&&this.finish()},e.prototype.pause=function(){this.running=!1},e.prototype.resume=function(){this.running=!0,this.indexthis.sectionStart&&this.cbs.ontext(this.sectionStart,this.index),this.state=r.BeforeTagName,this.sectionStart=this.index):this.decodeEntities&&e===i.Amp&&(this.state=r.BeforeEntity)},e.prototype.stateSpecialStartSequence=function(e){var t=this.sequenceIndex===this.currentSequence.length;if(t?l(e):(32|e)===this.currentSequence[this.sequenceIndex]){if(!t)return void this.sequenceIndex++}else this.isSpecial=!1;this.sequenceIndex=0,this.state=r.InTagName,this.stateInTagName(e)},e.prototype.stateInSpecialTag=function(e){if(this.sequenceIndex===this.currentSequence.length){if(e===i.Gt||a(e)){var t=this.index-this.currentSequence.length;if(this.sectionStart=i.LowerA&&e<=i.LowerZ||e>=i.UpperA&&e<=i.UpperZ}(e)},e.prototype.startSpecial=function(e,t){this.isSpecial=!0,this.currentSequence=e,this.sequenceIndex=t,this.state=r.SpecialStartSequence},e.prototype.stateBeforeTagName=function(e){if(e===i.ExclamationMark)this.state=r.BeforeDeclaration,this.sectionStart=this.index+1;else if(e===i.Questionmark)this.state=r.InProcessingInstruction,this.sectionStart=this.index+1;else if(this.isTagStartChar(e)){var t=32|e;this.sectionStart=this.index,this.xmlMode||t!==d.TitleEnd[2]?this.state=this.xmlMode||t!==d.ScriptEnd[2]?r.InTagName:r.BeforeSpecialS:this.startSpecial(d.TitleEnd,3)}else e===i.Slash?this.state=r.BeforeClosingTagName:(this.state=r.Text,this.stateText(e))},e.prototype.stateInTagName=function(e){l(e)&&(this.cbs.onopentagname(this.sectionStart,this.index),this.sectionStart=-1,this.state=r.BeforeAttributeName,this.stateBeforeAttributeName(e))},e.prototype.stateBeforeClosingTagName=function(e){a(e)||(e===i.Gt?this.state=r.Text:(this.state=this.isTagStartChar(e)?r.InClosingTagName:r.InSpecialComment,this.sectionStart=this.index))},e.prototype.stateInClosingTagName=function(e){(e===i.Gt||a(e))&&(this.cbs.onclosetag(this.sectionStart,this.index),this.sectionStart=-1,this.state=r.AfterClosingTagName,this.stateAfterClosingTagName(e))},e.prototype.stateAfterClosingTagName=function(e){(e===i.Gt||this.fastForwardTo(i.Gt))&&(this.state=r.Text,this.baseState=r.Text,this.sectionStart=this.index+1)},e.prototype.stateBeforeAttributeName=function(e){e===i.Gt?(this.cbs.onopentagend(this.index),this.isSpecial?(this.state=r.InSpecialTag,this.sequenceIndex=0):this.state=r.Text,this.baseState=this.state,this.sectionStart=this.index+1):e===i.Slash?this.state=r.InSelfClosingTag:a(e)||(this.state=r.InAttributeName,this.sectionStart=this.index)},e.prototype.stateInSelfClosingTag=function(e){e===i.Gt?(this.cbs.onselfclosingtag(this.index),this.state=r.Text,this.baseState=r.Text,this.sectionStart=this.index+1,this.isSpecial=!1):a(e)||(this.state=r.BeforeAttributeName,this.stateBeforeAttributeName(e))},e.prototype.stateInAttributeName=function(e){(e===i.Eq||l(e))&&(this.cbs.onattribname(this.sectionStart,this.index),this.sectionStart=-1,this.state=r.AfterAttributeName,this.stateAfterAttributeName(e))},e.prototype.stateAfterAttributeName=function(e){e===i.Eq?this.state=r.BeforeAttributeValue:e===i.Slash||e===i.Gt?(this.cbs.onattribend(s.NoValue,this.index),this.state=r.BeforeAttributeName,this.stateBeforeAttributeName(e)):a(e)||(this.cbs.onattribend(s.NoValue,this.index),this.state=r.InAttributeName,this.sectionStart=this.index)},e.prototype.stateBeforeAttributeValue=function(e){e===i.DoubleQuote?(this.state=r.InAttributeValueDq,this.sectionStart=this.index+1):e===i.SingleQuote?(this.state=r.InAttributeValueSq,this.sectionStart=this.index+1):a(e)||(this.sectionStart=this.index,this.state=r.InAttributeValueNq,this.stateInAttributeValueNoQuotes(e))},e.prototype.handleInAttributeValue=function(e,t){e===t||!this.decodeEntities&&this.fastForwardTo(t)?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(t===i.DoubleQuote?s.Double:s.Single,this.index),this.state=r.BeforeAttributeName):this.decodeEntities&&e===i.Amp&&(this.baseState=this.state,this.state=r.BeforeEntity)},e.prototype.stateInAttributeValueDoubleQuotes=function(e){this.handleInAttributeValue(e,i.DoubleQuote)},e.prototype.stateInAttributeValueSingleQuotes=function(e){this.handleInAttributeValue(e,i.SingleQuote)},e.prototype.stateInAttributeValueNoQuotes=function(e){a(e)||e===i.Gt?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(s.Unquoted,this.index),this.state=r.BeforeAttributeName,this.stateBeforeAttributeName(e)):this.decodeEntities&&e===i.Amp&&(this.baseState=this.state,this.state=r.BeforeEntity)},e.prototype.stateBeforeDeclaration=function(e){e===i.OpeningSquareBracket?(this.state=r.CDATASequence,this.sequenceIndex=0):this.state=e===i.Dash?r.BeforeComment:r.InDeclaration},e.prototype.stateInDeclaration=function(e){(e===i.Gt||this.fastForwardTo(i.Gt))&&(this.cbs.ondeclaration(this.sectionStart,this.index),this.state=r.Text,this.sectionStart=this.index+1)},e.prototype.stateInProcessingInstruction=function(e){(e===i.Gt||this.fastForwardTo(i.Gt))&&(this.cbs.onprocessinginstruction(this.sectionStart,this.index),this.state=r.Text,this.sectionStart=this.index+1)},e.prototype.stateBeforeComment=function(e){e===i.Dash?(this.state=r.InCommentLike,this.currentSequence=d.CommentEnd,this.sequenceIndex=2,this.sectionStart=this.index+1):this.state=r.InDeclaration},e.prototype.stateInSpecialComment=function(e){(e===i.Gt||this.fastForwardTo(i.Gt))&&(this.cbs.oncomment(this.sectionStart,this.index,0),this.state=r.Text,this.sectionStart=this.index+1)},e.prototype.stateBeforeSpecialS=function(e){var t=32|e;t===d.ScriptEnd[3]?this.startSpecial(d.ScriptEnd,4):t===d.StyleEnd[3]?this.startSpecial(d.StyleEnd,4):(this.state=r.InTagName,this.stateInTagName(e))},e.prototype.stateBeforeEntity=function(e){this.entityExcess=1,this.entityResult=0,e===i.Number?this.state=r.BeforeNumericEntity:e===i.Amp||(this.trieIndex=0,this.trieCurrent=this.entityTrie[0],this.state=r.InNamedEntity,this.stateInNamedEntity(e))},e.prototype.stateInNamedEntity=function(e){if(this.entityExcess+=1,this.trieIndex=(0,o.determineBranch)(this.entityTrie,this.trieCurrent,this.trieIndex+1,e),this.trieIndex<0)return this.emitNamedEntity(),void this.index--;this.trieCurrent=this.entityTrie[this.trieIndex];var t=this.trieCurrent&o.BinTrieFlags.VALUE_LENGTH;if(t){var n=(t>>14)-1;if(this.allowLegacyEntity()||e===i.Semi){var r=this.index-this.entityExcess+1;r>this.sectionStart&&this.emitPartial(this.sectionStart,r),this.entityResult=this.trieIndex,this.trieIndex+=n,this.entityExcess=0,this.sectionStart=this.index+1,0===n&&this.emitNamedEntity()}else this.trieIndex+=n}},e.prototype.emitNamedEntity=function(){if(this.state=this.baseState,0!==this.entityResult)switch((this.entityTrie[this.entityResult]&o.BinTrieFlags.VALUE_LENGTH)>>14){case 1:this.emitCodePoint(this.entityTrie[this.entityResult]&~o.BinTrieFlags.VALUE_LENGTH);break;case 2:this.emitCodePoint(this.entityTrie[this.entityResult+1]);break;case 3:this.emitCodePoint(this.entityTrie[this.entityResult+1]),this.emitCodePoint(this.entityTrie[this.entityResult+2])}},e.prototype.stateBeforeNumericEntity=function(e){(32|e)===i.LowerX?(this.entityExcess++,this.state=r.InHexEntity):(this.state=r.InNumericEntity,this.stateInNumericEntity(e))},e.prototype.emitNumericEntity=function(e){var t=this.index-this.entityExcess-1;t+2+Number(this.state===r.InHexEntity)!==this.index&&(t>this.sectionStart&&this.emitPartial(this.sectionStart,t),this.sectionStart=this.index+Number(e),this.emitCodePoint((0,o.replaceCodePoint)(this.entityResult))),this.state=this.baseState},e.prototype.stateInNumericEntity=function(e){e===i.Semi?this.emitNumericEntity(!0):u(e)?(this.entityResult=10*this.entityResult+(e-i.Zero),this.entityExcess++):(this.allowLegacyEntity()?this.emitNumericEntity(!1):this.state=this.baseState,this.index--)},e.prototype.stateInHexEntity=function(e){e===i.Semi?this.emitNumericEntity(!0):u(e)?(this.entityResult=16*this.entityResult+(e-i.Zero),this.entityExcess++):function(e){return e>=i.UpperA&&e<=i.UpperF||e>=i.LowerA&&e<=i.LowerF}(e)?(this.entityResult=16*this.entityResult+((32|e)-i.LowerA+10),this.entityExcess++):(this.allowLegacyEntity()?this.emitNumericEntity(!1):this.state=this.baseState,this.index--)},e.prototype.allowLegacyEntity=function(){return!this.xmlMode&&(this.baseState===r.Text||this.baseState===r.InSpecialTag)},e.prototype.cleanup=function(){this.running&&this.sectionStart!==this.index&&(this.state===r.Text||this.state===r.InSpecialTag&&0===this.sequenceIndex?(this.cbs.ontext(this.sectionStart,this.index),this.sectionStart=this.index):this.state!==r.InAttributeValueDq&&this.state!==r.InAttributeValueSq&&this.state!==r.InAttributeValueNq||(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=this.index))},e.prototype.shouldContinue=function(){return this.index{"use strict";function n(e){return"[object Object]"===Object.prototype.toString.call(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.isPlainObject=function(e){var t,i;return!1!==n(e)&&(void 0===(t=e.constructor)||!1!==n(i=t.prototype)&&!1!==i.hasOwnProperty("isPrototypeOf"))}},1622:(e,t,n)=>{const i=n(4493),r=n(2189),{isPlainObject:s}=n(9244),o=n(2743),a=n(8287),{parse:l}=n(1412),u=["img","audio","video","picture","svg","object","map","iframe","embed"],d=["script","style"];function c(e,t){e&&Object.keys(e).forEach((function(n){t(e[n],n)}))}function h(e,t){return{}.hasOwnProperty.call(e,t)}function p(e,t){const n=[];return c(e,(function(e){t(e)&&n.push(e)})),n}e.exports=g;const f=/^[^\0\t\n\f\r /<=>]+$/;function g(e,t,n){if(null==e)return"";"number"==typeof e&&(e=e.toString());let v="",b="";function A(e,t){const n=this;this.tag=e,this.attribs=t||{},this.tagPosition=v.length,this.text="",this.mediaChildren=[],this.updateParentNodeText=function(){k.length&&(k[k.length-1].text+=n.text)},this.updateParentNodeMediaChildren=function(){k.length&&u.includes(this.tag)&&k[k.length-1].mediaChildren.push(this.tag)}}(t=Object.assign({},g.defaults,t)).parser=Object.assign({},m,t.parser);const y=function(e){return!1===t.allowedTags||(t.allowedTags||[]).indexOf(e)>-1};d.forEach((function(e){y(e)&&!t.allowVulnerableTags&&console.warn(`\n\n⚠️ Your \`allowedTags\` option includes, \`${e}\`, which is inherently\nvulnerable to XSS attacks. Please remove it from \`allowedTags\`.\nOr, to disable this warning, add the \`allowVulnerableTags\` option\nand ensure you are accounting for this risk.\n\n`)}));const w=t.nonTextTags||["script","style","textarea","option"];let _,E;t.allowedAttributes&&(_={},E={},c(t.allowedAttributes,(function(e,t){_[t]=[];const n=[];e.forEach((function(e){"string"==typeof e&&e.indexOf("*")>=0?n.push(r(e).replace(/\\\*/g,".*")):_[t].push(e)})),n.length&&(E[t]=new RegExp("^("+n.join("|")+")$"))})));const C={},x={},D={};c(t.allowedClasses,(function(e,t){if(_&&(h(_,t)||(_[t]=[]),_[t].push("class")),C[t]=e,Array.isArray(e)){const n=[];C[t]=[],D[t]=[],e.forEach((function(e){"string"==typeof e&&e.indexOf("*")>=0?n.push(r(e).replace(/\\\*/g,".*")):e instanceof RegExp?D[t].push(e):C[t].push(e)})),n.length&&(x[t]=new RegExp("^("+n.join("|")+")$"))}}));const S={};let T,B,k,M,j,O,I;c(t.transformTags,(function(e,t){let n;"function"==typeof e?n=e:"string"==typeof e&&(n=g.simpleTransform(e)),"*"===t?T=n:S[t]=n}));let P=!1;L();const R=new i.Parser({onopentag:function(e,n){if(t.enforceHtmlBoundary&&"html"===e&&L(),O)return void I++;const i=new A(e,n);k.push(i);let r=!1;const u=!!i.text;let d;if(h(S,e)&&(d=S[e](e,n),i.attribs=n=d.attribs,void 0!==d.text&&(i.innerText=d.text),e!==d.tagName&&(i.name=e=d.tagName,j[B]=d.tagName)),T&&(d=T(e,n),i.attribs=n=d.attribs,e!==d.tagName&&(i.name=e=d.tagName,j[B]=d.tagName)),(!y(e)||"recursiveEscape"===t.disallowedTagsMode&&!function(e){for(const t in e)if(h(e,t))return!1;return!0}(M)||null!=t.nestingLimit&&B>=t.nestingLimit)&&(r=!0,M[B]=!0,"discard"===t.disallowedTagsMode&&-1!==w.indexOf(e)&&(O=!0,I=1),M[B]=!0),B++,r){if("discard"===t.disallowedTagsMode)return;b=v,v=""}v+="<"+e,"script"===e&&(t.allowedScriptHostnames||t.allowedScriptDomains)&&(i.innerText=""),(!_||h(_,e)||_["*"])&&c(n,(function(n,r){if(!f.test(r))return void delete i.attribs[r];if(""===n&&!t.allowedEmptyAttributes.includes(r)&&(t.nonBooleanAttributes.includes(r)||t.nonBooleanAttributes.includes("*")))return void delete i.attribs[r];let u=!1;if(!_||h(_,e)&&-1!==_[e].indexOf(r)||_["*"]&&-1!==_["*"].indexOf(r)||h(E,e)&&E[e].test(r)||E["*"]&&E["*"].test(r))u=!0;else if(_&&_[e])for(const t of _[e])if(s(t)&&t.name&&t.name===r){u=!0;let e="";if(!0===t.multiple){const i=n.split(" ");for(const n of i)-1!==t.values.indexOf(n)&&(""===e?e=n:e+=" "+n)}else t.values.indexOf(n)>=0&&(e=n);n=e}if(u){if(-1!==t.allowedSchemesAppliedToAttributes.indexOf(r)&&F(e,n))return void delete i.attribs[r];if("script"===e&&"src"===r){let e=!0;try{const i=z(n);if(t.allowedScriptHostnames||t.allowedScriptDomains){const n=(t.allowedScriptHostnames||[]).find((function(e){return e===i.url.hostname})),r=(t.allowedScriptDomains||[]).find((function(e){return i.url.hostname===e||i.url.hostname.endsWith(`.${e}`)}));e=n||r}}catch(t){e=!1}if(!e)return void delete i.attribs[r]}if("iframe"===e&&"src"===r){let e=!0;try{const i=z(n);if(i.isRelativeUrl)e=h(t,"allowIframeRelativeUrls")?t.allowIframeRelativeUrls:!t.allowedIframeHostnames&&!t.allowedIframeDomains;else if(t.allowedIframeHostnames||t.allowedIframeDomains){const n=(t.allowedIframeHostnames||[]).find((function(e){return e===i.url.hostname})),r=(t.allowedIframeDomains||[]).find((function(e){return i.url.hostname===e||i.url.hostname.endsWith(`.${e}`)}));e=n||r}}catch(t){e=!1}if(!e)return void delete i.attribs[r]}if("srcset"===r)try{let e=a(n);if(e.forEach((function(e){F("srcset",e.url)&&(e.evil=!0)})),e=p(e,(function(e){return!e.evil})),!e.length)return void delete i.attribs[r];n=p(e,(function(e){return!e.evil})).map((function(e){if(!e.url)throw new Error("URL missing");return e.url+(e.w?` ${e.w}w`:"")+(e.h?` ${e.h}h`:"")+(e.d?` ${e.d}x`:"")})).join(", "),i.attribs[r]=n}catch(e){return void delete i.attribs[r]}if("class"===r){const t=C[e],s=C["*"],a=x[e],l=D[e],u=[a,x["*"]].concat(l).filter((function(e){return e}));if(!(d=n,c=t&&s?o(t,s):t||s,g=u,n=c?(d=d.split(/\s+/)).filter((function(e){return-1!==c.indexOf(e)||g.some((function(t){return t.test(e)}))})).join(" "):d).length)return void delete i.attribs[r]}if("style"===r)if(t.parseStyleAttributes)try{if(n=function(e){return e.nodes[0].nodes.reduce((function(e,t){return e.push(`${t.prop}:${t.value}${t.important?" !important":""}`),e}),[]).join(";")}(function(e,t){if(!t)return e;const n=e.nodes[0];let i;return i=t[n.selector]&&t["*"]?o(t[n.selector],t["*"]):t[n.selector]||t["*"],i&&(e.nodes[0].nodes=n.nodes.reduce(function(e){return function(t,n){return h(e,n.prop)&&e[n.prop].some((function(e){return e.test(n.value)}))&&t.push(n),t}}(i),[])),e}(l(e+" {"+n+"}",{map:!1}),t.allowedStyles)),0===n.length)return void delete i.attribs[r]}catch(t){return"undefined"!=typeof window&&console.warn('Failed to parse "'+e+" {"+n+"}\", If you're running this in a browser, we recommend to disable style parsing: options.parseStyleAttributes: false, since this only works in a node environment due to a postcss dependency, More info: https://github.com/apostrophecms/sanitize-html/issues/547"),void delete i.attribs[r]}else if(t.allowedStyles)throw new Error("allowedStyles option cannot be used together with parseStyleAttributes: false.");v+=" "+r,n&&n.length?v+='="'+N(n,!0)+'"':t.allowedEmptyAttributes.includes(r)&&(v+='=""')}else delete i.attribs[r];var d,c,g})),-1!==t.selfClosing.indexOf(e)?v+=" />":(v+=">",!i.innerText||u||t.textFilter||(v+=N(i.innerText),P=!0)),r&&(v=b+N(v),b="")},ontext:function(e){if(O)return;const n=k[k.length-1];let i;if(n&&(i=n.tag,e=void 0!==n.innerText?n.innerText:e),"discard"!==t.disallowedTagsMode||"script"!==i&&"style"!==i){const n=N(e,!1);t.textFilter&&!P?v+=t.textFilter(n,i):P||(v+=n)}else v+=e;k.length&&(k[k.length-1].text+=e)},onclosetag:function(e,n){if(O){if(I--,I)return;O=!1}const i=k.pop();if(!i)return;if(i.tag!==e)return void k.push(i);O=!!t.enforceHtmlBoundary&&"html"===e,B--;const r=M[B];if(r){if(delete M[B],"discard"===t.disallowedTagsMode)return void i.updateParentNodeText();b=v,v=""}j[B]&&(e=j[B],delete j[B]),t.exclusiveFilter&&t.exclusiveFilter(i)?v=v.substr(0,i.tagPosition):(i.updateParentNodeMediaChildren(),i.updateParentNodeText(),-1!==t.selfClosing.indexOf(e)||n&&!y(e)&&["escape","recursiveEscape"].indexOf(t.disallowedTagsMode)>=0?r&&(v=b,b=""):(v+="",r&&(v=b+N(v),b=""),P=!1))}},t.parser);return R.write(e),R.end(),v;function L(){v="",B=0,k=[],M={},j={},O=!1,I=0}function N(e,n){return"string"!=typeof e&&(e+=""),t.parser.decodeEntities&&(e=e.replace(/&/g,"&").replace(//g,">"),n&&(e=e.replace(/"/g,"""))),e=e.replace(/&(?![a-zA-Z0-9#]{1,20};)/g,"&").replace(//g,">"),n&&(e=e.replace(/"/g,""")),e}function F(e,n){for(n=n.replace(/[\x00-\x20]+/g,"");;){const e=n.indexOf("\x3c!--");if(-1===e)break;const t=n.indexOf("--\x3e",e+4);if(-1===t)break;n=n.substring(0,e)+n.substring(t+3)}const i=n.match(/^([a-zA-Z][a-zA-Z0-9.\-+]*):/);if(!i)return!!n.match(/^[/\\]{2}/)&&!t.allowProtocolRelative;const r=i[1].toLowerCase();return h(t.allowedSchemesByTag,e)?-1===t.allowedSchemesByTag[e].indexOf(r):!t.allowedSchemes||-1===t.allowedSchemes.indexOf(r)}function z(e){if((e=e.replace(/^(\w+:)?\s*[\\/]\s*[\\/]/,"$1//")).startsWith("relative:"))throw new Error("relative: exploit attempt");let t="relative://relative-site";for(let e=0;e<100;e++)t+=`/${e}`;const n=new URL(e,t);return{isRelativeUrl:n&&"relative-site"===n.hostname&&"relative:"===n.protocol,url:n}}}const m={decodeEntities:!0};g.defaults={allowedTags:["address","article","aside","footer","header","h1","h2","h3","h4","h5","h6","hgroup","main","nav","section","blockquote","dd","div","dl","dt","figcaption","figure","hr","li","main","ol","p","pre","ul","a","abbr","b","bdi","bdo","br","cite","code","data","dfn","em","i","kbd","mark","q","rb","rp","rt","rtc","ruby","s","samp","small","span","strong","sub","sup","time","u","var","wbr","caption","col","colgroup","table","tbody","td","tfoot","th","thead","tr"],nonBooleanAttributes:["abbr","accept","accept-charset","accesskey","action","allow","alt","as","autocapitalize","autocomplete","blocking","charset","cite","class","color","cols","colspan","content","contenteditable","coords","crossorigin","data","datetime","decoding","dir","dirname","download","draggable","enctype","enterkeyhint","fetchpriority","for","form","formaction","formenctype","formmethod","formtarget","headers","height","hidden","high","href","hreflang","http-equiv","id","imagesizes","imagesrcset","inputmode","integrity","is","itemid","itemprop","itemref","itemtype","kind","label","lang","list","loading","low","max","maxlength","media","method","min","minlength","name","nonce","optimum","pattern","ping","placeholder","popover","popovertarget","popovertargetaction","poster","preload","referrerpolicy","rel","rows","rowspan","sandbox","scope","shape","size","sizes","slot","span","spellcheck","src","srcdoc","srclang","srcset","start","step","style","tabindex","target","title","translate","type","usemap","value","width","wrap","onauxclick","onafterprint","onbeforematch","onbeforeprint","onbeforeunload","onbeforetoggle","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextlost","oncontextmenu","oncontextrestored","oncopy","oncuechange","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onformdata","onhashchange","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onlanguagechange","onload","onloadeddata","onloadedmetadata","onloadstart","onmessage","onmessageerror","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onoffline","ononline","onpagehide","onpageshow","onpaste","onpause","onplay","onplaying","onpopstate","onprogress","onratechange","onreset","onresize","onrejectionhandled","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onslotchange","onstalled","onstorage","onsubmit","onsuspend","ontimeupdate","ontoggle","onunhandledrejection","onunload","onvolumechange","onwaiting","onwheel"],disallowedTagsMode:"discard",allowedAttributes:{a:["href","name","target"],img:["src","srcset","alt","title","width","height","loading"]},allowedEmptyAttributes:["alt"],selfClosing:["img","br","hr","area","base","basefont","input","link","meta"],allowedSchemes:["http","https","ftp","mailto","tel"],allowedSchemesByTag:{},allowedSchemesAppliedToAttributes:["href","src","cite"],allowProtocolRelative:!0,enforceHtmlBoundary:!1,parseStyleAttributes:!0},g.simpleTransform=function(e,t,n){return n=void 0===n||n,t=t||{},function(i,r){let s;if(n)for(s in t)r[s]=t[s];else r=t;return{tagName:e,attribs:r}}}},9704:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActivityMonitor=void 0;const i=n(8571);t.ActivityMonitor=class{constructor(e){this._timer=-1,this._timeout=-1,this._isDisposed=!1,this._activityStopped=new i.Signal(this),e.signal.connect(this._onSignalFired,this),this._timeout=e.timeout||1e3}get activityStopped(){return this._activityStopped}get timeout(){return this._timeout}set timeout(e){this._timeout=e}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,i.Signal.clearData(this))}_onSignalFired(e,t){clearTimeout(this._timer),this._sender=e,this._args=t,this._timer=setTimeout((()=>{this._activityStopped.emit({sender:this._sender,args:this._args})}),this._timeout)}}},8925:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),r(n(9704),t),r(n(9269),t),r(n(1232),t),r(n(9547),t),r(n(5964),t),r(n(9830),t),r(n(7361),t),r(n(8126),t),r(n(1796),t),r(n(1692),t)},9269:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1232:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LruCache=void 0,t.LruCache=class{constructor(e={}){this._map=new Map,this._maxSize=(null==e?void 0:e.maxSize)||128}get size(){return this._map.size}clear(){this._map.clear()}get(e){const t=this._map.get(e)||null;return null!=t&&(this._map.delete(e),this._map.set(e,t)),t}set(e,t){this._map.size>=this._maxSize&&this._map.delete(this._map.keys().next().value),this._map.set(e,t)}}},9547:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.MarkdownCodeBlocks=void 0,function(e){e.CODE_BLOCK_MARKER="```";const t=[".markdown",".mdown",".mkdn",".md",".mkd",".mdwn",".mdtxt",".mdtext",".text",".txt",".Rmd"];class n{constructor(e){this.startLine=e,this.code="",this.endLine=-1}}e.MarkdownCodeBlock=n,e.isMarkdown=function(e){return t.indexOf(e)>-1},e.findMarkdownCodeBlocks=function(t){if(!t||""===t)return[];const i=t.split("\n"),r=[];let s=null;for(let t=0;te===t||i&&e===i))},e.isDisabled=function(t){const n=t.indexOf(":");let i="";return-1!==n&&(i=t.slice(0,n)),e.disabled.some((e=>e===t||i&&e===i))}}(Extension=PageConfig.Extension||(PageConfig.Extension={}))})(PageConfig||(exports.PageConfig=PageConfig={}))},9830:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PathExt=void 0;const i=n(9942);var r;!function(e){function t(e){return 0===e.indexOf("/")&&(e=e.slice(1)),e}e.join=function(...e){const n=i.posix.join(...e);return"."===n?"":t(n)},e.joinWithLeadingSlash=function(...e){const t=i.posix.join(...e);return"."===t?"":t},e.basename=function(e,t){return i.posix.basename(e,t)},e.dirname=function(e){const n=t(i.posix.dirname(e));return"."===n?"":n},e.extname=function(e){return i.posix.extname(e)},e.normalize=function(e){return""===e?"":t(i.posix.normalize(e))},e.resolve=function(...e){return t(i.posix.resolve(...e))},e.relative=function(e,n){return t(i.posix.relative(e,n))},e.normalizeExtension=function(e){return e.length>0&&0!==e.indexOf(".")&&(e=`.${e}`),e},e.removeSlash=t}(r||(t.PathExt=r={}))},7361:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.signalToPromise=void 0;const i=n(5764);t.signalToPromise=function(e,t){const n=new i.PromiseDelegate;function r(){e.disconnect(s)}function s(e,t){r(),n.resolve([e,t])}return e.connect(s),(null!=t?t:0)>0&&setTimeout((()=>{r(),n.reject(`Signal not emitted within ${t} ms.`)}),t),n.promise}},8126:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.Text=void 0,function(e){e.jsIndexToCharIndex=function(e,t){return e},e.charIndexToJsIndex=function(e,t){return e},e.camelCase=function(e,t=!1){return e.replace(/^(\w)|[\s-_:]+(\w)/g,(function(e,n,i){return i?i.toUpperCase():t?n.toUpperCase():n.toLowerCase()}))},e.titleCase=function(e){return(e||"").toLowerCase().split(" ").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join(" ")}}(n||(t.Text=n={}))},1796:(e,t)=>{},1692:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.URLExt=void 0;const r=n(9942),s=i(n(2225));var o;!function(e){function t(e){if("undefined"!=typeof document&&document){const t=document.createElement("a");return t.href=e,t}return(0,s.default)(e)}function n(...e){let t=(0,s.default)(e[0],{});const n=""===t.protocol&&t.slashes;n&&(t=(0,s.default)(e[0],"https:"+e[0]));const i=`${n?"":t.protocol}${t.slashes?"//":""}${t.auth}${t.auth?"@":""}${t.host}`,o=r.posix.join(`${i&&"/"!==t.pathname[0]?"/":""}${t.pathname}`,...e.slice(1));return`${i}${"."===o?"":o}`}e.parse=t,e.getHostName=function(e){return(0,s.default)(e).hostname},e.normalize=function(e){return e&&t(e).toString()},e.join=n,e.encodeParts=function(e){return n(...e.split("/").map(encodeURIComponent))},e.objectToQueryString=function(e){const t=Object.keys(e).filter((e=>e.length>0));return t.length?"?"+t.map((t=>{const n=encodeURIComponent(String(e[t]));return t+(n?"="+n:"")})).join("&"):""},e.queryStringToObject=function(e){return e.replace(/^\?/,"").split("&").reduce(((e,t)=>{const[n,i]=t.split("=");return n.length>0&&(e[n]=decodeURIComponent(i||"")),e}),{})},e.isLocal=function(e,n=!1){const{protocol:i}=t(e);return(!i||0!==e.toLowerCase().indexOf(i))&&(n?0!==e.indexOf("//"):0!==e.indexOf("/"))}}(o||(t.URLExt=o={}))},6008:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{es:()=>rendererFactory});var _jupyterlab_rendermime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5865);const TEXT_JAVASCRIPT_MIMETYPE="text/javascript",APPLICATION_JAVASCRIPT_MIMETYPE="application/javascript";function evalInContext(code,element,document,window){return eval(code)}class ExperimentalRenderedJavascript extends _jupyterlab_rendermime__WEBPACK_IMPORTED_MODULE_0__.TS{render(e){const t=this.translator.load("jupyterlab"),n=()=>{try{const t=e.data[this.mimeType];return t&&evalInContext(t,this.node,document,window),Promise.resolve()}catch(e){return Promise.reject(e)}};if(!e.trusted){const e=document.createElement("pre");e.textContent=t.__("Are you sure that you want to run arbitrary Javascript within your JupyterLab session?");const i=document.createElement("button");return i.textContent=t.__("Run"),this.node.appendChild(e),this.node.appendChild(i),i.onclick=e=>{this.node.textContent="",n()},Promise.resolve()}return n()}}const rendererFactory={safe:!1,mimeTypes:[TEXT_JAVASCRIPT_MIMETYPE,APPLICATION_JAVASCRIPT_MIMETYPE],createRenderer:e=>new ExperimentalRenderedJavascript(e)},extension={id:"@jupyterlab/javascript-extension:factory",description:"Adds renderer for JavaScript content.",rendererFactory,rank:0,dataType:"string"};var __WEBPACK_DEFAULT_EXPORT__=extension},3328:function(e,t){!function(e){"use strict";e.JSONExt=void 0,function(e){function t(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e}function n(e){return Array.isArray(e)}function i(e,r){if(e===r)return!0;if(t(e)||t(r))return!1;var s=n(e),o=n(r);return s===o&&(s&&o?function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(var n=0,r=e.length;n>>0),e[n]=255&t,t>>>=8}e.Random=void 0,(e.Random||(e.Random={})).getRandomValues=function(){var e="undefined"!=typeof window&&(window.crypto||window.msCrypto)||null;return e&&"function"==typeof e.getRandomValues?function(t){return e.getRandomValues(t)}:r}(),e.UUID=void 0,(e.UUID||(e.UUID={})).uuid4=function(e){for(var t=new Uint8Array(16),n=new Array(256),i=0;i<16;++i)n[i]="0"+i.toString(16);for(i=16;i<256;++i)n[i]=i.toString(16);return function(){return e(t),t[6]=64|15&t[6],t[8]=128|63&t[8],n[t[0]]+n[t[1]]+n[t[2]]+n[t[3]]+"-"+n[t[4]]+n[t[5]]+"-"+n[t[6]]+n[t[7]]+"-"+n[t[8]]+n[t[9]]+"-"+n[t[10]]+n[t[11]]+n[t[12]]+n[t[13]]+n[t[14]]+n[t[15]]}}(e.Random.getRandomValues),e.MimeData=t,e.PromiseDelegate=n,e.Token=i,Object.defineProperty(e,"__esModule",{value:!0})}(t)},478:(e,t,n)=>{"use strict";n.d(t,{c:()=>D});var i,r,s,o=n(5764);function a(e){return"execute_result"===e.output_type}function l(e){return"display_data"===e.output_type}function u(e){return"stream"===e.output_type}!function(e){function t(e,t,n=0,i=-1){let r,s=e.length;if(0===s)return-1;n=n<0?Math.max(0,n+s):Math.min(n,s-1),r=(i=i<0?Math.max(0,i+s):Math.min(i,s-1))=n)return;let i=e[t];for(let i=t+1;i0;){let i=a>>1,r=o+i;n(e[r],t)<0?(o=r+1,a-=i+1):a=i}return o},e.upperBound=function(e,t,n,i=0,r=-1){let s=e.length;if(0===s)return 0;let o=i=i<0?Math.max(0,i+s):Math.min(i,s-1),a=(r=r<0?Math.max(0,r+s):Math.min(r,s-1))-i+1;for(;a>0;){let i=a>>1,r=o+i;n(e[r],t)>0?a=i:(o=r+1,a-=i+1)}return o},e.shallowEqual=function(e,t,n){if(e===t)return!0;if(e.length!==t.length)return!1;for(let i=0,r=e.length;i=o&&(n=r<0?o-1:o),void 0===i?i=r<0?-1:o:i<0?i=Math.max(i+o,r<0?-1:0):i>=o&&(i=r<0?o-1:o),s=r<0&&i>=n||r>0&&n>=i?0:r<0?Math.floor((i-n+1)/r+1):Math.floor((i-n-1)/r+1);let a=[];for(let t=0;t=(i=i<0?Math.max(0,i+r):Math.min(i,r-1)))return;let o=i-n+1;if(t>0?t%=o:t<0&&(t=(t%o+o)%o),0===t)return;let a=n+t;s(e,n,a-1),s(e,a,i),s(e,n,i)},e.fill=function(e,t,n=0,i=-1){let r,s=e.length;if(0!==s){n=n<0?Math.max(0,n+s):Math.min(n,s-1),r=(i=i<0?Math.max(0,i+s):Math.min(i,s-1))t;--n)e[n]=e[n-1];e[t]=n},e.removeAt=o,e.removeFirstOf=function(e,n,i=0,r=-1){let s=t(e,n,i,r);return-1!==s&&o(e,s),s},e.removeLastOf=function(e,t,i=-1,r=0){let s=n(e,t,i,r);return-1!==s&&o(e,s),s},e.removeAllOf=function(e,t,n=0,i=-1){let r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);let s=0;for(let o=0;o=n&&o<=i&&e[o]===t||i=n)&&e[o]===t?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s},e.removeFirstWhere=function(e,t,n=0,r=-1){let s,a=i(e,t,n,r);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeLastWhere=function(e,t,n=-1,i=0){let s,a=r(e,t,n,i);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeAllWhere=function(e,t,n=0,i=-1){let r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);let s=0;for(let o=0;o=n&&o<=i&&t(e[o],o)||i=n)&&t(e[o],o)?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s}}(i||(i={})),function(e){e.rangeLength=function(e,t,n){return 0===n?1/0:e>t&&n>0||et?1:0}}(s||(s={}));var d,c,h,p,f,g,m,v,b,A=n(8571);class y{constructor(e={}){if(this._array=[],this._isDisposed=!1,this._changed=new A.Signal(this),e.values)for(const t of e.values)this._array.push(t);this._itemCmp=e.itemCmp||d.itemCmp}get type(){return"List"}get changed(){return this._changed}get length(){return this._array.length}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,A.Signal.clearData(this),this.clear())}[Symbol.iterator](){return this._array[Symbol.iterator]()}get(e){return this._array[e]}set(e,t){const n=this._array[e];if(void 0===t)throw new Error("Cannot set an undefined item");(0,this._itemCmp)(n,t)||(this._array[e]=t,this._changed.emit({type:"set",oldIndex:e,newIndex:e,oldValues:[n],newValues:[t]}))}push(e){const t=this._array.push(e);return this._changed.emit({type:"add",oldIndex:-1,newIndex:this.length-1,oldValues:[],newValues:[e]}),t}insert(e,t){e===this._array.length?this._array.push(t):i.insert(this._array,e,t),this._changed.emit({type:"add",oldIndex:-2,newIndex:e,oldValues:[],newValues:[t]})}removeValue(e){const t=this._itemCmp,n=i.findFirstIndex(this._array,(n=>t(n,e)));return this.remove(n),n}remove(e){const t=i.removeAt(this._array,e);if(void 0!==t)return this._changed.emit({type:"remove",oldIndex:e,newIndex:-1,newValues:[],oldValues:[t]}),t}clear(){const e=this._array.slice();this._array.length=0,this._changed.emit({type:"remove",oldIndex:0,newIndex:0,newValues:[],oldValues:e})}move(e,t){if(this.length<=1||e===t)return;const n=[this._array[e]];i.move(this._array,e,t),this._changed.emit({type:"move",oldIndex:e,newIndex:t,oldValues:n,newValues:n})}pushAll(e){const t=this.length;for(const t of e)this._array.push(t);return this._changed.emit({type:"add",oldIndex:-1,newIndex:t,oldValues:[],newValues:Array.from(e)}),this.length}insertAll(e,t){const n=e;for(const n of t)i.insert(this._array,e++,n);this._changed.emit({type:"add",oldIndex:-2,newIndex:n,oldValues:[],newValues:Array.from(t)})}removeRange(e,t){const n=this._array.slice(e,t);for(let n=e;n{let t=!1;return r.then((()=>!t&&e())),()=>{t=!0}});var r;function s(e,t){let n=a.get(e);if(!n||0===n.length)return void c(e,t);let i=function(e,t){let n=0;for(const i of e)if(!1===t(i,n++))return!1;return!0}(function*(e){if("function"==typeof e.retro)yield*e.retro();else for(let t=e.length-1;t>-1;t--)yield e[t]}(n),(n=>!n||function(e,t,n){let i=!0;try{i="function"==typeof e?e(t,n):e.messageHook(t,n)}catch(e){u(e)}return i}(n,e,t)));i&&c(e,t)}e.sendMessage=s,e.postMessage=function(e,t){t.isConflatable&&function(n){for(const r of n)if((i=r).handler===e&&i.msg&&i.msg.type===t.type&&i.msg.isConflatable&&i.msg.conflate(t))return!0;var i;return!1}(o)||h(e,t)},e.installMessageHook=function(e,t){let n=a.get(e);n&&-1!==n.indexOf(t)||(n?n.push(t):a.set(e,[t]))},e.removeMessageHook=function(e,t){let n=a.get(e);if(!n)return;let i=n.indexOf(t);-1!==i&&(n[i]=null,f(n))},e.clearData=function(e){let t=a.get(e);t&&t.length>0&&(i.fill(t,null),f(t));for(const t of o)t.handler===e&&(t.handler=null,t.msg=null)},e.flush=function(){d||null===t||(t(),t=null,d=!0,p(),d=!1)},e.getExceptionHandler=function(){return u},e.setExceptionHandler=function(e){let t=u;return u=e,t};const o=new w,a=new WeakMap,l=new Set;let u=e=>{console.error(e)},d=!1;function c(e,t){try{e.processMessage(t)}catch(e){u(e)}}function h(e,i){o.addLast({handler:e,msg:i}),null===t&&(t=n(p))}function p(){if(t=null,o.isEmpty)return;let e={handler:null,msg:null};for(o.addLast(e);;){let t=o.removeFirst();if(t===e)return;t.handler&&t.msg&&s(t.handler,t.msg)}}function f(e){0===l.size&&n(g),l.add(e)}function g(){l.forEach(m),l.clear()}function m(e){i.removeAllWhere(e,v)}function v(e){return null===e}}(h||(h={}));class E{constructor(e={}){if(this._map=new Map,this._changed=new A.Signal(this),this._isDisposed=!1,this._itemCmp=e.itemCmp||p.itemCmp,e.values)for(const t in e.values)this._map.set(t,e.values[t])}get type(){return"Map"}get changed(){return this._changed}get isDisposed(){return this._isDisposed}get size(){return this._map.size}set(e,t){const n=this._map.get(e);if(void 0===t)throw Error("Cannot set an undefined value, use remove");const i=this._itemCmp;return void 0!==n&&i(n,t)||(this._map.set(e,t),this._changed.emit({type:n?"change":"add",key:e,oldValue:n,newValue:t})),n}get(e){return this._map.get(e)}has(e){return this._map.has(e)}keys(){const e=[];return this._map.forEach(((t,n)=>{e.push(n)})),e}values(){const e=[];return this._map.forEach(((t,n)=>{e.push(t)})),e}delete(e){const t=this._map.get(e);return this._map.delete(e)&&this._changed.emit({type:"remove",key:e,oldValue:t,newValue:void 0}),t}clear(){const e=this.keys();for(let t=0;t=n)return;let i=e[t];for(let i=t+1;i0;){let i=a>>1,r=o+i;n(e[r],t)<0?(o=r+1,a-=i+1):a=i}return o},e.upperBound=function(e,t,n,i=0,r=-1){let s=e.length;if(0===s)return 0;let o=i=i<0?Math.max(0,i+s):Math.min(i,s-1),a=(r=r<0?Math.max(0,r+s):Math.min(r,s-1))-i+1;for(;a>0;){let i=a>>1,r=o+i;n(e[r],t)>0?a=i:(o=r+1,a-=i+1)}return o},e.shallowEqual=function(e,t,n){if(e===t)return!0;if(e.length!==t.length)return!1;for(let i=0,r=e.length;i=o&&(n=r<0?o-1:o),void 0===i?i=r<0?-1:o:i<0?i=Math.max(i+o,r<0?-1:0):i>=o&&(i=r<0?o-1:o),s=r<0&&i>=n||r>0&&n>=i?0:r<0?Math.floor((i-n+1)/r+1):Math.floor((i-n-1)/r+1);let a=[];for(let t=0;t=(i=i<0?Math.max(0,i+r):Math.min(i,r-1)))return;let o=i-n+1;if(t>0?t%=o:t<0&&(t=(t%o+o)%o),0===t)return;let a=n+t;s(e,n,a-1),s(e,a,i),s(e,n,i)},e.fill=function(e,t,n=0,i=-1){let r,s=e.length;if(0!==s){n=n<0?Math.max(0,n+s):Math.min(n,s-1),r=(i=i<0?Math.max(0,i+s):Math.min(i,s-1))t;--n)e[n]=e[n-1];e[t]=n},e.removeAt=o,e.removeFirstOf=function(e,n,i=0,r=-1){let s=t(e,n,i,r);return-1!==s&&o(e,s),s},e.removeLastOf=function(e,t,i=-1,r=0){let s=n(e,t,i,r);return-1!==s&&o(e,s),s},e.removeAllOf=function(e,t,n=0,i=-1){let r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);let s=0;for(let o=0;o=n&&o<=i&&e[o]===t||i=n)&&e[o]===t?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s},e.removeFirstWhere=function(e,t,n=0,r=-1){let s,a=i(e,t,n,r);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeLastWhere=function(e,t,n=-1,i=0){let s,a=r(e,t,n,i);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeAllWhere=function(e,t,n=0,i=-1){let r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);let s=0;for(let o=0;o=n&&o<=i&&t(e[o],o)||i=n)&&t(e[o],o)?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s}}(g||(g={})),function(e){e.rangeLength=function(e,t,n){return 0===n?1/0:e>t&&n>0||et?1:0}}(v||(v={}));class D{constructor(e={}){if(this.clearNext=!1,this._lastStream="",this._trusted=!1,this._isDisposed=!1,this._stateChanged=new A.Signal(this),this._changed=new A.Signal(this),this._trusted=!!e.trusted,this.contentFactory=e.contentFactory||D.defaultContentFactory,this.list=new y,e.values)for(const t of e.values){const e=this._add(t)-1;this.list.get(e).changed.connect(this._onGenericChange,this)}this.list.changed.connect(this._onListChanged,this)}get stateChanged(){return this._stateChanged}get changed(){return this._changed}get length(){return this.list?this.list.length:0}get trusted(){return this._trusted}set trusted(e){if(e===this._trusted)return;const t=this._trusted=e;for(let e=0;e{e.changed.connect(this._onGenericChange,this)}));break;case"remove":t.oldValues.forEach((e=>{e.changed.disconnect(this._onGenericChange,this)}));break;case"set":t.newValues.forEach((e=>{e.changed.connect(this._onGenericChange,this)})),t.oldValues.forEach((e=>{e.changed.disconnect(this._onGenericChange,this)}))}this._changed.emit(t)}_onGenericChange(e){let t,n=null;for(t=0;t-1;){const t=e.match(/^(.*)\r+/m)[1];let n=e.match(/\r+(.*)$/m)[1];n+=t.slice(n.length,t.length),e=e.replace(/\r+.*$/m,"\r").replace(/^.*\r/m,n)}return e}(function(e){let t=e;do{t=(e=t).replace(/[^\n]\x08/gm,"")}while(t.length{"use strict";n.d(t,{Bw:()=>f});var i=n(1670),r=n(8571),s=n(5070);class o{constructor(e){this._currentChanged=new r.Signal(this),this._deferred=null,this._isDisposed=!1,this._widgetAdded=new r.Signal(this),this._widgetUpdated=new r.Signal(this);const t=this._focusTracker=new s.$x,n=this._pool=new i.RestorablePool(e);this.namespace=e.namespace,t.currentChanged.connect(((e,t)=>{t.newValue!==this.currentWidget&&(n.current=t.newValue)}),this),n.added.connect(((e,t)=>{this._widgetAdded.emit(t)}),this),n.currentChanged.connect(((e,i)=>{null===i&&t.currentWidget?n.current=t.currentWidget:(this.onCurrentChanged(i),this._currentChanged.emit(i))}),this),n.updated.connect(((e,t)=>{this._widgetUpdated.emit(t)}),this)}get currentChanged(){return this._currentChanged}get currentWidget(){return this._pool.current||null}get restored(){return this._deferred?Promise.resolve():this._pool.restored}get size(){return this._pool.size}get widgetAdded(){return this._widgetAdded}get widgetUpdated(){return this._widgetUpdated}async add(e){this._focusTracker.add(e),await this._pool.add(e),this._focusTracker.activeWidget||(this._pool.current=e)}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,this._pool.dispose(),this._focusTracker.dispose(),r.Signal.clearData(this))}find(e){return this._pool.find(e)}forEach(e){return this._pool.forEach(e)}filter(e){return this._pool.filter(e)}inject(e){return this._pool.inject(e)}has(e){return this._pool.has(e)}async restore(e){const t=this._deferred;return t?(this._deferred=null,this._pool.restore(t)):e?this._pool.restore(e):void console.warn("No options provided to restore the tracker.")}defer(e){this._deferred=e}async save(e){return this._pool.save(e)}onCurrentChanged(e){}}var a=n(7883),l=n(509),u=n(5764),d=n(6573);const c="jp-OutputArea-child",h="jp-OutputArea-output",p="jp-OutputArea-prompt";class f extends s.x0{constructor(e){var t,n,i,a;super(),this.outputLengthChanged=new r.Signal(this),this._onIOPub=e=>{const t=this.model,n=e.header.msg_type;let i;const r=(e.content.transient||{}).display_id;let s;switch(n){case"execute_result":case"display_data":case"stream":case"error":i={...e.content,output_type:n},t.add(i);break;case"clear_output":{const n=e.content.wait;t.clear(n);break}case"update_display_data":if(i={...e.content,output_type:"display_data"},s=this._displayIdMap.get(r),s)for(const e of s)t.set(e,i);break;case"status":"idle"===e.content.execution_state&&(this._pendingInput=!1)}r&&"display_data"===n&&(s=this._displayIdMap.get(r)||[],s.push(t.length-1),this._displayIdMap.set(r,s))},this._onExecuteReply=e=>{const t=this.model,n=e.content;if("ok"!==n.status)return;const i=n&&n.payload;if(!i||!i.length)return;const r=i.filter((e=>"page"===e.source));if(!r.length)return;const s={output_type:"display_data",data:JSON.parse(JSON.stringify(r[0])).data,metadata:{}};t.add(s)},this._displayIdMap=new Map,this._minHeightTimeout=null,this._inputRequested=new r.Signal(this),this._toggleScrolling=new r.Signal(this),this._initialize=new r.Signal(this),this._outputTracker=new o({namespace:u.UUID.uuid4()}),this._inputHistoryScope="global",this._pendingInput=!1,super.layout=new s.DG,this.addClass("jp-OutputArea"),this.contentFactory=null!==(t=e.contentFactory)&&void 0!==t?t:f.defaultContentFactory,this.rendermime=e.rendermime,this._maxNumberOutputs=null!==(n=e.maxNumberOutputs)&&void 0!==n?n:1/0,this._translator=null!==(i=e.translator)&&void 0!==i?i:l.wK,this._inputHistoryScope=null!==(a=e.inputHistoryScope)&&void 0!==a?a:"global";const d=this.model=e.model;for(let e=0;e{this._pendingInput=!1})).catch((()=>{})),this.model.clear(),this.widgets.length&&(this._clear(),this.outputLengthChanged.emit(Math.min(this.model.length,this._maxNumberOutputs))),e.onIOPub=this._onIOPub,e.onReply=this._onExecuteReply,e.onStdin=t=>{a.KernelMessage.isInputRequestMsg(t)&&this.onInputRequest(t,e)})}get inputRequested(){return this._inputRequested}get pendingInput(){return this._pendingInput}get maxNumberOutputs(){return this._maxNumberOutputs}set maxNumberOutputs(e){if(e<=0)return void console.warn("OutputArea.maxNumberOutputs must be strictly positive.");const t=this._maxNumberOutputs;this._maxNumberOutputs=e,t{this._toggleScrolling.emit()})),this.node.appendChild(e),requestAnimationFrame((()=>{this._initialize.emit()}))}_moveDisplayIdIndices(e,t){this._displayIdMap.forEach((n=>{const i=e+t;for(let r=n.length-1;r>=0;--r){const s=n[r];s>=e&&s=i&&(n[r]-=t)}}))}onStateChanged(e,t){const n=Math.min(this.model.length,this._maxNumberOutputs);if(t){if(t>=this._maxNumberOutputs)return;this._setOutput(t,this.model.get(t))}else for(let e=0;e{this.isDisposed||(this.node.style.minHeight="")}),50)}onInputRequest(e,t){const n=this.contentFactory,i=e.content.prompt,r=e.content.password,o=new s.Zk;o.addClass(c),o.addClass("jp-OutputArea-stdin-item");const a=n.createOutputPrompt();a.addClass(p),o.addWidget(a),this._pendingInput=!0;const l=n.createStdin({parent_header:e.header,prompt:i,password:r,future:t,translator:this._translator,inputHistoryScope:this._inputHistoryScope});l.addClass(h),o.addWidget(l),this.model.length>=this.maxNumberOutputs&&(this.maxNumberOutputs=this.model.length),this._inputRequested.emit(l);const u=l.node.getElementsByTagName("input")[0];l.value.then((e=>{this.model.length>=this.maxNumberOutputs&&(this.maxNumberOutputs=this.model.length+1),o.addClass("jp-OutputArea-stdin-hiding"),this.model.add({output_type:"stream",name:"stdin",text:e+"\n"}),u.focus(),this._pendingInput=!1,window.setTimeout((()=>{const e=document.activeElement;o.dispose(),e&&e instanceof HTMLElement&&e.focus()}),500)})),this.layout.addWidget(o)}_setOutput(e,t){if(e>=this._maxNumberOutputs)return;const n=this.layout.widgets[e],i=n.widgets?n.widgets.filter((e=>"renderModel"in e)).pop():n,r=this.rendermime.preferredMimeType(t.data,t.trusted?"any":"ensure");v.currentPreferredMimetype.get(i)===r&&f.isIsolated(r,t.metadata)===i instanceof v.IsolatedRenderer?i.renderModel(t):(this.layout.widgets[e].dispose(),this._insertOutput(e,t))}_insertOutput(e,t){if(e>this._maxNumberOutputs)return;const n=this.layout;if(e===this._maxNumberOutputs){const t=new v.TrimmedOutputs(this._maxNumberOutputs,(()=>{const e=this._maxNumberOutputs;this._maxNumberOutputs=1/0,this._showTrimmedOutputs(e)}));n.insertWidget(e,this._wrappedOutput(t))}else{let i=this.createOutputItem(t);i?i.toggleClass("jp-OutputArea-executeResult",null!==t.executionCount):i=new s.x0,this._outputTracker.has(i)||this._outputTracker.add(i),n.insertWidget(e,i)}}get outputTracker(){return this._outputTracker}_showTrimmedOutputs(e){this.widgets[e].dispose();for(let t=e;t{const t=document.createElement("pre"),i=this._translator.load("jupyterlab");t.textContent=i.__("Javascript Error: %1",e.message),n.node.appendChild(t),n.node.className="lm-Widget jp-RenderedText",n.node.setAttribute("data-mime-type","application/vnd.jupyter.stderr")})),n}_wrappedOutput(e,t=null){const n=new v.OutputPanel;n.addClass(c);const i=this.contentFactory.createOutputPrompt();return i.executionCount=t,i.addClass(p),n.addWidget(i),e.addClass(h),n.addWidget(e),n}}!function(e){e.execute=async function(e,t,n,i){var r;let s=!0;i&&Array.isArray(i.tags)&&-1!==i.tags.indexOf("raises-exception")&&(s=!1);const o={code:e,stop_on_error:s},a=null===(r=n.session)||void 0===r?void 0:r.kernel;if(!a)throw new Error("Session has no kernel.");const l=a.requestExecute(o,!1,i);return t.future=l,l.done},e.isIsolated=function(e,t){const n=t[e];return n&&void 0!==n.isolated?!!n.isolated:!!t.isolated};class t{createOutputPrompt(){return new g}createStdin(e){return new m(e)}}e.ContentFactory=t,e.defaultContentFactory=new t}(f||(f={}));class g extends s.x0{constructor(){super(),this._executionCount=null,this.addClass("jp-OutputPrompt")}get executionCount(){return this._executionCount}set executionCount(e){this._executionCount=e,this.node.textContent=null===e?"":`[${e}]:`}}class m extends s.x0{static _historyIx(e,t){const n=m._history.get(e);if(!n)return;const i=n.length;return t<=0?i+t:void 0}static _historyAt(e,t){const n=m._history.get(e);if(!n)return;const i=n.length,r=m._historyIx(e,t);return void 0!==r&&r1e3&&n.shift()}static _historySearch(e,t,n,i=!0){const r=m._history.get(e),s=r.length,o=m._historyIx(e,n),a=e=>-1!==e.search(t);if(void 0!==o)if(i){if(0===o)return;const e=r.slice(0,o).findLastIndex(a);if(-1!==e)return e-s}else{if(o>=s-1)return;const e=r.slice(o+1).findIndex(a);if(-1!==e)return e-s+o+1}}constructor(e){var t;super({node:v.createInputWidgetNode(e.prompt,e.password)}),this._promise=new u.PromiseDelegate,this._resolved=!1,this.addClass("jp-Stdin"),this._future=e.future,this._historyIndex=0,this._historyKey="session"===e.inputHistoryScope?e.parent_header.session:"",this._historyPat="",this._parentHeader=e.parent_header,this._password=e.password,this._trans=(null!==(t=e.translator)&&void 0!==t?t:l.wK).load("jupyterlab"),this._value=e.prompt+" ",this._input=this.node.getElementsByTagName("input")[0],this._password?this._input.placeholder="":this._input.placeholder=this._trans.__("↑↓ for history. Search history with c-↑/c-↓"),m._history.has(this._historyKey)||m._history.set(this._historyKey,[])}get value(){return this._promise.promise.then((()=>this._value))}handleEvent(e){if(this._resolved)return void e.preventDefault();const t=this._input;if("keydown"===e.type)if("Enter"===e.key)this.resetSearch(),this._future.sendInputReply({status:"ok",value:t.value},this._parentHeader),this._password?this._value+="········":(this._value+=t.value,m._historyPush(this._historyKey,t.value)),this._resolved=!0,this._promise.resolve(void 0);else if("Escape"===e.key)this.resetSearch(),t.blur();else if(!e.ctrlKey||"ArrowUp"!==e.key&&"ArrowDown"!==e.key){if("ArrowUp"===e.key){this.resetSearch();const n=m._historyAt(this._historyKey,this._historyIndex-1);n&&(0===this._historyIndex&&(this._valueCache=t.value),this._setInputValue(n),--this._historyIndex,e.preventDefault())}else if("ArrowDown"===e.key)if(this.resetSearch(),0===this._historyIndex);else if(-1===this._historyIndex)this._setInputValue(this._valueCache),++this._historyIndex;else{const e=m._historyAt(this._historyKey,this._historyIndex+1);e&&(this._setInputValue(e),++this._historyIndex)}}else{""===this._historyPat&&(this._historyPat=t.value);const n="ArrowUp"===e.key,i=m._historySearch(this._historyKey,this._historyPat,this._historyIndex,n);if(void 0!==i){const n=m._historyAt(this._historyKey,i);void 0!==n&&(0===this._historyIndex&&(this._valueCache=t.value),this._setInputValue(n),this._historyIndex=i,e.preventDefault())}}}resetSearch(){this._historyPat=""}onAfterAttach(e){this._input.addEventListener("keydown",this),this._input.focus()}onBeforeDetach(e){this._input.removeEventListener("keydown",this)}_setInputValue(e){this._input.value=e,this._input.setSelectionRange(e.length,e.length)}}var v;m._history=new Map,function(e){e.createInputWidgetNode=function(e,t){const n=document.createElement("div"),i=document.createElement("pre");i.className="jp-Stdin-prompt",i.textContent=e;const r=document.createElement("input");return r.className="jp-Stdin-input",t&&(r.type="password"),n.appendChild(i),i.appendChild(r),n};class t extends s.x0{constructor(e){super({node:document.createElement("iframe")}),this.addClass("jp-mod-isolated"),this._wrapped=e;const t=this.node;t.frameBorder="0",t.scrolling="auto",t.addEventListener("load",(()=>{t.contentDocument.open(),t.contentDocument.write(this._wrapped.node.innerHTML),t.contentDocument.close();const e=t.contentDocument.body;t.style.height=`${e.scrollHeight}px`,t.heightChangeObserver=new ResizeObserver((()=>{t.style.height=`${e.scrollHeight}px`})),t.heightChangeObserver.observe(e)}))}renderModel(e){return this._wrapped.renderModel(e)}}e.IsolatedRenderer=t,e.currentPreferredMimetype=new d.AttachedProperty({name:"preferredMimetype",create:e=>""});class n extends s.Zk{constructor(e){super(e)}_onContext(e){this.node.focus()}onAfterAttach(e){super.onAfterAttach(e),this.node.addEventListener("contextmenu",this._onContext.bind(this))}onBeforeDetach(e){super.onAfterDetach(e),this.node.removeEventListener("contextmenu",this._onContext.bind(this))}}e.OutputPanel=n;class i extends s.x0{constructor(e,t){const n=document.createElement("div"),i=`The first ${e} are displayed`;n.insertAdjacentHTML("afterbegin",`\n
Show more outputs
\n
`),super({node:n}),this._onClick=t,this.addClass("jp-TrimmedOutputs"),this.addClass("jp-RenderedHTMLCommon")}handleEvent(e){"click"===e.type&&this._onClick(e)}onAfterAttach(e){super.onAfterAttach(e),this.node.addEventListener("click",this)}onBeforeDetach(e){super.onBeforeDetach(e),this.node.removeEventListener("click",this)}}e.TrimmedOutputs=i}(v||(v={}))},5865:(e,t,n)=>{"use strict";n.d(t,{A6:()=>B,TH:()=>E,vf:()=>x,TS:()=>k,Kc:()=>C,jL:()=>D,Yk:()=>S,Vx:()=>T});var i=n(509),r=n(5070),s=n(8925),o=n(9452),a=n.n(o);const l=/(\$\$?|\\(?:begin|end)\{[a-z]*\*?\}|\\[{}$]|[{}]|(?:\n\s*)+|@@\d+@@|\\\\(?:\(|\)|\[|\]))/i;function u(e,t,n,i,r){let s=r.slice(e,t+1).join("").replace(/&/g,"&").replace(//g,">");for(navigator&&"Microsoft Internet Explorer"===navigator.appName&&(s=s.replace(/(%[^\n]*)\n/g,"$1
\n"));t>e;)r[t]="",t--;return r[e]="@@"+i.length+"@@",n&&(s=n(s)),i.push(s),r}function d(e){let{host:t,source:n,trusted:r,sanitizer:s,resolver:o,linkHandler:a,shouldTypeset:l,latexTypesetter:u,translator:d}=e;d=d||i.wK;const c=null==d?void 0:d.load("jupyterlab");let h,f=n;if(!n)return t.textContent="",Promise.resolve(void 0);if(r||(f=`${n}`,n=s.sanitize(n)),t.innerHTML=n,t.getElementsByTagName("script").length>0)if(r)p.evalInnerHTMLScriptTags(t);else{const e=document.createElement("div"),n=document.createElement("pre");n.textContent=c.__("This HTML output contains inline scripts. Are you sure that you want to run arbitrary Javascript within your JupyterLab session?");const i=document.createElement("button");i.textContent=c.__("Run"),i.onclick=e=>{t.innerHTML=f,p.evalInnerHTMLScriptTags(t),t.firstChild&&t.removeChild(t.firstChild)},e.appendChild(n),e.appendChild(i),t.insertBefore(e,t.firstChild)}return p.handleDefaults(t,o),h=o?p.handleUrls(t,o,a):Promise.resolve(void 0),h.then((()=>{l&&u&&u.typeset(t)}))}async function c(e){const{host:t,source:n,markdownParser:i,...r}=e;if(!n)return void(t.textContent="");let s="";if(i){const e=function(e){const t=[];let n,i=null,r=null,s=null,o=0;e.includes("`")||e.includes("~~~")?(e=e.replace(/~/g,"~T").replace(/^(?`{3,}|(~T){3,})[^`\n]*\n([\s\S]*?)^\k`*$/gm,(e=>e.replace(/\$/g,"~D"))).replace(/(^|[^\\])(`+)([^\n]*?[^`\n])\2(?!`)/gm,(e=>e.replace(/\$/g,"~D"))),n=e=>e.replace(/~([TD])/g,((e,t)=>"T"===t?"~":"$"))):n=e=>e;let a=e.replace(/\r\n?/g,"\n").split(l);for(let e=1,l=a.length;e{let n=a[t];return"\\\\("===n.substr(0,3)&&"\\\\)"===n.substr(n.length-3)?n="\\("+n.substring(3,n.length-3)+"\\)":"\\\\["===n.substr(0,3)&&"\\\\]"===n.substr(n.length-3)&&(n="\\["+n.substring(3,n.length-3)+"\\]"),n}))}else s=`
${n}
`;var o,a;await d({host:t,source:s,...r}),p.headerAnchors(t)}var h,p;!function(e){e.createHeaderId=function(e){var t;return(null!==(t=e.textContent)&&void 0!==t?t:"").replace(/ /g,"-")}}(c||(c={})),function(e){const t="\\u0000-\\u0020\\u007f-\\u009f";e.webLinkRegex=new RegExp("(?(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\\/\\/|data:|www\\.)[^\\s"+t+'"]{2,}[^\\s'+t+"\"'(){}\\[\\],:;.!?])","ug");const n=new RegExp(`(${/(?:[a-zA-Z]:(?:(?:\\|\/)[\w\.-]*)+)/.source}|${/(?:(?:\~|\.)(?:(?:\\|\/)[\w\.-]*)+)/.source})`),i=navigator.userAgent.indexOf("Windows")>=0;e.pathLinkRegex=new RegExp(`(?${i?n.source:/((?:\~|\.)?(?:\/[\w\.-]*)+)/.source})${/(?:(?:\:|", line )(?[\d]+))?(?:\:(?[\d]+))?/.source}`,"g")}(h||(h={}));class f{constructor(){this.regex=h.webLinkRegex}createAnchor(e,t){const n=document.createElement("a");return n.href=e.startsWith("www.")?"https://"+e:e,n.rel="noopener",n.target="_blank",n.appendChild(document.createTextNode(t)),n}processPath(e){const t=e.slice(-1),n=-1!==[">","<"].indexOf(t)?e.length-1:e.length;return e.slice(0,n)}processLabel(e){return this.processPath(e)}}class g{constructor(){this.regex=h.pathLinkRegex}createAnchor(e,t,n){const i=document.createElement("a");i.dataset.path=e;const r=parseInt(n.line,10);let s=isNaN(r)?"":"line="+(r-1);return i.dataset.locator=s,i.appendChild(document.createTextNode(t)),i}}function m(e,t){const n=[];t.checkWeb&&n.push(new f),t.checkPaths&&n.push(new g);const i=[],r=(e,t)=>{if(t>=n.length)return void i.push(document.createTextNode(e));const s=n[t];let o,a=0;const l=s.regex;for(l.lastIndex=0;null!=(o=l.exec(e));){const n=e.substring(a,o.index);n&&r(n,t+1);const{path:l,...u}=o.groups,d=s.processPath?s.processPath(l):l,c=s.processLabel?s.processLabel(o[0]):o[0];i.push(s.createAnchor(d,c,u)),a=o.index+c.length}const u=e.substring(a);u&&r(u,t+1)};return r(e,0),i}function v(e,t){var n,i;const r=e.cloneNode();r.textContent=null===(n=e.textContent)||void 0===n?void 0:n.slice(0,t);const s=e.cloneNode();return s.textContent=null===(i=e.textContent)||void 0===i?void 0:i.slice(t),{pre:r,post:s}}function*b(e){var t;let n,i=0;for(let r of e)n=i+((null===(t=r.textContent)||void 0===t?void 0:t.length)||0),yield{node:r,start:i,end:n,isText:r.nodeType===Node.TEXT_NODE},i=n}function A(e){var t,n;const{host:i,sanitizer:r,source:s}=e,o=r.sanitize(p.ansiSpan(s),{allowedTags:["span"]}),a=document.createElement("pre");a.innerHTML=o;const l=a.textContent;let u;if(l){const e=null===(n=null===(t=r.getAutolink)||void 0===t?void 0:t.call(r))||void 0===n||n?m(l,{checkWeb:!0,checkPaths:!1}):[document.createTextNode(o)];u=y(Array.from(a.childNodes),e)}else u=document.createElement("pre");return i.appendChild(u),Promise.resolve(void 0)}function y(e,t){const n=document.createElement("pre");let i=!1;const r=[];for(let n of function*(e,t){var n,i;let r=b(e),s=b(t),o=r.next(),a=s.next();for(;!o.done&&!a.done;){let e=o.value,t=a.value;if(e.isText&&e.start<=t.start&&e.end>=t.end)yield[null,t.node],a=s.next();else if(t.isText&&t.start<=e.start&&t.end>=e.end)yield[e.node,null],o=r.next();else if(e.end===t.end&&e.start===t.start)yield[e.node,t.node],o=r.next(),a=s.next();else if(e.end>t.end){let{pre:i,post:r}=v(e.node,t.end-e.start);t.starte.end))throw new Error(`Unexpected intersection: ${JSON.stringify(e)} ${JSON.stringify(t)}`);{let{pre:n,post:s}=v(t.node,e.end-t.start);e.start{const r=decodeURIComponent(i);return n&&n.handleLink(e,r,o),t.getDownloadUrl(i)})).then((t=>{e.href=t+o})).catch((t=>{e.href=""}))}async function i(e,t,n){let i=e.dataset.path||"",r=e.dataset.locator?"#"+e.dataset.locator:"";delete e.dataset.path,delete e.dataset.locator;const o=!0,a=t.isLocal?t.isLocal(i,o):s.URLExt.isLocal(i,o);if(!(i&&a&&t.resolvePath&&n&&n.handlePath))return e.replaceWith(...e.childNodes),Promise.resolve(void 0);try{const s=await t.resolvePath(i);if(!s)return console.log("Path resolution bailing: does not exist"),Promise.resolve(void 0);n.handlePath(e,s.path,s.scope,r),e.href=s.path+r}catch(t){console.warn("Path anchor error:",t),e.href="#linking-failed-see-console"}}e.evalInnerHTMLScriptTags=function(e){const t=Array.from(e.getElementsByTagName("script"));for(const e of t){if(!e.parentNode)continue;const t=document.createElement("script"),n=e.attributes;for(let e=0,i=n.length;e{}))},e.handlePaths=async function(e,t,n){const r=e.getElementsByTagName("a");for(let e=0;e"),a.push(e),a.push("")):a.push(e)}}function l(e){let t,n,i;const r=e.shift();if(2===r&&e.length>=3){if(t=e.shift(),n=e.shift(),i=e.shift(),[t,n,i].some((e=>e<0||255=1))throw new RangeError("Invalid extended color specification");{const r=e.shift();if(r<0)throw new RangeError("Color index must be >= 0");if(r<16)return r;if(r<232)t=Math.floor((r-16)/36),t=t>0?55+40*t:0,n=Math.floor((r-16)%36/6),n=n>0?55+40*n:0,i=(r-16)%6,i=i>0?55+40*i:0;else{if(!(r<256))throw new RangeError("Color index must be < 256");t=n=i=10*(r-232)+8}}}return[t,n,i]}e.ansiSpan=function(e){const t=/\x1b\[(.*?)([@-~])/g;let n,i=[],r=[],s=!1,u=!1,d=!1;const c=[],h=[];let p=0;for(e=a()(e),e+="";n=t.exec(e);){if("m"===n[2]){const e=n[1].split(";");for(let t=0;t{this.latexTypesetter&&this.latexTypesetter.typeset(this.node)})).catch(console.warn)}}class C extends w{constructor(e){super(e),this._rendered=Promise.resolve(),this.addClass("jp-RenderedLatex")}render(e){return this._rendered=function(e){const{host:t,source:n,shouldTypeset:i,latexTypesetter:r}=e;return t.textContent=n,i&&r&&r.typeset(t),Promise.resolve(void 0)}({host:this.node,source:String(e.data[this.mimeType]),shouldTypeset:this.isAttached,latexTypesetter:this.latexTypesetter})}onAfterAttach(e){this._rendered.then((()=>{this.latexTypesetter&&this.latexTypesetter.typeset(this.node)})).catch(console.warn)}}class x extends w{constructor(e){super(e),this.addClass("jp-RenderedImage")}render(e){const t=e.metadata[this.mimeType];return function(e){const{host:t,mimeType:n,source:i,width:r,height:s,needsBackground:o,unconfined:a}=e;t.textContent="";const l=document.createElement("img");return l.src=`data:${n};base64,${i}`,"number"==typeof s&&(l.height=s),"number"==typeof r&&(l.width=r),"light"===o?l.classList.add("jp-needs-light-background"):"dark"===o&&l.classList.add("jp-needs-dark-background"),!0===a&&l.classList.add("jp-mod-unconfined"),t.appendChild(l),Promise.resolve(void 0)}({host:this.node,mimeType:this.mimeType,source:String(e.data[this.mimeType]),width:t&&t.width,height:t&&t.height,needsBackground:e.metadata.needs_background,unconfined:t&&t.unconfined})}}class D extends _{constructor(e){super(e),this._rendered=Promise.resolve(),this.addClass("jp-RenderedMarkdown")}render(e){return this._rendered=c({host:this.node,source:String(e.data[this.mimeType]),trusted:e.trusted,resolver:this.resolver,sanitizer:this.sanitizer,linkHandler:this.linkHandler,shouldTypeset:this.isAttached,latexTypesetter:this.latexTypesetter,markdownParser:this.markdownParser,translator:this.translator})}async renderModel(e){await super.renderModel(e,!0)}onAfterAttach(e){this._rendered.then((()=>{this.latexTypesetter&&this.latexTypesetter.typeset(this.node)})).catch(console.warn)}}class S extends w{constructor(e){super(e),this._rendered=Promise.resolve(),this.addClass("jp-RenderedSVG")}render(e){const t=e.metadata[this.mimeType];return this._rendered=function(e){let{host:t,source:n,trusted:i,unconfined:r}=e;if(!n)return t.textContent="",Promise.resolve(void 0);if(!i)return t.textContent="Cannot display an untrusted SVG. Maybe you need to run the cell?",Promise.resolve(void 0);n.search("]+xmlns=[^>]+svg")<0&&(n=n.replace("{this.latexTypesetter&&this.latexTypesetter.typeset(this.node)})).catch(console.warn)}}class T extends w{constructor(e){super(e),this.addClass("jp-RenderedText")}render(e){return A({host:this.node,sanitizer:this.sanitizer,source:String(e.data[this.mimeType]),translator:this.translator})}}class B extends w{constructor(e){super(e),this.addClass("jp-RenderedText")}render(e){return function(e){var t,n;const{host:i,linkHandler:r,sanitizer:s,resolver:o,source:a}=e,l=s.sanitize(p.ansiSpan(a),{allowedTags:["span"]}),u=document.createElement("pre");u.innerHTML=l;const d=u.textContent;let c,h;if(d){const e=null===(n=null===(t=s.getAutolink)||void 0===t?void 0:t.call(s))||void 0===n||n?m(d,{checkWeb:!0,checkPaths:!0}):[document.createTextNode(l)];c=y(Array.from(u.childNodes),e)}else c=document.createElement("pre");return i.appendChild(c),h=o?p.handlePaths(i,o,r):Promise.resolve(void 0),h}({host:this.node,sanitizer:this.sanitizer,source:String(e.data[this.mimeType]),linkHandler:this.linkHandler,resolver:this.resolver,translator:this.translator})}}class k extends w{constructor(e){super(e),this.addClass("jp-RenderedJavaScript")}render(e){const t=this.translator.load("jupyterlab");return A({host:this.node,sanitizer:this.sanitizer,source:t.__("JavaScript output is disabled in JupyterLab"),translator:this.translator})}}},3867:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseManager=void 0;const i=n(8571),r=n(2920);t.BaseManager=class{constructor(e){var t;this._isDisposed=!1,this._disposed=new i.Signal(this),this.serverSettings=null!==(t=e.serverSettings)&&void 0!==t?t:r.ServerConnection.makeSettings()}get disposed(){return this._disposed}get isDisposed(){return this._isDisposed}get isActive(){return!0}dispose(){this.isDisposed||(this._isDisposed=!0,this._disposed.emit(void 0),i.Signal.clearData(this))}}},4219:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BuildManager=void 0;const i=n(8925),r=n(2920);t.BuildManager=class{constructor(e={}){var t;this._url="",this.serverSettings=null!==(t=e.serverSettings)&&void 0!==t?t:r.ServerConnection.makeSettings();const{baseUrl:n,appUrl:s}=this.serverSettings;this._url=i.URLExt.join(n,s,"api/build")}get isAvailable(){return"true"===i.PageConfig.getOption("buildAvailable").toLowerCase()}get shouldCheck(){return"true"===i.PageConfig.getOption("buildCheck").toLowerCase()}getStatus(){const{_url:e,serverSettings:t}=this;return r.ServerConnection.makeRequest(e,{},t).then((e=>{if(200!==e.status)throw new r.ServerConnection.ResponseError(e);return e.json()})).then((e=>{if("string"!=typeof e.status)throw new Error("Invalid data");if("string"!=typeof e.message)throw new Error("Invalid data");return e}))}build(){const{_url:e,serverSettings:t}=this;return r.ServerConnection.makeRequest(e,{method:"POST"},t).then((e=>{if(400===e.status)throw new r.ServerConnection.ResponseError(e,"Build aborted");if(200!==e.status){const t=`Build failed with ${e.status}.\n\n If you are experiencing the build failure after installing an extension (or trying to include previously installed extension after updating JupyterLab) please check the extension repository for new installation instructions as many extensions migrated to the prebuilt extensions system which no longer requires rebuilding JupyterLab (but uses a different installation procedure, typically involving a package manager such as 'pip' or 'conda').\n\n If you specifically intended to install a source extension, please run 'jupyter lab build' on the server for full output.`;throw new r.ServerConnection.ResponseError(e,t)}}))}cancel(){const{_url:e,serverSettings:t}=this;return r.ServerConnection.makeRequest(e,{method:"DELETE"},t).then((e=>{if(204!==e.status)throw new r.ServerConnection.ResponseError(e)}))}}},2170:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConfigWithDefaults=t.ConfigSection=void 0;const i=n(8925),r=n(7883);var s;!function(e){e.create=function(e){const t=new o(e);return t.load().then((()=>t))}}(s||(t.ConfigSection=s={}));class o{constructor(e){var t;this._url="unknown";const n=this.serverSettings=null!==(t=e.serverSettings)&&void 0!==t?t:r.ServerConnection.makeSettings();this._url=i.URLExt.join(n.baseUrl,"api/config",encodeURIComponent(e.name))}get data(){return this._data}async load(){const e=await r.ServerConnection.makeRequest(this._url,{},this.serverSettings);if(200!==e.status)throw await r.ServerConnection.ResponseError.create(e);this._data=await e.json()}async update(e){this._data={...this._data,...e};const t={method:"PATCH",body:JSON.stringify(e)},n=await r.ServerConnection.makeRequest(this._url,t,this.serverSettings);if(200!==n.status)throw await r.ServerConnection.ResponseError.create(n);return this._data=await n.json(),this._data}}t.ConfigWithDefaults=class{constructor(e){var t,n;this._className="",this._section=e.section,this._defaults=null!==(t=e.defaults)&&void 0!==t?t:{},this._className=null!==(n=e.className)&&void 0!==n?n:""}get(e){const t=this._classData();return e in t?t[e]:this._defaults[e]}set(e,t){const n={};if(n[e]=t,this._className){const e={};return e[this._className]=n,this._section.update(e)}return this._section.update(n)}_classData(){const e=this._section.data;return this._className&&this._className in e?e[this._className]:e}}},8790:(e,t)=>{},9480:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EventManager=void 0;const i=n(8925),r=n(6049),s=n(8571),o=n(2920),a="api/events";t.EventManager=class{constructor(e={}){var t;this._socket=null,this.serverSettings=null!==(t=e.serverSettings)&&void 0!==t?t:o.ServerConnection.makeSettings(),this._poll=new r.Poll({factory:()=>this._subscribe()}),this._stream=new s.Stream(this),this._poll.start()}get isDisposed(){return this._poll.isDisposed}get stream(){return this._stream}dispose(){if(this.isDisposed)return;this._poll.dispose();const e=this._socket;e&&(this._socket=null,e.onopen=()=>{},e.onerror=()=>{},e.onmessage=()=>{},e.onclose=()=>{},e.close()),s.Signal.clearData(this),this._stream.stop()}async emit(e){const{serverSettings:t}=this,{baseUrl:n}=t,{makeRequest:r,ResponseError:s}=o.ServerConnection,l=i.URLExt.join(n,a),u={body:JSON.stringify(e),method:"POST"},d=await r(l,u,t);if(204!==d.status)throw new s(d)}_subscribe(){return new Promise(((e,t)=>{if(this.isDisposed)return;const{appendToken:n,token:r,WebSocket:s,wsUrl:o}=this.serverSettings;let l=i.URLExt.join(o,a,"subscribe");n&&""!==r&&(l+=`?token=${encodeURIComponent(r)}`);const u=this._socket=new s(l),d=this._stream;u.onclose=()=>t(new Error("EventManager socket closed")),u.onmessage=e=>e.data&&d.emit(JSON.parse(e.data))}))}}},7883:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),r(n(3867),t),r(n(2170),t),r(n(8790),t),r(n(9480),t),r(n(973),t),r(n(2946),t),r(n(9740),t),r(n(2920),t),r(n(7668),t),r(n(7780),t),r(n(9040),t),r(n(9191),t),r(n(8053),t),r(n(8683),t)},7489:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.CommHandler=void 0;const o=n(7556),a=s(n(9909));class l extends o.DisposableDelegate{constructor(e,t,n,i){super(i),this._target="",this._id="",this._id=t,this._target=e,this._kernel=n}get commId(){return this._id}get targetName(){return this._target}get onClose(){return this._onClose}set onClose(e){this._onClose=e}get onMsg(){return this._onMsg}set onMsg(e){this._onMsg=e}open(e,t,n=[]){if(this.isDisposed||this._kernel.isDisposed)throw new Error("Cannot open");const i=a.createMessage({msgType:"comm_open",channel:"shell",username:this._kernel.username,session:this._kernel.clientId,content:{comm_id:this._id,target_name:this._target,data:null!=e?e:{}},metadata:t,buffers:n});return this._kernel.sendShellMessage(i,!1,!0)}send(e,t,n=[],i=!0){if(this.isDisposed||this._kernel.isDisposed)throw new Error("Cannot send");const r=a.createMessage({msgType:"comm_msg",channel:"shell",username:this._kernel.username,session:this._kernel.clientId,content:{comm_id:this._id,data:e},metadata:t,buffers:n});return this._kernel.sendShellMessage(r,!1,i)}close(e,t,n=[]){if(this.isDisposed||this._kernel.isDisposed)throw new Error("Cannot close");const i=a.createMessage({msgType:"comm_close",channel:"shell",username:this._kernel.username,session:this._kernel.clientId,content:{comm_id:this._id,data:null!=e?e:{}},metadata:t,buffers:n}),r=this._kernel.sendShellMessage(i,!1,!0),s=this._onClose;return s&&s(a.createMessage({msgType:"comm_close",channel:"iopub",username:this._kernel.username,session:this._kernel.clientId,content:{comm_id:this._id,data:null!=e?e:{}},metadata:t,buffers:n})),this.dispose(),r}}t.CommHandler=l},2456:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.KernelConnection=void 0;const o=n(8925),a=n(5764),l=n(8571),u=n(7883),d=n(7489),c=s(n(9909)),h=n(134),p=s(n(5855)),f=n(2946),g=s(n(8235)),m="_RESTARTING_";class v{constructor(e){var t,n,i,r;this._createSocket=(e=!0)=>{this._errorIfDisposed(),this._clearSocket(),this._updateConnectionStatus("connecting");const t=this.serverSettings,n=o.URLExt.join(t.wsUrl,g.KERNEL_SERVICE_URL,encodeURIComponent(this._id)),i=n.replace(/^((?:\w+:)?\/\/)(?:[^@\/]+@)/,"$1");console.debug(`Starting WebSocket: ${i}`);let r=o.URLExt.join(n,"channels?session_id="+encodeURIComponent(this._clientId));const s=t.token;t.appendToken&&""!==s&&(r+=`&token=${encodeURIComponent(s)}`);const a=e?this._supportedProtocols:[];this._ws=new t.WebSocket(r,a),this._ws.binaryType="arraybuffer";let l=!1;const d=async e=>{var n,i;if(!this._isDisposed){this._reason="",this._model=void 0;try{const n=await g.getKernelModel(this._id,t);this._model=n,"dead"===(null==n?void 0:n.execution_state)?this._updateStatus("dead"):this._onWSClose(e)}catch(t){if(t instanceof u.ServerConnection.NetworkError||503===(null===(n=t.response)||void 0===n?void 0:n.status)||424===(null===(i=t.response)||void 0===i?void 0:i.status)){const t=1e3*b.getRandomIntInclusive(10,30);setTimeout(d,t,e)}else this._reason="Kernel died unexpectedly",this._updateStatus("dead")}}},c=async e=>{l||(l=!0,await d(e))};this._ws.onmessage=this._onWSMessage,this._ws.onopen=this._onWSOpen,this._ws.onclose=c,this._ws.onerror=c},this._onWSOpen=e=>{if(""!==this._ws.protocol&&!this._supportedProtocols.includes(this._ws.protocol))throw console.log("Server selected unknown kernel wire protocol:",this._ws.protocol),this._updateStatus("dead"),new Error(`Unknown kernel wire protocol: ${this._ws.protocol}`);this._selectedProtocol=this._ws.protocol,this._ws.onclose=this._onWSClose,this._ws.onerror=this._onWSClose,this._updateConnectionStatus("connected")},this._onWSMessage=e=>{let t;try{t=this.serverSettings.serializer.deserialize(e.data,this._ws.protocol),p.validateMessage(t)}catch(e){throw e.message=`Kernel message validation error: ${e.message}`,e}this._kernelSession=t.header.session,this._msgChain=this._msgChain.then((()=>this._handleMessage(t))).catch((e=>{e.message.startsWith("Canceled future for ")&&console.error(e)})),this._anyMessage.emit({msg:t,direction:"recv"})},this._onWSClose=e=>{this.isDisposed||this._reconnect()},this._id="",this._name="",this._status="unknown",this._connectionStatus="connecting",this._kernelSession="",this._isDisposed=!1,this._ws=null,this._username="",this._reconnectLimit=7,this._reconnectAttempt=0,this._reconnectTimeout=null,this._supportedProtocols=Object.values(c.supportedKernelWebSocketProtocols),this._selectedProtocol="",this._futures=new Map,this._comms=new Map,this._targetRegistry=Object.create(null),this._info=new a.PromiseDelegate,this._pendingMessages=[],this._statusChanged=new l.Signal(this),this._connectionStatusChanged=new l.Signal(this),this._disposed=new l.Signal(this),this._iopubMessage=new l.Signal(this),this._anyMessage=new l.Signal(this),this._pendingInput=new l.Signal(this),this._unhandledMessage=new l.Signal(this),this._displayIdToParentIds=new Map,this._msgIdToDisplayIds=new Map,this._msgChain=Promise.resolve(),this._hasPendingInput=!1,this._reason="",this._noOp=()=>{},this._name=e.model.name,this._id=e.model.id,this.serverSettings=null!==(t=e.serverSettings)&&void 0!==t?t:u.ServerConnection.makeSettings(),this._clientId=null!==(n=e.clientId)&&void 0!==n?n:a.UUID.uuid4(),this._username=null!==(i=e.username)&&void 0!==i?i:"",this.handleComms=null===(r=e.handleComms)||void 0===r||r,this._createSocket()}get disposed(){return this._disposed}get statusChanged(){return this._statusChanged}get connectionStatusChanged(){return this._connectionStatusChanged}get iopubMessage(){return this._iopubMessage}get unhandledMessage(){return this._unhandledMessage}get model(){return this._model||{id:this.id,name:this.name,reason:this._reason}}get anyMessage(){return this._anyMessage}get pendingInput(){return this._pendingInput}get id(){return this._id}get name(){return this._name}get username(){return this._username}get clientId(){return this._clientId}get status(){return this._status}get connectionStatus(){return this._connectionStatus}get isDisposed(){return this._isDisposed}get info(){return this._info.promise}get spec(){return this._specPromise||(this._specPromise=f.KernelSpecAPI.getSpecs(this.serverSettings).then((e=>e.kernelspecs[this._name]))),this._specPromise}clone(e={}){return new v({model:this.model,username:this.username,serverSettings:this.serverSettings,handleComms:!1,...e})}dispose(){this.isDisposed||(this._isDisposed=!0,this._disposed.emit(),this._updateConnectionStatus("disconnected"),this._clearKernelState(),this._pendingMessages=[],this._clearSocket(),l.Signal.clearData(this))}sendShellMessage(e,t=!1,n=!0){return this._sendKernelShellControl(h.KernelShellFutureHandler,e,t,n)}sendControlMessage(e,t=!1,n=!0){return this._sendKernelShellControl(h.KernelControlFutureHandler,e,t,n)}_sendKernelShellControl(e,t,n=!1,i=!0){this._sendMessage(t),this._anyMessage.emit({msg:t,direction:"send"});const r=new e((()=>{const e=t.header.msg_id;this._futures.delete(e);const n=this._msgIdToDisplayIds.get(e);n&&(n.forEach((t=>{const n=this._displayIdToParentIds.get(t);if(n){const i=n.indexOf(e);if(-1===i)return;1===n.length?this._displayIdToParentIds.delete(t):(n.splice(i,1),this._displayIdToParentIds.set(t,n))}})),this._msgIdToDisplayIds.delete(e))}),t,n,i,this);return this._futures.set(t.header.msg_id,r),r}_sendMessage(e,t=!0){if("dead"===this.status)throw new Error("Kernel is dead");if((""===this._kernelSession||this._kernelSession===m)&&c.isInfoRequestMsg(e)){if("connected"===this.connectionStatus)return void this._ws.send(this.serverSettings.serializer.serialize(e,this._ws.protocol));throw new Error("Could not send message: status is not connected")}if(t&&this._pendingMessages.length>0)this._pendingMessages.push(e);else if("connected"===this.connectionStatus&&this._kernelSession!==m)this._ws.send(this.serverSettings.serializer.serialize(e,this._ws.protocol));else{if(!t)throw new Error("Could not send message");this._pendingMessages.push(e)}}async interrupt(){if(this.hasPendingInput=!1,"dead"===this.status)throw new Error("Kernel is dead");return g.interruptKernel(this.id,this.serverSettings)}async restart(){if("dead"===this.status)throw new Error("Kernel is dead");this._updateStatus("restarting"),this._clearKernelState(),this._kernelSession=m,await g.restartKernel(this.id,this.serverSettings),await this.reconnect(),this.hasPendingInput=!1}reconnect(){this._errorIfDisposed();const e=new a.PromiseDelegate,t=(n,i)=>{"connected"===i?(e.resolve(),this.connectionStatusChanged.disconnect(t,this)):"disconnected"===i&&(e.reject(new Error("Kernel connection disconnected")),this.connectionStatusChanged.disconnect(t,this))};return this.connectionStatusChanged.connect(t,this),this._reconnectAttempt=0,this._reconnect(),e.promise}async shutdown(){"dead"!==this.status&&await g.shutdownKernel(this.id,this.serverSettings),this.handleShutdown()}handleShutdown(){this._updateStatus("dead"),this.dispose()}async requestKernelInfo(){const e=c.createMessage({msgType:"kernel_info_request",channel:"shell",username:this._username,session:this._clientId,content:{}});let t;try{t=await b.handleShellMessage(this,e)}catch(e){if(this.isDisposed)return;throw e}if(this._errorIfDisposed(),t)return void 0===t.content.status&&(t.content.status="ok"),"ok"!==t.content.status?(this._info.reject("Kernel info reply errored"),t):(this._info.resolve(t.content),this._kernelSession=t.header.session,t)}requestComplete(e){const t=c.createMessage({msgType:"complete_request",channel:"shell",username:this._username,session:this._clientId,content:e});return b.handleShellMessage(this,t)}requestInspect(e){const t=c.createMessage({msgType:"inspect_request",channel:"shell",username:this._username,session:this._clientId,content:e});return b.handleShellMessage(this,t)}requestHistory(e){const t=c.createMessage({msgType:"history_request",channel:"shell",username:this._username,session:this._clientId,content:e});return b.handleShellMessage(this,t)}requestExecute(e,t=!0,n){const i=c.createMessage({msgType:"execute_request",channel:"shell",username:this._username,session:this._clientId,content:{silent:!1,store_history:!0,user_expressions:{},allow_stdin:!0,stop_on_error:!1,...e},metadata:n});return this.sendShellMessage(i,!0,t)}requestDebug(e,t=!0){const n=c.createMessage({msgType:"debug_request",channel:"control",username:this._username,session:this._clientId,content:e});return this.sendControlMessage(n,!0,t)}requestIsComplete(e){const t=c.createMessage({msgType:"is_complete_request",channel:"shell",username:this._username,session:this._clientId,content:e});return b.handleShellMessage(this,t)}requestCommInfo(e){const t=c.createMessage({msgType:"comm_info_request",channel:"shell",username:this._username,session:this._clientId,content:e});return b.handleShellMessage(this,t)}sendInputReply(e,t){const n=c.createMessage({msgType:"input_reply",channel:"stdin",username:this._username,session:this._clientId,content:e});n.parent_header=t,this._sendMessage(n),this._anyMessage.emit({msg:n,direction:"send"}),this.hasPendingInput=!1}createComm(e,t=a.UUID.uuid4()){if(!this.handleComms)throw new Error("Comms are disabled on this kernel connection");if(this._comms.has(t))throw new Error("Comm is already created");const n=new d.CommHandler(e,t,this,(()=>{this._unregisterComm(t)}));return this._comms.set(t,n),n}hasComm(e){return this._comms.has(e)}registerCommTarget(e,t){this.handleComms&&(this._targetRegistry[e]=t)}removeCommTarget(e,t){this.handleComms&&(this.isDisposed||this._targetRegistry[e]!==t||delete this._targetRegistry[e])}registerMessageHook(e,t){var n;const i=null===(n=this._futures)||void 0===n?void 0:n.get(e);i&&i.registerMessageHook(t)}removeMessageHook(e,t){var n;const i=null===(n=this._futures)||void 0===n?void 0:n.get(e);i&&i.removeMessageHook(t)}removeInputGuard(){this.hasPendingInput=!1}async _handleDisplayId(e,t){var n,i;const r=t.parent_header.msg_id;let s=this._displayIdToParentIds.get(e);if(s){const e={header:a.JSONExt.deepCopy(t.header),parent_header:a.JSONExt.deepCopy(t.parent_header),metadata:a.JSONExt.deepCopy(t.metadata),content:a.JSONExt.deepCopy(t.content),channel:t.channel,buffers:t.buffers?t.buffers.slice():[]};e.header.msg_type="update_display_data",await Promise.all(s.map((async t=>{const n=this._futures&&this._futures.get(t);n&&await n.handleMsg(e)})))}if("update_display_data"===t.header.msg_type)return!0;s=null!==(n=this._displayIdToParentIds.get(e))&&void 0!==n?n:[],-1===s.indexOf(r)&&s.push(r),this._displayIdToParentIds.set(e,s);const o=null!==(i=this._msgIdToDisplayIds.get(r))&&void 0!==i?i:[];return-1===o.indexOf(r)&&o.push(r),this._msgIdToDisplayIds.set(r,o),!1}_clearSocket(){null!==this._ws&&(this._ws.onopen=this._noOp,this._ws.onclose=this._noOp,this._ws.onerror=this._noOp,this._ws.onmessage=this._noOp,this._ws.close(),this._ws=null)}_updateStatus(e){this._status!==e&&"dead"!==this._status&&(this._status=e,b.logKernelStatus(this),this._statusChanged.emit(e),"dead"===e&&this.dispose())}_sendPending(){for(;"connected"===this.connectionStatus&&this._kernelSession!==m&&this._pendingMessages.length>0;)this._sendMessage(this._pendingMessages[0],!1),this._pendingMessages.shift()}_clearKernelState(){this._kernelSession="",this._pendingMessages=[],this._futures.forEach((e=>{e.dispose()})),this._comms.forEach((e=>{e.dispose()})),this._msgChain=Promise.resolve(),this._futures=new Map,this._comms=new Map,this._displayIdToParentIds.clear(),this._msgIdToDisplayIds.clear()}_assertCurrentMessage(e){if(this._errorIfDisposed(),e.header.session!==this._kernelSession)throw new Error(`Canceling handling of old message: ${e.header.msg_type}`)}async _handleCommOpen(e){this._assertCurrentMessage(e);const t=e.content,n=new d.CommHandler(t.target_name,t.comm_id,this,(()=>{this._unregisterComm(t.comm_id)}));this._comms.set(t.comm_id,n);try{const i=await b.loadObject(t.target_name,t.target_module,this._targetRegistry);await i(n,e)}catch(e){throw n.close(),console.error("Exception opening new comm"),e}}async _handleCommClose(e){this._assertCurrentMessage(e);const t=e.content,n=this._comms.get(t.comm_id);if(!n)return void console.error("Comm not found for comm id "+t.comm_id);this._unregisterComm(n.commId);const i=n.onClose;i&&await i(e),n.dispose()}async _handleCommMsg(e){this._assertCurrentMessage(e);const t=e.content,n=this._comms.get(t.comm_id);if(!n)return;const i=n.onMsg;i&&await i(e)}_unregisterComm(e){this._comms.delete(e)}_updateConnectionStatus(e){if(this._connectionStatus!==e){if(this._connectionStatus=e,"connecting"!==e&&(this._reconnectAttempt=0,clearTimeout(this._reconnectTimeout)),"dead"!==this.status)if("connected"===e){let e=this._kernelSession===m,t=this.requestKernelInfo(),n=!1,i=()=>{n||(n=!0,e&&this._kernelSession===m&&(this._kernelSession=""),clearTimeout(r),this._pendingMessages.length>0&&this._sendPending())};t.then(i);let r=setTimeout(i,3e3)}else this._updateStatus("unknown");this._connectionStatusChanged.emit(e)}}async _handleMessage(e){var t,n;let i=!1;if(e.parent_header&&"iopub"===e.channel&&(c.isDisplayDataMsg(e)||c.isUpdateDisplayDataMsg(e)||c.isExecuteResultMsg(e))){const n=(null!==(t=e.content.transient)&&void 0!==t?t:{}).display_id;n&&(i=await this._handleDisplayId(n,e),this._assertCurrentMessage(e))}if(!i&&e.parent_header){const t=e.parent_header,i=null===(n=this._futures)||void 0===n?void 0:n.get(t.msg_id);if(i)await i.handleMsg(e),this._assertCurrentMessage(e);else{const n=t.session===this.clientId;"iopub"!==e.channel&&n&&this._unhandledMessage.emit(e)}}if("iopub"===e.channel){switch(e.header.msg_type){case"status":{const t=e.content.execution_state;"restarting"===t&&Promise.resolve().then((async()=>{this._updateStatus("autorestarting"),this._clearKernelState(),await this.reconnect()})),this._updateStatus(t);break}case"comm_open":this.handleComms&&await this._handleCommOpen(e);break;case"comm_msg":this.handleComms&&await this._handleCommMsg(e);break;case"comm_close":this.handleComms&&await this._handleCommClose(e)}this.isDisposed||(this._assertCurrentMessage(e),this._iopubMessage.emit(e))}}_reconnect(){if(this._errorIfDisposed(),clearTimeout(this._reconnectTimeout),this._reconnectAttempt{if(t){if("undefined"==typeof requirejs)throw new Error("requirejs not found");requirejs([t],(n=>{void 0===n[e]?r(new Error(`Object '${e}' not found in module '${t}'`)):i(n[e])}),r)}else(null==n?void 0:n[e])?i(n[e]):r(new Error(`Object '${e}' not found in registry`))}))},e.getRandomIntInclusive=function(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}}(b||(b={}))},134:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.KernelShellFutureHandler=t.KernelControlFutureHandler=t.KernelFutureHandler=void 0;const o=n(5764),a=n(7556),l=s(n(9909));class u extends a.DisposableDelegate{constructor(e,t,n,i,r){super(e),this._status=0,this._stdin=d.noOp,this._iopub=d.noOp,this._reply=d.noOp,this._done=new o.PromiseDelegate,this._hooks=new d.HookList,this._disposeOnDone=!0,this._msg=t,n||this._setFlag(d.KernelFutureFlag.GotReply),this._disposeOnDone=i,this._kernel=r}get msg(){return this._msg}get done(){return this._done.promise}get onReply(){return this._reply}set onReply(e){this._reply=e}get onIOPub(){return this._iopub}set onIOPub(e){this._iopub=e}get onStdin(){return this._stdin}set onStdin(e){this._stdin=e}registerMessageHook(e){if(this.isDisposed)throw new Error("Kernel future is disposed");this._hooks.add(e)}removeMessageHook(e){this.isDisposed||this._hooks.remove(e)}sendInputReply(e,t){this._kernel.sendInputReply(e,t)}dispose(){this._stdin=d.noOp,this._iopub=d.noOp,this._reply=d.noOp,this._hooks=null,this._testFlag(d.KernelFutureFlag.IsDone)||(this._done.promise.catch((()=>{})),this._done.reject(new Error(`Canceled future for ${this.msg.header.msg_type} message before replies were done`))),super.dispose()}async handleMsg(e){switch(e.channel){case"control":case"shell":e.channel===this.msg.channel&&e.parent_header.msg_id===this.msg.header.msg_id&&await this._handleReply(e);break;case"stdin":await this._handleStdin(e);break;case"iopub":await this._handleIOPub(e)}}async _handleReply(e){const t=this._reply;t&&await t(e),this._replyMsg=e,this._setFlag(d.KernelFutureFlag.GotReply),this._testFlag(d.KernelFutureFlag.GotIdle)&&this._handleDone()}async _handleStdin(e){this._kernel.hasPendingInput=!0;const t=this._stdin;t&&await t(e)}async _handleIOPub(e){const t=await this._hooks.process(e),n=this._iopub;t&&n&&await n(e),l.isStatusMsg(e)&&"idle"===e.content.execution_state&&(this._setFlag(d.KernelFutureFlag.GotIdle),this._testFlag(d.KernelFutureFlag.GotReply)&&this._handleDone())}_handleDone(){this._testFlag(d.KernelFutureFlag.IsDone)||(this._setFlag(d.KernelFutureFlag.IsDone),this._done.resolve(this._replyMsg),this._disposeOnDone&&this.dispose())}_testFlag(e){return!!(this._status&e)}_setFlag(e){this._status|=e}}var d;t.KernelFutureHandler=u,t.KernelControlFutureHandler=class extends u{},t.KernelShellFutureHandler=class extends u{},function(e){e.noOp=()=>{};const t="function"==typeof requestAnimationFrame?requestAnimationFrame:setImmediate;let n;e.HookList=class{constructor(){this._hooks=[]}add(e){this.remove(e),this._hooks.push(e)}remove(e){const t=this._hooks.indexOf(e);t>=0&&(this._hooks[t]=null,this._scheduleCompact())}async process(e){await this._processing;const t=new o.PromiseDelegate;let n;this._processing=t.promise;for(let i=this._hooks.length-1;i>=0;i--){const r=this._hooks[i];if(null!==r){try{n=await r(e)}catch(e){n=!0,console.error(e)}if(!1===n)return t.resolve(void 0),!1}}return t.resolve(void 0),!0}_scheduleCompact(){this._compactScheduled||(this._compactScheduled=!0,t((()=>{this._processing=this._processing.then((()=>{this._compactScheduled=!1,this._compact()}))})))}_compact(){let e=0;for(let t=0,n=this._hooks.length;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5198:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.KernelManager=void 0;const i=n(6049),r=n(8571),s=n(7883),o=n(3867),a=n(8235),l=n(2456);class u extends o.BaseManager{constructor(e={}){var t;super(e),this._isReady=!1,this._kernelConnections=new Set,this._models=new Map,this._runningChanged=new r.Signal(this),this._connectionFailure=new r.Signal(this),this._pollModels=new i.Poll({auto:!1,factory:()=>this.requestRunning(),frequency:{interval:1e4,backoff:!0,max:3e5},name:"@jupyterlab/services:KernelManager#models",standby:null!==(t=e.standby)&&void 0!==t?t:"when-hidden"}),this._ready=(async()=>{await this._pollModels.start(),await this._pollModels.tick,this._isReady=!0})()}get isReady(){return this._isReady}get ready(){return this._ready}get runningChanged(){return this._runningChanged}get connectionFailure(){return this._connectionFailure}dispose(){this.isDisposed||(this._models.clear(),this._kernelConnections.forEach((e=>e.dispose())),this._pollModels.dispose(),super.dispose())}connectTo(e){var t;const{id:n}=e.model;let i=null===(t=e.handleComms)||void 0===t||t;if(void 0===e.handleComms)for(const e of this._kernelConnections)if(e.id===n&&e.handleComms){i=!1;break}const r=new l.KernelConnection({handleComms:i,...e,serverSettings:this.serverSettings});return this._onStarted(r),this._models.has(n)||this.refreshRunning().catch((()=>{})),r}running(){return this._models.values()}async refreshRunning(){await this._pollModels.refresh(),await this._pollModels.tick}async startNew(e={},t={}){const n=await(0,a.startNew)(e,this.serverSettings);return this.connectTo({...t,model:n})}async shutdown(e){await(0,a.shutdownKernel)(e,this.serverSettings),await this.refreshRunning()}async shutdownAll(){await this.refreshRunning(),await Promise.all([...this._models.keys()].map((e=>(0,a.shutdownKernel)(e,this.serverSettings)))),await this.refreshRunning()}async findById(e){return this._models.has(e)||await this.refreshRunning(),this._models.get(e)}async requestRunning(){var e,t;let n;try{n=await(0,a.listRunning)(this.serverSettings)}catch(n){throw(n instanceof s.ServerConnection.NetworkError||503===(null===(e=n.response)||void 0===e?void 0:e.status)||424===(null===(t=n.response)||void 0===t?void 0:t.status))&&this._connectionFailure.emit(n),n}this.isDisposed||this._models.size===n.length&&n.every((e=>{const t=this._models.get(e.id);return!!t&&t.connections===e.connections&&t.execution_state===e.execution_state&&t.last_activity===e.last_activity&&t.name===e.name&&t.reason===e.reason&&t.traceback===e.traceback}))||(this._models=new Map(n.map((e=>[e.id,e]))),this._kernelConnections.forEach((e=>{this._models.has(e.id)||e.handleShutdown()})),this._runningChanged.emit(n))}_onStarted(e){this._kernelConnections.add(e),e.statusChanged.connect(this._onStatusChanged,this),e.disposed.connect(this._onDisposed,this)}_onDisposed(e){this._kernelConnections.delete(e),this.refreshRunning().catch((()=>{}))}_onStatusChanged(e,t){"dead"===t&&this.refreshRunning().catch((()=>{}))}}t.KernelManager=u,function(e){e.NoopManager=class extends e{constructor(){super(...arguments),this._readyPromise=new Promise((()=>{}))}get isActive(){return!1}get parentReady(){return super.ready}async startNew(e={},t={}){return Promise.reject(new Error("Not implemented in no-op Kernel Manager"))}connectTo(e){throw new Error("Not implemented in no-op Kernel Manager")}async shutdown(e){return Promise.reject(new Error("Not implemented in no-op Kernel Manager"))}get ready(){return this.parentReady.then((()=>this._readyPromise))}async requestRunning(){return Promise.resolve()}}}(u||(t.KernelManager=u={}))},9909:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.supportedKernelWebSocketProtocols=t.isInputReplyMsg=t.isInputRequestMsg=t.isDebugReplyMsg=t.isDebugRequestMsg=t.isExecuteReplyMsg=t.isInfoRequestMsg=t.isCommMsgMsg=t.isCommCloseMsg=t.isCommOpenMsg=t.isDebugEventMsg=t.isClearOutputMsg=t.isStatusMsg=t.isErrorMsg=t.isExecuteResultMsg=t.isExecuteInputMsg=t.isUpdateDisplayDataMsg=t.isDisplayDataMsg=t.isStreamMsg=t.createMessage=void 0;const i=n(5764);var r;t.createMessage=function(e){var t,n,r,s,o;return{buffers:null!==(t=e.buffers)&&void 0!==t?t:[],channel:e.channel,content:e.content,header:{date:(new Date).toISOString(),msg_id:null!==(n=e.msgId)&&void 0!==n?n:i.UUID.uuid4(),msg_type:e.msgType,session:e.session,username:null!==(r=e.username)&&void 0!==r?r:"",version:"5.2"},metadata:null!==(s=e.metadata)&&void 0!==s?s:{},parent_header:null!==(o=e.parentHeader)&&void 0!==o?o:{}}},t.isStreamMsg=function(e){return"stream"===e.header.msg_type},t.isDisplayDataMsg=function(e){return"display_data"===e.header.msg_type},t.isUpdateDisplayDataMsg=function(e){return"update_display_data"===e.header.msg_type},t.isExecuteInputMsg=function(e){return"execute_input"===e.header.msg_type},t.isExecuteResultMsg=function(e){return"execute_result"===e.header.msg_type},t.isErrorMsg=function(e){return"error"===e.header.msg_type},t.isStatusMsg=function(e){return"status"===e.header.msg_type},t.isClearOutputMsg=function(e){return"clear_output"===e.header.msg_type},t.isDebugEventMsg=function(e){return"debug_event"===e.header.msg_type},t.isCommOpenMsg=function(e){return"comm_open"===e.header.msg_type},t.isCommCloseMsg=function(e){return"comm_close"===e.header.msg_type},t.isCommMsgMsg=function(e){return"comm_msg"===e.header.msg_type},t.isInfoRequestMsg=function(e){return"kernel_info_request"===e.header.msg_type},t.isExecuteReplyMsg=function(e){return"execute_reply"===e.header.msg_type},t.isDebugRequestMsg=function(e){return"debug_request"===e.header.msg_type},t.isDebugReplyMsg=function(e){return"debug_reply"===e.header.msg_type},t.isInputRequestMsg=function(e){return"input_request"===e.header.msg_type},t.isInputReplyMsg=function(e){return"input_reply"===e.header.msg_type},function(e){e.v1KernelWebsocketJupyterOrg="v1.kernel.websocket.jupyter.org"}(r||(t.supportedKernelWebSocketProtocols=r={}))},8235:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getKernelModel=t.shutdownKernel=t.interruptKernel=t.restartKernel=t.startNew=t.listRunning=t.KERNEL_SERVICE_URL=void 0;const i=n(2920),r=n(8925),s=n(5855);t.KERNEL_SERVICE_URL="api/kernels",t.listRunning=async function(e=i.ServerConnection.makeSettings()){const n=r.URLExt.join(e.baseUrl,t.KERNEL_SERVICE_URL),o=await i.ServerConnection.makeRequest(n,{},e);if(200!==o.status)throw await i.ServerConnection.ResponseError.create(o);const a=await o.json();return(0,s.validateModels)(a),a},t.startNew=async function(e={},n=i.ServerConnection.makeSettings()){const o=r.URLExt.join(n.baseUrl,t.KERNEL_SERVICE_URL),a={method:"POST",body:JSON.stringify(e)},l=await i.ServerConnection.makeRequest(o,a,n);if(201!==l.status)throw await i.ServerConnection.ResponseError.create(l);const u=await l.json();return(0,s.validateModel)(u),u},t.restartKernel=async function(e,n=i.ServerConnection.makeSettings()){const o=r.URLExt.join(n.baseUrl,t.KERNEL_SERVICE_URL,encodeURIComponent(e),"restart"),a=await i.ServerConnection.makeRequest(o,{method:"POST"},n);if(200!==a.status)throw await i.ServerConnection.ResponseError.create(a);const l=await a.json();(0,s.validateModel)(l)},t.interruptKernel=async function(e,n=i.ServerConnection.makeSettings()){const s=r.URLExt.join(n.baseUrl,t.KERNEL_SERVICE_URL,encodeURIComponent(e),"interrupt"),o=await i.ServerConnection.makeRequest(s,{method:"POST"},n);if(204!==o.status)throw await i.ServerConnection.ResponseError.create(o)},t.shutdownKernel=async function(e,n=i.ServerConnection.makeSettings()){const s=r.URLExt.join(n.baseUrl,t.KERNEL_SERVICE_URL,encodeURIComponent(e)),o=await i.ServerConnection.makeRequest(s,{method:"DELETE"},n);if(404===o.status){const t=`The kernel "${e}" does not exist on the server`;console.warn(t)}else if(204!==o.status)throw await i.ServerConnection.ResponseError.create(o)},t.getKernelModel=async function(e,n=i.ServerConnection.makeSettings()){const o=r.URLExt.join(n.baseUrl,t.KERNEL_SERVICE_URL,encodeURIComponent(e)),a=await i.ServerConnection.makeRequest(o,{},n);if(404===a.status)return;if(200!==a.status)throw await i.ServerConnection.ResponseError.create(a);const l=await a.json();return(0,s.validateModel)(l),l}},7179:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.deserialize=t.serialize=void 0;const o=s(n(9909));var a;t.serialize=function(e,t=""){return t===o.supportedKernelWebSocketProtocols.v1KernelWebsocketJupyterOrg?a.serializeV1KernelWebsocketJupyterOrg(e):a.serializeDefault(e)},t.deserialize=function(e,t=""){return t===o.supportedKernelWebSocketProtocols.v1KernelWebsocketJupyterOrg?a.deserializeV1KernelWebsocketJupyterOrg(e):a.deserializeDefault(e)},function(e){e.deserializeV1KernelWebsocketJupyterOrg=function(e){let t;const n=new DataView(e),i=Number(n.getBigUint64(0,!0));let r=[];for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateModels=t.validateModel=t.validateMessage=void 0;const i=n(7441),r=["username","version","session","msg_id","msg_type"],s={stream:{name:"string",text:"string"},display_data:{data:"object",metadata:"object"},execute_input:{code:"string",execution_count:"number"},execute_result:{execution_count:"number",data:"object",metadata:"object"},error:{ename:"string",evalue:"string",traceback:"object"},status:{execution_state:["string",["starting","idle","busy","restarting","dead"]]},clear_output:{wait:"boolean"},comm_open:{comm_id:"string",target_name:"string",data:"object"},comm_msg:{comm_id:"string",data:"object"},comm_close:{comm_id:"string"},shutdown_reply:{restart:"boolean"}};function o(e){(0,i.validateProperty)(e,"name","string"),(0,i.validateProperty)(e,"id","string")}t.validateMessage=function(e){(0,i.validateProperty)(e,"metadata","object"),(0,i.validateProperty)(e,"content","object"),(0,i.validateProperty)(e,"channel","string"),function(e){for(let t=0;to(e)))}},2946:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t},o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.KernelSpecAPI=t.KernelSpec=void 0;const a=s(n(4806));t.KernelSpec=a;const l=s(n(6492));t.KernelSpecAPI=l,o(n(733),t)},4806:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},733:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.KernelSpecManager=void 0;const o=n(5764),a=n(6049),l=n(8571),u=s(n(6492)),d=n(3867);class c extends d.BaseManager{constructor(e={}){var t;super(e),this._isReady=!1,this._connectionFailure=new l.Signal(this),this._specs=null,this._specsChanged=new l.Signal(this),this._ready=Promise.all([this.requestSpecs()]).then((e=>{})).catch((e=>{})).then((()=>{this.isDisposed||(this._isReady=!0)})),this._pollSpecs=new a.Poll({auto:!1,factory:()=>this.requestSpecs(),frequency:{interval:61e3,backoff:!0,max:3e5},name:"@jupyterlab/services:KernelSpecManager#specs",standby:null!==(t=e.standby)&&void 0!==t?t:"when-hidden"}),this.ready.then((()=>{this._pollSpecs.start()}))}get isReady(){return this._isReady}get ready(){return this._ready}get specs(){return this._specs}get specsChanged(){return this._specsChanged}get connectionFailure(){return this._connectionFailure}dispose(){this._pollSpecs.dispose(),super.dispose()}async refreshSpecs(){await this._pollSpecs.refresh(),await this._pollSpecs.tick}async requestSpecs(){const e=await u.getSpecs(this.serverSettings);this.isDisposed||o.JSONExt.deepEqual(e,this._specs)||(this._specs=e,this._specsChanged.emit(e))}}t.KernelSpecManager=c},6492:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSpecs=void 0;const i=n(2920),r=n(2598),s=n(8925);t.getSpecs=async function(e=i.ServerConnection.makeSettings()){const t=s.URLExt.join(e.baseUrl,"api/kernelspecs"),n=await i.ServerConnection.makeRequest(t,{},e);if(200!==n.status)throw await i.ServerConnection.ResponseError.create(n);const o=await n.json();return(0,r.validateSpecModels)(o)}},2598:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateSpecModels=t.validateSpecModel=void 0;const i=n(7441);function r(e){const t=e.spec;if(!t)throw new Error("Invalid kernel spec");(0,i.validateProperty)(e,"name","string"),(0,i.validateProperty)(e,"resources","object"),(0,i.validateProperty)(t,"language","string"),(0,i.validateProperty)(t,"display_name","string"),(0,i.validateProperty)(t,"argv","array");let n=null;t.hasOwnProperty("metadata")&&((0,i.validateProperty)(t,"metadata","object"),n=t.metadata);let r=null;return t.hasOwnProperty("env")&&((0,i.validateProperty)(t,"env","object"),r=t.env),{name:e.name,resources:e.resources,language:t.language,display_name:t.display_name,argv:t.argv,metadata:n,env:r}}t.validateSpecModel=r,t.validateSpecModels=function(e){if(!e.hasOwnProperty("kernelspecs"))throw new Error("No kernelspecs found");let t=Object.keys(e.kernelspecs);const n=Object.create(null);let i=e.default;for(let i=0;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServiceManager=void 0;const i=n(8571),r=n(4219),s=n(8790),o=n(9480),a=n(973),l=n(2946),u=n(8683),d=n(2920),c=n(7668),h=n(7780),p=n(9040),f=n(9191),g=n(8053);t.ServiceManager=class{constructor(e={}){var t,n;this._isDisposed=!1,this._connectionFailure=new i.Signal(this),this._isReady=!1;const m=e.defaultDrive,v=null!==(t=e.serverSettings)&&void 0!==t?t:d.ServerConnection.makeSettings(),b={defaultDrive:m,serverSettings:v,standby:null!==(n=e.standby)&&void 0!==n?n:"when-hidden"};this.serverSettings=v,this.contents=e.contents||new s.ContentsManager(b),this.events=e.events||new o.EventManager(b),this.kernels=e.kernels||new a.KernelManager(b),this.sessions=e.sessions||new c.SessionManager({...b,kernelManager:this.kernels}),this.settings=e.settings||new h.SettingManager(b),this.terminals=e.terminals||new p.TerminalManager(b),this.builder=e.builder||new r.BuildManager(b),this.workspaces=e.workspaces||new g.WorkspaceManager(b),this.nbconvert=e.nbconvert||new u.NbConvertManager(b),this.kernelspecs=e.kernelspecs||new l.KernelSpecManager(b),this.user=e.user||new f.UserManager(b),this.kernelspecs.connectionFailure.connect(this._onConnectionFailure,this),this.sessions.connectionFailure.connect(this._onConnectionFailure,this),this.terminals.connectionFailure.connect(this._onConnectionFailure,this);const A=[this.sessions.ready,this.kernelspecs.ready];this.terminals.isAvailable()&&A.push(this.terminals.ready),this._readyPromise=Promise.all(A).then((()=>{this._isReady=!0}))}get connectionFailure(){return this._connectionFailure}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,i.Signal.clearData(this),this.contents.dispose(),this.events.dispose(),this.sessions.dispose(),this.terminals.dispose())}get isReady(){return this._isReady}get ready(){return this._readyPromise}_onConnectionFailure(e,t){this._connectionFailure.emit(t)}}},8683:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NbConvertManager=void 0;const i=n(8925),r=n(2920),s=n(5764);t.NbConvertManager=class{constructor(e={}){var t;this._exportFormats=null,this.serverSettings=null!==(t=e.serverSettings)&&void 0!==t?t:r.ServerConnection.makeSettings()}async fetchExportFormats(){this._requestingFormats=new s.PromiseDelegate,this._exportFormats=null;const e=this.serverSettings.baseUrl,t=i.URLExt.join(e,"api/nbconvert"),{serverSettings:n}=this,o=await r.ServerConnection.makeRequest(t,{},n);if(200!==o.status)throw await r.ServerConnection.ResponseError.create(o);const a=await o.json(),l={};return Object.keys(a).forEach((function(e){const t=a[e].output_mimetype;l[e]={output_mimetype:t}})),this._exportFormats=l,this._requestingFormats.resolve(l),l}async getExportFormats(e=!0){return this._requestingFormats?this._requestingFormats.promise:e||!this._exportFormats?await this.fetchExportFormats():this._exportFormats}}},2920:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServerConnection=void 0;const i=n(8925),r=n(7179);let s;var o,a;s="undefined"==typeof window?n(7251):WebSocket,function(e){e.makeSettings=function(e){return a.makeSettings(e)},e.makeRequest=function(e,t,n){return a.handleRequest(e,t,n)};class t extends Error{static async create(e){try{const n=await e.json(),{message:i,traceback:r}=n;return r&&console.error(r),new t(e,null!=i?i:t._defaultMessage(e),null!=r?r:"")}catch(n){return console.debug(n),new t(e)}}constructor(e,n=t._defaultMessage(e),i=""){super(n),this.response=e,this.traceback=i}static _defaultMessage(e){return`Invalid response: ${e.status} ${e.statusText}`}}e.ResponseError=t;class n extends TypeError{constructor(e){super(e.message),this.stack=e.stack}}e.NetworkError=n}(o||(t.ServerConnection=o={})),function(e){e.makeSettings=function(e={}){var t;const n=i.PageConfig.getBaseUrl(),o=i.PageConfig.getWsUrl(),a=i.URLExt.normalize(e.baseUrl)||n;let l=e.wsUrl;l||a!==n||(l=o),l||0!==a.indexOf("http")||(l="ws"+a.slice(4)),l=null!=l?l:o;const u=i.PageConfig.getOption("appendToken").toLowerCase();let d;return d=""===u?"undefined"==typeof window||"undefined"!=typeof process&&void 0!==(null===(t=null===process||void 0===process?void 0:process.env)||void 0===t?void 0:t.JEST_WORKER_ID)||i.URLExt.getHostName(n)!==i.URLExt.getHostName(l):"true"===u,{init:{cache:"no-store",credentials:"same-origin"},fetch,Headers,Request,WebSocket:s,token:i.PageConfig.getToken(),appUrl:i.PageConfig.getOption("appUrl"),appendToken:d,serializer:{serialize:r.serialize,deserialize:r.deserialize},...e,baseUrl:a,wsUrl:l}},e.handleRequest=function(e,t,n){var i;if(0!==e.indexOf(n.baseUrl))throw new Error("Can only be used for notebook server requests");"no-store"===(null!==(i=t.cache)&&void 0!==i?i:n.init.cache)&&(e+=(/\?/.test(e)?"&":"?")+(new Date).getTime());const r=new n.Request(e,{...n.init,...t});let s=!1;if(n.token&&(s=!0,r.headers.append("Authorization",`token ${n.token}`)),"undefined"!=typeof document){const e=function(){let e="";try{e=document.cookie}catch(e){return}const t=e.match("\\b_xsrf=([^;]*)\\b");return null==t?void 0:t[1]}();void 0!==e&&(s=!0,r.headers.append("X-XSRFToken",e))}return!r.headers.has("Content-Type")&&s&&r.headers.set("Content-Type","application/json"),n.fetch.call(null,r).catch((e=>{throw new o.NetworkError(e)}))}}(a||(a={}))},5341:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SessionConnection=void 0;const i=n(8571),r=n(7883),s=n(7570),o=n(5764);t.SessionConnection=class{constructor(e){var t,n,s,a;this._id="",this._path="",this._name="",this._type="",this._kernel=null,this._isDisposed=!1,this._disposed=new i.Signal(this),this._kernelChanged=new i.Signal(this),this._statusChanged=new i.Signal(this),this._connectionStatusChanged=new i.Signal(this),this._pendingInput=new i.Signal(this),this._iopubMessage=new i.Signal(this),this._unhandledMessage=new i.Signal(this),this._anyMessage=new i.Signal(this),this._propertyChanged=new i.Signal(this),this._id=e.model.id,this._name=e.model.name,this._path=e.model.path,this._type=e.model.type,this._username=null!==(t=e.username)&&void 0!==t?t:"",this._clientId=null!==(n=e.clientId)&&void 0!==n?n:o.UUID.uuid4(),this._connectToKernel=e.connectToKernel,this._kernelConnectionOptions=null!==(s=e.kernelConnectionOptions)&&void 0!==s?s:{},this.serverSettings=null!==(a=e.serverSettings)&&void 0!==a?a:r.ServerConnection.makeSettings(),this.setupKernel(e.model.kernel)}get disposed(){return this._disposed}get kernelChanged(){return this._kernelChanged}get statusChanged(){return this._statusChanged}get connectionStatusChanged(){return this._connectionStatusChanged}get pendingInput(){return this._pendingInput}get iopubMessage(){return this._iopubMessage}get unhandledMessage(){return this._unhandledMessage}get anyMessage(){return this._anyMessage}get propertyChanged(){return this._propertyChanged}get id(){return this._id}get kernel(){return this._kernel}get path(){return this._path}get type(){return this._type}get name(){return this._name}get model(){return{id:this.id,kernel:this.kernel&&{id:this.kernel.id,name:this.kernel.name},path:this._path,type:this._type,name:this._name}}get isDisposed(){return this._isDisposed}update(e){const t=this.model;if(this._path=e.path,this._name=e.name,this._type=e.type,null===this._kernel&&null!==e.kernel||null!==this._kernel&&null===e.kernel||null!==this._kernel&&null!==e.kernel&&this._kernel.id!==e.kernel.id){null!==this._kernel&&this._kernel.dispose();const t=this._kernel||null;this.setupKernel(e.kernel);const n=this._kernel||null;this._kernelChanged.emit({name:"kernel",oldValue:t,newValue:n})}this._handleModelChange(t)}dispose(){if(!this.isDisposed){if(this._isDisposed=!0,this._disposed.emit(),this._kernel){this._kernel.dispose();const e=this._kernel;this._kernel=null;const t=this._kernel;this._kernelChanged.emit({name:"kernel",oldValue:e,newValue:t})}i.Signal.clearData(this)}}async setPath(e){if(this.isDisposed)throw new Error("Session is disposed");await this._patch({path:e})}async setName(e){if(this.isDisposed)throw new Error("Session is disposed");await this._patch({name:e})}async setType(e){if(this.isDisposed)throw new Error("Session is disposed");await this._patch({type:e})}async changeKernel(e){if(this.isDisposed)throw new Error("Session is disposed");return await this._patch({kernel:e}),this.kernel}async shutdown(){if(this.isDisposed)throw new Error("Session is disposed");await(0,s.shutdownSession)(this.id,this.serverSettings),this.dispose()}setupKernel(e){if(null===e)return void(this._kernel=null);const t=this._connectToKernel({...this._kernelConnectionOptions,model:e,username:this._username,clientId:this._clientId,serverSettings:this.serverSettings});this._kernel=t,t.statusChanged.connect(this.onKernelStatus,this),t.connectionStatusChanged.connect(this.onKernelConnectionStatus,this),t.pendingInput.connect(this.onPendingInput,this),t.unhandledMessage.connect(this.onUnhandledMessage,this),t.iopubMessage.connect(this.onIOPubMessage,this),t.anyMessage.connect(this.onAnyMessage,this)}onKernelStatus(e,t){this._statusChanged.emit(t)}onKernelConnectionStatus(e,t){this._connectionStatusChanged.emit(t)}onPendingInput(e,t){this._pendingInput.emit(t)}onIOPubMessage(e,t){this._iopubMessage.emit(t)}onUnhandledMessage(e,t){this._unhandledMessage.emit(t)}onAnyMessage(e,t){this._anyMessage.emit(t)}async _patch(e){const t=await(0,s.updateSession)({...e,id:this._id},this.serverSettings);return this.update(t),t}_handleModelChange(e){e.name!==this._name&&this._propertyChanged.emit("name"),e.type!==this._type&&this._propertyChanged.emit("type"),e.path!==this._path&&this._propertyChanged.emit("path")}}},7668:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t},o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.SessionAPI=t.Session=void 0;const a=s(n(7240));t.Session=a;const l=s(n(7570));t.SessionAPI=l,o(n(6919),t)},6919:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SessionManager=void 0;const i=n(6049),r=n(8571),s=n(2920),o=n(3867),a=n(5341),l=n(7570);class u extends o.BaseManager{constructor(e){var t;super(e),this._isReady=!1,this._sessionConnections=new Set,this._models=new Map,this._runningChanged=new r.Signal(this),this._connectionFailure=new r.Signal(this),this._connectToKernel=e=>this._kernelManager.connectTo(e),this._kernelManager=e.kernelManager,this._pollModels=new i.Poll({auto:!1,factory:()=>this.requestRunning(),frequency:{interval:1e4,backoff:!0,max:3e5},name:"@jupyterlab/services:SessionManager#models",standby:null!==(t=e.standby)&&void 0!==t?t:"when-hidden"}),this._ready=(async()=>{await this._pollModels.start(),await this._pollModels.tick,this._kernelManager.isActive&&await this._kernelManager.ready,this._isReady=!0})()}get isReady(){return this._isReady}get ready(){return this._ready}get runningChanged(){return this._runningChanged}get connectionFailure(){return this._connectionFailure}dispose(){this.isDisposed||(this._models.clear(),this._sessionConnections.forEach((e=>e.dispose())),this._pollModels.dispose(),super.dispose())}connectTo(e){const t=new a.SessionConnection({...e,connectToKernel:this._connectToKernel,serverSettings:this.serverSettings});return this._onStarted(t),this._models.has(e.model.id)||this.refreshRunning().catch((()=>{})),t}running(){return this._models.values()}async refreshRunning(){await this._pollModels.refresh(),await this._pollModels.tick}async startNew(e,t={}){const n=await(0,l.startSession)(e,this.serverSettings);return await this.refreshRunning(),this.connectTo({...t,model:n})}async shutdown(e){await(0,l.shutdownSession)(e,this.serverSettings),await this.refreshRunning()}async shutdownAll(){await this.refreshRunning(),await Promise.all([...this._models.keys()].map((e=>(0,l.shutdownSession)(e,this.serverSettings)))),await this.refreshRunning()}async stopIfNeeded(e){try{const t=(await(0,l.listRunning)(this.serverSettings)).filter((t=>t.path===e));if(1===t.length){const e=t[0].id;await this.shutdown(e)}}catch(e){}}async findById(e){return this._models.has(e)||await this.refreshRunning(),this._models.get(e)}async findByPath(e){for(const t of this._models.values())if(t.path===e)return t;await this.refreshRunning();for(const t of this._models.values())if(t.path===e)return t}async requestRunning(){var e,t;let n;try{n=await(0,l.listRunning)(this.serverSettings)}catch(n){throw(n instanceof s.ServerConnection.NetworkError||503===(null===(e=n.response)||void 0===e?void 0:e.status)||424===(null===(t=n.response)||void 0===t?void 0:t.status))&&this._connectionFailure.emit(n),n}this.isDisposed||this._models.size===n.length&&n.every((e=>{var t,n,i,r;const s=this._models.get(e.id);return!!s&&(null===(t=s.kernel)||void 0===t?void 0:t.id)===(null===(n=e.kernel)||void 0===n?void 0:n.id)&&(null===(i=s.kernel)||void 0===i?void 0:i.name)===(null===(r=e.kernel)||void 0===r?void 0:r.name)&&s.name===e.name&&s.path===e.path&&s.type===e.type}))||(this._models=new Map(n.map((e=>[e.id,e]))),this._sessionConnections.forEach((e=>{this._models.has(e.id)?e.update(this._models.get(e.id)):e.dispose()})),this._runningChanged.emit(n))}_onStarted(e){this._sessionConnections.add(e),e.disposed.connect(this._onDisposed,this),e.propertyChanged.connect(this._onChanged,this),e.kernelChanged.connect(this._onChanged,this)}_onDisposed(e){this._sessionConnections.delete(e),this.refreshRunning().catch((()=>{}))}_onChanged(){this.refreshRunning().catch((()=>{}))}}t.SessionManager=u,function(e){e.NoopManager=class extends e{constructor(){super(...arguments),this._readyPromise=new Promise((()=>{}))}get isActive(){return!1}get parentReady(){return super.ready}async startNew(e,t={}){return Promise.reject(new Error("Not implemented in no-op Session Manager"))}connectTo(e){throw Error("Not implemented in no-op Session Manager")}get ready(){return this.parentReady.then((()=>this._readyPromise))}async shutdown(e){return Promise.reject(new Error("Not implemented in no-op Session Manager"))}async requestRunning(){return Promise.resolve()}}}(u||(t.SessionManager=u={}))},7570:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.updateSession=t.startSession=t.getSessionModel=t.shutdownSession=t.getSessionUrl=t.listRunning=t.SESSION_SERVICE_URL=void 0;const i=n(2920),r=n(8925),s=n(5684);function o(e,n){const i=r.URLExt.join(e,t.SESSION_SERVICE_URL),s=r.URLExt.join(i,n);if(!s.startsWith(i))throw new Error("Can only be used for services requests");return s}t.SESSION_SERVICE_URL="api/sessions",t.listRunning=async function(e=i.ServerConnection.makeSettings()){const n=r.URLExt.join(e.baseUrl,t.SESSION_SERVICE_URL),o=await i.ServerConnection.makeRequest(n,{},e);if(200!==o.status)throw await i.ServerConnection.ResponseError.create(o);const a=await o.json();if(!Array.isArray(a))throw new Error("Invalid Session list");return a.forEach((e=>{(0,s.updateLegacySessionModel)(e),(0,s.validateModel)(e)})),a},t.getSessionUrl=o,t.shutdownSession=async function(e,t=i.ServerConnection.makeSettings()){var n;const r=o(t.baseUrl,e),s=await i.ServerConnection.makeRequest(r,{method:"DELETE"},t);if(404===s.status){const t=null!==(n=(await s.json()).message)&&void 0!==n?n:`The session "${e}"" does not exist on the server`;console.warn(t)}else{if(410===s.status)throw new i.ServerConnection.ResponseError(s,"The kernel was deleted but the session was not");if(204!==s.status)throw await i.ServerConnection.ResponseError.create(s)}},t.getSessionModel=async function(e,t=i.ServerConnection.makeSettings()){const n=o(t.baseUrl,e),r=await i.ServerConnection.makeRequest(n,{},t);if(200!==r.status)throw await i.ServerConnection.ResponseError.create(r);const a=await r.json();return(0,s.updateLegacySessionModel)(a),(0,s.validateModel)(a),a},t.startSession=async function(e,n=i.ServerConnection.makeSettings()){const o=r.URLExt.join(n.baseUrl,t.SESSION_SERVICE_URL),a={method:"POST",body:JSON.stringify(e)},l=await i.ServerConnection.makeRequest(o,a,n);if(201!==l.status)throw await i.ServerConnection.ResponseError.create(l);const u=await l.json();return(0,s.updateLegacySessionModel)(u),(0,s.validateModel)(u),u},t.updateSession=async function(e,t=i.ServerConnection.makeSettings()){const n=o(t.baseUrl,e.id),r={method:"PATCH",body:JSON.stringify(e)},a=await i.ServerConnection.makeRequest(n,r,t);if(200!==a.status)throw await i.ServerConnection.ResponseError.create(a);const l=await a.json();return(0,s.updateLegacySessionModel)(l),(0,s.validateModel)(l),l}},7240:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5684:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateModels=t.updateLegacySessionModel=t.validateModel=void 0;const i=n(5855),r=n(7441);function s(e){(0,r.validateProperty)(e,"id","string"),(0,r.validateProperty)(e,"type","string"),(0,r.validateProperty)(e,"name","string"),(0,r.validateProperty)(e,"path","string"),(0,r.validateProperty)(e,"kernel","object"),(0,i.validateModel)(e.kernel)}t.validateModel=s,t.updateLegacySessionModel=function(e){void 0===e.path&&void 0!==e.notebook&&(e.path=e.notebook.path,e.type="notebook",e.name="")},t.validateModels=function(e){if(!Array.isArray(e))throw new Error("Invalid session list");e.forEach((e=>s(e)))}},7780:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SettingManager=void 0;const i=n(8925),r=n(1670),s=n(2920);class o extends r.DataConnector{constructor(e={}){var t;super(),this.serverSettings=null!==(t=e.serverSettings)&&void 0!==t?t:s.ServerConnection.makeSettings()}async fetch(e){if(!e)throw new Error("Plugin `id` parameter is required for settings fetch.");const{serverSettings:t}=this,{baseUrl:n,appUrl:i}=t,{makeRequest:r,ResponseError:o}=s.ServerConnection,l=n+i,u=a.url(l,e),d=await r(u,{},t);if(200!==d.status)throw await o.create(d);return d.json()}async list(e){var t,n,i,r;const{serverSettings:o}=this,{baseUrl:l,appUrl:u}=o,{makeRequest:d,ResponseError:c}=s.ServerConnection,h=l+u,p=a.url(h,"","ids"===e),f=await d(p,{},o);if(200!==f.status)throw new c(f);const g=await f.json(),m=null!==(n=null===(t=null==g?void 0:g.settings)||void 0===t?void 0:t.map((e=>e.id)))&&void 0!==n?n:[];let v=[];return e||(v=null!==(r=null===(i=null==g?void 0:g.settings)||void 0===i?void 0:i.map((e=>(e.data={composite:{},user:{}},e))))&&void 0!==r?r:[]),{ids:m,values:v}}async save(e,t){const{serverSettings:n}=this,{baseUrl:i,appUrl:r}=n,{makeRequest:o,ResponseError:l}=s.ServerConnection,u=i+r,d=a.url(u,e),c={body:JSON.stringify({raw:t}),method:"PUT"},h=await o(d,c,n);if(204!==h.status)throw new l(h)}}var a;t.SettingManager=o,function(e){e.url=function(e,t,n){const r=n?i.URLExt.objectToQueryString({ids_only:!0}):"",s=i.URLExt.join(e,"api/settings"),o=i.URLExt.join(s,t);if(!o.startsWith(s))throw new Error("Can only be used for workspaces requests");return`${o}${r}`}}(a||(a={}))},7251:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=WebSocket},9040:(e,t)=>{},9191:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UserManager=void 0;const i=n(8925),r=n(5764),s=n(6049),o=n(8571),a=n(2920),l=n(3867),u="@jupyterlab/services:UserManager#user";class d extends l.BaseManager{constructor(e={}){var t;super(e),this._isReady=!1,this._userChanged=new o.Signal(this),this._connectionFailure=new o.Signal(this),this._ready=this.requestUser().then((()=>{this.isDisposed||(this._isReady=!0)})).catch((e=>new Promise((()=>{})))),this._pollSpecs=new s.Poll({auto:!1,factory:()=>this.requestUser(),frequency:{interval:61e3,backoff:!0,max:3e5},name:u,standby:null!==(t=e.standby)&&void 0!==t?t:"when-hidden"}),this.ready.then((()=>{this._pollSpecs.start()}))}get isReady(){return this._isReady}get ready(){return this._ready}get identity(){return this._identity}get permissions(){return this._permissions}get userChanged(){return this._userChanged}get connectionFailure(){return this._connectionFailure}dispose(){this._pollSpecs.dispose(),super.dispose()}async refreshUser(){await this._pollSpecs.refresh(),await this._pollSpecs.tick}async requestUser(){if(this.isDisposed)return;const{baseUrl:e}=this.serverSettings,{makeRequest:t,ResponseError:n}=a.ServerConnection,s=i.URLExt.join(e,"api/me"),o=await t(s,{},this.serverSettings);if(200!==o.status)throw await n.create(o);const l={identity:this._identity,permissions:this._permissions},d=await o.json(),h=d.identity,{localStorage:p}=window,f=p.getItem(u);if(f&&(!h.initials||!h.color)){const e=JSON.parse(f);h.initials=h.initials||e.initials||h.name.substring(0,1),h.color=h.color||e.color||c.getRandomColor()}r.JSONExt.deepEqual(d,l)||(this._identity=h,this._permissions=d.permissions,p.setItem(u,JSON.stringify(h)),this._userChanged.emit(d))}}var c;t.UserManager=d,function(e){const t=["var(--jp-collaborator-color1)","var(--jp-collaborator-color2)","var(--jp-collaborator-color3)","var(--jp-collaborator-color4)","var(--jp-collaborator-color5)","var(--jp-collaborator-color6)","var(--jp-collaborator-color7)"];e.getRandomColor=()=>t[Math.floor(Math.random()*t.length)]}(c||(c={}))},7441:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateProperty=void 0,t.validateProperty=function(e,t,n,i=[]){if(!e.hasOwnProperty(t))throw Error(`Missing property '${t}'`);const r=e[t];if(void 0!==n){let e=!0;switch(n){case"array":e=Array.isArray(r);break;case"object":e=void 0!==r;break;default:e=typeof r===n}if(!e)throw new Error(`Property '${t}' is not of type '${n}'`);if(i.length>0){let e=!0;switch(n){case"string":case"number":case"boolean":e=i.includes(r);break;default:e=i.findIndex((e=>e===r))>=0}if(!e)throw new Error(`Property '${t}' is not one of the valid values ${JSON.stringify(i)}`)}}}},8053:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WorkspaceManager=void 0;const i=n(8925),r=n(1670),s=n(2920);class o extends r.DataConnector{constructor(e={}){var t;super(),this.serverSettings=null!==(t=e.serverSettings)&&void 0!==t?t:s.ServerConnection.makeSettings()}async fetch(e){const{serverSettings:t}=this,{baseUrl:n,appUrl:i}=t,{makeRequest:r,ResponseError:o}=s.ServerConnection,l=n+i,u=a.url(l,e),d=await r(u,{},t);if(200!==d.status)throw await o.create(d);return d.json()}async list(){const{serverSettings:e}=this,{baseUrl:t,appUrl:n}=e,{makeRequest:i,ResponseError:r}=s.ServerConnection,o=t+n,l=a.url(o,""),u=await i(l,{},e);if(200!==u.status)throw await r.create(u);return(await u.json()).workspaces}async remove(e){const{serverSettings:t}=this,{baseUrl:n,appUrl:i}=t,{makeRequest:r,ResponseError:o}=s.ServerConnection,l=n+i,u=a.url(l,e),d=await r(u,{method:"DELETE"},t);if(204!==d.status)throw await o.create(d)}async save(e,t){const{serverSettings:n}=this,{baseUrl:i,appUrl:r}=n,{makeRequest:o,ResponseError:l}=s.ServerConnection,u=i+r,d=a.url(u,e),c={body:JSON.stringify(t),method:"PUT"},h=await o(d,c,n);if(204!==h.status)throw await l.create(h)}}var a;t.WorkspaceManager=o,function(e){e.url=function(e,t){const n=i.URLExt.join(e,"api/workspaces"),r=i.URLExt.join(n,t);if(!r.startsWith(n))throw new Error("Can only be used for workspaces requests");return r}}(a||(a={}))},4949:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DataConnector=void 0,t.DataConnector=class{async list(e){throw new Error("DataConnector#list method has not been implemented.")}async remove(e){throw new Error("DataConnector#remove method has not been implemented.")}async save(e,t){throw new Error("DataConnector#save method has not been implemented.")}}},1670:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),r(n(4949),t),r(n(9708),t),r(n(4025),t),r(n(2133),t),r(n(8022),t)},9708:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},4025:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RestorablePool=void 0;const i=n(5764),r=n(6573),s=n(8571);var o;t.RestorablePool=class{constructor(e){this._added=new s.Signal(this),this._current=null,this._currentChanged=new s.Signal(this),this._hasRestored=!1,this._isDisposed=!1,this._objects=new Set,this._restore=null,this._restored=new i.PromiseDelegate,this._updated=new s.Signal(this),this.namespace=e.namespace}get added(){return this._added}get current(){return this._current}set current(e){this._current!==e&&null!==e&&this._objects.has(e)&&(this._current=e,this._currentChanged.emit(this._current))}get currentChanged(){return this._currentChanged}get isDisposed(){return this._isDisposed}get restored(){return this._restored.promise}get size(){return this._objects.size}get updated(){return this._updated}async add(e){var t,n;if(e.isDisposed){const t="A disposed object cannot be added.";throw console.warn(t,e),new Error(t)}if(this._objects.has(e)){const t="This object already exists in the pool.";throw console.warn(t,e),new Error(t)}if(this._objects.add(e),e.disposed.connect(this._onInstanceDisposed,this),!o.injectedProperty.get(e)){if(this._restore){const{connector:i}=this._restore,r=this._restore.name(e);if(r){const s=`${this.namespace}:${r}`,a=null===(n=(t=this._restore).args)||void 0===n?void 0:n.call(t,e);o.nameProperty.set(e,s),await i.save(s,{data:a})}}this._added.emit(e)}}dispose(){this.isDisposed||(this._current=null,this._isDisposed=!0,this._objects.clear(),s.Signal.clearData(this))}find(e){const t=this._objects.values();for(const n of t)if(e(n))return n}forEach(e){this._objects.forEach(e)}filter(e){const t=[];return this.forEach((n=>{e(n)&&t.push(n)})),t}inject(e){return o.injectedProperty.set(e,!0),this.add(e)}has(e){return this._objects.has(e)}async restore(e){if(this._hasRestored)throw new Error("This pool has already been restored.");this._hasRestored=!0;const{command:t,connector:n,registry:i,when:r}=e,s=this.namespace,o=r?[n.list(s)].concat(r):[n.list(s)];this._restore=e;const[a]=await Promise.all(o),l=await Promise.all(a.ids.map((async(e,r)=>{const s=a.values[r],o=s&&s.data;return void 0===o?n.remove(e):i.execute(t,o).catch((()=>n.remove(e)))})));return this._restored.resolve(),l}async save(e){var t,n;const i=o.injectedProperty.get(e);if(!this._restore||!this.has(e)||i)return;const{connector:r}=this._restore,s=this._restore.name(e),a=o.nameProperty.get(e),l=s?`${this.namespace}:${s}`:"";if(a&&a!==l&&await r.remove(a),o.nameProperty.set(e,l),l){const i=null===(n=(t=this._restore).args)||void 0===n?void 0:n.call(t,e);await r.save(l,{data:i})}a!==l&&this._updated.emit(e)}_onInstanceDisposed(e){if(this._objects.delete(e),e===this._current&&(this._current=null,this._currentChanged.emit(this._current)),o.injectedProperty.get(e))return;if(!this._restore)return;const{connector:t}=this._restore,n=o.nameProperty.get(e);n&&t.remove(n)}},function(e){e.injectedProperty=new r.AttachedProperty({name:"injected",create:()=>!1}),e.nameProperty=new r.AttachedProperty({name:"name",create:()=>""})}(o||(o={}))},2133:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StateDB=void 0;const i=n(8571);class r{constructor(e={}){this._changed=new i.Signal(this);const{connector:t,transform:n}=e;this._connector=t||new r.Connector,this._ready=n?n.then((e=>{const{contents:t,type:n}=e;switch(n){case"cancel":default:return;case"clear":return this._clear();case"merge":return this._merge(t||{});case"overwrite":return this._overwrite(t||{})}})):Promise.resolve(void 0)}get changed(){return this._changed}async clear(){await this._ready,await this._clear()}async fetch(e){return await this._ready,this._fetch(e)}async list(e){return await this._ready,this._list(e)}async remove(e){await this._ready,await this._remove(e),this._changed.emit({id:e,type:"remove"})}async save(e,t){await this._ready,await this._save(e,t),this._changed.emit({id:e,type:"save"})}async toJSON(){await this._ready;const{ids:e,values:t}=await this._list();return t.reduce(((t,n,i)=>(t[e[i]]=n,t)),{})}async _clear(){await Promise.all((await this._list()).ids.map((e=>this._remove(e))))}async _fetch(e){const t=await this._connector.fetch(e);if(t)return JSON.parse(t).v}async _list(e=""){const{ids:t,values:n}=await this._connector.list(e);return{ids:t,values:n.map((e=>JSON.parse(e).v))}}async _merge(e){await Promise.all(Object.keys(e).map((t=>e[t]&&this._save(t,e[t]))))}async _overwrite(e){await this._clear(),await this._merge(e)}async _remove(e){return this._connector.remove(e)}async _save(e,t){return this._connector.save(e,JSON.stringify({v:t}))}}t.StateDB=r,function(e){e.Connector=class{constructor(){this._storage={}}async fetch(e){return this._storage[e]}async list(e=""){return Object.keys(this._storage).reduce(((t,n)=>(""!==e&&e!==n.split(":")[0]||(t.ids.push(n),t.values.push(this._storage[n])),t)),{ids:[],values:[]})}async remove(e){delete this._storage[e]}async save(e,t){this._storage[e]=t}}}(r||(t.StateDB=r={}))},8022:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IStateDB=void 0;const i=n(5764);t.IStateDB=new i.Token("@jupyterlab/coreutils:IStateDB",'A service for the JupyterLab state database.\n Use this if you want to store data that will persist across page loads.\n See "state database" for more information.')},509:(e,t,n)=>{"use strict";function i(e){return e.replace("-","_")}n.d(t,{sQ:()=>l,wK:()=>s});class r{constructor(e){e=e||{},this._defaults={domain:"messages",locale:document.documentElement.getAttribute("lang")||"en",pluralFunc:function(e){return{nplurals:2,plural:1!=e?1:0}},contextDelimiter:String.fromCharCode(4),stringsPrefix:""},this._locale=(e.locale||this._defaults.locale).replace("_","-"),this._domain=i(e.domain||this._defaults.domain),this._contextDelimiter=e.contextDelimiter||this._defaults.contextDelimiter,this._stringsPrefix=e.stringsPrefix||this._defaults.stringsPrefix,this._pluralFuncs={},this._dictionary={},this._pluralForms={},e.messages&&(this._dictionary[this._domain]={},this._dictionary[this._domain][this._locale]=e.messages),e.pluralForms&&(this._pluralForms[this._locale]=e.pluralForms)}setContextDelimiter(e){this._contextDelimiter=e}getContextDelimiter(){return this._contextDelimiter}setLocale(e){this._locale=e.replace("_","-")}getLocale(){return this._locale}setDomain(e){this._domain=i(e)}getDomain(){return this._domain}setStringsPrefix(e){this._stringsPrefix=e}getStringsPrefix(){return this._stringsPrefix}static strfmt(e,...t){return e.replace(/%%/g,"%% ").replace(/%(\d+)/g,(function(e,n){return t[n-1]})).replace(/%% /g,"%")}loadJSON(e,t){if(!e[""]||!e[""].language||!e[""].pluralForms)throw new Error(`Wrong jsonData, it must have an empty key ("") with "language" and "pluralForms" information: ${e}`);t=i(t);let n=e[""],r=JSON.parse(JSON.stringify(e));delete r[""],this.setMessages(t||this._defaults.domain,n.language,r,n.pluralForms)}__(e,...t){return this.gettext(e,...t)}_n(e,t,n,...i){return this.ngettext(e,t,n,...i)}_p(e,t,...n){return this.pgettext(e,t,...n)}_np(e,t,n,i,...r){return this.npgettext(e,t,n,i,...r)}gettext(e,...t){return this.dcnpgettext("","",e,"",0,...t)}ngettext(e,t,n,...i){return this.dcnpgettext("","",e,t,n,...i)}pgettext(e,t,...n){return this.dcnpgettext("",e,t,"",0,...n)}npgettext(e,t,n,i,...r){return this.dcnpgettext("",e,t,n,i,...r)}dcnpgettext(e,t,n,r,s,...o){let a;e=i(e)||this._domain;let l=t?t+this._contextDelimiter+n:n,u={pluralForm:!1},d=!1,c=this._locale,h=this.expandLocale(this._locale);for(let t in h)if(c=h[t],d=this._dictionary[e]&&this._dictionary[e][c]&&this._dictionary[e][c][l],d=r?d&&this._dictionary[e][c][l].length>1:d&&1==this._dictionary[e][c][l].length,d){u.locale=c;break}if(d?a=this._dictionary[e][c][l]:(a=[n],u.pluralFunc=this._defaults.pluralFunc),!r)return this.t(a,s,u,...o);u.pluralForm=!0;let p=d?a:[n,r];return this.t(p,s,u,...o)}expandLocale(e){let t=[e],n=e.lastIndexOf("-");for(;n>0;)e=e.slice(0,n),t.push(e),n=e.lastIndexOf("-");return t}getPluralFunc(e){if(!new RegExp("^\\s*nplurals\\s*=\\s*[0-9]+\\s*;\\s*plural\\s*=\\s*(?:\\s|[-\\?\\|&=!<>+*/%:;n0-9_()])+").test(e))throw new Error(r.strfmt('The plural form "%1" is not valid',e));return new Function("n","let plural, nplurals; "+e+" return { nplurals: nplurals, plural: (plural === true ? 1 : (plural ? plural : 0)) };")}removeContext(e){return-1!==e.indexOf(this._contextDelimiter)?e.split(this._contextDelimiter)[1]:e}t(e,t,n,...i){if(!n.pluralForm)return this._stringsPrefix+r.strfmt(this.removeContext(e[0]),...i);let s;return n.pluralFunc?s=n.pluralFunc(t):(this._pluralFuncs[n.locale||""]||(this._pluralFuncs[n.locale||""]=this.getPluralFunc(this._pluralForms[n.locale||""])),s=this._pluralFuncs[n.locale||""](t)),(void 0===!s.plural||s.plural>s.nplurals||e.length<=s.plural)&&(s.plural=0),this._stringsPrefix+r.strfmt(this.removeContext(e[s.plural]),...[t].concat(i))}setMessages(e,t,n,r){e=i(e),r&&(this._pluralForms[t]=r),this._dictionary[e]||(this._dictionary[e]={}),this._dictionary[e][t]=n}}const s=new class{constructor(e){this.languageCode="en",this._languageBundle=e}load(e){return this._languageBundle}}(new class{__(e,...t){return this.gettext(e,...t)}_n(e,t,n,...i){return this.ngettext(e,t,n,...i)}_p(e,t,...n){return this.pgettext(e,t,...n)}_np(e,t,n,i,...r){return this.npgettext(e,t,n,i,...r)}gettext(e,...t){return r.strfmt(e,...t)}ngettext(e,t,n,...i){return r.strfmt(1==n?e:t,...[n].concat(i))}pgettext(e,t,...n){return r.strfmt(t,...n)}npgettext(e,t,n,i,...r){return this.ngettext(t,n,i,...r)}dcnpgettext(e,t,n,i,r,...s){return this.ngettext(n,i,r,...s)}});var o=n(1670),a=n(5764);n(8925),n(7883),new a.Token("@jupyterlab/translation:ITranslatorConnector","A service to connect to the server translation endpoint."),o.DataConnector;const l=new a.Token("@jupyterlab/translation:ITranslator","A service to translate strings.")},8135:(e,t,n)=>{"use strict";var i;function r(e){return"function"==typeof e.iter?e.iter():new l(e)}function s(e,t){for(var n,i=0,s=r(e);void 0!==(n=s.next());)if(!1===t(n,i++))return}function o(e,t){for(var n,i=0,s=r(e);void 0!==(n=s.next());)if(!t(n,i++))return!1;return!0}function a(e,t){for(var n,i=0,s=r(e);void 0!==(n=s.next());)if(t(n,i++))return!0;return!1}n.d(t,{$0:()=>h,Ie:()=>u,Rw:()=>i,Si:()=>o,__:()=>s,zN:()=>a}),function(e){function t(e,t,n,i){void 0===n&&(n=0),void 0===i&&(i=-1);var r,s=e.length;if(0===s)return-1;n=n<0?Math.max(0,n+s):Math.min(n,s-1),r=(i=i<0?Math.max(0,i+s):Math.min(i,s-1))=n)){for(var i=e[t],r=t+1;r0;){var l=a>>1,u=o+l;n(e[u],t)<0?(o=u+1,a-=l+1):a=l}return o},e.upperBound=function(e,t,n,i,r){void 0===i&&(i=0),void 0===r&&(r=-1);var s=e.length;if(0===s)return 0;for(var o=i=i<0?Math.max(0,i+s):Math.min(i,s-1),a=(r=r<0?Math.max(0,r+s):Math.min(r,s-1))-i+1;a>0;){var l=a>>1,u=o+l;n(e[u],t)>0?a=l:(o=u+1,a-=l+1)}return o},e.shallowEqual=function(e,t,n){if(e===t)return!0;if(e.length!==t.length)return!1;for(var i=0,r=e.length;i=o&&(n=r<0?o-1:o),void 0===i?i=r<0?-1:o:i<0?i=Math.max(i+o,r<0?-1:0):i>=o&&(i=r<0?o-1:o),s=r<0&&i>=n||r>0&&n>=i?0:r<0?Math.floor((i-n+1)/r+1):Math.floor((i-n-1)/r+1);for(var a=[],l=0;l=(i=i<0?Math.max(0,i+r):Math.min(i,r-1)))){var o=i-n+1;if(t>0?t%=o:t<0&&(t=(t%o+o)%o),0!==t){var a=n+t;s(e,n,a-1),s(e,a,i),s(e,n,i)}}},e.fill=function(e,t,n,i){void 0===n&&(n=0),void 0===i&&(i=-1);var r=e.length;if(0!==r){var s;n=n<0?Math.max(0,n+r):Math.min(n,r-1),s=(i=i<0?Math.max(0,i+r):Math.min(i,r-1))t;--r)e[r]=e[r-1];e[t]=n},e.removeAt=o,e.removeFirstOf=function(e,n,i,r){void 0===i&&(i=0),void 0===r&&(r=-1);var s=t(e,n,i,r);return-1!==s&&o(e,s),s},e.removeLastOf=function(e,t,i,r){void 0===i&&(i=-1),void 0===r&&(r=0);var s=n(e,t,i,r);return-1!==s&&o(e,s),s},e.removeAllOf=function(e,t,n,i){void 0===n&&(n=0),void 0===i&&(i=-1);var r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);for(var s=0,o=0;o=n&&o<=i&&e[o]===t||i=n)&&e[o]===t?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s},e.removeFirstWhere=function(e,t,n,r){var s;void 0===n&&(n=0),void 0===r&&(r=-1);var a=i(e,t,n,r);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeLastWhere=function(e,t,n,i){var s;void 0===n&&(n=-1),void 0===i&&(i=0);var a=r(e,t,n,i);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeAllWhere=function(e,t,n,i){void 0===n&&(n=0),void 0===i&&(i=-1);var r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);for(var s=0,o=0;o=n&&o<=i&&t(e[o],o)||i=n)&&t(e[o],o)?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s}}(i||(i={}));var l=function(){function e(e){this._index=0,this._source=e}return e.prototype.iter=function(){return this},e.prototype.clone=function(){var t=new e(this._source);return t._index=this._index,t},e.prototype.next=function(){if(!(this._index>=this._source.length))return this._source[this._index++]},e}();function u(){return new c}(function(){function e(e,t){void 0===t&&(t=Object.keys(e)),this._index=0,this._source=e,this._keys=t}e.prototype.iter=function(){return this},e.prototype.clone=function(){var t=new e(this._source,this._keys);return t._index=this._index,t},e.prototype.next=function(){if(!(this._index>=this._keys.length)){var e=this._keys[this._index++];return e in this._source?e:this.next()}}})(),function(){function e(e,t){void 0===t&&(t=Object.keys(e)),this._index=0,this._source=e,this._keys=t}e.prototype.iter=function(){return this},e.prototype.clone=function(){var t=new e(this._source,this._keys);return t._index=this._index,t},e.prototype.next=function(){if(!(this._index>=this._keys.length)){var e=this._keys[this._index++];return e in this._source?this._source[e]:this.next()}}}(),function(){function e(e,t){void 0===t&&(t=Object.keys(e)),this._index=0,this._source=e,this._keys=t}e.prototype.iter=function(){return this},e.prototype.clone=function(){var t=new e(this._source,this._keys);return t._index=this._index,t},e.prototype.next=function(){if(!(this._index>=this._keys.length)){var e=this._keys[this._index++];return e in this._source?[e,this._source[e]]:this.next()}}}(),function(){function e(e){this._fn=e}e.prototype.iter=function(){return this},e.prototype.clone=function(){throw new Error("An `FnIterator` cannot be cloned.")},e.prototype.next=function(){return this._fn.call(void 0)}}(),function(){function e(e){this._cloned=!1,this._source=e,this._active=void 0}e.prototype.iter=function(){return this},e.prototype.clone=function(){var t=new e(this._source.clone());return t._active=this._active&&this._active.clone(),t._cloned=!0,this._cloned=!0,t},e.prototype.next=function(){if(void 0===this._active){var e=this._source.next();if(void 0===e)return;this._active=this._cloned?e.clone():e}var t=this._active.next();return void 0!==t?t:(this._active=void 0,this.next())}}();var d,c=function(){function e(){}return e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e},e.prototype.next=function(){},e}();function h(e){return"function"==typeof e.retro?e.retro():new f(e)}!function(){function e(e,t){this._source=e,this._index=t}e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._source.clone(),this._index)},e.prototype.next=function(){var e=this._source.next();if(void 0!==e)return[this._index++,e]}}(),function(){function e(e,t){this._index=0,this._source=e,this._fn=t}e.prototype.iter=function(){return this},e.prototype.clone=function(){var t=new e(this._source.clone(),this._fn);return t._index=this._index,t},e.prototype.next=function(){for(var e,t=this._fn,n=this._source;void 0!==(e=n.next());)if(t(e,this._index++))return e}}(),function(){function e(e,t){this._index=0,this._source=e,this._fn=t}e.prototype.iter=function(){return this},e.prototype.clone=function(){var t=new e(this._source.clone(),this._fn);return t._index=this._index,t},e.prototype.next=function(){var e=this._source.next();if(void 0!==e)return this._fn.call(void 0,e,this._index++)}}(),function(){function e(e,t,n){this._index=0,this._start=e,this._stop=t,this._step=n,this._length=d.rangeLength(e,t,n)}e.prototype.iter=function(){return this},e.prototype.clone=function(){var t=new e(this._start,this._stop,this._step);return t._index=this._index,t},e.prototype.next=function(){if(!(this._index>=this._length))return this._start+this._step*this._index++}}(),function(e){e.rangeLength=function(e,t,n){return 0===n?1/0:e>t&&n>0||e=this._source.length))return this._source[this._index--]},e}();!function(){function e(e,t){this._source=e,this._step=t}e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._source.clone(),this._step)},e.prototype.next=function(){for(var e=this._source.next(),t=this._step-1;t>0;--t)this._source.next();return e}}(),function(e){function t(e,t,n){void 0===n&&(n=0);for(var i=new Array(t.length),r=0,s=n,o=t.length;rt?1:0}}(p||(p={})),function(){function e(e,t){this._source=e,this._count=t}e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._source.clone(),this._count)},e.prototype.next=function(){if(!(this._count<=0)){var e=this._source.next();if(void 0!==e)return this._count--,e}}}(),function(){function e(e){this._source=e}e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._source.map((function(e){return e.clone()})))},e.prototype.next=function(){for(var e=new Array(this._source.length),t=0,n=this._source.length;t{if(i===e.provides)return!0;const o=n.get(i);if(!o)return!1;const a=t.get(o),l=[...a.requires,...a.optional];return 0!==l.length&&(s.push(o),!!l.some(r)||(s.pop(),!1))};if(!e.provides||0===i.length)return;const s=[e.id];if(i.some(r))throw new ReferenceError(`Cycle detected: ${s.join(" -> ")}.`)},e.findDependents=function(e,n,i){const r=new Array,s=e=>{const t=n.get(e),s=[...t.requires,...t.optional];r.push(...s.reduce(((t,n)=>{const r=i.get(n);return r&&t.push([e,r]),t}),[]))};for(const e of n.keys())s(e);const o=r.filter((t=>t[1]===e));let a=0;for(;o.length>a;){const e=o.length,t=new Set(o.map((e=>e[0])));for(const e of t)r.filter((t=>t[1]===e)).forEach((e=>{o.includes(e)||o.push(e)}));a=e}const l=t.topologicSort(o),u=l.findIndex((t=>t===e));return-1===u?[e]:l.slice(0,u+1)},e.collectStartupPlugins=function(e,t){const n=new Set;for(const t of e.keys())!0===e.get(t).autoStart&&n.add(t);if(t.startPlugins)for(const e of t.startPlugins)n.add(e);if(t.ignorePlugins)for(const e of t.ignorePlugins)n.delete(e);return Array.from(n)}}(n||(n={}));function i(e){let t=0;for(let n=0,i=e.length;n>>0),e[n]=255&t,t>>>=8}e.Random=void 0,(e.Random||(e.Random={})).getRandomValues=(()=>{const e="undefined"!=typeof window&&(window.crypto||window.msCrypto)||null;return e&&"function"==typeof e.getRandomValues?function(t){return e.getRandomValues(t)}:i})(),e.UUID=void 0,(e.UUID||(e.UUID={})).uuid4=function(e){const t=new Uint8Array(16),n=new Array(256);for(let e=0;e<16;++e)n[e]="0"+e.toString(16);for(let e=16;e<256;++e)n[e]=e.toString(16);return function(){return e(t),t[6]=64|15&t[6],t[8]=128|63&t[8],n[t[0]]+n[t[1]]+n[t[2]]+n[t[3]]+"-"+n[t[4]]+n[t[5]]+"-"+n[t[6]]+n[t[7]]+"-"+n[t[8]]+n[t[9]]+"-"+n[t[10]]+n[t[11]]+n[t[12]]+n[t[13]]+n[t[14]]+n[t[15]]}}(e.Random.getRandomValues),e.MimeData=class{constructor(){this._types=[],this._values=[]}types(){return this._types.slice()}hasData(e){return-1!==this._types.indexOf(e)}getData(e){let t=this._types.indexOf(e);return-1!==t?this._values[t]:void 0}setData(e,t){this.clearData(e),this._types.push(e),this._values.push(t)}clearData(e){let t=this._types.indexOf(e);-1!==t&&(this._types.splice(t,1),this._values.splice(t,1))}clear(){this._types.length=0,this._values.length=0}},e.PluginRegistry=class{constructor(e={}){this._application=null,this._validatePlugin=()=>!0,this._plugins=new Map,this._services=new Map,e.validatePlugin&&(console.info("Plugins may be rejected by the custom validation plugin method."),this._validatePlugin=e.validatePlugin)}get application(){return this._application}set application(e){if(null!==this._application)throw Error("PluginRegistry.application is already set. It cannot be overridden.");this._application=e}get deferredPlugins(){return Array.from(this._plugins).filter((([e,t])=>"defer"===t.autoStart)).map((([e,t])=>e))}getPluginDescription(e){var t,n;return null!==(n=null===(t=this._plugins.get(e))||void 0===t?void 0:t.description)&&void 0!==n?n:""}hasPlugin(e){return this._plugins.has(e)}isPluginActivated(e){var t,n;return null!==(n=null===(t=this._plugins.get(e))||void 0===t?void 0:t.activated)&&void 0!==n&&n}listPlugins(){return Array.from(this._plugins.keys())}registerPlugin(e){if(this._plugins.has(e.id))throw new TypeError(`Plugin '${e.id}' is already registered.`);if(!this._validatePlugin(e))throw new Error(`Plugin '${e.id}' is not valid.`);const t=n.createPluginData(e);n.ensureNoCycle(t,this._plugins,this._services),t.provides&&this._services.set(t.provides,t.id),this._plugins.set(t.id,t)}registerPlugins(e){for(const t of e)this.registerPlugin(t)}deregisterPlugin(e,t){const n=this._plugins.get(e);if(n){if(n.activated&&!t)throw new Error(`Plugin '${e}' is still active.`);this._plugins.delete(e)}}async activatePlugin(e){const t=this._plugins.get(e);if(!t)throw new ReferenceError(`Plugin '${e}' is not registered.`);if(t.activated)return;if(t.promise)return t.promise;const n=t.requires.map((e=>this.resolveRequiredService(e))),i=t.optional.map((e=>this.resolveOptionalService(e)));return t.promise=Promise.all([...n,...i]).then((e=>t.activate.apply(void 0,[this.application,...e]))).then((e=>{t.service=e,t.activated=!0,t.promise=null})).catch((e=>{throw t.promise=null,e})),t.promise}async activatePlugins(e,t={}){switch(e){case"defer":{const e=this.deferredPlugins.filter((e=>this._plugins.get(e).autoStart)).map((e=>this.activatePlugin(e)));await Promise.all(e);break}case"startUp":{const e=n.collectStartupPlugins(this._plugins,t).map((async e=>{try{return await this.activatePlugin(e)}catch(t){console.error(`Plugin '${e}' failed to activate.`,t)}}));await Promise.all(e);break}}}async deactivatePlugin(e){const t=this._plugins.get(e);if(!t)throw new ReferenceError(`Plugin '${e}' is not registered.`);if(!t.activated)return[];if(!t.deactivate)throw new TypeError(`Plugin '${e}'#deactivate() method missing`);const i=n.findDependents(e,this._plugins,this._services),r=i.map((e=>this._plugins.get(e)));for(const t of r)if(!t.deactivate)throw new TypeError(`Plugin ${t.id}#deactivate() method missing (depends on ${e})`);for(const e of r){const t=[...e.requires,...e.optional].map((e=>{const t=this._services.get(e);return t?this._plugins.get(t).service:null}));await e.deactivate(this.application,...t),e.service=null,e.activated=!1}return i.pop(),i}async resolveRequiredService(e){const t=this._services.get(e);if(!t)throw new TypeError(`No provider for: ${e.name}.`);const n=this._plugins.get(t);return n.activated||await this.activatePlugin(t),n.service}async resolveOptionalService(e){const t=this._services.get(e);if(!t)return null;const n=this._plugins.get(t);if(!n.activated)try{await this.activatePlugin(t)}catch(e){return console.error(e),null}return n.service}},e.PromiseDelegate=class{constructor(){this.promise=new Promise(((e,t)=>{this._resolve=e,this._reject=t}))}resolve(e){(0,this._resolve)(e)}reject(e){(0,this._reject)(e)}},e.Token=class{constructor(e,t){this.name=e,this.description=null!=t?t:"",this._tokenStructuralPropertyT=null}}}(t,n(5102))},5102:(e,t,n)=>{"use strict";var i,r,s;function*o(...e){for(const t of e)yield*t}function*a(){}function*l(e,t=0){for(const n of e)yield[t++,n]}function*u(e,t){let n=0;for(const i of e)t(i,n++)&&(yield i)}function d(e,t){let n=0;for(const i of e)if(t(i,n++))return i}function c(e,t){let n=0;for(const i of e)if(t(i,n++))return n-1;return-1}function h(e,t){let n;for(const i of e)void 0!==n?t(i,n)<0&&(n=i):n=i;return n}function p(e,t){let n;for(const i of e)void 0!==n?t(i,n)>0&&(n=i):n=i;return n}function f(e,t){let n,i,r=!0;for(const s of e)r?(n=s,i=s,r=!1):t(s,n)<0?n=s:t(s,i)>0&&(i=s);return r?void 0:[n,i]}function g(e){return Array.from(e)}function m(e){const t={};for(const[n,i]of e)t[n]=i;return t}function v(e,t){let n=0;for(const i of e)if(!1===t(i,n++))return}function b(e,t){let n=0;for(const i of e)if(!1===t(i,n++))return!1;return!0}function A(e,t){let n=0;for(const i of e)if(t(i,n++))return!0;return!1}function*y(e,t){let n=0;for(const i of e)yield t(i,n++)}function*w(e,t,n){void 0===t?(t=e,e=0,n=1):void 0===n&&(n=1);const i=r.rangeLength(e,t,n);for(let t=0;t-1;t--)yield e[t]}function D(e){let t=[],n=new Set,i=new Map;for(const t of e)r(t);for(const[e]of i)s(e);return t;function r(e){let[t,n]=e,r=i.get(n);r?r.push(t):i.set(n,[t])}function s(e){if(n.has(e))return;n.add(e);let r=i.get(e);if(r)for(const e of r)s(e);t.push(e)}}function*S(e,t){let n=0;for(const i of e)0==n++%t&&(yield i)}function*T(e,t){if(t<1)return;const n=e[Symbol.iterator]();let i;for(;0e[Symbol.iterator]()));let n=t.map((e=>e.next()));for(;b(n,(e=>!e.done));n=t.map((e=>e.next())))yield n.map((e=>e.value))}n.r(t),n.d(t,{ArrayExt:()=>i,StringExt:()=>s,chain:()=>o,each:()=>v,empty:()=>a,enumerate:()=>l,every:()=>b,filter:()=>u,find:()=>d,findIndex:()=>c,map:()=>y,max:()=>p,min:()=>h,minmax:()=>f,once:()=>C,range:()=>w,reduce:()=>_,repeat:()=>E,retro:()=>x,some:()=>A,stride:()=>S,take:()=>T,toArray:()=>g,toObject:()=>m,topologicSort:()=>D,zip:()=>B}),function(e){function t(e,t,n=0,i=-1){let r,s=e.length;if(0===s)return-1;n=n<0?Math.max(0,n+s):Math.min(n,s-1),r=(i=i<0?Math.max(0,i+s):Math.min(i,s-1))=n)return;let i=e[t];for(let i=t+1;i0;){let i=a>>1,r=o+i;n(e[r],t)<0?(o=r+1,a-=i+1):a=i}return o},e.upperBound=function(e,t,n,i=0,r=-1){let s=e.length;if(0===s)return 0;let o=i=i<0?Math.max(0,i+s):Math.min(i,s-1),a=(r=r<0?Math.max(0,r+s):Math.min(r,s-1))-i+1;for(;a>0;){let i=a>>1,r=o+i;n(e[r],t)>0?a=i:(o=r+1,a-=i+1)}return o},e.shallowEqual=function(e,t,n){if(e===t)return!0;if(e.length!==t.length)return!1;for(let i=0,r=e.length;i=o&&(n=r<0?o-1:o),void 0===i?i=r<0?-1:o:i<0?i=Math.max(i+o,r<0?-1:0):i>=o&&(i=r<0?o-1:o),s=r<0&&i>=n||r>0&&n>=i?0:r<0?Math.floor((i-n+1)/r+1):Math.floor((i-n-1)/r+1);let a=[];for(let t=0;t=(i=i<0?Math.max(0,i+r):Math.min(i,r-1)))return;let o=i-n+1;if(t>0?t%=o:t<0&&(t=(t%o+o)%o),0===t)return;let a=n+t;s(e,n,a-1),s(e,a,i),s(e,n,i)},e.fill=function(e,t,n=0,i=-1){let r,s=e.length;if(0!==s){n=n<0?Math.max(0,n+s):Math.min(n,s-1),r=(i=i<0?Math.max(0,i+s):Math.min(i,s-1))t;--n)e[n]=e[n-1];e[t]=n},e.removeAt=o,e.removeFirstOf=function(e,n,i=0,r=-1){let s=t(e,n,i,r);return-1!==s&&o(e,s),s},e.removeLastOf=function(e,t,i=-1,r=0){let s=n(e,t,i,r);return-1!==s&&o(e,s),s},e.removeAllOf=function(e,t,n=0,i=-1){let r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);let s=0;for(let o=0;o=n&&o<=i&&e[o]===t||i=n)&&e[o]===t?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s},e.removeFirstWhere=function(e,t,n=0,r=-1){let s,a=i(e,t,n,r);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeLastWhere=function(e,t,n=-1,i=0){let s,a=r(e,t,n,i);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeAllWhere=function(e,t,n=0,i=-1){let r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);let s=0;for(let o=0;o=n&&o<=i&&t(e[o],o)||i=n)&&t(e[o],o)?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s}}(i||(i={})),function(e){e.rangeLength=function(e,t,n){return 0===n?1/0:e>t&&n>0||et?1:0}}(s||(s={}))},7556:(e,t,n)=>{"use strict";n.r(t),n.d(t,{DisposableDelegate:()=>r,DisposableSet:()=>o,ObservableDisposableDelegate:()=>s,ObservableDisposableSet:()=>a});var i=n(8571);class r{constructor(e){this._fn=e}get isDisposed(){return!this._fn}dispose(){if(!this._fn)return;let e=this._fn;this._fn=null,e()}}class s extends r{constructor(){super(...arguments),this._disposed=new i.Signal(this)}get disposed(){return this._disposed}dispose(){this.isDisposed||(super.dispose(),this._disposed.emit(void 0),i.Signal.clearData(this))}}class o{constructor(){this._isDisposed=!1,this._items=new Set}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,this._items.forEach((e=>{e.dispose()})),this._items.clear())}contains(e){return this._items.has(e)}add(e){this._items.add(e)}remove(e){this._items.delete(e)}clear(){this._items.clear()}}!function(e){e.from=function(t){let n=new e;for(const e of t)n.add(e);return n}}(o||(o={}));class a extends o{constructor(){super(...arguments),this._disposed=new i.Signal(this)}get disposed(){return this._disposed}dispose(){this.isDisposed||(super.dispose(),this._disposed.emit(void 0),i.Signal.clearData(this))}}!function(e){e.from=function(t){let n=new e;for(const e of t)n.add(e);return n}}(a||(a={}))},3326:(e,t,n)=>{"use strict";n.d(t,{Mu:()=>l});var i,r=n(8135),s=function(){function e(e){this._root=new i.LeafNode,this.cmp=e}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return 0===this._root.size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this._root.size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"first",{get:function(){var e=i.firstLeaf(this._root);return e.size>0?e.items[0]:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"last",{get:function(){var e=i.lastLeaf(this._root);return e.size>0?e.items[e.size-1]:void 0},enumerable:!0,configurable:!0}),e.prototype.iter=function(){return i.iterItems(this._root)},e.prototype.retro=function(){return i.retroItems(this._root)},e.prototype.slice=function(e,t){return i.sliceItems(this._root,e,t)},e.prototype.retroSlice=function(e,t){return i.retroSliceItems(this._root,e,t)},e.prototype.at=function(e){return i.itemAt(this._root,e)},e.prototype.has=function(e,t){return i.hasItem(this._root,e,t)},e.prototype.indexOf=function(e,t){return i.indexOf(this._root,e,t)},e.prototype.get=function(e,t){return i.getItem(this._root,e,t)},e.prototype.assign=function(e){this.clear(),this.update(e)},e.prototype.insert=function(e){var t=i.insertItem(this._root,e,this.cmp);return this._root=i.maybeSplitRoot(this._root),t},e.prototype.update=function(e){var t=this;(0,r.__)(e,(function(e){t.insert(e)}))},e.prototype.delete=function(e,t){var n=i.deleteItem(this._root,e,t);return this._root=i.maybeExtractRoot(this._root),n},e.prototype.remove=function(e){var t=i.removeItem(this._root,e);return this._root=i.maybeExtractRoot(this._root),t},e.prototype.clear=function(){i.clear(this._root),this._root=new i.LeafNode},e}();!function(e){e.from=function(t,n){var i=new e(n);return i.assign(t),i}}(s||(s={})),function(e){var t=function(){function e(){this.items=[],this.sizes=[],this.children=[]}return Object.defineProperty(e.prototype,"type",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this.sizes[this.sizes.length-1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.children.length},enumerable:!0,configurable:!0}),e}();e.BranchNode=t;var n=function(){function e(){this.next=null,this.prev=null,this.items=[]}return Object.defineProperty(e.prototype,"type",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this.items.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.items.length},enumerable:!0,configurable:!0}),e}();function i(e){for(;0===e.type;)e=e.children[0];return e}function s(e){for(;0===e.type;)e=e.children[e.children.length-1];return e}function o(e){0===e.type?((0,r.__)(e.children,o),e.children.length=0,e.sizes.length=0,e.items.length=0):(e.items.length=0,e.next=null,e.prev=null)}e.LeafNode=n,e.firstLeaf=i,e.lastLeaf=s,e.iterItems=function(e){var t=i(e);return new u(t,0,-1)},e.retroItems=function(e){var t=s(e);return new d(t,t.size-1,-1)},e.sliceItems=function(e,t,n){t=void 0===t?0:t<0?Math.max(0,t+e.size):Math.min(t,e.size),n=void 0===n?e.size:n<0?Math.max(0,n+e.size):Math.min(n,e.size);var i=Math.max(0,n-t);if(0===i)return(0,r.Ie)();for(;0===e.type;){var s=c(e.sizes,t);s>0&&(t-=e.sizes[s-1]),e=e.children[s]}return new u(e,t,i)},e.retroSliceItems=function(e,t,n){t=void 0===t?e.size-1:t<0?Math.max(-1,t+e.size):Math.min(t,e.size-1),n=void 0===n?-1:n<0?Math.max(-1,n+e.size):Math.min(n,e.size-1);var i=Math.max(0,t-n);if(0===i)return(0,r.Ie)();for(;0===e.type;){var s=c(e.sizes,t);s>0&&(t-=e.sizes[s-1]),e=e.children[s]}return new d(e,t,i)},e.itemAt=function(e,t){if(t<0&&(t+=e.size),!(t<0||t>=e.size)){for(;0===e.type;){var n=c(e.sizes,t);n>0&&(t-=e.sizes[n-1]),e=e.children[n]}return e.items[t]}},e.hasItem=function(e,t,n){for(;0===e.type;){var i=h(e.items,t,n);e=e.children[i]}return p(e.items,t,n)>=0},e.indexOf=function(e,t,n){for(var i=0;0===e.type;){var r=h(e.items,t,n);r>0&&(i+=e.sizes[r-1]),e=e.children[r]}var s=p(e.items,t,n);return s>=0?i+s:-i+s},e.getItem=function(e,t,n){for(;0===e.type;){var i=h(e.items,t,n);e=e.children[i]}var r=p(e.items,t,n);return r>=0?e.items[r]:void 0},e.insertItem=function e(t,n,i){if(1===t.type){var s,o=p(t.items,n,i);return o>=0?(s=t.items[o],t.items[o]=n):(s=void 0,r.Rw.insert(t.items,-o-1,n)),s}var l=h(t.items,n,i),u=t.children[l],d=u.size,c=e(u,n,i),m=u.size;if(t.items[l]=u.items[0],d===m)return c;if(u.width>a){var v=g(u);r.Rw.insert(t.children,l+1,v),r.Rw.insert(t.items,l+1,v.items[0])}return f(t,l),c},e.deleteItem=function e(t,n,i){if(1===t.type){var s=p(t.items,n,i);if(s<0)return;return r.Rw.removeAt(t.items,s)}var o=h(t.items,n,i),a=t.children[o],u=a.size,d=e(a,n,i);return u===a.size||(t.items[o]=a.items[0],a.width=t.size)){if(1===t.type)return r.Rw.removeAt(t.items,n);var i=c(t.sizes,n);i>0&&(n-=t.sizes[i]);var s=t.children[i],o=e(s,n);return t.items[i]=s.items[0],s.width1)return e;var t=e.children.pop();return o(e),t};var a=32,l=a>>1,u=function(){function e(e,t,n){this._node=e,this._index=t,this._count=n}return e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._node,this._index,this._count)},e.prototype.next=function(){if(null!==this._node&&0!==this._count)return this._index>=this._node.size?(this._node=this._node.next,this._index=0,this.next()):(this._count>0&&this._count--,this._node.items[this._index++])},e}(),d=function(){function e(e,t,n){this._node=e,this._index=t,this._count=n}return e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._node,this._index,this._count)},e.prototype.next=function(){if(null!==this._node&&0!==this._count)return this._index>=this._node.size&&(this._index=this._node.size-1),this._index<0?(this._node=this._node.prev,this._index=this._node?this._node.size-1:-1,this.next()):(this._count>0&&this._count--,this._node.items[this._index--])},e}();function c(e,t){for(var n=e.length,i=0;it)return i;return n-1}function h(e,t,n){for(var i=e.length,r=1;r0)return r-1;return i-1}function p(e,t,n){for(var i=e.length,r=0;r0)return-r-1}return-i-1}function f(e,t){for(var n=e.sizes,i=e.children,r=t>0?n[t-1]:0,s=i.length;tl;if(g&&m&&p){var v=h;return(b=c).items.push(v.items.shift()),e.items[t+1]=v.items[0],t}if(g&&m&&!p)return v=h,(b=c).items.unshift(v.items.pop()),e.items[t]=b.items[0],t-1;if(g&&!m&&p){var b=c;return(n=(v=h).items).unshift.apply(n,b.items),r.Rw.removeAt(e.children,t),r.Rw.removeAt(e.items,t+1),b.prev&&(b.prev.next=v),v.prev=b.prev,o(b),t}if(g&&!m&&!p)return b=c,(i=(v=h).items).push.apply(i,b.items),r.Rw.removeAt(e.children,t),r.Rw.removeAt(e.items,t),b.next&&(b.next.prev=v),v.next=b.next,o(b),t-1;if(!g&&m&&p)return v=h,(b=c).children.push(v.children.shift()),b.items.push(v.items.shift()),e.items[t+1]=v.items[0],f(b,b.width-1),f(v,0),t;if(!g&&m&&!p)return v=h,(b=c).children.unshift(v.children.pop()),b.items.unshift(v.items.pop()),e.items[t]=b.items[0],f(b,0),f(v,v.width-1),t-1;if(!g&&!m&&p)return b=c,(s=(v=h).children).unshift.apply(s,b.children),(a=v.items).unshift.apply(a,b.items),r.Rw.removeAt(e.children,t),r.Rw.removeAt(e.items,t+1),f(v,0),b.children.length=0,o(b),t;if(!g&&!m&&!p)return b=c,(u=(v=h).children).push.apply(u,b.children),(d=v.items).push.apply(d,b.items),r.Rw.removeAt(e.children,t),r.Rw.removeAt(e.items,t),f(v,0),b.children.length=0,o(b),t-1;throw"unreachable"}}(i||(i={}));var o,a=function(){function e(){this._first=null,this._last=null,this._size=0}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return 0===this._size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"first",{get:function(){return this._first?this._first.value:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"last",{get:function(){return this._last?this._last.value:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"firstNode",{get:function(){return this._first},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lastNode",{get:function(){return this._last},enumerable:!0,configurable:!0}),e.prototype.iter=function(){return new e.ForwardValueIterator(this._first)},e.prototype.retro=function(){return new e.RetroValueIterator(this._last)},e.prototype.nodes=function(){return new e.ForwardNodeIterator(this._first)},e.prototype.retroNodes=function(){return new e.RetroNodeIterator(this._last)},e.prototype.assign=function(e){var t=this;this.clear(),(0,r.__)(e,(function(e){t.addLast(e)}))},e.prototype.push=function(e){this.addLast(e)},e.prototype.pop=function(){return this.removeLast()},e.prototype.shift=function(e){this.addFirst(e)},e.prototype.unshift=function(){return this.removeFirst()},e.prototype.addFirst=function(e){var t=new o.LinkedListNode(this,e);return this._first?(t.next=this._first,this._first.prev=t,this._first=t):(this._first=t,this._last=t),this._size++,t},e.prototype.addLast=function(e){var t=new o.LinkedListNode(this,e);return this._last?(t.prev=this._last,this._last.next=t,this._last=t):(this._first=t,this._last=t),this._size++,t},e.prototype.insertBefore=function(e,t){if(!t||t===this._first)return this.addFirst(e);if(!(t instanceof o.LinkedListNode)||t.list!==this)throw new Error("Reference node is not owned by the list.");var n=new o.LinkedListNode(this,e),i=t,r=i.prev;return n.next=i,n.prev=r,i.prev=n,r.next=n,this._size++,n},e.prototype.insertAfter=function(e,t){if(!t||t===this._last)return this.addLast(e);if(!(t instanceof o.LinkedListNode)||t.list!==this)throw new Error("Reference node is not owned by the list.");var n=new o.LinkedListNode(this,e),i=t,r=i.next;return n.next=r,n.prev=i,i.next=n,r.prev=n,this._size++,n},e.prototype.removeFirst=function(){var e=this._first;if(e)return e===this._last?(this._first=null,this._last=null):(this._first=e.next,this._first.prev=null),e.list=null,e.next=null,e.prev=null,this._size--,e.value},e.prototype.removeLast=function(){var e=this._last;if(e)return e===this._first?(this._first=null,this._last=null):(this._last=e.prev,this._last.next=null),e.list=null,e.next=null,e.prev=null,this._size--,e.value},e.prototype.removeNode=function(e){if(!(e instanceof o.LinkedListNode)||e.list!==this)throw new Error("Node is not owned by the list.");var t=e;t===this._first&&t===this._last?(this._first=null,this._last=null):t===this._first?(this._first=t.next,this._first.prev=null):t===this._last?(this._last=t.prev,this._last.next=null):(t.next.prev=t.prev,t.prev.next=t.next),t.list=null,t.next=null,t.prev=null,this._size--},e.prototype.clear=function(){for(var e=this._first;e;){var t=e.next;e.list=null,e.prev=null,e.next=null,e=t}this._first=null,this._last=null,this._size=0},e}();!function(e){e.from=function(t){var n=new e;return n.assign(t),n};var t=function(){function e(e){this._node=e}return e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._node)},e.prototype.next=function(){if(this._node){var e=this._node;return this._node=e.next,e.value}},e}();e.ForwardValueIterator=t;var n=function(){function e(e){this._node=e}return e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._node)},e.prototype.next=function(){if(this._node){var e=this._node;return this._node=e.prev,e.value}},e}();e.RetroValueIterator=n;var i=function(){function e(e){this._node=e}return e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._node)},e.prototype.next=function(){if(this._node){var e=this._node;return this._node=e.next,e}},e}();e.ForwardNodeIterator=i;var r=function(){function e(e){this._node=e}return e.prototype.iter=function(){return this},e.prototype.clone=function(){return new e(this._node)},e.prototype.next=function(){if(this._node){var e=this._node;return this._node=e.prev,e}},e}();e.RetroNodeIterator=r}(a||(a={})),function(e){e.LinkedListNode=function(e,t){this.list=null,this.next=null,this.prev=null,this.list=e,this.value=t}}(o||(o={}));var l,u=function(e,t){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},u(e,t)};!function(e){function t(){return null!==e&&e.apply(this,arguments)||this}(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}u(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)})(t,e),Object.defineProperty(t.prototype,"isConflatable",{get:function(){return!0},enumerable:!0,configurable:!0}),t.prototype.conflate=function(e){return!0}}(function(){function e(e){this.type=e}return Object.defineProperty(e.prototype,"isConflatable",{get:function(){return!1},enumerable:!0,configurable:!0}),e.prototype.conflate=function(e){return!1},e}()),function(e){function t(e,t){var n=i.get(e);if(n&&0!==n.length){var s=(0,r.Si)((0,r.$0)(n),(function(n){return!n||function(e,t,n){var i=!0;try{i="function"==typeof e?e(t,n):e.messageHook(t,n)}catch(e){o(e)}return i}(n,e,t)}));s&&h(e,t)}else h(e,t)}e.sendMessage=t,e.postMessage=function(e,t){t.isConflatable&&(0,r.zN)(n,(function(n){return n.handler===e&&!!n.msg&&n.msg.type===t.type&&!!n.msg.isConflatable&&n.msg.conflate(t)}))||function(e,t){n.addLast({handler:e,msg:t}),0===l&&(l=d(p))}(e,t)},e.installMessageHook=function(e,t){var n=i.get(e);n&&-1!==n.indexOf(t)||(n?n.push(t):i.set(e,[t]))},e.removeMessageHook=function(e,t){var n=i.get(e);if(n){var r=n.indexOf(t);-1!==r&&(n[r]=null,f(n))}},e.clearData=function(e){var t=i.get(e);t&&t.length>0&&(r.Rw.fill(t,null),f(t)),(0,r.__)(n,(function(t){t.handler===e&&(t.handler=null,t.msg=null)}))},e.flush=function(){u||0===l||(c(l),u=!0,p(),u=!1)},e.getExceptionHandler=function(){return o},e.setExceptionHandler=function(e){var t=o;return o=e,t};var n=new a,i=new WeakMap,s=new Set,o=function(e){console.error(e)},l=0,u=!1,d="function"==typeof requestAnimationFrame?requestAnimationFrame:setImmediate,c="function"==typeof cancelAnimationFrame?cancelAnimationFrame:clearImmediate;function h(e,t){try{e.processMessage(t)}catch(e){o(e)}}function p(){if(l=0,!n.isEmpty){var e={handler:null,msg:null};for(n.addLast(e);;){var i=n.removeFirst();if(i===e)return;i.handler&&i.msg&&t(i.handler,i.msg)}}}function f(e){0===s.size&&d(g),s.add(e)}function g(){s.forEach(m),s.clear()}function m(e){r.Rw.removeAllWhere(e,v)}function v(e){return null===e}}(l||(l={}))},6049:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Debouncer:()=>l,Poll:()=>o,RateLimiter:()=>a,Throttler:()=>u});var i,r=n(5764),s=n(8571);class o{constructor(e){var t;this._disposed=new s.Signal(this),this._lingered=0,this._tick=new r.PromiseDelegate,this._ticked=new s.Signal(this),this._factory=e.factory,this._linger=null!==(t=e.linger)&&void 0!==t?t:i.DEFAULT_LINGER,this._standby=e.standby||i.DEFAULT_STANDBY,this._state={...i.DEFAULT_STATE,timestamp:(new Date).getTime()};const n=e.frequency||{},o=Math.max(n.interval||0,n.max||0,i.DEFAULT_FREQUENCY.max);this.frequency={...i.DEFAULT_FREQUENCY,...n,max:o},this.name=e.name||i.DEFAULT_NAME,"auto"in e&&!e.auto||setTimeout((()=>this.start()))}get disposed(){return this._disposed}get frequency(){return this._frequency}set frequency(e){if(this.isDisposed||r.JSONExt.deepEqual(e,this.frequency||{}))return;let{backoff:t,interval:n,max:i}=e;if(n=Math.round(n),i=Math.round(i),"number"==typeof t&&t<1)throw new Error("Poll backoff growth factor must be at least 1");if((n<0||n>i)&&n!==o.NEVER)throw new Error("Poll interval must be between 0 and max");if(i>o.MAX_INTERVAL&&i!==o.NEVER)throw new Error(`Max interval must be less than ${o.MAX_INTERVAL}`);this._frequency={backoff:t,interval:n,max:i}}get isDisposed(){return"disposed"===this.state.phase}get standby(){return this._standby}set standby(e){this.isDisposed||this.standby===e||(this._standby=e)}get state(){return this._state}get tick(){return this._tick.promise}get ticked(){return this._ticked}async*[Symbol.asyncIterator](){for(;!this.isDisposed;)yield this.state,await this.tick.catch((()=>{}))}dispose(){this.isDisposed||(this._state={...i.DISPOSED_STATE,timestamp:(new Date).getTime()},this._tick.promise.catch((e=>{})),this._tick.reject(new Error(`Poll (${this.name}) is disposed.`)),this._disposed.emit(void 0),s.Signal.clearData(this))}refresh(){return this.schedule({cancel:({phase:e})=>"refreshed"===e,interval:o.IMMEDIATE,phase:"refreshed"})}async schedule(e={}){if(this.isDisposed)return;if(e.cancel&&e.cancel(this.state))return;const t=this._tick,n=new r.PromiseDelegate,i={interval:this.frequency.interval,payload:null,phase:"standby",timestamp:(new Date).getTime(),...e};this._state=i,this._tick=n,clearTimeout(this._timeout),this._ticked.emit(this.state),t.resolve(this),await t.promise,i.interval!==o.NEVER?this._timeout=setTimeout((()=>{this.isDisposed||this.tick!==n.promise||this._execute()}),i.interval):this._timeout=void 0}start(){return this.schedule({cancel:({phase:e})=>"constructed"!==e&&"standby"!==e&&"stopped"!==e,interval:o.IMMEDIATE,phase:"started"})}stop(){return this.schedule({cancel:({phase:e})=>"stopped"===e,interval:o.NEVER,phase:"stopped"})}get hidden(){return i.hidden}_execute(){let e="function"==typeof this.standby?this.standby():this.standby;if("never"===e?e=!1:"when-hidden"===e&&(this.hidden?e=++this._lingered>this._linger:(this._lingered=0,e=!1)),e)return void this.schedule();const t=this.tick;this._factory(this.state).then((e=>{this.isDisposed||this.tick!==t||this.schedule({payload:e,phase:"rejected"===this.state.phase?"reconnected":"resolved"})})).catch((e=>{this.isDisposed||this.tick!==t||this.schedule({interval:i.sleep(this.frequency,this.state),payload:e,phase:"rejected"})}))}}!function(e){e.IMMEDIATE=0,e.MAX_INTERVAL=2147483647,e.NEVER=1/0}(o||(o={})),function(e){e.DEFAULT_BACKOFF=3,e.DEFAULT_FREQUENCY={backoff:!0,interval:1e3,max:3e4},e.DEFAULT_LINGER=1,e.DEFAULT_NAME="unknown",e.DEFAULT_STANDBY="when-hidden",e.DEFAULT_STATE={interval:o.NEVER,payload:null,phase:"constructed",timestamp:new Date(0).getTime()},e.DISPOSED_STATE={interval:o.NEVER,payload:null,phase:"disposed",timestamp:new Date(0).getTime()},e.sleep=function(t,n){const{backoff:i,interval:r,max:s}=t;if(r===o.NEVER)return r;const a=!0===i?e.DEFAULT_BACKOFF:!1===i?1:i,l=function(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}(r,n.interval*a);return Math.min(s,l)},e.hidden="undefined"!=typeof document&&(document.addEventListener("visibilitychange",(()=>{e.hidden="hidden"===document.visibilityState})),document.addEventListener("pagehide",(()=>{e.hidden="hidden"===document.visibilityState})),"hidden"===document.visibilityState)}(i||(i={}));class a{constructor(e,t=500){this.args=void 0,this.payload=null,this.limit=t,this.poll=new o({auto:!1,factory:async()=>{const{args:t}=this;return this.args=void 0,e(...t)},frequency:{backoff:!1,interval:o.NEVER,max:o.NEVER},standby:"never"}),this.payload=new r.PromiseDelegate,this.poll.ticked.connect(((e,t)=>{const{payload:n}=this;return"resolved"===t.phase?(this.payload=new r.PromiseDelegate,void n.resolve(t.payload)):"rejected"===t.phase||"stopped"===t.phase?(this.payload=new r.PromiseDelegate,n.promise.catch((e=>{})),void n.reject(t.payload)):void 0}),this)}get isDisposed(){return null===this.payload}dispose(){this.isDisposed||(this.args=void 0,this.payload=null,this.poll.dispose())}async stop(){return this.poll.stop()}}class l extends a{invoke(...e){return this.args=e,this.poll.schedule({interval:this.limit,phase:"invoked"}),this.payload.promise}}class u extends a{constructor(e,t){super(e,"number"==typeof t?t:t&&t.limit),this._trailing=!1,"number"!=typeof t&&t&&"trailing"===t.edge&&(this._trailing=!0),this._interval=this._trailing?this.limit:o.IMMEDIATE}invoke(...e){const t="invoked"!==this.poll.state.phase;return(t||this._trailing)&&(this.args=e),t&&this.poll.schedule({interval:this._interval,phase:"invoked"}),this.payload.promise}}},6573:(e,t,n)=>{"use strict";n.r(t),n.d(t,{AttachedProperty:()=>i});class i{constructor(e){this._pid=r.nextPID(),this.name=e.name,this._create=e.create,this._coerce=e.coerce||null,this._compare=e.compare||null,this._changed=e.changed||null}get(e){let t,n=r.ensureMap(e);return t=this._pid in n?n[this._pid]:n[this._pid]=this._createValue(e),t}set(e,t){let n,i=r.ensureMap(e);n=this._pid in i?i[this._pid]:i[this._pid]=this._createValue(e);let s=this._coerceValue(e,t);this._maybeNotify(e,n,i[this._pid]=s)}coerce(e){let t,n=r.ensureMap(e);t=this._pid in n?n[this._pid]:n[this._pid]=this._createValue(e);let i=this._coerceValue(e,t);this._maybeNotify(e,t,n[this._pid]=i)}_createValue(e){return(0,this._create)(e)}_coerceValue(e,t){let n=this._coerce;return n?n(e,t):t}_compareValue(e,t){let n=this._compare;return n?n(e,t):e===t}_maybeNotify(e,t,n){let i=this._changed;i&&!this._compareValue(t,n)&&i(e,t,n)}}var r;!function(e){e.clearData=function(e){r.ownerData.delete(e)}}(i||(i={})),function(e){e.ownerData=new WeakMap,e.nextPID=(()=>{let e=0;return()=>`pid-${`${Math.random()}`.slice(2)}-${e++}`})(),e.ensureMap=function(t){let n=e.ownerData.get(t);return n||(n=Object.create(null),e.ownerData.set(t,n),n)}}(r||(r={}))},8571:(e,t,n)=>{"use strict";var i,r,s;n.r(t),n.d(t,{Signal:()=>l,Stream:()=>u}),function(e){function t(e,t,n=0,i=-1){let r,s=e.length;if(0===s)return-1;n=n<0?Math.max(0,n+s):Math.min(n,s-1),r=(i=i<0?Math.max(0,i+s):Math.min(i,s-1))=n)return;let i=e[t];for(let i=t+1;i0;){let i=a>>1,r=o+i;n(e[r],t)<0?(o=r+1,a-=i+1):a=i}return o},e.upperBound=function(e,t,n,i=0,r=-1){let s=e.length;if(0===s)return 0;let o=i=i<0?Math.max(0,i+s):Math.min(i,s-1),a=(r=r<0?Math.max(0,r+s):Math.min(r,s-1))-i+1;for(;a>0;){let i=a>>1,r=o+i;n(e[r],t)>0?a=i:(o=r+1,a-=i+1)}return o},e.shallowEqual=function(e,t,n){if(e===t)return!0;if(e.length!==t.length)return!1;for(let i=0,r=e.length;i=o&&(n=r<0?o-1:o),void 0===i?i=r<0?-1:o:i<0?i=Math.max(i+o,r<0?-1:0):i>=o&&(i=r<0?o-1:o),s=r<0&&i>=n||r>0&&n>=i?0:r<0?Math.floor((i-n+1)/r+1):Math.floor((i-n-1)/r+1);let a=[];for(let t=0;t=(i=i<0?Math.max(0,i+r):Math.min(i,r-1)))return;let o=i-n+1;if(t>0?t%=o:t<0&&(t=(t%o+o)%o),0===t)return;let a=n+t;s(e,n,a-1),s(e,a,i),s(e,n,i)},e.fill=function(e,t,n=0,i=-1){let r,s=e.length;if(0!==s){n=n<0?Math.max(0,n+s):Math.min(n,s-1),r=(i=i<0?Math.max(0,i+s):Math.min(i,s-1))t;--n)e[n]=e[n-1];e[t]=n},e.removeAt=o,e.removeFirstOf=function(e,n,i=0,r=-1){let s=t(e,n,i,r);return-1!==s&&o(e,s),s},e.removeLastOf=function(e,t,i=-1,r=0){let s=n(e,t,i,r);return-1!==s&&o(e,s),s},e.removeAllOf=function(e,t,n=0,i=-1){let r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);let s=0;for(let o=0;o=n&&o<=i&&e[o]===t||i=n)&&e[o]===t?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s},e.removeFirstWhere=function(e,t,n=0,r=-1){let s,a=i(e,t,n,r);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeLastWhere=function(e,t,n=-1,i=0){let s,a=r(e,t,n,i);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeAllWhere=function(e,t,n=0,i=-1){let r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);let s=0;for(let o=0;o=n&&o<=i&&t(e[o],o)||i=n)&&t(e[o],o)?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s}}(i||(i={})),function(e){e.rangeLength=function(e,t,n){return 0===n?1/0:e>t&&n>0||et?1:0}}(s||(s={}));var o,a=n(5764);class l{constructor(e){this.sender=e}connect(e,t){return o.connect(this,e,t)}disconnect(e,t){return o.disconnect(this,e,t)}emit(e){o.emit(this,e)}}!function(e){e.disconnectBetween=function(e,t){o.disconnectBetween(e,t)},e.disconnectSender=function(e){o.disconnectSender(e)},e.disconnectReceiver=function(e){o.disconnectReceiver(e)},e.disconnectAll=function(e){o.disconnectAll(e)},e.clearData=function(e){o.disconnectAll(e)},e.getExceptionHandler=function(){return o.exceptionHandler},e.setExceptionHandler=function(e){let t=o.exceptionHandler;return o.exceptionHandler=e,t}}(l||(l={}));class u extends l{constructor(){super(...arguments),this._pending=new a.PromiseDelegate}async*[Symbol.asyncIterator](){let e=this._pending;for(;;)try{const{args:t,next:n}=await e.promise;e=n,yield t}catch(e){return}}emit(e){const t=this._pending,n=this._pending=new a.PromiseDelegate;t.resolve({args:e,next:n}),super.emit(e)}stop(){this._pending.promise.catch((()=>{})),this._pending.reject("stop"),this._pending=new a.PromiseDelegate}}!function(e){function t(e){let t=r.get(e);if(t&&0!==t.length){for(const e of t){if(!e.signal)continue;let t=e.thisArg||e.slot;e.signal=null,d(s.get(t))}d(t)}}function n(e){let t=s.get(e);if(t&&0!==t.length){for(const e of t){if(!e.signal)continue;let t=e.signal.sender;e.signal=null,d(r.get(t))}d(t)}}e.exceptionHandler=e=>{console.error(e)},e.connect=function(e,t,n){n=n||void 0;let i=r.get(e.sender);if(i||(i=[],r.set(e.sender,i)),l(i,e,t,n))return!1;let o=n||t,a=s.get(o);a||(a=[],s.set(o,a));let u={signal:e,slot:t,thisArg:n};return i.push(u),a.push(u),!0},e.disconnect=function(e,t,n){n=n||void 0;let i=r.get(e.sender);if(!i||0===i.length)return!1;let o=l(i,e,t,n);if(!o)return!1;let a=n||t,u=s.get(a);return o.signal=null,d(i),d(u),!0},e.disconnectBetween=function(e,t){let n=r.get(e);if(!n||0===n.length)return;let i=s.get(t);if(i&&0!==i.length){for(const t of i)t.signal&&t.signal.sender===e&&(t.signal=null);d(n),d(i)}},e.disconnectSender=t,e.disconnectReceiver=n,e.disconnectAll=function(e){t(e),n(e)},e.emit=function(e,t){let n=r.get(e.sender);if(n&&0!==n.length)for(let i=0,r=n.length;i{"use strict";var i,r,s;function*o(){}function a(e,t){let n=0;for(const i of e)if(t(i,n++))return i}n.d(t,{$x:()=>_e,Zk:()=>ie,DG:()=>W,VQ:()=>ce,x0:()=>z}),function(e){function t(e,t,n=0,i=-1){let r,s=e.length;if(0===s)return-1;n=n<0?Math.max(0,n+s):Math.min(n,s-1),r=(i=i<0?Math.max(0,i+s):Math.min(i,s-1))=n)return;let i=e[t];for(let i=t+1;i0;){let i=a>>1,r=o+i;n(e[r],t)<0?(o=r+1,a-=i+1):a=i}return o},e.upperBound=function(e,t,n,i=0,r=-1){let s=e.length;if(0===s)return 0;let o=i=i<0?Math.max(0,i+s):Math.min(i,s-1),a=(r=r<0?Math.max(0,r+s):Math.min(r,s-1))-i+1;for(;a>0;){let i=a>>1,r=o+i;n(e[r],t)>0?a=i:(o=r+1,a-=i+1)}return o},e.shallowEqual=function(e,t,n){if(e===t)return!0;if(e.length!==t.length)return!1;for(let i=0,r=e.length;i=o&&(n=r<0?o-1:o),void 0===i?i=r<0?-1:o:i<0?i=Math.max(i+o,r<0?-1:0):i>=o&&(i=r<0?o-1:o),s=r<0&&i>=n||r>0&&n>=i?0:r<0?Math.floor((i-n+1)/r+1):Math.floor((i-n-1)/r+1);let a=[];for(let t=0;t=(i=i<0?Math.max(0,i+r):Math.min(i,r-1)))return;let o=i-n+1;if(t>0?t%=o:t<0&&(t=(t%o+o)%o),0===t)return;let a=n+t;s(e,n,a-1),s(e,a,i),s(e,n,i)},e.fill=function(e,t,n=0,i=-1){let r,s=e.length;if(0!==s){n=n<0?Math.max(0,n+s):Math.min(n,s-1),r=(i=i<0?Math.max(0,i+s):Math.min(i,s-1))t;--n)e[n]=e[n-1];e[t]=n},e.removeAt=o,e.removeFirstOf=function(e,n,i=0,r=-1){let s=t(e,n,i,r);return-1!==s&&o(e,s),s},e.removeLastOf=function(e,t,i=-1,r=0){let s=n(e,t,i,r);return-1!==s&&o(e,s),s},e.removeAllOf=function(e,t,n=0,i=-1){let r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);let s=0;for(let o=0;o=n&&o<=i&&e[o]===t||i=n)&&e[o]===t?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s},e.removeFirstWhere=function(e,t,n=0,r=-1){let s,a=i(e,t,n,r);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeLastWhere=function(e,t,n=-1,i=0){let s,a=r(e,t,n,i);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeAllWhere=function(e,t,n=0,i=-1){let r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);let s=0;for(let o=0;o=n&&o<=i&&t(e[o],o)||i=n)&&t(e[o],o)?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s}}(i||(i={})),function(e){e.rangeLength=function(e,t,n){return 0===n?1/0:e>t&&n>0||et?1:0}}(s||(s={}));var l,u,d,c,h,p,f,g=n(5764);!function(e){e.copyText=function(e){const t=document.body,n=i=>{i.preventDefault(),i.stopPropagation(),i.clipboardData.setData("text",e),t.removeEventListener("copy",n,!0)};t.addEventListener("copy",n,!0),document.execCommand("copy")}}(l||(l={})),function(e){e.boxSizing=function(e){let t=window.getComputedStyle(e),n=parseFloat(t.borderTopWidth)||0,i=parseFloat(t.borderLeftWidth)||0,r=parseFloat(t.borderRightWidth)||0,s=parseFloat(t.borderBottomWidth)||0,o=parseFloat(t.paddingTop)||0,a=parseFloat(t.paddingLeft)||0,l=parseFloat(t.paddingRight)||0,u=parseFloat(t.paddingBottom)||0;return{borderTop:n,borderLeft:i,borderRight:r,borderBottom:s,paddingTop:o,paddingLeft:a,paddingRight:l,paddingBottom:u,horizontalSum:i+a+l+r,verticalSum:n+o+u+s}},e.sizeLimits=function(e){let t=window.getComputedStyle(e),n=parseFloat(t.minWidth)||0,i=parseFloat(t.minHeight)||0,r=parseFloat(t.maxWidth)||1/0,s=parseFloat(t.maxHeight)||1/0;return r=Math.max(n,r),s=Math.max(i,s),{minWidth:n,minHeight:i,maxWidth:r,maxHeight:s}},e.hitTest=function(e,t,n){let i=e.getBoundingClientRect();return t>=i.left&&t=i.top&&n=n.bottom||(i.topn.bottom&&i.height>=n.height?e.scrollTop-=n.top-i.top:(i.topn.height||i.bottom>n.bottom&&i.height{let e=Element.prototype;return e.matches||e.matchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector||function(e){let t=this,n=t.ownerDocument?t.ownerDocument.querySelectorAll(e):[];return-1!==Array.prototype.indexOf.call(n,t)}})(),e.calculateSingle=function(e){let u=0,d=0,c=0;function h(t){let n=e.match(t);return null!==n&&(e=e.slice(n[0].length),!0)}for(e=(e=e.split(",",1)[0]).replace(l," $1 ");e.length>0;)if(h(t))u++;else if(h(n))d++;else if(h(i))d++;else if(h(s))c++;else if(h(o))d++;else if(h(r))c++;else if(!h(a))return 0;return u=Math.min(u,255),d=Math.min(d,255),c=Math.min(c,255),u<<16|d<<8|c};const t=/^#[^\s\+>~#\.\[:]+/,n=/^\.[^\s\+>~#\.\[:]+/,i=/^\[[^\]]+\]/,r=/^[^\s\+>~#\.\[:]+/,s=/^(::[^\s\+>~#\.\[:]+|:first-line|:first-letter|:before|:after)/,o=/^:[^\s\+>~#\.\[:]+/,a=/^[\s\+>~\*]+/,l=/:not\(([^\)]+)\)/g}(h||(h={}));class m{constructor(){this._first=null,this._last=null,this._size=0}get isEmpty(){return 0===this._size}get size(){return this._size}get length(){return this._size}get first(){return this._first?this._first.value:void 0}get last(){return this._last?this._last.value:void 0}get firstNode(){return this._first}get lastNode(){return this._last}*[Symbol.iterator](){let e=this._first;for(;e;)yield e.value,e=e.next}*retro(){let e=this._last;for(;e;)yield e.value,e=e.prev}*nodes(){let e=this._first;for(;e;)yield e,e=e.next}*retroNodes(){let e=this._last;for(;e;)yield e,e=e.prev}assign(e){this.clear();for(const t of e)this.addLast(t)}push(e){this.addLast(e)}pop(){return this.removeLast()}shift(e){this.addFirst(e)}unshift(){return this.removeFirst()}addFirst(e){let t=new p.LinkedListNode(this,e);return this._first?(t.next=this._first,this._first.prev=t,this._first=t):(this._first=t,this._last=t),this._size++,t}addLast(e){let t=new p.LinkedListNode(this,e);return this._last?(t.prev=this._last,this._last.next=t,this._last=t):(this._first=t,this._last=t),this._size++,t}insertBefore(e,t){if(!t||t===this._first)return this.addFirst(e);if(!(t instanceof p.LinkedListNode)||t.list!==this)throw new Error("Reference node is not owned by the list.");let n=new p.LinkedListNode(this,e),i=t,r=i.prev;return n.next=i,n.prev=r,i.prev=n,r.next=n,this._size++,n}insertAfter(e,t){if(!t||t===this._last)return this.addLast(e);if(!(t instanceof p.LinkedListNode)||t.list!==this)throw new Error("Reference node is not owned by the list.");let n=new p.LinkedListNode(this,e),i=t,r=i.next;return n.next=r,n.prev=i,i.next=n,r.prev=n,this._size++,n}removeFirst(){let e=this._first;if(e)return e===this._last?(this._first=null,this._last=null):(this._first=e.next,this._first.prev=null),e.list=null,e.next=null,e.prev=null,this._size--,e.value}removeLast(){let e=this._last;if(e)return e===this._first?(this._first=null,this._last=null):(this._last=e.prev,this._last.next=null),e.list=null,e.next=null,e.prev=null,this._size--,e.value}removeNode(e){if(!(e instanceof p.LinkedListNode)||e.list!==this)throw new Error("Node is not owned by the list.");let t=e;t===this._first&&t===this._last?(this._first=null,this._last=null):t===this._first?(this._first=t.next,this._first.prev=null):t===this._last?(this._last=t.prev,this._last.next=null):(t.next.prev=t.prev,t.prev.next=t.next),t.list=null,t.next=null,t.prev=null,this._size--}clear(){let e=this._first;for(;e;){let t=e.next;e.list=null,e.prev=null,e.next=null,e=t}this._first=null,this._last=null,this._size=0}}!function(e){e.from=function(t){let n=new e;return n.assign(t),n}}(m||(m={})),function(e){e.LinkedListNode=class{constructor(e,t){this.list=null,this.next=null,this.prev=null,this.list=e,this.value=t}}}(p||(p={}));class v{constructor(e){this.type=e}get isConflatable(){return!1}conflate(e){return!1}}class b extends v{get isConflatable(){return!0}conflate(e){return!0}}!function(e){let t=null;const n=(r=Promise.resolve(),e=>{let t=!1;return r.then((()=>!t&&e())),()=>{t=!0}});var r;function s(e,t){let n=a.get(e);if(!n||0===n.length)return void c(e,t);let i=function(e,t){let n=0;for(const i of e)if(!1===t(i,n++))return!1;return!0}(function*(e){if("function"==typeof e.retro)yield*e.retro();else for(let t=e.length-1;t>-1;t--)yield e[t]}(n),(n=>!n||function(e,t,n){let i=!0;try{i="function"==typeof e?e(t,n):e.messageHook(t,n)}catch(e){u(e)}return i}(n,e,t)));i&&c(e,t)}e.sendMessage=s,e.postMessage=function(e,t){t.isConflatable&&function(n){for(const r of n)if((i=r).handler===e&&i.msg&&i.msg.type===t.type&&i.msg.isConflatable&&i.msg.conflate(t))return!0;var i;return!1}(o)||h(e,t)},e.installMessageHook=function(e,t){let n=a.get(e);n&&-1!==n.indexOf(t)||(n?n.push(t):a.set(e,[t]))},e.removeMessageHook=function(e,t){let n=a.get(e);if(!n)return;let i=n.indexOf(t);-1!==i&&(n[i]=null,f(n))},e.clearData=function(e){let t=a.get(e);t&&t.length>0&&(i.fill(t,null),f(t));for(const t of o)t.handler===e&&(t.handler=null,t.msg=null)},e.flush=function(){d||null===t||(t(),t=null,d=!0,p(),d=!1)},e.getExceptionHandler=function(){return u},e.setExceptionHandler=function(e){let t=u;return u=e,t};const o=new m,a=new WeakMap,l=new Set;let u=e=>{console.error(e)},d=!1;function c(e,t){try{e.processMessage(t)}catch(e){u(e)}}function h(e,i){o.addLast({handler:e,msg:i}),null===t&&(t=n(p))}function p(){if(t=null,o.isEmpty)return;let e={handler:null,msg:null};for(o.addLast(e);;){let t=o.removeFirst();if(t===e)return;t.handler&&t.msg&&s(t.handler,t.msg)}}function f(e){0===l.size&&n(g),l.add(e)}function g(){l.forEach(v),l.clear()}function v(e){i.removeAllWhere(e,b)}function b(e){return null===e}}(f||(f={}));var A,y,w,_,E,C=n(6573),x=n(8571),D=n(1412);!function(e){function t(e,t,n=0,i=-1){let r,s=e.length;if(0===s)return-1;n=n<0?Math.max(0,n+s):Math.min(n,s-1),r=(i=i<0?Math.max(0,i+s):Math.min(i,s-1))=n)return;let i=e[t];for(let i=t+1;i0;){let i=a>>1,r=o+i;n(e[r],t)<0?(o=r+1,a-=i+1):a=i}return o},e.upperBound=function(e,t,n,i=0,r=-1){let s=e.length;if(0===s)return 0;let o=i=i<0?Math.max(0,i+s):Math.min(i,s-1),a=(r=r<0?Math.max(0,r+s):Math.min(r,s-1))-i+1;for(;a>0;){let i=a>>1,r=o+i;n(e[r],t)>0?a=i:(o=r+1,a-=i+1)}return o},e.shallowEqual=function(e,t,n){if(e===t)return!0;if(e.length!==t.length)return!1;for(let i=0,r=e.length;i=o&&(n=r<0?o-1:o),void 0===i?i=r<0?-1:o:i<0?i=Math.max(i+o,r<0?-1:0):i>=o&&(i=r<0?o-1:o),s=r<0&&i>=n||r>0&&n>=i?0:r<0?Math.floor((i-n+1)/r+1):Math.floor((i-n-1)/r+1);let a=[];for(let t=0;t=(i=i<0?Math.max(0,i+r):Math.min(i,r-1)))return;let o=i-n+1;if(t>0?t%=o:t<0&&(t=(t%o+o)%o),0===t)return;let a=n+t;s(e,n,a-1),s(e,a,i),s(e,n,i)},e.fill=function(e,t,n=0,i=-1){let r,s=e.length;if(0!==s){n=n<0?Math.max(0,n+s):Math.min(n,s-1),r=(i=i<0?Math.max(0,i+s):Math.min(i,s-1))t;--n)e[n]=e[n-1];e[t]=n},e.removeAt=o,e.removeFirstOf=function(e,n,i=0,r=-1){let s=t(e,n,i,r);return-1!==s&&o(e,s),s},e.removeLastOf=function(e,t,i=-1,r=0){let s=n(e,t,i,r);return-1!==s&&o(e,s),s},e.removeAllOf=function(e,t,n=0,i=-1){let r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);let s=0;for(let o=0;o=n&&o<=i&&e[o]===t||i=n)&&e[o]===t?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s},e.removeFirstWhere=function(e,t,n=0,r=-1){let s,a=i(e,t,n,r);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeLastWhere=function(e,t,n=-1,i=0){let s,a=r(e,t,n,i);return-1!==a&&(s=o(e,a)),{index:a,value:s}},e.removeAllWhere=function(e,t,n=0,i=-1){let r=e.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);let s=0;for(let o=0;o=n&&o<=i&&t(e[o],o)||i=n)&&t(e[o],o)?s++:s>0&&(e[o-s]=e[o]);return s>0&&(e.length=r-s),s}}(A||(A={})),function(e){e.rangeLength=function(e,t,n){return 0===n?1/0:e>t&&n>0||et?1:0}}(w||(w={}));class S{constructor(e){this.type="text",this.content=e}}class T{constructor(e,t,n,i){this.type="element",this.tag=e,this.attrs=t,this.children=n,this.renderer=i}}function B(e){let t,n={},i=[];for(let e=1,s=arguments.length;e=i;--s){const i=t[s],o=r?e.lastChild:e.childNodes[s];"text"===i.type||(i.renderer&&i.renderer.unrender?i.renderer.unrender(o,{attrs:i.attrs,children:i.children}):n(o,i.children,0,!1)),r&&e.removeChild(o)}}e.hostMap=new WeakMap,e.asContentArray=function(e){return e?e instanceof Array?e:[e]:[]},e.createDOMNode=t,e.updateContent=function e(i,s,o){if(s===o)return;let a=function(e,t){let n=e.firstChild,i=Object.create(null);for(let e of t)"element"===e.type&&e.attrs.key&&(i[e.attrs.key]={vNode:e,element:n}),n=n.nextSibling;return i}(i,s),l=s.slice(),u=i.firstChild,d=o.length;for(let n=0;n=l.length){t(o[n],i);continue}let s=l[n],d=o[n];if(s===d){u=u.nextSibling;continue}if("text"===s.type&&"text"===d.type){u.textContent!==d.content&&(u.textContent=d.content),u=u.nextSibling;continue}if("text"===s.type||"text"===d.type){A.insert(l,n,d),t(d,i,u);continue}if(!s.renderer!=!d.renderer){A.insert(l,n,d),t(d,i,u);continue}let c=d.attrs.key;if(c&&c in a){let e=a[c];e.vNode!==s&&(A.move(l,l.indexOf(e.vNode,n+1),n),i.insertBefore(e.element,u),s=e.vNode,u=e.element)}if(s===d){u=u.nextSibling;continue}let h=s.attrs.key;h&&h!==c?(A.insert(l,n,d),t(d,i,u)):s.tag===d.tag?(r(u,s.attrs,d.attrs),d.renderer?d.renderer.render(u,{attrs:d.attrs,children:d.children}):e(u,s.children,d.children),u=u.nextSibling):(A.insert(l,n,d),t(d,i,u))}n(i,l,d,!0)};const i={key:!0,className:!0,htmlFor:!0,dataset:!0,style:!0};function r(e,t,n){if(t===n)return;let r;for(r in t)r in i||r in n||("on"===r.substr(0,2)?e[r]=null:e.removeAttribute(r));for(r in n)r in i||t[r]===n[r]||("on"===r.substr(0,2)?e[r]=n[r]:e.setAttribute(r,n[r]));t.className!==n.className&&(void 0!==n.className?e.setAttribute("class",n.className):e.removeAttribute("class")),t.htmlFor!==n.htmlFor&&(void 0!==n.htmlFor?e.setAttribute("for",n.htmlFor):e.removeAttribute("for")),t.dataset!==n.dataset&&function(e,t,n){for(let i in t)i in n||e.removeAttribute(`data-${i}`);for(let i in n)t[i]!==n[i]&&e.setAttribute(`data-${i}`,n[i])}(e,t.dataset||{},n.dataset||{}),t.style!==n.style&&function(e,t,n){let i,r=e.style;for(i in t)i in n||(r[i]="");for(i in n)t[i]!==n[i]&&(r[i]=n[i])}(e,t.style||{},n.style||{})}}(E||(E={})),n(7556);class M{constructor(e,t,n=[]){this.name=e,this._codes=t,this._keys=M.extractKeys(t),this._modifierKeys=M.convertToKeySet(n)}keys(){return Object.keys(this._keys)}isValidKey(e){return e in this._keys}isModifierKey(e){return e in this._modifierKeys}keyForKeydownEvent(e){return this._codes[e.keyCode]||""}}!function(e){e.extractKeys=function(e){let t=Object.create(null);for(let n in e)t[e[n]]=!0;return t},e.convertToKeySet=function(e){let t=Object(null);for(let n=0,i=e.length;n0&&(o+=n.stretch,a++)}if(t===s)return 0;if(t<=i){for(let t=0;t=r){for(let t=0;t0&&i>l;){let t=i,r=o;for(let s=0;s0&&i>l;){let t=i/u;for(let r=0;r0&&i>l;){let t=i,r=o;for(let s=0;s=n.maxSize?(i-=n.maxSize-n.size,o-=n.stretch,n.size=n.maxSize,n.done=!0,u--,a--):(i-=l,n.size+=l)}}for(;u>0&&i>l;){let t=i/u;for(let r=0;r=n.maxSize?(i-=n.maxSize-n.size,n.size=n.maxSize,n.done=!0,u--):(i-=t,n.size+=t))}}}return 0},e.adjust=function(e,t,n){0!==e.length&&0!==n&&(n>0?function(e,t,n){let i=0;for(let n=0;n<=t;++n){let t=e[n];i+=t.maxSize-t.size}let r=0;for(let n=t+1,i=e.length;n=0&&s>0;--n){let t=e[n],i=t.maxSize-t.size;i>=s?(t.sizeHint=t.size+s,s=0):(t.sizeHint=t.size+i,s-=i)}let o=n;for(let n=t+1,i=e.length;n0;++n){let t=e[n],i=t.size-t.minSize;i>=o?(t.sizeHint=t.size-o,o=0):(t.sizeHint=t.size-i,o-=i)}}(e,t,n):function(e,t,n){let i=0;for(let n=t+1,r=e.length;n0;++n){let t=e[n],i=t.maxSize-t.size;i>=s?(t.sizeHint=t.size+s,s=0):(t.sizeHint=t.size+i,s-=i)}let o=n;for(let n=t;n>=0&&o>0;--n){let t=e[n],i=t.size-t.minSize;i>=o?(t.sizeHint=t.size-o,o=0):(t.sizeHint=t.size-i,o-=i)}}(e,t,-n))}}(I||(I={}));class F{constructor(e){this._label="",this._caption="",this._mnemonic=-1,this._icon=void 0,this._iconClass="",this._iconLabel="",this._className="",this._closable=!1,this._changed=new x.Signal(this),this._isDisposed=!1,this.owner=e.owner,void 0!==e.label&&(this._label=e.label),void 0!==e.mnemonic&&(this._mnemonic=e.mnemonic),void 0!==e.icon&&(this._icon=e.icon),void 0!==e.iconClass&&(this._iconClass=e.iconClass),void 0!==e.iconLabel&&(this._iconLabel=e.iconLabel),void 0!==e.caption&&(this._caption=e.caption),void 0!==e.className&&(this._className=e.className),void 0!==e.closable&&(this._closable=e.closable),this._dataset=e.dataset||{}}get changed(){return this._changed}get label(){return this._label}set label(e){this._label!==e&&(this._label=e,this._changed.emit(void 0))}get mnemonic(){return this._mnemonic}set mnemonic(e){this._mnemonic!==e&&(this._mnemonic=e,this._changed.emit(void 0))}get icon(){return this._icon}set icon(e){this._icon!==e&&(this._icon=e,this._changed.emit(void 0))}get iconClass(){return this._iconClass}set iconClass(e){this._iconClass!==e&&(this._iconClass=e,this._changed.emit(void 0))}get iconLabel(){return this._iconLabel}set iconLabel(e){this._iconLabel!==e&&(this._iconLabel=e,this._changed.emit(void 0))}get caption(){return this._caption}set caption(e){this._caption!==e&&(this._caption=e,this._changed.emit(void 0))}get className(){return this._className}set className(e){this._className!==e&&(this._className=e,this._changed.emit(void 0))}get closable(){return this._closable}set closable(e){this._closable!==e&&(this._closable=e,this._changed.emit(void 0))}get dataset(){return this._dataset}set dataset(e){this._dataset!==e&&(this._dataset=e,this._changed.emit(void 0))}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,x.Signal.clearData(this))}}class z{constructor(e={}){this._flags=0,this._layout=null,this._parent=null,this._disposed=new x.Signal(this),this._hiddenMode=z.HiddenMode.Display,this.node=P.createNode(e),this.addClass("lm-Widget")}dispose(){this.isDisposed||(this.setFlag(z.Flag.IsDisposed),this._disposed.emit(void 0),this.parent?this.parent=null:this.isAttached&&z.detach(this),this._layout&&(this._layout.dispose(),this._layout=null),this.title.dispose(),x.Signal.clearData(this),f.clearData(this),C.AttachedProperty.clearData(this))}get disposed(){return this._disposed}get isDisposed(){return this.testFlag(z.Flag.IsDisposed)}get isAttached(){return this.testFlag(z.Flag.IsAttached)}get isHidden(){return this.testFlag(z.Flag.IsHidden)}get isVisible(){return this.testFlag(z.Flag.IsVisible)}get title(){return P.titleProperty.get(this)}get id(){return this.node.id}set id(e){this.node.id=e}get dataset(){return this.node.dataset}get hiddenMode(){return this._hiddenMode}set hiddenMode(e){this._hiddenMode!==e&&(this.isHidden&&this._toggleHidden(!1),e==z.HiddenMode.Scale?this.node.style.willChange="transform":this.node.style.willChange="auto",this._hiddenMode=e,this.isHidden&&this._toggleHidden(!0))}get parent(){return this._parent}set parent(e){if(this._parent!==e){if(e&&this.contains(e))throw new Error("Invalid parent widget.");if(this._parent&&!this._parent.isDisposed){let e=new z.ChildMessage("child-removed",this);f.sendMessage(this._parent,e)}if(this._parent=e,this._parent&&!this._parent.isDisposed){let e=new z.ChildMessage("child-added",this);f.sendMessage(this._parent,e)}this.isDisposed||f.sendMessage(this,z.Msg.ParentChanged)}}get layout(){return this._layout}set layout(e){if(this._layout!==e){if(this.testFlag(z.Flag.DisallowLayout))throw new Error("Cannot set widget layout.");if(this._layout)throw new Error("Cannot change widget layout.");if(e.parent)throw new Error("Cannot change layout parent.");this._layout=e,e.parent=this}}*children(){this._layout&&(yield*this._layout)}contains(e){for(let t=e;t;t=t._parent)if(t===this)return!0;return!1}hasClass(e){return this.node.classList.contains(e)}addClass(e){this.node.classList.add(e)}removeClass(e){this.node.classList.remove(e)}toggleClass(e,t){return!0===t?(this.node.classList.add(e),!0):!1===t?(this.node.classList.remove(e),!1):this.node.classList.toggle(e)}update(){f.postMessage(this,z.Msg.UpdateRequest)}fit(){f.postMessage(this,z.Msg.FitRequest)}activate(){f.postMessage(this,z.Msg.ActivateRequest)}close(){f.sendMessage(this,z.Msg.CloseRequest)}show(){if(this.testFlag(z.Flag.IsHidden)&&(!this.isAttached||this.parent&&!this.parent.isVisible||f.sendMessage(this,z.Msg.BeforeShow),this.clearFlag(z.Flag.IsHidden),this._toggleHidden(!1),!this.isAttached||this.parent&&!this.parent.isVisible||f.sendMessage(this,z.Msg.AfterShow),this.parent)){let e=new z.ChildMessage("child-shown",this);f.sendMessage(this.parent,e)}}hide(){if(!this.testFlag(z.Flag.IsHidden)&&(!this.isAttached||this.parent&&!this.parent.isVisible||f.sendMessage(this,z.Msg.BeforeHide),this.setFlag(z.Flag.IsHidden),this._toggleHidden(!0),!this.isAttached||this.parent&&!this.parent.isVisible||f.sendMessage(this,z.Msg.AfterHide),this.parent)){let e=new z.ChildMessage("child-hidden",this);f.sendMessage(this.parent,e)}}setHidden(e){e?this.hide():this.show()}testFlag(e){return!!(this._flags&e)}setFlag(e){this._flags|=e}clearFlag(e){this._flags&=~e}processMessage(e){switch(e.type){case"resize":this.notifyLayout(e),this.onResize(e);break;case"update-request":this.notifyLayout(e),this.onUpdateRequest(e);break;case"fit-request":this.notifyLayout(e),this.onFitRequest(e);break;case"before-show":this.notifyLayout(e),this.onBeforeShow(e);break;case"after-show":this.setFlag(z.Flag.IsVisible),this.notifyLayout(e),this.onAfterShow(e);break;case"before-hide":this.notifyLayout(e),this.onBeforeHide(e);break;case"after-hide":this.clearFlag(z.Flag.IsVisible),this.notifyLayout(e),this.onAfterHide(e);break;case"before-attach":this.notifyLayout(e),this.onBeforeAttach(e);break;case"after-attach":this.isHidden||this.parent&&!this.parent.isVisible||this.setFlag(z.Flag.IsVisible),this.setFlag(z.Flag.IsAttached),this.notifyLayout(e),this.onAfterAttach(e);break;case"before-detach":this.notifyLayout(e),this.onBeforeDetach(e);break;case"after-detach":this.clearFlag(z.Flag.IsVisible),this.clearFlag(z.Flag.IsAttached),this.notifyLayout(e),this.onAfterDetach(e);break;case"activate-request":this.notifyLayout(e),this.onActivateRequest(e);break;case"close-request":this.notifyLayout(e),this.onCloseRequest(e);break;case"child-added":this.notifyLayout(e),this.onChildAdded(e);break;case"child-removed":this.notifyLayout(e),this.onChildRemoved(e);break;default:this.notifyLayout(e)}}notifyLayout(e){this._layout&&this._layout.processParentMessage(e)}onCloseRequest(e){this.parent?this.parent=null:this.isAttached&&z.detach(this)}onResize(e){}onUpdateRequest(e){}onFitRequest(e){}onActivateRequest(e){}onBeforeShow(e){}onAfterShow(e){}onBeforeHide(e){}onAfterHide(e){}onBeforeAttach(e){}onAfterAttach(e){}onBeforeDetach(e){}onAfterDetach(e){}onChildAdded(e){}onChildRemoved(e){}_toggleHidden(e){if(e)switch(this._hiddenMode){case z.HiddenMode.Display:this.addClass("lm-mod-hidden");break;case z.HiddenMode.Scale:this.node.style.transform="scale(0)",this.node.setAttribute("aria-hidden","true");break;case z.HiddenMode.ContentVisibility:this.node.style.contentVisibility="hidden",this.node.style.zIndex="-1"}else switch(this._hiddenMode){case z.HiddenMode.Display:this.removeClass("lm-mod-hidden");break;case z.HiddenMode.Scale:this.node.style.transform="",this.node.removeAttribute("aria-hidden");break;case z.HiddenMode.ContentVisibility:this.node.style.contentVisibility="",this.node.style.zIndex=""}}}!function(e){var t,n,i;(t=e.HiddenMode||(e.HiddenMode={}))[t.Display=0]="Display",t[t.Scale=1]="Scale",t[t.ContentVisibility=2]="ContentVisibility",(n=e.Flag||(e.Flag={}))[n.IsDisposed=1]="IsDisposed",n[n.IsAttached=2]="IsAttached",n[n.IsHidden=4]="IsHidden",n[n.IsVisible=8]="IsVisible",n[n.DisallowLayout=16]="DisallowLayout",(i=e.Msg||(e.Msg={})).BeforeShow=new v("before-show"),i.AfterShow=new v("after-show"),i.BeforeHide=new v("before-hide"),i.AfterHide=new v("after-hide"),i.BeforeAttach=new v("before-attach"),i.AfterAttach=new v("after-attach"),i.BeforeDetach=new v("before-detach"),i.AfterDetach=new v("after-detach"),i.ParentChanged=new v("parent-changed"),i.UpdateRequest=new b("update-request"),i.FitRequest=new b("fit-request"),i.ActivateRequest=new b("activate-request"),i.CloseRequest=new b("close-request"),e.ChildMessage=class extends v{constructor(e,t){super(e),this.child=t}};class r extends v{constructor(e,t){super("resize"),this.width=e,this.height=t}}e.ResizeMessage=r,function(e){e.UnknownSize=new e(-1,-1)}(r=e.ResizeMessage||(e.ResizeMessage={})),e.attach=function(t,n,i=null){if(t.parent)throw new Error("Cannot attach a child widget.");if(t.isAttached||t.node.isConnected)throw new Error("Widget is already attached.");if(!n.isConnected)throw new Error("Host is not attached.");f.sendMessage(t,e.Msg.BeforeAttach),n.insertBefore(t.node,i),f.sendMessage(t,e.Msg.AfterAttach)},e.detach=function(t){if(t.parent)throw new Error("Cannot detach a child widget.");if(!t.isAttached||!t.node.isConnected)throw new Error("Widget is not attached.");f.sendMessage(t,e.Msg.BeforeDetach),t.node.parentNode.removeChild(t.node),f.sendMessage(t,e.Msg.AfterDetach)}}(z||(z={})),function(e){e.titleProperty=new C.AttachedProperty({name:"title",create:e=>new F({owner:e})}),e.createNode=function(e){return e.node||document.createElement(e.tag||"div")}}(P||(P={}));class U{constructor(e={}){this._disposed=!1,this._parent=null,this._fitPolicy=e.fitPolicy||"set-min-size"}dispose(){this._parent=null,this._disposed=!0,x.Signal.clearData(this),C.AttachedProperty.clearData(this)}get isDisposed(){return this._disposed}get parent(){return this._parent}set parent(e){if(this._parent!==e){if(this._parent)throw new Error("Cannot change parent widget.");if(e.layout!==this)throw new Error("Invalid parent widget.");this._parent=e,this.init()}}get fitPolicy(){return this._fitPolicy}set fitPolicy(e){if(this._fitPolicy!==e&&(this._fitPolicy=e,this._parent)){let e=this._parent.node.style;e.minWidth="",e.minHeight="",e.maxWidth="",e.maxHeight="",this._parent.fit()}}processParentMessage(e){switch(e.type){case"resize":this.onResize(e);break;case"update-request":this.onUpdateRequest(e);break;case"fit-request":this.onFitRequest(e);break;case"before-show":this.onBeforeShow(e);break;case"after-show":this.onAfterShow(e);break;case"before-hide":this.onBeforeHide(e);break;case"after-hide":this.onAfterHide(e);break;case"before-attach":this.onBeforeAttach(e);break;case"after-attach":this.onAfterAttach(e);break;case"before-detach":this.onBeforeDetach(e);break;case"after-detach":this.onAfterDetach(e);break;case"child-removed":this.onChildRemoved(e);break;case"child-shown":this.onChildShown(e);break;case"child-hidden":this.onChildHidden(e)}}init(){for(const e of this)e.parent=this.parent}onResize(e){for(const e of this)f.sendMessage(e,z.ResizeMessage.UnknownSize)}onUpdateRequest(e){for(const e of this)f.sendMessage(e,z.ResizeMessage.UnknownSize)}onBeforeAttach(e){for(const t of this)f.sendMessage(t,e)}onAfterAttach(e){for(const t of this)f.sendMessage(t,e)}onBeforeDetach(e){for(const t of this)f.sendMessage(t,e)}onAfterDetach(e){for(const t of this)f.sendMessage(t,e)}onBeforeShow(e){for(const t of this)t.isHidden||f.sendMessage(t,e)}onAfterShow(e){for(const t of this)t.isHidden||f.sendMessage(t,e)}onBeforeHide(e){for(const t of this)t.isHidden||f.sendMessage(t,e)}onAfterHide(e){for(const t of this)t.isHidden||f.sendMessage(t,e)}onChildRemoved(e){this.removeWidget(e.child)}onFitRequest(e){}onChildShown(e){}onChildHidden(e){}}!function(e){e.getHorizontalAlignment=function(e){return R.horizontalAlignmentProperty.get(e)},e.setHorizontalAlignment=function(e,t){R.horizontalAlignmentProperty.set(e,t)},e.getVerticalAlignment=function(e){return R.verticalAlignmentProperty.get(e)},e.setVerticalAlignment=function(e,t){R.verticalAlignmentProperty.set(e,t)}}(U||(U={}));class H{constructor(e){this._top=NaN,this._left=NaN,this._width=NaN,this._height=NaN,this._minWidth=0,this._minHeight=0,this._maxWidth=1/0,this._maxHeight=1/0,this._disposed=!1,this.widget=e,this.widget.node.style.position="absolute",this.widget.node.style.contain="strict"}dispose(){if(this._disposed)return;this._disposed=!0;let e=this.widget.node.style;e.position="",e.top="",e.left="",e.width="",e.height="",e.contain=""}get minWidth(){return this._minWidth}get minHeight(){return this._minHeight}get maxWidth(){return this._maxWidth}get maxHeight(){return this._maxHeight}get isDisposed(){return this._disposed}get isHidden(){return this.widget.isHidden}get isVisible(){return this.widget.isVisible}get isAttached(){return this.widget.isAttached}fit(){let e=u.sizeLimits(this.widget.node);this._minWidth=e.minWidth,this._minHeight=e.minHeight,this._maxWidth=e.maxWidth,this._maxHeight=e.maxHeight}update(e,t,n,i){let r=Math.max(this._minWidth,Math.min(n,this._maxWidth)),s=Math.max(this._minHeight,Math.min(i,this._maxHeight));if(r"center",changed:t}),e.verticalAlignmentProperty=new C.AttachedProperty({name:"verticalAlignment",create:()=>"top",changed:t})}(R||(R={}));class W extends U{constructor(){super(...arguments),this._widgets=[]}dispose(){for(;this._widgets.length>0;)this._widgets.pop().dispose();super.dispose()}get widgets(){return this._widgets}*[Symbol.iterator](){yield*this._widgets}addWidget(e){this.insertWidget(this._widgets.length,e)}insertWidget(e,t){t.parent=this.parent;let n=this._widgets.indexOf(t),r=Math.max(0,Math.min(e,this._widgets.length));if(-1===n)return i.insert(this._widgets,r,t),void(this.parent&&this.attachWidget(r,t));r===this._widgets.length&&r--,n!==r&&(i.move(this._widgets,n,r),this.parent&&this.moveWidget(n,r,t))}removeWidget(e){this.removeWidgetAt(this._widgets.indexOf(e))}removeWidgetAt(e){let t=i.removeAt(this._widgets,e);t&&this.parent&&this.detachWidget(e,t)}init(){super.init();let e=0;for(const t of this)this.attachWidget(e++,t)}attachWidget(e,t){let n=this.parent.node.children[e];this.parent.isAttached&&f.sendMessage(t,z.Msg.BeforeAttach),this.parent.node.insertBefore(t.node,n),this.parent.isAttached&&f.sendMessage(t,z.Msg.AfterAttach)}moveWidget(e,t,n){this.parent.isAttached&&f.sendMessage(n,z.Msg.BeforeDetach),this.parent.node.removeChild(n.node),this.parent.isAttached&&f.sendMessage(n,z.Msg.AfterDetach);let i=this.parent.node.children[t];this.parent.isAttached&&f.sendMessage(n,z.Msg.BeforeAttach),this.parent.node.insertBefore(n.node,i),this.parent.isAttached&&f.sendMessage(n,z.Msg.AfterAttach)}detachWidget(e,t){this.parent.isAttached&&f.sendMessage(t,z.Msg.BeforeDetach),this.parent.node.removeChild(t.node),this.parent.isAttached&&f.sendMessage(t,z.Msg.AfterDetach)}}!function(e){e.clampDimension=function(e){return Math.max(0,Math.floor(e))}}(L||(L={}));var q,$,V,G,K,Y,J,X,Z,Q,ee=L;class te extends W{constructor(e){super(),this.widgetOffset=0,this._fixed=0,this._spacing=4,this._dirty=!1,this._hasNormedSizes=!1,this._sizers=[],this._items=[],this._handles=[],this._box=null,this._alignment="start",this._orientation="horizontal",this.renderer=e.renderer,void 0!==e.orientation&&(this._orientation=e.orientation),void 0!==e.alignment&&(this._alignment=e.alignment),void 0!==e.spacing&&(this._spacing=L.clampDimension(e.spacing))}dispose(){for(const e of this._items)e.dispose();this._box=null,this._items.length=0,this._sizers.length=0,this._handles.length=0,super.dispose()}get orientation(){return this._orientation}set orientation(e){this._orientation!==e&&(this._orientation=e,this.parent&&(this.parent.dataset.orientation=e,this.parent.fit()))}get alignment(){return this._alignment}set alignment(e){this._alignment!==e&&(this._alignment=e,this.parent&&(this.parent.dataset.alignment=e,this.parent.update()))}get spacing(){return this._spacing}set spacing(e){e=L.clampDimension(e),this._spacing!==e&&(this._spacing=e,this.parent&&this.parent.fit())}get handles(){return this._handles}absoluteSizes(){return this._sizers.map((e=>e.size))}relativeSizes(){return q.normalize(this._sizers.map((e=>e.size)))}setRelativeSizes(e,t=!0){let n=this._sizers.length,i=e.slice(0,n);for(;i.length0&&(e.sizeHint=e.size);I.adjust(this._sizers,e,n),this.parent&&this.parent.update()}}init(){this.parent.dataset.orientation=this.orientation,this.parent.dataset.alignment=this.alignment,super.init()}attachWidget(e,t){let n=new H(t),r=q.createHandle(this.renderer),s=q.averageSize(this._sizers),o=q.createSizer(s);i.insert(this._items,e,n),i.insert(this._sizers,e,o),i.insert(this._handles,e,r),this.parent.isAttached&&f.sendMessage(t,z.Msg.BeforeAttach),this.parent.node.appendChild(t.node),this.parent.node.appendChild(r),this.parent.isAttached&&f.sendMessage(t,z.Msg.AfterAttach),this.parent.fit()}moveWidget(e,t,n){i.move(this._items,e,t),i.move(this._sizers,e,t),i.move(this._handles,e,t),this.parent.fit()}detachWidget(e,t){let n=i.removeAt(this._items,e),r=i.removeAt(this._handles,e);i.removeAt(this._sizers,e),this.parent.isAttached&&f.sendMessage(t,z.Msg.BeforeDetach),this.parent.node.removeChild(t.node),this.parent.node.removeChild(r),this.parent.isAttached&&f.sendMessage(t,z.Msg.AfterDetach),n.dispose(),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}updateItemPosition(e,t,n,i,r,s,o){const a=this._items[e];if(a.isHidden)return;let l=this._handles[e].style;t?(n+=this.widgetOffset,a.update(n,i,o,r),n+=o,l.top=`${i}px`,l.left=`${n}px`,l.width=`${this._spacing}px`,l.height=`${r}px`):(i+=this.widgetOffset,a.update(n,i,s,o),i+=o,l.top=`${i}px`,l.left=`${n}px`,l.width=`${s}px`,l.height=`${this._spacing}px`)}_fit(){let e=0,t=-1;for(let n=0,i=this._items.length;n0&&(s.sizeHint=s.size),t.isHidden?(s.minSize=0,s.maxSize=0):(t.fit(),s.stretch=te.getStretch(t.widget),n?(s.minSize=t.minWidth,s.maxSize=t.maxWidth,i+=t.minWidth,r=Math.max(r,t.minHeight)):(s.minSize=t.minHeight,s.maxSize=t.maxHeight,r+=t.minHeight,i=Math.max(i,t.minWidth)))}let s=this._box=u.boxSizing(this.parent.node);i+=s.horizontalSum,r+=s.verticalSum;let o=this.parent.node.style;o.minWidth=`${i}px`,o.minHeight=`${r}px`,this._dirty=!0,this.parent.parent&&f.sendMessage(this.parent.parent,z.Msg.FitRequest),this._dirty&&f.sendMessage(this.parent,z.Msg.UpdateRequest)}_update(e,t){this._dirty=!1;let n=0;for(let e=0,t=this._items.length;e0){let e;if(e=d?Math.max(0,s-this._fixed):Math.max(0,o-this._fixed),this._hasNormedSizes){for(let t of this._sizers)t.sizeHint*=e;this._hasNormedSizes=!1}let t=I.calc(this._sizers,e);if(t>0)switch(this._alignment){case"start":break;case"center":a=0,l=t/2;break;case"end":a=0,l=t;break;case"justify":a=t/n,l=0;break;default:throw"unreachable"}}for(let e=0,t=this._items.length;e0,coerce:(e,t)=>Math.max(0,Math.floor(t)),changed:function(e){e.parent&&e.parent.layout instanceof te&&e.parent.fit()}}),e.createSizer=function(e){let t=new N;return t.sizeHint=Math.floor(e),t},e.createHandle=function(e){let t=e.createHandle();return t.style.position="absolute",t.style.contain="style",t},e.averageSize=function(e){return e.reduce(((e,t)=>e+t.size),0)/e.length||0},e.normalize=function(e){let t=e.length;if(0===t)return[];let n=e.reduce(((e,t)=>e+Math.abs(t)),0);return 0===n?e.map((e=>1/t)):e.map((e=>e/n))}}(q||(q={}));class ne extends te{constructor(e){super({...e,orientation:e.orientation||"vertical"}),this._titles=[],this.titleSpace=e.titleSpace||22}get titleSpace(){return this.widgetOffset}set titleSpace(e){e=ee.clampDimension(e),this.widgetOffset!==e&&(this.widgetOffset=e,this.parent&&this.parent.fit())}get titles(){return this._titles}dispose(){this.isDisposed||(this._titles.length=0,super.dispose())}updateTitle(e,t){const n=this._titles[e],i=n.classList.contains("lm-mod-expanded"),r=$.createTitle(this.renderer,t.title,i);this._titles[e]=r,this.parent.node.replaceChild(r,n)}insertWidget(e,t){t.id||(t.id=`id-${g.UUID.uuid4()}`),super.insertWidget(e,t)}attachWidget(e,t){const n=$.createTitle(this.renderer,t.title);i.insert(this._titles,e,n),this.parent.node.appendChild(n),t.node.setAttribute("role","region"),t.node.setAttribute("aria-labelledby",n.id),super.attachWidget(e,t)}moveWidget(e,t,n){i.move(this._titles,e,t),super.moveWidget(e,t,n)}detachWidget(e,t){const n=i.removeAt(this._titles,e);this.parent.node.removeChild(n),super.detachWidget(e,t)}updateItemPosition(e,t,n,i,r,s,o){const a=this._titles[e].style;a.top=`${i}px`,a.left=`${n}px`,a.height=`${this.widgetOffset}px`,a.width=t?`${r}px`:`${s}px`,super.updateItemPosition(e,t,n,i,r,s,o)}}!function(e){e.createTitle=function(e,t,n=!0){const i=e.createSectionTitle(t);return i.style.position="absolute",i.style.contain="strict",i.setAttribute("aria-label",`${t.label} Section`),i.setAttribute("aria-expanded",n?"true":"false"),i.setAttribute("aria-controls",t.owner.id),n&&i.classList.add("lm-mod-expanded"),i}}($||($={}));class ie extends z{constructor(e={}){super(),this.addClass("lm-Panel"),this.layout=V.createLayout(e)}get widgets(){return this.layout.widgets}addWidget(e){this.layout.addWidget(e)}insertWidget(e,t){this.layout.insertWidget(e,t)}}!function(e){e.createLayout=function(e){return e.layout||new W}}(V||(V={}));class re extends ie{constructor(e={}){super({layout:G.createLayout(e)}),this._handleMoved=new x.Signal(this),this._pressData=null,this.addClass("lm-SplitPanel")}dispose(){this._releaseMouse(),super.dispose()}get orientation(){return this.layout.orientation}set orientation(e){this.layout.orientation=e}get alignment(){return this.layout.alignment}set alignment(e){this.layout.alignment=e}get spacing(){return this.layout.spacing}set spacing(e){this.layout.spacing=e}get renderer(){return this.layout.renderer}get handleMoved(){return this._handleMoved}get handles(){return this.layout.handles}relativeSizes(){return this.layout.relativeSizes()}setRelativeSizes(e,t=!0){this.layout.setRelativeSizes(e,t)}handleEvent(e){switch(e.type){case"pointerdown":this._evtPointerDown(e);break;case"pointermove":this._evtPointerMove(e);break;case"pointerup":this._evtPointerUp(e);break;case"keydown":this._evtKeyDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("pointerdown",this)}onAfterDetach(e){this.node.removeEventListener("pointerdown",this),this._releaseMouse()}onChildAdded(e){e.child.addClass("lm-SplitPanel-child"),this._releaseMouse()}onChildRemoved(e){e.child.removeClass("lm-SplitPanel-child"),this._releaseMouse()}_evtKeyDown(e){this._pressData&&(e.preventDefault(),e.stopPropagation()),27===e.keyCode&&this._releaseMouse()}_evtPointerDown(e){if(0!==e.button)return;let t,n=this.layout,r=i.findFirstIndex(n.handles,(t=>t.contains(e.target)));if(-1===r)return;e.preventDefault(),e.stopPropagation(),document.addEventListener("pointerup",this,!0),document.addEventListener("pointermove",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("contextmenu",this,!0);let s=n.handles[r],o=s.getBoundingClientRect();t="horizontal"===n.orientation?e.clientX-o.left:e.clientY-o.top;let a=window.getComputedStyle(s),l=D.Drag.overrideCursor(a.cursor);this._pressData={index:r,delta:t,override:l}}_evtPointerMove(e){let t;e.preventDefault(),e.stopPropagation();let n=this.layout,i=this.node.getBoundingClientRect();t="horizontal"===n.orientation?e.clientX-i.left-this._pressData.delta:e.clientY-i.top-this._pressData.delta,n.moveHandle(this._pressData.index,t)}_evtPointerUp(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),this._releaseMouse())}_releaseMouse(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,this._handleMoved.emit(),document.removeEventListener("keydown",this,!0),document.removeEventListener("pointerup",this,!0),document.removeEventListener("pointermove",this,!0),document.removeEventListener("contextmenu",this,!0))}}!function(e){class t{createHandle(){let e=document.createElement("div");return e.className="lm-SplitPanel-handle",e}}e.Renderer=t,e.defaultRenderer=new t,e.getStretch=function(e){return te.getStretch(e)},e.setStretch=function(e,t){te.setStretch(e,t)}}(re||(re={})),function(e){e.createLayout=function(e){return e.layout||new te({renderer:e.renderer||re.defaultRenderer,orientation:e.orientation,alignment:e.alignment,spacing:e.spacing})}}(G||(G={}));class se extends re{constructor(e={}){super({...e,layout:K.createLayout(e)}),this._widgetSizesCache=new WeakMap,this._expansionToggled=new x.Signal(this),this.addClass("lm-AccordionPanel")}get renderer(){return this.layout.renderer}get titleSpace(){return this.layout.titleSpace}set titleSpace(e){this.layout.titleSpace=e}get titles(){return this.layout.titles}get expansionToggled(){return this._expansionToggled}addWidget(e){super.addWidget(e),e.title.changed.connect(this._onTitleChanged,this)}collapse(e){const t=this.layout.widgets[e];t&&!t.isHidden&&this._toggleExpansion(e)}expand(e){const t=this.layout.widgets[e];t&&t.isHidden&&this._toggleExpansion(e)}insertWidget(e,t){super.insertWidget(e,t),t.title.changed.connect(this._onTitleChanged,this)}handleEvent(e){switch(super.handleEvent(e),e.type){case"click":this._evtClick(e);break;case"keydown":this._eventKeyDown(e)}}onBeforeAttach(e){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),super.onBeforeAttach(e)}onAfterDetach(e){super.onAfterDetach(e),this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this)}_onTitleChanged(e){const t=i.findFirstIndex(this.widgets,(t=>t.contains(e.owner)));t>=0&&(this.layout.updateTitle(t,e.owner),this.update())}_computeWidgetSize(e){const t=this.layout,n=t.widgets[e];if(!n)return;const i=n.isHidden,r=t.absoluteSizes(),s=(i?-1:1)*this.spacing,o=r.reduce(((e,t)=>e+t));let a=[...r];if(i){const t=this._widgetSizesCache.get(n);if(!t)return;a[e]+=t;const i=a.map((e=>e-t>0)).lastIndexOf(!0);-1===i?a.forEach(((n,i)=>{i!==e&&(a[i]-=r[i]/o*(t-s))})):a[i]-=t-s}else{const t=r[e];this._widgetSizesCache.set(n,t),a[e]=0;const i=a.map((e=>e>0)).lastIndexOf(!0);if(-1===i)return;a[i]=r[i]+t+s}return a.map((e=>e/(o+s)))}_evtClick(e){const t=e.target;if(t){const n=i.findFirstIndex(this.titles,(e=>e.contains(t)));n>=0&&(e.preventDefault(),e.stopPropagation(),this._toggleExpansion(n))}}_eventKeyDown(e){if(e.defaultPrevented)return;const t=e.target;let n=!1;if(t){const r=i.findFirstIndex(this.titles,(e=>e.contains(t)));if(r>=0){const i=e.keyCode.toString();if(e.key.match(/Space|Enter/)||i.match(/13|32/))t.click(),n=!0;else if("horizontal"===this.orientation?e.key.match(/ArrowLeft|ArrowRight/)||i.match(/37|39/):e.key.match(/ArrowUp|ArrowDown/)||i.match(/38|40/)){const t=e.key.match(/ArrowLeft|ArrowUp/)||i.match(/37|38/)?-1:1,s=this.titles.length,o=(r+s+t)%s;this.titles[o].focus(),n=!0}else"End"===e.key||"35"===i?(this.titles[this.titles.length-1].focus(),n=!0):"Home"!==e.key&&"36"!==i||(this.titles[0].focus(),n=!0)}n&&e.preventDefault()}}_toggleExpansion(e){const t=this.titles[e],n=this.layout.widgets[e],i=this._computeWidgetSize(e);i&&this.setRelativeSizes(i,!1),n.isHidden?(t.classList.add("lm-mod-expanded"),t.setAttribute("aria-expanded","true"),n.show()):(t.classList.remove("lm-mod-expanded"),t.setAttribute("aria-expanded","false"),n.hide()),this._expansionToggled.emit(e)}}!function(e){class t extends re.Renderer{constructor(){super(),this.titleClassName="lm-AccordionPanel-title",this._titleID=0,this._titleKeys=new WeakMap,this._uuid=++t._nInstance}createCollapseIcon(e){return document.createElement("span")}createSectionTitle(e){const t=document.createElement("h3");t.setAttribute("tabindex","0"),t.id=this.createTitleKey(e),t.className=this.titleClassName;for(const n in e.dataset)t.dataset[n]=e.dataset[n];t.appendChild(this.createCollapseIcon(e)).className="lm-AccordionPanel-titleCollapser";const n=t.appendChild(document.createElement("span"));return n.className="lm-AccordionPanel-titleLabel",n.textContent=e.label,n.title=e.caption||e.label,t}createTitleKey(e){let t=this._titleKeys.get(e);return void 0===t&&(t=`title-key-${this._uuid}-${this._titleID++}`,this._titleKeys.set(e,t)),t}}t._nInstance=0,e.Renderer=t,e.defaultRenderer=new t}(se||(se={})),function(e){e.createLayout=function(e){return e.layout||new ne({renderer:e.renderer||se.defaultRenderer,orientation:e.orientation,alignment:e.alignment,spacing:e.spacing,titleSpace:e.titleSpace})}}(K||(K={}));class oe extends W{constructor(e={}){super(),this._fixed=0,this._spacing=4,this._dirty=!1,this._sizers=[],this._items=[],this._box=null,this._alignment="start",this._direction="top-to-bottom",void 0!==e.direction&&(this._direction=e.direction),void 0!==e.alignment&&(this._alignment=e.alignment),void 0!==e.spacing&&(this._spacing=ee.clampDimension(e.spacing))}dispose(){for(const e of this._items)e.dispose();this._box=null,this._items.length=0,this._sizers.length=0,super.dispose()}get direction(){return this._direction}set direction(e){this._direction!==e&&(this._direction=e,this.parent&&(this.parent.dataset.direction=e,this.parent.fit()))}get alignment(){return this._alignment}set alignment(e){this._alignment!==e&&(this._alignment=e,this.parent&&(this.parent.dataset.alignment=e,this.parent.update()))}get spacing(){return this._spacing}set spacing(e){e=ee.clampDimension(e),this._spacing!==e&&(this._spacing=e,this.parent&&this.parent.fit())}init(){this.parent.dataset.direction=this.direction,this.parent.dataset.alignment=this.alignment,super.init()}attachWidget(e,t){i.insert(this._items,e,new H(t)),i.insert(this._sizers,e,new N),this.parent.isAttached&&f.sendMessage(t,z.Msg.BeforeAttach),this.parent.node.appendChild(t.node),this.parent.isAttached&&f.sendMessage(t,z.Msg.AfterAttach),this.parent.fit()}moveWidget(e,t,n){i.move(this._items,e,t),i.move(this._sizers,e,t),this.parent.update()}detachWidget(e,t){let n=i.removeAt(this._items,e);i.removeAt(this._sizers,e),this.parent.isAttached&&f.sendMessage(t,z.Msg.BeforeDetach),this.parent.node.removeChild(t.node),this.parent.isAttached&&f.sendMessage(t,z.Msg.AfterDetach),n.dispose(),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_fit(){let e=0;for(let t=0,n=this._items.length;t0)switch(this._alignment){case"start":break;case"center":l=0,d=i/2;break;case"end":l=0,d=i;break;case"justify":l=i/n,d=0;break;default:throw"unreachable"}for(let e=0,t=this._items.length;e0,coerce:(e,t)=>Math.max(0,Math.floor(t)),changed:t}),e.sizeBasisProperty=new C.AttachedProperty({name:"sizeBasis",create:()=>0,coerce:(e,t)=>Math.max(0,Math.floor(t)),changed:t}),e.isHorizontal=function(e){return"left-to-right"===e||"right-to-left"===e},e.clampSpacing=function(e){return Math.max(0,Math.floor(e))}}(Y||(Y={}));class ae extends ie{constructor(e={}){super({layout:J.createLayout(e)}),this.addClass("lm-BoxPanel")}get direction(){return this.layout.direction}set direction(e){this.layout.direction=e}get alignment(){return this.layout.alignment}set alignment(e){this.layout.alignment=e}get spacing(){return this.layout.spacing}set spacing(e){this.layout.spacing=e}onChildAdded(e){e.child.addClass("lm-BoxPanel-child")}onChildRemoved(e){e.child.removeClass("lm-BoxPanel-child")}}!function(e){e.getStretch=function(e){return oe.getStretch(e)},e.setStretch=function(e,t){oe.setStretch(e,t)},e.getSizeBasis=function(e){return oe.getSizeBasis(e)},e.setSizeBasis=function(e,t){oe.setSizeBasis(e,t)}}(ae||(ae={})),function(e){e.createLayout=function(e){return e.layout||new oe(e)}}(J||(J={}));class le extends z{constructor(e){super({node:X.createNode()}),this._activeIndex=-1,this._items=[],this._results=null,this.addClass("lm-CommandPalette"),this.setFlag(z.Flag.DisallowLayout),this.commands=e.commands,this.renderer=e.renderer||le.defaultRenderer,this.commands.commandChanged.connect(this._onGenericChange,this),this.commands.keyBindingChanged.connect(this._onGenericChange,this)}dispose(){this._items.length=0,this._results=null,super.dispose()}get searchNode(){return this.node.getElementsByClassName("lm-CommandPalette-search")[0]}get inputNode(){return this.node.getElementsByClassName("lm-CommandPalette-input")[0]}get contentNode(){return this.node.getElementsByClassName("lm-CommandPalette-content")[0]}get items(){return this._items}addItem(e){let t=X.createItem(this.commands,e);return this._items.push(t),this.refresh(),t}addItems(e){const t=e.map((e=>X.createItem(this.commands,e)));return t.forEach((e=>this._items.push(e))),this.refresh(),t}removeItem(e){this.removeItemAt(this._items.indexOf(e))}removeItemAt(e){i.removeAt(this._items,e)&&this.refresh()}clearItems(){0!==this._items.length&&(this._items.length=0,this.refresh())}refresh(){this._results=null,""!==this.inputNode.value?this.node.getElementsByClassName("lm-close-icon")[0].style.display="inherit":this.node.getElementsByClassName("lm-close-icon")[0].style.display="none",this.update()}handleEvent(e){switch(e.type){case"click":this._evtClick(e);break;case"keydown":this._evtKeyDown(e);break;case"input":this.refresh();break;case"focus":case"blur":this._toggleFocused()}}onBeforeAttach(e){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),this.node.addEventListener("input",this),this.node.addEventListener("focus",this,!0),this.node.addEventListener("blur",this,!0)}onAfterDetach(e){this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this),this.node.removeEventListener("input",this),this.node.removeEventListener("focus",this,!0),this.node.removeEventListener("blur",this,!0)}onAfterShow(e){this.update(),super.onAfterShow(e)}onActivateRequest(e){if(this.isAttached){let e=this.inputNode;e.focus(),e.select()}}onUpdateRequest(e){if(this.isHidden)return;let t=this.inputNode.value,n=this.contentNode,r=this._results;if(r||(r=this._results=X.search(this._items,t),this._activeIndex=t?i.findFirstIndex(r,X.canActivate):-1),!t&&0===r.length)return void _.render(null,n);if(t&&0===r.length){let e=this.renderer.renderEmptyMessage({query:t});return void _.render(e,n)}let s=this.renderer,o=this._activeIndex,a=new Array(r.length);for(let e=0,t=r.length;e=r.length)n.scrollTop=0;else{let e=n.children[o];u.scrollIntoViewIfNeeded(n,e)}}_evtClick(e){if(0!==e.button)return;if(e.target.classList.contains("lm-close-icon"))return this.inputNode.value="",void this.refresh();let t=i.findFirstIndex(this.contentNode.children,(t=>t.contains(e.target)));-1!==t&&(e.preventDefault(),e.stopPropagation(),this._execute(t))}_evtKeyDown(e){if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey))switch(e.keyCode){case 13:e.preventDefault(),e.stopPropagation(),this._execute(this._activeIndex);break;case 38:e.preventDefault(),e.stopPropagation(),this._activatePreviousItem();break;case 40:e.preventDefault(),e.stopPropagation(),this._activateNextItem()}}_activateNextItem(){if(!this._results||0===this._results.length)return;let e=this._activeIndex,t=this._results.length,n=ee-t)),c=a.slice(0,d),h=a.slice(d);for(let e=0,t=h.length;en.command===e&&g.JSONExt.deepEqual(n.args,t)))||null}}}(X||(X={}));class ue extends z{constructor(e){super({node:Z.createNode()}),this._childIndex=-1,this._activeIndex=-1,this._openTimerID=0,this._closeTimerID=0,this._items=[],this._childMenu=null,this._parentMenu=null,this._aboutToClose=new x.Signal(this),this._menuRequested=new x.Signal(this),this.addClass("lm-Menu"),this.setFlag(z.Flag.DisallowLayout),this.commands=e.commands,this.renderer=e.renderer||ue.defaultRenderer}dispose(){this.close(),this._items.length=0,super.dispose()}get aboutToClose(){return this._aboutToClose}get menuRequested(){return this._menuRequested}get parentMenu(){return this._parentMenu}get childMenu(){return this._childMenu}get rootMenu(){let e=this;for(;e._parentMenu;)e=e._parentMenu;return e}get leafMenu(){let e=this;for(;e._childMenu;)e=e._childMenu;return e}get contentNode(){return this.node.getElementsByClassName("lm-Menu-content")[0]}get activeItem(){return this._items[this._activeIndex]||null}set activeItem(e){this.activeIndex=e?this._items.indexOf(e):-1}get activeIndex(){return this._activeIndex}set activeIndex(e){(e<0||e>=this._items.length)&&(e=-1),-1===e||Z.canActivate(this._items[e])||(e=-1),this._activeIndex!==e&&(this._activeIndex=e,this._activeIndex>=0&&this.contentNode.childNodes[this._activeIndex]&&this.contentNode.childNodes[this._activeIndex].focus(),this.update())}get items(){return this._items}activateNextItem(){let e=this._items.length,t=this._activeIndex,n=t{this.activeIndex=e}})}_.render(s,this.contentNode)}onCloseRequest(e){this._cancelOpenTimer(),this._cancelCloseTimer(),this.activeIndex=-1;let t=this._childMenu;t&&(this._childIndex=-1,this._childMenu=null,t._parentMenu=null,t.close());let n=this._parentMenu;n&&(this._parentMenu=null,n._childIndex=-1,n._childMenu=null,n.activate()),this.isAttached&&this._aboutToClose.emit(void 0),super.onCloseRequest(e)}_evtKeyDown(e){e.preventDefault(),e.stopPropagation();let t=e.keyCode;if(13===t)return void this.triggerActiveItem();if(27===t)return void this.close();if(37===t)return void(this._parentMenu?this.close():this._menuRequested.emit("previous"));if(38===t)return void this.activatePreviousItem();if(39===t){let e=this.activeItem;return void(e&&"submenu"===e.type?this.triggerActiveItem():this.rootMenu._menuRequested.emit("next"))}if(40===t)return void this.activateNextItem();let n=k().keyForKeydownEvent(e);if(!n)return;let i=this._activeIndex+1,r=Z.findMnemonic(this._items,n,i);-1===r.index||r.multiple?-1!==r.index?this.activeIndex=r.index:-1!==r.auto&&(this.activeIndex=r.auto):(this.activeIndex=r.index,this.triggerActiveItem())}_evtMouseUp(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),this.triggerActiveItem())}_evtMouseMove(e){let t=i.findFirstIndex(this.contentNode.children,(t=>u.hitTest(t,e.clientX,e.clientY)));if(t===this._activeIndex)return;if(this.activeIndex=t,t=this.activeIndex,t===this._childIndex)return this._cancelOpenTimer(),void this._cancelCloseTimer();-1!==this._childIndex&&this._startCloseTimer(),this._cancelOpenTimer();let n=this.activeItem;n&&"submenu"===n.type&&n.submenu&&this._startOpenTimer()}_evtMouseEnter(e){for(let e=this._parentMenu;e;e=e._parentMenu)e._cancelOpenTimer(),e._cancelCloseTimer(),e.activeIndex=e._childIndex}_evtMouseLeave(e){if(this._cancelOpenTimer(),!this._childMenu)return void(this.activeIndex=-1);let{clientX:t,clientY:n}=e;u.hitTest(this._childMenu.node,t,n)?this._cancelCloseTimer():(this.activeIndex=-1,this._startCloseTimer())}_evtMouseDown(e){this._parentMenu||(Z.hitTestMenus(this,e.clientX,e.clientY)?(e.preventDefault(),e.stopPropagation()):this.close())}_openChildMenu(e=!1){let t=this.activeItem;if(!t||"submenu"!==t.type||!t.submenu)return void this._closeChildMenu();let n=t.submenu;if(n===this._childMenu)return;ue.saveWindowData(),this._closeChildMenu(),this._childMenu=n,this._childIndex=this._activeIndex,n._parentMenu=this,f.sendMessage(this,z.Msg.UpdateRequest);let i=this.contentNode.children[this._activeIndex];Z.openSubmenu(n,i),e&&(n.activeIndex=-1,n.activateNextItem()),n.activate()}_closeChildMenu(){this._childMenu&&this._childMenu.close()}_startOpenTimer(){0===this._openTimerID&&(this._openTimerID=window.setTimeout((()=>{this._openTimerID=0,this._openChildMenu()}),Z.TIMER_DELAY))}_startCloseTimer(){0===this._closeTimerID&&(this._closeTimerID=window.setTimeout((()=>{this._closeTimerID=0,this._closeChildMenu()}),Z.TIMER_DELAY))}_cancelOpenTimer(){0!==this._openTimerID&&(clearTimeout(this._openTimerID),this._openTimerID=0)}_cancelCloseTimer(){0!==this._closeTimerID&&(clearTimeout(this._closeTimerID),this._closeTimerID=0)}static saveWindowData(){Z.saveWindowData()}}!function(e){class t{renderItem(e){let t=this.createItemClass(e),n=this.createItemDataset(e),i=this.createItemARIA(e);return B.li({className:t,dataset:n,tabindex:"0",onfocus:e.onfocus,...i},this.renderIcon(e),this.renderLabel(e),this.renderShortcut(e),this.renderSubmenu(e))}renderIcon(e){let t=this.createIconClass(e);return B.div({className:t},e.item.icon,e.item.iconLabel)}renderLabel(e){let t=this.formatLabel(e);return B.div({className:"lm-Menu-itemLabel"},t)}renderShortcut(e){let t=this.formatShortcut(e);return B.div({className:"lm-Menu-itemShortcut"},t)}renderSubmenu(e){return B.div({className:"lm-Menu-itemSubmenuIcon"})}createItemClass(e){let t="lm-Menu-item";e.item.isEnabled||(t+=" lm-mod-disabled"),e.item.isToggled&&(t+=" lm-mod-toggled"),e.item.isVisible||(t+=" lm-mod-hidden"),e.active&&(t+=" lm-mod-active"),e.collapsed&&(t+=" lm-mod-collapsed");let n=e.item.className;return n&&(t+=` ${n}`),t}createItemDataset(e){let t,{type:n,command:i,dataset:r}=e.item;return t="command"===n?{...r,type:n,command:i}:{...r,type:n},t}createIconClass(e){let t="lm-Menu-itemIcon",n=e.item.iconClass;return n?`${t} ${n}`:t}createItemARIA(e){let t={};switch(e.item.type){case"separator":t.role="presentation";break;case"submenu":t["aria-haspopup"]="true",e.item.isEnabled||(t["aria-disabled"]="true");break;default:e.item.isEnabled||(t["aria-disabled"]="true"),t.role="menuitem"}return t}formatLabel(e){let{label:t,mnemonic:n}=e.item;if(n<0||n>=t.length)return t;let i=t.slice(0,n),r=t.slice(n+1),s=t[n];return[i,B.span({className:"lm-Menu-itemMnemonic"},s),r]}formatShortcut(e){let t=e.item.keyBinding;return t?D.CommandRegistry.formatKeystroke(t.keys):null}}e.Renderer=t,e.defaultRenderer=new t}(ue||(ue={})),function(e){e.TIMER_DELAY=300,e.SUBMENU_OVERLAP=3;let t=null,n=0;function r(){return n>0?(n--,t):o()}function s(e){return"separator"!==e.type&&e.isEnabled&&e.isVisible}function o(){return{pageXOffset:window.pageXOffset,pageYOffset:window.pageYOffset,clientWidth:document.documentElement.clientWidth,clientHeight:document.documentElement.clientHeight}}e.saveWindowData=function(){t=o(),n++},e.createNode=function(){let e=document.createElement("div"),t=document.createElement("ul");return t.className="lm-Menu-content",e.appendChild(t),t.setAttribute("role","menu"),e.tabIndex=0,e},e.canActivate=s,e.createItem=function(e,t){return new a(e.commands,t)},e.hitTestMenus=function(e,t,n){for(let i=e;i;i=i.childMenu)if(u.hitTest(i.node,t,n))return!0;return!1},e.computeCollapsed=function(e){let t=new Array(e.length);i.fill(t,!1);let n=0,r=e.length;for(;n=0;--s){let n=e[s];if(n.isVisible){if("separator"!==n.type)break;t[s]=!0}}let o=!1;for(;++nu+c&&(t=u+c-v),!s&&n+b>d+h&&(n>d+h?n=d+h-b:n-=b),m.transform=`translate(${Math.max(0,t)}px, ${Math.max(0,n)}px`,m.opacity="1"},e.openSubmenu=function(t,n){const i=r();let s=i.pageXOffset,o=i.pageYOffset,a=i.clientWidth,l=i.clientHeight;f.sendMessage(t,z.Msg.UpdateRequest);let d=l,c=t.node,h=c.style;h.opacity="0",h.maxHeight=`${d}px`,z.attach(t,document.body);let{width:p,height:g}=c.getBoundingClientRect(),m=u.boxSizing(t.node),v=n.getBoundingClientRect(),b=v.right-e.SUBMENU_OVERLAP;b+p>s+a&&(b=v.left+e.SUBMENU_OVERLAP-p);let A=v.top-m.borderTop-m.paddingTop;A+g>o+l&&(A=v.bottom+m.borderBottom+m.paddingBottom-g),h.transform=`translate(${Math.max(0,b)}px, ${Math.max(0,A)}px`,h.opacity="1"},e.findMnemonic=function(e,t,n){let i=-1,r=-1,o=!1,a=t.toUpperCase();for(let t=0,l=e.length;t=0&&hn.command===e&&g.JSONExt.deepEqual(n.args,t)))||null}return null}}}(Z||(Z={})),function(e){function t(e,t){let n=e.rank,i=t.rank;return n!==i?n=this._titles.length)&&(e=-1),this._currentIndex===e)return;let t=this._currentIndex,n=this._titles[t]||null,i=e,r=this._titles[i]||null;this._currentIndex=i,this._previousTitle=n,this.update(),this._currentChanged.emit({previousIndex:t,previousTitle:n,currentIndex:i,currentTitle:r})}get name(){return this._name}set name(e){this._name=e,e?this.contentNode.setAttribute("aria-label",e):this.contentNode.removeAttribute("aria-label")}get orientation(){return this._orientation}set orientation(e){this._orientation!==e&&(this._releaseMouse(),this._orientation=e,this.dataset.orientation=e,this.contentNode.setAttribute("aria-orientation",e))}get addButtonEnabled(){return this._addButtonEnabled}set addButtonEnabled(e){this._addButtonEnabled!==e&&(this._addButtonEnabled=e,e?this.addButtonNode.classList.remove("lm-mod-hidden"):this.addButtonNode.classList.add("lm-mod-hidden"))}get titles(){return this._titles}get contentNode(){return this.node.getElementsByClassName("lm-TabBar-content")[0]}get addButtonNode(){return this.node.getElementsByClassName("lm-TabBar-addButton")[0]}addTab(e){return this.insertTab(this._titles.length,e)}insertTab(e,t){this._releaseMouse();let n=he.asTitle(t),r=this._titles.indexOf(n),s=Math.max(0,Math.min(e,this._titles.length));return-1===r?(i.insert(this._titles,s,n),n.changed.connect(this._onTitleChanged,this),this.update(),this._adjustCurrentForInsert(s,n),n):(s===this._titles.length&&s--,r===s||(i.move(this._titles,r,s),this.update(),this._adjustCurrentForMove(r,s)),n)}removeTab(e){this.removeTabAt(this._titles.indexOf(e))}removeTabAt(e){this._releaseMouse();let t=i.removeAt(this._titles,e);t&&(t.changed.disconnect(this._onTitleChanged,this),t===this._previousTitle&&(this._previousTitle=null),this.update(),this._adjustCurrentForRemove(e,t))}clearTabs(){if(0===this._titles.length)return;this._releaseMouse();for(let e of this._titles)e.changed.disconnect(this._onTitleChanged,this);let e=this.currentIndex,t=this.currentTitle;this._currentIndex=-1,this._previousTitle=null,this._titles.length=0,this.update(),-1!==e&&this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:-1,currentTitle:null})}releaseMouse(){this._releaseMouse()}handleEvent(e){switch(e.type){case"pointerdown":this._evtPointerDown(e);break;case"pointermove":this._evtPointerMove(e);break;case"pointerup":this._evtPointerUp(e);break;case"dblclick":this._evtDblClick(e);break;case"keydown":e.eventPhase===Event.CAPTURING_PHASE?this._evtKeyDownCapturing(e):this._evtKeyDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("pointerdown",this),this.node.addEventListener("dblclick",this),this.node.addEventListener("keydown",this)}onAfterDetach(e){this.node.removeEventListener("pointerdown",this),this.node.removeEventListener("dblclick",this),this.node.removeEventListener("keydown",this),this._releaseMouse()}onUpdateRequest(e){var t;let n=this._titles,i=this.renderer,r=this.currentTitle,s=new Array(n.length);const o=null!==(t=this._getCurrentTabindex())&&void 0!==t?t:this._currentIndex>-1?this._currentIndex:0;for(let e=0,t=n.length;eu.hitTest(t,e.clientX,e.clientY)));if(-1===n)return;let r=this.titles[n],s=t[n].querySelector(".lm-TabBar-tabLabel");if(s&&s.contains(e.target)){let e=r.label||"",t=s.innerHTML;s.innerHTML="";let n=document.createElement("input");n.classList.add("lm-TabBar-tabInput"),n.value=e,s.appendChild(n);let i=()=>{n.removeEventListener("blur",i),s.innerHTML=t,this.node.addEventListener("keydown",this)};n.addEventListener("dblclick",(e=>e.stopPropagation())),n.addEventListener("blur",i),n.addEventListener("keydown",(e=>{"Enter"===e.key?(""!==n.value&&(r.label=r.caption=n.value),i()):"Escape"===e.key&&i()})),this.node.removeEventListener("keydown",this),n.select(),n.focus(),s.children.length>0&&s.children[0].focus()}}_evtKeyDownCapturing(e){e.eventPhase===Event.CAPTURING_PHASE&&(e.preventDefault(),e.stopPropagation(),"Escape"===e.key&&this._releaseMouse())}_evtKeyDown(e){var t,n,r;if("Tab"!==e.key&&e.eventPhase!==Event.CAPTURING_PHASE)if("Enter"===e.key||"Spacebar"===e.key||" "===e.key){const t=document.activeElement;if(this.addButtonEnabled&&this.addButtonNode.contains(t))e.preventDefault(),e.stopPropagation(),this._addRequested.emit();else{const n=i.findFirstIndex(this.contentNode.children,(e=>e.contains(t)));n>=0&&(e.preventDefault(),e.stopPropagation(),this.currentIndex=n)}}else if(de.includes(e.key)){const i=[...this.contentNode.children];if(this.addButtonEnabled&&i.push(this.addButtonNode),i.length<=1)return;e.preventDefault(),e.stopPropagation();let s,o=i.indexOf(document.activeElement);-1===o&&(o=this._currentIndex),"ArrowRight"===e.key&&"horizontal"===this._orientation||"ArrowDown"===e.key&&"vertical"===this._orientation?s=null!==(t=i[o+1])&&void 0!==t?t:i[0]:"ArrowLeft"===e.key&&"horizontal"===this._orientation||"ArrowUp"===e.key&&"vertical"===this._orientation?s=null!==(n=i[o-1])&&void 0!==n?n:i[i.length-1]:"Home"===e.key?s=i[0]:"End"===e.key&&(s=i[i.length-1]),s&&(null===(r=i[o])||void 0===r||r.setAttribute("tabindex","-1"),null==s||s.setAttribute("tabindex","0"),s.focus())}}_evtPointerDown(e){if(0!==e.button&&1!==e.button)return;if(this._dragData)return;if(e.target.classList.contains("lm-TabBar-tabInput"))return;let t=this.addButtonEnabled&&this.addButtonNode.contains(e.target),n=this.contentNode.children,r=i.findFirstIndex(n,(t=>u.hitTest(t,e.clientX,e.clientY)));if(-1===r&&!t)return;if(e.preventDefault(),e.stopPropagation(),this._dragData={tab:n[r],index:r,pressX:e.clientX,pressY:e.clientY,tabPos:-1,tabSize:-1,tabPressPos:-1,targetIndex:-1,tabLayout:null,contentRect:null,override:null,dragActive:!1,dragAborted:!1,detachRequested:!1},this.document.addEventListener("pointerup",this,!0),1===e.button||t)return;let s=n[r].querySelector(this.renderer.closeIconSelector);s&&s.contains(e.target)||(this.tabsMovable&&(this.document.addEventListener("pointermove",this,!0),this.document.addEventListener("keydown",this,!0),this.document.addEventListener("contextmenu",this,!0)),this.allowDeselect&&this.currentIndex===r?this.currentIndex=-1:this.currentIndex=r,-1!==this.currentIndex&&this._tabActivateRequested.emit({index:this.currentIndex,title:this.currentTitle}))}_evtPointerMove(e){let t=this._dragData;if(!t)return;e.preventDefault(),e.stopPropagation();let n=this.contentNode.children;if(t.dragActive||he.dragExceeded(t,e)){if(!t.dragActive){let e=t.tab.getBoundingClientRect();"horizontal"===this._orientation?(t.tabPos=t.tab.offsetLeft,t.tabSize=e.width,t.tabPressPos=t.pressX-e.left):(t.tabPos=t.tab.offsetTop,t.tabSize=e.height,t.tabPressPos=t.pressY-e.top),t.tabPressOffset={x:t.pressX-e.left,y:t.pressY-e.top},t.tabLayout=he.snapTabLayout(n,this._orientation),t.contentRect=this.contentNode.getBoundingClientRect(),t.override=D.Drag.overrideCursor("default"),t.tab.classList.add("lm-mod-dragging"),this.addClass("lm-mod-dragging"),t.dragActive=!0}if(!t.detachRequested&&he.detachExceeded(t,e)){t.detachRequested=!0;let i=t.index,r=e.clientX,s=e.clientY,o=n[i],a=this._titles[i];if(this._tabDetachRequested.emit({index:i,title:a,tab:o,clientX:r,clientY:s,offset:t.tabPressOffset}),t.dragAborted)return}he.layoutTabs(n,t,e,this._orientation)}}_evtPointerUp(e){if(0!==e.button&&1!==e.button)return;const t=this._dragData;if(!t)return;if(e.preventDefault(),e.stopPropagation(),this.document.removeEventListener("pointermove",this,!0),this.document.removeEventListener("pointerup",this,!0),this.document.removeEventListener("keydown",this,!0),this.document.removeEventListener("contextmenu",this,!0),!t.dragActive){if(this._dragData=null,this.addButtonEnabled&&this.addButtonNode.contains(e.target))return void this._addRequested.emit(void 0);let n=this.contentNode.children,r=i.findFirstIndex(n,(t=>u.hitTest(t,e.clientX,e.clientY)));if(r!==t.index)return;let s=this._titles[r];if(!s.closable)return;if(1===e.button)return void this._tabCloseRequested.emit({index:r,title:s});let o=n[r].querySelector(this.renderer.closeIconSelector);return o&&o.contains(e.target)?void this._tabCloseRequested.emit({index:r,title:s}):void 0}if(0!==e.button)return;he.finalizeTabPosition(t,this._orientation),t.tab.classList.remove("lm-mod-dragging");let n=he.parseTransitionDuration(t.tab);setTimeout((()=>{if(t.dragAborted)return;this._dragData=null,he.resetTabPositions(this.contentNode.children,this._orientation),t.override.dispose(),this.removeClass("lm-mod-dragging");let e=t.index,n=t.targetIndex;-1!==n&&e!==n&&(i.move(this._titles,e,n),this._adjustCurrentForMove(e,n),this._tabMoved.emit({fromIndex:e,toIndex:n,title:this._titles[n]}),f.sendMessage(this,z.Msg.UpdateRequest))}),n)}_releaseMouse(){let e=this._dragData;e&&(this._dragData=null,this.document.removeEventListener("pointermove",this,!0),this.document.removeEventListener("pointerup",this,!0),this.document.removeEventListener("keydown",this,!0),this.document.removeEventListener("contextmenu",this,!0),e.dragAborted=!0,e.dragActive&&(he.resetTabPositions(this.contentNode.children,this._orientation),e.override.dispose(),e.tab.classList.remove("lm-mod-dragging"),this.removeClass("lm-mod-dragging")))}_adjustCurrentForInsert(e,t){let n=this.currentTitle,i=this._currentIndex,r=this.insertBehavior;if("select-tab"===r||"select-tab-if-needed"===r&&-1===i)return this._currentIndex=e,this._previousTitle=n,void this._currentChanged.emit({previousIndex:i,previousTitle:n,currentIndex:e,currentTitle:t});i>=e&&this._currentIndex++}_adjustCurrentForMove(e,t){this._currentIndex===e?this._currentIndex=t:this._currentIndex=t?this._currentIndex++:this._currentIndex>e&&this._currentIndex<=t&&this._currentIndex--}_adjustCurrentForRemove(e,t){let n=this._currentIndex,i=this.removeBehavior;if(n===e){if(0===this._titles.length)return this._currentIndex=-1,void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:-1,currentTitle:null});if("select-tab-after"===i)return this._currentIndex=Math.min(e,this._titles.length-1),void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:this._currentIndex,currentTitle:this.currentTitle});if("select-tab-before"===i)return this._currentIndex=Math.max(0,e-1),void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:this._currentIndex,currentTitle:this.currentTitle});if("select-previous-tab"===i)return this._previousTitle?(this._currentIndex=this._titles.indexOf(this._previousTitle),this._previousTitle=null):this._currentIndex=Math.min(e,this._titles.length-1),void this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:this._currentIndex,currentTitle:this.currentTitle});this._currentIndex=-1,this._currentChanged.emit({previousIndex:e,previousTitle:t,currentIndex:-1,currentTitle:null})}else n>e&&this._currentIndex--}_onTitleChanged(e){this.update()}}var he,pe,fe,ge,me,ve,be,Ae;!function(e){class t{constructor(){this.closeIconSelector=".lm-TabBar-tabCloseIcon",this._tabID=0,this._tabKeys=new WeakMap,this._uuid=++t._nInstance}renderTab(e){let t=e.title.caption,n=this.createTabKey(e),i=n,r=this.createTabStyle(e),s=this.createTabClass(e),o=this.createTabDataset(e),a=this.createTabARIA(e);return e.title.closable?B.li({id:i,key:n,className:s,title:t,style:r,dataset:o,...a},this.renderIcon(e),this.renderLabel(e),this.renderCloseIcon(e)):B.li({id:i,key:n,className:s,title:t,style:r,dataset:o,...a},this.renderIcon(e),this.renderLabel(e))}renderIcon(e){const{title:t}=e;let n=this.createIconClass(e);return B.div({className:n},t.icon,t.iconLabel)}renderLabel(e){return B.div({className:"lm-TabBar-tabLabel"},e.title.label)}renderCloseIcon(e){return B.div({className:"lm-TabBar-tabCloseIcon"})}createTabKey(e){let t=this._tabKeys.get(e.title);return void 0===t&&(t=`tab-key-${this._uuid}-${this._tabID++}`,this._tabKeys.set(e.title,t)),t}createTabStyle(e){return{zIndex:`${e.zIndex}`}}createTabClass(e){let t="lm-TabBar-tab";return e.title.className&&(t+=` ${e.title.className}`),e.title.closable&&(t+=" lm-mod-closable"),e.current&&(t+=" lm-mod-current"),t}createTabDataset(e){return e.title.dataset}createTabARIA(e){var t;return{role:"tab","aria-selected":e.current.toString(),tabindex:`${null!==(t=e.tabIndex)&&void 0!==t?t:"-1"}`}}createIconClass(e){let t="lm-TabBar-tabIcon",n=e.title.iconClass;return n?`${t} ${n}`:t}}t._nInstance=0,e.Renderer=t,e.defaultRenderer=new t,e.addButtonSelector=".lm-TabBar-addButton"}(ce||(ce={})),function(e){e.DRAG_THRESHOLD=5,e.DETACH_THRESHOLD=20,e.createNode=function(){let e=document.createElement("div"),t=document.createElement("ul");t.setAttribute("role","tablist"),t.className="lm-TabBar-content",e.appendChild(t);let n=document.createElement("div");return n.className="lm-TabBar-addButton lm-mod-hidden",n.setAttribute("tabindex","-1"),n.setAttribute("role","button"),e.appendChild(n),e},e.asTitle=function(e){return e instanceof F?e:new F(e)},e.parseTransitionDuration=function(e){let t=window.getComputedStyle(e);return 1e3*(parseFloat(t.transitionDuration)||0)},e.snapTabLayout=function(e,t){let n=new Array(e.length);for(let i=0,r=e.length;i=e.DRAG_THRESHOLD||r>=e.DRAG_THRESHOLD},e.detachExceeded=function(t,n){let i=t.contentRect;return n.clientX=i.right+e.DETACH_THRESHOLD||n.clientY=i.bottom+e.DETACH_THRESHOLD},e.layoutTabs=function(e,t,n,i){let r,s,o,a;"horizontal"===i?(r=t.pressX,s=n.clientX-t.contentRect.left,o=n.clientX,a=t.contentRect.width):(r=t.pressY,s=n.clientY-t.contentRect.top,o=n.clientY,a=t.contentRect.height);let l=t.index,u=s-t.tabPressPos,d=u+t.tabSize;for(let n=0,s=e.length;n>1);if(nt.index&&d>h)s=-t.tabSize-c.margin+"px",l=Math.max(l,n);else if(n===t.index){let e=o-r,n=a-(t.tabPos+t.tabSize);s=`${Math.max(-t.tabPos,Math.min(e,n))}px`}else s="";"horizontal"===i?e[n].style.left=s:e[n].style.top=s}t.targetIndex=l},e.finalizeTabPosition=function(e,t){let n,i;if(n="horizontal"===t?e.contentRect.width:e.contentRect.height,e.targetIndex===e.index)i=0;else if(e.targetIndex>e.index){let t=e.tabLayout[e.targetIndex];i=t.pos+t.size-e.tabSize-e.tabPos}else i=e.tabLayout[e.targetIndex].pos-e.tabPos;let r=n-(e.tabPos+e.tabSize),s=Math.max(-e.tabPos,Math.min(i,r));"horizontal"===t?e.tab.style.left=`${s}px`:e.tab.style.top=`${s}px`},e.resetTabPositions=function(e,t){for(const n of e)"horizontal"===t?n.style.left="":n.style.top=""}}(he||(he={}));class ye extends U{constructor(e){super(),this._spacing=4,this._dirty=!1,this._root=null,this._box=null,this._items=new Map,this.renderer=e.renderer,void 0!==e.spacing&&(this._spacing=ee.clampDimension(e.spacing)),this._document=e.document||document,this._hiddenMode=void 0!==e.hiddenMode?e.hiddenMode:z.HiddenMode.Display}dispose(){let e=this[Symbol.iterator]();this._items.forEach((e=>{e.dispose()})),this._box=null,this._root=null,this._items.clear();for(const t of e)t.dispose();super.dispose()}get hiddenMode(){return this._hiddenMode}set hiddenMode(e){if(this._hiddenMode!==e){this._hiddenMode=e;for(const e of this.tabBars())if(e.titles.length>1)for(const t of e.titles)t.owner.hiddenMode=this._hiddenMode}}get spacing(){return this._spacing}set spacing(e){e=ee.clampDimension(e),this._spacing!==e&&(this._spacing=e,this.parent&&this.parent.fit())}get isEmpty(){return null===this._root}[Symbol.iterator](){return this._root?this._root.iterAllWidgets():o()}widgets(){return this._root?this._root.iterUserWidgets():o()}selectedWidgets(){return this._root?this._root.iterSelectedWidgets():o()}tabBars(){return this._root?this._root.iterTabBars():o()}handles(){return this._root?this._root.iterHandles():o()}moveHandle(e,t,n){let i=e.classList.contains("lm-mod-hidden");if(!this._root||i)return;let r,s=this._root.findSplitNode(e);s&&(r="horizontal"===s.node.orientation?t-e.offsetLeft:n-e.offsetTop,0!==r&&(s.node.holdSizes(),I.adjust(s.node.sizers,s.index,r),this.parent&&this.parent.update()))}saveLayout(){return this._root?(this._root.holdAllSizes(),{main:this._root.createConfig()}):{main:null}}restoreLayout(e){let t,n=new Set;t=e.main?pe.normalizeAreaConfig(e.main,n):null;let i=this.widgets(),r=this.tabBars(),s=this.handles();this._root=null;for(const e of i)n.has(e)||(e.parent=null);for(const e of r)e.dispose();for(const e of s)e.parentNode&&e.parentNode.removeChild(e);for(const e of n)e.parent=this.parent;this._root=t?pe.realizeAreaConfig(t,{createTabBar:e=>this._createTabBar(),createHandle:()=>this._createHandle()},this._document):null,this.parent&&(n.forEach((e=>{this.attachWidget(e)})),this.parent.fit())}addWidget(e,t={}){let n=t.ref||null,i=t.mode||"tab-after",r=null;if(this._root&&n&&(r=this._root.findTabNode(n)),n&&!r)throw new Error("Reference widget is not in the layout.");switch(e.parent=this.parent,i){case"tab-after":this._insertTab(e,n,r,!0);break;case"tab-before":this._insertTab(e,n,r,!1);break;case"split-top":this._insertSplit(e,n,r,"vertical",!1);break;case"split-left":this._insertSplit(e,n,r,"horizontal",!1);break;case"split-right":this._insertSplit(e,n,r,"horizontal",!0);break;case"split-bottom":this._insertSplit(e,n,r,"vertical",!0);break;case"merge-top":this._insertSplit(e,n,r,"vertical",!1,!0);break;case"merge-left":this._insertSplit(e,n,r,"horizontal",!1,!0);break;case"merge-right":this._insertSplit(e,n,r,"horizontal",!0,!0);break;case"merge-bottom":this._insertSplit(e,n,r,"vertical",!0,!0)}this.parent&&(this.attachWidget(e),this.parent.fit())}removeWidget(e){this._removeWidget(e),this.parent&&(this.detachWidget(e),this.parent.fit())}hitTestTabAreas(e,t){if(!this._root||!this.parent||!this.parent.isVisible)return null;this._box||(this._box=u.boxSizing(this.parent.node));let n=this.parent.node.getBoundingClientRect(),i=e-n.left-this._box.borderLeft,r=t-n.top-this._box.borderTop,s=this._root.hitTestTabNodes(i,r);if(!s)return null;let{tabBar:o,top:a,left:l,width:d,height:c}=s,h=this._box.borderLeft+this._box.borderRight,p=this._box.borderTop+this._box.borderBottom;return{tabBar:o,x:i,y:r,top:a,left:l,right:n.width-h-(l+d),bottom:n.height-p-(a+c),width:d,height:c}}init(){super.init();for(const e of this)this.attachWidget(e);for(const e of this.handles())this.parent.node.appendChild(e);this.parent.fit()}attachWidget(e){this.parent.node!==e.node.parentNode&&(this._items.set(e,new H(e)),this.parent.isAttached&&f.sendMessage(e,z.Msg.BeforeAttach),this.parent.node.appendChild(e.node),this.parent.isAttached&&f.sendMessage(e,z.Msg.AfterAttach))}detachWidget(e){if(this.parent.node!==e.node.parentNode)return;this.parent.isAttached&&f.sendMessage(e,z.Msg.BeforeDetach),this.parent.node.removeChild(e.node),this.parent.isAttached&&f.sendMessage(e,z.Msg.AfterDetach);let t=this._items.get(e);t&&(this._items.delete(e),t.dispose())}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_removeWidget(e){if(!this._root)return;let t=this._root.findTabNode(e);if(!t)return;if(pe.removeAria(e),t.tabBar.titles.length>1)return t.tabBar.removeTab(e.title),void(this._hiddenMode===z.HiddenMode.Scale&&1==t.tabBar.titles.length&&(t.tabBar.titles[0].owner.hiddenMode=z.HiddenMode.Display));if(t.tabBar.dispose(),this._root===t)return void(this._root=null);this._root.holdAllSizes();let n=t.parent;t.parent=null;let r=i.removeFirstOf(n.children,t),s=i.removeAt(n.handles,r);if(i.removeAt(n.sizers,r),s.parentNode&&s.parentNode.removeChild(s),n.children.length>1)return void n.syncHandles();let o=n.parent;n.parent=null;let a=n.children[0],l=n.handles[0];if(n.children.length=0,n.handles.length=0,n.sizers.length=0,l.parentNode&&l.parentNode.removeChild(l),this._root===n)return a.parent=null,void(this._root=a);let u=o,d=u.children.indexOf(n);if(a instanceof pe.TabLayoutNode)return a.parent=u,void(u.children[d]=a);let c=i.removeAt(u.handles,d);i.removeAt(u.children,d),i.removeAt(u.sizers,d),c.parentNode&&c.parentNode.removeChild(c);for(let e=0,t=a.children.length;e=n.length)&&(i=0),{type:"tab-area",widgets:n,currentIndex:i}}(t,n):function(t,n){let i=t.orientation,r=[],s=[];for(let o=0,a=t.children.length;o{let l=r(i,n,s),u=t(e.sizes[a]),d=n.createHandle();o.children.push(l),o.handles.push(d),o.sizers.push(u),l.parent=o})),o.syncHandles(),o.normalizeSizes(),o}(s,o,a),l};class n{constructor(e){this.parent=null,this._top=0,this._left=0,this._width=0,this._height=0;let t=new N,n=new N;t.stretch=0,n.stretch=1,this.tabBar=e,this.sizers=[t,n]}get top(){return this._top}get left(){return this._left}get width(){return this._width}get height(){return this._height}*iterAllWidgets(){yield this.tabBar,yield*this.iterUserWidgets()}*iterUserWidgets(){for(const e of this.tabBar.titles)yield e.owner}*iterSelectedWidgets(){let e=this.tabBar.currentTitle;e&&(yield e.owner)}*iterTabBars(){yield this.tabBar}*iterHandles(){}findTabNode(e){return-1!==this.tabBar.titles.indexOf(e.title)?this:null}findSplitNode(e){return null}findFirstTabNode(){return this}hitTestTabNodes(e,t){return e=this._left+this._width||t=this._top+this._height?null:this}createConfig(){return{type:"tab-area",widgets:this.tabBar.titles.map((e=>e.owner)),currentIndex:this.tabBar.currentIndex}}holdAllSizes(){}fit(e,t){let n=0,i=0,r=t.get(this.tabBar),s=this.tabBar.currentTitle,o=s?t.get(s.owner):void 0,[a,l]=this.sizers;return r&&r.fit(),o&&o.fit(),r&&!r.isHidden?(n=Math.max(n,r.minWidth),i+=r.minHeight,a.minSize=r.minHeight,a.maxSize=r.maxHeight):(a.minSize=0,a.maxSize=0),o&&!o.isHidden?(n=Math.max(n,o.minWidth),i+=o.minHeight,l.minSize=o.minHeight,l.maxSize=1/0):(l.minSize=0,l.maxSize=1/0),{minWidth:n,minHeight:i,maxWidth:1/0,maxHeight:1/0}}update(e,t,n,i,r,s){this._top=t,this._left=e,this._width=n,this._height=i;let o=s.get(this.tabBar),a=this.tabBar.currentTitle,l=a?s.get(a.owner):void 0;if(I.calc(this.sizers,i),o&&!o.isHidden){let i=this.sizers[0].size;o.update(e,t,n,i),t+=i}if(l&&!l.isHidden){let i=this.sizers[1].size;l.update(e,t,n,i)}}}e.TabLayoutNode=n;class i{constructor(e){this.parent=null,this.normalized=!1,this.children=[],this.sizers=[],this.handles=[],this.orientation=e}*iterAllWidgets(){for(const e of this.children)yield*e.iterAllWidgets()}*iterUserWidgets(){for(const e of this.children)yield*e.iterUserWidgets()}*iterSelectedWidgets(){for(const e of this.children)yield*e.iterSelectedWidgets()}*iterTabBars(){for(const e of this.children)yield*e.iterTabBars()}*iterHandles(){yield*this.handles;for(const e of this.children)yield*e.iterHandles()}findTabNode(e){for(let t=0,n=this.children.length;te.createConfig())),sizes:t}}syncHandles(){this.handles.forEach(((e,t)=>{e.setAttribute("data-orientation",this.orientation),t===this.handles.length-1?e.classList.add("lm-mod-hidden"):e.classList.remove("lm-mod-hidden")}))}holdSizes(){for(const e of this.sizers)e.sizeHint=e.size}holdAllSizes(){for(const e of this.children)e.holdAllSizes();this.holdSizes()}normalizeSizes(){let e=this.sizers.length;if(0===e)return;this.holdSizes();let t=this.sizers.reduce(((e,t)=>e+t.sizeHint),0);if(0===t)for(const t of this.sizers)t.size=t.sizeHint=1/e;else for(const e of this.sizers)e.size=e.sizeHint/=t;this.normalized=!0}createNormalizedSizes(){let e=this.sizers.length;if(0===e)return[];let t=this.sizers.map((e=>e.size)),n=t.reduce(((e,t)=>e+t),0);if(0===n)for(let n=t.length-1;n>-1;n--)t[n]=1/e;else for(let e=t.length-1;e>-1;e--)t[e]/=n;return t}fit(e,t){let n="horizontal"===this.orientation,i=Math.max(0,this.children.length-1)*e,r=n?i:0,s=n?0:i;for(let i=0,o=this.children.length;ithis._createTabBar(),createHandle:()=>this._createHandle()};this.layout=new ye({document:this._document,renderer:t,spacing:e.spacing,hiddenMode:e.hiddenMode}),this.overlay=e.overlay||new we.Overlay,this.node.appendChild(this.overlay.node)}dispose(){this._releaseMouse(),this.overlay.hide(0),this._drag&&this._drag.dispose(),super.dispose()}get hiddenMode(){return this.layout.hiddenMode}set hiddenMode(e){this.layout.hiddenMode=e}get layoutModified(){return this._layoutModified}get addRequested(){return this._addRequested}get renderer(){return this.layout.renderer}get spacing(){return this.layout.spacing}set spacing(e){this.layout.spacing=e}get mode(){return this._mode}set mode(e){if(this._mode===e)return;this._mode=e,this.dataset.mode=e;let t=this.layout;switch(e){case"multiple-document":for(const e of t.tabBars())e.show();break;case"single-document":t.restoreLayout(fe.createSingleDocumentConfig(this));break;default:throw"unreachable"}f.postMessage(this,fe.LayoutModified)}get tabsMovable(){return this._tabsMovable}set tabsMovable(e){this._tabsMovable=e;for(const t of this.tabBars())t.tabsMovable=e}get tabsConstrained(){return this._tabsConstrained}set tabsConstrained(e){this._tabsConstrained=e}get addButtonEnabled(){return this._addButtonEnabled}set addButtonEnabled(e){this._addButtonEnabled=e;for(const t of this.tabBars())t.addButtonEnabled=e}get isEmpty(){return this.layout.isEmpty}*widgets(){yield*this.layout.widgets()}*selectedWidgets(){yield*this.layout.selectedWidgets()}*tabBars(){yield*this.layout.tabBars()}*handles(){yield*this.layout.handles()}selectWidget(e){let t=a(this.tabBars(),(t=>-1!==t.titles.indexOf(e.title)));if(!t)throw new Error("Widget is not contained in the dock panel.");t.currentTitle=e.title}activateWidget(e){this.selectWidget(e),e.activate()}saveLayout(){return this.layout.saveLayout()}restoreLayout(e){this._mode="multiple-document",this.layout.restoreLayout(e),(d.IS_EDGE||d.IS_IE)&&f.flush(),f.postMessage(this,fe.LayoutModified)}addWidget(e,t={}){"single-document"===this._mode?this.layout.addWidget(e):this.layout.addWidget(e,t),f.postMessage(this,fe.LayoutModified)}processMessage(e){"layout-modified"===e.type?this._layoutModified.emit(void 0):super.processMessage(e)}handleEvent(e){switch(e.type){case"lm-dragenter":this._evtDragEnter(e);break;case"lm-dragleave":this._evtDragLeave(e);break;case"lm-dragover":this._evtDragOver(e);break;case"lm-drop":this._evtDrop(e);break;case"pointerdown":this._evtPointerDown(e);break;case"pointermove":this._evtPointerMove(e);break;case"pointerup":this._evtPointerUp(e);break;case"keydown":this._evtKeyDown(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("lm-dragenter",this),this.node.addEventListener("lm-dragleave",this),this.node.addEventListener("lm-dragover",this),this.node.addEventListener("lm-drop",this),this.node.addEventListener("pointerdown",this)}onAfterDetach(e){this.node.removeEventListener("lm-dragenter",this),this.node.removeEventListener("lm-dragleave",this),this.node.removeEventListener("lm-dragover",this),this.node.removeEventListener("lm-drop",this),this.node.removeEventListener("pointerdown",this),this._releaseMouse()}onChildAdded(e){fe.isGeneratedTabBarProperty.get(e.child)||e.child.addClass("lm-DockPanel-widget")}onChildRemoved(e){fe.isGeneratedTabBarProperty.get(e.child)||(e.child.removeClass("lm-DockPanel-widget"),f.postMessage(this,fe.LayoutModified))}_evtDragEnter(e){e.mimeData.hasData("application/vnd.lumino.widget-factory")&&(e.preventDefault(),e.stopPropagation())}_evtDragLeave(e){e.preventDefault(),this._tabsConstrained&&e.source!==this||(e.stopPropagation(),this.overlay.hide(1))}_evtDragOver(e){e.preventDefault(),this._tabsConstrained&&e.source!==this||"invalid"===this._showOverlay(e.clientX,e.clientY)?e.dropAction="none":(e.stopPropagation(),e.dropAction=e.proposedAction)}_evtDrop(e){if(e.preventDefault(),this.overlay.hide(0),"none"===e.proposedAction)return void(e.dropAction="none");let{clientX:t,clientY:n}=e,{zone:i,target:r}=fe.findDropTarget(this,t,n,this._edges);if(this._tabsConstrained&&e.source!==this||"invalid"===i)return void(e.dropAction="none");let s=e.mimeData.getData("application/vnd.lumino.widget-factory");if("function"!=typeof s)return void(e.dropAction="none");let o=s();if(!(o instanceof z))return void(e.dropAction="none");if(o.contains(this))return void(e.dropAction="none");let a=r?fe.getDropRef(r.tabBar):null;switch(i){case"root-all":this.addWidget(o);break;case"root-top":this.addWidget(o,{mode:"split-top"});break;case"root-left":this.addWidget(o,{mode:"split-left"});break;case"root-right":this.addWidget(o,{mode:"split-right"});break;case"root-bottom":this.addWidget(o,{mode:"split-bottom"});break;case"widget-all":case"widget-tab":this.addWidget(o,{mode:"tab-after",ref:a});break;case"widget-top":this.addWidget(o,{mode:"split-top",ref:a});break;case"widget-left":this.addWidget(o,{mode:"split-left",ref:a});break;case"widget-right":this.addWidget(o,{mode:"split-right",ref:a});break;case"widget-bottom":this.addWidget(o,{mode:"split-bottom",ref:a});break;default:throw"unreachable"}e.dropAction=e.proposedAction,e.stopPropagation(),this.activateWidget(o)}_evtKeyDown(e){e.preventDefault(),e.stopPropagation(),27===e.keyCode&&(this._releaseMouse(),f.postMessage(this,fe.LayoutModified))}_evtPointerDown(e){if(0!==e.button)return;let t=this.layout,n=e.target,i=a(t.handles(),(e=>e.contains(n)));if(!i)return;e.preventDefault(),e.stopPropagation(),this._document.addEventListener("keydown",this,!0),this._document.addEventListener("pointerup",this,!0),this._document.addEventListener("pointermove",this,!0),this._document.addEventListener("contextmenu",this,!0);let r=i.getBoundingClientRect(),s=e.clientX-r.left,o=e.clientY-r.top,l=window.getComputedStyle(i),u=D.Drag.overrideCursor(l.cursor,this._document);this._pressData={handle:i,deltaX:s,deltaY:o,override:u}}_evtPointerMove(e){if(!this._pressData)return;e.preventDefault(),e.stopPropagation();let t=this.node.getBoundingClientRect(),n=e.clientX-t.left-this._pressData.deltaX,i=e.clientY-t.top-this._pressData.deltaY;this.layout.moveHandle(this._pressData.handle,n,i)}_evtPointerUp(e){0===e.button&&(e.preventDefault(),e.stopPropagation(),this._releaseMouse(),f.postMessage(this,fe.LayoutModified))}_releaseMouse(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,this._document.removeEventListener("keydown",this,!0),this._document.removeEventListener("pointerup",this,!0),this._document.removeEventListener("pointermove",this,!0),this._document.removeEventListener("contextmenu",this,!0))}_showOverlay(e,t){let n,i,r,s,{zone:o,target:a}=fe.findDropTarget(this,e,t,this._edges);if("invalid"===o)return this.overlay.hide(100),o;let l=u.boxSizing(this.node),d=this.node.getBoundingClientRect();switch(o){case"root-all":n=l.paddingTop,i=l.paddingLeft,r=l.paddingRight,s=l.paddingBottom;break;case"root-top":n=l.paddingTop,i=l.paddingLeft,r=l.paddingRight,s=d.height*fe.GOLDEN_RATIO;break;case"root-left":n=l.paddingTop,i=l.paddingLeft,r=d.width*fe.GOLDEN_RATIO,s=l.paddingBottom;break;case"root-right":n=l.paddingTop,i=d.width*fe.GOLDEN_RATIO,r=l.paddingRight,s=l.paddingBottom;break;case"root-bottom":n=d.height*fe.GOLDEN_RATIO,i=l.paddingLeft,r=l.paddingRight,s=l.paddingBottom;break;case"widget-all":n=a.top,i=a.left,r=a.right,s=a.bottom;break;case"widget-top":n=a.top,i=a.left,r=a.right,s=a.bottom+a.height/2;break;case"widget-left":n=a.top,i=a.left,r=a.right+a.width/2,s=a.bottom;break;case"widget-right":n=a.top,i=a.left+a.width/2,r=a.right,s=a.bottom;break;case"widget-bottom":n=a.top+a.height/2,i=a.left,r=a.right,s=a.bottom;break;case"widget-tab":{const e=a.tabBar.node.getBoundingClientRect().height;n=a.top,i=a.left,r=a.right,s=a.bottom+a.height-e;break}default:throw"unreachable"}return this.overlay.show({top:n,left:i,right:r,bottom:s}),o}_createTabBar(){let e=this._renderer.createTabBar(this._document);return fe.isGeneratedTabBarProperty.set(e,!0),"single-document"===this._mode&&e.hide(),e.tabsMovable=this._tabsMovable,e.allowDeselect=!1,e.addButtonEnabled=this._addButtonEnabled,e.removeBehavior="select-previous-tab",e.insertBehavior="select-tab-if-needed",e.tabMoved.connect(this._onTabMoved,this),e.currentChanged.connect(this._onCurrentChanged,this),e.tabCloseRequested.connect(this._onTabCloseRequested,this),e.tabDetachRequested.connect(this._onTabDetachRequested,this),e.tabActivateRequested.connect(this._onTabActivateRequested,this),e.addRequested.connect(this._onTabAddRequested,this),e}_createHandle(){return this._renderer.createHandle()}_onTabMoved(){f.postMessage(this,fe.LayoutModified)}_onCurrentChanged(e,t){let{previousTitle:n,currentTitle:i}=t;n&&n.owner.hide(),i&&i.owner.show(),(d.IS_EDGE||d.IS_IE)&&f.flush(),f.postMessage(this,fe.LayoutModified)}_onTabAddRequested(e){this._addRequested.emit(e)}_onTabActivateRequested(e,t){t.title.owner.activate()}_onTabCloseRequested(e,t){t.title.owner.close()}_onTabDetachRequested(e,t){if(this._drag)return;e.releaseMouse();let{title:n,tab:i,clientX:r,clientY:s,offset:o}=t,a=new g.MimeData;a.setData("application/vnd.lumino.widget-factory",(()=>n.owner));let l=i.cloneNode(!0);o&&(l.style.top=`-${o.y}px`,l.style.left=`-${o.x}px`),this._drag=new D.Drag({document:this._document,mimeData:a,dragImage:l,proposedAction:"move",supportedActions:"move",source:this}),i.classList.add("lm-mod-hidden"),this._drag.start(r,s).then((()=>{this._drag=null,i.classList.remove("lm-mod-hidden")}))}}!function(e){e.Overlay=class{constructor(){this._timer=-1,this._hidden=!0,this.node=document.createElement("div"),this.node.classList.add("lm-DockPanel-overlay"),this.node.classList.add("lm-mod-hidden"),this.node.style.position="absolute",this.node.style.contain="strict"}show(e){let t=this.node.style;t.top=`${e.top}px`,t.left=`${e.left}px`,t.right=`${e.right}px`,t.bottom=`${e.bottom}px`,clearTimeout(this._timer),this._timer=-1,this._hidden&&(this._hidden=!1,this.node.classList.remove("lm-mod-hidden"))}hide(e){if(!this._hidden)return e<=0?(clearTimeout(this._timer),this._timer=-1,this._hidden=!0,void this.node.classList.add("lm-mod-hidden")):void(-1===this._timer&&(this._timer=window.setTimeout((()=>{this._timer=-1,this._hidden=!0,this.node.classList.add("lm-mod-hidden")}),e)))}};class t{createTabBar(e){let t=new ce({document:e});return t.addClass("lm-DockPanel-tabBar"),t}createHandle(){let e=document.createElement("div");return e.className="lm-DockPanel-handle",e}}e.Renderer=t,e.defaultRenderer=new t}(we||(we={})),function(e){e.GOLDEN_RATIO=.618,e.DEFAULT_EDGES={top:12,right:40,bottom:40,left:40},e.LayoutModified=new b("layout-modified"),e.isGeneratedTabBarProperty=new C.AttachedProperty({name:"isGeneratedTabBar",create:()=>!1}),e.createSingleDocumentConfig=function(e){if(e.isEmpty)return{main:null};let t=Array.from(e.widgets()),n=e.selectedWidgets().next().value,i=n?t.indexOf(n):-1;return{main:{type:"tab-area",widgets:t,currentIndex:i}}},e.findDropTarget=function(e,t,n,i){if(!u.hitTest(e.node,t,n))return{zone:"invalid",target:null};let r=e.layout;if(r.isEmpty)return{zone:"root-all",target:null};if("multiple-document"===e.mode){let r=e.node.getBoundingClientRect(),s=t-r.left+1,o=n-r.top+1,a=r.right-t,l=r.bottom-n;switch(Math.min(o,a,l,s)){case o:if(oh&&l>h&&a>p&&d>p)return{zone:"widget-all",target:s};switch(o/=h,a/=p,l/=h,d/=p,Math.min(o,a,l,d)){case o:c="widget-left";break;case a:c="widget-top";break;case l:c="widget-right";break;case d:c="widget-bottom";break;default:throw"unreachable"}return{zone:c,target:s}},e.getDropRef=function(e){return 0===e.titles.length?null:e.currentTitle?e.currentTitle.owner:e.titles[e.titles.length-1].owner}}(fe||(fe={}));class _e{constructor(){this._counter=0,this._widgets=[],this._activeWidget=null,this._currentWidget=null,this._numbers=new Map,this._nodes=new Map,this._activeChanged=new x.Signal(this),this._currentChanged=new x.Signal(this)}dispose(){if(!(this._counter<0)){this._counter=-1,x.Signal.clearData(this);for(const e of this._widgets)e.node.removeEventListener("focus",this,!0),e.node.removeEventListener("blur",this,!0);this._activeWidget=null,this._currentWidget=null,this._nodes.clear(),this._numbers.clear(),this._widgets.length=0}}get currentChanged(){return this._currentChanged}get activeChanged(){return this._activeChanged}get isDisposed(){return this._counter<0}get currentWidget(){return this._currentWidget}get activeWidget(){return this._activeWidget}get widgets(){return this._widgets}focusNumber(e){let t=this._numbers.get(e);return void 0===t?-1:t}has(e){return this._numbers.has(e)}add(e){if(this._numbers.has(e))return;let t=e.node.contains(document.activeElement),n=t?this._counter++:-1;this._widgets.push(e),this._numbers.set(e,n),this._nodes.set(e.node,e),e.node.addEventListener("focus",this,!0),e.node.addEventListener("blur",this,!0),e.disposed.connect(this._onWidgetDisposed,this),t&&this._setWidgets(e,e)}remove(e){if(!this._numbers.has(e))return;if(e.disposed.disconnect(this._onWidgetDisposed,this),e.node.removeEventListener("focus",this,!0),e.node.removeEventListener("blur",this,!0),i.removeFirstOf(this._widgets,e),this._nodes.delete(e.node),this._numbers.delete(e),this._currentWidget!==e)return;let t=function(e,t){let n;for(const i of e)void 0!==n?t(i,n)>0&&(n=i):n=i;return n}(this._widgets.filter((e=>-1!==this._numbers.get(e))),((e,t)=>this._numbers.get(e)-this._numbers.get(t)))||null;this._setWidgets(t,null)}handleEvent(e){switch(e.type){case"focus":this._evtFocus(e);break;case"blur":this._evtBlur(e)}}_setWidgets(e,t){let n=this._currentWidget;this._currentWidget=e;let i=this._activeWidget;this._activeWidget=t,n!==e&&this._currentChanged.emit({oldValue:n,newValue:e}),i!==t&&this._activeChanged.emit({oldValue:i,newValue:t})}_evtFocus(e){let t=this._nodes.get(e.currentTarget);t!==this._currentWidget&&this._numbers.set(t,this._counter++),this._setWidgets(t,t)}_evtBlur(e){let t=this._nodes.get(e.currentTarget),n=e.relatedTarget;n&&(t.node.contains(n)||a(this._widgets,(e=>e.node.contains(n))))||this._setWidgets(this._currentWidget,null)}_onWidgetDisposed(e){this.remove(e)}}class Ee extends U{constructor(e={}){super(e),this._dirty=!1,this._rowSpacing=4,this._columnSpacing=4,this._items=[],this._rowStarts=[],this._columnStarts=[],this._rowSizers=[new N],this._columnSizers=[new N],this._box=null,void 0!==e.rowCount&&ge.reallocSizers(this._rowSizers,e.rowCount),void 0!==e.columnCount&&ge.reallocSizers(this._columnSizers,e.columnCount),void 0!==e.rowSpacing&&(this._rowSpacing=ge.clampValue(e.rowSpacing)),void 0!==e.columnSpacing&&(this._columnSpacing=ge.clampValue(e.columnSpacing))}dispose(){for(const e of this._items){let t=e.widget;e.dispose(),t.dispose()}this._box=null,this._items.length=0,this._rowStarts.length=0,this._rowSizers.length=0,this._columnStarts.length=0,this._columnSizers.length=0,super.dispose()}get rowCount(){return this._rowSizers.length}set rowCount(e){e!==this.rowCount&&(ge.reallocSizers(this._rowSizers,e),this.parent&&this.parent.fit())}get columnCount(){return this._columnSizers.length}set columnCount(e){e!==this.columnCount&&(ge.reallocSizers(this._columnSizers,e),this.parent&&this.parent.fit())}get rowSpacing(){return this._rowSpacing}set rowSpacing(e){e=ge.clampValue(e),this._rowSpacing!==e&&(this._rowSpacing=e,this.parent&&this.parent.fit())}get columnSpacing(){return this._columnSpacing}set columnSpacing(e){e=ge.clampValue(e),this._columnSpacing!==e&&(this._columnSpacing=e,this.parent&&this.parent.fit())}rowStretch(e){let t=this._rowSizers[e];return t?t.stretch:-1}setRowStretch(e,t){let n=this._rowSizers[e];n&&(t=ge.clampValue(t),n.stretch!==t&&(n.stretch=t,this.parent&&this.parent.update()))}columnStretch(e){let t=this._columnSizers[e];return t?t.stretch:-1}setColumnStretch(e,t){let n=this._columnSizers[e];n&&(t=ge.clampValue(t),n.stretch!==t&&(n.stretch=t,this.parent&&this.parent.update()))}*[Symbol.iterator](){for(const e of this._items)yield e.widget}addWidget(e){-1===i.findFirstIndex(this._items,(t=>t.widget===e))&&(this._items.push(new H(e)),this.parent&&this.attachWidget(e))}removeWidget(e){let t=i.findFirstIndex(this._items,(t=>t.widget===e));if(-1===t)return;let n=i.removeAt(this._items,t);this.parent&&this.detachWidget(e),n.dispose()}init(){super.init();for(const e of this)this.attachWidget(e)}attachWidget(e){this.parent.isAttached&&f.sendMessage(e,z.Msg.BeforeAttach),this.parent.node.appendChild(e.node),this.parent.isAttached&&f.sendMessage(e,z.Msg.AfterAttach),this.parent.fit()}detachWidget(e){this.parent.isAttached&&f.sendMessage(e,z.Msg.BeforeDetach),this.parent.node.removeChild(e.node),this.parent.isAttached&&f.sendMessage(e,z.Msg.AfterDetach),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_fit(){for(let e=0,t=this.rowCount;e!e.isHidden));for(let t=0,n=e.length;t({row:0,column:0,rowSpan:1,columnSpan:1}),changed:function(e){e.parent&&e.parent.layout instanceof Ee&&e.parent.fit()}}),e.normalizeConfig=function(e){return{row:Math.max(0,Math.floor(e.row||0)),column:Math.max(0,Math.floor(e.column||0)),rowSpan:Math.max(1,Math.floor(e.rowSpan||0)),columnSpan:Math.max(1,Math.floor(e.columnSpan||0))}},e.clampValue=function(e){return Math.max(0,Math.floor(e))},e.rowSpanCmp=function(t,n){let i=e.cellConfigProperty.get(t.widget),r=e.cellConfigProperty.get(n.widget);return i.rowSpan-r.rowSpan},e.columnSpanCmp=function(t,n){let i=e.cellConfigProperty.get(t.widget),r=e.cellConfigProperty.get(n.widget);return i.columnSpan-r.columnSpan},e.reallocSizers=function(e,t){for(t=Math.max(1,Math.floor(t));e.lengtht&&(e.length=t)},e.distributeMin=function(e,t,n,i){if(n=i)return;let s=(i-r)/(n-t+1);for(let i=t;i<=n;++i)e[i].minSize+=s}}(ge||(ge={}));class Ce extends z{constructor(e={}){super({node:me.createNode()}),this._activeIndex=-1,this._tabFocusIndex=0,this._menus=[],this._childMenu=null,this._overflowMenu=null,this._menuItemSizes=[],this._overflowIndex=-1,this.addClass("lm-MenuBar"),this.setFlag(z.Flag.DisallowLayout),this.renderer=e.renderer||Ce.defaultRenderer,this._forceItemsPosition=e.forceItemsPosition||{forceX:!0,forceY:!0},this._overflowMenuOptions=e.overflowMenuOptions||{isVisible:!0}}dispose(){this._closeChildMenu(),this._menus.length=0,super.dispose()}get childMenu(){return this._childMenu}get overflowIndex(){return this._overflowIndex}get overflowMenu(){return this._overflowMenu}get contentNode(){return this.node.getElementsByClassName("lm-MenuBar-content")[0]}get activeMenu(){return this._menus[this._activeIndex]||null}set activeMenu(e){this.activeIndex=e?this._menus.indexOf(e):-1}get activeIndex(){return this._activeIndex}set activeIndex(e){(e<0||e>=this._menus.length)&&(e=-1),e>-1&&0===this._menus[e].items.length&&(e=-1),this._activeIndex!==e&&(this._activeIndex=e,this.update())}get menus(){return this._menus}openActiveMenu(){-1!==this._activeIndex&&(this._openChildMenu(),this._childMenu&&(this._childMenu.activeIndex=-1,this._childMenu.activateNextItem()))}addMenu(e,t=!0){this.insertMenu(this._menus.length,e,t)}insertMenu(e,t,n=!0){this._closeChildMenu();let r=this._menus.indexOf(t),s=Math.max(0,Math.min(e,this._menus.length));if(-1===r)return i.insert(this._menus,s,t),t.addClass("lm-MenuBar-menu"),t.aboutToClose.connect(this._onMenuAboutToClose,this),t.menuRequested.connect(this._onMenuMenuRequested,this),t.title.changed.connect(this._onTitleChanged,this),void(n&&this.update());s===this._menus.length&&s--,r!==s&&(i.move(this._menus,r,s),n&&this.update())}removeMenu(e,t=!0){this.removeMenuAt(this._menus.indexOf(e),t)}removeMenuAt(e,t=!0){this._closeChildMenu();let n=i.removeAt(this._menus,e);n&&(n.aboutToClose.disconnect(this._onMenuAboutToClose,this),n.menuRequested.disconnect(this._onMenuMenuRequested,this),n.title.changed.disconnect(this._onTitleChanged,this),n.removeClass("lm-MenuBar-menu"),t&&this.update())}clearMenus(){if(0!==this._menus.length){this._closeChildMenu();for(let e of this._menus)e.aboutToClose.disconnect(this._onMenuAboutToClose,this),e.menuRequested.disconnect(this._onMenuMenuRequested,this),e.title.changed.disconnect(this._onTitleChanged,this),e.removeClass("lm-MenuBar-menu");this._menus.length=0,this.update()}}handleEvent(e){switch(e.type){case"keydown":this._evtKeyDown(e);break;case"mousedown":this._evtMouseDown(e);break;case"mousemove":this._evtMouseMove(e);break;case"focusout":this._evtFocusOut(e);break;case"contextmenu":e.preventDefault(),e.stopPropagation()}}onBeforeAttach(e){this.node.addEventListener("keydown",this),this.node.addEventListener("mousedown",this),this.node.addEventListener("mousemove",this),this.node.addEventListener("focusout",this),this.node.addEventListener("contextmenu",this)}onAfterDetach(e){this.node.removeEventListener("keydown",this),this.node.removeEventListener("mousedown",this),this.node.removeEventListener("mousemove",this),this.node.removeEventListener("focusout",this),this.node.removeEventListener("contextmenu",this),this._closeChildMenu()}onActivateRequest(e){this.isAttached&&this._focusItemAt(0)}onResize(e){this.update(),super.onResize(e)}onUpdateRequest(e){var t;let n=this._menus,i=this.renderer,r=this._activeIndex,s=this._tabFocusIndex>=0&&this._tabFocusIndex-1?this._overflowIndex:n.length,a=0,l=!1;o=null!==this._overflowMenu?o-1:o;let u=new Array(o);for(let e=0;e{this._tabFocusIndex=e,this.activeIndex=e}}),a+=this._menuItemSizes[e],n[e].title.label===this._overflowMenuOptions.title&&(l=!0,o--);if(this._overflowMenuOptions.isVisible)if(this._overflowIndex>-1&&!l){if(null===this._overflowMenu){const e=null!==(t=this._overflowMenuOptions.title)&&void 0!==t?t:"...";this._overflowMenu=new ue({commands:new D.CommandRegistry}),this._overflowMenu.title.label=e,this._overflowMenu.title.mnemonic=0,this.addMenu(this._overflowMenu,!1)}for(let e=n.length-2;e>=o;e--){const t=this.menus[e];t.title.mnemonic=0,this._overflowMenu.insertItem(0,{type:"submenu",submenu:t}),this.removeMenu(t,!1)}u[o]=i.renderItem({title:this._overflowMenu.title,active:o===r&&0!==n[o].items.length,tabbable:o===s,disabled:0===n[o].items.length,onfocus:()=>{this._tabFocusIndex=o,this.activeIndex=o}}),o++}else if(null!==this._overflowMenu){let e=this._overflowMenu.items,t=this.node.offsetWidth,r=this._overflowMenu.items.length;for(let l=0;lthis._menuItemSizes[r]){let t=e[0].submenu;this._overflowMenu.removeItemAt(0),this.insertMenu(o,t,!1),u[o]=i.renderItem({title:t.title,active:!1,tabbable:o===s,disabled:0===n[o].items.length,onfocus:()=>{this._tabFocusIndex=o,this.activeIndex=o}}),o++}}0===this._overflowMenu.items.length&&(this.removeMenu(this._overflowMenu,!1),u.pop(),this._overflowMenu=null,this._overflowIndex=-1)}_.render(u,this.contentNode),this._updateOverflowIndex()}_updateOverflowIndex(){if(!this._overflowMenuOptions.isVisible)return;const e=this.contentNode.childNodes;let t=this.node.offsetWidth,n=0,i=-1,r=e.length;if(0==this._menuItemSizes.length)for(let s=0;st&&-1===i&&(i=s)}else for(let e=0;et){i=e;break}this._overflowIndex=i}_evtKeyDown(e){let t=e.keyCode;if(9===t)return void(this.activeIndex=-1);if(e.preventDefault(),e.stopPropagation(),13===t||32===t||38===t||40===t){if(this.activeIndex=this._tabFocusIndex,this.activeIndex!==this._tabFocusIndex)return;return void this.openActiveMenu()}if(27===t)return this._closeChildMenu(),void this._focusItemAt(this.activeIndex);if(37===t||39===t){let e=37===t?-1:1,n=this._tabFocusIndex+e,i=this._menus.length;for(let t=0;tu.hitTest(t,e.clientX,e.clientY)));if(-1!==t){if(0===e.button)if(this._childMenu)this._closeChildMenu(),this.activeIndex=t;else{e.preventDefault();const n=this._positionForMenu(t);ue.saveWindowData(),this.activeIndex=t,this._openChildMenu(n)}}else this._closeChildMenu()}_evtMouseMove(e){let t=i.findFirstIndex(this.contentNode.children,(t=>u.hitTest(t,e.clientX,e.clientY)));if(t===this._activeIndex)return;if(-1===t&&this._childMenu)return;const n=t>=0&&this._childMenu?this._positionForMenu(t):null;ue.saveWindowData(),this.activeIndex=t,n&&this._openChildMenu(n)}_positionForMenu(e){let t=this.contentNode.children[e],{left:n,bottom:i}=t.getBoundingClientRect();return{top:i,left:n}}_evtFocusOut(e){this._childMenu||this.node.contains(e.relatedTarget)||(this.activeIndex=-1)}_focusItemAt(e){const t=this.contentNode.childNodes[e];t&&t.focus()}_openChildMenu(e={}){let t=this.activeMenu;if(!t)return void this._closeChildMenu();let n=this._childMenu;if(n===t)return;this._childMenu=t,n?n.close():document.addEventListener("mousedown",this,!0),this._tabFocusIndex=this.activeIndex,f.sendMessage(this,z.Msg.UpdateRequest);let{left:i,top:r}=e;void 0!==i&&void 0!==r||({left:i,top:r}=this._positionForMenu(this._activeIndex)),n||this.addClass("lm-mod-active"),t.items.length>0&&t.open(i,r,this._forceItemsPosition)}_closeChildMenu(){if(!this._childMenu)return;this.removeClass("lm-mod-active"),document.removeEventListener("mousedown",this,!0);let e=this._childMenu;this._childMenu=null,e.close(),this.activeIndex=-1}_onMenuAboutToClose(e){e===this._childMenu&&(this.removeClass("lm-mod-active"),document.removeEventListener("mousedown",this,!0),this._childMenu=null,this.activeIndex=-1)}_onMenuMenuRequested(e,t){if(e!==this._childMenu)return;let n=this._activeIndex,i=this._menus.length;switch(t){case"next":this.activeIndex=n===i-1?0:n+1;break;case"previous":this.activeIndex=0===n?i-1:n-1}this.openActiveMenu()}_onTitleChanged(){this.update()}}!function(e){class t{renderItem(e){let t=this.createItemClass(e),n=this.createItemDataset(e),i=this.createItemARIA(e);return B.li({className:t,dataset:n,...e.disabled?{}:{tabindex:e.tabbable?"0":"-1"},onfocus:e.onfocus,...i},this.renderIcon(e),this.renderLabel(e))}renderIcon(e){let t=this.createIconClass(e);return B.div({className:t},e.title.icon,e.title.iconLabel)}renderLabel(e){let t=this.formatLabel(e);return B.div({className:"lm-MenuBar-itemLabel"},t)}createItemClass(e){let t="lm-MenuBar-item";return e.title.className&&(t+=` ${e.title.className}`),e.active&&!e.disabled&&(t+=" lm-mod-active"),t}createItemDataset(e){return e.title.dataset}createItemARIA(e){return{role:"menuitem","aria-haspopup":"true","aria-disabled":e.disabled?"true":"false"}}createIconClass(e){let t="lm-MenuBar-itemIcon",n=e.title.iconClass;return n?`${t} ${n}`:t}formatLabel(e){let{label:t,mnemonic:n}=e.title;if(n<0||n>=t.length)return t;let i=t.slice(0,n),r=t.slice(n+1),s=t[n];return[i,B.span({className:"lm-MenuBar-itemMnemonic"},s),r]}}e.Renderer=t,e.defaultRenderer=new t}(Ce||(Ce={})),function(e){e.createNode=function(){let e=document.createElement("div"),t=document.createElement("ul");return t.className="lm-MenuBar-content",e.appendChild(t),t.setAttribute("role","menubar"),e},e.findMnemonic=function(e,t,n){let i=-1,r=-1,s=!1,o=t.toUpperCase();for(let t=0,a=e.length;t=0&&d1&&this.widgets.forEach((e=>{e.hiddenMode=this._hiddenMode})))}dispose(){for(const e of this._items)e.dispose();this._box=null,this._items.length=0,super.dispose()}attachWidget(e,t){this._hiddenMode===z.HiddenMode.Scale&&this._items.length>0?(1===this._items.length&&(this.widgets[0].hiddenMode=z.HiddenMode.Scale),t.hiddenMode=z.HiddenMode.Scale):t.hiddenMode=z.HiddenMode.Display,i.insert(this._items,e,new H(t)),this.parent.isAttached&&f.sendMessage(t,z.Msg.BeforeAttach),this.parent.node.appendChild(t.node),this.parent.isAttached&&f.sendMessage(t,z.Msg.AfterAttach),this.parent.fit()}moveWidget(e,t,n){i.move(this._items,e,t),this.parent.update()}detachWidget(e,t){let n=i.removeAt(this._items,e);this.parent.isAttached&&f.sendMessage(t,z.Msg.BeforeDetach),this.parent.node.removeChild(t.node),this.parent.isAttached&&f.sendMessage(t,z.Msg.AfterDetach),n.widget.node.style.zIndex="",this._hiddenMode===z.HiddenMode.Scale&&(t.hiddenMode=z.HiddenMode.Display,1===this._items.length&&(this._items[0].widget.hiddenMode=z.HiddenMode.Display)),n.dispose(),this.parent.fit()}onBeforeShow(e){super.onBeforeShow(e),this.parent.update()}onBeforeAttach(e){super.onBeforeAttach(e),this.parent.fit()}onChildShown(e){this.parent.fit()}onChildHidden(e){this.parent.fit()}onResize(e){this.parent.isVisible&&this._update(e.width,e.height)}onUpdateRequest(e){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(e){this.parent.isAttached&&this._fit()}_fit(){let e=0,t=0;for(let n=0,i=this._items.length;n{var i,r,s;s="object"==typeof self&&self.self===self&&self||"object"==typeof n.g&&n.g.global===n.g&&n.g,i=[n(2562),n(4651),t],r=function(e,t,n){s.Backbone=function(e,t,n,i){var r=e.Backbone,s=Array.prototype.slice;t.VERSION="1.4.0",t.$=i,t.noConflict=function(){return e.Backbone=r,this},t.emulateHTTP=!1,t.emulateJSON=!1;var o,a=t.Events={},l=/\s+/,u=function(e,t,i,r,s){var o,a=0;if(i&&"object"==typeof i){void 0!==r&&"context"in s&&void 0===s.context&&(s.context=r);for(o=n.keys(i);athis.length&&(r=this.length),r<0&&(r+=this.length+1);var s,o,a=[],l=[],u=[],d=[],c={},h=t.add,p=t.merge,f=t.remove,g=!1,m=this.comparator&&null==r&&!1!==t.sort,v=n.isString(this.comparator)?this.comparator:null;for(o=0;o7),this._useHashChange=this._wantsHashChange&&this._hasHashChange,this._wantsPushState=!!this.options.pushState,this._hasPushState=!(!this.history||!this.history.pushState),this._usePushState=this._wantsPushState&&this._hasPushState,this.fragment=this.getFragment(),this.root=("/"+this.root+"/").replace(U,"/"),this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var t=this.root.slice(0,-1)||"/";return this.location.replace(t+"#"+this.getPath()),!0}this._hasPushState&&this.atRoot()&&this.navigate(this.getHash(),{replace:!0})}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe"),this.iframe.src="javascript:0",this.iframe.style.display="none",this.iframe.tabIndex=-1;var i=document.body,r=i.insertBefore(this.iframe,i.firstChild).contentWindow;r.document.open(),r.document.close(),r.location.hash="#"+this.fragment}var s=window.addEventListener||function(e,t){return attachEvent("on"+e,t)};if(this._usePushState?s("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe?s("hashchange",this.checkUrl,!1):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),!this.options.silent)return this.loadUrl()},stop:function(){var e=window.removeEventListener||function(e,t){return detachEvent("on"+e,t)};this._usePushState?e("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe&&e("hashchange",this.checkUrl,!1),this.iframe&&(document.body.removeChild(this.iframe),this.iframe=null),this._checkUrlInterval&&clearInterval(this._checkUrlInterval),F.started=!1},route:function(e,t){this.handlers.unshift({route:e,callback:t})},checkUrl:function(e){var t=this.getFragment();if(t===this.fragment&&this.iframe&&(t=this.getHash(this.iframe.contentWindow)),t===this.fragment)return!1;this.iframe&&this.navigate(t),this.loadUrl()},loadUrl:function(e){return!!this.matchRoot()&&(e=this.fragment=this.getFragment(e),n.some(this.handlers,(function(t){if(t.route.test(e))return t.callback(e),!0})))},navigate:function(e,t){if(!F.started)return!1;t&&!0!==t||(t={trigger:!!t}),e=this.getFragment(e||"");var n=this.root;""!==e&&"?"!==e.charAt(0)||(n=n.slice(0,-1)||"/");var i=n+e;e=e.replace(H,"");var r=this.decodeFragment(e);if(this.fragment!==r){if(this.fragment=r,this._usePushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,i);else{if(!this._wantsHashChange)return this.location.assign(i);if(this._updateHash(this.location,e,t.replace),this.iframe&&e!==this.getHash(this.iframe.contentWindow)){var s=this.iframe.contentWindow;t.replace||(s.document.open(),s.document.close()),this._updateHash(s.location,e,t.replace)}}return t.trigger?this.loadUrl(e):void 0}},_updateHash:function(e,t,n){if(n){var i=e.href.replace(/(javascript:|#).*$/,"");e.replace(i+"#"+t)}else e.hash="#"+t}}),t.history=new F;v.extend=b.extend=I.extend=S.extend=F.extend=function(e,t){var i,r=this;return i=e&&n.has(e,"constructor")?e.constructor:function(){return r.apply(this,arguments)},n.extend(i,r,t),i.prototype=n.create(r.prototype,e),i.prototype.constructor=i,i.__super__=r.prototype,i};var W=function(){throw new Error('A "url" property or function must be specified')},q=function(e,t){var n=t.error;t.error=function(i){n&&n.call(t.context,e,i,t),e.trigger("error",e,i,t)}};return t}(s,n,e,t)}.apply(t,i),void 0===r||(e.exports=r)},7991:(e,t)=>{"use strict";t.bg=function(e){var t,n,s=function(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}(e),o=s[0],a=s[1],l=new r(function(e,t,n){return 3*(t+n)/4-n}(0,o,a)),u=0,d=a>0?o-4:o;for(n=0;n>16&255,l[u++]=t>>8&255,l[u++]=255&t;return 2===a&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,l[u++]=255&t),1===a&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,l[u++]=t>>8&255,l[u++]=255&t),l},t.iI=function(e){for(var t,i=e.length,r=i%3,s=[],o=16383,l=0,u=i-r;lu?u:l+o));return 1===r?(t=e[i-1],s.push(n[t>>2]+n[t<<4&63]+"==")):2===r&&(t=(e[i-2]<<8)+e[i-1],s.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),s.join("")};for(var n=[],i=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0;o<64;++o)n[o]=s[o],i[s.charCodeAt(o)]=o;function a(e,t,i){for(var r,s,o=[],a=t;a>18&63]+n[s>>12&63]+n[s>>6&63]+n[63&s]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},1050:(e,t,n)=>{!function(e){"use strict";function t(t,n){clearTimeout(n.timeout),e.off(window,"mouseup",n.hurry),e.off(window,"keyup",n.hurry)}e.defineOption("autoRefresh",!1,(function(n,i){n.state.autoRefresh&&(t(0,n.state.autoRefresh),n.state.autoRefresh=null),i&&0==n.display.wrapper.offsetHeight&&function(n,i){function r(){n.display.wrapper.offsetHeight?(t(0,i),n.display.lastWrapHeight!=n.display.wrapper.clientHeight&&n.refresh()):i.timeout=setTimeout(r,i.delay)}i.timeout=setTimeout(r,i.delay),i.hurry=function(){clearTimeout(i.timeout),i.timeout=setTimeout(r,50)},e.on(window,"mouseup",i.hurry),e.on(window,"keyup",i.hurry)}(n,n.state.autoRefresh={delay:i.delay||250})}))}(n(1448))},7122:(e,t,n)=>{!function(e){"use strict";var t="CodeMirror-hint-active";function n(e,t){if(this.cm=e,this.options=t,this.widget=null,this.debounce=0,this.tick=0,this.startPos=this.cm.getCursor("start"),this.startLen=this.cm.getLine(this.startPos.line).length-this.cm.getSelection().length,this.options.updateOnCursorActivity){var n=this;e.on("cursorActivity",this.activityFunc=function(){n.cursorActivity()})}}e.showHint=function(e,t,n){if(!t)return e.showHint(n);n&&n.async&&(t.async=!0);var i={hint:t};if(n)for(var r in n)i[r]=n[r];return e.showHint(i)},e.defineExtension("showHint",(function(t){t=function(e,t,n){var i=e.options.hintOptions,r={};for(var s in u)r[s]=u[s];if(i)for(var s in i)void 0!==i[s]&&(r[s]=i[s]);if(n)for(var s in n)void 0!==n[s]&&(r[s]=n[s]);return r.hint.resolve&&(r.hint=r.hint.resolve(e,t)),r}(this,this.getCursor("start"),t);var i=this.listSelections();if(!(i.length>1)){if(this.somethingSelected()){if(!t.hint.supportsSelection)return;for(var r=0;rd.clientHeight+1;if(setTimeout((function(){B=a.getScrollInfo()})),k.bottom-T>0){var j=k.bottom-k.top;if(b.top-(b.bottom-k.top)-j>0)d.style.top=(y=b.top-j-E)+"px",w=!1;else if(j>T){d.style.height=T-5+"px",d.style.top=(y=b.bottom-k.top-E)+"px";var O=a.getCursor();i.from.ch!=O.ch&&(b=a.cursorCoords(O),d.style.left=(A=b.left-_)+"px",k=d.getBoundingClientRect())}}var I,P=k.right-S;if(M&&(P+=a.display.nativeBarWidth),P>0&&(k.right-k.left>S&&(d.style.width=S-5+"px",P-=k.right-k.left-S),d.style.left=(A=b.left-P-_)+"px"),M)for(var R=d.firstChild;R;R=R.nextSibling)R.style.paddingRight=a.display.nativeBarWidth+"px";a.addKeyMap(this.keyMap=function(e,t){var n={Up:function(){t.moveFocus(-1)},Down:function(){t.moveFocus(1)},PageUp:function(){t.moveFocus(1-t.menuSize(),!0)},PageDown:function(){t.moveFocus(t.menuSize()-1,!0)},Home:function(){t.setFocus(0)},End:function(){t.setFocus(t.length-1)},Enter:t.pick,Tab:t.pick,Esc:t.close};/Mac/.test(navigator.platform)&&(n["Ctrl-P"]=function(){t.moveFocus(-1)},n["Ctrl-N"]=function(){t.moveFocus(1)});var i=e.options.customKeys,r=i?{}:n;function s(e,i){var s;s="string"!=typeof i?function(e){return i(e,t)}:n.hasOwnProperty(i)?n[i]:i,r[e]=s}if(i)for(var o in i)i.hasOwnProperty(o)&&s(o,i[o]);var a=e.options.extraKeys;if(a)for(var o in a)a.hasOwnProperty(o)&&s(o,a[o]);return r}(n,{moveFocus:function(e,t){r.changeActive(r.selectedHint+e,t)},setFocus:function(e){r.changeActive(e)},menuSize:function(){return r.screenAmount()},length:h.length,close:function(){n.close()},pick:function(){r.pick()},data:i})),n.options.closeOnUnfocus&&(a.on("blur",this.onBlur=function(){I=setTimeout((function(){n.close()}),100)}),a.on("focus",this.onFocus=function(){clearTimeout(I)})),a.on("scroll",this.onScroll=function(){var e=a.getScrollInfo(),t=a.getWrapperElement().getBoundingClientRect();B||(B=a.getScrollInfo());var i=y+B.top-e.top,r=i-(u.pageYOffset||(l.documentElement||l.body).scrollTop);if(w||(r+=d.offsetHeight),r<=t.top||r>=t.bottom)return n.close();d.style.top=i+"px",d.style.left=A+B.left-e.left+"px"}),e.on(d,"dblclick",(function(e){var t=o(d,e.target||e.srcElement);t&&null!=t.hintId&&(r.changeActive(t.hintId),r.pick())})),e.on(d,"click",(function(e){var t=o(d,e.target||e.srcElement);t&&null!=t.hintId&&(r.changeActive(t.hintId),n.options.completeOnSingleClick&&r.pick())})),e.on(d,"mousedown",(function(){setTimeout((function(){a.focus()}),20)}));var L=this.getSelectedHintRange();return 0===L.from&&0===L.to||this.scrollToActive(),e.signal(i,"select",h[this.selectedHint],d.childNodes[this.selectedHint]),!0}function l(e,t,n,i){if(e.async)e(t,i,n);else{var r=e(t,n);r&&r.then?r.then(i):i(r)}}n.prototype={close:function(){this.active()&&(this.cm.state.completionActive=null,this.tick=null,this.options.updateOnCursorActivity&&this.cm.off("cursorActivity",this.activityFunc),this.widget&&this.data&&e.signal(this.data,"close"),this.widget&&this.widget.close(),e.signal(this.cm,"endCompletion",this.cm))},active:function(){return this.cm.state.completionActive==this},pick:function(t,n){var i=t.list[n],r=this;this.cm.operation((function(){i.hint?i.hint(r.cm,t,i):r.cm.replaceRange(s(i),i.from||t.from,i.to||t.to,"complete"),e.signal(t,"pick",i),r.cm.scrollIntoView()})),this.options.closeOnPick&&this.close()},cursorActivity:function(){this.debounce&&(r(this.debounce),this.debounce=0);var e=this.startPos;this.data&&(e=this.data.from);var t=this.cm.getCursor(),n=this.cm.getLine(t.line);if(t.line!=this.startPos.line||n.length-t.ch!=this.startLen-this.startPos.ch||t.ch=this.data.list.length?n=i?this.data.list.length-1:0:n<0&&(n=i?0:this.data.list.length-1),this.selectedHint!=n){var r=this.hints.childNodes[this.selectedHint];r&&(r.className=r.className.replace(" "+t,"")),(r=this.hints.childNodes[this.selectedHint=n]).className+=" "+t,this.scrollToActive(),e.signal(this.data,"select",this.data.list[this.selectedHint],r)}},scrollToActive:function(){var e=this.getSelectedHintRange(),t=this.hints.childNodes[e.from],n=this.hints.childNodes[e.to],i=this.hints.firstChild;t.offsetTopthis.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=n.offsetTop+n.offsetHeight-this.hints.clientHeight+i.offsetTop)},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1},getSelectedHintRange:function(){var e=this.completion.options.scrollMargin||0;return{from:Math.max(0,this.selectedHint-e),to:Math.min(this.data.list.length-1,this.selectedHint+e)}}},e.registerHelper("hint","auto",{resolve:function(t,n){var i,r=t.getHelpers(n,"hint");if(r.length){var s=function(e,t,n){var i=function(e,t){if(!e.somethingSelected())return t;for(var n=[],i=0;i0?t(e):r(s+1)}))}(0)};return s.async=!0,s.supportsSelection=!0,s}return(i=t.getHelper(t.getCursor(),"hintWords"))?function(t){return e.hint.fromList(t,{words:i})}:e.hint.anyword?function(t,n){return e.hint.anyword(t,n)}:function(){}}}),e.registerHelper("hint","fromList",(function(t,n){var i,r=t.getCursor(),s=t.getTokenAt(r),o=e.Pos(r.line,s.start),a=r;s.start,]/,closeOnPick:!0,closeOnUnfocus:!0,updateOnCursorActivity:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null,paddingForScrollbar:!0,moveOnOverlap:!0};e.defineOption("hintOptions",null)}(n(1448))},1448:function(e){e.exports=function(){"use strict";var e=navigator.userAgent,t=navigator.platform,n=/gecko\/\d/i.test(e),i=/MSIE \d/.test(e),r=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),s=/Edge\/(\d+)/.exec(e),o=i||r||s,a=o&&(i?document.documentMode||6:+(s||r)[1]),l=!s&&/WebKit\//.test(e),u=l&&/Qt\/\d+\.\d+/.test(e),d=!s&&/Chrome\//.test(e),c=/Opera\//.test(e),h=/Apple Computer/.test(navigator.vendor),p=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),f=/PhantomJS/.test(e),g=h&&(/Mobile\/\w+/.test(e)||navigator.maxTouchPoints>2),m=/Android/.test(e),v=g||m||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),b=g||/Mac/.test(t),A=/\bCrOS\b/.test(e),y=/win/i.test(t),w=c&&e.match(/Version\/(\d*\.\d*)/);w&&(w=Number(w[1])),w&&w>=15&&(c=!1,l=!0);var _=b&&(u||c&&(null==w||w<12.11)),E=n||o&&a>=9;function C(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var x,D=function(e,t){var n=e.className,i=C(t).exec(n);if(i){var r=n.slice(i.index+i[0].length);e.className=n.slice(0,i.index)+(r?i[1]+r:"")}};function S(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function T(e,t){return S(e).appendChild(t)}function B(e,t,n,i){var r=document.createElement(e);if(n&&(r.className=n),i&&(r.style.cssText=i),"string"==typeof t)r.appendChild(document.createTextNode(t));else if(t)for(var s=0;s=t)return o+(t-s);o+=a-s,o+=n-o%n,s=a+1}}g?P=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:o&&(P=function(e){try{e.select()}catch(e){}});var F=function(){this.id=null,this.f=null,this.time=0,this.handler=R(this.onTimeout,this)};function z(e,t){for(var n=0;n=t)return i+Math.min(o,t-r);if(r+=s-i,i=s+1,(r+=n-r%n)>=t)return i}}var G=[""];function K(e){for(;G.length<=e;)G.push(Y(G)+" ");return G[e]}function Y(e){return e[e.length-1]}function J(e,t){for(var n=[],i=0;i"€"&&(e.toUpperCase()!=e.toLowerCase()||Q.test(e))}function te(e,t){return t?!!(t.source.indexOf("\\w")>-1&&ee(e))||t.test(e):ee(e)}function ne(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ie=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function re(e){return e.charCodeAt(0)>=768&&ie.test(e)}function se(e,t,n){for(;(n<0?t>0:tn?-1:1;;){if(t==n)return t;var r=(t+n)/2,s=i<0?Math.ceil(r):Math.floor(r);if(s==t)return e(s)?t:n;e(s)?n=s:t=s+i}}var ae=null;function le(e,t,n){var i;ae=null;for(var r=0;rt)return r;s.to==t&&(s.from!=s.to&&"before"==n?i=r:ae=r),s.from==t&&(s.from!=s.to&&"before"!=n?i=r:ae=r)}return null!=i?i:ae}var ue=function(){var e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,t=/[stwN]/,n=/[LRr]/,i=/[Lb1n]/,r=/[1n]/;function s(e,t,n){this.level=e,this.from=t,this.to=n}return function(o,a){var l,u="ltr"==a?"L":"R";if(0==o.length||"ltr"==a&&!e.test(o))return!1;for(var d=o.length,c=[],h=0;h-1&&(i[t]=r.slice(0,s).concat(r.slice(s+1)))}}}function ge(e,t){var n=pe(e,t);if(n.length)for(var i=Array.prototype.slice.call(arguments,2),r=0;r0}function Ae(e){e.prototype.on=function(e,t){he(this,e,t)},e.prototype.off=function(e,t){fe(this,e,t)}}function ye(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function we(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function _e(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Ee(e){ye(e),we(e)}function Ce(e){return e.target||e.srcElement}function xe(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),b&&e.ctrlKey&&1==t&&(t=3),t}var De,Se,Te=function(){if(o&&a<9)return!1;var e=B("div");return"draggable"in e||"dragDrop"in e}();function Be(e){if(null==De){var t=B("span","​");T(e,B("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(De=t.offsetWidth<=1&&t.offsetHeight>2&&!(o&&a<8))}var n=De?B("span","​"):B("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function ke(e){if(null!=Se)return Se;var t=T(e,document.createTextNode("AخA")),n=x(t,0,1).getBoundingClientRect(),i=x(t,1,2).getBoundingClientRect();return S(e),!(!n||n.left==n.right)&&(Se=i.right-n.right<3)}var Me,je=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,n=[],i=e.length;t<=i;){var r=e.indexOf("\n",t);-1==r&&(r=e.length);var s=e.slice(t,"\r"==e.charAt(r-1)?r-1:r),o=s.indexOf("\r");-1!=o?(n.push(s.slice(0,o)),t+=o+1):(n.push(s),t=r+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Oe=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},Ie="oncopy"in(Me=B("div"))||(Me.setAttribute("oncopy","return;"),"function"==typeof Me.oncopy),Pe=null;var Re={},Le={};function Ne(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Re[e]=t}function Fe(e){if("string"==typeof e&&Le.hasOwnProperty(e))e=Le[e];else if(e&&"string"==typeof e.name&&Le.hasOwnProperty(e.name)){var t=Le[e.name];"string"==typeof t&&(t={name:t}),(e=Z(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Fe("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Fe("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function ze(e,t){t=Fe(t);var n=Re[t.name];if(!n)return ze(e,"text/plain");var i=n(e,t);if(Ue.hasOwnProperty(t.name)){var r=Ue[t.name];for(var s in r)r.hasOwnProperty(s)&&(i.hasOwnProperty(s)&&(i["_"+s]=i[s]),i[s]=r[s])}if(i.name=t.name,t.helperType&&(i.helperType=t.helperType),t.modeProps)for(var o in t.modeProps)i[o]=t.modeProps[o];return i}var Ue={};function He(e,t){L(t,Ue.hasOwnProperty(e)?Ue[e]:Ue[e]={})}function We(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var n={};for(var i in t){var r=t[i];r instanceof Array&&(r=r.concat([])),n[i]=r}return n}function qe(e,t){for(var n;e.innerMode&&(n=e.innerMode(t))&&n.mode!=e;)t=n.state,e=n.mode;return n||{mode:e,state:t}}function $e(e,t,n){return!e.startState||e.startState(t,n)}var Ve=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};function Ge(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var i=0;;++i){var r=n.children[i],s=r.chunkSize();if(t=e.first&&tn?tt(n,Ge(e,n).text.length):function(e,t){var n=e.ch;return null==n||n>t?tt(e.line,t):n<0?tt(e.line,0):e}(t,Ge(e,t.line).text.length)}function ut(e,t){for(var n=[],i=0;i=this.string.length},Ve.prototype.sol=function(){return this.pos==this.lineStart},Ve.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ve.prototype.next=function(){if(this.post},Ve.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ve.prototype.skipToEnd=function(){this.pos=this.string.length},Ve.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ve.prototype.backUp=function(e){this.pos-=e},Ve.prototype.column=function(){return this.lastColumnPos0?null:(i&&!1!==t&&(this.pos+=i[0].length),i)}var r=function(e){return n?e.toLowerCase():e};if(r(this.string.substr(this.pos,e.length))==r(e))return!1!==t&&(this.pos+=e.length),!0},Ve.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ve.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ve.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ve.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var dt=function(e,t){this.state=e,this.lookAhead=t},ct=function(e,t,n,i){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};function ht(e,t,n,i){var r=[e.state.modeGen],s={};wt(e,t.text,e.doc.mode,n,(function(e,t){return r.push(e,t)}),s,i);for(var o=n.state,a=function(i){n.baseTokens=r;var a=e.state.overlays[i],l=1,u=0;n.state=!0,wt(e,t.text,a.mode,n,(function(e,t){for(var n=l;ue&&r.splice(l,1,e,r[l+1],i),l+=2,u=Math.min(e,i)}if(t)if(a.opaque)r.splice(n,l-n,e,"overlay "+t),l=n+2;else for(;ne.options.maxHighlightLength&&We(e.doc.mode,i.state),s=ht(e,t,i);r&&(i.state=r),t.stateAfter=i.save(!r),t.styles=s.styles,s.classes?t.styleClasses=s.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function ft(e,t,n){var i=e.doc,r=e.display;if(!i.mode.startState)return new ct(i,!0,t);var s=function(e,t,n){for(var i,r,s=e.doc,o=n?-1:t-(e.doc.mode.innerMode?1e3:100),a=t;a>o;--a){if(a<=s.first)return s.first;var l=Ge(s,a-1),u=l.stateAfter;if(u&&(!n||a+(u instanceof dt?u.lookAhead:0)<=s.modeFrontier))return a;var d=N(l.text,null,e.options.tabSize);(null==r||i>d)&&(r=a-1,i=d)}return r}(e,t,n),o=s>i.first&&Ge(i,s-1).stateAfter,a=o?ct.fromSaved(i,o,s):new ct(i,$e(i.mode),s);return i.iter(s,t,(function(n){gt(e,n.text,a);var i=a.line;n.stateAfter=i==t-1||i%5==0||i>=r.viewFrom&&it.start)return s}throw new Error("Mode "+e.name+" failed to advance stream.")}ct.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ct.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},ct.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ct.fromSaved=function(e,t,n){return t instanceof dt?new ct(e,We(e.mode,t.state),n,t.lookAhead):new ct(e,We(e.mode,t),n)},ct.prototype.save=function(e){var t=!1!==e?We(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new dt(t,this.maxLookAhead):t};var bt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function At(e,t,n,i){var r,s,o=e.doc,a=o.mode,l=Ge(o,(t=lt(o,t)).line),u=ft(e,t.line,n),d=new Ve(l.text,e.options.tabSize,u);for(i&&(s=[]);(i||d.pose.options.maxHighlightLength?(a=!1,o&>(e,t,i,c.pos),c.pos=t.length,l=null):l=yt(vt(n,c,i.state,h),s),h){var p=h[0].name;p&&(l="m-"+(l?p+" "+l:p))}if(!a||d!=l){for(;u=t:s.to>t);(i||(i=[])).push(new Ct(o,s.from,a?null:s.to))}}return i}(n,r,o),l=function(e,t,n){var i;if(e)for(var r=0;r=t:s.to>t)||s.from==t&&"bookmark"==o.type&&(!n||s.marker.insertLeft)){var a=null==s.from||(o.inclusiveLeft?s.from<=t:s.from0&&a)for(var A=0;At)&&(!n||Ot(n,s.marker)<0)&&(n=s.marker)}return n}function Nt(e,t,n,i,r){var s=Ge(e,t),o=Et&&s.markedSpans;if(o)for(var a=0;a=0&&c<=0||d<=0&&c>=0)&&(d<=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?nt(u.to,n)>=0:nt(u.to,n)>0)||d>=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?nt(u.from,i)<=0:nt(u.from,i)<0)))return!0}}}function Ft(e){for(var t;t=Pt(e);)e=t.find(-1,!0).line;return e}function zt(e,t){var n=Ge(e,t),i=Ft(n);return n==i?t:Xe(i)}function Ut(e,t){if(t>e.lastLine())return t;var n,i=Ge(e,t);if(!Ht(e,i))return t;for(;n=Rt(i);)i=n.find(1,!0).line;return Xe(i)+1}function Ht(e,t){var n=Et&&t.markedSpans;if(n)for(var i=void 0,r=0;rt.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)}))}var Gt=function(e,t,n){this.text=e,kt(this,t),this.height=n?n(this):1};function Kt(e){e.parent=null,Bt(e)}Gt.prototype.lineNo=function(){return Xe(this)},Ae(Gt);var Yt={},Jt={};function Xt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Jt:Yt;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Zt(e,t){var n=k("span",null,null,l?"padding-right: .1px":null),i={pre:k("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var r=0;r<=(t.rest?t.rest.length:0);r++){var s=r?t.rest[r-1]:t.line,o=void 0;i.pos=0,i.addToken=en,ke(e.display.measure)&&(o=de(s,e.doc.direction))&&(i.addToken=tn(i.addToken,o)),i.map=[],rn(s,i,pt(e,s,t!=e.display.externalMeasured&&Xe(s))),s.styleClasses&&(s.styleClasses.bgClass&&(i.bgClass=I(s.styleClasses.bgClass,i.bgClass||"")),s.styleClasses.textClass&&(i.textClass=I(s.styleClasses.textClass,i.textClass||""))),0==i.map.length&&i.map.push(0,0,i.content.appendChild(Be(e.display.measure))),0==r?(t.measure.map=i.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(i.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(l){var a=i.content.lastChild;(/\bcm-tab\b/.test(a.className)||a.querySelector&&a.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return ge(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=I(i.pre.className,i.textClass||"")),i}function Qt(e){var t=B("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function en(e,t,n,i,r,s,l){if(t){var u,d=e.splitSpaces?function(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,i="",r=0;ru&&c.from<=u);h++);if(c.to>=d)return e(n,i,r,s,o,a,l);e(n,i.slice(0,c.to-u),r,s,null,a,l),s=null,i=i.slice(c.to-u),u=c.to}}}function nn(e,t,n,i){var r=!i&&n.widgetNode;r&&e.map.push(e.pos,e.pos+t,r),!i&&e.cm.display.input.needsContentAttribute&&(r||(r=e.content.appendChild(document.createElement("span"))),r.setAttribute("cm-marker",n.id)),r&&(e.cm.display.input.setUneditable(r),e.content.appendChild(r)),e.pos+=t,e.trailingSpace=!1}function rn(e,t,n){var i=e.markedSpans,r=e.text,s=0;if(i)for(var o,a,l,u,d,c,h,p=r.length,f=0,g=1,m="",v=0;;){if(v==f){l=u=d=a="",h=null,c=null,v=1/0;for(var b=[],A=void 0,y=0;yf||_.collapsed&&w.to==f&&w.from==f)){if(null!=w.to&&w.to!=f&&v>w.to&&(v=w.to,u=""),_.className&&(l+=" "+_.className),_.css&&(a=(a?a+";":"")+_.css),_.startStyle&&w.from==f&&(d+=" "+_.startStyle),_.endStyle&&w.to==v&&(A||(A=[])).push(_.endStyle,w.to),_.title&&((h||(h={})).title=_.title),_.attributes)for(var E in _.attributes)(h||(h={}))[E]=_.attributes[E];_.collapsed&&(!c||Ot(c.marker,_)<0)&&(c=w)}else w.from>f&&v>w.from&&(v=w.from)}if(A)for(var C=0;C=p)break;for(var D=Math.min(p,v);;){if(m){var S=f+m.length;if(!c){var T=S>D?m.slice(0,D-f):m;t.addToken(t,T,o?o+l:l,d,f+T.length==v?u:"",a,h)}if(S>=D){m=m.slice(D-f),f=D;break}f=S,d=""}m=r.slice(s,s=n[g++]),o=Xt(n[g++],t.cm.options)}}else for(var B=1;Bn)return{map:e.measure.maps[r],cache:e.measure.caches[r],before:!0}}function Mn(e,t,n,i){return In(e,On(e,t),n,i)}function jn(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&t2&&s.push((l.bottom+u.top)/2-n.top)}}s.push(n.bottom-n.top)}}(e,t.view,t.rect),t.hasHeights=!0),(s=function(e,t,n,i){var r,s=Ln(t.map,n,i),l=s.node,u=s.start,d=s.end,c=s.collapse;if(3==l.nodeType){for(var h=0;h<4;h++){for(;u&&re(t.line.text.charAt(s.coverStart+u));)--u;for(;s.coverStart+d1}(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,i=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*i,bottom:t.bottom*i}}(e.display.measure,r))}else{var p;u>0&&(c=i="right"),r=e.options.lineWrapping&&(p=l.getClientRects()).length>1?p["right"==i?p.length-1:0]:l.getBoundingClientRect()}if(o&&a<9&&!u&&(!r||!r.left&&!r.right)){var f=l.parentNode.getClientRects()[0];r=f?{left:f.left,right:f.left+si(e.display),top:f.top,bottom:f.bottom}:Rn}for(var g=r.top-t.rect.top,m=r.bottom-t.rect.top,v=(g+m)/2,b=t.view.measure.heights,A=0;At)&&(r=(s=l-a)-1,t>=l&&(o="right")),null!=r){if(i=e[u+2],a==l&&n==(i.insertLeft?"left":"right")&&(o=n),"left"==n&&0==r)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)i=e[2+(u-=3)],o="left";if("right"==n&&r==l-a)for(;u=0&&(n=e[r]).left==n.right;r--);return n}function Fn(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t=i.text.length?(l=i.text.length,u="before"):l<=0&&(l=0,u="after"),!a)return o("before"==u?l-1:l,"before"==u);function d(e,t,n){return o(n?e-1:e,1==a[t].level!=n)}var c=le(a,l,u),h=ae,p=d(l,c,"before"==u);return null!=h&&(p.other=d(l,h,"before"!=u)),p}function Yn(e,t){var n=0;t=lt(e.doc,t),e.options.lineWrapping||(n=si(e.display)*t.ch);var i=Ge(e.doc,t.line),r=qt(i)+Cn(e.display);return{left:n,right:n,top:r,bottom:r+i.height}}function Jn(e,t,n,i,r){var s=tt(e,t,n);return s.xRel=r,i&&(s.outside=i),s}function Xn(e,t,n){var i=e.doc;if((n+=e.display.viewOffset)<0)return Jn(i.first,0,null,-1,-1);var r=Ze(i,n),s=i.first+i.size-1;if(r>s)return Jn(i.first+i.size-1,Ge(i,s).text.length,null,1,1);t<0&&(t=0);for(var o=Ge(i,r);;){var a=ti(e,o,r,t,n),l=Lt(o,a.ch+(a.xRel>0||a.outside>0?1:0));if(!l)return a;var u=l.find(1);if(u.line==r)return u;o=Ge(i,r=u.line)}}function Zn(e,t,n,i){i-=qn(t);var r=t.text.length,s=oe((function(t){return In(e,n,t-1).bottom<=i}),r,0);return{begin:s,end:r=oe((function(t){return In(e,n,t).top>i}),s,r)}}function Qn(e,t,n,i){return n||(n=On(e,t)),Zn(e,t,n,$n(e,t,In(e,n,i),"line").top)}function ei(e,t,n,i){return!(e.bottom<=n)&&(e.top>n||(i?e.left:e.right)>t)}function ti(e,t,n,i,r){r-=qt(t);var s=On(e,t),o=qn(t),a=0,l=t.text.length,u=!0,d=de(t,e.doc.direction);if(d){var c=(e.options.lineWrapping?ii:ni)(e,t,n,s,d,i,r);a=(u=1!=c.level)?c.from:c.to-1,l=u?c.to:c.from-1}var h,p,f=null,g=null,m=oe((function(t){var n=In(e,s,t);return n.top+=o,n.bottom+=o,!!ei(n,i,r,!1)&&(n.top<=r&&n.left<=i&&(f=t,g=n),!0)}),a,l),v=!1;if(g){var b=i-g.left=y.bottom?1:0}return Jn(n,m=se(t.text,m,1),p,v,i-h)}function ni(e,t,n,i,r,s,o){var a=oe((function(a){var l=r[a],u=1!=l.level;return ei(Kn(e,tt(n,u?l.to:l.from,u?"before":"after"),"line",t,i),s,o,!0)}),0,r.length-1),l=r[a];if(a>0){var u=1!=l.level,d=Kn(e,tt(n,u?l.from:l.to,u?"after":"before"),"line",t,i);ei(d,s,o,!0)&&d.top>o&&(l=r[a-1])}return l}function ii(e,t,n,i,r,s,o){var a=Zn(e,t,i,o),l=a.begin,u=a.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var d=null,c=null,h=0;h=u||p.to<=l)){var f=In(e,i,1!=p.level?Math.min(u,p.to)-1:Math.max(l,p.from)).right,g=fg)&&(d=p,c=g)}}return d||(d=r[r.length-1]),d.fromu&&(d={from:d.from,to:u,level:d.level}),d}function ri(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Pn){Pn=B("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Pn.appendChild(document.createTextNode("x")),Pn.appendChild(B("br"));Pn.appendChild(document.createTextNode("x"))}T(e.measure,Pn);var n=Pn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),S(e.measure),n||1}function si(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=B("span","xxxxxxxxxx"),n=B("pre",[t],"CodeMirror-line-like");T(e.measure,n);var i=t.getBoundingClientRect(),r=(i.right-i.left)/10;return r>2&&(e.cachedCharWidth=r),r||10}function oi(e){for(var t=e.display,n={},i={},r=t.gutters.clientLeft,s=t.gutters.firstChild,o=0;s;s=s.nextSibling,++o){var a=e.display.gutterSpecs[o].className;n[a]=s.offsetLeft+s.clientLeft+r,i[a]=s.clientWidth}return{fixedPos:ai(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function ai(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function li(e){var t=ri(e.display),n=e.options.lineWrapping,i=n&&Math.max(5,e.display.scroller.clientWidth/si(e.display)-3);return function(r){if(Ht(e.doc,r))return 0;var s=0;if(r.widgets)for(var o=0;o0&&(l=Ge(e.doc,u.line).text).length==u.ch){var d=N(l,l.length,e.options.tabSize)-l.length;u=tt(u.line,Math.max(0,Math.round((s-Dn(e.display).left)/si(e.display))-d))}return u}function ci(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var n=e.display.view,i=0;it)&&(r.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=r.viewTo)Et&&zt(e.doc,t)r.viewFrom?fi(e):(r.viewFrom+=i,r.viewTo+=i);else if(t<=r.viewFrom&&n>=r.viewTo)fi(e);else if(t<=r.viewFrom){var s=gi(e,n,n+i,1);s?(r.view=r.view.slice(s.index),r.viewFrom=s.lineN,r.viewTo+=i):fi(e)}else if(n>=r.viewTo){var o=gi(e,t,t,-1);o?(r.view=r.view.slice(0,o.index),r.viewTo=o.lineN):fi(e)}else{var a=gi(e,t,t,-1),l=gi(e,n,n+i,1);a&&l?(r.view=r.view.slice(0,a.index).concat(on(e,a.lineN,l.lineN)).concat(r.view.slice(l.index)),r.viewTo+=i):fi(e)}var u=r.externalMeasured;u&&(n=r.lineN&&t=i.viewTo)){var s=i.view[ci(e,t)];if(null!=s.node){var o=s.changes||(s.changes=[]);-1==z(o,n)&&o.push(n)}}}function fi(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function gi(e,t,n,i){var r,s=ci(e,t),o=e.display.view;if(!Et||n==e.doc.first+e.doc.size)return{index:s,lineN:n};for(var a=e.display.viewFrom,l=0;l0){if(s==o.length-1)return null;r=a+o[s].size-t,s++}else r=a-t;t+=r,n+=r}for(;zt(e.doc,n)!=n;){if(s==(i<0?0:o.length-1))return null;n+=i*o[s-(i<0?1:0)].size,s+=i}return{index:s,lineN:n}}function mi(e){for(var t=e.display.view,n=0,i=0;i=e.display.viewTo||a.to().linet||t==n&&o.to==t)&&(i(Math.max(o.from,t),Math.min(o.to,n),1==o.level?"rtl":"ltr",s),r=!0)}r||i(t,n,"ltr")}(g,n||0,null==i?h:i,(function(e,t,r,c){var m="ltr"==r,v=p(e,m?"left":"right"),b=p(t-1,m?"right":"left"),A=null==n&&0==e,y=null==i&&t==h,w=0==c,_=!g||c==g.length-1;if(b.top-v.top<=3){var E=(u?y:A)&&_,C=(u?A:y)&&w?a:(m?v:b).left,x=E?l:(m?b:v).right;d(C,v.top,x-C,v.bottom)}else{var D,S,T,B;m?(D=u&&A&&w?a:v.left,S=u?l:f(e,r,"before"),T=u?a:f(t,r,"after"),B=u&&y&&_?l:b.right):(D=u?f(e,r,"before"):a,S=!u&&A&&w?l:v.right,T=!u&&y&&_?a:b.left,B=u?f(t,r,"after"):l),d(D,v.top,S-D,v.bottom),v.bottom0?t.blinker=setInterval((function(){e.hasFocus()||Di(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"}),e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Ei(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||xi(e))}function Ci(e){e.state.delayingBlurEvent=!0,setTimeout((function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&Di(e))}),100)}function xi(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(ge(e,"focus",e,t),e.state.focused=!0,O(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),l&&setTimeout((function(){return e.display.input.reset(!0)}),20)),e.display.input.receivedFocus()),_i(e))}function Di(e,t){e.state.delayingBlurEvent||(e.state.focused&&(ge(e,"blur",e,t),e.state.focused=!1,D(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout((function(){e.state.focused||(e.display.shift=!1)}),150))}function Si(e){for(var t=e.display,n=t.lineDiv.offsetTop,i=0;i.005||h<-.005)&&(Je(r.line,l),Ti(r.line),r.rest))for(var p=0;pe.display.sizerWidth){var f=Math.ceil(u/si(e.display));f>e.display.maxLineLength&&(e.display.maxLineLength=f,e.display.maxLine=r.line,e.display.maxLineChanged=!0)}}}}function Ti(e){if(e.widgets)for(var t=0;t=o&&(s=Ze(t,qt(Ge(t,l))-e.wrapper.clientHeight),o=l)}return{from:s,to:Math.max(o,s+1)}}function ki(e,t){var n=e.display,i=ri(e.display);t.top<0&&(t.top=0);var r=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:n.scroller.scrollTop,s=Bn(e),o={};t.bottom-t.top>s&&(t.bottom=t.top+s);var a=e.doc.height+xn(n),l=t.topa-i;if(t.topr+s){var d=Math.min(t.top,(u?a:t.bottom)-s);d!=r&&(o.scrollTop=d)}var c=e.options.fixedGutter?0:n.gutters.offsetWidth,h=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft-c,p=Tn(e)-n.gutters.offsetWidth,f=t.right-t.left>p;return f&&(t.right=t.left+p),t.left<10?o.scrollLeft=0:t.leftp+h-3&&(o.scrollLeft=t.right+(f?0:10)-p),o}function Mi(e,t){null!=t&&(Ii(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function ji(e){Ii(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Oi(e,t,n){null==t&&null==n||Ii(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function Ii(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,Pi(e,Yn(e,t.from),Yn(e,t.to),t.margin))}function Pi(e,t,n,i){var r=ki(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-i,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+i});Oi(e,r.scrollLeft,r.scrollTop)}function Ri(e,t){Math.abs(e.doc.scrollTop-t)<2||(n||ur(e,{top:t}),Li(e,t,!0),n&&ur(e),rr(e,100))}function Li(e,t,n){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),(e.display.scroller.scrollTop!=t||n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Ni(e,t,n,i){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!i||(e.doc.scrollLeft=t,hr(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Fi(e){var t=e.display,n=t.gutters.offsetWidth,i=Math.round(e.doc.height+xn(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:i,scrollHeight:i+Sn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var zi=function(e,t,n){this.cm=n;var i=this.vert=B("div",[B("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),r=this.horiz=B("div",[B("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=r.tabIndex=-1,e(i),e(r),he(i,"scroll",(function(){i.clientHeight&&t(i.scrollTop,"vertical")})),he(r,"scroll",(function(){r.clientWidth&&t(r.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,o&&a<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};zi.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,i=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?i+"px":"0";var r=e.viewHeight-(t?i:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+r)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?i+"px":"0",this.horiz.style.left=e.barLeft+"px";var s=e.viewWidth-e.barLeft-(n?i:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+s)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==i&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?i:0,bottom:t?i:0}},zi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},zi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},zi.prototype.zeroWidthHack=function(){var e=b&&!p?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new F,this.disableVert=new F},zi.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto",t.set(1e3,(function i(){var r=e.getBoundingClientRect();("vert"==n?document.elementFromPoint(r.right-1,(r.top+r.bottom)/2):document.elementFromPoint((r.right+r.left)/2,r.bottom-1))!=e?e.style.pointerEvents="none":t.set(1e3,i)}))},zi.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Ui=function(){};function Hi(e,t){t||(t=Fi(e));var n=e.display.barWidth,i=e.display.barHeight;Wi(e,t);for(var r=0;r<4&&n!=e.display.barWidth||i!=e.display.barHeight;r++)n!=e.display.barWidth&&e.options.lineWrapping&&Si(e),Wi(e,Fi(e)),n=e.display.barWidth,i=e.display.barHeight}function Wi(e,t){var n=e.display,i=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=i.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=i.bottom)+"px",n.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=i.bottom+"px",n.scrollbarFiller.style.width=i.right+"px"):n.scrollbarFiller.style.display="",i.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=i.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}Ui.prototype.update=function(){return{bottom:0,right:0}},Ui.prototype.setScrollLeft=function(){},Ui.prototype.setScrollTop=function(){},Ui.prototype.clear=function(){};var qi={native:zi,null:Ui};function $i(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&D(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new qi[e.options.scrollbarStyle]((function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),he(t,"mousedown",(function(){e.state.focused&&setTimeout((function(){return e.display.input.focus()}),0)})),t.setAttribute("cm-not-content","true")}),(function(t,n){"horizontal"==n?Ni(e,t):Ri(e,t)}),e),e.display.scrollbars.addClass&&O(e.display.wrapper,e.display.scrollbars.addClass)}var Vi=0;function Gi(e){var t;e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Vi,markArrays:null},t=e.curOp,an?an.ops.push(t):t.ownsGroup=an={ops:[t],delayedCallbacks:[]}}function Ki(e){var t=e.curOp;t&&function(e,t){var n=e.ownsGroup;if(n)try{!function(e){var t=e.delayedCallbacks,n=0;do{for(;n=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new or(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Ji(e){e.updatedDisplay=e.mustUpdate&&ar(e.cm,e.update)}function Xi(e){var t=e.cm,n=t.display;e.updatedDisplay&&Si(t),e.barMeasure=Fi(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Mn(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Sn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Tn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Zi(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft(window.innerHeight||document.documentElement.clientHeight)&&(r=!1),null!=r&&!f){var s=B("div","​",null,"position: absolute;\n top: "+(t.top-n.viewOffset-Cn(e.display))+"px;\n height: "+(t.bottom-t.top+Sn(e)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(s),s.scrollIntoView(r),e.display.lineSpace.removeChild(s)}}}(t,function(e,t,n,i){var r;null==i&&(i=0),e.options.lineWrapping||t!=n||(n="before"==t.sticky?tt(t.line,t.ch+1,"before"):t,t=t.ch?tt(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t);for(var s=0;s<5;s++){var o=!1,a=Kn(e,t),l=n&&n!=t?Kn(e,n):a,u=ki(e,r={left:Math.min(a.left,l.left),top:Math.min(a.top,l.top)-i,right:Math.max(a.left,l.left),bottom:Math.max(a.bottom,l.bottom)+i}),d=e.doc.scrollTop,c=e.doc.scrollLeft;if(null!=u.scrollTop&&(Ri(e,u.scrollTop),Math.abs(e.doc.scrollTop-d)>1&&(o=!0)),null!=u.scrollLeft&&(Ni(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-c)>1&&(o=!0)),!o)break}return r}(t,lt(i,e.scrollToPos.from),lt(i,e.scrollToPos.to),e.scrollToPos.margin));var r=e.maybeHiddenMarkers,s=e.maybeUnhiddenMarkers;if(r)for(var o=0;o=e.display.viewTo)){var n=+new Date+e.options.workTime,i=ft(e,t.highlightFrontier),r=[];t.iter(i.line,Math.min(t.first+t.size,e.display.viewTo+500),(function(s){if(i.line>=e.display.viewFrom){var o=s.styles,a=s.text.length>e.options.maxHighlightLength?We(t.mode,i.state):null,l=ht(e,s,i,!0);a&&(i.state=a),s.styles=l.styles;var u=s.styleClasses,d=l.classes;d?s.styleClasses=d:u&&(s.styleClasses=null);for(var c=!o||o.length!=s.styles.length||u!=d&&(!u||!d||u.bgClass!=d.bgClass||u.textClass!=d.textClass),h=0;!c&&hn)return rr(e,e.options.workDelay),!0})),t.highlightFrontier=i.line,t.modeFrontier=Math.max(t.modeFrontier,i.line),r.length&&er(e,(function(){for(var t=0;t=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==mi(e))return!1;pr(e)&&(fi(e),t.dims=oi(e));var r=i.first+i.size,s=Math.max(t.visible.from-e.options.viewportMargin,i.first),o=Math.min(r,t.visible.to+e.options.viewportMargin);n.viewFromo&&n.viewTo-o<20&&(o=Math.min(r,n.viewTo)),Et&&(s=zt(e.doc,s),o=Ut(e.doc,o));var a=s!=n.viewFrom||o!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;(function(e,t,n){var i=e.display;0==i.view.length||t>=i.viewTo||n<=i.viewFrom?(i.view=on(e,t,n),i.viewFrom=t):(i.viewFrom>t?i.view=on(e,t,i.viewFrom).concat(i.view):i.viewFromn&&(i.view=i.view.slice(0,ci(e,n)))),i.viewTo=n})(e,s,o),n.viewOffset=qt(Ge(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var u=mi(e);if(!a&&0==u&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var d=function(e){if(e.hasFocus())return null;var t=j();if(!t||!M(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var i=window.getSelection();i.anchorNode&&i.extend&&M(e.display.lineDiv,i.anchorNode)&&(n.anchorNode=i.anchorNode,n.anchorOffset=i.anchorOffset,n.focusNode=i.focusNode,n.focusOffset=i.focusOffset)}return n}(e);return u>4&&(n.lineDiv.style.display="none"),function(e,t,n){var i=e.display,r=e.options.lineNumbers,s=i.lineDiv,o=s.firstChild;function a(t){var n=t.nextSibling;return l&&b&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}for(var u=i.view,d=i.viewFrom,c=0;c-1&&(p=!1),cn(e,h,d,n)),p&&(S(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(et(e.options,d)))),o=h.node.nextSibling}else{var f=bn(e,h,d,n);s.insertBefore(f,o)}d+=h.size}for(;o;)o=a(o)}(e,n.updateLineNumbers,t.dims),u>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,function(e){if(e&&e.activeElt&&e.activeElt!=j()&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&M(document.body,e.anchorNode)&&M(document.body,e.focusNode))){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}(d),S(n.cursorDiv),S(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,a&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,rr(e,400)),n.updateLineNumbers=null,!0}function lr(e,t){for(var n=t.viewport,i=!0;;i=!1){if(i&&e.options.lineWrapping&&t.oldDisplayWidth!=Tn(e))i&&(t.visible=Bi(e.display,e.doc,n));else if(n&&null!=n.top&&(n={top:Math.min(e.doc.height+xn(e.display)-Bn(e),n.top)}),t.visible=Bi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!ar(e,t))break;Si(e);var r=Fi(e);vi(e),Hi(e,r),cr(e,r),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function ur(e,t){var n=new or(e,t);if(ar(e,n)){Si(e),lr(e,n);var i=Fi(e);vi(e),Hi(e,i),cr(e,i),n.finish()}}function dr(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",un(e,"gutterChanged",e)}function cr(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Sn(e)+"px"}function hr(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var i=ai(t)-t.scroller.scrollLeft+e.doc.scrollLeft,r=t.gutters.offsetWidth,s=i+"px",o=0;oa.clientWidth,d=a.scrollHeight>a.clientHeight;if(r&&u||s&&d){if(s&&b&&l)e:for(var h=t.target,p=o.view;h!=a;h=h.parentNode)for(var f=0;f=0&&nt(e,i.to())<=0)return n}return-1};var Cr=function(e,t){this.anchor=e,this.head=t};function xr(e,t,n){var i=e&&e.options.selectionsMayTouch,r=t[n];t.sort((function(e,t){return nt(e.from(),t.from())})),n=z(t,r);for(var s=1;s0:l>=0){var u=ot(a.from(),o.from()),d=st(a.to(),o.to()),c=a.empty()?o.from()==o.head:a.from()==a.head;s<=n&&--n,t.splice(--s,2,new Cr(c?d:u,c?u:d))}}return new Er(t,n)}function Dr(e,t){return new Er([new Cr(e,t||e)],0)}function Sr(e){return e.text?tt(e.from.line+e.text.length-1,Y(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function Tr(e,t){if(nt(e,t.from)<0)return e;if(nt(e,t.to)<=0)return Sr(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;return e.line==t.to.line&&(i+=Sr(t).ch-t.to.ch),tt(n,i)}function Br(e,t){for(var n=[],i=0;i1&&e.remove(a.line+1,f-1),e.insert(a.line+1,v)}un(e,"change",e,t)}function Pr(e,t,n){!function e(i,r,s){if(i.linked)for(var o=0;oa-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(s=function(e,t){return t?(zr(e.done),Y(e.done)):e.done.length&&!Y(e.done).ranges?Y(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Y(e.done)):void 0}(r,r.lastOp==i)))o=Y(s.changes),0==nt(t.from,t.to)&&0==nt(t.from,o.to)?o.to=Sr(t):s.changes.push(Fr(e,t));else{var l=Y(r.done);for(l&&l.ranges||Wr(e.sel,r.done),s={changes:[Fr(e,t)],generation:r.generation},r.done.push(s);r.done.length>r.undoDepth;)r.done.shift(),r.done[0].ranges||r.done.shift()}r.done.push(n),r.generation=++r.maxGeneration,r.lastModTime=r.lastSelTime=a,r.lastOp=r.lastSelOp=i,r.lastOrigin=r.lastSelOrigin=t.origin,o||ge(e,"historyAdded")}function Hr(e,t,n,i){var r=e.history,s=i&&i.origin;n==r.lastSelOp||s&&r.lastSelOrigin==s&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==s||function(e,t,n,i){var r=t.charAt(0);return"*"==r||"+"==r&&n.ranges.length==i.ranges.length&&n.somethingSelected()==i.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}(e,s,Y(r.done),t))?r.done[r.done.length-1]=t:Wr(t,r.done),r.lastSelTime=+new Date,r.lastSelOrigin=s,r.lastSelOp=n,i&&!1!==i.clearRedo&&zr(r.undone)}function Wr(e,t){var n=Y(t);n&&n.ranges&&n.equals(e)||t.push(e)}function qr(e,t,n,i){var r=t["spans_"+e.id],s=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,i),(function(n){n.markedSpans&&((r||(r=t["spans_"+e.id]={}))[s]=n.markedSpans),++s}))}function $r(e){if(!e)return null;for(var t,n=0;n-1&&(Y(a)[c]=u[c],delete u[c])}}}return i}function Kr(e,t,n,i){if(i){var r=e.anchor;if(n){var s=nt(t,r)<0;s!=nt(n,r)<0?(r=t,t=n):s!=nt(t,n)<0&&(t=n)}return new Cr(r,t)}return new Cr(n||t,t)}function Yr(e,t,n,i,r){null==r&&(r=e.cm&&(e.cm.display.shift||e.extend)),es(e,new Er([Kr(e.sel.primary(),t,n,r)],0),i)}function Jr(e,t,n){for(var i=[],r=e.cm&&(e.cm.display.shift||e.extend),s=0;s=t.ch:a.to>t.ch))){if(r&&(ge(l,"beforeCursorEnter"),l.explicitlyCleared)){if(s.markedSpans){--o;continue}break}if(!l.atomic)continue;if(n){var c=l.find(i<0?1:-1),h=void 0;if((i<0?d:u)&&(c=as(e,c,-i,c&&c.line==t.line?s:null)),c&&c.line==t.line&&(h=nt(c,n))&&(i<0?h<0:h>0))return ss(e,c,t,i,r)}var p=l.find(i<0?-1:1);return(i<0?u:d)&&(p=as(e,p,i,p.line==t.line?s:null)),p?ss(e,p,t,i,r):null}}return t}function os(e,t,n,i,r){var s=i||1;return ss(e,t,n,s,r)||!r&&ss(e,t,n,s,!0)||ss(e,t,n,-s,r)||!r&&ss(e,t,n,-s,!0)||(e.cantEdit=!0,tt(e.first,0))}function as(e,t,n,i){return n<0&&0==t.ch?t.line>e.first?lt(e,tt(t.line-1)):null:n>0&&t.ch==(i||Ge(e,t.line)).text.length?t.line0)){var d=[l,1],c=nt(u.from,a.from),h=nt(u.to,a.to);(c<0||!o.inclusiveLeft&&!c)&&d.push({from:u.from,to:a.from}),(h>0||!o.inclusiveRight&&!h)&&d.push({from:a.to,to:u.to}),r.splice.apply(r,d),l+=d.length-3}}return r}(e,t.from,t.to);if(i)for(var r=i.length-1;r>=0;--r)cs(e,{from:i[r].from,to:i[r].to,text:r?[""]:t.text,origin:t.origin});else cs(e,t)}}function cs(e,t){if(1!=t.text.length||""!=t.text[0]||0!=nt(t.from,t.to)){var n=Br(e,t);Ur(e,t,n,e.cm?e.cm.curOp.id:NaN),fs(e,t,n,St(e,t));var i=[];Pr(e,(function(e,n){n||-1!=z(i,e.history)||(bs(e.history,t),i.push(e.history)),fs(e,t,null,St(e,t))}))}}function hs(e,t,n){var i=e.cm&&e.cm.state.suppressEdits;if(!i||n){for(var r,s=e.history,o=e.sel,a="undo"==t?s.done:s.undone,l="undo"==t?s.undone:s.done,u=0;u=0;--p){var f=h(p);if(f)return f.v}}}}function ps(e,t){if(0!=t&&(e.first+=t,e.sel=new Er(J(e.sel.ranges,(function(e){return new Cr(tt(e.anchor.line+t,e.anchor.ch),tt(e.head.line+t,e.head.ch))})),e.sel.primIndex),e.cm)){hi(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,i=n.viewFrom;ie.lastLine())){if(t.from.lines&&(t={from:t.from,to:tt(s,Ge(e,s).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Ke(e,t.from,t.to),n||(n=Br(e,t)),e.cm?function(e,t,n){var i=e.doc,r=e.display,s=t.from,o=t.to,a=!1,l=s.line;e.options.lineWrapping||(l=Xe(Ft(Ge(i,s.line))),i.iter(l,o.line+1,(function(e){if(e==r.maxLine)return a=!0,!0}))),i.sel.contains(t.from,t.to)>-1&&ve(e),Ir(i,t,n,li(e)),e.options.lineWrapping||(i.iter(l,s.line+t.text.length,(function(e){var t=$t(e);t>r.maxLineLength&&(r.maxLine=e,r.maxLineLength=t,r.maxLineChanged=!0,a=!1)})),a&&(e.curOp.updateMaxLine=!0)),function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontiern;i--){var r=Ge(e,i).stateAfter;if(r&&(!(r instanceof dt)||i+r.lookAhead1||!(this.children[0]instanceof ys))){var a=[];this.collapse(a),this.children=[new ys(a)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var o=r.lines.length%25+25,a=o;a10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var i=0;i0||0==o&&!1!==s.clearWhenEmpty)return s;if(s.replacedWith&&(s.collapsed=!0,s.widgetNode=k("span",[s.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||s.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(s.widgetNode.insertLeft=!0)),s.collapsed){if(Nt(e,t.line,t,n,s)||t.line!=n.line&&Nt(e,n.line,t,n,s))throw new Error("Inserting collapsed marker partially overlapping an existing one");Et=!0}s.addToHistory&&Ur(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var a,l=t.line,u=e.cm;if(e.iter(l,n.line+1,(function(i){u&&s.collapsed&&!u.options.lineWrapping&&Ft(i)==u.display.maxLine&&(a=!0),s.collapsed&&l!=t.line&&Je(i,0),function(e,t,n){var i=n&&window.WeakSet&&(n.markedSpans||(n.markedSpans=new WeakSet));i&&i.has(e.markedSpans)?e.markedSpans.push(t):(e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],i&&i.add(e.markedSpans)),t.marker.attachLine(e)}(i,new Ct(s,l==t.line?t.ch:null,l==n.line?n.ch:null),e.cm&&e.cm.curOp),++l})),s.collapsed&&e.iter(t.line,n.line+1,(function(t){Ht(e,t)&&Je(t,0)})),s.clearOnEnter&&he(s,"beforeCursorEnter",(function(){return s.clear()})),s.readOnly&&(_t=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),s.collapsed&&(s.id=++Cs,s.atomic=!0),u){if(a&&(u.curOp.updateMaxLine=!0),s.collapsed)hi(u,t.line,n.line+1);else if(s.className||s.startStyle||s.endStyle||s.css||s.attributes||s.title)for(var d=t.line;d<=n.line;d++)pi(u,d,"text");s.atomic&&is(u.doc),un(u,"markerAdded",u,s)}return s}xs.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Gi(e),be(this,"clear")){var n=this.find();n&&un(this,"clear",n.from,n.to)}for(var i=null,r=null,s=0;se.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=d,e.display.maxLineChanged=!0)}null!=i&&e&&this.collapsed&&hi(e,i,r+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&is(e.doc)),e&&un(e,"markerCleared",e,this,i,r),t&&Ki(e),this.parent&&this.parent.clear()}},xs.prototype.find=function(e,t){var n,i;null==e&&"bookmark"==this.type&&(e=1);for(var r=0;r=0;l--)ds(this,i[l]);a?Qr(this,a):this.cm&&ji(this.cm)})),undo:ir((function(){hs(this,"undo")})),redo:ir((function(){hs(this,"redo")})),undoSelection:ir((function(){hs(this,"undo",!0)})),redoSelection:ir((function(){hs(this,"redo",!0)})),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,i=0;i=e.ch)&&t.push(r.marker.parent||r.marker)}return t},findMarks:function(e,t,n){e=lt(this,e),t=lt(this,t);var i=[],r=e.line;return this.iter(e.line,t.line+1,(function(s){var o=s.markedSpans;if(o)for(var a=0;a=l.to||null==l.from&&r!=e.line||null!=l.from&&r==t.line&&l.from>=t.ch||n&&!n(l.marker)||i.push(l.marker.parent||l.marker)}++r})),i},getAllMarks:function(){var e=[];return this.iter((function(t){var n=t.markedSpans;if(n)for(var i=0;ie)return t=e,!0;e-=s,++n})),lt(this,tt(n,t))},indexFromPos:function(e){var t=(e=lt(this,e)).ch;if(e.linet&&(t=e.from),null!=e.to&&e.to-1)return t.state.draggingText(e),void setTimeout((function(){return t.display.input.focus()}),20);try{var c=e.dataTransfer.getData("Text");if(c){var h;if(t.state.draggingText&&!t.state.draggingText.copy&&(h=t.listSelections()),ts(t.doc,Dr(n,n)),h)for(var p=0;p=0;t--)gs(e.doc,"",i[t].from,i[t].to,"+delete");ji(e)}))}function Zs(e,t,n){var i=se(e.text,t+n,n);return i<0||i>e.text.length?null:i}function Qs(e,t,n){var i=Zs(e,t.ch,n);return null==i?null:new tt(t.line,i,n<0?"after":"before")}function eo(e,t,n,i,r){if(e){"rtl"==t.doc.direction&&(r=-r);var s=de(n,t.doc.direction);if(s){var o,a=r<0?Y(s):s[0],l=r<0==(1==a.level)?"after":"before";if(a.level>0||"rtl"==t.doc.direction){var u=On(t,n);o=r<0?n.text.length-1:0;var d=In(t,u,o).top;o=oe((function(e){return In(t,u,e).top==d}),r<0==(1==a.level)?a.from:a.to-1,o),"before"==l&&(o=Zs(n,o,1))}else o=r<0?a.to:a.from;return new tt(i,o,l)}}return new tt(i,r<0?n.text.length:0,r<0?"before":"after")}Ws.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Ws.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Ws.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Ws.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Ws.default=b?Ws.macDefault:Ws.pcDefault;var to={selectAll:ls,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),W)},killLine:function(e){return Xs(e,(function(t){if(t.empty()){var n=Ge(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line0)r=new tt(r.line,r.ch+1),e.replaceRange(s.charAt(r.ch-1)+s.charAt(r.ch-2),tt(r.line,r.ch-2),r,"+transpose");else if(r.line>e.doc.first){var o=Ge(e.doc,r.line-1).text;o&&(r=new tt(r.line,1),e.replaceRange(s.charAt(0)+e.doc.lineSeparator()+o.charAt(o.length-1),tt(r.line-1,o.length-1),r,"+transpose"))}n.push(new Cr(r,r))}e.setSelections(n)}))},newlineAndIndent:function(e){return er(e,(function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var i=0;i-1&&(nt((r=u.ranges[r]).from(),t)<0||t.xRel>0)&&(nt(r.to(),t)>0||t.xRel<0)?function(e,t,n,i){var r=e.display,s=!1,u=tr(e,(function(t){l&&(r.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Ci(e)),fe(r.wrapper.ownerDocument,"mouseup",u),fe(r.wrapper.ownerDocument,"mousemove",d),fe(r.scroller,"dragstart",c),fe(r.scroller,"drop",u),s||(ye(t),i.addNew||Yr(e.doc,n,null,null,i.extend),l&&!h||o&&9==a?setTimeout((function(){r.wrapper.ownerDocument.body.focus({preventScroll:!0}),r.input.focus()}),20):r.input.focus())})),d=function(e){s=s||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},c=function(){return s=!0};l&&(r.scroller.draggable=!0),e.state.draggingText=u,u.copy=!i.moveOnDrag,he(r.wrapper.ownerDocument,"mouseup",u),he(r.wrapper.ownerDocument,"mousemove",d),he(r.scroller,"dragstart",c),he(r.scroller,"drop",u),e.state.delayingBlurEvent=!0,setTimeout((function(){return r.input.focus()}),20),r.scroller.dragDrop&&r.scroller.dragDrop()}(e,i,t,s):function(e,t,n,i){o&&Ci(e);var r=e.display,s=e.doc;ye(t);var a,l,u=s.sel,d=u.ranges;if(i.addNew&&!i.extend?(l=s.sel.contains(n),a=l>-1?d[l]:new Cr(n,n)):(a=s.sel.primary(),l=s.sel.primIndex),"rectangle"==i.unit)i.addNew||(a=new Cr(n,n)),n=di(e,t,!0,!0),l=-1;else{var c=bo(e,n,i.unit);a=i.extend?Kr(a,c.anchor,c.head,i.extend):c}i.addNew?-1==l?(l=d.length,es(s,xr(e,d.concat([a]),l),{scroll:!1,origin:"*mouse"})):d.length>1&&d[l].empty()&&"char"==i.unit&&!i.extend?(es(s,xr(e,d.slice(0,l).concat(d.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),u=s.sel):Xr(s,l,a,q):(l=0,es(s,new Er([a],0),q),u=s.sel);var h=n;function p(t){if(0!=nt(h,t))if(h=t,"rectangle"==i.unit){for(var r=[],o=e.options.tabSize,d=N(Ge(s,n.line).text,n.ch,o),c=N(Ge(s,t.line).text,t.ch,o),p=Math.min(d,c),f=Math.max(d,c),g=Math.min(n.line,t.line),m=Math.min(e.lastLine(),Math.max(n.line,t.line));g<=m;g++){var v=Ge(s,g).text,b=V(v,p,o);p==f?r.push(new Cr(tt(g,b),tt(g,b))):v.length>b&&r.push(new Cr(tt(g,b),tt(g,V(v,f,o))))}r.length||r.push(new Cr(n,n)),es(s,xr(e,u.ranges.slice(0,l).concat(r),l),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var A,y=a,w=bo(e,t,i.unit),_=y.anchor;nt(w.anchor,_)>0?(A=w.head,_=ot(y.from(),w.anchor)):(A=w.anchor,_=st(y.to(),w.head));var E=u.ranges.slice(0);E[l]=function(e,t){var n=t.anchor,i=t.head,r=Ge(e.doc,n.line);if(0==nt(n,i)&&n.sticky==i.sticky)return t;var s=de(r);if(!s)return t;var o=le(s,n.ch,n.sticky),a=s[o];if(a.from!=n.ch&&a.to!=n.ch)return t;var l,u=o+(a.from==n.ch==(1!=a.level)?0:1);if(0==u||u==s.length)return t;if(i.line!=n.line)l=(i.line-n.line)*("ltr"==e.doc.direction?1:-1)>0;else{var d=le(s,i.ch,i.sticky),c=d-o||(i.ch-n.ch)*(1==a.level?-1:1);l=d==u-1||d==u?c<0:c>0}var h=s[u+(l?-1:0)],p=l==(1==h.level),f=p?h.from:h.to,g=p?"after":"before";return n.ch==f&&n.sticky==g?t:new Cr(new tt(n.line,f,g),i)}(e,new Cr(lt(s,_),A)),es(s,xr(e,E,l),q)}}var f=r.wrapper.getBoundingClientRect(),g=0;function m(t){var n=++g,o=di(e,t,!0,"rectangle"==i.unit);if(o)if(0!=nt(o,h)){e.curOp.focus=j(),p(o);var a=Bi(r,s);(o.line>=a.to||o.linef.bottom?20:0;l&&setTimeout(tr(e,(function(){g==n&&(r.scroller.scrollTop+=l,m(t))})),50)}}function v(t){e.state.selectingText=!1,g=1/0,t&&(ye(t),r.input.focus()),fe(r.wrapper.ownerDocument,"mousemove",b),fe(r.wrapper.ownerDocument,"mouseup",A),s.history.lastSelOrigin=null}var b=tr(e,(function(e){0!==e.buttons&&xe(e)?m(e):v(e)})),A=tr(e,v);e.state.selectingText=A,he(r.wrapper.ownerDocument,"mousemove",b),he(r.wrapper.ownerDocument,"mouseup",A)}(e,i,t,s)}(t,i,s,e):Ce(e)==n.scroller&&ye(e):2==r?(i&&Yr(t.doc,i),setTimeout((function(){return n.input.focus()}),20)):3==r&&(E?t.display.input.onContextMenu(e):Ci(t)))}}function bo(e,t,n){if("char"==n)return new Cr(t,t);if("word"==n)return e.findWordAt(t);if("line"==n)return new Cr(tt(t.line,0),lt(e.doc,tt(t.line+1,0)));var i=n(e,t);return new Cr(i.from,i.to)}function Ao(e,t,n,i){var r,s;if(t.touches)r=t.touches[0].clientX,s=t.touches[0].clientY;else try{r=t.clientX,s=t.clientY}catch(e){return!1}if(r>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;i&&ye(t);var o=e.display,a=o.lineDiv.getBoundingClientRect();if(s>a.bottom||!be(e,n))return _e(t);s-=a.top-o.viewOffset;for(var l=0;l=r)return ge(e,n,e,Ze(e.doc,s),e.display.gutterSpecs[l].className,t),_e(t)}}function yo(e,t){return Ao(e,t,"gutterClick",!0)}function wo(e,t){En(e.display,t)||function(e,t){return!!be(e,"gutterContextMenu")&&Ao(e,t,"gutterContextMenu",!1)}(e,t)||me(e,t,"contextmenu")||E||e.display.input.onContextMenu(t)}function _o(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Un(e)}mo.prototype.compare=function(e,t,n){return this.time+400>e&&0==nt(t,this.pos)&&n==this.button};var Eo={toString:function(){return"CodeMirror.Init"}},Co={},xo={};function Do(e,t,n){if(!t!=!(n&&n!=Eo)){var i=e.display.dragFunctions,r=t?he:fe;r(e.display.scroller,"dragstart",i.start),r(e.display.scroller,"dragenter",i.enter),r(e.display.scroller,"dragover",i.over),r(e.display.scroller,"dragleave",i.leave),r(e.display.scroller,"drop",i.drop)}}function So(e){e.options.lineWrapping?(O(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(D(e.display.wrapper,"CodeMirror-wrap"),Vt(e)),ui(e),hi(e),Un(e),setTimeout((function(){return Hi(e)}),100)}function To(e,t){var n=this;if(!(this instanceof To))return new To(e,t);this.options=t=t?L(t):{},L(Co,t,!1);var i=t.value;"string"==typeof i?i=new Ms(i,t.mode,null,t.lineSeparator,t.direction):t.mode&&(i.modeOption=t.mode),this.doc=i;var r=new To.inputStyles[t.inputStyle](this),s=this.display=new vr(e,i,r,t);for(var u in s.wrapper.CodeMirror=this,_o(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),$i(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new F,keySeq:null,specialChars:null},t.autofocus&&!v&&s.input.focus(),o&&a<11&&setTimeout((function(){return n.display.input.reset(!0)}),20),function(e){var t=e.display;he(t.scroller,"mousedown",tr(e,vo)),he(t.scroller,"dblclick",o&&a<11?tr(e,(function(t){if(!me(e,t)){var n=di(e,t);if(n&&!yo(e,t)&&!En(e.display,t)){ye(t);var i=e.findWordAt(n);Yr(e.doc,i.anchor,i.head)}}})):function(t){return me(e,t)||ye(t)}),he(t.scroller,"contextmenu",(function(t){return wo(e,t)})),he(t.input.getField(),"contextmenu",(function(n){t.scroller.contains(n.target)||wo(e,n)}));var n,i={end:0};function r(){t.activeTouch&&(n=setTimeout((function(){return t.activeTouch=null}),1e3),(i=t.activeTouch).end=+new Date)}function s(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function l(e,t){if(null==t.left)return!0;var n=t.left-e.left,i=t.top-e.top;return n*n+i*i>400}he(t.scroller,"touchstart",(function(r){if(!me(e,r)&&!s(r)&&!yo(e,r)){t.input.ensurePolled(),clearTimeout(n);var o=+new Date;t.activeTouch={start:o,moved:!1,prev:o-i.end<=300?i:null},1==r.touches.length&&(t.activeTouch.left=r.touches[0].pageX,t.activeTouch.top=r.touches[0].pageY)}})),he(t.scroller,"touchmove",(function(){t.activeTouch&&(t.activeTouch.moved=!0)})),he(t.scroller,"touchend",(function(n){var i=t.activeTouch;if(i&&!En(t,n)&&null!=i.left&&!i.moved&&new Date-i.start<300){var s,o=e.coordsChar(t.activeTouch,"page");s=!i.prev||l(i,i.prev)?new Cr(o,o):!i.prev.prev||l(i,i.prev.prev)?e.findWordAt(o):new Cr(tt(o.line,0),lt(e.doc,tt(o.line+1,0))),e.setSelection(s.anchor,s.head),e.focus(),ye(n)}r()})),he(t.scroller,"touchcancel",r),he(t.scroller,"scroll",(function(){t.scroller.clientHeight&&(Ri(e,t.scroller.scrollTop),Ni(e,t.scroller.scrollLeft,!0),ge(e,"scroll",e))})),he(t.scroller,"mousewheel",(function(t){return _r(e,t)})),he(t.scroller,"DOMMouseScroll",(function(t){return _r(e,t)})),he(t.wrapper,"scroll",(function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0})),t.dragFunctions={enter:function(t){me(e,t)||Ee(t)},over:function(t){me(e,t)||(function(e,t){var n=di(e,t);if(n){var i=document.createDocumentFragment();Ai(e,n,i),e.display.dragCursor||(e.display.dragCursor=B("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),T(e.display.dragCursor,i)}}(e,t),Ee(t))},start:function(t){return function(e,t){if(o&&(!e.state.draggingText||+new Date-js<100))Ee(t);else if(!me(e,t)&&!En(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!h)){var n=B("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",c&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),c&&n.parentNode.removeChild(n)}}(e,t)},drop:tr(e,Os),leave:function(t){me(e,t)||Is(e)}};var u=t.input.getField();he(u,"keyup",(function(t){return ho.call(e,t)})),he(u,"keydown",tr(e,co)),he(u,"keypress",tr(e,po)),he(u,"focus",(function(t){return xi(e,t)})),he(u,"blur",(function(t){return Di(e,t)}))}(this),Ls(),Gi(this),this.curOp.forceUpdate=!0,Rr(this,i),t.autofocus&&!v||this.hasFocus()?setTimeout((function(){n.hasFocus()&&!n.state.focused&&xi(n)}),20):Di(this),xo)xo.hasOwnProperty(u)&&xo[u](this,t[u],Eo);pr(this),t.finishInit&&t.finishInit(this);for(var d=0;d150)){if(!i)return;n="prev"}}else u=0,n="not";"prev"==n?u=t>s.first?N(Ge(s,t-1).text,null,o):0:"add"==n?u=l+e.options.indentUnit:"subtract"==n?u=l-e.options.indentUnit:"number"==typeof n&&(u=l+n),u=Math.max(0,u);var c="",h=0;if(e.options.indentWithTabs)for(var p=Math.floor(u/o);p;--p)h+=o,c+="\t";if(ho,l=je(t),u=null;if(a&&i.ranges.length>1)if(Mo&&Mo.text.join("\n")==t){if(i.ranges.length%Mo.text.length==0){u=[];for(var d=0;d=0;h--){var p=i.ranges[h],f=p.from(),g=p.to();p.empty()&&(n&&n>0?f=tt(f.line,f.ch-n):e.state.overwrite&&!a?g=tt(g.line,Math.min(Ge(s,g.line).text.length,g.ch+Y(l).length)):a&&Mo&&Mo.lineWise&&Mo.text.join("\n")==l.join("\n")&&(f=g=tt(f.line,0)));var m={from:f,to:g,text:u?u[h%u.length]:l,origin:r||(a?"paste":e.state.cutIncoming>o?"cut":"+input")};ds(e.doc,m),un(e,"inputRead",e,m)}t&&!a&&Po(e,t),ji(e),e.curOp.updateInput<2&&(e.curOp.updateInput=c),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Io(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||er(t,(function(){return Oo(t,n,0,null,"paste")})),!0}function Po(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,i=n.ranges.length-1;i>=0;i--){var r=n.ranges[i];if(!(r.head.ch>100||i&&n.ranges[i-1].head.line==r.head.line)){var s=e.getModeAt(r.head),o=!1;if(s.electricChars){for(var a=0;a-1){o=ko(e,r.head.line,"smart");break}}else s.electricInput&&s.electricInput.test(Ge(e.doc,r.head.line).text.slice(0,r.head.ch))&&(o=ko(e,r.head.line,"smart"));o&&un(e,"electricInput",e,r.head.line)}}}function Ro(e){for(var t=[],n=[],i=0;i0?0:-1));if(isNaN(d))o=null;else{var c=n>0?d>=55296&&d<56320:d>=56320&&d<57343;o=new tt(t.line,Math.max(0,Math.min(a.text.length,t.ch+n*(c?2:1))),-n)}}else o=r?function(e,t,n,i){var r=de(t,e.doc.direction);if(!r)return Qs(t,n,i);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var s=le(r,n.ch,n.sticky),o=r[s];if("ltr"==e.doc.direction&&o.level%2==0&&(i>0?o.to>n.ch:o.from=o.from&&h>=d.begin)){var p=c?"before":"after";return new tt(n.line,h,p)}}var f=function(e,t,i){for(var s=function(e,t){return t?new tt(n.line,l(e,1),"before"):new tt(n.line,e,"after")};e>=0&&e0==(1!=o.level),u=a?i.begin:l(i.end,-1);if(o.from<=u&&u0?d.end:l(d.begin,-1);return null==m||i>0&&m==t.text.length||!(g=f(i>0?0:r.length-1,i,u(m)))?null:g}(e.cm,a,t,n):Qs(a,t,n);if(null==o){if(s||((u=t.line+l)=e.first+e.size||(t=new tt(u,t.ch,t.sticky),!(a=Ge(e,u)))))return!1;t=eo(r,e.cm,a,t.line,l)}else t=o;return!0}if("char"==i||"codepoint"==i)u();else if("column"==i)u(!0);else if("word"==i||"group"==i)for(var d=null,c="group"==i,h=e.cm&&e.cm.getHelper(t,"wordChars"),p=!0;!(n<0)||u(!p);p=!1){var f=a.text.charAt(t.ch)||"\n",g=te(f,h)?"w":c&&"\n"==f?"n":!c||/\s/.test(f)?null:"p";if(!c||p||g||(g="s"),d&&d!=g){n<0&&(n=1,u(),t.sticky="after");break}if(g&&(d=g),n>0&&!u(!p))break}var m=os(e,t,s,o,!0);return it(s,m)&&(m.hitSide=!0),m}function zo(e,t,n,i){var r,s,o=e.doc,a=t.left;if("page"==i){var l=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),u=Math.max(l-.5*ri(e.display),3);r=(n>0?t.bottom:t.top)+n*u}else"line"==i&&(r=n>0?t.bottom+3:t.top-3);for(;(s=Xn(e,a,r)).outside;){if(n<0?r<=0:r>=o.height){s.hitSide=!0;break}r+=5*n}return s}var Uo=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new F,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Ho(e,t){var n=jn(e,t.line);if(!n||n.hidden)return null;var i=Ge(e.doc,t.line),r=kn(n,i,t.line),s=de(i,e.doc.direction),o="left";s&&(o=le(s,t.ch)%2?"right":"left");var a=Ln(r.map,t.ch,o);return a.offset="right"==a.collapse?a.end:a.start,a}function Wo(e,t){return t&&(e.bad=!0),e}function qo(e,t,n){var i;if(t==e.display.lineDiv){if(!(i=e.display.lineDiv.childNodes[n]))return Wo(e.clipPos(tt(e.display.viewTo-1)),!0);t=null,n=0}else for(i=t;;i=i.parentNode){if(!i||i==e.display.lineDiv)return null;if(i.parentNode&&i.parentNode==e.display.lineDiv)break}for(var r=0;r=t.display.viewTo||s.line=t.display.viewFrom&&Ho(t,r)||{node:l[0].measure.map[2],offset:0},d=s.linei.firstLine()&&(o=tt(o.line-1,Ge(i.doc,o.line-1).length)),a.ch==Ge(i.doc,a.line).text.length&&a.liner.viewTo-1)return!1;o.line==r.viewFrom||0==(e=ci(i,o.line))?(t=Xe(r.view[0].line),n=r.view[0].node):(t=Xe(r.view[e].line),n=r.view[e-1].node.nextSibling);var l,u,d=ci(i,a.line);if(d==r.view.length-1?(l=r.viewTo-1,u=r.lineDiv.lastChild):(l=Xe(r.view[d+1].line)-1,u=r.view[d+1].node.previousSibling),!n)return!1;for(var c=i.doc.splitLines(function(e,t,n,i,r){var s="",o=!1,a=e.doc.lineSeparator(),l=!1;function u(){o&&(s+=a,l&&(s+=a),o=l=!1)}function d(e){e&&(u(),s+=e)}function c(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(n)return void d(n);var s,h=t.getAttribute("cm-marker");if(h){var p=e.findMarks(tt(i,0),tt(r+1,0),(m=+h,function(e){return e.id==m}));return void(p.length&&(s=p[0].find(0))&&d(Ke(e.doc,s.from,s.to).join(a)))}if("false"==t.getAttribute("contenteditable"))return;var f=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;f&&u();for(var g=0;g1&&h.length>1;)if(Y(c)==Y(h))c.pop(),h.pop(),l--;else{if(c[0]!=h[0])break;c.shift(),h.shift(),t++}for(var p=0,f=0,g=c[0],m=h[0],v=Math.min(g.length,m.length);po.ch&&b.charCodeAt(b.length-f-1)==A.charCodeAt(A.length-f-1);)p--,f++;c[c.length-1]=b.slice(0,b.length-f).replace(/^\u200b+/,""),c[0]=c[0].slice(p).replace(/\u200b+$/,"");var w=tt(t,p),_=tt(l,h.length?Y(h).length-f:0);return c.length>1||c[0]||nt(w,_)?(gs(i.doc,c,w,_,"+input"),!0):void 0},Uo.prototype.ensurePolled=function(){this.forceCompositionEnd()},Uo.prototype.reset=function(){this.forceCompositionEnd()},Uo.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Uo.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()}),80))},Uo.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||er(this.cm,(function(){return hi(e.cm)}))},Uo.prototype.setUneditable=function(e){e.contentEditable="false"},Uo.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||tr(this.cm,Oo)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Uo.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Uo.prototype.onContextMenu=function(){},Uo.prototype.resetPosition=function(){},Uo.prototype.needsContentAttribute=!0;var Vo=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new F,this.hasSelection=!1,this.composing=null};Vo.prototype.init=function(e){var t=this,n=this,i=this.cm;this.createField(e);var r=this.textarea;function s(e){if(!me(i,e)){if(i.somethingSelected())jo({lineWise:!1,text:i.getSelections()});else{if(!i.options.lineWiseCopyCut)return;var t=Ro(i);jo({lineWise:!0,text:t.text}),"cut"==e.type?i.setSelections(t.ranges,null,W):(n.prevInput="",r.value=t.text.join("\n"),P(r))}"cut"==e.type&&(i.state.cutIncoming=+new Date)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),g&&(r.style.width="0px"),he(r,"input",(function(){o&&a>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()})),he(r,"paste",(function(e){me(i,e)||Io(e,i)||(i.state.pasteIncoming=+new Date,n.fastPoll())})),he(r,"cut",s),he(r,"copy",s),he(e.scroller,"paste",(function(t){if(!En(e,t)&&!me(i,t)){if(!r.dispatchEvent)return i.state.pasteIncoming=+new Date,void n.focus();var s=new Event("paste");s.clipboardData=t.clipboardData,r.dispatchEvent(s)}})),he(e.lineSpace,"selectstart",(function(t){En(e,t)||ye(t)})),he(r,"compositionstart",(function(){var e=i.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:e,range:i.markText(e,i.getCursor("to"),{className:"CodeMirror-composing"})}})),he(r,"compositionend",(function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)}))},Vo.prototype.createField=function(e){this.wrapper=No(),this.textarea=this.wrapper.firstChild},Vo.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Vo.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,i=bi(e);if(e.options.moveInputWithCursor){var r=Kn(e,n.sel.primary().head,"div"),s=t.wrapper.getBoundingClientRect(),o=t.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,r.top+o.top-s.top)),i.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,r.left+o.left-s.left))}return i},Vo.prototype.showSelection=function(e){var t=this.cm.display;T(t.cursorDiv,e.cursors),T(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Vo.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&P(this.textarea),o&&a>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",o&&a>=9&&(this.hasSelection=null))}},Vo.prototype.getField=function(){return this.textarea},Vo.prototype.supportsTouch=function(){return!1},Vo.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!v||j()!=this.textarea))try{this.textarea.focus()}catch(e){}},Vo.prototype.blur=function(){this.textarea.blur()},Vo.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Vo.prototype.receivedFocus=function(){this.slowPoll()},Vo.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){e.poll(),e.cm.state.focused&&e.slowPoll()}))},Vo.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0,t.polling.set(20,(function n(){t.poll()||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,n))}))},Vo.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,i=this.prevInput;if(this.contextMenuPending||!t.state.focused||Oe(n)&&!i&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var r=n.value;if(r==i&&!t.somethingSelected())return!1;if(o&&a>=9&&this.hasSelection===r||b&&/[\uf700-\uf7ff]/.test(r))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var s=r.charCodeAt(0);if(8203!=s||i||(i="​"),8666==s)return this.reset(),this.cm.execCommand("undo")}for(var l=0,u=Math.min(i.length,r.length);l1e3||r.indexOf("\n")>-1?n.value=e.prevInput="":e.prevInput=r,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},Vo.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Vo.prototype.onKeyPress=function(){o&&a>=9&&(this.hasSelection=null),this.fastPoll()},Vo.prototype.onContextMenu=function(e){var t=this,n=t.cm,i=n.display,r=t.textarea;t.contextMenuPending&&t.contextMenuPending();var s=di(n,e),u=i.scroller.scrollTop;if(s&&!c){n.options.resetSelectionOnContextMenu&&-1==n.doc.sel.contains(s)&&tr(n,es)(n.doc,Dr(s),W);var d,h=r.style.cssText,p=t.wrapper.style.cssText,f=t.wrapper.offsetParent.getBoundingClientRect();if(t.wrapper.style.cssText="position: static",r.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-f.top-5)+"px; left: "+(e.clientX-f.left-5)+"px;\n z-index: 1000; background: "+(o?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",l&&(d=window.scrollY),i.input.focus(),l&&window.scrollTo(null,d),i.input.reset(),n.somethingSelected()||(r.value=t.prevInput=" "),t.contextMenuPending=v,i.selForContextMenu=n.doc.sel,clearTimeout(i.detectingSelectAll),o&&a>=9&&m(),E){Ee(e);var g=function(){fe(window,"mouseup",g),setTimeout(v,20)};he(window,"mouseup",g)}else setTimeout(v,50)}function m(){if(null!=r.selectionStart){var e=n.somethingSelected(),s="​"+(e?r.value:"");r.value="⇚",r.value=s,t.prevInput=e?"":"​",r.selectionStart=1,r.selectionEnd=s.length,i.selForContextMenu=n.doc.sel}}function v(){if(t.contextMenuPending==v&&(t.contextMenuPending=!1,t.wrapper.style.cssText=p,r.style.cssText=h,o&&a<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=u),null!=r.selectionStart)){(!o||o&&a<9)&&m();var e=0,s=function(){i.selForContextMenu==n.doc.sel&&0==r.selectionStart&&r.selectionEnd>0&&"​"==t.prevInput?tr(n,ls)(n):e++<10?i.detectingSelectAll=setTimeout(s,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(s,200)}}},Vo.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e,this.textarea.readOnly=!!e},Vo.prototype.setUneditable=function(){},Vo.prototype.needsContentAttribute=!1,function(e){var t=e.optionHandlers;function n(n,i,r,s){e.defaults[n]=i,r&&(t[n]=s?function(e,t,n){n!=Eo&&r(e,t,n)}:r)}e.defineOption=n,e.Init=Eo,n("value","",(function(e,t){return e.setValue(t)}),!0),n("mode",null,(function(e,t){e.doc.modeOption=t,Mr(e)}),!0),n("indentUnit",2,Mr,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,(function(e){jr(e),Un(e),hi(e)}),!0),n("lineSeparator",null,(function(e,t){if(e.doc.lineSep=t,t){var n=[],i=e.doc.first;e.doc.iter((function(e){for(var r=0;;){var s=e.text.indexOf(t,r);if(-1==s)break;r=s+t.length,n.push(tt(i,s))}i++}));for(var r=n.length-1;r>=0;r--)gs(e.doc,t,n[r],tt(n[r].line,n[r].ch+t.length))}})),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,(function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=Eo&&e.refresh()})),n("specialCharPlaceholder",Qt,(function(e){return e.refresh()}),!0),n("electricChars",!0),n("inputStyle",v?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),n("spellcheck",!1,(function(e,t){return e.getInputField().spellcheck=t}),!0),n("autocorrect",!1,(function(e,t){return e.getInputField().autocorrect=t}),!0),n("autocapitalize",!1,(function(e,t){return e.getInputField().autocapitalize=t}),!0),n("rtlMoveVisually",!y),n("wholeLineUpdateBefore",!0),n("theme","default",(function(e){_o(e),mr(e)}),!0),n("keyMap","default",(function(e,t,n){var i=Js(t),r=n!=Eo&&Js(n);r&&r.detach&&r.detach(e,i),i.attach&&i.attach(e,r||null)})),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,So,!0),n("gutters",[],(function(e,t){e.display.gutterSpecs=fr(t,e.options.lineNumbers),mr(e)}),!0),n("fixedGutter",!0,(function(e,t){e.display.gutters.style.left=t?ai(e.display)+"px":"0",e.refresh()}),!0),n("coverGutterNextToScrollbar",!1,(function(e){return Hi(e)}),!0),n("scrollbarStyle","native",(function(e){$i(e),Hi(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)}),!0),n("lineNumbers",!1,(function(e,t){e.display.gutterSpecs=fr(e.options.gutters,t),mr(e)}),!0),n("firstLineNumber",1,mr,!0),n("lineNumberFormatter",(function(e){return e}),mr,!0),n("showCursorWhenSelecting",!1,vi,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,(function(e,t){"nocursor"==t&&(Di(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)})),n("screenReaderLabel",null,(function(e,t){t=""===t?null:t,e.display.input.screenReaderLabelChanged(t)})),n("disableInput",!1,(function(e,t){t||e.display.input.reset()}),!0),n("dragDrop",!0,Do),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,vi,!0),n("singleCursorHeightPerLine",!0,vi,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,jr,!0),n("addModeClass",!1,jr,!0),n("pollInterval",100),n("undoDepth",200,(function(e,t){return e.doc.history.undoDepth=t})),n("historyEventDelay",1250),n("viewportMargin",10,(function(e){return e.refresh()}),!0),n("maxHighlightLength",1e4,jr,!0),n("moveInputWithCursor",!0,(function(e,t){t||e.display.input.resetPosition()})),n("tabindex",null,(function(e,t){return e.display.input.getField().tabIndex=t||""})),n("autofocus",null),n("direction","ltr",(function(e,t){return e.doc.setDirection(t)}),!0),n("phrases",null)}(To),function(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,n){var i=this.options,r=i[e];i[e]==n&&"mode"!=e||(i[e]=n,t.hasOwnProperty(e)&&tr(this,t[e])(this,n,r),ge(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Js(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;nn&&(ko(this,r.head.line,e,!0),n=r.head.line,i==this.doc.sel.primIndex&&ji(this));else{var s=r.from(),o=r.to(),a=Math.max(n,s.line);n=Math.min(this.lastLine(),o.line-(o.ch?0:1))+1;for(var l=a;l0&&Xr(this.doc,i,new Cr(s,u[i].to()),W)}}})),getTokenAt:function(e,t){return At(this,e,t)},getLineTokens:function(e,t){return At(this,tt(e),t,!0)},getTokenTypeAt:function(e){e=lt(this.doc,e);var t,n=pt(this,Ge(this.doc,e.line)),i=0,r=(n.length-1)/2,s=e.ch;if(0==s)t=n[2];else for(;;){var o=i+r>>1;if((o?n[2*o-1]:0)>=s)r=o;else{if(!(n[2*o+1]s&&(e=s,r=!0),i=Ge(this.doc,e)}else i=e;return $n(this,i,{top:0,left:0},t||"page",n||r).top+(r?this.doc.height-qt(i):0)},defaultTextHeight:function(){return ri(this.display)},defaultCharWidth:function(){return si(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,i,r){var s,o,a,l=this.display,u=(e=Kn(this,lt(this.doc,e))).bottom,d=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),l.sizer.appendChild(t),"over"==i)u=e.top;else if("above"==i||"near"==i){var c=Math.max(l.wrapper.clientHeight,this.doc.height),h=Math.max(l.sizer.clientWidth,l.lineSpace.clientWidth);("above"==i||e.bottom+t.offsetHeight>c)&&e.top>t.offsetHeight?u=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=c&&(u=e.bottom),d+t.offsetWidth>h&&(d=h-t.offsetWidth)}t.style.top=u+"px",t.style.left=t.style.right="","right"==r?(d=l.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==r?d=0:"middle"==r&&(d=(l.sizer.clientWidth-t.offsetWidth)/2),t.style.left=d+"px"),n&&(s=this,o={left:d,top:u,right:d+t.offsetWidth,bottom:u+t.offsetHeight},null!=(a=ki(s,o)).scrollTop&&Ri(s,a.scrollTop),null!=a.scrollLeft&&Ni(s,a.scrollLeft))},triggerOnKeyDown:nr(co),triggerOnKeyPress:nr(po),triggerOnKeyUp:ho,triggerOnMouseDown:nr(vo),execCommand:function(e){if(to.hasOwnProperty(e))return to[e].call(null,this)},triggerElectric:nr((function(e){Po(this,e)})),findPosH:function(e,t,n,i){var r=1;t<0&&(r=-1,t=-t);for(var s=lt(this.doc,e),o=0;o0&&o(t.charAt(n-1));)--n;for(;i.5||this.options.lineWrapping)&&ui(this),ge(this,"refresh",this)})),swapDoc:nr((function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),Rr(this,e),Un(this),this.display.input.reset(),Oi(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,un(this,"swapDoc",this,t),t})),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Ae(e),e.registerHelper=function(t,i,r){n.hasOwnProperty(t)||(n[t]=e[t]={_global:[]}),n[t][i]=r},e.registerGlobalHelper=function(t,i,r,s){e.registerHelper(t,i,s),n[t]._global.push({pred:r,val:s})}}(To);var Go="iter insert remove copy getEditor constructor".split(" ");for(var Ko in Ms.prototype)Ms.prototype.hasOwnProperty(Ko)&&z(Go,Ko)<0&&(To.prototype[Ko]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ms.prototype[Ko]));return Ae(Ms),To.inputStyles={textarea:Vo,contenteditable:Uo},To.defineMode=function(e){To.defaults.mode||"null"==e||(To.defaults.mode=e),Ne.apply(this,arguments)},To.defineMIME=function(e,t){Le[e]=t},To.defineMode("null",(function(){return{token:function(e){return e.skipToEnd()}}})),To.defineMIME("text/plain","null"),To.defineExtension=function(e,t){To.prototype[e]=t},To.defineDocExtension=function(e,t){Ms.prototype[e]=t},To.fromTextArea=function(e,t){if((t=t?L(t):{}).value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var n=j();t.autofocus=n==e||null!=e.getAttribute("autofocus")&&n==document.body}function i(){e.value=a.getValue()}var r;if(e.form&&(he(e.form,"submit",i),!t.leaveSubmitMethodAlone)){var s=e.form;r=s.submit;try{var o=s.submit=function(){i(),s.submit=r,s.submit(),s.submit=o}}catch(e){}}t.finishInit=function(n){n.save=i,n.getTextArea=function(){return e},n.toTextArea=function(){n.toTextArea=isNaN,i(),e.parentNode.removeChild(n.getWrapperElement()),e.style.display="",e.form&&(fe(e.form,"submit",i),t.leaveSubmitMethodAlone||"function"!=typeof e.form.submit||(e.form.submit=r))}},e.style.display="none";var a=To((function(t){return e.parentNode.insertBefore(t,e.nextSibling)}),t);return a},function(e){e.off=fe,e.on=he,e.wheelEventPixels=wr,e.Doc=Ms,e.splitLines=je,e.countColumn=N,e.findColumn=V,e.isWordChar=ee,e.Pass=H,e.signal=ge,e.Line=Gt,e.changeEnd=Sr,e.scrollbarModel=qi,e.Pos=tt,e.cmpPos=nt,e.modes=Re,e.mimeModes=Le,e.resolveMode=Fe,e.getMode=ze,e.modeExtensions=Ue,e.extendMode=He,e.copyState=We,e.startState=$e,e.innerMode=qe,e.commands=to,e.keyMap=Ws,e.keyName=Ys,e.isModifierKey=Gs,e.lookupKey=Vs,e.normalizeKeyMap=$s,e.StringStream=Ve,e.SharedTextMarker=Ss,e.TextMarker=xs,e.LineWidget=_s,e.e_preventDefault=ye,e.e_stopPropagation=we,e.e_stop=Ee,e.addClass=O,e.contains=M,e.rmClass=D,e.keyNames=Fs}(To),To.version="5.61.1",To}()},1755:(e,t,n)=>{!function(e){"use strict";function t(e){return new RegExp("^(("+e.join(")|(")+"))\\b")}var n=t(["and","or","not","is"]),i=["as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","lambda","pass","raise","return","try","while","with","yield","in"],r=["abs","all","any","bin","bool","bytearray","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip","__import__","NotImplemented","Ellipsis","__debug__"];function s(e){return e.scopes[e.scopes.length-1]}e.registerHelper("hintWords","python",i.concat(r)),e.defineMode("python",(function(o,a){for(var l="error",u=a.delimiters||a.singleDelimiters||/^[\(\)\[\]\{\}@,:`=;\.\\]/,d=[a.singleOperators,a.doubleOperators,a.doubleDelimiters,a.tripleDelimiters,a.operators||/^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@]|\.\.\.)/],c=0;ci?_(t):r0&&E(e,t)&&(o+=" "+l),o}return w(e,t)}function w(e,t,i){if(e.eatSpace())return null;if(!i&&e.match(/^#.*/))return"comment";if(e.match(/^[0-9\.]/,!1)){var r=!1;if(e.match(/^[\d_]*\.\d+(e[\+\-]?\d+)?/i)&&(r=!0),e.match(/^[\d_]+\.\d*/)&&(r=!0),e.match(/^\.\d+/)&&(r=!0),r)return e.eat(/J/i),"number";var s=!1;if(e.match(/^0x[0-9a-f_]+/i)&&(s=!0),e.match(/^0b[01_]+/i)&&(s=!0),e.match(/^0o[0-7_]+/i)&&(s=!0),e.match(/^[1-9][\d_]*(e[\+\-]?[\d_]+)?/)&&(e.eat(/J/i),s=!0),e.match(/^0(?![\dx])/i)&&(s=!0),s)return e.eat(/L/i),"number"}if(e.match(v))return-1!==e.current().toLowerCase().indexOf("f")?(t.tokenize=function(e,t){for(;"rubf".indexOf(e.charAt(0).toLowerCase())>=0;)e=e.substr(1);var n=1==e.length,i="string";function r(e){return function(t,n){var i=w(t,n,!0);return"punctuation"==i&&("{"==t.current()?n.tokenize=r(e+1):"}"==t.current()&&(n.tokenize=e>1?r(e-1):s)),i}}function s(s,o){for(;!s.eol();)if(s.eatWhile(/[^'"\{\}\\]/),s.eat("\\")){if(s.next(),n&&s.eol())return i}else{if(s.match(e))return o.tokenize=t,i;if(s.match("{{"))return i;if(s.match("{",!1))return o.tokenize=r(0),s.current()?i:o.tokenize(s,o);if(s.match("}}"))return i;if(s.match("}"))return l;s.eat(/['"]/)}if(n){if(a.singleLineStringErrors)return l;o.tokenize=t}return i}return s.isString=!0,s}(e.current(),t.tokenize),t.tokenize(e,t)):(t.tokenize=function(e,t){for(;"rubf".indexOf(e.charAt(0).toLowerCase())>=0;)e=e.substr(1);var n=1==e.length,i="string";function r(r,s){for(;!r.eol();)if(r.eatWhile(/[^'"\\]/),r.eat("\\")){if(r.next(),n&&r.eol())return i}else{if(r.match(e))return s.tokenize=t,i;r.eat(/['"]/)}if(n){if(a.singleLineStringErrors)return l;s.tokenize=t}return i}return r.isString=!0,r}(e.current(),t.tokenize),t.tokenize(e,t));for(var o=0;o1&&s(t).offset>n;){if("py"!=s(t).type)return!0;t.scopes.pop()}return s(t).offset!=n}function C(e,t){e.sol()&&(t.beginningOfLine=!0);var n=t.tokenize(e,t),i=e.current();if(t.beginningOfLine&&"@"==i)return e.match(m,!1)?"meta":g?"operator":l;if(/\S/.test(i)&&(t.beginningOfLine=!1),"variable"!=n&&"builtin"!=n||"meta"!=t.lastToken||(n="meta"),"pass"!=i&&"return"!=i||(t.dedent+=1),"lambda"==i&&(t.lambda=!0),":"==i&&!t.lambda&&"py"==s(t).type&&e.match(/^\s*(?:#|$)/,!1)&&_(t),1==i.length&&!/string|comment/.test(n)){var r="[({".indexOf(i);if(-1!=r&&function(e,t,n){var i=e.match(/^[\s\[\{\(]*(?:#|$)/,!1)?null:e.column()+1;t.scopes.push({offset:t.indent+h,type:n,align:i})}(e,t,"])}".slice(r,r+1)),-1!=(r="])}".indexOf(i))){if(s(t).type!=i)return l;t.indent=t.scopes.pop().offset-h}}return t.dedent>0&&e.eol()&&"py"==s(t).type&&(t.scopes.length>1&&t.scopes.pop(),t.dedent-=1),n}return{startState:function(e){return{tokenize:y,scopes:[{offset:e||0,type:"py",align:null}],indent:e||0,lastToken:null,lambda:!1,dedent:0}},token:function(e,t){var n=t.errorToken;n&&(t.errorToken=!1);var i=C(e,t);return i&&"comment"!=i&&(t.lastToken="keyword"==i||"punctuation"==i?e.current():i),"punctuation"==i&&(i=null),e.eol()&&t.lambda&&(t.lambda=!1),n?i+" "+l:i},indent:function(t,n){if(t.tokenize!=y)return t.tokenize.isString?e.Pass:0;var i=s(t),r=i.type==n.charAt(0);return null!=i.align?i.align-(r?1:0):i.offset-(r?h:0)},electricInput:/^\s*[\}\]\)]$/,closeBrackets:{triples:"'\""},lineComment:"#",fold:"indent"}})),e.defineMIME("text/x-python","python");var o;e.defineMIME("text/x-cython",{name:"python",extra_keywords:(o="by cdef cimport cpdef ctypedef enum except extern gil include nogil property public readonly struct union DEF IF ELIF ELSE",o.split(" "))})}(n(1448))},2743:e=>{"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?a((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function r(e,t,n){return e.concat(t).map((function(e){return i(e,n)}))}function s(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]}(e))}function o(e,t){try{return t in e}catch(e){return!1}}function a(e,n,l){(l=l||{}).arrayMerge=l.arrayMerge||r,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=i;var u=Array.isArray(n);return u===Array.isArray(e)?u?l.arrayMerge(e,n,l):function(e,t,n){var r={};return n.isMergeableObject(e)&&s(e).forEach((function(t){r[t]=i(e[t],n)})),s(t).forEach((function(s){(function(e,t){return o(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,s)||(o(e,s)&&n.isMergeableObject(t[s])?r[s]=function(e,t){if(!t.customMerge)return a;var n=t.customMerge(e);return"function"==typeof n?n:a}(s,n)(e[s],t[s],n):r[s]=i(t[s],n))})),r}(e,n,l):i(n,l)}a.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return a(e,n,t)}),{})};var l=a;e.exports=l},3338:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.Doctype=t.CDATA=t.Tag=t.Style=t.Script=t.Comment=t.Directive=t.Text=t.Root=t.isTag=t.ElementType=void 0,function(e){e.Root="root",e.Text="text",e.Directive="directive",e.Comment="comment",e.Script="script",e.Style="style",e.Tag="tag",e.CDATA="cdata",e.Doctype="doctype"}(n=t.ElementType||(t.ElementType={})),t.isTag=function(e){return e.type===n.Tag||e.type===n.Script||e.type===n.Style},t.Root=n.Root,t.Text=n.Text,t.Directive=n.Directive,t.Comment=n.Comment,t.Script=n.Script,t.Style=n.Style,t.Tag=n.Tag,t.CDATA=n.CDATA,t.Doctype=n.Doctype},3379:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.decodeXML=t.decodeHTMLStrict=t.decodeHTMLAttribute=t.decodeHTML=t.determineBranch=t.EntityDecoder=t.DecodingMode=t.BinTrieFlags=t.fromCodePoint=t.replaceCodePoint=t.decodeCodePoint=t.xmlDecodeTree=t.htmlDecodeTree=void 0;var a=o(n(7346));t.htmlDecodeTree=a.default;var l=o(n(8622));t.xmlDecodeTree=l.default;var u=s(n(2809));t.decodeCodePoint=u.default;var d,c,h,p,f=n(2809);function g(e){return e>=d.ZERO&&e<=d.NINE}Object.defineProperty(t,"replaceCodePoint",{enumerable:!0,get:function(){return f.replaceCodePoint}}),Object.defineProperty(t,"fromCodePoint",{enumerable:!0,get:function(){return f.fromCodePoint}}),function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"}(d||(d={})),function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"}(c=t.BinTrieFlags||(t.BinTrieFlags={})),function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"}(h||(h={})),function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"}(p=t.DecodingMode||(t.DecodingMode={}));var m=function(){function e(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=h.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=p.Strict}return e.prototype.startEntity=function(e){this.decodeMode=e,this.state=h.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1},e.prototype.write=function(e,t){switch(this.state){case h.EntityStart:return e.charCodeAt(t)===d.NUM?(this.state=h.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=h.NamedEntity,this.stateNamedEntity(e,t));case h.NumericStart:return this.stateNumericStart(e,t);case h.NumericDecimal:return this.stateNumericDecimal(e,t);case h.NumericHex:return this.stateNumericHex(e,t);case h.NamedEntity:return this.stateNamedEntity(e,t)}},e.prototype.stateNumericStart=function(e,t){return t>=e.length?-1:(32|e.charCodeAt(t))===d.LOWER_X?(this.state=h.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=h.NumericDecimal,this.stateNumericDecimal(e,t))},e.prototype.addToNumericResult=function(e,t,n,i){if(t!==n){var r=n-t;this.result=this.result*Math.pow(i,r)+parseInt(e.substr(t,r),i),this.consumed+=r}},e.prototype.stateNumericHex=function(e,t){for(var n,i=t;t=d.UPPER_A&&n<=d.UPPER_F||n>=d.LOWER_A&&n<=d.LOWER_F)))return this.addToNumericResult(e,i,t,16),this.emitNumericEntity(r,3);t+=1}return this.addToNumericResult(e,i,t,16),-1},e.prototype.stateNumericDecimal=function(e,t){for(var n=t;t>14;t=d.UPPER_A&&e<=d.UPPER_Z||e>=d.LOWER_A&&e<=d.LOWER_Z||g(e)}(o)))?0:this.emitNotTerminatedNamedEntity();if(0!=(r=((i=n[this.treeIndex])&c.VALUE_LENGTH)>>14)){if(s===d.SEMI)return this.emitNamedEntityData(this.treeIndex,r,this.consumed+this.excess);this.decodeMode!==p.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}var o;return-1},e.prototype.emitNotTerminatedNamedEntity=function(){var e,t=this.result,n=(this.decodeTree[t]&c.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,n,this.consumed),null===(e=this.errors)||void 0===e||e.missingSemicolonAfterCharacterReference(),this.consumed},e.prototype.emitNamedEntityData=function(e,t,n){var i=this.decodeTree;return this.emitCodePoint(1===t?i[e]&~c.VALUE_LENGTH:i[e+1],n),3===t&&this.emitCodePoint(i[e+2],n),n},e.prototype.end=function(){var e;switch(this.state){case h.NamedEntity:return 0===this.result||this.decodeMode===p.Attribute&&this.result!==this.treeIndex?0:this.emitNotTerminatedNamedEntity();case h.NumericDecimal:return this.emitNumericEntity(0,2);case h.NumericHex:return this.emitNumericEntity(0,3);case h.NumericStart:return null===(e=this.errors)||void 0===e||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case h.EntityStart:return 0}},e}();function v(e){var t="",n=new m(e,(function(e){return t+=(0,u.fromCodePoint)(e)}));return function(e,i){for(var r=0,s=0;(s=e.indexOf("&",s))>=0;){t+=e.slice(r,s),n.startEntity(i);var o=n.write(e,s+1);if(o<0){r=s+n.end();break}r=s+o,s=0===o?r+1:r}var a=t+e.slice(r);return t="",a}}function b(e,t,n,i){var r=(t&c.BRANCH_LENGTH)>>7,s=t&c.JUMP_TABLE;if(0===r)return 0!==s&&i===s?n:-1;if(s){var o=i-s;return o<0||o>=r?-1:e[n+o]-1}for(var a=n,l=a+r-1;a<=l;){var u=a+l>>>1,d=e[u];if(di))return e[u+r];l=u-1}}return-1}t.EntityDecoder=m,t.determineBranch=b;var A=v(a.default),y=v(l.default);t.decodeHTML=function(e,t){return void 0===t&&(t=p.Legacy),A(e,t)},t.decodeHTMLAttribute=function(e){return A(e,p.Attribute)},t.decodeHTMLStrict=function(e){return A(e,p.Strict)},t.decodeXML=function(e){return y(e,p.Strict)}},2809:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.replaceCodePoint=t.fromCodePoint=void 0;var i=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function r(e){var t;return e>=55296&&e<=57343||e>1114111?65533:null!==(t=i.get(e))&&void 0!==t?t:e}t.fromCodePoint=null!==(n=String.fromCodePoint)&&void 0!==n?n:function(e){var t="";return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|1023&e),t+String.fromCharCode(e)},t.replaceCodePoint=r,t.default=function(e){return(0,t.fromCodePoint)(r(e))}},3231:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.encodeNonAsciiHTML=t.encodeHTML=void 0;var r=i(n(8635)),s=n(7078),o=/[\t\n!-,./:-@[-`\f{-}$\x80-\uFFFF]/g;function a(e,t){for(var n,i="",o=0;null!==(n=e.exec(t));){var a=n.index;i+=t.substring(o,a);var l=t.charCodeAt(a),u=r.default.get(l);if("object"==typeof u){if(a+1{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.escapeText=t.escapeAttribute=t.escapeUTF8=t.escape=t.encodeXML=t.getCodePoint=t.xmlReplacer=void 0,t.xmlReplacer=/["&'<>$\x80-\uFFFF]/g;var n=new Map([[34,"""],[38,"&"],[39,"'"],[60,"<"],[62,">"]]);function i(e){for(var i,r="",s=0;null!==(i=t.xmlReplacer.exec(e));){var o=i.index,a=e.charCodeAt(o),l=n.get(a);void 0!==l?(r+=e.substring(s,o)+l,s=o+1):(r+="".concat(e.substring(s,o),"&#x").concat((0,t.getCodePoint)(e,o).toString(16),";"),s=t.xmlReplacer.lastIndex+=Number(55296==(64512&a)))}return r+e.substr(s)}function r(e,t){return function(n){for(var i,r=0,s="";i=e.exec(n);)r!==i.index&&(s+=n.substring(r,i.index)),s+=t.get(i[0].charCodeAt(0)),r=i.index+1;return s+n.substring(r)}}t.getCodePoint=null!=String.prototype.codePointAt?function(e,t){return e.codePointAt(t)}:function(e,t){return 55296==(64512&e.charCodeAt(t))?1024*(e.charCodeAt(t)-55296)+e.charCodeAt(t+1)-56320+65536:e.charCodeAt(t)},t.encodeXML=i,t.escape=i,t.escapeUTF8=r(/[&<>'"]/g,n),t.escapeAttribute=r(/["&\u00A0]/g,new Map([[34,"""],[38,"&"],[160," "]])),t.escapeText=r(/[&<>\u00A0]/g,new Map([[38,"&"],[60,"<"],[62,">"],[160," "]]))},7346:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map((function(e){return e.charCodeAt(0)})))},8622:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=new Uint16Array("Ȁaglq\tɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢".split("").map((function(e){return e.charCodeAt(0)})))},8635:(e,t)=>{"use strict";function n(e){for(var t=1;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decodeXMLStrict=t.decodeHTML5Strict=t.decodeHTML4Strict=t.decodeHTML5=t.decodeHTML4=t.decodeHTMLAttribute=t.decodeHTMLStrict=t.decodeHTML=t.decodeXML=t.DecodingMode=t.EntityDecoder=t.encodeHTML5=t.encodeHTML4=t.encodeNonAsciiHTML=t.encodeHTML=t.escapeText=t.escapeAttribute=t.escapeUTF8=t.escape=t.encodeXML=t.encode=t.decodeStrict=t.decode=t.EncodingMode=t.EntityLevel=void 0;var i,r,s=n(3379),o=n(3231),a=n(7078);function l(e,t){if(void 0===t&&(t=i.XML),("number"==typeof t?t:t.level)===i.HTML){var n="object"==typeof t?t.mode:void 0;return(0,s.decodeHTML)(e,n)}return(0,s.decodeXML)(e)}!function(e){e[e.XML=0]="XML",e[e.HTML=1]="HTML"}(i=t.EntityLevel||(t.EntityLevel={})),function(e){e[e.UTF8=0]="UTF8",e[e.ASCII=1]="ASCII",e[e.Extensive=2]="Extensive",e[e.Attribute=3]="Attribute",e[e.Text=4]="Text"}(r=t.EncodingMode||(t.EncodingMode={})),t.decode=l,t.decodeStrict=function(e,t){var n;void 0===t&&(t=i.XML);var r="number"==typeof t?{level:t}:t;return null!==(n=r.mode)&&void 0!==n||(r.mode=s.DecodingMode.Strict),l(e,r)},t.encode=function(e,t){void 0===t&&(t=i.XML);var n="number"==typeof t?{level:t}:t;return n.mode===r.UTF8?(0,a.escapeUTF8)(e):n.mode===r.Attribute?(0,a.escapeAttribute)(e):n.mode===r.Text?(0,a.escapeText)(e):n.level===i.HTML?n.mode===r.ASCII?(0,o.encodeNonAsciiHTML)(e):(0,o.encodeHTML)(e):(0,a.encodeXML)(e)};var u=n(7078);Object.defineProperty(t,"encodeXML",{enumerable:!0,get:function(){return u.encodeXML}}),Object.defineProperty(t,"escape",{enumerable:!0,get:function(){return u.escape}}),Object.defineProperty(t,"escapeUTF8",{enumerable:!0,get:function(){return u.escapeUTF8}}),Object.defineProperty(t,"escapeAttribute",{enumerable:!0,get:function(){return u.escapeAttribute}}),Object.defineProperty(t,"escapeText",{enumerable:!0,get:function(){return u.escapeText}});var d=n(3231);Object.defineProperty(t,"encodeHTML",{enumerable:!0,get:function(){return d.encodeHTML}}),Object.defineProperty(t,"encodeNonAsciiHTML",{enumerable:!0,get:function(){return d.encodeNonAsciiHTML}}),Object.defineProperty(t,"encodeHTML4",{enumerable:!0,get:function(){return d.encodeHTML}}),Object.defineProperty(t,"encodeHTML5",{enumerable:!0,get:function(){return d.encodeHTML}});var c=n(3379);Object.defineProperty(t,"EntityDecoder",{enumerable:!0,get:function(){return c.EntityDecoder}}),Object.defineProperty(t,"DecodingMode",{enumerable:!0,get:function(){return c.DecodingMode}}),Object.defineProperty(t,"decodeXML",{enumerable:!0,get:function(){return c.decodeXML}}),Object.defineProperty(t,"decodeHTML",{enumerable:!0,get:function(){return c.decodeHTML}}),Object.defineProperty(t,"decodeHTMLStrict",{enumerable:!0,get:function(){return c.decodeHTMLStrict}}),Object.defineProperty(t,"decodeHTMLAttribute",{enumerable:!0,get:function(){return c.decodeHTMLAttribute}}),Object.defineProperty(t,"decodeHTML4",{enumerable:!0,get:function(){return c.decodeHTML}}),Object.defineProperty(t,"decodeHTML5",{enumerable:!0,get:function(){return c.decodeHTML}}),Object.defineProperty(t,"decodeHTML4Strict",{enumerable:!0,get:function(){return c.decodeHTMLStrict}}),Object.defineProperty(t,"decodeHTML5Strict",{enumerable:!0,get:function(){return c.decodeHTMLStrict}}),Object.defineProperty(t,"decodeXMLStrict",{enumerable:!0,get:function(){return c.decodeXML}})},2189:e=>{"use strict";e.exports=e=>{if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}},4651:function(e,t){var n;!function(t,n){"use strict";"object"==typeof e.exports?e.exports=t.document?n(t,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return n(e)}:n(t)}("undefined"!=typeof window?window:this,(function(i,r){"use strict";var s=[],o=Object.getPrototypeOf,a=s.slice,l=s.flat?function(e){return s.flat.call(e)}:function(e){return s.concat.apply([],e)},u=s.push,d=s.indexOf,c={},h=c.toString,p=c.hasOwnProperty,f=p.toString,g=f.call(Object),m={},v=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},b=function(e){return null!=e&&e===e.window},A=i.document,y={type:!0,src:!0,nonce:!0,noModule:!0};function w(e,t,n){var i,r,s=(n=n||A).createElement("script");if(s.text=e,t)for(i in y)(r=t[i]||t.getAttribute&&t.getAttribute(i))&&s.setAttribute(i,r);n.head.appendChild(s).parentNode.removeChild(s)}function _(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?c[h.call(e)]||"object":typeof e}var E="3.7.1",C=/HTML$/i,x=function(e,t){return new x.fn.init(e,t)};function D(e){var t=!!e&&"length"in e&&e.length,n=_(e);return!v(e)&&!b(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}function S(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}x.fn=x.prototype={jquery:E,constructor:x,length:0,toArray:function(){return a.call(this)},get:function(e){return null==e?a.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return x.each(this,e)},map:function(e){return this.pushStack(x.map(this,(function(t,n){return e.call(t,n,t)})))},slice:function(){return this.pushStack(a.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(x.grep(this,(function(e,t){return(t+1)%2})))},odd:function(){return this.pushStack(x.grep(this,(function(e,t){return t%2})))},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),H=new RegExp(L),W=new RegExp("^"+O+"$"),q={ID:new RegExp("^#("+O+")"),CLASS:new RegExp("^\\.("+O+")"),TAG:new RegExp("^("+O+"|[*])"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+L),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+D+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},$=/^(?:input|select|textarea|button)$/i,V=/^h\d$/i,G=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,K=/[+~]/,Y=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),J=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},X=function(){le()},Z=he((function(e){return!0===e.disabled&&S(e,"fieldset")}),{dir:"parentNode",next:"legend"});try{g.apply(s=a.call(P.childNodes),P.childNodes),s[P.childNodes.length].nodeType}catch(e){g={apply:function(e,t){R.apply(e,a.call(t))},call:function(e){R.apply(e,a.call(arguments,1))}}}function Q(e,t,n,i){var r,s,o,a,u,d,p,f=t&&t.ownerDocument,b=t?t.nodeType:9;if(n=n||[],"string"!=typeof e||!e||1!==b&&9!==b&&11!==b)return n;if(!i&&(le(t),t=t||l,c)){if(11!==b&&(u=G.exec(e)))if(r=u[1]){if(9===b){if(!(o=t.getElementById(r)))return n;if(o.id===r)return g.call(n,o),n}else if(f&&(o=f.getElementById(r))&&Q.contains(t,o)&&o.id===r)return g.call(n,o),n}else{if(u[2])return g.apply(n,t.getElementsByTagName(e)),n;if((r=u[3])&&t.getElementsByClassName)return g.apply(n,t.getElementsByClassName(r)),n}if(!(E[e+" "]||h&&h.test(e))){if(p=e,f=t,1===b&&(U.test(e)||z.test(e))){for((f=K.test(e)&&ae(t.parentNode)||t)==t&&m.scope||((a=t.getAttribute("id"))?a=x.escapeSelector(a):t.setAttribute("id",a=v)),s=(d=de(e)).length;s--;)d[s]=(a?"#"+a:":scope")+" "+ce(d[s]);p=d.join(",")}try{return g.apply(n,f.querySelectorAll(p)),n}catch(t){E(e,!0)}finally{a===v&&t.removeAttribute("id")}}}return be(e.replace(j,"$1"),t,n,i)}function ee(){var e=[];return function n(i,r){return e.push(i+" ")>t.cacheLength&&delete n[e.shift()],n[i+" "]=r}}function te(e){return e[v]=!0,e}function ne(e){var t=l.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ie(e){return function(t){return S(t,"input")&&t.type===e}}function re(e){return function(t){return(S(t,"input")||S(t,"button"))&&t.type===e}}function se(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&Z(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function oe(e){return te((function(t){return t=+t,te((function(n,i){for(var r,s=e([],n.length,t),o=s.length;o--;)n[r=s[o]]&&(n[r]=!(i[r]=n[r]))}))}))}function ae(e){return e&&void 0!==e.getElementsByTagName&&e}function le(e){var n,i=e?e.ownerDocument||e:P;return i!=l&&9===i.nodeType&&i.documentElement?(u=(l=i).documentElement,c=!x.isXMLDoc(l),f=u.matches||u.webkitMatchesSelector||u.msMatchesSelector,u.msMatchesSelector&&P!=l&&(n=l.defaultView)&&n.top!==n&&n.addEventListener("unload",X),m.getById=ne((function(e){return u.appendChild(e).id=x.expando,!l.getElementsByName||!l.getElementsByName(x.expando).length})),m.disconnectedMatch=ne((function(e){return f.call(e,"*")})),m.scope=ne((function(){return l.querySelectorAll(":scope")})),m.cssHas=ne((function(){try{return l.querySelector(":has(*,:jqfake)"),!1}catch(e){return!0}})),m.getById?(t.filter.ID=function(e){var t=e.replace(Y,J);return function(e){return e.getAttribute("id")===t}},t.find.ID=function(e,t){if(void 0!==t.getElementById&&c){var n=t.getElementById(e);return n?[n]:[]}}):(t.filter.ID=function(e){var t=e.replace(Y,J);return function(e){var n=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},t.find.ID=function(e,t){if(void 0!==t.getElementById&&c){var n,i,r,s=t.getElementById(e);if(s){if((n=s.getAttributeNode("id"))&&n.value===e)return[s];for(r=t.getElementsByName(e),i=0;s=r[i++];)if((n=s.getAttributeNode("id"))&&n.value===e)return[s]}return[]}}),t.find.TAG=function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):t.querySelectorAll(e)},t.find.CLASS=function(e,t){if(void 0!==t.getElementsByClassName&&c)return t.getElementsByClassName(e)},h=[],ne((function(e){var t;u.appendChild(e).innerHTML="",e.querySelectorAll("[selected]").length||h.push("\\["+M+"*(?:value|"+D+")"),e.querySelectorAll("[id~="+v+"-]").length||h.push("~="),e.querySelectorAll("a#"+v+"+*").length||h.push(".#.+[+~]"),e.querySelectorAll(":checked").length||h.push(":checked"),(t=l.createElement("input")).setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),u.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&h.push(":enabled",":disabled"),(t=l.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||h.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")")})),m.cssHas||h.push(":has"),h=h.length&&new RegExp(h.join("|")),C=function(e,t){if(e===t)return o=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!m.sortDetached&&t.compareDocumentPosition(e)===n?e===l||e.ownerDocument==P&&Q.contains(P,e)?-1:t===l||t.ownerDocument==P&&Q.contains(P,t)?1:r?d.call(r,e)-d.call(r,t):0:4&n?-1:1)},l):l}for(e in Q.matches=function(e,t){return Q(e,null,null,t)},Q.matchesSelector=function(e,t){if(le(e),c&&!E[t+" "]&&(!h||!h.test(t)))try{var n=f.call(e,t);if(n||m.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){E(t,!0)}return Q(t,l,null,[e]).length>0},Q.contains=function(e,t){return(e.ownerDocument||e)!=l&&le(e),x.contains(e,t)},Q.attr=function(e,n){(e.ownerDocument||e)!=l&&le(e);var i=t.attrHandle[n.toLowerCase()],r=i&&p.call(t.attrHandle,n.toLowerCase())?i(e,n,!c):void 0;return void 0!==r?r:e.getAttribute(n)},Q.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},x.uniqueSort=function(e){var t,n=[],i=0,s=0;if(o=!m.sortStable,r=!m.sortStable&&a.call(e,0),B.call(e,C),o){for(;t=e[s++];)t===e[s]&&(i=n.push(s));for(;i--;)k.call(e,n[i],1)}return r=null,e},x.fn.uniqueSort=function(){return this.pushStack(x.uniqueSort(a.apply(this)))},t=x.expr={cacheLength:50,createPseudo:te,match:q,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Y,J),e[3]=(e[3]||e[4]||e[5]||"").replace(Y,J),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||Q.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&Q.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return q.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&H.test(n)&&(t=de(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Y,J).toLowerCase();return"*"===e?function(){return!0}:function(e){return S(e,t)}},CLASS:function(e){var t=y[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&y(e,(function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")}))},ATTR:function(e,t,n){return function(i){var r=Q.attr(i,e);return null==r?"!="===t:!t||(r+="","="===t?r===n:"!="===t?r!==n:"^="===t?n&&0===r.indexOf(n):"*="===t?n&&r.indexOf(n)>-1:"$="===t?n&&r.slice(-n.length)===n:"~="===t?(" "+r.replace(N," ")+" ").indexOf(n)>-1:"|="===t&&(r===n||r.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,i,r){var s="nth"!==e.slice(0,3),o="last"!==e.slice(-4),a="of-type"===t;return 1===i&&0===r?function(e){return!!e.parentNode}:function(t,n,l){var u,d,c,h,p,f=s!==o?"nextSibling":"previousSibling",g=t.parentNode,m=a&&t.nodeName.toLowerCase(),A=!l&&!a,y=!1;if(g){if(s){for(;f;){for(c=t;c=c[f];)if(a?S(c,m):1===c.nodeType)return!1;p=f="only"===e&&!p&&"nextSibling"}return!0}if(p=[o?g.firstChild:g.lastChild],o&&A){for(y=(h=(u=(d=g[v]||(g[v]={}))[e]||[])[0]===b&&u[1])&&u[2],c=h&&g.childNodes[h];c=++h&&c&&c[f]||(y=h=0)||p.pop();)if(1===c.nodeType&&++y&&c===t){d[e]=[b,h,y];break}}else if(A&&(y=h=(u=(d=t[v]||(t[v]={}))[e]||[])[0]===b&&u[1]),!1===y)for(;(c=++h&&c&&c[f]||(y=h=0)||p.pop())&&(!(a?S(c,m):1===c.nodeType)||!++y||(A&&((d=c[v]||(c[v]={}))[e]=[b,y]),c!==t)););return(y-=r)===i||y%i==0&&y/i>=0}}},PSEUDO:function(e,n){var i,r=t.pseudos[e]||t.setFilters[e.toLowerCase()]||Q.error("unsupported pseudo: "+e);return r[v]?r(n):r.length>1?(i=[e,e,"",n],t.setFilters.hasOwnProperty(e.toLowerCase())?te((function(e,t){for(var i,s=r(e,n),o=s.length;o--;)e[i=d.call(e,s[o])]=!(t[i]=s[o])})):function(e){return r(e,0,i)}):r}},pseudos:{not:te((function(e){var t=[],n=[],i=ve(e.replace(j,"$1"));return i[v]?te((function(e,t,n,r){for(var s,o=i(e,null,r,[]),a=e.length;a--;)(s=o[a])&&(e[a]=!(t[a]=s))})):function(e,r,s){return t[0]=e,i(t,null,s,n),t[0]=null,!n.pop()}})),has:te((function(e){return function(t){return Q(e,t).length>0}})),contains:te((function(e){return e=e.replace(Y,J),function(t){return(t.textContent||x.text(t)).indexOf(e)>-1}})),lang:te((function(e){return W.test(e||"")||Q.error("unsupported lang: "+e),e=e.replace(Y,J).toLowerCase(),function(t){var n;do{if(n=c?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}})),target:function(e){var t=i.location&&i.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===u},focus:function(e){return e===function(){try{return l.activeElement}catch(e){}}()&&l.hasFocus()&&!!(e.type||e.href||~e.tabIndex)},enabled:se(!1),disabled:se(!0),checked:function(e){return S(e,"input")&&!!e.checked||S(e,"option")&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!t.pseudos.empty(e)},header:function(e){return V.test(e.nodeName)},input:function(e){return $.test(e.nodeName)},button:function(e){return S(e,"input")&&"button"===e.type||S(e,"button")},text:function(e){var t;return S(e,"input")&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:oe((function(){return[0]})),last:oe((function(e,t){return[t-1]})),eq:oe((function(e,t,n){return[n<0?n+t:n]})),even:oe((function(e,t){for(var n=0;nt?t:n;--i>=0;)e.push(i);return e})),gt:oe((function(e,t,n){for(var i=n<0?n+t:n;++i1?function(t,n,i){for(var r=e.length;r--;)if(!e[r](t,n,i))return!1;return!0}:e[0]}function fe(e,t,n,i,r){for(var s,o=[],a=0,l=e.length,u=null!=t;a-1&&(s[u]=!(o[u]=h))}}else p=fe(p===o?p.splice(v,p.length):p),r?r(null,o,p,l):g.apply(o,p)}))}function me(e){for(var i,r,s,o=e.length,a=t.relative[e[0].type],l=a||t.relative[" "],u=a?1:0,c=he((function(e){return e===i}),l,!0),h=he((function(e){return d.call(i,e)>-1}),l,!0),p=[function(e,t,r){var s=!a&&(r||t!=n)||((i=t).nodeType?c(e,t,r):h(e,t,r));return i=null,s}];u1&&pe(p),u>1&&ce(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace(j,"$1"),r,u0,s=e.length>0,o=function(o,a,u,d,h){var p,f,m,v=0,A="0",y=o&&[],w=[],_=n,E=o||s&&t.find.TAG("*",h),C=b+=null==_?1:Math.random()||.1,D=E.length;for(h&&(n=a==l||a||h);A!==D&&null!=(p=E[A]);A++){if(s&&p){for(f=0,a||p.ownerDocument==l||(le(p),u=!c);m=e[f++];)if(m(p,a||l,u)){g.call(d,p);break}h&&(b=C)}r&&((p=!m&&p)&&v--,o&&y.push(p))}if(v+=A,r&&A!==v){for(f=0;m=i[f++];)m(y,w,a,u);if(o){if(v>0)for(;A--;)y[A]||w[A]||(w[A]=T.call(d));w=fe(w)}g.apply(d,w),h&&!o&&w.length>0&&v+i.length>1&&x.uniqueSort(d)}return h&&(b=C,n=_),y};return r?te(o):o}(o,s)),a.selector=e}return a}function be(e,n,i,r){var s,o,a,l,u,d="function"==typeof e&&e,h=!r&&de(e=d.selector||e);if(i=i||[],1===h.length){if((o=h[0]=h[0].slice(0)).length>2&&"ID"===(a=o[0]).type&&9===n.nodeType&&c&&t.relative[o[1].type]){if(!(n=(t.find.ID(a.matches[0].replace(Y,J),n)||[])[0]))return i;d&&(n=n.parentNode),e=e.slice(o.shift().value.length)}for(s=q.needsContext.test(e)?0:o.length;s--&&(a=o[s],!t.relative[l=a.type]);)if((u=t.find[l])&&(r=u(a.matches[0].replace(Y,J),K.test(o[0].type)&&ae(n.parentNode)||n))){if(o.splice(s,1),!(e=r.length&&ce(o)))return g.apply(i,r),i;break}}return(d||ve(e,h))(r,n,!c,i,!n||K.test(e)&&ae(n.parentNode)||n),i}ue.prototype=t.filters=t.pseudos,t.setFilters=new ue,m.sortStable=v.split("").sort(C).join("")===v,le(),m.sortDetached=ne((function(e){return 1&e.compareDocumentPosition(l.createElement("fieldset"))})),x.find=Q,x.expr[":"]=x.expr.pseudos,x.unique=x.uniqueSort,Q.compile=ve,Q.select=be,Q.setDocument=le,Q.tokenize=de,Q.escape=x.escapeSelector,Q.getText=x.text,Q.isXML=x.isXMLDoc,Q.selectors=x.expr,Q.support=x.support,Q.uniqueSort=x.uniqueSort}();var L=function(e,t,n){for(var i=[],r=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(r&&x(e).is(n))break;i.push(e)}return i},N=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},F=x.expr.match.needsContext,z=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function U(e,t,n){return v(t)?x.grep(e,(function(e,i){return!!t.call(e,i,e)!==n})):t.nodeType?x.grep(e,(function(e){return e===t!==n})):"string"!=typeof t?x.grep(e,(function(e){return d.call(t,e)>-1!==n})):x.filter(t,e,n)}x.filter=function(e,t,n){var i=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===i.nodeType?x.find.matchesSelector(i,e)?[i]:[]:x.find.matches(e,x.grep(t,(function(e){return 1===e.nodeType})))},x.fn.extend({find:function(e){var t,n,i=this.length,r=this;if("string"!=typeof e)return this.pushStack(x(e).filter((function(){for(t=0;t1?x.uniqueSort(n):n},filter:function(e){return this.pushStack(U(this,e||[],!1))},not:function(e){return this.pushStack(U(this,e||[],!0))},is:function(e){return!!U(this,"string"==typeof e&&F.test(e)?x(e):e||[],!1).length}});var H,W=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(x.fn.init=function(e,t,n){var i,r;if(!e)return this;if(n=n||H,"string"==typeof e){if(!(i="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:W.exec(e))||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof x?t[0]:t,x.merge(this,x.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:A,!0)),z.test(i[1])&&x.isPlainObject(t))for(i in t)v(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(r=A.getElementById(i[2]))&&(this[0]=r,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):v(e)?void 0!==n.ready?n.ready(e):e(x):x.makeArray(e,this)}).prototype=x.fn,H=x(A);var q=/^(?:parents|prev(?:Until|All))/,$={children:!0,contents:!0,next:!0,prev:!0};function V(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}x.fn.extend({has:function(e){var t=x(e,this),n=t.length;return this.filter((function(){for(var e=0;e-1:1===n.nodeType&&x.find.matchesSelector(n,e))){s.push(n);break}return this.pushStack(s.length>1?x.uniqueSort(s):s)},index:function(e){return e?"string"==typeof e?d.call(x(e),this[0]):d.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(x.uniqueSort(x.merge(this.get(),x(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return L(e,"parentNode")},parentsUntil:function(e,t,n){return L(e,"parentNode",n)},next:function(e){return V(e,"nextSibling")},prev:function(e){return V(e,"previousSibling")},nextAll:function(e){return L(e,"nextSibling")},prevAll:function(e){return L(e,"previousSibling")},nextUntil:function(e,t,n){return L(e,"nextSibling",n)},prevUntil:function(e,t,n){return L(e,"previousSibling",n)},siblings:function(e){return N((e.parentNode||{}).firstChild,e)},children:function(e){return N(e.firstChild)},contents:function(e){return null!=e.contentDocument&&o(e.contentDocument)?e.contentDocument:(S(e,"template")&&(e=e.content||e),x.merge([],e.childNodes))}},(function(e,t){x.fn[e]=function(n,i){var r=x.map(this,t,n);return"Until"!==e.slice(-5)&&(i=n),i&&"string"==typeof i&&(r=x.filter(i,r)),this.length>1&&($[e]||x.uniqueSort(r),q.test(e)&&r.reverse()),this.pushStack(r)}}));var G=/[^\x20\t\r\n\f]+/g;function K(e){return e}function Y(e){throw e}function J(e,t,n,i){var r;try{e&&v(r=e.promise)?r.call(e).done(t).fail(n):e&&v(r=e.then)?r.call(e,t,n):t.apply(void 0,[e].slice(i))}catch(e){n.apply(void 0,[e])}}x.Callbacks=function(e){e="string"==typeof e?function(e){var t={};return x.each(e.match(G)||[],(function(e,n){t[n]=!0})),t}(e):x.extend({},e);var t,n,i,r,s=[],o=[],a=-1,l=function(){for(r=r||e.once,i=t=!0;o.length;a=-1)for(n=o.shift();++a-1;)s.splice(n,1),n<=a&&a--})),this},has:function(e){return e?x.inArray(e,s)>-1:s.length>0},empty:function(){return s&&(s=[]),this},disable:function(){return r=o=[],s=n="",this},disabled:function(){return!s},lock:function(){return r=o=[],n||t||(s=n=""),this},locked:function(){return!!r},fireWith:function(e,n){return r||(n=[e,(n=n||[]).slice?n.slice():n],o.push(n),t||l()),this},fire:function(){return u.fireWith(this,arguments),this},fired:function(){return!!i}};return u},x.extend({Deferred:function(e){var t=[["notify","progress",x.Callbacks("memory"),x.Callbacks("memory"),2],["resolve","done",x.Callbacks("once memory"),x.Callbacks("once memory"),0,"resolved"],["reject","fail",x.Callbacks("once memory"),x.Callbacks("once memory"),1,"rejected"]],n="pending",r={state:function(){return n},always:function(){return s.done(arguments).fail(arguments),this},catch:function(e){return r.then(null,e)},pipe:function(){var e=arguments;return x.Deferred((function(n){x.each(t,(function(t,i){var r=v(e[i[4]])&&e[i[4]];s[i[1]]((function(){var e=r&&r.apply(this,arguments);e&&v(e.promise)?e.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[i[0]+"With"](this,r?[e]:arguments)}))})),e=null})).promise()},then:function(e,n,r){var s=0;function o(e,t,n,r){return function(){var a=this,l=arguments,u=function(){var i,u;if(!(e=s&&(n!==Y&&(a=void 0,l=[i]),t.rejectWith(a,l))}};e?d():(x.Deferred.getErrorHook?d.error=x.Deferred.getErrorHook():x.Deferred.getStackHook&&(d.error=x.Deferred.getStackHook()),i.setTimeout(d))}}return x.Deferred((function(i){t[0][3].add(o(0,i,v(r)?r:K,i.notifyWith)),t[1][3].add(o(0,i,v(e)?e:K)),t[2][3].add(o(0,i,v(n)?n:Y))})).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},s={};return x.each(t,(function(e,i){var o=i[2],a=i[5];r[i[1]]=o.add,a&&o.add((function(){n=a}),t[3-e][2].disable,t[3-e][3].disable,t[0][2].lock,t[0][3].lock),o.add(i[3].fire),s[i[0]]=function(){return s[i[0]+"With"](this===s?void 0:this,arguments),this},s[i[0]+"With"]=o.fireWith})),r.promise(s),e&&e.call(s,s),s},when:function(e){var t=arguments.length,n=t,i=Array(n),r=a.call(arguments),s=x.Deferred(),o=function(e){return function(n){i[e]=this,r[e]=arguments.length>1?a.call(arguments):n,--t||s.resolveWith(i,r)}};if(t<=1&&(J(e,s.done(o(n)).resolve,s.reject,!t),"pending"===s.state()||v(r[n]&&r[n].then)))return s.then();for(;n--;)J(r[n],o(n),s.reject);return s.promise()}});var X=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;x.Deferred.exceptionHook=function(e,t){i.console&&i.console.warn&&e&&X.test(e.name)&&i.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},x.readyException=function(e){i.setTimeout((function(){throw e}))};var Z=x.Deferred();function Q(){A.removeEventListener("DOMContentLoaded",Q),i.removeEventListener("load",Q),x.ready()}x.fn.ready=function(e){return Z.then(e).catch((function(e){x.readyException(e)})),this},x.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--x.readyWait:x.isReady)||(x.isReady=!0,!0!==e&&--x.readyWait>0||Z.resolveWith(A,[x]))}}),x.ready.then=Z.then,"complete"===A.readyState||"loading"!==A.readyState&&!A.documentElement.doScroll?i.setTimeout(x.ready):(A.addEventListener("DOMContentLoaded",Q),i.addEventListener("load",Q));var ee=function(e,t,n,i,r,s,o){var a=0,l=e.length,u=null==n;if("object"===_(n))for(a in r=!0,n)ee(e,t,a,n[a],!0,s,o);else if(void 0!==i&&(r=!0,v(i)||(o=!0),u&&(o?(t.call(e,i),t=null):(u=t,t=function(e,t,n){return u.call(x(e),n)})),t))for(;a1,null,!0)},removeData:function(e){return this.each((function(){le.remove(this,e)}))}}),x.extend({queue:function(e,t,n){var i;if(e)return t=(t||"fx")+"queue",i=ae.get(e,t),n&&(!i||Array.isArray(n)?i=ae.access(e,t,x.makeArray(n)):i.push(n)),i||[]},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),i=n.length,r=n.shift(),s=x._queueHooks(e,t);"inprogress"===r&&(r=n.shift(),i--),r&&("fx"===t&&n.unshift("inprogress"),delete s.stop,r.call(e,(function(){x.dequeue(e,t)}),s)),!i&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return ae.get(e,n)||ae.access(e,n,{empty:x.Callbacks("once memory").add((function(){ae.remove(e,[t+"queue",n])}))})}}),x.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length\x20\t\r\n\f]*)/i,Se=/^$|^module$|\/(?:java|ecma)script/i;Ee=A.createDocumentFragment().appendChild(A.createElement("div")),(Ce=A.createElement("input")).setAttribute("type","radio"),Ce.setAttribute("checked","checked"),Ce.setAttribute("name","t"),Ee.appendChild(Ce),m.checkClone=Ee.cloneNode(!0).cloneNode(!0).lastChild.checked,Ee.innerHTML="",m.noCloneChecked=!!Ee.cloneNode(!0).lastChild.defaultValue,Ee.innerHTML="",m.option=!!Ee.lastChild;var Te={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function Be(e,t){var n;return n=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&S(e,t)?x.merge([e],n):n}function ke(e,t){for(var n=0,i=e.length;n",""]);var Me=/<|&#?\w+;/;function je(e,t,n,i,r){for(var s,o,a,l,u,d,c=t.createDocumentFragment(),h=[],p=0,f=e.length;p-1)r&&r.push(s);else if(u=me(s),o=Be(c.appendChild(s),"script"),u&&ke(o),n)for(d=0;s=o[d++];)Se.test(s.type||"")&&n.push(s);return c}var Oe=/^([^.]*)(?:\.(.+)|)/;function Ie(){return!0}function Pe(){return!1}function Re(e,t,n,i,r,s){var o,a;if("object"==typeof t){for(a in"string"!=typeof n&&(i=i||n,n=void 0),t)Re(e,a,n,i,t[a],s);return e}if(null==i&&null==r?(r=n,i=n=void 0):null==r&&("string"==typeof n?(r=i,i=void 0):(r=i,i=n,n=void 0)),!1===r)r=Pe;else if(!r)return e;return 1===s&&(o=r,r=function(e){return x().off(e),o.apply(this,arguments)},r.guid=o.guid||(o.guid=x.guid++)),e.each((function(){x.event.add(this,t,r,i,n)}))}function Le(e,t,n){n?(ae.set(e,t,!1),x.event.add(e,t,{namespace:!1,handler:function(e){var n,i=ae.get(this,t);if(1&e.isTrigger&&this[t]){if(i)(x.event.special[t]||{}).delegateType&&e.stopPropagation();else if(i=a.call(arguments),ae.set(this,t,i),this[t](),n=ae.get(this,t),ae.set(this,t,!1),i!==n)return e.stopImmediatePropagation(),e.preventDefault(),n}else i&&(ae.set(this,t,x.event.trigger(i[0],i.slice(1),this)),e.stopPropagation(),e.isImmediatePropagationStopped=Ie)}})):void 0===ae.get(e,t)&&x.event.add(e,t,Ie)}x.event={global:{},add:function(e,t,n,i,r){var s,o,a,l,u,d,c,h,p,f,g,m=ae.get(e);if(se(e))for(n.handler&&(n=(s=n).handler,r=s.selector),r&&x.find.matchesSelector(ge,r),n.guid||(n.guid=x.guid++),(l=m.events)||(l=m.events=Object.create(null)),(o=m.handle)||(o=m.handle=function(t){return void 0!==x&&x.event.triggered!==t.type?x.event.dispatch.apply(e,arguments):void 0}),u=(t=(t||"").match(G)||[""]).length;u--;)p=g=(a=Oe.exec(t[u])||[])[1],f=(a[2]||"").split(".").sort(),p&&(c=x.event.special[p]||{},p=(r?c.delegateType:c.bindType)||p,c=x.event.special[p]||{},d=x.extend({type:p,origType:g,data:i,handler:n,guid:n.guid,selector:r,needsContext:r&&x.expr.match.needsContext.test(r),namespace:f.join(".")},s),(h=l[p])||((h=l[p]=[]).delegateCount=0,c.setup&&!1!==c.setup.call(e,i,f,o)||e.addEventListener&&e.addEventListener(p,o)),c.add&&(c.add.call(e,d),d.handler.guid||(d.handler.guid=n.guid)),r?h.splice(h.delegateCount++,0,d):h.push(d),x.event.global[p]=!0)},remove:function(e,t,n,i,r){var s,o,a,l,u,d,c,h,p,f,g,m=ae.hasData(e)&&ae.get(e);if(m&&(l=m.events)){for(u=(t=(t||"").match(G)||[""]).length;u--;)if(p=g=(a=Oe.exec(t[u])||[])[1],f=(a[2]||"").split(".").sort(),p){for(c=x.event.special[p]||{},h=l[p=(i?c.delegateType:c.bindType)||p]||[],a=a[2]&&new RegExp("(^|\\.)"+f.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=s=h.length;s--;)d=h[s],!r&&g!==d.origType||n&&n.guid!==d.guid||a&&!a.test(d.namespace)||i&&i!==d.selector&&("**"!==i||!d.selector)||(h.splice(s,1),d.selector&&h.delegateCount--,c.remove&&c.remove.call(e,d));o&&!h.length&&(c.teardown&&!1!==c.teardown.call(e,f,m.handle)||x.removeEvent(e,p,m.handle),delete l[p])}else for(p in l)x.event.remove(e,p+t[u],n,i,!0);x.isEmptyObject(l)&&ae.remove(e,"handle events")}},dispatch:function(e){var t,n,i,r,s,o,a=new Array(arguments.length),l=x.event.fix(e),u=(ae.get(this,"events")||Object.create(null))[l.type]||[],d=x.event.special[l.type]||{};for(a[0]=l,t=1;t=1))for(;u!==this;u=u.parentNode||this)if(1===u.nodeType&&("click"!==e.type||!0!==u.disabled)){for(s=[],o={},n=0;n-1:x.find(r,this,null,[u]).length),o[r]&&s.push(i);s.length&&a.push({elem:u,handlers:s})}return u=this,l\s*$/g;function Ue(e,t){return S(e,"table")&&S(11!==t.nodeType?t:t.firstChild,"tr")&&x(e).children("tbody")[0]||e}function He(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function We(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function qe(e,t){var n,i,r,s,o,a;if(1===t.nodeType){if(ae.hasData(e)&&(a=ae.get(e).events))for(r in ae.remove(t,"handle events"),a)for(n=0,i=a[r].length;n1&&"string"==typeof f&&!m.checkClone&&Fe.test(f))return e.each((function(r){var s=e.eq(r);g&&(t[0]=f.call(this,r,s.html())),Ve(s,t,n,i)}));if(h&&(s=(r=je(t,e[0].ownerDocument,!1,e,i)).firstChild,1===r.childNodes.length&&(r=s),s||i)){for(a=(o=x.map(Be(r,"script"),He)).length;c0&&ke(o,!l&&Be(e,"script")),a},cleanData:function(e){for(var t,n,i,r=x.event.special,s=0;void 0!==(n=e[s]);s++)if(se(n)){if(t=n[ae.expando]){if(t.events)for(i in t.events)r[i]?x.event.remove(n,i):x.removeEvent(n,i,t.handle);n[ae.expando]=void 0}n[le.expando]&&(n[le.expando]=void 0)}}}),x.fn.extend({detach:function(e){return Ge(this,e,!0)},remove:function(e){return Ge(this,e)},text:function(e){return ee(this,(function(e){return void 0===e?x.text(this):this.empty().each((function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)}))}),null,e,arguments.length)},append:function(){return Ve(this,arguments,(function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Ue(this,e).appendChild(e)}))},prepend:function(){return Ve(this,arguments,(function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Ue(this,e);t.insertBefore(e,t.firstChild)}}))},before:function(){return Ve(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this)}))},after:function(){return Ve(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)}))},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(x.cleanData(Be(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map((function(){return x.clone(this,e,t)}))},html:function(e){return ee(this,(function(e){var t=this[0]||{},n=0,i=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ne.test(e)&&!Te[(De.exec(e)||["",""])[1].toLowerCase()]){e=x.htmlPrefilter(e);try{for(;n=0&&(l+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-s-l-a-.5))||0),l+u}function dt(e,t,n){var i=Je(e),r=(!m.boxSizingReliable()||n)&&"border-box"===x.css(e,"boxSizing",!1,i),s=r,o=Qe(e,t,i),a="offset"+t[0].toUpperCase()+t.slice(1);if(Ke.test(o)){if(!n)return o;o="auto"}return(!m.boxSizingReliable()&&r||!m.reliableTrDimensions()&&S(e,"tr")||"auto"===o||!parseFloat(o)&&"inline"===x.css(e,"display",!1,i))&&e.getClientRects().length&&(r="border-box"===x.css(e,"boxSizing",!1,i),(s=a in e)&&(o=e[a])),(o=parseFloat(o)||0)+ut(e,t,n||(r?"border":"content"),s,i,o)+"px"}function ct(e,t,n,i,r){return new ct.prototype.init(e,t,n,i,r)}x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Qe(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,aspectRatio:!0,borderImageSlice:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,scale:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeMiterlimit:!0,strokeOpacity:!0},cssProps:{},style:function(e,t,n,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var r,s,o,a=re(t),l=Ye.test(t),u=e.style;if(l||(t=rt(a)),o=x.cssHooks[t]||x.cssHooks[a],void 0===n)return o&&"get"in o&&void 0!==(r=o.get(e,!1,i))?r:u[t];"string"==(s=typeof n)&&(r=pe.exec(n))&&r[1]&&(n=Ae(e,t,r),s="number"),null!=n&&n==n&&("number"!==s||l||(n+=r&&r[3]||(x.cssNumber[a]?"":"px")),m.clearCloneStyle||""!==n||0!==t.indexOf("background")||(u[t]="inherit"),o&&"set"in o&&void 0===(n=o.set(e,n,i))||(l?u.setProperty(t,n):u[t]=n))}},css:function(e,t,n,i){var r,s,o,a=re(t);return Ye.test(t)||(t=rt(a)),(o=x.cssHooks[t]||x.cssHooks[a])&&"get"in o&&(r=o.get(e,!0,n)),void 0===r&&(r=Qe(e,t,i)),"normal"===r&&t in at&&(r=at[t]),""===n||n?(s=parseFloat(r),!0===n||isFinite(s)?s||0:r):r}}),x.each(["height","width"],(function(e,t){x.cssHooks[t]={get:function(e,n,i){if(n)return!st.test(x.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?dt(e,t,i):Xe(e,ot,(function(){return dt(e,t,i)}))},set:function(e,n,i){var r,s=Je(e),o=!m.scrollboxSize()&&"absolute"===s.position,a=(o||i)&&"border-box"===x.css(e,"boxSizing",!1,s),l=i?ut(e,t,i,a,s):0;return a&&o&&(l-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(s[t])-ut(e,t,"border",!1,s)-.5)),l&&(r=pe.exec(n))&&"px"!==(r[3]||"px")&&(e.style[t]=n,n=x.css(e,t)),lt(0,n,l)}}})),x.cssHooks.marginLeft=et(m.reliableMarginLeft,(function(e,t){if(t)return(parseFloat(Qe(e,"marginLeft"))||e.getBoundingClientRect().left-Xe(e,{marginLeft:0},(function(){return e.getBoundingClientRect().left})))+"px"})),x.each({margin:"",padding:"",border:"Width"},(function(e,t){x.cssHooks[e+t]={expand:function(n){for(var i=0,r={},s="string"==typeof n?n.split(" "):[n];i<4;i++)r[e+fe[i]+t]=s[i]||s[i-2]||s[0];return r}},"margin"!==e&&(x.cssHooks[e+t].set=lt)})),x.fn.extend({css:function(e,t){return ee(this,(function(e,t,n){var i,r,s={},o=0;if(Array.isArray(t)){for(i=Je(e),r=t.length;o1)}}),x.Tween=ct,ct.prototype={constructor:ct,init:function(e,t,n,i,r,s){this.elem=e,this.prop=n,this.easing=r||x.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=i,this.unit=s||(x.cssNumber[n]?"":"px")},cur:function(){var e=ct.propHooks[this.prop];return e&&e.get?e.get(this):ct.propHooks._default.get(this)},run:function(e){var t,n=ct.propHooks[this.prop];return this.options.duration?this.pos=t=x.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):ct.propHooks._default.set(this),this}},ct.prototype.init.prototype=ct.prototype,ct.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=x.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):1!==e.elem.nodeType||!x.cssHooks[e.prop]&&null==e.elem.style[rt(e.prop)]?e.elem[e.prop]=e.now:x.style(e.elem,e.prop,e.now+e.unit)}}},ct.propHooks.scrollTop=ct.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},x.fx=ct.prototype.init,x.fx.step={};var ht,pt,ft=/^(?:toggle|show|hide)$/,gt=/queueHooks$/;function mt(){pt&&(!1===A.hidden&&i.requestAnimationFrame?i.requestAnimationFrame(mt):i.setTimeout(mt,x.fx.interval),x.fx.tick())}function vt(){return i.setTimeout((function(){ht=void 0})),ht=Date.now()}function bt(e,t){var n,i=0,r={height:e};for(t=t?1:0;i<4;i+=2-t)r["margin"+(n=fe[i])]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function At(e,t,n){for(var i,r=(yt.tweeners[t]||[]).concat(yt.tweeners["*"]),s=0,o=r.length;s1)},removeAttr:function(e){return this.each((function(){x.removeAttr(this,e)}))}}),x.extend({attr:function(e,t,n){var i,r,s=e.nodeType;if(3!==s&&8!==s&&2!==s)return void 0===e.getAttribute?x.prop(e,t,n):(1===s&&x.isXMLDoc(e)||(r=x.attrHooks[t.toLowerCase()]||(x.expr.match.bool.test(t)?wt:void 0)),void 0!==n?null===n?void x.removeAttr(e,t):r&&"set"in r&&void 0!==(i=r.set(e,n,t))?i:(e.setAttribute(t,n+""),n):r&&"get"in r&&null!==(i=r.get(e,t))?i:null==(i=x.find.attr(e,t))?void 0:i)},attrHooks:{type:{set:function(e,t){if(!m.radioValue&&"radio"===t&&S(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,i=0,r=t&&t.match(G);if(r&&1===e.nodeType)for(;n=r[i++];)e.removeAttribute(n)}}),wt={set:function(e,t,n){return!1===t?x.removeAttr(e,n):e.setAttribute(n,n),n}},x.each(x.expr.match.bool.source.match(/\w+/g),(function(e,t){var n=_t[t]||x.find.attr;_t[t]=function(e,t,i){var r,s,o=t.toLowerCase();return i||(s=_t[o],_t[o]=r,r=null!=n(e,t,i)?o:null,_t[o]=s),r}}));var Et=/^(?:input|select|textarea|button)$/i,Ct=/^(?:a|area)$/i;function xt(e){return(e.match(G)||[]).join(" ")}function Dt(e){return e.getAttribute&&e.getAttribute("class")||""}function St(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(G)||[]}x.fn.extend({prop:function(e,t){return ee(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each((function(){delete this[x.propFix[e]||e]}))}}),x.extend({prop:function(e,t,n){var i,r,s=e.nodeType;if(3!==s&&8!==s&&2!==s)return 1===s&&x.isXMLDoc(e)||(t=x.propFix[t]||t,r=x.propHooks[t]),void 0!==n?r&&"set"in r&&void 0!==(i=r.set(e,n,t))?i:e[t]=n:r&&"get"in r&&null!==(i=r.get(e,t))?i:e[t]},propHooks:{tabIndex:{get:function(e){var t=x.find.attr(e,"tabindex");return t?parseInt(t,10):Et.test(e.nodeName)||Ct.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),m.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){x.propFix[this.toLowerCase()]=this})),x.fn.extend({addClass:function(e){var t,n,i,r,s,o;return v(e)?this.each((function(t){x(this).addClass(e.call(this,t,Dt(this)))})):(t=St(e)).length?this.each((function(){if(i=Dt(this),n=1===this.nodeType&&" "+xt(i)+" "){for(s=0;s-1;)n=n.replace(" "+r+" "," ");o=xt(n),i!==o&&this.setAttribute("class",o)}})):this:this.attr("class","")},toggleClass:function(e,t){var n,i,r,s,o=typeof e,a="string"===o||Array.isArray(e);return v(e)?this.each((function(n){x(this).toggleClass(e.call(this,n,Dt(this),t),t)})):"boolean"==typeof t&&a?t?this.addClass(e):this.removeClass(e):(n=St(e),this.each((function(){if(a)for(s=x(this),r=0;r-1)return!0;return!1}});var Tt=/\r/g;x.fn.extend({val:function(e){var t,n,i,r=this[0];return arguments.length?(i=v(e),this.each((function(n){var r;1===this.nodeType&&(null==(r=i?e.call(this,n,x(this).val()):e)?r="":"number"==typeof r?r+="":Array.isArray(r)&&(r=x.map(r,(function(e){return null==e?"":e+""}))),(t=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,r,"value")||(this.value=r))}))):r?(t=x.valHooks[r.type]||x.valHooks[r.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(r,"value"))?n:"string"==typeof(n=r.value)?n.replace(Tt,""):null==n?"":n:void 0}}),x.extend({valHooks:{option:{get:function(e){var t=x.find.attr(e,"value");return null!=t?t:xt(x.text(e))}},select:{get:function(e){var t,n,i,r=e.options,s=e.selectedIndex,o="select-one"===e.type,a=o?null:[],l=o?s+1:r.length;for(i=s<0?l:o?s:0;i-1)&&(n=!0);return n||(e.selectedIndex=-1),s}}}}),x.each(["radio","checkbox"],(function(){x.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=x.inArray(x(e).val(),t)>-1}},m.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}));var Bt=i.location,kt={guid:Date.now()},Mt=/\?/;x.parseXML=function(e){var t,n;if(!e||"string"!=typeof e)return null;try{t=(new i.DOMParser).parseFromString(e,"text/xml")}catch(e){}return n=t&&t.getElementsByTagName("parsererror")[0],t&&!n||x.error("Invalid XML: "+(n?x.map(n.childNodes,(function(e){return e.textContent})).join("\n"):e)),t};var jt=/^(?:focusinfocus|focusoutblur)$/,Ot=function(e){e.stopPropagation()};x.extend(x.event,{trigger:function(e,t,n,r){var s,o,a,l,u,d,c,h,f=[n||A],g=p.call(e,"type")?e.type:e,m=p.call(e,"namespace")?e.namespace.split("."):[];if(o=h=a=n=n||A,3!==n.nodeType&&8!==n.nodeType&&!jt.test(g+x.event.triggered)&&(g.indexOf(".")>-1&&(m=g.split("."),g=m.shift(),m.sort()),u=g.indexOf(":")<0&&"on"+g,(e=e[x.expando]?e:new x.Event(g,"object"==typeof e&&e)).isTrigger=r?2:3,e.namespace=m.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:x.makeArray(t,[e]),c=x.event.special[g]||{},r||!c.trigger||!1!==c.trigger.apply(n,t))){if(!r&&!c.noBubble&&!b(n)){for(l=c.delegateType||g,jt.test(l+g)||(o=o.parentNode);o;o=o.parentNode)f.push(o),a=o;a===(n.ownerDocument||A)&&f.push(a.defaultView||a.parentWindow||i)}for(s=0;(o=f[s++])&&!e.isPropagationStopped();)h=o,e.type=s>1?l:c.bindType||g,(d=(ae.get(o,"events")||Object.create(null))[e.type]&&ae.get(o,"handle"))&&d.apply(o,t),(d=u&&o[u])&&d.apply&&se(o)&&(e.result=d.apply(o,t),!1===e.result&&e.preventDefault());return e.type=g,r||e.isDefaultPrevented()||c._default&&!1!==c._default.apply(f.pop(),t)||!se(n)||u&&v(n[g])&&!b(n)&&((a=n[u])&&(n[u]=null),x.event.triggered=g,e.isPropagationStopped()&&h.addEventListener(g,Ot),n[g](),e.isPropagationStopped()&&h.removeEventListener(g,Ot),x.event.triggered=void 0,a&&(n[u]=a)),e.result}},simulate:function(e,t,n){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0});x.event.trigger(i,null,t)}}),x.fn.extend({trigger:function(e,t){return this.each((function(){x.event.trigger(e,t,this)}))},triggerHandler:function(e,t){var n=this[0];if(n)return x.event.trigger(e,t,n,!0)}});var It=/\[\]$/,Pt=/\r?\n/g,Rt=/^(?:submit|button|image|reset|file)$/i,Lt=/^(?:input|select|textarea|keygen)/i;function Nt(e,t,n,i){var r;if(Array.isArray(t))x.each(t,(function(t,r){n||It.test(e)?i(e,r):Nt(e+"["+("object"==typeof r&&null!=r?t:"")+"]",r,n,i)}));else if(n||"object"!==_(t))i(e,t);else for(r in t)Nt(e+"["+r+"]",t[r],n,i)}x.param=function(e,t){var n,i=[],r=function(e,t){var n=v(t)?t():t;i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!x.isPlainObject(e))x.each(e,(function(){r(this.name,this.value)}));else for(n in e)Nt(n,e[n],t,r);return i.join("&")},x.fn.extend({serialize:function(){return x.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var e=x.prop(this,"elements");return e?x.makeArray(e):this})).filter((function(){var e=this.type;return this.name&&!x(this).is(":disabled")&&Lt.test(this.nodeName)&&!Rt.test(e)&&(this.checked||!xe.test(e))})).map((function(e,t){var n=x(this).val();return null==n?null:Array.isArray(n)?x.map(n,(function(e){return{name:t.name,value:e.replace(Pt,"\r\n")}})):{name:t.name,value:n.replace(Pt,"\r\n")}})).get()}});var Ft=/%20/g,zt=/#.*$/,Ut=/([?&])_=[^&]*/,Ht=/^(.*?):[ \t]*([^\r\n]*)$/gm,Wt=/^(?:GET|HEAD)$/,qt=/^\/\//,$t={},Vt={},Gt="*/".concat("*"),Kt=A.createElement("a");function Yt(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var i,r=0,s=t.toLowerCase().match(G)||[];if(v(n))for(;i=s[r++];)"+"===i[0]?(i=i.slice(1)||"*",(e[i]=e[i]||[]).unshift(n)):(e[i]=e[i]||[]).push(n)}}function Jt(e,t,n,i){var r={},s=e===Vt;function o(a){var l;return r[a]=!0,x.each(e[a]||[],(function(e,a){var u=a(t,n,i);return"string"!=typeof u||s||r[u]?s?!(l=u):void 0:(t.dataTypes.unshift(u),o(u),!1)})),l}return o(t.dataTypes[0])||!r["*"]&&o("*")}function Xt(e,t){var n,i,r=x.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((r[n]?e:i||(i={}))[n]=t[n]);return i&&x.extend(!0,e,i),e}Kt.href=Bt.href,x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Bt.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Bt.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Gt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Xt(Xt(e,x.ajaxSettings),t):Xt(x.ajaxSettings,e)},ajaxPrefilter:Yt($t),ajaxTransport:Yt(Vt),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var n,r,s,o,a,l,u,d,c,h,p=x.ajaxSetup({},t),f=p.context||p,g=p.context&&(f.nodeType||f.jquery)?x(f):x.event,m=x.Deferred(),v=x.Callbacks("once memory"),b=p.statusCode||{},y={},w={},_="canceled",E={readyState:0,getResponseHeader:function(e){var t;if(u){if(!o)for(o={};t=Ht.exec(s);)o[t[1].toLowerCase()+" "]=(o[t[1].toLowerCase()+" "]||[]).concat(t[2]);t=o[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return u?s:null},setRequestHeader:function(e,t){return null==u&&(e=w[e.toLowerCase()]=w[e.toLowerCase()]||e,y[e]=t),this},overrideMimeType:function(e){return null==u&&(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(u)E.always(e[E.status]);else for(t in e)b[t]=[b[t],e[t]];return this},abort:function(e){var t=e||_;return n&&n.abort(t),C(0,t),this}};if(m.promise(E),p.url=((e||p.url||Bt.href)+"").replace(qt,Bt.protocol+"//"),p.type=t.method||t.type||p.method||p.type,p.dataTypes=(p.dataType||"*").toLowerCase().match(G)||[""],null==p.crossDomain){l=A.createElement("a");try{l.href=p.url,l.href=l.href,p.crossDomain=Kt.protocol+"//"+Kt.host!=l.protocol+"//"+l.host}catch(e){p.crossDomain=!0}}if(p.data&&p.processData&&"string"!=typeof p.data&&(p.data=x.param(p.data,p.traditional)),Jt($t,p,t,E),u)return E;for(c in(d=x.event&&p.global)&&0==x.active++&&x.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Wt.test(p.type),r=p.url.replace(zt,""),p.hasContent?p.data&&p.processData&&0===(p.contentType||"").indexOf("application/x-www-form-urlencoded")&&(p.data=p.data.replace(Ft,"+")):(h=p.url.slice(r.length),p.data&&(p.processData||"string"==typeof p.data)&&(r+=(Mt.test(r)?"&":"?")+p.data,delete p.data),!1===p.cache&&(r=r.replace(Ut,"$1"),h=(Mt.test(r)?"&":"?")+"_="+kt.guid+++h),p.url=r+h),p.ifModified&&(x.lastModified[r]&&E.setRequestHeader("If-Modified-Since",x.lastModified[r]),x.etag[r]&&E.setRequestHeader("If-None-Match",x.etag[r])),(p.data&&p.hasContent&&!1!==p.contentType||t.contentType)&&E.setRequestHeader("Content-Type",p.contentType),E.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Gt+"; q=0.01":""):p.accepts["*"]),p.headers)E.setRequestHeader(c,p.headers[c]);if(p.beforeSend&&(!1===p.beforeSend.call(f,E,p)||u))return E.abort();if(_="abort",v.add(p.complete),E.done(p.success),E.fail(p.error),n=Jt(Vt,p,t,E)){if(E.readyState=1,d&&g.trigger("ajaxSend",[E,p]),u)return E;p.async&&p.timeout>0&&(a=i.setTimeout((function(){E.abort("timeout")}),p.timeout));try{u=!1,n.send(y,C)}catch(e){if(u)throw e;C(-1,e)}}else C(-1,"No Transport");function C(e,t,o,l){var c,h,A,y,w,_=t;u||(u=!0,a&&i.clearTimeout(a),n=void 0,s=l||"",E.readyState=e>0?4:0,c=e>=200&&e<300||304===e,o&&(y=function(e,t,n){for(var i,r,s,o,a=e.contents,l=e.dataTypes;"*"===l[0];)l.shift(),void 0===i&&(i=e.mimeType||t.getResponseHeader("Content-Type"));if(i)for(r in a)if(a[r]&&a[r].test(i)){l.unshift(r);break}if(l[0]in n)s=l[0];else{for(r in n){if(!l[0]||e.converters[r+" "+l[0]]){s=r;break}o||(o=r)}s=s||o}if(s)return s!==l[0]&&l.unshift(s),n[s]}(p,E,o)),!c&&x.inArray("script",p.dataTypes)>-1&&x.inArray("json",p.dataTypes)<0&&(p.converters["text script"]=function(){}),y=function(e,t,n,i){var r,s,o,a,l,u={},d=e.dataTypes.slice();if(d[1])for(o in e.converters)u[o.toLowerCase()]=e.converters[o];for(s=d.shift();s;)if(e.responseFields[s]&&(n[e.responseFields[s]]=t),!l&&i&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=s,s=d.shift())if("*"===s)s=l;else if("*"!==l&&l!==s){if(!(o=u[l+" "+s]||u["* "+s]))for(r in u)if((a=r.split(" "))[1]===s&&(o=u[l+" "+a[0]]||u["* "+a[0]])){!0===o?o=u[r]:!0!==u[r]&&(s=a[0],d.unshift(a[1]));break}if(!0!==o)if(o&&e.throws)t=o(t);else try{t=o(t)}catch(e){return{state:"parsererror",error:o?e:"No conversion from "+l+" to "+s}}}return{state:"success",data:t}}(p,y,E,c),c?(p.ifModified&&((w=E.getResponseHeader("Last-Modified"))&&(x.lastModified[r]=w),(w=E.getResponseHeader("etag"))&&(x.etag[r]=w)),204===e||"HEAD"===p.type?_="nocontent":304===e?_="notmodified":(_=y.state,h=y.data,c=!(A=y.error))):(A=_,!e&&_||(_="error",e<0&&(e=0))),E.status=e,E.statusText=(t||_)+"",c?m.resolveWith(f,[h,_,E]):m.rejectWith(f,[E,_,A]),E.statusCode(b),b=void 0,d&&g.trigger(c?"ajaxSuccess":"ajaxError",[E,p,c?h:A]),v.fireWith(f,[E,_]),d&&(g.trigger("ajaxComplete",[E,p]),--x.active||x.event.trigger("ajaxStop")))}return E},getJSON:function(e,t,n){return x.get(e,t,n,"json")},getScript:function(e,t){return x.get(e,void 0,t,"script")}}),x.each(["get","post"],(function(e,t){x[t]=function(e,n,i,r){return v(n)&&(r=r||i,i=n,n=void 0),x.ajax(x.extend({url:e,type:t,dataType:r,data:n,success:i},x.isPlainObject(e)&&e))}})),x.ajaxPrefilter((function(e){var t;for(t in e.headers)"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")})),x._evalUrl=function(e,t,n){return x.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){x.globalEval(e,t,n)}})},x.fn.extend({wrapAll:function(e){var t;return this[0]&&(v(e)&&(e=e.call(this[0])),t=x(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map((function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e})).append(this)),this},wrapInner:function(e){return v(e)?this.each((function(t){x(this).wrapInner(e.call(this,t))})):this.each((function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)}))},wrap:function(e){var t=v(e);return this.each((function(n){x(this).wrapAll(t?e.call(this,n):e)}))},unwrap:function(e){return this.parent(e).not("body").each((function(){x(this).replaceWith(this.childNodes)})),this}}),x.expr.pseudos.hidden=function(e){return!x.expr.pseudos.visible(e)},x.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},x.ajaxSettings.xhr=function(){try{return new i.XMLHttpRequest}catch(e){}};var Zt={0:200,1223:204},Qt=x.ajaxSettings.xhr();m.cors=!!Qt&&"withCredentials"in Qt,m.ajax=Qt=!!Qt,x.ajaxTransport((function(e){var t,n;if(m.cors||Qt&&!e.crossDomain)return{send:function(r,s){var o,a=e.xhr();if(a.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(o in e.xhrFields)a[o]=e.xhrFields[o];for(o in e.mimeType&&a.overrideMimeType&&a.overrideMimeType(e.mimeType),e.crossDomain||r["X-Requested-With"]||(r["X-Requested-With"]="XMLHttpRequest"),r)a.setRequestHeader(o,r[o]);t=function(e){return function(){t&&(t=n=a.onload=a.onerror=a.onabort=a.ontimeout=a.onreadystatechange=null,"abort"===e?a.abort():"error"===e?"number"!=typeof a.status?s(0,"error"):s(a.status,a.statusText):s(Zt[a.status]||a.status,a.statusText,"text"!==(a.responseType||"text")||"string"!=typeof a.responseText?{binary:a.response}:{text:a.responseText},a.getAllResponseHeaders()))}},a.onload=t(),n=a.onerror=a.ontimeout=t("error"),void 0!==a.onabort?a.onabort=n:a.onreadystatechange=function(){4===a.readyState&&i.setTimeout((function(){t&&n()}))},t=t("abort");try{a.send(e.hasContent&&e.data||null)}catch(e){if(t)throw e}},abort:function(){t&&t()}}})),x.ajaxPrefilter((function(e){e.crossDomain&&(e.contents.script=!1)})),x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",(function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")})),x.ajaxTransport("script",(function(e){var t,n;if(e.crossDomain||e.scriptAttrs)return{send:function(i,r){t=x("`.\n this.sequenceIndex = Number(c === CharCodes.Lt);\n }\n };\n Tokenizer.prototype.stateCDATASequence = function (c) {\n if (c === Sequences.Cdata[this.sequenceIndex]) {\n if (++this.sequenceIndex === Sequences.Cdata.length) {\n this.state = State.InCommentLike;\n this.currentSequence = Sequences.CdataEnd;\n this.sequenceIndex = 0;\n this.sectionStart = this.index + 1;\n }\n }\n else {\n this.sequenceIndex = 0;\n this.state = State.InDeclaration;\n this.stateInDeclaration(c); // Reconsume the character\n }\n };\n /**\n * When we wait for one specific character, we can speed things up\n * by skipping through the buffer until we find it.\n *\n * @returns Whether the character was found.\n */\n Tokenizer.prototype.fastForwardTo = function (c) {\n while (++this.index < this.buffer.length + this.offset) {\n if (this.buffer.charCodeAt(this.index - this.offset) === c) {\n return true;\n }\n }\n /*\n * We increment the index at the end of the `parse` loop,\n * so set it to `buffer.length - 1` here.\n *\n * TODO: Refactor `parse` to increment index before calling states.\n */\n this.index = this.buffer.length + this.offset - 1;\n return false;\n };\n /**\n * Comments and CDATA end with `-->` and `]]>`.\n *\n * Their common qualities are:\n * - Their end sequences have a distinct character they start with.\n * - That character is then repeated, so we have to check multiple repeats.\n * - All characters but the start character of the sequence can be skipped.\n */\n Tokenizer.prototype.stateInCommentLike = function (c) {\n if (c === this.currentSequence[this.sequenceIndex]) {\n if (++this.sequenceIndex === this.currentSequence.length) {\n if (this.currentSequence === Sequences.CdataEnd) {\n this.cbs.oncdata(this.sectionStart, this.index, 2);\n }\n else {\n this.cbs.oncomment(this.sectionStart, this.index, 2);\n }\n this.sequenceIndex = 0;\n this.sectionStart = this.index + 1;\n this.state = State.Text;\n }\n }\n else if (this.sequenceIndex === 0) {\n // Fast-forward to the first character of the sequence\n if (this.fastForwardTo(this.currentSequence[0])) {\n this.sequenceIndex = 1;\n }\n }\n else if (c !== this.currentSequence[this.sequenceIndex - 1]) {\n // Allow long sequences, eg. --->, ]]]>\n this.sequenceIndex = 0;\n }\n };\n /**\n * HTML only allows ASCII alpha characters (a-z and A-Z) at the beginning of a tag name.\n *\n * XML allows a lot more characters here (@see https://www.w3.org/TR/REC-xml/#NT-NameStartChar).\n * We allow anything that wouldn't end the tag.\n */\n Tokenizer.prototype.isTagStartChar = function (c) {\n return this.xmlMode ? !isEndOfTagSection(c) : isASCIIAlpha(c);\n };\n Tokenizer.prototype.startSpecial = function (sequence, offset) {\n this.isSpecial = true;\n this.currentSequence = sequence;\n this.sequenceIndex = offset;\n this.state = State.SpecialStartSequence;\n };\n Tokenizer.prototype.stateBeforeTagName = function (c) {\n if (c === CharCodes.ExclamationMark) {\n this.state = State.BeforeDeclaration;\n this.sectionStart = this.index + 1;\n }\n else if (c === CharCodes.Questionmark) {\n this.state = State.InProcessingInstruction;\n this.sectionStart = this.index + 1;\n }\n else if (this.isTagStartChar(c)) {\n var lower = c | 0x20;\n this.sectionStart = this.index;\n if (!this.xmlMode && lower === Sequences.TitleEnd[2]) {\n this.startSpecial(Sequences.TitleEnd, 3);\n }\n else {\n this.state =\n !this.xmlMode && lower === Sequences.ScriptEnd[2]\n ? State.BeforeSpecialS\n : State.InTagName;\n }\n }\n else if (c === CharCodes.Slash) {\n this.state = State.BeforeClosingTagName;\n }\n else {\n this.state = State.Text;\n this.stateText(c);\n }\n };\n Tokenizer.prototype.stateInTagName = function (c) {\n if (isEndOfTagSection(c)) {\n this.cbs.onopentagname(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n };\n Tokenizer.prototype.stateBeforeClosingTagName = function (c) {\n if (isWhitespace(c)) {\n // Ignore\n }\n else if (c === CharCodes.Gt) {\n this.state = State.Text;\n }\n else {\n this.state = this.isTagStartChar(c)\n ? State.InClosingTagName\n : State.InSpecialComment;\n this.sectionStart = this.index;\n }\n };\n Tokenizer.prototype.stateInClosingTagName = function (c) {\n if (c === CharCodes.Gt || isWhitespace(c)) {\n this.cbs.onclosetag(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.state = State.AfterClosingTagName;\n this.stateAfterClosingTagName(c);\n }\n };\n Tokenizer.prototype.stateAfterClosingTagName = function (c) {\n // Skip everything until \">\"\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.state = State.Text;\n this.baseState = State.Text;\n this.sectionStart = this.index + 1;\n }\n };\n Tokenizer.prototype.stateBeforeAttributeName = function (c) {\n if (c === CharCodes.Gt) {\n this.cbs.onopentagend(this.index);\n if (this.isSpecial) {\n this.state = State.InSpecialTag;\n this.sequenceIndex = 0;\n }\n else {\n this.state = State.Text;\n }\n this.baseState = this.state;\n this.sectionStart = this.index + 1;\n }\n else if (c === CharCodes.Slash) {\n this.state = State.InSelfClosingTag;\n }\n else if (!isWhitespace(c)) {\n this.state = State.InAttributeName;\n this.sectionStart = this.index;\n }\n };\n Tokenizer.prototype.stateInSelfClosingTag = function (c) {\n if (c === CharCodes.Gt) {\n this.cbs.onselfclosingtag(this.index);\n this.state = State.Text;\n this.baseState = State.Text;\n this.sectionStart = this.index + 1;\n this.isSpecial = false; // Reset special state, in case of self-closing special tags\n }\n else if (!isWhitespace(c)) {\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n };\n Tokenizer.prototype.stateInAttributeName = function (c) {\n if (c === CharCodes.Eq || isEndOfTagSection(c)) {\n this.cbs.onattribname(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.state = State.AfterAttributeName;\n this.stateAfterAttributeName(c);\n }\n };\n Tokenizer.prototype.stateAfterAttributeName = function (c) {\n if (c === CharCodes.Eq) {\n this.state = State.BeforeAttributeValue;\n }\n else if (c === CharCodes.Slash || c === CharCodes.Gt) {\n this.cbs.onattribend(QuoteType.NoValue, this.index);\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n else if (!isWhitespace(c)) {\n this.cbs.onattribend(QuoteType.NoValue, this.index);\n this.state = State.InAttributeName;\n this.sectionStart = this.index;\n }\n };\n Tokenizer.prototype.stateBeforeAttributeValue = function (c) {\n if (c === CharCodes.DoubleQuote) {\n this.state = State.InAttributeValueDq;\n this.sectionStart = this.index + 1;\n }\n else if (c === CharCodes.SingleQuote) {\n this.state = State.InAttributeValueSq;\n this.sectionStart = this.index + 1;\n }\n else if (!isWhitespace(c)) {\n this.sectionStart = this.index;\n this.state = State.InAttributeValueNq;\n this.stateInAttributeValueNoQuotes(c); // Reconsume token\n }\n };\n Tokenizer.prototype.handleInAttributeValue = function (c, quote) {\n if (c === quote ||\n (!this.decodeEntities && this.fastForwardTo(quote))) {\n this.cbs.onattribdata(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.cbs.onattribend(quote === CharCodes.DoubleQuote\n ? QuoteType.Double\n : QuoteType.Single, this.index);\n this.state = State.BeforeAttributeName;\n }\n else if (this.decodeEntities && c === CharCodes.Amp) {\n this.baseState = this.state;\n this.state = State.BeforeEntity;\n }\n };\n Tokenizer.prototype.stateInAttributeValueDoubleQuotes = function (c) {\n this.handleInAttributeValue(c, CharCodes.DoubleQuote);\n };\n Tokenizer.prototype.stateInAttributeValueSingleQuotes = function (c) {\n this.handleInAttributeValue(c, CharCodes.SingleQuote);\n };\n Tokenizer.prototype.stateInAttributeValueNoQuotes = function (c) {\n if (isWhitespace(c) || c === CharCodes.Gt) {\n this.cbs.onattribdata(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.cbs.onattribend(QuoteType.Unquoted, this.index);\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n else if (this.decodeEntities && c === CharCodes.Amp) {\n this.baseState = this.state;\n this.state = State.BeforeEntity;\n }\n };\n Tokenizer.prototype.stateBeforeDeclaration = function (c) {\n if (c === CharCodes.OpeningSquareBracket) {\n this.state = State.CDATASequence;\n this.sequenceIndex = 0;\n }\n else {\n this.state =\n c === CharCodes.Dash\n ? State.BeforeComment\n : State.InDeclaration;\n }\n };\n Tokenizer.prototype.stateInDeclaration = function (c) {\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.cbs.ondeclaration(this.sectionStart, this.index);\n this.state = State.Text;\n this.sectionStart = this.index + 1;\n }\n };\n Tokenizer.prototype.stateInProcessingInstruction = function (c) {\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.cbs.onprocessinginstruction(this.sectionStart, this.index);\n this.state = State.Text;\n this.sectionStart = this.index + 1;\n }\n };\n Tokenizer.prototype.stateBeforeComment = function (c) {\n if (c === CharCodes.Dash) {\n this.state = State.InCommentLike;\n this.currentSequence = Sequences.CommentEnd;\n // Allow short comments (eg. )\n this.sequenceIndex = 2;\n this.sectionStart = this.index + 1;\n }\n else {\n this.state = State.InDeclaration;\n }\n };\n Tokenizer.prototype.stateInSpecialComment = function (c) {\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.cbs.oncomment(this.sectionStart, this.index, 0);\n this.state = State.Text;\n this.sectionStart = this.index + 1;\n }\n };\n Tokenizer.prototype.stateBeforeSpecialS = function (c) {\n var lower = c | 0x20;\n if (lower === Sequences.ScriptEnd[3]) {\n this.startSpecial(Sequences.ScriptEnd, 4);\n }\n else if (lower === Sequences.StyleEnd[3]) {\n this.startSpecial(Sequences.StyleEnd, 4);\n }\n else {\n this.state = State.InTagName;\n this.stateInTagName(c); // Consume the token again\n }\n };\n Tokenizer.prototype.stateBeforeEntity = function (c) {\n // Start excess with 1 to include the '&'\n this.entityExcess = 1;\n this.entityResult = 0;\n if (c === CharCodes.Number) {\n this.state = State.BeforeNumericEntity;\n }\n else if (c === CharCodes.Amp) {\n // We have two `&` characters in a row. Stay in the current state.\n }\n else {\n this.trieIndex = 0;\n this.trieCurrent = this.entityTrie[0];\n this.state = State.InNamedEntity;\n this.stateInNamedEntity(c);\n }\n };\n Tokenizer.prototype.stateInNamedEntity = function (c) {\n this.entityExcess += 1;\n this.trieIndex = (0, decode_js_1.determineBranch)(this.entityTrie, this.trieCurrent, this.trieIndex + 1, c);\n if (this.trieIndex < 0) {\n this.emitNamedEntity();\n this.index--;\n return;\n }\n this.trieCurrent = this.entityTrie[this.trieIndex];\n var masked = this.trieCurrent & decode_js_1.BinTrieFlags.VALUE_LENGTH;\n // If the branch is a value, store it and continue\n if (masked) {\n // The mask is the number of bytes of the value, including the current byte.\n var valueLength = (masked >> 14) - 1;\n // If we have a legacy entity while parsing strictly, just skip the number of bytes\n if (!this.allowLegacyEntity() && c !== CharCodes.Semi) {\n this.trieIndex += valueLength;\n }\n else {\n // Add 1 as we have already incremented the excess\n var entityStart = this.index - this.entityExcess + 1;\n if (entityStart > this.sectionStart) {\n this.emitPartial(this.sectionStart, entityStart);\n }\n // If this is a surrogate pair, consume the next two bytes\n this.entityResult = this.trieIndex;\n this.trieIndex += valueLength;\n this.entityExcess = 0;\n this.sectionStart = this.index + 1;\n if (valueLength === 0) {\n this.emitNamedEntity();\n }\n }\n }\n };\n Tokenizer.prototype.emitNamedEntity = function () {\n this.state = this.baseState;\n if (this.entityResult === 0) {\n return;\n }\n var valueLength = (this.entityTrie[this.entityResult] & decode_js_1.BinTrieFlags.VALUE_LENGTH) >>\n 14;\n switch (valueLength) {\n case 1: {\n this.emitCodePoint(this.entityTrie[this.entityResult] &\n ~decode_js_1.BinTrieFlags.VALUE_LENGTH);\n break;\n }\n case 2: {\n this.emitCodePoint(this.entityTrie[this.entityResult + 1]);\n break;\n }\n case 3: {\n this.emitCodePoint(this.entityTrie[this.entityResult + 1]);\n this.emitCodePoint(this.entityTrie[this.entityResult + 2]);\n }\n }\n };\n Tokenizer.prototype.stateBeforeNumericEntity = function (c) {\n if ((c | 0x20) === CharCodes.LowerX) {\n this.entityExcess++;\n this.state = State.InHexEntity;\n }\n else {\n this.state = State.InNumericEntity;\n this.stateInNumericEntity(c);\n }\n };\n Tokenizer.prototype.emitNumericEntity = function (strict) {\n var entityStart = this.index - this.entityExcess - 1;\n var numberStart = entityStart + 2 + Number(this.state === State.InHexEntity);\n if (numberStart !== this.index) {\n // Emit leading data if any\n if (entityStart > this.sectionStart) {\n this.emitPartial(this.sectionStart, entityStart);\n }\n this.sectionStart = this.index + Number(strict);\n this.emitCodePoint((0, decode_js_1.replaceCodePoint)(this.entityResult));\n }\n this.state = this.baseState;\n };\n Tokenizer.prototype.stateInNumericEntity = function (c) {\n if (c === CharCodes.Semi) {\n this.emitNumericEntity(true);\n }\n else if (isNumber(c)) {\n this.entityResult = this.entityResult * 10 + (c - CharCodes.Zero);\n this.entityExcess++;\n }\n else {\n if (this.allowLegacyEntity()) {\n this.emitNumericEntity(false);\n }\n else {\n this.state = this.baseState;\n }\n this.index--;\n }\n };\n Tokenizer.prototype.stateInHexEntity = function (c) {\n if (c === CharCodes.Semi) {\n this.emitNumericEntity(true);\n }\n else if (isNumber(c)) {\n this.entityResult = this.entityResult * 16 + (c - CharCodes.Zero);\n this.entityExcess++;\n }\n else if (isHexDigit(c)) {\n this.entityResult =\n this.entityResult * 16 + ((c | 0x20) - CharCodes.LowerA + 10);\n this.entityExcess++;\n }\n else {\n if (this.allowLegacyEntity()) {\n this.emitNumericEntity(false);\n }\n else {\n this.state = this.baseState;\n }\n this.index--;\n }\n };\n Tokenizer.prototype.allowLegacyEntity = function () {\n return (!this.xmlMode &&\n (this.baseState === State.Text ||\n this.baseState === State.InSpecialTag));\n };\n /**\n * Remove data that has already been consumed from the buffer.\n */\n Tokenizer.prototype.cleanup = function () {\n // If we are inside of text or attributes, emit what we already have.\n if (this.running && this.sectionStart !== this.index) {\n if (this.state === State.Text ||\n (this.state === State.InSpecialTag && this.sequenceIndex === 0)) {\n this.cbs.ontext(this.sectionStart, this.index);\n this.sectionStart = this.index;\n }\n else if (this.state === State.InAttributeValueDq ||\n this.state === State.InAttributeValueSq ||\n this.state === State.InAttributeValueNq) {\n this.cbs.onattribdata(this.sectionStart, this.index);\n this.sectionStart = this.index;\n }\n }\n };\n Tokenizer.prototype.shouldContinue = function () {\n return this.index < this.buffer.length + this.offset && this.running;\n };\n /**\n * Iterates through the buffer, calling the function corresponding to the current state.\n *\n * States that are more likely to be hit are higher up, as a performance improvement.\n */\n Tokenizer.prototype.parse = function () {\n while (this.shouldContinue()) {\n var c = this.buffer.charCodeAt(this.index - this.offset);\n switch (this.state) {\n case State.Text: {\n this.stateText(c);\n break;\n }\n case State.SpecialStartSequence: {\n this.stateSpecialStartSequence(c);\n break;\n }\n case State.InSpecialTag: {\n this.stateInSpecialTag(c);\n break;\n }\n case State.CDATASequence: {\n this.stateCDATASequence(c);\n break;\n }\n case State.InAttributeValueDq: {\n this.stateInAttributeValueDoubleQuotes(c);\n break;\n }\n case State.InAttributeName: {\n this.stateInAttributeName(c);\n break;\n }\n case State.InCommentLike: {\n this.stateInCommentLike(c);\n break;\n }\n case State.InSpecialComment: {\n this.stateInSpecialComment(c);\n break;\n }\n case State.BeforeAttributeName: {\n this.stateBeforeAttributeName(c);\n break;\n }\n case State.InTagName: {\n this.stateInTagName(c);\n break;\n }\n case State.InClosingTagName: {\n this.stateInClosingTagName(c);\n break;\n }\n case State.BeforeTagName: {\n this.stateBeforeTagName(c);\n break;\n }\n case State.AfterAttributeName: {\n this.stateAfterAttributeName(c);\n break;\n }\n case State.InAttributeValueSq: {\n this.stateInAttributeValueSingleQuotes(c);\n break;\n }\n case State.BeforeAttributeValue: {\n this.stateBeforeAttributeValue(c);\n break;\n }\n case State.BeforeClosingTagName: {\n this.stateBeforeClosingTagName(c);\n break;\n }\n case State.AfterClosingTagName: {\n this.stateAfterClosingTagName(c);\n break;\n }\n case State.BeforeSpecialS: {\n this.stateBeforeSpecialS(c);\n break;\n }\n case State.InAttributeValueNq: {\n this.stateInAttributeValueNoQuotes(c);\n break;\n }\n case State.InSelfClosingTag: {\n this.stateInSelfClosingTag(c);\n break;\n }\n case State.InDeclaration: {\n this.stateInDeclaration(c);\n break;\n }\n case State.BeforeDeclaration: {\n this.stateBeforeDeclaration(c);\n break;\n }\n case State.BeforeComment: {\n this.stateBeforeComment(c);\n break;\n }\n case State.InProcessingInstruction: {\n this.stateInProcessingInstruction(c);\n break;\n }\n case State.InNamedEntity: {\n this.stateInNamedEntity(c);\n break;\n }\n case State.BeforeEntity: {\n this.stateBeforeEntity(c);\n break;\n }\n case State.InHexEntity: {\n this.stateInHexEntity(c);\n break;\n }\n case State.InNumericEntity: {\n this.stateInNumericEntity(c);\n break;\n }\n default: {\n // `this._state === State.BeforeNumericEntity`\n this.stateBeforeNumericEntity(c);\n }\n }\n this.index++;\n }\n this.cleanup();\n };\n Tokenizer.prototype.finish = function () {\n if (this.state === State.InNamedEntity) {\n this.emitNamedEntity();\n }\n // If there is remaining data, emit it in a reasonable way\n if (this.sectionStart < this.index) {\n this.handleTrailingData();\n }\n this.cbs.onend();\n };\n /** Handle any trailing data. */\n Tokenizer.prototype.handleTrailingData = function () {\n var endIndex = this.buffer.length + this.offset;\n if (this.state === State.InCommentLike) {\n if (this.currentSequence === Sequences.CdataEnd) {\n this.cbs.oncdata(this.sectionStart, endIndex, 0);\n }\n else {\n this.cbs.oncomment(this.sectionStart, endIndex, 0);\n }\n }\n else if (this.state === State.InNumericEntity &&\n this.allowLegacyEntity()) {\n this.emitNumericEntity(false);\n // All trailing data will have been consumed\n }\n else if (this.state === State.InHexEntity &&\n this.allowLegacyEntity()) {\n this.emitNumericEntity(false);\n // All trailing data will have been consumed\n }\n else if (this.state === State.InTagName ||\n this.state === State.BeforeAttributeName ||\n this.state === State.BeforeAttributeValue ||\n this.state === State.AfterAttributeName ||\n this.state === State.InAttributeName ||\n this.state === State.InAttributeValueSq ||\n this.state === State.InAttributeValueDq ||\n this.state === State.InAttributeValueNq ||\n this.state === State.InClosingTagName) {\n /*\n * If we are currently in an opening or closing tag, us not calling the\n * respective callback signals that the tag should be ignored.\n */\n }\n else {\n this.cbs.ontext(this.sectionStart, endIndex);\n }\n };\n Tokenizer.prototype.emitPartial = function (start, endIndex) {\n if (this.baseState !== State.Text &&\n this.baseState !== State.InSpecialTag) {\n this.cbs.onattribdata(start, endIndex);\n }\n else {\n this.cbs.ontext(start, endIndex);\n }\n };\n Tokenizer.prototype.emitCodePoint = function (cp) {\n if (this.baseState !== State.Text &&\n this.baseState !== State.InSpecialTag) {\n this.cbs.onattribentity(cp);\n }\n else {\n this.cbs.ontextentity(cp);\n }\n };\n return Tokenizer;\n}());\nexports.default = Tokenizer;\n//# sourceMappingURL=Tokenizer.js.map","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DomUtils = exports.parseFeed = exports.getFeed = exports.ElementType = exports.Tokenizer = exports.createDomStream = exports.parseDOM = exports.parseDocument = exports.DefaultHandler = exports.DomHandler = exports.Parser = void 0;\nvar Parser_js_1 = require(\"./Parser.js\");\nvar Parser_js_2 = require(\"./Parser.js\");\nObject.defineProperty(exports, \"Parser\", { enumerable: true, get: function () { return Parser_js_2.Parser; } });\nvar domhandler_1 = require(\"domhandler\");\nvar domhandler_2 = require(\"domhandler\");\nObject.defineProperty(exports, \"DomHandler\", { enumerable: true, get: function () { return domhandler_2.DomHandler; } });\n// Old name for DomHandler\nObject.defineProperty(exports, \"DefaultHandler\", { enumerable: true, get: function () { return domhandler_2.DomHandler; } });\n// Helper methods\n/**\n * Parses the data, returns the resulting document.\n *\n * @param data The data that should be parsed.\n * @param options Optional options for the parser and DOM builder.\n */\nfunction parseDocument(data, options) {\n var handler = new domhandler_1.DomHandler(undefined, options);\n new Parser_js_1.Parser(handler, options).end(data);\n return handler.root;\n}\nexports.parseDocument = parseDocument;\n/**\n * Parses data, returns an array of the root nodes.\n *\n * Note that the root nodes still have a `Document` node as their parent.\n * Use `parseDocument` to get the `Document` node instead.\n *\n * @param data The data that should be parsed.\n * @param options Optional options for the parser and DOM builder.\n * @deprecated Use `parseDocument` instead.\n */\nfunction parseDOM(data, options) {\n return parseDocument(data, options).children;\n}\nexports.parseDOM = parseDOM;\n/**\n * Creates a parser instance, with an attached DOM handler.\n *\n * @param callback A callback that will be called once parsing has been completed.\n * @param options Optional options for the parser and DOM builder.\n * @param elementCallback An optional callback that will be called every time a tag has been completed inside of the DOM.\n */\nfunction createDomStream(callback, options, elementCallback) {\n var handler = new domhandler_1.DomHandler(callback, options, elementCallback);\n return new Parser_js_1.Parser(handler, options);\n}\nexports.createDomStream = createDomStream;\nvar Tokenizer_js_1 = require(\"./Tokenizer.js\");\nObject.defineProperty(exports, \"Tokenizer\", { enumerable: true, get: function () { return __importDefault(Tokenizer_js_1).default; } });\n/*\n * All of the following exports exist for backwards-compatibility.\n * They should probably be removed eventually.\n */\nexports.ElementType = __importStar(require(\"domelementtype\"));\nvar domutils_1 = require(\"domutils\");\nvar domutils_2 = require(\"domutils\");\nObject.defineProperty(exports, \"getFeed\", { enumerable: true, get: function () { return domutils_2.getFeed; } });\nvar parseFeedDefaultOptions = { xmlMode: true };\n/**\n * Parse a feed.\n *\n * @param feed The feed that should be parsed, as a string.\n * @param options Optionally, options for parsing. When using this, you should set `xmlMode` to `true`.\n */\nfunction parseFeed(feed, options) {\n if (options === void 0) { options = parseFeedDefaultOptions; }\n return (0, domutils_1.getFeed)(parseDOM(feed, options));\n}\nexports.parseFeed = parseFeed;\nexports.DomUtils = __importStar(require(\"domutils\"));\n//# sourceMappingURL=index.js.map","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\n/*!\n * is-plain-object \n *\n * Copyright (c) 2014-2017, Jon Schlinkert.\n * Released under the MIT License.\n */\n\nfunction isObject(o) {\n return Object.prototype.toString.call(o) === '[object Object]';\n}\n\nfunction isPlainObject(o) {\n var ctor,prot;\n\n if (isObject(o) === false) return false;\n\n // If has modified constructor\n ctor = o.constructor;\n if (ctor === undefined) return true;\n\n // If has modified prototype\n prot = ctor.prototype;\n if (isObject(prot) === false) return false;\n\n // If constructor does not have an Object-specific method\n if (prot.hasOwnProperty('isPrototypeOf') === false) {\n return false;\n }\n\n // Most likely a plain Object\n return true;\n}\n\nexports.isPlainObject = isPlainObject;\n","const htmlparser = require('htmlparser2');\nconst escapeStringRegexp = require('escape-string-regexp');\nconst { isPlainObject } = require('is-plain-object');\nconst deepmerge = require('deepmerge');\nconst parseSrcset = require('parse-srcset');\nconst { parse: postcssParse } = require('postcss');\n// Tags that can conceivably represent stand-alone media.\nconst mediaTags = [\n 'img', 'audio', 'video', 'picture', 'svg',\n 'object', 'map', 'iframe', 'embed'\n];\n// Tags that are inherently vulnerable to being used in XSS attacks.\nconst vulnerableTags = [ 'script', 'style' ];\n\nfunction each(obj, cb) {\n if (obj) {\n Object.keys(obj).forEach(function (key) {\n cb(obj[key], key);\n });\n }\n}\n\n// Avoid false positives with .__proto__, .hasOwnProperty, etc.\nfunction has(obj, key) {\n return ({}).hasOwnProperty.call(obj, key);\n}\n\n// Returns those elements of `a` for which `cb(a)` returns truthy\nfunction filter(a, cb) {\n const n = [];\n each(a, function(v) {\n if (cb(v)) {\n n.push(v);\n }\n });\n return n;\n}\n\nfunction isEmptyObject(obj) {\n for (const key in obj) {\n if (has(obj, key)) {\n return false;\n }\n }\n return true;\n}\n\nfunction stringifySrcset(parsedSrcset) {\n return parsedSrcset.map(function(part) {\n if (!part.url) {\n throw new Error('URL missing');\n }\n\n return (\n part.url +\n (part.w ? ` ${part.w}w` : '') +\n (part.h ? ` ${part.h}h` : '') +\n (part.d ? ` ${part.d}x` : '')\n );\n }).join(', ');\n}\n\nmodule.exports = sanitizeHtml;\n\n// A valid attribute name.\n// We use a tolerant definition based on the set of strings defined by\n// html.spec.whatwg.org/multipage/parsing.html#before-attribute-name-state\n// and html.spec.whatwg.org/multipage/parsing.html#attribute-name-state .\n// The characters accepted are ones which can be appended to the attribute\n// name buffer without triggering a parse error:\n// * unexpected-equals-sign-before-attribute-name\n// * unexpected-null-character\n// * unexpected-character-in-attribute-name\n// We exclude the empty string because it's impossible to get to the after\n// attribute name state with an empty attribute name buffer.\nconst VALID_HTML_ATTRIBUTE_NAME = /^[^\\0\\t\\n\\f\\r /<=>]+$/;\n\n// Ignore the _recursing flag; it's there for recursive\n// invocation as a guard against this exploit:\n// https://github.com/fb55/htmlparser2/issues/105\n\nfunction sanitizeHtml(html, options, _recursing) {\n if (html == null) {\n return '';\n }\n if (typeof html === 'number') {\n html = html.toString();\n }\n\n let result = '';\n // Used for hot swapping the result variable with an empty string in order to \"capture\" the text written to it.\n let tempResult = '';\n\n function Frame(tag, attribs) {\n const that = this;\n this.tag = tag;\n this.attribs = attribs || {};\n this.tagPosition = result.length;\n this.text = ''; // Node inner text\n this.mediaChildren = [];\n\n this.updateParentNodeText = function() {\n if (stack.length) {\n const parentFrame = stack[stack.length - 1];\n parentFrame.text += that.text;\n }\n };\n\n this.updateParentNodeMediaChildren = function() {\n if (stack.length && mediaTags.includes(this.tag)) {\n const parentFrame = stack[stack.length - 1];\n parentFrame.mediaChildren.push(this.tag);\n }\n };\n }\n\n options = Object.assign({}, sanitizeHtml.defaults, options);\n options.parser = Object.assign({}, htmlParserDefaults, options.parser);\n\n const tagAllowed = function (name) {\n return options.allowedTags === false || (options.allowedTags || []).indexOf(name) > -1;\n };\n\n // vulnerableTags\n vulnerableTags.forEach(function (tag) {\n if (tagAllowed(tag) && !options.allowVulnerableTags) {\n console.warn(`\\n\\n⚠️ Your \\`allowedTags\\` option includes, \\`${tag}\\`, which is inherently\\nvulnerable to XSS attacks. Please remove it from \\`allowedTags\\`.\\nOr, to disable this warning, add the \\`allowVulnerableTags\\` option\\nand ensure you are accounting for this risk.\\n\\n`);\n }\n });\n\n // Tags that contain something other than HTML, or where discarding\n // the text when the tag is disallowed makes sense for other reasons.\n // If we are not allowing these tags, we should drop their content too.\n // For other tags you would drop the tag but keep its content.\n const nonTextTagsArray = options.nonTextTags || [\n 'script',\n 'style',\n 'textarea',\n 'option'\n ];\n let allowedAttributesMap;\n let allowedAttributesGlobMap;\n if (options.allowedAttributes) {\n allowedAttributesMap = {};\n allowedAttributesGlobMap = {};\n each(options.allowedAttributes, function(attributes, tag) {\n allowedAttributesMap[tag] = [];\n const globRegex = [];\n attributes.forEach(function(obj) {\n if (typeof obj === 'string' && obj.indexOf('*') >= 0) {\n globRegex.push(escapeStringRegexp(obj).replace(/\\\\\\*/g, '.*'));\n } else {\n allowedAttributesMap[tag].push(obj);\n }\n });\n if (globRegex.length) {\n allowedAttributesGlobMap[tag] = new RegExp('^(' + globRegex.join('|') + ')$');\n }\n });\n }\n const allowedClassesMap = {};\n const allowedClassesGlobMap = {};\n const allowedClassesRegexMap = {};\n each(options.allowedClasses, function(classes, tag) {\n // Implicitly allows the class attribute\n if (allowedAttributesMap) {\n if (!has(allowedAttributesMap, tag)) {\n allowedAttributesMap[tag] = [];\n }\n allowedAttributesMap[tag].push('class');\n }\n\n allowedClassesMap[tag] = classes;\n\n if (Array.isArray(classes)) {\n const globRegex = [];\n allowedClassesMap[tag] = [];\n allowedClassesRegexMap[tag] = [];\n classes.forEach(function(obj) {\n if (typeof obj === 'string' && obj.indexOf('*') >= 0) {\n globRegex.push(escapeStringRegexp(obj).replace(/\\\\\\*/g, '.*'));\n } else if (obj instanceof RegExp) {\n allowedClassesRegexMap[tag].push(obj);\n } else {\n allowedClassesMap[tag].push(obj);\n }\n });\n if (globRegex.length) {\n allowedClassesGlobMap[tag] = new RegExp('^(' + globRegex.join('|') + ')$');\n }\n }\n });\n\n const transformTagsMap = {};\n let transformTagsAll;\n each(options.transformTags, function(transform, tag) {\n let transFun;\n if (typeof transform === 'function') {\n transFun = transform;\n } else if (typeof transform === 'string') {\n transFun = sanitizeHtml.simpleTransform(transform);\n }\n if (tag === '*') {\n transformTagsAll = transFun;\n } else {\n transformTagsMap[tag] = transFun;\n }\n });\n\n let depth;\n let stack;\n let skipMap;\n let transformMap;\n let skipText;\n let skipTextDepth;\n let addedText = false;\n\n initializeState();\n\n const parser = new htmlparser.Parser({\n onopentag: function(name, attribs) {\n // If `enforceHtmlBoundary` is `true` and this has found the opening\n // `html` tag, reset the state.\n if (options.enforceHtmlBoundary && name === 'html') {\n initializeState();\n }\n\n if (skipText) {\n skipTextDepth++;\n return;\n }\n const frame = new Frame(name, attribs);\n stack.push(frame);\n\n let skip = false;\n const hasText = !!frame.text;\n let transformedTag;\n if (has(transformTagsMap, name)) {\n transformedTag = transformTagsMap[name](name, attribs);\n\n frame.attribs = attribs = transformedTag.attribs;\n\n if (transformedTag.text !== undefined) {\n frame.innerText = transformedTag.text;\n }\n\n if (name !== transformedTag.tagName) {\n frame.name = name = transformedTag.tagName;\n transformMap[depth] = transformedTag.tagName;\n }\n }\n if (transformTagsAll) {\n transformedTag = transformTagsAll(name, attribs);\n\n frame.attribs = attribs = transformedTag.attribs;\n if (name !== transformedTag.tagName) {\n frame.name = name = transformedTag.tagName;\n transformMap[depth] = transformedTag.tagName;\n }\n }\n\n if (!tagAllowed(name) || (options.disallowedTagsMode === 'recursiveEscape' && !isEmptyObject(skipMap)) || (options.nestingLimit != null && depth >= options.nestingLimit)) {\n skip = true;\n skipMap[depth] = true;\n if (options.disallowedTagsMode === 'discard') {\n if (nonTextTagsArray.indexOf(name) !== -1) {\n skipText = true;\n skipTextDepth = 1;\n }\n }\n skipMap[depth] = true;\n }\n depth++;\n if (skip) {\n if (options.disallowedTagsMode === 'discard') {\n // We want the contents but not this tag\n return;\n }\n tempResult = result;\n result = '';\n }\n result += '<' + name;\n\n if (name === 'script') {\n if (options.allowedScriptHostnames || options.allowedScriptDomains) {\n frame.innerText = '';\n }\n }\n\n if (!allowedAttributesMap || has(allowedAttributesMap, name) || allowedAttributesMap['*']) {\n each(attribs, function(value, a) {\n if (!VALID_HTML_ATTRIBUTE_NAME.test(a)) {\n // This prevents part of an attribute name in the output from being\n // interpreted as the end of an attribute, or end of a tag.\n delete frame.attribs[a];\n return;\n }\n // If the value is empty, check if the attribute is in the allowedEmptyAttributes array.\n // If it is not in the allowedEmptyAttributes array, and it is a known non-boolean attribute, delete it\n // List taken from https://html.spec.whatwg.org/multipage/indices.html#attributes-3\n if (value === '' && (!options.allowedEmptyAttributes.includes(a)) &&\n (options.nonBooleanAttributes.includes(a) || options.nonBooleanAttributes.includes('*'))) {\n delete frame.attribs[a];\n return;\n }\n // check allowedAttributesMap for the element and attribute and modify the value\n // as necessary if there are specific values defined.\n let passedAllowedAttributesMapCheck = false;\n if (!allowedAttributesMap ||\n (has(allowedAttributesMap, name) && allowedAttributesMap[name].indexOf(a) !== -1) ||\n (allowedAttributesMap['*'] && allowedAttributesMap['*'].indexOf(a) !== -1) ||\n (has(allowedAttributesGlobMap, name) && allowedAttributesGlobMap[name].test(a)) ||\n (allowedAttributesGlobMap['*'] && allowedAttributesGlobMap['*'].test(a))) {\n passedAllowedAttributesMapCheck = true;\n } else if (allowedAttributesMap && allowedAttributesMap[name]) {\n for (const o of allowedAttributesMap[name]) {\n if (isPlainObject(o) && o.name && (o.name === a)) {\n passedAllowedAttributesMapCheck = true;\n let newValue = '';\n if (o.multiple === true) {\n // verify the values that are allowed\n const splitStrArray = value.split(' ');\n for (const s of splitStrArray) {\n if (o.values.indexOf(s) !== -1) {\n if (newValue === '') {\n newValue = s;\n } else {\n newValue += ' ' + s;\n }\n }\n }\n } else if (o.values.indexOf(value) >= 0) {\n // verified an allowed value matches the entire attribute value\n newValue = value;\n }\n value = newValue;\n }\n }\n }\n if (passedAllowedAttributesMapCheck) {\n if (options.allowedSchemesAppliedToAttributes.indexOf(a) !== -1) {\n if (naughtyHref(name, value)) {\n delete frame.attribs[a];\n return;\n }\n }\n\n if (name === 'script' && a === 'src') {\n\n let allowed = true;\n\n try {\n const parsed = parseUrl(value);\n\n if (options.allowedScriptHostnames || options.allowedScriptDomains) {\n const allowedHostname = (options.allowedScriptHostnames || []).find(function (hostname) {\n return hostname === parsed.url.hostname;\n });\n const allowedDomain = (options.allowedScriptDomains || []).find(function(domain) {\n return parsed.url.hostname === domain || parsed.url.hostname.endsWith(`.${domain}`);\n });\n allowed = allowedHostname || allowedDomain;\n }\n } catch (e) {\n allowed = false;\n }\n\n if (!allowed) {\n delete frame.attribs[a];\n return;\n }\n }\n\n if (name === 'iframe' && a === 'src') {\n let allowed = true;\n try {\n const parsed = parseUrl(value);\n\n if (parsed.isRelativeUrl) {\n // default value of allowIframeRelativeUrls is true\n // unless allowedIframeHostnames or allowedIframeDomains specified\n allowed = has(options, 'allowIframeRelativeUrls')\n ? options.allowIframeRelativeUrls\n : (!options.allowedIframeHostnames && !options.allowedIframeDomains);\n } else if (options.allowedIframeHostnames || options.allowedIframeDomains) {\n const allowedHostname = (options.allowedIframeHostnames || []).find(function (hostname) {\n return hostname === parsed.url.hostname;\n });\n const allowedDomain = (options.allowedIframeDomains || []).find(function(domain) {\n return parsed.url.hostname === domain || parsed.url.hostname.endsWith(`.${domain}`);\n });\n allowed = allowedHostname || allowedDomain;\n }\n } catch (e) {\n // Unparseable iframe src\n allowed = false;\n }\n if (!allowed) {\n delete frame.attribs[a];\n return;\n }\n }\n if (a === 'srcset') {\n try {\n let parsed = parseSrcset(value);\n parsed.forEach(function(value) {\n if (naughtyHref('srcset', value.url)) {\n value.evil = true;\n }\n });\n parsed = filter(parsed, function(v) {\n return !v.evil;\n });\n if (!parsed.length) {\n delete frame.attribs[a];\n return;\n } else {\n value = stringifySrcset(filter(parsed, function(v) {\n return !v.evil;\n }));\n frame.attribs[a] = value;\n }\n } catch (e) {\n // Unparseable srcset\n delete frame.attribs[a];\n return;\n }\n }\n if (a === 'class') {\n const allowedSpecificClasses = allowedClassesMap[name];\n const allowedWildcardClasses = allowedClassesMap['*'];\n const allowedSpecificClassesGlob = allowedClassesGlobMap[name];\n const allowedSpecificClassesRegex = allowedClassesRegexMap[name];\n const allowedWildcardClassesGlob = allowedClassesGlobMap['*'];\n const allowedClassesGlobs = [\n allowedSpecificClassesGlob,\n allowedWildcardClassesGlob\n ]\n .concat(allowedSpecificClassesRegex)\n .filter(function (t) {\n return t;\n });\n if (allowedSpecificClasses && allowedWildcardClasses) {\n value = filterClasses(value, deepmerge(allowedSpecificClasses, allowedWildcardClasses), allowedClassesGlobs);\n } else {\n value = filterClasses(value, allowedSpecificClasses || allowedWildcardClasses, allowedClassesGlobs);\n }\n if (!value.length) {\n delete frame.attribs[a];\n return;\n }\n }\n if (a === 'style') {\n if (options.parseStyleAttributes) {\n try {\n const abstractSyntaxTree = postcssParse(name + ' {' + value + '}', { map: false });\n const filteredAST = filterCss(abstractSyntaxTree, options.allowedStyles);\n\n value = stringifyStyleAttributes(filteredAST);\n\n if (value.length === 0) {\n delete frame.attribs[a];\n return;\n }\n } catch (e) {\n if (typeof window !== 'undefined') {\n console.warn('Failed to parse \"' + name + ' {' + value + '}' + '\", If you\\'re running this in a browser, we recommend to disable style parsing: options.parseStyleAttributes: false, since this only works in a node environment due to a postcss dependency, More info: https://github.com/apostrophecms/sanitize-html/issues/547');\n }\n delete frame.attribs[a];\n return;\n }\n } else if (options.allowedStyles) {\n throw new Error('allowedStyles option cannot be used together with parseStyleAttributes: false.');\n }\n }\n result += ' ' + a;\n if (value && value.length) {\n result += '=\"' + escapeHtml(value, true) + '\"';\n } else if (options.allowedEmptyAttributes.includes(a)) {\n result += '=\"\"';\n }\n } else {\n delete frame.attribs[a];\n }\n });\n }\n if (options.selfClosing.indexOf(name) !== -1) {\n result += ' />';\n } else {\n result += '>';\n if (frame.innerText && !hasText && !options.textFilter) {\n result += escapeHtml(frame.innerText);\n addedText = true;\n }\n }\n if (skip) {\n result = tempResult + escapeHtml(result);\n tempResult = '';\n }\n },\n ontext: function(text) {\n if (skipText) {\n return;\n }\n const lastFrame = stack[stack.length - 1];\n let tag;\n\n if (lastFrame) {\n tag = lastFrame.tag;\n // If inner text was set by transform function then let's use it\n text = lastFrame.innerText !== undefined ? lastFrame.innerText : text;\n }\n\n if (options.disallowedTagsMode === 'discard' && ((tag === 'script') || (tag === 'style'))) {\n // htmlparser2 gives us these as-is. Escaping them ruins the content. Allowing\n // script tags is, by definition, game over for XSS protection, so if that's\n // your concern, don't allow them. The same is essentially true for style tags\n // which have their own collection of XSS vectors.\n result += text;\n } else {\n const escaped = escapeHtml(text, false);\n if (options.textFilter && !addedText) {\n result += options.textFilter(escaped, tag);\n } else if (!addedText) {\n result += escaped;\n }\n }\n if (stack.length) {\n const frame = stack[stack.length - 1];\n frame.text += text;\n }\n },\n onclosetag: function(name, isImplied) {\n\n if (skipText) {\n skipTextDepth--;\n if (!skipTextDepth) {\n skipText = false;\n } else {\n return;\n }\n }\n\n const frame = stack.pop();\n if (!frame) {\n // Do not crash on bad markup\n return;\n }\n\n if (frame.tag !== name) {\n // Another case of bad markup.\n // Push to stack, so that it will be used in future closing tags.\n stack.push(frame);\n return;\n }\n\n skipText = options.enforceHtmlBoundary ? name === 'html' : false;\n depth--;\n const skip = skipMap[depth];\n if (skip) {\n delete skipMap[depth];\n if (options.disallowedTagsMode === 'discard') {\n frame.updateParentNodeText();\n return;\n }\n tempResult = result;\n result = '';\n }\n\n if (transformMap[depth]) {\n name = transformMap[depth];\n delete transformMap[depth];\n }\n\n if (options.exclusiveFilter && options.exclusiveFilter(frame)) {\n result = result.substr(0, frame.tagPosition);\n return;\n }\n\n frame.updateParentNodeMediaChildren();\n frame.updateParentNodeText();\n\n if (\n // Already output />\n options.selfClosing.indexOf(name) !== -1 ||\n // Escaped tag, closing tag is implied\n (isImplied && !tagAllowed(name) && [ 'escape', 'recursiveEscape' ].indexOf(options.disallowedTagsMode) >= 0)\n ) {\n if (skip) {\n result = tempResult;\n tempResult = '';\n }\n return;\n }\n\n result += '';\n if (skip) {\n result = tempResult + escapeHtml(result);\n tempResult = '';\n }\n addedText = false;\n }\n }, options.parser);\n parser.write(html);\n parser.end();\n\n return result;\n\n function initializeState() {\n result = '';\n depth = 0;\n stack = [];\n skipMap = {};\n transformMap = {};\n skipText = false;\n skipTextDepth = 0;\n }\n\n function escapeHtml(s, quote) {\n if (typeof (s) !== 'string') {\n s = s + '';\n }\n if (options.parser.decodeEntities) {\n s = s.replace(/&/g, '&').replace(//g, '>');\n if (quote) {\n s = s.replace(/\"/g, '"');\n }\n }\n // TODO: this is inadequate because it will pass `&0;`. This approach\n // will not work, each & must be considered with regard to whether it\n // is followed by a 100% syntactically valid entity or not, and escaped\n // if it is not. If this bothers you, don't set parser.decodeEntities\n // to false. (The default is true.)\n s = s.replace(/&(?![a-zA-Z0-9#]{1,20};)/g, '&') // Match ampersands not part of existing HTML entity\n .replace(//g, '>');\n if (quote) {\n s = s.replace(/\"/g, '"');\n }\n return s;\n }\n\n function naughtyHref(name, href) {\n // Browsers ignore character codes of 32 (space) and below in a surprising\n // number of situations. Start reading here:\n // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet#Embedded_tab\n // eslint-disable-next-line no-control-regex\n href = href.replace(/[\\x00-\\x20]+/g, '');\n // Clobber any comments in URLs, which the browser might\n // interpret inside an XML data island, allowing\n // a javascript: URL to be snuck through\n while (true) {\n const firstIndex = href.indexOf('', firstIndex + 4);\n if (lastIndex === -1) {\n break;\n }\n href = href.substring(0, firstIndex) + href.substring(lastIndex + 3);\n }\n // Case insensitive so we don't get faked out by JAVASCRIPT #1\n // Allow more characters after the first so we don't get faked\n // out by certain schemes browsers accept\n const matches = href.match(/^([a-zA-Z][a-zA-Z0-9.\\-+]*):/);\n if (!matches) {\n // Protocol-relative URL starting with any combination of '/' and '\\'\n if (href.match(/^[/\\\\]{2}/)) {\n return !options.allowProtocolRelative;\n }\n\n // No scheme\n return false;\n }\n const scheme = matches[1].toLowerCase();\n\n if (has(options.allowedSchemesByTag, name)) {\n return options.allowedSchemesByTag[name].indexOf(scheme) === -1;\n }\n\n return !options.allowedSchemes || options.allowedSchemes.indexOf(scheme) === -1;\n }\n\n function parseUrl(value) {\n value = value.replace(/^(\\w+:)?\\s*[\\\\/]\\s*[\\\\/]/, '$1//');\n if (value.startsWith('relative:')) {\n // An attempt to exploit our workaround for base URLs being\n // mandatory for relative URL validation in the WHATWG\n // URL parser, reject it\n throw new Error('relative: exploit attempt');\n }\n // naughtyHref is in charge of whether protocol relative URLs\n // are cool. Here we are concerned just with allowed hostnames and\n // whether to allow relative URLs.\n //\n // Build a placeholder \"base URL\" against which any reasonable\n // relative URL may be parsed successfully\n let base = 'relative://relative-site';\n for (let i = 0; (i < 100); i++) {\n base += `/${i}`;\n }\n\n const parsed = new URL(value, base);\n\n const isRelativeUrl = parsed && parsed.hostname === 'relative-site' && parsed.protocol === 'relative:';\n return {\n isRelativeUrl,\n url: parsed\n };\n }\n /**\n * Filters user input css properties by allowlisted regex attributes.\n * Modifies the abstractSyntaxTree object.\n *\n * @param {object} abstractSyntaxTree - Object representation of CSS attributes.\n * @property {array[Declaration]} abstractSyntaxTree.nodes[0] - Each object cointains prop and value key, i.e { prop: 'color', value: 'red' }.\n * @param {object} allowedStyles - Keys are properties (i.e color), value is list of permitted regex rules (i.e /green/i).\n * @return {object} - The modified tree.\n */\n function filterCss(abstractSyntaxTree, allowedStyles) {\n if (!allowedStyles) {\n return abstractSyntaxTree;\n }\n\n const astRules = abstractSyntaxTree.nodes[0];\n let selectedRule;\n\n // Merge global and tag-specific styles into new AST.\n if (allowedStyles[astRules.selector] && allowedStyles['*']) {\n selectedRule = deepmerge(\n allowedStyles[astRules.selector],\n allowedStyles['*']\n );\n } else {\n selectedRule = allowedStyles[astRules.selector] || allowedStyles['*'];\n }\n\n if (selectedRule) {\n abstractSyntaxTree.nodes[0].nodes = astRules.nodes.reduce(filterDeclarations(selectedRule), []);\n }\n\n return abstractSyntaxTree;\n }\n\n /**\n * Extracts the style attributes from an AbstractSyntaxTree and formats those\n * values in the inline style attribute format.\n *\n * @param {AbstractSyntaxTree} filteredAST\n * @return {string} - Example: \"color:yellow;text-align:center !important;font-family:helvetica;\"\n */\n function stringifyStyleAttributes(filteredAST) {\n return filteredAST.nodes[0].nodes\n .reduce(function(extractedAttributes, attrObject) {\n extractedAttributes.push(\n `${attrObject.prop}:${attrObject.value}${attrObject.important ? ' !important' : ''}`\n );\n return extractedAttributes;\n }, [])\n .join(';');\n }\n\n /**\n * Filters the existing attributes for the given property. Discards any attributes\n * which don't match the allowlist.\n *\n * @param {object} selectedRule - Example: { color: red, font-family: helvetica }\n * @param {array} allowedDeclarationsList - List of declarations which pass the allowlist.\n * @param {object} attributeObject - Object representing the current css property.\n * @property {string} attributeObject.type - Typically 'declaration'.\n * @property {string} attributeObject.prop - The CSS property, i.e 'color'.\n * @property {string} attributeObject.value - The corresponding value to the css property, i.e 'red'.\n * @return {function} - When used in Array.reduce, will return an array of Declaration objects\n */\n function filterDeclarations(selectedRule) {\n return function (allowedDeclarationsList, attributeObject) {\n // If this property is allowlisted...\n if (has(selectedRule, attributeObject.prop)) {\n const matchesRegex = selectedRule[attributeObject.prop].some(function(regularExpression) {\n return regularExpression.test(attributeObject.value);\n });\n\n if (matchesRegex) {\n allowedDeclarationsList.push(attributeObject);\n }\n }\n return allowedDeclarationsList;\n };\n }\n\n function filterClasses(classes, allowed, allowedGlobs) {\n if (!allowed) {\n // The class attribute is allowed without filtering on this tag\n return classes;\n }\n classes = classes.split(/\\s+/);\n return classes.filter(function(clss) {\n return allowed.indexOf(clss) !== -1 || allowedGlobs.some(function(glob) {\n return glob.test(clss);\n });\n }).join(' ');\n }\n}\n\n// Defaults are accessible to you so that you can use them as a starting point\n// programmatically if you wish\n\nconst htmlParserDefaults = {\n decodeEntities: true\n};\nsanitizeHtml.defaults = {\n allowedTags: [\n // Sections derived from MDN element categories and limited to the more\n // benign categories.\n // https://developer.mozilla.org/en-US/docs/Web/HTML/Element\n // Content sectioning\n 'address', 'article', 'aside', 'footer', 'header',\n 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hgroup',\n 'main', 'nav', 'section',\n // Text content\n 'blockquote', 'dd', 'div', 'dl', 'dt', 'figcaption', 'figure',\n 'hr', 'li', 'main', 'ol', 'p', 'pre', 'ul',\n // Inline text semantics\n 'a', 'abbr', 'b', 'bdi', 'bdo', 'br', 'cite', 'code', 'data', 'dfn',\n 'em', 'i', 'kbd', 'mark', 'q',\n 'rb', 'rp', 'rt', 'rtc', 'ruby',\n 's', 'samp', 'small', 'span', 'strong', 'sub', 'sup', 'time', 'u', 'var', 'wbr',\n // Table content\n 'caption', 'col', 'colgroup', 'table', 'tbody', 'td', 'tfoot', 'th',\n 'thead', 'tr'\n ],\n // Tags that cannot be boolean\n nonBooleanAttributes: [\n 'abbr', 'accept', 'accept-charset', 'accesskey', 'action',\n 'allow', 'alt', 'as', 'autocapitalize', 'autocomplete',\n 'blocking', 'charset', 'cite', 'class', 'color', 'cols',\n 'colspan', 'content', 'contenteditable', 'coords', 'crossorigin',\n 'data', 'datetime', 'decoding', 'dir', 'dirname', 'download',\n 'draggable', 'enctype', 'enterkeyhint', 'fetchpriority', 'for',\n 'form', 'formaction', 'formenctype', 'formmethod', 'formtarget',\n 'headers', 'height', 'hidden', 'high', 'href', 'hreflang',\n 'http-equiv', 'id', 'imagesizes', 'imagesrcset', 'inputmode',\n 'integrity', 'is', 'itemid', 'itemprop', 'itemref', 'itemtype',\n 'kind', 'label', 'lang', 'list', 'loading', 'low', 'max',\n 'maxlength', 'media', 'method', 'min', 'minlength', 'name',\n 'nonce', 'optimum', 'pattern', 'ping', 'placeholder', 'popover',\n 'popovertarget', 'popovertargetaction', 'poster', 'preload',\n 'referrerpolicy', 'rel', 'rows', 'rowspan', 'sandbox', 'scope',\n 'shape', 'size', 'sizes', 'slot', 'span', 'spellcheck', 'src',\n 'srcdoc', 'srclang', 'srcset', 'start', 'step', 'style',\n 'tabindex', 'target', 'title', 'translate', 'type', 'usemap',\n 'value', 'width', 'wrap',\n // Event handlers\n 'onauxclick', 'onafterprint', 'onbeforematch', 'onbeforeprint',\n 'onbeforeunload', 'onbeforetoggle', 'onblur', 'oncancel',\n 'oncanplay', 'oncanplaythrough', 'onchange', 'onclick', 'onclose',\n 'oncontextlost', 'oncontextmenu', 'oncontextrestored', 'oncopy',\n 'oncuechange', 'oncut', 'ondblclick', 'ondrag', 'ondragend',\n 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart',\n 'ondrop', 'ondurationchange', 'onemptied', 'onended',\n 'onerror', 'onfocus', 'onformdata', 'onhashchange', 'oninput',\n 'oninvalid', 'onkeydown', 'onkeypress', 'onkeyup',\n 'onlanguagechange', 'onload', 'onloadeddata', 'onloadedmetadata',\n 'onloadstart', 'onmessage', 'onmessageerror', 'onmousedown',\n 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmouseout',\n 'onmouseover', 'onmouseup', 'onoffline', 'ononline', 'onpagehide',\n 'onpageshow', 'onpaste', 'onpause', 'onplay', 'onplaying',\n 'onpopstate', 'onprogress', 'onratechange', 'onreset', 'onresize',\n 'onrejectionhandled', 'onscroll', 'onscrollend',\n 'onsecuritypolicyviolation', 'onseeked', 'onseeking', 'onselect',\n 'onslotchange', 'onstalled', 'onstorage', 'onsubmit', 'onsuspend',\n 'ontimeupdate', 'ontoggle', 'onunhandledrejection', 'onunload',\n 'onvolumechange', 'onwaiting', 'onwheel'\n ],\n disallowedTagsMode: 'discard',\n allowedAttributes: {\n a: [ 'href', 'name', 'target' ],\n // We don't currently allow img itself by default, but\n // these attributes would make sense if we did.\n img: [ 'src', 'srcset', 'alt', 'title', 'width', 'height', 'loading' ]\n },\n allowedEmptyAttributes: [\n 'alt'\n ],\n // Lots of these won't come up by default because we don't allow them\n selfClosing: [ 'img', 'br', 'hr', 'area', 'base', 'basefont', 'input', 'link', 'meta' ],\n // URL schemes we permit\n allowedSchemes: [ 'http', 'https', 'ftp', 'mailto', 'tel' ],\n allowedSchemesByTag: {},\n allowedSchemesAppliedToAttributes: [ 'href', 'src', 'cite' ],\n allowProtocolRelative: true,\n enforceHtmlBoundary: false,\n parseStyleAttributes: true\n};\n\nsanitizeHtml.simpleTransform = function(newTagName, newAttribs, merge) {\n merge = (merge === undefined) ? true : merge;\n newAttribs = newAttribs || {};\n\n return function(tagName, attribs) {\n let attrib;\n if (merge) {\n for (attrib in newAttribs) {\n attribs[attrib] = newAttribs[attrib];\n }\n } else {\n attribs = newAttribs;\n }\n\n return {\n tagName: newTagName,\n attribs: attribs\n };\n };\n};\n","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ActivityMonitor = void 0;\nconst signaling_1 = require(\"@lumino/signaling\");\n/**\n * A class that monitors activity on a signal.\n */\nclass ActivityMonitor {\n /**\n * Construct a new activity monitor.\n */\n constructor(options) {\n this._timer = -1;\n this._timeout = -1;\n this._isDisposed = false;\n this._activityStopped = new signaling_1.Signal(this);\n options.signal.connect(this._onSignalFired, this);\n this._timeout = options.timeout || 1000;\n }\n /**\n * A signal emitted when activity has ceased.\n */\n get activityStopped() {\n return this._activityStopped;\n }\n /**\n * The timeout associated with the monitor, in milliseconds.\n */\n get timeout() {\n return this._timeout;\n }\n set timeout(value) {\n this._timeout = value;\n }\n /**\n * Test whether the monitor has been disposed.\n *\n * #### Notes\n * This is a read-only property.\n */\n get isDisposed() {\n return this._isDisposed;\n }\n /**\n * Dispose of the resources used by the activity monitor.\n */\n dispose() {\n if (this._isDisposed) {\n return;\n }\n this._isDisposed = true;\n signaling_1.Signal.clearData(this);\n }\n /**\n * A signal handler for the monitored signal.\n */\n _onSignalFired(sender, args) {\n clearTimeout(this._timer);\n this._sender = sender;\n this._args = args;\n this._timer = setTimeout(() => {\n this._activityStopped.emit({\n sender: this._sender,\n args: this._args\n });\n }, this._timeout);\n }\n}\nexports.ActivityMonitor = ActivityMonitor;\n//# sourceMappingURL=activitymonitor.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/**\n * @packageDocumentation\n * @module coreutils\n */\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n__exportStar(require(\"./activitymonitor\"), exports);\n__exportStar(require(\"./interfaces\"), exports);\n__exportStar(require(\"./lru\"), exports);\n__exportStar(require(\"./markdowncodeblocks\"), exports);\n__exportStar(require(\"./pageconfig\"), exports);\n__exportStar(require(\"./path\"), exports);\n__exportStar(require(\"./signal\"), exports);\n__exportStar(require(\"./text\"), exports);\n__exportStar(require(\"./time\"), exports);\n__exportStar(require(\"./url\"), exports);\n//# sourceMappingURL=index.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\n//# sourceMappingURL=interfaces.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.LruCache = void 0;\nconst DEFAULT_MAX_SIZE = 128;\n/** A least-recently-used cache. */\nclass LruCache {\n constructor(options = {}) {\n this._map = new Map();\n this._maxSize = (options === null || options === void 0 ? void 0 : options.maxSize) || DEFAULT_MAX_SIZE;\n }\n /**\n * Return the current size of the cache.\n */\n get size() {\n return this._map.size;\n }\n /**\n * Clear the values in the cache.\n */\n clear() {\n this._map.clear();\n }\n /**\n * Get a value (or null) from the cache, pushing the item to the front of the cache.\n */\n get(key) {\n const item = this._map.get(key) || null;\n if (item != null) {\n this._map.delete(key);\n this._map.set(key, item);\n }\n return item;\n }\n /**\n * Set a value in the cache, potentially evicting an old item.\n */\n set(key, value) {\n if (this._map.size >= this._maxSize) {\n this._map.delete(this._map.keys().next().value);\n }\n this._map.set(key, value);\n }\n}\nexports.LruCache = LruCache;\n//# sourceMappingURL=lru.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MarkdownCodeBlocks = void 0;\n/**\n * The namespace for code block functions which help\n * in extract code from markdown text\n */\nvar MarkdownCodeBlocks;\n(function (MarkdownCodeBlocks) {\n MarkdownCodeBlocks.CODE_BLOCK_MARKER = '```';\n const markdownExtensions = [\n '.markdown',\n '.mdown',\n '.mkdn',\n '.md',\n '.mkd',\n '.mdwn',\n '.mdtxt',\n '.mdtext',\n '.text',\n '.txt',\n '.Rmd'\n ];\n class MarkdownCodeBlock {\n constructor(startLine) {\n this.startLine = startLine;\n this.code = '';\n this.endLine = -1;\n }\n }\n MarkdownCodeBlocks.MarkdownCodeBlock = MarkdownCodeBlock;\n /**\n * Check whether the given file extension is a markdown extension\n * @param extension - A file extension\n *\n * @returns true/false depending on whether this is a supported markdown extension\n */\n function isMarkdown(extension) {\n return markdownExtensions.indexOf(extension) > -1;\n }\n MarkdownCodeBlocks.isMarkdown = isMarkdown;\n /**\n * Construct all code snippets from current text\n * (this could be potentially optimized if we can cache and detect differences)\n * @param text - A string to parse codeblocks from\n *\n * @returns An array of MarkdownCodeBlocks.\n */\n function findMarkdownCodeBlocks(text) {\n if (!text || text === '') {\n return [];\n }\n const lines = text.split('\\n');\n const codeBlocks = [];\n let currentBlock = null;\n for (let lineIndex = 0; lineIndex < lines.length; lineIndex++) {\n const line = lines[lineIndex];\n const lineContainsMarker = line.indexOf(MarkdownCodeBlocks.CODE_BLOCK_MARKER) === 0;\n const constructingBlock = currentBlock != null;\n // Skip this line if it is not part of any code block and doesn't contain a marker.\n if (!lineContainsMarker && !constructingBlock) {\n continue;\n }\n // Check if we are already constructing a code block.\n if (!constructingBlock) {\n // Start constructing a new code block.\n currentBlock = new MarkdownCodeBlock(lineIndex);\n // Check whether this is a single line code block of the form ```a = 10```.\n const firstIndex = line.indexOf(MarkdownCodeBlocks.CODE_BLOCK_MARKER);\n const lastIndex = line.lastIndexOf(MarkdownCodeBlocks.CODE_BLOCK_MARKER);\n const isSingleLine = firstIndex !== lastIndex;\n if (isSingleLine) {\n currentBlock.code = line.substring(firstIndex + MarkdownCodeBlocks.CODE_BLOCK_MARKER.length, lastIndex);\n currentBlock.endLine = lineIndex;\n codeBlocks.push(currentBlock);\n currentBlock = null;\n }\n }\n else if (currentBlock) {\n if (lineContainsMarker) {\n // End of block, finish it up.\n currentBlock.endLine = lineIndex - 1;\n codeBlocks.push(currentBlock);\n currentBlock = null;\n }\n else {\n // Append the current line.\n currentBlock.code += line + '\\n';\n }\n }\n }\n return codeBlocks;\n }\n MarkdownCodeBlocks.findMarkdownCodeBlocks = findMarkdownCodeBlocks;\n})(MarkdownCodeBlocks || (exports.MarkdownCodeBlocks = MarkdownCodeBlocks = {}));\n//# sourceMappingURL=markdowncodeblocks.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PageConfig = void 0;\nconst coreutils_1 = require(\"@lumino/coreutils\");\nconst minimist_1 = __importDefault(require(\"minimist\"));\nconst url_1 = require(\"./url\");\n/**\n * The namespace for `PageConfig` functions.\n */\nvar PageConfig;\n(function (PageConfig) {\n /**\n * Get global configuration data for the Jupyter application.\n *\n * @param name - The name of the configuration option.\n *\n * @returns The config value or an empty string if not found.\n *\n * #### Notes\n * All values are treated as strings.\n * For browser based applications, it is assumed that the page HTML\n * includes a script tag with the id `jupyter-config-data` containing the\n * configuration as valid JSON. In order to support the classic Notebook,\n * we fall back on checking for `body` data of the given `name`.\n *\n * For node applications, it is assumed that the process was launched\n * with a `--jupyter-config-data` option pointing to a JSON settings\n * file.\n */\n function getOption(name) {\n if (configData) {\n return configData[name] || getBodyData(name);\n }\n configData = Object.create(null);\n let found = false;\n // Use script tag if available.\n if (typeof document !== 'undefined' && document) {\n const el = document.getElementById('jupyter-config-data');\n if (el) {\n configData = JSON.parse(el.textContent || '');\n found = true;\n }\n }\n // Otherwise use CLI if given.\n if (!found && typeof process !== 'undefined' && process.argv) {\n try {\n const cli = (0, minimist_1.default)(process.argv.slice(2));\n const path = require('path');\n let fullPath = '';\n if ('jupyter-config-data' in cli) {\n fullPath = path.resolve(cli['jupyter-config-data']);\n }\n else if ('JUPYTER_CONFIG_DATA' in process.env) {\n fullPath = path.resolve(process.env['JUPYTER_CONFIG_DATA']);\n }\n if (fullPath) {\n // Force Webpack to ignore this require.\n // eslint-disable-next-line\n configData = eval('require')(fullPath);\n }\n }\n catch (e) {\n console.error(e);\n }\n }\n if (!coreutils_1.JSONExt.isObject(configData)) {\n configData = Object.create(null);\n }\n else {\n for (const key in configData) {\n // PageConfig expects strings\n if (typeof configData[key] !== 'string') {\n configData[key] = JSON.stringify(configData[key]);\n }\n }\n }\n return configData[name] || getBodyData(name);\n }\n PageConfig.getOption = getOption;\n /**\n * Set global configuration data for the Jupyter application.\n *\n * @param name - The name of the configuration option.\n * @param value - The value to set the option to.\n *\n * @returns The last config value or an empty string if it doesn't exist.\n */\n function setOption(name, value) {\n const last = getOption(name);\n configData[name] = value;\n return last;\n }\n PageConfig.setOption = setOption;\n /**\n * Get the base url for a Jupyter application, or the base url of the page.\n */\n function getBaseUrl() {\n return url_1.URLExt.normalize(getOption('baseUrl') || '/');\n }\n PageConfig.getBaseUrl = getBaseUrl;\n /**\n * Get the tree url for a JupyterLab application.\n */\n function getTreeUrl() {\n return url_1.URLExt.join(getBaseUrl(), getOption('treeUrl'));\n }\n PageConfig.getTreeUrl = getTreeUrl;\n /**\n * Get the base url for sharing links (usually baseUrl)\n */\n function getShareUrl() {\n return url_1.URLExt.normalize(getOption('shareUrl') || getBaseUrl());\n }\n PageConfig.getShareUrl = getShareUrl;\n /**\n * Get the tree url for shareable links.\n * Usually the same as treeUrl,\n * but overrideable e.g. when sharing with JupyterHub.\n */\n function getTreeShareUrl() {\n return url_1.URLExt.normalize(url_1.URLExt.join(getShareUrl(), getOption('treeUrl')));\n }\n PageConfig.getTreeShareUrl = getTreeShareUrl;\n /**\n * Create a new URL given an optional mode and tree path.\n *\n * This is used to create URLS when the mode or tree path change as the user\n * changes mode or the current document in the main area. If fields in\n * options are omitted, the value in PageConfig will be used.\n *\n * @param options - IGetUrlOptions for the new path.\n */\n function getUrl(options) {\n var _a, _b, _c, _d;\n let path = options.toShare ? getShareUrl() : getBaseUrl();\n const mode = (_a = options.mode) !== null && _a !== void 0 ? _a : getOption('mode');\n const workspace = (_b = options.workspace) !== null && _b !== void 0 ? _b : getOption('workspace');\n const labOrDoc = mode === 'single-document' ? 'doc' : 'lab';\n path = url_1.URLExt.join(path, labOrDoc);\n if (workspace !== PageConfig.defaultWorkspace) {\n path = url_1.URLExt.join(path, 'workspaces', encodeURIComponent((_c = getOption('workspace')) !== null && _c !== void 0 ? _c : PageConfig.defaultWorkspace));\n }\n const treePath = (_d = options.treePath) !== null && _d !== void 0 ? _d : getOption('treePath');\n if (treePath) {\n path = url_1.URLExt.join(path, 'tree', url_1.URLExt.encodeParts(treePath));\n }\n return path;\n }\n PageConfig.getUrl = getUrl;\n PageConfig.defaultWorkspace = 'default';\n /**\n * Get the base websocket url for a Jupyter application, or an empty string.\n */\n function getWsUrl(baseUrl) {\n let wsUrl = getOption('wsUrl');\n if (!wsUrl) {\n baseUrl = baseUrl ? url_1.URLExt.normalize(baseUrl) : getBaseUrl();\n if (baseUrl.indexOf('http') !== 0) {\n return '';\n }\n wsUrl = 'ws' + baseUrl.slice(4);\n }\n return url_1.URLExt.normalize(wsUrl);\n }\n PageConfig.getWsUrl = getWsUrl;\n /**\n * Returns the URL converting this notebook to a certain\n * format with nbconvert.\n */\n function getNBConvertURL({ path, format, download }) {\n const notebookPath = url_1.URLExt.encodeParts(path);\n const url = url_1.URLExt.join(getBaseUrl(), 'nbconvert', format, notebookPath);\n if (download) {\n return url + '?download=true';\n }\n return url;\n }\n PageConfig.getNBConvertURL = getNBConvertURL;\n /**\n * Get the authorization token for a Jupyter application.\n */\n function getToken() {\n return getOption('token') || getBodyData('jupyterApiToken');\n }\n PageConfig.getToken = getToken;\n /**\n * Get the Notebook version info [major, minor, patch].\n */\n function getNotebookVersion() {\n const notebookVersion = getOption('notebookVersion');\n if (notebookVersion === '') {\n return [0, 0, 0];\n }\n return JSON.parse(notebookVersion);\n }\n PageConfig.getNotebookVersion = getNotebookVersion;\n /**\n * Private page config data for the Jupyter application.\n */\n let configData = null;\n /**\n * Get a url-encoded item from `body.data` and decode it\n * We should never have any encoded URLs anywhere else in code\n * until we are building an actual request.\n */\n function getBodyData(key) {\n if (typeof document === 'undefined' || !document.body) {\n return '';\n }\n const val = document.body.dataset[key];\n if (typeof val === 'undefined') {\n return '';\n }\n return decodeURIComponent(val);\n }\n /**\n * The namespace for page config `Extension` functions.\n */\n let Extension;\n (function (Extension) {\n /**\n * Populate an array from page config.\n *\n * @param key - The page config key (e.g., `deferredExtensions`).\n *\n * #### Notes\n * This is intended for `deferredExtensions` and `disabledExtensions`.\n */\n function populate(key) {\n try {\n const raw = getOption(key);\n if (raw) {\n return JSON.parse(raw);\n }\n }\n catch (error) {\n console.warn(`Unable to parse ${key}.`, error);\n }\n return [];\n }\n /**\n * The collection of deferred extensions in page config.\n */\n Extension.deferred = populate('deferredExtensions');\n /**\n * The collection of disabled extensions in page config.\n */\n Extension.disabled = populate('disabledExtensions');\n /**\n * Returns whether a plugin is deferred.\n *\n * @param id - The plugin ID.\n */\n function isDeferred(id) {\n // Check for either a full plugin id match or an extension\n // name match.\n const separatorIndex = id.indexOf(':');\n let extName = '';\n if (separatorIndex !== -1) {\n extName = id.slice(0, separatorIndex);\n }\n return Extension.deferred.some(val => val === id || (extName && val === extName));\n }\n Extension.isDeferred = isDeferred;\n /**\n * Returns whether a plugin is disabled.\n *\n * @param id - The plugin ID.\n */\n function isDisabled(id) {\n // Check for either a full plugin id match or an extension\n // name match.\n const separatorIndex = id.indexOf(':');\n let extName = '';\n if (separatorIndex !== -1) {\n extName = id.slice(0, separatorIndex);\n }\n return Extension.disabled.some(val => val === id || (extName && val === extName));\n }\n Extension.isDisabled = isDisabled;\n })(Extension = PageConfig.Extension || (PageConfig.Extension = {}));\n})(PageConfig || (exports.PageConfig = PageConfig = {}));\n//# sourceMappingURL=pageconfig.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PathExt = void 0;\nconst path_1 = require(\"path\");\n/**\n * The namespace for path-related functions.\n *\n * Note that Jupyter server paths do not start with a leading slash.\n */\nvar PathExt;\n(function (PathExt) {\n /**\n * Join all arguments together and normalize the resulting path.\n * Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown.\n *\n * @param paths - The string paths to join.\n */\n function join(...paths) {\n const path = path_1.posix.join(...paths);\n return path === '.' ? '' : removeSlash(path);\n }\n PathExt.join = join;\n /**\n * Join all arguments together and normalize the resulting path and preserve the leading slash.\n *\n * @param paths - The string paths to join.\n */\n function joinWithLeadingSlash(...paths) {\n const path = path_1.posix.join(...paths);\n return path === '.' ? '' : path;\n }\n PathExt.joinWithLeadingSlash = joinWithLeadingSlash;\n /**\n * Return the last portion of a path. Similar to the Unix basename command.\n * Often used to extract the file name from a fully qualified path.\n *\n * @param path - The path to evaluate.\n *\n * @param ext - An extension to remove from the result.\n */\n function basename(path, ext) {\n return path_1.posix.basename(path, ext);\n }\n PathExt.basename = basename;\n /**\n * Get the directory name of a path, similar to the Unix dirname command.\n * When an empty path is given, returns the root path.\n *\n * @param path - The file path.\n */\n function dirname(path) {\n const dir = removeSlash(path_1.posix.dirname(path));\n return dir === '.' ? '' : dir;\n }\n PathExt.dirname = dirname;\n /**\n * Get the extension of the path.\n *\n * @param path - The file path.\n *\n * @returns the extension of the file.\n *\n * #### Notes\n * The extension is the string from the last occurrence of the `.`\n * character to end of string in the last portion of the path, inclusive.\n * If there is no `.` in the last portion of the path, or if the first\n * character of the basename of path [[basename]] is `.`, then an\n * empty string is returned.\n */\n function extname(path) {\n return path_1.posix.extname(path);\n }\n PathExt.extname = extname;\n /**\n * Normalize a string path, reducing '..' and '.' parts.\n * When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used.\n * When an empty path is given, returns the root path.\n *\n * @param path - The string path to normalize.\n */\n function normalize(path) {\n if (path === '') {\n return '';\n }\n return removeSlash(path_1.posix.normalize(path));\n }\n PathExt.normalize = normalize;\n /**\n * Resolve a sequence of paths or path segments into an absolute path.\n * The root path in the application has no leading slash, so it is removed.\n *\n * @param parts - The paths to join.\n *\n * #### Notes\n * The right-most parameter is considered \\{to\\}. Other parameters are considered an array of \\{from\\}.\n *\n * Starting from leftmost \\{from\\} parameter, resolves \\{to\\} to an absolute path.\n *\n * If \\{to\\} isn't already absolute, \\{from\\} arguments are prepended in right to left order, until an absolute path is found. If after using all \\{from\\} paths still no absolute path is found, the current working directory is used as well. The resulting path is normalized, and trailing slashes are removed unless the path gets resolved to the root directory.\n */\n function resolve(...parts) {\n return removeSlash(path_1.posix.resolve(...parts));\n }\n PathExt.resolve = resolve;\n /**\n * Solve the relative path from \\{from\\} to \\{to\\}.\n *\n * @param from - The source path.\n *\n * @param to - The target path.\n *\n * #### Notes\n * If from and to each resolve to the same path (after calling\n * path.resolve() on each), a zero-length string is returned.\n * If a zero-length string is passed as from or to, `/`\n * will be used instead of the zero-length strings.\n */\n function relative(from, to) {\n return removeSlash(path_1.posix.relative(from, to));\n }\n PathExt.relative = relative;\n /**\n * Normalize a file extension to be of the type `'.foo'`.\n *\n * @param extension - the file extension.\n *\n * #### Notes\n * Adds a leading dot if not present and converts to lower case.\n */\n function normalizeExtension(extension) {\n if (extension.length > 0 && extension.indexOf('.') !== 0) {\n extension = `.${extension}`;\n }\n return extension;\n }\n PathExt.normalizeExtension = normalizeExtension;\n /**\n * Remove the leading slash from a path.\n *\n * @param path the path from which to remove a leading slash.\n */\n function removeSlash(path) {\n if (path.indexOf('/') === 0) {\n path = path.slice(1);\n }\n return path;\n }\n PathExt.removeSlash = removeSlash;\n})(PathExt || (exports.PathExt = PathExt = {}));\n//# sourceMappingURL=path.js.map","\"use strict\";\n/*\n * Copyright (c) Jupyter Development Team.\n * Distributed under the terms of the Modified BSD License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.signalToPromise = void 0;\nconst coreutils_1 = require(\"@lumino/coreutils\");\n/**\n * Convert a signal into a promise for the first emitted value.\n *\n * @param signal - The signal we are listening to.\n * @param timeout - Timeout to wait for signal in ms (not timeout if not defined or 0)\n *\n * @returns a Promise that resolves with a `(sender, args)` pair.\n */\nfunction signalToPromise(signal, timeout) {\n const waitForSignal = new coreutils_1.PromiseDelegate();\n function cleanup() {\n signal.disconnect(slot);\n }\n function slot(sender, args) {\n cleanup();\n waitForSignal.resolve([sender, args]);\n }\n signal.connect(slot);\n if ((timeout !== null && timeout !== void 0 ? timeout : 0) > 0) {\n setTimeout(() => {\n cleanup();\n waitForSignal.reject(`Signal not emitted within ${timeout} ms.`);\n }, timeout);\n }\n return waitForSignal.promise;\n}\nexports.signalToPromise = signalToPromise;\n//# sourceMappingURL=signal.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Text = void 0;\n/**\n * The namespace for text-related functions.\n */\nvar Text;\n(function (Text) {\n // javascript stores text as utf16 and string indices use \"code units\",\n // which stores high-codepoint characters as \"surrogate pairs\",\n // which occupy two indices in the javascript string.\n // We need to translate cursor_pos in the Jupyter protocol (in characters)\n // to js offset (with surrogate pairs taking two spots).\n const HAS_SURROGATES = '𝐚'.length > 1;\n /**\n * Convert a javascript string index into a unicode character offset\n *\n * @param jsIdx - The javascript string index (counting surrogate pairs)\n *\n * @param text - The text in which the offset is calculated\n *\n * @returns The unicode character offset\n */\n function jsIndexToCharIndex(jsIdx, text) {\n if (HAS_SURROGATES) {\n // not using surrogates, nothing to do\n return jsIdx;\n }\n let charIdx = jsIdx;\n for (let i = 0; i + 1 < text.length && i < jsIdx; i++) {\n const charCode = text.charCodeAt(i);\n // check for surrogate pair\n if (charCode >= 0xd800 && charCode <= 0xdbff) {\n const nextCharCode = text.charCodeAt(i + 1);\n if (nextCharCode >= 0xdc00 && nextCharCode <= 0xdfff) {\n charIdx--;\n i++;\n }\n }\n }\n return charIdx;\n }\n Text.jsIndexToCharIndex = jsIndexToCharIndex;\n /**\n * Convert a unicode character offset to a javascript string index.\n *\n * @param charIdx - The index in unicode characters\n *\n * @param text - The text in which the offset is calculated\n *\n * @returns The js-native index\n */\n function charIndexToJsIndex(charIdx, text) {\n if (HAS_SURROGATES) {\n // not using surrogates, nothing to do\n return charIdx;\n }\n let jsIdx = charIdx;\n for (let i = 0; i + 1 < text.length && i < jsIdx; i++) {\n const charCode = text.charCodeAt(i);\n // check for surrogate pair\n if (charCode >= 0xd800 && charCode <= 0xdbff) {\n const nextCharCode = text.charCodeAt(i + 1);\n if (nextCharCode >= 0xdc00 && nextCharCode <= 0xdfff) {\n jsIdx++;\n i++;\n }\n }\n }\n return jsIdx;\n }\n Text.charIndexToJsIndex = charIndexToJsIndex;\n /**\n * Given a 'snake-case', 'snake_case', 'snake:case', or\n * 'snake case' string, will return the camel case version: 'snakeCase'.\n *\n * @param str the snake-case input string.\n *\n * @param upper default = false. If true, the first letter of the\n * returned string will be capitalized.\n *\n * @returns the camel case version of the input string.\n */\n function camelCase(str, upper = false) {\n return str.replace(/^(\\w)|[\\s-_:]+(\\w)/g, function (match, p1, p2) {\n if (p2) {\n return p2.toUpperCase();\n }\n else {\n return upper ? p1.toUpperCase() : p1.toLowerCase();\n }\n });\n }\n Text.camelCase = camelCase;\n /**\n * Given a string, title case the words in the string.\n *\n * @param str the string to title case.\n *\n * @returns the same string, but with each word capitalized.\n */\n function titleCase(str) {\n return (str || '')\n .toLowerCase()\n .split(' ')\n .map(word => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n }\n Text.titleCase = titleCase;\n})(Text || (exports.Text = Text = {}));\n//# sourceMappingURL=text.js.map","\"use strict\";\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.URLExt = void 0;\nconst path_1 = require(\"path\");\nconst url_parse_1 = __importDefault(require(\"url-parse\"));\n/**\n * The namespace for URL-related functions.\n */\nvar URLExt;\n(function (URLExt) {\n /**\n * Parse a url into a URL object.\n *\n * @param url - The URL string to parse.\n *\n * @returns A URL object.\n */\n function parse(url) {\n if (typeof document !== 'undefined' && document) {\n const a = document.createElement('a');\n a.href = url;\n return a;\n }\n return (0, url_parse_1.default)(url);\n }\n URLExt.parse = parse;\n /**\n * Parse URL and retrieve hostname\n *\n * @param url - The URL string to parse\n *\n * @returns a hostname string value\n */\n function getHostName(url) {\n return (0, url_parse_1.default)(url).hostname;\n }\n URLExt.getHostName = getHostName;\n function normalize(url) {\n return url && parse(url).toString();\n }\n URLExt.normalize = normalize;\n /**\n * Join a sequence of url components and normalizes as in node `path.join`.\n *\n * @param parts - The url components.\n *\n * @returns the joined url.\n */\n function join(...parts) {\n let u = (0, url_parse_1.default)(parts[0], {});\n // Schema-less URL can be only parsed as relative to a base URL\n // see https://github.com/unshiftio/url-parse/issues/219#issuecomment-1002219326\n const isSchemaLess = u.protocol === '' && u.slashes;\n if (isSchemaLess) {\n u = (0, url_parse_1.default)(parts[0], 'https:' + parts[0]);\n }\n const prefix = `${isSchemaLess ? '' : u.protocol}${u.slashes ? '//' : ''}${u.auth}${u.auth ? '@' : ''}${u.host}`;\n // If there was a prefix, then the first path must start at the root.\n const path = path_1.posix.join(`${!!prefix && u.pathname[0] !== '/' ? '/' : ''}${u.pathname}`, ...parts.slice(1));\n return `${prefix}${path === '.' ? '' : path}`;\n }\n URLExt.join = join;\n /**\n * Encode the components of a multi-segment url.\n *\n * @param url - The url to encode.\n *\n * @returns the encoded url.\n *\n * #### Notes\n * Preserves the `'/'` separators.\n * Should not include the base url, since all parts are escaped.\n */\n function encodeParts(url) {\n return join(...url.split('/').map(encodeURIComponent));\n }\n URLExt.encodeParts = encodeParts;\n /**\n * Return a serialized object string suitable for a query.\n *\n * @param value The source object.\n *\n * @returns an encoded url query.\n *\n * #### Notes\n * Modified version of [stackoverflow](http://stackoverflow.com/a/30707423).\n */\n function objectToQueryString(value) {\n const keys = Object.keys(value).filter(key => key.length > 0);\n if (!keys.length) {\n return '';\n }\n return ('?' +\n keys\n .map(key => {\n const content = encodeURIComponent(String(value[key]));\n return key + (content ? '=' + content : '');\n })\n .join('&'));\n }\n URLExt.objectToQueryString = objectToQueryString;\n /**\n * Return a parsed object that represents the values in a query string.\n */\n function queryStringToObject(value) {\n return value\n .replace(/^\\?/, '')\n .split('&')\n .reduce((acc, val) => {\n const [key, value] = val.split('=');\n if (key.length > 0) {\n acc[key] = decodeURIComponent(value || '');\n }\n return acc;\n }, {});\n }\n URLExt.queryStringToObject = queryStringToObject;\n /**\n * Test whether the url is a local url.\n *\n * @param allowRoot - Whether the paths starting at Unix-style filesystem root (`/`) are permitted.\n *\n * #### Notes\n * This function returns `false` for any fully qualified url, including\n * `data:`, `file:`, and `//` protocol URLs.\n */\n function isLocal(url, allowRoot = false) {\n const { protocol } = parse(url);\n return ((!protocol || url.toLowerCase().indexOf(protocol) !== 0) &&\n (allowRoot ? url.indexOf('//') !== 0 : url.indexOf('/') !== 0));\n }\n URLExt.isLocal = isLocal;\n})(URLExt || (exports.URLExt = URLExt = {}));\n//# sourceMappingURL=url.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/**\n * @packageDocumentation\n * @module javascript-extension\n */\nimport { RenderedJavaScript } from '@jupyterlab/rendermime';\nexport const TEXT_JAVASCRIPT_MIMETYPE = 'text/javascript';\nexport const APPLICATION_JAVASCRIPT_MIMETYPE = 'application/javascript';\nfunction evalInContext(code, element, document, window) {\n // eslint-disable-next-line\n return eval(code);\n}\nexport class ExperimentalRenderedJavascript extends RenderedJavaScript {\n render(model) {\n const trans = this.translator.load('jupyterlab');\n const renderJavascript = () => {\n try {\n const data = model.data[this.mimeType];\n if (data) {\n evalInContext(data, this.node, document, window);\n }\n return Promise.resolve();\n }\n catch (error) {\n return Promise.reject(error);\n }\n };\n if (!model.trusted) {\n // If output is not trusted or if arbitrary Javascript execution is not enabled, render an informative error message\n const pre = document.createElement('pre');\n pre.textContent = trans.__('Are you sure that you want to run arbitrary Javascript within your JupyterLab session?');\n const button = document.createElement('button');\n button.textContent = trans.__('Run');\n this.node.appendChild(pre);\n this.node.appendChild(button);\n button.onclick = event => {\n this.node.textContent = '';\n void renderJavascript();\n };\n return Promise.resolve();\n }\n return renderJavascript();\n }\n}\n/**\n * A mime renderer factory for text/javascript data.\n */\nexport const rendererFactory = {\n safe: false,\n mimeTypes: [TEXT_JAVASCRIPT_MIMETYPE, APPLICATION_JAVASCRIPT_MIMETYPE],\n createRenderer: options => new ExperimentalRenderedJavascript(options)\n};\nconst extension = {\n id: '@jupyterlab/javascript-extension:factory',\n description: 'Adds renderer for JavaScript content.',\n rendererFactory,\n rank: 0,\n dataType: 'string'\n};\nexport default extension;\n//# sourceMappingURL=index.js.map","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.lumino_coreutils = {}));\n}(this, (function (exports) { 'use strict';\n\n // Copyright (c) Jupyter Development Team.\n // Distributed under the terms of the Modified BSD License.\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014-2017, PhosphorJS Contributors\n |\n | Distributed under the terms of the BSD 3-Clause License.\n |\n | The full license is in the file LICENSE, distributed with this software.\n |----------------------------------------------------------------------------*/\n /**\n * The namespace for JSON-specific functions.\n */\n exports.JSONExt = void 0;\n (function (JSONExt) {\n /**\n * A shared frozen empty JSONObject\n */\n JSONExt.emptyObject = Object.freeze({});\n /**\n * A shared frozen empty JSONArray\n */\n JSONExt.emptyArray = Object.freeze([]);\n /**\n * Test whether a JSON value is a primitive.\n *\n * @param value - The JSON value of interest.\n *\n * @returns `true` if the value is a primitive,`false` otherwise.\n */\n function isPrimitive(value) {\n return (value === null ||\n typeof value === 'boolean' ||\n typeof value === 'number' ||\n typeof value === 'string');\n }\n JSONExt.isPrimitive = isPrimitive;\n function isArray(value) {\n return Array.isArray(value);\n }\n JSONExt.isArray = isArray;\n function isObject(value) {\n return !isPrimitive(value) && !isArray(value);\n }\n JSONExt.isObject = isObject;\n /**\n * Compare two JSON values for deep equality.\n *\n * @param first - The first JSON value of interest.\n *\n * @param second - The second JSON value of interest.\n *\n * @returns `true` if the values are equivalent, `false` otherwise.\n */\n function deepEqual(first, second) {\n // Check referential and primitive equality first.\n if (first === second) {\n return true;\n }\n // If one is a primitive, the `===` check ruled out the other.\n if (isPrimitive(first) || isPrimitive(second)) {\n return false;\n }\n // Test whether they are arrays.\n var a1 = isArray(first);\n var a2 = isArray(second);\n // Bail if the types are different.\n if (a1 !== a2) {\n return false;\n }\n // If they are both arrays, compare them.\n if (a1 && a2) {\n return deepArrayEqual(first, second);\n }\n // At this point, they must both be objects.\n return deepObjectEqual(first, second);\n }\n JSONExt.deepEqual = deepEqual;\n /**\n * Create a deep copy of a JSON value.\n *\n * @param value - The JSON value to copy.\n *\n * @returns A deep copy of the given JSON value.\n */\n function deepCopy(value) {\n // Do nothing for primitive values.\n if (isPrimitive(value)) {\n return value;\n }\n // Deep copy an array.\n if (isArray(value)) {\n return deepArrayCopy(value);\n }\n // Deep copy an object.\n return deepObjectCopy(value);\n }\n JSONExt.deepCopy = deepCopy;\n /**\n * Compare two JSON arrays for deep equality.\n */\n function deepArrayEqual(first, second) {\n // Check referential equality first.\n if (first === second) {\n return true;\n }\n // Test the arrays for equal length.\n if (first.length !== second.length) {\n return false;\n }\n // Compare the values for equality.\n for (var i = 0, n = first.length; i < n; ++i) {\n if (!deepEqual(first[i], second[i])) {\n return false;\n }\n }\n // At this point, the arrays are equal.\n return true;\n }\n /**\n * Compare two JSON objects for deep equality.\n */\n function deepObjectEqual(first, second) {\n // Check referential equality first.\n if (first === second) {\n return true;\n }\n // Check for the first object's keys in the second object.\n for (var key in first) {\n if (first[key] !== undefined && !(key in second)) {\n return false;\n }\n }\n // Check for the second object's keys in the first object.\n for (var key in second) {\n if (second[key] !== undefined && !(key in first)) {\n return false;\n }\n }\n // Compare the values for equality.\n for (var key in first) {\n // Get the values.\n var firstValue = first[key];\n var secondValue = second[key];\n // If both are undefined, ignore the key.\n if (firstValue === undefined && secondValue === undefined) {\n continue;\n }\n // If only one value is undefined, the objects are not equal.\n if (firstValue === undefined || secondValue === undefined) {\n return false;\n }\n // Compare the values.\n if (!deepEqual(firstValue, secondValue)) {\n return false;\n }\n }\n // At this point, the objects are equal.\n return true;\n }\n /**\n * Create a deep copy of a JSON array.\n */\n function deepArrayCopy(value) {\n var result = new Array(value.length);\n for (var i = 0, n = value.length; i < n; ++i) {\n result[i] = deepCopy(value[i]);\n }\n return result;\n }\n /**\n * Create a deep copy of a JSON object.\n */\n function deepObjectCopy(value) {\n var result = {};\n for (var key in value) {\n // Ignore undefined values.\n var subvalue = value[key];\n if (subvalue === undefined) {\n continue;\n }\n result[key] = deepCopy(subvalue);\n }\n return result;\n }\n })(exports.JSONExt || (exports.JSONExt = {}));\n\n // Copyright (c) Jupyter Development Team.\n // Distributed under the terms of the Modified BSD License.\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014-2017, PhosphorJS Contributors\n |\n | Distributed under the terms of the BSD 3-Clause License.\n |\n | The full license is in the file LICENSE, distributed with this software.\n |----------------------------------------------------------------------------*/\n /**\n * An object which stores MIME data for general application use.\n *\n * #### Notes\n * This class does not attempt to enforce \"correctness\" of MIME types\n * and their associated data. Since this class is designed to transfer\n * arbitrary data and objects within the same application, it assumes\n * that the user provides correct and accurate data.\n */\n var MimeData = /** @class */ (function () {\n function MimeData() {\n this._types = [];\n this._values = [];\n }\n /**\n * Get an array of the MIME types contained within the dataset.\n *\n * @returns A new array of the MIME types, in order of insertion.\n */\n MimeData.prototype.types = function () {\n return this._types.slice();\n };\n /**\n * Test whether the dataset has an entry for the given type.\n *\n * @param mime - The MIME type of interest.\n *\n * @returns `true` if the dataset contains a value for the given\n * MIME type, `false` otherwise.\n */\n MimeData.prototype.hasData = function (mime) {\n return this._types.indexOf(mime) !== -1;\n };\n /**\n * Get the data value for the given MIME type.\n *\n * @param mime - The MIME type of interest.\n *\n * @returns The value for the given MIME type, or `undefined` if\n * the dataset does not contain a value for the type.\n */\n MimeData.prototype.getData = function (mime) {\n var i = this._types.indexOf(mime);\n return i !== -1 ? this._values[i] : undefined;\n };\n /**\n * Set the data value for the given MIME type.\n *\n * @param mime - The MIME type of interest.\n *\n * @param data - The data value for the given MIME type.\n *\n * #### Notes\n * This will overwrite any previous entry for the MIME type.\n */\n MimeData.prototype.setData = function (mime, data) {\n this.clearData(mime);\n this._types.push(mime);\n this._values.push(data);\n };\n /**\n * Remove the data entry for the given MIME type.\n *\n * @param mime - The MIME type of interest.\n *\n * #### Notes\n * This is a no-op if there is no entry for the given MIME type.\n */\n MimeData.prototype.clearData = function (mime) {\n var i = this._types.indexOf(mime);\n if (i !== -1) {\n this._types.splice(i, 1);\n this._values.splice(i, 1);\n }\n };\n /**\n * Remove all data entries from the dataset.\n */\n MimeData.prototype.clear = function () {\n this._types.length = 0;\n this._values.length = 0;\n };\n return MimeData;\n }());\n\n // Copyright (c) Jupyter Development Team.\n // Distributed under the terms of the Modified BSD License.\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014-2017, PhosphorJS Contributors\n |\n | Distributed under the terms of the BSD 3-Clause License.\n |\n | The full license is in the file LICENSE, distributed with this software.\n |----------------------------------------------------------------------------*/\n /**\n * A class which wraps a promise into a delegate object.\n *\n * #### Notes\n * This class is useful when the logic to resolve or reject a promise\n * cannot be defined at the point where the promise is created.\n */\n var PromiseDelegate = /** @class */ (function () {\n /**\n * Construct a new promise delegate.\n */\n function PromiseDelegate() {\n var _this = this;\n this.promise = new Promise(function (resolve, reject) {\n _this._resolve = resolve;\n _this._reject = reject;\n });\n }\n /**\n * Resolve the wrapped promise with the given value.\n *\n * @param value - The value to use for resolving the promise.\n */\n PromiseDelegate.prototype.resolve = function (value) {\n var resolve = this._resolve;\n resolve(value);\n };\n /**\n * Reject the wrapped promise with the given value.\n *\n * @reason - The reason for rejecting the promise.\n */\n PromiseDelegate.prototype.reject = function (reason) {\n var reject = this._reject;\n reject(reason);\n };\n return PromiseDelegate;\n }());\n\n // Copyright (c) Jupyter Development Team.\n // Distributed under the terms of the Modified BSD License.\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014-2017, PhosphorJS Contributors\n |\n | Distributed under the terms of the BSD 3-Clause License.\n |\n | The full license is in the file LICENSE, distributed with this software.\n |----------------------------------------------------------------------------*/\n /**\n * A runtime object which captures compile-time type information.\n *\n * #### Notes\n * A token captures the compile-time type of an interface or class in\n * an object which can be used at runtime in a type-safe fashion.\n */\n var Token = /** @class */ (function () {\n /**\n * Construct a new token.\n *\n * @param name - A human readable name for the token.\n */\n function Token(name) {\n this.name = name;\n this._tokenStructuralPropertyT = null;\n }\n return Token;\n }());\n\n // Copyright (c) Jupyter Development Team.\n // Distributed under the terms of the Modified BSD License.\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014-2017, PhosphorJS Contributors\n |\n | Distributed under the terms of the BSD 3-Clause License.\n |\n | The full license is in the file LICENSE, distributed with this software.\n |----------------------------------------------------------------------------*/\n // Fallback\n function fallbackRandomValues(buffer) {\n var value = 0;\n for (var i = 0, n = buffer.length; i < n; ++i) {\n if (i % 4 === 0) {\n value = (Math.random() * 0xffffffff) >>> 0;\n }\n buffer[i] = value & 0xff;\n value >>>= 8;\n }\n }\n\n // Copyright (c) Jupyter Development Team.\n /**\n * The namespace for random number related functionality.\n */\n exports.Random = void 0;\n (function (Random) {\n /**\n * A function which generates random bytes.\n *\n * @param buffer - The `Uint8Array` to fill with random bytes.\n *\n * #### Notes\n * A cryptographically strong random number generator will be used if\n * available. Otherwise, `Math.random` will be used as a fallback for\n * randomness.\n *\n * The following RNGs are supported, listed in order of precedence:\n * - `window.crypto.getRandomValues`\n * - `window.msCrypto.getRandomValues`\n * - `require('crypto').randomFillSync\n * - `require('crypto').randomBytes\n * - `Math.random`\n */\n Random.getRandomValues = (function () {\n // Look up the crypto module if available.\n var crypto = (typeof window !== 'undefined' && (window.crypto || window.msCrypto)) ||\n null;\n // Modern browsers and IE 11\n if (crypto && typeof crypto.getRandomValues === 'function') {\n return function getRandomValues(buffer) {\n return crypto.getRandomValues(buffer);\n };\n }\n // Fallback\n return fallbackRandomValues;\n })();\n })(exports.Random || (exports.Random = {}));\n\n // Copyright (c) Jupyter Development Team.\n // Distributed under the terms of the Modified BSD License.\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014-2017, PhosphorJS Contributors\n |\n | Distributed under the terms of the BSD 3-Clause License.\n |\n | The full license is in the file LICENSE, distributed with this software.\n |----------------------------------------------------------------------------*/\n /**\n * A function which creates a function that generates UUID v4 identifiers.\n *\n * @returns A new function that creates a UUID v4 string.\n *\n * #### Notes\n * This implementation complies with RFC 4122.\n *\n * This uses `Random.getRandomValues()` for random bytes, which in\n * turn will use the underlying `crypto` module of the platform if\n * it is available. The fallback for randomness is `Math.random`.\n */\n function uuid4Factory(getRandomValues) {\n // Create a 16 byte array to hold the random values.\n var bytes = new Uint8Array(16);\n // Create a look up table from bytes to hex strings.\n var lut = new Array(256);\n // Pad the single character hex digits with a leading zero.\n for (var i = 0; i < 16; ++i) {\n lut[i] = '0' + i.toString(16);\n }\n // Populate the rest of the hex digits.\n for (var i = 16; i < 256; ++i) {\n lut[i] = i.toString(16);\n }\n // Return a function which generates the UUID.\n return function uuid4() {\n // Get a new batch of random values.\n getRandomValues(bytes);\n // Set the UUID version number to 4.\n bytes[6] = 0x40 | (bytes[6] & 0x0f);\n // Set the clock sequence bit to the RFC spec.\n bytes[8] = 0x80 | (bytes[8] & 0x3f);\n // Assemble the UUID string.\n return (lut[bytes[0]] +\n lut[bytes[1]] +\n lut[bytes[2]] +\n lut[bytes[3]] +\n '-' +\n lut[bytes[4]] +\n lut[bytes[5]] +\n '-' +\n lut[bytes[6]] +\n lut[bytes[7]] +\n '-' +\n lut[bytes[8]] +\n lut[bytes[9]] +\n '-' +\n lut[bytes[10]] +\n lut[bytes[11]] +\n lut[bytes[12]] +\n lut[bytes[13]] +\n lut[bytes[14]] +\n lut[bytes[15]]);\n };\n }\n\n // Copyright (c) Jupyter Development Team.\n /**\n * The namespace for UUID related functionality.\n */\n exports.UUID = void 0;\n (function (UUID) {\n /**\n * A function which generates UUID v4 identifiers.\n *\n * @returns A new UUID v4 string.\n *\n * #### Notes\n * This implementation complies with RFC 4122.\n *\n * This uses `Random.getRandomValues()` for random bytes, which in\n * turn will use the underlying `crypto` module of the platform if\n * it is available. The fallback for randomness is `Math.random`.\n */\n UUID.uuid4 = uuid4Factory(exports.Random.getRandomValues);\n })(exports.UUID || (exports.UUID = {}));\n\n exports.MimeData = MimeData;\n exports.PromiseDelegate = PromiseDelegate;\n exports.Token = Token;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n})));\n//# sourceMappingURL=index.js.map\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * The namespace for array-specific algorithms.\n */\nvar ArrayExt;\n(function (ArrayExt) {\n /**\n * Find the index of the first occurrence of a value in an array.\n *\n * @param array - The array-like object to search.\n *\n * @param value - The value to locate in the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first occurrence of the value, or `-1`\n * if the value is not found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four', 'one'];\n * ArrayExt.firstIndexOf(data, 'red'); // -1\n * ArrayExt.firstIndexOf(data, 'one'); // 0\n * ArrayExt.firstIndexOf(data, 'one', 1); // 4\n * ArrayExt.firstIndexOf(data, 'two', 2); // -1\n * ArrayExt.firstIndexOf(data, 'two', 2, 1); // 1\n * ```\n */\n function firstIndexOf(array, value, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let span;\n if (stop < start) {\n span = stop + 1 + (n - start);\n }\n else {\n span = stop - start + 1;\n }\n for (let i = 0; i < span; ++i) {\n let j = (start + i) % n;\n if (array[j] === value) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.firstIndexOf = firstIndexOf;\n /**\n * Find the index of the last occurrence of a value in an array.\n *\n * @param array - The array-like object to search.\n *\n * @param value - The value to locate in the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the last occurrence of the value, or `-1`\n * if the value is not found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four', 'one'];\n * ArrayExt.lastIndexOf(data, 'red'); // -1\n * ArrayExt.lastIndexOf(data, 'one'); // 4\n * ArrayExt.lastIndexOf(data, 'one', 1); // 0\n * ArrayExt.lastIndexOf(data, 'two', 0); // -1\n * ArrayExt.lastIndexOf(data, 'two', 0, 1); // 1\n * ```\n */\n function lastIndexOf(array, value, start = -1, stop = 0) {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let span;\n if (start < stop) {\n span = start + 1 + (n - stop);\n }\n else {\n span = start - stop + 1;\n }\n for (let i = 0; i < span; ++i) {\n let j = (start - i + n) % n;\n if (array[j] === value) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.lastIndexOf = lastIndexOf;\n /**\n * Find the index of the first value which matches a predicate.\n *\n * @param array - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first matching value, or `-1` if no\n * matching value is found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findFirstIndex(data, isEven); // 1\n * ArrayExt.findFirstIndex(data, isEven, 4); // 5\n * ArrayExt.findFirstIndex(data, isEven, 6); // -1\n * ArrayExt.findFirstIndex(data, isEven, 6, 5); // 1\n * ```\n */\n function findFirstIndex(array, fn, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let span;\n if (stop < start) {\n span = stop + 1 + (n - start);\n }\n else {\n span = stop - start + 1;\n }\n for (let i = 0; i < span; ++i) {\n let j = (start + i) % n;\n if (fn(array[j], j)) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.findFirstIndex = findFirstIndex;\n /**\n * Find the index of the last value which matches a predicate.\n *\n * @param array - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the last matching value, or `-1` if no\n * matching value is found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findLastIndex(data, isEven); // 5\n * ArrayExt.findLastIndex(data, isEven, 4); // 3\n * ArrayExt.findLastIndex(data, isEven, 0); // -1\n * ArrayExt.findLastIndex(data, isEven, 0, 1); // 5\n * ```\n */\n function findLastIndex(array, fn, start = -1, stop = 0) {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let d;\n if (start < stop) {\n d = start + 1 + (n - stop);\n }\n else {\n d = start - stop + 1;\n }\n for (let i = 0; i < d; ++i) {\n let j = (start - i + n) % n;\n if (fn(array[j], j)) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.findLastIndex = findLastIndex;\n /**\n * Find the first value which matches a predicate.\n *\n * @param array - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The first matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findFirstValue(data, isEven); // 2\n * ArrayExt.findFirstValue(data, isEven, 2); // 4\n * ArrayExt.findFirstValue(data, isEven, 6); // undefined\n * ArrayExt.findFirstValue(data, isEven, 6, 5); // 2\n * ```\n */\n function findFirstValue(array, fn, start = 0, stop = -1) {\n let index = findFirstIndex(array, fn, start, stop);\n return index !== -1 ? array[index] : undefined;\n }\n ArrayExt.findFirstValue = findFirstValue;\n /**\n * Find the last value which matches a predicate.\n *\n * @param object - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The last matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findLastValue(data, isEven); // 2\n * ArrayExt.findLastValue(data, isEven, 4); // 4\n * ArrayExt.findLastValue(data, isEven, 0); // undefined\n * ArrayExt.findLastValue(data, isEven, 0, 1); // 2\n * ```\n */\n function findLastValue(array, fn, start = -1, stop = 0) {\n let index = findLastIndex(array, fn, start, stop);\n return index !== -1 ? array[index] : undefined;\n }\n ArrayExt.findLastValue = findLastValue;\n /**\n * Find the index of the first element which compares `>=` to a value.\n *\n * @param array - The sorted array-like object to search.\n *\n * @param value - The value to locate in the array.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if an element is less than a value, `0` if\n * an element is equal to a value, or `> 0` if an element is greater\n * than a value.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first element which compares `>=` to the\n * value, or `length` if there is no such element. If the computed\n * index for `stop` is less than `start`, then the computed index\n * for `start` is returned.\n *\n * #### Notes\n * The array must already be sorted in ascending order according to\n * the comparison function.\n *\n * #### Complexity\n * Logarithmic.\n *\n * #### Undefined Behavior\n * Searching a range which is not sorted in ascending order.\n *\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.lowerBound(data, 0, numberCmp); // 0\n * ArrayExt.lowerBound(data, 6, numberCmp); // 3\n * ArrayExt.lowerBound(data, 7, numberCmp); // 3\n * ArrayExt.lowerBound(data, -1, numberCmp); // 0\n * ArrayExt.lowerBound(data, 10, numberCmp); // 6\n * ```\n */\n function lowerBound(array, value, fn, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let begin = start;\n let span = stop - start + 1;\n while (span > 0) {\n let half = span >> 1;\n let middle = begin + half;\n if (fn(array[middle], value) < 0) {\n begin = middle + 1;\n span -= half + 1;\n }\n else {\n span = half;\n }\n }\n return begin;\n }\n ArrayExt.lowerBound = lowerBound;\n /**\n * Find the index of the first element which compares `>` than a value.\n *\n * @param array - The sorted array-like object to search.\n *\n * @param value - The value to locate in the array.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if an element is less than a value, `0` if\n * an element is equal to a value, or `> 0` if an element is greater\n * than a value.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first element which compares `>` than the\n * value, or `length` if there is no such element. If the computed\n * index for `stop` is less than `start`, then the computed index\n * for `start` is returned.\n *\n * #### Notes\n * The array must already be sorted in ascending order according to\n * the comparison function.\n *\n * #### Complexity\n * Logarithmic.\n *\n * #### Undefined Behavior\n * Searching a range which is not sorted in ascending order.\n *\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.upperBound(data, 0, numberCmp); // 1\n * ArrayExt.upperBound(data, 6, numberCmp); // 3\n * ArrayExt.upperBound(data, 7, numberCmp); // 5\n * ArrayExt.upperBound(data, -1, numberCmp); // 0\n * ArrayExt.upperBound(data, 10, numberCmp); // 6\n * ```\n */\n function upperBound(array, value, fn, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let begin = start;\n let span = stop - start + 1;\n while (span > 0) {\n let half = span >> 1;\n let middle = begin + half;\n if (fn(array[middle], value) > 0) {\n span = half;\n }\n else {\n begin = middle + 1;\n span -= half + 1;\n }\n }\n return begin;\n }\n ArrayExt.upperBound = upperBound;\n /**\n * Test whether two arrays are shallowly equal.\n *\n * @param a - The first array-like object to compare.\n *\n * @param b - The second array-like object to compare.\n *\n * @param fn - The comparison function to apply to the elements. It\n * should return `true` if the elements are \"equal\". The default\n * compares elements using strict `===` equality.\n *\n * @returns Whether the two arrays are shallowly equal.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * Modifying the length of the arrays while comparing.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let d1 = [0, 3, 4, 7, 7, 9];\n * let d2 = [0, 3, 4, 7, 7, 9];\n * let d3 = [42];\n * ArrayExt.shallowEqual(d1, d2); // true\n * ArrayExt.shallowEqual(d2, d3); // false\n * ```\n */\n function shallowEqual(a, b, fn) {\n // Check for object identity first.\n if (a === b) {\n return true;\n }\n // Bail early if the lengths are different.\n if (a.length !== b.length) {\n return false;\n }\n // Compare each element for equality.\n for (let i = 0, n = a.length; i < n; ++i) {\n if (fn ? !fn(a[i], b[i]) : a[i] !== b[i]) {\n return false;\n }\n }\n // The array are shallowly equal.\n return true;\n }\n ArrayExt.shallowEqual = shallowEqual;\n /**\n * Create a slice of an array subject to an optional step.\n *\n * @param array - The array-like object of interest.\n *\n * @param options - The options for configuring the slice.\n *\n * @returns A new array with the specified values.\n *\n * @throws An exception if the slice `step` is `0`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start`, `stop`, or `step` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.slice(data); // [0, 3, 4, 7, 7, 9]\n * ArrayExt.slice(data, { start: 2 }); // [4, 7, 7, 9]\n * ArrayExt.slice(data, { start: 0, stop: 4 }); // [0, 3, 4, 7]\n * ArrayExt.slice(data, { step: 2 }); // [0, 4, 7]\n * ArrayExt.slice(data, { step: -1 }); // [9, 7, 7, 4, 3, 0]\n * ```\n */\n function slice(array, options = {}) {\n // Extract the options.\n let { start, stop, step } = options;\n // Set up the `step` value.\n if (step === undefined) {\n step = 1;\n }\n // Validate the step size.\n if (step === 0) {\n throw new Error('Slice `step` cannot be zero.');\n }\n // Look up the length of the array.\n let n = array.length;\n // Set up the `start` value.\n if (start === undefined) {\n start = step < 0 ? n - 1 : 0;\n }\n else if (start < 0) {\n start = Math.max(start + n, step < 0 ? -1 : 0);\n }\n else if (start >= n) {\n start = step < 0 ? n - 1 : n;\n }\n // Set up the `stop` value.\n if (stop === undefined) {\n stop = step < 0 ? -1 : n;\n }\n else if (stop < 0) {\n stop = Math.max(stop + n, step < 0 ? -1 : 0);\n }\n else if (stop >= n) {\n stop = step < 0 ? n - 1 : n;\n }\n // Compute the slice length.\n let length;\n if ((step < 0 && stop >= start) || (step > 0 && start >= stop)) {\n length = 0;\n }\n else if (step < 0) {\n length = Math.floor((stop - start + 1) / step + 1);\n }\n else {\n length = Math.floor((stop - start - 1) / step + 1);\n }\n // Compute the sliced result.\n let result = [];\n for (let i = 0; i < length; ++i) {\n result[i] = array[start + i * step];\n }\n // Return the result.\n return result;\n }\n ArrayExt.slice = slice;\n /**\n * Move an element in an array from one index to another.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param fromIndex - The index of the element to move. Negative\n * values are taken as an offset from the end of the array.\n *\n * @param toIndex - The target index of the element. Negative\n * values are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `fromIndex` or `toIndex` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.move(data, 1, 2); // [0, 2, 1, 3, 4]\n * ArrayExt.move(data, 4, 2); // [0, 2, 4, 1, 3]\n * ```\n */\n function move(array, fromIndex, toIndex) {\n let n = array.length;\n if (n <= 1) {\n return;\n }\n if (fromIndex < 0) {\n fromIndex = Math.max(0, fromIndex + n);\n }\n else {\n fromIndex = Math.min(fromIndex, n - 1);\n }\n if (toIndex < 0) {\n toIndex = Math.max(0, toIndex + n);\n }\n else {\n toIndex = Math.min(toIndex, n - 1);\n }\n if (fromIndex === toIndex) {\n return;\n }\n let value = array[fromIndex];\n let d = fromIndex < toIndex ? 1 : -1;\n for (let i = fromIndex; i !== toIndex; i += d) {\n array[i] = array[i + d];\n }\n array[toIndex] = value;\n }\n ArrayExt.move = move;\n /**\n * Reverse an array in-place.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param start - The index of the first element in the range to be\n * reversed, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * reversed, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` index which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.reverse(data, 1, 3); // [0, 3, 2, 1, 4]\n * ArrayExt.reverse(data, 3); // [0, 3, 2, 4, 1]\n * ArrayExt.reverse(data); // [1, 4, 2, 3, 0]\n * ```\n */\n function reverse(array, start = 0, stop = -1) {\n let n = array.length;\n if (n <= 1) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n while (start < stop) {\n let a = array[start];\n let b = array[stop];\n array[start++] = b;\n array[stop--] = a;\n }\n }\n ArrayExt.reverse = reverse;\n /**\n * Rotate the elements of an array in-place.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param delta - The amount of rotation to apply to the elements. A\n * positive value will rotate the elements to the left. A negative\n * value will rotate the elements to the right.\n *\n * @param start - The index of the first element in the range to be\n * rotated, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * rotated, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `delta`, `start`, or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.rotate(data, 2); // [2, 3, 4, 0, 1]\n * ArrayExt.rotate(data, -2); // [0, 1, 2, 3, 4]\n * ArrayExt.rotate(data, 10); // [0, 1, 2, 3, 4]\n * ArrayExt.rotate(data, 9); // [4, 0, 1, 2, 3]\n * ArrayExt.rotate(data, 2, 1, 3); // [4, 2, 0, 1, 3]\n * ```\n */\n function rotate(array, delta, start = 0, stop = -1) {\n let n = array.length;\n if (n <= 1) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n if (start >= stop) {\n return;\n }\n let length = stop - start + 1;\n if (delta > 0) {\n delta = delta % length;\n }\n else if (delta < 0) {\n delta = ((delta % length) + length) % length;\n }\n if (delta === 0) {\n return;\n }\n let pivot = start + delta;\n reverse(array, start, pivot - 1);\n reverse(array, pivot, stop);\n reverse(array, start, stop);\n }\n ArrayExt.rotate = rotate;\n /**\n * Fill an array with a static value.\n *\n * @param array - The mutable array-like object to fill.\n *\n * @param value - The static value to use to fill the array.\n *\n * @param start - The index of the first element in the range to be\n * filled, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * filled, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Notes\n * If `stop < start` the fill will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four'];\n * ArrayExt.fill(data, 'r'); // ['r', 'r', 'r', 'r']\n * ArrayExt.fill(data, 'g', 1); // ['r', 'g', 'g', 'g']\n * ArrayExt.fill(data, 'b', 2, 3); // ['r', 'g', 'b', 'b']\n * ArrayExt.fill(data, 'z', 3, 1); // ['z', 'z', 'b', 'z']\n * ```\n */\n function fill(array, value, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let span;\n if (stop < start) {\n span = stop + 1 + (n - start);\n }\n else {\n span = stop - start + 1;\n }\n for (let i = 0; i < span; ++i) {\n array[(start + i) % n] = value;\n }\n }\n ArrayExt.fill = fill;\n /**\n * Insert a value into an array at a specific index.\n *\n * @param array - The array of interest.\n *\n * @param index - The index at which to insert the value. Negative\n * values are taken as an offset from the end of the array.\n *\n * @param value - The value to set at the specified index.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2];\n * ArrayExt.insert(data, 0, -1); // [-1, 0, 1, 2]\n * ArrayExt.insert(data, 2, 12); // [-1, 0, 12, 1, 2]\n * ArrayExt.insert(data, -1, 7); // [-1, 0, 12, 1, 7, 2]\n * ArrayExt.insert(data, 6, 19); // [-1, 0, 12, 1, 7, 2, 19]\n * ```\n */\n function insert(array, index, value) {\n let n = array.length;\n if (index < 0) {\n index = Math.max(0, index + n);\n }\n else {\n index = Math.min(index, n);\n }\n for (let i = n; i > index; --i) {\n array[i] = array[i - 1];\n }\n array[index] = value;\n }\n ArrayExt.insert = insert;\n /**\n * Remove and return a value at a specific index in an array.\n *\n * @param array - The array of interest.\n *\n * @param index - The index of the value to remove. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The value at the specified index, or `undefined` if the\n * index is out of range.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeAt(data, 2); // 23\n * ArrayExt.removeAt(data, -2); // 12\n * ArrayExt.removeAt(data, 10); // undefined;\n * ```\n */\n function removeAt(array, index) {\n let n = array.length;\n if (index < 0) {\n index += n;\n }\n if (index < 0 || index >= n) {\n return undefined;\n }\n let value = array[index];\n for (let i = index + 1; i < n; ++i) {\n array[i - 1] = array[i];\n }\n array.length = n - 1;\n return value;\n }\n ArrayExt.removeAt = removeAt;\n /**\n * Remove the first occurrence of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the removed value, or `-1` if the value\n * is not contained in the array.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeFirstOf(data, 12); // 1\n * ArrayExt.removeFirstOf(data, 17); // -1\n * ArrayExt.removeFirstOf(data, 39, 3); // -1\n * ArrayExt.removeFirstOf(data, 39, 3, 2); // 2\n * ```\n */\n function removeFirstOf(array, value, start = 0, stop = -1) {\n let index = firstIndexOf(array, value, start, stop);\n if (index !== -1) {\n removeAt(array, index);\n }\n return index;\n }\n ArrayExt.removeFirstOf = removeFirstOf;\n /**\n * Remove the last occurrence of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the removed value, or `-1` if the value\n * is not contained in the array.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeLastOf(data, 12); // 5\n * ArrayExt.removeLastOf(data, 17); // -1\n * ArrayExt.removeLastOf(data, 39, 2); // -1\n * ArrayExt.removeLastOf(data, 39, 2, 3); // 3\n * ```\n */\n function removeLastOf(array, value, start = -1, stop = 0) {\n let index = lastIndexOf(array, value, start, stop);\n if (index !== -1) {\n removeAt(array, index);\n }\n return index;\n }\n ArrayExt.removeLastOf = removeLastOf;\n /**\n * Remove all occurrences of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The number of elements removed from the array.\n *\n * #### Notes\n * If `stop < start` the search will conceptually wrap at the end of\n * the array, however the array will be traversed front-to-back.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [14, 12, 23, 39, 14, 12, 19, 14];\n * ArrayExt.removeAllOf(data, 12); // 2\n * ArrayExt.removeAllOf(data, 17); // 0\n * ArrayExt.removeAllOf(data, 14, 1, 4); // 1\n * ```\n */\n function removeAllOf(array, value, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let count = 0;\n for (let i = 0; i < n; ++i) {\n if (start <= stop && i >= start && i <= stop && array[i] === value) {\n count++;\n }\n else if (stop < start &&\n (i <= stop || i >= start) &&\n array[i] === value) {\n count++;\n }\n else if (count > 0) {\n array[i - count] = array[i];\n }\n }\n if (count > 0) {\n array.length = n - count;\n }\n return count;\n }\n ArrayExt.removeAllOf = removeAllOf;\n /**\n * Remove the first occurrence of a value which matches a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The removed `{ index, value }`, which will be `-1` and\n * `undefined` if the value is not contained in the array.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeFirstWhere(data, isEven); // { index: 0, value: 0 }\n * ArrayExt.removeFirstWhere(data, isEven, 2); // { index: 3, value: 14 }\n * ArrayExt.removeFirstWhere(data, isEven, 4); // { index: -1, value: undefined }\n * ```\n */\n function removeFirstWhere(array, fn, start = 0, stop = -1) {\n let value;\n let index = findFirstIndex(array, fn, start, stop);\n if (index !== -1) {\n value = removeAt(array, index);\n }\n return { index, value };\n }\n ArrayExt.removeFirstWhere = removeFirstWhere;\n /**\n * Remove the last occurrence of a value which matches a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The removed `{ index, value }`, which will be `-1` and\n * `undefined` if the value is not contained in the array.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeLastWhere(data, isEven); // { index: 5, value: 12 }\n * ArrayExt.removeLastWhere(data, isEven, 2); // { index: 1, value: 12 }\n * ArrayExt.removeLastWhere(data, isEven, 2, 1); // { index: -1, value: undefined }\n * ```\n */\n function removeLastWhere(array, fn, start = -1, stop = 0) {\n let value;\n let index = findLastIndex(array, fn, start, stop);\n if (index !== -1) {\n value = removeAt(array, index);\n }\n return { index, value };\n }\n ArrayExt.removeLastWhere = removeLastWhere;\n /**\n * Remove all occurrences of values which match a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The number of elements removed from the array.\n *\n * #### Notes\n * If `stop < start` the search will conceptually wrap at the end of\n * the array, however the array will be traversed front-to-back.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * function isNegative(value: number): boolean {\n * return value < 0;\n * }\n *\n * let data = [0, 12, -13, -9, 23, 39, 14, -15, 12, 75];\n * ArrayExt.removeAllWhere(data, isEven); // 4\n * ArrayExt.removeAllWhere(data, isNegative, 0, 3); // 2\n * ```\n */\n function removeAllWhere(array, fn, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let count = 0;\n for (let i = 0; i < n; ++i) {\n if (start <= stop && i >= start && i <= stop && fn(array[i], i)) {\n count++;\n }\n else if (stop < start && (i <= stop || i >= start) && fn(array[i], i)) {\n count++;\n }\n else if (count > 0) {\n array[i - count] = array[i];\n }\n }\n if (count > 0) {\n array.length = n - count;\n }\n return count;\n }\n ArrayExt.removeAllWhere = removeAllWhere;\n})(ArrayExt || (ArrayExt = {}));\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Chain together several iterables.\n *\n * @deprecated\n *\n * @param objects - The iterable objects of interest.\n *\n * @returns An iterator which yields the values of the iterables\n * in the order in which they are supplied.\n *\n * #### Example\n * ```typescript\n * import { chain } from '@lumino/algorithm';\n *\n * let data1 = [1, 2, 3];\n * let data2 = [4, 5, 6];\n *\n * let stream = chain(data1, data2);\n *\n * Array.from(stream); // [1, 2, 3, 4, 5, 6]\n * ```\n */\nfunction* chain(...objects) {\n for (const object of objects) {\n yield* object;\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an empty iterator.\n *\n * @returns A new iterator which yields nothing.\n *\n * #### Example\n * ```typescript\n * import { empty } from '@lumino/algorithm';\n *\n * let stream = empty();\n *\n * Array.from(stream); // []\n * ```\n */\n// eslint-disable-next-line require-yield\nfunction* empty() {\n return;\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Enumerate an iterable object.\n *\n * @param object - The iterable object of interest.\n *\n * @param start - The starting enum value. The default is `0`.\n *\n * @returns An iterator which yields the enumerated values.\n *\n * #### Example\n * ```typescript\n * import { enumerate } from '@lumino/algorithm';\n *\n * let data = ['foo', 'bar', 'baz'];\n *\n * let stream = enumerate(data, 1);\n *\n * Array.from(stream); // [[1, 'foo'], [2, 'bar'], [3, 'baz']]\n * ```\n */\nfunction* enumerate(object, start = 0) {\n for (const value of object) {\n yield [start++, value];\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Filter an iterable for values which pass a test.\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns An iterator which yields the values which pass the test.\n *\n * #### Example\n * ```typescript\n * import { filter } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = filter(data, value => value % 2 === 0);\n *\n * Array.from(stream); // [2, 4, 6]\n * ```\n */\nfunction* filter(object, fn) {\n let index = 0;\n for (const value of object) {\n if (fn(value, index++)) {\n yield value;\n }\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Find the first value in an iterable which matches a predicate.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @returns The first matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { find } from '@lumino/algorithm';\n *\n * interface IAnimal { species: string, name: string };\n *\n * function isCat(value: IAnimal): boolean {\n * return value.species === 'cat';\n * }\n *\n * let data: IAnimal[] = [\n * { species: 'dog', name: 'spot' },\n * { species: 'cat', name: 'fluffy' },\n * { species: 'alligator', name: 'pocho' }\n * ];\n *\n * find(data, isCat).name; // 'fluffy'\n * ```\n */\nfunction find(object, fn) {\n let index = 0;\n for (const value of object) {\n if (fn(value, index++)) {\n return value;\n }\n }\n return undefined;\n}\n/**\n * Find the index of the first value which matches a predicate.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @returns The index of the first matching value, or `-1` if no\n * matching value is found.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { findIndex } from '@lumino/algorithm';\n *\n * interface IAnimal { species: string, name: string };\n *\n * function isCat(value: IAnimal): boolean {\n * return value.species === 'cat';\n * }\n *\n * let data: IAnimal[] = [\n * { species: 'dog', name: 'spot' },\n * { species: 'cat', name: 'fluffy' },\n * { species: 'alligator', name: 'pocho' }\n * ];\n *\n * findIndex(data, isCat); // 1\n * ```\n */\nfunction findIndex(object, fn) {\n let index = 0;\n for (const value of object) {\n if (fn(value, index++)) {\n return index - 1;\n }\n }\n return -1;\n}\n/**\n * Find the minimum value in an iterable.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns The minimum value in the iterable. If multiple values are\n * equivalent to the minimum, the left-most value is returned. If\n * the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { min } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * min([7, 4, 0, 3, 9, 4], numberCmp); // 0\n * ```\n */\nfunction min(object, fn) {\n let result = undefined;\n for (const value of object) {\n if (result === undefined) {\n result = value;\n continue;\n }\n if (fn(value, result) < 0) {\n result = value;\n }\n }\n return result;\n}\n/**\n * Find the maximum value in an iterable.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns The maximum value in the iterable. If multiple values are\n * equivalent to the maximum, the left-most value is returned. If\n * the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { max } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * max([7, 4, 0, 3, 9, 4], numberCmp); // 9\n * ```\n */\nfunction max(object, fn) {\n let result = undefined;\n for (const value of object) {\n if (result === undefined) {\n result = value;\n continue;\n }\n if (fn(value, result) > 0) {\n result = value;\n }\n }\n return result;\n}\n/**\n * Find the minimum and maximum values in an iterable.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns A 2-tuple of the `[min, max]` values in the iterable. If\n * multiple values are equivalent, the left-most values are returned.\n * If the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { minmax } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * minmax([7, 4, 0, 3, 9, 4], numberCmp); // [0, 9]\n * ```\n */\nfunction minmax(object, fn) {\n let empty = true;\n let vmin;\n let vmax;\n for (const value of object) {\n if (empty) {\n vmin = value;\n vmax = value;\n empty = false;\n }\n else if (fn(value, vmin) < 0) {\n vmin = value;\n }\n else if (fn(value, vmax) > 0) {\n vmax = value;\n }\n }\n return empty ? undefined : [vmin, vmax];\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an array from an iterable of values.\n *\n * @deprecated\n *\n * @param object - The iterable object of interest.\n *\n * @returns A new array of values from the given object.\n *\n * #### Example\n * ```typescript\n * import { toArray } from '@lumino/algorithm';\n *\n * let stream = [1, 2, 3, 4, 5, 6][Symbol.iterator]();\n *\n * toArray(stream); // [1, 2, 3, 4, 5, 6];\n * ```\n */\nfunction toArray(object) {\n return Array.from(object);\n}\n/**\n * Create an object from an iterable of key/value pairs.\n *\n * @param object - The iterable object of interest.\n *\n * @returns A new object mapping keys to values.\n *\n * #### Example\n * ```typescript\n * import { toObject } from '@lumino/algorithm';\n *\n * let data: [string, number][] = [['one', 1], ['two', 2], ['three', 3]];\n *\n * toObject(data); // { one: 1, two: 2, three: 3 }\n * ```\n */\nfunction toObject(object) {\n const result = {};\n for (const [key, value] of object) {\n result[key] = value;\n }\n return result;\n}\n/**\n * Invoke a function for each value in an iterable.\n *\n * @deprecated\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The callback function to invoke for each value.\n *\n * #### Notes\n * Iteration can be terminated early by returning `false` from the\n * callback function.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { each } from '@lumino/algorithm';\n *\n * let data = [5, 7, 0, -2, 9];\n *\n * each(data, value => { console.log(value); });\n * ```\n */\nfunction each(object, fn) {\n let index = 0;\n for (const value of object) {\n if (false === fn(value, index++)) {\n return;\n }\n }\n}\n/**\n * Test whether all values in an iterable satisfy a predicate.\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns `true` if all values pass the test, `false` otherwise.\n *\n * #### Notes\n * Iteration terminates on the first `false` predicate result.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { every } from '@lumino/algorithm';\n *\n * let data = [5, 7, 1];\n *\n * every(data, value => value % 2 === 0); // false\n * every(data, value => value % 2 === 1); // true\n * ```\n */\nfunction every(object, fn) {\n let index = 0;\n for (const value of object) {\n if (false === fn(value, index++)) {\n return false;\n }\n }\n return true;\n}\n/**\n * Test whether any value in an iterable satisfies a predicate.\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns `true` if any value passes the test, `false` otherwise.\n *\n * #### Notes\n * Iteration terminates on the first `true` predicate result.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { some } from '@lumino/algorithm';\n *\n * let data = [5, 7, 1];\n *\n * some(data, value => value === 7); // true\n * some(data, value => value === 3); // false\n * ```\n */\nfunction some(object, fn) {\n let index = 0;\n for (const value of object) {\n if (fn(value, index++)) {\n return true;\n }\n }\n return false;\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Transform the values of an iterable with a mapping function.\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The mapping function to invoke for each value.\n *\n * @returns An iterator which yields the transformed values.\n *\n * #### Example\n * ```typescript\n * import { map } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3];\n *\n * let stream = map(data, value => value * 2);\n *\n * Array.from(stream); // [2, 4, 6]\n * ```\n */\nfunction* map(object, fn) {\n let index = 0;\n for (const value of object) {\n yield fn(value, index++);\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an iterator of evenly spaced values.\n *\n * @param start - The starting value for the range, inclusive.\n *\n * @param stop - The stopping value for the range, exclusive.\n *\n * @param step - The distance between each value.\n *\n * @returns An iterator which produces evenly spaced values.\n *\n * #### Notes\n * In the single argument form of `range(stop)`, `start` defaults to\n * `0` and `step` defaults to `1`.\n *\n * In the two argument form of `range(start, stop)`, `step` defaults\n * to `1`.\n *\n * #### Example\n * ```typescript\n * import { range } from '@lumino/algorithm';\n *\n * let stream = range(2, 4);\n *\n * Array.from(stream); // [2, 3]\n * ```\n */\nfunction* range(start, stop, step) {\n if (stop === undefined) {\n stop = start;\n start = 0;\n step = 1;\n }\n else if (step === undefined) {\n step = 1;\n }\n const length = Private.rangeLength(start, stop, step);\n for (let index = 0; index < length; index++) {\n yield start + step * index;\n }\n}\n/**\n * The namespace for the module implementation details.\n */\nvar Private;\n(function (Private) {\n /**\n * Compute the effective length of a range.\n *\n * @param start - The starting value for the range, inclusive.\n *\n * @param stop - The stopping value for the range, exclusive.\n *\n * @param step - The distance between each value.\n *\n * @returns The number of steps need to traverse the range.\n */\n function rangeLength(start, stop, step) {\n if (step === 0) {\n return Infinity;\n }\n if (start > stop && step > 0) {\n return 0;\n }\n if (start < stop && step < 0) {\n return 0;\n }\n return Math.ceil((stop - start) / step);\n }\n Private.rangeLength = rangeLength;\n})(Private || (Private = {}));\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nfunction reduce(object, fn, initial) {\n // Setup the iterator and fetch the first value.\n const it = object[Symbol.iterator]();\n let index = 0;\n let first = it.next();\n // An empty iterator and no initial value is an error.\n if (first.done && initial === undefined) {\n throw new TypeError('Reduce of empty iterable with no initial value.');\n }\n // If the iterator is empty, return the initial value.\n if (first.done) {\n return initial;\n }\n // If the iterator has a single item and no initial value, the\n // reducer is not invoked and the first item is the return value.\n let second = it.next();\n if (second.done && initial === undefined) {\n return first.value;\n }\n // If iterator has a single item and an initial value is provided,\n // the reducer is invoked and that result is the return value.\n if (second.done) {\n return fn(initial, first.value, index++);\n }\n // Setup the initial accumlated value.\n let accumulator;\n if (initial === undefined) {\n accumulator = fn(first.value, second.value, index++);\n }\n else {\n accumulator = fn(fn(initial, first.value, index++), second.value, index++);\n }\n // Iterate the rest of the values, updating the accumulator.\n let next;\n while (!(next = it.next()).done) {\n accumulator = fn(accumulator, next.value, index++);\n }\n // Return the final accumulated value.\n return accumulator;\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an iterator which repeats a value a number of times.\n *\n * @deprecated\n *\n * @param value - The value to repeat.\n *\n * @param count - The number of times to repeat the value.\n *\n * @returns A new iterator which repeats the specified value.\n *\n * #### Example\n * ```typescript\n * import { repeat } from '@lumino/algorithm';\n *\n * let stream = repeat(7, 3);\n *\n * Array.from(stream); // [7, 7, 7]\n * ```\n */\nfunction* repeat(value, count) {\n while (0 < count--) {\n yield value;\n }\n}\n/**\n * Create an iterator which yields a value a single time.\n *\n * @deprecated\n *\n * @param value - The value to wrap in an iterator.\n *\n * @returns A new iterator which yields the value a single time.\n *\n * #### Example\n * ```typescript\n * import { once } from '@lumino/algorithm';\n *\n * let stream = once(7);\n *\n * Array.from(stream); // [7]\n * ```\n */\nfunction* once(value) {\n yield value;\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an iterator for a retroable object.\n *\n * @param object - The retroable or array-like object of interest.\n *\n * @returns An iterator which traverses the object's values in reverse.\n *\n * #### Example\n * ```typescript\n * import { retro } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = retro(data);\n *\n * Array.from(stream); // [6, 5, 4, 3, 2, 1]\n * ```\n */\nfunction* retro(object) {\n if (typeof object.retro === 'function') {\n yield* object.retro();\n }\n else {\n for (let index = object.length - 1; index > -1; index--) {\n yield object[index];\n }\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Topologically sort an iterable of edges.\n *\n * @param edges - The iterable object of edges to sort.\n * An edge is represented as a 2-tuple of `[fromNode, toNode]`.\n *\n * @returns The topologically sorted array of nodes.\n *\n * #### Notes\n * If a cycle is present in the graph, the cycle will be ignored and\n * the return value will be only approximately sorted.\n *\n * #### Example\n * ```typescript\n * import { topologicSort } from '@lumino/algorithm';\n *\n * let data = [\n * ['d', 'e'],\n * ['c', 'd'],\n * ['a', 'b'],\n * ['b', 'c']\n * ];\n *\n * topologicSort(data); // ['a', 'b', 'c', 'd', 'e']\n * ```\n */\nfunction topologicSort(edges) {\n // Setup the shared sorting state.\n let sorted = [];\n let visited = new Set();\n let graph = new Map();\n // Add the edges to the graph.\n for (const edge of edges) {\n addEdge(edge);\n }\n // Visit each node in the graph.\n for (const [k] of graph) {\n visit(k);\n }\n // Return the sorted results.\n return sorted;\n // Add an edge to the graph.\n function addEdge(edge) {\n let [fromNode, toNode] = edge;\n let children = graph.get(toNode);\n if (children) {\n children.push(fromNode);\n }\n else {\n graph.set(toNode, [fromNode]);\n }\n }\n // Recursively visit the node.\n function visit(node) {\n if (visited.has(node)) {\n return;\n }\n visited.add(node);\n let children = graph.get(node);\n if (children) {\n for (const child of children) {\n visit(child);\n }\n }\n sorted.push(node);\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Iterate over an iterable using a stepped increment.\n *\n * @param object - The iterable object of interest.\n *\n * @param step - The distance to step on each iteration. A value\n * of less than `1` will behave the same as a value of `1`.\n *\n * @returns An iterator which traverses the iterable step-wise.\n *\n * #### Example\n * ```typescript\n * import { stride } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = stride(data, 2);\n *\n * Array.from(stream); // [1, 3, 5];\n * ```\n */\nfunction* stride(object, step) {\n let count = 0;\n for (const value of object) {\n if (0 === count++ % step) {\n yield value;\n }\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * The namespace for string-specific algorithms.\n */\nvar StringExt;\n(function (StringExt) {\n /**\n * Find the indices of characters in a source text.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The matched indices, or `null` if there is no match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * In order for there to be a match, all of the characters in `query`\n * **must** appear in `source` in the order given by `query`.\n *\n * Characters are matched using strict `===` equality.\n */\n function findIndices(source, query, start = 0) {\n let indices = new Array(query.length);\n for (let i = 0, j = start, n = query.length; i < n; ++i, ++j) {\n j = source.indexOf(query[i], j);\n if (j === -1) {\n return null;\n }\n indices[i] = j;\n }\n return indices;\n }\n StringExt.findIndices = findIndices;\n /**\n * A string matcher which uses a sum-of-squares algorithm.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The match result, or `null` if there is no match.\n * A lower `score` represents a stronger match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * This scoring algorithm uses a sum-of-squares approach to determine\n * the score. In order for there to be a match, all of the characters\n * in `query` **must** appear in `source` in order. The index of each\n * matching character is squared and added to the score. This means\n * that early and consecutive character matches are preferred, while\n * late matches are heavily penalized.\n */\n function matchSumOfSquares(source, query, start = 0) {\n let indices = findIndices(source, query, start);\n if (!indices) {\n return null;\n }\n let score = 0;\n for (let i = 0, n = indices.length; i < n; ++i) {\n let j = indices[i] - start;\n score += j * j;\n }\n return { score, indices };\n }\n StringExt.matchSumOfSquares = matchSumOfSquares;\n /**\n * A string matcher which uses a sum-of-deltas algorithm.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The match result, or `null` if there is no match.\n * A lower `score` represents a stronger match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * This scoring algorithm uses a sum-of-deltas approach to determine\n * the score. In order for there to be a match, all of the characters\n * in `query` **must** appear in `source` in order. The delta between\n * the indices are summed to create the score. This means that groups\n * of matched characters are preferred, while fragmented matches are\n * penalized.\n */\n function matchSumOfDeltas(source, query, start = 0) {\n let indices = findIndices(source, query, start);\n if (!indices) {\n return null;\n }\n let score = 0;\n let last = start - 1;\n for (let i = 0, n = indices.length; i < n; ++i) {\n let j = indices[i];\n score += j - last - 1;\n last = j;\n }\n return { score, indices };\n }\n StringExt.matchSumOfDeltas = matchSumOfDeltas;\n /**\n * Highlight the matched characters of a source text.\n *\n * @param source - The text which should be highlighted.\n *\n * @param indices - The indices of the matched characters. They must\n * appear in increasing order and must be in bounds of the source.\n *\n * @param fn - The function to apply to the matched chunks.\n *\n * @returns An array of unmatched and highlighted chunks.\n */\n function highlight(source, indices, fn) {\n // Set up the result array.\n let result = [];\n // Set up the counter variables.\n let k = 0;\n let last = 0;\n let n = indices.length;\n // Iterator over each index.\n while (k < n) {\n // Set up the chunk indices.\n let i = indices[k];\n let j = indices[k];\n // Advance the right chunk index until it's non-contiguous.\n while (++k < n && indices[k] === j + 1) {\n j++;\n }\n // Extract the unmatched text.\n if (last < i) {\n result.push(source.slice(last, i));\n }\n // Extract and highlight the matched text.\n if (i < j + 1) {\n result.push(fn(source.slice(i, j + 1)));\n }\n // Update the last visited index.\n last = j + 1;\n }\n // Extract any remaining unmatched text.\n if (last < source.length) {\n result.push(source.slice(last));\n }\n // Return the highlighted result.\n return result;\n }\n StringExt.highlight = highlight;\n /**\n * A 3-way string comparison function.\n *\n * @param a - The first string of interest.\n *\n * @param b - The second string of interest.\n *\n * @returns `-1` if `a < b`, else `1` if `a > b`, else `0`.\n */\n function cmp(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n }\n StringExt.cmp = cmp;\n})(StringExt || (StringExt = {}));\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Take a fixed number of items from an iterable.\n *\n * @param object - The iterable object of interest.\n *\n * @param count - The number of items to take from the iterable.\n *\n * @returns An iterator which yields the specified number of items\n * from the source iterable.\n *\n * #### Notes\n * The returned iterator will exhaust early if the source iterable\n * contains an insufficient number of items.\n *\n * #### Example\n * ```typescript\n * import { take } from '@lumino/algorithm';\n *\n * let stream = take([5, 4, 3, 2, 1, 0, -1], 3);\n *\n * Array.from(stream); // [5, 4, 3]\n * ```\n */\nfunction* take(object, count) {\n if (count < 1) {\n return;\n }\n const it = object[Symbol.iterator]();\n let item;\n while (0 < count-- && !(item = it.next()).done) {\n yield item.value;\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Iterate several iterables in lockstep.\n *\n * @param objects - The iterable objects of interest.\n *\n * @returns An iterator which yields successive tuples of values where\n * each value is taken in turn from the provided iterables. It will\n * be as long as the shortest provided iterable.\n *\n * #### Example\n * ```typescript\n * import { zip } from '@lumino/algorithm';\n *\n * let data1 = [1, 2, 3];\n * let data2 = [4, 5, 6];\n *\n * let stream = zip(data1, data2);\n *\n * Array.from(stream); // [[1, 4], [2, 5], [3, 6]]\n * ```\n */\nfunction* zip(...objects) {\n const iters = objects.map(obj => obj[Symbol.iterator]());\n let tuple = iters.map(it => it.next());\n for (; every(tuple, item => !item.done); tuple = iters.map(it => it.next())) {\n yield tuple.map(item => item.value);\n }\n}\n\nexport { ArrayExt, StringExt, chain, each, empty, enumerate, every, filter, find, findIndex, map, max, min, minmax, once, range, reduce, repeat, retro, some, stride, take, toArray, toObject, topologicSort, zip };\n//# sourceMappingURL=index.es6.js.map\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/**\n * @packageDocumentation\n * @module nbformat\n */\n// Notebook format interfaces\n// https://nbformat.readthedocs.io/en/latest/format_description.html\n// https://github.com/jupyter/nbformat/blob/master/nbformat/v4/nbformat.v4.schema.json\nimport { JSONExt } from '@lumino/coreutils';\n/**\n * The earliest major version of the notebook format we support.\n */\nexport const MAJOR_VERSION = 4;\n/**\n * The earliest minor version of the notebook format we support.\n */\nexport const MINOR_VERSION = 4;\n/**\n * Validate a mime type/value pair.\n *\n * @param type - The mimetype name.\n *\n * @param value - The value associated with the type.\n *\n * @returns Whether the type/value pair are valid.\n */\nexport function validateMimeValue(type, value) {\n // Check if \"application/json\" or \"application/foo+json\"\n const jsonTest = /^application\\/.+\\+json$/;\n const isJSONType = type === 'application/json' || jsonTest.test(type);\n const isString = (x) => {\n return Object.prototype.toString.call(x) === '[object String]';\n };\n // If it is an array, make sure if is not a JSON type and it is an\n // array of strings.\n if (Array.isArray(value)) {\n if (isJSONType) {\n return false;\n }\n let valid = true;\n value.forEach(v => {\n if (!isString(v)) {\n valid = false;\n }\n });\n return valid;\n }\n // If it is a string, make sure we are not a JSON type.\n if (isString(value)) {\n return !isJSONType;\n }\n // It is not a string, make sure it is a JSON type.\n if (!isJSONType) {\n return false;\n }\n // It is a JSON type, make sure it is a valid JSON object.\n return JSONExt.isObject(value);\n}\n/**\n * Test whether a cell is a raw cell.\n */\nexport function isRaw(cell) {\n return cell.cell_type === 'raw';\n}\n/**\n * Test whether a cell is a markdown cell.\n */\nexport function isMarkdown(cell) {\n return cell.cell_type === 'markdown';\n}\n/**\n * Test whether a cell is a code cell.\n */\nexport function isCode(cell) {\n return cell.cell_type === 'code';\n}\n/**\n * Test whether an output is an execute result.\n */\nexport function isExecuteResult(output) {\n return output.output_type === 'execute_result';\n}\n/**\n * Test whether an output is from display data.\n */\nexport function isDisplayData(output) {\n return output.output_type === 'display_data';\n}\n/**\n * Test whether an output is from updated display data.\n */\nexport function isDisplayUpdate(output) {\n return output.output_type === 'update_display_data';\n}\n/**\n * Test whether an output is from a stream.\n */\nexport function isStream(output) {\n return output.output_type === 'stream';\n}\n/**\n * Test whether an output is an error.\n */\nexport function isError(output) {\n return output.output_type === 'error';\n}\n//# sourceMappingURL=index.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { ArrayExt } from '@lumino/algorithm';\nimport { Signal } from '@lumino/signaling';\n/**\n * A concrete implementation of [[IObservableList]].\n */\nexport class ObservableList {\n /**\n * Construct a new observable map.\n */\n constructor(options = {}) {\n this._array = [];\n this._isDisposed = false;\n this._changed = new Signal(this);\n if (options.values) {\n for (const value of options.values) {\n this._array.push(value);\n }\n }\n this._itemCmp = options.itemCmp || Private.itemCmp;\n }\n /**\n * The type of this object.\n */\n get type() {\n return 'List';\n }\n /**\n * A signal emitted when the list has changed.\n */\n get changed() {\n return this._changed;\n }\n /**\n * The length of the list.\n */\n get length() {\n return this._array.length;\n }\n /**\n * Test whether the list has been disposed.\n */\n get isDisposed() {\n return this._isDisposed;\n }\n /**\n * Dispose of the resources held by the list.\n */\n dispose() {\n if (this._isDisposed) {\n return;\n }\n this._isDisposed = true;\n Signal.clearData(this);\n this.clear();\n }\n /**\n * Create an iterator over the values in the list.\n *\n * @returns A new iterator starting at the front of the list.\n *\n * #### Complexity\n * Constant.\n *\n * #### Iterator Validity\n * No changes.\n */\n [Symbol.iterator]() {\n return this._array[Symbol.iterator]();\n }\n /**\n * Get the value at the specified index.\n *\n * @param index - The positive integer index of interest.\n *\n * @returns The value at the specified index.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral or out of range.\n */\n get(index) {\n return this._array[index];\n }\n /**\n * Set the value at the specified index.\n *\n * @param index - The positive integer index of interest.\n *\n * @param value - The value to set at the specified index.\n *\n * #### Complexity\n * Constant.\n *\n * #### Iterator Validity\n * No changes.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral or out of range.\n */\n set(index, value) {\n const oldValue = this._array[index];\n if (value === undefined) {\n throw new Error('Cannot set an undefined item');\n }\n // Bail if the value does not change.\n const itemCmp = this._itemCmp;\n if (itemCmp(oldValue, value)) {\n return;\n }\n this._array[index] = value;\n this._changed.emit({\n type: 'set',\n oldIndex: index,\n newIndex: index,\n oldValues: [oldValue],\n newValues: [value]\n });\n }\n /**\n * Add a value to the end of the list.\n *\n * @param value - The value to add to the end of the list.\n *\n * @returns The new length of the list.\n *\n * #### Complexity\n * Constant.\n *\n * #### Notes\n * By convention, the oldIndex is set to -1 to indicate\n * an push operation.\n *\n * #### Iterator Validity\n * No changes.\n */\n push(value) {\n const num = this._array.push(value);\n this._changed.emit({\n type: 'add',\n oldIndex: -1,\n newIndex: this.length - 1,\n oldValues: [],\n newValues: [value]\n });\n return num;\n }\n /**\n * Insert a value into the list at a specific index.\n *\n * @param index - The index at which to insert the value.\n *\n * @param value - The value to set at the specified index.\n *\n * #### Complexity\n * Linear.\n *\n * #### Iterator Validity\n * No changes.\n *\n * #### Notes\n * The `index` will be clamped to the bounds of the list.\n *\n * By convention, the oldIndex is set to -2 to indicate\n * an insert operation.\n *\n * The value -2 as oldIndex can be used to distinguish from the push\n * method which will use a value -1.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n insert(index, value) {\n if (index === this._array.length) {\n this._array.push(value);\n }\n else {\n ArrayExt.insert(this._array, index, value);\n }\n this._changed.emit({\n type: 'add',\n oldIndex: -2,\n newIndex: index,\n oldValues: [],\n newValues: [value]\n });\n }\n /**\n * Remove the first occurrence of a value from the list.\n *\n * @param value - The value of interest.\n *\n * @returns The index of the removed value, or `-1` if the value\n * is not contained in the list.\n *\n * #### Complexity\n * Linear.\n *\n * #### Iterator Validity\n * Iterators pointing at the removed value and beyond are invalidated.\n */\n removeValue(value) {\n const itemCmp = this._itemCmp;\n const index = ArrayExt.findFirstIndex(this._array, item => {\n return itemCmp(item, value);\n });\n this.remove(index);\n return index;\n }\n /**\n * Remove and return the value at a specific index.\n *\n * @param index - The index of the value of interest.\n *\n * @returns The value at the specified index, or `undefined` if the\n * index is out of range.\n *\n * #### Complexity\n * Constant.\n *\n * #### Iterator Validity\n * Iterators pointing at the removed value and beyond are invalidated.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n */\n remove(index) {\n const value = ArrayExt.removeAt(this._array, index);\n if (value === undefined) {\n return;\n }\n this._changed.emit({\n type: 'remove',\n oldIndex: index,\n newIndex: -1,\n newValues: [],\n oldValues: [value]\n });\n return value;\n }\n /**\n * Remove all values from the list.\n *\n * #### Complexity\n * Linear.\n *\n * #### Iterator Validity\n * All current iterators are invalidated.\n */\n clear() {\n const copy = this._array.slice();\n this._array.length = 0;\n this._changed.emit({\n type: 'remove',\n oldIndex: 0,\n newIndex: 0,\n newValues: [],\n oldValues: copy\n });\n }\n /**\n * Move a value from one index to another.\n *\n * @param fromIndex - The index of the element to move.\n *\n * @param toIndex - The index to move the element to.\n *\n * #### Complexity\n * Constant.\n *\n * #### Iterator Validity\n * Iterators pointing at the lesser of the `fromIndex` and the `toIndex`\n * and beyond are invalidated.\n *\n * #### Undefined Behavior\n * A `fromIndex` or a `toIndex` which is non-integral.\n */\n move(fromIndex, toIndex) {\n if (this.length <= 1 || fromIndex === toIndex) {\n return;\n }\n const values = [this._array[fromIndex]];\n ArrayExt.move(this._array, fromIndex, toIndex);\n this._changed.emit({\n type: 'move',\n oldIndex: fromIndex,\n newIndex: toIndex,\n oldValues: values,\n newValues: values\n });\n }\n /**\n * Push a set of values to the back of the list.\n *\n * @param values - An iterable set of values to add.\n *\n * @returns The new length of the list.\n *\n * #### Complexity\n * Linear.\n *\n * #### Notes\n * By convention, the oldIndex is set to -1 to indicate\n * an push operation.\n *\n * #### Iterator Validity\n * No changes.\n */\n pushAll(values) {\n const newIndex = this.length;\n for (const value of values) {\n this._array.push(value);\n }\n this._changed.emit({\n type: 'add',\n oldIndex: -1,\n newIndex,\n oldValues: [],\n newValues: Array.from(values)\n });\n return this.length;\n }\n /**\n * Insert a set of items into the list at the specified index.\n *\n * @param index - The index at which to insert the values.\n *\n * @param values - The values to insert at the specified index.\n *\n * #### Complexity.\n * Linear.\n *\n * #### Iterator Validity\n * No changes.\n *\n * #### Notes\n * The `index` will be clamped to the bounds of the list.\n * By convention, the oldIndex is set to -2 to indicate\n * an insert operation.\n *\n * #### Undefined Behavior.\n * An `index` which is non-integral.\n */\n insertAll(index, values) {\n const newIndex = index;\n for (const value of values) {\n ArrayExt.insert(this._array, index++, value);\n }\n this._changed.emit({\n type: 'add',\n oldIndex: -2,\n newIndex,\n oldValues: [],\n newValues: Array.from(values)\n });\n }\n /**\n * Remove a range of items from the list.\n *\n * @param startIndex - The start index of the range to remove (inclusive).\n *\n * @param endIndex - The end index of the range to remove (exclusive).\n *\n * @returns The new length of the list.\n *\n * #### Complexity\n * Linear.\n *\n * #### Iterator Validity\n * Iterators pointing to the first removed value and beyond are invalid.\n *\n * #### Undefined Behavior\n * A `startIndex` or `endIndex` which is non-integral.\n */\n removeRange(startIndex, endIndex) {\n const oldValues = this._array.slice(startIndex, endIndex);\n for (let i = startIndex; i < endIndex; i++) {\n ArrayExt.removeAt(this._array, startIndex);\n }\n this._changed.emit({\n type: 'remove',\n oldIndex: startIndex,\n newIndex: -1,\n oldValues,\n newValues: []\n });\n return this.length;\n }\n}\n/**\n * The namespace for module private data.\n */\nvar Private;\n(function (Private) {\n /**\n * The default strict equality item cmp.\n */\n function itemCmp(first, second) {\n return first === second;\n }\n Private.itemCmp = itemCmp;\n})(Private || (Private = {}));\n//# sourceMappingURL=observablelist.js.map","/**\n * A generic doubly-linked list.\n */\nclass LinkedList {\n constructor() {\n this._first = null;\n this._last = null;\n this._size = 0;\n }\n /**\n * Whether the list is empty.\n *\n * #### Complexity\n * Constant.\n */\n get isEmpty() {\n return this._size === 0;\n }\n /**\n * The size of the list.\n *\n * #### Complexity\n * `O(1)`\n *\n * #### Notes\n * This is equivalent to `length`.\n */\n get size() {\n return this._size;\n }\n /**\n * The length of the list.\n *\n * #### Complexity\n * Constant.\n *\n * #### Notes\n * This is equivalent to `size`.\n *\n * This property is deprecated.\n */\n get length() {\n return this._size;\n }\n /**\n * The first value in the list.\n *\n * This is `undefined` if the list is empty.\n *\n * #### Complexity\n * Constant.\n */\n get first() {\n return this._first ? this._first.value : undefined;\n }\n /**\n * The last value in the list.\n *\n * This is `undefined` if the list is empty.\n *\n * #### Complexity\n * Constant.\n */\n get last() {\n return this._last ? this._last.value : undefined;\n }\n /**\n * The first node in the list.\n *\n * This is `null` if the list is empty.\n *\n * #### Complexity\n * Constant.\n */\n get firstNode() {\n return this._first;\n }\n /**\n * The last node in the list.\n *\n * This is `null` if the list is empty.\n *\n * #### Complexity\n * Constant.\n */\n get lastNode() {\n return this._last;\n }\n /**\n * Create an iterator over the values in the list.\n *\n * @returns A new iterator starting with the first value.\n *\n * #### Complexity\n * Constant.\n */\n *[Symbol.iterator]() {\n let node = this._first;\n while (node) {\n yield node.value;\n node = node.next;\n }\n }\n /**\n * Create a reverse iterator over the values in the list.\n *\n * @returns A new iterator starting with the last value.\n *\n * #### Complexity\n * Constant.\n */\n *retro() {\n let node = this._last;\n while (node) {\n yield node.value;\n node = node.prev;\n }\n }\n /**\n * Create an iterator over the nodes in the list.\n *\n * @returns A new iterator starting with the first node.\n *\n * #### Complexity\n * Constant.\n */\n *nodes() {\n let node = this._first;\n while (node) {\n yield node;\n node = node.next;\n }\n }\n /**\n * Create a reverse iterator over the nodes in the list.\n *\n * @returns A new iterator starting with the last node.\n *\n * #### Complexity\n * Constant.\n */\n *retroNodes() {\n let node = this._last;\n while (node) {\n yield node;\n node = node.prev;\n }\n }\n /**\n * Assign new values to the list, replacing all current values.\n *\n * @param values - The values to assign to the list.\n *\n * #### Complexity\n * Linear.\n */\n assign(values) {\n this.clear();\n for (const value of values) {\n this.addLast(value);\n }\n }\n /**\n * Add a value to the end of the list.\n *\n * @param value - The value to add to the end of the list.\n *\n * #### Complexity\n * Constant.\n *\n * #### Notes\n * This is equivalent to `addLast`.\n */\n push(value) {\n this.addLast(value);\n }\n /**\n * Remove and return the value at the end of the list.\n *\n * @returns The removed value, or `undefined` if the list is empty.\n *\n * #### Complexity\n * Constant.\n *\n * #### Notes\n * This is equivalent to `removeLast`.\n */\n pop() {\n return this.removeLast();\n }\n /**\n * Add a value to the beginning of the list.\n *\n * @param value - The value to add to the beginning of the list.\n *\n * #### Complexity\n * Constant.\n *\n * #### Notes\n * This is equivalent to `addFirst`.\n */\n shift(value) {\n this.addFirst(value);\n }\n /**\n * Remove and return the value at the beginning of the list.\n *\n * @returns The removed value, or `undefined` if the list is empty.\n *\n * #### Complexity\n * Constant.\n *\n * #### Notes\n * This is equivalent to `removeFirst`.\n */\n unshift() {\n return this.removeFirst();\n }\n /**\n * Add a value to the beginning of the list.\n *\n * @param value - The value to add to the beginning of the list.\n *\n * @returns The list node which holds the value.\n *\n * #### Complexity\n * Constant.\n */\n addFirst(value) {\n let node = new Private.LinkedListNode(this, value);\n if (!this._first) {\n this._first = node;\n this._last = node;\n }\n else {\n node.next = this._first;\n this._first.prev = node;\n this._first = node;\n }\n this._size++;\n return node;\n }\n /**\n * Add a value to the end of the list.\n *\n * @param value - The value to add to the end of the list.\n *\n * @returns The list node which holds the value.\n *\n * #### Complexity\n * Constant.\n */\n addLast(value) {\n let node = new Private.LinkedListNode(this, value);\n if (!this._last) {\n this._first = node;\n this._last = node;\n }\n else {\n node.prev = this._last;\n this._last.next = node;\n this._last = node;\n }\n this._size++;\n return node;\n }\n /**\n * Insert a value before a specific node in the list.\n *\n * @param value - The value to insert before the reference node.\n *\n * @param ref - The reference node of interest. If this is `null`,\n * the value will be added to the beginning of the list.\n *\n * @returns The list node which holds the value.\n *\n * #### Notes\n * The reference node must be owned by the list.\n *\n * #### Complexity\n * Constant.\n */\n insertBefore(value, ref) {\n if (!ref || ref === this._first) {\n return this.addFirst(value);\n }\n if (!(ref instanceof Private.LinkedListNode) || ref.list !== this) {\n throw new Error('Reference node is not owned by the list.');\n }\n let node = new Private.LinkedListNode(this, value);\n let _ref = ref;\n let prev = _ref.prev;\n node.next = _ref;\n node.prev = prev;\n _ref.prev = node;\n prev.next = node;\n this._size++;\n return node;\n }\n /**\n * Insert a value after a specific node in the list.\n *\n * @param value - The value to insert after the reference node.\n *\n * @param ref - The reference node of interest. If this is `null`,\n * the value will be added to the end of the list.\n *\n * @returns The list node which holds the value.\n *\n * #### Notes\n * The reference node must be owned by the list.\n *\n * #### Complexity\n * Constant.\n */\n insertAfter(value, ref) {\n if (!ref || ref === this._last) {\n return this.addLast(value);\n }\n if (!(ref instanceof Private.LinkedListNode) || ref.list !== this) {\n throw new Error('Reference node is not owned by the list.');\n }\n let node = new Private.LinkedListNode(this, value);\n let _ref = ref;\n let next = _ref.next;\n node.next = next;\n node.prev = _ref;\n _ref.next = node;\n next.prev = node;\n this._size++;\n return node;\n }\n /**\n * Remove and return the value at the beginning of the list.\n *\n * @returns The removed value, or `undefined` if the list is empty.\n *\n * #### Complexity\n * Constant.\n */\n removeFirst() {\n let node = this._first;\n if (!node) {\n return undefined;\n }\n if (node === this._last) {\n this._first = null;\n this._last = null;\n }\n else {\n this._first = node.next;\n this._first.prev = null;\n }\n node.list = null;\n node.next = null;\n node.prev = null;\n this._size--;\n return node.value;\n }\n /**\n * Remove and return the value at the end of the list.\n *\n * @returns The removed value, or `undefined` if the list is empty.\n *\n * #### Complexity\n * Constant.\n */\n removeLast() {\n let node = this._last;\n if (!node) {\n return undefined;\n }\n if (node === this._first) {\n this._first = null;\n this._last = null;\n }\n else {\n this._last = node.prev;\n this._last.next = null;\n }\n node.list = null;\n node.next = null;\n node.prev = null;\n this._size--;\n return node.value;\n }\n /**\n * Remove a specific node from the list.\n *\n * @param node - The node to remove from the list.\n *\n * #### Complexity\n * Constant.\n *\n * #### Notes\n * The node must be owned by the list.\n */\n removeNode(node) {\n if (!(node instanceof Private.LinkedListNode) || node.list !== this) {\n throw new Error('Node is not owned by the list.');\n }\n let _node = node;\n if (_node === this._first && _node === this._last) {\n this._first = null;\n this._last = null;\n }\n else if (_node === this._first) {\n this._first = _node.next;\n this._first.prev = null;\n }\n else if (_node === this._last) {\n this._last = _node.prev;\n this._last.next = null;\n }\n else {\n _node.next.prev = _node.prev;\n _node.prev.next = _node.next;\n }\n _node.list = null;\n _node.next = null;\n _node.prev = null;\n this._size--;\n }\n /**\n * Remove all values from the list.\n *\n * #### Complexity\n * Linear.\n */\n clear() {\n let node = this._first;\n while (node) {\n let next = node.next;\n node.list = null;\n node.prev = null;\n node.next = null;\n node = next;\n }\n this._first = null;\n this._last = null;\n this._size = 0;\n }\n}\n/**\n * The namespace for the `LinkedList` class statics.\n */\n(function (LinkedList) {\n /**\n * Create a linked list from an iterable of values.\n *\n * @param values - The iterable object of interest.\n *\n * @returns A new linked list initialized with the given values.\n *\n * #### Complexity\n * Linear.\n */\n function from(values) {\n let list = new LinkedList();\n list.assign(values);\n return list;\n }\n LinkedList.from = from;\n})(LinkedList || (LinkedList = {}));\n/**\n * The namespace for the module implementation details.\n */\nvar Private;\n(function (Private) {\n /**\n * The internal linked list node implementation.\n */\n class LinkedListNode {\n /**\n * Construct a new linked list node.\n *\n * @param list - The list which owns the node.\n *\n * @param value - The value for the link.\n */\n constructor(list, value) {\n /**\n * The linked list which created and owns the node.\n */\n this.list = null;\n /**\n * The next node in the list.\n */\n this.next = null;\n /**\n * The previous node in the list.\n */\n this.prev = null;\n this.list = list;\n this.value = value;\n }\n }\n Private.LinkedListNode = LinkedListNode;\n})(Private || (Private = {}));\n\nexport { LinkedList };\n//# sourceMappingURL=index.es6.js.map\n","import { every, retro, some, ArrayExt } from '@lumino/algorithm';\nimport { LinkedList } from '@lumino/collections';\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * @packageDocumentation\n * @module messaging\n */\n/**\n * A message which can be delivered to a message handler.\n *\n * #### Notes\n * This class may be subclassed to create complex message types.\n */\nclass Message {\n /**\n * Construct a new message.\n *\n * @param type - The type of the message.\n */\n constructor(type) {\n this.type = type;\n }\n /**\n * Test whether the message is conflatable.\n *\n * #### Notes\n * Message conflation is an advanced topic. Most message types will\n * not make use of this feature.\n *\n * If a conflatable message is posted to a handler while another\n * conflatable message of the same `type` has already been posted\n * to the handler, the `conflate()` method of the existing message\n * will be invoked. If that method returns `true`, the new message\n * will not be enqueued. This allows messages to be compressed, so\n * that only a single instance of the message type is processed per\n * cycle, no matter how many times messages of that type are posted.\n *\n * Custom message types may reimplement this property.\n *\n * The default implementation is always `false`.\n */\n get isConflatable() {\n return false;\n }\n /**\n * Conflate this message with another message of the same `type`.\n *\n * @param other - A conflatable message of the same `type`.\n *\n * @returns `true` if the message was successfully conflated, or\n * `false` otherwise.\n *\n * #### Notes\n * Message conflation is an advanced topic. Most message types will\n * not make use of this feature.\n *\n * This method is called automatically by the message loop when the\n * given message is posted to the handler paired with this message.\n * This message will already be enqueued and conflatable, and the\n * given message will have the same `type` and also be conflatable.\n *\n * This method should merge the state of the other message into this\n * message as needed so that when this message is finally delivered\n * to the handler, it receives the most up-to-date information.\n *\n * If this method returns `true`, it signals that the other message\n * was successfully conflated and that message will not be enqueued.\n *\n * If this method returns `false`, the other message will be enqueued\n * for normal delivery.\n *\n * Custom message types may reimplement this method.\n *\n * The default implementation always returns `false`.\n */\n conflate(other) {\n return false;\n }\n}\n/**\n * A convenience message class which conflates automatically.\n *\n * #### Notes\n * Message conflation is an advanced topic. Most user code will not\n * make use of this class.\n *\n * This message class is useful for creating message instances which\n * should be conflated, but which have no state other than `type`.\n *\n * If conflation of stateful messages is required, a custom `Message`\n * subclass should be created.\n */\nclass ConflatableMessage extends Message {\n /**\n * Test whether the message is conflatable.\n *\n * #### Notes\n * This property is always `true`.\n */\n get isConflatable() {\n return true;\n }\n /**\n * Conflate this message with another message of the same `type`.\n *\n * #### Notes\n * This method always returns `true`.\n */\n conflate(other) {\n return true;\n }\n}\n/**\n * The namespace for the global singleton message loop.\n */\nvar MessageLoop;\n(function (MessageLoop) {\n /**\n * A function that cancels the pending loop task; `null` if unavailable.\n */\n let pending = null;\n /**\n * Schedules a function for invocation as soon as possible asynchronously.\n *\n * @param fn The function to invoke when called back.\n *\n * @returns An anonymous function that will unschedule invocation if possible.\n */\n const schedule = (resolved => (fn) => {\n let rejected = false;\n resolved.then(() => !rejected && fn());\n return () => {\n rejected = true;\n };\n })(Promise.resolve());\n /**\n * Send a message to a message handler to process immediately.\n *\n * @param handler - The handler which should process the message.\n *\n * @param msg - The message to deliver to the handler.\n *\n * #### Notes\n * The message will first be sent through any installed message hooks\n * for the handler. If the message passes all hooks, it will then be\n * delivered to the `processMessage` method of the handler.\n *\n * The message will not be conflated with pending posted messages.\n *\n * Exceptions in hooks and handlers will be caught and logged.\n */\n function sendMessage(handler, msg) {\n // Lookup the message hooks for the handler.\n let hooks = messageHooks.get(handler);\n // Handle the common case of no installed hooks.\n if (!hooks || hooks.length === 0) {\n invokeHandler(handler, msg);\n return;\n }\n // Invoke the message hooks starting with the newest first.\n let passed = every(retro(hooks), hook => {\n return hook ? invokeHook(hook, handler, msg) : true;\n });\n // Invoke the handler if the message passes all hooks.\n if (passed) {\n invokeHandler(handler, msg);\n }\n }\n MessageLoop.sendMessage = sendMessage;\n /**\n * Post a message to a message handler to process in the future.\n *\n * @param handler - The handler which should process the message.\n *\n * @param msg - The message to post to the handler.\n *\n * #### Notes\n * The message will be conflated with the pending posted messages for\n * the handler, if possible. If the message is not conflated, it will\n * be queued for normal delivery on the next cycle of the event loop.\n *\n * Exceptions in hooks and handlers will be caught and logged.\n */\n function postMessage(handler, msg) {\n // Handle the common case of a non-conflatable message.\n if (!msg.isConflatable) {\n enqueueMessage(handler, msg);\n return;\n }\n // Conflate the message with an existing message if possible.\n let conflated = some(messageQueue, posted => {\n if (posted.handler !== handler) {\n return false;\n }\n if (!posted.msg) {\n return false;\n }\n if (posted.msg.type !== msg.type) {\n return false;\n }\n if (!posted.msg.isConflatable) {\n return false;\n }\n return posted.msg.conflate(msg);\n });\n // Enqueue the message if it was not conflated.\n if (!conflated) {\n enqueueMessage(handler, msg);\n }\n }\n MessageLoop.postMessage = postMessage;\n /**\n * Install a message hook for a message handler.\n *\n * @param handler - The message handler of interest.\n *\n * @param hook - The message hook to install.\n *\n * #### Notes\n * A message hook is invoked before a message is delivered to the\n * handler. If the hook returns `false`, no other hooks will be\n * invoked and the message will not be delivered to the handler.\n *\n * The most recently installed message hook is executed first.\n *\n * If the hook is already installed, this is a no-op.\n */\n function installMessageHook(handler, hook) {\n // Look up the hooks for the handler.\n let hooks = messageHooks.get(handler);\n // Bail early if the hook is already installed.\n if (hooks && hooks.indexOf(hook) !== -1) {\n return;\n }\n // Add the hook to the end, so it will be the first to execute.\n if (!hooks) {\n messageHooks.set(handler, [hook]);\n }\n else {\n hooks.push(hook);\n }\n }\n MessageLoop.installMessageHook = installMessageHook;\n /**\n * Remove an installed message hook for a message handler.\n *\n * @param handler - The message handler of interest.\n *\n * @param hook - The message hook to remove.\n *\n * #### Notes\n * It is safe to call this function while the hook is executing.\n *\n * If the hook is not installed, this is a no-op.\n */\n function removeMessageHook(handler, hook) {\n // Lookup the hooks for the handler.\n let hooks = messageHooks.get(handler);\n // Bail early if the hooks do not exist.\n if (!hooks) {\n return;\n }\n // Lookup the index of the hook and bail if not found.\n let i = hooks.indexOf(hook);\n if (i === -1) {\n return;\n }\n // Clear the hook and schedule a cleanup of the array.\n hooks[i] = null;\n scheduleCleanup(hooks);\n }\n MessageLoop.removeMessageHook = removeMessageHook;\n /**\n * Clear all message data associated with a message handler.\n *\n * @param handler - The message handler of interest.\n *\n * #### Notes\n * This will clear all posted messages and hooks for the handler.\n */\n function clearData(handler) {\n // Lookup the hooks for the handler.\n let hooks = messageHooks.get(handler);\n // Clear all messsage hooks for the handler.\n if (hooks && hooks.length > 0) {\n ArrayExt.fill(hooks, null);\n scheduleCleanup(hooks);\n }\n // Clear all posted messages for the handler.\n for (const posted of messageQueue) {\n if (posted.handler === handler) {\n posted.handler = null;\n posted.msg = null;\n }\n }\n }\n MessageLoop.clearData = clearData;\n /**\n * Process the pending posted messages in the queue immediately.\n *\n * #### Notes\n * This function is useful when posted messages must be processed immediately.\n *\n * This function should normally not be needed, but it may be\n * required to work around certain browser idiosyncrasies.\n *\n * Recursing into this function is a no-op.\n */\n function flush() {\n // Bail if recursion is detected or if there is no pending task.\n if (flushGuard || pending === null) {\n return;\n }\n // Unschedule the pending loop task.\n pending();\n pending = null;\n // Run the message loop within the recursion guard.\n flushGuard = true;\n runMessageLoop();\n flushGuard = false;\n }\n MessageLoop.flush = flush;\n /**\n * Get the message loop exception handler.\n *\n * @returns The current exception handler.\n *\n * #### Notes\n * The default exception handler is `console.error`.\n */\n function getExceptionHandler() {\n return exceptionHandler;\n }\n MessageLoop.getExceptionHandler = getExceptionHandler;\n /**\n * Set the message loop exception handler.\n *\n * @param handler - The function to use as the exception handler.\n *\n * @returns The old exception handler.\n *\n * #### Notes\n * The exception handler is invoked when a message handler or a\n * message hook throws an exception.\n */\n function setExceptionHandler(handler) {\n let old = exceptionHandler;\n exceptionHandler = handler;\n return old;\n }\n MessageLoop.setExceptionHandler = setExceptionHandler;\n /**\n * The queue of posted message pairs.\n */\n const messageQueue = new LinkedList();\n /**\n * A mapping of handler to array of installed message hooks.\n */\n const messageHooks = new WeakMap();\n /**\n * A set of message hook arrays which are pending cleanup.\n */\n const dirtySet = new Set();\n /**\n * The message loop exception handler.\n */\n let exceptionHandler = (err) => {\n console.error(err);\n };\n /**\n * A guard flag to prevent flush recursion.\n */\n let flushGuard = false;\n /**\n * Invoke a message hook with the specified handler and message.\n *\n * Returns the result of the hook, or `true` if the hook throws.\n *\n * Exceptions in the hook will be caught and logged.\n */\n function invokeHook(hook, handler, msg) {\n let result = true;\n try {\n if (typeof hook === 'function') {\n result = hook(handler, msg);\n }\n else {\n result = hook.messageHook(handler, msg);\n }\n }\n catch (err) {\n exceptionHandler(err);\n }\n return result;\n }\n /**\n * Invoke a message handler with the specified message.\n *\n * Exceptions in the handler will be caught and logged.\n */\n function invokeHandler(handler, msg) {\n try {\n handler.processMessage(msg);\n }\n catch (err) {\n exceptionHandler(err);\n }\n }\n /**\n * Add a message to the end of the message queue.\n *\n * This will automatically schedule a run of the message loop.\n */\n function enqueueMessage(handler, msg) {\n // Add the posted message to the queue.\n messageQueue.addLast({ handler, msg });\n // Bail if a loop task is already pending.\n if (pending !== null) {\n return;\n }\n // Schedule a run of the message loop.\n pending = schedule(runMessageLoop);\n }\n /**\n * Run an iteration of the message loop.\n *\n * This will process all pending messages in the queue. If a message\n * is added to the queue while the message loop is running, it will\n * be processed on the next cycle of the loop.\n */\n function runMessageLoop() {\n // Clear the task so the next loop can be scheduled.\n pending = null;\n // If the message queue is empty, there is nothing else to do.\n if (messageQueue.isEmpty) {\n return;\n }\n // Add a sentinel value to the end of the queue. The queue will\n // only be processed up to the sentinel. Messages posted during\n // this cycle will execute on the next cycle.\n let sentinel = { handler: null, msg: null };\n messageQueue.addLast(sentinel);\n // Enter the message loop.\n // eslint-disable-next-line no-constant-condition\n while (true) {\n // Remove the first posted message in the queue.\n let posted = messageQueue.removeFirst();\n // If the value is the sentinel, exit the loop.\n if (posted === sentinel) {\n return;\n }\n // Dispatch the message if it has not been cleared.\n if (posted.handler && posted.msg) {\n sendMessage(posted.handler, posted.msg);\n }\n }\n }\n /**\n * Schedule a cleanup of a message hooks array.\n *\n * This will add the array to the dirty set and schedule a deferred\n * cleanup of the array contents. On cleanup, any `null` hook will\n * be removed from the array.\n */\n function scheduleCleanup(hooks) {\n if (dirtySet.size === 0) {\n schedule(cleanupDirtySet);\n }\n dirtySet.add(hooks);\n }\n /**\n * Cleanup the message hook arrays in the dirty set.\n *\n * This function should only be invoked asynchronously, when the\n * stack frame is guaranteed to not be on the path of user code.\n */\n function cleanupDirtySet() {\n dirtySet.forEach(cleanupHooks);\n dirtySet.clear();\n }\n /**\n * Cleanup the dirty hooks in a message hooks array.\n *\n * This will remove any `null` hook from the array.\n *\n * This function should only be invoked asynchronously, when the\n * stack frame is guaranteed to not be on the path of user code.\n */\n function cleanupHooks(hooks) {\n ArrayExt.removeAllWhere(hooks, isNull);\n }\n /**\n * Test whether a value is `null`.\n */\n function isNull(value) {\n return value === null;\n }\n})(MessageLoop || (MessageLoop = {}));\n\nexport { ConflatableMessage, Message, MessageLoop };\n//# sourceMappingURL=index.es6.js.map\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { Signal } from '@lumino/signaling';\n/**\n * A concrete implementation of IObservableMap.\n */\nexport class ObservableMap {\n /**\n * Construct a new observable map.\n */\n constructor(options = {}) {\n this._map = new Map();\n this._changed = new Signal(this);\n this._isDisposed = false;\n this._itemCmp = options.itemCmp || Private.itemCmp;\n if (options.values) {\n for (const key in options.values) {\n this._map.set(key, options.values[key]);\n }\n }\n }\n /**\n * The type of the Observable.\n */\n get type() {\n return 'Map';\n }\n /**\n * A signal emitted when the map has changed.\n */\n get changed() {\n return this._changed;\n }\n /**\n * Whether this map has been disposed.\n */\n get isDisposed() {\n return this._isDisposed;\n }\n /**\n * The number of key-value pairs in the map.\n */\n get size() {\n return this._map.size;\n }\n /**\n * Set a key-value pair in the map\n *\n * @param key - The key to set.\n *\n * @param value - The value for the key.\n *\n * @returns the old value for the key, or undefined\n * if that did not exist.\n *\n * @throws if the new value is undefined.\n *\n * #### Notes\n * This is a no-op if the value does not change.\n */\n set(key, value) {\n const oldVal = this._map.get(key);\n if (value === undefined) {\n throw Error('Cannot set an undefined value, use remove');\n }\n // Bail if the value does not change.\n const itemCmp = this._itemCmp;\n if (oldVal !== undefined && itemCmp(oldVal, value)) {\n return oldVal;\n }\n this._map.set(key, value);\n this._changed.emit({\n type: oldVal ? 'change' : 'add',\n key: key,\n oldValue: oldVal,\n newValue: value\n });\n return oldVal;\n }\n /**\n * Get a value for a given key.\n *\n * @param key - the key.\n *\n * @returns the value for that key.\n */\n get(key) {\n return this._map.get(key);\n }\n /**\n * Check whether the map has a key.\n *\n * @param key - the key to check.\n *\n * @returns `true` if the map has the key, `false` otherwise.\n */\n has(key) {\n return this._map.has(key);\n }\n /**\n * Get a list of the keys in the map.\n *\n * @returns - a list of keys.\n */\n keys() {\n const keyList = [];\n this._map.forEach((v, k) => {\n keyList.push(k);\n });\n return keyList;\n }\n /**\n * Get a list of the values in the map.\n *\n * @returns - a list of values.\n */\n values() {\n const valList = [];\n this._map.forEach((v, k) => {\n valList.push(v);\n });\n return valList;\n }\n /**\n * Remove a key from the map\n *\n * @param key - the key to remove.\n *\n * @returns the value of the given key,\n * or undefined if that does not exist.\n *\n * #### Notes\n * This is a no-op if the value does not change.\n */\n delete(key) {\n const oldVal = this._map.get(key);\n const removed = this._map.delete(key);\n if (removed) {\n this._changed.emit({\n type: 'remove',\n key: key,\n oldValue: oldVal,\n newValue: undefined\n });\n }\n return oldVal;\n }\n /**\n * Set the ObservableMap to an empty map.\n */\n clear() {\n // Delete one by one to emit the correct signals.\n const keyList = this.keys();\n for (let i = 0; i < keyList.length; i++) {\n this.delete(keyList[i]);\n }\n }\n /**\n * Dispose of the resources held by the map.\n */\n dispose() {\n if (this.isDisposed) {\n return;\n }\n this._isDisposed = true;\n Signal.clearData(this);\n this._map.clear();\n }\n}\n/**\n * The namespace for module private data.\n */\nvar Private;\n(function (Private) {\n /**\n * The default strict equality item comparator.\n */\n function itemCmp(first, second) {\n return first === second;\n }\n Private.itemCmp = itemCmp;\n})(Private || (Private = {}));\n//# sourceMappingURL=observablemap.js.map","/* -----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\nimport * as nbformat from '@jupyterlab/nbformat';\nimport { ObservableJSON } from '@jupyterlab/observables';\nimport { JSONExt } from '@lumino/coreutils';\nimport { Signal } from '@lumino/signaling';\n/**\n * The default implementation of a notebook output model.\n */\nexport class OutputModel {\n /**\n * Construct a new output model.\n */\n constructor(options) {\n this._changed = new Signal(this);\n this._raw = {};\n const { data, metadata, trusted } = Private.getBundleOptions(options);\n this._data = new ObservableJSON({ values: data });\n this._rawData = data;\n this._metadata = new ObservableJSON({ values: metadata });\n this._rawMetadata = metadata;\n this.trusted = trusted;\n // Make a copy of the data.\n const value = options.value;\n for (const key in value) {\n // Ignore data and metadata that were stripped.\n switch (key) {\n case 'data':\n case 'metadata':\n break;\n default:\n this._raw[key] = Private.extract(value, key);\n }\n }\n this.type = value.output_type;\n if (nbformat.isExecuteResult(value)) {\n this.executionCount = value.execution_count;\n }\n else {\n this.executionCount = null;\n }\n }\n /**\n * A signal emitted when the output model changes.\n */\n get changed() {\n return this._changed;\n }\n /**\n * Dispose of the resources used by the output model.\n */\n dispose() {\n this._data.dispose();\n this._metadata.dispose();\n Signal.clearData(this);\n }\n /**\n * The data associated with the model.\n */\n get data() {\n return this._rawData;\n }\n /**\n * The metadata associated with the model.\n */\n get metadata() {\n return this._rawMetadata;\n }\n /**\n * Set the data associated with the model.\n *\n * #### Notes\n * Depending on the implementation of the mime model,\n * this call may or may not have deferred effects,\n */\n setData(options) {\n if (options.data) {\n this._updateObservable(this._data, options.data);\n this._rawData = options.data;\n }\n if (options.metadata) {\n this._updateObservable(this._metadata, options.metadata);\n this._rawMetadata = options.metadata;\n }\n this._changed.emit();\n }\n /**\n * Serialize the model to JSON.\n */\n toJSON() {\n const output = {};\n for (const key in this._raw) {\n output[key] = Private.extract(this._raw, key);\n }\n switch (this.type) {\n case 'display_data':\n case 'execute_result':\n case 'update_display_data':\n output['data'] = this.data;\n output['metadata'] = this.metadata;\n break;\n default:\n break;\n }\n // Remove transient data.\n delete output['transient'];\n return output;\n }\n /**\n * Update an observable JSON object using a readonly JSON object.\n */\n _updateObservable(observable, data) {\n const oldKeys = observable.keys();\n const newKeys = Object.keys(data);\n // Handle removed keys.\n for (const key of oldKeys) {\n if (newKeys.indexOf(key) === -1) {\n observable.delete(key);\n }\n }\n // Handle changed data.\n for (const key of newKeys) {\n const oldValue = observable.get(key);\n const newValue = data[key];\n if (oldValue !== newValue) {\n observable.set(key, newValue);\n }\n }\n }\n}\n/**\n * The namespace for OutputModel statics.\n */\n(function (OutputModel) {\n /**\n * Get the data for an output.\n *\n * @param output - A kernel output message payload.\n *\n * @returns - The data for the payload.\n */\n function getData(output) {\n return Private.getData(output);\n }\n OutputModel.getData = getData;\n /**\n * Get the metadata from an output message.\n *\n * @param output - A kernel output message payload.\n *\n * @returns - The metadata for the payload.\n */\n function getMetadata(output) {\n return Private.getMetadata(output);\n }\n OutputModel.getMetadata = getMetadata;\n})(OutputModel || (OutputModel = {}));\n/**\n * The namespace for module private data.\n */\nvar Private;\n(function (Private) {\n /**\n * Get the data from a notebook output.\n */\n function getData(output) {\n let bundle = {};\n if (nbformat.isExecuteResult(output) ||\n nbformat.isDisplayData(output) ||\n nbformat.isDisplayUpdate(output)) {\n bundle = output.data;\n }\n else if (nbformat.isStream(output)) {\n if (output.name === 'stderr') {\n bundle['application/vnd.jupyter.stderr'] = output.text;\n }\n else {\n bundle['application/vnd.jupyter.stdout'] = output.text;\n }\n }\n else if (nbformat.isError(output)) {\n bundle['application/vnd.jupyter.error'] = output;\n const traceback = output.traceback.join('\\n');\n bundle['application/vnd.jupyter.stderr'] =\n traceback || `${output.ename}: ${output.evalue}`;\n }\n return convertBundle(bundle);\n }\n Private.getData = getData;\n /**\n * Get the metadata from an output message.\n */\n function getMetadata(output) {\n const value = Object.create(null);\n if (nbformat.isExecuteResult(output) || nbformat.isDisplayData(output)) {\n for (const key in output.metadata) {\n value[key] = extract(output.metadata, key);\n }\n }\n return value;\n }\n Private.getMetadata = getMetadata;\n /**\n * Get the bundle options given output model options.\n */\n function getBundleOptions(options) {\n const data = getData(options.value);\n const metadata = getMetadata(options.value);\n const trusted = !!options.trusted;\n return { data, metadata, trusted };\n }\n Private.getBundleOptions = getBundleOptions;\n /**\n * Extract a value from a JSONObject.\n */\n function extract(value, key) {\n const item = value[key];\n if (item === undefined || JSONExt.isPrimitive(item)) {\n return item;\n }\n return JSON.parse(JSON.stringify(item));\n }\n Private.extract = extract;\n /**\n * Convert a mime bundle to mime data.\n */\n function convertBundle(bundle) {\n const map = Object.create(null);\n for (const mimeType in bundle) {\n map[mimeType] = extract(bundle, mimeType);\n }\n return map;\n }\n})(Private || (Private = {}));\n//# sourceMappingURL=outputmodel.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * The namespace for array-specific algorithms.\n */\nvar ArrayExt;\n(function (ArrayExt) {\n /**\n * Find the index of the first occurrence of a value in an array.\n *\n * @param array - The array-like object to search.\n *\n * @param value - The value to locate in the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first occurrence of the value, or `-1`\n * if the value is not found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four', 'one'];\n * ArrayExt.firstIndexOf(data, 'red'); // -1\n * ArrayExt.firstIndexOf(data, 'one'); // 0\n * ArrayExt.firstIndexOf(data, 'one', 1); // 4\n * ArrayExt.firstIndexOf(data, 'two', 2); // -1\n * ArrayExt.firstIndexOf(data, 'two', 2, 1); // 1\n * ```\n */\n function firstIndexOf(array, value, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let span;\n if (stop < start) {\n span = stop + 1 + (n - start);\n }\n else {\n span = stop - start + 1;\n }\n for (let i = 0; i < span; ++i) {\n let j = (start + i) % n;\n if (array[j] === value) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.firstIndexOf = firstIndexOf;\n /**\n * Find the index of the last occurrence of a value in an array.\n *\n * @param array - The array-like object to search.\n *\n * @param value - The value to locate in the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the last occurrence of the value, or `-1`\n * if the value is not found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four', 'one'];\n * ArrayExt.lastIndexOf(data, 'red'); // -1\n * ArrayExt.lastIndexOf(data, 'one'); // 4\n * ArrayExt.lastIndexOf(data, 'one', 1); // 0\n * ArrayExt.lastIndexOf(data, 'two', 0); // -1\n * ArrayExt.lastIndexOf(data, 'two', 0, 1); // 1\n * ```\n */\n function lastIndexOf(array, value, start = -1, stop = 0) {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let span;\n if (start < stop) {\n span = start + 1 + (n - stop);\n }\n else {\n span = start - stop + 1;\n }\n for (let i = 0; i < span; ++i) {\n let j = (start - i + n) % n;\n if (array[j] === value) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.lastIndexOf = lastIndexOf;\n /**\n * Find the index of the first value which matches a predicate.\n *\n * @param array - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first matching value, or `-1` if no\n * matching value is found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findFirstIndex(data, isEven); // 1\n * ArrayExt.findFirstIndex(data, isEven, 4); // 5\n * ArrayExt.findFirstIndex(data, isEven, 6); // -1\n * ArrayExt.findFirstIndex(data, isEven, 6, 5); // 1\n * ```\n */\n function findFirstIndex(array, fn, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let span;\n if (stop < start) {\n span = stop + 1 + (n - start);\n }\n else {\n span = stop - start + 1;\n }\n for (let i = 0; i < span; ++i) {\n let j = (start + i) % n;\n if (fn(array[j], j)) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.findFirstIndex = findFirstIndex;\n /**\n * Find the index of the last value which matches a predicate.\n *\n * @param array - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the last matching value, or `-1` if no\n * matching value is found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findLastIndex(data, isEven); // 5\n * ArrayExt.findLastIndex(data, isEven, 4); // 3\n * ArrayExt.findLastIndex(data, isEven, 0); // -1\n * ArrayExt.findLastIndex(data, isEven, 0, 1); // 5\n * ```\n */\n function findLastIndex(array, fn, start = -1, stop = 0) {\n let n = array.length;\n if (n === 0) {\n return -1;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let d;\n if (start < stop) {\n d = start + 1 + (n - stop);\n }\n else {\n d = start - stop + 1;\n }\n for (let i = 0; i < d; ++i) {\n let j = (start - i + n) % n;\n if (fn(array[j], j)) {\n return j;\n }\n }\n return -1;\n }\n ArrayExt.findLastIndex = findLastIndex;\n /**\n * Find the first value which matches a predicate.\n *\n * @param array - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The first matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findFirstValue(data, isEven); // 2\n * ArrayExt.findFirstValue(data, isEven, 2); // 4\n * ArrayExt.findFirstValue(data, isEven, 6); // undefined\n * ArrayExt.findFirstValue(data, isEven, 6, 5); // 2\n * ```\n */\n function findFirstValue(array, fn, start = 0, stop = -1) {\n let index = findFirstIndex(array, fn, start, stop);\n return index !== -1 ? array[index] : undefined;\n }\n ArrayExt.findFirstValue = findFirstValue;\n /**\n * Find the last value which matches a predicate.\n *\n * @param object - The array-like object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The last matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the front of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [1, 2, 3, 4, 3, 2, 1];\n * ArrayExt.findLastValue(data, isEven); // 2\n * ArrayExt.findLastValue(data, isEven, 4); // 4\n * ArrayExt.findLastValue(data, isEven, 0); // undefined\n * ArrayExt.findLastValue(data, isEven, 0, 1); // 2\n * ```\n */\n function findLastValue(array, fn, start = -1, stop = 0) {\n let index = findLastIndex(array, fn, start, stop);\n return index !== -1 ? array[index] : undefined;\n }\n ArrayExt.findLastValue = findLastValue;\n /**\n * Find the index of the first element which compares `>=` to a value.\n *\n * @param array - The sorted array-like object to search.\n *\n * @param value - The value to locate in the array.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if an element is less than a value, `0` if\n * an element is equal to a value, or `> 0` if an element is greater\n * than a value.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first element which compares `>=` to the\n * value, or `length` if there is no such element. If the computed\n * index for `stop` is less than `start`, then the computed index\n * for `start` is returned.\n *\n * #### Notes\n * The array must already be sorted in ascending order according to\n * the comparison function.\n *\n * #### Complexity\n * Logarithmic.\n *\n * #### Undefined Behavior\n * Searching a range which is not sorted in ascending order.\n *\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.lowerBound(data, 0, numberCmp); // 0\n * ArrayExt.lowerBound(data, 6, numberCmp); // 3\n * ArrayExt.lowerBound(data, 7, numberCmp); // 3\n * ArrayExt.lowerBound(data, -1, numberCmp); // 0\n * ArrayExt.lowerBound(data, 10, numberCmp); // 6\n * ```\n */\n function lowerBound(array, value, fn, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let begin = start;\n let span = stop - start + 1;\n while (span > 0) {\n let half = span >> 1;\n let middle = begin + half;\n if (fn(array[middle], value) < 0) {\n begin = middle + 1;\n span -= half + 1;\n }\n else {\n span = half;\n }\n }\n return begin;\n }\n ArrayExt.lowerBound = lowerBound;\n /**\n * Find the index of the first element which compares `>` than a value.\n *\n * @param array - The sorted array-like object to search.\n *\n * @param value - The value to locate in the array.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if an element is less than a value, `0` if\n * an element is equal to a value, or `> 0` if an element is greater\n * than a value.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the first element which compares `>` than the\n * value, or `length` if there is no such element. If the computed\n * index for `stop` is less than `start`, then the computed index\n * for `start` is returned.\n *\n * #### Notes\n * The array must already be sorted in ascending order according to\n * the comparison function.\n *\n * #### Complexity\n * Logarithmic.\n *\n * #### Undefined Behavior\n * Searching a range which is not sorted in ascending order.\n *\n * A `start` or `stop` which is non-integral.\n *\n * Modifying the length of the array while searching.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.upperBound(data, 0, numberCmp); // 1\n * ArrayExt.upperBound(data, 6, numberCmp); // 3\n * ArrayExt.upperBound(data, 7, numberCmp); // 5\n * ArrayExt.upperBound(data, -1, numberCmp); // 0\n * ArrayExt.upperBound(data, 10, numberCmp); // 6\n * ```\n */\n function upperBound(array, value, fn, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let begin = start;\n let span = stop - start + 1;\n while (span > 0) {\n let half = span >> 1;\n let middle = begin + half;\n if (fn(array[middle], value) > 0) {\n span = half;\n }\n else {\n begin = middle + 1;\n span -= half + 1;\n }\n }\n return begin;\n }\n ArrayExt.upperBound = upperBound;\n /**\n * Test whether two arrays are shallowly equal.\n *\n * @param a - The first array-like object to compare.\n *\n * @param b - The second array-like object to compare.\n *\n * @param fn - The comparison function to apply to the elements. It\n * should return `true` if the elements are \"equal\". The default\n * compares elements using strict `===` equality.\n *\n * @returns Whether the two arrays are shallowly equal.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * Modifying the length of the arrays while comparing.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let d1 = [0, 3, 4, 7, 7, 9];\n * let d2 = [0, 3, 4, 7, 7, 9];\n * let d3 = [42];\n * ArrayExt.shallowEqual(d1, d2); // true\n * ArrayExt.shallowEqual(d2, d3); // false\n * ```\n */\n function shallowEqual(a, b, fn) {\n // Check for object identity first.\n if (a === b) {\n return true;\n }\n // Bail early if the lengths are different.\n if (a.length !== b.length) {\n return false;\n }\n // Compare each element for equality.\n for (let i = 0, n = a.length; i < n; ++i) {\n if (fn ? !fn(a[i], b[i]) : a[i] !== b[i]) {\n return false;\n }\n }\n // The array are shallowly equal.\n return true;\n }\n ArrayExt.shallowEqual = shallowEqual;\n /**\n * Create a slice of an array subject to an optional step.\n *\n * @param array - The array-like object of interest.\n *\n * @param options - The options for configuring the slice.\n *\n * @returns A new array with the specified values.\n *\n * @throws An exception if the slice `step` is `0`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start`, `stop`, or `step` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 3, 4, 7, 7, 9];\n * ArrayExt.slice(data); // [0, 3, 4, 7, 7, 9]\n * ArrayExt.slice(data, { start: 2 }); // [4, 7, 7, 9]\n * ArrayExt.slice(data, { start: 0, stop: 4 }); // [0, 3, 4, 7]\n * ArrayExt.slice(data, { step: 2 }); // [0, 4, 7]\n * ArrayExt.slice(data, { step: -1 }); // [9, 7, 7, 4, 3, 0]\n * ```\n */\n function slice(array, options = {}) {\n // Extract the options.\n let { start, stop, step } = options;\n // Set up the `step` value.\n if (step === undefined) {\n step = 1;\n }\n // Validate the step size.\n if (step === 0) {\n throw new Error('Slice `step` cannot be zero.');\n }\n // Look up the length of the array.\n let n = array.length;\n // Set up the `start` value.\n if (start === undefined) {\n start = step < 0 ? n - 1 : 0;\n }\n else if (start < 0) {\n start = Math.max(start + n, step < 0 ? -1 : 0);\n }\n else if (start >= n) {\n start = step < 0 ? n - 1 : n;\n }\n // Set up the `stop` value.\n if (stop === undefined) {\n stop = step < 0 ? -1 : n;\n }\n else if (stop < 0) {\n stop = Math.max(stop + n, step < 0 ? -1 : 0);\n }\n else if (stop >= n) {\n stop = step < 0 ? n - 1 : n;\n }\n // Compute the slice length.\n let length;\n if ((step < 0 && stop >= start) || (step > 0 && start >= stop)) {\n length = 0;\n }\n else if (step < 0) {\n length = Math.floor((stop - start + 1) / step + 1);\n }\n else {\n length = Math.floor((stop - start - 1) / step + 1);\n }\n // Compute the sliced result.\n let result = [];\n for (let i = 0; i < length; ++i) {\n result[i] = array[start + i * step];\n }\n // Return the result.\n return result;\n }\n ArrayExt.slice = slice;\n /**\n * Move an element in an array from one index to another.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param fromIndex - The index of the element to move. Negative\n * values are taken as an offset from the end of the array.\n *\n * @param toIndex - The target index of the element. Negative\n * values are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `fromIndex` or `toIndex` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.move(data, 1, 2); // [0, 2, 1, 3, 4]\n * ArrayExt.move(data, 4, 2); // [0, 2, 4, 1, 3]\n * ```\n */\n function move(array, fromIndex, toIndex) {\n let n = array.length;\n if (n <= 1) {\n return;\n }\n if (fromIndex < 0) {\n fromIndex = Math.max(0, fromIndex + n);\n }\n else {\n fromIndex = Math.min(fromIndex, n - 1);\n }\n if (toIndex < 0) {\n toIndex = Math.max(0, toIndex + n);\n }\n else {\n toIndex = Math.min(toIndex, n - 1);\n }\n if (fromIndex === toIndex) {\n return;\n }\n let value = array[fromIndex];\n let d = fromIndex < toIndex ? 1 : -1;\n for (let i = fromIndex; i !== toIndex; i += d) {\n array[i] = array[i + d];\n }\n array[toIndex] = value;\n }\n ArrayExt.move = move;\n /**\n * Reverse an array in-place.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param start - The index of the first element in the range to be\n * reversed, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * reversed, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` index which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.reverse(data, 1, 3); // [0, 3, 2, 1, 4]\n * ArrayExt.reverse(data, 3); // [0, 3, 2, 4, 1]\n * ArrayExt.reverse(data); // [1, 4, 2, 3, 0]\n * ```\n */\n function reverse(array, start = 0, stop = -1) {\n let n = array.length;\n if (n <= 1) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n while (start < stop) {\n let a = array[start];\n let b = array[stop];\n array[start++] = b;\n array[stop--] = a;\n }\n }\n ArrayExt.reverse = reverse;\n /**\n * Rotate the elements of an array in-place.\n *\n * @param array - The mutable array-like object of interest.\n *\n * @param delta - The amount of rotation to apply to the elements. A\n * positive value will rotate the elements to the left. A negative\n * value will rotate the elements to the right.\n *\n * @param start - The index of the first element in the range to be\n * rotated, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * rotated, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `delta`, `start`, or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2, 3, 4];\n * ArrayExt.rotate(data, 2); // [2, 3, 4, 0, 1]\n * ArrayExt.rotate(data, -2); // [0, 1, 2, 3, 4]\n * ArrayExt.rotate(data, 10); // [0, 1, 2, 3, 4]\n * ArrayExt.rotate(data, 9); // [4, 0, 1, 2, 3]\n * ArrayExt.rotate(data, 2, 1, 3); // [4, 2, 0, 1, 3]\n * ```\n */\n function rotate(array, delta, start = 0, stop = -1) {\n let n = array.length;\n if (n <= 1) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n if (start >= stop) {\n return;\n }\n let length = stop - start + 1;\n if (delta > 0) {\n delta = delta % length;\n }\n else if (delta < 0) {\n delta = ((delta % length) + length) % length;\n }\n if (delta === 0) {\n return;\n }\n let pivot = start + delta;\n reverse(array, start, pivot - 1);\n reverse(array, pivot, stop);\n reverse(array, start, stop);\n }\n ArrayExt.rotate = rotate;\n /**\n * Fill an array with a static value.\n *\n * @param array - The mutable array-like object to fill.\n *\n * @param value - The static value to use to fill the array.\n *\n * @param start - The index of the first element in the range to be\n * filled, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * filled, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * #### Notes\n * If `stop < start` the fill will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * A `start` or `stop` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = ['one', 'two', 'three', 'four'];\n * ArrayExt.fill(data, 'r'); // ['r', 'r', 'r', 'r']\n * ArrayExt.fill(data, 'g', 1); // ['r', 'g', 'g', 'g']\n * ArrayExt.fill(data, 'b', 2, 3); // ['r', 'g', 'b', 'b']\n * ArrayExt.fill(data, 'z', 3, 1); // ['z', 'z', 'b', 'z']\n * ```\n */\n function fill(array, value, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let span;\n if (stop < start) {\n span = stop + 1 + (n - start);\n }\n else {\n span = stop - start + 1;\n }\n for (let i = 0; i < span; ++i) {\n array[(start + i) % n] = value;\n }\n }\n ArrayExt.fill = fill;\n /**\n * Insert a value into an array at a specific index.\n *\n * @param array - The array of interest.\n *\n * @param index - The index at which to insert the value. Negative\n * values are taken as an offset from the end of the array.\n *\n * @param value - The value to set at the specified index.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 1, 2];\n * ArrayExt.insert(data, 0, -1); // [-1, 0, 1, 2]\n * ArrayExt.insert(data, 2, 12); // [-1, 0, 12, 1, 2]\n * ArrayExt.insert(data, -1, 7); // [-1, 0, 12, 1, 7, 2]\n * ArrayExt.insert(data, 6, 19); // [-1, 0, 12, 1, 7, 2, 19]\n * ```\n */\n function insert(array, index, value) {\n let n = array.length;\n if (index < 0) {\n index = Math.max(0, index + n);\n }\n else {\n index = Math.min(index, n);\n }\n for (let i = n; i > index; --i) {\n array[i] = array[i - 1];\n }\n array[index] = value;\n }\n ArrayExt.insert = insert;\n /**\n * Remove and return a value at a specific index in an array.\n *\n * @param array - The array of interest.\n *\n * @param index - The index of the value to remove. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The value at the specified index, or `undefined` if the\n * index is out of range.\n *\n * #### Complexity\n * Linear.\n *\n * #### Undefined Behavior\n * An `index` which is non-integral.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeAt(data, 2); // 23\n * ArrayExt.removeAt(data, -2); // 12\n * ArrayExt.removeAt(data, 10); // undefined;\n * ```\n */\n function removeAt(array, index) {\n let n = array.length;\n if (index < 0) {\n index += n;\n }\n if (index < 0 || index >= n) {\n return undefined;\n }\n let value = array[index];\n for (let i = index + 1; i < n; ++i) {\n array[i - 1] = array[i];\n }\n array.length = n - 1;\n return value;\n }\n ArrayExt.removeAt = removeAt;\n /**\n * Remove the first occurrence of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the removed value, or `-1` if the value\n * is not contained in the array.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeFirstOf(data, 12); // 1\n * ArrayExt.removeFirstOf(data, 17); // -1\n * ArrayExt.removeFirstOf(data, 39, 3); // -1\n * ArrayExt.removeFirstOf(data, 39, 3, 2); // 2\n * ```\n */\n function removeFirstOf(array, value, start = 0, stop = -1) {\n let index = firstIndexOf(array, value, start, stop);\n if (index !== -1) {\n removeAt(array, index);\n }\n return index;\n }\n ArrayExt.removeFirstOf = removeFirstOf;\n /**\n * Remove the last occurrence of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The index of the removed value, or `-1` if the value\n * is not contained in the array.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeLastOf(data, 12); // 5\n * ArrayExt.removeLastOf(data, 17); // -1\n * ArrayExt.removeLastOf(data, 39, 2); // -1\n * ArrayExt.removeLastOf(data, 39, 2, 3); // 3\n * ```\n */\n function removeLastOf(array, value, start = -1, stop = 0) {\n let index = lastIndexOf(array, value, start, stop);\n if (index !== -1) {\n removeAt(array, index);\n }\n return index;\n }\n ArrayExt.removeLastOf = removeLastOf;\n /**\n * Remove all occurrences of a value from an array.\n *\n * @param array - The array of interest.\n *\n * @param value - The value to remove from the array. Values are\n * compared using strict `===` equality.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The number of elements removed from the array.\n *\n * #### Notes\n * If `stop < start` the search will conceptually wrap at the end of\n * the array, however the array will be traversed front-to-back.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * let data = [14, 12, 23, 39, 14, 12, 19, 14];\n * ArrayExt.removeAllOf(data, 12); // 2\n * ArrayExt.removeAllOf(data, 17); // 0\n * ArrayExt.removeAllOf(data, 14, 1, 4); // 1\n * ```\n */\n function removeAllOf(array, value, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let count = 0;\n for (let i = 0; i < n; ++i) {\n if (start <= stop && i >= start && i <= stop && array[i] === value) {\n count++;\n }\n else if (stop < start &&\n (i <= stop || i >= start) &&\n array[i] === value) {\n count++;\n }\n else if (count > 0) {\n array[i - count] = array[i];\n }\n }\n if (count > 0) {\n array.length = n - count;\n }\n return count;\n }\n ArrayExt.removeAllOf = removeAllOf;\n /**\n * Remove the first occurrence of a value which matches a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The removed `{ index, value }`, which will be `-1` and\n * `undefined` if the value is not contained in the array.\n *\n * #### Notes\n * If `stop < start` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeFirstWhere(data, isEven); // { index: 0, value: 0 }\n * ArrayExt.removeFirstWhere(data, isEven, 2); // { index: 3, value: 14 }\n * ArrayExt.removeFirstWhere(data, isEven, 4); // { index: -1, value: undefined }\n * ```\n */\n function removeFirstWhere(array, fn, start = 0, stop = -1) {\n let value;\n let index = findFirstIndex(array, fn, start, stop);\n if (index !== -1) {\n value = removeAt(array, index);\n }\n return { index, value };\n }\n ArrayExt.removeFirstWhere = removeFirstWhere;\n /**\n * Remove the last occurrence of a value which matches a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The removed `{ index, value }`, which will be `-1` and\n * `undefined` if the value is not contained in the array.\n *\n * #### Notes\n * If `start < stop` the search will wrap at the end of the array.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * let data = [0, 12, 23, 39, 14, 12, 75];\n * ArrayExt.removeLastWhere(data, isEven); // { index: 5, value: 12 }\n * ArrayExt.removeLastWhere(data, isEven, 2); // { index: 1, value: 12 }\n * ArrayExt.removeLastWhere(data, isEven, 2, 1); // { index: -1, value: undefined }\n * ```\n */\n function removeLastWhere(array, fn, start = -1, stop = 0) {\n let value;\n let index = findLastIndex(array, fn, start, stop);\n if (index !== -1) {\n value = removeAt(array, index);\n }\n return { index, value };\n }\n ArrayExt.removeLastWhere = removeLastWhere;\n /**\n * Remove all occurrences of values which match a predicate.\n *\n * @param array - The array of interest.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @param start - The index of the first element in the range to be\n * searched, inclusive. The default value is `0`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @param stop - The index of the last element in the range to be\n * searched, inclusive. The default value is `-1`. Negative values\n * are taken as an offset from the end of the array.\n *\n * @returns The number of elements removed from the array.\n *\n * #### Notes\n * If `stop < start` the search will conceptually wrap at the end of\n * the array, however the array will be traversed front-to-back.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { ArrayExt } from '@lumino/algorithm';\n *\n * function isEven(value: number): boolean {\n * return value % 2 === 0;\n * }\n *\n * function isNegative(value: number): boolean {\n * return value < 0;\n * }\n *\n * let data = [0, 12, -13, -9, 23, 39, 14, -15, 12, 75];\n * ArrayExt.removeAllWhere(data, isEven); // 4\n * ArrayExt.removeAllWhere(data, isNegative, 0, 3); // 2\n * ```\n */\n function removeAllWhere(array, fn, start = 0, stop = -1) {\n let n = array.length;\n if (n === 0) {\n return 0;\n }\n if (start < 0) {\n start = Math.max(0, start + n);\n }\n else {\n start = Math.min(start, n - 1);\n }\n if (stop < 0) {\n stop = Math.max(0, stop + n);\n }\n else {\n stop = Math.min(stop, n - 1);\n }\n let count = 0;\n for (let i = 0; i < n; ++i) {\n if (start <= stop && i >= start && i <= stop && fn(array[i], i)) {\n count++;\n }\n else if (stop < start && (i <= stop || i >= start) && fn(array[i], i)) {\n count++;\n }\n else if (count > 0) {\n array[i - count] = array[i];\n }\n }\n if (count > 0) {\n array.length = n - count;\n }\n return count;\n }\n ArrayExt.removeAllWhere = removeAllWhere;\n})(ArrayExt || (ArrayExt = {}));\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Chain together several iterables.\n *\n * @deprecated\n *\n * @param objects - The iterable objects of interest.\n *\n * @returns An iterator which yields the values of the iterables\n * in the order in which they are supplied.\n *\n * #### Example\n * ```typescript\n * import { chain } from '@lumino/algorithm';\n *\n * let data1 = [1, 2, 3];\n * let data2 = [4, 5, 6];\n *\n * let stream = chain(data1, data2);\n *\n * Array.from(stream); // [1, 2, 3, 4, 5, 6]\n * ```\n */\nfunction* chain(...objects) {\n for (const object of objects) {\n yield* object;\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an empty iterator.\n *\n * @returns A new iterator which yields nothing.\n *\n * #### Example\n * ```typescript\n * import { empty } from '@lumino/algorithm';\n *\n * let stream = empty();\n *\n * Array.from(stream); // []\n * ```\n */\n// eslint-disable-next-line require-yield\nfunction* empty() {\n return;\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Enumerate an iterable object.\n *\n * @param object - The iterable object of interest.\n *\n * @param start - The starting enum value. The default is `0`.\n *\n * @returns An iterator which yields the enumerated values.\n *\n * #### Example\n * ```typescript\n * import { enumerate } from '@lumino/algorithm';\n *\n * let data = ['foo', 'bar', 'baz'];\n *\n * let stream = enumerate(data, 1);\n *\n * Array.from(stream); // [[1, 'foo'], [2, 'bar'], [3, 'baz']]\n * ```\n */\nfunction* enumerate(object, start = 0) {\n for (const value of object) {\n yield [start++, value];\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Filter an iterable for values which pass a test.\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns An iterator which yields the values which pass the test.\n *\n * #### Example\n * ```typescript\n * import { filter } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = filter(data, value => value % 2 === 0);\n *\n * Array.from(stream); // [2, 4, 6]\n * ```\n */\nfunction* filter(object, fn) {\n let index = 0;\n for (const value of object) {\n if (fn(value, index++)) {\n yield value;\n }\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Find the first value in an iterable which matches a predicate.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @returns The first matching value, or `undefined` if no matching\n * value is found.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { find } from '@lumino/algorithm';\n *\n * interface IAnimal { species: string, name: string };\n *\n * function isCat(value: IAnimal): boolean {\n * return value.species === 'cat';\n * }\n *\n * let data: IAnimal[] = [\n * { species: 'dog', name: 'spot' },\n * { species: 'cat', name: 'fluffy' },\n * { species: 'alligator', name: 'pocho' }\n * ];\n *\n * find(data, isCat).name; // 'fluffy'\n * ```\n */\nfunction find(object, fn) {\n let index = 0;\n for (const value of object) {\n if (fn(value, index++)) {\n return value;\n }\n }\n return undefined;\n}\n/**\n * Find the index of the first value which matches a predicate.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The predicate function to apply to the values.\n *\n * @returns The index of the first matching value, or `-1` if no\n * matching value is found.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { findIndex } from '@lumino/algorithm';\n *\n * interface IAnimal { species: string, name: string };\n *\n * function isCat(value: IAnimal): boolean {\n * return value.species === 'cat';\n * }\n *\n * let data: IAnimal[] = [\n * { species: 'dog', name: 'spot' },\n * { species: 'cat', name: 'fluffy' },\n * { species: 'alligator', name: 'pocho' }\n * ];\n *\n * findIndex(data, isCat); // 1\n * ```\n */\nfunction findIndex(object, fn) {\n let index = 0;\n for (const value of object) {\n if (fn(value, index++)) {\n return index - 1;\n }\n }\n return -1;\n}\n/**\n * Find the minimum value in an iterable.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns The minimum value in the iterable. If multiple values are\n * equivalent to the minimum, the left-most value is returned. If\n * the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { min } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * min([7, 4, 0, 3, 9, 4], numberCmp); // 0\n * ```\n */\nfunction min(object, fn) {\n let result = undefined;\n for (const value of object) {\n if (result === undefined) {\n result = value;\n continue;\n }\n if (fn(value, result) < 0) {\n result = value;\n }\n }\n return result;\n}\n/**\n * Find the maximum value in an iterable.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns The maximum value in the iterable. If multiple values are\n * equivalent to the maximum, the left-most value is returned. If\n * the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { max } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * max([7, 4, 0, 3, 9, 4], numberCmp); // 9\n * ```\n */\nfunction max(object, fn) {\n let result = undefined;\n for (const value of object) {\n if (result === undefined) {\n result = value;\n continue;\n }\n if (fn(value, result) > 0) {\n result = value;\n }\n }\n return result;\n}\n/**\n * Find the minimum and maximum values in an iterable.\n *\n * @param object - The iterable object to search.\n *\n * @param fn - The 3-way comparison function to apply to the values.\n * It should return `< 0` if the first value is less than the second.\n * `0` if the values are equivalent, or `> 0` if the first value is\n * greater than the second.\n *\n * @returns A 2-tuple of the `[min, max]` values in the iterable. If\n * multiple values are equivalent, the left-most values are returned.\n * If the iterable is empty, this returns `undefined`.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { minmax } from '@lumino/algorithm';\n *\n * function numberCmp(a: number, b: number): number {\n * return a - b;\n * }\n *\n * minmax([7, 4, 0, 3, 9, 4], numberCmp); // [0, 9]\n * ```\n */\nfunction minmax(object, fn) {\n let empty = true;\n let vmin;\n let vmax;\n for (const value of object) {\n if (empty) {\n vmin = value;\n vmax = value;\n empty = false;\n }\n else if (fn(value, vmin) < 0) {\n vmin = value;\n }\n else if (fn(value, vmax) > 0) {\n vmax = value;\n }\n }\n return empty ? undefined : [vmin, vmax];\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an array from an iterable of values.\n *\n * @deprecated\n *\n * @param object - The iterable object of interest.\n *\n * @returns A new array of values from the given object.\n *\n * #### Example\n * ```typescript\n * import { toArray } from '@lumino/algorithm';\n *\n * let stream = [1, 2, 3, 4, 5, 6][Symbol.iterator]();\n *\n * toArray(stream); // [1, 2, 3, 4, 5, 6];\n * ```\n */\nfunction toArray(object) {\n return Array.from(object);\n}\n/**\n * Create an object from an iterable of key/value pairs.\n *\n * @param object - The iterable object of interest.\n *\n * @returns A new object mapping keys to values.\n *\n * #### Example\n * ```typescript\n * import { toObject } from '@lumino/algorithm';\n *\n * let data: [string, number][] = [['one', 1], ['two', 2], ['three', 3]];\n *\n * toObject(data); // { one: 1, two: 2, three: 3 }\n * ```\n */\nfunction toObject(object) {\n const result = {};\n for (const [key, value] of object) {\n result[key] = value;\n }\n return result;\n}\n/**\n * Invoke a function for each value in an iterable.\n *\n * @deprecated\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The callback function to invoke for each value.\n *\n * #### Notes\n * Iteration can be terminated early by returning `false` from the\n * callback function.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { each } from '@lumino/algorithm';\n *\n * let data = [5, 7, 0, -2, 9];\n *\n * each(data, value => { console.log(value); });\n * ```\n */\nfunction each(object, fn) {\n let index = 0;\n for (const value of object) {\n if (false === fn(value, index++)) {\n return;\n }\n }\n}\n/**\n * Test whether all values in an iterable satisfy a predicate.\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns `true` if all values pass the test, `false` otherwise.\n *\n * #### Notes\n * Iteration terminates on the first `false` predicate result.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { every } from '@lumino/algorithm';\n *\n * let data = [5, 7, 1];\n *\n * every(data, value => value % 2 === 0); // false\n * every(data, value => value % 2 === 1); // true\n * ```\n */\nfunction every(object, fn) {\n let index = 0;\n for (const value of object) {\n if (false === fn(value, index++)) {\n return false;\n }\n }\n return true;\n}\n/**\n * Test whether any value in an iterable satisfies a predicate.\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The predicate function to invoke for each value.\n *\n * @returns `true` if any value passes the test, `false` otherwise.\n *\n * #### Notes\n * Iteration terminates on the first `true` predicate result.\n *\n * #### Complexity\n * Linear.\n *\n * #### Example\n * ```typescript\n * import { some } from '@lumino/algorithm';\n *\n * let data = [5, 7, 1];\n *\n * some(data, value => value === 7); // true\n * some(data, value => value === 3); // false\n * ```\n */\nfunction some(object, fn) {\n let index = 0;\n for (const value of object) {\n if (fn(value, index++)) {\n return true;\n }\n }\n return false;\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Transform the values of an iterable with a mapping function.\n *\n * @param object - The iterable object of interest.\n *\n * @param fn - The mapping function to invoke for each value.\n *\n * @returns An iterator which yields the transformed values.\n *\n * #### Example\n * ```typescript\n * import { map } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3];\n *\n * let stream = map(data, value => value * 2);\n *\n * Array.from(stream); // [2, 4, 6]\n * ```\n */\nfunction* map(object, fn) {\n let index = 0;\n for (const value of object) {\n yield fn(value, index++);\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an iterator of evenly spaced values.\n *\n * @param start - The starting value for the range, inclusive.\n *\n * @param stop - The stopping value for the range, exclusive.\n *\n * @param step - The distance between each value.\n *\n * @returns An iterator which produces evenly spaced values.\n *\n * #### Notes\n * In the single argument form of `range(stop)`, `start` defaults to\n * `0` and `step` defaults to `1`.\n *\n * In the two argument form of `range(start, stop)`, `step` defaults\n * to `1`.\n *\n * #### Example\n * ```typescript\n * import { range } from '@lumino/algorithm';\n *\n * let stream = range(2, 4);\n *\n * Array.from(stream); // [2, 3]\n * ```\n */\nfunction* range(start, stop, step) {\n if (stop === undefined) {\n stop = start;\n start = 0;\n step = 1;\n }\n else if (step === undefined) {\n step = 1;\n }\n const length = Private.rangeLength(start, stop, step);\n for (let index = 0; index < length; index++) {\n yield start + step * index;\n }\n}\n/**\n * The namespace for the module implementation details.\n */\nvar Private;\n(function (Private) {\n /**\n * Compute the effective length of a range.\n *\n * @param start - The starting value for the range, inclusive.\n *\n * @param stop - The stopping value for the range, exclusive.\n *\n * @param step - The distance between each value.\n *\n * @returns The number of steps need to traverse the range.\n */\n function rangeLength(start, stop, step) {\n if (step === 0) {\n return Infinity;\n }\n if (start > stop && step > 0) {\n return 0;\n }\n if (start < stop && step < 0) {\n return 0;\n }\n return Math.ceil((stop - start) / step);\n }\n Private.rangeLength = rangeLength;\n})(Private || (Private = {}));\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\nfunction reduce(object, fn, initial) {\n // Setup the iterator and fetch the first value.\n const it = object[Symbol.iterator]();\n let index = 0;\n let first = it.next();\n // An empty iterator and no initial value is an error.\n if (first.done && initial === undefined) {\n throw new TypeError('Reduce of empty iterable with no initial value.');\n }\n // If the iterator is empty, return the initial value.\n if (first.done) {\n return initial;\n }\n // If the iterator has a single item and no initial value, the\n // reducer is not invoked and the first item is the return value.\n let second = it.next();\n if (second.done && initial === undefined) {\n return first.value;\n }\n // If iterator has a single item and an initial value is provided,\n // the reducer is invoked and that result is the return value.\n if (second.done) {\n return fn(initial, first.value, index++);\n }\n // Setup the initial accumlated value.\n let accumulator;\n if (initial === undefined) {\n accumulator = fn(first.value, second.value, index++);\n }\n else {\n accumulator = fn(fn(initial, first.value, index++), second.value, index++);\n }\n // Iterate the rest of the values, updating the accumulator.\n let next;\n while (!(next = it.next()).done) {\n accumulator = fn(accumulator, next.value, index++);\n }\n // Return the final accumulated value.\n return accumulator;\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an iterator which repeats a value a number of times.\n *\n * @deprecated\n *\n * @param value - The value to repeat.\n *\n * @param count - The number of times to repeat the value.\n *\n * @returns A new iterator which repeats the specified value.\n *\n * #### Example\n * ```typescript\n * import { repeat } from '@lumino/algorithm';\n *\n * let stream = repeat(7, 3);\n *\n * Array.from(stream); // [7, 7, 7]\n * ```\n */\nfunction* repeat(value, count) {\n while (0 < count--) {\n yield value;\n }\n}\n/**\n * Create an iterator which yields a value a single time.\n *\n * @deprecated\n *\n * @param value - The value to wrap in an iterator.\n *\n * @returns A new iterator which yields the value a single time.\n *\n * #### Example\n * ```typescript\n * import { once } from '@lumino/algorithm';\n *\n * let stream = once(7);\n *\n * Array.from(stream); // [7]\n * ```\n */\nfunction* once(value) {\n yield value;\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Create an iterator for a retroable object.\n *\n * @param object - The retroable or array-like object of interest.\n *\n * @returns An iterator which traverses the object's values in reverse.\n *\n * #### Example\n * ```typescript\n * import { retro } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = retro(data);\n *\n * Array.from(stream); // [6, 5, 4, 3, 2, 1]\n * ```\n */\nfunction* retro(object) {\n if (typeof object.retro === 'function') {\n yield* object.retro();\n }\n else {\n for (let index = object.length - 1; index > -1; index--) {\n yield object[index];\n }\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Topologically sort an iterable of edges.\n *\n * @param edges - The iterable object of edges to sort.\n * An edge is represented as a 2-tuple of `[fromNode, toNode]`.\n *\n * @returns The topologically sorted array of nodes.\n *\n * #### Notes\n * If a cycle is present in the graph, the cycle will be ignored and\n * the return value will be only approximately sorted.\n *\n * #### Example\n * ```typescript\n * import { topologicSort } from '@lumino/algorithm';\n *\n * let data = [\n * ['d', 'e'],\n * ['c', 'd'],\n * ['a', 'b'],\n * ['b', 'c']\n * ];\n *\n * topologicSort(data); // ['a', 'b', 'c', 'd', 'e']\n * ```\n */\nfunction topologicSort(edges) {\n // Setup the shared sorting state.\n let sorted = [];\n let visited = new Set();\n let graph = new Map();\n // Add the edges to the graph.\n for (const edge of edges) {\n addEdge(edge);\n }\n // Visit each node in the graph.\n for (const [k] of graph) {\n visit(k);\n }\n // Return the sorted results.\n return sorted;\n // Add an edge to the graph.\n function addEdge(edge) {\n let [fromNode, toNode] = edge;\n let children = graph.get(toNode);\n if (children) {\n children.push(fromNode);\n }\n else {\n graph.set(toNode, [fromNode]);\n }\n }\n // Recursively visit the node.\n function visit(node) {\n if (visited.has(node)) {\n return;\n }\n visited.add(node);\n let children = graph.get(node);\n if (children) {\n for (const child of children) {\n visit(child);\n }\n }\n sorted.push(node);\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Iterate over an iterable using a stepped increment.\n *\n * @param object - The iterable object of interest.\n *\n * @param step - The distance to step on each iteration. A value\n * of less than `1` will behave the same as a value of `1`.\n *\n * @returns An iterator which traverses the iterable step-wise.\n *\n * #### Example\n * ```typescript\n * import { stride } from '@lumino/algorithm';\n *\n * let data = [1, 2, 3, 4, 5, 6];\n *\n * let stream = stride(data, 2);\n *\n * Array.from(stream); // [1, 3, 5];\n * ```\n */\nfunction* stride(object, step) {\n let count = 0;\n for (const value of object) {\n if (0 === count++ % step) {\n yield value;\n }\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * The namespace for string-specific algorithms.\n */\nvar StringExt;\n(function (StringExt) {\n /**\n * Find the indices of characters in a source text.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The matched indices, or `null` if there is no match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * In order for there to be a match, all of the characters in `query`\n * **must** appear in `source` in the order given by `query`.\n *\n * Characters are matched using strict `===` equality.\n */\n function findIndices(source, query, start = 0) {\n let indices = new Array(query.length);\n for (let i = 0, j = start, n = query.length; i < n; ++i, ++j) {\n j = source.indexOf(query[i], j);\n if (j === -1) {\n return null;\n }\n indices[i] = j;\n }\n return indices;\n }\n StringExt.findIndices = findIndices;\n /**\n * A string matcher which uses a sum-of-squares algorithm.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The match result, or `null` if there is no match.\n * A lower `score` represents a stronger match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * This scoring algorithm uses a sum-of-squares approach to determine\n * the score. In order for there to be a match, all of the characters\n * in `query` **must** appear in `source` in order. The index of each\n * matching character is squared and added to the score. This means\n * that early and consecutive character matches are preferred, while\n * late matches are heavily penalized.\n */\n function matchSumOfSquares(source, query, start = 0) {\n let indices = findIndices(source, query, start);\n if (!indices) {\n return null;\n }\n let score = 0;\n for (let i = 0, n = indices.length; i < n; ++i) {\n let j = indices[i] - start;\n score += j * j;\n }\n return { score, indices };\n }\n StringExt.matchSumOfSquares = matchSumOfSquares;\n /**\n * A string matcher which uses a sum-of-deltas algorithm.\n *\n * @param source - The source text which should be searched.\n *\n * @param query - The characters to locate in the source text.\n *\n * @param start - The index to start the search.\n *\n * @returns The match result, or `null` if there is no match.\n * A lower `score` represents a stronger match.\n *\n * #### Complexity\n * Linear on `sourceText`.\n *\n * #### Notes\n * This scoring algorithm uses a sum-of-deltas approach to determine\n * the score. In order for there to be a match, all of the characters\n * in `query` **must** appear in `source` in order. The delta between\n * the indices are summed to create the score. This means that groups\n * of matched characters are preferred, while fragmented matches are\n * penalized.\n */\n function matchSumOfDeltas(source, query, start = 0) {\n let indices = findIndices(source, query, start);\n if (!indices) {\n return null;\n }\n let score = 0;\n let last = start - 1;\n for (let i = 0, n = indices.length; i < n; ++i) {\n let j = indices[i];\n score += j - last - 1;\n last = j;\n }\n return { score, indices };\n }\n StringExt.matchSumOfDeltas = matchSumOfDeltas;\n /**\n * Highlight the matched characters of a source text.\n *\n * @param source - The text which should be highlighted.\n *\n * @param indices - The indices of the matched characters. They must\n * appear in increasing order and must be in bounds of the source.\n *\n * @param fn - The function to apply to the matched chunks.\n *\n * @returns An array of unmatched and highlighted chunks.\n */\n function highlight(source, indices, fn) {\n // Set up the result array.\n let result = [];\n // Set up the counter variables.\n let k = 0;\n let last = 0;\n let n = indices.length;\n // Iterator over each index.\n while (k < n) {\n // Set up the chunk indices.\n let i = indices[k];\n let j = indices[k];\n // Advance the right chunk index until it's non-contiguous.\n while (++k < n && indices[k] === j + 1) {\n j++;\n }\n // Extract the unmatched text.\n if (last < i) {\n result.push(source.slice(last, i));\n }\n // Extract and highlight the matched text.\n if (i < j + 1) {\n result.push(fn(source.slice(i, j + 1)));\n }\n // Update the last visited index.\n last = j + 1;\n }\n // Extract any remaining unmatched text.\n if (last < source.length) {\n result.push(source.slice(last));\n }\n // Return the highlighted result.\n return result;\n }\n StringExt.highlight = highlight;\n /**\n * A 3-way string comparison function.\n *\n * @param a - The first string of interest.\n *\n * @param b - The second string of interest.\n *\n * @returns `-1` if `a < b`, else `1` if `a > b`, else `0`.\n */\n function cmp(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n }\n StringExt.cmp = cmp;\n})(StringExt || (StringExt = {}));\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Take a fixed number of items from an iterable.\n *\n * @param object - The iterable object of interest.\n *\n * @param count - The number of items to take from the iterable.\n *\n * @returns An iterator which yields the specified number of items\n * from the source iterable.\n *\n * #### Notes\n * The returned iterator will exhaust early if the source iterable\n * contains an insufficient number of items.\n *\n * #### Example\n * ```typescript\n * import { take } from '@lumino/algorithm';\n *\n * let stream = take([5, 4, 3, 2, 1, 0, -1], 3);\n *\n * Array.from(stream); // [5, 4, 3]\n * ```\n */\nfunction* take(object, count) {\n if (count < 1) {\n return;\n }\n const it = object[Symbol.iterator]();\n let item;\n while (0 < count-- && !(item = it.next()).done) {\n yield item.value;\n }\n}\n\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n/**\n * Iterate several iterables in lockstep.\n *\n * @param objects - The iterable objects of interest.\n *\n * @returns An iterator which yields successive tuples of values where\n * each value is taken in turn from the provided iterables. It will\n * be as long as the shortest provided iterable.\n *\n * #### Example\n * ```typescript\n * import { zip } from '@lumino/algorithm';\n *\n * let data1 = [1, 2, 3];\n * let data2 = [4, 5, 6];\n *\n * let stream = zip(data1, data2);\n *\n * Array.from(stream); // [[1, 4], [2, 5], [3, 6]]\n * ```\n */\nfunction* zip(...objects) {\n const iters = objects.map(obj => obj[Symbol.iterator]());\n let tuple = iters.map(it => it.next());\n for (; every(tuple, item => !item.done); tuple = iters.map(it => it.next())) {\n yield tuple.map(item => item.value);\n }\n}\n\nexport { ArrayExt, StringExt, chain, each, empty, enumerate, every, filter, find, findIndex, map, max, min, minmax, once, range, reduce, repeat, retro, some, stride, take, toArray, toObject, topologicSort, zip };\n//# sourceMappingURL=index.es6.js.map\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport * as nbformat from '@jupyterlab/nbformat';\nimport { ObservableList } from '@jupyterlab/observables';\nimport { OutputModel } from '@jupyterlab/rendermime';\nimport { map } from '@lumino/algorithm';\nimport { JSONExt } from '@lumino/coreutils';\nimport { Signal } from '@lumino/signaling';\n/**\n * The default implementation of the IOutputAreaModel.\n */\nexport class OutputAreaModel {\n /**\n * Construct a new observable outputs instance.\n */\n constructor(options = {}) {\n /**\n * A flag that is set when we want to clear the output area\n * *after* the next addition to it.\n */\n this.clearNext = false;\n this._lastStream = '';\n this._trusted = false;\n this._isDisposed = false;\n this._stateChanged = new Signal(this);\n this._changed = new Signal(this);\n this._trusted = !!options.trusted;\n this.contentFactory =\n options.contentFactory || OutputAreaModel.defaultContentFactory;\n this.list = new ObservableList();\n if (options.values) {\n for (const value of options.values) {\n const index = this._add(value) - 1;\n const item = this.list.get(index);\n item.changed.connect(this._onGenericChange, this);\n }\n }\n this.list.changed.connect(this._onListChanged, this);\n }\n /**\n * A signal emitted when an item changes.\n */\n get stateChanged() {\n return this._stateChanged;\n }\n /**\n * A signal emitted when the list of items changes.\n */\n get changed() {\n return this._changed;\n }\n /**\n * Get the length of the items in the model.\n */\n get length() {\n return this.list ? this.list.length : 0;\n }\n /**\n * Get whether the model is trusted.\n */\n get trusted() {\n return this._trusted;\n }\n /**\n * Set whether the model is trusted.\n *\n * #### Notes\n * Changing the value will cause all of the models to re-set.\n */\n set trusted(value) {\n if (value === this._trusted) {\n return;\n }\n const trusted = (this._trusted = value);\n for (let i = 0; i < this.list.length; i++) {\n const oldItem = this.list.get(i);\n const value = oldItem.toJSON();\n const item = this._createItem({ value, trusted });\n this.list.set(i, item);\n oldItem.dispose();\n }\n }\n /**\n * Test whether the model is disposed.\n */\n get isDisposed() {\n return this._isDisposed;\n }\n /**\n * Dispose of the resources used by the model.\n */\n dispose() {\n if (this.isDisposed) {\n return;\n }\n this._isDisposed = true;\n this.list.dispose();\n Signal.clearData(this);\n }\n /**\n * Get an item at the specified index.\n */\n get(index) {\n return this.list.get(index);\n }\n /**\n * Set the value at the specified index.\n */\n set(index, value) {\n value = JSONExt.deepCopy(value);\n // Normalize stream data.\n Private.normalize(value);\n const item = this._createItem({ value, trusted: this._trusted });\n this.list.set(index, item);\n }\n /**\n * Add an output, which may be combined with previous output.\n *\n * @returns The total number of outputs.\n *\n * #### Notes\n * The output bundle is copied.\n * Contiguous stream outputs of the same `name` are combined.\n */\n add(output) {\n // If we received a delayed clear message, then clear now.\n if (this.clearNext) {\n this.clear();\n this.clearNext = false;\n }\n return this._add(output);\n }\n /**\n * Clear all of the output.\n *\n * @param wait Delay clearing the output until the next message is added.\n */\n clear(wait = false) {\n this._lastStream = '';\n if (wait) {\n this.clearNext = true;\n return;\n }\n for (const item of this.list) {\n item.dispose();\n }\n this.list.clear();\n }\n /**\n * Deserialize the model from JSON.\n *\n * #### Notes\n * This will clear any existing data.\n */\n fromJSON(values) {\n this.clear();\n for (const value of values) {\n this._add(value);\n }\n }\n /**\n * Serialize the model to JSON.\n */\n toJSON() {\n return Array.from(map(this.list, (output) => output.toJSON()));\n }\n /**\n * Add a copy of the item to the list.\n *\n * @returns The list length\n */\n _add(value) {\n const trusted = this._trusted;\n value = JSONExt.deepCopy(value);\n // Normalize the value.\n Private.normalize(value);\n // Consolidate outputs if they are stream outputs of the same kind.\n if (nbformat.isStream(value) &&\n this._lastStream &&\n value.name === this._lastName &&\n this.shouldCombine({\n value,\n lastModel: this.list.get(this.length - 1)\n })) {\n // In order to get a list change event, we add the previous\n // text to the current item and replace the previous item.\n // This also replaces the metadata of the last item.\n this._lastStream += value.text;\n this._lastStream = Private.removeOverwrittenChars(this._lastStream);\n value.text = this._lastStream;\n const item = this._createItem({ value, trusted });\n const index = this.length - 1;\n const prev = this.list.get(index);\n this.list.set(index, item);\n prev.dispose();\n return this.length;\n }\n if (nbformat.isStream(value)) {\n value.text = Private.removeOverwrittenChars(value.text);\n }\n // Create the new item.\n const item = this._createItem({ value, trusted });\n // Update the stream information.\n if (nbformat.isStream(value)) {\n this._lastStream = value.text;\n this._lastName = value.name;\n }\n else {\n this._lastStream = '';\n }\n // Add the item to our list and return the new length.\n return this.list.push(item);\n }\n /**\n * Whether a new value should be consolidated with the previous output.\n *\n * This will only be called if the minimal criteria of both being stream\n * messages of the same type.\n */\n shouldCombine(options) {\n return true;\n }\n /**\n * Create an output item and hook up its signals.\n */\n _createItem(options) {\n const factory = this.contentFactory;\n const item = factory.createOutputModel(options);\n return item;\n }\n /**\n * Handle a change to the list.\n */\n _onListChanged(sender, args) {\n switch (args.type) {\n case 'add':\n args.newValues.forEach(item => {\n item.changed.connect(this._onGenericChange, this);\n });\n break;\n case 'remove':\n args.oldValues.forEach(item => {\n item.changed.disconnect(this._onGenericChange, this);\n });\n break;\n case 'set':\n args.newValues.forEach(item => {\n item.changed.connect(this._onGenericChange, this);\n });\n args.oldValues.forEach(item => {\n item.changed.disconnect(this._onGenericChange, this);\n });\n break;\n }\n this._changed.emit(args);\n }\n /**\n * Handle a change to an item.\n */\n _onGenericChange(itemModel) {\n let idx;\n let item = null;\n for (idx = 0; idx < this.list.length; idx++) {\n item = this.list.get(idx);\n if (item === itemModel) {\n break;\n }\n }\n if (item != null) {\n this._stateChanged.emit(idx);\n this._changed.emit({\n type: 'set',\n newIndex: idx,\n oldIndex: idx,\n oldValues: [item],\n newValues: [item]\n });\n }\n }\n}\n/**\n * The namespace for OutputAreaModel class statics.\n */\n(function (OutputAreaModel) {\n /**\n * The default implementation of a `IModelOutputFactory`.\n */\n class ContentFactory {\n /**\n * Create an output model.\n */\n createOutputModel(options) {\n return new OutputModel(options);\n }\n }\n OutputAreaModel.ContentFactory = ContentFactory;\n /**\n * The default output model factory.\n */\n OutputAreaModel.defaultContentFactory = new ContentFactory();\n})(OutputAreaModel || (OutputAreaModel = {}));\n/**\n * A namespace for module-private functionality.\n */\nvar Private;\n(function (Private) {\n /**\n * Normalize an output.\n */\n function normalize(value) {\n if (nbformat.isStream(value)) {\n if (Array.isArray(value.text)) {\n value.text = value.text.join('\\n');\n }\n }\n }\n Private.normalize = normalize;\n /**\n * Remove characters that are overridden by backspace characters.\n */\n function fixBackspace(txt) {\n let tmp = txt;\n do {\n txt = tmp;\n // Cancel out anything-but-newline followed by backspace\n tmp = txt.replace(/[^\\n]\\x08/gm, ''); // eslint-disable-line no-control-regex\n } while (tmp.length < txt.length);\n return txt;\n }\n /**\n * Remove chunks that should be overridden by the effect of\n * carriage return characters.\n */\n function fixCarriageReturn(txt) {\n txt = txt.replace(/\\r+\\n/gm, '\\n'); // \\r followed by \\n --> newline\n while (txt.search(/\\r[^$]/g) > -1) {\n const base = txt.match(/^(.*)\\r+/m)[1];\n let insert = txt.match(/\\r+(.*)$/m)[1];\n insert = insert + base.slice(insert.length, base.length);\n txt = txt.replace(/\\r+.*$/m, '\\r').replace(/^.*\\r/m, insert);\n }\n return txt;\n }\n /*\n * Remove characters overridden by backspaces and carriage returns\n */\n function removeOverwrittenChars(text) {\n return fixCarriageReturn(fixBackspace(text));\n }\n Private.removeOverwrittenChars = removeOverwrittenChars;\n})(Private || (Private = {}));\n//# sourceMappingURL=model.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { JSONExt } from '@lumino/coreutils';\nimport { Message } from '@lumino/messaging';\nimport { ObservableMap } from './observablemap';\n/**\n * A concrete Observable map for JSON data.\n */\nexport class ObservableJSON extends ObservableMap {\n /**\n * Construct a new observable JSON object.\n */\n constructor(options = {}) {\n super({\n itemCmp: JSONExt.deepEqual,\n values: options.values\n });\n }\n /**\n * Serialize the model to JSON.\n */\n toJSON() {\n const out = Object.create(null);\n const keys = this.keys();\n for (const key of keys) {\n const value = this.get(key);\n if (value !== undefined) {\n out[key] = JSONExt.deepCopy(value);\n }\n }\n return out;\n }\n}\n/**\n * The namespace for ObservableJSON static data.\n */\n(function (ObservableJSON) {\n /**\n * An observable JSON change message.\n */\n class ChangeMessage extends Message {\n /**\n * Create a new metadata changed message.\n */\n constructor(type, args) {\n super(type);\n this.args = args;\n }\n }\n ObservableJSON.ChangeMessage = ChangeMessage;\n})(ObservableJSON || (ObservableJSON = {}));\n//# sourceMappingURL=observablejson.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { RestorablePool } from '@jupyterlab/statedb';\nimport { Signal } from '@lumino/signaling';\nimport { FocusTracker } from '@lumino/widgets';\n/**\n * A class that keeps track of widget instances on an Application shell.\n *\n * @typeparam T - The type of widget being tracked. Defaults to `Widget`.\n *\n * #### Notes\n * The API surface area of this concrete implementation is substantially larger\n * than the widget tracker interface it implements. The interface is intended\n * for export by JupyterLab plugins that create widgets and have clients who may\n * wish to keep track of newly created widgets. This class, however, can be used\n * internally by plugins to restore state as well.\n */\nexport class WidgetTracker {\n /**\n * Create a new widget tracker.\n *\n * @param options - The instantiation options for a widget tracker.\n */\n constructor(options) {\n this._currentChanged = new Signal(this);\n this._deferred = null;\n this._isDisposed = false;\n this._widgetAdded = new Signal(this);\n this._widgetUpdated = new Signal(this);\n const focus = (this._focusTracker = new FocusTracker());\n const pool = (this._pool = new RestorablePool(options));\n this.namespace = options.namespace;\n focus.currentChanged.connect((_, current) => {\n if (current.newValue !== this.currentWidget) {\n pool.current = current.newValue;\n }\n }, this);\n pool.added.connect((_, widget) => {\n this._widgetAdded.emit(widget);\n }, this);\n pool.currentChanged.connect((_, widget) => {\n // If the pool's current reference is `null` but the focus tracker has a\n // current widget, update the pool to match the focus tracker.\n if (widget === null && focus.currentWidget) {\n pool.current = focus.currentWidget;\n return;\n }\n this.onCurrentChanged(widget);\n this._currentChanged.emit(widget);\n }, this);\n pool.updated.connect((_, widget) => {\n this._widgetUpdated.emit(widget);\n }, this);\n }\n /**\n * A signal emitted when the current widget changes.\n */\n get currentChanged() {\n return this._currentChanged;\n }\n /**\n * The current widget is the most recently focused or added widget.\n *\n * #### Notes\n * It is the most recently focused widget, or the most recently added\n * widget if no widget has taken focus.\n */\n get currentWidget() {\n return this._pool.current || null;\n }\n /**\n * A promise resolved when the tracker has been restored.\n */\n get restored() {\n if (this._deferred) {\n return Promise.resolve();\n }\n else {\n return this._pool.restored;\n }\n }\n /**\n * The number of widgets held by the tracker.\n */\n get size() {\n return this._pool.size;\n }\n /**\n * A signal emitted when a widget is added.\n *\n * #### Notes\n * This signal will only fire when a widget is added to the tracker. It will\n * not fire if a widget is injected into the tracker.\n */\n get widgetAdded() {\n return this._widgetAdded;\n }\n /**\n * A signal emitted when a widget is updated.\n */\n get widgetUpdated() {\n return this._widgetUpdated;\n }\n /**\n * Add a new widget to the tracker.\n *\n * @param widget - The widget being added.\n *\n * #### Notes\n * The widget passed into the tracker is added synchronously; its existence in\n * the tracker can be checked with the `has()` method. The promise this method\n * returns resolves after the widget has been added and saved to an underlying\n * restoration connector, if one is available.\n *\n * The newly added widget becomes the current widget unless the focus tracker\n * already had a focused widget.\n */\n async add(widget) {\n this._focusTracker.add(widget);\n await this._pool.add(widget);\n if (!this._focusTracker.activeWidget) {\n this._pool.current = widget;\n }\n }\n /**\n * Test whether the tracker is disposed.\n */\n get isDisposed() {\n return this._isDisposed;\n }\n /**\n * Dispose of the resources held by the tracker.\n */\n dispose() {\n if (this.isDisposed) {\n return;\n }\n this._isDisposed = true;\n this._pool.dispose();\n this._focusTracker.dispose();\n Signal.clearData(this);\n }\n /**\n * Find the first widget in the tracker that satisfies a filter function.\n *\n * @param fn The filter function to call on each widget.\n *\n * #### Notes\n * If no widget is found, the value returned is `undefined`.\n */\n find(fn) {\n return this._pool.find(fn);\n }\n /**\n * Iterate through each widget in the tracker.\n *\n * @param fn - The function to call on each widget.\n */\n forEach(fn) {\n return this._pool.forEach(fn);\n }\n /**\n * Filter the widgets in the tracker based on a predicate.\n *\n * @param fn - The function by which to filter.\n */\n filter(fn) {\n return this._pool.filter(fn);\n }\n /**\n * Inject a foreign widget into the widget tracker.\n *\n * @param widget - The widget to inject into the tracker.\n *\n * #### Notes\n * Injected widgets will not have their state saved by the tracker.\n *\n * The primary use case for widget injection is for a plugin that offers a\n * sub-class of an extant plugin to have its instances share the same commands\n * as the parent plugin (since most relevant commands will use the\n * `currentWidget` of the parent plugin's widget tracker). In this situation,\n * the sub-class plugin may well have its own widget tracker for layout and\n * state restoration in addition to injecting its widgets into the parent\n * plugin's widget tracker.\n */\n inject(widget) {\n return this._pool.inject(widget);\n }\n /**\n * Check if this tracker has the specified widget.\n *\n * @param widget - The widget whose existence is being checked.\n */\n has(widget) {\n return this._pool.has(widget);\n }\n /**\n * Restore the widgets in this tracker's namespace.\n *\n * @param options - The configuration options that describe restoration.\n *\n * @returns A promise that resolves when restoration has completed.\n *\n * #### Notes\n * This function should not typically be invoked by client code.\n * Its primary use case is to be invoked by a restorer.\n */\n async restore(options) {\n const deferred = this._deferred;\n if (deferred) {\n this._deferred = null;\n return this._pool.restore(deferred);\n }\n if (options) {\n return this._pool.restore(options);\n }\n console.warn('No options provided to restore the tracker.');\n }\n /**\n * Save the restore options for this tracker, but do not restore yet.\n *\n * @param options - The configuration options that describe restoration.\n *\n * ### Notes\n * This function is useful when starting the shell in 'single-document' mode,\n * to avoid restoring all useless widgets. It should not ordinarily be called\n * by client code.\n */\n defer(options) {\n this._deferred = options;\n }\n /**\n * Save the restore data for a given widget.\n *\n * @param widget - The widget being saved.\n */\n async save(widget) {\n return this._pool.save(widget);\n }\n /**\n * Handle the current change event.\n *\n * #### Notes\n * The default implementation is a no-op.\n */\n onCurrentChanged(value) {\n /* no-op */\n }\n}\n//# sourceMappingURL=widgettracker.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { WidgetTracker } from '@jupyterlab/apputils';\nimport { KernelMessage } from '@jupyterlab/services';\nimport { nullTranslator } from '@jupyterlab/translation';\nimport { PromiseDelegate, UUID } from '@lumino/coreutils';\nimport { AttachedProperty } from '@lumino/properties';\nimport { Signal } from '@lumino/signaling';\nimport { Panel, PanelLayout, Widget } from '@lumino/widgets';\n/**\n * The class name added to an output area widget.\n */\nconst OUTPUT_AREA_CLASS = 'jp-OutputArea';\n/**\n * The class name added to the direction children of OutputArea\n */\nconst OUTPUT_AREA_ITEM_CLASS = 'jp-OutputArea-child';\n/**\n * The class name added to actual outputs\n */\nconst OUTPUT_AREA_OUTPUT_CLASS = 'jp-OutputArea-output';\n/**\n * The class name added to prompt children of OutputArea.\n */\nconst OUTPUT_AREA_PROMPT_CLASS = 'jp-OutputArea-prompt';\nconst OUTPUT_AREA_STDIN_HIDING_CLASS = 'jp-OutputArea-stdin-hiding';\n/**\n * The class name added to OutputPrompt.\n */\nconst OUTPUT_PROMPT_CLASS = 'jp-OutputPrompt';\n/**\n * The class name added to an execution result.\n */\nconst EXECUTE_CLASS = 'jp-OutputArea-executeResult';\n/**\n * The class name added stdin items of OutputArea\n */\nconst OUTPUT_AREA_STDIN_ITEM_CLASS = 'jp-OutputArea-stdin-item';\n/**\n * The class name added to stdin widgets.\n */\nconst STDIN_CLASS = 'jp-Stdin';\n/**\n * The class name added to stdin data prompt nodes.\n */\nconst STDIN_PROMPT_CLASS = 'jp-Stdin-prompt';\n/**\n * The class name added to stdin data input nodes.\n */\nconst STDIN_INPUT_CLASS = 'jp-Stdin-input';\n/**\n * The overlay that can be clicked to switch between output scrolling modes.\n */\nconst OUTPUT_PROMPT_OVERLAY = 'jp-OutputArea-promptOverlay';\n/** ****************************************************************************\n * OutputArea\n ******************************************************************************/\n/**\n * An output area widget.\n *\n * #### Notes\n * The widget model must be set separately and can be changed\n * at any time. Consumers of the widget must account for a\n * `null` model, and may want to listen to the `modelChanged`\n * signal.\n */\nexport class OutputArea extends Widget {\n /**\n * Construct an output area widget.\n */\n constructor(options) {\n var _a, _b, _c, _d;\n super();\n /**\n * A public signal used to indicate the number of displayed outputs has changed.\n *\n * #### Notes\n * This is useful for parents who want to apply styling based on the number\n * of outputs. Emits the current number of outputs.\n */\n this.outputLengthChanged = new Signal(this);\n /**\n * Handle an iopub message.\n */\n this._onIOPub = (msg) => {\n const model = this.model;\n const msgType = msg.header.msg_type;\n let output;\n const transient = (msg.content.transient || {});\n const displayId = transient['display_id'];\n let targets;\n switch (msgType) {\n case 'execute_result':\n case 'display_data':\n case 'stream':\n case 'error':\n output = { ...msg.content, output_type: msgType };\n model.add(output);\n break;\n case 'clear_output': {\n const wait = msg.content.wait;\n model.clear(wait);\n break;\n }\n case 'update_display_data':\n output = { ...msg.content, output_type: 'display_data' };\n targets = this._displayIdMap.get(displayId);\n if (targets) {\n for (const index of targets) {\n model.set(index, output);\n }\n }\n break;\n case 'status': {\n const executionState = msg.content\n .execution_state;\n if (executionState === 'idle') {\n // If status is idle, the kernel is no longer blocked by the input\n this._pendingInput = false;\n }\n break;\n }\n default:\n break;\n }\n if (displayId && msgType === 'display_data') {\n targets = this._displayIdMap.get(displayId) || [];\n targets.push(model.length - 1);\n this._displayIdMap.set(displayId, targets);\n }\n };\n /**\n * Handle an execute reply message.\n */\n this._onExecuteReply = (msg) => {\n // API responses that contain a pager are special cased and their type\n // is overridden from 'execute_reply' to 'display_data' in order to\n // render output.\n const model = this.model;\n const content = msg.content;\n if (content.status !== 'ok') {\n return;\n }\n const payload = content && content.payload;\n if (!payload || !payload.length) {\n return;\n }\n const pages = payload.filter((i) => i.source === 'page');\n if (!pages.length) {\n return;\n }\n const page = JSON.parse(JSON.stringify(pages[0]));\n const output = {\n output_type: 'display_data',\n data: page.data,\n metadata: {}\n };\n model.add(output);\n };\n this._displayIdMap = new Map();\n this._minHeightTimeout = null;\n this._inputRequested = new Signal(this);\n this._toggleScrolling = new Signal(this);\n this._initialize = new Signal(this);\n this._outputTracker = new WidgetTracker({\n namespace: UUID.uuid4()\n });\n this._inputHistoryScope = 'global';\n this._pendingInput = false;\n super.layout = new PanelLayout();\n this.addClass(OUTPUT_AREA_CLASS);\n this.contentFactory =\n (_a = options.contentFactory) !== null && _a !== void 0 ? _a : OutputArea.defaultContentFactory;\n this.rendermime = options.rendermime;\n this._maxNumberOutputs = (_b = options.maxNumberOutputs) !== null && _b !== void 0 ? _b : Infinity;\n this._translator = (_c = options.translator) !== null && _c !== void 0 ? _c : nullTranslator;\n this._inputHistoryScope = (_d = options.inputHistoryScope) !== null && _d !== void 0 ? _d : 'global';\n const model = (this.model = options.model);\n for (let i = 0; i < Math.min(model.length, this._maxNumberOutputs + 1); i++) {\n const output = model.get(i);\n this._insertOutput(i, output);\n }\n model.changed.connect(this.onModelChanged, this);\n model.stateChanged.connect(this.onStateChanged, this);\n if (options.promptOverlay) {\n this._addPromptOverlay();\n }\n }\n /**\n * Narrow the type of OutputArea's layout prop\n */\n get layout() {\n return super.layout;\n }\n /**\n * A read-only sequence of the children widgets in the output area.\n */\n get widgets() {\n return this.layout.widgets;\n }\n /**\n * The kernel future associated with the output area.\n */\n get future() {\n return this._future;\n }\n set future(value) {\n // Bail if the model is disposed.\n if (this.model.isDisposed) {\n throw Error('Model is disposed');\n }\n if (this._future === value) {\n return;\n }\n if (this._future) {\n this._future.dispose();\n }\n this._future = value;\n value.done\n .finally(() => {\n this._pendingInput = false;\n })\n .catch(() => {\n // No-op, required because `finally` re-raises any rejections,\n // even if caught on the `done` promise level before.\n });\n this.model.clear();\n // Make sure there were no input widgets.\n if (this.widgets.length) {\n this._clear();\n this.outputLengthChanged.emit(Math.min(this.model.length, this._maxNumberOutputs));\n }\n // Handle published messages.\n value.onIOPub = this._onIOPub;\n // Handle the execute reply.\n value.onReply = this._onExecuteReply;\n // Handle stdin.\n value.onStdin = msg => {\n if (KernelMessage.isInputRequestMsg(msg)) {\n this.onInputRequest(msg, value);\n }\n };\n }\n /**\n * Signal emitted when an output area is requesting an input. The signal\n * carries the input widget that this class creates in response to the input\n * request.\n */\n get inputRequested() {\n return this._inputRequested;\n }\n /**\n * A flag indicating if the output area has pending input.\n */\n get pendingInput() {\n return this._pendingInput;\n }\n /**\n * The maximum number of output items to display on top and bottom of cell output.\n *\n * ### Notes\n * It is set to Infinity if no trim is applied.\n */\n get maxNumberOutputs() {\n return this._maxNumberOutputs;\n }\n set maxNumberOutputs(limit) {\n if (limit <= 0) {\n console.warn(`OutputArea.maxNumberOutputs must be strictly positive.`);\n return;\n }\n const lastShown = this._maxNumberOutputs;\n this._maxNumberOutputs = limit;\n if (lastShown < limit) {\n this._showTrimmedOutputs(lastShown);\n }\n }\n /**\n * Dispose of the resources used by the output area.\n */\n dispose() {\n if (this._future) {\n this._future.dispose();\n this._future = null;\n }\n this._displayIdMap.clear();\n this._outputTracker.dispose();\n super.dispose();\n }\n /**\n * Follow changes on the model state.\n */\n onModelChanged(sender, args) {\n switch (args.type) {\n case 'add':\n this._insertOutput(args.newIndex, args.newValues[0]);\n break;\n case 'remove':\n if (this.widgets.length) {\n // all items removed from model\n if (this.model.length === 0) {\n this._clear();\n }\n else {\n // range of items removed from model\n // remove widgets corresponding to removed model items\n const startIndex = args.oldIndex;\n for (let i = 0; i < args.oldValues.length && startIndex < this.widgets.length; ++i) {\n const widget = this.widgets[startIndex];\n widget.parent = null;\n widget.dispose();\n }\n // apply item offset to target model item indices in _displayIdMap\n this._moveDisplayIdIndices(startIndex, args.oldValues.length);\n // prevent jitter caused by immediate height change\n this._preventHeightChangeJitter();\n }\n }\n break;\n case 'set':\n this._setOutput(args.newIndex, args.newValues[0]);\n break;\n default:\n break;\n }\n this.outputLengthChanged.emit(Math.min(this.model.length, this._maxNumberOutputs));\n }\n /**\n * Emitted when user requests toggling of the output scrolling mode.\n */\n get toggleScrolling() {\n return this._toggleScrolling;\n }\n get initialize() {\n return this._initialize;\n }\n /**\n * Add overlay allowing to toggle scrolling.\n */\n _addPromptOverlay() {\n const overlay = document.createElement('div');\n overlay.className = OUTPUT_PROMPT_OVERLAY;\n overlay.addEventListener('click', () => {\n this._toggleScrolling.emit();\n });\n this.node.appendChild(overlay);\n requestAnimationFrame(() => {\n this._initialize.emit();\n });\n }\n /**\n * Update indices in _displayIdMap in response to element remove from model items\n *\n * @param startIndex - The index of first element removed\n *\n * @param count - The number of elements removed from model items\n *\n */\n _moveDisplayIdIndices(startIndex, count) {\n this._displayIdMap.forEach((indices) => {\n const rangeEnd = startIndex + count;\n const numIndices = indices.length;\n // reverse loop in order to prevent removing element affecting the index\n for (let i = numIndices - 1; i >= 0; --i) {\n const index = indices[i];\n // remove model item indices in removed range\n if (index >= startIndex && index < rangeEnd) {\n indices.splice(i, 1);\n }\n else if (index >= rangeEnd) {\n // move model item indices that were larger than range end\n indices[i] -= count;\n }\n }\n });\n }\n /**\n * Follow changes on the output model state.\n */\n onStateChanged(sender, change) {\n const outputLength = Math.min(this.model.length, this._maxNumberOutputs);\n if (change) {\n if (change >= this._maxNumberOutputs) {\n // Bail early\n return;\n }\n this._setOutput(change, this.model.get(change));\n }\n else {\n for (let i = 0; i < outputLength; i++) {\n this._setOutput(i, this.model.get(i));\n }\n }\n this.outputLengthChanged.emit(outputLength);\n }\n /**\n * Clear the widget outputs.\n */\n _clear() {\n // Bail if there is no work to do.\n if (!this.widgets.length) {\n return;\n }\n // Remove all of our widgets.\n const length = this.widgets.length;\n for (let i = 0; i < length; i++) {\n const widget = this.widgets[0];\n widget.parent = null;\n widget.dispose();\n }\n // Clear the display id map.\n this._displayIdMap.clear();\n // prevent jitter caused by immediate height change\n this._preventHeightChangeJitter();\n }\n _preventHeightChangeJitter() {\n // When an output area is cleared and then quickly replaced with new\n // content (as happens with @interact in widgets, for example), the\n // quickly changing height can make the page jitter.\n // We introduce a small delay in the minimum height\n // to prevent this jitter.\n const rect = this.node.getBoundingClientRect();\n this.node.style.minHeight = `${rect.height}px`;\n if (this._minHeightTimeout) {\n window.clearTimeout(this._minHeightTimeout);\n }\n this._minHeightTimeout = window.setTimeout(() => {\n if (this.isDisposed) {\n return;\n }\n this.node.style.minHeight = '';\n }, 50);\n }\n /**\n * Handle an input request from a kernel.\n */\n onInputRequest(msg, future) {\n // Add an output widget to the end.\n const factory = this.contentFactory;\n const stdinPrompt = msg.content.prompt;\n const password = msg.content.password;\n const panel = new Panel();\n panel.addClass(OUTPUT_AREA_ITEM_CLASS);\n panel.addClass(OUTPUT_AREA_STDIN_ITEM_CLASS);\n const prompt = factory.createOutputPrompt();\n prompt.addClass(OUTPUT_AREA_PROMPT_CLASS);\n panel.addWidget(prompt);\n // Indicate that input is pending\n this._pendingInput = true;\n const input = factory.createStdin({\n parent_header: msg.header,\n prompt: stdinPrompt,\n password,\n future,\n translator: this._translator,\n inputHistoryScope: this._inputHistoryScope\n });\n input.addClass(OUTPUT_AREA_OUTPUT_CLASS);\n panel.addWidget(input);\n // Increase number of outputs to display the result up to the input request.\n if (this.model.length >= this.maxNumberOutputs) {\n this.maxNumberOutputs = this.model.length;\n }\n this._inputRequested.emit(input);\n // Get the input node to ensure focus after updating the model upon user reply.\n const inputNode = input.node.getElementsByTagName('input')[0];\n /**\n * Wait for the stdin to complete, add it to the model (so it persists)\n * and remove the stdin widget.\n */\n void input.value.then(value => {\n // Increase number of outputs to display the result of stdin if needed.\n if (this.model.length >= this.maxNumberOutputs) {\n this.maxNumberOutputs = this.model.length + 1;\n }\n panel.addClass(OUTPUT_AREA_STDIN_HIDING_CLASS);\n // Use stdin as the stream so it does not get combined with stdout.\n // Note: because it modifies DOM it may (will) shift focus away from the input node.\n this.model.add({\n output_type: 'stream',\n name: 'stdin',\n text: value + '\\n'\n });\n // Refocus the input node after it lost focus due to update of the model.\n inputNode.focus();\n // Indicate that input is no longer pending\n this._pendingInput = false;\n // Keep the input in view for a little while; this (along refocusing)\n // ensures that we can avoid the cell editor stealing the focus, and\n // leading to user inadvertently modifying editor content when executing\n // consecutive commands in short succession.\n window.setTimeout(() => {\n // Tack currently focused element to ensure that it remains on it\n // after disposal of the panel with the old input\n // (which modifies DOM and can lead to focus jump).\n const focusedElement = document.activeElement;\n // Dispose the old panel with no longer needed input box.\n panel.dispose();\n // Refocus the element that was focused before.\n if (focusedElement && focusedElement instanceof HTMLElement) {\n focusedElement.focus();\n }\n }, 500);\n });\n // Note: the `input.value` promise must be listened to before we attach the panel\n this.layout.addWidget(panel);\n }\n /**\n * Update an output in the layout in place.\n */\n _setOutput(index, model) {\n if (index >= this._maxNumberOutputs) {\n return;\n }\n const panel = this.layout.widgets[index];\n const renderer = (panel.widgets\n ? panel.widgets.filter(it => 'renderModel' in it).pop()\n : panel);\n // Check whether it is safe to reuse renderer:\n // - Preferred mime type has not changed\n // - Isolation has not changed\n const mimeType = this.rendermime.preferredMimeType(model.data, model.trusted ? 'any' : 'ensure');\n if (Private.currentPreferredMimetype.get(renderer) === mimeType &&\n OutputArea.isIsolated(mimeType, model.metadata) ===\n renderer instanceof Private.IsolatedRenderer) {\n void renderer.renderModel(model);\n }\n else {\n this.layout.widgets[index].dispose();\n this._insertOutput(index, model);\n }\n }\n /**\n * Render and insert a single output into the layout.\n *\n * @param index - The index of the output to be inserted.\n * @param model - The model of the output to be inserted.\n */\n _insertOutput(index, model) {\n if (index > this._maxNumberOutputs) {\n return;\n }\n const layout = this.layout;\n if (index === this._maxNumberOutputs) {\n const warning = new Private.TrimmedOutputs(this._maxNumberOutputs, () => {\n const lastShown = this._maxNumberOutputs;\n this._maxNumberOutputs = Infinity;\n this._showTrimmedOutputs(lastShown);\n });\n layout.insertWidget(index, this._wrappedOutput(warning));\n }\n else {\n let output = this.createOutputItem(model);\n if (output) {\n output.toggleClass(EXECUTE_CLASS, model.executionCount !== null);\n }\n else {\n output = new Widget();\n }\n if (!this._outputTracker.has(output)) {\n void this._outputTracker.add(output);\n }\n layout.insertWidget(index, output);\n }\n }\n /**\n * A widget tracker for individual output widgets in the output area.\n */\n get outputTracker() {\n return this._outputTracker;\n }\n /**\n * Dispose information message and show output models from the given\n * index to maxNumberOutputs\n *\n * @param lastShown Starting model index to insert.\n */\n _showTrimmedOutputs(lastShown) {\n // Dispose information widget\n this.widgets[lastShown].dispose();\n for (let idx = lastShown; idx < this.model.length; idx++) {\n this._insertOutput(idx, this.model.get(idx));\n }\n this.outputLengthChanged.emit(Math.min(this.model.length, this._maxNumberOutputs));\n }\n /**\n * Create an output item with a prompt and actual output\n *\n * @returns a rendered widget, or null if we cannot render\n * #### Notes\n */\n createOutputItem(model) {\n const output = this.createRenderedMimetype(model);\n if (!output) {\n return null;\n }\n return this._wrappedOutput(output, model.executionCount);\n }\n /**\n * Render a mimetype\n */\n createRenderedMimetype(model) {\n const mimeType = this.rendermime.preferredMimeType(model.data, model.trusted ? 'any' : 'ensure');\n if (!mimeType) {\n return null;\n }\n let output = this.rendermime.createRenderer(mimeType);\n const isolated = OutputArea.isIsolated(mimeType, model.metadata);\n if (isolated === true) {\n output = new Private.IsolatedRenderer(output);\n }\n Private.currentPreferredMimetype.set(output, mimeType);\n output.renderModel(model).catch(error => {\n // Manually append error message to output\n const pre = document.createElement('pre');\n const trans = this._translator.load('jupyterlab');\n pre.textContent = trans.__('Javascript Error: %1', error.message);\n output.node.appendChild(pre);\n // Remove mime-type-specific CSS classes\n output.node.className = 'lm-Widget jp-RenderedText';\n output.node.setAttribute('data-mime-type', 'application/vnd.jupyter.stderr');\n });\n return output;\n }\n /**\n * Wrap a output widget within a output panel\n *\n * @param output Output widget to wrap\n * @param executionCount Execution count\n * @returns The output panel\n */\n _wrappedOutput(output, executionCount = null) {\n const panel = new Private.OutputPanel();\n panel.addClass(OUTPUT_AREA_ITEM_CLASS);\n const prompt = this.contentFactory.createOutputPrompt();\n prompt.executionCount = executionCount;\n prompt.addClass(OUTPUT_AREA_PROMPT_CLASS);\n panel.addWidget(prompt);\n output.addClass(OUTPUT_AREA_OUTPUT_CLASS);\n panel.addWidget(output);\n return panel;\n }\n}\nexport class SimplifiedOutputArea extends OutputArea {\n /**\n * Handle an input request from a kernel by doing nothing.\n */\n onInputRequest(msg, future) {\n return;\n }\n /**\n * Create an output item without a prompt, just the output widgets\n */\n createOutputItem(model) {\n const output = this.createRenderedMimetype(model);\n if (!output) {\n return null;\n }\n const panel = new Private.OutputPanel();\n panel.addClass(OUTPUT_AREA_ITEM_CLASS);\n output.addClass(OUTPUT_AREA_OUTPUT_CLASS);\n panel.addWidget(output);\n return panel;\n }\n}\n/**\n * A namespace for OutputArea statics.\n */\n(function (OutputArea) {\n /**\n * Execute code on an output area.\n */\n async function execute(code, output, sessionContext, metadata) {\n var _a;\n // Override the default for `stop_on_error`.\n let stopOnError = true;\n if (metadata &&\n Array.isArray(metadata.tags) &&\n metadata.tags.indexOf('raises-exception') !== -1) {\n stopOnError = false;\n }\n const content = {\n code,\n stop_on_error: stopOnError\n };\n const kernel = (_a = sessionContext.session) === null || _a === void 0 ? void 0 : _a.kernel;\n if (!kernel) {\n throw new Error('Session has no kernel.');\n }\n const future = kernel.requestExecute(content, false, metadata);\n output.future = future;\n return future.done;\n }\n OutputArea.execute = execute;\n function isIsolated(mimeType, metadata) {\n const mimeMd = metadata[mimeType];\n // mime-specific higher priority\n if (mimeMd && mimeMd['isolated'] !== undefined) {\n return !!mimeMd['isolated'];\n }\n else {\n // fallback on global\n return !!metadata['isolated'];\n }\n }\n OutputArea.isIsolated = isIsolated;\n /**\n * The default implementation of `IContentFactory`.\n */\n class ContentFactory {\n /**\n * Create the output prompt for the widget.\n */\n createOutputPrompt() {\n return new OutputPrompt();\n }\n /**\n * Create an stdin widget.\n */\n createStdin(options) {\n return new Stdin(options);\n }\n }\n OutputArea.ContentFactory = ContentFactory;\n /**\n * The default `ContentFactory` instance.\n */\n OutputArea.defaultContentFactory = new ContentFactory();\n})(OutputArea || (OutputArea = {}));\n/**\n * The default output prompt implementation\n */\nexport class OutputPrompt extends Widget {\n /*\n * Create an output prompt widget.\n */\n constructor() {\n super();\n this._executionCount = null;\n this.addClass(OUTPUT_PROMPT_CLASS);\n }\n /**\n * The execution count for the prompt.\n */\n get executionCount() {\n return this._executionCount;\n }\n set executionCount(value) {\n this._executionCount = value;\n if (value === null) {\n this.node.textContent = '';\n }\n else {\n this.node.textContent = `[${value}]:`;\n }\n }\n}\n/**\n * The default stdin widget.\n */\nexport class Stdin extends Widget {\n static _historyIx(key, ix) {\n const history = Stdin._history.get(key);\n if (!history) {\n return undefined;\n }\n const len = history.length;\n // wrap nonpositive ix to nonnegative ix\n if (ix <= 0) {\n return len + ix;\n }\n }\n static _historyAt(key, ix) {\n const history = Stdin._history.get(key);\n if (!history) {\n return undefined;\n }\n const len = history.length;\n const ixpos = Stdin._historyIx(key, ix);\n if (ixpos !== undefined && ixpos < len) {\n return history[ixpos];\n }\n // return undefined if ix is out of bounds\n }\n static _historyPush(key, line) {\n const history = Stdin._history.get(key);\n history.push(line);\n if (history.length > 1000) {\n // truncate line history if it's too long\n history.shift();\n }\n }\n static _historySearch(key, pat, ix, reverse = true) {\n const history = Stdin._history.get(key);\n const len = history.length;\n const ixpos = Stdin._historyIx(key, ix);\n const substrFound = (x) => x.search(pat) !== -1;\n if (ixpos === undefined) {\n return;\n }\n if (reverse) {\n if (ixpos === 0) {\n // reverse search fails if already at start of history\n return;\n }\n const ixFound = history.slice(0, ixpos).findLastIndex(substrFound);\n if (ixFound !== -1) {\n // wrap ix to negative\n return ixFound - len;\n }\n }\n else {\n if (ixpos >= len - 1) {\n // forward search fails if already at end of history\n return;\n }\n const ixFound = history.slice(ixpos + 1).findIndex(substrFound);\n if (ixFound !== -1) {\n // wrap ix to negative and adjust for slice\n return ixFound - len + ixpos + 1;\n }\n }\n }\n /**\n * Construct a new input widget.\n */\n constructor(options) {\n var _a;\n super({\n node: Private.createInputWidgetNode(options.prompt, options.password)\n });\n this._promise = new PromiseDelegate();\n this._resolved = false;\n this.addClass(STDIN_CLASS);\n this._future = options.future;\n this._historyIndex = 0;\n this._historyKey =\n options.inputHistoryScope === 'session'\n ? options.parent_header.session\n : '';\n this._historyPat = '';\n this._parentHeader = options.parent_header;\n this._password = options.password;\n this._trans = ((_a = options.translator) !== null && _a !== void 0 ? _a : nullTranslator).load('jupyterlab');\n this._value = options.prompt + ' ';\n this._input = this.node.getElementsByTagName('input')[0];\n // make users aware of the line history feature\n if (!this._password) {\n this._input.placeholder = this._trans.__('↑↓ for history. Search history with c-↑/c-↓');\n }\n else {\n this._input.placeholder = '';\n }\n // initialize line history\n if (!Stdin._history.has(this._historyKey)) {\n Stdin._history.set(this._historyKey, []);\n }\n }\n /**\n * The value of the widget.\n */\n get value() {\n return this._promise.promise.then(() => this._value);\n }\n /**\n * Handle the DOM events for the widget.\n *\n * @param event - The DOM event sent to the widget.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the dock panel's node. It should\n * not be called directly by user code.\n */\n handleEvent(event) {\n if (this._resolved) {\n // Do not handle any more key events if the promise was resolved.\n event.preventDefault();\n return;\n }\n const input = this._input;\n if (event.type === 'keydown') {\n if (event.key === 'Enter') {\n this.resetSearch();\n this._future.sendInputReply({\n status: 'ok',\n value: input.value\n }, this._parentHeader);\n if (this._password) {\n this._value += '········';\n }\n else {\n this._value += input.value;\n Stdin._historyPush(this._historyKey, input.value);\n }\n this._resolved = true;\n this._promise.resolve(void 0);\n }\n else if (event.key === 'Escape') {\n // currently this gets clobbered by the documentsearch:end command at the notebook level\n this.resetSearch();\n input.blur();\n }\n else if (event.ctrlKey &&\n (event.key === 'ArrowUp' || event.key === 'ArrowDown')) {\n // if _historyPat is blank, use input as search pattern. Otherwise, reuse the current search pattern\n if (this._historyPat === '') {\n this._historyPat = input.value;\n }\n const reverse = event.key === 'ArrowUp';\n const searchHistoryIx = Stdin._historySearch(this._historyKey, this._historyPat, this._historyIndex, reverse);\n if (searchHistoryIx !== undefined) {\n const historyLine = Stdin._historyAt(this._historyKey, searchHistoryIx);\n if (historyLine !== undefined) {\n if (this._historyIndex === 0) {\n this._valueCache = input.value;\n }\n this._setInputValue(historyLine);\n this._historyIndex = searchHistoryIx;\n // The default action for ArrowUp is moving to first character\n // but we want to keep the cursor at the end.\n event.preventDefault();\n }\n }\n }\n else if (event.key === 'ArrowUp') {\n this.resetSearch();\n const historyLine = Stdin._historyAt(this._historyKey, this._historyIndex - 1);\n if (historyLine) {\n if (this._historyIndex === 0) {\n this._valueCache = input.value;\n }\n this._setInputValue(historyLine);\n --this._historyIndex;\n // The default action for ArrowUp is moving to first character\n // but we want to keep the cursor at the end.\n event.preventDefault();\n }\n }\n else if (event.key === 'ArrowDown') {\n this.resetSearch();\n if (this._historyIndex === 0) {\n // do nothing\n }\n else if (this._historyIndex === -1) {\n this._setInputValue(this._valueCache);\n ++this._historyIndex;\n }\n else {\n const historyLine = Stdin._historyAt(this._historyKey, this._historyIndex + 1);\n if (historyLine) {\n this._setInputValue(historyLine);\n ++this._historyIndex;\n }\n }\n }\n }\n }\n resetSearch() {\n this._historyPat = '';\n }\n /**\n * Handle `after-attach` messages sent to the widget.\n */\n onAfterAttach(msg) {\n this._input.addEventListener('keydown', this);\n this._input.focus();\n }\n /**\n * Handle `before-detach` messages sent to the widget.\n */\n onBeforeDetach(msg) {\n this._input.removeEventListener('keydown', this);\n }\n _setInputValue(value) {\n this._input.value = value;\n // Set cursor at the end; this is usually not necessary when input is\n // focused but having the explicit placement ensures consistency.\n this._input.setSelectionRange(value.length, value.length);\n }\n}\nStdin._history = new Map();\n/** ****************************************************************************\n * Private namespace\n ******************************************************************************/\n/**\n * A namespace for private data.\n */\nvar Private;\n(function (Private) {\n /**\n * Create the node for an InputWidget.\n */\n function createInputWidgetNode(prompt, password) {\n const node = document.createElement('div');\n const promptNode = document.createElement('pre');\n promptNode.className = STDIN_PROMPT_CLASS;\n promptNode.textContent = prompt;\n const input = document.createElement('input');\n input.className = STDIN_INPUT_CLASS;\n if (password) {\n input.type = 'password';\n }\n node.appendChild(promptNode);\n promptNode.appendChild(input);\n return node;\n }\n Private.createInputWidgetNode = createInputWidgetNode;\n /**\n * A renderer for IFrame data.\n */\n class IsolatedRenderer extends Widget {\n /**\n * Create an isolated renderer.\n */\n constructor(wrapped) {\n super({ node: document.createElement('iframe') });\n this.addClass('jp-mod-isolated');\n this._wrapped = wrapped;\n // Once the iframe is loaded, the subarea is dynamically inserted\n const iframe = this.node;\n iframe.frameBorder = '0';\n iframe.scrolling = 'auto';\n iframe.addEventListener('load', () => {\n // Workaround needed by Firefox, to properly render svg inside\n // iframes, see https://stackoverflow.com/questions/10177190/\n // svg-dynamically-added-to-iframe-does-not-render-correctly\n iframe.contentDocument.open();\n // Insert the subarea into the iframe\n // We must directly write the html. At this point, subarea doesn't\n // contain any user content.\n iframe.contentDocument.write(this._wrapped.node.innerHTML);\n iframe.contentDocument.close();\n const body = iframe.contentDocument.body;\n // Adjust the iframe height automatically\n iframe.style.height = `${body.scrollHeight}px`;\n iframe.heightChangeObserver = new ResizeObserver(() => {\n iframe.style.height = `${body.scrollHeight}px`;\n });\n iframe.heightChangeObserver.observe(body);\n });\n }\n /**\n * Render a mime model.\n *\n * @param model - The mime model to render.\n *\n * @returns A promise which resolves when rendering is complete.\n *\n * #### Notes\n * This method may be called multiple times during the lifetime\n * of the widget to update it if and when new data is available.\n */\n renderModel(model) {\n return this._wrapped.renderModel(model);\n }\n }\n Private.IsolatedRenderer = IsolatedRenderer;\n Private.currentPreferredMimetype = new AttachedProperty({\n name: 'preferredMimetype',\n create: owner => ''\n });\n /**\n * A `Panel` that's focused by a `contextmenu` event.\n */\n class OutputPanel extends Panel {\n /**\n * Construct a new `OutputPanel` widget.\n */\n constructor(options) {\n super(options);\n }\n /**\n * A callback that focuses on the widget.\n */\n _onContext(_) {\n this.node.focus();\n }\n /**\n * Handle `after-attach` messages sent to the widget.\n */\n onAfterAttach(msg) {\n super.onAfterAttach(msg);\n this.node.addEventListener('contextmenu', this._onContext.bind(this));\n }\n /**\n * Handle `before-detach` messages sent to the widget.\n */\n onBeforeDetach(msg) {\n super.onAfterDetach(msg);\n this.node.removeEventListener('contextmenu', this._onContext.bind(this));\n }\n }\n Private.OutputPanel = OutputPanel;\n /**\n * Trimmed outputs information widget.\n */\n class TrimmedOutputs extends Widget {\n /**\n * Widget constructor\n *\n * ### Notes\n * The widget will be disposed on click after calling the callback.\n *\n * @param maxNumberOutputs Maximal number of outputs to display\n * @param _onClick Callback on click event on the widget\n */\n constructor(maxNumberOutputs, onClick) {\n const node = document.createElement('div');\n const title = `The first ${maxNumberOutputs} are displayed`;\n const msg = 'Show more outputs';\n node.insertAdjacentHTML('afterbegin', `\n
${msg}
\n
`);\n super({\n node\n });\n this._onClick = onClick;\n this.addClass('jp-TrimmedOutputs');\n this.addClass('jp-RenderedHTMLCommon');\n }\n /**\n * Handle the DOM events for widget.\n *\n * @param event - The DOM event sent to the widget.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the widget's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event) {\n if (event.type === 'click') {\n this._onClick(event);\n }\n }\n /**\n * Handle `after-attach` messages for the widget.\n */\n onAfterAttach(msg) {\n super.onAfterAttach(msg);\n this.node.addEventListener('click', this);\n }\n /**\n * A message handler invoked on a `'before-detach'`\n * message\n */\n onBeforeDetach(msg) {\n super.onBeforeDetach(msg);\n this.node.removeEventListener('click', this);\n }\n }\n Private.TrimmedOutputs = TrimmedOutputs;\n})(Private || (Private = {}));\n//# sourceMappingURL=widget.js.map","/* -----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\n// Some magic for deferring mathematical expressions to MathJax\n// by hiding them from the Markdown parser.\n// Some of the code here is adapted with permission from Davide Cervone\n// under the terms of the Apache2 license governing the MathJax project.\n// Other minor modifications are also due to StackExchange and are used with\n// permission.\nconst inline = '$'; // the inline math delimiter\n// MATHSPLIT contains the pattern for math delimiters and special symbols\n// needed for searching for math in the text input.\nconst MATHSPLIT = /(\\$\\$?|\\\\(?:begin|end)\\{[a-z]*\\*?\\}|\\\\[{}$]|[{}]|(?:\\n\\s*)+|@@\\d+@@|\\\\\\\\(?:\\(|\\)|\\[|\\]))/i;\n/**\n * Break up the text into its component parts and search\n * through them for math delimiters, braces, linebreaks, etc.\n * Math delimiters must match and braces must balance.\n * Don't allow math to pass through a double linebreak\n * (which will be a paragraph).\n */\nexport function removeMath(text) {\n const math = []; // stores math strings for later\n let start = null;\n let end = null;\n let last = null;\n let braces = 0;\n let deTilde;\n // Except for extreme edge cases, this should catch precisely those pieces of the markdown\n // source that will later be turned into code spans. While MathJax will not TeXify code spans,\n // we still have to consider them at this point; the following issue has happened several times:\n //\n // `$foo` and `$bar` are variables. --> $foo ` and `$bar are variables.\n const hasCodeSpans = text.includes('`') || text.includes('~~~');\n if (hasCodeSpans) {\n text = text\n .replace(/~/g, '~T')\n // note: the `fence` (three or more consecutive tildes or backticks)\n // can be followed by an `info string` but this cannot include backticks,\n // see specification: https://spec.commonmark.org/0.30/#info-string\n .replace(/^(?`{3,}|(~T){3,})[^`\\n]*\\n([\\s\\S]*?)^\\k`*$/gm, wholematch => wholematch.replace(/\\$/g, '~D'))\n .replace(/(^|[^\\\\])(`+)([^\\n]*?[^`\\n])\\2(?!`)/gm, wholematch => wholematch.replace(/\\$/g, '~D'));\n deTilde = (text) => {\n return text.replace(/~([TD])/g, (wholematch, character) => character === 'T' ? '~' : inline);\n };\n }\n else {\n deTilde = (text) => {\n return text;\n };\n }\n let blocks = text.replace(/\\r\\n?/g, '\\n').split(MATHSPLIT);\n for (let i = 1, m = blocks.length; i < m; i += 2) {\n const block = blocks[i];\n if (block.charAt(0) === '@') {\n //\n // Things that look like our math markers will get\n // stored and then retrieved along with the math.\n //\n blocks[i] = '@@' + math.length + '@@';\n math.push(block);\n }\n else if (start !== null) {\n //\n // If we are in math, look for the end delimiter,\n // but don't go past double line breaks, and\n // and balance braces within the math.\n //\n if (block === end) {\n if (braces) {\n last = i;\n }\n else {\n blocks = processMath(start, i, deTilde, math, blocks);\n start = null;\n end = null;\n last = null;\n }\n }\n else if (block.match(/\\n.*\\n/)) {\n if (last !== null) {\n i = last;\n blocks = processMath(start, i, deTilde, math, blocks);\n }\n start = null;\n end = null;\n last = null;\n braces = 0;\n }\n else if (block === '{') {\n braces++;\n }\n else if (block === '}' && braces) {\n braces--;\n }\n }\n else {\n //\n // Look for math start delimiters and when\n // found, set up the end delimiter.\n //\n if (block === inline || block === '$$') {\n start = i;\n end = block;\n braces = 0;\n }\n else if (block === '\\\\\\\\(' || block === '\\\\\\\\[') {\n start = i;\n end = block.slice(-1) === '(' ? '\\\\\\\\)' : '\\\\\\\\]';\n braces = 0;\n }\n else if (block.substr(1, 5) === 'begin') {\n start = i;\n end = '\\\\end' + block.substr(6);\n braces = 0;\n }\n }\n }\n if (start !== null && last !== null) {\n blocks = processMath(start, last, deTilde, math, blocks);\n start = null;\n end = null;\n last = null;\n }\n return { text: deTilde(blocks.join('')), math };\n}\n/**\n * Put back the math strings that were saved,\n * and clear the math array (no need to keep it around).\n */\nexport function replaceMath(text, math) {\n /**\n * Replace a math placeholder with its corresponding group.\n * The math delimiters \"\\\\(\", \"\\\\[\", \"\\\\)\" and \"\\\\]\" are replaced\n * removing one backslash in order to be interpreted correctly by MathJax.\n */\n const process = (match, n) => {\n let group = math[n];\n if (group.substr(0, 3) === '\\\\\\\\(' &&\n group.substr(group.length - 3) === '\\\\\\\\)') {\n group = '\\\\(' + group.substring(3, group.length - 3) + '\\\\)';\n }\n else if (group.substr(0, 3) === '\\\\\\\\[' &&\n group.substr(group.length - 3) === '\\\\\\\\]') {\n group = '\\\\[' + group.substring(3, group.length - 3) + '\\\\]';\n }\n return group;\n };\n // Replace all the math group placeholders in the text\n // with the saved strings.\n return text.replace(/@@(\\d+)@@/g, process);\n}\n/**\n * Process math blocks.\n *\n * The math is in blocks i through j, so\n * collect it into one block and clear the others.\n * Replace &, <, and > by named entities.\n * For IE, put
at the ends of comments since IE removes \\n.\n * Clear the current math positions and store the index of the\n * math, then push the math string onto the storage array.\n * The preProcess function is called on all blocks if it has been passed in\n */\nfunction processMath(i, j, preProcess, math, blocks) {\n let block = blocks\n .slice(i, j + 1)\n .join('')\n .replace(/&/g, '&') // use HTML entity for &\n .replace(//g, '>'); // use HTML entity for >\n if (navigator && navigator.appName === 'Microsoft Internet Explorer') {\n block = block.replace(/(%[^\\n]*)\\n/g, '$1
\\n');\n }\n while (j > i) {\n blocks[j] = '';\n j--;\n }\n blocks[i] = '@@' + math.length + '@@'; // replace the current block text with a unique tag to find later\n if (preProcess) {\n block = preProcess(block);\n }\n math.push(block);\n return blocks;\n}\n//# sourceMappingURL=latex.js.map","/* -----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\nimport { URLExt } from '@jupyterlab/coreutils';\nimport { nullTranslator } from '@jupyterlab/translation';\nimport escape from 'lodash.escape';\nimport { removeMath, replaceMath } from './latex';\n/**\n * Render HTML into a host node.\n *\n * @param options - The options for rendering.\n *\n * @returns A promise which resolves when rendering is complete.\n */\nexport function renderHTML(options) {\n // Unpack the options.\n let { host, source, trusted, sanitizer, resolver, linkHandler, shouldTypeset, latexTypesetter, translator } = options;\n translator = translator || nullTranslator;\n const trans = translator === null || translator === void 0 ? void 0 : translator.load('jupyterlab');\n let originalSource = source;\n // Bail early if the source is empty.\n if (!source) {\n host.textContent = '';\n return Promise.resolve(undefined);\n }\n // Sanitize the source if it is not trusted. This removes all\n // ``.\n this.sequenceIndex = Number(c === CharCodes.Lt);\n }\n };\n Tokenizer.prototype.stateCDATASequence = function (c) {\n if (c === Sequences.Cdata[this.sequenceIndex]) {\n if (++this.sequenceIndex === Sequences.Cdata.length) {\n this.state = State.InCommentLike;\n this.currentSequence = Sequences.CdataEnd;\n this.sequenceIndex = 0;\n this.sectionStart = this.index + 1;\n }\n }\n else {\n this.sequenceIndex = 0;\n this.state = State.InDeclaration;\n this.stateInDeclaration(c); // Reconsume the character\n }\n };\n /**\n * When we wait for one specific character, we can speed things up\n * by skipping through the buffer until we find it.\n *\n * @returns Whether the character was found.\n */\n Tokenizer.prototype.fastForwardTo = function (c) {\n while (++this.index < this.buffer.length + this.offset) {\n if (this.buffer.charCodeAt(this.index - this.offset) === c) {\n return true;\n }\n }\n /*\n * We increment the index at the end of the `parse` loop,\n * so set it to `buffer.length - 1` here.\n *\n * TODO: Refactor `parse` to increment index before calling states.\n */\n this.index = this.buffer.length + this.offset - 1;\n return false;\n };\n /**\n * Comments and CDATA end with `-->` and `]]>`.\n *\n * Their common qualities are:\n * - Their end sequences have a distinct character they start with.\n * - That character is then repeated, so we have to check multiple repeats.\n * - All characters but the start character of the sequence can be skipped.\n */\n Tokenizer.prototype.stateInCommentLike = function (c) {\n if (c === this.currentSequence[this.sequenceIndex]) {\n if (++this.sequenceIndex === this.currentSequence.length) {\n if (this.currentSequence === Sequences.CdataEnd) {\n this.cbs.oncdata(this.sectionStart, this.index, 2);\n }\n else {\n this.cbs.oncomment(this.sectionStart, this.index, 2);\n }\n this.sequenceIndex = 0;\n this.sectionStart = this.index + 1;\n this.state = State.Text;\n }\n }\n else if (this.sequenceIndex === 0) {\n // Fast-forward to the first character of the sequence\n if (this.fastForwardTo(this.currentSequence[0])) {\n this.sequenceIndex = 1;\n }\n }\n else if (c !== this.currentSequence[this.sequenceIndex - 1]) {\n // Allow long sequences, eg. --->, ]]]>\n this.sequenceIndex = 0;\n }\n };\n /**\n * HTML only allows ASCII alpha characters (a-z and A-Z) at the beginning of a tag name.\n *\n * XML allows a lot more characters here (@see https://www.w3.org/TR/REC-xml/#NT-NameStartChar).\n * We allow anything that wouldn't end the tag.\n */\n Tokenizer.prototype.isTagStartChar = function (c) {\n return this.xmlMode ? !isEndOfTagSection(c) : isASCIIAlpha(c);\n };\n Tokenizer.prototype.startSpecial = function (sequence, offset) {\n this.isSpecial = true;\n this.currentSequence = sequence;\n this.sequenceIndex = offset;\n this.state = State.SpecialStartSequence;\n };\n Tokenizer.prototype.stateBeforeTagName = function (c) {\n if (c === CharCodes.ExclamationMark) {\n this.state = State.BeforeDeclaration;\n this.sectionStart = this.index + 1;\n }\n else if (c === CharCodes.Questionmark) {\n this.state = State.InProcessingInstruction;\n this.sectionStart = this.index + 1;\n }\n else if (this.isTagStartChar(c)) {\n var lower = c | 0x20;\n this.sectionStart = this.index;\n if (!this.xmlMode && lower === Sequences.TitleEnd[2]) {\n this.startSpecial(Sequences.TitleEnd, 3);\n }\n else {\n this.state =\n !this.xmlMode && lower === Sequences.ScriptEnd[2]\n ? State.BeforeSpecialS\n : State.InTagName;\n }\n }\n else if (c === CharCodes.Slash) {\n this.state = State.BeforeClosingTagName;\n }\n else {\n this.state = State.Text;\n this.stateText(c);\n }\n };\n Tokenizer.prototype.stateInTagName = function (c) {\n if (isEndOfTagSection(c)) {\n this.cbs.onopentagname(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n };\n Tokenizer.prototype.stateBeforeClosingTagName = function (c) {\n if (isWhitespace(c)) {\n // Ignore\n }\n else if (c === CharCodes.Gt) {\n this.state = State.Text;\n }\n else {\n this.state = this.isTagStartChar(c)\n ? State.InClosingTagName\n : State.InSpecialComment;\n this.sectionStart = this.index;\n }\n };\n Tokenizer.prototype.stateInClosingTagName = function (c) {\n if (c === CharCodes.Gt || isWhitespace(c)) {\n this.cbs.onclosetag(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.state = State.AfterClosingTagName;\n this.stateAfterClosingTagName(c);\n }\n };\n Tokenizer.prototype.stateAfterClosingTagName = function (c) {\n // Skip everything until \">\"\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.state = State.Text;\n this.baseState = State.Text;\n this.sectionStart = this.index + 1;\n }\n };\n Tokenizer.prototype.stateBeforeAttributeName = function (c) {\n if (c === CharCodes.Gt) {\n this.cbs.onopentagend(this.index);\n if (this.isSpecial) {\n this.state = State.InSpecialTag;\n this.sequenceIndex = 0;\n }\n else {\n this.state = State.Text;\n }\n this.baseState = this.state;\n this.sectionStart = this.index + 1;\n }\n else if (c === CharCodes.Slash) {\n this.state = State.InSelfClosingTag;\n }\n else if (!isWhitespace(c)) {\n this.state = State.InAttributeName;\n this.sectionStart = this.index;\n }\n };\n Tokenizer.prototype.stateInSelfClosingTag = function (c) {\n if (c === CharCodes.Gt) {\n this.cbs.onselfclosingtag(this.index);\n this.state = State.Text;\n this.baseState = State.Text;\n this.sectionStart = this.index + 1;\n this.isSpecial = false; // Reset special state, in case of self-closing special tags\n }\n else if (!isWhitespace(c)) {\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n };\n Tokenizer.prototype.stateInAttributeName = function (c) {\n if (c === CharCodes.Eq || isEndOfTagSection(c)) {\n this.cbs.onattribname(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.state = State.AfterAttributeName;\n this.stateAfterAttributeName(c);\n }\n };\n Tokenizer.prototype.stateAfterAttributeName = function (c) {\n if (c === CharCodes.Eq) {\n this.state = State.BeforeAttributeValue;\n }\n else if (c === CharCodes.Slash || c === CharCodes.Gt) {\n this.cbs.onattribend(QuoteType.NoValue, this.index);\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n else if (!isWhitespace(c)) {\n this.cbs.onattribend(QuoteType.NoValue, this.index);\n this.state = State.InAttributeName;\n this.sectionStart = this.index;\n }\n };\n Tokenizer.prototype.stateBeforeAttributeValue = function (c) {\n if (c === CharCodes.DoubleQuote) {\n this.state = State.InAttributeValueDq;\n this.sectionStart = this.index + 1;\n }\n else if (c === CharCodes.SingleQuote) {\n this.state = State.InAttributeValueSq;\n this.sectionStart = this.index + 1;\n }\n else if (!isWhitespace(c)) {\n this.sectionStart = this.index;\n this.state = State.InAttributeValueNq;\n this.stateInAttributeValueNoQuotes(c); // Reconsume token\n }\n };\n Tokenizer.prototype.handleInAttributeValue = function (c, quote) {\n if (c === quote ||\n (!this.decodeEntities && this.fastForwardTo(quote))) {\n this.cbs.onattribdata(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.cbs.onattribend(quote === CharCodes.DoubleQuote\n ? QuoteType.Double\n : QuoteType.Single, this.index);\n this.state = State.BeforeAttributeName;\n }\n else if (this.decodeEntities && c === CharCodes.Amp) {\n this.baseState = this.state;\n this.state = State.BeforeEntity;\n }\n };\n Tokenizer.prototype.stateInAttributeValueDoubleQuotes = function (c) {\n this.handleInAttributeValue(c, CharCodes.DoubleQuote);\n };\n Tokenizer.prototype.stateInAttributeValueSingleQuotes = function (c) {\n this.handleInAttributeValue(c, CharCodes.SingleQuote);\n };\n Tokenizer.prototype.stateInAttributeValueNoQuotes = function (c) {\n if (isWhitespace(c) || c === CharCodes.Gt) {\n this.cbs.onattribdata(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.cbs.onattribend(QuoteType.Unquoted, this.index);\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n else if (this.decodeEntities && c === CharCodes.Amp) {\n this.baseState = this.state;\n this.state = State.BeforeEntity;\n }\n };\n Tokenizer.prototype.stateBeforeDeclaration = function (c) {\n if (c === CharCodes.OpeningSquareBracket) {\n this.state = State.CDATASequence;\n this.sequenceIndex = 0;\n }\n else {\n this.state =\n c === CharCodes.Dash\n ? State.BeforeComment\n : State.InDeclaration;\n }\n };\n Tokenizer.prototype.stateInDeclaration = function (c) {\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.cbs.ondeclaration(this.sectionStart, this.index);\n this.state = State.Text;\n this.sectionStart = this.index + 1;\n }\n };\n Tokenizer.prototype.stateInProcessingInstruction = function (c) {\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.cbs.onprocessinginstruction(this.sectionStart, this.index);\n this.state = State.Text;\n this.sectionStart = this.index + 1;\n }\n };\n Tokenizer.prototype.stateBeforeComment = function (c) {\n if (c === CharCodes.Dash) {\n this.state = State.InCommentLike;\n this.currentSequence = Sequences.CommentEnd;\n // Allow short comments (eg. )\n this.sequenceIndex = 2;\n this.sectionStart = this.index + 1;\n }\n else {\n this.state = State.InDeclaration;\n }\n };\n Tokenizer.prototype.stateInSpecialComment = function (c) {\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.cbs.oncomment(this.sectionStart, this.index, 0);\n this.state = State.Text;\n this.sectionStart = this.index + 1;\n }\n };\n Tokenizer.prototype.stateBeforeSpecialS = function (c) {\n var lower = c | 0x20;\n if (lower === Sequences.ScriptEnd[3]) {\n this.startSpecial(Sequences.ScriptEnd, 4);\n }\n else if (lower === Sequences.StyleEnd[3]) {\n this.startSpecial(Sequences.StyleEnd, 4);\n }\n else {\n this.state = State.InTagName;\n this.stateInTagName(c); // Consume the token again\n }\n };\n Tokenizer.prototype.stateBeforeEntity = function (c) {\n // Start excess with 1 to include the '&'\n this.entityExcess = 1;\n this.entityResult = 0;\n if (c === CharCodes.Number) {\n this.state = State.BeforeNumericEntity;\n }\n else if (c === CharCodes.Amp) {\n // We have two `&` characters in a row. Stay in the current state.\n }\n else {\n this.trieIndex = 0;\n this.trieCurrent = this.entityTrie[0];\n this.state = State.InNamedEntity;\n this.stateInNamedEntity(c);\n }\n };\n Tokenizer.prototype.stateInNamedEntity = function (c) {\n this.entityExcess += 1;\n this.trieIndex = (0, decode_js_1.determineBranch)(this.entityTrie, this.trieCurrent, this.trieIndex + 1, c);\n if (this.trieIndex < 0) {\n this.emitNamedEntity();\n this.index--;\n return;\n }\n this.trieCurrent = this.entityTrie[this.trieIndex];\n var masked = this.trieCurrent & decode_js_1.BinTrieFlags.VALUE_LENGTH;\n // If the branch is a value, store it and continue\n if (masked) {\n // The mask is the number of bytes of the value, including the current byte.\n var valueLength = (masked >> 14) - 1;\n // If we have a legacy entity while parsing strictly, just skip the number of bytes\n if (!this.allowLegacyEntity() && c !== CharCodes.Semi) {\n this.trieIndex += valueLength;\n }\n else {\n // Add 1 as we have already incremented the excess\n var entityStart = this.index - this.entityExcess + 1;\n if (entityStart > this.sectionStart) {\n this.emitPartial(this.sectionStart, entityStart);\n }\n // If this is a surrogate pair, consume the next two bytes\n this.entityResult = this.trieIndex;\n this.trieIndex += valueLength;\n this.entityExcess = 0;\n this.sectionStart = this.index + 1;\n if (valueLength === 0) {\n this.emitNamedEntity();\n }\n }\n }\n };\n Tokenizer.prototype.emitNamedEntity = function () {\n this.state = this.baseState;\n if (this.entityResult === 0) {\n return;\n }\n var valueLength = (this.entityTrie[this.entityResult] & decode_js_1.BinTrieFlags.VALUE_LENGTH) >>\n 14;\n switch (valueLength) {\n case 1: {\n this.emitCodePoint(this.entityTrie[this.entityResult] &\n ~decode_js_1.BinTrieFlags.VALUE_LENGTH);\n break;\n }\n case 2: {\n this.emitCodePoint(this.entityTrie[this.entityResult + 1]);\n break;\n }\n case 3: {\n this.emitCodePoint(this.entityTrie[this.entityResult + 1]);\n this.emitCodePoint(this.entityTrie[this.entityResult + 2]);\n }\n }\n };\n Tokenizer.prototype.stateBeforeNumericEntity = function (c) {\n if ((c | 0x20) === CharCodes.LowerX) {\n this.entityExcess++;\n this.state = State.InHexEntity;\n }\n else {\n this.state = State.InNumericEntity;\n this.stateInNumericEntity(c);\n }\n };\n Tokenizer.prototype.emitNumericEntity = function (strict) {\n var entityStart = this.index - this.entityExcess - 1;\n var numberStart = entityStart + 2 + Number(this.state === State.InHexEntity);\n if (numberStart !== this.index) {\n // Emit leading data if any\n if (entityStart > this.sectionStart) {\n this.emitPartial(this.sectionStart, entityStart);\n }\n this.sectionStart = this.index + Number(strict);\n this.emitCodePoint((0, decode_js_1.replaceCodePoint)(this.entityResult));\n }\n this.state = this.baseState;\n };\n Tokenizer.prototype.stateInNumericEntity = function (c) {\n if (c === CharCodes.Semi) {\n this.emitNumericEntity(true);\n }\n else if (isNumber(c)) {\n this.entityResult = this.entityResult * 10 + (c - CharCodes.Zero);\n this.entityExcess++;\n }\n else {\n if (this.allowLegacyEntity()) {\n this.emitNumericEntity(false);\n }\n else {\n this.state = this.baseState;\n }\n this.index--;\n }\n };\n Tokenizer.prototype.stateInHexEntity = function (c) {\n if (c === CharCodes.Semi) {\n this.emitNumericEntity(true);\n }\n else if (isNumber(c)) {\n this.entityResult = this.entityResult * 16 + (c - CharCodes.Zero);\n this.entityExcess++;\n }\n else if (isHexDigit(c)) {\n this.entityResult =\n this.entityResult * 16 + ((c | 0x20) - CharCodes.LowerA + 10);\n this.entityExcess++;\n }\n else {\n if (this.allowLegacyEntity()) {\n this.emitNumericEntity(false);\n }\n else {\n this.state = this.baseState;\n }\n this.index--;\n }\n };\n Tokenizer.prototype.allowLegacyEntity = function () {\n return (!this.xmlMode &&\n (this.baseState === State.Text ||\n this.baseState === State.InSpecialTag));\n };\n /**\n * Remove data that has already been consumed from the buffer.\n */\n Tokenizer.prototype.cleanup = function () {\n // If we are inside of text or attributes, emit what we already have.\n if (this.running && this.sectionStart !== this.index) {\n if (this.state === State.Text ||\n (this.state === State.InSpecialTag && this.sequenceIndex === 0)) {\n this.cbs.ontext(this.sectionStart, this.index);\n this.sectionStart = this.index;\n }\n else if (this.state === State.InAttributeValueDq ||\n this.state === State.InAttributeValueSq ||\n this.state === State.InAttributeValueNq) {\n this.cbs.onattribdata(this.sectionStart, this.index);\n this.sectionStart = this.index;\n }\n }\n };\n Tokenizer.prototype.shouldContinue = function () {\n return this.index < this.buffer.length + this.offset && this.running;\n };\n /**\n * Iterates through the buffer, calling the function corresponding to the current state.\n *\n * States that are more likely to be hit are higher up, as a performance improvement.\n */\n Tokenizer.prototype.parse = function () {\n while (this.shouldContinue()) {\n var c = this.buffer.charCodeAt(this.index - this.offset);\n switch (this.state) {\n case State.Text: {\n this.stateText(c);\n break;\n }\n case State.SpecialStartSequence: {\n this.stateSpecialStartSequence(c);\n break;\n }\n case State.InSpecialTag: {\n this.stateInSpecialTag(c);\n break;\n }\n case State.CDATASequence: {\n this.stateCDATASequence(c);\n break;\n }\n case State.InAttributeValueDq: {\n this.stateInAttributeValueDoubleQuotes(c);\n break;\n }\n case State.InAttributeName: {\n this.stateInAttributeName(c);\n break;\n }\n case State.InCommentLike: {\n this.stateInCommentLike(c);\n break;\n }\n case State.InSpecialComment: {\n this.stateInSpecialComment(c);\n break;\n }\n case State.BeforeAttributeName: {\n this.stateBeforeAttributeName(c);\n break;\n }\n case State.InTagName: {\n this.stateInTagName(c);\n break;\n }\n case State.InClosingTagName: {\n this.stateInClosingTagName(c);\n break;\n }\n case State.BeforeTagName: {\n this.stateBeforeTagName(c);\n break;\n }\n case State.AfterAttributeName: {\n this.stateAfterAttributeName(c);\n break;\n }\n case State.InAttributeValueSq: {\n this.stateInAttributeValueSingleQuotes(c);\n break;\n }\n case State.BeforeAttributeValue: {\n this.stateBeforeAttributeValue(c);\n break;\n }\n case State.BeforeClosingTagName: {\n this.stateBeforeClosingTagName(c);\n break;\n }\n case State.AfterClosingTagName: {\n this.stateAfterClosingTagName(c);\n break;\n }\n case State.BeforeSpecialS: {\n this.stateBeforeSpecialS(c);\n break;\n }\n case State.InAttributeValueNq: {\n this.stateInAttributeValueNoQuotes(c);\n break;\n }\n case State.InSelfClosingTag: {\n this.stateInSelfClosingTag(c);\n break;\n }\n case State.InDeclaration: {\n this.stateInDeclaration(c);\n break;\n }\n case State.BeforeDeclaration: {\n this.stateBeforeDeclaration(c);\n break;\n }\n case State.BeforeComment: {\n this.stateBeforeComment(c);\n break;\n }\n case State.InProcessingInstruction: {\n this.stateInProcessingInstruction(c);\n break;\n }\n case State.InNamedEntity: {\n this.stateInNamedEntity(c);\n break;\n }\n case State.BeforeEntity: {\n this.stateBeforeEntity(c);\n break;\n }\n case State.InHexEntity: {\n this.stateInHexEntity(c);\n break;\n }\n case State.InNumericEntity: {\n this.stateInNumericEntity(c);\n break;\n }\n default: {\n // `this._state === State.BeforeNumericEntity`\n this.stateBeforeNumericEntity(c);\n }\n }\n this.index++;\n }\n this.cleanup();\n };\n Tokenizer.prototype.finish = function () {\n if (this.state === State.InNamedEntity) {\n this.emitNamedEntity();\n }\n // If there is remaining data, emit it in a reasonable way\n if (this.sectionStart < this.index) {\n this.handleTrailingData();\n }\n this.cbs.onend();\n };\n /** Handle any trailing data. */\n Tokenizer.prototype.handleTrailingData = function () {\n var endIndex = this.buffer.length + this.offset;\n if (this.state === State.InCommentLike) {\n if (this.currentSequence === Sequences.CdataEnd) {\n this.cbs.oncdata(this.sectionStart, endIndex, 0);\n }\n else {\n this.cbs.oncomment(this.sectionStart, endIndex, 0);\n }\n }\n else if (this.state === State.InNumericEntity &&\n this.allowLegacyEntity()) {\n this.emitNumericEntity(false);\n // All trailing data will have been consumed\n }\n else if (this.state === State.InHexEntity &&\n this.allowLegacyEntity()) {\n this.emitNumericEntity(false);\n // All trailing data will have been consumed\n }\n else if (this.state === State.InTagName ||\n this.state === State.BeforeAttributeName ||\n this.state === State.BeforeAttributeValue ||\n this.state === State.AfterAttributeName ||\n this.state === State.InAttributeName ||\n this.state === State.InAttributeValueSq ||\n this.state === State.InAttributeValueDq ||\n this.state === State.InAttributeValueNq ||\n this.state === State.InClosingTagName) {\n /*\n * If we are currently in an opening or closing tag, us not calling the\n * respective callback signals that the tag should be ignored.\n */\n }\n else {\n this.cbs.ontext(this.sectionStart, endIndex);\n }\n };\n Tokenizer.prototype.emitPartial = function (start, endIndex) {\n if (this.baseState !== State.Text &&\n this.baseState !== State.InSpecialTag) {\n this.cbs.onattribdata(start, endIndex);\n }\n else {\n this.cbs.ontext(start, endIndex);\n }\n };\n Tokenizer.prototype.emitCodePoint = function (cp) {\n if (this.baseState !== State.Text &&\n this.baseState !== State.InSpecialTag) {\n this.cbs.onattribentity(cp);\n }\n else {\n this.cbs.ontextentity(cp);\n }\n };\n return Tokenizer;\n}());\nexports.default = Tokenizer;\n//# sourceMappingURL=Tokenizer.js.map","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DomUtils = exports.parseFeed = exports.getFeed = exports.ElementType = exports.Tokenizer = exports.createDomStream = exports.parseDOM = exports.parseDocument = exports.DefaultHandler = exports.DomHandler = exports.Parser = void 0;\nvar Parser_js_1 = require(\"./Parser.js\");\nvar Parser_js_2 = require(\"./Parser.js\");\nObject.defineProperty(exports, \"Parser\", { enumerable: true, get: function () { return Parser_js_2.Parser; } });\nvar domhandler_1 = require(\"domhandler\");\nvar domhandler_2 = require(\"domhandler\");\nObject.defineProperty(exports, \"DomHandler\", { enumerable: true, get: function () { return domhandler_2.DomHandler; } });\n// Old name for DomHandler\nObject.defineProperty(exports, \"DefaultHandler\", { enumerable: true, get: function () { return domhandler_2.DomHandler; } });\n// Helper methods\n/**\n * Parses the data, returns the resulting document.\n *\n * @param data The data that should be parsed.\n * @param options Optional options for the parser and DOM builder.\n */\nfunction parseDocument(data, options) {\n var handler = new domhandler_1.DomHandler(undefined, options);\n new Parser_js_1.Parser(handler, options).end(data);\n return handler.root;\n}\nexports.parseDocument = parseDocument;\n/**\n * Parses data, returns an array of the root nodes.\n *\n * Note that the root nodes still have a `Document` node as their parent.\n * Use `parseDocument` to get the `Document` node instead.\n *\n * @param data The data that should be parsed.\n * @param options Optional options for the parser and DOM builder.\n * @deprecated Use `parseDocument` instead.\n */\nfunction parseDOM(data, options) {\n return parseDocument(data, options).children;\n}\nexports.parseDOM = parseDOM;\n/**\n * Creates a parser instance, with an attached DOM handler.\n *\n * @param callback A callback that will be called once parsing has been completed.\n * @param options Optional options for the parser and DOM builder.\n * @param elementCallback An optional callback that will be called every time a tag has been completed inside of the DOM.\n */\nfunction createDomStream(callback, options, elementCallback) {\n var handler = new domhandler_1.DomHandler(callback, options, elementCallback);\n return new Parser_js_1.Parser(handler, options);\n}\nexports.createDomStream = createDomStream;\nvar Tokenizer_js_1 = require(\"./Tokenizer.js\");\nObject.defineProperty(exports, \"Tokenizer\", { enumerable: true, get: function () { return __importDefault(Tokenizer_js_1).default; } });\n/*\n * All of the following exports exist for backwards-compatibility.\n * They should probably be removed eventually.\n */\nexports.ElementType = __importStar(require(\"domelementtype\"));\nvar domutils_1 = require(\"domutils\");\nvar domutils_2 = require(\"domutils\");\nObject.defineProperty(exports, \"getFeed\", { enumerable: true, get: function () { return domutils_2.getFeed; } });\nvar parseFeedDefaultOptions = { xmlMode: true };\n/**\n * Parse a feed.\n *\n * @param feed The feed that should be parsed, as a string.\n * @param options Optionally, options for parsing. When using this, you should set `xmlMode` to `true`.\n */\nfunction parseFeed(feed, options) {\n if (options === void 0) { options = parseFeedDefaultOptions; }\n return (0, domutils_1.getFeed)(parseDOM(feed, options));\n}\nexports.parseFeed = parseFeed;\nexports.DomUtils = __importStar(require(\"domutils\"));\n//# sourceMappingURL=index.js.map","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\n/*!\n * is-plain-object \n *\n * Copyright (c) 2014-2017, Jon Schlinkert.\n * Released under the MIT License.\n */\n\nfunction isObject(o) {\n return Object.prototype.toString.call(o) === '[object Object]';\n}\n\nfunction isPlainObject(o) {\n var ctor,prot;\n\n if (isObject(o) === false) return false;\n\n // If has modified constructor\n ctor = o.constructor;\n if (ctor === undefined) return true;\n\n // If has modified prototype\n prot = ctor.prototype;\n if (isObject(prot) === false) return false;\n\n // If constructor does not have an Object-specific method\n if (prot.hasOwnProperty('isPrototypeOf') === false) {\n return false;\n }\n\n // Most likely a plain Object\n return true;\n}\n\nexports.isPlainObject = isPlainObject;\n","const ANY = Symbol('SemVer ANY')\n// hoisted class for cyclic dependency\nclass Comparator {\n static get ANY () {\n return ANY\n }\n\n constructor (comp, options) {\n options = parseOptions(options)\n\n if (comp instanceof Comparator) {\n if (comp.loose === !!options.loose) {\n return comp\n } else {\n comp = comp.value\n }\n }\n\n comp = comp.trim().split(/\\s+/).join(' ')\n debug('comparator', comp, options)\n this.options = options\n this.loose = !!options.loose\n this.parse(comp)\n\n if (this.semver === ANY) {\n this.value = ''\n } else {\n this.value = this.operator + this.semver.version\n }\n\n debug('comp', this)\n }\n\n parse (comp) {\n const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]\n const m = comp.match(r)\n\n if (!m) {\n throw new TypeError(`Invalid comparator: ${comp}`)\n }\n\n this.operator = m[1] !== undefined ? m[1] : ''\n if (this.operator === '=') {\n this.operator = ''\n }\n\n // if it literally is just '>' or '' then allow anything.\n if (!m[2]) {\n this.semver = ANY\n } else {\n this.semver = new SemVer(m[2], this.options.loose)\n }\n }\n\n toString () {\n return this.value\n }\n\n test (version) {\n debug('Comparator.test', version, this.options.loose)\n\n if (this.semver === ANY || version === ANY) {\n return true\n }\n\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options)\n } catch (er) {\n return false\n }\n }\n\n return cmp(version, this.operator, this.semver, this.options)\n }\n\n intersects (comp, options) {\n if (!(comp instanceof Comparator)) {\n throw new TypeError('a Comparator is required')\n }\n\n if (this.operator === '') {\n if (this.value === '') {\n return true\n }\n return new Range(comp.value, options).test(this.value)\n } else if (comp.operator === '') {\n if (comp.value === '') {\n return true\n }\n return new Range(this.value, options).test(comp.semver)\n }\n\n options = parseOptions(options)\n\n // Special cases where nothing can possibly be lower\n if (options.includePrerelease &&\n (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {\n return false\n }\n if (!options.includePrerelease &&\n (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {\n return false\n }\n\n // Same direction increasing (> or >=)\n if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {\n return true\n }\n // Same direction decreasing (< or <=)\n if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {\n return true\n }\n // same SemVer and both sides are inclusive (<= or >=)\n if (\n (this.semver.version === comp.semver.version) &&\n this.operator.includes('=') && comp.operator.includes('=')) {\n return true\n }\n // opposite directions less than\n if (cmp(this.semver, '<', comp.semver, options) &&\n this.operator.startsWith('>') && comp.operator.startsWith('<')) {\n return true\n }\n // opposite directions greater than\n if (cmp(this.semver, '>', comp.semver, options) &&\n this.operator.startsWith('<') && comp.operator.startsWith('>')) {\n return true\n }\n return false\n }\n}\n\nmodule.exports = Comparator\n\nconst parseOptions = require('../internal/parse-options')\nconst { safeRe: re, t } = require('../internal/re')\nconst cmp = require('../functions/cmp')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst Range = require('./range')\n","const SPACE_CHARACTERS = /\\s+/g\n\n// hoisted class for cyclic dependency\nclass Range {\n constructor (range, options) {\n options = parseOptions(options)\n\n if (range instanceof Range) {\n if (\n range.loose === !!options.loose &&\n range.includePrerelease === !!options.includePrerelease\n ) {\n return range\n } else {\n return new Range(range.raw, options)\n }\n }\n\n if (range instanceof Comparator) {\n // just put it in the set and return\n this.raw = range.value\n this.set = [[range]]\n this.formatted = undefined\n return this\n }\n\n this.options = options\n this.loose = !!options.loose\n this.includePrerelease = !!options.includePrerelease\n\n // First reduce all whitespace as much as possible so we do not have to rely\n // on potentially slow regexes like \\s*. This is then stored and used for\n // future error messages as well.\n this.raw = range.trim().replace(SPACE_CHARACTERS, ' ')\n\n // First, split on ||\n this.set = this.raw\n .split('||')\n // map the range to a 2d array of comparators\n .map(r => this.parseRange(r.trim()))\n // throw out any comparator lists that are empty\n // this generally means that it was not a valid range, which is allowed\n // in loose mode, but will still throw if the WHOLE range is invalid.\n .filter(c => c.length)\n\n if (!this.set.length) {\n throw new TypeError(`Invalid SemVer Range: ${this.raw}`)\n }\n\n // if we have any that are not the null set, throw out null sets.\n if (this.set.length > 1) {\n // keep the first one, in case they're all null sets\n const first = this.set[0]\n this.set = this.set.filter(c => !isNullSet(c[0]))\n if (this.set.length === 0) {\n this.set = [first]\n } else if (this.set.length > 1) {\n // if we have any that are *, then the range is just *\n for (const c of this.set) {\n if (c.length === 1 && isAny(c[0])) {\n this.set = [c]\n break\n }\n }\n }\n }\n\n this.formatted = undefined\n }\n\n get range () {\n if (this.formatted === undefined) {\n this.formatted = ''\n for (let i = 0; i < this.set.length; i++) {\n if (i > 0) {\n this.formatted += '||'\n }\n const comps = this.set[i]\n for (let k = 0; k < comps.length; k++) {\n if (k > 0) {\n this.formatted += ' '\n }\n this.formatted += comps[k].toString().trim()\n }\n }\n }\n return this.formatted\n }\n\n format () {\n return this.range\n }\n\n toString () {\n return this.range\n }\n\n parseRange (range) {\n // memoize range parsing for performance.\n // this is a very hot path, and fully deterministic.\n const memoOpts =\n (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) |\n (this.options.loose && FLAG_LOOSE)\n const memoKey = memoOpts + ':' + range\n const cached = cache.get(memoKey)\n if (cached) {\n return cached\n }\n\n const loose = this.options.loose\n // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`\n const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]\n range = range.replace(hr, hyphenReplace(this.options.includePrerelease))\n debug('hyphen replace', range)\n\n // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`\n range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)\n debug('comparator trim', range)\n\n // `~ 1.2.3` => `~1.2.3`\n range = range.replace(re[t.TILDETRIM], tildeTrimReplace)\n debug('tilde trim', range)\n\n // `^ 1.2.3` => `^1.2.3`\n range = range.replace(re[t.CARETTRIM], caretTrimReplace)\n debug('caret trim', range)\n\n // At this point, the range is completely trimmed and\n // ready to be split into comparators.\n\n let rangeList = range\n .split(' ')\n .map(comp => parseComparator(comp, this.options))\n .join(' ')\n .split(/\\s+/)\n // >=0.0.0 is equivalent to *\n .map(comp => replaceGTE0(comp, this.options))\n\n if (loose) {\n // in loose mode, throw out any that are not valid comparators\n rangeList = rangeList.filter(comp => {\n debug('loose invalid filter', comp, this.options)\n return !!comp.match(re[t.COMPARATORLOOSE])\n })\n }\n debug('range list', rangeList)\n\n // if any comparators are the null set, then replace with JUST null set\n // if more than one comparator, remove any * comparators\n // also, don't include the same comparator more than once\n const rangeMap = new Map()\n const comparators = rangeList.map(comp => new Comparator(comp, this.options))\n for (const comp of comparators) {\n if (isNullSet(comp)) {\n return [comp]\n }\n rangeMap.set(comp.value, comp)\n }\n if (rangeMap.size > 1 && rangeMap.has('')) {\n rangeMap.delete('')\n }\n\n const result = [...rangeMap.values()]\n cache.set(memoKey, result)\n return result\n }\n\n intersects (range, options) {\n if (!(range instanceof Range)) {\n throw new TypeError('a Range is required')\n }\n\n return this.set.some((thisComparators) => {\n return (\n isSatisfiable(thisComparators, options) &&\n range.set.some((rangeComparators) => {\n return (\n isSatisfiable(rangeComparators, options) &&\n thisComparators.every((thisComparator) => {\n return rangeComparators.every((rangeComparator) => {\n return thisComparator.intersects(rangeComparator, options)\n })\n })\n )\n })\n )\n })\n }\n\n // if ANY of the sets match ALL of its comparators, then pass\n test (version) {\n if (!version) {\n return false\n }\n\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options)\n } catch (er) {\n return false\n }\n }\n\n for (let i = 0; i < this.set.length; i++) {\n if (testSet(this.set[i], version, this.options)) {\n return true\n }\n }\n return false\n }\n}\n\nmodule.exports = Range\n\nconst LRU = require('../internal/lrucache')\nconst cache = new LRU()\n\nconst parseOptions = require('../internal/parse-options')\nconst Comparator = require('./comparator')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst {\n safeRe: re,\n t,\n comparatorTrimReplace,\n tildeTrimReplace,\n caretTrimReplace,\n} = require('../internal/re')\nconst { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require('../internal/constants')\n\nconst isNullSet = c => c.value === '<0.0.0-0'\nconst isAny = c => c.value === ''\n\n// take a set of comparators and determine whether there\n// exists a version which can satisfy it\nconst isSatisfiable = (comparators, options) => {\n let result = true\n const remainingComparators = comparators.slice()\n let testComparator = remainingComparators.pop()\n\n while (result && remainingComparators.length) {\n result = remainingComparators.every((otherComparator) => {\n return testComparator.intersects(otherComparator, options)\n })\n\n testComparator = remainingComparators.pop()\n }\n\n return result\n}\n\n// comprised of xranges, tildes, stars, and gtlt's at this point.\n// already replaced the hyphen ranges\n// turn into a set of JUST comparators.\nconst parseComparator = (comp, options) => {\n debug('comp', comp, options)\n comp = replaceCarets(comp, options)\n debug('caret', comp)\n comp = replaceTildes(comp, options)\n debug('tildes', comp)\n comp = replaceXRanges(comp, options)\n debug('xrange', comp)\n comp = replaceStars(comp, options)\n debug('stars', comp)\n return comp\n}\n\nconst isX = id => !id || id.toLowerCase() === 'x' || id === '*'\n\n// ~, ~> --> * (any, kinda silly)\n// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0\n// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0\n// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0\n// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0\n// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0\n// ~0.0.1 --> >=0.0.1 <0.1.0-0\nconst replaceTildes = (comp, options) => {\n return comp\n .trim()\n .split(/\\s+/)\n .map((c) => replaceTilde(c, options))\n .join(' ')\n}\n\nconst replaceTilde = (comp, options) => {\n const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('tilde', comp, _, M, m, p, pr)\n let ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = `>=${M}.0.0 <${+M + 1}.0.0-0`\n } else if (isX(p)) {\n // ~1.2 == >=1.2.0 <1.3.0-0\n ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`\n } else if (pr) {\n debug('replaceTilde pr', pr)\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${+m + 1}.0-0`\n } else {\n // ~1.2.3 == >=1.2.3 <1.3.0-0\n ret = `>=${M}.${m}.${p\n } <${M}.${+m + 1}.0-0`\n }\n\n debug('tilde return', ret)\n return ret\n })\n}\n\n// ^ --> * (any, kinda silly)\n// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0\n// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0\n// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0\n// ^1.2.3 --> >=1.2.3 <2.0.0-0\n// ^1.2.0 --> >=1.2.0 <2.0.0-0\n// ^0.0.1 --> >=0.0.1 <0.0.2-0\n// ^0.1.0 --> >=0.1.0 <0.2.0-0\nconst replaceCarets = (comp, options) => {\n return comp\n .trim()\n .split(/\\s+/)\n .map((c) => replaceCaret(c, options))\n .join(' ')\n}\n\nconst replaceCaret = (comp, options) => {\n debug('caret', comp, options)\n const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]\n const z = options.includePrerelease ? '-0' : ''\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('caret', comp, _, M, m, p, pr)\n let ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`\n } else if (isX(p)) {\n if (M === '0') {\n ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`\n } else {\n ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`\n }\n } else if (pr) {\n debug('replaceCaret pr', pr)\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${m}.${+p + 1}-0`\n } else {\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${+m + 1}.0-0`\n }\n } else {\n ret = `>=${M}.${m}.${p}-${pr\n } <${+M + 1}.0.0-0`\n }\n } else {\n debug('no pr')\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p\n }${z} <${M}.${m}.${+p + 1}-0`\n } else {\n ret = `>=${M}.${m}.${p\n }${z} <${M}.${+m + 1}.0-0`\n }\n } else {\n ret = `>=${M}.${m}.${p\n } <${+M + 1}.0.0-0`\n }\n }\n\n debug('caret return', ret)\n return ret\n })\n}\n\nconst replaceXRanges = (comp, options) => {\n debug('replaceXRanges', comp, options)\n return comp\n .split(/\\s+/)\n .map((c) => replaceXRange(c, options))\n .join(' ')\n}\n\nconst replaceXRange = (comp, options) => {\n comp = comp.trim()\n const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]\n return comp.replace(r, (ret, gtlt, M, m, p, pr) => {\n debug('xRange', comp, ret, gtlt, M, m, p, pr)\n const xM = isX(M)\n const xm = xM || isX(m)\n const xp = xm || isX(p)\n const anyX = xp\n\n if (gtlt === '=' && anyX) {\n gtlt = ''\n }\n\n // if we're including prereleases in the match, then we need\n // to fix this to -0, the lowest possible prerelease value\n pr = options.includePrerelease ? '-0' : ''\n\n if (xM) {\n if (gtlt === '>' || gtlt === '<') {\n // nothing is allowed\n ret = '<0.0.0-0'\n } else {\n // nothing is forbidden\n ret = '*'\n }\n } else if (gtlt && anyX) {\n // we know patch is an x, because we have any x at all.\n // replace X with 0\n if (xm) {\n m = 0\n }\n p = 0\n\n if (gtlt === '>') {\n // >1 => >=2.0.0\n // >1.2 => >=1.3.0\n gtlt = '>='\n if (xm) {\n M = +M + 1\n m = 0\n p = 0\n } else {\n m = +m + 1\n p = 0\n }\n } else if (gtlt === '<=') {\n // <=0.7.x is actually <0.8.0, since any 0.7.x should\n // pass. Similarly, <=7.x is actually <8.0.0, etc.\n gtlt = '<'\n if (xm) {\n M = +M + 1\n } else {\n m = +m + 1\n }\n }\n\n if (gtlt === '<') {\n pr = '-0'\n }\n\n ret = `${gtlt + M}.${m}.${p}${pr}`\n } else if (xm) {\n ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`\n } else if (xp) {\n ret = `>=${M}.${m}.0${pr\n } <${M}.${+m + 1}.0-0`\n }\n\n debug('xRange return', ret)\n\n return ret\n })\n}\n\n// Because * is AND-ed with everything else in the comparator,\n// and '' means \"any version\", just remove the *s entirely.\nconst replaceStars = (comp, options) => {\n debug('replaceStars', comp, options)\n // Looseness is ignored here. star is always as loose as it gets!\n return comp\n .trim()\n .replace(re[t.STAR], '')\n}\n\nconst replaceGTE0 = (comp, options) => {\n debug('replaceGTE0', comp, options)\n return comp\n .trim()\n .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')\n}\n\n// This function is passed to string.replace(re[t.HYPHENRANGE])\n// M, m, patch, prerelease, build\n// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5\n// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do\n// 1.2 - 3.4 => >=1.2.0 <3.5.0-0\n// TODO build?\nconst hyphenReplace = incPr => ($0,\n from, fM, fm, fp, fpr, fb,\n to, tM, tm, tp, tpr) => {\n if (isX(fM)) {\n from = ''\n } else if (isX(fm)) {\n from = `>=${fM}.0.0${incPr ? '-0' : ''}`\n } else if (isX(fp)) {\n from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`\n } else if (fpr) {\n from = `>=${from}`\n } else {\n from = `>=${from}${incPr ? '-0' : ''}`\n }\n\n if (isX(tM)) {\n to = ''\n } else if (isX(tm)) {\n to = `<${+tM + 1}.0.0-0`\n } else if (isX(tp)) {\n to = `<${tM}.${+tm + 1}.0-0`\n } else if (tpr) {\n to = `<=${tM}.${tm}.${tp}-${tpr}`\n } else if (incPr) {\n to = `<${tM}.${tm}.${+tp + 1}-0`\n } else {\n to = `<=${to}`\n }\n\n return `${from} ${to}`.trim()\n}\n\nconst testSet = (set, version, options) => {\n for (let i = 0; i < set.length; i++) {\n if (!set[i].test(version)) {\n return false\n }\n }\n\n if (version.prerelease.length && !options.includePrerelease) {\n // Find the set of versions that are allowed to have prereleases\n // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0\n // That should allow `1.2.3-pr.2` to pass.\n // However, `1.2.4-alpha.notready` should NOT be allowed,\n // even though it's within the range set by the comparators.\n for (let i = 0; i < set.length; i++) {\n debug(set[i].semver)\n if (set[i].semver === Comparator.ANY) {\n continue\n }\n\n if (set[i].semver.prerelease.length > 0) {\n const allowed = set[i].semver\n if (allowed.major === version.major &&\n allowed.minor === version.minor &&\n allowed.patch === version.patch) {\n return true\n }\n }\n }\n\n // Version has a -pre, but it's not one of the ones we like.\n return false\n }\n\n return true\n}\n","const debug = require('../internal/debug')\nconst { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')\nconst { safeRe: re, t } = require('../internal/re')\n\nconst parseOptions = require('../internal/parse-options')\nconst { compareIdentifiers } = require('../internal/identifiers')\nclass SemVer {\n constructor (version, options) {\n options = parseOptions(options)\n\n if (version instanceof SemVer) {\n if (version.loose === !!options.loose &&\n version.includePrerelease === !!options.includePrerelease) {\n return version\n } else {\n version = version.version\n }\n } else if (typeof version !== 'string') {\n throw new TypeError(`Invalid version. Must be a string. Got type \"${typeof version}\".`)\n }\n\n if (version.length > MAX_LENGTH) {\n throw new TypeError(\n `version is longer than ${MAX_LENGTH} characters`\n )\n }\n\n debug('SemVer', version, options)\n this.options = options\n this.loose = !!options.loose\n // this isn't actually relevant for versions, but keep it so that we\n // don't run into trouble passing this.options around.\n this.includePrerelease = !!options.includePrerelease\n\n const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])\n\n if (!m) {\n throw new TypeError(`Invalid Version: ${version}`)\n }\n\n this.raw = version\n\n // these are actually numbers\n this.major = +m[1]\n this.minor = +m[2]\n this.patch = +m[3]\n\n if (this.major > MAX_SAFE_INTEGER || this.major < 0) {\n throw new TypeError('Invalid major version')\n }\n\n if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {\n throw new TypeError('Invalid minor version')\n }\n\n if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {\n throw new TypeError('Invalid patch version')\n }\n\n // numberify any prerelease numeric ids\n if (!m[4]) {\n this.prerelease = []\n } else {\n this.prerelease = m[4].split('.').map((id) => {\n if (/^[0-9]+$/.test(id)) {\n const num = +id\n if (num >= 0 && num < MAX_SAFE_INTEGER) {\n return num\n }\n }\n return id\n })\n }\n\n this.build = m[5] ? m[5].split('.') : []\n this.format()\n }\n\n format () {\n this.version = `${this.major}.${this.minor}.${this.patch}`\n if (this.prerelease.length) {\n this.version += `-${this.prerelease.join('.')}`\n }\n return this.version\n }\n\n toString () {\n return this.version\n }\n\n compare (other) {\n debug('SemVer.compare', this.version, this.options, other)\n if (!(other instanceof SemVer)) {\n if (typeof other === 'string' && other === this.version) {\n return 0\n }\n other = new SemVer(other, this.options)\n }\n\n if (other.version === this.version) {\n return 0\n }\n\n return this.compareMain(other) || this.comparePre(other)\n }\n\n compareMain (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n return (\n compareIdentifiers(this.major, other.major) ||\n compareIdentifiers(this.minor, other.minor) ||\n compareIdentifiers(this.patch, other.patch)\n )\n }\n\n comparePre (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n // NOT having a prerelease is > having one\n if (this.prerelease.length && !other.prerelease.length) {\n return -1\n } else if (!this.prerelease.length && other.prerelease.length) {\n return 1\n } else if (!this.prerelease.length && !other.prerelease.length) {\n return 0\n }\n\n let i = 0\n do {\n const a = this.prerelease[i]\n const b = other.prerelease[i]\n debug('prerelease compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n compareBuild (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n let i = 0\n do {\n const a = this.build[i]\n const b = other.build[i]\n debug('build compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n // preminor will bump the version up to the next minor release, and immediately\n // down to pre-release. premajor and prepatch work the same way.\n inc (release, identifier, identifierBase) {\n switch (release) {\n case 'premajor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor = 0\n this.major++\n this.inc('pre', identifier, identifierBase)\n break\n case 'preminor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor++\n this.inc('pre', identifier, identifierBase)\n break\n case 'prepatch':\n // If this is already a prerelease, it will bump to the next version\n // drop any prereleases that might already exist, since they are not\n // relevant at this point.\n this.prerelease.length = 0\n this.inc('patch', identifier, identifierBase)\n this.inc('pre', identifier, identifierBase)\n break\n // If the input is a non-prerelease version, this acts the same as\n // prepatch.\n case 'prerelease':\n if (this.prerelease.length === 0) {\n this.inc('patch', identifier, identifierBase)\n }\n this.inc('pre', identifier, identifierBase)\n break\n\n case 'major':\n // If this is a pre-major version, bump up to the same major version.\n // Otherwise increment major.\n // 1.0.0-5 bumps to 1.0.0\n // 1.1.0 bumps to 2.0.0\n if (\n this.minor !== 0 ||\n this.patch !== 0 ||\n this.prerelease.length === 0\n ) {\n this.major++\n }\n this.minor = 0\n this.patch = 0\n this.prerelease = []\n break\n case 'minor':\n // If this is a pre-minor version, bump up to the same minor version.\n // Otherwise increment minor.\n // 1.2.0-5 bumps to 1.2.0\n // 1.2.1 bumps to 1.3.0\n if (this.patch !== 0 || this.prerelease.length === 0) {\n this.minor++\n }\n this.patch = 0\n this.prerelease = []\n break\n case 'patch':\n // If this is not a pre-release version, it will increment the patch.\n // If it is a pre-release it will bump up to the same patch version.\n // 1.2.0-5 patches to 1.2.0\n // 1.2.0 patches to 1.2.1\n if (this.prerelease.length === 0) {\n this.patch++\n }\n this.prerelease = []\n break\n // This probably shouldn't be used publicly.\n // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.\n case 'pre': {\n const base = Number(identifierBase) ? 1 : 0\n\n if (!identifier && identifierBase === false) {\n throw new Error('invalid increment argument: identifier is empty')\n }\n\n if (this.prerelease.length === 0) {\n this.prerelease = [base]\n } else {\n let i = this.prerelease.length\n while (--i >= 0) {\n if (typeof this.prerelease[i] === 'number') {\n this.prerelease[i]++\n i = -2\n }\n }\n if (i === -1) {\n // didn't increment anything\n if (identifier === this.prerelease.join('.') && identifierBase === false) {\n throw new Error('invalid increment argument: identifier already exists')\n }\n this.prerelease.push(base)\n }\n }\n if (identifier) {\n // 1.2.0-beta.1 bumps to 1.2.0-beta.2,\n // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0\n let prerelease = [identifier, base]\n if (identifierBase === false) {\n prerelease = [identifier]\n }\n if (compareIdentifiers(this.prerelease[0], identifier) === 0) {\n if (isNaN(this.prerelease[1])) {\n this.prerelease = prerelease\n }\n } else {\n this.prerelease = prerelease\n }\n }\n break\n }\n default:\n throw new Error(`invalid increment argument: ${release}`)\n }\n this.raw = this.format()\n if (this.build.length) {\n this.raw += `+${this.build.join('.')}`\n }\n return this\n }\n}\n\nmodule.exports = SemVer\n","const parse = require('./parse')\nconst clean = (version, options) => {\n const s = parse(version.trim().replace(/^[=v]+/, ''), options)\n return s ? s.version : null\n}\nmodule.exports = clean\n","const eq = require('./eq')\nconst neq = require('./neq')\nconst gt = require('./gt')\nconst gte = require('./gte')\nconst lt = require('./lt')\nconst lte = require('./lte')\n\nconst cmp = (a, op, b, loose) => {\n switch (op) {\n case '===':\n if (typeof a === 'object') {\n a = a.version\n }\n if (typeof b === 'object') {\n b = b.version\n }\n return a === b\n\n case '!==':\n if (typeof a === 'object') {\n a = a.version\n }\n if (typeof b === 'object') {\n b = b.version\n }\n return a !== b\n\n case '':\n case '=':\n case '==':\n return eq(a, b, loose)\n\n case '!=':\n return neq(a, b, loose)\n\n case '>':\n return gt(a, b, loose)\n\n case '>=':\n return gte(a, b, loose)\n\n case '<':\n return lt(a, b, loose)\n\n case '<=':\n return lte(a, b, loose)\n\n default:\n throw new TypeError(`Invalid operator: ${op}`)\n }\n}\nmodule.exports = cmp\n","const SemVer = require('../classes/semver')\nconst parse = require('./parse')\nconst { safeRe: re, t } = require('../internal/re')\n\nconst coerce = (version, options) => {\n if (version instanceof SemVer) {\n return version\n }\n\n if (typeof version === 'number') {\n version = String(version)\n }\n\n if (typeof version !== 'string') {\n return null\n }\n\n options = options || {}\n\n let match = null\n if (!options.rtl) {\n match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE])\n } else {\n // Find the right-most coercible string that does not share\n // a terminus with a more left-ward coercible string.\n // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'\n // With includePrerelease option set, '1.2.3.4-rc' wants to coerce '2.3.4-rc', not '2.3.4'\n //\n // Walk through the string checking with a /g regexp\n // Manually set the index so as to pick up overlapping matches.\n // Stop when we get a match that ends at the string end, since no\n // coercible string can be more right-ward without the same terminus.\n const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL]\n let next\n while ((next = coerceRtlRegex.exec(version)) &&\n (!match || match.index + match[0].length !== version.length)\n ) {\n if (!match ||\n next.index + next[0].length !== match.index + match[0].length) {\n match = next\n }\n coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length\n }\n // leave it in a clean state\n coerceRtlRegex.lastIndex = -1\n }\n\n if (match === null) {\n return null\n }\n\n const major = match[2]\n const minor = match[3] || '0'\n const patch = match[4] || '0'\n const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : ''\n const build = options.includePrerelease && match[6] ? `+${match[6]}` : ''\n\n return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options)\n}\nmodule.exports = coerce\n","const SemVer = require('../classes/semver')\nconst compareBuild = (a, b, loose) => {\n const versionA = new SemVer(a, loose)\n const versionB = new SemVer(b, loose)\n return versionA.compare(versionB) || versionA.compareBuild(versionB)\n}\nmodule.exports = compareBuild\n","const compare = require('./compare')\nconst compareLoose = (a, b) => compare(a, b, true)\nmodule.exports = compareLoose\n","const SemVer = require('../classes/semver')\nconst compare = (a, b, loose) =>\n new SemVer(a, loose).compare(new SemVer(b, loose))\n\nmodule.exports = compare\n","const parse = require('./parse.js')\n\nconst diff = (version1, version2) => {\n const v1 = parse(version1, null, true)\n const v2 = parse(version2, null, true)\n const comparison = v1.compare(v2)\n\n if (comparison === 0) {\n return null\n }\n\n const v1Higher = comparison > 0\n const highVersion = v1Higher ? v1 : v2\n const lowVersion = v1Higher ? v2 : v1\n const highHasPre = !!highVersion.prerelease.length\n const lowHasPre = !!lowVersion.prerelease.length\n\n if (lowHasPre && !highHasPre) {\n // Going from prerelease -> no prerelease requires some special casing\n\n // If the low version has only a major, then it will always be a major\n // Some examples:\n // 1.0.0-1 -> 1.0.0\n // 1.0.0-1 -> 1.1.1\n // 1.0.0-1 -> 2.0.0\n if (!lowVersion.patch && !lowVersion.minor) {\n return 'major'\n }\n\n // Otherwise it can be determined by checking the high version\n\n if (highVersion.patch) {\n // anything higher than a patch bump would result in the wrong version\n return 'patch'\n }\n\n if (highVersion.minor) {\n // anything higher than a minor bump would result in the wrong version\n return 'minor'\n }\n\n // bumping major/minor/patch all have same result\n return 'major'\n }\n\n // add the `pre` prefix if we are going to a prerelease version\n const prefix = highHasPre ? 'pre' : ''\n\n if (v1.major !== v2.major) {\n return prefix + 'major'\n }\n\n if (v1.minor !== v2.minor) {\n return prefix + 'minor'\n }\n\n if (v1.patch !== v2.patch) {\n return prefix + 'patch'\n }\n\n // high and low are preleases\n return 'prerelease'\n}\n\nmodule.exports = diff\n","const compare = require('./compare')\nconst eq = (a, b, loose) => compare(a, b, loose) === 0\nmodule.exports = eq\n","const compare = require('./compare')\nconst gt = (a, b, loose) => compare(a, b, loose) > 0\nmodule.exports = gt\n","const compare = require('./compare')\nconst gte = (a, b, loose) => compare(a, b, loose) >= 0\nmodule.exports = gte\n","const SemVer = require('../classes/semver')\n\nconst inc = (version, release, options, identifier, identifierBase) => {\n if (typeof (options) === 'string') {\n identifierBase = identifier\n identifier = options\n options = undefined\n }\n\n try {\n return new SemVer(\n version instanceof SemVer ? version.version : version,\n options\n ).inc(release, identifier, identifierBase).version\n } catch (er) {\n return null\n }\n}\nmodule.exports = inc\n","const compare = require('./compare')\nconst lt = (a, b, loose) => compare(a, b, loose) < 0\nmodule.exports = lt\n","const compare = require('./compare')\nconst lte = (a, b, loose) => compare(a, b, loose) <= 0\nmodule.exports = lte\n","const SemVer = require('../classes/semver')\nconst major = (a, loose) => new SemVer(a, loose).major\nmodule.exports = major\n","const SemVer = require('../classes/semver')\nconst minor = (a, loose) => new SemVer(a, loose).minor\nmodule.exports = minor\n","const compare = require('./compare')\nconst neq = (a, b, loose) => compare(a, b, loose) !== 0\nmodule.exports = neq\n","const SemVer = require('../classes/semver')\nconst parse = (version, options, throwErrors = false) => {\n if (version instanceof SemVer) {\n return version\n }\n try {\n return new SemVer(version, options)\n } catch (er) {\n if (!throwErrors) {\n return null\n }\n throw er\n }\n}\n\nmodule.exports = parse\n","const SemVer = require('../classes/semver')\nconst patch = (a, loose) => new SemVer(a, loose).patch\nmodule.exports = patch\n","const parse = require('./parse')\nconst prerelease = (version, options) => {\n const parsed = parse(version, options)\n return (parsed && parsed.prerelease.length) ? parsed.prerelease : null\n}\nmodule.exports = prerelease\n","const compare = require('./compare')\nconst rcompare = (a, b, loose) => compare(b, a, loose)\nmodule.exports = rcompare\n","const compareBuild = require('./compare-build')\nconst rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose))\nmodule.exports = rsort\n","const Range = require('../classes/range')\nconst satisfies = (version, range, options) => {\n try {\n range = new Range(range, options)\n } catch (er) {\n return false\n }\n return range.test(version)\n}\nmodule.exports = satisfies\n","const compareBuild = require('./compare-build')\nconst sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose))\nmodule.exports = sort\n","const parse = require('./parse')\nconst valid = (version, options) => {\n const v = parse(version, options)\n return v ? v.version : null\n}\nmodule.exports = valid\n","// just pre-load all the stuff that index.js lazily exports\nconst internalRe = require('./internal/re')\nconst constants = require('./internal/constants')\nconst SemVer = require('./classes/semver')\nconst identifiers = require('./internal/identifiers')\nconst parse = require('./functions/parse')\nconst valid = require('./functions/valid')\nconst clean = require('./functions/clean')\nconst inc = require('./functions/inc')\nconst diff = require('./functions/diff')\nconst major = require('./functions/major')\nconst minor = require('./functions/minor')\nconst patch = require('./functions/patch')\nconst prerelease = require('./functions/prerelease')\nconst compare = require('./functions/compare')\nconst rcompare = require('./functions/rcompare')\nconst compareLoose = require('./functions/compare-loose')\nconst compareBuild = require('./functions/compare-build')\nconst sort = require('./functions/sort')\nconst rsort = require('./functions/rsort')\nconst gt = require('./functions/gt')\nconst lt = require('./functions/lt')\nconst eq = require('./functions/eq')\nconst neq = require('./functions/neq')\nconst gte = require('./functions/gte')\nconst lte = require('./functions/lte')\nconst cmp = require('./functions/cmp')\nconst coerce = require('./functions/coerce')\nconst Comparator = require('./classes/comparator')\nconst Range = require('./classes/range')\nconst satisfies = require('./functions/satisfies')\nconst toComparators = require('./ranges/to-comparators')\nconst maxSatisfying = require('./ranges/max-satisfying')\nconst minSatisfying = require('./ranges/min-satisfying')\nconst minVersion = require('./ranges/min-version')\nconst validRange = require('./ranges/valid')\nconst outside = require('./ranges/outside')\nconst gtr = require('./ranges/gtr')\nconst ltr = require('./ranges/ltr')\nconst intersects = require('./ranges/intersects')\nconst simplifyRange = require('./ranges/simplify')\nconst subset = require('./ranges/subset')\nmodule.exports = {\n parse,\n valid,\n clean,\n inc,\n diff,\n major,\n minor,\n patch,\n prerelease,\n compare,\n rcompare,\n compareLoose,\n compareBuild,\n sort,\n rsort,\n gt,\n lt,\n eq,\n neq,\n gte,\n lte,\n cmp,\n coerce,\n Comparator,\n Range,\n satisfies,\n toComparators,\n maxSatisfying,\n minSatisfying,\n minVersion,\n validRange,\n outside,\n gtr,\n ltr,\n intersects,\n simplifyRange,\n subset,\n SemVer,\n re: internalRe.re,\n src: internalRe.src,\n tokens: internalRe.t,\n SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,\n RELEASE_TYPES: constants.RELEASE_TYPES,\n compareIdentifiers: identifiers.compareIdentifiers,\n rcompareIdentifiers: identifiers.rcompareIdentifiers,\n}\n","// Note: this is the semver.org version of the spec that it implements\n// Not necessarily the package version of this code.\nconst SEMVER_SPEC_VERSION = '2.0.0'\n\nconst MAX_LENGTH = 256\nconst MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||\n/* istanbul ignore next */ 9007199254740991\n\n// Max safe segment length for coercion.\nconst MAX_SAFE_COMPONENT_LENGTH = 16\n\n// Max safe length for a build identifier. The max length minus 6 characters for\n// the shortest version with a build 0.0.0+BUILD.\nconst MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6\n\nconst RELEASE_TYPES = [\n 'major',\n 'premajor',\n 'minor',\n 'preminor',\n 'patch',\n 'prepatch',\n 'prerelease',\n]\n\nmodule.exports = {\n MAX_LENGTH,\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_SAFE_INTEGER,\n RELEASE_TYPES,\n SEMVER_SPEC_VERSION,\n FLAG_INCLUDE_PRERELEASE: 0b001,\n FLAG_LOOSE: 0b010,\n}\n","const debug = (\n typeof process === 'object' &&\n process.env &&\n process.env.NODE_DEBUG &&\n /\\bsemver\\b/i.test(process.env.NODE_DEBUG)\n) ? (...args) => console.error('SEMVER', ...args)\n : () => {}\n\nmodule.exports = debug\n","const numeric = /^[0-9]+$/\nconst compareIdentifiers = (a, b) => {\n const anum = numeric.test(a)\n const bnum = numeric.test(b)\n\n if (anum && bnum) {\n a = +a\n b = +b\n }\n\n return a === b ? 0\n : (anum && !bnum) ? -1\n : (bnum && !anum) ? 1\n : a < b ? -1\n : 1\n}\n\nconst rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)\n\nmodule.exports = {\n compareIdentifiers,\n rcompareIdentifiers,\n}\n","class LRUCache {\n constructor () {\n this.max = 1000\n this.map = new Map()\n }\n\n get (key) {\n const value = this.map.get(key)\n if (value === undefined) {\n return undefined\n } else {\n // Remove the key from the map and add it to the end\n this.map.delete(key)\n this.map.set(key, value)\n return value\n }\n }\n\n delete (key) {\n return this.map.delete(key)\n }\n\n set (key, value) {\n const deleted = this.delete(key)\n\n if (!deleted && value !== undefined) {\n // If cache is full, delete the least recently used item\n if (this.map.size >= this.max) {\n const firstKey = this.map.keys().next().value\n this.delete(firstKey)\n }\n\n this.map.set(key, value)\n }\n\n return this\n }\n}\n\nmodule.exports = LRUCache\n","// parse out just the options we care about\nconst looseOption = Object.freeze({ loose: true })\nconst emptyOpts = Object.freeze({ })\nconst parseOptions = options => {\n if (!options) {\n return emptyOpts\n }\n\n if (typeof options !== 'object') {\n return looseOption\n }\n\n return options\n}\nmodule.exports = parseOptions\n","const {\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_LENGTH,\n} = require('./constants')\nconst debug = require('./debug')\nexports = module.exports = {}\n\n// The actual regexps go on exports.re\nconst re = exports.re = []\nconst safeRe = exports.safeRe = []\nconst src = exports.src = []\nconst t = exports.t = {}\nlet R = 0\n\nconst LETTERDASHNUMBER = '[a-zA-Z0-9-]'\n\n// Replace some greedy regex tokens to prevent regex dos issues. These regex are\n// used internally via the safeRe object since all inputs in this library get\n// normalized first to trim and collapse all extra whitespace. The original\n// regexes are exported for userland consumption and lower level usage. A\n// future breaking change could export the safer regex only with a note that\n// all input should have extra whitespace removed.\nconst safeRegexReplacements = [\n ['\\\\s', 1],\n ['\\\\d', MAX_LENGTH],\n [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],\n]\n\nconst makeSafeRegex = (value) => {\n for (const [token, max] of safeRegexReplacements) {\n value = value\n .split(`${token}*`).join(`${token}{0,${max}}`)\n .split(`${token}+`).join(`${token}{1,${max}}`)\n }\n return value\n}\n\nconst createToken = (name, value, isGlobal) => {\n const safe = makeSafeRegex(value)\n const index = R++\n debug(name, index, value)\n t[name] = index\n src[index] = value\n re[index] = new RegExp(value, isGlobal ? 'g' : undefined)\n safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined)\n}\n\n// The following Regular Expressions can be used for tokenizing,\n// validating, and parsing SemVer version strings.\n\n// ## Numeric Identifier\n// A single `0`, or a non-zero digit followed by zero or more digits.\n\ncreateToken('NUMERICIDENTIFIER', '0|[1-9]\\\\d*')\ncreateToken('NUMERICIDENTIFIERLOOSE', '\\\\d+')\n\n// ## Non-numeric Identifier\n// Zero or more digits, followed by a letter or hyphen, and then zero or\n// more letters, digits, or hyphens.\n\ncreateToken('NONNUMERICIDENTIFIER', `\\\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`)\n\n// ## Main Version\n// Three dot-separated numeric identifiers.\n\ncreateToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version Identifier\n// A numeric identifier, or a non-numeric identifier.\n\ncreateToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]\n}|${src[t.NONNUMERICIDENTIFIER]})`)\n\ncreateToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]\n}|${src[t.NONNUMERICIDENTIFIER]})`)\n\n// ## Pre-release Version\n// Hyphen, followed by one or more dot-separated pre-release version\n// identifiers.\n\ncreateToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIER]})*))`)\n\ncreateToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)\n\n// ## Build Metadata Identifier\n// Any combination of digits, letters, or hyphens.\n\ncreateToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`)\n\n// ## Build Metadata\n// Plus sign, followed by one or more period-separated build metadata\n// identifiers.\n\ncreateToken('BUILD', `(?:\\\\+(${src[t.BUILDIDENTIFIER]\n}(?:\\\\.${src[t.BUILDIDENTIFIER]})*))`)\n\n// ## Full Version String\n// A main version, followed optionally by a pre-release version and\n// build metadata.\n\n// Note that the only major, minor, patch, and pre-release sections of\n// the version string are capturing groups. The build metadata is not a\n// capturing group, because it should not ever be used in version\n// comparison.\n\ncreateToken('FULLPLAIN', `v?${src[t.MAINVERSION]\n}${src[t.PRERELEASE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('FULL', `^${src[t.FULLPLAIN]}$`)\n\n// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.\n// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty\n// common in the npm registry.\ncreateToken('LOOSEPLAIN', `[v=\\\\s]*${src[t.MAINVERSIONLOOSE]\n}${src[t.PRERELEASELOOSE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)\n\ncreateToken('GTLT', '((?:<|>)?=?)')\n\n// Something like \"2.*\" or \"1.2.x\".\n// Note that \"x.x\" is a valid xRange identifer, meaning \"any version\"\n// Only the first item is strictly required.\ncreateToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\\\*`)\ncreateToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\\\*`)\n\ncreateToken('XRANGEPLAIN', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:${src[t.PRERELEASE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGEPLAINLOOSE', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:${src[t.PRERELEASELOOSE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAIN]}$`)\ncreateToken('XRANGELOOSE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Coercion.\n// Extract anything that could conceivably be a part of a valid semver\ncreateToken('COERCEPLAIN', `${'(^|[^\\\\d])' +\n '(\\\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`)\ncreateToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\\\d])`)\ncreateToken('COERCEFULL', src[t.COERCEPLAIN] +\n `(?:${src[t.PRERELEASE]})?` +\n `(?:${src[t.BUILD]})?` +\n `(?:$|[^\\\\d])`)\ncreateToken('COERCERTL', src[t.COERCE], true)\ncreateToken('COERCERTLFULL', src[t.COERCEFULL], true)\n\n// Tilde ranges.\n// Meaning is \"reasonably at or greater than\"\ncreateToken('LONETILDE', '(?:~>?)')\n\ncreateToken('TILDETRIM', `(\\\\s*)${src[t.LONETILDE]}\\\\s+`, true)\nexports.tildeTrimReplace = '$1~'\n\ncreateToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Caret ranges.\n// Meaning is \"at least and backwards compatible with\"\ncreateToken('LONECARET', '(?:\\\\^)')\n\ncreateToken('CARETTRIM', `(\\\\s*)${src[t.LONECARET]}\\\\s+`, true)\nexports.caretTrimReplace = '$1^'\n\ncreateToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// A simple gt/lt/eq thing, or just \"\" to indicate \"any version\"\ncreateToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\\\s*(${src[t.LOOSEPLAIN]})$|^$`)\ncreateToken('COMPARATOR', `^${src[t.GTLT]}\\\\s*(${src[t.FULLPLAIN]})$|^$`)\n\n// An expression to strip any whitespace between the gtlt and the thing\n// it modifies, so that `> 1.2.3` ==> `>1.2.3`\ncreateToken('COMPARATORTRIM', `(\\\\s*)${src[t.GTLT]\n}\\\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)\nexports.comparatorTrimReplace = '$1$2$3'\n\n// Something like `1.2.3 - 1.2.4`\n// Note that these all use the loose form, because they'll be\n// checked against either the strict or loose comparator form\n// later.\ncreateToken('HYPHENRANGE', `^\\\\s*(${src[t.XRANGEPLAIN]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAIN]})` +\n `\\\\s*$`)\n\ncreateToken('HYPHENRANGELOOSE', `^\\\\s*(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s*$`)\n\n// Star ranges basically just allow anything at all.\ncreateToken('STAR', '(<|>)?=?\\\\s*\\\\*')\n// >=0.0.0 is like a star\ncreateToken('GTE0', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0\\\\s*$')\ncreateToken('GTE0PRE', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0-0\\\\s*$')\n","// Determine if version is greater than all the versions possible in the range.\nconst outside = require('./outside')\nconst gtr = (version, range, options) => outside(version, range, '>', options)\nmodule.exports = gtr\n","const Range = require('../classes/range')\nconst intersects = (r1, r2, options) => {\n r1 = new Range(r1, options)\n r2 = new Range(r2, options)\n return r1.intersects(r2, options)\n}\nmodule.exports = intersects\n","const outside = require('./outside')\n// Determine if version is less than all the versions possible in the range\nconst ltr = (version, range, options) => outside(version, range, '<', options)\nmodule.exports = ltr\n","const SemVer = require('../classes/semver')\nconst Range = require('../classes/range')\n\nconst maxSatisfying = (versions, range, options) => {\n let max = null\n let maxSV = null\n let rangeObj = null\n try {\n rangeObj = new Range(range, options)\n } catch (er) {\n return null\n }\n versions.forEach((v) => {\n if (rangeObj.test(v)) {\n // satisfies(v, range, options)\n if (!max || maxSV.compare(v) === -1) {\n // compare(max, v, true)\n max = v\n maxSV = new SemVer(max, options)\n }\n }\n })\n return max\n}\nmodule.exports = maxSatisfying\n","const SemVer = require('../classes/semver')\nconst Range = require('../classes/range')\nconst minSatisfying = (versions, range, options) => {\n let min = null\n let minSV = null\n let rangeObj = null\n try {\n rangeObj = new Range(range, options)\n } catch (er) {\n return null\n }\n versions.forEach((v) => {\n if (rangeObj.test(v)) {\n // satisfies(v, range, options)\n if (!min || minSV.compare(v) === 1) {\n // compare(min, v, true)\n min = v\n minSV = new SemVer(min, options)\n }\n }\n })\n return min\n}\nmodule.exports = minSatisfying\n","const SemVer = require('../classes/semver')\nconst Range = require('../classes/range')\nconst gt = require('../functions/gt')\n\nconst minVersion = (range, loose) => {\n range = new Range(range, loose)\n\n let minver = new SemVer('0.0.0')\n if (range.test(minver)) {\n return minver\n }\n\n minver = new SemVer('0.0.0-0')\n if (range.test(minver)) {\n return minver\n }\n\n minver = null\n for (let i = 0; i < range.set.length; ++i) {\n const comparators = range.set[i]\n\n let setMin = null\n comparators.forEach((comparator) => {\n // Clone to avoid manipulating the comparator's semver object.\n const compver = new SemVer(comparator.semver.version)\n switch (comparator.operator) {\n case '>':\n if (compver.prerelease.length === 0) {\n compver.patch++\n } else {\n compver.prerelease.push(0)\n }\n compver.raw = compver.format()\n /* fallthrough */\n case '':\n case '>=':\n if (!setMin || gt(compver, setMin)) {\n setMin = compver\n }\n break\n case '<':\n case '<=':\n /* Ignore maximum versions */\n break\n /* istanbul ignore next */\n default:\n throw new Error(`Unexpected operation: ${comparator.operator}`)\n }\n })\n if (setMin && (!minver || gt(minver, setMin))) {\n minver = setMin\n }\n }\n\n if (minver && range.test(minver)) {\n return minver\n }\n\n return null\n}\nmodule.exports = minVersion\n","const SemVer = require('../classes/semver')\nconst Comparator = require('../classes/comparator')\nconst { ANY } = Comparator\nconst Range = require('../classes/range')\nconst satisfies = require('../functions/satisfies')\nconst gt = require('../functions/gt')\nconst lt = require('../functions/lt')\nconst lte = require('../functions/lte')\nconst gte = require('../functions/gte')\n\nconst outside = (version, range, hilo, options) => {\n version = new SemVer(version, options)\n range = new Range(range, options)\n\n let gtfn, ltefn, ltfn, comp, ecomp\n switch (hilo) {\n case '>':\n gtfn = gt\n ltefn = lte\n ltfn = lt\n comp = '>'\n ecomp = '>='\n break\n case '<':\n gtfn = lt\n ltefn = gte\n ltfn = gt\n comp = '<'\n ecomp = '<='\n break\n default:\n throw new TypeError('Must provide a hilo val of \"<\" or \">\"')\n }\n\n // If it satisfies the range it is not outside\n if (satisfies(version, range, options)) {\n return false\n }\n\n // From now on, variable terms are as if we're in \"gtr\" mode.\n // but note that everything is flipped for the \"ltr\" function.\n\n for (let i = 0; i < range.set.length; ++i) {\n const comparators = range.set[i]\n\n let high = null\n let low = null\n\n comparators.forEach((comparator) => {\n if (comparator.semver === ANY) {\n comparator = new Comparator('>=0.0.0')\n }\n high = high || comparator\n low = low || comparator\n if (gtfn(comparator.semver, high.semver, options)) {\n high = comparator\n } else if (ltfn(comparator.semver, low.semver, options)) {\n low = comparator\n }\n })\n\n // If the edge version comparator has a operator then our version\n // isn't outside it\n if (high.operator === comp || high.operator === ecomp) {\n return false\n }\n\n // If the lowest version comparator has an operator and our version\n // is less than it then it isn't higher than the range\n if ((!low.operator || low.operator === comp) &&\n ltefn(version, low.semver)) {\n return false\n } else if (low.operator === ecomp && ltfn(version, low.semver)) {\n return false\n }\n }\n return true\n}\n\nmodule.exports = outside\n","// given a set of versions and a range, create a \"simplified\" range\n// that includes the same versions that the original range does\n// If the original range is shorter than the simplified one, return that.\nconst satisfies = require('../functions/satisfies.js')\nconst compare = require('../functions/compare.js')\nmodule.exports = (versions, range, options) => {\n const set = []\n let first = null\n let prev = null\n const v = versions.sort((a, b) => compare(a, b, options))\n for (const version of v) {\n const included = satisfies(version, range, options)\n if (included) {\n prev = version\n if (!first) {\n first = version\n }\n } else {\n if (prev) {\n set.push([first, prev])\n }\n prev = null\n first = null\n }\n }\n if (first) {\n set.push([first, null])\n }\n\n const ranges = []\n for (const [min, max] of set) {\n if (min === max) {\n ranges.push(min)\n } else if (!max && min === v[0]) {\n ranges.push('*')\n } else if (!max) {\n ranges.push(`>=${min}`)\n } else if (min === v[0]) {\n ranges.push(`<=${max}`)\n } else {\n ranges.push(`${min} - ${max}`)\n }\n }\n const simplified = ranges.join(' || ')\n const original = typeof range.raw === 'string' ? range.raw : String(range)\n return simplified.length < original.length ? simplified : range\n}\n","const Range = require('../classes/range.js')\nconst Comparator = require('../classes/comparator.js')\nconst { ANY } = Comparator\nconst satisfies = require('../functions/satisfies.js')\nconst compare = require('../functions/compare.js')\n\n// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:\n// - Every simple range `r1, r2, ...` is a null set, OR\n// - Every simple range `r1, r2, ...` which is not a null set is a subset of\n// some `R1, R2, ...`\n//\n// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:\n// - If c is only the ANY comparator\n// - If C is only the ANY comparator, return true\n// - Else if in prerelease mode, return false\n// - else replace c with `[>=0.0.0]`\n// - If C is only the ANY comparator\n// - if in prerelease mode, return true\n// - else replace C with `[>=0.0.0]`\n// - Let EQ be the set of = comparators in c\n// - If EQ is more than one, return true (null set)\n// - Let GT be the highest > or >= comparator in c\n// - Let LT be the lowest < or <= comparator in c\n// - If GT and LT, and GT.semver > LT.semver, return true (null set)\n// - If any C is a = range, and GT or LT are set, return false\n// - If EQ\n// - If GT, and EQ does not satisfy GT, return true (null set)\n// - If LT, and EQ does not satisfy LT, return true (null set)\n// - If EQ satisfies every C, return true\n// - Else return false\n// - If GT\n// - If GT.semver is lower than any > or >= comp in C, return false\n// - If GT is >=, and GT.semver does not satisfy every C, return false\n// - If GT.semver has a prerelease, and not in prerelease mode\n// - If no C has a prerelease and the GT.semver tuple, return false\n// - If LT\n// - If LT.semver is greater than any < or <= comp in C, return false\n// - If LT is <=, and LT.semver does not satisfy every C, return false\n// - If GT.semver has a prerelease, and not in prerelease mode\n// - If no C has a prerelease and the LT.semver tuple, return false\n// - Else return true\n\nconst subset = (sub, dom, options = {}) => {\n if (sub === dom) {\n return true\n }\n\n sub = new Range(sub, options)\n dom = new Range(dom, options)\n let sawNonNull = false\n\n OUTER: for (const simpleSub of sub.set) {\n for (const simpleDom of dom.set) {\n const isSub = simpleSubset(simpleSub, simpleDom, options)\n sawNonNull = sawNonNull || isSub !== null\n if (isSub) {\n continue OUTER\n }\n }\n // the null set is a subset of everything, but null simple ranges in\n // a complex range should be ignored. so if we saw a non-null range,\n // then we know this isn't a subset, but if EVERY simple range was null,\n // then it is a subset.\n if (sawNonNull) {\n return false\n }\n }\n return true\n}\n\nconst minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')]\nconst minimumVersion = [new Comparator('>=0.0.0')]\n\nconst simpleSubset = (sub, dom, options) => {\n if (sub === dom) {\n return true\n }\n\n if (sub.length === 1 && sub[0].semver === ANY) {\n if (dom.length === 1 && dom[0].semver === ANY) {\n return true\n } else if (options.includePrerelease) {\n sub = minimumVersionWithPreRelease\n } else {\n sub = minimumVersion\n }\n }\n\n if (dom.length === 1 && dom[0].semver === ANY) {\n if (options.includePrerelease) {\n return true\n } else {\n dom = minimumVersion\n }\n }\n\n const eqSet = new Set()\n let gt, lt\n for (const c of sub) {\n if (c.operator === '>' || c.operator === '>=') {\n gt = higherGT(gt, c, options)\n } else if (c.operator === '<' || c.operator === '<=') {\n lt = lowerLT(lt, c, options)\n } else {\n eqSet.add(c.semver)\n }\n }\n\n if (eqSet.size > 1) {\n return null\n }\n\n let gtltComp\n if (gt && lt) {\n gtltComp = compare(gt.semver, lt.semver, options)\n if (gtltComp > 0) {\n return null\n } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) {\n return null\n }\n }\n\n // will iterate one or zero times\n for (const eq of eqSet) {\n if (gt && !satisfies(eq, String(gt), options)) {\n return null\n }\n\n if (lt && !satisfies(eq, String(lt), options)) {\n return null\n }\n\n for (const c of dom) {\n if (!satisfies(eq, String(c), options)) {\n return false\n }\n }\n\n return true\n }\n\n let higher, lower\n let hasDomLT, hasDomGT\n // if the subset has a prerelease, we need a comparator in the superset\n // with the same tuple and a prerelease, or it's not a subset\n let needDomLTPre = lt &&\n !options.includePrerelease &&\n lt.semver.prerelease.length ? lt.semver : false\n let needDomGTPre = gt &&\n !options.includePrerelease &&\n gt.semver.prerelease.length ? gt.semver : false\n // exception: <1.2.3-0 is the same as <1.2.3\n if (needDomLTPre && needDomLTPre.prerelease.length === 1 &&\n lt.operator === '<' && needDomLTPre.prerelease[0] === 0) {\n needDomLTPre = false\n }\n\n for (const c of dom) {\n hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>='\n hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<='\n if (gt) {\n if (needDomGTPre) {\n if (c.semver.prerelease && c.semver.prerelease.length &&\n c.semver.major === needDomGTPre.major &&\n c.semver.minor === needDomGTPre.minor &&\n c.semver.patch === needDomGTPre.patch) {\n needDomGTPre = false\n }\n }\n if (c.operator === '>' || c.operator === '>=') {\n higher = higherGT(gt, c, options)\n if (higher === c && higher !== gt) {\n return false\n }\n } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) {\n return false\n }\n }\n if (lt) {\n if (needDomLTPre) {\n if (c.semver.prerelease && c.semver.prerelease.length &&\n c.semver.major === needDomLTPre.major &&\n c.semver.minor === needDomLTPre.minor &&\n c.semver.patch === needDomLTPre.patch) {\n needDomLTPre = false\n }\n }\n if (c.operator === '<' || c.operator === '<=') {\n lower = lowerLT(lt, c, options)\n if (lower === c && lower !== lt) {\n return false\n }\n } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) {\n return false\n }\n }\n if (!c.operator && (lt || gt) && gtltComp !== 0) {\n return false\n }\n }\n\n // if there was a < or >, and nothing in the dom, then must be false\n // UNLESS it was limited by another range in the other direction.\n // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0\n if (gt && hasDomLT && !lt && gtltComp !== 0) {\n return false\n }\n\n if (lt && hasDomGT && !gt && gtltComp !== 0) {\n return false\n }\n\n // we needed a prerelease range in a specific tuple, but didn't get one\n // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0,\n // because it includes prereleases in the 1.2.3 tuple\n if (needDomGTPre || needDomLTPre) {\n return false\n }\n\n return true\n}\n\n// >=1.2.3 is lower than >1.2.3\nconst higherGT = (a, b, options) => {\n if (!a) {\n return b\n }\n const comp = compare(a.semver, b.semver, options)\n return comp > 0 ? a\n : comp < 0 ? b\n : b.operator === '>' && a.operator === '>=' ? b\n : a\n}\n\n// <=1.2.3 is higher than <1.2.3\nconst lowerLT = (a, b, options) => {\n if (!a) {\n return b\n }\n const comp = compare(a.semver, b.semver, options)\n return comp < 0 ? a\n : comp > 0 ? b\n : b.operator === '<' && a.operator === '<=' ? b\n : a\n}\n\nmodule.exports = subset\n","const Range = require('../classes/range')\n\n// Mostly just for testing and legacy API reasons\nconst toComparators = (range, options) =>\n new Range(range, options).set\n .map(comp => comp.map(c => c.value).join(' ').trim().split(' '))\n\nmodule.exports = toComparators\n","const Range = require('../classes/range')\nconst validRange = (range, options) => {\n try {\n // Return '*' instead of '' so that truthiness works.\n // This will throw if it's invalid anyway\n return new Range(range, options).range || '*'\n } catch (er) {\n return null\n }\n}\nmodule.exports = validRange\n","import type { Config } from './config';\nimport type { BinderUrlSet, RepoProviderSpec } from './types';\n\nexport function makeDefaultStorageKey(storagePrefix: string, url: string) {\n const urlObj = new URL(url);\n // ignore the query string and hash\n return `${storagePrefix}-${urlObj.origin + urlObj.pathname}`;\n}\n\nfunction makeDefaultBuildSpec(storagePrefix: string, binderUrl: string, stub: string) {\n const build = `${binderUrl}/build/${stub}`;\n const launch = `${binderUrl}/v2/${stub}`;\n\n return {\n build,\n launch,\n storageKey: makeDefaultStorageKey(storagePrefix, build),\n };\n}\n\n/**\n * Make a binder url for git providers\n *\n * - trim trailing or leading '/' on repo\n * - trailing / on binderUrl\n * - convert to URL acceptable string. Required for git\n *\n * @param opts BinderOptions\n * @returns a binder compatible url\n */\nfunction makeGitUrls(config: Config) {\n if (!config.binder.repo) throw Error('repo is required for git provider');\n const { repo, binderUrl, ref } = config.binder;\n const encodedRepo = encodeURIComponent(repo.replace(/(^\\/)|(\\/?$)/g, ''));\n const base = binderUrl?.replace(/(\\/?$)/g, '');\n const stub = `git/${encodedRepo}/${ref ?? 'HEAD'}`;\n return makeDefaultBuildSpec(config.savedSessions.storagePrefix, base, stub);\n}\n\n/**\n * Make a binder url for gitlab providers\n *\n * - trim gitlab.com from repo\n * - trim trailing or leading '/' on repo\n * - convert to URL acceptable string. Required for gitlab\n * - trailing / on binderUrl\n *\n * @param opts BinderOptions\n * @returns a binder compatible url\n */\nfunction makeGitLabUrl(config: Config) {\n if (!config.binder.repo) throw Error('repo is required for gitlab provider');\n const binderUrl = config.binder.binderUrl?.replace(/(\\/?$)/g, '');\n const repo = encodeURIComponent(\n (config.binder.repo ?? '')\n .replace(/^(https?:\\/\\/)?gitlab.com\\//, '')\n .replace(/(^\\/)|(\\/?$)/g, ''),\n );\n const stub = `gl/${repo}/${config.binder.ref ?? 'HEAD'}`;\n return makeDefaultBuildSpec(config.savedSessions.storagePrefix, binderUrl, stub);\n}\n\n/**\n * Make a binder url for gitlab providers\n *\n * - trim github.com from repo\n * - trim trailing or leading '/' on repo\n * - convert to URL acceptable string. Required for gitlab\n * - trailing / on binderUrl\n *\n * @param opts BinderOptions\n * @returns a binder compatible url\n */\nfunction makeGitHubUrl(config: Config) {\n if (!config.binder.repo) throw Error('repo is required for github provider');\n const repo = config.binder.repo\n .replace(/^(https?:\\/\\/)?github.com\\//, '')\n .replace(/(^\\/)|(\\/?$)/g, '');\n const binderUrl = config.binder.binderUrl?.replace(/(\\/?$)/g, '');\n const stub = `gh/${repo}/${config.binder.ref ?? 'HEAD'}`;\n\n return makeDefaultBuildSpec(config.savedSessions.storagePrefix, binderUrl, stub);\n}\n\nfunction makeGistUrl(config: Config) {\n if (!config.binder.repo) throw Error('repo is required for gist provider');\n const repo = config.binder.repo\n .replace(/^(https?:\\/\\/)?github.com\\//, '')\n .replace(/(^\\/)|(\\/?$)/g, '');\n const binderUrl = config.binder.binderUrl?.replace(/(\\/?$)/g, '');\n const stub = `gist/${repo}/${config.binder.ref ?? 'HEAD'}`;\n\n return makeDefaultBuildSpec(config.savedSessions.storagePrefix, binderUrl, stub);\n}\n\nexport const GITHUB_SPEC: RepoProviderSpec = {\n name: 'github',\n makeUrls: makeGitHubUrl,\n};\n\nexport const GITLAB_SPEC: RepoProviderSpec = {\n name: 'gitlab',\n makeUrls: makeGitLabUrl,\n};\n\nexport const GIT_SPEC: RepoProviderSpec = {\n name: 'git',\n makeUrls: makeGitUrls,\n};\n\nexport const GIST_SPEC: RepoProviderSpec = {\n name: 'gist',\n makeUrls: makeGistUrl,\n};\n\nexport const WELL_KNOWN_REPO_PROVIDERS = [GITHUB_SPEC, GITLAB_SPEC, GIT_SPEC, GIST_SPEC];\n\n/**\n * Make a binder url for both well known or custom providers\n *\n * Custom providers are supported by passing in an array of CustomRepoProviderSpecs.\n *\n */\nexport function makeBinderUrls(config: Config, repoProviders: RepoProviderSpec[]): BinderUrlSet {\n const providerMap: Record =\n repoProviders.reduce((obj, spec) => ({ ...obj, [spec.name]: spec }), {}) ?? {};\n\n const provider = config.binder.repoProvider ?? 'github';\n if (!Object.keys(providerMap).includes(provider))\n throw Error(`Unknown provider ${config.binder.repoProvider}`);\n\n if (!providerMap[provider].makeUrls) throw Error(`No makeUrls function for ${provider}`);\n\n return providerMap[provider].makeUrls(config);\n}\n","import type ThebeCodeCell from './cell';\nimport type ThebeNotebook from './notebook';\nimport type ThebeServer from './server';\nimport type ThebeSession from './session';\nimport type { IError } from '@jupyterlab/nbformat';\n\n// value of some of these enums are not arbitrary\n// but relate to events sent from the server via the\n// event stream\nexport enum ServerStatusEvent {\n 'launching' = 'launching',\n 'ready' = 'server-ready',\n 'closed' = 'closed',\n 'unknown' = 'unknown',\n}\n\nexport enum SessionStatusEvent {\n 'starting' = 'starting',\n 'ready' = 'ready',\n 'shutdown' = 'shutdown',\n}\n\nexport enum KernelStatusEvent {\n 'starting' = 'starting',\n 'ready' = 'ready',\n 'shutdown' = 'shutdown',\n}\n\nexport enum NotebookStatusEvent {\n 'attached' = 'attached',\n 'detached' = 'detached',\n 'executing' = 'executing',\n 'idle' = 'idle',\n}\n\nexport enum CellStatusEvent {\n 'attached' = 'attached',\n 'detached' = 'detached',\n 'executing' = 'executing',\n 'idle' = 'idle',\n}\n\nexport enum EventSubject {\n 'server' = 'server',\n 'session' = 'session',\n 'kernel' = 'kernel',\n 'notebook' = 'notebook',\n 'cell' = 'cell',\n}\n\n// TODO improve typing around status's\nexport enum ErrorStatusEvent {\n 'warning' = 'warning',\n 'executeError' = 'execute-error',\n 'error' = 'error',\n 'server' = 'server-error',\n 'session' = 'session-error',\n}\n\nexport function errorToMessage(json: IError): string {\n if (!json.traceback) {\n return json.evalue;\n } else if (Array.isArray(json.traceback)) {\n return `${json.evalue}\\n${(json.traceback ?? []).join('')}`;\n } else {\n return `${json.evalue}\\n${JSON.stringify(json.traceback)}`;\n }\n}\n\nexport enum ThebeEventType {\n 'status' = 'status',\n 'error' = 'error',\n}\n\nexport type EventObject = ThebeServer | ThebeSession | ThebeNotebook | ThebeCodeCell;\n\nexport type StatusEvent =\n | ServerStatusEvent\n | SessionStatusEvent\n | NotebookStatusEvent\n | CellStatusEvent\n | KernelStatusEvent\n | ErrorStatusEvent;\n\nexport interface ThebeEventData {\n subject?: EventSubject;\n id?: string;\n status?: StatusEvent;\n message: string;\n object?: EventObject;\n}\n\nexport type ThebeEventCb = (event: string, data: ThebeEventData) => void;\n\nexport class ThebeEvents {\n listeners: Record>;\n\n constructor() {\n this.listeners = {};\n }\n\n _ensureMap(event: string) {\n if (!(event in this.listeners)) this.listeners[event] = new Map();\n }\n\n trigger(event: ThebeEventType, evt: ThebeEventData) {\n if (!(event in this.listeners)) return;\n this.listeners[event].forEach(({ unbind }, cb) => {\n cb(event, evt);\n if (unbind) this.listeners[event].delete(cb);\n });\n }\n\n on(event: ThebeEventType, cb: ThebeEventCb) {\n this._ensureMap(event);\n this.listeners[event].set(cb, { unbind: false });\n return () => this.off(event, cb);\n }\n\n one(event: ThebeEventType, cb: ThebeEventCb) {\n this._ensureMap(event);\n this.listeners[event].set(cb, { unbind: true });\n return () => this.off(event, cb);\n }\n\n off(event: ThebeEventType, cb: ThebeEventCb) {\n if (!(event in this.listeners)) return;\n this.listeners[event].delete(cb);\n }\n}\n","import { KernelAPI, ServerConnection } from '@jupyterlab/services';\nimport type { SavedSessionInfo, SavedSessionOptions, ServerSettings } from './types';\n\nexport function removeServerInfo(storageKey: string) {\n window.localStorage.removeItem(storageKey);\n}\n\nexport function updateLastUsedTimestamp(storageKey: string) {\n const saved = window.localStorage.getItem(storageKey);\n if (!saved) return;\n const obj = JSON.parse(saved);\n window.localStorage.setItem(storageKey, JSON.stringify({ ...obj, lastUsed: new Date() }));\n}\n\nexport function saveServerInfo(\n storageKey: string,\n id: string,\n serverSettings: Required,\n) {\n try {\n // save the current connection url+token to reuse later\n const { baseUrl, token, wsUrl } = serverSettings;\n window.localStorage.setItem(\n storageKey,\n JSON.stringify({\n id,\n baseUrl,\n token,\n wsUrl,\n lastUsed: new Date(),\n }),\n );\n } catch (e) {\n // storage quota full, gently ignore nonfatal error\n console.warn(\"Couldn't save thebe binder connection info to local storage\", e);\n }\n}\n\nexport async function getExistingServer(\n savedSessionOptions: Required,\n storageKey: string,\n): Promise {\n if (!savedSessionOptions.enabled) return null;\n const storedInfoJSON = window.localStorage.getItem(storageKey);\n if (storedInfoJSON == null) {\n console.debug('thebe:getExistingServer No session saved in ', storageKey);\n return null;\n }\n\n console.debug('thebe:getExistingServer Saved binder session found');\n const existingSettings = JSON.parse(storedInfoJSON ?? '') as SavedSessionInfo;\n const lastUsed = new Date(existingSettings.lastUsed);\n const now = new Date();\n const ageSeconds = (now.getTime() - lastUsed.getTime()) / 1000;\n if (ageSeconds > savedSessionOptions.maxAge) {\n console.debug(\n `thebe:getExistingServer Not using expired binder session for ${existingSettings.baseUrl} from ${lastUsed}`,\n );\n window.localStorage.removeItem(storageKey);\n return null;\n }\n\n try {\n await KernelAPI.listRunning(ServerConnection.makeSettings(existingSettings));\n } catch (err) {\n console.debug(\n 'thebe:getExistingServer Saved binder connection appears to be invalid, requesting new session',\n err,\n );\n window.localStorage.removeItem(storageKey);\n return null;\n }\n\n // refresh lastUsed timestamp in stored info\n updateLastUsedTimestamp(storageKey);\n console.debug(\n `thebe:getExistingServer Saved binder session is valid and will be reused ${existingSettings.baseUrl}`,\n );\n\n return existingSettings;\n}\n\n/**\n * Remove all saved sessions items from local storage based on the storagePrefix provided.\n * The appropriate (default) storage prefix will be available in the SavedSessionOptions object\n * in the Config object.\n *\n * @param storagePrefix\n */\nexport function clearAllSavedSessions(storagePrefix = 'thebe-binder') {\n const keysToRemove: string[] = [];\n for (let i = 0; i < window.localStorage.length; i++) {\n const key = window.localStorage.key(i);\n if (key?.startsWith(storagePrefix)) {\n keysToRemove.push(key);\n }\n }\n console.debug(\n `thebe:clearAllSavedSessions - removing ${keysToRemove.length} saved sessions`,\n keysToRemove.join(','),\n );\n keysToRemove.forEach((key) => window.localStorage.removeItem(key));\n}\n\n/**\n * Remove all saved sessions items from local storage based on the storagePrefix provided.\n * The appropriate (default) storage prefix will be available in the SavedSessionOptions object\n * in the Config object.\n *\n * @param storagePrefix\n * @param url\n */\nexport function clearSavedSession(storageKey: string) {\n console.debug(`thebe:clearSavedSession - removing ${storageKey}`);\n window.localStorage.removeItem(storageKey);\n}\n","import { urlAlphabet } from './url-alphabet/index.js'\nlet random = bytes => crypto.getRandomValues(new Uint8Array(bytes))\nlet customRandom = (alphabet, defaultSize, getRandom) => {\n let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1\n let step = -~((1.6 * mask * defaultSize) / alphabet.length)\n return (size = defaultSize) => {\n let id = ''\n while (true) {\n let bytes = getRandom(step)\n let j = step\n while (j--) {\n id += alphabet[bytes[j] & mask] || ''\n if (id.length === size) return id\n }\n }\n }\n}\nlet customAlphabet = (alphabet, size = 21) =>\n customRandom(alphabet, size, random)\nlet nanoid = (size = 21) =>\n crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => {\n byte &= 63\n if (byte < 36) {\n id += byte.toString(36)\n } else if (byte < 62) {\n id += (byte - 26).toString(36).toUpperCase()\n } else if (byte > 62) {\n id += '-'\n } else {\n id += '_'\n }\n return id\n }, '')\nexport { nanoid, customAlphabet, customRandom, urlAlphabet, random }\n","import { customAlphabet } from 'nanoid';\nimport { WIDGET_MIMETYPE } from './manager';\nimport type * as nbformat from '@jupyterlab/nbformat';\n\nconst nanoid = customAlphabet('1234567890abcdef', 8);\n\n/**\n * Creates a compact random id for use in runtime objects\n *\n * @returns string\n */\nexport function shortId() {\n return nanoid();\n}\n\nexport function ensureString(maybeString: string[] | string): string {\n if (Array.isArray(maybeString)) return maybeString.join('\\n');\n return maybeString;\n}\n\nexport function isMimeBundle({ output_type }: nbformat.IOutput) {\n return output_type === 'display_data' || output_type === 'execute_result';\n}\n\nexport function placeholder(plainText?: string) {\n return `\n
\n
\n
ipywidgets - a Jupyter kernel connection is required to fully display this output.
\n ${plainText && `
${plainText}
`}\n
\n`;\n}\n\nexport function stripWidgets(\n outputs: nbformat.IOutput[],\n hideWidgets = true,\n placeholderFn: (plainText?: string) => string = placeholder,\n) {\n return outputs.map((output: nbformat.IOutput) => {\n if (!isMimeBundle(output)) return output;\n const { [WIDGET_MIMETYPE]: widgets, ...others } = output.data as nbformat.IMimeBundle;\n if (!widgets) return output;\n\n let data = output.data;\n if (hideWidgets) data = { ...others };\n\n if (placeholderFn && !('text/html' in (data as nbformat.IMimeBundle)))\n // if there is not already an html bundle, add a placeholder to hide the plain/text field\n (data as nbformat.IMimeBundle)['text/html'] = placeholderFn(\n ensureString((data as nbformat.IMimeBundle)['text/plain'] as string | string[]),\n );\n\n const stripped = {\n ...output,\n data,\n };\n return stripped;\n });\n}\n","/**\n * Inspired by https://github.com/jupyterlab/jupyterlab-plugin-playground/blob/main/src/requirejs.ts\n */\n\nconst REQUIREJS_CDN_URL = 'https://cdn.jsdelivr.net/npm/';\nconst REQUIREJS_URL = 'https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js';\n\nexport interface IRequireJS {\n readonly require: Require;\n readonly define: RequireDefine;\n}\n\nasync function fetchAndLoadInFrame(baseUrl: string): Promise {\n if (typeof document === 'undefined')\n throw new Error('Cannot load requirejs outside of the browser');\n\n const res = await fetch(REQUIREJS_URL);\n if (!res.ok) {\n throw new Error(`Could not fetch requirejs ${res.status} ${res.statusText}`);\n }\n\n const requireJsSource = await res.text();\n\n return new Promise((resolve, reject) => {\n const iframe = document.createElement('iframe');\n iframe.style.display = 'none';\n iframe.onload = () => {\n const contentWindow = iframe.contentWindow;\n if (!contentWindow) return reject('Cannot load in isolated: no contentWindow, origin error?');\n\n contentWindow.window.eval(requireJsSource);\n const requirejs: IRequireJS = {\n require: (contentWindow.window as any).require,\n define: (contentWindow.window as any).define,\n };\n if (!requirejs.require || !requirejs.define)\n return reject(\n 'Require.js loading did not result in `require` and `define` objects attachment to window',\n );\n\n requirejs.require.config({ baseUrl });\n\n resolve(requirejs);\n iframe.onload = null;\n };\n document.body.appendChild(iframe);\n });\n}\n\nexport class RequireJsLoader {\n requested: boolean;\n readonly baseUrl: string;\n readonly ready: Promise;\n requirejs?: IRequireJS;\n private resolveFn: (value: IRequireJS | PromiseLike) => void;\n\n constructor(baseUrl?: string) {\n this.baseUrl = baseUrl ?? REQUIREJS_CDN_URL;\n this.requested = false;\n this.resolveFn = () => ({});\n this.ready = new Promise((resolve) => (this.resolveFn = resolve));\n }\n\n async load(postLoadFn?: (require: Require, define: RequireDefine) => Promise | void) {\n if (!this.requested) {\n this.requested = true;\n this.requirejs = await fetchAndLoadInFrame(this.baseUrl);\n await postLoadFn?.(this.requirejs.require, this.requirejs.define);\n this.resolveFn(this.requirejs);\n }\n return this.ready;\n }\n}\n","import type { IRequireJS } from './requireJsLoader';\n\nconst cdn = 'https://cdn.jsdelivr.net/npm/';\n\n/**\n * Load a package using requirejs and return a promise\n */\nfunction requirePromise(requirejs: IRequireJS, moduleName: string) {\n return new Promise((resolve, reject) => requirejs.require([`${moduleName}`], resolve, reject));\n}\n\n/**\n * The URL structure is /npm/package@version/file.js\n */\nfunction moduleNameToCDNUrl(moduleName: string, moduleVersion: string) {\n let packageName = moduleName;\n let fileName = 'index'; // default filename\n // if a '/' is present, like 'foo/bar', packageName is changed to 'foo', and path to 'bar'\n // We first find the first '/'\n let index = moduleName.indexOf('/');\n if (index !== -1 && moduleName[0] === '@') {\n // if we have a namespace, it's a different story\n // @foo/bar/baz should translate to @foo/bar and baz\n // so we find the 2nd '/'\n index = moduleName.indexOf('/', index + 1);\n }\n if (index !== -1) {\n fileName = moduleName.substr(index + 1);\n packageName = moduleName.substr(0, index);\n }\n return `${cdn}${packageName}@${moduleVersion}/dist/${fileName}`;\n}\n\nasync function requireFromCDN(requirejs: IRequireJS, moduleName: string, moduleVersion: string) {\n const url = moduleNameToCDNUrl(moduleName, moduleVersion);\n const conf: { paths: { [key: string]: string } } = { paths: {} };\n conf.paths[moduleName] = url;\n requirejs.require.config(conf);\n\n try {\n // note: await needed here for try/catch behaviour\n const module = await requirePromise(requirejs, moduleName);\n return module;\n } catch (err: any) {\n console.error(`thebe:loader requirejs error on cdn require`, err);\n throw err;\n }\n}\n\n/**\n * Load an amd module locally and fall back to specified CDN if unavailable.\n *\n * @param moduleName The name of the module to load..\n * @param version The semver range for the module, if loaded from a CDN.\n *\n * By default, the CDN service used is cdn.jsdelivr.net. However, this default can be\n * overridden by specifying another URL via the HTML attribute\n * \"data-jupyter-widgets-cdn\" on a script tag of the page.\n *\n * The semver range is only used with the CDN.\n */\nexport async function requireLoader(\n requirejs: IRequireJS,\n moduleName: string,\n moduleVersion: string,\n useCDNOnly = false,\n): Promise {\n console.debug(`thebe:loader loading ${moduleName}@${moduleVersion}`);\n if (useCDNOnly) {\n return requireFromCDN(requirejs, moduleName, moduleVersion);\n } else {\n if (requirejs.require.defined(moduleName)) {\n return requirePromise(requirejs, moduleName);\n }\n console.debug(`thebe:loader falling back to ${cdn} for ${moduleName}@${moduleVersion}`);\n return requireFromCDN(requirejs, moduleName, moduleVersion);\n }\n}\n","import type { IRenderMimeRegistry } from '@jupyterlab/rendermime';\nimport type { Widget } from '@lumino/widgets';\n\nimport * as LuminoWidget from '@lumino/widgets';\nimport { MessageLoop } from '@lumino/messaging';\n\nimport { KernelWidgetManager, WidgetRenderer, output } from '@jupyter-widgets/jupyterlab-manager';\n\nexport const WIDGET_MIMETYPE = 'application/vnd.jupyter.widget-view+json';\n\nimport * as base from '@jupyter-widgets/base';\nimport * as controls from '@jupyter-widgets/controls';\nimport { shortId } from './utils';\nimport { RequireJsLoader } from './requireJsLoader';\nimport { requireLoader } from './loader';\nimport type { Kernel } from '@jupyterlab/services';\n\n/**\n * A Widget Manager class for Thebe using the context-free KernelWidgetManager from\n * the JupyterLab Manager and inspierd by the implementation in Voila here:\n * https://github.dev/voila-dashboards/voila/blob/main/packages/voila/src/manager.ts\n *\n */\nexport class ThebeManager extends KernelWidgetManager {\n id: string;\n _loader: RequireJsLoader;\n\n constructor(kernel: Kernel.IKernelConnection, rendermime: IRenderMimeRegistry) {\n super(kernel, rendermime);\n\n this.id = shortId();\n /** ensure this registry always gets the widget renderer.\n * This is essential for cases where widgets are rendered heirarchically\n */\n this.addWidgetFactories();\n\n this._registerWidgets();\n this._loader = new RequireJsLoader();\n }\n\n addWidgetFactories() {\n this.rendermime.addFactory(\n {\n safe: false,\n mimeTypes: [WIDGET_MIMETYPE],\n createRenderer: (options) => new WidgetRenderer(options, this as any),\n },\n 1,\n );\n }\n\n removeWidgetFactories() {\n this.rendermime.removeMimeType(WIDGET_MIMETYPE);\n }\n\n /**\n * TODO implement a reasonable method for thebe-core that can load serialized widget state\n * see: https://github.dev/voila-dashboards/voila/blob/7090eb3e30c0c4aa25c2b7d5d2d45e8de1333b3b/packages/voila/src/manager.ts#L52\n *\n */\n async build_widgets(): Promise {\n throw new Error('ThebeManager:build_widgets not implmented');\n }\n\n async display_view(msg: any, view: any, options: any): Promise {\n if (options.el) {\n LuminoWidget.Widget.attach(view.luminoWidget, options.el);\n }\n if (view.el) {\n view.el.setAttribute('data-thebe-jupyter-widget', '');\n view.el.addEventListener('jupyterWidgetResize', () => {\n MessageLoop.postMessage(view.luminoWidget, LuminoWidget.Widget.ResizeMessage.UnknownSize);\n });\n }\n return view.luminoWidget;\n }\n\n async loadClass(\n className: string,\n moduleName: string,\n moduleVersion: string,\n ): Promise {\n if (!this._loader.requested) {\n console.debug(`thebe:manager:loadClass initial requirejs load ${this.id}`);\n this._loader.load((require, define) => {\n define('@jupyter-widgets/base', base as any);\n define('@jupyter-widgets/controls', controls as any);\n define('@jupyter-widgets/output', output as any);\n });\n }\n\n console.debug(`thebe:manager:loadClass ${moduleName}@${moduleVersion}`);\n const rjs = await this._loader.ready;\n\n if (\n moduleName === '@jupyter-widgets/base' ||\n moduleName === '@jupyter-widgets/controls' ||\n moduleName === '@jupyter-widgets/output'\n ) {\n return super.loadClass(className, moduleName, moduleVersion);\n } else {\n let mod;\n try {\n mod = await requireLoader(rjs, moduleName, moduleVersion);\n } catch (err) {\n console.error(`thebe:manager:loadClass loader error`, err);\n throw err;\n }\n if (mod[className]) {\n return mod[className];\n } else {\n console.error(\n `thebe:manager:loadClass ${className} not found in module ${moduleName}@${moduleVersion}`,\n );\n throw new Error(`Class ${className} not found in module ${moduleName}@${moduleVersion}`);\n }\n }\n }\n\n private _registerWidgets() {\n this.register({\n name: '@jupyter-widgets/base',\n version: base.JUPYTER_WIDGETS_VERSION,\n exports: base as unknown as base.ExportData, // TODO improve typing\n });\n this.register({\n name: '@jupyter-widgets/controls',\n version: controls.JUPYTER_CONTROLS_VERSION,\n exports: controls as unknown as base.ExportData, // TODO improve typing\n });\n this.register({\n name: '@jupyter-widgets/output',\n version: output.OUTPUT_WIDGET_VERSION,\n exports: output as any,\n });\n }\n}\n","import type { Config } from './config';\nimport type { EventObject, EventSubject, StatusEvent, ErrorStatusEvent } from './events';\nimport { ThebeEventType } from './events';\n\nexport class EventEmitter {\n private _id: string;\n private _config: Config;\n private _subject: EventSubject;\n private _object: EventObject;\n\n constructor(id: string, config: Config, subject: EventSubject, object: EventObject) {\n this._id = id;\n this._config = config;\n this._subject = subject;\n this._object = object;\n }\n\n triggerStatus({ status, message }: { status: StatusEvent; message: string }) {\n console.debug(`${status} ${message}`);\n this._config.events.trigger(ThebeEventType.status, {\n subject: this._subject,\n id: this._id,\n object: this._object,\n status,\n message,\n });\n }\n\n triggerError({ status, message }: { status: ErrorStatusEvent; message: string }) {\n console.debug(`Error [${this._subject}][${this._id}] ${message}`);\n\n this._config.events.trigger(ThebeEventType.error, {\n subject: this._subject,\n id: this._id,\n object: this._object,\n status,\n message,\n });\n }\n}\n","import type { ISessionConnection } from '@jupyterlab/services/lib/session/session';\nimport { ErrorStatusEvent, EventSubject, SessionStatusEvent } from './events';\nimport { ThebeManager } from './manager';\nimport type ThebeServer from './server';\nimport { EventEmitter } from './emitter';\nimport type { IRenderMimeRegistry } from '@jupyterlab/rendermime';\n\nclass ThebeSession {\n readonly server: ThebeServer;\n readonly manager: ThebeManager;\n // see https://github.dev/jupyterlab/jupyterlab/blob/d48e0c04efb786561137fb20773fc15788507f0a/packages/logconsole/src/widget.ts line 43\n private connection: ISessionConnection;\n private events: EventEmitter;\n\n constructor(\n server: ThebeServer,\n connection: ISessionConnection,\n rendermime: IRenderMimeRegistry,\n ) {\n this.server = server;\n this.connection = connection;\n this.events = new EventEmitter(this.connection.id, server.config, EventSubject.session, this);\n\n if (this.connection.kernel == null) throw Error('ThebeSession - kernel is null');\n this.manager = new ThebeManager(this.connection.kernel, rendermime);\n\n this.connection.statusChanged.connect((_, s) => {\n // 'unknown' | 'starting' | 'idle' | 'busy' | 'terminating' | 'restarting' | 'autorestarting' | 'dead'\n let status;\n switch (s) {\n case 'starting':\n case 'restarting':\n case 'autorestarting':\n status = SessionStatusEvent.starting;\n break;\n case 'idle':\n case 'busy':\n status = SessionStatusEvent.ready;\n break;\n case 'terminating':\n case 'dead':\n default:\n status = SessionStatusEvent.shutdown;\n break;\n }\n\n this.events.triggerStatus({\n status,\n message: `kernel ${this.connection.name} status changed to ${status}[${s}]`,\n });\n if (s === 'dead') {\n this.events.triggerError({\n status: ErrorStatusEvent.session,\n message: `kernel ${this.connection.name} is dead`,\n });\n this.dispose();\n }\n });\n\n this.connection.disposed.connect(() => {\n this.events.triggerStatus({\n status: SessionStatusEvent.shutdown,\n message: `kernel ${this.connection.name} disposed`,\n });\n });\n\n this.events.triggerStatus({\n status: SessionStatusEvent.ready,\n message: `ThebeSession created, kernel '${this.connection.kernel?.name}' available`,\n });\n }\n\n get id() {\n return this.connection.id;\n }\n\n get kernel() {\n return this.connection?.kernel;\n }\n\n get path() {\n return this.connection.path;\n }\n\n get name() {\n return this.connection.name;\n }\n\n async restart() {\n console.debug(`requesting restart for kernel ${this.id}`);\n const p = this.connection.kernel?.restart();\n\n this.events.triggerStatus({\n status: SessionStatusEvent.starting,\n message: `Kernel restart requested`,\n });\n\n await p;\n\n this.events.triggerStatus({\n status: SessionStatusEvent.ready,\n message: `session restarted, kernel '${this.connection.kernel?.name}' available`,\n });\n }\n\n async shutdown() {\n if (this.connection.isDisposed) return;\n await this.connection.shutdown();\n this.events.triggerStatus({\n status: SessionStatusEvent.shutdown,\n message: `session ${this.name}`,\n });\n this.dispose();\n }\n\n dispose() {\n if (!this.connection.isDisposed) this.connection.dispose();\n }\n}\n\nexport default ThebeSession;\n","import type {\n BinderUrlSet,\n KernelOptions,\n RepoProviderSpec,\n RestAPIContentsResponse,\n ServerRestAPI,\n ServerRuntime,\n ServerSettings,\n SessionIModel,\n} from './types';\nimport type { Config } from './config';\nimport type { ServiceManager, Session } from '@jupyterlab/services';\nimport type { LiteServerConfig } from 'thebe-lite';\nimport type { IRenderMimeRegistry } from '@jupyterlab/rendermime';\nimport type { StatusEvent } from './events';\nimport { WELL_KNOWN_REPO_PROVIDERS, makeBinderUrls } from './url';\nimport { getExistingServer, saveServerInfo } from './sessions';\nimport {\n KernelManager,\n KernelSpecAPI,\n ServerConnection,\n SessionManager,\n} from '@jupyterlab/services';\nimport ThebeSession from './session';\nimport { shortId } from './utils';\nimport { ServerStatusEvent, EventSubject, ErrorStatusEvent } from './events';\nimport { EventEmitter } from './emitter';\n\nasync function responseToJson(res: Response) {\n if (!res.ok) throw Error(`${res.status} - ${res.statusText}`);\n const json = await res.json();\n return json as RestAPIContentsResponse;\n}\n\nfunction errorAsString(errorLike: any): string {\n if (typeof errorLike === 'string') return errorLike;\n if (errorLike.message) return errorLike.message;\n if (errorLike.status && errorLike.statusText)\n return `${errorLike.status} - ${errorLike.statusText}`;\n return JSON.stringify(errorLike);\n}\n\nclass ThebeServer implements ServerRuntime, ServerRestAPI {\n readonly id: string;\n readonly config: Config;\n readonly ready: Promise;\n sessionManager?: Session.IManager;\n serviceManager?: ServiceManager; // jlite only\n repoProviders?: RepoProviderSpec[];\n binderUrls?: BinderUrlSet;\n userServerUrl?: string;\n private resolveReadyFn?: (value: ThebeServer | PromiseLike) => void;\n private rejectReadyFn?: (reason?: any) => void;\n private _isDisposed: boolean;\n private events: EventEmitter;\n\n constructor(config: Config) {\n this.id = shortId();\n this.config = config;\n this.events = new EventEmitter(this.id, config, EventSubject.server, this);\n this.ready = new Promise((resolve, reject) => {\n this.resolveReadyFn = resolve;\n this.rejectReadyFn = reject;\n });\n this._isDisposed = false;\n }\n\n get isBinder(): boolean {\n return !!this.binderUrls;\n }\n\n get isReady(): boolean {\n return this.sessionManager?.isReady ?? false;\n }\n\n get isDisposed(): boolean {\n return this._isDisposed;\n }\n\n get settings() {\n return this.sessionManager?.serverSettings;\n }\n\n async shutdownSession(id: string) {\n return this.sessionManager?.shutdown(id);\n }\n\n async shutdownAllSessions() {\n return this.sessionManager?.shutdownAll();\n }\n\n async check(): Promise {\n const resp = await ThebeServer.status(\n this.sessionManager?.serverSettings ?? this.config.serverSettings,\n );\n return resp.ok;\n }\n\n dispose() {\n if (this._isDisposed) return;\n if (!this.serviceManager?.isDisposed) this.serviceManager?.dispose();\n if (!this.sessionManager?.isDisposed) this.sessionManager?.dispose();\n\n // Implementing the flag at this level as\n this._isDisposed = true;\n }\n\n async startNewSession(\n rendermime: IRenderMimeRegistry,\n kernelOptions?: KernelOptions,\n ): Promise {\n await this.ready;\n\n if (!this.sessionManager) {\n throw Error('Requesting session from a server, with no SessionManager available');\n }\n\n await this.sessionManager.ready;\n\n // name is assumed to be a non empty string but is otherwise not required\n // if a notebook name has been supplied on the path, use that otherwise use a default\n // https://jupyterlab.readthedocs.io/en/3.4.x/api/modules/services.session.html#isessionoptions\n let path = kernelOptions?.path ?? this.config.kernels.path;\n let name = 'thebe.ipynb';\n const match = path.match(/\\/*([a-zA-Z0-9-]+.ipynb)$/);\n if (match) {\n name = match[1];\n }\n\n const kernelName = kernelOptions?.kernelName ?? this.config.kernels.kernelName;\n\n console.debug('thebe:api:startNewSession server', this);\n console.debug('thebe:api:startNewSession', { name, path, kernelName });\n\n if (this.serviceManager) {\n // Temporary Fix: thebe-lite does not yet support filesystem based resouces fully,\n // so we can't use a path that points to a sub folder.\n path = path.slice(1).replace(/\\//g, '-');\n }\n\n const connection = await this.sessionManager?.startNew({\n name,\n path,\n type: 'notebook',\n kernel: {\n name: kernelName,\n },\n });\n\n return new ThebeSession(this, connection, rendermime);\n }\n\n async listRunningSessions(): Promise {\n await this.ready;\n const iter = this.sessionManager?.running();\n const models: SessionIModel[] = [];\n let result = iter?.next();\n while (result && !result.done) {\n models.push(result.value);\n result = iter?.next();\n }\n return models;\n }\n\n async refreshRunningSessions(): Promise {\n await this.ready;\n await this.sessionManager?.refreshRunning();\n return this.listRunningSessions();\n }\n\n async connectToExistingSession(model: SessionIModel, rendermime: IRenderMimeRegistry) {\n await this.ready;\n if (!this.sessionManager) {\n throw Error('Requesting session from a server, with no SessionManager available');\n }\n\n await this.sessionManager.ready;\n\n const connection = this.sessionManager?.connectTo({ model });\n return new ThebeSession(this, connection, rendermime);\n }\n\n async clearSavedBinderSessions() {\n const urls = this.makeBinderUrls();\n window.localStorage.removeItem(urls.storageKey);\n }\n\n /**\n * Connect to a Jupyter server directly\n *\n */\n async connectToJupyterServer(): Promise {\n console.debug('thebe:api:connectToJupyterServer:serverSettings:', this.config.serverSettings);\n const serverSettings = ServerConnection.makeSettings(this.config.serverSettings);\n\n // ping the server to check it is alive before trying to\n // hook up services\n try {\n this.events.triggerStatus({\n status: ServerStatusEvent.launching,\n message: `Checking server url`,\n });\n await ThebeServer.status(serverSettings);\n this.events.triggerStatus({\n status: ServerStatusEvent.launching,\n message: `Server reachable`,\n });\n // eslint-disable-next-line no-empty\n } catch (err: any) {\n const message = `Server not reachable (${serverSettings.baseUrl}) - ${err}`;\n this.events.triggerError({\n status: ErrorStatusEvent.error,\n message,\n });\n this.rejectReadyFn?.(message);\n return;\n }\n\n const kernelManager = new KernelManager({ serverSettings });\n this.events.triggerStatus({\n status: ServerStatusEvent.launching,\n message: `Created KernelManager`,\n });\n\n this.sessionManager = new SessionManager({\n kernelManager,\n serverSettings,\n });\n\n this.sessionManager.connectionFailure.connect((_, err) => {\n this.events.triggerError({\n status: ErrorStatusEvent.server,\n message: `connection failure: ${err}`,\n });\n });\n\n this.sessionManager.runningChanged.connect((_, models) => {\n this.events.triggerStatus({\n status: ServerStatusEvent.ready,\n message: `${models.length} running sessions changed: ${models\n .map((m) => m.name)\n .join(',')}`,\n });\n });\n\n this.events.triggerStatus({\n status: ServerStatusEvent.ready,\n message: `Created SessionManager`,\n });\n\n // Resolve the ready promise\n return this.sessionManager.ready.then(\n () => {\n this.userServerUrl = `${serverSettings.baseUrl}?token=${serverSettings.token}`;\n this.events.triggerStatus({\n status: ServerStatusEvent.ready,\n message: `Server connection ready`,\n });\n this.resolveReadyFn?.(this);\n },\n (err) => this.rejectReadyFn?.(errorAsString(err)),\n );\n }\n\n /**\n * Connect to Jupyterlite Server\n */\n async connectToJupyterLiteServer(config?: LiteServerConfig): Promise {\n this.events.triggerStatus({\n status: ServerStatusEvent.launching,\n message: `Connecting to JupyterLite`,\n });\n\n if (!window.thebeLite)\n throw new Error(\n `thebe-lite is not available at window.thebeLite - load this onto your page before loading thebe or thebe-core.`,\n );\n\n this.serviceManager = await window.thebeLite.startJupyterLiteServer(config);\n\n this.events.triggerStatus({\n status: ServerStatusEvent.launching,\n message: `Started JupyterLite server`,\n });\n\n console.debug(\n 'thebe:api:connectToJupyterLiteServer:serverSettings:',\n this.serviceManager.serverSettings,\n );\n\n this.sessionManager = this.serviceManager.sessions;\n\n this.events.triggerStatus({\n status: ServerStatusEvent.launching,\n message: `Received SessionMananger from JupyterLite`,\n });\n\n return this.sessionManager?.ready.then(\n () => {\n this.userServerUrl = '/'; // TODO bundle jlite UI `${this.serviceManager?.serverSettings.baseUrl}?token=${this.serviceManager?.serverSettings.token}`;\n this.events.triggerStatus({\n status: ServerStatusEvent.ready,\n message: `Server connection established`,\n });\n this.resolveReadyFn?.(this);\n },\n (err) => this.rejectReadyFn?.(errorAsString(err)),\n );\n }\n\n makeBinderUrls() {\n return makeBinderUrls(this.config, this.repoProviders ?? WELL_KNOWN_REPO_PROVIDERS);\n }\n\n async checkForSavedBinderSession() {\n try {\n const { storageKey } = makeBinderUrls(\n this.config,\n this.repoProviders ?? WELL_KNOWN_REPO_PROVIDERS,\n );\n return getExistingServer(this.config.savedSessions, storageKey);\n } catch (err: any) {\n this.events.triggerError({\n status: ErrorStatusEvent.error,\n message: `${err} - Failed to check for saved session.`,\n });\n return null;\n }\n }\n\n /**\n * Connect to a Binder instance in order to\n * access a Jupyter server that can provide kernels\n *\n * @param ctx\n * @param opts\n * @returns\n */\n async connectToServerViaBinder(customProviders?: RepoProviderSpec[]): Promise {\n // request new server\n this.events.triggerStatus({\n status: ServerStatusEvent.launching,\n message: `Connecting to binderhub at ${this.config.binder.binderUrl}`,\n });\n\n // TODO binder connection setup probably better as a a factory independent of the server\n this.repoProviders = [...WELL_KNOWN_REPO_PROVIDERS, ...(customProviders ?? [])];\n\n try {\n this.binderUrls = makeBinderUrls(this.config, this.repoProviders);\n } catch (err: any) {\n this.events.triggerError({\n status: ErrorStatusEvent.error,\n message: `${err} - Failed to connect to binderhub at ${this.config.binder.binderUrl}`,\n });\n return;\n }\n const urls = this.binderUrls;\n\n this.events.triggerStatus({\n status: ServerStatusEvent.launching,\n message: `Binder build url is ${urls.build}`,\n });\n\n if (this.config.savedSessions.enabled) {\n console.debug('thebe:server:connectToServerViaBinder Checking for saved session...');\n // the follow function will ping the server based on the settings and only return\n // non-null if the server is still alive. So highly likely that the remainder of\n // the connection calls below, work.\n const existingSettings = await this.checkForSavedBinderSession();\n if (existingSettings) {\n // Connect to the existing session\n const serverSettings = ServerConnection.makeSettings(existingSettings);\n const kernelManager = new KernelManager({ serverSettings });\n\n this.events.triggerStatus({\n status: ServerStatusEvent.launching,\n message: `Created KernelManager`,\n });\n\n this.sessionManager = new SessionManager({\n kernelManager,\n serverSettings,\n });\n\n this.events.triggerStatus({\n status: ServerStatusEvent.launching,\n message: `Created KernelManager`,\n });\n\n return this.sessionManager.ready.then(\n () => {\n this.userServerUrl = `${serverSettings.baseUrl}?token=${serverSettings.token}`;\n this.events.triggerStatus({\n status: ServerStatusEvent.ready,\n message: `Re-connected to binder server`,\n });\n this.resolveReadyFn?.(this);\n },\n (err) => this.rejectReadyFn?.(errorAsString(err)),\n );\n // else drop out of this block and request a new session\n }\n }\n\n // TODO we can get rid of one level of promise here?\n // Talk to the binder server\n const state: { status: StatusEvent } = {\n status: ServerStatusEvent.launching,\n };\n const es = new EventSource(urls.build);\n this.events.triggerStatus({\n status: state.status,\n message: `Opened connection to binder: ${urls.build}`,\n });\n\n // handle errors\n es.onerror = (evt: Event) => {\n console.error(`Lost connection to binder: ${urls.build}`, evt);\n es?.close();\n state.status = ErrorStatusEvent.error;\n const data = (evt as MessageEvent)?.data;\n const phase = data ? data.phase : 'unknown';\n const message = `Lost connection to binder: ${urls.build}\\nphase: ${phase} - ${\n data ? data.message : 'no message'\n }`;\n this.events.triggerError({\n status: ErrorStatusEvent.error,\n message,\n });\n this.rejectReadyFn?.(message);\n };\n\n es.onmessage = async (evt: MessageEvent) => {\n const msg: {\n // TODO must be in Jupyterlab types somewhere\n phase: string;\n message: string;\n url: string;\n token: string;\n } = JSON.parse(evt.data);\n\n const phase = msg.phase?.toLowerCase() ?? '';\n switch (phase) {\n case 'failed':\n es?.close();\n state.status = ErrorStatusEvent.error;\n this.events.triggerError({\n status: ErrorStatusEvent.error,\n message: `Binder: failed to build - ${urls.build} - ${msg.message}`,\n });\n this.rejectReadyFn?.(msg.message);\n break;\n case 'ready':\n {\n es?.close();\n\n const settings: ServerSettings = {\n baseUrl: msg.url,\n wsUrl: 'ws' + msg.url.slice(4),\n token: msg.token,\n appendToken: true,\n };\n\n const serverSettings = ServerConnection.makeSettings(settings);\n const kernelManager = new KernelManager({ serverSettings });\n this.sessionManager = new SessionManager({\n kernelManager,\n serverSettings,\n });\n\n if (this.config.savedSessions.enabled) {\n saveServerInfo(urls.storageKey, this.id, serverSettings);\n console.debug(\n `thebe:server:connectToServerViaBinder Saved session for ${this.id} at ${urls.build}`,\n );\n }\n\n // promise has already been returned to the caller\n // so we can await here\n await this.sessionManager.ready;\n\n this.userServerUrl = `${msg.url}?token=${msg.token}`;\n\n state.status = ServerStatusEvent.ready;\n this.events.triggerStatus({\n status: state.status,\n message: `Binder server is ready: ${msg.message}`,\n });\n\n this.resolveReadyFn?.(this);\n }\n break;\n default:\n this.events.triggerStatus({\n status: state.status,\n message: `Binder is: ${phase} - ${msg.message}`,\n });\n }\n };\n }\n\n //\n // ServerRestAPI Implementation\n //\n getFetchUrl(relativeUrl: string) {\n // TODO use ServerConnection.makeRequest - this willadd the token\n // and use any internal fetch overrides\n // TODO BUG this is the wrong serverSetting, they should be for the active connection\n if (!this.sessionManager)\n throw new Error('Must connect to a server before requesting KernelSpecs');\n if (!this.sessionManager?.serverSettings)\n throw new Error('No server settings available in session manager');\n const settings = this.sessionManager?.serverSettings;\n const baseUrl = new URL(settings.baseUrl);\n const url = new URL(`${baseUrl.pathname}${relativeUrl}`.replace('//', '/'), baseUrl.origin);\n url.searchParams.append('token', settings.token);\n return url;\n }\n\n static status(serverSettings: ServerSettings) {\n return ServerConnection.makeRequest(\n `${serverSettings.baseUrl}api/status`,\n {},\n ServerConnection.makeSettings(serverSettings),\n );\n }\n\n async getKernelSpecs() {\n if (!this.sessionManager)\n throw new Error('Must connect to a server before requesting KernelSpecs');\n return KernelSpecAPI.getSpecs(\n ServerConnection.makeSettings(this.sessionManager?.serverSettings),\n );\n }\n\n async getContents(opts: {\n path: string;\n type?: 'notebook' | 'file' | 'directory';\n format?: 'text' | 'base64';\n returnContent?: boolean;\n }) {\n const url = this.getFetchUrl(`/api/contents/${opts.path}`);\n if (opts.type) url.searchParams.append('type', opts.type);\n if (opts.format) url.searchParams.append('format', opts.format);\n url.searchParams.append('content', opts.returnContent ? '1' : '0');\n return responseToJson(await fetch(url));\n }\n\n async duplicateFile(opts: {\n path: string;\n copy_from: string;\n ext?: string;\n type?: 'notebook' | 'file';\n }) {\n const url = this.getFetchUrl(`/api/contents/${opts.path}`);\n const { copy_from, ext, type } = opts;\n return responseToJson(\n await fetch(url, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ copy_from, ext, type }),\n }),\n );\n }\n\n async createDirectory(opts: { path: string }) {\n const url = this.getFetchUrl(`/api/contents/${opts.path}`);\n return responseToJson(\n await fetch(url, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ type: 'directory' }),\n }),\n );\n }\n\n async renameContents(opts: { path: string; newPath: string }) {\n const { path, newPath } = opts;\n const url = this.getFetchUrl(`/api/contents/${path}`);\n return responseToJson(\n await fetch(url, {\n method: 'PATCH',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ path: newPath }),\n }),\n );\n }\n\n async uploadFile(opts: {\n path: string;\n content: string;\n format?: 'json' | 'text' | 'base64';\n type?: 'notebook' | 'file';\n }) {\n const { path, content, format, type } = opts;\n const url = this.getFetchUrl(`/api/contents/${path}`);\n console.debug('thebe:api:server:uploadFile', url);\n return responseToJson(\n await fetch(url, {\n method: 'PUT',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n path,\n content,\n format: format ?? 'json',\n type: type ?? 'notebook',\n }),\n }),\n );\n }\n}\n\nexport default ThebeServer;\n","import * as widgets from './widgets';\n/**\n * A mime renderer factory for raw html.\n */\nexport const htmlRendererFactory = {\n safe: true,\n mimeTypes: ['text/html'],\n defaultRank: 50,\n createRenderer: options => new widgets.RenderedHTML(options)\n};\n/**\n * A mime renderer factory for images.\n */\nexport const imageRendererFactory = {\n safe: true,\n mimeTypes: [\n 'image/bmp',\n 'image/png',\n 'image/jpeg',\n 'image/gif',\n 'image/webp'\n ],\n defaultRank: 90,\n createRenderer: options => new widgets.RenderedImage(options)\n};\n/**\n * A mime renderer factory for LaTeX.\n */\nexport const latexRendererFactory = {\n safe: true,\n mimeTypes: ['text/latex'],\n defaultRank: 70,\n createRenderer: options => new widgets.RenderedLatex(options)\n};\n/**\n * A mime renderer factory for Markdown.\n */\nexport const markdownRendererFactory = {\n safe: true,\n mimeTypes: ['text/markdown'],\n defaultRank: 60,\n createRenderer: options => new widgets.RenderedMarkdown(options)\n};\n/**\n * A mime renderer factory for svg.\n */\nexport const svgRendererFactory = {\n safe: false,\n mimeTypes: ['image/svg+xml'],\n defaultRank: 80,\n createRenderer: options => new widgets.RenderedSVG(options)\n};\n/**\n * A mime renderer factory for rendering stderr outputs\n */\nexport const errorRendererFactory = {\n safe: true,\n mimeTypes: ['application/vnd.jupyter.stderr'],\n defaultRank: 110,\n createRenderer: options => new widgets.RenderedError(options)\n};\n/**\n * A mime renderer factory for plain and jupyter console text data.\n */\nexport const textRendererFactory = {\n safe: true,\n mimeTypes: ['text/plain', 'application/vnd.jupyter.stdout'],\n defaultRank: 120,\n createRenderer: options => new widgets.RenderedText(options)\n};\n/**\n * A placeholder factory for rendered JavaScript.\n */\nexport const javaScriptRendererFactory = {\n safe: false,\n mimeTypes: ['text/javascript', 'application/javascript'],\n defaultRank: 110,\n createRenderer: options => new widgets.RenderedJavaScript(options)\n};\n/**\n * The standard factories provided by the rendermime package.\n */\nexport const standardRendererFactories = [\n htmlRendererFactory,\n markdownRendererFactory,\n latexRendererFactory,\n svgRendererFactory,\n imageRendererFactory,\n javaScriptRendererFactory,\n errorRendererFactory,\n textRendererFactory\n];\n//# sourceMappingURL=factories.js.map","/* eslint-disable camelcase */\n// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport sanitize from 'sanitize-html';\n/**\n * Helper class that contains regular expressions for inline CSS style validation.\n *\n * Which properties (and values) to allow is largely based on the Google Caja project:\n * https://github.com/google/caja\n *\n * The regular expressions are largly based on the syntax definition found at\n * https://developer.mozilla.org/en-US/docs/Web/CSS.\n */\nclass CssProp {\n static reg(r) {\n return new RegExp('^' + r + '$', 'i');\n }\n}\n/*\n * Numeric base expressions used to help build more complex regular expressions\n */\nCssProp.N = {\n integer: `[+-]?[0-9]+`,\n integer_pos: `[+]?[0-9]+`,\n integer_zero_ff: `([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])`,\n number: `[+-]?([0-9]*[.])?[0-9]+(e-?[0-9]*)?`,\n number_pos: `[+]?([0-9]*[.])?[0-9]+(e-?[0-9]*)?`,\n number_zero_hundred: `[+]?(([0-9]|[1-9][0-9])([.][0-9]+)?|100)`,\n number_zero_one: `[+]?(1([.][0]+)?|0?([.][0-9]+)?)`\n};\n/*\n * Base expressions of common CSS syntax elements\n */\nCssProp.B = {\n angle: `(${CssProp.N.number}(deg|rad|grad|turn)|0)`,\n frequency: `${CssProp.N.number}(Hz|kHz)`,\n ident: String.raw `-?([_a-z]|[\\xA0-\\xFF]|\\\\[0-9a-f]{1,6}(\\r\\n|[ \\t\\r\\n\\f])?|\\\\[^\\r\\n\\f0-9a-f])([_a-z0-9-]|[\\xA0-\\xFF]|\\\\[0-9a-f]{1,6}(\\r\\n|[ \\t\\r\\n\\f])?|\\\\[^\\r\\n\\f0-9a-f])*`,\n len_or_perc: `(0|${CssProp.N.number}(px|em|rem|ex|in|cm|mm|pt|pc|%))`,\n length: `(${CssProp.N.number}(px|em|rem|ex|in|cm|mm|pt|pc)|0)`,\n length_pos: `(${CssProp.N.number_pos}(px|em|rem|ex|in|cm|mm|pt|pc)|0)`,\n percentage: `${CssProp.N.number}%`,\n percentage_pos: `${CssProp.N.number_pos}%`,\n percentage_zero_hundred: `${CssProp.N.number_zero_hundred}%`,\n string: String.raw `(\\\"([^\\n\\r\\f\\\\\"]|\\\\\\n|\\r\\n|\\r|\\f|\\\\[0-9a-f]{1,6}(\\r\\n|[ \\t\\r\\n\\f])?|\\\\[^\\r\\n\\f0-9a-f])*\\\")|(\\'([^\\n\\r\\f\\\\']|\\\\\\n|\\r\\n|\\r|\\f|\\\\[0-9a-f]{1,6}(\\r\\n|[ \\t\\r\\n\\f])?|\\\\[^\\r\\n\\f0-9a-f])*\\')`,\n time: `${CssProp.N.number}(s|ms)`,\n url: `url\\\\(.*?\\\\)`,\n z_index: `[+-]?[0-9]{1,7}`\n};\n/*\n * Atomic (i.e. not dependant on other regular expressions) sub RegEx segments\n */\nCssProp.A = {\n absolute_size: `xx-small|x-small|small|medium|large|x-large|xx-large`,\n attachment: `scroll|fixed|local`,\n bg_origin: `border-box|padding-box|content-box`,\n border_style: `none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset`,\n box: `border-box|padding-box|content-box`,\n display_inside: `auto|block|table|flex|grid`,\n display_outside: `block-level|inline-level|none|table-row-group|table-header-group|table-footer-group|table-row|table-cell|table-column-group|table-column|table-caption`,\n ending_shape: `circle|ellipse`,\n generic_family: `serif|sans-serif|cursive|fantasy|monospace`,\n generic_voice: `male|female|child`,\n relative_size: `smaller|larger`,\n repeat_style: `repeat-x|repeat-y|((?:repeat|space|round|no-repeat)(?:\\\\s*(?:repeat|space|round|no-repeat))?)`,\n side_or_corner: `(left|right)?\\\\s*(top|bottom)?`,\n single_animation_direction: `normal|reverse|alternate|alternate-reverse`,\n single_animation_fill_mode: `none|forwards|backwards|both`,\n single_animation_play_state: `running|paused`\n};\n/*\n * Color definition sub expressions\n */\nCssProp._COLOR = {\n hex: `\\\\#(0x)?[0-9a-f]+`,\n name: `aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|transparent|violet|wheat|white|whitesmoke|yellow|yellowgreen`,\n rgb: String.raw `rgb\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*\\)`,\n rgba: String.raw `rgba\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(${CssProp.N.integer_zero_ff}|${CssProp.N.number_zero_one}|${CssProp.B.percentage_zero_hundred})\\s*\\)`\n};\n/*\n * Compound (i.e. dependant on other (sub) regular expressions) sub RegEx segments\n */\nCssProp._C = {\n alpha: `${CssProp.N.integer_zero_ff}|${CssProp.N.number_zero_one}|${CssProp.B.percentage_zero_hundred}`,\n alphavalue: CssProp.N.number_zero_one,\n bg_position: `((${CssProp.B.len_or_perc}|left|center|right|top|bottom)\\\\s*){1,4}`,\n bg_size: `(${CssProp.B.length_pos}|${CssProp.B.percentage}|auto){1,2}|cover|contain`,\n border_width: `thin|medium|thick|${CssProp.B.length}`,\n bottom: `${CssProp.B.length}|auto`,\n color: `${CssProp._COLOR.hex}|${CssProp._COLOR.rgb}|${CssProp._COLOR.rgba}|${CssProp._COLOR.name}`,\n color_stop_length: `(${CssProp.B.len_or_perc}\\\\s*){1,2}`,\n linear_color_hint: `${CssProp.B.len_or_perc}`,\n family_name: `${CssProp.B.string}|(${CssProp.B.ident}\\\\s*)+`,\n image_decl: CssProp.B.url,\n left: `${CssProp.B.length}|auto`,\n loose_quotable_words: `(${CssProp.B.ident})+`,\n margin_width: `${CssProp.B.len_or_perc}|auto`,\n padding_width: `${CssProp.B.length_pos}|${CssProp.B.percentage_pos}`,\n page_url: CssProp.B.url,\n position: `((${CssProp.B.len_or_perc}|left|center|right|top|bottom)\\\\s*){1,4}`,\n right: `${CssProp.B.length}|auto`,\n shadow: '',\n size: `closest-side|farthest-side|closest-corner|farthest-corner|${CssProp.B.length}|(${CssProp.B.len_or_perc})\\\\s+(${CssProp.B.len_or_perc})`,\n top: `${CssProp.B.length}|auto`\n};\nCssProp._C1 = {\n image_list: `image\\\\(\\\\s*(${CssProp.B.url})*\\\\s*(${CssProp.B.url}|${CssProp._C.color})\\\\s*\\\\)`,\n linear_color_stop: `(${CssProp._C.color})(\\\\s*${CssProp._C.color_stop_length})?`,\n shadow: `((${CssProp._C.color})\\\\s+((${CssProp.B.length})\\\\s*){2,4}(\\s+inset)?)|((inset\\\\s+)?((${CssProp.B.length})\\\\s*){2,4}\\\\s*(${CssProp._C.color})?)`\n};\nCssProp._C2 = {\n color_stop_list: `((${CssProp._C1.linear_color_stop})(\\\\s*(${CssProp._C.linear_color_hint}))?\\\\s*,\\\\s*)+(${CssProp._C1.linear_color_stop})`,\n shape: `rect\\\\(\\\\s*(${CssProp._C.top})\\\\s*,\\\\s*(${CssProp._C.right})\\\\s*,\\\\s*(${CssProp._C.bottom})\\\\s*,\\\\s*(${CssProp._C.left})\\\\s*\\\\)`\n};\nCssProp._C3 = {\n linear_gradient: `linear-gradient\\\\((((${CssProp.B.angle})|to\\\\s+(${CssProp.A.side_or_corner}))\\\\s*,\\\\s*)?\\\\s*(${CssProp._C2.color_stop_list})\\\\s*\\\\)`,\n radial_gradient: `radial-gradient\\\\(((((${CssProp.A.ending_shape})|(${CssProp._C.size}))\\\\s*)*\\\\s*(at\\\\s+${CssProp._C.position})?\\\\s*,\\\\s*)?\\\\s*(${CssProp._C2.color_stop_list})\\\\s*\\\\)`\n};\nCssProp._C4 = {\n image: `${CssProp.B.url}|${CssProp._C3.linear_gradient}|${CssProp._C3.radial_gradient}|${CssProp._C1.image_list}`,\n bg_image: `(${CssProp.B.url}|${CssProp._C3.linear_gradient}|${CssProp._C3.radial_gradient}|${CssProp._C1.image_list})|none`\n};\nCssProp.C = {\n ...CssProp._C,\n ...CssProp._C1,\n ...CssProp._C2,\n ...CssProp._C3,\n ...CssProp._C4\n};\n/*\n * Property value regular expressions not dependant on other sub expressions\n */\nCssProp.AP = {\n border_collapse: `collapse|separate`,\n box: `normal|none|contents`,\n box_sizing: `content-box|padding-box|border-box`,\n caption_side: `top|bottom`,\n clear: `none|left|right|both`,\n direction: `ltr|rtl`,\n empty_cells: `show|hide`,\n float: `left|right|none`,\n font_stretch: `normal|wider|narrower|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded`,\n font_style: `normal|italic|oblique`,\n font_variant: `normal|small-caps`,\n font_weight: `normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900`,\n list_style_position: `inside|outside`,\n list_style_type: `disc|circle|square|decimal|decimal-leading-zero|lower-roman|upper-roman|lower-greek|lower-latin|upper-latin|armenian|georgian|lower-alpha|upper-alpha|none`,\n overflow: `visible|hidden|scroll|auto`,\n overflow_wrap: `normal|break-word`,\n overflow_x: `visible|hidden|scroll|auto|no-display|no-content`,\n page_break_after: `auto|always|avoid|left|right`,\n page_break_before: `auto|always|avoid|left|right`,\n page_break_inside: `avoid|auto`,\n position: `static|relative|absolute`,\n resize: `none|both|horizontal|vertical`,\n speak: `normal|none|spell-out`,\n speak_header: `once|always`,\n speak_numeral: `digits|continuous`,\n speak_punctuation: `code|none`,\n table_layout: `auto|fixed`,\n text_align: `left|right|center|justify`,\n text_decoration: `none|((underline|overline|line-through|blink)\\\\s*)+`,\n text_transform: `capitalize|uppercase|lowercase|none`,\n text_wrap: `normal|unrestricted|none|suppress`,\n unicode_bidi: `normal|embed|bidi-override`,\n visibility: `visible|hidden|collapse`,\n white_space: `normal|pre|nowrap|pre-wrap|pre-line`,\n word_break: `normal|keep-all|break-all`\n};\n/*\n * Compound propertiy value regular expressions (i.e. dependant on other sub expressions)\n */\nCssProp._CP = {\n background_attachment: `${CssProp.A.attachment}(,\\\\s*${CssProp.A.attachment})*`,\n background_color: CssProp.C.color,\n background_origin: `${CssProp.A.box}(,\\\\s*${CssProp.A.box})*`,\n background_repeat: `${CssProp.A.repeat_style}(,\\\\s*${CssProp.A.repeat_style})*`,\n border: `((${CssProp.C.border_width}|${CssProp.A.border_style}|${CssProp.C.color})\\\\s*){1,3}`,\n border_radius: `((${CssProp.B.len_or_perc})\\\\s*){1,4}(\\\\/\\\\s*((${CssProp.B.len_or_perc})\\\\s*){1,4})?`,\n border_spacing: `${CssProp.B.length}\\\\s*(${CssProp.B.length})?`,\n border_top_color: CssProp.C.color,\n border_top_style: CssProp.A.border_style,\n border_width: `((${CssProp.C.border_width})\\\\s*){1,4}`,\n color: CssProp.C.color,\n cursor: `(${CssProp.B.url}(\\\\s*,\\\\s*)?)*(auto|crosshair|default|pointer|move|e-resize|ne-resize|nw-resize|n-resize|se-resize|sw-resize|s-resize|w-resize|text|wait|help|progress|all-scroll|col-resize|hand|no-drop|not-allowed|row-resize|vertical-text)`,\n display: `inline|block|list-item|run-in|inline-list-item|inline-block|table|inline-table|table-cell|table-caption|flex|inline-flex|grid|inline-grid|${CssProp.A.display_inside}|${CssProp.A.display_outside}|inherit|inline-box|inline-stack`,\n display_outside: CssProp.A.display_outside,\n elevation: `${CssProp.B.angle}|below|level|above|higher|lower`,\n font_family: `(${CssProp.C.family_name}|${CssProp.A.generic_family})(,\\\\s*(${CssProp.C.family_name}|${CssProp.A.generic_family}))*`,\n height: `${CssProp.B.length}|${CssProp.B.percentage}|auto`,\n letter_spacing: `normal|${CssProp.B.length}`,\n list_style_image: `${CssProp.C.image}|none`,\n margin_right: CssProp.C.margin_width,\n max_height: `${CssProp.B.length_pos}|${CssProp.B.percentage_pos}|none|auto`,\n min_height: `${CssProp.B.length_pos}|${CssProp.B.percentage_pos}|auto`,\n opacity: CssProp.C.alphavalue,\n outline_color: `${CssProp.C.color}|invert`,\n outline_width: CssProp.C.border_width,\n padding: `((${CssProp.C.padding_width})\\\\s*){1,4}`,\n padding_top: CssProp.C.padding_width,\n pitch_range: CssProp.N.number,\n right: `${CssProp.B.length}|${CssProp.B.percentage}|auto`,\n stress: CssProp.N.number,\n text_indent: `${CssProp.B.length}|${CssProp.B.percentage}`,\n text_shadow: `none|${CssProp.C.shadow}(,\\\\s*(${CssProp.C.shadow}))*`,\n volume: `${CssProp.N.number_pos}|${CssProp.B.percentage_pos}|silent|x-soft|soft|medium|loud|x-loud`,\n word_wrap: CssProp.AP.overflow_wrap,\n zoom: `normal|${CssProp.N.number_pos}|${CssProp.B.percentage_pos}`,\n backface_visibility: CssProp.AP.visibility,\n background_clip: `${CssProp.A.box}(,\\\\s*(${CssProp.A.box}))*`,\n background_position: `${CssProp.C.bg_position}(,\\\\s*(${CssProp.C.bg_position}))*`,\n border_bottom_color: CssProp.C.color,\n border_bottom_style: CssProp.A.border_style,\n border_color: `((${CssProp.C.color})\\\\s*){1,4}`,\n border_left_color: CssProp.C.color,\n border_right_color: CssProp.C.color,\n border_style: `((${CssProp.A.border_style})\\\\s*){1,4}`,\n border_top_left_radius: `(${CssProp.B.length}|${CssProp.B.percentage})(\\\\s*(${CssProp.B.length}|${CssProp.B.percentage}))?`,\n border_top_width: CssProp.C.border_width,\n box_shadow: `none|${CssProp.C.shadow}(,\\\\s*(${CssProp.C.shadow}))*`,\n clip: `${CssProp.C.shape}|auto`,\n display_inside: CssProp.A.display_inside,\n font_size: `${CssProp.A.absolute_size}|${CssProp.A.relative_size}|${CssProp.B.length_pos}|${CssProp.B.percentage_pos}`,\n line_height: `normal|${CssProp.N.number_pos}|${CssProp.B.length_pos}|${CssProp.B.percentage_pos}`,\n margin_left: CssProp.C.margin_width,\n max_width: `${CssProp.B.length_pos}|${CssProp.B.percentage_pos}|none|auto`,\n outline_style: CssProp.A.border_style,\n padding_bottom: CssProp.C.padding_width,\n padding_right: CssProp.C.padding_width,\n perspective: `none|${CssProp.B.length}`,\n richness: CssProp.N.number,\n text_overflow: `((clip|ellipsis|${CssProp.B.string})\\\\s*){1,2}`,\n top: `${CssProp.B.length}|${CssProp.B.percentage}|auto`,\n width: `${CssProp.B.length_pos}|${CssProp.B.percentage_pos}|auto`,\n z_index: `auto|${CssProp.B.z_index}`,\n // Simplified background\n background: `(((${CssProp.C.bg_position}\\\\s*(\\\\/\\\\s*${CssProp.C.bg_size})?)|(${CssProp.A.repeat_style})|(${CssProp.A.attachment})|(${CssProp.A.bg_origin})|(${CssProp.C.bg_image})|(${CssProp.C.color}))\\\\s*)+`,\n background_size: `${CssProp.C.bg_size}(,\\\\s*${CssProp.C.bg_size})*`,\n border_bottom_left_radius: `(${CssProp.B.length}|${CssProp.B.percentage})(\\\\s*(${CssProp.B.length}|${CssProp.B.percentage}))?`,\n border_bottom_width: CssProp.C.border_width,\n border_left_style: CssProp.A.border_style,\n border_right_style: CssProp.A.border_style,\n border_top: `((${CssProp.C.border_width}|${CssProp.A.border_style}|${CssProp.C.color})\\\\s*){1,3}`,\n bottom: `${CssProp.B.len_or_perc}|auto`,\n list_style: `((${CssProp.AP.list_style_type}|${CssProp.AP.list_style_position}|${CssProp.C.image}|none})\\\\s*){1,3}`,\n margin_top: CssProp.C.margin_width,\n outline: `((${CssProp.C.color}|invert|${CssProp.A.border_style}|${CssProp.C.border_width})\\\\s*){1,3}`,\n overflow_y: CssProp.AP.overflow_x,\n pitch: `${CssProp.B.frequency}|x-low|low|medium|high|x-high`,\n vertical_align: `baseline|sub|super|top|text-top|middle|bottom|text-bottom|${CssProp.B.len_or_perc}`,\n word_spacing: `normal|${CssProp.B.length}`,\n background_image: `${CssProp.C.bg_image}(,\\\\s*${CssProp.C.bg_image})*`,\n border_bottom_right_radius: `(${CssProp.B.length}|${CssProp.B.percentage})(\\\\s*(${CssProp.B.length}|${CssProp.B.percentage}))?`,\n border_left_width: CssProp.C.border_width,\n border_right_width: CssProp.C.border_width,\n left: `${CssProp.B.len_or_perc}|auto`,\n margin_bottom: CssProp.C.margin_width,\n pause_after: `${CssProp.B.time}|${CssProp.B.percentage}`,\n speech_rate: `${CssProp.N.number}|x-slow|slow|medium|fast|x-fast|faster|slower`,\n transition_duration: `${CssProp.B.time}(,\\\\s*${CssProp.B.time})*`,\n border_bottom: `((${CssProp.C.border_width}|${CssProp.A.border_style}|${CssProp.C.color})\\\\s*){1,3}`,\n border_right: `((${CssProp.C.border_width}|${CssProp.A.border_style}|${CssProp.C.color})\\\\s*){1,3}`,\n margin: `((${CssProp.C.margin_width})\\\\s*){1,4}`,\n padding_left: CssProp.C.padding_width,\n border_left: `((${CssProp.C.border_width}|${CssProp.A.border_style}|${CssProp.C.color})\\\\s*){1,3}`,\n quotes: `(${CssProp.B.string}\\\\s*${CssProp.B.string})+|none`,\n border_top_right_radius: `(${CssProp.B.length}|${CssProp.B.percentage})(\\\\s*(${CssProp.B.length}|${CssProp.B.percentage}))?`,\n min_width: `${CssProp.B.length_pos}|${CssProp.B.percentage_pos}|auto`\n};\nCssProp._CP1 = {\n font: `(((((${CssProp.AP.font_style}|${CssProp.AP.font_variant}|${CssProp.AP.font_weight})\\\\s*){1,3})?\\\\s*(${CssProp._CP.font_size})\\\\s*(\\\\/\\\\s*(${CssProp._CP.line_height}))?\\\\s+(${CssProp._CP.font_family}))|caption|icon|menu|message-box|small-caption|status-bar)`\n};\nCssProp.CP = { ...CssProp._CP, ...CssProp._CP1 };\n// CSS Property value validation regular expressions for use with sanitize-html\nCssProp.BORDER_COLLAPSE = CssProp.reg(CssProp.AP.border_collapse);\nCssProp.BOX = CssProp.reg(CssProp.AP.box);\nCssProp.BOX_SIZING = CssProp.reg(CssProp.AP.box_sizing);\nCssProp.CAPTION_SIDE = CssProp.reg(CssProp.AP.caption_side);\nCssProp.CLEAR = CssProp.reg(CssProp.AP.clear);\nCssProp.DIRECTION = CssProp.reg(CssProp.AP.direction);\nCssProp.EMPTY_CELLS = CssProp.reg(CssProp.AP.empty_cells);\nCssProp.FLOAT = CssProp.reg(CssProp.AP.float);\nCssProp.FONT_STRETCH = CssProp.reg(CssProp.AP.font_stretch);\nCssProp.FONT_STYLE = CssProp.reg(CssProp.AP.font_style);\nCssProp.FONT_VARIANT = CssProp.reg(CssProp.AP.font_variant);\nCssProp.FONT_WEIGHT = CssProp.reg(CssProp.AP.font_weight);\nCssProp.LIST_STYLE_POSITION = CssProp.reg(CssProp.AP.list_style_position);\nCssProp.LIST_STYLE_TYPE = CssProp.reg(CssProp.AP.list_style_type);\nCssProp.OVERFLOW = CssProp.reg(CssProp.AP.overflow);\nCssProp.OVERFLOW_WRAP = CssProp.reg(CssProp.AP.overflow_wrap);\nCssProp.OVERFLOW_X = CssProp.reg(CssProp.AP.overflow_x);\nCssProp.PAGE_BREAK_AFTER = CssProp.reg(CssProp.AP.page_break_after);\nCssProp.PAGE_BREAK_BEFORE = CssProp.reg(CssProp.AP.page_break_before);\nCssProp.PAGE_BREAK_INSIDE = CssProp.reg(CssProp.AP.page_break_inside);\nCssProp.POSITION = CssProp.reg(CssProp.AP.position);\nCssProp.RESIZE = CssProp.reg(CssProp.AP.resize);\nCssProp.SPEAK = CssProp.reg(CssProp.AP.speak);\nCssProp.SPEAK_HEADER = CssProp.reg(CssProp.AP.speak_header);\nCssProp.SPEAK_NUMERAL = CssProp.reg(CssProp.AP.speak_numeral);\nCssProp.SPEAK_PUNCTUATION = CssProp.reg(CssProp.AP.speak_punctuation);\nCssProp.TABLE_LAYOUT = CssProp.reg(CssProp.AP.table_layout);\nCssProp.TEXT_ALIGN = CssProp.reg(CssProp.AP.text_align);\nCssProp.TEXT_DECORATION = CssProp.reg(CssProp.AP.text_decoration);\nCssProp.TEXT_TRANSFORM = CssProp.reg(CssProp.AP.text_transform);\nCssProp.TEXT_WRAP = CssProp.reg(CssProp.AP.text_wrap);\nCssProp.UNICODE_BIDI = CssProp.reg(CssProp.AP.unicode_bidi);\nCssProp.VISIBILITY = CssProp.reg(CssProp.AP.visibility);\nCssProp.WHITE_SPACE = CssProp.reg(CssProp.AP.white_space);\nCssProp.WORD_BREAK = CssProp.reg(CssProp.AP.word_break);\nCssProp.BACKGROUND_ATTACHMENT = CssProp.reg(CssProp.CP.background_attachment);\nCssProp.BACKGROUND_COLOR = CssProp.reg(CssProp.CP.background_color);\nCssProp.BACKGROUND_ORIGIN = CssProp.reg(CssProp.CP.background_origin);\nCssProp.BACKGROUND_REPEAT = CssProp.reg(CssProp.CP.background_repeat);\nCssProp.BORDER = CssProp.reg(CssProp.CP.border);\nCssProp.BORDER_RADIUS = CssProp.reg(CssProp.CP.border_radius);\nCssProp.BORDER_SPACING = CssProp.reg(CssProp.CP.border_spacing);\nCssProp.BORDER_TOP_COLOR = CssProp.reg(CssProp.CP.border_top_color);\nCssProp.BORDER_TOP_STYLE = CssProp.reg(CssProp.CP.border_top_style);\nCssProp.BORDER_WIDTH = CssProp.reg(CssProp.CP.border_width);\nCssProp.COLOR = CssProp.reg(CssProp.CP.color);\nCssProp.CURSOR = CssProp.reg(CssProp.CP.cursor);\nCssProp.DISPLAY = CssProp.reg(CssProp.CP.display);\nCssProp.DISPLAY_OUTSIDE = CssProp.reg(CssProp.CP.display_outside);\nCssProp.ELEVATION = CssProp.reg(CssProp.CP.elevation);\nCssProp.FONT_FAMILY = CssProp.reg(CssProp.CP.font_family);\nCssProp.HEIGHT = CssProp.reg(CssProp.CP.height);\nCssProp.LETTER_SPACING = CssProp.reg(CssProp.CP.letter_spacing);\nCssProp.LIST_STYLE_IMAGE = CssProp.reg(CssProp.CP.list_style_image);\nCssProp.MARGIN_RIGHT = CssProp.reg(CssProp.CP.margin_right);\nCssProp.MAX_HEIGHT = CssProp.reg(CssProp.CP.max_height);\nCssProp.MIN_HEIGHT = CssProp.reg(CssProp.CP.min_height);\nCssProp.OPACITY = CssProp.reg(CssProp.CP.opacity);\nCssProp.OUTLINE_COLOR = CssProp.reg(CssProp.CP.outline_color);\nCssProp.OUTLINE_WIDTH = CssProp.reg(CssProp.CP.outline_width);\nCssProp.PADDING = CssProp.reg(CssProp.CP.padding);\nCssProp.PADDING_TOP = CssProp.reg(CssProp.CP.padding_top);\nCssProp.PITCH_RANGE = CssProp.reg(CssProp.CP.pitch_range);\nCssProp.RIGHT = CssProp.reg(CssProp.CP.right);\nCssProp.STRESS = CssProp.reg(CssProp.CP.stress);\nCssProp.TEXT_INDENT = CssProp.reg(CssProp.CP.text_indent);\nCssProp.TEXT_SHADOW = CssProp.reg(CssProp.CP.text_shadow);\nCssProp.VOLUME = CssProp.reg(CssProp.CP.volume);\nCssProp.WORD_WRAP = CssProp.reg(CssProp.CP.word_wrap);\nCssProp.ZOOM = CssProp.reg(CssProp.CP.zoom);\nCssProp.BACKFACE_VISIBILITY = CssProp.reg(CssProp.CP.backface_visibility);\nCssProp.BACKGROUND_CLIP = CssProp.reg(CssProp.CP.background_clip);\nCssProp.BACKGROUND_POSITION = CssProp.reg(CssProp.CP.background_position);\nCssProp.BORDER_BOTTOM_COLOR = CssProp.reg(CssProp.CP.border_bottom_color);\nCssProp.BORDER_BOTTOM_STYLE = CssProp.reg(CssProp.CP.border_bottom_style);\nCssProp.BORDER_COLOR = CssProp.reg(CssProp.CP.border_color);\nCssProp.BORDER_LEFT_COLOR = CssProp.reg(CssProp.CP.border_left_color);\nCssProp.BORDER_RIGHT_COLOR = CssProp.reg(CssProp.CP.border_right_color);\nCssProp.BORDER_STYLE = CssProp.reg(CssProp.CP.border_style);\nCssProp.BORDER_TOP_LEFT_RADIUS = CssProp.reg(CssProp.CP.border_top_left_radius);\nCssProp.BORDER_TOP_WIDTH = CssProp.reg(CssProp.CP.border_top_width);\nCssProp.BOX_SHADOW = CssProp.reg(CssProp.CP.box_shadow);\nCssProp.CLIP = CssProp.reg(CssProp.CP.clip);\nCssProp.DISPLAY_INSIDE = CssProp.reg(CssProp.CP.display_inside);\nCssProp.FONT_SIZE = CssProp.reg(CssProp.CP.font_size);\nCssProp.LINE_HEIGHT = CssProp.reg(CssProp.CP.line_height);\nCssProp.MARGIN_LEFT = CssProp.reg(CssProp.CP.margin_left);\nCssProp.MAX_WIDTH = CssProp.reg(CssProp.CP.max_width);\nCssProp.OUTLINE_STYLE = CssProp.reg(CssProp.CP.outline_style);\nCssProp.PADDING_BOTTOM = CssProp.reg(CssProp.CP.padding_bottom);\nCssProp.PADDING_RIGHT = CssProp.reg(CssProp.CP.padding_right);\nCssProp.PERSPECTIVE = CssProp.reg(CssProp.CP.perspective);\nCssProp.RICHNESS = CssProp.reg(CssProp.CP.richness);\nCssProp.TEXT_OVERFLOW = CssProp.reg(CssProp.CP.text_overflow);\nCssProp.TOP = CssProp.reg(CssProp.CP.top);\nCssProp.WIDTH = CssProp.reg(CssProp.CP.width);\nCssProp.Z_INDEX = CssProp.reg(CssProp.CP.z_index);\nCssProp.BACKGROUND = CssProp.reg(CssProp.CP.background);\nCssProp.BACKGROUND_SIZE = CssProp.reg(CssProp.CP.background_size);\nCssProp.BORDER_BOTTOM_LEFT_RADIUS = CssProp.reg(CssProp.CP.border_bottom_left_radius);\nCssProp.BORDER_BOTTOM_WIDTH = CssProp.reg(CssProp.CP.border_bottom_width);\nCssProp.BORDER_LEFT_STYLE = CssProp.reg(CssProp.CP.border_left_style);\nCssProp.BORDER_RIGHT_STYLE = CssProp.reg(CssProp.CP.border_right_style);\nCssProp.BORDER_TOP = CssProp.reg(CssProp.CP.border_top);\nCssProp.BOTTOM = CssProp.reg(CssProp.CP.bottom);\nCssProp.LIST_STYLE = CssProp.reg(CssProp.CP.list_style);\nCssProp.MARGIN_TOP = CssProp.reg(CssProp.CP.margin_top);\nCssProp.OUTLINE = CssProp.reg(CssProp.CP.outline);\nCssProp.OVERFLOW_Y = CssProp.reg(CssProp.CP.overflow_y);\nCssProp.PITCH = CssProp.reg(CssProp.CP.pitch);\nCssProp.VERTICAL_ALIGN = CssProp.reg(CssProp.CP.vertical_align);\nCssProp.WORD_SPACING = CssProp.reg(CssProp.CP.word_spacing);\nCssProp.BACKGROUND_IMAGE = CssProp.reg(CssProp.CP.background_image);\nCssProp.BORDER_BOTTOM_RIGHT_RADIUS = CssProp.reg(CssProp.CP.border_bottom_right_radius);\nCssProp.BORDER_LEFT_WIDTH = CssProp.reg(CssProp.CP.border_left_width);\nCssProp.BORDER_RIGHT_WIDTH = CssProp.reg(CssProp.CP.border_right_width);\nCssProp.LEFT = CssProp.reg(CssProp.CP.left);\nCssProp.MARGIN_BOTTOM = CssProp.reg(CssProp.CP.margin_bottom);\nCssProp.PAUSE_AFTER = CssProp.reg(CssProp.CP.pause_after);\nCssProp.SPEECH_RATE = CssProp.reg(CssProp.CP.speech_rate);\nCssProp.TRANSITION_DURATION = CssProp.reg(CssProp.CP.transition_duration);\nCssProp.BORDER_BOTTOM = CssProp.reg(CssProp.CP.border_bottom);\nCssProp.BORDER_RIGHT = CssProp.reg(CssProp.CP.border_right);\nCssProp.MARGIN = CssProp.reg(CssProp.CP.margin);\nCssProp.PADDING_LEFT = CssProp.reg(CssProp.CP.padding_left);\nCssProp.BORDER_LEFT = CssProp.reg(CssProp.CP.border_left);\nCssProp.FONT = CssProp.reg(CssProp.CP.font);\nCssProp.QUOTES = CssProp.reg(CssProp.CP.quotes);\nCssProp.BORDER_TOP_RIGHT_RADIUS = CssProp.reg(CssProp.CP.border_top_right_radius);\nCssProp.MIN_WIDTH = CssProp.reg(CssProp.CP.min_width);\n/**\n * A class to sanitize HTML strings.\n */\nexport class Sanitizer {\n constructor() {\n this._autolink = true;\n this._allowNamedProperties = false;\n this._generateOptions = () => ({\n // HTML tags that are allowed to be used. Tags were extracted from Google Caja\n allowedTags: [\n 'a',\n 'abbr',\n 'acronym',\n 'address',\n 'area',\n 'article',\n 'aside',\n 'audio',\n 'b',\n 'bdi',\n 'bdo',\n 'big',\n 'blockquote',\n 'br',\n 'button',\n 'canvas',\n 'caption',\n 'center',\n 'cite',\n 'code',\n 'col',\n 'colgroup',\n 'colspan',\n 'command',\n 'data',\n 'datalist',\n 'dd',\n 'del',\n 'details',\n 'dfn',\n 'dir',\n 'div',\n 'dl',\n 'dt',\n 'em',\n 'fieldset',\n 'figcaption',\n 'figure',\n 'font',\n 'footer',\n 'form',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'header',\n 'hgroup',\n 'hr',\n 'i',\n // 'iframe' is allowed by Google Caja, but disallowed by default by sanitize-html\n // , 'iframe'\n 'img',\n 'input',\n 'ins',\n 'kbd',\n 'label',\n 'legend',\n 'li',\n 'map',\n 'mark',\n 'menu',\n 'meter',\n 'nav',\n 'nobr',\n 'ol',\n 'optgroup',\n 'option',\n 'output',\n 'p',\n 'pre',\n 'progress',\n 'q',\n 'rowspan',\n 's',\n 'samp',\n 'section',\n 'select',\n 'small',\n 'source',\n 'span',\n 'strike',\n 'strong',\n 'sub',\n 'summary',\n 'sup',\n 'table',\n 'tbody',\n 'td',\n 'textarea',\n 'tfoot',\n 'th',\n 'thead',\n 'time',\n 'tr',\n 'track',\n 'tt',\n 'u',\n 'ul',\n 'var',\n 'video',\n 'wbr'\n ],\n // Attributes that HTML tags are allowed to have, extracted from Google Caja.\n // See https://github.com/jupyterlab/jupyterlab/issues/1812#issuecomment-285848435\n allowedAttributes: {\n '*': [\n 'class',\n 'dir',\n 'draggable',\n 'hidden',\n ...(this._allowNamedProperties ? ['id'] : []),\n 'inert',\n 'itemprop',\n 'itemref',\n 'itemscope',\n 'lang',\n 'spellcheck',\n 'style',\n 'title',\n 'translate'\n ],\n // 'rel' and 'target' were *not* allowed by Google Caja\n a: [\n 'accesskey',\n 'coords',\n 'href',\n 'hreflang',\n ...(this._allowNamedProperties ? ['name'] : []),\n 'rel',\n 'shape',\n 'tabindex',\n 'target',\n 'type'\n ],\n area: [\n 'accesskey',\n 'alt',\n 'coords',\n 'href',\n 'nohref',\n 'shape',\n 'tabindex'\n ],\n // 'autoplay' was *not* allowed by Google Caja\n audio: [\n 'autoplay',\n 'controls',\n 'loop',\n 'mediagroup',\n 'muted',\n 'preload',\n 'src'\n ],\n bdo: ['dir'],\n blockquote: ['cite'],\n br: ['clear'],\n button: [\n 'accesskey',\n 'data-commandlinker-args',\n 'data-commandlinker-command',\n 'disabled',\n ...(this._allowNamedProperties ? ['name'] : []),\n 'tabindex',\n 'type',\n 'value'\n ],\n canvas: ['height', 'width'],\n caption: ['align'],\n col: ['align', 'char', 'charoff', 'span', 'valign', 'width'],\n colgroup: ['align', 'char', 'charoff', 'span', 'valign', 'width'],\n command: [\n 'checked',\n 'command',\n 'disabled',\n 'icon',\n 'label',\n 'radiogroup',\n 'type'\n ],\n data: ['value'],\n del: ['cite', 'datetime'],\n details: ['open'],\n dir: ['compact'],\n div: ['align'],\n dl: ['compact'],\n fieldset: ['disabled'],\n font: ['color', 'face', 'size'],\n form: [\n 'accept',\n 'autocomplete',\n 'enctype',\n 'method',\n ...(this._allowNamedProperties ? ['name'] : []),\n 'novalidate'\n ],\n h1: ['align'],\n h2: ['align'],\n h3: ['align'],\n h4: ['align'],\n h5: ['align'],\n h6: ['align'],\n hr: ['align', 'noshade', 'size', 'width'],\n iframe: [\n 'align',\n 'frameborder',\n 'height',\n 'marginheight',\n 'marginwidth',\n 'width'\n ],\n img: [\n 'align',\n 'alt',\n 'border',\n 'height',\n 'hspace',\n 'ismap',\n ...(this._allowNamedProperties ? ['name'] : []),\n 'src',\n 'usemap',\n 'vspace',\n 'width'\n ],\n input: [\n 'accept',\n 'accesskey',\n 'align',\n 'alt',\n 'autocomplete',\n 'checked',\n 'disabled',\n 'inputmode',\n 'ismap',\n 'list',\n 'max',\n 'maxlength',\n 'min',\n 'multiple',\n ...(this._allowNamedProperties ? ['name'] : []),\n 'placeholder',\n 'readonly',\n 'required',\n 'size',\n 'src',\n 'step',\n 'tabindex',\n 'type',\n 'usemap',\n 'value'\n ],\n ins: ['cite', 'datetime'],\n label: ['accesskey', 'for'],\n legend: ['accesskey', 'align'],\n li: ['type', 'value'],\n map: this._allowNamedProperties ? ['name'] : [],\n menu: ['compact', 'label', 'type'],\n meter: ['high', 'low', 'max', 'min', 'value'],\n ol: ['compact', 'reversed', 'start', 'type'],\n optgroup: ['disabled', 'label'],\n option: ['disabled', 'label', 'selected', 'value'],\n output: ['for', ...(this._allowNamedProperties ? ['name'] : [])],\n p: ['align'],\n pre: ['width'],\n progress: ['max', 'min', 'value'],\n q: ['cite'],\n select: [\n 'autocomplete',\n 'disabled',\n 'multiple',\n ...(this._allowNamedProperties ? ['name'] : []),\n 'required',\n 'size',\n 'tabindex'\n ],\n source: ['type'],\n table: [\n 'align',\n 'bgcolor',\n 'border',\n 'cellpadding',\n 'cellspacing',\n 'frame',\n 'rules',\n 'summary',\n 'width'\n ],\n tbody: ['align', 'char', 'charoff', 'valign'],\n td: [\n 'abbr',\n 'align',\n 'axis',\n 'bgcolor',\n 'char',\n 'charoff',\n 'colspan',\n 'headers',\n 'height',\n 'nowrap',\n 'rowspan',\n 'scope',\n 'valign',\n 'width'\n ],\n textarea: [\n 'accesskey',\n 'autocomplete',\n 'cols',\n 'disabled',\n 'inputmode',\n ...(this._allowNamedProperties ? ['name'] : []),\n 'placeholder',\n 'readonly',\n 'required',\n 'rows',\n 'tabindex',\n 'wrap'\n ],\n tfoot: ['align', 'char', 'charoff', 'valign'],\n th: [\n 'abbr',\n 'align',\n 'axis',\n 'bgcolor',\n 'char',\n 'charoff',\n 'colspan',\n 'headers',\n 'height',\n 'nowrap',\n 'rowspan',\n 'scope',\n 'valign',\n 'width'\n ],\n thead: ['align', 'char', 'charoff', 'valign'],\n tr: ['align', 'bgcolor', 'char', 'charoff', 'valign'],\n track: ['default', 'kind', 'label', 'srclang'],\n ul: ['compact', 'type'],\n video: [\n 'autoplay',\n 'controls',\n 'height',\n 'loop',\n 'mediagroup',\n 'muted',\n 'poster',\n 'preload',\n 'src',\n 'width'\n ]\n },\n // Inline CSS styles that HTML tags may have (and their allowed values)\n allowedStyles: {\n // To simplify the data, all styles are allowed on all tags that allow the style attribute\n '*': {\n 'backface-visibility': [CssProp.BACKFACE_VISIBILITY],\n background: [CssProp.BACKGROUND],\n 'background-attachment': [CssProp.BACKGROUND_ATTACHMENT],\n 'background-clip': [CssProp.BACKGROUND_CLIP],\n 'background-color': [CssProp.BACKGROUND_COLOR],\n 'background-image': [CssProp.BACKGROUND_IMAGE],\n 'background-origin': [CssProp.BACKGROUND_ORIGIN],\n 'background-position': [CssProp.BACKGROUND_POSITION],\n 'background-repeat': [CssProp.BACKGROUND_REPEAT],\n 'background-size': [CssProp.BACKGROUND_SIZE],\n border: [CssProp.BORDER],\n 'border-bottom': [CssProp.BORDER_BOTTOM],\n 'border-bottom-color': [CssProp.BORDER_BOTTOM_COLOR],\n 'border-bottom-left-radius': [CssProp.BORDER_BOTTOM_LEFT_RADIUS],\n 'border-bottom-right-radius': [CssProp.BORDER_BOTTOM_RIGHT_RADIUS],\n 'border-bottom-style': [CssProp.BORDER_BOTTOM_STYLE],\n 'border-bottom-width': [CssProp.BORDER_BOTTOM_WIDTH],\n 'border-collapse': [CssProp.BORDER_COLLAPSE],\n 'border-color': [CssProp.BORDER_COLOR],\n 'border-left': [CssProp.BORDER_LEFT],\n 'border-left-color': [CssProp.BORDER_LEFT_COLOR],\n 'border-left-style': [CssProp.BORDER_LEFT_STYLE],\n 'border-left-width': [CssProp.BORDER_LEFT_WIDTH],\n 'border-radius': [CssProp.BORDER_RADIUS],\n 'border-right': [CssProp.BORDER_RIGHT],\n 'border-right-color': [CssProp.BORDER_RIGHT_COLOR],\n 'border-right-style': [CssProp.BORDER_RIGHT_STYLE],\n 'border-right-width': [CssProp.BORDER_RIGHT_WIDTH],\n 'border-spacing': [CssProp.BORDER_SPACING],\n 'border-style': [CssProp.BORDER_STYLE],\n 'border-top': [CssProp.BORDER_TOP],\n 'border-top-color': [CssProp.BORDER_TOP_COLOR],\n 'border-top-left-radius': [CssProp.BORDER_TOP_LEFT_RADIUS],\n 'border-top-right-radius': [CssProp.BORDER_TOP_RIGHT_RADIUS],\n 'border-top-style': [CssProp.BORDER_TOP_STYLE],\n 'border-top-width': [CssProp.BORDER_TOP_WIDTH],\n 'border-width': [CssProp.BORDER_WIDTH],\n bottom: [CssProp.BOTTOM],\n box: [CssProp.BOX],\n 'box-shadow': [CssProp.BOX_SHADOW],\n 'box-sizing': [CssProp.BOX_SIZING],\n 'caption-side': [CssProp.CAPTION_SIDE],\n clear: [CssProp.CLEAR],\n clip: [CssProp.CLIP],\n color: [CssProp.COLOR],\n cursor: [CssProp.CURSOR],\n direction: [CssProp.DIRECTION],\n display: [CssProp.DISPLAY],\n 'display-inside': [CssProp.DISPLAY_INSIDE],\n 'display-outside': [CssProp.DISPLAY_OUTSIDE],\n elevation: [CssProp.ELEVATION],\n 'empty-cells': [CssProp.EMPTY_CELLS],\n float: [CssProp.FLOAT],\n font: [CssProp.FONT],\n 'font-family': [CssProp.FONT_FAMILY],\n 'font-size': [CssProp.FONT_SIZE],\n 'font-stretch': [CssProp.FONT_STRETCH],\n 'font-style': [CssProp.FONT_STYLE],\n 'font-variant': [CssProp.FONT_VARIANT],\n 'font-weight': [CssProp.FONT_WEIGHT],\n height: [CssProp.HEIGHT],\n left: [CssProp.LEFT],\n 'letter-spacing': [CssProp.LETTER_SPACING],\n 'line-height': [CssProp.LINE_HEIGHT],\n 'list-style': [CssProp.LIST_STYLE],\n 'list-style-image': [CssProp.LIST_STYLE_IMAGE],\n 'list-style-position': [CssProp.LIST_STYLE_POSITION],\n 'list-style-type': [CssProp.LIST_STYLE_TYPE],\n margin: [CssProp.MARGIN],\n 'margin-bottom': [CssProp.MARGIN_BOTTOM],\n 'margin-left': [CssProp.MARGIN_LEFT],\n 'margin-right': [CssProp.MARGIN_RIGHT],\n 'margin-top': [CssProp.MARGIN_TOP],\n 'max-height': [CssProp.MAX_HEIGHT],\n 'max-width': [CssProp.MAX_WIDTH],\n 'min-height': [CssProp.MIN_HEIGHT],\n 'min-width': [CssProp.MIN_WIDTH],\n opacity: [CssProp.OPACITY],\n outline: [CssProp.OUTLINE],\n 'outline-color': [CssProp.OUTLINE_COLOR],\n 'outline-style': [CssProp.OUTLINE_STYLE],\n 'outline-width': [CssProp.OUTLINE_WIDTH],\n overflow: [CssProp.OVERFLOW],\n 'overflow-wrap': [CssProp.OVERFLOW_WRAP],\n 'overflow-x': [CssProp.OVERFLOW_X],\n 'overflow-y': [CssProp.OVERFLOW_Y],\n padding: [CssProp.PADDING],\n 'padding-bottom': [CssProp.PADDING_BOTTOM],\n 'padding-left': [CssProp.PADDING_LEFT],\n 'padding-right': [CssProp.PADDING_RIGHT],\n 'padding-top': [CssProp.PADDING_TOP],\n 'page-break-after': [CssProp.PAGE_BREAK_AFTER],\n 'page-break-before': [CssProp.PAGE_BREAK_BEFORE],\n 'page-break-inside': [CssProp.PAGE_BREAK_INSIDE],\n 'pause-after': [CssProp.PAUSE_AFTER],\n perspective: [CssProp.PERSPECTIVE],\n pitch: [CssProp.PITCH],\n 'pitch-range': [CssProp.PITCH_RANGE],\n position: [CssProp.POSITION],\n quotes: [CssProp.QUOTES],\n resize: [CssProp.RESIZE],\n richness: [CssProp.RICHNESS],\n right: [CssProp.RIGHT],\n speak: [CssProp.SPEAK],\n 'speak-header': [CssProp.SPEAK_HEADER],\n 'speak-numeral': [CssProp.SPEAK_NUMERAL],\n 'speak-punctuation': [CssProp.SPEAK_PUNCTUATION],\n 'speech-rate': [CssProp.SPEECH_RATE],\n stress: [CssProp.STRESS],\n 'table-layout': [CssProp.TABLE_LAYOUT],\n 'text-align': [CssProp.TEXT_ALIGN],\n 'text-decoration': [CssProp.TEXT_DECORATION],\n 'text-indent': [CssProp.TEXT_INDENT],\n 'text-overflow': [CssProp.TEXT_OVERFLOW],\n 'text-shadow': [CssProp.TEXT_SHADOW],\n 'text-transform': [CssProp.TEXT_TRANSFORM],\n 'text-wrap': [CssProp.TEXT_WRAP],\n top: [CssProp.TOP],\n 'unicode-bidi': [CssProp.UNICODE_BIDI],\n 'vertical-align': [CssProp.VERTICAL_ALIGN],\n visibility: [CssProp.VISIBILITY],\n volume: [CssProp.VOLUME],\n 'white-space': [CssProp.WHITE_SPACE],\n width: [CssProp.WIDTH],\n 'word-break': [CssProp.WORD_BREAK],\n 'word-spacing': [CssProp.WORD_SPACING],\n 'word-wrap': [CssProp.WORD_WRAP],\n 'z-index': [CssProp.Z_INDEX],\n zoom: [CssProp.ZOOM]\n }\n },\n transformTags: {\n // Set the \"rel\" attribute for tags to \"nofollow\".\n a: sanitize.simpleTransform('a', { rel: 'nofollow' }),\n // Set the \"disabled\" attribute for tags.\n input: sanitize.simpleTransform('input', { disabled: 'disabled' })\n },\n allowedSchemes: [...sanitize.defaults.allowedSchemes],\n allowedSchemesByTag: {\n // Allow 'attachment:' img src (used for markdown cell attachments).\n img: sanitize.defaults.allowedSchemes.concat(['attachment'])\n },\n // Override of the default option, so we can skip 'src' attribute validation.\n // 'src' Attributes are validated to be URIs, which does not allow for embedded (image) data.\n // Since embedded data is no longer deemed to be a threat, validation can be skipped.\n // See https://github.com/jupyterlab/jupyterlab/issues/5183\n allowedSchemesAppliedToAttributes: ['href', 'cite']\n });\n this._options = this._generateOptions();\n }\n /**\n * Sanitize an HTML string.\n *\n * @param dirty - The dirty text.\n *\n * @param options - The optional sanitization options.\n *\n * @returns The sanitized string.\n */\n sanitize(dirty, options) {\n return sanitize(dirty, { ...this._options, ...(options || {}) });\n }\n /**\n * @returns Whether to replace URLs by HTML anchors.\n */\n getAutolink() {\n return this._autolink;\n }\n /**\n * Set the allowed schemes\n *\n * @param scheme Allowed schemes\n */\n setAllowedSchemes(scheme) {\n // Force copy of `scheme`\n this._options.allowedSchemes = [...scheme];\n }\n /**\n * Set the URL replacement boolean.\n *\n * @param autolink URL replacement boolean.\n */\n setAutolink(autolink) {\n this._autolink = autolink;\n }\n /**\n * Set the whether to allow `name` and `id` attributes.\n */\n setAllowNamedProperties(allowNamedProperties) {\n this._allowNamedProperties = allowNamedProperties;\n this._options = this._generateOptions();\n }\n}\n//# sourceMappingURL=sanitizer.js.map","/**\n * The default mime model implementation.\n */\nexport class MimeModel {\n /**\n * Construct a new mime model.\n */\n constructor(options = {}) {\n this.trusted = !!options.trusted;\n this._data = options.data || {};\n this._metadata = options.metadata || {};\n this._callback = options.callback || Private.noOp;\n }\n /**\n * The data associated with the model.\n */\n get data() {\n return this._data;\n }\n /**\n * The metadata associated with the model.\n */\n get metadata() {\n return this._metadata;\n }\n /**\n * Set the data associated with the model.\n *\n * #### Notes\n * Depending on the implementation of the mime model,\n * this call may or may not have deferred effects,\n */\n setData(options) {\n this._data = options.data || this._data;\n this._metadata = options.metadata || this._metadata;\n this._callback(options);\n }\n}\n/**\n * The namespace for module private data.\n */\nvar Private;\n(function (Private) {\n /**\n * A no-op callback function.\n */\n function noOp() {\n /* no-op */\n }\n Private.noOp = noOp;\n})(Private || (Private = {}));\n//# sourceMappingURL=mimemodel.js.map","/* -----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\nimport { Sanitizer } from '@jupyterlab/apputils';\nimport { PageConfig, PathExt, URLExt } from '@jupyterlab/coreutils';\nimport { nullTranslator } from '@jupyterlab/translation';\nimport { MimeModel } from './mimemodel';\n/**\n * An object which manages mime renderer factories.\n *\n * This object is used to render mime models using registered mime\n * renderers, selecting the preferred mime renderer to render the\n * model into a widget.\n *\n * #### Notes\n * This class is not intended to be subclassed.\n */\nexport class RenderMimeRegistry {\n /**\n * Construct a new rendermime.\n *\n * @param options - The options for initializing the instance.\n */\n constructor(options = {}) {\n var _a, _b, _c, _d, _e, _f;\n this._id = 0;\n this._ranks = {};\n this._types = null;\n this._factories = {};\n // Parse the options.\n this.translator = (_a = options.translator) !== null && _a !== void 0 ? _a : nullTranslator;\n this.resolver = (_b = options.resolver) !== null && _b !== void 0 ? _b : null;\n this.linkHandler = (_c = options.linkHandler) !== null && _c !== void 0 ? _c : null;\n this.latexTypesetter = (_d = options.latexTypesetter) !== null && _d !== void 0 ? _d : null;\n this.markdownParser = (_e = options.markdownParser) !== null && _e !== void 0 ? _e : null;\n this.sanitizer = (_f = options.sanitizer) !== null && _f !== void 0 ? _f : new Sanitizer();\n // Add the initial factories.\n if (options.initialFactories) {\n for (const factory of options.initialFactories) {\n this.addFactory(factory);\n }\n }\n }\n /**\n * The ordered list of mimeTypes.\n */\n get mimeTypes() {\n return this._types || (this._types = Private.sortedTypes(this._ranks));\n }\n /**\n * Find the preferred mime type for a mime bundle.\n *\n * @param bundle - The bundle of mime data.\n *\n * @param safe - How to consider safe/unsafe factories. If 'ensure',\n * it will only consider safe factories. If 'any', any factory will be\n * considered. If 'prefer', unsafe factories will be considered, but\n * only after the safe options have been exhausted.\n *\n * @returns The preferred mime type from the available factories,\n * or `undefined` if the mime type cannot be rendered.\n */\n preferredMimeType(bundle, safe = 'ensure') {\n // Try to find a safe factory first, if preferred.\n if (safe === 'ensure' || safe === 'prefer') {\n for (const mt of this.mimeTypes) {\n if (mt in bundle && this._factories[mt].safe) {\n return mt;\n }\n }\n }\n if (safe !== 'ensure') {\n // Otherwise, search for the best factory among all factories.\n for (const mt of this.mimeTypes) {\n if (mt in bundle) {\n return mt;\n }\n }\n }\n // Otherwise, no matching mime type exists.\n return undefined;\n }\n /**\n * Create a renderer for a mime type.\n *\n * @param mimeType - The mime type of interest.\n *\n * @returns A new renderer for the given mime type.\n *\n * @throws An error if no factory exists for the mime type.\n */\n createRenderer(mimeType) {\n // Throw an error if no factory exists for the mime type.\n if (!(mimeType in this._factories)) {\n throw new Error(`No factory for mime type: '${mimeType}'`);\n }\n // Invoke the best factory for the given mime type.\n return this._factories[mimeType].createRenderer({\n mimeType,\n resolver: this.resolver,\n sanitizer: this.sanitizer,\n linkHandler: this.linkHandler,\n latexTypesetter: this.latexTypesetter,\n markdownParser: this.markdownParser,\n translator: this.translator\n });\n }\n /**\n * Create a new mime model. This is a convenience method.\n *\n * @options - The options used to create the model.\n *\n * @returns A new mime model.\n */\n createModel(options = {}) {\n return new MimeModel(options);\n }\n /**\n * Create a clone of this rendermime instance.\n *\n * @param options - The options for configuring the clone.\n *\n * @returns A new independent clone of the rendermime.\n */\n clone(options = {}) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;\n // Create the clone.\n const clone = new RenderMimeRegistry({\n resolver: (_b = (_a = options.resolver) !== null && _a !== void 0 ? _a : this.resolver) !== null && _b !== void 0 ? _b : undefined,\n sanitizer: (_d = (_c = options.sanitizer) !== null && _c !== void 0 ? _c : this.sanitizer) !== null && _d !== void 0 ? _d : undefined,\n linkHandler: (_f = (_e = options.linkHandler) !== null && _e !== void 0 ? _e : this.linkHandler) !== null && _f !== void 0 ? _f : undefined,\n latexTypesetter: (_h = (_g = options.latexTypesetter) !== null && _g !== void 0 ? _g : this.latexTypesetter) !== null && _h !== void 0 ? _h : undefined,\n markdownParser: (_k = (_j = options.markdownParser) !== null && _j !== void 0 ? _j : this.markdownParser) !== null && _k !== void 0 ? _k : undefined,\n translator: this.translator\n });\n // Clone the internal state.\n clone._factories = { ...this._factories };\n clone._ranks = { ...this._ranks };\n clone._id = this._id;\n // Return the cloned object.\n return clone;\n }\n /**\n * Get the renderer factory registered for a mime type.\n *\n * @param mimeType - The mime type of interest.\n *\n * @returns The factory for the mime type, or `undefined`.\n */\n getFactory(mimeType) {\n return this._factories[mimeType];\n }\n /**\n * Add a renderer factory to the rendermime.\n *\n * @param factory - The renderer factory of interest.\n *\n * @param rank - The rank of the renderer. A lower rank indicates\n * a higher priority for rendering. If not given, the rank will\n * defer to the `defaultRank` of the factory. If no `defaultRank`\n * is given, it will default to 100.\n *\n * #### Notes\n * The renderer will replace an existing renderer for the given\n * mimeType.\n */\n addFactory(factory, rank) {\n if (rank === undefined) {\n rank = factory.defaultRank;\n if (rank === undefined) {\n rank = 100;\n }\n }\n for (const mt of factory.mimeTypes) {\n this._factories[mt] = factory;\n this._ranks[mt] = { rank, id: this._id++ };\n }\n this._types = null;\n }\n /**\n * Remove a mime type.\n *\n * @param mimeType - The mime type of interest.\n */\n removeMimeType(mimeType) {\n delete this._factories[mimeType];\n delete this._ranks[mimeType];\n this._types = null;\n }\n /**\n * Get the rank for a given mime type.\n *\n * @param mimeType - The mime type of interest.\n *\n * @returns The rank of the mime type or undefined.\n */\n getRank(mimeType) {\n const rank = this._ranks[mimeType];\n return rank && rank.rank;\n }\n /**\n * Set the rank of a given mime type.\n *\n * @param mimeType - The mime type of interest.\n *\n * @param rank - The new rank to assign.\n *\n * #### Notes\n * This is a no-op if the mime type is not registered.\n */\n setRank(mimeType, rank) {\n if (!this._ranks[mimeType]) {\n return;\n }\n const id = this._id++;\n this._ranks[mimeType] = { rank, id };\n this._types = null;\n }\n}\n/**\n * The namespace for `RenderMimeRegistry` class statics.\n */\n(function (RenderMimeRegistry) {\n /**\n * A default resolver that uses a given reference path and a contents manager.\n */\n class UrlResolver {\n /**\n * Create a new url resolver.\n */\n constructor(options) {\n this._path = options.path;\n this._contents = options.contents;\n }\n /**\n * The path of the object, from which local urls can be derived.\n */\n get path() {\n return this._path;\n }\n set path(value) {\n this._path = value;\n }\n /**\n * Resolve a relative url to an absolute url path.\n */\n async resolveUrl(url) {\n if (this.isLocal(url)) {\n const cwd = encodeURI(PathExt.dirname(this.path));\n url = PathExt.resolve(cwd, url);\n }\n return url;\n }\n /**\n * Get the download url of a given absolute url path.\n *\n * #### Notes\n * The returned URL may include a query parameter.\n */\n async getDownloadUrl(urlPath) {\n if (this.isLocal(urlPath)) {\n // decode url->path before passing to contents api\n return this._contents.getDownloadUrl(decodeURIComponent(urlPath));\n }\n return urlPath;\n }\n /**\n * Whether the URL should be handled by the resolver\n * or not.\n *\n * @param allowRoot - Whether the paths starting at Unix-style filesystem root (`/`) are permitted.\n *\n * #### Notes\n * This is similar to the `isLocal` check in `URLExt`,\n * but it also checks whether the path points to any\n * of the `IDrive`s that may be registered with the contents\n * manager.\n */\n isLocal(url, allowRoot = false) {\n if (this.isMalformed(url)) {\n return false;\n }\n return (URLExt.isLocal(url, allowRoot) ||\n !!this._contents.driveName(decodeURI(url)));\n }\n /**\n * Resolve a path from Jupyter kernel to a path:\n * - relative to `root_dir` (preferrably) this is in jupyter-server scope,\n * - path understood and known by kernel (if such a path exists).\n * Returns `null` if there is no file matching provided path in neither\n * kernel nor jupyter-server contents manager.\n */\n async resolvePath(path) {\n // TODO: a clean implementation would be server-side and depends on:\n // https://github.com/jupyter-server/jupyter_server/issues/1280\n const rootDir = PageConfig.getOption('rootUri').replace('file://', '');\n // Workaround: expand `~` path using root dir (if it matches).\n if (path.startsWith('~/') && rootDir.startsWith('/home/')) {\n // For now we assume that kernel is in root dir.\n path = rootDir.split('/').slice(0, 3).join('/') + path.substring(1);\n }\n if (path.startsWith(rootDir) || path.startsWith('./')) {\n try {\n const relativePath = path.replace(rootDir, '');\n // If file exists on the server we have guessed right\n const response = await this._contents.get(relativePath, {\n content: false\n });\n return {\n path: response.path,\n scope: 'server'\n };\n }\n catch (error) {\n // The file seems like should be on the server but is not.\n console.warn(`Could not resolve location of ${path} on server`);\n return null;\n }\n }\n // The file is not accessible from jupyter-server but maybe it is\n // available from DAP `source`; we assume the path is available\n // from kernel because currently we have no way of checking this\n // without introducing a cycle (unless we were to set the debugger\n // service instance on the resolver later).\n return {\n path: path,\n scope: 'kernel'\n };\n }\n /**\n * Whether the URL can be decoded using `decodeURI`.\n */\n isMalformed(url) {\n try {\n decodeURI(url);\n return false;\n }\n catch (error) {\n if (error instanceof URIError) {\n return true;\n }\n throw error;\n }\n }\n }\n RenderMimeRegistry.UrlResolver = UrlResolver;\n})(RenderMimeRegistry || (RenderMimeRegistry = {}));\n/**\n * The namespace for the module implementation details.\n */\nvar Private;\n(function (Private) {\n /**\n * Get the mime types in the map, ordered by rank.\n */\n function sortedTypes(map) {\n return Object.keys(map).sort((a, b) => {\n const p1 = map[a];\n const p2 = map[b];\n if (p1.rank !== p2.rank) {\n return p1.rank - p2.rank;\n }\n return p1.id - p2.id;\n });\n }\n Private.sortedTypes = sortedTypes;\n})(Private || (Private = {}));\n//# sourceMappingURL=registry.js.map","/* -----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Distributed under the terms of the Modified BSD License.\n|----------------------------------------------------------------------------*/\n/**\n * @packageDocumentation\n * @module mathjax2\n */\nimport { PromiseDelegate } from '@lumino/coreutils';\n/**\n * The MathJax Typesetter.\n */\nexport class MathJaxTypesetter {\n /**\n * Create a new MathJax typesetter.\n */\n constructor(options) {\n this._initPromise = new PromiseDelegate();\n this._initialized = false;\n this._url = options.url;\n this._config = options.config;\n }\n /**\n * Typeset the math in a node.\n *\n * #### Notes\n * MathJax schedules the typesetting asynchronously,\n * but there are not currently any callbacks or Promises\n * firing when it is done.\n */\n typeset(node) {\n if (!this._initialized) {\n this._init();\n }\n void this._initPromise.promise.then(() => {\n MathJax.Hub.Queue(['Typeset', MathJax.Hub, node]);\n try {\n MathJax.Hub.Queue(['Require', MathJax.Ajax, '[MathJax]/extensions/TeX/AMSmath.js'], () => {\n MathJax.InputJax.TeX.resetEquationNumbers();\n });\n }\n catch (e) {\n console.error('Error queueing resetEquationNumbers:', e);\n }\n });\n }\n /**\n * Initialize MathJax.\n */\n _init() {\n const head = document.getElementsByTagName('head')[0];\n const script = document.createElement('script');\n script.type = 'text/javascript';\n script.src = `${this._url}?config=${this._config}&delayStartupUntil=configured`;\n script.charset = 'utf-8';\n head.appendChild(script);\n script.addEventListener('load', () => {\n this._onLoad();\n });\n this._initialized = true;\n }\n /**\n * Handle MathJax loading.\n */\n _onLoad() {\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [\n ['$', '$'],\n ['\\\\(', '\\\\)']\n ],\n displayMath: [\n ['$$', '$$'],\n ['\\\\[', '\\\\]']\n ],\n processEscapes: true,\n processEnvironments: true\n },\n // Center justify equations in code and markdown cells. Elsewhere\n // we use CSS to left justify single line equations in code cells.\n displayAlign: 'center',\n CommonHTML: {\n linebreaks: { automatic: true }\n },\n 'HTML-CSS': {\n availableFonts: [],\n imageFont: null,\n preferredFont: null,\n webFont: 'STIX-Web',\n styles: { '.MathJax_Display': { margin: 0 } },\n linebreaks: { automatic: true }\n },\n skipStartupTypeset: true,\n messageStyle: 'none'\n });\n MathJax.Hub.Register.StartupHook('End Config', () => {\n var _a, _b, _c, _d, _e, _f;\n // Disable `:hover span` styles which cause performance issues in Chromium browsers\n // c-f https://github.com/jupyterlab/jupyterlab/issues/9757\n // Note that we cannot overwrite them in config earlier due to how `CombineConfig`\n // is implemented in MathJax 2 (it does not allow removing styles, just expanding).\n (_c = (_b = (_a = MathJax.Hub) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.MathEvents) === null || _c === void 0 ? true : delete _c.styles['.MathJax_Hover_Arrow:hover span'];\n (_f = (_e = (_d = MathJax.Hub) === null || _d === void 0 ? void 0 : _d.config) === null || _e === void 0 ? void 0 : _e.MathMenu) === null || _f === void 0 ? true : delete _f.styles['.MathJax_MenuClose:hover span'];\n });\n MathJax.Hub.Configured();\n this._initPromise.resolve(void 0);\n }\n}\n//# sourceMappingURL=index.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\nimport { ServerConnection } from '@jupyterlab/services';\n/**\n * Any object is \"printable\" if it implements the `IPrintable` interface.\n *\n * To do this it, it must have a method called `Printing.symbol` which returns either a function\n * to print the object or null if it cannot be printed.\n *\n * One way of printing is to use the `printWidget` function, which creates a hidden iframe\n * and copies the DOM nodes from your widget to that iframe and printing just that iframe.\n *\n * Another way to print is to use the `printURL` function, which takes a URL and prints that page.\n */\nexport var Printing;\n(function (Printing) {\n /**\n * Symbol to use for a method that returns a function to print an object.\n */\n Printing.symbol = Symbol('printable');\n /**\n * Returns whether an object implements a print method.\n */\n function isPrintable(a) {\n if (typeof a !== 'object' || !a) {\n return false;\n }\n return Printing.symbol in a;\n }\n Printing.isPrintable = isPrintable;\n /**\n * Returns the print function for an object, or null if it does not provide a handler.\n */\n function getPrintFunction(val) {\n if (isPrintable(val)) {\n return val[Printing.symbol]();\n }\n return null;\n }\n Printing.getPrintFunction = getPrintFunction;\n /**\n * Prints a widget by copying it's DOM node\n * to a hidden iframe and printing that iframe.\n */\n function printWidget(widget) {\n return printContent(widget.node);\n }\n Printing.printWidget = printWidget;\n /**\n * Prints a URL by loading it into an iframe.\n *\n * @param url URL to load into an iframe.\n */\n async function printURL(url) {\n const settings = ServerConnection.makeSettings();\n const text = await (await ServerConnection.makeRequest(url, {}, settings)).text();\n return printContent(text);\n }\n Printing.printURL = printURL;\n /**\n * Prints a URL or an element in an iframe and then removes the iframe after printing.\n */\n async function printContent(textOrEl) {\n const isText = typeof textOrEl === 'string';\n const iframe = createIFrame();\n const parent = window.document.body;\n parent.appendChild(iframe);\n if (isText) {\n iframe.srcdoc = textOrEl;\n await resolveWhenLoaded(iframe);\n }\n else {\n iframe.src = 'about:blank';\n await resolveWhenLoaded(iframe);\n setIFrameNode(iframe, textOrEl);\n }\n const printed = resolveAfterEvent();\n launchPrint(iframe.contentWindow);\n // Once the print dialog has been dismissed, we regain event handling,\n // and it should be safe to discard the hidden iframe.\n await printed;\n parent.removeChild(iframe);\n }\n /**\n * Creates a new hidden iframe and appends it to the document\n *\n * Modified from\n * https://github.com/joseluisq/printd/blob/eb7948d602583c055ab6dee3ee294b6a421da4b6/src/index.ts#L24\n */\n function createIFrame() {\n const el = window.document.createElement('iframe');\n // We need both allow-modals and allow-same-origin to be able to\n // call print in the iframe.\n // We intentionally do not allow scripts:\n // https://github.com/jupyterlab/jupyterlab/pull/5850#pullrequestreview-230899790\n el.setAttribute('sandbox', 'allow-modals allow-same-origin');\n const css = 'visibility:hidden;width:0;height:0;position:absolute;z-index:-9999;bottom:0;';\n el.setAttribute('style', css);\n el.setAttribute('width', '0');\n el.setAttribute('height', '0');\n return el;\n }\n /**\n * Copies a node from the base document to the iframe.\n */\n function setIFrameNode(iframe, node) {\n iframe.contentDocument.body.appendChild(node.cloneNode(true));\n iframe.contentDocument.close();\n }\n /**\n * Promise that resolves when all resources are loaded in the window.\n */\n function resolveWhenLoaded(iframe) {\n return new Promise(resolve => {\n iframe.onload = () => resolve();\n });\n }\n /**\n * A promise that resolves after the next mousedown, mousemove, or\n * keydown event. We use this as a proxy for determining when the\n * main window has regained control after the print dialog is removed.\n *\n * We can't use the usual window.onafterprint handler because we\n * disallow Javascript execution in the print iframe.\n */\n function resolveAfterEvent() {\n return new Promise(resolve => {\n const onEvent = () => {\n document.removeEventListener('mousemove', onEvent, true);\n document.removeEventListener('mousedown', onEvent, true);\n document.removeEventListener('keydown', onEvent, true);\n resolve();\n };\n document.addEventListener('mousemove', onEvent, true);\n document.addEventListener('mousedown', onEvent, true);\n document.addEventListener('keydown', onEvent, true);\n });\n }\n /**\n * Prints a content window.\n */\n function launchPrint(contentWindow) {\n const result = contentWindow.document.execCommand('print', false);\n // execCommand won't work in firefox so we call the `print` method instead if it fails\n // https://github.com/joseluisq/printd/blob/eb7948d602583c055ab6dee3ee294b6a421da4b6/src/index.ts#L148\n if (!result) {\n contentWindow.print();\n }\n }\n})(Printing || (Printing = {}));\n//# sourceMappingURL=printing.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/**\n * @packageDocumentation\n * @module json-extension\n */\nimport { Printing } from '@jupyterlab/apputils';\nimport { nullTranslator } from '@jupyterlab/translation';\nimport { Widget } from '@lumino/widgets';\nimport * as React from 'react';\nimport { createRoot } from 'react-dom/client';\n/**\n * The CSS class to add to the JSON Widget.\n */\nconst CSS_CLASS = 'jp-RenderedJSON';\n/**\n * The MIME type for JSON.\n */\nexport const MIME_TYPE = 'application/json';\n// NOTE: not standardized yet\nexport const MIME_TYPES_JSONL = [\n 'text/jsonl',\n 'application/jsonl',\n 'application/json-lines'\n];\n/**\n * A renderer for JSON data.\n */\nexport class RenderedJSON extends Widget {\n /**\n * Create a new widget for rendering JSON.\n */\n constructor(options) {\n super();\n this._rootDOM = null;\n this.addClass(CSS_CLASS);\n this.addClass('CodeMirror');\n this._mimeType = options.mimeType;\n this.translator = options.translator || nullTranslator;\n }\n [Printing.symbol]() {\n return () => Printing.printWidget(this);\n }\n /**\n * Render JSON into this widget's node.\n */\n async renderModel(model) {\n const { Component } = await import('./component');\n let data;\n // handle if json-lines format\n if (MIME_TYPES_JSONL.indexOf(this._mimeType) >= 0) {\n // convert into proper json\n const lines = (model.data[this._mimeType] || '')\n .trim()\n .split(/\\n/);\n data = JSON.parse(`[${lines.join(',')}]`);\n }\n else {\n data = (model.data[this._mimeType] || {});\n }\n const metadata = (model.metadata[this._mimeType] || {});\n if (this._rootDOM === null) {\n this._rootDOM = createRoot(this.node);\n }\n return new Promise((resolve, reject) => {\n this._rootDOM.render(React.createElement(Component, { data: data, metadata: metadata, translator: this.translator, forwardedRef: () => resolve() }));\n });\n }\n /**\n * Called before the widget is detached from the DOM.\n */\n onBeforeDetach(msg) {\n // Unmount the component so it can tear down.\n if (this._rootDOM) {\n this._rootDOM.unmount();\n this._rootDOM = null;\n }\n }\n}\n/**\n * A mime renderer factory for JSON data.\n */\nexport const rendererFactory = {\n safe: true,\n mimeTypes: [MIME_TYPE, ...MIME_TYPES_JSONL],\n createRenderer: options => new RenderedJSON(options)\n};\nconst extensions = [\n {\n id: '@jupyterlab/json-extension:factory',\n description: 'Adds renderer for JSON content.',\n rendererFactory,\n rank: 0,\n dataType: 'json',\n documentWidgetFactoryOptions: {\n name: 'JSON',\n // TODO: how to translate label of the factory?\n primaryFileType: 'json',\n fileTypes: ['json', 'notebook', 'geojson'],\n defaultFor: ['json']\n }\n },\n {\n id: '@jupyterlab/json-lines-extension:factory',\n description: 'Adds renderer for JSONLines content.',\n rendererFactory,\n rank: 0,\n dataType: 'string',\n documentWidgetFactoryOptions: {\n name: 'JSONLines',\n primaryFileType: 'jsonl',\n fileTypes: ['jsonl', 'ndjson'],\n defaultFor: ['jsonl', 'ndjson']\n }\n }\n];\nexport default extensions;\n//# sourceMappingURL=index.js.map","import {\n makeBinderOptions,\n makeKernelOptions,\n makeSavedSessionOptions,\n makeServerSettings,\n} from './options';\nimport { ThebeEvents } from './events';\nimport type {\n BinderOptions,\n KernelOptions,\n CoreOptions,\n SavedSessionOptions,\n ServerSettings,\n MathjaxOptions,\n} from './types';\n\nexport class Config {\n private _options: Required<\n Omit\n >;\n private _binderOptions: Required;\n private _savedSessions: Required;\n private _kernelOptions: Required;\n private _serverSettings: Required> & { wsUrl?: string };\n private _events: ThebeEvents;\n\n constructor(opts: CoreOptions = {}, extraConfig?: { events?: ThebeEvents }) {\n this._events = extraConfig?.events ?? new ThebeEvents();\n\n this._options = {\n mathjaxUrl:\n opts.mathjaxUrl ?? 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js',\n mathjaxConfig: opts.mathjaxConfig ?? 'TeX-AMS_CHTML-full,Safe',\n };\n\n this._binderOptions = makeBinderOptions(opts.binderOptions ?? {});\n this._savedSessions = makeSavedSessionOptions(opts.savedSessionOptions ?? {});\n this._kernelOptions = makeKernelOptions(opts.kernelOptions ?? {});\n this._serverSettings = makeServerSettings(opts.serverSettings ?? {});\n\n console.debug('thebe:config:constructor', this);\n }\n\n get events() {\n return this._events;\n }\n\n get base() {\n return this._options;\n }\n\n get mathjax(): MathjaxOptions {\n return {\n mathjaxUrl: this._options.mathjaxUrl,\n mathjaxConfig: this._options.mathjaxConfig,\n };\n }\n\n get binder() {\n return this._binderOptions;\n }\n\n get savedSessions() {\n return this._savedSessions;\n }\n\n get kernels() {\n return this._kernelOptions;\n }\n\n get serverSettings() {\n return this._serverSettings;\n }\n\n set serverSettings(newSettings: Required> & { wsUrl?: string }) {\n this._serverSettings = newSettings;\n }\n}\n","import { Config } from './config';\nimport type { ThebeEvents } from './events';\nimport type {\n ServerSettings,\n BinderOptions,\n KernelOptions,\n CoreOptions,\n SavedSessionOptions,\n MathjaxOptions,\n} from './types';\nimport { shortId } from './utils';\n\nexport function makeBinderOptions(opts: BinderOptions) {\n return {\n repo: 'executablebooks/thebe-binder-base',\n ref: 'HEAD',\n binderUrl: 'https://mybinder.org',\n repoProvider: 'github',\n ...opts,\n };\n}\n\nexport function makeSavedSessionOptions(opts: SavedSessionOptions): Required {\n return {\n enabled: true,\n maxAge: 86400,\n storagePrefix: 'thebe-binder',\n ...opts,\n };\n}\n\nexport function makeKernelOptions(opts: KernelOptions): Required {\n return {\n path: opts.path ?? '/',\n kernelName: opts.kernelName ?? 'python',\n };\n}\n\nexport function makeServerSettings(settings: ServerSettings): Required {\n const baseUrl = settings.baseUrl ?? 'http://localhost:8888';\n const wsUrl = settings.wsUrl ?? baseUrl.replace(/^http/, 'ws');\n\n return {\n token: shortId(), // randomized default token to prevent accidental access to a local server\n appendToken: true,\n ...settings,\n wsUrl,\n baseUrl,\n };\n}\n\nexport function makeMathjaxOptions(opts?: MathjaxOptions) {\n return {\n mathjaxUrl: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js',\n mathjaxConfig: 'TeX-AMS_CHTML-full,Safe',\n ...opts,\n };\n}\n\nexport function makeConfiguration(\n options: CoreOptions & { [k: string]: any },\n events?: ThebeEvents,\n) {\n return new Config(options, { events });\n}\n\nexport function ensureCoreOptions(\n options: CoreOptions & { [k: string]: any },\n events?: ThebeEvents,\n): Required {\n const config = new Config(options, { events });\n\n return {\n ...config.base,\n binderOptions: config.binder,\n savedSessionOptions: config.savedSessions,\n kernelOptions: config.kernels,\n serverSettings: config.serverSettings,\n };\n}\n","import type { IRenderMime } from '@jupyterlab/rendermime';\nimport {\n RenderMimeRegistry,\n htmlRendererFactory,\n markdownRendererFactory,\n latexRendererFactory,\n svgRendererFactory,\n imageRendererFactory,\n textRendererFactory,\n errorRendererFactory,\n} from '@jupyterlab/rendermime';\nimport type { MathjaxOptions } from './types';\nimport { MathJaxTypesetter } from '@jupyterlab/mathjax2';\nimport { rendererFactory as javascriptRendererFactory } from '@jupyterlab/javascript-extension';\nimport { rendererFactory as jsonRendererFactory } from '@jupyterlab/json-extension';\nimport { makeMathjaxOptions } from './options';\n\nconst EXTENDED_FACTORIES = [\n htmlRendererFactory,\n markdownRendererFactory,\n latexRendererFactory,\n svgRendererFactory,\n imageRendererFactory,\n javascriptRendererFactory,\n textRendererFactory,\n errorRendererFactory,\n];\n\nlet RENDERERS: IRenderMime.IRendererFactory[] | null = null;\n\nexport function getRenderers(mathjax: MathjaxOptions) {\n if (RENDERERS == null) {\n RENDERERS = EXTENDED_FACTORIES.filter((f) => {\n // filter out latex renderer if mathjax is unavailable\n if (f.mimeTypes.indexOf('text/latex') >= 0) {\n if (mathjax.mathjaxUrl) {\n return true;\n } else {\n console.debug('thebe:getRenderers MathJax unavailable');\n return false;\n }\n } else {\n return true;\n }\n });\n }\n let latexTypesetter;\n if (mathjax.mathjaxUrl && mathjax.mathjaxConfig) {\n latexTypesetter = new MathJaxTypesetter({\n url: mathjax.mathjaxUrl,\n config: mathjax.mathjaxConfig,\n });\n }\n return {\n initialFactories: [...RENDERERS],\n latexTypesetter,\n };\n}\n\nexport function makeRenderMimeRegistry(mathjax?: MathjaxOptions) {\n const rendermime = new RenderMimeRegistry(getRenderers(mathjax ?? makeMathjaxOptions()));\n rendermime.addFactory(jsonRendererFactory, 10);\n return rendermime;\n}\n","import type * as nbformat from '@jupyterlab/nbformat';\nimport { makeRenderMimeRegistry } from './rendermime';\nimport { OutputArea, OutputAreaModel } from '@jupyterlab/outputarea';\nimport type { IRenderMimeRegistry } from '@jupyterlab/rendermime';\nimport type { IPassiveCell, MathjaxOptions } from './types';\nimport { makeMathjaxOptions } from './options';\nimport { Widget } from '@lumino/widgets';\nimport { MessageLoop } from '@lumino/messaging';\n\nclass PassiveCellRenderer implements IPassiveCell {\n readonly id: string;\n readonly rendermime: IRenderMimeRegistry;\n protected model: OutputAreaModel;\n protected area: OutputArea;\n\n constructor(id: string, rendermime?: IRenderMimeRegistry, mathjax?: MathjaxOptions) {\n this.id = id;\n this.rendermime = rendermime ?? makeRenderMimeRegistry(mathjax ?? makeMathjaxOptions());\n this.model = new OutputAreaModel({ trusted: true });\n this.area = new OutputArea({\n model: this.model,\n rendermime: this.rendermime,\n });\n }\n\n /**\n * Serialize the model state to JSON\n */\n get outputs(): nbformat.IOutput[] {\n return this.model.toJSON();\n }\n\n get isAttachedToDOM() {\n return this.area.isAttached;\n }\n\n attachToDOM(el?: HTMLElement, strict = false) {\n if (!this.area || !el) {\n console.error(\n `thebe:renderer:attachToDOM - could not attach to DOM - area: ${this.area}, el: ${el}`,\n );\n return;\n }\n if (this.area.isAttached) {\n // TODO should we detach and reattach?\n console.debug(`thebe:renderer:attachToDOM - already attached`);\n if (strict) return;\n } else {\n // if the target element has contents, preserve it but wrap it in our output area\n console.debug(`thebe:renderer:attachToDOM ${this.id} - appending existing contents`);\n if (el.innerHTML) {\n this.area.model.add({\n output_type: 'display_data',\n data: {\n 'text/html': el.innerHTML,\n },\n });\n }\n }\n\n el.textContent = '';\n\n const div = document.createElement('div');\n div.style.position = 'relative';\n div.className = 'thebe-output';\n el.append(div);\n\n MessageLoop.sendMessage(this.area, Widget.Msg.BeforeAttach);\n div.appendChild(this.area.node);\n MessageLoop.sendMessage(this.area, Widget.Msg.AfterAttach);\n }\n\n setOutputText(text: string) {\n if (!this.area) return;\n this.area.model.clear(true);\n this.area.model.add({\n output_type: 'stream',\n name: 'stdout',\n text,\n });\n }\n\n /**\n * Clears the output area model\n *\n * @returns\n */\n clear() {\n if (!this.area) return;\n this.area.model.clear();\n }\n\n /**\n * Will trigger the output to render an error with text taken from the optional argument\n *\n * @param error\n * @returns\n */\n clearOnError(error?: any) {\n if (!this.area) return;\n this.area.model.clear();\n this.area.model.add({\n output_type: 'stream',\n name: 'stderr',\n text: `Failed to execute. ${error ?? ''} Please refresh the page.`,\n });\n }\n\n /**\n * Render output data directly from json\n *\n * @param outputs - serialised jupyter outputs\n * @returns\n */\n render(outputs: nbformat.IOutput[]) {\n this.model.fromJSON(outputs);\n }\n}\n\nexport default PassiveCellRenderer;\n","import type { CellKind, IThebeCell, IThebeCellExecuteReturn, JsonObject } from './types';\nimport type ThebeSession from './session';\nimport PassiveCellRenderer from './passive';\nimport type { IRenderMimeRegistry } from '@jupyterlab/rendermime';\nimport type { Config } from './config';\nimport { CellStatusEvent, ErrorStatusEvent, errorToMessage, EventSubject } from './events';\nimport { EventEmitter } from './emitter';\nimport type { ICodeCell, IError, IOutput } from '@jupyterlab/nbformat';\nimport { ensureString, shortId } from './utils';\n\nclass ThebeCodeCell extends PassiveCellRenderer implements IThebeCell {\n kind: CellKind;\n source: string;\n metadata: JsonObject;\n session?: ThebeSession;\n executionCount: number | null;\n protected initialOutputs: IOutput[];\n readonly notebookId: string;\n protected busy: boolean;\n protected events: EventEmitter;\n\n constructor(\n id: string,\n notebookId: string,\n source: string,\n config: Config,\n metadata: JsonObject,\n rendermime: IRenderMimeRegistry,\n ) {\n super(id, rendermime);\n this.kind = 'code';\n this.events = new EventEmitter(id, config, EventSubject.cell, this);\n this.notebookId = notebookId;\n this.source = source;\n this.metadata = metadata;\n this.busy = false;\n this.executionCount = null;\n this.initialOutputs = [];\n console.debug('thebe:cell constructor', this);\n }\n\n static fromICodeCell(\n icc: ICodeCell,\n notebookId: string,\n config: Config,\n rendermime: IRenderMimeRegistry,\n ) {\n const cell = new ThebeCodeCell(\n icc.id ?? shortId(),\n notebookId,\n ensureString(icc.source),\n config,\n icc.metadata,\n rendermime,\n );\n Object.assign(cell.metadata, icc.metadata);\n\n return cell;\n }\n\n get isBusy() {\n return this.busy;\n }\n\n get isAttached() {\n return this.session !== undefined;\n }\n\n get tags(): string[] {\n return this.metadata.tags ?? [];\n }\n\n /**\n * Attaches to the session and adds the widgets factory to the rendermine registry\n * call this version if using ThebeCell in isolation, otherwise call ThebeNotebook::attachSession\n *\n * @param session\n */\n attachSession(session: ThebeSession) {\n this.session = session;\n this.events.triggerStatus({\n status: CellStatusEvent.attached,\n message: 'Attached to session',\n });\n }\n\n /**\n * Detaches from the session and removes the widgets factory from the rendermine registry\n * call this version if using ThebeCell in isolation, otherwise call ThebeNotebook::detachSession\n *\n */\n detachSession() {\n this.session = undefined;\n this.events.triggerStatus({\n status: CellStatusEvent.detached,\n message: 'Detached from session',\n });\n }\n\n setAsBusy() {\n console.debug(`thebe:renderer:message:busy ${this.id}`);\n this.busy = true;\n this.events.triggerStatus({\n status: CellStatusEvent.executing,\n message: 'Executing...',\n });\n }\n\n setAsIdle() {\n console.debug(`thebe:renderer:message:completed ${this.id}`);\n this.busy = false;\n this.events.triggerStatus({\n status: CellStatusEvent.idle,\n message: 'Completed',\n });\n }\n\n /**\n * reset the DOM representation of the cell to the initial state\n * along with the execution count\n *\n * @param hideWidgets boolean - if true, hide widgets\n */\n initOutputs(initialOutputs: IOutput[]) {\n this.initialOutputs = initialOutputs;\n this.render(initialOutputs);\n this.executionCount = null;\n }\n\n /**\n * reset the DOM representation of the cell to the initial state\n * along with the execution count\n *\n * @param hideWidgets boolean - if true, hide widgets\n */\n reset() {\n this.render(this.initialOutputs);\n this.executionCount = null;\n }\n\n /**\n * TODO\n * - pass execute_count or timestamp or something back to redux on success/failure?\n *\n * @param source?\n * @returns\n */\n async execute(source?: string): Promise {\n if (!this.session || !this.session.kernel) {\n console.warn('Attempting to execute on a cell without an attached kernel');\n return null;\n }\n\n const code = source ?? this.source;\n\n try {\n console.debug(`thebe:renderer:execute ${this.id}`);\n if (!this.isBusy) this.setAsBusy();\n\n this.area.future = this.session.kernel.requestExecute({ code });\n\n // TODO consider how to enable execution without the await here\n const reply = await this.area.future.done;\n this.executionCount = reply.content.execution_count;\n\n let executeErrors: IError[] | undefined;\n for (let i = 0; i < this.model.length; i++) {\n const out = this.model.get(i);\n console.debug('thebecell:execute:output', { out: out.toJSON() });\n if (out.type === 'error') {\n const json = out.toJSON() as IError;\n if (json.ename === 'stderr') {\n this.events.triggerError({\n status: ErrorStatusEvent.warning,\n message: errorToMessage(json),\n });\n } else {\n if (!executeErrors) executeErrors = [json];\n else executeErrors?.push(json);\n this.events.triggerError({\n status: ErrorStatusEvent.executeError,\n message: errorToMessage(json),\n });\n }\n }\n }\n\n this.setAsIdle();\n return {\n id: this.id,\n height: this.area.node.offsetHeight,\n width: this.area.node.offsetWidth,\n error: executeErrors,\n };\n } catch (err: any) {\n console.error('thebe:renderer:execute Error:', err);\n this.clearOnError(err);\n this.events.triggerError(err.message);\n return null;\n }\n }\n}\n\nexport default ThebeCodeCell;\n","/* eslint-disable @typescript-eslint/no-unused-vars */\nimport type { ICell, IOutput } from '@jupyterlab/nbformat';\nimport type { IRenderMimeRegistry } from '@jupyterlab/rendermime';\nimport PassiveCellRenderer from './passive';\nimport type ThebeSession from './session';\nimport type { CellKind, IThebeCell, IThebeCellExecuteReturn, JsonObject } from './types';\nimport { ensureString, shortId } from './utils';\n\n/**\n * A Thebe cell that is exepected to contain markdown (or raw) source.\n *\n * Currently this just separates content cells from code cells and thebe provides no\n * special handling for markdown cells.\n *\n */\nexport default class ThebeMarkdownCell extends PassiveCellRenderer implements IThebeCell {\n id: string;\n notebookId: string;\n kind: CellKind;\n source: string;\n busy: boolean;\n metadata: JsonObject;\n\n constructor(\n id: string,\n notebookId: string,\n source: string,\n metadata: JsonObject,\n rendermime: IRenderMimeRegistry,\n ) {\n super(id, rendermime);\n this.kind = 'markdown';\n this.id = id;\n this.notebookId = notebookId;\n this.source = source;\n this.busy = false;\n this.metadata = metadata;\n }\n\n static fromICell(ic: ICell, notebookId: string, rendermime: IRenderMimeRegistry) {\n const cell = new ThebeMarkdownCell(\n typeof ic.id === 'string' ? ic.id : shortId(),\n notebookId,\n ensureString(ic.source),\n ic.metadata,\n rendermime,\n );\n return cell;\n }\n\n get isAttachedToDOM() {\n return false;\n }\n\n get isBusy() {\n return false;\n }\n\n get isAttached() {\n return false;\n }\n\n get executionCount(): number | null {\n return null;\n }\n\n setAsBusy(): void {\n // no-op\n }\n\n setAsIdle(): void {\n // no-op\n }\n\n initOutputs(initialOutputs: IOutput[]) {\n // no-op\n }\n\n reset() {\n // no-op\n }\n\n attachToDOM(el?: HTMLElement) {\n // could potentially allow for markdown rendering here\n }\n\n attachSession(session: ThebeSession) {\n // no-op\n }\n\n detachSession(): void {\n // no-op\n }\n\n setOutputText(text: string) {\n // no-op\n }\n\n clear() {\n // no-op\n }\n\n clearOnError(error?: any) {\n // no-op\n }\n\n messageBusy(): void {\n // no-op\n }\n\n messageCompleted(): void {\n // no-op\n }\n\n messageError(message: string): void {\n // no-op\n }\n\n render(outputs: IOutput[]): void {\n // no-op\n }\n\n get tags(): string[] {\n return [];\n }\n\n get outputs() {\n return [] as IOutput[];\n }\n\n async execute(source?: string): Promise {\n // could potentially allow for markdown rendering here\n return { id: this.id, height: 0, width: 0 };\n }\n}\n","import ThebeCodeCell from './cell';\nimport type ThebeSession from './session';\nimport type { IThebeCell, IThebeCellExecuteReturn } from './types';\nimport { shortId } from './utils';\nimport type { IRenderMimeRegistry } from '@jupyterlab/rendermime';\nimport type { Config } from './config';\nimport { EventSubject, NotebookStatusEvent } from './events';\nimport { EventEmitter } from './emitter';\nimport type { ICodeCell, INotebookContent, INotebookMetadata } from '@jupyterlab/nbformat';\nimport ThebeMarkdownCell from './markdown';\n\nexport interface CodeBlock {\n id: string;\n source: string;\n [x: string]: any;\n}\n\nclass ThebeNotebook {\n readonly id: string;\n readonly rendermime: IRenderMimeRegistry;\n cells: IThebeCell[];\n metadata: INotebookMetadata;\n session?: ThebeSession;\n protected events: EventEmitter;\n\n constructor(id: string, config: Config, rendermime: IRenderMimeRegistry) {\n this.id = id;\n this.events = new EventEmitter(id, config, EventSubject.notebook, this);\n this.cells = [];\n this.metadata = {};\n this.rendermime = rendermime;\n console.debug('thebe:notebook constructor', this);\n }\n\n static fromCodeBlocks(blocks: CodeBlock[], config: Config, rendermime: IRenderMimeRegistry) {\n const id = shortId();\n const notebook = new ThebeNotebook(id, config, rendermime);\n notebook.cells = blocks.map((c) => {\n const metadata = {};\n const cell = new ThebeCodeCell(c.id, id, c.source, config, metadata, notebook.rendermime);\n console.debug(`thebe:notebook:fromCodeBlocks Initializing cell ${c.id}`);\n return cell;\n });\n\n return notebook;\n }\n\n static fromIpynb(ipynb: INotebookContent, config: Config, rendermime: IRenderMimeRegistry) {\n const notebook = new ThebeNotebook(shortId(), config, rendermime);\n\n Object.assign(notebook.metadata, ipynb.metadata);\n\n notebook.cells = ipynb.cells.map((c) => {\n if ((c as ICodeCell).cell_type === 'code')\n return ThebeCodeCell.fromICodeCell(\n c as ICodeCell,\n notebook.id,\n config,\n notebook.rendermime,\n );\n return ThebeMarkdownCell.fromICell(c, notebook.id, notebook.rendermime);\n });\n\n return notebook;\n }\n\n get parameters() {\n const p = this.findCells('parameters');\n if (!p || p?.length === 0) return undefined;\n if (p.length > 1) console.warn(`Mulitple parameter cells found in notebook ${this.id}`);\n return p;\n }\n\n get widgets() {\n return this.findCells('widget') ?? [];\n }\n\n get last() {\n if (this.cells.length === 0) throw new Error('empty notebook');\n return this.cells[this.cells.length - 1];\n }\n\n get markdown() {\n return this.cells.filter((c) => c.kind === 'markdown');\n }\n\n get code() {\n return this.cells.filter((c) => c.kind === 'code');\n }\n\n /**\n * reset the notebook to its initial state by resetting each cell\n *\n * @param hideWidgets boolean\n */\n reset() {\n this.cells.forEach((cell) => cell.reset());\n }\n\n numCells() {\n return this.cells?.length ?? 0;\n }\n\n findCells(tag: string) {\n const found = this.cells.filter((c) => c.tags.includes(tag));\n return found.length > 0 ? found : undefined;\n }\n\n getCell(idx: number) {\n if (!this.cells) throw Error('Dag not initialized');\n if (idx >= this.cells.length)\n throw Error(`Notebook.cells index out of range: ${idx}:${this.cells.length}`);\n return this.cells[idx];\n }\n\n getCellById(id: string) {\n const cell = this.cells?.find((c) => c.id === id);\n return cell;\n }\n\n lastCell() {\n if (!this.cells) throw Error('Notebook not initialized');\n return this.cells[this.cells.length - 1];\n }\n\n updateParameters(newSource: string, interpolate = false) {\n if (interpolate) throw new Error('Not implemented yet');\n if (this.parameters) this.parameters[0].source = newSource;\n }\n\n async waitForKernel(kernel: Promise) {\n return kernel.then((k) => {\n this.attachSession(k);\n return k;\n });\n }\n\n attachSession(session: ThebeSession) {\n if (!session.kernel) throw Error('ThebeNotebook - cannot connect to session, no kernel');\n // note all cells in a notebook share the rendermime registry\n // we only need to add the widgets factory once\n this.session = session;\n this.cells?.forEach((cell) => (cell.session = session));\n this.events.triggerStatus({\n status: NotebookStatusEvent.attached,\n message: 'Attached to session',\n });\n }\n\n detachSession() {\n this.cells?.map((cell) => (cell.session = undefined));\n this.session = undefined;\n this.events.triggerStatus({\n status: NotebookStatusEvent.detached,\n message: 'Detached from session',\n });\n }\n\n clear() {\n this.cells.forEach((cell) => cell.clear());\n }\n\n async executeUpTo(\n cellId: string,\n stopOnError = false,\n preprocessor?: (s: string) => string,\n ): Promise<(IThebeCellExecuteReturn | null)[]> {\n if (!this.cells) return [];\n this.events.triggerStatus({\n status: NotebookStatusEvent.executing,\n message: `executeUpTo ${cellId}`,\n });\n const idx = this.cells.findIndex((c) => c.id === cellId);\n if (idx === -1) return [];\n const cellsToExecute = this.cells.slice(0, idx + 1);\n cellsToExecute.map((cell) => cell.setAsBusy());\n const result = await this.executeCells(\n cellsToExecute.map((c) => c.id),\n stopOnError,\n preprocessor,\n );\n // TODO intercept errors here\n this.events.triggerStatus({\n status: NotebookStatusEvent.idle,\n message: `executeUpTo ${cellId}`,\n });\n\n return result;\n }\n\n async executeOnly(\n cellId: string,\n preprocessor?: (s: string) => string,\n ): Promise {\n if (!this.cells) return null;\n this.events.triggerStatus({\n status: NotebookStatusEvent.executing,\n message: `executeOnly ${cellId}`,\n });\n const result = await this.executeCells([cellId], false, preprocessor);\n this.events.triggerStatus({\n status: NotebookStatusEvent.idle,\n message: `executeUpTo ${cellId}`,\n });\n\n return result[0];\n }\n\n async executeCells(\n cellIds: string[],\n stopOnError = false,\n preprocessor?: (s: string) => string,\n ): Promise<(IThebeCellExecuteReturn | null)[]> {\n if (!this.cells) return [];\n this.events.triggerStatus({\n status: NotebookStatusEvent.executing,\n message: `executeCells ${cellIds.length} cells`,\n });\n const cells = this.cells.filter((c) => {\n const found = cellIds.find((id) => id === c.id);\n if (!found) {\n console.warn(`Cell ${c.id} not found in notebook`);\n }\n return Boolean(found);\n });\n\n let result: (IThebeCellExecuteReturn | null)[] = [];\n\n if (stopOnError) {\n let skipRemaining = false;\n for (const cell of cells) {\n if (skipRemaining) continue;\n const cellReturn = await cell.execute(\n preprocessor ? preprocessor(cell.source) : cell.source,\n );\n if (cellReturn == null || cellReturn.error) skipRemaining = true;\n result.push(cellReturn);\n }\n } else {\n result = await Promise.all(\n cells.map((cell) => cell.execute(preprocessor ? preprocessor(cell.source) : cell.source)),\n );\n }\n\n this.events.triggerStatus({\n status: NotebookStatusEvent.idle,\n message: `executeCells executed ${cellIds.length} cells`,\n });\n return result;\n }\n\n async executeAll(\n stopOnError = false,\n preprocessor?: (s: string) => string,\n ): Promise<(IThebeCellExecuteReturn | null)[]> {\n if (!this.cells) return [];\n\n this.events.triggerStatus({\n status: NotebookStatusEvent.executing,\n message: `executeAll`,\n });\n\n this.cells.map((cell) => cell.setAsBusy());\n\n const result = await this.executeCells(\n this.cells.map((c) => c.id),\n stopOnError,\n preprocessor,\n );\n\n this.events.triggerStatus({\n status: NotebookStatusEvent.idle,\n message: `executeAll`,\n });\n\n return result;\n }\n}\n\nexport default ThebeNotebook;\n","import ThebeServer from '../server';\nimport type { CodeBlock } from '../notebook';\nimport ThebeNotebook from '../notebook';\nimport type { INotebookContent } from '@jupyterlab/nbformat';\nimport type { Config } from '..';\nimport { ThebeEvents } from '../events';\nimport { makeConfiguration } from '../options';\nimport { makeRenderMimeRegistry } from '../rendermime';\nimport * as coreModule from '../index';\nimport type { IRenderMimeRegistry } from '@jupyterlab/rendermime';\n\nexport function connectToBinder(config: Config): ThebeServer {\n const server: ThebeServer = new ThebeServer(config);\n console.debug(`thebe:api:connect binder 📡`, config.binder);\n server.connectToServerViaBinder();\n return server;\n}\n\nexport function connectToJupyter(config: Config): ThebeServer {\n const server: ThebeServer = new ThebeServer(config);\n console.debug(`thebe:api:connect direct 🔌`, config.serverSettings);\n server.connectToJupyterServer();\n return server;\n}\n\nexport function connectToJupyterLite(config: Config): ThebeServer {\n const server: ThebeServer = new ThebeServer(config);\n console.debug(`thebe:api:connect JupyterLite 🤘`);\n server.connectToJupyterLiteServer();\n return server;\n}\n\nexport function makeEvents() {\n return new ThebeEvents();\n}\n\nexport function makeServer(config: Config) {\n return new ThebeServer(config);\n}\n\nexport function setupNotebookFromBlocks(\n blocks: CodeBlock[],\n config: Config,\n rendermime: IRenderMimeRegistry,\n) {\n return ThebeNotebook.fromCodeBlocks(blocks, config, rendermime);\n}\n\nexport function setupNotebookFromIpynb(\n ipynb: INotebookContent,\n config: Config,\n rendermime: IRenderMimeRegistry,\n) {\n return ThebeNotebook.fromIpynb(ipynb, config, rendermime);\n}\n\nexport function setupThebeCore() {\n console.debug(`thebe:api:setupThebeCore`, { coreModule });\n window.thebeCore = Object.assign(window.thebeCore ?? {}, {\n module: coreModule,\n api: {\n makeConfiguration,\n makeEvents,\n makeServer,\n makeRenderMimeRegistry,\n connectToBinder,\n connectToJupyter,\n connectToJupyterLite,\n setupNotebookFromBlocks,\n setupNotebookFromIpynb,\n },\n });\n}\n","/* eslint-disable import/no-duplicates */\n/**\n * thebe/index.js is the entrypoint for the webpack build and will\n * be invoked on module load, seting up context with an independent store\n * and adding to the window object.\n */\nimport type ThebeServer from '../server';\nimport type { CodeBlock } from '../notebook';\nimport type ThebeNotebook from '../notebook';\nimport type { CoreOptions } from '../types';\nimport type { Config } from '../config';\nimport type { ThebeEvents } from '../events';\nimport type { ThebeLiteGlobal } from 'thebe-lite';\nimport type * as coreModule from '../index';\nimport type { INotebookContent } from '@jupyterlab/nbformat';\nimport type { IRenderMimeRegistry } from '@jupyterlab/rendermime';\nimport { setupThebeCore } from './api';\n\n/**\n * This file is the main entrypoint for the cjs bundle\n * For the TS module, use setupThebeCore()\n */\n\nexport interface JsApi {\n makeEvents: () => ThebeEvents;\n makeConfiguration: (options: Partial, events?: ThebeEvents) => Config;\n makeServer: (config: Config) => ThebeServer;\n makeRenderMimeRegistry: (mathjax?: coreModule.MathjaxOptions | undefined) => IRenderMimeRegistry;\n connectToBinder: (config: Config) => ThebeServer;\n connectToJupyter: (config: Config) => ThebeServer;\n connectToJupyterLite: (config: Config) => ThebeServer;\n setupNotebookFromBlocks: (\n blocks: CodeBlock[],\n config: Config,\n rendermime: IRenderMimeRegistry,\n ) => ThebeNotebook;\n setupNotebookFromIpynb: (\n ipynb: INotebookContent,\n config: Config,\n rendermime: IRenderMimeRegistry,\n ) => ThebeNotebook;\n}\n\nexport type ThebeCore = typeof coreModule;\n\nexport interface ThebeCoreGlobal {\n module: ThebeCore;\n api: JsApi;\n}\n\ndeclare global {\n interface Window {\n define: any;\n requirejs: any;\n thebeLite?: ThebeLiteGlobal;\n thebeCore?: ThebeCoreGlobal;\n }\n}\n\nif (typeof window !== 'undefined') setupThebeCore();\n","import type { Options } from './options';\n\nexport class ActivateWidget {\n options: Partial;\n\n constructor(options?: Options) {\n this.options = options ?? {};\n }\n\n mount() {\n const el = document.querySelector('.thebe-activate');\n\n const box = document.createElement('div');\n box.classList.add('thebe-activate');\n\n const btn = document.createElement('button');\n btn.textContent = 'Activate';\n btn.classList.add('thebe-activate-button');\n btn.onclick = () => window.thebe.bootstrap(this.options);\n\n box.appendChild(btn);\n\n el?.replaceWith(box);\n }\n}\n","import CodeMirror from 'codemirror/lib/codemirror';\nimport 'codemirror/lib/codemirror.css';\nimport 'codemirror/mode/python/python.js';\nimport 'codemirror/addon/hint/show-hint';\nimport 'codemirror/addon/display/autorefresh';\nimport 'codemirror/theme/abcdef.css';\nimport 'codemirror/theme/darcula.css';\nimport 'codemirror/theme/idea.css';\n\nimport type { Options } from './options';\nimport type { IThebeCell } from 'thebe-core';\nimport type { ICompleteReplyMsg } from '@jupyterlab/services/lib/kernel/messages';\nimport type { CellDOMPlaceholder } from './types';\n\ninterface DefaultCodeMirrorConfig {\n theme: 'default';\n mode: 'python';\n readOnly: false;\n autoRefresh: true;\n lineNumbers: true;\n styleActiveLine: true;\n matchBrackets: true;\n}\n\ninterface PageCodeMirrorConfig {\n mode?: string;\n readOnly?: boolean;\n}\n\ninterface RequiredCodeMirrorConfig {\n value: string;\n extraKeys: {\n 'Shift-Enter': () => void;\n 'Ctrl-Space': () => void;\n Esc: () => void;\n };\n}\n\nexport function setupCodemirror(\n options: Options,\n item: CellDOMPlaceholder,\n cell: IThebeCell,\n cellEl: HTMLElement,\n editorEl: HTMLElement,\n setBusy: (id: string) => void,\n clearBusy: (id: string) => void,\n) {\n const { source: sourceEl } = item.placeholders;\n const modeFromPage = sourceEl.getAttribute('data-language') || 'python';\n const isReadOnlyFromPage = sourceEl.getAttribute('data-readonly');\n console.debug(`thebe:setupCodemirror isReadOnly: ${isReadOnlyFromPage}`);\n\n async function execute() {\n console.debug(`thebe:codemirror:shift-enter execute`);\n try {\n setBusy(cell.id);\n await cell.execute(cell.source);\n clearBusy(cell.id);\n } catch (error) {\n cell.clearOnError(error);\n }\n }\n\n const ref: { cm?: any } = { cm: undefined };\n\n function unFocus() {\n ref.cm?.display.input.blur();\n }\n\n function codeCompletion() {\n console.debug(`thebe:codemirror:codeCompletion`);\n const code = ref.cm?.getValue();\n const cursor = ref.cm?.getDoc().getCursor();\n if (cell.session?.kernel) {\n cell.session?.kernel\n .requestComplete({\n code,\n cursor_pos: ref.cm?.getDoc().indexFromPos(cursor),\n })\n .then((value: ICompleteReplyMsg) => {\n if (value.content.status === 'ok') {\n const from = ref.cm?.getDoc().posFromIndex(value.content.cursor_start);\n const to = ref.cm?.getDoc().posFromIndex(value.content.cursor_end);\n ref.cm?.showHint({\n container: editorEl,\n hint: () => {\n return {\n from: from,\n to: to,\n list: (value.content as { matches: string[] }).matches,\n };\n },\n });\n }\n });\n }\n }\n\n const defaultSettings: DefaultCodeMirrorConfig = {\n theme: 'default',\n mode: 'python',\n readOnly: false,\n autoRefresh: true,\n lineNumbers: true,\n styleActiveLine: true,\n matchBrackets: true,\n };\n\n const configFromPage: PageCodeMirrorConfig = {\n mode: modeFromPage,\n readOnly: undefined,\n };\n\n if (isReadOnlyFromPage != null) {\n // override settings using the cell attribute\n configFromPage.readOnly = isReadOnlyFromPage == 'false' ? false : true;\n }\n\n const requiredSettings: RequiredCodeMirrorConfig = {\n value: cell.source,\n extraKeys: {\n 'Shift-Enter': execute,\n 'Ctrl-Space': codeCompletion,\n Esc: unFocus,\n },\n };\n\n const codeMirrorConfig = Object.assign(\n {},\n defaultSettings,\n options.codeMirrorConfig ?? {},\n configFromPage,\n requiredSettings,\n );\n console.debug('thebe:setupCodemirror:codeMirrorConfig', codeMirrorConfig);\n\n ref.cm = new CodeMirror(editorEl as HTMLElement, codeMirrorConfig);\n // TODO enable loading of mode js files via configuration\n // see https://github.com/jupyterlab/jupyterlab/blob/3.6.x/packages/codemirror/src/mode.ts for\n // an example of how to do this\n ref.cm.setOption('mode', codeMirrorConfig.mode);\n\n // All cells in the notebook automatically update their sources on change\n ref.cm.on('change', () => {\n const code = ref.cm.getValue();\n cell.source = code;\n ref.cm.refresh();\n });\n\n if (codeMirrorConfig.readOnly) {\n ref.cm.display.lineDiv.setAttribute('data-readonly', 'true');\n editorEl.setAttribute('data-readonly', 'true');\n cellEl.setAttribute('data-readonly', 'true');\n }\n\n ref.cm.refresh();\n\n return ref.cm;\n}\n","import { ThebeEvents, setupThebeCore } from 'thebe-core';\nimport * as thebe from './thebe';\n\nexport * from './types';\nexport * from './thebe';\n\nexport function setupGlobals() {\n const events = new ThebeEvents();\n\n window.thebe = Object.assign(window.thebe ?? {}, {\n ...thebe,\n events,\n trigger: events.trigger.bind(events),\n on: events.on.bind(events),\n one: events.one.bind(events),\n off: events.off.bind(events),\n });\n\n window.thebelab = window.thebe;\n}\n\nif ((window as any) !== undefined) {\n setupThebeCore();\n setupGlobals();\n\n document.addEventListener('DOMContentLoaded', () => {\n const options = thebe.getPageConfig();\n if (options.mountStatusWidget) {\n thebe.mountStatusWidget();\n }\n if (options.mountActivateWidget) {\n thebe.mountActivateWidget(options);\n }\n if (options['bootstrap']) {\n thebe.bootstrap(options);\n }\n });\n}\n","import type { CoreOptions } from 'thebe-core';\nimport { ensureCoreOptions } from 'thebe-core';\nimport merge from 'lodash.merge';\nimport JSON5 from 'json5';\n\n// Exposing @jupyter-widgets/base and @jupyter-widgets/controls as amd\n// modules for custom widget bundles that depend on it.\n\nexport interface ThebeOptions {\n bootstrap?: boolean;\n useBinder?: boolean;\n useJupyterLite?: boolean;\n requestKernel?: boolean;\n // UI related options\n selector?: string;\n outputSelector?: string;\n predefinedOutput?: boolean;\n mountStatusWidget?: boolean;\n mountActivateWidget?: boolean;\n mountRunButton?: boolean;\n mountRunAllButton?: boolean;\n mountRestartButton?: boolean;\n mountRestartAllButton?: boolean;\n preRenderHook?: (() => void) | null;\n // thebe specific options\n stripPrompts?: {\n inPrompt?: string;\n continuationPrompt?: string;\n };\n stripOutputPrompts?: { outPrompt?: string };\n codeMirrorConfig?: {\n theme?: string;\n readOnly?: boolean;\n mode?: string;\n autoRefresh?: boolean;\n lineNumbers?: boolean;\n styleActiveLine?: boolean;\n matchBrackets?: boolean;\n };\n}\n\nexport type Options = ThebeOptions & CoreOptions;\n\nexport const defaultSelector = '[data-executable]';\nexport const defaultOutputSelector = '[data-output]';\n\n// options\nexport const defaultOptions: ThebeOptions = {\n bootstrap: false,\n useBinder: true,\n useJupyterLite: false,\n requestKernel: true,\n preRenderHook: null,\n predefinedOutput: true,\n mountStatusWidget: true,\n mountActivateWidget: true,\n selector: defaultSelector,\n outputSelector: defaultOutputSelector,\n mountRunButton: true,\n mountRunAllButton: true,\n mountRestartButton: true,\n mountRestartAllButton: true,\n codeMirrorConfig: {},\n};\n\nlet _pageConfigData: Options | undefined;\n\nconst getKeyValue =\n (key: U) =>\n (obj: T) =>\n obj[key];\n\nexport function mergeOptions(options: Partial): Options {\n const optionsOnPage = getPageConfig();\n const merged = merge({}, optionsOnPage, options);\n if (!merged.codeMirrorConfig && (merged.binderOptions as any).codeMirrorConfig) {\n merged.codeMirrorConfig = (merged.binderOptions as any).codeMirrorConfig;\n }\n return { ...merged, ...ensureCoreOptions(merged) };\n}\n\nexport function resetPageConfig() {\n _pageConfigData = undefined;\n}\n\nexport function getPageConfig(): Options {\n ensurePageConfigLoaded();\n return _pageConfigData as Options;\n}\n\nexport function getPageConfigValue(key: keyof Options) {\n const config = getPageConfig();\n if (!config) return getKeyValue(key)(config);\n}\n\nexport function ensurePageConfigLoaded() {\n if (!_pageConfigData) {\n let fragments = {};\n const elList = document.querySelectorAll(\"script[type='text/x-thebe-config']\");\n elList.forEach((el) => {\n if (el.getAttribute('data-thebe-loaded')) return;\n el.setAttribute('data-thebe-loaded', 'true');\n if (!el.textContent) return;\n let pageConfigFragment = undefined;\n try {\n pageConfigFragment = JSON5.parse(el.textContent);\n if (pageConfigFragment) {\n console.debug('loading thebe config', pageConfigFragment);\n fragments = merge(fragments, pageConfigFragment);\n } else {\n console.debug('No thebeConfig found in ', el);\n }\n } catch (e) {\n console.error('Error loading thebe config', e, el.textContent);\n }\n });\n\n _pageConfigData = { ...defaultOptions, ...fragments };\n }\n return _pageConfigData;\n}\n","import type { IThebeCell, ThebeNotebook } from 'thebe-core';\nimport type { Options } from './options';\nimport { randomId } from './utils';\nimport type { CellDOMItem, CellDOMPlaceholder } from './types';\nimport { setupCodemirror } from './codemirror';\n\n/**\n * findCells will find cells and outputs, associating outputs with cells\n * in fifo priority\n *\n * Note: this mirrors the original thebe behaviour\n *\n * @param selector\n * @param outputSelector\n * @returns\n */\nexport function findCells(selector: string, outputSelector: string): CellDOMPlaceholder[] {\n const cellEls = Array.from(document.querySelectorAll(selector));\n const outputEls = Array.from(document.querySelectorAll(outputSelector));\n return cellEls.map((el, idx) => ({\n id: randomId(),\n placeholders: {\n source: el,\n output: idx < outputEls.length ? outputEls[idx] : undefined,\n },\n }));\n}\n\nfunction buildButton(\n parent: Element,\n classSlug: string,\n text: string,\n title: string,\n onClickCb?: () => void,\n) {\n const btn = document.createElement('button');\n btn.classList.add('thebe-button', `thebe-${classSlug}-button`);\n btn.textContent = text;\n btn.setAttribute('title', title);\n btn.onclick = onClickCb ?? (() => console.debug(`thebe:${classSlug}`));\n parent.append(btn);\n return btn;\n}\n\nfunction buildButtonBusySpinner(parent: Element) {\n const outer = document.createElement('div');\n outer.classList.add('thebe-busy');\n outer.style.display = 'none';\n const inner = document.createElement('div');\n inner.classList.add('thebe-busy-spinner');\n outer.appendChild(inner);\n parent.append(outer);\n return outer;\n}\n\nfunction getButtonsBusy(id: string) {\n const cell = document.querySelector(`[data-thebe-id=${id}]`);\n const busy = cell?.getElementsByClassName('thebe-busy').item(0);\n if (!busy) return;\n return busy as HTMLElement;\n}\n\nexport function setButtonsBusy(id: string) {\n const busy = getButtonsBusy(id);\n if (busy) {\n busy.style.display = 'inline-block';\n }\n}\n\nexport function clearButtonsBusy(id: string) {\n setTimeout(() => {\n const busy = getButtonsBusy(id);\n if (busy) busy.style.display = 'none';\n }, 200);\n}\n\nfunction buildCellUI(\n options: Options,\n item: CellDOMPlaceholder,\n notebook: ThebeNotebook,\n cell: IThebeCell,\n): CellDOMItem {\n console.debug(`thebe:buildCellUI CellId:${item.id}`);\n const box = document.createElement('div');\n box.classList.add('thebe-cell');\n box.setAttribute('data-thebe-id', item.id);\n\n console.debug(`thebe:buildCellUI building editor`);\n const editor = document.createElement('div');\n editor.classList.add('thebe-input');\n box.append(editor);\n\n console.debug(`thebe:buildCellUI setup CodeMirror`);\n setupCodemirror(options, item, cell, box, editor, setButtonsBusy, clearButtonsBusy);\n\n console.debug(`thebe:buildCellUI adding cell controls`);\n let run, runAll, restart, restartAll;\n\n const controls = document.createElement('div');\n controls.classList.add('thebe-controls');\n\n if (options.mountRunButton)\n run = buildButton(controls, 'run', 'run', 'run this cell', async () => {\n console.debug(`thebe:run:${cell.id} run`);\n setButtonsBusy(cell.id);\n await cell.execute(cell.source);\n clearButtonsBusy(cell.id);\n });\n\n if (options.mountRunAllButton) {\n runAll = buildButton(controls, 'runall', 'run all', 'run all cells', async () => {\n console.debug(`thebe:run:${cell.id} runall`);\n notebook.cells?.forEach(({ id }: { id: string }) => setButtonsBusy(id));\n // TODO notebook should return an array of promises, one for each cell\n // TODO return the cell id along with the each promise\n await notebook.executeAll();\n notebook.cells?.forEach(({ id }: { id: string }) => clearButtonsBusy(id));\n });\n }\n\n if (options.mountRestartButton) {\n restart = buildButton(controls, 'restart', 'restart', 'restart the kernel', async () => {\n console.debug(`thebe:run:${cell.id} restart`);\n await notebook.session?.kernel?.restart();\n });\n }\n\n if (options.mountRestartAllButton) {\n restartAll = buildButton(\n controls,\n 'restartall',\n 'restart & run all',\n 'restart the kernel and run all cells',\n async () => {\n console.debug(`thebe:run:${cell.id} runall`);\n notebook.cells?.forEach(({ id }) => setButtonsBusy(id));\n // TODO notebook should return an array of promises, one for each cell\n // TODO return the cell id along with the each promise\n await notebook.executeAll();\n notebook.cells?.forEach(({ id }) => clearButtonsBusy(id));\n },\n );\n }\n\n buildButtonBusySpinner(controls);\n box.append(controls);\n\n // no output placeholder for this cell, append a new element\n let output = item.placeholders.output;\n if (output) {\n console.debug(`thebe:buildCellUI using output placeholder`);\n } else {\n console.debug(`thebe:buildCellUI no output placeholder for this cell, append a new element`);\n output = document.createElement('div');\n output.classList.add('thebe-output');\n box.append(output);\n }\n\n // preserve id of original placeholder\n box.id = item.placeholders.source.id;\n item.placeholders.source.replaceWith(box);\n\n // this must happen after the box/host is attached\n cell.attachToDOM(output as HTMLElement);\n\n return {\n ...item,\n ui: {\n cell: box,\n editor,\n output,\n buttons: {\n run,\n runAll,\n restart,\n restartAll,\n },\n },\n };\n}\n\nexport function renderAllCells(\n options: Options,\n notebook: ThebeNotebook,\n placeholders: CellDOMPlaceholder[],\n) {\n return placeholders.map((p) => {\n const cell = notebook.getCellById(p.id);\n if (!cell) return p;\n return buildCellUI(options, p, notebook, cell);\n });\n}\n","import type { ThebeEventData } from 'thebe-core';\nimport { ErrorStatusEvent, EventSubject, ServerStatusEvent, SessionStatusEvent } from 'thebe-core';\n\n// Functions for the thebe activate button and status field\nexport class KernelStatus {\n stub: string;\n constructor() {\n this.stub = 'Status:';\n this._registerHandlers();\n }\n\n _registerHandlers() {\n window.thebe.on('status', (name: string, { subject, status, message }: ThebeEventData) => {\n if (\n subject !== EventSubject.server &&\n subject !== EventSubject.session &&\n subject !== EventSubject.kernel\n )\n return;\n const field = this._fieldElement();\n if (field) {\n switch (status) {\n case ServerStatusEvent.launching:\n field.className = `thebe-status-field thebe-status-${status}`;\n field.textContent = 'Launching...';\n break;\n case ErrorStatusEvent.error:\n field.className = `thebe-status-field thebe-status-${status}`;\n field.textContent = 'Failed to connect to server';\n break;\n case ServerStatusEvent.closed:\n field.className = `thebe-status-field thebe-status-${status}`;\n field.textContent = 'Server connection closed';\n break;\n case SessionStatusEvent.shutdown:\n field.className = `thebe-status-field thebe-status-${status}`;\n field.textContent = 'Session is dead';\n break;\n case SessionStatusEvent.starting:\n field.className = `thebe-status-field thebe-status-${status}`;\n field.textContent = 'Starting session';\n break;\n case SessionStatusEvent.ready:\n field.className = `thebe-status-field thebe-status-session-ready`;\n field.textContent = 'Kernel Connected';\n break;\n case ServerStatusEvent.ready:\n field.className = `thebe-status-field thebe-status-server-ready`;\n field.textContent = 'Conected to Server';\n break;\n }\n }\n\n const msg = this._messageElement();\n if (msg) msg.textContent = message;\n });\n }\n\n _messageElement() {\n const collection = document.getElementsByClassName('thebe-status-message');\n return collection.length ? collection.item(0) : undefined;\n }\n\n _fieldElement() {\n const collection = document.getElementsByClassName('thebe-status-field');\n return collection.length ? collection.item(0) : undefined;\n }\n\n /**\n * Mount the status field widget.\n *\n * Contents of the element with class `thebe-status-field` will be replaced with a status widget\n *\n * @returns true if an element with the expected class was found\n */\n mount() {\n const el = document.querySelector('.thebe-status');\n if (!el) {\n console.debug('KernelStatus mount requested but no .thebe-status element found on page');\n return;\n }\n\n const box = document.createElement('div');\n box.className = 'thebe-status thebe-status-mounted';\n box.setAttribute('title', this.stub);\n\n const stub = document.createElement('span');\n stub.classList.add('thebe-status-stub');\n stub.textContent = this.stub;\n box.appendChild(stub);\n\n const field = document.createElement('span');\n field.classList.add('thebe-status-field');\n field.textContent = 'No Kernel Attached';\n\n const message = document.createElement('div');\n message.classList.add('thebe-status-message');\n\n box.append(stub, field, message);\n\n el.replaceWith(box);\n\n return el !== undefined;\n }\n\n unmount() {\n const el = document.querySelector('.thebe-status');\n if (!el) return;\n let child = el.lastElementChild;\n while (child) {\n el.removeChild(child);\n child = el.lastElementChild;\n }\n return el;\n }\n}\n","import { defaultOutputSelector, defaultSelector, mergeOptions } from './options';\nimport { findCells, renderAllCells } from './render';\nimport { stripPrompts, stripOutputPrompts } from './utils';\nimport { KernelStatus } from './status';\nimport { ActivateWidget } from './activate';\n\n// Exposing @jupyter-widgets/base and @jupyter-widgets/controls as amd\n// modules for custom widget bundles that depend on it.\n\nimport * as base from '@jupyter-widgets/base';\nimport * as controls from '@jupyter-widgets/controls';\nimport { output } from '@jupyter-widgets/jupyterlab-manager';\nimport type { Options } from './options';\nimport {\n makeConfiguration,\n makeRenderMimeRegistry,\n setupNotebookFromBlocks,\n ThebeServer,\n} from 'thebe-core';\nimport type { CellDOMPlaceholder } from './types';\n\nif (typeof window !== 'undefined' && typeof window.define !== 'undefined') {\n window.define('@jupyter-widgets/base', base);\n window.define('@jupyter-widgets/controls', controls);\n window.define('@jupyter-widgets/output', output);\n}\n\nexport * from './render';\nexport {\n Options,\n mergeOptions,\n getPageConfig,\n getPageConfigValue,\n ensurePageConfigLoaded,\n} from './options';\nexport * from './utils';\n\nexport function mountStatusWidget() {\n window.thebe.kernelStatus = new KernelStatus();\n window.thebe.kernelStatus.mount();\n}\n\nexport function mountActivateWidget(options: Options = {}) {\n window.thebe.activateButton = new ActivateWidget(options);\n window.thebe.activateButton.mount();\n}\n\n/**\n * Bootstrap the library based on the configuration given.\n *\n * If bootstrap === true in the configuration and the library is loaded statically\n * then this function will be called automatically on the document load event.\n *\n * @param {Object} options Object containing thebe options.\n * Same structure as x-thebe-options.\n * @returns {Promise} Promise for connected Kernel object\n */\nexport async function bootstrap(opts: Partial = {}) {\n // bootstrap thebe on the page\n // merge defaults, pageConfig, etc.\n const options = mergeOptions({ useBinder: true, requestKernel: true, ...opts });\n\n if (options.preRenderHook) options.preRenderHook();\n if (options.stripPrompts) stripPrompts(options);\n if (options.stripOutputPrompts) stripOutputPrompts(options);\n\n const { selector, outputSelector } = options;\n const items: CellDOMPlaceholder[] = findCells(\n selector ?? defaultSelector,\n outputSelector ?? defaultOutputSelector,\n );\n\n const codeWithIds = items.map(({ id, placeholders: { source: el } }) => {\n return { id, source: el.textContent?.trim() ?? '' };\n });\n\n const config = makeConfiguration(options, window.thebe.events);\n const rendermime = makeRenderMimeRegistry(config.mathjax);\n\n const notebook = setupNotebookFromBlocks(codeWithIds, config, rendermime);\n window.thebe.notebook = notebook;\n\n renderAllCells(options, notebook, items);\n\n // starting to talk to binder / server is deferred until here so that any page\n // errors cause failure first\n\n const server = new ThebeServer(config);\n\n // connect to a resource\n if (options.useBinder) {\n console.debug(`thebe:api:connect useBinder`, config.base, config.binder);\n server.connectToServerViaBinder();\n } else if (options.useJupyterLite) {\n console.debug(`thebe:api:connect JupyterLite`, config.base);\n server.connectToJupyterLiteServer();\n } else {\n server.connectToJupyterServer();\n }\n\n window.thebe.server = server;\n\n if (!opts.requestKernel) {\n return { server, notebook };\n }\n\n await server.ready;\n\n const session = await server.startNewSession(rendermime);\n if (session != null) notebook.attachSession(session);\n\n window.thebe.session = session ?? undefined;\n\n return {\n server,\n session,\n notebook,\n };\n}\n","import type { Options } from './options';\nimport { defaultSelector } from './options';\n\nexport function stripPrompts({ selector, stripPrompts: prompts }: Options) {\n // strip prompts from a cell\n document.querySelectorAll(selector ?? defaultSelector).forEach((el) => {\n splitCell(el, prompts);\n });\n}\n\nexport function stripOutputPrompts({ selector, stripOutputPrompts: prompts }: Options) {\n // strip output prompts from a cell\n document.querySelectorAll(selector ?? defaultSelector).forEach((el) => {\n splitCellOutputPrompt(el, prompts);\n });\n}\n\nfunction appendNewCell(el: Element, text: string) {\n const pre = document.createElement('pre');\n pre.setAttribute('data-executable', 'data-executable');\n pre.textContent = text;\n el.appendChild(pre);\n}\n\nfunction splitCell(\n el: Element,\n {\n inPrompt,\n continuationPrompt,\n }: {\n inPrompt?: string;\n continuationPrompt?: string;\n } = {},\n) {\n const rawText = el.textContent?.trim() ?? '';\n if (!inPrompt || rawText.indexOf(inPrompt) == -1) {\n return el;\n }\n const listOfCellContents: string[] = [];\n let cellContents: string | null = null;\n rawText.split('\\n').map((line) => {\n line = line.trim();\n if (line.slice(0, inPrompt.length) === inPrompt) {\n // line with a prompt\n line = line.slice(inPrompt.length) + '\\n';\n if (cellContents) {\n cellContents += line;\n } else {\n cellContents = line;\n }\n } else if (\n continuationPrompt &&\n line.slice(0, continuationPrompt.length) === continuationPrompt\n ) {\n // line with a continuation prompt\n cellContents += line.slice(continuationPrompt.length) + '\\n';\n } else {\n // output line\n if (cellContents) {\n listOfCellContents.push(cellContents);\n cellContents = null;\n }\n }\n });\n if (cellContents) {\n listOfCellContents.push(cellContents);\n }\n // clear the parent element\n el.innerHTML = '';\n // add the thebe-able cells\n listOfCellContents.forEach((cell) => appendNewCell(el, cell));\n}\n\nfunction splitCellOutputPrompt(el: Element, { outPrompt }: { outPrompt?: string } = {}) {\n const rawText = el.textContent?.trim() ?? '';\n if (!outPrompt || rawText.indexOf(outPrompt) == -1) {\n return el;\n }\n const listOfCellContents: string[] = [];\n let cellContents: string | null = null;\n rawText.split('\\n').map((line) => {\n line = line.trim();\n if (line.slice(0, outPrompt.length) === outPrompt) {\n // output line\n if (cellContents) {\n listOfCellContents.push(cellContents);\n cellContents = null;\n }\n } else {\n // input line\n if (cellContents) {\n cellContents += line + '\\n';\n } else {\n cellContents = line + '\\n';\n }\n }\n });\n if (cellContents) {\n listOfCellContents.push(cellContents);\n }\n // clear the parent element\n el.innerHTML = '';\n // add the thebe-able cells\n listOfCellContents.forEach((cell) => appendNewCell(el, cell));\n}\n\nexport function randomId() {\n const uint32 = window.crypto.getRandomValues(new Uint32Array(1))[0];\n return 'id-' + uint32.toString(8);\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","'use strict';\n\nvar required = require('requires-port')\n , qs = require('querystringify')\n , controlOrWhitespace = /^[\\x00-\\x20\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]+/\n , CRHTLF = /[\\n\\r\\t]/g\n , slashes = /^[A-Za-z][A-Za-z0-9+-.]*:\\/\\//\n , port = /:\\d+$/\n , protocolre = /^([a-z][a-z0-9.+-]*:)?(\\/\\/)?([\\\\/]+)?([\\S\\s]*)/i\n , windowsDriveLetter = /^[a-zA-Z]:/;\n\n/**\n * Remove control characters and whitespace from the beginning of a string.\n *\n * @param {Object|String} str String to trim.\n * @returns {String} A new string representing `str` stripped of control\n * characters and whitespace from its beginning.\n * @public\n */\nfunction trimLeft(str) {\n return (str ? str : '').toString().replace(controlOrWhitespace, '');\n}\n\n/**\n * These are the parse rules for the URL parser, it informs the parser\n * about:\n *\n * 0. The char it Needs to parse, if it's a string it should be done using\n * indexOf, RegExp using exec and NaN means set as current value.\n * 1. The property we should set when parsing this value.\n * 2. Indication if it's backwards or forward parsing, when set as number it's\n * the value of extra chars that should be split off.\n * 3. Inherit from location if non existing in the parser.\n * 4. `toLowerCase` the resulting value.\n */\nvar rules = [\n ['#', 'hash'], // Extract from the back.\n ['?', 'query'], // Extract from the back.\n function sanitize(address, url) { // Sanitize what is left of the address\n return isSpecial(url.protocol) ? address.replace(/\\\\/g, '/') : address;\n },\n ['/', 'pathname'], // Extract from the back.\n ['@', 'auth', 1], // Extract from the front.\n [NaN, 'host', undefined, 1, 1], // Set left over value.\n [/:(\\d*)$/, 'port', undefined, 1], // RegExp the back.\n [NaN, 'hostname', undefined, 1, 1] // Set left over.\n];\n\n/**\n * These properties should not be copied or inherited from. This is only needed\n * for all non blob URL's as a blob URL does not include a hash, only the\n * origin.\n *\n * @type {Object}\n * @private\n */\nvar ignore = { hash: 1, query: 1 };\n\n/**\n * The location object differs when your code is loaded through a normal page,\n * Worker or through a worker using a blob. And with the blobble begins the\n * trouble as the location object will contain the URL of the blob, not the\n * location of the page where our code is loaded in. The actual origin is\n * encoded in the `pathname` so we can thankfully generate a good \"default\"\n * location from it so we can generate proper relative URL's again.\n *\n * @param {Object|String} loc Optional default location object.\n * @returns {Object} lolcation object.\n * @public\n */\nfunction lolcation(loc) {\n var globalVar;\n\n if (typeof window !== 'undefined') globalVar = window;\n else if (typeof global !== 'undefined') globalVar = global;\n else if (typeof self !== 'undefined') globalVar = self;\n else globalVar = {};\n\n var location = globalVar.location || {};\n loc = loc || location;\n\n var finaldestination = {}\n , type = typeof loc\n , key;\n\n if ('blob:' === loc.protocol) {\n finaldestination = new Url(unescape(loc.pathname), {});\n } else if ('string' === type) {\n finaldestination = new Url(loc, {});\n for (key in ignore) delete finaldestination[key];\n } else if ('object' === type) {\n for (key in loc) {\n if (key in ignore) continue;\n finaldestination[key] = loc[key];\n }\n\n if (finaldestination.slashes === undefined) {\n finaldestination.slashes = slashes.test(loc.href);\n }\n }\n\n return finaldestination;\n}\n\n/**\n * Check whether a protocol scheme is special.\n *\n * @param {String} The protocol scheme of the URL\n * @return {Boolean} `true` if the protocol scheme is special, else `false`\n * @private\n */\nfunction isSpecial(scheme) {\n return (\n scheme === 'file:' ||\n scheme === 'ftp:' ||\n scheme === 'http:' ||\n scheme === 'https:' ||\n scheme === 'ws:' ||\n scheme === 'wss:'\n );\n}\n\n/**\n * @typedef ProtocolExtract\n * @type Object\n * @property {String} protocol Protocol matched in the URL, in lowercase.\n * @property {Boolean} slashes `true` if protocol is followed by \"//\", else `false`.\n * @property {String} rest Rest of the URL that is not part of the protocol.\n */\n\n/**\n * Extract protocol information from a URL with/without double slash (\"//\").\n *\n * @param {String} address URL we want to extract from.\n * @param {Object} location\n * @return {ProtocolExtract} Extracted information.\n * @private\n */\nfunction extractProtocol(address, location) {\n address = trimLeft(address);\n address = address.replace(CRHTLF, '');\n location = location || {};\n\n var match = protocolre.exec(address);\n var protocol = match[1] ? match[1].toLowerCase() : '';\n var forwardSlashes = !!match[2];\n var otherSlashes = !!match[3];\n var slashesCount = 0;\n var rest;\n\n if (forwardSlashes) {\n if (otherSlashes) {\n rest = match[2] + match[3] + match[4];\n slashesCount = match[2].length + match[3].length;\n } else {\n rest = match[2] + match[4];\n slashesCount = match[2].length;\n }\n } else {\n if (otherSlashes) {\n rest = match[3] + match[4];\n slashesCount = match[3].length;\n } else {\n rest = match[4]\n }\n }\n\n if (protocol === 'file:') {\n if (slashesCount >= 2) {\n rest = rest.slice(2);\n }\n } else if (isSpecial(protocol)) {\n rest = match[4];\n } else if (protocol) {\n if (forwardSlashes) {\n rest = rest.slice(2);\n }\n } else if (slashesCount >= 2 && isSpecial(location.protocol)) {\n rest = match[4];\n }\n\n return {\n protocol: protocol,\n slashes: forwardSlashes || isSpecial(protocol),\n slashesCount: slashesCount,\n rest: rest\n };\n}\n\n/**\n * Resolve a relative URL pathname against a base URL pathname.\n *\n * @param {String} relative Pathname of the relative URL.\n * @param {String} base Pathname of the base URL.\n * @return {String} Resolved pathname.\n * @private\n */\nfunction resolve(relative, base) {\n if (relative === '') return base;\n\n var path = (base || '/').split('/').slice(0, -1).concat(relative.split('/'))\n , i = path.length\n , last = path[i - 1]\n , unshift = false\n , up = 0;\n\n while (i--) {\n if (path[i] === '.') {\n path.splice(i, 1);\n } else if (path[i] === '..') {\n path.splice(i, 1);\n up++;\n } else if (up) {\n if (i === 0) unshift = true;\n path.splice(i, 1);\n up--;\n }\n }\n\n if (unshift) path.unshift('');\n if (last === '.' || last === '..') path.push('');\n\n return path.join('/');\n}\n\n/**\n * The actual URL instance. Instead of returning an object we've opted-in to\n * create an actual constructor as it's much more memory efficient and\n * faster and it pleases my OCD.\n *\n * It is worth noting that we should not use `URL` as class name to prevent\n * clashes with the global URL instance that got introduced in browsers.\n *\n * @constructor\n * @param {String} address URL we want to parse.\n * @param {Object|String} [location] Location defaults for relative paths.\n * @param {Boolean|Function} [parser] Parser for the query string.\n * @private\n */\nfunction Url(address, location, parser) {\n address = trimLeft(address);\n address = address.replace(CRHTLF, '');\n\n if (!(this instanceof Url)) {\n return new Url(address, location, parser);\n }\n\n var relative, extracted, parse, instruction, index, key\n , instructions = rules.slice()\n , type = typeof location\n , url = this\n , i = 0;\n\n //\n // The following if statements allows this module two have compatibility with\n // 2 different API:\n //\n // 1. Node.js's `url.parse` api which accepts a URL, boolean as arguments\n // where the boolean indicates that the query string should also be parsed.\n //\n // 2. The `URL` interface of the browser which accepts a URL, object as\n // arguments. The supplied object will be used as default values / fall-back\n // for relative paths.\n //\n if ('object' !== type && 'string' !== type) {\n parser = location;\n location = null;\n }\n\n if (parser && 'function' !== typeof parser) parser = qs.parse;\n\n location = lolcation(location);\n\n //\n // Extract protocol information before running the instructions.\n //\n extracted = extractProtocol(address || '', location);\n relative = !extracted.protocol && !extracted.slashes;\n url.slashes = extracted.slashes || relative && location.slashes;\n url.protocol = extracted.protocol || location.protocol || '';\n address = extracted.rest;\n\n //\n // When the authority component is absent the URL starts with a path\n // component.\n //\n if (\n extracted.protocol === 'file:' && (\n extracted.slashesCount !== 2 || windowsDriveLetter.test(address)) ||\n (!extracted.slashes &&\n (extracted.protocol ||\n extracted.slashesCount < 2 ||\n !isSpecial(url.protocol)))\n ) {\n instructions[3] = [/(.*)/, 'pathname'];\n }\n\n for (; i < instructions.length; i++) {\n instruction = instructions[i];\n\n if (typeof instruction === 'function') {\n address = instruction(address, url);\n continue;\n }\n\n parse = instruction[0];\n key = instruction[1];\n\n if (parse !== parse) {\n url[key] = address;\n } else if ('string' === typeof parse) {\n index = parse === '@'\n ? address.lastIndexOf(parse)\n : address.indexOf(parse);\n\n if (~index) {\n if ('number' === typeof instruction[2]) {\n url[key] = address.slice(0, index);\n address = address.slice(index + instruction[2]);\n } else {\n url[key] = address.slice(index);\n address = address.slice(0, index);\n }\n }\n } else if ((index = parse.exec(address))) {\n url[key] = index[1];\n address = address.slice(0, index.index);\n }\n\n url[key] = url[key] || (\n relative && instruction[3] ? location[key] || '' : ''\n );\n\n //\n // Hostname, host and protocol should be lowercased so they can be used to\n // create a proper `origin`.\n //\n if (instruction[4]) url[key] = url[key].toLowerCase();\n }\n\n //\n // Also parse the supplied query string in to an object. If we're supplied\n // with a custom parser as function use that instead of the default build-in\n // parser.\n //\n if (parser) url.query = parser(url.query);\n\n //\n // If the URL is relative, resolve the pathname against the base URL.\n //\n if (\n relative\n && location.slashes\n && url.pathname.charAt(0) !== '/'\n && (url.pathname !== '' || location.pathname !== '')\n ) {\n url.pathname = resolve(url.pathname, location.pathname);\n }\n\n //\n // Default to a / for pathname if none exists. This normalizes the URL\n // to always have a /\n //\n if (url.pathname.charAt(0) !== '/' && isSpecial(url.protocol)) {\n url.pathname = '/' + url.pathname;\n }\n\n //\n // We should not add port numbers if they are already the default port number\n // for a given protocol. As the host also contains the port number we're going\n // override it with the hostname which contains no port number.\n //\n if (!required(url.port, url.protocol)) {\n url.host = url.hostname;\n url.port = '';\n }\n\n //\n // Parse down the `auth` for the username and password.\n //\n url.username = url.password = '';\n\n if (url.auth) {\n index = url.auth.indexOf(':');\n\n if (~index) {\n url.username = url.auth.slice(0, index);\n url.username = encodeURIComponent(decodeURIComponent(url.username));\n\n url.password = url.auth.slice(index + 1);\n url.password = encodeURIComponent(decodeURIComponent(url.password))\n } else {\n url.username = encodeURIComponent(decodeURIComponent(url.auth));\n }\n\n url.auth = url.password ? url.username +':'+ url.password : url.username;\n }\n\n url.origin = url.protocol !== 'file:' && isSpecial(url.protocol) && url.host\n ? url.protocol +'//'+ url.host\n : 'null';\n\n //\n // The href is just the compiled result.\n //\n url.href = url.toString();\n}\n\n/**\n * This is convenience method for changing properties in the URL instance to\n * insure that they all propagate correctly.\n *\n * @param {String} part Property we need to adjust.\n * @param {Mixed} value The newly assigned value.\n * @param {Boolean|Function} fn When setting the query, it will be the function\n * used to parse the query.\n * When setting the protocol, double slash will be\n * removed from the final url if it is true.\n * @returns {URL} URL instance for chaining.\n * @public\n */\nfunction set(part, value, fn) {\n var url = this;\n\n switch (part) {\n case 'query':\n if ('string' === typeof value && value.length) {\n value = (fn || qs.parse)(value);\n }\n\n url[part] = value;\n break;\n\n case 'port':\n url[part] = value;\n\n if (!required(value, url.protocol)) {\n url.host = url.hostname;\n url[part] = '';\n } else if (value) {\n url.host = url.hostname +':'+ value;\n }\n\n break;\n\n case 'hostname':\n url[part] = value;\n\n if (url.port) value += ':'+ url.port;\n url.host = value;\n break;\n\n case 'host':\n url[part] = value;\n\n if (port.test(value)) {\n value = value.split(':');\n url.port = value.pop();\n url.hostname = value.join(':');\n } else {\n url.hostname = value;\n url.port = '';\n }\n\n break;\n\n case 'protocol':\n url.protocol = value.toLowerCase();\n url.slashes = !fn;\n break;\n\n case 'pathname':\n case 'hash':\n if (value) {\n var char = part === 'pathname' ? '/' : '#';\n url[part] = value.charAt(0) !== char ? char + value : value;\n } else {\n url[part] = value;\n }\n break;\n\n case 'username':\n case 'password':\n url[part] = encodeURIComponent(value);\n break;\n\n case 'auth':\n var index = value.indexOf(':');\n\n if (~index) {\n url.username = value.slice(0, index);\n url.username = encodeURIComponent(decodeURIComponent(url.username));\n\n url.password = value.slice(index + 1);\n url.password = encodeURIComponent(decodeURIComponent(url.password));\n } else {\n url.username = encodeURIComponent(decodeURIComponent(value));\n }\n }\n\n for (var i = 0; i < rules.length; i++) {\n var ins = rules[i];\n\n if (ins[4]) url[ins[1]] = url[ins[1]].toLowerCase();\n }\n\n url.auth = url.password ? url.username +':'+ url.password : url.username;\n\n url.origin = url.protocol !== 'file:' && isSpecial(url.protocol) && url.host\n ? url.protocol +'//'+ url.host\n : 'null';\n\n url.href = url.toString();\n\n return url;\n}\n\n/**\n * Transform the properties back in to a valid and full URL string.\n *\n * @param {Function} stringify Optional query stringify function.\n * @returns {String} Compiled version of the URL.\n * @public\n */\nfunction toString(stringify) {\n if (!stringify || 'function' !== typeof stringify) stringify = qs.stringify;\n\n var query\n , url = this\n , host = url.host\n , protocol = url.protocol;\n\n if (protocol && protocol.charAt(protocol.length - 1) !== ':') protocol += ':';\n\n var result =\n protocol +\n ((url.protocol && url.slashes) || isSpecial(url.protocol) ? '//' : '');\n\n if (url.username) {\n result += url.username;\n if (url.password) result += ':'+ url.password;\n result += '@';\n } else if (url.password) {\n result += ':'+ url.password;\n result += '@';\n } else if (\n url.protocol !== 'file:' &&\n isSpecial(url.protocol) &&\n !host &&\n url.pathname !== '/'\n ) {\n //\n // Add back the empty userinfo, otherwise the original invalid URL\n // might be transformed into a valid one with `url.pathname` as host.\n //\n result += '@';\n }\n\n //\n // Trailing colon is removed from `url.host` when it is parsed. If it still\n // ends with a colon, then add back the trailing colon that was removed. This\n // prevents an invalid URL from being transformed into a valid one.\n //\n if (host[host.length - 1] === ':' || (port.test(url.hostname) && !url.port)) {\n host += ':';\n }\n\n result += host + url.pathname;\n\n query = 'object' === typeof url.query ? stringify(url.query) : url.query;\n if (query) result += '?' !== query.charAt(0) ? '?'+ query : query;\n\n if (url.hash) result += url.hash;\n\n return result;\n}\n\nUrl.prototype = { set: set, toString: toString };\n\n//\n// Expose the URL parser and some additional properties that might be useful for\n// others or testing.\n//\nUrl.extractProtocol = extractProtocol;\nUrl.location = lolcation;\nUrl.trimLeft = trimLeft;\nUrl.qs = qs;\n\nmodule.exports = Url;\n","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../../packages/thebe/node_modules/css-loader/dist/runtime/cssWithMappingToString.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../packages/thebe/node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/* Copyright (c) Jupyter Development Team.\\n * Distributed under the terms of the Modified BSD License.\\n */\\n\\n.jupyter-widgets-disconnected::before {\\n content: '\\\\f127'; /* chain-broken */\\n display: inline-block;\\n font: normal normal 900 14px/1 'Font Awesome 5 Free', 'FontAwesome';\\n text-rendering: auto;\\n -webkit-font-smoothing: antialiased;\\n -moz-osx-font-smoothing: grayscale;\\n color: #d9534f;\\n padding: 3px;\\n align-self: flex-start;\\n}\\n\\n.jupyter-widgets-error-widget {\\n display: flex;\\n flex-direction: column;\\n justify-content: center;\\n height: 100%;\\n border: solid 1px red;\\n margin: 0 auto;\\n}\\n\\n.jupyter-widgets-error-widget.icon-error {\\n min-width: var(--jp-widgets-inline-width-short);\\n}\\n.jupyter-widgets-error-widget.text-error {\\n min-width: calc(2 * var(--jp-widgets-inline-width));\\n min-height: calc(3 * var(--jp-widgets-inline-height));\\n}\\n\\n.jupyter-widgets-error-widget p {\\n text-align: center;\\n}\\n\\n.jupyter-widgets-error-widget.text-error pre::first-line {\\n font-weight: bold;\\n}\\n\", \"\",{\"version\":3,\"sources\":[\"webpack://./../../node_modules/@jupyter-widgets/base/css/index.css\"],\"names\":[],\"mappings\":\"AAAA;;EAEE;;AAEF;EACE,gBAAgB,EAAE,iBAAiB;EACnC,qBAAqB;EACrB,mEAAmE;EACnE,oBAAoB;EACpB,mCAAmC;EACnC,kCAAkC;EAClC,cAAc;EACd,YAAY;EACZ,sBAAsB;AACxB;;AAEA;EACE,aAAa;EACb,sBAAsB;EACtB,uBAAuB;EACvB,YAAY;EACZ,qBAAqB;EACrB,cAAc;AAChB;;AAEA;EACE,+CAA+C;AACjD;AACA;EACE,mDAAmD;EACnD,qDAAqD;AACvD;;AAEA;EACE,kBAAkB;AACpB;;AAEA;EACE,iBAAiB;AACnB\",\"sourcesContent\":[\"/* Copyright (c) Jupyter Development Team.\\n * Distributed under the terms of the Modified BSD License.\\n */\\n\\n.jupyter-widgets-disconnected::before {\\n content: '\\\\f127'; /* chain-broken */\\n display: inline-block;\\n font: normal normal 900 14px/1 'Font Awesome 5 Free', 'FontAwesome';\\n text-rendering: auto;\\n -webkit-font-smoothing: antialiased;\\n -moz-osx-font-smoothing: grayscale;\\n color: #d9534f;\\n padding: 3px;\\n align-self: flex-start;\\n}\\n\\n.jupyter-widgets-error-widget {\\n display: flex;\\n flex-direction: column;\\n justify-content: center;\\n height: 100%;\\n border: solid 1px red;\\n margin: 0 auto;\\n}\\n\\n.jupyter-widgets-error-widget.icon-error {\\n min-width: var(--jp-widgets-inline-width-short);\\n}\\n.jupyter-widgets-error-widget.text-error {\\n min-width: calc(2 * var(--jp-widgets-inline-width));\\n min-height: calc(3 * var(--jp-widgets-inline-height));\\n}\\n\\n.jupyter-widgets-error-widget p {\\n text-align: center;\\n}\\n\\n.jupyter-widgets-error-widget.text-error pre::first-line {\\n font-weight: bold;\\n}\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../../packages/thebe/node_modules/css-loader/dist/runtime/cssWithMappingToString.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../packages/thebe/node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/* This file has code derived from Lumino CSS files, as noted below. The license for this Lumino code is:\\n\\nCopyright (c) 2019 Project Jupyter Contributors\\nAll rights reserved.\\n\\nRedistribution and use in source and binary forms, with or without\\nmodification, are permitted provided that the following conditions are met:\\n\\n1. Redistributions of source code must retain the above copyright notice, this\\n list of conditions and the following disclaimer.\\n\\n2. Redistributions in binary form must reproduce the above copyright notice,\\n this list of conditions and the following disclaimer in the documentation\\n and/or other materials provided with the distribution.\\n\\n3. Neither the name of the copyright holder nor the names of its\\n contributors may be used to endorse or promote products derived from\\n this software without specific prior written permission.\\n\\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \\\"AS IS\\\"\\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\\n\\n\\nCopyright (c) 2014-2017, PhosphorJS Contributors\\nAll rights reserved.\\n\\nRedistribution and use in source and binary forms, with or without\\nmodification, are permitted provided that the following conditions are met:\\n\\n* Redistributions of source code must retain the above copyright notice, this\\n list of conditions and the following disclaimer.\\n\\n* Redistributions in binary form must reproduce the above copyright notice,\\n this list of conditions and the following disclaimer in the documentation\\n and/or other materials provided with the distribution.\\n\\n* Neither the name of the copyright holder nor the names of its\\n contributors may be used to endorse or promote products derived from\\n this software without specific prior written permission.\\n\\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \\\"AS IS\\\"\\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\\n*/\\n\\n/*\\n * The following section is derived from https://github.com/jupyterlab/lumino/blob/23b9d075ebc5b73ab148b6ebfc20af97f85714c4/packages/widgets/style/tabbar.css \\n * We've scoped the rules so that they are consistent with exactly our code.\\n */\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar {\\n display: flex;\\n -webkit-user-select: none;\\n -moz-user-select: none;\\n -ms-user-select: none;\\n user-select: none;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar[data-orientation='horizontal'], /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar[data-orientation='horizontal'], /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar[data-orientation='horizontal'] {\\n flex-direction: row;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar[data-orientation='vertical'], /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar[data-orientation='vertical'], /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar[data-orientation='vertical'] {\\n flex-direction: column;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar > .p-TabBar-content, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar > .p-TabBar-content, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar > .lm-TabBar-content {\\n margin: 0;\\n padding: 0;\\n display: flex;\\n flex: 1 1 auto;\\n list-style-type: none;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar[data-orientation='horizontal']\\n > .p-TabBar-content,\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n> .p-TabBar[data-orientation='horizontal']\\n> .p-TabBar-content,\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar[data-orientation='horizontal']\\n > .lm-TabBar-content {\\n flex-direction: row;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar[data-orientation='vertical']\\n > .p-TabBar-content,\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n> .p-TabBar[data-orientation='vertical']\\n> .p-TabBar-content,\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar[data-orientation='vertical']\\n > .lm-TabBar-content {\\n flex-direction: column;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tab, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tab {\\n display: flex;\\n flex-direction: row;\\n box-sizing: border-box;\\n overflow: hidden;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabIcon, /* */\\n/* */ .jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabCloseIcon, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tabIcon, /* */\\n/* */ .jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tabCloseIcon, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tabIcon,\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tabCloseIcon {\\n flex: 0 0 auto;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabLabel, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tabLabel, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tabLabel {\\n flex: 1 1 auto;\\n overflow: hidden;\\n white-space: nowrap;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab.p-mod-hidden, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tab.p-mod-hidden, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tab.lm-mod-hidden {\\n display: none !important;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar.p-mod-dragging .p-TabBar-tab, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar.p-mod-dragging .p-TabBar-tab, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar.lm-mod-dragging .lm-TabBar-tab {\\n position: relative;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar.p-mod-dragging[data-orientation='horizontal']\\n .p-TabBar-tab,\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .p-TabBar.p-mod-dragging[data-orientation='horizontal']\\n .p-TabBar-tab,\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar.lm-mod-dragging[data-orientation='horizontal']\\n .lm-TabBar-tab {\\n left: 0;\\n transition: left 150ms ease;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar.p-mod-dragging[data-orientation='vertical']\\n .p-TabBar-tab,\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n> .p-TabBar.p-mod-dragging[data-orientation='vertical']\\n.p-TabBar-tab,\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar.lm-mod-dragging[data-orientation='vertical']\\n .lm-TabBar-tab {\\n top: 0;\\n transition: top 150ms ease;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar.p-mod-dragging\\n .p-TabBar-tab.p-mod-dragging,\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n> .p-TabBar.p-mod-dragging\\n.p-TabBar-tab.p-mod-dragging,\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar.lm-mod-dragging\\n .lm-TabBar-tab.lm-mod-dragging {\\n transition: none;\\n}\\n\\n/* End tabbar.css */\\n\", \"\",{\"version\":3,\"sources\":[\"webpack://./../../node_modules/@jupyter-widgets/controls/css/lumino.css\"],\"names\":[],\"mappings\":\"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0DC;;AAED;;;EAGE;;AAEF,iBAAiB;AACjB;;;EAGE,aAAa;EACb,yBAAyB;EACzB,sBAAsB;EACtB,qBAAqB;EACrB,iBAAiB;AACnB;;AAEA,iBAAiB;AACjB;;;EAGE,mBAAmB;AACrB;;AAEA,iBAAiB;AACjB;;;EAGE,sBAAsB;AACxB;;AAEA,iBAAiB;AACjB;;;EAGE,SAAS;EACT,UAAU;EACV,aAAa;EACb,cAAc;EACd,qBAAqB;AACvB;;AAEA,iBAAiB;AACjB;;;;;;;;;;;;EAYE,mBAAmB;AACrB;;AAEA,iBAAiB;AACjB;;;;;;;;;;;;EAYE,sBAAsB;AACxB;;AAEA,iBAAiB;AACjB;;;EAGE,aAAa;EACb,mBAAmB;EACnB,sBAAsB;EACtB,gBAAgB;AAClB;;AAEA,iBAAiB;AACjB;;;;;;EAME,cAAc;AAChB;;AAEA,iBAAiB;AACjB;;;EAGE,cAAc;EACd,gBAAgB;EAChB,mBAAmB;AACrB;;AAEA,iBAAiB;AACjB;;;EAGE,wBAAwB;AAC1B;;AAEA,iBAAiB;AACjB;;;EAGE,kBAAkB;AACpB;;AAEA,iBAAiB;AACjB;;;;;;;;;;;;EAYE,OAAO;EACP,2BAA2B;AAC7B;;AAEA,iBAAiB;AACjB;;;;;;;;;;;;EAYE,MAAM;EACN,0BAA0B;AAC5B;;AAEA,iBAAiB;AACjB;;;;;;;;;;;;EAYE,gBAAgB;AAClB;;AAEA,mBAAmB\",\"sourcesContent\":[\"/* This file has code derived from Lumino CSS files, as noted below. The license for this Lumino code is:\\n\\nCopyright (c) 2019 Project Jupyter Contributors\\nAll rights reserved.\\n\\nRedistribution and use in source and binary forms, with or without\\nmodification, are permitted provided that the following conditions are met:\\n\\n1. Redistributions of source code must retain the above copyright notice, this\\n list of conditions and the following disclaimer.\\n\\n2. Redistributions in binary form must reproduce the above copyright notice,\\n this list of conditions and the following disclaimer in the documentation\\n and/or other materials provided with the distribution.\\n\\n3. Neither the name of the copyright holder nor the names of its\\n contributors may be used to endorse or promote products derived from\\n this software without specific prior written permission.\\n\\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \\\"AS IS\\\"\\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\\n\\n\\nCopyright (c) 2014-2017, PhosphorJS Contributors\\nAll rights reserved.\\n\\nRedistribution and use in source and binary forms, with or without\\nmodification, are permitted provided that the following conditions are met:\\n\\n* Redistributions of source code must retain the above copyright notice, this\\n list of conditions and the following disclaimer.\\n\\n* Redistributions in binary form must reproduce the above copyright notice,\\n this list of conditions and the following disclaimer in the documentation\\n and/or other materials provided with the distribution.\\n\\n* Neither the name of the copyright holder nor the names of its\\n contributors may be used to endorse or promote products derived from\\n this software without specific prior written permission.\\n\\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \\\"AS IS\\\"\\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\\n*/\\n\\n/*\\n * The following section is derived from https://github.com/jupyterlab/lumino/blob/23b9d075ebc5b73ab148b6ebfc20af97f85714c4/packages/widgets/style/tabbar.css \\n * We've scoped the rules so that they are consistent with exactly our code.\\n */\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar {\\n display: flex;\\n -webkit-user-select: none;\\n -moz-user-select: none;\\n -ms-user-select: none;\\n user-select: none;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar[data-orientation='horizontal'], /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar[data-orientation='horizontal'], /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar[data-orientation='horizontal'] {\\n flex-direction: row;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar[data-orientation='vertical'], /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar[data-orientation='vertical'], /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar[data-orientation='vertical'] {\\n flex-direction: column;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar > .p-TabBar-content, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar > .p-TabBar-content, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar > .lm-TabBar-content {\\n margin: 0;\\n padding: 0;\\n display: flex;\\n flex: 1 1 auto;\\n list-style-type: none;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar[data-orientation='horizontal']\\n > .p-TabBar-content,\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n> .p-TabBar[data-orientation='horizontal']\\n> .p-TabBar-content,\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar[data-orientation='horizontal']\\n > .lm-TabBar-content {\\n flex-direction: row;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar[data-orientation='vertical']\\n > .p-TabBar-content,\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n> .p-TabBar[data-orientation='vertical']\\n> .p-TabBar-content,\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar[data-orientation='vertical']\\n > .lm-TabBar-content {\\n flex-direction: column;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tab, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tab {\\n display: flex;\\n flex-direction: row;\\n box-sizing: border-box;\\n overflow: hidden;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabIcon, /* */\\n/* */ .jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabCloseIcon, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tabIcon, /* */\\n/* */ .jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tabCloseIcon, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tabIcon,\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tabCloseIcon {\\n flex: 0 0 auto;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabLabel, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tabLabel, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tabLabel {\\n flex: 1 1 auto;\\n overflow: hidden;\\n white-space: nowrap;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab.p-mod-hidden, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tab.p-mod-hidden, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tab.lm-mod-hidden {\\n display: none !important;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar.p-mod-dragging .p-TabBar-tab, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar.p-mod-dragging .p-TabBar-tab, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar.lm-mod-dragging .lm-TabBar-tab {\\n position: relative;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar.p-mod-dragging[data-orientation='horizontal']\\n .p-TabBar-tab,\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .p-TabBar.p-mod-dragging[data-orientation='horizontal']\\n .p-TabBar-tab,\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar.lm-mod-dragging[data-orientation='horizontal']\\n .lm-TabBar-tab {\\n left: 0;\\n transition: left 150ms ease;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar.p-mod-dragging[data-orientation='vertical']\\n .p-TabBar-tab,\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n> .p-TabBar.p-mod-dragging[data-orientation='vertical']\\n.p-TabBar-tab,\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar.lm-mod-dragging[data-orientation='vertical']\\n .lm-TabBar-tab {\\n top: 0;\\n transition: top 150ms ease;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar.p-mod-dragging\\n .p-TabBar-tab.p-mod-dragging,\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n> .p-TabBar.p-mod-dragging\\n.p-TabBar-tab.p-mod-dragging,\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar.lm-mod-dragging\\n .lm-TabBar-tab.lm-mod-dragging {\\n transition: none;\\n}\\n\\n/* End tabbar.css */\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../../packages/thebe/node_modules/css-loader/dist/runtime/cssWithMappingToString.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../packages/thebe/node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/*\\n\\nThe nouislider.css file is autogenerated from nouislider.less, which imports and wraps the nouislider/src/nouislider.less styles.\\n\\nMIT License\\n\\nCopyright (c) 2019 Léon Gersen\\n\\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \\\"Software\\\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\\n\\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\\n\\nTHE SOFTWARE IS PROVIDED \\\"AS IS\\\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\\n*/\\n/* The .widget-slider class is deprecated */\\n.widget-slider,\\n.jupyter-widget-slider {\\n /* Functional styling;\\n * These styles are required for noUiSlider to function.\\n * You don't need to change these rules to apply your design.\\n */\\n /* Wrapper for all connect elements.\\n */\\n /* Offset direction\\n */\\n /* Give origins 0 height/width so they don't interfere with clicking the\\n * connect elements.\\n */\\n /* Slider size and handle placement;\\n */\\n /* Styling;\\n * Giving the connect element a border radius causes issues with using transform: scale\\n */\\n /* Handles and cursors;\\n */\\n /* Handle stripes;\\n */\\n /* Disabled state;\\n */\\n /* Base;\\n *\\n */\\n /* Values;\\n *\\n */\\n /* Markings;\\n *\\n */\\n /* Horizontal layout;\\n *\\n */\\n /* Vertical layout;\\n *\\n */\\n /* Copyright (c) Jupyter Development Team.\\n * Distributed under the terms of the Modified BSD License.\\n */\\n /* Custom CSS for nouislider */\\n}\\n.widget-slider .noUi-target,\\n.jupyter-widget-slider .noUi-target,\\n.widget-slider .noUi-target *,\\n.jupyter-widget-slider .noUi-target * {\\n -webkit-touch-callout: none;\\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\\n -webkit-user-select: none;\\n -ms-touch-action: none;\\n touch-action: none;\\n -ms-user-select: none;\\n -moz-user-select: none;\\n user-select: none;\\n -moz-box-sizing: border-box;\\n box-sizing: border-box;\\n}\\n.widget-slider .noUi-target,\\n.jupyter-widget-slider .noUi-target {\\n position: relative;\\n}\\n.widget-slider .noUi-base,\\n.jupyter-widget-slider .noUi-base,\\n.widget-slider .noUi-connects,\\n.jupyter-widget-slider .noUi-connects {\\n width: 100%;\\n height: 100%;\\n position: relative;\\n z-index: 1;\\n}\\n.widget-slider .noUi-connects,\\n.jupyter-widget-slider .noUi-connects {\\n overflow: hidden;\\n z-index: 0;\\n}\\n.widget-slider .noUi-connect,\\n.jupyter-widget-slider .noUi-connect,\\n.widget-slider .noUi-origin,\\n.jupyter-widget-slider .noUi-origin {\\n will-change: transform;\\n position: absolute;\\n z-index: 1;\\n top: 0;\\n right: 0;\\n -ms-transform-origin: 0 0;\\n -webkit-transform-origin: 0 0;\\n -webkit-transform-style: preserve-3d;\\n transform-origin: 0 0;\\n transform-style: flat;\\n}\\n.widget-slider .noUi-connect,\\n.jupyter-widget-slider .noUi-connect {\\n height: 100%;\\n width: 100%;\\n}\\n.widget-slider .noUi-origin,\\n.jupyter-widget-slider .noUi-origin {\\n height: 10%;\\n width: 10%;\\n}\\n.widget-slider .noUi-txt-dir-rtl.noUi-horizontal .noUi-origin,\\n.jupyter-widget-slider .noUi-txt-dir-rtl.noUi-horizontal .noUi-origin {\\n left: 0;\\n right: auto;\\n}\\n.widget-slider .noUi-vertical .noUi-origin,\\n.jupyter-widget-slider .noUi-vertical .noUi-origin {\\n width: 0;\\n}\\n.widget-slider .noUi-horizontal .noUi-origin,\\n.jupyter-widget-slider .noUi-horizontal .noUi-origin {\\n height: 0;\\n}\\n.widget-slider .noUi-handle,\\n.jupyter-widget-slider .noUi-handle {\\n -webkit-backface-visibility: hidden;\\n backface-visibility: hidden;\\n position: absolute;\\n}\\n.widget-slider .noUi-touch-area,\\n.jupyter-widget-slider .noUi-touch-area {\\n height: 100%;\\n width: 100%;\\n}\\n.widget-slider .noUi-state-tap .noUi-connect,\\n.jupyter-widget-slider .noUi-state-tap .noUi-connect,\\n.widget-slider .noUi-state-tap .noUi-origin,\\n.jupyter-widget-slider .noUi-state-tap .noUi-origin {\\n -webkit-transition: transform 0.3s;\\n transition: transform 0.3s;\\n}\\n.widget-slider .noUi-state-drag *,\\n.jupyter-widget-slider .noUi-state-drag * {\\n cursor: inherit !important;\\n}\\n.widget-slider .noUi-horizontal,\\n.jupyter-widget-slider .noUi-horizontal {\\n height: 18px;\\n}\\n.widget-slider .noUi-horizontal .noUi-handle,\\n.jupyter-widget-slider .noUi-horizontal .noUi-handle {\\n width: 34px;\\n height: 28px;\\n right: -17px;\\n top: -6px;\\n}\\n.widget-slider .noUi-vertical,\\n.jupyter-widget-slider .noUi-vertical {\\n width: 18px;\\n}\\n.widget-slider .noUi-vertical .noUi-handle,\\n.jupyter-widget-slider .noUi-vertical .noUi-handle {\\n width: 28px;\\n height: 34px;\\n right: -6px;\\n top: -17px;\\n}\\n.widget-slider .noUi-txt-dir-rtl.noUi-horizontal .noUi-handle,\\n.jupyter-widget-slider .noUi-txt-dir-rtl.noUi-horizontal .noUi-handle {\\n left: -17px;\\n right: auto;\\n}\\n.widget-slider .noUi-target,\\n.jupyter-widget-slider .noUi-target {\\n background: #FAFAFA;\\n border-radius: 4px;\\n border: 1px solid #D3D3D3;\\n box-shadow: inset 0 1px 1px #F0F0F0, 0 3px 6px -5px #BBB;\\n}\\n.widget-slider .noUi-connects,\\n.jupyter-widget-slider .noUi-connects {\\n border-radius: 3px;\\n}\\n.widget-slider .noUi-connect,\\n.jupyter-widget-slider .noUi-connect {\\n background: #3FB8AF;\\n}\\n.widget-slider .noUi-draggable,\\n.jupyter-widget-slider .noUi-draggable {\\n cursor: ew-resize;\\n}\\n.widget-slider .noUi-vertical .noUi-draggable,\\n.jupyter-widget-slider .noUi-vertical .noUi-draggable {\\n cursor: ns-resize;\\n}\\n.widget-slider .noUi-handle,\\n.jupyter-widget-slider .noUi-handle {\\n border: 1px solid #D9D9D9;\\n border-radius: 3px;\\n background: #FFF;\\n cursor: default;\\n box-shadow: inset 0 0 1px #FFF, inset 0 1px 7px #EBEBEB, 0 3px 6px -3px #BBB;\\n}\\n.widget-slider .noUi-active,\\n.jupyter-widget-slider .noUi-active {\\n box-shadow: inset 0 0 1px #FFF, inset 0 1px 7px #DDD, 0 3px 6px -3px #BBB;\\n}\\n.widget-slider .noUi-handle:before,\\n.jupyter-widget-slider .noUi-handle:before,\\n.widget-slider .noUi-handle:after,\\n.jupyter-widget-slider .noUi-handle:after {\\n content: \\\"\\\";\\n display: block;\\n position: absolute;\\n height: 14px;\\n width: 1px;\\n background: #E8E7E6;\\n left: 14px;\\n top: 6px;\\n}\\n.widget-slider .noUi-handle:after,\\n.jupyter-widget-slider .noUi-handle:after {\\n left: 17px;\\n}\\n.widget-slider .noUi-vertical .noUi-handle:before,\\n.jupyter-widget-slider .noUi-vertical .noUi-handle:before,\\n.widget-slider .noUi-vertical .noUi-handle:after,\\n.jupyter-widget-slider .noUi-vertical .noUi-handle:after {\\n width: 14px;\\n height: 1px;\\n left: 6px;\\n top: 14px;\\n}\\n.widget-slider .noUi-vertical .noUi-handle:after,\\n.jupyter-widget-slider .noUi-vertical .noUi-handle:after {\\n top: 17px;\\n}\\n.widget-slider [disabled] .noUi-connect,\\n.jupyter-widget-slider [disabled] .noUi-connect {\\n background: #B8B8B8;\\n}\\n.widget-slider [disabled].noUi-target,\\n.jupyter-widget-slider [disabled].noUi-target,\\n.widget-slider [disabled].noUi-handle,\\n.jupyter-widget-slider [disabled].noUi-handle,\\n.widget-slider [disabled] .noUi-handle,\\n.jupyter-widget-slider [disabled] .noUi-handle {\\n cursor: not-allowed;\\n}\\n.widget-slider .noUi-pips,\\n.jupyter-widget-slider .noUi-pips,\\n.widget-slider .noUi-pips *,\\n.jupyter-widget-slider .noUi-pips * {\\n -moz-box-sizing: border-box;\\n box-sizing: border-box;\\n}\\n.widget-slider .noUi-pips,\\n.jupyter-widget-slider .noUi-pips {\\n position: absolute;\\n color: #999;\\n}\\n.widget-slider .noUi-value,\\n.jupyter-widget-slider .noUi-value {\\n position: absolute;\\n white-space: nowrap;\\n text-align: center;\\n}\\n.widget-slider .noUi-value-sub,\\n.jupyter-widget-slider .noUi-value-sub {\\n color: #ccc;\\n font-size: 10px;\\n}\\n.widget-slider .noUi-marker,\\n.jupyter-widget-slider .noUi-marker {\\n position: absolute;\\n background: #CCC;\\n}\\n.widget-slider .noUi-marker-sub,\\n.jupyter-widget-slider .noUi-marker-sub {\\n background: #AAA;\\n}\\n.widget-slider .noUi-marker-large,\\n.jupyter-widget-slider .noUi-marker-large {\\n background: #AAA;\\n}\\n.widget-slider .noUi-pips-horizontal,\\n.jupyter-widget-slider .noUi-pips-horizontal {\\n padding: 10px 0;\\n height: 80px;\\n top: 100%;\\n left: 0;\\n width: 100%;\\n}\\n.widget-slider .noUi-value-horizontal,\\n.jupyter-widget-slider .noUi-value-horizontal {\\n -webkit-transform: translate(-50%, 50%);\\n transform: translate(-50%, 50%);\\n}\\n.noUi-rtl .widget-slider .noUi-value-horizontal,\\n.noUi-rtl .jupyter-widget-slider .noUi-value-horizontal {\\n -webkit-transform: translate(50%, 50%);\\n transform: translate(50%, 50%);\\n}\\n.widget-slider .noUi-marker-horizontal.noUi-marker,\\n.jupyter-widget-slider .noUi-marker-horizontal.noUi-marker {\\n margin-left: -1px;\\n width: 2px;\\n height: 5px;\\n}\\n.widget-slider .noUi-marker-horizontal.noUi-marker-sub,\\n.jupyter-widget-slider .noUi-marker-horizontal.noUi-marker-sub {\\n height: 10px;\\n}\\n.widget-slider .noUi-marker-horizontal.noUi-marker-large,\\n.jupyter-widget-slider .noUi-marker-horizontal.noUi-marker-large {\\n height: 15px;\\n}\\n.widget-slider .noUi-pips-vertical,\\n.jupyter-widget-slider .noUi-pips-vertical {\\n padding: 0 10px;\\n height: 100%;\\n top: 0;\\n left: 100%;\\n}\\n.widget-slider .noUi-value-vertical,\\n.jupyter-widget-slider .noUi-value-vertical {\\n -webkit-transform: translate(0, -50%);\\n transform: translate(0, -50%);\\n padding-left: 25px;\\n}\\n.noUi-rtl .widget-slider .noUi-value-vertical,\\n.noUi-rtl .jupyter-widget-slider .noUi-value-vertical {\\n -webkit-transform: translate(0, 50%);\\n transform: translate(0, 50%);\\n}\\n.widget-slider .noUi-marker-vertical.noUi-marker,\\n.jupyter-widget-slider .noUi-marker-vertical.noUi-marker {\\n width: 5px;\\n height: 2px;\\n margin-top: -1px;\\n}\\n.widget-slider .noUi-marker-vertical.noUi-marker-sub,\\n.jupyter-widget-slider .noUi-marker-vertical.noUi-marker-sub {\\n width: 10px;\\n}\\n.widget-slider .noUi-marker-vertical.noUi-marker-large,\\n.jupyter-widget-slider .noUi-marker-vertical.noUi-marker-large {\\n width: 15px;\\n}\\n.widget-slider .noUi-tooltip,\\n.jupyter-widget-slider .noUi-tooltip {\\n display: block;\\n position: absolute;\\n border: 1px solid #D9D9D9;\\n border-radius: 3px;\\n background: #fff;\\n color: #000;\\n padding: 5px;\\n text-align: center;\\n white-space: nowrap;\\n}\\n.widget-slider .noUi-horizontal .noUi-tooltip,\\n.jupyter-widget-slider .noUi-horizontal .noUi-tooltip {\\n -webkit-transform: translate(-50%, 0);\\n transform: translate(-50%, 0);\\n left: 50%;\\n bottom: 120%;\\n}\\n.widget-slider .noUi-vertical .noUi-tooltip,\\n.jupyter-widget-slider .noUi-vertical .noUi-tooltip {\\n -webkit-transform: translate(0, -50%);\\n transform: translate(0, -50%);\\n top: 50%;\\n right: 120%;\\n}\\n.widget-slider .noUi-horizontal .noUi-origin > .noUi-tooltip,\\n.jupyter-widget-slider .noUi-horizontal .noUi-origin > .noUi-tooltip {\\n -webkit-transform: translate(50%, 0);\\n transform: translate(50%, 0);\\n left: auto;\\n bottom: 10px;\\n}\\n.widget-slider .noUi-vertical .noUi-origin > .noUi-tooltip,\\n.jupyter-widget-slider .noUi-vertical .noUi-origin > .noUi-tooltip {\\n -webkit-transform: translate(0, -18px);\\n transform: translate(0, -18px);\\n top: auto;\\n right: 28px;\\n}\\n.widget-slider .noUi-connect,\\n.jupyter-widget-slider .noUi-connect {\\n background: #2196f3;\\n}\\n.widget-slider .noUi-horizontal,\\n.jupyter-widget-slider .noUi-horizontal {\\n height: var(--jp-widgets-slider-track-thickness);\\n}\\n.widget-slider .noUi-vertical,\\n.jupyter-widget-slider .noUi-vertical {\\n width: var(--jp-widgets-slider-track-thickness);\\n height: 100%;\\n}\\n.widget-slider .noUi-horizontal .noUi-handle,\\n.jupyter-widget-slider .noUi-horizontal .noUi-handle {\\n width: var(--jp-widgets-slider-handle-size);\\n height: var(--jp-widgets-slider-handle-size);\\n border-radius: 50%;\\n top: calc((var(--jp-widgets-slider-track-thickness) - var(--jp-widgets-slider-handle-size)) / 2);\\n right: calc(var(--jp-widgets-slider-handle-size) / -2);\\n}\\n.widget-slider .noUi-vertical .noUi-handle,\\n.jupyter-widget-slider .noUi-vertical .noUi-handle {\\n height: var(--jp-widgets-slider-handle-size);\\n width: var(--jp-widgets-slider-handle-size);\\n border-radius: 50%;\\n right: calc((var(--jp-widgets-slider-handle-size) - var(--jp-widgets-slider-track-thickness)) / -2);\\n top: calc(var(--jp-widgets-slider-handle-size) / -2);\\n}\\n.widget-slider .noUi-handle:after,\\n.jupyter-widget-slider .noUi-handle:after {\\n content: none;\\n}\\n.widget-slider .noUi-handle:before,\\n.jupyter-widget-slider .noUi-handle:before {\\n content: none;\\n}\\n.widget-slider .noUi-target,\\n.jupyter-widget-slider .noUi-target {\\n background: #fafafa;\\n border-radius: 4px;\\n border: 1px;\\n /* box-shadow: inset 0 1px 1px #F0F0F0, 0 3px 6px -5px #BBB; */\\n}\\n.widget-slider .ui-slider,\\n.jupyter-widget-slider .ui-slider {\\n border: var(--jp-widgets-slider-border-width) solid var(--jp-layout-color3);\\n background: var(--jp-layout-color3);\\n box-sizing: border-box;\\n position: relative;\\n border-radius: 0px;\\n}\\n.widget-slider .noUi-handle,\\n.jupyter-widget-slider .noUi-handle {\\n width: var(--jp-widgets-slider-handle-size);\\n border: 1px solid #d9d9d9;\\n border-radius: 3px;\\n background: #fff;\\n cursor: default;\\n box-shadow: none;\\n outline: none;\\n}\\n.widget-slider .noUi-target:not([disabled]) .noUi-handle:hover,\\n.jupyter-widget-slider .noUi-target:not([disabled]) .noUi-handle:hover,\\n.widget-slider .noUi-target:not([disabled]) .noUi-handle:focus,\\n.jupyter-widget-slider .noUi-target:not([disabled]) .noUi-handle:focus {\\n background-color: var(--jp-widgets-slider-active-handle-color);\\n border: var(--jp-widgets-slider-border-width) solid var(--jp-widgets-slider-active-handle-color);\\n}\\n.widget-slider [disabled].noUi-target,\\n.jupyter-widget-slider [disabled].noUi-target {\\n opacity: 0.35;\\n}\\n.widget-slider .noUi-connects,\\n.jupyter-widget-slider .noUi-connects {\\n overflow: visible;\\n z-index: 0;\\n background: var(--jp-layout-color3);\\n}\\n.widget-slider .noUi-vertical .noUi-connect,\\n.jupyter-widget-slider .noUi-vertical .noUi-connect {\\n width: calc(100% + 2px);\\n right: -1px;\\n}\\n.widget-slider .noUi-horizontal .noUi-connect,\\n.jupyter-widget-slider .noUi-horizontal .noUi-connect {\\n height: calc(100% + 2px);\\n top: -1px;\\n}\\n\", \"\",{\"version\":3,\"sources\":[\"webpack://./../../node_modules/@jupyter-widgets/controls/css/nouislider.css\"],\"names\":[],\"mappings\":\"AAAA;;;;;;;;;;;;;CAaC;AACD,2CAA2C;AAC3C;;EAEE;;;EAGA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;;EAEA;EACA;;EAEA;EACA;;EAEA;EACA;;EAEA;EACA;;EAEA;EACA,8BAA8B;AAChC;AACA;;;;EAIE,2BAA2B;EAC3B,6CAA6C;EAC7C,yBAAyB;EACzB,sBAAsB;EACtB,kBAAkB;EAClB,qBAAqB;EACrB,sBAAsB;EACtB,iBAAiB;EACjB,2BAA2B;EAC3B,sBAAsB;AACxB;AACA;;EAEE,kBAAkB;AACpB;AACA;;;;EAIE,WAAW;EACX,YAAY;EACZ,kBAAkB;EAClB,UAAU;AACZ;AACA;;EAEE,gBAAgB;EAChB,UAAU;AACZ;AACA;;;;EAIE,sBAAsB;EACtB,kBAAkB;EAClB,UAAU;EACV,MAAM;EACN,QAAQ;EACR,yBAAyB;EACzB,6BAA6B;EAC7B,oCAAoC;EACpC,qBAAqB;EACrB,qBAAqB;AACvB;AACA;;EAEE,YAAY;EACZ,WAAW;AACb;AACA;;EAEE,WAAW;EACX,UAAU;AACZ;AACA;;EAEE,OAAO;EACP,WAAW;AACb;AACA;;EAEE,QAAQ;AACV;AACA;;EAEE,SAAS;AACX;AACA;;EAEE,mCAAmC;EACnC,2BAA2B;EAC3B,kBAAkB;AACpB;AACA;;EAEE,YAAY;EACZ,WAAW;AACb;AACA;;;;EAIE,kCAAkC;EAClC,0BAA0B;AAC5B;AACA;;EAEE,0BAA0B;AAC5B;AACA;;EAEE,YAAY;AACd;AACA;;EAEE,WAAW;EACX,YAAY;EACZ,YAAY;EACZ,SAAS;AACX;AACA;;EAEE,WAAW;AACb;AACA;;EAEE,WAAW;EACX,YAAY;EACZ,WAAW;EACX,UAAU;AACZ;AACA;;EAEE,WAAW;EACX,WAAW;AACb;AACA;;EAEE,mBAAmB;EACnB,kBAAkB;EAClB,yBAAyB;EACzB,wDAAwD;AAC1D;AACA;;EAEE,kBAAkB;AACpB;AACA;;EAEE,mBAAmB;AACrB;AACA;;EAEE,iBAAiB;AACnB;AACA;;EAEE,iBAAiB;AACnB;AACA;;EAEE,yBAAyB;EACzB,kBAAkB;EAClB,gBAAgB;EAChB,eAAe;EACf,4EAA4E;AAC9E;AACA;;EAEE,yEAAyE;AAC3E;AACA;;;;EAIE,WAAW;EACX,cAAc;EACd,kBAAkB;EAClB,YAAY;EACZ,UAAU;EACV,mBAAmB;EACnB,UAAU;EACV,QAAQ;AACV;AACA;;EAEE,UAAU;AACZ;AACA;;;;EAIE,WAAW;EACX,WAAW;EACX,SAAS;EACT,SAAS;AACX;AACA;;EAEE,SAAS;AACX;AACA;;EAEE,mBAAmB;AACrB;AACA;;;;;;EAME,mBAAmB;AACrB;AACA;;;;EAIE,2BAA2B;EAC3B,sBAAsB;AACxB;AACA;;EAEE,kBAAkB;EAClB,WAAW;AACb;AACA;;EAEE,kBAAkB;EAClB,mBAAmB;EACnB,kBAAkB;AACpB;AACA;;EAEE,WAAW;EACX,eAAe;AACjB;AACA;;EAEE,kBAAkB;EAClB,gBAAgB;AAClB;AACA;;EAEE,gBAAgB;AAClB;AACA;;EAEE,gBAAgB;AAClB;AACA;;EAEE,eAAe;EACf,YAAY;EACZ,SAAS;EACT,OAAO;EACP,WAAW;AACb;AACA;;EAEE,uCAAuC;EACvC,+BAA+B;AACjC;AACA;;EAEE,sCAAsC;EACtC,8BAA8B;AAChC;AACA;;EAEE,iBAAiB;EACjB,UAAU;EACV,WAAW;AACb;AACA;;EAEE,YAAY;AACd;AACA;;EAEE,YAAY;AACd;AACA;;EAEE,eAAe;EACf,YAAY;EACZ,MAAM;EACN,UAAU;AACZ;AACA;;EAEE,qCAAqC;EACrC,6BAA6B;EAC7B,kBAAkB;AACpB;AACA;;EAEE,oCAAoC;EACpC,4BAA4B;AAC9B;AACA;;EAEE,UAAU;EACV,WAAW;EACX,gBAAgB;AAClB;AACA;;EAEE,WAAW;AACb;AACA;;EAEE,WAAW;AACb;AACA;;EAEE,cAAc;EACd,kBAAkB;EAClB,yBAAyB;EACzB,kBAAkB;EAClB,gBAAgB;EAChB,WAAW;EACX,YAAY;EACZ,kBAAkB;EAClB,mBAAmB;AACrB;AACA;;EAEE,qCAAqC;EACrC,6BAA6B;EAC7B,SAAS;EACT,YAAY;AACd;AACA;;EAEE,qCAAqC;EACrC,6BAA6B;EAC7B,QAAQ;EACR,WAAW;AACb;AACA;;EAEE,oCAAoC;EACpC,4BAA4B;EAC5B,UAAU;EACV,YAAY;AACd;AACA;;EAEE,sCAAsC;EACtC,8BAA8B;EAC9B,SAAS;EACT,WAAW;AACb;AACA;;EAEE,mBAAmB;AACrB;AACA;;EAEE,gDAAgD;AAClD;AACA;;EAEE,+CAA+C;EAC/C,YAAY;AACd;AACA;;EAEE,2CAA2C;EAC3C,4CAA4C;EAC5C,kBAAkB;EAClB,gGAAgG;EAChG,sDAAsD;AACxD;AACA;;EAEE,4CAA4C;EAC5C,2CAA2C;EAC3C,kBAAkB;EAClB,mGAAmG;EACnG,oDAAoD;AACtD;AACA;;EAEE,aAAa;AACf;AACA;;EAEE,aAAa;AACf;AACA;;EAEE,mBAAmB;EACnB,kBAAkB;EAClB,WAAW;EACX,8DAA8D;AAChE;AACA;;EAEE,2EAA2E;EAC3E,mCAAmC;EACnC,sBAAsB;EACtB,kBAAkB;EAClB,kBAAkB;AACpB;AACA;;EAEE,2CAA2C;EAC3C,yBAAyB;EACzB,kBAAkB;EAClB,gBAAgB;EAChB,eAAe;EACf,gBAAgB;EAChB,aAAa;AACf;AACA;;;;EAIE,8DAA8D;EAC9D,gGAAgG;AAClG;AACA;;EAEE,aAAa;AACf;AACA;;EAEE,iBAAiB;EACjB,UAAU;EACV,mCAAmC;AACrC;AACA;;EAEE,uBAAuB;EACvB,WAAW;AACb;AACA;;EAEE,wBAAwB;EACxB,SAAS;AACX\",\"sourcesContent\":[\"/*\\n\\nThe nouislider.css file is autogenerated from nouislider.less, which imports and wraps the nouislider/src/nouislider.less styles.\\n\\nMIT License\\n\\nCopyright (c) 2019 Léon Gersen\\n\\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \\\"Software\\\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\\n\\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\\n\\nTHE SOFTWARE IS PROVIDED \\\"AS IS\\\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\\n*/\\n/* The .widget-slider class is deprecated */\\n.widget-slider,\\n.jupyter-widget-slider {\\n /* Functional styling;\\n * These styles are required for noUiSlider to function.\\n * You don't need to change these rules to apply your design.\\n */\\n /* Wrapper for all connect elements.\\n */\\n /* Offset direction\\n */\\n /* Give origins 0 height/width so they don't interfere with clicking the\\n * connect elements.\\n */\\n /* Slider size and handle placement;\\n */\\n /* Styling;\\n * Giving the connect element a border radius causes issues with using transform: scale\\n */\\n /* Handles and cursors;\\n */\\n /* Handle stripes;\\n */\\n /* Disabled state;\\n */\\n /* Base;\\n *\\n */\\n /* Values;\\n *\\n */\\n /* Markings;\\n *\\n */\\n /* Horizontal layout;\\n *\\n */\\n /* Vertical layout;\\n *\\n */\\n /* Copyright (c) Jupyter Development Team.\\n * Distributed under the terms of the Modified BSD License.\\n */\\n /* Custom CSS for nouislider */\\n}\\n.widget-slider .noUi-target,\\n.jupyter-widget-slider .noUi-target,\\n.widget-slider .noUi-target *,\\n.jupyter-widget-slider .noUi-target * {\\n -webkit-touch-callout: none;\\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\\n -webkit-user-select: none;\\n -ms-touch-action: none;\\n touch-action: none;\\n -ms-user-select: none;\\n -moz-user-select: none;\\n user-select: none;\\n -moz-box-sizing: border-box;\\n box-sizing: border-box;\\n}\\n.widget-slider .noUi-target,\\n.jupyter-widget-slider .noUi-target {\\n position: relative;\\n}\\n.widget-slider .noUi-base,\\n.jupyter-widget-slider .noUi-base,\\n.widget-slider .noUi-connects,\\n.jupyter-widget-slider .noUi-connects {\\n width: 100%;\\n height: 100%;\\n position: relative;\\n z-index: 1;\\n}\\n.widget-slider .noUi-connects,\\n.jupyter-widget-slider .noUi-connects {\\n overflow: hidden;\\n z-index: 0;\\n}\\n.widget-slider .noUi-connect,\\n.jupyter-widget-slider .noUi-connect,\\n.widget-slider .noUi-origin,\\n.jupyter-widget-slider .noUi-origin {\\n will-change: transform;\\n position: absolute;\\n z-index: 1;\\n top: 0;\\n right: 0;\\n -ms-transform-origin: 0 0;\\n -webkit-transform-origin: 0 0;\\n -webkit-transform-style: preserve-3d;\\n transform-origin: 0 0;\\n transform-style: flat;\\n}\\n.widget-slider .noUi-connect,\\n.jupyter-widget-slider .noUi-connect {\\n height: 100%;\\n width: 100%;\\n}\\n.widget-slider .noUi-origin,\\n.jupyter-widget-slider .noUi-origin {\\n height: 10%;\\n width: 10%;\\n}\\n.widget-slider .noUi-txt-dir-rtl.noUi-horizontal .noUi-origin,\\n.jupyter-widget-slider .noUi-txt-dir-rtl.noUi-horizontal .noUi-origin {\\n left: 0;\\n right: auto;\\n}\\n.widget-slider .noUi-vertical .noUi-origin,\\n.jupyter-widget-slider .noUi-vertical .noUi-origin {\\n width: 0;\\n}\\n.widget-slider .noUi-horizontal .noUi-origin,\\n.jupyter-widget-slider .noUi-horizontal .noUi-origin {\\n height: 0;\\n}\\n.widget-slider .noUi-handle,\\n.jupyter-widget-slider .noUi-handle {\\n -webkit-backface-visibility: hidden;\\n backface-visibility: hidden;\\n position: absolute;\\n}\\n.widget-slider .noUi-touch-area,\\n.jupyter-widget-slider .noUi-touch-area {\\n height: 100%;\\n width: 100%;\\n}\\n.widget-slider .noUi-state-tap .noUi-connect,\\n.jupyter-widget-slider .noUi-state-tap .noUi-connect,\\n.widget-slider .noUi-state-tap .noUi-origin,\\n.jupyter-widget-slider .noUi-state-tap .noUi-origin {\\n -webkit-transition: transform 0.3s;\\n transition: transform 0.3s;\\n}\\n.widget-slider .noUi-state-drag *,\\n.jupyter-widget-slider .noUi-state-drag * {\\n cursor: inherit !important;\\n}\\n.widget-slider .noUi-horizontal,\\n.jupyter-widget-slider .noUi-horizontal {\\n height: 18px;\\n}\\n.widget-slider .noUi-horizontal .noUi-handle,\\n.jupyter-widget-slider .noUi-horizontal .noUi-handle {\\n width: 34px;\\n height: 28px;\\n right: -17px;\\n top: -6px;\\n}\\n.widget-slider .noUi-vertical,\\n.jupyter-widget-slider .noUi-vertical {\\n width: 18px;\\n}\\n.widget-slider .noUi-vertical .noUi-handle,\\n.jupyter-widget-slider .noUi-vertical .noUi-handle {\\n width: 28px;\\n height: 34px;\\n right: -6px;\\n top: -17px;\\n}\\n.widget-slider .noUi-txt-dir-rtl.noUi-horizontal .noUi-handle,\\n.jupyter-widget-slider .noUi-txt-dir-rtl.noUi-horizontal .noUi-handle {\\n left: -17px;\\n right: auto;\\n}\\n.widget-slider .noUi-target,\\n.jupyter-widget-slider .noUi-target {\\n background: #FAFAFA;\\n border-radius: 4px;\\n border: 1px solid #D3D3D3;\\n box-shadow: inset 0 1px 1px #F0F0F0, 0 3px 6px -5px #BBB;\\n}\\n.widget-slider .noUi-connects,\\n.jupyter-widget-slider .noUi-connects {\\n border-radius: 3px;\\n}\\n.widget-slider .noUi-connect,\\n.jupyter-widget-slider .noUi-connect {\\n background: #3FB8AF;\\n}\\n.widget-slider .noUi-draggable,\\n.jupyter-widget-slider .noUi-draggable {\\n cursor: ew-resize;\\n}\\n.widget-slider .noUi-vertical .noUi-draggable,\\n.jupyter-widget-slider .noUi-vertical .noUi-draggable {\\n cursor: ns-resize;\\n}\\n.widget-slider .noUi-handle,\\n.jupyter-widget-slider .noUi-handle {\\n border: 1px solid #D9D9D9;\\n border-radius: 3px;\\n background: #FFF;\\n cursor: default;\\n box-shadow: inset 0 0 1px #FFF, inset 0 1px 7px #EBEBEB, 0 3px 6px -3px #BBB;\\n}\\n.widget-slider .noUi-active,\\n.jupyter-widget-slider .noUi-active {\\n box-shadow: inset 0 0 1px #FFF, inset 0 1px 7px #DDD, 0 3px 6px -3px #BBB;\\n}\\n.widget-slider .noUi-handle:before,\\n.jupyter-widget-slider .noUi-handle:before,\\n.widget-slider .noUi-handle:after,\\n.jupyter-widget-slider .noUi-handle:after {\\n content: \\\"\\\";\\n display: block;\\n position: absolute;\\n height: 14px;\\n width: 1px;\\n background: #E8E7E6;\\n left: 14px;\\n top: 6px;\\n}\\n.widget-slider .noUi-handle:after,\\n.jupyter-widget-slider .noUi-handle:after {\\n left: 17px;\\n}\\n.widget-slider .noUi-vertical .noUi-handle:before,\\n.jupyter-widget-slider .noUi-vertical .noUi-handle:before,\\n.widget-slider .noUi-vertical .noUi-handle:after,\\n.jupyter-widget-slider .noUi-vertical .noUi-handle:after {\\n width: 14px;\\n height: 1px;\\n left: 6px;\\n top: 14px;\\n}\\n.widget-slider .noUi-vertical .noUi-handle:after,\\n.jupyter-widget-slider .noUi-vertical .noUi-handle:after {\\n top: 17px;\\n}\\n.widget-slider [disabled] .noUi-connect,\\n.jupyter-widget-slider [disabled] .noUi-connect {\\n background: #B8B8B8;\\n}\\n.widget-slider [disabled].noUi-target,\\n.jupyter-widget-slider [disabled].noUi-target,\\n.widget-slider [disabled].noUi-handle,\\n.jupyter-widget-slider [disabled].noUi-handle,\\n.widget-slider [disabled] .noUi-handle,\\n.jupyter-widget-slider [disabled] .noUi-handle {\\n cursor: not-allowed;\\n}\\n.widget-slider .noUi-pips,\\n.jupyter-widget-slider .noUi-pips,\\n.widget-slider .noUi-pips *,\\n.jupyter-widget-slider .noUi-pips * {\\n -moz-box-sizing: border-box;\\n box-sizing: border-box;\\n}\\n.widget-slider .noUi-pips,\\n.jupyter-widget-slider .noUi-pips {\\n position: absolute;\\n color: #999;\\n}\\n.widget-slider .noUi-value,\\n.jupyter-widget-slider .noUi-value {\\n position: absolute;\\n white-space: nowrap;\\n text-align: center;\\n}\\n.widget-slider .noUi-value-sub,\\n.jupyter-widget-slider .noUi-value-sub {\\n color: #ccc;\\n font-size: 10px;\\n}\\n.widget-slider .noUi-marker,\\n.jupyter-widget-slider .noUi-marker {\\n position: absolute;\\n background: #CCC;\\n}\\n.widget-slider .noUi-marker-sub,\\n.jupyter-widget-slider .noUi-marker-sub {\\n background: #AAA;\\n}\\n.widget-slider .noUi-marker-large,\\n.jupyter-widget-slider .noUi-marker-large {\\n background: #AAA;\\n}\\n.widget-slider .noUi-pips-horizontal,\\n.jupyter-widget-slider .noUi-pips-horizontal {\\n padding: 10px 0;\\n height: 80px;\\n top: 100%;\\n left: 0;\\n width: 100%;\\n}\\n.widget-slider .noUi-value-horizontal,\\n.jupyter-widget-slider .noUi-value-horizontal {\\n -webkit-transform: translate(-50%, 50%);\\n transform: translate(-50%, 50%);\\n}\\n.noUi-rtl .widget-slider .noUi-value-horizontal,\\n.noUi-rtl .jupyter-widget-slider .noUi-value-horizontal {\\n -webkit-transform: translate(50%, 50%);\\n transform: translate(50%, 50%);\\n}\\n.widget-slider .noUi-marker-horizontal.noUi-marker,\\n.jupyter-widget-slider .noUi-marker-horizontal.noUi-marker {\\n margin-left: -1px;\\n width: 2px;\\n height: 5px;\\n}\\n.widget-slider .noUi-marker-horizontal.noUi-marker-sub,\\n.jupyter-widget-slider .noUi-marker-horizontal.noUi-marker-sub {\\n height: 10px;\\n}\\n.widget-slider .noUi-marker-horizontal.noUi-marker-large,\\n.jupyter-widget-slider .noUi-marker-horizontal.noUi-marker-large {\\n height: 15px;\\n}\\n.widget-slider .noUi-pips-vertical,\\n.jupyter-widget-slider .noUi-pips-vertical {\\n padding: 0 10px;\\n height: 100%;\\n top: 0;\\n left: 100%;\\n}\\n.widget-slider .noUi-value-vertical,\\n.jupyter-widget-slider .noUi-value-vertical {\\n -webkit-transform: translate(0, -50%);\\n transform: translate(0, -50%);\\n padding-left: 25px;\\n}\\n.noUi-rtl .widget-slider .noUi-value-vertical,\\n.noUi-rtl .jupyter-widget-slider .noUi-value-vertical {\\n -webkit-transform: translate(0, 50%);\\n transform: translate(0, 50%);\\n}\\n.widget-slider .noUi-marker-vertical.noUi-marker,\\n.jupyter-widget-slider .noUi-marker-vertical.noUi-marker {\\n width: 5px;\\n height: 2px;\\n margin-top: -1px;\\n}\\n.widget-slider .noUi-marker-vertical.noUi-marker-sub,\\n.jupyter-widget-slider .noUi-marker-vertical.noUi-marker-sub {\\n width: 10px;\\n}\\n.widget-slider .noUi-marker-vertical.noUi-marker-large,\\n.jupyter-widget-slider .noUi-marker-vertical.noUi-marker-large {\\n width: 15px;\\n}\\n.widget-slider .noUi-tooltip,\\n.jupyter-widget-slider .noUi-tooltip {\\n display: block;\\n position: absolute;\\n border: 1px solid #D9D9D9;\\n border-radius: 3px;\\n background: #fff;\\n color: #000;\\n padding: 5px;\\n text-align: center;\\n white-space: nowrap;\\n}\\n.widget-slider .noUi-horizontal .noUi-tooltip,\\n.jupyter-widget-slider .noUi-horizontal .noUi-tooltip {\\n -webkit-transform: translate(-50%, 0);\\n transform: translate(-50%, 0);\\n left: 50%;\\n bottom: 120%;\\n}\\n.widget-slider .noUi-vertical .noUi-tooltip,\\n.jupyter-widget-slider .noUi-vertical .noUi-tooltip {\\n -webkit-transform: translate(0, -50%);\\n transform: translate(0, -50%);\\n top: 50%;\\n right: 120%;\\n}\\n.widget-slider .noUi-horizontal .noUi-origin > .noUi-tooltip,\\n.jupyter-widget-slider .noUi-horizontal .noUi-origin > .noUi-tooltip {\\n -webkit-transform: translate(50%, 0);\\n transform: translate(50%, 0);\\n left: auto;\\n bottom: 10px;\\n}\\n.widget-slider .noUi-vertical .noUi-origin > .noUi-tooltip,\\n.jupyter-widget-slider .noUi-vertical .noUi-origin > .noUi-tooltip {\\n -webkit-transform: translate(0, -18px);\\n transform: translate(0, -18px);\\n top: auto;\\n right: 28px;\\n}\\n.widget-slider .noUi-connect,\\n.jupyter-widget-slider .noUi-connect {\\n background: #2196f3;\\n}\\n.widget-slider .noUi-horizontal,\\n.jupyter-widget-slider .noUi-horizontal {\\n height: var(--jp-widgets-slider-track-thickness);\\n}\\n.widget-slider .noUi-vertical,\\n.jupyter-widget-slider .noUi-vertical {\\n width: var(--jp-widgets-slider-track-thickness);\\n height: 100%;\\n}\\n.widget-slider .noUi-horizontal .noUi-handle,\\n.jupyter-widget-slider .noUi-horizontal .noUi-handle {\\n width: var(--jp-widgets-slider-handle-size);\\n height: var(--jp-widgets-slider-handle-size);\\n border-radius: 50%;\\n top: calc((var(--jp-widgets-slider-track-thickness) - var(--jp-widgets-slider-handle-size)) / 2);\\n right: calc(var(--jp-widgets-slider-handle-size) / -2);\\n}\\n.widget-slider .noUi-vertical .noUi-handle,\\n.jupyter-widget-slider .noUi-vertical .noUi-handle {\\n height: var(--jp-widgets-slider-handle-size);\\n width: var(--jp-widgets-slider-handle-size);\\n border-radius: 50%;\\n right: calc((var(--jp-widgets-slider-handle-size) - var(--jp-widgets-slider-track-thickness)) / -2);\\n top: calc(var(--jp-widgets-slider-handle-size) / -2);\\n}\\n.widget-slider .noUi-handle:after,\\n.jupyter-widget-slider .noUi-handle:after {\\n content: none;\\n}\\n.widget-slider .noUi-handle:before,\\n.jupyter-widget-slider .noUi-handle:before {\\n content: none;\\n}\\n.widget-slider .noUi-target,\\n.jupyter-widget-slider .noUi-target {\\n background: #fafafa;\\n border-radius: 4px;\\n border: 1px;\\n /* box-shadow: inset 0 1px 1px #F0F0F0, 0 3px 6px -5px #BBB; */\\n}\\n.widget-slider .ui-slider,\\n.jupyter-widget-slider .ui-slider {\\n border: var(--jp-widgets-slider-border-width) solid var(--jp-layout-color3);\\n background: var(--jp-layout-color3);\\n box-sizing: border-box;\\n position: relative;\\n border-radius: 0px;\\n}\\n.widget-slider .noUi-handle,\\n.jupyter-widget-slider .noUi-handle {\\n width: var(--jp-widgets-slider-handle-size);\\n border: 1px solid #d9d9d9;\\n border-radius: 3px;\\n background: #fff;\\n cursor: default;\\n box-shadow: none;\\n outline: none;\\n}\\n.widget-slider .noUi-target:not([disabled]) .noUi-handle:hover,\\n.jupyter-widget-slider .noUi-target:not([disabled]) .noUi-handle:hover,\\n.widget-slider .noUi-target:not([disabled]) .noUi-handle:focus,\\n.jupyter-widget-slider .noUi-target:not([disabled]) .noUi-handle:focus {\\n background-color: var(--jp-widgets-slider-active-handle-color);\\n border: var(--jp-widgets-slider-border-width) solid var(--jp-widgets-slider-active-handle-color);\\n}\\n.widget-slider [disabled].noUi-target,\\n.jupyter-widget-slider [disabled].noUi-target {\\n opacity: 0.35;\\n}\\n.widget-slider .noUi-connects,\\n.jupyter-widget-slider .noUi-connects {\\n overflow: visible;\\n z-index: 0;\\n background: var(--jp-layout-color3);\\n}\\n.widget-slider .noUi-vertical .noUi-connect,\\n.jupyter-widget-slider .noUi-vertical .noUi-connect {\\n width: calc(100% + 2px);\\n right: -1px;\\n}\\n.widget-slider .noUi-horizontal .noUi-connect,\\n.jupyter-widget-slider .noUi-horizontal .noUi-connect {\\n height: calc(100% + 2px);\\n top: -1px;\\n}\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../../packages/thebe/node_modules/css-loader/dist/runtime/cssWithMappingToString.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../packages/thebe/node_modules/css-loader/dist/runtime/api.js\";\nimport ___CSS_LOADER_AT_RULE_IMPORT_0___ from \"-!../../../../packages/thebe/node_modules/css-loader/dist/cjs.js!./lumino.css\";\nimport ___CSS_LOADER_AT_RULE_IMPORT_1___ from \"-!../../../../packages/thebe/node_modules/css-loader/dist/cjs.js!./nouislider.css\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n___CSS_LOADER_EXPORT___.i(___CSS_LOADER_AT_RULE_IMPORT_0___);\n___CSS_LOADER_EXPORT___.i(___CSS_LOADER_AT_RULE_IMPORT_1___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/* Copyright (c) Jupyter Development Team.\\n * Distributed under the terms of the Modified BSD License.\\n */\\n\\n/*\\n * We assume that the CSS variables in\\n * https://github.com/jupyterlab/jupyterlab/blob/master/src/default-theme/variables.css\\n * have been defined.\\n */\\n\\n:root {\\n --jp-widgets-color: var(--jp-content-font-color1);\\n --jp-widgets-label-color: var(--jp-widgets-color);\\n --jp-widgets-readout-color: var(--jp-widgets-color);\\n --jp-widgets-font-size: var(--jp-ui-font-size1);\\n --jp-widgets-margin: 2px;\\n --jp-widgets-inline-height: 28px;\\n --jp-widgets-inline-width: 300px;\\n --jp-widgets-inline-width-short: calc(\\n var(--jp-widgets-inline-width) / 2 - var(--jp-widgets-margin)\\n );\\n --jp-widgets-inline-width-tiny: calc(\\n var(--jp-widgets-inline-width-short) / 2 - var(--jp-widgets-margin)\\n );\\n --jp-widgets-inline-margin: 4px; /* margin between inline elements */\\n --jp-widgets-inline-label-width: 80px;\\n --jp-widgets-border-width: var(--jp-border-width);\\n --jp-widgets-vertical-height: 200px;\\n --jp-widgets-horizontal-tab-height: 24px;\\n --jp-widgets-horizontal-tab-width: 144px;\\n --jp-widgets-horizontal-tab-top-border: 2px;\\n --jp-widgets-progress-thickness: 20px;\\n --jp-widgets-container-padding: 15px;\\n --jp-widgets-input-padding: 4px;\\n --jp-widgets-radio-item-height-adjustment: 8px;\\n --jp-widgets-radio-item-height: calc(\\n var(--jp-widgets-inline-height) -\\n var(--jp-widgets-radio-item-height-adjustment)\\n );\\n --jp-widgets-slider-track-thickness: 4px;\\n --jp-widgets-slider-border-width: var(--jp-widgets-border-width);\\n --jp-widgets-slider-handle-size: 16px;\\n --jp-widgets-slider-handle-border-color: var(--jp-border-color1);\\n --jp-widgets-slider-handle-background-color: var(--jp-layout-color1);\\n --jp-widgets-slider-active-handle-color: var(--jp-brand-color1);\\n --jp-widgets-menu-item-height: 24px;\\n --jp-widgets-dropdown-arrow: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxOCAxOCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTggMTg7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDpub25lO30KPC9zdHlsZT4KPHBhdGggZD0iTTUuMiw1LjlMOSw5LjdsMy44LTMuOGwxLjIsMS4ybC00LjksNWwtNC45LTVMNS4yLDUuOXoiLz4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTAtMC42aDE4djE4SDBWLTAuNnoiLz4KPC9zdmc+Cg');\\n --jp-widgets-input-color: var(--jp-ui-font-color1);\\n --jp-widgets-input-background-color: var(--jp-layout-color1);\\n --jp-widgets-input-border-color: var(--jp-border-color1);\\n --jp-widgets-input-focus-border-color: var(--jp-brand-color2);\\n --jp-widgets-input-border-width: var(--jp-widgets-border-width);\\n --jp-widgets-disabled-opacity: 0.6;\\n\\n /* From Material Design Lite */\\n --md-shadow-key-umbra-opacity: 0.2;\\n --md-shadow-key-penumbra-opacity: 0.14;\\n --md-shadow-ambient-shadow-opacity: 0.12;\\n}\\n\\n.jupyter-widgets {\\n margin: var(--jp-widgets-margin);\\n box-sizing: border-box;\\n color: var(--jp-widgets-color);\\n overflow: visible;\\n}\\n\\n.jp-Output-result > .jupyter-widgets {\\n margin-left: 0;\\n margin-right: 0;\\n}\\n\\n/* vbox and hbox */\\n\\n/* */\\n.widget-inline-hbox, /* */\\n .jupyter-widget-inline-hbox {\\n /* Horizontal widgets */\\n box-sizing: border-box;\\n display: flex;\\n flex-direction: row;\\n align-items: baseline;\\n}\\n\\n/* */\\n.widget-inline-vbox, /* */\\n .jupyter-widget-inline-vbox {\\n /* Vertical Widgets */\\n box-sizing: border-box;\\n display: flex;\\n flex-direction: column;\\n align-items: center;\\n}\\n\\n/* */\\n.widget-box, /* */\\n.jupyter-widget-box {\\n box-sizing: border-box;\\n display: flex;\\n margin: 0;\\n overflow: auto;\\n}\\n\\n/* */\\n.widget-gridbox, /* */\\n.jupyter-widget-gridbox {\\n box-sizing: border-box;\\n display: grid;\\n margin: 0;\\n overflow: auto;\\n}\\n\\n/* */\\n.widget-hbox, /* */\\n.jupyter-widget-hbox {\\n flex-direction: row;\\n}\\n\\n/* */\\n.widget-vbox, /* */\\n.jupyter-widget-vbox {\\n flex-direction: column;\\n}\\n\\n/* General Tags Styling */\\n\\n.jupyter-widget-tagsinput {\\n display: flex;\\n flex-direction: row;\\n flex-wrap: wrap;\\n align-items: center;\\n overflow: auto;\\n\\n cursor: text;\\n}\\n\\n.jupyter-widget-tag {\\n padding-left: 10px;\\n padding-right: 10px;\\n padding-top: 0px;\\n padding-bottom: 0px;\\n display: inline-block;\\n white-space: nowrap;\\n overflow: hidden;\\n text-overflow: ellipsis;\\n text-align: center;\\n font-size: var(--jp-widgets-font-size);\\n\\n height: calc(var(--jp-widgets-inline-height) - 2px);\\n border: 0px solid;\\n line-height: calc(var(--jp-widgets-inline-height) - 2px);\\n box-shadow: none;\\n\\n color: var(--jp-ui-font-color1);\\n background-color: var(--jp-layout-color2);\\n border-color: var(--jp-border-color2);\\n border: none;\\n user-select: none;\\n\\n cursor: grab;\\n transition: margin-left 200ms;\\n margin: 1px 1px 1px 1px;\\n}\\n\\n.jupyter-widget-tag.mod-active {\\n /* MD Lite 4dp shadow */\\n box-shadow: 0 4px 5px 0 rgba(0, 0, 0, var(--md-shadow-key-penumbra-opacity)),\\n 0 1px 10px 0 rgba(0, 0, 0, var(--md-shadow-ambient-shadow-opacity)),\\n 0 2px 4px -1px rgba(0, 0, 0, var(--md-shadow-key-umbra-opacity));\\n color: var(--jp-ui-font-color1);\\n background-color: var(--jp-layout-color3);\\n}\\n\\n.jupyter-widget-colortag {\\n color: var(--jp-inverse-ui-font-color1);\\n}\\n\\n.jupyter-widget-colortag.mod-active {\\n color: var(--jp-inverse-ui-font-color0);\\n}\\n\\n.jupyter-widget-taginput {\\n color: var(--jp-ui-font-color0);\\n background-color: var(--jp-layout-color0);\\n\\n cursor: text;\\n text-align: left;\\n}\\n\\n.jupyter-widget-taginput:focus {\\n outline: none;\\n}\\n\\n.jupyter-widget-tag-close {\\n margin-left: var(--jp-widgets-inline-margin);\\n padding: 2px 0px 2px 2px;\\n}\\n\\n.jupyter-widget-tag-close:hover {\\n cursor: pointer;\\n}\\n\\n/* Tag \\\"Primary\\\" Styling */\\n\\n.jupyter-widget-tag.mod-primary {\\n color: var(--jp-inverse-ui-font-color1);\\n background-color: var(--jp-brand-color1);\\n}\\n\\n.jupyter-widget-tag.mod-primary.mod-active {\\n color: var(--jp-inverse-ui-font-color0);\\n background-color: var(--jp-brand-color0);\\n}\\n\\n/* Tag \\\"Success\\\" Styling */\\n\\n.jupyter-widget-tag.mod-success {\\n color: var(--jp-inverse-ui-font-color1);\\n background-color: var(--jp-success-color1);\\n}\\n\\n.jupyter-widget-tag.mod-success.mod-active {\\n color: var(--jp-inverse-ui-font-color0);\\n background-color: var(--jp-success-color0);\\n}\\n\\n/* Tag \\\"Info\\\" Styling */\\n\\n.jupyter-widget-tag.mod-info {\\n color: var(--jp-inverse-ui-font-color1);\\n background-color: var(--jp-info-color1);\\n}\\n\\n.jupyter-widget-tag.mod-info.mod-active {\\n color: var(--jp-inverse-ui-font-color0);\\n background-color: var(--jp-info-color0);\\n}\\n\\n/* Tag \\\"Warning\\\" Styling */\\n\\n.jupyter-widget-tag.mod-warning {\\n color: var(--jp-inverse-ui-font-color1);\\n background-color: var(--jp-warn-color1);\\n}\\n\\n.jupyter-widget-tag.mod-warning.mod-active {\\n color: var(--jp-inverse-ui-font-color0);\\n background-color: var(--jp-warn-color0);\\n}\\n\\n/* Tag \\\"Danger\\\" Styling */\\n\\n.jupyter-widget-tag.mod-danger {\\n color: var(--jp-inverse-ui-font-color1);\\n background-color: var(--jp-error-color1);\\n}\\n\\n.jupyter-widget-tag.mod-danger.mod-active {\\n color: var(--jp-inverse-ui-font-color0);\\n background-color: var(--jp-error-color0);\\n}\\n\\n/* General Button Styling */\\n\\n.jupyter-button {\\n padding-left: 10px;\\n padding-right: 10px;\\n padding-top: 0px;\\n padding-bottom: 0px;\\n display: inline-block;\\n white-space: nowrap;\\n overflow: hidden;\\n text-overflow: ellipsis;\\n text-align: center;\\n font-size: var(--jp-widgets-font-size);\\n cursor: pointer;\\n\\n height: var(--jp-widgets-inline-height);\\n border: 0px solid;\\n line-height: var(--jp-widgets-inline-height);\\n box-shadow: none;\\n\\n color: var(--jp-ui-font-color1);\\n background-color: var(--jp-layout-color2);\\n border-color: var(--jp-border-color2);\\n border: none;\\n user-select: none;\\n}\\n\\n.jupyter-button i.fa {\\n margin-right: var(--jp-widgets-inline-margin);\\n pointer-events: none;\\n}\\n\\n.jupyter-button:empty:before {\\n content: '\\\\200b'; /* zero-width space */\\n}\\n\\n.jupyter-widgets.jupyter-button:disabled {\\n opacity: var(--jp-widgets-disabled-opacity);\\n}\\n\\n.jupyter-button i.fa.center {\\n margin-right: 0;\\n}\\n\\n.jupyter-button:hover:enabled,\\n.jupyter-button:focus:enabled {\\n /* MD Lite 2dp shadow */\\n box-shadow: 0 2px 2px 0 rgba(0, 0, 0, var(--md-shadow-key-penumbra-opacity)),\\n 0 3px 1px -2px rgba(0, 0, 0, var(--md-shadow-key-umbra-opacity)),\\n 0 1px 5px 0 rgba(0, 0, 0, var(--md-shadow-ambient-shadow-opacity));\\n}\\n\\n.jupyter-button:active,\\n.jupyter-button.mod-active {\\n /* MD Lite 4dp shadow */\\n box-shadow: 0 4px 5px 0 rgba(0, 0, 0, var(--md-shadow-key-penumbra-opacity)),\\n 0 1px 10px 0 rgba(0, 0, 0, var(--md-shadow-ambient-shadow-opacity)),\\n 0 2px 4px -1px rgba(0, 0, 0, var(--md-shadow-key-umbra-opacity));\\n color: var(--jp-ui-font-color1);\\n background-color: var(--jp-layout-color3);\\n}\\n\\n.jupyter-button:focus:enabled {\\n outline: 1px solid var(--jp-widgets-input-focus-border-color);\\n}\\n\\n/* Button \\\"Primary\\\" Styling */\\n\\n.jupyter-button.mod-primary {\\n color: var(--jp-ui-inverse-font-color1);\\n background-color: var(--jp-brand-color1);\\n}\\n\\n.jupyter-button.mod-primary.mod-active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-brand-color0);\\n}\\n\\n.jupyter-button.mod-primary:active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-brand-color0);\\n}\\n\\n/* Button \\\"Success\\\" Styling */\\n\\n.jupyter-button.mod-success {\\n color: var(--jp-ui-inverse-font-color1);\\n background-color: var(--jp-success-color1);\\n}\\n\\n.jupyter-button.mod-success.mod-active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-success-color0);\\n}\\n\\n.jupyter-button.mod-success:active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-success-color0);\\n}\\n\\n/* Button \\\"Info\\\" Styling */\\n\\n.jupyter-button.mod-info {\\n color: var(--jp-ui-inverse-font-color1);\\n background-color: var(--jp-info-color1);\\n}\\n\\n.jupyter-button.mod-info.mod-active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-info-color0);\\n}\\n\\n.jupyter-button.mod-info:active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-info-color0);\\n}\\n\\n/* Button \\\"Warning\\\" Styling */\\n\\n.jupyter-button.mod-warning {\\n color: var(--jp-ui-inverse-font-color1);\\n background-color: var(--jp-warn-color1);\\n}\\n\\n.jupyter-button.mod-warning.mod-active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-warn-color0);\\n}\\n\\n.jupyter-button.mod-warning:active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-warn-color0);\\n}\\n\\n/* Button \\\"Danger\\\" Styling */\\n\\n.jupyter-button.mod-danger {\\n color: var(--jp-ui-inverse-font-color1);\\n background-color: var(--jp-error-color1);\\n}\\n\\n.jupyter-button.mod-danger.mod-active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-error-color0);\\n}\\n\\n.jupyter-button.mod-danger:active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-error-color0);\\n}\\n\\n/* Widget Button, Widget Toggle Button, Widget Upload */\\n\\n/* */\\n.widget-button, /* */\\n/* */ .widget-toggle-button, /* */\\n/* */ .widget-upload, /* */\\n.jupyter-widget-button,\\n.jupyter-widget-toggle-button,\\n.jupyter-widget-upload {\\n width: var(--jp-widgets-inline-width-short);\\n}\\n\\n/* Widget Label Styling */\\n\\n/* Override Bootstrap label css */\\n.jupyter-widgets label {\\n margin-bottom: initial;\\n}\\n\\n/* */\\n.widget-label-basic, /* */\\n.jupyter-widget-label-basic {\\n /* Basic Label */\\n color: var(--jp-widgets-label-color);\\n font-size: var(--jp-widgets-font-size);\\n overflow: hidden;\\n text-overflow: ellipsis;\\n white-space: nowrap;\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-label, /* */\\n.jupyter-widget-label {\\n /* Label */\\n color: var(--jp-widgets-label-color);\\n font-size: var(--jp-widgets-font-size);\\n overflow: hidden;\\n text-overflow: ellipsis;\\n white-space: nowrap;\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-inline-hbox .widget-label, /* */\\n.jupyter-widget-inline-hbox .jupyter-widget-label {\\n /* Horizontal Widget Label */\\n color: var(--jp-widgets-label-color);\\n text-align: right;\\n margin-right: calc(var(--jp-widgets-inline-margin) * 2);\\n width: var(--jp-widgets-inline-label-width);\\n flex-shrink: 0;\\n}\\n\\n/* */\\n.widget-inline-vbox .widget-label, /* */\\n.jupyter-widget-inline-vbox .jupyter-widget-label {\\n /* Vertical Widget Label */\\n color: var(--jp-widgets-label-color);\\n text-align: center;\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* Widget Readout Styling */\\n\\n/* */\\n.widget-readout, /* */\\n.jupyter-widget-readout {\\n color: var(--jp-widgets-readout-color);\\n font-size: var(--jp-widgets-font-size);\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n overflow: hidden;\\n white-space: nowrap;\\n text-align: center;\\n}\\n\\n/* */\\n.widget-readout.overflow, /* */\\n.jupyter-widget-readout.overflow {\\n /* Overflowing Readout */\\n\\n /* From Material Design Lite\\n shadow-key-umbra-opacity: 0.2;\\n shadow-key-penumbra-opacity: 0.14;\\n shadow-ambient-shadow-opacity: 0.12;\\n */\\n -webkit-box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2),\\n 0 3px 1px -2px rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);\\n\\n -moz-box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2),\\n 0 3px 1px -2px rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);\\n\\n box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2), 0 3px 1px -2px rgba(0, 0, 0, 0.14),\\n 0 1px 5px 0 rgba(0, 0, 0, 0.12);\\n}\\n\\n/* */\\n.widget-inline-hbox .widget-readout, /* */\\n.jupyter-widget-inline-hbox .jupyter-widget-readout {\\n /* Horizontal Readout */\\n text-align: center;\\n max-width: var(--jp-widgets-inline-width-short);\\n min-width: var(--jp-widgets-inline-width-tiny);\\n margin-left: var(--jp-widgets-inline-margin);\\n}\\n\\n/* */\\n.widget-inline-vbox .widget-readout, /* */\\n.jupyter-widget-inline-vbox .jupyter-widget-readout {\\n /* Vertical Readout */\\n margin-top: var(--jp-widgets-inline-margin);\\n /* as wide as the widget */\\n width: inherit;\\n}\\n\\n/* Widget Checkbox Styling */\\n\\n/* */\\n.widget-checkbox, /* */\\n.jupyter-widget-checkbox {\\n width: var(--jp-widgets-inline-width);\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-checkbox input[type='checkbox'], /* */\\n.jupyter-widget-checkbox input[type='checkbox'] {\\n margin: 0px calc(var(--jp-widgets-inline-margin) * 2) 0px 0px;\\n line-height: var(--jp-widgets-inline-height);\\n font-size: large;\\n flex-grow: 1;\\n flex-shrink: 0;\\n align-self: center;\\n}\\n\\n/* Widget Valid Styling */\\n\\n/* */\\n.widget-valid, /* */\\n.jupyter-widget-valid {\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n width: var(--jp-widgets-inline-width-short);\\n font-size: var(--jp-widgets-font-size);\\n}\\n\\n/* */\\n.widget-valid i, /* */\\n.jupyter-widget-valid i {\\n line-height: var(--jp-widgets-inline-height);\\n margin-right: var(--jp-widgets-inline-margin);\\n margin-left: var(--jp-widgets-inline-margin);\\n}\\n\\n/* */\\n.widget-valid.mod-valid i, /* */\\n.jupyter-widget-valid.mod-valid i {\\n color: green;\\n}\\n\\n/* */\\n.widget-valid.mod-invalid i, /* */\\n.jupyter-widget-valid.mod-invalid i {\\n color: red;\\n}\\n\\n/* */\\n.widget-valid.mod-valid .widget-valid-readout, /* */\\n.jupyter-widget-valid.mod-valid .jupyter-widget-valid-readout {\\n display: none;\\n}\\n\\n/* Widget Text and TextArea Styling */\\n\\n/* */\\n.widget-textarea, /* */\\n/* */ .widget-text, /* */\\n.jupyter-widget-textarea,\\n.jupyter-widget-text {\\n width: var(--jp-widgets-inline-width);\\n}\\n\\n/* */\\n.widget-text input[type='text'], /* */\\n/* */ .widget-text input[type='number'], /* */\\n/* */ .widget-text input[type='password'], /* */\\n.jupyter-widget-text input[type='text'],\\n.jupyter-widget-text input[type='number'],\\n.jupyter-widget-text input[type='password'] {\\n height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-text input[type='text']:disabled, /* */\\n/* */ .widget-text input[type='number']:disabled, /* */\\n/* */ .widget-text input[type='password']:disabled, /* */\\n/* */ .widget-textarea textarea:disabled, /* */\\n.jupyter-widget-text input[type='text']:disabled,\\n.jupyter-widget-text input[type='number']:disabled,\\n.jupyter-widget-text input[type='password']:disabled,\\n.jupyter-widget-textarea textarea:disabled {\\n opacity: var(--jp-widgets-disabled-opacity);\\n}\\n\\n/* */\\n.widget-text input[type='text'], /* */\\n/* */ .widget-text input[type='number'], /* */\\n/* */ .widget-text input[type='password'], /* */\\n/* */ .widget-textarea textarea, /* */\\n.jupyter-widget-text input[type='text'],\\n.jupyter-widget-text input[type='number'],\\n.jupyter-widget-text input[type='password'],\\n.jupyter-widget-textarea textarea {\\n box-sizing: border-box;\\n border: var(--jp-widgets-input-border-width) solid\\n var(--jp-widgets-input-border-color);\\n background-color: var(--jp-widgets-input-background-color);\\n color: var(--jp-widgets-input-color);\\n font-size: var(--jp-widgets-font-size);\\n flex-grow: 1;\\n min-width: 0; /* This makes it possible for the flexbox to shrink this input */\\n flex-shrink: 1;\\n outline: none !important;\\n}\\n\\n/* */\\n.widget-text input[type='text'], /* */\\n/* */ .widget-text input[type='password'], /* */\\n/* */ .widget-textarea textarea, /* */\\n.jupyter-widget-text input[type='text'],\\n.jupyter-widget-text input[type='password'],\\n.jupyter-widget-textarea textarea {\\n padding: var(--jp-widgets-input-padding)\\n calc(var(--jp-widgets-input-padding) * 2);\\n}\\n\\n/* */\\n.widget-text input[type='number'], /* */\\n.jupyter-widget-text input[type='number'] {\\n padding: var(--jp-widgets-input-padding) 0 var(--jp-widgets-input-padding)\\n calc(var(--jp-widgets-input-padding) * 2);\\n}\\n\\n/* */\\n.widget-textarea textarea, /* */\\n.jupyter-widget-textarea textarea {\\n height: inherit;\\n width: inherit;\\n}\\n\\n/* */\\n.widget-text input:focus, /* */\\n/* */ .widget-textarea textarea:focus, /* */\\n.jupyter-widget-text input:focus,\\n.jupyter-widget-textarea textarea:focus {\\n border-color: var(--jp-widgets-input-focus-border-color);\\n}\\n\\n/* Horizontal Slider */\\n/* */\\n.widget-hslider, /* */\\n.jupyter-widget-hslider {\\n width: var(--jp-widgets-inline-width);\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n\\n /* Override the align-items baseline. This way, the description and readout\\n still seem to align their baseline properly, and we don't have to have\\n align-self: stretch in the .slider-container. */\\n align-items: center;\\n}\\n\\n/* */\\n.widgets-slider .slider-container, /* */\\n.jupyter-widgets-slider .slider-container {\\n overflow: visible;\\n}\\n\\n/* */\\n.widget-hslider .slider-container, /* */\\n.jupyter-widget-hslider .slider-container {\\n margin-left: calc(\\n var(--jp-widgets-slider-handle-size) / 2 - 2 *\\n var(--jp-widgets-slider-border-width)\\n );\\n margin-right: calc(\\n var(--jp-widgets-slider-handle-size) / 2 - 2 *\\n var(--jp-widgets-slider-border-width)\\n );\\n flex: 1 1 var(--jp-widgets-inline-width-short);\\n}\\n\\n/* Vertical Slider */\\n\\n/* */\\n.widget-vbox .widget-label, /* */\\n.jupyter-widget-vbox .jupyter-widget-label {\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-vslider, /* */\\n.jupyter-widget-vslider {\\n /* Vertical Slider */\\n height: var(--jp-widgets-vertical-height);\\n width: var(--jp-widgets-inline-width-tiny);\\n}\\n\\n/* */\\n.widget-vslider .slider-container, /* */\\n.jupyter-widget-vslider .slider-container {\\n flex: 1 1 var(--jp-widgets-inline-width-short);\\n margin-left: auto;\\n margin-right: auto;\\n margin-bottom: calc(\\n var(--jp-widgets-slider-handle-size) / 2 - 2 *\\n var(--jp-widgets-slider-border-width)\\n );\\n margin-top: calc(\\n var(--jp-widgets-slider-handle-size) / 2 - 2 *\\n var(--jp-widgets-slider-border-width)\\n );\\n display: flex;\\n flex-direction: column;\\n}\\n\\n/* Widget Progress Styling */\\n\\n.progress-bar {\\n -webkit-transition: none;\\n -moz-transition: none;\\n -ms-transition: none;\\n -o-transition: none;\\n transition: none;\\n}\\n\\n.progress-bar {\\n height: var(--jp-widgets-inline-height);\\n}\\n\\n.progress-bar {\\n background-color: var(--jp-brand-color1);\\n}\\n\\n.progress-bar-success {\\n background-color: var(--jp-success-color1);\\n}\\n\\n.progress-bar-info {\\n background-color: var(--jp-info-color1);\\n}\\n\\n.progress-bar-warning {\\n background-color: var(--jp-warn-color1);\\n}\\n\\n.progress-bar-danger {\\n background-color: var(--jp-error-color1);\\n}\\n\\n.progress {\\n background-color: var(--jp-layout-color2);\\n border: none;\\n box-shadow: none;\\n}\\n\\n/* Horisontal Progress */\\n\\n/* */\\n.widget-hprogress, /* */\\n.jupyter-widget-hprogress {\\n /* Progress Bar */\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n width: var(--jp-widgets-inline-width);\\n align-items: center;\\n}\\n\\n/* */\\n.widget-hprogress .progress, /* */\\n.jupyter-widget-hprogress .progress {\\n flex-grow: 1;\\n margin-top: var(--jp-widgets-input-padding);\\n margin-bottom: var(--jp-widgets-input-padding);\\n align-self: stretch;\\n /* Override bootstrap style */\\n height: initial;\\n}\\n\\n/* Vertical Progress */\\n\\n/* */\\n.widget-vprogress, /* */\\n.jupyter-widget-vprogress {\\n height: var(--jp-widgets-vertical-height);\\n width: var(--jp-widgets-inline-width-tiny);\\n}\\n\\n/* */\\n.widget-vprogress .progress, /* */\\n.jupyter-widget-vprogress .progress {\\n flex-grow: 1;\\n width: var(--jp-widgets-progress-thickness);\\n margin-left: auto;\\n margin-right: auto;\\n margin-bottom: 0;\\n}\\n\\n/* Select Widget Styling */\\n\\n/* */\\n.widget-dropdown, /* */\\n.jupyter-widget-dropdown {\\n height: var(--jp-widgets-inline-height);\\n width: var(--jp-widgets-inline-width);\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-dropdown > select, /* */\\n.jupyter-widget-dropdown > select {\\n padding-right: 20px;\\n border: var(--jp-widgets-input-border-width) solid\\n var(--jp-widgets-input-border-color);\\n border-radius: 0;\\n height: inherit;\\n flex: 1 1 var(--jp-widgets-inline-width-short);\\n min-width: 0; /* This makes it possible for the flexbox to shrink this input */\\n box-sizing: border-box;\\n outline: none !important;\\n box-shadow: none;\\n background-color: var(--jp-widgets-input-background-color);\\n color: var(--jp-widgets-input-color);\\n font-size: var(--jp-widgets-font-size);\\n vertical-align: top;\\n padding-left: calc(var(--jp-widgets-input-padding) * 2);\\n appearance: none;\\n -webkit-appearance: none;\\n -moz-appearance: none;\\n background-repeat: no-repeat;\\n background-size: 20px;\\n background-position: right center;\\n background-image: var(--jp-widgets-dropdown-arrow);\\n}\\n/* */\\n.widget-dropdown > select:focus, /* */\\n.jupyter-widget-dropdown > select:focus {\\n border-color: var(--jp-widgets-input-focus-border-color);\\n}\\n\\n/* */\\n.widget-dropdown > select:disabled, /* */\\n.jupyter-widget-dropdown > select:disabled {\\n opacity: var(--jp-widgets-disabled-opacity);\\n}\\n\\n/* To disable the dotted border in Firefox around select controls.\\n See http://stackoverflow.com/a/18853002 */\\n/* */\\n.widget-dropdown > select:-moz-focusring, /* */\\n.jupyter-widget-dropdown > select:-moz-focusring {\\n color: transparent;\\n text-shadow: 0 0 0 #000;\\n}\\n\\n/* Select and SelectMultiple */\\n\\n/* */\\n.widget-select, /* */\\n.jupyter-widget-select {\\n width: var(--jp-widgets-inline-width);\\n line-height: var(--jp-widgets-inline-height);\\n\\n /* Because Firefox defines the baseline of a select as the bottom of the\\n control, we align the entire control to the top and add padding to the\\n select to get an approximate first line baseline alignment. */\\n align-items: flex-start;\\n}\\n\\n/* */\\n.widget-select > select, /* */\\n.jupyter-widget-select > select {\\n border: var(--jp-widgets-input-border-width) solid\\n var(--jp-widgets-input-border-color);\\n background-color: var(--jp-widgets-input-background-color);\\n color: var(--jp-widgets-input-color);\\n font-size: var(--jp-widgets-font-size);\\n flex: 1 1 var(--jp-widgets-inline-width-short);\\n outline: none !important;\\n overflow: auto;\\n height: inherit;\\n\\n /* Because Firefox defines the baseline of a select as the bottom of the\\n control, we align the entire control to the top and add padding to the\\n select to get an approximate first line baseline alignment. */\\n padding-top: 5px;\\n}\\n\\n/* */\\n.widget-select > select:focus, /* */\\n.jupyter-widget-select > select:focus {\\n border-color: var(--jp-widgets-input-focus-border-color);\\n}\\n\\n.wiget-select > select > option,\\n.jupyter-wiget-select > select > option {\\n padding-left: var(--jp-widgets-input-padding);\\n line-height: var(--jp-widgets-inline-height);\\n /* line-height doesn't work on some browsers for select options */\\n padding-top: calc(\\n var(--jp-widgets-inline-height) - var(--jp-widgets-font-size) / 2\\n );\\n padding-bottom: calc(\\n var(--jp-widgets-inline-height) - var(--jp-widgets-font-size) / 2\\n );\\n}\\n\\n/* Toggle Buttons Styling */\\n\\n/* */\\n.widget-toggle-buttons, /* */\\n.jupyter-widget-toggle-buttons {\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-toggle-buttons .widget-toggle-button, /* */\\n.jupyter-widget-toggle-buttons .jupyter-widget-toggle-button {\\n margin-left: var(--jp-widgets-margin);\\n margin-right: var(--jp-widgets-margin);\\n}\\n\\n/* */\\n.widget-toggle-buttons .jupyter-button:disabled, /* */\\n.jupyter-widget-toggle-buttons .jupyter-button:disabled {\\n opacity: var(--jp-widgets-disabled-opacity);\\n}\\n\\n/* Radio Buttons Styling */\\n\\n/* */\\n.widget-radio, /* */\\n.jupyter-widget-radio {\\n width: var(--jp-widgets-inline-width);\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-radio-box, /* */\\n.jupyter-widget-radio-box {\\n display: flex;\\n flex-direction: column;\\n align-items: stretch;\\n box-sizing: border-box;\\n flex-grow: 1;\\n margin-bottom: var(--jp-widgets-radio-item-height-adjustment);\\n}\\n\\n/* */\\n.widget-radio-box-vertical, /* */\\n.jupyter-widget-radio-box-vertical {\\n flex-direction: column;\\n}\\n\\n/* */\\n.widget-radio-box-horizontal, /* */\\n.jupyter-widget-radio-box-horizontal {\\n flex-direction: row;\\n}\\n\\n/* */\\n.widget-radio-box label, /* */\\n.jupyter-widget-radio-box label {\\n height: var(--jp-widgets-radio-item-height);\\n line-height: var(--jp-widgets-radio-item-height);\\n font-size: var(--jp-widgets-font-size);\\n}\\n\\n.widget-radio-box-horizontal label,\\n.jupyter-widget-radio-box-horizontal label {\\n margin: 0 calc(var(--jp-widgets-input-padding) * 2) 0 0;\\n}\\n\\n/* */\\n.widget-radio-box input, /* */\\n.jupyter-widget-radio-box input {\\n height: var(--jp-widgets-radio-item-height);\\n line-height: var(--jp-widgets-radio-item-height);\\n margin: 0 calc(var(--jp-widgets-input-padding) * 2) 0 1px;\\n float: left;\\n}\\n\\n/* Color Picker Styling */\\n\\n/* */\\n.widget-colorpicker, /* */\\n.jupyter-widget-colorpicker {\\n width: var(--jp-widgets-inline-width);\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-colorpicker > .widget-colorpicker-input, /* */\\n.jupyter-widget-colorpicker > .jupyter-widget-colorpicker-input {\\n flex-grow: 1;\\n flex-shrink: 1;\\n min-width: var(--jp-widgets-inline-width-tiny);\\n}\\n\\n/* */\\n.widget-colorpicker input[type='color'], /* */\\n.jupyter-widget-colorpicker input[type='color'] {\\n width: var(--jp-widgets-inline-height);\\n height: var(--jp-widgets-inline-height);\\n padding: 0 2px; /* make the color square actually square on Chrome on OS X */\\n background: var(--jp-widgets-input-background-color);\\n color: var(--jp-widgets-input-color);\\n border: var(--jp-widgets-input-border-width) solid\\n var(--jp-widgets-input-border-color);\\n border-left: none;\\n flex-grow: 0;\\n flex-shrink: 0;\\n box-sizing: border-box;\\n align-self: stretch;\\n outline: none !important;\\n}\\n\\n/* */\\n.widget-colorpicker.concise input[type='color'], /* */\\n.jupyter-widget-colorpicker.concise input[type='color'] {\\n border-left: var(--jp-widgets-input-border-width) solid\\n var(--jp-widgets-input-border-color);\\n}\\n\\n/* */\\n.widget-colorpicker input[type='color']:focus, /* */\\n/* */ .widget-colorpicker input[type='text']:focus, /* */\\n.jupyter-widget-colorpicker input[type='color']:focus,\\n.jupyter-widget-colorpicker input[type='text']:focus {\\n border-color: var(--jp-widgets-input-focus-border-color);\\n}\\n\\n/* */\\n.widget-colorpicker input[type='text'], /* */\\n.jupyter-widget-colorpicker input[type='text'] {\\n flex-grow: 1;\\n outline: none !important;\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n background: var(--jp-widgets-input-background-color);\\n color: var(--jp-widgets-input-color);\\n border: var(--jp-widgets-input-border-width) solid\\n var(--jp-widgets-input-border-color);\\n font-size: var(--jp-widgets-font-size);\\n padding: var(--jp-widgets-input-padding)\\n calc(var(--jp-widgets-input-padding) * 2);\\n min-width: 0; /* This makes it possible for the flexbox to shrink this input */\\n flex-shrink: 1;\\n box-sizing: border-box;\\n}\\n\\n/* */\\n.widget-colorpicker input[type='text']:disabled, /* */\\n.jupyter-widget-colorpicker input[type='text']:disabled {\\n opacity: var(--jp-widgets-disabled-opacity);\\n}\\n\\n/* Date Picker Styling */\\n\\n/* */\\n.widget-datepicker, /* */\\n.jupyter-widget-datepicker {\\n width: var(--jp-widgets-inline-width);\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-datepicker input[type='date'], /* */\\n.jupyter-widget-datepicker input[type='date'] {\\n flex-grow: 1;\\n flex-shrink: 1;\\n min-width: 0; /* This makes it possible for the flexbox to shrink this input */\\n outline: none !important;\\n height: var(--jp-widgets-inline-height);\\n border: var(--jp-widgets-input-border-width) solid\\n var(--jp-widgets-input-border-color);\\n background-color: var(--jp-widgets-input-background-color);\\n color: var(--jp-widgets-input-color);\\n font-size: var(--jp-widgets-font-size);\\n padding: var(--jp-widgets-input-padding)\\n calc(var(--jp-widgets-input-padding) * 2);\\n box-sizing: border-box;\\n}\\n\\n/* */\\n.widget-datepicker input[type='date']:focus, /* */\\n.jupyter-widget-datepicker input[type='date']:focus {\\n border-color: var(--jp-widgets-input-focus-border-color);\\n}\\n\\n/* */\\n.widget-datepicker input[type='date']:invalid, /* */\\n.jupyter-widget-datepicker input[type='date']:invalid {\\n border-color: var(--jp-warn-color1);\\n}\\n\\n/* */\\n.widget-datepicker input[type='date']:disabled, /* */\\n.jupyter-widget-datepicker input[type='date']:disabled {\\n opacity: var(--jp-widgets-disabled-opacity);\\n}\\n\\n/* Play Widget */\\n\\n/* */\\n.widget-play, /* */\\n.jupyter-widget-play {\\n width: var(--jp-widgets-inline-width-short);\\n display: flex;\\n align-items: stretch;\\n}\\n\\n/* */\\n.widget-play .jupyter-button, /* */\\n.jupyter-widget-play .jupyter-button {\\n flex-grow: 1;\\n height: auto;\\n}\\n\\n/* */\\n.widget-play .jupyter-button:disabled, /* */\\n.jupyter-widget-play .jupyter-button:disabled {\\n opacity: var(--jp-widgets-disabled-opacity);\\n}\\n\\n/* Tab Widget */\\n\\n/* */\\n.jupyter-widgets.widget-tab, /* */\\n.jupyter-widgets.jupyter-widget-tab {\\n display: flex;\\n flex-direction: column;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar {\\n /* Necessary so that a tab can be shifted down to overlay the border of the box below. */\\n overflow-x: visible;\\n overflow-y: visible;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar > .p-TabBar-content, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar > .p-TabBar-content, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar > .lm-TabBar-content {\\n /* Make sure that the tab grows from bottom up */\\n align-items: flex-end;\\n min-width: 0;\\n min-height: 0;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .widget-tab-contents, /* */\\n.jupyter-widgets.jupyter-widget-tab > .widget-tab-contents {\\n width: 100%;\\n box-sizing: border-box;\\n margin: 0;\\n background: var(--jp-layout-color1);\\n color: var(--jp-ui-font-color1);\\n border: var(--jp-border-width) solid var(--jp-border-color1);\\n padding: var(--jp-widgets-container-padding);\\n flex-grow: 1;\\n overflow: auto;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar {\\n font: var(--jp-widgets-font-size) Helvetica, Arial, sans-serif;\\n min-height: calc(\\n var(--jp-widgets-horizontal-tab-height) + var(--jp-border-width)\\n );\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tab, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tab {\\n flex: 0 1 var(--jp-widgets-horizontal-tab-width);\\n min-width: 35px;\\n min-height: calc(\\n var(--jp-widgets-horizontal-tab-height) + var(--jp-border-width)\\n );\\n line-height: var(--jp-widgets-horizontal-tab-height);\\n margin-left: calc(-1 * var(--jp-border-width));\\n padding: 0px 10px;\\n background: var(--jp-layout-color2);\\n color: var(--jp-ui-font-color2);\\n border: var(--jp-border-width) solid var(--jp-border-color1);\\n border-bottom: none;\\n position: relative;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab.p-mod-current, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tab.p-mod-current, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tab.lm-mod-current {\\n color: var(--jp-ui-font-color0);\\n /* We want the background to match the tab content background */\\n background: var(--jp-layout-color1);\\n min-height: calc(\\n var(--jp-widgets-horizontal-tab-height) + 2 * var(--jp-border-width)\\n );\\n transform: translateY(var(--jp-border-width));\\n overflow: visible;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab.p-mod-current:before, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tab.p-mod-current:before, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tab.lm-mod-current:before {\\n position: absolute;\\n top: calc(-1 * var(--jp-border-width));\\n left: calc(-1 * var(--jp-border-width));\\n content: '';\\n height: var(--jp-widgets-horizontal-tab-top-border);\\n width: calc(100% + 2 * var(--jp-border-width));\\n background: var(--jp-brand-color1);\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab:first-child, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tab:first-child, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tab:first-child {\\n margin-left: 0;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar\\n .p-TabBar-tab:hover:not(.p-mod-current),\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .p-TabBar\\n .p-TabBar-tab:hover:not(.p-mod-current),\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar\\n .lm-TabBar-tab:hover:not(.lm-mod-current) {\\n background: var(--jp-layout-color1);\\n color: var(--jp-ui-font-color1);\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar\\n .p-mod-closable\\n > .p-TabBar-tabCloseIcon,\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n> .p-TabBar\\n.p-mod-closable\\n> .p-TabBar-tabCloseIcon,\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar\\n .lm-mod-closable\\n > .lm-TabBar-tabCloseIcon {\\n margin-left: 4px;\\n}\\n\\n/* This font-awesome strategy may not work across FA4 and FA5, but we don't\\nactually support closable tabs, so it really doesn't matter */\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar\\n .p-mod-closable\\n > .p-TabBar-tabCloseIcon:before,\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-widget-tab\\n> .p-TabBar\\n.p-mod-closable\\n> .p-TabBar-tabCloseIcon:before,\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar\\n .lm-mod-closable\\n > .lm-TabBar-tabCloseIcon:before {\\n font-family: FontAwesome;\\n content: '\\\\f00d'; /* close */\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabIcon, /* */\\n/* */ .jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabLabel, /* */\\n/* */ .jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabCloseIcon, /* */\\n/* */ .jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tabIcon, /* */\\n/* */ .jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tabLabel, /* */\\n/* */ .jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tabCloseIcon, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tabIcon,\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tabLabel,\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tabCloseIcon {\\n line-height: var(--jp-widgets-horizontal-tab-height);\\n}\\n\\n/* Accordion Widget */\\n\\n.jupyter-widget-Collapse {\\n display: flex;\\n flex-direction: column;\\n align-items: stretch;\\n}\\n\\n.jupyter-widget-Collapse-header {\\n padding: var(--jp-widgets-input-padding);\\n cursor: pointer;\\n color: var(--jp-ui-font-color2);\\n background-color: var(--jp-layout-color2);\\n border: var(--jp-widgets-border-width) solid var(--jp-border-color1);\\n padding: calc(var(--jp-widgets-container-padding) * 2 / 3)\\n var(--jp-widgets-container-padding);\\n font-weight: bold;\\n}\\n\\n.jupyter-widget-Collapse-header:hover {\\n background-color: var(--jp-layout-color1);\\n color: var(--jp-ui-font-color1);\\n}\\n\\n.jupyter-widget-Collapse-open > .jupyter-widget-Collapse-header {\\n background-color: var(--jp-layout-color1);\\n color: var(--jp-ui-font-color0);\\n cursor: default;\\n border-bottom: none;\\n}\\n\\n.jupyter-widget-Collapse-contents {\\n padding: var(--jp-widgets-container-padding);\\n background-color: var(--jp-layout-color1);\\n color: var(--jp-ui-font-color1);\\n border-left: var(--jp-widgets-border-width) solid var(--jp-border-color1);\\n border-right: var(--jp-widgets-border-width) solid var(--jp-border-color1);\\n border-bottom: var(--jp-widgets-border-width) solid var(--jp-border-color1);\\n overflow: auto;\\n}\\n\\n.jupyter-widget-Accordion {\\n display: flex;\\n flex-direction: column;\\n align-items: stretch;\\n}\\n\\n.jupyter-widget-Accordion .jupyter-widget-Collapse {\\n margin-bottom: 0;\\n}\\n\\n.jupyter-widget-Accordion .jupyter-widget-Collapse + .jupyter-widget-Collapse {\\n margin-top: 4px;\\n}\\n\\n/* HTML widget */\\n\\n/* */\\n.widget-html, /* */\\n/* */ .widget-htmlmath, /* */\\n.jupyter-widget-html,\\n.jupyter-widget-htmlmath {\\n font-size: var(--jp-widgets-font-size);\\n}\\n\\n/* */\\n.widget-html > .widget-html-content, /* */\\n/* */.widget-htmlmath > .widget-html-content, /* */\\n.jupyter-widget-html > .jupyter-widget-html-content,\\n.jupyter-widget-htmlmath > .jupyter-widget-html-content {\\n /* Fill out the area in the HTML widget */\\n align-self: stretch;\\n flex-grow: 1;\\n flex-shrink: 1;\\n /* Makes sure the baseline is still aligned with other elements */\\n line-height: var(--jp-widgets-inline-height);\\n /* Make it possible to have absolutely-positioned elements in the html */\\n position: relative;\\n}\\n\\n/* Image widget */\\n\\n/* */\\n.widget-image, /* */\\n.jupyter-widget-image {\\n max-width: 100%;\\n height: auto;\\n}\\n\", \"\",{\"version\":3,\"sources\":[\"webpack://./../../node_modules/@jupyter-widgets/controls/css/widgets-base.css\"],\"names\":[],\"mappings\":\"AAAA;;EAEE;;AAEF;;;;EAIE;;AAKF;EACE,iDAAiD;EACjD,iDAAiD;EACjD,mDAAmD;EACnD,+CAA+C;EAC/C,wBAAwB;EACxB,gCAAgC;EAChC,gCAAgC;EAChC;;GAEC;EACD;;GAEC;EACD,+BAA+B,EAAE,mCAAmC;EACpE,qCAAqC;EACrC,iDAAiD;EACjD,mCAAmC;EACnC,wCAAwC;EACxC,wCAAwC;EACxC,2CAA2C;EAC3C,qCAAqC;EACrC,oCAAoC;EACpC,+BAA+B;EAC/B,8CAA8C;EAC9C;;;GAGC;EACD,wCAAwC;EACxC,gEAAgE;EAChE,qCAAqC;EACrC,gEAAgE;EAChE,oEAAoE;EACpE,+DAA+D;EAC/D,mCAAmC;EACnC,4uBAA4uB;EAC5uB,kDAAkD;EAClD,4DAA4D;EAC5D,wDAAwD;EACxD,6DAA6D;EAC7D,+DAA+D;EAC/D,kCAAkC;;EAElC,8BAA8B;EAC9B,kCAAkC;EAClC,sCAAsC;EACtC,wCAAwC;AAC1C;;AAEA;EACE,gCAAgC;EAChC,sBAAsB;EACtB,8BAA8B;EAC9B,iBAAiB;AACnB;;AAEA;EACE,cAAc;EACd,eAAe;AACjB;;AAEA,kBAAkB;;AAElB,iBAAiB;AACjB;;EAEE,uBAAuB;EACvB,sBAAsB;EACtB,aAAa;EACb,mBAAmB;EACnB,qBAAqB;AACvB;;AAEA,iBAAiB;AACjB;;EAEE,qBAAqB;EACrB,sBAAsB;EACtB,aAAa;EACb,sBAAsB;EACtB,mBAAmB;AACrB;;AAEA,iBAAiB;AACjB;;EAEE,sBAAsB;EACtB,aAAa;EACb,SAAS;EACT,cAAc;AAChB;;AAEA,iBAAiB;AACjB;;EAEE,sBAAsB;EACtB,aAAa;EACb,SAAS;EACT,cAAc;AAChB;;AAEA,iBAAiB;AACjB;;EAEE,mBAAmB;AACrB;;AAEA,iBAAiB;AACjB;;EAEE,sBAAsB;AACxB;;AAEA,yBAAyB;;AAEzB;EACE,aAAa;EACb,mBAAmB;EACnB,eAAe;EACf,mBAAmB;EACnB,cAAc;;EAEd,YAAY;AACd;;AAEA;EACE,kBAAkB;EAClB,mBAAmB;EACnB,gBAAgB;EAChB,mBAAmB;EACnB,qBAAqB;EACrB,mBAAmB;EACnB,gBAAgB;EAChB,uBAAuB;EACvB,kBAAkB;EAClB,sCAAsC;;EAEtC,mDAAmD;EACnD,iBAAiB;EACjB,wDAAwD;EACxD,gBAAgB;;EAEhB,+BAA+B;EAC/B,yCAAyC;EACzC,qCAAqC;EACrC,YAAY;EACZ,iBAAiB;;EAEjB,YAAY;EACZ,6BAA6B;EAC7B,uBAAuB;AACzB;;AAEA;EACE,uBAAuB;EACvB;;oEAEkE;EAClE,+BAA+B;EAC/B,yCAAyC;AAC3C;;AAEA;EACE,uCAAuC;AACzC;;AAEA;EACE,uCAAuC;AACzC;;AAEA;EACE,+BAA+B;EAC/B,yCAAyC;;EAEzC,YAAY;EACZ,gBAAgB;AAClB;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,4CAA4C;EAC5C,wBAAwB;AAC1B;;AAEA;EACE,eAAe;AACjB;;AAEA,0BAA0B;;AAE1B;EACE,uCAAuC;EACvC,wCAAwC;AAC1C;;AAEA;EACE,uCAAuC;EACvC,wCAAwC;AAC1C;;AAEA,0BAA0B;;AAE1B;EACE,uCAAuC;EACvC,0CAA0C;AAC5C;;AAEA;EACE,uCAAuC;EACvC,0CAA0C;AAC5C;;AAEA,uBAAuB;;AAEvB;EACE,uCAAuC;EACvC,uCAAuC;AACzC;;AAEA;EACE,uCAAuC;EACvC,uCAAuC;AACzC;;AAEA,0BAA0B;;AAE1B;EACE,uCAAuC;EACvC,uCAAuC;AACzC;;AAEA;EACE,uCAAuC;EACvC,uCAAuC;AACzC;;AAEA,yBAAyB;;AAEzB;EACE,uCAAuC;EACvC,wCAAwC;AAC1C;;AAEA;EACE,uCAAuC;EACvC,wCAAwC;AAC1C;;AAEA,2BAA2B;;AAE3B;EACE,kBAAkB;EAClB,mBAAmB;EACnB,gBAAgB;EAChB,mBAAmB;EACnB,qBAAqB;EACrB,mBAAmB;EACnB,gBAAgB;EAChB,uBAAuB;EACvB,kBAAkB;EAClB,sCAAsC;EACtC,eAAe;;EAEf,uCAAuC;EACvC,iBAAiB;EACjB,4CAA4C;EAC5C,gBAAgB;;EAEhB,+BAA+B;EAC/B,yCAAyC;EACzC,qCAAqC;EACrC,YAAY;EACZ,iBAAiB;AACnB;;AAEA;EACE,6CAA6C;EAC7C,oBAAoB;AACtB;;AAEA;EACE,gBAAgB,EAAE,qBAAqB;AACzC;;AAEA;EACE,2CAA2C;AAC7C;;AAEA;EACE,eAAe;AACjB;;AAEA;;EAEE,uBAAuB;EACvB;;sEAEoE;AACtE;;AAEA;;EAEE,uBAAuB;EACvB;;oEAEkE;EAClE,+BAA+B;EAC/B,yCAAyC;AAC3C;;AAEA;EACE,6DAA6D;AAC/D;;AAEA,6BAA6B;;AAE7B;EACE,uCAAuC;EACvC,wCAAwC;AAC1C;;AAEA;EACE,uCAAuC;EACvC,wCAAwC;AAC1C;;AAEA;EACE,uCAAuC;EACvC,wCAAwC;AAC1C;;AAEA,6BAA6B;;AAE7B;EACE,uCAAuC;EACvC,0CAA0C;AAC5C;;AAEA;EACE,uCAAuC;EACvC,0CAA0C;AAC5C;;AAEA;EACE,uCAAuC;EACvC,0CAA0C;AAC5C;;AAEA,0BAA0B;;AAE1B;EACE,uCAAuC;EACvC,uCAAuC;AACzC;;AAEA;EACE,uCAAuC;EACvC,uCAAuC;AACzC;;AAEA;EACE,uCAAuC;EACvC,uCAAuC;AACzC;;AAEA,6BAA6B;;AAE7B;EACE,uCAAuC;EACvC,uCAAuC;AACzC;;AAEA;EACE,uCAAuC;EACvC,uCAAuC;AACzC;;AAEA;EACE,uCAAuC;EACvC,uCAAuC;AACzC;;AAEA,4BAA4B;;AAE5B;EACE,uCAAuC;EACvC,wCAAwC;AAC1C;;AAEA;EACE,uCAAuC;EACvC,wCAAwC;AAC1C;;AAEA;EACE,uCAAuC;EACvC,wCAAwC;AAC1C;;AAEA,uDAAuD;;AAEvD,iBAAiB;AACjB;;;;;;EAME,2CAA2C;AAC7C;;AAEA,yBAAyB;;AAEzB,iCAAiC;AACjC;EACE,sBAAsB;AACxB;;AAEA,iBAAiB;AACjB;;EAEE,gBAAgB;EAChB,oCAAoC;EACpC,sCAAsC;EACtC,gBAAgB;EAChB,uBAAuB;EACvB,mBAAmB;EACnB,4CAA4C;AAC9C;;AAEA,iBAAiB;AACjB;;EAEE,UAAU;EACV,oCAAoC;EACpC,sCAAsC;EACtC,gBAAgB;EAChB,uBAAuB;EACvB,mBAAmB;EACnB,4CAA4C;AAC9C;;AAEA,iBAAiB;AACjB;;EAEE,4BAA4B;EAC5B,oCAAoC;EACpC,iBAAiB;EACjB,uDAAuD;EACvD,2CAA2C;EAC3C,cAAc;AAChB;;AAEA,iBAAiB;AACjB;;EAEE,0BAA0B;EAC1B,oCAAoC;EACpC,kBAAkB;EAClB,4CAA4C;AAC9C;;AAEA,2BAA2B;;AAE3B,iBAAiB;AACjB;;EAEE,sCAAsC;EACtC,sCAAsC;EACtC,uCAAuC;EACvC,4CAA4C;EAC5C,gBAAgB;EAChB,mBAAmB;EACnB,kBAAkB;AACpB;;AAEA,iBAAiB;AACjB;;EAEE,wBAAwB;;EAExB;;;;MAII;EACJ;uEACqE;;EAErE;uEACqE;;EAErE;mCACiC;AACnC;;AAEA,iBAAiB;AACjB;;EAEE,uBAAuB;EACvB,kBAAkB;EAClB,+CAA+C;EAC/C,8CAA8C;EAC9C,4CAA4C;AAC9C;;AAEA,iBAAiB;AACjB;;EAEE,qBAAqB;EACrB,2CAA2C;EAC3C,0BAA0B;EAC1B,cAAc;AAChB;;AAEA,4BAA4B;;AAE5B,iBAAiB;AACjB;;EAEE,qCAAqC;EACrC,uCAAuC;EACvC,4CAA4C;AAC9C;;AAEA,iBAAiB;AACjB;;EAEE,6DAA6D;EAC7D,4CAA4C;EAC5C,gBAAgB;EAChB,YAAY;EACZ,cAAc;EACd,kBAAkB;AACpB;;AAEA,yBAAyB;;AAEzB,iBAAiB;AACjB;;EAEE,uCAAuC;EACvC,4CAA4C;EAC5C,2CAA2C;EAC3C,sCAAsC;AACxC;;AAEA,iBAAiB;AACjB;;EAEE,4CAA4C;EAC5C,6CAA6C;EAC7C,4CAA4C;AAC9C;;AAEA,iBAAiB;AACjB;;EAEE,YAAY;AACd;;AAEA,iBAAiB;AACjB;;EAEE,UAAU;AACZ;;AAEA,iBAAiB;AACjB;;EAEE,aAAa;AACf;;AAEA,qCAAqC;;AAErC,iBAAiB;AACjB;;;;EAIE,qCAAqC;AACvC;;AAEA,iBAAiB;AACjB;;;;;;EAME,uCAAuC;AACzC;;AAEA,iBAAiB;AACjB;;;;;;;;EAQE,2CAA2C;AAC7C;;AAEA,iBAAiB;AACjB;;;;;;;;EAQE,sBAAsB;EACtB;wCACsC;EACtC,0DAA0D;EAC1D,oCAAoC;EACpC,sCAAsC;EACtC,YAAY;EACZ,YAAY,EAAE,gEAAgE;EAC9E,cAAc;EACd,wBAAwB;AAC1B;;AAEA,iBAAiB;AACjB;;;;;;EAME;6CAC2C;AAC7C;;AAEA,iBAAiB;AACjB;;EAEE;6CAC2C;AAC7C;;AAEA,iBAAiB;AACjB;;EAEE,eAAe;EACf,cAAc;AAChB;;AAEA,iBAAiB;AACjB;;;;EAIE,wDAAwD;AAC1D;;AAEA,sBAAsB;AACtB,iBAAiB;AACjB;;EAEE,qCAAqC;EACrC,uCAAuC;EACvC,4CAA4C;;EAE5C;;mDAEiD;EACjD,mBAAmB;AACrB;;AAEA,iBAAiB;AACjB;;EAEE,iBAAiB;AACnB;;AAEA,iBAAiB;AACjB;;EAEE;;;GAGC;EACD;;;GAGC;EACD,8CAA8C;AAChD;;AAEA,oBAAoB;;AAEpB,iBAAiB;AACjB;;EAEE,uCAAuC;EACvC,4CAA4C;AAC9C;;AAEA,iBAAiB;AACjB;;EAEE,oBAAoB;EACpB,yCAAyC;EACzC,0CAA0C;AAC5C;;AAEA,iBAAiB;AACjB;;EAEE,8CAA8C;EAC9C,iBAAiB;EACjB,kBAAkB;EAClB;;;GAGC;EACD;;;GAGC;EACD,aAAa;EACb,sBAAsB;AACxB;;AAEA,4BAA4B;;AAE5B;EACE,wBAAwB;EACxB,qBAAqB;EACrB,oBAAoB;EACpB,mBAAmB;EACnB,gBAAgB;AAClB;;AAEA;EACE,uCAAuC;AACzC;;AAEA;EACE,wCAAwC;AAC1C;;AAEA;EACE,0CAA0C;AAC5C;;AAEA;EACE,uCAAuC;AACzC;;AAEA;EACE,uCAAuC;AACzC;;AAEA;EACE,wCAAwC;AAC1C;;AAEA;EACE,yCAAyC;EACzC,YAAY;EACZ,gBAAgB;AAClB;;AAEA,wBAAwB;;AAExB,iBAAiB;AACjB;;EAEE,iBAAiB;EACjB,uCAAuC;EACvC,4CAA4C;EAC5C,qCAAqC;EACrC,mBAAmB;AACrB;;AAEA,iBAAiB;AACjB;;EAEE,YAAY;EACZ,2CAA2C;EAC3C,8CAA8C;EAC9C,mBAAmB;EACnB,6BAA6B;EAC7B,eAAe;AACjB;;AAEA,sBAAsB;;AAEtB,iBAAiB;AACjB;;EAEE,yCAAyC;EACzC,0CAA0C;AAC5C;;AAEA,iBAAiB;AACjB;;EAEE,YAAY;EACZ,2CAA2C;EAC3C,iBAAiB;EACjB,kBAAkB;EAClB,gBAAgB;AAClB;;AAEA,0BAA0B;;AAE1B,iBAAiB;AACjB;;EAEE,uCAAuC;EACvC,qCAAqC;EACrC,4CAA4C;AAC9C;;AAEA,iBAAiB;AACjB;;EAEE,mBAAmB;EACnB;wCACsC;EACtC,gBAAgB;EAChB,eAAe;EACf,8CAA8C;EAC9C,YAAY,EAAE,gEAAgE;EAC9E,sBAAsB;EACtB,wBAAwB;EACxB,gBAAgB;EAChB,0DAA0D;EAC1D,oCAAoC;EACpC,sCAAsC;EACtC,mBAAmB;EACnB,uDAAuD;EACvD,gBAAgB;EAChB,wBAAwB;EACxB,qBAAqB;EACrB,4BAA4B;EAC5B,qBAAqB;EACrB,iCAAiC;EACjC,kDAAkD;AACpD;AACA,iBAAiB;AACjB;;EAEE,wDAAwD;AAC1D;;AAEA,iBAAiB;AACjB;;EAEE,2CAA2C;AAC7C;;AAEA;4CAC4C;AAC5C,iBAAiB;AACjB;;EAEE,kBAAkB;EAClB,uBAAuB;AACzB;;AAEA,8BAA8B;;AAE9B,iBAAiB;AACjB;;EAEE,qCAAqC;EACrC,4CAA4C;;EAE5C;;iEAE+D;EAC/D,uBAAuB;AACzB;;AAEA,iBAAiB;AACjB;;EAEE;wCACsC;EACtC,0DAA0D;EAC1D,oCAAoC;EACpC,sCAAsC;EACtC,8CAA8C;EAC9C,wBAAwB;EACxB,cAAc;EACd,eAAe;;EAEf;;iEAE+D;EAC/D,gBAAgB;AAClB;;AAEA,iBAAiB;AACjB;;EAEE,wDAAwD;AAC1D;;AAEA;;EAEE,6CAA6C;EAC7C,4CAA4C;EAC5C,iEAAiE;EACjE;;GAEC;EACD;;GAEC;AACH;;AAEA,2BAA2B;;AAE3B,iBAAiB;AACjB;;EAEE,4CAA4C;AAC9C;;AAEA,iBAAiB;AACjB;;EAEE,qCAAqC;EACrC,sCAAsC;AACxC;;AAEA,iBAAiB;AACjB;;EAEE,2CAA2C;AAC7C;;AAEA,0BAA0B;;AAE1B,iBAAiB;AACjB;;EAEE,qCAAqC;EACrC,4CAA4C;AAC9C;;AAEA,iBAAiB;AACjB;;EAEE,aAAa;EACb,sBAAsB;EACtB,oBAAoB;EACpB,sBAAsB;EACtB,YAAY;EACZ,6DAA6D;AAC/D;;AAEA,iBAAiB;AACjB;;EAEE,sBAAsB;AACxB;;AAEA,iBAAiB;AACjB;;EAEE,mBAAmB;AACrB;;AAEA,iBAAiB;AACjB;;EAEE,2CAA2C;EAC3C,gDAAgD;EAChD,sCAAsC;AACxC;;AAEA;;EAEE,uDAAuD;AACzD;;AAEA,iBAAiB;AACjB;;EAEE,2CAA2C;EAC3C,gDAAgD;EAChD,yDAAyD;EACzD,WAAW;AACb;;AAEA,yBAAyB;;AAEzB,iBAAiB;AACjB;;EAEE,qCAAqC;EACrC,uCAAuC;EACvC,4CAA4C;AAC9C;;AAEA,iBAAiB;AACjB;;EAEE,YAAY;EACZ,cAAc;EACd,8CAA8C;AAChD;;AAEA,iBAAiB;AACjB;;EAEE,sCAAsC;EACtC,uCAAuC;EACvC,cAAc,EAAE,4DAA4D;EAC5E,oDAAoD;EACpD,oCAAoC;EACpC;wCACsC;EACtC,iBAAiB;EACjB,YAAY;EACZ,cAAc;EACd,sBAAsB;EACtB,mBAAmB;EACnB,wBAAwB;AAC1B;;AAEA,iBAAiB;AACjB;;EAEE;wCACsC;AACxC;;AAEA,iBAAiB;AACjB;;;;EAIE,wDAAwD;AAC1D;;AAEA,iBAAiB;AACjB;;EAEE,YAAY;EACZ,wBAAwB;EACxB,uCAAuC;EACvC,4CAA4C;EAC5C,oDAAoD;EACpD,oCAAoC;EACpC;wCACsC;EACtC,sCAAsC;EACtC;6CAC2C;EAC3C,YAAY,EAAE,gEAAgE;EAC9E,cAAc;EACd,sBAAsB;AACxB;;AAEA,iBAAiB;AACjB;;EAEE,2CAA2C;AAC7C;;AAEA,wBAAwB;;AAExB,iBAAiB;AACjB;;EAEE,qCAAqC;EACrC,uCAAuC;EACvC,4CAA4C;AAC9C;;AAEA,iBAAiB;AACjB;;EAEE,YAAY;EACZ,cAAc;EACd,YAAY,EAAE,gEAAgE;EAC9E,wBAAwB;EACxB,uCAAuC;EACvC;wCACsC;EACtC,0DAA0D;EAC1D,oCAAoC;EACpC,sCAAsC;EACtC;6CAC2C;EAC3C,sBAAsB;AACxB;;AAEA,iBAAiB;AACjB;;EAEE,wDAAwD;AAC1D;;AAEA,iBAAiB;AACjB;;EAEE,mCAAmC;AACrC;;AAEA,iBAAiB;AACjB;;EAEE,2CAA2C;AAC7C;;AAEA,gBAAgB;;AAEhB,iBAAiB;AACjB;;EAEE,2CAA2C;EAC3C,aAAa;EACb,oBAAoB;AACtB;;AAEA,iBAAiB;AACjB;;EAEE,YAAY;EACZ,YAAY;AACd;;AAEA,iBAAiB;AACjB;;EAEE,2CAA2C;AAC7C;;AAEA,eAAe;;AAEf,iBAAiB;AACjB;;EAEE,aAAa;EACb,sBAAsB;AACxB;;AAEA,iBAAiB;AACjB;;;EAGE,wFAAwF;EACxF,mBAAmB;EACnB,mBAAmB;AACrB;;AAEA,iBAAiB;AACjB;;;EAGE,gDAAgD;EAChD,qBAAqB;EACrB,YAAY;EACZ,aAAa;AACf;;AAEA,iBAAiB;AACjB;;EAEE,WAAW;EACX,sBAAsB;EACtB,SAAS;EACT,mCAAmC;EACnC,+BAA+B;EAC/B,4DAA4D;EAC5D,4CAA4C;EAC5C,YAAY;EACZ,cAAc;AAChB;;AAEA,iBAAiB;AACjB;;;EAGE,8DAA8D;EAC9D;;GAEC;AACH;;AAEA,iBAAiB;AACjB;;;EAGE,gDAAgD;EAChD,eAAe;EACf;;GAEC;EACD,oDAAoD;EACpD,8CAA8C;EAC9C,iBAAiB;EACjB,mCAAmC;EACnC,+BAA+B;EAC/B,4DAA4D;EAC5D,mBAAmB;EACnB,kBAAkB;AACpB;;AAEA,iBAAiB;AACjB;;;EAGE,+BAA+B;EAC/B,+DAA+D;EAC/D,mCAAmC;EACnC;;GAEC;EACD,6CAA6C;EAC7C,iBAAiB;AACnB;;AAEA,iBAAiB;AACjB;;;EAGE,kBAAkB;EAClB,sCAAsC;EACtC,uCAAuC;EACvC,WAAW;EACX,mDAAmD;EACnD,8CAA8C;EAC9C,kCAAkC;AACpC;;AAEA,iBAAiB;AACjB;;;EAGE,cAAc;AAChB;;AAEA,iBAAiB;AACjB;;;;;;;;;;;;EAYE,mCAAmC;EACnC,+BAA+B;AACjC;;AAEA,iBAAiB;AACjB;;;;;;;;;;;;;;;EAeE,gBAAgB;AAClB;;AAEA;6DAC6D;AAC7D,iBAAiB;AACjB;;;;;;;;;;;;;;;EAeE,wBAAwB;EACxB,gBAAgB,EAAE,UAAU;AAC9B;;AAEA,iBAAiB;AACjB;;;;;;;;;EASE,oDAAoD;AACtD;;AAEA,qBAAqB;;AAErB;EACE,aAAa;EACb,sBAAsB;EACtB,oBAAoB;AACtB;;AAEA;EACE,wCAAwC;EACxC,eAAe;EACf,+BAA+B;EAC/B,yCAAyC;EACzC,oEAAoE;EACpE;uCACqC;EACrC,iBAAiB;AACnB;;AAEA;EACE,yCAAyC;EACzC,+BAA+B;AACjC;;AAEA;EACE,yCAAyC;EACzC,+BAA+B;EAC/B,eAAe;EACf,mBAAmB;AACrB;;AAEA;EACE,4CAA4C;EAC5C,yCAAyC;EACzC,+BAA+B;EAC/B,yEAAyE;EACzE,0EAA0E;EAC1E,2EAA2E;EAC3E,cAAc;AAChB;;AAEA;EACE,aAAa;EACb,sBAAsB;EACtB,oBAAoB;AACtB;;AAEA;EACE,gBAAgB;AAClB;;AAEA;EACE,eAAe;AACjB;;AAEA,gBAAgB;;AAEhB,iBAAiB;AACjB;;;;EAIE,sCAAsC;AACxC;;AAEA,iBAAiB;AACjB;;;;EAIE,yCAAyC;EACzC,mBAAmB;EACnB,YAAY;EACZ,cAAc;EACd,iEAAiE;EACjE,4CAA4C;EAC5C,wEAAwE;EACxE,kBAAkB;AACpB;;AAEA,kBAAkB;;AAElB,iBAAiB;AACjB;;EAEE,eAAe;EACf,YAAY;AACd\",\"sourcesContent\":[\"/* Copyright (c) Jupyter Development Team.\\n * Distributed under the terms of the Modified BSD License.\\n */\\n\\n/*\\n * We assume that the CSS variables in\\n * https://github.com/jupyterlab/jupyterlab/blob/master/src/default-theme/variables.css\\n * have been defined.\\n */\\n\\n@import './lumino.css';\\n@import './nouislider.css';\\n\\n:root {\\n --jp-widgets-color: var(--jp-content-font-color1);\\n --jp-widgets-label-color: var(--jp-widgets-color);\\n --jp-widgets-readout-color: var(--jp-widgets-color);\\n --jp-widgets-font-size: var(--jp-ui-font-size1);\\n --jp-widgets-margin: 2px;\\n --jp-widgets-inline-height: 28px;\\n --jp-widgets-inline-width: 300px;\\n --jp-widgets-inline-width-short: calc(\\n var(--jp-widgets-inline-width) / 2 - var(--jp-widgets-margin)\\n );\\n --jp-widgets-inline-width-tiny: calc(\\n var(--jp-widgets-inline-width-short) / 2 - var(--jp-widgets-margin)\\n );\\n --jp-widgets-inline-margin: 4px; /* margin between inline elements */\\n --jp-widgets-inline-label-width: 80px;\\n --jp-widgets-border-width: var(--jp-border-width);\\n --jp-widgets-vertical-height: 200px;\\n --jp-widgets-horizontal-tab-height: 24px;\\n --jp-widgets-horizontal-tab-width: 144px;\\n --jp-widgets-horizontal-tab-top-border: 2px;\\n --jp-widgets-progress-thickness: 20px;\\n --jp-widgets-container-padding: 15px;\\n --jp-widgets-input-padding: 4px;\\n --jp-widgets-radio-item-height-adjustment: 8px;\\n --jp-widgets-radio-item-height: calc(\\n var(--jp-widgets-inline-height) -\\n var(--jp-widgets-radio-item-height-adjustment)\\n );\\n --jp-widgets-slider-track-thickness: 4px;\\n --jp-widgets-slider-border-width: var(--jp-widgets-border-width);\\n --jp-widgets-slider-handle-size: 16px;\\n --jp-widgets-slider-handle-border-color: var(--jp-border-color1);\\n --jp-widgets-slider-handle-background-color: var(--jp-layout-color1);\\n --jp-widgets-slider-active-handle-color: var(--jp-brand-color1);\\n --jp-widgets-menu-item-height: 24px;\\n --jp-widgets-dropdown-arrow: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxOCAxOCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTggMTg7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDpub25lO30KPC9zdHlsZT4KPHBhdGggZD0iTTUuMiw1LjlMOSw5LjdsMy44LTMuOGwxLjIsMS4ybC00LjksNWwtNC45LTVMNS4yLDUuOXoiLz4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTAtMC42aDE4djE4SDBWLTAuNnoiLz4KPC9zdmc+Cg');\\n --jp-widgets-input-color: var(--jp-ui-font-color1);\\n --jp-widgets-input-background-color: var(--jp-layout-color1);\\n --jp-widgets-input-border-color: var(--jp-border-color1);\\n --jp-widgets-input-focus-border-color: var(--jp-brand-color2);\\n --jp-widgets-input-border-width: var(--jp-widgets-border-width);\\n --jp-widgets-disabled-opacity: 0.6;\\n\\n /* From Material Design Lite */\\n --md-shadow-key-umbra-opacity: 0.2;\\n --md-shadow-key-penumbra-opacity: 0.14;\\n --md-shadow-ambient-shadow-opacity: 0.12;\\n}\\n\\n.jupyter-widgets {\\n margin: var(--jp-widgets-margin);\\n box-sizing: border-box;\\n color: var(--jp-widgets-color);\\n overflow: visible;\\n}\\n\\n.jp-Output-result > .jupyter-widgets {\\n margin-left: 0;\\n margin-right: 0;\\n}\\n\\n/* vbox and hbox */\\n\\n/* */\\n.widget-inline-hbox, /* */\\n .jupyter-widget-inline-hbox {\\n /* Horizontal widgets */\\n box-sizing: border-box;\\n display: flex;\\n flex-direction: row;\\n align-items: baseline;\\n}\\n\\n/* */\\n.widget-inline-vbox, /* */\\n .jupyter-widget-inline-vbox {\\n /* Vertical Widgets */\\n box-sizing: border-box;\\n display: flex;\\n flex-direction: column;\\n align-items: center;\\n}\\n\\n/* */\\n.widget-box, /* */\\n.jupyter-widget-box {\\n box-sizing: border-box;\\n display: flex;\\n margin: 0;\\n overflow: auto;\\n}\\n\\n/* */\\n.widget-gridbox, /* */\\n.jupyter-widget-gridbox {\\n box-sizing: border-box;\\n display: grid;\\n margin: 0;\\n overflow: auto;\\n}\\n\\n/* */\\n.widget-hbox, /* */\\n.jupyter-widget-hbox {\\n flex-direction: row;\\n}\\n\\n/* */\\n.widget-vbox, /* */\\n.jupyter-widget-vbox {\\n flex-direction: column;\\n}\\n\\n/* General Tags Styling */\\n\\n.jupyter-widget-tagsinput {\\n display: flex;\\n flex-direction: row;\\n flex-wrap: wrap;\\n align-items: center;\\n overflow: auto;\\n\\n cursor: text;\\n}\\n\\n.jupyter-widget-tag {\\n padding-left: 10px;\\n padding-right: 10px;\\n padding-top: 0px;\\n padding-bottom: 0px;\\n display: inline-block;\\n white-space: nowrap;\\n overflow: hidden;\\n text-overflow: ellipsis;\\n text-align: center;\\n font-size: var(--jp-widgets-font-size);\\n\\n height: calc(var(--jp-widgets-inline-height) - 2px);\\n border: 0px solid;\\n line-height: calc(var(--jp-widgets-inline-height) - 2px);\\n box-shadow: none;\\n\\n color: var(--jp-ui-font-color1);\\n background-color: var(--jp-layout-color2);\\n border-color: var(--jp-border-color2);\\n border: none;\\n user-select: none;\\n\\n cursor: grab;\\n transition: margin-left 200ms;\\n margin: 1px 1px 1px 1px;\\n}\\n\\n.jupyter-widget-tag.mod-active {\\n /* MD Lite 4dp shadow */\\n box-shadow: 0 4px 5px 0 rgba(0, 0, 0, var(--md-shadow-key-penumbra-opacity)),\\n 0 1px 10px 0 rgba(0, 0, 0, var(--md-shadow-ambient-shadow-opacity)),\\n 0 2px 4px -1px rgba(0, 0, 0, var(--md-shadow-key-umbra-opacity));\\n color: var(--jp-ui-font-color1);\\n background-color: var(--jp-layout-color3);\\n}\\n\\n.jupyter-widget-colortag {\\n color: var(--jp-inverse-ui-font-color1);\\n}\\n\\n.jupyter-widget-colortag.mod-active {\\n color: var(--jp-inverse-ui-font-color0);\\n}\\n\\n.jupyter-widget-taginput {\\n color: var(--jp-ui-font-color0);\\n background-color: var(--jp-layout-color0);\\n\\n cursor: text;\\n text-align: left;\\n}\\n\\n.jupyter-widget-taginput:focus {\\n outline: none;\\n}\\n\\n.jupyter-widget-tag-close {\\n margin-left: var(--jp-widgets-inline-margin);\\n padding: 2px 0px 2px 2px;\\n}\\n\\n.jupyter-widget-tag-close:hover {\\n cursor: pointer;\\n}\\n\\n/* Tag \\\"Primary\\\" Styling */\\n\\n.jupyter-widget-tag.mod-primary {\\n color: var(--jp-inverse-ui-font-color1);\\n background-color: var(--jp-brand-color1);\\n}\\n\\n.jupyter-widget-tag.mod-primary.mod-active {\\n color: var(--jp-inverse-ui-font-color0);\\n background-color: var(--jp-brand-color0);\\n}\\n\\n/* Tag \\\"Success\\\" Styling */\\n\\n.jupyter-widget-tag.mod-success {\\n color: var(--jp-inverse-ui-font-color1);\\n background-color: var(--jp-success-color1);\\n}\\n\\n.jupyter-widget-tag.mod-success.mod-active {\\n color: var(--jp-inverse-ui-font-color0);\\n background-color: var(--jp-success-color0);\\n}\\n\\n/* Tag \\\"Info\\\" Styling */\\n\\n.jupyter-widget-tag.mod-info {\\n color: var(--jp-inverse-ui-font-color1);\\n background-color: var(--jp-info-color1);\\n}\\n\\n.jupyter-widget-tag.mod-info.mod-active {\\n color: var(--jp-inverse-ui-font-color0);\\n background-color: var(--jp-info-color0);\\n}\\n\\n/* Tag \\\"Warning\\\" Styling */\\n\\n.jupyter-widget-tag.mod-warning {\\n color: var(--jp-inverse-ui-font-color1);\\n background-color: var(--jp-warn-color1);\\n}\\n\\n.jupyter-widget-tag.mod-warning.mod-active {\\n color: var(--jp-inverse-ui-font-color0);\\n background-color: var(--jp-warn-color0);\\n}\\n\\n/* Tag \\\"Danger\\\" Styling */\\n\\n.jupyter-widget-tag.mod-danger {\\n color: var(--jp-inverse-ui-font-color1);\\n background-color: var(--jp-error-color1);\\n}\\n\\n.jupyter-widget-tag.mod-danger.mod-active {\\n color: var(--jp-inverse-ui-font-color0);\\n background-color: var(--jp-error-color0);\\n}\\n\\n/* General Button Styling */\\n\\n.jupyter-button {\\n padding-left: 10px;\\n padding-right: 10px;\\n padding-top: 0px;\\n padding-bottom: 0px;\\n display: inline-block;\\n white-space: nowrap;\\n overflow: hidden;\\n text-overflow: ellipsis;\\n text-align: center;\\n font-size: var(--jp-widgets-font-size);\\n cursor: pointer;\\n\\n height: var(--jp-widgets-inline-height);\\n border: 0px solid;\\n line-height: var(--jp-widgets-inline-height);\\n box-shadow: none;\\n\\n color: var(--jp-ui-font-color1);\\n background-color: var(--jp-layout-color2);\\n border-color: var(--jp-border-color2);\\n border: none;\\n user-select: none;\\n}\\n\\n.jupyter-button i.fa {\\n margin-right: var(--jp-widgets-inline-margin);\\n pointer-events: none;\\n}\\n\\n.jupyter-button:empty:before {\\n content: '\\\\200b'; /* zero-width space */\\n}\\n\\n.jupyter-widgets.jupyter-button:disabled {\\n opacity: var(--jp-widgets-disabled-opacity);\\n}\\n\\n.jupyter-button i.fa.center {\\n margin-right: 0;\\n}\\n\\n.jupyter-button:hover:enabled,\\n.jupyter-button:focus:enabled {\\n /* MD Lite 2dp shadow */\\n box-shadow: 0 2px 2px 0 rgba(0, 0, 0, var(--md-shadow-key-penumbra-opacity)),\\n 0 3px 1px -2px rgba(0, 0, 0, var(--md-shadow-key-umbra-opacity)),\\n 0 1px 5px 0 rgba(0, 0, 0, var(--md-shadow-ambient-shadow-opacity));\\n}\\n\\n.jupyter-button:active,\\n.jupyter-button.mod-active {\\n /* MD Lite 4dp shadow */\\n box-shadow: 0 4px 5px 0 rgba(0, 0, 0, var(--md-shadow-key-penumbra-opacity)),\\n 0 1px 10px 0 rgba(0, 0, 0, var(--md-shadow-ambient-shadow-opacity)),\\n 0 2px 4px -1px rgba(0, 0, 0, var(--md-shadow-key-umbra-opacity));\\n color: var(--jp-ui-font-color1);\\n background-color: var(--jp-layout-color3);\\n}\\n\\n.jupyter-button:focus:enabled {\\n outline: 1px solid var(--jp-widgets-input-focus-border-color);\\n}\\n\\n/* Button \\\"Primary\\\" Styling */\\n\\n.jupyter-button.mod-primary {\\n color: var(--jp-ui-inverse-font-color1);\\n background-color: var(--jp-brand-color1);\\n}\\n\\n.jupyter-button.mod-primary.mod-active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-brand-color0);\\n}\\n\\n.jupyter-button.mod-primary:active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-brand-color0);\\n}\\n\\n/* Button \\\"Success\\\" Styling */\\n\\n.jupyter-button.mod-success {\\n color: var(--jp-ui-inverse-font-color1);\\n background-color: var(--jp-success-color1);\\n}\\n\\n.jupyter-button.mod-success.mod-active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-success-color0);\\n}\\n\\n.jupyter-button.mod-success:active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-success-color0);\\n}\\n\\n/* Button \\\"Info\\\" Styling */\\n\\n.jupyter-button.mod-info {\\n color: var(--jp-ui-inverse-font-color1);\\n background-color: var(--jp-info-color1);\\n}\\n\\n.jupyter-button.mod-info.mod-active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-info-color0);\\n}\\n\\n.jupyter-button.mod-info:active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-info-color0);\\n}\\n\\n/* Button \\\"Warning\\\" Styling */\\n\\n.jupyter-button.mod-warning {\\n color: var(--jp-ui-inverse-font-color1);\\n background-color: var(--jp-warn-color1);\\n}\\n\\n.jupyter-button.mod-warning.mod-active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-warn-color0);\\n}\\n\\n.jupyter-button.mod-warning:active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-warn-color0);\\n}\\n\\n/* Button \\\"Danger\\\" Styling */\\n\\n.jupyter-button.mod-danger {\\n color: var(--jp-ui-inverse-font-color1);\\n background-color: var(--jp-error-color1);\\n}\\n\\n.jupyter-button.mod-danger.mod-active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-error-color0);\\n}\\n\\n.jupyter-button.mod-danger:active {\\n color: var(--jp-ui-inverse-font-color0);\\n background-color: var(--jp-error-color0);\\n}\\n\\n/* Widget Button, Widget Toggle Button, Widget Upload */\\n\\n/* */\\n.widget-button, /* */\\n/* */ .widget-toggle-button, /* */\\n/* */ .widget-upload, /* */\\n.jupyter-widget-button,\\n.jupyter-widget-toggle-button,\\n.jupyter-widget-upload {\\n width: var(--jp-widgets-inline-width-short);\\n}\\n\\n/* Widget Label Styling */\\n\\n/* Override Bootstrap label css */\\n.jupyter-widgets label {\\n margin-bottom: initial;\\n}\\n\\n/* */\\n.widget-label-basic, /* */\\n.jupyter-widget-label-basic {\\n /* Basic Label */\\n color: var(--jp-widgets-label-color);\\n font-size: var(--jp-widgets-font-size);\\n overflow: hidden;\\n text-overflow: ellipsis;\\n white-space: nowrap;\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-label, /* */\\n.jupyter-widget-label {\\n /* Label */\\n color: var(--jp-widgets-label-color);\\n font-size: var(--jp-widgets-font-size);\\n overflow: hidden;\\n text-overflow: ellipsis;\\n white-space: nowrap;\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-inline-hbox .widget-label, /* */\\n.jupyter-widget-inline-hbox .jupyter-widget-label {\\n /* Horizontal Widget Label */\\n color: var(--jp-widgets-label-color);\\n text-align: right;\\n margin-right: calc(var(--jp-widgets-inline-margin) * 2);\\n width: var(--jp-widgets-inline-label-width);\\n flex-shrink: 0;\\n}\\n\\n/* */\\n.widget-inline-vbox .widget-label, /* */\\n.jupyter-widget-inline-vbox .jupyter-widget-label {\\n /* Vertical Widget Label */\\n color: var(--jp-widgets-label-color);\\n text-align: center;\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* Widget Readout Styling */\\n\\n/* */\\n.widget-readout, /* */\\n.jupyter-widget-readout {\\n color: var(--jp-widgets-readout-color);\\n font-size: var(--jp-widgets-font-size);\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n overflow: hidden;\\n white-space: nowrap;\\n text-align: center;\\n}\\n\\n/* */\\n.widget-readout.overflow, /* */\\n.jupyter-widget-readout.overflow {\\n /* Overflowing Readout */\\n\\n /* From Material Design Lite\\n shadow-key-umbra-opacity: 0.2;\\n shadow-key-penumbra-opacity: 0.14;\\n shadow-ambient-shadow-opacity: 0.12;\\n */\\n -webkit-box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2),\\n 0 3px 1px -2px rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);\\n\\n -moz-box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2),\\n 0 3px 1px -2px rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);\\n\\n box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.2), 0 3px 1px -2px rgba(0, 0, 0, 0.14),\\n 0 1px 5px 0 rgba(0, 0, 0, 0.12);\\n}\\n\\n/* */\\n.widget-inline-hbox .widget-readout, /* */\\n.jupyter-widget-inline-hbox .jupyter-widget-readout {\\n /* Horizontal Readout */\\n text-align: center;\\n max-width: var(--jp-widgets-inline-width-short);\\n min-width: var(--jp-widgets-inline-width-tiny);\\n margin-left: var(--jp-widgets-inline-margin);\\n}\\n\\n/* */\\n.widget-inline-vbox .widget-readout, /* */\\n.jupyter-widget-inline-vbox .jupyter-widget-readout {\\n /* Vertical Readout */\\n margin-top: var(--jp-widgets-inline-margin);\\n /* as wide as the widget */\\n width: inherit;\\n}\\n\\n/* Widget Checkbox Styling */\\n\\n/* */\\n.widget-checkbox, /* */\\n.jupyter-widget-checkbox {\\n width: var(--jp-widgets-inline-width);\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-checkbox input[type='checkbox'], /* */\\n.jupyter-widget-checkbox input[type='checkbox'] {\\n margin: 0px calc(var(--jp-widgets-inline-margin) * 2) 0px 0px;\\n line-height: var(--jp-widgets-inline-height);\\n font-size: large;\\n flex-grow: 1;\\n flex-shrink: 0;\\n align-self: center;\\n}\\n\\n/* Widget Valid Styling */\\n\\n/* */\\n.widget-valid, /* */\\n.jupyter-widget-valid {\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n width: var(--jp-widgets-inline-width-short);\\n font-size: var(--jp-widgets-font-size);\\n}\\n\\n/* */\\n.widget-valid i, /* */\\n.jupyter-widget-valid i {\\n line-height: var(--jp-widgets-inline-height);\\n margin-right: var(--jp-widgets-inline-margin);\\n margin-left: var(--jp-widgets-inline-margin);\\n}\\n\\n/* */\\n.widget-valid.mod-valid i, /* */\\n.jupyter-widget-valid.mod-valid i {\\n color: green;\\n}\\n\\n/* */\\n.widget-valid.mod-invalid i, /* */\\n.jupyter-widget-valid.mod-invalid i {\\n color: red;\\n}\\n\\n/* */\\n.widget-valid.mod-valid .widget-valid-readout, /* */\\n.jupyter-widget-valid.mod-valid .jupyter-widget-valid-readout {\\n display: none;\\n}\\n\\n/* Widget Text and TextArea Styling */\\n\\n/* */\\n.widget-textarea, /* */\\n/* */ .widget-text, /* */\\n.jupyter-widget-textarea,\\n.jupyter-widget-text {\\n width: var(--jp-widgets-inline-width);\\n}\\n\\n/* */\\n.widget-text input[type='text'], /* */\\n/* */ .widget-text input[type='number'], /* */\\n/* */ .widget-text input[type='password'], /* */\\n.jupyter-widget-text input[type='text'],\\n.jupyter-widget-text input[type='number'],\\n.jupyter-widget-text input[type='password'] {\\n height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-text input[type='text']:disabled, /* */\\n/* */ .widget-text input[type='number']:disabled, /* */\\n/* */ .widget-text input[type='password']:disabled, /* */\\n/* */ .widget-textarea textarea:disabled, /* */\\n.jupyter-widget-text input[type='text']:disabled,\\n.jupyter-widget-text input[type='number']:disabled,\\n.jupyter-widget-text input[type='password']:disabled,\\n.jupyter-widget-textarea textarea:disabled {\\n opacity: var(--jp-widgets-disabled-opacity);\\n}\\n\\n/* */\\n.widget-text input[type='text'], /* */\\n/* */ .widget-text input[type='number'], /* */\\n/* */ .widget-text input[type='password'], /* */\\n/* */ .widget-textarea textarea, /* */\\n.jupyter-widget-text input[type='text'],\\n.jupyter-widget-text input[type='number'],\\n.jupyter-widget-text input[type='password'],\\n.jupyter-widget-textarea textarea {\\n box-sizing: border-box;\\n border: var(--jp-widgets-input-border-width) solid\\n var(--jp-widgets-input-border-color);\\n background-color: var(--jp-widgets-input-background-color);\\n color: var(--jp-widgets-input-color);\\n font-size: var(--jp-widgets-font-size);\\n flex-grow: 1;\\n min-width: 0; /* This makes it possible for the flexbox to shrink this input */\\n flex-shrink: 1;\\n outline: none !important;\\n}\\n\\n/* */\\n.widget-text input[type='text'], /* */\\n/* */ .widget-text input[type='password'], /* */\\n/* */ .widget-textarea textarea, /* */\\n.jupyter-widget-text input[type='text'],\\n.jupyter-widget-text input[type='password'],\\n.jupyter-widget-textarea textarea {\\n padding: var(--jp-widgets-input-padding)\\n calc(var(--jp-widgets-input-padding) * 2);\\n}\\n\\n/* */\\n.widget-text input[type='number'], /* */\\n.jupyter-widget-text input[type='number'] {\\n padding: var(--jp-widgets-input-padding) 0 var(--jp-widgets-input-padding)\\n calc(var(--jp-widgets-input-padding) * 2);\\n}\\n\\n/* */\\n.widget-textarea textarea, /* */\\n.jupyter-widget-textarea textarea {\\n height: inherit;\\n width: inherit;\\n}\\n\\n/* */\\n.widget-text input:focus, /* */\\n/* */ .widget-textarea textarea:focus, /* */\\n.jupyter-widget-text input:focus,\\n.jupyter-widget-textarea textarea:focus {\\n border-color: var(--jp-widgets-input-focus-border-color);\\n}\\n\\n/* Horizontal Slider */\\n/* */\\n.widget-hslider, /* */\\n.jupyter-widget-hslider {\\n width: var(--jp-widgets-inline-width);\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n\\n /* Override the align-items baseline. This way, the description and readout\\n still seem to align their baseline properly, and we don't have to have\\n align-self: stretch in the .slider-container. */\\n align-items: center;\\n}\\n\\n/* */\\n.widgets-slider .slider-container, /* */\\n.jupyter-widgets-slider .slider-container {\\n overflow: visible;\\n}\\n\\n/* */\\n.widget-hslider .slider-container, /* */\\n.jupyter-widget-hslider .slider-container {\\n margin-left: calc(\\n var(--jp-widgets-slider-handle-size) / 2 - 2 *\\n var(--jp-widgets-slider-border-width)\\n );\\n margin-right: calc(\\n var(--jp-widgets-slider-handle-size) / 2 - 2 *\\n var(--jp-widgets-slider-border-width)\\n );\\n flex: 1 1 var(--jp-widgets-inline-width-short);\\n}\\n\\n/* Vertical Slider */\\n\\n/* */\\n.widget-vbox .widget-label, /* */\\n.jupyter-widget-vbox .jupyter-widget-label {\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-vslider, /* */\\n.jupyter-widget-vslider {\\n /* Vertical Slider */\\n height: var(--jp-widgets-vertical-height);\\n width: var(--jp-widgets-inline-width-tiny);\\n}\\n\\n/* */\\n.widget-vslider .slider-container, /* */\\n.jupyter-widget-vslider .slider-container {\\n flex: 1 1 var(--jp-widgets-inline-width-short);\\n margin-left: auto;\\n margin-right: auto;\\n margin-bottom: calc(\\n var(--jp-widgets-slider-handle-size) / 2 - 2 *\\n var(--jp-widgets-slider-border-width)\\n );\\n margin-top: calc(\\n var(--jp-widgets-slider-handle-size) / 2 - 2 *\\n var(--jp-widgets-slider-border-width)\\n );\\n display: flex;\\n flex-direction: column;\\n}\\n\\n/* Widget Progress Styling */\\n\\n.progress-bar {\\n -webkit-transition: none;\\n -moz-transition: none;\\n -ms-transition: none;\\n -o-transition: none;\\n transition: none;\\n}\\n\\n.progress-bar {\\n height: var(--jp-widgets-inline-height);\\n}\\n\\n.progress-bar {\\n background-color: var(--jp-brand-color1);\\n}\\n\\n.progress-bar-success {\\n background-color: var(--jp-success-color1);\\n}\\n\\n.progress-bar-info {\\n background-color: var(--jp-info-color1);\\n}\\n\\n.progress-bar-warning {\\n background-color: var(--jp-warn-color1);\\n}\\n\\n.progress-bar-danger {\\n background-color: var(--jp-error-color1);\\n}\\n\\n.progress {\\n background-color: var(--jp-layout-color2);\\n border: none;\\n box-shadow: none;\\n}\\n\\n/* Horisontal Progress */\\n\\n/* */\\n.widget-hprogress, /* */\\n.jupyter-widget-hprogress {\\n /* Progress Bar */\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n width: var(--jp-widgets-inline-width);\\n align-items: center;\\n}\\n\\n/* */\\n.widget-hprogress .progress, /* */\\n.jupyter-widget-hprogress .progress {\\n flex-grow: 1;\\n margin-top: var(--jp-widgets-input-padding);\\n margin-bottom: var(--jp-widgets-input-padding);\\n align-self: stretch;\\n /* Override bootstrap style */\\n height: initial;\\n}\\n\\n/* Vertical Progress */\\n\\n/* */\\n.widget-vprogress, /* */\\n.jupyter-widget-vprogress {\\n height: var(--jp-widgets-vertical-height);\\n width: var(--jp-widgets-inline-width-tiny);\\n}\\n\\n/* */\\n.widget-vprogress .progress, /* */\\n.jupyter-widget-vprogress .progress {\\n flex-grow: 1;\\n width: var(--jp-widgets-progress-thickness);\\n margin-left: auto;\\n margin-right: auto;\\n margin-bottom: 0;\\n}\\n\\n/* Select Widget Styling */\\n\\n/* */\\n.widget-dropdown, /* */\\n.jupyter-widget-dropdown {\\n height: var(--jp-widgets-inline-height);\\n width: var(--jp-widgets-inline-width);\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-dropdown > select, /* */\\n.jupyter-widget-dropdown > select {\\n padding-right: 20px;\\n border: var(--jp-widgets-input-border-width) solid\\n var(--jp-widgets-input-border-color);\\n border-radius: 0;\\n height: inherit;\\n flex: 1 1 var(--jp-widgets-inline-width-short);\\n min-width: 0; /* This makes it possible for the flexbox to shrink this input */\\n box-sizing: border-box;\\n outline: none !important;\\n box-shadow: none;\\n background-color: var(--jp-widgets-input-background-color);\\n color: var(--jp-widgets-input-color);\\n font-size: var(--jp-widgets-font-size);\\n vertical-align: top;\\n padding-left: calc(var(--jp-widgets-input-padding) * 2);\\n appearance: none;\\n -webkit-appearance: none;\\n -moz-appearance: none;\\n background-repeat: no-repeat;\\n background-size: 20px;\\n background-position: right center;\\n background-image: var(--jp-widgets-dropdown-arrow);\\n}\\n/* */\\n.widget-dropdown > select:focus, /* */\\n.jupyter-widget-dropdown > select:focus {\\n border-color: var(--jp-widgets-input-focus-border-color);\\n}\\n\\n/* */\\n.widget-dropdown > select:disabled, /* */\\n.jupyter-widget-dropdown > select:disabled {\\n opacity: var(--jp-widgets-disabled-opacity);\\n}\\n\\n/* To disable the dotted border in Firefox around select controls.\\n See http://stackoverflow.com/a/18853002 */\\n/* */\\n.widget-dropdown > select:-moz-focusring, /* */\\n.jupyter-widget-dropdown > select:-moz-focusring {\\n color: transparent;\\n text-shadow: 0 0 0 #000;\\n}\\n\\n/* Select and SelectMultiple */\\n\\n/* */\\n.widget-select, /* */\\n.jupyter-widget-select {\\n width: var(--jp-widgets-inline-width);\\n line-height: var(--jp-widgets-inline-height);\\n\\n /* Because Firefox defines the baseline of a select as the bottom of the\\n control, we align the entire control to the top and add padding to the\\n select to get an approximate first line baseline alignment. */\\n align-items: flex-start;\\n}\\n\\n/* */\\n.widget-select > select, /* */\\n.jupyter-widget-select > select {\\n border: var(--jp-widgets-input-border-width) solid\\n var(--jp-widgets-input-border-color);\\n background-color: var(--jp-widgets-input-background-color);\\n color: var(--jp-widgets-input-color);\\n font-size: var(--jp-widgets-font-size);\\n flex: 1 1 var(--jp-widgets-inline-width-short);\\n outline: none !important;\\n overflow: auto;\\n height: inherit;\\n\\n /* Because Firefox defines the baseline of a select as the bottom of the\\n control, we align the entire control to the top and add padding to the\\n select to get an approximate first line baseline alignment. */\\n padding-top: 5px;\\n}\\n\\n/* */\\n.widget-select > select:focus, /* */\\n.jupyter-widget-select > select:focus {\\n border-color: var(--jp-widgets-input-focus-border-color);\\n}\\n\\n.wiget-select > select > option,\\n.jupyter-wiget-select > select > option {\\n padding-left: var(--jp-widgets-input-padding);\\n line-height: var(--jp-widgets-inline-height);\\n /* line-height doesn't work on some browsers for select options */\\n padding-top: calc(\\n var(--jp-widgets-inline-height) - var(--jp-widgets-font-size) / 2\\n );\\n padding-bottom: calc(\\n var(--jp-widgets-inline-height) - var(--jp-widgets-font-size) / 2\\n );\\n}\\n\\n/* Toggle Buttons Styling */\\n\\n/* */\\n.widget-toggle-buttons, /* */\\n.jupyter-widget-toggle-buttons {\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-toggle-buttons .widget-toggle-button, /* */\\n.jupyter-widget-toggle-buttons .jupyter-widget-toggle-button {\\n margin-left: var(--jp-widgets-margin);\\n margin-right: var(--jp-widgets-margin);\\n}\\n\\n/* */\\n.widget-toggle-buttons .jupyter-button:disabled, /* */\\n.jupyter-widget-toggle-buttons .jupyter-button:disabled {\\n opacity: var(--jp-widgets-disabled-opacity);\\n}\\n\\n/* Radio Buttons Styling */\\n\\n/* */\\n.widget-radio, /* */\\n.jupyter-widget-radio {\\n width: var(--jp-widgets-inline-width);\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-radio-box, /* */\\n.jupyter-widget-radio-box {\\n display: flex;\\n flex-direction: column;\\n align-items: stretch;\\n box-sizing: border-box;\\n flex-grow: 1;\\n margin-bottom: var(--jp-widgets-radio-item-height-adjustment);\\n}\\n\\n/* */\\n.widget-radio-box-vertical, /* */\\n.jupyter-widget-radio-box-vertical {\\n flex-direction: column;\\n}\\n\\n/* */\\n.widget-radio-box-horizontal, /* */\\n.jupyter-widget-radio-box-horizontal {\\n flex-direction: row;\\n}\\n\\n/* */\\n.widget-radio-box label, /* */\\n.jupyter-widget-radio-box label {\\n height: var(--jp-widgets-radio-item-height);\\n line-height: var(--jp-widgets-radio-item-height);\\n font-size: var(--jp-widgets-font-size);\\n}\\n\\n.widget-radio-box-horizontal label,\\n.jupyter-widget-radio-box-horizontal label {\\n margin: 0 calc(var(--jp-widgets-input-padding) * 2) 0 0;\\n}\\n\\n/* */\\n.widget-radio-box input, /* */\\n.jupyter-widget-radio-box input {\\n height: var(--jp-widgets-radio-item-height);\\n line-height: var(--jp-widgets-radio-item-height);\\n margin: 0 calc(var(--jp-widgets-input-padding) * 2) 0 1px;\\n float: left;\\n}\\n\\n/* Color Picker Styling */\\n\\n/* */\\n.widget-colorpicker, /* */\\n.jupyter-widget-colorpicker {\\n width: var(--jp-widgets-inline-width);\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-colorpicker > .widget-colorpicker-input, /* */\\n.jupyter-widget-colorpicker > .jupyter-widget-colorpicker-input {\\n flex-grow: 1;\\n flex-shrink: 1;\\n min-width: var(--jp-widgets-inline-width-tiny);\\n}\\n\\n/* */\\n.widget-colorpicker input[type='color'], /* */\\n.jupyter-widget-colorpicker input[type='color'] {\\n width: var(--jp-widgets-inline-height);\\n height: var(--jp-widgets-inline-height);\\n padding: 0 2px; /* make the color square actually square on Chrome on OS X */\\n background: var(--jp-widgets-input-background-color);\\n color: var(--jp-widgets-input-color);\\n border: var(--jp-widgets-input-border-width) solid\\n var(--jp-widgets-input-border-color);\\n border-left: none;\\n flex-grow: 0;\\n flex-shrink: 0;\\n box-sizing: border-box;\\n align-self: stretch;\\n outline: none !important;\\n}\\n\\n/* */\\n.widget-colorpicker.concise input[type='color'], /* */\\n.jupyter-widget-colorpicker.concise input[type='color'] {\\n border-left: var(--jp-widgets-input-border-width) solid\\n var(--jp-widgets-input-border-color);\\n}\\n\\n/* */\\n.widget-colorpicker input[type='color']:focus, /* */\\n/* */ .widget-colorpicker input[type='text']:focus, /* */\\n.jupyter-widget-colorpicker input[type='color']:focus,\\n.jupyter-widget-colorpicker input[type='text']:focus {\\n border-color: var(--jp-widgets-input-focus-border-color);\\n}\\n\\n/* */\\n.widget-colorpicker input[type='text'], /* */\\n.jupyter-widget-colorpicker input[type='text'] {\\n flex-grow: 1;\\n outline: none !important;\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n background: var(--jp-widgets-input-background-color);\\n color: var(--jp-widgets-input-color);\\n border: var(--jp-widgets-input-border-width) solid\\n var(--jp-widgets-input-border-color);\\n font-size: var(--jp-widgets-font-size);\\n padding: var(--jp-widgets-input-padding)\\n calc(var(--jp-widgets-input-padding) * 2);\\n min-width: 0; /* This makes it possible for the flexbox to shrink this input */\\n flex-shrink: 1;\\n box-sizing: border-box;\\n}\\n\\n/* */\\n.widget-colorpicker input[type='text']:disabled, /* */\\n.jupyter-widget-colorpicker input[type='text']:disabled {\\n opacity: var(--jp-widgets-disabled-opacity);\\n}\\n\\n/* Date Picker Styling */\\n\\n/* */\\n.widget-datepicker, /* */\\n.jupyter-widget-datepicker {\\n width: var(--jp-widgets-inline-width);\\n height: var(--jp-widgets-inline-height);\\n line-height: var(--jp-widgets-inline-height);\\n}\\n\\n/* */\\n.widget-datepicker input[type='date'], /* */\\n.jupyter-widget-datepicker input[type='date'] {\\n flex-grow: 1;\\n flex-shrink: 1;\\n min-width: 0; /* This makes it possible for the flexbox to shrink this input */\\n outline: none !important;\\n height: var(--jp-widgets-inline-height);\\n border: var(--jp-widgets-input-border-width) solid\\n var(--jp-widgets-input-border-color);\\n background-color: var(--jp-widgets-input-background-color);\\n color: var(--jp-widgets-input-color);\\n font-size: var(--jp-widgets-font-size);\\n padding: var(--jp-widgets-input-padding)\\n calc(var(--jp-widgets-input-padding) * 2);\\n box-sizing: border-box;\\n}\\n\\n/* */\\n.widget-datepicker input[type='date']:focus, /* */\\n.jupyter-widget-datepicker input[type='date']:focus {\\n border-color: var(--jp-widgets-input-focus-border-color);\\n}\\n\\n/* */\\n.widget-datepicker input[type='date']:invalid, /* */\\n.jupyter-widget-datepicker input[type='date']:invalid {\\n border-color: var(--jp-warn-color1);\\n}\\n\\n/* */\\n.widget-datepicker input[type='date']:disabled, /* */\\n.jupyter-widget-datepicker input[type='date']:disabled {\\n opacity: var(--jp-widgets-disabled-opacity);\\n}\\n\\n/* Play Widget */\\n\\n/* */\\n.widget-play, /* */\\n.jupyter-widget-play {\\n width: var(--jp-widgets-inline-width-short);\\n display: flex;\\n align-items: stretch;\\n}\\n\\n/* */\\n.widget-play .jupyter-button, /* */\\n.jupyter-widget-play .jupyter-button {\\n flex-grow: 1;\\n height: auto;\\n}\\n\\n/* */\\n.widget-play .jupyter-button:disabled, /* */\\n.jupyter-widget-play .jupyter-button:disabled {\\n opacity: var(--jp-widgets-disabled-opacity);\\n}\\n\\n/* Tab Widget */\\n\\n/* */\\n.jupyter-widgets.widget-tab, /* */\\n.jupyter-widgets.jupyter-widget-tab {\\n display: flex;\\n flex-direction: column;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar {\\n /* Necessary so that a tab can be shifted down to overlay the border of the box below. */\\n overflow-x: visible;\\n overflow-y: visible;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar > .p-TabBar-content, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar > .p-TabBar-content, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar > .lm-TabBar-content {\\n /* Make sure that the tab grows from bottom up */\\n align-items: flex-end;\\n min-width: 0;\\n min-height: 0;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .widget-tab-contents, /* */\\n.jupyter-widgets.jupyter-widget-tab > .widget-tab-contents {\\n width: 100%;\\n box-sizing: border-box;\\n margin: 0;\\n background: var(--jp-layout-color1);\\n color: var(--jp-ui-font-color1);\\n border: var(--jp-border-width) solid var(--jp-border-color1);\\n padding: var(--jp-widgets-container-padding);\\n flex-grow: 1;\\n overflow: auto;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar {\\n font: var(--jp-widgets-font-size) Helvetica, Arial, sans-serif;\\n min-height: calc(\\n var(--jp-widgets-horizontal-tab-height) + var(--jp-border-width)\\n );\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tab, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tab {\\n flex: 0 1 var(--jp-widgets-horizontal-tab-width);\\n min-width: 35px;\\n min-height: calc(\\n var(--jp-widgets-horizontal-tab-height) + var(--jp-border-width)\\n );\\n line-height: var(--jp-widgets-horizontal-tab-height);\\n margin-left: calc(-1 * var(--jp-border-width));\\n padding: 0px 10px;\\n background: var(--jp-layout-color2);\\n color: var(--jp-ui-font-color2);\\n border: var(--jp-border-width) solid var(--jp-border-color1);\\n border-bottom: none;\\n position: relative;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab.p-mod-current, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tab.p-mod-current, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tab.lm-mod-current {\\n color: var(--jp-ui-font-color0);\\n /* We want the background to match the tab content background */\\n background: var(--jp-layout-color1);\\n min-height: calc(\\n var(--jp-widgets-horizontal-tab-height) + 2 * var(--jp-border-width)\\n );\\n transform: translateY(var(--jp-border-width));\\n overflow: visible;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab.p-mod-current:before, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tab.p-mod-current:before, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tab.lm-mod-current:before {\\n position: absolute;\\n top: calc(-1 * var(--jp-border-width));\\n left: calc(-1 * var(--jp-border-width));\\n content: '';\\n height: var(--jp-widgets-horizontal-tab-top-border);\\n width: calc(100% + 2 * var(--jp-border-width));\\n background: var(--jp-brand-color1);\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tab:first-child, /* */\\n/* */.jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tab:first-child, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tab:first-child {\\n margin-left: 0;\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar\\n .p-TabBar-tab:hover:not(.p-mod-current),\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .p-TabBar\\n .p-TabBar-tab:hover:not(.p-mod-current),\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar\\n .lm-TabBar-tab:hover:not(.lm-mod-current) {\\n background: var(--jp-layout-color1);\\n color: var(--jp-ui-font-color1);\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar\\n .p-mod-closable\\n > .p-TabBar-tabCloseIcon,\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n> .p-TabBar\\n.p-mod-closable\\n> .p-TabBar-tabCloseIcon,\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar\\n .lm-mod-closable\\n > .lm-TabBar-tabCloseIcon {\\n margin-left: 4px;\\n}\\n\\n/* This font-awesome strategy may not work across FA4 and FA5, but we don't\\nactually support closable tabs, so it really doesn't matter */\\n/* */\\n.jupyter-widgets.widget-tab\\n > .p-TabBar\\n .p-mod-closable\\n > .p-TabBar-tabCloseIcon:before,\\n/* */\\n/* */\\n.jupyter-widgets.jupyter-widget-widget-tab\\n> .p-TabBar\\n.p-mod-closable\\n> .p-TabBar-tabCloseIcon:before,\\n/* */\\n.jupyter-widgets.jupyter-widget-tab\\n > .lm-TabBar\\n .lm-mod-closable\\n > .lm-TabBar-tabCloseIcon:before {\\n font-family: FontAwesome;\\n content: '\\\\f00d'; /* close */\\n}\\n\\n/* */\\n.jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabIcon, /* */\\n/* */ .jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabLabel, /* */\\n/* */ .jupyter-widgets.widget-tab > .p-TabBar .p-TabBar-tabCloseIcon, /* */\\n/* */ .jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tabIcon, /* */\\n/* */ .jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tabLabel, /* */\\n/* */ .jupyter-widgets.jupyter-widget-tab > .p-TabBar .p-TabBar-tabCloseIcon, /* */\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tabIcon,\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tabLabel,\\n.jupyter-widgets.jupyter-widget-tab > .lm-TabBar .lm-TabBar-tabCloseIcon {\\n line-height: var(--jp-widgets-horizontal-tab-height);\\n}\\n\\n/* Accordion Widget */\\n\\n.jupyter-widget-Collapse {\\n display: flex;\\n flex-direction: column;\\n align-items: stretch;\\n}\\n\\n.jupyter-widget-Collapse-header {\\n padding: var(--jp-widgets-input-padding);\\n cursor: pointer;\\n color: var(--jp-ui-font-color2);\\n background-color: var(--jp-layout-color2);\\n border: var(--jp-widgets-border-width) solid var(--jp-border-color1);\\n padding: calc(var(--jp-widgets-container-padding) * 2 / 3)\\n var(--jp-widgets-container-padding);\\n font-weight: bold;\\n}\\n\\n.jupyter-widget-Collapse-header:hover {\\n background-color: var(--jp-layout-color1);\\n color: var(--jp-ui-font-color1);\\n}\\n\\n.jupyter-widget-Collapse-open > .jupyter-widget-Collapse-header {\\n background-color: var(--jp-layout-color1);\\n color: var(--jp-ui-font-color0);\\n cursor: default;\\n border-bottom: none;\\n}\\n\\n.jupyter-widget-Collapse-contents {\\n padding: var(--jp-widgets-container-padding);\\n background-color: var(--jp-layout-color1);\\n color: var(--jp-ui-font-color1);\\n border-left: var(--jp-widgets-border-width) solid var(--jp-border-color1);\\n border-right: var(--jp-widgets-border-width) solid var(--jp-border-color1);\\n border-bottom: var(--jp-widgets-border-width) solid var(--jp-border-color1);\\n overflow: auto;\\n}\\n\\n.jupyter-widget-Accordion {\\n display: flex;\\n flex-direction: column;\\n align-items: stretch;\\n}\\n\\n.jupyter-widget-Accordion .jupyter-widget-Collapse {\\n margin-bottom: 0;\\n}\\n\\n.jupyter-widget-Accordion .jupyter-widget-Collapse + .jupyter-widget-Collapse {\\n margin-top: 4px;\\n}\\n\\n/* HTML widget */\\n\\n/* */\\n.widget-html, /* */\\n/* */ .widget-htmlmath, /* */\\n.jupyter-widget-html,\\n.jupyter-widget-htmlmath {\\n font-size: var(--jp-widgets-font-size);\\n}\\n\\n/* */\\n.widget-html > .widget-html-content, /* */\\n/* */.widget-htmlmath > .widget-html-content, /* */\\n.jupyter-widget-html > .jupyter-widget-html-content,\\n.jupyter-widget-htmlmath > .jupyter-widget-html-content {\\n /* Fill out the area in the HTML widget */\\n align-self: stretch;\\n flex-grow: 1;\\n flex-shrink: 1;\\n /* Makes sure the baseline is still aligned with other elements */\\n line-height: var(--jp-widgets-inline-height);\\n /* Make it possible to have absolutely-positioned elements in the html */\\n position: relative;\\n}\\n\\n/* Image widget */\\n\\n/* */\\n.widget-image, /* */\\n.jupyter-widget-image {\\n max-width: 100%;\\n height: auto;\\n}\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../packages/thebe/node_modules/css-loader/dist/runtime/cssWithMappingToString.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../packages/thebe/node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/* BASICS */\\n\\n.CodeMirror {\\n /* Set height, width, borders, and global font properties here */\\n font-family: monospace;\\n height: 300px;\\n color: black;\\n direction: ltr;\\n}\\n\\n/* PADDING */\\n\\n.CodeMirror-lines {\\n padding: 4px 0; /* Vertical padding around content */\\n}\\n.CodeMirror pre.CodeMirror-line,\\n.CodeMirror pre.CodeMirror-line-like {\\n padding: 0 4px; /* Horizontal padding of content */\\n}\\n\\n.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {\\n background-color: white; /* The little square between H and V scrollbars */\\n}\\n\\n/* GUTTER */\\n\\n.CodeMirror-gutters {\\n border-right: 1px solid #ddd;\\n background-color: #f7f7f7;\\n white-space: nowrap;\\n}\\n.CodeMirror-linenumbers {}\\n.CodeMirror-linenumber {\\n padding: 0 3px 0 5px;\\n min-width: 20px;\\n text-align: right;\\n color: #999;\\n white-space: nowrap;\\n}\\n\\n.CodeMirror-guttermarker { color: black; }\\n.CodeMirror-guttermarker-subtle { color: #999; }\\n\\n/* CURSOR */\\n\\n.CodeMirror-cursor {\\n border-left: 1px solid black;\\n border-right: none;\\n width: 0;\\n}\\n/* Shown when moving in bi-directional text */\\n.CodeMirror div.CodeMirror-secondarycursor {\\n border-left: 1px solid silver;\\n}\\n.cm-fat-cursor .CodeMirror-cursor {\\n width: auto;\\n border: 0 !important;\\n background: #7e7;\\n}\\n.cm-fat-cursor div.CodeMirror-cursors {\\n z-index: 1;\\n}\\n.cm-fat-cursor-mark {\\n background-color: rgba(20, 255, 20, 0.5);\\n -webkit-animation: blink 1.06s steps(1) infinite;\\n -moz-animation: blink 1.06s steps(1) infinite;\\n animation: blink 1.06s steps(1) infinite;\\n}\\n.cm-animate-fat-cursor {\\n width: auto;\\n border: 0;\\n -webkit-animation: blink 1.06s steps(1) infinite;\\n -moz-animation: blink 1.06s steps(1) infinite;\\n animation: blink 1.06s steps(1) infinite;\\n background-color: #7e7;\\n}\\n@-moz-keyframes blink {\\n 0% {}\\n 50% { background-color: transparent; }\\n 100% {}\\n}\\n@-webkit-keyframes blink {\\n 0% {}\\n 50% { background-color: transparent; }\\n 100% {}\\n}\\n@keyframes blink {\\n 0% {}\\n 50% { background-color: transparent; }\\n 100% {}\\n}\\n\\n/* Can style cursor different in overwrite (non-insert) mode */\\n.CodeMirror-overwrite .CodeMirror-cursor {}\\n\\n.cm-tab { display: inline-block; text-decoration: inherit; }\\n\\n.CodeMirror-rulers {\\n position: absolute;\\n left: 0; right: 0; top: -50px; bottom: 0;\\n overflow: hidden;\\n}\\n.CodeMirror-ruler {\\n border-left: 1px solid #ccc;\\n top: 0; bottom: 0;\\n position: absolute;\\n}\\n\\n/* DEFAULT THEME */\\n\\n.cm-s-default .cm-header {color: blue;}\\n.cm-s-default .cm-quote {color: #090;}\\n.cm-negative {color: #d44;}\\n.cm-positive {color: #292;}\\n.cm-header, .cm-strong {font-weight: bold;}\\n.cm-em {font-style: italic;}\\n.cm-link {text-decoration: underline;}\\n.cm-strikethrough {text-decoration: line-through;}\\n\\n.cm-s-default .cm-keyword {color: #708;}\\n.cm-s-default .cm-atom {color: #219;}\\n.cm-s-default .cm-number {color: #164;}\\n.cm-s-default .cm-def {color: #00f;}\\n.cm-s-default .cm-variable,\\n.cm-s-default .cm-punctuation,\\n.cm-s-default .cm-property,\\n.cm-s-default .cm-operator {}\\n.cm-s-default .cm-variable-2 {color: #05a;}\\n.cm-s-default .cm-variable-3, .cm-s-default .cm-type {color: #085;}\\n.cm-s-default .cm-comment {color: #a50;}\\n.cm-s-default .cm-string {color: #a11;}\\n.cm-s-default .cm-string-2 {color: #f50;}\\n.cm-s-default .cm-meta {color: #555;}\\n.cm-s-default .cm-qualifier {color: #555;}\\n.cm-s-default .cm-builtin {color: #30a;}\\n.cm-s-default .cm-bracket {color: #997;}\\n.cm-s-default .cm-tag {color: #170;}\\n.cm-s-default .cm-attribute {color: #00c;}\\n.cm-s-default .cm-hr {color: #999;}\\n.cm-s-default .cm-link {color: #00c;}\\n\\n.cm-s-default .cm-error {color: #f00;}\\n.cm-invalidchar {color: #f00;}\\n\\n.CodeMirror-composing { border-bottom: 2px solid; }\\n\\n/* Default styles for common addons */\\n\\ndiv.CodeMirror span.CodeMirror-matchingbracket {color: #0b0;}\\ndiv.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}\\n.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }\\n.CodeMirror-activeline-background {background: #e8f2ff;}\\n\\n/* STOP */\\n\\n/* The rest of this file contains styles related to the mechanics of\\n the editor. You probably shouldn't touch them. */\\n\\n.CodeMirror {\\n position: relative;\\n overflow: hidden;\\n background: white;\\n}\\n\\n.CodeMirror-scroll {\\n overflow: scroll !important; /* Things will break if this is overridden */\\n /* 50px is the magic margin used to hide the element's real scrollbars */\\n /* See overflow: hidden in .CodeMirror */\\n margin-bottom: -50px; margin-right: -50px;\\n padding-bottom: 50px;\\n height: 100%;\\n outline: none; /* Prevent dragging from highlighting the element */\\n position: relative;\\n}\\n.CodeMirror-sizer {\\n position: relative;\\n border-right: 50px solid transparent;\\n}\\n\\n/* The fake, visible scrollbars. Used to force redraw during scrolling\\n before actual scrolling happens, thus preventing shaking and\\n flickering artifacts. */\\n.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {\\n position: absolute;\\n z-index: 6;\\n display: none;\\n outline: none;\\n}\\n.CodeMirror-vscrollbar {\\n right: 0; top: 0;\\n overflow-x: hidden;\\n overflow-y: scroll;\\n}\\n.CodeMirror-hscrollbar {\\n bottom: 0; left: 0;\\n overflow-y: hidden;\\n overflow-x: scroll;\\n}\\n.CodeMirror-scrollbar-filler {\\n right: 0; bottom: 0;\\n}\\n.CodeMirror-gutter-filler {\\n left: 0; bottom: 0;\\n}\\n\\n.CodeMirror-gutters {\\n position: absolute; left: 0; top: 0;\\n min-height: 100%;\\n z-index: 3;\\n}\\n.CodeMirror-gutter {\\n white-space: normal;\\n height: 100%;\\n display: inline-block;\\n vertical-align: top;\\n margin-bottom: -50px;\\n}\\n.CodeMirror-gutter-wrapper {\\n position: absolute;\\n z-index: 4;\\n background: none !important;\\n border: none !important;\\n}\\n.CodeMirror-gutter-background {\\n position: absolute;\\n top: 0; bottom: 0;\\n z-index: 4;\\n}\\n.CodeMirror-gutter-elt {\\n position: absolute;\\n cursor: default;\\n z-index: 4;\\n}\\n.CodeMirror-gutter-wrapper ::selection { background-color: transparent }\\n.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }\\n\\n.CodeMirror-lines {\\n cursor: text;\\n min-height: 1px; /* prevents collapsing before first draw */\\n}\\n.CodeMirror pre.CodeMirror-line,\\n.CodeMirror pre.CodeMirror-line-like {\\n /* Reset some styles that the rest of the page might have set */\\n -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;\\n border-width: 0;\\n background: transparent;\\n font-family: inherit;\\n font-size: inherit;\\n margin: 0;\\n white-space: pre;\\n word-wrap: normal;\\n line-height: inherit;\\n color: inherit;\\n z-index: 2;\\n position: relative;\\n overflow: visible;\\n -webkit-tap-highlight-color: transparent;\\n -webkit-font-variant-ligatures: contextual;\\n font-variant-ligatures: contextual;\\n}\\n.CodeMirror-wrap pre.CodeMirror-line,\\n.CodeMirror-wrap pre.CodeMirror-line-like {\\n word-wrap: break-word;\\n white-space: pre-wrap;\\n word-break: normal;\\n}\\n\\n.CodeMirror-linebackground {\\n position: absolute;\\n left: 0; right: 0; top: 0; bottom: 0;\\n z-index: 0;\\n}\\n\\n.CodeMirror-linewidget {\\n position: relative;\\n z-index: 2;\\n padding: 0.1px; /* Force widget margins to stay inside of the container */\\n}\\n\\n.CodeMirror-widget {}\\n\\n.CodeMirror-rtl pre { direction: rtl; }\\n\\n.CodeMirror-code {\\n outline: none;\\n}\\n\\n/* Force content-box sizing for the elements where we expect it */\\n.CodeMirror-scroll,\\n.CodeMirror-sizer,\\n.CodeMirror-gutter,\\n.CodeMirror-gutters,\\n.CodeMirror-linenumber {\\n -moz-box-sizing: content-box;\\n box-sizing: content-box;\\n}\\n\\n.CodeMirror-measure {\\n position: absolute;\\n width: 100%;\\n height: 0;\\n overflow: hidden;\\n visibility: hidden;\\n}\\n\\n.CodeMirror-cursor {\\n position: absolute;\\n pointer-events: none;\\n}\\n.CodeMirror-measure pre { position: static; }\\n\\ndiv.CodeMirror-cursors {\\n visibility: hidden;\\n position: relative;\\n z-index: 3;\\n}\\ndiv.CodeMirror-dragcursors {\\n visibility: visible;\\n}\\n\\n.CodeMirror-focused div.CodeMirror-cursors {\\n visibility: visible;\\n}\\n\\n.CodeMirror-selected { background: #d9d9d9; }\\n.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }\\n.CodeMirror-crosshair { cursor: crosshair; }\\n.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }\\n.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }\\n\\n.cm-searching {\\n background-color: #ffa;\\n background-color: rgba(255, 255, 0, .4);\\n}\\n\\n/* Used to force a border model for a node */\\n.cm-force-border { padding-right: .1px; }\\n\\n@media print {\\n /* Hide the cursor when printing */\\n .CodeMirror div.CodeMirror-cursors {\\n visibility: hidden;\\n }\\n}\\n\\n/* See issue #2901 */\\n.cm-tab-wrap-hack:after { content: ''; }\\n\\n/* Help users use markselection to safely style text background */\\nspan.CodeMirror-selectedtext { background: none; }\\n\", \"\",{\"version\":3,\"sources\":[\"webpack://./../../node_modules/codemirror/lib/codemirror.css\"],\"names\":[],\"mappings\":\"AAAA,WAAW;;AAEX;EACE,gEAAgE;EAChE,sBAAsB;EACtB,aAAa;EACb,YAAY;EACZ,cAAc;AAChB;;AAEA,YAAY;;AAEZ;EACE,cAAc,EAAE,oCAAoC;AACtD;AACA;;EAEE,cAAc,EAAE,kCAAkC;AACpD;;AAEA;EACE,uBAAuB,EAAE,iDAAiD;AAC5E;;AAEA,WAAW;;AAEX;EACE,4BAA4B;EAC5B,yBAAyB;EACzB,mBAAmB;AACrB;AACA,yBAAyB;AACzB;EACE,oBAAoB;EACpB,eAAe;EACf,iBAAiB;EACjB,WAAW;EACX,mBAAmB;AACrB;;AAEA,2BAA2B,YAAY,EAAE;AACzC,kCAAkC,WAAW,EAAE;;AAE/C,WAAW;;AAEX;EACE,4BAA4B;EAC5B,kBAAkB;EAClB,QAAQ;AACV;AACA,6CAA6C;AAC7C;EACE,6BAA6B;AAC/B;AACA;EACE,WAAW;EACX,oBAAoB;EACpB,gBAAgB;AAClB;AACA;EACE,UAAU;AACZ;AACA;EACE,wCAAwC;EACxC,gDAAgD;EAChD,6CAA6C;EAC7C,wCAAwC;AAC1C;AACA;EACE,WAAW;EACX,SAAS;EACT,gDAAgD;EAChD,6CAA6C;EAC7C,wCAAwC;EACxC,sBAAsB;AACxB;AACA;EACE,IAAI;EACJ,MAAM,6BAA6B,EAAE;EACrC,MAAM;AACR;AACA;EACE,IAAI;EACJ,MAAM,6BAA6B,EAAE;EACrC,MAAM;AACR;AACA;EACE,IAAI;EACJ,MAAM,6BAA6B,EAAE;EACrC,MAAM;AACR;;AAEA,8DAA8D;AAC9D,0CAA0C;;AAE1C,UAAU,qBAAqB,EAAE,wBAAwB,EAAE;;AAE3D;EACE,kBAAkB;EAClB,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS;EACxC,gBAAgB;AAClB;AACA;EACE,2BAA2B;EAC3B,MAAM,EAAE,SAAS;EACjB,kBAAkB;AACpB;;AAEA,kBAAkB;;AAElB,0BAA0B,WAAW,CAAC;AACtC,yBAAyB,WAAW,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,wBAAwB,iBAAiB,CAAC;AAC1C,QAAQ,kBAAkB,CAAC;AAC3B,UAAU,0BAA0B,CAAC;AACrC,mBAAmB,6BAA6B,CAAC;;AAEjD,2BAA2B,WAAW,CAAC;AACvC,wBAAwB,WAAW,CAAC;AACpC,0BAA0B,WAAW,CAAC;AACtC,uBAAuB,WAAW,CAAC;AACnC;;;4BAG4B;AAC5B,8BAA8B,WAAW,CAAC;AAC1C,sDAAsD,WAAW,CAAC;AAClE,2BAA2B,WAAW,CAAC;AACvC,0BAA0B,WAAW,CAAC;AACtC,4BAA4B,WAAW,CAAC;AACxC,wBAAwB,WAAW,CAAC;AACpC,6BAA6B,WAAW,CAAC;AACzC,2BAA2B,WAAW,CAAC;AACvC,2BAA2B,WAAW,CAAC;AACvC,uBAAuB,WAAW,CAAC;AACnC,6BAA6B,WAAW,CAAC;AACzC,sBAAsB,WAAW,CAAC;AAClC,wBAAwB,WAAW,CAAC;;AAEpC,yBAAyB,WAAW,CAAC;AACrC,iBAAiB,WAAW,CAAC;;AAE7B,wBAAwB,wBAAwB,EAAE;;AAElD,qCAAqC;;AAErC,gDAAgD,WAAW,CAAC;AAC5D,mDAAmD,WAAW,CAAC;AAC/D,0BAA0B,iCAAiC,EAAE;AAC7D,mCAAmC,mBAAmB,CAAC;;AAEvD,SAAS;;AAET;mDACmD;;AAEnD;EACE,kBAAkB;EAClB,gBAAgB;EAChB,iBAAiB;AACnB;;AAEA;EACE,2BAA2B,EAAE,4CAA4C;EACzE,wEAAwE;EACxE,wCAAwC;EACxC,oBAAoB,EAAE,mBAAmB;EACzC,oBAAoB;EACpB,YAAY;EACZ,aAAa,EAAE,mDAAmD;EAClE,kBAAkB;AACpB;AACA;EACE,kBAAkB;EAClB,oCAAoC;AACtC;;AAEA;;0BAE0B;AAC1B;EACE,kBAAkB;EAClB,UAAU;EACV,aAAa;EACb,aAAa;AACf;AACA;EACE,QAAQ,EAAE,MAAM;EAChB,kBAAkB;EAClB,kBAAkB;AACpB;AACA;EACE,SAAS,EAAE,OAAO;EAClB,kBAAkB;EAClB,kBAAkB;AACpB;AACA;EACE,QAAQ,EAAE,SAAS;AACrB;AACA;EACE,OAAO,EAAE,SAAS;AACpB;;AAEA;EACE,kBAAkB,EAAE,OAAO,EAAE,MAAM;EACnC,gBAAgB;EAChB,UAAU;AACZ;AACA;EACE,mBAAmB;EACnB,YAAY;EACZ,qBAAqB;EACrB,mBAAmB;EACnB,oBAAoB;AACtB;AACA;EACE,kBAAkB;EAClB,UAAU;EACV,2BAA2B;EAC3B,uBAAuB;AACzB;AACA;EACE,kBAAkB;EAClB,MAAM,EAAE,SAAS;EACjB,UAAU;AACZ;AACA;EACE,kBAAkB;EAClB,eAAe;EACf,UAAU;AACZ;AACA,yCAAyC,8BAA8B;AACvE,8CAA8C,8BAA8B;;AAE5E;EACE,YAAY;EACZ,eAAe,EAAE,0CAA0C;AAC7D;AACA;;EAEE,+DAA+D;EAC/D,qBAAqB,EAAE,wBAAwB,EAAE,gBAAgB;EACjE,eAAe;EACf,uBAAuB;EACvB,oBAAoB;EACpB,kBAAkB;EAClB,SAAS;EACT,gBAAgB;EAChB,iBAAiB;EACjB,oBAAoB;EACpB,cAAc;EACd,UAAU;EACV,kBAAkB;EAClB,iBAAiB;EACjB,wCAAwC;EACxC,0CAA0C;EAC1C,kCAAkC;AACpC;AACA;;EAEE,qBAAqB;EACrB,qBAAqB;EACrB,kBAAkB;AACpB;;AAEA;EACE,kBAAkB;EAClB,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS;EACpC,UAAU;AACZ;;AAEA;EACE,kBAAkB;EAClB,UAAU;EACV,cAAc,EAAE,yDAAyD;AAC3E;;AAEA,oBAAoB;;AAEpB,sBAAsB,cAAc,EAAE;;AAEtC;EACE,aAAa;AACf;;AAEA,iEAAiE;AACjE;;;;;EAKE,4BAA4B;EAC5B,uBAAuB;AACzB;;AAEA;EACE,kBAAkB;EAClB,WAAW;EACX,SAAS;EACT,gBAAgB;EAChB,kBAAkB;AACpB;;AAEA;EACE,kBAAkB;EAClB,oBAAoB;AACtB;AACA,0BAA0B,gBAAgB,EAAE;;AAE5C;EACE,kBAAkB;EAClB,kBAAkB;EAClB,UAAU;AACZ;AACA;EACE,mBAAmB;AACrB;;AAEA;EACE,mBAAmB;AACrB;;AAEA,uBAAuB,mBAAmB,EAAE;AAC5C,2CAA2C,mBAAmB,EAAE;AAChE,wBAAwB,iBAAiB,EAAE;AAC3C,6GAA6G,mBAAmB,EAAE;AAClI,4HAA4H,mBAAmB,EAAE;;AAEjJ;EACE,sBAAsB;EACtB,uCAAuC;AACzC;;AAEA,4CAA4C;AAC5C,mBAAmB,mBAAmB,EAAE;;AAExC;EACE,kCAAkC;EAClC;IACE,kBAAkB;EACpB;AACF;;AAEA,oBAAoB;AACpB,0BAA0B,WAAW,EAAE;;AAEvC,iEAAiE;AACjE,+BAA+B,gBAAgB,EAAE\",\"sourcesContent\":[\"/* BASICS */\\n\\n.CodeMirror {\\n /* Set height, width, borders, and global font properties here */\\n font-family: monospace;\\n height: 300px;\\n color: black;\\n direction: ltr;\\n}\\n\\n/* PADDING */\\n\\n.CodeMirror-lines {\\n padding: 4px 0; /* Vertical padding around content */\\n}\\n.CodeMirror pre.CodeMirror-line,\\n.CodeMirror pre.CodeMirror-line-like {\\n padding: 0 4px; /* Horizontal padding of content */\\n}\\n\\n.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {\\n background-color: white; /* The little square between H and V scrollbars */\\n}\\n\\n/* GUTTER */\\n\\n.CodeMirror-gutters {\\n border-right: 1px solid #ddd;\\n background-color: #f7f7f7;\\n white-space: nowrap;\\n}\\n.CodeMirror-linenumbers {}\\n.CodeMirror-linenumber {\\n padding: 0 3px 0 5px;\\n min-width: 20px;\\n text-align: right;\\n color: #999;\\n white-space: nowrap;\\n}\\n\\n.CodeMirror-guttermarker { color: black; }\\n.CodeMirror-guttermarker-subtle { color: #999; }\\n\\n/* CURSOR */\\n\\n.CodeMirror-cursor {\\n border-left: 1px solid black;\\n border-right: none;\\n width: 0;\\n}\\n/* Shown when moving in bi-directional text */\\n.CodeMirror div.CodeMirror-secondarycursor {\\n border-left: 1px solid silver;\\n}\\n.cm-fat-cursor .CodeMirror-cursor {\\n width: auto;\\n border: 0 !important;\\n background: #7e7;\\n}\\n.cm-fat-cursor div.CodeMirror-cursors {\\n z-index: 1;\\n}\\n.cm-fat-cursor-mark {\\n background-color: rgba(20, 255, 20, 0.5);\\n -webkit-animation: blink 1.06s steps(1) infinite;\\n -moz-animation: blink 1.06s steps(1) infinite;\\n animation: blink 1.06s steps(1) infinite;\\n}\\n.cm-animate-fat-cursor {\\n width: auto;\\n border: 0;\\n -webkit-animation: blink 1.06s steps(1) infinite;\\n -moz-animation: blink 1.06s steps(1) infinite;\\n animation: blink 1.06s steps(1) infinite;\\n background-color: #7e7;\\n}\\n@-moz-keyframes blink {\\n 0% {}\\n 50% { background-color: transparent; }\\n 100% {}\\n}\\n@-webkit-keyframes blink {\\n 0% {}\\n 50% { background-color: transparent; }\\n 100% {}\\n}\\n@keyframes blink {\\n 0% {}\\n 50% { background-color: transparent; }\\n 100% {}\\n}\\n\\n/* Can style cursor different in overwrite (non-insert) mode */\\n.CodeMirror-overwrite .CodeMirror-cursor {}\\n\\n.cm-tab { display: inline-block; text-decoration: inherit; }\\n\\n.CodeMirror-rulers {\\n position: absolute;\\n left: 0; right: 0; top: -50px; bottom: 0;\\n overflow: hidden;\\n}\\n.CodeMirror-ruler {\\n border-left: 1px solid #ccc;\\n top: 0; bottom: 0;\\n position: absolute;\\n}\\n\\n/* DEFAULT THEME */\\n\\n.cm-s-default .cm-header {color: blue;}\\n.cm-s-default .cm-quote {color: #090;}\\n.cm-negative {color: #d44;}\\n.cm-positive {color: #292;}\\n.cm-header, .cm-strong {font-weight: bold;}\\n.cm-em {font-style: italic;}\\n.cm-link {text-decoration: underline;}\\n.cm-strikethrough {text-decoration: line-through;}\\n\\n.cm-s-default .cm-keyword {color: #708;}\\n.cm-s-default .cm-atom {color: #219;}\\n.cm-s-default .cm-number {color: #164;}\\n.cm-s-default .cm-def {color: #00f;}\\n.cm-s-default .cm-variable,\\n.cm-s-default .cm-punctuation,\\n.cm-s-default .cm-property,\\n.cm-s-default .cm-operator {}\\n.cm-s-default .cm-variable-2 {color: #05a;}\\n.cm-s-default .cm-variable-3, .cm-s-default .cm-type {color: #085;}\\n.cm-s-default .cm-comment {color: #a50;}\\n.cm-s-default .cm-string {color: #a11;}\\n.cm-s-default .cm-string-2 {color: #f50;}\\n.cm-s-default .cm-meta {color: #555;}\\n.cm-s-default .cm-qualifier {color: #555;}\\n.cm-s-default .cm-builtin {color: #30a;}\\n.cm-s-default .cm-bracket {color: #997;}\\n.cm-s-default .cm-tag {color: #170;}\\n.cm-s-default .cm-attribute {color: #00c;}\\n.cm-s-default .cm-hr {color: #999;}\\n.cm-s-default .cm-link {color: #00c;}\\n\\n.cm-s-default .cm-error {color: #f00;}\\n.cm-invalidchar {color: #f00;}\\n\\n.CodeMirror-composing { border-bottom: 2px solid; }\\n\\n/* Default styles for common addons */\\n\\ndiv.CodeMirror span.CodeMirror-matchingbracket {color: #0b0;}\\ndiv.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}\\n.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }\\n.CodeMirror-activeline-background {background: #e8f2ff;}\\n\\n/* STOP */\\n\\n/* The rest of this file contains styles related to the mechanics of\\n the editor. You probably shouldn't touch them. */\\n\\n.CodeMirror {\\n position: relative;\\n overflow: hidden;\\n background: white;\\n}\\n\\n.CodeMirror-scroll {\\n overflow: scroll !important; /* Things will break if this is overridden */\\n /* 50px is the magic margin used to hide the element's real scrollbars */\\n /* See overflow: hidden in .CodeMirror */\\n margin-bottom: -50px; margin-right: -50px;\\n padding-bottom: 50px;\\n height: 100%;\\n outline: none; /* Prevent dragging from highlighting the element */\\n position: relative;\\n}\\n.CodeMirror-sizer {\\n position: relative;\\n border-right: 50px solid transparent;\\n}\\n\\n/* The fake, visible scrollbars. Used to force redraw during scrolling\\n before actual scrolling happens, thus preventing shaking and\\n flickering artifacts. */\\n.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {\\n position: absolute;\\n z-index: 6;\\n display: none;\\n outline: none;\\n}\\n.CodeMirror-vscrollbar {\\n right: 0; top: 0;\\n overflow-x: hidden;\\n overflow-y: scroll;\\n}\\n.CodeMirror-hscrollbar {\\n bottom: 0; left: 0;\\n overflow-y: hidden;\\n overflow-x: scroll;\\n}\\n.CodeMirror-scrollbar-filler {\\n right: 0; bottom: 0;\\n}\\n.CodeMirror-gutter-filler {\\n left: 0; bottom: 0;\\n}\\n\\n.CodeMirror-gutters {\\n position: absolute; left: 0; top: 0;\\n min-height: 100%;\\n z-index: 3;\\n}\\n.CodeMirror-gutter {\\n white-space: normal;\\n height: 100%;\\n display: inline-block;\\n vertical-align: top;\\n margin-bottom: -50px;\\n}\\n.CodeMirror-gutter-wrapper {\\n position: absolute;\\n z-index: 4;\\n background: none !important;\\n border: none !important;\\n}\\n.CodeMirror-gutter-background {\\n position: absolute;\\n top: 0; bottom: 0;\\n z-index: 4;\\n}\\n.CodeMirror-gutter-elt {\\n position: absolute;\\n cursor: default;\\n z-index: 4;\\n}\\n.CodeMirror-gutter-wrapper ::selection { background-color: transparent }\\n.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }\\n\\n.CodeMirror-lines {\\n cursor: text;\\n min-height: 1px; /* prevents collapsing before first draw */\\n}\\n.CodeMirror pre.CodeMirror-line,\\n.CodeMirror pre.CodeMirror-line-like {\\n /* Reset some styles that the rest of the page might have set */\\n -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;\\n border-width: 0;\\n background: transparent;\\n font-family: inherit;\\n font-size: inherit;\\n margin: 0;\\n white-space: pre;\\n word-wrap: normal;\\n line-height: inherit;\\n color: inherit;\\n z-index: 2;\\n position: relative;\\n overflow: visible;\\n -webkit-tap-highlight-color: transparent;\\n -webkit-font-variant-ligatures: contextual;\\n font-variant-ligatures: contextual;\\n}\\n.CodeMirror-wrap pre.CodeMirror-line,\\n.CodeMirror-wrap pre.CodeMirror-line-like {\\n word-wrap: break-word;\\n white-space: pre-wrap;\\n word-break: normal;\\n}\\n\\n.CodeMirror-linebackground {\\n position: absolute;\\n left: 0; right: 0; top: 0; bottom: 0;\\n z-index: 0;\\n}\\n\\n.CodeMirror-linewidget {\\n position: relative;\\n z-index: 2;\\n padding: 0.1px; /* Force widget margins to stay inside of the container */\\n}\\n\\n.CodeMirror-widget {}\\n\\n.CodeMirror-rtl pre { direction: rtl; }\\n\\n.CodeMirror-code {\\n outline: none;\\n}\\n\\n/* Force content-box sizing for the elements where we expect it */\\n.CodeMirror-scroll,\\n.CodeMirror-sizer,\\n.CodeMirror-gutter,\\n.CodeMirror-gutters,\\n.CodeMirror-linenumber {\\n -moz-box-sizing: content-box;\\n box-sizing: content-box;\\n}\\n\\n.CodeMirror-measure {\\n position: absolute;\\n width: 100%;\\n height: 0;\\n overflow: hidden;\\n visibility: hidden;\\n}\\n\\n.CodeMirror-cursor {\\n position: absolute;\\n pointer-events: none;\\n}\\n.CodeMirror-measure pre { position: static; }\\n\\ndiv.CodeMirror-cursors {\\n visibility: hidden;\\n position: relative;\\n z-index: 3;\\n}\\ndiv.CodeMirror-dragcursors {\\n visibility: visible;\\n}\\n\\n.CodeMirror-focused div.CodeMirror-cursors {\\n visibility: visible;\\n}\\n\\n.CodeMirror-selected { background: #d9d9d9; }\\n.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }\\n.CodeMirror-crosshair { cursor: crosshair; }\\n.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }\\n.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }\\n\\n.cm-searching {\\n background-color: #ffa;\\n background-color: rgba(255, 255, 0, .4);\\n}\\n\\n/* Used to force a border model for a node */\\n.cm-force-border { padding-right: .1px; }\\n\\n@media print {\\n /* Hide the cursor when printing */\\n .CodeMirror div.CodeMirror-cursors {\\n visibility: hidden;\\n }\\n}\\n\\n/* See issue #2901 */\\n.cm-tab-wrap-hack:after { content: ''; }\\n\\n/* Help users use markselection to safely style text background */\\nspan.CodeMirror-selectedtext { background: none; }\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../packages/thebe/node_modules/css-loader/dist/runtime/cssWithMappingToString.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../packages/thebe/node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \".cm-s-abcdef.CodeMirror { background: #0f0f0f; color: #defdef; }\\n.cm-s-abcdef div.CodeMirror-selected { background: #515151; }\\n.cm-s-abcdef .CodeMirror-line::selection, .cm-s-abcdef .CodeMirror-line > span::selection, .cm-s-abcdef .CodeMirror-line > span > span::selection { background: rgba(56, 56, 56, 0.99); }\\n.cm-s-abcdef .CodeMirror-line::-moz-selection, .cm-s-abcdef .CodeMirror-line > span::-moz-selection, .cm-s-abcdef .CodeMirror-line > span > span::-moz-selection { background: rgba(56, 56, 56, 0.99); }\\n.cm-s-abcdef .CodeMirror-gutters { background: #555; border-right: 2px solid #314151; }\\n.cm-s-abcdef .CodeMirror-guttermarker { color: #222; }\\n.cm-s-abcdef .CodeMirror-guttermarker-subtle { color: azure; }\\n.cm-s-abcdef .CodeMirror-linenumber { color: #FFFFFF; }\\n.cm-s-abcdef .CodeMirror-cursor { border-left: 1px solid #00FF00; }\\n\\n.cm-s-abcdef span.cm-keyword { color: darkgoldenrod; font-weight: bold; }\\n.cm-s-abcdef span.cm-atom { color: #77F; }\\n.cm-s-abcdef span.cm-number { color: violet; }\\n.cm-s-abcdef span.cm-def { color: #fffabc; }\\n.cm-s-abcdef span.cm-variable { color: #abcdef; }\\n.cm-s-abcdef span.cm-variable-2 { color: #cacbcc; }\\n.cm-s-abcdef span.cm-variable-3, .cm-s-abcdef span.cm-type { color: #def; }\\n.cm-s-abcdef span.cm-property { color: #fedcba; }\\n.cm-s-abcdef span.cm-operator { color: #ff0; }\\n.cm-s-abcdef span.cm-comment { color: #7a7b7c; font-style: italic;}\\n.cm-s-abcdef span.cm-string { color: #2b4; }\\n.cm-s-abcdef span.cm-meta { color: #C9F; }\\n.cm-s-abcdef span.cm-qualifier { color: #FFF700; }\\n.cm-s-abcdef span.cm-builtin { color: #30aabc; }\\n.cm-s-abcdef span.cm-bracket { color: #8a8a8a; }\\n.cm-s-abcdef span.cm-tag { color: #FFDD44; }\\n.cm-s-abcdef span.cm-attribute { color: #DDFF00; }\\n.cm-s-abcdef span.cm-error { color: #FF0000; }\\n.cm-s-abcdef span.cm-header { color: aquamarine; font-weight: bold; }\\n.cm-s-abcdef span.cm-link { color: blueviolet; }\\n\\n.cm-s-abcdef .CodeMirror-activeline-background { background: #314151; }\\n\", \"\",{\"version\":3,\"sources\":[\"webpack://./../../node_modules/codemirror/theme/abcdef.css\"],\"names\":[],\"mappings\":\"AAAA,0BAA0B,mBAAmB,EAAE,cAAc,EAAE;AAC/D,uCAAuC,mBAAmB,EAAE;AAC5D,oJAAoJ,kCAAkC,EAAE;AACxL,mKAAmK,kCAAkC,EAAE;AACvM,mCAAmC,gBAAgB,EAAE,+BAA+B,EAAE;AACtF,wCAAwC,WAAW,EAAE;AACrD,+CAA+C,YAAY,EAAE;AAC7D,sCAAsC,cAAc,EAAE;AACtD,kCAAkC,8BAA8B,EAAE;;AAElE,+BAA+B,oBAAoB,EAAE,iBAAiB,EAAE;AACxE,4BAA4B,WAAW,EAAE;AACzC,8BAA8B,aAAa,EAAE;AAC7C,2BAA2B,cAAc,EAAE;AAC3C,gCAAgC,cAAc,EAAE;AAChD,kCAAkC,cAAc,EAAE;AAClD,6DAA6D,WAAW,EAAE;AAC1E,gCAAgC,cAAc,EAAE;AAChD,gCAAgC,WAAW,EAAE;AAC7C,+BAA+B,cAAc,EAAE,kBAAkB,CAAC;AAClE,8BAA8B,WAAW,EAAE;AAC3C,4BAA4B,WAAW,EAAE;AACzC,iCAAiC,cAAc,EAAE;AACjD,+BAA+B,cAAc,EAAE;AAC/C,+BAA+B,cAAc,EAAE;AAC/C,2BAA2B,cAAc,EAAE;AAC3C,iCAAiC,cAAc,EAAE;AACjD,6BAA6B,cAAc,EAAE;AAC7C,8BAA8B,iBAAiB,EAAE,iBAAiB,EAAE;AACpE,4BAA4B,iBAAiB,EAAE;;AAE/C,iDAAiD,mBAAmB,EAAE\",\"sourcesContent\":[\".cm-s-abcdef.CodeMirror { background: #0f0f0f; color: #defdef; }\\n.cm-s-abcdef div.CodeMirror-selected { background: #515151; }\\n.cm-s-abcdef .CodeMirror-line::selection, .cm-s-abcdef .CodeMirror-line > span::selection, .cm-s-abcdef .CodeMirror-line > span > span::selection { background: rgba(56, 56, 56, 0.99); }\\n.cm-s-abcdef .CodeMirror-line::-moz-selection, .cm-s-abcdef .CodeMirror-line > span::-moz-selection, .cm-s-abcdef .CodeMirror-line > span > span::-moz-selection { background: rgba(56, 56, 56, 0.99); }\\n.cm-s-abcdef .CodeMirror-gutters { background: #555; border-right: 2px solid #314151; }\\n.cm-s-abcdef .CodeMirror-guttermarker { color: #222; }\\n.cm-s-abcdef .CodeMirror-guttermarker-subtle { color: azure; }\\n.cm-s-abcdef .CodeMirror-linenumber { color: #FFFFFF; }\\n.cm-s-abcdef .CodeMirror-cursor { border-left: 1px solid #00FF00; }\\n\\n.cm-s-abcdef span.cm-keyword { color: darkgoldenrod; font-weight: bold; }\\n.cm-s-abcdef span.cm-atom { color: #77F; }\\n.cm-s-abcdef span.cm-number { color: violet; }\\n.cm-s-abcdef span.cm-def { color: #fffabc; }\\n.cm-s-abcdef span.cm-variable { color: #abcdef; }\\n.cm-s-abcdef span.cm-variable-2 { color: #cacbcc; }\\n.cm-s-abcdef span.cm-variable-3, .cm-s-abcdef span.cm-type { color: #def; }\\n.cm-s-abcdef span.cm-property { color: #fedcba; }\\n.cm-s-abcdef span.cm-operator { color: #ff0; }\\n.cm-s-abcdef span.cm-comment { color: #7a7b7c; font-style: italic;}\\n.cm-s-abcdef span.cm-string { color: #2b4; }\\n.cm-s-abcdef span.cm-meta { color: #C9F; }\\n.cm-s-abcdef span.cm-qualifier { color: #FFF700; }\\n.cm-s-abcdef span.cm-builtin { color: #30aabc; }\\n.cm-s-abcdef span.cm-bracket { color: #8a8a8a; }\\n.cm-s-abcdef span.cm-tag { color: #FFDD44; }\\n.cm-s-abcdef span.cm-attribute { color: #DDFF00; }\\n.cm-s-abcdef span.cm-error { color: #FF0000; }\\n.cm-s-abcdef span.cm-header { color: aquamarine; font-weight: bold; }\\n.cm-s-abcdef span.cm-link { color: blueviolet; }\\n\\n.cm-s-abcdef .CodeMirror-activeline-background { background: #314151; }\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../packages/thebe/node_modules/css-loader/dist/runtime/cssWithMappingToString.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../packages/thebe/node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/**\\n Name: IntelliJ IDEA darcula theme\\n From IntelliJ IDEA by JetBrains\\n */\\n\\n.cm-s-darcula { font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif;}\\n.cm-s-darcula.CodeMirror { background: #2B2B2B; color: #A9B7C6; }\\n\\n.cm-s-darcula span.cm-meta { color: #BBB529; }\\n.cm-s-darcula span.cm-number { color: #6897BB; }\\n.cm-s-darcula span.cm-keyword { color: #CC7832; line-height: 1em; font-weight: bold; }\\n.cm-s-darcula span.cm-def { color: #A9B7C6; font-style: italic; }\\n.cm-s-darcula span.cm-variable { color: #A9B7C6; }\\n.cm-s-darcula span.cm-variable-2 { color: #A9B7C6; }\\n.cm-s-darcula span.cm-variable-3 { color: #9876AA; }\\n.cm-s-darcula span.cm-type { color: #AABBCC; font-weight: bold; }\\n.cm-s-darcula span.cm-property { color: #FFC66D; }\\n.cm-s-darcula span.cm-operator { color: #A9B7C6; }\\n.cm-s-darcula span.cm-string { color: #6A8759; }\\n.cm-s-darcula span.cm-string-2 { color: #6A8759; }\\n.cm-s-darcula span.cm-comment { color: #61A151; font-style: italic; }\\n.cm-s-darcula span.cm-link { color: #CC7832; }\\n.cm-s-darcula span.cm-atom { color: #CC7832; }\\n.cm-s-darcula span.cm-error { color: #BC3F3C; }\\n.cm-s-darcula span.cm-tag { color: #629755; font-weight: bold; font-style: italic; text-decoration: underline; }\\n.cm-s-darcula span.cm-attribute { color: #6897bb; }\\n.cm-s-darcula span.cm-qualifier { color: #6A8759; }\\n.cm-s-darcula span.cm-bracket { color: #A9B7C6; }\\n.cm-s-darcula span.cm-builtin { color: #FF9E59; }\\n.cm-s-darcula span.cm-special { color: #FF9E59; }\\n.cm-s-darcula span.cm-matchhighlight { color: #FFFFFF; background-color: rgba(50, 89, 48, .7); font-weight: normal;}\\n.cm-s-darcula span.cm-searching { color: #FFFFFF; background-color: rgba(61, 115, 59, .7); font-weight: normal;}\\n\\n.cm-s-darcula .CodeMirror-cursor { border-left: 1px solid #A9B7C6; }\\n.cm-s-darcula .CodeMirror-activeline-background { background: #323232; }\\n.cm-s-darcula .CodeMirror-gutters { background: #313335; border-right: 1px solid #313335; }\\n.cm-s-darcula .CodeMirror-guttermarker { color: #FFEE80; }\\n.cm-s-darcula .CodeMirror-guttermarker-subtle { color: #D0D0D0; }\\n.cm-s-darcula .CodeMirrir-linenumber { color: #606366; }\\n.cm-s-darcula .CodeMirror-matchingbracket { background-color: #3B514D; color: #FFEF28 !important; font-weight: bold; }\\n\\n.cm-s-darcula div.CodeMirror-selected { background: #214283; }\\n\\n.CodeMirror-hints.darcula {\\n font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;\\n color: #9C9E9E;\\n background-color: #3B3E3F !important;\\n}\\n\\n.CodeMirror-hints.darcula .CodeMirror-hint-active {\\n background-color: #494D4E !important;\\n color: #9C9E9E !important;\\n}\\n\", \"\",{\"version\":3,\"sources\":[\"webpack://./../../node_modules/codemirror/theme/darcula.css\"],\"names\":[],\"mappings\":\"AAAA;;;EAGE;;AAEF,iBAAiB,0JAA0J,CAAC;AAC5K,2BAA2B,mBAAmB,EAAE,cAAc,EAAE;;AAEhE,6BAA6B,cAAc,EAAE;AAC7C,+BAA+B,cAAc,EAAE;AAC/C,gCAAgC,cAAc,EAAE,gBAAgB,EAAE,iBAAiB,EAAE;AACrF,4BAA4B,cAAc,EAAE,kBAAkB,EAAE;AAChE,iCAAiC,cAAc,EAAE;AACjD,mCAAmC,cAAc,EAAE;AACnD,mCAAmC,cAAc,EAAE;AACnD,6BAA6B,cAAc,EAAE,iBAAiB,EAAE;AAChE,iCAAiC,cAAc,EAAE;AACjD,iCAAiC,cAAc,EAAE;AACjD,+BAA+B,cAAc,EAAE;AAC/C,iCAAiC,cAAc,EAAE;AACjD,gCAAgC,cAAc,EAAE,kBAAkB,EAAE;AACpE,6BAA6B,cAAc,EAAE;AAC7C,6BAA6B,cAAc,EAAE;AAC7C,8BAA8B,cAAc,EAAE;AAC9C,4BAA4B,cAAc,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,0BAA0B,EAAE;AAC/G,kCAAkC,cAAc,EAAE;AAClD,kCAAkC,cAAc,EAAE;AAClD,gCAAgC,cAAc,EAAE;AAChD,gCAAgC,cAAc,EAAE;AAChD,gCAAgC,cAAc,EAAE;AAChD,uCAAuC,cAAc,EAAE,sCAAsC,EAAE,mBAAmB,CAAC;AACnH,kCAAkC,cAAc,EAAE,uCAAuC,EAAE,mBAAmB,CAAC;;AAE/G,mCAAmC,8BAA8B,EAAE;AACnE,kDAAkD,mBAAmB,EAAE;AACvE,oCAAoC,mBAAmB,EAAE,+BAA+B,EAAE;AAC1F,yCAAyC,cAAc,EAAE;AACzD,gDAAgD,cAAc,EAAE;AAChE,uCAAuC,cAAc,EAAE;AACvD,4CAA4C,yBAAyB,EAAE,yBAAyB,EAAE,iBAAiB,EAAE;;AAErH,wCAAwC,mBAAmB,EAAE;;AAE7D;EACE,8DAA8D;EAC9D,cAAc;EACd,oCAAoC;AACtC;;AAEA;EACE,oCAAoC;EACpC,yBAAyB;AAC3B\",\"sourcesContent\":[\"/**\\n Name: IntelliJ IDEA darcula theme\\n From IntelliJ IDEA by JetBrains\\n */\\n\\n.cm-s-darcula { font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif;}\\n.cm-s-darcula.CodeMirror { background: #2B2B2B; color: #A9B7C6; }\\n\\n.cm-s-darcula span.cm-meta { color: #BBB529; }\\n.cm-s-darcula span.cm-number { color: #6897BB; }\\n.cm-s-darcula span.cm-keyword { color: #CC7832; line-height: 1em; font-weight: bold; }\\n.cm-s-darcula span.cm-def { color: #A9B7C6; font-style: italic; }\\n.cm-s-darcula span.cm-variable { color: #A9B7C6; }\\n.cm-s-darcula span.cm-variable-2 { color: #A9B7C6; }\\n.cm-s-darcula span.cm-variable-3 { color: #9876AA; }\\n.cm-s-darcula span.cm-type { color: #AABBCC; font-weight: bold; }\\n.cm-s-darcula span.cm-property { color: #FFC66D; }\\n.cm-s-darcula span.cm-operator { color: #A9B7C6; }\\n.cm-s-darcula span.cm-string { color: #6A8759; }\\n.cm-s-darcula span.cm-string-2 { color: #6A8759; }\\n.cm-s-darcula span.cm-comment { color: #61A151; font-style: italic; }\\n.cm-s-darcula span.cm-link { color: #CC7832; }\\n.cm-s-darcula span.cm-atom { color: #CC7832; }\\n.cm-s-darcula span.cm-error { color: #BC3F3C; }\\n.cm-s-darcula span.cm-tag { color: #629755; font-weight: bold; font-style: italic; text-decoration: underline; }\\n.cm-s-darcula span.cm-attribute { color: #6897bb; }\\n.cm-s-darcula span.cm-qualifier { color: #6A8759; }\\n.cm-s-darcula span.cm-bracket { color: #A9B7C6; }\\n.cm-s-darcula span.cm-builtin { color: #FF9E59; }\\n.cm-s-darcula span.cm-special { color: #FF9E59; }\\n.cm-s-darcula span.cm-matchhighlight { color: #FFFFFF; background-color: rgba(50, 89, 48, .7); font-weight: normal;}\\n.cm-s-darcula span.cm-searching { color: #FFFFFF; background-color: rgba(61, 115, 59, .7); font-weight: normal;}\\n\\n.cm-s-darcula .CodeMirror-cursor { border-left: 1px solid #A9B7C6; }\\n.cm-s-darcula .CodeMirror-activeline-background { background: #323232; }\\n.cm-s-darcula .CodeMirror-gutters { background: #313335; border-right: 1px solid #313335; }\\n.cm-s-darcula .CodeMirror-guttermarker { color: #FFEE80; }\\n.cm-s-darcula .CodeMirror-guttermarker-subtle { color: #D0D0D0; }\\n.cm-s-darcula .CodeMirrir-linenumber { color: #606366; }\\n.cm-s-darcula .CodeMirror-matchingbracket { background-color: #3B514D; color: #FFEF28 !important; font-weight: bold; }\\n\\n.cm-s-darcula div.CodeMirror-selected { background: #214283; }\\n\\n.CodeMirror-hints.darcula {\\n font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;\\n color: #9C9E9E;\\n background-color: #3B3E3F !important;\\n}\\n\\n.CodeMirror-hints.darcula .CodeMirror-hint-active {\\n background-color: #494D4E !important;\\n color: #9C9E9E !important;\\n}\\n\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","// Imports\nimport ___CSS_LOADER_API_SOURCEMAP_IMPORT___ from \"../../../packages/thebe/node_modules/css-loader/dist/runtime/cssWithMappingToString.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../packages/thebe/node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/**\\n Name: IDEA default theme\\n From IntelliJ IDEA by JetBrains\\n */\\n\\n.cm-s-idea span.cm-meta { color: #808000; }\\n.cm-s-idea span.cm-number { color: #0000FF; }\\n.cm-s-idea span.cm-keyword { line-height: 1em; font-weight: bold; color: #000080; }\\n.cm-s-idea span.cm-atom { font-weight: bold; color: #000080; }\\n.cm-s-idea span.cm-def { color: #000000; }\\n.cm-s-idea span.cm-variable { color: black; }\\n.cm-s-idea span.cm-variable-2 { color: black; }\\n.cm-s-idea span.cm-variable-3, .cm-s-idea span.cm-type { color: black; }\\n.cm-s-idea span.cm-property { color: black; }\\n.cm-s-idea span.cm-operator { color: black; }\\n.cm-s-idea span.cm-comment { color: #808080; }\\n.cm-s-idea span.cm-string { color: #008000; }\\n.cm-s-idea span.cm-string-2 { color: #008000; }\\n.cm-s-idea span.cm-qualifier { color: #555; }\\n.cm-s-idea span.cm-error { color: #FF0000; }\\n.cm-s-idea span.cm-attribute { color: #0000FF; }\\n.cm-s-idea span.cm-tag { color: #000080; }\\n.cm-s-idea span.cm-link { color: #0000FF; }\\n.cm-s-idea .CodeMirror-activeline-background { background: #FFFAE3; }\\n\\n.cm-s-idea span.cm-builtin { color: #30a; }\\n.cm-s-idea span.cm-bracket { color: #cc7; }\\n.cm-s-idea { font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;}\\n\\n\\n.cm-s-idea .CodeMirror-matchingbracket { outline:1px solid grey; color:black !important; }\\n\\n.CodeMirror-hints.idea {\\n font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;\\n color: #616569;\\n background-color: #ebf3fd !important;\\n}\\n\\n.CodeMirror-hints.idea .CodeMirror-hint-active {\\n background-color: #a2b8c9 !important;\\n color: #5c6065 !important;\\n}\", \"\",{\"version\":3,\"sources\":[\"webpack://./../../node_modules/codemirror/theme/idea.css\"],\"names\":[],\"mappings\":\"AAAA;;;EAGE;;AAEF,0BAA0B,cAAc,EAAE;AAC1C,4BAA4B,cAAc,EAAE;AAC5C,6BAA6B,gBAAgB,EAAE,iBAAiB,EAAE,cAAc,EAAE;AAClF,0BAA0B,iBAAiB,EAAE,cAAc,EAAE;AAC7D,yBAAyB,cAAc,EAAE;AACzC,8BAA8B,YAAY,EAAE;AAC5C,gCAAgC,YAAY,EAAE;AAC9C,yDAAyD,YAAY,EAAE;AACvE,8BAA8B,YAAY,EAAE;AAC5C,8BAA8B,YAAY,EAAE;AAC5C,6BAA6B,cAAc,EAAE;AAC7C,4BAA4B,cAAc,EAAE;AAC5C,8BAA8B,cAAc,EAAE;AAC9C,+BAA+B,WAAW,EAAE;AAC5C,2BAA2B,cAAc,EAAE;AAC3C,+BAA+B,cAAc,EAAE;AAC/C,yBAAyB,cAAc,EAAE;AACzC,0BAA0B,cAAc,EAAE;AAC1C,+CAA+C,mBAAmB,EAAE;;AAEpE,6BAA6B,WAAW,EAAE;AAC1C,6BAA6B,WAAW,EAAE;AAC1C,cAAc,gJAAgJ,CAAC;;;AAG/J,yCAAyC,sBAAsB,EAAE,sBAAsB,EAAE;;AAEzF;EACE,8DAA8D;EAC9D,cAAc;EACd,oCAAoC;AACtC;;AAEA;EACE,oCAAoC;EACpC,yBAAyB;AAC3B\",\"sourcesContent\":[\"/**\\n Name: IDEA default theme\\n From IntelliJ IDEA by JetBrains\\n */\\n\\n.cm-s-idea span.cm-meta { color: #808000; }\\n.cm-s-idea span.cm-number { color: #0000FF; }\\n.cm-s-idea span.cm-keyword { line-height: 1em; font-weight: bold; color: #000080; }\\n.cm-s-idea span.cm-atom { font-weight: bold; color: #000080; }\\n.cm-s-idea span.cm-def { color: #000000; }\\n.cm-s-idea span.cm-variable { color: black; }\\n.cm-s-idea span.cm-variable-2 { color: black; }\\n.cm-s-idea span.cm-variable-3, .cm-s-idea span.cm-type { color: black; }\\n.cm-s-idea span.cm-property { color: black; }\\n.cm-s-idea span.cm-operator { color: black; }\\n.cm-s-idea span.cm-comment { color: #808080; }\\n.cm-s-idea span.cm-string { color: #008000; }\\n.cm-s-idea span.cm-string-2 { color: #008000; }\\n.cm-s-idea span.cm-qualifier { color: #555; }\\n.cm-s-idea span.cm-error { color: #FF0000; }\\n.cm-s-idea span.cm-attribute { color: #0000FF; }\\n.cm-s-idea span.cm-tag { color: #000080; }\\n.cm-s-idea span.cm-link { color: #0000FF; }\\n.cm-s-idea .CodeMirror-activeline-background { background: #FFFAE3; }\\n\\n.cm-s-idea span.cm-builtin { color: #30a; }\\n.cm-s-idea span.cm-bracket { color: #cc7; }\\n.cm-s-idea { font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;}\\n\\n\\n.cm-s-idea .CodeMirror-matchingbracket { outline:1px solid grey; color:black !important; }\\n\\n.CodeMirror-hints.idea {\\n font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;\\n color: #616569;\\n background-color: #ebf3fd !important;\\n}\\n\\n.CodeMirror-hints.idea .CodeMirror-hint-active {\\n background-color: #a2b8c9 !important;\\n color: #5c6065 !important;\\n}\"],\"sourceRoot\":\"\"}]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","\"use strict\";\n\n/*\n MIT License http://www.opensource.org/licenses/mit-license.php\n Author Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\n// eslint-disable-next-line func-names\nmodule.exports = function (cssWithMappingToString) {\n var list = []; // return the list of modules as css string\n\n list.toString = function toString() {\n return this.map(function (item) {\n var content = cssWithMappingToString(item);\n\n if (item[2]) {\n return \"@media \".concat(item[2], \" {\").concat(content, \"}\");\n }\n\n return content;\n }).join(\"\");\n }; // import a list of modules into the list\n // eslint-disable-next-line func-names\n\n\n list.i = function (modules, mediaQuery, dedupe) {\n if (typeof modules === \"string\") {\n // eslint-disable-next-line no-param-reassign\n modules = [[null, modules, \"\"]];\n }\n\n var alreadyImportedModules = {};\n\n if (dedupe) {\n for (var i = 0; i < this.length; i++) {\n // eslint-disable-next-line prefer-destructuring\n var id = this[i][0];\n\n if (id != null) {\n alreadyImportedModules[id] = true;\n }\n }\n }\n\n for (var _i = 0; _i < modules.length; _i++) {\n var item = [].concat(modules[_i]);\n\n if (dedupe && alreadyImportedModules[item[0]]) {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n if (mediaQuery) {\n if (!item[2]) {\n item[2] = mediaQuery;\n } else {\n item[2] = \"\".concat(mediaQuery, \" and \").concat(item[2]);\n }\n }\n\n list.push(item);\n }\n };\n\n return list;\n};","\"use strict\";\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nmodule.exports = function cssWithMappingToString(item) {\n var _item = _slicedToArray(item, 4),\n content = _item[1],\n cssMapping = _item[3];\n\n if (!cssMapping) {\n return content;\n }\n\n if (typeof btoa === \"function\") {\n // eslint-disable-next-line no-undef\n var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(cssMapping))));\n var data = \"sourceMappingURL=data:application/json;charset=utf-8;base64,\".concat(base64);\n var sourceMapping = \"/*# \".concat(data, \" */\");\n var sourceURLs = cssMapping.sources.map(function (source) {\n return \"/*# sourceURL=\".concat(cssMapping.sourceRoot || \"\").concat(source, \" */\");\n });\n return [content].concat(sourceURLs).concat([sourceMapping]).join(\"\\n\");\n }\n\n return [content].join(\"\\n\");\n};","import api from \"!../../../packages/thebe/node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import content from \"!!../../../packages/thebe/node_modules/css-loader/dist/cjs.js!./codemirror.css\";\n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = api(content, options);\n\n\n\nexport default content.locals || {};","import api from \"!../../../packages/thebe/node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import content from \"!!../../../packages/thebe/node_modules/css-loader/dist/cjs.js!./abcdef.css\";\n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = api(content, options);\n\n\n\nexport default content.locals || {};","import api from \"!../../../packages/thebe/node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import content from \"!!../../../packages/thebe/node_modules/css-loader/dist/cjs.js!./darcula.css\";\n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = api(content, options);\n\n\n\nexport default content.locals || {};","import api from \"!../../../packages/thebe/node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import content from \"!!../../../packages/thebe/node_modules/css-loader/dist/cjs.js!./idea.css\";\n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = api(content, options);\n\n\n\nexport default content.locals || {};","\"use strict\";\n\nvar isOldIE = function isOldIE() {\n var memo;\n return function memorize() {\n if (typeof memo === 'undefined') {\n // Test for IE <= 9 as proposed by Browserhacks\n // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805\n // Tests for existence of standard globals is to allow style-loader\n // to operate correctly into non-standard environments\n // @see https://github.com/webpack-contrib/style-loader/issues/177\n memo = Boolean(window && document && document.all && !window.atob);\n }\n\n return memo;\n };\n}();\n\nvar getTarget = function getTarget() {\n var memo = {};\n return function memorize(target) {\n if (typeof memo[target] === 'undefined') {\n var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself\n\n if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {\n try {\n // This will throw an exception if access to iframe is blocked\n // due to cross-origin restrictions\n styleTarget = styleTarget.contentDocument.head;\n } catch (e) {\n // istanbul ignore next\n styleTarget = null;\n }\n }\n\n memo[target] = styleTarget;\n }\n\n return memo[target];\n };\n}();\n\nvar stylesInDom = [];\n\nfunction getIndexByIdentifier(identifier) {\n var result = -1;\n\n for (var i = 0; i < stylesInDom.length; i++) {\n if (stylesInDom[i].identifier === identifier) {\n result = i;\n break;\n }\n }\n\n return result;\n}\n\nfunction modulesToDom(list, options) {\n var idCountMap = {};\n var identifiers = [];\n\n for (var i = 0; i < list.length; i++) {\n var item = list[i];\n var id = options.base ? item[0] + options.base : item[0];\n var count = idCountMap[id] || 0;\n var identifier = \"\".concat(id, \" \").concat(count);\n idCountMap[id] = count + 1;\n var index = getIndexByIdentifier(identifier);\n var obj = {\n css: item[1],\n media: item[2],\n sourceMap: item[3]\n };\n\n if (index !== -1) {\n stylesInDom[index].references++;\n stylesInDom[index].updater(obj);\n } else {\n stylesInDom.push({\n identifier: identifier,\n updater: addStyle(obj, options),\n references: 1\n });\n }\n\n identifiers.push(identifier);\n }\n\n return identifiers;\n}\n\nfunction insertStyleElement(options) {\n var style = document.createElement('style');\n var attributes = options.attributes || {};\n\n if (typeof attributes.nonce === 'undefined') {\n var nonce = typeof __webpack_nonce__ !== 'undefined' ? __webpack_nonce__ : null;\n\n if (nonce) {\n attributes.nonce = nonce;\n }\n }\n\n Object.keys(attributes).forEach(function (key) {\n style.setAttribute(key, attributes[key]);\n });\n\n if (typeof options.insert === 'function') {\n options.insert(style);\n } else {\n var target = getTarget(options.insert || 'head');\n\n if (!target) {\n throw new Error(\"Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.\");\n }\n\n target.appendChild(style);\n }\n\n return style;\n}\n\nfunction removeStyleElement(style) {\n // istanbul ignore if\n if (style.parentNode === null) {\n return false;\n }\n\n style.parentNode.removeChild(style);\n}\n/* istanbul ignore next */\n\n\nvar replaceText = function replaceText() {\n var textStore = [];\n return function replace(index, replacement) {\n textStore[index] = replacement;\n return textStore.filter(Boolean).join('\\n');\n };\n}();\n\nfunction applyToSingletonTag(style, index, remove, obj) {\n var css = remove ? '' : obj.media ? \"@media \".concat(obj.media, \" {\").concat(obj.css, \"}\") : obj.css; // For old IE\n\n /* istanbul ignore if */\n\n if (style.styleSheet) {\n style.styleSheet.cssText = replaceText(index, css);\n } else {\n var cssNode = document.createTextNode(css);\n var childNodes = style.childNodes;\n\n if (childNodes[index]) {\n style.removeChild(childNodes[index]);\n }\n\n if (childNodes.length) {\n style.insertBefore(cssNode, childNodes[index]);\n } else {\n style.appendChild(cssNode);\n }\n }\n}\n\nfunction applyToTag(style, options, obj) {\n var css = obj.css;\n var media = obj.media;\n var sourceMap = obj.sourceMap;\n\n if (media) {\n style.setAttribute('media', media);\n } else {\n style.removeAttribute('media');\n }\n\n if (sourceMap && typeof btoa !== 'undefined') {\n css += \"\\n/*# sourceMappingURL=data:application/json;base64,\".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), \" */\");\n } // For old IE\n\n /* istanbul ignore if */\n\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n while (style.firstChild) {\n style.removeChild(style.firstChild);\n }\n\n style.appendChild(document.createTextNode(css));\n }\n}\n\nvar singleton = null;\nvar singletonCounter = 0;\n\nfunction addStyle(obj, options) {\n var style;\n var update;\n var remove;\n\n if (options.singleton) {\n var styleIndex = singletonCounter++;\n style = singleton || (singleton = insertStyleElement(options));\n update = applyToSingletonTag.bind(null, style, styleIndex, false);\n remove = applyToSingletonTag.bind(null, style, styleIndex, true);\n } else {\n style = insertStyleElement(options);\n update = applyToTag.bind(null, style, options);\n\n remove = function remove() {\n removeStyleElement(style);\n };\n }\n\n update(obj);\n return function updateStyle(newObj) {\n if (newObj) {\n if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) {\n return;\n }\n\n update(obj = newObj);\n } else {\n remove();\n }\n };\n}\n\nmodule.exports = function (list, options) {\n options = options || {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of