"use strict";exports.id=464,exports.ids=[464],exports.modules={22464:(a,b,c)=>{var d=Object.create,e=Object.defineProperty,f=Object.getOwnPropertyDescriptor,g=Object.getOwnPropertyNames,h=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty,j=(a,b,c,d)=>{if(b&&"object"==typeof b||"function"==typeof b)for(let h of g(b))i.call(a,h)||h===c||e(a,h,{get:()=>b[h],enumerable:!(d=f(b,h))||d.enumerable});return a},k=(a,b,c)=>(c=null!=a?d(h(a)):{},j(!b&&a&&a.__esModule?c:e(c,"default",{value:a,enumerable:!0}),a)),l={};((a,b)=>{for(var c in b)e(a,c,{get:b[c],enumerable:!0})})(l,{assertVercelOidcTokenResponse:()=>t,findProjectInfo:()=>u,getTokenPayload:()=>x,getVercelCliToken:()=>r,getVercelDataDir:()=>q,getVercelOidcToken:()=>s,isExpired:()=>y,loadToken:()=>w,saveToken:()=>v}),a.exports=j(e({},"__esModule",{value:!0}),l);var m=k(c(33873)),n=k(c(29021)),o=c(10726),p=c(91264);function q(){let a=(0,p.getUserDataDir)();return a?m.join(a,"com.vercel.cli"):null}function r(){let a=q();if(!a)return null;let b=m.join(a,"auth.json");if(!n.existsSync(b))return null;let c=n.readFileSync(b,"utf8");return c?JSON.parse(c).token:null}async function s(a,b,c){try{let d=`https://api.vercel.com/v1/projects/${b}/token?source=vercel-oidc-refresh${c?`&teamId=${c}`:""}`,e=await fetch(d,{method:"POST",headers:{Authorization:`Bearer ${a}`}});if(!e.ok)throw new o.VercelOidcTokenError(`Failed to refresh OIDC token: ${e.statusText}`);let f=await e.json();return t(f),f}catch(a){throw new o.VercelOidcTokenError("Failed to refresh OIDC token",a)}}function t(a){if(!a||"object"!=typeof a)throw TypeError("Expected an object");if(!("token"in a)||"string"!=typeof a.token)throw TypeError("Expected a string-valued token property")}function u(){let a=(0,p.findRootDir)();if(!a)throw new o.VercelOidcTokenError("Unable to find root directory");try{let b=m.join(a,".vercel","project.json");if(!n.existsSync(b))throw new o.VercelOidcTokenError("project.json not found");let c=JSON.parse(n.readFileSync(b,"utf8"));if("string"!=typeof c.projectId&&"string"!=typeof c.orgId)throw TypeError("Expected a string-valued projectId property");return{projectId:c.projectId,teamId:c.orgId}}catch(a){throw new o.VercelOidcTokenError("Unable to find project ID",a)}}function v(a,b){try{let c=(0,p.getUserDataDir)();if(!c)throw new o.VercelOidcTokenError("Unable to find user data directory");let d=m.join(c,"com.vercel.token",`${b}.json`),e=JSON.stringify(a);n.mkdirSync(m.dirname(d),{mode:432,recursive:!0}),n.writeFileSync(d,e),n.chmodSync(d,432);return}catch(a){throw new o.VercelOidcTokenError("Failed to save token",a)}}function w(a){try{let b=(0,p.getUserDataDir)();if(!b)return null;let c=m.join(b,"com.vercel.token",`${a}.json`);if(!n.existsSync(c))return null;let d=JSON.parse(n.readFileSync(c,"utf8"));return t(d),d}catch(a){throw new o.VercelOidcTokenError("Failed to load token",a)}}function x(a){let b=a.split(".");if(3!==b.length)throw new o.VercelOidcTokenError("Invalid token");let c=b[1].replace(/-/g,"+").replace(/_/g,"/"),d=c.padEnd(c.length+(4-c.length%4)%4,"=");return JSON.parse(Buffer.from(d,"base64").toString("utf8"))}function y(a){return 1e3*a.exp<Date.now()+9e5}},91264:(a,b,c)=>{var d=Object.create,e=Object.defineProperty,f=Object.getOwnPropertyDescriptor,g=Object.getOwnPropertyNames,h=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty,j=(a,b,c,d)=>{if(b&&"object"==typeof b||"function"==typeof b)for(let h of g(b))i.call(a,h)||h===c||e(a,h,{get:()=>b[h],enumerable:!(d=f(b,h))||d.enumerable});return a},k=(a,b,c)=>(c=null!=a?d(h(a)):{},j(!b&&a&&a.__esModule?c:e(c,"default",{value:a,enumerable:!0}),a)),l={};((a,b)=>{for(var c in b)e(a,c,{get:b[c],enumerable:!0})})(l,{findRootDir:()=>q,getUserDataDir:()=>r}),a.exports=j(e({},"__esModule",{value:!0}),l);var m=k(c(33873)),n=k(c(29021)),o=k(c(21820)),p=c(10726);function q(){try{let a=process.cwd();for(;a!==m.default.dirname(a);){let b=m.default.join(a,".vercel");if(n.default.existsSync(b))return a;a=m.default.dirname(a)}}catch(a){throw new p.VercelOidcTokenError("Token refresh only supported in node server environments")}throw new p.VercelOidcTokenError("Unable to find root directory")}function r(){if(process.env.XDG_DATA_HOME)return process.env.XDG_DATA_HOME;switch(o.default.platform()){case"darwin":return m.default.join(o.default.homedir(),"Library/Application Support");case"linux":return m.default.join(o.default.homedir(),".local/share");case"win32":if(process.env.LOCALAPPDATA)return process.env.LOCALAPPDATA;return null;default:return null}}}};