@tachybase/module-message 1.3.21 → 1.3.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/base/notification-providers/providerTypes/index.d.ts +1 -1
- package/dist/client/configuration/Message.instruction.d.ts +2 -2
- package/dist/client/index.js +4 -4
- package/dist/client/plugin.d.ts +1 -1
- package/dist/common/collections/messages.d.ts +1 -1
- package/dist/common/collections/users.d.ts +1 -1
- package/dist/common/collections/users.js +2 -2
- package/dist/externalVersion.js +7 -9
- package/dist/node_modules/@alicloud/dysmsapi20170525/dist/client.js +2 -2
- package/dist/node_modules/@alicloud/dysmsapi20170525/package.json +1 -1
- package/dist/node_modules/@alicloud/openapi-client/dist/client.js +2 -2
- package/dist/node_modules/@alicloud/openapi-client/package.json +1 -1
- package/dist/node_modules/@alicloud/tea-util/dist/client.js +1 -1
- package/dist/node_modules/@alicloud/tea-util/package.json +1 -1
- package/dist/node_modules/tencentcloud-sdk-nodejs/node_modules/.bin/uuid +2 -2
- package/dist/node_modules/tencentcloud-sdk-nodejs/package.json +1 -1
- package/dist/node_modules/ws/index.js +1 -1
- package/dist/node_modules/ws/lib/permessage-deflate.js +14 -0
- package/dist/node_modules/ws/lib/sender.js +1 -1
- package/dist/node_modules/ws/lib/stream.js +2 -0
- package/dist/node_modules/ws/lib/websocket-server.js +14 -4
- package/dist/node_modules/ws/lib/websocket.js +1 -1
- package/dist/node_modules/ws/package.json +1 -1
- package/dist/server/MessageManager.d.ts +1 -2
- package/dist/server/MessageManager.js +1 -1
- package/dist/server/actions/messages.js +2 -12
- package/dist/server/plugin.d.ts +1 -2
- package/dist/server/plugin.js +2 -3
- package/package.json +15 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@alicloud/openapi-client","version":"0.4.15","description":"","main":"dist/client.js","scripts":{"test":"mocha -r ts-node/register -r source-map-support/register test/**/*.spec.ts --timeout=10000","test-cov":"nyc -e .ts -r=html -r=text -r=lcov npm run test","build":"tsc","prepublishOnly":"tsc"},"author":"","license":"ISC","devDependencies":{"@types/mocha":"^5.2.7","mocha":"^6.2.0","@types/node":"^18.0.0","nyc":"^15.0.0","source-map-support":"^0.5.16","ts-node":"^10.0.0","typescript":"^5.6.0","@alicloud/gateway-pop":"0.0.6"},"dependencies":{"@alicloud/tea-typescript":"^1.7.1","@alicloud/tea-util":"1.4.9","@alicloud/credentials":"^2.4.2","@alicloud/openapi-util":"^0.3.2","@alicloud/gateway-spi":"^0.0.8","@alicloud/tea-xml":"0.0.3"},"files":["dist","src"],"repository":"git@github.com:aliyun/darabonba-openapi.git","_lastModified":"2025-
|
|
1
|
+
{"name":"@alicloud/openapi-client","version":"0.4.15","description":"","main":"dist/client.js","scripts":{"test":"mocha -r ts-node/register -r source-map-support/register test/**/*.spec.ts --timeout=10000","test-cov":"nyc -e .ts -r=html -r=text -r=lcov npm run test","build":"tsc","prepublishOnly":"tsc"},"author":"","license":"ISC","devDependencies":{"@types/mocha":"^5.2.7","mocha":"^6.2.0","@types/node":"^18.0.0","nyc":"^15.0.0","source-map-support":"^0.5.16","ts-node":"^10.0.0","typescript":"^5.6.0","@alicloud/gateway-pop":"0.0.6"},"dependencies":{"@alicloud/tea-typescript":"^1.7.1","@alicloud/tea-util":"1.4.9","@alicloud/credentials":"^2.4.2","@alicloud/openapi-util":"^0.3.2","@alicloud/gateway-spi":"^0.0.8","@alicloud/tea-xml":"0.0.3"},"files":["dist","src"],"repository":"git@github.com:aliyun/darabonba-openapi.git","_lastModified":"2025-08-02T21:30:57.736Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){var e={828:function(e,t,r){"use strict";var n=this&&this.__extends||function(){var extendStatics=function(e,t){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return extendStatics(e,t)};return function(e,t){extendStatics(e,t);function __(){this.constructor=e}e.prototype=t===null?Object.create(t):(__.prototype=t.prototype,new __)}}();var o=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(r!=="default"&&Object.hasOwnProperty.call(e,r))o(t,e,r);s(t,e);return t};var a=this&&this.__awaiter||function(e,t,r,n){function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,o){function fulfilled(e){try{step(n.next(e))}catch(e){o(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){o(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())}))};var u=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,o,s,i;return i={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function verb(e){return function(t){return step([e,t])}}function step(i){if(n)throw new TypeError("Generator is already executing.");while(r)try{if(n=1,o&&(s=i[0]&2?o["return"]:i[0]?o["throw"]||((s=o["return"])&&s.call(o),0):o.next)&&!(s=s.call(o,i[1])).done)return s;if(o=0,s)i=[i[0]&2,s.value];switch(i[0]){case 0:case 1:s=i;break;case 4:r.label++;return{value:i[1],done:false};case 5:r.label++;o=i[1];i=[0];continue;case 7:i=r.ops.pop();r.trys.pop();continue;default:if(!(s=r.trys,s=s.length>0&&s[s.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!s||i[1]>s[0]&&i[1]<s[3])){r.label=i[1];break}if(i[0]===6&&r.label<s[1]){r.label=s[1];s=i;break}if(s&&r.label<s[2]){r.label=s[2];r.ops.push(i);break}if(s[2])r.ops.pop();r.trys.pop();continue}i=t.call(e,r)}catch(e){i=[6,e];o=0}finally{n=s=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}};Object.defineProperty(t,"__esModule",{value:true});t.isRetryable=t.retryError=t.newUnretryableError=t.getBackoffTime=t.allowRetry=t.sleep=t.cast=t.Model=t.toMap=t.newError=t.doAction=t.Response=t.Request=t.BytesReadable=void 0;var c=i(r(480));var f=r(611);var l=r(692);var p=r(203);var d=i(r(312));var m=r(16);var y=function(e){n(BytesReadable,e);function BytesReadable(t){var r=e.call(this)||this;if(typeof t==="string"){r.value=Buffer.from(t)}else if(Buffer.isBuffer(t)){r.value=t}return r}BytesReadable.prototype._read=function(){this.push(this.value);this.push(null)};return BytesReadable}(p.Readable);t.BytesReadable=y;var h=function(){function Request(){this.headers={};this.query={}}return Request}();t.Request=h;var g=function(){function Response(e){this.statusCode=e.statusCode;this.statusMessage=e.statusMessage;this.headers=this.convertHeaders(e.headers);this.body=e}Response.prototype.convertHeaders=function(e){var t={};var r=Object.keys(e);for(var n=0;n<r.length;n++){var o=r[n];t[o]=e[o]}return t};Response.prototype.readBytes=function(){return a(this,void 0,void 0,(function(){var e;return u(this,(function(t){switch(t.label){case 0:return[4,d.read(this.body,"")];case 1:e=t.sent();return[2,e]}}))}))};return Response}();t.Response=g;function buildURL(e){var t=e.protocol+"://"+e.headers["host"];if(e.port){t+=":"+e.port}t+=""+e.pathname;var r=m.parse(t);if(e.query&&Object.keys(e.query).length>0){if(r.query){t+="&"+c.stringify(e.query)}else{t+="?"+c.stringify(e.query)}}return t}function isModelClass(e){if(!e){return false}return typeof e.types==="function"&&typeof e.names==="function"}function doAction(e,t){if(t===void 0){t=null}return a(this,void 0,void 0,(function(){var r,n,o,s,i;return u(this,(function(a){switch(a.label){case 0:r=buildURL(e);n=(e.method||"GET").toUpperCase();o={method:n,headers:e.headers};if(n!=="GET"&&n!=="HEAD"){o.data=e.body}if(t){if(typeof t.timeout!=="undefined"){o.timeout=Number(t.timeout)}if(typeof t.readTimeout!=="undefined"){o.readTimeout=Number(t.readTimeout)}if(typeof t.connectTimeout!=="undefined"){o.connectTimeout=Number(t.connectTimeout)}if(typeof t.ignoreSSL!=="undefined"){o.rejectUnauthorized=!t.ignoreSSL}if(typeof t.key!=="undefined"){o.key=String(t.key)}if(typeof t.cert!=="undefined"){o.cert=String(t.cert)}if(typeof t.ca!=="undefined"){o.ca=String(t.ca)}s={keepAlive:true};if(typeof t.keepAlive!=="undefined"){s.keepAlive=t.keepAlive;if(e.protocol&&e.protocol.toLowerCase()==="https"){o.agent=new l.Agent(s)}else{o.agent=new f.Agent(s)}}}return[4,d.request(r,o)];case 1:i=a.sent();return[2,new g(i)]}}))}))}t.doAction=doAction;var b=function(e){n(ResponseError,e);function ResponseError(t){var r=e.call(this,t.code+": "+t.message)||this;r.code=t.code;r.data=t.data;r.description=t.description;r.accessDeniedDetail=t.accessDeniedDetail;if(r.data&&r.data.statusCode){r.statusCode=Number(r.data.statusCode)}return r}return ResponseError}(Error);function newError(e){return new b(e)}t.newError=newError;function getValue(e,t){if(typeof e==="string"){return t}if(e.type==="array"){if(!Array.isArray(t)){throw new Error("expect: array, actual: "+typeof t)}return t.map((function(t){return getValue(e.itemType,t)}))}if(typeof e==="function"){if(isModelClass(e)){return new e(t)}return t}return t}function toMap(e){if(e===void 0){e=undefined}if(typeof e==="undefined"||e==null){return null}if(e instanceof v){return e.toMap()}if(typeof e.toMap==="function"){return e.toMap()}if(Array.isArray(e)){return e.map((function(e){return toMap(e)}))}return e}t.toMap=toMap;var v=function(){function Model(e){var t=this;if(e==null){return}var r=this.constructor;var n=r.names();var o=r.types();Object.keys(n).forEach((function(r){var n=e[r];if(n===undefined||n===null){return}var s=o[r];t[r]=getValue(s,n)}))}Model.prototype.toMap=function(){var e=this;var t={};var r=this.constructor;var n=r.names();Object.keys(n).forEach((function(r){var o=n[r];var s=e[r];if(typeof s==="undefined"||s==null){return}t[o]=toMap(s)}));return t};return Model}();t.Model=v;function cast(e,t){if(!e){throw new Error("can not cast to Map")}if(typeof e!=="object"){throw new Error("can not cast to Map")}var r=e;var n=t.constructor;var o=n.names();var s=n.types();Object.keys(o).forEach((function(e){var n=o[e];var i=r[n];var a=s[e];if(typeof i==="undefined"||i==null){return}if(typeof a==="string"){if(a==="Readable"||a==="map"||a==="Buffer"||a==="any"||typeof i===a){t[e]=i;return}if(a==="string"&&(typeof i==="number"||typeof i==="boolean")){t[e]=i.toString();return}if(a==="boolean"){if(i===1||i===0){t[e]=!!i;return}if(i==="true"||i==="false"){t[e]=i==="true";return}}if(a==="number"&&typeof i==="string"){if(i.match(/^\d*$/)){t[e]=parseInt(i);return}if(i.match(/^[\.\d]*$/)){t[e]=parseFloat(i);return}}throw new Error("type of "+e+" is mismatch, expect "+a+", but "+typeof i)}else if(a.type==="map"){if(!(i instanceof Object)){throw new Error("type of "+e+" is mismatch, expect object, but "+typeof i)}t[e]=i}else if(a.type==="array"){if(!Array.isArray(i)){throw new Error("type of "+e+" is mismatch, expect array, but "+typeof i)}if(typeof a.itemType==="function"){t[e]=i.map((function(e){if(isModelClass(a.itemType)){return cast(e,new a.itemType({}))}return e}))}else{t[e]=i}}else if(typeof a==="function"){if(!(i instanceof Object)){throw new Error("type of "+e+" is mismatch, expect object, but "+typeof i)}if(isModelClass(a)){t[e]=cast(i,new a({}));return}t[e]=i}else{}}));return t}t.cast=cast;function sleep(e){return new Promise((function(t){setTimeout(t,e)}))}t.sleep=sleep;function allowRetry(e,t,r){if(t===0){return true}if(e.retryable!==true){return false}if(e.policy==="never"){return false}if(e.policy==="always"){return true}if(e.policy==="simple"){return t<e["maxAttempts"]}if(e.policy==="timeout"){return Date.now()-r<e.timeout}if(e.maxAttempts&&typeof e.maxAttempts==="number"){return e.maxAttempts>=t}return false}t.allowRetry=allowRetry;function getBackoffTime(e,t){if(t===0){return 0}if(e.policy==="no"){return 0}if(e.policy==="fixed"){return e.period}if(e.policy==="random"){var r=e["minPeriod"];var n=e["maxPeriod"];return r+(n-r)*Math.random()}if(e.policy==="exponential"){var o=e.initial;var s=e.multiplier;var i=o*Math.pow(1+s,t-1);var n=e.max;return Math.min(i,n)}if(e.policy==="exponential_random"){var o=e.initial;var s=e.multiplier;var i=o*Math.pow(1+s,t-1);var n=e.max;return Math.min(i*(.5+Math.random()),n)}return 0}t.getBackoffTime=getBackoffTime;var C=function(e){n(UnretryableError,e);function UnretryableError(t){var r=e.call(this,t)||this;r.name="UnretryableError";return r}return UnretryableError}(Error);function newUnretryableError(e){var t=new C("");t.data={lastRequest:e};return t}t.newUnretryableError=newUnretryableError;var w=function(e){n(RetryError,e);function RetryError(t){var r=e.call(this,t)||this;r.name="RetryError";return r}return RetryError}(Error);function retryError(e,t){var r=new w("");r.data={request:e,response:t};return r}t.retryError=retryError;function isRetryable(e){if(typeof e==="undefined"||e===null){return false}return e.name==="RetryError"}t.isRetryable=isRetryable},252:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(r!=="default"&&Object.hasOwnProperty.call(e,r))n(t,e,r);o(t,e);return t};var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.RuntimeOptions=t.ExtendsParameters=void 0;const a=r(203);const u=s(r(828));const c=s(r(3));const f=i(r(480));const l=r(857);const p=`AlibabaCloud (${l.platform()}; ${l.arch()}) Node.js/${process.version} Core/1.0.1 TeaDSL/1`;class ExtendsParameters extends u.Model{constructor(e){super(e)}static names(){return{headers:"headers",queries:"queries"}}static types(){return{headers:{type:"map",keyType:"string",valueType:"string"},queries:{type:"map",keyType:"string",valueType:"string"}}}}t.ExtendsParameters=ExtendsParameters;class RuntimeOptions extends u.Model{constructor(e){super(e)}static names(){return{autoretry:"autoretry",ignoreSSL:"ignoreSSL",key:"key",cert:"cert",ca:"ca",maxAttempts:"max_attempts",backoffPolicy:"backoff_policy",backoffPeriod:"backoff_period",readTimeout:"readTimeout",connectTimeout:"connectTimeout",httpProxy:"httpProxy",httpsProxy:"httpsProxy",noProxy:"noProxy",maxIdleConns:"maxIdleConns",keepAlive:"keepAlive",extendsParameters:"extendsParameters"}}static types(){return{autoretry:"boolean",ignoreSSL:"boolean",key:"string",cert:"string",ca:"string",maxAttempts:"number",backoffPolicy:"string",backoffPeriod:"number",readTimeout:"number",connectTimeout:"number",httpProxy:"string",httpsProxy:"string",noProxy:"string",maxIdleConns:"number",keepAlive:"boolean",extendsParameters:ExtendsParameters}}}t.RuntimeOptions=RuntimeOptions;function read(e){return new Promise(((t,r)=>{let n,o,s;var cleanup=function(){e.removeListener("error",o);e.removeListener("data",n);e.removeListener("end",s)};var i=[];var a=0;n=function(e){i.push(e);a+=e.length};o=function(e){cleanup();r(e)};s=function(){cleanup();t(Buffer.concat(i,a))};e.on("error",o);e.on("data",n);e.on("end",s)}))}class Client{static toString(e){return e.toString()}static parseJSON(e){return JSON.parse(e)}static async readAsBytes(e){return await read(e)}static async readAsString(e){let t=await Client.readAsBytes(e);return Client.toString(t)}static async readAsJSON(e){return Client.parseJSON(await Client.readAsString(e))}static getNonce(){return c.makeNonce()}static getDateUTCString(){const e=new Date;return e.toUTCString()}static defaultString(e,t){return e||t}static defaultNumber(e,t){return e||t}static toFormString(e){return f.default.stringify(e)}static toJSONString(e){if(typeof e==="string"){return e}return JSON.stringify(e)}static toBytes(e){return Buffer.from(e)}static empty(e){return!e}static equalString(e,t){return e===t}static equalNumber(e,t){return e===t}static isUnset(e){if(typeof e==="undefined"){return true}if(e===null){return true}return false}static stringifyMapValue(e){if(!e){return e}const t={};for(const[r,n]of Object.entries(e)){if(typeof n==="undefined"||n===null){continue}t[r]=String(n)}return t}static anyifyMapValue(e){return e}static assertAsBoolean(e){if(typeof e==="boolean"){return e}throw new Error(`The value is not a boolean`)}static assertAsString(e){if(typeof e==="string"){return e}throw new Error(`The value is not a string`)}static assertAsNumber(e){if(typeof e==="number"){return e}throw new Error(`The value is not a number`)}static assertAsInteger(e){if(Number.isInteger(e)){return e}throw new Error(`The value is not a int number`)}static assertAsMap(e){if(e&&typeof e==="object"&&!Array.isArray(e)){return e}throw new Error(`The value is not a object`)}static assertAsArray(e){if(Array.isArray(e)){return e}throw new Error(`The value is not array`)}static assertAsBytes(e){if(Buffer.isBuffer(e)){return e}throw new Error(`The value is not bytes`)}static getUserAgent(e){if(!e||!e.length){return p}return p+" "+e}static is2xx(e){return e>=200&&e<300}static is3xx(e){return e>=300&&e<400}static is4xx(e){return e>=400&&e<500}static is5xx(e){return e>=500&&e<600}static validateModel(e){}static toMap(e){return u.toMap(e)}static async sleep(e){return new Promise((t=>{setTimeout((()=>{t()}),e)}))}static toArray(e){if(!(e instanceof Array)){return null}let t=[];e.forEach((e=>{if(!e){return}t.push(u.toMap(e))}));return t}static assertAsReadable(e){if(e instanceof a.Readable){return e}throw new Error(`The value is not a readable`)}}t["default"]=Client},313:function(e,t,r){t.formatArgs=formatArgs;t.save=save;t.load=load;t.useColors=useColors;t.storage=localstorage();t.destroy=(()=>{let e=false;return()=>{if(!e){e=true;console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}}})();t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function useColors(){if(typeof window!=="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)){return true}if(typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)){return false}let e;return typeof document!=="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!=="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!=="undefined"&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function formatArgs(t){t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff);if(!this.useColors){return}const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0;let o=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{if(e==="%%"){return}n++;if(e==="%c"){o=n}}));t.splice(o,0,r)}t.log=console.debug||console.log||(()=>{});function save(e){try{if(e){t.storage.setItem("debug",e)}else{t.storage.removeItem("debug")}}catch(e){}}function load(){let e;try{e=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch(e){}if(!e&&typeof process!=="undefined"&&"env"in process){e=process.env.DEBUG}return e}function localstorage(){try{return localStorage}catch(e){}}e.exports=r(384)(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},384:function(e,t,r){function setup(e){createDebug.debug=createDebug;createDebug.default=createDebug;createDebug.coerce=coerce;createDebug.disable=disable;createDebug.enable=enable;createDebug.enabled=enabled;createDebug.humanize=r(134);createDebug.destroy=destroy;Object.keys(e).forEach((t=>{createDebug[t]=e[t]}));createDebug.names=[];createDebug.skips=[];createDebug.formatters={};function selectColor(e){let t=0;for(let r=0;r<e.length;r++){t=(t<<5)-t+e.charCodeAt(r);t|=0}return createDebug.colors[Math.abs(t)%createDebug.colors.length]}createDebug.selectColor=selectColor;function createDebug(e){let t;let r=null;let n;let o;function debug(...e){if(!debug.enabled){return}const r=debug;const n=Number(new Date);const o=n-(t||n);r.diff=o;r.prev=t;r.curr=n;t=n;e[0]=createDebug.coerce(e[0]);if(typeof e[0]!=="string"){e.unshift("%O")}let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((t,n)=>{if(t==="%%"){return"%"}s++;const o=createDebug.formatters[n];if(typeof o==="function"){const n=e[s];t=o.call(r,n);e.splice(s,1);s--}return t}));createDebug.formatArgs.call(r,e);const i=r.log||createDebug.log;i.apply(r,e)}debug.namespace=e;debug.useColors=createDebug.useColors();debug.color=createDebug.selectColor(e);debug.extend=extend;debug.destroy=createDebug.destroy;Object.defineProperty(debug,"enabled",{enumerable:true,configurable:false,get:()=>{if(r!==null){return r}if(n!==createDebug.namespaces){n=createDebug.namespaces;o=createDebug.enabled(e)}return o},set:e=>{r=e}});if(typeof createDebug.init==="function"){createDebug.init(debug)}return debug}function extend(e,t){const r=createDebug(this.namespace+(typeof t==="undefined"?":":t)+e);r.log=this.log;return r}function enable(e){createDebug.save(e);createDebug.namespaces=e;createDebug.names=[];createDebug.skips=[];const t=(typeof e==="string"?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const e of t){if(e[0]==="-"){createDebug.skips.push(e.slice(1))}else{createDebug.names.push(e)}}}function matchesTemplate(e,t){let r=0;let n=0;let o=-1;let s=0;while(r<e.length){if(n<t.length&&(t[n]===e[r]||t[n]==="*")){if(t[n]==="*"){o=n;s=r;n++}else{r++;n++}}else if(o!==-1){n=o+1;s++;r=s}else{return false}}while(n<t.length&&t[n]==="*"){n++}return n===t.length}function disable(){const e=[...createDebug.names,...createDebug.skips.map((e=>"-"+e))].join(",");createDebug.enable("");return e}function enabled(e){for(const t of createDebug.skips){if(matchesTemplate(e,t)){return false}}for(const t of createDebug.names){if(matchesTemplate(e,t)){return true}}return false}function coerce(e){if(e instanceof Error){return e.stack||e.message}return e}function destroy(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}createDebug.enable(createDebug.load());return createDebug}e.exports=setup},449:function(e,t,r){if(typeof process==="undefined"||process.type==="renderer"||process.browser===true||process.__nwjs){e.exports=r(313)}else{e.exports=r(249)}},249:function(e,t,r){const n=r(18);const o=r(23);t.init=init;t.log=log;t.formatArgs=formatArgs;t.save=save;t.load=load;t.useColors=useColors;t.destroy=o.deprecate((()=>{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");t.colors=[6,2,3,4,5,1];try{const e=r(414);if(e&&(e.stderr||e).level>=2){t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const r=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let n=process.env[t];if(/^(yes|on|true|enabled)$/i.test(n)){n=true}else if(/^(no|off|false|disabled)$/i.test(n)){n=false}else if(n==="null"){n=null}else{n=Number(n)}e[r]=n;return e}),{});function useColors(){return"colors"in t.inspectOpts?Boolean(t.inspectOpts.colors):n.isatty(process.stderr.fd)}function formatArgs(t){const{namespace:r,useColors:n}=this;if(n){const n=this.color;const o="[3"+(n<8?n:"8;5;"+n);const s=` ${o};1m${r} [0m`;t[0]=s+t[0].split("\n").join("\n"+s);t.push(o+"m+"+e.exports.humanize(this.diff)+"[0m")}else{t[0]=getDate()+r+" "+t[0]}}function getDate(){if(t.inspectOpts.hideDate){return""}return(new Date).toISOString()+" "}function log(...e){return process.stderr.write(o.formatWithOptions(t.inspectOpts,...e)+"\n")}function save(e){if(e){process.env.DEBUG=e}else{delete process.env.DEBUG}}function load(){return process.env.DEBUG}function init(e){e.inspectOpts={};const r=Object.keys(t.inspectOpts);for(let n=0;n<r.length;n++){e.inspectOpts[r[n]]=t.inspectOpts[r[n]]}}e.exports=r(384)(t);const{formatters:s}=e.exports;s.o=function(e){this.inspectOpts.colors=this.useColors;return o.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")};s.O=function(e){this.inspectOpts.colors=this.useColors;return o.inspect(e,this.inspectOpts)}},871:function(e){"use strict";e.exports=(e,t)=>{t=t||process.argv;const r=e.startsWith("-")?"":e.length===1?"-":"--";const n=t.indexOf(r+e);const o=t.indexOf("--");return n!==-1&&(o===-1?true:n<o)}},312:function(e,t,r){"use strict";const n=r(106);const o=r(611);const s=r(692);const i=r(16).parse;const a=r(16).format;const u=r(449)("httpx:body");const c=r(449)("httpx:header");const f=new o.Agent({keepAlive:true});const l=new s.Agent({keepAlive:true});const p=3e3;const d=Symbol("TIMER::READ_TIMER");const m=Symbol("TIMER::READ_TIME_OUT");const y=Symbol("TIMER::READ_TIMER_START_AT");function decompress(e){switch(e.headers["content-encoding"]){case"gzip":return e.pipe(n.createGunzip());case"deflate":return e.pipe(n.createInflate());default:return e}}var append=function(e,t,r){e.name=t+e.name;e.message=`${r}. ${e.message}`;return e};const isNumber=function(e){return e!==null&&!isNaN(e)};t.request=function(e,t){t||(t={});const r=typeof e==="string"?i(e):e;let n,h;if(isNumber(t.readTimeout)||isNumber(t.connectTimeout)){n=isNumber(t.readTimeout)?Number(t.readTimeout):p;h=isNumber(t.connectTimeout)?Number(t.connectTimeout):p}else if(isNumber(t.timeout)){n=h=Number(t.timeout)}else{n=h=p}const g=r.protocol==="https:";const b=(t.method||"GET").toUpperCase();const v=g?l:f;const C=t.agent||v;var w={host:r.hostname||"localhost",path:r.path||"/",method:b,port:r.port||(r.protocol==="https:"?443:80),agent:C,headers:t.headers||{},key:t.key||"",cert:t.cert||"",ca:t.ca||"",timeout:h};if(g&&typeof t.rejectUnauthorized!=="undefined"){w.rejectUnauthorized=t.rejectUnauthorized}if(t.compression){w.headers["accept-encoding"]="gzip,deflate"}const E=g?s:o;if(typeof t.beforeRequest==="function"){w=t.beforeRequest(w)}return new Promise(((o,s)=>{const i=E.request(w);const f=t.data;var fulfilled=e=>{if(c.enabled){const t=e.req._header;t.split("\r\n").forEach((e=>{c("> %s",e)}));c("< HTTP/%s %s %s",e.httpVersion,e.statusCode,e.statusMessage);Object.keys(e.headers).forEach((t=>{c("< %s: %s",t,e.headers[t])}))}o(e)};var rejected=e=>{e.message+=`${b} ${a(r)} failed.`;if(i.socket&&i.socket[d]){clearTimeout(i.socket[d])}s(e)};var abort=e=>{i.abort();rejected(e)};const startResponseTimer=function(e){const t=setTimeout((()=>{if(e[d]){clearTimeout(e[d]);e[d]=null}var t=new Error;var r=`ReadTimeout(${n})`;abort(append(t,"RequestTimeout",r))}),n);e[m]=n;e[d]=t;e[y]=Date.now();t.unref()};if(!f||"string"===typeof f||f instanceof Buffer){if(u.enabled){if(!f){u("<no request body>")}else if("string"===typeof f){u(f)}else{u(`Buffer <ignored>, Buffer length: ${f.length}`)}}i.end(f)}else if("function"===typeof f.pipe){f.pipe(i);if(u.enabled){u("<request body is a stream>")}f.once("error",(e=>{abort(append(e,"HttpX","Stream occor error"))}))}i.on("timeout",(()=>{var t=new Error;t.name="RequestTimeoutError";t.message=`ConnectTimeout: Connect ${e} failed.`;i.destroy();s(t)}));i.on("response",fulfilled);i.on("error",rejected);i.once("socket",(function(e){if(e.readyState==="opening"){e.once("connect",(function(){startResponseTimer(e)}))}else{startResponseTimer(e)}}))}))};t.read=function(e,t){const r=decompress(e);return new Promise(((n,o)=>{const s=e.socket||e.client;const makeReadTimeoutError=()=>{const t=e.req;var r=new Error;r.name="RequestTimeoutError";r.message=`ReadTimeout: ${s[m]}. ${t.method} ${t.path} failed.`;return r};let i;const a=s[d];if(!a){o(makeReadTimeoutError());return}const c=s[m]-(Date.now()-s[y]);clearTimeout(a);if(c<=0){o(makeReadTimeoutError());return}i=setTimeout((function(){o(makeReadTimeoutError())}),c);var f,l,p;var cleanup=function(){r.removeListener("error",f);r.removeListener("data",l);r.removeListener("end",p);if(i){clearTimeout(i)}};const h=[];var g=0;l=function(e){h.push(e);g+=e.length};f=function(e){cleanup();o(e)};p=function(){cleanup();var e=Buffer.concat(h,g);u("");if(t){const r=e.toString(t);u(r);return n(r)}if(u.enabled){u(e.toString())}n(e)};r.on("error",f);r.on("data",l);r.on("end",p)}))};function readyToRead(e){return new Promise(((t,r)=>{var n,o,s;var cleanup=function(){e.removeListener("error",s);e.removeListener("end",o);e.removeListener("readable",n)};n=function(){cleanup();t(false)};o=function(){cleanup();t(true)};s=function(e){cleanup();r(e)};e.once("readable",n);e.once("end",o);e.once("error",s)}))}class Event{constructor(e,t,r,n){this.id=e;this.event=t;this.data=r;this.retry=n}}t.Event=Event;const h="data:";const g="event:";const b="id:";const v="retry:";function isDigitsOnly(e){for(let t=0;t<e.length;t++){const r=e.charAt(t);if(r<"0"||r>"9"){return false}}return e.length>0}function tryGetEvents(e,t){const r=e+t;let n=0;const o=[];for(let e=0;e<r.length-1;e++){const t=r[e];const s=r[e+1];if(t==="\n"&&s==="\n"){const t=r.substring(n,e);const s=t.split("\n");const i=new Event;s.forEach((e=>{if(e.startsWith(h)){i.data=e.substring(h.length).trim()}else if(e.startsWith(g)){i.event=e.substring(g.length).trim()}else if(e.startsWith(b)){i.id=e.substring(b.length).trim()}else if(e.startsWith(v)){const t=e.substring(v.length).trim();if(isDigitsOnly(t)){i.retry=parseInt(t,10)}}else if(e.startsWith(":")){}}));o.push(i);n=e+2}}const s=r.substring(n);return[o,s]}t.readAsSSE=async function*(e){const t=decompress(e);const r=e.socket||e.client;clearTimeout(r[d]);let n="";while(true){const e=await readyToRead(t);if(e){return}let r;while(null!==(r=t.read())){const[e,t]=tryGetEvents(n,r.toString());n=t;if(e&&e.length>0){for(const t of e){yield t}}}}}},3:function(e,t,r){"use strict";const n=r(896);const o=r(857);const s=r(982);t.loadJSONSync=function(e){var t=n.readFileSync(e,"utf8");if(t.charCodeAt(0)===65279){t=t.slice(1)}try{return JSON.parse(t)}catch(t){t.message=e+": "+t.message;throw t}};t.encode=function(e,t){if(typeof e!=="string"){e=""+e}return Buffer.from(e,t)};t.makeHasher=function(e){return function(t,r){var n=s.createHash(e);n.update(t);return n.digest(r)}};t.createHash=t.makeHasher;t.md5=t.makeHasher("md5");t.createHmac=function(e){return function(t,r,n){return s.createHmac(e,r).update(t).digest(n)}};t.sha1=t.createHmac("sha1");t.random=function(e,t){return Math.floor(e+Math.random()*(t-e))};t.makeNonce=function(){var e=0;var r;const n=o.hostname();const s=process.pid;return function(){var o=Math.floor(Math.random()*1e12);if(o===r){e++}else{e=0}r=o;var i=`${n}${s}${o}${e}`;return t.md5(i,"hex")}}();t.pad2=function(e){if(e<10){return"0"+e}return""+e};t.pad3=function(e){if(e<10){return"00"+e}else if(e<100){return"0"+e}return""+e};t.getYYYYMMDD=function(e){var r=e.getFullYear();var n=t.pad2(e.getMonth()+1);var o=t.pad2(e.getDate());return""+r+n+o};t.sleep=function(e){return new Promise((t=>{setTimeout(t,e)}))};t.getIPv4=function(){var e=o.networkInterfaces();var t=Object.keys(e);for(var r=0;r<t.length;r++){var n=t[r];var s=e[n];for(var i=0;i<s.length;i++){var a=s[i];if(!a.internal&&a.family==="IPv4"){return a.address}}}return""};t.getMac=function(){var e=o.networkInterfaces();var t=Object.keys(e);for(var r=0;r<t.length;r++){var n=t[r];var s=e[n];for(var i=0;i<s.length;i++){var a=s[i];if(!a.internal&&a.family==="IPv4"){return a.mac}}}return"00:00:00:00:00:00"};t.readAll=function(e){return new Promise(((t,r)=>{var n,o,s;var cleanup=function(t){e.removeListener("error",n);e.removeListener("data",o);e.removeListener("end",s)};var i=[];var a=0;o=function(e){i.push(e);a+=e.length};n=function(e){cleanup();r(e)};s=function(){cleanup();t(Buffer.concat(i,a))};e.on("error",n);e.on("data",o);e.on("end",s)}))}},134:function(e){var t=1e3;var r=t*60;var n=r*60;var o=n*24;var s=o*7;var i=o*365.25;e.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0){return parse(e)}else if(r==="number"&&isFinite(e)){return t.long?fmtLong(e):fmtShort(e)}throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function parse(e){e=String(e);if(e.length>100){return}var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!a){return}var u=parseFloat(a[1]);var c=(a[2]||"ms").toLowerCase();switch(c){case"years":case"year":case"yrs":case"yr":case"y":return u*i;case"weeks":case"week":case"w":return u*s;case"days":case"day":case"d":return u*o;case"hours":case"hour":case"hrs":case"hr":case"h":return u*n;case"minutes":case"minute":case"mins":case"min":case"m":return u*r;case"seconds":case"second":case"secs":case"sec":case"s":return u*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return undefined}}function fmtShort(e){var s=Math.abs(e);if(s>=o){return Math.round(e/o)+"d"}if(s>=n){return Math.round(e/n)+"h"}if(s>=r){return Math.round(e/r)+"m"}if(s>=t){return Math.round(e/t)+"s"}return e+"ms"}function fmtLong(e){var s=Math.abs(e);if(s>=o){return plural(e,s,o,"day")}if(s>=n){return plural(e,s,n,"hour")}if(s>=r){return plural(e,s,r,"minute")}if(s>=t){return plural(e,s,t,"second")}return e+" ms"}function plural(e,t,r,n){var o=t>=r*1.5;return Math.round(e/r)+" "+n+(o?"s":"")}},414:function(e,t,r){"use strict";const n=r(857);const o=r(871);const s=process.env;let i;if(o("no-color")||o("no-colors")||o("color=false")){i=false}else if(o("color")||o("colors")||o("color=true")||o("color=always")){i=true}if("FORCE_COLOR"in s){i=s.FORCE_COLOR.length===0||parseInt(s.FORCE_COLOR,10)!==0}function translateLevel(e){if(e===0){return false}return{level:e,hasBasic:true,has256:e>=2,has16m:e>=3}}function supportsColor(e){if(i===false){return 0}if(o("color=16m")||o("color=full")||o("color=truecolor")){return 3}if(o("color=256")){return 2}if(e&&!e.isTTY&&i!==true){return 0}const t=i?1:0;if(process.platform==="win32"){const e=n.release().split(".");if(Number(process.versions.node.split(".")[0])>=8&&Number(e[0])>=10&&Number(e[2])>=10586){return Number(e[2])>=14931?3:2}return 1}if("CI"in s){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some((e=>e in s))||s.CI_NAME==="codeship"){return 1}return t}if("TEAMCITY_VERSION"in s){return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(s.TEAMCITY_VERSION)?1:0}if(s.COLORTERM==="truecolor"){return 3}if("TERM_PROGRAM"in s){const e=parseInt((s.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(s.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(s.TERM)){return 2}if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(s.TERM)){return 1}if("COLORTERM"in s){return 1}if(s.TERM==="dumb"){return t}return t}function getSupportLevel(e){const t=supportsColor(e);return translateLevel(t)}e.exports={supportsColor:getSupportLevel,stdout:getSupportLevel(process.stdout),stderr:getSupportLevel(process.stderr)}},982:function(e){"use strict";e.exports=require("crypto")},896:function(e){"use strict";e.exports=require("fs")},611:function(e){"use strict";e.exports=require("http")},692:function(e){"use strict";e.exports=require("https")},857:function(e){"use strict";e.exports=require("os")},480:function(e){"use strict";e.exports=require("querystring")},203:function(e){"use strict";e.exports=require("stream")},18:function(e){"use strict";e.exports=require("tty")},16:function(e){"use strict";e.exports=require("url")},23:function(e){"use strict";e.exports=require("util")},106:function(e){"use strict";e.exports=require("zlib")}};var t={};function __nccwpck_require__(r){var n=t[r];if(n!==undefined){return n.exports}var o=t[r]={exports:{}};var s=true;try{e[r].call(o.exports,o,o.exports,__nccwpck_require__);s=false}finally{if(s)delete t[r]}return o.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(252);module.exports=r})();
|
|
1
|
+
(function(){var e={828:function(e,t,r){"use strict";var n=this&&this.__extends||function(){var extendStatics=function(e,t){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};return extendStatics(e,t)};return function(e,t){extendStatics(e,t);function __(){this.constructor=e}e.prototype=t===null?Object.create(t):(__.prototype=t.prototype,new __)}}();var o=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(r!=="default"&&Object.hasOwnProperty.call(e,r))o(t,e,r);s(t,e);return t};var a=this&&this.__awaiter||function(e,t,r,n){function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,o){function fulfilled(e){try{step(n.next(e))}catch(e){o(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){o(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())}))};var u=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,o,s,i;return i={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function verb(e){return function(t){return step([e,t])}}function step(i){if(n)throw new TypeError("Generator is already executing.");while(r)try{if(n=1,o&&(s=i[0]&2?o["return"]:i[0]?o["throw"]||((s=o["return"])&&s.call(o),0):o.next)&&!(s=s.call(o,i[1])).done)return s;if(o=0,s)i=[i[0]&2,s.value];switch(i[0]){case 0:case 1:s=i;break;case 4:r.label++;return{value:i[1],done:false};case 5:r.label++;o=i[1];i=[0];continue;case 7:i=r.ops.pop();r.trys.pop();continue;default:if(!(s=r.trys,s=s.length>0&&s[s.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!s||i[1]>s[0]&&i[1]<s[3])){r.label=i[1];break}if(i[0]===6&&r.label<s[1]){r.label=s[1];s=i;break}if(s&&r.label<s[2]){r.label=s[2];r.ops.push(i);break}if(s[2])r.ops.pop();r.trys.pop();continue}i=t.call(e,r)}catch(e){i=[6,e];o=0}finally{n=s=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}};Object.defineProperty(t,"__esModule",{value:true});t.isRetryable=t.retryError=t.newUnretryableError=t.getBackoffTime=t.allowRetry=t.sleep=t.cast=t.Model=t.toMap=t.newError=t.doAction=t.Response=t.Request=t.BytesReadable=void 0;var c=i(r(480));var f=r(611);var l=r(692);var p=r(203);var d=i(r(312));var m=r(16);var y=function(e){n(BytesReadable,e);function BytesReadable(t){var r=e.call(this)||this;if(typeof t==="string"){r.value=Buffer.from(t)}else if(Buffer.isBuffer(t)){r.value=t}return r}BytesReadable.prototype._read=function(){this.push(this.value);this.push(null)};return BytesReadable}(p.Readable);t.BytesReadable=y;var h=function(){function Request(){this.headers={};this.query={}}return Request}();t.Request=h;var g=function(){function Response(e){this.statusCode=e.statusCode;this.statusMessage=e.statusMessage;this.headers=this.convertHeaders(e.headers);this.body=e}Response.prototype.convertHeaders=function(e){var t={};var r=Object.keys(e);for(var n=0;n<r.length;n++){var o=r[n];t[o]=e[o]}return t};Response.prototype.readBytes=function(){return a(this,void 0,void 0,(function(){var e;return u(this,(function(t){switch(t.label){case 0:return[4,d.read(this.body,"")];case 1:e=t.sent();return[2,e]}}))}))};return Response}();t.Response=g;function buildURL(e){var t=e.protocol+"://"+e.headers["host"];if(e.port){t+=":"+e.port}t+=""+e.pathname;var r=m.parse(t);if(e.query&&Object.keys(e.query).length>0){if(r.query){t+="&"+c.stringify(e.query)}else{t+="?"+c.stringify(e.query)}}return t}function isModelClass(e){if(!e){return false}return typeof e.types==="function"&&typeof e.names==="function"}function doAction(e,t){if(t===void 0){t=null}return a(this,void 0,void 0,(function(){var r,n,o,s,i;return u(this,(function(a){switch(a.label){case 0:r=buildURL(e);n=(e.method||"GET").toUpperCase();o={method:n,headers:e.headers};if(n!=="GET"&&n!=="HEAD"){o.data=e.body}if(t){if(typeof t.timeout!=="undefined"){o.timeout=Number(t.timeout)}if(typeof t.readTimeout!=="undefined"){o.readTimeout=Number(t.readTimeout)}if(typeof t.connectTimeout!=="undefined"){o.connectTimeout=Number(t.connectTimeout)}if(typeof t.ignoreSSL!=="undefined"){o.rejectUnauthorized=!t.ignoreSSL}if(typeof t.key!=="undefined"){o.key=String(t.key)}if(typeof t.cert!=="undefined"){o.cert=String(t.cert)}if(typeof t.ca!=="undefined"){o.ca=String(t.ca)}s={keepAlive:true};if(typeof t.keepAlive!=="undefined"){s.keepAlive=t.keepAlive;if(e.protocol&&e.protocol.toLowerCase()==="https"){o.agent=new l.Agent(s)}else{o.agent=new f.Agent(s)}}}return[4,d.request(r,o)];case 1:i=a.sent();return[2,new g(i)]}}))}))}t.doAction=doAction;var b=function(e){n(ResponseError,e);function ResponseError(t){var r=e.call(this,t.code+": "+t.message)||this;r.code=t.code;r.data=t.data;r.description=t.description;r.accessDeniedDetail=t.accessDeniedDetail;if(r.data&&r.data.statusCode){r.statusCode=Number(r.data.statusCode)}return r}return ResponseError}(Error);function newError(e){return new b(e)}t.newError=newError;function getValue(e,t){if(typeof e==="string"){return t}if(e.type==="array"){if(!Array.isArray(t)){throw new Error("expect: array, actual: "+typeof t)}return t.map((function(t){return getValue(e.itemType,t)}))}if(typeof e==="function"){if(isModelClass(e)){return new e(t)}return t}return t}function toMap(e){if(e===void 0){e=undefined}if(typeof e==="undefined"||e==null){return null}if(e instanceof v){return e.toMap()}if(typeof e.toMap==="function"){return e.toMap()}if(Array.isArray(e)){return e.map((function(e){return toMap(e)}))}return e}t.toMap=toMap;var v=function(){function Model(e){var t=this;if(e==null){return}var r=this.constructor;var n=r.names();var o=r.types();Object.keys(n).forEach((function(r){var n=e[r];if(n===undefined||n===null){return}var s=o[r];t[r]=getValue(s,n)}))}Model.prototype.toMap=function(){var e=this;var t={};var r=this.constructor;var n=r.names();Object.keys(n).forEach((function(r){var o=n[r];var s=e[r];if(typeof s==="undefined"||s==null){return}t[o]=toMap(s)}));return t};return Model}();t.Model=v;function cast(e,t){if(!e){throw new Error("can not cast to Map")}if(typeof e!=="object"){throw new Error("can not cast to Map")}var r=e;var n=t.constructor;var o=n.names();var s=n.types();Object.keys(o).forEach((function(e){var n=o[e];var i=r[n];var a=s[e];if(typeof i==="undefined"||i==null){return}if(typeof a==="string"){if(a==="Readable"||a==="map"||a==="Buffer"||a==="any"||typeof i===a){t[e]=i;return}if(a==="string"&&(typeof i==="number"||typeof i==="boolean")){t[e]=i.toString();return}if(a==="boolean"){if(i===1||i===0){t[e]=!!i;return}if(i==="true"||i==="false"){t[e]=i==="true";return}}if(a==="number"&&typeof i==="string"){if(i.match(/^\d*$/)){t[e]=parseInt(i);return}if(i.match(/^[\.\d]*$/)){t[e]=parseFloat(i);return}}throw new Error("type of "+e+" is mismatch, expect "+a+", but "+typeof i)}else if(a.type==="map"){if(!(i instanceof Object)){throw new Error("type of "+e+" is mismatch, expect object, but "+typeof i)}t[e]=i}else if(a.type==="array"){if(!Array.isArray(i)){throw new Error("type of "+e+" is mismatch, expect array, but "+typeof i)}if(typeof a.itemType==="function"){t[e]=i.map((function(e){if(isModelClass(a.itemType)){return cast(e,new a.itemType({}))}return e}))}else{t[e]=i}}else if(typeof a==="function"){if(!(i instanceof Object)){throw new Error("type of "+e+" is mismatch, expect object, but "+typeof i)}if(isModelClass(a)){t[e]=cast(i,new a({}));return}t[e]=i}else{}}));return t}t.cast=cast;function sleep(e){return new Promise((function(t){setTimeout(t,e)}))}t.sleep=sleep;function allowRetry(e,t,r){if(t===0){return true}if(e.retryable!==true){return false}if(e.policy==="never"){return false}if(e.policy==="always"){return true}if(e.policy==="simple"){return t<e["maxAttempts"]}if(e.policy==="timeout"){return Date.now()-r<e.timeout}if(e.maxAttempts&&typeof e.maxAttempts==="number"){return e.maxAttempts>=t}return false}t.allowRetry=allowRetry;function getBackoffTime(e,t){if(t===0){return 0}if(e.policy==="no"){return 0}if(e.policy==="fixed"){return e.period}if(e.policy==="random"){var r=e["minPeriod"];var n=e["maxPeriod"];return r+(n-r)*Math.random()}if(e.policy==="exponential"){var o=e.initial;var s=e.multiplier;var i=o*Math.pow(1+s,t-1);var n=e.max;return Math.min(i,n)}if(e.policy==="exponential_random"){var o=e.initial;var s=e.multiplier;var i=o*Math.pow(1+s,t-1);var n=e.max;return Math.min(i*(.5+Math.random()),n)}return 0}t.getBackoffTime=getBackoffTime;var C=function(e){n(UnretryableError,e);function UnretryableError(t){var r=e.call(this,t)||this;r.name="UnretryableError";return r}return UnretryableError}(Error);function newUnretryableError(e){var t=new C("");t.data={lastRequest:e};return t}t.newUnretryableError=newUnretryableError;var w=function(e){n(RetryError,e);function RetryError(t){var r=e.call(this,t)||this;r.name="RetryError";return r}return RetryError}(Error);function retryError(e,t){var r=new w("");r.data={request:e,response:t};return r}t.retryError=retryError;function isRetryable(e){if(typeof e==="undefined"||e===null){return false}return e.name==="RetryError"}t.isRetryable=isRetryable},252:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(r!=="default"&&Object.hasOwnProperty.call(e,r))n(t,e,r);o(t,e);return t};var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.RuntimeOptions=t.ExtendsParameters=void 0;const a=r(203);const u=s(r(828));const c=s(r(406));const f=i(r(480));const l=r(857);const p=`AlibabaCloud (${l.platform()}; ${l.arch()}) Node.js/${process.version} Core/1.0.1 TeaDSL/1`;class ExtendsParameters extends u.Model{constructor(e){super(e)}static names(){return{headers:"headers",queries:"queries"}}static types(){return{headers:{type:"map",keyType:"string",valueType:"string"},queries:{type:"map",keyType:"string",valueType:"string"}}}}t.ExtendsParameters=ExtendsParameters;class RuntimeOptions extends u.Model{constructor(e){super(e)}static names(){return{autoretry:"autoretry",ignoreSSL:"ignoreSSL",key:"key",cert:"cert",ca:"ca",maxAttempts:"max_attempts",backoffPolicy:"backoff_policy",backoffPeriod:"backoff_period",readTimeout:"readTimeout",connectTimeout:"connectTimeout",httpProxy:"httpProxy",httpsProxy:"httpsProxy",noProxy:"noProxy",maxIdleConns:"maxIdleConns",keepAlive:"keepAlive",extendsParameters:"extendsParameters"}}static types(){return{autoretry:"boolean",ignoreSSL:"boolean",key:"string",cert:"string",ca:"string",maxAttempts:"number",backoffPolicy:"string",backoffPeriod:"number",readTimeout:"number",connectTimeout:"number",httpProxy:"string",httpsProxy:"string",noProxy:"string",maxIdleConns:"number",keepAlive:"boolean",extendsParameters:ExtendsParameters}}}t.RuntimeOptions=RuntimeOptions;function read(e){return new Promise(((t,r)=>{let n,o,s;var cleanup=function(){e.removeListener("error",o);e.removeListener("data",n);e.removeListener("end",s)};var i=[];var a=0;n=function(e){i.push(e);a+=e.length};o=function(e){cleanup();r(e)};s=function(){cleanup();t(Buffer.concat(i,a))};e.on("error",o);e.on("data",n);e.on("end",s)}))}class Client{static toString(e){return e.toString()}static parseJSON(e){return JSON.parse(e)}static async readAsBytes(e){return await read(e)}static async readAsString(e){let t=await Client.readAsBytes(e);return Client.toString(t)}static async readAsJSON(e){return Client.parseJSON(await Client.readAsString(e))}static getNonce(){return c.makeNonce()}static getDateUTCString(){const e=new Date;return e.toUTCString()}static defaultString(e,t){return e||t}static defaultNumber(e,t){return e||t}static toFormString(e){return f.default.stringify(e)}static toJSONString(e){if(typeof e==="string"){return e}return JSON.stringify(e)}static toBytes(e){return Buffer.from(e)}static empty(e){return!e}static equalString(e,t){return e===t}static equalNumber(e,t){return e===t}static isUnset(e){if(typeof e==="undefined"){return true}if(e===null){return true}return false}static stringifyMapValue(e){if(!e){return e}const t={};for(const[r,n]of Object.entries(e)){if(typeof n==="undefined"||n===null){continue}t[r]=String(n)}return t}static anyifyMapValue(e){return e}static assertAsBoolean(e){if(typeof e==="boolean"){return e}throw new Error(`The value is not a boolean`)}static assertAsString(e){if(typeof e==="string"){return e}throw new Error(`The value is not a string`)}static assertAsNumber(e){if(typeof e==="number"){return e}throw new Error(`The value is not a number`)}static assertAsInteger(e){if(Number.isInteger(e)){return e}throw new Error(`The value is not a int number`)}static assertAsMap(e){if(e&&typeof e==="object"&&!Array.isArray(e)){return e}throw new Error(`The value is not a object`)}static assertAsArray(e){if(Array.isArray(e)){return e}throw new Error(`The value is not array`)}static assertAsBytes(e){if(Buffer.isBuffer(e)){return e}throw new Error(`The value is not bytes`)}static getUserAgent(e){if(!e||!e.length){return p}return p+" "+e}static is2xx(e){return e>=200&&e<300}static is3xx(e){return e>=300&&e<400}static is4xx(e){return e>=400&&e<500}static is5xx(e){return e>=500&&e<600}static validateModel(e){}static toMap(e){return u.toMap(e)}static async sleep(e){return new Promise((t=>{setTimeout((()=>{t()}),e)}))}static toArray(e){if(!(e instanceof Array)){return null}let t=[];e.forEach((e=>{if(!e){return}t.push(u.toMap(e))}));return t}static assertAsReadable(e){if(e instanceof a.Readable){return e}throw new Error(`The value is not a readable`)}}t["default"]=Client},313:function(e,t,r){t.formatArgs=formatArgs;t.save=save;t.load=load;t.useColors=useColors;t.storage=localstorage();t.destroy=(()=>{let e=false;return()=>{if(!e){e=true;console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}}})();t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function useColors(){if(typeof window!=="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)){return true}if(typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)){return false}let e;return typeof document!=="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!=="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!=="undefined"&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function formatArgs(t){t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff);if(!this.useColors){return}const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0;let o=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{if(e==="%%"){return}n++;if(e==="%c"){o=n}}));t.splice(o,0,r)}t.log=console.debug||console.log||(()=>{});function save(e){try{if(e){t.storage.setItem("debug",e)}else{t.storage.removeItem("debug")}}catch(e){}}function load(){let e;try{e=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch(e){}if(!e&&typeof process!=="undefined"&&"env"in process){e=process.env.DEBUG}return e}function localstorage(){try{return localStorage}catch(e){}}e.exports=r(384)(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},384:function(e,t,r){function setup(e){createDebug.debug=createDebug;createDebug.default=createDebug;createDebug.coerce=coerce;createDebug.disable=disable;createDebug.enable=enable;createDebug.enabled=enabled;createDebug.humanize=r(134);createDebug.destroy=destroy;Object.keys(e).forEach((t=>{createDebug[t]=e[t]}));createDebug.names=[];createDebug.skips=[];createDebug.formatters={};function selectColor(e){let t=0;for(let r=0;r<e.length;r++){t=(t<<5)-t+e.charCodeAt(r);t|=0}return createDebug.colors[Math.abs(t)%createDebug.colors.length]}createDebug.selectColor=selectColor;function createDebug(e){let t;let r=null;let n;let o;function debug(...e){if(!debug.enabled){return}const r=debug;const n=Number(new Date);const o=n-(t||n);r.diff=o;r.prev=t;r.curr=n;t=n;e[0]=createDebug.coerce(e[0]);if(typeof e[0]!=="string"){e.unshift("%O")}let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((t,n)=>{if(t==="%%"){return"%"}s++;const o=createDebug.formatters[n];if(typeof o==="function"){const n=e[s];t=o.call(r,n);e.splice(s,1);s--}return t}));createDebug.formatArgs.call(r,e);const i=r.log||createDebug.log;i.apply(r,e)}debug.namespace=e;debug.useColors=createDebug.useColors();debug.color=createDebug.selectColor(e);debug.extend=extend;debug.destroy=createDebug.destroy;Object.defineProperty(debug,"enabled",{enumerable:true,configurable:false,get:()=>{if(r!==null){return r}if(n!==createDebug.namespaces){n=createDebug.namespaces;o=createDebug.enabled(e)}return o},set:e=>{r=e}});if(typeof createDebug.init==="function"){createDebug.init(debug)}return debug}function extend(e,t){const r=createDebug(this.namespace+(typeof t==="undefined"?":":t)+e);r.log=this.log;return r}function enable(e){createDebug.save(e);createDebug.namespaces=e;createDebug.names=[];createDebug.skips=[];const t=(typeof e==="string"?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const e of t){if(e[0]==="-"){createDebug.skips.push(e.slice(1))}else{createDebug.names.push(e)}}}function matchesTemplate(e,t){let r=0;let n=0;let o=-1;let s=0;while(r<e.length){if(n<t.length&&(t[n]===e[r]||t[n]==="*")){if(t[n]==="*"){o=n;s=r;n++}else{r++;n++}}else if(o!==-1){n=o+1;s++;r=s}else{return false}}while(n<t.length&&t[n]==="*"){n++}return n===t.length}function disable(){const e=[...createDebug.names,...createDebug.skips.map((e=>"-"+e))].join(",");createDebug.enable("");return e}function enabled(e){for(const t of createDebug.skips){if(matchesTemplate(e,t)){return false}}for(const t of createDebug.names){if(matchesTemplate(e,t)){return true}}return false}function coerce(e){if(e instanceof Error){return e.stack||e.message}return e}function destroy(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}createDebug.enable(createDebug.load());return createDebug}e.exports=setup},449:function(e,t,r){if(typeof process==="undefined"||process.type==="renderer"||process.browser===true||process.__nwjs){e.exports=r(313)}else{e.exports=r(249)}},249:function(e,t,r){const n=r(18);const o=r(23);t.init=init;t.log=log;t.formatArgs=formatArgs;t.save=save;t.load=load;t.useColors=useColors;t.destroy=o.deprecate((()=>{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");t.colors=[6,2,3,4,5,1];try{const e=r(414);if(e&&(e.stderr||e).level>=2){t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const r=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let n=process.env[t];if(/^(yes|on|true|enabled)$/i.test(n)){n=true}else if(/^(no|off|false|disabled)$/i.test(n)){n=false}else if(n==="null"){n=null}else{n=Number(n)}e[r]=n;return e}),{});function useColors(){return"colors"in t.inspectOpts?Boolean(t.inspectOpts.colors):n.isatty(process.stderr.fd)}function formatArgs(t){const{namespace:r,useColors:n}=this;if(n){const n=this.color;const o="[3"+(n<8?n:"8;5;"+n);const s=` ${o};1m${r} [0m`;t[0]=s+t[0].split("\n").join("\n"+s);t.push(o+"m+"+e.exports.humanize(this.diff)+"[0m")}else{t[0]=getDate()+r+" "+t[0]}}function getDate(){if(t.inspectOpts.hideDate){return""}return(new Date).toISOString()+" "}function log(...e){return process.stderr.write(o.formatWithOptions(t.inspectOpts,...e)+"\n")}function save(e){if(e){process.env.DEBUG=e}else{delete process.env.DEBUG}}function load(){return process.env.DEBUG}function init(e){e.inspectOpts={};const r=Object.keys(t.inspectOpts);for(let n=0;n<r.length;n++){e.inspectOpts[r[n]]=t.inspectOpts[r[n]]}}e.exports=r(384)(t);const{formatters:s}=e.exports;s.o=function(e){this.inspectOpts.colors=this.useColors;return o.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")};s.O=function(e){this.inspectOpts.colors=this.useColors;return o.inspect(e,this.inspectOpts)}},871:function(e){"use strict";e.exports=(e,t)=>{t=t||process.argv;const r=e.startsWith("-")?"":e.length===1?"-":"--";const n=t.indexOf(r+e);const o=t.indexOf("--");return n!==-1&&(o===-1?true:n<o)}},312:function(e,t,r){"use strict";const n=r(106);const o=r(611);const s=r(692);const i=r(16).parse;const a=r(16).format;const u=r(449)("httpx:body");const c=r(449)("httpx:header");const f=new o.Agent({keepAlive:true});const l=new s.Agent({keepAlive:true});const p=3e3;const d=Symbol("TIMER::READ_TIMER");const m=Symbol("TIMER::READ_TIME_OUT");const y=Symbol("TIMER::READ_TIMER_START_AT");function decompress(e){switch(e.headers["content-encoding"]){case"gzip":return e.pipe(n.createGunzip());case"deflate":return e.pipe(n.createInflate());default:return e}}var append=function(e,t,r){e.name=t+e.name;e.message=`${r}. ${e.message}`;return e};const isNumber=function(e){return e!==null&&!isNaN(e)};t.request=function(e,t){t||(t={});const r=typeof e==="string"?i(e):e;let n,h;if(isNumber(t.readTimeout)||isNumber(t.connectTimeout)){n=isNumber(t.readTimeout)?Number(t.readTimeout):p;h=isNumber(t.connectTimeout)?Number(t.connectTimeout):p}else if(isNumber(t.timeout)){n=h=Number(t.timeout)}else{n=h=p}const g=r.protocol==="https:";const b=(t.method||"GET").toUpperCase();const v=g?l:f;const C=t.agent||v;var w={host:r.hostname||"localhost",path:r.path||"/",method:b,port:r.port||(r.protocol==="https:"?443:80),agent:C,headers:t.headers||{},key:t.key||"",cert:t.cert||"",ca:t.ca||"",timeout:h};if(g&&typeof t.rejectUnauthorized!=="undefined"){w.rejectUnauthorized=t.rejectUnauthorized}if(t.compression){w.headers["accept-encoding"]="gzip,deflate"}const E=g?s:o;if(typeof t.beforeRequest==="function"){w=t.beforeRequest(w)}return new Promise(((o,s)=>{const i=E.request(w);const f=t.data;var fulfilled=e=>{if(c.enabled){const t=e.req._header;t.split("\r\n").forEach((e=>{c("> %s",e)}));c("< HTTP/%s %s %s",e.httpVersion,e.statusCode,e.statusMessage);Object.keys(e.headers).forEach((t=>{c("< %s: %s",t,e.headers[t])}))}o(e)};var rejected=e=>{e.message+=`${b} ${a(r)} failed.`;if(i.socket&&i.socket[d]){clearTimeout(i.socket[d])}s(e)};var abort=e=>{i.abort();rejected(e)};const startResponseTimer=function(e){const t=setTimeout((()=>{if(e[d]){clearTimeout(e[d]);e[d]=null}var t=new Error;var r=`ReadTimeout(${n})`;abort(append(t,"RequestTimeout",r))}),n);e[m]=n;e[d]=t;e[y]=Date.now();t.unref()};if(!f||"string"===typeof f||f instanceof Buffer){if(u.enabled){if(!f){u("<no request body>")}else if("string"===typeof f){u(f)}else{u(`Buffer <ignored>, Buffer length: ${f.length}`)}}i.end(f)}else if("function"===typeof f.pipe){f.pipe(i);if(u.enabled){u("<request body is a stream>")}f.once("error",(e=>{abort(append(e,"HttpX","Stream occor error"))}))}i.on("timeout",(()=>{var t=new Error;t.name="RequestTimeoutError";t.message=`ConnectTimeout: Connect ${e} failed.`;i.destroy();s(t)}));i.on("response",fulfilled);i.on("error",rejected);i.once("socket",(function(e){if(e.readyState==="opening"){e.once("connect",(function(){startResponseTimer(e)}))}else{startResponseTimer(e)}}))}))};t.read=function(e,t){const r=decompress(e);return new Promise(((n,o)=>{const s=e.socket||e.client;const makeReadTimeoutError=()=>{const t=e.req;var r=new Error;r.name="RequestTimeoutError";r.message=`ReadTimeout: ${s[m]}. ${t.method} ${t.path} failed.`;return r};let i;const a=s[d];if(!a){o(makeReadTimeoutError());return}const c=s[m]-(Date.now()-s[y]);clearTimeout(a);if(c<=0){o(makeReadTimeoutError());return}i=setTimeout((function(){o(makeReadTimeoutError())}),c);var f,l,p;var cleanup=function(){r.removeListener("error",f);r.removeListener("data",l);r.removeListener("end",p);if(i){clearTimeout(i)}};const h=[];var g=0;l=function(e){h.push(e);g+=e.length};f=function(e){cleanup();o(e)};p=function(){cleanup();var e=Buffer.concat(h,g);u("");if(t){const r=e.toString(t);u(r);return n(r)}if(u.enabled){u(e.toString())}n(e)};r.on("error",f);r.on("data",l);r.on("end",p)}))};function readyToRead(e){return new Promise(((t,r)=>{var n,o,s;var cleanup=function(){e.removeListener("error",s);e.removeListener("end",o);e.removeListener("readable",n)};n=function(){cleanup();t(false)};o=function(){cleanup();t(true)};s=function(e){cleanup();r(e)};e.once("readable",n);e.once("end",o);e.once("error",s)}))}class Event{constructor(e,t,r,n){this.id=e;this.event=t;this.data=r;this.retry=n}}t.Event=Event;const h="data:";const g="event:";const b="id:";const v="retry:";function isDigitsOnly(e){for(let t=0;t<e.length;t++){const r=e.charAt(t);if(r<"0"||r>"9"){return false}}return e.length>0}function tryGetEvents(e,t){const r=e+t;let n=0;const o=[];for(let e=0;e<r.length-1;e++){const t=r[e];const s=r[e+1];if(t==="\n"&&s==="\n"){const t=r.substring(n,e);const s=t.split("\n");const i=new Event;s.forEach((e=>{if(e.startsWith(h)){i.data=e.substring(h.length).trim()}else if(e.startsWith(g)){i.event=e.substring(g.length).trim()}else if(e.startsWith(b)){i.id=e.substring(b.length).trim()}else if(e.startsWith(v)){const t=e.substring(v.length).trim();if(isDigitsOnly(t)){i.retry=parseInt(t,10)}}else if(e.startsWith(":")){}}));o.push(i);n=e+2}}const s=r.substring(n);return[o,s]}t.readAsSSE=async function*(e){const t=decompress(e);const r=e.socket||e.client;clearTimeout(r[d]);let n="";while(true){const e=await readyToRead(t);if(e){return}let r;while(null!==(r=t.read())){const[e,t]=tryGetEvents(n,r.toString());n=t;if(e&&e.length>0){for(const t of e){yield t}}}}}},406:function(e,t,r){"use strict";const n=r(896);const o=r(857);const s=r(982);t.loadJSONSync=function(e){var t=n.readFileSync(e,"utf8");if(t.charCodeAt(0)===65279){t=t.slice(1)}try{return JSON.parse(t)}catch(t){t.message=e+": "+t.message;throw t}};t.encode=function(e,t){if(typeof e!=="string"){e=""+e}return Buffer.from(e,t)};t.makeHasher=function(e){return function(t,r){var n=s.createHash(e);n.update(t);return n.digest(r)}};t.createHash=t.makeHasher;t.md5=t.makeHasher("md5");t.createHmac=function(e){return function(t,r,n){return s.createHmac(e,r).update(t).digest(n)}};t.sha1=t.createHmac("sha1");t.random=function(e,t){return Math.floor(e+Math.random()*(t-e))};t.makeNonce=function(){var e=0;var r;const n=o.hostname();const s=process.pid;return function(){var o=Math.floor(Math.random()*1e12);if(o===r){e++}else{e=0}r=o;var i=`${n}${s}${o}${e}`;return t.md5(i,"hex")}}();t.pad2=function(e){if(e<10){return"0"+e}return""+e};t.pad3=function(e){if(e<10){return"00"+e}else if(e<100){return"0"+e}return""+e};t.getYYYYMMDD=function(e){var r=e.getFullYear();var n=t.pad2(e.getMonth()+1);var o=t.pad2(e.getDate());return""+r+n+o};t.sleep=function(e){return new Promise((t=>{setTimeout(t,e)}))};t.getIPv4=function(){var e=o.networkInterfaces();var t=Object.keys(e);for(var r=0;r<t.length;r++){var n=t[r];var s=e[n];for(var i=0;i<s.length;i++){var a=s[i];if(!a.internal&&a.family==="IPv4"){return a.address}}}return""};t.getMac=function(){var e=o.networkInterfaces();var t=Object.keys(e);for(var r=0;r<t.length;r++){var n=t[r];var s=e[n];for(var i=0;i<s.length;i++){var a=s[i];if(!a.internal&&a.family==="IPv4"){return a.mac}}}return"00:00:00:00:00:00"};t.readAll=function(e){return new Promise(((t,r)=>{var n,o,s;var cleanup=function(t){e.removeListener("error",n);e.removeListener("data",o);e.removeListener("end",s)};var i=[];var a=0;o=function(e){i.push(e);a+=e.length};n=function(e){cleanup();r(e)};s=function(){cleanup();t(Buffer.concat(i,a))};e.on("error",n);e.on("data",o);e.on("end",s)}))};class SimpleCryptoHelper{constructor(e,t,r){this.algorithm=e;this.key=t;this.iv=r}encrypt(e,t,r){const n=s.createCipheriv(this.algorithm,this.key,this.iv);let o=n.update(e,t,r);o+=n.final(r);return o}decrypt(e,t,r){const n=s.createDecipheriv(this.algorithm,this.key,this.iv);let o=n.update(e,t,r);o+=n.final(r);return o}}const i=new SimpleCryptoHelper("aes-192-cbc",Buffer.from("keykeykeykeykeykeykeykey"),Buffer.from("abcdefghijklmnop"));t.encrypt=function(e,t,r){return i.encrypt(e,t,r)};t.decrypt=function(e,t,r){return i.decrypt(e,t,r)}},134:function(e){var t=1e3;var r=t*60;var n=r*60;var o=n*24;var s=o*7;var i=o*365.25;e.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0){return parse(e)}else if(r==="number"&&isFinite(e)){return t.long?fmtLong(e):fmtShort(e)}throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function parse(e){e=String(e);if(e.length>100){return}var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!a){return}var u=parseFloat(a[1]);var c=(a[2]||"ms").toLowerCase();switch(c){case"years":case"year":case"yrs":case"yr":case"y":return u*i;case"weeks":case"week":case"w":return u*s;case"days":case"day":case"d":return u*o;case"hours":case"hour":case"hrs":case"hr":case"h":return u*n;case"minutes":case"minute":case"mins":case"min":case"m":return u*r;case"seconds":case"second":case"secs":case"sec":case"s":return u*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return undefined}}function fmtShort(e){var s=Math.abs(e);if(s>=o){return Math.round(e/o)+"d"}if(s>=n){return Math.round(e/n)+"h"}if(s>=r){return Math.round(e/r)+"m"}if(s>=t){return Math.round(e/t)+"s"}return e+"ms"}function fmtLong(e){var s=Math.abs(e);if(s>=o){return plural(e,s,o,"day")}if(s>=n){return plural(e,s,n,"hour")}if(s>=r){return plural(e,s,r,"minute")}if(s>=t){return plural(e,s,t,"second")}return e+" ms"}function plural(e,t,r,n){var o=t>=r*1.5;return Math.round(e/r)+" "+n+(o?"s":"")}},414:function(e,t,r){"use strict";const n=r(857);const o=r(871);const s=process.env;let i;if(o("no-color")||o("no-colors")||o("color=false")){i=false}else if(o("color")||o("colors")||o("color=true")||o("color=always")){i=true}if("FORCE_COLOR"in s){i=s.FORCE_COLOR.length===0||parseInt(s.FORCE_COLOR,10)!==0}function translateLevel(e){if(e===0){return false}return{level:e,hasBasic:true,has256:e>=2,has16m:e>=3}}function supportsColor(e){if(i===false){return 0}if(o("color=16m")||o("color=full")||o("color=truecolor")){return 3}if(o("color=256")){return 2}if(e&&!e.isTTY&&i!==true){return 0}const t=i?1:0;if(process.platform==="win32"){const e=n.release().split(".");if(Number(process.versions.node.split(".")[0])>=8&&Number(e[0])>=10&&Number(e[2])>=10586){return Number(e[2])>=14931?3:2}return 1}if("CI"in s){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some((e=>e in s))||s.CI_NAME==="codeship"){return 1}return t}if("TEAMCITY_VERSION"in s){return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(s.TEAMCITY_VERSION)?1:0}if(s.COLORTERM==="truecolor"){return 3}if("TERM_PROGRAM"in s){const e=parseInt((s.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(s.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(s.TERM)){return 2}if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(s.TERM)){return 1}if("COLORTERM"in s){return 1}if(s.TERM==="dumb"){return t}return t}function getSupportLevel(e){const t=supportsColor(e);return translateLevel(t)}e.exports={supportsColor:getSupportLevel,stdout:getSupportLevel(process.stdout),stderr:getSupportLevel(process.stderr)}},982:function(e){"use strict";e.exports=require("crypto")},896:function(e){"use strict";e.exports=require("fs")},611:function(e){"use strict";e.exports=require("http")},692:function(e){"use strict";e.exports=require("https")},857:function(e){"use strict";e.exports=require("os")},480:function(e){"use strict";e.exports=require("querystring")},203:function(e){"use strict";e.exports=require("stream")},18:function(e){"use strict";e.exports=require("tty")},16:function(e){"use strict";e.exports=require("url")},23:function(e){"use strict";e.exports=require("util")},106:function(e){"use strict";e.exports=require("zlib")}};var t={};function __nccwpck_require__(r){var n=t[r];if(n!==undefined){return n.exports}var o=t[r]={exports:{}};var s=true;try{e[r].call(o.exports,o,o.exports,__nccwpck_require__);s=false}finally{if(s)delete t[r]}return o.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(252);module.exports=r})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@alicloud/tea-util","version":"1.4.9","description":"","main":"dist/client.js","scripts":{"test":"mocha -r ts-node/register -r source-map-support/register test/**/*.spec.ts","test-cov":"nyc -e .ts -r=html -r=text -r=lcov npm run test","build":"tsc","prepublishOnly":"tsc"},"author":"Jackson Tian","license":"Apache-2.0","devDependencies":{"@types/mocha":"^7.0.1","@types/node":"^12.12.26","mocha":"^7.0.1","nyc":"^15.0.0","source-map-support":"^0.5.16","ts-node":"^8.6.2","typescript":"^3.7.5"},"dependencies":{"@alicloud/tea-typescript":"^1.5.1","kitx":"^2.0.0"},"files":["dist","src"],"repository":"git@github.com:aliyun/tea-util.git","_lastModified":"2025-
|
|
1
|
+
{"name":"@alicloud/tea-util","version":"1.4.9","description":"","main":"dist/client.js","scripts":{"test":"mocha -r ts-node/register -r source-map-support/register test/**/*.spec.ts","test-cov":"nyc -e .ts -r=html -r=text -r=lcov npm run test","build":"tsc","prepublishOnly":"tsc"},"author":"Jackson Tian","license":"Apache-2.0","devDependencies":{"@types/mocha":"^7.0.1","@types/node":"^12.12.26","mocha":"^7.0.1","nyc":"^15.0.0","source-map-support":"^0.5.16","ts-node":"^8.6.2","typescript":"^3.7.5"},"dependencies":{"@alicloud/tea-typescript":"^1.5.1","kitx":"^2.0.0"},"files":["dist","src"],"repository":"git@github.com:aliyun/tea-util.git","_lastModified":"2025-08-02T21:30:57.851Z"}
|
|
@@ -10,9 +10,9 @@ case `uname` in
|
|
|
10
10
|
esac
|
|
11
11
|
|
|
12
12
|
if [ -z "$NODE_PATH" ]; then
|
|
13
|
-
export NODE_PATH="/home/runner/work/tego/tego/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/bin/node_modules:/home/runner/work/tego/tego/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/node_modules:/home/runner/work/tego/tego/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/node_modules:/home/runner/work/tego/tego/node_modules/.pnpm/uuid@9.0.1/node_modules:/home/runner/work/tego/tego/node_modules/.pnpm/node_modules"
|
|
13
|
+
export NODE_PATH="/home/runner/work/tego-standard/tego-standard/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/bin/node_modules:/home/runner/work/tego-standard/tego-standard/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/node_modules:/home/runner/work/tego-standard/tego-standard/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/node_modules:/home/runner/work/tego-standard/tego-standard/node_modules/.pnpm/uuid@9.0.1/node_modules:/home/runner/work/tego-standard/tego-standard/node_modules/.pnpm/node_modules"
|
|
14
14
|
else
|
|
15
|
-
export NODE_PATH="/home/runner/work/tego/tego/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/bin/node_modules:/home/runner/work/tego/tego/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/node_modules:/home/runner/work/tego/tego/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/node_modules:/home/runner/work/tego/tego/node_modules/.pnpm/uuid@9.0.1/node_modules:/home/runner/work/tego/tego/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
15
|
+
export NODE_PATH="/home/runner/work/tego-standard/tego-standard/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/bin/node_modules:/home/runner/work/tego-standard/tego-standard/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/node_modules:/home/runner/work/tego-standard/tego-standard/node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/node_modules:/home/runner/work/tego-standard/tego-standard/node_modules/.pnpm/uuid@9.0.1/node_modules:/home/runner/work/tego-standard/tego-standard/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
16
|
fi
|
|
17
17
|
if [ -x "$basedir/node" ]; then
|
|
18
18
|
exec "$basedir/node" "$basedir/../../../../../uuid@9.0.1/node_modules/uuid/dist/bin/uuid" "$@"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"tencentcloud-sdk-nodejs","version":"4.0.996","description":"腾讯云 API NODEJS SDK","main":"tencentcloud/index.js","scripts":{"test":"mocha -t 10000","build":"tsc","prettier":"prettier --config prettier.config.js --write 'src/**/*.{tsx,ts,jsx,js,css,json,vue}'"},"engines":{"node":">=10"},"keywords":["tencentcloudapi","tencentcloud","qcloud","sdk","js","nodejs"],"author":"tencentcloudapi","license":"Apache-2.0","dependencies":{"form-data":"^3.0.0","get-stream":"^6.0.0","https-proxy-agent":"^5.0.0","is-stream":"^2.0.0","json-bigint":"^1.0.0","node-fetch":"^2.2.0","tslib":"1.13.0","uuid":"^9.0.1"},"directories":{"example":"examples","lib":"lib"},"repository":{"type":"git","url":"https://github.com/tencentcloud/tencentcloud-sdk-nodejs"},"devDependencies":{"@types/form-data":"^2.5.0","@types/json-bigint":"^1.0.1","@types/node":"^14.0.26","@types/node-fetch":"^2.5.7","@types/uuid":"^9.0.8","@typescript-eslint/eslint-plugin":"^2.34.0","@typescript-eslint/parser":"^2.34.0","babel-eslint":"^10.0.2","chai":"^4.2.0","eslint":"^6.8.0","eslint-plugin-react":"^7.17.0","mocha":"^8.1.1","prettier":"^2.3.0","ts-node":"^8.10.2","typescript":"^3.9.7"},"_lastModified":"2025-
|
|
1
|
+
{"name":"tencentcloud-sdk-nodejs","version":"4.0.996","description":"腾讯云 API NODEJS SDK","main":"tencentcloud/index.js","scripts":{"test":"mocha -t 10000","build":"tsc","prettier":"prettier --config prettier.config.js --write 'src/**/*.{tsx,ts,jsx,js,css,json,vue}'"},"engines":{"node":">=10"},"keywords":["tencentcloudapi","tencentcloud","qcloud","sdk","js","nodejs"],"author":"tencentcloudapi","license":"Apache-2.0","dependencies":{"form-data":"^3.0.0","get-stream":"^6.0.0","https-proxy-agent":"^5.0.0","is-stream":"^2.0.0","json-bigint":"^1.0.0","node-fetch":"^2.2.0","tslib":"1.13.0","uuid":"^9.0.1"},"directories":{"example":"examples","lib":"lib"},"repository":{"type":"git","url":"https://github.com/tencentcloud/tencentcloud-sdk-nodejs"},"devDependencies":{"@types/form-data":"^2.5.0","@types/json-bigint":"^1.0.1","@types/node":"^14.0.26","@types/node-fetch":"^2.5.7","@types/uuid":"^9.0.8","@typescript-eslint/eslint-plugin":"^2.34.0","@typescript-eslint/parser":"^2.34.0","babel-eslint":"^10.0.2","chai":"^4.2.0","eslint":"^6.8.0","eslint-plugin-react":"^7.17.0","mocha":"^8.1.1","prettier":"^2.3.0","ts-node":"^8.10.2","typescript":"^3.9.7"},"_lastModified":"2025-08-02T21:31:01.357Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){var __webpack_modules__={99:function(e,t,s){"use strict";const r=s(12);r.createWebSocketStream=s(391);r.Server=s(186);r.Receiver=s(198);r.Sender=s(994);r.WebSocket=r;r.WebSocketServer=r.Server;e.exports=r},914:function(e,t,s){"use strict";const{EMPTY_BUFFER:r}=s(190);const n=Buffer[Symbol.species];function concat(e,t){if(e.length===0)return r;if(e.length===1)return e[0];const s=Buffer.allocUnsafe(t);let i=0;for(let t=0;t<e.length;t++){const r=e[t];s.set(r,i);i+=r.length}if(i<t){return new n(s.buffer,s.byteOffset,i)}return s}function _mask(e,t,s,r,n){for(let i=0;i<n;i++){s[r+i]=e[i]^t[i&3]}}function _unmask(e,t){for(let s=0;s<e.length;s++){e[s]^=t[s&3]}}function toArrayBuffer(e){if(e.length===e.buffer.byteLength){return e.buffer}return e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function toBuffer(e){toBuffer.readOnly=true;if(Buffer.isBuffer(e))return e;let t;if(e instanceof ArrayBuffer){t=new n(e)}else if(ArrayBuffer.isView(e)){t=new n(e.buffer,e.byteOffset,e.byteLength)}else{t=Buffer.from(e);toBuffer.readOnly=false}return t}e.exports={concat:concat,mask:_mask,toArrayBuffer:toArrayBuffer,toBuffer:toBuffer,unmask:_unmask};if(!process.env.WS_NO_BUFFER_UTIL){try{const t=s(653);e.exports.mask=function(e,s,r,n,i){if(i<48)_mask(e,s,r,n,i);else t.mask(e,s,r,n,i)};e.exports.unmask=function(e,s){if(e.length<32)_unmask(e,s);else t.unmask(e,s)}}catch(e){}}},190:function(e){"use strict";const t=["nodebuffer","arraybuffer","fragments"];const s=typeof Blob!=="undefined";if(s)t.push("blob");e.exports={BINARY_TYPES:t,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:s,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}},789:function(e,t,s){"use strict";const{kForOnEventAttribute:r,kListener:n}=s(190);const i=Symbol("kCode");const o=Symbol("kData");const a=Symbol("kError");const c=Symbol("kMessage");const l=Symbol("kReason");const f=Symbol("kTarget");const h=Symbol("kType");const u=Symbol("kWasClean");class Event{constructor(e){this[f]=null;this[h]=e}get target(){return this[f]}get type(){return this[h]}}Object.defineProperty(Event.prototype,"target",{enumerable:true});Object.defineProperty(Event.prototype,"type",{enumerable:true});class CloseEvent extends Event{constructor(e,t={}){super(e);this[i]=t.code===undefined?0:t.code;this[l]=t.reason===undefined?"":t.reason;this[u]=t.wasClean===undefined?false:t.wasClean}get code(){return this[i]}get reason(){return this[l]}get wasClean(){return this[u]}}Object.defineProperty(CloseEvent.prototype,"code",{enumerable:true});Object.defineProperty(CloseEvent.prototype,"reason",{enumerable:true});Object.defineProperty(CloseEvent.prototype,"wasClean",{enumerable:true});class ErrorEvent extends Event{constructor(e,t={}){super(e);this[a]=t.error===undefined?null:t.error;this[c]=t.message===undefined?"":t.message}get error(){return this[a]}get message(){return this[c]}}Object.defineProperty(ErrorEvent.prototype,"error",{enumerable:true});Object.defineProperty(ErrorEvent.prototype,"message",{enumerable:true});class MessageEvent extends Event{constructor(e,t={}){super(e);this[o]=t.data===undefined?null:t.data}get data(){return this[o]}}Object.defineProperty(MessageEvent.prototype,"data",{enumerable:true});const d={addEventListener(e,t,s={}){for(const i of this.listeners(e)){if(!s[r]&&i[n]===t&&!i[r]){return}}let i;if(e==="message"){i=function onMessage(e,s){const r=new MessageEvent("message",{data:s?e:e.toString()});r[f]=this;callListener(t,this,r)}}else if(e==="close"){i=function onClose(e,s){const r=new CloseEvent("close",{code:e,reason:s.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[f]=this;callListener(t,this,r)}}else if(e==="error"){i=function onError(e){const s=new ErrorEvent("error",{error:e,message:e.message});s[f]=this;callListener(t,this,s)}}else if(e==="open"){i=function onOpen(){const e=new Event("open");e[f]=this;callListener(t,this,e)}}else{return}i[r]=!!s[r];i[n]=t;if(s.once){this.once(e,i)}else{this.on(e,i)}},removeEventListener(e,t){for(const s of this.listeners(e)){if(s[n]===t&&!s[r]){this.removeListener(e,s);break}}}};e.exports={CloseEvent:CloseEvent,ErrorEvent:ErrorEvent,Event:Event,EventTarget:d,MessageEvent:MessageEvent};function callListener(e,t,s){if(typeof e==="object"&&e.handleEvent){e.handleEvent.call(e,s)}else{e.call(t,s)}}},966:function(e,t,s){"use strict";const{tokenChars:r}=s(408);function push(e,t,s){if(e[t]===undefined)e[t]=[s];else e[t].push(s)}function parse(e){const t=Object.create(null);let s=Object.create(null);let n=false;let i=false;let o=false;let a;let c;let l=-1;let f=-1;let h=-1;let u=0;for(;u<e.length;u++){f=e.charCodeAt(u);if(a===undefined){if(h===-1&&r[f]===1){if(l===-1)l=u}else if(u!==0&&(f===32||f===9)){if(h===-1&&l!==-1)h=u}else if(f===59||f===44){if(l===-1){throw new SyntaxError(`Unexpected character at index ${u}`)}if(h===-1)h=u;const r=e.slice(l,h);if(f===44){push(t,r,s);s=Object.create(null)}else{a=r}l=h=-1}else{throw new SyntaxError(`Unexpected character at index ${u}`)}}else if(c===undefined){if(h===-1&&r[f]===1){if(l===-1)l=u}else if(f===32||f===9){if(h===-1&&l!==-1)h=u}else if(f===59||f===44){if(l===-1){throw new SyntaxError(`Unexpected character at index ${u}`)}if(h===-1)h=u;push(s,e.slice(l,h),true);if(f===44){push(t,a,s);s=Object.create(null);a=undefined}l=h=-1}else if(f===61&&l!==-1&&h===-1){c=e.slice(l,u);l=h=-1}else{throw new SyntaxError(`Unexpected character at index ${u}`)}}else{if(i){if(r[f]!==1){throw new SyntaxError(`Unexpected character at index ${u}`)}if(l===-1)l=u;else if(!n)n=true;i=false}else if(o){if(r[f]===1){if(l===-1)l=u}else if(f===34&&l!==-1){o=false;h=u}else if(f===92){i=true}else{throw new SyntaxError(`Unexpected character at index ${u}`)}}else if(f===34&&e.charCodeAt(u-1)===61){o=true}else if(h===-1&&r[f]===1){if(l===-1)l=u}else if(l!==-1&&(f===32||f===9)){if(h===-1)h=u}else if(f===59||f===44){if(l===-1){throw new SyntaxError(`Unexpected character at index ${u}`)}if(h===-1)h=u;let r=e.slice(l,h);if(n){r=r.replace(/\\/g,"");n=false}push(s,c,r);if(f===44){push(t,a,s);s=Object.create(null);a=undefined}c=undefined;l=h=-1}else{throw new SyntaxError(`Unexpected character at index ${u}`)}}}if(l===-1||o||f===32||f===9){throw new SyntaxError("Unexpected end of input")}if(h===-1)h=u;const d=e.slice(l,h);if(a===undefined){push(t,d,s)}else{if(c===undefined){push(s,d,true)}else if(n){push(s,c,d.replace(/\\/g,""))}else{push(s,c,d)}push(t,a,s)}return t}function format(e){return Object.keys(e).map((t=>{let s=e[t];if(!Array.isArray(s))s=[s];return s.map((e=>[t].concat(Object.keys(e).map((t=>{let s=e[t];if(!Array.isArray(s))s=[s];return s.map((e=>e===true?t:`${t}=${e}`)).join("; ")}))).join("; "))).join(", ")})).join(", ")}e.exports={format:format,parse:parse}},207:function(e){"use strict";const t=Symbol("kDone");const s=Symbol("kRun");class Limiter{constructor(e){this[t]=()=>{this.pending--;this[s]()};this.concurrency=e||Infinity;this.jobs=[];this.pending=0}add(e){this.jobs.push(e);this[s]()}[s](){if(this.pending===this.concurrency)return;if(this.jobs.length){const e=this.jobs.shift();this.pending++;e(this[t])}}}e.exports=Limiter},843:function(e,t,s){"use strict";const r=s(106);const n=s(914);const i=s(207);const{kStatusCode:o}=s(190);const a=Buffer[Symbol.species];const c=Buffer.from([0,0,255,255]);const l=Symbol("permessage-deflate");const f=Symbol("total-length");const h=Symbol("callback");const u=Symbol("buffers");const d=Symbol("error");let _;class PerMessageDeflate{constructor(e,t,s){this._maxPayload=s|0;this._options=e||{};this._threshold=this._options.threshold!==undefined?this._options.threshold:1024;this._isServer=!!t;this._deflate=null;this._inflate=null;this.params=null;if(!_){const e=this._options.concurrencyLimit!==undefined?this._options.concurrencyLimit:10;_=new i(e)}}static get extensionName(){return"permessage-deflate"}offer(){const e={};if(this._options.serverNoContextTakeover){e.server_no_context_takeover=true}if(this._options.clientNoContextTakeover){e.client_no_context_takeover=true}if(this._options.serverMaxWindowBits){e.server_max_window_bits=this._options.serverMaxWindowBits}if(this._options.clientMaxWindowBits){e.client_max_window_bits=this._options.clientMaxWindowBits}else if(this._options.clientMaxWindowBits==null){e.client_max_window_bits=true}return e}accept(e){e=this.normalizeParams(e);this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e);return this.params}cleanup(){if(this._inflate){this._inflate.close();this._inflate=null}if(this._deflate){const e=this._deflate[h];this._deflate.close();this._deflate=null;if(e){e(new Error("The deflate stream was closed while data was being processed"))}}}acceptAsServer(e){const t=this._options;const s=e.find((e=>{if(t.serverNoContextTakeover===false&&e.server_no_context_takeover||e.server_max_window_bits&&(t.serverMaxWindowBits===false||typeof t.serverMaxWindowBits==="number"&&t.serverMaxWindowBits>e.server_max_window_bits)||typeof t.clientMaxWindowBits==="number"&&!e.client_max_window_bits){return false}return true}));if(!s){throw new Error("None of the extension offers can be accepted")}if(t.serverNoContextTakeover){s.server_no_context_takeover=true}if(t.clientNoContextTakeover){s.client_no_context_takeover=true}if(typeof t.serverMaxWindowBits==="number"){s.server_max_window_bits=t.serverMaxWindowBits}if(typeof t.clientMaxWindowBits==="number"){s.client_max_window_bits=t.clientMaxWindowBits}else if(s.client_max_window_bits===true||t.clientMaxWindowBits===false){delete s.client_max_window_bits}return s}acceptAsClient(e){const t=e[0];if(this._options.clientNoContextTakeover===false&&t.client_no_context_takeover){throw new Error('Unexpected parameter "client_no_context_takeover"')}if(!t.client_max_window_bits){if(typeof this._options.clientMaxWindowBits==="number"){t.client_max_window_bits=this._options.clientMaxWindowBits}}else if(this._options.clientMaxWindowBits===false||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){e.forEach((e=>{Object.keys(e).forEach((t=>{let s=e[t];if(s.length>1){throw new Error(`Parameter "${t}" must have only a single value`)}s=s[0];if(t==="client_max_window_bits"){if(s!==true){const e=+s;if(!Number.isInteger(e)||e<8||e>15){throw new TypeError(`Invalid value for parameter "${t}": ${s}`)}s=e}else if(!this._isServer){throw new TypeError(`Invalid value for parameter "${t}": ${s}`)}}else if(t==="server_max_window_bits"){const e=+s;if(!Number.isInteger(e)||e<8||e>15){throw new TypeError(`Invalid value for parameter "${t}": ${s}`)}s=e}else if(t==="client_no_context_takeover"||t==="server_no_context_takeover"){if(s!==true){throw new TypeError(`Invalid value for parameter "${t}": ${s}`)}}else{throw new Error(`Unknown parameter "${t}"`)}e[t]=s}))}));return e}decompress(e,t,s){_.add((r=>{this._decompress(e,t,((e,t)=>{r();s(e,t)}))}))}compress(e,t,s){_.add((r=>{this._compress(e,t,((e,t)=>{r();s(e,t)}))}))}_decompress(e,t,s){const i=this._isServer?"client":"server";if(!this._inflate){const e=`${i}_max_window_bits`;const t=typeof this.params[e]!=="number"?r.Z_DEFAULT_WINDOWBITS:this.params[e];this._inflate=r.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t});this._inflate[l]=this;this._inflate[f]=0;this._inflate[u]=[];this._inflate.on("error",inflateOnError);this._inflate.on("data",inflateOnData)}this._inflate[h]=s;this._inflate.write(e);if(t)this._inflate.write(c);this._inflate.flush((()=>{const e=this._inflate[d];if(e){this._inflate.close();this._inflate=null;s(e);return}const r=n.concat(this._inflate[u],this._inflate[f]);if(this._inflate._readableState.endEmitted){this._inflate.close();this._inflate=null}else{this._inflate[f]=0;this._inflate[u]=[];if(t&&this.params[`${i}_no_context_takeover`]){this._inflate.reset()}}s(null,r)}))}_compress(e,t,s){const i=this._isServer?"server":"client";if(!this._deflate){const e=`${i}_max_window_bits`;const t=typeof this.params[e]!=="number"?r.Z_DEFAULT_WINDOWBITS:this.params[e];this._deflate=r.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t});this._deflate[f]=0;this._deflate[u]=[];this._deflate.on("data",deflateOnData)}this._deflate[h]=s;this._deflate.write(e);this._deflate.flush(r.Z_SYNC_FLUSH,(()=>{if(!this._deflate){return}let e=n.concat(this._deflate[u],this._deflate[f]);if(t){e=new a(e.buffer,e.byteOffset,e.length-4)}this._deflate[h]=null;this._deflate[f]=0;this._deflate[u]=[];if(t&&this.params[`${i}_no_context_takeover`]){this._deflate.reset()}s(null,e)}))}}e.exports=PerMessageDeflate;function deflateOnData(e){this[u].push(e);this[f]+=e.length}function inflateOnData(e){this[f]+=e.length;if(this[l]._maxPayload<1||this[f]<=this[l]._maxPayload){this[u].push(e);return}this[d]=new RangeError("Max payload size exceeded");this[d].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH";this[d][o]=1009;this.removeListener("data",inflateOnData);this.reset()}function inflateOnError(e){this[l]._inflate=null;e[o]=1007;this[h](e)}},198:function(e,t,s){"use strict";const{Writable:r}=s(203);const n=s(843);const{BINARY_TYPES:i,EMPTY_BUFFER:o,kStatusCode:a,kWebSocket:c}=s(190);const{concat:l,toArrayBuffer:f,unmask:h}=s(914);const{isValidStatusCode:u,isValidUTF8:d}=s(408);const _=Buffer[Symbol.species];const p=0;const m=1;const b=2;const S=3;const y=4;const k=5;const g=6;class Receiver extends r{constructor(e={}){super();this._allowSynchronousEvents=e.allowSynchronousEvents!==undefined?e.allowSynchronousEvents:true;this._binaryType=e.binaryType||i[0];this._extensions=e.extensions||{};this._isServer=!!e.isServer;this._maxPayload=e.maxPayload|0;this._skipUTF8Validation=!!e.skipUTF8Validation;this[c]=undefined;this._bufferedBytes=0;this._buffers=[];this._compressed=false;this._payloadLength=0;this._mask=undefined;this._fragmented=0;this._masked=false;this._fin=false;this._opcode=0;this._totalPayloadLength=0;this._messageLength=0;this._fragments=[];this._errored=false;this._loop=false;this._state=p}_write(e,t,s){if(this._opcode===8&&this._state==p)return s();this._bufferedBytes+=e.length;this._buffers.push(e);this.startLoop(s)}consume(e){this._bufferedBytes-=e;if(e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){const t=this._buffers[0];this._buffers[0]=new _(t.buffer,t.byteOffset+e,t.length-e);return new _(t.buffer,t.byteOffset,e)}const t=Buffer.allocUnsafe(e);do{const s=this._buffers[0];const r=t.length-e;if(e>=s.length){t.set(this._buffers.shift(),r)}else{t.set(new Uint8Array(s.buffer,s.byteOffset,e),r);this._buffers[0]=new _(s.buffer,s.byteOffset+e,s.length-e)}e-=s.length}while(e>0);return t}startLoop(e){this._loop=true;do{switch(this._state){case p:this.getInfo(e);break;case m:this.getPayloadLength16(e);break;case b:this.getPayloadLength64(e);break;case S:this.getMask();break;case y:this.getData(e);break;case k:case g:this._loop=false;return}}while(this._loop);if(!this._errored)e()}getInfo(e){if(this._bufferedBytes<2){this._loop=false;return}const t=this.consume(2);if((t[0]&48)!==0){const t=this.createError(RangeError,"RSV2 and RSV3 must be clear",true,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(t);return}const s=(t[0]&64)===64;if(s&&!this._extensions[n.extensionName]){const t=this.createError(RangeError,"RSV1 must be clear",true,1002,"WS_ERR_UNEXPECTED_RSV_1");e(t);return}this._fin=(t[0]&128)===128;this._opcode=t[0]&15;this._payloadLength=t[1]&127;if(this._opcode===0){if(s){const t=this.createError(RangeError,"RSV1 must be clear",true,1002,"WS_ERR_UNEXPECTED_RSV_1");e(t);return}if(!this._fragmented){const t=this.createError(RangeError,"invalid opcode 0",true,1002,"WS_ERR_INVALID_OPCODE");e(t);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){const t=this.createError(RangeError,`invalid opcode ${this._opcode}`,true,1002,"WS_ERR_INVALID_OPCODE");e(t);return}this._compressed=s}else if(this._opcode>7&&this._opcode<11){if(!this._fin){const t=this.createError(RangeError,"FIN must be set",true,1002,"WS_ERR_EXPECTED_FIN");e(t);return}if(s){const t=this.createError(RangeError,"RSV1 must be clear",true,1002,"WS_ERR_UNEXPECTED_RSV_1");e(t);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){const t=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,true,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(t);return}}else{const t=this.createError(RangeError,`invalid opcode ${this._opcode}`,true,1002,"WS_ERR_INVALID_OPCODE");e(t);return}if(!this._fin&&!this._fragmented)this._fragmented=this._opcode;this._masked=(t[1]&128)===128;if(this._isServer){if(!this._masked){const t=this.createError(RangeError,"MASK must be set",true,1002,"WS_ERR_EXPECTED_MASK");e(t);return}}else if(this._masked){const t=this.createError(RangeError,"MASK must be clear",true,1002,"WS_ERR_UNEXPECTED_MASK");e(t);return}if(this._payloadLength===126)this._state=m;else if(this._payloadLength===127)this._state=b;else this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=false;return}this._payloadLength=this.consume(2).readUInt16BE(0);this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=false;return}const t=this.consume(8);const s=t.readUInt32BE(0);if(s>Math.pow(2,53-32)-1){const t=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",false,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(t);return}this._payloadLength=s*Math.pow(2,32)+t.readUInt32BE(4);this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8){this._totalPayloadLength+=this._payloadLength;if(this._totalPayloadLength>this._maxPayload&&this._maxPayload>0){const t=this.createError(RangeError,"Max payload size exceeded",false,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(t);return}}if(this._masked)this._state=S;else this._state=y}getMask(){if(this._bufferedBytes<4){this._loop=false;return}this._mask=this.consume(4);this._state=y}getData(e){let t=o;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=false;return}t=this.consume(this._payloadLength);if(this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0){h(t,this._mask)}}if(this._opcode>7){this.controlMessage(t,e);return}if(this._compressed){this._state=k;this.decompress(t,e);return}if(t.length){this._messageLength=this._totalPayloadLength;this._fragments.push(t)}this.dataMessage(e)}decompress(e,t){const s=this._extensions[n.extensionName];s.decompress(e,this._fin,((e,s)=>{if(e)return t(e);if(s.length){this._messageLength+=s.length;if(this._messageLength>this._maxPayload&&this._maxPayload>0){const e=this.createError(RangeError,"Max payload size exceeded",false,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(e);return}this._fragments.push(s)}this.dataMessage(t);if(this._state===p)this.startLoop(t)}))}dataMessage(e){if(!this._fin){this._state=p;return}const t=this._messageLength;const s=this._fragments;this._totalPayloadLength=0;this._messageLength=0;this._fragmented=0;this._fragments=[];if(this._opcode===2){let r;if(this._binaryType==="nodebuffer"){r=l(s,t)}else if(this._binaryType==="arraybuffer"){r=f(l(s,t))}else if(this._binaryType==="blob"){r=new Blob(s)}else{r=s}if(this._allowSynchronousEvents){this.emit("message",r,true);this._state=p}else{this._state=g;setImmediate((()=>{this.emit("message",r,true);this._state=p;this.startLoop(e)}))}}else{const r=l(s,t);if(!this._skipUTF8Validation&&!d(r)){const t=this.createError(Error,"invalid UTF-8 sequence",true,1007,"WS_ERR_INVALID_UTF8");e(t);return}if(this._state===k||this._allowSynchronousEvents){this.emit("message",r,false);this._state=p}else{this._state=g;setImmediate((()=>{this.emit("message",r,false);this._state=p;this.startLoop(e)}))}}}controlMessage(e,t){if(this._opcode===8){if(e.length===0){this._loop=false;this.emit("conclude",1005,o);this.end()}else{const s=e.readUInt16BE(0);if(!u(s)){const e=this.createError(RangeError,`invalid status code ${s}`,true,1002,"WS_ERR_INVALID_CLOSE_CODE");t(e);return}const r=new _(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!d(r)){const e=this.createError(Error,"invalid UTF-8 sequence",true,1007,"WS_ERR_INVALID_UTF8");t(e);return}this._loop=false;this.emit("conclude",s,r);this.end()}this._state=p;return}if(this._allowSynchronousEvents){this.emit(this._opcode===9?"ping":"pong",e);this._state=p}else{this._state=g;setImmediate((()=>{this.emit(this._opcode===9?"ping":"pong",e);this._state=p;this.startLoop(t)}))}}createError(e,t,s,r,n){this._loop=false;this._errored=true;const i=new e(s?`Invalid WebSocket frame: ${t}`:t);Error.captureStackTrace(i,this.createError);i.code=n;i[a]=r;return i}}e.exports=Receiver},994:function(e,t,s){"use strict";const{Duplex:r}=s(203);const{randomFillSync:n}=s(982);const i=s(843);const{EMPTY_BUFFER:o,kWebSocket:a,NOOP:c}=s(190);const{isBlob:l,isValidStatusCode:f}=s(408);const{mask:h,toBuffer:u}=s(914);const d=Symbol("kByteLength");const _=Buffer.alloc(4);const p=8*1024;let m;let b=p;const S=0;const y=1;const k=2;class Sender{constructor(e,t,s){this._extensions=t||{};if(s){this._generateMask=s;this._maskBuffer=Buffer.alloc(4)}this._socket=e;this._firstFragment=true;this._compress=false;this._bufferedBytes=0;this._queue=[];this._state=S;this.onerror=c;this[a]=undefined}static frame(e,t){let s;let r=false;let i=2;let o=false;if(t.mask){s=t.maskBuffer||_;if(t.generateMask){t.generateMask(s)}else{if(b===p){if(m===undefined){m=Buffer.alloc(p)}n(m,0,p);b=0}s[0]=m[b++];s[1]=m[b++];s[2]=m[b++];s[3]=m[b++]}o=(s[0]|s[1]|s[2]|s[3])===0;i=6}let a;if(typeof e==="string"){if((!t.mask||o)&&t[d]!==undefined){a=t[d]}else{e=Buffer.from(e);a=e.length}}else{a=e.length;r=t.mask&&t.readOnly&&!o}let c=a;if(a>=65536){i+=8;c=127}else if(a>125){i+=2;c=126}const l=Buffer.allocUnsafe(r?a+i:i);l[0]=t.fin?t.opcode|128:t.opcode;if(t.rsv1)l[0]|=64;l[1]=c;if(c===126){l.writeUInt16BE(a,2)}else if(c===127){l[2]=l[3]=0;l.writeUIntBE(a,4,6)}if(!t.mask)return[l,e];l[1]|=128;l[i-4]=s[0];l[i-3]=s[1];l[i-2]=s[2];l[i-1]=s[3];if(o)return[l,e];if(r){h(e,s,l,i,a);return[l]}h(e,s,e,0,a);return[l,e]}close(e,t,s,r){let n;if(e===undefined){n=o}else if(typeof e!=="number"||!f(e)){throw new TypeError("First argument must be a valid error code number")}else if(t===undefined||!t.length){n=Buffer.allocUnsafe(2);n.writeUInt16BE(e,0)}else{const s=Buffer.byteLength(t);if(s>123){throw new RangeError("The message must not be greater than 123 bytes")}n=Buffer.allocUnsafe(2+s);n.writeUInt16BE(e,0);if(typeof t==="string"){n.write(t,2)}else{n.set(t,2)}}const i={[d]:n.length,fin:true,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:8,readOnly:false,rsv1:false};if(this._state!==S){this.enqueue([this.dispatch,n,false,i,r])}else{this.sendFrame(Sender.frame(n,i),r)}}ping(e,t,s){let r;let n;if(typeof e==="string"){r=Buffer.byteLength(e);n=false}else if(l(e)){r=e.size;n=false}else{e=u(e);r=e.length;n=u.readOnly}if(r>125){throw new RangeError("The data size must not be greater than 125 bytes")}const i={[d]:r,fin:true,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:9,readOnly:n,rsv1:false};if(l(e)){if(this._state!==S){this.enqueue([this.getBlobData,e,false,i,s])}else{this.getBlobData(e,false,i,s)}}else if(this._state!==S){this.enqueue([this.dispatch,e,false,i,s])}else{this.sendFrame(Sender.frame(e,i),s)}}pong(e,t,s){let r;let n;if(typeof e==="string"){r=Buffer.byteLength(e);n=false}else if(l(e)){r=e.size;n=false}else{e=u(e);r=e.length;n=u.readOnly}if(r>125){throw new RangeError("The data size must not be greater than 125 bytes")}const i={[d]:r,fin:true,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:10,readOnly:n,rsv1:false};if(l(e)){if(this._state!==S){this.enqueue([this.getBlobData,e,false,i,s])}else{this.getBlobData(e,false,i,s)}}else if(this._state!==S){this.enqueue([this.dispatch,e,false,i,s])}else{this.sendFrame(Sender.frame(e,i),s)}}send(e,t,s){const r=this._extensions[i.extensionName];let n=t.binary?2:1;let o=t.compress;let a;let c;if(typeof e==="string"){a=Buffer.byteLength(e);c=false}else if(l(e)){a=e.size;c=false}else{e=u(e);a=e.length;c=u.readOnly}if(this._firstFragment){this._firstFragment=false;if(o&&r&&r.params[r._isServer?"server_no_context_takeover":"client_no_context_takeover"]){o=a>=r._threshold}this._compress=o}else{o=false;n=0}if(t.fin)this._firstFragment=true;const f={[d]:a,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:c,rsv1:o};if(l(e)){if(this._state!==S){this.enqueue([this.getBlobData,e,this._compress,f,s])}else{this.getBlobData(e,this._compress,f,s)}}else if(this._state!==S){this.enqueue([this.dispatch,e,this._compress,f,s])}else{this.dispatch(e,this._compress,f,s)}}getBlobData(e,t,s,r){this._bufferedBytes+=s[d];this._state=k;e.arrayBuffer().then((e=>{if(this._socket.destroyed){const e=new Error("The socket was closed while the blob was being read");process.nextTick(callCallbacks,this,e,r);return}this._bufferedBytes-=s[d];const n=u(e);if(!t){this._state=S;this.sendFrame(Sender.frame(n,s),r);this.dequeue()}else{this.dispatch(n,t,s,r)}})).catch((e=>{process.nextTick(onError,this,e,r)}))}dispatch(e,t,s,r){if(!t){this.sendFrame(Sender.frame(e,s),r);return}const n=this._extensions[i.extensionName];this._bufferedBytes+=s[d];this._state=y;n.compress(e,s.fin,((e,t)=>{if(this._socket.destroyed){const e=new Error("The socket was closed while data was being compressed");callCallbacks(this,e,r);return}this._bufferedBytes-=s[d];this._state=S;s.readOnly=false;this.sendFrame(Sender.frame(t,s),r);this.dequeue()}))}dequeue(){while(this._state===S&&this._queue.length){const e=this._queue.shift();this._bufferedBytes-=e[3][d];Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][d];this._queue.push(e)}sendFrame(e,t){if(e.length===2){this._socket.cork();this._socket.write(e[0]);this._socket.write(e[1],t);this._socket.uncork()}else{this._socket.write(e[0],t)}}}e.exports=Sender;function callCallbacks(e,t,s){if(typeof s==="function")s(t);for(let s=0;s<e._queue.length;s++){const r=e._queue[s];const n=r[r.length-1];if(typeof n==="function")n(t)}}function onError(e,t,s){callCallbacks(e,t,s);e.onerror(t)}},391:function(e,t,s){"use strict";const{Duplex:r}=s(203);function emitClose(e){e.emit("close")}function duplexOnEnd(){if(!this.destroyed&&this._writableState.finished){this.destroy()}}function duplexOnError(e){this.removeListener("error",duplexOnError);this.destroy();if(this.listenerCount("error")===0){this.emit("error",e)}}function createWebSocketStream(e,t){let s=true;const n=new r({...t,autoDestroy:false,emitClose:false,objectMode:false,writableObjectMode:false});e.on("message",(function message(t,s){const r=!s&&n._readableState.objectMode?t.toString():t;if(!n.push(r))e.pause()}));e.once("error",(function error(e){if(n.destroyed)return;s=false;n.destroy(e)}));e.once("close",(function close(){if(n.destroyed)return;n.push(null)}));n._destroy=function(t,r){if(e.readyState===e.CLOSED){r(t);process.nextTick(emitClose,n);return}let i=false;e.once("error",(function error(e){i=true;r(e)}));e.once("close",(function close(){if(!i)r(t);process.nextTick(emitClose,n)}));if(s)e.terminate()};n._final=function(t){if(e.readyState===e.CONNECTING){e.once("open",(function open(){n._final(t)}));return}if(e._socket===null)return;if(e._socket._writableState.finished){t();if(n._readableState.endEmitted)n.destroy()}else{e._socket.once("finish",(function finish(){t()}));e.close()}};n._read=function(){if(e.isPaused)e.resume()};n._write=function(t,s,r){if(e.readyState===e.CONNECTING){e.once("open",(function open(){n._write(t,s,r)}));return}e.send(t,r)};n.on("end",duplexOnEnd);n.on("error",duplexOnError);return n}e.exports=createWebSocketStream},189:function(e,t,s){"use strict";const{tokenChars:r}=s(408);function parse(e){const t=new Set;let s=-1;let n=-1;let i=0;for(i;i<e.length;i++){const o=e.charCodeAt(i);if(n===-1&&r[o]===1){if(s===-1)s=i}else if(i!==0&&(o===32||o===9)){if(n===-1&&s!==-1)n=i}else if(o===44){if(s===-1){throw new SyntaxError(`Unexpected character at index ${i}`)}if(n===-1)n=i;const r=e.slice(s,n);if(t.has(r)){throw new SyntaxError(`The "${r}" subprotocol is duplicated`)}t.add(r);s=n=-1}else{throw new SyntaxError(`Unexpected character at index ${i}`)}}if(s===-1||n!==-1){throw new SyntaxError("Unexpected end of input")}const o=e.slice(s,i);if(t.has(o)){throw new SyntaxError(`The "${o}" subprotocol is duplicated`)}t.add(o);return t}e.exports={parse:parse}},408:function(e,t,s){"use strict";const{isUtf8:r}=s(181);const{hasBlob:n}=s(190);const i=[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 isValidStatusCode(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function _isValidUTF8(e){const t=e.length;let s=0;while(s<t){if((e[s]&128)===0){s++}else if((e[s]&224)===192){if(s+1===t||(e[s+1]&192)!==128||(e[s]&254)===192){return false}s+=2}else if((e[s]&240)===224){if(s+2>=t||(e[s+1]&192)!==128||(e[s+2]&192)!==128||e[s]===224&&(e[s+1]&224)===128||e[s]===237&&(e[s+1]&224)===160){return false}s+=3}else if((e[s]&248)===240){if(s+3>=t||(e[s+1]&192)!==128||(e[s+2]&192)!==128||(e[s+3]&192)!==128||e[s]===240&&(e[s+1]&240)===128||e[s]===244&&e[s+1]>143||e[s]>244){return false}s+=4}else{return false}}return true}function isBlob(e){return n&&typeof e==="object"&&typeof e.arrayBuffer==="function"&&typeof e.type==="string"&&typeof e.stream==="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}e.exports={isBlob:isBlob,isValidStatusCode:isValidStatusCode,isValidUTF8:_isValidUTF8,tokenChars:i};if(r){e.exports.isValidUTF8=function(e){return e.length<24?_isValidUTF8(e):r(e)}}else if(!process.env.WS_NO_UTF_8_VALIDATE){try{const t=s(4);e.exports.isValidUTF8=function(e){return e.length<32?_isValidUTF8(e):t(e)}}catch(e){}}},186:function(e,t,s){"use strict";const r=s(434);const n=s(611);const{Duplex:i}=s(203);const{createHash:o}=s(982);const a=s(966);const c=s(843);const l=s(189);const f=s(12);const{GUID:h,kWebSocket:u}=s(190);const d=/^[+/0-9A-Za-z]{22}==$/;const _=0;const p=1;const m=2;class WebSocketServer extends r{constructor(e,t){super();e={allowSynchronousEvents:true,autoPong:true,maxPayload:100*1024*1024,skipUTF8Validation:false,perMessageDeflate:false,handleProtocols:null,clientTracking:true,verifyClient:null,noServer:false,backlog:null,server:null,host:null,path:null,port:null,WebSocket:f,...e};if(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=n.createServer(((e,t)=>{const s=n.STATUS_CODES[426];t.writeHead(426,{"Content-Length":s.length,"Content-Type":"text/plain"});t.end(s)}));this._server.listen(e.port,e.host,e.backlog,t)}else if(e.server){this._server=e.server}if(this._server){const e=this.emit.bind(this,"connection");this._removeListeners=addListeners(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(t,s,r)=>{this.handleUpgrade(t,s,r,e)}})}if(e.perMessageDeflate===true)e.perMessageDeflate={};if(e.clientTracking){this.clients=new Set;this._shouldEmitClose=false}this.options=e;this._state=_}address(){if(this.options.noServer){throw new Error('The server is operating in "noServer" mode')}if(!this._server)return null;return this._server.address()}close(e){if(this._state===m){if(e){this.once("close",(()=>{e(new Error("The server is not running"))}))}process.nextTick(emitClose,this);return}if(e)this.once("close",e);if(this._state===p)return;this._state=p;if(this.options.noServer||this.options.server){if(this._server){this._removeListeners();this._removeListeners=this._server=null}if(this.clients){if(!this.clients.size){process.nextTick(emitClose,this)}else{this._shouldEmitClose=true}}else{process.nextTick(emitClose,this)}}else{const e=this._server;this._removeListeners();this._removeListeners=this._server=null;e.close((()=>{emitClose(this)}))}}shouldHandle(e){if(this.options.path){const t=e.url.indexOf("?");const s=t!==-1?e.url.slice(0,t):e.url;if(s!==this.options.path)return false}return true}handleUpgrade(e,t,s,r){t.on("error",socketOnError);const n=e.headers["sec-websocket-key"];const i=e.headers.upgrade;const o=+e.headers["sec-websocket-version"];if(e.method!=="GET"){const s="Invalid HTTP method";abortHandshakeOrEmitwsClientError(this,e,t,405,s);return}if(i===undefined||i.toLowerCase()!=="websocket"){const s="Invalid Upgrade header";abortHandshakeOrEmitwsClientError(this,e,t,400,s);return}if(n===undefined||!d.test(n)){const s="Missing or invalid Sec-WebSocket-Key header";abortHandshakeOrEmitwsClientError(this,e,t,400,s);return}if(o!==8&&o!==13){const s="Missing or invalid Sec-WebSocket-Version header";abortHandshakeOrEmitwsClientError(this,e,t,400,s);return}if(!this.shouldHandle(e)){abortHandshake(t,400);return}const f=e.headers["sec-websocket-protocol"];let h=new Set;if(f!==undefined){try{h=l.parse(f)}catch(s){const r="Invalid Sec-WebSocket-Protocol header";abortHandshakeOrEmitwsClientError(this,e,t,400,r);return}}const u=e.headers["sec-websocket-extensions"];const _={};if(this.options.perMessageDeflate&&u!==undefined){const s=new c(this.options.perMessageDeflate,true,this.options.maxPayload);try{const e=a.parse(u);if(e[c.extensionName]){s.accept(e[c.extensionName]);_[c.extensionName]=s}}catch(s){const r="Invalid or unacceptable Sec-WebSocket-Extensions header";abortHandshakeOrEmitwsClientError(this,e,t,400,r);return}}if(this.options.verifyClient){const i={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(i,((i,o,a,c)=>{if(!i){return abortHandshake(t,o||401,a,c)}this.completeUpgrade(_,n,h,e,t,s,r)}));return}if(!this.options.verifyClient(i))return abortHandshake(t,401)}this.completeUpgrade(_,n,h,e,t,s,r)}completeUpgrade(e,t,s,r,n,i,l){if(!n.readable||!n.writable)return n.destroy();if(n[u]){throw new Error("server.handleUpgrade() was called more than once with the same "+"socket, possibly due to a misconfiguration")}if(this._state>_)return abortHandshake(n,503);const f=o("sha1").update(t+h).digest("base64");const d=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${f}`];const p=new this.options.WebSocket(null,undefined,this.options);if(s.size){const e=this.options.handleProtocols?this.options.handleProtocols(s,r):s.values().next().value;if(e){d.push(`Sec-WebSocket-Protocol: ${e}`);p._protocol=e}}if(e[c.extensionName]){const t=e[c.extensionName].params;const s=a.format({[c.extensionName]:[t]});d.push(`Sec-WebSocket-Extensions: ${s}`);p._extensions=e}this.emit("headers",d,r);n.write(d.concat("\r\n").join("\r\n"));n.removeListener("error",socketOnError);p.setSocket(n,i,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation});if(this.clients){this.clients.add(p);p.on("close",(()=>{this.clients.delete(p);if(this._shouldEmitClose&&!this.clients.size){process.nextTick(emitClose,this)}}))}l(p,r)}}e.exports=WebSocketServer;function addListeners(e,t){for(const s of Object.keys(t))e.on(s,t[s]);return function removeListeners(){for(const s of Object.keys(t)){e.removeListener(s,t[s])}}}function emitClose(e){e._state=m;e.emit("close")}function socketOnError(){this.destroy()}function abortHandshake(e,t,s,r){s=s||n.STATUS_CODES[t];r={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(s),...r};e.once("finish",e.destroy);e.end(`HTTP/1.1 ${t} ${n.STATUS_CODES[t]}\r\n`+Object.keys(r).map((e=>`${e}: ${r[e]}`)).join("\r\n")+"\r\n\r\n"+s)}function abortHandshakeOrEmitwsClientError(e,t,s,r,n){if(e.listenerCount("wsClientError")){const r=new Error(n);Error.captureStackTrace(r,abortHandshakeOrEmitwsClientError);e.emit("wsClientError",r,s,t)}else{abortHandshake(s,r,n)}}},12:function(e,t,s){"use strict";const r=s(434);const n=s(692);const i=s(611);const o=s(278);const a=s(756);const{randomBytes:c,createHash:l}=s(982);const{Duplex:f,Readable:h}=s(203);const{URL:u}=s(16);const d=s(843);const _=s(198);const p=s(994);const{isBlob:m}=s(408);const{BINARY_TYPES:b,EMPTY_BUFFER:S,GUID:y,kForOnEventAttribute:k,kListener:g,kStatusCode:E,kWebSocket:w,NOOP:v}=s(190);const{EventTarget:{addEventListener:x,removeEventListener:O}}=s(789);const{format:C,parse:T}=s(966);const{toBuffer:L}=s(914);const N=30*1e3;const P=Symbol("kAborted");const W=[8,13];const B=["CONNECTING","OPEN","CLOSING","CLOSED"];const R=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class WebSocket extends r{constructor(e,t,s){super();this._binaryType=b[0];this._closeCode=1006;this._closeFrameReceived=false;this._closeFrameSent=false;this._closeMessage=S;this._closeTimer=null;this._errorEmitted=false;this._extensions={};this._paused=false;this._protocol="";this._readyState=WebSocket.CONNECTING;this._receiver=null;this._sender=null;this._socket=null;if(e!==null){this._bufferedAmount=0;this._isServer=false;this._redirects=0;if(t===undefined){t=[]}else if(!Array.isArray(t)){if(typeof t==="object"&&t!==null){s=t;t=[]}else{t=[t]}}initAsClient(this,e,t,s)}else{this._autoPong=s.autoPong;this._isServer=true}}get binaryType(){return this._binaryType}set binaryType(e){if(!b.includes(e))return;this._binaryType=e;if(this._receiver)this._receiver._binaryType=e}get bufferedAmount(){if(!this._socket)return this._bufferedAmount;return this._socket._writableState.length+this._sender._bufferedBytes}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,s){const r=new _({allowSynchronousEvents:s.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation});const n=new p(e,this._extensions,s.generateMask);this._receiver=r;this._sender=n;this._socket=e;r[w]=this;n[w]=this;e[w]=this;r.on("conclude",receiverOnConclude);r.on("drain",receiverOnDrain);r.on("error",receiverOnError);r.on("message",receiverOnMessage);r.on("ping",receiverOnPing);r.on("pong",receiverOnPong);n.onerror=senderOnError;if(e.setTimeout)e.setTimeout(0);if(e.setNoDelay)e.setNoDelay();if(t.length>0)e.unshift(t);e.on("close",socketOnClose);e.on("data",socketOnData);e.on("end",socketOnEnd);e.on("error",socketOnError);this._readyState=WebSocket.OPEN;this.emit("open")}emitClose(){if(!this._socket){this._readyState=WebSocket.CLOSED;this.emit("close",this._closeCode,this._closeMessage);return}if(this._extensions[d.extensionName]){this._extensions[d.extensionName].cleanup()}this._receiver.removeAllListeners();this._readyState=WebSocket.CLOSED;this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState===WebSocket.CLOSED)return;if(this.readyState===WebSocket.CONNECTING){const e="WebSocket was closed before the connection was established";abortHandshake(this,this._req,e);return}if(this.readyState===WebSocket.CLOSING){if(this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)){this._socket.end()}return}this._readyState=WebSocket.CLOSING;this._sender.close(e,t,!this._isServer,(e=>{if(e)return;this._closeFrameSent=true;if(this._closeFrameReceived||this._receiver._writableState.errorEmitted){this._socket.end()}}));setCloseTimer(this)}pause(){if(this.readyState===WebSocket.CONNECTING||this.readyState===WebSocket.CLOSED){return}this._paused=true;this._socket.pause()}ping(e,t,s){if(this.readyState===WebSocket.CONNECTING){throw new Error("WebSocket is not open: readyState 0 (CONNECTING)")}if(typeof e==="function"){s=e;e=t=undefined}else if(typeof t==="function"){s=t;t=undefined}if(typeof e==="number")e=e.toString();if(this.readyState!==WebSocket.OPEN){sendAfterClose(this,e,s);return}if(t===undefined)t=!this._isServer;this._sender.ping(e||S,t,s)}pong(e,t,s){if(this.readyState===WebSocket.CONNECTING){throw new Error("WebSocket is not open: readyState 0 (CONNECTING)")}if(typeof e==="function"){s=e;e=t=undefined}else if(typeof t==="function"){s=t;t=undefined}if(typeof e==="number")e=e.toString();if(this.readyState!==WebSocket.OPEN){sendAfterClose(this,e,s);return}if(t===undefined)t=!this._isServer;this._sender.pong(e||S,t,s)}resume(){if(this.readyState===WebSocket.CONNECTING||this.readyState===WebSocket.CLOSED){return}this._paused=false;if(!this._receiver._writableState.needDrain)this._socket.resume()}send(e,t,s){if(this.readyState===WebSocket.CONNECTING){throw new Error("WebSocket is not open: readyState 0 (CONNECTING)")}if(typeof t==="function"){s=t;t={}}if(typeof e==="number")e=e.toString();if(this.readyState!==WebSocket.OPEN){sendAfterClose(this,e,s);return}const r={binary:typeof e!=="string",mask:!this._isServer,compress:true,fin:true,...t};if(!this._extensions[d.extensionName]){r.compress=false}this._sender.send(e||S,r,s)}terminate(){if(this.readyState===WebSocket.CLOSED)return;if(this.readyState===WebSocket.CONNECTING){const e="WebSocket was closed before the connection was established";abortHandshake(this,this._req,e);return}if(this._socket){this._readyState=WebSocket.CLOSING;this._socket.destroy()}}}Object.defineProperty(WebSocket,"CONNECTING",{enumerable:true,value:B.indexOf("CONNECTING")});Object.defineProperty(WebSocket.prototype,"CONNECTING",{enumerable:true,value:B.indexOf("CONNECTING")});Object.defineProperty(WebSocket,"OPEN",{enumerable:true,value:B.indexOf("OPEN")});Object.defineProperty(WebSocket.prototype,"OPEN",{enumerable:true,value:B.indexOf("OPEN")});Object.defineProperty(WebSocket,"CLOSING",{enumerable:true,value:B.indexOf("CLOSING")});Object.defineProperty(WebSocket.prototype,"CLOSING",{enumerable:true,value:B.indexOf("CLOSING")});Object.defineProperty(WebSocket,"CLOSED",{enumerable:true,value:B.indexOf("CLOSED")});Object.defineProperty(WebSocket.prototype,"CLOSED",{enumerable:true,value:B.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach((e=>{Object.defineProperty(WebSocket.prototype,e,{enumerable:true})}));["open","error","close","message"].forEach((e=>{Object.defineProperty(WebSocket.prototype,`on${e}`,{enumerable:true,get(){for(const t of this.listeners(e)){if(t[k])return t[g]}return null},set(t){for(const t of this.listeners(e)){if(t[k]){this.removeListener(e,t);break}}if(typeof t!=="function")return;this.addEventListener(e,t,{[k]:true})}})}));WebSocket.prototype.addEventListener=x;WebSocket.prototype.removeEventListener=O;e.exports=WebSocket;function initAsClient(e,t,s,r){const o={allowSynchronousEvents:true,autoPong:true,protocolVersion:W[1],maxPayload:100*1024*1024,skipUTF8Validation:false,perMessageDeflate:true,followRedirects:false,maxRedirects:10,...r,socketPath:undefined,hostname:undefined,protocol:undefined,timeout:undefined,method:"GET",host:undefined,path:undefined,port:undefined};e._autoPong=o.autoPong;if(!W.includes(o.protocolVersion)){throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} `+`(supported versions: ${W.join(", ")})`)}let a;if(t instanceof u){a=t}else{try{a=new u(t)}catch(e){throw new SyntaxError(`Invalid URL: ${t}`)}}if(a.protocol==="http:"){a.protocol="ws:"}else if(a.protocol==="https:"){a.protocol="wss:"}e._url=a.href;const f=a.protocol==="wss:";const h=a.protocol==="ws+unix:";let _;if(a.protocol!=="ws:"&&!f&&!h){_='The URL\'s protocol must be one of "ws:", "wss:", '+'"http:", "https", or "ws+unix:"'}else if(h&&!a.pathname){_="The URL's pathname is empty"}else if(a.hash){_="The URL contains a fragment identifier"}if(_){const t=new SyntaxError(_);if(e._redirects===0){throw t}else{emitErrorAndClose(e,t);return}}const p=f?443:80;const m=c(16).toString("base64");const b=f?n.request:i.request;const S=new Set;let k;o.createConnection=o.createConnection||(f?tlsConnect:netConnect);o.defaultPort=o.defaultPort||p;o.port=a.port||p;o.host=a.hostname.startsWith("[")?a.hostname.slice(1,-1):a.hostname;o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":m,Connection:"Upgrade",Upgrade:"websocket"};o.path=a.pathname+a.search;o.timeout=o.handshakeTimeout;if(o.perMessageDeflate){k=new d(o.perMessageDeflate!==true?o.perMessageDeflate:{},false,o.maxPayload);o.headers["Sec-WebSocket-Extensions"]=C({[d.extensionName]:k.offer()})}if(s.length){for(const e of s){if(typeof e!=="string"||!R.test(e)||S.has(e)){throw new SyntaxError("An invalid or duplicated subprotocol was specified")}S.add(e)}o.headers["Sec-WebSocket-Protocol"]=s.join(",")}if(o.origin){if(o.protocolVersion<13){o.headers["Sec-WebSocket-Origin"]=o.origin}else{o.headers.Origin=o.origin}}if(a.username||a.password){o.auth=`${a.username}:${a.password}`}if(h){const e=o.path.split(":");o.socketPath=e[0];o.path=e[1]}let g;if(o.followRedirects){if(e._redirects===0){e._originalIpc=h;e._originalSecure=f;e._originalHostOrSocketPath=h?o.socketPath:a.host;const t=r&&r.headers;r={...r,headers:{}};if(t){for(const[e,s]of Object.entries(t)){r.headers[e.toLowerCase()]=s}}}else if(e.listenerCount("redirect")===0){const t=h?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:false:e._originalIpc?false:a.host===e._originalHostOrSocketPath;if(!t||e._originalSecure&&!f){delete o.headers.authorization;delete o.headers.cookie;if(!t)delete o.headers.host;o.auth=undefined}}if(o.auth&&!r.headers.authorization){r.headers.authorization="Basic "+Buffer.from(o.auth).toString("base64")}g=e._req=b(o);if(e._redirects){e.emit("redirect",e.url,g)}}else{g=e._req=b(o)}if(o.timeout){g.on("timeout",(()=>{abortHandshake(e,g,"Opening handshake has timed out")}))}g.on("error",(t=>{if(g===null||g[P])return;g=e._req=null;emitErrorAndClose(e,t)}));g.on("response",(n=>{const i=n.headers.location;const a=n.statusCode;if(i&&o.followRedirects&&a>=300&&a<400){if(++e._redirects>o.maxRedirects){abortHandshake(e,g,"Maximum redirects exceeded");return}g.abort();let n;try{n=new u(i,t)}catch(t){const s=new SyntaxError(`Invalid URL: ${i}`);emitErrorAndClose(e,s);return}initAsClient(e,n,s,r)}else if(!e.emit("unexpected-response",g,n)){abortHandshake(e,g,`Unexpected server response: ${n.statusCode}`)}}));g.on("upgrade",((t,s,r)=>{e.emit("upgrade",t);if(e.readyState!==WebSocket.CONNECTING)return;g=e._req=null;const n=t.headers.upgrade;if(n===undefined||n.toLowerCase()!=="websocket"){abortHandshake(e,s,"Invalid Upgrade header");return}const i=l("sha1").update(m+y).digest("base64");if(t.headers["sec-websocket-accept"]!==i){abortHandshake(e,s,"Invalid Sec-WebSocket-Accept header");return}const a=t.headers["sec-websocket-protocol"];let c;if(a!==undefined){if(!S.size){c="Server sent a subprotocol but none was requested"}else if(!S.has(a)){c="Server sent an invalid subprotocol"}}else if(S.size){c="Server sent no subprotocol"}if(c){abortHandshake(e,s,c);return}if(a)e._protocol=a;const f=t.headers["sec-websocket-extensions"];if(f!==undefined){if(!k){const t="Server sent a Sec-WebSocket-Extensions header but no extension "+"was requested";abortHandshake(e,s,t);return}let t;try{t=T(f)}catch(t){const r="Invalid Sec-WebSocket-Extensions header";abortHandshake(e,s,r);return}const r=Object.keys(t);if(r.length!==1||r[0]!==d.extensionName){const t="Server indicated an extension that was not requested";abortHandshake(e,s,t);return}try{k.accept(t[d.extensionName])}catch(t){const r="Invalid Sec-WebSocket-Extensions header";abortHandshake(e,s,r);return}e._extensions[d.extensionName]=k}e.setSocket(s,r,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}));if(o.finishRequest){o.finishRequest(g,e)}else{g.end()}}function emitErrorAndClose(e,t){e._readyState=WebSocket.CLOSING;e._errorEmitted=true;e.emit("error",t);e.emitClose()}function netConnect(e){e.path=e.socketPath;return o.connect(e)}function tlsConnect(e){e.path=undefined;if(!e.servername&&e.servername!==""){e.servername=o.isIP(e.host)?"":e.host}return a.connect(e)}function abortHandshake(e,t,s){e._readyState=WebSocket.CLOSING;const r=new Error(s);Error.captureStackTrace(r,abortHandshake);if(t.setHeader){t[P]=true;t.abort();if(t.socket&&!t.socket.destroyed){t.socket.destroy()}process.nextTick(emitErrorAndClose,e,r)}else{t.destroy(r);t.once("error",e.emit.bind(e,"error"));t.once("close",e.emitClose.bind(e))}}function sendAfterClose(e,t,s){if(t){const s=m(t)?t.size:L(t).length;if(e._socket)e._sender._bufferedBytes+=s;else e._bufferedAmount+=s}if(s){const t=new Error(`WebSocket is not open: readyState ${e.readyState} `+`(${B[e.readyState]})`);process.nextTick(s,t)}}function receiverOnConclude(e,t){const s=this[w];s._closeFrameReceived=true;s._closeMessage=t;s._closeCode=e;if(s._socket[w]===undefined)return;s._socket.removeListener("data",socketOnData);process.nextTick(resume,s._socket);if(e===1005)s.close();else s.close(e,t)}function receiverOnDrain(){const e=this[w];if(!e.isPaused)e._socket.resume()}function receiverOnError(e){const t=this[w];if(t._socket[w]!==undefined){t._socket.removeListener("data",socketOnData);process.nextTick(resume,t._socket);t.close(e[E])}if(!t._errorEmitted){t._errorEmitted=true;t.emit("error",e)}}function receiverOnFinish(){this[w].emitClose()}function receiverOnMessage(e,t){this[w].emit("message",e,t)}function receiverOnPing(e){const t=this[w];if(t._autoPong)t.pong(e,!this._isServer,v);t.emit("ping",e)}function receiverOnPong(e){this[w].emit("pong",e)}function resume(e){e.resume()}function senderOnError(e){const t=this[w];if(t.readyState===WebSocket.CLOSED)return;if(t.readyState===WebSocket.OPEN){t._readyState=WebSocket.CLOSING;setCloseTimer(t)}this._socket.end();if(!t._errorEmitted){t._errorEmitted=true;t.emit("error",e)}}function setCloseTimer(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),N)}function socketOnClose(){const e=this[w];this.removeListener("close",socketOnClose);this.removeListener("data",socketOnData);this.removeListener("end",socketOnEnd);e._readyState=WebSocket.CLOSING;let t;if(!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&(t=e._socket.read())!==null){e._receiver.write(t)}e._receiver.end();this[w]=undefined;clearTimeout(e._closeTimer);if(e._receiver._writableState.finished||e._receiver._writableState.errorEmitted){e.emitClose()}else{e._receiver.on("error",receiverOnFinish);e._receiver.on("finish",receiverOnFinish)}}function socketOnData(e){if(!this[w]._receiver.write(e)){this.pause()}}function socketOnEnd(){const e=this[w];e._readyState=WebSocket.CLOSING;e._receiver.end();this.end()}function socketOnError(){const e=this[w];this.removeListener("error",socketOnError);this.on("error",v);if(e){e._readyState=WebSocket.CLOSING;this.destroy()}}},653:function(module){module.exports=eval("require")("bufferutil")},4:function(module){module.exports=eval("require")("utf-8-validate")},181:function(e){"use strict";e.exports=require("buffer")},982:function(e){"use strict";e.exports=require("crypto")},434:function(e){"use strict";e.exports=require("events")},611:function(e){"use strict";e.exports=require("http")},692:function(e){"use strict";e.exports=require("https")},278:function(e){"use strict";e.exports=require("net")},203:function(e){"use strict";e.exports=require("stream")},756:function(e){"use strict";e.exports=require("tls")},16:function(e){"use strict";e.exports=require("url")},106:function(e){"use strict";e.exports=require("zlib")}};var __webpack_module_cache__={};function __nccwpck_require__(e){var t=__webpack_module_cache__[e];if(t!==undefined){return t.exports}var s=__webpack_module_cache__[e]={exports:{}};var r=true;try{__webpack_modules__[e](s,s.exports,__nccwpck_require__);r=false}finally{if(r)delete __webpack_module_cache__[e]}return s.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var __webpack_exports__=__nccwpck_require__(99);module.exports=__webpack_exports__})();
|
|
1
|
+
(function(){var __webpack_modules__={110:function(e,t,s){"use strict";const r=s(933);r.createWebSocketStream=s(368);r.Server=s(637);r.Receiver=s(761);r.Sender=s(161);r.WebSocket=r;r.WebSocketServer=r.Server;e.exports=r},767:function(e,t,s){"use strict";const{EMPTY_BUFFER:r}=s(899);const n=Buffer[Symbol.species];function concat(e,t){if(e.length===0)return r;if(e.length===1)return e[0];const s=Buffer.allocUnsafe(t);let i=0;for(let t=0;t<e.length;t++){const r=e[t];s.set(r,i);i+=r.length}if(i<t){return new n(s.buffer,s.byteOffset,i)}return s}function _mask(e,t,s,r,n){for(let i=0;i<n;i++){s[r+i]=e[i]^t[i&3]}}function _unmask(e,t){for(let s=0;s<e.length;s++){e[s]^=t[s&3]}}function toArrayBuffer(e){if(e.length===e.buffer.byteLength){return e.buffer}return e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function toBuffer(e){toBuffer.readOnly=true;if(Buffer.isBuffer(e))return e;let t;if(e instanceof ArrayBuffer){t=new n(e)}else if(ArrayBuffer.isView(e)){t=new n(e.buffer,e.byteOffset,e.byteLength)}else{t=Buffer.from(e);toBuffer.readOnly=false}return t}e.exports={concat:concat,mask:_mask,toArrayBuffer:toArrayBuffer,toBuffer:toBuffer,unmask:_unmask};if(!process.env.WS_NO_BUFFER_UTIL){try{const t=s(653);e.exports.mask=function(e,s,r,n,i){if(i<48)_mask(e,s,r,n,i);else t.mask(e,s,r,n,i)};e.exports.unmask=function(e,s){if(e.length<32)_unmask(e,s);else t.unmask(e,s)}}catch(e){}}},899:function(e){"use strict";const t=["nodebuffer","arraybuffer","fragments"];const s=typeof Blob!=="undefined";if(s)t.push("blob");e.exports={BINARY_TYPES:t,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:s,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}},350:function(e,t,s){"use strict";const{kForOnEventAttribute:r,kListener:n}=s(899);const i=Symbol("kCode");const o=Symbol("kData");const a=Symbol("kError");const c=Symbol("kMessage");const l=Symbol("kReason");const f=Symbol("kTarget");const h=Symbol("kType");const u=Symbol("kWasClean");class Event{constructor(e){this[f]=null;this[h]=e}get target(){return this[f]}get type(){return this[h]}}Object.defineProperty(Event.prototype,"target",{enumerable:true});Object.defineProperty(Event.prototype,"type",{enumerable:true});class CloseEvent extends Event{constructor(e,t={}){super(e);this[i]=t.code===undefined?0:t.code;this[l]=t.reason===undefined?"":t.reason;this[u]=t.wasClean===undefined?false:t.wasClean}get code(){return this[i]}get reason(){return this[l]}get wasClean(){return this[u]}}Object.defineProperty(CloseEvent.prototype,"code",{enumerable:true});Object.defineProperty(CloseEvent.prototype,"reason",{enumerable:true});Object.defineProperty(CloseEvent.prototype,"wasClean",{enumerable:true});class ErrorEvent extends Event{constructor(e,t={}){super(e);this[a]=t.error===undefined?null:t.error;this[c]=t.message===undefined?"":t.message}get error(){return this[a]}get message(){return this[c]}}Object.defineProperty(ErrorEvent.prototype,"error",{enumerable:true});Object.defineProperty(ErrorEvent.prototype,"message",{enumerable:true});class MessageEvent extends Event{constructor(e,t={}){super(e);this[o]=t.data===undefined?null:t.data}get data(){return this[o]}}Object.defineProperty(MessageEvent.prototype,"data",{enumerable:true});const d={addEventListener(e,t,s={}){for(const i of this.listeners(e)){if(!s[r]&&i[n]===t&&!i[r]){return}}let i;if(e==="message"){i=function onMessage(e,s){const r=new MessageEvent("message",{data:s?e:e.toString()});r[f]=this;callListener(t,this,r)}}else if(e==="close"){i=function onClose(e,s){const r=new CloseEvent("close",{code:e,reason:s.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[f]=this;callListener(t,this,r)}}else if(e==="error"){i=function onError(e){const s=new ErrorEvent("error",{error:e,message:e.message});s[f]=this;callListener(t,this,s)}}else if(e==="open"){i=function onOpen(){const e=new Event("open");e[f]=this;callListener(t,this,e)}}else{return}i[r]=!!s[r];i[n]=t;if(s.once){this.once(e,i)}else{this.on(e,i)}},removeEventListener(e,t){for(const s of this.listeners(e)){if(s[n]===t&&!s[r]){this.removeListener(e,s);break}}}};e.exports={CloseEvent:CloseEvent,ErrorEvent:ErrorEvent,Event:Event,EventTarget:d,MessageEvent:MessageEvent};function callListener(e,t,s){if(typeof e==="object"&&e.handleEvent){e.handleEvent.call(e,s)}else{e.call(t,s)}}},579:function(e,t,s){"use strict";const{tokenChars:r}=s(371);function push(e,t,s){if(e[t]===undefined)e[t]=[s];else e[t].push(s)}function parse(e){const t=Object.create(null);let s=Object.create(null);let n=false;let i=false;let o=false;let a;let c;let l=-1;let f=-1;let h=-1;let u=0;for(;u<e.length;u++){f=e.charCodeAt(u);if(a===undefined){if(h===-1&&r[f]===1){if(l===-1)l=u}else if(u!==0&&(f===32||f===9)){if(h===-1&&l!==-1)h=u}else if(f===59||f===44){if(l===-1){throw new SyntaxError(`Unexpected character at index ${u}`)}if(h===-1)h=u;const r=e.slice(l,h);if(f===44){push(t,r,s);s=Object.create(null)}else{a=r}l=h=-1}else{throw new SyntaxError(`Unexpected character at index ${u}`)}}else if(c===undefined){if(h===-1&&r[f]===1){if(l===-1)l=u}else if(f===32||f===9){if(h===-1&&l!==-1)h=u}else if(f===59||f===44){if(l===-1){throw new SyntaxError(`Unexpected character at index ${u}`)}if(h===-1)h=u;push(s,e.slice(l,h),true);if(f===44){push(t,a,s);s=Object.create(null);a=undefined}l=h=-1}else if(f===61&&l!==-1&&h===-1){c=e.slice(l,u);l=h=-1}else{throw new SyntaxError(`Unexpected character at index ${u}`)}}else{if(i){if(r[f]!==1){throw new SyntaxError(`Unexpected character at index ${u}`)}if(l===-1)l=u;else if(!n)n=true;i=false}else if(o){if(r[f]===1){if(l===-1)l=u}else if(f===34&&l!==-1){o=false;h=u}else if(f===92){i=true}else{throw new SyntaxError(`Unexpected character at index ${u}`)}}else if(f===34&&e.charCodeAt(u-1)===61){o=true}else if(h===-1&&r[f]===1){if(l===-1)l=u}else if(l!==-1&&(f===32||f===9)){if(h===-1)h=u}else if(f===59||f===44){if(l===-1){throw new SyntaxError(`Unexpected character at index ${u}`)}if(h===-1)h=u;let r=e.slice(l,h);if(n){r=r.replace(/\\/g,"");n=false}push(s,c,r);if(f===44){push(t,a,s);s=Object.create(null);a=undefined}c=undefined;l=h=-1}else{throw new SyntaxError(`Unexpected character at index ${u}`)}}}if(l===-1||o||f===32||f===9){throw new SyntaxError("Unexpected end of input")}if(h===-1)h=u;const d=e.slice(l,h);if(a===undefined){push(t,d,s)}else{if(c===undefined){push(s,d,true)}else if(n){push(s,c,d.replace(/\\/g,""))}else{push(s,c,d)}push(t,a,s)}return t}function format(e){return Object.keys(e).map((t=>{let s=e[t];if(!Array.isArray(s))s=[s];return s.map((e=>[t].concat(Object.keys(e).map((t=>{let s=e[t];if(!Array.isArray(s))s=[s];return s.map((e=>e===true?t:`${t}=${e}`)).join("; ")}))).join("; "))).join(", ")})).join(", ")}e.exports={format:format,parse:parse}},26:function(e){"use strict";const t=Symbol("kDone");const s=Symbol("kRun");class Limiter{constructor(e){this[t]=()=>{this.pending--;this[s]()};this.concurrency=e||Infinity;this.jobs=[];this.pending=0}add(e){this.jobs.push(e);this[s]()}[s](){if(this.pending===this.concurrency)return;if(this.jobs.length){const e=this.jobs.shift();this.pending++;e(this[t])}}}e.exports=Limiter},548:function(e,t,s){"use strict";const r=s(106);const n=s(767);const i=s(26);const{kStatusCode:o}=s(899);const a=Buffer[Symbol.species];const c=Buffer.from([0,0,255,255]);const l=Symbol("permessage-deflate");const f=Symbol("total-length");const h=Symbol("callback");const u=Symbol("buffers");const d=Symbol("error");let _;class PerMessageDeflate{constructor(e,t,s){this._maxPayload=s|0;this._options=e||{};this._threshold=this._options.threshold!==undefined?this._options.threshold:1024;this._isServer=!!t;this._deflate=null;this._inflate=null;this.params=null;if(!_){const e=this._options.concurrencyLimit!==undefined?this._options.concurrencyLimit:10;_=new i(e)}}static get extensionName(){return"permessage-deflate"}offer(){const e={};if(this._options.serverNoContextTakeover){e.server_no_context_takeover=true}if(this._options.clientNoContextTakeover){e.client_no_context_takeover=true}if(this._options.serverMaxWindowBits){e.server_max_window_bits=this._options.serverMaxWindowBits}if(this._options.clientMaxWindowBits){e.client_max_window_bits=this._options.clientMaxWindowBits}else if(this._options.clientMaxWindowBits==null){e.client_max_window_bits=true}return e}accept(e){e=this.normalizeParams(e);this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e);return this.params}cleanup(){if(this._inflate){this._inflate.close();this._inflate=null}if(this._deflate){const e=this._deflate[h];this._deflate.close();this._deflate=null;if(e){e(new Error("The deflate stream was closed while data was being processed"))}}}acceptAsServer(e){const t=this._options;const s=e.find((e=>{if(t.serverNoContextTakeover===false&&e.server_no_context_takeover||e.server_max_window_bits&&(t.serverMaxWindowBits===false||typeof t.serverMaxWindowBits==="number"&&t.serverMaxWindowBits>e.server_max_window_bits)||typeof t.clientMaxWindowBits==="number"&&!e.client_max_window_bits){return false}return true}));if(!s){throw new Error("None of the extension offers can be accepted")}if(t.serverNoContextTakeover){s.server_no_context_takeover=true}if(t.clientNoContextTakeover){s.client_no_context_takeover=true}if(typeof t.serverMaxWindowBits==="number"){s.server_max_window_bits=t.serverMaxWindowBits}if(typeof t.clientMaxWindowBits==="number"){s.client_max_window_bits=t.clientMaxWindowBits}else if(s.client_max_window_bits===true||t.clientMaxWindowBits===false){delete s.client_max_window_bits}return s}acceptAsClient(e){const t=e[0];if(this._options.clientNoContextTakeover===false&&t.client_no_context_takeover){throw new Error('Unexpected parameter "client_no_context_takeover"')}if(!t.client_max_window_bits){if(typeof this._options.clientMaxWindowBits==="number"){t.client_max_window_bits=this._options.clientMaxWindowBits}}else if(this._options.clientMaxWindowBits===false||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){e.forEach((e=>{Object.keys(e).forEach((t=>{let s=e[t];if(s.length>1){throw new Error(`Parameter "${t}" must have only a single value`)}s=s[0];if(t==="client_max_window_bits"){if(s!==true){const e=+s;if(!Number.isInteger(e)||e<8||e>15){throw new TypeError(`Invalid value for parameter "${t}": ${s}`)}s=e}else if(!this._isServer){throw new TypeError(`Invalid value for parameter "${t}": ${s}`)}}else if(t==="server_max_window_bits"){const e=+s;if(!Number.isInteger(e)||e<8||e>15){throw new TypeError(`Invalid value for parameter "${t}": ${s}`)}s=e}else if(t==="client_no_context_takeover"||t==="server_no_context_takeover"){if(s!==true){throw new TypeError(`Invalid value for parameter "${t}": ${s}`)}}else{throw new Error(`Unknown parameter "${t}"`)}e[t]=s}))}));return e}decompress(e,t,s){_.add((r=>{this._decompress(e,t,((e,t)=>{r();s(e,t)}))}))}compress(e,t,s){_.add((r=>{this._compress(e,t,((e,t)=>{r();s(e,t)}))}))}_decompress(e,t,s){const i=this._isServer?"client":"server";if(!this._inflate){const e=`${i}_max_window_bits`;const t=typeof this.params[e]!=="number"?r.Z_DEFAULT_WINDOWBITS:this.params[e];this._inflate=r.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t});this._inflate[l]=this;this._inflate[f]=0;this._inflate[u]=[];this._inflate.on("error",inflateOnError);this._inflate.on("data",inflateOnData)}this._inflate[h]=s;this._inflate.write(e);if(t)this._inflate.write(c);this._inflate.flush((()=>{const e=this._inflate[d];if(e){this._inflate.close();this._inflate=null;s(e);return}const r=n.concat(this._inflate[u],this._inflate[f]);if(this._inflate._readableState.endEmitted){this._inflate.close();this._inflate=null}else{this._inflate[f]=0;this._inflate[u]=[];if(t&&this.params[`${i}_no_context_takeover`]){this._inflate.reset()}}s(null,r)}))}_compress(e,t,s){const i=this._isServer?"server":"client";if(!this._deflate){const e=`${i}_max_window_bits`;const t=typeof this.params[e]!=="number"?r.Z_DEFAULT_WINDOWBITS:this.params[e];this._deflate=r.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t});this._deflate[f]=0;this._deflate[u]=[];this._deflate.on("data",deflateOnData)}this._deflate[h]=s;this._deflate.write(e);this._deflate.flush(r.Z_SYNC_FLUSH,(()=>{if(!this._deflate){return}let e=n.concat(this._deflate[u],this._deflate[f]);if(t){e=new a(e.buffer,e.byteOffset,e.length-4)}this._deflate[h]=null;this._deflate[f]=0;this._deflate[u]=[];if(t&&this.params[`${i}_no_context_takeover`]){this._deflate.reset()}s(null,e)}))}}e.exports=PerMessageDeflate;function deflateOnData(e){this[u].push(e);this[f]+=e.length}function inflateOnData(e){this[f]+=e.length;if(this[l]._maxPayload<1||this[f]<=this[l]._maxPayload){this[u].push(e);return}this[d]=new RangeError("Max payload size exceeded");this[d].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH";this[d][o]=1009;this.removeListener("data",inflateOnData);this.reset()}function inflateOnError(e){this[l]._inflate=null;if(this[d]){this[h](this[d]);return}e[o]=1007;this[h](e)}},761:function(e,t,s){"use strict";const{Writable:r}=s(203);const n=s(548);const{BINARY_TYPES:i,EMPTY_BUFFER:o,kStatusCode:a,kWebSocket:c}=s(899);const{concat:l,toArrayBuffer:f,unmask:h}=s(767);const{isValidStatusCode:u,isValidUTF8:d}=s(371);const _=Buffer[Symbol.species];const p=0;const m=1;const b=2;const S=3;const y=4;const k=5;const g=6;class Receiver extends r{constructor(e={}){super();this._allowSynchronousEvents=e.allowSynchronousEvents!==undefined?e.allowSynchronousEvents:true;this._binaryType=e.binaryType||i[0];this._extensions=e.extensions||{};this._isServer=!!e.isServer;this._maxPayload=e.maxPayload|0;this._skipUTF8Validation=!!e.skipUTF8Validation;this[c]=undefined;this._bufferedBytes=0;this._buffers=[];this._compressed=false;this._payloadLength=0;this._mask=undefined;this._fragmented=0;this._masked=false;this._fin=false;this._opcode=0;this._totalPayloadLength=0;this._messageLength=0;this._fragments=[];this._errored=false;this._loop=false;this._state=p}_write(e,t,s){if(this._opcode===8&&this._state==p)return s();this._bufferedBytes+=e.length;this._buffers.push(e);this.startLoop(s)}consume(e){this._bufferedBytes-=e;if(e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){const t=this._buffers[0];this._buffers[0]=new _(t.buffer,t.byteOffset+e,t.length-e);return new _(t.buffer,t.byteOffset,e)}const t=Buffer.allocUnsafe(e);do{const s=this._buffers[0];const r=t.length-e;if(e>=s.length){t.set(this._buffers.shift(),r)}else{t.set(new Uint8Array(s.buffer,s.byteOffset,e),r);this._buffers[0]=new _(s.buffer,s.byteOffset+e,s.length-e)}e-=s.length}while(e>0);return t}startLoop(e){this._loop=true;do{switch(this._state){case p:this.getInfo(e);break;case m:this.getPayloadLength16(e);break;case b:this.getPayloadLength64(e);break;case S:this.getMask();break;case y:this.getData(e);break;case k:case g:this._loop=false;return}}while(this._loop);if(!this._errored)e()}getInfo(e){if(this._bufferedBytes<2){this._loop=false;return}const t=this.consume(2);if((t[0]&48)!==0){const t=this.createError(RangeError,"RSV2 and RSV3 must be clear",true,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(t);return}const s=(t[0]&64)===64;if(s&&!this._extensions[n.extensionName]){const t=this.createError(RangeError,"RSV1 must be clear",true,1002,"WS_ERR_UNEXPECTED_RSV_1");e(t);return}this._fin=(t[0]&128)===128;this._opcode=t[0]&15;this._payloadLength=t[1]&127;if(this._opcode===0){if(s){const t=this.createError(RangeError,"RSV1 must be clear",true,1002,"WS_ERR_UNEXPECTED_RSV_1");e(t);return}if(!this._fragmented){const t=this.createError(RangeError,"invalid opcode 0",true,1002,"WS_ERR_INVALID_OPCODE");e(t);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){const t=this.createError(RangeError,`invalid opcode ${this._opcode}`,true,1002,"WS_ERR_INVALID_OPCODE");e(t);return}this._compressed=s}else if(this._opcode>7&&this._opcode<11){if(!this._fin){const t=this.createError(RangeError,"FIN must be set",true,1002,"WS_ERR_EXPECTED_FIN");e(t);return}if(s){const t=this.createError(RangeError,"RSV1 must be clear",true,1002,"WS_ERR_UNEXPECTED_RSV_1");e(t);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){const t=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,true,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(t);return}}else{const t=this.createError(RangeError,`invalid opcode ${this._opcode}`,true,1002,"WS_ERR_INVALID_OPCODE");e(t);return}if(!this._fin&&!this._fragmented)this._fragmented=this._opcode;this._masked=(t[1]&128)===128;if(this._isServer){if(!this._masked){const t=this.createError(RangeError,"MASK must be set",true,1002,"WS_ERR_EXPECTED_MASK");e(t);return}}else if(this._masked){const t=this.createError(RangeError,"MASK must be clear",true,1002,"WS_ERR_UNEXPECTED_MASK");e(t);return}if(this._payloadLength===126)this._state=m;else if(this._payloadLength===127)this._state=b;else this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=false;return}this._payloadLength=this.consume(2).readUInt16BE(0);this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=false;return}const t=this.consume(8);const s=t.readUInt32BE(0);if(s>Math.pow(2,53-32)-1){const t=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",false,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(t);return}this._payloadLength=s*Math.pow(2,32)+t.readUInt32BE(4);this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8){this._totalPayloadLength+=this._payloadLength;if(this._totalPayloadLength>this._maxPayload&&this._maxPayload>0){const t=this.createError(RangeError,"Max payload size exceeded",false,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(t);return}}if(this._masked)this._state=S;else this._state=y}getMask(){if(this._bufferedBytes<4){this._loop=false;return}this._mask=this.consume(4);this._state=y}getData(e){let t=o;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=false;return}t=this.consume(this._payloadLength);if(this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0){h(t,this._mask)}}if(this._opcode>7){this.controlMessage(t,e);return}if(this._compressed){this._state=k;this.decompress(t,e);return}if(t.length){this._messageLength=this._totalPayloadLength;this._fragments.push(t)}this.dataMessage(e)}decompress(e,t){const s=this._extensions[n.extensionName];s.decompress(e,this._fin,((e,s)=>{if(e)return t(e);if(s.length){this._messageLength+=s.length;if(this._messageLength>this._maxPayload&&this._maxPayload>0){const e=this.createError(RangeError,"Max payload size exceeded",false,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(e);return}this._fragments.push(s)}this.dataMessage(t);if(this._state===p)this.startLoop(t)}))}dataMessage(e){if(!this._fin){this._state=p;return}const t=this._messageLength;const s=this._fragments;this._totalPayloadLength=0;this._messageLength=0;this._fragmented=0;this._fragments=[];if(this._opcode===2){let r;if(this._binaryType==="nodebuffer"){r=l(s,t)}else if(this._binaryType==="arraybuffer"){r=f(l(s,t))}else if(this._binaryType==="blob"){r=new Blob(s)}else{r=s}if(this._allowSynchronousEvents){this.emit("message",r,true);this._state=p}else{this._state=g;setImmediate((()=>{this.emit("message",r,true);this._state=p;this.startLoop(e)}))}}else{const r=l(s,t);if(!this._skipUTF8Validation&&!d(r)){const t=this.createError(Error,"invalid UTF-8 sequence",true,1007,"WS_ERR_INVALID_UTF8");e(t);return}if(this._state===k||this._allowSynchronousEvents){this.emit("message",r,false);this._state=p}else{this._state=g;setImmediate((()=>{this.emit("message",r,false);this._state=p;this.startLoop(e)}))}}}controlMessage(e,t){if(this._opcode===8){if(e.length===0){this._loop=false;this.emit("conclude",1005,o);this.end()}else{const s=e.readUInt16BE(0);if(!u(s)){const e=this.createError(RangeError,`invalid status code ${s}`,true,1002,"WS_ERR_INVALID_CLOSE_CODE");t(e);return}const r=new _(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!d(r)){const e=this.createError(Error,"invalid UTF-8 sequence",true,1007,"WS_ERR_INVALID_UTF8");t(e);return}this._loop=false;this.emit("conclude",s,r);this.end()}this._state=p;return}if(this._allowSynchronousEvents){this.emit(this._opcode===9?"ping":"pong",e);this._state=p}else{this._state=g;setImmediate((()=>{this.emit(this._opcode===9?"ping":"pong",e);this._state=p;this.startLoop(t)}))}}createError(e,t,s,r,n){this._loop=false;this._errored=true;const i=new e(s?`Invalid WebSocket frame: ${t}`:t);Error.captureStackTrace(i,this.createError);i.code=n;i[a]=r;return i}}e.exports=Receiver},161:function(e,t,s){"use strict";const{Duplex:r}=s(203);const{randomFillSync:n}=s(982);const i=s(548);const{EMPTY_BUFFER:o,kWebSocket:a,NOOP:c}=s(899);const{isBlob:l,isValidStatusCode:f}=s(371);const{mask:h,toBuffer:u}=s(767);const d=Symbol("kByteLength");const _=Buffer.alloc(4);const p=8*1024;let m;let b=p;const S=0;const y=1;const k=2;class Sender{constructor(e,t,s){this._extensions=t||{};if(s){this._generateMask=s;this._maskBuffer=Buffer.alloc(4)}this._socket=e;this._firstFragment=true;this._compress=false;this._bufferedBytes=0;this._queue=[];this._state=S;this.onerror=c;this[a]=undefined}static frame(e,t){let s;let r=false;let i=2;let o=false;if(t.mask){s=t.maskBuffer||_;if(t.generateMask){t.generateMask(s)}else{if(b===p){if(m===undefined){m=Buffer.alloc(p)}n(m,0,p);b=0}s[0]=m[b++];s[1]=m[b++];s[2]=m[b++];s[3]=m[b++]}o=(s[0]|s[1]|s[2]|s[3])===0;i=6}let a;if(typeof e==="string"){if((!t.mask||o)&&t[d]!==undefined){a=t[d]}else{e=Buffer.from(e);a=e.length}}else{a=e.length;r=t.mask&&t.readOnly&&!o}let c=a;if(a>=65536){i+=8;c=127}else if(a>125){i+=2;c=126}const l=Buffer.allocUnsafe(r?a+i:i);l[0]=t.fin?t.opcode|128:t.opcode;if(t.rsv1)l[0]|=64;l[1]=c;if(c===126){l.writeUInt16BE(a,2)}else if(c===127){l[2]=l[3]=0;l.writeUIntBE(a,4,6)}if(!t.mask)return[l,e];l[1]|=128;l[i-4]=s[0];l[i-3]=s[1];l[i-2]=s[2];l[i-1]=s[3];if(o)return[l,e];if(r){h(e,s,l,i,a);return[l]}h(e,s,e,0,a);return[l,e]}close(e,t,s,r){let n;if(e===undefined){n=o}else if(typeof e!=="number"||!f(e)){throw new TypeError("First argument must be a valid error code number")}else if(t===undefined||!t.length){n=Buffer.allocUnsafe(2);n.writeUInt16BE(e,0)}else{const s=Buffer.byteLength(t);if(s>123){throw new RangeError("The message must not be greater than 123 bytes")}n=Buffer.allocUnsafe(2+s);n.writeUInt16BE(e,0);if(typeof t==="string"){n.write(t,2)}else{n.set(t,2)}}const i={[d]:n.length,fin:true,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:8,readOnly:false,rsv1:false};if(this._state!==S){this.enqueue([this.dispatch,n,false,i,r])}else{this.sendFrame(Sender.frame(n,i),r)}}ping(e,t,s){let r;let n;if(typeof e==="string"){r=Buffer.byteLength(e);n=false}else if(l(e)){r=e.size;n=false}else{e=u(e);r=e.length;n=u.readOnly}if(r>125){throw new RangeError("The data size must not be greater than 125 bytes")}const i={[d]:r,fin:true,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:9,readOnly:n,rsv1:false};if(l(e)){if(this._state!==S){this.enqueue([this.getBlobData,e,false,i,s])}else{this.getBlobData(e,false,i,s)}}else if(this._state!==S){this.enqueue([this.dispatch,e,false,i,s])}else{this.sendFrame(Sender.frame(e,i),s)}}pong(e,t,s){let r;let n;if(typeof e==="string"){r=Buffer.byteLength(e);n=false}else if(l(e)){r=e.size;n=false}else{e=u(e);r=e.length;n=u.readOnly}if(r>125){throw new RangeError("The data size must not be greater than 125 bytes")}const i={[d]:r,fin:true,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:10,readOnly:n,rsv1:false};if(l(e)){if(this._state!==S){this.enqueue([this.getBlobData,e,false,i,s])}else{this.getBlobData(e,false,i,s)}}else if(this._state!==S){this.enqueue([this.dispatch,e,false,i,s])}else{this.sendFrame(Sender.frame(e,i),s)}}send(e,t,s){const r=this._extensions[i.extensionName];let n=t.binary?2:1;let o=t.compress;let a;let c;if(typeof e==="string"){a=Buffer.byteLength(e);c=false}else if(l(e)){a=e.size;c=false}else{e=u(e);a=e.length;c=u.readOnly}if(this._firstFragment){this._firstFragment=false;if(o&&r&&r.params[r._isServer?"server_no_context_takeover":"client_no_context_takeover"]){o=a>=r._threshold}this._compress=o}else{o=false;n=0}if(t.fin)this._firstFragment=true;const f={[d]:a,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:c,rsv1:o};if(l(e)){if(this._state!==S){this.enqueue([this.getBlobData,e,this._compress,f,s])}else{this.getBlobData(e,this._compress,f,s)}}else if(this._state!==S){this.enqueue([this.dispatch,e,this._compress,f,s])}else{this.dispatch(e,this._compress,f,s)}}getBlobData(e,t,s,r){this._bufferedBytes+=s[d];this._state=k;e.arrayBuffer().then((e=>{if(this._socket.destroyed){const e=new Error("The socket was closed while the blob was being read");process.nextTick(callCallbacks,this,e,r);return}this._bufferedBytes-=s[d];const n=u(e);if(!t){this._state=S;this.sendFrame(Sender.frame(n,s),r);this.dequeue()}else{this.dispatch(n,t,s,r)}})).catch((e=>{process.nextTick(onError,this,e,r)}))}dispatch(e,t,s,r){if(!t){this.sendFrame(Sender.frame(e,s),r);return}const n=this._extensions[i.extensionName];this._bufferedBytes+=s[d];this._state=y;n.compress(e,s.fin,((e,t)=>{if(this._socket.destroyed){const e=new Error("The socket was closed while data was being compressed");callCallbacks(this,e,r);return}this._bufferedBytes-=s[d];this._state=S;s.readOnly=false;this.sendFrame(Sender.frame(t,s),r);this.dequeue()}))}dequeue(){while(this._state===S&&this._queue.length){const e=this._queue.shift();this._bufferedBytes-=e[3][d];Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][d];this._queue.push(e)}sendFrame(e,t){if(e.length===2){this._socket.cork();this._socket.write(e[0]);this._socket.write(e[1],t);this._socket.uncork()}else{this._socket.write(e[0],t)}}}e.exports=Sender;function callCallbacks(e,t,s){if(typeof s==="function")s(t);for(let s=0;s<e._queue.length;s++){const r=e._queue[s];const n=r[r.length-1];if(typeof n==="function")n(t)}}function onError(e,t,s){callCallbacks(e,t,s);e.onerror(t)}},368:function(e,t,s){"use strict";const r=s(933);const{Duplex:n}=s(203);function emitClose(e){e.emit("close")}function duplexOnEnd(){if(!this.destroyed&&this._writableState.finished){this.destroy()}}function duplexOnError(e){this.removeListener("error",duplexOnError);this.destroy();if(this.listenerCount("error")===0){this.emit("error",e)}}function createWebSocketStream(e,t){let s=true;const r=new n({...t,autoDestroy:false,emitClose:false,objectMode:false,writableObjectMode:false});e.on("message",(function message(t,s){const n=!s&&r._readableState.objectMode?t.toString():t;if(!r.push(n))e.pause()}));e.once("error",(function error(e){if(r.destroyed)return;s=false;r.destroy(e)}));e.once("close",(function close(){if(r.destroyed)return;r.push(null)}));r._destroy=function(t,n){if(e.readyState===e.CLOSED){n(t);process.nextTick(emitClose,r);return}let i=false;e.once("error",(function error(e){i=true;n(e)}));e.once("close",(function close(){if(!i)n(t);process.nextTick(emitClose,r)}));if(s)e.terminate()};r._final=function(t){if(e.readyState===e.CONNECTING){e.once("open",(function open(){r._final(t)}));return}if(e._socket===null)return;if(e._socket._writableState.finished){t();if(r._readableState.endEmitted)r.destroy()}else{e._socket.once("finish",(function finish(){t()}));e.close()}};r._read=function(){if(e.isPaused)e.resume()};r._write=function(t,s,n){if(e.readyState===e.CONNECTING){e.once("open",(function open(){r._write(t,s,n)}));return}e.send(t,n)};r.on("end",duplexOnEnd);r.on("error",duplexOnError);return r}e.exports=createWebSocketStream},624:function(e,t,s){"use strict";const{tokenChars:r}=s(371);function parse(e){const t=new Set;let s=-1;let n=-1;let i=0;for(i;i<e.length;i++){const o=e.charCodeAt(i);if(n===-1&&r[o]===1){if(s===-1)s=i}else if(i!==0&&(o===32||o===9)){if(n===-1&&s!==-1)n=i}else if(o===44){if(s===-1){throw new SyntaxError(`Unexpected character at index ${i}`)}if(n===-1)n=i;const r=e.slice(s,n);if(t.has(r)){throw new SyntaxError(`The "${r}" subprotocol is duplicated`)}t.add(r);s=n=-1}else{throw new SyntaxError(`Unexpected character at index ${i}`)}}if(s===-1||n!==-1){throw new SyntaxError("Unexpected end of input")}const o=e.slice(s,i);if(t.has(o)){throw new SyntaxError(`The "${o}" subprotocol is duplicated`)}t.add(o);return t}e.exports={parse:parse}},371:function(e,t,s){"use strict";const{isUtf8:r}=s(181);const{hasBlob:n}=s(899);const i=[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 isValidStatusCode(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function _isValidUTF8(e){const t=e.length;let s=0;while(s<t){if((e[s]&128)===0){s++}else if((e[s]&224)===192){if(s+1===t||(e[s+1]&192)!==128||(e[s]&254)===192){return false}s+=2}else if((e[s]&240)===224){if(s+2>=t||(e[s+1]&192)!==128||(e[s+2]&192)!==128||e[s]===224&&(e[s+1]&224)===128||e[s]===237&&(e[s+1]&224)===160){return false}s+=3}else if((e[s]&248)===240){if(s+3>=t||(e[s+1]&192)!==128||(e[s+2]&192)!==128||(e[s+3]&192)!==128||e[s]===240&&(e[s+1]&240)===128||e[s]===244&&e[s+1]>143||e[s]>244){return false}s+=4}else{return false}}return true}function isBlob(e){return n&&typeof e==="object"&&typeof e.arrayBuffer==="function"&&typeof e.type==="string"&&typeof e.stream==="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}e.exports={isBlob:isBlob,isValidStatusCode:isValidStatusCode,isValidUTF8:_isValidUTF8,tokenChars:i};if(r){e.exports.isValidUTF8=function(e){return e.length<24?_isValidUTF8(e):r(e)}}else if(!process.env.WS_NO_UTF_8_VALIDATE){try{const t=s(4);e.exports.isValidUTF8=function(e){return e.length<32?_isValidUTF8(e):t(e)}}catch(e){}}},637:function(e,t,s){"use strict";const r=s(434);const n=s(611);const{Duplex:i}=s(203);const{createHash:o}=s(982);const a=s(579);const c=s(548);const l=s(624);const f=s(933);const{GUID:h,kWebSocket:u}=s(899);const d=/^[+/0-9A-Za-z]{22}==$/;const _=0;const p=1;const m=2;class WebSocketServer extends r{constructor(e,t){super();e={allowSynchronousEvents:true,autoPong:true,maxPayload:100*1024*1024,skipUTF8Validation:false,perMessageDeflate:false,handleProtocols:null,clientTracking:true,verifyClient:null,noServer:false,backlog:null,server:null,host:null,path:null,port:null,WebSocket:f,...e};if(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=n.createServer(((e,t)=>{const s=n.STATUS_CODES[426];t.writeHead(426,{"Content-Length":s.length,"Content-Type":"text/plain"});t.end(s)}));this._server.listen(e.port,e.host,e.backlog,t)}else if(e.server){this._server=e.server}if(this._server){const e=this.emit.bind(this,"connection");this._removeListeners=addListeners(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(t,s,r)=>{this.handleUpgrade(t,s,r,e)}})}if(e.perMessageDeflate===true)e.perMessageDeflate={};if(e.clientTracking){this.clients=new Set;this._shouldEmitClose=false}this.options=e;this._state=_}address(){if(this.options.noServer){throw new Error('The server is operating in "noServer" mode')}if(!this._server)return null;return this._server.address()}close(e){if(this._state===m){if(e){this.once("close",(()=>{e(new Error("The server is not running"))}))}process.nextTick(emitClose,this);return}if(e)this.once("close",e);if(this._state===p)return;this._state=p;if(this.options.noServer||this.options.server){if(this._server){this._removeListeners();this._removeListeners=this._server=null}if(this.clients){if(!this.clients.size){process.nextTick(emitClose,this)}else{this._shouldEmitClose=true}}else{process.nextTick(emitClose,this)}}else{const e=this._server;this._removeListeners();this._removeListeners=this._server=null;e.close((()=>{emitClose(this)}))}}shouldHandle(e){if(this.options.path){const t=e.url.indexOf("?");const s=t!==-1?e.url.slice(0,t):e.url;if(s!==this.options.path)return false}return true}handleUpgrade(e,t,s,r){t.on("error",socketOnError);const n=e.headers["sec-websocket-key"];const i=e.headers.upgrade;const o=+e.headers["sec-websocket-version"];if(e.method!=="GET"){const s="Invalid HTTP method";abortHandshakeOrEmitwsClientError(this,e,t,405,s);return}if(i===undefined||i.toLowerCase()!=="websocket"){const s="Invalid Upgrade header";abortHandshakeOrEmitwsClientError(this,e,t,400,s);return}if(n===undefined||!d.test(n)){const s="Missing or invalid Sec-WebSocket-Key header";abortHandshakeOrEmitwsClientError(this,e,t,400,s);return}if(o!==13&&o!==8){const s="Missing or invalid Sec-WebSocket-Version header";abortHandshakeOrEmitwsClientError(this,e,t,400,s,{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){abortHandshake(t,400);return}const f=e.headers["sec-websocket-protocol"];let h=new Set;if(f!==undefined){try{h=l.parse(f)}catch(s){const r="Invalid Sec-WebSocket-Protocol header";abortHandshakeOrEmitwsClientError(this,e,t,400,r);return}}const u=e.headers["sec-websocket-extensions"];const _={};if(this.options.perMessageDeflate&&u!==undefined){const s=new c(this.options.perMessageDeflate,true,this.options.maxPayload);try{const e=a.parse(u);if(e[c.extensionName]){s.accept(e[c.extensionName]);_[c.extensionName]=s}}catch(s){const r="Invalid or unacceptable Sec-WebSocket-Extensions header";abortHandshakeOrEmitwsClientError(this,e,t,400,r);return}}if(this.options.verifyClient){const i={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(i,((i,o,a,c)=>{if(!i){return abortHandshake(t,o||401,a,c)}this.completeUpgrade(_,n,h,e,t,s,r)}));return}if(!this.options.verifyClient(i))return abortHandshake(t,401)}this.completeUpgrade(_,n,h,e,t,s,r)}completeUpgrade(e,t,s,r,n,i,l){if(!n.readable||!n.writable)return n.destroy();if(n[u]){throw new Error("server.handleUpgrade() was called more than once with the same "+"socket, possibly due to a misconfiguration")}if(this._state>_)return abortHandshake(n,503);const f=o("sha1").update(t+h).digest("base64");const d=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${f}`];const p=new this.options.WebSocket(null,undefined,this.options);if(s.size){const e=this.options.handleProtocols?this.options.handleProtocols(s,r):s.values().next().value;if(e){d.push(`Sec-WebSocket-Protocol: ${e}`);p._protocol=e}}if(e[c.extensionName]){const t=e[c.extensionName].params;const s=a.format({[c.extensionName]:[t]});d.push(`Sec-WebSocket-Extensions: ${s}`);p._extensions=e}this.emit("headers",d,r);n.write(d.concat("\r\n").join("\r\n"));n.removeListener("error",socketOnError);p.setSocket(n,i,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation});if(this.clients){this.clients.add(p);p.on("close",(()=>{this.clients.delete(p);if(this._shouldEmitClose&&!this.clients.size){process.nextTick(emitClose,this)}}))}l(p,r)}}e.exports=WebSocketServer;function addListeners(e,t){for(const s of Object.keys(t))e.on(s,t[s]);return function removeListeners(){for(const s of Object.keys(t)){e.removeListener(s,t[s])}}}function emitClose(e){e._state=m;e.emit("close")}function socketOnError(){this.destroy()}function abortHandshake(e,t,s,r){s=s||n.STATUS_CODES[t];r={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(s),...r};e.once("finish",e.destroy);e.end(`HTTP/1.1 ${t} ${n.STATUS_CODES[t]}\r\n`+Object.keys(r).map((e=>`${e}: ${r[e]}`)).join("\r\n")+"\r\n\r\n"+s)}function abortHandshakeOrEmitwsClientError(e,t,s,r,n,i){if(e.listenerCount("wsClientError")){const r=new Error(n);Error.captureStackTrace(r,abortHandshakeOrEmitwsClientError);e.emit("wsClientError",r,s,t)}else{abortHandshake(s,r,n,i)}}},933:function(e,t,s){"use strict";const r=s(434);const n=s(692);const i=s(611);const o=s(278);const a=s(756);const{randomBytes:c,createHash:l}=s(982);const{Duplex:f,Readable:h}=s(203);const{URL:u}=s(16);const d=s(548);const _=s(761);const p=s(161);const{isBlob:m}=s(371);const{BINARY_TYPES:b,EMPTY_BUFFER:S,GUID:y,kForOnEventAttribute:k,kListener:g,kStatusCode:E,kWebSocket:w,NOOP:v}=s(899);const{EventTarget:{addEventListener:x,removeEventListener:O}}=s(350);const{format:C,parse:T}=s(579);const{toBuffer:L}=s(767);const N=30*1e3;const W=Symbol("kAborted");const P=[8,13];const B=["CONNECTING","OPEN","CLOSING","CLOSED"];const R=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class WebSocket extends r{constructor(e,t,s){super();this._binaryType=b[0];this._closeCode=1006;this._closeFrameReceived=false;this._closeFrameSent=false;this._closeMessage=S;this._closeTimer=null;this._errorEmitted=false;this._extensions={};this._paused=false;this._protocol="";this._readyState=WebSocket.CONNECTING;this._receiver=null;this._sender=null;this._socket=null;if(e!==null){this._bufferedAmount=0;this._isServer=false;this._redirects=0;if(t===undefined){t=[]}else if(!Array.isArray(t)){if(typeof t==="object"&&t!==null){s=t;t=[]}else{t=[t]}}initAsClient(this,e,t,s)}else{this._autoPong=s.autoPong;this._isServer=true}}get binaryType(){return this._binaryType}set binaryType(e){if(!b.includes(e))return;this._binaryType=e;if(this._receiver)this._receiver._binaryType=e}get bufferedAmount(){if(!this._socket)return this._bufferedAmount;return this._socket._writableState.length+this._sender._bufferedBytes}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,s){const r=new _({allowSynchronousEvents:s.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation});const n=new p(e,this._extensions,s.generateMask);this._receiver=r;this._sender=n;this._socket=e;r[w]=this;n[w]=this;e[w]=this;r.on("conclude",receiverOnConclude);r.on("drain",receiverOnDrain);r.on("error",receiverOnError);r.on("message",receiverOnMessage);r.on("ping",receiverOnPing);r.on("pong",receiverOnPong);n.onerror=senderOnError;if(e.setTimeout)e.setTimeout(0);if(e.setNoDelay)e.setNoDelay();if(t.length>0)e.unshift(t);e.on("close",socketOnClose);e.on("data",socketOnData);e.on("end",socketOnEnd);e.on("error",socketOnError);this._readyState=WebSocket.OPEN;this.emit("open")}emitClose(){if(!this._socket){this._readyState=WebSocket.CLOSED;this.emit("close",this._closeCode,this._closeMessage);return}if(this._extensions[d.extensionName]){this._extensions[d.extensionName].cleanup()}this._receiver.removeAllListeners();this._readyState=WebSocket.CLOSED;this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState===WebSocket.CLOSED)return;if(this.readyState===WebSocket.CONNECTING){const e="WebSocket was closed before the connection was established";abortHandshake(this,this._req,e);return}if(this.readyState===WebSocket.CLOSING){if(this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)){this._socket.end()}return}this._readyState=WebSocket.CLOSING;this._sender.close(e,t,!this._isServer,(e=>{if(e)return;this._closeFrameSent=true;if(this._closeFrameReceived||this._receiver._writableState.errorEmitted){this._socket.end()}}));setCloseTimer(this)}pause(){if(this.readyState===WebSocket.CONNECTING||this.readyState===WebSocket.CLOSED){return}this._paused=true;this._socket.pause()}ping(e,t,s){if(this.readyState===WebSocket.CONNECTING){throw new Error("WebSocket is not open: readyState 0 (CONNECTING)")}if(typeof e==="function"){s=e;e=t=undefined}else if(typeof t==="function"){s=t;t=undefined}if(typeof e==="number")e=e.toString();if(this.readyState!==WebSocket.OPEN){sendAfterClose(this,e,s);return}if(t===undefined)t=!this._isServer;this._sender.ping(e||S,t,s)}pong(e,t,s){if(this.readyState===WebSocket.CONNECTING){throw new Error("WebSocket is not open: readyState 0 (CONNECTING)")}if(typeof e==="function"){s=e;e=t=undefined}else if(typeof t==="function"){s=t;t=undefined}if(typeof e==="number")e=e.toString();if(this.readyState!==WebSocket.OPEN){sendAfterClose(this,e,s);return}if(t===undefined)t=!this._isServer;this._sender.pong(e||S,t,s)}resume(){if(this.readyState===WebSocket.CONNECTING||this.readyState===WebSocket.CLOSED){return}this._paused=false;if(!this._receiver._writableState.needDrain)this._socket.resume()}send(e,t,s){if(this.readyState===WebSocket.CONNECTING){throw new Error("WebSocket is not open: readyState 0 (CONNECTING)")}if(typeof t==="function"){s=t;t={}}if(typeof e==="number")e=e.toString();if(this.readyState!==WebSocket.OPEN){sendAfterClose(this,e,s);return}const r={binary:typeof e!=="string",mask:!this._isServer,compress:true,fin:true,...t};if(!this._extensions[d.extensionName]){r.compress=false}this._sender.send(e||S,r,s)}terminate(){if(this.readyState===WebSocket.CLOSED)return;if(this.readyState===WebSocket.CONNECTING){const e="WebSocket was closed before the connection was established";abortHandshake(this,this._req,e);return}if(this._socket){this._readyState=WebSocket.CLOSING;this._socket.destroy()}}}Object.defineProperty(WebSocket,"CONNECTING",{enumerable:true,value:B.indexOf("CONNECTING")});Object.defineProperty(WebSocket.prototype,"CONNECTING",{enumerable:true,value:B.indexOf("CONNECTING")});Object.defineProperty(WebSocket,"OPEN",{enumerable:true,value:B.indexOf("OPEN")});Object.defineProperty(WebSocket.prototype,"OPEN",{enumerable:true,value:B.indexOf("OPEN")});Object.defineProperty(WebSocket,"CLOSING",{enumerable:true,value:B.indexOf("CLOSING")});Object.defineProperty(WebSocket.prototype,"CLOSING",{enumerable:true,value:B.indexOf("CLOSING")});Object.defineProperty(WebSocket,"CLOSED",{enumerable:true,value:B.indexOf("CLOSED")});Object.defineProperty(WebSocket.prototype,"CLOSED",{enumerable:true,value:B.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach((e=>{Object.defineProperty(WebSocket.prototype,e,{enumerable:true})}));["open","error","close","message"].forEach((e=>{Object.defineProperty(WebSocket.prototype,`on${e}`,{enumerable:true,get(){for(const t of this.listeners(e)){if(t[k])return t[g]}return null},set(t){for(const t of this.listeners(e)){if(t[k]){this.removeListener(e,t);break}}if(typeof t!=="function")return;this.addEventListener(e,t,{[k]:true})}})}));WebSocket.prototype.addEventListener=x;WebSocket.prototype.removeEventListener=O;e.exports=WebSocket;function initAsClient(e,t,s,r){const o={allowSynchronousEvents:true,autoPong:true,protocolVersion:P[1],maxPayload:100*1024*1024,skipUTF8Validation:false,perMessageDeflate:true,followRedirects:false,maxRedirects:10,...r,socketPath:undefined,hostname:undefined,protocol:undefined,timeout:undefined,method:"GET",host:undefined,path:undefined,port:undefined};e._autoPong=o.autoPong;if(!P.includes(o.protocolVersion)){throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} `+`(supported versions: ${P.join(", ")})`)}let a;if(t instanceof u){a=t}else{try{a=new u(t)}catch(e){throw new SyntaxError(`Invalid URL: ${t}`)}}if(a.protocol==="http:"){a.protocol="ws:"}else if(a.protocol==="https:"){a.protocol="wss:"}e._url=a.href;const f=a.protocol==="wss:";const h=a.protocol==="ws+unix:";let _;if(a.protocol!=="ws:"&&!f&&!h){_='The URL\'s protocol must be one of "ws:", "wss:", '+'"http:", "https:", or "ws+unix:"'}else if(h&&!a.pathname){_="The URL's pathname is empty"}else if(a.hash){_="The URL contains a fragment identifier"}if(_){const t=new SyntaxError(_);if(e._redirects===0){throw t}else{emitErrorAndClose(e,t);return}}const p=f?443:80;const m=c(16).toString("base64");const b=f?n.request:i.request;const S=new Set;let k;o.createConnection=o.createConnection||(f?tlsConnect:netConnect);o.defaultPort=o.defaultPort||p;o.port=a.port||p;o.host=a.hostname.startsWith("[")?a.hostname.slice(1,-1):a.hostname;o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":m,Connection:"Upgrade",Upgrade:"websocket"};o.path=a.pathname+a.search;o.timeout=o.handshakeTimeout;if(o.perMessageDeflate){k=new d(o.perMessageDeflate!==true?o.perMessageDeflate:{},false,o.maxPayload);o.headers["Sec-WebSocket-Extensions"]=C({[d.extensionName]:k.offer()})}if(s.length){for(const e of s){if(typeof e!=="string"||!R.test(e)||S.has(e)){throw new SyntaxError("An invalid or duplicated subprotocol was specified")}S.add(e)}o.headers["Sec-WebSocket-Protocol"]=s.join(",")}if(o.origin){if(o.protocolVersion<13){o.headers["Sec-WebSocket-Origin"]=o.origin}else{o.headers.Origin=o.origin}}if(a.username||a.password){o.auth=`${a.username}:${a.password}`}if(h){const e=o.path.split(":");o.socketPath=e[0];o.path=e[1]}let g;if(o.followRedirects){if(e._redirects===0){e._originalIpc=h;e._originalSecure=f;e._originalHostOrSocketPath=h?o.socketPath:a.host;const t=r&&r.headers;r={...r,headers:{}};if(t){for(const[e,s]of Object.entries(t)){r.headers[e.toLowerCase()]=s}}}else if(e.listenerCount("redirect")===0){const t=h?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:false:e._originalIpc?false:a.host===e._originalHostOrSocketPath;if(!t||e._originalSecure&&!f){delete o.headers.authorization;delete o.headers.cookie;if(!t)delete o.headers.host;o.auth=undefined}}if(o.auth&&!r.headers.authorization){r.headers.authorization="Basic "+Buffer.from(o.auth).toString("base64")}g=e._req=b(o);if(e._redirects){e.emit("redirect",e.url,g)}}else{g=e._req=b(o)}if(o.timeout){g.on("timeout",(()=>{abortHandshake(e,g,"Opening handshake has timed out")}))}g.on("error",(t=>{if(g===null||g[W])return;g=e._req=null;emitErrorAndClose(e,t)}));g.on("response",(n=>{const i=n.headers.location;const a=n.statusCode;if(i&&o.followRedirects&&a>=300&&a<400){if(++e._redirects>o.maxRedirects){abortHandshake(e,g,"Maximum redirects exceeded");return}g.abort();let n;try{n=new u(i,t)}catch(t){const s=new SyntaxError(`Invalid URL: ${i}`);emitErrorAndClose(e,s);return}initAsClient(e,n,s,r)}else if(!e.emit("unexpected-response",g,n)){abortHandshake(e,g,`Unexpected server response: ${n.statusCode}`)}}));g.on("upgrade",((t,s,r)=>{e.emit("upgrade",t);if(e.readyState!==WebSocket.CONNECTING)return;g=e._req=null;const n=t.headers.upgrade;if(n===undefined||n.toLowerCase()!=="websocket"){abortHandshake(e,s,"Invalid Upgrade header");return}const i=l("sha1").update(m+y).digest("base64");if(t.headers["sec-websocket-accept"]!==i){abortHandshake(e,s,"Invalid Sec-WebSocket-Accept header");return}const a=t.headers["sec-websocket-protocol"];let c;if(a!==undefined){if(!S.size){c="Server sent a subprotocol but none was requested"}else if(!S.has(a)){c="Server sent an invalid subprotocol"}}else if(S.size){c="Server sent no subprotocol"}if(c){abortHandshake(e,s,c);return}if(a)e._protocol=a;const f=t.headers["sec-websocket-extensions"];if(f!==undefined){if(!k){const t="Server sent a Sec-WebSocket-Extensions header but no extension "+"was requested";abortHandshake(e,s,t);return}let t;try{t=T(f)}catch(t){const r="Invalid Sec-WebSocket-Extensions header";abortHandshake(e,s,r);return}const r=Object.keys(t);if(r.length!==1||r[0]!==d.extensionName){const t="Server indicated an extension that was not requested";abortHandshake(e,s,t);return}try{k.accept(t[d.extensionName])}catch(t){const r="Invalid Sec-WebSocket-Extensions header";abortHandshake(e,s,r);return}e._extensions[d.extensionName]=k}e.setSocket(s,r,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}));if(o.finishRequest){o.finishRequest(g,e)}else{g.end()}}function emitErrorAndClose(e,t){e._readyState=WebSocket.CLOSING;e._errorEmitted=true;e.emit("error",t);e.emitClose()}function netConnect(e){e.path=e.socketPath;return o.connect(e)}function tlsConnect(e){e.path=undefined;if(!e.servername&&e.servername!==""){e.servername=o.isIP(e.host)?"":e.host}return a.connect(e)}function abortHandshake(e,t,s){e._readyState=WebSocket.CLOSING;const r=new Error(s);Error.captureStackTrace(r,abortHandshake);if(t.setHeader){t[W]=true;t.abort();if(t.socket&&!t.socket.destroyed){t.socket.destroy()}process.nextTick(emitErrorAndClose,e,r)}else{t.destroy(r);t.once("error",e.emit.bind(e,"error"));t.once("close",e.emitClose.bind(e))}}function sendAfterClose(e,t,s){if(t){const s=m(t)?t.size:L(t).length;if(e._socket)e._sender._bufferedBytes+=s;else e._bufferedAmount+=s}if(s){const t=new Error(`WebSocket is not open: readyState ${e.readyState} `+`(${B[e.readyState]})`);process.nextTick(s,t)}}function receiverOnConclude(e,t){const s=this[w];s._closeFrameReceived=true;s._closeMessage=t;s._closeCode=e;if(s._socket[w]===undefined)return;s._socket.removeListener("data",socketOnData);process.nextTick(resume,s._socket);if(e===1005)s.close();else s.close(e,t)}function receiverOnDrain(){const e=this[w];if(!e.isPaused)e._socket.resume()}function receiverOnError(e){const t=this[w];if(t._socket[w]!==undefined){t._socket.removeListener("data",socketOnData);process.nextTick(resume,t._socket);t.close(e[E])}if(!t._errorEmitted){t._errorEmitted=true;t.emit("error",e)}}function receiverOnFinish(){this[w].emitClose()}function receiverOnMessage(e,t){this[w].emit("message",e,t)}function receiverOnPing(e){const t=this[w];if(t._autoPong)t.pong(e,!this._isServer,v);t.emit("ping",e)}function receiverOnPong(e){this[w].emit("pong",e)}function resume(e){e.resume()}function senderOnError(e){const t=this[w];if(t.readyState===WebSocket.CLOSED)return;if(t.readyState===WebSocket.OPEN){t._readyState=WebSocket.CLOSING;setCloseTimer(t)}this._socket.end();if(!t._errorEmitted){t._errorEmitted=true;t.emit("error",e)}}function setCloseTimer(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),N)}function socketOnClose(){const e=this[w];this.removeListener("close",socketOnClose);this.removeListener("data",socketOnData);this.removeListener("end",socketOnEnd);e._readyState=WebSocket.CLOSING;let t;if(!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&(t=e._socket.read())!==null){e._receiver.write(t)}e._receiver.end();this[w]=undefined;clearTimeout(e._closeTimer);if(e._receiver._writableState.finished||e._receiver._writableState.errorEmitted){e.emitClose()}else{e._receiver.on("error",receiverOnFinish);e._receiver.on("finish",receiverOnFinish)}}function socketOnData(e){if(!this[w]._receiver.write(e)){this.pause()}}function socketOnEnd(){const e=this[w];e._readyState=WebSocket.CLOSING;e._receiver.end();this.end()}function socketOnError(){const e=this[w];this.removeListener("error",socketOnError);this.on("error",v);if(e){e._readyState=WebSocket.CLOSING;this.destroy()}}},653:function(module){module.exports=eval("require")("bufferutil")},4:function(module){module.exports=eval("require")("utf-8-validate")},181:function(e){"use strict";e.exports=require("buffer")},982:function(e){"use strict";e.exports=require("crypto")},434:function(e){"use strict";e.exports=require("events")},611:function(e){"use strict";e.exports=require("http")},692:function(e){"use strict";e.exports=require("https")},278:function(e){"use strict";e.exports=require("net")},203:function(e){"use strict";e.exports=require("stream")},756:function(e){"use strict";e.exports=require("tls")},16:function(e){"use strict";e.exports=require("url")},106:function(e){"use strict";e.exports=require("zlib")}};var __webpack_module_cache__={};function __nccwpck_require__(e){var t=__webpack_module_cache__[e];if(t!==undefined){return t.exports}var s=__webpack_module_cache__[e]={exports:{}};var r=true;try{__webpack_modules__[e](s,s.exports,__nccwpck_require__);r=false}finally{if(r)delete __webpack_module_cache__[e]}return s.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var __webpack_exports__=__nccwpck_require__(110);module.exports=__webpack_exports__})();
|
|
@@ -494,6 +494,14 @@ function inflateOnData(chunk) {
|
|
|
494
494
|
this[kError].code = 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH';
|
|
495
495
|
this[kError][kStatusCode] = 1009;
|
|
496
496
|
this.removeListener('data', inflateOnData);
|
|
497
|
+
|
|
498
|
+
//
|
|
499
|
+
// The choice to employ `zlib.reset()` over `zlib.close()` is dictated by the
|
|
500
|
+
// fact that in Node.js versions prior to 13.10.0, the callback for
|
|
501
|
+
// `zlib.flush()` is not called if `zlib.close()` is used. Utilizing
|
|
502
|
+
// `zlib.reset()` ensures that either the callback is invoked or an error is
|
|
503
|
+
// emitted.
|
|
504
|
+
//
|
|
497
505
|
this.reset();
|
|
498
506
|
}
|
|
499
507
|
|
|
@@ -509,6 +517,12 @@ function inflateOnError(err) {
|
|
|
509
517
|
// closed when an error is emitted.
|
|
510
518
|
//
|
|
511
519
|
this[kPerMessageDeflate]._inflate = null;
|
|
520
|
+
|
|
521
|
+
if (this[kError]) {
|
|
522
|
+
this[kCallback](this[kError]);
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
|
|
512
526
|
err[kStatusCode] = 1007;
|
|
513
527
|
this[kCallback](err);
|
|
514
528
|
}
|
|
@@ -256,9 +256,11 @@ class WebSocketServer extends EventEmitter {
|
|
|
256
256
|
return;
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
-
if (version !==
|
|
259
|
+
if (version !== 13 && version !== 8) {
|
|
260
260
|
const message = 'Missing or invalid Sec-WebSocket-Version header';
|
|
261
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message
|
|
261
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message, {
|
|
262
|
+
'Sec-WebSocket-Version': '13, 8'
|
|
263
|
+
});
|
|
262
264
|
return;
|
|
263
265
|
}
|
|
264
266
|
|
|
@@ -526,15 +528,23 @@ function abortHandshake(socket, code, message, headers) {
|
|
|
526
528
|
* @param {Duplex} socket The socket of the upgrade request
|
|
527
529
|
* @param {Number} code The HTTP response status code
|
|
528
530
|
* @param {String} message The HTTP response body
|
|
531
|
+
* @param {Object} [headers] The HTTP response headers
|
|
529
532
|
* @private
|
|
530
533
|
*/
|
|
531
|
-
function abortHandshakeOrEmitwsClientError(
|
|
534
|
+
function abortHandshakeOrEmitwsClientError(
|
|
535
|
+
server,
|
|
536
|
+
req,
|
|
537
|
+
socket,
|
|
538
|
+
code,
|
|
539
|
+
message,
|
|
540
|
+
headers
|
|
541
|
+
) {
|
|
532
542
|
if (server.listenerCount('wsClientError')) {
|
|
533
543
|
const err = new Error(message);
|
|
534
544
|
Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError);
|
|
535
545
|
|
|
536
546
|
server.emit('wsClientError', err, socket, req);
|
|
537
547
|
} else {
|
|
538
|
-
abortHandshake(socket, code, message);
|
|
548
|
+
abortHandshake(socket, code, message, headers);
|
|
539
549
|
}
|
|
540
550
|
}
|