@wix/create-app 0.0.47 → 0.0.48

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.
@@ -1,6 +1,6 @@
1
1
  import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
- import{d as Ma,h as u}from"./chunk-HFDLXX7R.js";u();u();u();u();var Qi=Object.prototype.toString;function mt(e){switch(Qi.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return rt(e,Error)}}function de(e,t){return Qi.call(e)===`[object ${t}]`}function Pa(e){return de(e,"ErrorEvent")}function La(e){return de(e,"DOMError")}function Ua(e){return de(e,"DOMException")}function Y(e){return de(e,"String")}function le(e){return typeof e=="object"&&e!==null&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function rn(e){return e===null||le(e)||typeof e!="object"&&typeof e!="function"}function J(e){return de(e,"Object")}function mr(e){return typeof Event<"u"&&rt(e,Event)}function gr(e){return typeof Element<"u"&&rt(e,Element)}function Re(e){return de(e,"RegExp")}function F(e){return!!(e&&e.then&&typeof e.then=="function")}function hr(e){return J(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e}function Ce(e){return typeof e=="number"&&e!==e}function rt(e,t){try{return e instanceof t}catch{return!1}}function Oe(e){return!!(typeof e=="object"&&e!==null&&(e.__isVue||e._isVue))}u();function gt(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function De(e,t){let n=e,r=n.length;if(r<=150)return n;t>r&&(t=r);let i=Math.max(t-60,0);i<5&&(i=0);let o=Math.min(i+140,r);return o>r-5&&(o=r),o===r&&(i=Math.max(o-140,0)),n=n.slice(i,o),i>0&&(n=`'{snip} ${n}`),o<r&&(n+=" {snip}"),n}function on(e,t){if(!Array.isArray(e))return"";let n=[];for(let r=0;r<e.length;r++){let i=e[r];try{Oe(i)?n.push("[VueViewModel]"):n.push(String(i))}catch{n.push("[value cannot be serialized]")}}return n.join(t)}function Zi(e,t,n=!1){return Y(e)?Re(t)?t.test(e):Y(t)?n?e===t:e.includes(t):!1:!1}function Ht(e,t=[],n=!1){return t.some(r=>Zi(e,r,n))}function Sr(e,t,n=250,r,i,o,s){if(!o.exception||!o.exception.values||!s||!rt(s.originalException,Error))return;let a=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;a&&(o.exception.values=Fa(_r(e,t,i,s.originalException,r,o.exception.values,a,0),n))}function _r(e,t,n,r,i,o,s,a){if(o.length>=n+1)return o;let c=[...o];if(rt(r[i],Error)){to(s,a);let d=e(t,r[i]),l=c.length;eo(d,i,l,a),c=_r(e,t,n,r[i],i,[d,...c],d,l)}return Array.isArray(r.errors)&&r.errors.forEach((d,l)=>{if(rt(d,Error)){to(s,a);let p=e(t,d),m=c.length;eo(p,`errors[${l}]`,m,a),c=_r(e,t,n,d,i,[p,...c],p,m)}}),c}function to(e,t){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,...e.type==="AggregateError"&&{is_exception_group:!0},exception_id:t}}function eo(e,t,n,r){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}function Fa(e,t){return e.map(n=>(n.value&&(n.value=gt(n.value,t)),n))}u();u();function sn(e){return e&&e.Math==Math?e:void 0}var x=typeof globalThis=="object"&&sn(globalThis)||typeof window=="object"&&sn(window)||typeof self=="object"&&sn(self)||typeof global=="object"&&sn(global)||function(){return this}()||{};function Vt(){return x}function Ne(e,t,n){let r=n||x,i=r.__SENTRY__=r.__SENTRY__||{};return i[e]||(i[e]=t())}var pe=Vt(),Ba=80;function $t(e,t={}){if(!e)return"<unknown>";try{let n=e,r=5,i=[],o=0,s=0,a=" > ",c=a.length,d,l=Array.isArray(t)?t:t.keyAttrs,p=!Array.isArray(t)&&t.maxStringLength||Ba;for(;n&&o++<r&&(d=Ha(n,l),!(d==="html"||o>1&&s+i.length*c+d.length>=p));)i.push(d),s+=d.length,n=n.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function Ha(e,t){let n=e,r=[],i,o,s,a,c;if(!n||!n.tagName)return"";if(pe.HTMLElement&&n instanceof HTMLElement&&n.dataset&&n.dataset.sentryComponent)return n.dataset.sentryComponent;r.push(n.tagName.toLowerCase());let d=t&&t.length?t.filter(p=>n.getAttribute(p)).map(p=>[p,n.getAttribute(p)]):null;if(d&&d.length)d.forEach(p=>{r.push(`[${p[0]}="${p[1]}"]`)});else if(n.id&&r.push(`#${n.id}`),i=n.className,i&&Y(i))for(o=i.split(/\s+/),c=0;c<o.length;c++)r.push(`.${o[c]}`);let l=["aria-label","type","name","title","alt"];for(c=0;c<l.length;c++)s=l[c],a=n.getAttribute(s),a&&r.push(`[${s}="${a}"]`);return r.join("")}function $a(){try{return pe.document.location.href}catch{return""}}function ke(e){return pe.document&&pe.document.querySelector?pe.document.querySelector(e):null}function Er(e){if(!pe.HTMLElement)return null;let t=e,n=5;for(let r=0;r<n;r++){if(!t)return null;if(t instanceof HTMLElement&&t.dataset.sentryComponent)return t.dataset.sentryComponent;t=t.parentNode}return null}u();u();var ot=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;u();var Ga="Sentry Logger ",Xt=["debug","info","warn","error","log","assert","trace"],fe={};function ht(e){if(!("console"in x))return e();let t=x.console,n={},r=Object.keys(fe);r.forEach(i=>{let o=fe[i];n[i]=t[i],t[i]=o});try{return e()}finally{r.forEach(i=>{t[i]=n[i]})}}function ja(){let e=!1,t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return ot?Xt.forEach(n=>{t[n]=(...r)=>{e&&ht(()=>{x.console[n](`${Ga}[${n}]:`,...r)})}}):Xt.forEach(n=>{t[n]=()=>{}}),t}var f=ja();var Wa=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function qa(e){return e==="http"||e==="https"}function it(e,t=!1){let{host:n,path:r,pass:i,port:o,projectId:s,protocol:a,publicKey:c}=e;return`${a}://${c}${t&&i?`:${i}`:""}@${n}${o?`:${o}`:""}/${r&&`${r}/`}${s}`}function an(e){let t=Wa.exec(e);if(!t){ht(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}let[n,r,i="",o,s="",a]=t.slice(1),c="",d=a,l=d.split("/");if(l.length>1&&(c=l.slice(0,-1).join("/"),d=l.pop()),d){let p=d.match(/^\d+/);p&&(d=p[0])}return no({host:o,pass:i,path:c,projectId:d,port:s,protocol:n,publicKey:r})}function no(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function za(e){if(!ot)return!0;let{port:t,projectId:n,protocol:r}=e;return["protocol","publicKey","host","projectId"].find(s=>e[s]?!1:(f.error(`Invalid Sentry Dsn: ${s} missing`),!0))?!1:n.match(/^\d+$/)?qa(r)?t&&isNaN(parseInt(t,10))?(f.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(f.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(f.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function we(e){let t=typeof e=="string"?an(e):no(e);if(!(!t||!za(t)))return t}u();var j=class extends Error{constructor(t,n="warn"){super(t),this.message=t,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=n}};u();u();function M(e,t,n){if(!(t in e))return;let r=e[t],i=n(r);typeof i=="function"&&oo(i,r),e[t]=i}function X(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{ot&&f.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function oo(e,t){try{let n=t.prototype||{};e.prototype=t.prototype=n,X(e,"__sentry_original__",t)}catch{}}function yr(e){return e.__sentry_original__}function Ir(e){return Object.keys(e).map(t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`).join("&")}function cn(e){if(mt(e))return{message:e.message,name:e.name,stack:e.stack,...io(e)};if(mr(e)){let t={type:e.type,target:ro(e.target),currentTarget:ro(e.currentTarget),...io(e)};return typeof CustomEvent<"u"&&rt(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function ro(e){try{return gr(e)?$t(e):Object.prototype.toString.call(e)}catch{return"<unknown>"}}function io(e){if(typeof e=="object"&&e!==null){let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}else return{}}function br(e,t=40){let n=Object.keys(cn(e));if(n.sort(),!n.length)return"[object has no keys]";if(n[0].length>=t)return gt(n[0],t);for(let r=n.length;r>0;r--){let i=n.slice(0,r).join(", ");if(!(i.length>t))return r===n.length?i:gt(i,t)}return""}function k(e){return Tr(e,new Map)}function Tr(e,t){if(Ya(e)){let n=t.get(e);if(n!==void 0)return n;let r={};t.set(e,r);for(let i of Object.keys(e))typeof e[i]<"u"&&(r[i]=Tr(e[i],t));return r}if(Array.isArray(e)){let n=t.get(e);if(n!==void 0)return n;let r=[];return t.set(e,r),e.forEach(i=>{r.push(Tr(i,t))}),r}return e}function Ya(e){if(!J(e))return!1;try{let t=Object.getPrototypeOf(e).constructor.name;return!t||t==="Object"}catch{return!0}}u();u();u();function Ja(e,t=!1){return!(t||e&&!e.startsWith("/")&&!e.match(/^[A-Z]:/)&&!e.startsWith(".")&&!e.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&e!==void 0&&!e.includes("node_modules/")}function so(e){let t=/^\s*[-]{4,}$/,n=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;return r=>{let i=r.match(n);if(i){let o,s,a,c,d;if(i[1]){a=i[1];let m=a.lastIndexOf(".");if(a[m-1]==="."&&m--,m>0){o=a.slice(0,m),s=a.slice(m+1);let _=o.indexOf(".Module");_>0&&(a=a.slice(_+1),o=o.slice(0,_))}c=void 0}s&&(c=o,d=s),s==="<anonymous>"&&(d=void 0,a=void 0),a===void 0&&(d=d||"<anonymous>",a=c?`${c}.${d}`:d);let l=i[2]&&i[2].startsWith("file://")?i[2].slice(7):i[2],p=i[5]==="native";return l&&l.match(/\/[A-Z]:/)&&(l=l.slice(1)),!l&&i[5]&&!p&&(l=i[5]),{filename:l,module:e?e(l):void 0,function:a,lineno:parseInt(i[3],10)||void 0,colno:parseInt(i[4],10)||void 0,in_app:Ja(l,p)}}if(r.match(t))return{filename:r}}}var uo=50,ao=/\(error: (.*)\)/,co=/captureMessage|captureException/;function lo(...e){let t=e.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0)=>{let i=[],o=n.split(`
3
+ import{d as Ma,h as u}from"./chunk-V4TR6DCM.js";u();u();u();u();var Qi=Object.prototype.toString;function mt(e){switch(Qi.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return rt(e,Error)}}function de(e,t){return Qi.call(e)===`[object ${t}]`}function Pa(e){return de(e,"ErrorEvent")}function La(e){return de(e,"DOMError")}function Ua(e){return de(e,"DOMException")}function Y(e){return de(e,"String")}function le(e){return typeof e=="object"&&e!==null&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function rn(e){return e===null||le(e)||typeof e!="object"&&typeof e!="function"}function J(e){return de(e,"Object")}function mr(e){return typeof Event<"u"&&rt(e,Event)}function gr(e){return typeof Element<"u"&&rt(e,Element)}function Re(e){return de(e,"RegExp")}function F(e){return!!(e&&e.then&&typeof e.then=="function")}function hr(e){return J(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e}function Ce(e){return typeof e=="number"&&e!==e}function rt(e,t){try{return e instanceof t}catch{return!1}}function Oe(e){return!!(typeof e=="object"&&e!==null&&(e.__isVue||e._isVue))}u();function gt(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function De(e,t){let n=e,r=n.length;if(r<=150)return n;t>r&&(t=r);let i=Math.max(t-60,0);i<5&&(i=0);let o=Math.min(i+140,r);return o>r-5&&(o=r),o===r&&(i=Math.max(o-140,0)),n=n.slice(i,o),i>0&&(n=`'{snip} ${n}`),o<r&&(n+=" {snip}"),n}function on(e,t){if(!Array.isArray(e))return"";let n=[];for(let r=0;r<e.length;r++){let i=e[r];try{Oe(i)?n.push("[VueViewModel]"):n.push(String(i))}catch{n.push("[value cannot be serialized]")}}return n.join(t)}function Zi(e,t,n=!1){return Y(e)?Re(t)?t.test(e):Y(t)?n?e===t:e.includes(t):!1:!1}function Ht(e,t=[],n=!1){return t.some(r=>Zi(e,r,n))}function Sr(e,t,n=250,r,i,o,s){if(!o.exception||!o.exception.values||!s||!rt(s.originalException,Error))return;let a=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;a&&(o.exception.values=Fa(_r(e,t,i,s.originalException,r,o.exception.values,a,0),n))}function _r(e,t,n,r,i,o,s,a){if(o.length>=n+1)return o;let c=[...o];if(rt(r[i],Error)){to(s,a);let d=e(t,r[i]),l=c.length;eo(d,i,l,a),c=_r(e,t,n,r[i],i,[d,...c],d,l)}return Array.isArray(r.errors)&&r.errors.forEach((d,l)=>{if(rt(d,Error)){to(s,a);let p=e(t,d),m=c.length;eo(p,`errors[${l}]`,m,a),c=_r(e,t,n,d,i,[p,...c],p,m)}}),c}function to(e,t){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,...e.type==="AggregateError"&&{is_exception_group:!0},exception_id:t}}function eo(e,t,n,r){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}function Fa(e,t){return e.map(n=>(n.value&&(n.value=gt(n.value,t)),n))}u();u();function sn(e){return e&&e.Math==Math?e:void 0}var x=typeof globalThis=="object"&&sn(globalThis)||typeof window=="object"&&sn(window)||typeof self=="object"&&sn(self)||typeof global=="object"&&sn(global)||function(){return this}()||{};function Vt(){return x}function Ne(e,t,n){let r=n||x,i=r.__SENTRY__=r.__SENTRY__||{};return i[e]||(i[e]=t())}var pe=Vt(),Ba=80;function $t(e,t={}){if(!e)return"<unknown>";try{let n=e,r=5,i=[],o=0,s=0,a=" > ",c=a.length,d,l=Array.isArray(t)?t:t.keyAttrs,p=!Array.isArray(t)&&t.maxStringLength||Ba;for(;n&&o++<r&&(d=Ha(n,l),!(d==="html"||o>1&&s+i.length*c+d.length>=p));)i.push(d),s+=d.length,n=n.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function Ha(e,t){let n=e,r=[],i,o,s,a,c;if(!n||!n.tagName)return"";if(pe.HTMLElement&&n instanceof HTMLElement&&n.dataset&&n.dataset.sentryComponent)return n.dataset.sentryComponent;r.push(n.tagName.toLowerCase());let d=t&&t.length?t.filter(p=>n.getAttribute(p)).map(p=>[p,n.getAttribute(p)]):null;if(d&&d.length)d.forEach(p=>{r.push(`[${p[0]}="${p[1]}"]`)});else if(n.id&&r.push(`#${n.id}`),i=n.className,i&&Y(i))for(o=i.split(/\s+/),c=0;c<o.length;c++)r.push(`.${o[c]}`);let l=["aria-label","type","name","title","alt"];for(c=0;c<l.length;c++)s=l[c],a=n.getAttribute(s),a&&r.push(`[${s}="${a}"]`);return r.join("")}function $a(){try{return pe.document.location.href}catch{return""}}function ke(e){return pe.document&&pe.document.querySelector?pe.document.querySelector(e):null}function Er(e){if(!pe.HTMLElement)return null;let t=e,n=5;for(let r=0;r<n;r++){if(!t)return null;if(t instanceof HTMLElement&&t.dataset.sentryComponent)return t.dataset.sentryComponent;t=t.parentNode}return null}u();u();var ot=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;u();var Ga="Sentry Logger ",Xt=["debug","info","warn","error","log","assert","trace"],fe={};function ht(e){if(!("console"in x))return e();let t=x.console,n={},r=Object.keys(fe);r.forEach(i=>{let o=fe[i];n[i]=t[i],t[i]=o});try{return e()}finally{r.forEach(i=>{t[i]=n[i]})}}function ja(){let e=!1,t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return ot?Xt.forEach(n=>{t[n]=(...r)=>{e&&ht(()=>{x.console[n](`${Ga}[${n}]:`,...r)})}}):Xt.forEach(n=>{t[n]=()=>{}}),t}var f=ja();var Wa=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function qa(e){return e==="http"||e==="https"}function it(e,t=!1){let{host:n,path:r,pass:i,port:o,projectId:s,protocol:a,publicKey:c}=e;return`${a}://${c}${t&&i?`:${i}`:""}@${n}${o?`:${o}`:""}/${r&&`${r}/`}${s}`}function an(e){let t=Wa.exec(e);if(!t){ht(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}let[n,r,i="",o,s="",a]=t.slice(1),c="",d=a,l=d.split("/");if(l.length>1&&(c=l.slice(0,-1).join("/"),d=l.pop()),d){let p=d.match(/^\d+/);p&&(d=p[0])}return no({host:o,pass:i,path:c,projectId:d,port:s,protocol:n,publicKey:r})}function no(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function za(e){if(!ot)return!0;let{port:t,projectId:n,protocol:r}=e;return["protocol","publicKey","host","projectId"].find(s=>e[s]?!1:(f.error(`Invalid Sentry Dsn: ${s} missing`),!0))?!1:n.match(/^\d+$/)?qa(r)?t&&isNaN(parseInt(t,10))?(f.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(f.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(f.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function we(e){let t=typeof e=="string"?an(e):no(e);if(!(!t||!za(t)))return t}u();var j=class extends Error{constructor(t,n="warn"){super(t),this.message=t,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=n}};u();u();function M(e,t,n){if(!(t in e))return;let r=e[t],i=n(r);typeof i=="function"&&oo(i,r),e[t]=i}function X(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{ot&&f.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function oo(e,t){try{let n=t.prototype||{};e.prototype=t.prototype=n,X(e,"__sentry_original__",t)}catch{}}function yr(e){return e.__sentry_original__}function Ir(e){return Object.keys(e).map(t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`).join("&")}function cn(e){if(mt(e))return{message:e.message,name:e.name,stack:e.stack,...io(e)};if(mr(e)){let t={type:e.type,target:ro(e.target),currentTarget:ro(e.currentTarget),...io(e)};return typeof CustomEvent<"u"&&rt(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function ro(e){try{return gr(e)?$t(e):Object.prototype.toString.call(e)}catch{return"<unknown>"}}function io(e){if(typeof e=="object"&&e!==null){let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}else return{}}function br(e,t=40){let n=Object.keys(cn(e));if(n.sort(),!n.length)return"[object has no keys]";if(n[0].length>=t)return gt(n[0],t);for(let r=n.length;r>0;r--){let i=n.slice(0,r).join(", ");if(!(i.length>t))return r===n.length?i:gt(i,t)}return""}function k(e){return Tr(e,new Map)}function Tr(e,t){if(Ya(e)){let n=t.get(e);if(n!==void 0)return n;let r={};t.set(e,r);for(let i of Object.keys(e))typeof e[i]<"u"&&(r[i]=Tr(e[i],t));return r}if(Array.isArray(e)){let n=t.get(e);if(n!==void 0)return n;let r=[];return t.set(e,r),e.forEach(i=>{r.push(Tr(i,t))}),r}return e}function Ya(e){if(!J(e))return!1;try{let t=Object.getPrototypeOf(e).constructor.name;return!t||t==="Object"}catch{return!0}}u();u();u();function Ja(e,t=!1){return!(t||e&&!e.startsWith("/")&&!e.match(/^[A-Z]:/)&&!e.startsWith(".")&&!e.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&e!==void 0&&!e.includes("node_modules/")}function so(e){let t=/^\s*[-]{4,}$/,n=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;return r=>{let i=r.match(n);if(i){let o,s,a,c,d;if(i[1]){a=i[1];let m=a.lastIndexOf(".");if(a[m-1]==="."&&m--,m>0){o=a.slice(0,m),s=a.slice(m+1);let _=o.indexOf(".Module");_>0&&(a=a.slice(_+1),o=o.slice(0,_))}c=void 0}s&&(c=o,d=s),s==="<anonymous>"&&(d=void 0,a=void 0),a===void 0&&(d=d||"<anonymous>",a=c?`${c}.${d}`:d);let l=i[2]&&i[2].startsWith("file://")?i[2].slice(7):i[2],p=i[5]==="native";return l&&l.match(/\/[A-Z]:/)&&(l=l.slice(1)),!l&&i[5]&&!p&&(l=i[5]),{filename:l,module:e?e(l):void 0,function:a,lineno:parseInt(i[3],10)||void 0,colno:parseInt(i[4],10)||void 0,in_app:Ja(l,p)}}if(r.match(t))return{filename:r}}}var uo=50,ao=/\(error: (.*)\)/,co=/captureMessage|captureException/;function lo(...e){let t=e.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0)=>{let i=[],o=n.split(`
4
4
  `);for(let s=r;s<o.length;s++){let a=o[s];if(a.length>1024)continue;let c=ao.test(a)?a.replace(ao,"$1"):a;if(!c.match(/\S*Error: /)){for(let d of t){let l=d(c);if(l){i.push(l);break}}if(i.length>=uo)break}}return po(i)}}function Ka(e){return Array.isArray(e)?lo(...e):e}function po(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(t[t.length-1].function||"")&&t.pop(),t.reverse(),co.test(t[t.length-1].function||"")&&(t.pop(),co.test(t[t.length-1].function||"")&&t.pop()),t.slice(0,uo).map(n=>({...n,filename:n.filename||t[t.length-1].filename,function:n.function||"?"}))}var xr="<anonymous>";function Qt(e){try{return!e||typeof e!="function"?xr:e.name||xr}catch{return xr}}function Va(e){return[90,so(e)]}var un={},fo={};function Q(e,t){un[e]=un[e]||[],un[e].push(t)}function Z(e,t){fo[e]||(t(),fo[e]=!0)}function $(e,t){let n=e&&un[e];if(n)for(let r of n)try{r(t)}catch(i){ot&&f.error(`Error while triggering instrumentation handler.
5
5
  Type: ${e}
6
6
  Name: ${Qt(r)}
@@ -26,4 +26,4 @@ Name: ${Qt(r)}
26
26
  Error:`,i)}}function Qd(){return As(e=>{Ae("cls",{metric:e}),Fs=e},{reportAllChanges:!0})}function Zd(){return Rs(e=>{Ae("fid",{metric:e}),Bs=e})}function tl(){return Ls(e=>{Ae("lcp",{metric:e}),Hs=e})}function el(){return Us(e=>{Ae("ttfb",{metric:e}),$s=e})}function nl(){return Ms(e=>{Ae("inp",{metric:e}),Gs=e})}function tn(e,t,n,r,i=!1){qs(e,t);let o;return Vn[e]||(o=n(),Vn[e]=!0),r&&t({metric:r}),zs(e,t,i?o:void 0)}function rl(e){let t={};e==="event"&&(t.durationThreshold=0),ut(e,n=>{Ae(e,{entries:n})},t)}function qs(e,t){Ze[e]=Ze[e]||[],Ze[e].push(t)}function zs(e,t,n){return()=>{n&&n();let r=Ze[e];if(!r)return;let i=r.indexOf(t);i!==-1&&r.splice(i,1)}}var Yi=["localhost",/^\/(?!\/)/],ce={traceFetch:!0,traceXHR:!0,enableHTTPTimings:!0,tracingOrigins:Yi,tracePropagationTargets:Yi};function en(e){let{traceFetch:t,traceXHR:n,tracePropagationTargets:r,tracingOrigins:i,shouldCreateSpanForRequest:o,enableHTTPTimings:s}={traceFetch:ce.traceFetch,traceXHR:ce.traceXHR,...e},a=typeof o=="function"?o:l=>!0,c=l=>al(l,r||i),d={};t&&Pe(l=>{let p=xs(l,a,c,d);if(p){let m=Js(l.fetchData.url),_=m?jt(m).host:void 0;p.setAttributes({"http.url":m,"server.address":_})}s&&p&&Ys(p)}),n&&Fe(l=>{let p=cl(l,a,c,d);s&&p&&Ys(p)})}function il(e){return e.entryType==="resource"&&"initiatorType"in e&&typeof e.nextHopProtocol=="string"&&(e.initiatorType==="fetch"||e.initiatorType==="xmlhttprequest")}function Ys(e){let{url:t}=R(e).data||{};if(!t||typeof t!="string")return;let n=dt("resource",({entries:r})=>{r.forEach(i=>{il(i)&&i.name.endsWith(t)&&(sl(i).forEach(s=>e.setAttribute(...s)),setTimeout(n))})})}function ol(e){let t="unknown",n="unknown",r="";for(let i of e){if(i==="/"){[t,n]=e.split("/");break}if(!isNaN(Number(i))){t=r==="h"?"http":r,n=e.split(r)[1];break}r+=i}return r===e&&(t=r),{name:t,version:n}}function bt(e=0){return((B||performance.timeOrigin)+e)/1e3}function sl(e){let{name:t,version:n}=ol(e.nextHopProtocol),r=[];return r.push(["network.protocol.version",n],["network.protocol.name",t]),B?[...r,["http.request.redirect_start",bt(e.redirectStart)],["http.request.fetch_start",bt(e.fetchStart)],["http.request.domain_lookup_start",bt(e.domainLookupStart)],["http.request.domain_lookup_end",bt(e.domainLookupEnd)],["http.request.connect_start",bt(e.connectStart)],["http.request.secure_connection_start",bt(e.secureConnectionStart)],["http.request.connection_end",bt(e.connectEnd)],["http.request.request_start",bt(e.requestStart)],["http.request.response_start",bt(e.responseStart)],["http.request.response_end",bt(e.responseEnd)]]:r}function al(e,t){return Ht(e,t||Yi)}function cl(e,t,n,r){let i=e.xhr,o=i&&i[Ct];if(!at()||!i||i.__sentry_own_request__||!o)return;let s=t(o.url);if(e.endTimestamp&&s){let _=i.__sentry_xhr_span_id__;if(!_)return;let S=r[_];S&&o.status_code!==void 0&&(re(S,o.status_code),S.end(),delete r[_]);return}let a=L(),c=et(),d=Js(o.url),l=d?jt(d).host:void 0,p=s?Je({name:`${o.method} ${o.url}`,onlyIfParent:!0,attributes:{type:"xhr","http.method":o.method,"http.url":d,url:o.url,"server.address":l,[ct]:"auto.http.browser"},op:"http.client"}):void 0;p&&(i.__sentry_xhr_span_id__=p.spanContext().spanId,r[i.__sentry_xhr_span_id__]=p);let m=C();if(i.setRequestHeader&&n(o.url)&&m){let{traceId:_,spanId:S,sampled:T,dsc:y}={...c.getPropagationContext(),...a.getPropagationContext()},v=p?Pt(p):te(_,S,T),N=$e(y||(p?tt(p):St(_,m,a)));ul(i,v,N)}return p}function ul(e,t,n){try{e.setRequestHeader("sentry-trace",t),n&&e.setRequestHeader(he,n)}catch{}}function Js(e){try{return new URL(e,I.location.origin).href}catch{return}}u();u();function Xn(){I.document?I.document.addEventListener("visibilitychange",()=>{let e=z();if(I.document.hidden&&e){let t="cancelled",{op:n,status:r}=R(e);b&&f.log(`[Tracing] Transaction: ${t} -> since tab moved to the background, op: ${n}`),r||e.setStatus(t),e.setTag("visibilitychange","document.hidden"),e.end()}}):b&&f.warn("[Tracing] Could not set up background tab detection due to lack of global document")}u();u();function Qn(e){return typeof e=="number"&&isFinite(e)}function ue(e,{startTimestamp:t,...n}){return t&&e.startTimestamp>t&&(e.startTimestamp=t),e.startChild({startTimestamp:t,...n})}var dl=2147483647;function H(e){return e/1e3}function Ki(){return I&&I.addEventListener&&I.performance}var Ks=0,U={},xt,nn;function tr(){let e=Ki();if(e&&B){e.mark&&I.performance.mark("sentry-tracing-init");let t=fl(),n=ll(),r=pl(),i=ml();return()=>{t(),n(),r(),i()}}return()=>{}}function er(){dt("longtask",({entries:e})=>{for(let t of e){let n=z();if(!n)return;let r=H(B+t.startTime),i=H(t.duration);n.startChild({description:"Main UI thread blocked",op:"ui.long-task",origin:"auto.ui.browser.metrics",startTimestamp:r,endTimestamp:r+i})}})}function nr(){dt("event",({entries:e})=>{for(let t of e){let n=z();if(!n)return;if(t.name==="click"){let r=H(B+t.startTime),i=H(t.duration),o={description:$t(t.target),op:`ui.interaction.${t.name}`,origin:"auto.ui.browser.metrics",startTimestamp:r,endTimestamp:r+i},s=Er(t.target);s&&(o.attributes={"ui.component_name":s}),n.startChild(o)}}})}function rr(e,t){if(Ki()&&B){let r=gl(e,t);return()=>{r()}}return()=>{}}function ll(){return Wi(({metric:e})=>{let t=e.entries[e.entries.length-1];t&&(b&&f.log("[Measurements] Adding CLS"),U.cls={value:e.value,unit:""},nn=t)},!0)}function pl(){return qi(({metric:e})=>{let t=e.entries[e.entries.length-1];t&&(b&&f.log("[Measurements] Adding LCP"),U.lcp={value:e.value,unit:"millisecond"},xt=t)},!0)}function fl(){return zi(({metric:e})=>{let t=e.entries[e.entries.length-1];if(!t)return;let n=H(B),r=H(t.startTime);b&&f.log("[Measurements] Adding FID"),U.fid={value:e.value,unit:"millisecond"},U["mark.fid"]={value:n+r,unit:"second"}})}function ml(){return js(({metric:e})=>{e.entries[e.entries.length-1]&&(b&&f.log("[Measurements] Adding TTFB"),U.ttfb={value:e.value,unit:"millisecond"})})}var Vs={click:"click",pointerdown:"click",pointerup:"click",mousedown:"click",mouseup:"click",touchstart:"click",touchend:"click",mouseover:"hover",mouseout:"hover",mouseenter:"hover",mouseleave:"hover",pointerover:"hover",pointerout:"hover",pointerenter:"hover",pointerleave:"hover",dragstart:"drag",dragend:"drag",drag:"drag",dragenter:"drag",dragleave:"drag",dragover:"drag",drop:"drag",keydown:"press",keyup:"press",keypress:"press",input:"press"};function gl(e,t){return Ws(({metric:n})=>{if(n.value===void 0)return;let r=n.entries.find(P=>P.duration===n.value&&Vs[P.name]!==void 0),i=C();if(!r||!i)return;let o=Vs[r.name],s=i.getOptions(),a=H(B+r.startTime),c=H(n.value),d=r.interactionId!==void 0?e[r.interactionId]:void 0;if(d===void 0)return;let{routeName:l,parentContext:p,activeTransaction:m,user:_,replayId:S}=d,T=_!==void 0?_.email||_.id||_.ip_address:void 0,y=m!==void 0?m.getProfileId():void 0,v=new oe({startTimestamp:a,endTimestamp:a+c,op:`ui.interaction.${o}`,name:$t(r.target),attributes:{release:s.release,environment:s.environment,transaction:l,...T!==void 0&&T!==""?{user:T}:{},...y!==void 0?{profile_id:y}:{},...S!==void 0?{replay_id:S}:{}},exclusiveTime:n.value,measurements:{inp:{value:n.value,unit:"millisecond"}}}),N=bl(p,s,t);if(N&&Math.random()<N){let P=v?Pi([v],i.getDsn()):void 0,vt=i&&i.getTransport();vt&&P&&vt.send(P).then(null,Kt=>{b&&f.error("Error while sending interaction:",Kt)});return}})}function ir(e){let t=Ki();if(!t||!I.performance.getEntries||!B)return;b&&f.log("[Tracing] Adding & adjusting spans using Performance API");let n=H(B),r=t.getEntries(),{op:i,start_timestamp:o}=R(e);if(r.slice(Ks).forEach(s=>{let a=H(s.startTime),c=H(s.duration);if(!(e.op==="navigation"&&o&&n+a<o))switch(s.entryType){case"navigation":{_l(e,s,n);break}case"mark":case"paint":case"measure":{hl(e,s,a,c,n);let d=ve(),l=s.startTime<d.firstHiddenTime;s.name==="first-paint"&&l&&(b&&f.log("[Measurements] Adding FP"),U.fp={value:s.startTime,unit:"millisecond"}),s.name==="first-contentful-paint"&&l&&(b&&f.log("[Measurements] Adding FCP"),U.fcp={value:s.startTime,unit:"millisecond"});break}case"resource":{El(e,s,s.name,a,c,n);break}}}),Ks=Math.max(r.length-1,0),Tl(e),i==="pageload"){Il(U),["fcp","fp","lcp"].forEach(a=>{if(!U[a]||!o||n>=o)return;let c=U[a].value,d=n+H(c),l=Math.abs((d-o)*1e3),p=l-c;b&&f.log(`[Measurements] Normalized ${a} from ${c} to ${l} (${p})`),U[a].value=l});let s=U["mark.fid"];s&&U.fid&&(ue(e,{description:"first input delay",endTimestamp:s.value+H(U.fid.value),op:"ui.action",origin:"auto.ui.browser.metrics",startTimestamp:s.value}),delete U["mark.fid"]),"fcp"in U||delete U.cls,Object.keys(U).forEach(a=>{Ti(a,U[a].value,U[a].unit)}),yl(e)}xt=void 0,nn=void 0,U={}}function hl(e,t,n,r,i){let o=i+n,s=o+r;return ue(e,{description:t.name,endTimestamp:s,op:t.entryType,origin:"auto.resource.browser.metrics",startTimestamp:o}),o}function _l(e,t,n){["unloadEvent","redirect","domContentLoadedEvent","loadEvent","connect"].forEach(r=>{Zn(e,t,r,n)}),Zn(e,t,"secureConnection",n,"TLS/SSL","connectEnd"),Zn(e,t,"fetch",n,"cache","domainLookupStart"),Zn(e,t,"domainLookup",n,"DNS"),Sl(e,t,n)}function Zn(e,t,n,r,i,o){let s=o?t[o]:t[`${n}End`],a=t[`${n}Start`];!a||!s||ue(e,{op:"browser",origin:"auto.browser.browser.metrics",description:i||n,startTimestamp:r+H(a),endTimestamp:r+H(s)})}function Sl(e,t,n){t.responseEnd&&(ue(e,{op:"browser",origin:"auto.browser.browser.metrics",description:"request",startTimestamp:n+H(t.requestStart),endTimestamp:n+H(t.responseEnd)}),ue(e,{op:"browser",origin:"auto.browser.browser.metrics",description:"response",startTimestamp:n+H(t.responseStart),endTimestamp:n+H(t.responseEnd)}))}function El(e,t,n,r,i,o){if(t.initiatorType==="xmlhttprequest"||t.initiatorType==="fetch")return;let s=jt(n),a={};Ji(a,t,"transferSize","http.response_transfer_size"),Ji(a,t,"encodedBodySize","http.response_content_length"),Ji(a,t,"decodedBodySize","http.decoded_response_content_length"),"renderBlockingStatus"in t&&(a["resource.render_blocking_status"]=t.renderBlockingStatus),s.protocol&&(a["url.scheme"]=s.protocol.split(":").pop()),s.host&&(a["server.address"]=s.host),a["url.same_origin"]=n.includes(I.location.origin);let c=o+r,d=c+i;ue(e,{description:n.replace(I.location.origin,""),endTimestamp:d,op:t.initiatorType?`resource.${t.initiatorType}`:"resource.other",origin:"auto.resource.browser.metrics",startTimestamp:c,data:a})}function Tl(e){let t=I.navigator;if(!t)return;let n=t.connection;n&&(n.effectiveType&&e.setTag("effectiveConnectionType",n.effectiveType),n.type&&e.setTag("connectionType",n.type),Qn(n.rtt)&&(U["connection.rtt"]={value:n.rtt,unit:"millisecond"})),Qn(t.deviceMemory)&&e.setTag("deviceMemory",`${t.deviceMemory} GB`),Qn(t.hardwareConcurrency)&&e.setTag("hardwareConcurrency",String(t.hardwareConcurrency))}function yl(e){xt&&(b&&f.log("[Measurements] Adding LCP Data"),xt.element&&e.setTag("lcp.element",$t(xt.element)),xt.id&&e.setTag("lcp.id",xt.id),xt.url&&e.setTag("lcp.url",xt.url.trim().slice(0,200)),e.setTag("lcp.size",xt.size)),nn&&nn.sources&&(b&&f.log("[Measurements] Adding CLS Data"),nn.sources.forEach((t,n)=>e.setTag(`cls.source.${n+1}`,$t(t.node))))}function Ji(e,t,n,r){let i=t[n];i!=null&&i<dl&&(e[r]=i)}function Il(e){let t=Jt();if(!t)return;let{responseStart:n,requestStart:r}=t;r<=n&&(b&&f.log("[Measurements] Adding TTFB Request Time"),e["ttfb.requestTime"]={value:n-r,unit:"millisecond"})}function bl(e,t,n){if(!at(t))return!1;let r;return e!==void 0&&typeof t.tracesSampler=="function"?r=t.tracesSampler({transactionContext:e,name:e.name,parentSampled:e.parentSampled,attributes:{...e.data,...e.attributes},location:I.location}):e!==void 0&&e.sampled!==void 0?r=e.sampled:typeof t.tracesSampleRate<"u"?r=t.tracesSampleRate:r=1,Mn(r)?r===!0?n:r===!1?0:r*n:(b&&f.warn("[Tracing] Discarding interaction span because of invalid sample rate."),!1)}u();function Xs(e,t=!0,n=!0){if(!I||!I.location){b&&f.warn("Could not initialize routing instrumentation due to invalid location");return}let r=I.location.href,i;t&&(i=e({name:I.location.pathname,startTimestamp:B?B/1e3:void 0,op:"pageload",origin:"auto.pageload.browser",metadata:{source:"url"}})),n&&Ue(({to:o,from:s})=>{if(s===void 0&&r&&r.indexOf(o)!==-1){r=void 0;return}s!==o&&(r=void 0,i&&(b&&f.log(`[Tracing] Finishing current transaction with op: ${i.op}`),i.end()),i=e({name:I.location.pathname,op:"navigation",origin:"auto.navigation.browser",metadata:{source:"url"}}))})}var ta="BrowserTracing",xl={...zt,markBackgroundTransactions:!0,routingInstrumentation:Xs,startTransactionOnLocationChange:!0,startTransactionOnPageLoad:!0,enableLongTask:!0,enableInp:!1,interactionsSampleRate:1,_experiments:{},...ce},Qs=10,Vi=class{constructor(t){this.name=ta,this._hasSetTracePropagationTargets=!1,ae(),b&&(this._hasSetTracePropagationTargets=!!(t&&(t.tracePropagationTargets||t.tracingOrigins))),this.options={...xl,...t},this.options._experiments.enableLongTask!==void 0&&(this.options.enableLongTask=this.options._experiments.enableLongTask),t&&!t.tracePropagationTargets&&t.tracingOrigins&&(this.options.tracePropagationTargets=t.tracingOrigins),this._collectWebVitals=tr(),this._interactionIdToRouteNameMapping={},this.options.enableInp&&rr(this._interactionIdToRouteNameMapping,this.options.interactionsSampleRate),this.options.enableLongTask&&er(),this.options._experiments.enableInteractions&&nr(),this._latestRoute={name:void 0,context:void 0}}setupOnce(t,n){this._getCurrentHub=n;let i=n().getClient(),o=i&&i.getOptions(),{routingInstrumentation:s,startTransactionOnLocationChange:a,startTransactionOnPageLoad:c,markBackgroundTransactions:d,traceFetch:l,traceXHR:p,shouldCreateSpanForRequest:m,enableHTTPTimings:_,_experiments:S}=this.options,T=o&&o.tracePropagationTargets,y=T||this.options.tracePropagationTargets;b&&this._hasSetTracePropagationTargets&&T&&f.warn("[Tracing] The `tracePropagationTargets` option was set in the BrowserTracing integration and top level `Sentry.init`. The top level `Sentry.init` value is being used."),s(v=>{let N=this._createRouteTransaction(v);return this.options._experiments.onStartRouteTransaction&&this.options._experiments.onStartRouteTransaction(N,v,n),N},c,a),d&&Xn(),S.enableInteractions&&this._registerInteractionListener(),this.options.enableInp&&this._registerInpInteractionListener(),en({traceFetch:l,traceXHR:p,tracePropagationTargets:y,shouldCreateSpanForRequest:m,enableHTTPTimings:_})}_createRouteTransaction(t){if(!this._getCurrentHub){b&&f.warn(`[Tracing] Did not create ${t.op} transaction because _getCurrentHub is invalid.`);return}let n=this._getCurrentHub(),{beforeNavigate:r,idleTimeout:i,finalTimeout:o,heartbeatInterval:s}=this.options,a=t.op==="pageload",c;if(a){let _=a?Zs("sentry-trace"):"",S=a?Zs("baggage"):void 0,{traceId:T,dsc:y,parentSpanId:v,sampled:N}=je(_,S);c={traceId:T,parentSpanId:v,parentSampled:N,...t,metadata:{...t.metadata,dynamicSamplingContext:y},trimEnd:!0}}else c={trimEnd:!0,...t};let d=typeof r=="function"?r(c):c,l=d===void 0?{...c,sampled:!1}:d;l.metadata=l.name!==c.name?{...l.metadata,source:"custom"}:l.metadata,this._latestRoute.name=l.name,this._latestRoute.context=l,l.sampled===!1&&b&&f.log(`[Tracing] Will not send ${l.op} transaction because of beforeNavigate.`),b&&f.log(`[Tracing] Starting ${l.op} transaction on scope`);let{location:p}=I,m=se(n,l,i,o,!0,{location:p},s,a);return a&&I.document&&(I.document.addEventListener("readystatechange",()=>{["interactive","complete"].includes(I.document.readyState)&&m.sendAutoFinishSignal()}),["interactive","complete"].includes(I.document.readyState)&&m.sendAutoFinishSignal()),m.registerBeforeFinishCallback(_=>{this._collectWebVitals(),ir(_)}),m}_registerInteractionListener(){let t,n=()=>{let{idleTimeout:r,finalTimeout:i,heartbeatInterval:o}=this.options,s="ui.action.click",a=z();if(a&&a.op&&["navigation","pageload"].includes(a.op)){b&&f.warn(`[Tracing] Did not create ${s} transaction because a pageload or navigation transaction is in progress.`);return}if(t&&(t.setFinishReason("interactionInterrupted"),t.end(),t=void 0),!this._getCurrentHub){b&&f.warn(`[Tracing] Did not create ${s} transaction because _getCurrentHub is invalid.`);return}if(!this._latestRoute.name){b&&f.warn(`[Tracing] Did not create ${s} transaction because _latestRouteName is missing.`);return}let c=this._getCurrentHub(),{location:d}=I,l={name:this._latestRoute.name,op:s,trimEnd:!0,data:{[G]:this._latestRoute.context?vl(this._latestRoute.context):"url"}};t=se(c,l,r,i,!0,{location:d},o)};["click"].forEach(r=>{I.document&&addEventListener(r,n,{once:!1,capture:!0})})}_registerInpInteractionListener(){let t=({entries:n})=>{let r=C(),i=r!==void 0&&r.getIntegrationByName!==void 0?r.getIntegrationByName("Replay"):void 0,o=i!==void 0?i.getReplayId():void 0,s=z(),a=L(),c=a!==void 0?a.getUser():void 0;n.forEach(d=>{if(Al(d)){let l=d.interactionId;if(l===void 0)return;let p=this._interactionIdToRouteNameMapping[l],m=d.duration,_=d.startTime,S=Object.keys(this._interactionIdToRouteNameMapping),T=S.length>0?S.reduce((y,v)=>this._interactionIdToRouteNameMapping[y].duration<this._interactionIdToRouteNameMapping[v].duration?y:v):void 0;if(d.entryType==="first-input"&&S.map(v=>this._interactionIdToRouteNameMapping[v]).some(v=>v.duration===m&&v.startTime===_)||!l)return;if(p)p.duration=Math.max(p.duration,m);else if(S.length<Qs||T===void 0||m>this._interactionIdToRouteNameMapping[T].duration){let y=this._latestRoute.name,v=this._latestRoute.context;y&&v&&(T&&Object.keys(this._interactionIdToRouteNameMapping).length>=Qs&&delete this._interactionIdToRouteNameMapping[T],this._interactionIdToRouteNameMapping[l]={routeName:y,duration:m,parentContext:v,user:c,activeTransaction:s,replayId:o,startTime:_})}}})};dt("event",t),dt("first-input",t)}};function Zs(e){let t=ke(`meta[name=${e}]`);return t?t.getAttribute("content"):void 0}function vl(e){let t=e.attributes&&e.attributes[G],n=e.data&&e.data[G],r=e.metadata&&e.metadata.source;return t||n||r}function Al(e){return"duration"in e}u();var Rl="BrowserTracing",Cl={...zt,instrumentNavigation:!0,instrumentPageLoad:!0,markBackgroundSpan:!0,enableLongTask:!0,enableInp:!1,interactionsSampleRate:1,_experiments:{},...ce},Ol=(e={})=>{let t=b?!!(e.tracePropagationTargets||e.tracingOrigins):!1;ae(),!e.tracePropagationTargets&&e.tracingOrigins&&(e.tracePropagationTargets=e.tracingOrigins);let n={...Cl,...e},r=tr(),i={};n.enableInp&&rr(i,n.interactionsSampleRate),n.enableLongTask&&er(),n._experiments.enableInteractions&&nr();let o={name:void 0,context:void 0};function s(a){let c=D(),{beforeStartSpan:d,idleTimeout:l,finalTimeout:p,heartbeatInterval:m}=n,_=a.op==="pageload",S;if(_){let N=_?ea("sentry-trace"):"",P=_?ea("baggage"):void 0,{traceId:vt,dsc:Kt,parentSpanId:pr,sampled:fr}=je(N,P);S={traceId:vt,parentSpanId:pr,parentSampled:fr,...a,metadata:{...a.metadata,dynamicSamplingContext:Kt},trimEnd:!0}}else S={trimEnd:!0,...a};let T=d?d(S):S;T.metadata=T.name!==S.name?{...T.metadata,source:"custom"}:T.metadata,o.name=T.name,o.context=T,T.sampled===!1&&b&&f.log(`[Tracing] Will not send ${T.op} transaction because of beforeNavigate.`),b&&f.log(`[Tracing] Starting ${T.op} transaction on scope`);let{location:y}=I,v=se(c,T,l,p,!0,{location:y},m,_);return _&&I.document&&(I.document.addEventListener("readystatechange",()=>{["interactive","complete"].includes(I.document.readyState)&&v.sendAutoFinishSignal()}),["interactive","complete"].includes(I.document.readyState)&&v.sendAutoFinishSignal()),v.registerBeforeFinishCallback(N=>{r(),ir(N)}),v}return{name:Rl,setupOnce:()=>{},afterAllSetup(a){let c=a.getOptions(),{markBackgroundSpan:d,traceFetch:l,traceXHR:p,shouldCreateSpanForRequest:m,enableHTTPTimings:_,_experiments:S}=n,T=c&&c.tracePropagationTargets,y=T||n.tracePropagationTargets;b&&t&&T&&f.warn("[Tracing] The `tracePropagationTargets` option was set in the BrowserTracing integration and top level `Sentry.init`. The top level `Sentry.init` value is being used.");let v,N=I.location&&I.location.href;if(a.on&&(a.on("startNavigationSpan",P=>{v&&(b&&f.log(`[Tracing] Finishing current transaction with op: ${R(v).op}`),v.end()),v=s({op:"navigation",...P})}),a.on("startPageLoadSpan",P=>{v&&(b&&f.log(`[Tracing] Finishing current transaction with op: ${R(v).op}`),v.end()),v=s({op:"pageload",...P})})),n.instrumentPageLoad&&a.emit&&I.location){let P={name:I.location.pathname,startTimestamp:B?B/1e3:void 0,origin:"auto.pageload.browser",attributes:{[G]:"url"}};ra(a,P)}n.instrumentNavigation&&a.emit&&I.location&&Ue(({to:P,from:vt})=>{if(vt===void 0&&N&&N.indexOf(P)!==-1){N=void 0;return}if(vt!==P){N=void 0;let Kt={name:I.location.pathname,origin:"auto.navigation.browser",attributes:{[G]:"url"}};ia(a,Kt)}}),d&&Xn(),S.enableInteractions&&Dl(n,o),n.enableInp&&kl(i,o),en({traceFetch:l,traceXHR:p,tracePropagationTargets:y,shouldCreateSpanForRequest:m,enableHTTPTimings:_})},options:n}};function ra(e,t){if(!e.emit)return;e.emit("startPageLoadSpan",t);let n=ie();return(n&&R(n).op)==="pageload"?n:void 0}function ia(e,t){if(!e.emit)return;e.emit("startNavigationSpan",t);let n=ie();return(n&&R(n).op)==="navigation"?n:void 0}function ea(e){let t=ke(`meta[name=${e}]`);return t?t.getAttribute("content"):void 0}function Dl(e,t){let n,r=()=>{let{idleTimeout:i,finalTimeout:o,heartbeatInterval:s}=e,a="ui.action.click",c=z();if(c&&c.op&&["navigation","pageload"].includes(c.op)){b&&f.warn(`[Tracing] Did not create ${a} transaction because a pageload or navigation transaction is in progress.`);return}if(n&&(n.setFinishReason("interactionInterrupted"),n.end(),n=void 0),!t.name){b&&f.warn(`[Tracing] Did not create ${a} transaction because _latestRouteName is missing.`);return}let{location:d}=I,l={name:t.name,op:a,trimEnd:!0,data:{[G]:t.context?wl(t.context):"url"}};n=se(D(),l,i,o,!0,{location:d},s)};["click"].forEach(i=>{I.document&&addEventListener(i,r,{once:!1,capture:!0})})}function Nl(e){return"duration"in e}var na=10;function kl(e,t){let n=({entries:r})=>{let i=C(),o=i!==void 0&&i.getIntegrationByName!==void 0?i.getIntegrationByName("Replay"):void 0,s=o!==void 0?o.getReplayId():void 0,a=z(),c=L(),d=c!==void 0?c.getUser():void 0;r.forEach(l=>{if(Nl(l)){let p=l.interactionId;if(p===void 0)return;let m=e[p],_=l.duration,S=l.startTime,T=Object.keys(e),y=T.length>0?T.reduce((v,N)=>e[v].duration<e[N].duration?v:N):void 0;if(l.entryType==="first-input"&&T.map(N=>e[N]).some(N=>N.duration===_&&N.startTime===S)||!p)return;if(m)m.duration=Math.max(m.duration,_);else if(T.length<na||y===void 0||_>e[y].duration){let v=t.name,N=t.context;v&&N&&(y&&Object.keys(e).length>=na&&delete e[y],e[p]={routeName:v,duration:_,parentContext:N,user:d,activeTransaction:a,replayId:s,startTime:S})}}})};dt("event",n),dt("first-input",n)}function wl(e){let t=e.attributes&&e.attributes[G],n=e.data&&e.data[G],r=e.metadata&&e.metadata.source;return t||n||r}u();u();u();function nt(e){let t=A([e,"call",r=>r(),"access",r=>r.getClient,"call",r=>r(),"optionalAccess",r=>r.getOptions,"call",r=>r()]);return(A([t,"optionalAccess",r=>r.instrumenter])||"sentry")!=="sentry"}var or=class e{static __initStatic(){this.id="Express"}constructor(t={}){this.name=e.id,this._router=t.router||t.app,this._methods=(Array.isArray(t.methods)?t.methods:[]).concat("use")}setupOnce(t,n){if(!this._router){b&&f.error("ExpressIntegration is missing an Express instance");return}if(nt(n)){b&&f.log("Express Integration is skipped because of instrumenter configuration.");return}Ll(this._router,this._methods),Ul(this._router)}};or.__initStatic();function oa(e,t){let n=e.length;switch(n){case 2:return function(r,i){let o=i.__sentry_transaction;if(o){let s=o.startChild({description:e.name,op:`middleware.express.${t}`,origin:"auto.middleware.express"});i.once("finish",()=>{s.end()})}return e.call(this,r,i)};case 3:return function(r,i,o){let s=i.__sentry_transaction,a=A([s,"optionalAccess",c=>c.startChild,"call",c=>c({description:e.name,op:`middleware.express.${t}`,origin:"auto.middleware.express"})]);e.call(this,r,i,function(...c){A([a,"optionalAccess",d=>d.end,"call",d=>d()]),o.call(this,...c)})};case 4:return function(r,i,o,s){let a=o.__sentry_transaction,c=A([a,"optionalAccess",d=>d.startChild,"call",d=>d({description:e.name,op:`middleware.express.${t}`,origin:"auto.middleware.express"})]);e.call(this,r,i,o,function(...d){A([c,"optionalAccess",l=>l.end,"call",l=>l()]),s.call(this,...d)})};default:throw new Error(`Express middleware takes 2-4 arguments. Got: ${n}`)}}function Ml(e,t){return e.map(n=>typeof n=="function"?oa(n,t):Array.isArray(n)?n.map(r=>typeof r=="function"?oa(r,t):r):n)}function Pl(e,t){let n=e[t];return e[t]=function(...r){return n.call(this,...Ml(r,t))},e}function Ll(e,t=[]){t.forEach(n=>Pl(e,n))}function Ul(e){let t="settings"in e;t&&e._router===void 0&&e.lazyrouter&&e.lazyrouter();let n=t?e._router:e;if(!n){b&&f.debug("Cannot instrument router for URL Parameterization (did not find a valid router)."),b&&f.debug("Routing instrumentation is currently only supported in Express 4.");return}let r=Object.getPrototypeOf(n),i=r.process_params;r.process_params=function(s,a,c,d,l){c._reconstructedRoute||(c._reconstructedRoute="");let{layerRoutePath:p,isRegex:m,isArray:_,numExtraSegments:S}=Bl(s);(p||m||_)&&(c._hasParameters=!0);let T;p?T=p:T=Gl(c.originalUrl,c._reconstructedRoute,s.path)||"";let y=T.split("/").filter(P=>P.length>0&&(m||_||!P.includes("*"))).join("/");y&&y.length>0&&(c._reconstructedRoute+=`/${y}${m?"/":""}`);let v=ge(Dt(c.originalUrl||""))+S,N=ge(c._reconstructedRoute);if(v===N){c._hasParameters||c._reconstructedRoute!==c.originalUrl&&(c._reconstructedRoute=c.originalUrl?Dt(c.originalUrl):c.originalUrl);let P=d.__sentry_transaction,vt=P&&R(P).data||{};if(P&&vt[G]!=="custom"){let Kt=c._reconstructedRoute||"/",[pr,fr]=Zt(c,{path:!0,method:!0,customRoute:Kt});P.updateName(pr),P.setAttribute(G,fr)}}return i.call(this,s,a,c,d,l)}}var Fl=(e,t,n)=>{if(!e||!t||!n||Object.keys(n).length===0||!A([n,"access",d=>d[0],"optionalAccess",d=>d.offset]))return;let r=n.sort((d,l)=>d.offset-l.offset),o=new RegExp(t,`${t.flags}d`).exec(e);if(!o||!o.indices)return;let[,...s]=o.indices;if(s.length!==r.length)return;let a=e,c=0;return s.forEach((d,l)=>{if(d){let[p,m]=d,_=a.substring(0,p-c),S=`:${r[l].name}`,T=a.substring(m-c);a=_+S+T,c=c+(m-p-S.length)}}),a};function Bl(e){let t=A([e,"access",s=>s.route,"optionalAccess",s=>s.path]),n=Re(t),r=Array.isArray(t);if(!t){let[s]=x.process.versions.node.split(".").map(Number);s>=16&&(t=Fl(e.path,e.regexp,e.keys))}if(!t)return{isRegex:n,isArray:r,numExtraSegments:0};let i=r?Math.max(Hl(t)-ge(e.path||""),0):0;return{layerRoutePath:$l(r,t),isRegex:n,isArray:r,numExtraSegments:i}}function Hl(e){return e.reduce((t,n)=>t+ge(n.toString()),0)}function $l(e,t){return e?t.map(n=>n.toString()).join(","):t&&t.toString()}function Gl(e,t,n){let r=Dt(e||""),i=A([r,"optionalAccess",c=>c.split,"call",c=>c("/"),"access",c=>c.filter,"call",c=>c(d=>!!d)]),o=0,s=A([t,"optionalAccess",c=>c.split,"call",c=>c("/"),"access",c=>c.filter,"call",c=>c(d=>!!d),"access",c=>c.length])||0;return A([n,"optionalAccess",c=>c.split,"call",c=>c("/"),"access",c=>c.filter,"call",c=>c(d=>A([i,"optionalAccess",l=>l[s+o]])===d?(o+=1,!0):!1),"access",c=>c.join,"call",c=>c("/")])}u();var sr=class e{static __initStatic(){this.id="Postgres"}constructor(t={}){this.name=e.id,this._usePgNative=!!t.usePgNative,this._module=t.module}loadDependency(){return this._module=this._module||st("pg")}setupOnce(t,n){if(nt(n)){b&&f.log("Postgres Integration is skipped because of instrumenter configuration.");return}let r=this.loadDependency();if(!r){b&&f.error("Postgres Integration was unable to require `pg` package.");return}let i=this._usePgNative?A([r,"access",o=>o.native,"optionalAccess",o=>o.Client]):r.Client;if(!i){b&&f.error("Postgres Integration was unable to access 'pg-native' bindings.");return}M(i.prototype,"query",function(o){return function(s,a,c){let l=n().getScope().getSpan(),p={"db.system":"postgresql"};try{this.database&&(p["db.name"]=this.database),this.host&&(p["server.address"]=this.host),this.port&&(p["server.port"]=this.port),this.user&&(p["db.user"]=this.user)}catch{}let m=A([l,"optionalAccess",S=>S.startChild,"call",S=>S({description:typeof s=="string"?s:s.text,op:"db",origin:"auto.db.postgres",data:p})]);if(typeof c=="function")return o.call(this,s,a,function(S,T){A([m,"optionalAccess",y=>y.end,"call",y=>y()]),c(S,T)});if(typeof a=="function")return o.call(this,s,function(S,T){A([m,"optionalAccess",y=>y.end,"call",y=>y()]),a(S,T)});let _=typeof a<"u"?o.call(this,s,a):o.call(this,s);return F(_)?_.then(S=>(A([m,"optionalAccess",T=>T.end,"call",T=>T()]),S)):(A([m,"optionalAccess",S=>S.end,"call",S=>S()]),_)}})}};sr.__initStatic();u();var ar=class e{static __initStatic(){this.id="Mysql"}constructor(){this.name=e.id}loadDependency(){return this._module=this._module||st("mysql/lib/Connection.js")}setupOnce(t,n){if(nt(n)){b&&f.log("Mysql Integration is skipped because of instrumenter configuration.");return}let r=this.loadDependency();if(!r){b&&f.error("Mysql Integration was unable to require `mysql` package.");return}let i;try{r.prototype.connect=new Proxy(r.prototype.connect,{apply(a,c,d){return i||(i=c.config),a.apply(c,d)}})}catch{b&&f.error("Mysql Integration was unable to instrument `mysql` config.")}function o(){return i?{"server.address":i.host,"server.port":i.port,"db.user":i.user}:{}}function s(a){if(!a)return;let c=o();Object.keys(c).forEach(d=>{a.setAttribute(d,c[d])}),a.end()}M(r,"createQuery",function(a){return function(c,d,l){let m=n().getScope().getSpan(),_=A([m,"optionalAccess",T=>T.startChild,"call",T=>T({description:typeof c=="string"?c:c.sql,op:"db",origin:"auto.db.mysql",data:{"db.system":"mysql"}})]);if(typeof l=="function")return a.call(this,c,d,function(T,y,v){s(_),l(T,y,v)});if(typeof d=="function")return a.call(this,c,function(T,y,v){s(_),d(T,y,v)});let S=a.call(this,c,d);return S.on("end",()=>{s(_)}),S}})}};ar.__initStatic();u();var jl=["aggregate","bulkWrite","countDocuments","createIndex","createIndexes","deleteMany","deleteOne","distinct","drop","dropIndex","dropIndexes","estimatedDocumentCount","find","findOne","findOneAndDelete","findOneAndReplace","findOneAndUpdate","indexes","indexExists","indexInformation","initializeOrderedBulkOp","insertMany","insertOne","isCapped","mapReduce","options","parallelCollectionScan","rename","replaceOne","stats","updateMany","updateOne"],Wl={bulkWrite:["operations"],countDocuments:["query"],createIndex:["fieldOrSpec"],createIndexes:["indexSpecs"],deleteMany:["filter"],deleteOne:["filter"],distinct:["key","query"],dropIndex:["indexName"],find:["query"],findOne:["query"],findOneAndDelete:["filter"],findOneAndReplace:["filter","replacement"],findOneAndUpdate:["filter","update"],indexExists:["indexes"],insertMany:["docs"],insertOne:["doc"],mapReduce:["map","reduce"],rename:["newName"],replaceOne:["filter","doc"],updateMany:["filter","update"],updateOne:["filter","update"]};function ql(e){return e&&typeof e=="object"&&e.once&&typeof e.once=="function"}var cr=class e{static __initStatic(){this.id="Mongo"}constructor(t={}){this.name=e.id,this._operations=Array.isArray(t.operations)?t.operations:jl,this._describeOperations="describeOperations"in t?t.describeOperations:!0,this._useMongoose=!!t.useMongoose}loadDependency(){let t=this._useMongoose?"mongoose":"mongodb";return this._module=this._module||st(t)}setupOnce(t,n){if(nt(n)){b&&f.log("Mongo Integration is skipped because of instrumenter configuration.");return}let r=this.loadDependency();if(!r){let i=this._useMongoose?"mongoose":"mongodb";b&&f.error(`Mongo Integration was unable to require \`${i}\` package.`);return}this._instrumentOperations(r.Collection,this._operations,n)}_instrumentOperations(t,n,r){n.forEach(i=>this._patchOperation(t,i,r))}_patchOperation(t,n,r){if(!(n in t.prototype))return;let i=this._getSpanContextFromOperationArguments.bind(this);M(t.prototype,n,function(o){return function(...s){let a=s[s.length-1],c=r(),d=c.getScope(),l=c.getClient(),p=d.getSpan(),m=A([l,"optionalAccess",S=>S.getOptions,"call",S=>S(),"access",S=>S.sendDefaultPii]);if(typeof a!="function"||n==="mapReduce"&&s.length===2){let S=A([p,"optionalAccess",y=>y.startChild,"call",y=>y(i(this,n,s,m))]),T=o.call(this,...s);if(F(T))return T.then(y=>(A([S,"optionalAccess",v=>v.end,"call",v=>v()]),y));if(ql(T)){let y=T;try{y.once("close",()=>{A([S,"optionalAccess",v=>v.end,"call",v=>v()])})}catch{A([S,"optionalAccess",N=>N.end,"call",N=>N()])}return y}else return A([S,"optionalAccess",y=>y.end,"call",y=>y()]),T}let _=A([p,"optionalAccess",S=>S.startChild,"call",S=>S(i(this,n,s.slice(0,-1)))]);return o.call(this,...s.slice(0,-1),function(S,T){A([_,"optionalAccess",y=>y.end,"call",y=>y()]),a(S,T)})}})}_getSpanContextFromOperationArguments(t,n,r,i=!1){let o={"db.system":"mongodb","db.name":t.dbName,"db.operation":n,"db.mongodb.collection":t.collectionName},s={op:"db",origin:"auto.db.mongo",description:n,data:o},a=Wl[n],c=Array.isArray(this._describeOperations)?this._describeOperations.includes(n):this._describeOperations;if(!a||!c||!i)return s;try{if(n==="mapReduce"){let[d,l]=r;o[a[0]]=typeof d=="string"?d:d.name||"<anonymous>",o[a[1]]=typeof l=="string"?l:l.name||"<anonymous>"}else for(let d=0;d<a.length;d++)o[`db.mongodb.${a[d]}`]=JSON.stringify(r[d])}catch{}return s}};cr.__initStatic();u();function zl(e){return!!e&&!!e.$use}var ur=class e{static __initStatic(){this.id="Prisma"}constructor(t={}){if(this.name=e.id,zl(t.client)&&!t.client._sentryInstrumented){X(t.client,"_sentryInstrumented",!0);let n={};try{let r=t.client._engineConfig;if(r){let{activeProvider:i,clientVersion:o}=r;i&&(n["db.system"]=i),o&&(n["db.prisma.version"]=o)}}catch{}t.client.$use((r,i)=>{if(nt(D))return i(r);let o=r.action,s=r.model;return hi({name:s?`${s} ${o}`:o,onlyIfParent:!0,op:"db.prisma",attributes:{[ct]:"auto.db.prisma"},data:{...n,"db.operation":o}},()=>i(r))})}else b&&f.warn("Unsupported Prisma client provided to PrismaIntegration. Provided client:",t.client)}setupOnce(){}};ur.__initStatic();u();var dr=class e{static __initStatic(){this.id="GraphQL"}constructor(){this.name=e.id}loadDependency(){return this._module=this._module||st("graphql/execution/execute.js")}setupOnce(t,n){if(nt(n)){b&&f.log("GraphQL Integration is skipped because of instrumenter configuration.");return}let r=this.loadDependency();if(!r){b&&f.error("GraphQL Integration was unable to require graphql/execution package.");return}M(r,"execute",function(i){return function(...o){let s=n().getScope(),a=s.getSpan(),c=A([a,"optionalAccess",l=>l.startChild,"call",l=>l({description:"execute",op:"graphql.execute",origin:"auto.graphql.graphql"})]);A([s,"optionalAccess",l=>l.setSpan,"call",l=>l(c)]);let d=i.call(this,...o);return F(d)?d.then(l=>(A([c,"optionalAccess",p=>p.end,"call",p=>p()]),A([s,"optionalAccess",p=>p.setSpan,"call",p=>p(a)]),l)):(A([c,"optionalAccess",l=>l.end,"call",l=>l()]),A([s,"optionalAccess",l=>l.setSpan,"call",l=>l(a)]),d)}})}};dr.__initStatic();u();var lr=class e{static __initStatic(){this.id="Apollo"}constructor(t={useNestjs:!1}){this.name=e.id,this._useNest=!!t.useNestjs}loadDependency(){return this._useNest?this._module=this._module||st("@nestjs/graphql"):this._module=this._module||st("apollo-server-core"),this._module}setupOnce(t,n){if(nt(n)){b&&f.log("Apollo Integration is skipped because of instrumenter configuration.");return}if(this._useNest){let r=this.loadDependency();if(!r){b&&f.error("Apollo-NestJS Integration was unable to require @nestjs/graphql package.");return}M(r.GraphQLFactory.prototype,"mergeWithSchema",function(i){return function(...o){return M(this.resolversExplorerService,"explore",function(s){return function(){let a=Gt(s.call(this));return sa(a,n)}}),i.call(this,...o)}})}else{let r=this.loadDependency();if(!r){b&&f.error("Apollo Integration was unable to require apollo-server-core package.");return}M(r.ApolloServerBase.prototype,"constructSchema",function(i){return function(){if(!this.config.resolvers)return b&&(this.config.schema?(f.warn("Apollo integration is not able to trace `ApolloServer` instances constructed via `schema` property.If you are using NestJS with Apollo, please use `Sentry.Integrations.Apollo({ useNestjs: true })` instead."),f.warn()):this.config.modules&&f.warn("Apollo integration is not able to trace `ApolloServer` instances constructed via `modules` property."),f.error("Skipping tracing as no resolvers found on the `ApolloServer` instance.")),i.call(this);let o=Gt(this.config.resolvers);return this.config.resolvers=sa(o,n),i.call(this)}})}}};lr.__initStatic();function sa(e,t){return e.map(n=>(Object.keys(n).forEach(r=>{Object.keys(n[r]).forEach(i=>{typeof n[r][i]=="function"&&Yl(n,r,i,t)})}),n))}function Yl(e,t,n,r){M(e[t],n,function(i){return function(...o){let a=r().getScope().getSpan(),c=A([a,"optionalAccess",l=>l.startChild,"call",l=>l({description:`${t}.${n}`,op:"graphql.resolve",origin:"auto.graphql.apollo"})]),d=i.call(this,...o);return F(d)?d.then(l=>(A([c,"optionalAccess",p=>p.end,"call",p=>p()]),l)):(A([c,"optionalAccess",l=>l.end,"call",l=>l()]),d)}})}u();var aa="CaptureConsole",Jl=(e={})=>{let t=e.levels||Xt;return{name:aa,setupOnce(){},setup(n){"console"in x&&vr(({args:r,level:i})=>{C()!==n||!t.includes(i)||Vl(r,i)})}}},ca=Jl,Kl=w(aa,ca);function Vl(e,t){let n={level:jr(t),extra:{arguments:e}};Lt(r=>{if(r.addEventProcessor(s=>(s.logger="console",Rt(s,{handled:!1,type:"console"}),s)),t==="assert"&&e[0]===!1){let s=`Assertion failed: ${on(e.slice(1)," ")||"console.assert"}`;r.setExtra("arguments",e.slice(1)),Ee(s,n);return}let i=e.find(s=>s instanceof Error);if(t==="error"&&i){li(i,n);return}let o=on(e," ");Ee(o,n)})}u();var ua="Debug",Xl=(e={})=>{let t={debugger:!1,stringify:!1,...e};return{name:ua,setupOnce(){},setup(n){n.on&&n.on("beforeSendEvent",(r,i)=>{if(t.debugger)debugger;ht(()=>{t.stringify?(console.log(JSON.stringify(r,null,2)),i&&Object.keys(i).length&&console.log(JSON.stringify(i,null,2))):(console.log(r),i&&Object.keys(i).length&&console.log(i))})})}}},da=Xl,Ql=w(ua,da);u();u();var Bt=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var fa="Dedupe",Zl=()=>{let e;return{name:fa,setupOnce(){},processEvent(t){if(t.type)return t;try{if(ep(t,e))return Bt&&f.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}},ma=Zl,tp=w(fa,ma);function ep(e,t){return t?!!(np(e,t)||rp(e,t)):!1}function np(e,t){let n=e.message,r=t.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!ha(e,t)||!ga(e,t))}function rp(e,t){let n=la(t),r=la(e);return!(!n||!r||n.type!==r.type||n.value!==r.value||!ha(e,t)||!ga(e,t))}function ga(e,t){let n=pa(e),r=pa(t);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let i=0;i<r.length;i++){let o=r[i],s=n[i];if(o.filename!==s.filename||o.lineno!==s.lineno||o.colno!==s.colno||o.function!==s.function)return!1}return!0}function ha(e,t){let n=e.fingerprint,r=t.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;n=n,r=r;try{return n.join("")===r.join("")}catch{return!1}}function la(e){return e.exception&&e.exception.values&&e.exception.values[0]}function pa(e){let t=e.exception;if(t)try{return t.values[0].stacktrace.frames}catch{return}}u();var _a="ExtraErrorData",ip=(e={})=>{let t=e.depth||3,n=e.captureErrorCause||!1;return{name:_a,setupOnce(){},processEvent(r,i){return sp(r,i,t,n)}}},Sa=ip,op=w(_a,Sa);function sp(e,t={},n,r){if(!t.originalException||!mt(t.originalException))return e;let i=t.originalException.name||t.originalException.constructor.name,o=ap(t.originalException,r);if(o){let s={...e.contexts},a=K(o,n);return J(a)&&(X(a,"__sentry_skip_normalization__",!0),s[i]=a),{...e,contexts:s}}return e}function ap(e,t){try{let n=["name","message","stack","line","column","fileName","lineNumber","columnNumber","toJSON"],r={};for(let i of Object.keys(e)){if(n.indexOf(i)!==-1)continue;let o=e[i];r[i]=mt(o)?o.toString():o}if(t&&e.cause!==void 0&&(r.cause=mt(e.cause)?e.cause.toString():e.cause),typeof e.toJSON=="function"){let i=e.toJSON();for(let o of Object.keys(i)){let s=i[o];r[o]=mt(s)?s.toString():s}}return r}catch(n){Bt&&f.error("Unable to extract extra data from the Error object:",n)}return null}u();var cp=x,Ta="ReportingObserver",Ea=new WeakMap,up=(e={})=>{let t=e.types||["crash","deprecation","intervention"];function n(r){if(Ea.has(C()))for(let i of r)Lt(o=>{o.setExtra("url",i.url);let s=`ReportingObserver [${i.type}]`,a="No details available";if(i.body){let c={};for(let d in i.body)c[d]=i.body[d];if(o.setExtra("body",c),i.type==="crash"){let d=i.body;a=[d.crashId||"",d.reason||""].join(" ").trim()||a}else a=i.body.message||a}Ee(`${s}: ${a}`)})}return{name:Ta,setupOnce(){if(!Nr())return;new cp.ReportingObserver(n,{buffered:!0,types:t}).observe()},setup(r){Ea.set(r,!0)}}},ya=up,dp=w(Ta,ya);u();var Ia="RewriteFrames",lp=(e={})=>{let t=e.root,n=e.prefix||"app:///",r=e.iteratee||(s=>{if(!s.filename)return s;let a=/^[a-zA-Z]:\\/.test(s.filename)||s.filename.includes("\\")&&!s.filename.includes("/"),c=/^\//.test(s.filename);if(a||c){let d=a?s.filename.replace(/^[a-zA-Z]:/,"").replace(/\\/g,"/"):s.filename,l=t?Fr(t,d):Br(d);s.filename=`${n}${l}`}return s});function i(s){try{return{...s,exception:{...s.exception,values:s.exception.values.map(a=>({...a,...a.stacktrace&&{stacktrace:o(a.stacktrace)}}))}}}catch{return s}}function o(s){return{...s,frames:s&&s.frames&&s.frames.map(a=>r(a))}}return{name:Ia,setupOnce(){},processEvent(s){let a=s;return s.exception&&Array.isArray(s.exception.values)&&(a=i(a)),a}}},ba=lp,pp=w(Ia,ba);u();var xa="SessionTiming",fp=()=>{let e=Date.now();return{name:xa,setupOnce(){},processEvent(t){let n=Date.now();return{...t,extra:{...t.extra,"session:start":e,"session:duration":n-e,"session:end":n}}}}},va=fp,mp=w(xa,va);u();var Aa="HttpClient",gp=(e={})=>{let t={failedRequestStatusCodes:[[500,599]],failedRequestTargets:[/.*/],...e};return{name:Aa,setupOnce(){},setup(n){xp(n,t),vp(n,t)}}},Ra=gp,hp=w(Aa,Ra);function _p(e,t,n,r){if(Oa(e,n.status,n.url)){let i=Ap(t,r),o,s,a,c;Na()&&([{headers:o,cookies:a},{headers:s,cookies:c}]=[{cookieHeader:"Cookie",obj:i},{cookieHeader:"Set-Cookie",obj:n}].map(({cookieHeader:l,obj:p})=>{let m=Tp(p.headers),_;try{let S=m[l]||m[l.toLowerCase()]||void 0;S&&(_=Ca(S))}catch{Bt&&f.log(`Could not extract cookies from header ${l}`)}return{headers:m,cookies:_}}));let d=Da({url:i.url,method:i.method,status:n.status,requestHeaders:o,responseHeaders:s,requestCookies:a,responseCookies:c});Cn(d)}}function Sp(e,t,n,r){if(Oa(e,t.status,t.responseURL)){let i,o,s;if(Na()){try{let c=t.getResponseHeader("Set-Cookie")||t.getResponseHeader("set-cookie")||void 0;c&&(o=Ca(c))}catch{Bt&&f.log("Could not extract cookies from response headers")}try{s=yp(t)}catch{Bt&&f.log("Could not extract headers from response")}i=r}let a=Da({url:t.responseURL,method:n,status:t.status,requestHeaders:i,responseHeaders:s,responseCookies:o});Cn(a)}}function Ep(e){if(e){let t=e["Content-Length"]||e["content-length"];if(t)return parseInt(t,10)}}function Ca(e){return e.split("; ").reduce((t,n)=>{let[r,i]=n.split("=");return t[r]=i,t},{})}function Tp(e){let t={};return e.forEach((n,r)=>{t[r]=n}),t}function yp(e){let t=e.getAllResponseHeaders();return t?t.split(`\r
27
27
  `).reduce((n,r)=>{let[i,o]=r.split(": ");return n[i]=o,n},{}):{}}function Ip(e,t){return e.some(n=>typeof n=="string"?t.includes(n):n.test(t))}function bp(e,t){return e.some(n=>typeof n=="number"?n===t:t>=n[0]&&t<=n[1])}function xp(e,t){Me()&&Pe(n=>{if(C()!==e)return;let{response:r,args:i}=n,[o,s]=i;r&&_p(t,o,r,s)})}function vp(e,t){"XMLHttpRequest"in x&&Fe(n=>{if(C()!==e)return;let r=n.xhr,i=r[Ct];if(!i)return;let{method:o,request_headers:s}=i;try{Sp(t,r,o,s)}catch(a){Bt&&f.warn("Error while extracting response event form XHR response",a)}})}function Oa(e,t,n){return bp(e.failedRequestStatusCodes,t)&&Ip(e.failedRequestTargets,n)&&!Li(n,C())}function Da(e){let t=`HTTP Client Error with status code: ${e.status}`,n={message:t,exception:{values:[{type:"Error",value:t}]},request:{url:e.url,method:e.method,headers:e.requestHeaders,cookies:e.requestCookies},contexts:{response:{status_code:e.status,headers:e.responseHeaders,cookies:e.responseCookies,body_size:Ep(e.responseHeaders)}}};return Rt(n,{type:"http.client",handled:!1}),n}function Ap(e,t){return!t&&e instanceof Request||e instanceof Request&&e.bodyUsed?e:new Request(e,t)}function Na(){let e=C();return e?!!e.getOptions().sendDefaultPii:!1}u();var Xi=x,Rp=7,ka="ContextLines",Cp=(e={})=>{let t=e.frameContextLines!=null?e.frameContextLines:Rp;return{name:ka,setupOnce(){},processEvent(n){return Dp(n,t)}}},wa=Cp,Op=w(ka,wa);function Dp(e,t){let n=Xi.document,r=Xi.location&&Dt(Xi.location.href);if(!n||!r)return e;let i=e.exception&&e.exception.values;if(!i||!i.length)return e;let o=n.documentElement.innerHTML;if(!o)return e;let s=["<!DOCTYPE html>","<html>",...o.split(`
28
28
  `),"</html>"];return i.forEach(a=>{let c=a.stacktrace;c&&c.frames&&(c.frames=c.frames.map(d=>Np(d,s,r,t)))}),e}function Np(e,t,n,r){return e.filename!==n||!e.lineno||!t.length||Rr(t,e,r),e}u();export{mt as a,Pa as b,La as c,Ua as d,Y as e,le as f,rn as g,J as h,mr as i,on as j,Ht as k,Sr as l,x as m,$t as n,$a as o,Er as p,ht as q,f as r,it as s,M as t,X as u,oo as v,yr as w,br as x,k as y,lo as z,Ka as A,Qt as B,Va as C,vr as D,O as E,At as F,Ar as G,Rt as H,Za as I,Rr as J,ec as K,_o as L,Dr as M,Pe as N,wr as O,Mr as P,Ue as Q,Ct as R,Fe as S,mc as T,hn as U,gc as V,K as W,Sn as X,bc as Y,pt as Z,Be as _,lt as $,jt as aa,xc as ba,jr as ca,W as da,B as ea,$e as fa,te as ga,q as ha,Nt as ia,Kr as ja,wc as ka,yn as la,Xr as ma,Pc as na,Qr as oa,Zr as pa,ri as qa,Uc as ra,A as sa,Fc as ta,kt as ua,ii as va,Pt as wa,R as xa,di as ya,li as za,Ee as Aa,Cn as Ba,ou as Ca,su as Da,au as Ea,cu as Fa,uu as Ga,du as Ha,lu as Ia,pu as Ja,Lt as Ka,fu as La,mu as Ma,gu as Na,hu as Oa,_u as Pa,Su as Qa,C as Ra,Eu as Sa,L as Ta,Tu as Ua,pi as Va,yu as Wa,St as Xa,tt as Ya,An as Za,Et as _a,ai as $a,Se as ab,Ye as bb,qt as cb,ci as db,D as eb,et as fb,Rn as gb,z as hb,Iu as ib,mi as jb,bu as kb,re as lb,at as mb,vu as nb,hi as ob,Au as pb,Je as qb,ie as rb,Ru as sb,G as tb,Ut as ub,Te as vb,ct as wb,ae as xb,Ti as yb,xi as zb,Bu as Ab,wu as Bb,Mu as Cb,w as Db,Qe as Eb,Ju as Fb,wi as Gb,Ku as Hb,ts as Ib,Qu as Jb,Nd as Kb,ed as Lb,Li as Mb,nd as Nb,Ld as Ob,cs as Pb,sd as Qb,ys as Rb,Fd as Sb,ds as Tb,vi as Ub,ms as Vb,Ai as Wb,bs as Xb,Ad as Yb,pI as Zb,or as _b,sr as $b,ar as ac,cr as bc,ur as cc,dr as dc,lr as ec,qi as fc,dt as gc,ce as hc,en as ic,Vi as jc,Ol as kc,ra as lc,ia as mc,ca as nc,da as oc,ma as pc,Sa as qc,ya as rc,ba as sc,va as tc,Ra as uc,wa as vc};
29
- //# sourceMappingURL=chunk-ZRY56TPY.js.map
29
+ //# sourceMappingURL=chunk-FYQALL2O.js.map
@@ -1,4 +1,4 @@
1
1
  import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
3
  var a=Object.create;var r=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var u=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,o)=>(typeof require<"u"?require:e)[o]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var s=(t,e)=>()=>(t&&(e=t(t=0)),e);var D=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),F=(t,e)=>{for(var o in e)r(t,o,{get:e[o],enumerable:!0})},n=(t,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let m of c(e))!l.call(t,m)&&m!==o&&r(t,m,{get:()=>e[m],enumerable:!(i=p(e,m))||i.enumerable});return t};var L=(t,e,o)=>(o=t!=null?a(f(t)):{},n(e||!t||!t.__esModule?r(o,"default",{value:t,enumerable:!0}):o,t)),P=t=>n(r({},"__esModule",{value:!0}),t);import{fileURLToPath as _}from"url";import d from"path";var g,h,b,x=s(()=>{"use strict";g=()=>_(import.meta.url),h=()=>d.dirname(g()),b=h()});export{u as a,s as b,D as c,F as d,L as e,P as f,b as g,x as h};
4
- //# sourceMappingURL=chunk-HFDLXX7R.js.map
4
+ //# sourceMappingURL=chunk-V4TR6DCM.js.map
@@ -1,10 +1,10 @@
1
1
  import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
- import{a as m,c as b,e as V,h as d}from"./chunk-HFDLXX7R.js";var Ge=b((ss,qe)=>{"use strict";d();var{Duplex:Vt}=m("stream");function We(r){r.emit("close")}function $t(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Fe(r){this.removeListener("error",Fe),this.destroy(),this.listenerCount("error")===0&&this.emit("error",r)}function jt(r,e){let t=!0,i=new Vt({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return r.on("message",function(n,o){let l=!o&&i._readableState.objectMode?n.toString():n;i.push(l)||r.pause()}),r.once("error",function(n){i.destroyed||(t=!1,i.destroy(n))}),r.once("close",function(){i.destroyed||i.push(null)}),i._destroy=function(s,n){if(r.readyState===r.CLOSED){n(s),process.nextTick(We,i);return}let o=!1;r.once("error",function(f){o=!0,n(f)}),r.once("close",function(){o||n(s),process.nextTick(We,i)}),t&&r.terminate()},i._final=function(s){if(r.readyState===r.CONNECTING){r.once("open",function(){i._final(s)});return}r._socket!==null&&(r._socket._writableState.finished?(s(),i._readableState.endEmitted&&i.destroy()):(r._socket.once("finish",function(){s()}),r.close()))},i._read=function(){r.isPaused&&r.resume()},i._write=function(s,n,o){if(r.readyState===r.CONNECTING){r.once("open",function(){i._write(s,n,o)});return}r.send(s,o)},i.on("end",$t),i.on("error",Fe),i}qe.exports=jt});var P=b((ns,Ve)=>{"use strict";d();Ve.exports={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var $=b((as,re)=>{"use strict";d();var{EMPTY_BUFFER:Ht}=P(),me=Buffer[Symbol.species];function zt(r,e){if(r.length===0)return Ht;if(r.length===1)return r[0];let t=Buffer.allocUnsafe(e),i=0;for(let s=0;s<r.length;s++){let n=r[s];t.set(n,i),i+=n.length}return i<e?new me(t.buffer,t.byteOffset,i):t}function $e(r,e,t,i,s){for(let n=0;n<s;n++)t[i+n]=r[n]^e[n&3]}function je(r,e){for(let t=0;t<r.length;t++)r[t]^=e[t&3]}function Yt(r){return r.length===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.length)}function ge(r){if(ge.readOnly=!0,Buffer.isBuffer(r))return r;let e;return r instanceof ArrayBuffer?e=new me(r):ArrayBuffer.isView(r)?e=new me(r.buffer,r.byteOffset,r.byteLength):(e=Buffer.from(r),ge.readOnly=!1),e}re.exports={concat:zt,mask:$e,toArrayBuffer:Yt,toBuffer:ge,unmask:je};if(!process.env.WS_NO_BUFFER_UTIL)try{let r=m("bufferutil");re.exports.mask=function(e,t,i,s,n){n<48?$e(e,t,i,s,n):r.mask(e,t,i,s,n)},re.exports.unmask=function(e,t){e.length<32?je(e,t):r.unmask(e,t)}}catch{}});var Ye=b((fs,ze)=>{"use strict";d();var He=Symbol("kDone"),ye=Symbol("kRun"),xe=class{constructor(e){this[He]=()=>{this.pending--,this[ye]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[ye]()}[ye](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[He])}}};ze.exports=xe});var z=b((cs,Qe)=>{"use strict";d();var j=m("zlib"),Ke=$(),Kt=Ye(),{kStatusCode:Xe}=P(),Xt=Buffer[Symbol.species],Zt=Buffer.from([0,0,255,255]),ne=Symbol("permessage-deflate"),C=Symbol("total-length"),H=Symbol("callback"),R=Symbol("buffers"),ie=Symbol("error"),se,Se=class{constructor(e,t,i){if(this._maxPayload=i|0,this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!t,this._deflate=null,this._inflate=null,this.params=null,!se){let s=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;se=new Kt(s)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[H];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let t=this._options,i=e.find(s=>!(t.serverNoContextTakeover===!1&&s.server_no_context_takeover||s.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits=="number"&&t.serverMaxWindowBits>s.server_max_window_bits)||typeof t.clientMaxWindowBits=="number"&&!s.client_max_window_bits));if(!i)throw new Error("None of the extension offers can be accepted");return t.serverNoContextTakeover&&(i.server_no_context_takeover=!0),t.clientNoContextTakeover&&(i.client_no_context_takeover=!0),typeof t.serverMaxWindowBits=="number"&&(i.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits=="number"?i.client_max_window_bits=t.clientMaxWindowBits:(i.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete i.client_max_window_bits,i}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return t}normalizeParams(e){return e.forEach(t=>{Object.keys(t).forEach(i=>{let s=t[i];if(s.length>1)throw new Error(`Parameter "${i}" must have only a single value`);if(s=s[0],i==="client_max_window_bits"){if(s!==!0){let n=+s;if(!Number.isInteger(n)||n<8||n>15)throw new TypeError(`Invalid value for parameter "${i}": ${s}`);s=n}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${i}": ${s}`)}else if(i==="server_max_window_bits"){let n=+s;if(!Number.isInteger(n)||n<8||n>15)throw new TypeError(`Invalid value for parameter "${i}": ${s}`);s=n}else if(i==="client_no_context_takeover"||i==="server_no_context_takeover"){if(s!==!0)throw new TypeError(`Invalid value for parameter "${i}": ${s}`)}else throw new Error(`Unknown parameter "${i}"`);t[i]=s})}),e}decompress(e,t,i){se.add(s=>{this._decompress(e,t,(n,o)=>{s(),i(n,o)})})}compress(e,t,i){se.add(s=>{this._compress(e,t,(n,o)=>{s(),i(n,o)})})}_decompress(e,t,i){let s=this._isServer?"client":"server";if(!this._inflate){let n=`${s}_max_window_bits`,o=typeof this.params[n]!="number"?j.Z_DEFAULT_WINDOWBITS:this.params[n];this._inflate=j.createInflateRaw({...this._options.zlibInflateOptions,windowBits:o}),this._inflate[ne]=this,this._inflate[C]=0,this._inflate[R]=[],this._inflate.on("error",Jt),this._inflate.on("data",Ze)}this._inflate[H]=i,this._inflate.write(e),t&&this._inflate.write(Zt),this._inflate.flush(()=>{let n=this._inflate[ie];if(n){this._inflate.close(),this._inflate=null,i(n);return}let o=Ke.concat(this._inflate[R],this._inflate[C]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[C]=0,this._inflate[R]=[],t&&this.params[`${s}_no_context_takeover`]&&this._inflate.reset()),i(null,o)})}_compress(e,t,i){let s=this._isServer?"server":"client";if(!this._deflate){let n=`${s}_max_window_bits`,o=typeof this.params[n]!="number"?j.Z_DEFAULT_WINDOWBITS:this.params[n];this._deflate=j.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:o}),this._deflate[C]=0,this._deflate[R]=[],this._deflate.on("data",Qt)}this._deflate[H]=i,this._deflate.write(e),this._deflate.flush(j.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let n=Ke.concat(this._deflate[R],this._deflate[C]);t&&(n=new Xt(n.buffer,n.byteOffset,n.length-4)),this._deflate[H]=null,this._deflate[C]=0,this._deflate[R]=[],t&&this.params[`${s}_no_context_takeover`]&&this._deflate.reset(),i(null,n)})}};Qe.exports=Se;function Qt(r){this[R].push(r),this[C]+=r.length}function Ze(r){if(this[C]+=r.length,this[ne]._maxPayload<1||this[C]<=this[ne]._maxPayload){this[R].push(r);return}this[ie]=new RangeError("Max payload size exceeded"),this[ie].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[ie][Xe]=1009,this.removeListener("data",Ze),this.reset()}function Jt(r){this[ne]._inflate=null,r[Xe]=1007,this[H](r)}});var Y=b((ds,oe)=>{"use strict";d();var{isUtf8:Je}=m("buffer"),er=[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];function tr(r){return r>=1e3&&r<=1014&&r!==1004&&r!==1005&&r!==1006||r>=3e3&&r<=4999}function Ee(r){let e=r.length,t=0;for(;t<e;)if(!(r[t]&128))t++;else if((r[t]&224)===192){if(t+1===e||(r[t+1]&192)!==128||(r[t]&254)===192)return!1;t+=2}else if((r[t]&240)===224){if(t+2>=e||(r[t+1]&192)!==128||(r[t+2]&192)!==128||r[t]===224&&(r[t+1]&224)===128||r[t]===237&&(r[t+1]&224)===160)return!1;t+=3}else if((r[t]&248)===240){if(t+3>=e||(r[t+1]&192)!==128||(r[t+2]&192)!==128||(r[t+3]&192)!==128||r[t]===240&&(r[t+1]&240)===128||r[t]===244&&r[t+1]>143||r[t]>244)return!1;t+=4}else return!1;return!0}oe.exports={isValidStatusCode:tr,isValidUTF8:Ee,tokenChars:er};if(Je)oe.exports.isValidUTF8=function(r){return r.length<24?Ee(r):Je(r)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let r=m("utf-8-validate");oe.exports.isValidUTF8=function(e){return e.length<32?Ee(e):r(e)}}catch{}});var ke=b((ps,ot)=>{"use strict";d();var{Writable:rr}=m("stream"),et=z(),{BINARY_TYPES:sr,EMPTY_BUFFER:tt,kStatusCode:ir,kWebSocket:nr}=P(),{concat:ve,toArrayBuffer:or,unmask:ar}=$(),{isValidStatusCode:lr,isValidUTF8:rt}=Y(),ae=Buffer[Symbol.species],O=0,st=1,it=2,nt=3,be=4,we=5,le=6,Oe=class extends rr{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||sr[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[nr]=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=O}_write(e,t,i){if(this._opcode===8&&this._state==O)return i();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(i)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let i=this._buffers[0];return this._buffers[0]=new ae(i.buffer,i.byteOffset+e,i.length-e),new ae(i.buffer,i.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let i=this._buffers[0],s=t.length-e;e>=i.length?t.set(this._buffers.shift(),s):(t.set(new Uint8Array(i.buffer,i.byteOffset,e),s),this._buffers[0]=new ae(i.buffer,i.byteOffset+e,i.length-e)),e-=i.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case O:this.getInfo(e);break;case st:this.getPayloadLength16(e);break;case it:this.getPayloadLength64(e);break;case nt:this.getMask();break;case be:this.getData(e);break;case we:case le:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if(t[0]&48){let s=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(s);return}let i=(t[0]&64)===64;if(i&&!this._extensions[et.extensionName]){let s=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(s);return}if(this._fin=(t[0]&128)===128,this._opcode=t[0]&15,this._payloadLength=t[1]&127,this._opcode===0){if(i){let s=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(s);return}if(!this._fragmented){let s=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(s);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let s=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(s);return}this._compressed=i}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let s=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(s);return}if(i){let s=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(s);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let s=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(s);return}}else{let s=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(s);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(t[1]&128)===128,this._isServer){if(!this._masked){let s=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(s);return}}else if(this._masked){let s=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(s);return}this._payloadLength===126?this._state=st:this._payloadLength===127?this._state=it:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),i=t.readUInt32BE(0);if(i>Math.pow(2,21)-1){let s=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(s);return}this._payloadLength=i*Math.pow(2,32)+t.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let t=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(t);return}this._masked?this._state=nt:this._state=be}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=be}getData(e){let t=tt;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3]&&ar(t,this._mask)}if(this._opcode>7){this.controlMessage(t,e);return}if(this._compressed){this._state=we,this.decompress(t,e);return}t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage(e)}decompress(e,t){this._extensions[et.extensionName].decompress(e,this._fin,(s,n)=>{if(s)return t(s);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let o=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(o);return}this._fragments.push(n)}this.dataMessage(t),this._state===O&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=O;return}let t=this._messageLength,i=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let s;this._binaryType==="nodebuffer"?s=ve(i,t):this._binaryType==="arraybuffer"?s=or(ve(i,t)):s=i,this._allowSynchronousEvents?(this.emit("message",s,!0),this._state=O):(this._state=le,setImmediate(()=>{this.emit("message",s,!0),this._state=O,this.startLoop(e)}))}else{let s=ve(i,t);if(!this._skipUTF8Validation&&!rt(s)){let n=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(n);return}this._state===we||this._allowSynchronousEvents?(this.emit("message",s,!1),this._state=O):(this._state=le,setImmediate(()=>{this.emit("message",s,!1),this._state=O,this.startLoop(e)}))}}controlMessage(e,t){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,tt),this.end();else{let i=e.readUInt16BE(0);if(!lr(i)){let n=this.createError(RangeError,`invalid status code ${i}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");t(n);return}let s=new ae(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!rt(s)){let n=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(n);return}this._loop=!1,this.emit("conclude",i,s),this.end()}this._state=O;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=O):(this._state=le,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=O,this.startLoop(t)}))}createError(e,t,i,s,n){this._loop=!1,this._errored=!0;let o=new e(i?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(o,this.createError),o.code=n,o[ir]=s,o}};ot.exports=Oe});var Ce=b((ys,ft)=>{"use strict";d();var{Duplex:gs}=m("stream"),{randomFillSync:fr}=m("crypto"),at=z(),{EMPTY_BUFFER:hr}=P(),{isValidStatusCode:cr}=Y(),{mask:lt,toBuffer:W}=$(),k=Symbol("kByteLength"),ur=Buffer.alloc(4),Te=class r{constructor(e,t,i){this._extensions=t||{},i&&(this._generateMask=i,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(e,t){let i,s=!1,n=2,o=!1;t.mask&&(i=t.maskBuffer||ur,t.generateMask?t.generateMask(i):fr(i,0,4),o=(i[0]|i[1]|i[2]|i[3])===0,n=6);let l;typeof e=="string"?(!t.mask||o)&&t[k]!==void 0?l=t[k]:(e=Buffer.from(e),l=e.length):(l=e.length,s=t.mask&&t.readOnly&&!o);let f=l;l>=65536?(n+=8,f=127):l>125&&(n+=2,f=126);let a=Buffer.allocUnsafe(s?l+n:n);return a[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(a[0]|=64),a[1]=f,f===126?a.writeUInt16BE(l,2):f===127&&(a[2]=a[3]=0,a.writeUIntBE(l,4,6)),t.mask?(a[1]|=128,a[n-4]=i[0],a[n-3]=i[1],a[n-2]=i[2],a[n-1]=i[3],o?[a,e]:s?(lt(e,i,a,n,l),[a]):(lt(e,i,e,0,l),[a,e])):[a,e]}close(e,t,i,s){let n;if(e===void 0)n=hr;else{if(typeof e!="number"||!cr(e))throw new TypeError("First argument must be a valid error code number");if(t===void 0||!t.length)n=Buffer.allocUnsafe(2),n.writeUInt16BE(e,0);else{let l=Buffer.byteLength(t);if(l>123)throw new RangeError("The message must not be greater than 123 bytes");n=Buffer.allocUnsafe(2+l),n.writeUInt16BE(e,0),typeof t=="string"?n.write(t,2):n.set(t,2)}}let o={[k]:n.length,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._deflating?this.enqueue([this.dispatch,n,!1,o,s]):this.sendFrame(r.frame(n,o),s)}ping(e,t,i){let s,n;if(typeof e=="string"?(s=Buffer.byteLength(e),n=!1):(e=W(e),s=e.length,n=W.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[k]:s,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:9,readOnly:n,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,i]):this.sendFrame(r.frame(e,o),i)}pong(e,t,i){let s,n;if(typeof e=="string"?(s=Buffer.byteLength(e),n=!1):(e=W(e),s=e.length,n=W.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[k]:s,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:10,readOnly:n,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,i]):this.sendFrame(r.frame(e,o),i)}send(e,t,i){let s=this._extensions[at.extensionName],n=t.binary?2:1,o=t.compress,l,f;if(typeof e=="string"?(l=Buffer.byteLength(e),f=!1):(e=W(e),l=e.length,f=W.readOnly),this._firstFragment?(this._firstFragment=!1,o&&s&&s.params[s._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(o=l>=s._threshold),this._compress=o):(o=!1,n=0),t.fin&&(this._firstFragment=!0),s){let a={[k]:l,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:f,rsv1:o};this._deflating?this.enqueue([this.dispatch,e,this._compress,a,i]):this.dispatch(e,this._compress,a,i)}else this.sendFrame(r.frame(e,{[k]:l,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:f,rsv1:!1}),i)}dispatch(e,t,i,s){if(!t){this.sendFrame(r.frame(e,i),s);return}let n=this._extensions[at.extensionName];this._bufferedBytes+=i[k],this._deflating=!0,n.compress(e,i.fin,(o,l)=>{if(this._socket.destroyed){let f=new Error("The socket was closed while data was being compressed");typeof s=="function"&&s(f);for(let a=0;a<this._queue.length;a++){let c=this._queue[a],h=c[c.length-1];typeof h=="function"&&h(f)}return}this._bufferedBytes-=i[k],this._deflating=!1,i.readOnly=!1,this.sendFrame(r.frame(l,i),s),this.dequeue()})}dequeue(){for(;!this._deflating&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][k],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][k],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};ft.exports=Te});var yt=b((Ss,gt)=>{"use strict";d();var{kForOnEventAttribute:K,kListener:Ne}=P(),ht=Symbol("kCode"),ct=Symbol("kData"),ut=Symbol("kError"),dt=Symbol("kMessage"),_t=Symbol("kReason"),F=Symbol("kTarget"),pt=Symbol("kType"),mt=Symbol("kWasClean"),N=class{constructor(e){this[F]=null,this[pt]=e}get target(){return this[F]}get type(){return this[pt]}};Object.defineProperty(N.prototype,"target",{enumerable:!0});Object.defineProperty(N.prototype,"type",{enumerable:!0});var B=class extends N{constructor(e,t={}){super(e),this[ht]=t.code===void 0?0:t.code,this[_t]=t.reason===void 0?"":t.reason,this[mt]=t.wasClean===void 0?!1:t.wasClean}get code(){return this[ht]}get reason(){return this[_t]}get wasClean(){return this[mt]}};Object.defineProperty(B.prototype,"code",{enumerable:!0});Object.defineProperty(B.prototype,"reason",{enumerable:!0});Object.defineProperty(B.prototype,"wasClean",{enumerable:!0});var q=class extends N{constructor(e,t={}){super(e),this[ut]=t.error===void 0?null:t.error,this[dt]=t.message===void 0?"":t.message}get error(){return this[ut]}get message(){return this[dt]}};Object.defineProperty(q.prototype,"error",{enumerable:!0});Object.defineProperty(q.prototype,"message",{enumerable:!0});var X=class extends N{constructor(e,t={}){super(e),this[ct]=t.data===void 0?null:t.data}get data(){return this[ct]}};Object.defineProperty(X.prototype,"data",{enumerable:!0});var dr={addEventListener(r,e,t={}){for(let s of this.listeners(r))if(!t[K]&&s[Ne]===e&&!s[K])return;let i;if(r==="message")i=function(n,o){let l=new X("message",{data:o?n:n.toString()});l[F]=this,fe(e,this,l)};else if(r==="close")i=function(n,o){let l=new B("close",{code:n,reason:o.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});l[F]=this,fe(e,this,l)};else if(r==="error")i=function(n){let o=new q("error",{error:n,message:n.message});o[F]=this,fe(e,this,o)};else if(r==="open")i=function(){let n=new N("open");n[F]=this,fe(e,this,n)};else return;i[K]=!!t[K],i[Ne]=e,t.once?this.once(r,i):this.on(r,i)},removeEventListener(r,e){for(let t of this.listeners(r))if(t[Ne]===e&&!t[K]){this.removeListener(r,t);break}}};gt.exports={CloseEvent:B,ErrorEvent:q,Event:N,EventTarget:dr,MessageEvent:X};function fe(r,e,t){typeof r=="object"&&r.handleEvent?r.handleEvent.call(r,t):r.call(e,t)}});var Le=b((vs,xt)=>{"use strict";d();var{tokenChars:Z}=Y();function T(r,e,t){r[e]===void 0?r[e]=[t]:r[e].push(t)}function _r(r){let e=Object.create(null),t=Object.create(null),i=!1,s=!1,n=!1,o,l,f=-1,a=-1,c=-1,h=0;for(;h<r.length;h++)if(a=r.charCodeAt(h),o===void 0)if(c===-1&&Z[a]===1)f===-1&&(f=h);else if(h!==0&&(a===32||a===9))c===-1&&f!==-1&&(c=h);else if(a===59||a===44){if(f===-1)throw new SyntaxError(`Unexpected character at index ${h}`);c===-1&&(c=h);let x=r.slice(f,c);a===44?(T(e,x,t),t=Object.create(null)):o=x,f=c=-1}else throw new SyntaxError(`Unexpected character at index ${h}`);else if(l===void 0)if(c===-1&&Z[a]===1)f===-1&&(f=h);else if(a===32||a===9)c===-1&&f!==-1&&(c=h);else if(a===59||a===44){if(f===-1)throw new SyntaxError(`Unexpected character at index ${h}`);c===-1&&(c=h),T(t,r.slice(f,c),!0),a===44&&(T(e,o,t),t=Object.create(null),o=void 0),f=c=-1}else if(a===61&&f!==-1&&c===-1)l=r.slice(f,h),f=c=-1;else throw new SyntaxError(`Unexpected character at index ${h}`);else if(s){if(Z[a]!==1)throw new SyntaxError(`Unexpected character at index ${h}`);f===-1?f=h:i||(i=!0),s=!1}else if(n)if(Z[a]===1)f===-1&&(f=h);else if(a===34&&f!==-1)n=!1,c=h;else if(a===92)s=!0;else throw new SyntaxError(`Unexpected character at index ${h}`);else if(a===34&&r.charCodeAt(h-1)===61)n=!0;else if(c===-1&&Z[a]===1)f===-1&&(f=h);else if(f!==-1&&(a===32||a===9))c===-1&&(c=h);else if(a===59||a===44){if(f===-1)throw new SyntaxError(`Unexpected character at index ${h}`);c===-1&&(c=h);let x=r.slice(f,c);i&&(x=x.replace(/\\/g,""),i=!1),T(t,l,x),a===44&&(T(e,o,t),t=Object.create(null),o=void 0),l=void 0,f=c=-1}else throw new SyntaxError(`Unexpected character at index ${h}`);if(f===-1||n||a===32||a===9)throw new SyntaxError("Unexpected end of input");c===-1&&(c=h);let g=r.slice(f,c);return o===void 0?T(e,g,t):(l===void 0?T(t,g,!0):i?T(t,l,g.replace(/\\/g,"")):T(t,l,g),T(e,o,t)),e}function pr(r){return Object.keys(r).map(e=>{let t=r[e];return Array.isArray(t)||(t=[t]),t.map(i=>[e].concat(Object.keys(i).map(s=>{let n=i[s];return Array.isArray(n)||(n=[n]),n.map(o=>o===!0?s:`${s}=${o}`).join("; ")})).join("; ")).join(", ")}).join(", ")}xt.exports={format:pr,parse:_r}});var Be=b((ks,Lt)=>{"use strict";d();var mr=m("events"),gr=m("https"),yr=m("http"),vt=m("net"),xr=m("tls"),{randomBytes:Sr,createHash:Er}=m("crypto"),{Duplex:ws,Readable:Os}=m("stream"),{URL:Pe}=m("url"),I=z(),vr=ke(),br=Ce(),{BINARY_TYPES:St,EMPTY_BUFFER:he,GUID:wr,kForOnEventAttribute:Re,kListener:Or,kStatusCode:kr,kWebSocket:y,NOOP:bt}=P(),{EventTarget:{addEventListener:Tr,removeEventListener:Cr}}=yt(),{format:Nr,parse:Lr}=Le(),{toBuffer:Pr}=$(),Rr=30*1e3,wt=Symbol("kAborted"),Ie=[8,13],L=["CONNECTING","OPEN","CLOSING","CLOSED"],Ir=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,_=class r extends mr{constructor(e,t,i){super(),this._binaryType=St[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=he,this._closeTimer=null,this._extensions={},this._paused=!1,this._protocol="",this._readyState=r.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,t===void 0?t=[]:Array.isArray(t)||(typeof t=="object"&&t!==null?(i=t,t=[]):t=[t]),Ot(this,e,t,i)):(this._autoPong=i.autoPong,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){St.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}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(e,t,i){let s=new vr({allowSynchronousEvents:i.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation});this._sender=new br(e,this._extensions,i.generateMask),this._receiver=s,this._socket=e,s[y]=this,e[y]=this,s.on("conclude",Dr),s.on("drain",Mr),s.on("error",Ar),s.on("message",Wr),s.on("ping",Fr),s.on("pong",qr),e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",Tt),e.on("data",ue),e.on("end",Ct),e.on("error",Nt),this._readyState=r.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[I.extensionName]&&this._extensions[I.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){let i="WebSocket was closed before the connection was established";w(this,this._req,i);return}if(this.readyState===r.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=r.CLOSING,this._sender.close(e,t,!this._isServer,i=>{i||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),Rr)}}pause(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,t,i){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(i=e,e=t=void 0):typeof t=="function"&&(i=t,t=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Ue(this,e,i);return}t===void 0&&(t=!this._isServer),this._sender.ping(e||he,t,i)}pong(e,t,i){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(i=e,e=t=void 0):typeof t=="function"&&(i=t,t=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Ue(this,e,i);return}t===void 0&&(t=!this._isServer),this._sender.pong(e||he,t,i)}resume(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,t,i){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"&&(i=t,t={}),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Ue(this,e,i);return}let s={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...t};this._extensions[I.extensionName]||(s.compress=!1),this._sender.send(e||he,s,i)}terminate(){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){let e="WebSocket was closed before the connection was established";w(this,this._req,e);return}this._socket&&(this._readyState=r.CLOSING,this._socket.destroy())}}};Object.defineProperty(_,"CONNECTING",{enumerable:!0,value:L.indexOf("CONNECTING")});Object.defineProperty(_.prototype,"CONNECTING",{enumerable:!0,value:L.indexOf("CONNECTING")});Object.defineProperty(_,"OPEN",{enumerable:!0,value:L.indexOf("OPEN")});Object.defineProperty(_.prototype,"OPEN",{enumerable:!0,value:L.indexOf("OPEN")});Object.defineProperty(_,"CLOSING",{enumerable:!0,value:L.indexOf("CLOSING")});Object.defineProperty(_.prototype,"CLOSING",{enumerable:!0,value:L.indexOf("CLOSING")});Object.defineProperty(_,"CLOSED",{enumerable:!0,value:L.indexOf("CLOSED")});Object.defineProperty(_.prototype,"CLOSED",{enumerable:!0,value:L.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(r=>{Object.defineProperty(_.prototype,r,{enumerable:!0})});["open","error","close","message"].forEach(r=>{Object.defineProperty(_.prototype,`on${r}`,{enumerable:!0,get(){for(let e of this.listeners(r))if(e[Re])return e[Or];return null},set(e){for(let t of this.listeners(r))if(t[Re]){this.removeListener(r,t);break}typeof e=="function"&&this.addEventListener(r,e,{[Re]:!0})}})});_.prototype.addEventListener=Tr;_.prototype.removeEventListener=Cr;Lt.exports=_;function Ot(r,e,t,i){let s={allowSynchronousEvents:!0,autoPong:!0,protocolVersion:Ie[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...i,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(r._autoPong=s.autoPong,!Ie.includes(s.protocolVersion))throw new RangeError(`Unsupported protocol version: ${s.protocolVersion} (supported versions: ${Ie.join(", ")})`);let n;if(e instanceof Pe)n=e;else try{n=new Pe(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}n.protocol==="http:"?n.protocol="ws:":n.protocol==="https:"&&(n.protocol="wss:"),r._url=n.href;let o=n.protocol==="wss:",l=n.protocol==="ws+unix:",f;if(n.protocol!=="ws:"&&!o&&!l?f=`The URL's protocol must be one of "ws:", "wss:", "http:", "https", or "ws+unix:"`:l&&!n.pathname?f="The URL's pathname is empty":n.hash&&(f="The URL contains a fragment identifier"),f){let u=new SyntaxError(f);if(r._redirects===0)throw u;ce(r,u);return}let a=o?443:80,c=Sr(16).toString("base64"),h=o?gr.request:yr.request,g=new Set,x;if(s.createConnection=s.createConnection||(o?Br:Ur),s.defaultPort=s.defaultPort||a,s.port=n.port||a,s.host=n.hostname.startsWith("[")?n.hostname.slice(1,-1):n.hostname,s.headers={...s.headers,"Sec-WebSocket-Version":s.protocolVersion,"Sec-WebSocket-Key":c,Connection:"Upgrade",Upgrade:"websocket"},s.path=n.pathname+n.search,s.timeout=s.handshakeTimeout,s.perMessageDeflate&&(x=new I(s.perMessageDeflate!==!0?s.perMessageDeflate:{},!1,s.maxPayload),s.headers["Sec-WebSocket-Extensions"]=Nr({[I.extensionName]:x.offer()})),t.length){for(let u of t){if(typeof u!="string"||!Ir.test(u)||g.has(u))throw new SyntaxError("An invalid or duplicated subprotocol was specified");g.add(u)}s.headers["Sec-WebSocket-Protocol"]=t.join(",")}if(s.origin&&(s.protocolVersion<13?s.headers["Sec-WebSocket-Origin"]=s.origin:s.headers.Origin=s.origin),(n.username||n.password)&&(s.auth=`${n.username}:${n.password}`),l){let u=s.path.split(":");s.socketPath=u[0],s.path=u[1]}let p;if(s.followRedirects){if(r._redirects===0){r._originalIpc=l,r._originalSecure=o,r._originalHostOrSocketPath=l?s.socketPath:n.host;let u=i&&i.headers;if(i={...i,headers:{}},u)for(let[v,A]of Object.entries(u))i.headers[v.toLowerCase()]=A}else if(r.listenerCount("redirect")===0){let u=l?r._originalIpc?s.socketPath===r._originalHostOrSocketPath:!1:r._originalIpc?!1:n.host===r._originalHostOrSocketPath;(!u||r._originalSecure&&!o)&&(delete s.headers.authorization,delete s.headers.cookie,u||delete s.headers.host,s.auth=void 0)}s.auth&&!i.headers.authorization&&(i.headers.authorization="Basic "+Buffer.from(s.auth).toString("base64")),p=r._req=h(s),r._redirects&&r.emit("redirect",r.url,p)}else p=r._req=h(s);s.timeout&&p.on("timeout",()=>{w(r,p,"Opening handshake has timed out")}),p.on("error",u=>{p===null||p[wt]||(p=r._req=null,ce(r,u))}),p.on("response",u=>{let v=u.headers.location,A=u.statusCode;if(v&&s.followRedirects&&A>=300&&A<400){if(++r._redirects>s.maxRedirects){w(r,p,"Maximum redirects exceeded");return}p.abort();let te;try{te=new Pe(v,e)}catch{let U=new SyntaxError(`Invalid URL: ${v}`);ce(r,U);return}Ot(r,te,t,i)}else r.emit("unexpected-response",p,u)||w(r,p,`Unexpected server response: ${u.statusCode}`)}),p.on("upgrade",(u,v,A)=>{if(r.emit("upgrade",u),r.readyState!==_.CONNECTING)return;if(p=r._req=null,u.headers.upgrade.toLowerCase()!=="websocket"){w(r,v,"Invalid Upgrade header");return}let te=Er("sha1").update(c+wr).digest("base64");if(u.headers["sec-websocket-accept"]!==te){w(r,v,"Invalid Sec-WebSocket-Accept header");return}let G=u.headers["sec-websocket-protocol"],U;if(G!==void 0?g.size?g.has(G)||(U="Server sent an invalid subprotocol"):U="Server sent a subprotocol but none was requested":g.size&&(U="Server sent no subprotocol"),U){w(r,v,U);return}G&&(r._protocol=G);let Me=u.headers["sec-websocket-extensions"];if(Me!==void 0){if(!x){w(r,v,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let _e;try{_e=Lr(Me)}catch{w(r,v,"Invalid Sec-WebSocket-Extensions header");return}let Ae=Object.keys(_e);if(Ae.length!==1||Ae[0]!==I.extensionName){w(r,v,"Server indicated an extension that was not requested");return}try{x.accept(_e[I.extensionName])}catch{w(r,v,"Invalid Sec-WebSocket-Extensions header");return}r._extensions[I.extensionName]=x}r.setSocket(v,A,{allowSynchronousEvents:s.allowSynchronousEvents,generateMask:s.generateMask,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation})}),s.finishRequest?s.finishRequest(p,r):p.end()}function ce(r,e){r._readyState=_.CLOSING,r.emit("error",e),r.emitClose()}function Ur(r){return r.path=r.socketPath,vt.connect(r)}function Br(r){return r.path=void 0,!r.servername&&r.servername!==""&&(r.servername=vt.isIP(r.host)?"":r.host),xr.connect(r)}function w(r,e,t){r._readyState=_.CLOSING;let i=new Error(t);Error.captureStackTrace(i,w),e.setHeader?(e[wt]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(ce,r,i)):(e.destroy(i),e.once("error",r.emit.bind(r,"error")),e.once("close",r.emitClose.bind(r)))}function Ue(r,e,t){if(e){let i=Pr(e).length;r._socket?r._sender._bufferedBytes+=i:r._bufferedAmount+=i}if(t){let i=new Error(`WebSocket is not open: readyState ${r.readyState} (${L[r.readyState]})`);process.nextTick(t,i)}}function Dr(r,e){let t=this[y];t._closeFrameReceived=!0,t._closeMessage=e,t._closeCode=r,t._socket[y]!==void 0&&(t._socket.removeListener("data",ue),process.nextTick(kt,t._socket),r===1005?t.close():t.close(r,e))}function Mr(){let r=this[y];r.isPaused||r._socket.resume()}function Ar(r){let e=this[y];e._socket[y]!==void 0&&(e._socket.removeListener("data",ue),process.nextTick(kt,e._socket),e.close(r[kr])),e.emit("error",r)}function Et(){this[y].emitClose()}function Wr(r,e){this[y].emit("message",r,e)}function Fr(r){let e=this[y];e._autoPong&&e.pong(r,!this._isServer,bt),e.emit("ping",r)}function qr(r){this[y].emit("pong",r)}function kt(r){r.resume()}function Tt(){let r=this[y];this.removeListener("close",Tt),this.removeListener("data",ue),this.removeListener("end",Ct),r._readyState=_.CLOSING;let e;!this._readableState.endEmitted&&!r._closeFrameReceived&&!r._receiver._writableState.errorEmitted&&(e=r._socket.read())!==null&&r._receiver.write(e),r._receiver.end(),this[y]=void 0,clearTimeout(r._closeTimer),r._receiver._writableState.finished||r._receiver._writableState.errorEmitted?r.emitClose():(r._receiver.on("error",Et),r._receiver.on("finish",Et))}function ue(r){this[y]._receiver.write(r)||this.pause()}function Ct(){let r=this[y];r._readyState=_.CLOSING,r._receiver.end(),this.end()}function Nt(){let r=this[y];this.removeListener("error",Nt),this.on("error",bt),r&&(r._readyState=_.CLOSING,this.destroy())}});var Rt=b((Cs,Pt)=>{"use strict";d();var{tokenChars:Gr}=Y();function Vr(r){let e=new Set,t=-1,i=-1,s=0;for(s;s<r.length;s++){let o=r.charCodeAt(s);if(i===-1&&Gr[o]===1)t===-1&&(t=s);else if(s!==0&&(o===32||o===9))i===-1&&t!==-1&&(i=s);else if(o===44){if(t===-1)throw new SyntaxError(`Unexpected character at index ${s}`);i===-1&&(i=s);let l=r.slice(t,i);if(e.has(l))throw new SyntaxError(`The "${l}" subprotocol is duplicated`);e.add(l),t=i=-1}else throw new SyntaxError(`Unexpected character at index ${s}`)}if(t===-1||i!==-1)throw new SyntaxError("Unexpected end of input");let n=r.slice(t,s);if(e.has(n))throw new SyntaxError(`The "${n}" subprotocol is duplicated`);return e.add(n),e}Pt.exports={parse:Vr}});var Wt=b((Ps,At)=>{"use strict";d();var $r=m("events"),de=m("http"),{Duplex:Ls}=m("stream"),{createHash:jr}=m("crypto"),It=Le(),D=z(),Hr=Rt(),zr=Be(),{GUID:Yr,kWebSocket:Kr}=P(),Xr=/^[+/0-9A-Za-z]{22}==$/,Ut=0,Bt=1,Mt=2,De=class extends $r{constructor(e,t){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:zr,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=de.createServer((i,s)=>{let n=de.STATUS_CODES[426];s.writeHead(426,{"Content-Length":n.length,"Content-Type":"text/plain"}),s.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)):e.server&&(this._server=e.server),this._server){let i=this.emit.bind(this,"connection");this._removeListeners=Zr(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(s,n,o)=>{this.handleUpgrade(s,n,o,i)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=Ut}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===Mt){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(Q,this);return}if(e&&this.once("close",e),this._state!==Bt)if(this._state=Bt,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(Q,this):process.nextTick(Q,this);else{let t=this._server;this._removeListeners(),this._removeListeners=this._server=null,t.close(()=>{Q(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf("?");if((t!==-1?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,i,s){t.on("error",Dt);let n=e.headers["sec-websocket-key"],o=+e.headers["sec-websocket-version"];if(e.method!=="GET"){M(this,e,t,405,"Invalid HTTP method");return}if(e.headers.upgrade.toLowerCase()!=="websocket"){M(this,e,t,400,"Invalid Upgrade header");return}if(!n||!Xr.test(n)){M(this,e,t,400,"Missing or invalid Sec-WebSocket-Key header");return}if(o!==8&&o!==13){M(this,e,t,400,"Missing or invalid Sec-WebSocket-Version header");return}if(!this.shouldHandle(e)){J(t,400);return}let l=e.headers["sec-websocket-protocol"],f=new Set;if(l!==void 0)try{f=Hr.parse(l)}catch{M(this,e,t,400,"Invalid Sec-WebSocket-Protocol header");return}let a=e.headers["sec-websocket-extensions"],c={};if(this.options.perMessageDeflate&&a!==void 0){let h=new D(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let g=It.parse(a);g[D.extensionName]&&(h.accept(g[D.extensionName]),c[D.extensionName]=h)}catch{M(this,e,t,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let h={origin:e.headers[`${o===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(h,(g,x,p,u)=>{if(!g)return J(t,x||401,p,u);this.completeUpgrade(c,n,f,e,t,i,s)});return}if(!this.options.verifyClient(h))return J(t,401)}this.completeUpgrade(c,n,f,e,t,i,s)}completeUpgrade(e,t,i,s,n,o,l){if(!n.readable||!n.writable)return n.destroy();if(n[Kr])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Ut)return J(n,503);let a=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${jr("sha1").update(t+Yr).digest("base64")}`],c=new this.options.WebSocket(null,void 0,this.options);if(i.size){let h=this.options.handleProtocols?this.options.handleProtocols(i,s):i.values().next().value;h&&(a.push(`Sec-WebSocket-Protocol: ${h}`),c._protocol=h)}if(e[D.extensionName]){let h=e[D.extensionName].params,g=It.format({[D.extensionName]:[h]});a.push(`Sec-WebSocket-Extensions: ${g}`),c._extensions=e}this.emit("headers",a,s),n.write(a.concat(`\r
3
+ import{a as m,c as b,e as V,h as d}from"./chunk-V4TR6DCM.js";var Ge=b((ss,qe)=>{"use strict";d();var{Duplex:Vt}=m("stream");function We(r){r.emit("close")}function $t(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Fe(r){this.removeListener("error",Fe),this.destroy(),this.listenerCount("error")===0&&this.emit("error",r)}function jt(r,e){let t=!0,i=new Vt({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return r.on("message",function(n,o){let l=!o&&i._readableState.objectMode?n.toString():n;i.push(l)||r.pause()}),r.once("error",function(n){i.destroyed||(t=!1,i.destroy(n))}),r.once("close",function(){i.destroyed||i.push(null)}),i._destroy=function(s,n){if(r.readyState===r.CLOSED){n(s),process.nextTick(We,i);return}let o=!1;r.once("error",function(f){o=!0,n(f)}),r.once("close",function(){o||n(s),process.nextTick(We,i)}),t&&r.terminate()},i._final=function(s){if(r.readyState===r.CONNECTING){r.once("open",function(){i._final(s)});return}r._socket!==null&&(r._socket._writableState.finished?(s(),i._readableState.endEmitted&&i.destroy()):(r._socket.once("finish",function(){s()}),r.close()))},i._read=function(){r.isPaused&&r.resume()},i._write=function(s,n,o){if(r.readyState===r.CONNECTING){r.once("open",function(){i._write(s,n,o)});return}r.send(s,o)},i.on("end",$t),i.on("error",Fe),i}qe.exports=jt});var P=b((ns,Ve)=>{"use strict";d();Ve.exports={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var $=b((as,re)=>{"use strict";d();var{EMPTY_BUFFER:Ht}=P(),me=Buffer[Symbol.species];function zt(r,e){if(r.length===0)return Ht;if(r.length===1)return r[0];let t=Buffer.allocUnsafe(e),i=0;for(let s=0;s<r.length;s++){let n=r[s];t.set(n,i),i+=n.length}return i<e?new me(t.buffer,t.byteOffset,i):t}function $e(r,e,t,i,s){for(let n=0;n<s;n++)t[i+n]=r[n]^e[n&3]}function je(r,e){for(let t=0;t<r.length;t++)r[t]^=e[t&3]}function Yt(r){return r.length===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.length)}function ge(r){if(ge.readOnly=!0,Buffer.isBuffer(r))return r;let e;return r instanceof ArrayBuffer?e=new me(r):ArrayBuffer.isView(r)?e=new me(r.buffer,r.byteOffset,r.byteLength):(e=Buffer.from(r),ge.readOnly=!1),e}re.exports={concat:zt,mask:$e,toArrayBuffer:Yt,toBuffer:ge,unmask:je};if(!process.env.WS_NO_BUFFER_UTIL)try{let r=m("bufferutil");re.exports.mask=function(e,t,i,s,n){n<48?$e(e,t,i,s,n):r.mask(e,t,i,s,n)},re.exports.unmask=function(e,t){e.length<32?je(e,t):r.unmask(e,t)}}catch{}});var Ye=b((fs,ze)=>{"use strict";d();var He=Symbol("kDone"),ye=Symbol("kRun"),xe=class{constructor(e){this[He]=()=>{this.pending--,this[ye]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[ye]()}[ye](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[He])}}};ze.exports=xe});var z=b((cs,Qe)=>{"use strict";d();var j=m("zlib"),Ke=$(),Kt=Ye(),{kStatusCode:Xe}=P(),Xt=Buffer[Symbol.species],Zt=Buffer.from([0,0,255,255]),ne=Symbol("permessage-deflate"),C=Symbol("total-length"),H=Symbol("callback"),R=Symbol("buffers"),ie=Symbol("error"),se,Se=class{constructor(e,t,i){if(this._maxPayload=i|0,this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!t,this._deflate=null,this._inflate=null,this.params=null,!se){let s=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;se=new Kt(s)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[H];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let t=this._options,i=e.find(s=>!(t.serverNoContextTakeover===!1&&s.server_no_context_takeover||s.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits=="number"&&t.serverMaxWindowBits>s.server_max_window_bits)||typeof t.clientMaxWindowBits=="number"&&!s.client_max_window_bits));if(!i)throw new Error("None of the extension offers can be accepted");return t.serverNoContextTakeover&&(i.server_no_context_takeover=!0),t.clientNoContextTakeover&&(i.client_no_context_takeover=!0),typeof t.serverMaxWindowBits=="number"&&(i.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits=="number"?i.client_max_window_bits=t.clientMaxWindowBits:(i.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete i.client_max_window_bits,i}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return t}normalizeParams(e){return e.forEach(t=>{Object.keys(t).forEach(i=>{let s=t[i];if(s.length>1)throw new Error(`Parameter "${i}" must have only a single value`);if(s=s[0],i==="client_max_window_bits"){if(s!==!0){let n=+s;if(!Number.isInteger(n)||n<8||n>15)throw new TypeError(`Invalid value for parameter "${i}": ${s}`);s=n}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${i}": ${s}`)}else if(i==="server_max_window_bits"){let n=+s;if(!Number.isInteger(n)||n<8||n>15)throw new TypeError(`Invalid value for parameter "${i}": ${s}`);s=n}else if(i==="client_no_context_takeover"||i==="server_no_context_takeover"){if(s!==!0)throw new TypeError(`Invalid value for parameter "${i}": ${s}`)}else throw new Error(`Unknown parameter "${i}"`);t[i]=s})}),e}decompress(e,t,i){se.add(s=>{this._decompress(e,t,(n,o)=>{s(),i(n,o)})})}compress(e,t,i){se.add(s=>{this._compress(e,t,(n,o)=>{s(),i(n,o)})})}_decompress(e,t,i){let s=this._isServer?"client":"server";if(!this._inflate){let n=`${s}_max_window_bits`,o=typeof this.params[n]!="number"?j.Z_DEFAULT_WINDOWBITS:this.params[n];this._inflate=j.createInflateRaw({...this._options.zlibInflateOptions,windowBits:o}),this._inflate[ne]=this,this._inflate[C]=0,this._inflate[R]=[],this._inflate.on("error",Jt),this._inflate.on("data",Ze)}this._inflate[H]=i,this._inflate.write(e),t&&this._inflate.write(Zt),this._inflate.flush(()=>{let n=this._inflate[ie];if(n){this._inflate.close(),this._inflate=null,i(n);return}let o=Ke.concat(this._inflate[R],this._inflate[C]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[C]=0,this._inflate[R]=[],t&&this.params[`${s}_no_context_takeover`]&&this._inflate.reset()),i(null,o)})}_compress(e,t,i){let s=this._isServer?"server":"client";if(!this._deflate){let n=`${s}_max_window_bits`,o=typeof this.params[n]!="number"?j.Z_DEFAULT_WINDOWBITS:this.params[n];this._deflate=j.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:o}),this._deflate[C]=0,this._deflate[R]=[],this._deflate.on("data",Qt)}this._deflate[H]=i,this._deflate.write(e),this._deflate.flush(j.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let n=Ke.concat(this._deflate[R],this._deflate[C]);t&&(n=new Xt(n.buffer,n.byteOffset,n.length-4)),this._deflate[H]=null,this._deflate[C]=0,this._deflate[R]=[],t&&this.params[`${s}_no_context_takeover`]&&this._deflate.reset(),i(null,n)})}};Qe.exports=Se;function Qt(r){this[R].push(r),this[C]+=r.length}function Ze(r){if(this[C]+=r.length,this[ne]._maxPayload<1||this[C]<=this[ne]._maxPayload){this[R].push(r);return}this[ie]=new RangeError("Max payload size exceeded"),this[ie].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[ie][Xe]=1009,this.removeListener("data",Ze),this.reset()}function Jt(r){this[ne]._inflate=null,r[Xe]=1007,this[H](r)}});var Y=b((ds,oe)=>{"use strict";d();var{isUtf8:Je}=m("buffer"),er=[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];function tr(r){return r>=1e3&&r<=1014&&r!==1004&&r!==1005&&r!==1006||r>=3e3&&r<=4999}function Ee(r){let e=r.length,t=0;for(;t<e;)if(!(r[t]&128))t++;else if((r[t]&224)===192){if(t+1===e||(r[t+1]&192)!==128||(r[t]&254)===192)return!1;t+=2}else if((r[t]&240)===224){if(t+2>=e||(r[t+1]&192)!==128||(r[t+2]&192)!==128||r[t]===224&&(r[t+1]&224)===128||r[t]===237&&(r[t+1]&224)===160)return!1;t+=3}else if((r[t]&248)===240){if(t+3>=e||(r[t+1]&192)!==128||(r[t+2]&192)!==128||(r[t+3]&192)!==128||r[t]===240&&(r[t+1]&240)===128||r[t]===244&&r[t+1]>143||r[t]>244)return!1;t+=4}else return!1;return!0}oe.exports={isValidStatusCode:tr,isValidUTF8:Ee,tokenChars:er};if(Je)oe.exports.isValidUTF8=function(r){return r.length<24?Ee(r):Je(r)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let r=m("utf-8-validate");oe.exports.isValidUTF8=function(e){return e.length<32?Ee(e):r(e)}}catch{}});var ke=b((ps,ot)=>{"use strict";d();var{Writable:rr}=m("stream"),et=z(),{BINARY_TYPES:sr,EMPTY_BUFFER:tt,kStatusCode:ir,kWebSocket:nr}=P(),{concat:ve,toArrayBuffer:or,unmask:ar}=$(),{isValidStatusCode:lr,isValidUTF8:rt}=Y(),ae=Buffer[Symbol.species],O=0,st=1,it=2,nt=3,be=4,we=5,le=6,Oe=class extends rr{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||sr[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[nr]=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=O}_write(e,t,i){if(this._opcode===8&&this._state==O)return i();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(i)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let i=this._buffers[0];return this._buffers[0]=new ae(i.buffer,i.byteOffset+e,i.length-e),new ae(i.buffer,i.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let i=this._buffers[0],s=t.length-e;e>=i.length?t.set(this._buffers.shift(),s):(t.set(new Uint8Array(i.buffer,i.byteOffset,e),s),this._buffers[0]=new ae(i.buffer,i.byteOffset+e,i.length-e)),e-=i.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case O:this.getInfo(e);break;case st:this.getPayloadLength16(e);break;case it:this.getPayloadLength64(e);break;case nt:this.getMask();break;case be:this.getData(e);break;case we:case le:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if(t[0]&48){let s=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(s);return}let i=(t[0]&64)===64;if(i&&!this._extensions[et.extensionName]){let s=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(s);return}if(this._fin=(t[0]&128)===128,this._opcode=t[0]&15,this._payloadLength=t[1]&127,this._opcode===0){if(i){let s=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(s);return}if(!this._fragmented){let s=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(s);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let s=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(s);return}this._compressed=i}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let s=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(s);return}if(i){let s=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(s);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let s=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(s);return}}else{let s=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(s);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(t[1]&128)===128,this._isServer){if(!this._masked){let s=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(s);return}}else if(this._masked){let s=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(s);return}this._payloadLength===126?this._state=st:this._payloadLength===127?this._state=it:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),i=t.readUInt32BE(0);if(i>Math.pow(2,21)-1){let s=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(s);return}this._payloadLength=i*Math.pow(2,32)+t.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let t=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(t);return}this._masked?this._state=nt:this._state=be}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=be}getData(e){let t=tt;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3]&&ar(t,this._mask)}if(this._opcode>7){this.controlMessage(t,e);return}if(this._compressed){this._state=we,this.decompress(t,e);return}t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage(e)}decompress(e,t){this._extensions[et.extensionName].decompress(e,this._fin,(s,n)=>{if(s)return t(s);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let o=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(o);return}this._fragments.push(n)}this.dataMessage(t),this._state===O&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=O;return}let t=this._messageLength,i=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let s;this._binaryType==="nodebuffer"?s=ve(i,t):this._binaryType==="arraybuffer"?s=or(ve(i,t)):s=i,this._allowSynchronousEvents?(this.emit("message",s,!0),this._state=O):(this._state=le,setImmediate(()=>{this.emit("message",s,!0),this._state=O,this.startLoop(e)}))}else{let s=ve(i,t);if(!this._skipUTF8Validation&&!rt(s)){let n=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(n);return}this._state===we||this._allowSynchronousEvents?(this.emit("message",s,!1),this._state=O):(this._state=le,setImmediate(()=>{this.emit("message",s,!1),this._state=O,this.startLoop(e)}))}}controlMessage(e,t){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,tt),this.end();else{let i=e.readUInt16BE(0);if(!lr(i)){let n=this.createError(RangeError,`invalid status code ${i}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");t(n);return}let s=new ae(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!rt(s)){let n=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(n);return}this._loop=!1,this.emit("conclude",i,s),this.end()}this._state=O;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=O):(this._state=le,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=O,this.startLoop(t)}))}createError(e,t,i,s,n){this._loop=!1,this._errored=!0;let o=new e(i?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(o,this.createError),o.code=n,o[ir]=s,o}};ot.exports=Oe});var Ce=b((ys,ft)=>{"use strict";d();var{Duplex:gs}=m("stream"),{randomFillSync:fr}=m("crypto"),at=z(),{EMPTY_BUFFER:hr}=P(),{isValidStatusCode:cr}=Y(),{mask:lt,toBuffer:W}=$(),k=Symbol("kByteLength"),ur=Buffer.alloc(4),Te=class r{constructor(e,t,i){this._extensions=t||{},i&&(this._generateMask=i,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(e,t){let i,s=!1,n=2,o=!1;t.mask&&(i=t.maskBuffer||ur,t.generateMask?t.generateMask(i):fr(i,0,4),o=(i[0]|i[1]|i[2]|i[3])===0,n=6);let l;typeof e=="string"?(!t.mask||o)&&t[k]!==void 0?l=t[k]:(e=Buffer.from(e),l=e.length):(l=e.length,s=t.mask&&t.readOnly&&!o);let f=l;l>=65536?(n+=8,f=127):l>125&&(n+=2,f=126);let a=Buffer.allocUnsafe(s?l+n:n);return a[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(a[0]|=64),a[1]=f,f===126?a.writeUInt16BE(l,2):f===127&&(a[2]=a[3]=0,a.writeUIntBE(l,4,6)),t.mask?(a[1]|=128,a[n-4]=i[0],a[n-3]=i[1],a[n-2]=i[2],a[n-1]=i[3],o?[a,e]:s?(lt(e,i,a,n,l),[a]):(lt(e,i,e,0,l),[a,e])):[a,e]}close(e,t,i,s){let n;if(e===void 0)n=hr;else{if(typeof e!="number"||!cr(e))throw new TypeError("First argument must be a valid error code number");if(t===void 0||!t.length)n=Buffer.allocUnsafe(2),n.writeUInt16BE(e,0);else{let l=Buffer.byteLength(t);if(l>123)throw new RangeError("The message must not be greater than 123 bytes");n=Buffer.allocUnsafe(2+l),n.writeUInt16BE(e,0),typeof t=="string"?n.write(t,2):n.set(t,2)}}let o={[k]:n.length,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._deflating?this.enqueue([this.dispatch,n,!1,o,s]):this.sendFrame(r.frame(n,o),s)}ping(e,t,i){let s,n;if(typeof e=="string"?(s=Buffer.byteLength(e),n=!1):(e=W(e),s=e.length,n=W.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[k]:s,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:9,readOnly:n,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,i]):this.sendFrame(r.frame(e,o),i)}pong(e,t,i){let s,n;if(typeof e=="string"?(s=Buffer.byteLength(e),n=!1):(e=W(e),s=e.length,n=W.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[k]:s,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:10,readOnly:n,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,i]):this.sendFrame(r.frame(e,o),i)}send(e,t,i){let s=this._extensions[at.extensionName],n=t.binary?2:1,o=t.compress,l,f;if(typeof e=="string"?(l=Buffer.byteLength(e),f=!1):(e=W(e),l=e.length,f=W.readOnly),this._firstFragment?(this._firstFragment=!1,o&&s&&s.params[s._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(o=l>=s._threshold),this._compress=o):(o=!1,n=0),t.fin&&(this._firstFragment=!0),s){let a={[k]:l,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:f,rsv1:o};this._deflating?this.enqueue([this.dispatch,e,this._compress,a,i]):this.dispatch(e,this._compress,a,i)}else this.sendFrame(r.frame(e,{[k]:l,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:f,rsv1:!1}),i)}dispatch(e,t,i,s){if(!t){this.sendFrame(r.frame(e,i),s);return}let n=this._extensions[at.extensionName];this._bufferedBytes+=i[k],this._deflating=!0,n.compress(e,i.fin,(o,l)=>{if(this._socket.destroyed){let f=new Error("The socket was closed while data was being compressed");typeof s=="function"&&s(f);for(let a=0;a<this._queue.length;a++){let c=this._queue[a],h=c[c.length-1];typeof h=="function"&&h(f)}return}this._bufferedBytes-=i[k],this._deflating=!1,i.readOnly=!1,this.sendFrame(r.frame(l,i),s),this.dequeue()})}dequeue(){for(;!this._deflating&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][k],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][k],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};ft.exports=Te});var yt=b((Ss,gt)=>{"use strict";d();var{kForOnEventAttribute:K,kListener:Ne}=P(),ht=Symbol("kCode"),ct=Symbol("kData"),ut=Symbol("kError"),dt=Symbol("kMessage"),_t=Symbol("kReason"),F=Symbol("kTarget"),pt=Symbol("kType"),mt=Symbol("kWasClean"),N=class{constructor(e){this[F]=null,this[pt]=e}get target(){return this[F]}get type(){return this[pt]}};Object.defineProperty(N.prototype,"target",{enumerable:!0});Object.defineProperty(N.prototype,"type",{enumerable:!0});var B=class extends N{constructor(e,t={}){super(e),this[ht]=t.code===void 0?0:t.code,this[_t]=t.reason===void 0?"":t.reason,this[mt]=t.wasClean===void 0?!1:t.wasClean}get code(){return this[ht]}get reason(){return this[_t]}get wasClean(){return this[mt]}};Object.defineProperty(B.prototype,"code",{enumerable:!0});Object.defineProperty(B.prototype,"reason",{enumerable:!0});Object.defineProperty(B.prototype,"wasClean",{enumerable:!0});var q=class extends N{constructor(e,t={}){super(e),this[ut]=t.error===void 0?null:t.error,this[dt]=t.message===void 0?"":t.message}get error(){return this[ut]}get message(){return this[dt]}};Object.defineProperty(q.prototype,"error",{enumerable:!0});Object.defineProperty(q.prototype,"message",{enumerable:!0});var X=class extends N{constructor(e,t={}){super(e),this[ct]=t.data===void 0?null:t.data}get data(){return this[ct]}};Object.defineProperty(X.prototype,"data",{enumerable:!0});var dr={addEventListener(r,e,t={}){for(let s of this.listeners(r))if(!t[K]&&s[Ne]===e&&!s[K])return;let i;if(r==="message")i=function(n,o){let l=new X("message",{data:o?n:n.toString()});l[F]=this,fe(e,this,l)};else if(r==="close")i=function(n,o){let l=new B("close",{code:n,reason:o.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});l[F]=this,fe(e,this,l)};else if(r==="error")i=function(n){let o=new q("error",{error:n,message:n.message});o[F]=this,fe(e,this,o)};else if(r==="open")i=function(){let n=new N("open");n[F]=this,fe(e,this,n)};else return;i[K]=!!t[K],i[Ne]=e,t.once?this.once(r,i):this.on(r,i)},removeEventListener(r,e){for(let t of this.listeners(r))if(t[Ne]===e&&!t[K]){this.removeListener(r,t);break}}};gt.exports={CloseEvent:B,ErrorEvent:q,Event:N,EventTarget:dr,MessageEvent:X};function fe(r,e,t){typeof r=="object"&&r.handleEvent?r.handleEvent.call(r,t):r.call(e,t)}});var Le=b((vs,xt)=>{"use strict";d();var{tokenChars:Z}=Y();function T(r,e,t){r[e]===void 0?r[e]=[t]:r[e].push(t)}function _r(r){let e=Object.create(null),t=Object.create(null),i=!1,s=!1,n=!1,o,l,f=-1,a=-1,c=-1,h=0;for(;h<r.length;h++)if(a=r.charCodeAt(h),o===void 0)if(c===-1&&Z[a]===1)f===-1&&(f=h);else if(h!==0&&(a===32||a===9))c===-1&&f!==-1&&(c=h);else if(a===59||a===44){if(f===-1)throw new SyntaxError(`Unexpected character at index ${h}`);c===-1&&(c=h);let x=r.slice(f,c);a===44?(T(e,x,t),t=Object.create(null)):o=x,f=c=-1}else throw new SyntaxError(`Unexpected character at index ${h}`);else if(l===void 0)if(c===-1&&Z[a]===1)f===-1&&(f=h);else if(a===32||a===9)c===-1&&f!==-1&&(c=h);else if(a===59||a===44){if(f===-1)throw new SyntaxError(`Unexpected character at index ${h}`);c===-1&&(c=h),T(t,r.slice(f,c),!0),a===44&&(T(e,o,t),t=Object.create(null),o=void 0),f=c=-1}else if(a===61&&f!==-1&&c===-1)l=r.slice(f,h),f=c=-1;else throw new SyntaxError(`Unexpected character at index ${h}`);else if(s){if(Z[a]!==1)throw new SyntaxError(`Unexpected character at index ${h}`);f===-1?f=h:i||(i=!0),s=!1}else if(n)if(Z[a]===1)f===-1&&(f=h);else if(a===34&&f!==-1)n=!1,c=h;else if(a===92)s=!0;else throw new SyntaxError(`Unexpected character at index ${h}`);else if(a===34&&r.charCodeAt(h-1)===61)n=!0;else if(c===-1&&Z[a]===1)f===-1&&(f=h);else if(f!==-1&&(a===32||a===9))c===-1&&(c=h);else if(a===59||a===44){if(f===-1)throw new SyntaxError(`Unexpected character at index ${h}`);c===-1&&(c=h);let x=r.slice(f,c);i&&(x=x.replace(/\\/g,""),i=!1),T(t,l,x),a===44&&(T(e,o,t),t=Object.create(null),o=void 0),l=void 0,f=c=-1}else throw new SyntaxError(`Unexpected character at index ${h}`);if(f===-1||n||a===32||a===9)throw new SyntaxError("Unexpected end of input");c===-1&&(c=h);let g=r.slice(f,c);return o===void 0?T(e,g,t):(l===void 0?T(t,g,!0):i?T(t,l,g.replace(/\\/g,"")):T(t,l,g),T(e,o,t)),e}function pr(r){return Object.keys(r).map(e=>{let t=r[e];return Array.isArray(t)||(t=[t]),t.map(i=>[e].concat(Object.keys(i).map(s=>{let n=i[s];return Array.isArray(n)||(n=[n]),n.map(o=>o===!0?s:`${s}=${o}`).join("; ")})).join("; ")).join(", ")}).join(", ")}xt.exports={format:pr,parse:_r}});var Be=b((ks,Lt)=>{"use strict";d();var mr=m("events"),gr=m("https"),yr=m("http"),vt=m("net"),xr=m("tls"),{randomBytes:Sr,createHash:Er}=m("crypto"),{Duplex:ws,Readable:Os}=m("stream"),{URL:Pe}=m("url"),I=z(),vr=ke(),br=Ce(),{BINARY_TYPES:St,EMPTY_BUFFER:he,GUID:wr,kForOnEventAttribute:Re,kListener:Or,kStatusCode:kr,kWebSocket:y,NOOP:bt}=P(),{EventTarget:{addEventListener:Tr,removeEventListener:Cr}}=yt(),{format:Nr,parse:Lr}=Le(),{toBuffer:Pr}=$(),Rr=30*1e3,wt=Symbol("kAborted"),Ie=[8,13],L=["CONNECTING","OPEN","CLOSING","CLOSED"],Ir=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,_=class r extends mr{constructor(e,t,i){super(),this._binaryType=St[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=he,this._closeTimer=null,this._extensions={},this._paused=!1,this._protocol="",this._readyState=r.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,t===void 0?t=[]:Array.isArray(t)||(typeof t=="object"&&t!==null?(i=t,t=[]):t=[t]),Ot(this,e,t,i)):(this._autoPong=i.autoPong,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){St.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}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(e,t,i){let s=new vr({allowSynchronousEvents:i.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation});this._sender=new br(e,this._extensions,i.generateMask),this._receiver=s,this._socket=e,s[y]=this,e[y]=this,s.on("conclude",Dr),s.on("drain",Mr),s.on("error",Ar),s.on("message",Wr),s.on("ping",Fr),s.on("pong",qr),e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",Tt),e.on("data",ue),e.on("end",Ct),e.on("error",Nt),this._readyState=r.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[I.extensionName]&&this._extensions[I.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){w(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===r.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=r.CLOSING,this._sender.close(e,t,!this._isServer,i=>{i||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),Rr)}}pause(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,t,i){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(i=e,e=t=void 0):typeof t=="function"&&(i=t,t=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Ue(this,e,i);return}t===void 0&&(t=!this._isServer),this._sender.ping(e||he,t,i)}pong(e,t,i){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(i=e,e=t=void 0):typeof t=="function"&&(i=t,t=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Ue(this,e,i);return}t===void 0&&(t=!this._isServer),this._sender.pong(e||he,t,i)}resume(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,t,i){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"&&(i=t,t={}),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Ue(this,e,i);return}let s={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...t};this._extensions[I.extensionName]||(s.compress=!1),this._sender.send(e||he,s,i)}terminate(){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){w(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=r.CLOSING,this._socket.destroy())}}};Object.defineProperty(_,"CONNECTING",{enumerable:!0,value:L.indexOf("CONNECTING")});Object.defineProperty(_.prototype,"CONNECTING",{enumerable:!0,value:L.indexOf("CONNECTING")});Object.defineProperty(_,"OPEN",{enumerable:!0,value:L.indexOf("OPEN")});Object.defineProperty(_.prototype,"OPEN",{enumerable:!0,value:L.indexOf("OPEN")});Object.defineProperty(_,"CLOSING",{enumerable:!0,value:L.indexOf("CLOSING")});Object.defineProperty(_.prototype,"CLOSING",{enumerable:!0,value:L.indexOf("CLOSING")});Object.defineProperty(_,"CLOSED",{enumerable:!0,value:L.indexOf("CLOSED")});Object.defineProperty(_.prototype,"CLOSED",{enumerable:!0,value:L.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(r=>{Object.defineProperty(_.prototype,r,{enumerable:!0})});["open","error","close","message"].forEach(r=>{Object.defineProperty(_.prototype,`on${r}`,{enumerable:!0,get(){for(let e of this.listeners(r))if(e[Re])return e[Or];return null},set(e){for(let t of this.listeners(r))if(t[Re]){this.removeListener(r,t);break}typeof e=="function"&&this.addEventListener(r,e,{[Re]:!0})}})});_.prototype.addEventListener=Tr;_.prototype.removeEventListener=Cr;Lt.exports=_;function Ot(r,e,t,i){let s={allowSynchronousEvents:!0,autoPong:!0,protocolVersion:Ie[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...i,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(r._autoPong=s.autoPong,!Ie.includes(s.protocolVersion))throw new RangeError(`Unsupported protocol version: ${s.protocolVersion} (supported versions: ${Ie.join(", ")})`);let n;if(e instanceof Pe)n=e;else try{n=new Pe(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}n.protocol==="http:"?n.protocol="ws:":n.protocol==="https:"&&(n.protocol="wss:"),r._url=n.href;let o=n.protocol==="wss:",l=n.protocol==="ws+unix:",f;if(n.protocol!=="ws:"&&!o&&!l?f=`The URL's protocol must be one of "ws:", "wss:", "http:", "https", or "ws+unix:"`:l&&!n.pathname?f="The URL's pathname is empty":n.hash&&(f="The URL contains a fragment identifier"),f){let u=new SyntaxError(f);if(r._redirects===0)throw u;ce(r,u);return}let a=o?443:80,c=Sr(16).toString("base64"),h=o?gr.request:yr.request,g=new Set,x;if(s.createConnection=s.createConnection||(o?Br:Ur),s.defaultPort=s.defaultPort||a,s.port=n.port||a,s.host=n.hostname.startsWith("[")?n.hostname.slice(1,-1):n.hostname,s.headers={...s.headers,"Sec-WebSocket-Version":s.protocolVersion,"Sec-WebSocket-Key":c,Connection:"Upgrade",Upgrade:"websocket"},s.path=n.pathname+n.search,s.timeout=s.handshakeTimeout,s.perMessageDeflate&&(x=new I(s.perMessageDeflate!==!0?s.perMessageDeflate:{},!1,s.maxPayload),s.headers["Sec-WebSocket-Extensions"]=Nr({[I.extensionName]:x.offer()})),t.length){for(let u of t){if(typeof u!="string"||!Ir.test(u)||g.has(u))throw new SyntaxError("An invalid or duplicated subprotocol was specified");g.add(u)}s.headers["Sec-WebSocket-Protocol"]=t.join(",")}if(s.origin&&(s.protocolVersion<13?s.headers["Sec-WebSocket-Origin"]=s.origin:s.headers.Origin=s.origin),(n.username||n.password)&&(s.auth=`${n.username}:${n.password}`),l){let u=s.path.split(":");s.socketPath=u[0],s.path=u[1]}let p;if(s.followRedirects){if(r._redirects===0){r._originalIpc=l,r._originalSecure=o,r._originalHostOrSocketPath=l?s.socketPath:n.host;let u=i&&i.headers;if(i={...i,headers:{}},u)for(let[v,A]of Object.entries(u))i.headers[v.toLowerCase()]=A}else if(r.listenerCount("redirect")===0){let u=l?r._originalIpc?s.socketPath===r._originalHostOrSocketPath:!1:r._originalIpc?!1:n.host===r._originalHostOrSocketPath;(!u||r._originalSecure&&!o)&&(delete s.headers.authorization,delete s.headers.cookie,u||delete s.headers.host,s.auth=void 0)}s.auth&&!i.headers.authorization&&(i.headers.authorization="Basic "+Buffer.from(s.auth).toString("base64")),p=r._req=h(s),r._redirects&&r.emit("redirect",r.url,p)}else p=r._req=h(s);s.timeout&&p.on("timeout",()=>{w(r,p,"Opening handshake has timed out")}),p.on("error",u=>{p===null||p[wt]||(p=r._req=null,ce(r,u))}),p.on("response",u=>{let v=u.headers.location,A=u.statusCode;if(v&&s.followRedirects&&A>=300&&A<400){if(++r._redirects>s.maxRedirects){w(r,p,"Maximum redirects exceeded");return}p.abort();let te;try{te=new Pe(v,e)}catch{let U=new SyntaxError(`Invalid URL: ${v}`);ce(r,U);return}Ot(r,te,t,i)}else r.emit("unexpected-response",p,u)||w(r,p,`Unexpected server response: ${u.statusCode}`)}),p.on("upgrade",(u,v,A)=>{if(r.emit("upgrade",u),r.readyState!==_.CONNECTING)return;if(p=r._req=null,u.headers.upgrade.toLowerCase()!=="websocket"){w(r,v,"Invalid Upgrade header");return}let te=Er("sha1").update(c+wr).digest("base64");if(u.headers["sec-websocket-accept"]!==te){w(r,v,"Invalid Sec-WebSocket-Accept header");return}let G=u.headers["sec-websocket-protocol"],U;if(G!==void 0?g.size?g.has(G)||(U="Server sent an invalid subprotocol"):U="Server sent a subprotocol but none was requested":g.size&&(U="Server sent no subprotocol"),U){w(r,v,U);return}G&&(r._protocol=G);let Me=u.headers["sec-websocket-extensions"];if(Me!==void 0){if(!x){w(r,v,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let _e;try{_e=Lr(Me)}catch{w(r,v,"Invalid Sec-WebSocket-Extensions header");return}let Ae=Object.keys(_e);if(Ae.length!==1||Ae[0]!==I.extensionName){w(r,v,"Server indicated an extension that was not requested");return}try{x.accept(_e[I.extensionName])}catch{w(r,v,"Invalid Sec-WebSocket-Extensions header");return}r._extensions[I.extensionName]=x}r.setSocket(v,A,{allowSynchronousEvents:s.allowSynchronousEvents,generateMask:s.generateMask,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation})}),s.finishRequest?s.finishRequest(p,r):p.end()}function ce(r,e){r._readyState=_.CLOSING,r.emit("error",e),r.emitClose()}function Ur(r){return r.path=r.socketPath,vt.connect(r)}function Br(r){return r.path=void 0,!r.servername&&r.servername!==""&&(r.servername=vt.isIP(r.host)?"":r.host),xr.connect(r)}function w(r,e,t){r._readyState=_.CLOSING;let i=new Error(t);Error.captureStackTrace(i,w),e.setHeader?(e[wt]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(ce,r,i)):(e.destroy(i),e.once("error",r.emit.bind(r,"error")),e.once("close",r.emitClose.bind(r)))}function Ue(r,e,t){if(e){let i=Pr(e).length;r._socket?r._sender._bufferedBytes+=i:r._bufferedAmount+=i}if(t){let i=new Error(`WebSocket is not open: readyState ${r.readyState} (${L[r.readyState]})`);process.nextTick(t,i)}}function Dr(r,e){let t=this[y];t._closeFrameReceived=!0,t._closeMessage=e,t._closeCode=r,t._socket[y]!==void 0&&(t._socket.removeListener("data",ue),process.nextTick(kt,t._socket),r===1005?t.close():t.close(r,e))}function Mr(){let r=this[y];r.isPaused||r._socket.resume()}function Ar(r){let e=this[y];e._socket[y]!==void 0&&(e._socket.removeListener("data",ue),process.nextTick(kt,e._socket),e.close(r[kr])),e.emit("error",r)}function Et(){this[y].emitClose()}function Wr(r,e){this[y].emit("message",r,e)}function Fr(r){let e=this[y];e._autoPong&&e.pong(r,!this._isServer,bt),e.emit("ping",r)}function qr(r){this[y].emit("pong",r)}function kt(r){r.resume()}function Tt(){let r=this[y];this.removeListener("close",Tt),this.removeListener("data",ue),this.removeListener("end",Ct),r._readyState=_.CLOSING;let e;!this._readableState.endEmitted&&!r._closeFrameReceived&&!r._receiver._writableState.errorEmitted&&(e=r._socket.read())!==null&&r._receiver.write(e),r._receiver.end(),this[y]=void 0,clearTimeout(r._closeTimer),r._receiver._writableState.finished||r._receiver._writableState.errorEmitted?r.emitClose():(r._receiver.on("error",Et),r._receiver.on("finish",Et))}function ue(r){this[y]._receiver.write(r)||this.pause()}function Ct(){let r=this[y];r._readyState=_.CLOSING,r._receiver.end(),this.end()}function Nt(){let r=this[y];this.removeListener("error",Nt),this.on("error",bt),r&&(r._readyState=_.CLOSING,this.destroy())}});var Rt=b((Cs,Pt)=>{"use strict";d();var{tokenChars:Gr}=Y();function Vr(r){let e=new Set,t=-1,i=-1,s=0;for(s;s<r.length;s++){let o=r.charCodeAt(s);if(i===-1&&Gr[o]===1)t===-1&&(t=s);else if(s!==0&&(o===32||o===9))i===-1&&t!==-1&&(i=s);else if(o===44){if(t===-1)throw new SyntaxError(`Unexpected character at index ${s}`);i===-1&&(i=s);let l=r.slice(t,i);if(e.has(l))throw new SyntaxError(`The "${l}" subprotocol is duplicated`);e.add(l),t=i=-1}else throw new SyntaxError(`Unexpected character at index ${s}`)}if(t===-1||i!==-1)throw new SyntaxError("Unexpected end of input");let n=r.slice(t,s);if(e.has(n))throw new SyntaxError(`The "${n}" subprotocol is duplicated`);return e.add(n),e}Pt.exports={parse:Vr}});var Wt=b((Ps,At)=>{"use strict";d();var $r=m("events"),de=m("http"),{Duplex:Ls}=m("stream"),{createHash:jr}=m("crypto"),It=Le(),D=z(),Hr=Rt(),zr=Be(),{GUID:Yr,kWebSocket:Kr}=P(),Xr=/^[+/0-9A-Za-z]{22}==$/,Ut=0,Bt=1,Mt=2,De=class extends $r{constructor(e,t){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:zr,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=de.createServer((i,s)=>{let n=de.STATUS_CODES[426];s.writeHead(426,{"Content-Length":n.length,"Content-Type":"text/plain"}),s.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)):e.server&&(this._server=e.server),this._server){let i=this.emit.bind(this,"connection");this._removeListeners=Zr(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(s,n,o)=>{this.handleUpgrade(s,n,o,i)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=Ut}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===Mt){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(Q,this);return}if(e&&this.once("close",e),this._state!==Bt)if(this._state=Bt,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(Q,this):process.nextTick(Q,this);else{let t=this._server;this._removeListeners(),this._removeListeners=this._server=null,t.close(()=>{Q(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf("?");if((t!==-1?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,i,s){t.on("error",Dt);let n=e.headers["sec-websocket-key"],o=+e.headers["sec-websocket-version"];if(e.method!=="GET"){M(this,e,t,405,"Invalid HTTP method");return}if(e.headers.upgrade.toLowerCase()!=="websocket"){M(this,e,t,400,"Invalid Upgrade header");return}if(!n||!Xr.test(n)){M(this,e,t,400,"Missing or invalid Sec-WebSocket-Key header");return}if(o!==8&&o!==13){M(this,e,t,400,"Missing or invalid Sec-WebSocket-Version header");return}if(!this.shouldHandle(e)){J(t,400);return}let l=e.headers["sec-websocket-protocol"],f=new Set;if(l!==void 0)try{f=Hr.parse(l)}catch{M(this,e,t,400,"Invalid Sec-WebSocket-Protocol header");return}let a=e.headers["sec-websocket-extensions"],c={};if(this.options.perMessageDeflate&&a!==void 0){let h=new D(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let g=It.parse(a);g[D.extensionName]&&(h.accept(g[D.extensionName]),c[D.extensionName]=h)}catch{M(this,e,t,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let h={origin:e.headers[`${o===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(h,(g,x,p,u)=>{if(!g)return J(t,x||401,p,u);this.completeUpgrade(c,n,f,e,t,i,s)});return}if(!this.options.verifyClient(h))return J(t,401)}this.completeUpgrade(c,n,f,e,t,i,s)}completeUpgrade(e,t,i,s,n,o,l){if(!n.readable||!n.writable)return n.destroy();if(n[Kr])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Ut)return J(n,503);let a=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${jr("sha1").update(t+Yr).digest("base64")}`],c=new this.options.WebSocket(null,void 0,this.options);if(i.size){let h=this.options.handleProtocols?this.options.handleProtocols(i,s):i.values().next().value;h&&(a.push(`Sec-WebSocket-Protocol: ${h}`),c._protocol=h)}if(e[D.extensionName]){let h=e[D.extensionName].params,g=It.format({[D.extensionName]:[h]});a.push(`Sec-WebSocket-Extensions: ${g}`),c._extensions=e}this.emit("headers",a,s),n.write(a.concat(`\r
4
4
  `).join(`\r
5
5
  `)),n.removeListener("error",Dt),c.setSocket(n,o,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(c),c.on("close",()=>{this.clients.delete(c),this._shouldEmitClose&&!this.clients.size&&process.nextTick(Q,this)})),l(c,s)}};At.exports=De;function Zr(r,e){for(let t of Object.keys(e))r.on(t,e[t]);return function(){for(let i of Object.keys(e))r.removeListener(i,e[i])}}function Q(r){r._state=Mt,r.emit("close")}function Dt(){this.destroy()}function J(r,e,t,i){t=t||de.STATUS_CODES[e],i={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(t),...i},r.once("finish",r.destroy),r.end(`HTTP/1.1 ${e} ${de.STATUS_CODES[e]}\r
6
6
  `+Object.keys(i).map(s=>`${s}: ${i[s]}`).join(`\r
7
7
  `)+`\r
8
8
  \r
9
9
  `+t)}function M(r,e,t,i,s){if(r.listenerCount("wsClientError")){let n=new Error(s);Error.captureStackTrace(n,M),r.emit("wsClientError",n,t,e)}else J(t,i,s)}});d();d();d();var Qr=V(Ge(),1),Jr=V(ke(),1),es=V(Ce(),1),Ft=V(Be(),1),ts=V(Wt(),1);var qt=Ft.default;var ee=global;ee.WebSocket||(ee.WebSocket=qt);ee.window||(ee.window=global);ee.window.__REACT_DEVTOOLS_COMPONENT_FILTERS__=[{type:1,value:7,isEnabled:!0},{type:2,value:"InternalApp",isEnabled:!0,isValid:!0},{type:2,value:"InternalAppContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalStdoutContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalStderrContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalStdinContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalFocusContext",isEnabled:!0,isValid:!0}];import rs from"react-devtools-core";rs.connectToDevTools();
10
- //# sourceMappingURL=devtools-WFBFD7GB.js.map
10
+ //# sourceMappingURL=devtools-WDPQJNQZ.js.map