wilddragon-site/node_modules/next/dist/compiled/next-server/pages-api.runtime.dev.js

3 lines
165 KiB
JavaScript
Raw Normal View History

2026-04-17 15:51:01 -04:00
(()=>{var leafPrototypes,getProto,__webpack_modules__={"./dist/compiled/@edge-runtime/cookies/index.js"(module1){"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,src_exports={},all={RequestCookies:()=>RequestCookies,ResponseCookies:()=>ResponseCookies,parseCookie:()=>parseCookie,parseSetCookie:()=>parseSetCookie,stringifyCookie:()=>stringifyCookie};for(var name in all)__defProp(src_exports,name,{get:all[name],enumerable:!0});function stringifyCookie(c){var _a;let attrs=["path"in c&&c.path&&`Path=${c.path}`,"expires"in c&&(c.expires||0===c.expires)&&`Expires=${("number"==typeof c.expires?new Date(c.expires):c.expires).toUTCString()}`,"maxAge"in c&&"number"==typeof c.maxAge&&`Max-Age=${c.maxAge}`,"domain"in c&&c.domain&&`Domain=${c.domain}`,"secure"in c&&c.secure&&"Secure","httpOnly"in c&&c.httpOnly&&"HttpOnly","sameSite"in c&&c.sameSite&&`SameSite=${c.sameSite}`,"partitioned"in c&&c.partitioned&&"Partitioned","priority"in c&&c.priority&&`Priority=${c.priority}`].filter(Boolean),stringified=`${c.name}=${encodeURIComponent(null!=(_a=c.value)?_a:"")}`;return 0===attrs.length?stringified:`${stringified}; ${attrs.join("; ")}`}function parseCookie(cookie){let map=new Map;for(let pair of cookie.split(/; */)){if(!pair)continue;let splitAt=pair.indexOf("=");if(-1===splitAt){map.set(pair,"true");continue}let[key,value]=[pair.slice(0,splitAt),pair.slice(splitAt+1)];try{map.set(key,decodeURIComponent(null!=value?value:"true"))}catch{}}return map}function parseSetCookie(setCookie){if(!setCookie)return;let[[name,value],...attributes]=parseCookie(setCookie),{domain,expires,httponly,maxage,path,samesite,secure,partitioned,priority}=Object.fromEntries(attributes.map(([key,value2])=>[key.toLowerCase().replace(/-/g,""),value2]));{var string,string1,t={name,value:decodeURIComponent(value),domain,...expires&&{expires:new Date(expires)},...httponly&&{httpOnly:!0},..."string"==typeof maxage&&{maxAge:Number(maxage)},path,...samesite&&{sameSite:SAME_SITE.includes(string=(string=samesite).toLowerCase())?string:void 0},...secure&&{secure:!0},...priority&&{priority:PRIORITY.includes(string1=(string1=priority).toLowerCase())?string1:void 0},...partitioned&&{partitioned:!0}};let newT={};for(let key in t)t[key]&&(newT[key]=t[key]);return newT}}module1.exports=((to,from,except,desc)=>{if(from&&"object"==typeof from||"function"==typeof from)for(let key of __getOwnPropNames(from))__hasOwnProp.call(to,key)||void 0===key||__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to})(__defProp({},"__esModule",{value:!0}),src_exports);var SAME_SITE=["strict","lax","none"],PRIORITY=["low","medium","high"],RequestCookies=class{constructor(requestHeaders){this._parsed=new Map,this._headers=requestHeaders;const header=requestHeaders.get("cookie");if(header)for(const[name,value]of parseCookie(header))this._parsed.set(name,{name,value})}[Symbol.iterator](){return this._parsed[Symbol.iterator]()}get size(){return this._parsed.size}get(...args){let name="string"==typeof args[0]?args[0]:args[0].name;return this._parsed.get(name)}getAll(...args){var _a;let all=Array.from(this._parsed);if(!args.length)return all.map(([_,value])=>value);let name="string"==typeof args[0]?args[0]:null==(_a=args[0])?void 0:_a.name;return all.filter(([n])=>n===name).map(([_,value])=>value)}has(name){return this._parsed.has(name)}set(...args){let[name,value]=1===args.length?[args[0].name,args[0].value]:args,map=this._parsed;return map.set(name,{name,value}),this._headers.set("cookie",Array.from(map).map(([_,value2])=>stringifyCookie(value2)).join("; ")),this}delete(names){let map=this._parsed,result=Array.isArray(names)?names.map(name=>map.delete(name)):map.delete(names);return this._headers.set("cookie",Array.from(map).map(([_,value])=>stringifyCookie(value)).join("; ")),result}clear(){return this.delete(Array.from(this._parsed.keys())),this}[Symbol.for("edge-runtime.inspect.custom")](){return`RequestCoo
See more info here https://nextjs.org/docs/messages/invalid-api-status-body`),res.end();return}let contentType=res.getHeader("Content-Type");if(body instanceof external_stream_namespaceObject.Stream){contentType||res.setHeader("Content-Type","application/octet-stream"),body.pipe(res);return}let isJSONLike=["object","number","boolean"].includes(typeof body),stringifiedBody=isJSONLike?JSON.stringify(body):body,etag=((payload,weak=!1)=>(weak?'W/"':'"')+(str=>{let len=str.length,i=0,t0=0,v0=8997,t1=0,v1=33826,t2=0,v2=40164,t3=0,v3=52210;for(;i<len;)v0^=str.charCodeAt(i++),t0=435*v0,t1=435*v1,t2=435*v2,t3=435*v3,t2+=v0<<8,t3+=v1<<8,t1+=t0>>>16,v0=65535&t0,t2+=t1>>>16,v1=65535&t1,v3=t3+(t2>>>16)&65535,v2=65535&t2;return(15&v3)*0x1000000000000+0x100000000*v2+65536*v1+(v0^v3>>4)})(payload).toString(36)+payload.length.toString(36)+'"')(stringifiedBody);if(etag&&res.setHeader("ETag",etag),!fresh_default()(req.headers,{etag:etag})||(res.statusCode=304,res.end(),0)){if(Buffer.isBuffer(body)){contentType||res.setHeader("Content-Type","application/octet-stream"),res.setHeader("Content-Length",body.length),res.end(body);return}isJSONLike&&res.setHeader("Content-Type",constants.JSON_CONTENT_TYPE_HEADER),res.setHeader("Content-Length",Buffer.byteLength(stringifiedBody)),res.end(stringifiedBody)}})(req,res,data),res.json=data=>{res.setHeader("Content-Type",constants.JSON_CONTENT_TYPE_HEADER),res.send(JSON.stringify(data))},res.redirect=(statusOrUrl,url)=>(0,api_utils.redirect)(res,statusOrUrl,url),res.setDraftMode=(options={enable:!0})=>(function(res,options){if(!isValidData(options.previewModeId))throw Object.defineProperty(Error("invariant: invalid previewModeId"),"__NEXT_ERROR_CODE",{value:"E169",enumerable:!1,configurable:!0});let expires=options.enable?void 0:new Date(0),{serialize}=__webpack_require__("./dist/compiled/cookie/index.js"),previous=res.getHeader("Set-Cookie");return res.setHeader("Set-Cookie",[..."string"==typeof previous?[previous]:Array.isArray(previous)?previous:[],serialize(api_utils.COOKIE_NAME_PRERENDER_BYPASS,options.previewModeId,{httpOnly:!0,sameSite:"lax",secure:!1,path:"/",expires})]),res})(res,Object.assign({},apiContext,options)),res.setPreviewData=(data,options={})=>(function(res,data,options){if(!isValidData(options.previewModeId))throw Object.defineProperty(Error("invariant: invalid previewModeId"),"__NEXT_ERROR_CODE",{value:"E169",enumerable:!1,configurable:!0});if(!isValidData(options.previewModeEncryptionKey))throw Object.defineProperty(Error("invariant: invalid previewModeEncryptionKey"),"__NEXT_ERROR_CODE",{value:"E334",enumerable:!1,configurable:!0});if(!isValidData(options.previewModeSigningKey))throw Object.defineProperty(Error("invariant: invalid previewModeSigningKey"),"__NEXT_ERROR_CODE",{value:"E436",enumerable:!1,configurable:!0});let jsonwebtoken=__webpack_require__("next/dist/compiled/jsonwebtoken"),{encryptWithSecret}=__webpack_require__("./dist/esm/server/crypto-utils.js"),payload=jsonwebtoken.sign({data:encryptWithSecret(Buffer.from(options.previewModeEncryptionKey),JSON.stringify(data))},options.previewModeSigningKey,{algorithm:"HS256",...void 0!==options.maxAge?{expiresIn:options.maxAge}:void 0});if(payload.length>2048)throw Object.defineProperty(Error("Preview data is limited to 2KB currently, reduce how much data you are storing as preview data to continue"),"__NEXT_ERROR_CODE",{value:"E465",enumerable:!1,configurable:!0});let{serialize}=__webpack_require__("./dist/compiled/cookie/index.js"),previous=res.getHeader("Set-Cookie");return res.setHeader("Set-Cookie",[..."string"==typeof previous?[previous]:Array.isArray(previous)?previous:[],serialize(api_utils.COOKIE_NAME_PRERENDER_BYPASS,options.previewModeId,{httpOnly:!0,sameSite:"lax",secure:!1,path:"/",...void 0!==options.maxAge?{maxAge:options.maxAge}:void 0,...void 0!==options.path?{path:options.path}:void 0}),serialize(api_utils.COOKIE_NAME_PRERENDER_DATA,payload,{httpOnly:!0,sameSite:"lax",secure:!1,path:"/",...void 0!==options.maxAge?{maxAge:options.maxAge}:void 0,...void 0!==options.path?{path:options.path}:void 0})]),res})(r
//# sourceMappingURL=pages-api.runtime.dev.js.map