import{b as a}from"./vendor-lit-B2r-dKc0.js";import{s as c,p as d}from"./app-review-C3CmcSYC.js";import"./app-session-runtime-CeFJDILJ.js";let n="system";function b(){return n}function h(e){n=e}function y(){return n==="system"?void 0:n}const f={builtin:"bg-muted text-muted-foreground",server:"config-origin-server",project:"config-origin-project"};function $(e,t){return e?a`
		<span class="inline-flex items-center gap-1 shrink-0">
			<span class="config-origin-badge ${f[e]}">${e}</span>
			${t?a`<span class="config-origin-overrides">overrides ${t}</span>`:""}
		</span>
	`:""}function k(e){return e?n==="system"?e==="builtin":e!=="project":!1}function v(e,t,s){const o=c.projects||[];return o.length===0?"":a`
		<div class="shrink-0 flex items-center gap-1 px-4 py-2 border-b border-border overflow-x-auto" style="scrollbar-width:thin;">
			${s?"":a`<button
				class="px-3 py-1.5 text-sm rounded-md transition-colors whitespace-nowrap shrink-0
					${e==="system"?"bg-background text-foreground shadow-sm border border-border":"text-muted-foreground hover:text-foreground hover:bg-secondary/50"}"
				@click=${()=>t("system")}
			>System</button>`}
			${o.map(r=>{const i=e===r.id,u=document.documentElement.classList.contains("dark")?r.colorDark||r.color||"var(--muted-foreground)":r.colorLight||r.color||"var(--muted-foreground)";return a`
					<button
						class="px-3 py-1.5 text-sm rounded-md transition-colors whitespace-nowrap shrink-0 flex items-center gap-1.5
							${i?"bg-background text-foreground shadow-sm border border-border":"text-muted-foreground hover:text-foreground hover:bg-secondary/50"}"
						@click=${()=>t(r.id)}
					>
						<span class="inline-block w-2 h-2 rounded-full shrink-0" style="background:${u};"></span>
						${r.name}
					</button>
				`})}
		</div>
	`}async function x(e,t,s,o){try{const r=new URLSearchParams({scope:s});return o&&r.set("projectId",o),(await d(`/api/${e}/${encodeURIComponent(t)}/customize?${r}`,{method:"POST"})).ok}catch{return!1}}async function w(e,t,s,o){try{const r=new URLSearchParams({scope:s});return o&&r.set("projectId",o),(await d(`/api/${e}/${encodeURIComponent(t)}/override?${r}`,{method:"DELETE"})).ok}catch{return!1}}function S(){return n==="system"?"":(c.projects||[]).find(t=>t.id===n)?.name||"Project"}export{b as a,$ as b,x as c,w as d,S as e,y as g,k as i,v as r,h as s};
