import{_ as S}from"./AbstraButton.vue_vue_type_script_setup_true_lang-BpvNJyII.js";import{e as z,V as B,J as C,r as c,$ as D,H as k,f as d,g as u,k as h,q as s,w as f,R as _,p as e,S as p,l as t,B as V,a0 as $,U as E,aU as N,W as P,j as R,a$ as T,ar as F}from"./jwt-decode.esm-CZajAnkk.js";import{G as M}from"./PhArrowLeft.vue-BlHQD7SF.js";import"./router-C8CCuUKN.js";import{M as U,i as j}from"./member-D3C_DPKf.js";import{a as q}from"./organization-CkvaBeNd.js";import"./tables-BosOXgsx.js";import"./LoadingOutlined-C3cOtTgj.js";import"./ts.worker-CbdM7mxv.js";import"./string-CFhNxAoY.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]="1f283088-f2a4-42d0-9e96-576e1b8b8c26",i._sentryDebugIdIdentifier="sentry-dbid-1f283088-f2a4-42d0-9e96-576e1b8b8c26")}catch{}})();const G={class:"ai-skills-page"},H={class:"ai-skills-header"},J={class:"header-left"},O={key:0,class:"loading-container"},W={key:0,class:"ai-skills-footer"},K=z({__name:"AiSkills",setup(i){const l=B(),g=C(),n=l.params.organizationId,y=new q,w=new U,b=c(!0),m=c(!1),o=c(""),v=c(!1);D(async()=>{try{const[a,r]=await Promise.all([y.listSkills(n),w.me(n).catch(()=>null)]);a.length>0&&(o.value=a[0].content),v.value=j(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 y.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(){g.push({name:"projects",params:{organizationId:n}})}return(a,r)=>(u(),d("div",G,[h("div",H,[h("div",J,[s(e(V),{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($),{level:2,style:{margin:"0"}},{default:f(()=>[_(p(e(t).translate("i18n_aiskills_title")),1)]),_:1}),s(e(E),{type:"secondary"},{default:f(()=>[_(p(e(t).translate("i18n_aiskills_subtitle")),1)]),_:1})])]),b.value?(u(),d("div",O,[s(e(N),{size:"large"})])):(u(),d(P,{key:1},[s(e(T),{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",W,[s(S,{type:"primary",loading:m.value,onClick:I},{default:f(()=>[_(p(e(t).translate("i18n_aiskills_save")),1)]),_:1},8,["loading"])])):R("",!0)],64))]))}}),le=F(K,[["__scopeId","data-v-90157cc8"]]);export{le as default};
//# sourceMappingURL=AiSkills-CxOw9Lts.js.map
