module.exports=[24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},24868,(e,t,r)=>{t.exports=e.x("fs/promises",()=>require("fs/promises"))},54799,(e,t,r)=>{t.exports=e.x("crypto",()=>require("crypto"))},8098,e=>{"use strict";var t=e.i(22734),r=e.i(24868),n=e.i(14747),i=e.i(54799);function a(e){return"number"==typeof e.lookbackDays?e:{...e,lookbackDays:90}}function o(){return n.default.join(process.cwd(),"data","invites.json")}function s(){let e=n.default.dirname(o());t.default.existsSync(e)||t.default.mkdirSync(e,{recursive:!0})}function l(){try{if(!t.default.existsSync(o()))return[];let e=t.default.readFileSync(o(),"utf8"),r=JSON.parse(e);return Array.isArray(r)?r:[]}catch{return[]}}function d(e){s(),t.default.writeFileSync(o(),JSON.stringify(e,null,2),"utf8")}function u(e){if(!e.startsWith("inv_"))return;let t=l().find(t=>t.token===e);return t?a(t):void 0}function c(e){let t=u(e);return t?t.completedAt?{ok:!1,reason:"used",invite:t}:new Date(t.expiresAt).getTime()<Date.now()?{ok:!1,reason:"expired",invite:t}:{ok:!0,invite:t}:{ok:!1,reason:"not_found"}}let p=["EXPERTISE","DECISIONS","CONTEXT","PEOPLE","PROJECTS","PREFERENCES","TONE","BOUNDARIES","EMPLOYMENT"];function f(e){return e.toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64)}async function v(e,t){let i,a,o=u(e);if(!o)throw Error("invite not found");if(o.employeeId)return{employeeId:o.employeeId,reused:!0};let s=(t?.name||o.name||"").trim(),c=(t?.role||o.role||"").trim(),v=f(s);v||(v=f(c)),v||(v=`pending-${e.slice(4,10)}`);let m=`${v}-${e.slice(4,10)}`,g=n.default.join(process.cwd(),"data","employees",m),h=n.default.join(g,"employee.json");try{return await r.default.access(h),{employeeId:m,reused:!0}}catch{}await r.default.mkdir(g,{recursive:!0});let x=s||`Pending (${e.slice(4,10)})`,y=(i=new Date().toISOString().slice(0,10),(a={}).EMPLOYMENT=`# Employment — ${x}

- Name: ${x}
${c?`- Role: ${c}
`:""}- Onboarded: ${i}
`,a.EXPERTISE=`# Expertise — ${x}

_To be filled in during onboarding._
`,a.BOUNDARIES=`# Boundaries — ${x}

_To be filled in during onboarding._
`,a.CONTEXT=`# Context — ${x}

_To be filled in during onboarding._
`,a.DECISIONS=`# Decisions — ${x}

_To be filled in during onboarding._
`,a.PEOPLE=`# People — ${x}

_To be filled in during onboarding._
`,a.PROJECTS=`# Projects — ${x}

_To be filled in during onboarding._
`,a.PREFERENCES=`# Preferences — ${x}

_To be filled in during onboarding._
`,a.TONE=`# Tone — ${x}

_To be filled in during onboarding._
`,a);return await Promise.all(p.map(async e=>{let t=n.default.join(g,`${e}.md`);try{await r.default.access(t)}catch{await r.default.writeFile(t,y[e],"utf8")}})),await r.default.writeFile(h,JSON.stringify({id:m,name:x,role:c||null,integrations:[],createdAt:new Date().toISOString(),lastActiveAt:new Date().toISOString(),via:{invite:e},pendingProfile:!s},null,2),"utf8"),!function(e,t){let r=l(),n=r.findIndex(t=>t.token===e);if(n<0)return;let i=r[n];i.employeeId===t||i.employeeId&&i.employeeId!==t||(r[n]={...i,employeeId:t},d(r))}(e,m),{employeeId:m,reused:!1}}e.s(["bulkRevokeInvites",0,function(e){let t=Date.now(),r=l(),n=[],i=r.filter(r=>!(!r.completedAt&&("expired"===e?new Date(r.expiresAt).getTime()<t:!r.employeeId))||(n.push(r.token),!1));return n.length>0&&d(i),{removed:n.length,tokens:n}},"classifyInvite",0,c,"createInvite",0,function(e){let t=`inv_${(0,i.randomBytes)(20).toString("hex")}`,r=new Date,n=new Date(r.getTime()+12096e5),a={token:t,name:e.name?.trim()||void 0,role:e.role?.trim()||void 0,createdAt:r.toISOString(),expiresAt:n.toISOString(),lookbackDays:function(e){let t="number"==typeof e?e:Number(e);if(!Number.isFinite(t))return 90;let r=Math.round(t);return r<30?30:r>360?360:r}(void 0===e.lookbackDays?90:e.lookbackDays)},o=l();return o.push(a),d(o),a},"findInvite",0,u,"isInviteRedeemable",0,function(e){let t=u(e);if(t&&!t.completedAt&&!(new Date(t.expiresAt).getTime()<Date.now()))return t},"listInvites",0,function(){return l().filter(e=>"string"==typeof e?.token).map(a).sort((e,t)=>t.createdAt.localeCompare(e.createdAt))},"markInviteCompleted",0,function(e,t){let r=l(),n=r.findIndex(t=>t.token===e);if(-1!==n)return r[n]={...r[n],completedAt:new Date().toISOString(),employeeId:t},d(r),r[n]},"materializeEmployeeFromInvite",0,v,"releaseInviteClaim",0,function(e){let r=n.default.join(n.default.dirname(o()),`.invite-${e}.lock`);try{t.default.unlinkSync(r)}catch{}},"revokeInvite",0,function(e){let t=l(),r=t.filter(t=>t.token!==e);return r.length!==t.length&&(d(r),!0)},"tryClaimInvite",0,function(e){let r=c(e);if(!r.ok)return{claimed:!1,reason:r.reason};s();let i=n.default.join(n.default.dirname(o()),`.invite-${e}.lock`);try{t.default.writeFileSync(i,String(process.pid),{flag:"wx"});let r=c(e);if(!r.ok){try{t.default.unlinkSync(i)}catch{}return{claimed:!1,reason:r.reason}}return{claimed:!0}}catch(e){if(e&&"EEXIST"===e.code)return{claimed:!1,reason:"already_claimed"};throw e}}])},13570,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),i=e.i(59756),a=e.i(61916),o=e.i(74677),s=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),c=e.i(47587),p=e.i(66012),f=e.i(70101),v=e.i(74838),m=e.i(10372),g=e.i(93695);e.i(20232);var h=e.i(220),x=e.i(89171),y=e.i(8098);let E=["expired","unused"];async function R(e){let t={};try{t=await e.json()}catch{}let r=t.scope;if("string"!=typeof r||!E.includes(r))return x.NextResponse.json({error:"invalid_scope",message:`scope must be one of: ${E.join(", ")}`},{status:400});let n=(0,y.bulkRevokeInvites)(r);return x.NextResponse.json(n)}e.s(["POST",0,R,"runtime",0,"nodejs"],43033);var w=e.i(43033);let k=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/invites/bulk-revoke/route",pathname:"/api/invites/bulk-revoke",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/invites/bulk-revoke/route.ts",nextConfigOutput:"standalone",userland:w,...{}}),{workAsyncStorage:b,workUnitAsyncStorage:S,serverHooks:I}=k;async function T(e,t,n){n.requestMeta&&(0,i.setRequestMeta)(e,n.requestMeta),k.isDev&&(0,i.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let x="/api/invites/bulk-revoke/route";x=x.replace(/\/index$/,"")||"/";let y=await k.prepare(e,t,{srcPage:x,multiZoneDraftMode:!1});if(!y)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:E,params:R,nextConfig:w,parsedUrl:b,isDraftMode:S,prerenderManifest:I,routerServerContext:T,isOnDemandRevalidate:C,revalidateOnlyGenerated:A,resolvedPathname:N,clientReferenceManifest:O,serverActionsManifest:P}=y,_=(0,s.normalizeAppPath)(x),D=!!(I.dynamicRoutes[_]||I.routes[N]),$=async()=>((null==T?void 0:T.render404)?await T.render404(e,t,b,!1):t.end("This page could not be found"),null);if(D&&!S){let e=!!I.routes[N],t=I.dynamicRoutes[_];if(t&&!1===t.fallback&&!e){if(w.adapterPath)return await $();throw new g.NoFallbackError}}let j=null;!D||k.isDev||S||(j="/index"===(j=N)?"/":j);let q=!0===k.isDev||!D,M=D&&!q;P&&O&&(0,o.setManifestsSingleton)({page:x,clientReferenceManifest:O,serverActionsManifest:P});let F=e.method||"GET",U=(0,a.getTracer)(),H=U.getActiveScopeSpan(),B=!!(null==T?void 0:T.isWrappedByNextServer),L=!!(0,i.getRequestMeta)(e,"minimalMode"),K=(0,i.getRequestMeta)(e,"incrementalCache")||await k.getIncrementalCache(e,w,I,L);null==K||K.resetRequestCache(),globalThis.__incrementalCache=K;let X={params:R,previewProps:I.preview,renderOpts:{experimental:{authInterrupts:!!w.experimental.authInterrupts},cacheComponents:!!w.cacheComponents,supportsDynamicResponse:q,incrementalCache:K,cacheLifeProfiles:w.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,i)=>k.onRequestError(e,t,n,i,T)},sharedContext:{buildId:E}},J=new l.NodeNextRequest(e),z=new l.NodeNextResponse(t),W=d.NextRequestAdapter.fromNodeNextRequest(J,(0,d.signalFromNodeResponse)(t));try{let i,o=async e=>k.handle(W,X).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=U.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.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 n=r.get("next.route");if(n){let t=`${F} ${n}`;e.setAttributes({"next.route":n,"http.route":n,"next.span_name":t}),e.updateName(t),i&&i!==e&&(i.setAttribute("http.route",n),i.updateName(t))}else e.updateName(`${F} ${x}`)}),s=async i=>{var a,s;let l=async({previousCacheEntry:r})=>{try{if(!L&&C&&A&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let a=await o(i);e.fetchMetrics=X.renderOpts.fetchMetrics;let s=X.renderOpts.pendingWaitUntil;s&&n.waitUntil&&(n.waitUntil(s),s=void 0);let l=X.renderOpts.collectedTags;if(!D)return await (0,p.sendResponse)(J,z,a,X.renderOpts.pendingWaitUntil),null;{let e=await a.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(a.headers);l&&(t[m.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==X.renderOpts.collectedRevalidate&&!(X.renderOpts.collectedRevalidate>=m.INFINITE_CACHE)&&X.renderOpts.collectedRevalidate,n=void 0===X.renderOpts.collectedExpire||X.renderOpts.collectedExpire>=m.INFINITE_CACHE?void 0:X.renderOpts.collectedExpire;return{value:{kind:h.CachedRouteKind.APP_ROUTE,status:a.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await k.onRequestError(e,t,{routerKind:"App Router",routePath:x,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:C})},!1,T),t}},d=await k.handleResponse({req:e,nextConfig:w,cacheKey:j,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:I,isRoutePPREnabled:!1,isOnDemandRevalidate:C,revalidateOnlyGenerated:A,responseGenerator:l,waitUntil:n.waitUntil,isMinimalMode:L});if(!D)return null;if((null==d||null==(a=d.value)?void 0:a.kind)!==h.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(s=d.value)?void 0:s.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});L||t.setHeader("x-nextjs-cache",C?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),S&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,f.fromNodeOutgoingHttpHeaders)(d.value.headers);return L&&D||u.delete(m.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,v.getCacheControlHeader)(d.cacheControl)),await (0,p.sendResponse)(J,z,new Response(d.value.body,{headers:u,status:d.value.status||200})),null};B&&H?await s(H):(i=U.getActiveScopeSpan(),await U.withPropagatedContext(e.headers,()=>U.trace(u.BaseServerSpan.handleRequest,{spanName:`${F} ${x}`,kind:a.SpanKind.SERVER,attributes:{"http.method":F,"http.target":e.url}},s),void 0,!B))}catch(t){if(t instanceof g.NoFallbackError||await k.onRequestError(e,t,{routerKind:"App Router",routePath:_,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:C})},!1,T),D)throw t;return await (0,p.sendResponse)(J,z,new Response(null,{status:500})),null}}e.s(["handler",0,T,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:b,workUnitAsyncStorage:S})},"routeModule",0,k,"serverHooks",0,I,"workAsyncStorage",0,b,"workUnitAsyncStorage",0,S],13570)}];

//# sourceMappingURL=%5Broot-of-the-server%5D__12ky.dn._.js.map