use-mmdb-vanilla 1.0.1 → 1.0.2
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/README.md +6 -219
- package/dist/index.cjs.js +3 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +66 -63
- package/dist/index.es.js.map +1 -1
- package/dist/index.iife.js +3 -3
- package/dist/index.iife.js.map +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -1,226 +1,13 @@
|
|
|
1
|
-
#
|
|
1
|
+
# use-mmdb-vanilla
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
a simple lib, show ip geo, using mmdb file
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
> Looking for a JavaScript version of this template? Try: [Vite JavaScript NPM Package](https://github.com/jasonsturges/vite-npm-package)
|
|
5
|
+
[](https://www.npmjs.com/package/use-mmdb-vanilla)
|
|
7
6
|
|
|
7
|
+
https://www.npmjs.com/package/use-mmdb-vanilla
|
|
8
8
|
|
|
9
|
-
## Getting Started
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
- Press the "*Use this template*" button
|
|
14
|
-
|
|
15
|
-
- Use [GitHub CLI](https://cli.github.com/) to execute:
|
|
16
|
-
|
|
17
|
-
```
|
|
18
|
-
gh repo create <name> --template="https://github.com/jasonsturges/vite-typescript-npm-package"
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
- Simply `git clone`, delete the existing .git folder, and initialize a fresh repo:
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
git clone https://github.com/jasonsturges/vite-typescript-npm-package.git
|
|
25
|
-
cd vite-typescript-npm-package
|
|
26
|
-
rm -rf .git
|
|
27
|
-
git init
|
|
28
|
-
git add -A
|
|
29
|
-
git commit -m "Initial commit"
|
|
30
|
-
````
|
|
31
|
-
|
|
32
|
-
There is no package lock included so that you may chose either `npm` or `yarn`.
|
|
33
|
-
|
|
34
|
-
Remember to use `npm search <term>` to avoid naming conflicts in the NPM Registery for your new package name.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
## Usage
|
|
38
|
-
|
|
39
|
-
The following tasks are available:
|
|
40
|
-
|
|
41
|
-
- `dev`: Run Vite in watch mode to detect changes - all modules are compiled to the `dist/` folder, as well as rollup of all types to a d.ts declaration file
|
|
42
|
-
- `start`: Run Vite in host mode to work in a local development environment within this package - vite hosts the `index.html` with real time HMR updates
|
|
43
|
-
- `build`: Run Vite to build a production release distributable
|
|
44
|
-
- `build:types`: Run DTS Generator to build d.ts type declarations only
|
|
45
|
-
|
|
46
|
-
Rollup all your exports to the top-level index.ts for inclusion into the build distributable.
|
|
47
|
-
|
|
48
|
-
For example, if you have a `utils/` folder that contains an `arrayUtils.ts` file.
|
|
49
|
-
|
|
50
|
-
/src/utils/arrayUtils.ts:
|
|
51
|
-
```ts
|
|
52
|
-
export const distinct = <T>(array: T[] = []) => [...new Set(array)];
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
Include that export in the top-level `index.ts` .
|
|
56
|
-
|
|
57
|
-
/src/index.ts:
|
|
58
|
-
```ts
|
|
59
|
-
// Main library exports - these are packaged in your distributable
|
|
60
|
-
export { distinct } from "./utils/arrayUtils"
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
## Development
|
|
65
|
-
|
|
66
|
-
There are multiple strategies for development, either working directly from the library or from a linked project.
|
|
67
|
-
|
|
68
|
-
### Local Development
|
|
69
|
-
|
|
70
|
-
Vite features a host mode for development with real time HMR updates directly from the library via the `start` script. This enables rapid development within the library instead of linking from other projects.
|
|
71
|
-
|
|
72
|
-
Using the `start` task, Vite hosts the `index.html` for a local development environment. This file is not included in the production build. Note that only exports specified from the `index.ts` are ultimately bundled into the library.
|
|
73
|
-
|
|
74
|
-
As an example, this template includes a React app, which could be replaced with a different framework such as Vue, Solid.js, Svelte, etc...
|
|
75
|
-
|
|
76
|
-
For UI projects, you may want to consider adding tools such as [Storybook](https://storybook.js.org/) to isolate UI component development by running a `storybook` script from this package.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
### Project Development
|
|
80
|
-
|
|
81
|
-
To use this library with other app projects before submitting to a registry such as NPM, run the `dev` script and link packages.
|
|
82
|
-
|
|
83
|
-
Using the `dev` task, Vite detects changes and compiles all modules to the `dist/` folder, as well as rollup of all types to a d.ts declaration file.
|
|
84
|
-
|
|
85
|
-
To test your library from within an app:
|
|
86
|
-
|
|
87
|
-
- **From this library**: run `npm link` or `yarn link` command to register the package
|
|
88
|
-
- **From your app**: run `npm link "mylib"` or `yarn link "mylib"` command to use the library inside your app during development
|
|
89
|
-
|
|
90
|
-
Inside your app's `node_modules/` folder, a symlink is created to the library.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
## Development Cleanup
|
|
94
|
-
|
|
95
|
-
Once development completes, `unlink` both your library and test app projects.
|
|
96
|
-
|
|
97
|
-
- **From your app**: run `npm unlink "mylib"` or `yarn unlink "mylib"` command to remove the library symlink
|
|
98
|
-
- **From your library**: run `npm unlink` or `yarn unlink` command to unregister the package
|
|
99
|
-
|
|
100
|
-
If you mistakenly forget to `unlink`, you can manually clean up artifacts from `yarn` or `npm`.
|
|
101
|
-
|
|
102
|
-
For `yarn`, the `link` command creates symlinks which can be deleted from your home directory:
|
|
103
|
-
```
|
|
104
|
-
~/.config/yarn/link
|
|
10
|
+
## browser version
|
|
105
11
|
```
|
|
106
|
-
|
|
107
|
-
For `npm`, the `link` command creates global packages which can be removed by executing:
|
|
108
|
-
```bash
|
|
109
|
-
sudo npm rm --global "mylib"
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
Confirm your npm global packages with the command:
|
|
113
|
-
```bash
|
|
114
|
-
npm ls --global --depth 0
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
For your app, simply reinstall dependencies to clear any forgotten linked packages. This will remove any symlinks in the `node_modules/` folder.
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
## Release Publishing
|
|
121
|
-
|
|
122
|
-
Update your `package.json` to the next version number and tag a release.
|
|
123
|
-
|
|
124
|
-
Assure that your package lockfile is also updated by running an install. For npm, this will assure the lockfile has the updated version number. Yarn does not duplicate the version number in the lockfile.
|
|
125
|
-
|
|
126
|
-
If you are publishing to a private registry such as GitHub packages, update your `package.json` to include `publishConfig` and `repository`:
|
|
127
|
-
|
|
128
|
-
package.json:
|
|
129
|
-
```json
|
|
130
|
-
"publishConfig": {
|
|
131
|
-
"registry": "https://npm.pkg.github.com/@MyOrg"
|
|
132
|
-
},
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
Unless you are using a continuous integration service such as GitHub Actions, assure that your `dist/` folder is cleanly build. Note that `npm publish` will ship anything inside the distributable folder.
|
|
136
|
-
|
|
137
|
-
For clean builds, you may want to install the `rimraf` package and add a `clean` or `prebuild` script to your `package.json` to remove any artifacts from your `dist/` folder. Or, manually delete the `dist/` folder yourself.
|
|
138
|
-
|
|
139
|
-
package.json:
|
|
140
|
-
```json
|
|
141
|
-
"scripts": {
|
|
142
|
-
"clean": "rimraf dist"
|
|
143
|
-
}
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
Before you submit for the first time, make sure your package name is available by using `npm search`. If npm rejects your package name, update your `package.json` and resubmit.
|
|
147
|
-
|
|
148
|
-
```bash
|
|
149
|
-
npm search <term>
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
Once ready to submit your package to the NPM Registry, execute the following tasks via `npm` (or `yarn`):
|
|
153
|
-
|
|
154
|
-
```bash
|
|
155
|
-
npm run build
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
Assure the proper npm login:
|
|
159
|
-
|
|
160
|
-
```bash
|
|
161
|
-
npm login
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
Submit your package to the registry:
|
|
165
|
-
|
|
166
|
-
```bash
|
|
167
|
-
npm publish --access public
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
## Continuous Integration
|
|
171
|
-
|
|
172
|
-
For continuous integration with GitHub Actions, create a `.github/workflows/publish.yml`:
|
|
173
|
-
|
|
174
|
-
```yml
|
|
175
|
-
name: Publish Package to npmjs
|
|
176
|
-
on:
|
|
177
|
-
release:
|
|
178
|
-
types: [created]
|
|
179
|
-
|
|
180
|
-
jobs:
|
|
181
|
-
build:
|
|
182
|
-
runs-on: ubuntu-latest
|
|
183
|
-
permissions:
|
|
184
|
-
contents: read
|
|
185
|
-
packages: write
|
|
186
|
-
steps:
|
|
187
|
-
- uses: actions/checkout@v4
|
|
188
|
-
- uses: actions/setup-node@v4
|
|
189
|
-
with:
|
|
190
|
-
node-version: '20'
|
|
191
|
-
registry-url: 'https://registry.npmjs.org'
|
|
192
|
-
- run: npm ci
|
|
193
|
-
- run: npm run build
|
|
194
|
-
- run: npm publish
|
|
195
|
-
env:
|
|
196
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
This will deploy your build artifact when a release is tagged.
|
|
200
|
-
|
|
201
|
-
Obtain an "Automation" CI/CD access token to bypass 2FA from [npm](https://www.npmjs.com/) by selecting your profile image in the upper right, and chosing "Access Tokens".
|
|
202
|
-
|
|
203
|
-
To add secrets to your repository:
|
|
204
|
-
- From your repository, select _Settings_
|
|
205
|
-
- From the _Security_ section of the sidebar, expand _Secrets and variables_ and select _Actions_
|
|
206
|
-
- From the _Secrets_ tab, press _New repository secret_ to add the `NPM_TOKEN` key
|
|
207
|
-
|
|
208
|
-
To add secrets to your organization:
|
|
209
|
-
- From your organization, select _Settings_
|
|
210
|
-
- From the _Security_ section of the sidebar, expand _Secrets and variables_ and select _Actions_
|
|
211
|
-
- From the _Secrets_ tab, press _New organization secret_ to add the `NPM_TOKEN` key
|
|
212
|
-
|
|
213
|
-
Assure either a `.npmrc` or `publishConfig` in your `package.json`:
|
|
214
|
-
|
|
215
|
-
package.json:
|
|
216
|
-
```json
|
|
217
|
-
"publishConfig": {
|
|
218
|
-
"access": "public",
|
|
219
|
-
"registry": "https://registry.npmjs.org/",
|
|
220
|
-
"scope": "username"
|
|
221
|
-
},
|
|
12
|
+
https://cdn.jsdelivr.net/npm/use-mmdb-vanilla/dist/index.umd.js
|
|
222
13
|
```
|
|
223
|
-
|
|
224
|
-
For more information, see:
|
|
225
|
-
- [Using secrets in GitHub Actions](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions)
|
|
226
|
-
- [Publish to npmjs and GPR with npm](https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#publish-to-npmjs-and-gpr-with-npm)
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";var L=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ft={},q={},Q={};Q.byteLength=
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var L=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ft={},q={},Q={};Q.byteLength=Xt;Q.toByteArray=Zt;Q.fromByteArray=vt;var k=[],P=[],qt=typeof Uint8Array<"u"?Uint8Array:Array,it="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var V=0,Ht=it.length;V<Ht;++V)k[V]=it[V],P[it.charCodeAt(V)]=V;P[45]=62;P[95]=63;function At(u){var o=u.length;if(o%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var s=u.indexOf("=");s===-1&&(s=o);var f=s===o?0:4-s%4;return[s,f]}function Xt(u){var o=At(u),s=o[0],f=o[1];return(s+f)*3/4-f}function Jt(u,o,s){return(o+s)*3/4-s}function Zt(u){var o,s=At(u),f=s[0],l=s[1],d=new qt(Jt(u,f,l)),p=0,c=l>0?f-4:f,x;for(x=0;x<c;x+=4)o=P[u.charCodeAt(x)]<<18|P[u.charCodeAt(x+1)]<<12|P[u.charCodeAt(x+2)]<<6|P[u.charCodeAt(x+3)],d[p++]=o>>16&255,d[p++]=o>>8&255,d[p++]=o&255;return l===2&&(o=P[u.charCodeAt(x)]<<2|P[u.charCodeAt(x+1)]>>4,d[p++]=o&255),l===1&&(o=P[u.charCodeAt(x)]<<10|P[u.charCodeAt(x+1)]<<4|P[u.charCodeAt(x+2)]>>2,d[p++]=o>>8&255,d[p++]=o&255),d}function Kt(u){return k[u>>18&63]+k[u>>12&63]+k[u>>6&63]+k[u&63]}function Qt(u,o,s){for(var f,l=[],d=o;d<s;d+=3)f=(u[d]<<16&16711680)+(u[d+1]<<8&65280)+(u[d+2]&255),l.push(Kt(f));return l.join("")}function vt(u){for(var o,s=u.length,f=s%3,l=[],d=16383,p=0,c=s-f;p<c;p+=d)l.push(Qt(u,p,p+d>c?c:p+d));return f===1?(o=u[s-1],l.push(k[o>>2]+k[o<<4&63]+"==")):f===2&&(o=(u[s-2]<<8)+u[s-1],l.push(k[o>>10]+k[o>>4&63]+k[o<<2&63]+"=")),l.join("")}var ct={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ct.read=function(u,o,s,f,l){var d,p,c=l*8-f-1,x=(1<<c)-1,m=x>>1,E=-7,g=s?l-1:0,w=s?-1:1,y=u[o+g];for(g+=w,d=y&(1<<-E)-1,y>>=-E,E+=c;E>0;d=d*256+u[o+g],g+=w,E-=8);for(p=d&(1<<-E)-1,d>>=-E,E+=f;E>0;p=p*256+u[o+g],g+=w,E-=8);if(d===0)d=1-m;else{if(d===x)return p?NaN:(y?-1:1)*(1/0);p=p+Math.pow(2,f),d=d-m}return(y?-1:1)*p*Math.pow(2,d-f)};ct.write=function(u,o,s,f,l,d){var p,c,x,m=d*8-l-1,E=(1<<m)-1,g=E>>1,w=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=f?0:d-1,_=f?1:-1,S=o<0||o===0&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(c=isNaN(o)?1:0,p=E):(p=Math.floor(Math.log(o)/Math.LN2),o*(x=Math.pow(2,-p))<1&&(p--,x*=2),p+g>=1?o+=w/x:o+=w*Math.pow(2,1-g),o*x>=2&&(p++,x/=2),p+g>=E?(c=0,p=E):p+g>=1?(c=(o*x-1)*Math.pow(2,l),p=p+g):(c=o*Math.pow(2,g-1)*Math.pow(2,l),p=0));l>=8;u[s+y]=c&255,y+=_,c/=256,l-=8);for(p=p<<l|c,m+=l;m>0;u[s+y]=p&255,y+=_,p/=256,m-=8);u[s+y-_]|=S*128};/*!
|
|
2
2
|
* The buffer module from node.js, for the browser.
|
|
3
3
|
*
|
|
4
4
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
5
5
|
* @license MIT
|
|
6
|
-
*/(function(u){const o=Q,s=ct,f=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;u.Buffer=c,u.SlowBuffer=W,u.INSPECT_MAX_BYTES=50;const l=2147483647;u.kMaxLength=l,c.TYPED_ARRAY_SUPPORT=d(),!c.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function d(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}});function p(e){if(e>l)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,r){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return B(e)}return g(e,t,r)}c.poolSize=8192;function g(e,t,r){if(typeof e=="string")return w(e,t);if(ArrayBuffer.isView(e))return _(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(N(e,ArrayBuffer)||e&&N(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(N(e,SharedArrayBuffer)||e&&N(e.buffer,SharedArrayBuffer)))return S(e,t,r);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(n!=null&&n!==e)return c.from(n,t,r);const i=X(e);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return c.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}c.from=function(e,t,r){return g(e,t,r)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array);function m(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function E(e,t,r){return m(e),e<=0?p(e):t!==void 0?typeof r=="string"?p(e).fill(t,r):p(e).fill(t):p(e)}c.alloc=function(e,t,r){return E(e,t,r)};function B(e){return m(e),p(e<0?0:T(e)|0)}c.allocUnsafe=function(e){return B(e)},c.allocUnsafeSlow=function(e){return B(e)};function w(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=O(e,t)|0;let n=p(r);const i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}function y(e){const t=e.length<0?0:T(e.length)|0,r=p(t);for(let n=0;n<t;n+=1)r[n]=e[n]&255;return r}function _(e){if(N(e,Uint8Array)){const t=new Uint8Array(e);return S(t.buffer,t.byteOffset,t.byteLength)}return y(e)}function S(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return t===void 0&&r===void 0?n=new Uint8Array(e):r===void 0?n=new Uint8Array(e,t):n=new Uint8Array(e,t,r),Object.setPrototypeOf(n,c.prototype),n}function X(e){if(c.isBuffer(e)){const t=T(e.length)|0,r=p(t);return r.length===0||e.copy(r,0,0,t),r}if(e.length!==void 0)return typeof e.length!="number"||nt(e.length)?p(0):y(e);if(e.type==="Buffer"&&Array.isArray(e.data))return y(e.data)}function T(e){if(e>=l)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+l.toString(16)+" bytes");return e|0}function W(e){return+e!=e&&(e=0),c.alloc(+e)}c.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==c.prototype},c.compare=function(t,r){if(N(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),N(r,Uint8Array)&&(r=c.from(r,r.offset,r.byteLength)),!c.isBuffer(t)||!c.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;let n=t.length,i=r.length;for(let a=0,h=Math.min(n,i);a<h;++a)if(t[a]!==r[a]){n=t[a],i=r[a];break}return n<i?-1:i<n?1:0},c.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return c.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<t.length;++n)r+=t[n].length;const i=c.allocUnsafe(r);let a=0;for(n=0;n<t.length;++n){let h=t[n];if(N(h,Uint8Array))a+h.length>i.length?(c.isBuffer(h)||(h=c.from(h)),h.copy(i,a)):Uint8Array.prototype.set.call(i,h,a);else if(c.isBuffer(h))h.copy(i,a);else throw new TypeError('"list" argument must be an Array of Buffers');a+=h.length}return i};function O(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||N(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return et(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return mt(e).length;default:if(i)return n?-1:et(e).length;t=(""+t).toLowerCase(),i=!0}}c.byteLength=O;function _t(e,t,r){let n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return kt(this,t,r);case"utf8":case"utf-8":return lt(this,t,r);case"ascii":return Tt(this,t,r);case"latin1":case"binary":return Nt(this,t,r);case"base64":return Pt(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ot(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}c.prototype._isBuffer=!0;function D(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}c.prototype.swap16=function(){const t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<t;r+=2)D(this,r,r+1);return this},c.prototype.swap32=function(){const t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<t;r+=4)D(this,r,r+3),D(this,r+1,r+2);return this},c.prototype.swap64=function(){const t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<t;r+=8)D(this,r,r+7),D(this,r+1,r+6),D(this,r+2,r+5),D(this,r+3,r+4);return this},c.prototype.toString=function(){const t=this.length;return t===0?"":arguments.length===0?lt(this,0,t):_t.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(t){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:c.compare(this,t)===0},c.prototype.inspect=function(){let t="";const r=u.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},f&&(c.prototype[f]=c.prototype.inspect),c.prototype.compare=function(t,r,n,i,a){if(N(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(r===void 0&&(r=0),n===void 0&&(n=t?t.length:0),i===void 0&&(i=0),a===void 0&&(a=this.length),r<0||n>t.length||i<0||a>this.length)throw new RangeError("out of range index");if(i>=a&&r>=n)return 0;if(i>=a)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,a>>>=0,this===t)return 0;let h=a-i,x=n-r;const A=Math.min(h,x),F=this.slice(i,a),U=t.slice(r,n);for(let I=0;I<A;++I)if(F[I]!==U[I]){h=F[I],x=U[I];break}return h<x?-1:x<h?1:0};function ht(e,t,r,n,i){if(e.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,nt(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof t=="string"&&(t=c.from(t,n)),c.isBuffer(t))return t.length===0?-1:ft(e,t,r,n,i);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):ft(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function ft(e,t,r,n,i){let a=1,h=e.length,x=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(e.length<2||t.length<2)return-1;a=2,h/=2,x/=2,r/=2}function A(U,I){return a===1?U[I]:U.readUInt16BE(I*a)}let F;if(i){let U=-1;for(F=r;F<h;F++)if(A(e,F)===A(t,U===-1?0:F-U)){if(U===-1&&(U=F),F-U+1===x)return U*a}else U!==-1&&(F-=F-U),U=-1}else for(r+x>h&&(r=h-x),F=r;F>=0;F--){let U=!0;for(let I=0;I<x;I++)if(A(e,F+I)!==A(t,I)){U=!1;break}if(U)return F}return-1}c.prototype.includes=function(t,r,n){return this.indexOf(t,r,n)!==-1},c.prototype.indexOf=function(t,r,n){return ht(this,t,r,n,!0)},c.prototype.lastIndexOf=function(t,r,n){return ht(this,t,r,n,!1)};function bt(e,t,r,n){r=Number(r)||0;const i=e.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;const a=t.length;n>a/2&&(n=a/2);let h;for(h=0;h<n;++h){const x=parseInt(t.substr(h*2,2),16);if(nt(x))return h;e[r+h]=x}return h}function Rt(e,t,r,n){return J(et(t,e.length-r),e,r,n)}function St(e,t,r,n){return J(Gt(t),e,r,n)}function Ct(e,t,r,n){return J(mt(t),e,r,n)}function Mt(e,t,r,n){return J(zt(t,e.length-r),e,r,n)}c.prototype.write=function(t,r,n,i){if(r===void 0)i="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")i=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const a=this.length-r;if((n===void 0||n>a)&&(n=a),t.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let h=!1;for(;;)switch(i){case"hex":return bt(this,t,r,n);case"utf8":case"utf-8":return Rt(this,t,r,n);case"ascii":case"latin1":case"binary":return St(this,t,r,n);case"base64":return Ct(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Mt(this,t,r,n);default:if(h)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),h=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Pt(e,t,r){return t===0&&r===e.length?o.fromByteArray(e):o.fromByteArray(e.slice(t,r))}function lt(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i<r;){const a=e[i];let h=null,x=a>239?4:a>223?3:a>191?2:1;if(i+x<=r){let A,F,U,I;switch(x){case 1:a<128&&(h=a);break;case 2:A=e[i+1],(A&192)===128&&(I=(a&31)<<6|A&63,I>127&&(h=I));break;case 3:A=e[i+1],F=e[i+2],(A&192)===128&&(F&192)===128&&(I=(a&15)<<12|(A&63)<<6|F&63,I>2047&&(I<55296||I>57343)&&(h=I));break;case 4:A=e[i+1],F=e[i+2],U=e[i+3],(A&192)===128&&(F&192)===128&&(U&192)===128&&(I=(a&15)<<18|(A&63)<<12|(F&63)<<6|U&63,I>65535&&I<1114112&&(h=I))}}h===null?(h=65533,x=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|h&1023),n.push(h),i+=x}return Lt(n)}const dt=4096;function Lt(e){const t=e.length;if(t<=dt)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=dt));return r}function Tt(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]&127);return n}function Nt(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function kt(e,t,r){const n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let a=t;a<r;++a)i+=Vt[e[a]];return i}function Ot(e,t,r){const n=e.slice(t,r);let i="";for(let a=0;a<n.length-1;a+=2)i+=String.fromCharCode(n[a]+n[a+1]*256);return i}c.prototype.slice=function(t,r){const n=this.length;t=~~t,r=r===void 0?n:~~r,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<t&&(r=t);const i=this.subarray(t,r);return Object.setPrototypeOf(i,c.prototype),i};function b(e,t,r){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}c.prototype.readUintLE=c.prototype.readUIntLE=function(t,r,n){t=t>>>0,r=r>>>0,n||b(t,r,this.length);let i=this[t],a=1,h=0;for(;++h<r&&(a*=256);)i+=this[t+h]*a;return i},c.prototype.readUintBE=c.prototype.readUIntBE=function(t,r,n){t=t>>>0,r=r>>>0,n||b(t,r,this.length);let i=this[t+--r],a=1;for(;r>0&&(a*=256);)i+=this[t+--r]*a;return i},c.prototype.readUint8=c.prototype.readUInt8=function(t,r){return t=t>>>0,r||b(t,1,this.length),this[t]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||b(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||b(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||b(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||b(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readBigUInt64LE=$(function(t){t=t>>>0,z(t,"offset");const r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Y(t,this.length-8);const i=r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,a=this[++t]+this[++t]*2**8+this[++t]*2**16+n*2**24;return BigInt(i)+(BigInt(a)<<BigInt(32))}),c.prototype.readBigUInt64BE=$(function(t){t=t>>>0,z(t,"offset");const r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Y(t,this.length-8);const i=r*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],a=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n;return(BigInt(i)<<BigInt(32))+BigInt(a)}),c.prototype.readIntLE=function(t,r,n){t=t>>>0,r=r>>>0,n||b(t,r,this.length);let i=this[t],a=1,h=0;for(;++h<r&&(a*=256);)i+=this[t+h]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*r)),i},c.prototype.readIntBE=function(t,r,n){t=t>>>0,r=r>>>0,n||b(t,r,this.length);let i=r,a=1,h=this[t+--i];for(;i>0&&(a*=256);)h+=this[t+--i]*a;return a*=128,h>=a&&(h-=Math.pow(2,8*r)),h},c.prototype.readInt8=function(t,r){return t=t>>>0,r||b(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]},c.prototype.readInt16LE=function(t,r){t=t>>>0,r||b(t,2,this.length);const n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n},c.prototype.readInt16BE=function(t,r){t=t>>>0,r||b(t,2,this.length);const n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n},c.prototype.readInt32LE=function(t,r){return t=t>>>0,r||b(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,r){return t=t>>>0,r||b(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readBigInt64LE=$(function(t){t=t>>>0,z(t,"offset");const r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Y(t,this.length-8);const i=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)}),c.prototype.readBigInt64BE=$(function(t){t=t>>>0,z(t,"offset");const r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Y(t,this.length-8);const i=(r<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(i)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n)}),c.prototype.readFloatLE=function(t,r){return t=t>>>0,r||b(t,4,this.length),s.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,r){return t=t>>>0,r||b(t,4,this.length),s.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||b(t,8,this.length),s.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||b(t,8,this.length),s.read(this,t,!1,52,8)};function M(e,t,r,n,i,a){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}c.prototype.writeUintLE=c.prototype.writeUIntLE=function(t,r,n,i){if(t=+t,r=r>>>0,n=n>>>0,!i){const x=Math.pow(2,8*n)-1;M(this,t,r,n,x,0)}let a=1,h=0;for(this[r]=t&255;++h<n&&(a*=256);)this[r+h]=t/a&255;return r+n},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(t,r,n,i){if(t=+t,r=r>>>0,n=n>>>0,!i){const x=Math.pow(2,8*n)-1;M(this,t,r,n,x,0)}let a=n-1,h=1;for(this[r+a]=t&255;--a>=0&&(h*=256);)this[r+a]=t/h&255;return r+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(t,r,n){return t=+t,r=r>>>0,n||M(this,t,r,1,255,0),this[r]=t&255,r+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||M(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||M(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||M(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||M(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function pt(e,t,r,n,i){Et(t,n,i,e,r,7);let a=Number(t&BigInt(4294967295));e[r++]=a,a=a>>8,e[r++]=a,a=a>>8,e[r++]=a,a=a>>8,e[r++]=a;let h=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=h,h=h>>8,e[r++]=h,h=h>>8,e[r++]=h,h=h>>8,e[r++]=h,r}function wt(e,t,r,n,i){Et(t,n,i,e,r,7);let a=Number(t&BigInt(4294967295));e[r+7]=a,a=a>>8,e[r+6]=a,a=a>>8,e[r+5]=a,a=a>>8,e[r+4]=a;let h=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=h,h=h>>8,e[r+2]=h,h=h>>8,e[r+1]=h,h=h>>8,e[r]=h,r+8}c.prototype.writeBigUInt64LE=$(function(t,r=0){return pt(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=$(function(t,r=0){return wt(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(t,r,n,i){if(t=+t,r=r>>>0,!i){const A=Math.pow(2,8*n-1);M(this,t,r,n,A-1,-A)}let a=0,h=1,x=0;for(this[r]=t&255;++a<n&&(h*=256);)t<0&&x===0&&this[r+a-1]!==0&&(x=1),this[r+a]=(t/h>>0)-x&255;return r+n},c.prototype.writeIntBE=function(t,r,n,i){if(t=+t,r=r>>>0,!i){const A=Math.pow(2,8*n-1);M(this,t,r,n,A-1,-A)}let a=n-1,h=1,x=0;for(this[r+a]=t&255;--a>=0&&(h*=256);)t<0&&x===0&&this[r+a+1]!==0&&(x=1),this[r+a]=(t/h>>0)-x&255;return r+n},c.prototype.writeInt8=function(t,r,n){return t=+t,r=r>>>0,n||M(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1},c.prototype.writeInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||M(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2},c.prototype.writeInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||M(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2},c.prototype.writeInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||M(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4},c.prototype.writeInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||M(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4},c.prototype.writeBigInt64LE=$(function(t,r=0){return pt(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=$(function(t,r=0){return wt(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function yt(e,t,r,n,i,a){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Bt(e,t,r,n,i){return t=+t,r=r>>>0,i||yt(e,t,r,4),s.write(e,t,r,n,23,4),r+4}c.prototype.writeFloatLE=function(t,r,n){return Bt(this,t,r,!0,n)},c.prototype.writeFloatBE=function(t,r,n){return Bt(this,t,r,!1,n)};function xt(e,t,r,n,i){return t=+t,r=r>>>0,i||yt(e,t,r,8),s.write(e,t,r,n,52,8),r+8}c.prototype.writeDoubleLE=function(t,r,n){return xt(this,t,r,!0,n)},c.prototype.writeDoubleBE=function(t,r,n){return xt(this,t,r,!1,n)},c.prototype.copy=function(t,r,n,i){if(!c.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i<n&&(i=n),i===n||t.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r<i-n&&(i=t.length-r+n);const a=i-n;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,i):Uint8Array.prototype.set.call(t,this.subarray(n,i),r),a},c.prototype.fill=function(t,r,n,i){if(typeof t=="string"){if(typeof r=="string"?(i=r,r=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!c.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(t.length===1){const h=t.charCodeAt(0);(i==="utf8"&&h<128||i==="latin1")&&(t=h)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);let a;if(typeof t=="number")for(a=r;a<n;++a)this[a]=t;else{const h=c.isBuffer(t)?t:c.from(t,i),x=h.length;if(x===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(a=0;a<n-r;++a)this[a+r]=h[a%x]}return this};const G={};function rt(e,t,r){G[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}rt("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),rt("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),rt("ERR_OUT_OF_RANGE",function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=gt(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=gt(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n},RangeError);function gt(e){let t="",r=e.length;const n=e[0]==="-"?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function $t(e,t,r){z(t,"offset"),(e[t]===void 0||e[t+r]===void 0)&&Y(t,e.length-(r+1))}function Et(e,t,r,n,i,a){if(e>r||e<t){const h=typeof t=="bigint"?"n":"";let x;throw a>3?t===0||t===BigInt(0)?x=`>= 0${h} and < 2${h} ** ${(a+1)*8}${h}`:x=`>= -(2${h} ** ${(a+1)*8-1}${h}) and < 2 ** ${(a+1)*8-1}${h}`:x=`>= ${t}${h} and <= ${r}${h}`,new G.ERR_OUT_OF_RANGE("value",x,e)}$t(n,i,a)}function z(e,t){if(typeof e!="number")throw new G.ERR_INVALID_ARG_TYPE(t,"number",e)}function Y(e,t,r){throw Math.floor(e)!==e?(z(e,r),new G.ERR_OUT_OF_RANGE(r||"offset","an integer",e)):t<0?new G.ERR_BUFFER_OUT_OF_BOUNDS:new G.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}const Dt=/[^+/0-9A-Za-z-_]/g;function jt(e){if(e=e.split("=")[0],e=e.trim().replace(Dt,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function et(e,t){t=t||1/0;let r;const n=e.length;let i=null;const a=[];for(let h=0;h<n;++h){if(r=e.charCodeAt(h),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(h+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return a}function Gt(e){const t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r)&255);return t}function zt(e,t){let r,n,i;const a=[];for(let h=0;h<e.length&&!((t-=2)<0);++h)r=e.charCodeAt(h),n=r>>8,i=r%256,a.push(i),a.push(n);return a}function mt(e){return o.toByteArray(jt(e))}function J(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function N(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function nt(e){return e!==e}const Vt=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=r*16;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function $(e){return typeof BigInt>"u"?Wt:e}function Wt(){throw new Error("BigInt not supported")}})(q);var v={},H={};Object.defineProperty(H,"__esModule",{value:!0});const vt=(u,o)=>u<<8|o,tr=(u,o,s)=>u<<16|o<<8|s,rr=(u,o,s,f)=>u<<24|o<<16|s<<8|f,er=`Maxmind v2 module has changed API.
|
|
6
|
+
*/(function(u){const o=Q,s=ct,f=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;u.Buffer=c,u.SlowBuffer=W,u.INSPECT_MAX_BYTES=50;const l=2147483647;u.kMaxLength=l,c.TYPED_ARRAY_SUPPORT=d(),!c.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function d(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}});function p(e){if(e>l)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,r){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return g(e)}return x(e,t,r)}c.poolSize=8192;function x(e,t,r){if(typeof e=="string")return w(e,t);if(ArrayBuffer.isView(e))return _(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(N(e,ArrayBuffer)||e&&N(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(N(e,SharedArrayBuffer)||e&&N(e.buffer,SharedArrayBuffer)))return S(e,t,r);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(n!=null&&n!==e)return c.from(n,t,r);const i=X(e);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return c.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}c.from=function(e,t,r){return x(e,t,r)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array);function m(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function E(e,t,r){return m(e),e<=0?p(e):t!==void 0?typeof r=="string"?p(e).fill(t,r):p(e).fill(t):p(e)}c.alloc=function(e,t,r){return E(e,t,r)};function g(e){return m(e),p(e<0?0:T(e)|0)}c.allocUnsafe=function(e){return g(e)},c.allocUnsafeSlow=function(e){return g(e)};function w(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=O(e,t)|0;let n=p(r);const i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}function y(e){const t=e.length<0?0:T(e.length)|0,r=p(t);for(let n=0;n<t;n+=1)r[n]=e[n]&255;return r}function _(e){if(N(e,Uint8Array)){const t=new Uint8Array(e);return S(t.buffer,t.byteOffset,t.byteLength)}return y(e)}function S(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return t===void 0&&r===void 0?n=new Uint8Array(e):r===void 0?n=new Uint8Array(e,t):n=new Uint8Array(e,t,r),Object.setPrototypeOf(n,c.prototype),n}function X(e){if(c.isBuffer(e)){const t=T(e.length)|0,r=p(t);return r.length===0||e.copy(r,0,0,t),r}if(e.length!==void 0)return typeof e.length!="number"||nt(e.length)?p(0):y(e);if(e.type==="Buffer"&&Array.isArray(e.data))return y(e.data)}function T(e){if(e>=l)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+l.toString(16)+" bytes");return e|0}function W(e){return+e!=e&&(e=0),c.alloc(+e)}c.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==c.prototype},c.compare=function(t,r){if(N(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),N(r,Uint8Array)&&(r=c.from(r,r.offset,r.byteLength)),!c.isBuffer(t)||!c.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;let n=t.length,i=r.length;for(let a=0,h=Math.min(n,i);a<h;++a)if(t[a]!==r[a]){n=t[a],i=r[a];break}return n<i?-1:i<n?1:0},c.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return c.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<t.length;++n)r+=t[n].length;const i=c.allocUnsafe(r);let a=0;for(n=0;n<t.length;++n){let h=t[n];if(N(h,Uint8Array))a+h.length>i.length?(c.isBuffer(h)||(h=c.from(h)),h.copy(i,a)):Uint8Array.prototype.set.call(i,h,a);else if(c.isBuffer(h))h.copy(i,a);else throw new TypeError('"list" argument must be an Array of Buffers');a+=h.length}return i};function O(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||N(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return et(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return mt(e).length;default:if(i)return n?-1:et(e).length;t=(""+t).toLowerCase(),i=!0}}c.byteLength=O;function bt(e,t,r){let n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return Ot(this,t,r);case"utf8":case"utf-8":return lt(this,t,r);case"ascii":return Nt(this,t,r);case"latin1":case"binary":return kt(this,t,r);case"base64":return Lt(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $t(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}c.prototype._isBuffer=!0;function D(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}c.prototype.swap16=function(){const t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<t;r+=2)D(this,r,r+1);return this},c.prototype.swap32=function(){const t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<t;r+=4)D(this,r,r+3),D(this,r+1,r+2);return this},c.prototype.swap64=function(){const t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<t;r+=8)D(this,r,r+7),D(this,r+1,r+6),D(this,r+2,r+5),D(this,r+3,r+4);return this},c.prototype.toString=function(){const t=this.length;return t===0?"":arguments.length===0?lt(this,0,t):bt.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(t){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:c.compare(this,t)===0},c.prototype.inspect=function(){let t="";const r=u.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},f&&(c.prototype[f]=c.prototype.inspect),c.prototype.compare=function(t,r,n,i,a){if(N(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(r===void 0&&(r=0),n===void 0&&(n=t?t.length:0),i===void 0&&(i=0),a===void 0&&(a=this.length),r<0||n>t.length||i<0||a>this.length)throw new RangeError("out of range index");if(i>=a&&r>=n)return 0;if(i>=a)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,a>>>=0,this===t)return 0;let h=a-i,B=n-r;const A=Math.min(h,B),F=this.slice(i,a),U=t.slice(r,n);for(let I=0;I<A;++I)if(F[I]!==U[I]){h=F[I],B=U[I];break}return h<B?-1:B<h?1:0};function ht(e,t,r,n,i){if(e.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,nt(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof t=="string"&&(t=c.from(t,n)),c.isBuffer(t))return t.length===0?-1:ft(e,t,r,n,i);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):ft(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function ft(e,t,r,n,i){let a=1,h=e.length,B=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(e.length<2||t.length<2)return-1;a=2,h/=2,B/=2,r/=2}function A(U,I){return a===1?U[I]:U.readUInt16BE(I*a)}let F;if(i){let U=-1;for(F=r;F<h;F++)if(A(e,F)===A(t,U===-1?0:F-U)){if(U===-1&&(U=F),F-U+1===B)return U*a}else U!==-1&&(F-=F-U),U=-1}else for(r+B>h&&(r=h-B),F=r;F>=0;F--){let U=!0;for(let I=0;I<B;I++)if(A(e,F+I)!==A(t,I)){U=!1;break}if(U)return F}return-1}c.prototype.includes=function(t,r,n){return this.indexOf(t,r,n)!==-1},c.prototype.indexOf=function(t,r,n){return ht(this,t,r,n,!0)},c.prototype.lastIndexOf=function(t,r,n){return ht(this,t,r,n,!1)};function Rt(e,t,r,n){r=Number(r)||0;const i=e.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;const a=t.length;n>a/2&&(n=a/2);let h;for(h=0;h<n;++h){const B=parseInt(t.substr(h*2,2),16);if(nt(B))return h;e[r+h]=B}return h}function St(e,t,r,n){return J(et(t,e.length-r),e,r,n)}function Mt(e,t,r,n){return J(zt(t),e,r,n)}function Ct(e,t,r,n){return J(mt(t),e,r,n)}function Pt(e,t,r,n){return J(Vt(t,e.length-r),e,r,n)}c.prototype.write=function(t,r,n,i){if(r===void 0)i="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")i=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const a=this.length-r;if((n===void 0||n>a)&&(n=a),t.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let h=!1;for(;;)switch(i){case"hex":return Rt(this,t,r,n);case"utf8":case"utf-8":return St(this,t,r,n);case"ascii":case"latin1":case"binary":return Mt(this,t,r,n);case"base64":return Ct(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Pt(this,t,r,n);default:if(h)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),h=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Lt(e,t,r){return t===0&&r===e.length?o.fromByteArray(e):o.fromByteArray(e.slice(t,r))}function lt(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i<r;){const a=e[i];let h=null,B=a>239?4:a>223?3:a>191?2:1;if(i+B<=r){let A,F,U,I;switch(B){case 1:a<128&&(h=a);break;case 2:A=e[i+1],(A&192)===128&&(I=(a&31)<<6|A&63,I>127&&(h=I));break;case 3:A=e[i+1],F=e[i+2],(A&192)===128&&(F&192)===128&&(I=(a&15)<<12|(A&63)<<6|F&63,I>2047&&(I<55296||I>57343)&&(h=I));break;case 4:A=e[i+1],F=e[i+2],U=e[i+3],(A&192)===128&&(F&192)===128&&(U&192)===128&&(I=(a&15)<<18|(A&63)<<12|(F&63)<<6|U&63,I>65535&&I<1114112&&(h=I))}}h===null?(h=65533,B=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|h&1023),n.push(h),i+=B}return Tt(n)}const dt=4096;function Tt(e){const t=e.length;if(t<=dt)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=dt));return r}function Nt(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]&127);return n}function kt(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function Ot(e,t,r){const n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let a=t;a<r;++a)i+=Wt[e[a]];return i}function $t(e,t,r){const n=e.slice(t,r);let i="";for(let a=0;a<n.length-1;a+=2)i+=String.fromCharCode(n[a]+n[a+1]*256);return i}c.prototype.slice=function(t,r){const n=this.length;t=~~t,r=r===void 0?n:~~r,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<t&&(r=t);const i=this.subarray(t,r);return Object.setPrototypeOf(i,c.prototype),i};function b(e,t,r){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}c.prototype.readUintLE=c.prototype.readUIntLE=function(t,r,n){t=t>>>0,r=r>>>0,n||b(t,r,this.length);let i=this[t],a=1,h=0;for(;++h<r&&(a*=256);)i+=this[t+h]*a;return i},c.prototype.readUintBE=c.prototype.readUIntBE=function(t,r,n){t=t>>>0,r=r>>>0,n||b(t,r,this.length);let i=this[t+--r],a=1;for(;r>0&&(a*=256);)i+=this[t+--r]*a;return i},c.prototype.readUint8=c.prototype.readUInt8=function(t,r){return t=t>>>0,r||b(t,1,this.length),this[t]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||b(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||b(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||b(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||b(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readBigUInt64LE=$(function(t){t=t>>>0,z(t,"offset");const r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Y(t,this.length-8);const i=r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,a=this[++t]+this[++t]*2**8+this[++t]*2**16+n*2**24;return BigInt(i)+(BigInt(a)<<BigInt(32))}),c.prototype.readBigUInt64BE=$(function(t){t=t>>>0,z(t,"offset");const r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Y(t,this.length-8);const i=r*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],a=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n;return(BigInt(i)<<BigInt(32))+BigInt(a)}),c.prototype.readIntLE=function(t,r,n){t=t>>>0,r=r>>>0,n||b(t,r,this.length);let i=this[t],a=1,h=0;for(;++h<r&&(a*=256);)i+=this[t+h]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*r)),i},c.prototype.readIntBE=function(t,r,n){t=t>>>0,r=r>>>0,n||b(t,r,this.length);let i=r,a=1,h=this[t+--i];for(;i>0&&(a*=256);)h+=this[t+--i]*a;return a*=128,h>=a&&(h-=Math.pow(2,8*r)),h},c.prototype.readInt8=function(t,r){return t=t>>>0,r||b(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]},c.prototype.readInt16LE=function(t,r){t=t>>>0,r||b(t,2,this.length);const n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n},c.prototype.readInt16BE=function(t,r){t=t>>>0,r||b(t,2,this.length);const n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n},c.prototype.readInt32LE=function(t,r){return t=t>>>0,r||b(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,r){return t=t>>>0,r||b(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readBigInt64LE=$(function(t){t=t>>>0,z(t,"offset");const r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Y(t,this.length-8);const i=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)}),c.prototype.readBigInt64BE=$(function(t){t=t>>>0,z(t,"offset");const r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Y(t,this.length-8);const i=(r<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(i)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n)}),c.prototype.readFloatLE=function(t,r){return t=t>>>0,r||b(t,4,this.length),s.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,r){return t=t>>>0,r||b(t,4,this.length),s.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||b(t,8,this.length),s.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||b(t,8,this.length),s.read(this,t,!1,52,8)};function C(e,t,r,n,i,a){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}c.prototype.writeUintLE=c.prototype.writeUIntLE=function(t,r,n,i){if(t=+t,r=r>>>0,n=n>>>0,!i){const B=Math.pow(2,8*n)-1;C(this,t,r,n,B,0)}let a=1,h=0;for(this[r]=t&255;++h<n&&(a*=256);)this[r+h]=t/a&255;return r+n},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(t,r,n,i){if(t=+t,r=r>>>0,n=n>>>0,!i){const B=Math.pow(2,8*n)-1;C(this,t,r,n,B,0)}let a=n-1,h=1;for(this[r+a]=t&255;--a>=0&&(h*=256);)this[r+a]=t/h&255;return r+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(t,r,n){return t=+t,r=r>>>0,n||C(this,t,r,1,255,0),this[r]=t&255,r+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||C(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||C(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||C(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||C(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function pt(e,t,r,n,i){Et(t,n,i,e,r,7);let a=Number(t&BigInt(4294967295));e[r++]=a,a=a>>8,e[r++]=a,a=a>>8,e[r++]=a,a=a>>8,e[r++]=a;let h=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=h,h=h>>8,e[r++]=h,h=h>>8,e[r++]=h,h=h>>8,e[r++]=h,r}function wt(e,t,r,n,i){Et(t,n,i,e,r,7);let a=Number(t&BigInt(4294967295));e[r+7]=a,a=a>>8,e[r+6]=a,a=a>>8,e[r+5]=a,a=a>>8,e[r+4]=a;let h=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=h,h=h>>8,e[r+2]=h,h=h>>8,e[r+1]=h,h=h>>8,e[r]=h,r+8}c.prototype.writeBigUInt64LE=$(function(t,r=0){return pt(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=$(function(t,r=0){return wt(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(t,r,n,i){if(t=+t,r=r>>>0,!i){const A=Math.pow(2,8*n-1);C(this,t,r,n,A-1,-A)}let a=0,h=1,B=0;for(this[r]=t&255;++a<n&&(h*=256);)t<0&&B===0&&this[r+a-1]!==0&&(B=1),this[r+a]=(t/h>>0)-B&255;return r+n},c.prototype.writeIntBE=function(t,r,n,i){if(t=+t,r=r>>>0,!i){const A=Math.pow(2,8*n-1);C(this,t,r,n,A-1,-A)}let a=n-1,h=1,B=0;for(this[r+a]=t&255;--a>=0&&(h*=256);)t<0&&B===0&&this[r+a+1]!==0&&(B=1),this[r+a]=(t/h>>0)-B&255;return r+n},c.prototype.writeInt8=function(t,r,n){return t=+t,r=r>>>0,n||C(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1},c.prototype.writeInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||C(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2},c.prototype.writeInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||C(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2},c.prototype.writeInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||C(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4},c.prototype.writeInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||C(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4},c.prototype.writeBigInt64LE=$(function(t,r=0){return pt(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=$(function(t,r=0){return wt(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function yt(e,t,r,n,i,a){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function gt(e,t,r,n,i){return t=+t,r=r>>>0,i||yt(e,t,r,4),s.write(e,t,r,n,23,4),r+4}c.prototype.writeFloatLE=function(t,r,n){return gt(this,t,r,!0,n)},c.prototype.writeFloatBE=function(t,r,n){return gt(this,t,r,!1,n)};function Bt(e,t,r,n,i){return t=+t,r=r>>>0,i||yt(e,t,r,8),s.write(e,t,r,n,52,8),r+8}c.prototype.writeDoubleLE=function(t,r,n){return Bt(this,t,r,!0,n)},c.prototype.writeDoubleBE=function(t,r,n){return Bt(this,t,r,!1,n)},c.prototype.copy=function(t,r,n,i){if(!c.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i<n&&(i=n),i===n||t.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r<i-n&&(i=t.length-r+n);const a=i-n;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,i):Uint8Array.prototype.set.call(t,this.subarray(n,i),r),a},c.prototype.fill=function(t,r,n,i){if(typeof t=="string"){if(typeof r=="string"?(i=r,r=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!c.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(t.length===1){const h=t.charCodeAt(0);(i==="utf8"&&h<128||i==="latin1")&&(t=h)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);let a;if(typeof t=="number")for(a=r;a<n;++a)this[a]=t;else{const h=c.isBuffer(t)?t:c.from(t,i),B=h.length;if(B===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(a=0;a<n-r;++a)this[a+r]=h[a%B]}return this};const G={};function rt(e,t,r){G[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}rt("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),rt("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),rt("ERR_OUT_OF_RANGE",function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=xt(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=xt(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n},RangeError);function xt(e){let t="",r=e.length;const n=e[0]==="-"?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function Dt(e,t,r){z(t,"offset"),(e[t]===void 0||e[t+r]===void 0)&&Y(t,e.length-(r+1))}function Et(e,t,r,n,i,a){if(e>r||e<t){const h=typeof t=="bigint"?"n":"";let B;throw a>3?t===0||t===BigInt(0)?B=`>= 0${h} and < 2${h} ** ${(a+1)*8}${h}`:B=`>= -(2${h} ** ${(a+1)*8-1}${h}) and < 2 ** ${(a+1)*8-1}${h}`:B=`>= ${t}${h} and <= ${r}${h}`,new G.ERR_OUT_OF_RANGE("value",B,e)}Dt(n,i,a)}function z(e,t){if(typeof e!="number")throw new G.ERR_INVALID_ARG_TYPE(t,"number",e)}function Y(e,t,r){throw Math.floor(e)!==e?(z(e,r),new G.ERR_OUT_OF_RANGE(r||"offset","an integer",e)):t<0?new G.ERR_BUFFER_OUT_OF_BOUNDS:new G.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}const jt=/[^+/0-9A-Za-z-_]/g;function Gt(e){if(e=e.split("=")[0],e=e.trim().replace(jt,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function et(e,t){t=t||1/0;let r;const n=e.length;let i=null;const a=[];for(let h=0;h<n;++h){if(r=e.charCodeAt(h),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(h+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return a}function zt(e){const t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r)&255);return t}function Vt(e,t){let r,n,i;const a=[];for(let h=0;h<e.length&&!((t-=2)<0);++h)r=e.charCodeAt(h),n=r>>8,i=r%256,a.push(i),a.push(n);return a}function mt(e){return o.toByteArray(Gt(e))}function J(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function N(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function nt(e){return e!==e}const Wt=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=r*16;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function $(e){return typeof BigInt>"u"?Yt:e}function Yt(){throw new Error("BigInt not supported")}})(q);var v={},H={};Object.defineProperty(H,"__esModule",{value:!0});const tr=(u,o)=>u<<8|o,rr=(u,o,s)=>u<<16|o<<8|s,er=(u,o,s,f)=>u<<24|o<<16|s<<8|f,nr=`Maxmind v2 module has changed API.
|
|
7
7
|
Upgrade instructions can be found here: https://github.com/runk/node-maxmind/wiki/Migration-guide
|
|
8
|
-
If you want to use legacy library then explicitly install maxmind@1`;H.default={concat2:
|
|
8
|
+
If you want to use legacy library then explicitly install maxmind@1`;H.default={concat2:tr,concat3:rr,concat4:er,legacyErrorMessage:nr};var ir=L&&L.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(v,"__esModule",{value:!0});const j=ir(H),or=q;var M;(function(u){u[u.Extended=0]="Extended",u[u.Pointer=1]="Pointer",u[u.Utf8String=2]="Utf8String",u[u.Double=3]="Double",u[u.Bytes=4]="Bytes",u[u.Uint16=5]="Uint16",u[u.Uint32=6]="Uint32",u[u.Map=7]="Map",u[u.Int32=8]="Int32",u[u.Uint64=9]="Uint64",u[u.Uint128=10]="Uint128",u[u.Array=11]="Array",u[u.Container=12]="Container",u[u.EndMarker=13]="EndMarker",u[u.Boolean=14]="Boolean",u[u.Float=15]="Float"})(M||(M={}));const ur=[0,2048,526336,0],cr={get:()=>{},set:()=>{}},R=(u,o)=>({value:u,offset:o});class ar{constructor(o,s=0,f=cr){this.telemetry={},this.db=o,this.baseOffset=s,this.cache=f}decode(o){let s;const f=this.db[o++];let l=f>>5;if(l===M.Pointer)return s=this.decodePointer(f,o),R(this.decodeFast(s.value).value,s.offset);if(l===M.Extended){if(s=this.db[o]+7,s<8)throw new Error("Invalid Extended Type at offset "+o+" val "+s);l=s,o++}const d=this.sizeFromCtrlByte(f,o);return this.decodeByType(l,d.offset,d.value)}decodeFast(o){const s=this.cache.get(o);if(s)return s;const f=this.decode(o);return this.cache.set(o,f),f}decodeByType(o,s,f){const l=s+f;switch(o){case M.Utf8String:return R(this.decodeString(s,f),l);case M.Map:return this.decodeMap(f,s);case M.Uint32:return R(this.decodeUint(s,f),l);case M.Double:return R(this.decodeDouble(s),l);case M.Array:return this.decodeArray(f,s);case M.Boolean:return R(this.decodeBoolean(f),s);case M.Float:return R(this.decodeFloat(s),l);case M.Bytes:return R(this.decodeBytes(s,f),l);case M.Uint16:return R(this.decodeUint(s,f),l);case M.Int32:return R(this.decodeInt32(s,f),l);case M.Uint64:return R(this.decodeUint(s,f),l);case M.Uint128:return R(this.decodeUint(s,f),l)}throw new Error("Unknown type "+o+" at offset "+s)}sizeFromCtrlByte(o,s){const f=o&31;return f<29?R(f,s):f===29?R(29+this.db[s],s+1):f===30?R(285+this.db.readUInt16BE(s),s+2):R(65821+j.default.concat3(this.db[s],this.db[s+1],this.db[s+2]),s+3)}decodeBytes(o,s){return this.db.slice(o,o+s)}decodePointer(o,s){const f=o>>3&3,l=this.baseOffset+ur[f];let d=0;return f===0?d=j.default.concat2(o&7,this.db[s]):f===1?d=j.default.concat3(o&7,this.db[s],this.db[s+1]):f===2?d=j.default.concat4(o&7,this.db[s],this.db[s+1],this.db[s+2]):d=this.db.readUInt32BE(s),s+=f+1,R(l+d,s)}decodeArray(o,s){let f;const l=[];for(let d=0;d<o;d++)f=this.decode(s),s=f.offset,l.push(f.value);return R(l,s)}decodeBoolean(o){return o!==0}decodeDouble(o){return this.db.readDoubleBE(o)}decodeFloat(o){return this.db.readFloatBE(o)}decodeMap(o,s){let f,l;const d={};for(let p=0;p<o;p++)f=this.decode(s),l=f.value,f=this.decode(f.offset),s=f.offset,d[l]=f.value;return R(d,s)}decodeInt32(o,s){return s===0?0:this.db.readInt32BE(o)}decodeUint(o,s){switch(s){case 0:return 0;case 1:return this.db[o];case 2:return j.default.concat2(this.db[o+0],this.db[o+1]);case 3:return j.default.concat3(this.db[o+0],this.db[o+1],this.db[o+2]);case 4:return j.default.concat4(this.db[o+0],this.db[o+1],this.db[o+2],this.db[o+3]);case 8:return this.decodeBigUint(o,s);case 16:return this.decodeBigUint(o,s)}return 0}decodeString(o,s){return this.db.slice(o,o+s).toString()}decodeBigUint(o,s){const f=or.Buffer.alloc(s);this.db.copy(f,0,o,o+s);let l=BigInt(0);const d=s/4;for(let p=0;p<d;p++)l=l*BigInt(4294967296)+BigInt(f.readUInt32BE(p<<2));return l.toString()}}v.default=ar;var at={};Object.defineProperty(at,"__esModule",{value:!0});const sr=u=>{const o=u.split(".",4),s=parseInt(o[0]),f=parseInt(o[1]),l=parseInt(o[2]),d=parseInt(o[3]);return[s,f,l,d]},Z=u=>{const o=parseInt(u,10).toString(16);return o.length===2?o:"0"+o},hr=u=>{const o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let s,f,l;const d=u.indexOf(".")>-1?u.replace(/(\d+)\.(\d+)\.(\d+)\.(\d+)/,(x,m,E,g,w)=>Z(m)+Z(E)+":"+Z(g)+Z(w)):u,[p,c]=d.split("::",2);if(p)for(f=p.split(":"),s=0;s<f.length;s++)l=parseInt(f[s],16),o[s*2]=l>>8,o[s*2+1]=l&255;if(c){f=c.split(":");const x=16-f.length*2;for(s=0;s<f.length;s++)l=parseInt(f[s],16),o[x+s*2]=l>>8,o[x+(s*2+1)]=l&255}return o},fr=u=>u.indexOf(":")===-1?sr(u):hr(u),lr=(u,o)=>{const s=o>>3,f=7^o&7;return u[s]>>>f&1},dr=u=>/^(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]?)$/.test(u),pr=u=>/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/.test(u),wr=u=>dr(u)||pr(u);at.default={bitAt:lr,parse:fr,validate:wr};var Ut={};(function(u){var o=L&&L.__importDefault||function(m){return m&&m.__esModule?m:{default:m}};Object.defineProperty(u,"__esModule",{value:!0}),u.isLegacyFormat=u.parseMetadata=void 0;const s=o(v),f=o(H),d=q.Buffer.from("ABCDEF4D61784D696E642E636F6D","hex"),p=m=>{const E=c(m),w=new s.default(m,E).decode(E).value;if(!w)throw new Error((0,u.isLegacyFormat)(m)?f.default.legacyErrorMessage:"Cannot parse binary database");return[24,28,32].indexOf(w.record_size)>-1,{binaryFormatMajorVersion:w.binary_format_major_version,binaryFormatMinorVersion:w.binary_format_minor_version,buildEpoch:new Date(w.build_epoch*1e3),databaseType:w.database_type,description:w.description,ipVersion:w.ip_version,languages:w.languages,nodeByteSize:w.record_size/4,nodeCount:w.node_count,recordSize:w.record_size,searchTreeSize:w.node_count*w.record_size/4,treeDepth:Math.pow(2,w.ip_version+1)}};u.parseMetadata=p;const c=m=>{let E=0,g=m.length-1;const w=d.length-1;for(;E<=w&&g-- >0;)E+=m[g]===d[w-E]?1:-E;return g+E},x=m=>{for(let g=0;g<20;g++){const w=m.slice(m.length-3-g,m.length-g);if(w[0]===255&&w[1]===255&&w[2]===255)return!0}return!1};u.isLegacyFormat=x})(Ut);var st={},yr=L&&L.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(st,"__esModule",{value:!0});const tt=yr(H),gr=u=>o=>tt.default.concat3(u[o+3],u[o+4],u[o+5]),Br=u=>o=>tt.default.concat3(u[o],u[o+1],u[o+2]),xr=u=>o=>tt.default.concat4(u[o+3]>>4,u[o],u[o+1],u[o+2]),Er=u=>o=>tt.default.concat4(u[o+3]&15,u[o+4],u[o+5],u[o+6]),mr=u=>o=>u.readUInt32BE(o),Ir=u=>o=>u.readUInt32BE(o+4);st.default=(u,o)=>{switch(o){case 24:return{left:Br(u),right:gr(u)};case 28:return{left:xr(u),right:Er(u)};case 32:return{left:mr(u),right:Ir(u)}}throw new Error("Unsupported record size")};var ot={},It;function Fr(){return It||(It=1,Object.defineProperty(ot,"__esModule",{value:!0})),ot}(function(u){var o=L&&L.__createBinding||(Object.create?function(g,w,y,_){_===void 0&&(_=y);var S=Object.getOwnPropertyDescriptor(w,y);(!S||("get"in S?!w.__esModule:S.writable||S.configurable))&&(S={enumerable:!0,get:function(){return w[y]}}),Object.defineProperty(g,_,S)}:function(g,w,y,_){_===void 0&&(_=y),g[_]=w[y]}),s=L&&L.__exportStar||function(g,w){for(var y in g)y!=="default"&&!Object.prototype.hasOwnProperty.call(w,y)&&o(w,g,y)},f=L&&L.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(u,"__esModule",{value:!0}),u.Reader=void 0;const l=q,d=f(v),p=f(at),c=Ut,x=f(st),m=16;class E{constructor(w,y={}){this.opts=y,this.load(w)}load(w){if(!l.Buffer.isBuffer(w))throw new Error(`mmdb-lib expects an instance of Buffer, got: ${typeof w}`);this.db=w,this.metadata=(0,c.parseMetadata)(this.db),this.decoder=new d.default(this.db,this.metadata.searchTreeSize+m,this.opts.cache),this.walker=(0,x.default)(this.db,this.metadata.recordSize),this.ipv4StartNodeNumber=this.ipv4Start()}get(w){const[y]=this.getWithPrefixLength(w);return y}getWithPrefixLength(w){const[y,_]=this.findAddressInTree(w);return[y?this.resolveDataPointer(y):null,_]}findAddressInTree(w){const y=p.default.parse(w),_=this.metadata.nodeCount,S=y.length*8;let X,T=0,W,O=0;for(y.length===4&&(T=this.ipv4StartNodeNumber);O<S&&T<_;O++)X=p.default.bitAt(y,O),W=T*this.metadata.nodeByteSize,T=X?this.walker.right(W):this.walker.left(W);return T>_?[T,O]:[null,O]}resolveDataPointer(w){const y=w-this.metadata.nodeCount+this.metadata.searchTreeSize;return this.decoder.decodeFast(y).value}ipv4Start(){if(this.metadata.ipVersion===4)return 0;const w=this.metadata.nodeCount;let y=0,_=0;for(;_<96&&y<w;_++){const S=y*this.metadata.nodeByteSize;y=this.walker.left(S)}return y}}u.Reader=E,s(Fr(),u)})(Ft);async function Ar(u){try{const o=await fetch(u);if(!o.ok)throw new Error("Network response was not ok");const s=await o.arrayBuffer(),f=new Uint8Array(s);return q.Buffer.from(f)}catch(o){console.error("Fetching file failed:",o)}}const Ur="https://raw.githubusercontent.com/Max-Sum/17mon-mmdb/release/Country.mmdb";let K=null;const _r=async u=>{if(K)return K;const o=await Ar(u??Ur);if(o)return K=new Ft.Reader(o),K},ut=new Map,_t=async u=>{var d;if(ut.has(u))return ut.get(u);const o=await _r(),s=o==null?void 0:o.get(u),f=(d=s==null?void 0:s.country)==null?void 0:d.names,l=(f==null?void 0:f["zh-CN"])??(f==null?void 0:f.en)??"n/a";return l&&ut.set(u,l),l};window.getGeoFromIp=_t;exports.getGeoFromIp=_t;
|
|
9
9
|
//# sourceMappingURL=index.cjs.js.map
|