@stacksjs/whois 0.63.0 → 0.64.0

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/index.js CHANGED
@@ -1,601 +1,5 @@
1
1
  // @bun
2
- // src/index.ts
3
- import Net from "net";
4
- import fetch from "node-fetch";
5
- import {SocksClient} from "socks";
2
+ var t1=Object.create;var{getPrototypeOf:e1,defineProperty:X9,getOwnPropertyNames:w8}=Object;var J8=Object.prototype.hasOwnProperty;var Q8=(w,J,X)=>{X=w!=null?t1(e1(w)):{};const Y=J||!w||!w.__esModule?X9(X,"default",{value:w,enumerable:!0}):X;for(let Z of w8(w))if(!J8.call(Y,Z))X9(Y,Z,{get:()=>w[Z],enumerable:!0});return Y};var R=(w,J)=>()=>(J||w((J={exports:{}}).exports,J),J.exports);var G9=R((h9)=>{function $8(w){if(!K9.Buffer.isEncoding(w))throw new Error(Kw.INVALID_ENCODING)}function Z9(w){return typeof w==="number"&&isFinite(w)&&Z8(w)}function W9(w,J){if(typeof w==="number"){if(!Z9(w)||w<0)throw new Error(J?Kw.INVALID_OFFSET:Kw.INVALID_LENGTH)}else throw new Error(J?Kw.INVALID_OFFSET_NON_NUMBER:Kw.INVALID_LENGTH_NON_NUMBER)}function Y8(w){W9(w,!1)}function X8(w){W9(w,!0)}function K8(w,J){if(w<0||w>J.length)throw new Error(Kw.INVALID_TARGET_OFFSET)}function Z8(w){return typeof w==="number"&&isFinite(w)&&Math.floor(w)===w}function W8(w){if(typeof BigInt==="undefined")throw new Error("Platform does not support JS BigInt type.");if(typeof K9.Buffer.prototype[w]==="undefined")throw new Error(`Platform does not support Buffer.prototype.${w}.`)}Object.defineProperty(h9,"__esModule",{value:!0});var K9=import.meta.require("buffer"),Kw={INVALID_ENCODING:"Invalid encoding provided. Please specify a valid encoding the internal Node.js Buffer supports.",INVALID_SMARTBUFFER_SIZE:"Invalid size provided. Size must be a valid integer greater than zero.",INVALID_SMARTBUFFER_BUFFER:"Invalid Buffer provided in SmartBufferOptions.",INVALID_SMARTBUFFER_OBJECT:"Invalid SmartBufferOptions object supplied to SmartBuffer constructor or factory methods.",INVALID_OFFSET:"An invalid offset value was provided.",INVALID_OFFSET_NON_NUMBER:"An invalid offset value was provided. A numeric value is required.",INVALID_LENGTH:"An invalid length value was provided.",INVALID_LENGTH_NON_NUMBER:"An invalid length value was provived. A numeric value is required.",INVALID_TARGET_OFFSET:"Target offset is beyond the bounds of the internal SmartBuffer data.",INVALID_TARGET_LENGTH:"Specified length value moves cursor beyong the bounds of the internal SmartBuffer data.",INVALID_READ_BEYOND_BOUNDS:"Attempted to read beyond the bounds of the managed data.",INVALID_WRITE_BEYOND_BOUNDS:"Attempted to write beyond the bounds of the managed data."};h9.ERRORS=Kw;h9.checkEncoding=$8;h9.isFiniteInteger=Z9;h9.checkLengthValue=Y8;h9.checkOffsetValue=X8;h9.checkTargetOffset=K8;h9.bigIntAndBufferInt64Check=W8});var U9=R((F9)=>{Object.defineProperty(F9,"__esModule",{value:!0});var P=G9(),q9=4096,O8="utf8";class xw{constructor(w){if(this.length=0,this._encoding=O8,this._writeOffset=0,this._readOffset=0,xw.isSmartBufferOptions(w)){if(w.encoding)P.checkEncoding(w.encoding),this._encoding=w.encoding;if(w.size)if(P.isFiniteInteger(w.size)&&w.size>0)this._buff=Buffer.allocUnsafe(w.size);else throw new Error(P.ERRORS.INVALID_SMARTBUFFER_SIZE);else if(w.buff)if(Buffer.isBuffer(w.buff))this._buff=w.buff,this.length=w.buff.length;else throw new Error(P.ERRORS.INVALID_SMARTBUFFER_BUFFER);else this._buff=Buffer.allocUnsafe(q9)}else{if(typeof w!=="undefined")throw new Error(P.ERRORS.INVALID_SMARTBUFFER_OBJECT);this._buff=Buffer.allocUnsafe(q9)}}static fromSize(w,J){return new this({size:w,encoding:J})}static fromBuffer(w,J){return new this({buff:w,encoding:J})}static fromOptions(w){return new this(w)}static isSmartBufferOptions(w){const J=w;return J&&(J.encoding!==void 0||J.size!==void 0||J.buff!==void 0)}readInt8(w){return this._readNumberValue(Buffer.prototype.readInt8,1,w)}readInt16BE(w){return this._readNumberValue(Buffer.prototype.readInt16BE,2,w)}readInt16LE(w){return this._readNumberValue(Buffer.prototype.readInt16LE,2,w)}readInt32BE(w){return this._readNumberValue(Buffer.prototype.readInt32BE,4,w)}readInt32LE(w){return this._readNumberValue(Buffer.prototype.readInt32LE,4,w)}readBigInt64BE(w){return P.bigIntAndBufferInt64Check("readBigInt64BE"),this._readNumberValue(Buffer.prototype.readBigInt64BE,8,w)}readBigInt64LE(w){return P.bigIntAndBufferInt64Check("readBigInt64LE"),this._readNumberValue(Buffer.prototype.readBigInt64LE,8,w)}writeInt8(w,J){return this._writeNumberValue(Buffer.prototype.writeInt8,1,w,J),this}insertInt8(w,J){return this._insertNumberValue(Buffer.prototype.writeInt8,1,w,J)}writeInt16BE(w,J){return this._writeNumberValue(Buffer.prototype.writeInt16BE,2,w,J)}insertInt16BE(w,J){return this._insertNumberValue(Buffer.prototype.writeInt16BE,2,w,J)}writeInt16LE(w,J){return this._writeNumberValue(Buffer.prototype.writeInt16LE,2,w,J)}insertInt16LE(w,J){return this._insertNumberValue(Buffer.prototype.writeInt16LE,2,w,J)}writeInt32BE(w,J){return this._writeNumberValue(Buffer.prototype.writeInt32BE,4,w,J)}insertInt32BE(w,J){return this._insertNumberValue(Buffer.prototype.writeInt32BE,4,w,J)}writeInt32LE(w,J){return this._writeNumberValue(Buffer.prototype.writeInt32LE,4,w,J)}insertInt32LE(w,J){return this._insertNumberValue(Buffer.prototype.writeInt32LE,4,w,J)}writeBigInt64BE(w,J){return P.bigIntAndBufferInt64Check("writeBigInt64BE"),this._writeNumberValue(Buffer.prototype.writeBigInt64BE,8,w,J)}insertBigInt64BE(w,J){return P.bigIntAndBufferInt64Check("writeBigInt64BE"),this._insertNumberValue(Buffer.prototype.writeBigInt64BE,8,w,J)}writeBigInt64LE(w,J){return P.bigIntAndBufferInt64Check("writeBigInt64LE"),this._writeNumberValue(Buffer.prototype.writeBigInt64LE,8,w,J)}insertBigInt64LE(w,J){return P.bigIntAndBufferInt64Check("writeBigInt64LE"),this._insertNumberValue(Buffer.prototype.writeBigInt64LE,8,w,J)}readUInt8(w){return this._readNumberValue(Buffer.prototype.readUInt8,1,w)}readUInt16BE(w){return this._readNumberValue(Buffer.prototype.readUInt16BE,2,w)}readUInt16LE(w){return this._readNumberValue(Buffer.prototype.readUInt16LE,2,w)}readUInt32BE(w){return this._readNumberValue(Buffer.prototype.readUInt32BE,4,w)}readUInt32LE(w){return this._readNumberValue(Buffer.prototype.readUInt32LE,4,w)}readBigUInt64BE(w){return P.bigIntAndBufferInt64Check("readBigUInt64BE"),this._readNumberValue(Buffer.prototype.readBigUInt64BE,8,w)}readBigUInt64LE(w){return P.bigIntAndBufferInt64Check("readBigUInt64LE"),this._readNumberValue(Buffer.prototype.readBigUInt64LE,8,w)}writeUInt8(w,J){return this._writeNumberValue(Buffer.prototype.writeUInt8,1,w,J)}insertUInt8(w,J){return this._insertNumberValue(Buffer.prototype.writeUInt8,1,w,J)}writeUInt16BE(w,J){return this._writeNumberValue(Buffer.prototype.writeUInt16BE,2,w,J)}insertUInt16BE(w,J){return this._insertNumberValue(Buffer.prototype.writeUInt16BE,2,w,J)}writeUInt16LE(w,J){return this._writeNumberValue(Buffer.prototype.writeUInt16LE,2,w,J)}insertUInt16LE(w,J){return this._insertNumberValue(Buffer.prototype.writeUInt16LE,2,w,J)}writeUInt32BE(w,J){return this._writeNumberValue(Buffer.prototype.writeUInt32BE,4,w,J)}insertUInt32BE(w,J){return this._insertNumberValue(Buffer.prototype.writeUInt32BE,4,w,J)}writeUInt32LE(w,J){return this._writeNumberValue(Buffer.prototype.writeUInt32LE,4,w,J)}insertUInt32LE(w,J){return this._insertNumberValue(Buffer.prototype.writeUInt32LE,4,w,J)}writeBigUInt64BE(w,J){return P.bigIntAndBufferInt64Check("writeBigUInt64BE"),this._writeNumberValue(Buffer.prototype.writeBigUInt64BE,8,w,J)}insertBigUInt64BE(w,J){return P.bigIntAndBufferInt64Check("writeBigUInt64BE"),this._insertNumberValue(Buffer.prototype.writeBigUInt64BE,8,w,J)}writeBigUInt64LE(w,J){return P.bigIntAndBufferInt64Check("writeBigUInt64LE"),this._writeNumberValue(Buffer.prototype.writeBigUInt64LE,8,w,J)}insertBigUInt64LE(w,J){return P.bigIntAndBufferInt64Check("writeBigUInt64LE"),this._insertNumberValue(Buffer.prototype.writeBigUInt64LE,8,w,J)}readFloatBE(w){return this._readNumberValue(Buffer.prototype.readFloatBE,4,w)}readFloatLE(w){return this._readNumberValue(Buffer.prototype.readFloatLE,4,w)}writeFloatBE(w,J){return this._writeNumberValue(Buffer.prototype.writeFloatBE,4,w,J)}insertFloatBE(w,J){return this._insertNumberValue(Buffer.prototype.writeFloatBE,4,w,J)}writeFloatLE(w,J){return this._writeNumberValue(Buffer.prototype.writeFloatLE,4,w,J)}insertFloatLE(w,J){return this._insertNumberValue(Buffer.prototype.writeFloatLE,4,w,J)}readDoubleBE(w){return this._readNumberValue(Buffer.prototype.readDoubleBE,8,w)}readDoubleLE(w){return this._readNumberValue(Buffer.prototype.readDoubleLE,8,w)}writeDoubleBE(w,J){return this._writeNumberValue(Buffer.prototype.writeDoubleBE,8,w,J)}insertDoubleBE(w,J){return this._insertNumberValue(Buffer.prototype.writeDoubleBE,8,w,J)}writeDoubleLE(w,J){return this._writeNumberValue(Buffer.prototype.writeDoubleLE,8,w,J)}insertDoubleLE(w,J){return this._insertNumberValue(Buffer.prototype.writeDoubleLE,8,w,J)}readString(w,J){let X;if(typeof w==="number")P.checkLengthValue(w),X=Math.min(w,this.length-this._readOffset);else J=w,X=this.length-this._readOffset;if(typeof J!=="undefined")P.checkEncoding(J);const Y=this._buff.slice(this._readOffset,this._readOffset+X).toString(J||this._encoding);return this._readOffset+=X,Y}insertString(w,J,X){return P.checkOffsetValue(J),this._handleString(w,!0,J,X)}writeString(w,J,X){return this._handleString(w,!1,J,X)}readStringNT(w){if(typeof w!=="undefined")P.checkEncoding(w);let J=this.length;for(let Y=this._readOffset;Y<this.length;Y++)if(this._buff[Y]===0){J=Y;break}const X=this._buff.slice(this._readOffset,J);return this._readOffset=J+1,X.toString(w||this._encoding)}insertStringNT(w,J,X){return P.checkOffsetValue(J),this.insertString(w,J,X),this.insertUInt8(0,J+w.length),this}writeStringNT(w,J,X){return this.writeString(w,J,X),this.writeUInt8(0,typeof J==="number"?J+w.length:this.writeOffset),this}readBuffer(w){if(typeof w!=="undefined")P.checkLengthValue(w);const J=typeof w==="number"?w:this.length,X=Math.min(this.length,this._readOffset+J),Y=this._buff.slice(this._readOffset,X);return this._readOffset=X,Y}insertBuffer(w,J){return P.checkOffsetValue(J),this._handleBuffer(w,!0,J)}writeBuffer(w,J){return this._handleBuffer(w,!1,J)}readBufferNT(){let w=this.length;for(let X=this._readOffset;X<this.length;X++)if(this._buff[X]===0){w=X;break}const J=this._buff.slice(this._readOffset,w);return this._readOffset=w+1,J}insertBufferNT(w,J){return P.checkOffsetValue(J),this.insertBuffer(w,J),this.insertUInt8(0,J+w.length),this}writeBufferNT(w,J){if(typeof J!=="undefined")P.checkOffsetValue(J);return this.writeBuffer(w,J),this.writeUInt8(0,typeof J==="number"?J+w.length:this._writeOffset),this}clear(){return this._writeOffset=0,this._readOffset=0,this.length=0,this}remaining(){return this.length-this._readOffset}get readOffset(){return this._readOffset}set readOffset(w){P.checkOffsetValue(w),P.checkTargetOffset(w,this),this._readOffset=w}get writeOffset(){return this._writeOffset}set writeOffset(w){P.checkOffsetValue(w),P.checkTargetOffset(w,this),this._writeOffset=w}get encoding(){return this._encoding}set encoding(w){P.checkEncoding(w),this._encoding=w}get internalBuffer(){return this._buff}toBuffer(){return this._buff.slice(0,this.length)}toString(w){const J=typeof w==="string"?w:this._encoding;return P.checkEncoding(J),this._buff.toString(J,0,this.length)}destroy(){return this.clear(),this}_handleString(w,J,X,Y){let Z=this._writeOffset,h=this._encoding;if(typeof X==="number")Z=X;else if(typeof X==="string")P.checkEncoding(X),h=X;if(typeof Y==="string")P.checkEncoding(Y),h=Y;const z=Buffer.byteLength(w,h);if(J)this.ensureInsertable(z,Z);else this._ensureWriteable(z,Z);if(this._buff.write(w,Z,z,h),J)this._writeOffset+=z;else if(typeof X==="number")this._writeOffset=Math.max(this._writeOffset,Z+z);else this._writeOffset+=z;return this}_handleBuffer(w,J,X){const Y=typeof X==="number"?X:this._writeOffset;if(J)this.ensureInsertable(w.length,Y);else this._ensureWriteable(w.length,Y);if(w.copy(this._buff,Y),J)this._writeOffset+=w.length;else if(typeof X==="number")this._writeOffset=Math.max(this._writeOffset,Y+w.length);else this._writeOffset+=w.length;return this}ensureReadable(w,J){let X=this._readOffset;if(typeof J!=="undefined")P.checkOffsetValue(J),X=J;if(X<0||X+w>this.length)throw new Error(P.ERRORS.INVALID_READ_BEYOND_BOUNDS)}ensureInsertable(w,J){if(P.checkOffsetValue(J),this._ensureCapacity(this.length+w),J<this.length)this._buff.copy(this._buff,J+w,J,this._buff.length);if(J+w>this.length)this.length=J+w;else this.length+=w}_ensureWriteable(w,J){const X=typeof J==="number"?J:this._writeOffset;if(this._ensureCapacity(X+w),X+w>this.length)this.length=X+w}_ensureCapacity(w){const J=this._buff.length;if(w>J){let X=this._buff,Y=J*3/2+1;if(Y<w)Y=w;this._buff=Buffer.allocUnsafe(Y),X.copy(this._buff,0,0,J)}}_readNumberValue(w,J,X){this.ensureReadable(J,X);const Y=w.call(this._buff,typeof X==="number"?X:this._readOffset);if(typeof X==="undefined")this._readOffset+=J;return Y}_insertNumberValue(w,J,X,Y){return P.checkOffsetValue(Y),this.ensureInsertable(J,Y),w.call(this._buff,X,Y),this._writeOffset+=J,this}_writeNumberValue(w,J,X,Y){if(typeof Y==="number"){if(Y<0)throw new Error(P.ERRORS.INVALID_WRITE_BEYOND_BOUNDS);P.checkOffsetValue(Y)}const Z=typeof Y==="number"?Y:this._writeOffset;if(this._ensureWriteable(J,Z),w.call(this._buff,X,Z),typeof Y==="number")this._writeOffset=Math.max(this._writeOffset,Z+J);else this._writeOffset+=J;return this}}F9.SmartBuffer=xw});var mw=R((P9)=>{Object.defineProperty(P9,"__esModule",{value:!0});P9.SOCKS5_NO_ACCEPTABLE_AUTH=P9.SOCKS5_CUSTOM_AUTH_END=P9.SOCKS5_CUSTOM_AUTH_START=P9.SOCKS_INCOMING_PACKET_SIZES=P9.SocksClientState=P9.Socks5Response=P9.Socks5HostType=P9.Socks5Auth=P9.Socks4Response=P9.SocksCommand=P9.ERRORS=P9.DEFAULT_TIMEOUT=void 0;var E8=30000;P9.DEFAULT_TIMEOUT=E8;var H8={InvalidSocksCommand:"An invalid SOCKS command was provided. Valid options are connect, bind, and associate.",InvalidSocksCommandForOperation:"An invalid SOCKS command was provided. Only a subset of commands are supported for this operation.",InvalidSocksCommandChain:"An invalid SOCKS command was provided. Chaining currently only supports the connect command.",InvalidSocksClientOptionsDestination:"An invalid destination host was provided.",InvalidSocksClientOptionsExistingSocket:"An invalid existing socket was provided. This should be an instance of stream.Duplex.",InvalidSocksClientOptionsProxy:"Invalid SOCKS proxy details were provided.",InvalidSocksClientOptionsTimeout:"An invalid timeout value was provided. Please enter a value above 0 (in ms).",InvalidSocksClientOptionsProxiesLength:"At least two socks proxies must be provided for chaining.",InvalidSocksClientOptionsCustomAuthRange:"Custom auth must be a value between 0x80 and 0xFE.",InvalidSocksClientOptionsCustomAuthOptions:"When a custom_auth_method is provided, custom_auth_request_handler, custom_auth_response_size, and custom_auth_response_handler must also be provided and valid.",NegotiationError:"Negotiation error",SocketClosed:"Socket closed",ProxyConnectionTimedOut:"Proxy connection timed out",InternalError:"SocksClient internal error (this should not happen)",InvalidSocks4HandshakeResponse:"Received invalid Socks4 handshake response",Socks4ProxyRejectedConnection:"Socks4 Proxy rejected connection",InvalidSocks4IncomingConnectionResponse:"Socks4 invalid incoming connection response",Socks4ProxyRejectedIncomingBoundConnection:"Socks4 Proxy rejected incoming bound connection",InvalidSocks5InitialHandshakeResponse:"Received invalid Socks5 initial handshake response",InvalidSocks5IntiailHandshakeSocksVersion:"Received invalid Socks5 initial handshake (invalid socks version)",InvalidSocks5InitialHandshakeNoAcceptedAuthType:"Received invalid Socks5 initial handshake (no accepted authentication type)",InvalidSocks5InitialHandshakeUnknownAuthType:"Received invalid Socks5 initial handshake (unknown authentication type)",Socks5AuthenticationFailed:"Socks5 Authentication failed",InvalidSocks5FinalHandshake:"Received invalid Socks5 final handshake response",InvalidSocks5FinalHandshakeRejected:"Socks5 proxy rejected connection",InvalidSocks5IncomingConnectionResponse:"Received invalid Socks5 incoming connection response",Socks5ProxyRejectedIncomingBoundConnection:"Socks5 Proxy rejected incoming bound connection"};P9.ERRORS=H8;var P8={Socks5InitialHandshakeResponse:2,Socks5UserPassAuthenticationResponse:2,Socks5ResponseHeader:5,Socks5ResponseIPv4:10,Socks5ResponseIPv6:22,Socks5ResponseHostname:(w)=>w+7,Socks4Response:8};P9.SOCKS_INCOMING_PACKET_SIZES=P8;var z9;(function(w){w[w.connect=1]="connect",w[w.bind=2]="bind",w[w.associate=3]="associate"})(z9||(P9.SocksCommand=z9={}));var N9;(function(w){w[w.Granted=90]="Granted",w[w.Failed=91]="Failed",w[w.Rejected=92]="Rejected",w[w.RejectedIdent=93]="RejectedIdent"})(N9||(P9.Socks4Response=N9={}));var O9;(function(w){w[w.NoAuth=0]="NoAuth",w[w.GSSApi=1]="GSSApi",w[w.UserPass=2]="UserPass"})(O9||(P9.Socks5Auth=O9={}));var D8=128;P9.SOCKS5_CUSTOM_AUTH_START=D8;var M8=254;P9.SOCKS5_CUSTOM_AUTH_END=M8;var T8=255;P9.SOCKS5_NO_ACCEPTABLE_AUTH=T8;var V9;(function(w){w[w.Granted=0]="Granted",w[w.Failure=1]="Failure",w[w.NotAllowed=2]="NotAllowed",w[w.NetworkUnreachable=3]="NetworkUnreachable",w[w.HostUnreachable=4]="HostUnreachable",w[w.ConnectionRefused=5]="ConnectionRefused",w[w.TTLExpired=6]="TTLExpired",w[w.CommandNotSupported=7]="CommandNotSupported",w[w.AddressNotSupported=8]="AddressNotSupported"})(V9||(P9.Socks5Response=V9={}));var E9;(function(w){w[w.IPv4=1]="IPv4",w[w.Hostname=3]="Hostname",w[w.IPv6=4]="IPv6"})(E9||(P9.Socks5HostType=E9={}));var H9;(function(w){w[w.Created=0]="Created",w[w.Connecting=1]="Connecting",w[w.Connected=2]="Connected",w[w.SentInitialHandshake=3]="SentInitialHandshake",w[w.ReceivedInitialHandshakeResponse=4]="ReceivedInitialHandshakeResponse",w[w.SentAuthentication=5]="SentAuthentication",w[w.ReceivedAuthenticationResponse=6]="ReceivedAuthenticationResponse",w[w.SentFinalHandshake=7]="SentFinalHandshake",w[w.ReceivedFinalResponse=8]="ReceivedFinalResponse",w[w.BoundWaitingForConnection=9]="BoundWaitingForConnection",w[w.Established=10]="Established",w[w.Disconnected=11]="Disconnected",w[w.Error=99]="Error"})(H9||(P9.SocksClientState=H9={}))});var cw=R((T9)=>{function b8(w){for(let J=w.length-1;J>0;J--){const X=Math.floor(Math.random()*(J+1));[w[J],w[X]]=[w[X],w[J]]}}Object.defineProperty(T9,"__esModule",{value:!0});T9.shuffleArray=T9.SocksClientError=void 0;class M9 extends Error{constructor(w,J){super(w);this.options=J}}T9.SocksClientError=M9;T9.shuffleArray=b8});var _w=R((A9)=>{function m8(w){if(this.subnetMask<w.subnetMask)return!1;if(this.mask(w.subnetMask)===w.mask())return!0;return!1}function c8(w){return function(){if(this.addressMinusSuffix!==this.correctForm())return!1;if(this.subnetMask===w&&!this.parsedSubnet)return!0;return this.parsedSubnet===String(this.subnetMask)}}Object.defineProperty(A9,"__esModule",{value:!0});A9.isCorrect=A9.isInSubnet=void 0;A9.isInSubnet=m8;A9.isCorrect=c8});var gw=R((R9)=>{Object.defineProperty(R9,"__esModule",{value:!0});R9.RE_SUBNET_STRING=R9.RE_ADDRESS=R9.GROUPS=R9.BITS=void 0;R9.BITS=32;R9.GROUPS=4;R9.RE_ADDRESS=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g;R9.RE_SUBNET_STRING=/\/\d{1,2}$/});var Tw=R((I9)=>{Object.defineProperty(I9,"__esModule",{value:!0});I9.AddressError=void 0;class B9 extends Error{constructor(w,J){super(w);if(this.name="AddressError",J!==null)this.parseMessage=J}}I9.AddressError=B9});var uw=R((Lw,v9)=>{(function(){var w,J=244837814094590,X=(J&16777215)==15715070;function Y(Q,$,K){if(Q!=null)if(typeof Q=="number")this.fromNumber(Q,$,K);else if($==null&&typeof Q!="string")this.fromString(Q,256);else this.fromString(Q,$)}function Z(){return new Y(null)}function h(Q,$,K,W,G,F){while(--F>=0){var N=$*this[Q++]+K[W]+G;G=Math.floor(N/67108864),K[W++]=N&67108863}return G}function z(Q,$,K,W,G,F){var N=$&32767,O=$>>15;while(--F>=0){var C=this[Q]&32767,B=this[Q++]>>15,f=O*C+B*N;C=N*C+((f&32767)<<15)+K[W]+(G&1073741823),G=(C>>>30)+(f>>>15)+O*B+(G>>>30),K[W++]=C&1073741823}return G}function V(Q,$,K,W,G,F){var N=$&16383,O=$>>14;while(--F>=0){var C=this[Q]&16383,B=this[Q++]>>14,f=O*C+B*N;C=N*C+((f&16383)<<14)+K[W]+G,G=(C>>28)+(f>>14)+O*B,K[W++]=C&268435455}return G}var E=typeof navigator!=="undefined";if(E&&X&&navigator.appName=="Microsoft Internet Explorer")Y.prototype.am=z,w=30;else if(E&&X&&navigator.appName!="Netscape")Y.prototype.am=h,w=26;else Y.prototype.am=V,w=28;Y.prototype.DB=w,Y.prototype.DM=(1<<w)-1,Y.prototype.DV=1<<w;var L=52;Y.prototype.FV=Math.pow(2,L),Y.prototype.F1=L-w,Y.prototype.F2=2*w-L;var q="0123456789abcdefghijklmnopqrstuvwxyz",T=new Array,D,M;D="0".charCodeAt(0);for(M=0;M<=9;++M)T[D++]=M;D="a".charCodeAt(0);for(M=10;M<36;++M)T[D++]=M;D="A".charCodeAt(0);for(M=10;M<36;++M)T[D++]=M;function H(Q){return q.charAt(Q)}function Qw(Q,$){var K=T[Q.charCodeAt($)];return K==null?-1:K}function zw(Q){for(var $=this.t-1;$>=0;--$)Q[$]=this[$];Q.t=this.t,Q.s=this.s}function Nw(Q){if(this.t=1,this.s=Q<0?-1:0,Q>0)this[0]=Q;else if(Q<-1)this[0]=Q+this.DV;else this.t=0}function l(Q){var $=Z();return $.fromInt(Q),$}function e(Q,$){var K;if($==16)K=4;else if($==8)K=3;else if($==256)K=8;else if($==2)K=1;else if($==32)K=5;else if($==4)K=2;else{this.fromRadix(Q,$);return}this.t=0,this.s=0;var W=Q.length,G=!1,F=0;while(--W>=0){var N=K==8?Q[W]&255:Qw(Q,W);if(N<0){if(Q.charAt(W)=="-")G=!0;continue}if(G=!1,F==0)this[this.t++]=N;else if(F+K>this.DB)this[this.t-1]|=(N&(1<<this.DB-F)-1)<<F,this[this.t++]=N>>this.DB-F;else this[this.t-1]|=N<<F;if(F+=K,F>=this.DB)F-=this.DB}if(K==8&&(Q[0]&128)!=0){if(this.s=-1,F>0)this[this.t-1]|=(1<<this.DB-F)-1<<F}if(this.clamp(),G)Y.ZERO.subTo(this,this)}function U0(){var Q=this.s&this.DM;while(this.t>0&&this[this.t-1]==Q)--this.t}function z0(Q){if(this.s<0)return"-"+this.negate().toString(Q);var $;if(Q==16)$=4;else if(Q==8)$=3;else if(Q==2)$=1;else if(Q==32)$=5;else if(Q==4)$=2;else return this.toRadix(Q);var K=(1<<$)-1,W,G=!1,F="",N=this.t,O=this.DB-N*this.DB%$;if(N-- >0){if(O<this.DB&&(W=this[N]>>O)>0)G=!0,F=H(W);while(N>=0){if(O<$)W=(this[N]&(1<<O)-1)<<$-O,W|=this[--N]>>(O+=this.DB-$);else if(W=this[N]>>(O-=$)&K,O<=0)O+=this.DB,--N;if(W>0)G=!0;if(G)F+=H(W)}}return G?F:"0"}function N0(){var Q=Z();return Y.ZERO.subTo(this,Q),Q}function O0(){return this.s<0?this.negate():this}function V0(Q){var $=this.s-Q.s;if($!=0)return $;var K=this.t;if($=K-Q.t,$!=0)return this.s<0?-$:$;while(--K>=0)if(($=this[K]-Q[K])!=0)return $;return 0}function Hw(Q){var $=1,K;if((K=Q>>>16)!=0)Q=K,$+=16;if((K=Q>>8)!=0)Q=K,$+=8;if((K=Q>>4)!=0)Q=K,$+=4;if((K=Q>>2)!=0)Q=K,$+=2;if((K=Q>>1)!=0)Q=K,$+=1;return $}function E0(){if(this.t<=0)return 0;return this.DB*(this.t-1)+Hw(this[this.t-1]^this.s&this.DM)}function H0(Q,$){var K;for(K=this.t-1;K>=0;--K)$[K+Q]=this[K];for(K=Q-1;K>=0;--K)$[K]=0;$.t=this.t+Q,$.s=this.s}function P0(Q,$){for(var K=Q;K<this.t;++K)$[K-Q]=this[K];$.t=Math.max(this.t-Q,0),$.s=this.s}function D0(Q,$){var K=Q%this.DB,W=this.DB-K,G=(1<<W)-1,F=Math.floor(Q/this.DB),N=this.s<<K&this.DM,O;for(O=this.t-1;O>=0;--O)$[O+F+1]=this[O]>>W|N,N=(this[O]&G)<<K;for(O=F-1;O>=0;--O)$[O]=0;$[F]=N,$.t=this.t+F+1,$.s=this.s,$.clamp()}function M0(Q,$){$.s=this.s;var K=Math.floor(Q/this.DB);if(K>=this.t){$.t=0;return}var W=Q%this.DB,G=this.DB-W,F=(1<<W)-1;$[0]=this[K]>>W;for(var N=K+1;N<this.t;++N)$[N-K-1]|=(this[N]&F)<<G,$[N-K]=this[N]>>W;if(W>0)$[this.t-K-1]|=(this.s&F)<<G;$.t=this.t-K,$.clamp()}function T0(Q,$){var K=0,W=0,G=Math.min(Q.t,this.t);while(K<G)W+=this[K]-Q[K],$[K++]=W&this.DM,W>>=this.DB;if(Q.t<this.t){W-=Q.s;while(K<this.t)W+=this[K],$[K++]=W&this.DM,W>>=this.DB;W+=this.s}else{W+=this.s;while(K<Q.t)W-=Q[K],$[K++]=W&this.DM,W>>=this.DB;W-=Q.s}if($.s=W<0?-1:0,W<-1)$[K++]=this.DV+W;else if(W>0)$[K++]=W;$.t=K,$.clamp()}function L0(Q,$){var K=this.abs(),W=Q.abs(),G=K.t;$.t=G+W.t;while(--G>=0)$[G]=0;for(G=0;G<W.t;++G)$[G+K.t]=K.am(0,W[G],$,G,0,K.t);if($.s=0,$.clamp(),this.s!=Q.s)Y.ZERO.subTo($,$)}function A0(Q){var $=this.abs(),K=Q.t=2*$.t;while(--K>=0)Q[K]=0;for(K=0;K<$.t-1;++K){var W=$.am(K,$[K],Q,2*K,0,1);if((Q[K+$.t]+=$.am(K+1,2*$[K],Q,2*K+1,W,$.t-K-1))>=$.DV)Q[K+$.t]-=$.DV,Q[K+$.t+1]=1}if(Q.t>0)Q[Q.t-1]+=$.am(K,$[K],Q,2*K,0,1);Q.s=0,Q.clamp()}function C0(Q,$,K){var W=Q.abs();if(W.t<=0)return;var G=this.abs();if(G.t<W.t){if($!=null)$.fromInt(0);if(K!=null)this.copyTo(K);return}if(K==null)K=Z();var F=Z(),N=this.s,O=Q.s,C=this.DB-Hw(W[W.t-1]);if(C>0)W.lShiftTo(C,F),G.lShiftTo(C,K);else W.copyTo(F),G.copyTo(K);var B=F.t,f=F[B-1];if(f==0)return;var g=f*(1<<this.F1)+(B>1?F[B-2]>>this.F2:0),s=this.FV/g,Dw=(1<<this.F1)/g,p=1<<this.F2,n=K.t,Mw=n-B,ww=$==null?Z():$;if(F.dlShiftTo(Mw,ww),K.compareTo(ww)>=0)K[K.t++]=1,K.subTo(ww,K);Y.ONE.dlShiftTo(B,ww),ww.subTo(F,F);while(F.t<B)F[F.t++]=0;while(--Mw>=0){var bw=K[--n]==f?this.DM:Math.floor(K[n]*s+(K[n-1]+p)*Dw);if((K[n]+=F.am(0,bw,K,Mw,0,B))<bw){F.dlShiftTo(Mw,ww),K.subTo(ww,K);while(K[n]<--bw)K.subTo(ww,K)}}if($!=null){if(K.drShiftTo(B,$),N!=O)Y.ZERO.subTo($,$)}if(K.t=B,K.clamp(),C>0)K.rShiftTo(C,K);if(N<0)Y.ZERO.subTo(K,K)}function R0(Q){var $=Z();if(this.abs().divRemTo(Q,null,$),this.s<0&&$.compareTo(Y.ZERO)>0)Q.subTo($,$);return $}function $w(Q){this.m=Q}function j0(Q){if(Q.s<0||Q.compareTo(this.m)>=0)return Q.mod(this.m);else return Q}function B0(Q){return Q}function I0(Q){Q.divRemTo(this.m,null,Q)}function y0(Q,$,K){Q.multiplyTo($,K),this.reduce(K)}function v0(Q,$){Q.squareTo($),this.reduce($)}$w.prototype.convert=j0,$w.prototype.revert=B0,$w.prototype.reduce=I0,$w.prototype.mulTo=y0,$w.prototype.sqrTo=v0;function S0(){if(this.t<1)return 0;var Q=this[0];if((Q&1)==0)return 0;var $=Q&3;return $=$*(2-(Q&15)*$)&15,$=$*(2-(Q&255)*$)&255,$=$*(2-((Q&65535)*$&65535))&65535,$=$*(2-Q*$%this.DV)%this.DV,$>0?this.DV-$:-$}function Yw(Q){this.m=Q,this.mp=Q.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<Q.DB-15)-1,this.mt2=2*Q.t}function k0(Q){var $=Z();if(Q.abs().dlShiftTo(this.m.t,$),$.divRemTo(this.m,null,$),Q.s<0&&$.compareTo(Y.ZERO)>0)this.m.subTo($,$);return $}function b0(Q){var $=Z();return Q.copyTo($),this.reduce($),$}function x0(Q){while(Q.t<=this.mt2)Q[Q.t++]=0;for(var $=0;$<this.m.t;++$){var K=Q[$]&32767,W=K*this.mpl+((K*this.mph+(Q[$]>>15)*this.mpl&this.um)<<15)&Q.DM;K=$+this.m.t,Q[K]+=this.m.am(0,W,Q,$,0,this.m.t);while(Q[K]>=Q.DV)Q[K]-=Q.DV,Q[++K]++}if(Q.clamp(),Q.drShiftTo(this.m.t,Q),Q.compareTo(this.m)>=0)Q.subTo(this.m,Q)}function m0(Q,$){Q.squareTo($),this.reduce($)}function c0(Q,$,K){Q.multiplyTo($,K),this.reduce(K)}Yw.prototype.convert=k0,Yw.prototype.revert=b0,Yw.prototype.reduce=x0,Yw.prototype.mulTo=c0,Yw.prototype.sqrTo=m0;function _0(){return(this.t>0?this[0]&1:this.s)==0}function g0(Q,$){if(Q>4294967295||Q<1)return Y.ONE;var K=Z(),W=Z(),G=$.convert(this),F=Hw(Q)-1;G.copyTo(K);while(--F>=0)if($.sqrTo(K,W),(Q&1<<F)>0)$.mulTo(W,G,K);else{var N=K;K=W,W=N}return $.revert(K)}function u0(Q,$){var K;if(Q<256||$.isEven())K=new $w($);else K=new Yw($);return this.exp(Q,K)}Y.prototype.copyTo=zw,Y.prototype.fromInt=Nw,Y.prototype.fromString=e,Y.prototype.clamp=U0,Y.prototype.dlShiftTo=H0,Y.prototype.drShiftTo=P0,Y.prototype.lShiftTo=D0,Y.prototype.rShiftTo=M0,Y.prototype.subTo=T0,Y.prototype.multiplyTo=L0,Y.prototype.squareTo=A0,Y.prototype.divRemTo=C0,Y.prototype.invDigit=S0,Y.prototype.isEven=_0,Y.prototype.exp=g0,Y.prototype.toString=z0,Y.prototype.negate=N0,Y.prototype.abs=O0,Y.prototype.compareTo=V0,Y.prototype.bitLength=E0,Y.prototype.mod=R0,Y.prototype.modPowInt=u0,Y.ZERO=l(0),Y.ONE=l(1);function l0(){var Q=Z();return this.copyTo(Q),Q}function f0(){if(this.s<0){if(this.t==1)return this[0]-this.DV;else if(this.t==0)return-1}else if(this.t==1)return this[0];else if(this.t==0)return 0;return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function d0(){return this.t==0?this.s:this[0]<<24>>24}function i0(){return this.t==0?this.s:this[0]<<16>>16}function p0(Q){return Math.floor(Math.LN2*this.DB/Math.log(Q))}function n0(){if(this.s<0)return-1;else if(this.t<=0||this.t==1&&this[0]<=0)return 0;else return 1}function a0(Q){if(Q==null)Q=10;if(this.signum()==0||Q<2||Q>36)return"0";var $=this.chunkSize(Q),K=Math.pow(Q,$),W=l(K),G=Z(),F=Z(),N="";this.divRemTo(W,G,F);while(G.signum()>0)N=(K+F.intValue()).toString(Q).substr(1)+N,G.divRemTo(W,G,F);return F.intValue().toString(Q)+N}function o0(Q,$){if(this.fromInt(0),$==null)$=10;var K=this.chunkSize($),W=Math.pow($,K),G=!1,F=0,N=0;for(var O=0;O<Q.length;++O){var C=Qw(Q,O);if(C<0){if(Q.charAt(O)=="-"&&this.signum()==0)G=!0;continue}if(N=$*N+C,++F>=K)this.dMultiply(W),this.dAddOffset(N,0),F=0,N=0}if(F>0)this.dMultiply(Math.pow($,F)),this.dAddOffset(N,0);if(G)Y.ZERO.subTo(this,this)}function r0(Q,$,K){if(typeof $=="number")if(Q<2)this.fromInt(1);else{if(this.fromNumber(Q,K),!this.testBit(Q-1))this.bitwiseTo(Y.ONE.shiftLeft(Q-1),yw,this);if(this.isEven())this.dAddOffset(1,0);while(!this.isProbablePrime($))if(this.dAddOffset(2,0),this.bitLength()>Q)this.subTo(Y.ONE.shiftLeft(Q-1),this)}else{var W=new Array,G=Q&7;if(W.length=(Q>>3)+1,$.nextBytes(W),G>0)W[0]&=(1<<G)-1;else W[0]=0;this.fromString(W,256)}}function s0(){var Q=this.t,$=new Array;$[0]=this.s;var K=this.DB-Q*this.DB%8,W,G=0;if(Q-- >0){if(K<this.DB&&(W=this[Q]>>K)!=(this.s&this.DM)>>K)$[G++]=W|this.s<<this.DB-K;while(Q>=0){if(K<8)W=(this[Q]&(1<<K)-1)<<8-K,W|=this[--Q]>>(K+=this.DB-8);else if(W=this[Q]>>(K-=8)&255,K<=0)K+=this.DB,--Q;if((W&128)!=0)W|=-256;if(G==0&&(this.s&128)!=(W&128))++G;if(G>0||W!=this.s)$[G++]=W}}return $}function t0(Q){return this.compareTo(Q)==0}function e0(Q){return this.compareTo(Q)<0?this:Q}function w1(Q){return this.compareTo(Q)>0?this:Q}function J1(Q,$,K){var W,G,F=Math.min(Q.t,this.t);for(W=0;W<F;++W)K[W]=$(this[W],Q[W]);if(Q.t<this.t){G=Q.s&this.DM;for(W=F;W<this.t;++W)K[W]=$(this[W],G);K.t=this.t}else{G=this.s&this.DM;for(W=F;W<Q.t;++W)K[W]=$(G,Q[W]);K.t=Q.t}K.s=$(this.s,Q.s),K.clamp()}function Q1(Q,$){return Q&$}function $1(Q){var $=Z();return this.bitwiseTo(Q,Q1,$),$}function yw(Q,$){return Q|$}function Y1(Q){var $=Z();return this.bitwiseTo(Q,yw,$),$}function ew(Q,$){return Q^$}function X1(Q){var $=Z();return this.bitwiseTo(Q,ew,$),$}function w9(Q,$){return Q&~$}function K1(Q){var $=Z();return this.bitwiseTo(Q,w9,$),$}function Z1(){var Q=Z();for(var $=0;$<this.t;++$)Q[$]=this.DM&~this[$];return Q.t=this.t,Q.s=~this.s,Q}function W1(Q){var $=Z();if(Q<0)this.rShiftTo(-Q,$);else this.lShiftTo(Q,$);return $}function h1(Q){var $=Z();if(Q<0)this.lShiftTo(-Q,$);else this.rShiftTo(Q,$);return $}function G1(Q){if(Q==0)return-1;var $=0;if((Q&65535)==0)Q>>=16,$+=16;if((Q&255)==0)Q>>=8,$+=8;if((Q&15)==0)Q>>=4,$+=4;if((Q&3)==0)Q>>=2,$+=2;if((Q&1)==0)++$;return $}function q1(){for(var Q=0;Q<this.t;++Q)if(this[Q]!=0)return Q*this.DB+G1(this[Q]);if(this.s<0)return this.t*this.DB;return-1}function F1(Q){var $=0;while(Q!=0)Q&=Q-1,++$;return $}function U1(){var Q=0,$=this.s&this.DM;for(var K=0;K<this.t;++K)Q+=F1(this[K]^$);return Q}function z1(Q){var $=Math.floor(Q/this.DB);if($>=this.t)return this.s!=0;return(this[$]&1<<Q%this.DB)!=0}function N1(Q,$){var K=Y.ONE.shiftLeft(Q);return this.bitwiseTo(K,$,K),K}function O1(Q){return this.changeBit(Q,yw)}function V1(Q){return this.changeBit(Q,w9)}function E1(Q){return this.changeBit(Q,ew)}function H1(Q,$){var K=0,W=0,G=Math.min(Q.t,this.t);while(K<G)W+=this[K]+Q[K],$[K++]=W&this.DM,W>>=this.DB;if(Q.t<this.t){W+=Q.s;while(K<this.t)W+=this[K],$[K++]=W&this.DM,W>>=this.DB;W+=this.s}else{W+=this.s;while(K<Q.t)W+=Q[K],$[K++]=W&this.DM,W>>=this.DB;W+=Q.s}if($.s=W<0?-1:0,W>0)$[K++]=W;else if(W<-1)$[K++]=this.DV+W;$.t=K,$.clamp()}function P1(Q){var $=Z();return this.addTo(Q,$),$}function D1(Q){var $=Z();return this.subTo(Q,$),$}function M1(Q){var $=Z();return this.multiplyTo(Q,$),$}function T1(){var Q=Z();return this.squareTo(Q),Q}function L1(Q){var $=Z();return this.divRemTo(Q,$,null),$}function A1(Q){var $=Z();return this.divRemTo(Q,null,$),$}function C1(Q){var $=Z(),K=Z();return this.divRemTo(Q,$,K),new Array($,K)}function R1(Q){this[this.t]=this.am(0,Q-1,this,0,0,this.t),++this.t,this.clamp()}function j1(Q,$){if(Q==0)return;while(this.t<=$)this[this.t++]=0;this[$]+=Q;while(this[$]>=this.DV){if(this[$]-=this.DV,++$>=this.t)this[this.t++]=0;++this[$]}}function Ow(){}function J9(Q){return Q}function B1(Q,$,K){Q.multiplyTo($,K)}function I1(Q,$){Q.squareTo($)}Ow.prototype.convert=J9,Ow.prototype.revert=J9,Ow.prototype.mulTo=B1,Ow.prototype.sqrTo=I1;function y1(Q){return this.exp(Q,new Ow)}function v1(Q,$,K){var W=Math.min(this.t+Q.t,$);K.s=0,K.t=W;while(W>0)K[--W]=0;var G;for(G=K.t-this.t;W<G;++W)K[W+this.t]=this.am(0,Q[W],K,W,0,this.t);for(G=Math.min(Q.t,$);W<G;++W)this.am(0,Q[W],K,W,0,$-W);K.clamp()}function S1(Q,$,K){--$;var W=K.t=this.t+Q.t-$;K.s=0;while(--W>=0)K[W]=0;for(W=Math.max($-this.t,0);W<Q.t;++W)K[this.t+W-$]=this.am($-W,Q[W],K,0,0,this.t+W-$);K.clamp(),K.drShiftTo(1,K)}function Xw(Q){this.r2=Z(),this.q3=Z(),Y.ONE.dlShiftTo(2*Q.t,this.r2),this.mu=this.r2.divide(Q),this.m=Q}function k1(Q){if(Q.s<0||Q.t>2*this.m.t)return Q.mod(this.m);else if(Q.compareTo(this.m)<0)return Q;else{var $=Z();return Q.copyTo($),this.reduce($),$}}function b1(Q){return Q}function x1(Q){if(Q.drShiftTo(this.m.t-1,this.r2),Q.t>this.m.t+1)Q.t=this.m.t+1,Q.clamp();this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);while(Q.compareTo(this.r2)<0)Q.dAddOffset(1,this.m.t+1);Q.subTo(this.r2,Q);while(Q.compareTo(this.m)>=0)Q.subTo(this.m,Q)}function m1(Q,$){Q.squareTo($),this.reduce($)}function c1(Q,$,K){Q.multiplyTo($,K),this.reduce(K)}Xw.prototype.convert=k1,Xw.prototype.revert=b1,Xw.prototype.reduce=x1,Xw.prototype.mulTo=c1,Xw.prototype.sqrTo=m1;function _1(Q,$){var K=Q.bitLength(),W,G=l(1),F;if(K<=0)return G;else if(K<18)W=1;else if(K<48)W=3;else if(K<144)W=4;else if(K<768)W=5;else W=6;if(K<8)F=new $w($);else if($.isEven())F=new Xw($);else F=new Yw($);var N=new Array,O=3,C=W-1,B=(1<<W)-1;if(N[1]=F.convert(this),W>1){var f=Z();F.sqrTo(N[1],f);while(O<=B)N[O]=Z(),F.mulTo(f,N[O-2],N[O]),O+=2}var g=Q.t-1,s,Dw=!0,p=Z(),n;K=Hw(Q[g])-1;while(g>=0){if(K>=C)s=Q[g]>>K-C&B;else if(s=(Q[g]&(1<<K+1)-1)<<C-K,g>0)s|=Q[g-1]>>this.DB+K-C;O=W;while((s&1)==0)s>>=1,--O;if((K-=O)<0)K+=this.DB,--g;if(Dw)N[s].copyTo(G),Dw=!1;else{while(O>1)F.sqrTo(G,p),F.sqrTo(p,G),O-=2;if(O>0)F.sqrTo(G,p);else n=G,G=p,p=n;F.mulTo(p,N[s],G)}while(g>=0&&(Q[g]&1<<K)==0)if(F.sqrTo(G,p),n=G,G=p,p=n,--K<0)K=this.DB-1,--g}return F.revert(G)}function g1(Q){var $=this.s<0?this.negate():this.clone(),K=Q.s<0?Q.negate():Q.clone();if($.compareTo(K)<0){var W=$;$=K,K=W}var G=$.getLowestSetBit(),F=K.getLowestSetBit();if(F<0)return $;if(G<F)F=G;if(F>0)$.rShiftTo(F,$),K.rShiftTo(F,K);while($.signum()>0){if((G=$.getLowestSetBit())>0)$.rShiftTo(G,$);if((G=K.getLowestSetBit())>0)K.rShiftTo(G,K);if($.compareTo(K)>=0)$.subTo(K,$),$.rShiftTo(1,$);else K.subTo($,K),K.rShiftTo(1,K)}if(F>0)K.lShiftTo(F,K);return K}function u1(Q){if(Q<=0)return 0;var $=this.DV%Q,K=this.s<0?Q-1:0;if(this.t>0)if($==0)K=this[0]%Q;else for(var W=this.t-1;W>=0;--W)K=($*K+this[W])%Q;return K}function l1(Q){var $=Q.isEven();if(this.isEven()&&$||Q.signum()==0)return Y.ZERO;var K=Q.clone(),W=this.clone(),G=l(1),F=l(0),N=l(0),O=l(1);while(K.signum()!=0){while(K.isEven()){if(K.rShiftTo(1,K),$){if(!G.isEven()||!F.isEven())G.addTo(this,G),F.subTo(Q,F);G.rShiftTo(1,G)}else if(!F.isEven())F.subTo(Q,F);F.rShiftTo(1,F)}while(W.isEven()){if(W.rShiftTo(1,W),$){if(!N.isEven()||!O.isEven())N.addTo(this,N),O.subTo(Q,O);N.rShiftTo(1,N)}else if(!O.isEven())O.subTo(Q,O);O.rShiftTo(1,O)}if(K.compareTo(W)>=0){if(K.subTo(W,K),$)G.subTo(N,G);F.subTo(O,F)}else{if(W.subTo(K,W),$)N.subTo(G,N);O.subTo(F,O)}}if(W.compareTo(Y.ONE)!=0)return Y.ZERO;if(O.compareTo(Q)>=0)return O.subtract(Q);if(O.signum()<0)O.addTo(Q,O);else return O;if(O.signum()<0)return O.add(Q);else return O}var k=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],f1=67108864/k[k.length-1];function d1(Q){var $,K=this.abs();if(K.t==1&&K[0]<=k[k.length-1]){for($=0;$<k.length;++$)if(K[0]==k[$])return!0;return!1}if(K.isEven())return!1;$=1;while($<k.length){var W=k[$],G=$+1;while(G<k.length&&W<f1)W*=k[G++];W=K.modInt(W);while($<G)if(W%k[$++]==0)return!1}return K.millerRabin(Q)}function i1(Q){var $=this.subtract(Y.ONE),K=$.getLowestSetBit();if(K<=0)return!1;var W=$.shiftRight(K);if(Q=Q+1>>1,Q>k.length)Q=k.length;var G=Z();for(var F=0;F<Q;++F){G.fromInt(k[Math.floor(Math.random()*k.length)]);var N=G.modPow(W,this);if(N.compareTo(Y.ONE)!=0&&N.compareTo($)!=0){var O=1;while(O++<K&&N.compareTo($)!=0)if(N=N.modPowInt(2,this),N.compareTo(Y.ONE)==0)return!1;if(N.compareTo($)!=0)return!1}}return!0}Y.prototype.chunkSize=p0,Y.prototype.toRadix=a0,Y.prototype.fromRadix=o0,Y.prototype.fromNumber=r0,Y.prototype.bitwiseTo=J1,Y.prototype.changeBit=N1,Y.prototype.addTo=H1,Y.prototype.dMultiply=R1,Y.prototype.dAddOffset=j1,Y.prototype.multiplyLowerTo=v1,Y.prototype.multiplyUpperTo=S1,Y.prototype.modInt=u1,Y.prototype.millerRabin=i1,Y.prototype.clone=l0,Y.prototype.intValue=f0,Y.prototype.byteValue=d0,Y.prototype.shortValue=i0,Y.prototype.signum=n0,Y.prototype.toByteArray=s0,Y.prototype.equals=t0,Y.prototype.min=e0,Y.prototype.max=w1,Y.prototype.and=$1,Y.prototype.or=Y1,Y.prototype.xor=X1,Y.prototype.andNot=K1,Y.prototype.not=Z1,Y.prototype.shiftLeft=W1,Y.prototype.shiftRight=h1,Y.prototype.getLowestSetBit=q1,Y.prototype.bitCount=U1,Y.prototype.testBit=z1,Y.prototype.setBit=O1,Y.prototype.clearBit=V1,Y.prototype.flipBit=E1,Y.prototype.add=P1,Y.prototype.subtract=D1,Y.prototype.multiply=M1,Y.prototype.divide=L1,Y.prototype.remainder=A1,Y.prototype.divideAndRemainder=C1,Y.prototype.modPow=_1,Y.prototype.modInverse=l1,Y.prototype.pow=y1,Y.prototype.gcd=g1,Y.prototype.isProbablePrime=d1,Y.prototype.square=T1,Y.prototype.Barrett=Xw;var Pw,_,j;function p1(Q){if(_[j++]^=Q&255,_[j++]^=Q>>8&255,_[j++]^=Q>>16&255,_[j++]^=Q>>24&255,j>=kw)j-=kw}function Q9(){p1(new Date().getTime())}if(_==null){_=new Array,j=0;var i;if(typeof window!=="undefined"&&window.crypto){if(window.crypto.getRandomValues){var $9=new Uint8Array(32);window.crypto.getRandomValues($9);for(i=0;i<32;++i)_[j++]=$9[i]}else if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var Y9=window.crypto.random(32);for(i=0;i<Y9.length;++i)_[j++]=Y9.charCodeAt(i)&255}}while(j<kw)i=Math.floor(65536*Math.random()),_[j++]=i>>>8,_[j++]=i&255;j=0,Q9()}function n1(){if(Pw==null){Q9(),Pw=s1(),Pw.init(_);for(j=0;j<_.length;++j)_[j]=0;j=0}return Pw.next()}function a1(Q){var $;for($=0;$<Q.length;++$)Q[$]=n1()}function vw(){}vw.prototype.nextBytes=a1;function Sw(){this.i=0,this.j=0,this.S=new Array}function o1(Q){var $,K,W;for($=0;$<256;++$)this.S[$]=$;K=0;for($=0;$<256;++$)K=K+this.S[$]+Q[$%Q.length]&255,W=this.S[$],this.S[$]=this.S[K],this.S[K]=W;this.i=0,this.j=0}function r1(){var Q;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,Q=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=Q,this.S[Q+this.S[this.i]&255]}Sw.prototype.init=o1,Sw.prototype.next=r1;function s1(){return new Sw}var kw=256;if(typeof Lw!=="undefined")Lw=v9.exports={default:Y,BigInteger:Y,SecureRandom:vw};else this.jsbn={BigInteger:Y,SecureRandom:vw}}).call(Lw)});var Vw=R((S9)=>{(function(){var w={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function J(z){return Y(h(z),arguments)}function X(z,V){return J.apply(null,[z].concat(V||[]))}function Y(z,V){var E=1,L=z.length,q,T="",D,M,H,Qw,zw,Nw,l,e;for(D=0;D<L;D++)if(typeof z[D]==="string")T+=z[D];else if(typeof z[D]==="object"){if(H=z[D],H.keys){q=V[E];for(M=0;M<H.keys.length;M++){if(q==null)throw new Error(J('[sprintf] Cannot access property "%s" of undefined value "%s"',H.keys[M],H.keys[M-1]));q=q[H.keys[M]]}}else if(H.param_no)q=V[H.param_no];else q=V[E++];if(w.not_type.test(H.type)&&w.not_primitive.test(H.type)&&q instanceof Function)q=q();if(w.numeric_arg.test(H.type)&&(typeof q!=="number"&&isNaN(q)))throw new TypeError(J("[sprintf] expecting number but found %T",q));if(w.number.test(H.type))l=q>=0;switch(H.type){case"b":q=parseInt(q,10).toString(2);break;case"c":q=String.fromCharCode(parseInt(q,10));break;case"d":case"i":q=parseInt(q,10);break;case"j":q=JSON.stringify(q,null,H.width?parseInt(H.width):0);break;case"e":q=H.precision?parseFloat(q).toExponential(H.precision):parseFloat(q).toExponential();break;case"f":q=H.precision?parseFloat(q).toFixed(H.precision):parseFloat(q);break;case"g":q=H.precision?String(Number(q.toPrecision(H.precision))):parseFloat(q);break;case"o":q=(parseInt(q,10)>>>0).toString(8);break;case"s":q=String(q),q=H.precision?q.substring(0,H.precision):q;break;case"t":q=String(!!q),q=H.precision?q.substring(0,H.precision):q;break;case"T":q=Object.prototype.toString.call(q).slice(8,-1).toLowerCase(),q=H.precision?q.substring(0,H.precision):q;break;case"u":q=parseInt(q,10)>>>0;break;case"v":q=q.valueOf(),q=H.precision?q.substring(0,H.precision):q;break;case"x":q=(parseInt(q,10)>>>0).toString(16);break;case"X":q=(parseInt(q,10)>>>0).toString(16).toUpperCase();break}if(w.json.test(H.type))T+=q;else{if(w.number.test(H.type)&&(!l||H.sign))e=l?"+":"-",q=q.toString().replace(w.sign,"");else e="";zw=H.pad_char?H.pad_char==="0"?"0":H.pad_char.charAt(1):" ",Nw=H.width-(e+q).length,Qw=H.width?Nw>0?zw.repeat(Nw):"":"",T+=H.align?e+q+Qw:zw==="0"?e+Qw+q:Qw+e+q}}return T}var Z=Object.create(null);function h(z){if(Z[z])return Z[z];var V=z,E,L=[],q=0;while(V){if((E=w.text.exec(V))!==null)L.push(E[0]);else if((E=w.modulo.exec(V))!==null)L.push("%");else if((E=w.placeholder.exec(V))!==null){if(E[2]){q|=1;var T=[],D=E[2],M=[];if((M=w.key.exec(D))!==null){T.push(M[1]);while((D=D.substring(M[0].length))!=="")if((M=w.key_access.exec(D))!==null)T.push(M[1]);else if((M=w.index_access.exec(D))!==null)T.push(M[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key")}else throw new SyntaxError("[sprintf] failed to parse named argument key");E[2]=T}else q|=2;if(q===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");L.push({placeholder:E[0],param_no:E[1],keys:E[2],sign:E[3],pad_char:E[4],align:E[5],width:E[6],precision:E[7],type:E[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");V=V.substring(E[0].length)}return Z[z]=L}if(typeof S9!=="undefined")S9.sprintf=J,S9.vsprintf=X;if(typeof window!=="undefined"){if(window.sprintf=J,window.vsprintf=X,typeof define==="function"&&define.amd)define(function(){return{sprintf:J,vsprintf:X}})}})()});var lw=R((o)=>{var f8=o&&o.__createBinding||(Object.create?function(w,J,X,Y){if(Y===void 0)Y=X;var Z=Object.getOwnPropertyDescriptor(J,X);if(!Z||("get"in Z?!J.__esModule:Z.writable||Z.configurable))Z={enumerable:!0,get:function(){return J[X]}};Object.defineProperty(w,Y,Z)}:function(w,J,X,Y){if(Y===void 0)Y=X;w[Y]=J[X]}),d8=o&&o.__setModuleDefault||(Object.create?function(w,J){Object.defineProperty(w,"default",{enumerable:!0,value:J})}:function(w,J){w.default=J}),x9=o&&o.__importStar||function(w){if(w&&w.__esModule)return w;var J={};if(w!=null){for(var X in w)if(X!=="default"&&Object.prototype.hasOwnProperty.call(w,X))f8(J,w,X)}return d8(J,w),J};Object.defineProperty(o,"__esModule",{value:!0});o.Address4=void 0;var k9=x9(_w()),a=x9(gw()),b9=Tw(),Ew=uw(),Gw=Vw();class d{constructor(w){this.groups=a.GROUPS,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=k9.isCorrect(a.BITS),this.isInSubnet=k9.isInSubnet,this.address=w;const J=a.RE_SUBNET_STRING.exec(w);if(J){if(this.parsedSubnet=J[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,this.subnetMask<0||this.subnetMask>a.BITS)throw new b9.AddressError("Invalid subnet mask.");w=w.replace(a.RE_SUBNET_STRING,"")}this.addressMinusSuffix=w,this.parsedAddress=this.parse(w)}static isValid(w){try{return new d(w),!0}catch(J){return!1}}parse(w){const J=w.split(".");if(!w.match(a.RE_ADDRESS))throw new b9.AddressError("Invalid IPv4 address.");return J}correctForm(){return this.parsedAddress.map((w)=>parseInt(w,10)).join(".")}static fromHex(w){const J=w.replace(/:/g,"").padStart(8,"0"),X=[];let Y;for(Y=0;Y<8;Y+=2){const Z=J.slice(Y,Y+2);X.push(parseInt(Z,16))}return new d(X.join("."))}static fromInteger(w){return d.fromHex(w.toString(16))}static fromArpa(w){const X=w.replace(/(\.in-addr\.arpa)?\.$/,"").split(".").reverse().join(".");return new d(X)}toHex(){return this.parsedAddress.map((w)=>Gw.sprintf("%02x",parseInt(w,10))).join(":")}toArray(){return this.parsedAddress.map((w)=>parseInt(w,10))}toGroup6(){const w=[];let J;for(J=0;J<a.GROUPS;J+=2){const X=Gw.sprintf("%02x%02x",parseInt(this.parsedAddress[J],10),parseInt(this.parsedAddress[J+1],10));w.push(Gw.sprintf("%x",parseInt(X,16)))}return w.join(":")}bigInteger(){return new Ew.BigInteger(this.parsedAddress.map((w)=>Gw.sprintf("%02x",parseInt(w,10))).join(""),16)}_startAddress(){return new Ew.BigInteger(this.mask()+"0".repeat(a.BITS-this.subnetMask),2)}startAddress(){return d.fromBigInteger(this._startAddress())}startAddressExclusive(){const w=new Ew.BigInteger("1");return d.fromBigInteger(this._startAddress().add(w))}_endAddress(){return new Ew.BigInteger(this.mask()+"1".repeat(a.BITS-this.subnetMask),2)}endAddress(){return d.fromBigInteger(this._endAddress())}endAddressExclusive(){const w=new Ew.BigInteger("1");return d.fromBigInteger(this._endAddress().subtract(w))}static fromBigInteger(w){return d.fromInteger(parseInt(w.toString(),10))}mask(w){if(w===void 0)w=this.subnetMask;return this.getBitsBase2(0,w)}getBitsBase2(w,J){return this.binaryZeroPad().slice(w,J)}reverseForm(w){if(!w)w={};const J=this.correctForm().split(".").reverse().join(".");if(w.omitSuffix)return J;return Gw.sprintf("%s.in-addr.arpa.",J)}isMulticast(){return this.isInSubnet(new d("224.0.0.0/4"))}binaryZeroPad(){return this.bigInteger().toString(2).padStart(a.BITS,"0")}groupForV6(){const w=this.parsedAddress;return this.address.replace(a.RE_ADDRESS,Gw.sprintf('<span class="hover-group group-v4 group-6">%s</span>.<span class="hover-group group-v4 group-7">%s</span>',w.slice(0,2).join("."),w.slice(2,4).join(".")))}}o.Address4=d});var fw=R((m9)=>{Object.defineProperty(m9,"__esModule",{value:!0});m9.RE_URL_WITH_PORT=m9.RE_URL=m9.RE_ZONE_STRING=m9.RE_SUBNET_STRING=m9.RE_BAD_ADDRESS=m9.RE_BAD_CHARACTERS=m9.TYPES=m9.SCOPES=m9.GROUPS=m9.BITS=void 0;m9.BITS=128;m9.GROUPS=8;m9.SCOPES={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"};m9.TYPES={"ff01::1/128":"Multicast (All nodes on this interface)","ff01::2/128":"Multicast (All routers on this interface)","ff02::1/128":"Multicast (All nodes on this link)","ff02::2/128":"Multicast (All routers on this link)","ff05::2/128":"Multicast (All routers in this site)","ff02::5/128":"Multicast (OSPFv3 AllSPF routers)","ff02::6/128":"Multicast (OSPFv3 AllDR routers)","ff02::9/128":"Multicast (RIP routers)","ff02::a/128":"Multicast (EIGRP routers)","ff02::d/128":"Multicast (PIM routers)","ff02::16/128":"Multicast (MLDv2 reports)","ff01::fb/128":"Multicast (mDNSv6)","ff02::fb/128":"Multicast (mDNSv6)","ff05::fb/128":"Multicast (mDNSv6)","ff02::1:2/128":"Multicast (All DHCP servers and relay agents on this link)","ff05::1:2/128":"Multicast (All DHCP servers and relay agents in this site)","ff02::1:3/128":"Multicast (All DHCP servers on this link)","ff05::1:3/128":"Multicast (All DHCP servers in this site)","::/128":"Unspecified","::1/128":"Loopback","ff00::/8":"Multicast","fe80::/10":"Link-local unicast"};m9.RE_BAD_CHARACTERS=/([^0-9a-f:/%])/gi;m9.RE_BAD_ADDRESS=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi;m9.RE_SUBNET_STRING=/\/\d{1,3}(?=%|$)/;m9.RE_ZONE_STRING=/%.*$/;m9.RE_URL=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/);m9.RE_URL_WITH_PORT=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/)});var dw=R((l9)=>{function g9(w){return w.replace(/(0+)/g,'<span class="zero">$1</span>')}function wJ(w,J=0){return w.split("").map((Y,Z)=>_9.sprintf('<span class="digit value-%s position-%d">%s</span>',Y,Z+J,g9(Y))).join("")}function u9(w){return w.replace(/^(0+)/,'<span class="zero">$1</span>')}function JJ(w){return w.split(":").map((X)=>u9(X)).join(":")}function QJ(w,J=0){return w.split(":").map((Y,Z)=>{if(/group-v4/.test(Y))return Y;return _9.sprintf('<span class="hover-group group-%d">%s</span>',Z+J,u9(Y))})}Object.defineProperty(l9,"__esModule",{value:!0});l9.simpleGroup=l9.spanLeadingZeroes=l9.spanAll=l9.spanAllZeroes=void 0;var _9=Vw();l9.spanAllZeroes=g9;l9.spanAll=wJ;l9.spanLeadingZeroes=JJ;l9.simpleGroup=QJ});var d9=R((I)=>{function Cw(w){return qw.sprintf("(%s)",w.join("|"))}function Aw(w){if(w.length<4)return qw.sprintf("0{0,%d}%s",4-w.length,w);return w}function GJ(w){const J=[];w.forEach((Y,Z)=>{if(parseInt(Y,16)===0)J.push(Z)});const X=J.map((Y)=>w.map((Z,h)=>{if(h===Y){const z=h===0||h===hJ.GROUPS-1?":":"";return Cw([Aw(Z),z])}return Aw(Z)}).join(":"));return X.push(w.map(Aw).join(":")),Cw(X)}function qJ(w,J,X){const Y=J?"":":",Z=X?"":":",h=[];if(!J&&!X)h.push("::");if(J&&X)h.push("");if(X&&!J||!X&&J)h.push(":");h.push(qw.sprintf("%s(:0{1,4}){1,%d}",Y,w-1)),h.push(qw.sprintf("(0{1,4}:){1,%d}%s",w-1,Z)),h.push(qw.sprintf("(0{1,4}:){%d}0{1,4}",w-1));for(let z=1;z<w-1;z++)for(let V=1;V<w-z;V++)h.push(qw.sprintf("(0{1,4}:){%d}:(0{1,4}:){%d}0{1,4}",V,w-V-z-1));return Cw(h)}var KJ=I&&I.__createBinding||(Object.create?function(w,J,X,Y){if(Y===void 0)Y=X;var Z=Object.getOwnPropertyDescriptor(J,X);if(!Z||("get"in Z?!J.__esModule:Z.writable||Z.configurable))Z={enumerable:!0,get:function(){return J[X]}};Object.defineProperty(w,Y,Z)}:function(w,J,X,Y){if(Y===void 0)Y=X;w[Y]=J[X]}),ZJ=I&&I.__setModuleDefault||(Object.create?function(w,J){Object.defineProperty(w,"default",{enumerable:!0,value:J})}:function(w,J){w.default=J}),WJ=I&&I.__importStar||function(w){if(w&&w.__esModule)return w;var J={};if(w!=null){for(var X in w)if(X!=="default"&&Object.prototype.hasOwnProperty.call(w,X))KJ(J,w,X)}return ZJ(J,w),J};Object.defineProperty(I,"__esModule",{value:!0});I.possibleElisions=I.simpleRegularExpression=I.ADDRESS_BOUNDARY=I.padGroup=I.groupPossibilities=void 0;var hJ=WJ(fw()),qw=Vw();I.groupPossibilities=Cw;I.padGroup=Aw;I.ADDRESS_BOUNDARY="[^A-Fa-f0-9:]";I.simpleRegularExpression=GJ;I.possibleElisions=qJ});var a9=R((r)=>{function Rw(w){if(!w)throw new Error("Assertion failed.")}function zJ(w){const J=/(\d+)(\d{3})/;while(J.test(w))w=w.replace(J,"$1,$2");return w}function NJ(w){return w=w.replace(/^(0{1,})([1-9]+)$/,'<span class="parse-error">$1</span>$2'),w=w.replace(/^(0{1,})(0)$/,'<span class="parse-error">$1</span>$2'),w}function OJ(w,J){const X=[],Y=[];let Z;for(Z=0;Z<w.length;Z++)if(Z<J[0])X.push(w[Z]);else if(Z>J[1])Y.push(w[Z]);return X.concat(["compact"]).concat(Y)}function p9(w){return x.sprintf("%04x",parseInt(w,16))}function n9(w){return w&255}var FJ=r&&r.__createBinding||(Object.create?function(w,J,X,Y){if(Y===void 0)Y=X;var Z=Object.getOwnPropertyDescriptor(J,X);if(!Z||("get"in Z?!J.__esModule:Z.writable||Z.configurable))Z={enumerable:!0,get:function(){return J[X]}};Object.defineProperty(w,Y,Z)}:function(w,J,X,Y){if(Y===void 0)Y=X;w[Y]=J[X]}),UJ=r&&r.__setModuleDefault||(Object.create?function(w,J){Object.defineProperty(w,"default",{enumerable:!0,value:J})}:function(w,J){w.default=J}),jw=r&&r.__importStar||function(w){if(w&&w.__esModule)return w;var J={};if(w!=null){for(var X in w)if(X!=="default"&&Object.prototype.hasOwnProperty.call(w,X))FJ(J,w,X)}return UJ(J,w),J};Object.defineProperty(r,"__esModule",{value:!0});r.Address6=void 0;var i9=jw(_w()),iw=jw(gw()),A=jw(fw()),pw=jw(dw()),Zw=lw(),Ww=d9(),t=Tw(),b=uw(),x=Vw();class y{constructor(w,J){if(this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=i9.isInSubnet,this.isCorrect=i9.isCorrect(A.BITS),J===void 0)this.groups=A.GROUPS;else this.groups=J;this.address=w;const X=A.RE_SUBNET_STRING.exec(w);if(X){if(this.parsedSubnet=X[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,Number.isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>A.BITS)throw new t.AddressError("Invalid subnet mask.");w=w.replace(A.RE_SUBNET_STRING,"")}else if(/\//.test(w))throw new t.AddressError("Invalid subnet mask.");const Y=A.RE_ZONE_STRING.exec(w);if(Y)this.zone=Y[0],w=w.replace(A.RE_ZONE_STRING,"");this.addressMinusSuffix=w,this.parsedAddress=this.parse(this.addressMinusSuffix)}static isValid(w){try{return new y(w),!0}catch(J){return!1}}static fromBigInteger(w){const J=w.toString(16).padStart(32,"0"),X=[];let Y;for(Y=0;Y<A.GROUPS;Y++)X.push(J.slice(Y*4,(Y+1)*4));return new y(X.join(":"))}static fromURL(w){let J,X=null,Y;if(w.indexOf("[")!==-1&&w.indexOf("]:")!==-1){if(Y=A.RE_URL_WITH_PORT.exec(w),Y===null)return{error:"failed to parse address with port",address:null,port:null};J=Y[1],X=Y[2]}else if(w.indexOf("/")!==-1){if(w=w.replace(/^[a-z0-9]+:\/\//,""),Y=A.RE_URL.exec(w),Y===null)return{error:"failed to parse address from URL",address:null,port:null};J=Y[1]}else J=w;if(X){if(X=parseInt(X,10),X<0||X>65536)X=null}else X=null;return{address:new y(J),port:X}}static fromAddress4(w){const J=new Zw.Address4(w),X=A.BITS-(iw.BITS-J.subnetMask);return new y(`::ffff:${J.correctForm()}/${X}`)}static fromArpa(w){let J=w.replace(/(\.ip6\.arpa)?\.$/,"");const X=7;if(J.length!==63)throw new t.AddressError("Invalid 'ip6.arpa' form.");const Y=J.split(".").reverse();for(let Z=X;Z>0;Z--){const h=Z*4;Y.splice(h,0,":")}return J=Y.join(""),new y(J)}microsoftTranscription(){return x.sprintf("%s.ipv6-literal.net",this.correctForm().replace(/:/g,"-"))}mask(w=this.subnetMask){return this.getBitsBase2(0,w)}possibleSubnets(w=128){const J=A.BITS-this.subnetMask,X=Math.abs(w-A.BITS),Y=J-X;if(Y<0)return"0";return zJ(new b.BigInteger("2",10).pow(Y).toString(10))}_startAddress(){return new b.BigInteger(this.mask()+"0".repeat(A.BITS-this.subnetMask),2)}startAddress(){return y.fromBigInteger(this._startAddress())}startAddressExclusive(){const w=new b.BigInteger("1");return y.fromBigInteger(this._startAddress().add(w))}_endAddress(){return new b.BigInteger(this.mask()+"1".repeat(A.BITS-this.subnetMask),2)}endAddress(){return y.fromBigInteger(this._endAddress())}endAddressExclusive(){const w=new b.BigInteger("1");return y.fromBigInteger(this._endAddress().subtract(w))}getScope(){let w=A.SCOPES[this.getBits(12,16).intValue()];if(this.getType()==="Global unicast"&&w!=="Link local")w="Global";return w||"Unknown"}getType(){for(let w of Object.keys(A.TYPES))if(this.isInSubnet(new y(w)))return A.TYPES[w];return"Global unicast"}getBits(w,J){return new b.BigInteger(this.getBitsBase2(w,J),2)}getBitsBase2(w,J){return this.binaryZeroPad().slice(w,J)}getBitsBase16(w,J){const X=J-w;if(X%4!==0)throw new Error("Length of bits to retrieve must be divisible by four");return this.getBits(w,J).toString(16).padStart(X/4,"0")}getBitsPastSubnet(){return this.getBitsBase2(this.subnetMask,A.BITS)}reverseForm(w){if(!w)w={};const J=Math.floor(this.subnetMask/4),X=this.canonicalForm().replace(/:/g,"").split("").slice(0,J).reverse().join(".");if(J>0){if(w.omitSuffix)return X;return x.sprintf("%s.ip6.arpa.",X)}if(w.omitSuffix)return"";return"ip6.arpa."}correctForm(){let w,J=[],X=0;const Y=[];for(w=0;w<this.parsedAddress.length;w++){const z=parseInt(this.parsedAddress[w],16);if(z===0)X++;if(z!==0&&X>0){if(X>1)Y.push([w-X,w-1]);X=0}}if(X>1)Y.push([this.parsedAddress.length-X,this.parsedAddress.length-1]);const Z=Y.map((z)=>z[1]-z[0]+1);if(Y.length>0){const z=Z.indexOf(Math.max(...Z));J=OJ(this.parsedAddress,Y[z])}else J=this.parsedAddress;for(w=0;w<J.length;w++)if(J[w]!=="compact")J[w]=parseInt(J[w],16).toString(16);let h=J.join(":");return h=h.replace(/^compact$/,"::"),h=h.replace(/^compact|compact$/,":"),h=h.replace(/compact/,""),h}binaryZeroPad(){return this.bigInteger().toString(2).padStart(A.BITS,"0")}parse4in6(w){const J=w.split(":"),Y=J.slice(-1)[0].match(iw.RE_ADDRESS);if(Y){this.parsedAddress4=Y[0],this.address4=new Zw.Address4(this.parsedAddress4);for(let Z=0;Z<this.address4.groups;Z++)if(/^0[0-9]+/.test(this.address4.parsedAddress[Z]))throw new t.AddressError("IPv4 addresses can't have leading zeroes.",w.replace(iw.RE_ADDRESS,this.address4.parsedAddress.map(NJ).join(".")));this.v4=!0,J[J.length-1]=this.address4.toGroup6(),w=J.join(":")}return w}parse(w){w=this.parse4in6(w);const J=w.match(A.RE_BAD_CHARACTERS);if(J)throw new t.AddressError(x.sprintf("Bad character%s detected in address: %s",J.length>1?"s":"",J.join("")),w.replace(A.RE_BAD_CHARACTERS,'<span class="parse-error">$1</span>'));const X=w.match(A.RE_BAD_ADDRESS);if(X)throw new t.AddressError(x.sprintf("Address failed regex: %s",X.join("")),w.replace(A.RE_BAD_ADDRESS,'<span class="parse-error">$1</span>'));let Y=[];const Z=w.split("::");if(Z.length===2){let h=Z[0].split(":"),z=Z[1].split(":");if(h.length===1&&h[0]==="")h=[];if(z.length===1&&z[0]==="")z=[];const V=this.groups-(h.length+z.length);if(!V)throw new t.AddressError("Error parsing groups");this.elidedGroups=V,this.elisionBegin=h.length,this.elisionEnd=h.length+this.elidedGroups,Y=Y.concat(h);for(let E=0;E<V;E++)Y.push("0");Y=Y.concat(z)}else if(Z.length===1)Y=w.split(":"),this.elidedGroups=0;else throw new t.AddressError("Too many :: groups found");if(Y=Y.map((h)=>x.sprintf("%x",parseInt(h,16))),Y.length!==this.groups)throw new t.AddressError("Incorrect number of groups found");return Y}canonicalForm(){return this.parsedAddress.map(p9).join(":")}decimal(){return this.parsedAddress.map((w)=>x.sprintf("%05d",parseInt(w,16))).join(":")}bigInteger(){return new b.BigInteger(this.parsedAddress.map(p9).join(""),16)}to4(){const w=this.binaryZeroPad().split("");return Zw.Address4.fromHex(new b.BigInteger(w.slice(96,128).join(""),2).toString(16))}to4in6(){const w=this.to4(),X=new y(this.parsedAddress.slice(0,6).join(":"),6).correctForm();let Y="";if(!/:$/.test(X))Y=":";return X+Y+w.address}inspectTeredo(){const w=this.getBitsBase16(0,32),J=this.getBits(80,96).xor(new b.BigInteger("ffff",16)).toString(),X=Zw.Address4.fromHex(this.getBitsBase16(32,64)),Y=Zw.Address4.fromHex(this.getBits(96,128).xor(new b.BigInteger("ffffffff",16)).toString(16)),Z=this.getBits(64,80),h=this.getBitsBase2(64,80),z=Z.testBit(15),V=Z.testBit(14),E=Z.testBit(8),L=Z.testBit(9),q=new b.BigInteger(h.slice(2,6)+h.slice(8,16),2).toString(10);return{prefix:x.sprintf("%s:%s",w.slice(0,4),w.slice(4,8)),server4:X.address,client4:Y.address,flags:h,coneNat:z,microsoft:{reserved:V,universalLocal:L,groupIndividual:E,nonce:q},udpPort:J}}inspect6to4(){const w=this.getBitsBase16(0,16),J=Zw.Address4.fromHex(this.getBitsBase16(16,48));return{prefix:x.sprintf("%s",w.slice(0,4)),gateway:J.address}}to6to4(){if(!this.is4())return null;const w=["2002",this.getBitsBase16(96,112),this.getBitsBase16(112,128),"","/16"].join(":");return new y(w)}toByteArray(){const w=this.bigInteger().toByteArray();if(w.length===17&&w[0]===0)return w.slice(1);return w}toUnsignedByteArray(){return this.toByteArray().map(n9)}static fromByteArray(w){return this.fromUnsignedByteArray(w.map(n9))}static fromUnsignedByteArray(w){const J=new b.BigInteger("256",10);let X=new b.BigInteger("0",10),Y=new b.BigInteger("1",10);for(let Z=w.length-1;Z>=0;Z--)X=X.add(Y.multiply(new b.BigInteger(w[Z].toString(10),10))),Y=Y.multiply(J);return y.fromBigInteger(X)}isCanonical(){return this.addressMinusSuffix===this.canonicalForm()}isLinkLocal(){if(this.getBitsBase2(0,64)==="1111111010000000000000000000000000000000000000000000000000000000")return!0;return!1}isMulticast(){return this.getType()==="Multicast"}is4(){return this.v4}isTeredo(){return this.isInSubnet(new y("2001::/32"))}is6to4(){return this.isInSubnet(new y("2002::/16"))}isLoopback(){return this.getType()==="Loopback"}href(w){if(w===void 0)w="";else w=x.sprintf(":%s",w);return x.sprintf("http://[%s]%s/",this.correctForm(),w)}link(w){if(!w)w={};if(w.className===void 0)w.className="";if(w.prefix===void 0)w.prefix="/#address=";if(w.v4===void 0)w.v4=!1;let J=this.correctForm;if(w.v4)J=this.to4in6;if(w.className)return x.sprintf('<a href="%1$s%2$s" class="%3$s">%2$s</a>',w.prefix,J.call(this),w.className);return x.sprintf('<a href="%1$s%2$s">%2$s</a>',w.prefix,J.call(this))}group(){if(this.elidedGroups===0)return pw.simpleGroup(this.address).join(":");Rw(typeof this.elidedGroups==="number"),Rw(typeof this.elisionBegin==="number");const w=[],[J,X]=this.address.split("::");if(J.length)w.push(...pw.simpleGroup(J));else w.push("");const Y=["hover-group"];for(let Z=this.elisionBegin;Z<this.elisionBegin+this.elidedGroups;Z++)Y.push(x.sprintf("group-%d",Z));if(w.push(x.sprintf('<span class="%s"></span>',Y.join(" "))),X.length)w.push(...pw.simpleGroup(X,this.elisionEnd));else w.push("");if(this.is4())Rw(this.address4 instanceof Zw.Address4),w.pop(),w.push(this.address4.groupForV6());return w.join(":")}regularExpressionString(w=!1){let J=[];const X=new y(this.correctForm());if(X.elidedGroups===0)J.push(Ww.simpleRegularExpression(X.parsedAddress));else if(X.elidedGroups===A.GROUPS)J.push(Ww.possibleElisions(A.GROUPS));else{const Y=X.address.split("::");if(Y[0].length)J.push(Ww.simpleRegularExpression(Y[0].split(":")));if(Rw(typeof X.elidedGroups==="number"),J.push(Ww.possibleElisions(X.elidedGroups,Y[0].length!==0,Y[1].length!==0)),Y[1].length)J.push(Ww.simpleRegularExpression(Y[1].split(":")));J=[J.join(":")]}if(!w)J=["(?=^|",Ww.ADDRESS_BOUNDARY,"|[^\\w\\:])(",...J,")(?=[^\\w\\:]|",Ww.ADDRESS_BOUNDARY,"|$)"];return J.join("")}regularExpression(w=!1){return new RegExp(this.regularExpressionString(w),"i")}}r.Address6=y});var nw=R((S)=>{var VJ=S&&S.__createBinding||(Object.create?function(w,J,X,Y){if(Y===void 0)Y=X;var Z=Object.getOwnPropertyDescriptor(J,X);if(!Z||("get"in Z?!J.__esModule:Z.writable||Z.configurable))Z={enumerable:!0,get:function(){return J[X]}};Object.defineProperty(w,Y,Z)}:function(w,J,X,Y){if(Y===void 0)Y=X;w[Y]=J[X]}),EJ=S&&S.__setModuleDefault||(Object.create?function(w,J){Object.defineProperty(w,"default",{enumerable:!0,value:J})}:function(w,J){w.default=J}),HJ=S&&S.__importStar||function(w){if(w&&w.__esModule)return w;var J={};if(w!=null){for(var X in w)if(X!=="default"&&Object.prototype.hasOwnProperty.call(w,X))VJ(J,w,X)}return EJ(J,w),J};Object.defineProperty(S,"__esModule",{value:!0});S.v6=S.AddressError=S.Address6=S.Address4=void 0;var PJ=lw();Object.defineProperty(S,"Address4",{enumerable:!0,get:function(){return PJ.Address4}});var DJ=a9();Object.defineProperty(S,"Address6",{enumerable:!0,get:function(){return DJ.Address6}});var MJ=Tw();Object.defineProperty(S,"AddressError",{enumerable:!0,get:function(){return MJ.AddressError}});var TJ=HJ(dw());S.v6={helpers:TJ}});var Q0=R((w0)=>{function AJ(w,J=["connect","bind","associate"]){if(!v.SocksCommand[w.command])throw new m.SocksClientError(v.ERRORS.InvalidSocksCommand,w);if(J.indexOf(w.command)===-1)throw new m.SocksClientError(v.ERRORS.InvalidSocksCommandForOperation,w);if(!s9(w.destination))throw new m.SocksClientError(v.ERRORS.InvalidSocksClientOptionsDestination,w);if(!t9(w.proxy))throw new m.SocksClientError(v.ERRORS.InvalidSocksClientOptionsProxy,w);if(r9(w.proxy,w),w.timeout&&!e9(w.timeout))throw new m.SocksClientError(v.ERRORS.InvalidSocksClientOptionsTimeout,w);if(w.existing_socket&&!(w.existing_socket instanceof LJ.Duplex))throw new m.SocksClientError(v.ERRORS.InvalidSocksClientOptionsExistingSocket,w)}function CJ(w){if(w.command!=="connect")throw new m.SocksClientError(v.ERRORS.InvalidSocksCommandChain,w);if(!s9(w.destination))throw new m.SocksClientError(v.ERRORS.InvalidSocksClientOptionsDestination,w);if(!(w.proxies&&Array.isArray(w.proxies)&&w.proxies.length>=2))throw new m.SocksClientError(v.ERRORS.InvalidSocksClientOptionsProxiesLength,w);if(w.proxies.forEach((J)=>{if(!t9(J))throw new m.SocksClientError(v.ERRORS.InvalidSocksClientOptionsProxy,w);r9(J,w)}),w.timeout&&!e9(w.timeout))throw new m.SocksClientError(v.ERRORS.InvalidSocksClientOptionsTimeout,w)}function r9(w,J){if(w.custom_auth_method!==void 0){if(w.custom_auth_method<v.SOCKS5_CUSTOM_AUTH_START||w.custom_auth_method>v.SOCKS5_CUSTOM_AUTH_END)throw new m.SocksClientError(v.ERRORS.InvalidSocksClientOptionsCustomAuthRange,J);if(w.custom_auth_request_handler===void 0||typeof w.custom_auth_request_handler!=="function")throw new m.SocksClientError(v.ERRORS.InvalidSocksClientOptionsCustomAuthOptions,J);if(w.custom_auth_response_size===void 0)throw new m.SocksClientError(v.ERRORS.InvalidSocksClientOptionsCustomAuthOptions,J);if(w.custom_auth_response_handler===void 0||typeof w.custom_auth_response_handler!=="function")throw new m.SocksClientError(v.ERRORS.InvalidSocksClientOptionsCustomAuthOptions,J)}}function s9(w){return w&&typeof w.host==="string"&&typeof w.port==="number"&&w.port>=0&&w.port<=65535}function t9(w){return w&&(typeof w.host==="string"||typeof w.ipaddress==="string")&&typeof w.port==="number"&&w.port>=0&&w.port<=65535&&(w.type===4||w.type===5)}function e9(w){return typeof w==="number"&&w>0}function RJ(w){return new aw.Address4(w).toArray().reduce((X,Y)=>(X<<8)+Y,0)}function jJ(w){const J=w>>>24&255,X=w>>>16&255,Y=w>>>8&255,Z=w&255;return[J,X,Y,Z].join(".")}function BJ(w){if(o9.isIPv4(w)){const J=new aw.Address4(w);return Buffer.from(J.toArray())}else if(o9.isIPv6(w)){const J=new aw.Address6(w);return Buffer.from(J.canonicalForm().split(":").map((X)=>X.padStart(4,"0")).join(""),"hex")}else throw new Error("Invalid IP address format")}Object.defineProperty(w0,"__esModule",{value:!0});w0.ipToBuffer=w0.int32ToIpv4=w0.ipv4ToInt32=w0.validateSocksClientChainOptions=w0.validateSocksClientOptions=void 0;var m=cw(),v=mw(),LJ=import.meta.require("stream"),aw=nw(),o9=import.meta.require("net");w0.validateSocksClientOptions=AJ;w0.validateSocksClientChainOptions=CJ;w0.ipv4ToInt32=RJ;w0.int32ToIpv4=jJ;w0.ipToBuffer=BJ});var K0=R((Y0)=>{Object.defineProperty(Y0,"__esModule",{value:!0});Y0.ReceiveBuffer=void 0;class $0{constructor(w=4096){this.buffer=Buffer.allocUnsafe(w),this.offset=0,this.originalSize=w}get length(){return this.offset}append(w){if(!Buffer.isBuffer(w))throw new Error("Attempted to append a non-buffer instance to ReceiveBuffer.");if(this.offset+w.length>=this.buffer.length){const J=this.buffer;this.buffer=Buffer.allocUnsafe(Math.max(this.buffer.length+this.originalSize,this.buffer.length+w.length)),J.copy(this.buffer)}return w.copy(this.buffer,this.offset),this.offset+=w.length}peek(w){if(w>this.offset)throw new Error("Attempted to read beyond the bounds of the managed internal data.");return this.buffer.slice(0,w)}get(w){if(w>this.offset)throw new Error("Attempted to read beyond the bounds of the managed internal data.");const J=Buffer.allocUnsafe(w);return this.buffer.slice(0,w).copy(J),this.buffer.copyWithin(0,w,w+this.offset-w),this.offset-=w,J}}Y0.ReceiveBuffer=$0});var Z0=R((Jw)=>{var Fw=Jw&&Jw.__awaiter||function(w,J,X,Y){function Z(h){return h instanceof X?h:new X(function(z){z(h)})}return new(X||(X=Promise))(function(h,z){function V(q){try{L(Y.next(q))}catch(T){z(T)}}function E(q){try{L(Y.throw(q))}catch(T){z(T)}}function L(q){q.done?h(q.value):Z(q.value).then(V,E)}L((Y=Y.apply(w,J||[])).next())})};Object.defineProperty(Jw,"__esModule",{value:!0});Jw.SocksClientError=Jw.SocksClient=void 0;var kJ=import.meta.require("events"),Uw=import.meta.require("net"),c=U9(),U=mw(),u=Q0(),bJ=K0(),rw=cw();Object.defineProperty(Jw,"SocksClientError",{enumerable:!0,get:function(){return rw.SocksClientError}});var ow=nw();class Bw extends kJ.EventEmitter{constructor(w){super();this.options=Object.assign({},w),u.validateSocksClientOptions(w),this.setState(U.SocksClientState.Created)}static createConnection(w,J){return new Promise((X,Y)=>{try{u.validateSocksClientOptions(w,["connect"])}catch(h){if(typeof J==="function")return J(h),X(h);else return Y(h)}const Z=new Bw(w);Z.connect(w.existing_socket),Z.once("established",(h)=>{if(Z.removeAllListeners(),typeof J==="function")J(null,h),X(h);else X(h)}),Z.once("error",(h)=>{if(Z.removeAllListeners(),typeof J==="function")J(h),X(h);else Y(h)})})}static createConnectionChain(w,J){return new Promise((X,Y)=>Fw(this,void 0,void 0,function*(){try{u.validateSocksClientChainOptions(w)}catch(Z){if(typeof J==="function")return J(Z),X(Z);else return Y(Z)}if(w.randomizeChain)rw.shuffleArray(w.proxies);try{let Z;for(let h=0;h<w.proxies.length;h++){const z=w.proxies[h],V=h===w.proxies.length-1?w.destination:{host:w.proxies[h+1].host||w.proxies[h+1].ipaddress,port:w.proxies[h+1].port},E=yield Bw.createConnection({command:"connect",proxy:z,destination:V,existing_socket:Z});Z=Z||E.socket}if(typeof J==="function")J(null,{socket:Z}),X({socket:Z});else X({socket:Z})}catch(Z){if(typeof J==="function")J(Z),X(Z);else Y(Z)}}))}static createUDPFrame(w){const J=new c.SmartBuffer;if(J.writeUInt16BE(0),J.writeUInt8(w.frameNumber||0),Uw.isIPv4(w.remoteHost.host))J.writeUInt8(U.Socks5HostType.IPv4),J.writeUInt32BE(u.ipv4ToInt32(w.remoteHost.host));else if(Uw.isIPv6(w.remoteHost.host))J.writeUInt8(U.Socks5HostType.IPv6),J.writeBuffer(u.ipToBuffer(w.remoteHost.host));else J.writeUInt8(U.Socks5HostType.Hostname),J.writeUInt8(Buffer.byteLength(w.remoteHost.host)),J.writeString(w.remoteHost.host);return J.writeUInt16BE(w.remoteHost.port),J.writeBuffer(w.data),J.toBuffer()}static parseUDPFrame(w){const J=c.SmartBuffer.fromBuffer(w);J.readOffset=2;const X=J.readUInt8(),Y=J.readUInt8();let Z;if(Y===U.Socks5HostType.IPv4)Z=u.int32ToIpv4(J.readUInt32BE());else if(Y===U.Socks5HostType.IPv6)Z=ow.Address6.fromByteArray(Array.from(J.readBuffer(16))).canonicalForm();else Z=J.readString(J.readUInt8());const h=J.readUInt16BE();return{frameNumber:X,remoteHost:{host:Z,port:h},data:J.readBuffer()}}setState(w){if(this.state!==U.SocksClientState.Error)this.state=w}connect(w){this.onDataReceived=(X)=>this.onDataReceivedHandler(X),this.onClose=()=>this.onCloseHandler(),this.onError=(X)=>this.onErrorHandler(X),this.onConnect=()=>this.onConnectHandler();const J=setTimeout(()=>this.onEstablishedTimeout(),this.options.timeout||U.DEFAULT_TIMEOUT);if(J.unref&&typeof J.unref==="function")J.unref();if(w)this.socket=w;else this.socket=new Uw.Socket;if(this.socket.once("close",this.onClose),this.socket.once("error",this.onError),this.socket.once("connect",this.onConnect),this.socket.on("data",this.onDataReceived),this.setState(U.SocksClientState.Connecting),this.receiveBuffer=new bJ.ReceiveBuffer,w)this.socket.emit("connect");else if(this.socket.connect(this.getSocketOptions()),this.options.set_tcp_nodelay!==void 0&&this.options.set_tcp_nodelay!==null)this.socket.setNoDelay(!!this.options.set_tcp_nodelay);this.prependOnceListener("established",(X)=>{setImmediate(()=>{if(this.receiveBuffer.length>0){const Y=this.receiveBuffer.get(this.receiveBuffer.length);X.socket.emit("data",Y)}X.socket.resume()})})}getSocketOptions(){return Object.assign(Object.assign({},this.options.socket_options),{host:this.options.proxy.host||this.options.proxy.ipaddress,port:this.options.proxy.port})}onEstablishedTimeout(){if(this.state!==U.SocksClientState.Established&&this.state!==U.SocksClientState.BoundWaitingForConnection)this.closeSocket(U.ERRORS.ProxyConnectionTimedOut)}onConnectHandler(){if(this.setState(U.SocksClientState.Connected),this.options.proxy.type===4)this.sendSocks4InitialHandshake();else this.sendSocks5InitialHandshake();this.setState(U.SocksClientState.SentInitialHandshake)}onDataReceivedHandler(w){this.receiveBuffer.append(w),this.processData()}processData(){while(this.state!==U.SocksClientState.Established&&this.state!==U.SocksClientState.Error&&this.receiveBuffer.length>=this.nextRequiredPacketBufferSize)if(this.state===U.SocksClientState.SentInitialHandshake)if(this.options.proxy.type===4)this.handleSocks4FinalHandshakeResponse();else this.handleInitialSocks5HandshakeResponse();else if(this.state===U.SocksClientState.SentAuthentication)this.handleInitialSocks5AuthenticationHandshakeResponse();else if(this.state===U.SocksClientState.SentFinalHandshake)this.handleSocks5FinalHandshakeResponse();else if(this.state===U.SocksClientState.BoundWaitingForConnection)if(this.options.proxy.type===4)this.handleSocks4IncomingConnectionResponse();else this.handleSocks5IncomingConnectionResponse();else{this.closeSocket(U.ERRORS.InternalError);break}}onCloseHandler(){this.closeSocket(U.ERRORS.SocketClosed)}onErrorHandler(w){this.closeSocket(w.message)}removeInternalSocketHandlers(){this.socket.pause(),this.socket.removeListener("data",this.onDataReceived),this.socket.removeListener("close",this.onClose),this.socket.removeListener("error",this.onError),this.socket.removeListener("connect",this.onConnect)}closeSocket(w){if(this.state!==U.SocksClientState.Error)this.setState(U.SocksClientState.Error),this.socket.destroy(),this.removeInternalSocketHandlers(),this.emit("error",new rw.SocksClientError(w,this.options))}sendSocks4InitialHandshake(){const w=this.options.proxy.userId||"",J=new c.SmartBuffer;if(J.writeUInt8(4),J.writeUInt8(U.SocksCommand[this.options.command]),J.writeUInt16BE(this.options.destination.port),Uw.isIPv4(this.options.destination.host))J.writeBuffer(u.ipToBuffer(this.options.destination.host)),J.writeStringNT(w);else J.writeUInt8(0),J.writeUInt8(0),J.writeUInt8(0),J.writeUInt8(1),J.writeStringNT(w),J.writeStringNT(this.options.destination.host);this.nextRequiredPacketBufferSize=U.SOCKS_INCOMING_PACKET_SIZES.Socks4Response,this.socket.write(J.toBuffer())}handleSocks4FinalHandshakeResponse(){const w=this.receiveBuffer.get(8);if(w[1]!==U.Socks4Response.Granted)this.closeSocket(`${U.ERRORS.Socks4ProxyRejectedConnection} - (${U.Socks4Response[w[1]]})`);else if(U.SocksCommand[this.options.command]===U.SocksCommand.bind){const J=c.SmartBuffer.fromBuffer(w);J.readOffset=2;const X={port:J.readUInt16BE(),host:u.int32ToIpv4(J.readUInt32BE())};if(X.host==="0.0.0.0")X.host=this.options.proxy.ipaddress;this.setState(U.SocksClientState.BoundWaitingForConnection),this.emit("bound",{remoteHost:X,socket:this.socket})}else this.setState(U.SocksClientState.Established),this.removeInternalSocketHandlers(),this.emit("established",{socket:this.socket})}handleSocks4IncomingConnectionResponse(){const w=this.receiveBuffer.get(8);if(w[1]!==U.Socks4Response.Granted)this.closeSocket(`${U.ERRORS.Socks4ProxyRejectedIncomingBoundConnection} - (${U.Socks4Response[w[1]]})`);else{const J=c.SmartBuffer.fromBuffer(w);J.readOffset=2;const X={port:J.readUInt16BE(),host:u.int32ToIpv4(J.readUInt32BE())};this.setState(U.SocksClientState.Established),this.removeInternalSocketHandlers(),this.emit("established",{remoteHost:X,socket:this.socket})}}sendSocks5InitialHandshake(){const w=new c.SmartBuffer,J=[U.Socks5Auth.NoAuth];if(this.options.proxy.userId||this.options.proxy.password)J.push(U.Socks5Auth.UserPass);if(this.options.proxy.custom_auth_method!==void 0)J.push(this.options.proxy.custom_auth_method);w.writeUInt8(5),w.writeUInt8(J.length);for(let X of J)w.writeUInt8(X);this.nextRequiredPacketBufferSize=U.SOCKS_INCOMING_PACKET_SIZES.Socks5InitialHandshakeResponse,this.socket.write(w.toBuffer()),this.setState(U.SocksClientState.SentInitialHandshake)}handleInitialSocks5HandshakeResponse(){const w=this.receiveBuffer.get(2);if(w[0]!==5)this.closeSocket(U.ERRORS.InvalidSocks5IntiailHandshakeSocksVersion);else if(w[1]===U.SOCKS5_NO_ACCEPTABLE_AUTH)this.closeSocket(U.ERRORS.InvalidSocks5InitialHandshakeNoAcceptedAuthType);else if(w[1]===U.Socks5Auth.NoAuth)this.socks5ChosenAuthType=U.Socks5Auth.NoAuth,this.sendSocks5CommandRequest();else if(w[1]===U.Socks5Auth.UserPass)this.socks5ChosenAuthType=U.Socks5Auth.UserPass,this.sendSocks5UserPassAuthentication();else if(w[1]===this.options.proxy.custom_auth_method)this.socks5ChosenAuthType=this.options.proxy.custom_auth_method,this.sendSocks5CustomAuthentication();else this.closeSocket(U.ERRORS.InvalidSocks5InitialHandshakeUnknownAuthType)}sendSocks5UserPassAuthentication(){const w=this.options.proxy.userId||"",J=this.options.proxy.password||"",X=new c.SmartBuffer;X.writeUInt8(1),X.writeUInt8(Buffer.byteLength(w)),X.writeString(w),X.writeUInt8(Buffer.byteLength(J)),X.writeString(J),this.nextRequiredPacketBufferSize=U.SOCKS_INCOMING_PACKET_SIZES.Socks5UserPassAuthenticationResponse,this.socket.write(X.toBuffer()),this.setState(U.SocksClientState.SentAuthentication)}sendSocks5CustomAuthentication(){return Fw(this,void 0,void 0,function*(){this.nextRequiredPacketBufferSize=this.options.proxy.custom_auth_response_size,this.socket.write(yield this.options.proxy.custom_auth_request_handler()),this.setState(U.SocksClientState.SentAuthentication)})}handleSocks5CustomAuthHandshakeResponse(w){return Fw(this,void 0,void 0,function*(){return yield this.options.proxy.custom_auth_response_handler(w)})}handleSocks5AuthenticationNoAuthHandshakeResponse(w){return Fw(this,void 0,void 0,function*(){return w[1]===0})}handleSocks5AuthenticationUserPassHandshakeResponse(w){return Fw(this,void 0,void 0,function*(){return w[1]===0})}handleInitialSocks5AuthenticationHandshakeResponse(){return Fw(this,void 0,void 0,function*(){this.setState(U.SocksClientState.ReceivedAuthenticationResponse);let w=!1;if(this.socks5ChosenAuthType===U.Socks5Auth.NoAuth)w=yield this.handleSocks5AuthenticationNoAuthHandshakeResponse(this.receiveBuffer.get(2));else if(this.socks5ChosenAuthType===U.Socks5Auth.UserPass)w=yield this.handleSocks5AuthenticationUserPassHandshakeResponse(this.receiveBuffer.get(2));else if(this.socks5ChosenAuthType===this.options.proxy.custom_auth_method)w=yield this.handleSocks5CustomAuthHandshakeResponse(this.receiveBuffer.get(this.options.proxy.custom_auth_response_size));if(!w)this.closeSocket(U.ERRORS.Socks5AuthenticationFailed);else this.sendSocks5CommandRequest()})}sendSocks5CommandRequest(){const w=new c.SmartBuffer;if(w.writeUInt8(5),w.writeUInt8(U.SocksCommand[this.options.command]),w.writeUInt8(0),Uw.isIPv4(this.options.destination.host))w.writeUInt8(U.Socks5HostType.IPv4),w.writeBuffer(u.ipToBuffer(this.options.destination.host));else if(Uw.isIPv6(this.options.destination.host))w.writeUInt8(U.Socks5HostType.IPv6),w.writeBuffer(u.ipToBuffer(this.options.destination.host));else w.writeUInt8(U.Socks5HostType.Hostname),w.writeUInt8(this.options.destination.host.length),w.writeString(this.options.destination.host);w.writeUInt16BE(this.options.destination.port),this.nextRequiredPacketBufferSize=U.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHeader,this.socket.write(w.toBuffer()),this.setState(U.SocksClientState.SentFinalHandshake)}handleSocks5FinalHandshakeResponse(){const w=this.receiveBuffer.peek(5);if(w[0]!==5||w[1]!==U.Socks5Response.Granted)this.closeSocket(`${U.ERRORS.InvalidSocks5FinalHandshakeRejected} - ${U.Socks5Response[w[1]]}`);else{const J=w[3];let X,Y;if(J===U.Socks5HostType.IPv4){const Z=U.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv4;if(this.receiveBuffer.length<Z){this.nextRequiredPacketBufferSize=Z;return}if(Y=c.SmartBuffer.fromBuffer(this.receiveBuffer.get(Z).slice(4)),X={host:u.int32ToIpv4(Y.readUInt32BE()),port:Y.readUInt16BE()},X.host==="0.0.0.0")X.host=this.options.proxy.ipaddress}else if(J===U.Socks5HostType.Hostname){const Z=w[4],h=U.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHostname(Z);if(this.receiveBuffer.length<h){this.nextRequiredPacketBufferSize=h;return}Y=c.SmartBuffer.fromBuffer(this.receiveBuffer.get(h).slice(5)),X={host:Y.readString(Z),port:Y.readUInt16BE()}}else if(J===U.Socks5HostType.IPv6){const Z=U.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv6;if(this.receiveBuffer.length<Z){this.nextRequiredPacketBufferSize=Z;return}Y=c.SmartBuffer.fromBuffer(this.receiveBuffer.get(Z).slice(4)),X={host:ow.Address6.fromByteArray(Array.from(Y.readBuffer(16))).canonicalForm(),port:Y.readUInt16BE()}}if(this.setState(U.SocksClientState.ReceivedFinalResponse),U.SocksCommand[this.options.command]===U.SocksCommand.connect)this.setState(U.SocksClientState.Established),this.removeInternalSocketHandlers(),this.emit("established",{remoteHost:X,socket:this.socket});else if(U.SocksCommand[this.options.command]===U.SocksCommand.bind)this.setState(U.SocksClientState.BoundWaitingForConnection),this.nextRequiredPacketBufferSize=U.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHeader,this.emit("bound",{remoteHost:X,socket:this.socket});else if(U.SocksCommand[this.options.command]===U.SocksCommand.associate)this.setState(U.SocksClientState.Established),this.removeInternalSocketHandlers(),this.emit("established",{remoteHost:X,socket:this.socket})}}handleSocks5IncomingConnectionResponse(){const w=this.receiveBuffer.peek(5);if(w[0]!==5||w[1]!==U.Socks5Response.Granted)this.closeSocket(`${U.ERRORS.Socks5ProxyRejectedIncomingBoundConnection} - ${U.Socks5Response[w[1]]}`);else{const J=w[3];let X,Y;if(J===U.Socks5HostType.IPv4){const Z=U.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv4;if(this.receiveBuffer.length<Z){this.nextRequiredPacketBufferSize=Z;return}if(Y=c.SmartBuffer.fromBuffer(this.receiveBuffer.get(Z).slice(4)),X={host:u.int32ToIpv4(Y.readUInt32BE()),port:Y.readUInt16BE()},X.host==="0.0.0.0")X.host=this.options.proxy.ipaddress}else if(J===U.Socks5HostType.Hostname){const Z=w[4],h=U.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHostname(Z);if(this.receiveBuffer.length<h){this.nextRequiredPacketBufferSize=h;return}Y=c.SmartBuffer.fromBuffer(this.receiveBuffer.get(h).slice(5)),X={host:Y.readString(Z),port:Y.readUInt16BE()}}else if(J===U.Socks5HostType.IPv6){const Z=U.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv6;if(this.receiveBuffer.length<Z){this.nextRequiredPacketBufferSize=Z;return}Y=c.SmartBuffer.fromBuffer(this.receiveBuffer.get(Z).slice(4)),X={host:ow.Address6.fromByteArray(Array.from(Y.readBuffer(16))).canonicalForm(),port:Y.readUInt16BE()}}this.setState(U.SocksClientState.Established),this.removeInternalSocketHandlers(),this.emit("established",{remoteHost:X,socket:this.socket})}}get socksClientOptions(){return Object.assign({},this.options)}}Jw.SocksClient=Bw});var W0=R((hw)=>{var xJ=hw&&hw.__createBinding||(Object.create?function(w,J,X,Y){if(Y===void 0)Y=X;var Z=Object.getOwnPropertyDescriptor(J,X);if(!Z||("get"in Z?!J.__esModule:Z.writable||Z.configurable))Z={enumerable:!0,get:function(){return J[X]}};Object.defineProperty(w,Y,Z)}:function(w,J,X,Y){if(Y===void 0)Y=X;w[Y]=J[X]}),mJ=hw&&hw.__exportStar||function(w,J){for(var X in w)if(X!=="default"&&!Object.prototype.hasOwnProperty.call(J,X))xJ(J,w,X)};Object.defineProperty(hw,"__esModule",{value:!0});mJ(Z0(),hw)});var q0=Q8(W0(),1);import cJ from"net";import _J from"node-fetch";var h0={"whois.denic.de":"-T dn,ace","whois.nic.fr":"-V Md5.2"};var sw={"br.com":"whois.centralnic.net","cn.com":"whois.centralnic.net","de.com":"whois.centralnic.net","eu.com":"whois.centralnic.net","gb.com":"whois.centralnic.net","gb.net":"whois.centralnic.net","gr.com":"whois.centralnic.net","hu.com":"whois.centralnic.net","in.net":"whois.centralnic.net","no.com":"whois.centralnic.net","qc.com":"whois.centralnic.net","ru.com":"whois.centralnic.net","sa.com":"whois.centralnic.net","se.com":"whois.centralnic.net","se.net":"whois.centralnic.net","uk.com":"whois.centralnic.net","uk.net":"whois.centralnic.net","us.com":"whois.centralnic.net","uy.com":"whois.centralnic.net","za.com":"whois.centralnic.net","jpn.com":"whois.centralnic.ne","web.com":"whois.centralnic.ne",com:"whois.verisign-grs.com","za.net":"whois.za.net",net:"whois.verisign-grs.com","eu.org":"whois.eu.org","za.org":"whois.za.org",org:"whois.pir.org","llyw.cymru":"whois.nic.llyw.cymru","gov.scot":"whois.nic.gov.scot","gov.wales":"whois.nic.gov.wales",edu:"whois.educause.edu",gov:"whois.dotgov.gov",int:"whois.iana.org","e164.arpa":"whois.ripe.net",arpa:"whois.iana.org",aero:"whois.aero",asia:"whois.nic.asia",biz:"whois.nic.biz",cat:"whois.nic.cat",coop:"whois.nic.coop",info:"whois.afilias.net",jobs:"whois.nic.jobs",mobi:"whois.afilias.net",museum:"whois.nic.museum",name:"whois.nic.name",post:"whois.dotpostregistry.net",pro:"whois.nic.pro",tel:"whois.nic.tel",travel:"whois.nic.travel",xxx:"whois.nic.xxx",ac:"whois.nic.ac",ae:"whois.aeda.net.ae",af:"whois.nic.af",ag:"whois.nic.ag",ai:"whois.nic.ai",am:"whois.amnic.net",ar:"whois.nic.ar",as:"whois.nic.as","priv.at":"whois.nic.priv.at",at:"whois.nic.at",au:"whois.auda.org.au",aw:"whois.nic.aw",ax:"whois.ax",be:"whois.dns.be",bf:"whois.registre.bf",bg:"whois.register.bg",bh:"whois.nic.bh",bi:"whois1.nic.bi",bj:"whois.nic.bj",bm:"whois.afilias-srs.net",bn:"whois.bnnic.bn",bo:"whois.nic.bo",br:"whois.registro.br",by:"whois.cctld.by",bw:"whois.nic.net.bw",bz:"whois.afilias-grs.info","co.ca":"whois.co.ca",ca:"whois.cira.ca",cc:"ccwhois.verisign-grs.com",cd:"whois.nic.cd",ch:"whois.nic.ch",ci:"whois.nic.ci",cl:"whois.nic.cl",cm:"whois.netcom.cm","edu.cn":"whois.edu.cn",cn:"whois.cnnic.cn","uk.co":"whois.uk.co",co:"whois.nic.co",cr:"whois.nic.cr",cx:"whois.nic.cx",cz:"whois.nic.cz",de:"whois.denic.de",dk:"whois.dk-hostmaster.dk",dm:"whois.dmdomains.dm",do:"whois.nic.do",dz:"whois.nic.dz",ec:"whois.nic.ec",ee:"whois.tld.ee",eu:"whois.eu",fi:"whois.fi",fj:"www.whois.fj",fm:"whois.nic.fm",fo:"whois.nic.fo",fr:"whois.nic.fr",gd:"whois.nic.gd",ge:"whois.nic.ge",gf:"whois.mediaserv.net",gg:"whois.gg",gh:"whois.nic.gh",gi:"whois2.afilias-grs.net",gl:"whois.nic.gl",gp:"whois.nic.gp",gq:"whois.dominio.gq",gs:"whois.nic.gs",gy:"whois.registry.gy",hk:"whois.hkirc.hk",hm:"whois.registry.hm",hn:"whois.nic.hn",hr:"whois.dns.hr",ht:"whois.nic.ht",hu:"whois.nic.hu",id:"whois.id",ie:"whois.weare.ie",il:"whois.isoc.org.il",im:"whois.nic.im",in:"whois.registry.in",io:"whois.nic.io",iq:"whois.cmc.iq",ir:"whois.nic.ir",is:"whois.isnic.is",it:"whois.nic.it",je:"whois.je",jp:"whois.jprs.jp",ke:"whois.kenic.or.ke",kg:"whois.kg",ki:"whois.nic.ki",kn:"whois.nic.kn",kr:"whois.kr",kw:"whois.nic.kw",ky:"whois.kyregistry.ky",kz:"whois.nic.kz",la:"whois.nic.la",lb:"whois.lbdr.org.lb",lc:"whois2.afilias-grs.net",li:"whois.nic.li",lk:"whois.nic.lk",ls:"whois.nic.ls",lt:"whois.domreg.lt",lu:"whois.dns.lu",lv:"whois.nic.lv",ly:"whois.nic.ly",ma:"whois.registre.ma",md:"whois.nic.md",me:"whois.nic.me",mg:"whois.nic.mg",mk:"whois.marnet.mk",ml:"whois.dot.ml",mm:"whois.registry.gov.mm",mn:"whois.nic.mn",mq:"whois.mediaserv.net",mr:"whois.nic.mr",ms:"whois.nic.ms",mt:"whois.nic.org.mt",mu:"whois.nic.mu",mw:"whois.nic.mw",mx:"whois.mx",my:"whois.mynic.my",mz:"whois.nic.mz",na:"whois.na-nic.com.na",nc:"whois.nc",nf:"whois.nic.nf",ng:"whois.nic.net.ng",nl:"whois.domain-registry.nl",no:"whois.norid.no",nu:"whois.iis.nu",nz:"whois.irs.net.nz",om:"whois.registry.om",pe:"kero.yachay.pe",pf:"whois.registry.pf",pk:"whois.pknic.net.pk","co.pl":"whois.co.pl",pl:"whois.dns.pl",pm:"whois.nic.pm",pr:"whois.afilias-srs.net",ps:"whois.pnina.ps",pt:"whois.dns.pt",pw:"whois.nic.pw",qa:"whois.registry.qa",re:"whois.nic.re",ro:"whois.rotld.ro",rs:"whois.rnids.rs","ac.ru":"whois.free.net","edu.ru":"whois.informika.ru","com.ru":"whois.flexireg.net","msk.ru":"whois.flexireg.net","net.ru":"whois.nic.net.ru","nov.ru":"whois.flexireg.net","org.ru":"whois.nic.net.ru","pp.ru":"whois.nic.net.ru","spb.ru":"whois.flexireg.net",ru:"whois.tcinet.ru",rw:"whois.ricta.org.rw",sa:"whois.nic.net.sa",sb:"whois.nic.net.sb",sc:"whois2.afilias-grs.net",sd:"whois.sdnic.sd",se:"whois.iis.se",sg:"whois.sgnic.sg",sh:"whois.nic.sh",si:"whois.register.si",sk:"whois.sk-nic.sk",sl:"whois.nic.sl",sm:"whois.nic.sm",sn:"whois.nic.sn",so:"whois.nic.so",ss:"whois.nic.ss",st:"whois.nic.st","msk.su":"whois.flexireg.net","nov.su":"whois.flexireg.net","spb.su":"whois.flexireg.net",su:"whois.tcinet.ru",sx:"whois.sx",sy:"whois.tld.sy",tc:"whois.nic.tc",td:"whois.nic.td",tf:"whois.nic.tf",tg:"whois.nic.tg",th:"whois.thnic.co.th",tk:"whois.dot.tk",tl:"whois.nic.tl",tm:"whois.nic.tm",tn:"whois.ati.tn",to:"whois.tonic.to",tr:"whois.trabis.gov.tr",tv:"whois.nic.tv",tw:"whois.twnic.net.tw",tz:"whois.tznic.or.tz","biz.ua":"whois.biz.ua","co.ua":"whois.co.ua","pp.ua":"whois.pp.ua",ua:"whois.ua",ug:"whois.co.ug","ac.uk":"whois.nic.ac.uk","gov.uk":"whois.gov.uk",uk:"whois.nic.uk","fed.us":"whois.nic.gov",us:"whois.nic.us",uy:"whois.nic.org.uy",uz:"whois.cctld.uz",vc:"whois2.afilias-grs.net",ve:"whois.nic.ve",vg:"whois.nic.vg",vu:"whois.dnrs.vu",wf:"whois.nic.wf",ws:"whois.website.ws",yt:"whois.nic.yt","ac.za":"whois.ac.za","co.za":"whois.registry.net.za","gov.za":"whois.gov.za","net.za":"net-whois.registry.net.za","org.za":"org-whois.registry.net.za","web.za":"web-whois.registry.net.za",zm:"whois.zicta.zm","xn--2scrj9c":"whois.registry.in","xn--3e0b707e":"whois.kr","xn--3hcrj9c":"whois.registry.in","xn--45br5cyl":"whois.registry.in","xn--45brj9c":"whois.registry.in","xn--4dbrk0ce":"whois.isoc.org.il","xn--80ao21a":"whois.nic.kz","xn--90a3ac":"whois.rnids.rs","xn--90ae":"whois.imena.bg","xn--90ais":"whois.cctld.by","xn--clchc0ea0b2g2a9gcd":"whois.sgnic.sg","xn--d1alf":"whois.marnet.mk","xn--e1a4c":"whois.eu","xn--fiqs8s":"cwhois.cnnic.cn","xn--fiqz9s":"cwhois.cnnic.cn","xn--fpcrj9c3d":"whois.registry.in","xn--fzc2c9e2c":"whois.nic.lk","xn--gecrj9c":"whois.registry.in","xn--h2breg3eve":"whois.registry.in","xn--h2brj9c8c":"whois.registry.in","xn--h2brj9c":"whois.registry.in","xn--j1amh":"whois.dotukr.com","xn--j6w193g":"whois.hkirc.hk","xn--kprw13d":"whois.twnic.net.tw","xn--kpry57d":"whois.twnic.net.tw","xn--lgbbat1ad8j":"whois.nic.dz","xn--mgb9awbf":"whois.registry.om","xn--mgba3a4f16a":"whois.nic.ir","xn--mgbaam7a8h":"whois.aeda.net.ae","xn--mgbah1a3hjkrd":"whois.nic.mr","xn--mgbbh1a71e":"whois.registry.in","xn--mgbbh1a":"whois.registry.in","xn--mgberp4a5d4ar":"whois.nic.net.sa","xn--mgbgu82a":"whois.registry.in","xn--mgbtx2b":"whois.cmc.iq","xn--mgbx4cd0ab":"whois.mynic.my","xn--node":"whois.itdc.ge","xn--o3cw4h":"whois.thnic.co.th","xn--ogbpf8fl":"whois.tld.sy","xn--p1ai":"whois.tcinet.ru","xn--pgbs0dh":"whois.ati.tn","xn--q7ce6a":"whois.nic.la","xn--qxa6a":"whois.eu","xn--rvc1e0am3e":"whois.registry.in","xn--s9brj9c":"whois.registry.in","xn--wgbh1c":"whois.dotmasr.eg","xn--wgbl6a":"whois.registry.qa","xn--xkc2al3hye2a":"whois.nic.lk","xn--xkc2dl3a5ee0h":"whois.registry.in","xn--y9a3aq":"whois.amnic.net","xn--yfro4i67o":"whois.sgnic.sg","xn--ygbi2ammx":"whois.pnina.ps"};async function uJ(w){const J=gJ+w;try{const X=await _J(J);if(X.ok){const Z=(await X.text()).match(/whois:\s+(.*)\s+/);if(Z?.[1])return Z[1]}}catch(X){console.error("Error in getting WhoIs server data from IANA",X)}return""}function F0(w){if(Array.isArray(w))return w.slice();if(typeof w==="object"&&w!==null){const J={};for(let X in w)if(Object.prototype.hasOwnProperty.call(w,X))J[X]=F0(w[X]);return J}return w}function lJ(w){return sw[w]}function G0(w){let J=null,X=w;while(!0){const Z=X.split(".");if(Z.length<2)break;const h=Z.slice(1).join(".");if(sw[h]){J=h;break}X=h}if(J)return J;console.debug("TLD is not found in server list. Returning last element after split as TLD!");const Y=w.split(".");return Y[Y.length-1]}function fJ(w){return h0[w]}async function iJ(w,J,X,Y,Z,h){const z=new TextDecoder(Z),V=new TextEncoder;if(!h){const L=new cJ.Socket;return new Promise((q,T)=>{try{L.connect({port:Y,host:X},()=>{if(J!=="")L.write(V.encode(`${J} ${w}\r\n`));else L.write(V.encode(`${w}\r\n`))}),L.on("data",(D)=>{q(z.decode(D))}),L.on("error",(D)=>{T(D)})}catch(D){T(D)}})}const E={proxy:{host:h.ip,port:h.port,type:h.type===1?5:4},command:"connect",destination:{host:X,port:Y}};if(h.username&&h.password)E.proxy.userId=h.username,E.proxy.password=h.password;return new Promise((L,q)=>{q0.SocksClient.createConnection(E,(T,D)=>{if(T)q(T);else{if(!D)q(new Error("No socket info received!"));if(J!=="")D?.socket.write(V.encode(`${J} ${w}\r\n`));else D?.socket.write(V.encode(`${w}\r\n`));D?.socket.on("data",(M)=>{L(z.decode(M))}),D?.socket.resume()}})})}async function tw(w,J=!1,X=null){let Y,Z=43,h="",z,V="utf-8";if(!X)Y=G0(w),z=null;else Y=X.tld?X.tld:G0(w),V=X.encoding?X.encoding:"utf-8",z=X.proxy?X.proxy:null,h=X.server?X.server:"",Z=X.serverPort?X.serverPort:43;if(h===""){let q=lJ(Y);if(!q){if(console.debug(`No WhoIs server found for TLD: ${Y}! Attempting IANA WhoIs database for server!`),q=await uJ(Y),!q)return console.debug("WhoIs server could not be found!"),{_raw:"",parsedData:null};console.debug(`WhoIs sever found for ${Y}: ${h}`)}h=q}const L=fJ(h)||"";try{const q=await iJ(w,L,h,Z,V,z);if(!J){const D=Iw.parseData(q,null);return{_raw:q,parsedData:D}}let T=null;if(X?.parseData)T=F0(X.parseData);try{const D=Iw.parseData(q,T);return{_raw:q,parsedData:D}}catch(D){return console.error("Error in parsing WhoIs data!",D),{_raw:q,parsedData:null}}}catch(q){return{_raw:"",parsedData:null}}}function HQ(w,J=null){return tw(w,!0,J)}async function PQ(w,J=!1,X=1,Y=!1,Z=null){let h=[];if(J){if(X>w.length)X=w.length;for(let z=0;z<w.length;z+=X){const V=w.slice(z,z+X);h=await Promise.all(V.map(async(E)=>{return await tw(E,Y,Z)}))}}else for(let z=0;z<w.length;z++){const V=await tw(w[z],Y,Z);h.push(V)}return h}var gJ="https://www.iana.org/whois?q=",dJ;((X)=>{X[X.SOCKS4=0]="SOCKS4";X[X.SOCKS5=1]="SOCKS5"})(dJ||={});class Iw{static iterParse(w,J){let X="",Y=null,Z="";for(let h=0;h<w.length;h++){const z=w[h];if(z==="\n"||Z===":"&&z===" "){if(X.trim()in J)Y=X.trim();else if(Y!==null){const V=X.trim();if(V!==""){const E=J[Y];if(Array.isArray(E))E.push(V);else J[Y]=V;Y=null}}X=""}else if(z!==":")X=X+z;if(Z=z,X==="Record maintained by"||X===">>>")break}return J}static parseData(w,J){if(!J)J={"Domain Name":"","Creation Date":"","Updated Date":"","Registry Expiry Date":"","Domain Status":[],Registrar:""};return J=Iw.iterParse(w,J),J}}export{tw as whois,iJ as tcpWhois,HQ as lookup,PQ as batchWhois,Iw as WhoIsParser,dJ as ProxyType};
6
3
 
7
- // src/parameters.ts
8
- var parameters_default = {
9
- "whois.denic.de": "-T dn,ace",
10
- "whois.nic.fr": "-V Md5.2"
11
- };
12
-
13
- // src/servers.ts
14
- var servers_default = {
15
- "br.com": "whois.centralnic.net",
16
- "cn.com": "whois.centralnic.net",
17
- "de.com": "whois.centralnic.net",
18
- "eu.com": "whois.centralnic.net",
19
- "gb.com": "whois.centralnic.net",
20
- "gb.net": "whois.centralnic.net",
21
- "gr.com": "whois.centralnic.net",
22
- "hu.com": "whois.centralnic.net",
23
- "in.net": "whois.centralnic.net",
24
- "no.com": "whois.centralnic.net",
25
- "qc.com": "whois.centralnic.net",
26
- "ru.com": "whois.centralnic.net",
27
- "sa.com": "whois.centralnic.net",
28
- "se.com": "whois.centralnic.net",
29
- "se.net": "whois.centralnic.net",
30
- "uk.com": "whois.centralnic.net",
31
- "uk.net": "whois.centralnic.net",
32
- "us.com": "whois.centralnic.net",
33
- "uy.com": "whois.centralnic.net",
34
- "za.com": "whois.centralnic.net",
35
- "jpn.com": "whois.centralnic.ne",
36
- "web.com": "whois.centralnic.ne",
37
- com: "whois.verisign-grs.com",
38
- "za.net": "whois.za.net",
39
- net: "whois.verisign-grs.com",
40
- "eu.org": "whois.eu.org",
41
- "za.org": "whois.za.org",
42
- org: "whois.pir.org",
43
- "llyw.cymru": "whois.nic.llyw.cymru",
44
- "gov.scot": "whois.nic.gov.scot",
45
- "gov.wales": "whois.nic.gov.wales",
46
- edu: "whois.educause.edu",
47
- gov: "whois.dotgov.gov",
48
- int: "whois.iana.org",
49
- "e164.arpa": "whois.ripe.net",
50
- arpa: "whois.iana.org",
51
- aero: "whois.aero",
52
- asia: "whois.nic.asia",
53
- biz: "whois.nic.biz",
54
- cat: "whois.nic.cat",
55
- coop: "whois.nic.coop",
56
- info: "whois.afilias.net",
57
- jobs: "whois.nic.jobs",
58
- mobi: "whois.afilias.net",
59
- museum: "whois.nic.museum",
60
- name: "whois.nic.name",
61
- post: "whois.dotpostregistry.net",
62
- pro: "whois.nic.pro",
63
- tel: "whois.nic.tel",
64
- travel: "whois.nic.travel",
65
- xxx: "whois.nic.xxx",
66
- ac: "whois.nic.ac",
67
- ae: "whois.aeda.net.ae",
68
- af: "whois.nic.af",
69
- ag: "whois.nic.ag",
70
- ai: "whois.nic.ai",
71
- am: "whois.amnic.net",
72
- ar: "whois.nic.ar",
73
- as: "whois.nic.as",
74
- "priv.at": "whois.nic.priv.at",
75
- at: "whois.nic.at",
76
- au: "whois.auda.org.au",
77
- aw: "whois.nic.aw",
78
- ax: "whois.ax",
79
- be: "whois.dns.be",
80
- bf: "whois.registre.bf",
81
- bg: "whois.register.bg",
82
- bh: "whois.nic.bh",
83
- bi: "whois1.nic.bi",
84
- bj: "whois.nic.bj",
85
- bm: "whois.afilias-srs.net",
86
- bn: "whois.bnnic.bn",
87
- bo: "whois.nic.bo",
88
- br: "whois.registro.br",
89
- by: "whois.cctld.by",
90
- bw: "whois.nic.net.bw",
91
- bz: "whois.afilias-grs.info",
92
- "co.ca": "whois.co.ca",
93
- ca: "whois.cira.ca",
94
- cc: "ccwhois.verisign-grs.com",
95
- cd: "whois.nic.cd",
96
- ch: "whois.nic.ch",
97
- ci: "whois.nic.ci",
98
- cl: "whois.nic.cl",
99
- cm: "whois.netcom.cm",
100
- "edu.cn": "whois.edu.cn",
101
- cn: "whois.cnnic.cn",
102
- "uk.co": "whois.uk.co",
103
- co: "whois.nic.co",
104
- cr: "whois.nic.cr",
105
- cx: "whois.nic.cx",
106
- cz: "whois.nic.cz",
107
- de: "whois.denic.de",
108
- dk: "whois.dk-hostmaster.dk",
109
- dm: "whois.dmdomains.dm",
110
- do: "whois.nic.do",
111
- dz: "whois.nic.dz",
112
- ec: "whois.nic.ec",
113
- ee: "whois.tld.ee",
114
- eu: "whois.eu",
115
- fi: "whois.fi",
116
- fj: "www.whois.fj",
117
- fm: "whois.nic.fm",
118
- fo: "whois.nic.fo",
119
- fr: "whois.nic.fr",
120
- gd: "whois.nic.gd",
121
- ge: "whois.nic.ge",
122
- gf: "whois.mediaserv.net",
123
- gg: "whois.gg",
124
- gh: "whois.nic.gh",
125
- gi: "whois2.afilias-grs.net",
126
- gl: "whois.nic.gl",
127
- gp: "whois.nic.gp",
128
- gq: "whois.dominio.gq",
129
- gs: "whois.nic.gs",
130
- gy: "whois.registry.gy",
131
- hk: "whois.hkirc.hk",
132
- hm: "whois.registry.hm",
133
- hn: "whois.nic.hn",
134
- hr: "whois.dns.hr",
135
- ht: "whois.nic.ht",
136
- hu: "whois.nic.hu",
137
- id: "whois.id",
138
- ie: "whois.weare.ie",
139
- il: "whois.isoc.org.il",
140
- im: "whois.nic.im",
141
- in: "whois.registry.in",
142
- io: "whois.nic.io",
143
- iq: "whois.cmc.iq",
144
- ir: "whois.nic.ir",
145
- is: "whois.isnic.is",
146
- it: "whois.nic.it",
147
- je: "whois.je",
148
- jp: "whois.jprs.jp",
149
- ke: "whois.kenic.or.ke",
150
- kg: "whois.kg",
151
- ki: "whois.nic.ki",
152
- kn: "whois.nic.kn",
153
- kr: "whois.kr",
154
- kw: "whois.nic.kw",
155
- ky: "whois.kyregistry.ky",
156
- kz: "whois.nic.kz",
157
- la: "whois.nic.la",
158
- lb: "whois.lbdr.org.lb",
159
- lc: "whois2.afilias-grs.net",
160
- li: "whois.nic.li",
161
- lk: "whois.nic.lk",
162
- ls: "whois.nic.ls",
163
- lt: "whois.domreg.lt",
164
- lu: "whois.dns.lu",
165
- lv: "whois.nic.lv",
166
- ly: "whois.nic.ly",
167
- ma: "whois.registre.ma",
168
- md: "whois.nic.md",
169
- me: "whois.nic.me",
170
- mg: "whois.nic.mg",
171
- mk: "whois.marnet.mk",
172
- ml: "whois.dot.ml",
173
- mm: "whois.registry.gov.mm",
174
- mn: "whois.nic.mn",
175
- mq: "whois.mediaserv.net",
176
- mr: "whois.nic.mr",
177
- ms: "whois.nic.ms",
178
- mt: "whois.nic.org.mt",
179
- mu: "whois.nic.mu",
180
- mw: "whois.nic.mw",
181
- mx: "whois.mx",
182
- my: "whois.mynic.my",
183
- mz: "whois.nic.mz",
184
- na: "whois.na-nic.com.na",
185
- nc: "whois.nc",
186
- nf: "whois.nic.nf",
187
- ng: "whois.nic.net.ng",
188
- nl: "whois.domain-registry.nl",
189
- no: "whois.norid.no",
190
- nu: "whois.iis.nu",
191
- nz: "whois.irs.net.nz",
192
- om: "whois.registry.om",
193
- pe: "kero.yachay.pe",
194
- pf: "whois.registry.pf",
195
- pk: "whois.pknic.net.pk",
196
- "co.pl": "whois.co.pl",
197
- pl: "whois.dns.pl",
198
- pm: "whois.nic.pm",
199
- pr: "whois.afilias-srs.net",
200
- ps: "whois.pnina.ps",
201
- pt: "whois.dns.pt",
202
- pw: "whois.nic.pw",
203
- qa: "whois.registry.qa",
204
- re: "whois.nic.re",
205
- ro: "whois.rotld.ro",
206
- rs: "whois.rnids.rs",
207
- "ac.ru": "whois.free.net",
208
- "edu.ru": "whois.informika.ru",
209
- "com.ru": "whois.flexireg.net",
210
- "msk.ru": "whois.flexireg.net",
211
- "net.ru": "whois.nic.net.ru",
212
- "nov.ru": "whois.flexireg.net",
213
- "org.ru": "whois.nic.net.ru",
214
- "pp.ru": "whois.nic.net.ru",
215
- "spb.ru": "whois.flexireg.net",
216
- ru: "whois.tcinet.ru",
217
- rw: "whois.ricta.org.rw",
218
- sa: "whois.nic.net.sa",
219
- sb: "whois.nic.net.sb",
220
- sc: "whois2.afilias-grs.net",
221
- sd: "whois.sdnic.sd",
222
- se: "whois.iis.se",
223
- sg: "whois.sgnic.sg",
224
- sh: "whois.nic.sh",
225
- si: "whois.register.si",
226
- sk: "whois.sk-nic.sk",
227
- sl: "whois.nic.sl",
228
- sm: "whois.nic.sm",
229
- sn: "whois.nic.sn",
230
- so: "whois.nic.so",
231
- ss: "whois.nic.ss",
232
- st: "whois.nic.st",
233
- "msk.su": "whois.flexireg.net",
234
- "nov.su": "whois.flexireg.net",
235
- "spb.su": "whois.flexireg.net",
236
- su: "whois.tcinet.ru",
237
- sx: "whois.sx",
238
- sy: "whois.tld.sy",
239
- tc: "whois.nic.tc",
240
- td: "whois.nic.td",
241
- tf: "whois.nic.tf",
242
- tg: "whois.nic.tg",
243
- th: "whois.thnic.co.th",
244
- tk: "whois.dot.tk",
245
- tl: "whois.nic.tl",
246
- tm: "whois.nic.tm",
247
- tn: "whois.ati.tn",
248
- to: "whois.tonic.to",
249
- tr: "whois.trabis.gov.tr",
250
- tv: "whois.nic.tv",
251
- tw: "whois.twnic.net.tw",
252
- tz: "whois.tznic.or.tz",
253
- "biz.ua": "whois.biz.ua",
254
- "co.ua": "whois.co.ua",
255
- "pp.ua": "whois.pp.ua",
256
- ua: "whois.ua",
257
- ug: "whois.co.ug",
258
- "ac.uk": "whois.nic.ac.uk",
259
- "gov.uk": "whois.gov.uk",
260
- uk: "whois.nic.uk",
261
- "fed.us": "whois.nic.gov",
262
- us: "whois.nic.us",
263
- uy: "whois.nic.org.uy",
264
- uz: "whois.cctld.uz",
265
- vc: "whois2.afilias-grs.net",
266
- ve: "whois.nic.ve",
267
- vg: "whois.nic.vg",
268
- vu: "whois.dnrs.vu",
269
- wf: "whois.nic.wf",
270
- ws: "whois.website.ws",
271
- yt: "whois.nic.yt",
272
- "ac.za": "whois.ac.za",
273
- "co.za": "whois.registry.net.za",
274
- "gov.za": "whois.gov.za",
275
- "net.za": "net-whois.registry.net.za",
276
- "org.za": "org-whois.registry.net.za",
277
- "web.za": "web-whois.registry.net.za",
278
- zm: "whois.zicta.zm",
279
- "xn--2scrj9c": "whois.registry.in",
280
- "xn--3e0b707e": "whois.kr",
281
- "xn--3hcrj9c": "whois.registry.in",
282
- "xn--45br5cyl": "whois.registry.in",
283
- "xn--45brj9c": "whois.registry.in",
284
- "xn--4dbrk0ce": "whois.isoc.org.il",
285
- "xn--80ao21a": "whois.nic.kz",
286
- "xn--90a3ac": "whois.rnids.rs",
287
- "xn--90ae": "whois.imena.bg",
288
- "xn--90ais": "whois.cctld.by",
289
- "xn--clchc0ea0b2g2a9gcd": "whois.sgnic.sg",
290
- "xn--d1alf": "whois.marnet.mk",
291
- "xn--e1a4c": "whois.eu",
292
- "xn--fiqs8s": "cwhois.cnnic.cn",
293
- "xn--fiqz9s": "cwhois.cnnic.cn",
294
- "xn--fpcrj9c3d": "whois.registry.in",
295
- "xn--fzc2c9e2c": "whois.nic.lk",
296
- "xn--gecrj9c": "whois.registry.in",
297
- "xn--h2breg3eve": "whois.registry.in",
298
- "xn--h2brj9c8c": "whois.registry.in",
299
- "xn--h2brj9c": "whois.registry.in",
300
- "xn--j1amh": "whois.dotukr.com",
301
- "xn--j6w193g": "whois.hkirc.hk",
302
- "xn--kprw13d": "whois.twnic.net.tw",
303
- "xn--kpry57d": "whois.twnic.net.tw",
304
- "xn--lgbbat1ad8j": "whois.nic.dz",
305
- "xn--mgb9awbf": "whois.registry.om",
306
- "xn--mgba3a4f16a": "whois.nic.ir",
307
- "xn--mgbaam7a8h": "whois.aeda.net.ae",
308
- "xn--mgbah1a3hjkrd": "whois.nic.mr",
309
- "xn--mgbbh1a71e": "whois.registry.in",
310
- "xn--mgbbh1a": "whois.registry.in",
311
- "xn--mgberp4a5d4ar": "whois.nic.net.sa",
312
- "xn--mgbgu82a": "whois.registry.in",
313
- "xn--mgbtx2b": "whois.cmc.iq",
314
- "xn--mgbx4cd0ab": "whois.mynic.my",
315
- "xn--node": "whois.itdc.ge",
316
- "xn--o3cw4h": "whois.thnic.co.th",
317
- "xn--ogbpf8fl": "whois.tld.sy",
318
- "xn--p1ai": "whois.tcinet.ru",
319
- "xn--pgbs0dh": "whois.ati.tn",
320
- "xn--q7ce6a": "whois.nic.la",
321
- "xn--qxa6a": "whois.eu",
322
- "xn--rvc1e0am3e": "whois.registry.in",
323
- "xn--s9brj9c": "whois.registry.in",
324
- "xn--wgbh1c": "whois.dotmasr.eg",
325
- "xn--wgbl6a": "whois.registry.qa",
326
- "xn--xkc2al3hye2a": "whois.nic.lk",
327
- "xn--xkc2dl3a5ee0h": "whois.registry.in",
328
- "xn--y9a3aq": "whois.amnic.net",
329
- "xn--yfro4i67o": "whois.sgnic.sg",
330
- "xn--ygbi2ammx": "whois.pnina.ps"
331
- };
332
-
333
- // src/index.ts
334
- async function findWhoIsServer(tld) {
335
- const chkURL = IANA_CHK_URL + tld;
336
- try {
337
- const res = await fetch(chkURL);
338
- if (res.ok) {
339
- const body = await res.text();
340
- const server = body.match(/whois:\s+(.*)\s+/);
341
- if (server?.[1])
342
- return server[1];
343
- }
344
- } catch (err) {
345
- console.error("Error in getting WhoIs server data from IANA", err);
346
- }
347
- return "";
348
- }
349
- function shallowCopy(obj) {
350
- if (Array.isArray(obj)) {
351
- return obj.slice();
352
- }
353
- if (typeof obj === "object" && obj !== null) {
354
- const copy = {};
355
- for (const key in obj) {
356
- if (Object.prototype.hasOwnProperty.call(obj, key))
357
- copy[key] = shallowCopy(obj[key]);
358
- }
359
- return copy;
360
- }
361
- return obj;
362
- }
363
- function getWhoIsServer(tld) {
364
- return servers_default[tld];
365
- }
366
- function getTLD(domain) {
367
- let tld = null;
368
- let domainStr = domain;
369
- while (true) {
370
- const domainData2 = domainStr.split(".");
371
- if (domainData2.length < 2)
372
- break;
373
- const tldCheck = domainData2.slice(1).join(".");
374
- const server = servers_default[tldCheck];
375
- if (server) {
376
- tld = tldCheck;
377
- break;
378
- }
379
- domainStr = tldCheck;
380
- }
381
- if (tld)
382
- return tld;
383
- console.debug("TLD is not found in server list. Returning last element after split as TLD!");
384
- const domainData = domain.split(".");
385
- return domainData[domainData.length - 1];
386
- }
387
- function getParameters(server) {
388
- return parameters_default[server];
389
- }
390
- async function tcpWhois(domain, queryOptions, server, port, encoding, proxy) {
391
- const decoder = new TextDecoder(encoding);
392
- const encoder = new TextEncoder;
393
- if (!proxy) {
394
- const socket = new Net.Socket;
395
- return new Promise((resolve, reject) => {
396
- try {
397
- socket.connect({ port, host: server }, () => {
398
- if (queryOptions !== "")
399
- socket.write(encoder.encode(`${queryOptions} ${domain}\r\n`));
400
- else
401
- socket.write(encoder.encode(`${domain}\r\n`));
402
- });
403
- socket.on("data", (data) => {
404
- resolve(decoder.decode(data));
405
- });
406
- socket.on("error", (error) => {
407
- reject(error);
408
- });
409
- } catch (e) {
410
- reject(e);
411
- }
412
- });
413
- }
414
- const options = {
415
- proxy: {
416
- host: proxy.ip,
417
- port: proxy.port,
418
- type: proxy.type === 1 /* SOCKS5 */ ? 5 : 4
419
- },
420
- command: "connect",
421
- destination: {
422
- host: server,
423
- port
424
- }
425
- };
426
- if (proxy.username && proxy.password) {
427
- options.proxy.userId = proxy.username;
428
- options.proxy.password = proxy.password;
429
- }
430
- return new Promise((resolve, reject) => {
431
- SocksClient.createConnection(options, (err, info) => {
432
- if (err) {
433
- reject(err);
434
- } else {
435
- if (!info)
436
- reject(new Error("No socket info received!"));
437
- if (queryOptions !== "") {
438
- info?.socket.write(encoder.encode(`${queryOptions} ${domain}\r\n`));
439
- } else {
440
- info?.socket.write(encoder.encode(`${domain}\r\n`));
441
- }
442
- info?.socket.on("data", (data) => {
443
- resolve(decoder.decode(data));
444
- });
445
- info?.socket.resume();
446
- }
447
- });
448
- });
449
- }
450
- async function whois(domain, parse = false, options = null) {
451
- let tld;
452
- let port = 43;
453
- let server = "";
454
- let proxy;
455
- let encoding = "utf-8";
456
- if (!options) {
457
- tld = getTLD(domain);
458
- proxy = null;
459
- } else {
460
- tld = options.tld ? options.tld : getTLD(domain);
461
- encoding = options.encoding ? options.encoding : "utf-8";
462
- proxy = options.proxy ? options.proxy : null;
463
- server = options.server ? options.server : "";
464
- port = options.serverPort ? options.serverPort : 43;
465
- }
466
- if (server === "") {
467
- let serverData = getWhoIsServer(tld);
468
- if (!serverData) {
469
- console.debug(`No WhoIs server found for TLD: ${tld}! Attempting IANA WhoIs database for server!`);
470
- serverData = await findWhoIsServer(tld);
471
- if (!serverData) {
472
- console.debug("WhoIs server could not be found!");
473
- return {
474
- _raw: "",
475
- parsedData: null
476
- };
477
- }
478
- console.debug(`WhoIs sever found for ${tld}: ${server}`);
479
- }
480
- server = serverData;
481
- }
482
- const qOptions = getParameters(server);
483
- const queryOptions = qOptions || "";
484
- try {
485
- const rawData = await tcpWhois(domain, queryOptions, server, port, encoding, proxy);
486
- if (!parse) {
487
- const parsedData = WhoIsParser.parseData(rawData, null);
488
- return {
489
- _raw: rawData,
490
- parsedData
491
- };
492
- }
493
- let outputData = null;
494
- if (options?.parseData)
495
- outputData = shallowCopy(options.parseData);
496
- try {
497
- const parsedData = WhoIsParser.parseData(rawData, outputData);
498
- return {
499
- _raw: rawData,
500
- parsedData
501
- };
502
- } catch (err) {
503
- console.error("Error in parsing WhoIs data!", err);
504
- return {
505
- _raw: rawData,
506
- parsedData: null
507
- };
508
- }
509
- } catch (err) {
510
- return {
511
- _raw: "",
512
- parsedData: null
513
- };
514
- }
515
- }
516
- function lookup(domain, options = null) {
517
- return whois(domain, true, options);
518
- }
519
- async function batchWhois(domains, parallel = false, threads = 1, parse = false, options = null) {
520
- let response = [];
521
- if (parallel) {
522
- if (threads > domains.length)
523
- threads = domains.length;
524
- for (let i = 0;i < domains.length; i += threads) {
525
- const batch = domains.slice(i, i + threads);
526
- response = await Promise.all(batch.map(async (domain) => {
527
- return await whois(domain, parse, options);
528
- }));
529
- }
530
- } else {
531
- for (let i = 0;i < domains.length; i++) {
532
- const res = await whois(domains[i], parse, options);
533
- response.push(res);
534
- }
535
- }
536
- return response;
537
- }
538
- var IANA_CHK_URL = "https://www.iana.org/whois?q=";
539
- var ProxyType;
540
- ((ProxyType2) => {
541
- ProxyType2[ProxyType2["SOCKS4"] = 0] = "SOCKS4";
542
- ProxyType2[ProxyType2["SOCKS5"] = 1] = "SOCKS5";
543
- })(ProxyType ||= {});
544
-
545
- class WhoIsParser {
546
- static iterParse(rawData, outputData) {
547
- let lastStr = "";
548
- let lastField = null;
549
- let lastLetter = "";
550
- for (let i = 0;i < rawData.length; i++) {
551
- const letter = rawData[i];
552
- if (letter === "\n" || lastLetter === ":" && letter === " ") {
553
- if (lastStr.trim() in outputData) {
554
- lastField = lastStr.trim();
555
- } else if (lastField !== null) {
556
- const x = lastStr.trim();
557
- if (x !== "") {
558
- const obj = outputData[lastField];
559
- if (Array.isArray(obj))
560
- obj.push(x);
561
- else
562
- outputData[lastField] = x;
563
- lastField = null;
564
- }
565
- }
566
- lastStr = "";
567
- } else if (letter !== ":") {
568
- lastStr = lastStr + letter;
569
- }
570
- lastLetter = letter;
571
- if (lastStr === "Record maintained by" || lastStr === ">>>")
572
- break;
573
- }
574
- return outputData;
575
- }
576
- static parseData(rawData, outputData) {
577
- if (!outputData) {
578
- outputData = {
579
- "Domain Name": "",
580
- "Creation Date": "",
581
- "Updated Date": "",
582
- "Registry Expiry Date": "",
583
- "Domain Status": [],
584
- Registrar: ""
585
- };
586
- }
587
- outputData = WhoIsParser.iterParse(rawData, outputData);
588
- return outputData;
589
- }
590
- }
591
- export {
592
- whois,
593
- tcpWhois,
594
- lookup,
595
- batchWhois,
596
- WhoIsParser,
597
- ProxyType
598
- };
599
-
600
- //# debugId=9DF3DD8E9D6845DB64756E2164756E21
4
+ //# debugId=948E637C85E686ED64756E2164756E21
601
5
  //# sourceMappingURL=index.js.map