@minimalcorp/tsunagi 0.1.17 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/apps/web/.next/BUILD_ID +1 -1
- package/.next/standalone/apps/web/.next/build-manifest.json +3 -3
- package/.next/standalone/apps/web/.next/prerender-manifest.json +3 -3
- package/.next/standalone/apps/web/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/index.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/index.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/index.segments/_full.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_full.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_head.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_index.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings.segments/settings.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/tasks/[id]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/[root-of-the-server]__05isylw._.js +2 -2
- package/.next/standalone/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0ro8-ey._.js +2 -2
- package/.next/standalone/apps/web/.next/server/chunks/ssr/_0g.cd6a._.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/apps_web_src_app_tasks_[id]_page_tsx_0jshsm2._.js +1 -1
- package/.next/standalone/apps/web/.next/server/middleware-build-manifest.js +3 -3
- package/.next/standalone/apps/web/.next/server/pages/404.html +1 -1
- package/.next/standalone/apps/web/.next/server/pages/500.html +1 -1
- package/.next/standalone/apps/web/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/apps/web/.next/static/chunks/09ik3f_4bui.6.js +3 -0
- package/.next/standalone/apps/web/.next/static/chunks/{0zf.4.k6hxz~b.js → 0e9ktynfbcnuu.js} +2 -2
- package/.next/standalone/apps/web/.next/static/chunks/{03lw1.jf3nzsp.js → 10i6zv0moo8jf.js} +1 -1
- package/.next/standalone/apps/web/.next/static/chunks/{0jaki2nicisbt.js → 1145l.gbs9mp0.js} +2 -2
- package/dist/server/generated/prisma/internal/class.js +4 -4
- package/dist/server/generated/prisma/internal/prismaNamespace.d.ts +1 -0
- package/dist/server/generated/prisma/internal/prismaNamespace.js +1 -0
- package/dist/server/generated/prisma/internal/prismaNamespaceBrowser.d.ts +1 -0
- package/dist/server/generated/prisma/internal/prismaNamespaceBrowser.js +1 -0
- package/dist/server/generated/prisma/models/Tab.d.ts +36 -1
- package/dist/server/lib/repositories/task.d.ts +1 -1
- package/dist/server/lib/repositories/task.js +3 -1
- package/dist/server/routes/tasks.js +2 -1
- package/npm-shrinkwrap.json +20 -15
- package/package.json +1 -1
- package/prisma/migrations/20260629000000_add_tab_mode/migration.sql +4 -0
- package/prisma/schema.prisma +1 -0
- package/.next/standalone/apps/web/.next/static/chunks/0kpkmh5umvk_l.js +0 -3
- /package/.next/standalone/apps/web/.next/static/{Q7QTiWuO93GtNyS-DgVqZ → 36-cU0G0900-sCM9SPr1i}/_buildManifest.js +0 -0
- /package/.next/standalone/apps/web/.next/static/{Q7QTiWuO93GtNyS-DgVqZ → 36-cU0G0900-sCM9SPr1i}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/apps/web/.next/static/{Q7QTiWuO93GtNyS-DgVqZ → 36-cU0G0900-sCM9SPr1i}/_ssgManifest.js +0 -0
package/.next/standalone/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0ro8-ey._.js
CHANGED
|
@@ -9,10 +9,10 @@ ${a.themeCSS}`),void 0!==a.fontFamily&&(c+=`
|
|
|
9
9
|
If you want to hide the \`${b.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
10
10
|
|
|
11
11
|
For more information, see https://radix-ui.com/primitives/docs/components/${b.docsSlug}`;return p.useEffect(()=>{a&&(document.getElementById(a)||console.error(c))},[c,a]),null},li=({contentRef:a,descriptionId:b})=>{let c=lg("DialogDescriptionWarning"),d=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${c.contentName}}.`;return p.useEffect(()=>{let c=a.current?.getAttribute("aria-describedby");b&&c&&(document.getElementById(b)||console.warn(d))},[d,a,b]),null},lj=Symbol.for("react.lazy"),lk=p[" use ".trim().toString()];function ll(a){var b;return null!=a&&"object"==typeof a&&"$$typeof"in a&&a.$$typeof===lj&&"_payload"in a&&"object"==typeof(b=a._payload)&&null!==b&&"then"in b}var lm=Symbol("radix.slottable");function ln(a){return p.isValidElement(a)&&"function"==typeof a.type&&"__radixId"in a.type&&a.type.__radixId===lm}var lo=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((a,b)=>{var c,d;let e,f,g,h=(d=c=`Primitive.${b}`,(e=p.forwardRef((a,b)=>{let{children:c,...d}=a;if(ll(c)&&"function"==typeof lk&&(c=lk(c._payload)),p.isValidElement(c)){var e;let a,f,g=(e=c,(f=(a=Object.getOwnPropertyDescriptor(e.props,"ref")?.get)&&"isReactWarning"in a&&a.isReactWarning)?e.ref:(f=(a=Object.getOwnPropertyDescriptor(e,"ref")?.get)&&"isReactWarning"in a&&a.isReactWarning)?e.props.ref:e.props.ref||e.ref),h=function(a,b){let c={...b};for(let d in b){let e=a[d],f=b[d];/^on[A-Z]/.test(d)?e&&f?c[d]=(...a)=>{let b=f(...a);return e(...a),b}:e&&(c[d]=e):"style"===d?c[d]={...e,...f}:"className"===d&&(c[d]=[e,f].filter(Boolean).join(" "))}return{...a,...c}}(d,c.props);return c.type!==p.Fragment&&(h.ref=b?jI(b,g):g),p.cloneElement(c,h)}return p.Children.count(c)>1?p.Children.only(null):null})).displayName=`${d}.SlotClone`,f=e,(g=p.forwardRef((a,b)=>{let{children:c,...d}=a;ll(c)&&"function"==typeof lk&&(c=lk(c._payload));let e=p.Children.toArray(c),g=e.find(ln);if(g){let a=g.props.children,c=e.map(b=>b!==g?b:p.Children.count(a)>1?p.Children.only(null):p.isValidElement(a)?a.props.children:null);return(0,o.jsx)(f,{...d,ref:b,children:p.isValidElement(a)?p.cloneElement(a,void 0,c):null})}return(0,o.jsx)(f,{...d,ref:b,children:c})})).displayName=`${c}.Slot`,g),i=p.forwardRef((a,c)=>{let{asChild:d,...e}=a;return(0,o.jsx)(d?h:b,{...e,ref:c})});return i.displayName=`Primitive.${b}`,{...a,[b]:i}},{}),lp='[cmdk-group=""]',lq='[cmdk-group-items=""]',lr='[cmdk-item=""]',ls=`${lr}:not([aria-disabled="true"])`,lt="cmdk-item-select",lu="data-value",lv=(a,b,c)=>{var d;return d=a,function a(b,c,d,e,f,g,h){if(g===c.length)return f===b.length?1:.99;var i=`${f},${g}`;if(void 0!==h[i])return h[i];for(var j,k,l,m,n=e.charAt(g),o=d.indexOf(n,f),p=0;o>=0;)(j=a(b,c,d,e,o+1,g+1,h))>p&&(o===f?j*=1:jB.test(b.charAt(o-1))?(j*=.8,(l=b.slice(f,o-1).match(jC))&&f>0&&(j*=Math.pow(.999,l.length))):jD.test(b.charAt(o-1))?(j*=.9,(m=b.slice(f,o-1).match(jE))&&f>0&&(j*=Math.pow(.999,m.length))):(j*=.17,f>0&&(j*=Math.pow(.999,o-f))),b.charAt(o)!==c.charAt(g)&&(j*=.9999)),(j<.1&&d.charAt(o-1)===e.charAt(g+1)||e.charAt(g+1)===e.charAt(g)&&d.charAt(o-1)!==e.charAt(g))&&.1*(k=a(b,c,d,e,o+1,g+2,h))>j&&(j=.1*k),j>p&&(p=j),o=d.indexOf(n,o+1);return h[i]=p,p}(d=c&&c.length>0?`${d+" "+c.join(" ")}`:d,b,jF(d),jF(b),0,0,{})},lw=p.createContext(void 0),lx=p.createContext(void 0),ly=p.createContext(void 0),lz=p.forwardRef((a,b)=>{let c=lJ(()=>{var b,c;return{search:"",value:null!=(c=null!=(b=a.value)?b:a.defaultValue)?c:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),d=lJ(()=>new Set),e=lJ(()=>new Map),f=lJ(()=>new Map),g=lJ(()=>new Set),h=lH(a),{label:i,children:j,value:k,onValueChange:l,filter:m,shouldFilter:n,loop:o,disablePointerSelection:q=!1,vimBindings:r=!0,...s}=a,u=jN(),v=jN(),w=jN(),x=p.useRef(null),y=lM();lI(()=>{if(void 0!==k){let a=k.trim();c.current.value=a,z.emit()}},[k]),lI(()=>{y(6,F)},[]);let z=p.useMemo(()=>({subscribe:a=>(g.current.add(a),()=>g.current.delete(a)),snapshot:()=>c.current,setState:(a,b,d)=>{var e,f,g,i;if(!Object.is(c.current[a],b)){if(c.current[a]=b,"search"===a)E(),C(),y(1,D);else if("value"===a){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let a=document.getElementById(w);a?a.focus():null==(e=document.getElementById(u))||e.focus()}if(y(7,()=>{var a;c.current.selectedItemId=null==(a=G())?void 0:a.id,z.emit()}),d||y(5,F),(null==(f=h.current)?void 0:f.value)!==void 0){null==(i=(g=h.current).onValueChange)||i.call(g,null!=b?b:"");return}}z.emit()}},emit:()=>{g.current.forEach(a=>a())}}),[]),A=p.useMemo(()=>({value:(a,b,d)=>{var e;b!==(null==(e=f.current.get(a))?void 0:e.value)&&(f.current.set(a,{value:b,keywords:d}),c.current.filtered.items.set(a,B(b,d)),y(2,()=>{C(),z.emit()}))},item:(a,b)=>(d.current.add(a),b&&(e.current.has(b)?e.current.get(b).add(a):e.current.set(b,new Set([a]))),y(3,()=>{E(),C(),c.current.value||D(),z.emit()}),()=>{f.current.delete(a),d.current.delete(a),c.current.filtered.items.delete(a);let b=G();y(4,()=>{E(),(null==b?void 0:b.getAttribute("id"))===a&&D(),z.emit()})}),group:a=>(e.current.has(a)||e.current.set(a,new Set),()=>{f.current.delete(a),e.current.delete(a)}),filter:()=>h.current.shouldFilter,label:i||a["aria-label"],getDisablePointerSelection:()=>h.current.disablePointerSelection,listId:u,inputId:w,labelId:v,listInnerRef:x}),[]);function B(a,b){var d,e;let f=null!=(e=null==(d=h.current)?void 0:d.filter)?e:lv;return a?f(a,c.current.search,b):0}function C(){if(!c.current.search||!1===h.current.shouldFilter)return;let a=c.current.filtered.items,b=[];c.current.filtered.groups.forEach(c=>{let d=e.current.get(c),f=0;d.forEach(b=>{f=Math.max(a.get(b),f)}),b.push([c,f])});let d=x.current;H().sort((b,c)=>{var d,e;let f=b.getAttribute("id"),g=c.getAttribute("id");return(null!=(d=a.get(g))?d:0)-(null!=(e=a.get(f))?e:0)}).forEach(a=>{let b=a.closest(lq);b?b.appendChild(a.parentElement===b?a:a.closest(`${lq} > *`)):d.appendChild(a.parentElement===d?a:a.closest(`${lq} > *`))}),b.sort((a,b)=>b[1]-a[1]).forEach(a=>{var b;let c=null==(b=x.current)?void 0:b.querySelector(`${lp}[${lu}="${encodeURIComponent(a[0])}"]`);null==c||c.parentElement.appendChild(c)})}function D(){let a=H().find(a=>"true"!==a.getAttribute("aria-disabled")),b=null==a?void 0:a.getAttribute(lu);z.setState("value",b||void 0)}function E(){var a,b,g,i;if(!c.current.search||!1===h.current.shouldFilter){c.current.filtered.count=d.current.size;return}c.current.filtered.groups=new Set;let j=0;for(let e of d.current){let d=B(null!=(b=null==(a=f.current.get(e))?void 0:a.value)?b:"",null!=(i=null==(g=f.current.get(e))?void 0:g.keywords)?i:[]);c.current.filtered.items.set(e,d),d>0&&j++}for(let[a,b]of e.current)for(let d of b)if(c.current.filtered.items.get(d)>0){c.current.filtered.groups.add(a);break}c.current.filtered.count=j}function F(){var a,b,c;let d=G();d&&((null==(a=d.parentElement)?void 0:a.firstChild)===d&&(null==(c=null==(b=d.closest(lp))?void 0:b.querySelector('[cmdk-group-heading=""]'))||c.scrollIntoView({block:"nearest"})),d.scrollIntoView({block:"nearest"}))}function G(){var a;return null==(a=x.current)?void 0:a.querySelector(`${lr}[aria-selected="true"]`)}function H(){var a;return Array.from((null==(a=x.current)?void 0:a.querySelectorAll(ls))||[])}function I(a){let b=H()[a];b&&z.setState("value",b.getAttribute(lu))}function J(a){var b;let c=G(),d=H(),e=d.findIndex(a=>a===c),f=d[e+a];null!=(b=h.current)&&b.loop&&(f=e+a<0?d[d.length-1]:e+a===d.length?d[0]:d[e+a]),f&&z.setState("value",f.getAttribute(lu))}function K(a){let b=G(),c=null==b?void 0:b.closest(lp),d;for(;c&&!d;)d=null==(c=a>0?function(a,b){let c=a.nextElementSibling;for(;c;){if(c.matches(b))return c;c=c.nextElementSibling}}(c,lp):function(a,b){let c=a.previousElementSibling;for(;c;){if(c.matches(b))return c;c=c.previousElementSibling}}(c,lp))?void 0:c.querySelector(ls);d?z.setState("value",d.getAttribute(lu)):J(a)}let L=()=>I(H().length-1),M=a=>{a.preventDefault(),a.metaKey?L():a.altKey?K(1):J(1)},N=a=>{a.preventDefault(),a.metaKey?I(0):a.altKey?K(-1):J(-1)};return p.createElement(lo.div,{ref:b,tabIndex:-1,...s,"cmdk-root":"",onKeyDown:a=>{var b;null==(b=s.onKeyDown)||b.call(s,a);let c=a.nativeEvent.isComposing||229===a.keyCode;if(!(a.defaultPrevented||c))switch(a.key){case"n":case"j":r&&a.ctrlKey&&M(a);break;case"ArrowDown":M(a);break;case"p":case"k":r&&a.ctrlKey&&N(a);break;case"ArrowUp":N(a);break;case"Home":a.preventDefault(),I(0);break;case"End":a.preventDefault(),L();break;case"Enter":{a.preventDefault();let b=G();if(b){let a=new Event(lt);b.dispatchEvent(a)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:A.inputId,id:A.labelId,style:lO},i),lN(a,a=>p.createElement(lx.Provider,{value:z},p.createElement(lw.Provider,{value:A},a))))}),lA=p.forwardRef((a,b)=>{var c,d;let e=jN(),f=p.useRef(null),g=p.useContext(ly),h=p.useContext(lw),i=lH(a),j=null!=(d=null==(c=i.current)?void 0:c.forceMount)?d:null==g?void 0:g.forceMount;lI(()=>{if(!j)return h.item(e,null==g?void 0:g.id)},[j]);let k=lL(e,f,[a.value,a.children,f],a.keywords),l=p.useContext(lx),m=lK(a=>a.value&&a.value===k.current),n=lK(a=>!!j||!1===h.filter()||!a.search||a.filtered.items.get(e)>0);function o(){var a,b;q(),null==(b=(a=i.current).onSelect)||b.call(a,k.current)}function q(){l.setState("value",k.current,!0)}if(p.useEffect(()=>{let b=f.current;if(!(!b||a.disabled))return b.addEventListener(lt,o),()=>b.removeEventListener(lt,o)},[n,a.onSelect,a.disabled]),!n)return null;let{disabled:r,value:s,onSelect:u,forceMount:v,keywords:w,...x}=a;return p.createElement(lo.div,{ref:jI(f,b),...x,id:e,"cmdk-item":"",role:"option","aria-disabled":!!r,"aria-selected":!!m,"data-disabled":!!r,"data-selected":!!m,onPointerMove:r||h.getDisablePointerSelection()?void 0:q,onClick:r?void 0:o},a.children)}),lB=p.forwardRef((a,b)=>{let{heading:c,children:d,forceMount:e,...f}=a,g=jN(),h=p.useRef(null),i=p.useRef(null),j=jN(),k=p.useContext(lw),l=lK(a=>!!e||!1===k.filter()||!a.search||a.filtered.groups.has(g));lI(()=>k.group(g),[]),lL(g,h,[a.value,a.heading,i]);let m=p.useMemo(()=>({id:g,forceMount:e}),[e]);return p.createElement(lo.div,{ref:jI(h,b),...f,"cmdk-group":"",role:"presentation",hidden:!l||void 0},c&&p.createElement("div",{ref:i,"cmdk-group-heading":"","aria-hidden":!0,id:j},c),lN(a,a=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":c?j:void 0},p.createElement(ly.Provider,{value:m},a))))}),lC=p.forwardRef((a,b)=>{let{alwaysRender:c,...d}=a,e=p.useRef(null),f=lK(a=>!a.search);return c||f?p.createElement(lo.div,{ref:jI(e,b),...d,"cmdk-separator":"",role:"separator"}):null}),lD=p.forwardRef((a,b)=>{let{onValueChange:c,...d}=a,e=null!=a.value,f=p.useContext(lx),g=lK(a=>a.search),h=lK(a=>a.selectedItemId),i=p.useContext(lw);return p.useEffect(()=>{null!=a.value&&f.setState("search",a.value)},[a.value]),p.createElement(lo.input,{ref:b,...d,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":i.listId,"aria-labelledby":i.labelId,"aria-activedescendant":h,id:i.inputId,type:"text",value:e?a.value:g,onChange:a=>{e||f.setState("search",a.target.value),null==c||c(a.target.value)}})}),lE=p.forwardRef((a,b)=>{let{children:c,label:d="Suggestions",...e}=a,f=p.useRef(null),g=p.useRef(null),h=lK(a=>a.selectedItemId),i=p.useContext(lw);return p.useEffect(()=>{if(g.current&&f.current){let a=g.current,b=f.current,c,d=new ResizeObserver(()=>{c=requestAnimationFrame(()=>{let c=a.offsetHeight;b.style.setProperty("--cmdk-list-height",c.toFixed(1)+"px")})});return d.observe(a),()=>{cancelAnimationFrame(c),d.unobserve(a)}}},[]),p.createElement(lo.div,{ref:jI(f,b),...e,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":h,"aria-label":d,id:i.listId},lN(a,a=>p.createElement("div",{ref:jI(g,i.listInnerRef),"cmdk-list-sizer":""},a)))}),lF=p.forwardRef((a,b)=>{let{open:c,onOpenChange:d,overlayClassName:e,contentClassName:f,container:g,...h}=a;return p.createElement(kX,{open:c,onOpenChange:d},p.createElement(k0,{container:g},p.createElement(k2,{"cmdk-overlay":"",className:e}),p.createElement(k6,{"aria-label":a.label,"cmdk-dialog":"",className:f},p.createElement(lz,{ref:b,...h}))))}),lG=Object.assign(lz,{List:lE,Item:lA,Input:lD,Group:lB,Separator:lC,Dialog:lF,Empty:p.forwardRef((a,b)=>lK(a=>0===a.filtered.count)?p.createElement(lo.div,{ref:b,...a,"cmdk-empty":"",role:"presentation"}):null),Loading:p.forwardRef((a,b)=>{let{progress:c,children:d,label:e="Loading...",...f}=a;return p.createElement(lo.div,{ref:b,...f,"cmdk-loading":"",role:"progressbar","aria-valuenow":c,"aria-valuemin":0,"aria-valuemax":100,"aria-label":e},lN(a,a=>p.createElement("div",{"aria-hidden":!0},a)))})});function lH(a){let b=p.useRef(a);return lI(()=>{b.current=a}),b}var lI=p.useEffect;function lJ(a){let b=p.useRef();return void 0===b.current&&(b.current=a()),b}function lK(a){let b=p.useContext(lx),c=()=>a(b.snapshot());return p.useSyncExternalStore(b.subscribe,c,c)}function lL(a,b,c,d=[]){let e=p.useRef(),f=p.useContext(lw);return lI(()=>{var g;let h=(()=>{var a;for(let b of c){if("string"==typeof b)return b.trim();if("object"==typeof b&&"current"in b)return b.current?null==(a=b.current.textContent)?void 0:a.trim():e.current}})(),i=d.map(a=>a.trim());f.value(a,h,i),null==(g=b.current)||g.setAttribute(lu,h),e.current=h}),e}var lM=()=>{let[a,b]=p.useState(),c=lJ(()=>new Map);return lI(()=>{c.current.forEach(a=>a()),c.current=new Map},[a]),(a,d)=>{c.current.set(a,d),b({})}};function lN({asChild:a,children:b},c){let d;return a&&p.isValidElement(b)?p.cloneElement("function"==typeof(d=b.type)?d(b.props):"render"in d?d.render(b.props):b,{ref:b.ref},c(b.props.children)):c(b)}var lO={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};a.i(26807);var lP=a.i(187),lQ=a.i(28503);function lR({className:a,...b}){return(0,o.jsx)("textarea",{"data-slot":"textarea",className:(0,jx.cn)("flex field-sizing-content min-h-16 w-full resize-none rounded-md border border-input bg-input/20 px-2 py-2 text-sm transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 md:text-xs/relaxed dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",a),...b})}function lS({className:a,...b}){return(0,o.jsx)("div",{"data-slot":"input-group",role:"group",className:(0,jx.cn)("group/input-group relative flex h-7 w-full min-w-0 items-center rounded-md border border-input bg-input/20 transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-data-[align=block-end]:rounded-md has-data-[align=block-start]:rounded-md has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-2 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/30 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-2 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[textarea]:rounded-md has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",a),...b})}let lT=(0,lP.cva)("flex h-auto cursor-text items-center justify-center gap-1 py-2 text-xs/relaxed font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 **:data-[slot=kbd]:rounded-[calc(var(--radius-sm)-2px)] **:data-[slot=kbd]:bg-muted-foreground/10 **:data-[slot=kbd]:px-1 **:data-[slot=kbd]:text-[0.625rem] [&>svg:not([class*='size-'])]:size-3.5",{variants:{align:{"inline-start":"order-first pl-2 has-[>button]:ml-[-0.275rem] has-[>kbd]:ml-[-0.275rem]","inline-end":"order-last pr-2 has-[>button]:mr-[-0.275rem] has-[>kbd]:mr-[-0.275rem]","block-start":"order-first w-full justify-start px-2 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function lU({className:a,align:b="inline-start",...c}){return(0,o.jsx)("div",{role:"group","data-slot":"input-group-addon","data-align":b,className:(0,jx.cn)(lT({align:b}),a),onClick:a=>{a.target.closest("button")||a.currentTarget.parentElement?.querySelector("input")?.focus()},...c})}(0,lP.cva)("flex items-center gap-2 rounded-md text-xs/relaxed shadow-none",{variants:{size:{xs:"h-5 gap-1 rounded-[calc(var(--radius-sm)-2px)] px-1 [&>svg:not([class*='size-'])]:size-3",sm:"gap-1","icon-xs":"size-6 p-0 has-[>svg]:p-0","icon-sm":"size-7 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});let lV=(0,d$.default)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);a.s(["default",0,lV],50537);var lW=a.i(34157);a.s(["CheckIcon",()=>lW.default],6406);var lW=lW;function lX({className:a,...b}){return(0,o.jsx)(lG,{"data-slot":"command",className:(0,jx.cn)("flex size-full flex-col overflow-hidden rounded-xl bg-popover p-1 text-popover-foreground",a),...b})}function lY({className:a,...b}){return(0,o.jsx)("div",{"data-slot":"command-input-wrapper",className:"p-1 pb-0",children:(0,o.jsxs)(lS,{className:"h-8! bg-input/20 dark:bg-input/30",children:[(0,o.jsx)(lG.Input,{"data-slot":"command-input",className:(0,jx.cn)("w-full text-xs/relaxed outline-hidden disabled:cursor-not-allowed disabled:opacity-50",a),...b}),(0,o.jsx)(lU,{children:(0,o.jsx)(lV,{className:"size-3.5 shrink-0 opacity-50"})})]})})}function lZ({className:a,...b}){return(0,o.jsx)(lG.List,{"data-slot":"command-list",className:(0,jx.cn)("no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",a),...b})}function l$({className:a,...b}){return(0,o.jsx)(lG.Empty,{"data-slot":"command-empty",className:(0,jx.cn)("py-6 text-center text-xs/relaxed",a),...b})}function l_({className:a,...b}){return(0,o.jsx)(lG.Group,{"data-slot":"command-group",className:(0,jx.cn)("overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2.5 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground",a),...b})}function l0({className:a,children:b,...c}){return(0,o.jsxs)(lG.Item,{"data-slot":"command-item",className:(0,jx.cn)("group/command-item relative flex min-h-7 cursor-default items-center gap-2 rounded-md px-2.5 py-1.5 text-xs/relaxed outline-hidden select-none in-data-[slot=dialog-content]:rounded-md data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 data-selected:*:[svg]:text-foreground",a),...c,children:[b,(0,o.jsx)(lW.default,{className:"ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100"})]})}function l1({options:a,value:b,onChange:c,placeholder:d="Select option",disabled:e=!1,className:f="",allowCustomValue:g=!1,multiple:h=!1,onClear:i,showClearButton:j=!1}){let[k,l]=(0,p.useState)(!1),[m,n]=(0,p.useState)(""),q=(0,p.useRef)(null),r=(0,p.useMemo)(()=>Array.isArray(b)?b:[b],[b]),s=(0,p.useMemo)(()=>{if(h){if(1===r.length&&"all"===r[0]){let b=a.find(a=>"all"===a.value);return b?.label||""}return r.filter(a=>"all"!==a).map(b=>a.find(a=>a.value===b)?.label).filter(Boolean).join(", ")}return r.map(b=>a.find(a=>a.value===b)?.label).filter(Boolean).join(", ")},[r,a,h]),u=(0,p.useMemo)(()=>{let b={};for(let c of a){let a=c.group||"Other";b[a]||(b[a]=[]),b[a].push(c)}return b},[a]),v=(0,p.useMemo)(()=>Object.keys(u).length>1||!u.Other,[u]),w=a=>{if(h){let b=[...r],d=b.indexOf(a);d>=0?b.splice(d,1):b.push(a),c(b.length>0?b:[])}else c(a),l(!1)},x=()=>{g&&m&&!h&&(c(m),l(!1))};return(0,o.jsxs)(jy,{open:k,onOpenChange:a=>{l(a),a||n("")},children:[(0,o.jsxs)("div",{className:`relative ${f}`,children:[(0,o.jsx)(jz,{ref:q,disabled:e,className:`flex h-9 w-full items-center justify-between pl-3 ${j?"pr-16":"pr-10"} border border-input rounded-md text-sm bg-input/20 dark:bg-input/30 text-foreground transition-colors outline-none hover:border-ring focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 data-[state=open]:border-ring data-[state=open]:ring-2 data-[state=open]:ring-ring/30 disabled:opacity-50 disabled:cursor-not-allowed disabled:pointer-events-none cursor-pointer overflow-hidden text-ellipsis whitespace-nowrap text-left shadow-xs`,children:(0,o.jsx)("span",{className:"truncate",children:s||(0,o.jsx)("span",{className:"text-muted-foreground",children:d})})}),j&&i&&(0,o.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),i()},className:"absolute right-8 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors cursor-pointer z-10","aria-label":"Clear selection",children:(0,o.jsx)(hk.X,{className:"w-4 h-4"})}),(0,o.jsx)(hj,{className:"absolute right-2 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground pointer-events-none"})]}),(0,o.jsx)(jA,{className:"w-[var(--anchor-width)] p-0",align:"start",sideOffset:4,children:(0,o.jsxs)(lX,{filter:(b,c)=>{let d=a.find(a=>a.value===b);return d?+!!`${d.label} ${d.group||""}`.toLowerCase().includes(c.toLowerCase()):0},children:[(0,o.jsx)(lY,{placeholder:"Search...",value:m,onValueChange:n,onKeyDown:a=>{"Enter"===a.key&&g&&x()}}),(0,o.jsxs)(lZ,{children:[(0,o.jsx)(l$,{children:g&&m?(0,o.jsxs)("button",{type:"button",className:"w-full px-2 py-1.5 text-left text-xs cursor-pointer hover:bg-accent rounded",onClick:x,children:['Use "',m,'"']}):"No options found"}),v?Object.entries(u).map(([a,b])=>(0,o.jsx)(l_,{heading:a,children:b.map(a=>(0,o.jsx)(l0,{value:a.value,"data-checked":r.includes(a.value),onSelect:()=>w(a.value),children:(0,o.jsx)("span",{className:"truncate",children:a.label})},a.value))},a)):(0,o.jsx)(l_,{children:a.map(a=>(0,o.jsx)(l0,{value:a.value,"data-checked":r.includes(a.value),onSelect:()=>w(a.value),children:(0,o.jsx)("span",{className:"truncate",children:a.label})},a.value))})]})]})})]})}let l2=(0,d$.default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);var l3=a.i(77156),l4=a.i(91399);function l5({value:a,onChange:b,editorRef:c,theme:d,activeTab:e,onTabChange:f,disabled:g,onFocusChange:h}){let i=(0,p.useCallback)(a=>{b(a??"")},[b]),j=(0,o.jsx)("div",{className:"border border-border rounded overflow-hidden h-full",children:(0,o.jsx)(q.Editor,{height:"100%",defaultLanguage:"markdown",value:a,onChange:i,onMount:a=>{c.current=a,a.layout(),a.onDidFocusEditorText(()=>h?.(!0)),a.onDidBlurEditorText(()=>h?.(!1))},options:{minimap:{enabled:!1},lineNumbers:"on",wordWrap:"on",fontSize:13,scrollBeyondLastLine:!1,readOnly:g},theme:"dark"===d?"vs-dark":"vs-light"})}),k=(0,o.jsx)("div",{className:"border border-border rounded overflow-y-auto h-full p-4 prose prose-sm prose-slate dark:prose-invert max-w-none",children:a?(0,o.jsx)(cN,{remarkPlugins:[dZ],components:hd,children:a}):(0,o.jsx)("p",{className:"text-muted-foreground italic",children:"No content"})});return(0,o.jsxs)("div",{className:"flex flex-col flex-1 min-h-0",children:[(0,o.jsxs)("div",{className:"flex gap-1 mb-2 md:hidden flex-shrink-0",children:[(0,o.jsxs)(d2.Button,{type:"button",variant:"editor"===e?"default":"outline",size:"sm",onClick:()=>f("editor"),children:[(0,o.jsx)(l2,{className:"w-4 h-4 mr-1"}),"Editor"]}),(0,o.jsxs)(d2.Button,{type:"button",variant:"preview"===e?"default":"outline",size:"sm",onClick:()=>f("preview"),children:[(0,o.jsx)(l3.Eye,{className:"w-4 h-4 mr-1"}),"Preview"]})]}),(0,o.jsxs)("div",{className:"hidden md:grid md:grid-cols-2 md:gap-4 flex-1 min-h-0",children:[j,k]}),(0,o.jsx)("div",{className:"md:hidden flex-1 min-h-0",children:"editor"===e?j:k})]})}a.s(["TaskDialog",0,function({mode:a,isOpen:b,onClose:c,repositories:d=[],task:e,onUpdate:f}){let g=hh(),[h,i]=(0,p.useState)(""),[j,k]=(0,p.useState)([]),[l,m]=(0,p.useState)(""),[n,q]=(0,p.useState)(!1),[r,s]=(0,p.useState)(""),[u,v]=(0,p.useState)({title:"",description:"",owner:"",repo:"",branch:"",baseBranch:"",status:"backlog",effort:void 0,order:void 0}),[w,x]=(0,p.useState)(!1),[y,z]=(0,p.useState)({}),[A,B]=(0,p.useState)("editor"),[C,D]=(0,p.useState)(!1),E=(0,p.useRef)(null),{effectiveTheme:F}=(0,he.useTheme)();(0,p.useEffect)(()=>{"edit"===a&&e&&v({title:e.title,description:e.description,owner:e.owner,repo:e.repo,branch:e.branch,baseBranch:"",status:e.status,effort:e.effort,order:e.order})},[a,e,b]);let G=(0,p.useMemo)(()=>d.map(a=>({value:`${a.owner}/${a.repo}`,label:`${a.owner}/${a.repo}`})),[d]),H=(0,p.useMemo)(()=>j.map(a=>({value:a,label:a===l?`${a} (default)`:a})),[j,l]);(0,p.useEffect)(()=>{if("create"===a){if(!h){k([]),m(""),v(a=>({...a,baseBranch:""}));return}(async()=>{q(!0),s("");try{let[a,b]=h.split("/"),c=await fetch((0,l4.apiUrl)(`/api/repos/${a}/${b}/branches`));if(!c.ok)throw Error("Failed to fetch branches");let d=await c.json();k(d.data.branches),m(d.data.defaultBranch),v(a=>({...a,baseBranch:d.data.defaultBranch}))}catch(a){console.error("Failed to fetch branches:",a),s("Failed to load branches. Repository may not be initialized."),k([]),m("")}finally{q(!1)}})()}},[h,a]);let I=async b=>{if(b.preventDefault(),z({}),"create"===a){x(!0);try{let a=await fetch((0,l4.apiUrl)("/api/tasks/validate"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:u.title,owner:u.owner,repo:u.repo,branch:u.branch})}),b=await a.json();if(!b.valid){let a={};b.errors.forEach(b=>{a[b.field]=b.message}),z(a),x(!1);return}let d={title:u.title,description:u.description,owner:u.owner,repo:u.repo,branch:u.branch,baseBranch:u.baseBranch};c(),i(""),v({title:"",description:"",owner:"",repo:"",branch:"",baseBranch:"",status:"backlog",effort:void 0,order:void 0}),x(!1);let e=g.loading("Creating task...",d.title);try{if(!(await fetch((0,l4.apiUrl)("/api/tasks"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)})).ok)throw Error("Failed to create task");g.dismiss(e)}catch(b){let a=b instanceof Error?b.message:"Unknown error";g.error(e,"Failed to create task",a)}}catch(b){x(!1);let a=b instanceof Error?b.message:"Validation failed";g.error(void 0,"Validation failed",a)}}else if("edit"===a&&f&&e){x(!0);try{let a=await f(e.id,{title:u.title,description:u.description,status:u.status,effort:u.effort,order:u.order});if(a.success)c();else if(a.errors){let b={};a.errors.forEach(a=>{b[a.field]=a.message}),z(b)}}catch(a){console.error("Failed to update task:",a),z({global:a instanceof Error?a.message:"Failed to update task. Please try again."})}finally{x(!1)}}},J="create"===a,K=J?"Add New Task":"Edit Task",L=J?"Create":"Save";return(0,o.jsxs)(hi.Dialog,{open:b,onOpenChange:a=>{a.open||w||c()},title:K,maxWidth:J?"2xl":"6xl",fullScreen:!J,showCloseButton:!w,dismissOnEsc:!C,children:[w&&(0,o.jsx)("div",{className:"absolute inset-0 bg-card bg-opacity-90 rounded-lg flex items-center justify-center z-10",children:(0,o.jsx)(hf.LoadingSpinner,{size:"lg",message:J?"Creating task...":"Saving task..."})}),y.global&&(0,o.jsx)("div",{className:"mb-4 p-3 bg-destructive/10 border border-destructive/50 rounded text-destructive text-sm",children:y.global}),(0,o.jsxs)("form",{onSubmit:I,className:J?"space-y-4":"flex flex-col gap-4 flex-1 min-h-0 overflow-hidden",children:[J&&(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"block text-sm font-medium mb-1 text-foreground",children:"Repository *"}),(0,o.jsx)(l1,{options:G,value:h,onChange:a=>{let b=Array.isArray(a)?a[0]||"":a;if(i(b),b){let[a,c]=b.split("/");v(b=>({...b,owner:a,repo:c,baseBranch:""}))}else v(a=>({...a,owner:"",repo:"",baseBranch:""}))},placeholder:"Select repository",disabled:w})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"block text-sm font-medium mb-1 text-foreground",children:"Title *"}),(0,o.jsx)(lQ.Input,{type:"text",required:!0,maxLength:200,value:u.title,onChange:a=>v({...u,title:a.target.value}),className:"w-full",disabled:w})]}),!J&&e&&(0,o.jsxs)("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 p-3 bg-muted/50 rounded-md text-sm",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("span",{className:"font-medium text-foreground",children:"Repository"}),(0,o.jsxs)("p",{className:"text-muted-foreground",children:[e.owner,"/",e.repo]})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("span",{className:"font-medium text-foreground",children:"Branch"}),(0,o.jsx)("p",{className:"text-muted-foreground",children:e.branch})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("span",{className:"font-medium text-foreground",children:"Base Branch"}),(0,o.jsx)("p",{className:"text-muted-foreground",children:e.baseBranch||"N/A"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("span",{className:"font-medium text-foreground",children:"Worktree"}),(0,o.jsx)("p",{className:"text-muted-foreground capitalize",children:e.worktreeStatus})]})]}),(0,o.jsxs)("div",{className:J?"":"flex flex-col flex-1 min-h-0",children:[(0,o.jsx)("label",{className:"block text-sm font-medium mb-1 text-foreground flex-shrink-0",children:"Description"}),J?(0,o.jsx)(lR,{maxLength:5e3,value:u.description,onChange:a=>v({...u,description:a.target.value}),className:"min-h-24 w-full",disabled:w}):(0,o.jsx)(l5,{value:u.description,onChange:a=>v(b=>({...b,description:a})),editorRef:E,theme:F,activeTab:A,onTabChange:B,disabled:w,onFocusChange:D})]}),!J&&(0,o.jsxs)("div",{className:"grid grid-cols-3 gap-4 flex-shrink-0",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"block text-sm font-medium mb-1 text-foreground",children:"Status"}),(0,o.jsxs)("select",{value:u.status,onChange:a=>v({...u,status:a.target.value}),className:"w-full h-9 pl-3 pr-10 py-1 rounded-md border border-input bg-transparent text-sm shadow-xs text-foreground",disabled:w,children:[(0,o.jsx)("option",{value:"backlog",children:"Backlog"}),(0,o.jsx)("option",{value:"planning",children:"Planning"}),(0,o.jsx)("option",{value:"tasking",children:"Tasking"}),(0,o.jsx)("option",{value:"coding",children:"Coding"}),(0,o.jsx)("option",{value:"reviewing",children:"Reviewing"}),(0,o.jsx)("option",{value:"done",children:"Done"})]})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"block text-sm font-medium mb-1 text-foreground",children:"Effort (h)"}),(0,o.jsx)(lQ.Input,{type:"number",step:"0.5",min:"0.5",max:"40",value:u.effort??"",onChange:a=>v({...u,effort:parseFloat(a.target.value)||void 0}),className:"w-full",placeholder:"2.5",disabled:w})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"block text-sm font-medium mb-1 text-foreground",children:"Order"}),(0,o.jsx)(lQ.Input,{type:"number",min:"0",value:u.order??"",onChange:a=>v({...u,order:parseInt(a.target.value)||void 0}),className:"w-full",placeholder:"0",disabled:w})]})]}),J&&(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"block text-sm font-medium mb-1 text-foreground",children:"Base Branch *"}),n?(0,o.jsxs)("div",{className:"w-full h-9 px-3 rounded-md border border-input bg-transparent text-muted-foreground flex items-center gap-2",children:[(0,o.jsx)(hf.LoadingSpinner,{size:"sm"}),(0,o.jsx)("span",{className:"text-xs",children:"Loading branches..."})]}):j.length>0?(0,o.jsx)(l1,{options:H,value:u.baseBranch,onChange:a=>{let b=Array.isArray(a)?a[0]||"":a;v({...u,baseBranch:b})},placeholder:"Select base branch",disabled:w}):(0,o.jsx)("div",{className:"w-full h-9 px-3 rounded-md border border-input bg-transparent text-sm text-muted-foreground flex items-center",children:r||"Select repository first"}),(0,o.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Your new branch will be created from this branch"})]}),J&&(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"block text-sm font-medium mb-1 text-foreground",children:"New Branch Name *"}),(0,o.jsx)(lQ.Input,{type:"text",required:!0,maxLength:255,value:u.branch,onChange:a=>v({...u,branch:a.target.value}),className:`w-full ${y.branch?"border-destructive":""}`,placeholder:"feature/new-feature",disabled:w,"aria-invalid":!!y.branch}),y.branch&&(0,o.jsx)("p",{className:"text-xs text-destructive mt-1",children:y.branch}),!y.branch&&(0,o.jsxs)("p",{className:"text-xs text-muted-foreground mt-1",children:["Will be created from ",u.baseBranch||"base branch"]})]}),(0,o.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,o.jsx)(d2.Button,{type:"button",variant:"outline",size:"lg",onClick:c,className:"active:scale-95",disabled:w,children:"Cancel"}),(0,o.jsx)(d2.Button,{type:"submit",size:"lg",className:"active:scale-95",disabled:w||J&&n,children:L})]})]})]})}],92712)},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
|
|
12
|
-
`+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)},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}},[])}])},70845,82434,a=>{"use strict";var b=a.i(60137);let c=(0,b.default)("circle-pause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);a.s(["CirclePause",0,c],70845);let d=(0,b.default)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);a.s(["Bot",0,d],82434)},33591,a=>{"use strict";let b=(0,a.i(60137).default)("wifi-off",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);a.s(["WifiOff",0,b],33591)},67453,62722,a=>{"use strict";var b=a.i(67511);a.s(["CheckCircle2",()=>b.default],67453);let c=(0,a.i(60137).default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);a.s(["XCircle",0,c],62722)},63588,a=>{"use strict";let b=(0,a.i(60137).default)("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]);a.s(["MessageSquare",0,b],63588)},501,10450,99813,a=>{"use strict";let b,c,d,e,f,g,h,i,j,k,l,m;var n=a.i(87924),o=a.i(72131),p=a.i(33508),q=a.i(96221),r=a.i(70845),s=a.i(82434),u=a.i(80386),v=a.i(92e3),w=a.i(33591),x=a.i(67453),y=a.i(62722),z=a.i(63588),A=a.i(90002),B=a.i(39524);function C({entry:a}){if(!a||"idle"===a.terminal)return(0,n.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,n.jsx)(r.CirclePause,{className:"w-3 h-3"}),(0,n.jsx)("span",{children:"idle"})]});if("connecting"===a.terminal)return(0,n.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,n.jsx)(q.Loader2,{className:"w-3 h-3 animate-spin"}),(0,n.jsx)("span",{children:"connecting"})]});if("error"===a.terminal)return(0,n.jsxs)("div",{className:"flex items-center gap-1 text-xs text-destructive",children:[(0,n.jsx)(v.AlertCircle,{className:"w-3 h-3"}),(0,n.jsx)("span",{children:"error"})]});if("exited"===a.terminal||"paused"===a.terminal)return(0,n.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,n.jsx)(w.WifiOff,{className:"w-3 h-3"}),(0,n.jsx)("span",{children:a.terminal})]});switch(a.claude){case"running":return(0,n.jsxs)("div",{className:"flex items-center gap-1 text-xs text-primary",children:[(0,n.jsx)(q.Loader2,{className:"w-3 h-3 animate-spin"}),(0,n.jsx)("span",{children:"running"})]});case"waiting":return(0,n.jsxs)("div",{className:"flex items-center gap-1 text-xs text-warning",children:[(0,n.jsx)(z.MessageSquare,{className:"w-3 h-3"}),(0,n.jsx)("span",{children:"waiting"})]});case"success":return(0,n.jsxs)("div",{className:"flex items-center gap-1 text-xs text-success",children:[(0,n.jsx)(x.CheckCircle2,{className:"w-3 h-3"}),(0,n.jsx)("span",{children:"success"})]});case"failure":case"error":return(0,n.jsxs)("div",{className:"flex items-center gap-1 text-xs text-destructive",children:[(0,n.jsx)(y.XCircle,{className:"w-3 h-3"}),(0,n.jsx)("span",{children:"failure"===a.claude?"failure":"error"})]});default:return(0,n.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,n.jsx)(r.CirclePause,{className:"w-3 h-3"}),(0,n.jsx)("span",{children:"idle"})]})}}a.s(["SessionTabs",0,function({tabs:a,activeTabId:b,onTabChange:c,onTabCreateTerminal:d,onTabCreateClaude:e,onTabDelete:f,tabStatusMap:g}){let h=(0,o.useRef)([]),[i,j]=(0,o.useState)({left:0,width:0}),[k,l]=(0,o.useState)(null);return(0,o.useEffect)(()=>{let c=a.findIndex(a=>a.tab_id===b);if(-1!==c&&h.current[c]){let a=h.current[c];a&&j({left:a.offsetLeft,width:a.offsetWidth})}},[b,a]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(A.ConfirmDialog,{open:null!==k,onOpenChange:a=>{a.open||l(null)},title:"Delete Tab",message:k?.isRunning?"This tab is running. Are you sure you want to delete it?":"Delete this tab?",confirmLabel:"Delete",cancelLabel:"Cancel",onConfirm:()=>{k&&f(k.tabId)},variant:"danger"}),(0,n.jsxs)("div",{className:"relative flex items-center gap-2 overflow-x-auto border-b border-border pb-1",children:[a.map((d,e)=>{let f=b===d.tab_id,i=g?.get(d.tab_id),j=(i?.claude==="running"||i?.claude==="waiting")&&i?.terminal==="connected";return(0,n.jsxs)("div",{ref:a=>{h.current[e]=a},onClick:()=>c(d.tab_id),className:`
|
|
12
|
+
`+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)},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}},[])}])},70845,82434,a=>{"use strict";var b=a.i(60137);let c=(0,b.default)("circle-pause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);a.s(["CirclePause",0,c],70845);let d=(0,b.default)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);a.s(["Bot",0,d],82434)},33591,a=>{"use strict";let b=(0,a.i(60137).default)("wifi-off",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);a.s(["WifiOff",0,b],33591)},67453,62722,a=>{"use strict";var b=a.i(67511);a.s(["CheckCircle2",()=>b.default],67453);let c=(0,a.i(60137).default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);a.s(["XCircle",0,c],62722)},63588,a=>{"use strict";let b=(0,a.i(60137).default)("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]);a.s(["MessageSquare",0,b],63588)},501,10450,99813,a=>{"use strict";let b,c,d,e,f,g,h,i,j,k,l,m;var n=a.i(87924),o=a.i(72131),p=a.i(33508),q=a.i(96221),r=a.i(70845),s=a.i(82434),u=a.i(80386),v=a.i(92e3),w=a.i(33591),x=a.i(67453),y=a.i(62722),z=a.i(63588),A=a.i(90002),B=a.i(39524);function C({entry:a}){if(!a||"idle"===a.terminal)return(0,n.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,n.jsx)(r.CirclePause,{className:"w-3 h-3"}),(0,n.jsx)("span",{children:"idle"})]});if("connecting"===a.terminal)return(0,n.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,n.jsx)(q.Loader2,{className:"w-3 h-3 animate-spin"}),(0,n.jsx)("span",{children:"connecting"})]});if("error"===a.terminal)return(0,n.jsxs)("div",{className:"flex items-center gap-1 text-xs text-destructive",children:[(0,n.jsx)(v.AlertCircle,{className:"w-3 h-3"}),(0,n.jsx)("span",{children:"error"})]});if("exited"===a.terminal||"paused"===a.terminal)return(0,n.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,n.jsx)(w.WifiOff,{className:"w-3 h-3"}),(0,n.jsx)("span",{children:a.terminal})]});switch(a.claude){case"running":return(0,n.jsxs)("div",{className:"flex items-center gap-1 text-xs text-primary",children:[(0,n.jsx)(q.Loader2,{className:"w-3 h-3 animate-spin"}),(0,n.jsx)("span",{children:"running"})]});case"waiting":return(0,n.jsxs)("div",{className:"flex items-center gap-1 text-xs text-warning",children:[(0,n.jsx)(z.MessageSquare,{className:"w-3 h-3"}),(0,n.jsx)("span",{children:"waiting"})]});case"success":return(0,n.jsxs)("div",{className:"flex items-center gap-1 text-xs text-success",children:[(0,n.jsx)(x.CheckCircle2,{className:"w-3 h-3"}),(0,n.jsx)("span",{children:"success"})]});case"failure":case"error":return(0,n.jsxs)("div",{className:"flex items-center gap-1 text-xs text-destructive",children:[(0,n.jsx)(y.XCircle,{className:"w-3 h-3"}),(0,n.jsx)("span",{children:"failure"===a.claude?"failure":"error"})]});default:return(0,n.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,n.jsx)(r.CirclePause,{className:"w-3 h-3"}),(0,n.jsx)("span",{children:"idle"})]})}}a.s(["SessionTabs",0,function({tabs:a,activeTabId:b,onTabChange:c,onTabCreateTerminal:d,onTabCreateClaude:e,onTabDelete:f,tabStatusMap:g}){let h=(0,o.useRef)([]),[i,j]=(0,o.useState)({left:0,width:0}),[k,l]=(0,o.useState)(null);(0,o.useEffect)(()=>{let c=a.findIndex(a=>a.tab_id===b);if(-1!==c&&h.current[c]){let a=h.current[c];a&&j({left:a.offsetLeft,width:a.offsetWidth})}},[b,a]);let m=new Map,q=0;for(let b of a)"terminal"===b.mode&&(q+=1,m.set(b.tab_id,q));return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(A.ConfirmDialog,{open:null!==k,onOpenChange:a=>{a.open||l(null)},title:"Delete Tab",message:k?.isRunning?"This tab is running. Are you sure you want to delete it?":"Delete this tab?",confirmLabel:"Delete",cancelLabel:"Cancel",onConfirm:()=>{k&&f(k.tabId)},variant:"danger"}),(0,n.jsxs)("div",{className:"relative flex items-center gap-2 overflow-x-auto border-b border-border pb-1",children:[a.map((d,e)=>{let f=b===d.tab_id,i=g?.get(d.tab_id),j=(i?.claude==="running"||i?.claude==="waiting")&&i?.terminal==="connected";return(0,n.jsxs)("div",{ref:a=>{h.current[e]=a},onClick:()=>c(d.tab_id),className:`
|
|
13
13
|
flex items-center gap-2 px-4 pt-1 pb-2 h-10 flex-shrink-0 transition-colors cursor-pointer
|
|
14
14
|
${f?"text-primary":j?"text-primary-light":"text-muted-foreground hover:text-foreground"}
|
|
15
|
-
`,children:[(0,n.jsx)("div",{className:"font-medium flex items-center gap-2",children:(0,n.jsx)(C,{entry:i})}),a.length>1&&(0,n.jsx)(B.Button,{variant:"ghost",size:"icon-xs",onClick:a=>{a.stopPropagation(),l({tabId:d.tab_id,isRunning:j})},children:(0,n.jsx)(p.X,{className:"w-4 h-4"})})]},d.tab_id)}),(0,n.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0 ml-auto",children:[(0,n.jsx)("div",{className:"w-px self-stretch bg-theme"}),d&&(0,n.jsx)(B.Button,{size:"icon",onClick:d,title:"Open terminal",children:(0,n.jsx)(u.Terminal,{className:"w-4 h-4"})}),(0,n.jsx)(B.Button,{size:"icon",onClick:e,title:"Open terminal with Claude",children:(0,n.jsx)(s.Bot,{className:"w-4 h-4"})})]}),(0,n.jsx)("div",{className:"absolute bottom-0 h-0.5 bg-primary transition-[left,width]",style:{left:`${i.left}px`,width:`${i.width}px`}})]})]})}],501);var D=Object.defineProperty,E=Object.getOwnPropertyDescriptor,F=(a,b,c,d)=>{for(var e,f=d>1?void 0:d?E(b,c):b,g=a.length-1;g>=0;g--)(e=a[g])&&(f=(d?e(b,c,f):e(f))||f);return d&&f&&D(b,c,f),f},G=(a,b)=>(c,d)=>b(c,d,a),H="Terminal input",I="Too much output to announce, navigate to rows manually to read";function J(a,b,c,d){var e;e=a=a.replace(/\r?\n/g,"\r"),a=c.decPrivateModes.bracketedPasteMode&&!0!==d.rawOptions.ignoreBracketedPasteMode?"\x1b[200~"+e+"\x1b[201~":e,c.triggerDataEvent(a,!0),b.value=""}function K(a,b,c){let d=c.getBoundingClientRect(),e=a.clientX-d.left-10,f=a.clientY-d.top-10;b.style.width="20px",b.style.height="20px",b.style.left=`${e}px`,b.style.top=`${f}px`,b.style.zIndex="1000",b.focus()}function L(a,b,c,d,e){K(a,b,c),e&&d.rightClickSelect(a),b.value=d.selectionText,b.select()}function M(a){return a>65535?String.fromCharCode(((a-=65536)>>10)+55296)+String.fromCharCode(a%1024+56320):String.fromCharCode(a)}function N(a,b=0,c=a.length){let d="";for(let e=b;e<c;++e){let b=a[e];b>65535?(b-=65536,d+=String.fromCharCode((b>>10)+55296)+String.fromCharCode(b%1024+56320)):d+=String.fromCharCode(b)}return d}var O=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,b){let c=a.length;if(!c)return 0;let d=0,e=0;if(this._interim){let c=a.charCodeAt(e++);56320<=c&&c<=57343?b[d++]=(this._interim-55296)*1024+c-56320+65536:(b[d++]=this._interim,b[d++]=c),this._interim=0}for(let f=e;f<c;++f){let e=a.charCodeAt(f);if(55296<=e&&e<=56319){if(++f>=c)return this._interim=e,d;let g=a.charCodeAt(f);56320<=g&&g<=57343?b[d++]=(e-55296)*1024+g-56320+65536:(b[d++]=e,b[d++]=g);continue}65279!==e&&(b[d++]=e)}return d}},P=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,b){let c=a.length;if(!c)return 0;let d=0,e,f,g,h,i=0,j=0;if(this.interim[0]){let e=!1,f=this.interim[0];f&=(224&f)==192?31:(240&f)==224?15:7;let g=0,h;for(;(h=63&this.interim[++g])&&g<4;)f<<=6,f|=h;let i=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,k=i-g;for(;j<k;){if(j>=c)return 0;if((192&(h=a[j++]))!=128){j--,e=!0;break}this.interim[g++]=h,f<<=6,f|=63&h}e||(2===i?f<128?j--:b[d++]=f:3===i?f<2048||f>=55296&&f<=57343||65279===f||(b[d++]=f):f<65536||f>1114111||(b[d++]=f)),this.interim.fill(0)}let k=c-4,l=j;for(;l<c;){for(;l<k&&!(128&(e=a[l]))&&!(128&(f=a[l+1]))&&!(128&(g=a[l+2]))&&!(128&(h=a[l+3]));)b[d++]=e,b[d++]=f,b[d++]=g,b[d++]=h,l+=4;if((e=a[l++])<128)b[d++]=e;else if((224&e)==192){if(l>=c)return this.interim[0]=e,d;if((192&(f=a[l++]))!=128||(i=(31&e)<<6|63&f)<128){l--;continue}b[d++]=i}else if((240&e)==224){if(l>=c)return this.interim[0]=e,d;if((192&(f=a[l++]))!=128){l--;continue}if(l>=c)return this.interim[0]=e,this.interim[1]=f,d;if((192&(g=a[l++]))!=128){l--;continue}if((i=(15&e)<<12|(63&f)<<6|63&g)<2048||i>=55296&&i<=57343||65279===i)continue;b[d++]=i}else if((248&e)==240){if(l>=c)return this.interim[0]=e,d;if((192&(f=a[l++]))!=128){l--;continue}if(l>=c)return this.interim[0]=e,this.interim[1]=f,d;if((192&(g=a[l++]))!=128){l--;continue}if(l>=c)return this.interim[0]=e,this.interim[1]=f,this.interim[2]=g,d;if((192&(h=a[l++]))!=128){l--;continue}if((i=(7&e)<<18|(63&f)<<12|(63&g)<<6|63&h)<65536||i>1114111)continue;b[d++]=i}}return d}},Q=class a{constructor(){this.fg=0,this.bg=0,this.extended=new R}static toColorRGB(a){return[a>>>16&255,a>>>8&255,255&a]}static fromColorRGB(a){return(255&a[0])<<16|(255&a[1])<<8|255&a[2]}clone(){let b=new a;return b.fg=this.fg,b.bg=this.bg,b.extended=this.extended.clone(),b}isInverse(){return 0x4000000&this.fg}isBold(){return 0x8000000&this.fg}isUnderline(){return this.hasExtendedAttrs()&&0!==this.extended.underlineStyle?1:0x10000000&this.fg}isBlink(){return 0x20000000&this.fg}isInvisible(){return 0x40000000&this.fg}isItalic(){return 0x4000000&this.bg}isDim(){return 0x8000000&this.bg}isStrikethrough(){return 0x80000000&this.fg}isProtected(){return 0x20000000&this.bg}isOverline(){return 0x40000000&this.bg}getFgColorMode(){return 0x3000000&this.fg}getBgColorMode(){return 0x3000000&this.bg}isFgRGB(){return(0x3000000&this.fg)==0x3000000}isBgRGB(){return(0x3000000&this.bg)==0x3000000}isFgPalette(){return(0x3000000&this.fg)==0x1000000||(0x3000000&this.fg)==0x2000000}isBgPalette(){return(0x3000000&this.bg)==0x1000000||(0x3000000&this.bg)==0x2000000}isFgDefault(){return(0x3000000&this.fg)==0}isBgDefault(){return(0x3000000&this.bg)==0}isAttributeDefault(){return 0===this.fg&&0===this.bg}getFgColor(){switch(0x3000000&this.fg){case 0x1000000:case 0x2000000:return 255&this.fg;case 0x3000000:return 0xffffff&this.fg;default:return -1}}getBgColor(){switch(0x3000000&this.bg){case 0x1000000:case 0x2000000:return 255&this.bg;case 0x3000000:return 0xffffff&this.bg;default:return -1}}hasExtendedAttrs(){return 0x10000000&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-0x10000001:this.bg|=0x10000000}getUnderlineColor(){if(0x10000000&this.bg&&~this.extended.underlineColor)switch(0x3000000&this.extended.underlineColor){case 0x1000000:case 0x2000000:return 255&this.extended.underlineColor;case 0x3000000:return 0xffffff&this.extended.underlineColor}return this.getFgColor()}getUnderlineColorMode(){return 0x10000000&this.bg&&~this.extended.underlineColor?0x3000000&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 0x10000000&this.bg&&~this.extended.underlineColor?(0x3000000&this.extended.underlineColor)==0x3000000:this.isFgRGB()}isUnderlineColorPalette(){return 0x10000000&this.bg&&~this.extended.underlineColor?(0x3000000&this.extended.underlineColor)==0x1000000||(0x3000000&this.extended.underlineColor)==0x2000000:this.isFgPalette()}isUnderlineColorDefault(){return 0x10000000&this.bg&&~this.extended.underlineColor?(0x3000000&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 0x10000000&this.fg?0x10000000&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},R=class a{constructor(a=0,b=0){this._ext=0,this._urlId=0,this._ext=a,this._urlId=b}get ext(){return this._urlId?-0x1c000001&this._ext|this.underlineStyle<<26:this._ext}set ext(a){this._ext=a}get underlineStyle(){return this._urlId?5:(0x1c000000&this._ext)>>26}set underlineStyle(a){this._ext&=-0x1c000001,this._ext|=a<<26&0x1c000000}get underlineColor(){return 0x3ffffff&this._ext}set underlineColor(a){this._ext&=-0x4000000,this._ext|=0x3ffffff&a}get urlId(){return this._urlId}set urlId(a){this._urlId=a}get underlineVariantOffset(){let a=(0xe0000000&this._ext)>>29;return a<0?0xfffffff8^a:a}set underlineVariantOffset(a){this._ext&=0x1fffffff,this._ext|=a<<29&0xe0000000}clone(){return new a(this._ext,this._urlId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId}},S=class a extends Q{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new R,this.combinedData=""}static fromCharData(b){let c=new a;return c.setFromCharData(b),c}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?M(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(a){this.fg=a[0],this.bg=0;let b=!1;if(a[1].length>2)b=!0;else if(2===a[1].length){let c=a[1].charCodeAt(0);if(55296<=c&&c<=56319){let d=a[1].charCodeAt(1);56320<=d&&d<=57343?this.content=(c-55296)*1024+d-56320+65536|a[2]<<22:b=!0}else b=!0}else this.content=a[1].charCodeAt(0)|a[2]<<22;b&&(this.combinedData=a[1],this.content=2097152|a[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},T="di$target",U="di$dependencies",V=new Map;function W(a){if(V.has(a))return V.get(a);let b=function(a,c,d){var e,f,g;if(3!=arguments.length)throw Error("@IServiceName-decorator can only be used to decorate a parameter");e=b,f=a,g=d,f[T]===f?f[U].push({id:e,index:g}):(f[U]=[{id:e,index:g}],f[T]=f)};return b._id=a,V.set(a,b),b}var X=W("BufferService"),Y=W("CoreMouseService"),Z=W("CoreService"),$=W("CharsetService"),_=W("InstantiationService"),aa=W("LogService"),ab=W("OptionsService"),ac=W("OscLinkService"),ad=W("UnicodeService"),ae=W("DecorationService"),af=class{constructor(a,b,c){this._bufferService=a,this._optionsService=b,this._oscLinkService=c}provideLinks(a,b){let c=this._bufferService.buffer.lines.get(a-1);if(!c)return void b(void 0);let d=[],e=this._optionsService.rawOptions.linkHandler,f=new S,g=c.getTrimmedLength(),h=-1,i=-1,j=!1;for(let b=0;b<g;b++)if(!(-1===i&&!c.hasContent(b))){if(c.loadCell(b,f),f.hasExtendedAttrs()&&f.extended.urlId)if(-1===i){i=b,h=f.extended.urlId;continue}else j=f.extended.urlId!==h;else -1!==i&&(j=!0);if(j||-1!==i&&b===g-1){let c=this._oscLinkService.getLinkData(h)?.uri;if(c){let f={start:{x:i+1,y:a},end:{x:b+ +(!j&&b===g-1),y:a}},h=!1;if(!e?.allowNonHttpProtocols)try{let a=new URL(c);["http:","https:"].includes(a.protocol)||(h=!0)}catch{h=!0}h||d.push({text:c,range:f,activate:(a,b)=>e?e.activate(a,b,f):function(a){if(confirm(`Do you want to navigate to ${a}?
|
|
15
|
+
`,children:[(0,n.jsx)("div",{className:"font-medium flex items-center gap-2",children:"terminal"===d.mode?(0,n.jsxs)("span",{className:"text-xs",children:["terminal ",m.get(d.tab_id)]}):(0,n.jsx)(C,{entry:i})}),a.length>1&&(0,n.jsx)(B.Button,{variant:"ghost",size:"icon-xs",onClick:a=>{a.stopPropagation(),l({tabId:d.tab_id,isRunning:j})},children:(0,n.jsx)(p.X,{className:"w-4 h-4"})})]},d.tab_id)}),(0,n.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0 ml-auto",children:[(0,n.jsx)("div",{className:"w-px self-stretch bg-theme"}),d&&(0,n.jsx)(B.Button,{size:"icon",onClick:d,title:"Open terminal",children:(0,n.jsx)(u.Terminal,{className:"w-4 h-4"})}),(0,n.jsx)(B.Button,{size:"icon",onClick:e,title:"Open terminal with Claude",children:(0,n.jsx)(s.Bot,{className:"w-4 h-4"})})]}),(0,n.jsx)("div",{className:"absolute bottom-0 h-0.5 bg-primary transition-[left,width]",style:{left:`${i.left}px`,width:`${i.width}px`}})]})]})}],501);var D=Object.defineProperty,E=Object.getOwnPropertyDescriptor,F=(a,b,c,d)=>{for(var e,f=d>1?void 0:d?E(b,c):b,g=a.length-1;g>=0;g--)(e=a[g])&&(f=(d?e(b,c,f):e(f))||f);return d&&f&&D(b,c,f),f},G=(a,b)=>(c,d)=>b(c,d,a),H="Terminal input",I="Too much output to announce, navigate to rows manually to read";function J(a,b,c,d){var e;e=a=a.replace(/\r?\n/g,"\r"),a=c.decPrivateModes.bracketedPasteMode&&!0!==d.rawOptions.ignoreBracketedPasteMode?"\x1b[200~"+e+"\x1b[201~":e,c.triggerDataEvent(a,!0),b.value=""}function K(a,b,c){let d=c.getBoundingClientRect(),e=a.clientX-d.left-10,f=a.clientY-d.top-10;b.style.width="20px",b.style.height="20px",b.style.left=`${e}px`,b.style.top=`${f}px`,b.style.zIndex="1000",b.focus()}function L(a,b,c,d,e){K(a,b,c),e&&d.rightClickSelect(a),b.value=d.selectionText,b.select()}function M(a){return a>65535?String.fromCharCode(((a-=65536)>>10)+55296)+String.fromCharCode(a%1024+56320):String.fromCharCode(a)}function N(a,b=0,c=a.length){let d="";for(let e=b;e<c;++e){let b=a[e];b>65535?(b-=65536,d+=String.fromCharCode((b>>10)+55296)+String.fromCharCode(b%1024+56320)):d+=String.fromCharCode(b)}return d}var O=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,b){let c=a.length;if(!c)return 0;let d=0,e=0;if(this._interim){let c=a.charCodeAt(e++);56320<=c&&c<=57343?b[d++]=(this._interim-55296)*1024+c-56320+65536:(b[d++]=this._interim,b[d++]=c),this._interim=0}for(let f=e;f<c;++f){let e=a.charCodeAt(f);if(55296<=e&&e<=56319){if(++f>=c)return this._interim=e,d;let g=a.charCodeAt(f);56320<=g&&g<=57343?b[d++]=(e-55296)*1024+g-56320+65536:(b[d++]=e,b[d++]=g);continue}65279!==e&&(b[d++]=e)}return d}},P=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,b){let c=a.length;if(!c)return 0;let d=0,e,f,g,h,i=0,j=0;if(this.interim[0]){let e=!1,f=this.interim[0];f&=(224&f)==192?31:(240&f)==224?15:7;let g=0,h;for(;(h=63&this.interim[++g])&&g<4;)f<<=6,f|=h;let i=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,k=i-g;for(;j<k;){if(j>=c)return 0;if((192&(h=a[j++]))!=128){j--,e=!0;break}this.interim[g++]=h,f<<=6,f|=63&h}e||(2===i?f<128?j--:b[d++]=f:3===i?f<2048||f>=55296&&f<=57343||65279===f||(b[d++]=f):f<65536||f>1114111||(b[d++]=f)),this.interim.fill(0)}let k=c-4,l=j;for(;l<c;){for(;l<k&&!(128&(e=a[l]))&&!(128&(f=a[l+1]))&&!(128&(g=a[l+2]))&&!(128&(h=a[l+3]));)b[d++]=e,b[d++]=f,b[d++]=g,b[d++]=h,l+=4;if((e=a[l++])<128)b[d++]=e;else if((224&e)==192){if(l>=c)return this.interim[0]=e,d;if((192&(f=a[l++]))!=128||(i=(31&e)<<6|63&f)<128){l--;continue}b[d++]=i}else if((240&e)==224){if(l>=c)return this.interim[0]=e,d;if((192&(f=a[l++]))!=128){l--;continue}if(l>=c)return this.interim[0]=e,this.interim[1]=f,d;if((192&(g=a[l++]))!=128){l--;continue}if((i=(15&e)<<12|(63&f)<<6|63&g)<2048||i>=55296&&i<=57343||65279===i)continue;b[d++]=i}else if((248&e)==240){if(l>=c)return this.interim[0]=e,d;if((192&(f=a[l++]))!=128){l--;continue}if(l>=c)return this.interim[0]=e,this.interim[1]=f,d;if((192&(g=a[l++]))!=128){l--;continue}if(l>=c)return this.interim[0]=e,this.interim[1]=f,this.interim[2]=g,d;if((192&(h=a[l++]))!=128){l--;continue}if((i=(7&e)<<18|(63&f)<<12|(63&g)<<6|63&h)<65536||i>1114111)continue;b[d++]=i}}return d}},Q=class a{constructor(){this.fg=0,this.bg=0,this.extended=new R}static toColorRGB(a){return[a>>>16&255,a>>>8&255,255&a]}static fromColorRGB(a){return(255&a[0])<<16|(255&a[1])<<8|255&a[2]}clone(){let b=new a;return b.fg=this.fg,b.bg=this.bg,b.extended=this.extended.clone(),b}isInverse(){return 0x4000000&this.fg}isBold(){return 0x8000000&this.fg}isUnderline(){return this.hasExtendedAttrs()&&0!==this.extended.underlineStyle?1:0x10000000&this.fg}isBlink(){return 0x20000000&this.fg}isInvisible(){return 0x40000000&this.fg}isItalic(){return 0x4000000&this.bg}isDim(){return 0x8000000&this.bg}isStrikethrough(){return 0x80000000&this.fg}isProtected(){return 0x20000000&this.bg}isOverline(){return 0x40000000&this.bg}getFgColorMode(){return 0x3000000&this.fg}getBgColorMode(){return 0x3000000&this.bg}isFgRGB(){return(0x3000000&this.fg)==0x3000000}isBgRGB(){return(0x3000000&this.bg)==0x3000000}isFgPalette(){return(0x3000000&this.fg)==0x1000000||(0x3000000&this.fg)==0x2000000}isBgPalette(){return(0x3000000&this.bg)==0x1000000||(0x3000000&this.bg)==0x2000000}isFgDefault(){return(0x3000000&this.fg)==0}isBgDefault(){return(0x3000000&this.bg)==0}isAttributeDefault(){return 0===this.fg&&0===this.bg}getFgColor(){switch(0x3000000&this.fg){case 0x1000000:case 0x2000000:return 255&this.fg;case 0x3000000:return 0xffffff&this.fg;default:return -1}}getBgColor(){switch(0x3000000&this.bg){case 0x1000000:case 0x2000000:return 255&this.bg;case 0x3000000:return 0xffffff&this.bg;default:return -1}}hasExtendedAttrs(){return 0x10000000&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-0x10000001:this.bg|=0x10000000}getUnderlineColor(){if(0x10000000&this.bg&&~this.extended.underlineColor)switch(0x3000000&this.extended.underlineColor){case 0x1000000:case 0x2000000:return 255&this.extended.underlineColor;case 0x3000000:return 0xffffff&this.extended.underlineColor}return this.getFgColor()}getUnderlineColorMode(){return 0x10000000&this.bg&&~this.extended.underlineColor?0x3000000&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 0x10000000&this.bg&&~this.extended.underlineColor?(0x3000000&this.extended.underlineColor)==0x3000000:this.isFgRGB()}isUnderlineColorPalette(){return 0x10000000&this.bg&&~this.extended.underlineColor?(0x3000000&this.extended.underlineColor)==0x1000000||(0x3000000&this.extended.underlineColor)==0x2000000:this.isFgPalette()}isUnderlineColorDefault(){return 0x10000000&this.bg&&~this.extended.underlineColor?(0x3000000&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 0x10000000&this.fg?0x10000000&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},R=class a{constructor(a=0,b=0){this._ext=0,this._urlId=0,this._ext=a,this._urlId=b}get ext(){return this._urlId?-0x1c000001&this._ext|this.underlineStyle<<26:this._ext}set ext(a){this._ext=a}get underlineStyle(){return this._urlId?5:(0x1c000000&this._ext)>>26}set underlineStyle(a){this._ext&=-0x1c000001,this._ext|=a<<26&0x1c000000}get underlineColor(){return 0x3ffffff&this._ext}set underlineColor(a){this._ext&=-0x4000000,this._ext|=0x3ffffff&a}get urlId(){return this._urlId}set urlId(a){this._urlId=a}get underlineVariantOffset(){let a=(0xe0000000&this._ext)>>29;return a<0?0xfffffff8^a:a}set underlineVariantOffset(a){this._ext&=0x1fffffff,this._ext|=a<<29&0xe0000000}clone(){return new a(this._ext,this._urlId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId}},S=class a extends Q{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new R,this.combinedData=""}static fromCharData(b){let c=new a;return c.setFromCharData(b),c}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?M(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(a){this.fg=a[0],this.bg=0;let b=!1;if(a[1].length>2)b=!0;else if(2===a[1].length){let c=a[1].charCodeAt(0);if(55296<=c&&c<=56319){let d=a[1].charCodeAt(1);56320<=d&&d<=57343?this.content=(c-55296)*1024+d-56320+65536|a[2]<<22:b=!0}else b=!0}else this.content=a[1].charCodeAt(0)|a[2]<<22;b&&(this.combinedData=a[1],this.content=2097152|a[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},T="di$target",U="di$dependencies",V=new Map;function W(a){if(V.has(a))return V.get(a);let b=function(a,c,d){var e,f,g;if(3!=arguments.length)throw Error("@IServiceName-decorator can only be used to decorate a parameter");e=b,f=a,g=d,f[T]===f?f[U].push({id:e,index:g}):(f[U]=[{id:e,index:g}],f[T]=f)};return b._id=a,V.set(a,b),b}var X=W("BufferService"),Y=W("CoreMouseService"),Z=W("CoreService"),$=W("CharsetService"),_=W("InstantiationService"),aa=W("LogService"),ab=W("OptionsService"),ac=W("OscLinkService"),ad=W("UnicodeService"),ae=W("DecorationService"),af=class{constructor(a,b,c){this._bufferService=a,this._optionsService=b,this._oscLinkService=c}provideLinks(a,b){let c=this._bufferService.buffer.lines.get(a-1);if(!c)return void b(void 0);let d=[],e=this._optionsService.rawOptions.linkHandler,f=new S,g=c.getTrimmedLength(),h=-1,i=-1,j=!1;for(let b=0;b<g;b++)if(!(-1===i&&!c.hasContent(b))){if(c.loadCell(b,f),f.hasExtendedAttrs()&&f.extended.urlId)if(-1===i){i=b,h=f.extended.urlId;continue}else j=f.extended.urlId!==h;else -1!==i&&(j=!0);if(j||-1!==i&&b===g-1){let c=this._oscLinkService.getLinkData(h)?.uri;if(c){let f={start:{x:i+1,y:a},end:{x:b+ +(!j&&b===g-1),y:a}},h=!1;if(!e?.allowNonHttpProtocols)try{let a=new URL(c);["http:","https:"].includes(a.protocol)||(h=!0)}catch{h=!0}h||d.push({text:c,range:f,activate:(a,b)=>e?e.activate(a,b,f):function(a){if(confirm(`Do you want to navigate to ${a}?
|
|
16
16
|
|
|
17
17
|
WARNING: This link could potentially be dangerous`)){let b=window.open();if(b){try{b.opener=null}catch{}b.location.href=a}else console.warn("Opening link blocked as opener could not be cleared")}}(b),hover:(a,b)=>e?.hover?.(a,b,f),leave:(a,b)=>e?.leave?.(a,b,f)})}j=!1,f.hasExtendedAttrs()&&f.extended.urlId?(i=b,h=f.extended.urlId):(i=-1,h=-1)}}b(d)}};af=F([G(0,X),G(1,ab),G(2,ac)],af);var ag=W("CharSizeService"),ah=W("CoreBrowserService"),ai=W("MouseService"),aj=W("RenderService"),ak=W("SelectionService"),al=W("CharacterJoinerService"),am=W("ThemeService"),an=W("LinkProviderService"),ao=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(a){setTimeout(()=>{throw a.stack?as.isErrorNoTelemetry(a)?new as(a.message+`
|
|
18
18
|
|