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 d(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 u(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 g(e){return new Set((e.toLowerCase().match(/[\p{L}\p{N}_-]{2,}/gu)??[]).filter(e=>!h.has(e)))}let h=new Set(["the","and","for","that","this","with","you","are","was","were","what","how","של","על","עם","את","זה","מה","איך"]);function m(){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 m()[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)||u(p(r.name))||i||u(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=>!h.has(e)).slice(0,8)}(s,a,l);return d({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,m()[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=g(t);if(0===r.size)return 0;let n=0,i=g([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)))),d=m();return d[e]=s,a=d,t.default.mkdirSync(r.default.dirname(i),{recursive:!0}),t.default.writeFileSync(i,JSON.stringify(a,null,2),"utf8"),s},"writeOrgSkill",0,d])},4627,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),g=e.i(74838),h=e.i(10372),m=e.i(93695);e.i(20232);var w=e.i(220),y=e.i(45919);async function v(e,t){let{id:r}=await t.params,n=(0,y.readOrgSkill)(r);return n?Response.json({skill:n},{headers:{"Cache-Control":"no-store"}}):Response.json({error:"skill not found"},{status:404})}async function R(e,t){let{id:r}=await t.params,n=(0,y.readOrgSkill)(r);if(!n)return Response.json({error:"skill not found"},{status:404});let i=await e.json(),a=(0,y.writeOrgSkill)({id:n.id,label:i.label??n.label,description:i.description??n.description,triggers:i.triggers??n.triggers,body:i.body??n.body});return Response.json({skill:a})}e.s(["GET",0,v,"PATCH",0,R],69463);var x=e.i(69463);let b=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/org/skills/[id]/route",pathname:"/api/org/skills/[id]",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/org/skills/[id]/route.ts",nextConfigOutput:"standalone",userland:x,...{}}),{workAsyncStorage:S,workUnitAsyncStorage:k,serverHooks:C}=b;async function E(e,t,n){n.requestMeta&&(0,i.setRequestMeta)(e,n.requestMeta),b.isDev&&(0,i.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let y="/api/org/skills/[id]/route";y=y.replace(/\/index$/,"")||"/";let v=await b.prepare(e,t,{srcPage:y,multiZoneDraftMode:!1});if(!v)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:R,params:x,nextConfig:S,parsedUrl:k,isDraftMode:C,prerenderManifest:E,routerServerContext:A,isOnDemandRevalidate:O,revalidateOnlyGenerated:j,resolvedPathname:T,clientReferenceManifest:N,serverActionsManifest:$}=v,_=(0,s.normalizeAppPath)(y),q=!!(E.dynamicRoutes[_]||E.routes[T]),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[T],t=E.dynamicRoutes[_];if(t&&!1===t.fallback&&!e){if(S.adapterPath)return await P();throw new m.NoFallbackError}}let I=null;!q||b.isDev||C||(I="/index"===(I=T)?"/":I);let H=!0===b.isDev||!q,U=q&&!H;$&&N&&(0,o.setManifestsSingleton)({page:y,clientReferenceManifest:N,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 b.getIncrementalCache(e,S,E,K);null==B||B.resetRequestCache(),globalThis.__incrementalCache=B;let z={params:x,previewProps:E.preview,renderOpts:{experimental:{authInterrupts:!!S.experimental.authInterrupts},cacheComponents:!!S.cacheComponents,supportsDynamicResponse:H,incrementalCache:B,cacheLifeProfiles:S.cacheLife,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,i)=>b.onRequestError(e,t,n,i,A)},sharedContext:{buildId:R}},W=new l.NodeNextRequest(e),G=new l.NodeNextResponse(t),V=d.NextRequestAdapter.fromNodeNextRequest(W,(0,d.signalFromNodeResponse)(t));try{let i,o=async e=>b.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")!==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=`${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} ${y}`)}),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[h.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>=h.INFINITE_CACHE)&&z.renderOpts.collectedRevalidate,n=void 0===z.renderOpts.collectedExpire||z.renderOpts.collectedExpire>=h.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 b.onRequestError(e,t,{routerKind:"App Router",routePath:y,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:O})},!1,A),t}},d=await b.handleResponse({req:e,nextConfig:S,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==d||null==(a=d.value)?void 0:a.kind)!==w.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});K||t.setHeader("x-nextjs-cache",O?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),C&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,f.fromNodeOutgoingHttpHeaders)(d.value.headers);return K&&q||u.delete(h.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,g.getCacheControlHeader)(d.cacheControl)),await (0,p.sendResponse)(W,G,new Response(d.value.body,{headers:u,status:d.value.status||200})),null};D&&F?await s(F):(i=M.getActiveScopeSpan(),await M.withPropagatedContext(e.headers,()=>M.trace(u.BaseServerSpan.handleRequest,{spanName:`${L} ${y}`,kind:a.SpanKind.SERVER,attributes:{"http.method":L,"http.target":e.url}},s),void 0,!D))}catch(t){if(t instanceof m.NoFallbackError||await b.onRequestError(e,t,{routerKind:"App Router",routePath:_,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:O})},!1,A),q)throw t;return await (0,p.sendResponse)(W,G,new Response(null,{status:500})),null}}e.s(["handler",0,E,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:S,workUnitAsyncStorage:k})},"routeModule",0,b,"serverHooks",0,C,"workAsyncStorage",0,S,"workUnitAsyncStorage",0,k],4627)}];

//# sourceMappingURL=%5Broot-of-the-server%5D__0c~i694._.js.map