1import{s as B,l as y,i as I,d as f,j as V,p as T,r as U,e as g,c as h,a as k,f as $,g as N,n as W,k as q,o as C}from"../chunks/BJxi2uby.js";import{S as D,i as P,a as p,c as j,t as _,g as H,b as v,d as E,m as b,e as w}from"../chunks/nvZPBZPx.js";import{g as K}from"../chunks/CiwcbNGJ.js";import{p as Q}from"../chunks/BzZTU-KT.js";import{d as z,e as F,b as M}from"../chunks/D0jdIh6e.js";import{S as A}from"../chunks/DLb9suLr.js";import{T as G}from"../chunks/DoFyIjX1.js";import{j as R,t as J}from"../chunks/LZ6VP8CG.js";import{e as L,c as X}from"../chunks/C1G4X3g3.js";import{t as d}from"../chunks/CD5_q8jn.js";import{W as Y}from"../chunks/Bu7uzx3b.js";import{l as Z}from"../chunks/BbXpsXtm.js";function x(l){let o,t,c,s;return c=new A({}),{c(){o=g("div"),t=g("div"),v(c.$$.fragment),this.h()},l(i){o=h(i,"DIV",{class:!0});var e=k(o);t=h(e,"DIV",{class:!0});var n=k(t);E(c.$$.fragment,n),n.forEach(f),e.forEach(f),this.h()},h(){$(t,"class","pb-16"),$(o,"class","workspace-section flex items-center justify-center h-full")},m(i,e){I(i,o,e),N(o,t),b(c,t,null),s=!0},p:W,i(i){s||(_(c.$$.fragment,i),s=!0)},o(i){p(c.$$.fragment,i),s=!1},d(i){i&&f(o),w(c)}}}function ee(l){let o,t,c,s,i;return t=new Y({props:{backHref:"/workspace/tools",titleKey:"Edit Workspace Tool",descKey:"Update tool logic, manifest details, and access settings without leaving the workspace."}}),s=new G({props:{edit:!0,id:l[0].id,ownerId:l[0].user_id,name:l[0].name,meta:l[0].meta,content:l[0].content,accessControl:l[0].access_control,showBackButton:!1,onSave:l[3]}}),{c(){o=g("div"),v(t.$$.fragment),c=q(),v(s.$$.fragment),this.h()},l(e){o=h(e,"DIV",{class:!0});var n=k(o);E(t.$$.fragment,n),c=C(n),E(s.$$.fragment,n),n.forEach(f),this.h()},h(){$(o,"class","space-y-4")},m(e,n){I(e,o,n),b(t,o,null),N(o,c),b(s,o,null),i=!0},p(e,n){const r={};n&1&&(r.id=e[0].id),n&1&&(r.ownerId=e[0].user_id),n&1&&(r.name=e[0].name),n&1&&(r.meta=e[0].meta),n&1&&(r.content=e[0].content),n&1&&(r.accessControl=e[0].access_control),s.$set(r)},i(e){i||(_(t.$$.fragment,e),_(s.$$.fragment,e),i=!0)},o(e){p(t.$$.fragment,e),p(s.$$.fragment,e),i=!1},d(e){e&&f(o),w(t),w(s)}}}function oe(l){let o,t,c,s;const i=[ee,x],e=[];function n(r,m){return r[0]?0:1}return o=n(l),t=e[o]=i[o](l),{c(){t.c(),c=y()},l(r){t.l(r),c=y()},m(r,m){e[o].m(r,m),I(r,c,m),s=!0},p(r,[m]){let a=o;o=n(r),o===a?e[o].p(r,m):(H(),p(e[a],1,1,()=>{e[a]=null}),j(),t=e[o],t?t.p(r,m):(t=e[o]=i[o](r),t.c()),_(t,1),t.m(c.parentNode,c))},i(r){s||(_(t),s=!0)},o(r){p(t),s=!1},d(r){r&&f(c),e[o].d(r)}}}function te(l,o,t){let c,s;V(l,Q,a=>t(4,c=a));const i=T("i18n");V(l,i,a=>t(5,s=a));const e=a=>Z(a,(u,S)=>s.t(u,S));let n=null;const r=async a=>{console.log(a);const u=L(a.content);return X((u==null?void 0:u.required_open_webui_version)??"0.0.0",R)?(console.log("Version is lower than required"),d.error(s.t("Open WebUI version (v{{OPEN_WEBUI_VERSION}}) is lower than required version (v{{REQUIRED_VERSION}})",{OPEN_WEBUI_VERSION:R,REQUIRED_VERSION:(u==null?void 0:u.required_open_webui_version)??"0.0.0"})),!1):await F(localStorage.token,n.id,{id:a.id,name:a.name,meta:a.meta,content:a.content,access_control:a.access_control}).catch(O=>(d.error(e(O)),null))?(d.success(s.t("Tool updated successfully")),J.set(await M(localStorage.token)),!0):!1};return U(async()=>{console.log("mounted");const a=c.url.searchParams.get("id");a&&(t(0,n=await z(localStorage.token,a).catch(u=>(d.error(e(u)),K("/workspace/tools"),null))),console.log(n))}),[n,i,r,a=>r(a)]}class de extends D{constructor(o){super(),P(this,o,te,oe,B,{})}}export{de as component};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.