@gjsify/example-node-express-webserver 0.55.0 → 0.56.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.gjs.js +28 -28
  2. package/package.json +5 -5
package/dist/index.gjs.js CHANGED
@@ -229,54 +229,54 @@ var n=el()(`finalhandler`),r=Vd(),i=Hd(),o=Hl(),s=Ud(),c=il(),l=o.isFinished;fun
229
229
  * MIT Licensed
230
230
  */
231
231
  var n=el()(`express:view`),r=(jr(),__toCommonJS(hr)),i=(op(),__toCommonJS(rp)),o=r.dirname,s=r.basename,c=r.extname,l=r.join,u=r.resolve;t.exports=View;function View(e,t){var r=t||{};if(this.defaultEngine=r.defaultEngine,this.ext=c(e),this.name=e,this.root=r.root,!this.ext&&!this.defaultEngine)throw Error(`No default engine was specified and no extension was provided.`);var i=e;if(this.ext||(this.ext=this.defaultEngine[0]===`.`?this.defaultEngine:`.`+this.defaultEngine,i+=this.ext),!r.engines[this.ext]){var o=this.ext.slice(1);n(`require "%s"`,o);var s=y(o).__express;if(typeof s!=`function`)throw Error(`Module "`+o+`" does not provide a view engine.`);r.engines[this.ext]=s}this.engine=r.engines[this.ext],this.path=this.lookup(i)}View.prototype.lookup=function lookup(e){var t,r=[].concat(this.root);n(`lookup "%s"`,e);for(var i=0;i<r.length&&!t;i++){var c=r[i],l=u(c,e),d=o(l),p=s(l);t=this.resolve(d,p)}return t},View.prototype.render=function render(e,t){var r=!0;n(`render "%s"`,this.path),this.engine(this.path,e,function onRender(){if(!r)return t.apply(this,arguments);for(var e=Array(arguments.length),n=this,i=0;i<arguments.length;i++)e[i]=arguments[i];return process.nextTick(function renderTick(){return t.apply(n,e)})}),r=!1},View.prototype.resolve=function resolve(e,t){var n=this.ext,r=l(e,t),i=tryStat(r);if(i&&i.isFile()||(r=l(e,s(t,n),`index`+n),i=tryStat(r),i&&i.isFile()))return r};function tryStat(e){n(`stat "%s"`,e);try{return i.statSync(e)}catch{return}}}));function validateHeaderName(e){if(typeof e!=`string`||!/^[\^`\-\w!#$%&'*+.|~]+$/.test(e)){let t=TypeError(`Header name must be a valid HTTP token ["${e}"]`);throw Object.defineProperty(t,"code",{value:`ERR_INVALID_HTTP_TOKEN`}),t}}function validateHeaderValue(e,t){if(t===void 0){let t=TypeError(`Header "${e}" value must not be undefined`);throw Object.defineProperty(t,"code",{value:`ERR_HTTP_INVALID_HEADER_VALUE`}),t}if(typeof t==`string`&&/[^\t -~€-ÿ]/.test(t)){let t=TypeError(`Invalid character in header content ["${e}"]`);throw Object.defineProperty(t,"code",{value:`ERR_INVALID_CHAR`}),t}}var lp=__esmMin(()=>{}),up,dp,fp=__esmMin(()=>{up={100:`Continue`,101:`Switching Protocols`,102:`Processing`,103:`Early Hints`,200:`OK`,201:`Created`,202:`Accepted`,203:`Non-Authoritative Information`,204:`No Content`,205:`Reset Content`,206:`Partial Content`,207:`Multi-Status`,208:`Already Reported`,226:`IM Used`,300:`Multiple Choices`,301:`Moved Permanently`,302:`Found`,303:`See Other`,304:`Not Modified`,305:`Use Proxy`,307:`Temporary Redirect`,308:`Permanent Redirect`,400:`Bad Request`,401:`Unauthorized`,402:`Payment Required`,403:`Forbidden`,404:`Not Found`,405:`Method Not Allowed`,406:`Not Acceptable`,407:`Proxy Authentication Required`,408:`Request Timeout`,409:`Conflict`,410:`Gone`,411:`Length Required`,412:`Precondition Failed`,413:`Payload Too Large`,414:`URI Too Long`,415:`Unsupported Media Type`,416:`Range Not Satisfiable`,417:`Expectation Failed`,418:`I'm a Teapot`,421:`Misdirected Request`,422:`Unprocessable Entity`,423:`Locked`,424:`Failed Dependency`,425:`Too Early`,426:`Upgrade Required`,428:`Precondition Required`,429:`Too Many Requests`,431:`Request Header Fields Too Large`,451:`Unavailable For Legal Reasons`,500:`Internal Server Error`,501:`Not Implemented`,502:`Bad Gateway`,503:`Service Unavailable`,504:`Gateway Timeout`,505:`HTTP Version Not Supported`,506:`Variant Also Negotiates`,507:`Insufficient Storage`,508:`Loop Detected`,510:`Not Extended`,511:`Network Authentication Required`},dp=`ACL.BIND.CHECKOUT.CONNECT.COPY.DELETE.GET.HEAD.LINK.LOCK.M-SEARCH.MERGE.MKACTIVITY.MKCALENDAR.MKCOL.MOVE.NOTIFY.OPTIONS.PATCH.POST.PRI.PROPFIND.PROPPATCH.PURGE.PUT.REBIND.REPORT.SEARCH.SOURCE.SUBSCRIBE.TRACE.UNBIND.UNLINK.UNLOCK.UNSUBSCRIBE`.split(`.`)}),IncomingMessage,pp=__esmMin(()=>{U(),Sa(),IncomingMessage=class extends ga{httpVersion=`1.1`;httpVersionMajor=1;httpVersionMinor=1;headers={};rawHeaders=[];method;url;statusCode;statusMessage;complete=!1;socket=null;aborted=!1;get connection(){return this.socket}_timeoutTimer=null;constructor(){super()}_read(e){}_autoClose(){}_pushBody(e){e&&e.length>0&&this.push(H.from(e)),this.push(null),this.complete=!0,this._timeoutTimer&&=(clearTimeout(this._timeoutTimer),null)}setTimeout(e,t){return this._timeoutTimer&&=(clearTimeout(this._timeoutTimer),null),t&&this.once(`timeout`,t),e>0&&(this._timeoutTimer=setTimeout(()=>{this._timeoutTimer=null,this.emit(`timeout`)},e)),this}destroy(e){return this._timeoutTimer&&=(clearTimeout(this._timeoutTimer),null),this.aborted=!0,super.destroy(e)}}}),ServerRequestSocket,mp=__esmMin(()=>{Sa(),ServerRequestSocket=class extends va{remoteAddress;remotePort;localAddress;localPort;remoteFamily=`IPv4`;encrypted;connecting=!1;pending=!1;bytesRead=0;bytesWritten=0;_bridgeRes;_bridgePaused=!1;constructor(e,t,n,r,i,o=!1){super({allowHalfOpen:!0}),this.remoteAddress=e,this.remotePort=t,this.localAddress=n,this.localPort=r,this.encrypted=o,this._bridgeRes=i}pause(){return this._bridgePaused?this:(this._bridgePaused=!0,super.pause())}resume(){return this._bridgePaused&&=!1,super.resume()}_read(e){}_write(e,t,n){n()}destroySoon(){this.writableEnded||this.end(),this.writableFinished?this.destroy():this.once(`finish`,()=>this.destroy())}setTimeout(e,t){return t&&this.once(`timeout`,t),this}setNoDelay(e){return this}setKeepAlive(e,t){return this}ref(){return this}unref(){return this}address(){return{address:this.localAddress,family:`IPv4`,port:this.localPort}}}});function unfqdn(e){return e.endsWith(`.`)?e.slice(0,-1):e}function splitHost(e){return unfqdn(e).toLowerCase().split(`.`)}function isPrintableAscii(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<33||n>126)return!1}return!0}function checkHostMatch(e,t){if(!t)return!1;let n=splitHost(t);if(e.length!==n.length||n.includes(``)||!n.every(isPrintableAscii))return!1;for(let t=e.length-1;t>0;t--)if(e[t]!==n[t])return!1;let r=e[0],i=n[0],o=i.split(`*`,3);if(o.length===1||i.includes(`xn--`))return r===i;if(o.length>2||n.length<=2)return!1;let s=o[0],c=o[1];return!(s.length+c.length>r.length||!r.startsWith(s)||!r.endsWith(c))}function checkServerIdentity(e,t){let n=t.subject,r=t.subjectaltname,i=[],o=[];if(e=String(e),r){let e=r.split(`, `);for(let t of e)t.startsWith(`DNS:`)?i.push(t.slice(4)):t.startsWith(`IP Address:`)&&o.push(t.slice(11).trim())}let s=!1,c=`Unknown reason`;e=unfqdn(e);let l=/^(\d{1,3}\.){3}\d{1,3}$/.test(e),u=e.includes(`:`);if(l||u)s=o.some(t=>t.toLowerCase()===e.toLowerCase()),s||(c=`IP: ${e} is not in the cert's list: ${o.join(`, `)}`);else if(i.length>0||n?.CN){let t=splitHost(e);if(i.length>0)s=i.some(e=>checkHostMatch(t,e.trim())),s||(c=`Host: ${e}. is not in the cert's altnames: ${r}`);else{let r=n?.CN;Array.isArray(r)?s=r.some(e=>checkHostMatch(t,e)):r&&(s=checkHostMatch(t,r)),s||(c=`Host: ${e}. is not cert's CN: ${r}`)}}else c=`Cert does not contain a DNS name`;if(!s){let n=Error(`Hostname/IP does not match certificate's altnames: ${c}`);return n.reason=c,n.host=e,n.cert=t,n.code=`ERR_TLS_CERT_ALTNAME_INVALID`,n}}var hp=__esmMin(()=>{});function pemToString(e){return Array.isArray(e)?e.map(pemToString).join(`
232
- `):typeof e==`string`?e:e instanceof Uint8Array?new TextDecoder(`utf-8`).decode(e):String(e)}function splitPemBlocks(e){let t=[],n=/-----BEGIN [^-]+-----[\s\S]*?-----END [^-]+-----/g,r;for(;(r=n.exec(e))!==null;)t.push(r[0]);return t}function buildGioCertificate(e,t){let n=pemToString(e),r=t?pemToString(t):``,i=r?`${n}\n${r}`:n;return X.TlsCertificate.new_from_pem(i,i.length)}function buildCaCertificates(e){let t=[];if(Array.isArray(e))for(let n of e)t.push(...splitPemBlocks(pemToString(n)));else t.push(...splitPemBlocks(pemToString(e)));let n=[];for(let e of t)try{n.push(X.TlsCertificate.new_from_pem(e,e.length))}catch{}return n}function pemToDer(e){let t=/-----BEGIN CERTIFICATE-----([\s\S]*?)-----END CERTIFICATE-----/.exec(e);if(!t)return new Uint8Array;let n=t[1].replace(/[\s\r\n]+/g,``);try{let e=globalThis.atob;if(!e)return new Uint8Array;let t=e(n),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return r}catch{return new Uint8Array}}var gp=__esmMin(()=>{Z()});function createSecureContext(e){let t=e??{},n=null;if(t.cert)try{n=buildGioCertificate(t.cert,t.key)}catch{n=null}let r=t.ca?buildCaCertificates(t.ca):[],i={certificate:n,caCertificates:r,options:t};return i.context=i,i}var vp=__esmMin(()=>{gp()}),yp,bp=__esmMin(()=>{P(),yp=loadOptionalNativeModule(`GjsifyTls`,[`Tls`,`SessionAccess`]),yp.module}),xp=__esmMin(()=>{bp()});function parseDistinguishedName(e){if(!e)return{};let t={};for(let n of e.split(/,(?![^=]*=)/)){let e=n.indexOf(`=`);if(e<0)continue;let r=n.slice(0,e).trim(),i=n.slice(e+1).trim(),o=t[r];o===void 0?t[r]=i:Array.isArray(o)?o.push(i):t[r]=[o,i]}return t}function formatCertDate(e){if(!e)return``;try{return e.format(`%b %d %H:%M:%S %Y GMT`)??``}catch{return``}}function formatAltNames(e){let t=[],n=e.get_dns_names();if(n)for(let e of n){let n=e.get_data();n&&t.push(`DNS:${new TextDecoder(`utf-8`).decode(n)}`)}let r=e.get_ip_addresses();if(r)for(let e of r)t.push(`IP Address:${e.to_string()}`);return t.join(`, `)}function fingerprintFromBytes(e,t){try{let n=new W.Checksum(t);n.update(e);let r=n.get_string();if(!r)return``;let i=[];for(let e=0;e<r.length;e+=2)i.push(r.slice(e,e+2).toUpperCase());return i.join(`:`)}catch{return``}}function tlsCertToPeerCert(e,t){let n={};try{n.subject=parseDistinguishedName(e.get_subject_name())}catch{}try{n.issuer=parseDistinguishedName(e.get_issuer_name())}catch{}n.subjectaltname=formatAltNames(e);try{n.valid_from=formatCertDate(e.get_not_valid_before()),n.valid_to=formatCertDate(e.get_not_valid_after())}catch{}try{let t=e,r=t.certificate_pem??t.certificatePem;if(r){let e=pemToDer(r);n.raw=e,n.fingerprint=fingerprintFromBytes(e,W.ChecksumType.SHA1),n.fingerprint256=fingerprintFromBytes(e,W.ChecksumType.SHA256)}}catch{}if(t)try{let t=e.get_issuer();t&&!t.is_same(e)?n.issuerCertificate=tlsCertToPeerCert(t,!0):t&&(n.issuerCertificate=n)}catch{}return n}var Sp=__esmMin(()=>{gp(),G()});function isIP(e){if(typeof e!=`string`)return 0;let t=e.includes(`%`)?e.slice(0,e.indexOf(`%`)):e,n=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(t);if(n)return n.slice(1).every(e=>(e.length===1||e[0]!==`0`)&&Number(e)<=255)?4:0;if(t.length===0||!t.includes(`:`))return 0;let r=/:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/.exec(t),i=r?t.slice(0,t.length-r[0].length):t;if(r&&isIP(r[1])!==4)return 0;let o=i.split(`::`);if(o.length>2)return 0;let s=0;for(let e of o)if(e!==``)for(let t of e.split(`:`)){if(!/^[0-9a-fA-F]{1,4}$/.test(t))return 0;s++}let c=r?6:8;return o.length===2?s<c?6:0:s===c?6:0}function isIPv4(e){return isIP(e)===4}function isIPv6(e){return isIP(e)===6}var Cp=__esmMin(()=>{});function destroyedError(){let e=Error(`Cannot call write after a stream was destroyed`);return e.code=`ERR_STREAM_DESTROYED`,e}var Socket,wp=__esmMin(()=>{Z(),G(),Sa(),U(),kf(),Socket=class extends va{remoteAddress;remotePort;remoteFamily;localAddress;localPort;bytesRead=0;bytesWritten=0;connecting=!1;destroyed=!1;pending=!0;readyState=`closed`;_connection=null;_ioStream=null;_inputStream=null;_outputStream=null;_cancellable=new X.Cancellable;_readCancellable=new X.Cancellable;_reading=!1;_detaching=!1;_detachResolve=null;_pendingIo=0;_afterIo=null;_timeout=0;_timeoutId=null;constructor(e){super(e),this.allowHalfOpen=e?.allowHalfOpen??!1}_setConnection(e){this._connection=e}_setupFromIOStream(e){this._ioStream=e;try{let t=e;if(typeof t.get_socket==`function`){this._connection=t;let e=t.get_remote_address();this.remoteAddress=e.get_address().to_string(),this.remotePort=e.get_port(),this.remoteFamily=e.get_address().get_family()===X.SocketFamily.IPV6?`IPv6`:`IPv4`;let n=t.get_local_address();this.localAddress=n.get_address().to_string(),this.localPort=n.get_port()}}catch{}this._inputStream=e.get_input_stream(),this._outputStream=e.get_output_stream(),this.connecting=!1,this.pending=!1,this.readyState=`open`,this.emit(`connect`),this.emit(`ready`),this._startReading()}_attachOutputOnly(e){this._ioStream=e;try{let t=e;if(typeof t.get_socket==`function`){this._connection=t;let e=t.get_remote_address();this.remoteAddress=e.get_address().to_string(),this.remotePort=e.get_port(),this.remoteFamily=e.get_address().get_family()===X.SocketFamily.IPV6?`IPv6`:`IPv4`;let n=t.get_local_address();this.localAddress=n.get_address().to_string(),this.localPort=n.get_port()}}catch{}this._inputStream=e.get_input_stream(),this._outputStream=e.get_output_stream(),this.connecting=!1,this.pending=!1,this.readyState=`open`,this.emit(`connect`),this.emit(`ready`)}_releaseIOStream(){let e=this._ioStream;return this._ioStream=null,this._inputStream=null,this._outputStream=null,this._connection=null,e}_claimConnection(){let e={connection:this._connection,ioStream:this._ioStream,inputStream:this._inputStream,outputStream:this._outputStream};return this._connection=null,this._ioStream=null,this._inputStream=null,this._outputStream=null,e}connect(e,t,n){let r;typeof e==`number`?(r={port:e,host:typeof t==`string`?t:`localhost`},typeof t==`function`&&(n=t)):(r=e,typeof t==`function`&&(n=t)),n&&this.once(`connect`,n),this.connecting=!0,this.readyState=`opening`,this.pending=!0;let i=r.host||`localhost`,o=r.port,s=new X.SocketClient;return r.timeout&&s.set_timeout(Math.ceil(r.timeout/1e3)),s.connect_to_host_async(i,o,this._cancellable,(e,t)=>{try{let e=s.connect_to_host_finish(t);if(this.destroyed){e.close(null);return}this._connection=e,this._setupConnection(r)}catch(e){this.connecting=!1,this.readyState=`closed`;let t=createNodeError$1(e,`connect`,{address:i,port:o});this.destroy(t)}}),this}_setupConnection(e,t=!0){if(!this._connection)return;let n=this._connection.get_socket();if(this._inputStream=this._connection.get_input_stream(),this._outputStream=this._connection.get_output_stream(),`keepAlive`in e&&e.keepAlive&&n.set_keepalive(!0),!(`noDelay`in e)||e.noDelay!==!1)try{n.set_option(6,1,1)}catch{}try{let e=this._connection.get_remote_address();this.remoteAddress=e.get_address().to_string(),this.remotePort=e.get_port(),this.remoteFamily=e.get_address().get_family()===X.SocketFamily.IPV6?`IPv6`:`IPv4`}catch{}try{let e=this._connection.get_local_address();this.localAddress=e.get_address().to_string(),this.localPort=e.get_port()}catch{}this.connecting=!1,this.pending=!1,this.readyState=`open`,this.emit(`connect`),this.emit(`ready`),t&&this._startReading()}_startReading(){this._reading||!this._inputStream||(this._reading=!0,this._readLoop())}async _readLoop(){let e=this._inputStream;if(e)try{for(;this._reading&&e;){let t=await new Promise((t,n)=>{this._pendingIo++,e.read_bytes_async(16384,W.PRIORITY_DEFAULT,this._readCancellable,(r,i)=>{try{t(e.read_bytes_finish(i))}catch(e){n(e)}finally{this._ioSettled()}})});if(this._detaching){this._resolveDetach(t&&t.get_size()>0?H.from(gbytesToUint8Array(t)):null);return}if(!t||t.get_size()===0){this._reading=!1,this.allowHalfOpen?this.readyState=this.writable?`writeOnly`:`closed`:this.once(`end`,()=>{this.end(),this.readyState=`closed`}),this.push(null),this.read(0);break}let n=gbytesToUint8Array(t);if(this.bytesRead+=n.length,this._resetTimeout(),!this.push(H.from(n))){this._reading=!1;break}}}catch(e){if(this._detaching){this._resolveDetach(null);return}this._readCancellable.is_cancelled()||this.destroy(createNodeError$1(e,`read`,{address:this.remoteAddress}))}}_detachReader(){return this._reading?(this._detaching=!0,this._reading=!1,this._readCancellable.cancel(),new Promise(e=>{this._detachResolve=e})):Promise.resolve(null)}_resolveDetach(e){this._detaching=!1;let t=this._detachResolve;this._detachResolve=null,t&&t(e)}_read(e){!this._reading&&this._inputStream&&this._startReading()}_write(e,t,n){if(!this._outputStream){n(Error(`Socket is not connected`));return}let r=H.isBuffer(e)?e:typeof e==`string`?H.from(e,t):H.from(e),i=this._outputStream;this._pendingIo++,i.write_bytes_async(new W.Bytes(r),W.PRIORITY_DEFAULT,this._cancellable,(e,t)=>{let r=null;try{let e=i.write_bytes_finish(t);this.bytesWritten+=e,this._resetTimeout()}catch(e){r=this._cancellable.is_cancelled()?destroyedError():createNodeError$1(e,`write`,{address:this.remoteAddress})}this._ioSettled(),n(r)})}_final(e){if(this._connection)try{this._connection.get_socket().shutdown(!1,!0),this.readyState=this.readable?`readOnly`:`closed`}catch{}else if(this._ioStream){try{this._ioStream.close(null),this.readyState=`closed`}catch{}this._ioStream=null,this._inputStream=null,this._outputStream=null}e()}_destroy(e,t){this._reading=!1,this._clearTimeout(),this._cancellable.cancel(),this._readCancellable.cancel();let release=()=>this._release(e,t);this._pendingIo===0?release():this._afterIo=release}_ioSettled(){if(this._pendingIo--,this._pendingIo===0&&this._afterIo){let e=this._afterIo;this._afterIo=null,e()}}_release(e,t){if(this._connection){try{this._connection.close(null)}catch{}this._connection=null}else if(this._ioStream)try{this._ioStream.close(null)}catch{}this._ioStream=null,this._inputStream=null,this._outputStream=null,this.readyState=`closed`,this.destroyed=!0,t(e)}setTimeout(e,t){return this._timeout=e,this._clearTimeout(),t&&this.once(`timeout`,t),e>0&&this._resetTimeout(),this}_resetTimeout(){this._clearTimeout(),this._timeout>0&&(this._timeoutId=setTimeout(()=>{this.emit(`timeout`)},this._timeout))}_clearTimeout(){this._timeoutId!==null&&(clearTimeout(this._timeoutId),this._timeoutId=null)}setKeepAlive(e,t){return this._connection?.get_socket().set_keepalive(e??!1),this}setNoDelay(e){if(this._connection)try{this._connection.get_socket().set_option(6,1,e===!1?0:1)}catch{}return this}destroySoon(){this.writable&&this.end(),this.writableFinished?this.destroy():this.once(`finish`,this.destroy.bind(this))}address(){return this.localAddress&&this.localPort?{port:this.localPort,family:this.remoteFamily||`IPv4`,address:this.localAddress}:{}}ref(){return this}unref(){return this}}}),Tp,Server$1,Ep=__esmMin(()=>{wp(),Z(),kf(),Kn(),P(),Tp=new Set,Server$1=class extends K{static{__name(this,`Server`)}listening=!1;maxConnections;allowHalfOpen;_service=null;_connections=new Set;_closingService=null;_address=null;constructor(e,t){super(),typeof e==`function`?(t=e,this.allowHalfOpen=!1):this.allowHalfOpen=e?.allowHalfOpen??!1,t&&this.on(`connection`,t)}listen(...e){let t=0,n=`0.0.0.0`,r=511,i;if(typeof e[0]==`object`&&e[0]!==null&&!Array.isArray(e[0])){let o=e[0];t=o.port??0,n=o.host??`0.0.0.0`,r=o.backlog??511,i=e[1]}else{typeof e[0]==`number`&&(t=e[0]);for(let t=1;t<e.length;t++)typeof e[t]==`string`?n=e[t]:typeof e[t]==`number`?r=e[t]:typeof e[t]==`function`&&(i=e[t])}i&&this.once(`listening`,i);try{releaseListenPort(t),this._service=new X.SocketService,this._service.set_backlog(r);let e;t===0?e=this._service.add_any_inet_port(null):(this._service.add_inet_port(t,null),e=t),this._service.connect(`incoming`,(e,t)=>(this._handleConnection(t),!0)),this._service.start(),ensureMainLoop(),this.listening=!0,Tp.add(this);let i=n.includes(`:`)?`IPv6`:`IPv4`;this._address={port:e,family:i,address:n},deferEmit(this,`listening`)}catch(e){this._service=null;let r=createNodeError$1(e,`listen`,{address:n,port:t});deferEmit(this,`error`,r)}return this}_handleConnection(e){if(this.maxConnections&&this._connections.size>=this.maxConnections){try{e.close(null)}catch{}return}let t=new Socket({allowHalfOpen:this.allowHalfOpen});t._setConnection(e),t._setupConnection({},!1),this._connections.add(t),t.on(`close`,()=>{this._connections.delete(t),this._emitCloseIfDrained()}),this.emit(`connection`,t),t._startReading()}address(){return this._address}close(e){let t=this._service;return e&&this.once(`close`,t?e:()=>{let t=Error(`Server is not running.`);t.code=`ERR_SERVER_NOT_RUNNING`,e(t)}),t&&(this._service=null,this.listening=!1,this._closingService=t,closeSocketService(t,this._address?[this._address.port]:[],()=>{this._closingService===t&&(this._closingService=null),this._emitCloseIfDrained()})),this._emitCloseIfDrained(),this}_emitCloseIfDrained(){this._service||this._closingService||this._connections.size>0||(Tp.delete(this),nextTick(()=>this.emit(`close`)))}getConnections(e){e(null,this._connections.size)}ref(){return this}unref(){return this}}}),Dp=__exportAll$5({Server:()=>Server$1,Socket:()=>Socket,connect:()=>Op,createConnection:()=>createConnection,createServer:()=>createServer$1,default:()=>kp,isIP:()=>isIP,isIPv4:()=>isIPv4,isIPv6:()=>isIPv6});function createConnection(e,t,n){return new Socket().connect(e,t,n)}function createServer$1(e,t){return typeof e==`function`?new Server$1(e):new Server$1(e,t)}var Op,kp,Ap=__esmMin(()=>{Cp(),wp(),Ep(),Op=createConnection,__name(createServer$1,`createServer`),kp={Socket,Server:Server$1,isIP,isIPv4,isIPv6,createConnection,connect:Op,createServer:createServer$1}}),jp=__esmMin(()=>{N(),Sp(),vp(),xp(),Z(),G(),Ap()}),Mp=__esmMin(()=>{jp()}),Np=__esmMin(()=>{vp(),jp(),Z(),G(),Ap()}),Pp=__esmMin(()=>{bp()}),Fp=__esmMin(()=>{vp(),xp(),jp(),Mp(),Np(),Pp()});function resolveServerTls(e){let t=createSecureContext(e);if(e.cert&&!t.certificate)throw Error(`https.Server: cannot parse the key/cert pair as PEM`);if(!t.certificate)return null;let n=X.TlsAuthenticationMode.NONE;return e.requestCert&&(n=e.rejectUnauthorized===!1?X.TlsAuthenticationMode.REQUESTED:X.TlsAuthenticationMode.REQUIRED),{certificate:t.certificate,authenticationMode:n,clientCa:e.requestCert?t.caCertificates:[]}}function createTrustDatabase(e){let[t,n]=X.File.new_tmp(`gjsify-https-ca-XXXXXX.pem`);try{let r=e.map(e=>e.certificate_pem).join(`
233
- `);return n.get_output_stream().write_all(new TextEncoder().encode(r),null),n.close(null),{database:X.TlsFileDatabase.new(t.get_path()),file:t}}catch(e){throw removeFile(t),e}}function removeFile(e){try{e.delete(null)}catch{}}var Ip=__esmMin(()=>{Z(),Fp()}),Lp,Rp=__esmMin(()=>{Lp=u}),zp,Bp=__esmMin(()=>{Rp(),zp=Lp}),Vp,Hp,Up=__esmMin(()=>{if(P(),Vp=openNativeLibrary(`GjsifyHttpSoupBridge`),Vp)throw Vp;Hp=d.Server,d.Request,d.Response}),OutgoingMessage,ServerResponse,Wp,Server,Gp=__esmMin(()=>{N(),mp(),fp(),pp(),Ip(),Bp(),Z(),U(),Kn(),Sa(),wp(),Up(),P(),OutgoingMessage=class extends _a{headersSent=!1;sendDate=!0;finished=!1;socket=null;_headers=new Map;setHeader(e,t){return this._headers.set(e.toLowerCase(),typeof t==`number`?String(t):t),this}getHeader(e){return this._headers.get(e.toLowerCase())}removeHeader(e){this._headers.delete(e.toLowerCase())}hasHeader(e){return this._headers.has(e.toLowerCase())}getHeaderNames(){return Array.from(this._headers.keys())}getHeaders(){let e={};for(let[t,n]of this._headers)e[t]=n;return e}appendHeader(e,t){let n=e.toLowerCase(),r=this._headers.get(n);return r===void 0?this._headers.set(n,t):Array.isArray(r)?Array.isArray(t)?r.push(...t):r.push(t):Array.isArray(t)?this._headers.set(n,[r,...t]):this._headers.set(n,[r,t]),this}flushHeaders(){this.headersSent=!0}_write(e,t,n){n()}},ServerResponse=class extends OutgoingMessage{statusCode=200;statusMessage=``;_streaming=!1;_bridge;_timeoutTimer=null;constructor(e){super(),this._bridge=e,e.connect(`close`,()=>{this.emit(`close`)})}setTimeout(e,t){return this._timeoutTimer&&=(clearTimeout(this._timeoutTimer),null),t&&this.once(`timeout`,t),e>0&&(this._timeoutTimer=setTimeout(()=>{this._timeoutTimer=null,this.emit(`timeout`)},e)),this}writeHead(e,t,n){if(this.statusCode=e,typeof t==`object`&&(n=t,t=void 0),this.statusMessage=t||up[e]||``,n)for(let[e,t]of Object.entries(n))this.setHeader(e,t);return this}writeContinue(e){e&&Promise.resolve().then(e)}writeProcessing(e){e&&Promise.resolve().then(e)}flushHeaders(){this.headersSent||=!0}addTrailers(e){for(let[t,n]of Object.entries(e))this._headers.set(`trailer-`+t.toLowerCase(),n)}_startStreaming(){if(!this._streaming){this._streaming=!0,this.headersSent=!0,this._timeoutTimer&&=(clearTimeout(this._timeoutTimer),null);for(let[e,t]of this._headers)if(Array.isArray(t))for(let n of t)this._bridge.append_header(e,n);else this._bridge.set_header(e,t);this._bridge.write_head(this.statusCode,this.statusMessage||null)}}_write(e,t,n){let r=H.isBuffer(e)?e:typeof e==`string`?H.from(e,t):H.from(e);this._startStreaming(),this._bridge.write_chunk(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)),n()}_final(e){if(!this._streaming){for(let[e,t]of this._headers)if(Array.isArray(t))for(let n of t)this._bridge.append_header(e,n);else this._bridge.set_header(e,t);this._bridge.write_head(this.statusCode,this.statusMessage||null)}this._bridge.end(),this.finished=!0,e()}end(e,t,n){return typeof e==`function`?(n=e,e=void 0):typeof t==`function`&&(n=t,t=void 0),e!=null&&this.write(e,t),super.end(n),this}},Wp=new Set,Server=class extends K{listening=!1;maxHeadersCount=2e3;timeout=0;keepAliveTimeout=5e3;headersTimeout=6e4;requestTimeout=3e5;_bridge=null;_tls=null;_tlsRequested=!1;_trustFile=null;_address=null;get soupServer(){return this._bridge?.soup_server??null}constructor(e,t){super();let n=typeof e==`function`?e:t;n&&this.on(`request`,n)}_useTls(e){this._tlsRequested=!0,this._tls=resolveServerTls(e)}listen(...e){let t=0,n=`0.0.0.0`,r;for(let i of e)typeof i==`number`?t=i:typeof i==`string`?n=i:typeof i==`function`&&(r=i);if(this._tlsRequested&&!this._tls)return deferEmit(this,`error`,Error(`https.Server: no certificate — pass key and cert (PEM)`)),this;r&&this.once(`listening`,r);try{this._bridge=new Hp,this._bridge.connect(`request-received`,(e,t,n)=>{this._handleRequest(t,n)}),this._bridge.connect(`upgrade`,(e,t,n,r)=>{this._handleUpgrade(t,n)}),this._bridge.connect(`error-occurred`,(e,t)=>{this.emit(`error`,Error(t))});let e=this._tls?this._listenTls(this._bridge,t):this._listenPlain(this._bridge,t,n);ensureMainLoop(),this.listening=!0,this._address={port:e,family:`IPv4`,address:this._bridge.address||n},Wp.add(this),deferEmit(this,`listening`)}catch(e){let r=createNodeError$1(e,`listen`,{address:n,port:t});deferEmit(this,`error`,r)}return this}_listenPlain(e,t,n){return e.listen(t,n),e.port}_listenTls(e,t){let n=this._tls,r=e.soup_server;if(r.tls_certificate=n.certificate,r.tls_auth_mode=n.authenticationMode,n.clientCa.length>0){let e=createTrustDatabase(n.clientCa);r.tls_database=e.database,this._trustFile&&removeFile(this._trustFile),this._trustFile=e.file}if(n.authenticationMode!==X.TlsAuthenticationMode.NONE){let e=n.authenticationMode===X.TlsAuthenticationMode.REQUIRED;r.connect(`request-started`,(t,n)=>{n.connect(`accept-certificate`,(t,n,r)=>!e||r===X.TlsCertificateFlags.NO_FLAGS)})}try{r.listen_local(t,zp.ServerListenOptions.IPV4_ONLY|zp.ServerListenOptions.HTTPS)}catch(e){throw this._trustFile&&removeFile(this._trustFile),this._trustFile=null,e}return(r.get_listeners()[0]?.get_local_address())?.get_port()??t}_handleRequest(e,t){let n=new IncomingMessage,r=new ServerResponse(t);n.method=e.method,n.url=e.url,n.httpVersion=`1.1`;let i=e.header_pairs??[];for(let e=0;e+1<i.length;e+=2){let t=i[e],r=i[e+1],o=t.toLowerCase();if(n.rawHeaders.push(t,r),o in n.headers){let e=n.headers[o];Array.isArray(e)?e.push(r):n.headers[o]=[e,r]}else n.headers[o]=r}n.socket=new ServerRequestSocket(e.remote_address??`127.0.0.1`,e.remote_port??0,this._address?.address??`127.0.0.1`,this._address?.port??0,t,this._tls!==null);let o=e.get_body();o.length>0?n._pushBody(o):n._pushBody(null),e.connect(`aborted_signal`,()=>{n.aborted||(n.aborted=!0,n.emit(`aborted`))}),e.connect(`close`,()=>{n.emit(`close`)});try{let e=this.emit(`request`,n,r);(e instanceof Promise||typeof e==`object`&&e&&typeof e.then==`function`)&&e.catch(e=>{if(M.error(`[HTTP] Unhandled error in async request handler:`,e),!r.headersSent)try{r.writeHead(500),r.end(`Internal Server Error`)}catch{}})}catch(e){if(M.error(`[HTTP] Unhandled error in request handler:`,e),!r.headersSent)try{r.writeHead(500),r.end(`Internal Server Error`)}catch{}}}_handleUpgrade(e,t){let n=new IncomingMessage;n.method=e.method,n.url=e.url,n.httpVersion=`1.1`;let r=e.header_pairs??[];for(let e=0;e+1<r.length;e+=2){let t=r[e],i=r[e+1],o=t.toLowerCase();n.rawHeaders.push(t,i),n.headers[o]=i}if(this.listenerCount(`upgrade`)>0){let r=new Socket;r._attachOutputOnly(t),n.socket=r,r.remoteAddress??=e.remote_address||void 0,r.remotePort??=e.remote_port??void 0,r.remoteFamily??=r.remoteAddress?.includes(`:`)?`IPv6`:`IPv4`,r.localAddress??=this._address?.address,r.localPort??=this._address?.port,this.emit(`upgrade`,n,r,H.alloc(0))}}address(){return this._address}addWebSocketHandler(e,t){if(!this._bridge)throw Error(`Server must be listening before adding WebSocket handlers. Call listen() first.`);this._bridge.soup_server.add_websocket_handler(e,null,null,(e,n,r,i)=>{t(i)})}close(e){return e&&this.once(`close`,e),this._bridge&&=(this._tls?this._bridge.soup_server.disconnect():this._bridge.close(),null),this._trustFile&&=(removeFile(this._trustFile),null),this.listening=!1,Wp.delete(this),deferEmit(this,`close`),this}setTimeout(e,t){return this.timeout=e,t&&this.on(`timeout`,t),this}}});function resolveRejectUnauthorized(e){return e===void 0?W.getenv(`NODE_TLS_REJECT_UNAUTHORIZED`)!==`0`:e!==!1}function createPeerVerifier(e){let t=resolveRejectUnauthorized(e.rejectUnauthorized),n=e.checkServerIdentity??checkServerIdentity,r=e.caCertificates??[],i=null;return{accept(o){return i=chainError(o,r)??n(e.host,tlsCertToPeerCert(o,!0))??null,i===null||!t},get error(){return i},get authorized(){return i===null},get authorizationError(){if(i)return i.code??i.message}}}function chainFlags(e,t){if(t.length===0)return X.TlsBackend.get_default().get_default_database().verify_chain(e,X.TLS_DATABASE_PURPOSE_AUTHENTICATE_SERVER,null,null,X.TlsDatabaseVerifyFlags.NONE,null);let n=X.TlsCertificateFlags.UNKNOWN_CA;for(let r of t){let t=e.verify(null,r)&Kp;if(t===X.TlsCertificateFlags.NO_FLAGS)return t;t&X.TlsCertificateFlags.UNKNOWN_CA||(n=t)}return n}function isSelfSigned(e){return e.get_subject_name()===e.get_issuer_name()}function verifyError(e,t){let n=Error(t);return n.code=e,n}function chainError(e,t=[]){let n=chainFlags(e,t)&Kp,r=X.TlsCertificateFlags;if(n===r.NO_FLAGS)return null;if(n&r.UNKNOWN_CA){if(isSelfSigned(e))return verifyError(`DEPTH_ZERO_SELF_SIGNED_CERT`,`self-signed certificate`);let t=e;for(let e=t.get_issuer();e&&!e.is_same(t);e=t.get_issuer())t=e;return t===e?verifyError(`UNABLE_TO_VERIFY_LEAF_SIGNATURE`,`unable to verify the first certificate`):isSelfSigned(t)?verifyError(`SELF_SIGNED_CERT_IN_CHAIN`,`self-signed certificate in certificate chain`):verifyError(`UNABLE_TO_GET_ISSUER_CERT_LOCALLY`,`unable to get local issuer certificate`)}return n&r.REVOKED?verifyError(`CERT_REVOKED`,`certificate revoked`):n&r.EXPIRED?verifyError(`CERT_HAS_EXPIRED`,`certificate has expired`):n&r.NOT_ACTIVATED?verifyError(`CERT_NOT_YET_VALID`,`certificate is not yet valid`):n&r.INSECURE?verifyError(`CA_MD_TOO_WEAK`,`CA signature digest algorithm too weak`):verifyError(`CERT_REJECTED`,`certificate rejected`)}var Kp,qp=__esmMin(()=>{hp(),Sp(),vp(),Z(),G(),Kp=X.TlsCertificateFlags.VALIDATE_ALL&~X.TlsCertificateFlags.BAD_IDENTITY}),ClientRequest,Jp=__esmMin(()=>{pp(),Gp(),G(),Bp(),Z(),U(),Vr(),kf(),qp(),ClientRequest=class extends OutgoingMessage{method;path;protocol;host;hostname;port;aborted=!1;reusedSocket=!1;maxHeadersCount=2e3;_chunks=[];_session;_message;_cancellable;_timeout=0;_timeoutTimer=null;_responseCallback;_tlsRejection=null;constructor(e,t,n){super();let r;if(typeof e==`string`||e instanceof J){let i=typeof e==`string`?new J(e):e;r={protocol:i.protocol,hostname:i.hostname,port:i.port?Number(i.port):void 0,path:i.pathname+i.search,...typeof t==`object`?t:{}},typeof t==`function`&&(n=t)}else r=e,typeof t==`function`&&(n=t);if(this.method=(r.method||`GET`).toUpperCase(),this.protocol=r.protocol||`http:`,this.hostname=r.hostname||r.host?.split(`:`)[0]||`localhost`,this.port=Number(r.port)||(this.protocol===`https:`?443:80),this.path=r.path||`/`,this.host=r.host||`${this.hostname}:${this.port}`,this._timeout=r.timeout||0,n&&(this._responseCallback=n,this.once(`response`,n)),r.headers)for(let[e,t]of Object.entries(r.headers))this.setHeader(e,t);if(r.setHost!==!1&&!this._headers.has(`host`)){let e=this.protocol===`https:`?443:80,t=this.port===e?this.hostname:`${this.hostname}:${this.port}`;this.setHeader(`Host`,t)}r.auth&&!this._headers.has(`authorization`)&&this.setHeader(`Authorization`,`Basic `+H.from(r.auth).toString(`base64`)),r.signal&&(r.signal.aborted?this.abort():r.signal.addEventListener(`abort`,()=>this.abort(),{once:!0}));let i=W.Uri.parse(this._buildUrl(),W.UriFlags.NONE);this._session=new zp.Session,this._message=new zp.Message({method:this.method,uri:i}),this._cancellable=new X.Cancellable,this.protocol===`https:`&&this._setupTls(r),this._timeout>0&&(this._session.timeout=Math.ceil(this._timeout/1e3),this._timeoutTimer=setTimeout(()=>{this._timeoutTimer=null,this.emit(`timeout`)},this._timeout))}_setupTls(e){let t=e.agent===void 0?e._defaultAgent:e.agent,n=t&&typeof t==`object`?t.options:void 0,r={...e,...n},i=r.secureContext??createSecureContext(r),o=createPeerVerifier({caCertificates:i.caCertificates,rejectUnauthorized:r.rejectUnauthorized,host:r.servername||this.hostname,checkServerIdentity:r.checkServerIdentity});this._session.set_tls_database(null),this._message.connect(`accept-certificate`,(e,t,n)=>{let r=o.accept(t);return this._tlsRejection=r?null:o.error,r}),i.certificate&&this._message.set_tls_client_certificate(i.certificate)}_buildUrl(){let e=this.protocol.endsWith(`:`)?this.protocol:this.protocol+`:`,t=e===`https:`?443:80,n=this.port===t?``:`:${this.port}`;return`${e}//${this.hostname}${n}${this.path}`}getRawHeaderNames(){return Array.from(this._headers.keys())}flushHeaders(){this.headersSent||this._applyHeaders()}setTimeout(e,t){return this._timeout=e,this._timeoutTimer&&=(clearTimeout(this._timeoutTimer),null),t&&this.once(`timeout`,t),e>0&&(this._session.timeout=Math.ceil(e/1e3),this._timeoutTimer=setTimeout(()=>{this._timeoutTimer=null,this.emit(`timeout`)},e)),this}abort(){this.aborted||(this.aborted=!0,this._timeoutTimer&&=(clearTimeout(this._timeoutTimer),null),this._cancellable.cancel(),this.emit(`abort`),this.destroy())}_write(e,t,n){let r=H.isBuffer(e)?e:typeof e==`string`?H.from(e,t):H.from(e);this._chunks.push(r),n()}_final(e){this._sendRequest().then(()=>e()).catch(t=>e(t))}_applyHeaders(){if(this.headersSent)return;this.headersSent=!0;let e=this._message.get_request_headers();for(let[t,n]of this._headers)if(Array.isArray(n))for(let r of n)e.append(t,r);else e.replace(t,n)}async _sendRequest(){this._applyHeaders();let e=H.concat(this._chunks);if(e.length>0){let t=this._headers.get(`content-type`)||`application/octet-stream`;this._message.set_request_body_from_bytes(t,new W.Bytes(e))}try{let e=await new Promise((e,t)=>{this._session.send_async(this._message,W.PRIORITY_DEFAULT,this._cancellable,(n,r)=>{try{e(this._session.send_finish(r))}catch(e){t(e)}})}),t=[];try{let n;for(;(n=await readBytesAsync(e,4096,W.PRIORITY_DEFAULT,this._cancellable))!==null;)t.push(H.from(n))}catch{}let n=new IncomingMessage;n.statusCode=this._message.status_code,n.statusMessage=this._message.get_reason_phrase(),n.httpVersion=`1.1`,this._message.get_response_headers().foreach((e,t)=>{let r=e.toLowerCase();if(n.rawHeaders.push(e,t),r in n.headers){let e=n.headers[r];Array.isArray(e)?e.push(t):n.headers[r]=[e,t]}else n.headers[r]=t}),this.finished=!0,this._timeoutTimer&&=(clearTimeout(this._timeoutTimer),null),this.emit(`response`,n),setTimeout(()=>{for(let e of t)n.push(e);n.push(null),n.complete=!0},0)}catch(e){this.aborted?this.emit(`abort`):this._tlsRejection?this.emit(`error`,this._tlsRejection):this.emit(`error`,e instanceof Error?e:Error(String(e)))}}}}),Yp=__exportAll$5({Agent:()=>Agent,ClientRequest:()=>ClientRequest,IncomingMessage:()=>IncomingMessage,METHODS:()=>dp,OutgoingMessage:()=>OutgoingMessage,STATUS_CODES:()=>up,Server:()=>Server,ServerResponse:()=>ServerResponse,createServer:()=>createServer,default:()=>Qp,get:()=>get,globalAgent:()=>Xp,maxHeaderSize:()=>Zp,request:()=>request,setMaxIdleHTTPParsers:()=>setMaxIdleHTTPParsers,validateHeaderName:()=>validateHeaderName,validateHeaderValue:()=>validateHeaderValue});function createServer(e,t){return typeof e==`function`?new Server(e):new Server(t)}function request(e,t,n){return new ClientRequest(e,t,n)}function get(e,t,n){let r,i=n;typeof e==`string`||e instanceof J?(r=typeof t==`object`?{...t,method:`GET`}:{method:`GET`},typeof t==`function`&&(i=t)):(r={...e,method:`GET`},typeof t==`function`&&(i=t),e=r);let o=typeof e==`string`||e instanceof J?new ClientRequest(e,{...r,method:`GET`},i):new ClientRequest({...r,method:`GET`},i);return o.end(),o}function setMaxIdleHTTPParsers(e){}var Agent,Xp,Zp,Qp,$p=__esmMin(()=>{lp(),fp(),pp(),Gp(),Jp(),Vr(),Agent=class{defaultPort=80;protocol=`http:`;maxSockets;maxTotalSockets;maxFreeSockets;keepAliveMsecs;keepAlive;scheduling;requests={};sockets={};freeSockets={};options;constructor(e){this.options={...e},this.keepAlive=e?.keepAlive??!1,this.keepAliveMsecs=e?.keepAliveMsecs??1e3,this.maxSockets=e?.maxSockets??1/0,this.maxTotalSockets=e?.maxTotalSockets??1/0,this.maxFreeSockets=e?.maxFreeSockets??256,this.scheduling=e?.scheduling??`lifo`}destroy(){}getName(e){let t=e.host||`localhost`;return e.port&&(t+=`:`+e.port),e.localAddress&&(t+=`:`+e.localAddress),(e.family===4||e.family===6)&&(t+=`:`+e.family),t}},Xp=new Agent,Zp=16384,Qp={STATUS_CODES:up,METHODS:dp,Server,IncomingMessage,OutgoingMessage,ServerResponse,ClientRequest,Agent,globalAgent:Xp,createServer,request,get,validateHeaderName,validateHeaderValue,maxHeaderSize:Zp,setMaxIdleHTTPParsers}}),em=__commonJSMin(((e,t)=>{
232
+ `):typeof e==`string`?e:e instanceof Uint8Array?new TextDecoder(`utf-8`).decode(e):String(e)}function splitPemBlocks(e){let t=[],n=/-----BEGIN [^-]+-----[\s\S]*?-----END [^-]+-----/g,r;for(;(r=n.exec(e))!==null;)t.push(r[0]);return t}function buildGioCertificate(e,t){let n=pemToString(e),r=t?pemToString(t):``,i=r?`${n}\n${r}`:n;return X.TlsCertificate.new_from_pem(i,i.length)}function buildCaCertificates(e){let t=[];if(Array.isArray(e))for(let n of e)t.push(...splitPemBlocks(pemToString(n)));else t.push(...splitPemBlocks(pemToString(e)));let n=[];for(let e of t)try{n.push(X.TlsCertificate.new_from_pem(e,e.length))}catch{}return n}function pemToDer(e){let t=/-----BEGIN CERTIFICATE-----([\s\S]*?)-----END CERTIFICATE-----/.exec(e);if(!t)return new Uint8Array;let n=t[1].replace(/[\s\r\n]+/g,``);try{let e=globalThis.atob;if(!e)return new Uint8Array;let t=e(n),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return r}catch{return new Uint8Array}}var gp=__esmMin(()=>{Z()});function createSecureContext(e){let t=e??{},n=null;if(t.cert)try{n=buildGioCertificate(t.cert,t.key)}catch{n=null}let r=t.ca?buildCaCertificates(t.ca):[],i={certificate:n,caCertificates:r,options:t};return i.context=i,i}var vp=__esmMin(()=>{gp()}),yp,bp=__esmMin(()=>{P(),yp=loadOptionalNativeModule(`GjsifyTls`,[`Tls`,`SessionAccess`]),yp.module}),xp=__esmMin(()=>{bp()});function parseDistinguishedName(e){if(!e)return{};let t={};for(let n of e.split(/,(?![^=]*=)/)){let e=n.indexOf(`=`);if(e<0)continue;let r=n.slice(0,e).trim(),i=n.slice(e+1).trim(),o=t[r];o===void 0?t[r]=i:Array.isArray(o)?o.push(i):t[r]=[o,i]}return t}function formatCertDate(e){if(!e)return``;try{return e.format(`%b %d %H:%M:%S %Y GMT`)??``}catch{return``}}function formatAltNames(e){let t=[],n=e.get_dns_names();if(n)for(let e of n){let n=e.get_data();n&&t.push(`DNS:${new TextDecoder(`utf-8`).decode(n)}`)}let r=e.get_ip_addresses();if(r)for(let e of r)t.push(`IP Address:${e.to_string()}`);return t.join(`, `)}function fingerprintFromBytes(e,t){try{let n=new W.Checksum(t);n.update(e);let r=n.get_string();if(!r)return``;let i=[];for(let e=0;e<r.length;e+=2)i.push(r.slice(e,e+2).toUpperCase());return i.join(`:`)}catch{return``}}function tlsCertToPeerCert(e,t){let n={};try{n.subject=parseDistinguishedName(e.get_subject_name())}catch{}try{n.issuer=parseDistinguishedName(e.get_issuer_name())}catch{}n.subjectaltname=formatAltNames(e);try{n.valid_from=formatCertDate(e.get_not_valid_before()),n.valid_to=formatCertDate(e.get_not_valid_after())}catch{}try{let t=e,r=t.certificate_pem??t.certificatePem;if(r){let e=pemToDer(r);n.raw=e,n.fingerprint=fingerprintFromBytes(e,W.ChecksumType.SHA1),n.fingerprint256=fingerprintFromBytes(e,W.ChecksumType.SHA256)}}catch{}if(t)try{let t=e.get_issuer();t&&!t.is_same(e)?n.issuerCertificate=tlsCertToPeerCert(t,!0):t&&(n.issuerCertificate=n)}catch{}return n}var Sp=__esmMin(()=>{gp(),G()});function resolveRejectUnauthorized(e){return e===void 0?W.getenv(`NODE_TLS_REJECT_UNAUTHORIZED`)!==`0`:e!==!1}function createPeerVerifier(e){let t=resolveRejectUnauthorized(e.rejectUnauthorized),n=e.checkServerIdentity??checkServerIdentity,r=e.caCertificates??[],i=null;return{accept(o){return i=chainError(o,r)??n(e.host,tlsCertToPeerCert(o,!0))??null,i===null||!t},get error(){return i},get authorized(){return i===null},get authorizationError(){if(i)return i.code??i.message}}}function chainFlags(e,t){if(t.length===0)return X.TlsBackend.get_default().get_default_database().verify_chain(e,X.TLS_DATABASE_PURPOSE_AUTHENTICATE_SERVER,null,null,X.TlsDatabaseVerifyFlags.NONE,null);let n=X.TlsCertificateFlags.UNKNOWN_CA;for(let r of t){let t=e.verify(null,r)&chainFlagsMask();if(t===X.TlsCertificateFlags.NO_FLAGS)return t;t&X.TlsCertificateFlags.UNKNOWN_CA||(n=t)}return n}function isSelfSigned(e){return e.get_subject_name()===e.get_issuer_name()}function verifyError(e,t){let n=Error(t);return n.code=e,n}function chainError(e,t=[]){let n=chainFlags(e,t)&chainFlagsMask(),r=X.TlsCertificateFlags;if(n===r.NO_FLAGS)return null;if(n&r.UNKNOWN_CA){if(isSelfSigned(e))return verifyError(`DEPTH_ZERO_SELF_SIGNED_CERT`,`self-signed certificate`);let t=e;for(let e=t.get_issuer();e&&!e.is_same(t);e=t.get_issuer())t=e;return t===e?verifyError(`UNABLE_TO_VERIFY_LEAF_SIGNATURE`,`unable to verify the first certificate`):isSelfSigned(t)?verifyError(`SELF_SIGNED_CERT_IN_CHAIN`,`self-signed certificate in certificate chain`):verifyError(`UNABLE_TO_GET_ISSUER_CERT_LOCALLY`,`unable to get local issuer certificate`)}return n&r.REVOKED?verifyError(`CERT_REVOKED`,`certificate revoked`):n&r.EXPIRED?verifyError(`CERT_HAS_EXPIRED`,`certificate has expired`):n&r.NOT_ACTIVATED?verifyError(`CERT_NOT_YET_VALID`,`certificate is not yet valid`):n&r.INSECURE?verifyError(`CA_MD_TOO_WEAK`,`CA signature digest algorithm too weak`):verifyError(`CERT_REJECTED`,`certificate rejected`)}var chainFlagsMask,Cp=__esmMin(()=>{hp(),Sp(),vp(),Z(),G(),chainFlagsMask=()=>X.TlsCertificateFlags.VALIDATE_ALL&~X.TlsCertificateFlags.BAD_IDENTITY});function isIP(e){if(typeof e!=`string`)return 0;let t=e.includes(`%`)?e.slice(0,e.indexOf(`%`)):e,n=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(t);if(n)return n.slice(1).every(e=>(e.length===1||e[0]!==`0`)&&Number(e)<=255)?4:0;if(t.length===0||!t.includes(`:`))return 0;let r=/:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/.exec(t),i=r?t.slice(0,t.length-r[0].length):t;if(r&&isIP(r[1])!==4)return 0;let o=i.split(`::`);if(o.length>2)return 0;let s=0;for(let e of o)if(e!==``)for(let t of e.split(`:`)){if(!/^[0-9a-fA-F]{1,4}$/.test(t))return 0;s++}let c=r?6:8;return o.length===2?s<c?6:0:s===c?6:0}function isIPv4(e){return isIP(e)===4}function isIPv6(e){return isIP(e)===6}var wp=__esmMin(()=>{});function destroyedError(){let e=Error(`Cannot call write after a stream was destroyed`);return e.code=`ERR_STREAM_DESTROYED`,e}var Socket,Tp=__esmMin(()=>{Z(),G(),Sa(),U(),kf(),Socket=class extends va{remoteAddress;remotePort;remoteFamily;localAddress;localPort;bytesRead=0;bytesWritten=0;connecting=!1;destroyed=!1;pending=!0;readyState=`closed`;_connection=null;_ioStream=null;_inputStream=null;_outputStream=null;_cancellable=new X.Cancellable;_readCancellable=new X.Cancellable;_reading=!1;_detaching=!1;_detachResolve=null;_pendingIo=0;_afterIo=null;_timeout=0;_timeoutId=null;constructor(e){super(e),this.allowHalfOpen=e?.allowHalfOpen??!1}_setConnection(e){this._connection=e}_setupFromIOStream(e){this._ioStream=e;try{let t=e;if(typeof t.get_socket==`function`){this._connection=t;let e=t.get_remote_address();this.remoteAddress=e.get_address().to_string(),this.remotePort=e.get_port(),this.remoteFamily=e.get_address().get_family()===X.SocketFamily.IPV6?`IPv6`:`IPv4`;let n=t.get_local_address();this.localAddress=n.get_address().to_string(),this.localPort=n.get_port()}}catch{}this._inputStream=e.get_input_stream(),this._outputStream=e.get_output_stream(),this.connecting=!1,this.pending=!1,this.readyState=`open`,this.emit(`connect`),this.emit(`ready`),this._startReading()}_attachOutputOnly(e){this._ioStream=e;try{let t=e;if(typeof t.get_socket==`function`){this._connection=t;let e=t.get_remote_address();this.remoteAddress=e.get_address().to_string(),this.remotePort=e.get_port(),this.remoteFamily=e.get_address().get_family()===X.SocketFamily.IPV6?`IPv6`:`IPv4`;let n=t.get_local_address();this.localAddress=n.get_address().to_string(),this.localPort=n.get_port()}}catch{}this._inputStream=e.get_input_stream(),this._outputStream=e.get_output_stream(),this.connecting=!1,this.pending=!1,this.readyState=`open`,this.emit(`connect`),this.emit(`ready`)}_releaseIOStream(){let e=this._ioStream;return this._ioStream=null,this._inputStream=null,this._outputStream=null,this._connection=null,e}_claimConnection(){let e={connection:this._connection,ioStream:this._ioStream,inputStream:this._inputStream,outputStream:this._outputStream};return this._connection=null,this._ioStream=null,this._inputStream=null,this._outputStream=null,e}connect(e,t,n){let r;typeof e==`number`?(r={port:e,host:typeof t==`string`?t:`localhost`},typeof t==`function`&&(n=t)):(r=e,typeof t==`function`&&(n=t)),n&&this.once(`connect`,n),this.connecting=!0,this.readyState=`opening`,this.pending=!0;let i=r.host||`localhost`,o=r.port,s=new X.SocketClient;return r.timeout&&s.set_timeout(Math.ceil(r.timeout/1e3)),s.connect_to_host_async(i,o,this._cancellable,(e,t)=>{try{let e=s.connect_to_host_finish(t);if(this.destroyed){e.close(null);return}this._connection=e,this._setupConnection(r)}catch(e){this.connecting=!1,this.readyState=`closed`;let t=createNodeError$1(e,`connect`,{address:i,port:o});this.destroy(t)}}),this}_setupConnection(e,t=!0){if(!this._connection)return;let n=this._connection.get_socket();if(this._inputStream=this._connection.get_input_stream(),this._outputStream=this._connection.get_output_stream(),`keepAlive`in e&&e.keepAlive&&n.set_keepalive(!0),!(`noDelay`in e)||e.noDelay!==!1)try{n.set_option(6,1,1)}catch{}try{let e=this._connection.get_remote_address();this.remoteAddress=e.get_address().to_string(),this.remotePort=e.get_port(),this.remoteFamily=e.get_address().get_family()===X.SocketFamily.IPV6?`IPv6`:`IPv4`}catch{}try{let e=this._connection.get_local_address();this.localAddress=e.get_address().to_string(),this.localPort=e.get_port()}catch{}this.connecting=!1,this.pending=!1,this.readyState=`open`,this.emit(`connect`),this.emit(`ready`),t&&this._startReading()}_startReading(){this._reading||!this._inputStream||(this._reading=!0,this._readLoop())}async _readLoop(){let e=this._inputStream;if(e)try{for(;this._reading&&e;){let t=await new Promise((t,n)=>{this._pendingIo++,e.read_bytes_async(16384,W.PRIORITY_DEFAULT,this._readCancellable,(r,i)=>{try{t(e.read_bytes_finish(i))}catch(e){n(e)}finally{this._ioSettled()}})});if(this._detaching){this._resolveDetach(t&&t.get_size()>0?H.from(gbytesToUint8Array(t)):null);return}if(!t||t.get_size()===0){this._reading=!1,this.allowHalfOpen?this.readyState=this.writable?`writeOnly`:`closed`:this.once(`end`,()=>{this.end(),this.readyState=`closed`}),this.push(null),this.read(0);break}let n=gbytesToUint8Array(t);if(this.bytesRead+=n.length,this._resetTimeout(),!this.push(H.from(n))){this._reading=!1;break}}}catch(e){if(this._detaching){this._resolveDetach(null);return}this._readCancellable.is_cancelled()||this.destroy(createNodeError$1(e,`read`,{address:this.remoteAddress}))}}_detachReader(){return this._reading?(this._detaching=!0,this._reading=!1,this._readCancellable.cancel(),new Promise(e=>{this._detachResolve=e})):Promise.resolve(null)}_resolveDetach(e){this._detaching=!1;let t=this._detachResolve;this._detachResolve=null,t&&t(e)}_read(e){!this._reading&&this._inputStream&&this._startReading()}_write(e,t,n){if(!this._outputStream){n(Error(`Socket is not connected`));return}let r=H.isBuffer(e)?e:typeof e==`string`?H.from(e,t):H.from(e),i=this._outputStream;this._pendingIo++,i.write_bytes_async(new W.Bytes(r),W.PRIORITY_DEFAULT,this._cancellable,(e,t)=>{let r=null;try{let e=i.write_bytes_finish(t);this.bytesWritten+=e,this._resetTimeout()}catch(e){r=this._cancellable.is_cancelled()?destroyedError():createNodeError$1(e,`write`,{address:this.remoteAddress})}this._ioSettled(),n(r)})}_final(e){if(this._connection)try{this._connection.get_socket().shutdown(!1,!0),this.readyState=this.readable?`readOnly`:`closed`}catch{}else if(this._ioStream){try{this._ioStream.close(null),this.readyState=`closed`}catch{}this._ioStream=null,this._inputStream=null,this._outputStream=null}e()}_destroy(e,t){this._reading=!1,this._clearTimeout(),this._cancellable.cancel(),this._readCancellable.cancel();let release=()=>this._release(e,t);this._pendingIo===0?release():this._afterIo=release}_ioSettled(){if(this._pendingIo--,this._pendingIo===0&&this._afterIo){let e=this._afterIo;this._afterIo=null,e()}}_release(e,t){if(this._connection){try{this._connection.close(null)}catch{}this._connection=null}else if(this._ioStream)try{this._ioStream.close(null)}catch{}this._ioStream=null,this._inputStream=null,this._outputStream=null,this.readyState=`closed`,this.destroyed=!0,t(e)}setTimeout(e,t){return this._timeout=e,this._clearTimeout(),t&&this.once(`timeout`,t),e>0&&this._resetTimeout(),this}_resetTimeout(){this._clearTimeout(),this._timeout>0&&(this._timeoutId=setTimeout(()=>{this.emit(`timeout`)},this._timeout))}_clearTimeout(){this._timeoutId!==null&&(clearTimeout(this._timeoutId),this._timeoutId=null)}_gioSocket(){let e=this._connection;for(;e instanceof X.TlsConnection;)e=e.base_io_stream;return e instanceof X.SocketConnection?e.get_socket():null}setKeepAlive(e,t){return this._gioSocket()?.set_keepalive(e??!1),this}setNoDelay(e){try{this._gioSocket()?.set_option(6,1,e===!1?0:1)}catch{}return this}destroySoon(){this.writable&&this.end(),this.writableFinished?this.destroy():this.once(`finish`,this.destroy.bind(this))}address(){return this.localAddress&&this.localPort?{port:this.localPort,family:this.remoteFamily||`IPv4`,address:this.localAddress}:{}}ref(){return this}unref(){return this}}}),Ep,Server$1,Dp=__esmMin(()=>{Tp(),Z(),kf(),Kn(),P(),Ep=new Set,Server$1=class extends K{static{__name(this,`Server`)}listening=!1;maxConnections;allowHalfOpen;_service=null;_connections=new Set;_closingService=null;_address=null;constructor(e,t){super(),typeof e==`function`?(t=e,this.allowHalfOpen=!1):this.allowHalfOpen=e?.allowHalfOpen??!1,t&&this.on(`connection`,t)}listen(...e){let t=0,n=`0.0.0.0`,r=511,i;if(typeof e[0]==`object`&&e[0]!==null&&!Array.isArray(e[0])){let o=e[0];t=o.port??0,n=o.host??`0.0.0.0`,r=o.backlog??511,i=e[1]}else{typeof e[0]==`number`&&(t=e[0]);for(let t=1;t<e.length;t++)typeof e[t]==`string`?n=e[t]:typeof e[t]==`number`?r=e[t]:typeof e[t]==`function`&&(i=e[t])}i&&this.once(`listening`,i);try{releaseListenPort(t),this._service=new X.SocketService,this._service.set_backlog(r);let e;t===0?e=this._service.add_any_inet_port(null):(this._service.add_inet_port(t,null),e=t),this._service.connect(`incoming`,(e,t)=>(this._handleConnection(t),!0)),this._service.start(),ensureMainLoop(),this.listening=!0,Ep.add(this);let i=n.includes(`:`)?`IPv6`:`IPv4`;this._address={port:e,family:i,address:n},deferEmit(this,`listening`)}catch(e){this._service=null;let r=createNodeError$1(e,`listen`,{address:n,port:t});deferEmit(this,`error`,r)}return this}_handleConnection(e){if(this.maxConnections&&this._connections.size>=this.maxConnections){try{e.close(null)}catch{}return}let t=new Socket({allowHalfOpen:this.allowHalfOpen});t._setConnection(e),t._setupConnection({},!1),this._connections.add(t),t.on(`close`,()=>{this._connections.delete(t),this._emitCloseIfDrained()}),this.emit(`connection`,t),t._startReading()}address(){return this._address}close(e){let t=this._service;return e&&this.once(`close`,t?e:()=>{let t=Error(`Server is not running.`);t.code=`ERR_SERVER_NOT_RUNNING`,e(t)}),t&&(this._service=null,this.listening=!1,this._closingService=t,closeSocketService(t,this._address?[this._address.port]:[],()=>{this._closingService===t&&(this._closingService=null),this._emitCloseIfDrained()})),this._emitCloseIfDrained(),this}_emitCloseIfDrained(){this._service||this._closingService||this._connections.size>0||(Ep.delete(this),nextTick(()=>this.emit(`close`)))}getConnections(e){e(null,this._connections.size)}ref(){return this}unref(){return this}}}),Op=__exportAll$5({Server:()=>Server$1,Socket:()=>Socket,connect:()=>kp,createConnection:()=>createConnection,createServer:()=>createServer$1,default:()=>Ap,isIP:()=>isIP,isIPv4:()=>isIPv4,isIPv6:()=>isIPv6});function createConnection(e,t,n){return new Socket().connect(e,t,n)}function createServer$1(e,t){return typeof e==`function`?new Server$1(e):new Server$1(e,t)}var kp,Ap,jp=__esmMin(()=>{wp(),Tp(),Dp(),kp=createConnection,__name(createServer$1,`createServer`),Ap={Socket,Server:Server$1,isIP,isIPv4,isIPv6,createConnection,connect:kp,createServer:createServer$1}}),Mp=__esmMin(()=>{N(),Sp(),vp(),xp(),Cp(),Z(),G(),jp()}),Np=__esmMin(()=>{Mp()}),Pp=__esmMin(()=>{vp(),Mp(),Z(),G(),jp()}),Fp=__esmMin(()=>{bp()}),Ip=__esmMin(()=>{vp(),xp(),Mp(),Np(),Pp(),Fp()});function resolveServerTls(e){let t=createSecureContext(e);if(e.cert&&!t.certificate)throw Error(`https.Server: cannot parse the key/cert pair as PEM`);if(!t.certificate)return null;let n=X.TlsAuthenticationMode.NONE;return e.requestCert&&(n=e.rejectUnauthorized===!1?X.TlsAuthenticationMode.REQUESTED:X.TlsAuthenticationMode.REQUIRED),{certificate:t.certificate,authenticationMode:n,clientCa:e.requestCert?t.caCertificates:[]}}function createTrustDatabase(e){let[t,n]=X.File.new_tmp(`gjsify-https-ca-XXXXXX.pem`);try{let r=e.map(e=>e.certificate_pem).join(`
233
+ `);return n.get_output_stream().write_all(new TextEncoder().encode(r),null),n.close(null),{database:X.TlsFileDatabase.new(t.get_path()),file:t}}catch(e){throw removeFile(t),e}}function removeFile(e){try{e.delete(null)}catch{}}var Lp=__esmMin(()=>{Z(),Ip()}),Rp,zp=__esmMin(()=>{Rp=u}),Bp,Vp=__esmMin(()=>{zp(),Bp=Rp}),Hp,Up,Wp=__esmMin(()=>{if(P(),Hp=openNativeLibrary(`GjsifyHttpSoupBridge`),Hp)throw Hp;Up=d.Server,d.Request,d.Response}),OutgoingMessage,ServerResponse,Gp,Server,Kp=__esmMin(()=>{N(),mp(),fp(),pp(),Lp(),Vp(),Z(),U(),Kn(),Sa(),Tp(),Wp(),P(),OutgoingMessage=class extends _a{headersSent=!1;sendDate=!0;finished=!1;socket=null;_headers=new Map;setHeader(e,t){return this._headers.set(e.toLowerCase(),typeof t==`number`?String(t):t),this}getHeader(e){return this._headers.get(e.toLowerCase())}removeHeader(e){this._headers.delete(e.toLowerCase())}hasHeader(e){return this._headers.has(e.toLowerCase())}getHeaderNames(){return Array.from(this._headers.keys())}getHeaders(){let e={};for(let[t,n]of this._headers)e[t]=n;return e}appendHeader(e,t){let n=e.toLowerCase(),r=this._headers.get(n);return r===void 0?this._headers.set(n,t):Array.isArray(r)?Array.isArray(t)?r.push(...t):r.push(t):Array.isArray(t)?this._headers.set(n,[r,...t]):this._headers.set(n,[r,t]),this}flushHeaders(){this.headersSent=!0}_write(e,t,n){n()}},ServerResponse=class extends OutgoingMessage{statusCode=200;statusMessage=``;_streaming=!1;_bridge;_timeoutTimer=null;constructor(e){super(),this._bridge=e,e.connect(`close`,()=>{this.emit(`close`)})}setTimeout(e,t){return this._timeoutTimer&&=(clearTimeout(this._timeoutTimer),null),t&&this.once(`timeout`,t),e>0&&(this._timeoutTimer=setTimeout(()=>{this._timeoutTimer=null,this.emit(`timeout`)},e)),this}writeHead(e,t,n){if(this.statusCode=e,typeof t==`object`&&(n=t,t=void 0),this.statusMessage=t||up[e]||``,n)for(let[e,t]of Object.entries(n))this.setHeader(e,t);return this}writeContinue(e){e&&Promise.resolve().then(e)}writeProcessing(e){e&&Promise.resolve().then(e)}flushHeaders(){this.headersSent||=!0}addTrailers(e){for(let[t,n]of Object.entries(e))this._headers.set(`trailer-`+t.toLowerCase(),n)}_startStreaming(){if(!this._streaming){this._streaming=!0,this.headersSent=!0,this._timeoutTimer&&=(clearTimeout(this._timeoutTimer),null);for(let[e,t]of this._headers)if(Array.isArray(t))for(let n of t)this._bridge.append_header(e,n);else this._bridge.set_header(e,t);this._bridge.write_head(this.statusCode,this.statusMessage||null)}}_write(e,t,n){let r=H.isBuffer(e)?e:typeof e==`string`?H.from(e,t):H.from(e);this._startStreaming(),this._bridge.write_chunk(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)),n()}_final(e){if(!this._streaming){for(let[e,t]of this._headers)if(Array.isArray(t))for(let n of t)this._bridge.append_header(e,n);else this._bridge.set_header(e,t);this._bridge.write_head(this.statusCode,this.statusMessage||null)}this._bridge.end(),this.finished=!0,e()}end(e,t,n){return typeof e==`function`?(n=e,e=void 0):typeof t==`function`&&(n=t,t=void 0),e!=null&&this.write(e,t),super.end(n),this}},Gp=new Set,Server=class extends K{listening=!1;maxHeadersCount=2e3;timeout=0;keepAliveTimeout=5e3;headersTimeout=6e4;requestTimeout=3e5;_bridge=null;_tls=null;_tlsRequested=!1;_trustFile=null;_address=null;get soupServer(){return this._bridge?.soup_server??null}constructor(e,t){super();let n=typeof e==`function`?e:t;n&&this.on(`request`,n)}_useTls(e){this._tlsRequested=!0,this._tls=resolveServerTls(e)}listen(...e){let t=0,n=`0.0.0.0`,r;for(let i of e)typeof i==`number`?t=i:typeof i==`string`?n=i:typeof i==`function`&&(r=i);if(this._tlsRequested&&!this._tls)return deferEmit(this,`error`,Error(`https.Server: no certificate — pass key and cert (PEM)`)),this;r&&this.once(`listening`,r);try{this._bridge=new Up,this._bridge.connect(`request-received`,(e,t,n)=>{this._handleRequest(t,n)}),this._bridge.connect(`upgrade`,(e,t,n,r)=>{this._handleUpgrade(t,n)}),this._bridge.connect(`error-occurred`,(e,t)=>{this.emit(`error`,Error(t))});let e=this._tls?this._listenTls(this._bridge,t):this._listenPlain(this._bridge,t,n);ensureMainLoop(),this.listening=!0,this._address={port:e,family:`IPv4`,address:this._bridge.address||n},Gp.add(this),deferEmit(this,`listening`)}catch(e){let r=createNodeError$1(e,`listen`,{address:n,port:t});deferEmit(this,`error`,r)}return this}_listenPlain(e,t,n){return e.listen(t,n),e.port}_listenTls(e,t){let n=this._tls,r=e.soup_server;if(r.tls_certificate=n.certificate,r.tls_auth_mode=n.authenticationMode,n.clientCa.length>0){let e=createTrustDatabase(n.clientCa);r.tls_database=e.database,this._trustFile&&removeFile(this._trustFile),this._trustFile=e.file}if(n.authenticationMode!==X.TlsAuthenticationMode.NONE){let e=n.authenticationMode===X.TlsAuthenticationMode.REQUIRED;r.connect(`request-started`,(t,n)=>{n.connect(`accept-certificate`,(t,n,r)=>!e||r===X.TlsCertificateFlags.NO_FLAGS)})}try{r.listen_local(t,Bp.ServerListenOptions.IPV4_ONLY|Bp.ServerListenOptions.HTTPS)}catch(e){throw this._trustFile&&removeFile(this._trustFile),this._trustFile=null,e}return(r.get_listeners()[0]?.get_local_address())?.get_port()??t}_handleRequest(e,t){let n=new IncomingMessage,r=new ServerResponse(t);n.method=e.method,n.url=e.url,n.httpVersion=`1.1`;let i=e.header_pairs??[];for(let e=0;e+1<i.length;e+=2){let t=i[e],r=i[e+1],o=t.toLowerCase();if(n.rawHeaders.push(t,r),o in n.headers){let e=n.headers[o];Array.isArray(e)?e.push(r):n.headers[o]=[e,r]}else n.headers[o]=r}n.socket=new ServerRequestSocket(e.remote_address??`127.0.0.1`,e.remote_port??0,this._address?.address??`127.0.0.1`,this._address?.port??0,t,this._tls!==null);let o=e.get_body();o.length>0?n._pushBody(o):n._pushBody(null),e.connect(`aborted_signal`,()=>{n.aborted||(n.aborted=!0,n.emit(`aborted`))}),e.connect(`close`,()=>{n.emit(`close`)});try{let e=this.emit(`request`,n,r);(e instanceof Promise||typeof e==`object`&&e&&typeof e.then==`function`)&&e.catch(e=>{if(M.error(`[HTTP] Unhandled error in async request handler:`,e),!r.headersSent)try{r.writeHead(500),r.end(`Internal Server Error`)}catch{}})}catch(e){if(M.error(`[HTTP] Unhandled error in request handler:`,e),!r.headersSent)try{r.writeHead(500),r.end(`Internal Server Error`)}catch{}}}_handleUpgrade(e,t){let n=new IncomingMessage;n.method=e.method,n.url=e.url,n.httpVersion=`1.1`;let r=e.header_pairs??[];for(let e=0;e+1<r.length;e+=2){let t=r[e],i=r[e+1],o=t.toLowerCase();n.rawHeaders.push(t,i),n.headers[o]=i}if(this.listenerCount(`upgrade`)>0){let r=new Socket;r._attachOutputOnly(t),n.socket=r,r.remoteAddress??=e.remote_address||void 0,r.remotePort??=e.remote_port??void 0,r.remoteFamily??=r.remoteAddress?.includes(`:`)?`IPv6`:`IPv4`,r.localAddress??=this._address?.address,r.localPort??=this._address?.port,this.emit(`upgrade`,n,r,H.alloc(0))}}address(){return this._address}addWebSocketHandler(e,t){if(!this._bridge)throw Error(`Server must be listening before adding WebSocket handlers. Call listen() first.`);this._bridge.soup_server.add_websocket_handler(e,null,null,(e,n,r,i)=>{t(i)})}close(e){return e&&this.once(`close`,e),this._bridge&&=(this._tls?this._bridge.soup_server.disconnect():this._bridge.close(),null),this._trustFile&&=(removeFile(this._trustFile),null),this.listening=!1,Gp.delete(this),deferEmit(this,`close`),this}setTimeout(e,t){return this.timeout=e,t&&this.on(`timeout`,t),this}}}),ClientRequest,qp=__esmMin(()=>{pp(),Kp(),G(),Vp(),Z(),U(),Vr(),kf(),Cp(),ClientRequest=class extends OutgoingMessage{method;path;protocol;host;hostname;port;aborted=!1;reusedSocket=!1;maxHeadersCount=2e3;_chunks=[];_session;_message;_cancellable;_timeout=0;_timeoutTimer=null;_responseCallback;_tlsRejection=null;constructor(e,t,n){super();let r;if(typeof e==`string`||e instanceof J){let i=typeof e==`string`?new J(e):e;r={protocol:i.protocol,hostname:i.hostname,port:i.port?Number(i.port):void 0,path:i.pathname+i.search,...typeof t==`object`?t:{}},typeof t==`function`&&(n=t)}else r=e,typeof t==`function`&&(n=t);if(this.method=(r.method||`GET`).toUpperCase(),this.protocol=r.protocol||`http:`,this.hostname=r.hostname||r.host?.split(`:`)[0]||`localhost`,this.port=Number(r.port)||(this.protocol===`https:`?443:80),this.path=r.path||`/`,this.host=r.host||`${this.hostname}:${this.port}`,this._timeout=r.timeout||0,n&&(this._responseCallback=n,this.once(`response`,n)),r.headers)for(let[e,t]of Object.entries(r.headers))this.setHeader(e,t);if(r.setHost!==!1&&!this._headers.has(`host`)){let e=this.protocol===`https:`?443:80,t=this.port===e?this.hostname:`${this.hostname}:${this.port}`;this.setHeader(`Host`,t)}r.auth&&!this._headers.has(`authorization`)&&this.setHeader(`Authorization`,`Basic `+H.from(r.auth).toString(`base64`)),r.signal&&(r.signal.aborted?this.abort():r.signal.addEventListener(`abort`,()=>this.abort(),{once:!0}));let i=W.Uri.parse(this._buildUrl(),W.UriFlags.NONE);this._session=new Bp.Session,this._message=new Bp.Message({method:this.method,uri:i}),this._cancellable=new X.Cancellable,this.protocol===`https:`&&this._setupTls(r),this._timeout>0&&(this._session.timeout=Math.ceil(this._timeout/1e3),this._timeoutTimer=setTimeout(()=>{this._timeoutTimer=null,this.emit(`timeout`)},this._timeout))}_setupTls(e){let t=e.agent===void 0?e._defaultAgent:e.agent,n=t&&typeof t==`object`?t.options:void 0,r={...e,...n},i=r.secureContext??createSecureContext(r),o=createPeerVerifier({caCertificates:i.caCertificates,rejectUnauthorized:r.rejectUnauthorized,host:r.servername||this.hostname,checkServerIdentity:r.checkServerIdentity});this._session.set_tls_database(null),this._message.connect(`accept-certificate`,(e,t,n)=>{let r=o.accept(t);return this._tlsRejection=r?null:o.error,r}),i.certificate&&this._message.set_tls_client_certificate(i.certificate)}_buildUrl(){let e=this.protocol.endsWith(`:`)?this.protocol:this.protocol+`:`,t=e===`https:`?443:80,n=this.port===t?``:`:${this.port}`;return`${e}//${this.hostname}${n}${this.path}`}getRawHeaderNames(){return Array.from(this._headers.keys())}flushHeaders(){this.headersSent||this._applyHeaders()}setTimeout(e,t){return this._timeout=e,this._timeoutTimer&&=(clearTimeout(this._timeoutTimer),null),t&&this.once(`timeout`,t),e>0&&(this._session.timeout=Math.ceil(e/1e3),this._timeoutTimer=setTimeout(()=>{this._timeoutTimer=null,this.emit(`timeout`)},e)),this}abort(){this.aborted||(this.aborted=!0,this._timeoutTimer&&=(clearTimeout(this._timeoutTimer),null),this._cancellable.cancel(),this.emit(`abort`),this.destroy())}_write(e,t,n){let r=H.isBuffer(e)?e:typeof e==`string`?H.from(e,t):H.from(e);this._chunks.push(r),n()}_final(e){this._sendRequest().then(()=>e()).catch(t=>e(t))}_applyHeaders(){if(this.headersSent)return;this.headersSent=!0;let e=this._message.get_request_headers();for(let[t,n]of this._headers)if(Array.isArray(n))for(let r of n)e.append(t,r);else e.replace(t,n)}async _sendRequest(){this._applyHeaders();let e=H.concat(this._chunks);if(e.length>0){let t=this._headers.get(`content-type`)||`application/octet-stream`;this._message.set_request_body_from_bytes(t,new W.Bytes(e))}try{let e=await new Promise((e,t)=>{this._session.send_async(this._message,W.PRIORITY_DEFAULT,this._cancellable,(n,r)=>{try{e(this._session.send_finish(r))}catch(e){t(e)}})}),t=[];try{let n;for(;(n=await readBytesAsync(e,4096,W.PRIORITY_DEFAULT,this._cancellable))!==null;)t.push(H.from(n))}catch{}let n=new IncomingMessage;n.statusCode=this._message.status_code,n.statusMessage=this._message.get_reason_phrase(),n.httpVersion=`1.1`,this._message.get_response_headers().foreach((e,t)=>{let r=e.toLowerCase();if(n.rawHeaders.push(e,t),r in n.headers){let e=n.headers[r];Array.isArray(e)?e.push(t):n.headers[r]=[e,t]}else n.headers[r]=t}),this.finished=!0,this._timeoutTimer&&=(clearTimeout(this._timeoutTimer),null),this.emit(`response`,n),setTimeout(()=>{for(let e of t)n.push(e);n.push(null),n.complete=!0},0)}catch(e){this.aborted?this.emit(`abort`):this._tlsRejection?this.emit(`error`,this._tlsRejection):this.emit(`error`,e instanceof Error?e:Error(String(e)))}}}}),Jp=__exportAll$5({Agent:()=>Agent,ClientRequest:()=>ClientRequest,IncomingMessage:()=>IncomingMessage,METHODS:()=>dp,OutgoingMessage:()=>OutgoingMessage,STATUS_CODES:()=>up,Server:()=>Server,ServerResponse:()=>ServerResponse,createServer:()=>createServer,default:()=>Zp,get:()=>get,globalAgent:()=>Yp,maxHeaderSize:()=>Xp,request:()=>request,setMaxIdleHTTPParsers:()=>setMaxIdleHTTPParsers,validateHeaderName:()=>validateHeaderName,validateHeaderValue:()=>validateHeaderValue});function createServer(e,t){return typeof e==`function`?new Server(e):new Server(t)}function request(e,t,n){return new ClientRequest(e,t,n)}function get(e,t,n){let r,i=n;typeof e==`string`||e instanceof J?(r=typeof t==`object`?{...t,method:`GET`}:{method:`GET`},typeof t==`function`&&(i=t)):(r={...e,method:`GET`},typeof t==`function`&&(i=t),e=r);let o=typeof e==`string`||e instanceof J?new ClientRequest(e,{...r,method:`GET`},i):new ClientRequest({...r,method:`GET`},i);return o.end(),o}function setMaxIdleHTTPParsers(e){}var Agent,Yp,Xp,Zp,Qp=__esmMin(()=>{lp(),fp(),pp(),Kp(),qp(),Vr(),Agent=class{defaultPort=80;protocol=`http:`;maxSockets;maxTotalSockets;maxFreeSockets;keepAliveMsecs;keepAlive;scheduling;requests={};sockets={};freeSockets={};options;constructor(e){this.options={...e},this.keepAlive=e?.keepAlive??!1,this.keepAliveMsecs=e?.keepAliveMsecs??1e3,this.maxSockets=e?.maxSockets??1/0,this.maxTotalSockets=e?.maxTotalSockets??1/0,this.maxFreeSockets=e?.maxFreeSockets??256,this.scheduling=e?.scheduling??`lifo`}destroy(){}getName(e){let t=e.host||`localhost`;return e.port&&(t+=`:`+e.port),e.localAddress&&(t+=`:`+e.localAddress),(e.family===4||e.family===6)&&(t+=`:`+e.family),t}},Yp=new Agent,Xp=16384,Zp={STATUS_CODES:up,METHODS:dp,Server,IncomingMessage,OutgoingMessage,ServerResponse,ClientRequest,Agent,globalAgent:Yp,createServer,request,get,validateHeaderName,validateHeaderValue,maxHeaderSize:Xp,setMaxIdleHTTPParsers}}),$p=__commonJSMin(((e,t)=>{
234
234
  /*!
235
235
  * etag
236
236
  * Copyright(c) 2014-2016 Douglas Christopher Wilson
237
237
  * MIT Licensed
238
238
  */
239
- t.exports=etag;var n=(Tc(),__toCommonJS(Cc)),r=(op(),__toCommonJS(rp)).Stats,i=Object.prototype.toString;function entitytag(e){if(e.length===0)return`"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"`;var t=n.createHash(`sha1`).update(e,`utf8`).digest(`base64`).substring(0,27);return`"`+(typeof e==`string`?Buffer.byteLength(e,`utf8`):e.length).toString(16)+`-`+t+`"`}function etag(e,t){if(e==null)throw TypeError(`argument entity is required`);var n=isstats(e),r=t&&typeof t.weak==`boolean`?t.weak:n;if(!n&&typeof e!=`string`&&!Buffer.isBuffer(e))throw TypeError(`argument entity must be string, Buffer, or fs.Stats`);var i=n?stattag(e):entitytag(e);return r?`W/`+i:i}function isstats(e){return typeof r==`function`&&e instanceof r?!0:e&&typeof e==`object`&&`ctime`in e&&i.call(e.ctime)===`[object Date]`&&`mtime`in e&&i.call(e.mtime)===`[object Date]`&&`ino`in e&&typeof e.ino==`number`&&`size`in e&&typeof e.size==`number`}function stattag(e){var t=e.mtime.getTime().toString(16);return`"`+e.size.toString(16)+`-`+t+`"`}})),tm=__commonJSMin(((e,t)=>{
239
+ t.exports=etag;var n=(Tc(),__toCommonJS(Cc)),r=(op(),__toCommonJS(rp)).Stats,i=Object.prototype.toString;function entitytag(e){if(e.length===0)return`"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"`;var t=n.createHash(`sha1`).update(e,`utf8`).digest(`base64`).substring(0,27);return`"`+(typeof e==`string`?Buffer.byteLength(e,`utf8`):e.length).toString(16)+`-`+t+`"`}function etag(e,t){if(e==null)throw TypeError(`argument entity is required`);var n=isstats(e),r=t&&typeof t.weak==`boolean`?t.weak:n;if(!n&&typeof e!=`string`&&!Buffer.isBuffer(e))throw TypeError(`argument entity must be string, Buffer, or fs.Stats`);var i=n?stattag(e):entitytag(e);return r?`W/`+i:i}function isstats(e){return typeof r==`function`&&e instanceof r?!0:e&&typeof e==`object`&&`ctime`in e&&i.call(e.ctime)===`[object Date]`&&`mtime`in e&&i.call(e.mtime)===`[object Date]`&&`ino`in e&&typeof e.ino==`number`&&`size`in e&&typeof e.size==`number`}function stattag(e){var t=e.mtime.getTime().toString(16);return`"`+e.size.toString(16)+`-`+t+`"`}})),em=__commonJSMin(((e,t)=>{
240
240
  /*!
241
241
  * forwarded
242
242
  * Copyright(c) 2014-2017 Douglas Christopher Wilson
243
243
  * MIT Licensed
244
244
  */
245
- t.exports=forwarded;function forwarded(e){if(!e)throw TypeError(`argument req is required`);var t=parse(e.headers[`x-forwarded-for`]||``);return[getSocketAddr(e)].concat(t)}function getSocketAddr(e){return e.socket?e.socket.remoteAddress:e.connection.remoteAddress}function parse(e){for(var t=e.length,n=[],r=e.length,i=e.length-1;i>=0;i--)switch(e.charCodeAt(i)){case 32:r===t&&(r=t=i);break;case 44:r!==t&&n.push(e.substring(r,t)),r=t=i;break;default:r=i;break}return r!==t&&n.push(e.substring(r,t)),n}})),nm=__commonJSMin(((e,t)=>{(function(){var expandIPv6,e={},n,r,i,o,matchCIDR,s=this,c;t!=null&&t.exports?t.exports=e:s.ipaddr=e,matchCIDR=function(e,t,n,r){var i,o;if(e.length!==t.length)throw Error(`ipaddr: cannot match CIDR for objects with different lengths`);for(i=0;r>0;){if(o=n-r,o<0&&(o=0),e[i]>>o!==t[i]>>o)return!1;r-=n,i+=1}return!0},e.subnetMatch=function(e,t,n){var r,i,o,s,c;for(o in n??=`unicast`,t)for(s=t[o],s[0]&&!(s[0]instanceof Array)&&(s=[s]),r=0,i=s.length;r<i;r++)if(c=s[r],e.kind()===c[0].kind()&&e.match.apply(e,c))return o;return n},e.IPv4=(function(){function IPv4(e){var t,n,r;if(e.length!==4)throw Error(`ipaddr: ipv4 octet count should be 4`);for(t=0,n=e.length;t<n;t++)if(r=e[t],!(0<=r&&r<=255))throw Error(`ipaddr: ipv4 octet should fit in 8 bits`);this.octets=e}return IPv4.prototype.kind=function(){return`ipv4`},IPv4.prototype.toString=function(){return this.octets.join(`.`)},IPv4.prototype.toNormalizedString=function(){return this.toString()},IPv4.prototype.toByteArray=function(){return this.octets.slice(0)},IPv4.prototype.match=function(e,t){var n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv4`)throw Error(`ipaddr: cannot match ipv4 address with non-ipv4 one`);return matchCIDR(this.octets,e.octets,8,t)},IPv4.prototype.SpecialRanges={unspecified:[[new IPv4([0,0,0,0]),8]],broadcast:[[new IPv4([255,255,255,255]),32]],multicast:[[new IPv4([224,0,0,0]),4]],linkLocal:[[new IPv4([169,254,0,0]),16]],loopback:[[new IPv4([127,0,0,0]),8]],carrierGradeNat:[[new IPv4([100,64,0,0]),10]],private:[[new IPv4([10,0,0,0]),8],[new IPv4([172,16,0,0]),12],[new IPv4([192,168,0,0]),16]],reserved:[[new IPv4([192,0,0,0]),24],[new IPv4([192,0,2,0]),24],[new IPv4([192,88,99,0]),24],[new IPv4([198,51,100,0]),24],[new IPv4([203,0,113,0]),24],[new IPv4([240,0,0,0]),4]]},IPv4.prototype.range=function(){return e.subnetMatch(this,this.SpecialRanges)},IPv4.prototype.toIPv4MappedAddress=function(){return e.IPv6.parse(`::ffff:`+this.toString())},IPv4.prototype.prefixLengthFromSubnetMask=function(){var e,t,n,r,i,o,s={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};for(e=0,i=!1,t=n=3;n>=0;t=n+=-1)if(r=this.octets[t],r in s){if(o=s[r],i&&o!==0)return null;o!==8&&(i=!0),e+=o}else return null;return 32-e},IPv4})(),n=`(0?\\d+|0x[a-f0-9]+)`,r={fourOctet:RegExp(`^`+n+`\\.`+n+`\\.`+n+`\\.`+n+`$`,`i`),longValue:RegExp(`^`+n+`$`,`i`)},e.IPv4.parser=function(e){var t,parseIntAuto=function(e){return e[0]===`0`&&e[1]!==`x`?parseInt(e,8):parseInt(e)},n,i,o;if(t=e.match(r.fourOctet))return(function(){var e,r,i=t.slice(1,6),o=[];for(e=0,r=i.length;e<r;e++)n=i[e],o.push(parseIntAuto(n));return o})();if(t=e.match(r.longValue)){if(o=parseIntAuto(t[1]),o>4294967295||o<0)throw Error(`ipaddr: address outside defined range`);return(function(){var e,t=[];for(i=e=0;e<=24;i=e+=8)t.push(o>>i&255);return t})().reverse()}else return null},e.IPv6=(function(){function IPv6(e,t){var n,r,i,o,s,c;if(e.length===16)for(this.parts=[],n=r=0;r<=14;n=r+=2)this.parts.push(e[n]<<8|e[n+1]);else if(e.length===8)this.parts=e;else throw Error(`ipaddr: ipv6 part count should be 8 or 16`);for(c=this.parts,i=0,o=c.length;i<o;i++)if(s=c[i],!(0<=s&&s<=65535))throw Error(`ipaddr: ipv6 part should fit in 16 bits`);t&&(this.zoneId=t)}return IPv6.prototype.kind=function(){return`ipv6`},IPv6.prototype.toString=function(){return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/,`::`)},IPv6.prototype.toRFC5952String=function(){var e,t,n,r=/((^|:)(0(:|$)){2,})/g,i=this.toNormalizedString();for(e=0,t=-1;n=r.exec(i);)n[0].length>t&&(e=n.index,t=n[0].length);return t<0?i:i.substring(0,e)+`::`+i.substring(e+t)},IPv6.prototype.toByteArray=function(){var e=[],t,n,r,i=this.parts;for(t=0,n=i.length;t<n;t++)r=i[t],e.push(r>>8),e.push(r&255);return e},IPv6.prototype.toNormalizedString=function(){var e=(function(){var e,n,r=this.parts,i=[];for(e=0,n=r.length;e<n;e++)t=r[e],i.push(t.toString(16));return i}).call(this).join(`:`),t,n=``;return this.zoneId&&(n=`%`+this.zoneId),e+n},IPv6.prototype.toFixedLengthString=function(){var e=(function(){var e,n,r=this.parts,i=[];for(e=0,n=r.length;e<n;e++)t=r[e],i.push(t.toString(16).padStart(4,`0`));return i}).call(this).join(`:`),t,n=``;return this.zoneId&&(n=`%`+this.zoneId),e+n},IPv6.prototype.match=function(e,t){var n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv6`)throw Error(`ipaddr: cannot match ipv6 address with non-ipv6 one`);return matchCIDR(this.parts,e.parts,16,t)},IPv6.prototype.SpecialRanges={unspecified:[new IPv6([0,0,0,0,0,0,0,0]),128],linkLocal:[new IPv6([65152,0,0,0,0,0,0,0]),10],multicast:[new IPv6([65280,0,0,0,0,0,0,0]),8],loopback:[new IPv6([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new IPv6([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new IPv6([0,0,0,0,0,65535,0,0]),96],rfc6145:[new IPv6([0,0,0,0,65535,0,0,0]),96],rfc6052:[new IPv6([100,65435,0,0,0,0,0,0]),96],"6to4":[new IPv6([8194,0,0,0,0,0,0,0]),16],teredo:[new IPv6([8193,0,0,0,0,0,0,0]),32],reserved:[[new IPv6([8193,3512,0,0,0,0,0,0]),32]]},IPv6.prototype.range=function(){return e.subnetMatch(this,this.SpecialRanges)},IPv6.prototype.isIPv4MappedAddress=function(){return this.range()===`ipv4Mapped`},IPv6.prototype.toIPv4Address=function(){var t,n,r;if(!this.isIPv4MappedAddress())throw Error(`ipaddr: trying to convert a generic ipv6 address to ipv4`);return r=this.parts.slice(-2),t=r[0],n=r[1],new e.IPv4([t>>8,t&255,n>>8,n&255])},IPv6.prototype.prefixLengthFromSubnetMask=function(){var e,t,n,r,i,o,s={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0};for(e=0,i=!1,t=n=7;n>=0;t=n+=-1)if(r=this.parts[t],r in s){if(o=s[r],i&&o!==0)return null;o!==16&&(i=!0),e+=o}else return null;return 128-e},IPv6})(),i=`(?:[0-9a-f]+::?)+`,c=`%[0-9a-z]{1,}`,o={zoneIndex:new RegExp(c,`i`),native:RegExp(`^(::)?(`+i+`)?([0-9a-f]+)?(::)?(`+c+`)?$`,`i`),transitional:RegExp(`^((?:`+i+`)|(?:::)(?:`+i+`)?)`+(n+`\\.`+n+`\\.`+n+`\\.`+n)+(`(`+c+`)?$`),`i`)},expandIPv6=function(e,t){var n,r,i,s,c,l;if(e.indexOf(`::`)!==e.lastIndexOf(`::`))return null;for(l=(e.match(o.zoneIndex)||[])[0],l&&(l=l.substring(1),e=e.replace(/%.+$/,``)),n=0,r=-1;(r=e.indexOf(`:`,r+1))>=0;)n++;if(e.substr(0,2)===`::`&&n--,e.substr(-2,2)===`::`&&n--,n>t)return null;for(c=t-n,s=`:`;c--;)s+=`0:`;return e=e.replace(`::`,s),e[0]===`:`&&(e=e.slice(1)),e[e.length-1]===`:`&&(e=e.slice(0,-1)),t=(function(){var t,n,r=e.split(`:`),o=[];for(t=0,n=r.length;t<n;t++)i=r[t],o.push(parseInt(i,16));return o})(),{parts:t,zoneId:l}},e.IPv6.parser=function(e){var t,n,r,i,s,c,l;if(o.native.test(e))return expandIPv6(e,8);if((i=e.match(o.transitional))&&(l=i[6]||``,t=expandIPv6(i[1].slice(0,-1)+l,6),t.parts)){for(c=[parseInt(i[2]),parseInt(i[3]),parseInt(i[4]),parseInt(i[5])],n=0,r=c.length;n<r;n++)if(s=c[n],!(0<=s&&s<=255))return null;return t.parts.push(c[0]<<8|c[1]),t.parts.push(c[2]<<8|c[3]),{parts:t.parts,zoneId:t.zoneId}}return null},e.IPv4.isIPv4=e.IPv6.isIPv6=function(e){return this.parser(e)!==null},e.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch{return!1}},e.IPv4.isValidFourPartDecimal=function(t){return!!(e.IPv4.isValid(t)&&t.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},e.IPv6.isValid=function(e){var t;if(typeof e==`string`&&e.indexOf(`:`)===-1)return!1;try{return t=this.parser(e),new this(t.parts,t.zoneId),!0}catch{return!1}},e.IPv4.parse=function(e){var t=this.parser(e);if(t===null)throw Error(`ipaddr: string is not formatted like ip address`);return new this(t)},e.IPv6.parse=function(e){var t=this.parser(e);if(t.parts===null)throw Error(`ipaddr: string is not formatted like ip address`);return new this(t.parts,t.zoneId)},e.IPv4.parseCIDR=function(e){var t,n,r;if((n=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(n[2]),t>=0&&t<=32))return r=[this.parse(n[1]),t],Object.defineProperty(r,"toString",{value:function(){return this.join(`/`)}}),r;throw Error(`ipaddr: string is not formatted like an IPv4 CIDR range`)},e.IPv4.subnetMaskFromPrefixLength=function(e){var t,n,r;if(e=parseInt(e),e<0||e>32)throw Error(`ipaddr: invalid IPv4 prefix length`);for(r=[0,0,0,0],n=0,t=Math.floor(e/8);n<t;)r[n]=255,n++;return t<4&&(r[t]=2**(e%8)-1<<8-e%8),new this(r)},e.IPv4.broadcastAddressFromCIDR=function(e){var t,n,r,i,o;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),o=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<4;)i.push(parseInt(r[n],10)|parseInt(o[n],10)^255),n++;return new this(i)}catch{throw Error(`ipaddr: the address does not have IPv4 CIDR format`)}},e.IPv4.networkAddressFromCIDR=function(e){var t,n,r,i,o;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),o=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<4;)i.push(parseInt(r[n],10)&parseInt(o[n],10)),n++;return new this(i)}catch{throw Error(`ipaddr: the address does not have IPv4 CIDR format`)}},e.IPv6.parseCIDR=function(e){var t,n,r;if((n=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(n[2]),t>=0&&t<=128))return r=[this.parse(n[1]),t],Object.defineProperty(r,"toString",{value:function(){return this.join(`/`)}}),r;throw Error(`ipaddr: string is not formatted like an IPv6 CIDR range`)},e.isValid=function(t){return e.IPv6.isValid(t)||e.IPv4.isValid(t)},e.parse=function(t){if(e.IPv6.isValid(t))return e.IPv6.parse(t);if(e.IPv4.isValid(t))return e.IPv4.parse(t);throw Error(`ipaddr: the address has neither IPv6 nor IPv4 format`)},e.parseCIDR=function(t){try{return e.IPv6.parseCIDR(t)}catch{try{return e.IPv4.parseCIDR(t)}catch{throw Error(`ipaddr: the address has neither IPv6 nor IPv4 CIDR format`)}}},e.fromByteArray=function(t){var n=t.length;if(n===4)return new e.IPv4(t);if(n===16)return new e.IPv6(t);throw Error(`ipaddr: the binary input is neither an IPv6 nor IPv4 address`)},e.process=function(e){var t=this.parse(e);return t.kind()===`ipv6`&&t.isIPv4MappedAddress()?t.toIPv4Address():t}}).call(e)})),im=__commonJSMin(((e,t)=>{
245
+ t.exports=forwarded;function forwarded(e){if(!e)throw TypeError(`argument req is required`);var t=parse(e.headers[`x-forwarded-for`]||``);return[getSocketAddr(e)].concat(t)}function getSocketAddr(e){return e.socket?e.socket.remoteAddress:e.connection.remoteAddress}function parse(e){for(var t=e.length,n=[],r=e.length,i=e.length-1;i>=0;i--)switch(e.charCodeAt(i)){case 32:r===t&&(r=t=i);break;case 44:r!==t&&n.push(e.substring(r,t)),r=t=i;break;default:r=i;break}return r!==t&&n.push(e.substring(r,t)),n}})),tm=__commonJSMin(((e,t)=>{(function(){var expandIPv6,e={},n,r,i,o,matchCIDR,s=this,c;t!=null&&t.exports?t.exports=e:s.ipaddr=e,matchCIDR=function(e,t,n,r){var i,o;if(e.length!==t.length)throw Error(`ipaddr: cannot match CIDR for objects with different lengths`);for(i=0;r>0;){if(o=n-r,o<0&&(o=0),e[i]>>o!==t[i]>>o)return!1;r-=n,i+=1}return!0},e.subnetMatch=function(e,t,n){var r,i,o,s,c;for(o in n??=`unicast`,t)for(s=t[o],s[0]&&!(s[0]instanceof Array)&&(s=[s]),r=0,i=s.length;r<i;r++)if(c=s[r],e.kind()===c[0].kind()&&e.match.apply(e,c))return o;return n},e.IPv4=(function(){function IPv4(e){var t,n,r;if(e.length!==4)throw Error(`ipaddr: ipv4 octet count should be 4`);for(t=0,n=e.length;t<n;t++)if(r=e[t],!(0<=r&&r<=255))throw Error(`ipaddr: ipv4 octet should fit in 8 bits`);this.octets=e}return IPv4.prototype.kind=function(){return`ipv4`},IPv4.prototype.toString=function(){return this.octets.join(`.`)},IPv4.prototype.toNormalizedString=function(){return this.toString()},IPv4.prototype.toByteArray=function(){return this.octets.slice(0)},IPv4.prototype.match=function(e,t){var n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv4`)throw Error(`ipaddr: cannot match ipv4 address with non-ipv4 one`);return matchCIDR(this.octets,e.octets,8,t)},IPv4.prototype.SpecialRanges={unspecified:[[new IPv4([0,0,0,0]),8]],broadcast:[[new IPv4([255,255,255,255]),32]],multicast:[[new IPv4([224,0,0,0]),4]],linkLocal:[[new IPv4([169,254,0,0]),16]],loopback:[[new IPv4([127,0,0,0]),8]],carrierGradeNat:[[new IPv4([100,64,0,0]),10]],private:[[new IPv4([10,0,0,0]),8],[new IPv4([172,16,0,0]),12],[new IPv4([192,168,0,0]),16]],reserved:[[new IPv4([192,0,0,0]),24],[new IPv4([192,0,2,0]),24],[new IPv4([192,88,99,0]),24],[new IPv4([198,51,100,0]),24],[new IPv4([203,0,113,0]),24],[new IPv4([240,0,0,0]),4]]},IPv4.prototype.range=function(){return e.subnetMatch(this,this.SpecialRanges)},IPv4.prototype.toIPv4MappedAddress=function(){return e.IPv6.parse(`::ffff:`+this.toString())},IPv4.prototype.prefixLengthFromSubnetMask=function(){var e,t,n,r,i,o,s={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};for(e=0,i=!1,t=n=3;n>=0;t=n+=-1)if(r=this.octets[t],r in s){if(o=s[r],i&&o!==0)return null;o!==8&&(i=!0),e+=o}else return null;return 32-e},IPv4})(),n=`(0?\\d+|0x[a-f0-9]+)`,r={fourOctet:RegExp(`^`+n+`\\.`+n+`\\.`+n+`\\.`+n+`$`,`i`),longValue:RegExp(`^`+n+`$`,`i`)},e.IPv4.parser=function(e){var t,parseIntAuto=function(e){return e[0]===`0`&&e[1]!==`x`?parseInt(e,8):parseInt(e)},n,i,o;if(t=e.match(r.fourOctet))return(function(){var e,r,i=t.slice(1,6),o=[];for(e=0,r=i.length;e<r;e++)n=i[e],o.push(parseIntAuto(n));return o})();if(t=e.match(r.longValue)){if(o=parseIntAuto(t[1]),o>4294967295||o<0)throw Error(`ipaddr: address outside defined range`);return(function(){var e,t=[];for(i=e=0;e<=24;i=e+=8)t.push(o>>i&255);return t})().reverse()}else return null},e.IPv6=(function(){function IPv6(e,t){var n,r,i,o,s,c;if(e.length===16)for(this.parts=[],n=r=0;r<=14;n=r+=2)this.parts.push(e[n]<<8|e[n+1]);else if(e.length===8)this.parts=e;else throw Error(`ipaddr: ipv6 part count should be 8 or 16`);for(c=this.parts,i=0,o=c.length;i<o;i++)if(s=c[i],!(0<=s&&s<=65535))throw Error(`ipaddr: ipv6 part should fit in 16 bits`);t&&(this.zoneId=t)}return IPv6.prototype.kind=function(){return`ipv6`},IPv6.prototype.toString=function(){return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/,`::`)},IPv6.prototype.toRFC5952String=function(){var e,t,n,r=/((^|:)(0(:|$)){2,})/g,i=this.toNormalizedString();for(e=0,t=-1;n=r.exec(i);)n[0].length>t&&(e=n.index,t=n[0].length);return t<0?i:i.substring(0,e)+`::`+i.substring(e+t)},IPv6.prototype.toByteArray=function(){var e=[],t,n,r,i=this.parts;for(t=0,n=i.length;t<n;t++)r=i[t],e.push(r>>8),e.push(r&255);return e},IPv6.prototype.toNormalizedString=function(){var e=(function(){var e,n,r=this.parts,i=[];for(e=0,n=r.length;e<n;e++)t=r[e],i.push(t.toString(16));return i}).call(this).join(`:`),t,n=``;return this.zoneId&&(n=`%`+this.zoneId),e+n},IPv6.prototype.toFixedLengthString=function(){var e=(function(){var e,n,r=this.parts,i=[];for(e=0,n=r.length;e<n;e++)t=r[e],i.push(t.toString(16).padStart(4,`0`));return i}).call(this).join(`:`),t,n=``;return this.zoneId&&(n=`%`+this.zoneId),e+n},IPv6.prototype.match=function(e,t){var n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv6`)throw Error(`ipaddr: cannot match ipv6 address with non-ipv6 one`);return matchCIDR(this.parts,e.parts,16,t)},IPv6.prototype.SpecialRanges={unspecified:[new IPv6([0,0,0,0,0,0,0,0]),128],linkLocal:[new IPv6([65152,0,0,0,0,0,0,0]),10],multicast:[new IPv6([65280,0,0,0,0,0,0,0]),8],loopback:[new IPv6([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new IPv6([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new IPv6([0,0,0,0,0,65535,0,0]),96],rfc6145:[new IPv6([0,0,0,0,65535,0,0,0]),96],rfc6052:[new IPv6([100,65435,0,0,0,0,0,0]),96],"6to4":[new IPv6([8194,0,0,0,0,0,0,0]),16],teredo:[new IPv6([8193,0,0,0,0,0,0,0]),32],reserved:[[new IPv6([8193,3512,0,0,0,0,0,0]),32]]},IPv6.prototype.range=function(){return e.subnetMatch(this,this.SpecialRanges)},IPv6.prototype.isIPv4MappedAddress=function(){return this.range()===`ipv4Mapped`},IPv6.prototype.toIPv4Address=function(){var t,n,r;if(!this.isIPv4MappedAddress())throw Error(`ipaddr: trying to convert a generic ipv6 address to ipv4`);return r=this.parts.slice(-2),t=r[0],n=r[1],new e.IPv4([t>>8,t&255,n>>8,n&255])},IPv6.prototype.prefixLengthFromSubnetMask=function(){var e,t,n,r,i,o,s={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0};for(e=0,i=!1,t=n=7;n>=0;t=n+=-1)if(r=this.parts[t],r in s){if(o=s[r],i&&o!==0)return null;o!==16&&(i=!0),e+=o}else return null;return 128-e},IPv6})(),i=`(?:[0-9a-f]+::?)+`,c=`%[0-9a-z]{1,}`,o={zoneIndex:new RegExp(c,`i`),native:RegExp(`^(::)?(`+i+`)?([0-9a-f]+)?(::)?(`+c+`)?$`,`i`),transitional:RegExp(`^((?:`+i+`)|(?:::)(?:`+i+`)?)`+(n+`\\.`+n+`\\.`+n+`\\.`+n)+(`(`+c+`)?$`),`i`)},expandIPv6=function(e,t){var n,r,i,s,c,l;if(e.indexOf(`::`)!==e.lastIndexOf(`::`))return null;for(l=(e.match(o.zoneIndex)||[])[0],l&&(l=l.substring(1),e=e.replace(/%.+$/,``)),n=0,r=-1;(r=e.indexOf(`:`,r+1))>=0;)n++;if(e.substr(0,2)===`::`&&n--,e.substr(-2,2)===`::`&&n--,n>t)return null;for(c=t-n,s=`:`;c--;)s+=`0:`;return e=e.replace(`::`,s),e[0]===`:`&&(e=e.slice(1)),e[e.length-1]===`:`&&(e=e.slice(0,-1)),t=(function(){var t,n,r=e.split(`:`),o=[];for(t=0,n=r.length;t<n;t++)i=r[t],o.push(parseInt(i,16));return o})(),{parts:t,zoneId:l}},e.IPv6.parser=function(e){var t,n,r,i,s,c,l;if(o.native.test(e))return expandIPv6(e,8);if((i=e.match(o.transitional))&&(l=i[6]||``,t=expandIPv6(i[1].slice(0,-1)+l,6),t.parts)){for(c=[parseInt(i[2]),parseInt(i[3]),parseInt(i[4]),parseInt(i[5])],n=0,r=c.length;n<r;n++)if(s=c[n],!(0<=s&&s<=255))return null;return t.parts.push(c[0]<<8|c[1]),t.parts.push(c[2]<<8|c[3]),{parts:t.parts,zoneId:t.zoneId}}return null},e.IPv4.isIPv4=e.IPv6.isIPv6=function(e){return this.parser(e)!==null},e.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch{return!1}},e.IPv4.isValidFourPartDecimal=function(t){return!!(e.IPv4.isValid(t)&&t.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},e.IPv6.isValid=function(e){var t;if(typeof e==`string`&&e.indexOf(`:`)===-1)return!1;try{return t=this.parser(e),new this(t.parts,t.zoneId),!0}catch{return!1}},e.IPv4.parse=function(e){var t=this.parser(e);if(t===null)throw Error(`ipaddr: string is not formatted like ip address`);return new this(t)},e.IPv6.parse=function(e){var t=this.parser(e);if(t.parts===null)throw Error(`ipaddr: string is not formatted like ip address`);return new this(t.parts,t.zoneId)},e.IPv4.parseCIDR=function(e){var t,n,r;if((n=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(n[2]),t>=0&&t<=32))return r=[this.parse(n[1]),t],Object.defineProperty(r,"toString",{value:function(){return this.join(`/`)}}),r;throw Error(`ipaddr: string is not formatted like an IPv4 CIDR range`)},e.IPv4.subnetMaskFromPrefixLength=function(e){var t,n,r;if(e=parseInt(e),e<0||e>32)throw Error(`ipaddr: invalid IPv4 prefix length`);for(r=[0,0,0,0],n=0,t=Math.floor(e/8);n<t;)r[n]=255,n++;return t<4&&(r[t]=2**(e%8)-1<<8-e%8),new this(r)},e.IPv4.broadcastAddressFromCIDR=function(e){var t,n,r,i,o;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),o=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<4;)i.push(parseInt(r[n],10)|parseInt(o[n],10)^255),n++;return new this(i)}catch{throw Error(`ipaddr: the address does not have IPv4 CIDR format`)}},e.IPv4.networkAddressFromCIDR=function(e){var t,n,r,i,o;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),o=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<4;)i.push(parseInt(r[n],10)&parseInt(o[n],10)),n++;return new this(i)}catch{throw Error(`ipaddr: the address does not have IPv4 CIDR format`)}},e.IPv6.parseCIDR=function(e){var t,n,r;if((n=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(n[2]),t>=0&&t<=128))return r=[this.parse(n[1]),t],Object.defineProperty(r,"toString",{value:function(){return this.join(`/`)}}),r;throw Error(`ipaddr: string is not formatted like an IPv6 CIDR range`)},e.isValid=function(t){return e.IPv6.isValid(t)||e.IPv4.isValid(t)},e.parse=function(t){if(e.IPv6.isValid(t))return e.IPv6.parse(t);if(e.IPv4.isValid(t))return e.IPv4.parse(t);throw Error(`ipaddr: the address has neither IPv6 nor IPv4 format`)},e.parseCIDR=function(t){try{return e.IPv6.parseCIDR(t)}catch{try{return e.IPv4.parseCIDR(t)}catch{throw Error(`ipaddr: the address has neither IPv6 nor IPv4 CIDR format`)}}},e.fromByteArray=function(t){var n=t.length;if(n===4)return new e.IPv4(t);if(n===16)return new e.IPv6(t);throw Error(`ipaddr: the binary input is neither an IPv6 nor IPv4 address`)},e.process=function(e){var t=this.parse(e);return t.kind()===`ipv6`&&t.isIPv4MappedAddress()?t.toIPv4Address():t}}).call(e)})),nm=__commonJSMin(((e,t)=>{
246
246
  /*!
247
247
  * proxy-addr
248
248
  * Copyright(c) 2014-2016 Douglas Christopher Wilson
249
249
  * MIT Licensed
250
250
  */
251
- t.exports=proxyaddr,t.exports.all=alladdrs,t.exports.compile=compile;var n=tm(),r=nm(),i=/^[0-9]+$/,o=r.isValid,s=r.parse,c={linklocal:[`169.254.0.0/16`,`fe80::/10`],loopback:[`127.0.0.1/8`,`::1/128`],uniquelocal:[`10.0.0.0/8`,`172.16.0.0/12`,`192.168.0.0/16`,`fc00::/7`]};function alladdrs(e,t){var r=n(e);if(!t)return r;typeof t!=`function`&&(t=compile(t));for(var i=0;i<r.length-1;i++)t(r[i],i)||(r.length=i+1);return r}function compile(e){if(!e)throw TypeError(`argument is required`);var t;if(typeof e==`string`)t=[e];else if(Array.isArray(e))t=e.slice();else throw TypeError(`unsupported trust argument`);for(var n=0;n<t.length;n++)e=t[n],Object.prototype.hasOwnProperty.call(c,e)&&(e=c[e],t.splice.apply(t,[n,1].concat(e)),n+=e.length-1);return compileTrust(compileRangeSubnets(t))}function compileRangeSubnets(e){for(var t=Array(e.length),n=0;n<e.length;n++)t[n]=parseipNotation(e[n]);return t}function compileTrust(e){var t=e.length;return t===0?trustNone:t===1?trustSingle(e[0]):trustMulti(e)}function parseipNotation(e){var t=e.lastIndexOf(`/`),n=t===-1?e:e.substring(0,t);if(!o(n))throw TypeError(`invalid IP address: `+n);var r=s(n);t===-1&&r.kind()===`ipv6`&&r.isIPv4MappedAddress()&&(r=r.toIPv4Address());var c=r.kind()===`ipv6`?128:32,l=t===-1?null:e.substring(t+1,e.length);if(l=l===null?c:i.test(l)?parseInt(l,10):r.kind()===`ipv4`&&o(l)?parseNetmask(l):null,l<=0||l>c)throw TypeError(`invalid range on address: `+e);return[r,l]}function parseNetmask(e){var t=s(e);return t.kind()===`ipv4`?t.prefixLengthFromSubnetMask():null}function proxyaddr(e,t){if(!e)throw TypeError(`req argument is required`);if(!t)throw TypeError(`trust argument is required`);var n=alladdrs(e,t);return n[n.length-1]}function trustNone(){return!1}function trustMulti(e){return function trust(t){if(!o(t))return!1;for(var n=s(t),r,i=n.kind(),c=0;c<e.length;c++){var l=e[c],u=l[0],d=u.kind(),p=l[1],m=n;if(i!==d){if(d===`ipv4`&&!n.isIPv4MappedAddress())continue;r||=d===`ipv4`?n.toIPv4Address():n.toIPv4MappedAddress(),m=r}if(m.match(u,p))return!0}return!1}}function trustSingle(e){var t=e[0],n=t.kind(),r=n===`ipv4`,i=e[1];return function trust(e){if(!o(e))return!1;var c=s(e);if(c.kind()!==n){if(r&&!c.isIPv4MappedAddress())return!1;c=r?c.toIPv4Address():c.toIPv4MappedAddress()}return c.match(t,i)}}})),NodeErrorAbstraction,NodeURIError,am=__esmMin(()=>{NodeErrorAbstraction=class extends Error{code;constructor(e,t,n){super(n),this.code=t,this.name=e,this.stack=this.stack&&`${e} [${this.code}]${this.stack.slice(20)}`}toString(){return`${this.name} [${this.code}]: ${this.message}`}},NodeURIError=class extends NodeErrorAbstraction{constructor(e,t){super(URIError.prototype.name,e,t),Object.setPrototypeOf(this,URIError.prototype),this.toString=function(){return`${this.name} [${this.code}]: ${this.message}`}}}}),om,sm,cm,lm,um=__esmMin(()=>{om=Array.from({length:256});for(let e=0;e<256;++e)om[e]=`%`+((e<16?`0`:``)+e.toString(16)).toUpperCase();sm=new Int8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,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,1,1,1,1,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),cm=new Int8Array([0,0,0,0,0,0,0,0,0,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,0,0,0,0,1,1,1,1,0,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,0,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,0,0,0,1,0]),lm=new Int8Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-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])});function encodeStr(e,t,n){let r=e.length;if(r===0)return``;let i=``,o=0;for(let s=0;s<r;s++){let c=e.charCodeAt(s);if(c<128){if(t[c]===1)continue;o<s&&(i+=e.slice(o,s)),o=s+1,i+=n[c];continue}if(o<s&&(i+=e.slice(o,s)),c<2048){o=s+1,i+=n[192|c>>6]+n[128|c&63];continue}if(c<55296||c>=57344){o=s+1,i+=n[224|c>>12]+n[128|c>>6&63]+n[128|c&63];continue}if(++s,s>=r)throw new ERR_INVALID_URI;let l=e.charCodeAt(s)&1023;o=s+1,c=65536+((c&1023)<<10|l),i+=n[240|c>>18]+n[128|c>>12&63]+n[128|c>>6&63]+n[128|c&63]}return o===0?e:o<r?i+e.slice(o):i}function qsEscape(e){return typeof e!=`string`&&(typeof e==`object`?e=String(e):e+=``),encodeStr(e,cm,om)}var ERR_INVALID_URI,dm=__esmMin(()=>{am(),um(),ERR_INVALID_URI=class extends NodeURIError{constructor(){super(`ERR_INVALID_URI`,`URI malformed`)}}});function unescapeBuffer(e,t=!1){let n=new H(e.length),r=0,i=0,o,s,c,l,u=e.length-2,d=!1;for(;r<e.length;){if(o=e.charCodeAt(r),o===43&&t){n[i++]=32,r++;continue}if(o===37&&r<u)if(o=e.charCodeAt(++r),c=lm[o],c>=0)s=e.charCodeAt(++r),l=lm[s],l>=0?(d=!0,o=c*16+l):(n[i++]=37,r--);else{n[i++]=37;continue}n[i++]=o,r++}return d?n.slice(0,i):n}function qsUnescape(e){try{return decodeURIComponent(e)}catch{return unescapeBuffer(e).toString()}}var fm=__esmMin(()=>{um(),U()});function charCodes(e){let t=Array.from({length:e.length});for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}function addKeyVal(e,t,n,r,i,o){if(t.length>0&&r)try{t=o(t)}catch{}if(n.length>0&&i)try{n=o(n)}catch{}if(e[t]===void 0)e[t]=n;else{let r=e[t];r.pop?r[r.length]=n:e[t]=[r,n]}}function parse(e,t=`&`,n=`=`,{decodeURIComponent:r=qsUnescape,maxKeys:i=1e3}={}){let o=Object.create(null);if(typeof e!=`string`||e.length===0)return o;let s=t?charCodes(String(t)):[38],c=n?charCodes(String(n)):[61],l=s.length,u=c.length,d=1e3;typeof i==`number`&&(d=i>0?i:-1);let p=qsUnescape;r&&(p=r);let m=p!==qsUnescape,h=0,g=0,_=0,v=``,y=``,b=m,x=m,S=m?`%20`:` `,w=0;for(let t=0;t<e.length;++t){let n=e.charCodeAt(t);if(n===s[g]){if(++g===l){let n=t-g+1;if(_<u){if(h<n)v+=e.slice(h,n);else if(v.length===0){if(--d===0)return o;h=t+1,g=_=0;continue}}else h<n&&(y+=e.slice(h,n));if(addKeyVal(o,v,y,b,x,p),--d===0)return o;v=y=``,w=0,h=t+1,g=_=0}}else{if(g=0,_<u){if(n===c[_]){if(++_===u){let n=t-_+1;h<n&&(v+=e.slice(h,n)),w=0,h=t+1}continue}else if(_=0,!b){if(n===37){w=1;continue}else if(w>0)if(sm[n]===1){++w===3&&(b=!0);continue}else w=0}if(n===43){h<t&&(v+=e.slice(h,t)),v+=S,h=t+1;continue}}n===43?(h<t&&(y+=e.slice(h,t)),y+=S,h=t+1):x||(n===37?w=1:w>0&&(sm[n]===1?++w===3&&(x=!0):w=0))}}if(h<e.length)_<u?v+=e.slice(h):g<l&&(y+=e.slice(h));else if(_===0&&v.length===0)return o;return addKeyVal(o,v,y,b,x,p),o}var pm=__esmMin(()=>{um(),fm()});function stringifyPrimitive(e){return typeof e==`string`?e:typeof e==`number`&&isFinite(e)||typeof e==`bigint`?``+e:typeof e==`boolean`?e?`true`:`false`:``}function encodeStringifiedCustom(e,t){return t(stringifyPrimitive(e))}function encodeStringified(e,t){return typeof e==`string`?e.length?t(e):``:typeof e==`number`&&isFinite(e)?Math.abs(e)<1e21?``+e:t(``+e):typeof e==`bigint`?``+e:typeof e==`boolean`?e?`true`:`false`:``}function stringify(e,t,n,r){t||=`&`,n||=`=`;let i=r?r.encodeURIComponent:qsEscape,o=r?encodeStringifiedCustom:encodeStringified;if(typeof e==`object`&&e){let r=Object.keys(e),s=r.length,c=``;for(let l=0;l<s;++l){let s=r[l],u=e[s],d=o(s,i);if(d+=n,Array.isArray(u)){let e=u.length;if(e===0)continue;c&&(c+=t);for(let n=0;n<e;++n)n&&(c+=t),c+=d,c+=o(u[n],i)}else c&&(c+=t),c+=d,c+=o(u,i)}return c}return``}var mm=__esmMin(()=>{dm()}),hm=__exportAll$5({ERR_INVALID_URI:()=>ERR_INVALID_URI,decode:()=>gm,default:()=>bm,encode:()=>_m,escape:()=>vm,parse:()=>parse,stringify:()=>stringify,unescape:()=>ym,unescapeBuffer:()=>unescapeBuffer}),gm,_m,vm,ym,bm,xm=__esmMin(()=>{dm(),fm(),pm(),mm(),gm=parse,_m=stringify,vm=qsEscape,ym=qsUnescape,bm={parse,stringify,decode:gm,encode:_m,unescape:ym,escape:vm,unescapeBuffer}}),Sm=__commonJSMin((e=>{
251
+ t.exports=proxyaddr,t.exports.all=alladdrs,t.exports.compile=compile;var n=em(),r=tm(),i=/^[0-9]+$/,o=r.isValid,s=r.parse,c={linklocal:[`169.254.0.0/16`,`fe80::/10`],loopback:[`127.0.0.1/8`,`::1/128`],uniquelocal:[`10.0.0.0/8`,`172.16.0.0/12`,`192.168.0.0/16`,`fc00::/7`]};function alladdrs(e,t){var r=n(e);if(!t)return r;typeof t!=`function`&&(t=compile(t));for(var i=0;i<r.length-1;i++)t(r[i],i)||(r.length=i+1);return r}function compile(e){if(!e)throw TypeError(`argument is required`);var t;if(typeof e==`string`)t=[e];else if(Array.isArray(e))t=e.slice();else throw TypeError(`unsupported trust argument`);for(var n=0;n<t.length;n++)e=t[n],Object.prototype.hasOwnProperty.call(c,e)&&(e=c[e],t.splice.apply(t,[n,1].concat(e)),n+=e.length-1);return compileTrust(compileRangeSubnets(t))}function compileRangeSubnets(e){for(var t=Array(e.length),n=0;n<e.length;n++)t[n]=parseipNotation(e[n]);return t}function compileTrust(e){var t=e.length;return t===0?trustNone:t===1?trustSingle(e[0]):trustMulti(e)}function parseipNotation(e){var t=e.lastIndexOf(`/`),n=t===-1?e:e.substring(0,t);if(!o(n))throw TypeError(`invalid IP address: `+n);var r=s(n);t===-1&&r.kind()===`ipv6`&&r.isIPv4MappedAddress()&&(r=r.toIPv4Address());var c=r.kind()===`ipv6`?128:32,l=t===-1?null:e.substring(t+1,e.length);if(l=l===null?c:i.test(l)?parseInt(l,10):r.kind()===`ipv4`&&o(l)?parseNetmask(l):null,l<=0||l>c)throw TypeError(`invalid range on address: `+e);return[r,l]}function parseNetmask(e){var t=s(e);return t.kind()===`ipv4`?t.prefixLengthFromSubnetMask():null}function proxyaddr(e,t){if(!e)throw TypeError(`req argument is required`);if(!t)throw TypeError(`trust argument is required`);var n=alladdrs(e,t);return n[n.length-1]}function trustNone(){return!1}function trustMulti(e){return function trust(t){if(!o(t))return!1;for(var n=s(t),r,i=n.kind(),c=0;c<e.length;c++){var l=e[c],u=l[0],d=u.kind(),p=l[1],m=n;if(i!==d){if(d===`ipv4`&&!n.isIPv4MappedAddress())continue;r||=d===`ipv4`?n.toIPv4Address():n.toIPv4MappedAddress(),m=r}if(m.match(u,p))return!0}return!1}}function trustSingle(e){var t=e[0],n=t.kind(),r=n===`ipv4`,i=e[1];return function trust(e){if(!o(e))return!1;var c=s(e);if(c.kind()!==n){if(r&&!c.isIPv4MappedAddress())return!1;c=r?c.toIPv4Address():c.toIPv4MappedAddress()}return c.match(t,i)}}})),NodeErrorAbstraction,NodeURIError,im=__esmMin(()=>{NodeErrorAbstraction=class extends Error{code;constructor(e,t,n){super(n),this.code=t,this.name=e,this.stack=this.stack&&`${e} [${this.code}]${this.stack.slice(20)}`}toString(){return`${this.name} [${this.code}]: ${this.message}`}},NodeURIError=class extends NodeErrorAbstraction{constructor(e,t){super(URIError.prototype.name,e,t),Object.setPrototypeOf(this,URIError.prototype),this.toString=function(){return`${this.name} [${this.code}]: ${this.message}`}}}}),am,om,sm,cm,lm=__esmMin(()=>{am=Array.from({length:256});for(let e=0;e<256;++e)am[e]=`%`+((e<16?`0`:``)+e.toString(16)).toUpperCase();om=new Int8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,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,1,1,1,1,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),sm=new Int8Array([0,0,0,0,0,0,0,0,0,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,0,0,0,0,1,1,1,1,0,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,0,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,0,0,0,1,0]),cm=new Int8Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-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])});function encodeStr(e,t,n){let r=e.length;if(r===0)return``;let i=``,o=0;for(let s=0;s<r;s++){let c=e.charCodeAt(s);if(c<128){if(t[c]===1)continue;o<s&&(i+=e.slice(o,s)),o=s+1,i+=n[c];continue}if(o<s&&(i+=e.slice(o,s)),c<2048){o=s+1,i+=n[192|c>>6]+n[128|c&63];continue}if(c<55296||c>=57344){o=s+1,i+=n[224|c>>12]+n[128|c>>6&63]+n[128|c&63];continue}if(++s,s>=r)throw new ERR_INVALID_URI;let l=e.charCodeAt(s)&1023;o=s+1,c=65536+((c&1023)<<10|l),i+=n[240|c>>18]+n[128|c>>12&63]+n[128|c>>6&63]+n[128|c&63]}return o===0?e:o<r?i+e.slice(o):i}function qsEscape(e){return typeof e!=`string`&&(typeof e==`object`?e=String(e):e+=``),encodeStr(e,sm,am)}var ERR_INVALID_URI,um=__esmMin(()=>{im(),lm(),ERR_INVALID_URI=class extends NodeURIError{constructor(){super(`ERR_INVALID_URI`,`URI malformed`)}}});function unescapeBuffer(e,t=!1){let n=new H(e.length),r=0,i=0,o,s,c,l,u=e.length-2,d=!1;for(;r<e.length;){if(o=e.charCodeAt(r),o===43&&t){n[i++]=32,r++;continue}if(o===37&&r<u)if(o=e.charCodeAt(++r),c=cm[o],c>=0)s=e.charCodeAt(++r),l=cm[s],l>=0?(d=!0,o=c*16+l):(n[i++]=37,r--);else{n[i++]=37;continue}n[i++]=o,r++}return d?n.slice(0,i):n}function qsUnescape(e){try{return decodeURIComponent(e)}catch{return unescapeBuffer(e).toString()}}var dm=__esmMin(()=>{lm(),U()});function charCodes(e){let t=Array.from({length:e.length});for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}function addKeyVal(e,t,n,r,i,o){if(t.length>0&&r)try{t=o(t)}catch{}if(n.length>0&&i)try{n=o(n)}catch{}if(e[t]===void 0)e[t]=n;else{let r=e[t];r.pop?r[r.length]=n:e[t]=[r,n]}}function parse(e,t=`&`,n=`=`,{decodeURIComponent:r=qsUnescape,maxKeys:i=1e3}={}){let o=Object.create(null);if(typeof e!=`string`||e.length===0)return o;let s=t?charCodes(String(t)):[38],c=n?charCodes(String(n)):[61],l=s.length,u=c.length,d=1e3;typeof i==`number`&&(d=i>0?i:-1);let p=qsUnescape;r&&(p=r);let m=p!==qsUnescape,h=0,g=0,_=0,v=``,y=``,b=m,x=m,S=m?`%20`:` `,w=0;for(let t=0;t<e.length;++t){let n=e.charCodeAt(t);if(n===s[g]){if(++g===l){let n=t-g+1;if(_<u){if(h<n)v+=e.slice(h,n);else if(v.length===0){if(--d===0)return o;h=t+1,g=_=0;continue}}else h<n&&(y+=e.slice(h,n));if(addKeyVal(o,v,y,b,x,p),--d===0)return o;v=y=``,w=0,h=t+1,g=_=0}}else{if(g=0,_<u){if(n===c[_]){if(++_===u){let n=t-_+1;h<n&&(v+=e.slice(h,n)),w=0,h=t+1}continue}else if(_=0,!b){if(n===37){w=1;continue}else if(w>0)if(om[n]===1){++w===3&&(b=!0);continue}else w=0}if(n===43){h<t&&(v+=e.slice(h,t)),v+=S,h=t+1;continue}}n===43?(h<t&&(y+=e.slice(h,t)),y+=S,h=t+1):x||(n===37?w=1:w>0&&(om[n]===1?++w===3&&(x=!0):w=0))}}if(h<e.length)_<u?v+=e.slice(h):g<l&&(y+=e.slice(h));else if(_===0&&v.length===0)return o;return addKeyVal(o,v,y,b,x,p),o}var fm=__esmMin(()=>{lm(),dm()});function stringifyPrimitive(e){return typeof e==`string`?e:typeof e==`number`&&isFinite(e)||typeof e==`bigint`?``+e:typeof e==`boolean`?e?`true`:`false`:``}function encodeStringifiedCustom(e,t){return t(stringifyPrimitive(e))}function encodeStringified(e,t){return typeof e==`string`?e.length?t(e):``:typeof e==`number`&&isFinite(e)?Math.abs(e)<1e21?``+e:t(``+e):typeof e==`bigint`?``+e:typeof e==`boolean`?e?`true`:`false`:``}function stringify(e,t,n,r){t||=`&`,n||=`=`;let i=r?r.encodeURIComponent:qsEscape,o=r?encodeStringifiedCustom:encodeStringified;if(typeof e==`object`&&e){let r=Object.keys(e),s=r.length,c=``;for(let l=0;l<s;++l){let s=r[l],u=e[s],d=o(s,i);if(d+=n,Array.isArray(u)){let e=u.length;if(e===0)continue;c&&(c+=t);for(let n=0;n<e;++n)n&&(c+=t),c+=d,c+=o(u[n],i)}else c&&(c+=t),c+=d,c+=o(u,i)}return c}return``}var pm=__esmMin(()=>{um()}),mm=__exportAll$5({ERR_INVALID_URI:()=>ERR_INVALID_URI,decode:()=>hm,default:()=>ym,encode:()=>gm,escape:()=>_m,parse:()=>parse,stringify:()=>stringify,unescape:()=>vm,unescapeBuffer:()=>unescapeBuffer}),hm,gm,_m,vm,ym,bm=__esmMin(()=>{um(),dm(),fm(),pm(),hm=parse,gm=stringify,_m=qsEscape,vm=qsUnescape,ym={parse,stringify,decode:hm,encode:gm,unescape:vm,escape:_m,unescapeBuffer}}),xm=__commonJSMin((e=>{
252
252
  /*!
253
253
  * express
254
254
  * Copyright(c) 2009-2013 TJ Holowaychuk
255
255
  * Copyright(c) 2014-2015 Douglas Christopher Wilson
256
256
  * MIT Licensed
257
257
  */
258
- var{METHODS:t}=($p(),__toCommonJS(Yp)),n=Xl(),r=em(),i=ql(),o=im(),s=Id(),c=(xm(),__toCommonJS(hm));let{Buffer:l}=(U(),__toCommonJS(an));e.methods=t.map(e=>e.toLowerCase()),e.etag=createETagGenerator({weak:!1}),e.wetag=createETagGenerator({weak:!0}),e.normalizeType=function(e){return~e.indexOf(`/`)?acceptParams(e):{value:i.lookup(e)||`application/octet-stream`,params:{}}},e.normalizeTypes=function(t){return t.map(e.normalizeType)};function acceptParams(e){for(var t=e.length,n=e.indexOf(`;`),r=n===-1?t:n,i={value:e.slice(0,r).trim(),quality:1,params:{}};r<t;){var o=e.indexOf(`=`,r);if(o===-1)break;var n=e.indexOf(`;`,r),s=n===-1?t:n;if(o>s){r=e.lastIndexOf(`;`,o-1)+1;continue}var c=e.slice(r,o).trim(),l=e.slice(o+1,s).trim();c===`q`?i.quality=parseFloat(l):i.params[c]=l,r=s+1}return i}e.compileETag=function(t){var n;if(typeof t==`function`)return t;switch(t){case!0:case`weak`:n=e.wetag;break;case!1:break;case`strong`:n=e.etag;break;default:throw TypeError(`unknown value for etag function: `+t)}return n},e.compileQueryParser=function compileQueryParser(e){var t;if(typeof e==`function`)return e;switch(e){case!0:case`simple`:t=c.parse;break;case!1:break;case`extended`:t=parseExtendedQueryString;break;default:throw TypeError(`unknown value for query parser function: `+e)}return t},e.compileTrust=function(e){return typeof e==`function`?e:e===!0?function(){return!0}:typeof e==`number`?function(t,n){return n<e}:(typeof e==`string`&&(e=e.split(`,`).map(function(e){return e.trim()})),o.compile(e||[]))},e.setCharset=function setCharset(e,t){if(!e||!t)return e;var r=n.parse(e);return r.parameters.charset=t,n.format(r)};function createETagGenerator(e){return function generateETag(t,n){return r(l.isBuffer(t)?t:l.from(t,n),e)}}function parseExtendedQueryString(e){return s.parse(e,{allowPrototypes:!0})}})),Cm=__commonJSMin(((e,t)=>{t.exports=wrappy;function wrappy(e,t){if(e&&t)return wrappy(e)(t);if(typeof e!=`function`)throw TypeError(`need wrapper function`);return Object.keys(e).forEach(function(t){wrapper[t]=e[t]}),wrapper;function wrapper(){for(var t=Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];var r=e.apply(this,t),i=t[t.length-1];return typeof r==`function`&&r!==i&&Object.keys(i).forEach(function(e){r[e]=i[e]}),r}}})),wm=__commonJSMin(((e,t)=>{var n=Cm();t.exports=n(once),t.exports.strict=n(onceStrict),once.proto=once(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return once(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return onceStrict(this)},configurable:!0})});function once(e){var f=function(){return f.called?f.value:(f.called=!0,f.value=e.apply(this,arguments))};return f.called=!1,f}function onceStrict(e){var f=function(){if(f.called)throw Error(f.onceError);return f.called=!0,f.value=e.apply(this,arguments)};return f.onceError=(e.name||"Function wrapped with `once`")+` shouldn't be called more than once`,f.called=!1,f}})),Tm=__commonJSMin(((e,t)=>{t.exports=isPromise,t.exports.default=isPromise;function isPromise(e){return!!e&&(typeof e==`object`||typeof e==`function`)&&typeof e.then==`function`}})),Em=__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PathError=e.TokenData=void 0,e.parse=parse,e.compile=compile,e.match=match,e.pathToRegexp=pathToRegexp,e.stringify=stringify;let NOOP_VALUE=e=>e,t=/^[$_\p{ID_Start}]$/u,n=/^[$\u200c\u200d\p{ID_Continue}]$/u,r=/^[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u;function escapeText(e){return e.replace(/[{}()\[\]+?!:*\\]/g,`\\$&`)}function escape(e){return e.replace(/[.+*?^${}()[\]|/\\]/g,`\\$&`)}var TokenData=class{constructor(e,t){this.tokens=e,this.originalPath=t}};e.TokenData=TokenData;var PathError=class extends TypeError{constructor(e,t){let n=e;t&&(n+=`: ${t}`),n+=`; visit https://git.new/pathToRegexpError for info`,super(n),this.originalPath=t}};e.PathError=PathError;function parse(e,r={}){let{encodePath:i=NOOP_VALUE}=r,o=[...e],s=0;function consumeUntil(r){let c=[],l=``;function writePath(){l&&=(c.push({type:`text`,value:i(l)}),``)}for(;s<o.length;){let i=o[s++];if(i===r)return writePath(),c;if(i===`\\`){if(s===o.length)throw new PathError(`Unexpected end after \\ at index ${s}`,e);l+=o[s++];continue}if(i===`:`||i===`*`){let r=i===`:`?`param`:`wildcard`,l=``;if(t.test(o[s]))do l+=o[s++];while(n.test(o[s]));else if(o[s]===`"`){let t=s;for(;s<o.length;){if(o[++s]===`"`){s++,t=0;break}o[s]===`\\`&&s++,l+=o[s]}if(t)throw new PathError(`Unterminated quote at index ${t}`,e)}if(!l)throw new PathError(`Missing parameter name at index ${s}`,e);writePath(),c.push({type:r,name:l});continue}if(i===`{`){writePath(),c.push({type:`group`,tokens:consumeUntil(`}`)});continue}if(i===`}`||i===`(`||i===`)`||i===`[`||i===`]`||i===`+`||i===`?`||i===`!`)throw new PathError(`Unexpected ${i} at index ${s-1}`,e);l+=i}if(r)throw new PathError(`Unexpected end at index ${s}, expected ${r}`,e);return writePath(),c}return new TokenData(consumeUntil(``),e)}function compile(e,t={}){let{encode:n=encodeURIComponent,delimiter:r=`/`}=t,i=tokensToFunction((typeof e==`object`?e:parse(e,t)).tokens,r,n);return function path(e={}){let t=[],n=i(e,t);if(t.length)throw TypeError(`Missing parameters: ${t.join(`, `)}`);return n}}function tokensToFunction(e,t,n){let r=e.map(e=>tokenToFunction(e,t,n));return(e,t)=>{let n=``;for(let i of r)n+=i(e,t);return n}}function tokenToFunction(e,t,n){if(e.type===`text`)return()=>e.value;if(e.type===`group`){let r=tokensToFunction(e.tokens,t,n);return(e,t)=>{let n=t.length,i=r(e,t);return t.length===n?i:(t.length=n,``)}}let r=n||NOOP_VALUE;return e.type===`wildcard`&&n!==!1?(n,i)=>{let o=n[e.name];if(o==null)return i.push(e.name),``;if(!Array.isArray(o)||o.length===0)throw TypeError(`Expected "${e.name}" to be a non-empty array`);let s=``;for(let n=0;n<o.length;n++){if(typeof o[n]!=`string`)throw TypeError(`Expected "${e.name}/${n}" to be a string`);n>0&&(s+=t),s+=r(o[n])}return s}:(t,n)=>{let i=t[e.name];if(i==null)return n.push(e.name),``;if(typeof i!=`string`)throw TypeError(`Expected "${e.name}" to be a string`);return r(i)}}function match(e,t={}){let{decode:n=decodeURIComponent,delimiter:r=`/`}=t,{regexp:i,keys:o}=pathToRegexp(e,t),s=o.map(e=>n===!1?NOOP_VALUE:e.type===`param`?n:e=>e.split(r).map(n));return function match(e){let t=i.exec(e);if(!t)return!1;let n=t[0],r=Object.create(null);for(let e=1;e<t.length;e++){if(t[e]===void 0)continue;let n=o[e-1],i=s[e-1];r[n.name]=i(t[e])}return{path:n,params:r}}}function pathToRegexp(e,t={}){let{delimiter:n=`/`,end:r=!0,sensitive:i=!1,trailing:o=!0}=t,s=[],c=``,l=0;function process(e){if(Array.isArray(e)){for(let t of e)process(t);return}let r=typeof e==`object`?e:parse(e,t);flatten(r.tokens,0,[],e=>{if(l>=256)throw new PathError(`Too many path combinations`,r.originalPath);l>0&&(c+=`|`),c+=toRegExpSource(e,n,s,r.originalPath),l++})}process(e);let u=`^(?:${c})`;return o&&(u+=`(?:`+escape(n)+`$)?`),u+=r?`$`:`(?=`+escape(n)+`|$)`,{regexp:new RegExp(u,i?``:`i`),keys:s}}function flatten(e,t,n,r){for(;t<e.length;){let i=e[t++];if(i.type===`group`){let o=n.length;flatten(i.tokens,0,n,n=>flatten(e,t,n,r)),n.length=o;continue}n.push(i)}r(n)}function toRegExpSource(e,t,n,r){let i=``,o=``,s=``,c=0,l=0,u=0;function hasInSegment(n,r){for(;n<e.length;){let i=e[n++];if(i.type===r)return!0;if(i.type===`text`&&i.value.includes(t))break}return!1}function peekText(t){let n=``;for(;t<e.length;){let r=e[t++];if(r.type!==`text`)break;n+=r.value}return n}for(;u<e.length;){let d=e[u++];if(d.type===`text`){i+=escape(d.value),o+=d.value,c===2&&(s+=d.value),d.value.includes(t)&&(l=0);continue}if(d.type===`param`||d.type===`wildcard`){if(c&&!o)throw new PathError(`Missing text before "${d.name}" ${d.type}`,r);d.type===`param`?(i+=l&2?`(${negate(t,o)}+)`:hasInSegment(u,`wildcard`)?`(${negate(t,peekText(u))}+)`:l&1?`(${negate(t,o)}+|${escape(o)})`:`(${negate(t,``)}+)`,l|=c=1):(i+=l&2?`(${negate(o,``)}+)`:s?`(${negate(s,``)}+|${negate(t,``)}+)`:`([^]+)`,s=``,l|=c=2),n.push(d),o=``;continue}throw TypeError(`Unknown token type: ${d.type}`)}return i}function negate(e,t){return t.length>e.length?negate(t,e):(e===t&&(t=``),t.length>1?`(?:(?!${escape(e)}|${escape(t)})[^])`:e.length>1?`(?:(?!${escape(e)})[^${escape(t)}])`:`[^${escape(e+t)}]`)}function stringifyTokens(e,t){let n=``;for(;t<e.length;){let r=e[t++];if(r.type===`text`){n+=escapeText(r.value);continue}if(r.type===`group`){n+=`{`+stringifyTokens(r.tokens,0)+`}`;continue}if(r.type===`param`){n+=`:`+stringifyName(r.name,e[t]);continue}if(r.type===`wildcard`){n+=`*`+stringifyName(r.name,e[t]);continue}throw TypeError(`Unknown token type: ${r.type}`)}return n}function stringify(e){return stringifyTokens(e.tokens,0)}function stringifyName(e,t){return!r.test(e)||t?.type===`text`&&n.test(t.value[0])?JSON.stringify(e):e}})),Dm=__commonJSMin(((e,t)=>{
258
+ var{METHODS:t}=(Qp(),__toCommonJS(Jp)),n=Xl(),r=$p(),i=ql(),o=nm(),s=Id(),c=(bm(),__toCommonJS(mm));let{Buffer:l}=(U(),__toCommonJS(an));e.methods=t.map(e=>e.toLowerCase()),e.etag=createETagGenerator({weak:!1}),e.wetag=createETagGenerator({weak:!0}),e.normalizeType=function(e){return~e.indexOf(`/`)?acceptParams(e):{value:i.lookup(e)||`application/octet-stream`,params:{}}},e.normalizeTypes=function(t){return t.map(e.normalizeType)};function acceptParams(e){for(var t=e.length,n=e.indexOf(`;`),r=n===-1?t:n,i={value:e.slice(0,r).trim(),quality:1,params:{}};r<t;){var o=e.indexOf(`=`,r);if(o===-1)break;var n=e.indexOf(`;`,r),s=n===-1?t:n;if(o>s){r=e.lastIndexOf(`;`,o-1)+1;continue}var c=e.slice(r,o).trim(),l=e.slice(o+1,s).trim();c===`q`?i.quality=parseFloat(l):i.params[c]=l,r=s+1}return i}e.compileETag=function(t){var n;if(typeof t==`function`)return t;switch(t){case!0:case`weak`:n=e.wetag;break;case!1:break;case`strong`:n=e.etag;break;default:throw TypeError(`unknown value for etag function: `+t)}return n},e.compileQueryParser=function compileQueryParser(e){var t;if(typeof e==`function`)return e;switch(e){case!0:case`simple`:t=c.parse;break;case!1:break;case`extended`:t=parseExtendedQueryString;break;default:throw TypeError(`unknown value for query parser function: `+e)}return t},e.compileTrust=function(e){return typeof e==`function`?e:e===!0?function(){return!0}:typeof e==`number`?function(t,n){return n<e}:(typeof e==`string`&&(e=e.split(`,`).map(function(e){return e.trim()})),o.compile(e||[]))},e.setCharset=function setCharset(e,t){if(!e||!t)return e;var r=n.parse(e);return r.parameters.charset=t,n.format(r)};function createETagGenerator(e){return function generateETag(t,n){return r(l.isBuffer(t)?t:l.from(t,n),e)}}function parseExtendedQueryString(e){return s.parse(e,{allowPrototypes:!0})}})),Sm=__commonJSMin(((e,t)=>{t.exports=wrappy;function wrappy(e,t){if(e&&t)return wrappy(e)(t);if(typeof e!=`function`)throw TypeError(`need wrapper function`);return Object.keys(e).forEach(function(t){wrapper[t]=e[t]}),wrapper;function wrapper(){for(var t=Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];var r=e.apply(this,t),i=t[t.length-1];return typeof r==`function`&&r!==i&&Object.keys(i).forEach(function(e){r[e]=i[e]}),r}}})),Cm=__commonJSMin(((e,t)=>{var n=Sm();t.exports=n(once),t.exports.strict=n(onceStrict),once.proto=once(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return once(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return onceStrict(this)},configurable:!0})});function once(e){var f=function(){return f.called?f.value:(f.called=!0,f.value=e.apply(this,arguments))};return f.called=!1,f}function onceStrict(e){var f=function(){if(f.called)throw Error(f.onceError);return f.called=!0,f.value=e.apply(this,arguments)};return f.onceError=(e.name||"Function wrapped with `once`")+` shouldn't be called more than once`,f.called=!1,f}})),wm=__commonJSMin(((e,t)=>{t.exports=isPromise,t.exports.default=isPromise;function isPromise(e){return!!e&&(typeof e==`object`||typeof e==`function`)&&typeof e.then==`function`}})),Tm=__commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PathError=e.TokenData=void 0,e.parse=parse,e.compile=compile,e.match=match,e.pathToRegexp=pathToRegexp,e.stringify=stringify;let NOOP_VALUE=e=>e,t=/^[$_\p{ID_Start}]$/u,n=/^[$\u200c\u200d\p{ID_Continue}]$/u,r=/^[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u;function escapeText(e){return e.replace(/[{}()\[\]+?!:*\\]/g,`\\$&`)}function escape(e){return e.replace(/[.+*?^${}()[\]|/\\]/g,`\\$&`)}var TokenData=class{constructor(e,t){this.tokens=e,this.originalPath=t}};e.TokenData=TokenData;var PathError=class extends TypeError{constructor(e,t){let n=e;t&&(n+=`: ${t}`),n+=`; visit https://git.new/pathToRegexpError for info`,super(n),this.originalPath=t}};e.PathError=PathError;function parse(e,r={}){let{encodePath:i=NOOP_VALUE}=r,o=[...e],s=0;function consumeUntil(r){let c=[],l=``;function writePath(){l&&=(c.push({type:`text`,value:i(l)}),``)}for(;s<o.length;){let i=o[s++];if(i===r)return writePath(),c;if(i===`\\`){if(s===o.length)throw new PathError(`Unexpected end after \\ at index ${s}`,e);l+=o[s++];continue}if(i===`:`||i===`*`){let r=i===`:`?`param`:`wildcard`,l=``;if(t.test(o[s]))do l+=o[s++];while(n.test(o[s]));else if(o[s]===`"`){let t=s;for(;s<o.length;){if(o[++s]===`"`){s++,t=0;break}o[s]===`\\`&&s++,l+=o[s]}if(t)throw new PathError(`Unterminated quote at index ${t}`,e)}if(!l)throw new PathError(`Missing parameter name at index ${s}`,e);writePath(),c.push({type:r,name:l});continue}if(i===`{`){writePath(),c.push({type:`group`,tokens:consumeUntil(`}`)});continue}if(i===`}`||i===`(`||i===`)`||i===`[`||i===`]`||i===`+`||i===`?`||i===`!`)throw new PathError(`Unexpected ${i} at index ${s-1}`,e);l+=i}if(r)throw new PathError(`Unexpected end at index ${s}, expected ${r}`,e);return writePath(),c}return new TokenData(consumeUntil(``),e)}function compile(e,t={}){let{encode:n=encodeURIComponent,delimiter:r=`/`}=t,i=tokensToFunction((typeof e==`object`?e:parse(e,t)).tokens,r,n);return function path(e={}){let t=[],n=i(e,t);if(t.length)throw TypeError(`Missing parameters: ${t.join(`, `)}`);return n}}function tokensToFunction(e,t,n){let r=e.map(e=>tokenToFunction(e,t,n));return(e,t)=>{let n=``;for(let i of r)n+=i(e,t);return n}}function tokenToFunction(e,t,n){if(e.type===`text`)return()=>e.value;if(e.type===`group`){let r=tokensToFunction(e.tokens,t,n);return(e,t)=>{let n=t.length,i=r(e,t);return t.length===n?i:(t.length=n,``)}}let r=n||NOOP_VALUE;return e.type===`wildcard`&&n!==!1?(n,i)=>{let o=n[e.name];if(o==null)return i.push(e.name),``;if(!Array.isArray(o)||o.length===0)throw TypeError(`Expected "${e.name}" to be a non-empty array`);let s=``;for(let n=0;n<o.length;n++){if(typeof o[n]!=`string`)throw TypeError(`Expected "${e.name}/${n}" to be a string`);n>0&&(s+=t),s+=r(o[n])}return s}:(t,n)=>{let i=t[e.name];if(i==null)return n.push(e.name),``;if(typeof i!=`string`)throw TypeError(`Expected "${e.name}" to be a string`);return r(i)}}function match(e,t={}){let{decode:n=decodeURIComponent,delimiter:r=`/`}=t,{regexp:i,keys:o}=pathToRegexp(e,t),s=o.map(e=>n===!1?NOOP_VALUE:e.type===`param`?n:e=>e.split(r).map(n));return function match(e){let t=i.exec(e);if(!t)return!1;let n=t[0],r=Object.create(null);for(let e=1;e<t.length;e++){if(t[e]===void 0)continue;let n=o[e-1],i=s[e-1];r[n.name]=i(t[e])}return{path:n,params:r}}}function pathToRegexp(e,t={}){let{delimiter:n=`/`,end:r=!0,sensitive:i=!1,trailing:o=!0}=t,s=[],c=``,l=0;function process(e){if(Array.isArray(e)){for(let t of e)process(t);return}let r=typeof e==`object`?e:parse(e,t);flatten(r.tokens,0,[],e=>{if(l>=256)throw new PathError(`Too many path combinations`,r.originalPath);l>0&&(c+=`|`),c+=toRegExpSource(e,n,s,r.originalPath),l++})}process(e);let u=`^(?:${c})`;return o&&(u+=`(?:`+escape(n)+`$)?`),u+=r?`$`:`(?=`+escape(n)+`|$)`,{regexp:new RegExp(u,i?``:`i`),keys:s}}function flatten(e,t,n,r){for(;t<e.length;){let i=e[t++];if(i.type===`group`){let o=n.length;flatten(i.tokens,0,n,n=>flatten(e,t,n,r)),n.length=o;continue}n.push(i)}r(n)}function toRegExpSource(e,t,n,r){let i=``,o=``,s=``,c=0,l=0,u=0;function hasInSegment(n,r){for(;n<e.length;){let i=e[n++];if(i.type===r)return!0;if(i.type===`text`&&i.value.includes(t))break}return!1}function peekText(t){let n=``;for(;t<e.length;){let r=e[t++];if(r.type!==`text`)break;n+=r.value}return n}for(;u<e.length;){let d=e[u++];if(d.type===`text`){i+=escape(d.value),o+=d.value,c===2&&(s+=d.value),d.value.includes(t)&&(l=0);continue}if(d.type===`param`||d.type===`wildcard`){if(c&&!o)throw new PathError(`Missing text before "${d.name}" ${d.type}`,r);d.type===`param`?(i+=l&2?`(${negate(t,o)}+)`:hasInSegment(u,`wildcard`)?`(${negate(t,peekText(u))}+)`:l&1?`(${negate(t,o)}+|${escape(o)})`:`(${negate(t,``)}+)`,l|=c=1):(i+=l&2?`(${negate(o,``)}+)`:s?`(${negate(s,``)}+|${negate(t,``)}+)`:`([^]+)`,s=``,l|=c=2),n.push(d),o=``;continue}throw TypeError(`Unknown token type: ${d.type}`)}return i}function negate(e,t){return t.length>e.length?negate(t,e):(e===t&&(t=``),t.length>1?`(?:(?!${escape(e)}|${escape(t)})[^])`:e.length>1?`(?:(?!${escape(e)})[^${escape(t)}])`:`[^${escape(e+t)}]`)}function stringifyTokens(e,t){let n=``;for(;t<e.length;){let r=e[t++];if(r.type===`text`){n+=escapeText(r.value);continue}if(r.type===`group`){n+=`{`+stringifyTokens(r.tokens,0)+`}`;continue}if(r.type===`param`){n+=`:`+stringifyName(r.name,e[t]);continue}if(r.type===`wildcard`){n+=`*`+stringifyName(r.name,e[t]);continue}throw TypeError(`Unknown token type: ${r.type}`)}return n}function stringify(e){return stringifyTokens(e.tokens,0)}function stringifyName(e,t){return!r.test(e)||t?.type===`text`&&n.test(t.value[0])?JSON.stringify(e):e}})),Em=__commonJSMin(((e,t)=>{
259
259
  /*!
260
260
  * router
261
261
  * Copyright(c) 2013 Roman Shtylman
262
262
  * Copyright(c) 2014-2022 Douglas Christopher Wilson
263
263
  * MIT Licensed
264
264
  */
265
- let n=Tm(),r=Em(),i=el()(`router:layer`),o=tl()(`router`),s=/\/+$/,c=/\((?:\?<(.*?)>)?(?!\?)/g;t.exports=Layer;function Layer(e,t,n){if(!(this instanceof Layer))return new Layer(e,t,n);i(`new %o`,e);let o=t||{};this.handle=n,this.keys=[],this.name=n.name||`<anonymous>`,this.params=void 0,this.path=void 0,this.slash=e===`/`&&o.end===!1;function matcher(e){if(e instanceof RegExp){let t=[],n=0,r;for(;r=c.exec(e.source);)t.push({name:r[1]||n++,offset:r.index});return function regexpMatcher(n){let r=e.exec(n);if(!r)return!1;let i={};for(let e=1;e<r.length;e++){let n=t[e-1].name,o=decodeParam(r[e]);o!==void 0&&(i[n]=o)}return{params:i,path:r[0]}}}return r.match(o.strict?e:loosen(e),{sensitive:o.sensitive,end:o.end,trailing:!o.strict,decode:decodeParam})}this.matchers=Array.isArray(e)?e.map(matcher):[matcher(e)]}Layer.prototype.handleError=function handleError(e,t,r,i){let s=this.handle;if(s.length!==4)return i(e);try{let c=s(e,t,r,i);n(c)&&(c instanceof Promise||o(`handlers that are Promise-like are deprecated, use a native Promise instead`),c.then(null,function(e){i(e||Error(`Rejected promise`))}))}catch(e){i(e)}},Layer.prototype.handleRequest=function handleRequest(e,t,r){let i=this.handle;if(i.length>3)return r();try{let s=i(e,t,r);n(s)&&(s instanceof Promise||o(`handlers that are Promise-like are deprecated, use a native Promise instead`),s.then(null,function(e){r(e||Error(`Rejected promise`))}))}catch(e){r(e)}},Layer.prototype.match=function match(e){let t;if(e!=null){if(this.slash)return this.params={},this.path=``,!0;let n=0;for(;!t&&n<this.matchers.length;)t=this.matchers[n](e),n++}return t?(this.params=t.params,this.path=t.path,this.keys=Object.keys(t.params),!0):(this.params=void 0,this.path=void 0,!1)};function decodeParam(e){if(typeof e!=`string`||e.length===0)return e;try{return decodeURIComponent(e)}catch(t){throw t instanceof URIError&&(t.message=`Failed to decode param '`+e+`'`,t.status=400),t}}function loosen(e){return e instanceof RegExp||e===`/`?e:Array.isArray(e)?e.map(function(e){return loosen(e)}):String(e).replace(s,``)}})),Om=__commonJSMin(((e,t)=>{
265
+ let n=wm(),r=Tm(),i=el()(`router:layer`),o=tl()(`router`),s=/\/+$/,c=/\((?:\?<(.*?)>)?(?!\?)/g;t.exports=Layer;function Layer(e,t,n){if(!(this instanceof Layer))return new Layer(e,t,n);i(`new %o`,e);let o=t||{};this.handle=n,this.keys=[],this.name=n.name||`<anonymous>`,this.params=void 0,this.path=void 0,this.slash=e===`/`&&o.end===!1;function matcher(e){if(e instanceof RegExp){let t=[],n=0,r;for(;r=c.exec(e.source);)t.push({name:r[1]||n++,offset:r.index});return function regexpMatcher(n){let r=e.exec(n);if(!r)return!1;let i={};for(let e=1;e<r.length;e++){let n=t[e-1].name,o=decodeParam(r[e]);o!==void 0&&(i[n]=o)}return{params:i,path:r[0]}}}return r.match(o.strict?e:loosen(e),{sensitive:o.sensitive,end:o.end,trailing:!o.strict,decode:decodeParam})}this.matchers=Array.isArray(e)?e.map(matcher):[matcher(e)]}Layer.prototype.handleError=function handleError(e,t,r,i){let s=this.handle;if(s.length!==4)return i(e);try{let c=s(e,t,r,i);n(c)&&(c instanceof Promise||o(`handlers that are Promise-like are deprecated, use a native Promise instead`),c.then(null,function(e){i(e||Error(`Rejected promise`))}))}catch(e){i(e)}},Layer.prototype.handleRequest=function handleRequest(e,t,r){let i=this.handle;if(i.length>3)return r();try{let s=i(e,t,r);n(s)&&(s instanceof Promise||o(`handlers that are Promise-like are deprecated, use a native Promise instead`),s.then(null,function(e){r(e||Error(`Rejected promise`))}))}catch(e){r(e)}},Layer.prototype.match=function match(e){let t;if(e!=null){if(this.slash)return this.params={},this.path=``,!0;let n=0;for(;!t&&n<this.matchers.length;)t=this.matchers[n](e),n++}return t?(this.params=t.params,this.path=t.path,this.keys=Object.keys(t.params),!0):(this.params=void 0,this.path=void 0,!1)};function decodeParam(e){if(typeof e!=`string`||e.length===0)return e;try{return decodeURIComponent(e)}catch(t){throw t instanceof URIError&&(t.message=`Failed to decode param '`+e+`'`,t.status=400),t}}function loosen(e){return e instanceof RegExp||e===`/`?e:Array.isArray(e)?e.map(function(e){return loosen(e)}):String(e).replace(s,``)}})),Dm=__commonJSMin(((e,t)=>{
266
266
  /*!
267
267
  * router
268
268
  * Copyright(c) 2013 Roman Shtylman
269
269
  * Copyright(c) 2014-2022 Douglas Christopher Wilson
270
270
  * MIT Licensed
271
271
  */
272
- let n=el()(`router:route`),r=Dm(),{METHODS:i}=($p(),__toCommonJS(Yp)),o=Array.prototype.slice,s=Array.prototype.flat,c=i.map(e=>e.toLowerCase());t.exports=Route;function Route(e){n(`new %o`,e),this.path=e,this.stack=[],this.methods=Object.create(null)}Route.prototype._handlesMethod=function _handlesMethod(e){if(this.methods._all)return!0;let t=typeof e==`string`?e.toLowerCase():e;return t===`head`&&!this.methods.head&&(t=`get`),!!this.methods[t]},Route.prototype._methods=function _methods(){let e=Object.keys(this.methods);this.methods.get&&!this.methods.head&&e.push(`head`);for(let t=0;t<e.length;t++)e[t]=e[t].toUpperCase();return e},Route.prototype.dispatch=function dispatch(e,t,n){let r=0,i=this.stack,o=0;if(i.length===0)return n();let s=typeof e.method==`string`?e.method.toLowerCase():e.method;s===`head`&&!this.methods.head&&(s=`get`),e.route=this,next();function next(c){if(c&&c===`route`)return n();if(c&&c===`router`||r>=i.length)return n(c);if(++o>100)return setImmediate(next,c);let l,u;for(;u!==!0&&r<i.length;)l=i[r++],u=!l.method||l.method===s;if(u!==!0)return n(c);c?l.handleError(c,e,t,next):l.handleRequest(e,t,next),o=0}},Route.prototype.all=function all(e){let t=s.call(o.call(arguments),1/0);if(t.length===0)throw TypeError(`argument handler is required`);for(let e=0;e<t.length;e++){let n=t[e];if(typeof n!=`function`)throw TypeError(`argument handler must be a function`);let i=r(`/`,{},n);i.method=void 0,this.methods._all=!0,this.stack.push(i)}return this},c.forEach(function(e){Route.prototype[e]=function(t){let i=s.call(o.call(arguments),1/0);if(i.length===0)throw TypeError(`argument handler is required`);for(let t=0;t<i.length;t++){let o=i[t];if(typeof o!=`function`)throw TypeError(`argument handler must be a function`);n(`%s %s`,e,this.path);let s=r(`/`,{},o);s.method=e,this.methods[e]=!0,this.stack.push(s)}return this}})})),km=__commonJSMin(((e,t)=>{
272
+ let n=el()(`router:route`),r=Em(),{METHODS:i}=(Qp(),__toCommonJS(Jp)),o=Array.prototype.slice,s=Array.prototype.flat,c=i.map(e=>e.toLowerCase());t.exports=Route;function Route(e){n(`new %o`,e),this.path=e,this.stack=[],this.methods=Object.create(null)}Route.prototype._handlesMethod=function _handlesMethod(e){if(this.methods._all)return!0;let t=typeof e==`string`?e.toLowerCase():e;return t===`head`&&!this.methods.head&&(t=`get`),!!this.methods[t]},Route.prototype._methods=function _methods(){let e=Object.keys(this.methods);this.methods.get&&!this.methods.head&&e.push(`head`);for(let t=0;t<e.length;t++)e[t]=e[t].toUpperCase();return e},Route.prototype.dispatch=function dispatch(e,t,n){let r=0,i=this.stack,o=0;if(i.length===0)return n();let s=typeof e.method==`string`?e.method.toLowerCase():e.method;s===`head`&&!this.methods.head&&(s=`get`),e.route=this,next();function next(c){if(c&&c===`route`)return n();if(c&&c===`router`||r>=i.length)return n(c);if(++o>100)return setImmediate(next,c);let l,u;for(;u!==!0&&r<i.length;)l=i[r++],u=!l.method||l.method===s;if(u!==!0)return n(c);c?l.handleError(c,e,t,next):l.handleRequest(e,t,next),o=0}},Route.prototype.all=function all(e){let t=s.call(o.call(arguments),1/0);if(t.length===0)throw TypeError(`argument handler is required`);for(let e=0;e<t.length;e++){let n=t[e];if(typeof n!=`function`)throw TypeError(`argument handler must be a function`);let i=r(`/`,{},n);i.method=void 0,this.methods._all=!0,this.stack.push(i)}return this},c.forEach(function(e){Route.prototype[e]=function(t){let i=s.call(o.call(arguments),1/0);if(i.length===0)throw TypeError(`argument handler is required`);for(let t=0;t<i.length;t++){let o=i[t];if(typeof o!=`function`)throw TypeError(`argument handler must be a function`);n(`%s %s`,e,this.path);let s=r(`/`,{},o);s.method=e,this.methods[e]=!0,this.stack.push(s)}return this}})})),Om=__commonJSMin(((e,t)=>{
273
273
  /*!
274
274
  * router
275
275
  * Copyright(c) 2013 Roman Shtylman
276
276
  * Copyright(c) 2014-2022 Douglas Christopher Wilson
277
277
  * MIT Licensed
278
278
  */
279
- let n=Tm(),r=Dm(),{METHODS:i}=($p(),__toCommonJS(Yp)),o=Ud(),s=Om(),c=el()(`router`),l=tl()(`router`),u=Array.prototype.slice,d=Array.prototype.flat,p=i.map(e=>e.toLowerCase());t.exports=Router,t.exports.Route=s;function Router(e){if(!(this instanceof Router))return new Router(e);let t=e||{};function router(e,t,n){router.handle(e,t,n)}return Object.setPrototypeOf(router,this),router.caseSensitive=t.caseSensitive,router.mergeParams=t.mergeParams,router.params={},router.strict=t.strict,router.stack=[],router}Router.prototype=function(){},Router.prototype.param=function param(e,t){if(!e)throw TypeError(`argument name is required`);if(typeof e!=`string`)throw TypeError(`argument name must be a string`);if(!t)throw TypeError(`argument fn is required`);if(typeof t!=`function`)throw TypeError(`argument fn must be a function`);let n=this.params[e];return n||=this.params[e]=[],n.push(t),this},Router.prototype.handle=function handle(e,t,n){if(!n)throw TypeError(`argument callback is required`);c(`dispatching %s %s`,e.method,e.url);let r=0,i,o=getProtohost(e.url)||``,s=``,l=this,u=!1,d=0,p={},m=this.stack,h=e.params,g=e.baseUrl||``,_=restore(n,e,`baseUrl`,`next`,`params`);e.next=next,e.method===`OPTIONS`&&(i=[],_=wrap(_,generateOptionsResponder(t,i))),e.baseUrl=g,e.originalUrl=e.originalUrl||e.url,next();function next(n){let c=n===`route`?null:n;if(u&&=(e.url=e.url.slice(1),!1),s.length!==0&&(e.baseUrl=g,e.url=o+s+e.url.slice(o.length),s=``),c===`router`){setImmediate(_,null);return}if(r>=m.length){setImmediate(_,c);return}if(++d>100)return setImmediate(next,n);let v=getPathname(e);if(v==null)return _(c);let y,b,x;for(;b!==!0&&r<m.length;){if(y=m[r++],b=matchLayer(y,v),x=y.route,typeof b!=`boolean`&&(c||=b),b!==!0||!x)continue;if(c){b=!1;continue}let t=e.method,n=x._handlesMethod(t);!n&&t===`OPTIONS`&&i&&i.push.apply(i,x._methods()),!n&&t!==`HEAD`&&(b=!1)}if(b!==!0)return _(c);x&&(e.route=x),e.params=l.mergeParams?mergeParams(y.params,h):y.params;let S=y.path;processParams(l.params,y,p,e,t,function(n){n?next(c||n):x?y.handleRequest(e,t,next):trimPrefix(y,c,S,v),d=0})}function trimPrefix(n,r,i,l){if(i.length!==0){if(i!==l.substring(0,i.length)){next(r);return}let t=l[i.length];if(t&&t!==`/`){next(r);return}c(`trim prefix (%s) from url %s`,i,e.url),s=i,e.url=o+e.url.slice(o.length+s.length),!o&&e.url[0]!==`/`&&(e.url=`/`+e.url,u=!0),e.baseUrl=g+(s[s.length-1]===`/`?s.substring(0,s.length-1):s)}c(`%s %s : %s`,n.name,i,e.originalUrl),r?n.handleError(r,e,t,next):n.handleRequest(e,t,next)}},Router.prototype.use=function use(e){let t=0,n=`/`;if(typeof e!=`function`){let r=e;for(;Array.isArray(r)&&r.length!==0;)r=r[0];typeof r!=`function`&&(t=1,n=e)}let i=d.call(u.call(arguments,t),1/0);if(i.length===0)throw TypeError(`argument handler is required`);for(let e=0;e<i.length;e++){let t=i[e];if(typeof t!=`function`)throw TypeError(`argument handler must be a function`);c(`use %o %s`,n,t.name||`<anonymous>`);let o=new r(n,{sensitive:this.caseSensitive,strict:!1,end:!1},t);o.route=void 0,this.stack.push(o)}return this},Router.prototype.route=function route(e){let t=new s(e),n=new r(e,{sensitive:this.caseSensitive,strict:this.strict,end:!0},handle);function handle(e,n,r){t.dispatch(e,n,r)}return n.route=t,this.stack.push(n),t},p.concat(`all`).forEach(function(e){Router.prototype[e]=function(t){let n=this.route(t);return n[e].apply(n,u.call(arguments,1)),this}});function generateOptionsResponder(e,t){return function onDone(n,r){if(r||t.length===0)return n(r);trySendOptionsResponse(e,t,n)}}function getPathname(e){try{return o(e).pathname}catch{return}}function getProtohost(e){if(typeof e!=`string`||e.length===0||e[0]===`/`)return;let t=e.indexOf(`?`),n=t===-1?e.length:t,r=e.substring(0,n).indexOf(`://`);return r===-1?void 0:e.substring(0,e.indexOf(`/`,3+r))}function matchLayer(e,t){try{return e.match(t)}catch(e){return e}}function mergeParams(e,t){if(typeof t!=`object`||!t)return e;let n=Object.assign({},t);if(!(0 in e)||!(0 in t))return Object.assign(n,e);let r=0,i=0;for(;r in e;)r++;for(;i in t;)i++;for(r--;r>=0;r--)e[r+i]=e[r],r<i&&delete e[r];return Object.assign(n,e)}function processParams(e,t,r,i,o,s){let c=t.keys;if(!c||c.length===0)return s();let u=0,d=0,p,m,h,g;function param(t){if(t)return s(t);if(u>=c.length)return s();if(d=0,p=c[u++],m=i.params[p],h=e[p],g=r[p],m===void 0||!h)return param();if(g&&(g.match===m||g.error&&g.error!==`route`))return i.params[p]=g.value,param(g.error);r[p]=g={error:null,match:m,value:m},paramCallback()}function paramCallback(e){let t=h[d++];if(g.value=i.params[p],e){g.error=e,param(e);return}if(!t)return param();try{let e=t(i,o,paramCallback,m,p);n(e)&&(e instanceof Promise||l(`parameters that are Promise-like are deprecated, use a native Promise instead`),e.then(null,function(e){paramCallback(e||Error(`Rejected promise`))}))}catch(e){paramCallback(e)}}param()}function restore(e,t){let n=Array(arguments.length-2),r=Array(arguments.length-2);for(let e=0;e<n.length;e++)n[e]=arguments[e+2],r[e]=t[n[e]];return function(){for(let e=0;e<n.length;e++)t[n[e]]=r[e];return e.apply(this,arguments)}}function sendOptionsResponse(e,t){let n=Object.create(null);for(let e=0;e<t.length;e++)n[t[e]]=!0;let r=Object.keys(n).sort().join(`, `);e.setHeader(`Allow`,r),e.setHeader(`Content-Length`,Buffer.byteLength(r)),e.setHeader(`Content-Type`,`text/plain`),e.setHeader(`X-Content-Type-Options`,`nosniff`),e.end(r)}function trySendOptionsResponse(e,t,n){try{sendOptionsResponse(e,t)}catch(e){n(e)}}function wrap(e,t){return function proxy(){let n=Array(arguments.length+1);n[0]=e;for(let e=0,t=arguments.length;e<t;e++)n[e+1]=arguments[e];t.apply(this,n)}}})),Am=__commonJSMin(((e,t)=>{
279
+ let n=wm(),r=Em(),{METHODS:i}=(Qp(),__toCommonJS(Jp)),o=Ud(),s=Dm(),c=el()(`router`),l=tl()(`router`),u=Array.prototype.slice,d=Array.prototype.flat,p=i.map(e=>e.toLowerCase());t.exports=Router,t.exports.Route=s;function Router(e){if(!(this instanceof Router))return new Router(e);let t=e||{};function router(e,t,n){router.handle(e,t,n)}return Object.setPrototypeOf(router,this),router.caseSensitive=t.caseSensitive,router.mergeParams=t.mergeParams,router.params={},router.strict=t.strict,router.stack=[],router}Router.prototype=function(){},Router.prototype.param=function param(e,t){if(!e)throw TypeError(`argument name is required`);if(typeof e!=`string`)throw TypeError(`argument name must be a string`);if(!t)throw TypeError(`argument fn is required`);if(typeof t!=`function`)throw TypeError(`argument fn must be a function`);let n=this.params[e];return n||=this.params[e]=[],n.push(t),this},Router.prototype.handle=function handle(e,t,n){if(!n)throw TypeError(`argument callback is required`);c(`dispatching %s %s`,e.method,e.url);let r=0,i,o=getProtohost(e.url)||``,s=``,l=this,u=!1,d=0,p={},m=this.stack,h=e.params,g=e.baseUrl||``,_=restore(n,e,`baseUrl`,`next`,`params`);e.next=next,e.method===`OPTIONS`&&(i=[],_=wrap(_,generateOptionsResponder(t,i))),e.baseUrl=g,e.originalUrl=e.originalUrl||e.url,next();function next(n){let c=n===`route`?null:n;if(u&&=(e.url=e.url.slice(1),!1),s.length!==0&&(e.baseUrl=g,e.url=o+s+e.url.slice(o.length),s=``),c===`router`){setImmediate(_,null);return}if(r>=m.length){setImmediate(_,c);return}if(++d>100)return setImmediate(next,n);let v=getPathname(e);if(v==null)return _(c);let y,b,x;for(;b!==!0&&r<m.length;){if(y=m[r++],b=matchLayer(y,v),x=y.route,typeof b!=`boolean`&&(c||=b),b!==!0||!x)continue;if(c){b=!1;continue}let t=e.method,n=x._handlesMethod(t);!n&&t===`OPTIONS`&&i&&i.push.apply(i,x._methods()),!n&&t!==`HEAD`&&(b=!1)}if(b!==!0)return _(c);x&&(e.route=x),e.params=l.mergeParams?mergeParams(y.params,h):y.params;let S=y.path;processParams(l.params,y,p,e,t,function(n){n?next(c||n):x?y.handleRequest(e,t,next):trimPrefix(y,c,S,v),d=0})}function trimPrefix(n,r,i,l){if(i.length!==0){if(i!==l.substring(0,i.length)){next(r);return}let t=l[i.length];if(t&&t!==`/`){next(r);return}c(`trim prefix (%s) from url %s`,i,e.url),s=i,e.url=o+e.url.slice(o.length+s.length),!o&&e.url[0]!==`/`&&(e.url=`/`+e.url,u=!0),e.baseUrl=g+(s[s.length-1]===`/`?s.substring(0,s.length-1):s)}c(`%s %s : %s`,n.name,i,e.originalUrl),r?n.handleError(r,e,t,next):n.handleRequest(e,t,next)}},Router.prototype.use=function use(e){let t=0,n=`/`;if(typeof e!=`function`){let r=e;for(;Array.isArray(r)&&r.length!==0;)r=r[0];typeof r!=`function`&&(t=1,n=e)}let i=d.call(u.call(arguments,t),1/0);if(i.length===0)throw TypeError(`argument handler is required`);for(let e=0;e<i.length;e++){let t=i[e];if(typeof t!=`function`)throw TypeError(`argument handler must be a function`);c(`use %o %s`,n,t.name||`<anonymous>`);let o=new r(n,{sensitive:this.caseSensitive,strict:!1,end:!1},t);o.route=void 0,this.stack.push(o)}return this},Router.prototype.route=function route(e){let t=new s(e),n=new r(e,{sensitive:this.caseSensitive,strict:this.strict,end:!0},handle);function handle(e,n,r){t.dispatch(e,n,r)}return n.route=t,this.stack.push(n),t},p.concat(`all`).forEach(function(e){Router.prototype[e]=function(t){let n=this.route(t);return n[e].apply(n,u.call(arguments,1)),this}});function generateOptionsResponder(e,t){return function onDone(n,r){if(r||t.length===0)return n(r);trySendOptionsResponse(e,t,n)}}function getPathname(e){try{return o(e).pathname}catch{return}}function getProtohost(e){if(typeof e!=`string`||e.length===0||e[0]===`/`)return;let t=e.indexOf(`?`),n=t===-1?e.length:t,r=e.substring(0,n).indexOf(`://`);return r===-1?void 0:e.substring(0,e.indexOf(`/`,3+r))}function matchLayer(e,t){try{return e.match(t)}catch(e){return e}}function mergeParams(e,t){if(typeof t!=`object`||!t)return e;let n=Object.assign({},t);if(!(0 in e)||!(0 in t))return Object.assign(n,e);let r=0,i=0;for(;r in e;)r++;for(;i in t;)i++;for(r--;r>=0;r--)e[r+i]=e[r],r<i&&delete e[r];return Object.assign(n,e)}function processParams(e,t,r,i,o,s){let c=t.keys;if(!c||c.length===0)return s();let u=0,d=0,p,m,h,g;function param(t){if(t)return s(t);if(u>=c.length)return s();if(d=0,p=c[u++],m=i.params[p],h=e[p],g=r[p],m===void 0||!h)return param();if(g&&(g.match===m||g.error&&g.error!==`route`))return i.params[p]=g.value,param(g.error);r[p]=g={error:null,match:m,value:m},paramCallback()}function paramCallback(e){let t=h[d++];if(g.value=i.params[p],e){g.error=e,param(e);return}if(!t)return param();try{let e=t(i,o,paramCallback,m,p);n(e)&&(e instanceof Promise||l(`parameters that are Promise-like are deprecated, use a native Promise instead`),e.then(null,function(e){paramCallback(e||Error(`Rejected promise`))}))}catch(e){paramCallback(e)}}param()}function restore(e,t){let n=Array(arguments.length-2),r=Array(arguments.length-2);for(let e=0;e<n.length;e++)n[e]=arguments[e+2],r[e]=t[n[e]];return function(){for(let e=0;e<n.length;e++)t[n[e]]=r[e];return e.apply(this,arguments)}}function sendOptionsResponse(e,t){let n=Object.create(null);for(let e=0;e<t.length;e++)n[t[e]]=!0;let r=Object.keys(n).sort().join(`, `);e.setHeader(`Allow`,r),e.setHeader(`Content-Length`,Buffer.byteLength(r)),e.setHeader(`Content-Type`,`text/plain`),e.setHeader(`X-Content-Type-Options`,`nosniff`),e.end(r)}function trySendOptionsResponse(e,t,n){try{sendOptionsResponse(e,t)}catch(e){n(e)}}function wrap(e,t){return function proxy(){let n=Array(arguments.length+1);n[0]=e;for(let e=0,t=arguments.length;e<t;e++)n[e+1]=arguments[e];t.apply(this,n)}}})),km=__commonJSMin(((e,t)=>{
280
280
  /*!
281
281
  * express
282
282
  * Copyright(c) 2009-2013 TJ Holowaychuk
@@ -284,7 +284,7 @@ let n=Tm(),r=Dm(),{METHODS:i}=($p(),__toCommonJS(Yp)),o=Ud(),s=Om(),c=el()(`rout
284
284
  * Copyright(c) 2014-2015 Douglas Christopher Wilson
285
285
  * MIT Licensed
286
286
  */
287
- N();var n=Wd(),r=el()(`express:application`),i=sp(),o=($p(),__toCommonJS(Yp)),s=Sm().methods,c=Sm().compileETag,l=Sm().compileQueryParser,u=Sm().compileTrust,d=(jr(),__toCommonJS(hr)).resolve,p=wm(),m=km(),h=Array.prototype.slice,g=Array.prototype.flat,_=e=t.exports={},v=`@@symbol:trust_proxy_default`;_.init=function init(){var e=null;this.cache=Object.create(null),this.engines=Object.create(null),this.settings=Object.create(null),this.defaultConfiguration(),Object.defineProperty(this,"router",{configurable:!0,enumerable:!0,get:function getrouter(){return e===null&&(e=new m({caseSensitive:this.enabled(`case sensitive routing`),strict:this.enabled(`strict routing`)})),e}})},_.defaultConfiguration=function defaultConfiguration(){var e=`production`;this.enable(`x-powered-by`),this.set(`etag`,`weak`),this.set(`env`,e),this.set(`query parser`,`simple`),this.set(`subdomain offset`,2),this.set(`trust proxy`,!1),Object.defineProperty(this.settings,v,{configurable:!0,value:!0}),r(`booting in %s mode`,e),this.on(`mount`,function onmount(e){this.settings[v]===!0&&typeof e.settings[`trust proxy fn`]==`function`&&(delete this.settings[`trust proxy`],delete this.settings[`trust proxy fn`]),Object.setPrototypeOf(this.request,e.request),Object.setPrototypeOf(this.response,e.response),Object.setPrototypeOf(this.engines,e.engines),Object.setPrototypeOf(this.settings,e.settings)}),this.locals=Object.create(null),this.mountpath=`/`,this.locals.settings=this.settings,this.set(`view`,i),this.set(`views`,d(`views`)),this.set(`jsonp callback name`,`callback`),e===`production`&&this.enable(`view cache`)},_.handle=function handle(e,t,r){var i=r||n(e,t,{env:this.get(`env`),onerror:logerror.bind(this)});this.enabled(`x-powered-by`)&&t.setHeader(`X-Powered-By`,`Express`),e.res=t,t.req=e,Object.setPrototypeOf(e,this.request),Object.setPrototypeOf(t,this.response),t.locals||=Object.create(null),this.router.handle(e,t,i)},_.use=function use(e){var t=0,n=`/`;if(typeof e!=`function`){for(var i=e;Array.isArray(i)&&i.length!==0;)i=i[0];typeof i!=`function`&&(t=1,n=e)}var o=g.call(h.call(arguments,t),1/0);if(o.length===0)throw TypeError(`app.use() requires a middleware function`);var s=this.router;return o.forEach(function(e){if(!e||!e.handle||!e.set)return s.use(n,e);r(`.use app under %s`,n),e.mountpath=n,e.parent=this,s.use(n,function mounted_app(t,n,r){var i=t.app;e.handle(t,n,function(e){Object.setPrototypeOf(t,i.request),Object.setPrototypeOf(n,i.response),r(e)})}),e.emit(`mount`,this)},this),this},_.route=function route(e){return this.router.route(e)},_.engine=function engine(e,t){if(typeof t!=`function`)throw Error(`callback function required`);var n=e[0]===`.`?e:`.`+e;return this.engines[n]=t,this},_.param=function param(e,t){if(Array.isArray(e)){for(var n=0;n<e.length;n++)this.param(e[n],t);return this}return this.router.param(e,t),this},_.set=function set(e,t){if(arguments.length===1)return this.settings[e];switch(r(`set "%s" to %o`,e,t),this.settings[e]=t,e){case`etag`:this.set(`etag fn`,c(t));break;case`query parser`:this.set(`query parser fn`,l(t));break;case`trust proxy`:this.set(`trust proxy fn`,u(t)),Object.defineProperty(this.settings,v,{configurable:!0,value:!1});break}return this},_.path=function path(){return this.parent?this.parent.path()+this.mountpath:``},_.enabled=function enabled(e){return!!this.set(e)},_.disabled=function disabled(e){return!this.set(e)},_.enable=function enable(e){return this.set(e,!0)},_.disable=function disable(e){return this.set(e,!1)},s.forEach(function(e){_[e]=function(t){if(e===`get`&&arguments.length===1)return this.set(t);var n=this.route(t);return n[e].apply(n,h.call(arguments,1)),this}}),_.all=function all(e){for(var t=this.route(e),n=h.call(arguments,1),r=0;r<s.length;r++)t[s[r]].apply(t,n);return this},_.render=function render(e,t,n){var r=this.cache,i=n,o=this.engines,s=t,c;typeof t==`function`&&(i=t,s={});var l={...this.locals,...s._locals,...s};if(l.cache??=this.enabled(`view cache`),l.cache&&(c=r[e]),!c){if(c=new(this.get(`view`))(e,{defaultEngine:this.get(`view engine`),root:this.get(`views`),engines:o}),!c.path){var u=Array.isArray(c.root)&&c.root.length>1?`directories "`+c.root.slice(0,-1).join(`", "`)+`" or "`+c.root[c.root.length-1]+`"`:`directory "`+c.root+`"`,d=Error(`Failed to lookup view "`+e+`" in views `+u);return d.view=c,i(d)}l.cache&&(r[e]=c)}tryRender(c,l,i)},_.listen=function listen(){var e=o.createServer(this),t=h.call(arguments);if(typeof t[t.length-1]==`function`){var n=t[t.length-1]=p(t[t.length-1]);e.once(`error`,n)}return e.listen.apply(e,t)};function logerror(e){this.get(`env`)!==`test`&&M.error(e.stack||e.toString())}function tryRender(e,t,n){try{e.render(t,n)}catch(e){n(e)}}})),jm=__commonJSMin(((e,t)=>{t.exports=preferredCharsets,t.exports.preferredCharsets=preferredCharsets;var n=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function parseAcceptCharset(e){for(var t=e.split(`,`),n=0,r=0;n<t.length;n++){var i=parseCharset(t[n].trim(),n);i&&(t[r++]=i)}return t.length=r,t}function parseCharset(e,t){var r=n.exec(e);if(!r)return null;var i=r[1],o=1;if(r[2])for(var s=r[2].split(`;`),c=0;c<s.length;c++){var l=s[c].trim().split(`=`);if(l[0]===`q`){o=parseFloat(l[1]);break}}return{charset:i,q:o,i:t}}function getCharsetPriority(e,t,n){for(var r={o:-1,q:0,s:0},i=0;i<t.length;i++){var o=specify(e,t[i],n);o&&(r.s-o.s||r.q-o.q||r.o-o.o)<0&&(r=o)}return r}function specify(e,t,n){var r=0;if(t.charset.toLowerCase()===e.toLowerCase())r|=1;else if(t.charset!==`*`)return null;return{i:n,o:t.i,q:t.q,s:r}}function preferredCharsets(e,t){var n=parseAcceptCharset(e===void 0?`*`:e||``);if(!t)return n.filter(isQuality).sort(compareSpecs).map(getFullCharset);var r=t.map(function getPriority(e,t){return getCharsetPriority(e,n,t)});return r.filter(isQuality).sort(compareSpecs).map(function getCharset(e){return t[r.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i||0}function getFullCharset(e){return e.charset}function isQuality(e){return e.q>0}})),Mm=__commonJSMin(((e,t)=>{t.exports=preferredEncodings,t.exports.preferredEncodings=preferredEncodings;var n=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function parseAcceptEncoding(e){for(var t=e.split(`,`),n=!1,r=1,i=0,o=0;i<t.length;i++){var s=parseEncoding(t[i].trim(),i);s&&(t[o++]=s,n||=specify(`identity`,s),r=Math.min(r,s.q||1))}return n||(t[o++]={encoding:`identity`,q:r,i}),t.length=o,t}function parseEncoding(e,t){var r=n.exec(e);if(!r)return null;var i=r[1],o=1;if(r[2])for(var s=r[2].split(`;`),c=0;c<s.length;c++){var l=s[c].trim().split(`=`);if(l[0]===`q`){o=parseFloat(l[1]);break}}return{encoding:i,q:o,i:t}}function getEncodingPriority(e,t,n){for(var r={encoding:e,o:-1,q:0,s:0},i=0;i<t.length;i++){var o=specify(e,t[i],n);o&&(r.s-o.s||r.q-o.q||r.o-o.o)<0&&(r=o)}return r}function specify(e,t,n){var r=0;if(t.encoding.toLowerCase()===e.toLowerCase())r|=1;else if(t.encoding!==`*`)return null;return{encoding:e,i:n,o:t.i,q:t.q,s:r}}function preferredEncodings(e,t,n){var r=parseAcceptEncoding(e||``),i=n?function comparator(e,t){if(e.q!==t.q)return t.q-e.q;var r=n.indexOf(e.encoding),i=n.indexOf(t.encoding);return r===-1&&i===-1?t.s-e.s||e.o-t.o||e.i-t.i:r!==-1&&i!==-1?r-i:r===-1?1:-1}:compareSpecs;if(!t)return r.filter(isQuality).sort(i).map(getFullEncoding);var o=t.map(function getPriority(e,t){return getEncodingPriority(e,r,t)});return o.filter(isQuality).sort(i).map(function getEncoding(e){return t[o.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i}function getFullEncoding(e){return e.encoding}function isQuality(e){return e.q>0}})),Nm=__commonJSMin(((e,t)=>{t.exports=preferredLanguages,t.exports.preferredLanguages=preferredLanguages;var n=/^\s*([^\s\-;]+)(?:-([^\s;]+))?\s*(?:;(.*))?$/;function parseAcceptLanguage(e){for(var t=e.split(`,`),n=0,r=0;n<t.length;n++){var i=parseLanguage(t[n].trim(),n);i&&(t[r++]=i)}return t.length=r,t}function parseLanguage(e,t){var r=n.exec(e);if(!r)return null;var i=r[1],o=r[2],s=i;o&&(s+=`-`+o);var c=1;if(r[3])for(var l=r[3].split(`;`),u=0;u<l.length;u++){var d=l[u].split(`=`);d[0]===`q`&&(c=parseFloat(d[1]))}return{prefix:i,suffix:o,q:c,i:t,full:s}}function getLanguagePriority(e,t,n){for(var r={o:-1,q:0,s:0},i=0;i<t.length;i++){var o=specify(e,t[i],n);o&&(r.s-o.s||r.q-o.q||r.o-o.o)<0&&(r=o)}return r}function specify(e,t,n){var r=parseLanguage(e);if(!r)return null;var i=0;if(t.full.toLowerCase()===r.full.toLowerCase())i|=4;else if(t.prefix.toLowerCase()===r.full.toLowerCase())i|=2;else if(t.full.toLowerCase()===r.prefix.toLowerCase())i|=1;else if(t.full!==`*`)return null;return{i:n,o:t.i,q:t.q,s:i}}function preferredLanguages(e,t){var n=parseAcceptLanguage(e===void 0?`*`:e||``);if(!t)return n.filter(isQuality).sort(compareSpecs).map(getFullLanguage);var r=t.map(function getPriority(e,t){return getLanguagePriority(e,n,t)});return r.filter(isQuality).sort(compareSpecs).map(function getLanguage(e){return t[r.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i||0}function getFullLanguage(e){return e.full}function isQuality(e){return e.q>0}})),Pm=__commonJSMin(((e,t)=>{t.exports=preferredMediaTypes,t.exports.preferredMediaTypes=preferredMediaTypes;var n=/^\s*([^\s\/;]+)\/([^;\s]+)\s*(?:;(.*))?$/;function parseAccept(e){for(var t=splitMediaTypes(e),n=0,r=0;n<t.length;n++){var i=parseMediaType(t[n].trim(),n);i&&(t[r++]=i)}return t.length=r,t}function parseMediaType(e,t){var r=n.exec(e);if(!r)return null;var i=Object.create(null),o=1,s=r[2],c=r[1];if(r[3])for(var l=splitParameters(r[3]).map(splitKeyValuePair),u=0;u<l.length;u++){var d=l[u],p=d[0].toLowerCase(),m=d[1],h=m&&m[0]===`"`&&m[m.length-1]===`"`?m.slice(1,-1):m;if(p===`q`){o=parseFloat(h);break}i[p]=h}return{type:c,subtype:s,params:i,q:o,i:t}}function getMediaTypePriority(e,t,n){for(var r={o:-1,q:0,s:0},i=0;i<t.length;i++){var o=specify(e,t[i],n);o&&(r.s-o.s||r.q-o.q||r.o-o.o)<0&&(r=o)}return r}function specify(e,t,n){var r=parseMediaType(e),i=0;if(!r)return null;if(t.type.toLowerCase()==r.type.toLowerCase())i|=4;else if(t.type!=`*`)return null;if(t.subtype.toLowerCase()==r.subtype.toLowerCase())i|=2;else if(t.subtype!=`*`)return null;var o=Object.keys(t.params);if(o.length>0)if(o.every(function(e){return t.params[e]==`*`||(t.params[e]||``).toLowerCase()==(r.params[e]||``).toLowerCase()}))i|=1;else return null;return{i:n,o:t.i,q:t.q,s:i}}function preferredMediaTypes(e,t){var n=parseAccept(e===void 0?`*/*`:e||``);if(!t)return n.filter(isQuality).sort(compareSpecs).map(getFullType);var r=t.map(function getPriority(e,t){return getMediaTypePriority(e,n,t)});return r.filter(isQuality).sort(compareSpecs).map(function getType(e){return t[r.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i||0}function getFullType(e){return e.type+`/`+e.subtype}function isQuality(e){return e.q>0}function quoteCount(e){for(var t=0,n=0;(n=e.indexOf(`"`,n))!==-1;)t++,n++;return t}function splitKeyValuePair(e){var t=e.indexOf(`=`),n,r;return t===-1?n=e:(n=e.slice(0,t),r=e.slice(t+1)),[n,r]}function splitMediaTypes(e){for(var t=e.split(`,`),n=1,r=0;n<t.length;n++)quoteCount(t[r])%2==0?t[++r]=t[n]:t[r]+=`,`+t[n];return t.length=r+1,t}function splitParameters(e){for(var t=e.split(`;`),n=1,r=0;n<t.length;n++)quoteCount(t[r])%2==0?t[++r]=t[n]:t[r]+=`;`+t[n];t.length=r+1;for(var n=0;n<t.length;n++)t[n]=t[n].trim();return t}})),Fm=__commonJSMin(((e,t)=>{
287
+ N();var n=Wd(),r=el()(`express:application`),i=sp(),o=(Qp(),__toCommonJS(Jp)),s=xm().methods,c=xm().compileETag,l=xm().compileQueryParser,u=xm().compileTrust,d=(jr(),__toCommonJS(hr)).resolve,p=Cm(),m=Om(),h=Array.prototype.slice,g=Array.prototype.flat,_=e=t.exports={},v=`@@symbol:trust_proxy_default`;_.init=function init(){var e=null;this.cache=Object.create(null),this.engines=Object.create(null),this.settings=Object.create(null),this.defaultConfiguration(),Object.defineProperty(this,"router",{configurable:!0,enumerable:!0,get:function getrouter(){return e===null&&(e=new m({caseSensitive:this.enabled(`case sensitive routing`),strict:this.enabled(`strict routing`)})),e}})},_.defaultConfiguration=function defaultConfiguration(){var e=`production`;this.enable(`x-powered-by`),this.set(`etag`,`weak`),this.set(`env`,e),this.set(`query parser`,`simple`),this.set(`subdomain offset`,2),this.set(`trust proxy`,!1),Object.defineProperty(this.settings,v,{configurable:!0,value:!0}),r(`booting in %s mode`,e),this.on(`mount`,function onmount(e){this.settings[v]===!0&&typeof e.settings[`trust proxy fn`]==`function`&&(delete this.settings[`trust proxy`],delete this.settings[`trust proxy fn`]),Object.setPrototypeOf(this.request,e.request),Object.setPrototypeOf(this.response,e.response),Object.setPrototypeOf(this.engines,e.engines),Object.setPrototypeOf(this.settings,e.settings)}),this.locals=Object.create(null),this.mountpath=`/`,this.locals.settings=this.settings,this.set(`view`,i),this.set(`views`,d(`views`)),this.set(`jsonp callback name`,`callback`),e===`production`&&this.enable(`view cache`)},_.handle=function handle(e,t,r){var i=r||n(e,t,{env:this.get(`env`),onerror:logerror.bind(this)});this.enabled(`x-powered-by`)&&t.setHeader(`X-Powered-By`,`Express`),e.res=t,t.req=e,Object.setPrototypeOf(e,this.request),Object.setPrototypeOf(t,this.response),t.locals||=Object.create(null),this.router.handle(e,t,i)},_.use=function use(e){var t=0,n=`/`;if(typeof e!=`function`){for(var i=e;Array.isArray(i)&&i.length!==0;)i=i[0];typeof i!=`function`&&(t=1,n=e)}var o=g.call(h.call(arguments,t),1/0);if(o.length===0)throw TypeError(`app.use() requires a middleware function`);var s=this.router;return o.forEach(function(e){if(!e||!e.handle||!e.set)return s.use(n,e);r(`.use app under %s`,n),e.mountpath=n,e.parent=this,s.use(n,function mounted_app(t,n,r){var i=t.app;e.handle(t,n,function(e){Object.setPrototypeOf(t,i.request),Object.setPrototypeOf(n,i.response),r(e)})}),e.emit(`mount`,this)},this),this},_.route=function route(e){return this.router.route(e)},_.engine=function engine(e,t){if(typeof t!=`function`)throw Error(`callback function required`);var n=e[0]===`.`?e:`.`+e;return this.engines[n]=t,this},_.param=function param(e,t){if(Array.isArray(e)){for(var n=0;n<e.length;n++)this.param(e[n],t);return this}return this.router.param(e,t),this},_.set=function set(e,t){if(arguments.length===1)return this.settings[e];switch(r(`set "%s" to %o`,e,t),this.settings[e]=t,e){case`etag`:this.set(`etag fn`,c(t));break;case`query parser`:this.set(`query parser fn`,l(t));break;case`trust proxy`:this.set(`trust proxy fn`,u(t)),Object.defineProperty(this.settings,v,{configurable:!0,value:!1});break}return this},_.path=function path(){return this.parent?this.parent.path()+this.mountpath:``},_.enabled=function enabled(e){return!!this.set(e)},_.disabled=function disabled(e){return!this.set(e)},_.enable=function enable(e){return this.set(e,!0)},_.disable=function disable(e){return this.set(e,!1)},s.forEach(function(e){_[e]=function(t){if(e===`get`&&arguments.length===1)return this.set(t);var n=this.route(t);return n[e].apply(n,h.call(arguments,1)),this}}),_.all=function all(e){for(var t=this.route(e),n=h.call(arguments,1),r=0;r<s.length;r++)t[s[r]].apply(t,n);return this},_.render=function render(e,t,n){var r=this.cache,i=n,o=this.engines,s=t,c;typeof t==`function`&&(i=t,s={});var l={...this.locals,...s._locals,...s};if(l.cache??=this.enabled(`view cache`),l.cache&&(c=r[e]),!c){if(c=new(this.get(`view`))(e,{defaultEngine:this.get(`view engine`),root:this.get(`views`),engines:o}),!c.path){var u=Array.isArray(c.root)&&c.root.length>1?`directories "`+c.root.slice(0,-1).join(`", "`)+`" or "`+c.root[c.root.length-1]+`"`:`directory "`+c.root+`"`,d=Error(`Failed to lookup view "`+e+`" in views `+u);return d.view=c,i(d)}l.cache&&(r[e]=c)}tryRender(c,l,i)},_.listen=function listen(){var e=o.createServer(this),t=h.call(arguments);if(typeof t[t.length-1]==`function`){var n=t[t.length-1]=p(t[t.length-1]);e.once(`error`,n)}return e.listen.apply(e,t)};function logerror(e){this.get(`env`)!==`test`&&M.error(e.stack||e.toString())}function tryRender(e,t,n){try{e.render(t,n)}catch(e){n(e)}}})),Am=__commonJSMin(((e,t)=>{t.exports=preferredCharsets,t.exports.preferredCharsets=preferredCharsets;var n=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function parseAcceptCharset(e){for(var t=e.split(`,`),n=0,r=0;n<t.length;n++){var i=parseCharset(t[n].trim(),n);i&&(t[r++]=i)}return t.length=r,t}function parseCharset(e,t){var r=n.exec(e);if(!r)return null;var i=r[1],o=1;if(r[2])for(var s=r[2].split(`;`),c=0;c<s.length;c++){var l=s[c].trim().split(`=`);if(l[0]===`q`){o=parseFloat(l[1]);break}}return{charset:i,q:o,i:t}}function getCharsetPriority(e,t,n){for(var r={o:-1,q:0,s:0},i=0;i<t.length;i++){var o=specify(e,t[i],n);o&&(r.s-o.s||r.q-o.q||r.o-o.o)<0&&(r=o)}return r}function specify(e,t,n){var r=0;if(t.charset.toLowerCase()===e.toLowerCase())r|=1;else if(t.charset!==`*`)return null;return{i:n,o:t.i,q:t.q,s:r}}function preferredCharsets(e,t){var n=parseAcceptCharset(e===void 0?`*`:e||``);if(!t)return n.filter(isQuality).sort(compareSpecs).map(getFullCharset);var r=t.map(function getPriority(e,t){return getCharsetPriority(e,n,t)});return r.filter(isQuality).sort(compareSpecs).map(function getCharset(e){return t[r.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i||0}function getFullCharset(e){return e.charset}function isQuality(e){return e.q>0}})),jm=__commonJSMin(((e,t)=>{t.exports=preferredEncodings,t.exports.preferredEncodings=preferredEncodings;var n=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function parseAcceptEncoding(e){for(var t=e.split(`,`),n=!1,r=1,i=0,o=0;i<t.length;i++){var s=parseEncoding(t[i].trim(),i);s&&(t[o++]=s,n||=specify(`identity`,s),r=Math.min(r,s.q||1))}return n||(t[o++]={encoding:`identity`,q:r,i}),t.length=o,t}function parseEncoding(e,t){var r=n.exec(e);if(!r)return null;var i=r[1],o=1;if(r[2])for(var s=r[2].split(`;`),c=0;c<s.length;c++){var l=s[c].trim().split(`=`);if(l[0]===`q`){o=parseFloat(l[1]);break}}return{encoding:i,q:o,i:t}}function getEncodingPriority(e,t,n){for(var r={encoding:e,o:-1,q:0,s:0},i=0;i<t.length;i++){var o=specify(e,t[i],n);o&&(r.s-o.s||r.q-o.q||r.o-o.o)<0&&(r=o)}return r}function specify(e,t,n){var r=0;if(t.encoding.toLowerCase()===e.toLowerCase())r|=1;else if(t.encoding!==`*`)return null;return{encoding:e,i:n,o:t.i,q:t.q,s:r}}function preferredEncodings(e,t,n){var r=parseAcceptEncoding(e||``),i=n?function comparator(e,t){if(e.q!==t.q)return t.q-e.q;var r=n.indexOf(e.encoding),i=n.indexOf(t.encoding);return r===-1&&i===-1?t.s-e.s||e.o-t.o||e.i-t.i:r!==-1&&i!==-1?r-i:r===-1?1:-1}:compareSpecs;if(!t)return r.filter(isQuality).sort(i).map(getFullEncoding);var o=t.map(function getPriority(e,t){return getEncodingPriority(e,r,t)});return o.filter(isQuality).sort(i).map(function getEncoding(e){return t[o.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i}function getFullEncoding(e){return e.encoding}function isQuality(e){return e.q>0}})),Mm=__commonJSMin(((e,t)=>{t.exports=preferredLanguages,t.exports.preferredLanguages=preferredLanguages;var n=/^\s*([^\s\-;]+)(?:-([^\s;]+))?\s*(?:;(.*))?$/;function parseAcceptLanguage(e){for(var t=e.split(`,`),n=0,r=0;n<t.length;n++){var i=parseLanguage(t[n].trim(),n);i&&(t[r++]=i)}return t.length=r,t}function parseLanguage(e,t){var r=n.exec(e);if(!r)return null;var i=r[1],o=r[2],s=i;o&&(s+=`-`+o);var c=1;if(r[3])for(var l=r[3].split(`;`),u=0;u<l.length;u++){var d=l[u].split(`=`);d[0]===`q`&&(c=parseFloat(d[1]))}return{prefix:i,suffix:o,q:c,i:t,full:s}}function getLanguagePriority(e,t,n){for(var r={o:-1,q:0,s:0},i=0;i<t.length;i++){var o=specify(e,t[i],n);o&&(r.s-o.s||r.q-o.q||r.o-o.o)<0&&(r=o)}return r}function specify(e,t,n){var r=parseLanguage(e);if(!r)return null;var i=0;if(t.full.toLowerCase()===r.full.toLowerCase())i|=4;else if(t.prefix.toLowerCase()===r.full.toLowerCase())i|=2;else if(t.full.toLowerCase()===r.prefix.toLowerCase())i|=1;else if(t.full!==`*`)return null;return{i:n,o:t.i,q:t.q,s:i}}function preferredLanguages(e,t){var n=parseAcceptLanguage(e===void 0?`*`:e||``);if(!t)return n.filter(isQuality).sort(compareSpecs).map(getFullLanguage);var r=t.map(function getPriority(e,t){return getLanguagePriority(e,n,t)});return r.filter(isQuality).sort(compareSpecs).map(function getLanguage(e){return t[r.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i||0}function getFullLanguage(e){return e.full}function isQuality(e){return e.q>0}})),Nm=__commonJSMin(((e,t)=>{t.exports=preferredMediaTypes,t.exports.preferredMediaTypes=preferredMediaTypes;var n=/^\s*([^\s\/;]+)\/([^;\s]+)\s*(?:;(.*))?$/;function parseAccept(e){for(var t=splitMediaTypes(e),n=0,r=0;n<t.length;n++){var i=parseMediaType(t[n].trim(),n);i&&(t[r++]=i)}return t.length=r,t}function parseMediaType(e,t){var r=n.exec(e);if(!r)return null;var i=Object.create(null),o=1,s=r[2],c=r[1];if(r[3])for(var l=splitParameters(r[3]).map(splitKeyValuePair),u=0;u<l.length;u++){var d=l[u],p=d[0].toLowerCase(),m=d[1],h=m&&m[0]===`"`&&m[m.length-1]===`"`?m.slice(1,-1):m;if(p===`q`){o=parseFloat(h);break}i[p]=h}return{type:c,subtype:s,params:i,q:o,i:t}}function getMediaTypePriority(e,t,n){for(var r={o:-1,q:0,s:0},i=0;i<t.length;i++){var o=specify(e,t[i],n);o&&(r.s-o.s||r.q-o.q||r.o-o.o)<0&&(r=o)}return r}function specify(e,t,n){var r=parseMediaType(e),i=0;if(!r)return null;if(t.type.toLowerCase()==r.type.toLowerCase())i|=4;else if(t.type!=`*`)return null;if(t.subtype.toLowerCase()==r.subtype.toLowerCase())i|=2;else if(t.subtype!=`*`)return null;var o=Object.keys(t.params);if(o.length>0)if(o.every(function(e){return t.params[e]==`*`||(t.params[e]||``).toLowerCase()==(r.params[e]||``).toLowerCase()}))i|=1;else return null;return{i:n,o:t.i,q:t.q,s:i}}function preferredMediaTypes(e,t){var n=parseAccept(e===void 0?`*/*`:e||``);if(!t)return n.filter(isQuality).sort(compareSpecs).map(getFullType);var r=t.map(function getPriority(e,t){return getMediaTypePriority(e,n,t)});return r.filter(isQuality).sort(compareSpecs).map(function getType(e){return t[r.indexOf(e)]})}function compareSpecs(e,t){return t.q-e.q||t.s-e.s||e.o-t.o||e.i-t.i||0}function getFullType(e){return e.type+`/`+e.subtype}function isQuality(e){return e.q>0}function quoteCount(e){for(var t=0,n=0;(n=e.indexOf(`"`,n))!==-1;)t++,n++;return t}function splitKeyValuePair(e){var t=e.indexOf(`=`),n,r;return t===-1?n=e:(n=e.slice(0,t),r=e.slice(t+1)),[n,r]}function splitMediaTypes(e){for(var t=e.split(`,`),n=1,r=0;n<t.length;n++)quoteCount(t[r])%2==0?t[++r]=t[n]:t[r]+=`,`+t[n];return t.length=r+1,t}function splitParameters(e){for(var t=e.split(`;`),n=1,r=0;n<t.length;n++)quoteCount(t[r])%2==0?t[++r]=t[n]:t[r]+=`;`+t[n];t.length=r+1;for(var n=0;n<t.length;n++)t[n]=t[n].trim();return t}})),Pm=__commonJSMin(((e,t)=>{
288
288
  /*!
289
289
  * negotiator
290
290
  * Copyright(c) 2012 Federico Romero
@@ -292,28 +292,28 @@ N();var n=Wd(),r=el()(`express:application`),i=sp(),o=($p(),__toCommonJS(Yp)),s=
292
292
  * Copyright(c) 2015 Douglas Christopher Wilson
293
293
  * MIT Licensed
294
294
  */
295
- var n=jm(),r=Mm(),i=Nm(),o=Pm();t.exports=Negotiator,t.exports.Negotiator=Negotiator;function Negotiator(e){if(!(this instanceof Negotiator))return new Negotiator(e);this.request=e}Negotiator.prototype.charset=function charset(e){var t=this.charsets(e);return t&&t[0]},Negotiator.prototype.charsets=function charsets(e){return n(this.request.headers[`accept-charset`],e)},Negotiator.prototype.encoding=function encoding(e,t){var n=this.encodings(e,t);return n&&n[0]},Negotiator.prototype.encodings=function encodings(e,t){var n=t||{};return r(this.request.headers[`accept-encoding`],e,n.preferred)},Negotiator.prototype.language=function language(e){var t=this.languages(e);return t&&t[0]},Negotiator.prototype.languages=function languages(e){return i(this.request.headers[`accept-language`],e)},Negotiator.prototype.mediaType=function mediaType(e){var t=this.mediaTypes(e);return t&&t[0]},Negotiator.prototype.mediaTypes=function mediaTypes(e){return o(this.request.headers.accept,e)},Negotiator.prototype.preferredCharset=Negotiator.prototype.charset,Negotiator.prototype.preferredCharsets=Negotiator.prototype.charsets,Negotiator.prototype.preferredEncoding=Negotiator.prototype.encoding,Negotiator.prototype.preferredEncodings=Negotiator.prototype.encodings,Negotiator.prototype.preferredLanguage=Negotiator.prototype.language,Negotiator.prototype.preferredLanguages=Negotiator.prototype.languages,Negotiator.prototype.preferredMediaType=Negotiator.prototype.mediaType,Negotiator.prototype.preferredMediaTypes=Negotiator.prototype.mediaTypes})),Im=__commonJSMin(((e,t)=>{
295
+ var n=Am(),r=jm(),i=Mm(),o=Nm();t.exports=Negotiator,t.exports.Negotiator=Negotiator;function Negotiator(e){if(!(this instanceof Negotiator))return new Negotiator(e);this.request=e}Negotiator.prototype.charset=function charset(e){var t=this.charsets(e);return t&&t[0]},Negotiator.prototype.charsets=function charsets(e){return n(this.request.headers[`accept-charset`],e)},Negotiator.prototype.encoding=function encoding(e,t){var n=this.encodings(e,t);return n&&n[0]},Negotiator.prototype.encodings=function encodings(e,t){var n=t||{};return r(this.request.headers[`accept-encoding`],e,n.preferred)},Negotiator.prototype.language=function language(e){var t=this.languages(e);return t&&t[0]},Negotiator.prototype.languages=function languages(e){return i(this.request.headers[`accept-language`],e)},Negotiator.prototype.mediaType=function mediaType(e){var t=this.mediaTypes(e);return t&&t[0]},Negotiator.prototype.mediaTypes=function mediaTypes(e){return o(this.request.headers.accept,e)},Negotiator.prototype.preferredCharset=Negotiator.prototype.charset,Negotiator.prototype.preferredCharsets=Negotiator.prototype.charsets,Negotiator.prototype.preferredEncoding=Negotiator.prototype.encoding,Negotiator.prototype.preferredEncodings=Negotiator.prototype.encodings,Negotiator.prototype.preferredLanguage=Negotiator.prototype.language,Negotiator.prototype.preferredLanguages=Negotiator.prototype.languages,Negotiator.prototype.preferredMediaType=Negotiator.prototype.mediaType,Negotiator.prototype.preferredMediaTypes=Negotiator.prototype.mediaTypes})),Fm=__commonJSMin(((e,t)=>{
296
296
  /*!
297
297
  * accepts
298
298
  * Copyright(c) 2014 Jonathan Ong
299
299
  * Copyright(c) 2015 Douglas Christopher Wilson
300
300
  * MIT Licensed
301
301
  */
302
- var n=Fm(),r=ql();t.exports=Accepts;function Accepts(e){if(!(this instanceof Accepts))return new Accepts(e);this.headers=e.headers,this.negotiator=new n(e)}Accepts.prototype.type=Accepts.prototype.types=function(e){var t=e;if(t&&!Array.isArray(t)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}if(!t||t.length===0)return this.negotiator.mediaTypes();if(!this.headers.accept)return t[0];var r=t.map(extToMime),i=this.negotiator.mediaTypes(r.filter(validMime))[0];return i?t[r.indexOf(i)]:!1},Accepts.prototype.encoding=Accepts.prototype.encodings=function(e){var t=e;if(t&&!Array.isArray(t)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return!t||t.length===0?this.negotiator.encodings():this.negotiator.encodings(t)[0]||!1},Accepts.prototype.charset=Accepts.prototype.charsets=function(e){var t=e;if(t&&!Array.isArray(t)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return!t||t.length===0?this.negotiator.charsets():this.negotiator.charsets(t)[0]||!1},Accepts.prototype.lang=Accepts.prototype.langs=Accepts.prototype.language=Accepts.prototype.languages=function(e){var t=e;if(t&&!Array.isArray(t)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return!t||t.length===0?this.negotiator.languages():this.negotiator.languages(t)[0]||!1};function extToMime(e){return e.indexOf(`/`)===-1?r.lookup(e):e}function validMime(e){return typeof e==`string`}})),Lm=__commonJSMin(((e,t)=>{
302
+ var n=Pm(),r=ql();t.exports=Accepts;function Accepts(e){if(!(this instanceof Accepts))return new Accepts(e);this.headers=e.headers,this.negotiator=new n(e)}Accepts.prototype.type=Accepts.prototype.types=function(e){var t=e;if(t&&!Array.isArray(t)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}if(!t||t.length===0)return this.negotiator.mediaTypes();if(!this.headers.accept)return t[0];var r=t.map(extToMime),i=this.negotiator.mediaTypes(r.filter(validMime))[0];return i?t[r.indexOf(i)]:!1},Accepts.prototype.encoding=Accepts.prototype.encodings=function(e){var t=e;if(t&&!Array.isArray(t)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return!t||t.length===0?this.negotiator.encodings():this.negotiator.encodings(t)[0]||!1},Accepts.prototype.charset=Accepts.prototype.charsets=function(e){var t=e;if(t&&!Array.isArray(t)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return!t||t.length===0?this.negotiator.charsets():this.negotiator.charsets(t)[0]||!1},Accepts.prototype.lang=Accepts.prototype.langs=Accepts.prototype.language=Accepts.prototype.languages=function(e){var t=e;if(t&&!Array.isArray(t)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return!t||t.length===0?this.negotiator.languages():this.negotiator.languages(t)[0]||!1};function extToMime(e){return e.indexOf(`/`)===-1?r.lookup(e):e}function validMime(e){return typeof e==`string`}})),Im=__commonJSMin(((e,t)=>{
303
303
  /*!
304
304
  * fresh
305
305
  * Copyright(c) 2012 TJ Holowaychuk
306
306
  * Copyright(c) 2016-2017 Douglas Christopher Wilson
307
307
  * MIT Licensed
308
308
  */
309
- var n=/(?:^|,)\s*?no-cache\s*?(?:,|$)/;t.exports=fresh;function fresh(e,t){var r=e[`if-modified-since`],i=e[`if-none-match`];if(!r&&!i)return!1;var o=e[`cache-control`];if(o&&n.test(o))return!1;if(i){if(i===`*`)return!0;var s=t.etag;if(!s)return!1;for(var c=parseTokenList(i),l=0;l<c.length;l++){var u=c[l];if(u===s||u===`W/`+s||`W/`+u===s)return!0}return!1}if(r){var d=t[`last-modified`];if(!d||!(parseHttpDate(d)<=parseHttpDate(r)))return!1}return!0}function parseHttpDate(e){var t=e&&Date.parse(e);return typeof t==`number`?t:NaN}function parseTokenList(e){for(var t=0,n=[],r=0,i=0,o=e.length;i<o;i++)switch(e.charCodeAt(i)){case 32:r===t&&(r=t=i+1);break;case 44:n.push(e.substring(r,t)),r=t=i+1;break;default:t=i+1;break}return n.push(e.substring(r,t)),n}})),Rm=__commonJSMin(((e,t)=>{
309
+ var n=/(?:^|,)\s*?no-cache\s*?(?:,|$)/;t.exports=fresh;function fresh(e,t){var r=e[`if-modified-since`],i=e[`if-none-match`];if(!r&&!i)return!1;var o=e[`cache-control`];if(o&&n.test(o))return!1;if(i){if(i===`*`)return!0;var s=t.etag;if(!s)return!1;for(var c=parseTokenList(i),l=0;l<c.length;l++){var u=c[l];if(u===s||u===`W/`+s||`W/`+u===s)return!0}return!1}if(r){var d=t[`last-modified`];if(!d||!(parseHttpDate(d)<=parseHttpDate(r)))return!1}return!0}function parseHttpDate(e){var t=e&&Date.parse(e);return typeof t==`number`?t:NaN}function parseTokenList(e){for(var t=0,n=[],r=0,i=0,o=e.length;i<o;i++)switch(e.charCodeAt(i)){case 32:r===t&&(r=t=i+1);break;case 44:n.push(e.substring(r,t)),r=t=i+1;break;default:t=i+1;break}return n.push(e.substring(r,t)),n}})),Lm=__commonJSMin(((e,t)=>{
310
310
  /*!
311
311
  * range-parser
312
312
  * Copyright(c) 2012-2014 TJ Holowaychuk
313
313
  * Copyright(c) 2015-2016 Douglas Christopher Wilson
314
314
  * MIT Licensed
315
315
  */
316
- t.exports=rangeParser;function rangeParser(e,t,n){if(typeof t!=`string`)throw TypeError(`argument str must be a string`);var r=t.indexOf(`=`);if(r===-1)return-2;var i=t.slice(r+1).split(`,`),o=[];o.type=t.slice(0,r);for(var s=0;s<i.length;s++){var c=i[s].split(`-`),l=parseInt(c[0],10),u=parseInt(c[1],10);isNaN(l)?(l=e-u,u=e-1):isNaN(u)&&(u=e-1),u>e-1&&(u=e-1),!(isNaN(l)||isNaN(u)||l>u||l<0)&&o.push({start:l,end:u})}return o.length<1?-1:n&&n.combine?combineRanges(o):o}function combineRanges(e){for(var t=e.map(mapWithIndex).sort(sortByRangeStart),n=0,r=1;r<t.length;r++){var i=t[r],o=t[n];i.start>o.end+1?t[++n]=i:i.end>o.end&&(o.end=i.end,o.index=Math.min(o.index,i.index))}t.length=n+1;var s=t.sort(sortByRangeIndex).map(mapWithoutIndex);return s.type=e.type,s}function mapWithIndex(e,t){return{start:e.start,end:e.end,index:t}}function mapWithoutIndex(e){return{start:e.start,end:e.end}}function sortByRangeIndex(e,t){return e.index-t.index}function sortByRangeStart(e,t){return e.start-t.start}})),zm=__commonJSMin(((e,t)=>{
316
+ t.exports=rangeParser;function rangeParser(e,t,n){if(typeof t!=`string`)throw TypeError(`argument str must be a string`);var r=t.indexOf(`=`);if(r===-1)return-2;var i=t.slice(r+1).split(`,`),o=[];o.type=t.slice(0,r);for(var s=0;s<i.length;s++){var c=i[s].split(`-`),l=parseInt(c[0],10),u=parseInt(c[1],10);isNaN(l)?(l=e-u,u=e-1):isNaN(u)&&(u=e-1),u>e-1&&(u=e-1),!(isNaN(l)||isNaN(u)||l>u||l<0)&&o.push({start:l,end:u})}return o.length<1?-1:n&&n.combine?combineRanges(o):o}function combineRanges(e){for(var t=e.map(mapWithIndex).sort(sortByRangeStart),n=0,r=1;r<t.length;r++){var i=t[r],o=t[n];i.start>o.end+1?t[++n]=i:i.end>o.end&&(o.end=i.end,o.index=Math.min(o.index,i.index))}t.length=n+1;var s=t.sort(sortByRangeIndex).map(mapWithoutIndex);return s.type=e.type,s}function mapWithIndex(e,t){return{start:e.start,end:e.end,index:t}}function mapWithoutIndex(e){return{start:e.start,end:e.end}}function sortByRangeIndex(e,t){return e.index-t.index}function sortByRangeStart(e,t){return e.start-t.start}})),Rm=__commonJSMin(((e,t)=>{
317
317
  /*!
318
318
  * express
319
319
  * Copyright(c) 2009-2013 TJ Holowaychuk
@@ -321,27 +321,27 @@ t.exports=rangeParser;function rangeParser(e,t,n){if(typeof t!=`string`)throw Ty
321
321
  * Copyright(c) 2014-2015 Douglas Christopher Wilson
322
322
  * MIT Licensed
323
323
  */
324
- var n=Im(),r=(Ap(),__toCommonJS(Dp)).isIP,i=Yl(),o=($p(),__toCommonJS(Yp)),s=Lm(),c=Rm(),l=Ud(),u=im(),d=Object.create(o.IncomingMessage.prototype);t.exports=d,d.get=d.header=function header(e){if(!e)throw TypeError(`name argument is required to req.get`);if(typeof e!=`string`)throw TypeError(`name must be a string to req.get`);var t=e.toLowerCase();switch(t){case`referer`:case`referrer`:return this.headers.referrer||this.headers.referer;default:return this.headers[t]}},d.accepts=function(){var e=n(this);return e.types.apply(e,arguments)},d.acceptsEncodings=function(){var e=n(this);return e.encodings.apply(e,arguments)},d.acceptsCharsets=function(){var e=n(this);return e.charsets.apply(e,arguments)},d.acceptsLanguages=function(...e){return n(this).languages(...e)},d.range=function range(e,t){var n=this.get(`Range`);if(n)return c(e,n,t)},defineGetter(d,`query`,function query(){var e=this.app.get(`query parser fn`);if(!e)return Object.create(null);var t=l(this).query;return e(t)}),d.is=function is(e){var t=e;if(!Array.isArray(e)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return i(this,t)},defineGetter(d,`protocol`,function protocol(){var e=this.socket.encrypted?`https`:`http`;if(!this.app.get(`trust proxy fn`)(this.socket.remoteAddress,0))return e;var t=this.get(`X-Forwarded-Proto`)||e,n=t.indexOf(`,`);return n===-1?t.trim():t.substring(0,n).trim()}),defineGetter(d,`secure`,function secure(){return this.protocol===`https`}),defineGetter(d,`ip`,function ip(){var e=this.app.get(`trust proxy fn`);return u(this,e)}),defineGetter(d,`ips`,function ips(){var e=this.app.get(`trust proxy fn`),t=u.all(this,e);return t.reverse().pop(),t}),defineGetter(d,`subdomains`,function subdomains(){var e=this.hostname;if(!e)return[];var t=this.app.get(`subdomain offset`);return(r(e)?[e]:e.split(`.`).reverse()).slice(t)}),defineGetter(d,`path`,function path(){return l(this).pathname}),defineGetter(d,`host`,function host(){var e=this.app.get(`trust proxy fn`),t=this.get(`X-Forwarded-Host`);return!t||!e(this.socket.remoteAddress,0)?t=this.get(`Host`):t.indexOf(`,`)!==-1&&(t=t.substring(0,t.indexOf(`,`)).trimRight()),t||void 0}),defineGetter(d,`hostname`,function hostname(){var e=this.host;if(e){var t=e[0]===`[`?e.indexOf(`]`)+1:0,n=e.indexOf(`:`,t);return n===-1?e:e.substring(0,n)}}),defineGetter(d,`fresh`,function(){var e=this.method,t=this.res,n=t.statusCode;return e!==`GET`&&e!==`HEAD`?!1:n>=200&&n<300||n===304?s(this.headers,{etag:t.get(`ETag`),"last-modified":t.get(`Last-Modified`)}):!1}),defineGetter(d,`stale`,function stale(){return!this.fresh}),defineGetter(d,`xhr`,function xhr(){return(this.get(`X-Requested-With`)||``).toLowerCase()===`xmlhttprequest`});function defineGetter(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:n})}})),Bm=__commonJSMin(((e,t)=>{
324
+ var n=Fm(),r=(jp(),__toCommonJS(Op)).isIP,i=Yl(),o=(Qp(),__toCommonJS(Jp)),s=Im(),c=Lm(),l=Ud(),u=nm(),d=Object.create(o.IncomingMessage.prototype);t.exports=d,d.get=d.header=function header(e){if(!e)throw TypeError(`name argument is required to req.get`);if(typeof e!=`string`)throw TypeError(`name must be a string to req.get`);var t=e.toLowerCase();switch(t){case`referer`:case`referrer`:return this.headers.referrer||this.headers.referer;default:return this.headers[t]}},d.accepts=function(){var e=n(this);return e.types.apply(e,arguments)},d.acceptsEncodings=function(){var e=n(this);return e.encodings.apply(e,arguments)},d.acceptsCharsets=function(){var e=n(this);return e.charsets.apply(e,arguments)},d.acceptsLanguages=function(...e){return n(this).languages(...e)},d.range=function range(e,t){var n=this.get(`Range`);if(n)return c(e,n,t)},defineGetter(d,`query`,function query(){var e=this.app.get(`query parser fn`);if(!e)return Object.create(null);var t=l(this).query;return e(t)}),d.is=function is(e){var t=e;if(!Array.isArray(e)){t=Array(arguments.length);for(var n=0;n<t.length;n++)t[n]=arguments[n]}return i(this,t)},defineGetter(d,`protocol`,function protocol(){var e=this.socket.encrypted?`https`:`http`;if(!this.app.get(`trust proxy fn`)(this.socket.remoteAddress,0))return e;var t=this.get(`X-Forwarded-Proto`)||e,n=t.indexOf(`,`);return n===-1?t.trim():t.substring(0,n).trim()}),defineGetter(d,`secure`,function secure(){return this.protocol===`https`}),defineGetter(d,`ip`,function ip(){var e=this.app.get(`trust proxy fn`);return u(this,e)}),defineGetter(d,`ips`,function ips(){var e=this.app.get(`trust proxy fn`),t=u.all(this,e);return t.reverse().pop(),t}),defineGetter(d,`subdomains`,function subdomains(){var e=this.hostname;if(!e)return[];var t=this.app.get(`subdomain offset`);return(r(e)?[e]:e.split(`.`).reverse()).slice(t)}),defineGetter(d,`path`,function path(){return l(this).pathname}),defineGetter(d,`host`,function host(){var e=this.app.get(`trust proxy fn`),t=this.get(`X-Forwarded-Host`);return!t||!e(this.socket.remoteAddress,0)?t=this.get(`Host`):t.indexOf(`,`)!==-1&&(t=t.substring(0,t.indexOf(`,`)).trimRight()),t||void 0}),defineGetter(d,`hostname`,function hostname(){var e=this.host;if(e){var t=e[0]===`[`?e.indexOf(`]`)+1:0,n=e.indexOf(`:`,t);return n===-1?e:e.substring(0,n)}}),defineGetter(d,`fresh`,function(){var e=this.method,t=this.res,n=t.statusCode;return e!==`GET`&&e!==`HEAD`?!1:n>=200&&n<300||n===304?s(this.headers,{etag:t.get(`ETag`),"last-modified":t.get(`Last-Modified`)}):!1}),defineGetter(d,`stale`,function stale(){return!this.fresh}),defineGetter(d,`xhr`,function xhr(){return(this.get(`X-Requested-With`)||``).toLowerCase()===`xmlhttprequest`});function defineGetter(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:n})}})),zm=__commonJSMin(((e,t)=>{
325
325
  /*!
326
326
  * content-disposition
327
327
  * Copyright(c) 2014-2017 Douglas Christopher Wilson
328
328
  * MIT Licensed
329
329
  */
330
- t.exports=contentDisposition,t.exports.parse=parse;let n=new TextDecoder(`utf-8`);var r=/[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g,i=/[^\x20-\x7e\xa0-\xff]/g,o=/\\([\u0000-\u007f])/g,s=/([\\"])/g,c=/;[\x09\x20]*([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*=[\x09\x20]*("(?:[\x20!\x23-\x5b\x5d-\x7e\x80-\xff]|\\[\x20-\x7e])*"|[!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*/g,l=/^[\x20-\x7e\x80-\xff]+$/,u=/^[!#$%&'*+.0-9A-Z^_`a-z|~-]+$/,d=/^([A-Za-z0-9!#$%&+\-^_`{}~]+)'(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}|[A-Za-z]{4,8}|)'((?:%[0-9A-Fa-f]{2}|[A-Za-z0-9!#$&+.^_`|~-])+)$/,p=/^([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*(?:$|;)/;function contentDisposition(e,t){var n=t||{};return format(new ContentDisposition(n.type||`attachment`,createparams(e,n.fallback)))}function createparams(e,t){if(e!==void 0){var n={};if(typeof e!=`string`)throw TypeError(`filename must be a string`);if(t===void 0&&(t=!0),typeof t!=`string`&&typeof t!=`boolean`)throw TypeError(`fallback must be a string or boolean`);if(typeof t==`string`&&i.test(t))throw TypeError(`fallback must be ISO-8859-1 string`);var r=basename(e),o=l.test(r),s=typeof t==`string`?basename(t):t&&getlatin1(r),c=typeof s==`string`&&s!==r;return(c||!o||hasHexEscape(r))&&(n[`filename*`]=r),(o||c)&&(n.filename=c?s:r),n}}function format(e){var t=e.parameters,n=e.type;if(!n||typeof n!=`string`||!u.test(n))throw TypeError(`invalid type`);var r=String(n).toLowerCase();if(t&&typeof t==`object`)for(var i,o=Object.keys(t).sort(),s=0;s<o.length;s++){i=o[s];var c=i.slice(-1)===`*`?ustring(t[i]):qstring(t[i]);r+=`; `+i+`=`+c}return r}function decodefield(e){let t=d.exec(e);if(!t)throw TypeError(`invalid extended field value`);let r=t[1].toLowerCase(),i=t[2];switch(r){case`iso-8859-1`:return getlatin1(decodeHexEscapes(i));case`utf-8`:case`utf8`:try{return decodeURIComponent(i)}catch{let e=decodeHexEscapes(i),t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return n.decode(t)}}throw TypeError(`unsupported charset in extended field`)}function getlatin1(e){return String(e).replace(i,`?`)}function parse(e){if(!e||typeof e!=`string`)throw TypeError(`argument string is required`);var t=p.exec(e);if(!t)throw TypeError(`invalid type format`);var n=t[0].length,r=t[1].toLowerCase(),i,s=[],l={},u;for(n=c.lastIndex=t[0].slice(-1)===`;`?n-1:n;t=c.exec(e);){if(t.index!==n)throw TypeError(`invalid parameter format`);if(n+=t[0].length,i=t[1].toLowerCase(),u=t[2],s.indexOf(i)!==-1)throw TypeError(`invalid duplicate parameter`);if(s.push(i),i.indexOf(`*`)+1===i.length){i=i.slice(0,-1),u=decodefield(u),l[i]=u;continue}typeof l[i]!=`string`&&(u[0]===`"`&&(u=u.slice(1,-1).replace(o,`$1`)),l[i]=u)}if(n!==-1&&n!==e.length)throw TypeError(`invalid parameter format`);return new ContentDisposition(r,l)}function pencode(e){return`%`+String(e).charCodeAt(0).toString(16).toUpperCase()}function qstring(e){return`"`+String(e).replace(s,`\\$1`)+`"`}function ustring(e){return`UTF-8''`+encodeURIComponent(String(e)).replace(r,pencode)}function ContentDisposition(e,t){this.type=e,this.parameters=t}function basename(e){let t=e.replaceAll(`\\`,`/`),n=t.length;for(;n>0&&t[n-1]===`/`;)n--;if(n===0)return``;let r=n-1;for(;r>=0&&t[r]!==`/`;)r--;return t.slice(r+1,n)}function isHexDigit(e){let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function hasHexEscape(e){let t=e.length-3,n=-1;for(;(n=e.indexOf(`%`,n+1))!==-1&&n<=t;)if(isHexDigit(e[n+1])&&isHexDigit(e[n+2]))return!0;return!1}function decodeHexEscapes(e){let t=e.indexOf(`%`);if(t===-1)return e;let n=e.slice(0,t);for(let r=t;r<e.length;r++)e[r]===`%`&&r+2<e.length&&isHexDigit(e[r+1])&&isHexDigit(e[r+2])?(n+=String.fromCharCode(Number.parseInt(e[r+1]+e[r+2],16)),r+=2):n+=e[r];return n}})),Vm=__commonJSMin((e=>{var t=(Tc(),__toCommonJS(Cc));e.sign=function(e,n){if(typeof e!=`string`)throw TypeError(`Cookie value must be provided as a string.`);if(n==null)throw TypeError(`Secret key must be provided.`);return e+`.`+t.createHmac(`sha256`,n).update(e).digest(`base64`).replace(/\=+$/,``)},e.unsign=function(n,r){if(typeof n!=`string`)throw TypeError(`Signed cookie string must be provided.`);if(r==null)throw TypeError(`Secret key must be provided.`);var i=n.slice(0,n.lastIndexOf(`.`)),o=e.sign(i,r),s=Buffer.from(o),c=Buffer.from(n);return s.length===c.length&&t.timingSafeEqual(s,c)?i:!1}})),Hm=__commonJSMin((e=>{
330
+ t.exports=contentDisposition,t.exports.parse=parse;let n=new TextDecoder(`utf-8`);var r=/[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g,i=/[^\x20-\x7e\xa0-\xff]/g,o=/\\([\u0000-\u007f])/g,s=/([\\"])/g,c=/;[\x09\x20]*([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*=[\x09\x20]*("(?:[\x20!\x23-\x5b\x5d-\x7e\x80-\xff]|\\[\x20-\x7e])*"|[!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*/g,l=/^[\x20-\x7e\x80-\xff]+$/,u=/^[!#$%&'*+.0-9A-Z^_`a-z|~-]+$/,d=/^([A-Za-z0-9!#$%&+\-^_`{}~]+)'(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}|[A-Za-z]{4,8}|)'((?:%[0-9A-Fa-f]{2}|[A-Za-z0-9!#$&+.^_`|~-])+)$/,p=/^([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*(?:$|;)/;function contentDisposition(e,t){var n=t||{};return format(new ContentDisposition(n.type||`attachment`,createparams(e,n.fallback)))}function createparams(e,t){if(e!==void 0){var n={};if(typeof e!=`string`)throw TypeError(`filename must be a string`);if(t===void 0&&(t=!0),typeof t!=`string`&&typeof t!=`boolean`)throw TypeError(`fallback must be a string or boolean`);if(typeof t==`string`&&i.test(t))throw TypeError(`fallback must be ISO-8859-1 string`);var r=basename(e),o=l.test(r),s=typeof t==`string`?basename(t):t&&getlatin1(r),c=typeof s==`string`&&s!==r;return(c||!o||hasHexEscape(r))&&(n[`filename*`]=r),(o||c)&&(n.filename=c?s:r),n}}function format(e){var t=e.parameters,n=e.type;if(!n||typeof n!=`string`||!u.test(n))throw TypeError(`invalid type`);var r=String(n).toLowerCase();if(t&&typeof t==`object`)for(var i,o=Object.keys(t).sort(),s=0;s<o.length;s++){i=o[s];var c=i.slice(-1)===`*`?ustring(t[i]):qstring(t[i]);r+=`; `+i+`=`+c}return r}function decodefield(e){let t=d.exec(e);if(!t)throw TypeError(`invalid extended field value`);let r=t[1].toLowerCase(),i=t[2];switch(r){case`iso-8859-1`:return getlatin1(decodeHexEscapes(i));case`utf-8`:case`utf8`:try{return decodeURIComponent(i)}catch{let e=decodeHexEscapes(i),t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return n.decode(t)}}throw TypeError(`unsupported charset in extended field`)}function getlatin1(e){return String(e).replace(i,`?`)}function parse(e){if(!e||typeof e!=`string`)throw TypeError(`argument string is required`);var t=p.exec(e);if(!t)throw TypeError(`invalid type format`);var n=t[0].length,r=t[1].toLowerCase(),i,s=[],l={},u;for(n=c.lastIndex=t[0].slice(-1)===`;`?n-1:n;t=c.exec(e);){if(t.index!==n)throw TypeError(`invalid parameter format`);if(n+=t[0].length,i=t[1].toLowerCase(),u=t[2],s.indexOf(i)!==-1)throw TypeError(`invalid duplicate parameter`);if(s.push(i),i.indexOf(`*`)+1===i.length){i=i.slice(0,-1),u=decodefield(u),l[i]=u;continue}typeof l[i]!=`string`&&(u[0]===`"`&&(u=u.slice(1,-1).replace(o,`$1`)),l[i]=u)}if(n!==-1&&n!==e.length)throw TypeError(`invalid parameter format`);return new ContentDisposition(r,l)}function pencode(e){return`%`+String(e).charCodeAt(0).toString(16).toUpperCase()}function qstring(e){return`"`+String(e).replace(s,`\\$1`)+`"`}function ustring(e){return`UTF-8''`+encodeURIComponent(String(e)).replace(r,pencode)}function ContentDisposition(e,t){this.type=e,this.parameters=t}function basename(e){let t=e.replaceAll(`\\`,`/`),n=t.length;for(;n>0&&t[n-1]===`/`;)n--;if(n===0)return``;let r=n-1;for(;r>=0&&t[r]!==`/`;)r--;return t.slice(r+1,n)}function isHexDigit(e){let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function hasHexEscape(e){let t=e.length-3,n=-1;for(;(n=e.indexOf(`%`,n+1))!==-1&&n<=t;)if(isHexDigit(e[n+1])&&isHexDigit(e[n+2]))return!0;return!1}function decodeHexEscapes(e){let t=e.indexOf(`%`);if(t===-1)return e;let n=e.slice(0,t);for(let r=t;r<e.length;r++)e[r]===`%`&&r+2<e.length&&isHexDigit(e[r+1])&&isHexDigit(e[r+2])?(n+=String.fromCharCode(Number.parseInt(e[r+1]+e[r+2],16)),r+=2):n+=e[r];return n}})),Bm=__commonJSMin((e=>{var t=(Tc(),__toCommonJS(Cc));e.sign=function(e,n){if(typeof e!=`string`)throw TypeError(`Cookie value must be provided as a string.`);if(n==null)throw TypeError(`Secret key must be provided.`);return e+`.`+t.createHmac(`sha256`,n).update(e).digest(`base64`).replace(/\=+$/,``)},e.unsign=function(n,r){if(typeof n!=`string`)throw TypeError(`Signed cookie string must be provided.`);if(r==null)throw TypeError(`Secret key must be provided.`);var i=n.slice(0,n.lastIndexOf(`.`)),o=e.sign(i,r),s=Buffer.from(o),c=Buffer.from(n);return s.length===c.length&&t.timingSafeEqual(s,c)?i:!1}})),Vm=__commonJSMin((e=>{
331
331
  /*!
332
332
  * cookie
333
333
  * Copyright(c) 2012-2014 Roman Shtylman
334
334
  * Copyright(c) 2015 Douglas Christopher Wilson
335
335
  * MIT Licensed
336
336
  */
337
- e.parse=parse,e.serialize=serialize;var t=Object.prototype.toString,n=Object.prototype.hasOwnProperty,r=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,i=/^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/,o=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,s=/^[\u0020-\u003A\u003D-\u007E]*$/;function parse(e,t){if(typeof e!=`string`)throw TypeError(`argument str must be a string`);var r={},i=e.length;if(i<2)return r;var o=t&&t.decode||decode,s=0,c=0,l=0;do{if(c=e.indexOf(`=`,s),c===-1)break;if(l=e.indexOf(`;`,s),l===-1)l=i;else if(c>l){s=e.lastIndexOf(`;`,c-1)+1;continue}var u=startIndex(e,s,c),d=endIndex(e,c,u),p=e.slice(u,d);if(!n.call(r,p)){var m=startIndex(e,c+1,l),h=endIndex(e,l,m);e.charCodeAt(m)===34&&e.charCodeAt(h-1)===34&&(m++,h--),r[p]=tryDecode(e.slice(m,h),o)}s=l+1}while(s<i);return r}function startIndex(e,t,n){do{var r=e.charCodeAt(t);if(r!==32&&r!==9)return t}while(++t<n);return n}function endIndex(e,t,n){for(;t>n;){var r=e.charCodeAt(--t);if(r!==32&&r!==9)return t+1}return n}function serialize(e,t,n){var c=n&&n.encode||encodeURIComponent;if(typeof c!=`function`)throw TypeError(`option encode is invalid`);if(!r.test(e))throw TypeError(`argument name is invalid`);var l=c(t);if(!i.test(l))throw TypeError(`argument val is invalid`);var u=e+`=`+l;if(!n)return u;if(n.maxAge!=null){var d=Math.floor(n.maxAge);if(!isFinite(d))throw TypeError(`option maxAge is invalid`);u+=`; Max-Age=`+d}if(n.domain){if(!o.test(n.domain))throw TypeError(`option domain is invalid`);u+=`; Domain=`+n.domain}if(n.path){if(!s.test(n.path))throw TypeError(`option path is invalid`);u+=`; Path=`+n.path}if(n.expires){var p=n.expires;if(!isDate(p)||isNaN(p.valueOf()))throw TypeError(`option expires is invalid`);u+=`; Expires=`+p.toUTCString()}if(n.httpOnly&&(u+=`; HttpOnly`),n.secure&&(u+=`; Secure`),n.partitioned&&(u+=`; Partitioned`),n.priority)switch(typeof n.priority==`string`?n.priority.toLowerCase():n.priority){case`low`:u+=`; Priority=Low`;break;case`medium`:u+=`; Priority=Medium`;break;case`high`:u+=`; Priority=High`;break;default:throw TypeError(`option priority is invalid`)}if(n.sameSite)switch(typeof n.sameSite==`string`?n.sameSite.toLowerCase():n.sameSite){case!0:u+=`; SameSite=Strict`;break;case`lax`:u+=`; SameSite=Lax`;break;case`strict`:u+=`; SameSite=Strict`;break;case`none`:u+=`; SameSite=None`;break;default:throw TypeError(`option sameSite is invalid`)}return u}function decode(e){return e.indexOf(`%`)===-1?e:decodeURIComponent(e)}function isDate(e){return t.call(e)===`[object Date]`}function tryDecode(e,t){try{return t(e)}catch{return e}}})),Um=__commonJSMin(((e,t)=>{
337
+ e.parse=parse,e.serialize=serialize;var t=Object.prototype.toString,n=Object.prototype.hasOwnProperty,r=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,i=/^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/,o=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,s=/^[\u0020-\u003A\u003D-\u007E]*$/;function parse(e,t){if(typeof e!=`string`)throw TypeError(`argument str must be a string`);var r={},i=e.length;if(i<2)return r;var o=t&&t.decode||decode,s=0,c=0,l=0;do{if(c=e.indexOf(`=`,s),c===-1)break;if(l=e.indexOf(`;`,s),l===-1)l=i;else if(c>l){s=e.lastIndexOf(`;`,c-1)+1;continue}var u=startIndex(e,s,c),d=endIndex(e,c,u),p=e.slice(u,d);if(!n.call(r,p)){var m=startIndex(e,c+1,l),h=endIndex(e,l,m);e.charCodeAt(m)===34&&e.charCodeAt(h-1)===34&&(m++,h--),r[p]=tryDecode(e.slice(m,h),o)}s=l+1}while(s<i);return r}function startIndex(e,t,n){do{var r=e.charCodeAt(t);if(r!==32&&r!==9)return t}while(++t<n);return n}function endIndex(e,t,n){for(;t>n;){var r=e.charCodeAt(--t);if(r!==32&&r!==9)return t+1}return n}function serialize(e,t,n){var c=n&&n.encode||encodeURIComponent;if(typeof c!=`function`)throw TypeError(`option encode is invalid`);if(!r.test(e))throw TypeError(`argument name is invalid`);var l=c(t);if(!i.test(l))throw TypeError(`argument val is invalid`);var u=e+`=`+l;if(!n)return u;if(n.maxAge!=null){var d=Math.floor(n.maxAge);if(!isFinite(d))throw TypeError(`option maxAge is invalid`);u+=`; Max-Age=`+d}if(n.domain){if(!o.test(n.domain))throw TypeError(`option domain is invalid`);u+=`; Domain=`+n.domain}if(n.path){if(!s.test(n.path))throw TypeError(`option path is invalid`);u+=`; Path=`+n.path}if(n.expires){var p=n.expires;if(!isDate(p)||isNaN(p.valueOf()))throw TypeError(`option expires is invalid`);u+=`; Expires=`+p.toUTCString()}if(n.httpOnly&&(u+=`; HttpOnly`),n.secure&&(u+=`; Secure`),n.partitioned&&(u+=`; Partitioned`),n.priority)switch(typeof n.priority==`string`?n.priority.toLowerCase():n.priority){case`low`:u+=`; Priority=Low`;break;case`medium`:u+=`; Priority=Medium`;break;case`high`:u+=`; Priority=High`;break;default:throw TypeError(`option priority is invalid`)}if(n.sameSite)switch(typeof n.sameSite==`string`?n.sameSite.toLowerCase():n.sameSite){case!0:u+=`; SameSite=Strict`;break;case`lax`:u+=`; SameSite=Lax`;break;case`strict`:u+=`; SameSite=Strict`;break;case`none`:u+=`; SameSite=None`;break;default:throw TypeError(`option sameSite is invalid`)}return u}function decode(e){return e.indexOf(`%`)===-1?e:decodeURIComponent(e)}function isDate(e){return t.call(e)===`[object Date]`}function tryDecode(e,t){try{return t(e)}catch{return e}}})),Hm=__commonJSMin(((e,t)=>{
338
338
  /*!
339
339
  * send
340
340
  * Copyright(c) 2012 TJ Holowaychuk
341
341
  * Copyright(c) 2014-2022 Douglas Christopher Wilson
342
342
  * MIT Licensed
343
343
  */
344
- var n=sl(),r=el()(`send`),i=Vd(),o=Hd(),s=em(),c=Lm(),l=(op(),__toCommonJS(rp)),u=ql(),d=Qc(),p=Hl(),m=Rm(),h=(jr(),__toCommonJS(hr)),g=il(),_=jl(),v=(Vu(),__toCommonJS(Lu)),y=h.extname,b=h.join,x=h.normalize,S=h.resolve,w=h.sep,T=/^ *bytes=/,E=3600*24*365*1e3,D=/(?:^|[\\/])\.\.(?:[\\/]|$)/;t.exports=send;function send(e,t,n){return new SendStream(e,t,n)}function SendStream(e,t,n){_.call(this);var r=n||{};if(this.options=r,this.path=t,this.req=e,this._acceptRanges=r.acceptRanges===void 0?!0:!!r.acceptRanges,this._cacheControl=r.cacheControl===void 0?!0:!!r.cacheControl,this._etag=r.etag===void 0?!0:!!r.etag,this._dotfiles=r.dotfiles===void 0?`ignore`:r.dotfiles,this._dotfiles!==`ignore`&&this._dotfiles!==`allow`&&this._dotfiles!==`deny`)throw TypeError(`dotfiles option must be "allow", "deny", or "ignore"`);this._extensions=r.extensions===void 0?[]:normalizeList(r.extensions,`extensions option`),this._immutable=r.immutable===void 0?!1:!!r.immutable,this._index=r.index===void 0?[`index.html`]:normalizeList(r.index,`index option`),this._lastModified=r.lastModified===void 0?!0:!!r.lastModified,this._maxage=r.maxAge||r.maxage,this._maxage=typeof this._maxage==`string`?d(this._maxage):Number(this._maxage),this._maxage=isNaN(this._maxage)?0:Math.min(Math.max(0,this._maxage),E),this._root=r.root?S(r.root):null}v.inherits(SendStream,_),SendStream.prototype.error=function error(e,t){if(hasListeners(this,`error`))return this.emit(`error`,createHttpError(e,t));var n=this.res,r=createHtmlDocument(`Error`,o(g.message[e]||String(e)));clearHeaders(n),t&&t.headers&&setHeaders(n,t.headers),n.statusCode=e,n.setHeader(`Content-Type`,`text/html; charset=UTF-8`),n.setHeader(`Content-Length`,Buffer.byteLength(r)),n.setHeader(`Content-Security-Policy`,`default-src 'none'`),n.setHeader(`X-Content-Type-Options`,`nosniff`),n.end(r)},SendStream.prototype.hasTrailingSlash=function hasTrailingSlash(){return this.path[this.path.length-1]===`/`},SendStream.prototype.isConditionalGET=function isConditionalGET(){return this.req.headers[`if-match`]||this.req.headers[`if-unmodified-since`]||this.req.headers[`if-none-match`]||this.req.headers[`if-modified-since`]},SendStream.prototype.isPreconditionFailure=function isPreconditionFailure(){var e=this.req,t=this.res,n=e.headers[`if-match`];if(n){var r=t.getHeader(`ETag`);return!r||n!==`*`&&parseTokenList(n).every(function(e){return e!==r&&e!==`W/`+r&&`W/`+e!==r})}var i=parseHttpDate(e.headers[`if-unmodified-since`]);if(!isNaN(i)){var o=parseHttpDate(t.getHeader(`Last-Modified`));return isNaN(o)||o>i}return!1},SendStream.prototype.removeContentHeaderFields=function removeContentHeaderFields(){var e=this.res;e.removeHeader(`Content-Encoding`),e.removeHeader(`Content-Language`),e.removeHeader(`Content-Length`),e.removeHeader(`Content-Range`),e.removeHeader(`Content-Type`)},SendStream.prototype.notModified=function notModified(){var e=this.res;r(`not modified`),this.removeContentHeaderFields(),e.statusCode=304,e.end()},SendStream.prototype.headersAlreadySent=function headersAlreadySent(){var e=Error(`Can't set headers after they are sent.`);r(`headers already sent`),this.error(500,e)},SendStream.prototype.isCachable=function isCachable(){var e=this.res.statusCode;return e>=200&&e<300||e===304},SendStream.prototype.onStatError=function onStatError(e){switch(e.code){case`ENAMETOOLONG`:case`ENOENT`:case`ENOTDIR`:this.error(404,e);break;default:this.error(500,e);break}},SendStream.prototype.isFresh=function isFresh(){return c(this.req.headers,{etag:this.res.getHeader(`ETag`),"last-modified":this.res.getHeader(`Last-Modified`)})},SendStream.prototype.isRangeFresh=function isRangeFresh(){var e=this.req.headers[`if-range`];if(!e)return!0;if(e.indexOf(`"`)!==-1){var t=this.res.getHeader(`ETag`);return!!(t&&e.indexOf(t)!==-1)}return parseHttpDate(this.res.getHeader(`Last-Modified`))<=parseHttpDate(e)},SendStream.prototype.redirect=function redirect(e){var t=this.res;if(hasListeners(this,`directory`)){this.emit(`directory`,t,e);return}if(this.hasTrailingSlash()){this.error(403);return}var n=i(collapseLeadingSlashes(this.path+`/`)),r=createHtmlDocument(`Redirecting`,`Redirecting to `+o(n));t.statusCode=301,t.setHeader(`Content-Type`,`text/html; charset=UTF-8`),t.setHeader(`Content-Length`,Buffer.byteLength(r)),t.setHeader(`Content-Security-Policy`,`default-src 'none'`),t.setHeader(`X-Content-Type-Options`,`nosniff`),t.setHeader(`Location`,n),t.end(r)},SendStream.prototype.pipe=function pipe(e){var t=this._root;this.res=e;var n=decode(this.path);if(n===-1||~n.indexOf(`\0`))return this.error(400),e;var i;if(t!==null){if(n&&=x(`.`+w+n),D.test(n))return r(`malicious path "%s"`,n),this.error(403),e;i=n.split(w),n=x(b(t,n))}else{if(D.test(n))return r(`malicious path "%s"`,n),this.error(403),e;i=x(n).split(w),n=S(n)}if(containsDotFile(i))switch(r(`%s dotfile "%s"`,this._dotfiles,n),this._dotfiles){case`allow`:break;case`deny`:return this.error(403),e;default:return this.error(404),e}return this._index.length&&this.hasTrailingSlash()?(this.sendIndex(n),e):(this.sendFile(n),e)},SendStream.prototype.send=function send(e,t){var n=t.size,i=this.options,o={},s=this.res,c=this.req,l=c.headers.range,u=i.start||0;if(s.headersSent){this.headersAlreadySent();return}if(r(`pipe "%s"`,e),this.setHeader(e,t),this.type(e),this.isConditionalGET()){if(this.isPreconditionFailure()){this.error(412);return}if(this.isCachable()&&this.isFresh()){this.notModified();return}}if(n=Math.max(0,n-u),i.end!==void 0){var d=i.end-u+1;n>d&&(n=d)}if(this._acceptRanges&&T.test(l)){if(l=m(n,l,{combine:!0}),this.isRangeFresh()||(r(`range stale`),l=-2),l===-1)return r(`range unsatisfiable`),s.setHeader(`Content-Range`,contentRange(`bytes`,n)),this.error(416,{headers:{"Content-Range":s.getHeader(`Content-Range`)}});l!==-2&&l.length===1&&(r(`range %j`,l),s.statusCode=206,s.setHeader(`Content-Range`,contentRange(`bytes`,n,l[0])),u+=l[0].start,n=l[0].end-l[0].start+1)}for(var p in i)o[p]=i[p];if(o.start=u,o.end=Math.max(u,u+n-1),s.setHeader(`Content-Length`,n),c.method===`HEAD`){s.end();return}this.stream(e,o)},SendStream.prototype.sendFile=function sendFile(e){var t=0,n=this;r(`stat "%s"`,e),l.stat(e,function onstat(t,r){var i=e[e.length-1]===w;if(t&&t.code===`ENOENT`&&!y(e)&&!i)return next(t);if(t)return n.onStatError(t);if(r.isDirectory())return n.redirect(e);if(i)return n.error(404);n.emit(`file`,e,r),n.send(e,r)});function next(i){if(n._extensions.length<=t)return i?n.onStatError(i):n.error(404);var o=e+`.`+n._extensions[t++];r(`stat "%s"`,o),l.stat(o,function(e,t){if(e)return next(e);if(t.isDirectory())return next();n.emit(`file`,o,t),n.send(o,t)})}},SendStream.prototype.sendIndex=function sendIndex(e){var t=-1,n=this;function next(i){if(++t>=n._index.length)return i?n.onStatError(i):n.error(404);var o=b(e,n._index[t]);r(`stat "%s"`,o),l.stat(o,function(e,t){if(e)return next(e);if(t.isDirectory())return next();n.emit(`file`,o,t),n.send(o,t)})}next()},SendStream.prototype.stream=function stream(e,t){var n=this,r=this.res,i=l.createReadStream(e,t);this.emit(`stream`,i),i.pipe(r);function cleanup(){i.destroy()}p(r,cleanup),i.on(`error`,function onerror(e){cleanup(),n.onStatError(e)}),i.on(`end`,function onend(){n.emit(`end`)})},SendStream.prototype.type=function type(e){var t=this.res;if(!t.getHeader(`Content-Type`)){var n=y(e),i=u.contentType(n)||`application/octet-stream`;r(`content-type %s`,i),t.setHeader(`Content-Type`,i)}},SendStream.prototype.setHeader=function setHeader(e,t){var n=this.res;if(this.emit(`headers`,n,e,t),this._acceptRanges&&!n.getHeader(`Accept-Ranges`)&&(r(`accept ranges`),n.setHeader(`Accept-Ranges`,`bytes`)),this._cacheControl&&!n.getHeader(`Cache-Control`)){var i=`public, max-age=`+Math.floor(this._maxage/1e3);this._immutable&&(i+=`, immutable`),r(`cache-control %s`,i),n.setHeader(`Cache-Control`,i)}if(this._lastModified&&!n.getHeader(`Last-Modified`)){var o=t.mtime.toUTCString();r(`modified %s`,o),n.setHeader(`Last-Modified`,o)}if(this._etag&&!n.getHeader(`ETag`)){var c=s(t);r(`etag %s`,c),n.setHeader(`ETag`,c)}};function clearHeaders(e){for(let t of e.getHeaderNames())e.removeHeader(t)}function collapseLeadingSlashes(e){for(var t=0;t<e.length&&e[t]===`/`;t++);return t>1?`/`+e.substr(t):e}function containsDotFile(e){for(var t=0;t<e.length;t++){var n=e[t];if(n.length>1&&n[0]===`.`)return!0}return!1}function contentRange(e,t,n){return e+` `+(n?n.start+`-`+n.end:`*`)+`/`+t}function createHtmlDocument(e,t){return`<!DOCTYPE html>
344
+ var n=sl(),r=el()(`send`),i=Vd(),o=Hd(),s=$p(),c=Im(),l=(op(),__toCommonJS(rp)),u=ql(),d=Qc(),p=Hl(),m=Lm(),h=(jr(),__toCommonJS(hr)),g=il(),_=jl(),v=(Vu(),__toCommonJS(Lu)),y=h.extname,b=h.join,x=h.normalize,S=h.resolve,w=h.sep,T=/^ *bytes=/,E=3600*24*365*1e3,D=/(?:^|[\\/])\.\.(?:[\\/]|$)/;t.exports=send;function send(e,t,n){return new SendStream(e,t,n)}function SendStream(e,t,n){_.call(this);var r=n||{};if(this.options=r,this.path=t,this.req=e,this._acceptRanges=r.acceptRanges===void 0?!0:!!r.acceptRanges,this._cacheControl=r.cacheControl===void 0?!0:!!r.cacheControl,this._etag=r.etag===void 0?!0:!!r.etag,this._dotfiles=r.dotfiles===void 0?`ignore`:r.dotfiles,this._dotfiles!==`ignore`&&this._dotfiles!==`allow`&&this._dotfiles!==`deny`)throw TypeError(`dotfiles option must be "allow", "deny", or "ignore"`);this._extensions=r.extensions===void 0?[]:normalizeList(r.extensions,`extensions option`),this._immutable=r.immutable===void 0?!1:!!r.immutable,this._index=r.index===void 0?[`index.html`]:normalizeList(r.index,`index option`),this._lastModified=r.lastModified===void 0?!0:!!r.lastModified,this._maxage=r.maxAge||r.maxage,this._maxage=typeof this._maxage==`string`?d(this._maxage):Number(this._maxage),this._maxage=isNaN(this._maxage)?0:Math.min(Math.max(0,this._maxage),E),this._root=r.root?S(r.root):null}v.inherits(SendStream,_),SendStream.prototype.error=function error(e,t){if(hasListeners(this,`error`))return this.emit(`error`,createHttpError(e,t));var n=this.res,r=createHtmlDocument(`Error`,o(g.message[e]||String(e)));clearHeaders(n),t&&t.headers&&setHeaders(n,t.headers),n.statusCode=e,n.setHeader(`Content-Type`,`text/html; charset=UTF-8`),n.setHeader(`Content-Length`,Buffer.byteLength(r)),n.setHeader(`Content-Security-Policy`,`default-src 'none'`),n.setHeader(`X-Content-Type-Options`,`nosniff`),n.end(r)},SendStream.prototype.hasTrailingSlash=function hasTrailingSlash(){return this.path[this.path.length-1]===`/`},SendStream.prototype.isConditionalGET=function isConditionalGET(){return this.req.headers[`if-match`]||this.req.headers[`if-unmodified-since`]||this.req.headers[`if-none-match`]||this.req.headers[`if-modified-since`]},SendStream.prototype.isPreconditionFailure=function isPreconditionFailure(){var e=this.req,t=this.res,n=e.headers[`if-match`];if(n){var r=t.getHeader(`ETag`);return!r||n!==`*`&&parseTokenList(n).every(function(e){return e!==r&&e!==`W/`+r&&`W/`+e!==r})}var i=parseHttpDate(e.headers[`if-unmodified-since`]);if(!isNaN(i)){var o=parseHttpDate(t.getHeader(`Last-Modified`));return isNaN(o)||o>i}return!1},SendStream.prototype.removeContentHeaderFields=function removeContentHeaderFields(){var e=this.res;e.removeHeader(`Content-Encoding`),e.removeHeader(`Content-Language`),e.removeHeader(`Content-Length`),e.removeHeader(`Content-Range`),e.removeHeader(`Content-Type`)},SendStream.prototype.notModified=function notModified(){var e=this.res;r(`not modified`),this.removeContentHeaderFields(),e.statusCode=304,e.end()},SendStream.prototype.headersAlreadySent=function headersAlreadySent(){var e=Error(`Can't set headers after they are sent.`);r(`headers already sent`),this.error(500,e)},SendStream.prototype.isCachable=function isCachable(){var e=this.res.statusCode;return e>=200&&e<300||e===304},SendStream.prototype.onStatError=function onStatError(e){switch(e.code){case`ENAMETOOLONG`:case`ENOENT`:case`ENOTDIR`:this.error(404,e);break;default:this.error(500,e);break}},SendStream.prototype.isFresh=function isFresh(){return c(this.req.headers,{etag:this.res.getHeader(`ETag`),"last-modified":this.res.getHeader(`Last-Modified`)})},SendStream.prototype.isRangeFresh=function isRangeFresh(){var e=this.req.headers[`if-range`];if(!e)return!0;if(e.indexOf(`"`)!==-1){var t=this.res.getHeader(`ETag`);return!!(t&&e.indexOf(t)!==-1)}return parseHttpDate(this.res.getHeader(`Last-Modified`))<=parseHttpDate(e)},SendStream.prototype.redirect=function redirect(e){var t=this.res;if(hasListeners(this,`directory`)){this.emit(`directory`,t,e);return}if(this.hasTrailingSlash()){this.error(403);return}var n=i(collapseLeadingSlashes(this.path+`/`)),r=createHtmlDocument(`Redirecting`,`Redirecting to `+o(n));t.statusCode=301,t.setHeader(`Content-Type`,`text/html; charset=UTF-8`),t.setHeader(`Content-Length`,Buffer.byteLength(r)),t.setHeader(`Content-Security-Policy`,`default-src 'none'`),t.setHeader(`X-Content-Type-Options`,`nosniff`),t.setHeader(`Location`,n),t.end(r)},SendStream.prototype.pipe=function pipe(e){var t=this._root;this.res=e;var n=decode(this.path);if(n===-1||~n.indexOf(`\0`))return this.error(400),e;var i;if(t!==null){if(n&&=x(`.`+w+n),D.test(n))return r(`malicious path "%s"`,n),this.error(403),e;i=n.split(w),n=x(b(t,n))}else{if(D.test(n))return r(`malicious path "%s"`,n),this.error(403),e;i=x(n).split(w),n=S(n)}if(containsDotFile(i))switch(r(`%s dotfile "%s"`,this._dotfiles,n),this._dotfiles){case`allow`:break;case`deny`:return this.error(403),e;default:return this.error(404),e}return this._index.length&&this.hasTrailingSlash()?(this.sendIndex(n),e):(this.sendFile(n),e)},SendStream.prototype.send=function send(e,t){var n=t.size,i=this.options,o={},s=this.res,c=this.req,l=c.headers.range,u=i.start||0;if(s.headersSent){this.headersAlreadySent();return}if(r(`pipe "%s"`,e),this.setHeader(e,t),this.type(e),this.isConditionalGET()){if(this.isPreconditionFailure()){this.error(412);return}if(this.isCachable()&&this.isFresh()){this.notModified();return}}if(n=Math.max(0,n-u),i.end!==void 0){var d=i.end-u+1;n>d&&(n=d)}if(this._acceptRanges&&T.test(l)){if(l=m(n,l,{combine:!0}),this.isRangeFresh()||(r(`range stale`),l=-2),l===-1)return r(`range unsatisfiable`),s.setHeader(`Content-Range`,contentRange(`bytes`,n)),this.error(416,{headers:{"Content-Range":s.getHeader(`Content-Range`)}});l!==-2&&l.length===1&&(r(`range %j`,l),s.statusCode=206,s.setHeader(`Content-Range`,contentRange(`bytes`,n,l[0])),u+=l[0].start,n=l[0].end-l[0].start+1)}for(var p in i)o[p]=i[p];if(o.start=u,o.end=Math.max(u,u+n-1),s.setHeader(`Content-Length`,n),c.method===`HEAD`){s.end();return}this.stream(e,o)},SendStream.prototype.sendFile=function sendFile(e){var t=0,n=this;r(`stat "%s"`,e),l.stat(e,function onstat(t,r){var i=e[e.length-1]===w;if(t&&t.code===`ENOENT`&&!y(e)&&!i)return next(t);if(t)return n.onStatError(t);if(r.isDirectory())return n.redirect(e);if(i)return n.error(404);n.emit(`file`,e,r),n.send(e,r)});function next(i){if(n._extensions.length<=t)return i?n.onStatError(i):n.error(404);var o=e+`.`+n._extensions[t++];r(`stat "%s"`,o),l.stat(o,function(e,t){if(e)return next(e);if(t.isDirectory())return next();n.emit(`file`,o,t),n.send(o,t)})}},SendStream.prototype.sendIndex=function sendIndex(e){var t=-1,n=this;function next(i){if(++t>=n._index.length)return i?n.onStatError(i):n.error(404);var o=b(e,n._index[t]);r(`stat "%s"`,o),l.stat(o,function(e,t){if(e)return next(e);if(t.isDirectory())return next();n.emit(`file`,o,t),n.send(o,t)})}next()},SendStream.prototype.stream=function stream(e,t){var n=this,r=this.res,i=l.createReadStream(e,t);this.emit(`stream`,i),i.pipe(r);function cleanup(){i.destroy()}p(r,cleanup),i.on(`error`,function onerror(e){cleanup(),n.onStatError(e)}),i.on(`end`,function onend(){n.emit(`end`)})},SendStream.prototype.type=function type(e){var t=this.res;if(!t.getHeader(`Content-Type`)){var n=y(e),i=u.contentType(n)||`application/octet-stream`;r(`content-type %s`,i),t.setHeader(`Content-Type`,i)}},SendStream.prototype.setHeader=function setHeader(e,t){var n=this.res;if(this.emit(`headers`,n,e,t),this._acceptRanges&&!n.getHeader(`Accept-Ranges`)&&(r(`accept ranges`),n.setHeader(`Accept-Ranges`,`bytes`)),this._cacheControl&&!n.getHeader(`Cache-Control`)){var i=`public, max-age=`+Math.floor(this._maxage/1e3);this._immutable&&(i+=`, immutable`),r(`cache-control %s`,i),n.setHeader(`Cache-Control`,i)}if(this._lastModified&&!n.getHeader(`Last-Modified`)){var o=t.mtime.toUTCString();r(`modified %s`,o),n.setHeader(`Last-Modified`,o)}if(this._etag&&!n.getHeader(`ETag`)){var c=s(t);r(`etag %s`,c),n.setHeader(`ETag`,c)}};function clearHeaders(e){for(let t of e.getHeaderNames())e.removeHeader(t)}function collapseLeadingSlashes(e){for(var t=0;t<e.length&&e[t]===`/`;t++);return t>1?`/`+e.substr(t):e}function containsDotFile(e){for(var t=0;t<e.length;t++){var n=e[t];if(n.length>1&&n[0]===`.`)return!0}return!1}function contentRange(e,t,n){return e+` `+(n?n.start+`-`+n.end:`*`)+`/`+t}function createHtmlDocument(e,t){return`<!DOCTYPE html>
345
345
  <html lang="en">
346
346
  <head>
347
347
  <meta charset="utf-8">
@@ -351,20 +351,20 @@ var n=sl(),r=el()(`send`),i=Vd(),o=Hd(),s=em(),c=Lm(),l=(op(),__toCommonJS(rp)),
351
351
  <pre>`+t+`</pre>
352
352
  </body>
353
353
  </html>
354
- `}function createHttpError(e,t){return t?t instanceof Error?n(e,t,{expose:!1}):n(e,t):n(e)}function decode(e){try{return decodeURIComponent(e)}catch{return-1}}function hasListeners(e,t){return(typeof e.listenerCount==`function`?e.listenerCount(t):e.listeners(t).length)>0}function normalizeList(e,t){for(var n=[].concat(e||[]),r=0;r<n.length;r++)if(typeof n[r]!=`string`)throw TypeError(t+` must be array of strings or false`);return n}function parseHttpDate(e){var t=e&&Date.parse(e);return typeof t==`number`?t:NaN}function parseTokenList(e){for(var t=0,n=[],r=0,i=0,o=e.length;i<o;i++)switch(e.charCodeAt(i)){case 32:r===t&&(r=t=i+1);break;case 44:r!==t&&n.push(e.substring(r,t)),r=t=i+1;break;default:t=i+1;break}return r!==t&&n.push(e.substring(r,t)),n}function setHeaders(e,t){for(var n=Object.keys(t),r=0;r<n.length;r++){var i=n[r];e.setHeader(i,t[i])}}})),Wm=__commonJSMin(((e,t)=>{
354
+ `}function createHttpError(e,t){return t?t instanceof Error?n(e,t,{expose:!1}):n(e,t):n(e)}function decode(e){try{return decodeURIComponent(e)}catch{return-1}}function hasListeners(e,t){return(typeof e.listenerCount==`function`?e.listenerCount(t):e.listeners(t).length)>0}function normalizeList(e,t){for(var n=[].concat(e||[]),r=0;r<n.length;r++)if(typeof n[r]!=`string`)throw TypeError(t+` must be array of strings or false`);return n}function parseHttpDate(e){var t=e&&Date.parse(e);return typeof t==`number`?t:NaN}function parseTokenList(e){for(var t=0,n=[],r=0,i=0,o=e.length;i<o;i++)switch(e.charCodeAt(i)){case 32:r===t&&(r=t=i+1);break;case 44:r!==t&&n.push(e.substring(r,t)),r=t=i+1;break;default:t=i+1;break}return r!==t&&n.push(e.substring(r,t)),n}function setHeaders(e,t){for(var n=Object.keys(t),r=0;r<n.length;r++){var i=n[r];e.setHeader(i,t[i])}}})),Um=__commonJSMin(((e,t)=>{
355
355
  /*!
356
356
  * vary
357
357
  * Copyright(c) 2014-2017 Douglas Christopher Wilson
358
358
  * MIT Licensed
359
359
  */
360
- t.exports=vary,t.exports.append=append;var n=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function append(e,t){if(typeof e!=`string`)throw TypeError(`header argument is required`);if(!t)throw TypeError(`field argument is required`);for(var r=Array.isArray(t)?t:parse(String(t)),i=0;i<r.length;i++)if(!n.test(r[i]))throw TypeError(`field argument contains an invalid header name`);if(e===`*`)return e;var o=e,s=parse(e.toLowerCase());if(r.indexOf(`*`)!==-1||s.indexOf(`*`)!==-1)return`*`;for(var c=0;c<r.length;c++){var l=r[c].toLowerCase();s.indexOf(l)===-1&&(s.push(l),o=o?o+`, `+r[c]:r[c])}return o}function parse(e){for(var t=0,n=[],r=0,i=0,o=e.length;i<o;i++)switch(e.charCodeAt(i)){case 32:r===t&&(r=t=i+1);break;case 44:n.push(e.substring(r,t)),r=t=i+1;break;default:t=i+1;break}return n.push(e.substring(r,t)),n}function vary(e,t){if(!e||!e.getHeader||!e.setHeader)throw TypeError(`res argument is required`);var n=e.getHeader(`Vary`)||``;(n=append(Array.isArray(n)?n.join(`, `):String(n),t))&&e.setHeader(`Vary`,n)}})),Gm=__commonJSMin(((e,t)=>{
360
+ t.exports=vary,t.exports.append=append;var n=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function append(e,t){if(typeof e!=`string`)throw TypeError(`header argument is required`);if(!t)throw TypeError(`field argument is required`);for(var r=Array.isArray(t)?t:parse(String(t)),i=0;i<r.length;i++)if(!n.test(r[i]))throw TypeError(`field argument contains an invalid header name`);if(e===`*`)return e;var o=e,s=parse(e.toLowerCase());if(r.indexOf(`*`)!==-1||s.indexOf(`*`)!==-1)return`*`;for(var c=0;c<r.length;c++){var l=r[c].toLowerCase();s.indexOf(l)===-1&&(s.push(l),o=o?o+`, `+r[c]:r[c])}return o}function parse(e){for(var t=0,n=[],r=0,i=0,o=e.length;i<o;i++)switch(e.charCodeAt(i)){case 32:r===t&&(r=t=i+1);break;case 44:n.push(e.substring(r,t)),r=t=i+1;break;default:t=i+1;break}return n.push(e.substring(r,t)),n}function vary(e,t){if(!e||!e.getHeader||!e.setHeader)throw TypeError(`res argument is required`);var n=e.getHeader(`Vary`)||``;(n=append(Array.isArray(n)?n.join(`, `):String(n),t))&&e.setHeader(`Vary`,n)}})),Wm=__commonJSMin(((e,t)=>{
361
361
  /*!
362
362
  * express
363
363
  * Copyright(c) 2009-2013 TJ Holowaychuk
364
364
  * Copyright(c) 2014-2015 Douglas Christopher Wilson
365
365
  * MIT Licensed
366
366
  */
367
- var n=Bm(),r=sl(),i=tl()(`express`),o=Vd(),s=Hd(),c=($p(),__toCommonJS(Yp)),l=Hl(),u=ql(),d=(jr(),__toCommonJS(hr)),p=(jr(),__toCommonJS(hr)).isAbsolute,m=il(),h=Vm().sign,g=Sm().normalizeType,_=Sm().normalizeTypes,v=Sm().setCharset,y=Hm(),b=Um(),x=d.extname,S=d.resolve,w=Wm();let{Buffer:T}=(U(),__toCommonJS(an));var E=Object.create(c.ServerResponse.prototype);t.exports=E,E.status=function status(e){if(!Number.isInteger(e))throw TypeError(`Invalid status code: ${JSON.stringify(e)}. Status code must be an integer.`);if(e<100||e>999)throw RangeError(`Invalid status code: ${JSON.stringify(e)}. Status code must be greater than 99 and less than 1000.`);return this.statusCode=e,this},E.links=function(e){var t=this.get(`Link`)||``;return t&&(t+=`, `),this.set(`Link`,t+Object.keys(e).map(function(t){return Array.isArray(e[t])?e[t].map(function(e){return`<${e}>; rel="${t}"`}).join(`, `):`<${e[t]}>; rel="${t}"`}).join(`, `))},E.send=function send(e){var t=e,n,r=this.req,i,o=this.app;switch(typeof t){case`string`:this.get(`Content-Type`)||this.type(`html`);break;case`boolean`:case`number`:case`object`:if(t===null)t=``;else if(ArrayBuffer.isView(t))this.get(`Content-Type`)||this.type(`bin`);else return this.json(t);break}typeof t==`string`&&(n=`utf8`,i=this.get(`Content-Type`),typeof i==`string`&&this.set(`Content-Type`,v(i,`utf-8`)));var s=o.get(`etag fn`),c=!this.get(`ETag`)&&typeof s==`function`,l;t!==void 0&&(T.isBuffer(t)?l=t.length:!c&&t.length<1e3?l=T.byteLength(t,n):(t=T.from(t,n),n=void 0,l=t.length),this.set(`Content-Length`,l));var u;return c&&l!==void 0&&(u=s(t,n))&&this.set(`ETag`,u),r.fresh&&this.status(304),(this.statusCode===204||this.statusCode===304)&&(this.removeHeader(`Content-Type`),this.removeHeader(`Content-Length`),this.removeHeader(`Transfer-Encoding`),t=``),this.statusCode===205&&(this.set(`Content-Length`,`0`),this.removeHeader(`Transfer-Encoding`),t=``),r.method===`HEAD`?this.end():this.end(t,n),this},E.json=function json(e){var t=this.app,n=t.get(`json escape`),r=stringify(e,t.get(`json replacer`),t.get(`json spaces`),n);return this.get(`Content-Type`)||this.set(`Content-Type`,`application/json`),this.send(r)},E.jsonp=function jsonp(e){var t=this.app,n=t.get(`json escape`),r=stringify(e,t.get(`json replacer`),t.get(`json spaces`),n),i=this.req.query[t.get(`jsonp callback name`)];return this.get(`Content-Type`)||(this.set(`X-Content-Type-Options`,`nosniff`),this.set(`Content-Type`,`application/json`)),Array.isArray(i)&&(i=i[0]),typeof i==`string`&&i.length!==0&&(this.set(`X-Content-Type-Options`,`nosniff`),this.set(`Content-Type`,`text/javascript`),i=i.replace(/[^\[\]\w$.]/g,``),r===void 0?r=``:typeof r==`string`&&(r=r.replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)),r=`/**/ typeof `+i+` === 'function' && `+i+`(`+r+`);`),this.send(r)},E.sendStatus=function sendStatus(e){var t=m.message[e]||String(e);return this.status(e),this.type(`txt`),this.send(t)},E.sendFile=function sendFile(e,t,n){var r=n,i=this.req,o=this,s=i.next,c=t||{};if(!e)throw TypeError(`path argument is required to res.sendFile`);if(typeof e!=`string`)throw TypeError(`path must be a string to res.sendFile`);if(typeof t==`function`&&(r=t,c={}),!c.root&&!p(e))throw TypeError(`path must be absolute or specify root to res.sendFile`);var l=encodeURI(e);c.etag=this.app.enabled(`etag`),sendfile(o,b(i,l,c),c,function(e){if(r)return r(e);if(e&&e.code===`EISDIR`)return s();e&&e.code!==`ECONNABORTED`&&e.syscall!==`write`&&s(e)})},E.download=function download(e,t,r,i){var o=i,s=t,c=r||null;typeof t==`function`?(o=t,s=null,c=null):typeof r==`function`&&(o=r,c=null),typeof t==`object`&&(typeof r==`function`||r===void 0)&&(s=null,c=t);var l={"Content-Disposition":n(s||e)};if(c&&c.headers)for(var u=Object.keys(c.headers),d=0;d<u.length;d++){var p=u[d];p.toLowerCase()!==`content-disposition`&&(l[p]=c.headers[p])}c=Object.create(c),c.headers=l;var m=c.root?e:S(e);return this.sendFile(m,c,o)},E.contentType=E.type=function contentType(e){var t=e.indexOf(`/`)===-1?u.contentType(e)||`application/octet-stream`:e;return this.set(`Content-Type`,t)},E.format=function(e){var t=this.req,n=t.next,i=Object.keys(e).filter(function(e){return e!=="default"}),o=i.length>0?t.accepts(i):!1;return this.vary(`Accept`),o?(this.set(`Content-Type`,g(o).value),e[o](t,this,n)):e.default?e.default(t,this,n):n(r(406,{types:_(i).map(function(e){return e.value})})),this},E.attachment=function attachment(e){return e&&this.type(x(e)),this.set(`Content-Disposition`,n(e)),this},E.append=function append(e,t){var n=this.get(e),r=t;return n&&(r=Array.isArray(n)?n.concat(t):Array.isArray(t)?[n].concat(t):[n,t]),this.set(e,r)},E.set=E.header=function header(e,t){if(arguments.length===2){var n=Array.isArray(t)?t.map(String):String(t);if(e.toLowerCase()===`content-type`){if(Array.isArray(n))throw TypeError(`Content-Type cannot be set to an Array`);n=u.contentType(n)}this.setHeader(e,n)}else for(var r in e)this.set(r,e[r]);return this},E.get=function(e){return this.getHeader(e)},E.clearCookie=function clearCookie(e,t){let n={path:`/`,...t,expires:new Date(1)};return delete n.maxAge,this.cookie(e,``,n)},E.cookie=function(e,t,n){var r={...n},i=this.req.secret,o=r.signed;if(o&&!i)throw Error(`cookieParser("secret") required for signed cookies`);var s=typeof t==`object`?`j:`+JSON.stringify(t):String(t);if(o&&(s=`s:`+h(s,i)),r.maxAge!=null){var c=r.maxAge-0;isNaN(c)||(r.expires=new Date(Date.now()+c),r.maxAge=Math.floor(c/1e3))}return r.path??=`/`,this.append(`Set-Cookie`,y.serialize(e,String(s),r)),this},E.location=function location(e){return this.set(`Location`,o(e))},E.redirect=function redirect(e){var t=e,n,r=302;arguments.length===2&&(r=arguments[0],t=arguments[1]),t||i(`Provide a url argument`),typeof t!=`string`&&i(`Url must be a string`),typeof r!=`number`&&i(`Status must be a number`),t=this.location(t).get(`Location`),this.format({text:function(){n=m.message[r]+`. Redirecting to `+t},html:function(){var e=s(t);n=`<p>`+m.message[r]+`. Redirecting to `+e+`</p>`},default:function(){n=``}}),this.status(r),this.set(`Content-Length`,T.byteLength(n)),this.req.method===`HEAD`?this.end():this.end(n)},E.vary=function(e){return w(this,e),this},E.render=function render(e,t,n){var r=this.req.app,done=n,i=t||{},o=this.req,s=this;typeof t==`function`&&(done=t,i={}),i._locals=s.locals,done||=function(e,t){if(e)return o.next(e);s.send(t)},r.render(e,i,done)};function sendfile(e,t,n,r){var i=!1,o;function onaborted(){if(!i){i=!0;var e=Error(`Request aborted`);e.code=`ECONNABORTED`,r(e)}}function ondirectory(){if(!i){i=!0;var e=Error(`EISDIR, read`);e.code=`EISDIR`,r(e)}}function onerror(e){i||(i=!0,r(e))}function onend(){i||(i=!0,r())}function onfile(){o=!1}function onfinish(e){if(e&&e.code===`ECONNRESET`)return onaborted();if(e)return onerror(e);i||setImmediate(function(){if(o!==!1&&!i){onaborted();return}i||(i=!0,r())})}function onstream(){o=!0}t.on(`directory`,ondirectory),t.on(`end`,onend),t.on(`error`,onerror),t.on(`file`,onfile),t.on(`stream`,onstream),l(e,onfinish),n.headers&&t.on(`headers`,function headers(e){for(var t=n.headers,r=Object.keys(t),i=0;i<r.length;i++){var o=r[i];e.setHeader(o,t[o])}}),t.pipe(e)}function stringify(e,t,n,r){var i=t||n?JSON.stringify(e,t,n):JSON.stringify(e);return r&&typeof i==`string`&&(i=i.replace(/[<>&]/g,function(e){switch(e.charCodeAt(0)){case 60:return`\\u003c`;case 62:return`\\u003e`;case 38:return`\\u0026`;default:return e}})),i}})),Km=__commonJSMin(((e,t)=>{
367
+ var n=zm(),r=sl(),i=tl()(`express`),o=Vd(),s=Hd(),c=(Qp(),__toCommonJS(Jp)),l=Hl(),u=ql(),d=(jr(),__toCommonJS(hr)),p=(jr(),__toCommonJS(hr)).isAbsolute,m=il(),h=Bm().sign,g=xm().normalizeType,_=xm().normalizeTypes,v=xm().setCharset,y=Vm(),b=Hm(),x=d.extname,S=d.resolve,w=Um();let{Buffer:T}=(U(),__toCommonJS(an));var E=Object.create(c.ServerResponse.prototype);t.exports=E,E.status=function status(e){if(!Number.isInteger(e))throw TypeError(`Invalid status code: ${JSON.stringify(e)}. Status code must be an integer.`);if(e<100||e>999)throw RangeError(`Invalid status code: ${JSON.stringify(e)}. Status code must be greater than 99 and less than 1000.`);return this.statusCode=e,this},E.links=function(e){var t=this.get(`Link`)||``;return t&&(t+=`, `),this.set(`Link`,t+Object.keys(e).map(function(t){return Array.isArray(e[t])?e[t].map(function(e){return`<${e}>; rel="${t}"`}).join(`, `):`<${e[t]}>; rel="${t}"`}).join(`, `))},E.send=function send(e){var t=e,n,r=this.req,i,o=this.app;switch(typeof t){case`string`:this.get(`Content-Type`)||this.type(`html`);break;case`boolean`:case`number`:case`object`:if(t===null)t=``;else if(ArrayBuffer.isView(t))this.get(`Content-Type`)||this.type(`bin`);else return this.json(t);break}typeof t==`string`&&(n=`utf8`,i=this.get(`Content-Type`),typeof i==`string`&&this.set(`Content-Type`,v(i,`utf-8`)));var s=o.get(`etag fn`),c=!this.get(`ETag`)&&typeof s==`function`,l;t!==void 0&&(T.isBuffer(t)?l=t.length:!c&&t.length<1e3?l=T.byteLength(t,n):(t=T.from(t,n),n=void 0,l=t.length),this.set(`Content-Length`,l));var u;return c&&l!==void 0&&(u=s(t,n))&&this.set(`ETag`,u),r.fresh&&this.status(304),(this.statusCode===204||this.statusCode===304)&&(this.removeHeader(`Content-Type`),this.removeHeader(`Content-Length`),this.removeHeader(`Transfer-Encoding`),t=``),this.statusCode===205&&(this.set(`Content-Length`,`0`),this.removeHeader(`Transfer-Encoding`),t=``),r.method===`HEAD`?this.end():this.end(t,n),this},E.json=function json(e){var t=this.app,n=t.get(`json escape`),r=stringify(e,t.get(`json replacer`),t.get(`json spaces`),n);return this.get(`Content-Type`)||this.set(`Content-Type`,`application/json`),this.send(r)},E.jsonp=function jsonp(e){var t=this.app,n=t.get(`json escape`),r=stringify(e,t.get(`json replacer`),t.get(`json spaces`),n),i=this.req.query[t.get(`jsonp callback name`)];return this.get(`Content-Type`)||(this.set(`X-Content-Type-Options`,`nosniff`),this.set(`Content-Type`,`application/json`)),Array.isArray(i)&&(i=i[0]),typeof i==`string`&&i.length!==0&&(this.set(`X-Content-Type-Options`,`nosniff`),this.set(`Content-Type`,`text/javascript`),i=i.replace(/[^\[\]\w$.]/g,``),r===void 0?r=``:typeof r==`string`&&(r=r.replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)),r=`/**/ typeof `+i+` === 'function' && `+i+`(`+r+`);`),this.send(r)},E.sendStatus=function sendStatus(e){var t=m.message[e]||String(e);return this.status(e),this.type(`txt`),this.send(t)},E.sendFile=function sendFile(e,t,n){var r=n,i=this.req,o=this,s=i.next,c=t||{};if(!e)throw TypeError(`path argument is required to res.sendFile`);if(typeof e!=`string`)throw TypeError(`path must be a string to res.sendFile`);if(typeof t==`function`&&(r=t,c={}),!c.root&&!p(e))throw TypeError(`path must be absolute or specify root to res.sendFile`);var l=encodeURI(e);c.etag=this.app.enabled(`etag`),sendfile(o,b(i,l,c),c,function(e){if(r)return r(e);if(e&&e.code===`EISDIR`)return s();e&&e.code!==`ECONNABORTED`&&e.syscall!==`write`&&s(e)})},E.download=function download(e,t,r,i){var o=i,s=t,c=r||null;typeof t==`function`?(o=t,s=null,c=null):typeof r==`function`&&(o=r,c=null),typeof t==`object`&&(typeof r==`function`||r===void 0)&&(s=null,c=t);var l={"Content-Disposition":n(s||e)};if(c&&c.headers)for(var u=Object.keys(c.headers),d=0;d<u.length;d++){var p=u[d];p.toLowerCase()!==`content-disposition`&&(l[p]=c.headers[p])}c=Object.create(c),c.headers=l;var m=c.root?e:S(e);return this.sendFile(m,c,o)},E.contentType=E.type=function contentType(e){var t=e.indexOf(`/`)===-1?u.contentType(e)||`application/octet-stream`:e;return this.set(`Content-Type`,t)},E.format=function(e){var t=this.req,n=t.next,i=Object.keys(e).filter(function(e){return e!=="default"}),o=i.length>0?t.accepts(i):!1;return this.vary(`Accept`),o?(this.set(`Content-Type`,g(o).value),e[o](t,this,n)):e.default?e.default(t,this,n):n(r(406,{types:_(i).map(function(e){return e.value})})),this},E.attachment=function attachment(e){return e&&this.type(x(e)),this.set(`Content-Disposition`,n(e)),this},E.append=function append(e,t){var n=this.get(e),r=t;return n&&(r=Array.isArray(n)?n.concat(t):Array.isArray(t)?[n].concat(t):[n,t]),this.set(e,r)},E.set=E.header=function header(e,t){if(arguments.length===2){var n=Array.isArray(t)?t.map(String):String(t);if(e.toLowerCase()===`content-type`){if(Array.isArray(n))throw TypeError(`Content-Type cannot be set to an Array`);n=u.contentType(n)}this.setHeader(e,n)}else for(var r in e)this.set(r,e[r]);return this},E.get=function(e){return this.getHeader(e)},E.clearCookie=function clearCookie(e,t){let n={path:`/`,...t,expires:new Date(1)};return delete n.maxAge,this.cookie(e,``,n)},E.cookie=function(e,t,n){var r={...n},i=this.req.secret,o=r.signed;if(o&&!i)throw Error(`cookieParser("secret") required for signed cookies`);var s=typeof t==`object`?`j:`+JSON.stringify(t):String(t);if(o&&(s=`s:`+h(s,i)),r.maxAge!=null){var c=r.maxAge-0;isNaN(c)||(r.expires=new Date(Date.now()+c),r.maxAge=Math.floor(c/1e3))}return r.path??=`/`,this.append(`Set-Cookie`,y.serialize(e,String(s),r)),this},E.location=function location(e){return this.set(`Location`,o(e))},E.redirect=function redirect(e){var t=e,n,r=302;arguments.length===2&&(r=arguments[0],t=arguments[1]),t||i(`Provide a url argument`),typeof t!=`string`&&i(`Url must be a string`),typeof r!=`number`&&i(`Status must be a number`),t=this.location(t).get(`Location`),this.format({text:function(){n=m.message[r]+`. Redirecting to `+t},html:function(){var e=s(t);n=`<p>`+m.message[r]+`. Redirecting to `+e+`</p>`},default:function(){n=``}}),this.status(r),this.set(`Content-Length`,T.byteLength(n)),this.req.method===`HEAD`?this.end():this.end(n)},E.vary=function(e){return w(this,e),this},E.render=function render(e,t,n){var r=this.req.app,done=n,i=t||{},o=this.req,s=this;typeof t==`function`&&(done=t,i={}),i._locals=s.locals,done||=function(e,t){if(e)return o.next(e);s.send(t)},r.render(e,i,done)};function sendfile(e,t,n,r){var i=!1,o;function onaborted(){if(!i){i=!0;var e=Error(`Request aborted`);e.code=`ECONNABORTED`,r(e)}}function ondirectory(){if(!i){i=!0;var e=Error(`EISDIR, read`);e.code=`EISDIR`,r(e)}}function onerror(e){i||(i=!0,r(e))}function onend(){i||(i=!0,r())}function onfile(){o=!1}function onfinish(e){if(e&&e.code===`ECONNRESET`)return onaborted();if(e)return onerror(e);i||setImmediate(function(){if(o!==!1&&!i){onaborted();return}i||(i=!0,r())})}function onstream(){o=!0}t.on(`directory`,ondirectory),t.on(`end`,onend),t.on(`error`,onerror),t.on(`file`,onfile),t.on(`stream`,onstream),l(e,onfinish),n.headers&&t.on(`headers`,function headers(e){for(var t=n.headers,r=Object.keys(t),i=0;i<r.length;i++){var o=r[i];e.setHeader(o,t[o])}}),t.pipe(e)}function stringify(e,t,n,r){var i=t||n?JSON.stringify(e,t,n):JSON.stringify(e);return r&&typeof i==`string`&&(i=i.replace(/[<>&]/g,function(e){switch(e.charCodeAt(0)){case 60:return`\\u003c`;case 62:return`\\u003e`;case 38:return`\\u0026`;default:return e}})),i}})),Gm=__commonJSMin(((e,t)=>{
368
368
  /*!
369
369
  * serve-static
370
370
  * Copyright(c) 2010 Sencha Inc.
@@ -372,7 +372,7 @@ var n=Bm(),r=sl(),i=tl()(`express`),o=Vd(),s=Hd(),c=($p(),__toCommonJS(Yp)),l=Hl
372
372
  * Copyright(c) 2014-2016 Douglas Christopher Wilson
373
373
  * MIT Licensed
374
374
  */
375
- var n=Vd(),r=Hd(),i=Ud(),o=(jr(),__toCommonJS(hr)).resolve,s=Um(),c=(Vr(),__toCommonJS(Mr));t.exports=serveStatic;function serveStatic(e,t){if(!e)throw TypeError(`root path required`);if(typeof e!=`string`)throw TypeError(`root path must be a string`);var n=Object.create(t||null),r=n.fallthrough!==!1,c=n.redirect!==!1,l=n.setHeaders;if(l&&typeof l!=`function`)throw TypeError(`option setHeaders must be function`);n.maxage=n.maxage||n.maxAge||0,n.root=o(e);var u=c?createRedirectDirectoryListener():createNotFoundDirectoryListener();return function serveStatic(e,t,o){if(e.method!==`GET`&&e.method!==`HEAD`){if(r)return o();t.statusCode=405,t.setHeader(`Allow`,`GET, HEAD`),t.setHeader(`Content-Length`,`0`),t.end();return}var c=!r,d=i.original(e),p=i(e).pathname;p===`/`&&d.pathname.substr(-1)!==`/`&&(p=``);var m=s(e,p,n);m.on(`directory`,u),l&&m.on(`headers`,l),r&&m.on(`file`,function onFile(){c=!0}),m.on(`error`,function error(e){if(c||!(e.statusCode<500)){o(e);return}o()}),m.pipe(t)}}function collapseLeadingSlashes(e){for(var t=0;t<e.length&&e.charCodeAt(t)===47;t++);return t>1?`/`+e.substr(t):e}function createHtmlDocument(e,t){return`<!DOCTYPE html>
375
+ var n=Vd(),r=Hd(),i=Ud(),o=(jr(),__toCommonJS(hr)).resolve,s=Hm(),c=(Vr(),__toCommonJS(Mr));t.exports=serveStatic;function serveStatic(e,t){if(!e)throw TypeError(`root path required`);if(typeof e!=`string`)throw TypeError(`root path must be a string`);var n=Object.create(t||null),r=n.fallthrough!==!1,c=n.redirect!==!1,l=n.setHeaders;if(l&&typeof l!=`function`)throw TypeError(`option setHeaders must be function`);n.maxage=n.maxage||n.maxAge||0,n.root=o(e);var u=c?createRedirectDirectoryListener():createNotFoundDirectoryListener();return function serveStatic(e,t,o){if(e.method!==`GET`&&e.method!==`HEAD`){if(r)return o();t.statusCode=405,t.setHeader(`Allow`,`GET, HEAD`),t.setHeader(`Content-Length`,`0`),t.end();return}var c=!r,d=i.original(e),p=i(e).pathname;p===`/`&&d.pathname.substr(-1)!==`/`&&(p=``);var m=s(e,p,n);m.on(`directory`,u),l&&m.on(`headers`,l),r&&m.on(`file`,function onFile(){c=!0}),m.on(`error`,function error(e){if(c||!(e.statusCode<500)){o(e);return}o()}),m.pipe(t)}}function collapseLeadingSlashes(e){for(var t=0;t<e.length&&e.charCodeAt(t)===47;t++);return t>1?`/`+e.substr(t):e}function createHtmlDocument(e,t){return`<!DOCTYPE html>
376
376
  <html lang="en">
377
377
  <head>
378
378
  <meta charset="utf-8">
@@ -382,7 +382,7 @@ var n=Vd(),r=Hd(),i=Ud(),o=(jr(),__toCommonJS(hr)).resolve,s=Um(),c=(Vr(),__toCo
382
382
  <pre>`+t+`</pre>
383
383
  </body>
384
384
  </html>
385
- `}function createNotFoundDirectoryListener(){return function notFound(){this.error(404)}}function createRedirectDirectoryListener(){return function redirect(e){if(this.hasTrailingSlash()){this.error(404);return}var t=i.original(this.req);t.path=null,t.pathname=collapseLeadingSlashes(t.pathname+`/`);var o=n(c.format(t)),s=createHtmlDocument(`Redirecting`,`Redirecting to `+r(o));e.statusCode=301,e.setHeader(`Content-Type`,`text/html; charset=UTF-8`),e.setHeader(`Content-Length`,Buffer.byteLength(s)),e.setHeader(`Content-Security-Policy`,`default-src 'none'`),e.setHeader(`X-Content-Type-Options`,`nosniff`),e.setHeader(`Location`,o),e.end(s)}}})),qm=__commonJSMin(((e,t)=>{
385
+ `}function createNotFoundDirectoryListener(){return function notFound(){this.error(404)}}function createRedirectDirectoryListener(){return function redirect(e){if(this.hasTrailingSlash()){this.error(404);return}var t=i.original(this.req);t.path=null,t.pathname=collapseLeadingSlashes(t.pathname+`/`);var o=n(c.format(t)),s=createHtmlDocument(`Redirecting`,`Redirecting to `+r(o));e.statusCode=301,e.setHeader(`Content-Type`,`text/html; charset=UTF-8`),e.setHeader(`Content-Length`,Buffer.byteLength(s)),e.setHeader(`Content-Security-Policy`,`default-src 'none'`),e.setHeader(`X-Content-Type-Options`,`nosniff`),e.setHeader(`Location`,o),e.end(s)}}})),Km=__commonJSMin(((e,t)=>{
386
386
  /*!
387
387
  * express
388
388
  * Copyright(c) 2009-2013 TJ Holowaychuk
@@ -390,7 +390,7 @@ var n=Vd(),r=Hd(),i=Ud(),o=(jr(),__toCommonJS(hr)).resolve,s=Um(),c=(Vr(),__toCo
390
390
  * Copyright(c) 2014-2015 Douglas Christopher Wilson
391
391
  * MIT Licensed
392
392
  */
393
- var n=Rd(),r=zd().EventEmitter,i=Bd(),o=Am(),s=km(),c=zm(),l=Gm();e=t.exports=createApplication;function createApplication(){var app=function(e,t,n){app.handle(e,t,n)};return i(app,r.prototype,!1),i(app,o,!1),app.request=Object.create(c,{app:{configurable:!0,enumerable:!0,writable:!0,value:app}}),app.response=Object.create(l,{app:{configurable:!0,enumerable:!0,writable:!0,value:app}}),app.init(),app}e.application=o,e.request=c,e.response=l,e.Route=s.Route,e.Router=s,e.json=n.json,e.raw=n.raw,e.static=Km(),e.text=n.text,e.urlencoded=n.urlencoded})),Jm=__toESM(__commonJSMin(((e,t)=>{
393
+ var n=Rd(),r=zd().EventEmitter,i=Bd(),o=km(),s=Om(),c=Rm(),l=Wm();e=t.exports=createApplication;function createApplication(){var app=function(e,t,n){app.handle(e,t,n)};return i(app,r.prototype,!1),i(app,o,!1),app.request=Object.create(c,{app:{configurable:!0,enumerable:!0,writable:!0,value:app}}),app.response=Object.create(l,{app:{configurable:!0,enumerable:!0,writable:!0,value:app}}),app.init(),app}e.application=o,e.request=c,e.response=l,e.Route=s.Route,e.Router=s,e.json=n.json,e.raw=n.raw,e.static=Gm(),e.text=n.text,e.urlencoded=n.urlencoded})),qm=__toESM(__commonJSMin(((e,t)=>{
394
394
  /*!
395
395
  * express
396
396
  * Copyright(c) 2009-2013 TJ Holowaychuk
@@ -398,14 +398,14 @@ var n=Rd(),r=zd().EventEmitter,i=Bd(),o=Am(),s=km(),c=zm(),l=Gm();e=t.exports=cr
398
398
  * Copyright(c) 2014-2015 Douglas Christopher Wilson
399
399
  * MIT Licensed
400
400
  */
401
- t.exports=qm()}))());const Ym=[{id:1,slug:`hello-gjs`,title:`Hello, GJS!`,author:`Pascal`,date:`2026-04-01`,excerpt:`Running Express.js natively on Linux via GJS — no Node.js required.`,content:"This blog is served by a real Express.js application — the same code you would\nwrite for Node.js. The difference: it's running inside GJS, the GNOME JavaScript\nruntime, backed by GLib, Gio and Soup. No Node binary, no V8 — just SpiderMonkey\nand native Linux libraries.\n\nWith `@gjsify/node-globals` and the `@gjsify/*` package set, the full Node.js\nAPI surface is available: `fs`, `net`, `http`, `crypto`, `stream`, `events`,\nand many more. That means your existing npm ecosystem works out of the box."},{id:2,slug:`why-gjsify`,title:`Why GJSify?`,author:`Pascal`,date:`2026-04-03`,excerpt:`Bringing the full TypeScript ecosystem to the GNOME JavaScript runtime.`,content:`GJS is fantastic for writing GNOME applications, but historically you had to
401
+ t.exports=Km()}))());const Jm=[{id:1,slug:`hello-gjs`,title:`Hello, GJS!`,author:`Pascal`,date:`2026-04-01`,excerpt:`Running Express.js natively on Linux via GJS — no Node.js required.`,content:"This blog is served by a real Express.js application — the same code you would\nwrite for Node.js. The difference: it's running inside GJS, the GNOME JavaScript\nruntime, backed by GLib, Gio and Soup. No Node binary, no V8 — just SpiderMonkey\nand native Linux libraries.\n\nWith `@gjsify/node-globals` and the `@gjsify/*` package set, the full Node.js\nAPI surface is available: `fs`, `net`, `http`, `crypto`, `stream`, `events`,\nand many more. That means your existing npm ecosystem works out of the box."},{id:2,slug:`why-gjsify`,title:`Why GJSify?`,author:`Pascal`,date:`2026-04-03`,excerpt:`Bringing the full TypeScript ecosystem to the GNOME JavaScript runtime.`,content:`GJS is fantastic for writing GNOME applications, but historically you had to
402
402
  choose between the GObject world and the rich npm ecosystem. GJSify bridges
403
403
  that gap by implementing the Node.js and Web APIs on top of native GNOME
404
404
  libraries — so a package like Express, Koa or Hono Just Works, and you can
405
405
  still reach into GTK, Cairo or WebKit whenever you need to.
406
406
 
407
407
  The trade-off is no longer "Node.js or GNOME" — you can have both in the
408
- same application.`},{id:3,slug:`express-on-soup`,title:`Express on Soup 3.0`,author:`Pascal`,date:`2026-04-05`,excerpt:`How Express listens on a port when there is no V8 event loop.`,content:"The magic trick is `@gjsify/http`: it implements Node's `http` module on top\nof `Soup.Server`. When Express calls `app.listen(3000)`, GJSify starts a\nGLib MainLoop under the hood and wires Soup's request signals into Node-style\n`IncomingMessage` / `ServerResponse` objects.\n\nThe result: Express middleware, routing, template engines and the rest of the\necosystem simply work — on the GNOME stack."}];N(),jr(),Vr();const Xm=br(Cr(fileURLToPath(import.meta.url)),`public`),Zm=parseInt(process.env.PORT||`3000`,10),Qm=(0,Jm.default)();function escapeHtml(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}function renderContent(e){return e.split(/\n\n+/).map(e=>`<p>${escapeHtml(e.trim()).replace(/\n/g,`<br />`)}</p>`).join(`
408
+ same application.`},{id:3,slug:`express-on-soup`,title:`Express on Soup 3.0`,author:`Pascal`,date:`2026-04-05`,excerpt:`How Express listens on a port when there is no V8 event loop.`,content:"The magic trick is `@gjsify/http`: it implements Node's `http` module on top\nof `Soup.Server`. When Express calls `app.listen(3000)`, GJSify starts a\nGLib MainLoop under the hood and wires Soup's request signals into Node-style\n`IncomingMessage` / `ServerResponse` objects.\n\nThe result: Express middleware, routing, template engines and the rest of the\necosystem simply work — on the GNOME stack."}];N(),jr(),Vr();const Ym=br(Cr(fileURLToPath(import.meta.url)),`public`),Xm=parseInt(process.env.PORT||`3000`,10),Zm=(0,qm.default)();function escapeHtml(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}function renderContent(e){return e.split(/\n\n+/).map(e=>`<p>${escapeHtml(e.trim()).replace(/\n/g,`<br />`)}</p>`).join(`
409
409
  `)}function renderPage(e,t){return`<!DOCTYPE html>
410
410
  <html lang="en">
411
411
  <head>
@@ -431,7 +431,7 @@ ${t}
431
431
  </footer>
432
432
  <script src="/app.js" defer><\/script>
433
433
  </body>
434
- </html>`}Qm.use(Jm.json()),Qm.use((e,t,n)=>{let r=new Date().toISOString().slice(11,19);M.log(`[${r}] ${e.method} ${e.url}`),n()}),Qm.get(`/api/posts`,(e,t)=>{t.json({count:Ym.length,posts:Ym.map(({id:e,slug:t,title:n,author:r,date:i,excerpt:o})=>({id:e,slug:t,title:n,author:r,date:i,excerpt:o}))})}),Qm.get(`/api/posts/:slug`,(e,t)=>{let n=Ym.find(t=>t.slug===e.params.slug);if(!n){t.status(404).json({error:`Post not found`});return}t.json(n)}),Qm.get(`/api/runtime`,(e,t)=>{t.json({runtime:Zc,platform:process.platform,version:process.version,time:new Date().toISOString()})}),Qm.get(`/posts/:slug`,(e,t)=>{let n=Ym.find(t=>t.slug===e.params.slug);if(!n){t.status(404).send(renderPage(`Post not found`,`
434
+ </html>`}Zm.use(qm.json()),Zm.use((e,t,n)=>{let r=new Date().toISOString().slice(11,19);M.log(`[${r}] ${e.method} ${e.url}`),n()}),Zm.get(`/api/posts`,(e,t)=>{t.json({count:Jm.length,posts:Jm.map(({id:e,slug:t,title:n,author:r,date:i,excerpt:o})=>({id:e,slug:t,title:n,author:r,date:i,excerpt:o}))})}),Zm.get(`/api/posts/:slug`,(e,t)=>{let n=Jm.find(t=>t.slug===e.params.slug);if(!n){t.status(404).json({error:`Post not found`});return}t.json(n)}),Zm.get(`/api/runtime`,(e,t)=>{t.json({runtime:Zc,platform:process.platform,version:process.version,time:new Date().toISOString()})}),Zm.get(`/posts/:slug`,(e,t)=>{let n=Jm.find(t=>t.slug===e.params.slug);if(!n){t.status(404).send(renderPage(`Post not found`,`
435
435
  <main class="post-detail">
436
436
  <a href="/" class="back-link">← Back to posts</a>
437
437
  <p class="loading">Post not found.</p>
@@ -448,4 +448,4 @@ ${t}
448
448
  ${renderContent(n.content)}
449
449
  </div>
450
450
  </article>
451
- </main>`))}),Qm.use(Jm.static(Xm)),Qm.listen(Zm,()=>{M.log(``),M.log(` Express.js blog running on ${Zc}`),M.log(``),M.log(` ➜ Local: http://localhost:${Zm}/`),M.log(` ➜ API: http://localhost:${Zm}/api/posts`),M.log(``),M.log(` Press Ctrl+C to stop`),M.log(``)});const $m=globalThis.process,eh=Number($m?.exitCode);Number.isInteger(eh)&&eh!==0&&$m.exit(eh);
451
+ </main>`))}),Zm.use(qm.static(Ym)),Zm.listen(Xm,()=>{M.log(``),M.log(` Express.js blog running on ${Zc}`),M.log(``),M.log(` ➜ Local: http://localhost:${Xm}/`),M.log(` ➜ API: http://localhost:${Xm}/api/posts`),M.log(``),M.log(` Press Ctrl+C to stop`),M.log(``)});const Qm=globalThis.process,$m=Number(Qm?.exitCode);Number.isInteger($m)&&$m!==0&&Qm.exit($m);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/example-node-express-webserver",
3
- "version": "0.55.0",
3
+ "version": "0.56.0",
4
4
  "description": "Express.js blog showcase with JSON API and static frontend — a real Node.js web app running on GJS",
5
5
  "main": "dist/index.gjs.js",
6
6
  "type": "module",
@@ -21,12 +21,12 @@
21
21
  "build:public": "gjsify copy src/public dist/public"
22
22
  },
23
23
  "dependencies": {
24
- "@gjsify/http-soup-bridge": "^0.55.0"
24
+ "@gjsify/http-soup-bridge": "^0.56.0"
25
25
  },
26
26
  "devDependencies": {
27
- "@gjsify/cli": "^0.55.0",
28
- "@gjsify/node-globals": "^0.55.0",
29
- "@gjsify/runtime": "^0.55.0",
27
+ "@gjsify/cli": "^0.56.0",
28
+ "@gjsify/node-globals": "^0.56.0",
29
+ "@gjsify/runtime": "^0.56.0",
30
30
  "@types/express": "^5.0.6",
31
31
  "@types/node": "^25.9.2",
32
32
  "express": "^5.2.1",