(self.rspackChunk_JUPYTERLAB_CORE_OUTPUT=self.rspackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[8829],{39100(e){self,e.exports=(()=>{"use strict";var e={6:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkComputer=t.WebLinkProvider=void 0,t.WebLinkProvider=class{constructor(e,t,r,i={}){this._terminal=e,this._regex=t,this._handler=r,this._options=i}provideLinks(e,t){let i=r.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(i))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,r)=>{if(this._options.hover){let{range:i}=e;this._options.hover(t,r,i)}},e))}};class r{static computeLink(e,t,i,n){let s,o=RegExp(t.source,(t.flags||"")+"g"),[l,a]=r._getWindowedLineStrings(e-1,i),d=l.join(""),h=[];for(;s=o.exec(d);){let e=s[0];if(!function(e){try{let t=new URL(e),r=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(r.toLocaleLowerCase())}catch(e){return!1}}(e))continue;let[t,o]=r._mapStrIdx(i,a,0,s.index),[l,d]=r._mapStrIdx(i,t,o,e.length);if(-1===t||-1===o||-1===l||-1===d)continue;let p={start:{x:o+1,y:t+1},end:{x:d,y:l+1}};h.push({range:p,text:e,activate:n})}return h}static _getWindowedLineStrings(e,t){let r,i=e,n=e,s=0,o="",l=[];if(r=t.buffer.active.getLine(e)){let e=r.translateToString(!0);if(r.isWrapped&&" "!==e[0]){for(s=0;(r=t.buffer.active.getLine(--i))&&s<2048&&(s+=(o=r.translateToString(!0)).length,l.push(o),r.isWrapped&&-1===o.indexOf(" ")););l.reverse()}for(l.push(e),s=0;(r=t.buffer.active.getLine(++n))&&r.isWrapped&&s<2048&&(s+=(o=r.translateToString(!0)).length,l.push(o),-1===o.indexOf(" ")););}return[l,i]}static _mapStrIdx(e,t,r,i){let n=e.buffer.active,s=n.getNullCell(),o=r;for(;i;){let e=n.getLine(t);if(!e)return[-1,-1];for(let r=o;r<e.length;++r){e.getCell(r,s);let o=s.getChars();if(s.getWidth()&&(i-=o.length||1,r===e.length-1&&""===o)){let e=n.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,s),2===s.getWidth()&&(i+=1))}if(i<0)return[t,r]}t++,o=0}return[t,o]}}t.LinkComputer=r}},t={},r={};return(()=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WebLinksAddon=void 0;let i=function r(i){var n=t[i];if(void 0!==n)return n.exports;var s=t[i]={exports:{}};return e[i](s,s.exports,r),s.exports}(6),n=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function s(e,t){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}r.WebLinksAddon=class{constructor(e=s,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,r=t.urlRegex||n;this._linkProvider=this._terminal.registerLinkProvider(new i.WebLinkProvider(this._terminal,r,this._handler,t))}dispose(){this._linkProvider?.dispose()}}})(),r})()}}]);