From ffbad8391c2a1ec8bcf53e90a95d914d48cbc5b8 Mon Sep 17 00:00:00 2001 From: jonatanklosko <17034772+jonatanklosko@users.noreply.github.com> Date: Thu, 3 Apr 2025 10:42:31 +0000 Subject: [PATCH] Update assets --- static/assets/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/assets/app.js b/static/assets/app.js index 24acc7ec2..c3e8c3411 100644 --- a/static/assets/app.js +++ b/static/assets/app.js @@ -95,7 +95,7 @@ ${o.message}`)))}function aie(){return import("./mermaid.core-PK4ATILI.js" `)}},ba=Uw;function cie(t){return Ee(F({},qn),{attributes:Ee(F({},qn.attributes),{"*":[...qn.attributes["*"]||[],"className","style"]}),protocols:Ee(F({},qn.protocols),{href:[...qn.protocols.href,...t]})})}function uie(t){return e=>{let i=[];return bi(e,"code",n=>{let r=n.lang||t.defaultLanguage;if(r){let o=function(a){n.type="html",n.value=`
${a}
`},s=t.highlight(n.value,r);if(s&&typeof s.then=="function"){let a=Promise.resolve(s).then(o);i.push(a)}else o(s)}}),Promise.all(i).then(()=>null)}}function fie(t){return e=>{t.baseUrl&&bi(e,"element",i=>{if(i.tagName==="a"&&i.properties){let n=i.properties.href;n&&!Mw(n)&&!Nw(n)&&!mie(n)&&(i.properties.href=GR(t.baseUrl,n))}if(i.tagName==="img"&&i.properties){let n=i.properties.src;n&&!Mw(n)&&!Nw(n)&&(i.properties.src=GR(t.baseUrl,n))}}),bi(e,"element",i=>{i.tagName==="a"&&i.properties&&i.properties.href&&(i.properties.href=i.properties.href.split("/").map(n=>n===".."?"__parent__":n).join("/"))})}}var hie=Zh().use(Kd,{fragment:!0});function die(t){return e=>{bi(e,"code",(i,n,r)=>{i.lang==="mermaid"&&(i.type="html",i.value=`
${Qf(i.value)}
- `)})}}function Oie(t){return e=>{let i=[];return bi(e,"element",n=>{if((n.properties&&Array.isArray(n.properties.className)?n.properties.className:[]).includes("mermaid")){let o=function(c){let u=hie.parse(c);b1(u,!0),n.children=u.children},s=pu(n,{whitespace:"pre"}),a=t.useDarkTheme?"dark":"default",l=HR(s,{theme:a}).then(o);i.push(l)}}),Promise.all(i).then(()=>null)}}function pie(t){return e=>{bi(e,"element",i=>{if(i.properties&&i.properties.href){let n=i.properties.href;Nw(n)?(i.properties["data-phx-link"]=t.baseUrl&&n.startsWith(t.baseUrl)?"patch":"redirect",i.properties["data-phx-link-state"]="push"):Mw(n)&&(i.properties.target="_blank",i.properties.rel="noreferrer noopener")}})}}function Mw(t){return/^(?:[a-z]+:)?\/\//i.test(t)}function mie(t){return t.startsWith("#")}function Nw(t){return t.startsWith("/")||t.startsWith(window.location.origin)}function GR(t,e){return t.replace(/\/$/,"")+"/"+e}var Nl=class{constructor(){this.subscribersByTopic={}}subscribe(e,i){return Array.isArray(this.subscribersByTopic[e])||(this.subscribersByTopic[e]=[]),this.subscribersByTopic[e].push(i),{destroy:()=>{this.unsubscribe(e,i)}}}unsubscribe(e,i){let n=this.subscribersByTopic[e].indexOf(i);n!==-1&&(this.subscribersByTopic[e].splice(n,1),this.subscribersByTopic[e].length===0&&delete this.subscribersByTopic[e])}broadcast(e,i){Array.isArray(this.subscribersByTopic[e])&&this.subscribersByTopic[e].forEach(n=>{n(i)})}},at=new Nl;var KR=t=>typeof t=="object"&&t!=null&&t.nodeType===1,JR=(t,e)=>(!e||t!=="hidden")&&t!=="visible"&&t!=="clip",qw=(t,e)=>{if(t.clientHeight{let r=(o=>{if(!o.ownerDocument||!o.ownerDocument.defaultView)return null;try{return o.ownerDocument.defaultView.frameElement}catch(s){return null}})(n);return!!r&&(r.clientHeightoe||o>t&&s=e&&a>=i?o-t-n:s>e&&ai?s-e+r:0,gie=t=>{let e=t.parentElement;return e==null?t.getRootNode().host||null:e},jw=(t,e)=>{var i,n,r,o;if(typeof document=="undefined")return[];let{scrollMode:s,block:a,inline:l,boundary:c,skipOverflowHiddenElements:u}=e,f=typeof c=="function"?c:ne=>ne!==c;if(!KR(t))throw new TypeError("Invalid target");let d=document.scrollingElement||document.documentElement,O=[],m=t;for(;KR(m)&&f(m);){if(m=gie(m),m===d){O.push(m);break}m!=null&&m===document.body&&qw(m)&&!qw(document.documentElement)||m!=null&&qw(m,u)&&O.push(m)}let x=(n=(i=window.visualViewport)==null?void 0:i.width)!=null?n:innerWidth,v=(o=(r=window.visualViewport)==null?void 0:r.height)!=null?o:innerHeight,{scrollX:w,scrollY:T}=window,{height:A,width:L,top:D,right:P,bottom:N,left:le}=t.getBoundingClientRect(),H=a==="start"||a==="nearest"?D:a==="end"?N:D+A/2,M=l==="center"?le+L/2:l==="end"?P:le,ie=[];for(let ne=0;ne=0&&le>=0&&N<=v&&P<=x&&D>=ve&&N<=ue&&le>=Z&&P<=j)return ie;let C=getComputedStyle(re),W=parseInt(C.borderLeftWidth,10),oe=parseInt(C.borderTopWidth,10),I=parseInt(C.borderRightWidth,10),Ne=parseInt(C.borderBottomWidth,10),We=0,Ve=0,Et="offsetWidth"in re?re.offsetWidth-re.clientWidth-W-I:0,Xe="offsetHeight"in re?re.offsetHeight-re.clientHeight-oe-Ne:0,Rt="offsetWidth"in re?re.offsetWidth===0?0:pe/re.offsetWidth:0,Lt="offsetHeight"in re?re.offsetHeight===0?0:de/re.offsetHeight:0;if(d===re)We=a==="start"?H:a==="end"?H-v:a==="nearest"?fm(T,T+v,v,oe,Ne,T+H,T+H+A,A):H-v/2,Ve=l==="start"?M:l==="center"?M-x/2:l==="end"?M-x:fm(w,w+x,x,W,I,w+M,w+M+L,L),We=Math.max(0,We+T),Ve=Math.max(0,Ve+w);else{We=a==="start"?H-ve-oe:a==="end"?H-ue+Ne+Xe:a==="nearest"?fm(ve,ue,de,oe,Ne+Xe,H,H+A,A):H-(ve+de/2)+Xe/2,Ve=l==="start"?M-Z-W:l==="center"?M-(Z+pe/2)+Et/2:l==="end"?M-j+I+Et:fm(Z,j,pe,W,I+Et,M,M+L,L);let{scrollLeft:dn,scrollTop:On}=re;We=Math.max(0,Math.min(On+We/Lt,re.scrollHeight-de/Lt+Xe)),Ve=Math.max(0,Math.min(dn+Ve/Rt,re.scrollWidth-pe/Rt+Et)),H+=On-We,M+=dn-Ve}ie.push({el:re,top:We,left:Ve})}return ie};var bie=t=>t===!1?{block:"end",inline:"nearest"}:(e=>e===Object(e)&&Object.keys(e).length!==0)(t)?t:{block:"start",inline:"nearest"};function hm(t,e){if(!t.isConnected||!(r=>{let o=r;for(;o&&o.parentNode;){if(o.parentNode===document)return!0;o=o.parentNode instanceof ShadowRoot?o.parentNode.host:o.parentNode}return!1})(t))return;let i=(r=>{let o=window.getComputedStyle(r);return{top:parseFloat(o.scrollMarginTop)||0,right:parseFloat(o.scrollMarginRight)||0,bottom:parseFloat(o.scrollMarginBottom)||0,left:parseFloat(o.scrollMarginLeft)||0}})(t);if((r=>typeof r=="object"&&typeof r.behavior=="function")(e))return e.behavior(jw(t,e));let n=typeof e=="boolean"||e==null?void 0:e.behavior;for(let{el:r,top:o,left:s}of jw(t,bie(e))){let a=o-i.top+i.bottom,l=s-i.left+i.right;r.scroll({top:a,left:l,behavior:n})}}function ya(t){return["code","smart"].includes(t)}function e6(t){return["markdown","code"].includes(t)}var yie={mounted(){this.props=this.getProps(),this.isFocused=!1,this.insertMode=!1,this.liveEditors={},this.updateInsertModeAvailability();let t=this.el.querySelector("[data-el-amplify-outputs-button]");t&&t.addEventListener("click",e=>{this.el.toggleAttribute("data-js-amplified")}),this.props.type==="smart"&&this.el.querySelector("[data-el-toggle-source-button]").addEventListener("click",i=>{this.el.toggleAttribute("data-js-source-visible"),this.updateInsertModeAvailability(),this.maybeFocusCurrentEditor()}),this.el.addEventListener("lb:cell:editor_created",e=>{let{tag:i,liveEditor:n}=e.detail;this.handleCellEditorCreated(i,n)}),this.el.addEventListener("lb:cell:editor_removed",e=>{let{tag:i}=e.detail;this.handleCellEditorRemoved(i)}),this.el.addEventListener("mouseenter",e=>{this.el.setAttribute("data-js-hover","")}),this.el.addEventListener("mouseleave",e=>{this.el.removeAttribute("data-js-hover")}),this.subscriptions=[at.subscribe("navigation:focus_changed",({focusableId:e,scroll:i})=>this.handleElementFocused(e,i)),at.subscribe("navigation:insert_mode_changed",({enabled:e})=>this.handleInsertModeChanged(e)),at.subscribe("cells:cell_moved",({cellId:e})=>this.handleCellMoved(e)),at.subscribe(`cells:${this.props.cellId}:dispatch_queue_evaluation`,({dispatch:e})=>this.handleDispatchQueueEvaluation(e)),at.subscribe(`cells:${this.props.cellId}:jump_to_line`,({line:e,offset:i=0})=>this.handleJumpToLine(e,i))],this._handleViewportResize=this.handleViewportResize.bind(this),window.visualViewport.addEventListener("resize",this._handleViewportResize)},disconnected(){this.el.removeAttribute("id")},destroyed(){this.subscriptions.forEach(t=>t.destroy()),window.visualViewport.removeEventListener("resize",this._handleViewportResize)},updated(){let t=this.props;this.props=this.getProps(),this.props.evaluationDigest!==t.evaluationDigest&&this.updateChangeIndicator()},getProps(){return Ot(this.el,["cell-id","type","session-path","evaluation-digest","smart-cell-js-view-ref","allowed-uri-schemes"])},handleElementFocused(t,e){this.props.cellId===t?(this.isFocused=!0,this.el.setAttribute("data-js-focused",""),e&&ga(this.el)):this.isFocused&&(this.isFocused=!1,this.el.removeAttribute("data-js-focused"))},handleCellEditorCreated(t,e){if(this.liveEditors[t]=e,this.updateInsertModeAvailability(),e===this.currentEditor()&&this.maybeFocusCurrentEditor(),e.onBlur(()=>{setTimeout(()=>{this.isFocused&&this.insertMode&&this.currentEditor().focus()},0)}),e.onFocus(()=>{setTimeout(()=>{!this.isFocused||!this.insertMode?this.currentEditor().blur():this.sendCursorHistory()},0)}),e.onSelectionChange(()=>{this.isFocused&&this.sendCursorHistory()}),t==="primary"){let i=e.getSource();if(this.el.toggleAttribute("data-js-empty",i===""),e.onChange(n=>{this.el.toggleAttribute("data-js-empty",n==="")}),this.props.type==="markdown"){let n=this.el.querySelector("[data-el-markdown-container]"),r=new ba(n,i,{baseUrl:this.props.sessionPath,emptyText:"Empty markdown cell",allowedUriSchemes:this.props.allowedUriSchemes});e.onChange(o=>{r.setContent(o)})}ya(this.props.type)&&(this.updateChangeIndicator(),e.onChange(n=>{this.updateChangeIndicator()}),this.handleEvent(`evaluation_finished:${this.props.cellId}`,({code_markers:n})=>{e.setCodeMarkers(n)}),this.handleEvent(`start_evaluation:${this.props.cellId}`,()=>{e.clearDoctests()}),this.handleEvent(`doctest_report:${this.props.cellId}`,n=>{e.updateDoctests([n])}),this.handleEvent("erase_outputs",()=>{e.setCodeMarkers([]),e.clearDoctests()}))}},handleCellEditorRemoved(t){delete this.liveEditors[t]},handleViewportResize(){this.isFocused&&this.scrollEditorCursorIntoViewIfNeeded()},currentEditor(){return this.liveEditors[this.currentEditorTag()]},currentEditorTag(){return this.props.type==="smart"?this.el.hasAttribute("data-js-source-visible")?"primary":"secondary":"primary"},updateInsertModeAvailability(){this.el.toggleAttribute("data-js-insert-mode-disabled",!this.currentEditor())},maybeFocusCurrentEditor(){this.isFocused&&this.insertMode&&this.currentEditor().focus()},updateChangeIndicator(){let t=this.el.querySelector("[data-el-cell-status]");if(t&&t.querySelector("[data-el-change-indicator]")&&this.props.evaluationDigest){let i=this.liveEditors.primary.getSource(),n=sm(i),r=this.props.evaluationDigest!==n;this.el.toggleAttribute("data-js-changed",r)}},handleInsertModeChanged(t){this.isFocused&&!this.insertMode&&t?(this.insertMode=t,this.el.setAttribute("data-js-insert-mode",""),this.currentEditor()&&(this.currentEditor().focus(),this.scrollEditorCursorIntoViewIfNeeded())):this.insertMode&&!t&&(this.insertMode=t,this.el.removeAttribute("data-js-insert-mode"),this.currentEditor()&&this.currentEditor().blur())},handleCellMoved(t){this.isFocused&&t===this.props.cellId&&ga(this.el)},handleDispatchQueueEvaluation(t){this.props.type==="smart"&&this.props.smartCellJsViewRef?at.broadcast(`js_views:${this.props.smartCellJsViewRef}:sync`,{callback:t}):t()},handleJumpToLine(t,e){this.isFocused&&this.currentEditor().moveCursorToLine(t,e)},scrollEditorCursorIntoViewIfNeeded(){let t=this.currentEditor().getElementAtCursor();BR(t,{scrollMarginTop:"128px"},()=>{hm(t,{scrollMode:"if-needed",behavior:"instant",block:"start"})})},sendCursorHistory(){let t=this.currentEditor().getCurrentCursorPosition();t!==null&&at.broadcast("navigation:cursor_moved",{line:t.line,offset:t.offset,cellId:this.props.cellId})}},t6=yie;var Xf=t=>{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=Zw(t.state,i.from);return n.line?xie(t):n.block?vie(t):!1};function Rf(t,e){return({state:i,dispatch:n})=>{if(i.readOnly)return!1;let r=t(e,i);return r?(n(i.update(r)),!0):!1}}var xie=Rf(Bw,0),i6=Rf(Bw,1),n6=Rf(Bw,2),r6=Rf(o6,0);var vie=Rf((t,e)=>o6(t,e,kie(e)),0);function Zw(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}var $f=50;function wie(t,{open:e,close:i},n,r){let o=t.sliceDoc(n-$f,n),s=t.sliceDoc(r,r+$f),a=/\s*$/.exec(o)[0].length,l=/^\s*/.exec(s)[0].length,c=o.length-a;if(o.slice(c-e.length,c)==e&&s.slice(l,l+i.length)==i)return{open:{pos:n-a,margin:a&&1},close:{pos:r+l,margin:l&&1}};let u,f;r-n<=2*$f?u=f=t.sliceDoc(n,r):(u=t.sliceDoc(n,n+$f),f=t.sliceDoc(r-$f,r));let d=/^\s*/.exec(u)[0].length,O=/\s*$/.exec(f)[0].length,m=f.length-O-i.length;return u.slice(d,d+e.length)==e&&f.slice(m,m+i.length)==i?{open:{pos:n+d+e.length,margin:/\s/.test(u.charAt(d+e.length))?1:0},close:{pos:r-O-i.length,margin:/\s/.test(f.charAt(m-1))?1:0}}:null}function kie(t){let e=[];for(let i of t.selection.ranges){let n=t.doc.lineAt(i.from),r=i.to<=n.to?n:t.doc.lineAt(i.to);r.from>n.from&&r.from==i.to&&(r=i.to==n.to+1?n:t.doc.lineAt(i.to-1));let o=e.length-1;o>=0&&e[o].to>n.from?e[o].to=r.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:r.to})}return e}function o6(t,e,i=e.selection.ranges){let n=i.map(o=>Zw(e,o.from).block);if(!n.every(o=>o))return null;let r=i.map((o,s)=>wie(e,n[s],o.from,o.to));if(t!=2&&!r.every(o=>o))return{changes:e.changes(i.map((o,s)=>r[s]?[]:[{from:o.from,insert:n[s].open+" "},{from:o.to,insert:" "+n[s].close}]))};if(t!=1&&r.some(o=>o)){let o=[];for(let s=0,a;sr&&(o==s||s>f.from)){r=f.from;let d=/^\s*/.exec(f.text)[0].length,O=d==f.length,m=f.text.slice(d,d+c.length)==c?d:-1;do.comment<0&&(!o.empty||o.single))){let o=[];for(let{line:a,token:l,indent:c,empty:u,single:f}of n)(f||!u)&&o.push({from:a.from+c,insert:l+" "});let s=e.changes(o);return{changes:s,selection:e.selection.map(s,1)}}else if(t!=1&&n.some(o=>o.comment>=0)){let o=[];for(let{line:s,comment:a,token:l}of n)if(a>=0){let c=s.from+a,u=c+l.length;s.text[u-s.from]==" "&&u++,o.push({from:c,to:u})}return{changes:o}}return null}var Vw=wi.define(),Sie=wi.define(),Tie=be.define(),s6=be.define({combine(t){return Qt(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,i)=>i},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,i)=>(n,r)=>e(n,r)||i(n,r)})}}),a6=Ge.define({create(){return xa.empty},update(t,e){let i=e.state.facet(s6),n=e.annotation(Vw);if(n){let l=Yn.fromTransaction(e,n.selection),c=n.side,u=c==0?t.undone:t.done;return l?u=Om(u,u.length,i.minDepth,l):u=f6(u,e.startState.selection),new xa(c==0?n.rest:u,c==0?u:n.rest)}let r=e.annotation(Sie);if((r=="full"||r=="before")&&(t=t.isolate()),e.annotation(Xt.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let o=Yn.fromTransaction(e),s=e.annotation(Xt.time),a=e.annotation(Xt.userEvent);return o?t=t.addChanges(o,s,a,i,e):e.selection&&(t=t.addSelection(e.startState.selection,s,a,i.newGroupDelay)),(r=="full"||r=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new xa(t.done.map(Yn.fromJSON),t.undone.map(Yn.fromJSON))}});function l6(t={}){return[a6,s6.of(t),fe.domEventHandlers({beforeinput(e,i){let n=e.inputType=="historyUndo"?va:e.inputType=="historyRedo"?ls:null;return n?(e.preventDefault(),n(i)):!1}})]}function Yw(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let r=i.field(a6,!1);if(!r)return!1;let o=r.pop(t,i,e);return o?(n(o),!0):!1}}var va=Yw(0,!1),ls=Yw(1,!1),c6=Yw(0,!0);var Yn=class t{constructor(e,i,n,r,o){this.changes=e,this.effects=i,this.mapped=n,this.startSelection=r,this.selectionsAfter=o}setSelAfter(e){return new t(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,i,n;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(i=this.mapped)===null||i===void 0?void 0:i.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(e){return new t(e.changes&&_i.fromJSON(e.changes),[],e.mapped&&Zr.fromJSON(e.mapped),e.startSelection&&K.fromJSON(e.startSelection),e.selectionsAfter.map(K.fromJSON))}static fromTransaction(e,i){let n=_n;for(let r of e.startState.facet(Tie)){let o=r(e);o.length&&(n=n.concat(o))}return!n.length&&e.changes.empty?null:new t(e.changes.invert(e.startState.doc),n,void 0,i||e.startState.selection,_n)}static selection(e){return new t(void 0,_n,void 0,void 0,e)}};function Om(t,e,i,n){let r=e+1>i+20?e-i-1:0,o=t.slice(r,e);return o.push(n),o}function Eie(t,e){let i=[],n=!1;return t.iterChangedRanges((r,o)=>i.push(r,o)),e.iterChangedRanges((r,o,s,a)=>{for(let l=0;l=c&&s<=u&&(n=!0)}}),n}function Pie(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((i,n)=>i.empty!=e.ranges[n].empty).length===0}function u6(t,e){return t.length?e.length?t.concat(e):t:e}var _n=[],Cie=200;function f6(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-Cie));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),Om(t,t.length-1,1e9,i.setSelAfter(n)))}else return[Yn.selection([e])]}function Qie(t){let e=t[t.length-1],i=t.slice();return i[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),i}function Ww(t,e){if(!t.length)return t;let i=t.length,n=_n;for(;i;){let r=_ie(t[i-1],e,n);if(r.changes&&!r.changes.empty||r.effects.length){let o=t.slice(0,i);return o[i-1]=r,o}else e=r.mapped,i--,n=r.selectionsAfter}return n.length?[Yn.selection(n)]:_n}function _ie(t,e,i){let n=u6(t.selectionsAfter.length?t.selectionsAfter.map(a=>a.map(e)):_n,i);if(!t.changes)return Yn.selection(n);let r=t.changes.map(e),o=e.mapDesc(t.changes,!0),s=t.mapped?t.mapped.composeDesc(o):o;return new Yn(r,Se.mapEffects(t.effects,e),s,t.startSelection.map(o),n)}var Aie=/^(input\.type|delete)($|\.)/,xa=class t{constructor(e,i,n=0,r=void 0){this.done=e,this.undone=i,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new t(this.done,this.undone):this}addChanges(e,i,n,r,o){let s=this.done,a=s[s.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!n||Aie.test(n))&&(!a.selectionsAfter.length&&i-this.prevTime0&&i-this.prevTimei.empty?t.moveByChar(i,e):pm(i,e))}function us(t){return t.textDirectionAt(t.state.selection.main.head)==st.LTR}var If=t=>mm(t,!us(t)),Fw=t=>mm(t,us(t)),h6=t=>mm(t,!0),gm=t=>mm(t,!1);function d6(t,e){return wa(t,i=>i.empty?t.moveByGroup(i,e):pm(i,e))}var bm=t=>d6(t,!us(t)),ym=t=>d6(t,us(t));var DTe=typeof Intl!="undefined"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function O6(t,e){return wa(t,i=>{if(!i.empty)return pm(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)})}var Df=t=>O6(t,!1),zf=t=>O6(t,!0);function p6(t){let e=t.scrollDOM.clientHeights.empty?t.moveVertically(s,e,i.height):pm(s,e));if(r.eq(n.selection))return!1;let o;if(i.selfScroll){let s=t.coordsAtPos(n.selection.main.head),a=t.scrollDOM.getBoundingClientRect(),l=a.top+i.marginTop,c=a.bottom-i.marginBottom;s&&s.top>l&&s.bottomm6(t,!1),jl=t=>m6(t,!0);function xm(t,e,i){let n=t.lineBlockAt(e.head),r=t.moveToLineBoundary(e,i);if(r.head==e.head&&r.head!=(i?n.to:n.from)&&(r=t.moveToLineBoundary(e,i,!1)),!i&&r.head==n.from&&n.length){let o=/^\s*/.exec(t.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;o&&e.head!=n.from+o&&(r=K.cursor(n.from+o))}return r}var Uf=t=>wa(t,e=>xm(t,e,!0)),Mf=t=>wa(t,e=>xm(t,e,!1));var vm=t=>wa(t,e=>K.cursor(t.lineBlockAt(e.head).from,1)),wm=t=>wa(t,e=>K.cursor(t.lineBlockAt(e.head).to,-1));function $ie(t,e,i){let n=!1,r=Lf(t.selection,o=>{let s=Tn(t,o.head,-1)||Tn(t,o.head,1)||o.head>0&&Tn(t,o.head-1,1)||o.head$ie(t,e,!1);function fs(t,e){let i=Lf(t.state.selection,n=>{let r=e(n);return K.range(n.anchor,r.head,r.goalColumn,r.bidiLevel||void 0)});return i.eq(t.state.selection)?!1:(t.dispatch(cs(t.state,i)),!0)}function km(t,e){return fs(t,i=>t.moveByChar(i,e))}var Hw=t=>km(t,!us(t)),Gw=t=>km(t,us(t)),Kw=t=>km(t,!0),Jw=t=>km(t,!1);function Sm(t,e){return fs(t,i=>t.moveByGroup(i,e))}var Tm=t=>Sm(t,!us(t)),Em=t=>Sm(t,us(t)),b6=t=>Sm(t,!0),y6=t=>Sm(t,!1);function x6(t,e){return fs(t,i=>t.moveVertically(i,e))}var Wl=t=>x6(t,!1),Vl=t=>x6(t,!0);function v6(t,e){return fs(t,i=>t.moveVertically(i,e,p6(t).height))}var Nf=t=>v6(t,!1),ka=t=>v6(t,!0),ek=t=>fs(t,e=>xm(t,e,!0)),tk=t=>fs(t,e=>xm(t,e,!1));var qf=t=>fs(t,e=>K.cursor(t.lineBlockAt(e.head).from)),jf=t=>fs(t,e=>K.cursor(t.lineBlockAt(e.head).to)),Wf=({state:t,dispatch:e})=>(e(cs(t,{anchor:0})),!0),Vf=({state:t,dispatch:e})=>(e(cs(t,{anchor:t.doc.length})),!0),Zl=({state:t,dispatch:e})=>(e(cs(t,{anchor:t.selection.main.anchor,head:0})),!0),Bl=({state:t,dispatch:e})=>(e(cs(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),Pm=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),w6=({state:t,dispatch:e})=>{let i=_m(t).map(({from:n,to:r})=>K.range(n,Math.min(r+1,t.doc.length)));return e(t.update({selection:K.create(i),userEvent:"select"})),!0};function Cm(t,e){if(t.state.readOnly)return!1;let i="delete.selection",{state:n}=t,r=n.changeByRange(o=>{let{from:s,to:a}=o;if(s==a){let l=e(o);ls&&(i="delete.forward",l=dm(t,l,!0)),s=Math.min(s,l),a=Math.max(a,l)}else s=dm(t,s,!1),a=dm(t,a,!0);return s==a?{range:o}:{changes:{from:s,to:a},range:K.cursor(s,sr(t)))n.between(e,e,(r,o)=>{re&&(e=i?o:r)});return e}var k6=(t,e,i)=>Cm(t,n=>{let r=n.from,{state:o}=t,s=o.doc.lineAt(r),a,l;if(i&&!e&&r>s.from&&rk6(t,!1,!0);var Zf=t=>k6(t,!0,!1),S6=(t,e)=>Cm(t,i=>{let n=i.head,{state:r}=t,o=r.doc.lineAt(n),s=r.charCategorizer(n);for(let a=null;;){if(n==(e?o.to:o.from)){n==i.head&&o.number!=(e?r.doc.lines:1)&&(n+=e?1:-1);break}let l=Bt(o.text,n-o.from,e)+o.from,c=o.text.slice(Math.min(n,l)-o.from,Math.max(n,l)-o.from),u=s(c);if(a!=null&&u!=a)break;(c!=" "||n!=i.head)&&(a=u),n=l}return n}),ik=t=>S6(t,!1),T6=t=>S6(t,!0),nk=t=>Cm(t,e=>{let i=t.lineBlockAt(e.head).to;return e.headCm(t,e=>{let i=t.lineBlockAt(e.head).from;return e.head>i?i:Math.max(0,e.head-1)});var Bf=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:Fe.of(["",""])},range:K.cursor(n.from)}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0},Qm=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange(n=>{if(!n.empty||n.from==0||n.from==t.doc.length)return{range:n};let r=n.from,o=t.doc.lineAt(r),s=r==o.from?r-1:Bt(o.text,r-o.from,!1)+o.from,a=r==o.to?r+1:Bt(o.text,r-o.from,!0)+o.from;return{changes:{from:s,to:a,insert:t.doc.slice(r,a).append(t.doc.slice(s,r))},range:K.cursor(a)}});return i.changes.empty?!1:(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function _m(t){let e=[],i=-1;for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),o=t.doc.lineAt(n.to);if(!n.empty&&n.to==o.from&&(o=t.doc.lineAt(n.to-1)),i>=r.number){let s=e[e.length-1];s.to=o.to,s.ranges.push(n)}else e.push({from:r.from,to:o.to,ranges:[n]});i=o.number+1}return e}function P6(t,e,i){if(t.readOnly)return!1;let n=[],r=[];for(let o of _m(t)){if(i?o.to==t.doc.length:o.from==0)continue;let s=t.doc.lineAt(i?o.to+1:o.from-1),a=s.length+1;if(i){n.push({from:o.to,to:s.to},{from:o.from,insert:s.text+t.lineBreak});for(let l of o.ranges)r.push(K.range(Math.min(t.doc.length,l.anchor+a),Math.min(t.doc.length,l.head+a)))}else{n.push({from:s.from,to:o.from},{from:o.to,insert:t.lineBreak+s.text});for(let l of o.ranges)r.push(K.range(l.anchor-a,l.head-a))}}return n.length?(e(t.update({changes:n,scrollIntoView:!0,selection:K.create(r,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}var C6=({state:t,dispatch:e})=>P6(t,e,!1),Q6=({state:t,dispatch:e})=>P6(t,e,!0);function _6(t,e,i){if(t.readOnly)return!1;let n=[];for(let r of _m(t))i?n.push({from:r.from,insert:t.doc.slice(r.from,r.to)+t.lineBreak}):n.push({from:r.to,insert:t.lineBreak+t.doc.slice(r.from,r.to)});return e(t.update({changes:n,scrollIntoView:!0,userEvent:"input.copyline"})),!0}var A6=({state:t,dispatch:e})=>_6(t,e,!1),$6=({state:t,dispatch:e})=>_6(t,e,!0),X6=t=>{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(_m(e).map(({from:r,to:o})=>(r>0?r--:o{let o;if(t.lineWrapping){let s=t.lineBlockAt(r.head),a=t.coordsAtPos(r.head,r.assoc||1);a&&(o=s.bottom+t.documentTop-a.bottom+t.defaultLineHeight/2)}return t.moveVertically(r,!0,o)}).map(i);return t.dispatch({changes:i,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0};function Xie(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i=qe(t).resolveInner(e),n=i.childBefore(e),r=i.childAfter(e),o;return n&&r&&n.to<=e&&r.from>=e&&(o=n.type.prop(_e.closedBy))&&o.indexOf(r.name)>-1&&t.doc.lineAt(n.to).from==t.doc.lineAt(r.from).from&&!/\S/.test(t.sliceDoc(n.to,r.from))?{from:n.to,to:r.from}:null}var Yf=L6(!1),R6=L6(!0);function L6(t){return({state:e,dispatch:i})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>{let{from:o,to:s}=r,a=e.doc.lineAt(o),l=!t&&o==s&&Xie(e,o);t&&(o=s=(s<=a.to?a:e.doc.lineAt(s)).to);let c=new Ks(e,{simulateBreak:o,simulateDoubleBreak:!!l}),u=kl(c,o);for(u==null&&(u=$i(/^\s*/.exec(e.doc.lineAt(o).text)[0],e.tabSize));sa.from&&o{let r=[];for(let s=n.from;s<=n.to;){let a=t.doc.lineAt(s);a.number>i&&(n.empty||n.to>a.from)&&(e(a,r,n),i=a.number),s=a.to+1}let o=t.changes(r);return{changes:r,range:K.range(o.mapPos(n.anchor,1),o.mapPos(n.head,1))}})}var I6=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new Ks(t,{overrideIndentation:o=>{let s=i[o];return s==null?-1:s}}),r=rk(t,(o,s,a)=>{let l=kl(n,o.from);if(l==null)return;/\S/.test(o.text)||(l=0);let c=/^\s*/.exec(o.text)[0],u=Gr(t,l);(c!=u||a.fromt.readOnly?!1:(e(t.update(rk(t,(i,n)=>{n.push({from:i.from,insert:t.facet(Vn)})}),{userEvent:"input.indent"})),!0),Hf=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(rk(t,(i,n)=>{let r=/^\s*/.exec(i.text)[0];if(!r)return;let o=$i(r,t.tabSize),s=0,a=Gr(t,Math.max(0,o-br(t)));for(;st.normalize("NFKD"):t=>t,ds=class{constructor(e,i,n=0,r=e.length,o,s){this.test=s,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=o?a=>o(z6(a)):z6,this.query=this.normalize(i)}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 ui(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 i=Tu(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=nn(e);let r=this.normalize(i);if(r.length)for(let o=0,s=n;;o++){let a=r.charCodeAt(o),l=this.match(a,s,this.bufferPos+this.bufferStart);if(o==r.length-1){if(l)return this.value=l,this;break}s==n&&othis.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 i=this.matchPos<=this.to&&this.re.exec(this.curLine);if(i){let n=this.curLineStart+i.index,r=n+i[0].length;if(this.matchPos=Lm(this.text,r+(n==r?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(nthis.value.to)&&(!this.test||this.test(n,r,i)))return this.value={from:n,to:r,match:i},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=n||r.to<=i){let a=new t(i,e.sliceString(i,n));return ok.set(e,a),a}if(r.from==i&&r.to==n)return r;let{text:o,from:s}=r;return s>i&&(o=e.sliceString(i,s)+o,s=i),r.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,i=this.re.exec(this.flat.text);if(i&&!i[0]&&i.index==e&&(this.re.lastIndex=e+1,i=this.re.exec(this.flat.text)),i){let n=this.flat.from+i.index,r=n+i[0].length;if((this.flat.to>=this.to||i.index+i[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,r,i)))return this.value={from:n,to:r,match:i},this.matchPos=Lm(this.text,r+(n==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Xm.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol!="undefined"&&(Gl.prototype[Symbol.iterator]=Rm.prototype[Symbol.iterator]=function(){return this});function Lie(t){try{return new RegExp(t,fk),!0}catch(e){return!1}}function Lm(t,e){if(e>=t.length)return e;let i=t.lineAt(e),n;for(;e=56320&&n<57344;)e++;return e}function sk(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),i=ct("input",{class:"cm-textfield",name:"line",value:e}),n=ct("form",{class:"cm-gotoLine",onkeydown:o=>{o.keyCode==27?(o.preventDefault(),t.dispatch({effects:Gf.of(!1)}),t.focus()):o.keyCode==13&&(o.preventDefault(),r())},onsubmit:o=>{o.preventDefault(),r()}},ct("label",t.state.phrase("Go to line"),": ",i)," ",ct("button",{class:"cm-button",type:"submit"},t.state.phrase("go")),ct("button",{name:"close",onclick:()=>{t.dispatch({effects:Gf.of(!1)}),t.focus()},"aria-label":t.state.phrase("close"),type:"button"},["\xD7"]));function r(){let o=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(i.value);if(!o)return;let{state:s}=t,a=s.doc.lineAt(s.selection.main.head),[,l,c,u,f]=o,d=u?+u.slice(1):0,O=c?+c:a.number;if(c&&f){let v=O/100;l&&(v=v*(l=="-"?-1:1)+a.number/s.doc.lines),O=Math.round(s.doc.lines*v)}else c&&l&&(O=O*(l=="-"?-1:1)+a.number);let m=s.doc.line(Math.max(1,Math.min(s.doc.lines,O))),x=K.cursor(m.from+Math.max(0,Math.min(d,m.length)));t.dispatch({effects:[Gf.of(!1),fe.scrollIntoView(x.from,{y:"center"})],selection:x}),t.focus()}return{dom:n}}var Gf=Se.define(),U6=Ge.define({create(){return!0},update(t,e){for(let i of e.effects)i.is(Gf)&&(t=i.value);return t},provide:t=>kn.from(t,e=>e?sk:null)}),V6=t=>{let e=Fs(t,sk);if(!e){let i=[Gf.of(!0)];t.state.field(U6,!1)==null&&i.push(Se.appendConfig.of([U6,Iie])),t.dispatch({effects:i}),e=Fs(t,sk)}return e&&e.dom.querySelector("input").select(),!0},Iie=fe.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),Die={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Z6=be.define({combine(t){return Qt(t,Die,{highlightWordAroundCursor:(e,i)=>e||i,minSelectionLength:Math.min,maxMatches:Math.min})}});function B6(t){let e=[qie,Nie];return t&&e.push(Z6.of(t)),e}var zie=we.mark({class:"cm-selectionMatch"}),Uie=we.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function M6(t,e,i,n){return(i==0||t(e.sliceDoc(i-1,i))!=pt.Word)&&(n==e.doc.length||t(e.sliceDoc(n,n+1))!=pt.Word)}function Mie(t,e,i,n){return t(e.sliceDoc(i,i+1))==pt.Word&&t(e.sliceDoc(n-1,n))==pt.Word}var Nie=He.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Z6),{state:i}=t,n=i.selection;if(n.ranges.length>1)return we.none;let r=n.main,o,s=null;if(r.empty){if(!e.highlightWordAroundCursor)return we.none;let l=i.wordAt(r.head);if(!l)return we.none;s=i.charCategorizer(r.head),o=i.sliceDoc(l.from,l.to)}else{let l=r.to-r.from;if(l200)return we.none;if(e.wholeWords){if(o=i.sliceDoc(r.from,r.to),s=i.charCategorizer(r.head),!(M6(s,i,r.from,r.to)&&Mie(s,i,r.from,r.to)))return we.none}else if(o=i.sliceDoc(r.from,r.to),!o)return we.none}let a=[];for(let l of t.visibleRanges){let c=new ds(i.doc,o,l.from,l.to);for(;!c.next().done;){let{from:u,to:f}=c.value;if((!s||M6(s,i,u,f))&&(r.empty&&u<=r.from&&f>=r.to?a.push(Uie.range(u,f)):(u>=r.to||f<=r.from)&&a.push(zie.range(u,f)),a.length>e.maxMatches))return we.none}}return we.set(a)}},{decorations:t=>t.decorations}),qie=fe.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),jie=({state:t,dispatch:e})=>{let{selection:i}=t,n=K.create(i.ranges.map(r=>t.wordAt(r.head)||K.cursor(r.head)),i.mainIndex);return n.eq(i)?!1:(e(t.update({selection:n})),!0)};function Wie(t,e){let{main:i,ranges:n}=t.selection,r=t.wordAt(i.head),o=r&&r.from==i.from&&r.to==i.to;for(let s=!1,a=new ds(t.doc,e,n[n.length-1].to);;)if(a.next(),a.done){if(s)return null;a=new ds(t.doc,e,0,Math.max(0,n[n.length-1].from-1)),s=!0}else{if(s&&n.some(l=>l.from==a.value.from))continue;if(o){let l=t.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}var Y6=({state:t,dispatch:e})=>{let{ranges:i}=t.selection;if(i.some(o=>o.from===o.to))return jie({state:t,dispatch:e});let n=t.sliceDoc(i[0].from,i[0].to);if(t.selection.ranges.some(o=>t.sliceDoc(o.from,o.to)!=n))return!1;let r=Wie(t,n);return r?(e(t.update({selection:t.selection.addRange(K.range(r.from,r.to),!1),effects:fe.scrollIntoView(r.to)})),!0):!1},Jl=be.define({combine(t){return Qt(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new uk(e),scrollToMatch:e=>fe.scrollIntoView(e)})}});var Kl=class{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||Lie(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(i,n)=>n=="n"?` + `)})}}function Oie(t){return e=>{let i=[];return bi(e,"element",n=>{if((n.properties&&Array.isArray(n.properties.className)?n.properties.className:[]).includes("mermaid")){let o=function(c){let u=hie.parse(c);b1(u,!0),n.children=u.children},s=pu(n,{whitespace:"pre"}),a=t.useDarkTheme?"dark":"default",l=HR(s,{theme:a}).then(o);i.push(l)}}),Promise.all(i).then(()=>null)}}function pie(t){return e=>{bi(e,"element",i=>{if(i.properties&&i.properties.href){let n=i.properties.href;Nw(n)?(i.properties["data-phx-link"]=t.baseUrl&&n.startsWith(t.baseUrl)?"patch":"redirect",i.properties["data-phx-link-state"]="push"):Mw(n)&&(i.properties.target="_blank",i.properties.rel="noreferrer noopener")}})}}function Mw(t){return/^([a-z]+:|\/\/)/i.test(t)}function mie(t){return t.startsWith("#")}function Nw(t){return t.startsWith("/")||t.startsWith(window.location.origin)}function GR(t,e){return t.replace(/\/$/,"")+"/"+e}var Nl=class{constructor(){this.subscribersByTopic={}}subscribe(e,i){return Array.isArray(this.subscribersByTopic[e])||(this.subscribersByTopic[e]=[]),this.subscribersByTopic[e].push(i),{destroy:()=>{this.unsubscribe(e,i)}}}unsubscribe(e,i){let n=this.subscribersByTopic[e].indexOf(i);n!==-1&&(this.subscribersByTopic[e].splice(n,1),this.subscribersByTopic[e].length===0&&delete this.subscribersByTopic[e])}broadcast(e,i){Array.isArray(this.subscribersByTopic[e])&&this.subscribersByTopic[e].forEach(n=>{n(i)})}},at=new Nl;var KR=t=>typeof t=="object"&&t!=null&&t.nodeType===1,JR=(t,e)=>(!e||t!=="hidden")&&t!=="visible"&&t!=="clip",qw=(t,e)=>{if(t.clientHeight{let r=(o=>{if(!o.ownerDocument||!o.ownerDocument.defaultView)return null;try{return o.ownerDocument.defaultView.frameElement}catch(s){return null}})(n);return!!r&&(r.clientHeightoe||o>t&&s=e&&a>=i?o-t-n:s>e&&ai?s-e+r:0,gie=t=>{let e=t.parentElement;return e==null?t.getRootNode().host||null:e},jw=(t,e)=>{var i,n,r,o;if(typeof document=="undefined")return[];let{scrollMode:s,block:a,inline:l,boundary:c,skipOverflowHiddenElements:u}=e,f=typeof c=="function"?c:ne=>ne!==c;if(!KR(t))throw new TypeError("Invalid target");let d=document.scrollingElement||document.documentElement,O=[],m=t;for(;KR(m)&&f(m);){if(m=gie(m),m===d){O.push(m);break}m!=null&&m===document.body&&qw(m)&&!qw(document.documentElement)||m!=null&&qw(m,u)&&O.push(m)}let x=(n=(i=window.visualViewport)==null?void 0:i.width)!=null?n:innerWidth,v=(o=(r=window.visualViewport)==null?void 0:r.height)!=null?o:innerHeight,{scrollX:w,scrollY:T}=window,{height:A,width:L,top:D,right:P,bottom:N,left:le}=t.getBoundingClientRect(),H=a==="start"||a==="nearest"?D:a==="end"?N:D+A/2,M=l==="center"?le+L/2:l==="end"?P:le,ie=[];for(let ne=0;ne=0&&le>=0&&N<=v&&P<=x&&D>=ve&&N<=ue&&le>=Z&&P<=j)return ie;let C=getComputedStyle(re),W=parseInt(C.borderLeftWidth,10),oe=parseInt(C.borderTopWidth,10),I=parseInt(C.borderRightWidth,10),Ne=parseInt(C.borderBottomWidth,10),We=0,Ve=0,Et="offsetWidth"in re?re.offsetWidth-re.clientWidth-W-I:0,Xe="offsetHeight"in re?re.offsetHeight-re.clientHeight-oe-Ne:0,Rt="offsetWidth"in re?re.offsetWidth===0?0:pe/re.offsetWidth:0,Lt="offsetHeight"in re?re.offsetHeight===0?0:de/re.offsetHeight:0;if(d===re)We=a==="start"?H:a==="end"?H-v:a==="nearest"?fm(T,T+v,v,oe,Ne,T+H,T+H+A,A):H-v/2,Ve=l==="start"?M:l==="center"?M-x/2:l==="end"?M-x:fm(w,w+x,x,W,I,w+M,w+M+L,L),We=Math.max(0,We+T),Ve=Math.max(0,Ve+w);else{We=a==="start"?H-ve-oe:a==="end"?H-ue+Ne+Xe:a==="nearest"?fm(ve,ue,de,oe,Ne+Xe,H,H+A,A):H-(ve+de/2)+Xe/2,Ve=l==="start"?M-Z-W:l==="center"?M-(Z+pe/2)+Et/2:l==="end"?M-j+I+Et:fm(Z,j,pe,W,I+Et,M,M+L,L);let{scrollLeft:dn,scrollTop:On}=re;We=Math.max(0,Math.min(On+We/Lt,re.scrollHeight-de/Lt+Xe)),Ve=Math.max(0,Math.min(dn+Ve/Rt,re.scrollWidth-pe/Rt+Et)),H+=On-We,M+=dn-Ve}ie.push({el:re,top:We,left:Ve})}return ie};var bie=t=>t===!1?{block:"end",inline:"nearest"}:(e=>e===Object(e)&&Object.keys(e).length!==0)(t)?t:{block:"start",inline:"nearest"};function hm(t,e){if(!t.isConnected||!(r=>{let o=r;for(;o&&o.parentNode;){if(o.parentNode===document)return!0;o=o.parentNode instanceof ShadowRoot?o.parentNode.host:o.parentNode}return!1})(t))return;let i=(r=>{let o=window.getComputedStyle(r);return{top:parseFloat(o.scrollMarginTop)||0,right:parseFloat(o.scrollMarginRight)||0,bottom:parseFloat(o.scrollMarginBottom)||0,left:parseFloat(o.scrollMarginLeft)||0}})(t);if((r=>typeof r=="object"&&typeof r.behavior=="function")(e))return e.behavior(jw(t,e));let n=typeof e=="boolean"||e==null?void 0:e.behavior;for(let{el:r,top:o,left:s}of jw(t,bie(e))){let a=o-i.top+i.bottom,l=s-i.left+i.right;r.scroll({top:a,left:l,behavior:n})}}function ya(t){return["code","smart"].includes(t)}function e6(t){return["markdown","code"].includes(t)}var yie={mounted(){this.props=this.getProps(),this.isFocused=!1,this.insertMode=!1,this.liveEditors={},this.updateInsertModeAvailability();let t=this.el.querySelector("[data-el-amplify-outputs-button]");t&&t.addEventListener("click",e=>{this.el.toggleAttribute("data-js-amplified")}),this.props.type==="smart"&&this.el.querySelector("[data-el-toggle-source-button]").addEventListener("click",i=>{this.el.toggleAttribute("data-js-source-visible"),this.updateInsertModeAvailability(),this.maybeFocusCurrentEditor()}),this.el.addEventListener("lb:cell:editor_created",e=>{let{tag:i,liveEditor:n}=e.detail;this.handleCellEditorCreated(i,n)}),this.el.addEventListener("lb:cell:editor_removed",e=>{let{tag:i}=e.detail;this.handleCellEditorRemoved(i)}),this.el.addEventListener("mouseenter",e=>{this.el.setAttribute("data-js-hover","")}),this.el.addEventListener("mouseleave",e=>{this.el.removeAttribute("data-js-hover")}),this.subscriptions=[at.subscribe("navigation:focus_changed",({focusableId:e,scroll:i})=>this.handleElementFocused(e,i)),at.subscribe("navigation:insert_mode_changed",({enabled:e})=>this.handleInsertModeChanged(e)),at.subscribe("cells:cell_moved",({cellId:e})=>this.handleCellMoved(e)),at.subscribe(`cells:${this.props.cellId}:dispatch_queue_evaluation`,({dispatch:e})=>this.handleDispatchQueueEvaluation(e)),at.subscribe(`cells:${this.props.cellId}:jump_to_line`,({line:e,offset:i=0})=>this.handleJumpToLine(e,i))],this._handleViewportResize=this.handleViewportResize.bind(this),window.visualViewport.addEventListener("resize",this._handleViewportResize)},disconnected(){this.el.removeAttribute("id")},destroyed(){this.subscriptions.forEach(t=>t.destroy()),window.visualViewport.removeEventListener("resize",this._handleViewportResize)},updated(){let t=this.props;this.props=this.getProps(),this.props.evaluationDigest!==t.evaluationDigest&&this.updateChangeIndicator()},getProps(){return Ot(this.el,["cell-id","type","session-path","evaluation-digest","smart-cell-js-view-ref","allowed-uri-schemes"])},handleElementFocused(t,e){this.props.cellId===t?(this.isFocused=!0,this.el.setAttribute("data-js-focused",""),e&&ga(this.el)):this.isFocused&&(this.isFocused=!1,this.el.removeAttribute("data-js-focused"))},handleCellEditorCreated(t,e){if(this.liveEditors[t]=e,this.updateInsertModeAvailability(),e===this.currentEditor()&&this.maybeFocusCurrentEditor(),e.onBlur(()=>{setTimeout(()=>{this.isFocused&&this.insertMode&&this.currentEditor().focus()},0)}),e.onFocus(()=>{setTimeout(()=>{!this.isFocused||!this.insertMode?this.currentEditor().blur():this.sendCursorHistory()},0)}),e.onSelectionChange(()=>{this.isFocused&&this.sendCursorHistory()}),t==="primary"){let i=e.getSource();if(this.el.toggleAttribute("data-js-empty",i===""),e.onChange(n=>{this.el.toggleAttribute("data-js-empty",n==="")}),this.props.type==="markdown"){let n=this.el.querySelector("[data-el-markdown-container]"),r=new ba(n,i,{baseUrl:this.props.sessionPath,emptyText:"Empty markdown cell",allowedUriSchemes:this.props.allowedUriSchemes});e.onChange(o=>{r.setContent(o)})}ya(this.props.type)&&(this.updateChangeIndicator(),e.onChange(n=>{this.updateChangeIndicator()}),this.handleEvent(`evaluation_finished:${this.props.cellId}`,({code_markers:n})=>{e.setCodeMarkers(n)}),this.handleEvent(`start_evaluation:${this.props.cellId}`,()=>{e.clearDoctests()}),this.handleEvent(`doctest_report:${this.props.cellId}`,n=>{e.updateDoctests([n])}),this.handleEvent("erase_outputs",()=>{e.setCodeMarkers([]),e.clearDoctests()}))}},handleCellEditorRemoved(t){delete this.liveEditors[t]},handleViewportResize(){this.isFocused&&this.scrollEditorCursorIntoViewIfNeeded()},currentEditor(){return this.liveEditors[this.currentEditorTag()]},currentEditorTag(){return this.props.type==="smart"?this.el.hasAttribute("data-js-source-visible")?"primary":"secondary":"primary"},updateInsertModeAvailability(){this.el.toggleAttribute("data-js-insert-mode-disabled",!this.currentEditor())},maybeFocusCurrentEditor(){this.isFocused&&this.insertMode&&this.currentEditor().focus()},updateChangeIndicator(){let t=this.el.querySelector("[data-el-cell-status]");if(t&&t.querySelector("[data-el-change-indicator]")&&this.props.evaluationDigest){let i=this.liveEditors.primary.getSource(),n=sm(i),r=this.props.evaluationDigest!==n;this.el.toggleAttribute("data-js-changed",r)}},handleInsertModeChanged(t){this.isFocused&&!this.insertMode&&t?(this.insertMode=t,this.el.setAttribute("data-js-insert-mode",""),this.currentEditor()&&(this.currentEditor().focus(),this.scrollEditorCursorIntoViewIfNeeded())):this.insertMode&&!t&&(this.insertMode=t,this.el.removeAttribute("data-js-insert-mode"),this.currentEditor()&&this.currentEditor().blur())},handleCellMoved(t){this.isFocused&&t===this.props.cellId&&ga(this.el)},handleDispatchQueueEvaluation(t){this.props.type==="smart"&&this.props.smartCellJsViewRef?at.broadcast(`js_views:${this.props.smartCellJsViewRef}:sync`,{callback:t}):t()},handleJumpToLine(t,e){this.isFocused&&this.currentEditor().moveCursorToLine(t,e)},scrollEditorCursorIntoViewIfNeeded(){let t=this.currentEditor().getElementAtCursor();BR(t,{scrollMarginTop:"128px"},()=>{hm(t,{scrollMode:"if-needed",behavior:"instant",block:"start"})})},sendCursorHistory(){let t=this.currentEditor().getCurrentCursorPosition();t!==null&&at.broadcast("navigation:cursor_moved",{line:t.line,offset:t.offset,cellId:this.props.cellId})}},t6=yie;var Xf=t=>{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=Zw(t.state,i.from);return n.line?xie(t):n.block?vie(t):!1};function Rf(t,e){return({state:i,dispatch:n})=>{if(i.readOnly)return!1;let r=t(e,i);return r?(n(i.update(r)),!0):!1}}var xie=Rf(Bw,0),i6=Rf(Bw,1),n6=Rf(Bw,2),r6=Rf(o6,0);var vie=Rf((t,e)=>o6(t,e,kie(e)),0);function Zw(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}var $f=50;function wie(t,{open:e,close:i},n,r){let o=t.sliceDoc(n-$f,n),s=t.sliceDoc(r,r+$f),a=/\s*$/.exec(o)[0].length,l=/^\s*/.exec(s)[0].length,c=o.length-a;if(o.slice(c-e.length,c)==e&&s.slice(l,l+i.length)==i)return{open:{pos:n-a,margin:a&&1},close:{pos:r+l,margin:l&&1}};let u,f;r-n<=2*$f?u=f=t.sliceDoc(n,r):(u=t.sliceDoc(n,n+$f),f=t.sliceDoc(r-$f,r));let d=/^\s*/.exec(u)[0].length,O=/\s*$/.exec(f)[0].length,m=f.length-O-i.length;return u.slice(d,d+e.length)==e&&f.slice(m,m+i.length)==i?{open:{pos:n+d+e.length,margin:/\s/.test(u.charAt(d+e.length))?1:0},close:{pos:r-O-i.length,margin:/\s/.test(f.charAt(m-1))?1:0}}:null}function kie(t){let e=[];for(let i of t.selection.ranges){let n=t.doc.lineAt(i.from),r=i.to<=n.to?n:t.doc.lineAt(i.to);r.from>n.from&&r.from==i.to&&(r=i.to==n.to+1?n:t.doc.lineAt(i.to-1));let o=e.length-1;o>=0&&e[o].to>n.from?e[o].to=r.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:r.to})}return e}function o6(t,e,i=e.selection.ranges){let n=i.map(o=>Zw(e,o.from).block);if(!n.every(o=>o))return null;let r=i.map((o,s)=>wie(e,n[s],o.from,o.to));if(t!=2&&!r.every(o=>o))return{changes:e.changes(i.map((o,s)=>r[s]?[]:[{from:o.from,insert:n[s].open+" "},{from:o.to,insert:" "+n[s].close}]))};if(t!=1&&r.some(o=>o)){let o=[];for(let s=0,a;sr&&(o==s||s>f.from)){r=f.from;let d=/^\s*/.exec(f.text)[0].length,O=d==f.length,m=f.text.slice(d,d+c.length)==c?d:-1;do.comment<0&&(!o.empty||o.single))){let o=[];for(let{line:a,token:l,indent:c,empty:u,single:f}of n)(f||!u)&&o.push({from:a.from+c,insert:l+" "});let s=e.changes(o);return{changes:s,selection:e.selection.map(s,1)}}else if(t!=1&&n.some(o=>o.comment>=0)){let o=[];for(let{line:s,comment:a,token:l}of n)if(a>=0){let c=s.from+a,u=c+l.length;s.text[u-s.from]==" "&&u++,o.push({from:c,to:u})}return{changes:o}}return null}var Vw=wi.define(),Sie=wi.define(),Tie=be.define(),s6=be.define({combine(t){return Qt(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,i)=>i},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,i)=>(n,r)=>e(n,r)||i(n,r)})}}),a6=Ge.define({create(){return xa.empty},update(t,e){let i=e.state.facet(s6),n=e.annotation(Vw);if(n){let l=Yn.fromTransaction(e,n.selection),c=n.side,u=c==0?t.undone:t.done;return l?u=Om(u,u.length,i.minDepth,l):u=f6(u,e.startState.selection),new xa(c==0?n.rest:u,c==0?u:n.rest)}let r=e.annotation(Sie);if((r=="full"||r=="before")&&(t=t.isolate()),e.annotation(Xt.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let o=Yn.fromTransaction(e),s=e.annotation(Xt.time),a=e.annotation(Xt.userEvent);return o?t=t.addChanges(o,s,a,i,e):e.selection&&(t=t.addSelection(e.startState.selection,s,a,i.newGroupDelay)),(r=="full"||r=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new xa(t.done.map(Yn.fromJSON),t.undone.map(Yn.fromJSON))}});function l6(t={}){return[a6,s6.of(t),fe.domEventHandlers({beforeinput(e,i){let n=e.inputType=="historyUndo"?va:e.inputType=="historyRedo"?ls:null;return n?(e.preventDefault(),n(i)):!1}})]}function Yw(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let r=i.field(a6,!1);if(!r)return!1;let o=r.pop(t,i,e);return o?(n(o),!0):!1}}var va=Yw(0,!1),ls=Yw(1,!1),c6=Yw(0,!0);var Yn=class t{constructor(e,i,n,r,o){this.changes=e,this.effects=i,this.mapped=n,this.startSelection=r,this.selectionsAfter=o}setSelAfter(e){return new t(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,i,n;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(i=this.mapped)===null||i===void 0?void 0:i.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(e){return new t(e.changes&&_i.fromJSON(e.changes),[],e.mapped&&Zr.fromJSON(e.mapped),e.startSelection&&K.fromJSON(e.startSelection),e.selectionsAfter.map(K.fromJSON))}static fromTransaction(e,i){let n=_n;for(let r of e.startState.facet(Tie)){let o=r(e);o.length&&(n=n.concat(o))}return!n.length&&e.changes.empty?null:new t(e.changes.invert(e.startState.doc),n,void 0,i||e.startState.selection,_n)}static selection(e){return new t(void 0,_n,void 0,void 0,e)}};function Om(t,e,i,n){let r=e+1>i+20?e-i-1:0,o=t.slice(r,e);return o.push(n),o}function Eie(t,e){let i=[],n=!1;return t.iterChangedRanges((r,o)=>i.push(r,o)),e.iterChangedRanges((r,o,s,a)=>{for(let l=0;l=c&&s<=u&&(n=!0)}}),n}function Pie(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((i,n)=>i.empty!=e.ranges[n].empty).length===0}function u6(t,e){return t.length?e.length?t.concat(e):t:e}var _n=[],Cie=200;function f6(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-Cie));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),Om(t,t.length-1,1e9,i.setSelAfter(n)))}else return[Yn.selection([e])]}function Qie(t){let e=t[t.length-1],i=t.slice();return i[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),i}function Ww(t,e){if(!t.length)return t;let i=t.length,n=_n;for(;i;){let r=_ie(t[i-1],e,n);if(r.changes&&!r.changes.empty||r.effects.length){let o=t.slice(0,i);return o[i-1]=r,o}else e=r.mapped,i--,n=r.selectionsAfter}return n.length?[Yn.selection(n)]:_n}function _ie(t,e,i){let n=u6(t.selectionsAfter.length?t.selectionsAfter.map(a=>a.map(e)):_n,i);if(!t.changes)return Yn.selection(n);let r=t.changes.map(e),o=e.mapDesc(t.changes,!0),s=t.mapped?t.mapped.composeDesc(o):o;return new Yn(r,Se.mapEffects(t.effects,e),s,t.startSelection.map(o),n)}var Aie=/^(input\.type|delete)($|\.)/,xa=class t{constructor(e,i,n=0,r=void 0){this.done=e,this.undone=i,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new t(this.done,this.undone):this}addChanges(e,i,n,r,o){let s=this.done,a=s[s.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!n||Aie.test(n))&&(!a.selectionsAfter.length&&i-this.prevTime0&&i-this.prevTimei.empty?t.moveByChar(i,e):pm(i,e))}function us(t){return t.textDirectionAt(t.state.selection.main.head)==st.LTR}var If=t=>mm(t,!us(t)),Fw=t=>mm(t,us(t)),h6=t=>mm(t,!0),gm=t=>mm(t,!1);function d6(t,e){return wa(t,i=>i.empty?t.moveByGroup(i,e):pm(i,e))}var bm=t=>d6(t,!us(t)),ym=t=>d6(t,us(t));var DTe=typeof Intl!="undefined"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function O6(t,e){return wa(t,i=>{if(!i.empty)return pm(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)})}var Df=t=>O6(t,!1),zf=t=>O6(t,!0);function p6(t){let e=t.scrollDOM.clientHeights.empty?t.moveVertically(s,e,i.height):pm(s,e));if(r.eq(n.selection))return!1;let o;if(i.selfScroll){let s=t.coordsAtPos(n.selection.main.head),a=t.scrollDOM.getBoundingClientRect(),l=a.top+i.marginTop,c=a.bottom-i.marginBottom;s&&s.top>l&&s.bottomm6(t,!1),jl=t=>m6(t,!0);function xm(t,e,i){let n=t.lineBlockAt(e.head),r=t.moveToLineBoundary(e,i);if(r.head==e.head&&r.head!=(i?n.to:n.from)&&(r=t.moveToLineBoundary(e,i,!1)),!i&&r.head==n.from&&n.length){let o=/^\s*/.exec(t.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;o&&e.head!=n.from+o&&(r=K.cursor(n.from+o))}return r}var Uf=t=>wa(t,e=>xm(t,e,!0)),Mf=t=>wa(t,e=>xm(t,e,!1));var vm=t=>wa(t,e=>K.cursor(t.lineBlockAt(e.head).from,1)),wm=t=>wa(t,e=>K.cursor(t.lineBlockAt(e.head).to,-1));function $ie(t,e,i){let n=!1,r=Lf(t.selection,o=>{let s=Tn(t,o.head,-1)||Tn(t,o.head,1)||o.head>0&&Tn(t,o.head-1,1)||o.head$ie(t,e,!1);function fs(t,e){let i=Lf(t.state.selection,n=>{let r=e(n);return K.range(n.anchor,r.head,r.goalColumn,r.bidiLevel||void 0)});return i.eq(t.state.selection)?!1:(t.dispatch(cs(t.state,i)),!0)}function km(t,e){return fs(t,i=>t.moveByChar(i,e))}var Hw=t=>km(t,!us(t)),Gw=t=>km(t,us(t)),Kw=t=>km(t,!0),Jw=t=>km(t,!1);function Sm(t,e){return fs(t,i=>t.moveByGroup(i,e))}var Tm=t=>Sm(t,!us(t)),Em=t=>Sm(t,us(t)),b6=t=>Sm(t,!0),y6=t=>Sm(t,!1);function x6(t,e){return fs(t,i=>t.moveVertically(i,e))}var Wl=t=>x6(t,!1),Vl=t=>x6(t,!0);function v6(t,e){return fs(t,i=>t.moveVertically(i,e,p6(t).height))}var Nf=t=>v6(t,!1),ka=t=>v6(t,!0),ek=t=>fs(t,e=>xm(t,e,!0)),tk=t=>fs(t,e=>xm(t,e,!1));var qf=t=>fs(t,e=>K.cursor(t.lineBlockAt(e.head).from)),jf=t=>fs(t,e=>K.cursor(t.lineBlockAt(e.head).to)),Wf=({state:t,dispatch:e})=>(e(cs(t,{anchor:0})),!0),Vf=({state:t,dispatch:e})=>(e(cs(t,{anchor:t.doc.length})),!0),Zl=({state:t,dispatch:e})=>(e(cs(t,{anchor:t.selection.main.anchor,head:0})),!0),Bl=({state:t,dispatch:e})=>(e(cs(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),Pm=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),w6=({state:t,dispatch:e})=>{let i=_m(t).map(({from:n,to:r})=>K.range(n,Math.min(r+1,t.doc.length)));return e(t.update({selection:K.create(i),userEvent:"select"})),!0};function Cm(t,e){if(t.state.readOnly)return!1;let i="delete.selection",{state:n}=t,r=n.changeByRange(o=>{let{from:s,to:a}=o;if(s==a){let l=e(o);ls&&(i="delete.forward",l=dm(t,l,!0)),s=Math.min(s,l),a=Math.max(a,l)}else s=dm(t,s,!1),a=dm(t,a,!0);return s==a?{range:o}:{changes:{from:s,to:a},range:K.cursor(s,sr(t)))n.between(e,e,(r,o)=>{re&&(e=i?o:r)});return e}var k6=(t,e,i)=>Cm(t,n=>{let r=n.from,{state:o}=t,s=o.doc.lineAt(r),a,l;if(i&&!e&&r>s.from&&rk6(t,!1,!0);var Zf=t=>k6(t,!0,!1),S6=(t,e)=>Cm(t,i=>{let n=i.head,{state:r}=t,o=r.doc.lineAt(n),s=r.charCategorizer(n);for(let a=null;;){if(n==(e?o.to:o.from)){n==i.head&&o.number!=(e?r.doc.lines:1)&&(n+=e?1:-1);break}let l=Bt(o.text,n-o.from,e)+o.from,c=o.text.slice(Math.min(n,l)-o.from,Math.max(n,l)-o.from),u=s(c);if(a!=null&&u!=a)break;(c!=" "||n!=i.head)&&(a=u),n=l}return n}),ik=t=>S6(t,!1),T6=t=>S6(t,!0),nk=t=>Cm(t,e=>{let i=t.lineBlockAt(e.head).to;return e.headCm(t,e=>{let i=t.lineBlockAt(e.head).from;return e.head>i?i:Math.max(0,e.head-1)});var Bf=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:Fe.of(["",""])},range:K.cursor(n.from)}));return e(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0},Qm=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange(n=>{if(!n.empty||n.from==0||n.from==t.doc.length)return{range:n};let r=n.from,o=t.doc.lineAt(r),s=r==o.from?r-1:Bt(o.text,r-o.from,!1)+o.from,a=r==o.to?r+1:Bt(o.text,r-o.from,!0)+o.from;return{changes:{from:s,to:a,insert:t.doc.slice(r,a).append(t.doc.slice(s,r))},range:K.cursor(a)}});return i.changes.empty?!1:(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function _m(t){let e=[],i=-1;for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),o=t.doc.lineAt(n.to);if(!n.empty&&n.to==o.from&&(o=t.doc.lineAt(n.to-1)),i>=r.number){let s=e[e.length-1];s.to=o.to,s.ranges.push(n)}else e.push({from:r.from,to:o.to,ranges:[n]});i=o.number+1}return e}function P6(t,e,i){if(t.readOnly)return!1;let n=[],r=[];for(let o of _m(t)){if(i?o.to==t.doc.length:o.from==0)continue;let s=t.doc.lineAt(i?o.to+1:o.from-1),a=s.length+1;if(i){n.push({from:o.to,to:s.to},{from:o.from,insert:s.text+t.lineBreak});for(let l of o.ranges)r.push(K.range(Math.min(t.doc.length,l.anchor+a),Math.min(t.doc.length,l.head+a)))}else{n.push({from:s.from,to:o.from},{from:o.to,insert:t.lineBreak+s.text});for(let l of o.ranges)r.push(K.range(l.anchor-a,l.head-a))}}return n.length?(e(t.update({changes:n,scrollIntoView:!0,selection:K.create(r,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}var C6=({state:t,dispatch:e})=>P6(t,e,!1),Q6=({state:t,dispatch:e})=>P6(t,e,!0);function _6(t,e,i){if(t.readOnly)return!1;let n=[];for(let r of _m(t))i?n.push({from:r.from,insert:t.doc.slice(r.from,r.to)+t.lineBreak}):n.push({from:r.to,insert:t.lineBreak+t.doc.slice(r.from,r.to)});return e(t.update({changes:n,scrollIntoView:!0,userEvent:"input.copyline"})),!0}var A6=({state:t,dispatch:e})=>_6(t,e,!1),$6=({state:t,dispatch:e})=>_6(t,e,!0),X6=t=>{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(_m(e).map(({from:r,to:o})=>(r>0?r--:o{let o;if(t.lineWrapping){let s=t.lineBlockAt(r.head),a=t.coordsAtPos(r.head,r.assoc||1);a&&(o=s.bottom+t.documentTop-a.bottom+t.defaultLineHeight/2)}return t.moveVertically(r,!0,o)}).map(i);return t.dispatch({changes:i,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0};function Xie(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i=qe(t).resolveInner(e),n=i.childBefore(e),r=i.childAfter(e),o;return n&&r&&n.to<=e&&r.from>=e&&(o=n.type.prop(_e.closedBy))&&o.indexOf(r.name)>-1&&t.doc.lineAt(n.to).from==t.doc.lineAt(r.from).from&&!/\S/.test(t.sliceDoc(n.to,r.from))?{from:n.to,to:r.from}:null}var Yf=L6(!1),R6=L6(!0);function L6(t){return({state:e,dispatch:i})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>{let{from:o,to:s}=r,a=e.doc.lineAt(o),l=!t&&o==s&&Xie(e,o);t&&(o=s=(s<=a.to?a:e.doc.lineAt(s)).to);let c=new Ks(e,{simulateBreak:o,simulateDoubleBreak:!!l}),u=kl(c,o);for(u==null&&(u=$i(/^\s*/.exec(e.doc.lineAt(o).text)[0],e.tabSize));sa.from&&o{let r=[];for(let s=n.from;s<=n.to;){let a=t.doc.lineAt(s);a.number>i&&(n.empty||n.to>a.from)&&(e(a,r,n),i=a.number),s=a.to+1}let o=t.changes(r);return{changes:r,range:K.range(o.mapPos(n.anchor,1),o.mapPos(n.head,1))}})}var I6=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new Ks(t,{overrideIndentation:o=>{let s=i[o];return s==null?-1:s}}),r=rk(t,(o,s,a)=>{let l=kl(n,o.from);if(l==null)return;/\S/.test(o.text)||(l=0);let c=/^\s*/.exec(o.text)[0],u=Gr(t,l);(c!=u||a.fromt.readOnly?!1:(e(t.update(rk(t,(i,n)=>{n.push({from:i.from,insert:t.facet(Vn)})}),{userEvent:"input.indent"})),!0),Hf=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(rk(t,(i,n)=>{let r=/^\s*/.exec(i.text)[0];if(!r)return;let o=$i(r,t.tabSize),s=0,a=Gr(t,Math.max(0,o-br(t)));for(;st.normalize("NFKD"):t=>t,ds=class{constructor(e,i,n=0,r=e.length,o,s){this.test=s,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=o?a=>o(z6(a)):z6,this.query=this.normalize(i)}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 ui(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 i=Tu(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=nn(e);let r=this.normalize(i);if(r.length)for(let o=0,s=n;;o++){let a=r.charCodeAt(o),l=this.match(a,s,this.bufferPos+this.bufferStart);if(o==r.length-1){if(l)return this.value=l,this;break}s==n&&othis.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 i=this.matchPos<=this.to&&this.re.exec(this.curLine);if(i){let n=this.curLineStart+i.index,r=n+i[0].length;if(this.matchPos=Lm(this.text,r+(n==r?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(nthis.value.to)&&(!this.test||this.test(n,r,i)))return this.value={from:n,to:r,match:i},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=n||r.to<=i){let a=new t(i,e.sliceString(i,n));return ok.set(e,a),a}if(r.from==i&&r.to==n)return r;let{text:o,from:s}=r;return s>i&&(o=e.sliceString(i,s)+o,s=i),r.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,i=this.re.exec(this.flat.text);if(i&&!i[0]&&i.index==e&&(this.re.lastIndex=e+1,i=this.re.exec(this.flat.text)),i){let n=this.flat.from+i.index,r=n+i[0].length;if((this.flat.to>=this.to||i.index+i[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,r,i)))return this.value={from:n,to:r,match:i},this.matchPos=Lm(this.text,r+(n==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Xm.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol!="undefined"&&(Gl.prototype[Symbol.iterator]=Rm.prototype[Symbol.iterator]=function(){return this});function Lie(t){try{return new RegExp(t,fk),!0}catch(e){return!1}}function Lm(t,e){if(e>=t.length)return e;let i=t.lineAt(e),n;for(;e=56320&&n<57344;)e++;return e}function sk(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),i=ct("input",{class:"cm-textfield",name:"line",value:e}),n=ct("form",{class:"cm-gotoLine",onkeydown:o=>{o.keyCode==27?(o.preventDefault(),t.dispatch({effects:Gf.of(!1)}),t.focus()):o.keyCode==13&&(o.preventDefault(),r())},onsubmit:o=>{o.preventDefault(),r()}},ct("label",t.state.phrase("Go to line"),": ",i)," ",ct("button",{class:"cm-button",type:"submit"},t.state.phrase("go")),ct("button",{name:"close",onclick:()=>{t.dispatch({effects:Gf.of(!1)}),t.focus()},"aria-label":t.state.phrase("close"),type:"button"},["\xD7"]));function r(){let o=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(i.value);if(!o)return;let{state:s}=t,a=s.doc.lineAt(s.selection.main.head),[,l,c,u,f]=o,d=u?+u.slice(1):0,O=c?+c:a.number;if(c&&f){let v=O/100;l&&(v=v*(l=="-"?-1:1)+a.number/s.doc.lines),O=Math.round(s.doc.lines*v)}else c&&l&&(O=O*(l=="-"?-1:1)+a.number);let m=s.doc.line(Math.max(1,Math.min(s.doc.lines,O))),x=K.cursor(m.from+Math.max(0,Math.min(d,m.length)));t.dispatch({effects:[Gf.of(!1),fe.scrollIntoView(x.from,{y:"center"})],selection:x}),t.focus()}return{dom:n}}var Gf=Se.define(),U6=Ge.define({create(){return!0},update(t,e){for(let i of e.effects)i.is(Gf)&&(t=i.value);return t},provide:t=>kn.from(t,e=>e?sk:null)}),V6=t=>{let e=Fs(t,sk);if(!e){let i=[Gf.of(!0)];t.state.field(U6,!1)==null&&i.push(Se.appendConfig.of([U6,Iie])),t.dispatch({effects:i}),e=Fs(t,sk)}return e&&e.dom.querySelector("input").select(),!0},Iie=fe.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),Die={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Z6=be.define({combine(t){return Qt(t,Die,{highlightWordAroundCursor:(e,i)=>e||i,minSelectionLength:Math.min,maxMatches:Math.min})}});function B6(t){let e=[qie,Nie];return t&&e.push(Z6.of(t)),e}var zie=we.mark({class:"cm-selectionMatch"}),Uie=we.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function M6(t,e,i,n){return(i==0||t(e.sliceDoc(i-1,i))!=pt.Word)&&(n==e.doc.length||t(e.sliceDoc(n,n+1))!=pt.Word)}function Mie(t,e,i,n){return t(e.sliceDoc(i,i+1))==pt.Word&&t(e.sliceDoc(n-1,n))==pt.Word}var Nie=He.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Z6),{state:i}=t,n=i.selection;if(n.ranges.length>1)return we.none;let r=n.main,o,s=null;if(r.empty){if(!e.highlightWordAroundCursor)return we.none;let l=i.wordAt(r.head);if(!l)return we.none;s=i.charCategorizer(r.head),o=i.sliceDoc(l.from,l.to)}else{let l=r.to-r.from;if(l200)return we.none;if(e.wholeWords){if(o=i.sliceDoc(r.from,r.to),s=i.charCategorizer(r.head),!(M6(s,i,r.from,r.to)&&Mie(s,i,r.from,r.to)))return we.none}else if(o=i.sliceDoc(r.from,r.to),!o)return we.none}let a=[];for(let l of t.visibleRanges){let c=new ds(i.doc,o,l.from,l.to);for(;!c.next().done;){let{from:u,to:f}=c.value;if((!s||M6(s,i,u,f))&&(r.empty&&u<=r.from&&f>=r.to?a.push(Uie.range(u,f)):(u>=r.to||f<=r.from)&&a.push(zie.range(u,f)),a.length>e.maxMatches))return we.none}}return we.set(a)}},{decorations:t=>t.decorations}),qie=fe.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),jie=({state:t,dispatch:e})=>{let{selection:i}=t,n=K.create(i.ranges.map(r=>t.wordAt(r.head)||K.cursor(r.head)),i.mainIndex);return n.eq(i)?!1:(e(t.update({selection:n})),!0)};function Wie(t,e){let{main:i,ranges:n}=t.selection,r=t.wordAt(i.head),o=r&&r.from==i.from&&r.to==i.to;for(let s=!1,a=new ds(t.doc,e,n[n.length-1].to);;)if(a.next(),a.done){if(s)return null;a=new ds(t.doc,e,0,Math.max(0,n[n.length-1].from-1)),s=!0}else{if(s&&n.some(l=>l.from==a.value.from))continue;if(o){let l=t.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}var Y6=({state:t,dispatch:e})=>{let{ranges:i}=t.selection;if(i.some(o=>o.from===o.to))return jie({state:t,dispatch:e});let n=t.sliceDoc(i[0].from,i[0].to);if(t.selection.ranges.some(o=>t.sliceDoc(o.from,o.to)!=n))return!1;let r=Wie(t,n);return r?(e(t.update({selection:t.selection.addRange(K.range(r.from,r.to),!1),effects:fe.scrollIntoView(r.to)})),!0):!1},Jl=be.define({combine(t){return Qt(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new uk(e),scrollToMatch:e=>fe.scrollIntoView(e)})}});var Kl=class{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||Lie(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(i,n)=>n=="n"?` `:n=="r"?"\r":n=="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 lk(this):new ak(this)}getCursor(e,i=0,n){let r=e.doc?e:ot.create({doc:e});return n==null&&(n=r.doc.length),this.regexp?Hl(this,r,i,n):Fl(this,r,i,n)}},Im=class{constructor(e){this.spec=e}};function Fl(t,e,i,n){return new ds(e.doc,t.unquoted,i,n,t.caseSensitive?void 0:r=>r.toLowerCase(),t.wholeWord?Vie(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function Vie(t,e){return(i,n,r,o)=>((o>i||o+r.length=i)return null;r.push(n.value)}return r}highlight(e,i,n,r){let o=Fl(this.spec,e,Math.max(0,i-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!o.next().done;)r(o.value.from,o.value.to)}};function Hl(t,e,i,n){return new Gl(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?Zie(e.charCategorizer(e.selection.main.head)):void 0},i,n)}function Dm(t,e){return t.slice(Bt(t,e,!1),e)}function zm(t,e){return t.slice(e,Bt(t,e))}function Zie(t){return(e,i,n)=>!n[0].length||(t(Dm(n.input,n.index))!=pt.Word||t(zm(n.input,n.index))!=pt.Word)&&(t(zm(n.input,n.index+n[0].length))!=pt.Word||t(Dm(n.input,n.index+n[0].length))!=pt.Word)}var lk=class extends Im{nextMatch(e,i,n){let r=Hl(this.spec,e,n,e.doc.length).next();return r.done&&(r=Hl(this.spec,e,0,i).next()),r.done?null:r.value}prevMatchInRange(e,i,n){for(let r=1;;r++){let o=Math.max(i,n-r*1e4),s=Hl(this.spec,e,o,n),a=null;for(;!s.next().done;)a=s.value;if(a&&(o==i||a.from>o+10))return a;if(o==i)return null}}prevMatch(e,i,n){return this.prevMatchInRange(e,0,i)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(i,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let r=n.length;r>0;r--){let o=+n.slice(0,r);if(o>0&&o=i)return null;r.push(n.value)}return r}highlight(e,i,n,r){let o=Hl(this.spec,e,Math.max(0,i-250),Math.min(n+250,e.doc.length));for(;!o.next().done;)r(o.value.from,o.value.to)}},uo=Se.define(),hk=Se.define(),hs=Ge.define({create(t){return new Kf(ck(t).create(),null)},update(t,e){for(let i of e.effects)i.is(uo)?t=new Kf(i.value.create(),t.panel):i.is(hk)&&(t=new Kf(t.query,i.value?pk:null));return t},provide:t=>kn.from(t,e=>e.panel)});var Kf=class{constructor(e,i){this.query=e,this.panel=i}},Bie=we.mark({class:"cm-searchMatch"}),Yie=we.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Fie=He.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(hs))}update(t){let e=t.state.field(hs);(e!=t.startState.field(hs)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return we.none;let{view:i}=this,n=new Ai;for(let r=0,o=i.visibleRanges,s=o.length;ro[r+1].from-2*250;)l=o[++r].to;t.highlight(i.state,a,l,(c,u)=>{let f=i.state.selection.ranges.some(d=>d.from==c&&d.to==u);n.add(c,u,f?Yie:Bie)})}return n.finish()}},{decorations:t=>t.decorations});function Jf(t){return e=>{let i=e.state.field(hs,!1);return i&&i.query.spec.valid?t(e,i):ec(e)}}var N6=Jf((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let r=K.single(n.from,n.to),o=t.state.facet(Jl);return t.dispatch({selection:r,effects:[gk(t,n),o.scrollToMatch(r.main,t)],userEvent:"select.search"}),G6(t),!0}),q6=Jf((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,r=e.prevMatch(i,n,n);if(!r)return!1;let o=K.single(r.from,r.to),s=t.state.facet(Jl);return t.dispatch({selection:o,effects:[gk(t,r),s.scrollToMatch(o.main,t)],userEvent:"select.search"}),G6(t),!0}),dk=Jf((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!i||!i.length?!1:(t.dispatch({selection:K.create(i.map(n=>K.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),F6=({state:t,dispatch:e})=>{let i=t.selection;if(i.ranges.length>1||i.main.empty)return!1;let{from:n,to:r}=i.main,o=[],s=0;for(let a=new ds(t.doc,t.sliceDoc(n,r));!a.next().done;){if(o.length>1e3)return!1;a.value.from==n&&(s=o.length),o.push(K.range(a.value.from,a.value.to))}return e(t.update({selection:K.create(o,s),userEvent:"select.search.matches"})),!0},j6=Jf((t,{query:e})=>{let{state:i}=t,{from:n,to:r}=i.selection.main;if(i.readOnly)return!1;let o=e.nextMatch(i,n,n);if(!o)return!1;let s=o,a=[],l,c,u=[];if(s.from==n&&s.to==r&&(c=i.toText(e.getReplacement(s)),a.push({from:s.from,to:s.to,insert:c}),s=e.nextMatch(i,s.from,s.to),u.push(fe.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+"."))),s){let f=a.length==0||a[0].from>=o.to?0:o.to-o.from-c.length;l=K.single(s.from-f,s.to-f),u.push(gk(t,s)),u.push(i.facet(Jl).scrollToMatch(l.main,t))}return t.dispatch({changes:a,selection:l,effects:u,userEvent:"input.replace"}),!0}),Ok=Jf((t,{query:e})=>{if(t.state.readOnly)return!1;let i=e.matchAll(t.state,1e9).map(r=>{let{from:o,to:s}=r;return{from:o,to:s,insert:e.getReplacement(r)}});if(!i.length)return!1;let n=t.state.phrase("replaced $ matches",i.length)+".";return t.dispatch({changes:i,effects:fe.announce.of(n),userEvent:"input.replace.all"}),!0});function pk(t){return t.state.facet(Jl).createPanel(t)}function ck(t,e){var i,n,r,o,s;let a=t.selection.main,l=a.empty||a.to>a.from+100?"":t.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=t.facet(Jl);return new Kl({search:((i=e==null?void 0:e.literal)!==null&&i!==void 0?i:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(n=e==null?void 0:e.caseSensitive)!==null&&n!==void 0?n:c.caseSensitive,literal:(r=e==null?void 0:e.literal)!==null&&r!==void 0?r:c.literal,regexp:(o=e==null?void 0:e.regexp)!==null&&o!==void 0?o:c.regexp,wholeWord:(s=e==null?void 0:e.wholeWord)!==null&&s!==void 0?s:c.wholeWord})}function H6(t){let e=Fs(t,pk);return e&&e.dom.querySelector("[main-field]")}function G6(t){let e=H6(t);e&&e==t.root.activeElement&&e.select()}var ec=t=>{let e=t.state.field(hs,!1);if(e&&e.panel){let i=H6(t);if(i&&i!=t.root.activeElement){let n=ck(t.state,e.query.spec);n.valid&&t.dispatch({effects:uo.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[hk.of(!0),e?uo.of(ck(t.state,e.query.spec)):Se.appendConfig.of(Gie)]});return!0},mk=t=>{let e=t.state.field(hs,!1);if(!e||!e.panel)return!1;let i=Fs(t,pk);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:hk.of(!1)}),!0};var uk=class{constructor(e){this.view=e;let i=this.query=e.state.field(hs).query.spec;this.commit=this.commit.bind(this),this.searchField=ct("input",{value:i.search,placeholder:un(e,"Find"),"aria-label":un(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=ct("input",{value:i.replace,placeholder:un(e,"Replace"),"aria-label":un(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=ct("input",{type:"checkbox",name:"case",form:"",checked:i.caseSensitive,onchange:this.commit}),this.reField=ct("input",{type:"checkbox",name:"re",form:"",checked:i.regexp,onchange:this.commit}),this.wordField=ct("input",{type:"checkbox",name:"word",form:"",checked:i.wholeWord,onchange:this.commit});function n(r,o,s){return ct("button",{class:"cm-button",name:r,onclick:o,type:"button"},s)}this.dom=ct("div",{onkeydown:r=>this.keydown(r),class:"cm-search"},[this.searchField,n("next",()=>N6(e),[un(e,"next")]),n("prev",()=>q6(e),[un(e,"previous")]),n("select",()=>dk(e),[un(e,"all")]),ct("label",null,[this.caseField,un(e,"match case")]),ct("label",null,[this.reField,un(e,"regexp")]),ct("label",null,[this.wordField,un(e,"by word")]),...e.state.readOnly?[]:[ct("br"),this.replaceField,n("replace",()=>j6(e),[un(e,"replace")]),n("replaceAll",()=>Ok(e),[un(e,"replace all")])],ct("button",{name:"close",onclick:()=>mk(e),"aria-label":un(e,"close"),type:"button"},["\xD7"])])}commit(){let e=new Kl({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:uo.of(e)}))}keydown(e){ex(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?q6:N6)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),j6(this.view))}update(e){for(let i of e.transactions)for(let n of i.effects)n.is(uo)&&!n.value.eq(this.query)&&this.setQuery(n.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(Jl).top}};function un(t,e){return t.state.phrase(e)}var Am=30,$m=/[\s\.,:;?!]/;function gk(t,{from:e,to:i}){let n=t.state.doc.lineAt(e),r=t.state.doc.lineAt(i).to,o=Math.max(n.from,e-Am),s=Math.min(r,i+Am),a=t.state.sliceDoc(o,s);if(o!=n.from){for(let l=0;la.length-Am;l--)if(!$m.test(a[l-1])&&$m.test(a[l])){a=a.slice(0,l);break}}return fe.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${n.number}.`)}var Hie=fe.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"}}),Gie=[hs,Dt.low(Fie),Hie];var Mm=class{constructor(e,i,n){this.from=e,this.to=i,this.diagnostic=n}},Sa=class t{constructor(e,i,n){this.diagnostics=e,this.panel=i,this.selected=n}static init(e,i,n){let r=e,o=n.facet(eh).markerFilter;o&&(r=o(r,n));let s=e.slice().sort((f,d)=>f.from-d.from||f.to-d.to),a=new Ai,l=[],c=0;for(let f=0;;){let d=f==s.length?null:s[f];if(!d&&!l.length)break;let O,m;for(l.length?(O=c,m=l.reduce((v,w)=>Math.min(v,w.to),d&&d.from>O?d.from:1e8)):(O=d.from,m=d.to,l.push(d),f++);fv.from||v.to==O))l.push(v),f++,m=Math.min(v.to,m);else{m=Math.min(v.from,m);break}}let x=one(l);if(l.some(v=>v.from==v.to||v.from==v.to-1&&n.doc.lineAt(v.from).to==v.from))a.add(O,O,we.widget({widget:new bk(x),diagnostics:l.slice()}));else{let v=l.reduce((w,T)=>T.markClass?w+" "+T.markClass:w,"");a.add(O,m,we.mark({class:"cm-lintRange cm-lintRange-"+x+v,diagnostics:l.slice(),inclusiveEnd:l.some(w=>w.to>m)}))}c=m;for(let v=0;v{if(!(e&&s.diagnostics.indexOf(e)<0))if(!n)n=new Mm(r,o,e||s.diagnostics[0]);else{if(s.diagnostics.indexOf(n.diagnostic)<0)return!1;n=new Mm(n.from,o,n.diagnostic)}}),n}function Kie(t,e){let i=e.pos,n=e.end||i,r=t.state.facet(eh).hideOn(t,i,n);if(r!=null)return r;let o=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(s=>s.is(yk))||t.changes.touchesRange(o.from,Math.max(o.to,n)))}function J6(t,e){return t.field(fn,!1)?e:e.concat(Se.appendConfig.of(sne))}function eL(t,e){return{effects:J6(t,[yk.of(e)])}}var yk=Se.define(),xk=Se.define(),tL=Se.define(),fn=Ge.define({create(){return new Sa(we.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let i=t.diagnostics.map(e.changes),n=null,r=t.panel;if(t.selected){let o=e.changes.mapPos(t.selected.from,1);n=tc(i,t.selected.diagnostic,o)||tc(i,null,o)}!i.size&&r&&e.state.facet(eh).autoPanel&&(r=null),t=new Sa(i,r,n)}for(let i of e.effects)if(i.is(yk)){let n=e.state.facet(eh).autoPanel?i.value.length?th.open:null:t.panel;t=Sa.init(i.value,n,e.state)}else i.is(xk)?t=new Sa(t.diagnostics,i.value?th.open:null,t.selected):i.is(tL)&&(t=new Sa(t.diagnostics,t.panel,i.value));return t},provide:t=>[kn.from(t,e=>e.panel),fe.decorations.from(t,e=>e.diagnostics)]});var Jie=we.mark({class:"cm-lintRange cm-lintRange-active"});function ene(t,e,i){let{diagnostics:n}=t.state.field(fn),r,o=-1,s=-1;n.between(e-(i<0?1:0),e+(i>0?1:0),(l,c,{spec:u})=>{if(e>=l&&e<=c&&(l==c||(e>l||i>0)&&(eoL(t,i,!1)))}var iL=t=>{let e=t.state.field(fn,!1);(!e||!e.panel)&&t.dispatch({effects:J6(t.state,[xk.of(!0)])});let i=Fs(t,th.open);return i&&i.dom.querySelector(".cm-panel-lint ul").focus(),!0},K6=t=>{let e=t.state.field(fn,!1);return!e||!e.panel?!1:(t.dispatch({effects:xk.of(!1)}),!0)},nL=t=>{let e=t.state.field(fn,!1);if(!e)return!1;let i=t.state.selection.main,n=e.diagnostics.iter(i.to+1);return!n.value&&(n=e.diagnostics.iter(0),!n.value||n.from==i.from&&n.to==i.to)?!1:(t.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),!0)};var eh=be.define({combine(t){return Object.assign({sources:t.map(e=>e.source).filter(e=>e!=null)},Qt(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{needsRefresh:(e,i)=>e?i?n=>e(n)||i(n):e:i}))}});function rL(t){let e=[];if(t)e:for(let{name:i}of t){for(let n=0;no.toLowerCase()==r.toLowerCase())){e.push(r);continue e}}e.push("")}return e}function oL(t,e,i){var n;let r=i?rL(e.actions):[];return ct("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},ct("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(n=e.actions)===null||n===void 0?void 0:n.map((o,s)=>{let a=!1,l=d=>{if(d.preventDefault(),a)return;a=!0;let O=tc(t.state.field(fn).diagnostics,e);O&&o.apply(t,O.from,O.to)},{name:c}=o,u=r[s]?c.indexOf(r[s]):-1,f=u<0?c:[c.slice(0,u),ct("u",c.slice(u,u+1)),c.slice(u+1)];return ct("button",{type:"button",class:"cm-diagnosticAction",onclick:l,onmousedown:l,"aria-label":` Action: ${c}${u<0?"":` (access key "${r[s]})"`}.`},f)}),e.source&&ct("div",{class:"cm-diagnosticSource"},e.source))}var bk=class extends ni{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return ct("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}},Nm=class{constructor(e,i){this.diagnostic=i,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=oL(e,i,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}},th=class t{constructor(e){this.view=e,this.items=[];let i=r=>{if(r.keyCode==27)K6(this.view),this.view.focus();else if(r.keyCode==38||r.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(r.keyCode==40||r.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(r.keyCode==36)this.moveSelection(0);else if(r.keyCode==35)this.moveSelection(this.items.length-1);else if(r.keyCode==13)this.view.focus();else if(r.keyCode>=65&&r.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:o}=this.items[this.selectedIndex],s=rL(o.actions);for(let a=0;a{for(let o=0;oK6(this.view)},"\xD7")),this.update()}get selectedIndex(){let e=this.view.state.field(fn).selected;if(!e)return-1;for(let i=0;i{for(let u of c.diagnostics){if(s.has(u))continue;s.add(u);let f=-1,d;for(let O=n;On&&(this.items.splice(n,f-n),r=!0)),i&&d.diagnostic==i.diagnostic?d.dom.hasAttribute("aria-selected")||(d.dom.setAttribute("aria-selected","true"),o=d):d.dom.hasAttribute("aria-selected")&&d.dom.removeAttribute("aria-selected"),n++}});n({sel:o.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:a,panel:l})=>{let c=l.height/this.list.offsetHeight;a.topl.bottom&&(this.list.scrollTop+=(a.bottom-l.bottom)/c)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let e=this.list.firstChild;function i(){let n=e;e=n.nextSibling,n.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)i();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)i()}moveSelection(e){if(this.selectedIndex<0)return;let i=this.view.state.field(fn),n=tc(i.diagnostics,this.items[e].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:tL.of(n)})}static open(e){return new t(e)}};function ine(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(t)}')`}function Um(t){return ine(``,'width="6" height="3"')}var nne=fe.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Um("#d11")},".cm-lintRange-warning":{backgroundImage:Um("orange")},".cm-lintRange-info":{backgroundImage:Um("#999")},".cm-lintRange-hint":{backgroundImage:Um("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function rne(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function one(t){let e="hint",i=1;for(let n of t){let r=rne(n.severity);r>i&&(i=r,e=n.severity)}return e}var sne=[fn,fe.decorations.compute([fn],t=>{let{selected:e,panel:i}=t.field(fn);return!e||!i||e.from==e.to?we.none:we.set([Jie.range(e.from,e.to)])}),rp(ene,{hideOn:Kie}),nne];var sL=t=>e=>{let i=t==="down",n=e.state.selection;for(let r of n.ranges)n=n.addRange(e.moveVertically(r,i));return e.dispatch({selection:n}),!0},ane=sL("up"),lne=sL("down"),cne=t=>{let e=null;for(let i of t.state.selection.ranges)if(!i.empty)for(let n=i.from;n<=i.to;){let r=t.state.doc.lineAt(n),o=Math.min(r.to,i.to);e?e=e.addRange(K.range(o,o)):e=K.single(o),n=r.to+1}return e?(t.dispatch({selection:e}),!0):!1},aL=[{key:"Ctrl-Space",run:Tl},{key:"Escape",run:of},{key:"ArrowDown",run:Jr(!0)},{key:"ArrowUp",run:Jr(!1)},{key:"PageDown",run:Jr(!0,"page")},{key:"PageUp",run:Jr(!1,"page")},{key:"Enter",run:xp},{key:"Tab",run:xp},{key:"Mod-f",run:ec,scope:"editor search-panel"},{key:"Escape",run:mk,scope:"editor search-panel"},{key:"Alt-Enter",run:dk,scope:"editor search-panel"},{key:"Mod-Alt-Enter",run:Ok,scope:"editor search-panel"},{key:"Ctrl-g",run:V6},{key:"Mod-d",run:Y6,preventDefault:!0},{key:"Shift-Mod-l",run:F6},{key:"Enter",run:Yf,shift:Yf},{key:"ArrowLeft",run:If,shift:Hw,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:bm,shift:Tm},{key:"ArrowRight",run:Fw,shift:Gw,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:ym,shift:Em},{key:"ArrowUp",run:Df,shift:Wl,preventDefault:!0},{key:"ArrowDown",run:zf,shift:Vl,preventDefault:!0},{key:"Home",run:Mf,shift:tk},{mac:"Cmd-ArrowLeft",run:Mf,shift:tk},{key:"Mod-Home",run:Wf,shift:Zl},{mac:"Cmd-ArrowUp",run:Wf,shift:Zl},{key:"PageUp",run:ql,shift:Nf},{mac:"Ctrl-ArrowUp",run:ql,shift:Nf},{key:"PageDown",run:jl,shift:ka},{mac:"Ctrl-ArrowDown",run:jl,shift:ka},{key:"End",run:Uf,shift:ek},{mac:"Cmd-ArrowRight",run:Uf,shift:ek},{key:"Mod-Alt-ArrowUp",linux:"Shift-Alt-ArrowUp",run:ane,preventDefault:!0},{key:"Mod-Alt-ArrowDown",linux:"Shift-Alt-ArrowDown",run:lne,preventDefault:!0},{key:"Shift-Alt-i",run:cne},{key:"Mod-End",run:Vf,shift:Bl},{mac:"Cmd-ArrowDown",run:Vf,shift:Bl},{key:"Mod-a",run:Pm},{key:"Backspace",run:u_},{key:"Backspace",run:Yl,shift:Yl},{key:"Delete",run:Zf},{key:"Mod-Backspace",mac:"Alt-Backspace",run:ik},{key:"Mod-Delete",mac:"Alt-Delete",run:T6},{mac:"Mod-Backspace",run:E6},{mac:"Mod-Delete",run:nk},{mac:"Ctrl-b",run:If,shift:Hw,preventDefault:!0},{mac:"Ctrl-f",run:Fw,shift:Gw},{mac:"Ctrl-p",run:Df,shift:Wl},{mac:"Ctrl-n",run:zf,shift:Vl},{mac:"Ctrl-a",run:vm,shift:qf},{mac:"Ctrl-e",run:wm,shift:jf},{mac:"Ctrl-d",run:Zf},{mac:"Ctrl-h",run:Yl},{mac:"Ctrl-k",run:nk},{mac:"Ctrl-Alt-h",run:ik},{mac:"Ctrl-o",run:Bf},{mac:"Ctrl-t",run:Qm},{mac:"Ctrl-v",run:jl},{mac:"Alt-v",run:ql},{key:"Shift-Mod-k",run:X6},{key:"Alt-ArrowDown",run:Q6},{key:"Alt-ArrowUp",run:C6},{win:"Shift-Alt-ArrowDown",mac:"Shift-Alt-ArrowDown",run:$6},{win:"Shift-Alt-ArrowUp",mac:"Shift-Alt-ArrowUp",run:A6},{key:"Mod-l",run:w6,preventDefault:!0},{key:"Shift-Mod-\\",run:g6},{key:"Tab",run:Ff,shift:Hf,preventDefault:!0},{key:"Mod-[",run:Hf},{key:"Mod-]",run:Ff},{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:pp},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:$Q},{key:"Mod-k Mod-0",run:RQ},{key:"Mod-k Mod-j",run:LQ},{key:"Mod-k Mod-c",run:i6},{key:"Mod-k Mod-u",run:n6},{key:"Mod-/",run:Xf},{key:"Shift-Alt-a",run:r6},{key:"Mod-z",run:va,preventDefault:!0},{key:"Mod-y",run:ls,preventDefault:!0},{key:"Mod-Shift-z",run:ls,preventDefault:!0},{key:"Mod-u",run:c6,preventDefault:!0},{key:"Mod-Shift-m",run:iL},{key:"F8",run:nL}];function une(t){var e=t.Pos;function i(h,p,b){if(p.line===b.line&&p.ch>=b.ch-1){var y=h.getLine(p.line),k=y.charCodeAt(p.ch);55296<=k&&k<=55551&&(b.ch+=1)}return{start:p,end:b}}var n=[{keys:"",type:"keyToKey",toKeys:"h"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"g",type:"keyToKey",toKeys:"gk"},{keys:"g",type:"keyToKey",toKeys:"gj"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"h"},{keys:"",type:"keyToKey",toKeys:"x"},{keys:"",type:"keyToKey",toKeys:"W"},{keys:"",type:"keyToKey",toKeys:"B"},{keys:"",type:"keyToKey",toKeys:"w"},{keys:"",type:"keyToKey",toKeys:"b"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"s",type:"keyToKey",toKeys:"cl",context:"normal"},{keys:"s",type:"keyToKey",toKeys:"c",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"VdO",context:"visual"},{keys:"",type:"keyToKey",toKeys:"0"},{keys:"",type:"keyToKey",toKeys:"$"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"",type:"keyToKey",toKeys:"i",context:"normal"},{keys:"",type:"action",action:"toggleOverwrite",context:"insert"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"(",type:"motion",motion:"moveBySentence",motionArgs:{forward:!1}},{keys:")",type:"motion",motion:"moveBySentence",motionArgs:{forward:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"g$",type:"motion",motion:"moveToEndOfDisplayLine"},{keys:"g^",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"g0",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:"=",type:"operator",operator:"indentAuto"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"gn",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!0}},{keys:"gN",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!1}},{keys:"gq",type:"operator",operator:"hardWrap"},{keys:"gw",type:"operator",operator:"hardWrap",operatorArgs:{keepCursor:!0}},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"expandToLine",motionArgs:{linewise:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"",type:"operatorMotion",operator:"delete",motion:"moveToStartOfLine",context:"insert"},{keys:"",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"",type:"idle",context:"normal"},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"gi",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"lastEdit"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"gI",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"bol"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"gJ",type:"action",action:"joinLines",actionArgs:{keepSpaces:!0},isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r",type:"action",action:"replace",isEdit:!0},{keys:"@",type:"action",action:"replayMacro"},{keys:"q",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0},context:"normal"},{keys:"R",type:"operator",operator:"change",operatorArgs:{linewise:!0,fullLine:!0},context:"visual",exitVisualBlock:!0},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"",type:"action",action:"redo"},{keys:"m",type:"action",action:"setMark"},{keys:'"',type:"action",action:"setRegister"},{keys:"",type:"action",action:"insertRegister",context:"insert",isEdit:!0},{keys:"",type:"action",action:"oneNormalCommand",context:"insert"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a",type:"motion",motion:"textObjectManipulation"},{keys:"i",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],r=n.length,o=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"omap",shortName:"om"},{name:"noremap",shortName:"no"},{name:"nnoremap",shortName:"nn"},{name:"vnoremap",shortName:"vn"},{name:"inoremap",shortName:"ino"},{name:"onoremap",shortName:"ono"},{name:"unmap"},{name:"mapclear",shortName:"mapc"},{name:"nmapclear",shortName:"nmapc"},{name:"vmapclear",shortName:"vmapc"},{name:"imapclear",shortName:"imapc"},{name:"omapclear",shortName:"omapc"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"startinsert",shortName:"start"},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"vglobal",shortName:"v"},{name:"delete",shortName:"d"},{name:"join",shortName:"j"},{name:"normal",shortName:"norm"},{name:"global",shortName:"g"}],s=dn("");function a(h){h.setOption("disableInput",!0),h.setOption("showCursorWhenSelecting",!1),t.signal(h,"vim-mode-change",{mode:"normal"}),h.on("cursorActivity",lS),ve(h),t.on(h.getInputField(),"paste",c(h))}function l(h){h.setOption("disableInput",!1),h.off("cursorActivity",lS),t.off(h.getInputField(),"paste",c(h)),h.state.vim=null,fc&&clearTimeout(fc)}function c(h){var p=h.state.vim;return p.onPasteFn||(p.onPasteFn=function(){p.insertMode||(h.setCursor($e(h.getCursor(),0,1)),ce.enterInsertMode(h,{},p))}),p.onPasteFn}var u=/[\d]/,f=[t.isWordChar,function(h){return h&&!t.isWordChar(h)&&!/\s/.test(h)}],d=[function(h){return/\S/.test(h)}],O=["<",">"],m=["-",'"',".",":","_","/","+"],x=/^\w$/,v;try{v=new RegExp("^[\\p{Lu}]$","u")}catch(h){v=/^[A-Z]$/}function w(h,p){return p>=h.firstLine()&&p<=h.lastLine()}function T(h){return/^[a-z]$/.test(h)}function A(h){return"()[]{}".indexOf(h)!=-1}function L(h){return u.test(h)}function D(h){return v.test(h)}function P(h){return/^\s*$/.test(h)}function N(h){return".?!".indexOf(h)!=-1}function le(h,p){for(var b=0;b1&&p.setOption("textwidth",y)}});var re=function(){var h=100,p=-1,b=0,y=0,k=new Array(h);function S(X,U,q){var J=p%h,te=k[J];function Y(se){var he=++p%h,Ae=k[he];Ae&&Ae.clear(),k[he]=X.setBookmark(se)}if(te){var V=te.find();V&&!vt(V,U)&&Y(U)}else Y(U);Y(q),b=p,y=p-h+1,y<0&&(y=0)}function Q(X,U){p+=U,p>b?p=b:p0?1:-1,te,Y=X.getCursor();do if(p+=J,q=k[(h+p)%h],q&&(te=q.find())&&!vt(Y,te))break;while(py)}return q}function $(X,U){var q=p,J=Q(X,U);return p=q,J&&J.find()}return{cachedCursor:void 0,add:S,find:$,move:Q}},de=function(h){return h?{changes:h.changes,expectCursorActivityForChange:h.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};class pe{constructor(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=de()}exitMacroRecordMode(){var p=j.macroModeState;p.onRecordingDone&&p.onRecordingDone(),p.onRecordingDone=void 0,p.isRecording=!1}enterMacroRecordMode(p,b){var y=j.registerController.getRegister(b);if(y){if(y.clear(),this.latestRegister=b,p.openDialog){var k=xo("span",{class:"cm-vim-message"},"recording @"+b);this.onRecordingDone=p.openDialog(k,null,{bottom:!0})}this.isRecording=!0}}}function ve(h){return h.state.vim||(h.state.vim={inputState:new On,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},insertMode:!1,insertModeReturn:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:null,sel:{},options:{},expectLiteralNext:!1}),h.state.vim}var j;function ue(){j={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:re(),macroModeState:new pe,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new xg({}),searchHistoryController:new ac,exCommandHistoryController:new ac};for(var h in H){var p=H[h];p.value=p.defaultValue}}var Z,C={enterVimMode:a,leaveVimMode:l,buildKeyMap:function(){},getRegisterController:function(){return j.registerController},resetVimGlobalState_:ue,getVimGlobalState_:function(){return j},maybeInitVimState_:ve,suppressErrorLogging:!1,InsertModeKey:Qg,map:function(h,p,b){In.map(h,p,b)},unmap:function(h,p){return In.unmap(h,p)},noremap:function(h,p,b){In.map(h,p,b,!0)},mapclear:function(h){var p=n.length,b=r,y=n.slice(0,p-b);if(n=n.slice(p-b),h)for(var k=y.length-1;k>=0;k--){var S=y[k];if(h!==S.context)if(S.context)this._mapCommand(S);else{var Q=["normal","insert","visual"];for(var $ in Q)if(Q[$]!==h){var X=Object.assign({},S);X.context=Q[$],this._mapCommand(X)}}}},langmap:Lt,vimKeyFromEvent:Rt,setOption:ie,getOption:ne,defineOption:M,defineEx:function(h,p,b){if(!p)p=h;else if(h.indexOf(p)!==0)throw new Error('(Vim.defineEx) "'+p+'" is not a prefix of "'+h+'", command not registered');oS[h]=b,In.commandMap_[p]={name:h,shortName:p,type:"api"}},handleKey:function(h,p,b){var y=this.findKey(h,p,b);if(typeof y=="function")return y()},multiSelectHandleKey:fD,findKey:function(h,p,b){var y=ve(h),k=h;function S(){var q=j.macroModeState;if(q.isRecording){if(p=="q")return q.exitMacroRecordMode(),Nt(k),!0;b!="mapping"&&lD(q,p)}}function Q(){if(p==""){if(y.visualMode)Jn(k);else if(y.insertMode)vo(k);else return;return Nt(k),!0}}function $(){if(Q())return!0;y.inputState.keyBuffer.push(p);var q=y.inputState.keyBuffer.join(""),J=p.length==1,te=Kn.matchCommand(q,n,y.inputState,"insert"),Y=y.inputState.changeQueue;if(te.type=="none")return Nt(k),!1;if(te.type=="partial"){if(te.expectLiteralNext&&(y.expectLiteralNext=!0),Z&&window.clearTimeout(Z),Z=J&&window.setTimeout(function(){y.insertMode&&y.inputState.keyBuffer.length&&Nt(k)},ne("insertModeEscKeysTimeout")),J){var V=k.listSelections();(!Y||Y.removed.length!=V.length)&&(Y=y.inputState.changeQueue=new vh),Y.inserted+=p;for(var se=0;se|./gi,Q;Q=S.exec(p);){var $=Q[0],X=k.insertMode;if(I){Ne($);continue}var U=C.handleKey(h,$,"mapping");if(!U&&X&&k.insertMode){if($[0]=="<"){var q=$.toLowerCase().slice(1,-1),J=q.split("-");if(q=J.pop()||"",q=="lt")$="<";else if(q=="space")$=" ";else if(q=="cr")$=`