import{_ as z}from"./AbstraButton.vue_vue_type_script_setup_true_lang-4O0X4FwR.js";import{e as B,T as S,H as T,r as c,Y as C,F as k,f as d,g as u,k as h,t as s,y as f,Q as _,n as e,R as p,G as t,B as D,Z as E,$ as F,aT as N,U as P,j as R,a_ as V,aq as $}from"./jwt-decode.esm-Bw7_fA5B.js";import{G as M}from"./PhArrowLeft.vue-Cw-XxaD-.js";import"./router-CZr_q44o.js";import{M as j,i as G}from"./member-BxjiNVgF.js";import{a as U}from"./organization-Dn5EE2cQ.js";import"./tables-Cfb9dDsg.js";import"./LoadingOutlined-CCC-cDSZ.js";import"./ts.worker-C335cFo8.js";import"./string-OOo_ZIMQ.js";(function(){try{var i=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},l=new Error().stack;l&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[l]="3383b441-fa32-4538-9a96-75c0d07fe1a4",i._sentryDebugIdIdentifier="sentry-dbid-3383b441-fa32-4538-9a96-75c0d07fe1a4")}catch{}})();const q={class:"ai-skills-page"},H={class:"ai-skills-header"},O={class:"header-left"},Q={key:0,class:"loading-container"},Y={key:0,class:"ai-skills-footer"},Z=B({__name:"AiSkills",setup(i){const l=S(),y=T(),n=l.params.organizationId,g=new U,w=new j,b=c(!0),m=c(!1),o=c(""),v=c(!1);C(async()=>{try{const[a,r]=await Promise.all([g.listSkills(n),w.me(n).catch(()=>null)]);a.length>0&&(o.value=a[0].content),v.value=G(r)}catch(a){k.error(a instanceof Error?a.message:"Failed to load skill")}finally{b.value=!1}});async function I(){m.value=!0;try{await g.upsertSkill(n,{content:o.value}),k.success(t.translate("i18n_aiskills_saved"))}catch(a){k.error(a instanceof Error?a.message:"Failed to save")}finally{m.value=!1}}function A(){y.push({name:"projects",params:{organizationId:n}})}return(a,r)=>(u(),d("div",q,[h("div",H,[h("div",O,[s(e(D),{type:"text",class:"back-button",onClick:A},{default:f(()=>[s(e(M),{size:16}),_(" "+p(e(t).translate("i18n_billing_back")),1)]),_:1}),s(e(E),{level:2,style:{margin:"0"}},{default:f(()=>[_(p(e(t).translate("i18n_aiskills_title")),1)]),_:1}),s(e(F),{type:"secondary"},{default:f(()=>[_(p(e(t).translate("i18n_aiskills_subtitle")),1)]),_:1})])]),b.value?(u(),d("div",Q,[s(e(N),{size:"large"})])):(u(),d(P,{key:1},[s(e(V),{value:o.value,"onUpdate:value":r[0]||(r[0]=x=>o.value=x),placeholder:e(t).translate("i18n_aiskills_placeholder"),"auto-size":{minRows:20},disabled:!v.value,class:"ai-skills-editor"},null,8,["value","placeholder","disabled"]),v.value?(u(),d("div",Y,[s(z,{type:"primary",loading:m.value,onClick:I},{default:f(()=>[_(p(e(t).translate("i18n_aiskills_save")),1)]),_:1},8,["loading"])])):R("",!0)],64))]))}}),le=$(Z,[["__scopeId","data-v-90157cc8"]]);export{le as default};
//# sourceMappingURL=AiSkills-CZ3PW11V.js.map
