(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,93703,e=>{"use strict";var r=e.i(43476),t=e.i(71645);e.s(["default",0,function(){let[e,o]=(0,t.useState)("prompt"),[n,a]=(0,t.useState)(""),[i,s]=(0,t.useState)(""),[d,l]=(0,t.useState)(!1),[c,p]=(0,t.useState)("");(0,t.useEffect)(()=>{(async()=>{try{let e=await fetch("/api/context");if(e.ok){let r=await e.json();a(r.prompt||""),s(r.rules||"")}}catch(e){console.error("Failed to load context:",e)}})()},[]);let u=async()=>{l(!0),p("");try{(await fetch("/api/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({promptText:n,rulesText:i})})).ok?(p("✓ Saved and staging recompiled successfully!"),setTimeout(()=>p(""),4e3)):p("✗ Error saving context files.")}catch(e){console.error(e),p("✗ Network failure.")}finally{l(!1)}};return(0,r.jsxs)("div",{style:{border:"1px solid var(--border)",borderRadius:"12px",backgroundColor:"var(--card)",overflow:"hidden",marginTop:"1.5rem"},children:[(0,r.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",background:"hsla(var(--border-hsl), 0.3)",borderBottom:"1px solid var(--border)",padding:"0.5rem 1rem"},children:[(0,r.jsxs)("div",{style:{display:"flex",gap:"0.5rem"},children:[(0,r.jsx)("button",{onClick:()=>o("prompt"),style:{padding:"0.5rem 1rem",borderRadius:"6px",border:"none",background:"prompt"===e?"var(--border)":"transparent",color:"prompt"===e?"var(--foreground)":"var(--muted)",fontSize:"0.825rem",fontWeight:600},children:"✏️ Staged Prompt (cprompt.md)"}),(0,r.jsx)("button",{onClick:()=>o("rules"),style:{padding:"0.5rem 1rem",borderRadius:"6px",border:"none",background:"rules"===e?"var(--border)":"transparent",color:"rules"===e?"var(--foreground)":"var(--muted)",fontSize:"0.825rem",fontWeight:600},children:"📋 System Rules (AGENTS.md)"})]}),(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"1rem"},children:[c&&(0,r.jsx)("span",{style:{fontSize:"0.75rem",color:c.startsWith("✓")?"var(--success)":"var(--danger)"},children:c}),(0,r.jsx)("button",{onClick:u,disabled:d,style:{padding:"0.4rem 1rem",borderRadius:"6px",border:"none",backgroundColor:"var(--primary)",color:"#fff",fontSize:"0.75rem",fontWeight:600,opacity:d?.7:1},children:d?"Saving...":"Save & Recompile"})]})]}),(0,r.jsx)("div",{style:{position:"relative"},children:"prompt"===e?(0,r.jsx)("textarea",{value:n,onChange:e=>a(e.target.value),placeholder:"Type staged instructions for your next prompt trigger (/ccp)...",style:{width:"100%",height:"220px",padding:"1rem",background:"#080c14",border:"none",color:"#c9d1d9",fontFamily:"var(--font-mono), monospace",fontSize:"0.825rem",lineHeight:1.5,resize:"vertical",outline:"none"}}):(0,r.jsx)("textarea",{value:i,onChange:e=>s(e.target.value),placeholder:"Define global instructions, guidelines, style patterns for your agents...",style:{width:"100%",height:"220px",padding:"1rem",background:"#080c14",border:"none",color:"#c9d1d9",fontFamily:"var(--font-mono), monospace",fontSize:"0.825rem",lineHeight:1.5,resize:"vertical",outline:"none"}})})]})}])},1985,e=>{e.n(e.i(93703))}]);