@minimalcorp/tsunagi 0.1.19 → 0.1.21

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.
Files changed (57) hide show
  1. package/.next/standalone/apps/web/.next/BUILD_ID +1 -1
  2. package/.next/standalone/apps/web/.next/build-manifest.json +3 -3
  3. package/.next/standalone/apps/web/.next/prerender-manifest.json +3 -3
  4. package/.next/standalone/apps/web/.next/server/app/_global-error.html +1 -1
  5. package/.next/standalone/apps/web/.next/server/app/_global-error.rsc +1 -1
  6. package/.next/standalone/apps/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  7. package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  8. package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  9. package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  10. package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  11. package/.next/standalone/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  12. package/.next/standalone/apps/web/.next/server/app/_not-found.html +1 -1
  13. package/.next/standalone/apps/web/.next/server/app/_not-found.rsc +2 -2
  14. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  15. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  16. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  17. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  18. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  19. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  20. package/.next/standalone/apps/web/.next/server/app/index.html +1 -1
  21. package/.next/standalone/apps/web/.next/server/app/index.rsc +3 -3
  22. package/.next/standalone/apps/web/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  23. package/.next/standalone/apps/web/.next/server/app/index.segments/_full.segment.rsc +3 -3
  24. package/.next/standalone/apps/web/.next/server/app/index.segments/_head.segment.rsc +1 -1
  25. package/.next/standalone/apps/web/.next/server/app/index.segments/_index.segment.rsc +2 -2
  26. package/.next/standalone/apps/web/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  27. package/.next/standalone/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
  28. package/.next/standalone/apps/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  29. package/.next/standalone/apps/web/.next/server/app/settings.html +1 -1
  30. package/.next/standalone/apps/web/.next/server/app/settings.rsc +2 -2
  31. package/.next/standalone/apps/web/.next/server/app/settings.segments/_full.segment.rsc +2 -2
  32. package/.next/standalone/apps/web/.next/server/app/settings.segments/_head.segment.rsc +1 -1
  33. package/.next/standalone/apps/web/.next/server/app/settings.segments/_index.segment.rsc +2 -2
  34. package/.next/standalone/apps/web/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
  35. package/.next/standalone/apps/web/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +1 -1
  36. package/.next/standalone/apps/web/.next/server/app/settings.segments/settings.segment.rsc +1 -1
  37. package/.next/standalone/apps/web/.next/server/app/tasks/[id]/page_client-reference-manifest.js +1 -1
  38. package/.next/standalone/apps/web/.next/server/chunks/ssr/[root-of-the-server]__05isylw._.js +2 -2
  39. package/.next/standalone/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0ro8-ey._.js +2 -2
  40. package/.next/standalone/apps/web/.next/server/chunks/ssr/apps_web_src_app_tasks_[id]_page_tsx_0jshsm2._.js +1 -1
  41. package/.next/standalone/apps/web/.next/server/middleware-build-manifest.js +3 -3
  42. package/.next/standalone/apps/web/.next/server/pages/404.html +1 -1
  43. package/.next/standalone/apps/web/.next/server/pages/500.html +1 -1
  44. package/.next/standalone/apps/web/.next/server/server-reference-manifest.js +1 -1
  45. package/.next/standalone/apps/web/.next/server/server-reference-manifest.json +1 -1
  46. package/.next/standalone/apps/web/.next/static/chunks/{0e9ktynfbcnuu.js → 0dqrg945xihvq.js} +2 -2
  47. package/.next/standalone/apps/web/.next/static/chunks/0eh4r4805-t.c.js +3 -0
  48. package/.next/standalone/apps/web/.next/static/chunks/{1170mb1fc0c_1.css → 147e715pxo.p..css} +1 -1
  49. package/.next/standalone/apps/web/.next/static/chunks/{1145l.gbs9mp0.js → 16ud~dw7vj3ay.js} +2 -2
  50. package/dist/server/index.js +8 -5
  51. package/dist/server/routes/internal.js +14 -0
  52. package/npm-shrinkwrap.json +84 -36
  53. package/package.json +1 -1
  54. package/.next/standalone/apps/web/.next/static/chunks/09ik3f_4bui.6.js +0 -3
  55. /package/.next/standalone/apps/web/.next/static/{UZBFC2azFDGUO9l2ed0nq → qdfRw8pC3EF2mv12yUFzd}/_buildManifest.js +0 -0
  56. /package/.next/standalone/apps/web/.next/static/{UZBFC2azFDGUO9l2ed0nq → qdfRw8pC3EF2mv12yUFzd}/_clientMiddlewareManifest.js +0 -0
  57. /package/.next/standalone/apps/web/.next/static/{UZBFC2azFDGUO9l2ed0nq → qdfRw8pC3EF2mv12yUFzd}/_ssgManifest.js +0 -0
@@ -29,7 +29,7 @@ WARNING: This link could potentially be dangerous`)){let b=window.open();if(b){t
29
29
  `))),this._register(this._terminal.onA11yTab(a=>this._handleTab(a))),this._register(this._terminal.onKey(a=>this._handleKey(a.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(bZ(e,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(az(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(a){for(let b=0;b<a;b++)this._handleChar(" ")}_handleChar(a){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==a&&(this._charsToAnnounce+=a):this._charsToAnnounce+=a,a===`
30
30
  `&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent+=I)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(a){this._clearLiveRegion(),/\p{Control}/u.test(a)||this._charsToConsume.push(a)}_refreshRows(a,b){this._liveRegionDebouncer.refresh(a,b,this._terminal.rows)}_renderRows(a,b){let c=this._terminal.buffer,d=c.lines.length.toString();for(let e=a;e<=b;e++){let a=c.lines.get(c.ydisp+e),b=[],f=a?.translateToString(!0,void 0,void 0,b)||"",g=(c.ydisp+e+1).toString(),h=this._rowElements[e];h&&(0===f.length?(h.textContent=" ",this._rowColumns.set(h,[0,1])):(h.textContent=f,this._rowColumns.set(h,b)),h.setAttribute("aria-posinset",g),h.setAttribute("aria-setsize",d),this._alignRowWidth(h))}this._announceCharacters()}_announceCharacters(){0!==this._charsToAnnounce.length&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(a,b){let c,d,e=a.target,f=this._rowElements[0===b?1:this._rowElements.length-2];if(e.getAttribute("aria-posinset")!==(0===b?"1":`${this._terminal.buffer.lines.length}`)&&a.relatedTarget===f){if(0===b?(c=e,d=this._rowElements.pop(),this._rowContainer.removeChild(d)):(c=this._rowElements.shift(),d=e,this._rowContainer.removeChild(c)),c.removeEventListener("focus",this._topBoundaryFocusListener),d.removeEventListener("focus",this._bottomBoundaryFocusListener),0===b){let a=this._createAccessibilityTreeNode();this._rowElements.unshift(a),this._rowContainer.insertAdjacentElement("afterbegin",a)}else{let a=this._createAccessibilityTreeNode();this._rowElements.push(a),this._rowContainer.appendChild(a)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(0===b?-1:1),this._rowElements[0===b?1:this._rowElements.length-2].focus(),a.preventDefault(),a.stopImmediatePropagation()}}_handleSelectionChange(){if(0===this._rowElements.length)return;let a=this._coreBrowserService.mainDocument.getSelection();if(!a)return;if(a.isCollapsed){this._rowContainer.contains(a.anchorNode)&&this._terminal.clearSelection();return}if(!a.anchorNode||!a.focusNode)return void console.error("anchorNode and/or focusNode are null");let b={node:a.anchorNode,offset:a.anchorOffset},c={node:a.focusNode,offset:a.focusOffset};if((b.node.compareDocumentPosition(c.node)&Node.DOCUMENT_POSITION_PRECEDING||b.node===c.node&&b.offset>c.offset)&&([b,c]=[c,b]),b.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(b={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(b.node))return;let d=this._rowElements.slice(-1)[0];if(c.node.compareDocumentPosition(d)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(c={node:d,offset:d.textContent?.length??0}),!this._rowContainer.contains(c.node))return;let e=({node:a,offset:b})=>{let c=a instanceof Text?a.parentNode:a,d=parseInt(c?.getAttribute("aria-posinset"),10)-1;if(isNaN(d))return console.warn("row is invalid. Race condition?"),null;let e=this._rowColumns.get(c);if(!e)return console.warn("columns is null. Race condition?"),null;let f=b<e.length?e[b]:e.slice(-1)[0]+1;return f>=this._terminal.cols&&(++d,f=0),{row:d,column:f}},f=e(b),g=e(c);if(!(!f||!g)){if(f.row>g.row||f.row===g.row&&f.column>=g.column)throw Error("invalid range");this._terminal.select(f.column,f.row,(g.row-f.row)*this._terminal.cols-f.column+g.column)}}_handleResize(a){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let a=this._rowContainer.children.length;a<this._terminal.rows;a++)this._rowElements[a]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[a]);for(;this._rowElements.length>a;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let a=this._coreBrowserService.mainDocument.createElement("div");return a.setAttribute("role","listitem"),a.tabIndex=-1,this._refreshRowDimensions(a),a}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let a=0;a<this._terminal.rows;a++)this._refreshRowDimensions(this._rowElements[a]),this._alignRowWidth(this._rowElements[a])}}_refreshRowDimensions(a){a.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(a){a.style.transform="";let b=a.getBoundingClientRect().width,c=this._rowColumns.get(a)?.slice(-1)?.[0];if(!c)return;let d=c*this._renderService.dimensions.css.cell.width;a.style.transform=`scaleX(${d/b})`}};e2=F([G(1,_),G(2,ah),G(3,aj)],e2);var e3=class extends aC{constructor(a,b,c,d,e){super(),this._element=a,this._mouseService=b,this._renderService=c,this._bufferService=d,this._linkProviderService=e,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new aV),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new aV),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(az(()=>{ay(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(bZ(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(bZ(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(bZ(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(bZ(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(a){this._lastMouseEvent=a;let b=this._positionFromMouseEvent(a,this._element,this._mouseService);if(!b)return;this._isMouseOut=!1;let c=a.composedPath();for(let a=0;a<c.length;a++){let b=c[a];if(b.classList.contains("xterm"))break;if(b.classList.contains("xterm-hover"))return}this._lastBufferCell&&b.x===this._lastBufferCell.x&&b.y===this._lastBufferCell.y||(this._handleHover(b),this._lastBufferCell=b)}_handleHover(a){if(this._activeLine!==a.y||this._wasResized){this._clearCurrentLink(),this._askForLink(a,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,a)||(this._clearCurrentLink(),this._askForLink(a,!0))}_askForLink(a,b){this._activeProviderReplies&&b||(this._activeProviderReplies?.forEach(a=>{a?.forEach(a=>{a.link.dispose&&a.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=a.y);let c=!1;for(let[d,e]of this._linkProviderService.linkProviders.entries())b?this._activeProviderReplies?.get(d)&&(c=this._checkLinkProviderResult(d,a,c)):e.provideLinks(a.y,b=>{if(this._isMouseOut)return;let e=b?.map(a=>({link:a}));this._activeProviderReplies?.set(d,e),c=this._checkLinkProviderResult(d,a,c),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(a.y,this._activeProviderReplies)})}_removeIntersectingLinks(a,b){let c=new Set;for(let d=0;d<b.size;d++){let e=b.get(d);if(e)for(let b=0;b<e.length;b++){let d=e[b],f=d.link.range.start.y<a?0:d.link.range.start.x,g=d.link.range.end.y>a?this._bufferService.cols:d.link.range.end.x;for(let a=f;a<=g;a++){if(c.has(a)){e.splice(b--,1);break}c.add(a)}}}}_checkLinkProviderResult(a,b,c){if(!this._activeProviderReplies)return c;let d=this._activeProviderReplies.get(a),e=!1;for(let b=0;b<a;b++)(!this._activeProviderReplies.has(b)||this._activeProviderReplies.get(b))&&(e=!0);if(!e&&d){let a=d.find(a=>this._linkAtPosition(a.link,b));a&&(c=!0,this._handleNewLink(a))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!c)for(let a=0;a<this._activeProviderReplies.size;a++){let d=this._activeProviderReplies.get(a)?.find(a=>this._linkAtPosition(a.link,b));if(d){c=!0,this._handleNewLink(d);break}}return c}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(a){var b,c;if(!this._currentLink)return;let d=this._positionFromMouseEvent(a,this._element,this._mouseService);d&&this._mouseDownLink&&(b=this._mouseDownLink.link,c=this._currentLink.link,b.text===c.text&&b.range.start.x===c.range.start.x&&b.range.start.y===c.range.start.y&&b.range.end.x===c.range.end.x&&b.range.end.y===c.range.end.y)&&this._linkAtPosition(this._currentLink.link,d)&&this._currentLink.link.activate(a,this._currentLink.link.text)}_clearCurrentLink(a,b){this._currentLink&&this._lastMouseEvent&&(!a||!b||this._currentLink.link.range.start.y>=a&&this._currentLink.link.range.end.y<=b)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,ay(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(a){if(!this._lastMouseEvent)return;let b=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);b&&this._linkAtPosition(a.link,b)&&(this._currentLink=a,this._currentLink.state={decorations:{underline:void 0===a.link.decorations||a.link.decorations.underline,pointerCursor:void 0===a.link.decorations||a.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,a.link,this._lastMouseEvent),a.link.decorations={},Object.defineProperties(a.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:a=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==a&&(this._currentLink.state.decorations.pointerCursor=a,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",a))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:b=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==b&&(this._currentLink.state.decorations.underline=b,this._currentLink.state.isHovered&&this._fireUnderlineEvent(a.link,b))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(a=>{if(!this._currentLink)return;let b=0===a.start?0:a.start+1+this._bufferService.buffer.ydisp,c=this._bufferService.buffer.ydisp+1+a.end;if(this._currentLink.link.range.start.y>=b&&this._currentLink.link.range.end.y<=c&&(this._clearCurrentLink(b,c),this._lastMouseEvent)){let a=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);a&&this._askForLink(a,!1)}})))}_linkHover(a,b,c){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(b,!0),this._currentLink.state.decorations.pointerCursor&&a.classList.add("xterm-cursor-pointer")),b.hover&&b.hover(c,b.text)}_fireUnderlineEvent(a,b){let c=a.range,d=this._bufferService.buffer.ydisp,e=this._createLinkUnderlineEvent(c.start.x-1,c.start.y-d-1,c.end.x,c.end.y-d-1,void 0);(b?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(e)}_linkLeave(a,b,c){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(b,!1),this._currentLink.state.decorations.pointerCursor&&a.classList.remove("xterm-cursor-pointer")),b.leave&&b.leave(c,b.text)}_linkAtPosition(a,b){let c=a.range.start.y*this._bufferService.cols+a.range.start.x,d=a.range.end.y*this._bufferService.cols+a.range.end.x,e=b.y*this._bufferService.cols+b.x;return c<=e&&e<=d}_positionFromMouseEvent(a,b,c){let d=c.getCoords(a,b,this._bufferService.cols,this._bufferService.rows);if(d)return{x:d[0],y:d[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(a,b,c,d,e){return{x1:a,y1:b,x2:c,y2:d,cols:this._bufferService.cols,fg:e}}};e3=F([G(1,ai),G(2,aj),G(3,X),G(4,an)],e3);var e4=class extends eV{constructor(a={}){super(a),this._linkifier=this._register(new aD),this.browser=dg,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new aD),this._onCursorMove=this._register(new aV),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new aV),this.onKey=this._onKey.event,this._onRender=this._register(new aV),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new aV),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new aV),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new aV),this.onBell=this._onBell.event,this._onFocus=this._register(new aV),this._onBlur=this._register(new aV),this._onA11yCharEmitter=this._register(new aV),this._onA11yTabEmitter=this._register(new aV),this._onWillOpen=this._register(new aV),this._setup(),this._decorationService=this._instantiationService.createInstance(e_),this._instantiationService.setService(ae,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(dc),this._instantiationService.setService(an,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(af)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(a=>this.refresh(a?.start??0,a?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(a=>this._reportWindowsOptions(a))),this._register(this._inputHandler.onColor(a=>this._handleColorEvent(a))),this._register(aO.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(aO.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(aO.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(aO.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(a=>this._afterResize(a.cols,a.rows))),this._register(az(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(a){if(this._themeService)for(let b of a){let a,c="";switch(b.index){case 256:a="foreground",c="10";break;case 257:a="background",c="11";break;case 258:a="cursor",c="12";break;default:a="ansi",c="4;"+b.index}switch(b.type){case 0:let d=em.toColorRGB("ansi"===a?this._themeService.colors.ansi[b.index]:this._themeService.colors[a]);this.coreService.triggerDataEvent(`${cB.ESC}]${c};${function(a,b=16){let[c,d,e]=a;return`rgb:${eL(c,b)}/${eL(d,b)}/${eL(e,b)}`}(d)}${cD.ST}`);break;case 1:if("ansi"===a)this._themeService.modifyColors(a=>a.ansi[b.index]=cE.toColor(...b.color));else{let c=a;this._themeService.modifyColors(a=>a[c]=cE.toColor(...b.color))}break;case 2:this._themeService.restoreColor(b.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(a){a?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(e2,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(a){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(cB.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(cB.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let a=this.buffer.ybase+this.buffer.y,b=this.buffer.lines.get(a);if(!b)return;let c=Math.min(this.buffer.x,this.cols-1),d=this._renderService.dimensions.css.cell.height,e=b.getWidth(c),f=this._renderService.dimensions.css.cell.width*e,g=this.buffer.y*this._renderService.dimensions.css.cell.height,h=c*this._renderService.dimensions.css.cell.width;this.textarea.style.left=h+"px",this.textarea.style.top=g+"px",this.textarea.style.width=f+"px",this.textarea.style.height=d+"px",this.textarea.style.lineHeight=d+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(bZ(this.element,"copy",a=>{var b;this.hasSelection()&&(b=this._selectionService,a.clipboardData&&a.clipboardData.setData("text/plain",b.selectionText),a.preventDefault())}));let a=a=>{var b,c,d;return b=this.textarea,c=this.coreService,d=this.optionsService,void(a.stopPropagation(),a.clipboardData&&J(a.clipboardData.getData("text/plain"),b,c,d))};this._register(bZ(this.textarea,"paste",a)),this._register(bZ(this.element,"paste",a)),dm?this._register(bZ(this.element,"mousedown",a=>{2===a.button&&L(a,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(bZ(this.element,"contextmenu",a=>{L(a,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),dv&&this._register(bZ(this.element,"auxclick",a=>{1===a.button&&K(a,this.textarea,this.screenElement)}))}_bindKeys(){this._register(bZ(this.textarea,"keyup",a=>this._keyUp(a),!0)),this._register(bZ(this.textarea,"keydown",a=>this._keyDown(a),!0)),this._register(bZ(this.textarea,"keypress",a=>this._keyPress(a),!0)),this._register(bZ(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(bZ(this.textarea,"compositionupdate",a=>this._compositionHelper.compositionupdate(a))),this._register(bZ(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(bZ(this.textarea,"input",a=>this._inputEvent(a),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(a){if(!a)throw Error("Terminal requires a parent element.");if(a.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=a.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),a.appendChild(this.element);let b=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),b.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(bZ(this.screenElement,"mousemove",a=>this.updateCursorStyle(a))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),b.appendChild(this.screenElement);let c=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",H),dw||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>c.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(da,this.textarea,a.ownerDocument.defaultView??window,this._document?window.document:null)),this._instantiationService.setService(ah,this._coreBrowserService),this._register(bZ(this.textarea,"focus",a=>this._handleTextAreaFocus(a))),this._register(bZ(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(c6,this._document,this._helperContainer),this._instantiationService.setService(ag,this._charSizeService),this._themeService=this._instantiationService.createInstance(dU),this._instantiationService.setService(am,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(cU),this._instantiationService.setService(al,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(dC,this.rows,this.screenElement)),this._instantiationService.setService(aj,this._renderService),this._register(this._renderService.onRenderedViewportChange(a=>this._onRender.fire(a))),this.onResize(a=>this._renderService.resize(a.cols,a.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(cv,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(de),this._instantiationService.setService(ai,this._mouseService);let d=this._linkifier.value=this._register(this._instantiationService.createInstance(e3,this.screenElement));this.element.appendChild(b);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(co,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(a=>{super.scrollLines(a,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(dM,this.element,this.screenElement,d)),this._instantiationService.setService(ak,this._selectionService),this._register(this._selectionService.onRequestScrollLines(a=>this.scrollLines(a.amount,a.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(a=>this._renderService.handleSelectionChanged(a.start,a.end,a.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(a=>{this.textarea.value=a,this.textarea.focus(),this.textarea.select()})),this._register(aO.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(cp,this.screenElement)),this._register(bZ(this.element,"mousedown",a=>this._selectionService.handleMouseDown(a))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(e2,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",a=>this._handleScreenReaderModeOptionChange(a))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(cu,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",a=>{!this._overviewRulerRenderer&&a&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(cu,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(c5,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let a=this,b=this.element;function c(b){let c,d,e=a._mouseService.getMouseReportCoords(b,a.screenElement);if(!e)return!1;switch(b.overrideType||b.type){case"mousemove":d=32,void 0===b.buttons?(c=3,void 0!==b.button&&(c=b.button<3?b.button:3)):c=1&b.buttons?0:4&b.buttons?1:2&b.buttons?2:3;break;case"mouseup":d=0,c=b.button<3?b.button:3;break;case"mousedown":d=1,c=b.button<3?b.button:3;break;case"wheel":if(a._customWheelEventHandler&&!1===a._customWheelEventHandler(b))return!1;let f=b.deltaY;if(0===f||0===a.coreMouseService.consumeWheelEvent(b,a._renderService?.dimensions?.device?.cell?.height,a._coreBrowserService?.dpr))return!1;d=f<0?0:1,c=4;break;default:return!1}return void 0!==d&&void 0!==c&&!(c>4)&&a.coreMouseService.triggerMouseEvent({col:e.col,row:e.row,x:e.x,y:e.y,button:c,action:d,ctrl:b.ctrlKey,alt:b.altKey,shift:b.shiftKey})}let d={mouseup:null,wheel:null,mousedrag:null,mousemove:null},e=a=>(c(a),a.buttons||(this._document.removeEventListener("mouseup",d.mouseup),d.mousedrag&&this._document.removeEventListener("mousemove",d.mousedrag)),this.cancel(a)),f=a=>(c(a),this.cancel(a,!0)),g=a=>{a.buttons&&c(a)},h=a=>{a.buttons||c(a)};this._register(this.coreMouseService.onProtocolChange(a=>{a?("debug"===this.optionsService.rawOptions.logLevel&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(a)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&a?d.mousemove||(b.addEventListener("mousemove",h),d.mousemove=h):(b.removeEventListener("mousemove",d.mousemove),d.mousemove=null),16&a?d.wheel||(b.addEventListener("wheel",f,{passive:!1}),d.wheel=f):(b.removeEventListener("wheel",d.wheel),d.wheel=null),2&a?d.mouseup||(d.mouseup=e):(this._document.removeEventListener("mouseup",d.mouseup),d.mouseup=null),4&a?d.mousedrag||(d.mousedrag=g):(this._document.removeEventListener("mousemove",d.mousedrag),d.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(bZ(b,"mousedown",a=>{if(a.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(a)))return c(a),d.mouseup&&this._document.addEventListener("mouseup",d.mouseup),d.mousedrag&&this._document.addEventListener("mousemove",d.mousedrag),this.cancel(a)})),this._register(bZ(b,"wheel",b=>{if(!d.wheel){if(this._customWheelEventHandler&&!1===this._customWheelEventHandler(b))return!1;if(!this.buffer.hasScrollback){if(0===b.deltaY)return!1;if(0===a.coreMouseService.consumeWheelEvent(b,a._renderService?.dimensions?.device?.cell?.height,a._coreBrowserService?.dpr))return this.cancel(b,!0);let c=cB.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(b.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(c,!0),this.cancel(b,!0)}}},{passive:!1}))}refresh(a,b){this._renderService?.refreshRows(a,b)}updateCursorStyle(a){this._selectionService?.shouldColumnSelect(a)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(a,b){this._viewport?this._viewport.scrollLines(a):super.scrollLines(a,b),this.refresh(0,this.rows-1)}scrollPages(a){this.scrollLines(a*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(a){a&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(a){let b=a-this._bufferService.buffer.ydisp;0!==b&&this.scrollLines(b)}paste(a){J(a,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(a){this._customKeyEventHandler=a}attachCustomWheelEventHandler(a){this._customWheelEventHandler=a}registerLinkProvider(a){return this._linkProviderService.registerLinkProvider(a)}registerCharacterJoiner(a){if(!this._characterJoinerService)throw Error("Terminal must be opened first");let b=this._characterJoinerService.register(a);return this.refresh(0,this.rows-1),b}deregisterCharacterJoiner(a){if(!this._characterJoinerService)throw Error("Terminal must be opened first");this._characterJoinerService.deregister(a)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(a){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+a)}registerDecoration(a){return this._decorationService.registerDecoration(a)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(a,b,c){this._selectionService.setSelection(a,b,c)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(a,b){this._selectionService?.selectLines(a,b)}_keyDown(a){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(a))return!1;let b=this.browser.isMac&&this.options.macOptionIsMeta&&a.altKey;if(!b&&!this._compositionHelper.keydown(a))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;b||"Dead"!==a.key&&"AltGraph"!==a.key||(this._unprocessedDeadKey=!0);let c=function(a,b,c,d){let e={type:0,cancel:!1,key:void 0},f=!!a.shiftKey|2*!!a.altKey|4*!!a.ctrlKey|8*!!a.metaKey;switch(a.keyCode){case 0:"UIKeyInputUpArrow"===a.key?b?e.key=cB.ESC+"OA":e.key=cB.ESC+"[A":"UIKeyInputLeftArrow"===a.key?b?e.key=cB.ESC+"OD":e.key=cB.ESC+"[D":"UIKeyInputRightArrow"===a.key?b?e.key=cB.ESC+"OC":e.key=cB.ESC+"[C":"UIKeyInputDownArrow"===a.key&&(b?e.key=cB.ESC+"OB":e.key=cB.ESC+"[B");break;case 8:e.key=a.ctrlKey?"\b":cB.DEL,a.altKey&&(e.key=cB.ESC+e.key);break;case 9:if(a.shiftKey){e.key=cB.ESC+"[Z";break}e.key=cB.HT,e.cancel=!0;break;case 13:e.key=a.altKey?cB.ESC+cB.CR:cB.CR,e.cancel=!0;break;case 27:e.key=cB.ESC,a.altKey&&(e.key=cB.ESC+cB.ESC),e.cancel=!0;break;case 37:if(a.metaKey)break;f?e.key=cB.ESC+"[1;"+(f+1)+"D":b?e.key=cB.ESC+"OD":e.key=cB.ESC+"[D";break;case 39:if(a.metaKey)break;f?e.key=cB.ESC+"[1;"+(f+1)+"C":b?e.key=cB.ESC+"OC":e.key=cB.ESC+"[C";break;case 38:if(a.metaKey)break;f?e.key=cB.ESC+"[1;"+(f+1)+"A":b?e.key=cB.ESC+"OA":e.key=cB.ESC+"[A";break;case 40:if(a.metaKey)break;f?e.key=cB.ESC+"[1;"+(f+1)+"B":b?e.key=cB.ESC+"OB":e.key=cB.ESC+"[B";break;case 45:a.shiftKey||a.ctrlKey||(e.key=cB.ESC+"[2~");break;case 46:f?e.key=cB.ESC+"[3;"+(f+1)+"~":e.key=cB.ESC+"[3~";break;case 36:f?e.key=cB.ESC+"[1;"+(f+1)+"H":b?e.key=cB.ESC+"OH":e.key=cB.ESC+"[H";break;case 35:f?e.key=cB.ESC+"[1;"+(f+1)+"F":b?e.key=cB.ESC+"OF":e.key=cB.ESC+"[F";break;case 33:a.shiftKey?e.type=2:a.ctrlKey?e.key=cB.ESC+"[5;"+(f+1)+"~":e.key=cB.ESC+"[5~";break;case 34:a.shiftKey?e.type=3:a.ctrlKey?e.key=cB.ESC+"[6;"+(f+1)+"~":e.key=cB.ESC+"[6~";break;case 112:f?e.key=cB.ESC+"[1;"+(f+1)+"P":e.key=cB.ESC+"OP";break;case 113:f?e.key=cB.ESC+"[1;"+(f+1)+"Q":e.key=cB.ESC+"OQ";break;case 114:f?e.key=cB.ESC+"[1;"+(f+1)+"R":e.key=cB.ESC+"OR";break;case 115:f?e.key=cB.ESC+"[1;"+(f+1)+"S":e.key=cB.ESC+"OS";break;case 116:f?e.key=cB.ESC+"[15;"+(f+1)+"~":e.key=cB.ESC+"[15~";break;case 117:f?e.key=cB.ESC+"[17;"+(f+1)+"~":e.key=cB.ESC+"[17~";break;case 118:f?e.key=cB.ESC+"[18;"+(f+1)+"~":e.key=cB.ESC+"[18~";break;case 119:f?e.key=cB.ESC+"[19;"+(f+1)+"~":e.key=cB.ESC+"[19~";break;case 120:f?e.key=cB.ESC+"[20;"+(f+1)+"~":e.key=cB.ESC+"[20~";break;case 121:f?e.key=cB.ESC+"[21;"+(f+1)+"~":e.key=cB.ESC+"[21~";break;case 122:f?e.key=cB.ESC+"[23;"+(f+1)+"~":e.key=cB.ESC+"[23~";break;case 123:f?e.key=cB.ESC+"[24;"+(f+1)+"~":e.key=cB.ESC+"[24~";break;default:if(!a.ctrlKey||a.shiftKey||a.altKey||a.metaKey)if((!c||d)&&a.altKey&&!a.metaKey){let b=eW[a.keyCode]?.[+!!a.shiftKey];if(b)e.key=cB.ESC+b;else if(a.keyCode>=65&&a.keyCode<=90){let b=String.fromCharCode(a.ctrlKey?a.keyCode-64:a.keyCode+32);a.shiftKey&&(b=b.toUpperCase()),e.key=cB.ESC+b}else if(32===a.keyCode)e.key=cB.ESC+(a.ctrlKey?cB.NUL:" ");else if("Dead"===a.key&&a.code.startsWith("Key")){let b=a.code.slice(3,4);a.shiftKey||(b=b.toLowerCase()),e.key=cB.ESC+b,e.cancel=!0}}else!c||a.altKey||a.ctrlKey||a.shiftKey||!a.metaKey?!a.key||a.ctrlKey||a.altKey||a.metaKey||!(a.keyCode>=48)||1!==a.key.length?a.key&&a.ctrlKey&&("_"===a.key&&(e.key=cB.US),"@"===a.key&&(e.key=cB.NUL)):e.key=a.key:65===a.keyCode&&(e.type=1);else a.keyCode>=65&&a.keyCode<=90?e.key=String.fromCharCode(a.keyCode-64):32===a.keyCode?e.key=cB.NUL:a.keyCode>=51&&a.keyCode<=55?e.key=String.fromCharCode(a.keyCode-51+27):56===a.keyCode?e.key=cB.DEL:219===a.keyCode?e.key=cB.ESC:220===a.keyCode?e.key=cB.FS:221===a.keyCode&&(e.key=cB.GS)}return e}(a,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(a),3===c.type||2===c.type){let b=this.rows-1;return this.scrollLines(2===c.type?-b:b),this.cancel(a,!0)}return 1===c.type&&this.selectAll(),!!(this._isThirdLevelShift(this.browser,a)||(c.cancel&&this.cancel(a,!0),!c.key)||a.key&&!a.ctrlKey&&!a.altKey&&!a.metaKey&&1===a.key.length&&a.key.charCodeAt(0)>=65&&90>=a.key.charCodeAt(0))||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):((c.key===cB.ETX||c.key===cB.CR)&&(this.textarea.value=""),this._onKey.fire({key:c.key,domEvent:a}),this._showCursor(),this.coreService.triggerDataEvent(c.key,!0),!this.optionsService.rawOptions.screenReaderMode||a.altKey||a.ctrlKey)?this.cancel(a,!0):void(this._keyDownHandled=!0))}_isThirdLevelShift(a,b){let c=a.isMac&&!this.options.macOptionIsMeta&&b.altKey&&!b.ctrlKey&&!b.metaKey||a.isWindows&&b.altKey&&b.ctrlKey&&!b.metaKey||a.isWindows&&b.getModifierState("AltGraph");return"keypress"===b.type?c:c&&(!b.keyCode||b.keyCode>47)}_keyUp(a){var b;this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(a)||(16===(b=a).keyCode||17===b.keyCode||18===b.keyCode||this.focus(),this.updateCursorStyle(a),this._keyPressHandled=!1)}_keyPress(a){let b;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&!1===this._customKeyEventHandler(a))return!1;if(this.cancel(a),a.charCode)b=a.charCode;else if(null===a.which||void 0===a.which)b=a.keyCode;else{if(0===a.which||0===a.charCode)return!1;b=a.which}return!!b&&(!a.altKey&&!a.ctrlKey&&!a.metaKey||!!this._isThirdLevelShift(this.browser,a))&&(b=String.fromCharCode(b),this._onKey.fire({key:b,domEvent:a}),this._showCursor(),this.coreService.triggerDataEvent(b,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(a){if(a.data&&"insertText"===a.inputType&&(!a.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let b=a.data;return this.coreService.triggerDataEvent(b,!0),this.cancel(a),!0}return!1}resize(a,b){if(a===this.cols&&b===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(a,b)}_afterResize(a,b){this._charSizeService?.measure()}clear(){if(0!==this.buffer.ybase||0!==this.buffer.y){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let a=1;a<this.rows;a++)this.buffer.lines.push(this.buffer.getBlankLine(d_));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let a=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=a,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(cB.ESC+"[I"):this.coreService.triggerDataEvent(cB.ESC+"[O")}_reportWindowsOptions(a){if(this._renderService)switch(a){case 0:let b=this._renderService.dimensions.css.canvas.width.toFixed(0),c=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${cB.ESC}[4;${c};${b}t`);break;case 1:let d=this._renderService.dimensions.css.cell.width.toFixed(0),e=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${cB.ESC}[6;${e};${d}t`)}}cancel(a,b){if(!(!this.options.cancelEvents&&!b))return a.preventDefault(),a.stopPropagation(),!1}},e5=class{constructor(){this._addons=[]}dispose(){for(let a=this._addons.length-1;a>=0;a--)this._addons[a].instance.dispose()}loadAddon(a,b){let c={instance:b,dispose:b.dispose,isDisposed:!1};this._addons.push(c),b.dispose=()=>this._wrappedAddonDispose(c),b.activate(a)}_wrappedAddonDispose(a){if(a.isDisposed)return;let b=-1;for(let c=0;c<this._addons.length;c++)if(this._addons[c]===a){b=c;break}if(-1===b)throw Error("Could not dispose an addon that has not been loaded");a.isDisposed=!0,a.dispose.apply(a.instance),this._addons.splice(b,1)}},e6=class{constructor(a){this._line=a}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(a,b){if(!(a<0||a>=this._line.length))return b?(this._line.loadCell(a,b),b):this._line.loadCell(a,new S)}translateToString(a,b,c){return this._line.translateToString(a,b,c)}},e7=class{constructor(a,b){this._buffer=a,this.type=b}init(a){return this._buffer=a,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(a){let b=this._buffer.lines.get(a);if(b)return new e6(b)}getNullCell(){return new S}},e8=class extends aC{constructor(a){super(),this._core=a,this._onBufferChange=this._register(new aV),this.onBufferChange=this._onBufferChange.event,this._normal=new e7(this._core.buffers.normal,"normal"),this._alternate=new e7(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},e9=class{constructor(a){this._core=a}registerCsiHandler(a,b){return this._core.registerCsiHandler(a,a=>b(a.toArray()))}addCsiHandler(a,b){return this.registerCsiHandler(a,b)}registerDcsHandler(a,b){return this._core.registerDcsHandler(a,(a,c)=>b(a,c.toArray()))}addDcsHandler(a,b){return this.registerDcsHandler(a,b)}registerEscHandler(a,b){return this._core.registerEscHandler(a,b)}addEscHandler(a,b){return this.registerEscHandler(a,b)}registerOscHandler(a,b){return this._core.registerOscHandler(a,b)}addOscHandler(a,b){return this.registerOscHandler(a,b)}},fa=class{constructor(a){this._core=a}register(a){this._core.unicodeService.register(a)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(a){this._core.unicodeService.activeVersion=a}},fb=["cols","rows"],fc=0,fd=class extends aC{constructor(a){super(),this._core=this._register(new e4(a)),this._addonManager=this._register(new e5),this._publicOptions={...this._core.options};let b=a=>this._core.options[a],c=(a,b)=>{this._checkReadonlyOptions(a),this._core.options[a]=b};for(let a in this._core.options){let d={get:b.bind(this,a),set:c.bind(this,a)};Object.defineProperty(this._publicOptions,a,d)}}_checkReadonlyOptions(a){if(fb.includes(a))throw Error(`Option "${a}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new e9(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new fa(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new e8(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let a=this._core.coreService.decPrivateModes,b="none";switch(this._core.coreMouseService.activeProtocol){case"X10":b="x10";break;case"VT200":b="vt200";break;case"DRAG":b="drag";break;case"ANY":b="any"}return{applicationCursorKeysMode:a.applicationCursorKeys,applicationKeypadMode:a.applicationKeypad,bracketedPasteMode:a.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:b,originMode:a.origin,reverseWraparoundMode:a.reverseWraparound,sendFocusMode:a.sendFocus,synchronizedOutputMode:a.synchronizedOutput,wraparoundMode:a.wraparound}}get options(){return this._publicOptions}set options(a){for(let b in a)this._publicOptions[b]=a[b]}blur(){this._core.blur()}focus(){this._core.focus()}input(a,b=!0){this._core.input(a,b)}resize(a,b){this._verifyIntegers(a,b),this._core.resize(a,b)}open(a){this._core.open(a)}attachCustomKeyEventHandler(a){this._core.attachCustomKeyEventHandler(a)}attachCustomWheelEventHandler(a){this._core.attachCustomWheelEventHandler(a)}registerLinkProvider(a){return this._core.registerLinkProvider(a)}registerCharacterJoiner(a){return this._checkProposedApi(),this._core.registerCharacterJoiner(a)}deregisterCharacterJoiner(a){this._checkProposedApi(),this._core.deregisterCharacterJoiner(a)}registerMarker(a=0){return this._verifyIntegers(a),this._core.registerMarker(a)}registerDecoration(a){return this._checkProposedApi(),this._verifyPositiveIntegers(a.x??0,a.width??0,a.height??0),this._core.registerDecoration(a)}hasSelection(){return this._core.hasSelection()}select(a,b,c){this._verifyIntegers(a,b,c),this._core.select(a,b,c)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(a,b){this._verifyIntegers(a,b),this._core.selectLines(a,b)}dispose(){super.dispose()}scrollLines(a){this._verifyIntegers(a),this._core.scrollLines(a)}scrollPages(a){this._verifyIntegers(a),this._core.scrollPages(a)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(a){this._verifyIntegers(a),this._core.scrollToLine(a)}clear(){this._core.clear()}write(a,b){this._core.write(a,b)}writeln(a,b){this._core.write(a),this._core.write(`\r
31
31
  `,b)}paste(a){this._core.paste(a)}refresh(a,b){this._verifyIntegers(a,b),this._core.refresh(a,b)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(a){this._addonManager.loadAddon(this,a)}static get strings(){return{get promptLabel(){return H},set promptLabel(t){H=t},get tooMuchOutput(){return I},set tooMuchOutput(t){I=t}}}_verifyIntegers(...a){for(fc of a)if(fc===1/0||isNaN(fc)||fc%1!=0)throw Error("This API only accepts integers")}_verifyPositiveIntegers(...a){for(fc of a)if(fc&&(fc===1/0||isNaN(fc)||fc%1!=0||fc<0))throw Error("This API only accepts positive integers")}};a.s(["Terminal",0,fd],10450);var fe=class{activate(a){this._terminal=a}dispose(){}fit(){let a=this.proposeDimensions();if(!a||!this._terminal||isNaN(a.cols)||isNaN(a.rows))return;let b=this._terminal._core;(this._terminal.rows!==a.rows||this._terminal.cols!==a.cols)&&(b._renderService.clear(),this._terminal.resize(a.cols,a.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let a=this._terminal._core._renderService.dimensions;if(0===a.css.cell.width||0===a.css.cell.height)return;let b=0===this._terminal.options.scrollback?0:this._terminal.options.overviewRuler?.width||14,c=window.getComputedStyle(this._terminal.element.parentElement),d=parseInt(c.getPropertyValue("height")),e=Math.max(0,parseInt(c.getPropertyValue("width"))),f=window.getComputedStyle(this._terminal.element),g={top:parseInt(f.getPropertyValue("padding-top")),bottom:parseInt(f.getPropertyValue("padding-bottom")),right:parseInt(f.getPropertyValue("padding-right")),left:parseInt(f.getPropertyValue("padding-left"))},h=g.top+g.bottom;return{cols:Math.max(2,Math.floor((e-(g.right+g.left)-b)/a.css.cell.width)),rows:Math.max(1,Math.floor((d-h)/a.css.cell.height))}}};a.s(["FitAddon",0,fe],99813)},22734,(a,b,c)=>{b.exports=a.x("fs",()=>require("fs"))},92509,(a,b,c)=>{b.exports=a.x("url",()=>require("url"))},33405,(a,b,c)=>{b.exports=a.x("child_process",()=>require("child_process"))},21517,(a,b,c)=>{b.exports=a.x("http",()=>require("http"))},24836,(a,b,c)=>{b.exports=a.x("https",()=>require("https"))},63047,(a,b,c)=>{var d=a.r(22734),e=a.r(92509),f=a.r(33405).spawn;function g(b){"use strict";b=b||{};var c,g,h=this,i=a.r(21517),j=a.r(24836),k={},l=!1,m={"User-Agent":"node-XMLHttpRequest",Accept:"*/*"},n=Object.assign({},m),o=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","content-transfer-encoding","cookie","cookie2","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"],p=["TRACE","TRACK","CONNECT"],q=!1,r=!1,s=!1,u={};this.UNSENT=0,this.OPENED=1,this.HEADERS_RECEIVED=2,this.LOADING=3,this.DONE=4,this.readyState=this.UNSENT,this.onreadystatechange=null,this.responseText="",this.responseXML="",this.response=Buffer.alloc(0),this.status=null,this.statusText=null,this.open=function(a,b,c,d,e){if(this.abort(),r=!1,s=!1,!(a&&-1===p.indexOf(a)))throw Error("SecurityError: Request method not allowed");k={method:a,url:b.toString(),async:"boolean"!=typeof c||c,user:d||null,password:e||null},v(this.OPENED)},this.setDisableHeaderCheck=function(a){l=a},this.setRequestHeader=function(a,b){if(this.readyState!=this.OPENED)throw Error("INVALID_STATE_ERR: setRequestHeader can only be called when state is OPEN");if(!l&&(!a||-1!==o.indexOf(a.toLowerCase())))return console.warn('Refused to set unsafe header "'+a+'"'),!1;if(q)throw Error("INVALID_STATE_ERR: send flag is true");return n[a]=b,!0},this.getResponseHeader=function(a){return"string"==typeof a&&this.readyState>this.OPENED&&g.headers[a.toLowerCase()]&&!r?g.headers[a.toLowerCase()]:null},this.getAllResponseHeaders=function(){if(this.readyState<this.HEADERS_RECEIVED||r)return"";var a="";for(var b in g.headers)"set-cookie"!==b&&"set-cookie2"!==b&&(a+=b+": "+g.headers[b]+"\r\n");return a.substr(0,a.length-2)},this.getRequestHeader=function(a){return"string"==typeof a&&n[a]?n[a]:""},this.send=function(a){if(this.readyState!=this.OPENED)throw Error("INVALID_STATE_ERR: connection must be opened before send() is called");if(q)throw Error("INVALID_STATE_ERR: send has already been called");var l,m=!1,o=!1,p=e.parse(k.url);switch(p.protocol){case"https:":m=!0;case"http:":l=p.hostname;break;case"file:":o=!0;break;case void 0:case"":l="localhost";break;default:throw Error("Protocol not supported.")}if(o){if("GET"!==k.method)throw Error("XMLHttpRequest: Only GET method is supported");if(k.async)d.readFile(unescape(p.pathname),function(a,b){a?h.handleError(a,a.errno||-1):(h.status=200,h.responseText=b.toString("utf8"),h.response=b,v(h.DONE))});else try{this.response=d.readFileSync(unescape(p.pathname)),this.responseText=this.response.toString("utf8"),this.status=200,v(h.DONE)}catch(a){this.handleError(a,a.errno||-1)}return}var s=p.port||(m?443:80),u=p.pathname+(p.search?p.search:"");if(n.Host=l,m&&443===s||80===s||(n.Host+=":"+p.port),k.user){void 0===k.password&&(k.password="");var w=new Buffer(k.user+":"+k.password);n.Authorization="Basic "+w.toString("base64")}"GET"===k.method||"HEAD"===k.method?a=null:a?(n["Content-Length"]=Buffer.isBuffer(a)?a.length:Buffer.byteLength(a),Object.keys(n).some(function(a){return"content-type"===a.toLowerCase()})||(n["Content-Type"]="text/plain;charset=UTF-8")):"POST"===k.method&&(n["Content-Length"]=0);var x=b.agent||!1,y={host:l,port:s,path:u,method:k.method,headers:n,agent:x};if(m&&(y.pfx=b.pfx,y.key=b.key,y.passphrase=b.passphrase,y.cert=b.cert,y.ca=b.ca,y.ciphers=b.ciphers,y.rejectUnauthorized=!1!==b.rejectUnauthorized),r=!1,k.async){var z=m?j.request:i.request;q=!0,h.dispatchEvent("readystatechange");var A=function(a){if(302===(g=a).statusCode||303===g.statusCode||307===g.statusCode){k.url=g.headers.location;var d=e.parse(k.url);l=d.hostname;var f={hostname:d.hostname,port:d.port,path:d.path,method:303===g.statusCode?"GET":k.method,headers:n};m&&(f.pfx=b.pfx,f.key=b.key,f.passphrase=b.passphrase,f.cert=b.cert,f.ca=b.ca,f.ciphers=b.ciphers,f.rejectUnauthorized=!1!==b.rejectUnauthorized),(c=z(f,A).on("error",B)).end();return}v(h.HEADERS_RECEIVED),h.status=g.statusCode,g.on("data",function(a){if(a){var b=Buffer.from(a);h.response=Buffer.concat([h.response,b])}q&&v(h.LOADING)}),g.on("end",function(){q&&(q=!1,v(h.DONE),h.responseText=h.response.toString("utf8"))}),g.on("error",function(a){h.handleError(a)})},B=function(a){if(c.reusedSocket&&"ECONNRESET"===a.code)return z(y,A).on("error",B);h.handleError(a)};c=z(y,A).on("error",B),b.autoUnref&&c.on("socket",a=>{a.unref()}),a&&c.write(a),c.end(),h.dispatchEvent("loadstart")}else{var C=".node-xmlhttprequest-content-"+process.pid,D=".node-xmlhttprequest-sync-"+process.pid;d.writeFileSync(D,"","utf8");for(var E="var http = require('http'), https = require('https'), fs = require('fs');var doRequest = http"+(m?"s":"")+".request;var options = "+JSON.stringify(y)+";var responseText = '';var responseData = Buffer.alloc(0);var req = doRequest(options, function(response) {response.on('data', function(chunk) { var data = Buffer.from(chunk); responseText += data.toString('utf8'); responseData = Buffer.concat([responseData, data]);});response.on('end', function() {fs.writeFileSync('"+C+"', JSON.stringify({err: null, data: {statusCode: response.statusCode, headers: response.headers, text: responseText, data: responseData.toString('base64')}}), 'utf8');fs.unlinkSync('"+D+"');});response.on('error', function(error) {fs.writeFileSync('"+C+"', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('"+D+"');});}).on('error', function(error) {fs.writeFileSync('"+C+"', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('"+D+"');});"+(a?"req.write('"+JSON.stringify(a).slice(1,-1).replace(/'/g,"\\'")+"');":"")+"req.end();",F=f(process.argv[0],["-e",E]);d.existsSync(D););if(h.responseText=d.readFileSync(C,"utf8"),F.stdin.end(),d.unlinkSync(C),h.responseText.match(/^NODE-XMLHTTPREQUEST-ERROR:/)){var G=JSON.parse(h.responseText.replace(/^NODE-XMLHTTPREQUEST-ERROR:/,""));h.handleError(G,503)}else{h.status=h.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:([0-9]*),.*/,"$1");var H=JSON.parse(h.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:[0-9]*,(.*)/,"$1"));g={statusCode:h.status,headers:H.data.headers},h.responseText=H.data.text,h.response=Buffer.from(H.data.data,"base64"),v(h.DONE,!0)}}},this.handleError=function(a,b){this.status=b||0,this.statusText=a,this.responseText=a.stack,r=!0,v(this.DONE)},this.abort=function(){c&&(c.abort(),c=null),n=Object.assign({},m),this.responseText="",this.responseXML="",this.response=Buffer.alloc(0),r=s=!0,this.readyState!==this.UNSENT&&(this.readyState!==this.OPENED||q)&&this.readyState!==this.DONE&&(q=!1,v(this.DONE)),this.readyState=this.UNSENT},this.addEventListener=function(a,b){a in u||(u[a]=[]),u[a].push(b)},this.removeEventListener=function(a,b){a in u&&(u[a]=u[a].filter(function(a){return a!==b}))},this.dispatchEvent=function(a){if("function"==typeof h["on"+a]&&(this.readyState===this.DONE&&k.async?setTimeout(function(){h["on"+a]()},0):h["on"+a]()),a in u)for(let b=0,c=u[a].length;b<c;b++)this.readyState===this.DONE?setTimeout(function(){u[a][b].call(h)},0):u[a][b].call(h)};var v=function(a){if(h.readyState!==a&&(h.readyState!==h.UNSENT||!s)&&(h.readyState=a,(k.async||h.readyState<h.OPENED||h.readyState===h.DONE)&&h.dispatchEvent("readystatechange"),h.readyState===h.DONE)){let a;a=s?"abort":r?"error":"load",h.dispatchEvent(a),h.dispatchEvent("loadend")}}}b.exports=g,g.XMLHttpRequest=g},84425,(a,b,c)=>{function d(a,b,c,d){return Math.round(a/c)+" "+d+(b>=1.5*c?"s":"")}b.exports=function(a,b){b=b||{};var c,e,f,g,h=typeof a;if("string"===h&&a.length>0){var i=a;if(!((i=String(i)).length>100)){var j=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(j){var k=parseFloat(j[1]);switch((j[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*k;case"weeks":case"week":case"w":return 6048e5*k;case"days":case"day":case"d":return 864e5*k;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*k;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*k;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*k;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return k;default:break}}}return}if("number"===h&&isFinite(a)){return b.long?(e=Math.abs(c=a))>=864e5?d(c,e,864e5,"day"):e>=36e5?d(c,e,36e5,"hour"):e>=6e4?d(c,e,6e4,"minute"):e>=1e3?d(c,e,1e3,"second"):c+" ms":(g=Math.abs(f=a))>=864e5?Math.round(f/864e5)+"d":g>=36e5?Math.round(f/36e5)+"h":g>=6e4?Math.round(f/6e4)+"m":g>=1e3?Math.round(f/1e3)+"s":f+"ms"}throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))}},11017,(a,b,c)=>{b.exports=function(b){function c(a){let b,e,f,g=null;function h(...a){if(!h.enabled)return;let d=Number(new Date);h.diff=d-(b||d),h.prev=b,h.curr=d,b=d,a[0]=c.coerce(a[0]),"string"!=typeof a[0]&&a.unshift("%O");let e=0;a[0]=a[0].replace(/%([a-zA-Z%])/g,(b,d)=>{if("%%"===b)return"%";e++;let f=c.formatters[d];if("function"==typeof f){let c=a[e];b=f.call(h,c),a.splice(e,1),e--}return b}),c.formatArgs.call(h,a),(h.log||c.log).apply(h,a)}return h.namespace=a,h.useColors=c.useColors(),h.color=c.selectColor(a),h.extend=d,h.destroy=c.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==g?g:(e!==c.namespaces&&(e=c.namespaces,f=c.enabled(a)),f),set:a=>{g=a}}),"function"==typeof c.init&&c.init(h),h}function d(a,b){let d=c(this.namespace+(void 0===b?":":b)+a);return d.log=this.log,d}function e(a,b){let c=0,d=0,e=-1,f=0;for(;c<a.length;)if(d<b.length&&(b[d]===a[c]||"*"===b[d]))"*"===b[d]?(e=d,f=c):c++,d++;else{if(-1===e)return!1;d=e+1,c=++f}for(;d<b.length&&"*"===b[d];)d++;return d===b.length}return c.debug=c,c.default=c,c.coerce=function(a){return a instanceof Error?a.stack||a.message:a},c.disable=function(){let a=[...c.names,...c.skips.map(a=>"-"+a)].join(",");return c.enable(""),a},c.enable=function(a){for(let b of(c.save(a),c.namespaces=a,c.names=[],c.skips=[],("string"==typeof a?a:"").trim().replace(/\s+/g,",").split(",").filter(Boolean)))"-"===b[0]?c.skips.push(b.slice(1)):c.names.push(b)},c.enabled=function(a){for(let b of c.skips)if(e(a,b))return!1;for(let b of c.names)if(e(a,b))return!0;return!1},c.humanize=a.r(84425),c.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(b).forEach(a=>{c[a]=b[a]}),c.names=[],c.skips=[],c.formatters={},c.selectColor=function(a){let b=0;for(let c=0;c<a.length;c++)b=(b<<5)-b+a.charCodeAt(c)|0;return c.colors[Math.abs(b)%c.colors.length]},c.enable(c.load()),c}},70722,(a,b,c)=>{b.exports=a.x("tty",()=>require("tty"))},55858,(a,b,c)=>{"use strict";b.exports=(a,b=process.argv)=>{let c=a.startsWith("-")?"":1===a.length?"-":"--",d=b.indexOf(c+a),e=b.indexOf("--");return -1!==d&&(-1===e||d<e)}},73083,(a,b,c)=>{"use strict";let d;a.r(46786);let e=a.r(70722),f=a.r(55858),{env:g}=process;function h(a,b={}){var c;return 0!==(c=function(a,{streamIsTTY:b,sniffFlags:c=!0}={}){let e=function(){if("FORCE_COLOR"in g)return"true"===g.FORCE_COLOR?1:"false"===g.FORCE_COLOR?0:0===g.FORCE_COLOR.length?1:Math.min(Number.parseInt(g.FORCE_COLOR,10),3)}();void 0!==e&&(d=e);let h=c?d:e;if(0===h)return 0;if(c){if(f("color=16m")||f("color=full")||f("color=truecolor"))return 3;if(f("color=256"))return 2}if(a&&!b&&void 0===h)return 0;let i=h||0;if("dumb"===g.TERM)return i;if("CI"in g)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(a=>a in g)||"codeship"===g.CI_NAME?1:i;if("TEAMCITY_VERSION"in g)return+!!/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(g.TEAMCITY_VERSION);if("truecolor"===g.COLORTERM)return 3;if("TERM_PROGRAM"in g){let a=Number.parseInt((g.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(g.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(g.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(g.TERM)||"COLORTERM"in g?1:i}(a,{streamIsTTY:a&&a.isTTY,...b}))&&{level:c,hasBasic:!0,has256:c>=2,has16m:c>=3}}f("no-color")||f("no-colors")||f("color=false")||f("color=never")?d=0:(f("color")||f("colors")||f("color=true")||f("color=always"))&&(d=1),b.exports={supportsColor:h,stdout:h({isTTY:e.isatty(1)}),stderr:h({isTTY:e.isatty(2)})}},81454,(a,b,c)=>{let d=a.r(70722),e=a.r(24361);c.init=function(a){a.inspectOpts={};let b=Object.keys(c.inspectOpts);for(let d=0;d<b.length;d++)a.inspectOpts[b[d]]=c.inspectOpts[b[d]]},c.log=function(...a){return process.stderr.write(e.formatWithOptions(c.inspectOpts,...a)+"\n")},c.formatArgs=function(a){let{namespace:d,useColors:e}=this;if(e){let c=this.color,e="\x1b[3"+(c<8?c:"8;5;"+c),f=` ${e};1m${d} \u001B[0m`;a[0]=f+a[0].split("\n").join("\n"+f),a.push(e+"m+"+b.exports.humanize(this.diff)+"\x1b[0m")}else a[0]=(c.inspectOpts.hideDate?"":new Date().toISOString()+" ")+d+" "+a[0]},c.save=function(a){a?process.env.DEBUG=a:delete process.env.DEBUG},c.load=function(){return process.env.DEBUG},c.useColors=function(){return"colors"in c.inspectOpts?!!c.inspectOpts.colors:d.isatty(process.stderr.fd)},c.destroy=e.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),c.colors=[6,2,3,4,5,1];try{let b=a.r(73083);b&&(b.stderr||b).level>=2&&(c.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(a){}c.inspectOpts=Object.keys(process.env).filter(a=>/^debug_/i.test(a)).reduce((a,b)=>{let c=b.substring(6).toLowerCase().replace(/_([a-z])/g,(a,b)=>b.toUpperCase()),d=process.env[b];return d=!!/^(yes|on|true|enabled)$/i.test(d)||!/^(no|off|false|disabled)$/i.test(d)&&("null"===d?null:Number(d)),a[c]=d,a},{}),b.exports=a.r(11017)(c);let{formatters:f}=b.exports;f.o=function(a){return this.inspectOpts.colors=this.useColors,e.inspect(a,this.inspectOpts).split("\n").map(a=>a.trim()).join(" ")},f.O=function(a){return this.inspectOpts.colors=this.useColors,e.inspect(a,this.inspectOpts)}},47522,(a,b,c)=>{let d;c.formatArgs=function(a){if(a[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+a[0]+(this.useColors?"%c ":" ")+"+"+b.exports.humanize(this.diff),!this.useColors)return;let c="color: "+this.color;a.splice(1,0,c,"color: inherit");let d=0,e=0;a[0].replace(/%[a-zA-Z%]/g,a=>{"%%"!==a&&(d++,"%c"===a&&(e=d))}),a.splice(e,0,c)},c.save=function(a){try{a?c.storage.setItem("debug",a):c.storage.removeItem("debug")}catch(a){}},c.load=function(){let a;try{a=c.storage.getItem("debug")||c.storage.getItem("DEBUG")}catch(a){}return!a&&"u">typeof process&&"env"in process&&(a=process.env.DEBUG),a},c.useColors=function(){let a;return!("u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("u">typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"u">typeof navigator&&navigator.userAgent&&(a=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(a[1],10)>=31||"u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},c.storage=function(){try{return localStorage}catch(a){}}(),d=!1,c.destroy=()=>{d||(d=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))},c.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],c.log=console.debug||console.log||(()=>{}),b.exports=a.r(11017)(c);let{formatters:e}=b.exports;e.j=function(a){try{return JSON.stringify(a)}catch(a){return"[UnexpectedJSONParseError]: "+a.message}}},35290,(a,b,c)=>{"u"<typeof process||"renderer"===process.type||process.__nwjs?b.exports=a.r(47522):b.exports=a.r(81454)},27699,(a,b,c)=>{b.exports=a.x("events",()=>require("events"))},55004,(a,b,c)=>{b.exports=a.x("tls",()=>require("tls"))},88947,(a,b,c)=>{b.exports=a.x("stream",()=>require("stream"))},6461,(a,b,c)=>{b.exports=a.x("zlib",()=>require("zlib"))},17376,(a,b,c)=>{"use strict";let d=["nodebuffer","arraybuffer","fragments"],e="u">typeof Blob;e&&d.push("blob"),b.exports={BINARY_TYPES:d,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:e,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}},29618,(a,b,c)=>{"use strict";let{EMPTY_BUFFER:d}=a.r(17376),e=Buffer[Symbol.species];function f(a,b,c,d,e){for(let f=0;f<e;f++)c[d+f]=a[f]^b[3&f]}function g(a,b){for(let c=0;c<a.length;c++)a[c]^=b[3&c]}function h(a){let b;return(h.readOnly=!0,Buffer.isBuffer(a))?a:(a instanceof ArrayBuffer?b=new e(a):ArrayBuffer.isView(a)?b=new e(a.buffer,a.byteOffset,a.byteLength):(b=Buffer.from(a),h.readOnly=!1),b)}if(b.exports={concat:function(a,b){if(0===a.length)return d;if(1===a.length)return a[0];let c=Buffer.allocUnsafe(b),f=0;for(let b=0;b<a.length;b++){let d=a[b];c.set(d,f),f+=d.length}return f<b?new e(c.buffer,c.byteOffset,f):c},mask:f,toArrayBuffer:function(a){return a.length===a.buffer.byteLength?a.buffer:a.buffer.slice(a.byteOffset,a.byteOffset+a.length)},toBuffer:h,unmask:g},!process.env.WS_NO_BUFFER_UTIL)try{let a=(()=>{let a=Error("Cannot find module 'bufferutil'");throw a.code="MODULE_NOT_FOUND",a})();b.exports.mask=function(b,c,d,e,g){g<48?f(b,c,d,e,g):a.mask(b,c,d,e,g)},b.exports.unmask=function(b,c){b.length<32?g(b,c):a.unmask(b,c)}}catch(a){}},74873,(a,b,c)=>{"use strict";let d=Symbol("kDone"),e=Symbol("kRun");b.exports=class{constructor(a){this[d]=()=>{this.pending--,this[e]()},this.concurrency=a||1/0,this.jobs=[],this.pending=0}add(a){this.jobs.push(a),this[e]()}[e](){if(this.pending!==this.concurrency&&this.jobs.length){let a=this.jobs.shift();this.pending++,a(this[d])}}}},10976,(a,b,c)=>{"use strict";let d,e=a.r(6461),f=a.r(29618),g=a.r(74873),{kStatusCode:h}=a.r(17376),i=Buffer[Symbol.species],j=Buffer.from([0,0,255,255]),k=Symbol("permessage-deflate"),l=Symbol("total-length"),m=Symbol("callback"),n=Symbol("buffers"),o=Symbol("error");function p(a){this[n].push(a),this[l]+=a.length}function q(a){(this[l]+=a.length,this[k]._maxPayload<1||this[l]<=this[k]._maxPayload)?this[n].push(a):(this[o]=RangeError("Max payload size exceeded"),this[o].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[o][h]=1009,this.removeListener("data",q),this.reset())}function r(a){(this[k]._inflate=null,this[o])?this[m](this[o]):(a[h]=1007,this[m](a))}b.exports=class{constructor(a,b,c){this._maxPayload=0|c,this._options=a||{},this._threshold=void 0!==this._options.threshold?this._options.threshold:1024,this._isServer=!!b,this._deflate=null,this._inflate=null,this.params=null,d||(d=new g(void 0!==this._options.concurrencyLimit?this._options.concurrencyLimit:10))}static get extensionName(){return"permessage-deflate"}offer(){let a={};return this._options.serverNoContextTakeover&&(a.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(a.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(a.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?a.client_max_window_bits=this._options.clientMaxWindowBits:null==this._options.clientMaxWindowBits&&(a.client_max_window_bits=!0),a}accept(a){return a=this.normalizeParams(a),this.params=this._isServer?this.acceptAsServer(a):this.acceptAsClient(a),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let a=this._deflate[m];this._deflate.close(),this._deflate=null,a&&a(Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(a){let b=this._options,c=a.find(a=>(!1!==b.serverNoContextTakeover||!a.server_no_context_takeover)&&(!a.server_max_window_bits||!1!==b.serverMaxWindowBits&&("number"!=typeof b.serverMaxWindowBits||!(b.serverMaxWindowBits>a.server_max_window_bits)))&&("number"!=typeof b.clientMaxWindowBits||!!a.client_max_window_bits));if(!c)throw Error("None of the extension offers can be accepted");return b.serverNoContextTakeover&&(c.server_no_context_takeover=!0),b.clientNoContextTakeover&&(c.client_no_context_takeover=!0),"number"==typeof b.serverMaxWindowBits&&(c.server_max_window_bits=b.serverMaxWindowBits),"number"==typeof b.clientMaxWindowBits?c.client_max_window_bits=b.clientMaxWindowBits:(!0===c.client_max_window_bits||!1===b.clientMaxWindowBits)&&delete c.client_max_window_bits,c}acceptAsClient(a){let b=a[0];if(!1===this._options.clientNoContextTakeover&&b.client_no_context_takeover)throw Error('Unexpected parameter "client_no_context_takeover"');if(b.client_max_window_bits){if(!1===this._options.clientMaxWindowBits||"number"==typeof this._options.clientMaxWindowBits&&b.client_max_window_bits>this._options.clientMaxWindowBits)throw Error('Unexpected or invalid parameter "client_max_window_bits"')}else"number"==typeof this._options.clientMaxWindowBits&&(b.client_max_window_bits=this._options.clientMaxWindowBits);return b}normalizeParams(a){return a.forEach(a=>{Object.keys(a).forEach(b=>{let c=a[b];if(c.length>1)throw Error(`Parameter "${b}" must have only a single value`);if(c=c[0],"client_max_window_bits"===b){if(!0!==c){let a=+c;if(!Number.isInteger(a)||a<8||a>15)throw TypeError(`Invalid value for parameter "${b}": ${c}`);c=a}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${b}": ${c}`)}else if("server_max_window_bits"===b){let a=+c;if(!Number.isInteger(a)||a<8||a>15)throw TypeError(`Invalid value for parameter "${b}": ${c}`);c=a}else if("client_no_context_takeover"===b||"server_no_context_takeover"===b){if(!0!==c)throw TypeError(`Invalid value for parameter "${b}": ${c}`)}else throw Error(`Unknown parameter "${b}"`);a[b]=c})}),a}decompress(a,b,c){d.add(d=>{this._decompress(a,b,(a,b)=>{d(),c(a,b)})})}compress(a,b,c){d.add(d=>{this._compress(a,b,(a,b)=>{d(),c(a,b)})})}_decompress(a,b,c){let d=this._isServer?"client":"server";if(!this._inflate){let a=`${d}_max_window_bits`,b="number"!=typeof this.params[a]?e.Z_DEFAULT_WINDOWBITS:this.params[a];this._inflate=e.createInflateRaw({...this._options.zlibInflateOptions,windowBits:b}),this._inflate[k]=this,this._inflate[l]=0,this._inflate[n]=[],this._inflate.on("error",r),this._inflate.on("data",q)}this._inflate[m]=c,this._inflate.write(a),b&&this._inflate.write(j),this._inflate.flush(()=>{let a=this._inflate[o];if(a){this._inflate.close(),this._inflate=null,c(a);return}let e=f.concat(this._inflate[n],this._inflate[l]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[l]=0,this._inflate[n]=[],b&&this.params[`${d}_no_context_takeover`]&&this._inflate.reset()),c(null,e)})}_compress(a,b,c){let d=this._isServer?"server":"client";if(!this._deflate){let a=`${d}_max_window_bits`,b="number"!=typeof this.params[a]?e.Z_DEFAULT_WINDOWBITS:this.params[a];this._deflate=e.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:b}),this._deflate[l]=0,this._deflate[n]=[],this._deflate.on("data",p)}this._deflate[m]=c,this._deflate.write(a),this._deflate.flush(e.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let a=f.concat(this._deflate[n],this._deflate[l]);b&&(a=new i(a.buffer,a.byteOffset,a.length-4)),this._deflate[m]=null,this._deflate[l]=0,this._deflate[n]=[],b&&this.params[`${d}_no_context_takeover`]&&this._deflate.reset(),c(null,a)})}}},874,(a,b,c)=>{b.exports=a.x("buffer",()=>require("buffer"))},88686,(a,b,c)=>{"use strict";let{isUtf8:d}=a.r(874),{hasBlob:e}=a.r(17376);function f(a){let b=a.length,c=0;for(;c<b;)if((128&a[c])==0)c++;else if((224&a[c])==192){if(c+1===b||(192&a[c+1])!=128||(254&a[c])==192)return!1;c+=2}else if((240&a[c])==224){if(c+2>=b||(192&a[c+1])!=128||(192&a[c+2])!=128||224===a[c]&&(224&a[c+1])==128||237===a[c]&&(224&a[c+1])==160)return!1;c+=3}else{if((248&a[c])!=240||c+3>=b||(192&a[c+1])!=128||(192&a[c+2])!=128||(192&a[c+3])!=128||240===a[c]&&(240&a[c+1])==128||244===a[c]&&a[c+1]>143||a[c]>244)return!1;c+=4}return!0}if(b.exports={isBlob:function(a){return e&&"object"==typeof a&&"function"==typeof a.arrayBuffer&&"string"==typeof a.type&&"function"==typeof a.stream&&("Blob"===a[Symbol.toStringTag]||"File"===a[Symbol.toStringTag])},isValidStatusCode:function(a){return a>=1e3&&a<=1014&&1004!==a&&1005!==a&&1006!==a||a>=3e3&&a<=4999},isValidUTF8:f,tokenChars:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0]},d)b.exports.isValidUTF8=function(a){return a.length<24?f(a):d(a)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let a=(()=>{let a=Error("Cannot find module 'utf-8-validate'");throw a.code="MODULE_NOT_FOUND",a})();b.exports.isValidUTF8=function(b){return b.length<32?f(b):a(b)}}catch(a){}},64386,(a,b,c)=>{"use strict";let{Writable:d}=a.r(88947),e=a.r(10976),{BINARY_TYPES:f,EMPTY_BUFFER:g,kStatusCode:h,kWebSocket:i}=a.r(17376),{concat:j,toArrayBuffer:k,unmask:l}=a.r(29618),{isValidStatusCode:m,isValidUTF8:n}=a.r(88686),o=Buffer[Symbol.species];b.exports=class extends d{constructor(a={}){super(),this._allowSynchronousEvents=void 0===a.allowSynchronousEvents||a.allowSynchronousEvents,this._binaryType=a.binaryType||f[0],this._extensions=a.extensions||{},this._isServer=!!a.isServer,this._maxPayload=0|a.maxPayload,this._skipUTF8Validation=!!a.skipUTF8Validation,this[i]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(a,b,c){if(8===this._opcode&&0==this._state)return c();this._bufferedBytes+=a.length,this._buffers.push(a),this.startLoop(c)}consume(a){if(this._bufferedBytes-=a,a===this._buffers[0].length)return this._buffers.shift();if(a<this._buffers[0].length){let b=this._buffers[0];return this._buffers[0]=new o(b.buffer,b.byteOffset+a,b.length-a),new o(b.buffer,b.byteOffset,a)}let b=Buffer.allocUnsafe(a);do{let c=this._buffers[0],d=b.length-a;a>=c.length?b.set(this._buffers.shift(),d):(b.set(new Uint8Array(c.buffer,c.byteOffset,a),d),this._buffers[0]=new o(c.buffer,c.byteOffset+a,c.length-a)),a-=c.length}while(a>0)return b}startLoop(a){this._loop=!0;do switch(this._state){case 0:this.getInfo(a);break;case 1:this.getPayloadLength16(a);break;case 2:this.getPayloadLength64(a);break;case 3:this.getMask();break;case 4:this.getData(a);break;case 5:case 6:this._loop=!1;return}while(this._loop)this._errored||a()}getInfo(a){if(this._bufferedBytes<2){this._loop=!1;return}let b=this.consume(2);if((48&b[0])!=0)return void a(this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3"));let c=(64&b[0])==64;if(c&&!this._extensions[e.extensionName])return void a(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(this._fin=(128&b[0])==128,this._opcode=15&b[0],this._payloadLength=127&b[1],0===this._opcode){if(c)return void a(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(!this._fragmented)return void a(this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE"));this._opcode=this._fragmented}else if(1===this._opcode||2===this._opcode){if(this._fragmented)return void a(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE"));this._compressed=c}else{if(!(this._opcode>7)||!(this._opcode<11))return void a(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE"));if(!this._fin)return void a(this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN"));if(c)return void a(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(this._payloadLength>125||8===this._opcode&&1===this._payloadLength)return void a(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH"))}if(this._fin||this._fragmented||(this._fragmented=this._opcode),this._masked=(128&b[1])==128,this._isServer){if(!this._masked)return void a(this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK"))}else if(this._masked)return void a(this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK"));126===this._payloadLength?this._state=1:127===this._payloadLength?this._state=2:this.haveLength(a)}getPayloadLength16(a){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(a)}getPayloadLength64(a){if(this._bufferedBytes<8){this._loop=!1;return}let b=this.consume(8),c=b.readUInt32BE(0);c>2097151?a(this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=0x100000000*c+b.readUInt32BE(4),this.haveLength(a))}haveLength(a){this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)?a(this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH")):this._masked?this._state=3:this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(a){let b=g;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}b=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!=0&&l(b,this._mask)}if(this._opcode>7)return void this.controlMessage(b,a);if(this._compressed){this._state=5,this.decompress(b,a);return}b.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(b)),this.dataMessage(a)}decompress(a,b){this._extensions[e.extensionName].decompress(a,this._fin,(a,c)=>{if(a)return b(a);if(c.length){if(this._messageLength+=c.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return void b(this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));this._fragments.push(c)}this.dataMessage(b),0===this._state&&this.startLoop(b)})}dataMessage(a){if(!this._fin){this._state=0;return}let b=this._messageLength,c=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],2===this._opcode){let d;d="nodebuffer"===this._binaryType?j(c,b):"arraybuffer"===this._binaryType?k(j(c,b)):"blob"===this._binaryType?new Blob(c):c,this._allowSynchronousEvents?(this.emit("message",d,!0),this._state=0):(this._state=6,setImmediate(()=>{this.emit("message",d,!0),this._state=0,this.startLoop(a)}))}else{let d=j(c,b);if(!this._skipUTF8Validation&&!n(d))return void a(this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8"));5===this._state||this._allowSynchronousEvents?(this.emit("message",d,!1),this._state=0):(this._state=6,setImmediate(()=>{this.emit("message",d,!1),this._state=0,this.startLoop(a)}))}}controlMessage(a,b){if(8===this._opcode){if(0===a.length)this._loop=!1,this.emit("conclude",1005,g),this.end();else{let c=a.readUInt16BE(0);if(!m(c))return void b(this.createError(RangeError,`invalid status code ${c}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE"));let d=new o(a.buffer,a.byteOffset+2,a.length-2);if(!this._skipUTF8Validation&&!n(d))return void b(this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8"));this._loop=!1,this.emit("conclude",c,d),this.end()}this._state=0;return}this._allowSynchronousEvents?(this.emit(9===this._opcode?"ping":"pong",a),this._state=0):(this._state=6,setImmediate(()=>{this.emit(9===this._opcode?"ping":"pong",a),this._state=0,this.startLoop(b)}))}createError(a,b,c,d,e){this._loop=!1,this._errored=!0;let f=new a(c?`Invalid WebSocket frame: ${b}`:b);return Error.captureStackTrace(f,this.createError),f.code=e,f[h]=d,f}}},71387,(a,b,c)=>{"use strict";let d,{Duplex:e}=a.r(88947),{randomFillSync:f}=a.r(54799),g=a.r(10976),{EMPTY_BUFFER:h,kWebSocket:i,NOOP:j}=a.r(17376),{isBlob:k,isValidStatusCode:l}=a.r(88686),{mask:m,toBuffer:n}=a.r(29618),o=Symbol("kByteLength"),p=Buffer.alloc(4),q=8192;class r{constructor(a,b,c){this._extensions=b||{},c&&(this._generateMask=c,this._maskBuffer=Buffer.alloc(4)),this._socket=a,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=j,this[i]=void 0}static frame(a,b){let c,e,g=!1,h=2,i=!1;b.mask&&(c=b.maskBuffer||p,b.generateMask?b.generateMask(c):(8192===q&&(void 0===d&&(d=Buffer.alloc(8192)),f(d,0,8192),q=0),c[0]=d[q++],c[1]=d[q++],c[2]=d[q++],c[3]=d[q++]),i=(c[0]|c[1]|c[2]|c[3])==0,h=6),"string"==typeof a?e=(!b.mask||i)&&void 0!==b[o]?b[o]:(a=Buffer.from(a)).length:(e=a.length,g=b.mask&&b.readOnly&&!i);let j=e;e>=65536?(h+=8,j=127):e>125&&(h+=2,j=126);let k=Buffer.allocUnsafe(g?e+h:h);return(k[0]=b.fin?128|b.opcode:b.opcode,b.rsv1&&(k[0]|=64),k[1]=j,126===j?k.writeUInt16BE(e,2):127===j&&(k[2]=k[3]=0,k.writeUIntBE(e,4,6)),b.mask)?(k[1]|=128,k[h-4]=c[0],k[h-3]=c[1],k[h-2]=c[2],k[h-1]=c[3],i)?[k,a]:g?(m(a,c,k,h,e),[k]):(m(a,c,a,0,e),[k,a]):[k,a]}close(a,b,c,d){let e;if(void 0===a)e=h;else if("number"==typeof a&&l(a))if(void 0!==b&&b.length){let c=Buffer.byteLength(b);if(c>123)throw RangeError("The message must not be greater than 123 bytes");(e=Buffer.allocUnsafe(2+c)).writeUInt16BE(a,0),"string"==typeof b?e.write(b,2):e.set(b,2)}else(e=Buffer.allocUnsafe(2)).writeUInt16BE(a,0);else throw TypeError("First argument must be a valid error code number");let f={[o]:e.length,fin:!0,generateMask:this._generateMask,mask:c,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};0!==this._state?this.enqueue([this.dispatch,e,!1,f,d]):this.sendFrame(r.frame(e,f),d)}ping(a,b,c){let d,e;if("string"==typeof a?(d=Buffer.byteLength(a),e=!1):k(a)?(d=a.size,e=!1):(d=(a=n(a)).length,e=n.readOnly),d>125)throw RangeError("The data size must not be greater than 125 bytes");let f={[o]:d,fin:!0,generateMask:this._generateMask,mask:b,maskBuffer:this._maskBuffer,opcode:9,readOnly:e,rsv1:!1};k(a)?0!==this._state?this.enqueue([this.getBlobData,a,!1,f,c]):this.getBlobData(a,!1,f,c):0!==this._state?this.enqueue([this.dispatch,a,!1,f,c]):this.sendFrame(r.frame(a,f),c)}pong(a,b,c){let d,e;if("string"==typeof a?(d=Buffer.byteLength(a),e=!1):k(a)?(d=a.size,e=!1):(d=(a=n(a)).length,e=n.readOnly),d>125)throw RangeError("The data size must not be greater than 125 bytes");let f={[o]:d,fin:!0,generateMask:this._generateMask,mask:b,maskBuffer:this._maskBuffer,opcode:10,readOnly:e,rsv1:!1};k(a)?0!==this._state?this.enqueue([this.getBlobData,a,!1,f,c]):this.getBlobData(a,!1,f,c):0!==this._state?this.enqueue([this.dispatch,a,!1,f,c]):this.sendFrame(r.frame(a,f),c)}send(a,b,c){let d,e,f=this._extensions[g.extensionName],h=b.binary?2:1,i=b.compress;"string"==typeof a?(d=Buffer.byteLength(a),e=!1):k(a)?(d=a.size,e=!1):(d=(a=n(a)).length,e=n.readOnly),this._firstFragment?(this._firstFragment=!1,i&&f&&f.params[f._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(i=d>=f._threshold),this._compress=i):(i=!1,h=0),b.fin&&(this._firstFragment=!0);let j={[o]:d,fin:b.fin,generateMask:this._generateMask,mask:b.mask,maskBuffer:this._maskBuffer,opcode:h,readOnly:e,rsv1:i};k(a)?0!==this._state?this.enqueue([this.getBlobData,a,this._compress,j,c]):this.getBlobData(a,this._compress,j,c):0!==this._state?this.enqueue([this.dispatch,a,this._compress,j,c]):this.dispatch(a,this._compress,j,c)}getBlobData(a,b,c,d){this._bufferedBytes+=c[o],this._state=2,a.arrayBuffer().then(a=>{if(this._socket.destroyed){let a=Error("The socket was closed while the blob was being read");process.nextTick(s,this,a,d);return}this._bufferedBytes-=c[o];let e=n(a);b?this.dispatch(e,b,c,d):(this._state=0,this.sendFrame(r.frame(e,c),d),this.dequeue())}).catch(a=>{process.nextTick(u,this,a,d)})}dispatch(a,b,c,d){if(!b)return void this.sendFrame(r.frame(a,c),d);let e=this._extensions[g.extensionName];this._bufferedBytes+=c[o],this._state=1,e.compress(a,c.fin,(a,b)=>{this._socket.destroyed?s(this,Error("The socket was closed while data was being compressed"),d):(this._bufferedBytes-=c[o],this._state=0,c.readOnly=!1,this.sendFrame(r.frame(b,c),d),this.dequeue())})}dequeue(){for(;0===this._state&&this._queue.length;){let a=this._queue.shift();this._bufferedBytes-=a[3][o],Reflect.apply(a[0],this,a.slice(1))}}enqueue(a){this._bufferedBytes+=a[3][o],this._queue.push(a)}sendFrame(a,b){2===a.length?(this._socket.cork(),this._socket.write(a[0]),this._socket.write(a[1],b),this._socket.uncork()):this._socket.write(a[0],b)}}function s(a,b,c){"function"==typeof c&&c(b);for(let c=0;c<a._queue.length;c++){let d=a._queue[c],e=d[d.length-1];"function"==typeof e&&e(b)}}function u(a,b,c){s(a,b,c),a.onerror(b)}b.exports=r},25936,(a,b,c)=>{"use strict";let{kForOnEventAttribute:d,kListener:e}=a.r(17376),f=Symbol("kCode"),g=Symbol("kData"),h=Symbol("kError"),i=Symbol("kMessage"),j=Symbol("kReason"),k=Symbol("kTarget"),l=Symbol("kType"),m=Symbol("kWasClean");class n{constructor(a){this[k]=null,this[l]=a}get target(){return this[k]}get type(){return this[l]}}Object.defineProperty(n.prototype,"target",{enumerable:!0}),Object.defineProperty(n.prototype,"type",{enumerable:!0});class o extends n{constructor(a,b={}){super(a),this[f]=void 0===b.code?0:b.code,this[j]=void 0===b.reason?"":b.reason,this[m]=void 0!==b.wasClean&&b.wasClean}get code(){return this[f]}get reason(){return this[j]}get wasClean(){return this[m]}}Object.defineProperty(o.prototype,"code",{enumerable:!0}),Object.defineProperty(o.prototype,"reason",{enumerable:!0}),Object.defineProperty(o.prototype,"wasClean",{enumerable:!0});class p extends n{constructor(a,b={}){super(a),this[h]=void 0===b.error?null:b.error,this[i]=void 0===b.message?"":b.message}get error(){return this[h]}get message(){return this[i]}}Object.defineProperty(p.prototype,"error",{enumerable:!0}),Object.defineProperty(p.prototype,"message",{enumerable:!0});class q extends n{constructor(a,b={}){super(a),this[g]=void 0===b.data?null:b.data}get data(){return this[g]}}function r(a,b,c){"object"==typeof a&&a.handleEvent?a.handleEvent.call(a,c):a.call(b,c)}Object.defineProperty(q.prototype,"data",{enumerable:!0}),b.exports={CloseEvent:o,ErrorEvent:p,Event:n,EventTarget:{addEventListener(a,b,c={}){let f;for(let f of this.listeners(a))if(!c[d]&&f[e]===b&&!f[d])return;if("message"===a)f=function(a,c){let d=new q("message",{data:c?a:a.toString()});d[k]=this,r(b,this,d)};else if("close"===a)f=function(a,c){let d=new o("close",{code:a,reason:c.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});d[k]=this,r(b,this,d)};else if("error"===a)f=function(a){let c=new p("error",{error:a,message:a.message});c[k]=this,r(b,this,c)};else{if("open"!==a)return;f=function(){let a=new n("open");a[k]=this,r(b,this,a)}}f[d]=!!c[d],f[e]=b,c.once?this.once(a,f):this.on(a,f)},removeEventListener(a,b){for(let c of this.listeners(a))if(c[e]===b&&!c[d]){this.removeListener(a,c);break}}},MessageEvent:q}},16193,(a,b,c)=>{"use strict";let{tokenChars:d}=a.r(88686);function e(a,b,c){void 0===a[b]?a[b]=[c]:a[b].push(c)}b.exports={format:function(a){return Object.keys(a).map(b=>{let c=a[b];return Array.isArray(c)||(c=[c]),c.map(a=>[b].concat(Object.keys(a).map(b=>{let c=a[b];return Array.isArray(c)||(c=[c]),c.map(a=>!0===a?b:`${b}=${a}`).join("; ")})).join("; ")).join(", ")}).join(", ")},parse:function(a){let b,c,f=Object.create(null),g=Object.create(null),h=!1,i=!1,j=!1,k=-1,l=-1,m=-1,n=0;for(;n<a.length;n++)if(l=a.charCodeAt(n),void 0===b)if(-1===m&&1===d[l])-1===k&&(k=n);else if(0!==n&&(32===l||9===l))-1===m&&-1!==k&&(m=n);else if(59===l||44===l){if(-1===k)throw SyntaxError(`Unexpected character at index ${n}`);-1===m&&(m=n);let c=a.slice(k,m);44===l?(e(f,c,g),g=Object.create(null)):b=c,k=m=-1}else throw SyntaxError(`Unexpected character at index ${n}`);else if(void 0===c)if(-1===m&&1===d[l])-1===k&&(k=n);else if(32===l||9===l)-1===m&&-1!==k&&(m=n);else if(59===l||44===l){if(-1===k)throw SyntaxError(`Unexpected character at index ${n}`);-1===m&&(m=n),e(g,a.slice(k,m),!0),44===l&&(e(f,b,g),g=Object.create(null),b=void 0),k=m=-1}else if(61===l&&-1!==k&&-1===m)c=a.slice(k,n),k=m=-1;else throw SyntaxError(`Unexpected character at index ${n}`);else if(i){if(1!==d[l])throw SyntaxError(`Unexpected character at index ${n}`);-1===k?k=n:h||(h=!0),i=!1}else if(j)if(1===d[l])-1===k&&(k=n);else if(34===l&&-1!==k)j=!1,m=n;else if(92===l)i=!0;else throw SyntaxError(`Unexpected character at index ${n}`);else if(34===l&&61===a.charCodeAt(n-1))j=!0;else if(-1===m&&1===d[l])-1===k&&(k=n);else if(-1!==k&&(32===l||9===l))-1===m&&(m=n);else if(59===l||44===l){if(-1===k)throw SyntaxError(`Unexpected character at index ${n}`);-1===m&&(m=n);let d=a.slice(k,m);h&&(d=d.replace(/\\/g,""),h=!1),e(g,c,d),44===l&&(e(f,b,g),g=Object.create(null),b=void 0),c=void 0,k=m=-1}else throw SyntaxError(`Unexpected character at index ${n}`);if(-1===k||j||32===l||9===l)throw SyntaxError("Unexpected end of input");-1===m&&(m=n);let o=a.slice(k,m);return void 0===b?e(f,o,g):(void 0===c?e(g,o,!0):h?e(g,c,o.replace(/\\/g,"")):e(g,c,o),e(f,b,g)),f}}},36705,(a,b,c)=>{"use strict";let d=a.r(27699),e=a.r(24836),f=a.r(21517),g=a.r(4446),h=a.r(55004),{randomBytes:i,createHash:j}=a.r(54799),{Duplex:k,Readable:l}=a.r(88947),{URL:m}=a.r(92509),n=a.r(10976),o=a.r(64386),p=a.r(71387),{isBlob:q}=a.r(88686),{BINARY_TYPES:r,EMPTY_BUFFER:s,GUID:u,kForOnEventAttribute:v,kListener:w,kStatusCode:x,kWebSocket:y,NOOP:z}=a.r(17376),{EventTarget:{addEventListener:A,removeEventListener:B}}=a.r(25936),{format:C,parse:D}=a.r(16193),{toBuffer:E}=a.r(29618),F=Symbol("kAborted"),G=[8,13],H=["CONNECTING","OPEN","CLOSING","CLOSED"],I=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class J extends d{constructor(a,b,c){super(),this._binaryType=r[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=s,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=J.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,null!==a?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,void 0===b?b=[]:Array.isArray(b)||("object"==typeof b&&null!==b?(c=b,b=[]):b=[b]),function a(b,c,d,g){let h,k,l,o,p={allowSynchronousEvents:!0,autoPong:!0,protocolVersion:G[1],maxPayload:0x6400000,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...g,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(b._autoPong=p.autoPong,!G.includes(p.protocolVersion))throw RangeError(`Unsupported protocol version: ${p.protocolVersion} (supported versions: ${G.join(", ")})`);if(c instanceof m)h=c;else try{h=new m(c)}catch(a){throw SyntaxError(`Invalid URL: ${c}`)}"http:"===h.protocol?h.protocol="ws:":"https:"===h.protocol&&(h.protocol="wss:"),b._url=h.href;let q="wss:"===h.protocol,r="ws+unix:"===h.protocol;if("ws:"===h.protocol||q||r?r&&!h.pathname?k="The URL's pathname is empty":h.hash&&(k="The URL contains a fragment identifier"):k='The URL\'s protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"',k){let a=SyntaxError(k);if(0!==b._redirects)return void K(b,a);throw a}let s=q?443:80,v=i(16).toString("base64"),w=q?e.request:f.request,x=new Set;if(p.createConnection=p.createConnection||(q?M:L),p.defaultPort=p.defaultPort||s,p.port=h.port||s,p.host=h.hostname.startsWith("[")?h.hostname.slice(1,-1):h.hostname,p.headers={...p.headers,"Sec-WebSocket-Version":p.protocolVersion,"Sec-WebSocket-Key":v,Connection:"Upgrade",Upgrade:"websocket"},p.path=h.pathname+h.search,p.timeout=p.handshakeTimeout,p.perMessageDeflate&&(l=new n(!0!==p.perMessageDeflate?p.perMessageDeflate:{},!1,p.maxPayload),p.headers["Sec-WebSocket-Extensions"]=C({[n.extensionName]:l.offer()})),d.length){for(let a of d){if("string"!=typeof a||!I.test(a)||x.has(a))throw SyntaxError("An invalid or duplicated subprotocol was specified");x.add(a)}p.headers["Sec-WebSocket-Protocol"]=d.join(",")}if(p.origin&&(p.protocolVersion<13?p.headers["Sec-WebSocket-Origin"]=p.origin:p.headers.Origin=p.origin),(h.username||h.password)&&(p.auth=`${h.username}:${h.password}`),r){let a=p.path.split(":");p.socketPath=a[0],p.path=a[1]}if(p.followRedirects){if(0===b._redirects){b._originalIpc=r,b._originalSecure=q,b._originalHostOrSocketPath=r?p.socketPath:h.host;let a=g&&g.headers;if(g={...g,headers:{}},a)for(let[b,c]of Object.entries(a))g.headers[b.toLowerCase()]=c}else if(0===b.listenerCount("redirect")){let a=r?!!b._originalIpc&&p.socketPath===b._originalHostOrSocketPath:!b._originalIpc&&h.host===b._originalHostOrSocketPath;a&&(!b._originalSecure||q)||(delete p.headers.authorization,delete p.headers.cookie,a||delete p.headers.host,p.auth=void 0)}p.auth&&!g.headers.authorization&&(g.headers.authorization="Basic "+Buffer.from(p.auth).toString("base64")),o=b._req=w(p),b._redirects&&b.emit("redirect",b.url,o)}else o=b._req=w(p);p.timeout&&o.on("timeout",()=>{N(b,o,"Opening handshake has timed out")}),o.on("error",a=>{null===o||o[F]||(o=b._req=null,K(b,a))}),o.on("response",e=>{let f=e.headers.location,h=e.statusCode;if(f&&p.followRedirects&&h>=300&&h<400){let e;if(++b._redirects>p.maxRedirects)return void N(b,o,"Maximum redirects exceeded");o.abort();try{e=new m(f,c)}catch(a){K(b,SyntaxError(`Invalid URL: ${f}`));return}a(b,e,d,g)}else b.emit("unexpected-response",o,e)||N(b,o,`Unexpected server response: ${e.statusCode}`)}),o.on("upgrade",(a,c,d)=>{let e;if(b.emit("upgrade",a),b.readyState!==J.CONNECTING)return;o=b._req=null;let f=a.headers.upgrade;if(void 0===f||"websocket"!==f.toLowerCase())return void N(b,c,"Invalid Upgrade header");let g=j("sha1").update(v+u).digest("base64");if(a.headers["sec-websocket-accept"]!==g)return void N(b,c,"Invalid Sec-WebSocket-Accept header");let h=a.headers["sec-websocket-protocol"];if(void 0!==h?x.size?x.has(h)||(e="Server sent an invalid subprotocol"):e="Server sent a subprotocol but none was requested":x.size&&(e="Server sent no subprotocol"),e)return void N(b,c,e);h&&(b._protocol=h);let i=a.headers["sec-websocket-extensions"];if(void 0!==i){let a;if(!l)return void N(b,c,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");try{a=D(i)}catch(a){N(b,c,"Invalid Sec-WebSocket-Extensions header");return}let d=Object.keys(a);if(1!==d.length||d[0]!==n.extensionName)return void N(b,c,"Server indicated an extension that was not requested");try{l.accept(a[n.extensionName])}catch(a){N(b,c,"Invalid Sec-WebSocket-Extensions header");return}b._extensions[n.extensionName]=l}b.setSocket(c,d,{allowSynchronousEvents:p.allowSynchronousEvents,generateMask:p.generateMask,maxPayload:p.maxPayload,skipUTF8Validation:p.skipUTF8Validation})}),p.finishRequest?p.finishRequest(o,b):o.end()}(this,a,b,c)):(this._autoPong=c.autoPong,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(a){r.includes(a)&&(this._binaryType=a,this._receiver&&(this._receiver._binaryType=a))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(a,b,c){let d=new o({allowSynchronousEvents:c.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:c.maxPayload,skipUTF8Validation:c.skipUTF8Validation}),e=new p(a,this._extensions,c.generateMask);this._receiver=d,this._sender=e,this._socket=a,d[y]=this,e[y]=this,a[y]=this,d.on("conclude",P),d.on("drain",Q),d.on("error",R),d.on("message",T),d.on("ping",U),d.on("pong",V),e.onerror=X,a.setTimeout&&a.setTimeout(0),a.setNoDelay&&a.setNoDelay(),b.length>0&&a.unshift(b),a.on("close",Z),a.on("data",$),a.on("end",_),a.on("error",aa),this._readyState=J.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=J.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[n.extensionName]&&this._extensions[n.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=J.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(a,b){if(this.readyState!==J.CLOSED){if(this.readyState===J.CONNECTING)return void N(this,this._req,"WebSocket was closed before the connection was established");if(this.readyState===J.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=J.CLOSING,this._sender.close(a,b,!this._isServer,a=>{!a&&(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Y(this)}}pause(){this.readyState!==J.CONNECTING&&this.readyState!==J.CLOSED&&(this._paused=!0,this._socket.pause())}ping(a,b,c){if(this.readyState===J.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");("function"==typeof a?(c=a,a=b=void 0):"function"==typeof b&&(c=b,b=void 0),"number"==typeof a&&(a=a.toString()),this.readyState!==J.OPEN)?O(this,a,c):(void 0===b&&(b=!this._isServer),this._sender.ping(a||s,b,c))}pong(a,b,c){if(this.readyState===J.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");("function"==typeof a?(c=a,a=b=void 0):"function"==typeof b&&(c=b,b=void 0),"number"==typeof a&&(a=a.toString()),this.readyState!==J.OPEN)?O(this,a,c):(void 0===b&&(b=!this._isServer),this._sender.pong(a||s,b,c))}resume(){this.readyState!==J.CONNECTING&&this.readyState!==J.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(a,b,c){if(this.readyState===J.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if("function"==typeof b&&(c=b,b={}),"number"==typeof a&&(a=a.toString()),this.readyState!==J.OPEN)return void O(this,a,c);let d={binary:"string"!=typeof a,mask:!this._isServer,compress:!0,fin:!0,...b};this._extensions[n.extensionName]||(d.compress=!1),this._sender.send(a||s,d,c)}terminate(){if(this.readyState!==J.CLOSED){if(this.readyState===J.CONNECTING)return void N(this,this._req,"WebSocket was closed before the connection was established");this._socket&&(this._readyState=J.CLOSING,this._socket.destroy())}}}function K(a,b){a._readyState=J.CLOSING,a._errorEmitted=!0,a.emit("error",b),a.emitClose()}function L(a){return a.path=a.socketPath,g.connect(a)}function M(a){return a.path=void 0,a.servername||""===a.servername||(a.servername=g.isIP(a.host)?"":a.host),h.connect(a)}function N(a,b,c){a._readyState=J.CLOSING;let d=Error(c);Error.captureStackTrace(d,N),b.setHeader?(b[F]=!0,b.abort(),b.socket&&!b.socket.destroyed&&b.socket.destroy(),process.nextTick(K,a,d)):(b.destroy(d),b.once("error",a.emit.bind(a,"error")),b.once("close",a.emitClose.bind(a)))}function O(a,b,c){if(b){let c=q(b)?b.size:E(b).length;a._socket?a._sender._bufferedBytes+=c:a._bufferedAmount+=c}if(c){let b=Error(`WebSocket is not open: readyState ${a.readyState} (${H[a.readyState]})`);process.nextTick(c,b)}}function P(a,b){let c=this[y];c._closeFrameReceived=!0,c._closeMessage=b,c._closeCode=a,void 0!==c._socket[y]&&(c._socket.removeListener("data",$),process.nextTick(W,c._socket),1005===a?c.close():c.close(a,b))}function Q(){let a=this[y];a.isPaused||a._socket.resume()}function R(a){let b=this[y];void 0!==b._socket[y]&&(b._socket.removeListener("data",$),process.nextTick(W,b._socket),b.close(a[x])),b._errorEmitted||(b._errorEmitted=!0,b.emit("error",a))}function S(){this[y].emitClose()}function T(a,b){this[y].emit("message",a,b)}function U(a){let b=this[y];b._autoPong&&b.pong(a,!this._isServer,z),b.emit("ping",a)}function V(a){this[y].emit("pong",a)}function W(a){a.resume()}function X(a){let b=this[y];b.readyState!==J.CLOSED&&(b.readyState===J.OPEN&&(b._readyState=J.CLOSING,Y(b)),this._socket.end(),b._errorEmitted||(b._errorEmitted=!0,b.emit("error",a)))}function Y(a){a._closeTimer=setTimeout(a._socket.destroy.bind(a._socket),3e4)}function Z(){let a,b=this[y];this.removeListener("close",Z),this.removeListener("data",$),this.removeListener("end",_),b._readyState=J.CLOSING,this._readableState.endEmitted||b._closeFrameReceived||b._receiver._writableState.errorEmitted||null===(a=b._socket.read())||b._receiver.write(a),b._receiver.end(),this[y]=void 0,clearTimeout(b._closeTimer),b._receiver._writableState.finished||b._receiver._writableState.errorEmitted?b.emitClose():(b._receiver.on("error",S),b._receiver.on("finish",S))}function $(a){this[y]._receiver.write(a)||this.pause()}function _(){let a=this[y];a._readyState=J.CLOSING,a._receiver.end(),this.end()}function aa(){let a=this[y];this.removeListener("error",aa),this.on("error",z),a&&(a._readyState=J.CLOSING,this.destroy())}Object.defineProperty(J,"CONNECTING",{enumerable:!0,value:H.indexOf("CONNECTING")}),Object.defineProperty(J.prototype,"CONNECTING",{enumerable:!0,value:H.indexOf("CONNECTING")}),Object.defineProperty(J,"OPEN",{enumerable:!0,value:H.indexOf("OPEN")}),Object.defineProperty(J.prototype,"OPEN",{enumerable:!0,value:H.indexOf("OPEN")}),Object.defineProperty(J,"CLOSING",{enumerable:!0,value:H.indexOf("CLOSING")}),Object.defineProperty(J.prototype,"CLOSING",{enumerable:!0,value:H.indexOf("CLOSING")}),Object.defineProperty(J,"CLOSED",{enumerable:!0,value:H.indexOf("CLOSED")}),Object.defineProperty(J.prototype,"CLOSED",{enumerable:!0,value:H.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(a=>{Object.defineProperty(J.prototype,a,{enumerable:!0})}),["open","error","close","message"].forEach(a=>{Object.defineProperty(J.prototype,`on${a}`,{enumerable:!0,get(){for(let b of this.listeners(a))if(b[v])return b[w];return null},set(b){for(let b of this.listeners(a))if(b[v]){this.removeListener(a,b);break}"function"==typeof b&&this.addEventListener(a,b,{[v]:!0})}})}),J.prototype.addEventListener=A,J.prototype.removeEventListener=B,b.exports=J},57515,(a,b,c)=>{"use strict";a.r(36705);let{Duplex:d}=a.r(88947);function e(a){a.emit("close")}function f(){!this.destroyed&&this._writableState.finished&&this.destroy()}function g(a){this.removeListener("error",g),this.destroy(),0===this.listenerCount("error")&&this.emit("error",a)}b.exports=function(a,b){let c=!0,h=new d({...b,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return a.on("message",function(b,c){let d=!c&&h._readableState.objectMode?b.toString():b;h.push(d)||a.pause()}),a.once("error",function(a){h.destroyed||(c=!1,h.destroy(a))}),a.once("close",function(){h.destroyed||h.push(null)}),h._destroy=function(b,d){if(a.readyState===a.CLOSED){d(b),process.nextTick(e,h);return}let f=!1;a.once("error",function(a){f=!0,d(a)}),a.once("close",function(){f||d(b),process.nextTick(e,h)}),c&&a.terminate()},h._final=function(b){a.readyState===a.CONNECTING?a.once("open",function(){h._final(b)}):null!==a._socket&&(a._socket._writableState.finished?(b(),h._readableState.endEmitted&&h.destroy()):(a._socket.once("finish",function(){b()}),a.close()))},h._read=function(){a.isPaused&&a.resume()},h._write=function(b,c,d){a.readyState===a.CONNECTING?a.once("open",function(){h._write(b,c,d)}):a.send(b,d)},h.on("end",f),h.on("error",g),h}},62219,(a,b,c)=>{"use strict";let{tokenChars:d}=a.r(88686);b.exports={parse:function(a){let b=new Set,c=-1,e=-1,f=0;for(;f<a.length;f++){let g=a.charCodeAt(f);if(-1===e&&1===d[g])-1===c&&(c=f);else if(0!==f&&(32===g||9===g))-1===e&&-1!==c&&(e=f);else if(44===g){if(-1===c)throw SyntaxError(`Unexpected character at index ${f}`);-1===e&&(e=f);let d=a.slice(c,e);if(b.has(d))throw SyntaxError(`The "${d}" subprotocol is duplicated`);b.add(d),c=e=-1}else throw SyntaxError(`Unexpected character at index ${f}`)}if(-1===c||-1!==e)throw SyntaxError("Unexpected end of input");let g=a.slice(c,f);if(b.has(g))throw SyntaxError(`The "${g}" subprotocol is duplicated`);return b.add(g),b}}},67691,(a,b,c)=>{"use strict";let d=a.r(27699),e=a.r(21517),{Duplex:f}=a.r(88947),{createHash:g}=a.r(54799),h=a.r(16193),i=a.r(10976),j=a.r(62219),k=a.r(36705),{GUID:l,kWebSocket:m}=a.r(17376),n=/^[+/0-9A-Za-z]{22}==$/;function o(a){a._state=2,a.emit("close")}function p(){this.destroy()}function q(a,b,c,d){c=c||e.STATUS_CODES[b],d={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(c),...d},a.once("finish",a.destroy),a.end(`HTTP/1.1 ${b} ${e.STATUS_CODES[b]}\r
32
- `+Object.keys(d).map(a=>`${a}: ${d[a]}`).join("\r\n")+"\r\n\r\n"+c)}function r(a,b,c,d,e,f){if(a.listenerCount("wsClientError")){let d=Error(e);Error.captureStackTrace(d,r),a.emit("wsClientError",d,c,b)}else q(c,d,e,f)}b.exports=class extends d{constructor(a,b){if(super(),null==(a={allowSynchronousEvents:!0,autoPong:!0,maxPayload:0x6400000,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:k,...a}).port&&!a.server&&!a.noServer||null!=a.port&&(a.server||a.noServer)||a.server&&a.noServer)throw TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(null!=a.port?(this._server=e.createServer((a,b)=>{let c=e.STATUS_CODES[426];b.writeHead(426,{"Content-Length":c.length,"Content-Type":"text/plain"}),b.end(c)}),this._server.listen(a.port,a.host,a.backlog,b)):a.server&&(this._server=a.server),this._server){const a=this.emit.bind(this,"connection");this._removeListeners=function(a,b){for(let c of Object.keys(b))a.on(c,b[c]);return function(){for(let c of Object.keys(b))a.removeListener(c,b[c])}}(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(b,c,d)=>{this.handleUpgrade(b,c,d,a)}})}!0===a.perMessageDeflate&&(a.perMessageDeflate={}),a.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=a,this._state=0}address(){if(this.options.noServer)throw Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(a){if(2===this._state){a&&this.once("close",()=>{a(Error("The server is not running"))}),process.nextTick(o,this);return}if(a&&this.once("close",a),1!==this._state)if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(o,this);else{let a=this._server;this._removeListeners(),this._removeListeners=this._server=null,a.close(()=>{o(this)})}}shouldHandle(a){if(this.options.path){let b=a.url.indexOf("?");if((-1!==b?a.url.slice(0,b):a.url)!==this.options.path)return!1}return!0}handleUpgrade(a,b,c,d){b.on("error",p);let e=a.headers["sec-websocket-key"],f=a.headers.upgrade,g=+a.headers["sec-websocket-version"];if("GET"!==a.method)return void r(this,a,b,405,"Invalid HTTP method");if(void 0===f||"websocket"!==f.toLowerCase())return void r(this,a,b,400,"Invalid Upgrade header");if(void 0===e||!n.test(e))return void r(this,a,b,400,"Missing or invalid Sec-WebSocket-Key header");if(13!==g&&8!==g)return void r(this,a,b,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});if(!this.shouldHandle(a))return void q(b,400);let k=a.headers["sec-websocket-protocol"],l=new Set;if(void 0!==k)try{l=j.parse(k)}catch(c){r(this,a,b,400,"Invalid Sec-WebSocket-Protocol header");return}let m=a.headers["sec-websocket-extensions"],o={};if(this.options.perMessageDeflate&&void 0!==m){let c=new i(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let a=h.parse(m);a[i.extensionName]&&(c.accept(a[i.extensionName]),o[i.extensionName]=c)}catch(c){r(this,a,b,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let f={origin:a.headers[`${8===g?"sec-websocket-origin":"origin"}`],secure:!!(a.socket.authorized||a.socket.encrypted),req:a};if(2===this.options.verifyClient.length)return void this.options.verifyClient(f,(f,g,h,i)=>{if(!f)return q(b,g||401,h,i);this.completeUpgrade(o,e,l,a,b,c,d)});if(!this.options.verifyClient(f))return q(b,401)}this.completeUpgrade(o,e,l,a,b,c,d)}completeUpgrade(a,b,c,d,e,f,j){if(!e.readable||!e.writable)return e.destroy();if(e[m])throw Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return q(e,503);let k=g("sha1").update(b+l).digest("base64"),n=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${k}`],r=new this.options.WebSocket(null,void 0,this.options);if(c.size){let a=this.options.handleProtocols?this.options.handleProtocols(c,d):c.values().next().value;a&&(n.push(`Sec-WebSocket-Protocol: ${a}`),r._protocol=a)}if(a[i.extensionName]){let b=a[i.extensionName].params,c=h.format({[i.extensionName]:[b]});n.push(`Sec-WebSocket-Extensions: ${c}`),r._extensions=a}this.emit("headers",n,d),e.write(n.concat("\r\n").join("\r\n")),e.removeListener("error",p),r.setSocket(e,f,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(r),r.on("close",()=>{this.clients.delete(r),this._shouldEmitClose&&!this.clients.size&&process.nextTick(o,this)})),j(r,d)}}},83915,a=>{"use strict";let b,c,d;var e,f,g=a.i(63047);let h=Object.create(null);h.open="0",h.close="1",h.ping="2",h.pong="3",h.message="4",h.upgrade="5",h.noop="6";let i=Object.create(null);Object.keys(h).forEach(a=>{i[h[a]]=a});let j={type:"error",data:"parser error"},k=({type:a,data:b},c,d)=>d(b instanceof ArrayBuffer||ArrayBuffer.isView(b)?c?b:"b"+l(b,!0).toString("base64"):h[a]+(b||"")),l=(a,b)=>Buffer.isBuffer(a)||a instanceof Uint8Array&&!b?a:a instanceof ArrayBuffer?Buffer.from(a):Buffer.from(a.buffer,a.byteOffset,a.byteLength),m=(a,b)=>{if("string"!=typeof a)return{type:"message",data:n(a,b)};let c=a.charAt(0);return"b"===c?{type:"message",data:n(Buffer.from(a.substring(1),"base64"),b)}:i[c]?a.length>1?{type:i[c],data:a.substring(1)}:{type:i[c]}:j},n=(a,b)=>"arraybuffer"===b?a instanceof ArrayBuffer?a:Buffer.isBuffer(a)?a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength):a.buffer:Buffer.isBuffer(a)?a:Buffer.from(a);function o(a){return a.reduce((a,b)=>a+b.length,0)}function p(a,b){if(a[0].length===b)return a.shift();let c=new Uint8Array(b),d=0;for(let e=0;e<b;e++)c[e]=a[0][d++],d===a[0].length&&(a.shift(),d=0);return a.length&&d<a[0].length&&(a[0]=a[0].slice(d)),c}function q(a){if(a){var b=a;for(var c in q.prototype)b[c]=q.prototype[c];return b}}q.prototype.on=q.prototype.addEventListener=function(a,b){return this._callbacks=this._callbacks||{},(this._callbacks["$"+a]=this._callbacks["$"+a]||[]).push(b),this},q.prototype.once=function(a,b){function c(){this.off(a,c),b.apply(this,arguments)}return c.fn=b,this.on(a,c),this},q.prototype.off=q.prototype.removeListener=q.prototype.removeAllListeners=q.prototype.removeEventListener=function(a,b){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var c,d=this._callbacks["$"+a];if(!d)return this;if(1==arguments.length)return delete this._callbacks["$"+a],this;for(var e=0;e<d.length;e++)if((c=d[e])===b||c.fn===b){d.splice(e,1);break}return 0===d.length&&delete this._callbacks["$"+a],this},q.prototype.emit=function(a){this._callbacks=this._callbacks||{};for(var b=Array(arguments.length-1),c=this._callbacks["$"+a],d=1;d<arguments.length;d++)b[d-1]=arguments[d];if(c){c=c.slice(0);for(var d=0,e=c.length;d<e;++d)c[d].apply(this,b)}return this},q.prototype.emitReserved=q.prototype.emit,q.prototype.listeners=function(a){return this._callbacks=this._callbacks||{},this._callbacks["$"+a]||[]},q.prototype.hasListeners=function(a){return!!this.listeners(a).length};let r=process.nextTick,s=a.g;class u{constructor(){this._cookies=new Map}parseCookies(a){a&&a.forEach(a=>{let b=function(a){let b=a.split("; "),c=b[0].indexOf("=");if(-1===c)return;let d=b[0].substring(0,c).trim();if(!d.length)return;let e=b[0].substring(c+1).trim();34===e.charCodeAt(0)&&(e=e.slice(1,-1));let f={name:d,value:e};for(let a=1;a<b.length;a++){let c=b[a].split("=");if(2!==c.length)continue;let d=c[0].trim(),e=c[1].trim();switch(d){case"Expires":f.expires=new Date(e);break;case"Max-Age":let g=new Date;g.setUTCSeconds(g.getUTCSeconds()+parseInt(e,10)),f.expires=g}}return f}(a);b&&this._cookies.set(b.name,b)})}get cookies(){let a=Date.now();return this._cookies.forEach((b,c)=>{var d;(null==(d=b.expires)?void 0:d.getTime())<a&&this._cookies.delete(c)}),this._cookies.entries()}addCookies(a){let b=[];for(let[a,c]of this.cookies)b.push(`${a}=${c.value}`);b.length&&(a.setDisableHeaderCheck(!0),a.setRequestHeader("cookie",b.join("; ")))}appendCookies(a){for(let[b,c]of this.cookies)a.append("cookie",`${b}=${c.value}`)}}function v(a,...b){return b.reduce((b,c)=>(a.hasOwnProperty(c)&&(b[c]=a[c]),b),{})}let w=s.setTimeout,x=s.clearTimeout;function y(a,b){b.useNativeTimers?(a.setTimeoutFn=w.bind(s),a.clearTimeoutFn=x.bind(s)):(a.setTimeoutFn=s.setTimeout.bind(s),a.clearTimeoutFn=s.clearTimeout.bind(s))}function z(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}var A=a.i(35290);let B=(0,A.default)("engine.io-client:transport");class C extends Error{constructor(a,b,c){super(a),this.description=b,this.context=c,this.type="TransportError"}}class D extends q{constructor(a){super(),this.writable=!1,y(this,a),this.opts=a,this.query=a.query,this.socket=a.socket,this.supportsBinary=!a.forceBase64}onError(a,b,c){return super.emitReserved("error",new C(a,b,c)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return("opening"===this.readyState||"open"===this.readyState)&&(this.doClose(),this.onClose()),this}send(a){"open"===this.readyState?this.write(a):B("transport is not open, discarding packets")}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(a){let b=m(a,this.socket.binaryType);this.onPacket(b)}onPacket(a){super.emitReserved("packet",a)}onClose(a){this.readyState="closed",super.emitReserved("close",a)}pause(a){}createUri(a,b={}){return a+"://"+this._hostname()+this._port()+this.opts.path+this._query(b)}_hostname(){let a=this.opts.hostname;return -1===a.indexOf(":")?a:"["+a+"]"}_port(){return this.opts.port&&(this.opts.secure&&443!==Number(this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(a){let b=function(a){let b="";for(let c in a)a.hasOwnProperty(c)&&(b.length&&(b+="&"),b+=encodeURIComponent(c)+"="+encodeURIComponent(a[c]));return b}(a);return b.length?"?"+b:""}}let E=(0,A.default)("engine.io-client:polling");class F extends D{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(a){this.readyState="pausing";let b=()=>{E("paused"),this.readyState="paused",a()};if(this._polling||!this.writable){let a=0;this._polling&&(E("we are currently polling - waiting to pause"),a++,this.once("pollComplete",function(){E("pre-pause polling complete"),--a||b()})),this.writable||(E("we are currently writing - waiting to pause"),a++,this.once("drain",function(){E("pre-pause writing complete"),--a||b()}))}else b()}_poll(){E("polling"),this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(a){E("polling got data %s",a);let b=a=>{if("opening"===this.readyState&&"open"===a.type&&this.onOpen(),"close"===a.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(a)};((a,b)=>{let c=a.split("\x1e"),d=[];for(let a=0;a<c.length;a++){let e=m(c[a],b);if(d.push(e),"error"===e.type)break}return d})(a,this.socket.binaryType).forEach(b),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState?this._poll():E('ignoring poll - transport state "%s"',this.readyState))}doClose(){let a=()=>{E("writing close packet"),this.write([{type:"close"}])};"open"===this.readyState?(E("transport open - closing"),a()):(E("transport not open - deferring close"),this.once("open",a))}write(a){var b;let c,d,e;this.writable=!1,b=a=>{this.doWrite(a,()=>{this.writable=!0,this.emitReserved("drain")})},d=Array(c=a.length),e=0,a.forEach((a,f)=>{k(a,!1,a=>{d[f]=a,++e===c&&b(d.join("\x1e"))})})}uri(){let a=this.opts.secure?"https":"http",b=this.query||{};return!1!==this.opts.timestampRequests&&(b[this.opts.timestampParam]=z()),this.supportsBinary||b.sid||(b.b64=1),this.createUri(a,b)}}let G=!1;try{G="u">typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(a){}let H=G,I=(0,A.default)("engine.io-client:polling");function J(){}class K extends F{constructor(a){if(super(a),"u">typeof location){const b="https:"===location.protocol;let c=location.port;c||(c=b?"443":"80"),this.xd="u">typeof location&&a.hostname!==location.hostname||c!==a.port}}doWrite(a,b){let c=this.request({method:"POST",data:a});c.on("success",b),c.on("error",(a,b)=>{this.onError("xhr post error",a,b)})}doPoll(){I("xhr poll");let a=this.request();a.on("data",this.onData.bind(this)),a.on("error",(a,b)=>{this.onError("xhr poll error",a,b)}),this.pollXhr=a}}class L extends q{constructor(a,b,c){super(),this.createRequest=a,y(this,c),this._opts=c,this._method=c.method||"GET",this._uri=b,this._data=void 0!==c.data?c.data:null,this._create()}_create(){var a;let b=v(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");b.xdomain=!!this._opts.xd;let c=this._xhr=this.createRequest(b);try{I("xhr open %s: %s",this._method,this._uri),c.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders)for(let a in c.setDisableHeaderCheck&&c.setDisableHeaderCheck(!0),this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(a)&&c.setRequestHeader(a,this._opts.extraHeaders[a])}catch(a){}if("POST"===this._method)try{c.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(a){}try{c.setRequestHeader("Accept","*/*")}catch(a){}null==(a=this._opts.cookieJar)||a.addCookies(c),"withCredentials"in c&&(c.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(c.timeout=this._opts.requestTimeout),c.onreadystatechange=()=>{var a;3===c.readyState&&(null==(a=this._opts.cookieJar)||a.parseCookies(c.getResponseHeader("set-cookie"))),4===c.readyState&&(200===c.status||1223===c.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof c.status?c.status:0)},0))},I("xhr data %s",this._data),c.send(this._data)}catch(a){this.setTimeoutFn(()=>{this._onError(a)},0);return}"u">typeof document&&(this._index=L.requestsCount++,L.requests[this._index]=this)}_onError(a){this.emitReserved("error",a,this._xhr),this._cleanup(!0)}_cleanup(a){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=J,a)try{this._xhr.abort()}catch(a){}"u">typeof document&&delete L.requests[this._index],this._xhr=null}}_onLoad(){let a=this._xhr.responseText;null!==a&&(this.emitReserved("data",a),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}function M(){for(let a in L.requests)L.requests.hasOwnProperty(a)&&L.requests[a].abort()}L.requestsCount=0,L.requests={},"u">typeof document&&("function"==typeof attachEvent?attachEvent("onunload",M):"function"==typeof addEventListener&&addEventListener("onpagehide"in s?"pagehide":"unload",M,!1)),(d=function(a){let b=a.xdomain;try{if("u">typeof XMLHttpRequest&&(!b||H))return new XMLHttpRequest}catch(a){}if(!b)try{return new s[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(a){}}({xdomain:!1}))&&d.responseType;let N=g.default||g;a.i(57515),a.i(64386),a.i(71387);var O=a.i(36705);a.i(67691),O.default;let P=(0,A.default)("engine.io-client:websocket"),Q="u">typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class R extends D{get name(){return"websocket"}doOpen(){let a=this.uri(),b=this.opts.protocols,c=Q?{}:v(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(c.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(a,b,c)}catch(a){return this.emitReserved("error",a)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=a=>this.onClose({description:"websocket connection closed",context:a}),this.ws.onmessage=a=>this.onData(a.data),this.ws.onerror=a=>this.onError("websocket error",a)}write(a){this.writable=!1;for(let b=0;b<a.length;b++){let c=a[b],d=b===a.length-1;k(c,this.supportsBinary,a=>{try{this.doWrite(c,a)}catch(a){P("websocket closed before onclose event")}d&&r(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let a=this.opts.secure?"wss":"ws",b=this.query||{};return this.opts.timestampRequests&&(b[this.opts.timestampParam]=z()),this.supportsBinary||(b.b64=1),this.createUri(a,b)}}s.WebSocket||s.MozWebSocket;let S=(0,A.default)("engine.io-client:webtransport"),T={websocket:class extends R{createSocket(a,b,c){var d;if(null==(d=this.socket)?void 0:d._cookieJar)for(let[a,b]of(c.headers=c.headers||{},c.headers.cookie="string"==typeof c.headers.cookie?[c.headers.cookie]:c.headers.cookie||[],this.socket._cookieJar.cookies))c.headers.cookie.push(`${a}=${b.value}`);return new O.default(a,b,c)}doWrite(a,b){let c={};a.options&&(c.compress=a.options.compress),this.opts.perMessageDeflate&&("string"==typeof b?Buffer.byteLength(b):b.length)<this.opts.perMessageDeflate.threshold&&(c.compress=!1),this.ws.send(b,c)}},webtransport:class extends D{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(a){return this.emitReserved("error",a)}this._transport.closed.then(()=>{S("transport closed gracefully"),this.onClose()}).catch(a=>{S("transport closed due to %s",a),this.onError("webtransport error",a)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(a=>{var d,e;let f,g,h,i,n=(d=Number.MAX_SAFE_INTEGER,e=this.socket.binaryType,c||(c=new TextDecoder),f=[],g=0,h=-1,i=!1,new TransformStream({transform(a,b){for(f.push(a);;){if(0===g){if(1>o(f))break;let a=p(f,1);i=(128&a[0])==128,g=(h=127&a[0])<126?3:126===h?1:2}else if(1===g){if(2>o(f))break;let a=p(f,2);h=new DataView(a.buffer,a.byteOffset,a.length).getUint16(0),g=3}else if(2===g){if(8>o(f))break;let a=p(f,8),c=new DataView(a.buffer,a.byteOffset,a.length),d=c.getUint32(0);if(d>2097151){b.enqueue(j);break}h=0x100000000*d+c.getUint32(4),g=3}else{if(o(f)<h)break;let a=p(f,h);b.enqueue(m(i?a:c.decode(a),e)),g=0}if(0===h||h>d){b.enqueue(j);break}}}})),q=a.readable.pipeThrough(n).getReader(),r=new TransformStream({transform(a,c){!function(a,c){if(a.data instanceof ArrayBuffer||ArrayBuffer.isView(a.data))return c(l(a.data,!1));k(a,!0,a=>{b||(b=new TextEncoder),c(b.encode(a))})}(a,b=>{let d,e=b.length;if(e<126)new DataView((d=new Uint8Array(1)).buffer).setUint8(0,e);else if(e<65536){let a=new DataView((d=new Uint8Array(3)).buffer);a.setUint8(0,126),a.setUint16(1,e)}else{let a=new DataView((d=new Uint8Array(9)).buffer);a.setUint8(0,127),a.setBigUint64(1,BigInt(e))}a.data&&"string"!=typeof a.data&&(d[0]|=128),c.enqueue(d),c.enqueue(b)})}});r.readable.pipeTo(a.writable),this._writer=r.writable.getWriter();let s=()=>{q.read().then(({done:a,value:b})=>{a?S("session is closed"):(S("received chunk: %o",b),this.onPacket(b),s())}).catch(a=>{S("an error occurred while reading: %s",a)})};s();let u={type:"open"};this.query.sid&&(u.data=`{"sid":"${this.query.sid}"}`),this._writer.write(u).then(()=>this.onOpen())})})}write(a){this.writable=!1;for(let b=0;b<a.length;b++){let c=a[b],d=b===a.length-1;this._writer.write(c).then(()=>{d&&r(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var a;null==(a=this._transport)||a.close()}},polling:class extends K{request(a={}){var b;return Object.assign(a,{xd:this.xd,cookieJar:null==(b=this.socket)?void 0:b._cookieJar},this.opts),new L(a=>new N(a),this.uri(),a)}}},U=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,V=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function W(a){var b,c;let d,e;if(a.length>8e3)throw"URI too long";let f=a,g=a.indexOf("["),h=a.indexOf("]");-1!=g&&-1!=h&&(a=a.substring(0,g)+a.substring(g,h).replace(/:/g,";")+a.substring(h,a.length));let i=U.exec(a||""),j={},k=14;for(;k--;)j[V[k]]=i[k]||"";return -1!=g&&-1!=h&&(j.source=f,j.host=j.host.substring(1,j.host.length-1).replace(/;/g,":"),j.authority=j.authority.replace("[","").replace("]","").replace(/;/g,":"),j.ipv6uri=!0),d=(b=j.path).replace(/\/{2,9}/g,"/").split("/"),("/"==b.slice(0,1)||0===b.length)&&d.splice(0,1),"/"==b.slice(-1)&&d.splice(d.length-1,1),j.pathNames=d,c=j.query,e={},c.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(a,b,c){b&&(e[b]=c)}),j.queryKey=e,j}let X=(0,A.default)("engine.io-client:socket"),Y="function"==typeof addEventListener&&"function"==typeof removeEventListener,Z=[];Y&&addEventListener("offline",()=>{X("closing %d connection(s) because the network was lost",Z.length),Z.forEach(a=>a())},!1);class $ extends q{constructor(a,b){if(super(),this.binaryType="nodebuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,a&&"object"==typeof a&&(b=a,a=null),a){const c=W(a);b.hostname=c.host,b.secure="https"===c.protocol||"wss"===c.protocol,b.port=c.port,c.query&&(b.query=c.query)}else b.host&&(b.hostname=W(b.host).host);y(this,b),this.secure=null!=b.secure?b.secure:"u">typeof location&&"https:"===location.protocol,b.hostname&&!b.port&&(b.port=this.secure?"443":"80"),this.hostname=b.hostname||("u">typeof location?location.hostname:"localhost"),this.port=b.port||("u">typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},b.transports.forEach(a=>{let b=a.prototype.name;this.transports.push(b),this._transportsByName[b]=a}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},b),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(a){let b={},c=a.split("&");for(let a=0,d=c.length;a<d;a++){let d=c[a].split("=");b[decodeURIComponent(d[0])]=decodeURIComponent(d[1])}return b}(this.opts.query)),Y&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(X("adding listener for the 'offline' event"),this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Z.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=new u),this._open()}createTransport(a){X('creating transport "%s"',a);let b=Object.assign({},this.opts.query);b.EIO=4,b.transport=a,this.id&&(b.sid=this.id);let c=Object.assign({},this.opts,{query:b,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[a]);return X("options: %j",c),new this._transportsByName[a](c)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);let a=this.opts.rememberUpgrade&&$.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";let b=this.createTransport(a);b.open(),this.setTransport(b)}setTransport(a){X("setting transport %s",a.name),this.transport&&(X("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=a,a.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",a=>this._onClose("transport close",a))}onOpen(){X("socket open"),this.readyState="open",$.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(a){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(X('socket receive: type "%s", data "%s"',a.type,a.data),this.emitReserved("packet",a),this.emitReserved("heartbeat"),a.type){case"open":this.onHandshake(JSON.parse(a.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let b=Error("server error");b.code=a.data,this._onError(b);break;case"message":this.emitReserved("data",a.data),this.emitReserved("message",a.data)}else X('packet received with socket readyState "%s"',this.readyState)}onHandshake(a){this.emitReserved("handshake",a),this.id=a.sid,this.transport.query.sid=a.sid,this._pingInterval=a.pingInterval,this._pingTimeout=a.pingTimeout,this._maxPayload=a.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let a=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+a,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},a),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let a=this._getWritablePackets();X("flushing %d packets in socket",a.length),this.transport.send(a),this._prevBufferLen=a.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let a=1;for(let b=0;b<this.writeBuffer.length;b++){let c=this.writeBuffer[b].data;if(c&&(a+="string"==typeof c?function(a){let b=0,c=0;for(let d=0,e=a.length;d<e;d++)(b=a.charCodeAt(d))<128?c+=1:b<2048?c+=2:b<55296||b>=57344?c+=3:(d++,c+=4);return c}(c):Math.ceil(1.33*(c.byteLength||c.size))),b>0&&a>this._maxPayload)return X("only send %d out of %d packets",b,this.writeBuffer.length),this.writeBuffer.slice(0,b);a+=2}return X("payload size is %d (max: %d)",a,this._maxPayload),this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let a=Date.now()>this._pingTimeoutTime;return a&&(X("throttled timer detected, scheduling connection close"),this._pingTimeoutTime=0,r(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),a}write(a,b,c){return this._sendPacket("message",a,b,c),this}send(a,b,c){return this._sendPacket("message",a,b,c),this}_sendPacket(a,b,c,d){if("function"==typeof b&&(d=b,b=void 0),"function"==typeof c&&(d=c,c=null),"closing"===this.readyState||"closed"===this.readyState)return;(c=c||{}).compress=!1!==c.compress;let e={type:a,data:b,options:c};this.emitReserved("packetCreate",e),this.writeBuffer.push(e),d&&this.once("flush",d),this.flush()}close(){let a=()=>{this._onClose("forced close"),X("socket closing - telling transport to close"),this.transport.close()},b=()=>{this.off("upgrade",b),this.off("upgradeError",b),a()},c=()=>{this.once("upgrade",b),this.once("upgradeError",b)};return("opening"===this.readyState||"open"===this.readyState)&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?c():a()}):this.upgrading?c():a()),this}_onError(a){if(X("socket error %j",a),$.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return X("trying next transport"),this.transports.shift(),this._open();this.emitReserved("error",a),this._onClose("transport error",a)}_onClose(a,b){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(X('socket close with reason: "%s"',a),this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Y&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let a=Z.indexOf(this._offlineEventListener);-1!==a&&(X("removing listener for the 'offline' event"),Z.splice(a,1))}this.readyState="closed",this.id=null,this.emitReserved("close",a,b),this.writeBuffer=[],this._prevBufferLen=0}}}$.protocol=4;class _ extends ${constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade){X("starting upgrade probes");for(let a=0;a<this._upgrades.length;a++)this._probe(this._upgrades[a])}}_probe(a){X('probing transport "%s"',a);let b=this.createTransport(a),c=!1;$.priorWebsocketSuccess=!1;let d=()=>{c||(X('probe transport "%s" opened',a),b.send([{type:"ping",data:"probe"}]),b.once("packet",d=>{if(!c)if("pong"===d.type&&"probe"===d.data){if(X('probe transport "%s" pong',a),this.upgrading=!0,this.emitReserved("upgrading",b),!b)return;$.priorWebsocketSuccess="websocket"===b.name,X('pausing current transport "%s"',this.transport.name),this.transport.pause(()=>{c||"closed"!==this.readyState&&(X("changing transport and sending upgrade packet"),j(),this.setTransport(b),b.send([{type:"upgrade"}]),this.emitReserved("upgrade",b),b=null,this.upgrading=!1,this.flush())})}else{X('probe transport "%s" failed',a);let c=Error("probe error");c.transport=b.name,this.emitReserved("upgradeError",c)}}))};function e(){c||(c=!0,j(),b.close(),b=null)}let f=c=>{let d=Error("probe error: "+c);d.transport=b.name,e(),X('probe transport "%s" failed because of error: %s',a,c),this.emitReserved("upgradeError",d)};function g(){f("transport closed")}function h(){f("socket closed")}function i(a){b&&a.name!==b.name&&(X('"%s" works - aborting "%s"',a.name,b.name),e())}let j=()=>{b.removeListener("open",d),b.removeListener("error",f),b.removeListener("close",g),this.off("close",h),this.off("upgrading",i)};b.once("open",d),b.once("error",f),b.once("close",g),this.once("close",h),this.once("upgrading",i),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==a?this.setTimeoutFn(()=>{c||b.open()},200):b.open()}onHandshake(a){this._upgrades=this._filterUpgrades(a.upgrades),super.onHandshake(a)}_filterUpgrades(a){let b=[];for(let c=0;c<a.length;c++)~this.transports.indexOf(a[c])&&b.push(a[c]);return b}}class aa extends _{constructor(a,b={}){const c="object"==typeof a?a:b;(!c.transports||c.transports&&"string"==typeof c.transports[0])&&(c.transports=(c.transports||["polling","websocket","webtransport"]).map(a=>T[a]).filter(a=>!!a)),super(a,c)}}aa.protocol;let ab=(0,A.default)("socket.io-client:url"),ac="function"==typeof ArrayBuffer,ad=Object.prototype.toString,ae="function"==typeof Blob||"u">typeof Blob&&"[object BlobConstructor]"===ad.call(Blob),af="function"==typeof File||"u">typeof File&&"[object FileConstructor]"===ad.call(File);function ag(a){return ac&&(a instanceof ArrayBuffer||("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(a):a.buffer instanceof ArrayBuffer))||ae&&a instanceof Blob||af&&a instanceof File}let ah=(0,A.default)("socket.io-parser"),ai=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];(e=f||(f={}))[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK";class aj extends q{constructor(a){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},"function"==typeof a?{reviver:a}:a)}add(a){let b;if("string"==typeof a){if(this.reconstructor)throw Error("got plaintext data when reconstructing a packet");let c=(b=this.decodeString(a)).type===f.BINARY_EVENT;c||b.type===f.BINARY_ACK?(b.type=c?f.EVENT:f.ACK,this.reconstructor=new ak(b),0===b.attachments&&super.emitReserved("decoded",b)):super.emitReserved("decoded",b)}else if(ag(a)||a.base64)if(this.reconstructor)(b=this.reconstructor.takeBinaryData(a))&&(this.reconstructor=null,super.emitReserved("decoded",b));else throw Error("got binary data when not reconstructing a packet");else throw Error("Unknown type: "+a)}decodeString(a){let b=0,c={type:Number(a.charAt(0))};if(void 0===f[c.type])throw Error("unknown packet type "+c.type);if(c.type===f.BINARY_EVENT||c.type===f.BINARY_ACK){let d=b+1;for(;"-"!==a.charAt(++b)&&b!=a.length;);let e=a.substring(d,b);if(e!=Number(e)||"-"!==a.charAt(b))throw Error("Illegal attachments");let f=Number(e);if(!al(f)||f<0)throw Error("Illegal attachments");if(f>this.opts.maxAttachments)throw Error("too many attachments");c.attachments=f}if("/"===a.charAt(b+1)){let d=b+1;for(;++b&&","!==a.charAt(b)&&b!==a.length;);c.nsp=a.substring(d,b)}else c.nsp="/";let d=a.charAt(b+1);if(""!==d&&Number(d)==d){let d=b+1;for(;++b;){let c=a.charAt(b);if(null==c||Number(c)!=c){--b;break}if(b===a.length)break}c.id=Number(a.substring(d,b+1))}if(a.charAt(++b)){let d=this.tryParse(a.substr(b));if(aj.isPayloadValid(c.type,d))c.data=d;else throw Error("invalid payload")}return ah("decoded %s as %j",a,c),c}tryParse(a){try{return JSON.parse(a,this.opts.reviver)}catch(a){return!1}}static isPayloadValid(a,b){switch(a){case f.CONNECT:return am(b);case f.DISCONNECT:return void 0===b;case f.CONNECT_ERROR:return"string"==typeof b||am(b);case f.EVENT:case f.BINARY_EVENT:return Array.isArray(b)&&("number"==typeof b[0]||"string"==typeof b[0]&&-1===ai.indexOf(b[0]));case f.ACK:case f.BINARY_ACK:return Array.isArray(b)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class ak{constructor(a){this.packet=a,this.buffers=[],this.reconPack=a}takeBinaryData(a){if(this.buffers.push(a),this.buffers.length===this.reconPack.attachments){var b,c;let a=(b=this.reconPack,c=this.buffers,b.data=function a(b,c){if(!b)return b;if(b&&!0===b._placeholder){if("number"==typeof b.num&&b.num>=0&&b.num<c.length)return c[b.num];throw Error("illegal attachments")}if(Array.isArray(b))for(let d=0;d<b.length;d++)b[d]=a(b[d],c);else if("object"==typeof b)for(let d in b)Object.prototype.hasOwnProperty.call(b,d)&&(b[d]=a(b[d],c));return b}(b.data,c),delete b.attachments,b);return this.finishedReconstruction(),a}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}let al=Number.isInteger||function(a){return"number"==typeof a&&isFinite(a)&&Math.floor(a)===a};function am(a){return"[object Object]"===Object.prototype.toString.call(a)}function an(a,b,c){return a.on(b,c),function(){a.off(b,c)}}a.s(["Decoder",0,aj,"Encoder",0,class{constructor(a){this.replacer=a}encode(a){return(ah("encoding packet %j",a),(a.type===f.EVENT||a.type===f.ACK)&&function a(b,c){if(!b||"object"!=typeof b)return!1;if(Array.isArray(b)){for(let c=0,d=b.length;c<d;c++)if(a(b[c]))return!0;return!1}if(ag(b))return!0;if(b.toJSON&&"function"==typeof b.toJSON&&1==arguments.length)return a(b.toJSON(),!0);for(let c in b)if(Object.prototype.hasOwnProperty.call(b,c)&&a(b[c]))return!0;return!1}(a))?this.encodeAsBinary({type:a.type===f.EVENT?f.BINARY_EVENT:f.BINARY_ACK,nsp:a.nsp,data:a.data,id:a.id}):[this.encodeAsString(a)]}encodeAsString(a){let b=""+a.type;return(a.type===f.BINARY_EVENT||a.type===f.BINARY_ACK)&&(b+=a.attachments+"-"),a.nsp&&"/"!==a.nsp&&(b+=a.nsp+","),null!=a.id&&(b+=a.id),null!=a.data&&(b+=JSON.stringify(a.data,this.replacer)),ah("encoded %j as %s",a,b),b}encodeAsBinary(a){let b,c,d=(b=[],c=a.data,a.data=function a(b,c){if(!b)return b;if(ag(b)){let a={_placeholder:!0,num:c.length};return c.push(b),a}if(Array.isArray(b)){let d=Array(b.length);for(let e=0;e<b.length;e++)d[e]=a(b[e],c);return d}if("object"==typeof b&&!(b instanceof Date)){let d={};for(let e in b)Object.prototype.hasOwnProperty.call(b,e)&&(d[e]=a(b[e],c));return d}return b}(c,b),a.attachments=b.length,{packet:a,buffers:b}),e=this.encodeAsString(d.packet),f=d.buffers;return f.unshift(e),f}},"PacketType",0,f,"isPacketValid",0,function(a){var b;return"string"==typeof a.nsp&&(void 0===(b=a.id)||al(b))&&function(a,b){switch(a){case f.CONNECT:return void 0===b||am(b);case f.DISCONNECT:return void 0===b;case f.EVENT:return Array.isArray(b)&&("number"==typeof b[0]||"string"==typeof b[0]&&-1===ai.indexOf(b[0]));case f.ACK:return Array.isArray(b);case f.CONNECT_ERROR:return"string"==typeof b||am(b);default:return!1}}(a.type,a.data)},"protocol",0,5],32882);let ao=(0,A.default)("socket.io-client:socket"),ap=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class aq extends q{constructor(a,b,c){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=a,this.nsp=b,c&&c.auth&&(this.auth=c.auth),this._opts=Object.assign({},c),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let a=this.io;this.subs=[an(a,"open",this.onopen.bind(this)),an(a,"packet",this.onpacket.bind(this)),an(a,"error",this.onerror.bind(this)),an(a,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...a){return a.unshift("message"),this.emit.apply(this,a),this}emit(a,...b){var c,d,e;if(ap.hasOwnProperty(a))throw Error('"'+a.toString()+'" is a reserved event name');if(b.unshift(a),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(b),this;let g={type:f.EVENT,data:b};if(g.options={},g.options.compress=!1!==this.flags.compress,"function"==typeof b[b.length-1]){let a=this.ids++;ao("emitting packet with ack id %d",a);let c=b.pop();this._registerAckCallback(a,c),g.id=a}let h=null==(d=null==(c=this.io.engine)?void 0:c.transport)?void 0:d.writable,i=this.connected&&!(null==(e=this.io.engine)?void 0:e._hasPingExpired());return this.flags.volatile&&!h?ao("discard packet as the transport is not currently writable"):i?(this.notifyOutgoingListeners(g),this.packet(g)):this.sendBuffer.push(g),this.flags={},this}_registerAckCallback(a,b){var c;let d=null!=(c=this.flags.timeout)?c:this._opts.ackTimeout;if(void 0===d){this.acks[a]=b;return}let e=this.io.setTimeoutFn(()=>{delete this.acks[a];for(let b=0;b<this.sendBuffer.length;b++)this.sendBuffer[b].id===a&&(ao("removing packet with ack id %d from the buffer",a),this.sendBuffer.splice(b,1));ao("event with ack id %d has timed out after %d ms",a,d),b.call(this,Error("operation has timed out"))},d),f=(...a)=>{this.io.clearTimeoutFn(e),b.apply(this,a)};f.withError=!0,this.acks[a]=f}emitWithAck(a,...b){return new Promise((c,d)=>{let e=(a,b)=>a?d(a):c(b);e.withError=!0,b.push(e),this.emit(a,...b)})}_addToQueue(a){let b;"function"==typeof a[a.length-1]&&(b=a.pop());let c={id:this._queueSeq++,tryCount:0,pending:!1,args:a,flags:Object.assign({fromQueue:!0},this.flags)};a.push((a,...d)=>c!==this._queue[0]?ao("packet [%d] already acknowledged",c.id):(null!==a?c.tryCount>this._opts.retries&&(ao("packet [%d] is discarded after %d tries",c.id,c.tryCount),this._queue.shift(),b&&b(a)):(ao("packet [%d] was successfully sent",c.id),this._queue.shift(),b&&b(null,...d)),c.pending=!1,this._drainQueue())),this._queue.push(c),this._drainQueue()}_drainQueue(a=!1){if(ao("draining queue"),!this.connected||0===this._queue.length)return;let b=this._queue[0];b.pending&&!a?ao("packet [%d] has already been sent and is waiting for an ack",b.id):(b.pending=!0,b.tryCount++,ao("sending packet [%d] (try n°%d)",b.id,b.tryCount),this.flags=b.flags,this.emit.apply(this,b.args))}packet(a){a.nsp=this.nsp,this.io._packet(a)}onopen(){ao("transport is open - connecting"),"function"==typeof this.auth?this.auth(a=>{this._sendConnectPacket(a)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(a){this.packet({type:f.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},a):a})}onerror(a){this.connected||this.emitReserved("connect_error",a)}onclose(a,b){ao("close (%s)",a),this.connected=!1,delete this.id,this.emitReserved("disconnect",a,b),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(a=>{if(!this.sendBuffer.some(b=>String(b.id)===a)){let b=this.acks[a];delete this.acks[a],b.withError&&b.call(this,Error("socket has been disconnected"))}})}onpacket(a){if(a.nsp===this.nsp)switch(a.type){case f.CONNECT:a.data&&a.data.sid?this.onconnect(a.data.sid,a.data.pid):this.emitReserved("connect_error",Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case f.EVENT:case f.BINARY_EVENT:this.onevent(a);break;case f.ACK:case f.BINARY_ACK:this.onack(a);break;case f.DISCONNECT:this.ondisconnect();break;case f.CONNECT_ERROR:this.destroy();let b=Error(a.data.message);b.data=a.data.data,this.emitReserved("connect_error",b)}}onevent(a){let b=a.data||[];ao("emitting event %j",b),null!=a.id&&(ao("attaching ack callback to event"),b.push(this.ack(a.id))),this.connected?this.emitEvent(b):this.receiveBuffer.push(Object.freeze(b))}emitEvent(a){if(this._anyListeners&&this._anyListeners.length)for(let b of this._anyListeners.slice())b.apply(this,a);super.emit.apply(this,a),this._pid&&a.length&&"string"==typeof a[a.length-1]&&(this._lastOffset=a[a.length-1])}ack(a){let b=this,c=!1;return function(...d){c||(c=!0,ao("sending ack %j",d),b.packet({type:f.ACK,id:a,data:d}))}}onack(a){let b=this.acks[a.id];"function"!=typeof b?ao("bad ack %s",a.id):(delete this.acks[a.id],ao("calling ack %s with %j",a.id,a.data),b.withError&&a.data.unshift(null),b.apply(this,a.data))}onconnect(a,b){ao("socket connected with id %s",a),this.id=a,this.recovered=b&&this._pid===b,this._pid=b,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(a=>this.emitEvent(a)),this.receiveBuffer=[],this.sendBuffer.forEach(a=>{this.notifyOutgoingListeners(a),this.packet(a)}),this.sendBuffer=[]}ondisconnect(){ao("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(a=>a()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&(ao("performing disconnect (%s)",this.nsp),this.packet({type:f.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(a){return this.flags.compress=a,this}get volatile(){return this.flags.volatile=!0,this}timeout(a){return this.flags.timeout=a,this}onAny(a){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(a),this}prependAny(a){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(a),this}offAny(a){if(!this._anyListeners)return this;if(a){let b=this._anyListeners;for(let c=0;c<b.length;c++)if(a===b[c]){b.splice(c,1);break}}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(a){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(a),this}prependAnyOutgoing(a){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(a),this}offAnyOutgoing(a){if(!this._anyOutgoingListeners)return this;if(a){let b=this._anyOutgoingListeners;for(let c=0;c<b.length;c++)if(a===b[c]){b.splice(c,1);break}}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(a){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length)for(let b of this._anyOutgoingListeners.slice())b.apply(this,a.data)}}var ar=a.i(32882);function as(a){a=a||{},this.ms=a.min||100,this.max=a.max||1e4,this.factor=a.factor||2,this.jitter=a.jitter>0&&a.jitter<=1?a.jitter:0,this.attempts=0}as.prototype.duration=function(){var a=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var b=Math.random(),c=Math.floor(b*this.jitter*a);a=(1&Math.floor(10*b))==0?a-c:a+c}return 0|Math.min(a,this.max)},as.prototype.reset=function(){this.attempts=0},as.prototype.setMin=function(a){this.ms=a},as.prototype.setMax=function(a){this.max=a},as.prototype.setJitter=function(a){this.jitter=a};let at=(0,A.default)("socket.io-client:manager");class au extends q{constructor(a,b){var c;super(),this.nsps={},this.subs=[],a&&"object"==typeof a&&(b=a,a=void 0),(b=b||{}).path=b.path||"/socket.io",this.opts=b,y(this,b),this.reconnection(!1!==b.reconnection),this.reconnectionAttempts(b.reconnectionAttempts||1/0),this.reconnectionDelay(b.reconnectionDelay||1e3),this.reconnectionDelayMax(b.reconnectionDelayMax||5e3),this.randomizationFactor(null!=(c=b.randomizationFactor)?c:.5),this.backoff=new as({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==b.timeout?2e4:b.timeout),this._readyState="closed",this.uri=a;const d=b.parser||ar;this.encoder=new d.Encoder,this.decoder=new d.Decoder,this._autoConnect=!1!==b.autoConnect,this._autoConnect&&this.open()}reconnection(a){return arguments.length?(this._reconnection=!!a,a||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(a){return void 0===a?this._reconnectionAttempts:(this._reconnectionAttempts=a,this)}reconnectionDelay(a){var b;return void 0===a?this._reconnectionDelay:(this._reconnectionDelay=a,null==(b=this.backoff)||b.setMin(a),this)}randomizationFactor(a){var b;return void 0===a?this._randomizationFactor:(this._randomizationFactor=a,null==(b=this.backoff)||b.setJitter(a),this)}reconnectionDelayMax(a){var b;return void 0===a?this._reconnectionDelayMax:(this._reconnectionDelayMax=a,null==(b=this.backoff)||b.setMax(a),this)}timeout(a){return arguments.length?(this._timeout=a,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(a){if(at("readyState %s",this._readyState),~this._readyState.indexOf("open"))return this;at("opening %s",this.uri),this.engine=new aa(this.uri,this.opts);let b=this.engine,c=this;this._readyState="opening",this.skipReconnect=!1;let d=an(b,"open",function(){c.onopen(),a&&a()}),e=b=>{at("error"),this.cleanup(),this._readyState="closed",this.emitReserved("error",b),a?a(b):this.maybeReconnectOnOpen()},f=an(b,"error",e);if(!1!==this._timeout){let a=this._timeout;at("connect attempt will timeout after %d",a);let c=this.setTimeoutFn(()=>{at("connect attempt timed out after %d",a),d(),e(Error("timeout")),b.close()},a);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(d),this.subs.push(f),this}connect(a){return this.open(a)}onopen(){at("open"),this.cleanup(),this._readyState="open",this.emitReserved("open");let a=this.engine;this.subs.push(an(a,"ping",this.onping.bind(this)),an(a,"data",this.ondata.bind(this)),an(a,"error",this.onerror.bind(this)),an(a,"close",this.onclose.bind(this)),an(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(a){try{this.decoder.add(a)}catch(a){this.onclose("parse error",a)}}ondecoded(a){r(()=>{this.emitReserved("packet",a)},this.setTimeoutFn)}onerror(a){at("error",a),this.emitReserved("error",a)}socket(a,b){let c=this.nsps[a];return c?this._autoConnect&&!c.active&&c.connect():(c=new aq(this,a,b),this.nsps[a]=c),c}_destroy(a){for(let a of Object.keys(this.nsps))if(this.nsps[a].active)return void at("socket %s is still active, skipping close",a);this._close()}_packet(a){at("writing packet %j",a);let b=this.encoder.encode(a);for(let c=0;c<b.length;c++)this.engine.write(b[c],a.options)}cleanup(){at("cleanup"),this.subs.forEach(a=>a()),this.subs.length=0,this.decoder.destroy()}_close(){at("disconnect"),this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(a,b){var c;at("closed due to %s",a),this.cleanup(),null==(c=this.engine)||c.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",a,b),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let a=this;if(this.backoff.attempts>=this._reconnectionAttempts)at("reconnect failed"),this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let b=this.backoff.duration();at("will wait %dms before reconnect attempt",b),this._reconnecting=!0;let c=this.setTimeoutFn(()=>{a.skipReconnect||(at("attempting reconnect"),this.emitReserved("reconnect_attempt",a.backoff.attempts),a.skipReconnect||a.open(b=>{b?(at("reconnect attempt error"),a._reconnecting=!1,a.reconnect(),this.emitReserved("reconnect_error",b)):(at("reconnect success"),a.onreconnect())}))},b);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}}onreconnect(){let a=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",a)}}let av=(0,A.default)("socket.io-client"),aw={};function ax(a,b){let c;"object"==typeof a&&(b=a,a=void 0);let d=function(a,b="",c){let d=a;c=c||"u">typeof location&&location,null==a&&(a=c.protocol+"//"+c.host),"string"==typeof a&&("/"===a.charAt(0)&&(a="/"===a.charAt(1)?c.protocol+a:c.host+a),/^(https?|wss?):\/\//.test(a)||(ab("protocol-less url %s",a),a=void 0!==c?c.protocol+"//"+a:"https://"+a),ab("parse %s",a),d=W(a)),!d.port&&(/^(http|ws)$/.test(d.protocol)?d.port="80":/^(http|ws)s$/.test(d.protocol)&&(d.port="443")),d.path=d.path||"/";let e=-1!==d.host.indexOf(":")?"["+d.host+"]":d.host;return d.id=d.protocol+"://"+e+":"+d.port+b,d.href=d.protocol+"://"+e+(c&&c.port===d.port?"":":"+d.port),d}(a,(b=b||{}).path||"/socket.io"),e=d.source,f=d.id,g=d.path,h=aw[f]&&g in aw[f].nsps;return b.forceNew||b["force new connection"]||!1===b.multiplex||h?(av("ignoring socket cache for %s",e),c=new au(e,b)):(aw[f]||(av("new io instance for %s",e),aw[f]=new au(e,b)),c=aw[f]),d.query&&!b.query&&(b.query=d.queryKey),c.socket(d.path,b)}Object.assign(ax,{Manager:au,Socket:aq,io:ax,connect:ax}),a.s(["io",0,ax],83915)},25015,12548,a=>{"use strict";var b=a.i(60137);let c=(0,b.default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);a.s(["Play",0,c],25015);let d=(0,b.default)("square-pen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);a.s(["SquarePen",0,d],12548)},54124,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(10450),e=a.i(99813),f=a.i(83915),g=a.i(80087),h=a.i(96221),i=a.i(5151),j=a.i(25015),k=a.i(33441),l=a.i(12548),m=a.i(53155),n=a.i(39524),o=a.i(65025),p=a.i(91399);let q=(0,c.forwardRef)(function({tabId:a,cwd:q,env:r,worktreePath:s,command:u,className:v="",initialTodos:w,isActive:x,onTodosUpdated:y,onStatusChange:z},A){let B=(0,c.useRef)(null),C=(0,c.useRef)(null),D=(0,c.useRef)(null),E=(0,c.useRef)(null),F=(0,c.useRef)(a),[G,H]=(0,c.useState)(!1),I=(0,c.useRef)(!1),J=(0,c.useRef)(x),K=(0,c.useRef)(!1),L=(0,c.useRef)(!1),M=(0,c.useRef)(null),N=(0,c.useRef)(null),O=(0,c.useRef)(0),[P,Q]=(0,c.useState)("idle"),[R,S]=(0,c.useState)("idle"),[T,U]=(0,c.useState)(w??[]),[V,W]=(0,c.useState)(!1),{effectiveTheme:X}=(0,g.useTheme)(),Y=(0,c.useRef)(z);Y.current=z;let Z="dark"===X,$=Z?{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#d4d4d4",selectionBackground:"#264f78"}:{background:"#ffffff",foreground:"#1e1e1e",cursor:"#1e1e1e",selectionBackground:"#add6ff"};function _(){let a=E.current,b=C.current,c=F.current;a&&a.connected&&b&&c&&a.emit("resize",{sessionId:c,cols:b.cols,rows:b.rows})}function aa(a){a.write("\x1b[2J\x1b[3J\x1b[H")}async function ab(b,c,d){Q("connecting");try{var e,g,h,i;let j,k,l=await fetch((0,p.apiUrl)("/api/terminal/sessions"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:q,env:r,worktreePath:s,sessionId:b,command:u}),signal:d});if(!l.ok){let a=await l.text().catch(()=>"");throw Error(`Failed to create session: ${l.status} ${a}`)}let m=await l.json();if(d.aborted)return;F.current=m.sessionId,m.reused||aa(c),e=m.sessionId,g=m.reused,h=c,i=d,M.current?.dispose(),M.current=null,E.current&&(E.current.removeAllListeners(),E.current.disconnect()),E.current=j=(0,f.io)((0,p.getServerUrl)(),{transports:["polling","websocket"]}),k=!1,j.on("connect",()=>{let a=K.current;K.current=!0,a?h.writeln("\x1b[90mReconnected.\x1b[0m"):g?(L.current=!0,aa(h)):h.writeln("\x1b[90mConnected.\x1b[0m"),Q("connected"),O.current=0,j.emit("join",{room:`tab:${e}`,mode:"terminal"}),a&&J.current&&h.focus()}),j.on("output",({data:a})=>{g&&!k?(k=!0,h.write(a,()=>{L.current=!1,D.current?.fit();let a=C.current;if(a){let b=64===a.cols?63:64;a.resize(b,a.rows),_(),setTimeout(()=>{D.current?.fit(),_()},50)}h.scrollToBottom()})):h.write(a)}),j.on("exit",({exitCode:a})=>{console.log("[TerminalView] PTY exited with code:",a),Q("exited"),F.current=null,E.current=null}),j.on("error",({message:a})=>{if(console.error("[TerminalView] Socket error message:",a),a.startsWith("Session not found")&&O.current<1){O.current+=1,ac();return}Q("error")}),j.on("disconnect",()=>{i.aborted||Q(a=>"exited"===a||"paused"===a||"idle"===a?a:"exited")}),j.on("status-changed",({status:a})=>{S(a)}),j.on("todos-updated",({todos:b})=>{U(b),y?.(a,b)}),j.on("editor:open",({sessionId:a,content:b})=>{window.dispatchEvent(new CustomEvent("editor-session-open-request",{detail:{sessionId:a,content:b}}))}),M.current=h.onData(a=>{j.connected&&F.current&&j.emit("input",{sessionId:F.current,data:a})})}catch(a){if(a instanceof Error&&"AbortError"===a.name)return;console.error("[TerminalView] connectSession error:",a instanceof Error?a.message:String(a)),Q("error")}}async function ac(){let b=C.current;if(!b)return;let c=new AbortController;await ab(a,b,c.signal)}(0,c.useEffect)(()=>{Y.current?.(a,P,R)},[a,P,R]),(0,c.useLayoutEffect)(()=>{J.current=x}),(0,c.useEffect)(()=>{x&&C.current?.focus()},[x]),(0,c.useEffect)(()=>{if(G)C.current?.blur();else if(x){let a=B.current?.querySelector("textarea.xterm-helper-textarea");a?.focus()}},[G,x]),(0,c.useEffect)(()=>{"connected"===P&&D.current&&(D.current.fit(),L.current||_())},[P]),(0,c.useEffect)(()=>{if(!B.current)return;let b=B.current,c=new d.Terminal({cursorBlink:!0,fontSize:13,fontFamily:'"Cascadia Code", "Fira Code", "Menlo", monospace',theme:$,allowProposedApi:!0}),f=new e.FitAddon;c.loadAddon(f),c.open(B.current),f.fit(),C.current=c,D.current=f,J.current&&c.focus(),c.attachCustomKeyEventHandler(()=>!I.current),c.buffer.onBufferChange(a=>{"normal"===a.type&&c.refresh(0,c.rows-1)});let g=0,h=a=>{let b=performance.now();""===a.data&&b-g<100?a.stopImmediatePropagation():g=b};b.addEventListener("compositionend",h,!0);let i=new ResizeObserver(()=>{!I.current&&(f.fit(),L.current||_())});i.observe(B.current);let j=new AbortController;return ab(a,c,j.signal),()=>{j.abort(),i.disconnect(),b.removeEventListener("compositionend",h,!0),M.current?.dispose(),M.current=null,c.dispose(),C.current=null,D.current=null,E.current?.removeAllListeners(),E.current?.disconnect(),E.current=null}},[]),(0,c.useEffect)(()=>{C.current&&(C.current.options.theme=$)},[Z]),(0,c.useEffect)(()=>{function a(){I.current=!0,C.current?.blur()}function b(){if(setTimeout(()=>{let a=C.current;if(a){let b=64===a.cols?63:64;a.resize(b,a.rows),_(),setTimeout(()=>{I.current=!1,D.current?.fit(),_()},100)}else I.current=!1},300),!J.current)return;let a=B.current?.querySelector("textarea.xterm-helper-textarea");a?.focus()}return window.addEventListener("editor-session-open",a),window.addEventListener("editor-session-done",b),()=>{window.removeEventListener("editor-session-open",a),window.removeEventListener("editor-session-done",b)}},[]),(0,c.useEffect)(()=>{function a(){if("visible"!==document.visibilityState)return;let a=E.current;function b(){N.current&&(clearTimeout(N.current),N.current=null),J.current&&C.current?.focus()}a&&a.connected&&(N.current&&(clearTimeout(N.current),N.current=null),N.current=setTimeout(()=>{N.current=null,a.off("health-check-ack",b),a.disconnect(),a.connect(),Q("connecting")},6e3),a.once("health-check-ack",b),a.emit("health-check"))}return document.addEventListener("visibilitychange",a),()=>{document.removeEventListener("visibilitychange",a),N.current&&(clearTimeout(N.current),N.current=null)}},[]),(0,c.useImperativeHandle)(A,()=>({sendInput:a=>{let b=E.current,c=F.current;b?.connected&&c&&b.emit("input",{sessionId:c,data:a})},focus:()=>{C.current?.focus()}}));let ad=(0,c.useCallback)(()=>{navigator.clipboard.writeText(a).then(()=>{W(!0),setTimeout(()=>W(!1),2e3)})},[a]),ae="connecting"===P,af="paused"===P||"exited"===P||"error"===P,ag="connected"===P,ah=T.filter(a=>"deleted"!==a.status),ai=ah.filter(a=>"completed"===a.status).length,aj=ah.length,ak=a.length>8?`${a.slice(0,8)}…`:a;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:`flex flex-col h-full min-h-0 ${v}`,children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 border-b border-border flex-shrink-0 bg-card",children:[(0,b.jsx)("span",{className:"font-mono text-xs text-muted-foreground",title:a,children:ak}),(0,b.jsx)(n.Button,{variant:"ghost",size:"icon-xs",onClick:ad,className:"text-muted-foreground hover:text-foreground",title:"Copy tab ID",children:V?(0,b.jsx)(k.Check,{className:"w-3 h-3 text-success"}):(0,b.jsx)(i.Copy,{className:"w-3 h-3"})}),(0,b.jsxs)(n.Button,{size:"xs",onClick:function(){let a=E.current,b=F.current;if(!a||!a.connected||!b)return;let c=`claude --dangerously-skip-permissions --resume ${b} 2>/dev/null || claude --dangerously-skip-permissions --session-id ${b}
33
- `;a.emit("input",{sessionId:b,data:c})},disabled:!ag,title:"Run Claude",children:[(0,b.jsx)(j.Play,{className:"w-3 h-3"}),"Run Claude"]}),(0,b.jsxs)(n.Button,{variant:"ghost",size:"xs",onClick:()=>H(!0),disabled:!ag,className:"text-muted-foreground hover:text-foreground",title:"Open editor input",children:[(0,b.jsx)(l.SquarePen,{className:"w-3 h-3"}),"Open Editor"]}),aj>0&&(0,b.jsxs)("div",{className:"ml-auto flex items-center gap-1.5 shrink-0",title:T.find(a=>"in_progress"===a.status)?.content??"",children:[(0,b.jsx)(o.Progress,{value:ai,max:aj,className:"w-16 gap-0 [&_[data-slot=progress-track]]:h-[3px]"}),(0,b.jsxs)("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:[ai,"/",aj]})]})]}),(0,b.jsxs)("div",{className:"relative flex-1 min-h-0 overflow-hidden",children:[(0,b.jsx)("div",{ref:B,className:"w-full h-full",style:{padding:"4px"}}),ae&&(0,b.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-background",children:(0,b.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground text-xs",children:[(0,b.jsx)(h.Loader2,{className:"w-4 h-4 animate-spin"}),(0,b.jsx)("span",{children:"Connecting..."})]})}),af&&(0,b.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-background/90",children:(0,b.jsxs)("div",{className:"text-center space-y-2",children:["error"===P&&(0,b.jsx)("p",{className:"text-xs text-destructive",children:"Connection failed"}),"exited"===P&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"Session ended"}),"paused"===P&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"Paused"}),(0,b.jsx)(n.Button,{size:"xs",onClick:ac,children:"Reconnect"})]})})]})]}),(0,b.jsx)(m.MonacoEditorModal,{open:G,onOpenChange:a=>{a.open||H(!1)},onSubmit:a=>{C.current&&a&&C.current.paste(a),H(!1)},title:"Terminal Input",submitLabel:"Paste"})]})});a.s(["TerminalView",0,q])},88381,a=>{"use strict";var b=a.i(72131),c=a.i(83915),d=a.i(91399);a.s(["useTaskEvents",0,function(a){let e=(0,b.useRef)(null),f=(0,b.useRef)(a);(0,b.useLayoutEffect)(()=>{f.current=a}),(0,b.useEffect)(()=>{let a=(0,c.io)((0,d.getServerUrl)(),{transports:["polling","websocket"]});return e.current=a,a.on("task:created",({task:a})=>{f.current.onTaskCreated(a)}),a.on("task:updated",({task:a})=>{f.current.onTaskUpdated(a)}),a.on("task:deleted",({taskId:a})=>{f.current.onTaskDeleted(a)}),()=>{a.disconnect(),e.current=null}},[])}])}];
32
+ `+Object.keys(d).map(a=>`${a}: ${d[a]}`).join("\r\n")+"\r\n\r\n"+c)}function r(a,b,c,d,e,f){if(a.listenerCount("wsClientError")){let d=Error(e);Error.captureStackTrace(d,r),a.emit("wsClientError",d,c,b)}else q(c,d,e,f)}b.exports=class extends d{constructor(a,b){if(super(),null==(a={allowSynchronousEvents:!0,autoPong:!0,maxPayload:0x6400000,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:k,...a}).port&&!a.server&&!a.noServer||null!=a.port&&(a.server||a.noServer)||a.server&&a.noServer)throw TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(null!=a.port?(this._server=e.createServer((a,b)=>{let c=e.STATUS_CODES[426];b.writeHead(426,{"Content-Length":c.length,"Content-Type":"text/plain"}),b.end(c)}),this._server.listen(a.port,a.host,a.backlog,b)):a.server&&(this._server=a.server),this._server){const a=this.emit.bind(this,"connection");this._removeListeners=function(a,b){for(let c of Object.keys(b))a.on(c,b[c]);return function(){for(let c of Object.keys(b))a.removeListener(c,b[c])}}(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(b,c,d)=>{this.handleUpgrade(b,c,d,a)}})}!0===a.perMessageDeflate&&(a.perMessageDeflate={}),a.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=a,this._state=0}address(){if(this.options.noServer)throw Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(a){if(2===this._state){a&&this.once("close",()=>{a(Error("The server is not running"))}),process.nextTick(o,this);return}if(a&&this.once("close",a),1!==this._state)if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(o,this);else{let a=this._server;this._removeListeners(),this._removeListeners=this._server=null,a.close(()=>{o(this)})}}shouldHandle(a){if(this.options.path){let b=a.url.indexOf("?");if((-1!==b?a.url.slice(0,b):a.url)!==this.options.path)return!1}return!0}handleUpgrade(a,b,c,d){b.on("error",p);let e=a.headers["sec-websocket-key"],f=a.headers.upgrade,g=+a.headers["sec-websocket-version"];if("GET"!==a.method)return void r(this,a,b,405,"Invalid HTTP method");if(void 0===f||"websocket"!==f.toLowerCase())return void r(this,a,b,400,"Invalid Upgrade header");if(void 0===e||!n.test(e))return void r(this,a,b,400,"Missing or invalid Sec-WebSocket-Key header");if(13!==g&&8!==g)return void r(this,a,b,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});if(!this.shouldHandle(a))return void q(b,400);let k=a.headers["sec-websocket-protocol"],l=new Set;if(void 0!==k)try{l=j.parse(k)}catch(c){r(this,a,b,400,"Invalid Sec-WebSocket-Protocol header");return}let m=a.headers["sec-websocket-extensions"],o={};if(this.options.perMessageDeflate&&void 0!==m){let c=new i(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let a=h.parse(m);a[i.extensionName]&&(c.accept(a[i.extensionName]),o[i.extensionName]=c)}catch(c){r(this,a,b,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let f={origin:a.headers[`${8===g?"sec-websocket-origin":"origin"}`],secure:!!(a.socket.authorized||a.socket.encrypted),req:a};if(2===this.options.verifyClient.length)return void this.options.verifyClient(f,(f,g,h,i)=>{if(!f)return q(b,g||401,h,i);this.completeUpgrade(o,e,l,a,b,c,d)});if(!this.options.verifyClient(f))return q(b,401)}this.completeUpgrade(o,e,l,a,b,c,d)}completeUpgrade(a,b,c,d,e,f,j){if(!e.readable||!e.writable)return e.destroy();if(e[m])throw Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return q(e,503);let k=g("sha1").update(b+l).digest("base64"),n=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${k}`],r=new this.options.WebSocket(null,void 0,this.options);if(c.size){let a=this.options.handleProtocols?this.options.handleProtocols(c,d):c.values().next().value;a&&(n.push(`Sec-WebSocket-Protocol: ${a}`),r._protocol=a)}if(a[i.extensionName]){let b=a[i.extensionName].params,c=h.format({[i.extensionName]:[b]});n.push(`Sec-WebSocket-Extensions: ${c}`),r._extensions=a}this.emit("headers",n,d),e.write(n.concat("\r\n").join("\r\n")),e.removeListener("error",p),r.setSocket(e,f,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(r),r.on("close",()=>{this.clients.delete(r),this._shouldEmitClose&&!this.clients.size&&process.nextTick(o,this)})),j(r,d)}}},83915,a=>{"use strict";let b,c,d;var e,f,g=a.i(63047);let h=Object.create(null);h.open="0",h.close="1",h.ping="2",h.pong="3",h.message="4",h.upgrade="5",h.noop="6";let i=Object.create(null);Object.keys(h).forEach(a=>{i[h[a]]=a});let j={type:"error",data:"parser error"},k=({type:a,data:b},c,d)=>d(b instanceof ArrayBuffer||ArrayBuffer.isView(b)?c?b:"b"+l(b,!0).toString("base64"):h[a]+(b||"")),l=(a,b)=>Buffer.isBuffer(a)||a instanceof Uint8Array&&!b?a:a instanceof ArrayBuffer?Buffer.from(a):Buffer.from(a.buffer,a.byteOffset,a.byteLength),m=(a,b)=>{if("string"!=typeof a)return{type:"message",data:n(a,b)};let c=a.charAt(0);return"b"===c?{type:"message",data:n(Buffer.from(a.substring(1),"base64"),b)}:i[c]?a.length>1?{type:i[c],data:a.substring(1)}:{type:i[c]}:j},n=(a,b)=>"arraybuffer"===b?a instanceof ArrayBuffer?a:Buffer.isBuffer(a)?a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength):a.buffer:Buffer.isBuffer(a)?a:Buffer.from(a);function o(a){return a.reduce((a,b)=>a+b.length,0)}function p(a,b){if(a[0].length===b)return a.shift();let c=new Uint8Array(b),d=0;for(let e=0;e<b;e++)c[e]=a[0][d++],d===a[0].length&&(a.shift(),d=0);return a.length&&d<a[0].length&&(a[0]=a[0].slice(d)),c}function q(a){if(a){var b=a;for(var c in q.prototype)b[c]=q.prototype[c];return b}}q.prototype.on=q.prototype.addEventListener=function(a,b){return this._callbacks=this._callbacks||{},(this._callbacks["$"+a]=this._callbacks["$"+a]||[]).push(b),this},q.prototype.once=function(a,b){function c(){this.off(a,c),b.apply(this,arguments)}return c.fn=b,this.on(a,c),this},q.prototype.off=q.prototype.removeListener=q.prototype.removeAllListeners=q.prototype.removeEventListener=function(a,b){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var c,d=this._callbacks["$"+a];if(!d)return this;if(1==arguments.length)return delete this._callbacks["$"+a],this;for(var e=0;e<d.length;e++)if((c=d[e])===b||c.fn===b){d.splice(e,1);break}return 0===d.length&&delete this._callbacks["$"+a],this},q.prototype.emit=function(a){this._callbacks=this._callbacks||{};for(var b=Array(arguments.length-1),c=this._callbacks["$"+a],d=1;d<arguments.length;d++)b[d-1]=arguments[d];if(c){c=c.slice(0);for(var d=0,e=c.length;d<e;++d)c[d].apply(this,b)}return this},q.prototype.emitReserved=q.prototype.emit,q.prototype.listeners=function(a){return this._callbacks=this._callbacks||{},this._callbacks["$"+a]||[]},q.prototype.hasListeners=function(a){return!!this.listeners(a).length};let r=process.nextTick,s=a.g;class u{constructor(){this._cookies=new Map}parseCookies(a){a&&a.forEach(a=>{let b=function(a){let b=a.split("; "),c=b[0].indexOf("=");if(-1===c)return;let d=b[0].substring(0,c).trim();if(!d.length)return;let e=b[0].substring(c+1).trim();34===e.charCodeAt(0)&&(e=e.slice(1,-1));let f={name:d,value:e};for(let a=1;a<b.length;a++){let c=b[a].split("=");if(2!==c.length)continue;let d=c[0].trim(),e=c[1].trim();switch(d){case"Expires":f.expires=new Date(e);break;case"Max-Age":let g=new Date;g.setUTCSeconds(g.getUTCSeconds()+parseInt(e,10)),f.expires=g}}return f}(a);b&&this._cookies.set(b.name,b)})}get cookies(){let a=Date.now();return this._cookies.forEach((b,c)=>{var d;(null==(d=b.expires)?void 0:d.getTime())<a&&this._cookies.delete(c)}),this._cookies.entries()}addCookies(a){let b=[];for(let[a,c]of this.cookies)b.push(`${a}=${c.value}`);b.length&&(a.setDisableHeaderCheck(!0),a.setRequestHeader("cookie",b.join("; ")))}appendCookies(a){for(let[b,c]of this.cookies)a.append("cookie",`${b}=${c.value}`)}}function v(a,...b){return b.reduce((b,c)=>(a.hasOwnProperty(c)&&(b[c]=a[c]),b),{})}let w=s.setTimeout,x=s.clearTimeout;function y(a,b){b.useNativeTimers?(a.setTimeoutFn=w.bind(s),a.clearTimeoutFn=x.bind(s)):(a.setTimeoutFn=s.setTimeout.bind(s),a.clearTimeoutFn=s.clearTimeout.bind(s))}function z(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}var A=a.i(35290);let B=(0,A.default)("engine.io-client:transport");class C extends Error{constructor(a,b,c){super(a),this.description=b,this.context=c,this.type="TransportError"}}class D extends q{constructor(a){super(),this.writable=!1,y(this,a),this.opts=a,this.query=a.query,this.socket=a.socket,this.supportsBinary=!a.forceBase64}onError(a,b,c){return super.emitReserved("error",new C(a,b,c)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return("opening"===this.readyState||"open"===this.readyState)&&(this.doClose(),this.onClose()),this}send(a){"open"===this.readyState?this.write(a):B("transport is not open, discarding packets")}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(a){let b=m(a,this.socket.binaryType);this.onPacket(b)}onPacket(a){super.emitReserved("packet",a)}onClose(a){this.readyState="closed",super.emitReserved("close",a)}pause(a){}createUri(a,b={}){return a+"://"+this._hostname()+this._port()+this.opts.path+this._query(b)}_hostname(){let a=this.opts.hostname;return -1===a.indexOf(":")?a:"["+a+"]"}_port(){return this.opts.port&&(this.opts.secure&&443!==Number(this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(a){let b=function(a){let b="";for(let c in a)a.hasOwnProperty(c)&&(b.length&&(b+="&"),b+=encodeURIComponent(c)+"="+encodeURIComponent(a[c]));return b}(a);return b.length?"?"+b:""}}let E=(0,A.default)("engine.io-client:polling");class F extends D{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(a){this.readyState="pausing";let b=()=>{E("paused"),this.readyState="paused",a()};if(this._polling||!this.writable){let a=0;this._polling&&(E("we are currently polling - waiting to pause"),a++,this.once("pollComplete",function(){E("pre-pause polling complete"),--a||b()})),this.writable||(E("we are currently writing - waiting to pause"),a++,this.once("drain",function(){E("pre-pause writing complete"),--a||b()}))}else b()}_poll(){E("polling"),this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(a){E("polling got data %s",a);let b=a=>{if("opening"===this.readyState&&"open"===a.type&&this.onOpen(),"close"===a.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(a)};((a,b)=>{let c=a.split("\x1e"),d=[];for(let a=0;a<c.length;a++){let e=m(c[a],b);if(d.push(e),"error"===e.type)break}return d})(a,this.socket.binaryType).forEach(b),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState?this._poll():E('ignoring poll - transport state "%s"',this.readyState))}doClose(){let a=()=>{E("writing close packet"),this.write([{type:"close"}])};"open"===this.readyState?(E("transport open - closing"),a()):(E("transport not open - deferring close"),this.once("open",a))}write(a){var b;let c,d,e;this.writable=!1,b=a=>{this.doWrite(a,()=>{this.writable=!0,this.emitReserved("drain")})},d=Array(c=a.length),e=0,a.forEach((a,f)=>{k(a,!1,a=>{d[f]=a,++e===c&&b(d.join("\x1e"))})})}uri(){let a=this.opts.secure?"https":"http",b=this.query||{};return!1!==this.opts.timestampRequests&&(b[this.opts.timestampParam]=z()),this.supportsBinary||b.sid||(b.b64=1),this.createUri(a,b)}}let G=!1;try{G="u">typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(a){}let H=G,I=(0,A.default)("engine.io-client:polling");function J(){}class K extends F{constructor(a){if(super(a),"u">typeof location){const b="https:"===location.protocol;let c=location.port;c||(c=b?"443":"80"),this.xd="u">typeof location&&a.hostname!==location.hostname||c!==a.port}}doWrite(a,b){let c=this.request({method:"POST",data:a});c.on("success",b),c.on("error",(a,b)=>{this.onError("xhr post error",a,b)})}doPoll(){I("xhr poll");let a=this.request();a.on("data",this.onData.bind(this)),a.on("error",(a,b)=>{this.onError("xhr poll error",a,b)}),this.pollXhr=a}}class L extends q{constructor(a,b,c){super(),this.createRequest=a,y(this,c),this._opts=c,this._method=c.method||"GET",this._uri=b,this._data=void 0!==c.data?c.data:null,this._create()}_create(){var a;let b=v(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");b.xdomain=!!this._opts.xd;let c=this._xhr=this.createRequest(b);try{I("xhr open %s: %s",this._method,this._uri),c.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders)for(let a in c.setDisableHeaderCheck&&c.setDisableHeaderCheck(!0),this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(a)&&c.setRequestHeader(a,this._opts.extraHeaders[a])}catch(a){}if("POST"===this._method)try{c.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(a){}try{c.setRequestHeader("Accept","*/*")}catch(a){}null==(a=this._opts.cookieJar)||a.addCookies(c),"withCredentials"in c&&(c.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(c.timeout=this._opts.requestTimeout),c.onreadystatechange=()=>{var a;3===c.readyState&&(null==(a=this._opts.cookieJar)||a.parseCookies(c.getResponseHeader("set-cookie"))),4===c.readyState&&(200===c.status||1223===c.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof c.status?c.status:0)},0))},I("xhr data %s",this._data),c.send(this._data)}catch(a){this.setTimeoutFn(()=>{this._onError(a)},0);return}"u">typeof document&&(this._index=L.requestsCount++,L.requests[this._index]=this)}_onError(a){this.emitReserved("error",a,this._xhr),this._cleanup(!0)}_cleanup(a){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=J,a)try{this._xhr.abort()}catch(a){}"u">typeof document&&delete L.requests[this._index],this._xhr=null}}_onLoad(){let a=this._xhr.responseText;null!==a&&(this.emitReserved("data",a),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}function M(){for(let a in L.requests)L.requests.hasOwnProperty(a)&&L.requests[a].abort()}L.requestsCount=0,L.requests={},"u">typeof document&&("function"==typeof attachEvent?attachEvent("onunload",M):"function"==typeof addEventListener&&addEventListener("onpagehide"in s?"pagehide":"unload",M,!1)),(d=function(a){let b=a.xdomain;try{if("u">typeof XMLHttpRequest&&(!b||H))return new XMLHttpRequest}catch(a){}if(!b)try{return new s[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(a){}}({xdomain:!1}))&&d.responseType;let N=g.default||g;a.i(57515),a.i(64386),a.i(71387);var O=a.i(36705);a.i(67691),O.default;let P=(0,A.default)("engine.io-client:websocket"),Q="u">typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class R extends D{get name(){return"websocket"}doOpen(){let a=this.uri(),b=this.opts.protocols,c=Q?{}:v(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(c.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(a,b,c)}catch(a){return this.emitReserved("error",a)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=a=>this.onClose({description:"websocket connection closed",context:a}),this.ws.onmessage=a=>this.onData(a.data),this.ws.onerror=a=>this.onError("websocket error",a)}write(a){this.writable=!1;for(let b=0;b<a.length;b++){let c=a[b],d=b===a.length-1;k(c,this.supportsBinary,a=>{try{this.doWrite(c,a)}catch(a){P("websocket closed before onclose event")}d&&r(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let a=this.opts.secure?"wss":"ws",b=this.query||{};return this.opts.timestampRequests&&(b[this.opts.timestampParam]=z()),this.supportsBinary||(b.b64=1),this.createUri(a,b)}}s.WebSocket||s.MozWebSocket;let S=(0,A.default)("engine.io-client:webtransport"),T={websocket:class extends R{createSocket(a,b,c){var d;if(null==(d=this.socket)?void 0:d._cookieJar)for(let[a,b]of(c.headers=c.headers||{},c.headers.cookie="string"==typeof c.headers.cookie?[c.headers.cookie]:c.headers.cookie||[],this.socket._cookieJar.cookies))c.headers.cookie.push(`${a}=${b.value}`);return new O.default(a,b,c)}doWrite(a,b){let c={};a.options&&(c.compress=a.options.compress),this.opts.perMessageDeflate&&("string"==typeof b?Buffer.byteLength(b):b.length)<this.opts.perMessageDeflate.threshold&&(c.compress=!1),this.ws.send(b,c)}},webtransport:class extends D{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(a){return this.emitReserved("error",a)}this._transport.closed.then(()=>{S("transport closed gracefully"),this.onClose()}).catch(a=>{S("transport closed due to %s",a),this.onError("webtransport error",a)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(a=>{var d,e;let f,g,h,i,n=(d=Number.MAX_SAFE_INTEGER,e=this.socket.binaryType,c||(c=new TextDecoder),f=[],g=0,h=-1,i=!1,new TransformStream({transform(a,b){for(f.push(a);;){if(0===g){if(1>o(f))break;let a=p(f,1);i=(128&a[0])==128,g=(h=127&a[0])<126?3:126===h?1:2}else if(1===g){if(2>o(f))break;let a=p(f,2);h=new DataView(a.buffer,a.byteOffset,a.length).getUint16(0),g=3}else if(2===g){if(8>o(f))break;let a=p(f,8),c=new DataView(a.buffer,a.byteOffset,a.length),d=c.getUint32(0);if(d>2097151){b.enqueue(j);break}h=0x100000000*d+c.getUint32(4),g=3}else{if(o(f)<h)break;let a=p(f,h);b.enqueue(m(i?a:c.decode(a),e)),g=0}if(0===h||h>d){b.enqueue(j);break}}}})),q=a.readable.pipeThrough(n).getReader(),r=new TransformStream({transform(a,c){!function(a,c){if(a.data instanceof ArrayBuffer||ArrayBuffer.isView(a.data))return c(l(a.data,!1));k(a,!0,a=>{b||(b=new TextEncoder),c(b.encode(a))})}(a,b=>{let d,e=b.length;if(e<126)new DataView((d=new Uint8Array(1)).buffer).setUint8(0,e);else if(e<65536){let a=new DataView((d=new Uint8Array(3)).buffer);a.setUint8(0,126),a.setUint16(1,e)}else{let a=new DataView((d=new Uint8Array(9)).buffer);a.setUint8(0,127),a.setBigUint64(1,BigInt(e))}a.data&&"string"!=typeof a.data&&(d[0]|=128),c.enqueue(d),c.enqueue(b)})}});r.readable.pipeTo(a.writable),this._writer=r.writable.getWriter();let s=()=>{q.read().then(({done:a,value:b})=>{a?S("session is closed"):(S("received chunk: %o",b),this.onPacket(b),s())}).catch(a=>{S("an error occurred while reading: %s",a)})};s();let u={type:"open"};this.query.sid&&(u.data=`{"sid":"${this.query.sid}"}`),this._writer.write(u).then(()=>this.onOpen())})})}write(a){this.writable=!1;for(let b=0;b<a.length;b++){let c=a[b],d=b===a.length-1;this._writer.write(c).then(()=>{d&&r(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var a;null==(a=this._transport)||a.close()}},polling:class extends K{request(a={}){var b;return Object.assign(a,{xd:this.xd,cookieJar:null==(b=this.socket)?void 0:b._cookieJar},this.opts),new L(a=>new N(a),this.uri(),a)}}},U=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,V=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function W(a){var b,c;let d,e;if(a.length>8e3)throw"URI too long";let f=a,g=a.indexOf("["),h=a.indexOf("]");-1!=g&&-1!=h&&(a=a.substring(0,g)+a.substring(g,h).replace(/:/g,";")+a.substring(h,a.length));let i=U.exec(a||""),j={},k=14;for(;k--;)j[V[k]]=i[k]||"";return -1!=g&&-1!=h&&(j.source=f,j.host=j.host.substring(1,j.host.length-1).replace(/;/g,":"),j.authority=j.authority.replace("[","").replace("]","").replace(/;/g,":"),j.ipv6uri=!0),d=(b=j.path).replace(/\/{2,9}/g,"/").split("/"),("/"==b.slice(0,1)||0===b.length)&&d.splice(0,1),"/"==b.slice(-1)&&d.splice(d.length-1,1),j.pathNames=d,c=j.query,e={},c.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(a,b,c){b&&(e[b]=c)}),j.queryKey=e,j}let X=(0,A.default)("engine.io-client:socket"),Y="function"==typeof addEventListener&&"function"==typeof removeEventListener,Z=[];Y&&addEventListener("offline",()=>{X("closing %d connection(s) because the network was lost",Z.length),Z.forEach(a=>a())},!1);class $ extends q{constructor(a,b){if(super(),this.binaryType="nodebuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,a&&"object"==typeof a&&(b=a,a=null),a){const c=W(a);b.hostname=c.host,b.secure="https"===c.protocol||"wss"===c.protocol,b.port=c.port,c.query&&(b.query=c.query)}else b.host&&(b.hostname=W(b.host).host);y(this,b),this.secure=null!=b.secure?b.secure:"u">typeof location&&"https:"===location.protocol,b.hostname&&!b.port&&(b.port=this.secure?"443":"80"),this.hostname=b.hostname||("u">typeof location?location.hostname:"localhost"),this.port=b.port||("u">typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},b.transports.forEach(a=>{let b=a.prototype.name;this.transports.push(b),this._transportsByName[b]=a}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},b),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(a){let b={},c=a.split("&");for(let a=0,d=c.length;a<d;a++){let d=c[a].split("=");b[decodeURIComponent(d[0])]=decodeURIComponent(d[1])}return b}(this.opts.query)),Y&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(X("adding listener for the 'offline' event"),this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Z.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=new u),this._open()}createTransport(a){X('creating transport "%s"',a);let b=Object.assign({},this.opts.query);b.EIO=4,b.transport=a,this.id&&(b.sid=this.id);let c=Object.assign({},this.opts,{query:b,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[a]);return X("options: %j",c),new this._transportsByName[a](c)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);let a=this.opts.rememberUpgrade&&$.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";let b=this.createTransport(a);b.open(),this.setTransport(b)}setTransport(a){X("setting transport %s",a.name),this.transport&&(X("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=a,a.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",a=>this._onClose("transport close",a))}onOpen(){X("socket open"),this.readyState="open",$.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(a){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(X('socket receive: type "%s", data "%s"',a.type,a.data),this.emitReserved("packet",a),this.emitReserved("heartbeat"),a.type){case"open":this.onHandshake(JSON.parse(a.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let b=Error("server error");b.code=a.data,this._onError(b);break;case"message":this.emitReserved("data",a.data),this.emitReserved("message",a.data)}else X('packet received with socket readyState "%s"',this.readyState)}onHandshake(a){this.emitReserved("handshake",a),this.id=a.sid,this.transport.query.sid=a.sid,this._pingInterval=a.pingInterval,this._pingTimeout=a.pingTimeout,this._maxPayload=a.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let a=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+a,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},a),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let a=this._getWritablePackets();X("flushing %d packets in socket",a.length),this.transport.send(a),this._prevBufferLen=a.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let a=1;for(let b=0;b<this.writeBuffer.length;b++){let c=this.writeBuffer[b].data;if(c&&(a+="string"==typeof c?function(a){let b=0,c=0;for(let d=0,e=a.length;d<e;d++)(b=a.charCodeAt(d))<128?c+=1:b<2048?c+=2:b<55296||b>=57344?c+=3:(d++,c+=4);return c}(c):Math.ceil(1.33*(c.byteLength||c.size))),b>0&&a>this._maxPayload)return X("only send %d out of %d packets",b,this.writeBuffer.length),this.writeBuffer.slice(0,b);a+=2}return X("payload size is %d (max: %d)",a,this._maxPayload),this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let a=Date.now()>this._pingTimeoutTime;return a&&(X("throttled timer detected, scheduling connection close"),this._pingTimeoutTime=0,r(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),a}write(a,b,c){return this._sendPacket("message",a,b,c),this}send(a,b,c){return this._sendPacket("message",a,b,c),this}_sendPacket(a,b,c,d){if("function"==typeof b&&(d=b,b=void 0),"function"==typeof c&&(d=c,c=null),"closing"===this.readyState||"closed"===this.readyState)return;(c=c||{}).compress=!1!==c.compress;let e={type:a,data:b,options:c};this.emitReserved("packetCreate",e),this.writeBuffer.push(e),d&&this.once("flush",d),this.flush()}close(){let a=()=>{this._onClose("forced close"),X("socket closing - telling transport to close"),this.transport.close()},b=()=>{this.off("upgrade",b),this.off("upgradeError",b),a()},c=()=>{this.once("upgrade",b),this.once("upgradeError",b)};return("opening"===this.readyState||"open"===this.readyState)&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?c():a()}):this.upgrading?c():a()),this}_onError(a){if(X("socket error %j",a),$.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return X("trying next transport"),this.transports.shift(),this._open();this.emitReserved("error",a),this._onClose("transport error",a)}_onClose(a,b){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(X('socket close with reason: "%s"',a),this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Y&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let a=Z.indexOf(this._offlineEventListener);-1!==a&&(X("removing listener for the 'offline' event"),Z.splice(a,1))}this.readyState="closed",this.id=null,this.emitReserved("close",a,b),this.writeBuffer=[],this._prevBufferLen=0}}}$.protocol=4;class _ extends ${constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade){X("starting upgrade probes");for(let a=0;a<this._upgrades.length;a++)this._probe(this._upgrades[a])}}_probe(a){X('probing transport "%s"',a);let b=this.createTransport(a),c=!1;$.priorWebsocketSuccess=!1;let d=()=>{c||(X('probe transport "%s" opened',a),b.send([{type:"ping",data:"probe"}]),b.once("packet",d=>{if(!c)if("pong"===d.type&&"probe"===d.data){if(X('probe transport "%s" pong',a),this.upgrading=!0,this.emitReserved("upgrading",b),!b)return;$.priorWebsocketSuccess="websocket"===b.name,X('pausing current transport "%s"',this.transport.name),this.transport.pause(()=>{c||"closed"!==this.readyState&&(X("changing transport and sending upgrade packet"),j(),this.setTransport(b),b.send([{type:"upgrade"}]),this.emitReserved("upgrade",b),b=null,this.upgrading=!1,this.flush())})}else{X('probe transport "%s" failed',a);let c=Error("probe error");c.transport=b.name,this.emitReserved("upgradeError",c)}}))};function e(){c||(c=!0,j(),b.close(),b=null)}let f=c=>{let d=Error("probe error: "+c);d.transport=b.name,e(),X('probe transport "%s" failed because of error: %s',a,c),this.emitReserved("upgradeError",d)};function g(){f("transport closed")}function h(){f("socket closed")}function i(a){b&&a.name!==b.name&&(X('"%s" works - aborting "%s"',a.name,b.name),e())}let j=()=>{b.removeListener("open",d),b.removeListener("error",f),b.removeListener("close",g),this.off("close",h),this.off("upgrading",i)};b.once("open",d),b.once("error",f),b.once("close",g),this.once("close",h),this.once("upgrading",i),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==a?this.setTimeoutFn(()=>{c||b.open()},200):b.open()}onHandshake(a){this._upgrades=this._filterUpgrades(a.upgrades),super.onHandshake(a)}_filterUpgrades(a){let b=[];for(let c=0;c<a.length;c++)~this.transports.indexOf(a[c])&&b.push(a[c]);return b}}class aa extends _{constructor(a,b={}){const c="object"==typeof a?a:b;(!c.transports||c.transports&&"string"==typeof c.transports[0])&&(c.transports=(c.transports||["polling","websocket","webtransport"]).map(a=>T[a]).filter(a=>!!a)),super(a,c)}}aa.protocol;let ab=(0,A.default)("socket.io-client:url"),ac="function"==typeof ArrayBuffer,ad=Object.prototype.toString,ae="function"==typeof Blob||"u">typeof Blob&&"[object BlobConstructor]"===ad.call(Blob),af="function"==typeof File||"u">typeof File&&"[object FileConstructor]"===ad.call(File);function ag(a){return ac&&(a instanceof ArrayBuffer||("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(a):a.buffer instanceof ArrayBuffer))||ae&&a instanceof Blob||af&&a instanceof File}let ah=(0,A.default)("socket.io-parser"),ai=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];(e=f||(f={}))[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK";class aj extends q{constructor(a){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},"function"==typeof a?{reviver:a}:a)}add(a){let b;if("string"==typeof a){if(this.reconstructor)throw Error("got plaintext data when reconstructing a packet");let c=(b=this.decodeString(a)).type===f.BINARY_EVENT;c||b.type===f.BINARY_ACK?(b.type=c?f.EVENT:f.ACK,this.reconstructor=new ak(b),0===b.attachments&&super.emitReserved("decoded",b)):super.emitReserved("decoded",b)}else if(ag(a)||a.base64)if(this.reconstructor)(b=this.reconstructor.takeBinaryData(a))&&(this.reconstructor=null,super.emitReserved("decoded",b));else throw Error("got binary data when not reconstructing a packet");else throw Error("Unknown type: "+a)}decodeString(a){let b=0,c={type:Number(a.charAt(0))};if(void 0===f[c.type])throw Error("unknown packet type "+c.type);if(c.type===f.BINARY_EVENT||c.type===f.BINARY_ACK){let d=b+1;for(;"-"!==a.charAt(++b)&&b!=a.length;);let e=a.substring(d,b);if(e!=Number(e)||"-"!==a.charAt(b))throw Error("Illegal attachments");let f=Number(e);if(!al(f)||f<0)throw Error("Illegal attachments");if(f>this.opts.maxAttachments)throw Error("too many attachments");c.attachments=f}if("/"===a.charAt(b+1)){let d=b+1;for(;++b&&","!==a.charAt(b)&&b!==a.length;);c.nsp=a.substring(d,b)}else c.nsp="/";let d=a.charAt(b+1);if(""!==d&&Number(d)==d){let d=b+1;for(;++b;){let c=a.charAt(b);if(null==c||Number(c)!=c){--b;break}if(b===a.length)break}c.id=Number(a.substring(d,b+1))}if(a.charAt(++b)){let d=this.tryParse(a.substr(b));if(aj.isPayloadValid(c.type,d))c.data=d;else throw Error("invalid payload")}return ah("decoded %s as %j",a,c),c}tryParse(a){try{return JSON.parse(a,this.opts.reviver)}catch(a){return!1}}static isPayloadValid(a,b){switch(a){case f.CONNECT:return am(b);case f.DISCONNECT:return void 0===b;case f.CONNECT_ERROR:return"string"==typeof b||am(b);case f.EVENT:case f.BINARY_EVENT:return Array.isArray(b)&&("number"==typeof b[0]||"string"==typeof b[0]&&-1===ai.indexOf(b[0]));case f.ACK:case f.BINARY_ACK:return Array.isArray(b)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class ak{constructor(a){this.packet=a,this.buffers=[],this.reconPack=a}takeBinaryData(a){if(this.buffers.push(a),this.buffers.length===this.reconPack.attachments){var b,c;let a=(b=this.reconPack,c=this.buffers,b.data=function a(b,c){if(!b)return b;if(b&&!0===b._placeholder){if("number"==typeof b.num&&b.num>=0&&b.num<c.length)return c[b.num];throw Error("illegal attachments")}if(Array.isArray(b))for(let d=0;d<b.length;d++)b[d]=a(b[d],c);else if("object"==typeof b)for(let d in b)Object.prototype.hasOwnProperty.call(b,d)&&(b[d]=a(b[d],c));return b}(b.data,c),delete b.attachments,b);return this.finishedReconstruction(),a}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}let al=Number.isInteger||function(a){return"number"==typeof a&&isFinite(a)&&Math.floor(a)===a};function am(a){return"[object Object]"===Object.prototype.toString.call(a)}function an(a,b,c){return a.on(b,c),function(){a.off(b,c)}}a.s(["Decoder",0,aj,"Encoder",0,class{constructor(a){this.replacer=a}encode(a){return(ah("encoding packet %j",a),(a.type===f.EVENT||a.type===f.ACK)&&function a(b,c){if(!b||"object"!=typeof b)return!1;if(Array.isArray(b)){for(let c=0,d=b.length;c<d;c++)if(a(b[c]))return!0;return!1}if(ag(b))return!0;if(b.toJSON&&"function"==typeof b.toJSON&&1==arguments.length)return a(b.toJSON(),!0);for(let c in b)if(Object.prototype.hasOwnProperty.call(b,c)&&a(b[c]))return!0;return!1}(a))?this.encodeAsBinary({type:a.type===f.EVENT?f.BINARY_EVENT:f.BINARY_ACK,nsp:a.nsp,data:a.data,id:a.id}):[this.encodeAsString(a)]}encodeAsString(a){let b=""+a.type;return(a.type===f.BINARY_EVENT||a.type===f.BINARY_ACK)&&(b+=a.attachments+"-"),a.nsp&&"/"!==a.nsp&&(b+=a.nsp+","),null!=a.id&&(b+=a.id),null!=a.data&&(b+=JSON.stringify(a.data,this.replacer)),ah("encoded %j as %s",a,b),b}encodeAsBinary(a){let b,c,d=(b=[],c=a.data,a.data=function a(b,c){if(!b)return b;if(ag(b)){let a={_placeholder:!0,num:c.length};return c.push(b),a}if(Array.isArray(b)){let d=Array(b.length);for(let e=0;e<b.length;e++)d[e]=a(b[e],c);return d}if("object"==typeof b&&!(b instanceof Date)){let d={};for(let e in b)Object.prototype.hasOwnProperty.call(b,e)&&(d[e]=a(b[e],c));return d}return b}(c,b),a.attachments=b.length,{packet:a,buffers:b}),e=this.encodeAsString(d.packet),f=d.buffers;return f.unshift(e),f}},"PacketType",0,f,"isPacketValid",0,function(a){var b;return"string"==typeof a.nsp&&(void 0===(b=a.id)||al(b))&&function(a,b){switch(a){case f.CONNECT:return void 0===b||am(b);case f.DISCONNECT:return void 0===b;case f.EVENT:return Array.isArray(b)&&("number"==typeof b[0]||"string"==typeof b[0]&&-1===ai.indexOf(b[0]));case f.ACK:return Array.isArray(b);case f.CONNECT_ERROR:return"string"==typeof b||am(b);default:return!1}}(a.type,a.data)},"protocol",0,5],32882);let ao=(0,A.default)("socket.io-client:socket"),ap=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class aq extends q{constructor(a,b,c){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=a,this.nsp=b,c&&c.auth&&(this.auth=c.auth),this._opts=Object.assign({},c),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let a=this.io;this.subs=[an(a,"open",this.onopen.bind(this)),an(a,"packet",this.onpacket.bind(this)),an(a,"error",this.onerror.bind(this)),an(a,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...a){return a.unshift("message"),this.emit.apply(this,a),this}emit(a,...b){var c,d,e;if(ap.hasOwnProperty(a))throw Error('"'+a.toString()+'" is a reserved event name');if(b.unshift(a),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(b),this;let g={type:f.EVENT,data:b};if(g.options={},g.options.compress=!1!==this.flags.compress,"function"==typeof b[b.length-1]){let a=this.ids++;ao("emitting packet with ack id %d",a);let c=b.pop();this._registerAckCallback(a,c),g.id=a}let h=null==(d=null==(c=this.io.engine)?void 0:c.transport)?void 0:d.writable,i=this.connected&&!(null==(e=this.io.engine)?void 0:e._hasPingExpired());return this.flags.volatile&&!h?ao("discard packet as the transport is not currently writable"):i?(this.notifyOutgoingListeners(g),this.packet(g)):this.sendBuffer.push(g),this.flags={},this}_registerAckCallback(a,b){var c;let d=null!=(c=this.flags.timeout)?c:this._opts.ackTimeout;if(void 0===d){this.acks[a]=b;return}let e=this.io.setTimeoutFn(()=>{delete this.acks[a];for(let b=0;b<this.sendBuffer.length;b++)this.sendBuffer[b].id===a&&(ao("removing packet with ack id %d from the buffer",a),this.sendBuffer.splice(b,1));ao("event with ack id %d has timed out after %d ms",a,d),b.call(this,Error("operation has timed out"))},d),f=(...a)=>{this.io.clearTimeoutFn(e),b.apply(this,a)};f.withError=!0,this.acks[a]=f}emitWithAck(a,...b){return new Promise((c,d)=>{let e=(a,b)=>a?d(a):c(b);e.withError=!0,b.push(e),this.emit(a,...b)})}_addToQueue(a){let b;"function"==typeof a[a.length-1]&&(b=a.pop());let c={id:this._queueSeq++,tryCount:0,pending:!1,args:a,flags:Object.assign({fromQueue:!0},this.flags)};a.push((a,...d)=>c!==this._queue[0]?ao("packet [%d] already acknowledged",c.id):(null!==a?c.tryCount>this._opts.retries&&(ao("packet [%d] is discarded after %d tries",c.id,c.tryCount),this._queue.shift(),b&&b(a)):(ao("packet [%d] was successfully sent",c.id),this._queue.shift(),b&&b(null,...d)),c.pending=!1,this._drainQueue())),this._queue.push(c),this._drainQueue()}_drainQueue(a=!1){if(ao("draining queue"),!this.connected||0===this._queue.length)return;let b=this._queue[0];b.pending&&!a?ao("packet [%d] has already been sent and is waiting for an ack",b.id):(b.pending=!0,b.tryCount++,ao("sending packet [%d] (try n°%d)",b.id,b.tryCount),this.flags=b.flags,this.emit.apply(this,b.args))}packet(a){a.nsp=this.nsp,this.io._packet(a)}onopen(){ao("transport is open - connecting"),"function"==typeof this.auth?this.auth(a=>{this._sendConnectPacket(a)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(a){this.packet({type:f.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},a):a})}onerror(a){this.connected||this.emitReserved("connect_error",a)}onclose(a,b){ao("close (%s)",a),this.connected=!1,delete this.id,this.emitReserved("disconnect",a,b),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(a=>{if(!this.sendBuffer.some(b=>String(b.id)===a)){let b=this.acks[a];delete this.acks[a],b.withError&&b.call(this,Error("socket has been disconnected"))}})}onpacket(a){if(a.nsp===this.nsp)switch(a.type){case f.CONNECT:a.data&&a.data.sid?this.onconnect(a.data.sid,a.data.pid):this.emitReserved("connect_error",Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case f.EVENT:case f.BINARY_EVENT:this.onevent(a);break;case f.ACK:case f.BINARY_ACK:this.onack(a);break;case f.DISCONNECT:this.ondisconnect();break;case f.CONNECT_ERROR:this.destroy();let b=Error(a.data.message);b.data=a.data.data,this.emitReserved("connect_error",b)}}onevent(a){let b=a.data||[];ao("emitting event %j",b),null!=a.id&&(ao("attaching ack callback to event"),b.push(this.ack(a.id))),this.connected?this.emitEvent(b):this.receiveBuffer.push(Object.freeze(b))}emitEvent(a){if(this._anyListeners&&this._anyListeners.length)for(let b of this._anyListeners.slice())b.apply(this,a);super.emit.apply(this,a),this._pid&&a.length&&"string"==typeof a[a.length-1]&&(this._lastOffset=a[a.length-1])}ack(a){let b=this,c=!1;return function(...d){c||(c=!0,ao("sending ack %j",d),b.packet({type:f.ACK,id:a,data:d}))}}onack(a){let b=this.acks[a.id];"function"!=typeof b?ao("bad ack %s",a.id):(delete this.acks[a.id],ao("calling ack %s with %j",a.id,a.data),b.withError&&a.data.unshift(null),b.apply(this,a.data))}onconnect(a,b){ao("socket connected with id %s",a),this.id=a,this.recovered=b&&this._pid===b,this._pid=b,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(a=>this.emitEvent(a)),this.receiveBuffer=[],this.sendBuffer.forEach(a=>{this.notifyOutgoingListeners(a),this.packet(a)}),this.sendBuffer=[]}ondisconnect(){ao("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(a=>a()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&(ao("performing disconnect (%s)",this.nsp),this.packet({type:f.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(a){return this.flags.compress=a,this}get volatile(){return this.flags.volatile=!0,this}timeout(a){return this.flags.timeout=a,this}onAny(a){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(a),this}prependAny(a){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(a),this}offAny(a){if(!this._anyListeners)return this;if(a){let b=this._anyListeners;for(let c=0;c<b.length;c++)if(a===b[c]){b.splice(c,1);break}}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(a){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(a),this}prependAnyOutgoing(a){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(a),this}offAnyOutgoing(a){if(!this._anyOutgoingListeners)return this;if(a){let b=this._anyOutgoingListeners;for(let c=0;c<b.length;c++)if(a===b[c]){b.splice(c,1);break}}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(a){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length)for(let b of this._anyOutgoingListeners.slice())b.apply(this,a.data)}}var ar=a.i(32882);function as(a){a=a||{},this.ms=a.min||100,this.max=a.max||1e4,this.factor=a.factor||2,this.jitter=a.jitter>0&&a.jitter<=1?a.jitter:0,this.attempts=0}as.prototype.duration=function(){var a=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var b=Math.random(),c=Math.floor(b*this.jitter*a);a=(1&Math.floor(10*b))==0?a-c:a+c}return 0|Math.min(a,this.max)},as.prototype.reset=function(){this.attempts=0},as.prototype.setMin=function(a){this.ms=a},as.prototype.setMax=function(a){this.max=a},as.prototype.setJitter=function(a){this.jitter=a};let at=(0,A.default)("socket.io-client:manager");class au extends q{constructor(a,b){var c;super(),this.nsps={},this.subs=[],a&&"object"==typeof a&&(b=a,a=void 0),(b=b||{}).path=b.path||"/socket.io",this.opts=b,y(this,b),this.reconnection(!1!==b.reconnection),this.reconnectionAttempts(b.reconnectionAttempts||1/0),this.reconnectionDelay(b.reconnectionDelay||1e3),this.reconnectionDelayMax(b.reconnectionDelayMax||5e3),this.randomizationFactor(null!=(c=b.randomizationFactor)?c:.5),this.backoff=new as({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==b.timeout?2e4:b.timeout),this._readyState="closed",this.uri=a;const d=b.parser||ar;this.encoder=new d.Encoder,this.decoder=new d.Decoder,this._autoConnect=!1!==b.autoConnect,this._autoConnect&&this.open()}reconnection(a){return arguments.length?(this._reconnection=!!a,a||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(a){return void 0===a?this._reconnectionAttempts:(this._reconnectionAttempts=a,this)}reconnectionDelay(a){var b;return void 0===a?this._reconnectionDelay:(this._reconnectionDelay=a,null==(b=this.backoff)||b.setMin(a),this)}randomizationFactor(a){var b;return void 0===a?this._randomizationFactor:(this._randomizationFactor=a,null==(b=this.backoff)||b.setJitter(a),this)}reconnectionDelayMax(a){var b;return void 0===a?this._reconnectionDelayMax:(this._reconnectionDelayMax=a,null==(b=this.backoff)||b.setMax(a),this)}timeout(a){return arguments.length?(this._timeout=a,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(a){if(at("readyState %s",this._readyState),~this._readyState.indexOf("open"))return this;at("opening %s",this.uri),this.engine=new aa(this.uri,this.opts);let b=this.engine,c=this;this._readyState="opening",this.skipReconnect=!1;let d=an(b,"open",function(){c.onopen(),a&&a()}),e=b=>{at("error"),this.cleanup(),this._readyState="closed",this.emitReserved("error",b),a?a(b):this.maybeReconnectOnOpen()},f=an(b,"error",e);if(!1!==this._timeout){let a=this._timeout;at("connect attempt will timeout after %d",a);let c=this.setTimeoutFn(()=>{at("connect attempt timed out after %d",a),d(),e(Error("timeout")),b.close()},a);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(d),this.subs.push(f),this}connect(a){return this.open(a)}onopen(){at("open"),this.cleanup(),this._readyState="open",this.emitReserved("open");let a=this.engine;this.subs.push(an(a,"ping",this.onping.bind(this)),an(a,"data",this.ondata.bind(this)),an(a,"error",this.onerror.bind(this)),an(a,"close",this.onclose.bind(this)),an(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(a){try{this.decoder.add(a)}catch(a){this.onclose("parse error",a)}}ondecoded(a){r(()=>{this.emitReserved("packet",a)},this.setTimeoutFn)}onerror(a){at("error",a),this.emitReserved("error",a)}socket(a,b){let c=this.nsps[a];return c?this._autoConnect&&!c.active&&c.connect():(c=new aq(this,a,b),this.nsps[a]=c),c}_destroy(a){for(let a of Object.keys(this.nsps))if(this.nsps[a].active)return void at("socket %s is still active, skipping close",a);this._close()}_packet(a){at("writing packet %j",a);let b=this.encoder.encode(a);for(let c=0;c<b.length;c++)this.engine.write(b[c],a.options)}cleanup(){at("cleanup"),this.subs.forEach(a=>a()),this.subs.length=0,this.decoder.destroy()}_close(){at("disconnect"),this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(a,b){var c;at("closed due to %s",a),this.cleanup(),null==(c=this.engine)||c.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",a,b),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let a=this;if(this.backoff.attempts>=this._reconnectionAttempts)at("reconnect failed"),this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let b=this.backoff.duration();at("will wait %dms before reconnect attempt",b),this._reconnecting=!0;let c=this.setTimeoutFn(()=>{a.skipReconnect||(at("attempting reconnect"),this.emitReserved("reconnect_attempt",a.backoff.attempts),a.skipReconnect||a.open(b=>{b?(at("reconnect attempt error"),a._reconnecting=!1,a.reconnect(),this.emitReserved("reconnect_error",b)):(at("reconnect success"),a.onreconnect())}))},b);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}}onreconnect(){let a=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",a)}}let av=(0,A.default)("socket.io-client"),aw={};function ax(a,b){let c;"object"==typeof a&&(b=a,a=void 0);let d=function(a,b="",c){let d=a;c=c||"u">typeof location&&location,null==a&&(a=c.protocol+"//"+c.host),"string"==typeof a&&("/"===a.charAt(0)&&(a="/"===a.charAt(1)?c.protocol+a:c.host+a),/^(https?|wss?):\/\//.test(a)||(ab("protocol-less url %s",a),a=void 0!==c?c.protocol+"//"+a:"https://"+a),ab("parse %s",a),d=W(a)),!d.port&&(/^(http|ws)$/.test(d.protocol)?d.port="80":/^(http|ws)s$/.test(d.protocol)&&(d.port="443")),d.path=d.path||"/";let e=-1!==d.host.indexOf(":")?"["+d.host+"]":d.host;return d.id=d.protocol+"://"+e+":"+d.port+b,d.href=d.protocol+"://"+e+(c&&c.port===d.port?"":":"+d.port),d}(a,(b=b||{}).path||"/socket.io"),e=d.source,f=d.id,g=d.path,h=aw[f]&&g in aw[f].nsps;return b.forceNew||b["force new connection"]||!1===b.multiplex||h?(av("ignoring socket cache for %s",e),c=new au(e,b)):(aw[f]||(av("new io instance for %s",e),aw[f]=new au(e,b)),c=aw[f]),d.query&&!b.query&&(b.query=d.queryKey),c.socket(d.path,b)}Object.assign(ax,{Manager:au,Socket:aq,io:ax,connect:ax}),a.s(["io",0,ax],83915)},25015,12548,a=>{"use strict";var b=a.i(60137);let c=(0,b.default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);a.s(["Play",0,c],25015);let d=(0,b.default)("square-pen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);a.s(["SquarePen",0,d],12548)},54124,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(10450),e=a.i(99813),f=a.i(83915),g=a.i(80087),h=a.i(96221),i=a.i(5151),j=a.i(25015),k=a.i(33441),l=a.i(12548),m=a.i(53155),n=a.i(39524),o=a.i(65025),p=a.i(91399);let q=(0,c.forwardRef)(function({tabId:a,cwd:q,env:r,worktreePath:s,command:u,className:v="",initialTodos:w,initialClaudeStatus:x,isActive:y,onTodosUpdated:z,onStatusChange:A},B){let C=(0,c.useRef)(null),D=(0,c.useRef)(null),E=(0,c.useRef)(null),F=(0,c.useRef)(null),G=(0,c.useRef)(a),[H,I]=(0,c.useState)(!1),J=(0,c.useRef)(!1),K=(0,c.useRef)(y),L=(0,c.useRef)("idle"),M=(0,c.useRef)(!1),N=(0,c.useRef)(!1),O=(0,c.useRef)(null),P=(0,c.useRef)(null),Q=(0,c.useRef)(null),R=(0,c.useRef)(0),[S,T]=(0,c.useState)("idle"),[U,V]=(0,c.useState)(x??"idle"),W=(0,c.useRef)(x??"idle"),[X,Y]=(0,c.useState)(w??[]),[Z,$]=(0,c.useState)(!1),{effectiveTheme:_}=(0,g.useTheme)(),aa=(0,c.useRef)(A);aa.current=A;let ab="dark"===_,ac=ab?{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#d4d4d4",selectionBackground:"#264f78"}:{background:"#ffffff",foreground:"#1e1e1e",cursor:"#1e1e1e",selectionBackground:"#add6ff"};async function ad(a){try{await fetch((0,p.apiUrl)(`/api/internal/tabs/${a}/interrupt`),{method:"POST"})}catch(a){console.warn("[TerminalView] Failed to notify interrupt:",a)}}function ae(){let a=F.current,b=D.current,c=G.current;a&&a.connected&&b&&c&&a.emit("resize",{sessionId:c,cols:b.cols,rows:b.rows})}function af(a){a.write("\x1b[2J\x1b[3J\x1b[H")}async function ag(b,c,d){T("connecting");try{var e,g,h,i;let j,k,l=await fetch((0,p.apiUrl)("/api/terminal/sessions"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:q,env:r,worktreePath:s,sessionId:b,command:u}),signal:d});if(!l.ok){let a=await l.text().catch(()=>"");throw Error(`Failed to create session: ${l.status} ${a}`)}let m=await l.json();if(d.aborted)return;G.current=m.sessionId,m.reused||af(c),e=m.sessionId,g=m.reused,h=c,i=d,O.current?.dispose(),O.current=null,F.current&&(F.current.removeAllListeners(),F.current.disconnect()),F.current=j=(0,f.io)((0,p.getServerUrl)(),{transports:["polling","websocket"]}),k=!1,j.on("connect",()=>{let a=M.current;M.current=!0,a?h.writeln("\x1b[90mReconnected.\x1b[0m"):g?(N.current=!0,af(h)):h.writeln("\x1b[90mConnected.\x1b[0m"),T("connected"),R.current=0,j.emit("join",{room:`tab:${e}`,mode:"terminal"}),a&&K.current&&h.focus()}),j.on("output",({data:a})=>{g&&!k?(k=!0,h.write(a,()=>{N.current=!1,E.current?.fit();let a=D.current;if(a){let b=64===a.cols?63:64;a.resize(b,a.rows),ae(),setTimeout(()=>{E.current?.fit(),ae()},50)}h.scrollToBottom()})):h.write(a)}),j.on("exit",({exitCode:a})=>{console.log("[TerminalView] PTY exited with code:",a),T("exited"),G.current=null,F.current=null}),j.on("error",({message:a})=>{if(console.error("[TerminalView] Socket error message:",a),a.startsWith("Session not found")&&R.current<1){R.current+=1,ah();return}T("error")}),j.on("disconnect",()=>{i.aborted||T(a=>"exited"===a||"paused"===a||"idle"===a?a:"exited")}),j.on("status-changed",({status:a})=>{V(a)}),j.on("todos-updated",({todos:b})=>{Y(b),z?.(a,b)}),j.on("editor:open",({sessionId:a,content:b})=>{window.dispatchEvent(new CustomEvent("editor-session-open-request",{detail:{sessionId:a,content:b}}))}),O.current=h.onData(a=>{"\x1b"===a&&("running"===W.current||"waiting"===W.current)&&G.current&&ad(G.current),j.connected&&G.current&&j.emit("input",{sessionId:G.current,data:a})})}catch(a){if(a instanceof Error&&"AbortError"===a.name)return;console.error("[TerminalView] connectSession error:",a instanceof Error?a.message:String(a)),T("error")}}async function ah(){let b=D.current;if(!b)return;let c=new AbortController;await ag(a,b,c.signal)}(0,c.useEffect)(()=>{aa.current?.(a,S,U)},[a,S,U]),(0,c.useLayoutEffect)(()=>{K.current=y}),(0,c.useLayoutEffect)(()=>{L.current=S}),(0,c.useLayoutEffect)(()=>{W.current=U}),(0,c.useEffect)(()=>{y&&D.current?.focus()},[y]),(0,c.useEffect)(()=>{if(H)D.current?.blur();else if(y){let a=C.current?.querySelector("textarea.xterm-helper-textarea");a?.focus()}},[H,y]),(0,c.useEffect)(()=>{"connected"===S&&E.current&&(E.current.fit(),N.current||ae())},[S]),(0,c.useEffect)(()=>{if(!C.current)return;let b=C.current,c=new d.Terminal({cursorBlink:!0,fontSize:13,fontFamily:'"Cascadia Code", "Fira Code", "Menlo", monospace',theme:ac,allowProposedApi:!0}),f=new e.FitAddon;c.loadAddon(f),c.open(C.current),f.fit(),D.current=c,E.current=f,K.current&&c.focus(),c.attachCustomKeyEventHandler(()=>!J.current),c.buffer.onBufferChange(a=>{"normal"===a.type&&c.refresh(0,c.rows-1)});let g=0,h=a=>{let b=performance.now();""===a.data&&b-g<100?a.stopImmediatePropagation():g=b};b.addEventListener("compositionend",h,!0);let i=new ResizeObserver(()=>{!J.current&&(f.fit(),N.current||ae())});i.observe(C.current);let j=new AbortController;return ag(a,c,j.signal),()=>{j.abort(),i.disconnect(),b.removeEventListener("compositionend",h,!0),O.current?.dispose(),O.current=null,c.dispose(),D.current=null,E.current=null,F.current?.removeAllListeners(),F.current?.disconnect(),F.current=null}},[]),(0,c.useEffect)(()=>{D.current&&(D.current.options.theme=ac)},[ab]),(0,c.useEffect)(()=>{function a(){J.current=!0,D.current?.blur()}function b(){if(setTimeout(()=>{let a=D.current;if(a){let b=64===a.cols?63:64;a.resize(b,a.rows),ae(),setTimeout(()=>{J.current=!1,E.current?.fit(),ae()},100)}else J.current=!1},300),!K.current)return;let a=C.current?.querySelector("textarea.xterm-helper-textarea");a?.focus()}return window.addEventListener("editor-session-open",a),window.addEventListener("editor-session-done",b),()=>{window.removeEventListener("editor-session-open",a),window.removeEventListener("editor-session-done",b)}},[]),(0,c.useEffect)(()=>{function a(a){let b=F.current;if(!b||!b.connected||P.current)return;P.current=setTimeout(()=>{P.current=null,Q.current&&(b.off("health-check-ack",Q.current),Q.current=null),b.disconnect(),b.connect(),T("connecting")},6e3);let c=()=>{P.current&&(clearTimeout(P.current),P.current=null),Q.current=null,a.refocus&&K.current&&D.current?.focus()};Q.current=c,b.once("health-check-ack",c),b.emit("health-check")}function b(){"visible"===document.visibilityState&&a({refocus:!0})}let c=setInterval(()=>{"visible"!==document.visibilityState||"connected"===L.current&&a({refocus:!1})},8e3);return document.addEventListener("visibilitychange",b),()=>{document.removeEventListener("visibilitychange",b),clearInterval(c),P.current&&(clearTimeout(P.current),P.current=null),Q.current&&(F.current?.off("health-check-ack",Q.current),Q.current=null)}},[]),(0,c.useImperativeHandle)(B,()=>({sendInput:a=>{let b=F.current,c=G.current;b?.connected&&c&&b.emit("input",{sessionId:c,data:a})},focus:()=>{D.current?.focus()}}));let ai=(0,c.useCallback)(()=>{navigator.clipboard.writeText(a).then(()=>{$(!0),setTimeout(()=>$(!1),2e3)})},[a]),aj="connecting"===S,ak="paused"===S||"exited"===S||"error"===S,al="connected"===S,am=X.filter(a=>"deleted"!==a.status),an=am.filter(a=>"completed"===a.status).length,ao=am.length,ap=a.length>8?`${a.slice(0,8)}…`:a;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:`flex flex-col h-full min-h-0 ${v}`,children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 border-b border-border flex-shrink-0 bg-card",children:[(0,b.jsx)("span",{className:"font-mono text-xs text-muted-foreground",title:a,children:ap}),(0,b.jsx)(n.Button,{variant:"ghost",size:"icon-xs",onClick:ai,className:"text-muted-foreground hover:text-foreground",title:"Copy tab ID",children:Z?(0,b.jsx)(k.Check,{className:"w-3 h-3 text-success"}):(0,b.jsx)(i.Copy,{className:"w-3 h-3"})}),(0,b.jsxs)(n.Button,{size:"xs",onClick:function(){let a=F.current,b=G.current;if(!a||!a.connected||!b)return;let c=`claude --dangerously-skip-permissions --resume ${b} 2>/dev/null || claude --dangerously-skip-permissions --session-id ${b}
33
+ `;a.emit("input",{sessionId:b,data:c})},disabled:!al,title:"Run Claude",children:[(0,b.jsx)(j.Play,{className:"w-3 h-3"}),"Run Claude"]}),(0,b.jsxs)(n.Button,{variant:"ghost",size:"xs",onClick:()=>I(!0),disabled:!al,className:"text-muted-foreground hover:text-foreground",title:"Open editor input",children:[(0,b.jsx)(l.SquarePen,{className:"w-3 h-3"}),"Open Editor"]}),ao>0&&(0,b.jsxs)("div",{className:"ml-auto flex items-center gap-1.5 shrink-0",title:X.find(a=>"in_progress"===a.status)?.content??"",children:[(0,b.jsx)(o.Progress,{value:an,max:ao,className:"w-16 gap-0 [&_[data-slot=progress-track]]:h-[3px]"}),(0,b.jsxs)("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:[an,"/",ao]})]})]}),(0,b.jsxs)("div",{className:"relative flex-1 min-h-0 overflow-hidden",children:[(0,b.jsx)("div",{ref:C,className:"w-full h-full",style:{padding:"4px"}}),aj&&(0,b.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-background",children:(0,b.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground text-xs",children:[(0,b.jsx)(h.Loader2,{className:"w-4 h-4 animate-spin"}),(0,b.jsx)("span",{children:"Connecting..."})]})}),ak&&(0,b.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-background/90",children:(0,b.jsxs)("div",{className:"text-center space-y-2",children:["error"===S&&(0,b.jsx)("p",{className:"text-xs text-destructive",children:"Connection failed"}),"exited"===S&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"Session ended"}),"paused"===S&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"Paused"}),(0,b.jsx)(n.Button,{size:"xs",onClick:ah,children:"Reconnect"})]})})]})]}),(0,b.jsx)(m.MonacoEditorModal,{open:H,onOpenChange:a=>{a.open||I(!1)},onSubmit:a=>{D.current&&a&&D.current.paste(a),I(!1)},title:"Terminal Input",submitLabel:"Paste"})]})});a.s(["TerminalView",0,q])},88381,a=>{"use strict";var b=a.i(72131),c=a.i(83915),d=a.i(91399);a.s(["useTaskEvents",0,function(a){let e=(0,b.useRef)(null),f=(0,b.useRef)(a);(0,b.useLayoutEffect)(()=>{f.current=a}),(0,b.useEffect)(()=>{let a=(0,c.io)((0,d.getServerUrl)(),{transports:["polling","websocket"]});return e.current=a,a.on("task:created",({task:a})=>{f.current.onTaskCreated(a)}),a.on("task:updated",({task:a})=>{f.current.onTaskUpdated(a)}),a.on("task:deleted",({taskId:a})=>{f.current.onTaskDeleted(a)}),()=>{a.disconnect(),e.current=null}},[])}])}];
34
34
 
35
35
  //# sourceMappingURL=%5Broot-of-the-server%5D__05isylw._.js.map