module.exports=[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"))},45919,e=>{"use strict";var t=e.i(22734),r=e.i(14747);let n=r.default.join(process.cwd(),"data","org-skills"),i=r.default.join(process.cwd(),"data","org","skill-assignments.json"),a=/^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/;function o(e){let t=e.match(a);if(!t)return{fm:{},body:e};let r={};for(let e of t[1].split("\n")){let t=e.match(/^([a-zA-Z_]+):\s*(.+)$/);if(!t)continue;let n=t[1],i=t[2].trim();if(i.startsWith("[")&&i.endsWith("]")){let e=i.slice(1,-1).trim();r[n]=e?e.split(",").map(e=>e.trim().replace(/^['"]|['"]$/g,"")):[];continue}r[n]=i.replace(/^['"]|['"]$/g,"")}return{fm:r,body:t[2]?.trim()??""}}function s(e){let i=r.default.join(n,c(e),"SKILL.md");try{let r=t.default.readFileSync(i,"utf8"),{fm:n,body:a}=o(r);return{id:p(n.id)||e,label:p(n.label)||e,description:p(n.description),triggers:f(n.triggers),body:a}}catch{return null}}function l(){try{return t.default.readdirSync(n,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>s(e.name)).filter(e=>!!e).sort((e,t)=>e.label.localeCompare(t.label))}catch{return[]}}function u(e){var i;let a=c(e.id.trim().toLowerCase());if(!a)throw Error("skill id is required");let o={id:a,label:e.label.trim()||a,description:e.description.trim(),triggers:e.triggers.map(e=>e.trim()).filter(Boolean),body:e.body.trim()},s=r.default.join(n,a);return t.default.mkdirSync(s,{recursive:!0}),t.default.writeFileSync(r.default.join(s,"SKILL.md"),(i=o,`---
id: ${i.id}
label: ${i.label}
description: ${i.description}
triggers: [${i.triggers.join(", ")}]
---

${i.body.replace(/\s+$/,"")}
`),"utf8"),o}function d(e){return e.replace(/\.md$/i,"").replace(/^skill$/i,"").replace(/[-_]+/g," ").trim().replace(/\b\w/g,e=>e.toUpperCase())}function c(e){return e.replace(/[^a-zA-Z0-9_-]/g,"_")}function p(e){return"string"==typeof e?e:""}function f(e){return Array.isArray(e)?e:"string"==typeof e&&e?[e]:[]}function h(e){return new Set((e.toLowerCase().match(/[\p{L}\p{N}_-]{2,}/gu)??[]).filter(e=>!m.has(e)))}let m=new Set(["the","and","for","that","this","with","you","are","was","were","what","how","של","על","עם","את","זה","מה","איך"]);function g(){try{return JSON.parse(t.default.readFileSync(i,"utf8"))}catch{return{}}}e.s(["formatOrgSkillsBlock",0,function(e){if(0===e.length)return"";let t=e.map(({skill:e})=>`## ${e.label} (${e.id})

${e.body}`).join("\n\n---\n\n");return`# Relevant organization skills

These are organization-level playbooks assigned to this employee. Use them to
shape how work is performed. They do not override hard boundaries, approval
policy, or the employee's profile files.

${t}`},"getAssignedOrgSkillIdsForEmployee",0,function(e,t=[]){return g()[e]??t},"importOrgSkillMarkdown",0,function(e){let t,{fm:r,body:n}=o(e.content),i=(t=n.match(/^#\s+(.+)$/m),t?.[1]?.trim()??""),a=p(r.label)||d(p(r.name))||i||d(e.filename.replace(/\.md$/i,"")),s=p(r.id)||p(r.name)||a||e.filename.replace(/\.md$/i,""),l=p(r.description),c=f(r.triggers).length>0?f(r.triggers):function(...e){return Array.from(new Set(e.join(" ").toLowerCase().match(/[\p{L}\p{N}_-]{3,}/gu)??[])).filter(e=>!m.has(e)).slice(0,8)}(s,a,l);return u({id:s,label:a,description:l,triggers:c,body:n.trim()||e.content.trim()})},"listOrgSkills",0,l,"readOrgSkill",0,s,"selectOrgSkillsForRun",0,function(e,t,r=3){var n;let i=(n=e,g()[n.id]??n.orgSkillIds).map(s).filter(e=>!!e);if(0===i.length)return[];let a=i.map(e=>({skill:e,score:function(e,t){let r=h(t);if(0===r.size)return 0;let n=0,i=h([e.id,e.label,e.description,e.triggers.join(" ")].join(" ").toLowerCase());for(let e of r)i.has(e)&&(n+=1);for(let r of e.triggers)t.toLowerCase().includes(r.toLowerCase())&&(n+=2);return n}(e,t)})).sort((e,t)=>t.score-e.score),o=a.filter(e=>e.score>0);return(o.length>0?o:a).slice(0,r)},"setAssignedOrgSkillIds",0,function(e,n){var a;let o=new Set(l().map(e=>e.id)),s=Array.from(new Set(n.map(e=>c(e)).filter(e=>o.has(e)))),u=g();return u[e]=s,a=u,t.default.mkdirSync(r.default.dirname(i),{recursive:!0}),t.default.writeFileSync(i,JSON.stringify(a,null,2),"utf8"),s},"writeOrgSkill",0,u])},12383,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),u=e.i(87718),d=e.i(95169),c=e.i(47587),p=e.i(66012),f=e.i(70101),h=e.i(74838),m=e.i(10372),g=e.i(93695);e.i(20232);var w=e.i(220),v=e.i(45919);async function y(e){let t=(await e.json()).files??[];if(0===t.length)return Response.json({error:"files are required"},{status:400});let r=[],n=[];for(let e of t){if(!e.filename||!e.content){n.push({filename:e.filename??"unknown",error:"missing filename or content"});continue}try{r.push((0,v.importOrgSkillMarkdown)({filename:e.filename,content:e.content}))}catch(t){n.push({filename:e.filename,error:t instanceof Error?t.message:"import failed"})}}return Response.json({imported:r,errors:n})}e.s(["POST",0,y],8958);var R=e.i(8958);let x=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/org/skills/import/route",pathname:"/api/org/skills/import",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/org/skills/import/route.ts",nextConfigOutput:"standalone",userland:R,...{}}),{workAsyncStorage:S,workUnitAsyncStorage:b,serverHooks:k}=x;async function C(e,t,n){n.requestMeta&&(0,i.setRequestMeta)(e,n.requestMeta),x.isDev&&(0,i.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let v="/api/org/skills/import/route";v=v.replace(/\/index$/,"")||"/";let y=await x.prepare(e,t,{srcPage:v,multiZoneDraftMode:!1});if(!y)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:R,params:S,nextConfig:b,parsedUrl:k,isDraftMode:C,prerenderManifest:E,routerServerContext:A,isOnDemandRevalidate:O,revalidateOnlyGenerated:j,resolvedPathname:N,clientReferenceManifest:T,serverActionsManifest:$}=y,_=(0,s.normalizeAppPath)(v),q=!!(E.dynamicRoutes[_]||E.routes[N]),P=async()=>((null==A?void 0:A.render404)?await A.render404(e,t,k,!1):t.end("This page could not be found"),null);if(q&&!C){let e=!!E.routes[N],t=E.dynamicRoutes[_];if(t&&!1===t.fallback&&!e){if(b.adapterPath)return await P();throw new g.NoFallbackError}}let I=null;!q||x.isDev||C||(I="/index"===(I=N)?"/":I);let U=!0===x.isDev||!q,H=q&&!U;$&&T&&(0,o.setManifestsSingleton)({page:v,clientReferenceManifest:T,serverActionsManifest:$});let L=e.method||"GET",M=(0,a.getTracer)(),F=M.getActiveScopeSpan(),D=!!(null==A?void 0:A.isWrappedByNextServer),K=!!(0,i.getRequestMeta)(e,"minimalMode"),B=(0,i.getRequestMeta)(e,"incrementalCache")||await x.getIncrementalCache(e,b,E,K);null==B||B.resetRequestCache(),globalThis.__incrementalCache=B;let z={params:S,previewProps:E.preview,renderOpts:{experimental:{authInterrupts:!!b.experimental.authInterrupts},cacheComponents:!!b.cacheComponents,supportsDynamicResponse:U,incrementalCache:B,cacheLifeProfiles:b.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,i)=>x.onRequestError(e,t,n,i,A)},sharedContext:{buildId:R}},W=new l.NodeNextRequest(e),G=new l.NodeNextResponse(t),V=u.NextRequestAdapter.fromNodeNextRequest(W,(0,u.signalFromNodeResponse)(t));try{let i,o=async e=>x.handle(V,z).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=M.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 n=r.get("next.route");if(n){let t=`${L} ${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(`${L} ${v}`)}),s=async i=>{var a,s;let l=async({previousCacheEntry:r})=>{try{if(!K&&O&&j&&!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=z.renderOpts.fetchMetrics;let s=z.renderOpts.pendingWaitUntil;s&&n.waitUntil&&(n.waitUntil(s),s=void 0);let l=z.renderOpts.collectedTags;if(!q)return await (0,p.sendResponse)(W,G,a,z.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!==z.renderOpts.collectedRevalidate&&!(z.renderOpts.collectedRevalidate>=m.INFINITE_CACHE)&&z.renderOpts.collectedRevalidate,n=void 0===z.renderOpts.collectedExpire||z.renderOpts.collectedExpire>=m.INFINITE_CACHE?void 0:z.renderOpts.collectedExpire;return{value:{kind:w.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 x.onRequestError(e,t,{routerKind:"App Router",routePath:v,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:O})},!1,A),t}},u=await x.handleResponse({req:e,nextConfig:b,cacheKey:I,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:E,isRoutePPREnabled:!1,isOnDemandRevalidate:O,revalidateOnlyGenerated:j,responseGenerator:l,waitUntil:n.waitUntil,isMinimalMode:K});if(!q)return null;if((null==u||null==(a=u.value)?void 0:a.kind)!==w.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==u||null==(s=u.value)?void 0:s.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});K||t.setHeader("x-nextjs-cache",O?"REVALIDATED":u.isMiss?"MISS":u.isStale?"STALE":"HIT"),C&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let d=(0,f.fromNodeOutgoingHttpHeaders)(u.value.headers);return K&&q||d.delete(m.NEXT_CACHE_TAGS_HEADER),!u.cacheControl||t.getHeader("Cache-Control")||d.get("Cache-Control")||d.set("Cache-Control",(0,h.getCacheControlHeader)(u.cacheControl)),await (0,p.sendResponse)(W,G,new Response(u.value.body,{headers:d,status:u.value.status||200})),null};D&&F?await s(F):(i=M.getActiveScopeSpan(),await M.withPropagatedContext(e.headers,()=>M.trace(d.BaseServerSpan.handleRequest,{spanName:`${L} ${v}`,kind:a.SpanKind.SERVER,attributes:{"http.method":L,"http.target":e.url}},s),void 0,!D))}catch(t){if(t instanceof g.NoFallbackError||await x.onRequestError(e,t,{routerKind:"App Router",routePath:_,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:O})},!1,A),q)throw t;return await (0,p.sendResponse)(W,G,new Response(null,{status:500})),null}}e.s(["handler",0,C,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:S,workUnitAsyncStorage:b})},"routeModule",0,x,"serverHooks",0,k,"workAsyncStorage",0,S,"workUnitAsyncStorage",0,b],12383)}];

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