libre-webui 0.13.1 → 0.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/backend/dist/index.js +1 -1
  2. package/backend/dist/index.js.map +1 -1
  3. package/backend/dist/routes/plugins.d.ts.map +1 -1
  4. package/backend/dist/routes/plugins.js +8 -7
  5. package/backend/dist/routes/plugins.js.map +1 -1
  6. package/backend/dist/routes/tts.d.ts.map +1 -1
  7. package/backend/dist/routes/tts.js +28 -7
  8. package/backend/dist/routes/tts.js.map +1 -1
  9. package/backend/dist/services/pluginCapabilityRegistryService.d.ts +1 -1
  10. package/backend/dist/services/pluginCapabilityRegistryService.d.ts.map +1 -1
  11. package/backend/dist/services/pluginCapabilityRegistryService.js +10 -5
  12. package/backend/dist/services/pluginCapabilityRegistryService.js.map +1 -1
  13. package/backend/dist/services/pluginService.d.ts +8 -3
  14. package/backend/dist/services/pluginService.d.ts.map +1 -1
  15. package/backend/dist/services/pluginService.js +74 -54
  16. package/backend/dist/services/pluginService.js.map +1 -1
  17. package/backend/dist/services/pluginTTSService.d.ts +4 -2
  18. package/backend/dist/services/pluginTTSService.d.ts.map +1 -1
  19. package/backend/dist/services/pluginTTSService.js +25 -31
  20. package/backend/dist/services/pluginTTSService.js.map +1 -1
  21. package/backend/dist/services/preferencesService.d.ts.map +1 -1
  22. package/backend/dist/services/preferencesService.js +6 -1
  23. package/backend/dist/services/preferencesService.js.map +1 -1
  24. package/backend/dist/types/index.d.ts +2 -0
  25. package/backend/dist/types/index.d.ts.map +1 -1
  26. package/backend/dist/types/index.js.map +1 -1
  27. package/backend/dist/utils/packagePaths.d.ts +1 -0
  28. package/backend/dist/utils/packagePaths.d.ts.map +1 -1
  29. package/backend/dist/utils/packagePaths.js +22 -0
  30. package/backend/dist/utils/packagePaths.js.map +1 -1
  31. package/backend/package.json +1 -1
  32. package/frontend/dist/assets/index-BJsjOpGD.css +1 -0
  33. package/frontend/dist/assets/index-DgL4shIj.js +5 -0
  34. package/frontend/dist/index.html +5 -5
  35. package/frontend/dist/js/{ArtifactContainer-lBT2Cf0m.js → ArtifactContainer-urMJnZ_h.js} +1 -1
  36. package/frontend/dist/js/{ArtifactDemoPage-622qBoTt.js → ArtifactDemoPage-CVxPfyus.js} +1 -1
  37. package/frontend/dist/js/ArtifactSlideOutPanel-MP4ap9If.js +1 -0
  38. package/frontend/dist/js/{Button-Cgmt_2gR.js → Button-BZBnLKRn.js} +1 -1
  39. package/frontend/dist/js/ChatPage-D35quAJJ.js +16 -0
  40. package/frontend/dist/js/{FirstTimeSetup-BDCojgfX.js → FirstTimeSetup-B9NVXnGv.js} +1 -1
  41. package/frontend/dist/js/{GalleryPage-DWjvQFPR.js → GalleryPage-BNdUukNh.js} +1 -1
  42. package/frontend/dist/js/LibreClawPage-D_N9GBg7.js +1 -0
  43. package/frontend/dist/js/{ModelManagerModals-BECfRnGl.js → ModelManagerModals-C7wlZoV2.js} +1 -1
  44. package/frontend/dist/js/{ModelsPage-Ccmog6B5.js → ModelsPage-1ykVyEI4.js} +2 -2
  45. package/frontend/dist/js/{OptimizedSyntaxHighlighter-CNjLqj1Z.js → OptimizedSyntaxHighlighter-Fr-hsdRj.js} +1 -1
  46. package/frontend/dist/js/{PersonasPage-DvTDH2Fy.js → PersonasPage-Dg1AQ0e8.js} +2 -2
  47. package/frontend/dist/js/RichMessageContent-tAv_35Ur.js +3 -0
  48. package/frontend/dist/js/SettingsModal-BRQcVyKI.js +1 -0
  49. package/frontend/dist/js/{UserManagementPage-k1mBGCDH.js → UserManagementPage-CA15W6yb.js} +1 -1
  50. package/frontend/dist/js/{api-Ddawdcbi.js → api-BsUaU_IW.js} +3 -3
  51. package/frontend/dist/js/{ar-CQheG5xK.js → ar-CxLY7ABG.js} +1 -1
  52. package/frontend/dist/js/{bn-BVXljlpH.js → bn-DREExDzT.js} +1 -1
  53. package/frontend/dist/js/{cs-BgyyXudt.js → cs-LDpGwqlb.js} +1 -1
  54. package/frontend/dist/js/{da-Dk83-zzY.js → da-Csupo97j.js} +1 -1
  55. package/frontend/dist/js/{de-B9SDOxyQ.js → de-EOghQcPX.js} +1 -1
  56. package/frontend/dist/js/{es-DMlNf0tc.js → es-CiX_CYKt.js} +1 -1
  57. package/frontend/dist/js/{fr-DtOoKP26.js → fr-1IIacQYp.js} +1 -1
  58. package/frontend/dist/js/{hi-wuG6Draz.js → hi-DGT4fx6S.js} +1 -1
  59. package/frontend/dist/js/{id-CT2rnPXt.js → id-0UGudeEI.js} +1 -1
  60. package/frontend/dist/js/{is-Cfy2VWp5.js → is-BQzgz0LG.js} +1 -1
  61. package/frontend/dist/js/{it-vgQmoI8w.js → it-3PfovgDw.js} +1 -1
  62. package/frontend/dist/js/{ja-B8pVsr1R.js → ja-BaXdHNz8.js} +1 -1
  63. package/frontend/dist/js/{ko-CTERnuAH.js → ko-DNqxLzw3.js} +1 -1
  64. package/frontend/dist/js/{ms-BGmwAKcP.js → ms-D_X86VRO.js} +1 -1
  65. package/frontend/dist/js/{nl-CKLRry0w.js → nl-B832wh-7.js} +1 -1
  66. package/frontend/dist/js/{pl-DRWZS4lz.js → pl-BDMgy2lk.js} +1 -1
  67. package/frontend/dist/js/{pt-Dua6AStw.js → pt-CbhjHMrx.js} +1 -1
  68. package/frontend/dist/js/{ru-B6MEHobb.js → ru-CEe0KRO9.js} +1 -1
  69. package/frontend/dist/js/{sv-Bg1rkqPN.js → sv-BWwpkP0M.js} +1 -1
  70. package/frontend/dist/js/{th-Nz5BELCH.js → th-Dm5aEMnB.js} +1 -1
  71. package/frontend/dist/js/{tr-7Nyg2UmX.js → tr-DMaVgSRT.js} +1 -1
  72. package/frontend/dist/js/{uk-DUAnc6NJ.js → uk-Cu1mMWfT.js} +1 -1
  73. package/frontend/dist/js/useBaseQuery-DDZrESRv.js +1 -0
  74. package/frontend/dist/js/useQuery-BFOeNWc6.js +1 -0
  75. package/frontend/dist/js/utils-D0l9J3P-.js +1 -0
  76. package/frontend/dist/js/{vi-BOpghAsX.js → vi-B_DGmAUD.js} +1 -1
  77. package/frontend/dist/js/{zh-lCo3TiLV.js → zh-DIKyA5Kk.js} +1 -1
  78. package/package.json +2 -2
  79. package/frontend/dist/assets/index-6X4Fay3z.js +0 -5
  80. package/frontend/dist/assets/index-j-Q57B_D.css +0 -1
  81. package/frontend/dist/js/ArtifactSlideOutPanel-CfbbHcaI.js +0 -1
  82. package/frontend/dist/js/ChatPage-DGqHo1eh.js +0 -16
  83. package/frontend/dist/js/LibreClawPage-BQ5dN-0J.js +0 -1
  84. package/frontend/dist/js/RichMessageContent-CBR2ML5W.js +0 -3
  85. package/frontend/dist/js/SettingsModal-CV9iz6Lk.js +0 -1
  86. package/frontend/dist/js/useBaseQuery-5VtX6QMw.js +0 -1
  87. package/frontend/dist/js/useQuery-CXwvr2_e.js +0 -1
  88. package/frontend/dist/js/utils-BaPYjs_z.js +0 -1
@@ -0,0 +1 @@
1
+ import{r as e,t}from"./rolldown-runtime-QTnfLwEv.js";import{d as n,f as r}from"./markdown-core-fkbHPd-g.js";import{t as i}from"./logger-BmpKNkls.js";import{Dt as a,Nt as o,O as s,St as c,T as l,Vt as u,Z as d,_ as f,bt as p,d as m,h,k as g,n as _,ot as v,pt as y,u as b,vt as x}from"./ui-vendor-njo77ljx.js";import{f as S}from"./api-BsUaU_IW.js";import{t as C}from"./utils-D0l9J3P-.js";import{t as w}from"./Button-BZBnLKRn.js";import{B as T,F as E,H as D,I as ee,L as te,R as O,U as k,V as A,W as ne,a as re,i as j,z as M}from"../assets/index-DgL4shIj.js";var N=e(t(((e,t)=>{t.exports={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}}))()),P=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function F(e){var t={type:`tag`,name:``,voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(N.default[n[1]]||e.charAt(e.length-2)===`/`)&&(t.voidElement=!0),t.name.startsWith(`!--`))){var r=e.indexOf(`-->`);return{type:`comment`,comment:r===-1?``:e.slice(4,r)}}for(var i=new RegExp(P),a=null;(a=i.exec(e))!==null;)if(a[0].trim())if(a[1]){var o=a[1].trim(),s=[o,``];o.indexOf(`=`)>-1&&(s=o.split(`=`)),t.attrs[s[0]]=s[1],i.lastIndex--}else a[2]&&(t.attrs[a[2]]=a[3].trim().substring(1,a[3].length-1));return t}var I=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,ie=/^\s*$/,ae=Object.create(null);function oe(e,t){switch(t.type){case`text`:return e+t.content;case`tag`:return e+=`<`+t.name+(t.attrs?function(e){var t=[];for(var n in e)t.push(n+`="`+e[n]+`"`);return t.length?` `+t.join(` `):``}(t.attrs):``)+(t.voidElement?`/>`:`>`),t.voidElement?e:e+t.children.reduce(oe,``)+`</`+t.name+`>`;case`comment`:return e+`<!--`+t.comment+`-->`}}var se={parse:function(e,t){t||(t={}),t.components||(t.components=ae);var n,r=[],i=[],a=-1,o=!1;if(e.indexOf(`<`)!==0){var s=e.indexOf(`<`);r.push({type:`text`,content:s===-1?e:e.substring(0,s)})}return e.replace(I,function(s,c){if(o){if(s!==`</`+n.name+`>`)return;o=!1}var l,u=s.charAt(1)!==`/`,d=s.startsWith(`<!--`),f=c+s.length,p=e.charAt(f);if(d){var m=F(s);return a<0?(r.push(m),r):((l=i[a]).children.push(m),r)}if(u&&(a++,(n=F(s)).type===`tag`&&t.components[n.name]&&(n.type=`component`,o=!0),n.voidElement||o||!p||p===`<`||n.children.push({type:`text`,content:e.slice(f,e.indexOf(`<`,f))}),a===0&&r.push(n),(l=i[a-1])&&l.children.push(n),i[a]=n),(!u||n.voidElement)&&(a>-1&&(n.voidElement||n.name===s.slice(2,-1))&&(a--,n=a===-1?r:i[a]),!o&&p!==`<`&&p)){l=a===-1?r:i[a].children;var h=e.indexOf(`<`,f),g=e.slice(f,h===-1?void 0:h);ie.test(g)&&(g=` `),(h>-1&&a+l.length>=0||g!==` `)&&l.push({type:`text`,content:g})}}),r},stringify:function(e){return e.reduce(function(e,t){return e+oe(``,t)},``)}},L=e(r()),R=(e,t)=>{if(!e)return!1;let n=e.props?.children??e.children;return t?n.length>0:!!n},z=e=>{if(!e)return[];let t=e.props?.children??e.children;return e.props?.i18nIsDynamicList?B(t):t},ce=e=>Array.isArray(e)&&e.every(L.isValidElement),B=e=>Array.isArray(e)?e:[e],le=(e,t)=>{let n={...t};return n.props={...t.props,...e.props},n},V=e=>{let t={};if(!e)return t;let n=e=>{B(e).forEach(e=>{A(e)||(R(e)?n(z(e)):T(e)&&!(0,L.isValidElement)(e)&&Object.assign(t,e))})};return n(e),t},H=(e,t,n,r)=>{if(!e)return``;let i=``,a=B(e),o=t?.transSupportBasicHtmlNodes?t.transKeepBasicHtmlNodesFor??[]:[];return a.forEach((e,a)=>{if(A(e)){i+=`${e}`;return}if((0,L.isValidElement)(e)){let{props:s,type:c}=e,l=Object.keys(s).length,u=o.indexOf(c)>-1,d=s.children;if(!d&&u&&!l){i+=`<${c}/>`;return}if(!d&&(!u||l)||s.i18nIsDynamicList){i+=`<${a}></${a}>`;return}if(u&&l<=1){let e=A(d)?d:H(d,t,n,r);i+=`<${c}>${e}</${c}>`;return}let f=H(d,t,n,r);i+=`<${a}>${f}</${a}>`;return}if(e===null){D(n,`TRANS_NULL_VALUE`,`Passed in a null value as child`,{i18nKey:r});return}if(T(e)){let{format:t,...a}=e,o=Object.keys(a);if(o.length===1){let e=t?`${o[0]}, ${t}`:o[0];i+=`{{${e}}}`;return}D(n,`TRANS_INVALID_OBJ`,`Invalid child - Object should only have keys {{ value, format }} (format is optional).`,{i18nKey:r,child:e});return}D(n,`TRANS_INVALID_VAR`,`Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.`,{i18nKey:r,child:e})}),i},ue=(e,t=[],n={})=>{if(!e)return e;let r=Object.keys(n),i=[...t,...r],a=``,o=0;for(;o<e.length;)if(e[o]===`<`){let t=!1,n=e.slice(o).match(/^<\/(\d+|[a-zA-Z][a-zA-Z0-9_-]*)>/);if(n){let e=n[1];(/^\d+$/.test(e)||i.includes(e))&&(t=!0,a+=n[0],o+=n[0].length)}if(!t){let n=e.slice(o).match(/^<(\d+|[a-zA-Z][a-zA-Z0-9_-]*)(\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s*(\/)?>/);if(n){let e=n[1];(/^\d+$/.test(e)||i.includes(e))&&(t=!0,a+=n[0],o+=n[0].length)}}t||(a+=`&lt;`,o+=1)}else a+=e[o],o+=1;return a},de=(e,t,n,r,i,a,o)=>{if(n===``)return[];let s=i.transKeepBasicHtmlNodesFor||[],c=n&&new RegExp(s.map(e=>`<${e}`).join(`|`)).test(n);if(!e&&!t&&!c&&!o)return[n];let l=t??{},u=e=>{B(e).forEach(e=>{A(e)||(R(e)?u(z(e)):T(e)&&!(0,L.isValidElement)(e)&&Object.assign(l,e))})};u(e);let d=ue(n,s,l),f=se.parse(`<0>${d}</0>`),p={...l,...a},m=(e,t,n)=>{let r=z(e),i=g(r,t.children,n);return ce(r)&&i.length===0||e.props?.i18nIsDynamicList?r:i},h=(e,t,n,r,i)=>{e.dummy?(e.children=t,n.push((0,L.cloneElement)(e,{key:r},i?void 0:t))):n.push(...L.Children.map([e],e=>{if(e.type===L.Fragment||e.props?.i18nIsDynamicList!==void 0){let n={key:r};return e&&e.props&&Object.keys(e.props).forEach(t=>{t===`children`||t===`i18nIsDynamicList`||(n[t]=e.props[t])}),(0,L.createElement)(e.type,n,i?null:t)}let n={key:r};return e&&e.props&&Object.keys(e.props).forEach(t=>{t===`ref`||t===`children`||(n[t]=e.props[t])}),(0,L.cloneElement)(e,n,i?null:t)}))},g=(e,n,a)=>{let l=B(e),u=B(n),d={};return u.reduce((e,n,u)=>{let f=n.children?.[0]?.content&&r.services.interpolator.interpolate(n.children[0].content,p,r.language);if(n.type===`tag`){let _=l[parseInt(n.name,10)];!_&&t&&(_=t[n.name]),a.length===1&&!_&&(_=a[0][n.name]),_||(_={});let v={...n.attrs};o&&Object.keys(v).forEach(e=>{let t=v[e];A(t)&&(v[e]=M(t))});let y=Object.keys(v).length===0?_:le({props:v},_),b=(0,L.isValidElement)(y),x=b&&R(n,!0)&&!n.voidElement,S=c&&T(y)&&y.dummy&&!b,C=T(t)&&Object.hasOwnProperty.call(t,n.name);if(A(y)){let t=r.services.interpolator.interpolate(y,p,r.language);e.push(t)}else if(R(y)||x)h(y,m(y,n,a),e,u);else if(S)h(y,g(l,n.children,a),e,u);else if(Number.isNaN(parseFloat(n.name)))if(C)h(y,m(y,n,a),e,u,n.voidElement);else if(i.transSupportBasicHtmlNodes&&s.indexOf(n.name)>-1)if(n.voidElement)e.push((0,L.createElement)(n.name,{key:`${n.name}-${u}`}));else{let t=d[n.name]||0;d[n.name]=t+1;let r,i=0;for(let e=0;e<l.length;e+=1){let a=l[e];if((0,L.isValidElement)(a)&&a.type===n.name){if(i===t){r=a;break}i+=1}}let o=g(r?B(z(r)):l,n.children,a);e.push((0,L.createElement)(n.name,{key:`${n.name}-${u}`},o))}else if(n.voidElement)e.push(`<${n.name} />`);else{let t=g(l,n.children,a);e.push(`<${n.name}>${t}</${n.name}>`)}else if(T(y)&&!b){let t=n.children[0]?f:null;t&&e.push(t)}else h(y,f,e,u,n.children.length!==1||!f)}else if(n.type===`text`){let t=i.transWrapTextNodes,a=typeof i.unescape==`function`?i.unescape:O().unescape,s=o?a(r.services.interpolator.interpolate(n.content,p,r.language)):r.services.interpolator.interpolate(n.content,p,r.language);t?e.push((0,L.createElement)(t,{key:`${n.name}-${u}`},s)):e.push(s)}return e},[])};return z(g([{dummy:!0,children:e||[]}],f,B(e||[]))[0])},U=(e,t,n)=>{let r=e.key||t,i=(0,L.cloneElement)(e,{key:r});if(!i.props||!i.props.children||n.indexOf(`${t}/>`)<0&&n.indexOf(`${t} />`)<0)return i;function a(){return(0,L.createElement)(L.Fragment,null,i)}return(0,L.createElement)(a,{key:r})},fe=(e,t)=>e.map((e,n)=>U(e,n,t)),pe=(e,t)=>{let n={};return Object.keys(e).forEach(r=>{Object.assign(n,{[r]:U(e[r],r,t)})}),n},me=(e,t,n,r)=>e?Array.isArray(e)?fe(e,t):T(e)?pe(e,t):(k(n,`TRANS_INVALID_COMPONENTS`,`<Trans /> "components" prop expects an object or array`,{i18nKey:r}),null):null,W=e=>!T(e)||Array.isArray(e)?!1:Object.keys(e).reduce((e,t)=>e&&Number.isNaN(Number.parseFloat(t)),!0);function he({children:e,count:t,parent:n,i18nKey:r,context:i,tOptions:a={},values:o,defaults:s,components:c,ns:l,i18n:u,t:d,shouldUnescape:f,...p}){let m=u||te();if(!m)return k(m,`NO_I18NEXT_INSTANCE`,`Trans: You need to pass in an i18next instance using i18nextReactModule`,{i18nKey:r}),e;let h=d||m.t.bind(m)||(e=>e),g={...O(),...m.options?.react},_=l||h.ns||m.options?.defaultNS;_=A(_)?[_]:_||[`translation`];let{transDefaultProps:v}=g,y=v?.tOptions?{...v.tOptions,...a}:a,b=f??v?.shouldUnescape,x=v?.values?{...v.values,...o}:o,S=v?.components?{...v.components,...c}:c,C=H(e,g,m,r),w=s||y?.defaultValue||C||g.transEmptyNodeValue||(typeof r==`function`?ne(r):r),{hashTransKey:T}=g,E=r||(T?T(C||w):C||w);o=m.options?.interpolation?.defaultVariables?x&&Object.keys(x).length>0?{...x,...m.options.interpolation.defaultVariables}:{...m.options.interpolation.defaultVariables}:x;let D=V(e);D&&typeof D.count==`number`&&t===void 0&&(t=D.count);let ee=o||t!==void 0&&!m.options?.interpolation?.alwaysFormat||!e?y.interpolation:{interpolation:{...y.interpolation,prefix:`#$?`,suffix:`?$#`}},re={...y,context:i||y.context,count:t,...o,...ee,defaultValue:w,ns:_},j=E?h(E,re):w;j===E&&w&&(j=w);let M=me(S,j,m,r),N=M||e,P=null;W(M)&&(P=M,N=e);let F=de(N,P,j,m,g,re,b),I=n??g.defaultTransParent;return I?(0,L.createElement)(I,p,F):F}function ge({children:e,count:t,parent:n,i18nKey:r,context:i,tOptions:a={},values:o,defaults:s,components:c,ns:l,i18n:u,t:d,shouldUnescape:f,...p}){let{i18n:m,defaultNS:h}=(0,L.useContext)(ee)||{},g=u||m||te(),_=d||g?.t.bind(g);return he({children:e,count:t,parent:n,i18nKey:r,context:i,tOptions:a,values:o,defaults:s,components:c,ns:l||_?.ns||h||g?.options?.defaultNS,i18n:g,t:d,shouldUnescape:f,...p})}var G=n(),K=i(`pages:libre-claw`),q={queued:`bg-gray-100 text-gray-700 dark:bg-dark-200 dark:text-dark-700`,running:`bg-primary-100 text-primary-700 dark:bg-primary-900/25 dark:text-primary-300`,blocked:`bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300`,done:`bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-300`,failed:`bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300`,cancelled:`bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-300`},_e={assistant_message:`text-primary-600 dark:text-primary-300`,assistant_delta:`text-primary-600 dark:text-primary-300`,user_message:`text-gray-700 dark:text-dark-700`,permission_request:`text-amber-600 dark:text-amber-300`,permission_response:`text-gray-600 dark:text-dark-600`,tool_call:`text-gray-600 dark:text-dark-600`,tool_result:`text-gray-600 dark:text-dark-600`,usage:`text-gray-600 dark:text-dark-600`,error:`text-red-600 dark:text-red-300`,run_finished:`text-emerald-600 dark:text-emerald-300`},ve=[[`lobster`,`Lobster`],[`lobster-light`,`Lobster Light`],[`github-dark`,`GitHub Dark`],[`github-light`,`GitHub Light`],[`monokai-pro`,`Monokai Pro`],[`night-owl`,`Night Owl`],[`tokyo-night`,`Tokyo Night`],[`ayu`,`Ayu`],[`dracula`,`Dracula`],[`catppuccin-mocha`,`Catppuccin Mocha`],[`catppuccin-latte`,`Catppuccin Latte`],[`gruvbox-dark`,`Gruvbox Dark`],[`nord`,`Nord`],[`solarized-dark`,`Solarized Dark`],[`solarized-light`,`Solarized Light`],[`one-dark-pro`,`One Dark Pro`],[`rose-pine`,`Rose Pine`],[`kanagawa`,`Kanagawa`],[`matrix`,`Matrix`]],ye=()=>{let{t:e}=E(),[t,n]=(0,L.useState)(null),[r,i]=(0,L.useState)([]),[T,D]=(0,L.useState)([]),[ee,te]=(0,L.useState)([]),[O,k]=(0,L.useState)(null),[A,ne]=(0,L.useState)(null),[M,N]=(0,L.useState)(``),[P,F]=(0,L.useState)(null),[I,ie]=(0,L.useState)(!0),[ae,oe]=(0,L.useState)(!1),[se,R]=(0,L.useState)(!1),[z,ce]=(0,L.useState)(!1),[B,le]=(0,L.useState)(!1),[V,H]=(0,L.useState)(``),[ue,de]=(0,L.useState)(`chat`),[U,fe]=(0,L.useState)(``),[pe,me]=(0,L.useState)(``),[W,he]=(0,L.useState)(``),[q,_e]=(0,L.useState)(``),[ye,we]=(0,L.useState)(!1),[Te,Ee]=(0,L.useState)(`lobster`),[Y,De]=(0,L.useState)(!0),[je,Me]=(0,L.useState)(``),[Ne,X]=(0,L.useState)(``),[Z,Pe]=(0,L.useState)(``),[Fe,Ie]=(0,L.useState)(`report`),Q=(0,L.useMemo)(()=>r.find(e=>e.run_id===P)||null,[r,P]),Le=(0,L.useMemo)(()=>{let e=new Set(T.filter(e=>e.type===`permission_response`).map(e=>String(e.data.tool_call_id||``)));return T.filter(t=>{if(t.type!==`permission_request`)return!1;let n=String(t.data.tool_call_id||``);return n&&!e.has(n)})},[T]),Re=(0,L.useMemo)(()=>Ae(T,e),[T,e]),$=(0,L.useCallback)(async()=>{try{let[e,t,r,a,o,s]=await Promise.all([S.status(),S.listRuns(30),S.currentModel(),S.currentFallback(),S.usage(``,100),S.listAutomations(50)]);e.success&&e.data&&n(e.data),t.success&&t.data&&(i(t.data.runs),F(e=>e||t.data?.runs[0]?.run_id||null)),r.success&&r.data&&(k(r.data),he(String(r.data.provider||``)),_e(String(r.data.model||``))),a.success&&a.data&&ne(a.data),o.success&&o.data&&N(String(o.data.text||``)),s.success&&s.data&&te(s.data.automations)}catch(t){K.error(`Failed to load Libre Claw overview:`,t),u.error(e(`libreClaw.toasts.loadStatusFailed`))}finally{ie(!1)}},[e]),ze=(0,L.useCallback)(async(e,t=!1)=>{let n=t?0:T.length>0&&T[T.length-1]?.event_id||0;try{let r=await S.getEvents(e,n);r.success&&r.data&&D(e=>t?r.data?.events||[]:[...e,...r.data?.events||[]])}catch(e){K.error(`Failed to load Libre Claw events:`,e)}},[T]);(0,L.useEffect)(()=>{let e=window.setTimeout(()=>{$()},0);return()=>window.clearTimeout(e)},[$]),(0,L.useEffect)(()=>{if(!P){let e=window.setTimeout(()=>{D([])},0);return()=>window.clearTimeout(e)}let e=P;S.getEvents(e,0).then(e=>{e.success&&e.data&&D(e.data.events)}).catch(e=>{K.error(`Failed to load Libre Claw events:`,e)})},[P]),(0,L.useEffect)(()=>{if(!P||!Q||![`queued`,`running`,`blocked`].includes(Q.state))return;let e=window.setInterval(()=>{ze(P),S.listRuns(30).then(e=>{e.success&&e.data&&i(e.data.runs)})},1500);return()=>window.clearInterval(e)},[ze,Q,P]);let Be=async()=>{if(!V.trim()){u.error(e(`libreClaw.toasts.enterTask`));return}oe(!0);try{let t=await S.startRun({message:V,kind:ue,provider:U||void 0,model:pe||void 0});if(t.success&&t.data){let n=t.data.run;i(e=>[n,...e.filter(e=>e.run_id!==n.run_id)]),F(n.run_id),H(``),u.success(e(`libreClaw.toasts.runStarted`))}else u.error(t.error||e(`libreClaw.toasts.startRunFailed`))}catch(t){K.error(`Failed to start Libre Claw run:`,t),u.error(e(`libreClaw.toasts.startRunFailed`))}finally{oe(!1)}},Ve=async t=>{try{await S.cancelRun(t),await $(),u.success(e(`libreClaw.toasts.runCancelled`))}catch(t){K.error(`Failed to cancel Libre Claw run:`,t),u.error(e(`libreClaw.toasts.cancelRunFailed`))}},He=async(t,n)=>{if(!P)return;let r=String(t.data.tool_call_id||``);if(r)try{await S.resolvePermission(P,r,n),await ze(P,!0),u.success(e(n===`deny`?`libreClaw.toasts.denied`:`libreClaw.toasts.approved`))}catch(t){K.error(`Failed to resolve Libre Claw permission:`,t),u.error(e(`libreClaw.toasts.resolvePermissionFailed`))}},Ue=async()=>{if(!W.trim()||!q.trim()){u.error(e(`libreClaw.toasts.providerModelRequired`));return}R(!0);try{let t=await S.updateModel(W,q,ye);t.success&&t.data?(k(t.data),u.success(e(`libreClaw.toasts.modelUpdated`))):u.error(t.error||e(`libreClaw.toasts.updateModelFailed`))}catch(t){K.error(`Failed to update Libre Claw model:`,t),u.error(e(`libreClaw.toasts.updateModelFailed`))}finally{R(!1)}},We=async()=>{ce(!0);try{let t=await S.updateTheme(Te,Y);t.success?u.success(e(`libreClaw.toasts.themeUpdated`)):u.error(t.error||e(`libreClaw.toasts.updateThemeFailed`))}catch(t){K.error(`Failed to update Libre Claw theme:`,t),u.error(e(`libreClaw.toasts.updateThemeFailed`))}finally{ce(!1)}},Ge=async()=>{if(!je.trim()||!Ne.trim()||!Z.trim()){u.error(e(`libreClaw.toasts.automationRequired`));return}le(!0);try{let t=await S.createAutomation({name:je,schedule:Ne,prompt:Z,route:Fe});t.success?(Me(``),X(``),Pe(``),await $(),u.success(e(`libreClaw.toasts.automationCreated`))):u.error(t.error||e(`libreClaw.toasts.createAutomationFailed`))}catch(t){K.error(`Failed to create Libre Claw automation:`,t),u.error(e(`libreClaw.toasts.createAutomationFailed`))}finally{le(!1)}},Ke=async(t,n)=>{try{n===`pause`&&await S.pauseAutomation(t),n===`resume`&&await S.resumeAutomation(t),n===`run`&&await S.runAutomationNow(t),n===`delete`&&await S.deleteAutomation(t),await $(),u.success(e(`libreClaw.toasts.automationUpdated`))}catch(t){K.error(`Failed to update Libre Claw automation:`,t),u.error(e(`libreClaw.toasts.updateAutomationFailed`))}};return(0,G.jsxs)(re,{width:`wide`,contentClassName:`space-y-6`,children:[(0,G.jsx)(j,{className:`mb-0`,title:e(`libreClaw.title`),description:e(`libreClaw.subtitle`),actions:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(be,{status:t,t:e}),(0,G.jsxs)(w,{variant:`secondary`,size:`sm`,onClick:$,children:[(0,G.jsx)(l,{className:`h-4 w-4`}),e(`common.refresh`)]}),(0,G.jsxs)(`a`,{href:t?.dashboardUrl||`http://127.0.0.1:8766/dashboard`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex min-h-9 items-center gap-1.5 rounded-xl border border-gray-200/80 bg-white/70 px-3 py-1.5 text-sm font-medium text-gray-700 transition-colors hover:bg-white dark:border-white/10 dark:bg-white/[0.04] dark:text-dark-700 dark:hover:bg-white/[0.08]`,children:[(0,G.jsx)(v,{className:`h-4 w-4`}),e(`libreClaw.dashboard`)]})]})}),!t?.connected&&!I&&(0,G.jsx)(`section`,{className:`rounded-xl border border-amber-200 bg-amber-50 p-4 text-amber-900 dark:border-amber-800 dark:bg-amber-900/20 dark:text-amber-200`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(m,{className:`mt-0.5 h-5 w-5 shrink-0`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`font-semibold`,children:e(`libreClaw.connection.disconnectedTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 text-sm opacity-90`,children:(0,G.jsx)(ge,{i18nKey:`libreClaw.connection.disconnectedDescription`,components:{command:(0,G.jsx)(`code`,{}),env:(0,G.jsx)(`code`,{})}})}),t?.error&&(0,G.jsx)(`p`,{className:`mt-2 text-xs opacity-80`,children:t.error})]})]})}),(0,G.jsxs)(`section`,{className:`grid gap-4 lg:grid-cols-[minmax(0,1fr)_360px]`,children:[(0,G.jsx)(J,{title:e(`libreClaw.startRun.title`),icon:(0,G.jsx)(s,{className:`h-4 w-4`}),children:(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(`textarea`,{value:V,onChange:e=>H(e.target.value),placeholder:e(`libreClaw.startRun.placeholder`),className:`min-h-32 w-full rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm text-gray-900 outline-none transition focus:border-primary-400 focus:ring-2 focus:ring-primary-100 dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800 dark:focus:border-primary-500 dark:focus:ring-primary-900/30`}),(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-4`,children:[(0,G.jsxs)(`select`,{value:ue,onChange:e=>de(e.target.value),className:`rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`,children:[(0,G.jsx)(`option`,{value:`chat`,children:e(`libreClaw.startRun.chatRun`)}),(0,G.jsx)(`option`,{value:`goal`,children:e(`libreClaw.startRun.goalMode`)})]}),(0,G.jsx)(`input`,{value:U,onChange:e=>fe(e.target.value),placeholder:e(`libreClaw.startRun.providerOverride`),className:`rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`}),(0,G.jsx)(`input`,{value:pe,onChange:e=>me(e.target.value),placeholder:e(`libreClaw.startRun.modelOverride`),className:`rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`}),(0,G.jsxs)(w,{onClick:Be,loading:ae,children:[(0,G.jsx)(c,{className:`h-4 w-4`}),e(`libreClaw.startRun.run`)]})]})]})}),(0,G.jsx)(J,{title:e(`libreClaw.modelRoute.title`),icon:(0,G.jsx)(d,{className:`h-4 w-4`}),children:(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-1`,children:[(0,G.jsx)(`input`,{value:W,onChange:e=>he(e.target.value),placeholder:e(`libreClaw.modelRoute.providerPlaceholder`),className:`rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`}),(0,G.jsx)(`input`,{value:q,onChange:e=>_e(e.target.value),placeholder:e(`libreClaw.modelRoute.modelPlaceholder`),className:`rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`})]}),(0,G.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-gray-600 dark:text-dark-600`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:ye,onChange:e=>we(e.target.checked),className:`h-4 w-4 rounded border-gray-300 text-primary-600 focus:ring-primary-500`}),e(`libreClaw.modelRoute.persistGlobal`)]}),(0,G.jsx)(w,{variant:`secondary`,onClick:Ue,loading:se,children:e(`libreClaw.modelRoute.saveModel`)}),(0,G.jsxs)(`div`,{className:`border-t border-gray-100 pt-3 dark:border-dark-200`,children:[(0,G.jsx)(`label`,{className:`mb-1 block text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-dark-500`,children:e(`libreClaw.modelRoute.theme`)}),(0,G.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[minmax(0,1fr)_auto] lg:grid-cols-1`,children:[(0,G.jsx)(`select`,{value:Te,onChange:e=>Ee(e.target.value),className:`rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`,children:ve.map(([e,t])=>(0,G.jsx)(`option`,{value:e,children:t},e))}),(0,G.jsx)(w,{variant:`secondary`,onClick:We,loading:z,children:e(`libreClaw.modelRoute.saveTheme`)})]}),(0,G.jsxs)(`label`,{className:`mt-2 flex items-center gap-2 text-sm text-gray-600 dark:text-dark-600`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:Y,onChange:e=>De(e.target.checked),className:`h-4 w-4 rounded border-gray-300 text-primary-600 focus:ring-primary-500`}),e(`libreClaw.modelRoute.persistGlobal`)]})]}),O&&(0,G.jsx)(`pre`,{className:`max-h-32 overflow-auto rounded-lg bg-gray-100 p-2 text-xs text-gray-700 dark:bg-dark-200 dark:text-dark-700`,children:JSON.stringify(O,null,2)})]})})]}),(0,G.jsxs)(`section`,{className:`grid gap-4 xl:grid-cols-[360px_minmax(0,1fr)]`,children:[(0,G.jsx)(J,{title:e(`libreClaw.runs.title`),icon:(0,G.jsx)(a,{className:`h-4 w-4`}),children:(0,G.jsxs)(`div`,{className:`space-y-2`,children:[r.length===0&&(0,G.jsx)(Oe,{text:e(`libreClaw.runs.empty`)}),r.map(t=>(0,G.jsxs)(`button`,{onClick:()=>F(t.run_id),className:C(`w-full rounded-xl border p-3 text-start transition`,P===t.run_id?`border-primary-300 bg-primary-50 dark:border-primary-700 dark:bg-primary-900/20`:`border-gray-200 bg-white hover:bg-gray-50 dark:border-dark-300 dark:bg-dark-50 dark:hover:bg-dark-100`),children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate text-sm font-medium text-gray-900 dark:text-dark-900`,children:t.title}),(0,G.jsx)(xe,{state:t.state,t:e})]}),(0,G.jsxs)(`div`,{className:`mt-1 truncate text-xs text-gray-500 dark:text-dark-500`,children:[t.provider,`:`,t.model]}),(0,G.jsx)(`div`,{className:`mt-1 text-xs text-gray-400 dark:text-dark-500`,children:ke(t.updated_at)})]},t.run_id))]})}),(0,G.jsxs)(J,{title:Q?Q.title:e(`libreClaw.timeline.title`),icon:(0,G.jsx)(y,{className:`h-4 w-4`}),actions:Q&&[`queued`,`running`,`blocked`].includes(Q.state)?(0,G.jsxs)(w,{variant:`danger`,size:`sm`,onClick:()=>Ve(Q.run_id),children:[(0,G.jsx)(h,{className:`h-4 w-4`}),e(`common.cancel`)]}):null,children:[Le.length>0&&(0,G.jsxs)(`div`,{className:`mb-4 space-y-2 rounded-xl border border-amber-200 bg-amber-50 p-3 dark:border-amber-800 dark:bg-amber-900/20`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-amber-800 dark:text-amber-200`,children:[(0,G.jsx)(f,{className:`h-4 w-4`}),e(`libreClaw.approvals.needed`)]}),Le.map(t=>(0,G.jsxs)(`div`,{className:`rounded-lg bg-white/70 p-3 dark:bg-dark-50/70`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-gray-900 dark:text-dark-900`,children:String(t.data.name||e(`libreClaw.fallbacks.tool`))}),(0,G.jsx)(`pre`,{className:`mt-2 max-h-36 overflow-auto rounded bg-gray-100 p-2 text-xs text-gray-700 dark:bg-dark-200 dark:text-dark-700`,children:JSON.stringify(t.data.arguments||{},null,2)}),(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,G.jsxs)(w,{size:`sm`,onClick:()=>He(t,`allow_once`),children:[(0,G.jsx)(x,{className:`h-4 w-4`}),e(`libreClaw.approvals.allowOnce`)]}),(0,G.jsx)(w,{size:`sm`,variant:`secondary`,onClick:()=>He(t,`always_allow_tool`),children:e(`libreClaw.approvals.alwaysAllowTool`)}),(0,G.jsxs)(w,{size:`sm`,variant:`danger`,onClick:()=>He(t,`deny`),children:[(0,G.jsx)(_,{className:`h-4 w-4`}),e(`libreClaw.approvals.deny`)]})]})]},t.event_id))]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[T.length===0&&(0,G.jsx)(Oe,{text:e(`libreClaw.timeline.empty`)}),Re.map(t=>(0,G.jsx)(Ce,{item:t,t:e},t.key))]})]})]}),(0,G.jsxs)(`section`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,G.jsx)(J,{title:e(`libreClaw.automations.title`),icon:(0,G.jsx)(p,{className:`h-4 w-4`}),children:(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,G.jsx)(`input`,{value:je,onChange:e=>Me(e.target.value),placeholder:e(`libreClaw.automations.namePlaceholder`),className:`rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`}),(0,G.jsx)(`input`,{value:Ne,onChange:e=>X(e.target.value),placeholder:e(`libreClaw.automations.schedulePlaceholder`),className:`rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`}),(0,G.jsxs)(`select`,{value:Fe,onChange:e=>Ie(e.target.value),className:`rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`,children:[(0,G.jsx)(`option`,{value:`report`,children:e(`libreClaw.automations.routes.report`)}),(0,G.jsx)(`option`,{value:`telegram`,children:e(`libreClaw.automations.routes.telegram`)})]}),(0,G.jsx)(w,{onClick:Ge,loading:B,children:e(`libreClaw.automations.create`)})]}),(0,G.jsx)(`textarea`,{value:Z,onChange:e=>Pe(e.target.value),placeholder:e(`libreClaw.automations.promptPlaceholder`),className:`min-h-24 w-full rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[ee.length===0&&(0,G.jsx)(Oe,{text:e(`libreClaw.automations.empty`)}),ee.map(t=>(0,G.jsx)(`div`,{className:`rounded-xl border border-gray-200 bg-white p-3 dark:border-dark-300 dark:bg-dark-50`,children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`truncate text-sm font-medium text-gray-900 dark:text-dark-900`,children:t.name}),(0,G.jsxs)(`div`,{className:`mt-1 text-xs text-gray-500 dark:text-dark-500`,children:[t.schedule,` ·`,` `,e(`libreClaw.automations.routes.${t.route}`,{defaultValue:t.route}),` `,`·`,` `,e(`libreClaw.automations.status.${t.status}`,{defaultValue:t.status})]})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[(0,G.jsx)(Se,{title:e(`libreClaw.automations.runNow`),onClick:()=>Ke(t.automation_id,`run`),children:(0,G.jsx)(s,{className:`h-4 w-4`})}),(0,G.jsx)(Se,{title:t.status===`paused`?e(`libreClaw.automations.resume`):e(`libreClaw.automations.pause`),onClick:()=>Ke(t.automation_id,t.status===`paused`?`resume`:`pause`),children:t.status===`paused`?(0,G.jsx)(s,{className:`h-4 w-4`}):(0,G.jsx)(g,{className:`h-4 w-4`})}),(0,G.jsx)(Se,{title:e(`common.delete`),danger:!0,onClick:()=>Ke(t.automation_id,`delete`),children:(0,G.jsx)(b,{className:`h-4 w-4`})})]})]})},t.automation_id))]})]})}),(0,G.jsx)(J,{title:e(`libreClaw.usageFallback.title`),icon:(0,G.jsx)(a,{className:`h-4 w-4`}),children:(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`mb-2 text-sm font-semibold text-gray-900 dark:text-dark-900`,children:e(`libreClaw.usageFallback.usage`)}),(0,G.jsx)(`pre`,{className:`max-h-52 overflow-auto rounded-xl bg-gray-100 p-3 text-xs text-gray-700 dark:bg-dark-200 dark:text-dark-700`,children:M||e(`libreClaw.usageFallback.noUsage`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`mb-2 text-sm font-semibold text-gray-900 dark:text-dark-900`,children:e(`libreClaw.usageFallback.fallbackRoute`)}),(0,G.jsx)(`pre`,{className:`max-h-52 overflow-auto rounded-xl bg-gray-100 p-3 text-xs text-gray-700 dark:bg-dark-200 dark:text-dark-700`,children:JSON.stringify(A||{},null,2)})]})]})})]}),I&&(0,G.jsx)(`div`,{className:`fixed inset-0 z-40 flex items-center justify-center bg-white/60 backdrop-blur-sm dark:bg-dark-50/60`,children:(0,G.jsx)(o,{className:`h-7 w-7 animate-spin text-primary-600`})})]})},be=({status:e,t})=>{let n=!!e?.connected;return(0,G.jsxs)(`span`,{className:C(`inline-flex items-center gap-2 rounded-full px-3 py-1.5 text-sm font-medium`,n?`bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-300`:`bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300`),children:[(0,G.jsx)(`span`,{className:C(`h-2 w-2 rounded-full`,n?`bg-emerald-500`:`bg-amber-500`)}),t(n?`libreClaw.status.connected`:`libreClaw.status.disconnected`),e?.health?.active_runs!==void 0&&(0,G.jsxs)(`span`,{className:`opacity-70`,children:[`·`,` `,t(`libreClaw.status.activeRuns`,{count:e.health.active_runs})]})]})},xe=({state:e,t})=>(0,G.jsx)(`span`,{className:C(`rounded-full px-2 py-0.5 text-[11px] font-semibold uppercase tracking-wide`,q[e]||q.queued),children:t(`libreClaw.states.${e}`,{defaultValue:e})}),J=({title:e,icon:t,actions:n,children:r})=>(0,G.jsxs)(`section`,{className:`rounded-2xl border border-gray-200/80 bg-white/60 dark:border-white/10 dark:bg-white/[0.03]`,children:[(0,G.jsxs)(`header`,{className:`flex items-center justify-between gap-3 border-b border-gray-200/70 px-5 py-4 dark:border-white/[0.08]`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-dark-900`,children:[(0,G.jsx)(`span`,{className:`text-primary-600 dark:text-primary-300`,children:t}),e]}),n]}),(0,G.jsx)(`div`,{className:`p-5`,children:r})]}),Se=({title:e,danger:t,onClick:n,children:r})=>(0,G.jsx)(`button`,{type:`button`,title:e,onClick:n,className:C(`inline-flex h-8 w-8 items-center justify-center rounded-lg transition-colors`,t?`text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20`:`text-gray-500 hover:bg-gray-100 dark:text-dark-500 dark:hover:bg-dark-200`),children:r}),Ce=({item:e,t})=>(0,G.jsxs)(`article`,{className:C(`rounded-xl border p-3 transition-colors`,e.eventType===`assistant_message`?`border-primary-200 bg-primary-50/60 dark:border-primary-900/60 dark:bg-primary-900/10`:(e.eventType,`border-gray-200/80 bg-white/50 dark:border-white/[0.08] dark:bg-white/[0.025]`)),children:[(0,G.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,G.jsx)(`span`,{className:C(`text-xs font-semibold uppercase tracking-wide`,_e[e.eventType]||`text-gray-500 dark:text-dark-500`),children:e.label}),(0,G.jsxs)(`span`,{className:`shrink-0 text-xs text-gray-400 dark:text-dark-500`,children:[Ne(e),` · `,ke(e.timestamp)]})]}),(0,G.jsx)(we,{item:e,t})]}),we=({item:e,t})=>{if(e.kind===`assistant_message`)return(0,G.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-6 text-gray-900 dark:text-dark-900`,children:je(e.events)||t(`libreClaw.timeline.streaming`)});let n=e.events[0];return n?n.type===`assistant_delta`?(0,G.jsx)(`p`,{className:`whitespace-pre-wrap text-sm text-gray-800 dark:text-dark-800`,children:String(n.data.text||``)}):n.type===`user_message`?(0,G.jsx)(`p`,{className:`whitespace-pre-wrap text-sm text-gray-800 dark:text-dark-800`,children:String(n.data.content||``)}):n.type===`tool_call`?(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-gray-900 dark:text-dark-900`,children:String(n.data.name||t(`libreClaw.fallbacks.tool`))}),(0,G.jsx)(De,{value:n.data.arguments||{}})]}):n.type===`tool_result`?(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`text-sm font-medium text-gray-900 dark:text-dark-900`,children:[String(n.data.name||t(`libreClaw.fallbacks.tool`)),` ·`,` `,n.data.is_error?t(`libreClaw.timeline.resultError`):t(`libreClaw.timeline.resultOk`)]}),(0,G.jsx)(`pre`,{className:`mt-2 max-h-56 overflow-auto whitespace-pre-wrap rounded-lg bg-gray-100 p-2 text-xs text-gray-700 dark:bg-dark-200 dark:text-dark-700`,children:String(n.data.content||``)})]}):n.type===`permission_request`?(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-gray-900 dark:text-dark-900`,children:String(n.data.name||t(`libreClaw.approvals.toolApprovalRequested`))}),(0,G.jsx)(De,{value:n.data.arguments||{}})]}):n.type===`permission_response`?(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsx)(Y,{label:t(`libreClaw.metrics.tool`),value:String(n.data.name||n.data.tool_call_id||t(`libreClaw.fallbacks.tool`))}),(0,G.jsx)(Y,{label:t(`libreClaw.metrics.resolution`),value:String(n.data.resolution||t(`libreClaw.fallbacks.resolved`))})]}):n.type===`usage`?(0,G.jsx)(Te,{data:n.data,t}):n.type===`run_finished`?(0,G.jsx)(Ee,{data:n.data,t}):n.type===`error`?(0,G.jsx)(`p`,{className:`text-sm text-red-700 dark:text-red-300`,children:String(n.data.message||t(`libreClaw.fallbacks.unknownError`))}):(0,G.jsx)(De,{value:n.data}):null},Te=({data:e,t})=>(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsx)(Y,{label:t(`libreClaw.metrics.provider`),value:String(e.provider||t(`libreClaw.fallbacks.unknown`))}),(0,G.jsx)(Y,{label:t(`libreClaw.metrics.model`),value:String(e.model||t(`libreClaw.fallbacks.unknown`))}),(0,G.jsx)(Y,{label:t(`libreClaw.metrics.input`),value:t(`libreClaw.metrics.tokens`,{count:X(e.input_tokens),formatted:Z(e.input_tokens)})}),(0,G.jsx)(Y,{label:t(`libreClaw.metrics.output`),value:t(`libreClaw.metrics.tokens`,{count:X(e.output_tokens),formatted:Z(e.output_tokens)})}),X(e.cached_tokens)>0&&(0,G.jsx)(Y,{label:t(`libreClaw.metrics.cached`),value:t(`libreClaw.metrics.tokens`,{count:X(e.cached_tokens),formatted:Z(e.cached_tokens)})}),X(e.reasoning_tokens)>0&&(0,G.jsx)(Y,{label:t(`libreClaw.metrics.reasoning`),value:t(`libreClaw.metrics.tokens`,{count:X(e.reasoning_tokens),formatted:Z(e.reasoning_tokens)})}),(0,G.jsx)(Y,{label:t(`libreClaw.metrics.cost`),value:Pe(e.cost)})]}),Ee=({data:e,t})=>(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsx)(Y,{label:t(`libreClaw.metrics.state`),value:t(`libreClaw.states.${String(e.state||`done`)}`,{defaultValue:String(e.state||`done`)})}),e.stop_reason!==void 0&&(0,G.jsx)(Y,{label:t(`libreClaw.metrics.stopReason`),value:String(e.stop_reason)})]}),Y=({label:e,value:t})=>(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full border border-gray-200/80 bg-white/50 px-2.5 py-1 text-xs text-gray-700 dark:border-white/10 dark:bg-white/[0.035] dark:text-dark-700`,children:[(0,G.jsx)(`span`,{className:`font-semibold text-gray-500 dark:text-dark-500`,children:e}),(0,G.jsx)(`span`,{children:t})]}),De=({value:e})=>(0,G.jsx)(`pre`,{className:`mt-2 max-h-56 overflow-auto rounded-lg bg-gray-100 p-2 text-xs text-gray-700 dark:bg-dark-200 dark:text-dark-700`,children:JSON.stringify(e,null,2)}),Oe=({text:e})=>(0,G.jsx)(`div`,{className:`rounded-xl border border-dashed border-gray-300 bg-white/30 px-4 py-8 text-center text-sm text-gray-500 dark:border-white/15 dark:bg-white/[0.02] dark:text-dark-500`,children:e}),ke=e=>{if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()},Ae=(e,t)=>{let n=[],r=0;for(;r<e.length;){let i=e[r];if(!i)break;if(i.type===`assistant_delta`){let i=[];for(;e[r]?.type===`assistant_delta`;){let t=e[r];t&&i.push(t),r+=1}let a=i[0],o=i[i.length-1]||a;a&&o&&n.push({key:`assistant-${a.event_id}-${o.event_id}`,kind:`assistant_message`,eventType:`assistant_message`,label:t(`libreClaw.timeline.assistantResponse`),firstEventId:a.event_id,lastEventId:o.event_id,timestamp:a.timestamp,events:i});continue}n.push({key:`${i.type}-${i.event_id}`,kind:`event`,eventType:i.type,label:Me(i.type,t),firstEventId:i.event_id,lastEventId:i.event_id,timestamp:i.timestamp,events:[i]}),r+=1}return n},je=e=>e.map(e=>String(e.data.text||``)).join(``),Me=(e,t)=>({user_message:t(`libreClaw.timeline.labels.userMessage`),tool_call:t(`libreClaw.timeline.labels.toolCall`),tool_result:t(`libreClaw.timeline.labels.toolResult`),permission_request:t(`libreClaw.timeline.labels.approvalRequest`),permission_response:t(`libreClaw.timeline.labels.approvalResponse`),run_started:t(`libreClaw.timeline.labels.runStarted`),run_finished:t(`libreClaw.timeline.labels.runFinished`),usage:t(`libreClaw.timeline.labels.usage`),error:t(`libreClaw.timeline.labels.error`)})[e]||e.replace(/_/g,` `),Ne=e=>e.firstEventId===e.lastEventId?`#${e.firstEventId}`:`#${e.firstEventId}-#${e.lastEventId}`,X=e=>{let t=Number(e);return Number.isFinite(t)?t:0},Z=e=>new Intl.NumberFormat().format(X(e)),Pe=e=>{let t=X(e);return t<=0?`$0.00`:t<.01?`$${t.toFixed(6)}`:`$${t.toFixed(4)}`};export{ye as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime-QTnfLwEv.js";import{d as e,f as t}from"./markdown-core-fkbHPd-g.js";import{n}from"./react-vendor-Co1u1rWb.js";import{T as r,f as i,n as a,rt as o,ut as s}from"./ui-vendor-njo77ljx.js";import{t as c}from"./utils-BaPYjs_z.js";import{t as l}from"./Button-Cgmt_2gR.js";import{P as u}from"../assets/index-6X4Fay3z.js";t();var d=n(),f=e(),p=({models:e,showDetailsModal:t,setShowDetailsModal:n,selectedModelName:p,selectedModelDetails:m,loadingDetails:h,showCopyModal:g,setShowCopyModal:_,copySource:v,setCopySource:y,copyDestination:b,setCopyDestination:x,copying:S,handleCopyModel:C,showCreateModal:w,setShowCreateModal:T,createModelName:E,setCreateModelName:D,createModelfile:O,setCreateModelfile:k,creating:A,handleCreateModel:j,showEmbeddingsModal:M,setShowEmbeddingsModal:N,embeddingsModel:P,setEmbeddingsModel:F,embeddingsInput:I,setEmbeddingsInput:L,embeddingsResult:R,generatingEmbeddings:z,handleGenerateEmbeddings:B})=>{let{t:V}=u();return(0,f.jsxs)(f.Fragment,{children:[t&&(0,d.createPortal)((0,f.jsxs)(`div`,{className:`fixed inset-0 z-[999999] flex items-center justify-center p-4`,children:[(0,f.jsx)(`div`,{className:`absolute inset-0 bg-black/50 backdrop-blur-sm`,onClick:()=>n(!1)}),(0,f.jsxs)(`div`,{className:c(`relative w-full max-w-2xl max-h-[85vh] overflow-hidden rounded-xl border shadow-2xl`,`bg-white dark:bg-dark-100`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsxs)(`div`,{className:c(`flex items-center justify-between p-4 border-b`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsxs)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-gray-100`,children:[V(`modelManager.modals.details.title`),`: `,p]}),(0,f.jsx)(`button`,{onClick:()=>n(!1),className:`p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-dark-200`,children:(0,f.jsx)(a,{className:`h-5 w-5 text-gray-500`})})]}),(0,f.jsx)(`div`,{className:`overflow-y-auto max-h-[calc(85vh-60px)] p-4 space-y-4`,children:h?(0,f.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,f.jsx)(r,{className:`h-6 w-6 animate-spin text-gray-400`})}):m?(0,f.jsxs)(f.Fragment,{children:[m.details&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h4`,{className:`text-sm font-medium text-gray-700 dark:text-gray-300 mb-2`,children:V(`modelManager.modals.details.info`)}),(0,f.jsx)(`div`,{className:c(`p-3 rounded-lg text-sm`,`bg-gray-50 dark:bg-dark-50`),children:(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[m.details.family&&(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`span`,{className:`text-gray-500`,children:[V(`modelManager.modals.details.family`),`:`]}),` `,(0,f.jsx)(`span`,{className:`text-gray-900 dark:text-gray-100`,children:m.details.family})]}),m.details.parameter_size&&(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`span`,{className:`text-gray-500`,children:[V(`modelManager.modals.details.parameters`),`:`]}),` `,(0,f.jsx)(`span`,{className:`text-gray-900 dark:text-gray-100`,children:m.details.parameter_size})]}),m.details.quantization_level&&(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`span`,{className:`text-gray-500`,children:[V(`modelManager.modals.details.quantization`),`:`]}),` `,(0,f.jsx)(`span`,{className:`text-gray-900 dark:text-gray-100`,children:m.details.quantization_level})]}),m.details.format&&(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`span`,{className:`text-gray-500`,children:[V(`modelManager.modals.details.format`),`:`]}),` `,(0,f.jsx)(`span`,{className:`text-gray-900 dark:text-gray-100`,children:m.details.format})]})]})})]}),m.system&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h4`,{className:`text-sm font-medium text-gray-700 dark:text-gray-300 mb-2`,children:V(`modelManager.modals.details.systemPrompt`)}),(0,f.jsx)(`pre`,{className:c(`p-3 rounded-lg text-xs overflow-x-auto`,`bg-gray-50 dark:bg-dark-50`,`text-gray-700 dark:text-gray-300`),children:m.system})]}),m.template&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h4`,{className:`text-sm font-medium text-gray-700 dark:text-gray-300 mb-2`,children:V(`modelManager.modals.details.template`)}),(0,f.jsx)(`pre`,{className:c(`p-3 rounded-lg text-xs overflow-x-auto max-h-40`,`bg-gray-50 dark:bg-dark-50`,`text-gray-700 dark:text-gray-300`),children:m.template})]}),m.parameters&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h4`,{className:`text-sm font-medium text-gray-700 dark:text-gray-300 mb-2`,children:V(`modelManager.modals.details.parameters`)}),(0,f.jsx)(`pre`,{className:c(`p-3 rounded-lg text-xs overflow-x-auto`,`bg-gray-50 dark:bg-dark-50`,`text-gray-700 dark:text-gray-300`),children:m.parameters})]}),m.license&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h4`,{className:`text-sm font-medium text-gray-700 dark:text-gray-300 mb-2`,children:V(`modelManager.modals.details.license`)}),(0,f.jsx)(`pre`,{className:c(`p-3 rounded-lg text-xs overflow-x-auto max-h-32`,`bg-gray-50 dark:bg-dark-50`,`text-gray-700 dark:text-gray-300`),children:m.license})]}),m.modelfile&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h4`,{className:`text-sm font-medium text-gray-700 dark:text-gray-300 mb-2`,children:V(`modelManager.modals.details.modelfile`)}),(0,f.jsx)(`pre`,{className:c(`p-3 rounded-lg text-xs overflow-x-auto max-h-60`,`bg-gray-50 dark:bg-dark-50`,`text-gray-700 dark:text-gray-300`),children:m.modelfile})]})]}):(0,f.jsx)(`p`,{className:`text-center text-gray-500`,children:V(`modelManager.modals.details.noDetails`)})})]})]}),document.body),g&&(0,d.createPortal)((0,f.jsxs)(`div`,{className:`fixed inset-0 z-[999999] flex items-center justify-center p-4`,children:[(0,f.jsx)(`div`,{className:`absolute inset-0 bg-black/50 backdrop-blur-sm`,onClick:()=>_(!1)}),(0,f.jsxs)(`div`,{className:c(`relative w-full max-w-md rounded-xl border shadow-2xl`,`bg-white dark:bg-dark-100`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsxs)(`div`,{className:c(`flex items-center justify-between p-4 border-b`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-gray-100`,children:V(`modelManager.modals.copy.title`)}),(0,f.jsx)(`button`,{onClick:()=>_(!1),className:`p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-dark-200`,children:(0,f.jsx)(a,{className:`h-5 w-5 text-gray-500`})})]}),(0,f.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:V(`modelManager.modals.copy.source`)}),(0,f.jsxs)(`select`,{value:v,onChange:e=>y(e.target.value),className:c(`w-full px-3 py-2 rounded-lg border text-sm`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-gray-100`),children:[(0,f.jsx)(`option`,{value:``,children:V(`modelManager.modals.copy.selectModel`)}),e.map(e=>(0,f.jsx)(`option`,{value:e.name,children:e.name},e.name))]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:V(`modelManager.modals.copy.newName`)}),(0,f.jsx)(`input`,{type:`text`,value:b,onChange:e=>x(e.target.value),placeholder:V(`modelManager.modals.copy.placeholder`),className:c(`w-full px-3 py-2 rounded-lg border text-sm`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-gray-100`,`placeholder-gray-500`)})]}),(0,f.jsxs)(l,{onClick:C,disabled:!v.trim()||!b.trim()||S,className:c(`w-full gap-2`,``),children:[S?(0,f.jsx)(r,{className:`h-4 w-4 animate-spin`}):(0,f.jsx)(s,{className:`h-4 w-4`}),V(S?`modelManager.modals.copy.copying`:`modelManager.modals.copy.button`)]})]})]})]}),document.body),w&&(0,d.createPortal)((0,f.jsxs)(`div`,{className:`fixed inset-0 z-[999999] flex items-center justify-center p-4`,children:[(0,f.jsx)(`div`,{className:`absolute inset-0 bg-black/50 backdrop-blur-sm`,onClick:()=>T(!1)}),(0,f.jsxs)(`div`,{className:c(`relative w-full max-w-lg rounded-xl border shadow-2xl`,`bg-white dark:bg-dark-100`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsxs)(`div`,{className:c(`flex items-center justify-between p-4 border-b`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-gray-100`,children:V(`modelManager.modals.create.title`)}),(0,f.jsx)(`button`,{onClick:()=>T(!1),className:`p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-dark-200`,children:(0,f.jsx)(a,{className:`h-5 w-5 text-gray-500`})})]}),(0,f.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:V(`modelManager.modals.create.name`)}),(0,f.jsx)(`input`,{type:`text`,value:E,onChange:e=>D(e.target.value),placeholder:V(`modelManager.modals.create.namePlaceholder`),className:c(`w-full px-3 py-2 rounded-lg border text-sm`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-gray-100`,`placeholder-gray-500`)})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:V(`modelManager.modals.create.modelfile`)}),(0,f.jsx)(`textarea`,{value:O,onChange:e=>k(e.target.value),placeholder:V(`modelManager.modals.create.modelfilePlaceholder`),rows:8,className:c(`w-full px-3 py-2 rounded-lg border text-sm font-mono`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-gray-100`,`placeholder-gray-500`,`resize-none`)}),(0,f.jsxs)(`p`,{className:`mt-1 text-xs text-gray-500`,children:[V(`modelManager.modals.create.see`),` `,(0,f.jsx)(`a`,{href:`https://github.com/ollama/ollama/blob/main/docs/modelfile.md`,target:`_blank`,rel:`noopener noreferrer`,className:`text-primary-600 hover:underline`,children:V(`modelManager.modals.create.docs`)}),` `,V(`modelManager.modals.create.docsLink`)]})]}),(0,f.jsxs)(l,{onClick:j,disabled:!E.trim()||!O.trim()||A,className:c(`w-full gap-2`,``),children:[A?(0,f.jsx)(r,{className:`h-4 w-4 animate-spin`}):(0,f.jsx)(o,{className:`h-4 w-4`}),V(A?`modelManager.modals.create.creating`:`modelManager.modals.create.button`)]})]})]})]}),document.body),M&&(0,d.createPortal)((0,f.jsxs)(`div`,{className:`fixed inset-0 z-[999999] flex items-center justify-center p-4`,children:[(0,f.jsx)(`div`,{className:`absolute inset-0 bg-black/50 backdrop-blur-sm`,onClick:()=>N(!1)}),(0,f.jsxs)(`div`,{className:c(`relative w-full max-w-lg rounded-xl border shadow-2xl`,`bg-white dark:bg-dark-100`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsxs)(`div`,{className:c(`flex items-center justify-between p-4 border-b`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-gray-100`,children:V(`modelManager.modals.embeddings.title`)}),(0,f.jsx)(`button`,{onClick:()=>N(!1),className:`p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-dark-200`,children:(0,f.jsx)(a,{className:`h-5 w-5 text-gray-500`})})]}),(0,f.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:V(`modelManager.modals.embeddings.model`)}),(0,f.jsxs)(`select`,{value:P,onChange:e=>F(e.target.value),className:c(`w-full px-3 py-2 rounded-lg border text-sm`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-gray-100`),children:[(0,f.jsx)(`option`,{value:``,children:V(`modelManager.modals.embeddings.selectModel`)}),e.map(e=>(0,f.jsx)(`option`,{value:e.name,children:e.name},e.name))]}),(0,f.jsx)(`p`,{className:`mt-1 text-xs text-gray-500`,children:V(`modelManager.modals.embeddings.recommended`)})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:V(`modelManager.modals.embeddings.input`)}),(0,f.jsx)(`textarea`,{value:I,onChange:e=>L(e.target.value),placeholder:V(`modelManager.modals.embeddings.placeholder`),rows:3,className:c(`w-full px-3 py-2 rounded-lg border text-sm`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-gray-100`,`placeholder-gray-500`,`resize-none`)})]}),(0,f.jsxs)(l,{onClick:B,disabled:!P.trim()||!I.trim()||z,className:c(`w-full gap-2`,``),children:[z?(0,f.jsx)(r,{className:`h-4 w-4 animate-spin`}):(0,f.jsx)(i,{className:`h-4 w-4`}),V(z?`modelManager.modals.embeddings.generating`:`modelManager.modals.embeddings.button`)]}),R&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:V(`modelManager.modals.embeddings.result`,{count:R.length})}),(0,f.jsxs)(`pre`,{className:c(`p-3 rounded-lg text-xs overflow-x-auto max-h-32`,`bg-gray-50 dark:bg-dark-50`,`text-gray-700 dark:text-gray-300`),children:[`[`,R.slice(0,10).join(`, `),R.length>10&&`, ...`,` ]`]})]})]})]})]}),document.body)]})};export{p as ModelManagerModals,p as default};
1
+ import"./rolldown-runtime-QTnfLwEv.js";import{d as e,f as t}from"./markdown-core-fkbHPd-g.js";import{n}from"./react-vendor-Co1u1rWb.js";import{T as r,f as i,n as a,rt as o,ut as s}from"./ui-vendor-njo77ljx.js";import{t as c}from"./utils-D0l9J3P-.js";import{t as l}from"./Button-BZBnLKRn.js";import{F as u}from"../assets/index-DgL4shIj.js";t();var d=n(),f=e(),p=({models:e,showDetailsModal:t,setShowDetailsModal:n,selectedModelName:p,selectedModelDetails:m,loadingDetails:h,showCopyModal:g,setShowCopyModal:_,copySource:v,setCopySource:y,copyDestination:b,setCopyDestination:x,copying:S,handleCopyModel:C,showCreateModal:w,setShowCreateModal:T,createModelName:E,setCreateModelName:D,createModelfile:O,setCreateModelfile:k,creating:A,handleCreateModel:j,showEmbeddingsModal:M,setShowEmbeddingsModal:N,embeddingsModel:P,setEmbeddingsModel:F,embeddingsInput:I,setEmbeddingsInput:L,embeddingsResult:R,generatingEmbeddings:z,handleGenerateEmbeddings:B})=>{let{t:V}=u();return(0,f.jsxs)(f.Fragment,{children:[t&&(0,d.createPortal)((0,f.jsxs)(`div`,{className:`fixed inset-0 z-[999999] flex items-center justify-center p-4`,children:[(0,f.jsx)(`div`,{className:`absolute inset-0 bg-black/50 backdrop-blur-sm`,onClick:()=>n(!1)}),(0,f.jsxs)(`div`,{className:c(`relative w-full max-w-2xl max-h-[85vh] overflow-hidden rounded-xl border shadow-2xl`,`bg-white dark:bg-dark-100`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsxs)(`div`,{className:c(`flex items-center justify-between p-4 border-b`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsxs)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-gray-100`,children:[V(`modelManager.modals.details.title`),`: `,p]}),(0,f.jsx)(`button`,{onClick:()=>n(!1),className:`p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-dark-200`,children:(0,f.jsx)(a,{className:`h-5 w-5 text-gray-500`})})]}),(0,f.jsx)(`div`,{className:`overflow-y-auto max-h-[calc(85vh-60px)] p-4 space-y-4`,children:h?(0,f.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,f.jsx)(r,{className:`h-6 w-6 animate-spin text-gray-400`})}):m?(0,f.jsxs)(f.Fragment,{children:[m.details&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h4`,{className:`text-sm font-medium text-gray-700 dark:text-gray-300 mb-2`,children:V(`modelManager.modals.details.info`)}),(0,f.jsx)(`div`,{className:c(`p-3 rounded-lg text-sm`,`bg-gray-50 dark:bg-dark-50`),children:(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[m.details.family&&(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`span`,{className:`text-gray-500`,children:[V(`modelManager.modals.details.family`),`:`]}),` `,(0,f.jsx)(`span`,{className:`text-gray-900 dark:text-gray-100`,children:m.details.family})]}),m.details.parameter_size&&(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`span`,{className:`text-gray-500`,children:[V(`modelManager.modals.details.parameters`),`:`]}),` `,(0,f.jsx)(`span`,{className:`text-gray-900 dark:text-gray-100`,children:m.details.parameter_size})]}),m.details.quantization_level&&(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`span`,{className:`text-gray-500`,children:[V(`modelManager.modals.details.quantization`),`:`]}),` `,(0,f.jsx)(`span`,{className:`text-gray-900 dark:text-gray-100`,children:m.details.quantization_level})]}),m.details.format&&(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`span`,{className:`text-gray-500`,children:[V(`modelManager.modals.details.format`),`:`]}),` `,(0,f.jsx)(`span`,{className:`text-gray-900 dark:text-gray-100`,children:m.details.format})]})]})})]}),m.system&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h4`,{className:`text-sm font-medium text-gray-700 dark:text-gray-300 mb-2`,children:V(`modelManager.modals.details.systemPrompt`)}),(0,f.jsx)(`pre`,{className:c(`p-3 rounded-lg text-xs overflow-x-auto`,`bg-gray-50 dark:bg-dark-50`,`text-gray-700 dark:text-gray-300`),children:m.system})]}),m.template&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h4`,{className:`text-sm font-medium text-gray-700 dark:text-gray-300 mb-2`,children:V(`modelManager.modals.details.template`)}),(0,f.jsx)(`pre`,{className:c(`p-3 rounded-lg text-xs overflow-x-auto max-h-40`,`bg-gray-50 dark:bg-dark-50`,`text-gray-700 dark:text-gray-300`),children:m.template})]}),m.parameters&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h4`,{className:`text-sm font-medium text-gray-700 dark:text-gray-300 mb-2`,children:V(`modelManager.modals.details.parameters`)}),(0,f.jsx)(`pre`,{className:c(`p-3 rounded-lg text-xs overflow-x-auto`,`bg-gray-50 dark:bg-dark-50`,`text-gray-700 dark:text-gray-300`),children:m.parameters})]}),m.license&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h4`,{className:`text-sm font-medium text-gray-700 dark:text-gray-300 mb-2`,children:V(`modelManager.modals.details.license`)}),(0,f.jsx)(`pre`,{className:c(`p-3 rounded-lg text-xs overflow-x-auto max-h-32`,`bg-gray-50 dark:bg-dark-50`,`text-gray-700 dark:text-gray-300`),children:m.license})]}),m.modelfile&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h4`,{className:`text-sm font-medium text-gray-700 dark:text-gray-300 mb-2`,children:V(`modelManager.modals.details.modelfile`)}),(0,f.jsx)(`pre`,{className:c(`p-3 rounded-lg text-xs overflow-x-auto max-h-60`,`bg-gray-50 dark:bg-dark-50`,`text-gray-700 dark:text-gray-300`),children:m.modelfile})]})]}):(0,f.jsx)(`p`,{className:`text-center text-gray-500`,children:V(`modelManager.modals.details.noDetails`)})})]})]}),document.body),g&&(0,d.createPortal)((0,f.jsxs)(`div`,{className:`fixed inset-0 z-[999999] flex items-center justify-center p-4`,children:[(0,f.jsx)(`div`,{className:`absolute inset-0 bg-black/50 backdrop-blur-sm`,onClick:()=>_(!1)}),(0,f.jsxs)(`div`,{className:c(`relative w-full max-w-md rounded-xl border shadow-2xl`,`bg-white dark:bg-dark-100`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsxs)(`div`,{className:c(`flex items-center justify-between p-4 border-b`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-gray-100`,children:V(`modelManager.modals.copy.title`)}),(0,f.jsx)(`button`,{onClick:()=>_(!1),className:`p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-dark-200`,children:(0,f.jsx)(a,{className:`h-5 w-5 text-gray-500`})})]}),(0,f.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:V(`modelManager.modals.copy.source`)}),(0,f.jsxs)(`select`,{value:v,onChange:e=>y(e.target.value),className:c(`w-full px-3 py-2 rounded-lg border text-sm`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-gray-100`),children:[(0,f.jsx)(`option`,{value:``,children:V(`modelManager.modals.copy.selectModel`)}),e.map(e=>(0,f.jsx)(`option`,{value:e.name,children:e.name},e.name))]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:V(`modelManager.modals.copy.newName`)}),(0,f.jsx)(`input`,{type:`text`,value:b,onChange:e=>x(e.target.value),placeholder:V(`modelManager.modals.copy.placeholder`),className:c(`w-full px-3 py-2 rounded-lg border text-sm`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-gray-100`,`placeholder-gray-500`)})]}),(0,f.jsxs)(l,{onClick:C,disabled:!v.trim()||!b.trim()||S,className:c(`w-full gap-2`,``),children:[S?(0,f.jsx)(r,{className:`h-4 w-4 animate-spin`}):(0,f.jsx)(s,{className:`h-4 w-4`}),V(S?`modelManager.modals.copy.copying`:`modelManager.modals.copy.button`)]})]})]})]}),document.body),w&&(0,d.createPortal)((0,f.jsxs)(`div`,{className:`fixed inset-0 z-[999999] flex items-center justify-center p-4`,children:[(0,f.jsx)(`div`,{className:`absolute inset-0 bg-black/50 backdrop-blur-sm`,onClick:()=>T(!1)}),(0,f.jsxs)(`div`,{className:c(`relative w-full max-w-lg rounded-xl border shadow-2xl`,`bg-white dark:bg-dark-100`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsxs)(`div`,{className:c(`flex items-center justify-between p-4 border-b`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-gray-100`,children:V(`modelManager.modals.create.title`)}),(0,f.jsx)(`button`,{onClick:()=>T(!1),className:`p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-dark-200`,children:(0,f.jsx)(a,{className:`h-5 w-5 text-gray-500`})})]}),(0,f.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:V(`modelManager.modals.create.name`)}),(0,f.jsx)(`input`,{type:`text`,value:E,onChange:e=>D(e.target.value),placeholder:V(`modelManager.modals.create.namePlaceholder`),className:c(`w-full px-3 py-2 rounded-lg border text-sm`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-gray-100`,`placeholder-gray-500`)})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:V(`modelManager.modals.create.modelfile`)}),(0,f.jsx)(`textarea`,{value:O,onChange:e=>k(e.target.value),placeholder:V(`modelManager.modals.create.modelfilePlaceholder`),rows:8,className:c(`w-full px-3 py-2 rounded-lg border text-sm font-mono`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-gray-100`,`placeholder-gray-500`,`resize-none`)}),(0,f.jsxs)(`p`,{className:`mt-1 text-xs text-gray-500`,children:[V(`modelManager.modals.create.see`),` `,(0,f.jsx)(`a`,{href:`https://github.com/ollama/ollama/blob/main/docs/modelfile.md`,target:`_blank`,rel:`noopener noreferrer`,className:`text-primary-600 hover:underline`,children:V(`modelManager.modals.create.docs`)}),` `,V(`modelManager.modals.create.docsLink`)]})]}),(0,f.jsxs)(l,{onClick:j,disabled:!E.trim()||!O.trim()||A,className:c(`w-full gap-2`,``),children:[A?(0,f.jsx)(r,{className:`h-4 w-4 animate-spin`}):(0,f.jsx)(o,{className:`h-4 w-4`}),V(A?`modelManager.modals.create.creating`:`modelManager.modals.create.button`)]})]})]})]}),document.body),M&&(0,d.createPortal)((0,f.jsxs)(`div`,{className:`fixed inset-0 z-[999999] flex items-center justify-center p-4`,children:[(0,f.jsx)(`div`,{className:`absolute inset-0 bg-black/50 backdrop-blur-sm`,onClick:()=>N(!1)}),(0,f.jsxs)(`div`,{className:c(`relative w-full max-w-lg rounded-xl border shadow-2xl`,`bg-white dark:bg-dark-100`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsxs)(`div`,{className:c(`flex items-center justify-between p-4 border-b`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-gray-100`,children:V(`modelManager.modals.embeddings.title`)}),(0,f.jsx)(`button`,{onClick:()=>N(!1),className:`p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-dark-200`,children:(0,f.jsx)(a,{className:`h-5 w-5 text-gray-500`})})]}),(0,f.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:V(`modelManager.modals.embeddings.model`)}),(0,f.jsxs)(`select`,{value:P,onChange:e=>F(e.target.value),className:c(`w-full px-3 py-2 rounded-lg border text-sm`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-gray-100`),children:[(0,f.jsx)(`option`,{value:``,children:V(`modelManager.modals.embeddings.selectModel`)}),e.map(e=>(0,f.jsx)(`option`,{value:e.name,children:e.name},e.name))]}),(0,f.jsx)(`p`,{className:`mt-1 text-xs text-gray-500`,children:V(`modelManager.modals.embeddings.recommended`)})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:V(`modelManager.modals.embeddings.input`)}),(0,f.jsx)(`textarea`,{value:I,onChange:e=>L(e.target.value),placeholder:V(`modelManager.modals.embeddings.placeholder`),rows:3,className:c(`w-full px-3 py-2 rounded-lg border text-sm`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-gray-100`,`placeholder-gray-500`,`resize-none`)})]}),(0,f.jsxs)(l,{onClick:B,disabled:!P.trim()||!I.trim()||z,className:c(`w-full gap-2`,``),children:[z?(0,f.jsx)(r,{className:`h-4 w-4 animate-spin`}):(0,f.jsx)(i,{className:`h-4 w-4`}),V(z?`modelManager.modals.embeddings.generating`:`modelManager.modals.embeddings.button`)]}),R&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:V(`modelManager.modals.embeddings.result`,{count:R.length})}),(0,f.jsxs)(`pre`,{className:c(`p-3 rounded-lg text-xs overflow-x-auto max-h-32`,`bg-gray-50 dark:bg-dark-50`,`text-gray-700 dark:text-gray-300`),children:[`[`,R.slice(0,10).join(`, `),R.length>10&&`, ...`,` ]`]})]})]})]})]}),document.body)]})};export{p as ModelManagerModals,p as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/ModelManagerModals-BECfRnGl.js","js/rolldown-runtime-QTnfLwEv.js","js/markdown-core-fkbHPd-g.js","js/react-vendor-Co1u1rWb.js","js/ui-vendor-njo77ljx.js","js/utils-BaPYjs_z.js","js/utils-vendor-BX3ZwoIK.js","js/Button-Cgmt_2gR.js","assets/index-6X4Fay3z.js","js/logger-BmpKNkls.js","js/demoMode-BhEpMVh5.js","js/api-Ddawdcbi.js","assets/index-j-Q57B_D.css"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{d as t,f as n}from"./markdown-core-fkbHPd-g.js";import{t as r}from"./useQuery-CXwvr2_e.js";import{r as i,t as a}from"./logger-BmpKNkls.js";import{$ as o,Dt as s,F as c,G as l,H as u,It as d,K as f,Pt as p,S as m,T as h,Vt as g,_t as _,b as ee,f as te,ft as v,lt as y,mt as b,n as x,ot as S,pt as C,q as w,rt as ne,st as T,t as re,u as E,ut as ie,v as ae,vt as oe,z as se}from"./ui-vendor-njo77ljx.js";import{c as D,d as ce}from"./api-Ddawdcbi.js";import{t as O}from"./utils-BaPYjs_z.js";import{t as k}from"./Button-Cgmt_2gR.js";import{P as A,a as le,i as ue,q as de,x as fe}from"../assets/index-6X4Fay3z.js";var j=e(n(),1),M=t();function pe({expanded:e,models:t,search:n,task:r,sort:i,loadingModels:a,canInstallModels:o,expandedModelId:s,loadingGgufModelId:c,ggufFiles:l,pullingModel:u,pullProgress:d,setSearch:f,setTask:p,setSort:g,onToggle:ee,onToggleModel:te,onPullGguf:v,onCancelPull:y,onRefresh:x}){let{t:C}=A();return(0,M.jsxs)(`div`,{className:O(`overflow-hidden rounded-2xl border`,`bg-white/60 dark:bg-white/[0.03]`,`border-gray-200/80 dark:border-white/10`),children:[(0,M.jsxs)(`button`,{onClick:ee,"aria-expanded":e,className:O(`w-full flex items-center justify-between p-4`,`hover:bg-gray-50 dark:hover:bg-dark-50`,`transition-colors`),children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,M.jsx)(re,{className:`h-4 w-4 text-gray-500 dark:text-dark-500`}),(0,M.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-dark-800`,children:C(`modelManager.sections.huggingface`,`HuggingFace Hub`)}),t.length>0&&(0,M.jsxs)(`span`,{className:O(`px-2 py-0.5 rounded-full text-xs font-medium`,`bg-gray-100 dark:bg-dark-200`,`text-gray-600 dark:text-gray-400`),children:[t.length,` `,C(`modelManager.library.available`,`available`)]})]}),e?(0,M.jsx)(b,{className:`h-5 w-5 text-gray-500`}):(0,M.jsx)(_,{className:`h-5 w-5 text-gray-500`})]}),e&&(0,M.jsxs)(`div`,{className:`p-4 pt-0 space-y-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-3`,children:[(0,M.jsxs)(`div`,{className:`relative flex-1`,children:[(0,M.jsx)(m,{className:`absolute start-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400 dark:text-gray-500`}),(0,M.jsx)(`input`,{type:`text`,value:n,onChange:e=>f(e.target.value),placeholder:C(`modelManager.huggingface.search`,`Search HuggingFace models...`),className:O(`w-full rounded-xl border py-2 pe-4 ps-10 text-sm`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-dark-700`,`placeholder-gray-500 dark:placeholder-gray-400`,`focus:outline-none focus:ring-2 focus:ring-primary-500/20`,`focus:border-primary-500`)})]}),(0,M.jsxs)(`select`,{value:r,onChange:e=>p(e.target.value),className:O(`px-3 py-2 rounded-lg border text-sm min-w-[160px]`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-dark-700`,`focus:outline-none focus:ring-2 focus:ring-primary-500/20`),children:[(0,M.jsx)(`option`,{value:`text-generation`,children:C(`modelManager.huggingface.tasks.textGen`,`Text Generation`)}),(0,M.jsx)(`option`,{value:`text-to-speech`,children:C(`modelManager.huggingface.tasks.tts`,`Text to Speech`)}),(0,M.jsx)(`option`,{value:`text-to-image`,children:C(`modelManager.huggingface.tasks.image`,`Text to Image`)}),(0,M.jsx)(`option`,{value:`automatic-speech-recognition`,children:C(`modelManager.huggingface.tasks.stt`,`Speech Recognition`)})]}),(0,M.jsxs)(`select`,{value:i,onChange:e=>g(e.target.value),className:O(`px-3 py-2 rounded-lg border text-sm min-w-[140px]`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-dark-700`,`focus:outline-none focus:ring-2 focus:ring-primary-500/20`),children:[(0,M.jsx)(`option`,{value:`downloads`,children:C(`modelManager.huggingface.sort.downloads`,`Most Downloads`)}),(0,M.jsx)(`option`,{value:`likes`,children:C(`modelManager.huggingface.sort.likes`,`Most Liked`)}),(0,M.jsx)(`option`,{value:`lastModified`,children:C(`modelManager.huggingface.sort.recent`,`Recently Updated`)})]})]}),!o&&(0,M.jsx)(`p`,{className:`text-xs text-amber-700 dark:text-amber-300`,children:C(`modelManager.pull.restricted`)}),a?(0,M.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,M.jsx)(se,{className:`h-5 w-5 animate-spin text-gray-400`})}):t.length===0?(0,M.jsx)(`div`,{className:`text-center py-8 text-gray-500`,children:C(`modelManager.huggingface.noResults`,`No models found. Try adjusting your search or filters.`)}):(0,M.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:t.map(e=>(0,M.jsx)(me,{model:e,expanded:s===e.id,loadingGguf:c===e.id,ggufFiles:l[e.id]||[],pullingModel:u,pullProgress:d,canInstallModels:o,onToggle:()=>te(e.id),onPullGguf:v,onCancelPull:y},e.id))}),(0,M.jsxs)(`div`,{className:`flex items-center justify-between pt-2`,children:[(0,M.jsxs)(`a`,{href:`https://huggingface.co/models`,target:`_blank`,rel:`noopener noreferrer`,className:O(`inline-flex items-center gap-1.5 text-xs`,`text-primary-600 dark:text-primary-400`,`hover:underline`),children:[(0,M.jsx)(S,{className:`h-3 w-3`}),C(`modelManager.huggingface.browseAll`,`Browse all on HuggingFace`)]}),(0,M.jsxs)(k,{onClick:x,variant:`outline`,size:`sm`,disabled:a,className:O(`gap-1.5`,``,``),children:[(0,M.jsx)(h,{className:O(`h-3.5 w-3.5`,a&&`animate-spin`)}),C(`modelManager.library.refresh`,`Refresh`)]})]})]})]})}function me({model:e,expanded:t,loadingGguf:n,ggufFiles:r,pullingModel:i,pullProgress:a,canInstallModels:o,onToggle:s,onPullGguf:c,onCancelPull:u}){let{t:d}=A();return(0,M.jsxs)(`div`,{className:O(`rounded-lg border transition-all overflow-hidden`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`hover:shadow-md hover:border-gray-300 dark:hover:border-dark-400`),children:[(0,M.jsxs)(`div`,{className:`p-4 cursor-pointer`,onClick:s,children:[(0,M.jsxs)(`div`,{className:`flex items-start justify-between gap-2 mb-2`,children:[(0,M.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`h4`,{className:`font-medium text-gray-900 dark:text-dark-800 truncate`,children:e.id}),e.gated&&(0,M.jsx)(`span`,{className:O(`px-1.5 py-0.5 rounded text-xs`,`bg-yellow-100 dark:bg-yellow-900/30`,`text-yellow-700 dark:text-yellow-400`),children:d(`modelManager.huggingface.gated`,`Gated`)})]}),(0,M.jsxs)(`p`,{className:`text-xs text-gray-500 dark:text-dark-600 mt-0.5`,children:[d(`modelManager.huggingface.by`,`by`),` `,e.author]})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,M.jsx)(`a`,{href:`https://huggingface.co/${e.id}`,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),className:`p-1.5 rounded-lg hover:bg-gray-200 dark:hover:bg-dark-300 transition-colors`,title:d(`modelManager.huggingface.viewOnHF`,`View on HuggingFace`),children:(0,M.jsx)(S,{className:`h-4 w-4 text-gray-400 dark:text-gray-500`})}),(0,M.jsx)(_,{className:O(`h-4 w-4 text-gray-400 transition-transform`,t&&`rotate-180`)})]})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-gray-500 dark:text-dark-600`,children:[(0,M.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,M.jsx)(T,{className:`h-3.5 w-3.5`}),N(e.downloads)]}),(0,M.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,M.jsx)(l,{className:`h-3.5 w-3.5`}),N(e.likes)]}),e.pipeline_tag&&(0,M.jsx)(`span`,{className:O(`px-1.5 py-0.5 rounded`,`bg-gray-200 dark:bg-dark-300`),children:e.pipeline_tag})]})]}),t&&(0,M.jsx)(he,{modelId:e.id,loading:n,files:r,pullingModel:i,pullProgress:a,canInstallModels:o,onPullGguf:c,onCancelPull:u})]})}function he({modelId:e,loading:t,files:n,pullingModel:r,pullProgress:i,canInstallModels:a,onPullGguf:o,onCancelPull:s}){let{t:c}=A();return(0,M.jsx)(`div`,{className:`px-4 pb-4 pt-1 border-t border-gray-200 dark:border-dark-300 bg-white dark:bg-dark-100`,children:t?(0,M.jsxs)(`div`,{className:`flex items-center justify-center py-4`,children:[(0,M.jsx)(se,{className:`h-4 w-4 animate-spin text-gray-400`}),(0,M.jsx)(`span`,{className:`ml-2 text-xs text-gray-500`,children:c(`modelManager.huggingface.checkingGguf`)})]}):n.length===0?(0,M.jsx)(`div`,{className:`py-4 text-center text-xs text-gray-500 dark:text-gray-400`,children:c(`modelManager.huggingface.noGgufAvailable`)}):(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(`div`,{className:`text-xs font-medium text-gray-600 dark:text-gray-300 mb-2`,children:c(`modelManager.huggingface.ggufFilesCount`,{count:n.length})}),n.map(e=>(0,M.jsx)(ge,{file:e,pulling:r===e.ollamaCommand,pullProgress:i,canInstallModels:a,disabled:!!r||!a,onPullGguf:o,onCancelPull:s},e.filename)),r?.startsWith(`hf.co/`)&&r.includes(e)&&i?.percent!==void 0&&(0,M.jsx)(`div`,{className:`w-full bg-gray-200 dark:bg-dark-300 rounded-full h-1.5 overflow-hidden mt-2`,children:(0,M.jsx)(`div`,{className:`h-1.5 rounded-full bg-primary-500 transition-all duration-300`,style:{width:`${i.percent}%`}})})]})})}function ge({file:e,pulling:t,disabled:n,pullProgress:r,onPullGguf:i,onCancelPull:a}){let{t:o}=A();return(0,M.jsxs)(`div`,{className:`flex items-center gap-2 p-2 rounded-lg bg-gray-50 dark:bg-dark-50 border border-gray-200 dark:border-dark-300`,children:[(0,M.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,M.jsx)(`div`,{className:`text-xs font-medium text-gray-800 dark:text-gray-200 truncate`,children:e.filename}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2 mt-0.5 text-xs text-gray-500 dark:text-gray-400`,children:[(0,M.jsx)(`span`,{children:e.sizeFormatted}),e.quantization&&(0,M.jsx)(`span`,{className:`px-1.5 py-0.5 rounded bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-400`,children:e.quantization})]})]}),t?(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`div`,{className:`text-xs text-gray-500 w-12 text-right`,children:r?.percent===void 0?`...`:`${r.percent}%`}),(0,M.jsx)(`button`,{onClick:e=>{e.stopPropagation(),a()},className:`p-1.5 rounded-lg text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20`,children:(0,M.jsx)(x,{className:`h-4 w-4`})})]}):(0,M.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),i(e.ollamaCommand,e.filename)},disabled:n,className:O(`px-3 py-1.5 rounded-lg text-xs font-medium`,`bg-primary-100 dark:bg-primary-900/30`,`text-primary-700 dark:text-primary-400`,`hover:bg-primary-200 dark:hover:bg-primary-900/50`,`disabled:opacity-50 disabled:cursor-not-allowed`),children:[(0,M.jsx)(T,{className:`h-3 w-3 inline mr-1`}),o(`models.pull`)]})]})}function N(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e}function _e({expanded:e,models:t,onToggle:n,isModelRunning:r,formatSize:i,onShowModel:a,onCopyModel:o,onDeleteModel:s}){let{t:c}=A();return(0,M.jsxs)(`div`,{className:O(`overflow-hidden rounded-2xl border`,`bg-white/60 dark:bg-white/[0.03]`,`border-gray-200/80 dark:border-white/10`),children:[(0,M.jsxs)(`button`,{onClick:n,"aria-expanded":e,className:O(`w-full flex items-center justify-between p-4`,`hover:bg-gray-50 dark:hover:bg-dark-50`,`transition-colors`),children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,M.jsx)(w,{className:`h-4 w-4 text-gray-500 dark:text-dark-500`}),(0,M.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-dark-800`,children:c(`modelManager.sections.local`)}),(0,M.jsxs)(`span`,{className:O(`px-2 py-0.5 rounded-full text-xs font-medium`,`bg-gray-100 dark:bg-dark-200`,`text-gray-600 dark:text-gray-400`),children:[t.length,` `,c(`modelManager.local.installed`)]})]}),e?(0,M.jsx)(b,{className:`h-5 w-5 text-gray-500`}):(0,M.jsx)(_,{className:`h-5 w-5 text-gray-500`})]}),e&&(0,M.jsx)(`div`,{className:`p-4 pt-0`,children:t.length===0?(0,M.jsxs)(`div`,{className:O(`text-center py-12 rounded-lg border-2 border-dashed`,`border-gray-200 dark:border-dark-300`),children:[(0,M.jsx)(w,{className:`h-12 w-12 mx-auto mb-3 text-gray-300 dark:text-gray-600`}),(0,M.jsx)(`p`,{className:`text-gray-600 dark:text-dark-600 mb-2`,children:c(`modelManager.local.noModels`)}),(0,M.jsx)(`p`,{className:`text-sm text-gray-500 dark:text-gray-500`,children:c(`modelManager.local.pullToStart`)})]}):(0,M.jsx)(`div`,{className:`space-y-3`,children:t.map(e=>(0,M.jsx)(ve,{model:e,running:r(e.name),formatSize:i,onShowModel:a,onCopyModel:o,onDeleteModel:s},e.name))})})]})}function ve({model:e,running:t,formatSize:n,onShowModel:r,onCopyModel:i,onDeleteModel:a}){let{t:o}=A();return(0,M.jsx)(`div`,{className:O(`p-4 rounded-lg border transition-colors`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`hover:bg-gray-100 dark:hover:bg-dark-200`),children:(0,M.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,M.jsx)(`h4`,{className:`font-medium text-gray-900 dark:text-dark-800`,children:e.name}),t&&(0,M.jsxs)(`span`,{className:O(`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium`,`bg-green-100 dark:bg-green-900/30`,`text-green-700 dark:text-green-400`),children:[(0,M.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-green-500 animate-pulse`}),o(`modelManager.local.running`)]})]}),(0,M.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-sm text-gray-600 dark:text-dark-600 mt-2`,children:[(0,M.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,M.jsx)(w,{className:`h-3.5 w-3.5`}),n(e.size)]}),e.details?.parameter_size&&(0,M.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,M.jsx)(y,{className:`h-3.5 w-3.5`}),e.details.parameter_size]}),e.details?.quantization_level&&(0,M.jsx)(`span`,{className:O(`px-1.5 py-0.5 rounded text-xs`,`bg-gray-200 dark:bg-dark-300`,`text-gray-600 dark:text-gray-400`),children:e.details.quantization_level}),e.details?.family&&(0,M.jsx)(`span`,{className:`text-gray-500 dark:text-gray-500`,children:e.details.family})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-gray-400 dark:text-dark-500 mt-2`,children:[(0,M.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,M.jsx)(C,{className:`h-3 w-3`}),new Date(e.modified_at).toLocaleDateString()]}),(0,M.jsxs)(`span`,{className:`flex items-center gap-1 font-mono truncate max-w-[200px]`,title:e.digest,children:[(0,M.jsx)(f,{className:`h-3 w-3`}),e.digest.slice(0,12),`...`]})]})]}),(0,M.jsxs)(`div`,{className:`flex gap-2 flex-shrink-0`,children:[(0,M.jsxs)(k,{onClick:()=>r(e.name),variant:`outline`,size:`sm`,className:O(`gap-1.5`,``,``),children:[(0,M.jsx)(u,{className:`h-3.5 w-3.5`}),o(`modelManager.local.info`)]}),(0,M.jsxs)(k,{onClick:()=>i(e.name),variant:`outline`,size:`sm`,className:O(`gap-1.5`,``,``),children:[(0,M.jsx)(ie,{className:`h-3.5 w-3.5`}),o(`modelManager.local.copy`)]}),(0,M.jsxs)(k,{onClick:()=>a(e.name),variant:`outline`,size:`sm`,className:O(`gap-1.5`,`text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300`,``,``),children:[(0,M.jsx)(E,{className:`h-3.5 w-3.5`}),o(`modelManager.local.delete`)]})]})]})})}function ye({expanded:e,models:t,totalAvailable:n,categories:r,filter:i,search:a,loading:o,pulling:s,canInstallModels:c,pullSectionExpanded:l,setFilter:u,setSearch:f,isModelInstalled:p,normalizeCloudPullName:g,onToggle:ee,onTogglePullSection:te,onPullModel:y,onRefresh:x}){let{t:S}=A();return(0,M.jsxs)(`div`,{className:O(`overflow-hidden rounded-2xl border`,`bg-white/60 dark:bg-white/[0.03]`,`border-gray-200/80 dark:border-white/10`),children:[(0,M.jsxs)(`button`,{onClick:ee,"aria-expanded":e,className:O(`w-full flex items-center justify-between p-4`,`hover:bg-gray-50 dark:hover:bg-dark-50`,`transition-colors`),children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,M.jsx)(v,{className:`h-4 w-4 text-gray-500 dark:text-dark-500`}),(0,M.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-dark-800`,children:S(`modelManager.sections.library`)}),(0,M.jsxs)(`span`,{className:O(`px-2 py-0.5 rounded-full text-xs font-medium`,`bg-gray-100 dark:bg-dark-200`,`text-gray-600 dark:text-gray-400`),children:[n,` `,S(`modelManager.library.available`)]})]}),e?(0,M.jsx)(b,{className:`h-5 w-5 text-gray-500`}):(0,M.jsx)(_,{className:`h-5 w-5 text-gray-500`})]}),e&&(0,M.jsxs)(`div`,{className:`p-4 pt-0 space-y-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-3`,children:[(0,M.jsxs)(`div`,{className:`relative flex-1`,children:[(0,M.jsx)(m,{className:`absolute start-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400 dark:text-gray-500`}),(0,M.jsx)(`input`,{type:`text`,value:a,onChange:e=>f(e.target.value),placeholder:S(`modelManager.library.search`),className:O(`w-full rounded-xl border py-2 pe-4 ps-10 text-sm`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-dark-700`,`placeholder-gray-500 dark:placeholder-gray-400`,`focus:outline-none focus:ring-2 focus:ring-primary-500/20`,`focus:border-primary-500`)})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(d,{className:`h-4 w-4 text-gray-400`}),(0,M.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:r.map(e=>(0,M.jsx)(`button`,{onClick:()=>u(e),className:O(`px-2.5 py-1 rounded-full text-xs font-medium transition-colors`,i===e?`bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400`:`bg-gray-100 dark:bg-dark-200 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-dark-300`),children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]})]}),o?(0,M.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,M.jsx)(h,{className:`h-5 w-5 animate-spin text-gray-400`})}):t.length===0?(0,M.jsx)(`div`,{className:`text-center py-8 text-gray-500`,children:S(`modelManager.library.noResults`)}):(0,M.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:t.map(e=>{let t=e.category===`cloud`?g(e.name):e.name;return(0,M.jsx)(P,{model:e,installed:p(e.name)||p(t),pulling:s,canInstallModels:c,pullSectionExpanded:l,onTogglePullSection:te,onPullModel:y},e.name)})}),(0,M.jsx)(`div`,{className:`flex justify-center`,children:(0,M.jsxs)(k,{onClick:x,variant:`outline`,size:`sm`,disabled:o,className:O(`gap-1.5`,``,``),children:[(0,M.jsx)(h,{className:O(`h-3.5 w-3.5`,o&&`animate-spin`)}),S(`modelManager.library.refresh`)]})})]})]})}function P({model:e,installed:t,pulling:n,canInstallModels:r,pullSectionExpanded:i,onTogglePullSection:a,onPullModel:o}){let{t:s}=A();return(0,M.jsxs)(`div`,{"data-testid":`library-model-card-${e.name}`,className:O(`p-4 rounded-lg border transition-all`,`bg-gray-50 dark:bg-dark-50`,t?`border-green-200 dark:border-green-800/50`:`border-gray-200 dark:border-dark-300`,`hover:shadow-md hover:border-gray-300 dark:hover:border-dark-400`),children:[(0,M.jsxs)(`div`,{className:`flex items-start justify-between gap-2 mb-2`,children:[(0,M.jsx)(`h4`,{className:`font-medium text-gray-900 dark:text-dark-800`,children:e.name}),t&&(0,M.jsxs)(`span`,{className:O(`flex items-center gap-1 px-1.5 py-0.5 rounded text-xs`,`bg-green-100 dark:bg-green-900/30`,`text-green-700 dark:text-green-400`),children:[(0,M.jsx)(oe,{className:`h-3 w-3`}),s(`modelManager.library.installed`)]})]}),(0,M.jsx)(`p`,{className:`text-xs text-gray-600 dark:text-dark-600 mb-3 line-clamp-2`,children:e.description}),(0,M.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 mb-3`,children:[e.sizes.slice(0,4).map(e=>(0,M.jsx)(`span`,{className:O(`px-1.5 py-0.5 rounded text-xs`,`bg-gray-200 dark:bg-dark-300`,`text-gray-600 dark:text-gray-400`),children:e},e)),e.sizes.length>4&&(0,M.jsx)(`span`,{className:`text-xs text-gray-400`,children:s(`modelManager.library.more`,{count:e.sizes.length-4})})]}),(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-gray-500`,children:[e.pulls&&(0,M.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,M.jsx)(T,{className:`h-3 w-3`}),e.pulls]}),(0,M.jsx)(`span`,{className:O(`px-1.5 py-0.5 rounded capitalize`,e.category===`cloud`?`bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400`:`bg-gray-100 dark:bg-dark-200`),children:e.category})]}),(0,M.jsxs)(k,{"data-testid":`library-model-pull-${e.name}`,onClick:()=>{i||a(),o(e.name,e.category)},variant:`outline`,size:`sm`,disabled:n||!r,className:O(`gap-1 text-xs`,``,``),children:[(0,M.jsx)(T,{className:`h-3 w-3`}),s(`modelManager.pull.button`)]})]})]})}function be({expanded:e,modelName:t,setModelName:n,pulling:r,progress:i,canInstallModels:a,popularModels:o,onToggle:s,onPull:c,onCancelPull:l,formatSize:u}){let{t:d}=A();return(0,M.jsxs)(`div`,{className:O(`overflow-hidden rounded-2xl border`,`bg-white/60 dark:bg-white/[0.03]`,`border-gray-200/80 dark:border-white/10`),children:[(0,M.jsxs)(`button`,{onClick:s,"aria-expanded":e,className:O(`w-full flex items-center justify-between p-4`,`hover:bg-gray-50 dark:hover:bg-dark-50`,`transition-colors`),children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,M.jsx)(T,{className:`h-4 w-4 text-primary-600 dark:text-primary-400`}),(0,M.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-dark-800`,children:d(`modelManager.sections.pull`)})]}),e?(0,M.jsx)(b,{className:`h-5 w-5 text-gray-500`}):(0,M.jsx)(_,{className:`h-5 w-5 text-gray-500`})]}),e&&(0,M.jsxs)(`div`,{className:`p-4 pt-0 space-y-4`,children:[(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[(0,M.jsxs)(`div`,{className:`relative flex-1`,children:[(0,M.jsx)(m,{className:`absolute start-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400 dark:text-gray-500`}),(0,M.jsx)(`input`,{type:`text`,value:t,onChange:e=>n(e.target.value),placeholder:d(`modelManager.pull.placeholder`),className:O(`w-full rounded-xl border py-2.5 pe-4 ps-10 text-sm`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-dark-700`,`placeholder-gray-500 dark:placeholder-gray-400`,`focus:outline-none focus:ring-2 focus:ring-primary-500/20`,`focus:border-primary-500`),disabled:r||!a,onKeyDown:e=>{e.key===`Enter`&&!r&&a&&c()}})]}),r?(0,M.jsxs)(k,{onClick:l,variant:`outline`,className:O(`px-4 py-2.5 gap-2`,`text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300`,``,``),children:[(0,M.jsx)(x,{className:`h-4 w-4`}),d(`modelManager.pull.cancel`)]}):(0,M.jsxs)(k,{onClick:c,disabled:!t.trim()||!a,className:O(`px-4 py-2.5 gap-2`,``),children:[(0,M.jsx)(T,{className:`h-4 w-4`}),d(`modelManager.pull.button`)]})]}),r&&i&&(0,M.jsx)(F,{progress:i,formatSize:u}),!a&&(0,M.jsx)(`p`,{className:`text-xs text-amber-700 dark:text-amber-300`,children:d(`modelManager.pull.restricted`)}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`text-xs font-medium text-gray-500 dark:text-gray-400 mb-2`,children:d(`modelManager.pull.popular`)}),(0,M.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:o.map(e=>(0,M.jsxs)(`button`,{onClick:()=>n(e.name),disabled:r||!a,className:O(`px-3 py-1.5 rounded-full text-xs font-medium transition-colors`,`bg-gray-100 dark:bg-dark-200`,`text-gray-700 dark:text-gray-300`,`hover:bg-gray-200 dark:hover:bg-dark-300`,`border border-gray-200 dark:border-dark-300`,`disabled:opacity-50 disabled:cursor-not-allowed`),children:[e.name,(0,M.jsx)(`span`,{className:`ml-1 text-gray-400 dark:text-gray-500`,children:e.size})]},e.name))})]}),(0,M.jsxs)(`a`,{href:`https://ollama.com/library`,target:`_blank`,rel:`noopener noreferrer`,className:O(`inline-flex items-center gap-1.5 text-xs`,`text-primary-600 dark:text-primary-400`,`hover:underline`),children:[(0,M.jsx)(S,{className:`h-3 w-3`}),d(`modelManager.pull.browseAll`)]})]})]})}function F({progress:e,formatSize:t}){let{t:n}=A(),r=e.status===`starting`?n(`modelManager.progress.starting`):e.status.startsWith(`pulling`)?`${n(`modelManager.progress.pullingLayer`)} ${e.status.replace(`pulling `,``)}`:e.status.startsWith(`verifying sha256`)?n(`modelManager.progress.verifyingDigest`):e.status===`writing manifest`?n(`modelManager.progress.writing`):e.status===`removing any unused layers`?n(`modelManager.progress.cleaning`):e.status;return(0,M.jsxs)(`div`,{className:O(`p-4 rounded-lg border`,`bg-gray-50 dark:bg-dark-200`,`border-gray-200 dark:border-dark-300`),children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,M.jsx)(`span`,{className:`text-sm font-medium text-gray-800 dark:text-dark-700`,children:r}),e.percent!==void 0&&(0,M.jsxs)(`span`,{className:`text-sm font-mono text-gray-600 dark:text-dark-600`,children:[e.percent,`%`]})]}),e.percent!==void 0&&(0,M.jsx)(`div`,{className:`w-full bg-gray-200 dark:bg-dark-400 rounded-full h-2 overflow-hidden`,children:(0,M.jsx)(`div`,{className:O(`h-2 rounded-full transition-all duration-300`,`bg-primary-500 dark:bg-primary-400`),style:{width:`${e.percent}%`}})}),e.total&&e.completed&&(0,M.jsxs)(`div`,{className:`mt-2 text-xs text-gray-600 dark:text-dark-600`,children:[t(e.completed),` / `,t(e.total)]})]})}var xe=a(`components:model-manager`),Se=j.lazy(()=>i(()=>import(`./ModelManagerModals-BECfRnGl.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]))),I=e=>{let t=e.split(`:`).pop()?.toLowerCase();return t===`cloud`||t?.endsWith(`-cloud`)===!0},Ce=e=>{let t=e.trim();if(!t||I(t))return t;let n=t.lastIndexOf(`:`);return n===-1?`${t}:cloud`:`${t.slice(0,n)}:${t.slice(n+1)}-cloud`},L=()=>{let{t:e}=A(),{user:t,systemInfo:n}=fe(),i=t?.role===`admin`||(n?.allowUserModelPull??!0),a=de(),[l,u]=(0,j.useState)(`all`),[d,f]=(0,j.useState)(``),[m,v]=(0,j.useState)(``),[y,x]=(0,j.useState)(!1),[S,C]=(0,j.useState)(null),[T,E]=(0,j.useState)(null),[oe,se]=(0,j.useState)(null),[le,ue]=(0,j.useState)(``),[me,he]=(0,j.useState)(!1),[ge,N]=(0,j.useState)(!1),[ve,P]=(0,j.useState)(!1),[F,I]=(0,j.useState)(``),[L,R]=(0,j.useState)(``),[we,Te]=(0,j.useState)(!1),[Ee,De]=(0,j.useState)(!1),[z,Oe]=(0,j.useState)(``),[ke,Ae]=(0,j.useState)(``),[je,Me]=(0,j.useState)(!1),[Ne,Pe]=(0,j.useState)(!1),[Fe,Ie]=(0,j.useState)(``),[Le,Re]=(0,j.useState)(``),[ze,Be]=(0,j.useState)(null),[Ve,He]=(0,j.useState)(!1),[Ue,We]=(0,j.useState)(``),[Ge,Ke]=(0,j.useState)(``),[B,qe]=(0,j.useState)(`text-generation`),[V,Je]=(0,j.useState)(`downloads`),[Ye,Xe]=(0,j.useState)(null),[Ze,Qe]=(0,j.useState)({}),[$e,et]=(0,j.useState)(null),[tt,H]=(0,j.useState)(null),[nt,U]=(0,j.useState)(null),[rt,W]=(0,j.useState)(null),[G,it]=(0,j.useState)(new Set([`pull`,`local`])),K=e=>{it(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},{data:q,isLoading:at,refetch:J}=r({queryKey:[`ollama-state`],queryFn:async()=>{let[e,t,n,r]=await Promise.all([D.getModels(),D.listRunningModels(),D.getVersion(),D.checkHealth()]);return{models:e.success&&e.data||[],runningModels:t.success&&Array.isArray(t.data)?t.data:[],ollamaVersion:n.success&&n.data?n.data.version:null,isHealthy:r.success}}}),Y=q?.models??[],X=q?.runningModels??[],ot=q?.ollamaVersion??null,st=q?.isHealthy??null,Z=(0,j.useCallback)(async()=>{await J()},[J]),{data:Q=[],isLoading:ct}=r({queryKey:[`ollama-library`],queryFn:async()=>{let e=await D.getLibraryModels();return e.success&&e.data?e.data:[]}}),{data:lt=[],isLoading:ut}=r({queryKey:[`ollama-library`,`cloud`],queryFn:async()=>{let e=await D.getLibraryModels({category:`cloud`});return e.success&&e.data?e.data:[]},enabled:l===`cloud`}),dt=()=>a.invalidateQueries({queryKey:[`ollama-library`]});(0,j.useEffect)(()=>{let e=setTimeout(()=>{Ke(Ue)},300);return()=>clearTimeout(e)},[Ue]);let ft=G.has(`huggingface`),{data:pt=[],isLoading:mt}=r({queryKey:[`hf-models`,B,Ge,V],queryFn:async()=>{let e=await ce.getModels({task:B,search:Ge||void 0,sort:V,limit:30});return e.success&&e.data?e.data:[]},enabled:ft}),ht=()=>a.invalidateQueries({queryKey:[`hf-models`,B,Ge,V]}),gt=(0,j.useCallback)(async e=>{let[t,n]=e.split(`/`);if(!(!t||!n)){et(e);try{let r=await ce.getGgufFiles(t,n);r.success&&r.data&&Qe(t=>({...t,[e]:r.data}))}catch(e){xe.error(`Failed to load GGUF files:`,e)}finally{et(null)}}},[]),_t=(0,j.useCallback)(e=>{Ye===e?Xe(null):(Xe(e),Ze[e]||gt(e))},[Ye,Ze,gt]),vt=(0,j.useCallback)((t,n)=>{if(!i){g.error(e(`modelManager.pull.restricted`));return}if(!tt){H(t),U({status:`starting`});try{let e=D.pullModelStream(t,e=>{U(e)},()=>{U(null),H(null),W(null),g.success(`Downloaded ${n}`),Z()},e=>{U(null),H(null),W(null),g.error(`Failed to download: ${e}`)});W(()=>e)}catch{U(null),H(null),g.error(`Failed to start download`)}}},[i,tt,Z,e]),yt=(0,j.useCallback)(()=>{rt&&(rt(),W(null),H(null),U(null))},[rt]),bt=async(t,n)=>{if(!i){g.error(e(`modelManager.pull.restricted`));return}let r=t||m.trim(),a=n===`cloud`||!t&&l===`cloud`?Ce(r):r;if(!a){g.error(e(`modelManager.pull.enterName`));return}t&&v(a),x(!0),C({status:`starting`});try{let t=D.pullModelStream(a,e=>{C(e)},()=>{C(null),x(!1),E(null),g.success(e(`modelManager.pull.success`,{name:a})),v(``),Z()},t=>{C(null),x(!1),E(null),g.error(e(`modelManager.pull.failed`)+`: `+t)});E(()=>t)}catch(t){let n=t instanceof Error?t.message:String(t);g.error(e(`modelManager.pull.failed`)+`: `+n),C(null),x(!1),E(null)}},xt=()=>{T&&(T(),E(null),x(!1),C(null),g.success(e(`modelManager.pull.cancelled`)))},St=async t=>{if(confirm(e(`modelManager.local.deleteConfirm`,{name:t})))try{await D.deleteModel(t),g.success(e(`modelManager.local.deleteSuccess`,{name:t})),await Z()}catch(t){let n=t instanceof Error?t.message:String(t);g.error(e(`modelManager.local.deleteFailed`)+`: `+n)}},Ct=async t=>{N(!0),ue(t),he(!0);try{let n=await D.showModel(t,!0);n.success&&n.data?se(n.data):g.error(e(`modelManager.modals.details.noDetails`))}catch(t){let n=t instanceof Error?t.message:String(t);g.error(e(`modelManager.modals.details.noDetails`)+`: `+n)}finally{N(!1)}},wt=async()=>{if(!F.trim()||!L.trim()){g.error(e(`modelManager.modals.copy.enterBoth`));return}Te(!0);try{await D.copyModel(F.trim(),L.trim()),g.success(e(`modelManager.modals.copy.success`,{name:L})),P(!1),I(``),R(``),await Z()}catch(t){let n=t instanceof Error?t.message:String(t);g.error(e(`modelManager.modals.copy.failed`)+`: `+n)}finally{Te(!1)}},Tt=async()=>{if(!z.trim()||!ke.trim()){g.error(e(`modelManager.modals.create.enterBoth`));return}Me(!0);try{await D.createModel({model:z.trim(),modelfile:ke.trim()}),g.success(e(`modelManager.modals.create.success`,{name:z})),De(!1),Oe(``),Ae(``),await Z()}catch(t){let n=t instanceof Error?t.message:String(t);g.error(e(`modelManager.modals.create.failed`)+`: `+n)}finally{Me(!1)}},Et=async()=>{if(!Fe.trim()||!Le.trim()){g.error(e(`modelManager.modals.embeddings.enterBoth`));return}He(!0),Be(null);try{let t=await D.generateEmbeddings({model:Fe.trim(),input:Le.trim()});if(t.success&&t.data){let n=t.data.embeddings?.[0]||[];Be(n),g.success(e(`modelManager.modals.embeddings.success`,{count:n.length}))}}catch(t){let n=t instanceof Error?t.message:String(t);g.error(e(`modelManager.modals.embeddings.failed`)+`: `+n)}finally{He(!1)}},$=e=>{let t=e/(1024*1024*1024);return t>=1?`${t.toFixed(2)} GB`:`${(e/(1024*1024)).toFixed(1)} MB`},Dt=e=>Array.isArray(X)&&X.some(t=>t.name===e),Ot=()=>Y.reduce((e,t)=>e+t.size,0),kt=()=>X.reduce((e,t)=>e+(t.size_vram||0),0),At=e=>Y.some(t=>t.name===e||t.name.startsWith(e+`:`)),jt=(l===`cloud`?lt:Q).filter(e=>{let t=l===`all`||l===`cloud`||e.category===l,n=!d||e.name.toLowerCase().includes(d.toLowerCase())||e.description.toLowerCase().includes(d.toLowerCase());return t&&n}),Mt=[`all`,...new Set([...Q.map(e=>e.category),`cloud`])],Nt=(0,j.useMemo)(()=>Q.length>0?Q.slice(0,10).map(e=>({name:e.name,category:e.category,size:e.sizes?.[0]||``})):[{name:`deepseek-r1`,category:`reasoning`,size:`7B`},{name:`llama3.2`,category:`general`,size:`3B`},{name:`gemma3`,category:`general`,size:`4B`},{name:`qwen2.5`,category:`general`,size:`7B`},{name:`mistral`,category:`general`,size:`7B`},{name:`codellama`,category:`coding`,size:`7B`},{name:`nomic-embed-text`,category:`embedding`,size:`137M`},{name:`llava`,category:`vision`,size:`7B`},{name:`phi3`,category:`general`,size:`3.8B`},{name:`gemma2`,category:`general`,size:`9B`}],[Q]),Pt=me||ve||Ee||Ne;return at?(0,M.jsx)(`div`,{className:`flex items-center justify-center p-8`,children:(0,M.jsxs)(`div`,{className:`flex items-center gap-3 text-gray-600 dark:text-dark-600`,children:[(0,M.jsx)(h,{className:`h-5 w-5 animate-spin`}),e(`modelManager.loading`)]})}):(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsx)(`div`,{className:O(`rounded-2xl border px-4 py-3`,`bg-white/60 dark:bg-white/[0.03]`,`border-gray-200/80 dark:border-white/10`),children:(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`div`,{className:O(`w-2.5 h-2.5 rounded-full`,st?`bg-green-500`:`bg-red-500`)}),(0,M.jsx)(`span`,{className:`text-sm font-medium text-gray-700 dark:text-gray-300`,children:e(st?`modelManager.systemStatus.online`:`modelManager.systemStatus.offline`)})]}),ot&&(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-gray-600 dark:text-gray-400`,children:[(0,M.jsx)(ee,{className:`h-4 w-4`}),(0,M.jsxs)(`span`,{children:[`v`,ot]})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-gray-600 dark:text-gray-400`,children:[(0,M.jsx)(w,{className:`h-4 w-4`}),(0,M.jsxs)(`span`,{children:[Y.length,` `,Y.length===1?e(`modelManager.systemStatus.models`):e(`modelManager.systemStatus.models_plural`)]})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-gray-600 dark:text-gray-400`,children:[(0,M.jsx)(p,{className:`h-4 w-4`}),(0,M.jsx)(`span`,{children:$(Ot())})]}),X.length>0&&(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-green-600 dark:text-green-400`,children:[(0,M.jsx)(s,{className:`h-4 w-4`}),(0,M.jsxs)(`span`,{children:[X.length,` `,e(`modelManager.systemStatus.running`),` (`,$(kt()),` `,e(`modelManager.systemStatus.vram`),`)`]})]})]}),(0,M.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,M.jsxs)(k,{onClick:Z,variant:`outline`,size:`sm`,className:O(`gap-1.5`,``,``),children:[(0,M.jsx)(h,{className:`h-3.5 w-3.5`}),e(`common.refresh`)]})})]})}),(0,M.jsx)(be,{expanded:G.has(`pull`),modelName:m,setModelName:v,pulling:y,progress:S,canInstallModels:i,popularModels:Nt,onToggle:()=>K(`pull`),onPull:()=>bt(),onCancelPull:xt,formatSize:$}),(0,M.jsx)(ye,{expanded:G.has(`library`),models:jt,totalAvailable:Q.length,categories:Mt,filter:l,search:d,loading:ct||ut,pulling:y,canInstallModels:i,pullSectionExpanded:G.has(`pull`),setFilter:u,setSearch:f,isModelInstalled:At,normalizeCloudPullName:Ce,onToggle:()=>K(`library`),onTogglePullSection:()=>K(`pull`),onPullModel:bt,onRefresh:dt}),(0,M.jsx)(pe,{expanded:G.has(`huggingface`),models:pt,search:Ue,task:B,sort:V,loadingModels:mt,canInstallModels:i,expandedModelId:Ye,loadingGgufModelId:$e,ggufFiles:Ze,pullingModel:tt,pullProgress:nt,setSearch:We,setTask:qe,setSort:Je,onToggle:()=>K(`huggingface`),onToggleModel:_t,onPullGguf:vt,onCancelPull:yt,onRefresh:ht}),Array.isArray(X)&&X.length>0&&(0,M.jsxs)(`div`,{className:O(`rounded-2xl border p-4`,`bg-white/60 dark:bg-white/[0.03]`,`border-gray-200/80 dark:border-white/10`),children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-3 mb-4`,children:[(0,M.jsx)(s,{className:`h-4 w-4 text-gray-500 dark:text-dark-500`}),(0,M.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-dark-800`,children:e(`modelManager.sections.running`)}),(0,M.jsxs)(`span`,{className:O(`ms-auto rounded-full px-2 py-0.5 text-xs font-medium`,`border border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/[0.04]`,`text-gray-600 dark:text-dark-600`),children:[X.length,` `,e(`modelManager.systemStatus.running`)]})]}),(0,M.jsx)(`div`,{className:`space-y-2`,children:X.map(t=>(0,M.jsxs)(`div`,{className:O(`flex items-center justify-between p-4 rounded-lg border`,`bg-white/50 dark:bg-white/[0.025]`,`border-gray-200/80 dark:border-white/[0.08]`),children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,M.jsx)(`div`,{className:O(`w-2 h-2 rounded-full animate-pulse`,`bg-green-500`)}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`div`,{className:`font-medium text-gray-900 dark:text-dark-800`,children:t.name}),(0,M.jsxs)(`div`,{className:`flex items-center gap-3 text-sm text-gray-500 dark:text-dark-500`,children:[(0,M.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,M.jsx)(c,{className:`h-3 w-3`}),e(`modelManager.systemStatus.vram`),`:`,` `,$(t.size_vram||0)]}),t.size&&(0,M.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,M.jsx)(w,{className:`h-3 w-3`}),e(`models.size`),`: `,$(t.size)]})]})]})]}),(0,M.jsxs)(`div`,{className:O(`flex items-center gap-1.5 px-2 py-1 rounded-full text-xs font-medium`,`border border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/[0.04]`,`text-gray-600 dark:text-dark-600`),children:[(0,M.jsx)(re,{className:`h-3 w-3`}),e(`modelManager.local.running`)]})]},t.name))})]}),(0,M.jsx)(_e,{expanded:G.has(`local`),models:Y,onToggle:()=>K(`local`),isModelRunning:Dt,formatSize:$,onShowModel:Ct,onCopyModel:e=>{I(e),P(!0)},onDeleteModel:St}),(0,M.jsxs)(`div`,{className:O(`overflow-hidden rounded-2xl border`,`bg-white/60 dark:bg-white/[0.03]`,`border-gray-200/80 dark:border-white/10`),children:[(0,M.jsxs)(`button`,{onClick:()=>K(`advanced`),"aria-expanded":G.has(`advanced`),className:O(`w-full flex items-center justify-between p-4`,`hover:bg-gray-50 dark:hover:bg-dark-50`,`transition-colors`),children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,M.jsx)(ae,{className:`h-4 w-4 text-gray-500 dark:text-dark-500`}),(0,M.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-dark-800`,children:e(`modelManager.sections.advanced`)})]}),G.has(`advanced`)?(0,M.jsx)(b,{className:`h-5 w-5 text-gray-500`}):(0,M.jsx)(_,{className:`h-5 w-5 text-gray-500`})]}),G.has(`advanced`)&&(0,M.jsx)(`div`,{className:`p-4 pt-0`,children:(0,M.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3`,children:[(0,M.jsxs)(k,{onClick:()=>De(!0),variant:`outline`,className:O(`w-full gap-2 justify-start h-auto py-3 px-4`,``,``),children:[(0,M.jsx)(ne,{className:`h-5 w-5 text-gray-500 dark:text-dark-500`}),(0,M.jsxs)(`div`,{className:`text-start`,children:[(0,M.jsx)(`div`,{className:`font-medium`,children:e(`modelManager.advanced.createModel`)}),(0,M.jsx)(`div`,{className:`text-xs opacity-70`,children:e(`modelManager.advanced.fromModelfile`)})]})]}),(0,M.jsxs)(k,{onClick:()=>P(!0),variant:`outline`,className:O(`w-full gap-2 justify-start h-auto py-3 px-4`,``,``),children:[(0,M.jsx)(ie,{className:`h-5 w-5 text-gray-500 dark:text-dark-500`}),(0,M.jsxs)(`div`,{className:`text-start`,children:[(0,M.jsx)(`div`,{className:`font-medium`,children:e(`modelManager.advanced.copyModel`)}),(0,M.jsx)(`div`,{className:`text-xs opacity-70`,children:e(`modelManager.advanced.duplicateExisting`)})]})]}),(0,M.jsxs)(k,{onClick:()=>Pe(!0),variant:`outline`,className:O(`w-full gap-2 justify-start h-auto py-3 px-4`,``,``),children:[(0,M.jsx)(te,{className:`h-5 w-5 text-gray-500 dark:text-dark-500`}),(0,M.jsxs)(`div`,{className:`text-start`,children:[(0,M.jsx)(`div`,{className:`font-medium`,children:e(`modelManager.advanced.testEmbeddings`)}),(0,M.jsx)(`div`,{className:`text-xs opacity-70`,children:e(`modelManager.advanced.generateVectors`)})]})]}),(0,M.jsxs)(k,{onClick:async()=>{try{(await D.checkHealth()).success&&(await J(),g.success(e(`modelManager.advanced.healthy`)))}catch{await J(),g.error(e(`modelManager.systemStatus.offline`))}},variant:`outline`,className:O(`w-full gap-2 justify-start h-auto py-3 px-4`,``,``),children:[(0,M.jsx)(o,{className:`h-5 w-5 text-gray-500 dark:text-dark-500`}),(0,M.jsxs)(`div`,{className:`text-start`,children:[(0,M.jsx)(`div`,{className:`font-medium`,children:e(`modelManager.advanced.healthCheck`)}),(0,M.jsx)(`div`,{className:`text-xs opacity-70`,children:e(`modelManager.advanced.testConnection`)})]})]})]})})]}),Pt&&(0,M.jsx)(j.Suspense,{fallback:null,children:(0,M.jsx)(Se,{models:Y,showDetailsModal:me,setShowDetailsModal:he,selectedModelName:le,selectedModelDetails:oe,loadingDetails:ge,showCopyModal:ve,setShowCopyModal:P,copySource:F,setCopySource:I,copyDestination:L,setCopyDestination:R,copying:we,handleCopyModel:wt,showCreateModal:Ee,setShowCreateModal:De,createModelName:z,setCreateModelName:Oe,createModelfile:ke,setCreateModelfile:Ae,creating:je,handleCreateModel:Tt,showEmbeddingsModal:Ne,setShowEmbeddingsModal:Pe,embeddingsModel:Fe,setEmbeddingsModel:Ie,embeddingsInput:Le,setEmbeddingsInput:Re,embeddingsResult:ze,generatingEmbeddings:Ve,handleGenerateEmbeddings:Et})})]})},R=()=>{let{t:e}=A();return(0,M.jsxs)(le,{children:[(0,M.jsx)(ue,{title:e(`models.title`),description:e(`models.subtitle`)}),(0,M.jsx)(L,{})]})};export{R as ModelsPage,R as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/ModelManagerModals-C7wlZoV2.js","js/rolldown-runtime-QTnfLwEv.js","js/markdown-core-fkbHPd-g.js","js/react-vendor-Co1u1rWb.js","js/ui-vendor-njo77ljx.js","js/utils-D0l9J3P-.js","js/utils-vendor-BX3ZwoIK.js","js/Button-BZBnLKRn.js","assets/index-DgL4shIj.js","js/logger-BmpKNkls.js","js/demoMode-BhEpMVh5.js","js/api-BsUaU_IW.js","assets/index-BJsjOpGD.css"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{d as t,f as n}from"./markdown-core-fkbHPd-g.js";import{t as r}from"./useQuery-BFOeNWc6.js";import{r as i,t as a}from"./logger-BmpKNkls.js";import{$ as o,Dt as s,F as c,G as l,H as u,It as d,K as f,Pt as p,S as m,T as h,Vt as g,_t as _,b as ee,f as te,ft as v,lt as y,mt as b,n as x,ot as S,pt as C,q as w,rt as ne,st as T,t as re,u as E,ut as ie,v as ae,vt as oe,z as se}from"./ui-vendor-njo77ljx.js";import{d as D,m as ce}from"./api-BsUaU_IW.js";import{t as O}from"./utils-D0l9J3P-.js";import{t as k}from"./Button-BZBnLKRn.js";import{F as A,J as le,a as ue,i as de,x as fe}from"../assets/index-DgL4shIj.js";var j=e(n(),1),M=t();function pe({expanded:e,models:t,search:n,task:r,sort:i,loadingModels:a,canInstallModels:o,expandedModelId:s,loadingGgufModelId:c,ggufFiles:l,pullingModel:u,pullProgress:d,setSearch:f,setTask:p,setSort:g,onToggle:ee,onToggleModel:te,onPullGguf:v,onCancelPull:y,onRefresh:x}){let{t:C}=A();return(0,M.jsxs)(`div`,{className:O(`overflow-hidden rounded-2xl border`,`bg-white/60 dark:bg-white/[0.03]`,`border-gray-200/80 dark:border-white/10`),children:[(0,M.jsxs)(`button`,{onClick:ee,"aria-expanded":e,className:O(`w-full flex items-center justify-between p-4`,`hover:bg-gray-50 dark:hover:bg-dark-50`,`transition-colors`),children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,M.jsx)(re,{className:`h-4 w-4 text-gray-500 dark:text-dark-500`}),(0,M.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-dark-800`,children:C(`modelManager.sections.huggingface`,`HuggingFace Hub`)}),t.length>0&&(0,M.jsxs)(`span`,{className:O(`px-2 py-0.5 rounded-full text-xs font-medium`,`bg-gray-100 dark:bg-dark-200`,`text-gray-600 dark:text-gray-400`),children:[t.length,` `,C(`modelManager.library.available`,`available`)]})]}),e?(0,M.jsx)(b,{className:`h-5 w-5 text-gray-500`}):(0,M.jsx)(_,{className:`h-5 w-5 text-gray-500`})]}),e&&(0,M.jsxs)(`div`,{className:`p-4 pt-0 space-y-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-3`,children:[(0,M.jsxs)(`div`,{className:`relative flex-1`,children:[(0,M.jsx)(m,{className:`absolute start-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400 dark:text-gray-500`}),(0,M.jsx)(`input`,{type:`text`,value:n,onChange:e=>f(e.target.value),placeholder:C(`modelManager.huggingface.search`,`Search HuggingFace models...`),className:O(`w-full rounded-xl border py-2 pe-4 ps-10 text-sm`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-dark-700`,`placeholder-gray-500 dark:placeholder-gray-400`,`focus:outline-none focus:ring-2 focus:ring-primary-500/20`,`focus:border-primary-500`)})]}),(0,M.jsxs)(`select`,{value:r,onChange:e=>p(e.target.value),className:O(`px-3 py-2 rounded-lg border text-sm min-w-[160px]`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-dark-700`,`focus:outline-none focus:ring-2 focus:ring-primary-500/20`),children:[(0,M.jsx)(`option`,{value:`text-generation`,children:C(`modelManager.huggingface.tasks.textGen`,`Text Generation`)}),(0,M.jsx)(`option`,{value:`text-to-speech`,children:C(`modelManager.huggingface.tasks.tts`,`Text to Speech`)}),(0,M.jsx)(`option`,{value:`text-to-image`,children:C(`modelManager.huggingface.tasks.image`,`Text to Image`)}),(0,M.jsx)(`option`,{value:`automatic-speech-recognition`,children:C(`modelManager.huggingface.tasks.stt`,`Speech Recognition`)})]}),(0,M.jsxs)(`select`,{value:i,onChange:e=>g(e.target.value),className:O(`px-3 py-2 rounded-lg border text-sm min-w-[140px]`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-dark-700`,`focus:outline-none focus:ring-2 focus:ring-primary-500/20`),children:[(0,M.jsx)(`option`,{value:`downloads`,children:C(`modelManager.huggingface.sort.downloads`,`Most Downloads`)}),(0,M.jsx)(`option`,{value:`likes`,children:C(`modelManager.huggingface.sort.likes`,`Most Liked`)}),(0,M.jsx)(`option`,{value:`lastModified`,children:C(`modelManager.huggingface.sort.recent`,`Recently Updated`)})]})]}),!o&&(0,M.jsx)(`p`,{className:`text-xs text-amber-700 dark:text-amber-300`,children:C(`modelManager.pull.restricted`)}),a?(0,M.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,M.jsx)(se,{className:`h-5 w-5 animate-spin text-gray-400`})}):t.length===0?(0,M.jsx)(`div`,{className:`text-center py-8 text-gray-500`,children:C(`modelManager.huggingface.noResults`,`No models found. Try adjusting your search or filters.`)}):(0,M.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:t.map(e=>(0,M.jsx)(me,{model:e,expanded:s===e.id,loadingGguf:c===e.id,ggufFiles:l[e.id]||[],pullingModel:u,pullProgress:d,canInstallModels:o,onToggle:()=>te(e.id),onPullGguf:v,onCancelPull:y},e.id))}),(0,M.jsxs)(`div`,{className:`flex items-center justify-between pt-2`,children:[(0,M.jsxs)(`a`,{href:`https://huggingface.co/models`,target:`_blank`,rel:`noopener noreferrer`,className:O(`inline-flex items-center gap-1.5 text-xs`,`text-primary-600 dark:text-primary-400`,`hover:underline`),children:[(0,M.jsx)(S,{className:`h-3 w-3`}),C(`modelManager.huggingface.browseAll`,`Browse all on HuggingFace`)]}),(0,M.jsxs)(k,{onClick:x,variant:`outline`,size:`sm`,disabled:a,className:O(`gap-1.5`,``,``),children:[(0,M.jsx)(h,{className:O(`h-3.5 w-3.5`,a&&`animate-spin`)}),C(`modelManager.library.refresh`,`Refresh`)]})]})]})]})}function me({model:e,expanded:t,loadingGguf:n,ggufFiles:r,pullingModel:i,pullProgress:a,canInstallModels:o,onToggle:s,onPullGguf:c,onCancelPull:u}){let{t:d}=A();return(0,M.jsxs)(`div`,{className:O(`rounded-lg border transition-all overflow-hidden`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`hover:shadow-md hover:border-gray-300 dark:hover:border-dark-400`),children:[(0,M.jsxs)(`div`,{className:`p-4 cursor-pointer`,onClick:s,children:[(0,M.jsxs)(`div`,{className:`flex items-start justify-between gap-2 mb-2`,children:[(0,M.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`h4`,{className:`font-medium text-gray-900 dark:text-dark-800 truncate`,children:e.id}),e.gated&&(0,M.jsx)(`span`,{className:O(`px-1.5 py-0.5 rounded text-xs`,`bg-yellow-100 dark:bg-yellow-900/30`,`text-yellow-700 dark:text-yellow-400`),children:d(`modelManager.huggingface.gated`,`Gated`)})]}),(0,M.jsxs)(`p`,{className:`text-xs text-gray-500 dark:text-dark-600 mt-0.5`,children:[d(`modelManager.huggingface.by`,`by`),` `,e.author]})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,M.jsx)(`a`,{href:`https://huggingface.co/${e.id}`,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),className:`p-1.5 rounded-lg hover:bg-gray-200 dark:hover:bg-dark-300 transition-colors`,title:d(`modelManager.huggingface.viewOnHF`,`View on HuggingFace`),children:(0,M.jsx)(S,{className:`h-4 w-4 text-gray-400 dark:text-gray-500`})}),(0,M.jsx)(_,{className:O(`h-4 w-4 text-gray-400 transition-transform`,t&&`rotate-180`)})]})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-gray-500 dark:text-dark-600`,children:[(0,M.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,M.jsx)(T,{className:`h-3.5 w-3.5`}),N(e.downloads)]}),(0,M.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,M.jsx)(l,{className:`h-3.5 w-3.5`}),N(e.likes)]}),e.pipeline_tag&&(0,M.jsx)(`span`,{className:O(`px-1.5 py-0.5 rounded`,`bg-gray-200 dark:bg-dark-300`),children:e.pipeline_tag})]})]}),t&&(0,M.jsx)(he,{modelId:e.id,loading:n,files:r,pullingModel:i,pullProgress:a,canInstallModels:o,onPullGguf:c,onCancelPull:u})]})}function he({modelId:e,loading:t,files:n,pullingModel:r,pullProgress:i,canInstallModels:a,onPullGguf:o,onCancelPull:s}){let{t:c}=A();return(0,M.jsx)(`div`,{className:`px-4 pb-4 pt-1 border-t border-gray-200 dark:border-dark-300 bg-white dark:bg-dark-100`,children:t?(0,M.jsxs)(`div`,{className:`flex items-center justify-center py-4`,children:[(0,M.jsx)(se,{className:`h-4 w-4 animate-spin text-gray-400`}),(0,M.jsx)(`span`,{className:`ml-2 text-xs text-gray-500`,children:c(`modelManager.huggingface.checkingGguf`)})]}):n.length===0?(0,M.jsx)(`div`,{className:`py-4 text-center text-xs text-gray-500 dark:text-gray-400`,children:c(`modelManager.huggingface.noGgufAvailable`)}):(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(`div`,{className:`text-xs font-medium text-gray-600 dark:text-gray-300 mb-2`,children:c(`modelManager.huggingface.ggufFilesCount`,{count:n.length})}),n.map(e=>(0,M.jsx)(ge,{file:e,pulling:r===e.ollamaCommand,pullProgress:i,canInstallModels:a,disabled:!!r||!a,onPullGguf:o,onCancelPull:s},e.filename)),r?.startsWith(`hf.co/`)&&r.includes(e)&&i?.percent!==void 0&&(0,M.jsx)(`div`,{className:`w-full bg-gray-200 dark:bg-dark-300 rounded-full h-1.5 overflow-hidden mt-2`,children:(0,M.jsx)(`div`,{className:`h-1.5 rounded-full bg-primary-500 transition-all duration-300`,style:{width:`${i.percent}%`}})})]})})}function ge({file:e,pulling:t,disabled:n,pullProgress:r,onPullGguf:i,onCancelPull:a}){let{t:o}=A();return(0,M.jsxs)(`div`,{className:`flex items-center gap-2 p-2 rounded-lg bg-gray-50 dark:bg-dark-50 border border-gray-200 dark:border-dark-300`,children:[(0,M.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,M.jsx)(`div`,{className:`text-xs font-medium text-gray-800 dark:text-gray-200 truncate`,children:e.filename}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2 mt-0.5 text-xs text-gray-500 dark:text-gray-400`,children:[(0,M.jsx)(`span`,{children:e.sizeFormatted}),e.quantization&&(0,M.jsx)(`span`,{className:`px-1.5 py-0.5 rounded bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-400`,children:e.quantization})]})]}),t?(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`div`,{className:`text-xs text-gray-500 w-12 text-right`,children:r?.percent===void 0?`...`:`${r.percent}%`}),(0,M.jsx)(`button`,{onClick:e=>{e.stopPropagation(),a()},className:`p-1.5 rounded-lg text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20`,children:(0,M.jsx)(x,{className:`h-4 w-4`})})]}):(0,M.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),i(e.ollamaCommand,e.filename)},disabled:n,className:O(`px-3 py-1.5 rounded-lg text-xs font-medium`,`bg-primary-100 dark:bg-primary-900/30`,`text-primary-700 dark:text-primary-400`,`hover:bg-primary-200 dark:hover:bg-primary-900/50`,`disabled:opacity-50 disabled:cursor-not-allowed`),children:[(0,M.jsx)(T,{className:`h-3 w-3 inline mr-1`}),o(`models.pull`)]})]})}function N(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e}function _e({expanded:e,models:t,onToggle:n,isModelRunning:r,formatSize:i,onShowModel:a,onCopyModel:o,onDeleteModel:s}){let{t:c}=A();return(0,M.jsxs)(`div`,{className:O(`overflow-hidden rounded-2xl border`,`bg-white/60 dark:bg-white/[0.03]`,`border-gray-200/80 dark:border-white/10`),children:[(0,M.jsxs)(`button`,{onClick:n,"aria-expanded":e,className:O(`w-full flex items-center justify-between p-4`,`hover:bg-gray-50 dark:hover:bg-dark-50`,`transition-colors`),children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,M.jsx)(w,{className:`h-4 w-4 text-gray-500 dark:text-dark-500`}),(0,M.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-dark-800`,children:c(`modelManager.sections.local`)}),(0,M.jsxs)(`span`,{className:O(`px-2 py-0.5 rounded-full text-xs font-medium`,`bg-gray-100 dark:bg-dark-200`,`text-gray-600 dark:text-gray-400`),children:[t.length,` `,c(`modelManager.local.installed`)]})]}),e?(0,M.jsx)(b,{className:`h-5 w-5 text-gray-500`}):(0,M.jsx)(_,{className:`h-5 w-5 text-gray-500`})]}),e&&(0,M.jsx)(`div`,{className:`p-4 pt-0`,children:t.length===0?(0,M.jsxs)(`div`,{className:O(`text-center py-12 rounded-lg border-2 border-dashed`,`border-gray-200 dark:border-dark-300`),children:[(0,M.jsx)(w,{className:`h-12 w-12 mx-auto mb-3 text-gray-300 dark:text-gray-600`}),(0,M.jsx)(`p`,{className:`text-gray-600 dark:text-dark-600 mb-2`,children:c(`modelManager.local.noModels`)}),(0,M.jsx)(`p`,{className:`text-sm text-gray-500 dark:text-gray-500`,children:c(`modelManager.local.pullToStart`)})]}):(0,M.jsx)(`div`,{className:`space-y-3`,children:t.map(e=>(0,M.jsx)(ve,{model:e,running:r(e.name),formatSize:i,onShowModel:a,onCopyModel:o,onDeleteModel:s},e.name))})})]})}function ve({model:e,running:t,formatSize:n,onShowModel:r,onCopyModel:i,onDeleteModel:a}){let{t:o}=A();return(0,M.jsx)(`div`,{className:O(`p-4 rounded-lg border transition-colors`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`hover:bg-gray-100 dark:hover:bg-dark-200`),children:(0,M.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,M.jsx)(`h4`,{className:`font-medium text-gray-900 dark:text-dark-800`,children:e.name}),t&&(0,M.jsxs)(`span`,{className:O(`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium`,`bg-green-100 dark:bg-green-900/30`,`text-green-700 dark:text-green-400`),children:[(0,M.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-green-500 animate-pulse`}),o(`modelManager.local.running`)]})]}),(0,M.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-sm text-gray-600 dark:text-dark-600 mt-2`,children:[(0,M.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,M.jsx)(w,{className:`h-3.5 w-3.5`}),n(e.size)]}),e.details?.parameter_size&&(0,M.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,M.jsx)(y,{className:`h-3.5 w-3.5`}),e.details.parameter_size]}),e.details?.quantization_level&&(0,M.jsx)(`span`,{className:O(`px-1.5 py-0.5 rounded text-xs`,`bg-gray-200 dark:bg-dark-300`,`text-gray-600 dark:text-gray-400`),children:e.details.quantization_level}),e.details?.family&&(0,M.jsx)(`span`,{className:`text-gray-500 dark:text-gray-500`,children:e.details.family})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-gray-400 dark:text-dark-500 mt-2`,children:[(0,M.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,M.jsx)(C,{className:`h-3 w-3`}),new Date(e.modified_at).toLocaleDateString()]}),(0,M.jsxs)(`span`,{className:`flex items-center gap-1 font-mono truncate max-w-[200px]`,title:e.digest,children:[(0,M.jsx)(f,{className:`h-3 w-3`}),e.digest.slice(0,12),`...`]})]})]}),(0,M.jsxs)(`div`,{className:`flex gap-2 flex-shrink-0`,children:[(0,M.jsxs)(k,{onClick:()=>r(e.name),variant:`outline`,size:`sm`,className:O(`gap-1.5`,``,``),children:[(0,M.jsx)(u,{className:`h-3.5 w-3.5`}),o(`modelManager.local.info`)]}),(0,M.jsxs)(k,{onClick:()=>i(e.name),variant:`outline`,size:`sm`,className:O(`gap-1.5`,``,``),children:[(0,M.jsx)(ie,{className:`h-3.5 w-3.5`}),o(`modelManager.local.copy`)]}),(0,M.jsxs)(k,{onClick:()=>a(e.name),variant:`outline`,size:`sm`,className:O(`gap-1.5`,`text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300`,``,``),children:[(0,M.jsx)(E,{className:`h-3.5 w-3.5`}),o(`modelManager.local.delete`)]})]})]})})}function ye({expanded:e,models:t,totalAvailable:n,categories:r,filter:i,search:a,loading:o,pulling:s,canInstallModels:c,pullSectionExpanded:l,setFilter:u,setSearch:f,isModelInstalled:p,normalizeCloudPullName:g,onToggle:ee,onTogglePullSection:te,onPullModel:y,onRefresh:x}){let{t:S}=A();return(0,M.jsxs)(`div`,{className:O(`overflow-hidden rounded-2xl border`,`bg-white/60 dark:bg-white/[0.03]`,`border-gray-200/80 dark:border-white/10`),children:[(0,M.jsxs)(`button`,{onClick:ee,"aria-expanded":e,className:O(`w-full flex items-center justify-between p-4`,`hover:bg-gray-50 dark:hover:bg-dark-50`,`transition-colors`),children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,M.jsx)(v,{className:`h-4 w-4 text-gray-500 dark:text-dark-500`}),(0,M.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-dark-800`,children:S(`modelManager.sections.library`)}),(0,M.jsxs)(`span`,{className:O(`px-2 py-0.5 rounded-full text-xs font-medium`,`bg-gray-100 dark:bg-dark-200`,`text-gray-600 dark:text-gray-400`),children:[n,` `,S(`modelManager.library.available`)]})]}),e?(0,M.jsx)(b,{className:`h-5 w-5 text-gray-500`}):(0,M.jsx)(_,{className:`h-5 w-5 text-gray-500`})]}),e&&(0,M.jsxs)(`div`,{className:`p-4 pt-0 space-y-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-3`,children:[(0,M.jsxs)(`div`,{className:`relative flex-1`,children:[(0,M.jsx)(m,{className:`absolute start-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400 dark:text-gray-500`}),(0,M.jsx)(`input`,{type:`text`,value:a,onChange:e=>f(e.target.value),placeholder:S(`modelManager.library.search`),className:O(`w-full rounded-xl border py-2 pe-4 ps-10 text-sm`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-dark-700`,`placeholder-gray-500 dark:placeholder-gray-400`,`focus:outline-none focus:ring-2 focus:ring-primary-500/20`,`focus:border-primary-500`)})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(d,{className:`h-4 w-4 text-gray-400`}),(0,M.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:r.map(e=>(0,M.jsx)(`button`,{onClick:()=>u(e),className:O(`px-2.5 py-1 rounded-full text-xs font-medium transition-colors`,i===e?`bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400`:`bg-gray-100 dark:bg-dark-200 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-dark-300`),children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]})]}),o?(0,M.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,M.jsx)(h,{className:`h-5 w-5 animate-spin text-gray-400`})}):t.length===0?(0,M.jsx)(`div`,{className:`text-center py-8 text-gray-500`,children:S(`modelManager.library.noResults`)}):(0,M.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:t.map(e=>{let t=e.category===`cloud`?g(e.name):e.name;return(0,M.jsx)(P,{model:e,installed:p(e.name)||p(t),pulling:s,canInstallModels:c,pullSectionExpanded:l,onTogglePullSection:te,onPullModel:y},e.name)})}),(0,M.jsx)(`div`,{className:`flex justify-center`,children:(0,M.jsxs)(k,{onClick:x,variant:`outline`,size:`sm`,disabled:o,className:O(`gap-1.5`,``,``),children:[(0,M.jsx)(h,{className:O(`h-3.5 w-3.5`,o&&`animate-spin`)}),S(`modelManager.library.refresh`)]})})]})]})}function P({model:e,installed:t,pulling:n,canInstallModels:r,pullSectionExpanded:i,onTogglePullSection:a,onPullModel:o}){let{t:s}=A();return(0,M.jsxs)(`div`,{"data-testid":`library-model-card-${e.name}`,className:O(`p-4 rounded-lg border transition-all`,`bg-gray-50 dark:bg-dark-50`,t?`border-green-200 dark:border-green-800/50`:`border-gray-200 dark:border-dark-300`,`hover:shadow-md hover:border-gray-300 dark:hover:border-dark-400`),children:[(0,M.jsxs)(`div`,{className:`flex items-start justify-between gap-2 mb-2`,children:[(0,M.jsx)(`h4`,{className:`font-medium text-gray-900 dark:text-dark-800`,children:e.name}),t&&(0,M.jsxs)(`span`,{className:O(`flex items-center gap-1 px-1.5 py-0.5 rounded text-xs`,`bg-green-100 dark:bg-green-900/30`,`text-green-700 dark:text-green-400`),children:[(0,M.jsx)(oe,{className:`h-3 w-3`}),s(`modelManager.library.installed`)]})]}),(0,M.jsx)(`p`,{className:`text-xs text-gray-600 dark:text-dark-600 mb-3 line-clamp-2`,children:e.description}),(0,M.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 mb-3`,children:[e.sizes.slice(0,4).map(e=>(0,M.jsx)(`span`,{className:O(`px-1.5 py-0.5 rounded text-xs`,`bg-gray-200 dark:bg-dark-300`,`text-gray-600 dark:text-gray-400`),children:e},e)),e.sizes.length>4&&(0,M.jsx)(`span`,{className:`text-xs text-gray-400`,children:s(`modelManager.library.more`,{count:e.sizes.length-4})})]}),(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-gray-500`,children:[e.pulls&&(0,M.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,M.jsx)(T,{className:`h-3 w-3`}),e.pulls]}),(0,M.jsx)(`span`,{className:O(`px-1.5 py-0.5 rounded capitalize`,e.category===`cloud`?`bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400`:`bg-gray-100 dark:bg-dark-200`),children:e.category})]}),(0,M.jsxs)(k,{"data-testid":`library-model-pull-${e.name}`,onClick:()=>{i||a(),o(e.name,e.category)},variant:`outline`,size:`sm`,disabled:n||!r,className:O(`gap-1 text-xs`,``,``),children:[(0,M.jsx)(T,{className:`h-3 w-3`}),s(`modelManager.pull.button`)]})]})]})}function be({expanded:e,modelName:t,setModelName:n,pulling:r,progress:i,canInstallModels:a,popularModels:o,onToggle:s,onPull:c,onCancelPull:l,formatSize:u}){let{t:d}=A();return(0,M.jsxs)(`div`,{className:O(`overflow-hidden rounded-2xl border`,`bg-white/60 dark:bg-white/[0.03]`,`border-gray-200/80 dark:border-white/10`),children:[(0,M.jsxs)(`button`,{onClick:s,"aria-expanded":e,className:O(`w-full flex items-center justify-between p-4`,`hover:bg-gray-50 dark:hover:bg-dark-50`,`transition-colors`),children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,M.jsx)(T,{className:`h-4 w-4 text-primary-600 dark:text-primary-400`}),(0,M.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-dark-800`,children:d(`modelManager.sections.pull`)})]}),e?(0,M.jsx)(b,{className:`h-5 w-5 text-gray-500`}):(0,M.jsx)(_,{className:`h-5 w-5 text-gray-500`})]}),e&&(0,M.jsxs)(`div`,{className:`p-4 pt-0 space-y-4`,children:[(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[(0,M.jsxs)(`div`,{className:`relative flex-1`,children:[(0,M.jsx)(m,{className:`absolute start-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400 dark:text-gray-500`}),(0,M.jsx)(`input`,{type:`text`,value:t,onChange:e=>n(e.target.value),placeholder:d(`modelManager.pull.placeholder`),className:O(`w-full rounded-xl border py-2.5 pe-4 ps-10 text-sm`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-dark-700`,`placeholder-gray-500 dark:placeholder-gray-400`,`focus:outline-none focus:ring-2 focus:ring-primary-500/20`,`focus:border-primary-500`),disabled:r||!a,onKeyDown:e=>{e.key===`Enter`&&!r&&a&&c()}})]}),r?(0,M.jsxs)(k,{onClick:l,variant:`outline`,className:O(`px-4 py-2.5 gap-2`,`text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300`,``,``),children:[(0,M.jsx)(x,{className:`h-4 w-4`}),d(`modelManager.pull.cancel`)]}):(0,M.jsxs)(k,{onClick:c,disabled:!t.trim()||!a,className:O(`px-4 py-2.5 gap-2`,``),children:[(0,M.jsx)(T,{className:`h-4 w-4`}),d(`modelManager.pull.button`)]})]}),r&&i&&(0,M.jsx)(F,{progress:i,formatSize:u}),!a&&(0,M.jsx)(`p`,{className:`text-xs text-amber-700 dark:text-amber-300`,children:d(`modelManager.pull.restricted`)}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`text-xs font-medium text-gray-500 dark:text-gray-400 mb-2`,children:d(`modelManager.pull.popular`)}),(0,M.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:o.map(e=>(0,M.jsxs)(`button`,{onClick:()=>n(e.name),disabled:r||!a,className:O(`px-3 py-1.5 rounded-full text-xs font-medium transition-colors`,`bg-gray-100 dark:bg-dark-200`,`text-gray-700 dark:text-gray-300`,`hover:bg-gray-200 dark:hover:bg-dark-300`,`border border-gray-200 dark:border-dark-300`,`disabled:opacity-50 disabled:cursor-not-allowed`),children:[e.name,(0,M.jsx)(`span`,{className:`ml-1 text-gray-400 dark:text-gray-500`,children:e.size})]},e.name))})]}),(0,M.jsxs)(`a`,{href:`https://ollama.com/library`,target:`_blank`,rel:`noopener noreferrer`,className:O(`inline-flex items-center gap-1.5 text-xs`,`text-primary-600 dark:text-primary-400`,`hover:underline`),children:[(0,M.jsx)(S,{className:`h-3 w-3`}),d(`modelManager.pull.browseAll`)]})]})]})}function F({progress:e,formatSize:t}){let{t:n}=A(),r=e.status===`starting`?n(`modelManager.progress.starting`):e.status.startsWith(`pulling`)?`${n(`modelManager.progress.pullingLayer`)} ${e.status.replace(`pulling `,``)}`:e.status.startsWith(`verifying sha256`)?n(`modelManager.progress.verifyingDigest`):e.status===`writing manifest`?n(`modelManager.progress.writing`):e.status===`removing any unused layers`?n(`modelManager.progress.cleaning`):e.status;return(0,M.jsxs)(`div`,{className:O(`p-4 rounded-lg border`,`bg-gray-50 dark:bg-dark-200`,`border-gray-200 dark:border-dark-300`),children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,M.jsx)(`span`,{className:`text-sm font-medium text-gray-800 dark:text-dark-700`,children:r}),e.percent!==void 0&&(0,M.jsxs)(`span`,{className:`text-sm font-mono text-gray-600 dark:text-dark-600`,children:[e.percent,`%`]})]}),e.percent!==void 0&&(0,M.jsx)(`div`,{className:`w-full bg-gray-200 dark:bg-dark-400 rounded-full h-2 overflow-hidden`,children:(0,M.jsx)(`div`,{className:O(`h-2 rounded-full transition-all duration-300`,`bg-primary-500 dark:bg-primary-400`),style:{width:`${e.percent}%`}})}),e.total&&e.completed&&(0,M.jsxs)(`div`,{className:`mt-2 text-xs text-gray-600 dark:text-dark-600`,children:[t(e.completed),` / `,t(e.total)]})]})}var xe=a(`components:model-manager`),Se=j.lazy(()=>i(()=>import(`./ModelManagerModals-C7wlZoV2.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]))),I=e=>{let t=e.split(`:`).pop()?.toLowerCase();return t===`cloud`||t?.endsWith(`-cloud`)===!0},Ce=e=>{let t=e.trim();if(!t||I(t))return t;let n=t.lastIndexOf(`:`);return n===-1?`${t}:cloud`:`${t.slice(0,n)}:${t.slice(n+1)}-cloud`},L=()=>{let{t:e}=A(),{user:t,systemInfo:n}=fe(),i=t?.role===`admin`||(n?.allowUserModelPull??!0),a=le(),[l,u]=(0,j.useState)(`all`),[d,f]=(0,j.useState)(``),[m,v]=(0,j.useState)(``),[y,x]=(0,j.useState)(!1),[S,C]=(0,j.useState)(null),[T,E]=(0,j.useState)(null),[oe,se]=(0,j.useState)(null),[ue,de]=(0,j.useState)(``),[me,he]=(0,j.useState)(!1),[ge,N]=(0,j.useState)(!1),[ve,P]=(0,j.useState)(!1),[F,I]=(0,j.useState)(``),[L,R]=(0,j.useState)(``),[we,Te]=(0,j.useState)(!1),[Ee,De]=(0,j.useState)(!1),[z,Oe]=(0,j.useState)(``),[ke,Ae]=(0,j.useState)(``),[je,Me]=(0,j.useState)(!1),[Ne,Pe]=(0,j.useState)(!1),[Fe,Ie]=(0,j.useState)(``),[Le,Re]=(0,j.useState)(``),[ze,Be]=(0,j.useState)(null),[Ve,He]=(0,j.useState)(!1),[Ue,We]=(0,j.useState)(``),[Ge,Ke]=(0,j.useState)(``),[B,qe]=(0,j.useState)(`text-generation`),[V,Je]=(0,j.useState)(`downloads`),[Ye,Xe]=(0,j.useState)(null),[Ze,Qe]=(0,j.useState)({}),[$e,et]=(0,j.useState)(null),[tt,H]=(0,j.useState)(null),[nt,U]=(0,j.useState)(null),[rt,W]=(0,j.useState)(null),[G,it]=(0,j.useState)(new Set([`pull`,`local`])),K=e=>{it(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},{data:q,isLoading:at,refetch:J}=r({queryKey:[`ollama-state`],queryFn:async()=>{let[e,t,n,r]=await Promise.all([D.getModels(),D.listRunningModels(),D.getVersion(),D.checkHealth()]);return{models:e.success&&e.data||[],runningModels:t.success&&Array.isArray(t.data)?t.data:[],ollamaVersion:n.success&&n.data?n.data.version:null,isHealthy:r.success}}}),Y=q?.models??[],X=q?.runningModels??[],ot=q?.ollamaVersion??null,st=q?.isHealthy??null,Z=(0,j.useCallback)(async()=>{await J()},[J]),{data:Q=[],isLoading:ct}=r({queryKey:[`ollama-library`],queryFn:async()=>{let e=await D.getLibraryModels();return e.success&&e.data?e.data:[]}}),{data:lt=[],isLoading:ut}=r({queryKey:[`ollama-library`,`cloud`],queryFn:async()=>{let e=await D.getLibraryModels({category:`cloud`});return e.success&&e.data?e.data:[]},enabled:l===`cloud`}),dt=()=>a.invalidateQueries({queryKey:[`ollama-library`]});(0,j.useEffect)(()=>{let e=setTimeout(()=>{Ke(Ue)},300);return()=>clearTimeout(e)},[Ue]);let ft=G.has(`huggingface`),{data:pt=[],isLoading:mt}=r({queryKey:[`hf-models`,B,Ge,V],queryFn:async()=>{let e=await ce.getModels({task:B,search:Ge||void 0,sort:V,limit:30});return e.success&&e.data?e.data:[]},enabled:ft}),ht=()=>a.invalidateQueries({queryKey:[`hf-models`,B,Ge,V]}),gt=(0,j.useCallback)(async e=>{let[t,n]=e.split(`/`);if(!(!t||!n)){et(e);try{let r=await ce.getGgufFiles(t,n);r.success&&r.data&&Qe(t=>({...t,[e]:r.data}))}catch(e){xe.error(`Failed to load GGUF files:`,e)}finally{et(null)}}},[]),_t=(0,j.useCallback)(e=>{Ye===e?Xe(null):(Xe(e),Ze[e]||gt(e))},[Ye,Ze,gt]),vt=(0,j.useCallback)((t,n)=>{if(!i){g.error(e(`modelManager.pull.restricted`));return}if(!tt){H(t),U({status:`starting`});try{let e=D.pullModelStream(t,e=>{U(e)},()=>{U(null),H(null),W(null),g.success(`Downloaded ${n}`),Z()},e=>{U(null),H(null),W(null),g.error(`Failed to download: ${e}`)});W(()=>e)}catch{U(null),H(null),g.error(`Failed to start download`)}}},[i,tt,Z,e]),yt=(0,j.useCallback)(()=>{rt&&(rt(),W(null),H(null),U(null))},[rt]),bt=async(t,n)=>{if(!i){g.error(e(`modelManager.pull.restricted`));return}let r=t||m.trim(),a=n===`cloud`||!t&&l===`cloud`?Ce(r):r;if(!a){g.error(e(`modelManager.pull.enterName`));return}t&&v(a),x(!0),C({status:`starting`});try{let t=D.pullModelStream(a,e=>{C(e)},()=>{C(null),x(!1),E(null),g.success(e(`modelManager.pull.success`,{name:a})),v(``),Z()},t=>{C(null),x(!1),E(null),g.error(e(`modelManager.pull.failed`)+`: `+t)});E(()=>t)}catch(t){let n=t instanceof Error?t.message:String(t);g.error(e(`modelManager.pull.failed`)+`: `+n),C(null),x(!1),E(null)}},xt=()=>{T&&(T(),E(null),x(!1),C(null),g.success(e(`modelManager.pull.cancelled`)))},St=async t=>{if(confirm(e(`modelManager.local.deleteConfirm`,{name:t})))try{await D.deleteModel(t),g.success(e(`modelManager.local.deleteSuccess`,{name:t})),await Z()}catch(t){let n=t instanceof Error?t.message:String(t);g.error(e(`modelManager.local.deleteFailed`)+`: `+n)}},Ct=async t=>{N(!0),de(t),he(!0);try{let n=await D.showModel(t,!0);n.success&&n.data?se(n.data):g.error(e(`modelManager.modals.details.noDetails`))}catch(t){let n=t instanceof Error?t.message:String(t);g.error(e(`modelManager.modals.details.noDetails`)+`: `+n)}finally{N(!1)}},wt=async()=>{if(!F.trim()||!L.trim()){g.error(e(`modelManager.modals.copy.enterBoth`));return}Te(!0);try{await D.copyModel(F.trim(),L.trim()),g.success(e(`modelManager.modals.copy.success`,{name:L})),P(!1),I(``),R(``),await Z()}catch(t){let n=t instanceof Error?t.message:String(t);g.error(e(`modelManager.modals.copy.failed`)+`: `+n)}finally{Te(!1)}},Tt=async()=>{if(!z.trim()||!ke.trim()){g.error(e(`modelManager.modals.create.enterBoth`));return}Me(!0);try{await D.createModel({model:z.trim(),modelfile:ke.trim()}),g.success(e(`modelManager.modals.create.success`,{name:z})),De(!1),Oe(``),Ae(``),await Z()}catch(t){let n=t instanceof Error?t.message:String(t);g.error(e(`modelManager.modals.create.failed`)+`: `+n)}finally{Me(!1)}},Et=async()=>{if(!Fe.trim()||!Le.trim()){g.error(e(`modelManager.modals.embeddings.enterBoth`));return}He(!0),Be(null);try{let t=await D.generateEmbeddings({model:Fe.trim(),input:Le.trim()});if(t.success&&t.data){let n=t.data.embeddings?.[0]||[];Be(n),g.success(e(`modelManager.modals.embeddings.success`,{count:n.length}))}}catch(t){let n=t instanceof Error?t.message:String(t);g.error(e(`modelManager.modals.embeddings.failed`)+`: `+n)}finally{He(!1)}},$=e=>{let t=e/(1024*1024*1024);return t>=1?`${t.toFixed(2)} GB`:`${(e/(1024*1024)).toFixed(1)} MB`},Dt=e=>Array.isArray(X)&&X.some(t=>t.name===e),Ot=()=>Y.reduce((e,t)=>e+t.size,0),kt=()=>X.reduce((e,t)=>e+(t.size_vram||0),0),At=e=>Y.some(t=>t.name===e||t.name.startsWith(e+`:`)),jt=(l===`cloud`?lt:Q).filter(e=>{let t=l===`all`||l===`cloud`||e.category===l,n=!d||e.name.toLowerCase().includes(d.toLowerCase())||e.description.toLowerCase().includes(d.toLowerCase());return t&&n}),Mt=[`all`,...new Set([...Q.map(e=>e.category),`cloud`])],Nt=(0,j.useMemo)(()=>Q.length>0?Q.slice(0,10).map(e=>({name:e.name,category:e.category,size:e.sizes?.[0]||``})):[{name:`deepseek-r1`,category:`reasoning`,size:`7B`},{name:`llama3.2`,category:`general`,size:`3B`},{name:`gemma3`,category:`general`,size:`4B`},{name:`qwen2.5`,category:`general`,size:`7B`},{name:`mistral`,category:`general`,size:`7B`},{name:`codellama`,category:`coding`,size:`7B`},{name:`nomic-embed-text`,category:`embedding`,size:`137M`},{name:`llava`,category:`vision`,size:`7B`},{name:`phi3`,category:`general`,size:`3.8B`},{name:`gemma2`,category:`general`,size:`9B`}],[Q]),Pt=me||ve||Ee||Ne;return at?(0,M.jsx)(`div`,{className:`flex items-center justify-center p-8`,children:(0,M.jsxs)(`div`,{className:`flex items-center gap-3 text-gray-600 dark:text-dark-600`,children:[(0,M.jsx)(h,{className:`h-5 w-5 animate-spin`}),e(`modelManager.loading`)]})}):(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsx)(`div`,{className:O(`rounded-2xl border px-4 py-3`,`bg-white/60 dark:bg-white/[0.03]`,`border-gray-200/80 dark:border-white/10`),children:(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`div`,{className:O(`w-2.5 h-2.5 rounded-full`,st?`bg-green-500`:`bg-red-500`)}),(0,M.jsx)(`span`,{className:`text-sm font-medium text-gray-700 dark:text-gray-300`,children:e(st?`modelManager.systemStatus.online`:`modelManager.systemStatus.offline`)})]}),ot&&(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-gray-600 dark:text-gray-400`,children:[(0,M.jsx)(ee,{className:`h-4 w-4`}),(0,M.jsxs)(`span`,{children:[`v`,ot]})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-gray-600 dark:text-gray-400`,children:[(0,M.jsx)(w,{className:`h-4 w-4`}),(0,M.jsxs)(`span`,{children:[Y.length,` `,Y.length===1?e(`modelManager.systemStatus.models`):e(`modelManager.systemStatus.models_plural`)]})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-gray-600 dark:text-gray-400`,children:[(0,M.jsx)(p,{className:`h-4 w-4`}),(0,M.jsx)(`span`,{children:$(Ot())})]}),X.length>0&&(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-green-600 dark:text-green-400`,children:[(0,M.jsx)(s,{className:`h-4 w-4`}),(0,M.jsxs)(`span`,{children:[X.length,` `,e(`modelManager.systemStatus.running`),` (`,$(kt()),` `,e(`modelManager.systemStatus.vram`),`)`]})]})]}),(0,M.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,M.jsxs)(k,{onClick:Z,variant:`outline`,size:`sm`,className:O(`gap-1.5`,``,``),children:[(0,M.jsx)(h,{className:`h-3.5 w-3.5`}),e(`common.refresh`)]})})]})}),(0,M.jsx)(be,{expanded:G.has(`pull`),modelName:m,setModelName:v,pulling:y,progress:S,canInstallModels:i,popularModels:Nt,onToggle:()=>K(`pull`),onPull:()=>bt(),onCancelPull:xt,formatSize:$}),(0,M.jsx)(ye,{expanded:G.has(`library`),models:jt,totalAvailable:Q.length,categories:Mt,filter:l,search:d,loading:ct||ut,pulling:y,canInstallModels:i,pullSectionExpanded:G.has(`pull`),setFilter:u,setSearch:f,isModelInstalled:At,normalizeCloudPullName:Ce,onToggle:()=>K(`library`),onTogglePullSection:()=>K(`pull`),onPullModel:bt,onRefresh:dt}),(0,M.jsx)(pe,{expanded:G.has(`huggingface`),models:pt,search:Ue,task:B,sort:V,loadingModels:mt,canInstallModels:i,expandedModelId:Ye,loadingGgufModelId:$e,ggufFiles:Ze,pullingModel:tt,pullProgress:nt,setSearch:We,setTask:qe,setSort:Je,onToggle:()=>K(`huggingface`),onToggleModel:_t,onPullGguf:vt,onCancelPull:yt,onRefresh:ht}),Array.isArray(X)&&X.length>0&&(0,M.jsxs)(`div`,{className:O(`rounded-2xl border p-4`,`bg-white/60 dark:bg-white/[0.03]`,`border-gray-200/80 dark:border-white/10`),children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-3 mb-4`,children:[(0,M.jsx)(s,{className:`h-4 w-4 text-gray-500 dark:text-dark-500`}),(0,M.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-dark-800`,children:e(`modelManager.sections.running`)}),(0,M.jsxs)(`span`,{className:O(`ms-auto rounded-full px-2 py-0.5 text-xs font-medium`,`border border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/[0.04]`,`text-gray-600 dark:text-dark-600`),children:[X.length,` `,e(`modelManager.systemStatus.running`)]})]}),(0,M.jsx)(`div`,{className:`space-y-2`,children:X.map(t=>(0,M.jsxs)(`div`,{className:O(`flex items-center justify-between p-4 rounded-lg border`,`bg-white/50 dark:bg-white/[0.025]`,`border-gray-200/80 dark:border-white/[0.08]`),children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,M.jsx)(`div`,{className:O(`w-2 h-2 rounded-full animate-pulse`,`bg-green-500`)}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`div`,{className:`font-medium text-gray-900 dark:text-dark-800`,children:t.name}),(0,M.jsxs)(`div`,{className:`flex items-center gap-3 text-sm text-gray-500 dark:text-dark-500`,children:[(0,M.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,M.jsx)(c,{className:`h-3 w-3`}),e(`modelManager.systemStatus.vram`),`:`,` `,$(t.size_vram||0)]}),t.size&&(0,M.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,M.jsx)(w,{className:`h-3 w-3`}),e(`models.size`),`: `,$(t.size)]})]})]})]}),(0,M.jsxs)(`div`,{className:O(`flex items-center gap-1.5 px-2 py-1 rounded-full text-xs font-medium`,`border border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/[0.04]`,`text-gray-600 dark:text-dark-600`),children:[(0,M.jsx)(re,{className:`h-3 w-3`}),e(`modelManager.local.running`)]})]},t.name))})]}),(0,M.jsx)(_e,{expanded:G.has(`local`),models:Y,onToggle:()=>K(`local`),isModelRunning:Dt,formatSize:$,onShowModel:Ct,onCopyModel:e=>{I(e),P(!0)},onDeleteModel:St}),(0,M.jsxs)(`div`,{className:O(`overflow-hidden rounded-2xl border`,`bg-white/60 dark:bg-white/[0.03]`,`border-gray-200/80 dark:border-white/10`),children:[(0,M.jsxs)(`button`,{onClick:()=>K(`advanced`),"aria-expanded":G.has(`advanced`),className:O(`w-full flex items-center justify-between p-4`,`hover:bg-gray-50 dark:hover:bg-dark-50`,`transition-colors`),children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,M.jsx)(ae,{className:`h-4 w-4 text-gray-500 dark:text-dark-500`}),(0,M.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-dark-800`,children:e(`modelManager.sections.advanced`)})]}),G.has(`advanced`)?(0,M.jsx)(b,{className:`h-5 w-5 text-gray-500`}):(0,M.jsx)(_,{className:`h-5 w-5 text-gray-500`})]}),G.has(`advanced`)&&(0,M.jsx)(`div`,{className:`p-4 pt-0`,children:(0,M.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3`,children:[(0,M.jsxs)(k,{onClick:()=>De(!0),variant:`outline`,className:O(`w-full gap-2 justify-start h-auto py-3 px-4`,``,``),children:[(0,M.jsx)(ne,{className:`h-5 w-5 text-gray-500 dark:text-dark-500`}),(0,M.jsxs)(`div`,{className:`text-start`,children:[(0,M.jsx)(`div`,{className:`font-medium`,children:e(`modelManager.advanced.createModel`)}),(0,M.jsx)(`div`,{className:`text-xs opacity-70`,children:e(`modelManager.advanced.fromModelfile`)})]})]}),(0,M.jsxs)(k,{onClick:()=>P(!0),variant:`outline`,className:O(`w-full gap-2 justify-start h-auto py-3 px-4`,``,``),children:[(0,M.jsx)(ie,{className:`h-5 w-5 text-gray-500 dark:text-dark-500`}),(0,M.jsxs)(`div`,{className:`text-start`,children:[(0,M.jsx)(`div`,{className:`font-medium`,children:e(`modelManager.advanced.copyModel`)}),(0,M.jsx)(`div`,{className:`text-xs opacity-70`,children:e(`modelManager.advanced.duplicateExisting`)})]})]}),(0,M.jsxs)(k,{onClick:()=>Pe(!0),variant:`outline`,className:O(`w-full gap-2 justify-start h-auto py-3 px-4`,``,``),children:[(0,M.jsx)(te,{className:`h-5 w-5 text-gray-500 dark:text-dark-500`}),(0,M.jsxs)(`div`,{className:`text-start`,children:[(0,M.jsx)(`div`,{className:`font-medium`,children:e(`modelManager.advanced.testEmbeddings`)}),(0,M.jsx)(`div`,{className:`text-xs opacity-70`,children:e(`modelManager.advanced.generateVectors`)})]})]}),(0,M.jsxs)(k,{onClick:async()=>{try{(await D.checkHealth()).success&&(await J(),g.success(e(`modelManager.advanced.healthy`)))}catch{await J(),g.error(e(`modelManager.systemStatus.offline`))}},variant:`outline`,className:O(`w-full gap-2 justify-start h-auto py-3 px-4`,``,``),children:[(0,M.jsx)(o,{className:`h-5 w-5 text-gray-500 dark:text-dark-500`}),(0,M.jsxs)(`div`,{className:`text-start`,children:[(0,M.jsx)(`div`,{className:`font-medium`,children:e(`modelManager.advanced.healthCheck`)}),(0,M.jsx)(`div`,{className:`text-xs opacity-70`,children:e(`modelManager.advanced.testConnection`)})]})]})]})})]}),Pt&&(0,M.jsx)(j.Suspense,{fallback:null,children:(0,M.jsx)(Se,{models:Y,showDetailsModal:me,setShowDetailsModal:he,selectedModelName:ue,selectedModelDetails:oe,loadingDetails:ge,showCopyModal:ve,setShowCopyModal:P,copySource:F,setCopySource:I,copyDestination:L,setCopyDestination:R,copying:we,handleCopyModel:wt,showCreateModal:Ee,setShowCreateModal:De,createModelName:z,setCreateModelName:Oe,createModelfile:ke,setCreateModelfile:Ae,creating:je,handleCreateModel:Tt,showEmbeddingsModal:Ne,setShowEmbeddingsModal:Pe,embeddingsModel:Fe,setEmbeddingsModel:Ie,embeddingsInput:Le,setEmbeddingsInput:Re,embeddingsResult:ze,generatingEmbeddings:Ve,handleGenerateEmbeddings:Et})})]})},R=()=>{let{t:e}=A();return(0,M.jsxs)(ue,{children:[(0,M.jsx)(de,{title:e(`models.title`),description:e(`models.subtitle`)}),(0,M.jsx)(L,{})]})};export{R as ModelsPage,R as default};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-QTnfLwEv.js";import{d as t,f as n}from"./markdown-core-fkbHPd-g.js";import{_ as r,a as i,c as a,d as o,f as s,g as c,h as l,i as u,l as d,m as f,n as p,o as m,p as h,r as g,s as _,t as v,u as y,v as b}from"./syntax-highlight-D5wpTVgr.js";var x=e({OptimizedSyntaxHighlighter:()=>E,default:()=>E});n();var S=t(),C={js:`javascript`,ts:`typescript`,py:`python`,sh:`bash`,shell:`bash`,zsh:`bash`,terminal:`shell-session`,console:`shell-session`,html:`markup`,xml:`markup`,svg:`markup`,"c++":`cpp`},w={bash:r,c,cpp:l,css:f,diff:h,java:s,javascript:o,json:y,jsx:d,markdown:a,markup:_,python:m,"shell-session":i,tsx:u,typescript:g};Object.entries(w).forEach(([e,t])=>{b.registerLanguage(e,t)}),b.alias(`markup`,[`html`,`xml`,`svg`]);var T=new Set(Object.keys(w)),E=({children:e,language:t,isDark:n=!1,className:r=``})=>{let i=C[t.toLowerCase()]||t.toLowerCase();return T.has(i)?(0,S.jsx)(b,{language:i,style:n?p:v,className:r,customStyle:{margin:0,padding:`0.75rem`,borderRadius:`0.5rem`,fontSize:`0.875rem`},showLineNumbers:!1,children:e}):(0,S.jsx)(`pre`,{className:`bg-gray-100 dark:bg-dark-200 p-3 rounded-lg overflow-x-auto text-sm font-mono ${r}`,children:(0,S.jsx)(`code`,{className:``,children:e})})};export{x as n,E as t};
1
+ import{n as e}from"./rolldown-runtime-QTnfLwEv.js";import{d as t,f as n}from"./markdown-core-fkbHPd-g.js";import{_ as r,a as i,c as a,d as o,f as s,g as c,h as l,i as u,l as d,m as f,n as p,o as m,p as h,r as g,s as _,t as v,u as y,v as b}from"./syntax-highlight-D5wpTVgr.js";var x=e({OptimizedSyntaxHighlighter:()=>E,default:()=>E});n();var S=t(),C={js:`javascript`,ts:`typescript`,py:`python`,sh:`bash`,shell:`bash`,zsh:`bash`,terminal:`shell-session`,console:`shell-session`,html:`markup`,xml:`markup`,svg:`markup`,"c++":`cpp`},w={bash:r,c,cpp:l,css:f,diff:h,java:s,javascript:o,json:y,jsx:d,markdown:a,markup:_,python:m,"shell-session":i,tsx:u,typescript:g};Object.entries(w).forEach(([e,t])=>{b.registerLanguage(e,t)}),b.alias(`markup`,[`html`,`xml`,`svg`]);var T=new Set(Object.keys(w)),E=({children:e,language:t,isDark:n=!1,className:r=``})=>{let i=C[t.toLowerCase()]||t.toLowerCase();return T.has(i)?(0,S.jsx)(`div`,{dir:`ltr`,className:`text-left`,children:(0,S.jsx)(b,{language:i,style:n?p:v,className:r,customStyle:{margin:0,padding:`0.75rem`,borderRadius:`0.5rem`,fontSize:`0.875rem`},showLineNumbers:!1,children:e})}):(0,S.jsx)(`pre`,{dir:`ltr`,className:`bg-gray-100 dark:bg-dark-200 p-3 rounded-lg overflow-x-auto text-left text-sm font-mono ${r}`,children:(0,S.jsx)(`code`,{className:``,children:e})})};export{x as n,E as t};