5 lines
24 KiB
JavaScript
5 lines
24 KiB
JavaScript
;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="d61697bf-0fbc-8c8b-bc66-2e0b26fa04c2")}catch(e){}}();
|
|
module.exports=[504643,e=>{"use strict";e.i(10188);var t,r=e.i(785867);function n(e){return e.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function a(e){return e&&e.sensitive?"":"i"}var o=e.i(161516),i=e.i(839875),s=e.i(680381),l=e.i(384463),c=e.i(700859),u=e.i(638626),p=e.i(546712);let d=e=>{if(e){let t=Object.getPrototypeOf(e);if((t.constructor.name===p.ValidationErrorName||t.constructor.name===c.APIErrorName)&&e.data)return{errors:[{name:e.name,data:e.data,message:e.message}]};if(t.constructor.name===p.ValidationErrorName&&"errors"in e&&e.errors)return{errors:Object.keys(e.errors).reduce((t,r)=>(t.push({field:e.errors[r].path,message:e.errors[r].message}),t),[])};if(Array.isArray(e.message))return{errors:e.message};if(e.name)return{errors:[{message:e.message}]}}return{errors:[{message:"An unknown error occurred."}]}};var f=e.i(371552),h=e.i(392822);let m=async({collection:e,config:t,err:n,req:a})=>{if("payloadInitError"in n&&!0===n.payloadInitError)return console.error(n),Response.json({message:"There was an error initializing Payload"},{status:r.status.INTERNAL_SERVER_ERROR});let o=a&&"payload"in a&&a?.payload;if(!o)try{o=await (0,u.getPayload)({config:t,cron:!0})}catch(e){return Response.json({message:"There was an error initializing Payload"},{status:r.status.INTERNAL_SERVER_ERROR})}let i=d(n),p=n.status||r.status.INTERNAL_SERVER_ERROR;(0,h.logError)({err:n,payload:o}),a.payload=o;let m=(0,s.headersWithCors)({headers:new Headers,req:a}),{config:g}=o;return(0,f.isErrorPublic)(n,g)||(i=d(new c.APIError("Something went wrong."))),g.debug&&!0===g.debug&&(i.stack=n.stack),e&&await e.config.hooks.afterError?.reduce(async(t,r)=>{await t;let o=await r({collection:e.config,context:a.context,error:n,req:a,result:i});o&&(i=o.response||i,p=o.status||p)},Promise.resolve()),await g.hooks.afterError?.reduce(async(t,r)=>{await t;let o=await r({collection:e?.config,context:a.context,error:n,req:a,result:i});o&&(i=o.response||i,p=o.status||p)},Promise.resolve()),Response.json(i,{headers:a.responseHeaders?(0,l.mergeHeaders)(a.responseHeaders,m):m,status:p})},g=(e,t)=>Response.json({message:`Route not found "${t??new URL(e.url).pathname}"`},{headers:(0,s.headersWithCors)({headers:new Headers,req:e}),status:r.status.NOT_FOUND}),y=async({basePath:e="",config:t,path:c,payloadInstanceCacheKey:u,request:p})=>{let d,f,h;if("post"===p.method.toLowerCase()&&("GET"===p.headers.get("X-Payload-HTTP-Method-Override")||"GET"===p.headers.get("X-HTTP-Method-Override"))){let r,n=p.url;if("application/x-www-form-urlencoded"===p.headers.get("Content-Type")){let e=await p.text();n=`${p.url}?${e}`}else"application/json"===p.headers.get("Content-Type")&&(r=await p.json(),r?.locale&&(n+=`?locale=${r.locale}`),r?.fallbackLocale&&(n+=`&fallbackLocale=${r.depth}`));let a=new Request(n,{cache:p.cache,credentials:p.credentials,headers:p.headers,method:"GET",signal:p.signal});return r&&(a.data=r),await y({basePath:e,config:t,path:c,payloadInstanceCacheKey:u,request:a})}try{let e,{payload:m}=f=await (0,o.createPayloadRequest)({canSetHeaders:!0,config:t,payloadInstanceCacheKey:u,request:p}),{config:y}=m,v=c??new URL(f.url).pathname,T=(0,i.formatAdminURL)({apiRoute:y.routes.api,path:""});if(!v.startsWith(T))return g(f,v);let E=v.replace(T,""),w=!1;E.startsWith("/globals")&&(w=!0,E=E.replace("/globals",""));let R=E.split("/");R.shift();let C=R[0];C&&(w?e=m.globals.config.find(e=>e.slug===C):m.collections[C]&&(h=m.collections[C]));let x=y.endpoints;if(h?(x=h.config.endpoints,E=E.replace(`/${h.config.slug}`,"")):e&&(E=E.replace(`/${e.slug}`,""),x=e.endpoints),""===E&&(E="/"),!1===x)return Response.json({message:`Cannot ${f.method?.toUpperCase()} ${f.url}`},{headers:(0,s.headersWithCors)({headers:new Headers,req:f}),status:r.status.NOT_IMPLEMENTED});let O=x?.find(t=>{var r,o,i,s,l,c,u,p;if(t.method!==f.method?.toLowerCase())return!1;let d=(r=t.path,o={decode:decodeURIComponent},i=[],s=function e(t,r,o){if(t instanceof RegExp){var i;if(!r)return t;for(var s=/\((?:\?<(.*?)>)?(?!\?)/g,l=0,c=s.exec(t.source);c;)r.push({name:c[1]||l++,prefix:"",suffix:"",modifier:"",pattern:""}),c=s.exec(t.source);return t}return Array.isArray(t)?(i=t.map(function(t){return e(t,r,o).source}),new RegExp("(?:".concat(i.join("|"),")"),a(o))):function(e,t,r){void 0===r&&(r={});for(var o=r.strict,i=void 0!==o&&o,s=r.start,l=r.end,c=r.encode,u=void 0===c?function(e){return e}:c,p=r.delimiter,d=r.endsWith,f="[".concat(n(void 0===d?"":d),"]|$"),h="[".concat(n(void 0===p?"/#?":p),"]"),m=void 0===s||s?"^":"",g=0;g<e.length;g++){var y=e[g];if("string"==typeof y)m+=n(u(y));else{var v=n(u(y.prefix)),T=n(u(y.suffix));if(y.pattern)if(t&&t.push(y),v||T)if("+"===y.modifier||"*"===y.modifier){var E="*"===y.modifier?"?":"";m+="(?:".concat(v,"((?:").concat(y.pattern,")(?:").concat(T).concat(v,"(?:").concat(y.pattern,"))*)").concat(T,")").concat(E)}else m+="(?:".concat(v,"(").concat(y.pattern,")").concat(T,")").concat(y.modifier);else{if("+"===y.modifier||"*"===y.modifier)throw TypeError('Can not repeat "'.concat(y.name,'" without a prefix and suffix'));m+="(".concat(y.pattern,")").concat(y.modifier)}else m+="(?:".concat(v).concat(T,")").concat(y.modifier)}}if(void 0===l||l)i||(m+="".concat(h,"?")),m+=r.endsWith?"(?=".concat(f,")"):"$";else{var w=e[e.length-1],R="string"==typeof w?h.indexOf(w[w.length-1])>-1:void 0===w;i||(m+="(?:".concat(h,"(?=").concat(f,"))?")),R||(m+="(?=".concat(h,"|").concat(f,")"))}return new RegExp(m,a(r))}(function(e,t){void 0===t&&(t={});for(var r=function(e){for(var t=[],r=0;r<e.length;){var n=e[r];if("*"===n||"+"===n||"?"===n){t.push({type:"MODIFIER",index:r,value:e[r++]});continue}if("\\"===n){t.push({type:"ESCAPED_CHAR",index:r++,value:e[r++]});continue}if("{"===n){t.push({type:"OPEN",index:r,value:e[r++]});continue}if("}"===n){t.push({type:"CLOSE",index:r,value:e[r++]});continue}if(":"===n){for(var a="",o=r+1;o<e.length;){var i=e.charCodeAt(o);if(i>=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122||95===i){a+=e[o++];continue}break}if(!a)throw TypeError("Missing parameter name at ".concat(r));t.push({type:"NAME",index:r,value:a}),r=o;continue}if("("===n){var s=1,l="",o=r+1;if("?"===e[o])throw TypeError('Pattern cannot start with "?" at '.concat(o));for(;o<e.length;){if("\\"===e[o]){l+=e[o++]+e[o++];continue}if(")"===e[o]){if(0==--s){o++;break}}else if("("===e[o]&&(s++,"?"!==e[o+1]))throw TypeError("Capturing groups are not allowed at ".concat(o));l+=e[o++]}if(s)throw TypeError("Unbalanced pattern at ".concat(r));if(!l)throw TypeError("Missing pattern at ".concat(r));t.push({type:"PATTERN",index:r,value:l}),r=o;continue}t.push({type:"CHAR",index:r,value:e[r++]})}return t.push({type:"END",index:r,value:""}),t}(e),a=t.prefixes,o=void 0===a?"./":a,i=t.delimiter,s=void 0===i?"/#?":i,l=[],c=0,u=0,p="",d=function(e){if(u<r.length&&r[u].type===e)return r[u++].value},f=function(e){var t=d(e);if(void 0!==t)return t;var n=r[u],a=n.type,o=n.index;throw TypeError("Unexpected ".concat(a," at ").concat(o,", expected ").concat(e))},h=function(){for(var e,t="";e=d("CHAR")||d("ESCAPED_CHAR");)t+=e;return t},m=function(e){for(var t=0;t<s.length;t++){var r=s[t];if(e.indexOf(r)>-1)return!0}return!1},g=function(e){var t=l[l.length-1],r=e||(t&&"string"==typeof t?t:"");if(t&&!r)throw TypeError('Must have text between two parameters, missing text after "'.concat(t.name,'"'));return!r||m(r)?"[^".concat(n(s),"]+?"):"(?:(?!".concat(n(r),")[^").concat(n(s),"])+?")};u<r.length;){var y=d("CHAR"),v=d("NAME"),T=d("PATTERN");if(v||T){var E=y||"";-1===o.indexOf(E)&&(p+=E,E=""),p&&(l.push(p),p=""),l.push({name:v||c++,prefix:E,suffix:"",pattern:T||g(E),modifier:d("MODIFIER")||""});continue}var w=y||d("ESCAPED_CHAR");if(w){p+=w;continue}if(p&&(l.push(p),p=""),d("OPEN")){var E=h(),R=d("NAME")||"",C=d("PATTERN")||"",x=h();f("CLOSE"),l.push({name:R||(C?c++:""),pattern:R&&!C?g(E):C,prefix:E,suffix:x,modifier:d("MODIFIER")||""});continue}f("END")}return l}(t,o),r,o)}(r,i,o),l=i,c=o,void 0===c&&(c={}),u=c.decode,p=void 0===u?function(e){return e}:u,function(e){var t=s.exec(e);if(!t)return!1;for(var r=t[0],n=t.index,a=Object.create(null),o=1;o<t.length;o++)!function(e){if(void 0!==t[e]){var r=l[e-1];"*"===r.modifier||"+"===r.modifier?a[r.name]=t[e].split(r.prefix+r.suffix).map(function(e){return p(e,r)}):a[r.name]=p(t[e],r)}}(o);return{path:r,index:n,params:a}})(E);return!!d&&(f.routeParams=d.params,h?f.routeParams.collection=h.config.slug:e&&(f.routeParams.global=e.slug),!0)});if(O&&(d=O.handler),!d){if(f.method?.toLowerCase()==="options")return Response.json({},{headers:(0,s.headersWithCors)({headers:new Headers,req:f}),status:200});return g(f,v)}let P=await d(f);return new Response(P.body,{headers:(0,s.headersWithCors)({headers:(0,l.mergeHeaders)(f.responseHeaders??new Headers,P.headers),req:f}),status:P.status,statusText:P.statusText})}catch(e){return m({collection:h,config:t,err:e,req:f})}};var v=e.i(198526);e.i(796617);var T=e.i(55115),E=(e.i(186725),e.i(344219)),w=e.i(508917);Object.prototype.hasOwnProperty;let R=Array.isArray,C=Array.prototype.push,x=Date.prototype.toISOString,O=w.default;E.encode,w.formatters[O],e.i(616482),e.i(912150),e.i(968763),e.i(193510),e.i(192794),e.i(577198),e.i(231963),e.i(843385);var P=({fill:e})=>{let t=e||"var(--theme-elevation-1000)";return(0,v.jsxs)("svg",{className:"graphic-icon",height:"100%",viewBox:"0 0 25 25",width:"100%",xmlns:"http://www.w3.org/2000/svg",children:[(0,v.jsx)("path",{d:"M11.8673 21.2336L4.40922 16.9845C4.31871 16.9309 4.25837 16.8355 4.25837 16.7282V10.1609C4.25837 10.0477 4.38508 9.97616 4.48162 10.0298L13.1404 14.9642C13.2611 15.0358 13.412 14.9464 13.412 14.8093V11.6091C13.412 11.4839 13.3456 11.3647 13.2309 11.2992L2.81624 5.36353C2.72573 5.30989 2.60505 5.30989 2.51454 5.36353L1.15085 6.14422C1.06034 6.19786 1 6.29321 1 6.40048V18.5995C1 18.7068 1.06034 18.8021 1.15085 18.8558L11.8491 24.9583C11.9397 25.0119 12.0603 25.0119 12.1509 24.9583L21.1355 19.8331C21.2562 19.7616 21.2562 19.5948 21.1355 19.5232L18.3357 17.9261C18.2211 17.8605 18.0883 17.8605 17.9737 17.9261L12.175 21.2336C12.0845 21.2872 11.9638 21.2872 11.8733 21.2336H11.8673Z",fill:t}),(0,v.jsx)("path",{d:"M22.8491 6.13827L12.1508 0.0417218C12.0603 -0.0119135 11.9397 -0.0119135 11.8491 0.0417218L6.19528 3.2658C6.0746 3.33731 6.0746 3.50418 6.19528 3.57569L8.97092 5.16091C9.08557 5.22647 9.21832 5.22647 9.33296 5.16091L11.8672 3.71872C11.9578 3.66508 12.0784 3.66508 12.1689 3.71872L19.627 7.96782C19.7175 8.02146 19.7778 8.11681 19.7778 8.22408V14.8212C19.7778 14.9464 19.8442 15.0656 19.9589 15.1311L22.7345 16.7104C22.8552 16.7819 23.006 16.6925 23.006 16.5554V6.40048C23.006 6.29321 22.9457 6.19786 22.8552 6.14423L22.8491 6.13827Z",fill:t})]})},A={},b={};function N(e,t){try{let r=(A[e]||=new Intl.DateTimeFormat("en-GB",{timeZone:e,hour:"numeric",timeZoneName:"longOffset"}).format)(t).split("GMT")[1]||"";return r in b?b[r]:D(r,r.split(":"))}catch{if(e in b)return b[e];let t=e?.match(S);return t?D(e,t.slice(1)):NaN}}var S=/([+-]\d\d):?(\d\d)?/;function D(e,t){let r=+t[0],n=+(t[1]||0);return b[e]=r>0?60*r+n:60*r-n}var U=class e extends Date{constructor(...e){super(),e.length>1&&"string"==typeof e[e.length-1]&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(N(this.timeZone,this))?this.setTime(NaN):e.length?"number"==typeof e[0]&&(1===e.length||2===e.length&&"number"!=typeof e[1])?this.setTime(e[0]):"string"==typeof e[0]?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),M(this,NaN),_(this)):this.setTime(Date.now())}static tz(t,...r){return r.length?new e(...r,t):new e(Date.now(),t)}withTimeZone(t){return new e(+this,t)}getTimezoneOffset(){return-N(this.timeZone,this)}setTime(e){return Date.prototype.setTime.apply(this,arguments),_(this),+this}[Symbol.for("constructDateFrom")](t){return new e(+new Date(t),this.timeZone)}},H=/^(get|set)(?!UTC)/;function _(e){e.internal.setTime(+e),e.internal.setUTCMinutes(e.internal.getUTCMinutes()-e.getTimezoneOffset())}function M(e){let t=N(e.timeZone,e),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);let n=-new Date(+e).getTimezoneOffset(),a=n- -new Date(+r).getTimezoneOffset(),o=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();a&&o&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+a);let i=n-t;i&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+i);let s=N(e.timeZone,e),l=-new Date(+e).getTimezoneOffset()-s-i;if(s!==t&&l){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+l);let t=s-N(e.timeZone,e);t&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+t),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+t))}}Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!H.test(e))return;let t=e.replace(H,"$1UTC");U.prototype[t]&&(e.startsWith("get")?U.prototype[e]=function(){return this.internal[t]()}:(U.prototype[e]=function(){var e;return Date.prototype[t].apply(this.internal,arguments),e=this,Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),M(e),+this},U.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),_(this),+this}))}),(t={}).collection="collections",t.global="globals";var j=e.i(924868),I=e.i(169725),L=e.i(814747),k=e.i(792509),$=e.i(111281),q=e.i(709926);function F(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e))}let G=({clientProps:e={},Component:t,Fallback:r,importMap:n,key:a,serverProps:o})=>{if(Array.isArray(t))return t.map((t,r)=>G({clientProps:e,Component:t,importMap:n,key:r,serverProps:o}));if("function"==typeof t){let r=(0,T.isReactServerComponentOrFunction)(t),n=F({...e,...r?o:{}});return(0,v.jsx)(t,{...n},a)}if("string"==typeof t||(0,q.isPlainObject)(t)){let r=(e=>{let{importMap:t,PayloadComponent:r,schemaPath:n,silent:a}=e,{exportName:o,path:i}=(0,$.parsePayloadComponent)(r),s=i+"#"+o,l=t[s];return l||a||console.error("getFromImportMap: PayloadComponent not found in importMap",{key:s,PayloadComponent:r,schemaPath:n},"You may need to run the `payload generate:importmap` command to generate the importMap ahead of runtime."),l})({importMap:n,PayloadComponent:t,schemaPath:""});if(r){let n=(0,T.isReactServerComponentOrFunction)(r),i=F({...e,...n?o:{},...n&&"object"==typeof t&&t?.serverProps?t.serverProps:{},..."object"==typeof t&&t?.clientProps?t.clientProps:{}});return(0,v.jsx)(r,{...i},a)}}return r?G({clientProps:e,Component:r,importMap:n,key:a,serverProps:o}):null},W=({description:e,Fallback:t,fontFamily:r="Arial, sans-serif",Icon:n,importMap:a,leader:o,title:i})=>{let s=G({clientProps:{fill:"white"},Component:n,Fallback:t,importMap:a});return(0,v.jsxs)("div",{style:{backgroundColor:"#000",color:"#fff",display:"flex",flexDirection:"column",fontFamily:r,height:"100%",justifyContent:"space-between",padding:"100px",width:"100%"},children:[(0,v.jsxs)("div",{style:{display:"flex",flexDirection:"column",flexGrow:1,fontSize:50,height:"100%"},children:[o&&(0,v.jsx)("div",{style:{fontSize:30,marginBottom:10},children:o}),(0,v.jsx)("p",{style:{display:"-webkit-box",fontSize:90,lineHeight:1,marginBottom:0,marginTop:0,textOverflow:"ellipsis",WebkitBoxOrient:"vertical",WebkitLineClamp:2},children:i}),e&&(0,v.jsx)("p",{style:{display:"-webkit-box",flexGrow:1,fontSize:30,lineHeight:1,marginBottom:0,marginTop:40,textOverflow:"ellipsis",WebkitBoxOrient:"vertical",WebkitLineClamp:2},children:e})]}),(0,v.jsx)("div",{style:{alignItems:"flex-end",display:"flex",flexShrink:0,height:"38px",justifyContent:"center",width:"38px"},children:s})]})},z=(0,k.fileURLToPath)({get url(){return`file://${e.P("node_modules/.pnpm/@payloadcms+next@3.81.0_@types+react@19.2.14_graphql@16.13.2_monaco-editor@0.55.1_next@_61d9a511d651f25382fefb5a0d802417/node_modules/@payloadcms/next/dist/routes/rest/og/index.js")}`}}.url),V=L.default.dirname(z),Z=async e=>{let t=e.payload.config;if("off"===t.admin.meta.defaultOGImageType)return Response.json({error:"Open Graph images are disabled"},{status:400});try{let r,{searchParams:n}=new URL(e.url),a=n.has("title")?n.get("title")?.slice(0,100):"",o=n.has("leader")?n.get("leader")?.slice(0,100).replace("-"," "):"",i=n.has("description")?n.get("description"):"";try{r=j.default.readFile(L.default.join(V,"roboto-regular.woff"))}catch(t){e.payload.logger.error(`Error reading font file or not readable: ${t.message}`)}return new I.ImageResponse((0,v.jsx)(W,{description:i,Fallback:P,fontFamily:"Roboto, sans-serif",Icon:t.admin?.components?.graphics?.Icon,importMap:e.payload.importMap,leader:o,title:a}),{...r?{fonts:[{name:"Roboto",data:await r,style:"normal",weight:400}]}:{},height:630,width:1200})}catch(t){return e.payload.logger.error(`Error generating Open Graph image: ${t.message}`),Response.json({error:`Internal Server Error: ${t.message}`},{status:500})}},B=!1,K=e=>async(t,r)=>{let n=await e;!1!==B||n.endpoints.some(e=>"/og"===e.path&&"get"===e.method)||n.endpoints.push({handler:Z,method:"get",path:"/og"}),B=!0;let a=await r.params;return await y({config:e,path:(0,i.formatAdminURL)({apiRoute:n.routes.api,path:a?`/${a.slug.join("/")}`:void 0}),request:t})};e.s(["DELETE",0,K,"GET",0,K,"OPTIONS",0,K,"PATCH",0,K,"POST",0,K],504643)},7661,e=>{"use strict";var t=e.i(504643);e.s(["REST_GET",()=>t.GET])},723755,e=>{"use strict";var t=e.i(504643);e.s(["REST_OPTIONS",()=>t.OPTIONS])},340390,e=>{"use strict";var t=e.i(504643);e.s(["REST_PATCH",()=>t.PATCH])},507287,e=>{"use strict";var t=e.i(504643);e.s(["REST_POST",()=>t.POST])},666917,e=>{"use strict";var t=e.i(504643);e.s(["REST_DELETE",()=>t.DELETE])},100069,e=>e.a(async(t,r)=>{try{var n=e.i(621990),a=e.i(7661),o=e.i(723755),i=e.i(340390),s=e.i(507287),l=e.i(666917),c=t([n]);[n]=c.then?(await c)():c;let u=(0,a.REST_GET)(n.default),p=(0,s.REST_POST)(n.default),d=(0,l.REST_DELETE)(n.default),f=(0,i.REST_PATCH)(n.default),h=(0,o.REST_OPTIONS)(n.default);e.s(["DELETE",0,d,"GET",0,u,"OPTIONS",0,h,"PATCH",0,f,"POST",0,p]),r()}catch(e){r(e)}},!1),262572,e=>e.a(async(t,r)=>{try{var n=e.i(80690),a=e.i(278167),o=e.i(86697),i=e.i(991104),s=e.i(568359),l=e.i(18380),c=e.i(551902),u=e.i(202541),p=e.i(548322),d=e.i(626486),f=e.i(748),h=e.i(542413),m=e.i(833102),g=e.i(592758),y=e.i(288816),v=e.i(193695);e.i(73615);var T=e.i(888479),E=e.i(100069),w=t([E]);[E]=w.then?(await w)():w;let x=new n.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/(payload)/api/[...slug]/route",pathname:"/api/[...slug]",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/(payload)/api/[...slug]/route.ts",nextConfigOutput:"standalone",userland:E}),{workAsyncStorage:O,workUnitAsyncStorage:P,serverHooks:A}=x;function R(){return(0,o.patchFetch)({workAsyncStorage:O,workUnitAsyncStorage:P})}async function C(e,t,r){x.isDev&&(0,i.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let n="/(payload)/api/[...slug]/route";n=n.replace(/\/index$/,"")||"/";let o=await x.prepare(e,t,{srcPage:n,multiZoneDraftMode:!1});if(!o)return t.statusCode=400,t.end("Bad Request"),null==r.waitUntil||r.waitUntil.call(r,Promise.resolve()),null;let{buildId:E,params:w,nextConfig:R,parsedUrl:C,isDraftMode:O,prerenderManifest:P,routerServerContext:A,isOnDemandRevalidate:b,revalidateOnlyGenerated:N,resolvedPathname:S,clientReferenceManifest:D,serverActionsManifest:U}=o,H=(0,c.normalizeAppPath)(n),_=!!(P.dynamicRoutes[H]||P.routes[S]),M=async()=>((null==A?void 0:A.render404)?await A.render404(e,t,C,!1):t.end("This page could not be found"),null);if(_&&!O){let e=!!P.routes[S],t=P.dynamicRoutes[H];if(t&&!1===t.fallback&&!e){if(R.experimental.adapterPath)return await M();throw new v.NoFallbackError}}let j=null;!_||x.isDev||O||(j=S,j="/index"===j?"/":j);let I=!0===x.isDev||!_,L=_&&!I;U&&D&&(0,l.setManifestsSingleton)({page:n,clientReferenceManifest:D,serverActionsManifest:U});let k=e.method||"GET",$=(0,s.getTracer)(),q=$.getActiveScopeSpan(),F={params:w,prerenderManifest:P,renderOpts:{experimental:{authInterrupts:!!R.experimental.authInterrupts},cacheComponents:!!R.cacheComponents,supportsDynamicResponse:I,incrementalCache:(0,i.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:R.cacheLife,waitUntil:r.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,a)=>x.onRequestError(e,t,n,a,A)},sharedContext:{buildId:E}},G=new u.NodeNextRequest(e),W=new u.NodeNextResponse(t),z=p.NextRequestAdapter.fromNodeNextRequest(G,(0,p.signalFromNodeResponse)(t));try{let o=async e=>x.handle(z,F).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=$.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route");if(a){let t=`${k} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t)}else e.updateName(`${k} ${n}`)}),l=!!(0,i.getRequestMeta)(e,"minimalMode"),c=async i=>{var s,c;let u=async({previousCacheEntry:a})=>{try{if(!l&&b&&N&&!a)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let n=await o(i);e.fetchMetrics=F.renderOpts.fetchMetrics;let s=F.renderOpts.pendingWaitUntil;s&&r.waitUntil&&(r.waitUntil(s),s=void 0);let c=F.renderOpts.collectedTags;if(!_)return await (0,h.sendResponse)(G,W,n,F.renderOpts.pendingWaitUntil),null;{let e=await n.blob(),t=(0,m.toNodeOutgoingHttpHeaders)(n.headers);c&&(t[y.NEXT_CACHE_TAGS_HEADER]=c),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==F.renderOpts.collectedRevalidate&&!(F.renderOpts.collectedRevalidate>=y.INFINITE_CACHE)&&F.renderOpts.collectedRevalidate,a=void 0===F.renderOpts.collectedExpire||F.renderOpts.collectedExpire>=y.INFINITE_CACHE?void 0:F.renderOpts.collectedExpire;return{value:{kind:T.CachedRouteKind.APP_ROUTE,status:n.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==a?void 0:a.isStale)&&await x.onRequestError(e,t,{routerKind:"App Router",routePath:n,routeType:"route",revalidateReason:(0,f.getRevalidateReason)({isStaticGeneration:L,isOnDemandRevalidate:b})},!1,A),t}},p=await x.handleResponse({req:e,nextConfig:R,cacheKey:j,routeKind:a.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:P,isRoutePPREnabled:!1,isOnDemandRevalidate:b,revalidateOnlyGenerated:N,responseGenerator:u,waitUntil:r.waitUntil,isMinimalMode:l});if(!_)return null;if((null==p||null==(s=p.value)?void 0:s.kind)!==T.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==p||null==(c=p.value)?void 0:c.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});l||t.setHeader("x-nextjs-cache",b?"REVALIDATED":p.isMiss?"MISS":p.isStale?"STALE":"HIT"),O&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let d=(0,m.fromNodeOutgoingHttpHeaders)(p.value.headers);return l&&_||d.delete(y.NEXT_CACHE_TAGS_HEADER),!p.cacheControl||t.getHeader("Cache-Control")||d.get("Cache-Control")||d.set("Cache-Control",(0,g.getCacheControlHeader)(p.cacheControl)),await (0,h.sendResponse)(G,W,new Response(p.value.body,{headers:d,status:p.value.status||200})),null};q?await c(q):await $.withPropagatedContext(e.headers,()=>$.trace(d.BaseServerSpan.handleRequest,{spanName:`${k} ${n}`,kind:s.SpanKind.SERVER,attributes:{"http.method":k,"http.target":e.url}},c))}catch(t){if(t instanceof v.NoFallbackError||await x.onRequestError(e,t,{routerKind:"App Router",routePath:H,routeType:"route",revalidateReason:(0,f.getRevalidateReason)({isStaticGeneration:L,isOnDemandRevalidate:b})},!1,A),_)throw t;return await (0,h.sendResponse)(G,W,new Response(null,{status:500})),null}}e.s(["handler",()=>C,"patchFetch",()=>R,"routeModule",()=>x,"serverHooks",()=>A,"workAsyncStorage",()=>O,"workUnitAsyncStorage",()=>P]),r()}catch(e){r(e)}},!1)];
|
|
|
|
//# debugId=d61697bf-0fbc-8c8b-bc66-2e0b26fa04c2
|
|
//# sourceMappingURL=_35a377ae._.js.map
|