@embedder/embedder 2.0.5 → 2.0.7
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/assets/cli-BN-cw-1f.js +865 -0
- package/assets/devtools-5eoTYou8.js +20 -0
- package/assets/index-ChUt7dNW.js +1 -0
- package/assets/{index-oEV_emLn.js → index-D6_B9BKl.js} +1 -1
- package/cli.js +1 -1
- package/package.json +1 -1
- package/assets/cli-DIXdkQBM.js +0 -887
- package/assets/devtools-B4JKPJyU.js +0 -1
- package/assets/index-BCdeyKtY.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"events";import t from"https";import s from"http";import r from"net";import i from"tls";import o from"crypto";import n from"stream";import a from"url";import h from"zlib";import{a as c,g as l}from"./_commonjsHelpers-C1uRMj_j.js";import d from"buffer";var f,u,_={exports:{}};function p(){if(u)return f;u=1;const e=["nodebuffer","arraybuffer","fragments"],t="undefined"!=typeof Blob;return t&&e.push("blob"),f={BINARY_TYPES:e,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:t,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}}const m=c(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var y,b,v,g,S;function E(){if(y)return _.exports;y=1;const{EMPTY_BUFFER:e}=p(),t=Buffer[Symbol.species];function s(e,t,s,r,i){for(let o=0;o<i;o++)s[r+o]=e[o]^t[3&o]}function r(e,t){for(let s=0;s<e.length;s++)e[s]^=t[3&s]}if(_.exports={concat:function(s,r){if(0===s.length)return e;if(1===s.length)return s[0];const i=Buffer.allocUnsafe(r);let o=0;for(let e=0;e<s.length;e++){const t=s[e];i.set(t,o),o+=t.length}return o<r?new t(i.buffer,i.byteOffset,o):i},mask:s,toArrayBuffer:function(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)},toBuffer:function e(s){if(e.readOnly=!0,Buffer.isBuffer(s))return s;let r;return s instanceof ArrayBuffer?r=new t(s):ArrayBuffer.isView(s)?r=new t(s.buffer,s.byteOffset,s.byteLength):(r=Buffer.from(s),e.readOnly=!1),r},unmask:r},!process.env.WS_NO_BUFFER_UTIL)try{const e=m;_.exports.mask=function(t,r,i,o,n){n<48?s(t,r,i,o,n):e.mask(t,r,i,o,n)},_.exports.unmask=function(t,s){t.length<32?r(t,s):e.unmask(t,s)}}catch(i){}return _.exports}function w(){if(S)return g;S=1;const e=h,t=E(),s=function(){if(v)return b;v=1;const e=Symbol("kDone"),t=Symbol("kRun");return b=class{constructor(s){this[e]=()=>{this.pending--,this[t]()},this.concurrency=s||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[t]()}[t](){if(this.pending!==this.concurrency&&this.jobs.length){const t=this.jobs.shift();this.pending++,t(this[e])}}}}(),{kStatusCode:r}=p(),i=Buffer[Symbol.species],o=Buffer.from([0,0,255,255]),n=Symbol("permessage-deflate"),a=Symbol("total-length"),c=Symbol("callback"),l=Symbol("buffers"),d=Symbol("error");let f;function u(e){this[l].push(e),this[a]+=e.length}function _(e){this[a]+=e.length,this[n]._maxPayload<1||this[a]<=this[n]._maxPayload?this[l].push(e):(this[d]=new RangeError("Max payload size exceeded"),this[d].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[d][r]=1009,this.removeListener("data",_),this.reset())}function m(e){this[n]._inflate=null,this[d]?this[c](this[d]):(e[r]=1007,this[c](e))}return g=class{constructor(e,t,r){if(this._maxPayload=0|r,this._options=e||{},this._threshold=void 0!==this._options.threshold?this._options.threshold:1024,this._isServer=!!t,this._deflate=null,this._inflate=null,this.params=null,!f){const e=void 0!==this._options.concurrencyLimit?this._options.concurrencyLimit:10;f=new s(e)}}static get extensionName(){return"permessage-deflate"}offer(){const e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:null==this._options.clientMaxWindowBits&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){const e=this._deflate[c];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){const t=this._options,s=e.find(e=>!(!1===t.serverNoContextTakeover&&e.server_no_context_takeover||e.server_max_window_bits&&(!1===t.serverMaxWindowBits||"number"==typeof t.serverMaxWindowBits&&t.serverMaxWindowBits>e.server_max_window_bits)||"number"==typeof t.clientMaxWindowBits&&!e.client_max_window_bits));if(!s)throw new Error("None of the extension offers can be accepted");return t.serverNoContextTakeover&&(s.server_no_context_takeover=!0),t.clientNoContextTakeover&&(s.client_no_context_takeover=!0),"number"==typeof t.serverMaxWindowBits&&(s.server_max_window_bits=t.serverMaxWindowBits),"number"==typeof t.clientMaxWindowBits?s.client_max_window_bits=t.clientMaxWindowBits:!0!==s.client_max_window_bits&&!1!==t.clientMaxWindowBits||delete s.client_max_window_bits,s}acceptAsClient(e){const t=e[0];if(!1===this._options.clientNoContextTakeover&&t.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(t.client_max_window_bits){if(!1===this._options.clientMaxWindowBits||"number"==typeof this._options.clientMaxWindowBits&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"')}else"number"==typeof this._options.clientMaxWindowBits&&(t.client_max_window_bits=this._options.clientMaxWindowBits);return t}normalizeParams(e){return 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`);if(s=s[0],"client_max_window_bits"===t){if(!0!==s){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("server_max_window_bits"===t){const e=+s;if(!Number.isInteger(e)||e<8||e>15)throw new TypeError(`Invalid value for parameter "${t}": ${s}`);s=e}else{if("client_no_context_takeover"!==t&&"server_no_context_takeover"!==t)throw new Error(`Unknown parameter "${t}"`);if(!0!==s)throw new TypeError(`Invalid value for parameter "${t}": ${s}`)}e[t]=s})}),e}decompress(e,t,s){f.add(r=>{this._decompress(e,t,(e,t)=>{r(),s(e,t)})})}compress(e,t,s){f.add(r=>{this._compress(e,t,(e,t)=>{r(),s(e,t)})})}_decompress(s,r,i){const h=this._isServer?"client":"server";if(!this._inflate){const t=`${h}_max_window_bits`,s="number"!=typeof this.params[t]?e.Z_DEFAULT_WINDOWBITS:this.params[t];this._inflate=e.createInflateRaw({...this._options.zlibInflateOptions,windowBits:s}),this._inflate[n]=this,this._inflate[a]=0,this._inflate[l]=[],this._inflate.on("error",m),this._inflate.on("data",_)}this._inflate[c]=i,this._inflate.write(s),r&&this._inflate.write(o),this._inflate.flush(()=>{const e=this._inflate[d];if(e)return this._inflate.close(),this._inflate=null,void i(e);const s=t.concat(this._inflate[l],this._inflate[a]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[a]=0,this._inflate[l]=[],r&&this.params[`${h}_no_context_takeover`]&&this._inflate.reset()),i(null,s)})}_compress(s,r,o){const n=this._isServer?"server":"client";if(!this._deflate){const t=`${n}_max_window_bits`,s="number"!=typeof this.params[t]?e.Z_DEFAULT_WINDOWBITS:this.params[t];this._deflate=e.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:s}),this._deflate[a]=0,this._deflate[l]=[],this._deflate.on("data",u)}this._deflate[c]=o,this._deflate.write(s),this._deflate.flush(e.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let e=t.concat(this._deflate[l],this._deflate[a]);r&&(e=new i(e.buffer,e.byteOffset,e.length-4)),this._deflate[c]=null,this._deflate[a]=0,this._deflate[l]=[],r&&this.params[`${n}_no_context_takeover`]&&this._deflate.reset(),o(null,e)})}}}var k={exports:{}};const x=c(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var O,T,C,N,L,P,B,R,I,U,D,M,W;function A(){if(O)return k.exports;O=1;const{isUtf8:e}=d,{hasBlob:t}=p();function s(e){const t=e.length;let s=0;for(;s<t;)if(128&e[s])if(192==(224&e[s])){if(s+1===t||128!=(192&e[s+1])||192==(254&e[s]))return!1;s+=2}else if(224==(240&e[s])){if(s+2>=t||128!=(192&e[s+1])||128!=(192&e[s+2])||224===e[s]&&128==(224&e[s+1])||237===e[s]&&160==(224&e[s+1]))return!1;s+=3}else{if(240!=(248&e[s]))return!1;if(s+3>=t||128!=(192&e[s+1])||128!=(192&e[s+2])||128!=(192&e[s+3])||240===e[s]&&128==(240&e[s+1])||244===e[s]&&e[s+1]>143||e[s]>244)return!1;s+=4}else s++;return!0}if(k.exports={isBlob:function(e){return t&&"object"==typeof e&&"function"==typeof e.arrayBuffer&&"string"==typeof e.type&&"function"==typeof e.stream&&("Blob"===e[Symbol.toStringTag]||"File"===e[Symbol.toStringTag])},isValidStatusCode:function(e){return e>=1e3&&e<=1014&&1004!==e&&1005!==e&&1006!==e||e>=3e3&&e<=4999},isValidUTF8:s,tokenChars:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0]},e)k.exports.isValidUTF8=function(t){return t.length<24?s(t):e(t)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{const e=x;k.exports.isValidUTF8=function(t){return t.length<32?s(t):e(t)}}catch(r){}return k.exports}function F(){if(C)return T;C=1;const{Writable:e}=n,t=w(),{BINARY_TYPES:s,EMPTY_BUFFER:r,kStatusCode:i,kWebSocket:o}=p(),{concat:a,toArrayBuffer:h,unmask:c}=E(),{isValidStatusCode:l,isValidUTF8:d}=A(),f=Buffer[Symbol.species];return T=class extends e{constructor(e={}){super(),this._allowSynchronousEvents=void 0===e.allowSynchronousEvents||e.allowSynchronousEvents,this._binaryType=e.binaryType||s[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=0|e.maxPayload,this._skipUTF8Validation=!!e.skipUTF8Validation,this[o]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(e,t,s){if(8===this._opcode&&0==this._state)return s();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(s)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){const t=this._buffers[0];return this._buffers[0]=new f(t.buffer,t.byteOffset+e,t.length-e),new f(t.buffer,t.byteOffset,e)}const t=Buffer.allocUnsafe(e);do{const s=this._buffers[0],r=t.length-e;e>=s.length?t.set(this._buffers.shift(),r):(t.set(new Uint8Array(s.buffer,s.byteOffset,e),r),this._buffers[0]=new f(s.buffer,s.byteOffset+e,s.length-e)),e-=s.length}while(e>0);return t}startLoop(e){this._loop=!0;do{switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:return void(this._loop=!1)}}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2)return void(this._loop=!1);const s=this.consume(2);if(48&s[0]){return void e(this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3"))}const r=!(64&~s[0]);if(r&&!this._extensions[t.extensionName]){return void e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"))}if(this._fin=!(128&~s[0]),this._opcode=15&s[0],this._payloadLength=127&s[1],0===this._opcode){if(r){return void e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"))}if(!this._fragmented){return void e(this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE"))}this._opcode=this._fragmented}else if(1===this._opcode||2===this._opcode){if(this._fragmented){return void e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE"))}this._compressed=r}else{if(!(this._opcode>7&&this._opcode<11)){return void e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE"))}if(!this._fin){return void e(this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN"))}if(r){return void e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"))}if(this._payloadLength>125||8===this._opcode&&1===this._payloadLength){return void e(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH"))}}if(this._fin||this._fragmented||(this._fragmented=this._opcode),this._masked=!(128&~s[1]),this._isServer){if(!this._masked){return void e(this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK"))}}else if(this._masked){return void e(this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK"))}126===this._payloadLength?this._state=1:127===this._payloadLength?this._state=2:this.haveLength(e)}getPayloadLength16(e){this._bufferedBytes<2?this._loop=!1:(this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e))}getPayloadLength64(e){if(this._bufferedBytes<8)return void(this._loop=!1);const t=this.consume(8),s=t.readUInt32BE(0);if(s>Math.pow(2,21)-1){return void e(this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH"))}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,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){return void e(this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"))}this._masked?this._state=3:this._state=4}getMask(){this._bufferedBytes<4?this._loop=!1:(this._mask=this.consume(4),this._state=4)}getData(e){let t=r;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength)return void(this._loop=!1);t=this.consume(this._payloadLength),this._masked&&0!==(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])&&c(t,this._mask)}if(this._opcode>7)this.controlMessage(t,e);else{if(this._compressed)return this._state=5,void this.decompress(t,e);t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage(e)}}decompress(e,s){this._extensions[t.extensionName].decompress(e,this._fin,(e,t)=>{if(e)return s(e);if(t.length){if(this._messageLength+=t.length,this._messageLength>this._maxPayload&&this._maxPayload>0){const e=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");return void s(e)}this._fragments.push(t)}this.dataMessage(s),0===this._state&&this.startLoop(s)})}dataMessage(e){if(!this._fin)return void(this._state=0);const t=this._messageLength,s=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],2===this._opcode){let r;r="nodebuffer"===this._binaryType?a(s,t):"arraybuffer"===this._binaryType?h(a(s,t)):"blob"===this._binaryType?new Blob(s):s,this._allowSynchronousEvents?(this.emit("message",r,!0),this._state=0):(this._state=6,setImmediate(()=>{this.emit("message",r,!0),this._state=0,this.startLoop(e)}))}else{const r=a(s,t);if(!this._skipUTF8Validation&&!d(r)){const t=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");return void e(t)}5===this._state||this._allowSynchronousEvents?(this.emit("message",r,!1),this._state=0):(this._state=6,setImmediate(()=>{this.emit("message",r,!1),this._state=0,this.startLoop(e)}))}}controlMessage(e,t){if(8!==this._opcode)this._allowSynchronousEvents?(this.emit(9===this._opcode?"ping":"pong",e),this._state=0):(this._state=6,setImmediate(()=>{this.emit(9===this._opcode?"ping":"pong",e),this._state=0,this.startLoop(t)}));else{if(0===e.length)this._loop=!1,this.emit("conclude",1005,r),this.end();else{const s=e.readUInt16BE(0);if(!l(s)){const e=this.createError(RangeError,`invalid status code ${s}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");return void t(e)}const r=new f(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!d(r)){const e=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");return void t(e)}this._loop=!1,this.emit("conclude",s,r),this.end()}this._state=0}}createError(e,t,s,r,o){this._loop=!1,this._errored=!0;const n=new e(s?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(n,this.createError),n.code=o,n[i]=r,n}}}function j(){if(L)return N;L=1;const{Duplex:e}=n,{randomFillSync:t}=o,s=w(),{EMPTY_BUFFER:r,kWebSocket:i,NOOP:a}=p(),{isBlob:h,isValidStatusCode:c}=A(),{mask:l,toBuffer:d}=E(),f=Symbol("kByteLength"),u=Buffer.alloc(4),_=8192;let m,y=_;class b{constructor(e,t,s){this._extensions=t||{},s&&(this._generateMask=s,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=a,this[i]=void 0}static frame(e,s){let r,i,o=!1,n=2,a=!1;s.mask&&(r=s.maskBuffer||u,s.generateMask?s.generateMask(r):(y===_&&(void 0===m&&(m=Buffer.alloc(_)),t(m,0,_),y=0),r[0]=m[y++],r[1]=m[y++],r[2]=m[y++],r[3]=m[y++]),a=0===(r[0]|r[1]|r[2]|r[3]),n=6),"string"==typeof e?i=s.mask&&!a||void 0===s[f]?(e=Buffer.from(e)).length:s[f]:(i=e.length,o=s.mask&&s.readOnly&&!a);let h=i;i>=65536?(n+=8,h=127):i>125&&(n+=2,h=126);const c=Buffer.allocUnsafe(o?i+n:n);return c[0]=s.fin?128|s.opcode:s.opcode,s.rsv1&&(c[0]|=64),c[1]=h,126===h?c.writeUInt16BE(i,2):127===h&&(c[2]=c[3]=0,c.writeUIntBE(i,4,6)),s.mask?(c[1]|=128,c[n-4]=r[0],c[n-3]=r[1],c[n-2]=r[2],c[n-1]=r[3],a?[c,e]:o?(l(e,r,c,n,i),[c]):(l(e,r,e,0,i),[c,e])):[c,e]}close(e,t,s,i){let o;if(void 0===e)o=r;else{if("number"!=typeof e||!c(e))throw new TypeError("First argument must be a valid error code number");if(void 0!==t&&t.length){const s=Buffer.byteLength(t);if(s>123)throw new RangeError("The message must not be greater than 123 bytes");o=Buffer.allocUnsafe(2+s),o.writeUInt16BE(e,0),"string"==typeof t?o.write(t,2):o.set(t,2)}else o=Buffer.allocUnsafe(2),o.writeUInt16BE(e,0)}const n={[f]:o.length,fin:!0,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};0!==this._state?this.enqueue([this.dispatch,o,!1,n,i]):this.sendFrame(b.frame(o,n),i)}ping(e,t,s){let r,i;if("string"==typeof e?(r=Buffer.byteLength(e),i=!1):h(e)?(r=e.size,i=!1):(r=(e=d(e)).length,i=d.readOnly),r>125)throw new RangeError("The data size must not be greater than 125 bytes");const o={[f]:r,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:9,readOnly:i,rsv1:!1};h(e)?0!==this._state?this.enqueue([this.getBlobData,e,!1,o,s]):this.getBlobData(e,!1,o,s):0!==this._state?this.enqueue([this.dispatch,e,!1,o,s]):this.sendFrame(b.frame(e,o),s)}pong(e,t,s){let r,i;if("string"==typeof e?(r=Buffer.byteLength(e),i=!1):h(e)?(r=e.size,i=!1):(r=(e=d(e)).length,i=d.readOnly),r>125)throw new RangeError("The data size must not be greater than 125 bytes");const o={[f]:r,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:10,readOnly:i,rsv1:!1};h(e)?0!==this._state?this.enqueue([this.getBlobData,e,!1,o,s]):this.getBlobData(e,!1,o,s):0!==this._state?this.enqueue([this.dispatch,e,!1,o,s]):this.sendFrame(b.frame(e,o),s)}send(e,t,r){const i=this._extensions[s.extensionName];let o,n,a=t.binary?2:1,c=t.compress;"string"==typeof e?(o=Buffer.byteLength(e),n=!1):h(e)?(o=e.size,n=!1):(o=(e=d(e)).length,n=d.readOnly),this._firstFragment?(this._firstFragment=!1,c&&i&&i.params[i._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(c=o>=i._threshold),this._compress=c):(c=!1,a=0),t.fin&&(this._firstFragment=!0);const l={[f]:o,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:n,rsv1:c};h(e)?0!==this._state?this.enqueue([this.getBlobData,e,this._compress,l,r]):this.getBlobData(e,this._compress,l,r):0!==this._state?this.enqueue([this.dispatch,e,this._compress,l,r]):this.dispatch(e,this._compress,l,r)}getBlobData(e,t,s,r){this._bufferedBytes+=s[f],this._state=2,e.arrayBuffer().then(e=>{if(this._socket.destroyed){const e=new Error("The socket was closed while the blob was being read");return void process.nextTick(v,this,e,r)}this._bufferedBytes-=s[f];const i=d(e);t?this.dispatch(i,t,s,r):(this._state=0,this.sendFrame(b.frame(i,s),r),this.dequeue())}).catch(e=>{process.nextTick(g,this,e,r)})}dispatch(e,t,r,i){if(!t)return void this.sendFrame(b.frame(e,r),i);const o=this._extensions[s.extensionName];this._bufferedBytes+=r[f],this._state=1,o.compress(e,r.fin,(e,t)=>{if(this._socket.destroyed){return void v(this,new Error("The socket was closed while data was being compressed"),i)}this._bufferedBytes-=r[f],this._state=0,r.readOnly=!1,this.sendFrame(b.frame(t,r),i),this.dequeue()})}dequeue(){for(;0===this._state&&this._queue.length;){const e=this._queue.shift();this._bufferedBytes-=e[3][f],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][f],this._queue.push(e)}sendFrame(e,t){2===e.length?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}}function v(e,t,s){"function"==typeof s&&s(t);for(let r=0;r<e._queue.length;r++){const s=e._queue[r],i=s[s.length-1];"function"==typeof i&&i(t)}}function g(e,t,s){v(e,t,s),e.onerror(t)}return N=b}function $(){if(I)return R;I=1;const{tokenChars:e}=A();function t(e,t,s){void 0===e[t]?e[t]=[s]:e[t].push(s)}return R={format:function(e){return Object.keys(e).map(t=>{let s=e[t];return Array.isArray(s)||(s=[s]),s.map(e=>[t].concat(Object.keys(e).map(t=>{let s=e[t];return Array.isArray(s)||(s=[s]),s.map(e=>!0===e?t:`${t}=${e}`).join("; ")})).join("; ")).join(", ")}).join(", ")},parse:function(s){const r=Object.create(null);let i,o,n=Object.create(null),a=!1,h=!1,c=!1,l=-1,d=-1,f=-1,u=0;for(;u<s.length;u++)if(d=s.charCodeAt(u),void 0===i)if(-1===f&&1===e[d])-1===l&&(l=u);else if(0===u||32!==d&&9!==d){if(59!==d&&44!==d)throw new SyntaxError(`Unexpected character at index ${u}`);{if(-1===l)throw new SyntaxError(`Unexpected character at index ${u}`);-1===f&&(f=u);const e=s.slice(l,f);44===d?(t(r,e,n),n=Object.create(null)):i=e,l=f=-1}}else-1===f&&-1!==l&&(f=u);else if(void 0===o)if(-1===f&&1===e[d])-1===l&&(l=u);else if(32===d||9===d)-1===f&&-1!==l&&(f=u);else if(59===d||44===d){if(-1===l)throw new SyntaxError(`Unexpected character at index ${u}`);-1===f&&(f=u),t(n,s.slice(l,f),!0),44===d&&(t(r,i,n),n=Object.create(null),i=void 0),l=f=-1}else{if(61!==d||-1===l||-1!==f)throw new SyntaxError(`Unexpected character at index ${u}`);o=s.slice(l,u),l=f=-1}else if(h){if(1!==e[d])throw new SyntaxError(`Unexpected character at index ${u}`);-1===l?l=u:a||(a=!0),h=!1}else if(c)if(1===e[d])-1===l&&(l=u);else if(34===d&&-1!==l)c=!1,f=u;else{if(92!==d)throw new SyntaxError(`Unexpected character at index ${u}`);h=!0}else if(34===d&&61===s.charCodeAt(u-1))c=!0;else if(-1===f&&1===e[d])-1===l&&(l=u);else if(-1===l||32!==d&&9!==d){if(59!==d&&44!==d)throw new SyntaxError(`Unexpected character at index ${u}`);{if(-1===l)throw new SyntaxError(`Unexpected character at index ${u}`);-1===f&&(f=u);let e=s.slice(l,f);a&&(e=e.replace(/\\/g,""),a=!1),t(n,o,e),44===d&&(t(r,i,n),n=Object.create(null),i=void 0),o=void 0,l=f=-1}}else-1===f&&(f=u);if(-1===l||c||32===d||9===d)throw new SyntaxError("Unexpected end of input");-1===f&&(f=u);const _=s.slice(l,f);return void 0===i?t(r,_,n):(void 0===o?t(n,_,!0):t(n,o,a?_.replace(/\\/g,""):_),t(r,i,n)),r}}}function V(){if(D)return U;D=1;const h=e,c=t,l=s,d=r,f=i,{randomBytes:u,createHash:_}=o,{Duplex:m,Readable:y}=n,{URL:b}=a,v=w(),g=F(),S=j(),{isBlob:k}=A(),{BINARY_TYPES:x,EMPTY_BUFFER:O,GUID:T,kForOnEventAttribute:C,kListener:N,kStatusCode:L,kWebSocket:R,NOOP:I}=p(),{EventTarget:{addEventListener:M,removeEventListener:W}}=function(){if(B)return P;B=1;const{kForOnEventAttribute:e,kListener:t}=p(),s=Symbol("kCode"),r=Symbol("kData"),i=Symbol("kError"),o=Symbol("kMessage"),n=Symbol("kReason"),a=Symbol("kTarget"),h=Symbol("kType"),c=Symbol("kWasClean");class l{constructor(e){this[a]=null,this[h]=e}get target(){return this[a]}get type(){return this[h]}}Object.defineProperty(l.prototype,"target",{enumerable:!0}),Object.defineProperty(l.prototype,"type",{enumerable:!0});class d extends l{constructor(e,t={}){super(e),this[s]=void 0===t.code?0:t.code,this[n]=void 0===t.reason?"":t.reason,this[c]=void 0!==t.wasClean&&t.wasClean}get code(){return this[s]}get reason(){return this[n]}get wasClean(){return this[c]}}Object.defineProperty(d.prototype,"code",{enumerable:!0}),Object.defineProperty(d.prototype,"reason",{enumerable:!0}),Object.defineProperty(d.prototype,"wasClean",{enumerable:!0});class f extends l{constructor(e,t={}){super(e),this[i]=void 0===t.error?null:t.error,this[o]=void 0===t.message?"":t.message}get error(){return this[i]}get message(){return this[o]}}Object.defineProperty(f.prototype,"error",{enumerable:!0}),Object.defineProperty(f.prototype,"message",{enumerable:!0});class u extends l{constructor(e,t={}){super(e),this[r]=void 0===t.data?null:t.data}get data(){return this[r]}}Object.defineProperty(u.prototype,"data",{enumerable:!0});const _={addEventListener(s,r,i={}){for(const n of this.listeners(s))if(!i[e]&&n[t]===r&&!n[e])return;let o;if("message"===s)o=function(e,t){const s=new u("message",{data:t?e:e.toString()});s[a]=this,m(r,this,s)};else if("close"===s)o=function(e,t){const s=new d("close",{code:e,reason:t.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});s[a]=this,m(r,this,s)};else if("error"===s)o=function(e){const t=new f("error",{error:e,message:e.message});t[a]=this,m(r,this,t)};else{if("open"!==s)return;o=function(){const e=new l("open");e[a]=this,m(r,this,e)}}o[e]=!!i[e],o[t]=r,i.once?this.once(s,o):this.on(s,o)},removeEventListener(s,r){for(const i of this.listeners(s))if(i[t]===r&&!i[e]){this.removeListener(s,i);break}}};function m(e,t,s){"object"==typeof e&&e.handleEvent?e.handleEvent.call(e,s):e.call(t,s)}return P={CloseEvent:d,ErrorEvent:f,Event:l,EventTarget:_,MessageEvent:u}}(),{format:V,parse:G}=$(),{toBuffer:q}=E(),z=Symbol("kAborted"),H=[8,13],Y=["CONNECTING","OPEN","CLOSING","CLOSED"],X=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class K extends h{constructor(e,t,s){super(),this._binaryType=x[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=O,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=K.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,null!==e?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,void 0===t?t=[]:Array.isArray(t)||("object"==typeof t&&null!==t?(s=t,t=[]):t=[t]),Z(this,e,t,s)):(this._autoPong=s.autoPong,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){x.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,t,s){const r=new g({allowSynchronousEvents:s.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation}),i=new S(e,this._extensions,s.generateMask);this._receiver=r,this._sender=i,this._socket=e,r[R]=this,i[R]=this,e[R]=this,r.on("conclude",re),r.on("drain",ie),r.on("error",oe),r.on("message",ae),r.on("ping",he),r.on("pong",ce),i.onerror=de,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",ue),e.on("data",_e),e.on("end",pe),e.on("error",me),this._readyState=K.OPEN,this.emit("open")}emitClose(){if(!this._socket)return this._readyState=K.CLOSED,void this.emit("close",this._closeCode,this._closeMessage);this._extensions[v.extensionName]&&this._extensions[v.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=K.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==K.CLOSED){if(this.readyState===K.CONNECTING){const e="WebSocket was closed before the connection was established";return void te(this,this._req,e)}this.readyState!==K.CLOSING?(this._readyState=K.CLOSING,this._sender.close(e,t,!this._isServer,e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),fe(this)):this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end()}}pause(){this.readyState!==K.CONNECTING&&this.readyState!==K.CLOSED&&(this._paused=!0,this._socket.pause())}ping(e,t,s){if(this.readyState===K.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof e?(s=e,e=t=void 0):"function"==typeof t&&(s=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState===K.OPEN?(void 0===t&&(t=!this._isServer),this._sender.ping(e||O,t,s)):se(this,e,s)}pong(e,t,s){if(this.readyState===K.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof e?(s=e,e=t=void 0):"function"==typeof t&&(s=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState===K.OPEN?(void 0===t&&(t=!this._isServer),this._sender.pong(e||O,t,s)):se(this,e,s)}resume(){this.readyState!==K.CONNECTING&&this.readyState!==K.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,t,s){if(this.readyState===K.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if("function"==typeof t&&(s=t,t={}),"number"==typeof e&&(e=e.toString()),this.readyState!==K.OPEN)return void se(this,e,s);const r={binary:"string"!=typeof e,mask:!this._isServer,compress:!0,fin:!0,...t};this._extensions[v.extensionName]||(r.compress=!1),this._sender.send(e||O,r,s)}terminate(){if(this.readyState!==K.CLOSED){if(this.readyState===K.CONNECTING){const e="WebSocket was closed before the connection was established";return void te(this,this._req,e)}this._socket&&(this._readyState=K.CLOSING,this._socket.destroy())}}}function Z(e,t,s,r){const i={allowSynchronousEvents:!0,autoPong:!0,protocolVersion:H[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...r,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(e._autoPong=i.autoPong,!H.includes(i.protocolVersion))throw new RangeError(`Unsupported protocol version: ${i.protocolVersion} (supported versions: ${H.join(", ")})`);let o;if(t instanceof b)o=t;else try{o=new b(t)}catch(S){throw new SyntaxError(`Invalid URL: ${t}`)}"http:"===o.protocol?o.protocol="ws:":"https:"===o.protocol&&(o.protocol="wss:"),e._url=o.href;const n="wss:"===o.protocol,a="ws+unix:"===o.protocol;let h;if("ws:"===o.protocol||n||a?a&&!o.pathname?h="The URL's pathname is empty":o.hash&&(h="The URL contains a fragment identifier"):h='The URL\'s protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"',h){const t=new SyntaxError(h);if(0===e._redirects)throw t;return void J(e,t)}const d=n?443:80,f=u(16).toString("base64"),p=n?c.request:l.request,m=new Set;let y,g;if(i.createConnection=i.createConnection||(n?ee:Q),i.defaultPort=i.defaultPort||d,i.port=o.port||d,i.host=o.hostname.startsWith("[")?o.hostname.slice(1,-1):o.hostname,i.headers={...i.headers,"Sec-WebSocket-Version":i.protocolVersion,"Sec-WebSocket-Key":f,Connection:"Upgrade",Upgrade:"websocket"},i.path=o.pathname+o.search,i.timeout=i.handshakeTimeout,i.perMessageDeflate&&(y=new v(!0!==i.perMessageDeflate?i.perMessageDeflate:{},!1,i.maxPayload),i.headers["Sec-WebSocket-Extensions"]=V({[v.extensionName]:y.offer()})),s.length){for(const e of s){if("string"!=typeof e||!X.test(e)||m.has(e))throw new SyntaxError("An invalid or duplicated subprotocol was specified");m.add(e)}i.headers["Sec-WebSocket-Protocol"]=s.join(",")}if(i.origin&&(i.protocolVersion<13?i.headers["Sec-WebSocket-Origin"]=i.origin:i.headers.Origin=i.origin),(o.username||o.password)&&(i.auth=`${o.username}:${o.password}`),a){const e=i.path.split(":");i.socketPath=e[0],i.path=e[1]}if(i.followRedirects){if(0===e._redirects){e._originalIpc=a,e._originalSecure=n,e._originalHostOrSocketPath=a?i.socketPath:o.host;const t=r&&r.headers;if(r={...r,headers:{}},t)for(const[e,s]of Object.entries(t))r.headers[e.toLowerCase()]=s}else if(0===e.listenerCount("redirect")){const t=a?!!e._originalIpc&&i.socketPath===e._originalHostOrSocketPath:!e._originalIpc&&o.host===e._originalHostOrSocketPath;(!t||e._originalSecure&&!n)&&(delete i.headers.authorization,delete i.headers.cookie,t||delete i.headers.host,i.auth=void 0)}i.auth&&!r.headers.authorization&&(r.headers.authorization="Basic "+Buffer.from(i.auth).toString("base64")),g=e._req=p(i),e._redirects&&e.emit("redirect",e.url,g)}else g=e._req=p(i);i.timeout&&g.on("timeout",()=>{te(e,g,"Opening handshake has timed out")}),g.on("error",t=>{null===g||g[z]||(g=e._req=null,J(e,t))}),g.on("response",o=>{const n=o.headers.location,a=o.statusCode;if(n&&i.followRedirects&&a>=300&&a<400){if(++e._redirects>i.maxRedirects)return void te(e,g,"Maximum redirects exceeded");let o;g.abort();try{o=new b(n,t)}catch(S){const s=new SyntaxError(`Invalid URL: ${n}`);return void J(e,s)}Z(e,o,s,r)}else e.emit("unexpected-response",g,o)||te(e,g,`Unexpected server response: ${o.statusCode}`)}),g.on("upgrade",(t,s,r)=>{if(e.emit("upgrade",t),e.readyState!==K.CONNECTING)return;g=e._req=null;const o=t.headers.upgrade;if(void 0===o||"websocket"!==o.toLowerCase())return void te(e,s,"Invalid Upgrade header");const n=_("sha1").update(f+T).digest("base64");if(t.headers["sec-websocket-accept"]!==n)return void te(e,s,"Invalid Sec-WebSocket-Accept header");const a=t.headers["sec-websocket-protocol"];let h;if(void 0!==a?m.size?m.has(a)||(h="Server sent an invalid subprotocol"):h="Server sent a subprotocol but none was requested":m.size&&(h="Server sent no subprotocol"),h)return void te(e,s,h);a&&(e._protocol=a);const c=t.headers["sec-websocket-extensions"];if(void 0!==c){if(!y){return void te(e,s,"Server sent a Sec-WebSocket-Extensions header but no extension was requested")}let t;try{t=G(c)}catch(l){return void te(e,s,"Invalid Sec-WebSocket-Extensions header")}const r=Object.keys(t);if(1!==r.length||r[0]!==v.extensionName){return void te(e,s,"Server indicated an extension that was not requested")}try{y.accept(t[v.extensionName])}catch(l){return void te(e,s,"Invalid Sec-WebSocket-Extensions header")}e._extensions[v.extensionName]=y}e.setSocket(s,r,{allowSynchronousEvents:i.allowSynchronousEvents,generateMask:i.generateMask,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation})}),i.finishRequest?i.finishRequest(g,e):g.end()}function J(e,t){e._readyState=K.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}function Q(e){return e.path=e.socketPath,d.connect(e)}function ee(e){return e.path=void 0,e.servername||""===e.servername||(e.servername=d.isIP(e.host)?"":e.host),f.connect(e)}function te(e,t,s){e._readyState=K.CLOSING;const r=new Error(s);Error.captureStackTrace(r,te),t.setHeader?(t[z]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(J,e,r)):(t.destroy(r),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function se(e,t,s){if(t){const s=k(t)?t.size:q(t).length;e._socket?e._sender._bufferedBytes+=s:e._bufferedAmount+=s}if(s){const t=new Error(`WebSocket is not open: readyState ${e.readyState} (${Y[e.readyState]})`);process.nextTick(s,t)}}function re(e,t){const s=this[R];s._closeFrameReceived=!0,s._closeMessage=t,s._closeCode=e,void 0!==s._socket[R]&&(s._socket.removeListener("data",_e),process.nextTick(le,s._socket),1005===e?s.close():s.close(e,t))}function ie(){const e=this[R];e.isPaused||e._socket.resume()}function oe(e){const t=this[R];void 0!==t._socket[R]&&(t._socket.removeListener("data",_e),process.nextTick(le,t._socket),t.close(e[L])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}function ne(){this[R].emitClose()}function ae(e,t){this[R].emit("message",e,t)}function he(e){const t=this[R];t._autoPong&&t.pong(e,!this._isServer,I),t.emit("ping",e)}function ce(e){this[R].emit("pong",e)}function le(e){e.resume()}function de(e){const t=this[R];t.readyState!==K.CLOSED&&(t.readyState===K.OPEN&&(t._readyState=K.CLOSING,fe(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}function fe(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),3e4)}function ue(){const e=this[R];let t;this.removeListener("close",ue),this.removeListener("data",_e),this.removeListener("end",pe),e._readyState=K.CLOSING,this._readableState.endEmitted||e._closeFrameReceived||e._receiver._writableState.errorEmitted||null===(t=e._socket.read())||e._receiver.write(t),e._receiver.end(),this[R]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",ne),e._receiver.on("finish",ne))}function _e(e){this[R]._receiver.write(e)||this.pause()}function pe(){const e=this[R];e._readyState=K.CLOSING,e._receiver.end(),this.end()}function me(){const e=this[R];this.removeListener("error",me),this.on("error",I),e&&(e._readyState=K.CLOSING,this.destroy())}return Object.defineProperty(K,"CONNECTING",{enumerable:!0,value:Y.indexOf("CONNECTING")}),Object.defineProperty(K.prototype,"CONNECTING",{enumerable:!0,value:Y.indexOf("CONNECTING")}),Object.defineProperty(K,"OPEN",{enumerable:!0,value:Y.indexOf("OPEN")}),Object.defineProperty(K.prototype,"OPEN",{enumerable:!0,value:Y.indexOf("OPEN")}),Object.defineProperty(K,"CLOSING",{enumerable:!0,value:Y.indexOf("CLOSING")}),Object.defineProperty(K.prototype,"CLOSING",{enumerable:!0,value:Y.indexOf("CLOSING")}),Object.defineProperty(K,"CLOSED",{enumerable:!0,value:Y.indexOf("CLOSED")}),Object.defineProperty(K.prototype,"CLOSED",{enumerable:!0,value:Y.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(K.prototype,e,{enumerable:!0})}),["open","error","close","message"].forEach(e=>{Object.defineProperty(K.prototype,`on${e}`,{enumerable:!0,get(){for(const t of this.listeners(e))if(t[C])return t[N];return null},set(t){for(const s of this.listeners(e))if(s[C]){this.removeListener(e,s);break}"function"==typeof t&&this.addEventListener(e,t,{[C]:!0})}})}),K.prototype.addEventListener=M,K.prototype.removeEventListener=W,U=K}!function(){if(W)return M;W=1,V();const{Duplex:e}=n;function t(e){e.emit("close")}function s(){!this.destroyed&&this._writableState.finished&&this.destroy()}function r(e){this.removeListener("error",r),this.destroy(),0===this.listenerCount("error")&&this.emit("error",e)}M=function(i,o){let n=!0;const a=new e({...o,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return i.on("message",function(e,t){const s=!t&&a._readableState.objectMode?e.toString():e;a.push(s)||i.pause()}),i.once("error",function(e){a.destroyed||(n=!1,a.destroy(e))}),i.once("close",function(){a.destroyed||a.push(null)}),a._destroy=function(e,s){if(i.readyState===i.CLOSED)return s(e),void process.nextTick(t,a);let r=!1;i.once("error",function(e){r=!0,s(e)}),i.once("close",function(){r||s(e),process.nextTick(t,a)}),n&&i.terminate()},a._final=function(e){i.readyState!==i.CONNECTING?null!==i._socket&&(i._socket._writableState.finished?(e(),a._readableState.endEmitted&&a.destroy()):(i._socket.once("finish",function(){e()}),i.close())):i.once("open",function(){a._final(e)})},a._read=function(){i.isPaused&&i.resume()},a._write=function(e,t,s){i.readyState!==i.CONNECTING?i.send(e,s):i.once("open",function(){a._write(e,t,s)})},a.on("end",s),a.on("error",r),a}}(),F(),j();const G=l(V());var q,z,H,Y;!function(){if(Y)return H;Y=1;const t=e,r=s,{Duplex:i}=n,{createHash:a}=o,h=$(),c=w(),l=function(){if(z)return q;z=1;const{tokenChars:e}=A();return q={parse:function(t){const s=new Set;let r=-1,i=-1,o=0;for(;o<t.length;o++){const n=t.charCodeAt(o);if(-1===i&&1===e[n])-1===r&&(r=o);else if(0===o||32!==n&&9!==n){if(44!==n)throw new SyntaxError(`Unexpected character at index ${o}`);{if(-1===r)throw new SyntaxError(`Unexpected character at index ${o}`);-1===i&&(i=o);const e=t.slice(r,i);if(s.has(e))throw new SyntaxError(`The "${e}" subprotocol is duplicated`);s.add(e),r=i=-1}}else-1===i&&-1!==r&&(i=o)}if(-1===r||-1!==i)throw new SyntaxError("Unexpected end of input");const n=t.slice(r,o);if(s.has(n))throw new SyntaxError(`The "${n}" subprotocol is duplicated`);return s.add(n),s}}}(),d=V(),{GUID:f,kWebSocket:u}=p(),_=/^[+/0-9A-Za-z]{22}==$/;function m(e){e._state=2,e.emit("close")}function y(){this.destroy()}function b(e,t,s,i){s=s||r.STATUS_CODES[t],i={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(s),...i},e.once("finish",e.destroy),e.end(`HTTP/1.1 ${t} ${r.STATUS_CODES[t]}\r\n`+Object.keys(i).map(e=>`${e}: ${i[e]}`).join("\r\n")+"\r\n\r\n"+s)}function v(e,t,s,r,i,o){if(e.listenerCount("wsClientError")){const r=new Error(i);Error.captureStackTrace(r,v),e.emit("wsClientError",r,s,t)}else b(s,r,i,o)}H=class extends t{constructor(e,t){if(super(),null==(e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:d,...e}).port&&!e.server&&!e.noServer||null!=e.port&&(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(null!=e.port?(this._server=r.createServer((e,t)=>{const s=r.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)):e.server&&(this._server=e.server),this._server){const e=this.emit.bind(this,"connection");this._removeListeners=function(e,t){for(const s of Object.keys(t))e.on(s,t[s]);return function(){for(const s of Object.keys(t))e.removeListener(s,t[s])}}(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(t,s,r)=>{this.handleUpgrade(t,s,r,e)}})}!0===e.perMessageDeflate&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(2===this._state)return e&&this.once("close",()=>{e(new Error("The server is not running"))}),void process.nextTick(m,this);if(e&&this.once("close",e),1!==this._state)if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(m,this);else{const e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{m(this)})}}shouldHandle(e){if(this.options.path){const t=e.url.indexOf("?");if((-1!==t?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,s,r){t.on("error",y);const i=e.headers["sec-websocket-key"],o=e.headers.upgrade,n=+e.headers["sec-websocket-version"];if("GET"!==e.method){return void v(this,e,t,405,"Invalid HTTP method")}if(void 0===o||"websocket"!==o.toLowerCase()){return void v(this,e,t,400,"Invalid Upgrade header")}if(void 0===i||!_.test(i)){return void v(this,e,t,400,"Missing or invalid Sec-WebSocket-Key header")}if(13!==n&&8!==n){return void v(this,e,t,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"})}if(!this.shouldHandle(e))return void b(t,400);const a=e.headers["sec-websocket-protocol"];let d=new Set;if(void 0!==a)try{d=l.parse(a)}catch(p){return void v(this,e,t,400,"Invalid Sec-WebSocket-Protocol header")}const f=e.headers["sec-websocket-extensions"],u={};if(this.options.perMessageDeflate&&void 0!==f){const s=new c(this.options.perMessageDeflate,!0,this.options.maxPayload);try{const e=h.parse(f);e[c.extensionName]&&(s.accept(e[c.extensionName]),u[c.extensionName]=s)}catch(p){return void v(this,e,t,400,"Invalid or unacceptable Sec-WebSocket-Extensions header")}}if(this.options.verifyClient){const o={origin:e.headers[""+(8===n?"sec-websocket-origin":"origin")],secure:!(!e.socket.authorized&&!e.socket.encrypted),req:e};if(2===this.options.verifyClient.length)return void this.options.verifyClient(o,(o,n,a,h)=>{if(!o)return b(t,n||401,a,h);this.completeUpgrade(u,i,d,e,t,s,r)});if(!this.options.verifyClient(o))return b(t,401)}this.completeUpgrade(u,i,d,e,t,s,r)}completeUpgrade(e,t,s,r,i,o,n){if(!i.readable||!i.writable)return i.destroy();if(i[u])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return b(i,503);const l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${a("sha1").update(t+f).digest("base64")}`],d=new this.options.WebSocket(null,void 0,this.options);if(s.size){const e=this.options.handleProtocols?this.options.handleProtocols(s,r):s.values().next().value;e&&(l.push(`Sec-WebSocket-Protocol: ${e}`),d._protocol=e)}if(e[c.extensionName]){const t=e[c.extensionName].params,s=h.format({[c.extensionName]:[t]});l.push(`Sec-WebSocket-Extensions: ${s}`),d._extensions=e}this.emit("headers",l,r),i.write(l.concat("\r\n").join("\r\n")),i.removeListener("error",y),d.setSocket(i,o,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(d),d.on("close",()=>{this.clients.delete(d),this._shouldEmitClose&&!this.clients.size&&process.nextTick(m,this)})),n(d,r)}}}();const X=global;X.WebSocket||=G,X.window||=global,X.self||=global,X.window.__REACT_DEVTOOLS_COMPONENT_FILTERS__=[{type:1,value:7,isEnabled:!0},{type:2,value:"InternalApp",isEnabled:!0,isValid:!0},{type:2,value:"InternalAppContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalStdoutContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalStderrContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalStdinContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalFocusContext",isEnabled:!0,isValid:!0}];throw new Error('Could not resolve "react-devtools-core" imported by "ink".');
|
package/assets/index-BCdeyKtY.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{D as e,t}from"./cli-DIXdkQBM.js";import{b as n,c as r,d as s,a as i,f as o,l,s as u}from"./cli-DIXdkQBM.js";import"./_commonjsHelpers-C1uRMj_j.js";import"assert";import"events";import"node:process";import"node:events";import"node:fs";import"module";import"node:os";import"node:tty";import"node:buffer";import"node:util";import"node:path";import"os";import"crypto";import"node:crypto";import"fs";import"path";import"http";import"node:url";import"node:child_process";import"node:fs/promises";import"url";import"node:stream";import"node:string_decoder";import"fs/promises";import"child_process";import"util";import"perf_hooks";import"tty";import"worker_threads";import"node:diagnostics_channel";import"diagnostics_channel";import"node:net";import"async_hooks";import"node:readline";import"node:worker_threads";import"node:http";import"node:https";import"node:zlib";import"node:tls";const a=new class extends e{};function c(e,t,n){return a.diff(e,t,n)}function f(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function h(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return"";for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function p(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function d(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function g(e,t){return p(e,t,"")}function m(e,t){return d(e,t,"")}function v(e,t){return t.slice(0,function(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);const s=Array(r);let i=0;s[0]=0;for(let o=1;o<r;o++){for(t[o]==t[i]?s[o]=s[i]:s[o]=i;i>0&&t[o]!=t[i];)i=s[i];t[o]==t[i]&&i++}i=0;for(let o=n;o<e.length;o++){for(;i>0&&e[o]!=t[i];)i=s[i];e[o]==t[i]&&i++}return i}(e,t))}function w(e){let t;for(t=e.length-1;t>=0&&e[t].match(/\s/);t--);return e.substring(t+1)}function y(e){const t=e.match(/^\s*/);return t?t[0]:""}const k="a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",L=new RegExp(`[${k}]+|\\s+|[^${k}]`,"ug");const b=new class extends e{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){const r=t.intlSegmenter;if("word"!=r.resolvedOptions().granularity)throw new Error('The segmenter passed must have a granularity of "word"');n=Array.from(r.segment(e),e=>e.segment)}else n=e.match(L)||[];const r=[];let s=null;return n.forEach(e=>{/\s/.test(e)?null==s?r.push(e):r.push(r.pop()+e):null!=s&&/\s/.test(s)?r[r.length-1]==s?r.push(r.pop()+e):r.push(s+e):r.push(e),s=e}),r}join(e){return e.map((e,t)=>0==t?e:e.replace(/^\s+/,"")).join("")}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,s=null;return e.forEach(e=>{e.added?r=e:e.removed?s=e:((r||s)&&S(n,s,r,e),n=e,r=null,s=null)}),(r||s)&&S(n,s,r,null),e}};function j(e,t,n){return null==(null==n?void 0:n.ignoreWhitespace)||n.ignoreWhitespace?b.diff(e,t,n):E(e,t,n)}function S(e,t,n,r){if(t&&n){const s=y(t.value),i=w(t.value),o=y(n.value),l=w(n.value);if(e){const r=f(s,o);e.value=d(e.value,o,r),t.value=g(t.value,r),n.value=g(n.value,r)}if(r){const e=h(i,l);r.value=p(r.value,l,e),t.value=m(t.value,e),n.value=m(n.value,e)}}else if(n){if(e){const e=y(n.value);n.value=n.value.substring(e.length)}if(r){const e=y(r.value);r.value=r.value.substring(e.length)}}else if(e&&r){const n=y(r.value),s=y(t.value),i=w(t.value),o=f(n,s);t.value=g(t.value,o);const l=h(g(n,o),i);t.value=m(t.value,l),r.value=p(r.value,n,l),e.value=d(e.value,n,n.slice(0,n.length-l.length))}else if(r){const e=y(r.value),n=v(w(t.value),e);t.value=m(t.value,n)}else if(e){const n=v(w(e.value),y(t.value));t.value=g(t.value,n)}}const O=new class extends e{tokenize(e){const t=new RegExp(`(\\r?\\n)|[${k}]+|[^\\S\\n\\r]+|[^${k}]`,"ug");return e.match(t)||[]}};function E(e,t,n){return O.diff(e,t,n)}function A(e){return"."==e||"!"==e||"?"==e}const F=new class extends e{tokenize(e){var t;const n=[];let r=0;for(let s=0;s<e.length;s++){if(s==e.length-1){n.push(e.slice(r));break}if(A(e[s])&&e[s+1].match(/\s/)){for(n.push(e.slice(r,s+1)),s=r=s+1;null===(t=e[s+1])||void 0===t?void 0:t.match(/\s/);)s++;n.push(e.slice(r,s+1)),r=s+1}}return n}};function x(e,t,n){return F.diff(e,t,n)}const $=new class extends e{tokenize(e){return e.split(/([{}:;,]|\s+)/)}};function W(e,t,n){return $.diff(e,t,n)}const N=new class extends e{constructor(){super(...arguments),this.tokenize=t}get useLongestToken(){return!0}castInput(e,t){const{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>void 0===t?n:t}=t;return"string"==typeof e?e:JSON.stringify(_(e,null,null,r),null," ")}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,"$1"),t.replace(/,([\r\n])/g,"$1"),n)}};function z(e,t,n){return N.diff(e,t,n)}function _(e,t,n,r,s){let i,o;for(t=t||[],n=n||[],r&&(e=r(void 0===s?"":s,e)),i=0;i<t.length;i+=1)if(t[i]===e)return n[i];if("[object Array]"===Object.prototype.toString.call(e)){for(t.push(e),o=new Array(e.length),n.push(o),i=0;i<e.length;i+=1)o[i]=_(e[i],t,n,r,String(i));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),"object"==typeof e&&null!==e){t.push(e),o={},n.push(o);const s=[];let l;for(l in e)Object.prototype.hasOwnProperty.call(e,l)&&s.push(l);for(s.sort(),i=0;i<s.length;i+=1)l=s[i],o[l]=_(e[l],t,n,r,l);t.pop(),n.pop()}else o=e;return o}const C=new class extends e{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};function H(e,t,n){return C.diff(e,t,n)}function J(e){return Array.isArray(e)?e.map(e=>J(e)):Object.assign(Object.assign({},e),{hunks:e.hunks.map(e=>Object.assign(Object.assign({},e),{lines:e.lines.map((t,n)=>{var r;return t.startsWith("\\")||t.endsWith("\r")||(null===(r=e.lines[n+1])||void 0===r?void 0:r.startsWith("\\"))?t:t+"\r"})}))})}function P(e){return Array.isArray(e)?e.map(e=>P(e)):Object.assign(Object.assign({},e),{hunks:e.hunks.map(e=>Object.assign(Object.assign({},e),{lines:e.lines.map(e=>e.endsWith("\r")?e.substring(0,e.length-1):e)}))})}function I(e){const t=e.split(/\n/),n=[];let r=0;function s(){const e={};for(n.push(e);r<t.length;){const n=t[r];if(/^(---|\+\+\+|@@)\s/.test(n))break;const s=/^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(n);s&&(e.index=s[1]),r++}for(i(e),i(e),e.hunks=[];r<t.length;){const n=t[r];if(/^(Index:\s|diff\s|---\s|\+\+\+\s|===================================================================)/.test(n))break;if(/^@@/.test(n))e.hunks.push(o());else{if(n)throw new Error("Unknown line "+(r+1)+" "+JSON.stringify(n));r++}}}function i(e){const n=/^(---|\+\+\+)\s+(.*)\r?$/.exec(t[r]);if(n){const t=n[2].split("\t",2),s=(t[1]||"").trim();let i=t[0].replace(/\\\\/g,"\\");/^".*"$/.test(i)&&(i=i.substr(1,i.length-2)),"---"===n[1]?(e.oldFileName=i,e.oldHeader=s):(e.newFileName=i,e.newHeader=s),r++}}function o(){var e;const n=r,s=t[r++].split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/),i={oldStart:+s[1],oldLines:void 0===s[2]?1:+s[2],newStart:+s[3],newLines:void 0===s[4]?1:+s[4],lines:[]};0===i.oldLines&&(i.oldStart+=1),0===i.newLines&&(i.newStart+=1);let o=0,l=0;for(;r<t.length&&(l<i.oldLines||o<i.newLines||(null===(e=t[r])||void 0===e?void 0:e.startsWith("\\")));r++){const e=0==t[r].length&&r!=t.length-1?" ":t[r][0];if("+"!==e&&"-"!==e&&" "!==e&&"\\"!==e)throw new Error(`Hunk at line ${n+1} contained invalid line ${t[r]}`);i.lines.push(t[r]),"+"===e?o++:"-"===e?l++:" "===e&&(o++,l++)}if(o||1!==i.newLines||(i.newLines=0),l||1!==i.oldLines||(i.oldLines=0),o!==i.newLines)throw new Error("Added line count did not match for hunk at line "+(n+1));if(l!==i.oldLines)throw new Error("Removed line count did not match for hunk at line "+(n+1));return i}for(;r<t.length;)s();return n}function D(e,t,n){let r=!0,s=!1,i=!1,o=1;return function l(){if(r&&!i){if(s?o++:r=!1,e+o<=n)return e+o;i=!0}if(!s)return i||(r=!0),t<=e-o?e-o++:(s=!0,l())}}function R(e,t,n={}){let r;if(r="string"==typeof t?I(t):Array.isArray(t)?t:[t],r.length>1)throw new Error("applyPatch only works with a single input.");return function(e,t,n={}){(n.autoConvertLineEndings||null==n.autoConvertLineEndings)&&((r=e).includes("\r\n")&&!r.startsWith("\n")&&!r.match(/[^\r]\n/)&&function(e){return Array.isArray(e)||(e=[e]),!e.some(e=>e.hunks.some(e=>e.lines.some(e=>!e.startsWith("\\")&&e.endsWith("\r"))))}(t)?t=J(t):function(e){return!e.includes("\r\n")&&e.includes("\n")}(e)&&function(e){return Array.isArray(e)||(e=[e]),e.some(e=>e.hunks.some(e=>e.lines.some(e=>e.endsWith("\r"))))&&e.every(e=>e.hunks.every(e=>e.lines.every((t,n)=>{var r;return t.startsWith("\\")||t.endsWith("\r")||(null===(r=e.lines[n+1])||void 0===r?void 0:r.startsWith("\\"))})))}(t)&&(t=P(t)));var r;const s=e.split("\n"),i=t.hunks,o=n.compareLine||((e,t,n,r)=>t===r),l=n.fuzzFactor||0;let u=0;if(l<0||!Number.isInteger(l))throw new Error("fuzzFactor must be a non-negative integer");if(!i.length)return e;let a="",c=!1,f=!1;for(let g=0;g<i[i.length-1].lines.length;g++){const e=i[i.length-1].lines[g];"\\"==e[0]&&("+"==a[0]?c=!0:"-"==a[0]&&(f=!0)),a=e}if(c){if(f){if(!l&&""==s[s.length-1])return!1}else if(""==s[s.length-1])s.pop();else if(!l)return!1}else if(f)if(""!=s[s.length-1])s.push("");else if(!l)return!1;function h(e,t,n,r=0,i=!0,l=[],u=0){let a=0,c=!1;for(;r<e.length;r++){const f=e[r],p=f.length>0?f[0]:" ",d=f.length>0?f.substr(1):f;if("-"===p){if(!o(t+1,s[t],p,d))return n&&null!=s[t]?(l[u]=s[t],h(e,t+1,n-1,r,!1,l,u+1)):null;t++,a=0}if("+"===p){if(!i)return null;l[u]=d,u++,a=0,c=!0}if(" "===p){if(a++,l[u]=s[t],!o(t+1,s[t],p,d))return c||!n?null:s[t]&&(h(e,t+1,n-1,r+1,!1,l,u+1)||h(e,t+1,n-1,r,!1,l,u+1))||h(e,t,n-1,r+1,!1,l,u);u++,i=!0,c=!1,t++}}return u-=a,t-=a,l.length=u,{patchedLines:l,oldLineLastI:t-1}}const p=[];let d=0;for(let g=0;g<i.length;g++){const e=i[g];let t;const n=s.length-e.oldLines+l;let r;for(let s=0;s<=l;s++){r=e.oldStart+d-1;const i=D(r,u,n);for(;void 0!==r&&(t=h(e.lines,r,s),!t);r=i());if(t)break}if(!t)return!1;for(let i=u;i<r;i++)p.push(s[i]);for(let s=0;s<t.patchedLines.length;s++){const e=t.patchedLines[s];p.push(e)}u=t.oldLineLastI+1,d=r+1-e.oldStart}for(let g=u;g<s.length;g++)p.push(s[g]);return p.join("\n")}(e,r[0],n)}function T(e,t){const n="string"==typeof e?I(e):e;let r=0;!function e(){const s=n[r++];if(!s)return t.complete();t.loadFile(s,function(n,r){if(n)return t.complete(n);const i=R(r,s,t);t.patched(s,i,function(n){if(n)return t.complete(n);e()})})}()}function q(e){return Array.isArray(e)?e.map(e=>q(e)).reverse():Object.assign(Object.assign({},e),{oldFileName:e.newFileName,oldHeader:e.newHeader,newFileName:e.oldFileName,newHeader:e.oldHeader,hunks:e.hunks.map(e=>({oldLines:e.newLines,oldStart:e.newStart,newLines:e.oldLines,newStart:e.oldStart,lines:e.lines.map(e=>e.startsWith("-")?`+${e.slice(1)}`:e.startsWith("+")?`-${e.slice(1)}`:e)}))})}function U(e){const t=[];let n,r;for(let s=0;s<e.length;s++)n=e[s],r=n.added?1:n.removed?-1:0,t.push([r,n.value]);return t}function Z(e){const t=[];for(let n=0;n<e.length;n++){const r=e[n];r.added?t.push("<ins>"):r.removed&&t.push("<del>"),t.push(B(r.value)),r.added?t.push("</ins>"):r.removed&&t.push("</del>")}return t.join("")}function B(e){let t=e;return t=t.replace(/&/g,"&"),t=t.replace(/</g,"<"),t=t.replace(/>/g,">"),t=t.replace(/"/g,"""),t}export{e as Diff,R as applyPatch,T as applyPatches,C as arrayDiff,_ as canonicalize,a as characterDiff,U as convertChangesToDMP,Z as convertChangesToXML,n as createPatch,r as createTwoFilesPatch,$ as cssDiff,H as diffArrays,c as diffChars,W as diffCss,z as diffJson,s as diffLines,x as diffSentences,i as diffTrimmedLines,j as diffWords,E as diffWordsWithSpace,o as formatPatch,N as jsonDiff,l as lineDiff,I as parsePatch,q as reversePatch,F as sentenceDiff,u as structuredPatch,b as wordDiff,O as wordsWithSpaceDiff};
|