mock-service-cli 4.5.0 → 4.5.1
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/file-explorer-login.html +1 -1
- package/dist/file-explorer.html +33 -7
- package/dist/meta.json +3 -3
- package/dist/runtime.js +2 -2
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>文件浏览器登录</title>
|
|
7
|
-
<link rel="icon" type="image/svg+xml" href="
|
|
7
|
+
<link rel="icon" type="image/svg+xml" href="__FILE_EXPLORER_FAVICON_URL__" />
|
|
8
8
|
<style>
|
|
9
9
|
* { box-sizing: border-box; }
|
|
10
10
|
body { margin: 0; min-height: 100vh; display: grid; place-items: center; background: #f4f6f8; color: #202124; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
|
package/dist/file-explorer.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>文件浏览器 - File Explorer</title>
|
|
7
|
-
<link rel="icon" type="image/svg+xml" href="
|
|
7
|
+
<link rel="icon" type="image/svg+xml" href="__FILE_EXPLORER_FAVICON_URL__" />
|
|
8
8
|
<style>
|
|
9
9
|
* {
|
|
10
10
|
margin: 0;
|
|
@@ -1158,6 +1158,7 @@
|
|
|
1158
1158
|
let explorerLifecycleVersion = 0;
|
|
1159
1159
|
let currentArchiveJobId = null;
|
|
1160
1160
|
let currentArchiveJobOperation = null;
|
|
1161
|
+
let explorerRootId = null;
|
|
1161
1162
|
let archiveCapabilities = { createFormats: [], readExtensions: [] };
|
|
1162
1163
|
|
|
1163
1164
|
const EXPLORER_AUTH_STORAGE_KEY = 'mock-service-cli.file-explorer.password';
|
|
@@ -1281,6 +1282,7 @@
|
|
|
1281
1282
|
const config = await response.json();
|
|
1282
1283
|
if (!response.ok || config.error) throw new Error(config.error || 'Failed to load configuration');
|
|
1283
1284
|
editMode = Boolean(config.editMode);
|
|
1285
|
+
explorerRootId = typeof config.rootId === 'string' ? config.rootId : null;
|
|
1284
1286
|
} catch (error) {
|
|
1285
1287
|
console.warn('Failed to load file explorer configuration:', error);
|
|
1286
1288
|
editMode = false;
|
|
@@ -1413,7 +1415,25 @@
|
|
|
1413
1415
|
}
|
|
1414
1416
|
}
|
|
1415
1417
|
|
|
1416
|
-
|
|
1418
|
+
function getStoredExplorerPath() {
|
|
1419
|
+
try {
|
|
1420
|
+
const stored = JSON.parse(sessionStorage.getItem(EXPLORER_PATH_STORAGE_KEY));
|
|
1421
|
+
if (stored && stored.rootId === explorerRootId && typeof stored.path === 'string' && stored.path.startsWith('/')) {
|
|
1422
|
+
return stored.path;
|
|
1423
|
+
}
|
|
1424
|
+
} catch (error) {
|
|
1425
|
+
// Earlier releases stored the path directly; discard that unscoped value.
|
|
1426
|
+
}
|
|
1427
|
+
sessionStorage.removeItem(EXPLORER_PATH_STORAGE_KEY);
|
|
1428
|
+
return '/';
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
function storeExplorerPath(path) {
|
|
1432
|
+
if (!explorerRootId) return;
|
|
1433
|
+
sessionStorage.setItem(EXPLORER_PATH_STORAGE_KEY, JSON.stringify({ rootId: explorerRootId, path }));
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
async function initializeExplorer() {
|
|
1417
1437
|
if (explorerInitializationPromise) return explorerInitializationPromise;
|
|
1418
1438
|
|
|
1419
1439
|
const lifecycleVersion = explorerLifecycleVersion;
|
|
@@ -1443,7 +1463,7 @@
|
|
|
1443
1463
|
await loadArchiveCapabilities();
|
|
1444
1464
|
if (lifecycleVersion !== explorerLifecycleVersion) return;
|
|
1445
1465
|
startHealthCheck();
|
|
1446
|
-
await loadDirectory(
|
|
1466
|
+
await loadDirectory(getStoredExplorerPath(), { fallbackToRoot: true });
|
|
1447
1467
|
})();
|
|
1448
1468
|
explorerInitializationPromise = initializationPromise;
|
|
1449
1469
|
|
|
@@ -1460,7 +1480,7 @@
|
|
|
1460
1480
|
|
|
1461
1481
|
window.addEventListener('pagehide', handlePageHide);
|
|
1462
1482
|
window.addEventListener('pageshow', event => {
|
|
1463
|
-
if (event.persisted) initializeExplorer(
|
|
1483
|
+
if (event.persisted) initializeExplorer();
|
|
1464
1484
|
});
|
|
1465
1485
|
|
|
1466
1486
|
function showContextMenu(x, y, filePath, isDirectory) {
|
|
@@ -1538,7 +1558,7 @@
|
|
|
1538
1558
|
hideContextMenu();
|
|
1539
1559
|
}
|
|
1540
1560
|
|
|
1541
|
-
async function loadDirectory(path) {
|
|
1561
|
+
async function loadDirectory(path, { fallbackToRoot = false } = {}) {
|
|
1542
1562
|
const fileGrid = document.getElementById('fileGrid');
|
|
1543
1563
|
const oldCurrentPath = currentPath;
|
|
1544
1564
|
const requestId = ++directoryRequestId;
|
|
@@ -1562,12 +1582,14 @@
|
|
|
1562
1582
|
const data = await response.json();
|
|
1563
1583
|
|
|
1564
1584
|
if (!response.ok || data.error) {
|
|
1565
|
-
|
|
1585
|
+
const error = new Error(data.error || 'Failed to load directory');
|
|
1586
|
+
error.status = response.status;
|
|
1587
|
+
throw error;
|
|
1566
1588
|
}
|
|
1567
1589
|
if (requestId !== directoryRequestId) return;
|
|
1568
1590
|
|
|
1569
1591
|
currentPath = data.currentPath;
|
|
1570
|
-
|
|
1592
|
+
storeExplorerPath(currentPath);
|
|
1571
1593
|
allFiles = data.files || [];
|
|
1572
1594
|
|
|
1573
1595
|
if (document.getElementById('searchInput')) {
|
|
@@ -1580,6 +1602,10 @@
|
|
|
1580
1602
|
updateBackButton(data.parentPath);
|
|
1581
1603
|
} catch (error) {
|
|
1582
1604
|
if (error.name === 'AbortError' || requestId !== directoryRequestId) return;
|
|
1605
|
+
if (fallbackToRoot && path !== '/' && error.status === 404) {
|
|
1606
|
+
sessionStorage.removeItem(EXPLORER_PATH_STORAGE_KEY);
|
|
1607
|
+
return loadDirectory('/', { fallbackToRoot: false });
|
|
1608
|
+
}
|
|
1583
1609
|
console.error('Error loading directory:', error);
|
|
1584
1610
|
currentPath = oldCurrentPath;
|
|
1585
1611
|
const parentPath = currentPath === '/' ? null : currentPath.substring(0, currentPath.lastIndexOf('/')) || '/';
|
package/dist/meta.json
CHANGED
|
@@ -7484,7 +7484,7 @@
|
|
|
7484
7484
|
"format": "cjs"
|
|
7485
7485
|
},
|
|
7486
7486
|
"src/lib/fileExplorerServer.js": {
|
|
7487
|
-
"bytes":
|
|
7487
|
+
"bytes": 25537,
|
|
7488
7488
|
"imports": [
|
|
7489
7489
|
{
|
|
7490
7490
|
"path": "node_modules/express/index.js",
|
|
@@ -9979,13 +9979,13 @@
|
|
|
9979
9979
|
"bytesInOutput": 7774
|
|
9980
9980
|
},
|
|
9981
9981
|
"src/lib/fileExplorerServer.js": {
|
|
9982
|
-
"bytesInOutput":
|
|
9982
|
+
"bytesInOutput": 19066
|
|
9983
9983
|
},
|
|
9984
9984
|
"src/runtime.js": {
|
|
9985
9985
|
"bytesInOutput": 507
|
|
9986
9986
|
}
|
|
9987
9987
|
},
|
|
9988
|
-
"bytes":
|
|
9988
|
+
"bytes": 1621996
|
|
9989
9989
|
}
|
|
9990
9990
|
}
|
|
9991
9991
|
}
|
package/dist/runtime.js
CHANGED
|
@@ -137,8 +137,8 @@ Starting up Static Server, serving `),colors.cyan(instance.root),colors.yellow(`
|
|
|
137
137
|
Static Server available on:
|
|
138
138
|
`)),urls.forEach(url=>console.info(" "+url.replace(String(port),colors.green(port)))),config.open){let openPath=typeof config.open=="string"?config.open:"/";openBrowser(`${urls[0]}${openPath.startsWith("/")?openPath:`/${openPath}`}`,config.browser)}})}).catch(error=>{console.error(colors.red(`static-server watcher failed: ${error.message}`)),shutdown()})}process.env.PORT?startServer():(portfinder.basePort=8090,portfinder.getPort((error,port)=>{if(error)throw error;process.env.PORT=port,startServer()}));module2.exports={normalizeConfig,createStaticServer}}});var require_utils6=__commonJS({"node_modules/busboy/lib/utils.js"(exports2,module2){"use strict";function parseContentType(str){if(str.length===0)return;let params=Object.create(null),i=0;for(;i<str.length;++i){let code=str.charCodeAt(i);if(TOKEN[code]!==1){if(code!==47||i===0)return;break}}if(i===str.length)return;let type=str.slice(0,i).toLowerCase(),subtypeStart=++i;for(;i<str.length;++i){let code=str.charCodeAt(i);if(TOKEN[code]!==1){if(i===subtypeStart||parseContentTypeParams(str,i,params)===void 0)return;break}}if(i===subtypeStart)return;let subtype=str.slice(subtypeStart,i).toLowerCase();return{type,subtype,params}}function parseContentTypeParams(str,i,params){for(;i<str.length;){for(;i<str.length;++i){let code=str.charCodeAt(i);if(code!==32&&code!==9)break}if(i===str.length)break;if(str.charCodeAt(i++)!==59)return;for(;i<str.length;++i){let code=str.charCodeAt(i);if(code!==32&&code!==9)break}if(i===str.length)return;let name,nameStart=i;for(;i<str.length;++i){let code=str.charCodeAt(i);if(TOKEN[code]!==1){if(code!==61)return;break}}if(i===str.length||(name=str.slice(nameStart,i),++i,i===str.length))return;let value="",valueStart;if(str.charCodeAt(i)===34){valueStart=++i;let escaping=!1;for(;i<str.length;++i){let code=str.charCodeAt(i);if(code===92){escaping?(valueStart=i,escaping=!1):(value+=str.slice(valueStart,i),escaping=!0);continue}if(code===34){if(escaping){valueStart=i,escaping=!1;continue}value+=str.slice(valueStart,i);break}if(escaping&&(valueStart=i-1,escaping=!1),QDTEXT[code]!==1)return}if(i===str.length)return;++i}else{for(valueStart=i;i<str.length;++i){let code=str.charCodeAt(i);if(TOKEN[code]!==1){if(i===valueStart)return;break}}value=str.slice(valueStart,i)}name=name.toLowerCase(),params[name]===void 0&&(params[name]=value)}return params}function parseDisposition(str,defDecoder){if(str.length===0)return;let params=Object.create(null),i=0;for(;i<str.length;++i){let code=str.charCodeAt(i);if(TOKEN[code]!==1){if(parseDispositionParams(str,i,params,defDecoder)===void 0)return;break}}return{type:str.slice(0,i).toLowerCase(),params}}function parseDispositionParams(str,i,params,defDecoder){for(;i<str.length;){for(;i<str.length;++i){let code=str.charCodeAt(i);if(code!==32&&code!==9)break}if(i===str.length)break;if(str.charCodeAt(i++)!==59)return;for(;i<str.length;++i){let code=str.charCodeAt(i);if(code!==32&&code!==9)break}if(i===str.length)return;let name,nameStart=i;for(;i<str.length;++i){let code=str.charCodeAt(i);if(TOKEN[code]!==1){if(code===61)break;return}}if(i===str.length)return;let value="",valueStart,charset;if(name=str.slice(nameStart,i),name.charCodeAt(name.length-1)===42){let charsetStart=++i;for(;i<str.length;++i){let code=str.charCodeAt(i);if(CHARSET[code]!==1){if(code!==39)return;break}}if(i===str.length)return;for(charset=str.slice(charsetStart,i),++i;i<str.length&&str.charCodeAt(i)!==39;++i);if(i===str.length||(++i,i===str.length))return;valueStart=i;let encode=0;for(;i<str.length;++i){let code=str.charCodeAt(i);if(EXTENDED_VALUE[code]!==1){if(code===37){let hexUpper,hexLower;if(i+2<str.length&&(hexUpper=HEX_VALUES[str.charCodeAt(i+1)])!==-1&&(hexLower=HEX_VALUES[str.charCodeAt(i+2)])!==-1){let byteVal=(hexUpper<<4)+hexLower;value+=str.slice(valueStart,i),value+=String.fromCharCode(byteVal),i+=2,valueStart=i+1,byteVal>=128?encode=2:encode===0&&(encode=1);continue}return}break}}if(value+=str.slice(valueStart,i),value=convertToUTF8(value,charset,encode),value===void 0)return}else{if(++i,i===str.length)return;if(str.charCodeAt(i)===34){valueStart=++i;let escaping=!1;for(;i<str.length;++i){let code=str.charCodeAt(i);if(code===92){escaping?(valueStart=i,escaping=!1):(value+=str.slice(valueStart,i),escaping=!0);continue}if(code===34){if(escaping){valueStart=i,escaping=!1;continue}value+=str.slice(valueStart,i);break}if(escaping&&(valueStart=i-1,escaping=!1),QDTEXT[code]!==1)return}if(i===str.length)return;++i}else{for(valueStart=i;i<str.length;++i){let code=str.charCodeAt(i);if(TOKEN[code]!==1){if(i===valueStart)return;break}}value=str.slice(valueStart,i)}if(value=defDecoder(value,2),value===void 0)return}name=name.toLowerCase(),params[name]===void 0&&(params[name]=value)}return params}function getDecoder(charset){let lc;for(;;)switch(charset){case"utf-8":case"utf8":return decoders.utf8;case"latin1":case"ascii":case"us-ascii":case"iso-8859-1":case"iso8859-1":case"iso88591":case"iso_8859-1":case"windows-1252":case"iso_8859-1:1987":case"cp1252":case"x-cp1252":return decoders.latin1;case"utf16le":case"utf-16le":case"ucs2":case"ucs-2":return decoders.utf16le;case"base64":return decoders.base64;default:if(lc===void 0){lc=!0,charset=charset.toLowerCase();continue}return decoders.other.bind(charset)}}var decoders={utf8:(data,hint)=>{if(data.length===0)return"";if(typeof data=="string"){if(hint<2)return data;data=Buffer.from(data,"latin1")}return data.utf8Slice(0,data.length)},latin1:(data,hint)=>data.length===0?"":typeof data=="string"?data:data.latin1Slice(0,data.length),utf16le:(data,hint)=>data.length===0?"":(typeof data=="string"&&(data=Buffer.from(data,"latin1")),data.ucs2Slice(0,data.length)),base64:(data,hint)=>data.length===0?"":(typeof data=="string"&&(data=Buffer.from(data,"latin1")),data.base64Slice(0,data.length)),other:(data,hint)=>{if(data.length===0)return"";typeof data=="string"&&(data=Buffer.from(data,"latin1"));try{return new TextDecoder(exports2).decode(data)}catch{}}};function convertToUTF8(data,charset,hint){let decode=getDecoder(charset);if(decode)return decode(data,hint)}function basename(path){if(typeof path!="string")return"";for(let i=path.length-1;i>=0;--i)switch(path.charCodeAt(i)){case 47:case 92:return path=path.slice(i+1),path===".."||path==="."?"":path}return path===".."||path==="."?"":path}var TOKEN=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],QDTEXT=[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],CHARSET=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0,1,0,1,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],EXTENDED_VALUE=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,1,0,0,0,0,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],HEX_VALUES=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1];module2.exports={basename,convertToUTF8,getDecoder,parseContentType,parseDisposition}}});var require_sbmh=__commonJS({"node_modules/streamsearch/lib/sbmh.js"(exports2,module2){"use strict";function memcmp(buf1,pos1,buf2,pos2,num){for(let i=0;i<num;++i)if(buf1[pos1+i]!==buf2[pos2+i])return!1;return!0}var SBMH=class{constructor(needle,cb){if(typeof cb!="function")throw new Error("Missing match callback");if(typeof needle=="string")needle=Buffer.from(needle);else if(!Buffer.isBuffer(needle))throw new Error(`Expected Buffer for needle, got ${typeof needle}`);let needleLen=needle.length;if(this.maxMatches=1/0,this.matches=0,this._cb=cb,this._lookbehindSize=0,this._needle=needle,this._bufPos=0,this._lookbehind=Buffer.allocUnsafe(needleLen),this._occ=[needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen,needleLen],needleLen>1)for(let i=0;i<needleLen-1;++i)this._occ[needle[i]]=needleLen-1-i}reset(){this.matches=0,this._lookbehindSize=0,this._bufPos=0}push(chunk,pos){let result;Buffer.isBuffer(chunk)||(chunk=Buffer.from(chunk,"latin1"));let chunkLen=chunk.length;for(this._bufPos=pos||0;result!==chunkLen&&this.matches<this.maxMatches;)result=feed(this,chunk);return result}destroy(){let lbSize=this._lookbehindSize;lbSize&&this._cb(!1,this._lookbehind,0,lbSize,!1),this.reset()}};function feed(self2,data){let len=data.length,needle=self2._needle,needleLen=needle.length,pos=-self2._lookbehindSize,lastNeedleCharPos=needleLen-1,lastNeedleChar=needle[lastNeedleCharPos],end=len-needleLen,occ=self2._occ,lookbehind=self2._lookbehind;if(pos<0){for(;pos<0&&pos<=end;){let nextPos=pos+lastNeedleCharPos,ch=nextPos<0?lookbehind[self2._lookbehindSize+nextPos]:data[nextPos];if(ch===lastNeedleChar&&matchNeedle(self2,data,pos,lastNeedleCharPos))return self2._lookbehindSize=0,++self2.matches,pos>-self2._lookbehindSize?self2._cb(!0,lookbehind,0,self2._lookbehindSize+pos,!1):self2._cb(!0,void 0,0,0,!0),self2._bufPos=pos+needleLen;pos+=occ[ch]}for(;pos<0&&!matchNeedle(self2,data,pos,len-pos);)++pos;if(pos<0){let bytesToCutOff=self2._lookbehindSize+pos;return bytesToCutOff>0&&self2._cb(!1,lookbehind,0,bytesToCutOff,!1),self2._lookbehindSize-=bytesToCutOff,lookbehind.copy(lookbehind,0,bytesToCutOff,self2._lookbehindSize),lookbehind.set(data,self2._lookbehindSize),self2._lookbehindSize+=len,self2._bufPos=len,len}self2._cb(!1,lookbehind,0,self2._lookbehindSize,!1),self2._lookbehindSize=0}pos+=self2._bufPos;let firstNeedleChar=needle[0];for(;pos<=end;){let ch=data[pos+lastNeedleCharPos];if(ch===lastNeedleChar&&data[pos]===firstNeedleChar&&memcmp(needle,0,data,pos,lastNeedleCharPos))return++self2.matches,pos>0?self2._cb(!0,data,self2._bufPos,pos,!0):self2._cb(!0,void 0,0,0,!0),self2._bufPos=pos+needleLen;pos+=occ[ch]}for(;pos<len;){if(data[pos]!==firstNeedleChar||!memcmp(data,pos,needle,0,len-pos)){++pos;continue}data.copy(lookbehind,0,pos,len),self2._lookbehindSize=len-pos;break}return pos>0&&self2._cb(!1,data,self2._bufPos,pos<len?pos:len,!0),self2._bufPos=len,len}function matchNeedle(self2,data,pos,len){let lb=self2._lookbehind,lbSize=self2._lookbehindSize,needle=self2._needle;for(let i=0;i<len;++i,++pos)if((pos<0?lb[lbSize+pos]:data[pos])!==needle[i])return!1;return!0}module2.exports=SBMH}});var require_multipart=__commonJS({"node_modules/busboy/lib/types/multipart.js"(exports2,module2){"use strict";var{Readable,Writable}=require("stream"),StreamSearch=require_sbmh(),{basename,convertToUTF8,getDecoder,parseContentType,parseDisposition}=require_utils6(),BUF_CRLF=Buffer.from(`\r
|
|
139
139
|
`),BUF_CR=Buffer.from("\r"),BUF_DASH=Buffer.from("-");function noop(){}var MAX_HEADER_PAIRS=2e3,MAX_HEADER_SIZE=16*1024,HPARSER_NAME=0,HPARSER_PRE_OWS=1,HPARSER_VALUE=2,HeaderParser=class{constructor(cb){this.header=Object.create(null),this.pairCount=0,this.byteCount=0,this.state=HPARSER_NAME,this.name="",this.value="",this.crlf=0,this.cb=cb}reset(){this.header=Object.create(null),this.pairCount=0,this.byteCount=0,this.state=HPARSER_NAME,this.name="",this.value="",this.crlf=0}push(chunk,pos,end){let start=pos;for(;pos<end;)switch(this.state){case HPARSER_NAME:{let done=!1;for(;pos<end;++pos){if(this.byteCount===MAX_HEADER_SIZE)return-1;++this.byteCount;let code=chunk[pos];if(TOKEN[code]!==1){if(code!==58||(this.name+=chunk.latin1Slice(start,pos),this.name.length===0))return-1;++pos,done=!0,this.state=HPARSER_PRE_OWS;break}}if(!done){this.name+=chunk.latin1Slice(start,pos);break}}case HPARSER_PRE_OWS:{let done=!1;for(;pos<end;++pos){if(this.byteCount===MAX_HEADER_SIZE)return-1;++this.byteCount;let code=chunk[pos];if(code!==32&&code!==9){start=pos,done=!0,this.state=HPARSER_VALUE;break}}if(!done)break}case HPARSER_VALUE:switch(this.crlf){case 0:for(;pos<end;++pos){if(this.byteCount===MAX_HEADER_SIZE)return-1;++this.byteCount;let code=chunk[pos];if(FIELD_VCHAR[code]!==1){if(code!==13)return-1;++this.crlf;break}}this.value+=chunk.latin1Slice(start,pos++);break;case 1:if(this.byteCount===MAX_HEADER_SIZE||(++this.byteCount,chunk[pos++]!==10))return-1;++this.crlf;break;case 2:{if(this.byteCount===MAX_HEADER_SIZE)return-1;++this.byteCount;let code=chunk[pos];code===32||code===9?(start=pos,this.crlf=0):(++this.pairCount<MAX_HEADER_PAIRS&&(this.name=this.name.toLowerCase(),this.header[this.name]===void 0?this.header[this.name]=[this.value]:this.header[this.name].push(this.value)),code===13?(++this.crlf,++pos):(start=pos,this.crlf=0,this.state=HPARSER_NAME,this.name="",this.value=""));break}case 3:{if(this.byteCount===MAX_HEADER_SIZE||(++this.byteCount,chunk[pos++]!==10))return-1;let header=this.header;return this.reset(),this.cb(header),pos}}break}return pos}},FileStream=class extends Readable{constructor(opts,owner){super(opts),this.truncated=!1,this._readcb=null,this.once("end",()=>{if(this._read(),--owner._fileEndsLeft===0&&owner._finalcb){let cb=owner._finalcb;owner._finalcb=null,process.nextTick(cb)}})}_read(n){let cb=this._readcb;cb&&(this._readcb=null,cb())}},ignoreData={push:(chunk,pos)=>{},destroy:()=>{}};function callAndUnsetCb(self2,err){let cb=self2._writecb;self2._writecb=null,err?self2.destroy(err):cb&&cb()}function nullDecoder(val,hint){return val}var Multipart=class extends Writable{constructor(cfg){let streamOpts={autoDestroy:!0,emitClose:!0,highWaterMark:typeof cfg.highWaterMark=="number"?cfg.highWaterMark:void 0};if(super(streamOpts),!cfg.conType.params||typeof cfg.conType.params.boundary!="string")throw new Error("Multipart: Boundary not found");let boundary=cfg.conType.params.boundary,paramDecoder=typeof cfg.defParamCharset=="string"&&cfg.defParamCharset?getDecoder(cfg.defParamCharset):nullDecoder,defCharset=cfg.defCharset||"utf8",preservePath=cfg.preservePath,fileOpts={autoDestroy:!0,emitClose:!0,highWaterMark:typeof cfg.fileHwm=="number"?cfg.fileHwm:void 0},limits=cfg.limits,fieldSizeLimit=limits&&typeof limits.fieldSize=="number"?limits.fieldSize:1*1024*1024,fileSizeLimit=limits&&typeof limits.fileSize=="number"?limits.fileSize:1/0,filesLimit=limits&&typeof limits.files=="number"?limits.files:1/0,fieldsLimit=limits&&typeof limits.fields=="number"?limits.fields:1/0,partsLimit=limits&&typeof limits.parts=="number"?limits.parts:1/0,parts=-1,fields=0,files=0,skipPart=!1;this._fileEndsLeft=0,this._fileStream=void 0,this._complete=!1;let fileSize=0,field,fieldSize=0,partCharset,partEncoding,partType,partName,partTruncated=!1,hitFilesLimit=!1,hitFieldsLimit=!1;this._hparser=null;let hparser=new HeaderParser(header=>{this._hparser=null,skipPart=!1,partType="text/plain",partCharset=defCharset,partEncoding="7bit",partName=void 0,partTruncated=!1;let filename;if(!header["content-disposition"]){skipPart=!0;return}let disp=parseDisposition(header["content-disposition"][0],paramDecoder);if(!disp||disp.type!=="form-data"){skipPart=!0;return}if(disp.params&&(disp.params.name&&(partName=disp.params.name),disp.params["filename*"]?filename=disp.params["filename*"]:disp.params.filename&&(filename=disp.params.filename),filename!==void 0&&!preservePath&&(filename=basename(filename))),header["content-type"]){let conType=parseContentType(header["content-type"][0]);conType&&(partType=`${conType.type}/${conType.subtype}`,conType.params&&typeof conType.params.charset=="string"&&(partCharset=conType.params.charset.toLowerCase()))}if(header["content-transfer-encoding"]&&(partEncoding=header["content-transfer-encoding"][0].toLowerCase()),partType==="application/octet-stream"||filename!==void 0){if(files===filesLimit){hitFilesLimit||(hitFilesLimit=!0,this.emit("filesLimit")),skipPart=!0;return}if(++files,this.listenerCount("file")===0){skipPart=!0;return}fileSize=0,this._fileStream=new FileStream(fileOpts,this),++this._fileEndsLeft,this.emit("file",partName,this._fileStream,{filename,encoding:partEncoding,mimeType:partType})}else{if(fields===fieldsLimit){hitFieldsLimit||(hitFieldsLimit=!0,this.emit("fieldsLimit")),skipPart=!0;return}if(++fields,this.listenerCount("field")===0){skipPart=!0;return}field=[],fieldSize=0}}),matchPostBoundary=0,ssCb=(isMatch,data,start,end,isDataSafe)=>{retrydata:for(;data;){if(this._hparser!==null){let ret=this._hparser.push(data,start,end);if(ret===-1){this._hparser=null,hparser.reset(),this.emit("error",new Error("Malformed part header"));break}start=ret}if(start===end)break;if(matchPostBoundary!==0){if(matchPostBoundary===1){switch(data[start]){case 45:matchPostBoundary=2,++start;break;case 13:matchPostBoundary=3,++start;break;default:matchPostBoundary=0}if(start===end)return}if(matchPostBoundary===2){if(matchPostBoundary=0,data[start]===45){this._complete=!0,this._bparser=ignoreData;return}let writecb=this._writecb;this._writecb=noop,ssCb(!1,BUF_DASH,0,1,!1),this._writecb=writecb}else if(matchPostBoundary===3)if(matchPostBoundary=0,data[start]===10){if(++start,parts>=partsLimit||(this._hparser=hparser,start===end))break;continue retrydata}else{let writecb=this._writecb;this._writecb=noop,ssCb(!1,BUF_CR,0,1,!1),this._writecb=writecb}}if(!skipPart){if(this._fileStream){let chunk,actualLen=Math.min(end-start,fileSizeLimit-fileSize);isDataSafe?chunk=data.slice(start,start+actualLen):(chunk=Buffer.allocUnsafe(actualLen),data.copy(chunk,0,start,start+actualLen)),fileSize+=chunk.length,fileSize===fileSizeLimit?(chunk.length>0&&this._fileStream.push(chunk),this._fileStream.emit("limit"),this._fileStream.truncated=!0,skipPart=!0):this._fileStream.push(chunk)||(this._writecb&&(this._fileStream._readcb=this._writecb),this._writecb=null)}else if(field!==void 0){let chunk,actualLen=Math.min(end-start,fieldSizeLimit-fieldSize);isDataSafe?chunk=data.slice(start,start+actualLen):(chunk=Buffer.allocUnsafe(actualLen),data.copy(chunk,0,start,start+actualLen)),fieldSize+=actualLen,field.push(chunk),fieldSize===fieldSizeLimit&&(skipPart=!0,partTruncated=!0)}}break}if(isMatch){if(matchPostBoundary=1,this._fileStream)this._fileStream.push(null),this._fileStream=null;else if(field!==void 0){let data2;switch(field.length){case 0:data2="";break;case 1:data2=convertToUTF8(field[0],partCharset,0);break;default:data2=convertToUTF8(Buffer.concat(field,fieldSize),partCharset,0)}field=void 0,fieldSize=0,this.emit("field",partName,data2,{nameTruncated:!1,valueTruncated:partTruncated,encoding:partEncoding,mimeType:partType})}++parts===partsLimit&&this.emit("partsLimit")}};this._bparser=new StreamSearch(`\r
|
|
140
|
-
--${boundary}`,ssCb),this._writecb=null,this._finalcb=null,this.write(BUF_CRLF)}static detect(conType){return conType.type==="multipart"&&conType.subtype==="form-data"}_write(chunk,enc,cb){this._writecb=cb,this._bparser.push(chunk,0),this._writecb&&callAndUnsetCb(this)}_destroy(err,cb){this._hparser=null,this._bparser=ignoreData,err||(err=checkEndState(this));let fileStream=this._fileStream;fileStream&&(this._fileStream=null,fileStream.destroy(err)),cb(err)}_final(cb){if(this._bparser.destroy(),!this._complete)return cb(new Error("Unexpected end of form"));this._fileEndsLeft?this._finalcb=finalcb.bind(null,this,cb):finalcb(this,cb)}};function finalcb(self2,cb,err){if(err)return cb(err);err=checkEndState(self2),cb(err)}function checkEndState(self2){if(self2._hparser)return new Error("Malformed part header");let fileStream=self2._fileStream;if(fileStream&&(self2._fileStream=null,fileStream.destroy(new Error("Unexpected end of file"))),!self2._complete)return new Error("Unexpected end of form")}var TOKEN=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],FIELD_VCHAR=[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];module2.exports=Multipart}});var require_urlencoded2=__commonJS({"node_modules/busboy/lib/types/urlencoded.js"(exports2,module2){"use strict";var{Writable}=require("stream"),{getDecoder}=require_utils6(),URLEncoded=class extends Writable{constructor(cfg){let streamOpts={autoDestroy:!0,emitClose:!0,highWaterMark:typeof cfg.highWaterMark=="number"?cfg.highWaterMark:void 0};super(streamOpts);let charset=cfg.defCharset||"utf8";cfg.conType.params&&typeof cfg.conType.params.charset=="string"&&(charset=cfg.conType.params.charset),this.charset=charset;let limits=cfg.limits;this.fieldSizeLimit=limits&&typeof limits.fieldSize=="number"?limits.fieldSize:1*1024*1024,this.fieldsLimit=limits&&typeof limits.fields=="number"?limits.fields:1/0,this.fieldNameSizeLimit=limits&&typeof limits.fieldNameSize=="number"?limits.fieldNameSize:100,this._inKey=!0,this._keyTrunc=!1,this._valTrunc=!1,this._bytesKey=0,this._bytesVal=0,this._fields=0,this._key="",this._val="",this._byte=-2,this._lastPos=0,this._encode=0,this._decoder=getDecoder(charset)}static detect(conType){return conType.type==="application"&&conType.subtype==="x-www-form-urlencoded"}_write(chunk,enc,cb){if(this._fields>=this.fieldsLimit)return cb();let i=0,len=chunk.length;if(this._lastPos=0,this._byte!==-2){if(i=readPctEnc(this,chunk,i,len),i===-1)return cb(new Error("Malformed urlencoded form"));if(i>=len)return cb();this._inKey?++this._bytesKey:++this._bytesVal}main:for(;i<len;)if(this._inKey){for(i=skipKeyBytes(this,chunk,i,len);i<len;){switch(chunk[i]){case 61:this._lastPos<i&&(this._key+=chunk.latin1Slice(this._lastPos,i)),this._lastPos=++i,this._key=this._decoder(this._key,this._encode),this._encode=0,this._inKey=!1;continue main;case 38:if(this._lastPos<i&&(this._key+=chunk.latin1Slice(this._lastPos,i)),this._lastPos=++i,this._key=this._decoder(this._key,this._encode),this._encode=0,this._bytesKey>0&&this.emit("field",this._key,"",{nameTruncated:this._keyTrunc,valueTruncated:!1,encoding:this.charset,mimeType:"text/plain"}),this._key="",this._val="",this._keyTrunc=!1,this._valTrunc=!1,this._bytesKey=0,this._bytesVal=0,++this._fields>=this.fieldsLimit)return this.emit("fieldsLimit"),cb();continue;case 43:this._lastPos<i&&(this._key+=chunk.latin1Slice(this._lastPos,i)),this._key+=" ",this._lastPos=i+1;break;case 37:if(this._encode===0&&(this._encode=1),this._lastPos<i&&(this._key+=chunk.latin1Slice(this._lastPos,i)),this._lastPos=i+1,this._byte=-1,i=readPctEnc(this,chunk,i+1,len),i===-1)return cb(new Error("Malformed urlencoded form"));if(i>=len)return cb();++this._bytesKey,i=skipKeyBytes(this,chunk,i,len);continue}++i,++this._bytesKey,i=skipKeyBytes(this,chunk,i,len)}this._lastPos<i&&(this._key+=chunk.latin1Slice(this._lastPos,i))}else{for(i=skipValBytes(this,chunk,i,len);i<len;){switch(chunk[i]){case 38:if(this._lastPos<i&&(this._val+=chunk.latin1Slice(this._lastPos,i)),this._lastPos=++i,this._inKey=!0,this._val=this._decoder(this._val,this._encode),this._encode=0,(this._bytesKey>0||this._bytesVal>0)&&this.emit("field",this._key,this._val,{nameTruncated:this._keyTrunc,valueTruncated:this._valTrunc,encoding:this.charset,mimeType:"text/plain"}),this._key="",this._val="",this._keyTrunc=!1,this._valTrunc=!1,this._bytesKey=0,this._bytesVal=0,++this._fields>=this.fieldsLimit)return this.emit("fieldsLimit"),cb();continue main;case 43:this._lastPos<i&&(this._val+=chunk.latin1Slice(this._lastPos,i)),this._val+=" ",this._lastPos=i+1;break;case 37:if(this._encode===0&&(this._encode=1),this._lastPos<i&&(this._val+=chunk.latin1Slice(this._lastPos,i)),this._lastPos=i+1,this._byte=-1,i=readPctEnc(this,chunk,i+1,len),i===-1)return cb(new Error("Malformed urlencoded form"));if(i>=len)return cb();++this._bytesVal,i=skipValBytes(this,chunk,i,len);continue}++i,++this._bytesVal,i=skipValBytes(this,chunk,i,len)}this._lastPos<i&&(this._val+=chunk.latin1Slice(this._lastPos,i))}cb()}_final(cb){if(this._byte!==-2)return cb(new Error("Malformed urlencoded form"));(!this._inKey||this._bytesKey>0||this._bytesVal>0)&&(this._inKey?this._key=this._decoder(this._key,this._encode):this._val=this._decoder(this._val,this._encode),this.emit("field",this._key,this._val,{nameTruncated:this._keyTrunc,valueTruncated:this._valTrunc,encoding:this.charset,mimeType:"text/plain"})),cb()}};function readPctEnc(self2,chunk,pos,len){if(pos>=len)return len;if(self2._byte===-1){let hexUpper=HEX_VALUES[chunk[pos++]];if(hexUpper===-1)return-1;if(hexUpper>=8&&(self2._encode=2),pos<len){let hexLower=HEX_VALUES[chunk[pos++]];if(hexLower===-1)return-1;self2._inKey?self2._key+=String.fromCharCode((hexUpper<<4)+hexLower):self2._val+=String.fromCharCode((hexUpper<<4)+hexLower),self2._byte=-2,self2._lastPos=pos}else self2._byte=hexUpper}else{let hexLower=HEX_VALUES[chunk[pos++]];if(hexLower===-1)return-1;self2._inKey?self2._key+=String.fromCharCode((self2._byte<<4)+hexLower):self2._val+=String.fromCharCode((self2._byte<<4)+hexLower),self2._byte=-2,self2._lastPos=pos}return pos}function skipKeyBytes(self2,chunk,pos,len){if(self2._bytesKey>self2.fieldNameSizeLimit){for(self2._keyTrunc||self2._lastPos<pos&&(self2._key+=chunk.latin1Slice(self2._lastPos,pos-1)),self2._keyTrunc=!0;pos<len;++pos){let code=chunk[pos];if(code===61||code===38)break;++self2._bytesKey}self2._lastPos=pos}return pos}function skipValBytes(self2,chunk,pos,len){if(self2._bytesVal>self2.fieldSizeLimit){for(self2._valTrunc||self2._lastPos<pos&&(self2._val+=chunk.latin1Slice(self2._lastPos,pos-1)),self2._valTrunc=!0;pos<len&&chunk[pos]!==38;++pos)++self2._bytesVal;self2._lastPos=pos}return pos}var HEX_VALUES=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1];module2.exports=URLEncoded}});var require_lib5=__commonJS({"node_modules/busboy/lib/index.js"(exports2,module2){"use strict";var{parseContentType}=require_utils6();function getInstance(cfg){let headers=cfg.headers,conType=parseContentType(headers["content-type"]);if(!conType)throw new Error("Malformed content type");for(let type of TYPES){if(!type.detect(conType))continue;let instanceCfg={limits:cfg.limits,headers,conType,highWaterMark:void 0,fileHwm:void 0,defCharset:void 0,defParamCharset:void 0,preservePath:!1};return cfg.highWaterMark&&(instanceCfg.highWaterMark=cfg.highWaterMark),cfg.fileHwm&&(instanceCfg.fileHwm=cfg.fileHwm),instanceCfg.defCharset=cfg.defCharset,instanceCfg.defParamCharset=cfg.defParamCharset,instanceCfg.preservePath=cfg.preservePath,new type(instanceCfg)}throw new Error(`Unsupported content type: ${headers["content-type"]}`)}var TYPES=[require_multipart(),require_urlencoded2()].filter(function(typemod){return typeof typemod.detect=="function"});module2.exports=cfg=>{if((typeof cfg!="object"||cfg===null)&&(cfg={}),typeof cfg.headers!="object"||cfg.headers===null||typeof cfg.headers["content-type"]!="string")throw new Error("Missing Content-Type");return getInstance(cfg)}}});var require_parse_path=__commonJS({"node_modules/append-field/lib/parse-path.js"(exports2,module2){var reFirstKey=/^[^\[]*/,reDigitPath=/^\[(\d+)\]/,reNormalPath=/^\[([^\]]+)\]/;function parsePath(key){function failure(){return[{type:"object",key,last:!0}]}var firstKey=reFirstKey.exec(key)[0];if(!firstKey)return failure();for(var len=key.length,pos=firstKey.length,tail={type:"object",key:firstKey},steps=[tail];pos<len;){var m;if(key[pos]==="["&&key[pos+1]==="]"){if(pos+=2,tail.append=!0,pos!==len)return failure();continue}if(m=reDigitPath.exec(key.substring(pos)),m!==null){pos+=m[0].length,tail.nextType="array",tail={type:"array",key:parseInt(m[1],10)},steps.push(tail);continue}if(m=reNormalPath.exec(key.substring(pos)),m!==null){pos+=m[0].length,tail.nextType="object",tail={type:"object",key:m[1]},steps.push(tail);continue}return failure()}return tail.last=!0,steps}module2.exports=parsePath}});var require_set_value=__commonJS({"node_modules/append-field/lib/set-value.js"(exports2,module2){function valueType(value){return value===void 0?"undefined":Array.isArray(value)?"array":typeof value=="object"?"object":"scalar"}function setLastValue(context,step,currentValue,entryValue){switch(valueType(currentValue)){case"undefined":step.append?context[step.key]=[entryValue]:context[step.key]=entryValue;break;case"array":context[step.key].push(entryValue);break;case"object":return setLastValue(currentValue,{type:"object",key:"",last:!0},currentValue[""],entryValue);case"scalar":context[step.key]=[context[step.key],entryValue];break}return context}function setValue(context,step,currentValue,entryValue){if(step.last)return setLastValue(context,step,currentValue,entryValue);var obj;switch(valueType(currentValue)){case"undefined":return step.nextType==="array"?context[step.key]=[]:context[step.key]=Object.create(null),context[step.key];case"object":return context[step.key];case"array":return step.nextType==="array"?currentValue:(obj=Object.create(null),context[step.key]=obj,currentValue.forEach(function(item,i){item!==void 0&&(obj[""+i]=item)}),obj);case"scalar":return obj=Object.create(null),obj[""]=currentValue,context[step.key]=obj,obj}}module2.exports=setValue}});var require_append_field=__commonJS({"node_modules/append-field/index.js"(exports2,module2){var parsePath=require_parse_path(),setValue=require_set_value();function appendField(store,key,value){var steps=parsePath(key);steps.reduce(function(context,step){return setValue(context,step,context[step.key],value)},store)}module2.exports=appendField}});var require_counter=__commonJS({"node_modules/multer/lib/counter.js"(exports2,module2){var EventEmitter=require("events").EventEmitter;function Counter(){EventEmitter.call(this),this.value=0}Counter.prototype=Object.create(EventEmitter.prototype);Counter.prototype.increment=function(){this.value++};Counter.prototype.decrement=function(){--this.value===0&&this.emit("zero")};Counter.prototype.isZero=function(){return this.value===0};Counter.prototype.onceZero=function(fn){if(this.isZero())return fn();this.once("zero",fn)};module2.exports=Counter}});var require_multer_error=__commonJS({"node_modules/multer/lib/multer-error.js"(exports2,module2){var util=require("util"),errorMessages={LIMIT_PART_COUNT:"Too many parts",LIMIT_FILE_SIZE:"File too large",LIMIT_FILE_COUNT:"Too many files",LIMIT_FIELD_KEY:"Field name too long",LIMIT_FIELD_VALUE:"Field value too long",LIMIT_FIELD_COUNT:"Too many fields",LIMIT_UNEXPECTED_FILE:"Unexpected field",MISSING_FIELD_NAME:"Field name missing",LIMIT_FIELD_NESTING:"Field name nesting too deep"};function MulterError(code,field){Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message=errorMessages[code],this.code=code,field&&(this.field=field)}util.inherits(MulterError,Error);module2.exports=MulterError}});var require_file_appender=__commonJS({"node_modules/multer/lib/file-appender.js"(exports2,module2){function arrayRemove(arr,item){var idx=arr.indexOf(item);~idx&&arr.splice(idx,1)}function FileAppender(strategy,req){switch(this.strategy=strategy,this.req=req,strategy){case"NONE":break;case"VALUE":break;case"ARRAY":req.files=[];break;case"OBJECT":req.files=Object.create(null);break;default:throw new Error("Unknown file strategy: "+strategy)}}FileAppender.prototype.insertPlaceholder=function(file){var placeholder={fieldname:file.fieldname};switch(this.strategy){case"NONE":break;case"VALUE":break;case"ARRAY":this.req.files.push(placeholder);break;case"OBJECT":this.req.files[file.fieldname]?this.req.files[file.fieldname].push(placeholder):this.req.files[file.fieldname]=[placeholder];break}return placeholder};FileAppender.prototype.removePlaceholder=function(placeholder){switch(this.strategy){case"NONE":break;case"VALUE":break;case"ARRAY":arrayRemove(this.req.files,placeholder);break;case"OBJECT":this.req.files[placeholder.fieldname].length===1?delete this.req.files[placeholder.fieldname]:arrayRemove(this.req.files[placeholder.fieldname],placeholder);break}};FileAppender.prototype.replacePlaceholder=function(placeholder,file){if(this.strategy==="VALUE"){this.req.file=file;return}delete placeholder.fieldname,Object.assign(placeholder,file)};module2.exports=FileAppender}});var require_remove_uploaded_files=__commonJS({"node_modules/multer/lib/remove-uploaded-files.js"(exports2,module2){function removeUploadedFiles(uploadedFiles,remove,cb){var length=uploadedFiles.length,errors=[];if(length===0)return cb(null,errors);function handleFile(idx){var file=uploadedFiles[idx];remove(file,function(err){err&&(err.file=file,err.field=file.fieldname,errors.push(err)),idx<length-1?setImmediate(function(){handleFile(idx+1)}):cb(null,errors)})}handleFile(0)}module2.exports=removeUploadedFiles}});var require_make_middleware=__commonJS({"node_modules/multer/lib/make-middleware.js"(exports2,module2){var is=require_type_is(),Busboy=require_lib5(),appendField=require_append_field(),Counter=require_counter(),MulterError=require_multer_error(),FileAppender=require_file_appender(),removeUploadedFiles=require_remove_uploaded_files();function drainStream(stream){stream.on("readable",()=>{for(;stream.read()!==null;);})}function makeMiddleware(setup){return function(req,res,next){if(!is(req,["multipart"]))return next();var options=setup(),limits=options.limits,storage=options.storage,fileFilter=options.fileFilter,fileStrategy=options.fileStrategy,preservePath=options.preservePath,defParamCharset=options.defParamCharset;req.body=Object.create(null);var busboy,appender=null,isDone=!1,readFinished=!1,errorOccured=!1,pendingWrites=new Counter,uploadedFiles=[],pendingFiles=[];function done(err){var called=!1;function onFinished(){called||(called=!0,next(err))}if(!isDone){if(isDone=!0,busboy&&(req.unpipe(busboy),setImmediate(()=>{busboy.removeAllListeners()})),drainStream(req),req.resume(),err&&req.readable&&!req.destroyed){req.once("end",onFinished),req.once("error",onFinished),req.once("close",onFinished);return}next(err)}}function indicateDone(){readFinished&&pendingWrites.isZero()&&!errorOccured&&done()}function abortWithError(uploadError,skipPendingWait){if(errorOccured)return;errorOccured=!0;function finishAbort(){function remove(file,cb){storage._removeFile(req,file,cb)}var filesToRemove=uploadedFiles.concat(pendingFiles.filter(function(f){return f.path}));pendingFiles=[],removeUploadedFiles(filesToRemove,remove,function(err,storageErrors){if(err)return done(err);uploadError.storageErrors=storageErrors,done(uploadError)})}skipPendingWait?finishAbort():pendingWrites.onceZero(finishAbort)}function abortWithCode(code,optionalField){abortWithError(new MulterError(code,optionalField))}function handleRequestFailure(err){isDone||(busboy&&(req.unpipe(busboy),busboy.destroy(err)),abortWithError(err,!0))}req.on("error",function(err){handleRequestFailure(err||new Error("Request error"))}),req.on("aborted",function(){handleRequestFailure(new Error("Request aborted"))}),req.on("close",function(){req.readableEnded||handleRequestFailure(new Error("Request closed"))});try{busboy=Busboy({headers:req.headers,limits,preservePath,defParamCharset})}catch(err){return next(err)}appender=new FileAppender(fileStrategy,req),busboy.on("field",function(fieldname,value,{nameTruncated,valueTruncated}){if(fieldname==null)return abortWithCode("MISSING_FIELD_NAME");if(nameTruncated)return abortWithCode("LIMIT_FIELD_KEY");if(valueTruncated)return abortWithCode("LIMIT_FIELD_VALUE",fieldname);if(limits&&Object.prototype.hasOwnProperty.call(limits,"fieldNameSize")&&fieldname.length>limits.fieldNameSize)return abortWithCode("LIMIT_FIELD_KEY");if(limits&&Object.prototype.hasOwnProperty.call(limits,"fieldNestingDepth")&&fieldname.split("[").length-1>limits.fieldNestingDepth)return abortWithCode("LIMIT_FIELD_NESTING",fieldname);appendField(req.body,fieldname,value)}),busboy.on("file",function(fieldname,fileStream,{filename,encoding,mimeType}){var pendingWritesIncremented=!1;if(fileStream.on("error",function(err){pendingWritesIncremented&&pendingWrites.decrement(),abortWithError(err)}),fieldname==null)return abortWithCode("MISSING_FIELD_NAME");if(!filename)return fileStream.resume();if(limits&&Object.prototype.hasOwnProperty.call(limits,"fieldNameSize")&&fieldname.length>limits.fieldNameSize)return abortWithCode("LIMIT_FIELD_KEY");var file={fieldname,originalname:filename,encoding,mimetype:mimeType},placeholder=appender.insertPlaceholder(file);fileFilter(req,file,function(err,includeFile){if(errorOccured)return appender.removePlaceholder(placeholder),fileStream.resume();if(err)return appender.removePlaceholder(placeholder),abortWithError(err);if(!includeFile)return appender.removePlaceholder(placeholder),fileStream.resume();var aborting=!1;pendingWritesIncremented=!0,pendingWrites.increment(),Object.defineProperty(file,"stream",{configurable:!0,enumerable:!1,value:fileStream}),fileStream.on("limit",function(){aborting=!0,abortWithCode("LIMIT_FILE_SIZE",fieldname)}),pendingFiles.push(file),storage._handleFile(req,file,function(err2,info){var idx=pendingFiles.indexOf(file);if(idx!==-1&&pendingFiles.splice(idx,1),aborting)return appender.removePlaceholder(placeholder),uploadedFiles.push({...file,...info}),pendingWrites.decrement();if(err2)return appender.removePlaceholder(placeholder),pendingWrites.decrement(),abortWithError(err2);var fileInfo={...file,...info};appender.replacePlaceholder(placeholder,fileInfo),uploadedFiles.push(fileInfo),pendingWrites.decrement(),indicateDone()})})}),busboy.on("error",function(err){abortWithError(err)}),busboy.on("partsLimit",function(){abortWithCode("LIMIT_PART_COUNT")}),busboy.on("filesLimit",function(){abortWithCode("LIMIT_FILE_COUNT")}),busboy.on("fieldsLimit",function(){abortWithCode("LIMIT_FIELD_COUNT")}),busboy.on("close",function(){readFinished=!0,indicateDone()}),req.pipe(busboy)}}module2.exports=makeMiddleware}});var require_disk=__commonJS({"node_modules/multer/storage/disk.js"(exports2,module2){var fs=require("fs"),os=require("os"),path=require("path"),crypto=require("crypto");function getFilename(req,file,cb){crypto.randomBytes(16,function(err,raw){cb(err,err?void 0:raw.toString("hex"))})}function getDestination(req,file,cb){cb(null,os.tmpdir())}function DiskStorage(opts){this.getFilename=opts.filename||getFilename,typeof opts.destination=="string"?(fs.mkdirSync(opts.destination,{recursive:!0}),this.getDestination=function($0,$1,cb){cb(null,opts.destination)}):this.getDestination=opts.destination||getDestination}DiskStorage.prototype._handleFile=function(req,file,cb){var that=this;that.getDestination(req,file,function(err,destination){if(err)return cb(err);that.getFilename(req,file,function(err2,filename){if(err2)return cb(err2);var finalPath=path.join(destination,filename);if(!file.stream.destroyed){var outStream=fs.createWriteStream(finalPath);file.path=finalPath,file.stream.pipe(outStream),outStream.on("error",cb),outStream.on("finish",function(){cb(null,{destination,filename,path:finalPath,size:outStream.bytesWritten})})}})})};DiskStorage.prototype._removeFile=function(req,file,cb){var path2=file.path;delete file.destination,delete file.filename,delete file.path,fs.unlink(path2,cb)};module2.exports=function(opts){return new DiskStorage(opts)}}});var require_stream3=__commonJS({"node_modules/readable-stream/lib/internal/streams/stream.js"(exports2,module2){module2.exports=require("stream")}});var require_buffer_list=__commonJS({"node_modules/readable-stream/lib/internal/streams/buffer_list.js"(exports2,module2){"use strict";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor)}}function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Object.defineProperty(Constructor,"prototype",{writable:!1}),Constructor}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return typeof key=="symbol"?key:String(key)}function _toPrimitive(input,hint){if(typeof input!="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if(typeof res!="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return(hint==="string"?String:Number)(input)}var _require=require("buffer"),Buffer2=_require.Buffer,_require2=require("util"),inspect=_require2.inspect,custom=inspect&&inspect.custom||"inspect";function copyBuffer(src,target,offset){Buffer2.prototype.copy.call(src,target,offset)}module2.exports=(function(){function BufferList(){_classCallCheck(this,BufferList),this.head=null,this.tail=null,this.length=0}return _createClass(BufferList,[{key:"push",value:function(v){var entry={data:v,next:null};this.length>0?this.tail.next=entry:this.head=entry,this.tail=entry,++this.length}},{key:"unshift",value:function(v){var entry={data:v,next:this.head};this.length===0&&(this.tail=entry),this.head=entry,++this.length}},{key:"shift",value:function(){if(this.length!==0){var ret=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,ret}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(s){if(this.length===0)return"";for(var p=this.head,ret=""+p.data;p=p.next;)ret+=s+p.data;return ret}},{key:"concat",value:function(n){if(this.length===0)return Buffer2.alloc(0);for(var ret=Buffer2.allocUnsafe(n>>>0),p=this.head,i=0;p;)copyBuffer(p.data,ret,i),i+=p.data.length,p=p.next;return ret}},{key:"consume",value:function(n,hasStrings){var ret;return n<this.head.data.length?(ret=this.head.data.slice(0,n),this.head.data=this.head.data.slice(n)):n===this.head.data.length?ret=this.shift():ret=hasStrings?this._getString(n):this._getBuffer(n),ret}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(n){var p=this.head,c=1,ret=p.data;for(n-=ret.length;p=p.next;){var str=p.data,nb=n>str.length?str.length:n;if(nb===str.length?ret+=str:ret+=str.slice(0,n),n-=nb,n===0){nb===str.length?(++c,p.next?this.head=p.next:this.head=this.tail=null):(this.head=p,p.data=str.slice(nb));break}++c}return this.length-=c,ret}},{key:"_getBuffer",value:function(n){var ret=Buffer2.allocUnsafe(n),p=this.head,c=1;for(p.data.copy(ret),n-=p.data.length;p=p.next;){var buf=p.data,nb=n>buf.length?buf.length:n;if(buf.copy(ret,ret.length-n,0,nb),n-=nb,n===0){nb===buf.length?(++c,p.next?this.head=p.next:this.head=this.tail=null):(this.head=p,p.data=buf.slice(nb));break}++c}return this.length-=c,ret}},{key:custom,value:function(_,options){return inspect(this,_objectSpread(_objectSpread({},options),{},{depth:0,customInspect:!1}))}}]),BufferList})()}});var require_destroy2=__commonJS({"node_modules/readable-stream/lib/internal/streams/destroy.js"(exports2,module2){"use strict";function destroy(err,cb){var _this=this,readableDestroyed=this._readableState&&this._readableState.destroyed,writableDestroyed=this._writableState&&this._writableState.destroyed;return readableDestroyed||writableDestroyed?(cb?cb(err):err&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(emitErrorNT,this,err)):process.nextTick(emitErrorNT,this,err)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(err||null,function(err2){!cb&&err2?_this._writableState?_this._writableState.errorEmitted?process.nextTick(emitCloseNT,_this):(_this._writableState.errorEmitted=!0,process.nextTick(emitErrorAndCloseNT,_this,err2)):process.nextTick(emitErrorAndCloseNT,_this,err2):cb?(process.nextTick(emitCloseNT,_this),cb(err2)):process.nextTick(emitCloseNT,_this)}),this)}function emitErrorAndCloseNT(self2,err){emitErrorNT(self2,err),emitCloseNT(self2)}function emitCloseNT(self2){self2._writableState&&!self2._writableState.emitClose||self2._readableState&&!self2._readableState.emitClose||self2.emit("close")}function undestroy(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function emitErrorNT(self2,err){self2.emit("error",err)}function errorOrDestroy(stream,err){var rState=stream._readableState,wState=stream._writableState;rState&&rState.autoDestroy||wState&&wState.autoDestroy?stream.destroy(err):stream.emit("error",err)}module2.exports={destroy,undestroy,errorOrDestroy}}});var require_errors=__commonJS({"node_modules/readable-stream/errors.js"(exports2,module2){"use strict";var codes={};function createErrorType(code,message,Base){Base||(Base=Error);function getMessage(arg1,arg2,arg3){return typeof message=="string"?message:message(arg1,arg2,arg3)}class NodeError extends Base{constructor(arg1,arg2,arg3){super(getMessage(arg1,arg2,arg3))}}NodeError.prototype.name=Base.name,NodeError.prototype.code=code,codes[code]=NodeError}function oneOf(expected,thing){if(Array.isArray(expected)){let len=expected.length;return expected=expected.map(i=>String(i)),len>2?`one of ${thing} ${expected.slice(0,len-1).join(", ")}, or `+expected[len-1]:len===2?`one of ${thing} ${expected[0]} or ${expected[1]}`:`of ${thing} ${expected[0]}`}else return`of ${thing} ${String(expected)}`}function startsWith(str,search,pos){return str.substr(!pos||pos<0?0:+pos,search.length)===search}function endsWith(str,search,this_len){return(this_len===void 0||this_len>str.length)&&(this_len=str.length),str.substring(this_len-search.length,this_len)===search}function includes(str,search,start){return typeof start!="number"&&(start=0),start+search.length>str.length?!1:str.indexOf(search,start)!==-1}createErrorType("ERR_INVALID_OPT_VALUE",function(name,value){return'The value "'+value+'" is invalid for option "'+name+'"'},TypeError);createErrorType("ERR_INVALID_ARG_TYPE",function(name,expected,actual){let determiner;typeof expected=="string"&&startsWith(expected,"not ")?(determiner="must not be",expected=expected.replace(/^not /,"")):determiner="must be";let msg;if(endsWith(name," argument"))msg=`The ${name} ${determiner} ${oneOf(expected,"type")}`;else{let type=includes(name,".")?"property":"argument";msg=`The "${name}" ${type} ${determiner} ${oneOf(expected,"type")}`}return msg+=`. Received type ${typeof actual}`,msg},TypeError);createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");createErrorType("ERR_METHOD_NOT_IMPLEMENTED",function(name){return"The "+name+" method is not implemented"});createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close");createErrorType("ERR_STREAM_DESTROYED",function(name){return"Cannot call "+name+" after a stream was destroyed"});createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times");createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end");createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);createErrorType("ERR_UNKNOWN_ENCODING",function(arg){return"Unknown encoding: "+arg},TypeError);createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");module2.exports.codes=codes}});var require_state=__commonJS({"node_modules/readable-stream/lib/internal/streams/state.js"(exports2,module2){"use strict";var ERR_INVALID_OPT_VALUE=require_errors().codes.ERR_INVALID_OPT_VALUE;function highWaterMarkFrom(options,isDuplex,duplexKey){return options.highWaterMark!=null?options.highWaterMark:isDuplex?options[duplexKey]:null}function getHighWaterMark(state,options,duplexKey,isDuplex){var hwm=highWaterMarkFrom(options,isDuplex,duplexKey);if(hwm!=null){if(!(isFinite(hwm)&&Math.floor(hwm)===hwm)||hwm<0){var name=isDuplex?duplexKey:"highWaterMark";throw new ERR_INVALID_OPT_VALUE(name,hwm)}return Math.floor(hwm)}return state.objectMode?16:16*1024}module2.exports={getHighWaterMark}}});var require_node9=__commonJS({"node_modules/util-deprecate/node.js"(exports2,module2){module2.exports=require("util").deprecate}});var require_stream_writable=__commonJS({"node_modules/readable-stream/lib/_stream_writable.js"(exports2,module2){"use strict";module2.exports=Writable;function CorkedRequest(state){var _this=this;this.next=null,this.entry=null,this.finish=function(){onCorkedFinish(_this,state)}}var Duplex;Writable.WritableState=WritableState;var internalUtil={deprecate:require_node9()},Stream=require_stream3(),Buffer2=require("buffer").Buffer,OurUint8Array=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function _uint8ArrayToBuffer(chunk){return Buffer2.from(chunk)}function _isUint8Array(obj){return Buffer2.isBuffer(obj)||obj instanceof OurUint8Array}var destroyImpl=require_destroy2(),_require=require_state(),getHighWaterMark=_require.getHighWaterMark,_require$codes=require_errors().codes,ERR_INVALID_ARG_TYPE=_require$codes.ERR_INVALID_ARG_TYPE,ERR_METHOD_NOT_IMPLEMENTED=_require$codes.ERR_METHOD_NOT_IMPLEMENTED,ERR_MULTIPLE_CALLBACK=_require$codes.ERR_MULTIPLE_CALLBACK,ERR_STREAM_CANNOT_PIPE=_require$codes.ERR_STREAM_CANNOT_PIPE,ERR_STREAM_DESTROYED=_require$codes.ERR_STREAM_DESTROYED,ERR_STREAM_NULL_VALUES=_require$codes.ERR_STREAM_NULL_VALUES,ERR_STREAM_WRITE_AFTER_END=_require$codes.ERR_STREAM_WRITE_AFTER_END,ERR_UNKNOWN_ENCODING=_require$codes.ERR_UNKNOWN_ENCODING,errorOrDestroy=destroyImpl.errorOrDestroy;require_inherits()(Writable,Stream);function nop(){}function WritableState(options,stream,isDuplex){Duplex=Duplex||require_stream_duplex(),options=options||{},typeof isDuplex!="boolean"&&(isDuplex=stream instanceof Duplex),this.objectMode=!!options.objectMode,isDuplex&&(this.objectMode=this.objectMode||!!options.writableObjectMode),this.highWaterMark=getHighWaterMark(this,options,"writableHighWaterMark",isDuplex),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var noDecode=options.decodeStrings===!1;this.decodeStrings=!noDecode,this.defaultEncoding=options.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(er){onwrite(stream,er)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=options.emitClose!==!1,this.autoDestroy=!!options.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new CorkedRequest(this)}WritableState.prototype.getBuffer=function(){for(var current=this.bufferedRequest,out=[];current;)out.push(current),current=current.next;return out};(function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:internalUtil.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var realHasInstance;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(realHasInstance=Function.prototype[Symbol.hasInstance],Object.defineProperty(Writable,Symbol.hasInstance,{value:function(object){return realHasInstance.call(this,object)?!0:this!==Writable?!1:object&&object._writableState instanceof WritableState}})):realHasInstance=function(object){return object instanceof this};function Writable(options){Duplex=Duplex||require_stream_duplex();var isDuplex=this instanceof Duplex;if(!isDuplex&&!realHasInstance.call(Writable,this))return new Writable(options);this._writableState=new WritableState(options,this,isDuplex),this.writable=!0,options&&(typeof options.write=="function"&&(this._write=options.write),typeof options.writev=="function"&&(this._writev=options.writev),typeof options.destroy=="function"&&(this._destroy=options.destroy),typeof options.final=="function"&&(this._final=options.final)),Stream.call(this)}Writable.prototype.pipe=function(){errorOrDestroy(this,new ERR_STREAM_CANNOT_PIPE)};function writeAfterEnd(stream,cb){var er=new ERR_STREAM_WRITE_AFTER_END;errorOrDestroy(stream,er),process.nextTick(cb,er)}function validChunk(stream,state,chunk,cb){var er;return chunk===null?er=new ERR_STREAM_NULL_VALUES:typeof chunk!="string"&&!state.objectMode&&(er=new ERR_INVALID_ARG_TYPE("chunk",["string","Buffer"],chunk)),er?(errorOrDestroy(stream,er),process.nextTick(cb,er),!1):!0}Writable.prototype.write=function(chunk,encoding,cb){var state=this._writableState,ret=!1,isBuf=!state.objectMode&&_isUint8Array(chunk);return isBuf&&!Buffer2.isBuffer(chunk)&&(chunk=_uint8ArrayToBuffer(chunk)),typeof encoding=="function"&&(cb=encoding,encoding=null),isBuf?encoding="buffer":encoding||(encoding=state.defaultEncoding),typeof cb!="function"&&(cb=nop),state.ending?writeAfterEnd(this,cb):(isBuf||validChunk(this,state,chunk,cb))&&(state.pendingcb++,ret=writeOrBuffer(this,state,isBuf,chunk,encoding,cb)),ret};Writable.prototype.cork=function(){this._writableState.corked++};Writable.prototype.uncork=function(){var state=this._writableState;state.corked&&(state.corked--,!state.writing&&!state.corked&&!state.bufferProcessing&&state.bufferedRequest&&clearBuffer(this,state))};Writable.prototype.setDefaultEncoding=function(encoding){if(typeof encoding=="string"&&(encoding=encoding.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((encoding+"").toLowerCase())>-1))throw new ERR_UNKNOWN_ENCODING(encoding);return this._writableState.defaultEncoding=encoding,this};Object.defineProperty(Writable.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function decodeChunk(state,chunk,encoding){return!state.objectMode&&state.decodeStrings!==!1&&typeof chunk=="string"&&(chunk=Buffer2.from(chunk,encoding)),chunk}Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function writeOrBuffer(stream,state,isBuf,chunk,encoding,cb){if(!isBuf){var newChunk=decodeChunk(state,chunk,encoding);chunk!==newChunk&&(isBuf=!0,encoding="buffer",chunk=newChunk)}var len=state.objectMode?1:chunk.length;state.length+=len;var ret=state.length<state.highWaterMark;if(ret||(state.needDrain=!0),state.writing||state.corked){var last=state.lastBufferedRequest;state.lastBufferedRequest={chunk,encoding,isBuf,callback:cb,next:null},last?last.next=state.lastBufferedRequest:state.bufferedRequest=state.lastBufferedRequest,state.bufferedRequestCount+=1}else doWrite(stream,state,!1,len,chunk,encoding,cb);return ret}function doWrite(stream,state,writev,len,chunk,encoding,cb){state.writelen=len,state.writecb=cb,state.writing=!0,state.sync=!0,state.destroyed?state.onwrite(new ERR_STREAM_DESTROYED("write")):writev?stream._writev(chunk,state.onwrite):stream._write(chunk,encoding,state.onwrite),state.sync=!1}function onwriteError(stream,state,sync,er,cb){--state.pendingcb,sync?(process.nextTick(cb,er),process.nextTick(finishMaybe,stream,state),stream._writableState.errorEmitted=!0,errorOrDestroy(stream,er)):(cb(er),stream._writableState.errorEmitted=!0,errorOrDestroy(stream,er),finishMaybe(stream,state))}function onwriteStateUpdate(state){state.writing=!1,state.writecb=null,state.length-=state.writelen,state.writelen=0}function onwrite(stream,er){var state=stream._writableState,sync=state.sync,cb=state.writecb;if(typeof cb!="function")throw new ERR_MULTIPLE_CALLBACK;if(onwriteStateUpdate(state),er)onwriteError(stream,state,sync,er,cb);else{var finished=needFinish(state)||stream.destroyed;!finished&&!state.corked&&!state.bufferProcessing&&state.bufferedRequest&&clearBuffer(stream,state),sync?process.nextTick(afterWrite,stream,state,finished,cb):afterWrite(stream,state,finished,cb)}}function afterWrite(stream,state,finished,cb){finished||onwriteDrain(stream,state),state.pendingcb--,cb(),finishMaybe(stream,state)}function onwriteDrain(stream,state){state.length===0&&state.needDrain&&(state.needDrain=!1,stream.emit("drain"))}function clearBuffer(stream,state){state.bufferProcessing=!0;var entry=state.bufferedRequest;if(stream._writev&&entry&&entry.next){var l=state.bufferedRequestCount,buffer=new Array(l),holder=state.corkedRequestsFree;holder.entry=entry;for(var count=0,allBuffers=!0;entry;)buffer[count]=entry,entry.isBuf||(allBuffers=!1),entry=entry.next,count+=1;buffer.allBuffers=allBuffers,doWrite(stream,state,!0,state.length,buffer,"",holder.finish),state.pendingcb++,state.lastBufferedRequest=null,holder.next?(state.corkedRequestsFree=holder.next,holder.next=null):state.corkedRequestsFree=new CorkedRequest(state),state.bufferedRequestCount=0}else{for(;entry;){var chunk=entry.chunk,encoding=entry.encoding,cb=entry.callback,len=state.objectMode?1:chunk.length;if(doWrite(stream,state,!1,len,chunk,encoding,cb),entry=entry.next,state.bufferedRequestCount--,state.writing)break}entry===null&&(state.lastBufferedRequest=null)}state.bufferedRequest=entry,state.bufferProcessing=!1}Writable.prototype._write=function(chunk,encoding,cb){cb(new ERR_METHOD_NOT_IMPLEMENTED("_write()"))};Writable.prototype._writev=null;Writable.prototype.end=function(chunk,encoding,cb){var state=this._writableState;return typeof chunk=="function"?(cb=chunk,chunk=null,encoding=null):typeof encoding=="function"&&(cb=encoding,encoding=null),chunk!=null&&this.write(chunk,encoding),state.corked&&(state.corked=1,this.uncork()),state.ending||endWritable(this,state,cb),this};Object.defineProperty(Writable.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function needFinish(state){return state.ending&&state.length===0&&state.bufferedRequest===null&&!state.finished&&!state.writing}function callFinal(stream,state){stream._final(function(err){state.pendingcb--,err&&errorOrDestroy(stream,err),state.prefinished=!0,stream.emit("prefinish"),finishMaybe(stream,state)})}function prefinish(stream,state){!state.prefinished&&!state.finalCalled&&(typeof stream._final=="function"&&!state.destroyed?(state.pendingcb++,state.finalCalled=!0,process.nextTick(callFinal,stream,state)):(state.prefinished=!0,stream.emit("prefinish")))}function finishMaybe(stream,state){var need=needFinish(state);if(need&&(prefinish(stream,state),state.pendingcb===0&&(state.finished=!0,stream.emit("finish"),state.autoDestroy))){var rState=stream._readableState;(!rState||rState.autoDestroy&&rState.endEmitted)&&stream.destroy()}return need}function endWritable(stream,state,cb){state.ending=!0,finishMaybe(stream,state),cb&&(state.finished?process.nextTick(cb):stream.once("finish",cb)),state.ended=!0,stream.writable=!1}function onCorkedFinish(corkReq,state,err){var entry=corkReq.entry;for(corkReq.entry=null;entry;){var cb=entry.callback;state.pendingcb--,cb(err),entry=entry.next}state.corkedRequestsFree.next=corkReq}Object.defineProperty(Writable.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(value){this._writableState&&(this._writableState.destroyed=value)}});Writable.prototype.destroy=destroyImpl.destroy;Writable.prototype._undestroy=destroyImpl.undestroy;Writable.prototype._destroy=function(err,cb){cb(err)}}});var require_stream_duplex=__commonJS({"node_modules/readable-stream/lib/_stream_duplex.js"(exports2,module2){"use strict";var objectKeys=Object.keys||function(obj){var keys2=[];for(var key in obj)keys2.push(key);return keys2};module2.exports=Duplex;var Readable=require_stream_readable(),Writable=require_stream_writable();require_inherits()(Duplex,Readable);for(keys=objectKeys(Writable.prototype),v=0;v<keys.length;v++)method=keys[v],Duplex.prototype[method]||(Duplex.prototype[method]=Writable.prototype[method]);var keys,method,v;function Duplex(options){if(!(this instanceof Duplex))return new Duplex(options);Readable.call(this,options),Writable.call(this,options),this.allowHalfOpen=!0,options&&(options.readable===!1&&(this.readable=!1),options.writable===!1&&(this.writable=!1),options.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",onend)))}Object.defineProperty(Duplex.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});Object.defineProperty(Duplex.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});Object.defineProperty(Duplex.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function onend(){this._writableState.ended||process.nextTick(onEndNT,this)}function onEndNT(self2){self2.end()}Object.defineProperty(Duplex.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(value){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=value,this._writableState.destroyed=value)}})}});var require_string_decoder=__commonJS({"node_modules/string_decoder/lib/string_decoder.js"(exports2){"use strict";var Buffer2=require_safe_buffer().Buffer,isEncoding=Buffer2.isEncoding||function(encoding){switch(encoding=""+encoding,encoding&&encoding.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function _normalizeEncoding(enc){if(!enc)return"utf8";for(var retried;;)switch(enc){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return enc;default:if(retried)return;enc=(""+enc).toLowerCase(),retried=!0}}function normalizeEncoding(enc){var nenc=_normalizeEncoding(enc);if(typeof nenc!="string"&&(Buffer2.isEncoding===isEncoding||!isEncoding(enc)))throw new Error("Unknown encoding: "+enc);return nenc||enc}exports2.StringDecoder=StringDecoder;function StringDecoder(encoding){this.encoding=normalizeEncoding(encoding);var nb;switch(this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,nb=4;break;case"utf8":this.fillLast=utf8FillLast,nb=4;break;case"base64":this.text=base64Text,this.end=base64End,nb=3;break;default:this.write=simpleWrite,this.end=simpleEnd;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Buffer2.allocUnsafe(nb)}StringDecoder.prototype.write=function(buf){if(buf.length===0)return"";var r,i;if(this.lastNeed){if(r=this.fillLast(buf),r===void 0)return"";i=this.lastNeed,this.lastNeed=0}else i=0;return i<buf.length?r?r+this.text(buf,i):this.text(buf,i):r||""};StringDecoder.prototype.end=utf8End;StringDecoder.prototype.text=utf8Text;StringDecoder.prototype.fillLast=function(buf){if(this.lastNeed<=buf.length)return buf.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);buf.copy(this.lastChar,this.lastTotal-this.lastNeed,0,buf.length),this.lastNeed-=buf.length};function utf8CheckByte(byte){return byte<=127?0:byte>>5===6?2:byte>>4===14?3:byte>>3===30?4:byte>>6===2?-1:-2}function utf8CheckIncomplete(self2,buf,i){var j=buf.length-1;if(j<i)return 0;var nb=utf8CheckByte(buf[j]);return nb>=0?(nb>0&&(self2.lastNeed=nb-1),nb):--j<i||nb===-2?0:(nb=utf8CheckByte(buf[j]),nb>=0?(nb>0&&(self2.lastNeed=nb-2),nb):--j<i||nb===-2?0:(nb=utf8CheckByte(buf[j]),nb>=0?(nb>0&&(nb===2?nb=0:self2.lastNeed=nb-3),nb):0))}function utf8CheckExtraBytes(self2,buf,p){if((buf[0]&192)!==128)return self2.lastNeed=0,"\uFFFD";if(self2.lastNeed>1&&buf.length>1){if((buf[1]&192)!==128)return self2.lastNeed=1,"\uFFFD";if(self2.lastNeed>2&&buf.length>2&&(buf[2]&192)!==128)return self2.lastNeed=2,"\uFFFD"}}function utf8FillLast(buf){var p=this.lastTotal-this.lastNeed,r=utf8CheckExtraBytes(this,buf,p);if(r!==void 0)return r;if(this.lastNeed<=buf.length)return buf.copy(this.lastChar,p,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);buf.copy(this.lastChar,p,0,buf.length),this.lastNeed-=buf.length}function utf8Text(buf,i){var total=utf8CheckIncomplete(this,buf,i);if(!this.lastNeed)return buf.toString("utf8",i);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);return buf.copy(this.lastChar,0,end),buf.toString("utf8",i,end)}function utf8End(buf){var r=buf&&buf.length?this.write(buf):"";return this.lastNeed?r+"\uFFFD":r}function utf16Text(buf,i){if((buf.length-i)%2===0){var r=buf.toString("utf16le",i);if(r){var c=r.charCodeAt(r.length-1);if(c>=55296&&c<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=buf[buf.length-2],this.lastChar[1]=buf[buf.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=buf[buf.length-1],buf.toString("utf16le",i,buf.length-1)}function utf16End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed){var end=this.lastTotal-this.lastNeed;return r+this.lastChar.toString("utf16le",0,end)}return r}function base64Text(buf,i){var n=(buf.length-i)%3;return n===0?buf.toString("base64",i):(this.lastNeed=3-n,this.lastTotal=3,n===1?this.lastChar[0]=buf[buf.length-1]:(this.lastChar[0]=buf[buf.length-2],this.lastChar[1]=buf[buf.length-1]),buf.toString("base64",i,buf.length-n))}function base64End(buf){var r=buf&&buf.length?this.write(buf):"";return this.lastNeed?r+this.lastChar.toString("base64",0,3-this.lastNeed):r}function simpleWrite(buf){return buf.toString(this.encoding)}function simpleEnd(buf){return buf&&buf.length?this.write(buf):""}}});var require_end_of_stream=__commonJS({"node_modules/readable-stream/lib/internal/streams/end-of-stream.js"(exports2,module2){"use strict";var ERR_STREAM_PREMATURE_CLOSE=require_errors().codes.ERR_STREAM_PREMATURE_CLOSE;function once(callback){var called=!1;return function(){if(!called){called=!0;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];callback.apply(this,args)}}}function noop(){}function isRequest(stream){return stream.setHeader&&typeof stream.abort=="function"}function eos(stream,opts,callback){if(typeof opts=="function")return eos(stream,null,opts);opts||(opts={}),callback=once(callback||noop);var readable=opts.readable||opts.readable!==!1&&stream.readable,writable=opts.writable||opts.writable!==!1&&stream.writable,onlegacyfinish=function(){stream.writable||onfinish()},writableEnded=stream._writableState&&stream._writableState.finished,onfinish=function(){writable=!1,writableEnded=!0,readable||callback.call(stream)},readableEnded=stream._readableState&&stream._readableState.endEmitted,onend=function(){readable=!1,readableEnded=!0,writable||callback.call(stream)},onerror=function(err){callback.call(stream,err)},onclose=function(){var err;if(readable&&!readableEnded)return(!stream._readableState||!stream._readableState.ended)&&(err=new ERR_STREAM_PREMATURE_CLOSE),callback.call(stream,err);if(writable&&!writableEnded)return(!stream._writableState||!stream._writableState.ended)&&(err=new ERR_STREAM_PREMATURE_CLOSE),callback.call(stream,err)},onrequest=function(){stream.req.on("finish",onfinish)};return isRequest(stream)?(stream.on("complete",onfinish),stream.on("abort",onclose),stream.req?onrequest():stream.on("request",onrequest)):writable&&!stream._writableState&&(stream.on("end",onlegacyfinish),stream.on("close",onlegacyfinish)),stream.on("end",onend),stream.on("finish",onfinish),opts.error!==!1&&stream.on("error",onerror),stream.on("close",onclose),function(){stream.removeListener("complete",onfinish),stream.removeListener("abort",onclose),stream.removeListener("request",onrequest),stream.req&&stream.req.removeListener("finish",onfinish),stream.removeListener("end",onlegacyfinish),stream.removeListener("close",onlegacyfinish),stream.removeListener("finish",onfinish),stream.removeListener("end",onend),stream.removeListener("error",onerror),stream.removeListener("close",onclose)}}module2.exports=eos}});var require_async_iterator=__commonJS({"node_modules/readable-stream/lib/internal/streams/async_iterator.js"(exports2,module2){"use strict";var _Object$setPrototypeO;function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return typeof key=="symbol"?key:String(key)}function _toPrimitive(input,hint){if(typeof input!="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if(typeof res!="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return(hint==="string"?String:Number)(input)}var finished=require_end_of_stream(),kLastResolve=Symbol("lastResolve"),kLastReject=Symbol("lastReject"),kError=Symbol("error"),kEnded=Symbol("ended"),kLastPromise=Symbol("lastPromise"),kHandlePromise=Symbol("handlePromise"),kStream=Symbol("stream");function createIterResult(value,done){return{value,done}}function readAndResolve(iter){var resolve=iter[kLastResolve];if(resolve!==null){var data=iter[kStream].read();data!==null&&(iter[kLastPromise]=null,iter[kLastResolve]=null,iter[kLastReject]=null,resolve(createIterResult(data,!1)))}}function onReadable(iter){process.nextTick(readAndResolve,iter)}function wrapForNext(lastPromise,iter){return function(resolve,reject){lastPromise.then(function(){if(iter[kEnded]){resolve(createIterResult(void 0,!0));return}iter[kHandlePromise](resolve,reject)},reject)}}var AsyncIteratorPrototype=Object.getPrototypeOf(function(){}),ReadableStreamAsyncIteratorPrototype=Object.setPrototypeOf((_Object$setPrototypeO={get stream(){return this[kStream]},next:function(){var _this=this,error=this[kError];if(error!==null)return Promise.reject(error);if(this[kEnded])return Promise.resolve(createIterResult(void 0,!0));if(this[kStream].destroyed)return new Promise(function(resolve,reject){process.nextTick(function(){_this[kError]?reject(_this[kError]):resolve(createIterResult(void 0,!0))})});var lastPromise=this[kLastPromise],promise;if(lastPromise)promise=new Promise(wrapForNext(lastPromise,this));else{var data=this[kStream].read();if(data!==null)return Promise.resolve(createIterResult(data,!1));promise=new Promise(this[kHandlePromise])}return this[kLastPromise]=promise,promise}},_defineProperty(_Object$setPrototypeO,Symbol.asyncIterator,function(){return this}),_defineProperty(_Object$setPrototypeO,"return",function(){var _this2=this;return new Promise(function(resolve,reject){_this2[kStream].destroy(null,function(err){if(err){reject(err);return}resolve(createIterResult(void 0,!0))})})}),_Object$setPrototypeO),AsyncIteratorPrototype),createReadableStreamAsyncIterator=function(stream){var _Object$create,iterator=Object.create(ReadableStreamAsyncIteratorPrototype,(_Object$create={},_defineProperty(_Object$create,kStream,{value:stream,writable:!0}),_defineProperty(_Object$create,kLastResolve,{value:null,writable:!0}),_defineProperty(_Object$create,kLastReject,{value:null,writable:!0}),_defineProperty(_Object$create,kError,{value:null,writable:!0}),_defineProperty(_Object$create,kEnded,{value:stream._readableState.endEmitted,writable:!0}),_defineProperty(_Object$create,kHandlePromise,{value:function(resolve,reject){var data=iterator[kStream].read();data?(iterator[kLastPromise]=null,iterator[kLastResolve]=null,iterator[kLastReject]=null,resolve(createIterResult(data,!1))):(iterator[kLastResolve]=resolve,iterator[kLastReject]=reject)},writable:!0}),_Object$create));return iterator[kLastPromise]=null,finished(stream,function(err){if(err&&err.code!=="ERR_STREAM_PREMATURE_CLOSE"){var reject=iterator[kLastReject];reject!==null&&(iterator[kLastPromise]=null,iterator[kLastResolve]=null,iterator[kLastReject]=null,reject(err)),iterator[kError]=err;return}var resolve=iterator[kLastResolve];resolve!==null&&(iterator[kLastPromise]=null,iterator[kLastResolve]=null,iterator[kLastReject]=null,resolve(createIterResult(void 0,!0))),iterator[kEnded]=!0}),stream.on("readable",onReadable.bind(null,iterator)),iterator};module2.exports=createReadableStreamAsyncIterator}});var require_from=__commonJS({"node_modules/readable-stream/lib/internal/streams/from.js"(exports2,module2){"use strict";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){reject(error);return}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _asyncToGenerator(fn){return function(){var self2=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self2,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(void 0)})}}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return typeof key=="symbol"?key:String(key)}function _toPrimitive(input,hint){if(typeof input!="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if(typeof res!="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return(hint==="string"?String:Number)(input)}var ERR_INVALID_ARG_TYPE=require_errors().codes.ERR_INVALID_ARG_TYPE;function from(Readable,iterable,opts){var iterator;if(iterable&&typeof iterable.next=="function")iterator=iterable;else if(iterable&&iterable[Symbol.asyncIterator])iterator=iterable[Symbol.asyncIterator]();else if(iterable&&iterable[Symbol.iterator])iterator=iterable[Symbol.iterator]();else throw new ERR_INVALID_ARG_TYPE("iterable",["Iterable"],iterable);var readable=new Readable(_objectSpread({objectMode:!0},opts)),reading=!1;readable._read=function(){reading||(reading=!0,next())};function next(){return _next2.apply(this,arguments)}function _next2(){return _next2=_asyncToGenerator(function*(){try{var _yield$iterator$next=yield iterator.next(),value=_yield$iterator$next.value,done=_yield$iterator$next.done;done?readable.push(null):readable.push(yield value)?next():reading=!1}catch(err){readable.destroy(err)}}),_next2.apply(this,arguments)}return readable}module2.exports=from}});var require_stream_readable=__commonJS({"node_modules/readable-stream/lib/_stream_readable.js"(exports2,module2){"use strict";module2.exports=Readable;var Duplex;Readable.ReadableState=ReadableState;var EE=require("events").EventEmitter,EElistenerCount=function(emitter,type){return emitter.listeners(type).length},Stream=require_stream3(),Buffer2=require("buffer").Buffer,OurUint8Array=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function _uint8ArrayToBuffer(chunk){return Buffer2.from(chunk)}function _isUint8Array(obj){return Buffer2.isBuffer(obj)||obj instanceof OurUint8Array}var debugUtil=require("util"),debug;debugUtil&&debugUtil.debuglog?debug=debugUtil.debuglog("stream"):debug=function(){};var BufferList=require_buffer_list(),destroyImpl=require_destroy2(),_require=require_state(),getHighWaterMark=_require.getHighWaterMark,_require$codes=require_errors().codes,ERR_INVALID_ARG_TYPE=_require$codes.ERR_INVALID_ARG_TYPE,ERR_STREAM_PUSH_AFTER_EOF=_require$codes.ERR_STREAM_PUSH_AFTER_EOF,ERR_METHOD_NOT_IMPLEMENTED=_require$codes.ERR_METHOD_NOT_IMPLEMENTED,ERR_STREAM_UNSHIFT_AFTER_END_EVENT=_require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,StringDecoder,createReadableStreamAsyncIterator,from;require_inherits()(Readable,Stream);var errorOrDestroy=destroyImpl.errorOrDestroy,kProxyEvents=["error","close","destroy","pause","resume"];function prependListener(emitter,event,fn){if(typeof emitter.prependListener=="function")return emitter.prependListener(event,fn);!emitter._events||!emitter._events[event]?emitter.on(event,fn):Array.isArray(emitter._events[event])?emitter._events[event].unshift(fn):emitter._events[event]=[fn,emitter._events[event]]}function ReadableState(options,stream,isDuplex){Duplex=Duplex||require_stream_duplex(),options=options||{},typeof isDuplex!="boolean"&&(isDuplex=stream instanceof Duplex),this.objectMode=!!options.objectMode,isDuplex&&(this.objectMode=this.objectMode||!!options.readableObjectMode),this.highWaterMark=getHighWaterMark(this,options,"readableHighWaterMark",isDuplex),this.buffer=new BufferList,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=options.emitClose!==!1,this.autoDestroy=!!options.autoDestroy,this.destroyed=!1,this.defaultEncoding=options.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,options.encoding&&(StringDecoder||(StringDecoder=require_string_decoder().StringDecoder),this.decoder=new StringDecoder(options.encoding),this.encoding=options.encoding)}function Readable(options){if(Duplex=Duplex||require_stream_duplex(),!(this instanceof Readable))return new Readable(options);var isDuplex=this instanceof Duplex;this._readableState=new ReadableState(options,this,isDuplex),this.readable=!0,options&&(typeof options.read=="function"&&(this._read=options.read),typeof options.destroy=="function"&&(this._destroy=options.destroy)),Stream.call(this)}Object.defineProperty(Readable.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(value){this._readableState&&(this._readableState.destroyed=value)}});Readable.prototype.destroy=destroyImpl.destroy;Readable.prototype._undestroy=destroyImpl.undestroy;Readable.prototype._destroy=function(err,cb){cb(err)};Readable.prototype.push=function(chunk,encoding){var state=this._readableState,skipChunkCheck;return state.objectMode?skipChunkCheck=!0:typeof chunk=="string"&&(encoding=encoding||state.defaultEncoding,encoding!==state.encoding&&(chunk=Buffer2.from(chunk,encoding),encoding=""),skipChunkCheck=!0),readableAddChunk(this,chunk,encoding,!1,skipChunkCheck)};Readable.prototype.unshift=function(chunk){return readableAddChunk(this,chunk,null,!0,!1)};function readableAddChunk(stream,chunk,encoding,addToFront,skipChunkCheck){debug("readableAddChunk",chunk);var state=stream._readableState;if(chunk===null)state.reading=!1,onEofChunk(stream,state);else{var er;if(skipChunkCheck||(er=chunkInvalid(state,chunk)),er)errorOrDestroy(stream,er);else if(state.objectMode||chunk&&chunk.length>0)if(typeof chunk!="string"&&!state.objectMode&&Object.getPrototypeOf(chunk)!==Buffer2.prototype&&(chunk=_uint8ArrayToBuffer(chunk)),addToFront)state.endEmitted?errorOrDestroy(stream,new ERR_STREAM_UNSHIFT_AFTER_END_EVENT):addChunk(stream,state,chunk,!0);else if(state.ended)errorOrDestroy(stream,new ERR_STREAM_PUSH_AFTER_EOF);else{if(state.destroyed)return!1;state.reading=!1,state.decoder&&!encoding?(chunk=state.decoder.write(chunk),state.objectMode||chunk.length!==0?addChunk(stream,state,chunk,!1):maybeReadMore(stream,state)):addChunk(stream,state,chunk,!1)}else addToFront||(state.reading=!1,maybeReadMore(stream,state))}return!state.ended&&(state.length<state.highWaterMark||state.length===0)}function addChunk(stream,state,chunk,addToFront){state.flowing&&state.length===0&&!state.sync?(state.awaitDrain=0,stream.emit("data",chunk)):(state.length+=state.objectMode?1:chunk.length,addToFront?state.buffer.unshift(chunk):state.buffer.push(chunk),state.needReadable&&emitReadable(stream)),maybeReadMore(stream,state)}function chunkInvalid(state,chunk){var er;return!_isUint8Array(chunk)&&typeof chunk!="string"&&chunk!==void 0&&!state.objectMode&&(er=new ERR_INVALID_ARG_TYPE("chunk",["string","Buffer","Uint8Array"],chunk)),er}Readable.prototype.isPaused=function(){return this._readableState.flowing===!1};Readable.prototype.setEncoding=function(enc){StringDecoder||(StringDecoder=require_string_decoder().StringDecoder);var decoder=new StringDecoder(enc);this._readableState.decoder=decoder,this._readableState.encoding=this._readableState.decoder.encoding;for(var p=this._readableState.buffer.head,content="";p!==null;)content+=decoder.write(p.data),p=p.next;return this._readableState.buffer.clear(),content!==""&&this._readableState.buffer.push(content),this._readableState.length=content.length,this};var MAX_HWM=1073741824;function computeNewHighWaterMark(n){return n>=MAX_HWM?n=MAX_HWM:(n--,n|=n>>>1,n|=n>>>2,n|=n>>>4,n|=n>>>8,n|=n>>>16,n++),n}function howMuchToRead(n,state){return n<=0||state.length===0&&state.ended?0:state.objectMode?1:n!==n?state.flowing&&state.length?state.buffer.head.data.length:state.length:(n>state.highWaterMark&&(state.highWaterMark=computeNewHighWaterMark(n)),n<=state.length?n:state.ended?state.length:(state.needReadable=!0,0))}Readable.prototype.read=function(n){debug("read",n),n=parseInt(n,10);var state=this._readableState,nOrig=n;if(n!==0&&(state.emittedReadable=!1),n===0&&state.needReadable&&((state.highWaterMark!==0?state.length>=state.highWaterMark:state.length>0)||state.ended))return debug("read: emitReadable",state.length,state.ended),state.length===0&&state.ended?endReadable(this):emitReadable(this),null;if(n=howMuchToRead(n,state),n===0&&state.ended)return state.length===0&&endReadable(this),null;var doRead=state.needReadable;debug("need readable",doRead),(state.length===0||state.length-n<state.highWaterMark)&&(doRead=!0,debug("length less than watermark",doRead)),state.ended||state.reading?(doRead=!1,debug("reading or ended",doRead)):doRead&&(debug("do read"),state.reading=!0,state.sync=!0,state.length===0&&(state.needReadable=!0),this._read(state.highWaterMark),state.sync=!1,state.reading||(n=howMuchToRead(nOrig,state)));var ret;return n>0?ret=fromList(n,state):ret=null,ret===null?(state.needReadable=state.length<=state.highWaterMark,n=0):(state.length-=n,state.awaitDrain=0),state.length===0&&(state.ended||(state.needReadable=!0),nOrig!==n&&state.ended&&endReadable(this)),ret!==null&&this.emit("data",ret),ret};function onEofChunk(stream,state){if(debug("onEofChunk"),!state.ended){if(state.decoder){var chunk=state.decoder.end();chunk&&chunk.length&&(state.buffer.push(chunk),state.length+=state.objectMode?1:chunk.length)}state.ended=!0,state.sync?emitReadable(stream):(state.needReadable=!1,state.emittedReadable||(state.emittedReadable=!0,emitReadable_(stream)))}}function emitReadable(stream){var state=stream._readableState;debug("emitReadable",state.needReadable,state.emittedReadable),state.needReadable=!1,state.emittedReadable||(debug("emitReadable",state.flowing),state.emittedReadable=!0,process.nextTick(emitReadable_,stream))}function emitReadable_(stream){var state=stream._readableState;debug("emitReadable_",state.destroyed,state.length,state.ended),!state.destroyed&&(state.length||state.ended)&&(stream.emit("readable"),state.emittedReadable=!1),state.needReadable=!state.flowing&&!state.ended&&state.length<=state.highWaterMark,flow(stream)}function maybeReadMore(stream,state){state.readingMore||(state.readingMore=!0,process.nextTick(maybeReadMore_,stream,state))}function maybeReadMore_(stream,state){for(;!state.reading&&!state.ended&&(state.length<state.highWaterMark||state.flowing&&state.length===0);){var len=state.length;if(debug("maybeReadMore read 0"),stream.read(0),len===state.length)break}state.readingMore=!1}Readable.prototype._read=function(n){errorOrDestroy(this,new ERR_METHOD_NOT_IMPLEMENTED("_read()"))};Readable.prototype.pipe=function(dest,pipeOpts){var src=this,state=this._readableState;switch(state.pipesCount){case 0:state.pipes=dest;break;case 1:state.pipes=[state.pipes,dest];break;default:state.pipes.push(dest);break}state.pipesCount+=1,debug("pipe count=%d opts=%j",state.pipesCount,pipeOpts);var doEnd=(!pipeOpts||pipeOpts.end!==!1)&&dest!==process.stdout&&dest!==process.stderr,endFn=doEnd?onend:unpipe;state.endEmitted?process.nextTick(endFn):src.once("end",endFn),dest.on("unpipe",onunpipe);function onunpipe(readable,unpipeInfo){debug("onunpipe"),readable===src&&unpipeInfo&&unpipeInfo.hasUnpiped===!1&&(unpipeInfo.hasUnpiped=!0,cleanup())}function onend(){debug("onend"),dest.end()}var ondrain=pipeOnDrain(src);dest.on("drain",ondrain);var cleanedUp=!1;function cleanup(){debug("cleanup"),dest.removeListener("close",onclose),dest.removeListener("finish",onfinish),dest.removeListener("drain",ondrain),dest.removeListener("error",onerror),dest.removeListener("unpipe",onunpipe),src.removeListener("end",onend),src.removeListener("end",unpipe),src.removeListener("data",ondata),cleanedUp=!0,state.awaitDrain&&(!dest._writableState||dest._writableState.needDrain)&&ondrain()}src.on("data",ondata);function ondata(chunk){debug("ondata");var ret=dest.write(chunk);debug("dest.write",ret),ret===!1&&((state.pipesCount===1&&state.pipes===dest||state.pipesCount>1&&indexOf(state.pipes,dest)!==-1)&&!cleanedUp&&(debug("false write response, pause",state.awaitDrain),state.awaitDrain++),src.pause())}function onerror(er){debug("onerror",er),unpipe(),dest.removeListener("error",onerror),EElistenerCount(dest,"error")===0&&errorOrDestroy(dest,er)}prependListener(dest,"error",onerror);function onclose(){dest.removeListener("finish",onfinish),unpipe()}dest.once("close",onclose);function onfinish(){debug("onfinish"),dest.removeListener("close",onclose),unpipe()}dest.once("finish",onfinish);function unpipe(){debug("unpipe"),src.unpipe(dest)}return dest.emit("pipe",src),state.flowing||(debug("pipe resume"),src.resume()),dest};function pipeOnDrain(src){return function(){var state=src._readableState;debug("pipeOnDrain",state.awaitDrain),state.awaitDrain&&state.awaitDrain--,state.awaitDrain===0&&EElistenerCount(src,"data")&&(state.flowing=!0,flow(src))}}Readable.prototype.unpipe=function(dest){var state=this._readableState,unpipeInfo={hasUnpiped:!1};if(state.pipesCount===0)return this;if(state.pipesCount===1)return dest&&dest!==state.pipes?this:(dest||(dest=state.pipes),state.pipes=null,state.pipesCount=0,state.flowing=!1,dest&&dest.emit("unpipe",this,unpipeInfo),this);if(!dest){var dests=state.pipes,len=state.pipesCount;state.pipes=null,state.pipesCount=0,state.flowing=!1;for(var i=0;i<len;i++)dests[i].emit("unpipe",this,{hasUnpiped:!1});return this}var index=indexOf(state.pipes,dest);return index===-1?this:(state.pipes.splice(index,1),state.pipesCount-=1,state.pipesCount===1&&(state.pipes=state.pipes[0]),dest.emit("unpipe",this,unpipeInfo),this)};Readable.prototype.on=function(ev,fn){var res=Stream.prototype.on.call(this,ev,fn),state=this._readableState;return ev==="data"?(state.readableListening=this.listenerCount("readable")>0,state.flowing!==!1&&this.resume()):ev==="readable"&&!state.endEmitted&&!state.readableListening&&(state.readableListening=state.needReadable=!0,state.flowing=!1,state.emittedReadable=!1,debug("on readable",state.length,state.reading),state.length?emitReadable(this):state.reading||process.nextTick(nReadingNextTick,this)),res};Readable.prototype.addListener=Readable.prototype.on;Readable.prototype.removeListener=function(ev,fn){var res=Stream.prototype.removeListener.call(this,ev,fn);return ev==="readable"&&process.nextTick(updateReadableListening,this),res};Readable.prototype.removeAllListeners=function(ev){var res=Stream.prototype.removeAllListeners.apply(this,arguments);return(ev==="readable"||ev===void 0)&&process.nextTick(updateReadableListening,this),res};function updateReadableListening(self2){var state=self2._readableState;state.readableListening=self2.listenerCount("readable")>0,state.resumeScheduled&&!state.paused?state.flowing=!0:self2.listenerCount("data")>0&&self2.resume()}function nReadingNextTick(self2){debug("readable nexttick read 0"),self2.read(0)}Readable.prototype.resume=function(){var state=this._readableState;return state.flowing||(debug("resume"),state.flowing=!state.readableListening,resume(this,state)),state.paused=!1,this};function resume(stream,state){state.resumeScheduled||(state.resumeScheduled=!0,process.nextTick(resume_,stream,state))}function resume_(stream,state){debug("resume",state.reading),state.reading||stream.read(0),state.resumeScheduled=!1,stream.emit("resume"),flow(stream),state.flowing&&!state.reading&&stream.read(0)}Readable.prototype.pause=function(){return debug("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(debug("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function flow(stream){var state=stream._readableState;for(debug("flow",state.flowing);state.flowing&&stream.read()!==null;);}Readable.prototype.wrap=function(stream){var _this=this,state=this._readableState,paused=!1;stream.on("end",function(){if(debug("wrapped end"),state.decoder&&!state.ended){var chunk=state.decoder.end();chunk&&chunk.length&&_this.push(chunk)}_this.push(null)}),stream.on("data",function(chunk){if(debug("wrapped data"),state.decoder&&(chunk=state.decoder.write(chunk)),!(state.objectMode&&chunk==null)&&!(!state.objectMode&&(!chunk||!chunk.length))){var ret=_this.push(chunk);ret||(paused=!0,stream.pause())}});for(var i in stream)this[i]===void 0&&typeof stream[i]=="function"&&(this[i]=(function(method){return function(){return stream[method].apply(stream,arguments)}})(i));for(var n=0;n<kProxyEvents.length;n++)stream.on(kProxyEvents[n],this.emit.bind(this,kProxyEvents[n]));return this._read=function(n2){debug("wrapped _read",n2),paused&&(paused=!1,stream.resume())},this};typeof Symbol=="function"&&(Readable.prototype[Symbol.asyncIterator]=function(){return createReadableStreamAsyncIterator===void 0&&(createReadableStreamAsyncIterator=require_async_iterator()),createReadableStreamAsyncIterator(this)});Object.defineProperty(Readable.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});Object.defineProperty(Readable.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}});Object.defineProperty(Readable.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(state){this._readableState&&(this._readableState.flowing=state)}});Readable._fromList=fromList;Object.defineProperty(Readable.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function fromList(n,state){if(state.length===0)return null;var ret;return state.objectMode?ret=state.buffer.shift():!n||n>=state.length?(state.decoder?ret=state.buffer.join(""):state.buffer.length===1?ret=state.buffer.first():ret=state.buffer.concat(state.length),state.buffer.clear()):ret=state.buffer.consume(n,state.decoder),ret}function endReadable(stream){var state=stream._readableState;debug("endReadable",state.endEmitted),state.endEmitted||(state.ended=!0,process.nextTick(endReadableNT,state,stream))}function endReadableNT(state,stream){if(debug("endReadableNT",state.endEmitted,state.length),!state.endEmitted&&state.length===0&&(state.endEmitted=!0,stream.readable=!1,stream.emit("end"),state.autoDestroy)){var wState=stream._writableState;(!wState||wState.autoDestroy&&wState.finished)&&stream.destroy()}}typeof Symbol=="function"&&(Readable.from=function(iterable,opts){return from===void 0&&(from=require_from()),from(Readable,iterable,opts)});function indexOf(xs,x){for(var i=0,l=xs.length;i<l;i++)if(xs[i]===x)return i;return-1}}});var require_stream_transform=__commonJS({"node_modules/readable-stream/lib/_stream_transform.js"(exports2,module2){"use strict";module2.exports=Transform;var _require$codes=require_errors().codes,ERR_METHOD_NOT_IMPLEMENTED=_require$codes.ERR_METHOD_NOT_IMPLEMENTED,ERR_MULTIPLE_CALLBACK=_require$codes.ERR_MULTIPLE_CALLBACK,ERR_TRANSFORM_ALREADY_TRANSFORMING=_require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,ERR_TRANSFORM_WITH_LENGTH_0=_require$codes.ERR_TRANSFORM_WITH_LENGTH_0,Duplex=require_stream_duplex();require_inherits()(Transform,Duplex);function afterTransform(er,data){var ts=this._transformState;ts.transforming=!1;var cb=ts.writecb;if(cb===null)return this.emit("error",new ERR_MULTIPLE_CALLBACK);ts.writechunk=null,ts.writecb=null,data!=null&&this.push(data),cb(er);var rs=this._readableState;rs.reading=!1,(rs.needReadable||rs.length<rs.highWaterMark)&&this._read(rs.highWaterMark)}function Transform(options){if(!(this instanceof Transform))return new Transform(options);Duplex.call(this,options),this._transformState={afterTransform:afterTransform.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,options&&(typeof options.transform=="function"&&(this._transform=options.transform),typeof options.flush=="function"&&(this._flush=options.flush)),this.on("prefinish",prefinish)}function prefinish(){var _this=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(er,data){done(_this,er,data)}):done(this,null,null)}Transform.prototype.push=function(chunk,encoding){return this._transformState.needTransform=!1,Duplex.prototype.push.call(this,chunk,encoding)};Transform.prototype._transform=function(chunk,encoding,cb){cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()"))};Transform.prototype._write=function(chunk,encoding,cb){var ts=this._transformState;if(ts.writecb=cb,ts.writechunk=chunk,ts.writeencoding=encoding,!ts.transforming){var rs=this._readableState;(ts.needTransform||rs.needReadable||rs.length<rs.highWaterMark)&&this._read(rs.highWaterMark)}};Transform.prototype._read=function(n){var ts=this._transformState;ts.writechunk!==null&&!ts.transforming?(ts.transforming=!0,this._transform(ts.writechunk,ts.writeencoding,ts.afterTransform)):ts.needTransform=!0};Transform.prototype._destroy=function(err,cb){Duplex.prototype._destroy.call(this,err,function(err2){cb(err2)})};function done(stream,er,data){if(er)return stream.emit("error",er);if(data!=null&&stream.push(data),stream._writableState.length)throw new ERR_TRANSFORM_WITH_LENGTH_0;if(stream._transformState.transforming)throw new ERR_TRANSFORM_ALREADY_TRANSFORMING;return stream.push(null)}}});var require_stream_passthrough=__commonJS({"node_modules/readable-stream/lib/_stream_passthrough.js"(exports2,module2){"use strict";module2.exports=PassThrough;var Transform=require_stream_transform();require_inherits()(PassThrough,Transform);function PassThrough(options){if(!(this instanceof PassThrough))return new PassThrough(options);Transform.call(this,options)}PassThrough.prototype._transform=function(chunk,encoding,cb){cb(null,chunk)}}});var require_pipeline=__commonJS({"node_modules/readable-stream/lib/internal/streams/pipeline.js"(exports2,module2){"use strict";var eos;function once(callback){var called=!1;return function(){called||(called=!0,callback.apply(void 0,arguments))}}var _require$codes=require_errors().codes,ERR_MISSING_ARGS=_require$codes.ERR_MISSING_ARGS,ERR_STREAM_DESTROYED=_require$codes.ERR_STREAM_DESTROYED;function noop(err){if(err)throw err}function isRequest(stream){return stream.setHeader&&typeof stream.abort=="function"}function destroyer(stream,reading,writing,callback){callback=once(callback);var closed=!1;stream.on("close",function(){closed=!0}),eos===void 0&&(eos=require_end_of_stream()),eos(stream,{readable:reading,writable:writing},function(err){if(err)return callback(err);closed=!0,callback()});var destroyed=!1;return function(err){if(!closed&&!destroyed){if(destroyed=!0,isRequest(stream))return stream.abort();if(typeof stream.destroy=="function")return stream.destroy();callback(err||new ERR_STREAM_DESTROYED("pipe"))}}}function call(fn){fn()}function pipe(from,to){return from.pipe(to)}function popCallback(streams){return!streams.length||typeof streams[streams.length-1]!="function"?noop:streams.pop()}function pipeline(){for(var _len=arguments.length,streams=new Array(_len),_key=0;_key<_len;_key++)streams[_key]=arguments[_key];var callback=popCallback(streams);if(Array.isArray(streams[0])&&(streams=streams[0]),streams.length<2)throw new ERR_MISSING_ARGS("streams");var error,destroys=streams.map(function(stream,i){var reading=i<streams.length-1,writing=i>0;return destroyer(stream,reading,writing,function(err){error||(error=err),err&&destroys.forEach(call),!reading&&(destroys.forEach(call),callback(error))})});return streams.reduce(pipe)}module2.exports=pipeline}});var require_readable=__commonJS({"node_modules/readable-stream/readable.js"(exports2,module2){var Stream=require("stream");process.env.READABLE_STREAM==="disable"&&Stream?(module2.exports=Stream.Readable,Object.assign(module2.exports,Stream),module2.exports.Stream=Stream):(exports2=module2.exports=require_stream_readable(),exports2.Stream=Stream||exports2,exports2.Readable=exports2,exports2.Writable=require_stream_writable(),exports2.Duplex=require_stream_duplex(),exports2.Transform=require_stream_transform(),exports2.PassThrough=require_stream_passthrough(),exports2.finished=require_end_of_stream(),exports2.pipeline=require_pipeline())}});var require_buffer_from=__commonJS({"node_modules/buffer-from/index.js"(exports2,module2){var toString=Object.prototype.toString,isModern=typeof Buffer<"u"&&typeof Buffer.alloc=="function"&&typeof Buffer.allocUnsafe=="function"&&typeof Buffer.from=="function";function isArrayBuffer(input){return toString.call(input).slice(8,-1)==="ArrayBuffer"}function fromArrayBuffer(obj,byteOffset,length){byteOffset>>>=0;var maxLength=obj.byteLength-byteOffset;if(maxLength<0)throw new RangeError("'offset' is out of bounds");if(length===void 0)length=maxLength;else if(length>>>=0,length>maxLength)throw new RangeError("'length' is out of bounds");return isModern?Buffer.from(obj.slice(byteOffset,byteOffset+length)):new Buffer(new Uint8Array(obj.slice(byteOffset,byteOffset+length)))}function fromString(string,encoding){if((typeof encoding!="string"||encoding==="")&&(encoding="utf8"),!Buffer.isEncoding(encoding))throw new TypeError('"encoding" must be a valid string encoding');return isModern?Buffer.from(string,encoding):new Buffer(string,encoding)}function bufferFrom(value,encodingOrOffset,length){if(typeof value=="number")throw new TypeError('"value" argument must not be a number');return isArrayBuffer(value)?fromArrayBuffer(value,encodingOrOffset,length):typeof value=="string"?fromString(value,encodingOrOffset):isModern?Buffer.from(value):new Buffer(value)}module2.exports=bufferFrom}});var require_typedarray=__commonJS({"node_modules/typedarray/index.js"(exports2){var undefined2=void 0,MAX_ARRAY_LENGTH=1e5,ECMAScript=(function(){var opts=Object.prototype.toString,ophop=Object.prototype.hasOwnProperty;return{Class:function(v){return opts.call(v).replace(/^\[object *|\]$/g,"")},HasProperty:function(o,p){return p in o},HasOwnProperty:function(o,p){return ophop.call(o,p)},IsCallable:function(o){return typeof o=="function"},ToInt32:function(v){return v>>0},ToUint32:function(v){return v>>>0}}})(),LN2=Math.LN2,abs=Math.abs,floor=Math.floor,log=Math.log,min=Math.min,pow=Math.pow,round=Math.round;function configureProperties(obj){if(getOwnPropNames&&defineProp){var props=getOwnPropNames(obj),i;for(i=0;i<props.length;i+=1)defineProp(obj,props[i],{value:obj[props[i]],writable:!1,enumerable:!1,configurable:!1})}}var defineProp;Object.defineProperty&&(function(){try{return Object.defineProperty({},"x",{}),!0}catch{return!1}})()?defineProp=Object.defineProperty:defineProp=function(o,p,desc){if(!o===Object(o))throw new TypeError("Object.defineProperty called on non-object");return ECMAScript.HasProperty(desc,"get")&&Object.prototype.__defineGetter__&&Object.prototype.__defineGetter__.call(o,p,desc.get),ECMAScript.HasProperty(desc,"set")&&Object.prototype.__defineSetter__&&Object.prototype.__defineSetter__.call(o,p,desc.set),ECMAScript.HasProperty(desc,"value")&&(o[p]=desc.value),o};var getOwnPropNames=Object.getOwnPropertyNames||function(o){if(o!==Object(o))throw new TypeError("Object.getOwnPropertyNames called on non-object");var props=[],p;for(p in o)ECMAScript.HasOwnProperty(o,p)&&props.push(p);return props};function makeArrayAccessors(obj){if(!defineProp)return;if(obj.length>MAX_ARRAY_LENGTH)throw new RangeError("Array too large for polyfill");function makeArrayAccessor(index){defineProp(obj,index,{get:function(){return obj._getter(index)},set:function(v){obj._setter(index,v)},enumerable:!0,configurable:!1})}var i;for(i=0;i<obj.length;i+=1)makeArrayAccessor(i)}function as_signed(value,bits){var s=32-bits;return value<<s>>s}function as_unsigned(value,bits){var s=32-bits;return value<<s>>>s}function packI8(n){return[n&255]}function unpackI8(bytes){return as_signed(bytes[0],8)}function packU8(n){return[n&255]}function unpackU8(bytes){return as_unsigned(bytes[0],8)}function packU8Clamped(n){return n=round(Number(n)),[n<0?0:n>255?255:n&255]}function packI16(n){return[n>>8&255,n&255]}function unpackI16(bytes){return as_signed(bytes[0]<<8|bytes[1],16)}function packU16(n){return[n>>8&255,n&255]}function unpackU16(bytes){return as_unsigned(bytes[0]<<8|bytes[1],16)}function packI32(n){return[n>>24&255,n>>16&255,n>>8&255,n&255]}function unpackI32(bytes){return as_signed(bytes[0]<<24|bytes[1]<<16|bytes[2]<<8|bytes[3],32)}function packU32(n){return[n>>24&255,n>>16&255,n>>8&255,n&255]}function unpackU32(bytes){return as_unsigned(bytes[0]<<24|bytes[1]<<16|bytes[2]<<8|bytes[3],32)}function packIEEE754(v,ebits,fbits){var bias=(1<<ebits-1)-1,s,e,f,ln,i,bits,str,bytes;function roundToEven(n){var w=floor(n),f2=n-w;return f2<.5?w:f2>.5||w%2?w+1:w}for(v!==v?(e=(1<<ebits)-1,f=pow(2,fbits-1),s=0):v===1/0||v===-1/0?(e=(1<<ebits)-1,f=0,s=v<0?1:0):v===0?(e=0,f=0,s=1/v===-1/0?1:0):(s=v<0,v=abs(v),v>=pow(2,1-bias)?(e=min(floor(log(v)/LN2),1023),f=roundToEven(v/pow(2,e)*pow(2,fbits)),f/pow(2,fbits)>=2&&(e=e+1,f=1),e>bias?(e=(1<<ebits)-1,f=0):(e=e+bias,f=f-pow(2,fbits))):(e=0,f=roundToEven(v/pow(2,1-bias-fbits)))),bits=[],i=fbits;i;i-=1)bits.push(f%2?1:0),f=floor(f/2);for(i=ebits;i;i-=1)bits.push(e%2?1:0),e=floor(e/2);for(bits.push(s?1:0),bits.reverse(),str=bits.join(""),bytes=[];str.length;)bytes.push(parseInt(str.substring(0,8),2)),str=str.substring(8);return bytes}function unpackIEEE754(bytes,ebits,fbits){var bits=[],i,j,b,str,bias,s,e,f;for(i=bytes.length;i;i-=1)for(b=bytes[i-1],j=8;j;j-=1)bits.push(b%2?1:0),b=b>>1;return bits.reverse(),str=bits.join(""),bias=(1<<ebits-1)-1,s=parseInt(str.substring(0,1),2)?-1:1,e=parseInt(str.substring(1,1+ebits),2),f=parseInt(str.substring(1+ebits),2),e===(1<<ebits)-1?f!==0?NaN:s*(1/0):e>0?s*pow(2,e-bias)*(1+f/pow(2,fbits)):f!==0?s*pow(2,-(bias-1))*(f/pow(2,fbits)):s<0?-0:0}function unpackF64(b){return unpackIEEE754(b,11,52)}function packF64(v){return packIEEE754(v,11,52)}function unpackF32(b){return unpackIEEE754(b,8,23)}function packF32(v){return packIEEE754(v,8,23)}(function(){var ArrayBuffer2=function(length){if(length=ECMAScript.ToInt32(length),length<0)throw new RangeError("ArrayBuffer size is not a small enough positive integer");this.byteLength=length,this._bytes=[],this._bytes.length=length;var i;for(i=0;i<this.byteLength;i+=1)this._bytes[i]=0;configureProperties(this)};exports2.ArrayBuffer=exports2.ArrayBuffer||ArrayBuffer2;var ArrayBufferView=function(){};function makeConstructor(bytesPerElement,pack,unpack){var ctor;return ctor=function(buffer,byteOffset,length){var array,sequence,i,s;if(!arguments.length||typeof arguments[0]=="number"){if(this.length=ECMAScript.ToInt32(arguments[0]),length<0)throw new RangeError("ArrayBufferView size is not a small enough positive integer");this.byteLength=this.length*this.BYTES_PER_ELEMENT,this.buffer=new ArrayBuffer2(this.byteLength),this.byteOffset=0}else if(typeof arguments[0]=="object"&&arguments[0].constructor===ctor)for(array=arguments[0],this.length=array.length,this.byteLength=this.length*this.BYTES_PER_ELEMENT,this.buffer=new ArrayBuffer2(this.byteLength),this.byteOffset=0,i=0;i<this.length;i+=1)this._setter(i,array._getter(i));else if(typeof arguments[0]=="object"&&!(arguments[0]instanceof ArrayBuffer2||ECMAScript.Class(arguments[0])==="ArrayBuffer"))for(sequence=arguments[0],this.length=ECMAScript.ToUint32(sequence.length),this.byteLength=this.length*this.BYTES_PER_ELEMENT,this.buffer=new ArrayBuffer2(this.byteLength),this.byteOffset=0,i=0;i<this.length;i+=1)s=sequence[i],this._setter(i,Number(s));else if(typeof arguments[0]=="object"&&(arguments[0]instanceof ArrayBuffer2||ECMAScript.Class(arguments[0])==="ArrayBuffer")){if(this.buffer=buffer,this.byteOffset=ECMAScript.ToUint32(byteOffset),this.byteOffset>this.buffer.byteLength)throw new RangeError("byteOffset out of range");if(this.byteOffset%this.BYTES_PER_ELEMENT)throw new RangeError("ArrayBuffer length minus the byteOffset is not a multiple of the element size.");if(arguments.length<3){if(this.byteLength=this.buffer.byteLength-this.byteOffset,this.byteLength%this.BYTES_PER_ELEMENT)throw new RangeError("length of buffer minus byteOffset not a multiple of the element size");this.length=this.byteLength/this.BYTES_PER_ELEMENT}else this.length=ECMAScript.ToUint32(length),this.byteLength=this.length*this.BYTES_PER_ELEMENT;if(this.byteOffset+this.byteLength>this.buffer.byteLength)throw new RangeError("byteOffset and length reference an area beyond the end of the buffer")}else throw new TypeError("Unexpected argument type(s)");this.constructor=ctor,configureProperties(this),makeArrayAccessors(this)},ctor.prototype=new ArrayBufferView,ctor.prototype.BYTES_PER_ELEMENT=bytesPerElement,ctor.prototype._pack=pack,ctor.prototype._unpack=unpack,ctor.BYTES_PER_ELEMENT=bytesPerElement,ctor.prototype._getter=function(index){if(arguments.length<1)throw new SyntaxError("Not enough arguments");if(index=ECMAScript.ToUint32(index),index>=this.length)return undefined2;var bytes=[],i,o;for(i=0,o=this.byteOffset+index*this.BYTES_PER_ELEMENT;i<this.BYTES_PER_ELEMENT;i+=1,o+=1)bytes.push(this.buffer._bytes[o]);return this._unpack(bytes)},ctor.prototype.get=ctor.prototype._getter,ctor.prototype._setter=function(index,value){if(arguments.length<2)throw new SyntaxError("Not enough arguments");if(index=ECMAScript.ToUint32(index),index>=this.length)return undefined2;var bytes=this._pack(value),i,o;for(i=0,o=this.byteOffset+index*this.BYTES_PER_ELEMENT;i<this.BYTES_PER_ELEMENT;i+=1,o+=1)this.buffer._bytes[o]=bytes[i]},ctor.prototype.set=function(index,value){if(arguments.length<1)throw new SyntaxError("Not enough arguments");var array,sequence,offset,len,i,s,d,byteOffset,byteLength,tmp;if(typeof arguments[0]=="object"&&arguments[0].constructor===this.constructor){if(array=arguments[0],offset=ECMAScript.ToUint32(arguments[1]),offset+array.length>this.length)throw new RangeError("Offset plus length of array is out of range");if(byteOffset=this.byteOffset+offset*this.BYTES_PER_ELEMENT,byteLength=array.length*this.BYTES_PER_ELEMENT,array.buffer===this.buffer){for(tmp=[],i=0,s=array.byteOffset;i<byteLength;i+=1,s+=1)tmp[i]=array.buffer._bytes[s];for(i=0,d=byteOffset;i<byteLength;i+=1,d+=1)this.buffer._bytes[d]=tmp[i]}else for(i=0,s=array.byteOffset,d=byteOffset;i<byteLength;i+=1,s+=1,d+=1)this.buffer._bytes[d]=array.buffer._bytes[s]}else if(typeof arguments[0]=="object"&&typeof arguments[0].length<"u"){if(sequence=arguments[0],len=ECMAScript.ToUint32(sequence.length),offset=ECMAScript.ToUint32(arguments[1]),offset+len>this.length)throw new RangeError("Offset plus length of array is out of range");for(i=0;i<len;i+=1)s=sequence[i],this._setter(offset+i,Number(s))}else throw new TypeError("Unexpected argument type(s)")},ctor.prototype.subarray=function(start,end){function clamp(v,min2,max){return v<min2?min2:v>max?max:v}start=ECMAScript.ToInt32(start),end=ECMAScript.ToInt32(end),arguments.length<1&&(start=0),arguments.length<2&&(end=this.length),start<0&&(start=this.length+start),end<0&&(end=this.length+end),start=clamp(start,0,this.length),end=clamp(end,0,this.length);var len=end-start;return len<0&&(len=0),new this.constructor(this.buffer,this.byteOffset+start*this.BYTES_PER_ELEMENT,len)},ctor}var Int8Array2=makeConstructor(1,packI8,unpackI8),Uint8Array2=makeConstructor(1,packU8,unpackU8),Uint8ClampedArray2=makeConstructor(1,packU8Clamped,unpackU8),Int16Array2=makeConstructor(2,packI16,unpackI16),Uint16Array2=makeConstructor(2,packU16,unpackU16),Int32Array2=makeConstructor(4,packI32,unpackI32),Uint32Array2=makeConstructor(4,packU32,unpackU32),Float32Array2=makeConstructor(4,packF32,unpackF32),Float64Array2=makeConstructor(8,packF64,unpackF64);exports2.Int8Array=exports2.Int8Array||Int8Array2,exports2.Uint8Array=exports2.Uint8Array||Uint8Array2,exports2.Uint8ClampedArray=exports2.Uint8ClampedArray||Uint8ClampedArray2,exports2.Int16Array=exports2.Int16Array||Int16Array2,exports2.Uint16Array=exports2.Uint16Array||Uint16Array2,exports2.Int32Array=exports2.Int32Array||Int32Array2,exports2.Uint32Array=exports2.Uint32Array||Uint32Array2,exports2.Float32Array=exports2.Float32Array||Float32Array2,exports2.Float64Array=exports2.Float64Array||Float64Array2})();(function(){function r(array,index){return ECMAScript.IsCallable(array.get)?array.get(index):array[index]}var IS_BIG_ENDIAN=(function(){var u16array=new exports2.Uint16Array([4660]),u8array=new exports2.Uint8Array(u16array.buffer);return r(u8array,0)===18})(),DataView2=function(buffer,byteOffset,byteLength){if(arguments.length===0)buffer=new exports2.ArrayBuffer(0);else if(!(buffer instanceof exports2.ArrayBuffer||ECMAScript.Class(buffer)==="ArrayBuffer"))throw new TypeError("TypeError");if(this.buffer=buffer||new exports2.ArrayBuffer(0),this.byteOffset=ECMAScript.ToUint32(byteOffset),this.byteOffset>this.buffer.byteLength)throw new RangeError("byteOffset out of range");if(arguments.length<3?this.byteLength=this.buffer.byteLength-this.byteOffset:this.byteLength=ECMAScript.ToUint32(byteLength),this.byteOffset+this.byteLength>this.buffer.byteLength)throw new RangeError("byteOffset and length reference an area beyond the end of the buffer");configureProperties(this)};function makeGetter(arrayType){return function(byteOffset,littleEndian){if(byteOffset=ECMAScript.ToUint32(byteOffset),byteOffset+arrayType.BYTES_PER_ELEMENT>this.byteLength)throw new RangeError("Array index out of range");byteOffset+=this.byteOffset;var uint8Array=new exports2.Uint8Array(this.buffer,byteOffset,arrayType.BYTES_PER_ELEMENT),bytes=[],i;for(i=0;i<arrayType.BYTES_PER_ELEMENT;i+=1)bytes.push(r(uint8Array,i));return!!littleEndian==!!IS_BIG_ENDIAN&&bytes.reverse(),r(new arrayType(new exports2.Uint8Array(bytes).buffer),0)}}DataView2.prototype.getUint8=makeGetter(exports2.Uint8Array),DataView2.prototype.getInt8=makeGetter(exports2.Int8Array),DataView2.prototype.getUint16=makeGetter(exports2.Uint16Array),DataView2.prototype.getInt16=makeGetter(exports2.Int16Array),DataView2.prototype.getUint32=makeGetter(exports2.Uint32Array),DataView2.prototype.getInt32=makeGetter(exports2.Int32Array),DataView2.prototype.getFloat32=makeGetter(exports2.Float32Array),DataView2.prototype.getFloat64=makeGetter(exports2.Float64Array);function makeSetter(arrayType){return function(byteOffset,value,littleEndian){if(byteOffset=ECMAScript.ToUint32(byteOffset),byteOffset+arrayType.BYTES_PER_ELEMENT>this.byteLength)throw new RangeError("Array index out of range");var typeArray=new arrayType([value]),byteArray=new exports2.Uint8Array(typeArray.buffer),bytes=[],i,byteView;for(i=0;i<arrayType.BYTES_PER_ELEMENT;i+=1)bytes.push(r(byteArray,i));!!littleEndian==!!IS_BIG_ENDIAN&&bytes.reverse(),byteView=new exports2.Uint8Array(this.buffer,byteOffset,arrayType.BYTES_PER_ELEMENT),byteView.set(bytes)}}DataView2.prototype.setUint8=makeSetter(exports2.Uint8Array),DataView2.prototype.setInt8=makeSetter(exports2.Int8Array),DataView2.prototype.setUint16=makeSetter(exports2.Uint16Array),DataView2.prototype.setInt16=makeSetter(exports2.Int16Array),DataView2.prototype.setUint32=makeSetter(exports2.Uint32Array),DataView2.prototype.setInt32=makeSetter(exports2.Int32Array),DataView2.prototype.setFloat32=makeSetter(exports2.Float32Array),DataView2.prototype.setFloat64=makeSetter(exports2.Float64Array),exports2.DataView=exports2.DataView||DataView2})()}});var require_concat_stream=__commonJS({"node_modules/multer/node_modules/concat-stream/index.js"(exports2,module2){var Writable=require_readable().Writable,inherits=require_inherits(),bufferFrom=require_buffer_from();typeof Uint8Array>"u"?U8=require_typedarray().Uint8Array:U8=Uint8Array;var U8;function ConcatStream(opts,cb){if(!(this instanceof ConcatStream))return new ConcatStream(opts,cb);typeof opts=="function"&&(cb=opts,opts={}),opts||(opts={});var encoding=opts.encoding,shouldInferEncoding=!1;encoding?(encoding=String(encoding).toLowerCase(),(encoding==="u8"||encoding==="uint8")&&(encoding="uint8array")):shouldInferEncoding=!0,Writable.call(this,{objectMode:!0}),this.encoding=encoding,this.shouldInferEncoding=shouldInferEncoding,cb&&this.on("finish",function(){cb(this.getBody())}),this.body=[]}module2.exports=ConcatStream;inherits(ConcatStream,Writable);ConcatStream.prototype._write=function(chunk,enc,next){this.body.push(chunk),next()};ConcatStream.prototype.inferEncoding=function(buff){var firstBuffer=buff===void 0?this.body[0]:buff;return Buffer.isBuffer(firstBuffer)?"buffer":typeof Uint8Array<"u"&&firstBuffer instanceof Uint8Array?"uint8array":Array.isArray(firstBuffer)?"array":typeof firstBuffer=="string"?"string":Object.prototype.toString.call(firstBuffer)==="[object Object]"?"object":"buffer"};ConcatStream.prototype.getBody=function(){return!this.encoding&&this.body.length===0?[]:(this.shouldInferEncoding&&(this.encoding=this.inferEncoding()),this.encoding==="array"?arrayConcat(this.body):this.encoding==="string"?stringConcat(this.body):this.encoding==="buffer"?bufferConcat(this.body):this.encoding==="uint8array"?u8Concat(this.body):this.body)};function isArrayish(arr){return/Array\]$/.test(Object.prototype.toString.call(arr))}function isBufferish(p){return typeof p=="string"||isArrayish(p)||p&&typeof p.subarray=="function"}function stringConcat(parts){for(var strings=[],needsToString=!1,i=0;i<parts.length;i++){var p=parts[i];typeof p=="string"||Buffer.isBuffer(p)?strings.push(p):isBufferish(p)?strings.push(bufferFrom(p)):strings.push(bufferFrom(String(p)))}return Buffer.isBuffer(parts[0])?(strings=Buffer.concat(strings),strings=strings.toString("utf8")):strings=strings.join(""),strings}function bufferConcat(parts){for(var bufs=[],i=0;i<parts.length;i++){var p=parts[i];Buffer.isBuffer(p)?bufs.push(p):isBufferish(p)?bufs.push(bufferFrom(p)):bufs.push(bufferFrom(String(p)))}return Buffer.concat(bufs)}function arrayConcat(parts){for(var res=[],i=0;i<parts.length;i++)res.push.apply(res,parts[i]);return res}function u8Concat(parts){for(var len=0,i=0;i<parts.length;i++)typeof parts[i]=="string"&&(parts[i]=bufferFrom(parts[i])),len+=parts[i].length;for(var u8=new U8(len),i=0,offset=0;i<parts.length;i++)for(var part=parts[i],j=0;j<part.length;j++)u8[offset++]=part[j];return u8}}});var require_memory=__commonJS({"node_modules/multer/storage/memory.js"(exports2,module2){var concat=require_concat_stream();function MemoryStorage(opts){}MemoryStorage.prototype._handleFile=function(req,file,cb){file.stream.pipe(concat({encoding:"buffer"},function(data){cb(null,{buffer:data,size:data.length})}))};MemoryStorage.prototype._removeFile=function(req,file,cb){delete file.buffer,cb(null)};module2.exports=function(opts){return new MemoryStorage(opts)}}});var require_multer=__commonJS({"node_modules/multer/index.js"(exports2,module2){var makeMiddleware=require_make_middleware(),diskStorage=require_disk(),memoryStorage=require_memory(),MulterError=require_multer_error();function allowAll(req,file,cb){cb(null,!0)}function Multer(options){options.storage?this.storage=options.storage:options.dest?this.storage=diskStorage({destination:options.dest}):this.storage=memoryStorage(),this.limits=options.limits,this.preservePath=options.preservePath,this.defParamCharset=options.defParamCharset||"latin1",this.fileFilter=options.fileFilter||allowAll}Multer.prototype._makeMiddleware=function(fields,fileStrategy){function setup(){var fileFilter=this.fileFilter,filesLeft=Object.create(null);fields.forEach(function(field){typeof field.maxCount=="number"?filesLeft[field.name]=field.maxCount:filesLeft[field.name]=1/0});function wrappedFileFilter(req,file,cb){if((filesLeft[file.fieldname]||0)<=0)return cb(new MulterError("LIMIT_UNEXPECTED_FILE",file.fieldname));filesLeft[file.fieldname]-=1,fileFilter(req,file,cb)}return{limits:this.limits,preservePath:this.preservePath,defParamCharset:this.defParamCharset,storage:this.storage,fileFilter:wrappedFileFilter,fileStrategy}}return makeMiddleware(setup.bind(this))};Multer.prototype.single=function(name){return this._makeMiddleware([{name,maxCount:1}],"VALUE")};Multer.prototype.array=function(name,maxCount){return this._makeMiddleware([{name,maxCount}],"ARRAY")};Multer.prototype.fields=function(fields){return this._makeMiddleware(fields,"OBJECT")};Multer.prototype.none=function(){return this._makeMiddleware([],"NONE")};Multer.prototype.any=function(){function setup(){return{limits:this.limits,preservePath:this.preservePath,defParamCharset:this.defParamCharset,storage:this.storage,fileFilter:this.fileFilter,fileStrategy:"ARRAY"}}return makeMiddleware(setup.bind(this))};function multer(options){if(options===void 0)return new Multer({});if(typeof options=="object"&&options!==null)return new Multer(options);throw new TypeError("Expected object for argument options")}module2.exports=multer;module2.exports.diskStorage=diskStorage;module2.exports.memoryStorage=memoryStorage;module2.exports.MulterError=MulterError}});var require_ua_parser=__commonJS({"node_modules/ua-parser-js/src/main/ua-parser.js"(exports2,module2){(function(window2,undefined2){"use strict";var LIBVERSION="2.0.10",UA_MAX_LENGTH=500,USER_AGENT="user-agent",EMPTY="",UNKNOWN="?",TYPEOF={FUNCTION:"function",OBJECT:"object",STRING:"string",UNDEFINED:"undefined"},BROWSER="browser",CPU="cpu",DEVICE="device",ENGINE="engine",OS="os",RESULT="result",NAME="name",TYPE="type",VENDOR="vendor",VERSION="version",ARCHITECTURE="architecture",MAJOR="major",MODEL="model",CONSOLE="console",MOBILE="mobile",TABLET="tablet",SMARTTV="smarttv",WEARABLE="wearable",XR="xr",EMBEDDED="embedded",FETCHER="fetcher",INAPP="inapp",BRANDS="brands",FORMFACTORS="formFactors",FULLVERLIST="fullVersionList",PLATFORM="platform",PLATFORMVER="platformVersion",BITNESS="bitness",CH="sec-ch-ua",CH_FULL_VER_LIST=CH+"-full-version-list",CH_ARCH=CH+"-arch",CH_BITNESS=CH+"-"+BITNESS,CH_FORM_FACTORS=CH+"-form-factors",CH_MOBILE=CH+"-"+MOBILE,CH_MODEL=CH+"-"+MODEL,CH_PLATFORM=CH+"-"+PLATFORM,CH_PLATFORM_VER=CH_PLATFORM+"-version",CH_ALL_VALUES=[BRANDS,FULLVERLIST,MOBILE,MODEL,PLATFORM,PLATFORMVER,ARCHITECTURE,FORMFACTORS,BITNESS],AMAZON="Amazon",APPLE="Apple",ASUS="ASUS",BLACKBERRY="BlackBerry",GOOGLE="Google",HUAWEI="Huawei",LENOVO="Lenovo",HONOR="Honor",LG="LG",MICROSOFT="Microsoft",MOTOROLA="Motorola",NVIDIA="Nvidia",ONEPLUS="OnePlus",OPPO="OPPO",SAMSUNG="Samsung",SHARP="Sharp",SONY="Sony",XIAOMI="Xiaomi",ZEBRA="Zebra",CHROME="Chrome",CHROMIUM="Chromium",CHROMECAST="Chromecast",EDGE="Edge",FIREFOX="Firefox",OPERA="Opera",FACEBOOK="Facebook",SOGOU="Sogou",PREFIX_MOBILE="Mobile ",SUFFIX_BROWSER=" Browser",WINDOWS="Windows",isWindow=typeof window2!==TYPEOF.UNDEFINED,NAVIGATOR=isWindow&&window2.navigator?window2.navigator:undefined2,NAVIGATOR_UADATA=NAVIGATOR&&NAVIGATOR.userAgentData?NAVIGATOR.userAgentData:undefined2,extend=function(defaultRgx,extensions){var mergedRgx={},extraRgx=extensions;if(!isExtensions(extensions)){extraRgx={};for(var i in extensions)for(var j in extensions[i])extraRgx[j]=extensions[i][j].concat(extraRgx[j]?extraRgx[j]:[])}for(var k in defaultRgx)mergedRgx[k]=extraRgx[k]&&extraRgx[k].length%2===0?extraRgx[k].concat(defaultRgx[k]):defaultRgx[k];return mergedRgx},enumerize=function(arr){for(var enums={},i=0;i<arr.length;i++)enums[arr[i].toUpperCase()]=arr[i];return enums},has=function(str1,str2){if(typeof str1===TYPEOF.OBJECT&&str1.length>0){for(var i in str1)if(lowerize(str2)==lowerize(str1[i]))return!0;return!1}return isString(str1)?lowerize(str2)==lowerize(str1):!1},isExtensions=function(obj,deep){for(var prop in obj)return/^(browser|cpu|device|engine|os)$/.test(prop)||(deep?isExtensions(obj[prop]):!1)},isString=function(val){return typeof val===TYPEOF.STRING},itemListToArray=function(header){if(!header)return undefined2;for(var arr=[],tokens=normalizeHeaderValue(header).split(","),i=0;i<tokens.length;i++)if(tokens[i].indexOf(";")>-1){var token=trim(tokens[i]).split(";v=");arr[i]={brand:token[0],version:token[1]}}else arr[i]=trim(tokens[i]);return arr},lowerize=function(str){return isString(str)?str.toLowerCase():str},majorize=function(version){return isString(version)?strip(/[^\d\.]/g,version).split(".")[0]:undefined2},normalizeHeaderValue=function(str){return isString(str)?trim(strip(/\\?\"/g,str),UA_MAX_LENGTH):undefined2},setProps=function(arr){for(var i in arr)if(arr.hasOwnProperty(i)){var propName=arr[i];typeof propName==TYPEOF.OBJECT&&propName.length==2?this[propName[0]]=propName[1]:this[propName]=undefined2}return this},strip=function(pattern,str){return isString(str)?str.replace(pattern,EMPTY):str},trim=function(str,len){return str=strip(/^\s\s*/,String(str)),typeof len===TYPEOF.UNDEFINED?str:str.substring(0,len)},rgxMapper=function(ua,arrays){if(!(!ua||!arrays))for(var i=0,j,k,p,q,matches,match;i<arrays.length&&!matches;){var regex=arrays[i],props=arrays[i+1];for(j=k=0;j<regex.length&&!matches&®ex[j];)if(matches=regex[j++].exec(ua),matches)for(p=0;p<props.length;p++)match=matches[++k],q=props[p],typeof q===TYPEOF.OBJECT&&q.length>0?q.length===2?typeof q[1]==TYPEOF.FUNCTION?this[q[0]]=q[1].call(this,match):this[q[0]]=q[1]:q.length>=3&&(typeof q[1]===TYPEOF.FUNCTION&&!(q[1].exec&&q[1].test)?q.length>3?this[q[0]]=match?q[1].apply(this,q.slice(2)):undefined2:this[q[0]]=match?q[1].call(this,match,q[2]):undefined2:q.length==3?this[q[0]]=match?match.replace(q[1],q[2]):undefined2:q.length==4?this[q[0]]=match?q[3].call(this,match.replace(q[1],q[2])):undefined2:q.length>4&&(this[q[0]]=match?q[3].apply(this,[match.replace(q[1],q[2])].concat(q.slice(4))):undefined2)):this[q]=match||undefined2;i+=2}},strTest=function(str,map){return map.test.test(str)?map.ifTrue:map.ifFalse},strMapper=function(str,map){for(var i in map)if(typeof map[i]===TYPEOF.OBJECT&&map[i].length>0){for(var j=0;j<map[i].length;j++)if(has(map[i][j],str))return i===UNKNOWN?undefined2:i}else if(has(map[i],str))return i===UNKNOWN?undefined2:i;return map.hasOwnProperty("*")?map["*"]:str},windowsVersionMap={ME:"4.90","NT 3.51":"3.51","NT 4.0":"4.0",2e3:["5.0","5.01"],XP:["5.1","5.2"],Vista:"6.0",7:"6.1",8:"6.2","8.1":"6.3",10:["6.4","10.0"],NT:""},formFactorsMap={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":undefined2},browserHintsMap={Chrome:"Google Chrome",Edge:"Microsoft Edge","Edge WebView2":"Microsoft Edge WebView2","Chrome WebView":"Android WebView","Chrome Headless":"HeadlessChrome","Huawei Browser":"HuaweiBrowser","MIUI Browser":"Miui Browser","Opera Mobi":"OperaMobile",Yandex:"YaBrowser"},defaultRegexes={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[VERSION,[NAME,PREFIX_MOBILE+"Chrome"]],[/webview.+edge\/([\w\.]+)/i],[VERSION,[NAME,EDGE+" WebView"],[TYPE,INAPP]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[VERSION,[NAME,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[NAME,VERSION],[/opios[\/ ]+([\w\.]+)/i],[VERSION,[NAME,OPERA+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[VERSION,[NAME,OPERA+" GX"]],[/\bopr\/([\w\.]+)/i],[VERSION,[NAME,OPERA]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[VERSION,[NAME,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[VERSION,[NAME,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(atlas|flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:hi|lg |ovi|qute)browser|palemoon)\/v?([-\w\.]+)/i,/(brave)(?: chrome)?\/([\d\.]+)/i,/(aloha|heytap|ovi|115|surf|qwant)browser\/([\d\.]+)/i,/(qwant)(?:ios|mobile)\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[NAME,VERSION],[/quark(?:pc)?\/([-\w\.]+)/i],[VERSION,[NAME,"Quark"]],[/\bddg\/([\w\.]+)/i],[VERSION,[NAME,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb| ucpc)[\/ ]?([\w\.]+)/i],[VERSION,[NAME,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[VERSION,[NAME,"WeChat"]],[/konqueror\/([\w\.]+)/i],[VERSION,[NAME,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[VERSION,[NAME,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[VERSION,[NAME,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[VERSION,[NAME,"Smart "+LENOVO+SUFFIX_BROWSER]],[/(av(?:ast|g|ira))\/([\w\.]+)/i],[[NAME,/(.+)/,"$1 Secure"+SUFFIX_BROWSER],VERSION],[/norton\/([\w\.]+)/i],[VERSION,[NAME,"Norton Private"+SUFFIX_BROWSER]],[/\bfocus\/([\w\.]+)/i],[VERSION,[NAME,FIREFOX+" Focus"]],[/ mms\/([\w\.]+)$/i],[VERSION,[NAME,OPERA+" Neon"]],[/ opt\/([\w\.]+)$/i],[VERSION,[NAME,OPERA+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[VERSION,[NAME,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[VERSION,[NAME,"Dolphin"]],[/coast\/([\w\.]+)/i],[VERSION,[NAME,OPERA+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[VERSION,[NAME,"MIUI"+SUFFIX_BROWSER]],[/fxios\/([\w\.-]+)/i],[VERSION,[NAME,PREFIX_MOBILE+FIREFOX]],[/\bqihoobrowser\/?([\w\.]*)/i],[VERSION,[NAME,"360"]],[/\b(qq)\/([\w\.]+)/i],[[NAME,/(.+)/,"$1Browser"],VERSION],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[NAME,/(.+)/,"$1"+SUFFIX_BROWSER],VERSION],[/ HBPC\/([\w\.]+)/],[VERSION,[NAME,HUAWEI+SUFFIX_BROWSER]],[/samsungbrowser\/([\w\.]+)/i],[VERSION,[NAME,SAMSUNG+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[VERSION,[NAME,SOGOU+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[NAME,SOGOU+" Mobile"],VERSION],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[NAME,VERSION],[/(lbbrowser|luakit|rekonq|steam(?= (clie|tenf|gameo)))/i],[NAME],[/ome\/([\w\.]+).+(iron(?= saf)|360(?=[es]e$))/i],[VERSION,NAME],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[NAME,FACEBOOK],VERSION,[TYPE,INAPP]],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(bing)(?:web|sapphire)\/([\w\.]+)/i,/(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i],[NAME,VERSION,[TYPE,INAPP]],[/\bgsa\/([\w\.]+) .*safari\//i],[VERSION,[NAME,"GSA"],[TYPE,INAPP]],[/(?:musical_ly|trill)(?:.+app_?version\/|_)([\w\.]+)/i],[VERSION,[NAME,"TikTok"],[TYPE,INAPP]],[/\[(linkedin)app\]/i],[NAME,[TYPE,INAPP]],[/(zalo(?:app)?)[\/\sa-z]*([\w\.-]+)/i],[[NAME,/(.+)/,"Zalo"],VERSION,[TYPE,INAPP]],[/(chromium)[\/ ]([-\w\.]+)/i],[NAME,VERSION],[/ome-(lighthouse)$/i],[NAME,[TYPE,FETCHER]],[/headlesschrome(?:\/([\w\.]+)| )/i],[VERSION,[NAME,CHROME+" Headless"]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[VERSION,[NAME,EDGE+" WebView2"],[TYPE,INAPP]],[/; wv\).+(chrome)\/([\w\.]+)/i],[[NAME,CHROME+" WebView"],VERSION,[TYPE,INAPP]],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[VERSION,[NAME,"Android"+SUFFIX_BROWSER]],[/chrome\/([\w\.]+) mobile/i],[VERSION,[NAME,PREFIX_MOBILE+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[NAME,VERSION],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[VERSION,[NAME,PREFIX_MOBILE+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[NAME,PREFIX_MOBILE+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[VERSION,NAME],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[NAME,[VERSION,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[NAME,VERSION],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[NAME,PREFIX_MOBILE+FIREFOX],VERSION],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[NAME,"Netscape"],VERSION],[/(wolvic|librewolf)\/([\w\.]+)/i],[NAME,VERSION],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[VERSION,[NAME,FIREFOX+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+(?= .+rv\:.+gecko\/\d+)|[0-4][\w\.]+(?!.+compatible))/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[NAME,[VERSION,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[NAME,[VERSION,/[^\d\.]+./,EMPTY]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[ARCHITECTURE,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[ARCHITECTURE,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[ARCHITECTURE,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[ARCHITECTURE,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[ARCHITECTURE,"arm"]],[/ sun4\w[;\)]/i],[[ARCHITECTURE,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i,/((ppc|powerpc)(64)?)( mac|;|\))/i,/(?:osf1|[freopnt]{3,4}bsd) (alpha)/i],[[ARCHITECTURE,/ower/,EMPTY,lowerize]],[/mc680.0/i],[[ARCHITECTURE,"68k"]],[/winnt.+\[axp/i],[[ARCHITECTURE,"alpha"]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[MODEL,[VENDOR,SAMSUNG],[TYPE,TABLET]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,/sec-(sgh\w+)/i],[MODEL,[VENDOR,SAMSUNG],[TYPE,MOBILE]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)[\/\);]/i],[MODEL,[VENDOR,APPLE],[TYPE,MOBILE]],[/\b(?:ios|apple\w+)\/.+[\(\/](ipad)/i,/\b(ipad)[\d,]*[;\] ].+(mac |i(pad)?)os/i],[MODEL,[VENDOR,APPLE],[TYPE,TABLET]],[/(macintosh);/i],[MODEL,[VENDOR,APPLE]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[MODEL,[VENDOR,SHARP],[TYPE,MOBILE]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[MODEL,[VENDOR,HONOR],[TYPE,TABLET]],[/honor([-\w ]+)[;\)]/i],[MODEL,[VENDOR,HONOR],[TYPE,MOBILE]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[MODEL,[VENDOR,HUAWEI],[TYPE,TABLET]],[/(?:huawei) ?([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][\dc][adnt]?)\b(?!.+d\/s)/i],[MODEL,[VENDOR,HUAWEI],[TYPE,MOBILE]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b(?:xiao)?((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[MODEL,/_/g," "],[VENDOR,XIAOMI],[TYPE,TABLET]],[/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/oid[^\)]+; (redmi[\-_ ]?(?:note|k)?[\w_ ]+|m?[12]\d[01]\d\w{3,6}|poco[\w ]+|(shark )?\w{3}-[ah]0|qin ?[1-3](s\+|ultra| pro)?)( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note|max|cc)?[_ ]?(?:\d{0,2}\w?)[_ ]?(?:plus|se|lite|pro)?( 5g|lte)?)(?: bui|\))/i,/; ([\w ]+) miui\/v?\d/i],[[MODEL,/_/g," "],[VENDOR,XIAOMI],[TYPE,MOBILE]],[/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-l]\w[1m]10)\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[MODEL,[VENDOR,ONEPLUS],[TYPE,MOBILE]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[MODEL,[VENDOR,OPPO],[TYPE,MOBILE]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[MODEL,[VENDOR,strMapper,{OnePlus:["203","304","403","404","413","415"],"*":OPPO}],[TYPE,TABLET]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[MODEL,[VENDOR,"BLU"],[TYPE,MOBILE]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[MODEL,[VENDOR,"Vivo"],[TYPE,MOBILE]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[MODEL,[VENDOR,"Realme"],[TYPE,MOBILE]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[MODEL,[VENDOR,LENOVO],[TYPE,TABLET]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[MODEL,[VENDOR,LENOVO],[TYPE,MOBILE]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,/((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i],[MODEL,[VENDOR,MOTOROLA],[TYPE,MOBILE]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[MODEL,[VENDOR,MOTOROLA],[TYPE,TABLET]],[/\b(?:lg)?([vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[MODEL,[VENDOR,LG],[TYPE,TABLET]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[MODEL,[VENDOR,LG],[TYPE,MOBILE]],[/(nokia) (t[12][01])/i],[VENDOR,MODEL,[TYPE,TABLET]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*?))( bui|\)|;|\/)/i],[[MODEL,/_/g," "],[TYPE,MOBILE],[VENDOR,"Nokia"]],[/(pixel (c|tablet))\b/i],[MODEL,[VENDOR,GOOGLE],[TYPE,TABLET]],[/droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i],[MODEL,[VENDOR,GOOGLE],[TYPE,MOBILE]],[/(google) (pixelbook( go)?)/i],[VENDOR,MODEL],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[MODEL,[VENDOR,SONY],[TYPE,MOBILE]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[MODEL,"Xperia Tablet"],[VENDOR,SONY],[TYPE,TABLET]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[MODEL,[VENDOR,AMAZON],[TYPE,TABLET]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[MODEL,/(.+)/g,"Fire Phone $1"],[VENDOR,AMAZON],[TYPE,MOBILE]],[/(playbook);[-\w\),; ]+(rim)/i],[MODEL,VENDOR,[TYPE,TABLET]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/(?:blackberry|\(bb10;) (\w+)/i],[MODEL,[VENDOR,BLACKBERRY],[TYPE,MOBILE]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[MODEL,[VENDOR,ASUS],[TYPE,TABLET]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[MODEL,[VENDOR,ASUS],[TYPE,MOBILE]],[/(nexus 9)/i],[MODEL,[VENDOR,"HTC"],[TYPE,TABLET]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[VENDOR,[MODEL,/_/g," "],[TYPE,MOBILE]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[MODEL,[VENDOR,"TCL"],[TYPE,TABLET]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[MODEL,[VENDOR,"TCL"],[TYPE,MOBILE]],[/(itel) ((\w+))/i],[[VENDOR,lowerize],MODEL,[TYPE,strMapper,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[MODEL,[VENDOR,"Acer"],[TYPE,TABLET]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[MODEL,[VENDOR,"Meizu"],[TYPE,MOBILE]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[MODEL,[VENDOR,"Ulefone"],[TYPE,MOBILE]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[MODEL,[VENDOR,"Energizer"],[TYPE,MOBILE]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[MODEL,[VENDOR,"Cat"],[TYPE,MOBILE]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[MODEL,[VENDOR,"Smartfren"],[TYPE,MOBILE]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[MODEL,[VENDOR,"Nothing"],[TYPE,MOBILE]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[MODEL,[VENDOR,"Archos"],[TYPE,TABLET]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[MODEL,[VENDOR,"Archos"],[TYPE,MOBILE]],[/blackview ([-\w ]+)( b|\))/i,/; (bv\d{4}[-\w ]*)( b|\))/i],[MODEL,[VENDOR,"Blackview"],[TYPE,MOBILE]],[/; (n159v)/i],[MODEL,[VENDOR,"HMD"],[TYPE,MOBILE]],[/((revvl[ \w\+]+|tm(?:rv|af)\w*[45]g(?:tb)?))( b|\))/i],[MODEL,[TYPE,strTest,{test:/ta?b/i,ifTrue:TABLET,ifFalse:MOBILE}],[VENDOR,"T-Mobile"]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[VENDOR,MODEL,[TYPE,TABLET]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|coolpad|cubot|hmd|imo|infinix|lava|oneplus|tcl|wiko)[_ ]([-\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(oppo) ?([\w ]+) bui/i,/(hisense) ([ehv][\w ]+)\)/i,/droid[^;]+; (philips)[_ ]([sv-x][\d]{3,4}[xz]?)/i],[VENDOR,MODEL,[TYPE,MOBILE]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[VENDOR,MODEL,[TYPE,TABLET]],[/(surface duo)/i],[MODEL,[VENDOR,MICROSOFT],[TYPE,TABLET]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[MODEL,[VENDOR,"Fairphone"],[TYPE,MOBILE]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[MODEL,[VENDOR,NVIDIA],[TYPE,TABLET]],[/(sprint) (\w+)/i],[VENDOR,MODEL,[TYPE,MOBILE]],[/(kin\.[onetw]{3})/i],[[MODEL,/\./g," "],[VENDOR,MICROSOFT],[TYPE,MOBILE]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[MODEL,[VENDOR,ZEBRA],[TYPE,TABLET]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[MODEL,[VENDOR,ZEBRA],[TYPE,MOBILE]],[/(philips)[\w ]+tv/i,/smart-tv.+(samsung)/i],[VENDOR,[TYPE,SMARTTV]],[/hbbtv.+maple;(\d+)/i],[[MODEL,/^/,"SmartTV"],[VENDOR,SAMSUNG],[TYPE,SMARTTV]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[VENDOR,MODEL,[TYPE,SMARTTV]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[VENDOR,LG],[TYPE,SMARTTV]],[/(apple) ?tv/i],[VENDOR,[MODEL,APPLE+" TV"],[TYPE,SMARTTV]],[/crkey.*devicetype\/chromecast/i],[[MODEL,CHROMECAST+" Third Generation"],[VENDOR,GOOGLE],[TYPE,SMARTTV]],[/crkey.*devicetype\/([^/]*)/i],[[MODEL,/^/,"Chromecast "],[VENDOR,GOOGLE],[TYPE,SMARTTV]],[/fuchsia.*crkey/i],[[MODEL,CHROMECAST+" Nest Hub"],[VENDOR,GOOGLE],[TYPE,SMARTTV]],[/crkey/i],[[MODEL,CHROMECAST],[VENDOR,GOOGLE],[TYPE,SMARTTV]],[/(portaltv)/i],[MODEL,[VENDOR,FACEBOOK],[TYPE,SMARTTV]],[/droid.+aft(\w+)( bui|\))/i],[MODEL,[VENDOR,AMAZON],[TYPE,SMARTTV]],[/(shield \w+ tv)/i],[MODEL,[VENDOR,NVIDIA],[TYPE,SMARTTV]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[MODEL,[VENDOR,SHARP],[TYPE,SMARTTV]],[/(bravia[\w ]+)( bui|\))/i],[MODEL,[VENDOR,SONY],[TYPE,SMARTTV]],[/(mi(tv|box)-?\w+) bui/i],[MODEL,[VENDOR,XIAOMI],[TYPE,SMARTTV]],[/Hbbtv.*(technisat) (.*);/i],[VENDOR,MODEL,[TYPE,SMARTTV]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[VENDOR,/.+\/(\w+)/,"$1",strMapper,{LG:"lge"}],[MODEL,trim],[TYPE,SMARTTV]],[/(playstation \w+)/i],[MODEL,[VENDOR,SONY],[TYPE,CONSOLE]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[MODEL,[VENDOR,MICROSOFT],[TYPE,CONSOLE]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i,/(valve).+(steam deck)/i,/droid.+; ((shield|rgcube|gr0006))( bui|\))/i],[[VENDOR,strMapper,{Nvidia:"Shield",Anbernic:"RGCUBE",Logitech:"GR0006"}],MODEL,[TYPE,CONSOLE]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[MODEL,[VENDOR,SAMSUNG],[TYPE,WEARABLE]],[/((pebble))app/i,/(asus|google|lg|oppo|xiaomi) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[VENDOR,MODEL,[TYPE,WEARABLE]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[MODEL,[VENDOR,OPPO],[TYPE,WEARABLE]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[MODEL,[VENDOR,APPLE],[TYPE,WEARABLE]],[/(opwwe\d{3})/i],[MODEL,[VENDOR,ONEPLUS],[TYPE,WEARABLE]],[/(moto 360)/i],[MODEL,[VENDOR,MOTOROLA],[TYPE,WEARABLE]],[/(smartwatch 3)/i],[MODEL,[VENDOR,SONY],[TYPE,WEARABLE]],[/(g watch r)/i],[MODEL,[VENDOR,LG],[TYPE,WEARABLE]],[/droid.+; (wt63?0{2,3})\)/i],[MODEL,[VENDOR,ZEBRA],[TYPE,WEARABLE]],[/droid.+; (glass) \d/i],[MODEL,[VENDOR,GOOGLE],[TYPE,XR]],[/(pico) ([\w ]+) os\d/i],[VENDOR,MODEL,[TYPE,XR]],[/(quest( \d| pro)?s?).+vr/i],[MODEL,[VENDOR,FACEBOOK],[TYPE,XR]],[/mobile vr; rv.+firefox/i],[[TYPE,XR]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[VENDOR,[TYPE,EMBEDDED]],[/(aeobc)\b/i],[MODEL,[VENDOR,AMAZON],[TYPE,EMBEDDED]],[/(homepod).+mac os/i],[MODEL,[VENDOR,APPLE],[TYPE,EMBEDDED]],[/windows iot/i],[[TYPE,EMBEDDED]],[/droid.+; ([\w- ]+) (4k|android|smart|google)[- ]?tv/i],[MODEL,[TYPE,SMARTTV]],[/\b((4k|android|smart|opera)[- ]?tv|tv; rv:|large screen[\w ]+safari)\b/i],[[TYPE,SMARTTV]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew|; hmsc).+?(mobile|vr|\d) safari/i],[MODEL,[TYPE,strMapper,{mobile:"Mobile",xr:"VR","*":TABLET}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[TYPE,TABLET]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[TYPE,MOBILE]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[MODEL,[VENDOR,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[VERSION,[NAME,EDGE+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[NAME,VERSION],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[VERSION,[NAME,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links|dillo)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[NAME,VERSION],[/ladybird\//i],[[NAME,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[VERSION,NAME]],os:[[/(windows nt) (6\.[23]); arm/i],[[NAME,/N/,"R"],[VERSION,strMapper,windowsVersionMap]],[/(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i,/(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i],[NAME,VERSION],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[VERSION,/(;|\))/g,"",strMapper,windowsVersionMap],[NAME,WINDOWS]],[/(windows ce)\/?([\d\.]*)/i],[NAME,VERSION],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv|ios(?=.+ip(?:ad|hone)|.+apple ?tv)|ip(?:ad|hone)(?: |.+i(?:pad)?)os|apple ?tv.+ios)[\/ ]([\w\.]+)/i,/\btvos ?([\w\.]+)/i,/cfnetwork\/.+darwin/i],[[VERSION,/_/g,"."],[NAME,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[NAME,"macOS"],[VERSION,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[VERSION,[NAME,CHROMECAST+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[VERSION,[NAME,CHROMECAST+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[VERSION,[NAME,CHROMECAST+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[VERSION,[NAME,CHROMECAST+" Linux"]],[/crkey\/([\d\.]+)/i],[VERSION,[NAME,CHROMECAST]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[VERSION,NAME],[/(ubuntu) ([\w\.]+) like android/i],[[NAME,/(.+)/,"$1 Touch"],VERSION],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[NAME,VERSION],[/\(bb(10);/i],[VERSION,[NAME,BLACKBERRY]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[VERSION,[NAME,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile[;\w ]*|tablet|tv|[^\)]*(?:viera|lg(?:l25|-d300)|alcatel ?o.+|y300-f1)); rv:([\w\.]+)\).+gecko\//i],[VERSION,[NAME,FIREFOX+" OS"]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[VERSION,[NAME,"webOS"]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[VERSION,strMapper,{25:"120",24:"108",23:"94",22:"87",6:"79",5:"68",4:"53",3:"38",2:"538",1:"537","*":"TV"}],[NAME,"webOS"]],[/watch(?: ?os[,\/ ]|\d,\d\/)([\d\.]+)/i],[VERSION,[NAME,"watchOS"]],[/cros [\w]+(?:\)| ([\w\.]+)\b)/i],[VERSION,[NAME,"Chrome OS"]],[/kepler ([\w\.]+); (aft|aeo)/i],[VERSION,[NAME,"Vega OS"]],[/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/linux.+(mint)[\/\(\) ]?([\w\.]*)/i,/(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/\b(aix)[; ]([1-9\.]{0,4})/i,/(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) ?(r\d)?/i],[NAME,VERSION],[/(sunos) ?([\d\.]*)/i],[[NAME,"Solaris"],VERSION],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[NAME,VERSION]]},defaultProps=(function(){var props={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return setProps.call(props.init,[[BROWSER,[NAME,VERSION,MAJOR,TYPE]],[CPU,[ARCHITECTURE]],[DEVICE,[TYPE,MODEL,VENDOR]],[ENGINE,[NAME,VERSION]],[OS,[NAME,VERSION]]]),setProps.call(props.isIgnore,[[BROWSER,[VERSION,MAJOR]],[ENGINE,[VERSION]],[OS,[VERSION]]]),setProps.call(props.isIgnoreRgx,[[BROWSER,/ ?browser$/i],[OS,/ ?os$/i]]),setProps.call(props.toString,[[BROWSER,[NAME,VERSION]],[CPU,[ARCHITECTURE]],[DEVICE,[VENDOR,MODEL]],[ENGINE,[NAME,VERSION]],[OS,[NAME,VERSION]]]),props})(),createIData=function(item,itemType){var init_props=defaultProps.init[itemType],is_ignoreProps=defaultProps.isIgnore[itemType]||0,is_ignoreRgx=defaultProps.isIgnoreRgx[itemType]||0,toString_props=defaultProps.toString[itemType]||0;function IData(){setProps.call(this,init_props)}return IData.prototype.getItem=function(){return item},IData.prototype.withClientHints=function(){return NAVIGATOR_UADATA?NAVIGATOR_UADATA.getHighEntropyValues(CH_ALL_VALUES).then(function(res){return item.setCH(new UACHData(res,!1)).parseCH().get()}):item.parseCH().get()},IData.prototype.withFeatureCheck=function(){return item.detectFeature().get()},itemType!=RESULT&&(IData.prototype.is=function(strToCheck){var is=!1;for(var i in this)if(this.hasOwnProperty(i)&&!has(is_ignoreProps,i)&&lowerize(is_ignoreRgx?strip(is_ignoreRgx,this[i]):this[i])==lowerize(is_ignoreRgx?strip(is_ignoreRgx,strToCheck):strToCheck)){if(is=!0,strToCheck!=TYPEOF.UNDEFINED)break}else if(strToCheck==TYPEOF.UNDEFINED&&is){is=!is;break}return is},IData.prototype.toString=function(){var str=EMPTY;for(var i in toString_props)typeof this[toString_props[i]]!==TYPEOF.UNDEFINED&&(str+=(str?" ":EMPTY)+this[toString_props[i]]);return str||TYPEOF.UNDEFINED}),IData.prototype.then=function(cb){var that=this,IDataResolve=function(){for(var prop in that)that.hasOwnProperty(prop)&&(this[prop]=that[prop])};IDataResolve.prototype={is:IData.prototype.is,toString:IData.prototype.toString,withClientHints:IData.prototype.withClientHints,withFeatureCheck:IData.prototype.withFeatureCheck};var resolveData=new IDataResolve;return cb(resolveData),resolveData},new IData};function UACHData(uach,isHttpUACH){if(uach=uach||{},setProps.call(this,CH_ALL_VALUES),isHttpUACH)setProps.call(this,[[BRANDS,itemListToArray(uach[CH])],[FULLVERLIST,itemListToArray(uach[CH_FULL_VER_LIST])],[MOBILE,/\?1/.test(uach[CH_MOBILE])],[MODEL,normalizeHeaderValue(uach[CH_MODEL])],[PLATFORM,normalizeHeaderValue(uach[CH_PLATFORM])],[PLATFORMVER,normalizeHeaderValue(uach[CH_PLATFORM_VER])],[ARCHITECTURE,normalizeHeaderValue(uach[CH_ARCH])],[FORMFACTORS,itemListToArray(uach[CH_FORM_FACTORS])],[BITNESS,normalizeHeaderValue(uach[CH_BITNESS])]]);else for(var prop in uach)this.hasOwnProperty(prop)&&typeof uach[prop]!==TYPEOF.UNDEFINED&&(this[prop]=uach[prop])}function UAItem(itemType,ua,rgxMap,uaCH){return setProps.call(this,[["itemType",itemType],["ua",ua],["uaCH",uaCH],["rgxMap",rgxMap],["data",createIData(this,itemType)]]),this}UAItem.prototype.get=function(prop){return prop?this.data.hasOwnProperty(prop)?this.data[prop]:undefined2:this.data},UAItem.prototype.set=function(prop,val){return this.data[prop]=val,this},UAItem.prototype.setCH=function(ch){return this.uaCH=ch,this},UAItem.prototype.detectFeature=function(){if(NAVIGATOR&&NAVIGATOR.userAgent==this.ua)switch(this.itemType){case BROWSER:NAVIGATOR.brave&&typeof NAVIGATOR.brave.isBrave==TYPEOF.FUNCTION&&this.set(NAME,"Brave");break;case DEVICE:!this.get(TYPE)&&NAVIGATOR_UADATA&&NAVIGATOR_UADATA[MOBILE]&&this.set(TYPE,MOBILE),this.get(MODEL)=="Macintosh"&&NAVIGATOR&&typeof NAVIGATOR.standalone!==TYPEOF.UNDEFINED&&NAVIGATOR.maxTouchPoints&&NAVIGATOR.maxTouchPoints>2&&this.set(MODEL,"iPad").set(TYPE,TABLET);break;case OS:!this.get(NAME)&&NAVIGATOR_UADATA&&NAVIGATOR_UADATA[PLATFORM]&&this.set(NAME,NAVIGATOR_UADATA[PLATFORM]);break;case RESULT:var data=this.data,detect=function(itemType){return data[itemType].getItem().detectFeature().get()};this.set(BROWSER,detect(BROWSER)).set(CPU,detect(CPU)).set(DEVICE,detect(DEVICE)).set(ENGINE,detect(ENGINE)).set(OS,detect(OS))}return this},UAItem.prototype.parseUA=function(){switch(this.itemType!=RESULT&&rgxMapper.call(this.data,this.ua,this.rgxMap),this.itemType){case BROWSER:this.set(MAJOR,majorize(this.get(VERSION)));break;case OS:if(this.get(NAME)=="iOS"&&this.get(VERSION)&&/^1[89][^\d]/.exec(this.get(VERSION))){var realVersion=/\) Version\/((\d+)[\d\.]*)/.exec(this.ua);realVersion&&parseInt(realVersion[2],10)>=26&&this.set(VERSION,realVersion[1])}break}return this},UAItem.prototype.parseCH=function(){var uaCH=this.uaCH,rgxMap=this.rgxMap;switch(this.itemType){case BROWSER:case ENGINE:var brands=uaCH[FULLVERLIST]||uaCH[BRANDS],prevName;if(brands)for(var i=0;i<brands.length;i++){var brandName=brands[i].brand||brands[i],brandVersion=brands[i].version;this.itemType==BROWSER&&!/not.a.brand/i.test(brandName)&&(!prevName||/Chrom/.test(prevName)&&brandName!=CHROMIUM||prevName==EDGE&&/WebView2/.test(brandName))&&(brandName=strMapper(brandName,browserHintsMap),prevName=this.get(NAME),prevName&&!/Chrom/.test(prevName)&&/Chrom/.test(brandName)||this.set(NAME,brandName).set(VERSION,brandVersion).set(MAJOR,majorize(brandVersion)),prevName=brandName),this.itemType==ENGINE&&brandName==CHROMIUM&&this.set(VERSION,brandVersion)}break;case CPU:var archName=uaCH[ARCHITECTURE];archName&&(archName&&uaCH[BITNESS]=="64"&&(archName+="64"),rgxMapper.call(this.data,archName+";",rgxMap));break;case DEVICE:if(uaCH[MOBILE]&&this.set(TYPE,MOBILE),uaCH[MODEL]&&(this.set(MODEL,uaCH[MODEL]),!this.get(TYPE)||!this.get(VENDOR))){var reParse={};rgxMapper.call(reParse,"droid 9; "+uaCH[MODEL]+")",rgxMap),!this.get(TYPE)&&reParse.type&&this.set(TYPE,reParse.type),!this.get(VENDOR)&&reParse.vendor&&this.set(VENDOR,reParse.vendor)}if(uaCH[FORMFACTORS]){var ff;if(typeof uaCH[FORMFACTORS]!="string")for(var idx=0;!ff&&idx<uaCH[FORMFACTORS].length;)ff=strMapper(uaCH[FORMFACTORS][idx++],formFactorsMap);else ff=strMapper(uaCH[FORMFACTORS],formFactorsMap);this.set(TYPE,ff)}break;case OS:var osName=uaCH[PLATFORM];if(osName){var osVersion=uaCH[PLATFORMVER];osName==WINDOWS&&(osVersion=parseInt(majorize(osVersion),10)>=13?"11":"10"),this.set(NAME,osName).set(VERSION,osVersion)}this.get(NAME)==WINDOWS&&uaCH[MODEL]=="Xbox"&&this.set(NAME,"Xbox").set(VERSION,undefined2);break;case RESULT:var data=this.data,parse=function(itemType){return data[itemType].getItem().setCH(uaCH).parseCH().get()};this.set(BROWSER,parse(BROWSER)).set(CPU,parse(CPU)).set(DEVICE,parse(DEVICE)).set(ENGINE,parse(ENGINE)).set(OS,parse(OS))}return this};function UAParser(ua,extensions,headers){if(typeof ua===TYPEOF.OBJECT?(isExtensions(ua,!0)?(typeof extensions===TYPEOF.OBJECT&&(headers=extensions),extensions=ua):(headers=ua,extensions=undefined2),ua=undefined2):typeof ua===TYPEOF.STRING&&!isExtensions(extensions,!0)&&(headers=extensions,extensions=undefined2),headers)if(typeof headers.append===TYPEOF.FUNCTION){var kv={};headers.forEach(function(v,k){kv[String(k).toLowerCase()]=v}),headers=kv}else{var normalized={};for(var header in headers)headers.hasOwnProperty(header)&&(normalized[String(header).toLowerCase()]=headers[header]);headers=normalized}if(!(this instanceof UAParser))return new UAParser(ua,extensions,headers).getResult();var userAgent=typeof ua===TYPEOF.STRING?ua:headers&&headers[USER_AGENT]?headers[USER_AGENT]:NAVIGATOR&&NAVIGATOR.userAgent?NAVIGATOR.userAgent:EMPTY,httpUACH=new UACHData(headers,!0),regexMap=defaultRegexes,createItemFunc=function(itemType){return itemType==RESULT?function(){return new UAItem(itemType,userAgent,regexMap,httpUACH).set("ua",userAgent).set(BROWSER,this.getBrowser()).set(CPU,this.getCPU()).set(DEVICE,this.getDevice()).set(ENGINE,this.getEngine()).set(OS,this.getOS()).get()}:function(){return new UAItem(itemType,userAgent,regexMap[itemType],httpUACH).parseUA().get()}};return setProps.call(this,[["getBrowser",createItemFunc(BROWSER)],["getCPU",createItemFunc(CPU)],["getDevice",createItemFunc(DEVICE)],["getEngine",createItemFunc(ENGINE)],["getOS",createItemFunc(OS)],["getResult",createItemFunc(RESULT)],["getUA",function(){return userAgent}],["setUA",function(ua2){return isString(ua2)&&(userAgent=trim(ua2,UA_MAX_LENGTH)),this}],["useExtension",function(exts){return exts&&(regexMap=extend(regexMap,exts)),this}]]).setUA(userAgent).useExtension(extensions),this}UAParser.VERSION=LIBVERSION,UAParser.BROWSER=enumerize([NAME,VERSION,MAJOR,TYPE]),UAParser.CPU=enumerize([ARCHITECTURE]),UAParser.DEVICE=enumerize([MODEL,VENDOR,TYPE,CONSOLE,MOBILE,SMARTTV,TABLET,WEARABLE,EMBEDDED]),UAParser.ENGINE=UAParser.OS=enumerize([NAME,VERSION]),typeof exports2!==TYPEOF.UNDEFINED?(typeof module2!==TYPEOF.UNDEFINED&&module2.exports&&(exports2=module2.exports=UAParser),exports2.UAParser=UAParser):typeof define===TYPEOF.FUNCTION&&define.amd?define(function(){return UAParser}):isWindow&&(window2.UAParser=UAParser);var $=isWindow&&(window2.jQuery||window2.Zepto);if($&&!$.ua){var parser=new UAParser;$.ua=parser.getResult(),$.ua.get=function(){return parser.getUA()},$.ua.set=function(ua){parser.setUA(ua);var result=parser.getResult();for(var prop in result)$.ua[prop]=result[prop]}}})(typeof window=="object"?window:exports2)}});var require_archiveShared=__commonJS({"src/lib/archiveShared.js"(exports2,module2){var path=require("path");function createArchiveError(message,statusCode=400){let error=new Error(message);return error.statusCode=statusCode,error}function isSafeArchiveEntry(entryPath){let normalized=String(entryPath||"").replace(/\\/g,"/").replace(/\/+$/,"");return!normalized||normalized.startsWith("/")||/^[a-zA-Z]:/.test(normalized)?!1:normalized.split("/").every(part=>part&&part!=="."&&part!=="..")}function isInside(parentPath,candidatePath){let relative=path.relative(parentPath,candidatePath);return relative===""||!relative.startsWith("..")&&!path.isAbsolute(relative)}function hasArchiveExtension(filePath,extensions){let lower=String(filePath||"").toLowerCase();return extensions.some(extension=>lower.endsWith(extension))}module2.exports={createArchiveError,hasArchiveExtension,isInside,isSafeArchiveEntry}}});var require_light=__commonJS({"src/lib/archiveProviders/light.js"(exports2,module2){var{createReadStream,createWriteStream,mkdirSync}=require("fs"),path=require("path"),{pipeline}=require("stream/promises"),{createGunzip}=require("zlib"),tar=require("tar-stream"),yauzl=require("yauzl"),{createArchiveError,hasArchiveExtension,isSafeArchiveEntry}=require_archiveShared(),extensions=[".tar.gz",".tgz",".zip",".tar"],capabilities={edition:"light",createFormats:["zip","tar.gz"],readExtensions:extensions.map(extension=>extension.slice(1))};function isArchivePath(filePath){return hasArchiveExtension(filePath,extensions)}function isZipPath(filePath){return String(filePath).toLowerCase().endsWith(".zip")}function isCompressedTarPath(filePath){return/\.(tar\.gz|tgz)$/i.test(filePath)}function isTarMetadataEntry(header){return["pax-global-header","pax-header","gnu-long-path","gnu-long-link"].includes(header.type)}function isSafeTarEntry(header){return["file","directory"].includes(header.type)&&isSafeArchiveEntry(header.name)}function isZipDirectory(entry){return/\/$/.test(entry.fileName)}function isZipSymbolicLink(entry){let mode=Math.floor(Number(entry.externalFileAttributes||0)/65536)%65536;return Math.floor(mode/4096)%16===10}function isZipEncrypted(entry){return Number(entry.generalPurposeBitFlag||0)%2===1}function openZip(filePath){return new Promise((resolve,reject)=>{yauzl.open(filePath,{autoClose:!0,lazyEntries:!0,validateEntrySizes:!0},(error,zipFile)=>{error?reject(createArchiveError(`Unable to read ZIP archive: ${error.message}`,422)):resolve(zipFile)})})}async function listZip(filePath){let zipFile=await openZip(filePath);return new Promise((resolve,reject)=>{let entries=[],settled=!1,finish=(callback,value)=>{settled||(settled=!0,zipFile.close(),callback(value))};zipFile.on("entry",entry=>{entries.push({path:entry.fileName.replace(/\\/g,"/"),isDirectory:isZipDirectory(entry),isSymbolicLink:isZipSymbolicLink(entry),size:Number(entry.uncompressedSize||0),packedSize:Number(entry.compressedSize||0),encrypted:isZipEncrypted(entry),modified:entry.getLastModDate().toISOString(),attributes:""}),zipFile.readEntry()}),zipFile.once("end",()=>finish(resolve,entries)),zipFile.once("error",error=>finish(reject,createArchiveError(`Unable to read ZIP archive: ${error.message}`,422))),zipFile.readEntry()})}async function listTar(filePath){return new Promise((resolve,reject)=>{let entries=[],extractor=tar.extract(),input=createReadStream(filePath),streams=[input,extractor],source=input,settled=!1;if(isCompressedTarPath(filePath)){let gunzip=createGunzip();streams.push(gunzip),source=input.pipe(gunzip)}let finish=(callback,value)=>{settled||(settled=!0,callback(value))},fail=error=>{streams.forEach(stream=>stream.destroy()),finish(reject,createArchiveError(`Unable to read TAR archive: ${error.message}`,422))};streams.forEach(stream=>stream.once("error",fail)),extractor.on("entry",(header,entryStream,next)=>{isTarMetadataEntry(header)||entries.push({path:String(header.name||"").replace(/\\/g,"/"),isDirectory:header.type==="directory",isSymbolicLink:!isSafeTarEntry(header),size:Number(header.size||0),packedSize:0,encrypted:!1,modified:header.mtime?new Date(header.mtime).toISOString():null,attributes:header.type||""}),entryStream.once("error",fail),entryStream.once("end",next),entryStream.resume()}),extractor.once("finish",()=>finish(resolve,entries)),source.pipe(extractor)})}async function listEntries(filePath){return isZipPath(filePath)?listZip(filePath):listTar(filePath)}function assertZipEntrySafe(entry){if(!isSafeArchiveEntry(entry.fileName)||isZipSymbolicLink(entry))throw createArchiveError("Archive contains an unsafe entry path",422);if(isZipEncrypted(entry))throw createArchiveError("Encrypted archives are not supported",422)}async function extractZip(job,sourcePath,targetPath){let zipFile=await openZip(sourcePath);return new Promise((resolve,reject)=>{let settled=!1,finish=(callback,value)=>{settled||(settled=!0,zipFile.close(),callback(value))},next=()=>{settled||zipFile.readEntry()};zipFile.on("entry",entry=>{try{assertZipEntrySafe(entry);let outputPath=path.join(targetPath,entry.fileName);if(isZipDirectory(entry)){mkdirSync(outputPath,{recursive:!0}),job.progress.processedEntries=Math.min(job.progress.totalEntries,job.progress.processedEntries+1),next();return}mkdirSync(path.dirname(outputPath),{recursive:!0}),zipFile.openReadStream(entry,async(error,input)=>{if(error)return finish(reject,createArchiveError(`Unable to extract ZIP archive: ${error.message}`,422));try{return await pipeline(input,createWriteStream(outputPath,{flags:"wx"})),job.progress.processedEntries=Math.min(job.progress.totalEntries,job.progress.processedEntries+1),next()}catch(streamError){finish(reject,createArchiveError(`Unable to extract ZIP archive: ${streamError.message}`,422))}})}catch(error){finish(reject,error)}}),zipFile.once("end",()=>finish(resolve)),zipFile.once("error",error=>finish(reject,createArchiveError(`Unable to extract ZIP archive: ${error.message}`,422))),zipFile.readEntry()})}async function extractTar(job,sourcePath,targetPath){return new Promise((resolve,reject)=>{let extractor=tar.extract(),input=createReadStream(sourcePath),streams=[input,extractor],source=input,settled=!1;if(isCompressedTarPath(sourcePath)){let gunzip=createGunzip();streams.push(gunzip),source=input.pipe(gunzip)}let finish=(callback,value)=>{settled||(settled=!0,callback(value))},fail=error=>{streams.forEach(stream=>stream.destroy());let archiveError=error.statusCode?error:createArchiveError(`Unable to extract TAR archive: ${error.message}`,422);finish(reject,archiveError)};streams.forEach(stream=>stream.once("error",fail)),extractor.on("entry",(header,entryStream,next)=>{if(isTarMetadataEntry(header)){entryStream.once("error",fail),entryStream.once("end",next),entryStream.resume();return}if(!isSafeTarEntry(header)){fail(createArchiveError("Archive contains an unsafe entry path",422));return}let outputPath=path.join(targetPath,header.name);if(header.type==="directory"){mkdirSync(outputPath,{recursive:!0}),entryStream.once("error",fail),entryStream.once("end",()=>{job.progress.processedEntries=Math.min(job.progress.totalEntries,job.progress.processedEntries+1),next()}),entryStream.resume();return}mkdirSync(path.dirname(outputPath),{recursive:!0}),pipeline(entryStream,createWriteStream(outputPath,{flags:"wx"})).then(()=>{job.progress.processedEntries=Math.min(job.progress.totalEntries,job.progress.processedEntries+1),next()}).catch(fail)}),extractor.once("finish",()=>finish(resolve)),source.pipe(extractor)})}async function extract(job,sourcePath,targetPath){return isZipPath(sourcePath)?extractZip(job,sourcePath,targetPath):extractTar(job,sourcePath,targetPath)}module2.exports={capabilities,extract,isArchivePath,listEntries}}});var require_archiveService=__commonJS({"src/lib/archiveService.js"(exports2,module2){var{createWriteStream,existsSync,lstatSync,mkdirSync,promises:fsPromises,realpathSync,renameSync,rmSync}=require("fs"),path=require("path"),crypto=require("crypto"),archiver=require("archiver"),archiveProvider=require_light(),{createArchiveError,isInside,isSafeArchiveEntry}=require_archiveShared(),MAX_ARCHIVE_SIZE=2*1024*1024*1024,MAX_ARCHIVE_ENTRIES=1e4,MAX_COMPRESSION_RATIO=100,ArchiveService=class{constructor({rootPath,resolvePath,getChildPath}){this.rootPath=rootPath,this.resolvePath=resolvePath,this.getChildPath=getChildPath,this.jobs=new Map}resolveExistingFile(inputPath){let fullPath=this.resolvePath(inputPath);if(!existsSync(fullPath))throw createArchiveError("Path not found",404);let stats=lstatSync(fullPath);if(!stats.isFile())throw createArchiveError("Archive path must be a file");if(!archiveProvider.isArchivePath(fullPath))throw createArchiveError("Unsupported archive format");if(stats.size>MAX_ARCHIVE_SIZE)throw createArchiveError("Archive exceeds 2GB limit",413);return fullPath}async listArchive(inputPath){let fullPath=this.resolveExistingFile(inputPath),entries=await archiveProvider.listEntries(fullPath);return this.assertEntriesSafe(entries,fullPath),{path:inputPath,name:path.basename(fullPath),entries,totalEntries:entries.length,totalSize:entries.reduce((total,entry)=>total+entry.size,0),totalPackedSize:entries.reduce((total,entry)=>total+entry.packedSize,0)}}assertEntriesSafe(entries,fullPath){if(!entries.length)throw createArchiveError("Archive contains no entries",422);if(entries.length>MAX_ARCHIVE_ENTRIES)throw createArchiveError("Archive contains too many entries",413);if(entries.some(entry=>entry.encrypted))throw createArchiveError("Encrypted archives are not supported",422);if(entries.some(entry=>entry.isSymbolicLink||!isSafeArchiveEntry(entry.path)))throw createArchiveError("Archive contains an unsafe entry path",422);let totalSize=entries.reduce((total,entry)=>total+entry.size,0),packedSize=Math.max(lstatSync(fullPath).size,1);if(totalSize>MAX_ARCHIVE_SIZE)throw createArchiveError("Archive expands beyond 2GB limit",413);if(totalSize/packedSize>MAX_COMPRESSION_RATIO)throw createArchiveError("Archive compression ratio exceeds limit",413)}startJob(type,payload){let id=crypto.randomUUID(),job={id,type,status:"queued",progress:{processedEntries:0,totalEntries:0},createdAt:new Date().toISOString(),result:null,error:null,cancelled:!1,child:null,archive:null};return this.jobs.set(id,job),setImmediate(async()=>{if(!job.cancelled){job.status="running";try{job.result=type==="create"?await this.createArchive(job,payload):await this.extractArchive(job,payload),job.status=job.cancelled?"cancelled":"completed"}catch(error){job.status=job.cancelled?"cancelled":"failed",job.error=error.message}finally{job.child=null,job.archive=null,job.finishedAt=new Date().toISOString()}}}),job}getJob(id){return this.jobs.get(id)}getCapabilities(){return archiveProvider.capabilities}cancelJob(id){let job=this.getJob(id);if(!job)throw createArchiveError("Archive job not found",404);return["completed","failed","cancelled"].includes(job.status)||(job.cancelled=!0,job.status="cancelled",job.child&&job.child.kill("SIGTERM"),job.archive&&job.archive.abort()),job}async createArchive(job,payload){let format=payload.format==="tar.gz"?"tar.gz":payload.format;if(!archiveProvider.capabilities.createFormats.includes(format)){let formats=archiveProvider.capabilities.createFormats.join(" and ");throw createArchiveError(`Supported creation formats are ${formats}`)}if(!Array.isArray(payload.sources)||payload.sources.length===0)throw createArchiveError("Sources must be a non-empty array");let sourcePaths=payload.sources.map(source=>this.resolvePath(source));sourcePaths.forEach(source=>{if(!existsSync(source))throw createArchiveError("Source path not found",404);if(lstatSync(source).isSymbolicLink())throw createArchiveError("Symbolic links cannot be archived");let realPath=realpathSync(source);if(!isInside(this.rootPath,realPath))throw createArchiveError("Access denied",403)}),await Promise.all(sourcePaths.map(source=>this.assertSourceTreeSafe(source)));let destinationPath=payload.destinationPath||path.posix.dirname(payload.sources[0]),archiveName=String(payload.name||"").trim(),requiredExtension=format==="zip"?".zip":".tar.gz",safeName=archiveName.endsWith(requiredExtension)?archiveName:`${archiveName}${requiredExtension}`,outputPath=this.getChildPath(destinationPath,safeName);if(existsSync(outputPath))throw createArchiveError("Archive path already exists",409);if(job.progress.totalEntries=sourcePaths.length,await new Promise((resolve,reject)=>{let output=createWriteStream(outputPath,{flags:"wx"}),archive=format==="zip"?archiver("zip",{zlib:{level:9}}):archiver("tar",{gzip:!0,gzipOptions:{level:9}});job.archive=archive,output.on("close",resolve),output.on("error",reject),archive.on("error",reject),archive.on("progress",progress=>{job.progress.processedEntries=progress.entries.processed,job.progress.totalEntries=progress.entries.total}),archive.pipe(output),sourcePaths.forEach(source=>{lstatSync(source).isDirectory()?archive.directory(source,path.basename(source)):archive.file(source,{name:path.basename(source)})}),archive.finalize()}).catch(error=>{throw rmSync(outputPath,{force:!0}),error}),job.cancelled)throw rmSync(outputPath,{force:!0}),createArchiveError("Archive job cancelled",499);return{path:outputPath,name:path.basename(outputPath)}}async extractArchive(job,payload){let sourcePath=this.resolveExistingFile(payload.path),destinationPath=this.resolvePath(payload.destinationPath||"/");if(!existsSync(destinationPath)||!lstatSync(destinationPath).isDirectory())throw createArchiveError("Extraction destination must be an existing directory",404);let listing=await this.listArchive(payload.path);job.progress.totalEntries=listing.totalEntries;let tempRoot=await fsPromises.mkdtemp(path.join(destinationPath,".mock-service-cli-archive-")),tempOutput=path.join(tempRoot,"output");mkdirSync(tempOutput);try{if(await archiveProvider.extract(job,sourcePath,tempOutput),job.cancelled)throw createArchiveError("Archive job cancelled",499);await this.assertExtractedTreeSafe(tempOutput);let outputEntries=await fsPromises.readdir(tempOutput);if(!outputEntries.length)throw createArchiveError("Archive produced no files",422);outputEntries.forEach(name=>{if(existsSync(path.join(destinationPath,name)))throw createArchiveError(`Destination already contains ${name}`,409)});for(let name of outputEntries)renameSync(path.join(tempOutput,name),path.join(destinationPath,name));return job.progress.processedEntries=job.progress.totalEntries,{destinationPath,entries:outputEntries}}finally{rmSync(tempRoot,{recursive:!0,force:!0})}}async assertExtractedTreeSafe(root){let rootRealPath=realpathSync(root),walk=async current=>{let entries=await fsPromises.readdir(current,{withFileTypes:!0});for(let entry of entries){let child=path.join(current,entry.name),stats=await fsPromises.lstat(child);if(stats.isSymbolicLink())throw createArchiveError("Archive contains symbolic links",422);let realPath=realpathSync(child);if(!isInside(rootRealPath,realPath))throw createArchiveError("Archive extracted outside its destination",422);stats.isDirectory()&&await walk(child)}};await walk(root)}async assertSourceTreeSafe(source){let stats=await fsPromises.lstat(source);if(stats.isSymbolicLink())throw createArchiveError("Symbolic links cannot be archived");if(!stats.isDirectory())return;let entries=await fsPromises.readdir(source,{withFileTypes:!0});await Promise.all(entries.map(entry=>this.assertSourceTreeSafe(path.join(source,entry.name))))}};module2.exports={ArchiveService,isArchivePath:archiveProvider.isArchivePath}}});var require_fileExplorerServer=__commonJS({"src/lib/fileExplorerServer.js"(){var express=require_express2(),{existsSync,readFileSync,statSync,lstatSync,rmSync,mkdirSync,writeFileSync,renameSync,realpathSync,copyFileSync,unlinkSync,constants:fsConstants,promises:fsPromises}=require("fs"),path=require("path"),os=require("os"),crypto=require("crypto"),multer=require_multer(),{UAParser}=require_ua_parser(),colors=require_safe(),portfinder=require_portfinder(),{exec,execFile}=require("child_process"),{dateFormat,logger,getServerHost,getServerUrls,hostAllowlistMiddleware,normalizeRemoteAddress}=require_utils3(),{getPackageVersion}=require_packageInfo(),{ArchiveService}=require_archiveService(),app=express(),log=logger(process.env.SILENT),argv=JSON.parse(process.env.ARGV),explorerRoot=path.resolve(process.env.EXPLORER_DIRECTORY||process.cwd()),explorerRootRealPath=realpathSync(explorerRoot),port=argv.p||argv.port,isEditMode=process.env.EXPLORER_EDIT==="true",explorerPassword=process.env.EXPLORER_AUTH||"",isAuthEnabled=!!explorerPassword,visitorKeys=new Set,MAX_UPLOAD_FILE_SIZE=2*1024*1024*1024,MAX_UPLOAD_TOTAL_SIZE=2*1024*1024*1024,MAX_UPLOAD_FILE_COUNT=100,MAX_MULTIPART_OVERHEAD_SIZE=2*1024*1024,upload=multer({dest:path.join(os.tmpdir(),"mock-service-cli-upload"),preservePath:!0,limits:{fileSize:MAX_UPLOAD_FILE_SIZE,files:MAX_UPLOAD_FILE_COUNT,fields:10}}),archiveService=new ArchiveService({rootPath:explorerRootRealPath,resolvePath:resolveExplorerPath,getChildPath});function isPathInsideRoot(fullPath,resolvedRoot=explorerRootRealPath){let relativePath=path.relative(resolvedRoot,fullPath);return relativePath===""||!relativePath.startsWith("..")&&!path.isAbsolute(relativePath)}function normalizeExplorerInputPath(inputPath){let decodedPath=decodeURIComponent(String(inputPath||"/")).replace(/\\/g,"/");return!decodedPath||decodedPath==="."?"/":decodedPath.startsWith("/")?decodedPath:`/${decodedPath}`}function resolveExplorerPath(inputPath){let relativePath=normalizeExplorerInputPath(inputPath).replace(/^\/+/,""),fullPath=path.resolve(explorerRoot,relativePath);if(!isPathInsideRoot(fullPath,explorerRoot)){let error=new Error("Access denied");throw error.statusCode=403,error}if(!existsSync(fullPath))return fullPath;let realPath=realpathSync(fullPath);if(!isPathInsideRoot(realPath)){let error=new Error("Access denied");throw error.statusCode=403,error}return realPath}function validateEntryName(name){if(typeof name!="string")return"Name must be a string";let normalizedName=name.trim();if(!normalizedName||normalizedName==="."||normalizedName==="..")return"Invalid name";if(/[/\\\0<>:"|?*]/.test(normalizedName))return"Name contains invalid characters";if(process.platform==="win32"){let upperName=normalizedName.replace(/[. ]+$/g,"").split(".")[0].toUpperCase();if(new Set(["CON","PRN","AUX","NUL","COM1","COM2","COM3","COM4","COM5","COM6","COM7","COM8","COM9","LPT1","LPT2","LPT3","LPT4","LPT5","LPT6","LPT7","LPT8","LPT9"]).has(upperName)||normalizedName.endsWith(" ")||normalizedName.endsWith("."))return"Name is not supported on Windows"}return null}function getChildPath(parentPath,name){let nameError=validateEntryName(name);if(nameError){let error=new Error(nameError);throw error.statusCode=400,error}let parentFullPath=resolveExplorerPath(parentPath||"/");if(!existsSync(parentFullPath)||!statSync(parentFullPath).isDirectory()){let error=new Error("Parent directory not found");throw error.statusCode=404,error}let childPath=path.resolve(parentFullPath,name.trim());if(!isPathInsideRoot(childPath)){let error=new Error("Access denied");throw error.statusCode=403,error}return childPath}function requireEditMode(req,res,next){if(!isEditMode)return res.status(403).json({error:"File explorer is read-only. Restart with --edit to modify files."});next()}function isValidExplorerPassword(value){if(!isAuthEnabled)return!0;let provided=Buffer.from(String(value||"")),expected=Buffer.from(explorerPassword);return provided.length===expected.length&&crypto.timingSafeEqual(provided,expected)}function getExplorerPassword(req){return req.get("x-file-explorer-password")||req.body&&req.body.password}function requireExplorerAuth(req,res,next){if(!isValidExplorerPassword(getExplorerPassword(req)))return res.status(401).json({error:"Authentication required"});next()}function logExplorerVisit(req){let userAgent=req.get("user-agent")||"",ip=normalizeRemoteAddress(req.socket&&req.socket.remoteAddress),visitorKey=`${ip}
|
|
141
|
-
${userAgent}`;if(visitorKeys.has(visitorKey))return;visitorKeys.add(visitorKey);let parsed=new UAParser(userAgent).getResult(),browser=[parsed.browser.name,parsed.browser.version].filter(Boolean).join(" ")||"Unknown",operatingSystem=[parsed.os.name,parsed.os.version].filter(Boolean).join(" ")||"Unknown";log.info(`File explorer visitor: ip=${ip}, os=${operatingSystem}, browser=${browser}, userAgent=${userAgent}`)}function getUploadTargetPath(parentPath,originalName){let normalizedName=String(originalName||"").replace(/\\/g,"/").replace(/^\/+/,""),parts=normalizedName.split("/").filter(Boolean);if(parts.length===0||normalizedName!==parts.join("/")){let error=new Error("Invalid upload path");throw error.statusCode=400,error}parts.forEach(part=>{let nameError=validateEntryName(part);if(nameError){let error=new Error(nameError);throw error.statusCode=400,error}});let parentFullPath=resolveExplorerPath(parentPath||"/");if(!existsSync(parentFullPath)||!statSync(parentFullPath).isDirectory()){let error=new Error("Parent directory not found");throw error.statusCode=404,error}let targetPath=path.resolve(parentFullPath,...parts);if(!isPathInsideRoot(targetPath)){let error=new Error("Access denied");throw error.statusCode=403,error}return{targetPath,parentFullPath,parts}}function ensureUploadParent(parentFullPath,parts){let current=parentFullPath;parts.slice(0,-1).forEach(part=>{if(current=path.join(current,part),existsSync(current)){let stats=lstatSync(current);if(!stats.isDirectory()||stats.isSymbolicLink()||!isPathInsideRoot(realpathSync(current))){let error=new Error("Upload path is not a safe directory");throw error.statusCode=403,error}}else mkdirSync(current)})}function moveUploadedFile(sourcePath,targetPath){copyFileSync(sourcePath,targetPath,fsConstants.COPYFILE_EXCL),unlinkSync(sourcePath)}function cleanupUploadedTempFiles(files=[]){files.forEach(file=>{file&&file.path&&existsSync(file.path)&&rmSync(file.path,{force:!0})})}function enforceUploadRequestSize(req,res,next){let contentLength=Number(req.get("content-length"));if(Number.isFinite(contentLength)&&contentLength>MAX_UPLOAD_TOTAL_SIZE+MAX_MULTIPART_OVERHEAD_SIZE)return res.status(413).json({error:"Total upload size exceeds 2GB limit"});next()}function deleteExplorerPath(targetPath){let fullPath=resolveExplorerPath(targetPath);if(path.resolve(fullPath)===explorerRootRealPath){let error=new Error("Cannot delete explorer root");throw error.statusCode=400,error}if(!existsSync(fullPath)){let error=new Error("Path not found");throw error.statusCode=404,error}rmSync(fullPath,{recursive:!0,force:!1})}process.env.PORT?init():(portfinder.basePort=port||8090,portfinder.getPort(function(err,foundPort){if(err)throw err;process.env.PORT=foundPort,init()}));function init(){app.use(hostAllowlistMiddleware()),app.use(express.json()),app.get("/favicon-file-explorer.svg",(req,res)=>res.sendFile(path.resolve(__dirname,"./favicon-file-explorer.svg"))),app.get("/favicon-file-explorer-login.svg",(req,res)=>res.sendFile(path.resolve(__dirname,"./favicon-file-explorer-login.svg"))),app.get("/",(req,res)=>{let htmlPath=path.resolve(__dirname,"./file-explorer.html");existsSync(htmlPath)?res.sendFile(htmlPath):res.status(404).send("File explorer page not found")}),app.get("/__login",(req,res)=>{let htmlPath=path.resolve(__dirname,"./file-explorer-login.html");existsSync(htmlPath)?res.sendFile(htmlPath):res.status(404).send("File explorer login page not found")}),app.post("/__api/auth/verify",(req,res)=>{if(!isValidExplorerPassword(getExplorerPassword(req)))return res.status(401).json({error:"Invalid password"});res.json({success:!0,authEnabled:isAuthEnabled})}),app.use("/__api",requireExplorerAuth),app.get("/__api/config",(req,res)=>{logExplorerVisit(req),res.json({editMode:isEditMode,authEnabled:isAuthEnabled})}),app.get("/__api/archive/capabilities",requireEditMode,(req,res)=>{res.json(archiveService.getCapabilities())}),app.get("/__api/health",(req,res)=>{res.json({success:!0})}),app.get("/__api/list",async(req,res)=>{let dirPath=normalizeExplorerInputPath(req.query.path||"/"),fullPath;try{fullPath=resolveExplorerPath(dirPath)}catch(error){return res.status(error.statusCode||500).json({error:error.message})}if(!existsSync(fullPath))return res.status(404).json({error:"Path not found"});try{if(!(await fsPromises.lstat(fullPath)).isDirectory())return res.status(400).json({error:"Not a directory"});let files=await fsPromises.readdir(fullPath,{withFileTypes:!0}),result=await Promise.all(files.map(async file=>{let filePath=path.join(fullPath,file.name),fileStats,hasError=!1;try{fileStats=await fsPromises.lstat(filePath)}catch{hasError=!0}let relativePath=path.posix.join(dirPath,file.name),isDirectory=hasError?file.isDirectory():fileStats.isDirectory();return{name:file.name,path:relativePath.replace(/\\/g,"/"),isDirectory,size:hasError?0:fileStats.size,mtime:hasError?new Date:fileStats.mtime,birthtime:hasError?new Date:fileStats.birthtime,isHidden:file.name.startsWith("."),error:hasError?"Cannot access file":null}}));result.sort((a,b)=>a.isDirectory!==b.isDirectory?a.isDirectory?-1:1:a.name.localeCompare(b.name)),res.json({currentPath:dirPath,parentPath:dirPath==="/"?null:path.posix.dirname(dirPath),files:result})}catch(error){res.status(500).json({error:error.message})}}),app.get("/__api/file",(req,res)=>{let filePath=normalizeExplorerInputPath(req.query.path||"/"),fullPath;try{fullPath=resolveExplorerPath(filePath)}catch(error){return res.status(error.statusCode||500).json({error:error.message})}if(!existsSync(fullPath))return res.status(404).json({error:"File not found"});let stats=statSync(fullPath);if(stats.isDirectory())return res.status(400).json({error:"Is a directory"});if(req.query.download==="1")return res.download(fullPath,path.basename(filePath));let ext=path.extname(filePath).toLowerCase(),imageExts=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico"],textExts=[".txt",".json",".js",".css",".html",".xml",".md",".csv",".yaml",".yml",".log"];if(imageExts.includes(ext))res.sendFile(fullPath);else if(textExts.includes(ext)||stats.size<1024*1024)try{let content=readFileSync(fullPath,"utf-8");res.json({name:path.basename(filePath),type:"text",content,size:stats.size})}catch{res.download(fullPath)}else res.download(fullPath)}),app.post("/__api/open-in-explorer",(req,res)=>{let filePath=normalizeExplorerInputPath(req.body.path||"/"),fullPath;try{fullPath=resolveExplorerPath(filePath)}catch(error){return res.status(error.statusCode||500).json({error:error.message})}if(!existsSync(fullPath))return res.status(404).json({error:"Path not found"});let command,args;switch(process.platform){case"darwin":command="open",args=[fullPath];break;case"win32":command="explorer.exe",args=[fullPath];break;case"linux":command="xdg-open",args=[fullPath];break;default:return res.status(400).json({error:"Unsupported platform"})}execFile(command,args,error=>{if(error)return console.error(colors.red(`Failed to open in explorer: ${error.message}`)),res.status(500).json({error:"Failed to open in explorer"});res.json({success:!0,path:fullPath})})}),app.post("/__api/path",requireEditMode,(req,res)=>{let parentPath=req.body&&req.body.parentPath||"/",name=req.body&&req.body.name,type=req.body&&req.body.type||"file";if(type!=="file"&&type!=="directory")return res.status(400).json({error:"Invalid type"});let fullPath;try{fullPath=getChildPath(parentPath,name)}catch(error){return res.status(error.statusCode||500).json({error:error.message})}if(existsSync(fullPath))return res.status(409).json({error:"Path already exists"});try{type==="directory"?mkdirSync(fullPath):writeFileSync(fullPath,""),res.json({success:!0,path:fullPath})}catch(error){console.error(colors.red(`Failed to create path: ${error.message}`)),res.status(500).json({error:"Failed to create path"})}}),app.patch("/__api/path",requireEditMode,(req,res)=>{let sourcePath=req.body&&req.body.path,name=req.body&&req.body.name,fullPath,nextPath;try{if(fullPath=resolveExplorerPath(sourcePath),path.resolve(fullPath)===explorerRootRealPath)return res.status(400).json({error:"Cannot rename explorer root"});if(!existsSync(fullPath))return res.status(404).json({error:"Path not found"});nextPath=getChildPath(path.posix.dirname(normalizeExplorerInputPath(sourcePath||"/")),name)}catch(error){return res.status(error.statusCode||500).json({error:error.message})}if(existsSync(nextPath))return res.status(409).json({error:"Path already exists"});try{renameSync(fullPath,nextPath),res.json({success:!0,path:sourcePath,nextPath})}catch(error){console.error(colors.red(`Failed to rename path: ${error.message}`)),res.status(500).json({error:"Failed to rename path"})}}),app.delete("/__api/path",requireEditMode,(req,res)=>{let targetPath=req.body&&req.body.path||"/";try{deleteExplorerPath(targetPath),res.json({success:!0,path:targetPath})}catch(error){console.error(colors.red(`Failed to delete path: ${error.message}`)),res.status(error.statusCode||500).json({error:error.statusCode?error.message:"Failed to delete path"})}}),app.delete("/__api/paths",requireEditMode,(req,res)=>{let paths=req.body&&req.body.paths||[];if(!Array.isArray(paths)||paths.length===0)return res.status(400).json({error:"Paths must be a non-empty array"});let deleted=[];try{paths.forEach(targetPath=>{deleteExplorerPath(targetPath),deleted.push(targetPath)}),res.json({success:!0,deleted})}catch(error){console.error(colors.red(`Failed to delete paths: ${error.message}`)),res.status(error.statusCode||500).json({error:error.statusCode?error.message:"Failed to delete paths",deleted})}}),app.post("/__api/upload",requireEditMode,enforceUploadRequestSize,upload.any(),(req,res)=>{let parentPath=req.body&&req.body.parentPath||"/",files=req.files||[];if(!files.length)return res.status(400).json({error:"No files uploaded"});if(files.reduce((sum,file)=>sum+file.size,0)>MAX_UPLOAD_TOTAL_SIZE)return cleanupUploadedTempFiles(files),res.status(413).json({error:"Total upload size exceeds 2GB limit"});let uploaded=[],failed=[];files.forEach(file=>{try{let{targetPath,parentFullPath,parts}=getUploadTargetPath(parentPath,file.originalname);if(existsSync(targetPath)){failed.push({name:file.originalname,error:"Path already exists",statusCode:409});return}if(ensureUploadParent(parentFullPath,parts),existsSync(targetPath)){failed.push({name:file.originalname,error:"Path already exists",statusCode:409});return}moveUploadedFile(file.path,targetPath),uploaded.push({name:file.originalname,path:path.posix.join(normalizeExplorerInputPath(parentPath),...parts)})}catch(error){failed.push({name:file.originalname,error:error.message,statusCode:error.statusCode||500})}finally{existsSync(file.path)&&rmSync(file.path,{force:!0})}}),res.status(failed.length?207:200).json({success:failed.length===0,uploaded,failed})}),app.get("/__api/archive/preview",requireEditMode,async(req,res)=>{try{let preview=await archiveService.listArchive(normalizeExplorerInputPath(req.query.path||"/"));res.json(preview)}catch(error){res.status(error.statusCode||500).json({error:error.message})}}),app.post("/__api/archive/jobs",requireEditMode,(req,res)=>{let payload=req.body||{},operation=payload.operation;if(operation!=="create"&&operation!=="extract")return res.status(400).json({error:"Archive operation must be create or extract"});try{let job=archiveService.startJob(operation,payload);res.status(202).json({id:job.id,status:job.status,type:job.type})}catch(error){res.status(error.statusCode||500).json({error:error.message})}}),app.get("/__api/archive/jobs/:id",requireEditMode,(req,res)=>{let job=archiveService.getJob(req.params.id);if(!job)return res.status(404).json({error:"Archive job not found"});res.json({id:job.id,type:job.type,status:job.status,progress:job.progress,result:job.result,error:job.error,createdAt:job.createdAt,finishedAt:job.finishedAt||null})}),app.delete("/__api/archive/jobs/:id",requireEditMode,(req,res)=>{try{let job=archiveService.cancelJob(req.params.id);res.json({id:job.id,status:job.status})}catch(error){res.status(error.statusCode||500).json({error:error.message})}}),app.use((error,req,res,next)=>{if(error instanceof multer.MulterError){cleanupUploadedTempFiles(req.files);let statusCode=error.code==="LIMIT_FILE_SIZE"||error.code==="LIMIT_FILE_COUNT"?413:400;return res.status(statusCode).json({error:error.message})}if(error)return console.error(colors.red(`File explorer request failed: ${error.message}`)),res.status(error.statusCode||500).json({error:error.message||"Request failed"});next()}),startServer()}function startServer(){let http=require("http").createServer(app);http.requestTimeout=0,http.listen(Number.parseInt(process.env.PORT,10),getServerHost(),()=>{if(console.info([colors.yellow(`
|
|
140
|
+
--${boundary}`,ssCb),this._writecb=null,this._finalcb=null,this.write(BUF_CRLF)}static detect(conType){return conType.type==="multipart"&&conType.subtype==="form-data"}_write(chunk,enc,cb){this._writecb=cb,this._bparser.push(chunk,0),this._writecb&&callAndUnsetCb(this)}_destroy(err,cb){this._hparser=null,this._bparser=ignoreData,err||(err=checkEndState(this));let fileStream=this._fileStream;fileStream&&(this._fileStream=null,fileStream.destroy(err)),cb(err)}_final(cb){if(this._bparser.destroy(),!this._complete)return cb(new Error("Unexpected end of form"));this._fileEndsLeft?this._finalcb=finalcb.bind(null,this,cb):finalcb(this,cb)}};function finalcb(self2,cb,err){if(err)return cb(err);err=checkEndState(self2),cb(err)}function checkEndState(self2){if(self2._hparser)return new Error("Malformed part header");let fileStream=self2._fileStream;if(fileStream&&(self2._fileStream=null,fileStream.destroy(new Error("Unexpected end of file"))),!self2._complete)return new Error("Unexpected end of form")}var TOKEN=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],FIELD_VCHAR=[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];module2.exports=Multipart}});var require_urlencoded2=__commonJS({"node_modules/busboy/lib/types/urlencoded.js"(exports2,module2){"use strict";var{Writable}=require("stream"),{getDecoder}=require_utils6(),URLEncoded=class extends Writable{constructor(cfg){let streamOpts={autoDestroy:!0,emitClose:!0,highWaterMark:typeof cfg.highWaterMark=="number"?cfg.highWaterMark:void 0};super(streamOpts);let charset=cfg.defCharset||"utf8";cfg.conType.params&&typeof cfg.conType.params.charset=="string"&&(charset=cfg.conType.params.charset),this.charset=charset;let limits=cfg.limits;this.fieldSizeLimit=limits&&typeof limits.fieldSize=="number"?limits.fieldSize:1*1024*1024,this.fieldsLimit=limits&&typeof limits.fields=="number"?limits.fields:1/0,this.fieldNameSizeLimit=limits&&typeof limits.fieldNameSize=="number"?limits.fieldNameSize:100,this._inKey=!0,this._keyTrunc=!1,this._valTrunc=!1,this._bytesKey=0,this._bytesVal=0,this._fields=0,this._key="",this._val="",this._byte=-2,this._lastPos=0,this._encode=0,this._decoder=getDecoder(charset)}static detect(conType){return conType.type==="application"&&conType.subtype==="x-www-form-urlencoded"}_write(chunk,enc,cb){if(this._fields>=this.fieldsLimit)return cb();let i=0,len=chunk.length;if(this._lastPos=0,this._byte!==-2){if(i=readPctEnc(this,chunk,i,len),i===-1)return cb(new Error("Malformed urlencoded form"));if(i>=len)return cb();this._inKey?++this._bytesKey:++this._bytesVal}main:for(;i<len;)if(this._inKey){for(i=skipKeyBytes(this,chunk,i,len);i<len;){switch(chunk[i]){case 61:this._lastPos<i&&(this._key+=chunk.latin1Slice(this._lastPos,i)),this._lastPos=++i,this._key=this._decoder(this._key,this._encode),this._encode=0,this._inKey=!1;continue main;case 38:if(this._lastPos<i&&(this._key+=chunk.latin1Slice(this._lastPos,i)),this._lastPos=++i,this._key=this._decoder(this._key,this._encode),this._encode=0,this._bytesKey>0&&this.emit("field",this._key,"",{nameTruncated:this._keyTrunc,valueTruncated:!1,encoding:this.charset,mimeType:"text/plain"}),this._key="",this._val="",this._keyTrunc=!1,this._valTrunc=!1,this._bytesKey=0,this._bytesVal=0,++this._fields>=this.fieldsLimit)return this.emit("fieldsLimit"),cb();continue;case 43:this._lastPos<i&&(this._key+=chunk.latin1Slice(this._lastPos,i)),this._key+=" ",this._lastPos=i+1;break;case 37:if(this._encode===0&&(this._encode=1),this._lastPos<i&&(this._key+=chunk.latin1Slice(this._lastPos,i)),this._lastPos=i+1,this._byte=-1,i=readPctEnc(this,chunk,i+1,len),i===-1)return cb(new Error("Malformed urlencoded form"));if(i>=len)return cb();++this._bytesKey,i=skipKeyBytes(this,chunk,i,len);continue}++i,++this._bytesKey,i=skipKeyBytes(this,chunk,i,len)}this._lastPos<i&&(this._key+=chunk.latin1Slice(this._lastPos,i))}else{for(i=skipValBytes(this,chunk,i,len);i<len;){switch(chunk[i]){case 38:if(this._lastPos<i&&(this._val+=chunk.latin1Slice(this._lastPos,i)),this._lastPos=++i,this._inKey=!0,this._val=this._decoder(this._val,this._encode),this._encode=0,(this._bytesKey>0||this._bytesVal>0)&&this.emit("field",this._key,this._val,{nameTruncated:this._keyTrunc,valueTruncated:this._valTrunc,encoding:this.charset,mimeType:"text/plain"}),this._key="",this._val="",this._keyTrunc=!1,this._valTrunc=!1,this._bytesKey=0,this._bytesVal=0,++this._fields>=this.fieldsLimit)return this.emit("fieldsLimit"),cb();continue main;case 43:this._lastPos<i&&(this._val+=chunk.latin1Slice(this._lastPos,i)),this._val+=" ",this._lastPos=i+1;break;case 37:if(this._encode===0&&(this._encode=1),this._lastPos<i&&(this._val+=chunk.latin1Slice(this._lastPos,i)),this._lastPos=i+1,this._byte=-1,i=readPctEnc(this,chunk,i+1,len),i===-1)return cb(new Error("Malformed urlencoded form"));if(i>=len)return cb();++this._bytesVal,i=skipValBytes(this,chunk,i,len);continue}++i,++this._bytesVal,i=skipValBytes(this,chunk,i,len)}this._lastPos<i&&(this._val+=chunk.latin1Slice(this._lastPos,i))}cb()}_final(cb){if(this._byte!==-2)return cb(new Error("Malformed urlencoded form"));(!this._inKey||this._bytesKey>0||this._bytesVal>0)&&(this._inKey?this._key=this._decoder(this._key,this._encode):this._val=this._decoder(this._val,this._encode),this.emit("field",this._key,this._val,{nameTruncated:this._keyTrunc,valueTruncated:this._valTrunc,encoding:this.charset,mimeType:"text/plain"})),cb()}};function readPctEnc(self2,chunk,pos,len){if(pos>=len)return len;if(self2._byte===-1){let hexUpper=HEX_VALUES[chunk[pos++]];if(hexUpper===-1)return-1;if(hexUpper>=8&&(self2._encode=2),pos<len){let hexLower=HEX_VALUES[chunk[pos++]];if(hexLower===-1)return-1;self2._inKey?self2._key+=String.fromCharCode((hexUpper<<4)+hexLower):self2._val+=String.fromCharCode((hexUpper<<4)+hexLower),self2._byte=-2,self2._lastPos=pos}else self2._byte=hexUpper}else{let hexLower=HEX_VALUES[chunk[pos++]];if(hexLower===-1)return-1;self2._inKey?self2._key+=String.fromCharCode((self2._byte<<4)+hexLower):self2._val+=String.fromCharCode((self2._byte<<4)+hexLower),self2._byte=-2,self2._lastPos=pos}return pos}function skipKeyBytes(self2,chunk,pos,len){if(self2._bytesKey>self2.fieldNameSizeLimit){for(self2._keyTrunc||self2._lastPos<pos&&(self2._key+=chunk.latin1Slice(self2._lastPos,pos-1)),self2._keyTrunc=!0;pos<len;++pos){let code=chunk[pos];if(code===61||code===38)break;++self2._bytesKey}self2._lastPos=pos}return pos}function skipValBytes(self2,chunk,pos,len){if(self2._bytesVal>self2.fieldSizeLimit){for(self2._valTrunc||self2._lastPos<pos&&(self2._val+=chunk.latin1Slice(self2._lastPos,pos-1)),self2._valTrunc=!0;pos<len&&chunk[pos]!==38;++pos)++self2._bytesVal;self2._lastPos=pos}return pos}var HEX_VALUES=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1];module2.exports=URLEncoded}});var require_lib5=__commonJS({"node_modules/busboy/lib/index.js"(exports2,module2){"use strict";var{parseContentType}=require_utils6();function getInstance(cfg){let headers=cfg.headers,conType=parseContentType(headers["content-type"]);if(!conType)throw new Error("Malformed content type");for(let type of TYPES){if(!type.detect(conType))continue;let instanceCfg={limits:cfg.limits,headers,conType,highWaterMark:void 0,fileHwm:void 0,defCharset:void 0,defParamCharset:void 0,preservePath:!1};return cfg.highWaterMark&&(instanceCfg.highWaterMark=cfg.highWaterMark),cfg.fileHwm&&(instanceCfg.fileHwm=cfg.fileHwm),instanceCfg.defCharset=cfg.defCharset,instanceCfg.defParamCharset=cfg.defParamCharset,instanceCfg.preservePath=cfg.preservePath,new type(instanceCfg)}throw new Error(`Unsupported content type: ${headers["content-type"]}`)}var TYPES=[require_multipart(),require_urlencoded2()].filter(function(typemod){return typeof typemod.detect=="function"});module2.exports=cfg=>{if((typeof cfg!="object"||cfg===null)&&(cfg={}),typeof cfg.headers!="object"||cfg.headers===null||typeof cfg.headers["content-type"]!="string")throw new Error("Missing Content-Type");return getInstance(cfg)}}});var require_parse_path=__commonJS({"node_modules/append-field/lib/parse-path.js"(exports2,module2){var reFirstKey=/^[^\[]*/,reDigitPath=/^\[(\d+)\]/,reNormalPath=/^\[([^\]]+)\]/;function parsePath(key){function failure(){return[{type:"object",key,last:!0}]}var firstKey=reFirstKey.exec(key)[0];if(!firstKey)return failure();for(var len=key.length,pos=firstKey.length,tail={type:"object",key:firstKey},steps=[tail];pos<len;){var m;if(key[pos]==="["&&key[pos+1]==="]"){if(pos+=2,tail.append=!0,pos!==len)return failure();continue}if(m=reDigitPath.exec(key.substring(pos)),m!==null){pos+=m[0].length,tail.nextType="array",tail={type:"array",key:parseInt(m[1],10)},steps.push(tail);continue}if(m=reNormalPath.exec(key.substring(pos)),m!==null){pos+=m[0].length,tail.nextType="object",tail={type:"object",key:m[1]},steps.push(tail);continue}return failure()}return tail.last=!0,steps}module2.exports=parsePath}});var require_set_value=__commonJS({"node_modules/append-field/lib/set-value.js"(exports2,module2){function valueType(value){return value===void 0?"undefined":Array.isArray(value)?"array":typeof value=="object"?"object":"scalar"}function setLastValue(context,step,currentValue,entryValue){switch(valueType(currentValue)){case"undefined":step.append?context[step.key]=[entryValue]:context[step.key]=entryValue;break;case"array":context[step.key].push(entryValue);break;case"object":return setLastValue(currentValue,{type:"object",key:"",last:!0},currentValue[""],entryValue);case"scalar":context[step.key]=[context[step.key],entryValue];break}return context}function setValue(context,step,currentValue,entryValue){if(step.last)return setLastValue(context,step,currentValue,entryValue);var obj;switch(valueType(currentValue)){case"undefined":return step.nextType==="array"?context[step.key]=[]:context[step.key]=Object.create(null),context[step.key];case"object":return context[step.key];case"array":return step.nextType==="array"?currentValue:(obj=Object.create(null),context[step.key]=obj,currentValue.forEach(function(item,i){item!==void 0&&(obj[""+i]=item)}),obj);case"scalar":return obj=Object.create(null),obj[""]=currentValue,context[step.key]=obj,obj}}module2.exports=setValue}});var require_append_field=__commonJS({"node_modules/append-field/index.js"(exports2,module2){var parsePath=require_parse_path(),setValue=require_set_value();function appendField(store,key,value){var steps=parsePath(key);steps.reduce(function(context,step){return setValue(context,step,context[step.key],value)},store)}module2.exports=appendField}});var require_counter=__commonJS({"node_modules/multer/lib/counter.js"(exports2,module2){var EventEmitter=require("events").EventEmitter;function Counter(){EventEmitter.call(this),this.value=0}Counter.prototype=Object.create(EventEmitter.prototype);Counter.prototype.increment=function(){this.value++};Counter.prototype.decrement=function(){--this.value===0&&this.emit("zero")};Counter.prototype.isZero=function(){return this.value===0};Counter.prototype.onceZero=function(fn){if(this.isZero())return fn();this.once("zero",fn)};module2.exports=Counter}});var require_multer_error=__commonJS({"node_modules/multer/lib/multer-error.js"(exports2,module2){var util=require("util"),errorMessages={LIMIT_PART_COUNT:"Too many parts",LIMIT_FILE_SIZE:"File too large",LIMIT_FILE_COUNT:"Too many files",LIMIT_FIELD_KEY:"Field name too long",LIMIT_FIELD_VALUE:"Field value too long",LIMIT_FIELD_COUNT:"Too many fields",LIMIT_UNEXPECTED_FILE:"Unexpected field",MISSING_FIELD_NAME:"Field name missing",LIMIT_FIELD_NESTING:"Field name nesting too deep"};function MulterError(code,field){Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message=errorMessages[code],this.code=code,field&&(this.field=field)}util.inherits(MulterError,Error);module2.exports=MulterError}});var require_file_appender=__commonJS({"node_modules/multer/lib/file-appender.js"(exports2,module2){function arrayRemove(arr,item){var idx=arr.indexOf(item);~idx&&arr.splice(idx,1)}function FileAppender(strategy,req){switch(this.strategy=strategy,this.req=req,strategy){case"NONE":break;case"VALUE":break;case"ARRAY":req.files=[];break;case"OBJECT":req.files=Object.create(null);break;default:throw new Error("Unknown file strategy: "+strategy)}}FileAppender.prototype.insertPlaceholder=function(file){var placeholder={fieldname:file.fieldname};switch(this.strategy){case"NONE":break;case"VALUE":break;case"ARRAY":this.req.files.push(placeholder);break;case"OBJECT":this.req.files[file.fieldname]?this.req.files[file.fieldname].push(placeholder):this.req.files[file.fieldname]=[placeholder];break}return placeholder};FileAppender.prototype.removePlaceholder=function(placeholder){switch(this.strategy){case"NONE":break;case"VALUE":break;case"ARRAY":arrayRemove(this.req.files,placeholder);break;case"OBJECT":this.req.files[placeholder.fieldname].length===1?delete this.req.files[placeholder.fieldname]:arrayRemove(this.req.files[placeholder.fieldname],placeholder);break}};FileAppender.prototype.replacePlaceholder=function(placeholder,file){if(this.strategy==="VALUE"){this.req.file=file;return}delete placeholder.fieldname,Object.assign(placeholder,file)};module2.exports=FileAppender}});var require_remove_uploaded_files=__commonJS({"node_modules/multer/lib/remove-uploaded-files.js"(exports2,module2){function removeUploadedFiles(uploadedFiles,remove,cb){var length=uploadedFiles.length,errors=[];if(length===0)return cb(null,errors);function handleFile(idx){var file=uploadedFiles[idx];remove(file,function(err){err&&(err.file=file,err.field=file.fieldname,errors.push(err)),idx<length-1?setImmediate(function(){handleFile(idx+1)}):cb(null,errors)})}handleFile(0)}module2.exports=removeUploadedFiles}});var require_make_middleware=__commonJS({"node_modules/multer/lib/make-middleware.js"(exports2,module2){var is=require_type_is(),Busboy=require_lib5(),appendField=require_append_field(),Counter=require_counter(),MulterError=require_multer_error(),FileAppender=require_file_appender(),removeUploadedFiles=require_remove_uploaded_files();function drainStream(stream){stream.on("readable",()=>{for(;stream.read()!==null;);})}function makeMiddleware(setup){return function(req,res,next){if(!is(req,["multipart"]))return next();var options=setup(),limits=options.limits,storage=options.storage,fileFilter=options.fileFilter,fileStrategy=options.fileStrategy,preservePath=options.preservePath,defParamCharset=options.defParamCharset;req.body=Object.create(null);var busboy,appender=null,isDone=!1,readFinished=!1,errorOccured=!1,pendingWrites=new Counter,uploadedFiles=[],pendingFiles=[];function done(err){var called=!1;function onFinished(){called||(called=!0,next(err))}if(!isDone){if(isDone=!0,busboy&&(req.unpipe(busboy),setImmediate(()=>{busboy.removeAllListeners()})),drainStream(req),req.resume(),err&&req.readable&&!req.destroyed){req.once("end",onFinished),req.once("error",onFinished),req.once("close",onFinished);return}next(err)}}function indicateDone(){readFinished&&pendingWrites.isZero()&&!errorOccured&&done()}function abortWithError(uploadError,skipPendingWait){if(errorOccured)return;errorOccured=!0;function finishAbort(){function remove(file,cb){storage._removeFile(req,file,cb)}var filesToRemove=uploadedFiles.concat(pendingFiles.filter(function(f){return f.path}));pendingFiles=[],removeUploadedFiles(filesToRemove,remove,function(err,storageErrors){if(err)return done(err);uploadError.storageErrors=storageErrors,done(uploadError)})}skipPendingWait?finishAbort():pendingWrites.onceZero(finishAbort)}function abortWithCode(code,optionalField){abortWithError(new MulterError(code,optionalField))}function handleRequestFailure(err){isDone||(busboy&&(req.unpipe(busboy),busboy.destroy(err)),abortWithError(err,!0))}req.on("error",function(err){handleRequestFailure(err||new Error("Request error"))}),req.on("aborted",function(){handleRequestFailure(new Error("Request aborted"))}),req.on("close",function(){req.readableEnded||handleRequestFailure(new Error("Request closed"))});try{busboy=Busboy({headers:req.headers,limits,preservePath,defParamCharset})}catch(err){return next(err)}appender=new FileAppender(fileStrategy,req),busboy.on("field",function(fieldname,value,{nameTruncated,valueTruncated}){if(fieldname==null)return abortWithCode("MISSING_FIELD_NAME");if(nameTruncated)return abortWithCode("LIMIT_FIELD_KEY");if(valueTruncated)return abortWithCode("LIMIT_FIELD_VALUE",fieldname);if(limits&&Object.prototype.hasOwnProperty.call(limits,"fieldNameSize")&&fieldname.length>limits.fieldNameSize)return abortWithCode("LIMIT_FIELD_KEY");if(limits&&Object.prototype.hasOwnProperty.call(limits,"fieldNestingDepth")&&fieldname.split("[").length-1>limits.fieldNestingDepth)return abortWithCode("LIMIT_FIELD_NESTING",fieldname);appendField(req.body,fieldname,value)}),busboy.on("file",function(fieldname,fileStream,{filename,encoding,mimeType}){var pendingWritesIncremented=!1;if(fileStream.on("error",function(err){pendingWritesIncremented&&pendingWrites.decrement(),abortWithError(err)}),fieldname==null)return abortWithCode("MISSING_FIELD_NAME");if(!filename)return fileStream.resume();if(limits&&Object.prototype.hasOwnProperty.call(limits,"fieldNameSize")&&fieldname.length>limits.fieldNameSize)return abortWithCode("LIMIT_FIELD_KEY");var file={fieldname,originalname:filename,encoding,mimetype:mimeType},placeholder=appender.insertPlaceholder(file);fileFilter(req,file,function(err,includeFile){if(errorOccured)return appender.removePlaceholder(placeholder),fileStream.resume();if(err)return appender.removePlaceholder(placeholder),abortWithError(err);if(!includeFile)return appender.removePlaceholder(placeholder),fileStream.resume();var aborting=!1;pendingWritesIncremented=!0,pendingWrites.increment(),Object.defineProperty(file,"stream",{configurable:!0,enumerable:!1,value:fileStream}),fileStream.on("limit",function(){aborting=!0,abortWithCode("LIMIT_FILE_SIZE",fieldname)}),pendingFiles.push(file),storage._handleFile(req,file,function(err2,info){var idx=pendingFiles.indexOf(file);if(idx!==-1&&pendingFiles.splice(idx,1),aborting)return appender.removePlaceholder(placeholder),uploadedFiles.push({...file,...info}),pendingWrites.decrement();if(err2)return appender.removePlaceholder(placeholder),pendingWrites.decrement(),abortWithError(err2);var fileInfo={...file,...info};appender.replacePlaceholder(placeholder,fileInfo),uploadedFiles.push(fileInfo),pendingWrites.decrement(),indicateDone()})})}),busboy.on("error",function(err){abortWithError(err)}),busboy.on("partsLimit",function(){abortWithCode("LIMIT_PART_COUNT")}),busboy.on("filesLimit",function(){abortWithCode("LIMIT_FILE_COUNT")}),busboy.on("fieldsLimit",function(){abortWithCode("LIMIT_FIELD_COUNT")}),busboy.on("close",function(){readFinished=!0,indicateDone()}),req.pipe(busboy)}}module2.exports=makeMiddleware}});var require_disk=__commonJS({"node_modules/multer/storage/disk.js"(exports2,module2){var fs=require("fs"),os=require("os"),path=require("path"),crypto=require("crypto");function getFilename(req,file,cb){crypto.randomBytes(16,function(err,raw){cb(err,err?void 0:raw.toString("hex"))})}function getDestination(req,file,cb){cb(null,os.tmpdir())}function DiskStorage(opts){this.getFilename=opts.filename||getFilename,typeof opts.destination=="string"?(fs.mkdirSync(opts.destination,{recursive:!0}),this.getDestination=function($0,$1,cb){cb(null,opts.destination)}):this.getDestination=opts.destination||getDestination}DiskStorage.prototype._handleFile=function(req,file,cb){var that=this;that.getDestination(req,file,function(err,destination){if(err)return cb(err);that.getFilename(req,file,function(err2,filename){if(err2)return cb(err2);var finalPath=path.join(destination,filename);if(!file.stream.destroyed){var outStream=fs.createWriteStream(finalPath);file.path=finalPath,file.stream.pipe(outStream),outStream.on("error",cb),outStream.on("finish",function(){cb(null,{destination,filename,path:finalPath,size:outStream.bytesWritten})})}})})};DiskStorage.prototype._removeFile=function(req,file,cb){var path2=file.path;delete file.destination,delete file.filename,delete file.path,fs.unlink(path2,cb)};module2.exports=function(opts){return new DiskStorage(opts)}}});var require_stream3=__commonJS({"node_modules/readable-stream/lib/internal/streams/stream.js"(exports2,module2){module2.exports=require("stream")}});var require_buffer_list=__commonJS({"node_modules/readable-stream/lib/internal/streams/buffer_list.js"(exports2,module2){"use strict";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor)}}function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Object.defineProperty(Constructor,"prototype",{writable:!1}),Constructor}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return typeof key=="symbol"?key:String(key)}function _toPrimitive(input,hint){if(typeof input!="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if(typeof res!="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return(hint==="string"?String:Number)(input)}var _require=require("buffer"),Buffer2=_require.Buffer,_require2=require("util"),inspect=_require2.inspect,custom=inspect&&inspect.custom||"inspect";function copyBuffer(src,target,offset){Buffer2.prototype.copy.call(src,target,offset)}module2.exports=(function(){function BufferList(){_classCallCheck(this,BufferList),this.head=null,this.tail=null,this.length=0}return _createClass(BufferList,[{key:"push",value:function(v){var entry={data:v,next:null};this.length>0?this.tail.next=entry:this.head=entry,this.tail=entry,++this.length}},{key:"unshift",value:function(v){var entry={data:v,next:this.head};this.length===0&&(this.tail=entry),this.head=entry,++this.length}},{key:"shift",value:function(){if(this.length!==0){var ret=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,ret}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(s){if(this.length===0)return"";for(var p=this.head,ret=""+p.data;p=p.next;)ret+=s+p.data;return ret}},{key:"concat",value:function(n){if(this.length===0)return Buffer2.alloc(0);for(var ret=Buffer2.allocUnsafe(n>>>0),p=this.head,i=0;p;)copyBuffer(p.data,ret,i),i+=p.data.length,p=p.next;return ret}},{key:"consume",value:function(n,hasStrings){var ret;return n<this.head.data.length?(ret=this.head.data.slice(0,n),this.head.data=this.head.data.slice(n)):n===this.head.data.length?ret=this.shift():ret=hasStrings?this._getString(n):this._getBuffer(n),ret}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(n){var p=this.head,c=1,ret=p.data;for(n-=ret.length;p=p.next;){var str=p.data,nb=n>str.length?str.length:n;if(nb===str.length?ret+=str:ret+=str.slice(0,n),n-=nb,n===0){nb===str.length?(++c,p.next?this.head=p.next:this.head=this.tail=null):(this.head=p,p.data=str.slice(nb));break}++c}return this.length-=c,ret}},{key:"_getBuffer",value:function(n){var ret=Buffer2.allocUnsafe(n),p=this.head,c=1;for(p.data.copy(ret),n-=p.data.length;p=p.next;){var buf=p.data,nb=n>buf.length?buf.length:n;if(buf.copy(ret,ret.length-n,0,nb),n-=nb,n===0){nb===buf.length?(++c,p.next?this.head=p.next:this.head=this.tail=null):(this.head=p,p.data=buf.slice(nb));break}++c}return this.length-=c,ret}},{key:custom,value:function(_,options){return inspect(this,_objectSpread(_objectSpread({},options),{},{depth:0,customInspect:!1}))}}]),BufferList})()}});var require_destroy2=__commonJS({"node_modules/readable-stream/lib/internal/streams/destroy.js"(exports2,module2){"use strict";function destroy(err,cb){var _this=this,readableDestroyed=this._readableState&&this._readableState.destroyed,writableDestroyed=this._writableState&&this._writableState.destroyed;return readableDestroyed||writableDestroyed?(cb?cb(err):err&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(emitErrorNT,this,err)):process.nextTick(emitErrorNT,this,err)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(err||null,function(err2){!cb&&err2?_this._writableState?_this._writableState.errorEmitted?process.nextTick(emitCloseNT,_this):(_this._writableState.errorEmitted=!0,process.nextTick(emitErrorAndCloseNT,_this,err2)):process.nextTick(emitErrorAndCloseNT,_this,err2):cb?(process.nextTick(emitCloseNT,_this),cb(err2)):process.nextTick(emitCloseNT,_this)}),this)}function emitErrorAndCloseNT(self2,err){emitErrorNT(self2,err),emitCloseNT(self2)}function emitCloseNT(self2){self2._writableState&&!self2._writableState.emitClose||self2._readableState&&!self2._readableState.emitClose||self2.emit("close")}function undestroy(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function emitErrorNT(self2,err){self2.emit("error",err)}function errorOrDestroy(stream,err){var rState=stream._readableState,wState=stream._writableState;rState&&rState.autoDestroy||wState&&wState.autoDestroy?stream.destroy(err):stream.emit("error",err)}module2.exports={destroy,undestroy,errorOrDestroy}}});var require_errors=__commonJS({"node_modules/readable-stream/errors.js"(exports2,module2){"use strict";var codes={};function createErrorType(code,message,Base){Base||(Base=Error);function getMessage(arg1,arg2,arg3){return typeof message=="string"?message:message(arg1,arg2,arg3)}class NodeError extends Base{constructor(arg1,arg2,arg3){super(getMessage(arg1,arg2,arg3))}}NodeError.prototype.name=Base.name,NodeError.prototype.code=code,codes[code]=NodeError}function oneOf(expected,thing){if(Array.isArray(expected)){let len=expected.length;return expected=expected.map(i=>String(i)),len>2?`one of ${thing} ${expected.slice(0,len-1).join(", ")}, or `+expected[len-1]:len===2?`one of ${thing} ${expected[0]} or ${expected[1]}`:`of ${thing} ${expected[0]}`}else return`of ${thing} ${String(expected)}`}function startsWith(str,search,pos){return str.substr(!pos||pos<0?0:+pos,search.length)===search}function endsWith(str,search,this_len){return(this_len===void 0||this_len>str.length)&&(this_len=str.length),str.substring(this_len-search.length,this_len)===search}function includes(str,search,start){return typeof start!="number"&&(start=0),start+search.length>str.length?!1:str.indexOf(search,start)!==-1}createErrorType("ERR_INVALID_OPT_VALUE",function(name,value){return'The value "'+value+'" is invalid for option "'+name+'"'},TypeError);createErrorType("ERR_INVALID_ARG_TYPE",function(name,expected,actual){let determiner;typeof expected=="string"&&startsWith(expected,"not ")?(determiner="must not be",expected=expected.replace(/^not /,"")):determiner="must be";let msg;if(endsWith(name," argument"))msg=`The ${name} ${determiner} ${oneOf(expected,"type")}`;else{let type=includes(name,".")?"property":"argument";msg=`The "${name}" ${type} ${determiner} ${oneOf(expected,"type")}`}return msg+=`. Received type ${typeof actual}`,msg},TypeError);createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");createErrorType("ERR_METHOD_NOT_IMPLEMENTED",function(name){return"The "+name+" method is not implemented"});createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close");createErrorType("ERR_STREAM_DESTROYED",function(name){return"Cannot call "+name+" after a stream was destroyed"});createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times");createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end");createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);createErrorType("ERR_UNKNOWN_ENCODING",function(arg){return"Unknown encoding: "+arg},TypeError);createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");module2.exports.codes=codes}});var require_state=__commonJS({"node_modules/readable-stream/lib/internal/streams/state.js"(exports2,module2){"use strict";var ERR_INVALID_OPT_VALUE=require_errors().codes.ERR_INVALID_OPT_VALUE;function highWaterMarkFrom(options,isDuplex,duplexKey){return options.highWaterMark!=null?options.highWaterMark:isDuplex?options[duplexKey]:null}function getHighWaterMark(state,options,duplexKey,isDuplex){var hwm=highWaterMarkFrom(options,isDuplex,duplexKey);if(hwm!=null){if(!(isFinite(hwm)&&Math.floor(hwm)===hwm)||hwm<0){var name=isDuplex?duplexKey:"highWaterMark";throw new ERR_INVALID_OPT_VALUE(name,hwm)}return Math.floor(hwm)}return state.objectMode?16:16*1024}module2.exports={getHighWaterMark}}});var require_node9=__commonJS({"node_modules/util-deprecate/node.js"(exports2,module2){module2.exports=require("util").deprecate}});var require_stream_writable=__commonJS({"node_modules/readable-stream/lib/_stream_writable.js"(exports2,module2){"use strict";module2.exports=Writable;function CorkedRequest(state){var _this=this;this.next=null,this.entry=null,this.finish=function(){onCorkedFinish(_this,state)}}var Duplex;Writable.WritableState=WritableState;var internalUtil={deprecate:require_node9()},Stream=require_stream3(),Buffer2=require("buffer").Buffer,OurUint8Array=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function _uint8ArrayToBuffer(chunk){return Buffer2.from(chunk)}function _isUint8Array(obj){return Buffer2.isBuffer(obj)||obj instanceof OurUint8Array}var destroyImpl=require_destroy2(),_require=require_state(),getHighWaterMark=_require.getHighWaterMark,_require$codes=require_errors().codes,ERR_INVALID_ARG_TYPE=_require$codes.ERR_INVALID_ARG_TYPE,ERR_METHOD_NOT_IMPLEMENTED=_require$codes.ERR_METHOD_NOT_IMPLEMENTED,ERR_MULTIPLE_CALLBACK=_require$codes.ERR_MULTIPLE_CALLBACK,ERR_STREAM_CANNOT_PIPE=_require$codes.ERR_STREAM_CANNOT_PIPE,ERR_STREAM_DESTROYED=_require$codes.ERR_STREAM_DESTROYED,ERR_STREAM_NULL_VALUES=_require$codes.ERR_STREAM_NULL_VALUES,ERR_STREAM_WRITE_AFTER_END=_require$codes.ERR_STREAM_WRITE_AFTER_END,ERR_UNKNOWN_ENCODING=_require$codes.ERR_UNKNOWN_ENCODING,errorOrDestroy=destroyImpl.errorOrDestroy;require_inherits()(Writable,Stream);function nop(){}function WritableState(options,stream,isDuplex){Duplex=Duplex||require_stream_duplex(),options=options||{},typeof isDuplex!="boolean"&&(isDuplex=stream instanceof Duplex),this.objectMode=!!options.objectMode,isDuplex&&(this.objectMode=this.objectMode||!!options.writableObjectMode),this.highWaterMark=getHighWaterMark(this,options,"writableHighWaterMark",isDuplex),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var noDecode=options.decodeStrings===!1;this.decodeStrings=!noDecode,this.defaultEncoding=options.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(er){onwrite(stream,er)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=options.emitClose!==!1,this.autoDestroy=!!options.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new CorkedRequest(this)}WritableState.prototype.getBuffer=function(){for(var current=this.bufferedRequest,out=[];current;)out.push(current),current=current.next;return out};(function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:internalUtil.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var realHasInstance;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(realHasInstance=Function.prototype[Symbol.hasInstance],Object.defineProperty(Writable,Symbol.hasInstance,{value:function(object){return realHasInstance.call(this,object)?!0:this!==Writable?!1:object&&object._writableState instanceof WritableState}})):realHasInstance=function(object){return object instanceof this};function Writable(options){Duplex=Duplex||require_stream_duplex();var isDuplex=this instanceof Duplex;if(!isDuplex&&!realHasInstance.call(Writable,this))return new Writable(options);this._writableState=new WritableState(options,this,isDuplex),this.writable=!0,options&&(typeof options.write=="function"&&(this._write=options.write),typeof options.writev=="function"&&(this._writev=options.writev),typeof options.destroy=="function"&&(this._destroy=options.destroy),typeof options.final=="function"&&(this._final=options.final)),Stream.call(this)}Writable.prototype.pipe=function(){errorOrDestroy(this,new ERR_STREAM_CANNOT_PIPE)};function writeAfterEnd(stream,cb){var er=new ERR_STREAM_WRITE_AFTER_END;errorOrDestroy(stream,er),process.nextTick(cb,er)}function validChunk(stream,state,chunk,cb){var er;return chunk===null?er=new ERR_STREAM_NULL_VALUES:typeof chunk!="string"&&!state.objectMode&&(er=new ERR_INVALID_ARG_TYPE("chunk",["string","Buffer"],chunk)),er?(errorOrDestroy(stream,er),process.nextTick(cb,er),!1):!0}Writable.prototype.write=function(chunk,encoding,cb){var state=this._writableState,ret=!1,isBuf=!state.objectMode&&_isUint8Array(chunk);return isBuf&&!Buffer2.isBuffer(chunk)&&(chunk=_uint8ArrayToBuffer(chunk)),typeof encoding=="function"&&(cb=encoding,encoding=null),isBuf?encoding="buffer":encoding||(encoding=state.defaultEncoding),typeof cb!="function"&&(cb=nop),state.ending?writeAfterEnd(this,cb):(isBuf||validChunk(this,state,chunk,cb))&&(state.pendingcb++,ret=writeOrBuffer(this,state,isBuf,chunk,encoding,cb)),ret};Writable.prototype.cork=function(){this._writableState.corked++};Writable.prototype.uncork=function(){var state=this._writableState;state.corked&&(state.corked--,!state.writing&&!state.corked&&!state.bufferProcessing&&state.bufferedRequest&&clearBuffer(this,state))};Writable.prototype.setDefaultEncoding=function(encoding){if(typeof encoding=="string"&&(encoding=encoding.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((encoding+"").toLowerCase())>-1))throw new ERR_UNKNOWN_ENCODING(encoding);return this._writableState.defaultEncoding=encoding,this};Object.defineProperty(Writable.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function decodeChunk(state,chunk,encoding){return!state.objectMode&&state.decodeStrings!==!1&&typeof chunk=="string"&&(chunk=Buffer2.from(chunk,encoding)),chunk}Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function writeOrBuffer(stream,state,isBuf,chunk,encoding,cb){if(!isBuf){var newChunk=decodeChunk(state,chunk,encoding);chunk!==newChunk&&(isBuf=!0,encoding="buffer",chunk=newChunk)}var len=state.objectMode?1:chunk.length;state.length+=len;var ret=state.length<state.highWaterMark;if(ret||(state.needDrain=!0),state.writing||state.corked){var last=state.lastBufferedRequest;state.lastBufferedRequest={chunk,encoding,isBuf,callback:cb,next:null},last?last.next=state.lastBufferedRequest:state.bufferedRequest=state.lastBufferedRequest,state.bufferedRequestCount+=1}else doWrite(stream,state,!1,len,chunk,encoding,cb);return ret}function doWrite(stream,state,writev,len,chunk,encoding,cb){state.writelen=len,state.writecb=cb,state.writing=!0,state.sync=!0,state.destroyed?state.onwrite(new ERR_STREAM_DESTROYED("write")):writev?stream._writev(chunk,state.onwrite):stream._write(chunk,encoding,state.onwrite),state.sync=!1}function onwriteError(stream,state,sync,er,cb){--state.pendingcb,sync?(process.nextTick(cb,er),process.nextTick(finishMaybe,stream,state),stream._writableState.errorEmitted=!0,errorOrDestroy(stream,er)):(cb(er),stream._writableState.errorEmitted=!0,errorOrDestroy(stream,er),finishMaybe(stream,state))}function onwriteStateUpdate(state){state.writing=!1,state.writecb=null,state.length-=state.writelen,state.writelen=0}function onwrite(stream,er){var state=stream._writableState,sync=state.sync,cb=state.writecb;if(typeof cb!="function")throw new ERR_MULTIPLE_CALLBACK;if(onwriteStateUpdate(state),er)onwriteError(stream,state,sync,er,cb);else{var finished=needFinish(state)||stream.destroyed;!finished&&!state.corked&&!state.bufferProcessing&&state.bufferedRequest&&clearBuffer(stream,state),sync?process.nextTick(afterWrite,stream,state,finished,cb):afterWrite(stream,state,finished,cb)}}function afterWrite(stream,state,finished,cb){finished||onwriteDrain(stream,state),state.pendingcb--,cb(),finishMaybe(stream,state)}function onwriteDrain(stream,state){state.length===0&&state.needDrain&&(state.needDrain=!1,stream.emit("drain"))}function clearBuffer(stream,state){state.bufferProcessing=!0;var entry=state.bufferedRequest;if(stream._writev&&entry&&entry.next){var l=state.bufferedRequestCount,buffer=new Array(l),holder=state.corkedRequestsFree;holder.entry=entry;for(var count=0,allBuffers=!0;entry;)buffer[count]=entry,entry.isBuf||(allBuffers=!1),entry=entry.next,count+=1;buffer.allBuffers=allBuffers,doWrite(stream,state,!0,state.length,buffer,"",holder.finish),state.pendingcb++,state.lastBufferedRequest=null,holder.next?(state.corkedRequestsFree=holder.next,holder.next=null):state.corkedRequestsFree=new CorkedRequest(state),state.bufferedRequestCount=0}else{for(;entry;){var chunk=entry.chunk,encoding=entry.encoding,cb=entry.callback,len=state.objectMode?1:chunk.length;if(doWrite(stream,state,!1,len,chunk,encoding,cb),entry=entry.next,state.bufferedRequestCount--,state.writing)break}entry===null&&(state.lastBufferedRequest=null)}state.bufferedRequest=entry,state.bufferProcessing=!1}Writable.prototype._write=function(chunk,encoding,cb){cb(new ERR_METHOD_NOT_IMPLEMENTED("_write()"))};Writable.prototype._writev=null;Writable.prototype.end=function(chunk,encoding,cb){var state=this._writableState;return typeof chunk=="function"?(cb=chunk,chunk=null,encoding=null):typeof encoding=="function"&&(cb=encoding,encoding=null),chunk!=null&&this.write(chunk,encoding),state.corked&&(state.corked=1,this.uncork()),state.ending||endWritable(this,state,cb),this};Object.defineProperty(Writable.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function needFinish(state){return state.ending&&state.length===0&&state.bufferedRequest===null&&!state.finished&&!state.writing}function callFinal(stream,state){stream._final(function(err){state.pendingcb--,err&&errorOrDestroy(stream,err),state.prefinished=!0,stream.emit("prefinish"),finishMaybe(stream,state)})}function prefinish(stream,state){!state.prefinished&&!state.finalCalled&&(typeof stream._final=="function"&&!state.destroyed?(state.pendingcb++,state.finalCalled=!0,process.nextTick(callFinal,stream,state)):(state.prefinished=!0,stream.emit("prefinish")))}function finishMaybe(stream,state){var need=needFinish(state);if(need&&(prefinish(stream,state),state.pendingcb===0&&(state.finished=!0,stream.emit("finish"),state.autoDestroy))){var rState=stream._readableState;(!rState||rState.autoDestroy&&rState.endEmitted)&&stream.destroy()}return need}function endWritable(stream,state,cb){state.ending=!0,finishMaybe(stream,state),cb&&(state.finished?process.nextTick(cb):stream.once("finish",cb)),state.ended=!0,stream.writable=!1}function onCorkedFinish(corkReq,state,err){var entry=corkReq.entry;for(corkReq.entry=null;entry;){var cb=entry.callback;state.pendingcb--,cb(err),entry=entry.next}state.corkedRequestsFree.next=corkReq}Object.defineProperty(Writable.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(value){this._writableState&&(this._writableState.destroyed=value)}});Writable.prototype.destroy=destroyImpl.destroy;Writable.prototype._undestroy=destroyImpl.undestroy;Writable.prototype._destroy=function(err,cb){cb(err)}}});var require_stream_duplex=__commonJS({"node_modules/readable-stream/lib/_stream_duplex.js"(exports2,module2){"use strict";var objectKeys=Object.keys||function(obj){var keys2=[];for(var key in obj)keys2.push(key);return keys2};module2.exports=Duplex;var Readable=require_stream_readable(),Writable=require_stream_writable();require_inherits()(Duplex,Readable);for(keys=objectKeys(Writable.prototype),v=0;v<keys.length;v++)method=keys[v],Duplex.prototype[method]||(Duplex.prototype[method]=Writable.prototype[method]);var keys,method,v;function Duplex(options){if(!(this instanceof Duplex))return new Duplex(options);Readable.call(this,options),Writable.call(this,options),this.allowHalfOpen=!0,options&&(options.readable===!1&&(this.readable=!1),options.writable===!1&&(this.writable=!1),options.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",onend)))}Object.defineProperty(Duplex.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});Object.defineProperty(Duplex.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});Object.defineProperty(Duplex.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function onend(){this._writableState.ended||process.nextTick(onEndNT,this)}function onEndNT(self2){self2.end()}Object.defineProperty(Duplex.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(value){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=value,this._writableState.destroyed=value)}})}});var require_string_decoder=__commonJS({"node_modules/string_decoder/lib/string_decoder.js"(exports2){"use strict";var Buffer2=require_safe_buffer().Buffer,isEncoding=Buffer2.isEncoding||function(encoding){switch(encoding=""+encoding,encoding&&encoding.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function _normalizeEncoding(enc){if(!enc)return"utf8";for(var retried;;)switch(enc){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return enc;default:if(retried)return;enc=(""+enc).toLowerCase(),retried=!0}}function normalizeEncoding(enc){var nenc=_normalizeEncoding(enc);if(typeof nenc!="string"&&(Buffer2.isEncoding===isEncoding||!isEncoding(enc)))throw new Error("Unknown encoding: "+enc);return nenc||enc}exports2.StringDecoder=StringDecoder;function StringDecoder(encoding){this.encoding=normalizeEncoding(encoding);var nb;switch(this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,nb=4;break;case"utf8":this.fillLast=utf8FillLast,nb=4;break;case"base64":this.text=base64Text,this.end=base64End,nb=3;break;default:this.write=simpleWrite,this.end=simpleEnd;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Buffer2.allocUnsafe(nb)}StringDecoder.prototype.write=function(buf){if(buf.length===0)return"";var r,i;if(this.lastNeed){if(r=this.fillLast(buf),r===void 0)return"";i=this.lastNeed,this.lastNeed=0}else i=0;return i<buf.length?r?r+this.text(buf,i):this.text(buf,i):r||""};StringDecoder.prototype.end=utf8End;StringDecoder.prototype.text=utf8Text;StringDecoder.prototype.fillLast=function(buf){if(this.lastNeed<=buf.length)return buf.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);buf.copy(this.lastChar,this.lastTotal-this.lastNeed,0,buf.length),this.lastNeed-=buf.length};function utf8CheckByte(byte){return byte<=127?0:byte>>5===6?2:byte>>4===14?3:byte>>3===30?4:byte>>6===2?-1:-2}function utf8CheckIncomplete(self2,buf,i){var j=buf.length-1;if(j<i)return 0;var nb=utf8CheckByte(buf[j]);return nb>=0?(nb>0&&(self2.lastNeed=nb-1),nb):--j<i||nb===-2?0:(nb=utf8CheckByte(buf[j]),nb>=0?(nb>0&&(self2.lastNeed=nb-2),nb):--j<i||nb===-2?0:(nb=utf8CheckByte(buf[j]),nb>=0?(nb>0&&(nb===2?nb=0:self2.lastNeed=nb-3),nb):0))}function utf8CheckExtraBytes(self2,buf,p){if((buf[0]&192)!==128)return self2.lastNeed=0,"\uFFFD";if(self2.lastNeed>1&&buf.length>1){if((buf[1]&192)!==128)return self2.lastNeed=1,"\uFFFD";if(self2.lastNeed>2&&buf.length>2&&(buf[2]&192)!==128)return self2.lastNeed=2,"\uFFFD"}}function utf8FillLast(buf){var p=this.lastTotal-this.lastNeed,r=utf8CheckExtraBytes(this,buf,p);if(r!==void 0)return r;if(this.lastNeed<=buf.length)return buf.copy(this.lastChar,p,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);buf.copy(this.lastChar,p,0,buf.length),this.lastNeed-=buf.length}function utf8Text(buf,i){var total=utf8CheckIncomplete(this,buf,i);if(!this.lastNeed)return buf.toString("utf8",i);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);return buf.copy(this.lastChar,0,end),buf.toString("utf8",i,end)}function utf8End(buf){var r=buf&&buf.length?this.write(buf):"";return this.lastNeed?r+"\uFFFD":r}function utf16Text(buf,i){if((buf.length-i)%2===0){var r=buf.toString("utf16le",i);if(r){var c=r.charCodeAt(r.length-1);if(c>=55296&&c<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=buf[buf.length-2],this.lastChar[1]=buf[buf.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=buf[buf.length-1],buf.toString("utf16le",i,buf.length-1)}function utf16End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed){var end=this.lastTotal-this.lastNeed;return r+this.lastChar.toString("utf16le",0,end)}return r}function base64Text(buf,i){var n=(buf.length-i)%3;return n===0?buf.toString("base64",i):(this.lastNeed=3-n,this.lastTotal=3,n===1?this.lastChar[0]=buf[buf.length-1]:(this.lastChar[0]=buf[buf.length-2],this.lastChar[1]=buf[buf.length-1]),buf.toString("base64",i,buf.length-n))}function base64End(buf){var r=buf&&buf.length?this.write(buf):"";return this.lastNeed?r+this.lastChar.toString("base64",0,3-this.lastNeed):r}function simpleWrite(buf){return buf.toString(this.encoding)}function simpleEnd(buf){return buf&&buf.length?this.write(buf):""}}});var require_end_of_stream=__commonJS({"node_modules/readable-stream/lib/internal/streams/end-of-stream.js"(exports2,module2){"use strict";var ERR_STREAM_PREMATURE_CLOSE=require_errors().codes.ERR_STREAM_PREMATURE_CLOSE;function once(callback){var called=!1;return function(){if(!called){called=!0;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];callback.apply(this,args)}}}function noop(){}function isRequest(stream){return stream.setHeader&&typeof stream.abort=="function"}function eos(stream,opts,callback){if(typeof opts=="function")return eos(stream,null,opts);opts||(opts={}),callback=once(callback||noop);var readable=opts.readable||opts.readable!==!1&&stream.readable,writable=opts.writable||opts.writable!==!1&&stream.writable,onlegacyfinish=function(){stream.writable||onfinish()},writableEnded=stream._writableState&&stream._writableState.finished,onfinish=function(){writable=!1,writableEnded=!0,readable||callback.call(stream)},readableEnded=stream._readableState&&stream._readableState.endEmitted,onend=function(){readable=!1,readableEnded=!0,writable||callback.call(stream)},onerror=function(err){callback.call(stream,err)},onclose=function(){var err;if(readable&&!readableEnded)return(!stream._readableState||!stream._readableState.ended)&&(err=new ERR_STREAM_PREMATURE_CLOSE),callback.call(stream,err);if(writable&&!writableEnded)return(!stream._writableState||!stream._writableState.ended)&&(err=new ERR_STREAM_PREMATURE_CLOSE),callback.call(stream,err)},onrequest=function(){stream.req.on("finish",onfinish)};return isRequest(stream)?(stream.on("complete",onfinish),stream.on("abort",onclose),stream.req?onrequest():stream.on("request",onrequest)):writable&&!stream._writableState&&(stream.on("end",onlegacyfinish),stream.on("close",onlegacyfinish)),stream.on("end",onend),stream.on("finish",onfinish),opts.error!==!1&&stream.on("error",onerror),stream.on("close",onclose),function(){stream.removeListener("complete",onfinish),stream.removeListener("abort",onclose),stream.removeListener("request",onrequest),stream.req&&stream.req.removeListener("finish",onfinish),stream.removeListener("end",onlegacyfinish),stream.removeListener("close",onlegacyfinish),stream.removeListener("finish",onfinish),stream.removeListener("end",onend),stream.removeListener("error",onerror),stream.removeListener("close",onclose)}}module2.exports=eos}});var require_async_iterator=__commonJS({"node_modules/readable-stream/lib/internal/streams/async_iterator.js"(exports2,module2){"use strict";var _Object$setPrototypeO;function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return typeof key=="symbol"?key:String(key)}function _toPrimitive(input,hint){if(typeof input!="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if(typeof res!="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return(hint==="string"?String:Number)(input)}var finished=require_end_of_stream(),kLastResolve=Symbol("lastResolve"),kLastReject=Symbol("lastReject"),kError=Symbol("error"),kEnded=Symbol("ended"),kLastPromise=Symbol("lastPromise"),kHandlePromise=Symbol("handlePromise"),kStream=Symbol("stream");function createIterResult(value,done){return{value,done}}function readAndResolve(iter){var resolve=iter[kLastResolve];if(resolve!==null){var data=iter[kStream].read();data!==null&&(iter[kLastPromise]=null,iter[kLastResolve]=null,iter[kLastReject]=null,resolve(createIterResult(data,!1)))}}function onReadable(iter){process.nextTick(readAndResolve,iter)}function wrapForNext(lastPromise,iter){return function(resolve,reject){lastPromise.then(function(){if(iter[kEnded]){resolve(createIterResult(void 0,!0));return}iter[kHandlePromise](resolve,reject)},reject)}}var AsyncIteratorPrototype=Object.getPrototypeOf(function(){}),ReadableStreamAsyncIteratorPrototype=Object.setPrototypeOf((_Object$setPrototypeO={get stream(){return this[kStream]},next:function(){var _this=this,error=this[kError];if(error!==null)return Promise.reject(error);if(this[kEnded])return Promise.resolve(createIterResult(void 0,!0));if(this[kStream].destroyed)return new Promise(function(resolve,reject){process.nextTick(function(){_this[kError]?reject(_this[kError]):resolve(createIterResult(void 0,!0))})});var lastPromise=this[kLastPromise],promise;if(lastPromise)promise=new Promise(wrapForNext(lastPromise,this));else{var data=this[kStream].read();if(data!==null)return Promise.resolve(createIterResult(data,!1));promise=new Promise(this[kHandlePromise])}return this[kLastPromise]=promise,promise}},_defineProperty(_Object$setPrototypeO,Symbol.asyncIterator,function(){return this}),_defineProperty(_Object$setPrototypeO,"return",function(){var _this2=this;return new Promise(function(resolve,reject){_this2[kStream].destroy(null,function(err){if(err){reject(err);return}resolve(createIterResult(void 0,!0))})})}),_Object$setPrototypeO),AsyncIteratorPrototype),createReadableStreamAsyncIterator=function(stream){var _Object$create,iterator=Object.create(ReadableStreamAsyncIteratorPrototype,(_Object$create={},_defineProperty(_Object$create,kStream,{value:stream,writable:!0}),_defineProperty(_Object$create,kLastResolve,{value:null,writable:!0}),_defineProperty(_Object$create,kLastReject,{value:null,writable:!0}),_defineProperty(_Object$create,kError,{value:null,writable:!0}),_defineProperty(_Object$create,kEnded,{value:stream._readableState.endEmitted,writable:!0}),_defineProperty(_Object$create,kHandlePromise,{value:function(resolve,reject){var data=iterator[kStream].read();data?(iterator[kLastPromise]=null,iterator[kLastResolve]=null,iterator[kLastReject]=null,resolve(createIterResult(data,!1))):(iterator[kLastResolve]=resolve,iterator[kLastReject]=reject)},writable:!0}),_Object$create));return iterator[kLastPromise]=null,finished(stream,function(err){if(err&&err.code!=="ERR_STREAM_PREMATURE_CLOSE"){var reject=iterator[kLastReject];reject!==null&&(iterator[kLastPromise]=null,iterator[kLastResolve]=null,iterator[kLastReject]=null,reject(err)),iterator[kError]=err;return}var resolve=iterator[kLastResolve];resolve!==null&&(iterator[kLastPromise]=null,iterator[kLastResolve]=null,iterator[kLastReject]=null,resolve(createIterResult(void 0,!0))),iterator[kEnded]=!0}),stream.on("readable",onReadable.bind(null,iterator)),iterator};module2.exports=createReadableStreamAsyncIterator}});var require_from=__commonJS({"node_modules/readable-stream/lib/internal/streams/from.js"(exports2,module2){"use strict";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){reject(error);return}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _asyncToGenerator(fn){return function(){var self2=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self2,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(void 0)})}}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))})}return target}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return typeof key=="symbol"?key:String(key)}function _toPrimitive(input,hint){if(typeof input!="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if(typeof res!="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return(hint==="string"?String:Number)(input)}var ERR_INVALID_ARG_TYPE=require_errors().codes.ERR_INVALID_ARG_TYPE;function from(Readable,iterable,opts){var iterator;if(iterable&&typeof iterable.next=="function")iterator=iterable;else if(iterable&&iterable[Symbol.asyncIterator])iterator=iterable[Symbol.asyncIterator]();else if(iterable&&iterable[Symbol.iterator])iterator=iterable[Symbol.iterator]();else throw new ERR_INVALID_ARG_TYPE("iterable",["Iterable"],iterable);var readable=new Readable(_objectSpread({objectMode:!0},opts)),reading=!1;readable._read=function(){reading||(reading=!0,next())};function next(){return _next2.apply(this,arguments)}function _next2(){return _next2=_asyncToGenerator(function*(){try{var _yield$iterator$next=yield iterator.next(),value=_yield$iterator$next.value,done=_yield$iterator$next.done;done?readable.push(null):readable.push(yield value)?next():reading=!1}catch(err){readable.destroy(err)}}),_next2.apply(this,arguments)}return readable}module2.exports=from}});var require_stream_readable=__commonJS({"node_modules/readable-stream/lib/_stream_readable.js"(exports2,module2){"use strict";module2.exports=Readable;var Duplex;Readable.ReadableState=ReadableState;var EE=require("events").EventEmitter,EElistenerCount=function(emitter,type){return emitter.listeners(type).length},Stream=require_stream3(),Buffer2=require("buffer").Buffer,OurUint8Array=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function _uint8ArrayToBuffer(chunk){return Buffer2.from(chunk)}function _isUint8Array(obj){return Buffer2.isBuffer(obj)||obj instanceof OurUint8Array}var debugUtil=require("util"),debug;debugUtil&&debugUtil.debuglog?debug=debugUtil.debuglog("stream"):debug=function(){};var BufferList=require_buffer_list(),destroyImpl=require_destroy2(),_require=require_state(),getHighWaterMark=_require.getHighWaterMark,_require$codes=require_errors().codes,ERR_INVALID_ARG_TYPE=_require$codes.ERR_INVALID_ARG_TYPE,ERR_STREAM_PUSH_AFTER_EOF=_require$codes.ERR_STREAM_PUSH_AFTER_EOF,ERR_METHOD_NOT_IMPLEMENTED=_require$codes.ERR_METHOD_NOT_IMPLEMENTED,ERR_STREAM_UNSHIFT_AFTER_END_EVENT=_require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,StringDecoder,createReadableStreamAsyncIterator,from;require_inherits()(Readable,Stream);var errorOrDestroy=destroyImpl.errorOrDestroy,kProxyEvents=["error","close","destroy","pause","resume"];function prependListener(emitter,event,fn){if(typeof emitter.prependListener=="function")return emitter.prependListener(event,fn);!emitter._events||!emitter._events[event]?emitter.on(event,fn):Array.isArray(emitter._events[event])?emitter._events[event].unshift(fn):emitter._events[event]=[fn,emitter._events[event]]}function ReadableState(options,stream,isDuplex){Duplex=Duplex||require_stream_duplex(),options=options||{},typeof isDuplex!="boolean"&&(isDuplex=stream instanceof Duplex),this.objectMode=!!options.objectMode,isDuplex&&(this.objectMode=this.objectMode||!!options.readableObjectMode),this.highWaterMark=getHighWaterMark(this,options,"readableHighWaterMark",isDuplex),this.buffer=new BufferList,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=options.emitClose!==!1,this.autoDestroy=!!options.autoDestroy,this.destroyed=!1,this.defaultEncoding=options.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,options.encoding&&(StringDecoder||(StringDecoder=require_string_decoder().StringDecoder),this.decoder=new StringDecoder(options.encoding),this.encoding=options.encoding)}function Readable(options){if(Duplex=Duplex||require_stream_duplex(),!(this instanceof Readable))return new Readable(options);var isDuplex=this instanceof Duplex;this._readableState=new ReadableState(options,this,isDuplex),this.readable=!0,options&&(typeof options.read=="function"&&(this._read=options.read),typeof options.destroy=="function"&&(this._destroy=options.destroy)),Stream.call(this)}Object.defineProperty(Readable.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(value){this._readableState&&(this._readableState.destroyed=value)}});Readable.prototype.destroy=destroyImpl.destroy;Readable.prototype._undestroy=destroyImpl.undestroy;Readable.prototype._destroy=function(err,cb){cb(err)};Readable.prototype.push=function(chunk,encoding){var state=this._readableState,skipChunkCheck;return state.objectMode?skipChunkCheck=!0:typeof chunk=="string"&&(encoding=encoding||state.defaultEncoding,encoding!==state.encoding&&(chunk=Buffer2.from(chunk,encoding),encoding=""),skipChunkCheck=!0),readableAddChunk(this,chunk,encoding,!1,skipChunkCheck)};Readable.prototype.unshift=function(chunk){return readableAddChunk(this,chunk,null,!0,!1)};function readableAddChunk(stream,chunk,encoding,addToFront,skipChunkCheck){debug("readableAddChunk",chunk);var state=stream._readableState;if(chunk===null)state.reading=!1,onEofChunk(stream,state);else{var er;if(skipChunkCheck||(er=chunkInvalid(state,chunk)),er)errorOrDestroy(stream,er);else if(state.objectMode||chunk&&chunk.length>0)if(typeof chunk!="string"&&!state.objectMode&&Object.getPrototypeOf(chunk)!==Buffer2.prototype&&(chunk=_uint8ArrayToBuffer(chunk)),addToFront)state.endEmitted?errorOrDestroy(stream,new ERR_STREAM_UNSHIFT_AFTER_END_EVENT):addChunk(stream,state,chunk,!0);else if(state.ended)errorOrDestroy(stream,new ERR_STREAM_PUSH_AFTER_EOF);else{if(state.destroyed)return!1;state.reading=!1,state.decoder&&!encoding?(chunk=state.decoder.write(chunk),state.objectMode||chunk.length!==0?addChunk(stream,state,chunk,!1):maybeReadMore(stream,state)):addChunk(stream,state,chunk,!1)}else addToFront||(state.reading=!1,maybeReadMore(stream,state))}return!state.ended&&(state.length<state.highWaterMark||state.length===0)}function addChunk(stream,state,chunk,addToFront){state.flowing&&state.length===0&&!state.sync?(state.awaitDrain=0,stream.emit("data",chunk)):(state.length+=state.objectMode?1:chunk.length,addToFront?state.buffer.unshift(chunk):state.buffer.push(chunk),state.needReadable&&emitReadable(stream)),maybeReadMore(stream,state)}function chunkInvalid(state,chunk){var er;return!_isUint8Array(chunk)&&typeof chunk!="string"&&chunk!==void 0&&!state.objectMode&&(er=new ERR_INVALID_ARG_TYPE("chunk",["string","Buffer","Uint8Array"],chunk)),er}Readable.prototype.isPaused=function(){return this._readableState.flowing===!1};Readable.prototype.setEncoding=function(enc){StringDecoder||(StringDecoder=require_string_decoder().StringDecoder);var decoder=new StringDecoder(enc);this._readableState.decoder=decoder,this._readableState.encoding=this._readableState.decoder.encoding;for(var p=this._readableState.buffer.head,content="";p!==null;)content+=decoder.write(p.data),p=p.next;return this._readableState.buffer.clear(),content!==""&&this._readableState.buffer.push(content),this._readableState.length=content.length,this};var MAX_HWM=1073741824;function computeNewHighWaterMark(n){return n>=MAX_HWM?n=MAX_HWM:(n--,n|=n>>>1,n|=n>>>2,n|=n>>>4,n|=n>>>8,n|=n>>>16,n++),n}function howMuchToRead(n,state){return n<=0||state.length===0&&state.ended?0:state.objectMode?1:n!==n?state.flowing&&state.length?state.buffer.head.data.length:state.length:(n>state.highWaterMark&&(state.highWaterMark=computeNewHighWaterMark(n)),n<=state.length?n:state.ended?state.length:(state.needReadable=!0,0))}Readable.prototype.read=function(n){debug("read",n),n=parseInt(n,10);var state=this._readableState,nOrig=n;if(n!==0&&(state.emittedReadable=!1),n===0&&state.needReadable&&((state.highWaterMark!==0?state.length>=state.highWaterMark:state.length>0)||state.ended))return debug("read: emitReadable",state.length,state.ended),state.length===0&&state.ended?endReadable(this):emitReadable(this),null;if(n=howMuchToRead(n,state),n===0&&state.ended)return state.length===0&&endReadable(this),null;var doRead=state.needReadable;debug("need readable",doRead),(state.length===0||state.length-n<state.highWaterMark)&&(doRead=!0,debug("length less than watermark",doRead)),state.ended||state.reading?(doRead=!1,debug("reading or ended",doRead)):doRead&&(debug("do read"),state.reading=!0,state.sync=!0,state.length===0&&(state.needReadable=!0),this._read(state.highWaterMark),state.sync=!1,state.reading||(n=howMuchToRead(nOrig,state)));var ret;return n>0?ret=fromList(n,state):ret=null,ret===null?(state.needReadable=state.length<=state.highWaterMark,n=0):(state.length-=n,state.awaitDrain=0),state.length===0&&(state.ended||(state.needReadable=!0),nOrig!==n&&state.ended&&endReadable(this)),ret!==null&&this.emit("data",ret),ret};function onEofChunk(stream,state){if(debug("onEofChunk"),!state.ended){if(state.decoder){var chunk=state.decoder.end();chunk&&chunk.length&&(state.buffer.push(chunk),state.length+=state.objectMode?1:chunk.length)}state.ended=!0,state.sync?emitReadable(stream):(state.needReadable=!1,state.emittedReadable||(state.emittedReadable=!0,emitReadable_(stream)))}}function emitReadable(stream){var state=stream._readableState;debug("emitReadable",state.needReadable,state.emittedReadable),state.needReadable=!1,state.emittedReadable||(debug("emitReadable",state.flowing),state.emittedReadable=!0,process.nextTick(emitReadable_,stream))}function emitReadable_(stream){var state=stream._readableState;debug("emitReadable_",state.destroyed,state.length,state.ended),!state.destroyed&&(state.length||state.ended)&&(stream.emit("readable"),state.emittedReadable=!1),state.needReadable=!state.flowing&&!state.ended&&state.length<=state.highWaterMark,flow(stream)}function maybeReadMore(stream,state){state.readingMore||(state.readingMore=!0,process.nextTick(maybeReadMore_,stream,state))}function maybeReadMore_(stream,state){for(;!state.reading&&!state.ended&&(state.length<state.highWaterMark||state.flowing&&state.length===0);){var len=state.length;if(debug("maybeReadMore read 0"),stream.read(0),len===state.length)break}state.readingMore=!1}Readable.prototype._read=function(n){errorOrDestroy(this,new ERR_METHOD_NOT_IMPLEMENTED("_read()"))};Readable.prototype.pipe=function(dest,pipeOpts){var src=this,state=this._readableState;switch(state.pipesCount){case 0:state.pipes=dest;break;case 1:state.pipes=[state.pipes,dest];break;default:state.pipes.push(dest);break}state.pipesCount+=1,debug("pipe count=%d opts=%j",state.pipesCount,pipeOpts);var doEnd=(!pipeOpts||pipeOpts.end!==!1)&&dest!==process.stdout&&dest!==process.stderr,endFn=doEnd?onend:unpipe;state.endEmitted?process.nextTick(endFn):src.once("end",endFn),dest.on("unpipe",onunpipe);function onunpipe(readable,unpipeInfo){debug("onunpipe"),readable===src&&unpipeInfo&&unpipeInfo.hasUnpiped===!1&&(unpipeInfo.hasUnpiped=!0,cleanup())}function onend(){debug("onend"),dest.end()}var ondrain=pipeOnDrain(src);dest.on("drain",ondrain);var cleanedUp=!1;function cleanup(){debug("cleanup"),dest.removeListener("close",onclose),dest.removeListener("finish",onfinish),dest.removeListener("drain",ondrain),dest.removeListener("error",onerror),dest.removeListener("unpipe",onunpipe),src.removeListener("end",onend),src.removeListener("end",unpipe),src.removeListener("data",ondata),cleanedUp=!0,state.awaitDrain&&(!dest._writableState||dest._writableState.needDrain)&&ondrain()}src.on("data",ondata);function ondata(chunk){debug("ondata");var ret=dest.write(chunk);debug("dest.write",ret),ret===!1&&((state.pipesCount===1&&state.pipes===dest||state.pipesCount>1&&indexOf(state.pipes,dest)!==-1)&&!cleanedUp&&(debug("false write response, pause",state.awaitDrain),state.awaitDrain++),src.pause())}function onerror(er){debug("onerror",er),unpipe(),dest.removeListener("error",onerror),EElistenerCount(dest,"error")===0&&errorOrDestroy(dest,er)}prependListener(dest,"error",onerror);function onclose(){dest.removeListener("finish",onfinish),unpipe()}dest.once("close",onclose);function onfinish(){debug("onfinish"),dest.removeListener("close",onclose),unpipe()}dest.once("finish",onfinish);function unpipe(){debug("unpipe"),src.unpipe(dest)}return dest.emit("pipe",src),state.flowing||(debug("pipe resume"),src.resume()),dest};function pipeOnDrain(src){return function(){var state=src._readableState;debug("pipeOnDrain",state.awaitDrain),state.awaitDrain&&state.awaitDrain--,state.awaitDrain===0&&EElistenerCount(src,"data")&&(state.flowing=!0,flow(src))}}Readable.prototype.unpipe=function(dest){var state=this._readableState,unpipeInfo={hasUnpiped:!1};if(state.pipesCount===0)return this;if(state.pipesCount===1)return dest&&dest!==state.pipes?this:(dest||(dest=state.pipes),state.pipes=null,state.pipesCount=0,state.flowing=!1,dest&&dest.emit("unpipe",this,unpipeInfo),this);if(!dest){var dests=state.pipes,len=state.pipesCount;state.pipes=null,state.pipesCount=0,state.flowing=!1;for(var i=0;i<len;i++)dests[i].emit("unpipe",this,{hasUnpiped:!1});return this}var index=indexOf(state.pipes,dest);return index===-1?this:(state.pipes.splice(index,1),state.pipesCount-=1,state.pipesCount===1&&(state.pipes=state.pipes[0]),dest.emit("unpipe",this,unpipeInfo),this)};Readable.prototype.on=function(ev,fn){var res=Stream.prototype.on.call(this,ev,fn),state=this._readableState;return ev==="data"?(state.readableListening=this.listenerCount("readable")>0,state.flowing!==!1&&this.resume()):ev==="readable"&&!state.endEmitted&&!state.readableListening&&(state.readableListening=state.needReadable=!0,state.flowing=!1,state.emittedReadable=!1,debug("on readable",state.length,state.reading),state.length?emitReadable(this):state.reading||process.nextTick(nReadingNextTick,this)),res};Readable.prototype.addListener=Readable.prototype.on;Readable.prototype.removeListener=function(ev,fn){var res=Stream.prototype.removeListener.call(this,ev,fn);return ev==="readable"&&process.nextTick(updateReadableListening,this),res};Readable.prototype.removeAllListeners=function(ev){var res=Stream.prototype.removeAllListeners.apply(this,arguments);return(ev==="readable"||ev===void 0)&&process.nextTick(updateReadableListening,this),res};function updateReadableListening(self2){var state=self2._readableState;state.readableListening=self2.listenerCount("readable")>0,state.resumeScheduled&&!state.paused?state.flowing=!0:self2.listenerCount("data")>0&&self2.resume()}function nReadingNextTick(self2){debug("readable nexttick read 0"),self2.read(0)}Readable.prototype.resume=function(){var state=this._readableState;return state.flowing||(debug("resume"),state.flowing=!state.readableListening,resume(this,state)),state.paused=!1,this};function resume(stream,state){state.resumeScheduled||(state.resumeScheduled=!0,process.nextTick(resume_,stream,state))}function resume_(stream,state){debug("resume",state.reading),state.reading||stream.read(0),state.resumeScheduled=!1,stream.emit("resume"),flow(stream),state.flowing&&!state.reading&&stream.read(0)}Readable.prototype.pause=function(){return debug("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(debug("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function flow(stream){var state=stream._readableState;for(debug("flow",state.flowing);state.flowing&&stream.read()!==null;);}Readable.prototype.wrap=function(stream){var _this=this,state=this._readableState,paused=!1;stream.on("end",function(){if(debug("wrapped end"),state.decoder&&!state.ended){var chunk=state.decoder.end();chunk&&chunk.length&&_this.push(chunk)}_this.push(null)}),stream.on("data",function(chunk){if(debug("wrapped data"),state.decoder&&(chunk=state.decoder.write(chunk)),!(state.objectMode&&chunk==null)&&!(!state.objectMode&&(!chunk||!chunk.length))){var ret=_this.push(chunk);ret||(paused=!0,stream.pause())}});for(var i in stream)this[i]===void 0&&typeof stream[i]=="function"&&(this[i]=(function(method){return function(){return stream[method].apply(stream,arguments)}})(i));for(var n=0;n<kProxyEvents.length;n++)stream.on(kProxyEvents[n],this.emit.bind(this,kProxyEvents[n]));return this._read=function(n2){debug("wrapped _read",n2),paused&&(paused=!1,stream.resume())},this};typeof Symbol=="function"&&(Readable.prototype[Symbol.asyncIterator]=function(){return createReadableStreamAsyncIterator===void 0&&(createReadableStreamAsyncIterator=require_async_iterator()),createReadableStreamAsyncIterator(this)});Object.defineProperty(Readable.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});Object.defineProperty(Readable.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}});Object.defineProperty(Readable.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(state){this._readableState&&(this._readableState.flowing=state)}});Readable._fromList=fromList;Object.defineProperty(Readable.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function fromList(n,state){if(state.length===0)return null;var ret;return state.objectMode?ret=state.buffer.shift():!n||n>=state.length?(state.decoder?ret=state.buffer.join(""):state.buffer.length===1?ret=state.buffer.first():ret=state.buffer.concat(state.length),state.buffer.clear()):ret=state.buffer.consume(n,state.decoder),ret}function endReadable(stream){var state=stream._readableState;debug("endReadable",state.endEmitted),state.endEmitted||(state.ended=!0,process.nextTick(endReadableNT,state,stream))}function endReadableNT(state,stream){if(debug("endReadableNT",state.endEmitted,state.length),!state.endEmitted&&state.length===0&&(state.endEmitted=!0,stream.readable=!1,stream.emit("end"),state.autoDestroy)){var wState=stream._writableState;(!wState||wState.autoDestroy&&wState.finished)&&stream.destroy()}}typeof Symbol=="function"&&(Readable.from=function(iterable,opts){return from===void 0&&(from=require_from()),from(Readable,iterable,opts)});function indexOf(xs,x){for(var i=0,l=xs.length;i<l;i++)if(xs[i]===x)return i;return-1}}});var require_stream_transform=__commonJS({"node_modules/readable-stream/lib/_stream_transform.js"(exports2,module2){"use strict";module2.exports=Transform;var _require$codes=require_errors().codes,ERR_METHOD_NOT_IMPLEMENTED=_require$codes.ERR_METHOD_NOT_IMPLEMENTED,ERR_MULTIPLE_CALLBACK=_require$codes.ERR_MULTIPLE_CALLBACK,ERR_TRANSFORM_ALREADY_TRANSFORMING=_require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,ERR_TRANSFORM_WITH_LENGTH_0=_require$codes.ERR_TRANSFORM_WITH_LENGTH_0,Duplex=require_stream_duplex();require_inherits()(Transform,Duplex);function afterTransform(er,data){var ts=this._transformState;ts.transforming=!1;var cb=ts.writecb;if(cb===null)return this.emit("error",new ERR_MULTIPLE_CALLBACK);ts.writechunk=null,ts.writecb=null,data!=null&&this.push(data),cb(er);var rs=this._readableState;rs.reading=!1,(rs.needReadable||rs.length<rs.highWaterMark)&&this._read(rs.highWaterMark)}function Transform(options){if(!(this instanceof Transform))return new Transform(options);Duplex.call(this,options),this._transformState={afterTransform:afterTransform.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,options&&(typeof options.transform=="function"&&(this._transform=options.transform),typeof options.flush=="function"&&(this._flush=options.flush)),this.on("prefinish",prefinish)}function prefinish(){var _this=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(er,data){done(_this,er,data)}):done(this,null,null)}Transform.prototype.push=function(chunk,encoding){return this._transformState.needTransform=!1,Duplex.prototype.push.call(this,chunk,encoding)};Transform.prototype._transform=function(chunk,encoding,cb){cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()"))};Transform.prototype._write=function(chunk,encoding,cb){var ts=this._transformState;if(ts.writecb=cb,ts.writechunk=chunk,ts.writeencoding=encoding,!ts.transforming){var rs=this._readableState;(ts.needTransform||rs.needReadable||rs.length<rs.highWaterMark)&&this._read(rs.highWaterMark)}};Transform.prototype._read=function(n){var ts=this._transformState;ts.writechunk!==null&&!ts.transforming?(ts.transforming=!0,this._transform(ts.writechunk,ts.writeencoding,ts.afterTransform)):ts.needTransform=!0};Transform.prototype._destroy=function(err,cb){Duplex.prototype._destroy.call(this,err,function(err2){cb(err2)})};function done(stream,er,data){if(er)return stream.emit("error",er);if(data!=null&&stream.push(data),stream._writableState.length)throw new ERR_TRANSFORM_WITH_LENGTH_0;if(stream._transformState.transforming)throw new ERR_TRANSFORM_ALREADY_TRANSFORMING;return stream.push(null)}}});var require_stream_passthrough=__commonJS({"node_modules/readable-stream/lib/_stream_passthrough.js"(exports2,module2){"use strict";module2.exports=PassThrough;var Transform=require_stream_transform();require_inherits()(PassThrough,Transform);function PassThrough(options){if(!(this instanceof PassThrough))return new PassThrough(options);Transform.call(this,options)}PassThrough.prototype._transform=function(chunk,encoding,cb){cb(null,chunk)}}});var require_pipeline=__commonJS({"node_modules/readable-stream/lib/internal/streams/pipeline.js"(exports2,module2){"use strict";var eos;function once(callback){var called=!1;return function(){called||(called=!0,callback.apply(void 0,arguments))}}var _require$codes=require_errors().codes,ERR_MISSING_ARGS=_require$codes.ERR_MISSING_ARGS,ERR_STREAM_DESTROYED=_require$codes.ERR_STREAM_DESTROYED;function noop(err){if(err)throw err}function isRequest(stream){return stream.setHeader&&typeof stream.abort=="function"}function destroyer(stream,reading,writing,callback){callback=once(callback);var closed=!1;stream.on("close",function(){closed=!0}),eos===void 0&&(eos=require_end_of_stream()),eos(stream,{readable:reading,writable:writing},function(err){if(err)return callback(err);closed=!0,callback()});var destroyed=!1;return function(err){if(!closed&&!destroyed){if(destroyed=!0,isRequest(stream))return stream.abort();if(typeof stream.destroy=="function")return stream.destroy();callback(err||new ERR_STREAM_DESTROYED("pipe"))}}}function call(fn){fn()}function pipe(from,to){return from.pipe(to)}function popCallback(streams){return!streams.length||typeof streams[streams.length-1]!="function"?noop:streams.pop()}function pipeline(){for(var _len=arguments.length,streams=new Array(_len),_key=0;_key<_len;_key++)streams[_key]=arguments[_key];var callback=popCallback(streams);if(Array.isArray(streams[0])&&(streams=streams[0]),streams.length<2)throw new ERR_MISSING_ARGS("streams");var error,destroys=streams.map(function(stream,i){var reading=i<streams.length-1,writing=i>0;return destroyer(stream,reading,writing,function(err){error||(error=err),err&&destroys.forEach(call),!reading&&(destroys.forEach(call),callback(error))})});return streams.reduce(pipe)}module2.exports=pipeline}});var require_readable=__commonJS({"node_modules/readable-stream/readable.js"(exports2,module2){var Stream=require("stream");process.env.READABLE_STREAM==="disable"&&Stream?(module2.exports=Stream.Readable,Object.assign(module2.exports,Stream),module2.exports.Stream=Stream):(exports2=module2.exports=require_stream_readable(),exports2.Stream=Stream||exports2,exports2.Readable=exports2,exports2.Writable=require_stream_writable(),exports2.Duplex=require_stream_duplex(),exports2.Transform=require_stream_transform(),exports2.PassThrough=require_stream_passthrough(),exports2.finished=require_end_of_stream(),exports2.pipeline=require_pipeline())}});var require_buffer_from=__commonJS({"node_modules/buffer-from/index.js"(exports2,module2){var toString=Object.prototype.toString,isModern=typeof Buffer<"u"&&typeof Buffer.alloc=="function"&&typeof Buffer.allocUnsafe=="function"&&typeof Buffer.from=="function";function isArrayBuffer(input){return toString.call(input).slice(8,-1)==="ArrayBuffer"}function fromArrayBuffer(obj,byteOffset,length){byteOffset>>>=0;var maxLength=obj.byteLength-byteOffset;if(maxLength<0)throw new RangeError("'offset' is out of bounds");if(length===void 0)length=maxLength;else if(length>>>=0,length>maxLength)throw new RangeError("'length' is out of bounds");return isModern?Buffer.from(obj.slice(byteOffset,byteOffset+length)):new Buffer(new Uint8Array(obj.slice(byteOffset,byteOffset+length)))}function fromString(string,encoding){if((typeof encoding!="string"||encoding==="")&&(encoding="utf8"),!Buffer.isEncoding(encoding))throw new TypeError('"encoding" must be a valid string encoding');return isModern?Buffer.from(string,encoding):new Buffer(string,encoding)}function bufferFrom(value,encodingOrOffset,length){if(typeof value=="number")throw new TypeError('"value" argument must not be a number');return isArrayBuffer(value)?fromArrayBuffer(value,encodingOrOffset,length):typeof value=="string"?fromString(value,encodingOrOffset):isModern?Buffer.from(value):new Buffer(value)}module2.exports=bufferFrom}});var require_typedarray=__commonJS({"node_modules/typedarray/index.js"(exports2){var undefined2=void 0,MAX_ARRAY_LENGTH=1e5,ECMAScript=(function(){var opts=Object.prototype.toString,ophop=Object.prototype.hasOwnProperty;return{Class:function(v){return opts.call(v).replace(/^\[object *|\]$/g,"")},HasProperty:function(o,p){return p in o},HasOwnProperty:function(o,p){return ophop.call(o,p)},IsCallable:function(o){return typeof o=="function"},ToInt32:function(v){return v>>0},ToUint32:function(v){return v>>>0}}})(),LN2=Math.LN2,abs=Math.abs,floor=Math.floor,log=Math.log,min=Math.min,pow=Math.pow,round=Math.round;function configureProperties(obj){if(getOwnPropNames&&defineProp){var props=getOwnPropNames(obj),i;for(i=0;i<props.length;i+=1)defineProp(obj,props[i],{value:obj[props[i]],writable:!1,enumerable:!1,configurable:!1})}}var defineProp;Object.defineProperty&&(function(){try{return Object.defineProperty({},"x",{}),!0}catch{return!1}})()?defineProp=Object.defineProperty:defineProp=function(o,p,desc){if(!o===Object(o))throw new TypeError("Object.defineProperty called on non-object");return ECMAScript.HasProperty(desc,"get")&&Object.prototype.__defineGetter__&&Object.prototype.__defineGetter__.call(o,p,desc.get),ECMAScript.HasProperty(desc,"set")&&Object.prototype.__defineSetter__&&Object.prototype.__defineSetter__.call(o,p,desc.set),ECMAScript.HasProperty(desc,"value")&&(o[p]=desc.value),o};var getOwnPropNames=Object.getOwnPropertyNames||function(o){if(o!==Object(o))throw new TypeError("Object.getOwnPropertyNames called on non-object");var props=[],p;for(p in o)ECMAScript.HasOwnProperty(o,p)&&props.push(p);return props};function makeArrayAccessors(obj){if(!defineProp)return;if(obj.length>MAX_ARRAY_LENGTH)throw new RangeError("Array too large for polyfill");function makeArrayAccessor(index){defineProp(obj,index,{get:function(){return obj._getter(index)},set:function(v){obj._setter(index,v)},enumerable:!0,configurable:!1})}var i;for(i=0;i<obj.length;i+=1)makeArrayAccessor(i)}function as_signed(value,bits){var s=32-bits;return value<<s>>s}function as_unsigned(value,bits){var s=32-bits;return value<<s>>>s}function packI8(n){return[n&255]}function unpackI8(bytes){return as_signed(bytes[0],8)}function packU8(n){return[n&255]}function unpackU8(bytes){return as_unsigned(bytes[0],8)}function packU8Clamped(n){return n=round(Number(n)),[n<0?0:n>255?255:n&255]}function packI16(n){return[n>>8&255,n&255]}function unpackI16(bytes){return as_signed(bytes[0]<<8|bytes[1],16)}function packU16(n){return[n>>8&255,n&255]}function unpackU16(bytes){return as_unsigned(bytes[0]<<8|bytes[1],16)}function packI32(n){return[n>>24&255,n>>16&255,n>>8&255,n&255]}function unpackI32(bytes){return as_signed(bytes[0]<<24|bytes[1]<<16|bytes[2]<<8|bytes[3],32)}function packU32(n){return[n>>24&255,n>>16&255,n>>8&255,n&255]}function unpackU32(bytes){return as_unsigned(bytes[0]<<24|bytes[1]<<16|bytes[2]<<8|bytes[3],32)}function packIEEE754(v,ebits,fbits){var bias=(1<<ebits-1)-1,s,e,f,ln,i,bits,str,bytes;function roundToEven(n){var w=floor(n),f2=n-w;return f2<.5?w:f2>.5||w%2?w+1:w}for(v!==v?(e=(1<<ebits)-1,f=pow(2,fbits-1),s=0):v===1/0||v===-1/0?(e=(1<<ebits)-1,f=0,s=v<0?1:0):v===0?(e=0,f=0,s=1/v===-1/0?1:0):(s=v<0,v=abs(v),v>=pow(2,1-bias)?(e=min(floor(log(v)/LN2),1023),f=roundToEven(v/pow(2,e)*pow(2,fbits)),f/pow(2,fbits)>=2&&(e=e+1,f=1),e>bias?(e=(1<<ebits)-1,f=0):(e=e+bias,f=f-pow(2,fbits))):(e=0,f=roundToEven(v/pow(2,1-bias-fbits)))),bits=[],i=fbits;i;i-=1)bits.push(f%2?1:0),f=floor(f/2);for(i=ebits;i;i-=1)bits.push(e%2?1:0),e=floor(e/2);for(bits.push(s?1:0),bits.reverse(),str=bits.join(""),bytes=[];str.length;)bytes.push(parseInt(str.substring(0,8),2)),str=str.substring(8);return bytes}function unpackIEEE754(bytes,ebits,fbits){var bits=[],i,j,b,str,bias,s,e,f;for(i=bytes.length;i;i-=1)for(b=bytes[i-1],j=8;j;j-=1)bits.push(b%2?1:0),b=b>>1;return bits.reverse(),str=bits.join(""),bias=(1<<ebits-1)-1,s=parseInt(str.substring(0,1),2)?-1:1,e=parseInt(str.substring(1,1+ebits),2),f=parseInt(str.substring(1+ebits),2),e===(1<<ebits)-1?f!==0?NaN:s*(1/0):e>0?s*pow(2,e-bias)*(1+f/pow(2,fbits)):f!==0?s*pow(2,-(bias-1))*(f/pow(2,fbits)):s<0?-0:0}function unpackF64(b){return unpackIEEE754(b,11,52)}function packF64(v){return packIEEE754(v,11,52)}function unpackF32(b){return unpackIEEE754(b,8,23)}function packF32(v){return packIEEE754(v,8,23)}(function(){var ArrayBuffer2=function(length){if(length=ECMAScript.ToInt32(length),length<0)throw new RangeError("ArrayBuffer size is not a small enough positive integer");this.byteLength=length,this._bytes=[],this._bytes.length=length;var i;for(i=0;i<this.byteLength;i+=1)this._bytes[i]=0;configureProperties(this)};exports2.ArrayBuffer=exports2.ArrayBuffer||ArrayBuffer2;var ArrayBufferView=function(){};function makeConstructor(bytesPerElement,pack,unpack){var ctor;return ctor=function(buffer,byteOffset,length){var array,sequence,i,s;if(!arguments.length||typeof arguments[0]=="number"){if(this.length=ECMAScript.ToInt32(arguments[0]),length<0)throw new RangeError("ArrayBufferView size is not a small enough positive integer");this.byteLength=this.length*this.BYTES_PER_ELEMENT,this.buffer=new ArrayBuffer2(this.byteLength),this.byteOffset=0}else if(typeof arguments[0]=="object"&&arguments[0].constructor===ctor)for(array=arguments[0],this.length=array.length,this.byteLength=this.length*this.BYTES_PER_ELEMENT,this.buffer=new ArrayBuffer2(this.byteLength),this.byteOffset=0,i=0;i<this.length;i+=1)this._setter(i,array._getter(i));else if(typeof arguments[0]=="object"&&!(arguments[0]instanceof ArrayBuffer2||ECMAScript.Class(arguments[0])==="ArrayBuffer"))for(sequence=arguments[0],this.length=ECMAScript.ToUint32(sequence.length),this.byteLength=this.length*this.BYTES_PER_ELEMENT,this.buffer=new ArrayBuffer2(this.byteLength),this.byteOffset=0,i=0;i<this.length;i+=1)s=sequence[i],this._setter(i,Number(s));else if(typeof arguments[0]=="object"&&(arguments[0]instanceof ArrayBuffer2||ECMAScript.Class(arguments[0])==="ArrayBuffer")){if(this.buffer=buffer,this.byteOffset=ECMAScript.ToUint32(byteOffset),this.byteOffset>this.buffer.byteLength)throw new RangeError("byteOffset out of range");if(this.byteOffset%this.BYTES_PER_ELEMENT)throw new RangeError("ArrayBuffer length minus the byteOffset is not a multiple of the element size.");if(arguments.length<3){if(this.byteLength=this.buffer.byteLength-this.byteOffset,this.byteLength%this.BYTES_PER_ELEMENT)throw new RangeError("length of buffer minus byteOffset not a multiple of the element size");this.length=this.byteLength/this.BYTES_PER_ELEMENT}else this.length=ECMAScript.ToUint32(length),this.byteLength=this.length*this.BYTES_PER_ELEMENT;if(this.byteOffset+this.byteLength>this.buffer.byteLength)throw new RangeError("byteOffset and length reference an area beyond the end of the buffer")}else throw new TypeError("Unexpected argument type(s)");this.constructor=ctor,configureProperties(this),makeArrayAccessors(this)},ctor.prototype=new ArrayBufferView,ctor.prototype.BYTES_PER_ELEMENT=bytesPerElement,ctor.prototype._pack=pack,ctor.prototype._unpack=unpack,ctor.BYTES_PER_ELEMENT=bytesPerElement,ctor.prototype._getter=function(index){if(arguments.length<1)throw new SyntaxError("Not enough arguments");if(index=ECMAScript.ToUint32(index),index>=this.length)return undefined2;var bytes=[],i,o;for(i=0,o=this.byteOffset+index*this.BYTES_PER_ELEMENT;i<this.BYTES_PER_ELEMENT;i+=1,o+=1)bytes.push(this.buffer._bytes[o]);return this._unpack(bytes)},ctor.prototype.get=ctor.prototype._getter,ctor.prototype._setter=function(index,value){if(arguments.length<2)throw new SyntaxError("Not enough arguments");if(index=ECMAScript.ToUint32(index),index>=this.length)return undefined2;var bytes=this._pack(value),i,o;for(i=0,o=this.byteOffset+index*this.BYTES_PER_ELEMENT;i<this.BYTES_PER_ELEMENT;i+=1,o+=1)this.buffer._bytes[o]=bytes[i]},ctor.prototype.set=function(index,value){if(arguments.length<1)throw new SyntaxError("Not enough arguments");var array,sequence,offset,len,i,s,d,byteOffset,byteLength,tmp;if(typeof arguments[0]=="object"&&arguments[0].constructor===this.constructor){if(array=arguments[0],offset=ECMAScript.ToUint32(arguments[1]),offset+array.length>this.length)throw new RangeError("Offset plus length of array is out of range");if(byteOffset=this.byteOffset+offset*this.BYTES_PER_ELEMENT,byteLength=array.length*this.BYTES_PER_ELEMENT,array.buffer===this.buffer){for(tmp=[],i=0,s=array.byteOffset;i<byteLength;i+=1,s+=1)tmp[i]=array.buffer._bytes[s];for(i=0,d=byteOffset;i<byteLength;i+=1,d+=1)this.buffer._bytes[d]=tmp[i]}else for(i=0,s=array.byteOffset,d=byteOffset;i<byteLength;i+=1,s+=1,d+=1)this.buffer._bytes[d]=array.buffer._bytes[s]}else if(typeof arguments[0]=="object"&&typeof arguments[0].length<"u"){if(sequence=arguments[0],len=ECMAScript.ToUint32(sequence.length),offset=ECMAScript.ToUint32(arguments[1]),offset+len>this.length)throw new RangeError("Offset plus length of array is out of range");for(i=0;i<len;i+=1)s=sequence[i],this._setter(offset+i,Number(s))}else throw new TypeError("Unexpected argument type(s)")},ctor.prototype.subarray=function(start,end){function clamp(v,min2,max){return v<min2?min2:v>max?max:v}start=ECMAScript.ToInt32(start),end=ECMAScript.ToInt32(end),arguments.length<1&&(start=0),arguments.length<2&&(end=this.length),start<0&&(start=this.length+start),end<0&&(end=this.length+end),start=clamp(start,0,this.length),end=clamp(end,0,this.length);var len=end-start;return len<0&&(len=0),new this.constructor(this.buffer,this.byteOffset+start*this.BYTES_PER_ELEMENT,len)},ctor}var Int8Array2=makeConstructor(1,packI8,unpackI8),Uint8Array2=makeConstructor(1,packU8,unpackU8),Uint8ClampedArray2=makeConstructor(1,packU8Clamped,unpackU8),Int16Array2=makeConstructor(2,packI16,unpackI16),Uint16Array2=makeConstructor(2,packU16,unpackU16),Int32Array2=makeConstructor(4,packI32,unpackI32),Uint32Array2=makeConstructor(4,packU32,unpackU32),Float32Array2=makeConstructor(4,packF32,unpackF32),Float64Array2=makeConstructor(8,packF64,unpackF64);exports2.Int8Array=exports2.Int8Array||Int8Array2,exports2.Uint8Array=exports2.Uint8Array||Uint8Array2,exports2.Uint8ClampedArray=exports2.Uint8ClampedArray||Uint8ClampedArray2,exports2.Int16Array=exports2.Int16Array||Int16Array2,exports2.Uint16Array=exports2.Uint16Array||Uint16Array2,exports2.Int32Array=exports2.Int32Array||Int32Array2,exports2.Uint32Array=exports2.Uint32Array||Uint32Array2,exports2.Float32Array=exports2.Float32Array||Float32Array2,exports2.Float64Array=exports2.Float64Array||Float64Array2})();(function(){function r(array,index){return ECMAScript.IsCallable(array.get)?array.get(index):array[index]}var IS_BIG_ENDIAN=(function(){var u16array=new exports2.Uint16Array([4660]),u8array=new exports2.Uint8Array(u16array.buffer);return r(u8array,0)===18})(),DataView2=function(buffer,byteOffset,byteLength){if(arguments.length===0)buffer=new exports2.ArrayBuffer(0);else if(!(buffer instanceof exports2.ArrayBuffer||ECMAScript.Class(buffer)==="ArrayBuffer"))throw new TypeError("TypeError");if(this.buffer=buffer||new exports2.ArrayBuffer(0),this.byteOffset=ECMAScript.ToUint32(byteOffset),this.byteOffset>this.buffer.byteLength)throw new RangeError("byteOffset out of range");if(arguments.length<3?this.byteLength=this.buffer.byteLength-this.byteOffset:this.byteLength=ECMAScript.ToUint32(byteLength),this.byteOffset+this.byteLength>this.buffer.byteLength)throw new RangeError("byteOffset and length reference an area beyond the end of the buffer");configureProperties(this)};function makeGetter(arrayType){return function(byteOffset,littleEndian){if(byteOffset=ECMAScript.ToUint32(byteOffset),byteOffset+arrayType.BYTES_PER_ELEMENT>this.byteLength)throw new RangeError("Array index out of range");byteOffset+=this.byteOffset;var uint8Array=new exports2.Uint8Array(this.buffer,byteOffset,arrayType.BYTES_PER_ELEMENT),bytes=[],i;for(i=0;i<arrayType.BYTES_PER_ELEMENT;i+=1)bytes.push(r(uint8Array,i));return!!littleEndian==!!IS_BIG_ENDIAN&&bytes.reverse(),r(new arrayType(new exports2.Uint8Array(bytes).buffer),0)}}DataView2.prototype.getUint8=makeGetter(exports2.Uint8Array),DataView2.prototype.getInt8=makeGetter(exports2.Int8Array),DataView2.prototype.getUint16=makeGetter(exports2.Uint16Array),DataView2.prototype.getInt16=makeGetter(exports2.Int16Array),DataView2.prototype.getUint32=makeGetter(exports2.Uint32Array),DataView2.prototype.getInt32=makeGetter(exports2.Int32Array),DataView2.prototype.getFloat32=makeGetter(exports2.Float32Array),DataView2.prototype.getFloat64=makeGetter(exports2.Float64Array);function makeSetter(arrayType){return function(byteOffset,value,littleEndian){if(byteOffset=ECMAScript.ToUint32(byteOffset),byteOffset+arrayType.BYTES_PER_ELEMENT>this.byteLength)throw new RangeError("Array index out of range");var typeArray=new arrayType([value]),byteArray=new exports2.Uint8Array(typeArray.buffer),bytes=[],i,byteView;for(i=0;i<arrayType.BYTES_PER_ELEMENT;i+=1)bytes.push(r(byteArray,i));!!littleEndian==!!IS_BIG_ENDIAN&&bytes.reverse(),byteView=new exports2.Uint8Array(this.buffer,byteOffset,arrayType.BYTES_PER_ELEMENT),byteView.set(bytes)}}DataView2.prototype.setUint8=makeSetter(exports2.Uint8Array),DataView2.prototype.setInt8=makeSetter(exports2.Int8Array),DataView2.prototype.setUint16=makeSetter(exports2.Uint16Array),DataView2.prototype.setInt16=makeSetter(exports2.Int16Array),DataView2.prototype.setUint32=makeSetter(exports2.Uint32Array),DataView2.prototype.setInt32=makeSetter(exports2.Int32Array),DataView2.prototype.setFloat32=makeSetter(exports2.Float32Array),DataView2.prototype.setFloat64=makeSetter(exports2.Float64Array),exports2.DataView=exports2.DataView||DataView2})()}});var require_concat_stream=__commonJS({"node_modules/multer/node_modules/concat-stream/index.js"(exports2,module2){var Writable=require_readable().Writable,inherits=require_inherits(),bufferFrom=require_buffer_from();typeof Uint8Array>"u"?U8=require_typedarray().Uint8Array:U8=Uint8Array;var U8;function ConcatStream(opts,cb){if(!(this instanceof ConcatStream))return new ConcatStream(opts,cb);typeof opts=="function"&&(cb=opts,opts={}),opts||(opts={});var encoding=opts.encoding,shouldInferEncoding=!1;encoding?(encoding=String(encoding).toLowerCase(),(encoding==="u8"||encoding==="uint8")&&(encoding="uint8array")):shouldInferEncoding=!0,Writable.call(this,{objectMode:!0}),this.encoding=encoding,this.shouldInferEncoding=shouldInferEncoding,cb&&this.on("finish",function(){cb(this.getBody())}),this.body=[]}module2.exports=ConcatStream;inherits(ConcatStream,Writable);ConcatStream.prototype._write=function(chunk,enc,next){this.body.push(chunk),next()};ConcatStream.prototype.inferEncoding=function(buff){var firstBuffer=buff===void 0?this.body[0]:buff;return Buffer.isBuffer(firstBuffer)?"buffer":typeof Uint8Array<"u"&&firstBuffer instanceof Uint8Array?"uint8array":Array.isArray(firstBuffer)?"array":typeof firstBuffer=="string"?"string":Object.prototype.toString.call(firstBuffer)==="[object Object]"?"object":"buffer"};ConcatStream.prototype.getBody=function(){return!this.encoding&&this.body.length===0?[]:(this.shouldInferEncoding&&(this.encoding=this.inferEncoding()),this.encoding==="array"?arrayConcat(this.body):this.encoding==="string"?stringConcat(this.body):this.encoding==="buffer"?bufferConcat(this.body):this.encoding==="uint8array"?u8Concat(this.body):this.body)};function isArrayish(arr){return/Array\]$/.test(Object.prototype.toString.call(arr))}function isBufferish(p){return typeof p=="string"||isArrayish(p)||p&&typeof p.subarray=="function"}function stringConcat(parts){for(var strings=[],needsToString=!1,i=0;i<parts.length;i++){var p=parts[i];typeof p=="string"||Buffer.isBuffer(p)?strings.push(p):isBufferish(p)?strings.push(bufferFrom(p)):strings.push(bufferFrom(String(p)))}return Buffer.isBuffer(parts[0])?(strings=Buffer.concat(strings),strings=strings.toString("utf8")):strings=strings.join(""),strings}function bufferConcat(parts){for(var bufs=[],i=0;i<parts.length;i++){var p=parts[i];Buffer.isBuffer(p)?bufs.push(p):isBufferish(p)?bufs.push(bufferFrom(p)):bufs.push(bufferFrom(String(p)))}return Buffer.concat(bufs)}function arrayConcat(parts){for(var res=[],i=0;i<parts.length;i++)res.push.apply(res,parts[i]);return res}function u8Concat(parts){for(var len=0,i=0;i<parts.length;i++)typeof parts[i]=="string"&&(parts[i]=bufferFrom(parts[i])),len+=parts[i].length;for(var u8=new U8(len),i=0,offset=0;i<parts.length;i++)for(var part=parts[i],j=0;j<part.length;j++)u8[offset++]=part[j];return u8}}});var require_memory=__commonJS({"node_modules/multer/storage/memory.js"(exports2,module2){var concat=require_concat_stream();function MemoryStorage(opts){}MemoryStorage.prototype._handleFile=function(req,file,cb){file.stream.pipe(concat({encoding:"buffer"},function(data){cb(null,{buffer:data,size:data.length})}))};MemoryStorage.prototype._removeFile=function(req,file,cb){delete file.buffer,cb(null)};module2.exports=function(opts){return new MemoryStorage(opts)}}});var require_multer=__commonJS({"node_modules/multer/index.js"(exports2,module2){var makeMiddleware=require_make_middleware(),diskStorage=require_disk(),memoryStorage=require_memory(),MulterError=require_multer_error();function allowAll(req,file,cb){cb(null,!0)}function Multer(options){options.storage?this.storage=options.storage:options.dest?this.storage=diskStorage({destination:options.dest}):this.storage=memoryStorage(),this.limits=options.limits,this.preservePath=options.preservePath,this.defParamCharset=options.defParamCharset||"latin1",this.fileFilter=options.fileFilter||allowAll}Multer.prototype._makeMiddleware=function(fields,fileStrategy){function setup(){var fileFilter=this.fileFilter,filesLeft=Object.create(null);fields.forEach(function(field){typeof field.maxCount=="number"?filesLeft[field.name]=field.maxCount:filesLeft[field.name]=1/0});function wrappedFileFilter(req,file,cb){if((filesLeft[file.fieldname]||0)<=0)return cb(new MulterError("LIMIT_UNEXPECTED_FILE",file.fieldname));filesLeft[file.fieldname]-=1,fileFilter(req,file,cb)}return{limits:this.limits,preservePath:this.preservePath,defParamCharset:this.defParamCharset,storage:this.storage,fileFilter:wrappedFileFilter,fileStrategy}}return makeMiddleware(setup.bind(this))};Multer.prototype.single=function(name){return this._makeMiddleware([{name,maxCount:1}],"VALUE")};Multer.prototype.array=function(name,maxCount){return this._makeMiddleware([{name,maxCount}],"ARRAY")};Multer.prototype.fields=function(fields){return this._makeMiddleware(fields,"OBJECT")};Multer.prototype.none=function(){return this._makeMiddleware([],"NONE")};Multer.prototype.any=function(){function setup(){return{limits:this.limits,preservePath:this.preservePath,defParamCharset:this.defParamCharset,storage:this.storage,fileFilter:this.fileFilter,fileStrategy:"ARRAY"}}return makeMiddleware(setup.bind(this))};function multer(options){if(options===void 0)return new Multer({});if(typeof options=="object"&&options!==null)return new Multer(options);throw new TypeError("Expected object for argument options")}module2.exports=multer;module2.exports.diskStorage=diskStorage;module2.exports.memoryStorage=memoryStorage;module2.exports.MulterError=MulterError}});var require_ua_parser=__commonJS({"node_modules/ua-parser-js/src/main/ua-parser.js"(exports2,module2){(function(window2,undefined2){"use strict";var LIBVERSION="2.0.10",UA_MAX_LENGTH=500,USER_AGENT="user-agent",EMPTY="",UNKNOWN="?",TYPEOF={FUNCTION:"function",OBJECT:"object",STRING:"string",UNDEFINED:"undefined"},BROWSER="browser",CPU="cpu",DEVICE="device",ENGINE="engine",OS="os",RESULT="result",NAME="name",TYPE="type",VENDOR="vendor",VERSION="version",ARCHITECTURE="architecture",MAJOR="major",MODEL="model",CONSOLE="console",MOBILE="mobile",TABLET="tablet",SMARTTV="smarttv",WEARABLE="wearable",XR="xr",EMBEDDED="embedded",FETCHER="fetcher",INAPP="inapp",BRANDS="brands",FORMFACTORS="formFactors",FULLVERLIST="fullVersionList",PLATFORM="platform",PLATFORMVER="platformVersion",BITNESS="bitness",CH="sec-ch-ua",CH_FULL_VER_LIST=CH+"-full-version-list",CH_ARCH=CH+"-arch",CH_BITNESS=CH+"-"+BITNESS,CH_FORM_FACTORS=CH+"-form-factors",CH_MOBILE=CH+"-"+MOBILE,CH_MODEL=CH+"-"+MODEL,CH_PLATFORM=CH+"-"+PLATFORM,CH_PLATFORM_VER=CH_PLATFORM+"-version",CH_ALL_VALUES=[BRANDS,FULLVERLIST,MOBILE,MODEL,PLATFORM,PLATFORMVER,ARCHITECTURE,FORMFACTORS,BITNESS],AMAZON="Amazon",APPLE="Apple",ASUS="ASUS",BLACKBERRY="BlackBerry",GOOGLE="Google",HUAWEI="Huawei",LENOVO="Lenovo",HONOR="Honor",LG="LG",MICROSOFT="Microsoft",MOTOROLA="Motorola",NVIDIA="Nvidia",ONEPLUS="OnePlus",OPPO="OPPO",SAMSUNG="Samsung",SHARP="Sharp",SONY="Sony",XIAOMI="Xiaomi",ZEBRA="Zebra",CHROME="Chrome",CHROMIUM="Chromium",CHROMECAST="Chromecast",EDGE="Edge",FIREFOX="Firefox",OPERA="Opera",FACEBOOK="Facebook",SOGOU="Sogou",PREFIX_MOBILE="Mobile ",SUFFIX_BROWSER=" Browser",WINDOWS="Windows",isWindow=typeof window2!==TYPEOF.UNDEFINED,NAVIGATOR=isWindow&&window2.navigator?window2.navigator:undefined2,NAVIGATOR_UADATA=NAVIGATOR&&NAVIGATOR.userAgentData?NAVIGATOR.userAgentData:undefined2,extend=function(defaultRgx,extensions){var mergedRgx={},extraRgx=extensions;if(!isExtensions(extensions)){extraRgx={};for(var i in extensions)for(var j in extensions[i])extraRgx[j]=extensions[i][j].concat(extraRgx[j]?extraRgx[j]:[])}for(var k in defaultRgx)mergedRgx[k]=extraRgx[k]&&extraRgx[k].length%2===0?extraRgx[k].concat(defaultRgx[k]):defaultRgx[k];return mergedRgx},enumerize=function(arr){for(var enums={},i=0;i<arr.length;i++)enums[arr[i].toUpperCase()]=arr[i];return enums},has=function(str1,str2){if(typeof str1===TYPEOF.OBJECT&&str1.length>0){for(var i in str1)if(lowerize(str2)==lowerize(str1[i]))return!0;return!1}return isString(str1)?lowerize(str2)==lowerize(str1):!1},isExtensions=function(obj,deep){for(var prop in obj)return/^(browser|cpu|device|engine|os)$/.test(prop)||(deep?isExtensions(obj[prop]):!1)},isString=function(val){return typeof val===TYPEOF.STRING},itemListToArray=function(header){if(!header)return undefined2;for(var arr=[],tokens=normalizeHeaderValue(header).split(","),i=0;i<tokens.length;i++)if(tokens[i].indexOf(";")>-1){var token=trim(tokens[i]).split(";v=");arr[i]={brand:token[0],version:token[1]}}else arr[i]=trim(tokens[i]);return arr},lowerize=function(str){return isString(str)?str.toLowerCase():str},majorize=function(version){return isString(version)?strip(/[^\d\.]/g,version).split(".")[0]:undefined2},normalizeHeaderValue=function(str){return isString(str)?trim(strip(/\\?\"/g,str),UA_MAX_LENGTH):undefined2},setProps=function(arr){for(var i in arr)if(arr.hasOwnProperty(i)){var propName=arr[i];typeof propName==TYPEOF.OBJECT&&propName.length==2?this[propName[0]]=propName[1]:this[propName]=undefined2}return this},strip=function(pattern,str){return isString(str)?str.replace(pattern,EMPTY):str},trim=function(str,len){return str=strip(/^\s\s*/,String(str)),typeof len===TYPEOF.UNDEFINED?str:str.substring(0,len)},rgxMapper=function(ua,arrays){if(!(!ua||!arrays))for(var i=0,j,k,p,q,matches,match;i<arrays.length&&!matches;){var regex=arrays[i],props=arrays[i+1];for(j=k=0;j<regex.length&&!matches&®ex[j];)if(matches=regex[j++].exec(ua),matches)for(p=0;p<props.length;p++)match=matches[++k],q=props[p],typeof q===TYPEOF.OBJECT&&q.length>0?q.length===2?typeof q[1]==TYPEOF.FUNCTION?this[q[0]]=q[1].call(this,match):this[q[0]]=q[1]:q.length>=3&&(typeof q[1]===TYPEOF.FUNCTION&&!(q[1].exec&&q[1].test)?q.length>3?this[q[0]]=match?q[1].apply(this,q.slice(2)):undefined2:this[q[0]]=match?q[1].call(this,match,q[2]):undefined2:q.length==3?this[q[0]]=match?match.replace(q[1],q[2]):undefined2:q.length==4?this[q[0]]=match?q[3].call(this,match.replace(q[1],q[2])):undefined2:q.length>4&&(this[q[0]]=match?q[3].apply(this,[match.replace(q[1],q[2])].concat(q.slice(4))):undefined2)):this[q]=match||undefined2;i+=2}},strTest=function(str,map){return map.test.test(str)?map.ifTrue:map.ifFalse},strMapper=function(str,map){for(var i in map)if(typeof map[i]===TYPEOF.OBJECT&&map[i].length>0){for(var j=0;j<map[i].length;j++)if(has(map[i][j],str))return i===UNKNOWN?undefined2:i}else if(has(map[i],str))return i===UNKNOWN?undefined2:i;return map.hasOwnProperty("*")?map["*"]:str},windowsVersionMap={ME:"4.90","NT 3.51":"3.51","NT 4.0":"4.0",2e3:["5.0","5.01"],XP:["5.1","5.2"],Vista:"6.0",7:"6.1",8:"6.2","8.1":"6.3",10:["6.4","10.0"],NT:""},formFactorsMap={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":undefined2},browserHintsMap={Chrome:"Google Chrome",Edge:"Microsoft Edge","Edge WebView2":"Microsoft Edge WebView2","Chrome WebView":"Android WebView","Chrome Headless":"HeadlessChrome","Huawei Browser":"HuaweiBrowser","MIUI Browser":"Miui Browser","Opera Mobi":"OperaMobile",Yandex:"YaBrowser"},defaultRegexes={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[VERSION,[NAME,PREFIX_MOBILE+"Chrome"]],[/webview.+edge\/([\w\.]+)/i],[VERSION,[NAME,EDGE+" WebView"],[TYPE,INAPP]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[VERSION,[NAME,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[NAME,VERSION],[/opios[\/ ]+([\w\.]+)/i],[VERSION,[NAME,OPERA+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[VERSION,[NAME,OPERA+" GX"]],[/\bopr\/([\w\.]+)/i],[VERSION,[NAME,OPERA]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[VERSION,[NAME,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[VERSION,[NAME,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(atlas|flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:hi|lg |ovi|qute)browser|palemoon)\/v?([-\w\.]+)/i,/(brave)(?: chrome)?\/([\d\.]+)/i,/(aloha|heytap|ovi|115|surf|qwant)browser\/([\d\.]+)/i,/(qwant)(?:ios|mobile)\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[NAME,VERSION],[/quark(?:pc)?\/([-\w\.]+)/i],[VERSION,[NAME,"Quark"]],[/\bddg\/([\w\.]+)/i],[VERSION,[NAME,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb| ucpc)[\/ ]?([\w\.]+)/i],[VERSION,[NAME,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[VERSION,[NAME,"WeChat"]],[/konqueror\/([\w\.]+)/i],[VERSION,[NAME,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[VERSION,[NAME,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[VERSION,[NAME,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[VERSION,[NAME,"Smart "+LENOVO+SUFFIX_BROWSER]],[/(av(?:ast|g|ira))\/([\w\.]+)/i],[[NAME,/(.+)/,"$1 Secure"+SUFFIX_BROWSER],VERSION],[/norton\/([\w\.]+)/i],[VERSION,[NAME,"Norton Private"+SUFFIX_BROWSER]],[/\bfocus\/([\w\.]+)/i],[VERSION,[NAME,FIREFOX+" Focus"]],[/ mms\/([\w\.]+)$/i],[VERSION,[NAME,OPERA+" Neon"]],[/ opt\/([\w\.]+)$/i],[VERSION,[NAME,OPERA+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[VERSION,[NAME,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[VERSION,[NAME,"Dolphin"]],[/coast\/([\w\.]+)/i],[VERSION,[NAME,OPERA+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[VERSION,[NAME,"MIUI"+SUFFIX_BROWSER]],[/fxios\/([\w\.-]+)/i],[VERSION,[NAME,PREFIX_MOBILE+FIREFOX]],[/\bqihoobrowser\/?([\w\.]*)/i],[VERSION,[NAME,"360"]],[/\b(qq)\/([\w\.]+)/i],[[NAME,/(.+)/,"$1Browser"],VERSION],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[NAME,/(.+)/,"$1"+SUFFIX_BROWSER],VERSION],[/ HBPC\/([\w\.]+)/],[VERSION,[NAME,HUAWEI+SUFFIX_BROWSER]],[/samsungbrowser\/([\w\.]+)/i],[VERSION,[NAME,SAMSUNG+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[VERSION,[NAME,SOGOU+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[NAME,SOGOU+" Mobile"],VERSION],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[NAME,VERSION],[/(lbbrowser|luakit|rekonq|steam(?= (clie|tenf|gameo)))/i],[NAME],[/ome\/([\w\.]+).+(iron(?= saf)|360(?=[es]e$))/i],[VERSION,NAME],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[NAME,FACEBOOK],VERSION,[TYPE,INAPP]],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(bing)(?:web|sapphire)\/([\w\.]+)/i,/(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i],[NAME,VERSION,[TYPE,INAPP]],[/\bgsa\/([\w\.]+) .*safari\//i],[VERSION,[NAME,"GSA"],[TYPE,INAPP]],[/(?:musical_ly|trill)(?:.+app_?version\/|_)([\w\.]+)/i],[VERSION,[NAME,"TikTok"],[TYPE,INAPP]],[/\[(linkedin)app\]/i],[NAME,[TYPE,INAPP]],[/(zalo(?:app)?)[\/\sa-z]*([\w\.-]+)/i],[[NAME,/(.+)/,"Zalo"],VERSION,[TYPE,INAPP]],[/(chromium)[\/ ]([-\w\.]+)/i],[NAME,VERSION],[/ome-(lighthouse)$/i],[NAME,[TYPE,FETCHER]],[/headlesschrome(?:\/([\w\.]+)| )/i],[VERSION,[NAME,CHROME+" Headless"]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[VERSION,[NAME,EDGE+" WebView2"],[TYPE,INAPP]],[/; wv\).+(chrome)\/([\w\.]+)/i],[[NAME,CHROME+" WebView"],VERSION,[TYPE,INAPP]],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[VERSION,[NAME,"Android"+SUFFIX_BROWSER]],[/chrome\/([\w\.]+) mobile/i],[VERSION,[NAME,PREFIX_MOBILE+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[NAME,VERSION],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[VERSION,[NAME,PREFIX_MOBILE+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[NAME,PREFIX_MOBILE+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[VERSION,NAME],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[NAME,[VERSION,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[NAME,VERSION],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[NAME,PREFIX_MOBILE+FIREFOX],VERSION],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[NAME,"Netscape"],VERSION],[/(wolvic|librewolf)\/([\w\.]+)/i],[NAME,VERSION],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[VERSION,[NAME,FIREFOX+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+(?= .+rv\:.+gecko\/\d+)|[0-4][\w\.]+(?!.+compatible))/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[NAME,[VERSION,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[NAME,[VERSION,/[^\d\.]+./,EMPTY]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[ARCHITECTURE,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[ARCHITECTURE,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[ARCHITECTURE,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[ARCHITECTURE,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[ARCHITECTURE,"arm"]],[/ sun4\w[;\)]/i],[[ARCHITECTURE,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i,/((ppc|powerpc)(64)?)( mac|;|\))/i,/(?:osf1|[freopnt]{3,4}bsd) (alpha)/i],[[ARCHITECTURE,/ower/,EMPTY,lowerize]],[/mc680.0/i],[[ARCHITECTURE,"68k"]],[/winnt.+\[axp/i],[[ARCHITECTURE,"alpha"]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[MODEL,[VENDOR,SAMSUNG],[TYPE,TABLET]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,/sec-(sgh\w+)/i],[MODEL,[VENDOR,SAMSUNG],[TYPE,MOBILE]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)[\/\);]/i],[MODEL,[VENDOR,APPLE],[TYPE,MOBILE]],[/\b(?:ios|apple\w+)\/.+[\(\/](ipad)/i,/\b(ipad)[\d,]*[;\] ].+(mac |i(pad)?)os/i],[MODEL,[VENDOR,APPLE],[TYPE,TABLET]],[/(macintosh);/i],[MODEL,[VENDOR,APPLE]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[MODEL,[VENDOR,SHARP],[TYPE,MOBILE]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[MODEL,[VENDOR,HONOR],[TYPE,TABLET]],[/honor([-\w ]+)[;\)]/i],[MODEL,[VENDOR,HONOR],[TYPE,MOBILE]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[MODEL,[VENDOR,HUAWEI],[TYPE,TABLET]],[/(?:huawei) ?([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][\dc][adnt]?)\b(?!.+d\/s)/i],[MODEL,[VENDOR,HUAWEI],[TYPE,MOBILE]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b(?:xiao)?((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[MODEL,/_/g," "],[VENDOR,XIAOMI],[TYPE,TABLET]],[/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/oid[^\)]+; (redmi[\-_ ]?(?:note|k)?[\w_ ]+|m?[12]\d[01]\d\w{3,6}|poco[\w ]+|(shark )?\w{3}-[ah]0|qin ?[1-3](s\+|ultra| pro)?)( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note|max|cc)?[_ ]?(?:\d{0,2}\w?)[_ ]?(?:plus|se|lite|pro)?( 5g|lte)?)(?: bui|\))/i,/; ([\w ]+) miui\/v?\d/i],[[MODEL,/_/g," "],[VENDOR,XIAOMI],[TYPE,MOBILE]],[/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-l]\w[1m]10)\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[MODEL,[VENDOR,ONEPLUS],[TYPE,MOBILE]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[MODEL,[VENDOR,OPPO],[TYPE,MOBILE]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[MODEL,[VENDOR,strMapper,{OnePlus:["203","304","403","404","413","415"],"*":OPPO}],[TYPE,TABLET]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[MODEL,[VENDOR,"BLU"],[TYPE,MOBILE]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[MODEL,[VENDOR,"Vivo"],[TYPE,MOBILE]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[MODEL,[VENDOR,"Realme"],[TYPE,MOBILE]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[MODEL,[VENDOR,LENOVO],[TYPE,TABLET]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[MODEL,[VENDOR,LENOVO],[TYPE,MOBILE]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,/((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i],[MODEL,[VENDOR,MOTOROLA],[TYPE,MOBILE]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[MODEL,[VENDOR,MOTOROLA],[TYPE,TABLET]],[/\b(?:lg)?([vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[MODEL,[VENDOR,LG],[TYPE,TABLET]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[MODEL,[VENDOR,LG],[TYPE,MOBILE]],[/(nokia) (t[12][01])/i],[VENDOR,MODEL,[TYPE,TABLET]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*?))( bui|\)|;|\/)/i],[[MODEL,/_/g," "],[TYPE,MOBILE],[VENDOR,"Nokia"]],[/(pixel (c|tablet))\b/i],[MODEL,[VENDOR,GOOGLE],[TYPE,TABLET]],[/droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i],[MODEL,[VENDOR,GOOGLE],[TYPE,MOBILE]],[/(google) (pixelbook( go)?)/i],[VENDOR,MODEL],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[MODEL,[VENDOR,SONY],[TYPE,MOBILE]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[MODEL,"Xperia Tablet"],[VENDOR,SONY],[TYPE,TABLET]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[MODEL,[VENDOR,AMAZON],[TYPE,TABLET]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[MODEL,/(.+)/g,"Fire Phone $1"],[VENDOR,AMAZON],[TYPE,MOBILE]],[/(playbook);[-\w\),; ]+(rim)/i],[MODEL,VENDOR,[TYPE,TABLET]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/(?:blackberry|\(bb10;) (\w+)/i],[MODEL,[VENDOR,BLACKBERRY],[TYPE,MOBILE]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[MODEL,[VENDOR,ASUS],[TYPE,TABLET]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[MODEL,[VENDOR,ASUS],[TYPE,MOBILE]],[/(nexus 9)/i],[MODEL,[VENDOR,"HTC"],[TYPE,TABLET]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[VENDOR,[MODEL,/_/g," "],[TYPE,MOBILE]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[MODEL,[VENDOR,"TCL"],[TYPE,TABLET]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[MODEL,[VENDOR,"TCL"],[TYPE,MOBILE]],[/(itel) ((\w+))/i],[[VENDOR,lowerize],MODEL,[TYPE,strMapper,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[MODEL,[VENDOR,"Acer"],[TYPE,TABLET]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[MODEL,[VENDOR,"Meizu"],[TYPE,MOBILE]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[MODEL,[VENDOR,"Ulefone"],[TYPE,MOBILE]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[MODEL,[VENDOR,"Energizer"],[TYPE,MOBILE]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[MODEL,[VENDOR,"Cat"],[TYPE,MOBILE]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[MODEL,[VENDOR,"Smartfren"],[TYPE,MOBILE]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[MODEL,[VENDOR,"Nothing"],[TYPE,MOBILE]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[MODEL,[VENDOR,"Archos"],[TYPE,TABLET]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[MODEL,[VENDOR,"Archos"],[TYPE,MOBILE]],[/blackview ([-\w ]+)( b|\))/i,/; (bv\d{4}[-\w ]*)( b|\))/i],[MODEL,[VENDOR,"Blackview"],[TYPE,MOBILE]],[/; (n159v)/i],[MODEL,[VENDOR,"HMD"],[TYPE,MOBILE]],[/((revvl[ \w\+]+|tm(?:rv|af)\w*[45]g(?:tb)?))( b|\))/i],[MODEL,[TYPE,strTest,{test:/ta?b/i,ifTrue:TABLET,ifFalse:MOBILE}],[VENDOR,"T-Mobile"]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[VENDOR,MODEL,[TYPE,TABLET]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|coolpad|cubot|hmd|imo|infinix|lava|oneplus|tcl|wiko)[_ ]([-\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(oppo) ?([\w ]+) bui/i,/(hisense) ([ehv][\w ]+)\)/i,/droid[^;]+; (philips)[_ ]([sv-x][\d]{3,4}[xz]?)/i],[VENDOR,MODEL,[TYPE,MOBILE]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[VENDOR,MODEL,[TYPE,TABLET]],[/(surface duo)/i],[MODEL,[VENDOR,MICROSOFT],[TYPE,TABLET]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[MODEL,[VENDOR,"Fairphone"],[TYPE,MOBILE]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[MODEL,[VENDOR,NVIDIA],[TYPE,TABLET]],[/(sprint) (\w+)/i],[VENDOR,MODEL,[TYPE,MOBILE]],[/(kin\.[onetw]{3})/i],[[MODEL,/\./g," "],[VENDOR,MICROSOFT],[TYPE,MOBILE]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[MODEL,[VENDOR,ZEBRA],[TYPE,TABLET]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[MODEL,[VENDOR,ZEBRA],[TYPE,MOBILE]],[/(philips)[\w ]+tv/i,/smart-tv.+(samsung)/i],[VENDOR,[TYPE,SMARTTV]],[/hbbtv.+maple;(\d+)/i],[[MODEL,/^/,"SmartTV"],[VENDOR,SAMSUNG],[TYPE,SMARTTV]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[VENDOR,MODEL,[TYPE,SMARTTV]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[VENDOR,LG],[TYPE,SMARTTV]],[/(apple) ?tv/i],[VENDOR,[MODEL,APPLE+" TV"],[TYPE,SMARTTV]],[/crkey.*devicetype\/chromecast/i],[[MODEL,CHROMECAST+" Third Generation"],[VENDOR,GOOGLE],[TYPE,SMARTTV]],[/crkey.*devicetype\/([^/]*)/i],[[MODEL,/^/,"Chromecast "],[VENDOR,GOOGLE],[TYPE,SMARTTV]],[/fuchsia.*crkey/i],[[MODEL,CHROMECAST+" Nest Hub"],[VENDOR,GOOGLE],[TYPE,SMARTTV]],[/crkey/i],[[MODEL,CHROMECAST],[VENDOR,GOOGLE],[TYPE,SMARTTV]],[/(portaltv)/i],[MODEL,[VENDOR,FACEBOOK],[TYPE,SMARTTV]],[/droid.+aft(\w+)( bui|\))/i],[MODEL,[VENDOR,AMAZON],[TYPE,SMARTTV]],[/(shield \w+ tv)/i],[MODEL,[VENDOR,NVIDIA],[TYPE,SMARTTV]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[MODEL,[VENDOR,SHARP],[TYPE,SMARTTV]],[/(bravia[\w ]+)( bui|\))/i],[MODEL,[VENDOR,SONY],[TYPE,SMARTTV]],[/(mi(tv|box)-?\w+) bui/i],[MODEL,[VENDOR,XIAOMI],[TYPE,SMARTTV]],[/Hbbtv.*(technisat) (.*);/i],[VENDOR,MODEL,[TYPE,SMARTTV]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[VENDOR,/.+\/(\w+)/,"$1",strMapper,{LG:"lge"}],[MODEL,trim],[TYPE,SMARTTV]],[/(playstation \w+)/i],[MODEL,[VENDOR,SONY],[TYPE,CONSOLE]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[MODEL,[VENDOR,MICROSOFT],[TYPE,CONSOLE]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i,/(valve).+(steam deck)/i,/droid.+; ((shield|rgcube|gr0006))( bui|\))/i],[[VENDOR,strMapper,{Nvidia:"Shield",Anbernic:"RGCUBE",Logitech:"GR0006"}],MODEL,[TYPE,CONSOLE]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[MODEL,[VENDOR,SAMSUNG],[TYPE,WEARABLE]],[/((pebble))app/i,/(asus|google|lg|oppo|xiaomi) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[VENDOR,MODEL,[TYPE,WEARABLE]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[MODEL,[VENDOR,OPPO],[TYPE,WEARABLE]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[MODEL,[VENDOR,APPLE],[TYPE,WEARABLE]],[/(opwwe\d{3})/i],[MODEL,[VENDOR,ONEPLUS],[TYPE,WEARABLE]],[/(moto 360)/i],[MODEL,[VENDOR,MOTOROLA],[TYPE,WEARABLE]],[/(smartwatch 3)/i],[MODEL,[VENDOR,SONY],[TYPE,WEARABLE]],[/(g watch r)/i],[MODEL,[VENDOR,LG],[TYPE,WEARABLE]],[/droid.+; (wt63?0{2,3})\)/i],[MODEL,[VENDOR,ZEBRA],[TYPE,WEARABLE]],[/droid.+; (glass) \d/i],[MODEL,[VENDOR,GOOGLE],[TYPE,XR]],[/(pico) ([\w ]+) os\d/i],[VENDOR,MODEL,[TYPE,XR]],[/(quest( \d| pro)?s?).+vr/i],[MODEL,[VENDOR,FACEBOOK],[TYPE,XR]],[/mobile vr; rv.+firefox/i],[[TYPE,XR]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[VENDOR,[TYPE,EMBEDDED]],[/(aeobc)\b/i],[MODEL,[VENDOR,AMAZON],[TYPE,EMBEDDED]],[/(homepod).+mac os/i],[MODEL,[VENDOR,APPLE],[TYPE,EMBEDDED]],[/windows iot/i],[[TYPE,EMBEDDED]],[/droid.+; ([\w- ]+) (4k|android|smart|google)[- ]?tv/i],[MODEL,[TYPE,SMARTTV]],[/\b((4k|android|smart|opera)[- ]?tv|tv; rv:|large screen[\w ]+safari)\b/i],[[TYPE,SMARTTV]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew|; hmsc).+?(mobile|vr|\d) safari/i],[MODEL,[TYPE,strMapper,{mobile:"Mobile",xr:"VR","*":TABLET}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[TYPE,TABLET]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[TYPE,MOBILE]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[MODEL,[VENDOR,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[VERSION,[NAME,EDGE+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[NAME,VERSION],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[VERSION,[NAME,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links|dillo)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[NAME,VERSION],[/ladybird\//i],[[NAME,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[VERSION,NAME]],os:[[/(windows nt) (6\.[23]); arm/i],[[NAME,/N/,"R"],[VERSION,strMapper,windowsVersionMap]],[/(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i,/(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i],[NAME,VERSION],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[VERSION,/(;|\))/g,"",strMapper,windowsVersionMap],[NAME,WINDOWS]],[/(windows ce)\/?([\d\.]*)/i],[NAME,VERSION],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv|ios(?=.+ip(?:ad|hone)|.+apple ?tv)|ip(?:ad|hone)(?: |.+i(?:pad)?)os|apple ?tv.+ios)[\/ ]([\w\.]+)/i,/\btvos ?([\w\.]+)/i,/cfnetwork\/.+darwin/i],[[VERSION,/_/g,"."],[NAME,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[NAME,"macOS"],[VERSION,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[VERSION,[NAME,CHROMECAST+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[VERSION,[NAME,CHROMECAST+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[VERSION,[NAME,CHROMECAST+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[VERSION,[NAME,CHROMECAST+" Linux"]],[/crkey\/([\d\.]+)/i],[VERSION,[NAME,CHROMECAST]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[VERSION,NAME],[/(ubuntu) ([\w\.]+) like android/i],[[NAME,/(.+)/,"$1 Touch"],VERSION],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[NAME,VERSION],[/\(bb(10);/i],[VERSION,[NAME,BLACKBERRY]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[VERSION,[NAME,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile[;\w ]*|tablet|tv|[^\)]*(?:viera|lg(?:l25|-d300)|alcatel ?o.+|y300-f1)); rv:([\w\.]+)\).+gecko\//i],[VERSION,[NAME,FIREFOX+" OS"]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[VERSION,[NAME,"webOS"]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[VERSION,strMapper,{25:"120",24:"108",23:"94",22:"87",6:"79",5:"68",4:"53",3:"38",2:"538",1:"537","*":"TV"}],[NAME,"webOS"]],[/watch(?: ?os[,\/ ]|\d,\d\/)([\d\.]+)/i],[VERSION,[NAME,"watchOS"]],[/cros [\w]+(?:\)| ([\w\.]+)\b)/i],[VERSION,[NAME,"Chrome OS"]],[/kepler ([\w\.]+); (aft|aeo)/i],[VERSION,[NAME,"Vega OS"]],[/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/linux.+(mint)[\/\(\) ]?([\w\.]*)/i,/(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/\b(aix)[; ]([1-9\.]{0,4})/i,/(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) ?(r\d)?/i],[NAME,VERSION],[/(sunos) ?([\d\.]*)/i],[[NAME,"Solaris"],VERSION],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[NAME,VERSION]]},defaultProps=(function(){var props={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return setProps.call(props.init,[[BROWSER,[NAME,VERSION,MAJOR,TYPE]],[CPU,[ARCHITECTURE]],[DEVICE,[TYPE,MODEL,VENDOR]],[ENGINE,[NAME,VERSION]],[OS,[NAME,VERSION]]]),setProps.call(props.isIgnore,[[BROWSER,[VERSION,MAJOR]],[ENGINE,[VERSION]],[OS,[VERSION]]]),setProps.call(props.isIgnoreRgx,[[BROWSER,/ ?browser$/i],[OS,/ ?os$/i]]),setProps.call(props.toString,[[BROWSER,[NAME,VERSION]],[CPU,[ARCHITECTURE]],[DEVICE,[VENDOR,MODEL]],[ENGINE,[NAME,VERSION]],[OS,[NAME,VERSION]]]),props})(),createIData=function(item,itemType){var init_props=defaultProps.init[itemType],is_ignoreProps=defaultProps.isIgnore[itemType]||0,is_ignoreRgx=defaultProps.isIgnoreRgx[itemType]||0,toString_props=defaultProps.toString[itemType]||0;function IData(){setProps.call(this,init_props)}return IData.prototype.getItem=function(){return item},IData.prototype.withClientHints=function(){return NAVIGATOR_UADATA?NAVIGATOR_UADATA.getHighEntropyValues(CH_ALL_VALUES).then(function(res){return item.setCH(new UACHData(res,!1)).parseCH().get()}):item.parseCH().get()},IData.prototype.withFeatureCheck=function(){return item.detectFeature().get()},itemType!=RESULT&&(IData.prototype.is=function(strToCheck){var is=!1;for(var i in this)if(this.hasOwnProperty(i)&&!has(is_ignoreProps,i)&&lowerize(is_ignoreRgx?strip(is_ignoreRgx,this[i]):this[i])==lowerize(is_ignoreRgx?strip(is_ignoreRgx,strToCheck):strToCheck)){if(is=!0,strToCheck!=TYPEOF.UNDEFINED)break}else if(strToCheck==TYPEOF.UNDEFINED&&is){is=!is;break}return is},IData.prototype.toString=function(){var str=EMPTY;for(var i in toString_props)typeof this[toString_props[i]]!==TYPEOF.UNDEFINED&&(str+=(str?" ":EMPTY)+this[toString_props[i]]);return str||TYPEOF.UNDEFINED}),IData.prototype.then=function(cb){var that=this,IDataResolve=function(){for(var prop in that)that.hasOwnProperty(prop)&&(this[prop]=that[prop])};IDataResolve.prototype={is:IData.prototype.is,toString:IData.prototype.toString,withClientHints:IData.prototype.withClientHints,withFeatureCheck:IData.prototype.withFeatureCheck};var resolveData=new IDataResolve;return cb(resolveData),resolveData},new IData};function UACHData(uach,isHttpUACH){if(uach=uach||{},setProps.call(this,CH_ALL_VALUES),isHttpUACH)setProps.call(this,[[BRANDS,itemListToArray(uach[CH])],[FULLVERLIST,itemListToArray(uach[CH_FULL_VER_LIST])],[MOBILE,/\?1/.test(uach[CH_MOBILE])],[MODEL,normalizeHeaderValue(uach[CH_MODEL])],[PLATFORM,normalizeHeaderValue(uach[CH_PLATFORM])],[PLATFORMVER,normalizeHeaderValue(uach[CH_PLATFORM_VER])],[ARCHITECTURE,normalizeHeaderValue(uach[CH_ARCH])],[FORMFACTORS,itemListToArray(uach[CH_FORM_FACTORS])],[BITNESS,normalizeHeaderValue(uach[CH_BITNESS])]]);else for(var prop in uach)this.hasOwnProperty(prop)&&typeof uach[prop]!==TYPEOF.UNDEFINED&&(this[prop]=uach[prop])}function UAItem(itemType,ua,rgxMap,uaCH){return setProps.call(this,[["itemType",itemType],["ua",ua],["uaCH",uaCH],["rgxMap",rgxMap],["data",createIData(this,itemType)]]),this}UAItem.prototype.get=function(prop){return prop?this.data.hasOwnProperty(prop)?this.data[prop]:undefined2:this.data},UAItem.prototype.set=function(prop,val){return this.data[prop]=val,this},UAItem.prototype.setCH=function(ch){return this.uaCH=ch,this},UAItem.prototype.detectFeature=function(){if(NAVIGATOR&&NAVIGATOR.userAgent==this.ua)switch(this.itemType){case BROWSER:NAVIGATOR.brave&&typeof NAVIGATOR.brave.isBrave==TYPEOF.FUNCTION&&this.set(NAME,"Brave");break;case DEVICE:!this.get(TYPE)&&NAVIGATOR_UADATA&&NAVIGATOR_UADATA[MOBILE]&&this.set(TYPE,MOBILE),this.get(MODEL)=="Macintosh"&&NAVIGATOR&&typeof NAVIGATOR.standalone!==TYPEOF.UNDEFINED&&NAVIGATOR.maxTouchPoints&&NAVIGATOR.maxTouchPoints>2&&this.set(MODEL,"iPad").set(TYPE,TABLET);break;case OS:!this.get(NAME)&&NAVIGATOR_UADATA&&NAVIGATOR_UADATA[PLATFORM]&&this.set(NAME,NAVIGATOR_UADATA[PLATFORM]);break;case RESULT:var data=this.data,detect=function(itemType){return data[itemType].getItem().detectFeature().get()};this.set(BROWSER,detect(BROWSER)).set(CPU,detect(CPU)).set(DEVICE,detect(DEVICE)).set(ENGINE,detect(ENGINE)).set(OS,detect(OS))}return this},UAItem.prototype.parseUA=function(){switch(this.itemType!=RESULT&&rgxMapper.call(this.data,this.ua,this.rgxMap),this.itemType){case BROWSER:this.set(MAJOR,majorize(this.get(VERSION)));break;case OS:if(this.get(NAME)=="iOS"&&this.get(VERSION)&&/^1[89][^\d]/.exec(this.get(VERSION))){var realVersion=/\) Version\/((\d+)[\d\.]*)/.exec(this.ua);realVersion&&parseInt(realVersion[2],10)>=26&&this.set(VERSION,realVersion[1])}break}return this},UAItem.prototype.parseCH=function(){var uaCH=this.uaCH,rgxMap=this.rgxMap;switch(this.itemType){case BROWSER:case ENGINE:var brands=uaCH[FULLVERLIST]||uaCH[BRANDS],prevName;if(brands)for(var i=0;i<brands.length;i++){var brandName=brands[i].brand||brands[i],brandVersion=brands[i].version;this.itemType==BROWSER&&!/not.a.brand/i.test(brandName)&&(!prevName||/Chrom/.test(prevName)&&brandName!=CHROMIUM||prevName==EDGE&&/WebView2/.test(brandName))&&(brandName=strMapper(brandName,browserHintsMap),prevName=this.get(NAME),prevName&&!/Chrom/.test(prevName)&&/Chrom/.test(brandName)||this.set(NAME,brandName).set(VERSION,brandVersion).set(MAJOR,majorize(brandVersion)),prevName=brandName),this.itemType==ENGINE&&brandName==CHROMIUM&&this.set(VERSION,brandVersion)}break;case CPU:var archName=uaCH[ARCHITECTURE];archName&&(archName&&uaCH[BITNESS]=="64"&&(archName+="64"),rgxMapper.call(this.data,archName+";",rgxMap));break;case DEVICE:if(uaCH[MOBILE]&&this.set(TYPE,MOBILE),uaCH[MODEL]&&(this.set(MODEL,uaCH[MODEL]),!this.get(TYPE)||!this.get(VENDOR))){var reParse={};rgxMapper.call(reParse,"droid 9; "+uaCH[MODEL]+")",rgxMap),!this.get(TYPE)&&reParse.type&&this.set(TYPE,reParse.type),!this.get(VENDOR)&&reParse.vendor&&this.set(VENDOR,reParse.vendor)}if(uaCH[FORMFACTORS]){var ff;if(typeof uaCH[FORMFACTORS]!="string")for(var idx=0;!ff&&idx<uaCH[FORMFACTORS].length;)ff=strMapper(uaCH[FORMFACTORS][idx++],formFactorsMap);else ff=strMapper(uaCH[FORMFACTORS],formFactorsMap);this.set(TYPE,ff)}break;case OS:var osName=uaCH[PLATFORM];if(osName){var osVersion=uaCH[PLATFORMVER];osName==WINDOWS&&(osVersion=parseInt(majorize(osVersion),10)>=13?"11":"10"),this.set(NAME,osName).set(VERSION,osVersion)}this.get(NAME)==WINDOWS&&uaCH[MODEL]=="Xbox"&&this.set(NAME,"Xbox").set(VERSION,undefined2);break;case RESULT:var data=this.data,parse=function(itemType){return data[itemType].getItem().setCH(uaCH).parseCH().get()};this.set(BROWSER,parse(BROWSER)).set(CPU,parse(CPU)).set(DEVICE,parse(DEVICE)).set(ENGINE,parse(ENGINE)).set(OS,parse(OS))}return this};function UAParser(ua,extensions,headers){if(typeof ua===TYPEOF.OBJECT?(isExtensions(ua,!0)?(typeof extensions===TYPEOF.OBJECT&&(headers=extensions),extensions=ua):(headers=ua,extensions=undefined2),ua=undefined2):typeof ua===TYPEOF.STRING&&!isExtensions(extensions,!0)&&(headers=extensions,extensions=undefined2),headers)if(typeof headers.append===TYPEOF.FUNCTION){var kv={};headers.forEach(function(v,k){kv[String(k).toLowerCase()]=v}),headers=kv}else{var normalized={};for(var header in headers)headers.hasOwnProperty(header)&&(normalized[String(header).toLowerCase()]=headers[header]);headers=normalized}if(!(this instanceof UAParser))return new UAParser(ua,extensions,headers).getResult();var userAgent=typeof ua===TYPEOF.STRING?ua:headers&&headers[USER_AGENT]?headers[USER_AGENT]:NAVIGATOR&&NAVIGATOR.userAgent?NAVIGATOR.userAgent:EMPTY,httpUACH=new UACHData(headers,!0),regexMap=defaultRegexes,createItemFunc=function(itemType){return itemType==RESULT?function(){return new UAItem(itemType,userAgent,regexMap,httpUACH).set("ua",userAgent).set(BROWSER,this.getBrowser()).set(CPU,this.getCPU()).set(DEVICE,this.getDevice()).set(ENGINE,this.getEngine()).set(OS,this.getOS()).get()}:function(){return new UAItem(itemType,userAgent,regexMap[itemType],httpUACH).parseUA().get()}};return setProps.call(this,[["getBrowser",createItemFunc(BROWSER)],["getCPU",createItemFunc(CPU)],["getDevice",createItemFunc(DEVICE)],["getEngine",createItemFunc(ENGINE)],["getOS",createItemFunc(OS)],["getResult",createItemFunc(RESULT)],["getUA",function(){return userAgent}],["setUA",function(ua2){return isString(ua2)&&(userAgent=trim(ua2,UA_MAX_LENGTH)),this}],["useExtension",function(exts){return exts&&(regexMap=extend(regexMap,exts)),this}]]).setUA(userAgent).useExtension(extensions),this}UAParser.VERSION=LIBVERSION,UAParser.BROWSER=enumerize([NAME,VERSION,MAJOR,TYPE]),UAParser.CPU=enumerize([ARCHITECTURE]),UAParser.DEVICE=enumerize([MODEL,VENDOR,TYPE,CONSOLE,MOBILE,SMARTTV,TABLET,WEARABLE,EMBEDDED]),UAParser.ENGINE=UAParser.OS=enumerize([NAME,VERSION]),typeof exports2!==TYPEOF.UNDEFINED?(typeof module2!==TYPEOF.UNDEFINED&&module2.exports&&(exports2=module2.exports=UAParser),exports2.UAParser=UAParser):typeof define===TYPEOF.FUNCTION&&define.amd?define(function(){return UAParser}):isWindow&&(window2.UAParser=UAParser);var $=isWindow&&(window2.jQuery||window2.Zepto);if($&&!$.ua){var parser=new UAParser;$.ua=parser.getResult(),$.ua.get=function(){return parser.getUA()},$.ua.set=function(ua){parser.setUA(ua);var result=parser.getResult();for(var prop in result)$.ua[prop]=result[prop]}}})(typeof window=="object"?window:exports2)}});var require_archiveShared=__commonJS({"src/lib/archiveShared.js"(exports2,module2){var path=require("path");function createArchiveError(message,statusCode=400){let error=new Error(message);return error.statusCode=statusCode,error}function isSafeArchiveEntry(entryPath){let normalized=String(entryPath||"").replace(/\\/g,"/").replace(/\/+$/,"");return!normalized||normalized.startsWith("/")||/^[a-zA-Z]:/.test(normalized)?!1:normalized.split("/").every(part=>part&&part!=="."&&part!=="..")}function isInside(parentPath,candidatePath){let relative=path.relative(parentPath,candidatePath);return relative===""||!relative.startsWith("..")&&!path.isAbsolute(relative)}function hasArchiveExtension(filePath,extensions){let lower=String(filePath||"").toLowerCase();return extensions.some(extension=>lower.endsWith(extension))}module2.exports={createArchiveError,hasArchiveExtension,isInside,isSafeArchiveEntry}}});var require_light=__commonJS({"src/lib/archiveProviders/light.js"(exports2,module2){var{createReadStream,createWriteStream,mkdirSync}=require("fs"),path=require("path"),{pipeline}=require("stream/promises"),{createGunzip}=require("zlib"),tar=require("tar-stream"),yauzl=require("yauzl"),{createArchiveError,hasArchiveExtension,isSafeArchiveEntry}=require_archiveShared(),extensions=[".tar.gz",".tgz",".zip",".tar"],capabilities={edition:"light",createFormats:["zip","tar.gz"],readExtensions:extensions.map(extension=>extension.slice(1))};function isArchivePath(filePath){return hasArchiveExtension(filePath,extensions)}function isZipPath(filePath){return String(filePath).toLowerCase().endsWith(".zip")}function isCompressedTarPath(filePath){return/\.(tar\.gz|tgz)$/i.test(filePath)}function isTarMetadataEntry(header){return["pax-global-header","pax-header","gnu-long-path","gnu-long-link"].includes(header.type)}function isSafeTarEntry(header){return["file","directory"].includes(header.type)&&isSafeArchiveEntry(header.name)}function isZipDirectory(entry){return/\/$/.test(entry.fileName)}function isZipSymbolicLink(entry){let mode=Math.floor(Number(entry.externalFileAttributes||0)/65536)%65536;return Math.floor(mode/4096)%16===10}function isZipEncrypted(entry){return Number(entry.generalPurposeBitFlag||0)%2===1}function openZip(filePath){return new Promise((resolve,reject)=>{yauzl.open(filePath,{autoClose:!0,lazyEntries:!0,validateEntrySizes:!0},(error,zipFile)=>{error?reject(createArchiveError(`Unable to read ZIP archive: ${error.message}`,422)):resolve(zipFile)})})}async function listZip(filePath){let zipFile=await openZip(filePath);return new Promise((resolve,reject)=>{let entries=[],settled=!1,finish=(callback,value)=>{settled||(settled=!0,zipFile.close(),callback(value))};zipFile.on("entry",entry=>{entries.push({path:entry.fileName.replace(/\\/g,"/"),isDirectory:isZipDirectory(entry),isSymbolicLink:isZipSymbolicLink(entry),size:Number(entry.uncompressedSize||0),packedSize:Number(entry.compressedSize||0),encrypted:isZipEncrypted(entry),modified:entry.getLastModDate().toISOString(),attributes:""}),zipFile.readEntry()}),zipFile.once("end",()=>finish(resolve,entries)),zipFile.once("error",error=>finish(reject,createArchiveError(`Unable to read ZIP archive: ${error.message}`,422))),zipFile.readEntry()})}async function listTar(filePath){return new Promise((resolve,reject)=>{let entries=[],extractor=tar.extract(),input=createReadStream(filePath),streams=[input,extractor],source=input,settled=!1;if(isCompressedTarPath(filePath)){let gunzip=createGunzip();streams.push(gunzip),source=input.pipe(gunzip)}let finish=(callback,value)=>{settled||(settled=!0,callback(value))},fail=error=>{streams.forEach(stream=>stream.destroy()),finish(reject,createArchiveError(`Unable to read TAR archive: ${error.message}`,422))};streams.forEach(stream=>stream.once("error",fail)),extractor.on("entry",(header,entryStream,next)=>{isTarMetadataEntry(header)||entries.push({path:String(header.name||"").replace(/\\/g,"/"),isDirectory:header.type==="directory",isSymbolicLink:!isSafeTarEntry(header),size:Number(header.size||0),packedSize:0,encrypted:!1,modified:header.mtime?new Date(header.mtime).toISOString():null,attributes:header.type||""}),entryStream.once("error",fail),entryStream.once("end",next),entryStream.resume()}),extractor.once("finish",()=>finish(resolve,entries)),source.pipe(extractor)})}async function listEntries(filePath){return isZipPath(filePath)?listZip(filePath):listTar(filePath)}function assertZipEntrySafe(entry){if(!isSafeArchiveEntry(entry.fileName)||isZipSymbolicLink(entry))throw createArchiveError("Archive contains an unsafe entry path",422);if(isZipEncrypted(entry))throw createArchiveError("Encrypted archives are not supported",422)}async function extractZip(job,sourcePath,targetPath){let zipFile=await openZip(sourcePath);return new Promise((resolve,reject)=>{let settled=!1,finish=(callback,value)=>{settled||(settled=!0,zipFile.close(),callback(value))},next=()=>{settled||zipFile.readEntry()};zipFile.on("entry",entry=>{try{assertZipEntrySafe(entry);let outputPath=path.join(targetPath,entry.fileName);if(isZipDirectory(entry)){mkdirSync(outputPath,{recursive:!0}),job.progress.processedEntries=Math.min(job.progress.totalEntries,job.progress.processedEntries+1),next();return}mkdirSync(path.dirname(outputPath),{recursive:!0}),zipFile.openReadStream(entry,async(error,input)=>{if(error)return finish(reject,createArchiveError(`Unable to extract ZIP archive: ${error.message}`,422));try{return await pipeline(input,createWriteStream(outputPath,{flags:"wx"})),job.progress.processedEntries=Math.min(job.progress.totalEntries,job.progress.processedEntries+1),next()}catch(streamError){finish(reject,createArchiveError(`Unable to extract ZIP archive: ${streamError.message}`,422))}})}catch(error){finish(reject,error)}}),zipFile.once("end",()=>finish(resolve)),zipFile.once("error",error=>finish(reject,createArchiveError(`Unable to extract ZIP archive: ${error.message}`,422))),zipFile.readEntry()})}async function extractTar(job,sourcePath,targetPath){return new Promise((resolve,reject)=>{let extractor=tar.extract(),input=createReadStream(sourcePath),streams=[input,extractor],source=input,settled=!1;if(isCompressedTarPath(sourcePath)){let gunzip=createGunzip();streams.push(gunzip),source=input.pipe(gunzip)}let finish=(callback,value)=>{settled||(settled=!0,callback(value))},fail=error=>{streams.forEach(stream=>stream.destroy());let archiveError=error.statusCode?error:createArchiveError(`Unable to extract TAR archive: ${error.message}`,422);finish(reject,archiveError)};streams.forEach(stream=>stream.once("error",fail)),extractor.on("entry",(header,entryStream,next)=>{if(isTarMetadataEntry(header)){entryStream.once("error",fail),entryStream.once("end",next),entryStream.resume();return}if(!isSafeTarEntry(header)){fail(createArchiveError("Archive contains an unsafe entry path",422));return}let outputPath=path.join(targetPath,header.name);if(header.type==="directory"){mkdirSync(outputPath,{recursive:!0}),entryStream.once("error",fail),entryStream.once("end",()=>{job.progress.processedEntries=Math.min(job.progress.totalEntries,job.progress.processedEntries+1),next()}),entryStream.resume();return}mkdirSync(path.dirname(outputPath),{recursive:!0}),pipeline(entryStream,createWriteStream(outputPath,{flags:"wx"})).then(()=>{job.progress.processedEntries=Math.min(job.progress.totalEntries,job.progress.processedEntries+1),next()}).catch(fail)}),extractor.once("finish",()=>finish(resolve)),source.pipe(extractor)})}async function extract(job,sourcePath,targetPath){return isZipPath(sourcePath)?extractZip(job,sourcePath,targetPath):extractTar(job,sourcePath,targetPath)}module2.exports={capabilities,extract,isArchivePath,listEntries}}});var require_archiveService=__commonJS({"src/lib/archiveService.js"(exports2,module2){var{createWriteStream,existsSync,lstatSync,mkdirSync,promises:fsPromises,realpathSync,renameSync,rmSync}=require("fs"),path=require("path"),crypto=require("crypto"),archiver=require("archiver"),archiveProvider=require_light(),{createArchiveError,isInside,isSafeArchiveEntry}=require_archiveShared(),MAX_ARCHIVE_SIZE=2*1024*1024*1024,MAX_ARCHIVE_ENTRIES=1e4,MAX_COMPRESSION_RATIO=100,ArchiveService=class{constructor({rootPath,resolvePath,getChildPath}){this.rootPath=rootPath,this.resolvePath=resolvePath,this.getChildPath=getChildPath,this.jobs=new Map}resolveExistingFile(inputPath){let fullPath=this.resolvePath(inputPath);if(!existsSync(fullPath))throw createArchiveError("Path not found",404);let stats=lstatSync(fullPath);if(!stats.isFile())throw createArchiveError("Archive path must be a file");if(!archiveProvider.isArchivePath(fullPath))throw createArchiveError("Unsupported archive format");if(stats.size>MAX_ARCHIVE_SIZE)throw createArchiveError("Archive exceeds 2GB limit",413);return fullPath}async listArchive(inputPath){let fullPath=this.resolveExistingFile(inputPath),entries=await archiveProvider.listEntries(fullPath);return this.assertEntriesSafe(entries,fullPath),{path:inputPath,name:path.basename(fullPath),entries,totalEntries:entries.length,totalSize:entries.reduce((total,entry)=>total+entry.size,0),totalPackedSize:entries.reduce((total,entry)=>total+entry.packedSize,0)}}assertEntriesSafe(entries,fullPath){if(!entries.length)throw createArchiveError("Archive contains no entries",422);if(entries.length>MAX_ARCHIVE_ENTRIES)throw createArchiveError("Archive contains too many entries",413);if(entries.some(entry=>entry.encrypted))throw createArchiveError("Encrypted archives are not supported",422);if(entries.some(entry=>entry.isSymbolicLink||!isSafeArchiveEntry(entry.path)))throw createArchiveError("Archive contains an unsafe entry path",422);let totalSize=entries.reduce((total,entry)=>total+entry.size,0),packedSize=Math.max(lstatSync(fullPath).size,1);if(totalSize>MAX_ARCHIVE_SIZE)throw createArchiveError("Archive expands beyond 2GB limit",413);if(totalSize/packedSize>MAX_COMPRESSION_RATIO)throw createArchiveError("Archive compression ratio exceeds limit",413)}startJob(type,payload){let id=crypto.randomUUID(),job={id,type,status:"queued",progress:{processedEntries:0,totalEntries:0},createdAt:new Date().toISOString(),result:null,error:null,cancelled:!1,child:null,archive:null};return this.jobs.set(id,job),setImmediate(async()=>{if(!job.cancelled){job.status="running";try{job.result=type==="create"?await this.createArchive(job,payload):await this.extractArchive(job,payload),job.status=job.cancelled?"cancelled":"completed"}catch(error){job.status=job.cancelled?"cancelled":"failed",job.error=error.message}finally{job.child=null,job.archive=null,job.finishedAt=new Date().toISOString()}}}),job}getJob(id){return this.jobs.get(id)}getCapabilities(){return archiveProvider.capabilities}cancelJob(id){let job=this.getJob(id);if(!job)throw createArchiveError("Archive job not found",404);return["completed","failed","cancelled"].includes(job.status)||(job.cancelled=!0,job.status="cancelled",job.child&&job.child.kill("SIGTERM"),job.archive&&job.archive.abort()),job}async createArchive(job,payload){let format=payload.format==="tar.gz"?"tar.gz":payload.format;if(!archiveProvider.capabilities.createFormats.includes(format)){let formats=archiveProvider.capabilities.createFormats.join(" and ");throw createArchiveError(`Supported creation formats are ${formats}`)}if(!Array.isArray(payload.sources)||payload.sources.length===0)throw createArchiveError("Sources must be a non-empty array");let sourcePaths=payload.sources.map(source=>this.resolvePath(source));sourcePaths.forEach(source=>{if(!existsSync(source))throw createArchiveError("Source path not found",404);if(lstatSync(source).isSymbolicLink())throw createArchiveError("Symbolic links cannot be archived");let realPath=realpathSync(source);if(!isInside(this.rootPath,realPath))throw createArchiveError("Access denied",403)}),await Promise.all(sourcePaths.map(source=>this.assertSourceTreeSafe(source)));let destinationPath=payload.destinationPath||path.posix.dirname(payload.sources[0]),archiveName=String(payload.name||"").trim(),requiredExtension=format==="zip"?".zip":".tar.gz",safeName=archiveName.endsWith(requiredExtension)?archiveName:`${archiveName}${requiredExtension}`,outputPath=this.getChildPath(destinationPath,safeName);if(existsSync(outputPath))throw createArchiveError("Archive path already exists",409);if(job.progress.totalEntries=sourcePaths.length,await new Promise((resolve,reject)=>{let output=createWriteStream(outputPath,{flags:"wx"}),archive=format==="zip"?archiver("zip",{zlib:{level:9}}):archiver("tar",{gzip:!0,gzipOptions:{level:9}});job.archive=archive,output.on("close",resolve),output.on("error",reject),archive.on("error",reject),archive.on("progress",progress=>{job.progress.processedEntries=progress.entries.processed,job.progress.totalEntries=progress.entries.total}),archive.pipe(output),sourcePaths.forEach(source=>{lstatSync(source).isDirectory()?archive.directory(source,path.basename(source)):archive.file(source,{name:path.basename(source)})}),archive.finalize()}).catch(error=>{throw rmSync(outputPath,{force:!0}),error}),job.cancelled)throw rmSync(outputPath,{force:!0}),createArchiveError("Archive job cancelled",499);return{path:outputPath,name:path.basename(outputPath)}}async extractArchive(job,payload){let sourcePath=this.resolveExistingFile(payload.path),destinationPath=this.resolvePath(payload.destinationPath||"/");if(!existsSync(destinationPath)||!lstatSync(destinationPath).isDirectory())throw createArchiveError("Extraction destination must be an existing directory",404);let listing=await this.listArchive(payload.path);job.progress.totalEntries=listing.totalEntries;let tempRoot=await fsPromises.mkdtemp(path.join(destinationPath,".mock-service-cli-archive-")),tempOutput=path.join(tempRoot,"output");mkdirSync(tempOutput);try{if(await archiveProvider.extract(job,sourcePath,tempOutput),job.cancelled)throw createArchiveError("Archive job cancelled",499);await this.assertExtractedTreeSafe(tempOutput);let outputEntries=await fsPromises.readdir(tempOutput);if(!outputEntries.length)throw createArchiveError("Archive produced no files",422);outputEntries.forEach(name=>{if(existsSync(path.join(destinationPath,name)))throw createArchiveError(`Destination already contains ${name}`,409)});for(let name of outputEntries)renameSync(path.join(tempOutput,name),path.join(destinationPath,name));return job.progress.processedEntries=job.progress.totalEntries,{destinationPath,entries:outputEntries}}finally{rmSync(tempRoot,{recursive:!0,force:!0})}}async assertExtractedTreeSafe(root){let rootRealPath=realpathSync(root),walk=async current=>{let entries=await fsPromises.readdir(current,{withFileTypes:!0});for(let entry of entries){let child=path.join(current,entry.name),stats=await fsPromises.lstat(child);if(stats.isSymbolicLink())throw createArchiveError("Archive contains symbolic links",422);let realPath=realpathSync(child);if(!isInside(rootRealPath,realPath))throw createArchiveError("Archive extracted outside its destination",422);stats.isDirectory()&&await walk(child)}};await walk(root)}async assertSourceTreeSafe(source){let stats=await fsPromises.lstat(source);if(stats.isSymbolicLink())throw createArchiveError("Symbolic links cannot be archived");if(!stats.isDirectory())return;let entries=await fsPromises.readdir(source,{withFileTypes:!0});await Promise.all(entries.map(entry=>this.assertSourceTreeSafe(path.join(source,entry.name))))}};module2.exports={ArchiveService,isArchivePath:archiveProvider.isArchivePath}}});var require_fileExplorerServer=__commonJS({"src/lib/fileExplorerServer.js"(){var express=require_express2(),{existsSync,readFileSync,statSync,lstatSync,rmSync,mkdirSync,writeFileSync,renameSync,realpathSync,copyFileSync,unlinkSync,constants:fsConstants,promises:fsPromises}=require("fs"),path=require("path"),os=require("os"),crypto=require("crypto"),multer=require_multer(),{UAParser}=require_ua_parser(),colors=require_safe(),portfinder=require_portfinder(),{exec,execFile}=require("child_process"),{dateFormat,logger,getServerHost,getServerUrls,hostAllowlistMiddleware,normalizeRemoteAddress}=require_utils3(),{getPackageVersion}=require_packageInfo(),{ArchiveService}=require_archiveService(),app=express(),log=logger(process.env.SILENT),argv=JSON.parse(process.env.ARGV),explorerRoot=path.resolve(process.env.EXPLORER_DIRECTORY||process.cwd()),explorerRootRealPath=realpathSync(explorerRoot),explorerRootId=crypto.createHash("sha256").update(explorerRootRealPath).digest("hex"),port=argv.p||argv.port,isEditMode=process.env.EXPLORER_EDIT==="true",explorerPassword=process.env.EXPLORER_AUTH||"",isAuthEnabled=!!explorerPassword,visitorKeys=new Set,MAX_UPLOAD_FILE_SIZE=2*1024*1024*1024,MAX_UPLOAD_TOTAL_SIZE=2*1024*1024*1024,MAX_UPLOAD_FILE_COUNT=100,MAX_MULTIPART_OVERHEAD_SIZE=2*1024*1024,upload=multer({dest:path.join(os.tmpdir(),"mock-service-cli-upload"),preservePath:!0,limits:{fileSize:MAX_UPLOAD_FILE_SIZE,files:MAX_UPLOAD_FILE_COUNT,fields:10}}),archiveService=new ArchiveService({rootPath:explorerRootRealPath,resolvePath:resolveExplorerPath,getChildPath});function isPathInsideRoot(fullPath,resolvedRoot=explorerRootRealPath){let relativePath=path.relative(resolvedRoot,fullPath);return relativePath===""||!relativePath.startsWith("..")&&!path.isAbsolute(relativePath)}function normalizeExplorerInputPath(inputPath){let decodedPath=decodeURIComponent(String(inputPath||"/")).replace(/\\/g,"/");return!decodedPath||decodedPath==="."?"/":decodedPath.startsWith("/")?decodedPath:`/${decodedPath}`}function resolveExplorerPath(inputPath){let relativePath=normalizeExplorerInputPath(inputPath).replace(/^\/+/,""),fullPath=path.resolve(explorerRoot,relativePath);if(!isPathInsideRoot(fullPath,explorerRoot)){let error=new Error("Access denied");throw error.statusCode=403,error}if(!existsSync(fullPath))return fullPath;let realPath=realpathSync(fullPath);if(!isPathInsideRoot(realPath)){let error=new Error("Access denied");throw error.statusCode=403,error}return realPath}function validateEntryName(name){if(typeof name!="string")return"Name must be a string";let normalizedName=name.trim();if(!normalizedName||normalizedName==="."||normalizedName==="..")return"Invalid name";if(/[/\\\0<>:"|?*]/.test(normalizedName))return"Name contains invalid characters";if(process.platform==="win32"){let upperName=normalizedName.replace(/[. ]+$/g,"").split(".")[0].toUpperCase();if(new Set(["CON","PRN","AUX","NUL","COM1","COM2","COM3","COM4","COM5","COM6","COM7","COM8","COM9","LPT1","LPT2","LPT3","LPT4","LPT5","LPT6","LPT7","LPT8","LPT9"]).has(upperName)||normalizedName.endsWith(" ")||normalizedName.endsWith("."))return"Name is not supported on Windows"}return null}function getChildPath(parentPath,name){let nameError=validateEntryName(name);if(nameError){let error=new Error(nameError);throw error.statusCode=400,error}let parentFullPath=resolveExplorerPath(parentPath||"/");if(!existsSync(parentFullPath)||!statSync(parentFullPath).isDirectory()){let error=new Error("Parent directory not found");throw error.statusCode=404,error}let childPath=path.resolve(parentFullPath,name.trim());if(!isPathInsideRoot(childPath)){let error=new Error("Access denied");throw error.statusCode=403,error}return childPath}function requireEditMode(req,res,next){if(!isEditMode)return res.status(403).json({error:"File explorer is read-only. Restart with --edit to modify files."});next()}function isValidExplorerPassword(value){if(!isAuthEnabled)return!0;let provided=Buffer.from(String(value||"")),expected=Buffer.from(explorerPassword);return provided.length===expected.length&&crypto.timingSafeEqual(provided,expected)}function getExplorerPassword(req){return req.get("x-file-explorer-password")||req.body&&req.body.password}function requireExplorerAuth(req,res,next){if(!isValidExplorerPassword(getExplorerPassword(req)))return res.status(401).json({error:"Authentication required"});next()}function logExplorerVisit(req){let userAgent=req.get("user-agent")||"",ip=normalizeRemoteAddress(req.socket&&req.socket.remoteAddress),visitorKey=`${ip}
|
|
141
|
+
${userAgent}`;if(visitorKeys.has(visitorKey))return;visitorKeys.add(visitorKey);let parsed=new UAParser(userAgent).getResult(),browser=[parsed.browser.name,parsed.browser.version].filter(Boolean).join(" ")||"Unknown",operatingSystem=[parsed.os.name,parsed.os.version].filter(Boolean).join(" ")||"Unknown";log.info(`File explorer visitor: ip=${ip}, os=${operatingSystem}, browser=${browser}, userAgent=${userAgent}`)}function getUploadTargetPath(parentPath,originalName){let normalizedName=String(originalName||"").replace(/\\/g,"/").replace(/^\/+/,""),parts=normalizedName.split("/").filter(Boolean);if(parts.length===0||normalizedName!==parts.join("/")){let error=new Error("Invalid upload path");throw error.statusCode=400,error}parts.forEach(part=>{let nameError=validateEntryName(part);if(nameError){let error=new Error(nameError);throw error.statusCode=400,error}});let parentFullPath=resolveExplorerPath(parentPath||"/");if(!existsSync(parentFullPath)||!statSync(parentFullPath).isDirectory()){let error=new Error("Parent directory not found");throw error.statusCode=404,error}let targetPath=path.resolve(parentFullPath,...parts);if(!isPathInsideRoot(targetPath)){let error=new Error("Access denied");throw error.statusCode=403,error}return{targetPath,parentFullPath,parts}}function ensureUploadParent(parentFullPath,parts){let current=parentFullPath;parts.slice(0,-1).forEach(part=>{if(current=path.join(current,part),existsSync(current)){let stats=lstatSync(current);if(!stats.isDirectory()||stats.isSymbolicLink()||!isPathInsideRoot(realpathSync(current))){let error=new Error("Upload path is not a safe directory");throw error.statusCode=403,error}}else mkdirSync(current)})}function moveUploadedFile(sourcePath,targetPath){copyFileSync(sourcePath,targetPath,fsConstants.COPYFILE_EXCL),unlinkSync(sourcePath)}function cleanupUploadedTempFiles(files=[]){files.forEach(file=>{file&&file.path&&existsSync(file.path)&&rmSync(file.path,{force:!0})})}function enforceUploadRequestSize(req,res,next){let contentLength=Number(req.get("content-length"));if(Number.isFinite(contentLength)&&contentLength>MAX_UPLOAD_TOTAL_SIZE+MAX_MULTIPART_OVERHEAD_SIZE)return res.status(413).json({error:"Total upload size exceeds 2GB limit"});next()}function deleteExplorerPath(targetPath){let fullPath=resolveExplorerPath(targetPath);if(path.resolve(fullPath)===explorerRootRealPath){let error=new Error("Cannot delete explorer root");throw error.statusCode=400,error}if(!existsSync(fullPath)){let error=new Error("Path not found");throw error.statusCode=404,error}rmSync(fullPath,{recursive:!0,force:!1})}process.env.PORT?init():(portfinder.basePort=port||8090,portfinder.getPort(function(err,foundPort){if(err)throw err;process.env.PORT=foundPort,init()}));function init(){app.use(hostAllowlistMiddleware()),app.use(express.json());let faviconInstanceId=crypto.randomUUID(),explorerFaviconUrl=`/favicon-file-explorer.svg?instance=${faviconInstanceId}`,loginFaviconUrl=`/favicon-file-explorer-login.svg?instance=${faviconInstanceId}`,sendFavicon=(filename,res)=>{res.type("image/svg+xml").set("Cache-Control","no-store").sendFile(path.resolve(__dirname,filename))},sendExplorerPage=(filename,faviconUrl,res)=>{let htmlPath=path.resolve(__dirname,filename);if(!existsSync(htmlPath))return res.status(404).send("File explorer page not found");res.type("html").send(readFileSync(htmlPath,"utf8").replace("__FILE_EXPLORER_FAVICON_URL__",faviconUrl))};app.get("/favicon-file-explorer.svg",(req,res)=>sendFavicon("./favicon-file-explorer.svg",res)),app.get("/favicon-file-explorer-login.svg",(req,res)=>sendFavicon("./favicon-file-explorer-login.svg",res)),app.get("/",(req,res)=>sendExplorerPage("./file-explorer.html",explorerFaviconUrl,res)),app.get("/__login",(req,res)=>sendExplorerPage("./file-explorer-login.html",loginFaviconUrl,res)),app.post("/__api/auth/verify",(req,res)=>{if(!isValidExplorerPassword(getExplorerPassword(req)))return res.status(401).json({error:"Invalid password"});res.json({success:!0,authEnabled:isAuthEnabled})}),app.use("/__api",requireExplorerAuth),app.get("/__api/config",(req,res)=>{logExplorerVisit(req),res.json({editMode:isEditMode,authEnabled:isAuthEnabled,rootId:explorerRootId})}),app.get("/__api/archive/capabilities",requireEditMode,(req,res)=>{res.json(archiveService.getCapabilities())}),app.get("/__api/health",(req,res)=>{res.json({success:!0})}),app.get("/__api/list",async(req,res)=>{let dirPath=normalizeExplorerInputPath(req.query.path||"/"),fullPath;try{fullPath=resolveExplorerPath(dirPath)}catch(error){return res.status(error.statusCode||500).json({error:error.message})}if(!existsSync(fullPath))return res.status(404).json({error:"Path not found"});try{if(!(await fsPromises.lstat(fullPath)).isDirectory())return res.status(400).json({error:"Not a directory"});let files=await fsPromises.readdir(fullPath,{withFileTypes:!0}),result=await Promise.all(files.map(async file=>{let filePath=path.join(fullPath,file.name),fileStats,hasError=!1;try{fileStats=await fsPromises.lstat(filePath)}catch{hasError=!0}let relativePath=path.posix.join(dirPath,file.name),isDirectory=hasError?file.isDirectory():fileStats.isDirectory();return{name:file.name,path:relativePath.replace(/\\/g,"/"),isDirectory,size:hasError?0:fileStats.size,mtime:hasError?new Date:fileStats.mtime,birthtime:hasError?new Date:fileStats.birthtime,isHidden:file.name.startsWith("."),error:hasError?"Cannot access file":null}}));result.sort((a,b)=>a.isDirectory!==b.isDirectory?a.isDirectory?-1:1:a.name.localeCompare(b.name)),res.json({currentPath:dirPath,parentPath:dirPath==="/"?null:path.posix.dirname(dirPath),files:result})}catch(error){res.status(500).json({error:error.message})}}),app.get("/__api/file",(req,res)=>{let filePath=normalizeExplorerInputPath(req.query.path||"/"),fullPath;try{fullPath=resolveExplorerPath(filePath)}catch(error){return res.status(error.statusCode||500).json({error:error.message})}if(!existsSync(fullPath))return res.status(404).json({error:"File not found"});let stats=statSync(fullPath);if(stats.isDirectory())return res.status(400).json({error:"Is a directory"});if(req.query.download==="1")return res.download(fullPath,path.basename(filePath));let ext=path.extname(filePath).toLowerCase(),imageExts=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico"],textExts=[".txt",".json",".js",".css",".html",".xml",".md",".csv",".yaml",".yml",".log"];if(imageExts.includes(ext))res.sendFile(fullPath);else if(textExts.includes(ext)||stats.size<1024*1024)try{let content=readFileSync(fullPath,"utf-8");res.json({name:path.basename(filePath),type:"text",content,size:stats.size})}catch{res.download(fullPath)}else res.download(fullPath)}),app.post("/__api/open-in-explorer",(req,res)=>{let filePath=normalizeExplorerInputPath(req.body.path||"/"),fullPath;try{fullPath=resolveExplorerPath(filePath)}catch(error){return res.status(error.statusCode||500).json({error:error.message})}if(!existsSync(fullPath))return res.status(404).json({error:"Path not found"});let command,args;switch(process.platform){case"darwin":command="open",args=[fullPath];break;case"win32":command="explorer.exe",args=[fullPath];break;case"linux":command="xdg-open",args=[fullPath];break;default:return res.status(400).json({error:"Unsupported platform"})}execFile(command,args,error=>{if(error)return console.error(colors.red(`Failed to open in explorer: ${error.message}`)),res.status(500).json({error:"Failed to open in explorer"});res.json({success:!0,path:fullPath})})}),app.post("/__api/path",requireEditMode,(req,res)=>{let parentPath=req.body&&req.body.parentPath||"/",name=req.body&&req.body.name,type=req.body&&req.body.type||"file";if(type!=="file"&&type!=="directory")return res.status(400).json({error:"Invalid type"});let fullPath;try{fullPath=getChildPath(parentPath,name)}catch(error){return res.status(error.statusCode||500).json({error:error.message})}if(existsSync(fullPath))return res.status(409).json({error:"Path already exists"});try{type==="directory"?mkdirSync(fullPath):writeFileSync(fullPath,""),res.json({success:!0,path:fullPath})}catch(error){console.error(colors.red(`Failed to create path: ${error.message}`)),res.status(500).json({error:"Failed to create path"})}}),app.patch("/__api/path",requireEditMode,(req,res)=>{let sourcePath=req.body&&req.body.path,name=req.body&&req.body.name,fullPath,nextPath;try{if(fullPath=resolveExplorerPath(sourcePath),path.resolve(fullPath)===explorerRootRealPath)return res.status(400).json({error:"Cannot rename explorer root"});if(!existsSync(fullPath))return res.status(404).json({error:"Path not found"});nextPath=getChildPath(path.posix.dirname(normalizeExplorerInputPath(sourcePath||"/")),name)}catch(error){return res.status(error.statusCode||500).json({error:error.message})}if(existsSync(nextPath))return res.status(409).json({error:"Path already exists"});try{renameSync(fullPath,nextPath),res.json({success:!0,path:sourcePath,nextPath})}catch(error){console.error(colors.red(`Failed to rename path: ${error.message}`)),res.status(500).json({error:"Failed to rename path"})}}),app.delete("/__api/path",requireEditMode,(req,res)=>{let targetPath=req.body&&req.body.path||"/";try{deleteExplorerPath(targetPath),res.json({success:!0,path:targetPath})}catch(error){console.error(colors.red(`Failed to delete path: ${error.message}`)),res.status(error.statusCode||500).json({error:error.statusCode?error.message:"Failed to delete path"})}}),app.delete("/__api/paths",requireEditMode,(req,res)=>{let paths=req.body&&req.body.paths||[];if(!Array.isArray(paths)||paths.length===0)return res.status(400).json({error:"Paths must be a non-empty array"});let deleted=[];try{paths.forEach(targetPath=>{deleteExplorerPath(targetPath),deleted.push(targetPath)}),res.json({success:!0,deleted})}catch(error){console.error(colors.red(`Failed to delete paths: ${error.message}`)),res.status(error.statusCode||500).json({error:error.statusCode?error.message:"Failed to delete paths",deleted})}}),app.post("/__api/upload",requireEditMode,enforceUploadRequestSize,upload.any(),(req,res)=>{let parentPath=req.body&&req.body.parentPath||"/",files=req.files||[];if(!files.length)return res.status(400).json({error:"No files uploaded"});if(files.reduce((sum,file)=>sum+file.size,0)>MAX_UPLOAD_TOTAL_SIZE)return cleanupUploadedTempFiles(files),res.status(413).json({error:"Total upload size exceeds 2GB limit"});let uploaded=[],failed=[];files.forEach(file=>{try{let{targetPath,parentFullPath,parts}=getUploadTargetPath(parentPath,file.originalname);if(existsSync(targetPath)){failed.push({name:file.originalname,error:"Path already exists",statusCode:409});return}if(ensureUploadParent(parentFullPath,parts),existsSync(targetPath)){failed.push({name:file.originalname,error:"Path already exists",statusCode:409});return}moveUploadedFile(file.path,targetPath),uploaded.push({name:file.originalname,path:path.posix.join(normalizeExplorerInputPath(parentPath),...parts)})}catch(error){failed.push({name:file.originalname,error:error.message,statusCode:error.statusCode||500})}finally{existsSync(file.path)&&rmSync(file.path,{force:!0})}}),res.status(failed.length?207:200).json({success:failed.length===0,uploaded,failed})}),app.get("/__api/archive/preview",requireEditMode,async(req,res)=>{try{let preview=await archiveService.listArchive(normalizeExplorerInputPath(req.query.path||"/"));res.json(preview)}catch(error){res.status(error.statusCode||500).json({error:error.message})}}),app.post("/__api/archive/jobs",requireEditMode,(req,res)=>{let payload=req.body||{},operation=payload.operation;if(operation!=="create"&&operation!=="extract")return res.status(400).json({error:"Archive operation must be create or extract"});try{let job=archiveService.startJob(operation,payload);res.status(202).json({id:job.id,status:job.status,type:job.type})}catch(error){res.status(error.statusCode||500).json({error:error.message})}}),app.get("/__api/archive/jobs/:id",requireEditMode,(req,res)=>{let job=archiveService.getJob(req.params.id);if(!job)return res.status(404).json({error:"Archive job not found"});res.json({id:job.id,type:job.type,status:job.status,progress:job.progress,result:job.result,error:job.error,createdAt:job.createdAt,finishedAt:job.finishedAt||null})}),app.delete("/__api/archive/jobs/:id",requireEditMode,(req,res)=>{try{let job=archiveService.cancelJob(req.params.id);res.json({id:job.id,status:job.status})}catch(error){res.status(error.statusCode||500).json({error:error.message})}}),app.use((error,req,res,next)=>{if(error instanceof multer.MulterError){cleanupUploadedTempFiles(req.files);let statusCode=error.code==="LIMIT_FILE_SIZE"||error.code==="LIMIT_FILE_COUNT"?413:400;return res.status(statusCode).json({error:error.message})}if(error)return console.error(colors.red(`File explorer request failed: ${error.message}`)),res.status(error.statusCode||500).json({error:error.message||"Request failed"});next()}),startServer()}function startServer(){let http=require("http").createServer(app);http.requestTimeout=0,http.listen(Number.parseInt(process.env.PORT,10),getServerHost(),()=>{if(console.info([colors.yellow(`
|
|
142
142
|
Starting up file-explorer-server, serving `),colors.cyan(explorerRoot),colors.yellow(` ${dateFormat("YYYY-mm-dd HH:MM:SS",new Date)}`)].join("")),console.info([colors.yellow(`
|
|
143
143
|
\u{1F30D} file-explorer-server version: `),colors.cyan(getPackageVersion()),`
|
|
144
144
|
`].join("")),console.info(colors.yellow(`
|