{"size": 23012, "ext": "js", "max_stars_repo_path": "nuxt-example/.vercel_build_output/functions/node/_nuxt/chunks/runtime/node.js", "max_stars_repo_name": "moovweb/xdn-examples", "max_stars_repo_stars_event_min_datetime": "2020-07-27T04:29:37.000Z", "max_stars_repo_stars_event_max_datetime": "2020-07-27T04:29:37.000Z", "max_issues_repo_path": "nuxt-example/.vercel_build_output/functions/node/_nuxt/chunks/runtime/node.js", "max_issues_repo_name": "moovweb/xdn-examples", "max_issues_repo_issues_event_min_datetime": "2020-05-14T17:22:19.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-19T06:29:34.000Z", "max_forks_repo_path": "nuxt-example/.vercel_build_output/functions/node/_nuxt/chunks/runtime/node.js", "max_forks_repo_name": "moovweb/xdn-examples", "max_forks_repo_forks_event_min_datetime": "2020-12-01T16:18:27.000Z", "max_forks_repo_forks_event_max_datetime": "2021-04-04T22:54:12.000Z"}
{"max_stars_count": 1, "max_issues_count": 31, "max_forks_count": 2, "avg_line_length": 11506.0, "max_line_length": 23011, "alphanum_fraction": 0.721493134}
"use strict";global.__timing__.logStart("import:functions/node/_nuxt/chunks/runtime/node");const e=require("events"),t=require("stream"),r=require("http"),o=require("url"),n=require("https"),s=require("zlib");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const i=_interopDefaultLegacy(e),a=_interopDefaultLegacy(t),u=_interopDefaultLegacy(r),l=_interopDefaultLegacy(o),c=_interopDefaultLegacy(n),d=_interopDefaultLegacy(s),h=global.__timing__||{start:()=>0,end:()=>0,metrics:[]};function runStackPromise(e,t,r){return new Promise(((o,n)=>{!function(e,t,r,o){let n=0;function next(s){const i=r[n++];if(!i||s)return o(s);const a=e.originalUrl;if(!a.toLowerCase().startsWith(i.route.toLowerCase()))return next(s);e.url=a.substr(i.route.length),"/"!==e.url[0]&&(e.url="/"+e.url);try{let r,n;if(i.lazy?r=i.handle().then((r=>(r=r.default||r,n=isFinal(r),r(e,t,next)))):(n=isFinal(i.handle),r=i.handle(e,t,next)),r&&r.then)r.then((()=>(n?o:next)())).catch(o);else if(n)return o(s)}catch(e){next(e||s)}}e.originalUrl=e.originalUrl||e.url,next()}(e,t,r,(e=>e?n(e):o()))}))}function isFinal(e){return e.length<3||"function"==typeof e.handle}const{EventEmitter:f}=i.default;var p=class extends f{constructor(e){super(),this.url=e.url||"/",this.method=e.method||"GET",this.headers=e.headers||{},this.headers.host=this.headers.host||this.headers.Host||e.host||null,this.connection={encrypted:"https"===e.protocol},this.body=e.body||null,this.statusCode=null,this.statusMessage=null,this.aborted=!1,this.upgrade=!1,this.complete=!0,this.trailers={},this.rawTrailers=[],this.httpVersion=1.1,this.httpVersionMajor=1,this.httpVersionMinor=1}get rawHeaders(){const e=[];for(const t in this.headers)e.push(t,this.headers[t]);return e}},y=class extends f{constructor(){super(),this.headers={},this.headersSent=!1,this.statusCode=200,this.statusMessage="",this._sent=!1,this._data=void 0,this._encoding=void 0,this._endCB=void 0,this._consume=this._consume.bind(this)}_ensureNotSent(){if(this._sent)throw new Error("response is already sent")}_ensureNotHead(){if(this.headersSent)throw new Error("headers already already sent")}_consume(){return this._endCB&&this._endCB(),{statusCode:this.statusCode,statusMessage:this.statusMessage,headers:this.headers,data:this._data}}write(e,t,r){this._ensureNotSent(),e&&(this._data=e.toString()),t&&(this._encoding=t),r&&(this._endCB=r)}end(e,t,r){this._ensureNotSent(),e?this.write(e,t,r):r(),this.headersSent=!0,this._sent=!0}flushHeaders(){}getHeader(e){return e=e.toLowerCase(),this.headers[e]}getHeaderNames(){return Object.keys(this.headers)}getHeaders(){return this.headers}hasHeader(e){return(e=e.toLowerCase())in this.headers}removeHeader(e){this._ensureNotHead(),e=e.toLowerCase(),delete this.headers[e]}setHeader(e,t){this._ensureNotHead(),e=e.toLowerCase(),this.headers[e]=t}writeHead(e,t,r){if(this._ensureNotHead(),e&&(this.statusCode=e),t&&(this.statusMessage=t),r)for(const e in r)this.setHeader(e,r[e]);this.headersSent=!0}};const b=[{route:"/",handle:function(e,t,r){const o=h.start(),n=t.end;t.end=(e,r,s)=>{const i=[["response",h.end(o)],...h.metrics].map((e=>`${e[0]};val=${e[1]}`)).join(", ");t.headersSent||t.setHeader("Server-Timing",i),n.call(t,e,r,s)},r()}},{route:"/",handle:()=>Promise.resolve().then((function(){return require("./index.js")})).then((e=>e.renderMiddleware)),lazy:!0}];function handleRequest(e){return e.req=e.req||new p(e),e.res=e.res||new y,e.req.ctx=e,runStackPromise(e.req,e.res,b).then((()=>e.res))}const m=a.default.Readable,g=Symbol("buffer"),w=Symbol("type");class Blob{constructor(){this[w]="";const e=arguments[0],t=arguments[1],r=[];let o=0;if(e){const t=e,n=Number(t.length);for(let e=0;e<n;e++){const n=t[e];let s;s=n instanceof Buffer?n:ArrayBuffer.isView(n)?Buffer.from(n.buffer,n.byteOffset,n.byteLength):n instanceof ArrayBuffer?Buffer.from(n):n instanceof Blob?n[g]:Buffer.from("string"==typeof n?n:String(n)),o+=s.length,r.push(s)}}this[g]=Buffer.concat(r);let n=t&&void 0!==t.type&&String(t.type).toLowerCase();n&&!/[^\u0020-\u007E]/.test(n)&&(this[w]=n)}get size(){return this[g].length}get type(){return this[w]}text(){return Promise.resolve(this[g].toString())}arrayBuffer(){const e=this[g],t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return Promise.resolve(t)}stream(){const e=new m;return e._read=function(){},e.push(this[g]),e.push(null),e}toString(){return"[object Blob]"}slice(){const e=this.size,t=arguments[0],r=arguments[1];let o,n;o=void 0===t?0:t<0?Math.max(e+t,0):Math.min(t,e),n=void 0===r?e:r<0?Math.max(e+r,0):Math.min(r,e);const s=Math.max(n-o,0),i=this[g].slice(o,o+s),a=new Blob([],{type:arguments[2]});return a[g]=i,a}}function FetchError(e,t,r){Error.call(this,e),this.message=e,this.type=t,r&&(this.code=this.errno=r.code),Error.captureStackTrace(this,this.constructor)}let v;Object.defineProperties(Blob.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}}),Object.defineProperty(Blob.prototype,Symbol.toStringTag,{value:"Blob",writable:!1,enumerable:!1,configurable:!0}),FetchError.prototype=Object.create(Error.prototype),FetchError.prototype.constructor=FetchError,FetchError.prototype.name="FetchError";try{v={}.convert}catch(e){}const B=Symbol("Body internals"),E=a.default.PassThrough;function Body(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r.size;let n=void 0===o?0:o;var s=r.timeout;let i=void 0===s?0:s;null==e?e=null:isURLSearchParams(e)?e=Buffer.from(e.toString()):isBlob(e)||Buffer.isBuffer(e)||("[object ArrayBuffer]"===Object.prototype.toString.call(e)?e=Buffer.from(e):ArrayBuffer.isView(e)?e=Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof a.default||(e=Buffer.from(String(e)))),this[B]={body:e,disturbed:!1,error:null},this.size=n,this.timeout=i,e instanceof a.default&&e.on("error",(function(e){const r="AbortError"===e.name?e:new FetchError(`Invalid response body while trying to fetch ${t.url}: ${e.message}`,"system",e);t[B].error=r}))}function consumeBody(){var e=this;if(this[B].disturbed)return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`));if(this[B].disturbed=!0,this[B].error)return Body.Promise.reject(this[B].error);let t=this.body;if(null===t)return Body.Promise.resolve(Buffer.alloc(0));if(isBlob(t)&&(t=t.stream()),Buffer.isBuffer(t))return Body.Promise.resolve(t);if(!(t instanceof a.default))return Body.Promise.resolve(Buffer.alloc(0));let r=[],o=0,n=!1;return new Body.Promise((function(s,i){let a;e.timeout&&(a=setTimeout((function(){n=!0,i(new FetchError(`Response timeout while trying to fetch ${e.url} (over ${e.timeout}ms)`,"body-timeout"))}),e.timeout)),t.on("error",(function(t){"AbortError"===t.name?(n=!0,i(t)):i(new FetchError(`Invalid response body while trying to fetch ${e.url}: ${t.message}`,"system",t))})),t.on("data",(function(t){if(!n&&null!==t){if(e.size&&o+t.length>e.size)return n=!0,void i(new FetchError(`content size at ${e.url} over limit: ${e.size}`,"max-size"));o+=t.length,r.push(t)}})),t.on("end",(function(){if(!n){clearTimeout(a);try{s(Buffer.concat(r,o))}catch(t){i(new FetchError(`Could not create Buffer from response body for ${e.url}: ${t.message}`,"system",t))}}}))}))}function isURLSearchParams(e){return"object"==typeof e&&"function"==typeof e.append&&"function"==typeof e.delete&&"function"==typeof e.get&&"function"==typeof e.getAll&&"function"==typeof e.has&&"function"==typeof e.set&&("URLSearchParams"===e.constructor.name||"[object URLSearchParams]"===Object.prototype.toString.call(e)||"function"==typeof e.sort)}function isBlob(e){return"object"==typeof e&&"function"==typeof e.arrayBuffer&&"string"==typeof e.type&&"function"==typeof e.stream&&"function"==typeof e.constructor&&"string"==typeof e.constructor.name&&/^(Blob|File)$/.test(e.constructor.name)&&/^(Blob|File)$/.test(e[Symbol.toStringTag])}function clone(e){let t,r,o=e.body;if(e.bodyUsed)throw new Error("cannot clone body after it is used");return o instanceof a.default&&"function"!=typeof o.getBoundary&&(t=new E,r=new E,o.pipe(t),o.pipe(r),e[B].body=t,o=r),o}function extractContentType(e){return null===e?null:"string"==typeof e?"text/plain;charset=UTF-8":isURLSearchParams(e)?"application/x-www-form-urlencoded;charset=UTF-8":isBlob(e)?e.type||null:Buffer.isBuffer(e)||"[object ArrayBuffer]"===Object.prototype.toString.call(e)||ArrayBuffer.isView(e)?null:"function"==typeof e.getBoundary?`multipart/form-data;boundary=${e.getBoundary()}`:e instanceof a.default?null:"text/plain;charset=UTF-8"}function getTotalBytes(e){const t=e.body;return null===t?0:isBlob(t)?t.size:Buffer.isBuffer(t)?t.length:t&&"function"==typeof t.getLengthSync&&(t._lengthRetrievers&&0==t._lengthRetrievers.length||t.hasKnownLength&&t.hasKnownLength())?t.getLengthSync():null}Body.prototype={get body(){return this[B].body},get bodyUsed(){return this[B].disturbed},arrayBuffer(){return consumeBody.call(this).then((function(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}))},blob(){let e=this.headers&&this.headers.get("content-type")||"";return consumeBody.call(this).then((function(t){return Object.assign(new Blob([],{type:e.toLowerCase()}),{[g]:t})}))},json(){var e=this;return consumeBody.call(this).then((function(t){try{return JSON.parse(t.toString())}catch(t){return Body.Promise.reject(new FetchError(`invalid json response body at ${e.url} reason: ${t.message}`,"invalid-json"))}}))},text(){return consumeBody.call(this).then((function(e){return e.toString()}))},buffer(){return consumeBody.call(this)},textConverted(){var e=this;return consumeBody.call(this).then((function(t){return function(e,t){if("function"!=typeof v)throw new Error("The package `encoding` must be installed to use the textConverted() function");const r=t.get("content-type");let o,n,s="utf-8";r&&(o=/charset=([^;]*)/i.exec(r));n=e.slice(0,1024).toString(),!o&&n&&(o=/<meta.+?charset=(['"])(.+?)\1/i.exec(n));!o&&n&&(o=/<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(n),o||(o=/<meta[\s]+?content=(['"])(.+?)\1[\s]+?http-equiv=(['"])content-type\3/i.exec(n),o&&o.pop()),o&&(o=/charset=(.*)/i.exec(o.pop())));!o&&n&&(o=/<\?xml.+?encoding=(['"])(.+?)\1/i.exec(n));o&&(s=o.pop(),"gb2312"!==s&&"gbk"!==s||(s="gb18030"));return v(e,"UTF-8",s).toString()}(t,e.headers)}))}},Object.defineProperties(Body.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0}}),Body.mixIn=function(e){for(const t of Object.getOwnPropertyNames(Body.prototype))if(!(t in e)){const r=Object.getOwnPropertyDescriptor(Body.prototype,t);Object.defineProperty(e,t,r)}},Body.Promise=global.Promise;const S=/[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/,T=/[^\t\x20-\x7e\x80-\xff]/;function validateName(e){if(e=`${e}`,S.test(e)||""===e)throw new TypeError(`${e} is not a legal HTTP header name`)}function validateValue(e){if(e=`${e}`,T.test(e))throw new TypeError(`${e} is not a legal HTTP header value`)}function find(e,t){t=t.toLowerCase();for(const r in e)if(r.toLowerCase()===t)return r}const x=Symbol("map");class Headers{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;if(this[x]=Object.create(null),e instanceof Headers){const t=e.raw(),r=Object.keys(t);for(const e of r)for(const r of t[e])this.append(e,r)}else if(null==e);else{if("object"!=typeof e)throw new TypeError("Provided initializer must be an object");{const t=e[Symbol.iterator];if(null!=t){if("function"!=typeof t)throw new TypeError("Header pairs must be iterable");const r=[];for(const t of e){if("object"!=typeof t||"function"!=typeof t[Symbol.iterator])throw new TypeError("Each header pair must be iterable");r.push(Array.from(t))}for(const e of r){if(2!==e.length)throw new TypeError("Each header pair must be a name/value tuple");this.append(e[0],e[1])}}else for(const t of Object.keys(e)){const r=e[t];this.append(t,r)}}}}get(e){validateName(e=`${e}`);const t=find(this[x],e);return void 0===t?null:this[x][t].join(", ")}forEach(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=getHeaders(this),o=0;for(;o<r.length;){var n=r[o];const s=n[0],i=n[1];e.call(t,i,s,this),r=getHeaders(this),o++}}set(e,t){t=`${t}`,validateName(e=`${e}`),validateValue(t);const r=find(this[x],e);this[x][void 0!==r?r:e]=[t]}append(e,t){t=`${t}`,validateName(e=`${e}`),validateValue(t);const r=find(this[x],e);void 0!==r?this[x][r].push(t):this[x][e]=[t]}has(e){return validateName(e=`${e}`),void 0!==find(this[x],e)}delete(e){validateName(e=`${e}`);const t=find(this[x],e);void 0!==t&&delete this[x][t]}raw(){return this[x]}keys(){return createHeadersIterator(this,"key")}values(){return createHeadersIterator(this,"value")}[Symbol.iterator](){return createHeadersIterator(this,"key+value")}}function getHeaders(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"key+value";const r=Object.keys(e[x]).sort();return r.map("key"===t?function(e){return e.toLowerCase()}:"value"===t?function(t){return e[x][t].join(", ")}:function(t){return[t.toLowerCase(),e[x][t].join(", ")]})}Headers.prototype.entries=Headers.prototype[Symbol.iterator],Object.defineProperty(Headers.prototype,Symbol.toStringTag,{value:"Headers",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(Headers.prototype,{get:{enumerable:!0},forEach:{enumerable:!0},set:{enumerable:!0},append:{enumerable:!0},has:{enumerable:!0},delete:{enumerable:!0},keys:{enumerable:!0},values:{enumerable:!0},entries:{enumerable:!0}});const _=Symbol("internal");function createHeadersIterator(e,t){const r=Object.create(j);return r[_]={target:e,kind:t,index:0},r}const j=Object.setPrototypeOf({next(){if(!this||Object.getPrototypeOf(this)!==j)throw new TypeError("Value of `this` is not a HeadersIterator");var e=this[_];const t=e.target,r=e.kind,o=e.index,n=getHeaders(t,r);return o>=n.length?{value:void 0,done:!0}:(this[_].index=o+1,{value:n[o],done:!1})}},Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));function exportNodeCompatibleHeaders(e){const t=Object.assign({__proto__:null},e[x]),r=find(e[x],"Host");return void 0!==r&&(t[r]=t[r][0]),t}Object.defineProperty(j,Symbol.toStringTag,{value:"HeadersIterator",writable:!1,enumerable:!1,configurable:!0});const R=Symbol("Response internals"),H=u.default.STATUS_CODES;class Response{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Body.call(this,e,t);const r=t.status||200,o=new Headers(t.headers);if(null!=e&&!o.has("Content-Type")){const t=extractContentType(e);t&&o.append("Content-Type",t)}this[R]={url:t.url,status:r,statusText:t.statusText||H[r],headers:o,counter:t.counter}}get url(){return this[R].url||""}get status(){return this[R].status}get ok(){return this[R].status>=200&&this[R].status<300}get redirected(){return this[R].counter>0}get statusText(){return this[R].statusText}get headers(){return this[R].headers}clone(){return new Response(clone(this),{url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected})}}Body.mixIn(Response.prototype),Object.defineProperties(Response.prototype,{url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}}),Object.defineProperty(Response.prototype,Symbol.toStringTag,{value:"Response",writable:!1,enumerable:!1,configurable:!0});const P=Symbol("Request internals"),C=l.default.parse,O=l.default.format,L="destroy"in a.default.Readable.prototype;function isRequest(e){return"object"==typeof e&&"object"==typeof e[P]}class Request{constructor(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};isRequest(e)?t=C(e.url):(t=e&&e.href?C(e.href):C(`${e}`),e={});let o=r.method||e.method||"GET";if(o=o.toUpperCase(),(null!=r.body||isRequest(e)&&null!==e.body)&&("GET"===o||"HEAD"===o))throw new TypeError("Request with GET/HEAD method cannot have body");let n=null!=r.body?r.body:isRequest(e)&&null!==e.body?clone(e):null;Body.call(this,n,{timeout:r.timeout||e.timeout||0,size:r.size||e.size||0});const s=new Headers(r.headers||e.headers||{});if(null!=n&&!s.has("Content-Type")){const e=extractContentType(n);e&&s.append("Content-Type",e)}let i=isRequest(e)?e.signal:null;if("signal"in r&&(i=r.signal),null!=i&&!function(e){const t=e&&"object"==typeof e&&Object.getPrototypeOf(e);return!(!t||"AbortSignal"!==t.constructor.name)}(i))throw new TypeError("Expected signal to be an instanceof AbortSignal");this[P]={method:o,redirect:r.redirect||e.redirect||"follow",headers:s,parsedURL:t,signal:i},this.follow=void 0!==r.follow?r.follow:void 0!==e.follow?e.follow:20,this.compress=void 0!==r.compress?r.compress:void 0===e.compress||e.compress,this.counter=r.counter||e.counter||0,this.agent=r.agent||e.agent}get method(){return this[P].method}get url(){return O(this[P].parsedURL)}get headers(){return this[P].headers}get redirect(){return this[P].redirect}get signal(){return this[P].signal}clone(){return new Request(this)}}function AbortError(e){Error.call(this,e),this.type="aborted",this.message=e,Error.captureStackTrace(this,this.constructor)}Body.mixIn(Request.prototype),Object.defineProperty(Request.prototype,Symbol.toStringTag,{value:"Request",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(Request.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0}}),AbortError.prototype=Object.create(Error.prototype),AbortError.prototype.constructor=AbortError,AbortError.prototype.name="AbortError";const q=a.default.PassThrough,$=l.default.resolve;function fetch(e,t){if(!fetch.Promise)throw new Error("native promise missing, set fetch.Promise to your favorite alternative");return Body.Promise=fetch.Promise,new fetch.Promise((function(r,o){const n=new Request(e,t),s=function(e){const t=e[P].parsedURL,r=new Headers(e[P].headers);if(r.has("Accept")||r.set("Accept","*/*"),!t.protocol||!t.hostname)throw new TypeError("Only absolute URLs are supported");if(!/^https?:$/.test(t.protocol))throw new TypeError("Only HTTP(S) protocols are supported");if(e.signal&&e.body instanceof a.default.Readable&&!L)throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8");let o=null;if(null==e.body&&/^(POST|PUT)$/i.test(e.method)&&(o="0"),null!=e.body){const t=getTotalBytes(e);"number"==typeof t&&(o=String(t))}o&&r.set("Content-Length",o),r.has("User-Agent")||r.set("User-Agent","node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"),e.compress&&!r.has("Accept-Encoding")&&r.set("Accept-Encoding","gzip,deflate");let n=e.agent;return"function"==typeof n&&(n=n(t)),r.has("Connection")||n||r.set("Connection","close"),Object.assign({},t,{method:e.method,headers:exportNodeCompatibleHeaders(r),agent:n})}(n),i=("https:"===s.protocol?c.default:u.default).request,l=n.signal;let h=null;const abort=function(){let e=new AbortError("The user aborted a request.");o(e),n.body&&n.body instanceof a.default.Readable&&n.body.destroy(e),h&&h.body&&h.body.emit("error",e)};if(l&&l.aborted)return void abort();const abortAndFinalize=function(){abort(),finalize()},f=i(s);let p;function finalize(){f.abort(),l&&l.removeEventListener("abort",abortAndFinalize),clearTimeout(p)}l&&l.addEventListener("abort",abortAndFinalize),n.timeout&&f.once("socket",(function(e){p=setTimeout((function(){o(new FetchError(`network timeout at: ${n.url}`,"request-timeout")),finalize()}),n.timeout)})),f.on("error",(function(e){o(new FetchError(`request to ${n.url} failed, reason: ${e.message}`,"system",e)),finalize()})),f.on("response",(function(e){clearTimeout(p);const t=function(e){const t=new Headers;for(const r of Object.keys(e))if(!S.test(r))if(Array.isArray(e[r]))for(const o of e[r])T.test(o)||(void 0===t[x][r]?t[x][r]=[o]:t[x][r].push(o));else T.test(e[r])||(t[x][r]=[e[r]]);return t}(e.headers);if(fetch.isRedirect(e.statusCode)){const s=t.get("Location"),i=null===s?null:$(n.url,s);switch(n.redirect){case"error":return o(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${n.url}`,"no-redirect")),void finalize();case"manual":if(null!==i)try{t.set("Location",i)}catch(e){o(e)}break;case"follow":if(null===i)break;if(n.counter>=n.follow)return o(new FetchError(`maximum redirect reached at: ${n.url}`,"max-redirect")),void finalize();const s={headers:new Headers(n.headers),follow:n.follow,counter:n.counter+1,agent:n.agent,compress:n.compress,method:n.method,body:n.body,signal:n.signal,timeout:n.timeout,size:n.size};return 303!==e.statusCode&&n.body&&null===getTotalBytes(n)?(o(new FetchError("Cannot follow redirect with body being a readable stream","unsupported-redirect")),void finalize()):(303!==e.statusCode&&(301!==e.statusCode&&302!==e.statusCode||"POST"!==n.method)||(s.method="GET",s.body=void 0,s.headers.delete("content-length")),r(fetch(new Request(i,s))),void finalize())}}e.once("end",(function(){l&&l.removeEventListener("abort",abortAndFinalize)}));let s=e.pipe(new q);const i={url:n.url,status:e.statusCode,statusText:e.statusMessage,headers:t,size:n.size,timeout:n.timeout,counter:n.counter},a=t.get("Content-Encoding");if(!n.compress||"HEAD"===n.method||null===a||204===e.statusCode||304===e.statusCode)return h=new Response(s,i),void r(h);const u={flush:d.default.Z_SYNC_FLUSH,finishFlush:d.default.Z_SYNC_FLUSH};if("gzip"==a||"x-gzip"==a)return s=s.pipe(d.default.createGunzip(u)),h=new Response(s,i),void r(h);if("deflate"!=a&&"x-deflate"!=a){if("br"==a&&"function"==typeof d.default.createBrotliDecompress)return s=s.pipe(d.default.createBrotliDecompress()),h=new Response(s,i),void r(h);h=new Response(s,i),r(h)}else{e.pipe(new q).once("data",(function(e){s=8==(15&e[0])?s.pipe(d.default.createInflate()):s.pipe(d.default.createInflateRaw()),h=new Response(s,i),r(h)}))}})),function(e,t){const r=t.body;null===r?e.end():isBlob(r)?r.stream().pipe(e):Buffer.isBuffer(r)?(e.write(r),e.end()):r.pipe(e)}(f,n)}))}fetch.isRedirect=function(e){return 301===e||302===e||303===e||307===e||308===e},fetch.Promise=global.Promise;const z=Object.freeze({__proto__:null,default:fetch,Headers:Headers,Request:Request,Response:Response,FetchError:FetchError});function universalFetch(e,t){return e.startsWith("/")?async function(e,t){try{const r=(await handleRequest({url:e,...t}))._consume();return new Response(r.data,{status:r.statusCode,statusText:r.statusMessage,headers:r.headers})}catch(e){return console.error(e),new Response(e.stack,{status:500,ok:!1})}}(e,t):fetch(e,t)}global.fetch=universalFetch,global.Response=universalFetch.Response=Response,global.Headers=universalFetch.Headers=Headers,exports.lib=z,exports.node=async function(e,t){try{await handleRequest({req:e,res:t})}catch(e){console.error(e),t.statusCode=500,t.statusMessage="Internal Error",t.end("Internal Error: "+e)}},global.__timing__.logEnd("import:functions/node/_nuxt/chunks/runtime/node");
