@pi-outpost/embed 0.62.3 → 0.63.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{CodeEditor-C2mtBAxz.js → CodeEditor-BW8cShfE.js} +870 -869
- package/dist/CodeEditor-BZfOQyjO.cjs +9 -0
- package/dist/{conversationExport-jRLUX0kH.js → conversationExport-BHXWfKKh.js} +37 -37
- package/dist/{conversationExport-DXxmgLoF.cjs → conversationExport-CWUOyeJO.cjs} +2 -2
- package/dist/{conversationHistory-C6PqGsO9.cjs → conversationHistory-0ds9dEO5.cjs} +26 -4
- package/dist/{conversationHistory-3pDBlkZZ.js → conversationHistory-xEFHYA2a.js} +94 -61
- package/dist/{dist-B9wvGgxB.js → dist-B-n0qSdY.js} +134 -133
- package/dist/{dist-LBUs7dVk.js → dist-B53CIh_q.js} +62 -61
- package/dist/{dist-DeLxY4Ia.js → dist-BBPYf4ef.js} +30 -29
- package/dist/dist-BFbWWJdM.cjs +23 -0
- package/dist/dist-BLE5-Y8p.cjs +9 -0
- package/dist/dist-BQCPWecG.cjs +1 -0
- package/dist/dist-BmjjdWVL.cjs +1 -0
- package/dist/{dist-kpPXlS4A.cjs → dist-Bo7aGd2O.cjs} +2 -2
- package/dist/{dist-Bk3hLKgL.js → dist-BoHwBqKn.js} +49 -49
- package/dist/{dist-VWDOErn8.js → dist-BpRy8-Lq.js} +47 -47
- package/dist/dist-BzV3uXd3.js +2842 -0
- package/dist/dist-C3wOZTh_.cjs +1 -0
- package/dist/dist-C6485_TJ.cjs +1 -0
- package/dist/{dist-BIMxMB--.js → dist-CEPaeNz_.js} +57 -57
- package/dist/dist-CbNZ-oK_.cjs +11 -0
- package/dist/dist-CewGgiCl.cjs +1 -0
- package/dist/dist-Cgkuh5Wk.cjs +11 -0
- package/dist/dist-ChIJFFop.cjs +3 -0
- package/dist/dist-Cqy-WSUm.cjs +6 -0
- package/dist/{dist-Bg1-NGne.js → dist-D1XDfvdG.js} +17 -17
- package/dist/{dist-qeX2QqDc.js → dist-DAh__jUg.js} +6724 -9561
- package/dist/dist-DV7vb3Vn.cjs +1 -0
- package/dist/dist-DWOMmaS_.cjs +1 -0
- package/dist/{dist-BWAsFrsx.js → dist-DcevhA0K.js} +73 -73
- package/dist/dist-DdI6ugoG.cjs +1 -0
- package/dist/{dist-CpOA8cNn.js → dist-DhtR0qbm.js} +49 -49
- package/dist/{dist-CwPu13CG.js → dist-DlwWvZ4d.js} +46 -46
- package/dist/{dist-nQ2aeIgK.js → dist-DnmbmV7C.js} +495 -494
- package/dist/dist-DsOiUWHL.cjs +1 -0
- package/dist/dist-DuyBYmw-.cjs +1 -0
- package/dist/{dist-DUziszL2.js → dist-T7rNKseu.js} +32 -32
- package/dist/{dist-CcTOENSK.js → dist-XKeyr4Om.js} +26 -26
- package/dist/{dist-CvxwObne.js → dist-n29rG6c2.js} +117 -117
- package/dist/{dist-DCT8mdeU.js → dist-s8hmOD0A.js} +52 -52
- package/dist/pi-outpost-embed.cjs +46 -44
- package/dist/pi-outpost-embed.js +5022 -4147
- package/package.json +1 -1
- package/dist/CodeEditor-CHKp59kP.cjs +0 -9
- package/dist/dist-B9TXDASo.cjs +0 -1
- package/dist/dist-BMzIUMhf.cjs +0 -1
- package/dist/dist-BawiB8yE.cjs +0 -23
- package/dist/dist-BjxwUutQ.cjs +0 -6
- package/dist/dist-BlUoR-U1.cjs +0 -13
- package/dist/dist-Bnsp4Y3i.cjs +0 -9
- package/dist/dist-CM2l_BHt.cjs +0 -1
- package/dist/dist-CkDnvyBs.cjs +0 -1
- package/dist/dist-CpsCEkIr.cjs +0 -1
- package/dist/dist-DJYmQsI-.cjs +0 -1
- package/dist/dist-F6qtkv2Q.cjs +0 -11
- package/dist/dist-Lxxq5IH0.cjs +0 -1
- package/dist/dist-c-DRw6Dh.cjs +0 -1
- package/dist/dist-sM-IE5EO.cjs +0 -1
- package/dist/dist-vBlUeRrZ.cjs +0 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const e=require("./rolldown-runtime-DbbDpzbe.cjs"),t=require("./dist-CbNZ-oK_.cjs"),n=require("./dist-ChIJFFop.cjs");let r=require("react"),i=require("react/jsx-runtime");var a=class{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=n.k(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),i=r.search(f(e,!1));return i<0?null:{from:n+i,to:this.pos,text:r.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e==`abort`&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function o(e){let t=Object.keys(e).join(``),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,``)),`[${n?`\\w`:``}${t.replace(/[^\w\s]/g,`\\$&`)}]`}function s(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e<r.length;e++)n[r[e]]=!0}let r=o(t)+o(n)+`*$`;return[RegExp(`^`+r),new RegExp(r)]}function c(e){let t=e.map(e=>typeof e==`string`?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:s(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}function l(e,t){return r=>{for(let t=n.k(r.state).resolveInner(r.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(r)}}var u=class{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}};function d(e){return e.selection.main.from}function f(e,t){let{source:n}=e,r=t&&n[0]!=`^`,i=n[n.length-1]!=`$`;return!r&&!i?e:RegExp(`${r?`^`:``}(?:${n})${i?`$`:``}`,e.flags??(e.ignoreCase?`i`:``))}var p=t.x.define();function m(e,n,r,i){let{main:a}=e.selection,o=r-a.from,s=i-a.from;return{...e.changeByRange(c=>{if(c!=a&&r!=i&&e.sliceDoc(c.from+o,c.from+s)!=e.sliceDoc(r,i))return{range:c};let l=e.toText(n);return{changes:{from:c.from+o,to:i==a.from?c.to:c.from+s,insert:l},range:t.E.cursor(c.from+o+l.length)}}),scrollIntoView:!0,userEvent:`input.complete`}}var h=new WeakMap;function g(e){if(!Array.isArray(e))return e;let t=h.get(e);return t||h.set(e,t=c(e)),t}var _=t.P.define(),v=t.P.define(),y=class{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<e.length;){let r=t.R(e,n),i=t.z(r);this.chars.push(r);let a=e.slice(n,n+i),o=a.toUpperCase();this.folded.push(t.R(o==a?a.toLowerCase():o,0)),n+=i}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:n,folded:r,any:i,precise:a,byWord:o}=this;if(n.length==1){let i=t.R(e,0),a=t.z(i),o=a==e.length?0:-100;if(i!=n[0]){if(i==r[0])o+=-200;else return null}return this.ret(o,[0,a])}let s=e.indexOf(this.pattern);if(s==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let c=n.length,l=0;if(s<0){for(let a=0,o=Math.min(e.length,200);a<o&&l<c;){let o=t.R(e,a);(o==n[l]||o==r[l])&&(i[l++]=a),a+=t.z(o)}if(l<c)return null}let u=0,d=0,f=!1,p=0,m=-1,h=-1,g=/[a-z]/.test(e),_=!0;for(let i=0,l=Math.min(e.length,200),v=0;i<l&&d<c;){let l=t.R(e,i);s<0&&(u<c&&l==n[u]&&(a[u++]=i),p<c&&(l==n[p]||l==r[p]?(p==0&&(m=i),h=i+1,p++):p=0));let y,b=l<255?l>=48&&l<=57||l>=97&&l<=122?2:+(l>=65&&l<=90):(y=t.U(l))==y.toLowerCase()?y==y.toUpperCase()?0:2:1;(!i||b==1&&g||v==0&&b!=0)&&(n[d]==l||r[d]==l&&(f=!0)?o[d++]=i:o.length&&(_=!1)),v=b,i+=t.z(l)}return d==c&&o[0]==0&&_?this.result(-100+(f?-200:0),o,e):p==c&&m==0?this.ret(-200-e.length+(h==e.length?0:-100),[0,h]):s>-1?this.ret(-700-e.length,[s,s+this.pattern.length]):p==c?this.ret(-900-e.length,[m,h]):d==c?this.result(-100+(f?-200:0)+-700+(_?0:-1100),o,e):n.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,n,r){let i=[],a=0;for(let e of n){let n=e+(this.astral?t.z(t.R(r,e)):1);a&&i[a-1]==e?i[a-1]=n:(i[a++]=e,i[a++]=n)}return this.ret(e-r.length,i)}},b=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}},x=t.O.define({combine(e){return t.B(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>``,optionClass:()=>``,aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:te,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>ee(e(n),t(n)),optionClass:(e,t)=>n=>ee(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function ee(e,t){return e?t?e+` `+t:e:t}function te(e,n,r,i,a,o){let s=e.textDirection==t.n.RTL,c=s,l=!1,u=`top`,d,f,p=n.left-a.left,m=a.right-n.right,h=i.right-i.left,g=i.bottom-i.top;if(c&&p<Math.min(h,m)?c=!1:!c&&m<Math.min(h,p)&&(c=!0),h<=(c?p:m))d=Math.max(a.top,Math.min(r.top,a.bottom-g))-n.top,f=Math.min(400,c?p:m);else{l=!0,f=Math.min(400,(s?n.right:a.right-n.left)-30);let e=a.bottom-n.bottom;e>=g||e>n.top?d=r.bottom-n.top:(u=`bottom`,d=n.bottom-r.top)}let _=(n.bottom-n.top)/o.offsetHeight,v=(n.right-n.left)/o.offsetWidth;return{style:`${u}: ${d/_}px; max-width: ${f/v}px`,class:`cm-completionInfo-`+(l?s?`left-narrow`:`right-narrow`:c?`left`:`right`)}}var ne=t.P.define();function re(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement(`div`);return t.classList.add(`cm-completionIcon`),e.type&&t.classList.add(...e.type.split(/\s+/g).map(e=>`cm-completionIcon-`+e)),t.setAttribute(`aria-hidden`,`true`),t},position:20}),t.push({render(e,t,n,r){let i=document.createElement(`span`);i.className=`cm-completionLabel`;let a=e.displayLabel||e.label,o=0;for(let e=0;e<r.length;){let t=r[e++],n=r[e++];t>o&&i.appendChild(document.createTextNode(a.slice(o,t)));let s=i.appendChild(document.createElement(`span`));s.appendChild(document.createTextNode(a.slice(t,n))),s.className=`cm-completionMatchedText`,o=n}return o<a.length&&i.appendChild(document.createTextNode(a.slice(o))),i},position:50},{render(e){if(!e.detail)return null;let t=document.createElement(`span`);return t.className=`cm-completionDetail`,t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}function ie(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let r=Math.ceil((e-t)/n);return{from:e-r*n,to:e-(r-1)*n}}var ae=class{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass=``;let r=e.state.field(t),{options:i,selected:a}=r.open,o=e.state.facet(x);this.optionContent=re(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=ie(i.length,a,o.maxRenderedOptions),this.dom=document.createElement(`div`),this.dom.className=`cm-tooltip-autocomplete`,this.updateTooltipClass(e.state),this.dom.addEventListener(`mousedown`,n=>{let{options:r}=e.state.field(t).open;for(let t=n.target,i;t&&t!=this.dom;t=t.parentNode)if(t.nodeName==`LI`&&(i=/-(\d+)$/.exec(t.id))&&+i[1]<r.length){this.applyCompletion(e,r[+i[1]]),n.preventDefault();return}if(n.target==this.list){let t=this.list.classList.contains(`cm-completionListIncompleteTop`)&&n.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains(`cm-completionListIncompleteBottom`)&&n.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;t!=null&&(e.dispatch({effects:ne.of(t)}),n.preventDefault())}}),this.dom.addEventListener(`focusout`,t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(x).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:v.of(null)})}),this.showOptions(i,r.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener(`scroll`,()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){let t=e.state.field(this.stateField),n=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),t!=n){let{options:r,selected:i,disabled:a}=t.open;(!n.open||n.open.options!=r)&&(this.range=ie(r.length,i,e.state.facet(x).maxRenderedOptions),this.showOptions(r,t.id)),this.updateSel(),a!=n.open?.disabled&&this.dom.classList.toggle(`cm-tooltip-autocomplete-disabled`,!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(` `))e&&this.dom.classList.remove(e);for(let e of t.split(` `))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=ie(n.options.length,n.selected,this.view.state.facet(x).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:i}=n.options[n.selected],{info:a}=i;if(!a)return;let o=typeof a==`string`?document.createTextNode(a):a(i);if(!o)return;`then`in o?o.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,i)}).catch(e=>t._(this.view.state,e,`completion info`)):(this.addInfoPane(o,i),r.setAttribute(`aria-describedby`,this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement(`div`);if(n.className=`cm-tooltip cm-completionInfo`,n.id=`cm-completionInfo-`+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:r}=e;n.appendChild(t),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)n.nodeName!=`LI`||!n.id?r--:r==e?n.hasAttribute(`aria-selected`)||(n.setAttribute(`aria-selected`,`true`),t=n):n.hasAttribute(`aria-selected`)&&(n.removeAttribute(`aria-selected`),n.removeAttribute(`aria-describedby`));return t&&se(this.list,t),t}measureInfo(){let e=this.dom.querySelector(`[aria-selected]`);if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),i=this.space;if(!i){let e=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return r.top>Math.min(i.bottom,t.bottom)-10||r.bottom<Math.max(i.top,t.top)+10?null:this.view.state.facet(x).positionInfo(this.view,t,r,n,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className=`cm-tooltip cm-completionInfo `+(e.class||``)):this.info.style.cssText=`top: -1e6px`)}createListBox(e,t,n){let r=document.createElement(`ul`);r.id=t,r.setAttribute(`role`,`listbox`),r.setAttribute(`aria-expanded`,`true`),r.setAttribute(`aria-label`,this.view.state.phrase(`Completions`)),r.addEventListener(`mousedown`,e=>{e.target==r&&e.preventDefault()});let i=null;for(let a=n.from;a<n.to;a++){let{completion:o,match:s}=e[a],{section:c}=o;if(c){let e=typeof c==`string`?c:c.name;if(e!=i&&(a>n.from||n.from==0)){if(i=e,typeof c!=`string`&&c.header)r.appendChild(c.header(c));else{let t=r.appendChild(document.createElement(`completion-section`));t.textContent=e}}}let l=r.appendChild(document.createElement(`li`));l.id=t+`-`+a,l.setAttribute(`role`,`option`);let u=this.optionClass(o);u&&(l.className=u);for(let e of this.optionContent){let t=e(o,this.view.state,this.view,s);t&&l.appendChild(t)}}return n.from&&r.classList.add(`cm-completionListIncompleteTop`),n.to<e.length&&r.classList.add(`cm-completionListIncompleteBottom`),r}destroyInfo(){this.info&&=(this.infoDestroy&&this.infoDestroy(),this.info.remove(),null)}destroy(){this.destroyInfo()}};function oe(e,t){return n=>new ae(n,e,t)}function se(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.height/e.offsetHeight;r.top<n.top?e.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/i)}function ce(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+ +!!e.type}function le(e,t){let n=[],r=null,i=null,a=e=>{n.push(e);let{section:t}=e.completion;if(t){r||=[];let e=typeof t==`string`?t:t.name;r.some(t=>t.name==e)||r.push(typeof t==`string`?{name:e}:t)}},o=t.facet(x);for(let r of e)if(r.hasResult()){let e=r.result.getMatch;if(r.result.filter===!1)for(let t of r.result.options)a(new u(t,r.source,e?e(t):[],1e9-n.length));else{let n=t.sliceDoc(r.from,r.to),s,c=o.filterStrict?new b(n):new y(n);for(let t of r.result.options)if(s=c.match(t.label)){let n=t.displayLabel?e?e(t,s.matched):[]:s.matched,o=s.score+(t.boost||0);if(a(new u(t,r.source,n,o)),typeof t.section==`object`&&t.section.rank===`dynamic`){let{name:e}=t.section;i||=Object.create(null),i[e]=Math.max(o,i[e]||-1e9)}}}}if(r){let e=Object.create(null),t=0,a=(e,t)=>(e.rank===`dynamic`&&t.rank===`dynamic`?i[t.name]-i[e.name]:0)||(typeof e.rank==`number`?e.rank:1e9)-(typeof t.rank==`number`?t.rank:1e9)||(e.name<t.name?-1:1);for(let n of r.sort(a))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e[typeof n==`string`?n:n.name])}}let s=[],c=null,l=o.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||l(e.completion,t.completion))){let t=e.completion;!c||c.label!=t.label||c.detail!=t.detail||c.type!=null&&t.type!=null&&c.type!=t.type||c.apply!=t.apply||c.boost!=t.boost?s.push(e):ce(e.completion)>ce(c)&&(s[s.length-1]=e),c=e.completion}return s}var ue=class e{constructor(e,t,n,r,i,a){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=r,this.selected=i,this.disabled=a}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new e(this.options,he(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,r,i,a,o){if(i&&!o&&t.some(e=>e.isPending))return i.setDisabled();let s=le(t,n);if(!s.length)return i&&t.some(e=>e.isPending)?i.setDisabled():null;let c=n.facet(x).selectOnOpen?0:-1;if(i&&i.selected!=c&&i.selected!=-1){let e=i.options[i.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){c=t;break}}return new e(s,he(r,c),{pos:t.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:Se,above:a.aboveCursor},i?i.timestamp:Date.now(),c,!1)}map(t){return new e(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new e(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}},de=class e{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new e(ge,`cm-ac-`+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(x),i=(r.override||n.languageDataAt(`autocomplete`,d(n)).map(g)).map(e=>(this.active.find(t=>t.source==e)||new S(e,+!!this.active.some(e=>e.state!=0))).update(t,r));i.length==this.active.length&&i.every((e,t)=>e==this.active[t])&&(i=this.active);let a=this.open,o=t.effects.some(e=>e.is(be));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||i.some(e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to))||!fe(i,this.active)||o?a=ue.build(i,n,this.id,a,r,o):a&&a.disabled&&!i.some(e=>e.isPending)&&(a=null),!a&&i.every(e=>!e.isPending)&&i.some(e=>e.hasResult())&&(i=i.map(e=>e.hasResult()?new S(e.source,0):e));for(let e of t.effects)e.is(ne)&&(a&&=a.setSelected(e.value,this.id));return i==this.active&&a==this.open?this:new e(i,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?pe:me}};function fe(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let i=n==e.length,a=r==t.length;if(i||a)return i==a;if(e[n++].result!=t[r++].result)return!1}}var pe={"aria-autocomplete":`list`},me={};function he(e,t){let n={"aria-autocomplete":`list`,"aria-haspopup":`listbox`,"aria-controls":e};return t>-1&&(n[`aria-activedescendant`]=e+`-`+t),n}var ge=[];function _e(e,t){if(e.isUserEvent(`input.complete`)){let n=e.annotation(p);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent(`input.type`);return n&&t.activateOnTyping?5:n?1:e.isUserEvent(`delete.backward`)?2:e.selection?8:e.docChanged?16:0}var S=class e{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let r=_e(t,n),i=this;(r&8||r&16&&this.touches(t))&&(i=new e(i.source,0)),r&4&&i.state==0&&(i=new e(this.source,1)),i=i.updateFor(t,r);for(let n of t.effects)if(n.is(_))i=new e(i.source,1,n.value);else if(n.is(v))i=new e(i.source,0);else if(n.is(be))for(let e of n.value)e.source==i.source&&(i=e);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(d(e.state))}},ve=class e extends S{constructor(e,t,n,r,i,a){super(e,3,t),this.limit=n,this.result=r,this.from=i,this.to=a}hasResult(){return!0}updateFor(t,n){if(!(n&3))return this.map(t.changes);let r=this.result;r.map&&!t.changes.empty&&(r=r.map(r,t.changes));let i=t.changes.mapPos(this.from),o=t.changes.mapPos(this.to,1),s=d(t.state);if(s>o||!r||n&2&&(d(t.startState)==this.from||s<this.limit))return new S(this.source,n&4?1:0);let c=t.changes.mapPos(this.limit);return ye(r.validFor,t.state,i,o)?new e(this.source,this.explicit,c,r,i,o):r.update&&(r=r.update(r,i,o,new a(t.state,s,!1)))?new e(this.source,this.explicit,c,r,r.from,r.to??d(t.state)):new S(this.source,1,this.explicit)}map(t){if(t.empty)return this;let n=this.result.map?this.result.map(this.result,t):this.result;return n?new e(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new S(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}};function ye(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return typeof e==`function`?e(i,n,r,t):f(e,!0).test(i)}var be=t.P.define({map(e,t){return e.map(e=>e.map(t))}}),C=t.F.define({create(){return de.start()},update(e,t){return e.update(t)},provide:e=>[t.y.from(e,e=>e.tooltip),t.r.contentAttributes.from(e,e=>e.attrs)]});function xe(e,t){let n=t.completion.apply||t.completion.label,r=e.state.field(C).active.find(e=>e.source==t.source);return r instanceof ve&&(typeof n==`string`?e.dispatch({...m(e.state,n,r.from,r.to),annotations:p.of(t.completion)}):n(e,t.completion,r.from,r.to),!0)}var Se=oe(C,xe);function Ce(e,n=`option`){return r=>{let i=r.state.field(C,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp<r.state.facet(x).interactionDelay)return!1;let a=1,o;n==`page`&&(o=t.u(r,i.open.tooltip))&&(a=Math.max(2,Math.floor(o.dom.offsetHeight/o.dom.querySelector(`li`).offsetHeight)-1));let{length:s}=i.open.options,c=i.open.selected>-1?i.open.selected+a*(e?1:-1):e?0:s-1;return c<0?c=n==`page`?0:s-1:c>=s&&(c=n==`page`?s-1:0),r.dispatch({effects:ne.of(c)}),!0}}var we=e=>{let t=e.state.field(C,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(x).interactionDelay?!1:xe(e,t.open.options[t.open.selected])},Te=e=>e.state.field(C,!1)?(e.dispatch({effects:_.of(!0)}),!0):!1,Ee=e=>{let t=e.state.field(C,!1);return!t||!t.active.some(e=>e.state!=0)?!1:(e.dispatch({effects:v.of(null)}),!0)},De=class{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}},Oe=50,ke=1e3,Ae=t.a.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(C).active)t.isPending&&this.startQuery(t)}update(e){let n=e.state.field(C),r=e.state.facet(x);if(!e.selectionSet&&!e.docChanged&&e.startState.field(C)==n)return;let i=e.transactions.some(e=>{let t=_e(e,r);return t&8||(e.selection||e.docChanged)&&!(t&3)});for(let n=0;n<this.running.length;n++){let r=this.running[n];if(i||r.context.abortOnDocChange&&e.docChanged||r.updates.length+e.transactions.length>Oe&&Date.now()-r.time>ke){for(let e of r.context.abortListeners)try{e()}catch(e){t._(this.view.state,e)}r.context.abortListeners=null,this.running.splice(n--,1)}else r.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(_)))&&(this.pendingStart=!0);let a=this.pendingStart?50:r.activateOnTypingDelay;if(this.debounceUpdate=n.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),a):-1,this.composing!=0)for(let t of e.transactions)t.isUserEvent(`input.type`)?this.composing=2:this.composing==2&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(C);for(let e of t.active)e.isPending&&!this.running.some(t=>t.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(x).updateSyncTime))}startQuery(e){let{state:n}=this.view,r=new a(n,d(n),e.explicit,this.view),i=new De(e,r);this.running.push(i),Promise.resolve(e.source(r)).then(e=>{i.context.aborted||(i.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:v.of(null)}),t._(this.view.state,e)})}scheduleAccept(){this.running.every(e=>e.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(x).updateSyncTime))}accept(){this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(x),n=this.view.state.field(C);for(let r=0;r<this.running.length;r++){let i=this.running[r];if(i.done===void 0)continue;if(this.running.splice(r--,1),i.done){let n=d(i.updates.length?i.updates[0].startState:this.view.state),r=Math.min(n,i.done.from+ +!i.active.explicit),a=new ve(i.active.source,i.active.explicit,r,i.done,i.done.from,i.done.to??n);for(let e of i.updates)a=a.update(e,t);if(a.hasResult()){e.push(a);continue}}let a=n.active.find(e=>e.source==i.active.source);if(a&&a.isPending){if(i.done==null){let n=new S(i.active.source,0);for(let e of i.updates)n=n.update(e,t);n.isPending||e.push(n)}else this.startQuery(a)}}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:be.of(e)})}},{eventHandlers:{blur(e){let n=this.view.state.field(C,!1);if(n&&n.tooltip&&this.view.state.facet(x).closeOnBlur){let r=n.open&&t.u(this.view,n.open.tooltip);(!r||!r.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:v.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:_.of(!1)}),20),this.composing=0}}}),je=typeof navigator==`object`&&/Win/.test(navigator.platform),Me=t.A.highest(t.r.domEventHandlers({keydown(e,t){let n=t.state.field(C,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(je&&e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(e=>e.source==r.source),a=r.completion.commitCharacters||i.result.commitCharacters;return a&&a.indexOf(e.key)>-1&&xe(t,r),!1}})),Ne=t.r.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:`monospace`,whiteSpace:`nowrap`,overflow:`hidden auto`,maxWidth_fallback:`700px`,maxWidth:`min(700px, 95vw)`,minWidth:`250px`,maxHeight:`10em`,height:`100%`,listStyle:`none`,margin:0,padding:0,"& > li, & > completion-section":{padding:`1px 3px`,lineHeight:1.2},"& > li":{overflowX:`hidden`,textOverflow:`ellipsis`,cursor:`pointer`},"& > completion-section":{display:`list-item`,borderBottom:`1px solid silver`,paddingLeft:`0.5em`,opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#17c`,color:`white`},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#777`},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#347`,color:`white`},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#444`},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:`"···"`,opacity:.5,display:`block`,textAlign:`center`,cursor:`pointer`},".cm-tooltip.cm-completionInfo":{position:`absolute`,padding:`3px 9px`,width:`max-content`,maxWidth:`400px`,boxSizing:`border-box`,whiteSpace:`pre-line`},".cm-completionInfo.cm-completionInfo-left":{right:`100%`},".cm-completionInfo.cm-completionInfo-right":{left:`100%`},".cm-completionInfo.cm-completionInfo-left-narrow":{right:`30px`},".cm-completionInfo.cm-completionInfo-right-narrow":{left:`30px`},"&light .cm-snippetField":{backgroundColor:`#00000022`},"&dark .cm-snippetField":{backgroundColor:`#ffffff22`},".cm-snippetFieldPosition":{verticalAlign:`text-top`,width:0,height:`1.15em`,display:`inline-block`,margin:`0 -0.7px -.7em`,borderLeft:`1.4px dotted #888`},".cm-completionMatchedText":{textDecoration:`underline`},".cm-completionDetail":{marginLeft:`0.5em`,fontStyle:`italic`},".cm-completionIcon":{fontSize:`90%`,width:`.8em`,display:`inline-block`,textAlign:`center`,paddingRight:`.6em`,opacity:`0.6`,boxSizing:`content-box`},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:`'ƒ'`}},".cm-completionIcon-class":{"&:after":{content:`'○'`}},".cm-completionIcon-interface":{"&:after":{content:`'◌'`}},".cm-completionIcon-variable":{"&:after":{content:`'𝑥'`}},".cm-completionIcon-constant":{"&:after":{content:`'𝐶'`}},".cm-completionIcon-type":{"&:after":{content:`'𝑡'`}},".cm-completionIcon-enum":{"&:after":{content:`'∪'`}},".cm-completionIcon-property":{"&:after":{content:`'□'`}},".cm-completionIcon-keyword":{"&:after":{content:`'🔑︎'`}},".cm-completionIcon-namespace":{"&:after":{content:`'▢'`}},".cm-completionIcon-text":{"&:after":{content:`'abc'`,fontSize:`50%`,verticalAlign:`middle`}}}),Pe=class{constructor(e,t,n,r){this.field=e,this.line=t,this.from=n,this.to=r}},Fe=class e{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(n){let r=n.mapPos(this.from,-1,t.k.TrackDel),i=n.mapPos(this.to,1,t.k.TrackDel);return r==null||i==null?null:new e(this.field,r,i)}},Ie=class e{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let r=[],i=[t],a=e.doc.lineAt(t),o=/^\s*/.exec(a.text)[0];for(let a of this.lines){if(r.length){let r=o,s=/^\t*/.exec(a)[0].length;for(let t=0;t<s;t++)r+=e.facet(n.w);i.push(t+r.length-s),a=r+a.slice(s)}r.push(a),t+=a.length+1}return{text:r,ranges:this.fieldPositions.map(e=>new Fe(e.field,i[e.line]+e.from,i[e.line]+e.to))}}static parse(t){let n=[],r=[],i=[],a;for(let e of t.split(/\r\n?|\n/)){for(;a=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(e);){let t=a[1]?+a[1]:null,o=a[2]||a[3]||``,s=-1;t===0&&(t=1e9);let c=o.replace(/\\[{}]/g,e=>e[1]);for(let e=0;e<n.length;e++)(t==null?c&&n[e].name==c:n[e].seq==t)&&(s=e);if(s<0){let e=0;for(;e<n.length&&(t==null||n[e].seq!=null&&n[e].seq<t);)e++;n.splice(e,0,{seq:t,name:c}),s=e;for(let e of i)e.field>=s&&e.field++}for(let e of i)if(e.line==r.length&&e.from>a.index){let t=a[2]?3+(a[1]||``).length:2;e.from-=t,e.to-=t}i.push(new Pe(s,r.length,a.index,a.index+c.length)),e=e.slice(0,a.index)+o+e.slice(a.index+a[0].length)}e=e.replace(/\\([{}])/g,(e,t,n)=>{for(let e of i)e.line==r.length&&e.from>n&&(e.from--,e.to--);return t}),r.push(e)}return new e(r,i)}},Le=t.t.widget({widget:new class extends t.o{toDOM(){let e=document.createElement(`span`);return e.className=`cm-snippetFieldPosition`,e}ignoreEvent(){return!1}}}),Re=t.t.mark({class:`cm-snippetField`}),ze=class e{constructor(e,n){this.ranges=e,this.active=n,this.deco=t.t.set(e.map(e=>(e.from==e.to?Le:Re).range(e.from,e.to)),!0)}map(t){let n=[];for(let e of this.ranges){let r=e.map(t);if(!r)return null;n.push(r)}return new e(n,this.active)}selectionInsideField(e){return e.ranges.every(e=>this.ranges.some(t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))}},w=t.P.define({map(e,t){return e&&e.map(t)}}),Be=t.P.define(),T=t.F.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(w))return n.value;if(n.is(Be)&&e)return new ze(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>t.r.decorations.from(e,e=>e?e.deco:t.t.none)});function Ve(e,n){return t.E.create(e.filter(e=>e.field==n).map(e=>t.E.range(e.from,e.to)))}function He(e){let n=Ie.parse(e);return(e,r,i,a)=>{let{text:o,ranges:s}=n.instantiate(e.state,i),{main:c}=e.state.selection,l={changes:{from:i,to:a==c.from?c.to:a,insert:t.I.of(o)},scrollIntoView:!0,annotations:r?[p.of(r),t.L.userEvent.of(`input.complete`)]:void 0};if(s.length&&(l.selection=Ve(s,0)),s.some(e=>e.field>0)){let n=new ze(s,0),r=l.effects=[w.of(n)];e.state.field(T,!1)===void 0&&r.push(t.P.appendConfig.of([T,Ke,Je,Ne]))}e.dispatch(e.state.update(l))}}function Ue(e){return({state:t,dispatch:n})=>{let r=t.field(T,!1);if(!r||e<0&&r.active==0)return!1;let i=r.active+e,a=e>0&&!r.ranges.some(t=>t.field==i+e);return n(t.update({selection:Ve(r.ranges,i),effects:w.of(a?null:new ze(r.ranges,i)),scrollIntoView:!0})),!0}}var We=[{key:`Tab`,run:Ue(1),shift:Ue(-1)},{key:`Escape`,run:({state:e,dispatch:t})=>e.field(T,!1)?(t(e.update({effects:w.of(null)})),!0):!1}],Ge=t.O.define({combine(e){return e.length?e[0]:We}}),Ke=t.A.highest(t.h.compute([Ge],e=>e.facet(Ge)));function qe(e,t){return{...t,apply:He(e)}}var Je=t.r.domEventHandlers({mousedown(e,t){let n=t.state.field(T,!1),r;if(!n||(r=t.posAtCoords({x:e.clientX,y:e.clientY}))==null)return!1;let i=n.ranges.find(e=>e.from<=r&&e.to>=r);return!i||i.field==n.active?!1:(t.dispatch({selection:Ve(n.ranges,i.field),effects:w.of(n.ranges.some(e=>e.field>i.field)?new ze(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),E={brackets:[`(`,`[`,`{`,`'`,`"`],before:`)]}:;>`,stringPrefixes:[]},D=t.P.define({map(e,n){return n.mapPos(e,-1,t.k.TrackAfter)??void 0}}),Ye=new class extends t.N{};Ye.startSide=1,Ye.endSide=-1;var Xe=t.F.define({create(){return t.j.empty},update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(D)&&(e=e.update({add:[Ye.range(n.value,n.value+1)]}));return e}});function Ze(){return[nt,Xe]}var Qe=`()[]{}<>«»»«[]{}`;function $e(e){for(let t=0;t<16;t+=2)if(Qe.charCodeAt(t)==e)return Qe.charAt(t+1);return t.U(e<128?e:e+1)}function et(e,t){return e.languageDataAt(`closeBrackets`,t)[0]||E}var tt=typeof navigator==`object`&&/Android\b/.test(navigator.userAgent),nt=t.r.inputHandler.of((e,n,r,i)=>{if((tt?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let a=e.state.selection.main;if(i.length>2||i.length==2&&t.z(t.R(i,0))==1||n!=a.from||r!=a.to)return!1;let o=it(e.state,i);return o?(e.dispatch(o),!0):!1}),rt=[{key:`Backspace`,run:({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=et(e,e.selection.main.head).brackets||E.brackets,i=null,a=e.changeByRange(n=>{if(n.empty){let i=ot(e.doc,n.head);for(let a of r)if(a==i&&O(e.doc,n.head)==$e(t.R(a,0)))return{changes:{from:n.head-a.length,to:n.head+a.length},range:t.E.cursor(n.head-a.length)}}return{range:i=n}});return i||n(e.update(a,{scrollIntoView:!0,userEvent:`delete.backward`})),!i}}];function it(e,n){let r=et(e,e.selection.main.head),i=r.brackets||E.brackets;for(let a of i){let o=$e(t.R(a,0));if(n==a)return o==a?lt(e,a,i.indexOf(a+a+a)>-1,r):st(e,a,o,r.before||E.before);if(n==o&&at(e,e.selection.main.from))return ct(e,a,o)}return null}function at(e,t){let n=!1;return e.field(Xe).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function O(e,n){let r=e.sliceString(n,n+2);return r.slice(0,t.z(t.R(r,0)))}function ot(e,n){let r=e.sliceString(n-2,n);return t.z(t.R(r,0))==r.length?r:r.slice(1)}function st(e,n,r,i){let a=null,o=e.changeByRange(o=>{if(!o.empty)return{changes:[{insert:n,from:o.from},{insert:r,from:o.to}],effects:D.of(o.to+n.length),range:t.E.range(o.anchor+n.length,o.head+n.length)};let s=O(e.doc,o.head);return!s||/\s/.test(s)||i.indexOf(s)>-1?{changes:{insert:n+r,from:o.head},effects:D.of(o.head+n.length),range:t.E.cursor(o.head+n.length)}:{range:a=o}});return a?null:e.update(o,{scrollIntoView:!0,userEvent:`input.type`})}function ct(e,n,r){let i=null,a=e.changeByRange(n=>n.empty&&O(e.doc,n.head)==r?{changes:{from:n.head,to:n.head+r.length,insert:r},range:t.E.cursor(n.head+r.length)}:i={range:n});return i?null:e.update(a,{scrollIntoView:!0,userEvent:`input.type`})}function lt(e,n,r,i){let a=i.stringPrefixes||E.stringPrefixes,o=null,s=e.changeByRange(i=>{if(!i.empty)return{changes:[{insert:n,from:i.from},{insert:n,from:i.to}],effects:D.of(i.to+n.length),range:t.E.range(i.anchor+n.length,i.head+n.length)};let s=i.head,c=O(e.doc,s),l;if(c==n){if(ut(e,s))return{changes:{insert:n+n,from:s},effects:D.of(s+n.length),range:t.E.cursor(s+n.length)};if(at(e,s)){let i=r&&e.sliceDoc(s,s+n.length*3)==n+n+n?n+n+n:n;return{changes:{from:s,to:s+i.length,insert:i},range:t.E.cursor(s+i.length)}}}else if(r&&e.sliceDoc(s-2*n.length,s)==n+n&&(l=ft(e,s-2*n.length,a))>-1&&ut(e,l))return{changes:{insert:n+n+n+n,from:s},effects:D.of(s+n.length),range:t.E.cursor(s+n.length)};else if(e.charCategorizer(s)(c)!=t.w.Word&&ft(e,s,a)>-1&&!dt(e,s,n,a))return{changes:{insert:n+n,from:s},effects:D.of(s+n.length),range:t.E.cursor(s+n.length)};return{range:o=i}});return o?null:e.update(s,{scrollIntoView:!0,userEvent:`input.type`})}function ut(e,t){let r=n.k(e).resolveInner(t+1);return r.parent&&r.from==t}function dt(e,t,r,i){let a=n.k(e).resolveInner(t,-1),o=i.reduce((e,t)=>Math.max(e,t.length),0);for(let n=0;n<5;n++){let n=e.sliceDoc(a.from,Math.min(a.to,a.from+r.length+o)),s=n.indexOf(r);if(!s||s>-1&&i.indexOf(n.slice(0,s))>-1){let t=a.firstChild;for(;t&&t.from==a.from&&t.to-t.from>r.length+s;){if(e.sliceDoc(t.to-r.length,t.to)==r)return!1;t=t.firstChild}return!0}let c=a.to==t&&a.parent;if(!c)break;a=c}return!1}function ft(e,n,r){let i=e.charCategorizer(n);if(i(e.sliceDoc(n-1,n))!=t.w.Word)return n;for(let a of r){let r=n-a.length;if(e.sliceDoc(r,n)==a&&i(e.sliceDoc(r-1,r))!=t.w.Word)return r}return-1}function pt(e={}){return[Me,C,x.of(e),Ae,ht,Ne]}var mt=[{key:`Ctrl-Space`,run:Te},{mac:"Alt-`",run:Te},{mac:`Alt-i`,run:Te},{key:`Escape`,run:Ee},{key:`ArrowDown`,run:Ce(!0)},{key:`ArrowUp`,run:Ce(!1)},{key:`PageDown`,run:Ce(!0,`page`)},{key:`PageUp`,run:Ce(!1,`page`)},{key:`Enter`,run:we}],ht=t.A.highest(t.h.computeN([x],e=>e.facet(x).defaultKeymap?[mt]:[])),gt=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=xt(e.state,n.from);return r.line?vt(e):r.block?bt(e):!1};function _t(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return i?(r(n.update(i)),!0):!1}}var vt=_t(Tt,0),yt=_t(wt,0),bt=_t((e,t)=>wt(e,t,Ct(t)),0);function xt(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var k=50;function St(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-k,r),o=e.sliceDoc(i,i+k),s=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(o)[0].length,l=a.length-s;if(a.slice(l-t.length,l)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:i+c,margin:c&&1}};let u,d;i-r<=100?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+k),d=e.sliceDoc(i-k,i));let f=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(d)[0].length,m=d.length-p-n.length;return u.slice(f,f+t.length)==t&&d.slice(m,m+n.length)==n?{open:{pos:r+f+t.length,margin:+!!/\s/.test(u.charAt(f+t.length))},close:{pos:i-p-n.length,margin:+!!/\s/.test(d.charAt(m-1))}}:null}function Ct(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}function wt(e,t,n=t.selection.ranges){let r=n.map(e=>xt(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>St(t,r[n],e.from,e.to));if(e!=2&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+` `},{from:e.to,insert:` `+r[t].close}]))};if(e!=1&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:a,close:o}=n;e.push({from:a.pos-i.open.length,to:a.pos+a.margin},{from:o.pos-o.margin,to:o.pos+i.close.length})}return{changes:e}}return null}function Tt(e,t,n=t.selection.ranges){let r=[],i=-1;ranges:for(let{from:e,to:a}of n){let n=r.length,o=1e9,s;for(let n=e;n<=a;){let c=t.doc.lineAt(n);if(s==null&&(s=xt(t,c.from).line,!s))continue ranges;if(c.from>i&&(e==a||a>c.from)){i=c.from;let e=/^\s*/.exec(c.text)[0].length,t=e==c.length,n=c.text.slice(e,e+s.length)==s?e:-1;e<c.text.length&&e<o&&(o=e),r.push({line:c,comment:n,token:s,indent:e,empty:t,single:!1})}n=c.to+1}if(o<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=o);r.length==n+1&&(r[n].single=!0)}if(e!=2&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:a,single:o}of r)(o||!a)&&e.push({from:t.from+i,insert:n+` `});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(e!=1&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,a=r+i.length;t.text[a-t.from]==` `&&a++,e.push({from:r,to:a})}return{changes:e}}return null}var Et=t.x.define(),Dt=t.x.define(),Ot=t.O.define(),kt=t.O.define({combine(e){return t.B(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}}),At=t.F.define({create(){return P.empty},update(e,n){let r=n.state.facet(kt),i=n.annotation(Et);if(i){let t=j.fromTransaction(n,i.selection),a=i.side,o=a==0?e.undone:e.done;return o=t?M(o,o.length,r.minDepth,t):Bt(o,n.startState.selection),new P(a==0?i.rest:o,a==0?o:i.rest)}let a=n.annotation(Dt);if((a==`full`||a==`before`)&&(e=e.isolate()),n.annotation(t.L.addToHistory)===!1)return n.changes.empty?e:e.addMapping(n.changes.desc);let o=j.fromTransaction(n),s=n.annotation(t.L.time),c=n.annotation(t.L.userEvent);return o?e=e.addChanges(o,s,c,r,n):n.selection&&(e=e.addSelection(n.startState.selection,s,c,r.newGroupDelay)),(a==`full`||a==`after`)&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}},fromJSON(e){return new P(e.done.map(j.fromJSON),e.undone.map(j.fromJSON))}});function jt(e={}){return[At,kt.of(e),t.r.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?Mt:e.inputType==`historyRedo`?Nt:null;return n?(e.preventDefault(),n(t)):!1}})]}function A(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(At,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var Mt=A(0,!1),Nt=A(1,!1),Pt=A(0,!0),Ft=A(1,!0),j=class e{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(t){return new e(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){return{changes:this.changes?.toJSON(),mapped:this.mapped?.toJSON(),startSelection:this.startSelection?.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(n){return new e(n.changes&&t.C.fromJSON(n.changes),[],n.mapped&&t.S.fromJSON(n.mapped),n.startSelection&&t.E.fromJSON(n.startSelection),n.selectionsAfter.map(t.E.fromJSON))}static fromTransaction(t,n){let r=N;for(let e of t.startState.facet(Ot)){let n=e(t);n.length&&(r=r.concat(n))}return!r.length&&t.changes.empty?null:new e(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,N)}static selection(t){return new e(void 0,N,void 0,void 0,t)}};function M(e,t,n,r){let i=t+1>n+20?t-n-1:0,a=e.slice(i,t);return a.push(r),a}function It(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,a)=>{for(let e=0;e<n.length;){let t=n[e++],o=n[e++];a>=t&&i<=o&&(r=!0)}}),r}function Lt(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function Rt(e,t){return e.length?t.length?e.concat(t):e:t}var N=[],zt=200;function Bt(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-zt));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),M(e,e.length-1,1e9,n.setSelAfter(r)))}return[j.selection([t])]}function Vt(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function Ht(e,t){if(!e.length)return e;let n=e.length,r=N;for(;n;){let i=Ut(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[j.selection(r)]:N}function Ut(e,n,r){let i=Rt(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(n)):N,r);if(!e.changes)return j.selection(i);let a=e.changes.map(n),o=n.mapDesc(e.changes,!0),s=e.mapped?e.mapped.composeDesc(o):o;return new j(a,t.P.mapEffects(e.effects,n),s,e.startSelection.map(o),i)}var Wt=/^(input\.type|delete)($|\.)/,P=class e{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(n,r,i,a,o){let s=this.done,c=s[s.length-1];return s=c&&c.changes&&!c.changes.empty&&n.changes&&(!i||Wt.test(i))&&(!c.selectionsAfter.length&&r-this.prevTime<a.newGroupDelay&&a.joinToEvent(o,It(c.changes,n.changes))||i==`input.type.compose`)?M(s,s.length-1,a.minDepth,new j(n.changes.compose(c.changes),Rt(t.P.mapEffects(n.effects,c.changes),c.effects),c.mapped,c.startSelection,N)):M(s,s.length,a.minDepth,n),new e(s,N,r,i)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:N;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Lt(a[a.length-1],t)?this:new e(Bt(this.done,t),this.undone,n,r)}addMapping(t){return new e(Ht(this.done,t),Ht(this.undone,t),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],a=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:Et.of({side:e,rest:Vt(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?N:r.slice(0,r.length-1);return i.mapped&&(n=Ht(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:Et.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}return null}};P.empty=new P(N,N);var Gt=[{key:`Mod-z`,run:Mt,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:Nt,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:Nt,preventDefault:!0},{key:`Mod-u`,run:Pt,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:Ft,preventDefault:!0}];function F(e,n){return t.E.create(e.ranges.map(n),e.mainIndex)}function I(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function L({state:e,dispatch:t},n){let r=F(e.selection,n);return!r.eq(e.selection,!0)&&(t(I(e,r)),!0)}function R(e,n){return t.E.cursor(n?e.to:e.from)}function Kt(e,t){return L(e,n=>n.empty?e.moveByChar(n,t):R(n,t))}function z(e){return e.textDirectionAt(e.state.selection.main.head)==t.n.LTR}var qt=e=>Kt(e,!z(e)),Jt=e=>Kt(e,z(e));function Yt(e,t){return L(e,n=>n.empty?e.moveByGroup(n,t):R(n,t))}var Xt=e=>Yt(e,!z(e)),Zt=e=>Yt(e,z(e));typeof Intl<`u`&&Intl.Segmenter;function Qt(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function B(e,r,i){let a=n.k(e).resolveInner(r.head),o=i?n.I.closedBy:n.I.openedBy;for(let t=r.head;;){let n=i?a.childAfter(t):a.childBefore(t);if(!n)break;Qt(e,n,o)?a=n:t=i?n.to:n.from}let s=a.type.prop(o),c,l;return l=s&&(c=i?n.E(e,a.from,1):n.E(e,a.to,-1))&&c.matched?i?c.end.to:c.end.from:i?a.to:a.from,t.E.cursor(l,i?-1:1)}var $t=e=>L(e,t=>B(e.state,t,!z(e))),en=e=>L(e,t=>B(e.state,t,z(e)));function tn(e,t){return L(e,n=>{if(!n.empty)return R(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var nn=e=>tn(e,!1),rn=e=>tn(e,!0);function an(e){let n=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,r=0,i=0,a;if(n){for(let n of e.state.facet(t.r.scrollMargins)){let t=n(e);t?.top&&(r=Math.max(t?.top,r)),t?.bottom&&(i=Math.max(t?.bottom,i))}a=e.scrollDOM.clientHeight-r-i}else a=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:r,marginBottom:i,selfScroll:n,height:Math.max(e.defaultLineHeight,a-5)}}function on(e,n){let r=an(e),{state:i}=e,a=F(i.selection,t=>t.empty?e.moveVertically(t,n,r.height):R(t,n));if(a.eq(i.selection))return!1;let o;if(r.selfScroll){let n=e.coordsAtPos(i.selection.main.head),s=e.scrollDOM.getBoundingClientRect(),c=s.top+r.marginTop,l=s.bottom-r.marginBottom;n&&n.top>c&&n.bottom<l&&(o=t.r.scrollIntoView(a.main.head,{y:`start`,yMargin:n.top-c}))}return e.dispatch(I(i,a),{effects:o}),!0}var sn=e=>on(e,!1),cn=e=>on(e,!0);function V(e,n,r){let i=e.lineBlockAt(n.head),a=e.moveToLineBoundary(n,r);if(a.head==n.head&&a.head!=(r?i.to:i.from)&&(a=e.moveToLineBoundary(n,r,!1)),!r&&a.head==i.from&&i.length){let r=/^\s*/.exec(e.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;r&&n.head!=i.from+r&&(a=t.E.cursor(i.from+r))}return a}var ln=e=>L(e,t=>V(e,t,!0)),un=e=>L(e,t=>V(e,t,!1)),dn=e=>L(e,t=>V(e,t,!z(e))),fn=e=>L(e,t=>V(e,t,z(e))),pn=e=>L(e,t=>e.moveToLineBoundary(t,!1,!1)),mn=e=>L(e,t=>e.moveToLineBoundary(t,!0,!1));function hn(e,r,i){let a=!1,o=F(e.selection,r=>{let o=n.E(e,r.head,-1)||n.E(e,r.head,1)||r.head>0&&n.E(e,r.head-1,1)||r.head<e.doc.length&&n.E(e,r.head+1,-1);if(!o||!o.end)return r;a=!0;let s=o.start.from==r.head?o.end.to:o.end.from;return i?t.E.range(r.anchor,s):t.E.cursor(s)});return a?(r(I(e,o)),!0):!1}var gn=({state:e,dispatch:t})=>hn(e,t,!1);function H(e,n,r){let i=F(e.state.selection,e=>{e.undirectional&&e.head>=e.anchor!=n&&(e=t.E.range(e.head,e.anchor));let i=r(e);return t.E.range(e.anchor,i.head,i.goalColumn,i.bidiLevel||void 0,i.assoc)});return!i.eq(e.state.selection)&&(e.dispatch(I(e.state,i)),!0)}function _n(e,t){return H(e,t,n=>e.moveByChar(n,t))}var vn=e=>_n(e,!z(e)),yn=e=>_n(e,z(e));function bn(e,t){return H(e,t,n=>e.moveByGroup(n,t))}var xn=e=>bn(e,!z(e)),Sn=e=>bn(e,z(e)),Cn=e=>{let t=!z(e);return H(e,t,n=>B(e.state,n,t))},wn=e=>{let t=z(e);return H(e,t,n=>B(e.state,n,t))};function Tn(e,t){return H(e,t,n=>e.moveVertically(n,t))}var En=e=>Tn(e,!1),Dn=e=>Tn(e,!0);function On(e,t){return H(e,t,n=>e.moveVertically(n,t,an(e).height))}var kn=e=>On(e,!1),An=e=>On(e,!0),jn=e=>H(e,!0,t=>V(e,t,!0)),Mn=e=>H(e,!1,t=>V(e,t,!1)),Nn=e=>{let t=!z(e);return H(e,t,n=>V(e,n,t))},Pn=e=>{let t=z(e);return H(e,t,n=>V(e,n,t))},Fn=e=>H(e,!1,n=>t.E.cursor(e.lineBlockAt(n.head).from)),In=e=>H(e,!0,n=>t.E.cursor(e.lineBlockAt(n.head).to)),Ln=({state:e,dispatch:t})=>(t(I(e,{anchor:0})),!0),Rn=({state:e,dispatch:t})=>(t(I(e,{anchor:e.doc.length})),!0),zn=({state:e,dispatch:t})=>(t(I(e,{anchor:e.selection.main.anchor,head:0})),!0),Bn=({state:e,dispatch:t})=>(t(I(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),Vn=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),Hn=({state:e,dispatch:n})=>{let r=or(e).map(({from:n,to:r})=>t.E.undirectionalRange(n,Math.min(r+1,e.doc.length)));return n(e.update({selection:t.E.create(r),userEvent:`select`})),!0},Un=({state:e,dispatch:r})=>{let i=F(e.selection,r=>{let i=n.k(e),a=i.resolveStack(r.from,1);if(r.empty){let e=i.resolveStack(r.from,-1);e.node.from>=a.node.from&&e.node.to<=a.node.to&&(a=e)}for(let e=a;e;e=e.next){let{node:n}=e;if((n.from<r.from&&n.to>=r.to||n.to>r.to&&n.from<=r.from)&&e.next)return t.E.undirectionalRange(n.from,n.to)}return r});return!i.eq(e.selection)&&(r(I(e,i)),!0)};function Wn(e,n){let{state:r}=e,i=r.selection,a=r.selection.ranges.slice();for(let t of r.selection.ranges){let i=r.doc.lineAt(t.head);if(n?i.to<e.state.doc.length:i.from>0)for(let r=t;;){let t=e.moveVertically(r,n);if(t.head<i.from||t.head>i.to){a.some(e=>e.head==t.head)||a.push(t);break}if(t.head==r.head)break;r=t}}return a.length!=i.ranges.length&&(e.dispatch(I(r,t.E.create(a,a.length-1))),!0)}var Gn=e=>Wn(e,!1),Kn=e=>Wn(e,!0),qn=({state:e,dispatch:n})=>{let r=e.selection,i=null;return r.ranges.length>1?i=t.E.create([r.main]):r.main.empty||(i=t.E.create([t.E.cursor(r.main.head)])),i?(n(I(e,i)),!0):!1};function U(e,n){if(e.state.readOnly)return!1;let r=`delete.selection`,{state:i}=e,a=i.changeByRange(i=>{let{from:a,to:o}=i;if(a==o){let t=n(i);t<a?(r=`delete.backward`,t=Jn(e,t,!1)):t>a&&(r=`delete.forward`,t=Jn(e,t,!0)),a=Math.min(a,t),o=Math.max(o,t)}else a=Jn(e,a,!1),o=Jn(e,o,!0);return a==o?{range:i}:{changes:{from:a,to:o},range:t.E.cursor(a,a<i.head?-1:1)}});return!a.changes.empty&&(e.dispatch(i.update(a,{scrollIntoView:!0,userEvent:r,effects:r==`delete.selection`?t.r.announce.of(i.phrase(`Selection deleted`)):void 0})),!0)}function Jn(e,n,r){if(e instanceof t.r)for(let i of e.state.facet(t.r.atomicRanges).map(t=>t(e)))i.between(n,n,(e,t)=>{e<n&&t>n&&(n=r?t:e)});return n}var Yn=(e,r,i)=>U(e,a=>{let o=a.from,{state:s}=e,c=s.doc.lineAt(o),l,u;if(i&&!r&&o>c.from&&o<c.from+200&&!/[^ \t]/.test(l=c.text.slice(0,o-c.from))){if(l[l.length-1]==` `)return o-1;let e=t.V(l,s.tabSize)%n.y(s)||n.y(s);for(let t=0;t<e&&l[l.length-1-t]==` `;t++)o--;u=o}else u=t.H(c.text,o-c.from,r,r)+c.from,u==o&&c.number!=(r?s.doc.lines:1)?u+=r?1:-1:!r&&/[\ufe00-\ufe0f]/.test(c.text.slice(u-c.from,o-c.from))&&(u=t.H(c.text,u-c.from,!1,!1)+c.from);return u}),Xn=e=>Yn(e,!1,!0),Zn=e=>Yn(e,!0,!1),Qn=(e,n)=>U(e,r=>{let i=r.head,{state:a}=e,o=a.doc.lineAt(i),s=a.charCategorizer(i);for(let e=null;;){if(i==(n?o.to:o.from)){i==r.head&&o.number!=(n?a.doc.lines:1)&&(i+=n?1:-1);break}let c=t.H(o.text,i-o.from,n)+o.from,l=o.text.slice(Math.min(i,c)-o.from,Math.max(i,c)-o.from),u=s(l);if(e!=null&&u!=e)break;(l!=` `||i!=r.head)&&(e=u),i=c}return i}),$n=e=>Qn(e,!1),er=e=>Qn(e,!0),tr=e=>U(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),nr=e=>U(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),rr=e=>U(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),ir=({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:t.I.of([``,``])},range:t.E.cursor(e.from)}));return n(e.update(r,{scrollIntoView:!0,userEvent:`input`})),!0},ar=({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(n=>{if(!n.empty||n.from==0||n.from==e.doc.length)return{range:n};let r=n.from,i=e.doc.lineAt(r),a=r==i.from?r-1:t.H(i.text,r-i.from,!1)+i.from,o=r==i.to?r+1:t.H(i.text,r-i.from,!0)+i.from;return{changes:{from:a,to:o,insert:e.doc.slice(r,o).append(e.doc.slice(a,r))},range:t.E.cursor(o)}});return!r.changes.empty&&(n(e.update(r,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function or(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=a.to,e.ranges.push(r)}else t.push({from:i.from,to:a.to,ranges:[r]});n=a.number+1}return t}function sr(e,n,r){if(e.readOnly)return!1;let i=[],a=[];for(let n of or(e)){if(r?n.to==e.doc.length:n.from==0)continue;let o=e.doc.lineAt(r?n.to+1:n.from-1),s=o.length+1;if(r){i.push({from:n.to,to:o.to},{from:n.from,insert:o.text+e.lineBreak});for(let r of n.ranges)a.push(t.E.range(Math.min(e.doc.length,r.anchor+s),Math.min(e.doc.length,r.head+s)))}else{i.push({from:o.from,to:n.from},{from:n.to,insert:e.lineBreak+o.text});for(let e of n.ranges)a.push(t.E.range(e.anchor-s,e.head-s))}}return i.length?(n(e.update({changes:i,scrollIntoView:!0,selection:t.E.create(a,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var cr=({state:e,dispatch:t})=>sr(e,t,!1),lr=({state:e,dispatch:t})=>sr(e,t,!0);function ur(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of or(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:`input.copyline`})),!0}var dr=({state:e,dispatch:t})=>ur(e,t,!1),fr=({state:e,dispatch:t})=>ur(e,t,!0),pr=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(or(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=F(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:`delete.line`}),!0};function mr(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let r=n.k(e).resolveInner(t),i=r.childBefore(t),a=r.childAfter(t),o;return i&&a&&i.to<=t&&a.from>=t&&(o=i.type.prop(n.I.closedBy))&&o.indexOf(a.name)>-1&&e.doc.lineAt(i.to).from==e.doc.lineAt(a.from).from&&!/\S/.test(e.sliceDoc(i.to,a.from))?{from:i.to,to:a.from}:null}var hr=_r(!1),gr=_r(!0);function _r(e){return({state:r,dispatch:i})=>{if(r.readOnly)return!1;let a=r.changeByRange(i=>{let{from:a,to:o}=i,s=r.doc.lineAt(a),c=!e&&a==o&&mr(r,a);e&&(a=o=(o<=s.to?s:r.doc.lineAt(o)).to);let l=new n.t(r,{simulateBreak:a,simulateDoubleBreak:!!c}),u=n.b(l,a);for(u??=t.V(/^\s*/.exec(r.doc.lineAt(a).text)[0],r.tabSize);o<s.to&&/\s/.test(s.text[o-s.from]);)o++;c?{from:a,to:o}=c:a>s.from&&a<s.from+100&&!/\S/.test(s.text.slice(0,a))&&(a=s.from);let d=[``,n.C(r,u)];return c&&d.push(n.C(r,l.lineIndent(s.from,-1))),{changes:{from:a,to:o,insert:t.I.of(d)},range:t.E.cursor(a+1+d[1].length)}});return i(r.update(a,{scrollIntoView:!0,userEvent:`input`})),!0}}function vr(e,n){let r=-1;return e.changeByRange(i=>{let a=[];for(let t=i.from;t<=i.to;){let o=e.doc.lineAt(t);o.number>r&&(i.empty||i.to>o.from)&&(n(o,a,i),r=o.number),t=o.to+1}let o=e.changes(a);return{changes:a,range:t.E.range(o.mapPos(i.anchor,1),o.mapPos(i.head,1))}})}var yr=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=Object.create(null),i=new n.t(e,{overrideIndentation:e=>r[e]??-1}),a=vr(e,(t,a,o)=>{let s=n.b(i,t.from);if(s==null)return;/\S/.test(t.text)||(s=0);let c=/^\s*/.exec(t.text)[0],l=n.C(e,s);(c!=l||o.from<t.from+c.length)&&(r[t.from]=s,a.push({from:t.from,to:t.from+c.length,insert:l}))});return a.changes.empty||t(e.update(a,{userEvent:`indent`})),!0},br=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(vr(e,(t,r)=>{r.push({from:t.from,insert:e.facet(n.w)})}),{userEvent:`input.indent`})),!0),xr=({state:e,dispatch:r})=>!e.readOnly&&(r(e.update(vr(e,(r,i)=>{let a=/^\s*/.exec(r.text)[0];if(!a)return;let o=t.V(a,e.tabSize),s=0,c=n.C(e,Math.max(0,o-n.y(e)));for(;s<a.length&&s<c.length&&a.charCodeAt(s)==c.charCodeAt(s);)s++;i.push({from:r.from+s,to:r.from+a.length,insert:c.slice(s)})}),{userEvent:`delete.dedent`})),!0),Sr=e=>(e.setTabFocusMode(),!0),Cr=[{key:`Ctrl-b`,run:qt,shift:vn,preventDefault:!0},{key:`Ctrl-f`,run:Jt,shift:yn},{key:`Ctrl-p`,run:nn,shift:En},{key:`Ctrl-n`,run:rn,shift:Dn},{key:`Ctrl-a`,run:pn,shift:Fn},{key:`Ctrl-e`,run:mn,shift:In},{key:`Ctrl-d`,run:Zn},{key:`Ctrl-h`,run:Xn},{key:`Ctrl-k`,run:tr},{key:`Ctrl-Alt-h`,run:$n},{key:`Ctrl-o`,run:ir},{key:`Ctrl-t`,run:ar},{key:`Ctrl-v`,run:cn}],wr=[{key:`ArrowLeft`,run:qt,shift:vn,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:Xt,shift:xn,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:dn,shift:Nn,preventDefault:!0},{key:`ArrowRight`,run:Jt,shift:yn,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:Zt,shift:Sn,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:fn,shift:Pn,preventDefault:!0},{key:`ArrowUp`,run:nn,shift:En,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:Ln,shift:zn},{mac:`Ctrl-ArrowUp`,run:sn,shift:kn},{key:`ArrowDown`,run:rn,shift:Dn,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:Rn,shift:Bn},{mac:`Ctrl-ArrowDown`,run:cn,shift:An},{key:`PageUp`,run:sn,shift:kn},{key:`PageDown`,run:cn,shift:An},{key:`Home`,run:un,shift:Mn,preventDefault:!0},{key:`Mod-Home`,run:Ln,shift:zn},{key:`End`,run:ln,shift:jn,preventDefault:!0},{key:`Mod-End`,run:Rn,shift:Bn},{key:`Enter`,run:hr,shift:hr},{key:`Mod-a`,run:Vn},{key:`Backspace`,run:Xn,shift:Xn,preventDefault:!0},{key:`Delete`,run:Zn,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:$n,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:er,preventDefault:!0},{mac:`Mod-Backspace`,run:nr,preventDefault:!0},{mac:`Mod-Delete`,run:rr,preventDefault:!0}].concat(Cr.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),Tr=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:$t,shift:Cn},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:en,shift:wn},{key:`Alt-ArrowUp`,run:cr},{key:`Shift-Alt-ArrowUp`,run:dr},{key:`Alt-ArrowDown`,run:lr},{key:`Shift-Alt-ArrowDown`,run:fr},{key:`Mod-Alt-ArrowUp`,run:Gn},{key:`Mod-Alt-ArrowDown`,run:Kn},{key:`Escape`,run:qn},{key:`Mod-Enter`,run:gr},{key:`Alt-l`,mac:`Ctrl-l`,run:Hn},{key:`Mod-i`,run:Un,preventDefault:!0},{key:`Mod-[`,run:xr},{key:`Mod-]`,run:br},{key:`Mod-Alt-\\`,run:yr},{key:`Shift-Mod-k`,run:pr},{key:`Shift-Mod-\\`,run:gn},{key:`Mod-/`,run:gt},{key:`Alt-A`,mac:`Ctrl-A`,run:yt},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:Sr}].concat(wr),Er=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,Dr=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(Er(e)):Er,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return t.R(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 n=t.U(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=t.z(e);let i=this.normalize(n);if(i.length)for(let e=0,t=r,a=!0;;e++){let r=i.charCodeAt(e),o=this.match(r,t,a,this.bufferPos+this.bufferStart,e==i.length-1);if(o)return this.value=o,this;if(e==i.length-1)break;a&&e<n.length&&n.charCodeAt(e)==r?t++:a=!1}}}match(e,t,n,r,i){let a=null;for(let t=0;t<this.matches.length;){let n=this.matches[t],o=!1;this.query.charCodeAt(n.index)==e&&(n.index==this.query.length-1?a={from:n.from,to:r,precise:i&&n.precise}:(n.index++,o=!0)),o?t++:this.matches.splice(t,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?a={from:t,to:r,precise:n&&i}:this.matches.push({from:t,index:1,precise:n})),a&&this.test&&!this.test(a.from,a.to,this.buffer,this.bufferStart)&&(a=null),a}};typeof Symbol<`u`&&(Dr.prototype[Symbol.iterator]=function(){return this});var Or={from:-1,to:-1,match:/.*/.exec(``),precise:!0},kr=`gm`+(/x/.unicode==null?``:`u`),Ar=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=Or,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new Nr(e,t,n,r,i);this.re=new RegExp(t,kr+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=Pr(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=Pr(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},jr=new WeakMap,Mr=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=jr.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return jr.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),jr.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},Nr=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=Or,this.matchPos=Pr(e,r),this.re=new RegExp(t,kr+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=Mr.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,precise:!0,match:t},this.matchPos=Pr(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Mr.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(Ar.prototype[Symbol.iterator]=Nr.prototype[Symbol.iterator]=function(){return this});function Pr(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var Fr={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Ir=t.O.define({combine(e){return t.B(e,Fr,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function Lr(e){let t=[Ur,Hr];return e&&t.push(Ir.of(e)),t}var Rr=t.t.mark({class:`cm-selectionMatch`}),zr=t.t.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function Br(e,n,r,i){return(r==0||e(n.sliceDoc(r-1,r))!=t.w.Word)&&(i==n.doc.length||e(n.sliceDoc(i,i+1))!=t.w.Word)}function Vr(e,n,r,i){return e(n.sliceDoc(r,r+1))==t.w.Word&&e(n.sliceDoc(i-1,i))==t.w.Word}var Hr=t.a.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let n=e.state.facet(Ir),{state:r}=e,i=r.selection;if(i.ranges.length>1)return t.t.none;let a=i.main,o,s=null;if(a.empty){if(!n.highlightWordAroundCursor)return t.t.none;let e=r.wordAt(a.head);if(!e)return t.t.none;s=r.charCategorizer(a.head),o=r.sliceDoc(e.from,e.to)}else{let e=a.to-a.from;if(e<n.minSelectionLength||e>200)return t.t.none;if(n.wholeWords){if(o=r.sliceDoc(a.from,a.to),s=r.charCategorizer(a.head),!(Br(s,r,a.from,a.to)&&Vr(s,r,a.from,a.to)))return t.t.none}else if(o=r.sliceDoc(a.from,a.to),!o)return t.t.none}let c=[];for(let i of e.visibleRanges){let e=new Dr(r.doc,o,i.from,i.to);for(;!e.next().done;){let{from:i,to:o}=e.value;if((!s||Br(s,r,i,o))&&(a.empty&&i<=a.from&&o>=a.to?c.push(zr.range(i,o)):(i>=a.to||o<=a.from)&&c.push(Rr.range(i,o)),c.length>n.maxMatches))return t.t.none}}return t.t.set(c)}},{decorations:e=>e.decorations}),Ur=t.r.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),Wr=({state:e,dispatch:n})=>{let{selection:r}=e,i=t.E.create(r.ranges.map(n=>e.wordAt(n.head)||t.E.cursor(n.head)),r.mainIndex);return!i.eq(r)&&(n(e.update({selection:i})),!0)};function Gr(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new Dr(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new Dr(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var Kr=({state:e,dispatch:n})=>{let{ranges:r}=e.selection;if(r.some(e=>e.from===e.to))return Wr({state:e,dispatch:n});let i=e.sliceDoc(r[0].from,r[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=i))return!1;let a=Gr(e,i);return a?(n(e.update({selection:e.selection.addRange(t.E.range(a.from,a.to),!1),effects:t.r.scrollIntoView(a.to)})),!0):!1};async function W(e){return n.s.define(await e())}var qr=async()=>(await Promise.resolve().then(()=>require("./dist-BFbWWJdM.cjs")).then(e=>e.t)).javascript({typescript:!0}),Jr=async()=>(await Promise.resolve().then(()=>require("./dist-BFbWWJdM.cjs")).then(e=>e.t)).javascript({typescript:!0,jsx:!0}),Yr=async()=>(await Promise.resolve().then(()=>require("./dist-BFbWWJdM.cjs")).then(e=>e.t)).javascript({jsx:!0}),Xr=async()=>(await Promise.resolve().then(()=>require("./dist-DsOiUWHL.cjs"))).json(),Zr=async()=>(await Promise.resolve().then(()=>require("./dist-C6485_TJ.cjs")).then(e=>e.r)).css(),Qr=async()=>(await Promise.resolve().then(()=>require("./dist-DV7vb3Vn.cjs"))).html(),$r=async()=>(await Promise.resolve().then(()=>require("./dist-DuyBYmw-.cjs"))).xml(),ei=async()=>(await Promise.resolve().then(()=>require("./dist-Cqy-WSUm.cjs"))).markdown(),ti=async()=>(await Promise.resolve().then(()=>require("./dist-BLE5-Y8p.cjs"))).python(),ni=async()=>(await Promise.resolve().then(()=>require("./dist-Cgkuh5Wk.cjs"))).go(),ri=async()=>(await Promise.resolve().then(()=>require("./dist-BQCPWecG.cjs"))).rust(),ii=async()=>(await Promise.resolve().then(()=>require("./dist-CewGgiCl.cjs"))).java(),G=async()=>(await Promise.resolve().then(()=>require("./dist-BmjjdWVL.cjs"))).cpp(),ai=async()=>(await Promise.resolve().then(()=>require("./dist-DdI6ugoG.cjs"))).php(),oi=async()=>(await Promise.resolve().then(()=>require("./dist-Bo7aGd2O.cjs"))).sql(),si=async()=>(await Promise.resolve().then(()=>require("./dist-DWOMmaS_.cjs"))).yaml(),ci=()=>W(async()=>(await Promise.resolve().then(()=>require("./shell-CD1ADQh5.cjs"))).shell),li=()=>W(async()=>(await Promise.resolve().then(()=>require("./dockerfile-C67wRfne.cjs"))).dockerFile),ui=()=>W(async()=>(await Promise.resolve().then(()=>require("./toml-OuUxin0A.cjs"))).toml),K=()=>W(async()=>(await Promise.resolve().then(()=>require("./properties-XjDvZYDm.cjs"))).properties),di={ts:qr,mts:qr,cts:qr,tsx:Jr,js:Yr,jsx:Yr,mjs:Yr,cjs:Yr,json:Xr,jsonc:Xr,css:Zr,scss:Zr,less:Zr,html:Qr,htm:Qr,xml:$r,svg:$r,md:ei,markdown:ei,py:ti,go:ni,rs:ri,java:ii,c:G,h:G,cpp:G,cc:G,cxx:G,hpp:G,php:ai,sql:oi,yaml:si,yml:si,sh:ci,bash:ci,zsh:ci,toml:ui,ini:K,cfg:K,properties:K,env:K,rb:()=>W(async()=>(await Promise.resolve().then(()=>require("./ruby-Bx72aP7E.cjs"))).ruby),cs:()=>W(async()=>(await Promise.resolve().then(()=>require("./clike-I-fVVl3d.cjs"))).csharp)};function fi(e){let t=e.split(`/`).pop()??e;if(/^dockerfile$/i.test(t))return li();if(/^\.env(\..+)?$/.test(t))return K();let n=t.lastIndexOf(`.`),r=n<0?void 0:di[t.slice(n+1).toLowerCase()];return r===void 0?Promise.resolve(null):r()}var q=class e{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}offset(t,n=t){return new e(this.fromA+t,this.toA+t,this.fromB+n,this.toB+n)}};function J(e,t,n,r,i,a){if(e==r)return[];let o=yi(e,t,n,r,i,a),s=bi(e,t+o,n,r,i+o,a);t+=o,n-=s,i+=o,a-=s;let c=n-t,l=a-i;if(!c||!l)return[new q(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new q(t,t+o,i,i),new q(t+o+l,n,a,a)]}else if(l>c){let o=r.slice(i,a).indexOf(e.slice(t,n));if(o>-1)return[new q(t,t,i,i+o),new q(n,n,i+o+c,a)]}if(c==1||l==1)return[new q(t,n,i,a)];let u=Si(e,t,n,r,i,a);if(u){let[o,s,c]=u;return J(e,t,o,r,i,s).concat(J(e,o+c,n,r,s+c,a))}return pi(e,t,n,r,i,a)}var Y=1e9,X=0;function pi(e,t,n,r,i,a){let o=n-t,s=a-i;if(Y<1e9&&Math.min(o,s)>Y*16||X>0&&Date.now()>X)return Math.min(o,s)>Y*64?[new q(t,n,i,a)]:Ci(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);hi.reset(c),gi.reset(c);let l=(n,a)=>e.charCodeAt(t+n)==r.charCodeAt(i+a),u=(t,i)=>e.charCodeAt(n-t-1)==r.charCodeAt(a-i-1),d=(o-s)%2==0?null:gi,f=d?null:hi;for(let p=0;p<c;p++){if(p>Y||X>0&&!(p&63)&&Date.now()>X)return Ci(e,t,n,r,i,a);let m=hi.advance(p,o,s,c,d,!1,l)||gi.advance(p,o,s,c,f,!0,u);if(m)return _i(e,t,n,t+m[0],r,i,a,i+m[1])}return[new q(t,n,i,a)]}var mi=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let e=0;e<this.len;e++)this.vec[e]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,t,n,r,i,a,o){for(let s=-e+this.start;s<=e-this.end;s+=2){let c=r+s,l=s==-e||s!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,u=l-s;for(;l<t&&u<n&&o(l,u);)l++,u++;if(this.vec[c]=l,l>t)this.end+=2;else if(u>n)this.start+=2;else if(i){let e=r+(t-n)-s;if(e>=0&&e<this.len&&i.vec[e]!=-1){if(a){let n=i.vec[e];if(n>=t-l)return[n,r+n-e]}else{let n=t-i.vec[e];if(l>=n)return[l,u]}}}}return null}},hi=new mi,gi=new mi;function _i(e,t,n,r,i,a,o,s){let c=!1;return!Z(e,r)&&++r==n&&(c=!0),!Z(i,s)&&++s==o&&(c=!0),c?[new q(t,n,a,o)]:J(e,t,r,i,a,s).concat(J(e,r,n,i,s,o))}function vi(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function yi(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=vi(n-t,a-i);for(let s=t,c=i;;){let i=s+o,l=c+o;if(i>n||l>a||e.slice(s,i)!=r.slice(c,l)){if(o==1)return s-t-+!Z(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function bi(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=vi(n-t,a-i);for(let s=n,c=a;;){let a=s-o,l=c-o;if(a<t||l<i||e.slice(a,s)!=r.slice(l,c)){if(o==1)return n-s-+!Z(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function xi(e,t,n,r,i,a,o,s){let c=r.slice(i,a),l=null;for(;;){if(l||o<s)return l;for(let s=t+o;;){Z(e,s)||s++;let u=s+o;if(Z(e,u)||(u+=u==s+1?1:-1),u>=n)break;let d=e.slice(s,u),f=-1;for(;(f=c.indexOf(d,f+1))!=-1;){let o=yi(e,u,n,r,i+f+d.length,a),c=bi(e,t,s,r,i,i+f),p=d.length+o+c;(!l||l[2]<p)&&(l=[s-c,i+f-c,p])}s=u}if(s<0)return l;o>>=1}}function Si(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=Si(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:xi(e,t,n,r,i,a,Math.floor(o/4),-1)}function Ci(e,t,n,r,i,a){let o=n-t,s=a-i,c;if(o<s){let s=xi(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=xi(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new q(t,n,i,a)];let[l,u,d]=c;return J(e,t,l,r,i,u).concat(J(e,l+d,n,r,u+d,a))}function wi(e,t){for(let n=1;n<e.length;n++){let r=e[n-1],i=e[n];r.toA>i.fromA-t&&r.toB>i.fromB-t&&(e[n-1]=new q(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function Ti(e,t,n){for(;;){wi(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=yi(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new q(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=bi(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new q(a.fromA,a.toA-s,a.fromB,a.toB-s));let c=a.toA-a.fromA,l=a.toB-a.fromB;if(c&&l)continue;let u=a.fromA-(i?n[i-1].toA:0),d=(i<n.length-1?n[i+1].fromA:e.length)-a.toA;if(!u||!d)continue;let f=c?e.slice(a.fromA,a.toA):t.slice(a.fromB,a.toB);u<=f.length&&e.slice(a.fromA-u,a.fromA)==f.slice(f.length-u)?(n[i]=new q(a.fromA-u,a.toA-u,a.fromB-u,a.toB-u),r=!0):d<=f.length&&e.slice(a.toA,a.toA+d)==f.slice(0,d)&&(n[i]=new q(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}var Ei=e=>e>=55296&&e<=56319,Di=e=>e>=56320&&e<=57343;function Z(e,t){return!t||t==e.length||!Ei(e.charCodeAt(t-1))||!Di(e.charCodeAt(t))}function Oi(e,t,n){let r=n?.override;return r?r(e,t):(Y=(n?.scanLimit??1e9)>>1,X=n?.timeout?Date.now()+n.timeout:0,Ti(e,t,J(e,0,e.length,t,0,t.length)))}function ki(e){return e.fromA===e.toA?`added`:e.fromB===e.toB?`deleted`:`modified`}function Ai(e){return e.split(/\r?\n/)}var ji=256,Mi=2048,Ni=63232;function Pi(e){let t=ji+e;return String.fromCharCode(t>=55296?t+Mi:t)}function Fi(e,t){let n=new Map,r=e=>{let t=``;for(let r of e){let e=n.get(r);if(e===void 0){if(n.size>=Ni)return null;e=Pi(n.size),n.set(r,e)}t+=e}return t},i=r(e),a=r(t);return i===null||a===null?null:Oi(i,a).map(({fromA:e,toA:t,fromB:n,toB:r})=>({fromA:e,toA:t,fromB:n,toB:r}))}function Ii(e,n,r){let i=n.slice(r.fromA,r.toA);if(r.fromB===r.toB){if(r.fromB<e.lines){let n=e.line(r.fromB+1).from;return{from:n,to:n,insert:t.I.of([...i,``])}}return{from:e.length,to:e.length,insert:t.I.of([``,...i])}}let a=e.line(r.fromB+1).from,o=e.line(r.toB).to;return i.length===0?(r.toB<e.lines?o=e.line(r.toB+1).from:r.fromB>0&&(a=e.line(r.fromB).to),{from:a,to:o,insert:t.I.empty}):{from:a,to:o,insert:t.I.of(i)}}var Li=t.P.define(),Ri=t.P.define();function zi(e){let t=[];for(let n=e.iterLines();!n.next().done;)t.push(n.value);return t}function Bi(e,t){return e===null?[]:Fi(e,zi(t))??[]}function Vi(e,t){let n=t.findIndex(t=>t.fromA===e.fromA&&t.toA===e.toA);return n===-1?null:n}var Q=t.F.define({create:()=>({baseline:null,hunks:[],open:null}),update(e,t){let{baseline:n,hunks:r,open:i}=e,a=!1;for(let e of t.effects)e.is(Li)&&(n=e.value===null?null:Ai(e.value),i=null,a=!0);if(a||t.docChanged&&n!==null){let e=i===null?void 0:r[i];r=Bi(n,t.state.doc),i=e===void 0?null:Vi(e,r)}for(let e of t.effects)e.is(Ri)&&(i=i===e.value?null:e.value);return n===e.baseline&&r===e.hunks&&i===e.open?e:{baseline:n,hunks:r,open:i}}}),Hi=class extends t.i{kind;index;atEnd;constructor(e,t,n=!1){super(),this.kind=e,this.index=t,this.atEnd=n}eq(e){return e.kind===this.kind&&e.index===this.index&&e.atEnd===this.atEnd}toDOM(e){let t=document.createElement(`div`);return t.className=`cm-git-mark cm-git-${this.kind}${this.atEnd?` cm-git-at-end`:``}`,t.dataset.gitChange=this.kind,t.title={added:`Added since HEAD: click to see the change`,modified:`Changed since HEAD: click to see what was there`,deleted:`Lines removed since HEAD: click to see them`}[this.kind],t.addEventListener(`mousedown`,t=>{t.preventDefault(),e.dispatch({effects:Ri.of(this.index)})}),t}};function Ui(e){let{hunks:n}=e.field(Q),r=e.doc,i=[];for(let[e,t]of n.entries()){let n=ki(t);if(n===`deleted`){let a=t.fromB>=r.lines;i.push(new Hi(n,e,a).range(r.line(a?r.lines:t.fromB+1).from))}else for(let a=t.fromB;a<t.toB;a++)i.push(new Hi(n,e).range(r.line(a+1).from))}return t.j.of(i,!0)}var Wi=class extends t.o{index;kind;old;editable;constructor(e,t,n,r){super(),this.index=e,this.kind=t,this.old=n,this.editable=r}eq(e){return e.index===this.index&&e.editable===this.editable&&e.old.join(`
|
|
2
|
+
`)===this.old.join(`
|
|
3
|
+
`)}toDOM(e){let t=document.createElement(`div`);t.className=`cm-git-peek`,t.setAttribute(`role`,`region`),t.setAttribute(`aria-label`,`HEAD version of this change`);let n=document.createElement(`div`);n.className=`cm-git-peek-bar`;let r=document.createElement(`span`);if(r.textContent=this.kind===`added`?`Not in HEAD`:`In HEAD`,n.append(r),this.editable){let t=document.createElement(`button`);t.type=`button`,t.textContent=`Revert this change`,t.addEventListener(`click`,()=>{let{baseline:t,hunks:n}=e.state.field(Q),r=n[this.index];t!==null&&r!==void 0&&(e.dispatch({changes:Ii(e.state.doc,t,r),userEvent:`input.revert`}),e.focus())}),n.append(t)}let i=document.createElement(`button`);if(i.type=`button`,i.textContent=`Close`,i.addEventListener(`click`,()=>e.dispatch({effects:Ri.of(this.index)})),n.append(i),t.append(n),this.old.length>0){let e=document.createElement(`pre`);e.className=`cm-git-peek-old`,e.textContent=this.old.join(`
|
|
4
|
+
`),t.append(e)}return t}ignoreEvent(){return!0}};function Gi(e){let n=e.field(Q);if(n.open===null||n.baseline===null)return t.t.none;let r=n.hunks[n.open];if(r===void 0)return t.t.none;let i=e.doc,a=ki(r),o=n.baseline.slice(r.fromA,r.toA),s=new Wi(n.open,a,o,!e.readOnly),c=a!==`deleted`,l=c?i.line(r.toB):r.fromB<i.lines?i.line(r.fromB+1):i.line(i.lines),u=c||r.fromB>=i.lines;return t.t.set(t.t.widget({widget:s,block:!0,side:u?1:-1}).range(u?l.to:l.from))}var Ki=t.a.fromClass(class{dom=document.createElement(`div`);view;destroyed=!1;constructor(e){this.view=e,this.dom.className=`cm-git-overview`,this.dom.setAttribute(`role`,`group`),this.dom.setAttribute(`aria-label`,`Git changes in this file`),e.dom.append(this.dom),this.rebuild()}update(e){e.startState.field(Q).hunks===e.state.field(Q).hunks?(e.geometryChanged||e.viewportChanged||e.startState.field(Q).open!==e.state.field(Q).open)&&this.measure():this.rebuild()}rebuild(){let{hunks:e}=this.view.state.field(Q);this.dom.replaceChildren(),this.dom.hidden=e.length===0;for(let[n,r]of e.entries()){let e=ki(r),i=Math.min(r.fromB+1,this.view.state.doc.lines),a=document.createElement(`button`);a.type=`button`,a.className=`cm-git-overview-mark cm-git-overview-${e}`,a.dataset.gitChange=e,a.dataset.line=String(i),a.title=`${{added:`Added`,modified:`Changed`,deleted:`Deleted`}[e]} since HEAD, line ${i}: jump to change`,a.setAttribute(`aria-label`,a.title),a.addEventListener(`mousedown`,e=>e.preventDefault()),a.addEventListener(`click`,()=>{let e=this.view.state.field(Q).hunks[n];if(!e)return;let r=this.view.state.doc.line(Math.min(e.fromB+1,this.view.state.doc.lines)).from;this.view.dispatch({selection:{anchor:r},effects:t.r.scrollIntoView(r,{y:`center`})}),this.view.focus()}),this.dom.append(a)}this.measure()}measure(){this.view.requestMeasure({key:this,read:e=>{let t=Math.max(1,e.contentHeight);return e.state.field(Q).hunks.map(n=>{let r=e.lineBlockAt(e.state.doc.line(Math.min(n.fromB+1,e.state.doc.lines)).from),i=e.lineBlockAt(e.state.doc.line(Math.min(Math.max(n.fromB+1,n.toB),e.state.doc.lines)).from),a=n.fromB>=e.state.doc.lines?i.bottom:r.top;return{top:Math.min(1,a/t),height:Math.max(0,(i.bottom-a)/t)}})},write:e=>{this.destroyed||e.forEach((e,t)=>{let n=this.dom.children[t];n&&(n.style.top=`min(${e.top*100}%, calc(100% - 3px))`,n.style.height=`max(3px, ${e.height*100}%)`)})}})}destroy(){this.destroyed=!0,this.dom.remove()}});function qi(){return[Q,Ki,t.r.theme({"&":{position:`relative`},".cm-scroller":{marginRight:`10px`},".cm-git-overview":{position:`absolute`,right:`0`,top:`0`,bottom:`0`,width:`9px`,overflow:`hidden`},".cm-git-overview[hidden]":{display:`none`},".cm-git-overview-mark":{position:`absolute`,right:`1px`,width:`7px`,minHeight:`3px`,padding:`0`,border:`0`,borderRadius:`1px`,cursor:`pointer`},".cm-git-overview-mark:focus-visible":{outline:`1px solid currentColor`,outlineOffset:`1px`}}),t.r.decorations.compute([Q],Gi),t.d({class:`cm-git-gutter`,markers:e=>Ui(e.state),lineMarkerChange:e=>e.startState.field(Q)!==e.state.field(Q)})]}var Ji=e.n({CodeEditor:()=>ea,detectIndentUnit:()=>Zi,documentPosition:()=>$}),Yi=t.P.define(),Xi=t.F.define({create:()=>t.t.none,update(e,n){for(let e of n.effects)if(e.is(Yi))return t.t.set(e.value.map(({from:e,to:n,current:r})=>t.t.mark({class:r?`find-match-current`:`find-match`}).range(e,n)),!0);return e.map(n.changes)},provide:e=>t.r.decorations.from(e)});function Zi(e){if(/^\t/m.test(e))return` `;let t=[...e.matchAll(/^( +)\S/gm)].map(e=>e[1].length).filter(e=>e>=2&&e<=8);return` `.repeat(t.length===0?2:Math.min(...t))}function $(e,t){let n=0;for(let r=e.indexOf(`\r
|
|
5
|
+
`);r!==-1&&r<t-1;r=e.indexOf(`\r
|
|
6
|
+
`,r+2))n++;return t-n}var Qi=({state:e,dispatch:t})=>e.selection.ranges.some(e=>!e.empty)?br({state:e,dispatch:t}):(t(e.update(e.replaceSelection(e.facet(n.w)),{scrollIntoView:!0,userEvent:`input`})),!0);function $i(e){return[t.p(),jt(),t.l(),t.D.allowMultipleSelections.of(!0),n.S(),Ze(),pt({activateOnTyping:!1}),t.v(),t.s(),t.f(),t.h.of([...[`Ctrl-s`,`Meta-s`].map(t=>({key:t,preventDefault:!0,run:()=>(e.current.onSave?.(),!0)})),{key:`Mod-d`,run:Kr,preventDefault:!0},...rt,...Tr,...Gt,...n.g,...mt,{key:`Tab`,run:Qi,shift:xr,preventDefault:!0}]),t.r.updateListener.of(t=>{t.docChanged&&e.current.onChange?.(t.state.sliceDoc())})]}function ea({value:e,path:a,onChange:o,onSave:s,handle:c,onReady:l,readOnly:u=!1,baseline:d=null,label:f=u?`File source`:`File editor`}){let p=(0,r.useRef)(null),m=(0,r.useRef)(null),h=(0,r.useRef)({onChange:o,onSave:s});h.current={onChange:o,onSave:s},(0,r.useImperativeHandle)(c,()=>({focus:()=>m.current?.focus(),select(e,n){let r=m.current;if(r===null)return;let i=r.state.sliceDoc(),a=r.state.doc.length,o=Math.min($(i,e),a),s=Math.min($(i,n),a);r.dispatch({selection:t.E.single(o,s),effects:t.r.scrollIntoView(o,{y:`center`})})},markMatches(e,t){let n=m.current;if(n===null)return;let r=n.state.sliceDoc(),i=n.state.doc.length,a=e.map(({start:e,end:n},a)=>({from:Math.min($(r,e),i),to:Math.min($(r,n),i),current:a===t})).filter(({from:e,to:t})=>e<t);n.dispatch({effects:Yi.of(a)})}})),(0,r.useEffect)(()=>{let r=new t.T,i=new t.r({parent:p.current,state:t.D.create({doc:e,extensions:[t.D.lineSeparator.of(e.includes(`\r
|
|
7
|
+
`)?`\r
|
|
8
|
+
`:`
|
|
9
|
+
`),n.w.of(Zi(e)),t.g(),qi(),t.m(),n.m(),t.c(),n.O(n.j),n.c(),Lr(),Xi,t.r.lineWrapping,t.r.contentAttributes.of({"aria-label":f,spellcheck:`false`}),...u?[t.D.readOnly.of(!0),t.r.editable.of(!1),t.h.of(n.g)]:$i(h),r.of([])]})});m.current=i,l?.(),d!==null&&i.dispatch({effects:Li.of(d)}),u||i.focus();let o=!0;return fi(a).then(e=>{o&&e!==null&&i.dispatch({effects:r.reconfigure(e)})},()=>{}),()=>{o=!1,i.destroy(),m.current=null}},[]),(0,r.useEffect)(()=>{let t=m.current;t!==null&&t.state.sliceDoc()!==e&&t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})},[e]);let g=(0,r.useRef)(d);return(0,r.useEffect)(()=>{let e=m.current;e!==null&&g.current!==d&&(g.current=d,e.dispatch({effects:Li.of(d)}))},[d]),(0,i.jsx)(`div`,{ref:p,className:`code-editor h-full w-full`,"data-testid":u?`file-source`:`file-editor`})}exports.CodeEditor=ea,exports.a=qe,exports.detectIndentUnit=Zi,exports.documentPosition=$,exports.i=l,exports.n=a,exports.r=c,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Ji}});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as e,
|
|
1
|
+
import { C as e, D as t, E as n, O as r, T as i, _ as a, a as o, b as s, c, k as l, n as u, v as d, w as f, x as ee, y as p } from "./conversationHistory-xEFHYA2a.js";
|
|
2
2
|
import { g as m, i as h, n as g, r as _, t as te, u as ne } from "./lib-CSMo4o20.js";
|
|
3
3
|
import { n as re } from "./download-C9gupL_X.js";
|
|
4
4
|
import { a as ie, l as ae, n as oe, o as se, s as ce, u as le } from "./mermaidToImage-CBa4nUvP.js";
|
|
@@ -485,11 +485,11 @@ var W = {
|
|
|
485
485
|
single: [["&'".split(""), "\"&'`".split("")], ["\0&'".split(""), "\0\"&'`".split("")]],
|
|
486
486
|
double: [["\"&".split(""), "\"&'`".split("")], ["\0\"&".split(""), "\0\"&'`".split("")]]
|
|
487
487
|
};
|
|
488
|
-
function Be(
|
|
489
|
-
let a = i.schema, o = a.space !== "svg" && i.settings.omitOptionalTags, s = a.space === "svg" ? i.settings.closeEmptyElements : i.settings.voids.includes(
|
|
490
|
-
a.space === "html" &&
|
|
491
|
-
let u = Ve(i,
|
|
492
|
-
return i.schema = a, d && (s = !1), (u || !o || !Pe(
|
|
488
|
+
function Be(e, t, r, i) {
|
|
489
|
+
let a = i.schema, o = a.space !== "svg" && i.settings.omitOptionalTags, s = a.space === "svg" ? i.settings.closeEmptyElements : i.settings.voids.includes(e.tagName.toLowerCase()), c = [], l;
|
|
490
|
+
a.space === "html" && e.tagName === "svg" && (i.schema = n);
|
|
491
|
+
let u = Ve(i, e.properties), d = i.all(a.space === "html" && e.tagName === "template" ? e.content : e);
|
|
492
|
+
return i.schema = a, d && (s = !1), (u || !o || !Pe(e, t, r)) && (c.push("<", e.tagName, u ? " " + u : ""), s && (a.space === "svg" || i.settings.closeSelfClosing) && (l = u.charAt(u.length - 1), (!i.settings.tightSelfClosing || l === "/" || l && l !== "\"" && l !== "'") && c.push(" "), c.push("/")), c.push(">")), c.push(d), !s && (!o || !B(e, t, r)) && c.push("</" + e.tagName + ">"), c.join("");
|
|
493
493
|
}
|
|
494
494
|
function Ve(e, t) {
|
|
495
495
|
let n = [], r = -1, i;
|
|
@@ -506,16 +506,16 @@ function Ve(e, t) {
|
|
|
506
506
|
return n.join("");
|
|
507
507
|
}
|
|
508
508
|
function He(e, n, r) {
|
|
509
|
-
let i =
|
|
509
|
+
let i = t(e.schema, n), a = e.settings.allowParseErrors && e.schema.space === "html" ? 0 : 1, o = +!e.settings.allowDangerousCharacters, s = e.quote, c;
|
|
510
510
|
if (i.overloadedBoolean && (r === i.attribute || r === "") ? r = !0 : (i.boolean || i.overloadedBoolean) && (typeof r != "string" || r === i.attribute || r === "") && (r = !!r), r == null || r === !1 || typeof r == "number" && Number.isNaN(r)) return "";
|
|
511
|
-
let
|
|
512
|
-
return r === !0 || (r = Array.isArray(r) ? (i.commaSeparated ?
|
|
511
|
+
let u = j(i.attribute, Object.assign({}, e.settings.characterReferences, { subset: W.name[a][o] }));
|
|
512
|
+
return r === !0 || (r = Array.isArray(r) ? (i.commaSeparated ? l : f)(r, { padLeft: !e.settings.tightCommaSeparatedLists }) : String(r), e.settings.collapseEmptyAttributes && !r) ? u : (e.settings.preferUnquoted && (c = j(r, Object.assign({}, e.settings.characterReferences, {
|
|
513
513
|
attribute: !0,
|
|
514
514
|
subset: W.unquoted[a][o]
|
|
515
515
|
}))), c !== r && (e.settings.quoteSmart && _(r, s) > _(r, e.alternative) && (s = e.alternative), c = s + j(r, Object.assign({}, e.settings.characterReferences, {
|
|
516
516
|
subset: (s === "'" ? W.single : W.double)[a][o],
|
|
517
517
|
attribute: !0
|
|
518
|
-
})) + s),
|
|
518
|
+
})) + s), u + (c && "=" + c));
|
|
519
519
|
}
|
|
520
520
|
//#endregion
|
|
521
521
|
//#region ../node_modules/hast-util-to-html/lib/handle/text.js
|
|
@@ -535,7 +535,7 @@ function Ge(e, t, n, r) {
|
|
|
535
535
|
}
|
|
536
536
|
//#endregion
|
|
537
537
|
//#region ../node_modules/hast-util-to-html/lib/handle/index.js
|
|
538
|
-
var Ke =
|
|
538
|
+
var Ke = s("type", {
|
|
539
539
|
invalid: qe,
|
|
540
540
|
unknown: Je,
|
|
541
541
|
handlers: {
|
|
@@ -556,38 +556,38 @@ function Je(e) {
|
|
|
556
556
|
//#endregion
|
|
557
557
|
//#region ../node_modules/hast-util-to-html/lib/index.js
|
|
558
558
|
var Ye = {}, Xe = {}, Ze = [];
|
|
559
|
-
function Qe(
|
|
560
|
-
let
|
|
559
|
+
function Qe(e, t) {
|
|
560
|
+
let r = t || Ye, a = r.quote || "\"", o = a === "\"" ? "'" : "\"";
|
|
561
561
|
if (a !== "\"" && a !== "'") throw Error("Invalid quote `" + a + "`, expected `'` or `\"`");
|
|
562
562
|
return {
|
|
563
563
|
one: $e,
|
|
564
564
|
all: et,
|
|
565
565
|
settings: {
|
|
566
|
-
omitOptionalTags:
|
|
567
|
-
allowParseErrors:
|
|
568
|
-
allowDangerousCharacters:
|
|
569
|
-
quoteSmart:
|
|
570
|
-
preferUnquoted:
|
|
571
|
-
tightAttributes:
|
|
572
|
-
upperDoctype:
|
|
573
|
-
tightDoctype:
|
|
574
|
-
bogusComments:
|
|
575
|
-
tightCommaSeparatedLists:
|
|
576
|
-
tightSelfClosing:
|
|
577
|
-
collapseEmptyAttributes:
|
|
578
|
-
allowDangerousHtml:
|
|
579
|
-
voids:
|
|
580
|
-
characterReferences:
|
|
581
|
-
closeSelfClosing:
|
|
582
|
-
closeEmptyElements:
|
|
566
|
+
omitOptionalTags: r.omitOptionalTags || !1,
|
|
567
|
+
allowParseErrors: r.allowParseErrors || !1,
|
|
568
|
+
allowDangerousCharacters: r.allowDangerousCharacters || !1,
|
|
569
|
+
quoteSmart: r.quoteSmart || !1,
|
|
570
|
+
preferUnquoted: r.preferUnquoted || !1,
|
|
571
|
+
tightAttributes: r.tightAttributes || !1,
|
|
572
|
+
upperDoctype: r.upperDoctype || !1,
|
|
573
|
+
tightDoctype: r.tightDoctype || !1,
|
|
574
|
+
bogusComments: r.bogusComments || !1,
|
|
575
|
+
tightCommaSeparatedLists: r.tightCommaSeparatedLists || !1,
|
|
576
|
+
tightSelfClosing: r.tightSelfClosing || !1,
|
|
577
|
+
collapseEmptyAttributes: r.collapseEmptyAttributes || !1,
|
|
578
|
+
allowDangerousHtml: r.allowDangerousHtml || !1,
|
|
579
|
+
voids: r.voids || p,
|
|
580
|
+
characterReferences: r.characterReferences || Xe,
|
|
581
|
+
closeSelfClosing: r.closeSelfClosing || !1,
|
|
582
|
+
closeEmptyElements: r.closeEmptyElements || !1
|
|
583
583
|
},
|
|
584
|
-
schema:
|
|
584
|
+
schema: r.space === "svg" ? n : i,
|
|
585
585
|
quote: a,
|
|
586
586
|
alternative: o
|
|
587
|
-
}.one(Array.isArray(
|
|
587
|
+
}.one(Array.isArray(e) ? {
|
|
588
588
|
type: "root",
|
|
589
|
-
children:
|
|
590
|
-
} :
|
|
589
|
+
children: e
|
|
590
|
+
} : e, void 0, void 0);
|
|
591
591
|
}
|
|
592
592
|
function $e(e, t, n) {
|
|
593
593
|
return Ke(e, t, n, this);
|
|
@@ -605,7 +605,7 @@ var tt = class extends Error {
|
|
|
605
605
|
constructor(e, t) {
|
|
606
606
|
super(`the conversation's images come to ${Math.round(e / 1024)} kB, over the ${Math.round(t / 1024)} kB this export embeds`), this.name = "ExportBudgetError", this.bytes = e, this.budgetBytes = t;
|
|
607
607
|
}
|
|
608
|
-
}, K = h().use(ne).use(g).use(te).use(
|
|
608
|
+
}, K = h().use(ne).use(g).use(te).use(e, { allowDangerousHtml: !0 }).use(d).use(a, c).use(ee, { output: "mathml" });
|
|
609
609
|
function nt(e) {
|
|
610
610
|
let t = e.properties?.className;
|
|
611
611
|
return (Array.isArray(t) ? t.map(String) : typeof t == "string" ? [t] : []).find((e) => e.startsWith("language-"))?.slice(9);
|
|
@@ -682,7 +682,7 @@ function X(e) {
|
|
|
682
682
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
683
683
|
}
|
|
684
684
|
function rt(e) {
|
|
685
|
-
return
|
|
685
|
+
return o(e).map((e) => {
|
|
686
686
|
let t = [
|
|
687
687
|
e.color ? `color:${e.color}` : "",
|
|
688
688
|
e.bold ? "font-weight:600" : "",
|
|
@@ -809,7 +809,7 @@ async function ut(e) {
|
|
|
809
809
|
if (e.olderItems > 0) {
|
|
810
810
|
if (!e.fetchOlderItems) throw new $("this conversation has been compacted and the agent runtime cannot read back what it removed, so it cannot be exported in full");
|
|
811
811
|
try {
|
|
812
|
-
t = await
|
|
812
|
+
t = await u(e.fetchOlderItems, (t) => e.onProgress?.("collecting", t, e.olderItems));
|
|
813
813
|
} catch (e) {
|
|
814
814
|
throw new $(`the earlier part of the conversation could not be read back, so nothing was exported: ${e instanceof Error ? e.message : String(e)}`);
|
|
815
815
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require("./conversationHistory-
|
|
1
|
+
const e=require("./conversationHistory-0ds9dEO5.cjs"),t=require("./lib-CRTt_FoR.cjs"),n=require("./download-CVl_k6EM.cjs"),r=require("./mermaidToImage-Gx6dNGEn.cjs"),i=require("./loadReferencedImage-N3Qidv7i.cjs");var a=/["&'<>`]/g,o=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,s=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,c=/[|\\{}()[\]^$+*?.]/g,l=new WeakMap;function u(e,t){return e=e.replace(t.subset?d(t.subset):a,r),t.subset||t.escapeOnly?e:e.replace(o,n).replace(s,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function d(e){let t=l.get(e);return t||(t=ee(e),l.set(e,t)),t}function ee(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(c,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var f=/[\dA-Fa-f]/;function p(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!f.test(String.fromCharCode(t))?r:r+`;`}var m=/\d/;function te(e,t,n){let r=`&#`+String(e);return n&&t&&!m.test(String.fromCharCode(t))?r:r+`;`}var ne=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),h={nbsp:`\xA0`,iexcl:`¡`,cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:``,reg:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,frac34:`¾`,iquest:`¿`,Agrave:`À`,Aacute:`Á`,Acirc:`Â`,Atilde:`Ã`,Auml:`Ä`,Aring:`Å`,AElig:`Æ`,Ccedil:`Ç`,Egrave:`È`,Eacute:`É`,Ecirc:`Ê`,Euml:`Ë`,Igrave:`Ì`,Iacute:`Í`,Icirc:`Î`,Iuml:`Ï`,ETH:`Ð`,Ntilde:`Ñ`,Ograve:`Ò`,Oacute:`Ó`,Ocirc:`Ô`,Otilde:`Õ`,Ouml:`Ö`,times:`×`,Oslash:`Ø`,Ugrave:`Ù`,Uacute:`Ú`,Ucirc:`Û`,Uuml:`Ü`,Yacute:`Ý`,THORN:`Þ`,szlig:`ß`,agrave:`à`,aacute:`á`,acirc:`â`,atilde:`ã`,auml:`ä`,aring:`å`,aelig:`æ`,ccedil:`ç`,egrave:`è`,eacute:`é`,ecirc:`ê`,euml:`ë`,igrave:`ì`,iacute:`í`,icirc:`î`,iuml:`ï`,eth:`ð`,ntilde:`ñ`,ograve:`ò`,oacute:`ó`,ocirc:`ô`,otilde:`õ`,ouml:`ö`,divide:`÷`,oslash:`ø`,ugrave:`ù`,uacute:`ú`,ucirc:`û`,uuml:`ü`,yacute:`ý`,thorn:`þ`,yuml:`ÿ`,fnof:`ƒ`,Alpha:`Α`,Beta:`Β`,Gamma:`Γ`,Delta:`Δ`,Epsilon:`Ε`,Zeta:`Ζ`,Eta:`Η`,Theta:`Θ`,Iota:`Ι`,Kappa:`Κ`,Lambda:`Λ`,Mu:`Μ`,Nu:`Ν`,Xi:`Ξ`,Omicron:`Ο`,Pi:`Π`,Rho:`Ρ`,Sigma:`Σ`,Tau:`Τ`,Upsilon:`Υ`,Phi:`Φ`,Chi:`Χ`,Psi:`Ψ`,Omega:`Ω`,alpha:`α`,beta:`β`,gamma:`γ`,delta:`δ`,epsilon:`ε`,zeta:`ζ`,eta:`η`,theta:`θ`,iota:`ι`,kappa:`κ`,lambda:`λ`,mu:`μ`,nu:`ν`,xi:`ξ`,omicron:`ο`,pi:`π`,rho:`ρ`,sigmaf:`ς`,sigma:`σ`,tau:`τ`,upsilon:`υ`,phi:`φ`,chi:`χ`,psi:`ψ`,omega:`ω`,thetasym:`ϑ`,upsih:`ϒ`,piv:`ϖ`,bull:`•`,hellip:`…`,prime:`′`,Prime:`″`,oline:`‾`,frasl:`⁄`,weierp:`℘`,image:`ℑ`,real:`ℜ`,trade:`™`,alefsym:`ℵ`,larr:`←`,uarr:`↑`,rarr:`→`,darr:`↓`,harr:`↔`,crarr:`↵`,lArr:`⇐`,uArr:`⇑`,rArr:`⇒`,dArr:`⇓`,hArr:`⇔`,forall:`∀`,part:`∂`,exist:`∃`,empty:`∅`,nabla:`∇`,isin:`∈`,notin:`∉`,ni:`∋`,prod:`∏`,sum:`∑`,minus:`−`,lowast:`∗`,radic:`√`,prop:`∝`,infin:`∞`,ang:`∠`,and:`∧`,or:`∨`,cap:`∩`,cup:`∪`,int:`∫`,there4:`∴`,sim:`∼`,cong:`≅`,asymp:`≈`,ne:`≠`,equiv:`≡`,le:`≤`,ge:`≥`,sub:`⊂`,sup:`⊃`,nsub:`⊄`,sube:`⊆`,supe:`⊇`,oplus:`⊕`,otimes:`⊗`,perp:`⊥`,sdot:`⋅`,lceil:`⌈`,rceil:`⌉`,lfloor:`⌊`,rfloor:`⌋`,lang:`〈`,rang:`〉`,loz:`◊`,spades:`♠`,clubs:`♣`,hearts:`♥`,diams:`♦`,quot:`"`,amp:`&`,lt:`<`,gt:`>`,OElig:`Œ`,oelig:`œ`,Scaron:`Š`,scaron:`š`,Yuml:`Ÿ`,circ:`ˆ`,tilde:`˜`,ensp:` `,emsp:` `,thinsp:` `,zwnj:``,zwj:``,lrm:``,rlm:``,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,sbquo:`‚`,ldquo:`“`,rdquo:`”`,bdquo:`„`,dagger:`†`,Dagger:`‡`,permil:`‰`,lsaquo:`‹`,rsaquo:`›`,euro:`€`},re=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],g={}.hasOwnProperty,_={},v;for(v in h)g.call(h,v)&&(_[h[v]]=v);var y=/[^\dA-Za-z]/;function b(e,t,n,r){let i=String.fromCharCode(e);if(g.call(_,i)){let e=_[i],a=`&`+e;return n&&ne.includes(e)&&!re.includes(e)&&(!r||t&&t!==61&&y.test(String.fromCharCode(t)))?a:a+`;`}return``}function ie(e,t,n){let r=p(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=b(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=te(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function x(e,t){return u(e,Object.assign({format:ie},t))}var ae=/^>|^->|<!--|-->|--!>|<!-$/g,oe=[`>`],se=[`<`,`>`];function ce(e,t,n,r){return r.settings.bogusComments?`<?`+x(e.value,Object.assign({},r.settings.characterReferences,{subset:oe}))+`>`:`<!--`+e.value.replace(ae,i)+`-->`;function i(e){return x(e,Object.assign({},r.settings.characterReferences,{subset:se}))}}function le(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}var S=w(1),C=w(-1),ue=[];function w(t){return n;function n(n,r,i){let a=n?n.children:ue,o=(r||0)+t,s=a[o];if(!i)for(;s&&e.O(s);)o+=t,s=a[o];return s}}var T={}.hasOwnProperty;function E(e){return t;function t(t,n,r){return T.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var D=E({body:A,caption:O,colgroup:O,dd:P,dt:N,head:O,html:k,li:M,optgroup:I,option:L,p:j,rp:F,rt:F,tbody:z,td:H,tfoot:B,th:H,thead:R,tr:V});function O(t,n,r){let i=S(r,n,!0);return!i||i.type!==`comment`&&!(i.type===`text`&&e.O(i.value.charAt(0)))}function k(e,t,n){let r=S(n,t);return!r||r.type!==`comment`}function A(e,t,n){let r=S(n,t);return!r||r.type!==`comment`}function j(e,t,n){let r=S(n,t);return r?r.type===`element`&&(r.tagName===`address`||r.tagName===`article`||r.tagName===`aside`||r.tagName===`blockquote`||r.tagName===`details`||r.tagName===`div`||r.tagName===`dl`||r.tagName===`fieldset`||r.tagName===`figcaption`||r.tagName===`figure`||r.tagName===`footer`||r.tagName===`form`||r.tagName===`h1`||r.tagName===`h2`||r.tagName===`h3`||r.tagName===`h4`||r.tagName===`h5`||r.tagName===`h6`||r.tagName===`header`||r.tagName===`hgroup`||r.tagName===`hr`||r.tagName===`main`||r.tagName===`menu`||r.tagName===`nav`||r.tagName===`ol`||r.tagName===`p`||r.tagName===`pre`||r.tagName===`section`||r.tagName===`table`||r.tagName===`ul`):!n||n.type!==`element`||n.tagName!==`a`&&n.tagName!==`audio`&&n.tagName!==`del`&&n.tagName!==`ins`&&n.tagName!==`map`&&n.tagName!==`noscript`&&n.tagName!==`video`}function M(e,t,n){let r=S(n,t);return!r||r.type===`element`&&r.tagName===`li`}function N(e,t,n){let r=S(n,t);return!(!r||r.type!==`element`||r.tagName!==`dt`&&r.tagName!==`dd`)}function P(e,t,n){let r=S(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function F(e,t,n){let r=S(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function I(e,t,n){let r=S(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function L(e,t,n){let r=S(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function R(e,t,n){let r=S(n,t);return!(!r||r.type!==`element`||r.tagName!==`tbody`&&r.tagName!==`tfoot`)}function z(e,t,n){let r=S(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function B(e,t,n){return!S(n,t)}function V(e,t,n){let r=S(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function H(e,t,n){let r=S(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var U=E({body:pe,colgroup:me,head:fe,html:de,tbody:he});function de(e){let t=S(e,-1);return!t||t.type!==`comment`}function fe(e){let t=new Set;for(let n of e.children)if(n.type===`element`&&(n.tagName===`base`||n.tagName===`title`)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||n.type===`element`}function pe(t){let n=S(t,-1,!0);return!n||n.type!==`comment`&&!(n.type===`text`&&e.O(n.value.charAt(0)))&&(n.type!==`element`||n.tagName!==`meta`&&n.tagName!==`link`&&n.tagName!==`script`&&n.tagName!==`style`&&n.tagName!==`template`)}function me(e,t,n){let r=C(n,t),i=S(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&D(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function he(e,t,n){let r=C(n,t),i=S(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&D(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var W={name:[[`
|
|
2
2
|
\f\r &/=>`.split(``),`
|
|
3
3
|
\f\r "&'/=>\``.split(``)],[`\0
|
|
4
4
|
\f\r "&'/<=>`.split(``),`\0
|
|
@@ -6,7 +6,7 @@ const e=require("./conversationHistory-C6PqGsO9.cjs"),t=require("./lib-CRTt_FoR.
|
|
|
6
6
|
\f\r &>`.split(``),`\0
|
|
7
7
|
\f\r "&'<=>\``.split(``)],[`\0
|
|
8
8
|
\f\r "&'<=>\``.split(``),`\0
|
|
9
|
-
\f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function ge(t,n,r,i){let a=i.schema,o=a.space!==`svg`&&i.settings.omitOptionalTags,s=a.space===`svg`?i.settings.closeEmptyElements:i.settings.voids.includes(t.tagName.toLowerCase()),c=[],l;a.space===`html`&&t.tagName===`svg`&&(i.schema=e.
|
|
9
|
+
\f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function ge(t,n,r,i){let a=i.schema,o=a.space!==`svg`&&i.settings.omitOptionalTags,s=a.space===`svg`?i.settings.closeEmptyElements:i.settings.voids.includes(t.tagName.toLowerCase()),c=[],l;a.space===`html`&&t.tagName===`svg`&&(i.schema=e.E);let u=_e(i,t.properties),d=i.all(a.space===`html`&&t.tagName===`template`?t.content:t);return i.schema=a,d&&(s=!1),(u||!o||!U(t,n,r))&&(c.push(`<`,t.tagName,u?` `+u:``),s&&(a.space===`svg`||i.settings.closeSelfClosing)&&(l=u.charAt(u.length-1),(!i.settings.tightSelfClosing||l===`/`||l&&l!==`"`&&l!==`'`)&&c.push(` `),c.push(`/`)),c.push(`>`)),c.push(d),!s&&(!o||!D(t,n,r))&&c.push(`</`+t.tagName+`>`),c.join(``)}function _e(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=ve(e,i,t[i]);r&&n.push(r)}}for(;++r<n.length;){let t=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&t!==`"`&&t!==`'`&&(n[r]+=` `)}return n.join(``)}function ve(n,r,i){let a=e.D(n.schema,r),o=n.settings.allowParseErrors&&n.schema.space===`html`?0:1,s=+!n.settings.allowDangerousCharacters,c=n.quote,l;if(a.overloadedBoolean&&(i===a.attribute||i===``)?i=!0:(a.boolean||a.overloadedBoolean)&&(typeof i!=`string`||i===a.attribute||i===``)&&(i=!!i),i==null||i===!1||typeof i==`number`&&Number.isNaN(i))return``;let u=x(a.attribute,Object.assign({},n.settings.characterReferences,{subset:W.name[o][s]}));return i===!0||(i=Array.isArray(i)?(a.commaSeparated?e.k:e.w)(i,{padLeft:!n.settings.tightCommaSeparatedLists}):String(i),n.settings.collapseEmptyAttributes&&!i)?u:(n.settings.preferUnquoted&&(l=x(i,Object.assign({},n.settings.characterReferences,{attribute:!0,subset:W.unquoted[o][s]}))),l!==i&&(n.settings.quoteSmart&&t.r(i,c)>t.r(i,n.alternative)&&(c=n.alternative),l=c+x(i,Object.assign({},n.settings.characterReferences,{subset:(c===`'`?W.single:W.double)[o][s],attribute:!0}))+c),u+(l&&`=`+l))}var ye=[`<`,`&`];function G(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:x(e.value,Object.assign({},r.settings.characterReferences,{subset:ye}))}function be(e,t,n,r){return r.settings.allowDangerousHtml?e.value:G(e,t,n,r)}function xe(e,t,n,r){return r.all(e)}var Se=e.b(`type`,{invalid:Ce,unknown:we,handlers:{comment:ce,doctype:le,element:ge,raw:be,root:xe,text:G}});function Ce(e){throw Error("Expected node, not `"+e+"`")}function we(e){throw Error("Cannot compile unknown node `"+e.type+"`")}var Te={},Ee={},De=[];function Oe(t,n){let r=n||Te,i=r.quote||`"`,a=i===`"`?`'`:`"`;if(i!==`"`&&i!==`'`)throw Error("Invalid quote `"+i+"`, expected `'` or `\"`");return{one:ke,all:Ae,settings:{omitOptionalTags:r.omitOptionalTags||!1,allowParseErrors:r.allowParseErrors||!1,allowDangerousCharacters:r.allowDangerousCharacters||!1,quoteSmart:r.quoteSmart||!1,preferUnquoted:r.preferUnquoted||!1,tightAttributes:r.tightAttributes||!1,upperDoctype:r.upperDoctype||!1,tightDoctype:r.tightDoctype||!1,bogusComments:r.bogusComments||!1,tightCommaSeparatedLists:r.tightCommaSeparatedLists||!1,tightSelfClosing:r.tightSelfClosing||!1,collapseEmptyAttributes:r.collapseEmptyAttributes||!1,allowDangerousHtml:r.allowDangerousHtml||!1,voids:r.voids||e.y,characterReferences:r.characterReferences||Ee,closeSelfClosing:r.closeSelfClosing||!1,closeEmptyElements:r.closeEmptyElements||!1},schema:r.space===`svg`?e.E:e.T,quote:i,alternative:a}.one(Array.isArray(t)?{type:`root`,children:t}:t,void 0,void 0)}function ke(e,t,n){return Se(e,t,n,this)}function Ae(e){let t=[],n=e&&e.children||De,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join(``)}var je=class extends Error{bytes;budgetBytes;constructor(e,t){super(`the conversation's images come to ${Math.round(e/1024)} kB, over the ${Math.round(t/1024)} kB this export embeds`),this.name=`ExportBudgetError`,this.bytes=e,this.budgetBytes=t}},K=t.i().use(t.u).use(t.n).use(t.t).use(e.C,{allowDangerousHtml:!0}).use(e.v).use(e._,e.c).use(e.x,{output:`mathml`});function Me(e){let t=e.properties?.className;return(Array.isArray(t)?t.map(String):typeof t==`string`?[t]:[]).find(e=>e.startsWith(`language-`))?.slice(9)}async function q(e,t,n){if(e.tagName===`img`){let i=typeof e.properties?.src==`string`?e.properties.src:``;if(r.u(i)){let t=typeof e.properties?.alt==`string`?e.properties.alt:``;return{type:`element`,tagName:`a`,properties:{href:i},children:[{type:`text`,value:r.l(i,t)}]}}let a=i?await t.loadImage(i):void 0;if(!a)return{type:`element`,tagName:`em`,properties:{},children:[{type:`text`,value:`[image: ${typeof e.properties?.alt==`string`?e.properties.alt:i}]`}]};n.bytes+=a.bytes;let o=t.budgetBytes??41943040;if(n.bytes>o)throw new je(n.bytes,o);return{...e,properties:{...e.properties,src:a.dataUrl,loading:`lazy`}}}if(e.tagName===`pre`&&e.children?.length===1&&e.children[0].tagName===`code`){let r=e.children[0];if(Me(r)===`mermaid`&&t.renderDiagram){let e=J(r);n.diagrams+=1;let i=await t.renderDiagram(e,`pi-export-diagram-${n.diagrams}`);if(i)return{type:`element`,tagName:`figure`,properties:{className:[`diagram`]},children:[{type:`raw`,value:i}]}}}if(!e.children)return e;let i=[];for(let r of e.children)i.push(await q(r,t,n));return{...e,children:i}}function J(e){return e.type===`text`?e.value??``:(e.children??[]).map(J).join(``)}async function Y(e,n,r){return Oe(await q(await K.run(K.parse(t.g(e))),n,r),{allowDangerousHtml:!0})}function X(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function Ne(t){return e.a(t).map(e=>{let t=[e.color?`color:${e.color}`:``,e.bold?`font-weight:600`:``,e.dim?`opacity:0.7`:``,e.italic?`font-style:italic`:``,e.underline?`text-decoration:underline`:``].filter(Boolean).join(`;`),n=X(e.text);return t?`<span style="${X(t)}">${n}</span>`:n}).join(``)}var Pe=`:root {
|
|
10
10
|
--bg: #ffffff; --fg: #18181b; --muted: #71717a; --line: #e4e4e7;
|
|
11
11
|
--user-bg: #eff6ff; --tool-bg: #fafafa; --mark-bg: #fffbeb; --mark-fg: #92400e;
|
|
12
12
|
}
|