import{d as x,e as I,m as S,n as w,M as y,u as t,A as o,l as d,z as g,x as B,y as b}from"../../../../common/index.CPcBO1Os.js";import{a as k}from"../../../../common/vue-router.jJOaD9p9.js";import{a as C}from"../../../../common/index.BA7kDUNA.js";import{u as z,s as N}from"../index.CjI1uML7.js";import{u as T}from"../../../../common/index.B24w2ZeB.js";import D from"./AIAgentIcon.BOnBhzPT.js";import{S as E}from"../../../../common/index.CXHDE9hf.js";import{B as V}from"../../../../common/index.B1jVoQr7.js";import{_ as $}from"../../../../common/_plugin-vue_export-helper.DlAUqK2U.js";import"../../../../common/index.TkDYtvUB.js";import"../../../../common/KeyCode.D63Tfrq7.js";import"../../../../common/index.B91jMiUk.js";import"../../../../common/_getTag.5j88QV3u.js";import"../../../../common/useState.DXwtWea_.js";import"../../../../common/FormItemContext.Bd2ze9Fn.js";import"../../../../common/compact-item.BK6dH04p.js";import"../../../../common/omit.ddwJ_9WE.js";import"../../../../common/devWarning.DpJYEIzv.js";import"../../../../common/Compact.B3btkLRg.js";const R=["id"],q={class:"ai-agent-box-header"},G={class:"ai-agent-title-status"},M={class:"ai-agent-title"},P={class:"ai-agent-status"},U={class:"ai-agent-description"},j={class:"ai-agent-footer"},F=x({__name:"AiAgentBox",props:{agentId:{}},setup(p){var m;const a=p,c=z(),{aiAgents:l}=N(c),{emit:u}=T("saaiSettingsSaved"),{__:n,sprintf:_}=window.wp.i18n,f=k(),e=l.value[c.getAgentIndex(a.agentId)],i=I(e.status==="active"&&((m=e==null?void 0:e.settings)==null?void 0:m.enabled)==="yes"),h=r=>{i.value=r,l.value[c.getAgentIndex(a.agentId)].settings.enabled=r?"yes":"no",C().post("storeagent-ai/v1/".concat(a.agentId,"/settings/save"),{enabled:r?"yes":"no"}).then(s=>{u(a.agentId)}).catch(s=>{console.error(s)})},v=()=>{f.replace({name:"IndexPage",query:{page:"storeagent-settings",subpage:"ai-agents",agent:e.id}})};return(r,s)=>(w(),S("div",{id:"agent-".concat(t(e).id),class:"saai-agent-box",style:y({transitionDelay:"".concat(t(e).id.charCodeAt(0)%5*.005,"s")})},[o("div",q,[d(D,{icon:t(e).icon,alt:t(_)(t(n)("%s logo","storeagent-ai-for-woocommerce"),t(e).title)},null,8,["icon","alt"]),o("div",G,[o("h3",M,g(t(e).title),1),o("p",P,[d(t(E),{title:i.value?t(n)("Deactivate this agent","storeagent-ai-for-woocommerce"):t(n)("Activate this agent","storeagent-ai-for-woocommerce"),checked:i.value,"onUpdate:checked":s[0]||(s[0]=A=>i.value=A),size:"default",onChange:h},null,8,["title","checked"])])])]),o("p",U,g(t(e).description),1),o("div",j,[d(t(V),{size:"small",onClick:v},{default:B(()=>[b(g(t(n)("SETTINGS","storeagent-ai-for-woocommerce")),1)]),_:1})])],12,R))}}),dt=$(F,[["__scopeId","data-v-0dcae5bc"]]);export{dt as default};
