@samanhappy/mcphub 0.9.11 → 0.9.12
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.
- package/dist/services/dataServicex.js +1 -0
- package/dist/services/dataServicex.js.map +1 -1
- package/dist/services/registry.js +0 -1
- package/dist/services/registry.js.map +1 -1
- package/dist/utils/path.js +20 -8
- package/dist/utils/path.js.map +1 -1
- package/frontend/dist/assets/{index-Dzo9yYCx.js → index-CSwGPdCR.js} +3 -3
- package/frontend/dist/assets/{index-Dzo9yYCx.js.map → index-CSwGPdCR.js.map} +1 -1
- package/frontend/dist/index.html +1 -1
- package/package.json +1 -1
|
@@ -187,8 +187,8 @@ Please change the parent <Route path="${M}"> to <Route path="${M==="/"?"*":`${M}
|
|
|
187
187
|
*
|
|
188
188
|
* This source code is licensed under the ISC license.
|
|
189
189
|
* See the LICENSE file in the root directory of this source tree.
|
|
190
|
-
*/const hv=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Vn=et("x",hv);function Lp(n){var l,o,i="";if(typeof n=="string"||typeof n=="number")i+=n;else if(typeof n=="object")if(Array.isArray(n)){var u=n.length;for(l=0;l<u;l++)n[l]&&(o=Lp(n[l]))&&(i&&(i+=" "),i+=o)}else for(o in n)n[o]&&(i&&(i+=" "),i+=o);return i}function pv(){for(var n,l,o=0,i="",u=arguments.length;o<u;o++)(n=arguments[o])&&(l=Lp(n))&&(i&&(i+=" "),i+=l);return i}const Cu="-",gv=n=>{const l=yv(n),{conflictingClassGroups:o,conflictingClassGroupModifiers:i}=n;return{getClassGroupId:m=>{const p=m.split(Cu);return p[0]===""&&p.length!==1&&p.shift(),_p(p,l)||xv(m)},getConflictingClassGroupIds:(m,p)=>{const g=o[m]||[];return p&&i[m]?[...g,...i[m]]:g}}},_p=(n,l)=>{var m;if(n.length===0)return l.classGroupId;const o=n[0],i=l.nextPart.get(o),u=i?_p(n.slice(1),i):void 0;if(u)return u;if(l.validators.length===0)return;const d=n.join(Cu);return(m=l.validators.find(({validator:p})=>p(d)))==null?void 0:m.classGroupId},Dh=/^\[(.+)\]$/,xv=n=>{if(Dh.test(n)){const l=Dh.exec(n)[1],o=l==null?void 0:l.substring(0,l.indexOf(":"));if(o)return"arbitrary.."+o}},yv=n=>{const{theme:l,classGroups:o}=n,i={nextPart:new Map,validators:[]};for(const u in o)nu(o[u],i,u,l);return i},nu=(n,l,o,i)=>{n.forEach(u=>{if(typeof u=="string"){const d=u===""?l:Uh(l,u);d.classGroupId=o;return}if(typeof u=="function"){if(bv(u)){nu(u(i),l,o,i);return}l.validators.push({validator:u,classGroupId:o});return}Object.entries(u).forEach(([d,m])=>{nu(m,Uh(l,d),o,i)})})},Uh=(n,l)=>{let o=n;return l.split(Cu).forEach(i=>{o.nextPart.has(i)||o.nextPart.set(i,{nextPart:new Map,validators:[]}),o=o.nextPart.get(i)}),o},bv=n=>n.isThemeGetter,vv=n=>{if(n<1)return{get:()=>{},set:()=>{}};let l=0,o=new Map,i=new Map;const u=(d,m)=>{o.set(d,m),l++,l>n&&(l=0,i=o,o=new Map)};return{get(d){let m=o.get(d);if(m!==void 0)return m;if((m=i.get(d))!==void 0)return u(d,m),m},set(d,m){o.has(d)?o.set(d,m):u(d,m)}}},lu="!",ou=":",wv=ou.length,jv=n=>{const{prefix:l,experimentalParseClassName:o}=n;let i=u=>{const d=[];let m=0,p=0,g=0,h;for(let S=0;S<u.length;S++){let k=u[S];if(m===0&&p===0){if(k===ou){d.push(u.slice(g,S)),g=S+wv;continue}if(k==="/"){h=S;continue}}k==="["?m++:k==="]"?m--:k==="("?p++:k===")"&&p--}const y=d.length===0?u:u.substring(g),N=Nv(y),C=N!==y,E=h&&h>g?h-g:void 0;return{modifiers:d,hasImportantModifier:C,baseClassName:N,maybePostfixModifierPosition:E}};if(l){const u=l+ou,d=i;i=m=>m.startsWith(u)?d(m.substring(u.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:m,maybePostfixModifierPosition:void 0}}if(o){const u=i;i=d=>o({className:d,parseClassName:u})}return i},Nv=n=>n.endsWith(lu)?n.substring(0,n.length-1):n.startsWith(lu)?n.substring(1):n,Sv=n=>{const l=Object.fromEntries(n.orderSensitiveModifiers.map(i=>[i,!0]));return i=>{if(i.length<=1)return i;const u=[];let d=[];return i.forEach(m=>{m[0]==="["||l[m]?(u.push(...d.sort(),m),d=[]):d.push(m)}),u.push(...d.sort()),u}},Cv=n=>({cache:vv(n.cacheSize),parseClassName:jv(n),sortModifiers:Sv(n),...gv(n)}),Ev=/\s+/,kv=(n,l)=>{const{parseClassName:o,getClassGroupId:i,getConflictingClassGroupIds:u,sortModifiers:d}=l,m=[],p=n.trim().split(Ev);let g="";for(let h=p.length-1;h>=0;h-=1){const y=p[h],{isExternal:N,modifiers:C,hasImportantModifier:E,baseClassName:S,maybePostfixModifierPosition:k}=o(y);if(N){g=y+(g.length>0?" "+g:g);continue}let T=!!k,A=i(T?S.substring(0,k):S);if(!A){if(!T){g=y+(g.length>0?" "+g:g);continue}if(A=i(S),!A){g=y+(g.length>0?" "+g:g);continue}T=!1}const j=d(C).join(":"),M=E?j+lu:j,$=M+A;if(m.includes($))continue;m.push($);const W=u(A,T);for(let ne=0;ne<W.length;++ne){const re=W[ne];m.push(M+re)}g=y+(g.length>0?" "+g:g)}return g};function Tv(){let n=0,l,o,i="";for(;n<arguments.length;)(l=arguments[n++])&&(o=Pp(l))&&(i&&(i+=" "),i+=o);return i}const Pp=n=>{if(typeof n=="string")return n;let l,o="";for(let i=0;i<n.length;i++)n[i]&&(l=Pp(n[i]))&&(o&&(o+=" "),o+=l);return o};function Av(n,...l){let o,i,u,d=m;function m(g){const h=l.reduce((y,N)=>N(y),n());return o=Cv(h),i=o.cache.get,u=o.cache.set,d=p,p(g)}function p(g){const h=i(g);if(h)return h;const y=kv(g,o);return u(g,y),y}return function(){return d(Tv.apply(null,arguments))}}const dt=n=>{const l=o=>o[n]||[];return l.isThemeGetter=!0,l},Hp=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Bp=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Rv=/^\d+\/\d+$/,Mv=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ov=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Dv=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Uv=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,zv=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ks=n=>Rv.test(n),Re=n=>!!n&&!Number.isNaN(Number(n)),gr=n=>!!n&&Number.isInteger(Number(n)),Xc=n=>n.endsWith("%")&&Re(n.slice(0,-1)),Ha=n=>Mv.test(n),Lv=()=>!0,_v=n=>Ov.test(n)&&!Dv.test(n),qp=()=>!1,Pv=n=>Uv.test(n),Hv=n=>zv.test(n),Bv=n=>!pe(n)&&!ge(n),qv=n=>zs(n,Kp,qp),pe=n=>Hp.test(n),_r=n=>zs(n,Fp,_v),Qc=n=>zs(n,$v,Re),zh=n=>zs(n,Vp,qp),Vv=n=>zs(n,Gp,Hv),uo=n=>zs(n,$p,Pv),ge=n=>Bp.test(n),_n=n=>Ls(n,Fp),Gv=n=>Ls(n,Iv),Lh=n=>Ls(n,Vp),Kv=n=>Ls(n,Kp),Fv=n=>Ls(n,Gp),fo=n=>Ls(n,$p,!0),zs=(n,l,o)=>{const i=Hp.exec(n);return i?i[1]?l(i[1]):o(i[2]):!1},Ls=(n,l,o=!1)=>{const i=Bp.exec(n);return i?i[1]?l(i[1]):o:!1},Vp=n=>n==="position"||n==="percentage",Gp=n=>n==="image"||n==="url",Kp=n=>n==="length"||n==="size"||n==="bg-size",Fp=n=>n==="length",$v=n=>n==="number",Iv=n=>n==="family-name",$p=n=>n==="shadow",Yv=()=>{const n=dt("color"),l=dt("font"),o=dt("text"),i=dt("font-weight"),u=dt("tracking"),d=dt("leading"),m=dt("breakpoint"),p=dt("container"),g=dt("spacing"),h=dt("radius"),y=dt("shadow"),N=dt("inset-shadow"),C=dt("text-shadow"),E=dt("drop-shadow"),S=dt("blur"),k=dt("perspective"),T=dt("aspect"),A=dt("ease"),j=dt("animate"),M=()=>["auto","avoid","all","avoid-page","page","left","right","column"],$=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],W=()=>[...$(),ge,pe],ne=()=>["auto","hidden","clip","visible","scroll"],re=()=>["auto","contain","none"],I=()=>[ge,pe,g],oe=()=>[ks,"full","auto",...I()],te=()=>[gr,"none","subgrid",ge,pe],U=()=>["auto",{span:["full",gr,ge,pe]},gr,ge,pe],D=()=>[gr,"auto",ge,pe],Q=()=>["auto","min","max","fr",ge,pe],P=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],V=()=>["start","end","center","stretch","center-safe","end-safe"],w=()=>["auto",...I()],z=()=>[ks,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],q=()=>[n,ge,pe],de=()=>[...$(),Lh,zh,{position:[ge,pe]}],R=()=>["no-repeat",{repeat:["","x","y","space","round"]}],J=()=>["auto","cover","contain",Kv,qv,{size:[ge,pe]}],ie=()=>[Xc,_n,_r],B=()=>["","none","full",h,ge,pe],_=()=>["",Re,_n,_r],ee=()=>["solid","dashed","dotted","double"],Y=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],F=()=>[Re,Xc,Lh,zh],ue=()=>["","none",S,ge,pe],xe=()=>["none",Re,ge,pe],Ne=()=>["none",Re,ge,pe],ye=()=>[Re,ge,pe],Te=()=>[ks,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ha],breakpoint:[Ha],color:[Lv],container:[Ha],"drop-shadow":[Ha],ease:["in","out","in-out"],font:[Bv],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ha],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ha],shadow:[Ha],spacing:["px",Re],text:[Ha],"text-shadow":[Ha],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ks,pe,ge,T]}],container:["container"],columns:[{columns:[Re,pe,ge,p]}],"break-after":[{"break-after":M()}],"break-before":[{"break-before":M()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:W()}],overflow:[{overflow:ne()}],"overflow-x":[{"overflow-x":ne()}],"overflow-y":[{"overflow-y":ne()}],overscroll:[{overscroll:re()}],"overscroll-x":[{"overscroll-x":re()}],"overscroll-y":[{"overscroll-y":re()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:oe()}],"inset-x":[{"inset-x":oe()}],"inset-y":[{"inset-y":oe()}],start:[{start:oe()}],end:[{end:oe()}],top:[{top:oe()}],right:[{right:oe()}],bottom:[{bottom:oe()}],left:[{left:oe()}],visibility:["visible","invisible","collapse"],z:[{z:[gr,"auto",ge,pe]}],basis:[{basis:[ks,"full","auto",p,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Re,ks,"auto","initial","none",pe]}],grow:[{grow:["",Re,ge,pe]}],shrink:[{shrink:["",Re,ge,pe]}],order:[{order:[gr,"first","last","none",ge,pe]}],"grid-cols":[{"grid-cols":te()}],"col-start-end":[{col:U()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":te()}],"row-start-end":[{row:U()}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Q()}],"auto-rows":[{"auto-rows":Q()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...P(),"normal"]}],"justify-items":[{"justify-items":[...V(),"normal"]}],"justify-self":[{"justify-self":["auto",...V()]}],"align-content":[{content:["normal",...P()]}],"align-items":[{items:[...V(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...V(),{baseline:["","last"]}]}],"place-content":[{"place-content":P()}],"place-items":[{"place-items":[...V(),"baseline"]}],"place-self":[{"place-self":["auto",...V()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:w()}],mx:[{mx:w()}],my:[{my:w()}],ms:[{ms:w()}],me:[{me:w()}],mt:[{mt:w()}],mr:[{mr:w()}],mb:[{mb:w()}],ml:[{ml:w()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:z()}],w:[{w:[p,"screen",...z()]}],"min-w":[{"min-w":[p,"screen","none",...z()]}],"max-w":[{"max-w":[p,"screen","none","prose",{screen:[m]},...z()]}],h:[{h:["screen","lh",...z()]}],"min-h":[{"min-h":["screen","lh","none",...z()]}],"max-h":[{"max-h":["screen","lh",...z()]}],"font-size":[{text:["base",o,_n,_r]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,ge,Qc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Xc,pe]}],"font-family":[{font:[Gv,pe,l]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[u,ge,pe]}],"line-clamp":[{"line-clamp":[Re,"none",ge,Qc]}],leading:[{leading:[d,...I()]}],"list-image":[{"list-image":["none",ge,pe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ge,pe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:q()}],"text-color":[{text:q()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ee(),"wavy"]}],"text-decoration-thickness":[{decoration:[Re,"from-font","auto",ge,_r]}],"text-decoration-color":[{decoration:q()}],"underline-offset":[{"underline-offset":[Re,"auto",ge,pe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ge,pe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ge,pe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:de()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:J()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},gr,ge,pe],radial:["",ge,pe],conic:[gr,ge,pe]},Fv,Vv]}],"bg-color":[{bg:q()}],"gradient-from-pos":[{from:ie()}],"gradient-via-pos":[{via:ie()}],"gradient-to-pos":[{to:ie()}],"gradient-from":[{from:q()}],"gradient-via":[{via:q()}],"gradient-to":[{to:q()}],rounded:[{rounded:B()}],"rounded-s":[{"rounded-s":B()}],"rounded-e":[{"rounded-e":B()}],"rounded-t":[{"rounded-t":B()}],"rounded-r":[{"rounded-r":B()}],"rounded-b":[{"rounded-b":B()}],"rounded-l":[{"rounded-l":B()}],"rounded-ss":[{"rounded-ss":B()}],"rounded-se":[{"rounded-se":B()}],"rounded-ee":[{"rounded-ee":B()}],"rounded-es":[{"rounded-es":B()}],"rounded-tl":[{"rounded-tl":B()}],"rounded-tr":[{"rounded-tr":B()}],"rounded-br":[{"rounded-br":B()}],"rounded-bl":[{"rounded-bl":B()}],"border-w":[{border:_()}],"border-w-x":[{"border-x":_()}],"border-w-y":[{"border-y":_()}],"border-w-s":[{"border-s":_()}],"border-w-e":[{"border-e":_()}],"border-w-t":[{"border-t":_()}],"border-w-r":[{"border-r":_()}],"border-w-b":[{"border-b":_()}],"border-w-l":[{"border-l":_()}],"divide-x":[{"divide-x":_()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":_()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ee(),"hidden","none"]}],"divide-style":[{divide:[...ee(),"hidden","none"]}],"border-color":[{border:q()}],"border-color-x":[{"border-x":q()}],"border-color-y":[{"border-y":q()}],"border-color-s":[{"border-s":q()}],"border-color-e":[{"border-e":q()}],"border-color-t":[{"border-t":q()}],"border-color-r":[{"border-r":q()}],"border-color-b":[{"border-b":q()}],"border-color-l":[{"border-l":q()}],"divide-color":[{divide:q()}],"outline-style":[{outline:[...ee(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Re,ge,pe]}],"outline-w":[{outline:["",Re,_n,_r]}],"outline-color":[{outline:q()}],shadow:[{shadow:["","none",y,fo,uo]}],"shadow-color":[{shadow:q()}],"inset-shadow":[{"inset-shadow":["none",N,fo,uo]}],"inset-shadow-color":[{"inset-shadow":q()}],"ring-w":[{ring:_()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:q()}],"ring-offset-w":[{"ring-offset":[Re,_r]}],"ring-offset-color":[{"ring-offset":q()}],"inset-ring-w":[{"inset-ring":_()}],"inset-ring-color":[{"inset-ring":q()}],"text-shadow":[{"text-shadow":["none",C,fo,uo]}],"text-shadow-color":[{"text-shadow":q()}],opacity:[{opacity:[Re,ge,pe]}],"mix-blend":[{"mix-blend":[...Y(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Y()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Re]}],"mask-image-linear-from-pos":[{"mask-linear-from":F()}],"mask-image-linear-to-pos":[{"mask-linear-to":F()}],"mask-image-linear-from-color":[{"mask-linear-from":q()}],"mask-image-linear-to-color":[{"mask-linear-to":q()}],"mask-image-t-from-pos":[{"mask-t-from":F()}],"mask-image-t-to-pos":[{"mask-t-to":F()}],"mask-image-t-from-color":[{"mask-t-from":q()}],"mask-image-t-to-color":[{"mask-t-to":q()}],"mask-image-r-from-pos":[{"mask-r-from":F()}],"mask-image-r-to-pos":[{"mask-r-to":F()}],"mask-image-r-from-color":[{"mask-r-from":q()}],"mask-image-r-to-color":[{"mask-r-to":q()}],"mask-image-b-from-pos":[{"mask-b-from":F()}],"mask-image-b-to-pos":[{"mask-b-to":F()}],"mask-image-b-from-color":[{"mask-b-from":q()}],"mask-image-b-to-color":[{"mask-b-to":q()}],"mask-image-l-from-pos":[{"mask-l-from":F()}],"mask-image-l-to-pos":[{"mask-l-to":F()}],"mask-image-l-from-color":[{"mask-l-from":q()}],"mask-image-l-to-color":[{"mask-l-to":q()}],"mask-image-x-from-pos":[{"mask-x-from":F()}],"mask-image-x-to-pos":[{"mask-x-to":F()}],"mask-image-x-from-color":[{"mask-x-from":q()}],"mask-image-x-to-color":[{"mask-x-to":q()}],"mask-image-y-from-pos":[{"mask-y-from":F()}],"mask-image-y-to-pos":[{"mask-y-to":F()}],"mask-image-y-from-color":[{"mask-y-from":q()}],"mask-image-y-to-color":[{"mask-y-to":q()}],"mask-image-radial":[{"mask-radial":[ge,pe]}],"mask-image-radial-from-pos":[{"mask-radial-from":F()}],"mask-image-radial-to-pos":[{"mask-radial-to":F()}],"mask-image-radial-from-color":[{"mask-radial-from":q()}],"mask-image-radial-to-color":[{"mask-radial-to":q()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":$()}],"mask-image-conic-pos":[{"mask-conic":[Re]}],"mask-image-conic-from-pos":[{"mask-conic-from":F()}],"mask-image-conic-to-pos":[{"mask-conic-to":F()}],"mask-image-conic-from-color":[{"mask-conic-from":q()}],"mask-image-conic-to-color":[{"mask-conic-to":q()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:de()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:J()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ge,pe]}],filter:[{filter:["","none",ge,pe]}],blur:[{blur:ue()}],brightness:[{brightness:[Re,ge,pe]}],contrast:[{contrast:[Re,ge,pe]}],"drop-shadow":[{"drop-shadow":["","none",E,fo,uo]}],"drop-shadow-color":[{"drop-shadow":q()}],grayscale:[{grayscale:["",Re,ge,pe]}],"hue-rotate":[{"hue-rotate":[Re,ge,pe]}],invert:[{invert:["",Re,ge,pe]}],saturate:[{saturate:[Re,ge,pe]}],sepia:[{sepia:["",Re,ge,pe]}],"backdrop-filter":[{"backdrop-filter":["","none",ge,pe]}],"backdrop-blur":[{"backdrop-blur":ue()}],"backdrop-brightness":[{"backdrop-brightness":[Re,ge,pe]}],"backdrop-contrast":[{"backdrop-contrast":[Re,ge,pe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Re,ge,pe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Re,ge,pe]}],"backdrop-invert":[{"backdrop-invert":["",Re,ge,pe]}],"backdrop-opacity":[{"backdrop-opacity":[Re,ge,pe]}],"backdrop-saturate":[{"backdrop-saturate":[Re,ge,pe]}],"backdrop-sepia":[{"backdrop-sepia":["",Re,ge,pe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ge,pe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Re,"initial",ge,pe]}],ease:[{ease:["linear","initial",A,ge,pe]}],delay:[{delay:[Re,ge,pe]}],animate:[{animate:["none",j,ge,pe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,ge,pe]}],"perspective-origin":[{"perspective-origin":W()}],rotate:[{rotate:xe()}],"rotate-x":[{"rotate-x":xe()}],"rotate-y":[{"rotate-y":xe()}],"rotate-z":[{"rotate-z":xe()}],scale:[{scale:Ne()}],"scale-x":[{"scale-x":Ne()}],"scale-y":[{"scale-y":Ne()}],"scale-z":[{"scale-z":Ne()}],"scale-3d":["scale-3d"],skew:[{skew:ye()}],"skew-x":[{"skew-x":ye()}],"skew-y":[{"skew-y":ye()}],transform:[{transform:[ge,pe,"","none","gpu","cpu"]}],"transform-origin":[{origin:W()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Te()}],"translate-x":[{"translate-x":Te()}],"translate-y":[{"translate-y":Te()}],"translate-z":[{"translate-z":Te()}],"translate-none":["translate-none"],accent:[{accent:q()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:q()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ge,pe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ge,pe]}],fill:[{fill:["none",...q()]}],"stroke-w":[{stroke:[Re,_n,_r,Qc]}],stroke:[{stroke:["none",...q()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Xv=Av(Yv);function qa(...n){return Xv(pv(n))}const Qv=({message:n,type:l="info",duration:o=3e3,onClose:i,visible:u})=>{const{t:d}=ve();b.useEffect(()=>{if(u){const h=setTimeout(()=>{i()},o);return()=>clearTimeout(h)}},[u,o,i]);const m={success:r.jsx(Yn,{className:"w-5 h-5 text-green-500"}),error:r.jsx(Vn,{className:"w-5 h-5 text-red-500"}),info:r.jsx("svg",{className:"w-5 h-5 text-blue-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),warning:r.jsx("svg",{className:"w-5 h-5 text-yellow-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})},p={success:"bg-green-50 border-green-200",error:"bg-red-50 border-red-200",info:"bg-blue-50 border-blue-200",warning:"bg-yellow-50 border-yellow-200"},g={success:"text-green-800",error:"text-red-800",info:"text-blue-800",warning:"text-yellow-800"};return r.jsx("div",{className:qa("fixed top-4 right-4 z-50 max-w-sm p-4 rounded-md shadow-lg border",p[l],"transform transition-all duration-300 ease-in-out",u?"translate-x-0 opacity-100":"translate-x-full opacity-0"),children:r.jsxs("div",{className:"flex items-start",children:[r.jsx("div",{className:"flex-shrink-0",children:m[l]}),r.jsx("div",{className:"ml-3",children:r.jsx("p",{className:qa("text-sm font-medium",g[l]),children:n})}),r.jsx("div",{className:"ml-auto pl-3",children:r.jsx("div",{className:"-mx-1.5 -my-1.5",children:r.jsxs("button",{onClick:i,className:qa("inline-flex rounded-md p-1.5",`hover:bg-${l}-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-${l}-500`),children:[r.jsx("span",{className:"sr-only",children:d("common.dismiss")}),r.jsx(Vn,{className:"h-5 w-5"})]})})})]})})},Ip=b.createContext(void 0),Xn=()=>{const n=b.useContext(Ip);if(!n)throw new Error("useToast must be used within a ToastProvider");return n},Zv=({children:n})=>{const[l,o]=b.useState({message:"",type:"info",visible:!1,duration:3e3}),i=b.useCallback((d,m="info",p=3e3)=>{o({message:d,type:m,visible:!0,duration:p})},[]),u=b.useCallback(()=>{o(d=>({...d,visible:!1}))},[]);return r.jsxs(Ip.Provider,{value:{showToast:i},children:[n,r.jsx(Qv,{message:l.message,type:l.type,duration:l.duration,onClose:u,visible:l.visible})]})},Yp=b.createContext(void 0),Jv=()=>{const n=b.useContext(Yp);if(!n)throw new Error("useTheme must be used within a ThemeProvider");return n},Wv=({children:n})=>{const[l,o]=b.useState(()=>localStorage.getItem("theme")||"system"),[i,u]=b.useState("light"),d=m=>{o(m),localStorage.setItem("theme",m)};return b.useEffect(()=>{const m=()=>{const g=window.document.documentElement,h=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",y=l==="system"?h:l;u(y),y==="dark"?(console.log("Applying dark mode to HTML root element"),g.classList.add("dark"),document.body.style.backgroundColor="#111827"):(console.log("Removing dark mode from HTML root element"),g.classList.remove("dark"),document.body.style.backgroundColor="")},p=window.matchMedia("(prefers-color-scheme: dark)");return p.addEventListener("change",m),m(),()=>{p.removeEventListener("change",m)}},[l]),r.jsx(Yp.Provider,{value:{theme:l,setTheme:d,resolvedTheme:i},children:n})},mo={startup:{maxAttempts:60,pollingInterval:3e3},normal:{pollingInterval:1e4}},Xp=b.createContext(void 0),e1=({children:n})=>{const{t:l}=ve(),{auth:o}=Br(),[i,u]=b.useState([]),[d,m]=b.useState(null),[p,g]=b.useState(0),[h,y]=b.useState(!0),[N,C]=b.useState(0),E=b.useRef(null),S=b.useRef(0),k=b.useRef(0),T=3e3,A=()=>{E.current&&(clearInterval(E.current),E.current=null)},j=b.useCallback(te=>{const U=(te==null?void 0:te.immediate)??!0;A();const D=async()=>{try{console.log("[ServerContext] Fetching servers from API...");const Q=await Ye("/servers");k.current=Date.now(),Q&&Q.success&&Array.isArray(Q.data)?u(Q.data):Q&&Array.isArray(Q)?u(Q):(console.error("Invalid server data format:",Q),u([])),m(null)}catch(Q){console.error("Error fetching servers during normal polling:",Q),navigator.onLine?Q instanceof TypeError&&(Q.message.includes("NetworkError")||Q.message.includes("Failed to fetch"))?m(l("errors.serverConnection")):m(l("errors.serverFetch")):m(l("errors.network"))}};U&&D(),E.current=setInterval(D,mo.normal.pollingInterval)},[l]);b.useEffect(()=>{o.isAuthenticated?(console.log("[ServerContext] User authenticated, triggering refresh"),g(te=>te+1)):(console.log("[ServerContext] User not authenticated, clearing data and stopping polling"),A(),u([]),y(!1),m(null))},[o.isAuthenticated]),b.useEffect(()=>{if(!o.isAuthenticated){console.log("[ServerContext] User not authenticated, skipping polling setup");return}p>0&&(S.current=0,C(0));const te=async()=>{try{console.log("[ServerContext] Initial fetch - attempt",S.current+1);const U=await Ye("/servers");return k.current=Date.now(),U&&U.success&&Array.isArray(U.data)?(u(U.data),y(!1),j({immediate:!1}),!0):U&&Array.isArray(U)?(u(U),y(!1),j({immediate:!1}),!0):(console.error("Invalid server data format:",U),u([]),y(!1),j({immediate:!1}),!0)}catch(U){return S.current+=1,console.error(`Initial loading attempt ${S.current} failed:`,U),C(S.current),navigator.onLine?m(l("errors.initialStartup")):m(l("errors.network")),S.current>=mo.startup.maxAttempts&&(console.log("Maximum startup attempts reached, switching to normal polling"),y(!1),A(),j()),!1}};return h?(A(),te(),E.current=setInterval(te,mo.startup.pollingInterval),console.log(`Started initial polling with interval: ${mo.startup.pollingInterval}ms`)):j(),()=>{A()}},[p,l,h,j]);const M=b.useCallback(()=>{A(),h&&(y(!0),S.current=0,C(0)),g(te=>te+1)},[h]),$=b.useCallback(()=>{const U=Date.now()-k.current;console.log("[ServerContext] refreshIfNeeded called, time since last fetch:",U,"ms"),U>=T?(console.log("[ServerContext] Triggering refresh (exceeded MIN_REFRESH_INTERVAL:",T,"ms)"),M()):console.log("[ServerContext] Skipping refresh (MIN_REFRESH_INTERVAL:",T,"ms, time since last:",U,"ms)")},[M]),W=b.useCallback(()=>{g(te=>te+1)},[]),ne=b.useCallback(async te=>{try{const U=await Ye("/settings");if(U&&U.success&&U.data&&U.data.mcpServers&&U.data.mcpServers[te.name]){const D=U.data.mcpServers[te.name];return{name:te.name,status:te.status,tools:te.tools||[],config:D}}else return console.error("Failed to get server config from settings:",U),m(l("server.invalidConfig",{serverName:te.name})),null}catch(U){return console.error("Error fetching server settings:",U),m(U instanceof Error?U.message:String(U)),null}},[l]),re=b.useCallback(async te=>{try{const U=await qn(`/servers/${te}`);return!U||!U.success?(m((U==null?void 0:U.message)||l("server.deleteError",{serverName:te})),!1):(g(D=>D+1),!0)}catch(U){return m(l("errors.general")+": "+(U instanceof Error?U.message:String(U))),!1}},[l]),I=b.useCallback(async(te,U)=>{try{const D=await St(`/servers/${te.name}/toggle`,{enabled:U});return!D||!D.success?(console.error("Failed to toggle server:",D),m((D==null?void 0:D.message)||l("server.toggleError",{serverName:te.name})),!1):(g(Q=>Q+1),!0)}catch(D){return console.error("Error toggling server:",D),m(D instanceof Error?D.message:String(D)),!1}},[l]),oe={servers:i,error:d,setError:m,isLoading:h,fetchAttempts:N,triggerRefresh:M,refreshIfNeeded:$,handleServerAdd:W,handleServerEdit:ne,handleServerRemove:re,handleServerToggle:I};return r.jsx(Xp.Provider,{value:oe,children:n})},t1=()=>{const n=b.useContext(Xp);if(n===void 0)throw new Error("useServerContext must be used within a ServerProvider");return n},Qp=()=>{const{t:n}=ve(),{theme:l,setTheme:o}=Jv(),i=()=>{o(l==="light"?"dark":"light")};return r.jsx("button",{onClick:i,className:"p-2 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 focus:outline-none",title:n(l==="light"?"theme.dark":"theme.light"),"aria-label":n(l==="light"?"theme.dark":"theme.light"),children:l==="light"?r.jsx(ev,{className:"h-5 w-5"}):r.jsx(iv,{className:"h-5 w-5"})})},a1=n=>{const{t:l}=ve();return r.jsxs("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",stroke:"currentColor",strokeWidth:2,...n,children:[r.jsx("title",{children:l("common.language")}),r.jsx("circle",{cx:"12",cy:"12",r:"10"}),r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2 12h20"}),r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z"})]})},Zp=()=>{const{i18n:n}=ve(),[l,o]=b.useState(!1),[i,u]=b.useState(n.language),d=[{code:"en",label:"English"},{code:"zh",label:"中文"},{code:"fr",label:"Français"}];b.useEffect(()=>{u(n.language)},[n.language]),b.useEffect(()=>{const g=h=>{h.target.closest(".language-dropdown")||o(!1)};return l&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g)}},[l]);const m=g=>{localStorage.setItem("i18nextLng",g),o(!1),window.location.reload()},p=()=>{o(!l)};return r.jsxs("div",{className:"relative language-dropdown",children:[r.jsx("button",{onClick:p,className:"p-2 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 focus:outline-none","aria-label":"Language Switcher",children:r.jsx(a1,{className:"h-5 w-5"})}),l&&r.jsx("div",{className:"absolute right-0 mt-2 w-24 bg-white dark:bg-gray-800 rounded-md shadow-lg border border-gray-200 dark:border-gray-700 z-50",children:r.jsx("div",{children:d.map(g=>r.jsx("button",{onClick:()=>m(g.code),className:`flex items-center w-full px-4 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-700 ${i.startsWith(g.code)?"bg-blue-50 text-blue-700":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-100"}`,children:g.label},g.code))})})]})},r1=n=>{const{t:l}=ve();return r.jsxs("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",...n,children:[r.jsx("title",{children:l("common.github")}),r.jsx("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})]})},s1=({onToggleSidebar:n})=>{const{t:l}=ve();return r.jsx("header",{className:"bg-white dark:bg-gray-800 shadow-sm z-10",children:r.jsxs("div",{className:"flex justify-between items-center px-3 py-3",children:[r.jsxs("div",{className:"flex items-center",children:[r.jsx("button",{onClick:n,className:"p-2 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 focus:outline-none","aria-label":l("app.toggleSidebar"),children:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),r.jsx("h1",{className:"ml-4 text-xl font-bold text-gray-900 dark:text-white",children:l("app.title")})]}),r.jsxs("div",{className:"flex items-center space-x-1",children:[r.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400 mr-2",children:"v0.9.11"}),r.jsx("a",{href:"https://github.com/samanhappy/mcphub",target:"_blank",rel:"noopener noreferrer",className:"p-2 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700","aria-label":"GitHub Repository",children:r.jsx(r1,{className:"h-5 w-5"})}),r.jsx(Qp,{}),r.jsx(Zp,{})]})]})})},ho=({permissions:n,fallback:l=null,children:o})=>Jp(n)?r.jsx(r.Fragment,{children:o}):r.jsx(r.Fragment,{children:l}),Jp=n=>{const{auth:l}=Br();if(!l.isAuthenticated||!l.user)return!1;const o=l.user.permissions||[];return n==="x"&&!o.includes("x")?!1:o.includes("*")||l.user.isAdmin?!0:(Array.isArray(n)?n:[n]).some(u=>o.includes(u))},n1="https://registry.npmjs.org",l1="@samanhappy/mcphub",Wp=async()=>{try{const n=await fetch(`${n1}/${l1}/latest`);if(!n.ok)throw new Error(`Failed to fetch latest version: ${n.status}`);return(await n.json()).version||null}catch(n){return console.error("Error checking for latest version:",n),null}},eg=(n,l)=>{if(n==="dev")return-1;const o=n.split(".").map(Number),i=l.split(".").map(Number);for(let u=0;u<3;u++){const d=o[u]||0,m=i[u]||0;if(d>m)return-1;if(d<m)return 1}return 0},o1=({isOpen:n,onClose:l,version:o})=>{const{t:i}=ve(),[u,d]=b.useState(!1),[m,p]=b.useState(""),[g,h]=b.useState(!1),y=async()=>{h(!0);try{const N=await Wp();N&&(p(N),d(eg(o,N)>0))}catch(N){console.error("Failed to check for updates:",N)}finally{h(!1)}};return b.useEffect(()=>{n&&y()},[n,o]),n?r.jsx("div",{className:"fixed inset-0 bg-black/50 bg-opacity-30 z-50 flex items-center justify-center p-4",children:r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg max-w-md w-full",children:r.jsxs("div",{className:"p-6 relative",children:[r.jsx("button",{onClick:l,className:"absolute top-4 right-4 text-gray-400 hover:text-gray-500 dark:text-gray-500 dark:hover:text-gray-400","aria-label":i("common.close"),children:r.jsx(Vn,{className:"h-5 w-5"})}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-4",children:i("about.title")}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"text-gray-700 dark:text-gray-300",children:[i("about.currentVersion"),":"]}),r.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-100",children:o})]}),u&&m&&r.jsx("div",{className:"bg-blue-50 dark:bg-blue-900 p-3 rounded",children:r.jsxs("div",{className:"flex items-start",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),r.jsxs("div",{className:"ml-3 flex-1 text-sm text-blue-700 dark:text-blue-300",children:[r.jsx("p",{children:i("about.newVersionAvailable",{version:m})}),r.jsx("p",{className:"mt-1",children:r.jsx("a",{href:"https://github.com/samanhappy/mcphub",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 dark:text-blue-400 hover:underline",children:i("about.viewOnGitHub")})})]})]})}),r.jsxs("button",{onClick:y,disabled:g,className:`mt-4 inline-flex items-center px-4 py-2 border border-gray-200 dark:border-gray-600 rounded-md shadow-sm text-sm font-medium btn-secondary
|
|
191
|
-
${g?"text-gray-400 dark:text-gray-500 bg-gray-100 dark:bg-gray-800":"text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600"} focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500`,children:[r.jsx(rv,{className:`h-4 w-4 mr-2 ${g?"animate-spin":""}`}),i(g?"about.checking":"about.checkForUpdates")]})]})]})})}):null},i1=({open:n,onOpenChange:l})=>{const{i18n:o,t:i}=ve();return n?r.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg max-w-md w-full",children:r.jsxs("div",{className:"p-6 relative",children:[r.jsx("button",{onClick:()=>l(!1),className:"absolute top-4 right-4 text-gray-400 hover:text-gray-500 dark:text-gray-500 dark:hover:text-gray-400","aria-label":i("common.close"),children:r.jsx(Vn,{className:"h-5 w-5"})}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-4",children:i("sponsor.title")}),r.jsx("div",{className:"flex flex-col items-center justify-center py-4",children:o.language==="zh"?r.jsx("img",{src:"./assets/reward.png",alt:i("sponsor.rewardAlt"),className:"max-w-full h-auto",style:{maxHeight:"400px"}}):r.jsxs("div",{className:"text-center",children:[r.jsx("p",{className:"mb-4 text-gray-700 dark:text-gray-300",children:i("sponsor.supportMessage")}),r.jsx("a",{href:"https://ko-fi.com/samanhappy",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center bg-[#13C3FF] text-white px-4 py-2 rounded-md hover:bg-[#00A5E5] transition-colors",children:i("sponsor.supportButton")})]})})]})})}):null},c1=({open:n,onOpenChange:l})=>{const{t:o}=ve();return n?r.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg max-w-md w-full",children:r.jsxs("div",{className:"p-6 relative",children:[r.jsx("button",{onClick:()=>l(!1),className:"absolute top-4 right-4 text-gray-400 hover:text-gray-500 dark:text-gray-500 dark:hover:text-gray-400","aria-label":o("common.close"),children:r.jsx(Vn,{className:"h-5 w-5"})}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-4",children:o("wechat.title")}),r.jsxs("div",{className:"flex flex-col items-center justify-center py-4",children:[r.jsx("img",{src:"./assets/wexin.png",alt:o("wechat.qrCodeAlt"),className:"max-w-full h-auto",style:{maxHeight:"400px"}}),r.jsx("p",{className:"mt-4 text-center text-gray-700 dark:text-gray-300",children:o("wechat.scanMessage")})]})]})})}):null},u1=n=>{const{t:l}=ve();return r.jsxs("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",...n,children:[r.jsx("title",{children:l("common.wechat")}),r.jsx("path",{d:"M8.691 2.188C3.891 2.188 0 5.476 0 9.53c0 2.212 1.17 4.203 3.002 5.55a.59.59 0 0 1 .213.665l-.39 1.48c-.019.07-.048.141-.048.213 0 .163.13.295.29.295a.326.326 0 0 0 .167-.054l1.903-1.114a.864.864 0 0 1 .717-.098 10.16 10.16 0 0 0 2.837.403c.276 0 .543-.027.811-.05-.857-2.578.157-4.972 1.932-6.446 1.703-1.415 3.882-1.98 5.853-1.838-.576-3.583-4.196-6.348-8.596-6.348zM5.785 5.991c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178A1.17 1.17 0 0 1 4.623 7.17c0-.651.52-1.18 1.162-1.18zm5.813 0c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178 1.17 1.17 0 0 1-1.162-1.178c0-.651.52-1.18 1.162-1.18zm5.34 2.867c-1.797-.052-3.746.512-5.28 1.786-1.72 1.428-2.687 3.72-1.78 6.22.942 2.453 3.666 4.229 6.884 4.229.826 0 1.622-.12 2.361-.336a.722.722 0 0 1 .598.082l1.584.926a.272.272 0 0 0 .14.047c.134 0 .24-.111.24-.247 0-.06-.023-.12-.038-.177l-.327-1.233a.582.582 0 0 1-.023-.156.49.49 0 0 1 .201-.398C23.024 18.48 24 16.82 24 14.98c0-3.21-2.931-5.837-6.656-6.088V8.89c-.135-.01-.27-.027-.407-.03zm-2.53 3.274c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983.976.976 0 0 1-.969-.983c0-.542.434-.982.97-.982zm4.844 0c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983.976.976 0 0 1-.969-.983c0-.542.434-.982.969-.982z"})]})},d1=n=>{const{t:l}=ve();return r.jsxs("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",...n,children:[r.jsx("title",{children:l("common.discord")}),r.jsx("path",{d:"M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z"})]})},f1=n=>{const{t:l}=ve();return r.jsxs("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",...n,children:[r.jsx("title",{children:l("sponsor.label")}),r.jsx("path",{d:"M17.625 1.499c-2.32 0-4.354 1.203-5.625 3.03-1.271-1.827-3.305-3.03-5.625-3.03C3.129 1.499 0 4.253 0 8.249c0 4.275 3.068 7.847 5.828 10.227a33.14 33.14 0 0 0 5.616 3.876l.028.017.008.003-.001.003c.163.085.342.126.521.125.179.001.358-.041.521-.125l-.001-.003.008-.003.028-.017a33.14 33.14 0 0 0 5.616-3.876C20.932 16.096 24 12.524 24 8.249c0-3.996-3.129-6.75-6.375-6.75zm-.919 15.275a30.766 30.766 0 0 1-4.703 3.316l-.004-.002-.004.002a30.955 30.955 0 0 1-4.703-3.316c-2.677-2.307-5.047-5.298-5.047-8.523 0-2.754 2.121-4.5 4.125-4.5 2.06 0 3.914 1.479 4.544 3.684.143.495.596.797 1.086.796.49.001.943-.302 1.085-.796.63-2.205 2.484-3.684 4.544-3.684 2.004 0 4.125 1.746 4.125 4.5 0 3.225-2.37 6.216-5.048 8.523z"})]})},m1=({collapsed:n,version:l})=>{var re;const{t:o,i18n:i}=ve(),u=Ka(),{auth:d,logout:m}=Br(),[p,g]=b.useState(!1),[h,y]=b.useState(!1),[N,C]=b.useState(!1),[E,S]=b.useState(!1),[k,T]=b.useState(!1),A=b.useRef(null);b.useEffect(()=>{(async()=>{try{const oe=await Wp();oe&&y(eg(l,oe)>0)}catch(oe){console.error("Error checking for new version:",oe)}})()},[l]),b.useEffect(()=>{const I=oe=>{A.current&&!A.current.contains(oe.target)&&g(!1)};return document.addEventListener("mousedown",I),()=>{document.removeEventListener("mousedown",I)}},[]);const j=()=>{u("/settings"),g(!1)},M=()=>{m(),u("/login")},$=()=>{C(!0),g(!1)},W=()=>{S(!0),g(!1)},ne=()=>{T(!0),g(!1)};return r.jsxs("div",{ref:A,className:"relative",children:[r.jsxs("button",{onClick:()=>g(!p),className:`flex ${n?"justify-center":"items-center"} w-full p-2 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors rounded-md ${p?"bg-gray-100 dark:bg-gray-700":""}`,children:[r.jsxs("div",{className:"flex-shrink-0 relative",children:[r.jsx("div",{className:"w-5 h-5 flex items-center justify-center rounded-full border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-700",children:r.jsx(dv,{className:"h-4 w-4 text-gray-700 dark:text-gray-300"})}),h&&r.jsx("span",{className:"absolute -top-1 -right-1 block w-2 h-2 bg-red-500 rounded-full"})]}),!n&&r.jsx("div",{className:"ml-3 flex flex-col items-start",children:r.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:((re=d.user)==null?void 0:re.username)||o("auth.user")})})]}),p&&r.jsxs("div",{className:"absolute top-0 transform -translate-y-full left-0 w-full min-w-max bg-white border border-gray-200 dark:bg-gray-800 z-50",children:[r.jsxs("button",{onClick:W,className:"flex items-center w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700",children:[r.jsx(f1,{className:"h-4 w-4 mr-2"}),o("sponsor.label")]}),i.language==="zh"?r.jsxs("button",{onClick:ne,className:"flex items-center w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700",children:[r.jsx(u1,{className:"h-4 w-4 mr-2"}),o("wechat.label")]}):r.jsxs("a",{href:"https://discord.gg/qMKNsn5Q",target:"_blank",rel:"noopener noreferrer",className:"flex items-center w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700",children:[r.jsx(d1,{className:"h-4 w-4 mr-2"}),o("discord.label")]}),r.jsxs("button",{onClick:j,className:"flex items-center w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700",children:[r.jsx(nv,{className:"h-4 w-4 mr-2"}),o("nav.settings")]}),r.jsxs("button",{onClick:$,className:"flex items-center w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 relative",children:[r.jsx(Ib,{className:"h-4 w-4 mr-2"}),o("about.title"),h&&r.jsx("span",{className:"absolute top-2 right-4 block w-2 h-2 bg-red-500 rounded-full"})]}),r.jsx("div",{className:"border-t border-gray-200 dark:border-gray-600"}),r.jsxs("button",{onClick:M,className:"flex items-center w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700",children:[r.jsx(Jb,{className:"h-4 w-4 mr-2"}),o("app.logout")]})]}),r.jsx(o1,{isOpen:N,onClose:()=>C(!1),version:l}),r.jsx(i1,{open:E,onOpenChange:S}),r.jsx(c1,{open:k,onOpenChange:T})]})},h1=({collapsed:n})=>{var d;const{t:l}=ve(),{auth:o}=Br(),i="0.9.11",u=[{path:"/",label:l("nav.dashboard"),icon:r.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[r.jsx("path",{d:"M2 10a8 8 0 018-8v8h8a8 8 0 11-16 0z"}),r.jsx("path",{d:"M12 2.252A8.014 8.014 0 0117.748 8H12V2.252z"})]})},{path:"/servers",label:l("nav.servers"),icon:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:r.jsx("path",{fillRule:"evenodd",d:"M2 5a2 2 0 012-2h12a2 2 0 012 2v2a2 2 0 01-2 2H4a2 2 0 01-2-2V5zm14 1a1 1 0 11-2 0 1 1 0 012 0zM2 13a2 2 0 012-2h12a2 2 0 012 2v2a2 2 0 01-2 2H4a2 2 0 01-2-2v-2zm14 1a1 1 0 11-2 0 1 1 0 012 0z",clipRule:"evenodd"})})},{path:"/groups",label:l("nav.groups"),icon:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:r.jsx("path",{d:"M13 6a3 3 0 11-6 0 3 3 0 016 0zM18 8a2 2 0 11-4 0 2 2 0 014 0zM14 15a4 4 0 00-8 0v3h8v-3zM6 8a2 2 0 11-4 0 2 2 0 014 0zM16 18v-3a5.972 5.972 0 00-.75-2.906A3.005 3.005 0 0119 15v3h-3zM4.75 12.094A5.973 5.973 0 004 15v3H1v-3a3 3 0 013.75-2.906z"})})},...(d=o.user)!=null&&d.isAdmin&&Jp("x")?[{path:"/users",label:l("nav.users"),icon:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:r.jsx("path",{d:"M9 6a3 3 0 11-6 0 3 3 0 016 0zM17 6a3 3 0 11-6 0 3 3 0 016 0zM12.93 17c.046-.327.07-.66.07-1a6.97 6.97 0 00-1.5-4.33A5 5 0 0119 16v1h-6.07zM6 11a5 5 0 015 5v1H1v-1a5 5 0 015-5z"})})}]:[],{path:"/market",label:l("nav.market"),icon:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:r.jsx("path",{d:"M3 1a1 1 0 000 2h1.22l.305 1.222a.997.997 0 00.01.042l1.358 5.43-.893.892C3.74 11.846 4.632 14 6.414 14H15a1 1 0 000-2H6.414l1-1H14a1 1 0 00.894-.553l3-6A1 1 0 0017 3H6.28l-.31-1.243A1 1 0 005 1H3zM16 16.5a1.5 1.5 0 11-3 0 1.5 1.5 0 013 0zM6.5 18a1.5 1.5 0 100-3 1.5 1.5 0 000 3z"})})},{path:"/logs",label:l("nav.logs"),icon:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:r.jsx("path",{fillRule:"evenodd",d:"M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4zm2 6a1 1 0 011-1h6a1 1 0 110 2H7a1 1 0 01-1-1zm1 3a1 1 0 100 2h6a1 1 0 100-2H7z",clipRule:"evenodd"})})}];return r.jsxs("aside",{className:`bg-white dark:bg-gray-800 shadow-sm transition-all duration-300 ease-in-out flex flex-col h-full relative ${n?"w-16":"w-64"}`,children:[r.jsx("div",{className:"overflow-y-auto flex-grow",children:r.jsx("nav",{className:"p-3 space-y-1",children:u.map(m=>r.jsxs(Np,{to:m.path,className:({isActive:p})=>`flex items-center px-2.5 py-2 rounded-lg transition-colors duration-200
|
|
190
|
+
*/const hv=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Vn=et("x",hv);function Lp(n){var l,o,i="";if(typeof n=="string"||typeof n=="number")i+=n;else if(typeof n=="object")if(Array.isArray(n)){var u=n.length;for(l=0;l<u;l++)n[l]&&(o=Lp(n[l]))&&(i&&(i+=" "),i+=o)}else for(o in n)n[o]&&(i&&(i+=" "),i+=o);return i}function pv(){for(var n,l,o=0,i="",u=arguments.length;o<u;o++)(n=arguments[o])&&(l=Lp(n))&&(i&&(i+=" "),i+=l);return i}const Cu="-",gv=n=>{const l=yv(n),{conflictingClassGroups:o,conflictingClassGroupModifiers:i}=n;return{getClassGroupId:m=>{const p=m.split(Cu);return p[0]===""&&p.length!==1&&p.shift(),_p(p,l)||xv(m)},getConflictingClassGroupIds:(m,p)=>{const g=o[m]||[];return p&&i[m]?[...g,...i[m]]:g}}},_p=(n,l)=>{var m;if(n.length===0)return l.classGroupId;const o=n[0],i=l.nextPart.get(o),u=i?_p(n.slice(1),i):void 0;if(u)return u;if(l.validators.length===0)return;const d=n.join(Cu);return(m=l.validators.find(({validator:p})=>p(d)))==null?void 0:m.classGroupId},Dh=/^\[(.+)\]$/,xv=n=>{if(Dh.test(n)){const l=Dh.exec(n)[1],o=l==null?void 0:l.substring(0,l.indexOf(":"));if(o)return"arbitrary.."+o}},yv=n=>{const{theme:l,classGroups:o}=n,i={nextPart:new Map,validators:[]};for(const u in o)nu(o[u],i,u,l);return i},nu=(n,l,o,i)=>{n.forEach(u=>{if(typeof u=="string"){const d=u===""?l:Uh(l,u);d.classGroupId=o;return}if(typeof u=="function"){if(bv(u)){nu(u(i),l,o,i);return}l.validators.push({validator:u,classGroupId:o});return}Object.entries(u).forEach(([d,m])=>{nu(m,Uh(l,d),o,i)})})},Uh=(n,l)=>{let o=n;return l.split(Cu).forEach(i=>{o.nextPart.has(i)||o.nextPart.set(i,{nextPart:new Map,validators:[]}),o=o.nextPart.get(i)}),o},bv=n=>n.isThemeGetter,vv=n=>{if(n<1)return{get:()=>{},set:()=>{}};let l=0,o=new Map,i=new Map;const u=(d,m)=>{o.set(d,m),l++,l>n&&(l=0,i=o,o=new Map)};return{get(d){let m=o.get(d);if(m!==void 0)return m;if((m=i.get(d))!==void 0)return u(d,m),m},set(d,m){o.has(d)?o.set(d,m):u(d,m)}}},lu="!",ou=":",wv=ou.length,jv=n=>{const{prefix:l,experimentalParseClassName:o}=n;let i=u=>{const d=[];let m=0,p=0,g=0,h;for(let S=0;S<u.length;S++){let k=u[S];if(m===0&&p===0){if(k===ou){d.push(u.slice(g,S)),g=S+wv;continue}if(k==="/"){h=S;continue}}k==="["?m++:k==="]"?m--:k==="("?p++:k===")"&&p--}const y=d.length===0?u:u.substring(g),N=Nv(y),C=N!==y,E=h&&h>g?h-g:void 0;return{modifiers:d,hasImportantModifier:C,baseClassName:N,maybePostfixModifierPosition:E}};if(l){const u=l+ou,d=i;i=m=>m.startsWith(u)?d(m.substring(u.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:m,maybePostfixModifierPosition:void 0}}if(o){const u=i;i=d=>o({className:d,parseClassName:u})}return i},Nv=n=>n.endsWith(lu)?n.substring(0,n.length-1):n.startsWith(lu)?n.substring(1):n,Sv=n=>{const l=Object.fromEntries(n.orderSensitiveModifiers.map(i=>[i,!0]));return i=>{if(i.length<=1)return i;const u=[];let d=[];return i.forEach(m=>{m[0]==="["||l[m]?(u.push(...d.sort(),m),d=[]):d.push(m)}),u.push(...d.sort()),u}},Cv=n=>({cache:vv(n.cacheSize),parseClassName:jv(n),sortModifiers:Sv(n),...gv(n)}),Ev=/\s+/,kv=(n,l)=>{const{parseClassName:o,getClassGroupId:i,getConflictingClassGroupIds:u,sortModifiers:d}=l,m=[],p=n.trim().split(Ev);let g="";for(let h=p.length-1;h>=0;h-=1){const y=p[h],{isExternal:N,modifiers:C,hasImportantModifier:E,baseClassName:S,maybePostfixModifierPosition:k}=o(y);if(N){g=y+(g.length>0?" "+g:g);continue}let T=!!k,A=i(T?S.substring(0,k):S);if(!A){if(!T){g=y+(g.length>0?" "+g:g);continue}if(A=i(S),!A){g=y+(g.length>0?" "+g:g);continue}T=!1}const j=d(C).join(":"),M=E?j+lu:j,$=M+A;if(m.includes($))continue;m.push($);const W=u(A,T);for(let ne=0;ne<W.length;++ne){const re=W[ne];m.push(M+re)}g=y+(g.length>0?" "+g:g)}return g};function Tv(){let n=0,l,o,i="";for(;n<arguments.length;)(l=arguments[n++])&&(o=Pp(l))&&(i&&(i+=" "),i+=o);return i}const Pp=n=>{if(typeof n=="string")return n;let l,o="";for(let i=0;i<n.length;i++)n[i]&&(l=Pp(n[i]))&&(o&&(o+=" "),o+=l);return o};function Av(n,...l){let o,i,u,d=m;function m(g){const h=l.reduce((y,N)=>N(y),n());return o=Cv(h),i=o.cache.get,u=o.cache.set,d=p,p(g)}function p(g){const h=i(g);if(h)return h;const y=kv(g,o);return u(g,y),y}return function(){return d(Tv.apply(null,arguments))}}const dt=n=>{const l=o=>o[n]||[];return l.isThemeGetter=!0,l},Hp=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Bp=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Rv=/^\d+\/\d+$/,Mv=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ov=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Dv=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Uv=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,zv=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ks=n=>Rv.test(n),Re=n=>!!n&&!Number.isNaN(Number(n)),gr=n=>!!n&&Number.isInteger(Number(n)),Xc=n=>n.endsWith("%")&&Re(n.slice(0,-1)),Ha=n=>Mv.test(n),Lv=()=>!0,_v=n=>Ov.test(n)&&!Dv.test(n),qp=()=>!1,Pv=n=>Uv.test(n),Hv=n=>zv.test(n),Bv=n=>!pe(n)&&!ge(n),qv=n=>zs(n,Kp,qp),pe=n=>Hp.test(n),_r=n=>zs(n,Fp,_v),Qc=n=>zs(n,$v,Re),zh=n=>zs(n,Vp,qp),Vv=n=>zs(n,Gp,Hv),uo=n=>zs(n,$p,Pv),ge=n=>Bp.test(n),_n=n=>Ls(n,Fp),Gv=n=>Ls(n,Iv),Lh=n=>Ls(n,Vp),Kv=n=>Ls(n,Kp),Fv=n=>Ls(n,Gp),fo=n=>Ls(n,$p,!0),zs=(n,l,o)=>{const i=Hp.exec(n);return i?i[1]?l(i[1]):o(i[2]):!1},Ls=(n,l,o=!1)=>{const i=Bp.exec(n);return i?i[1]?l(i[1]):o:!1},Vp=n=>n==="position"||n==="percentage",Gp=n=>n==="image"||n==="url",Kp=n=>n==="length"||n==="size"||n==="bg-size",Fp=n=>n==="length",$v=n=>n==="number",Iv=n=>n==="family-name",$p=n=>n==="shadow",Yv=()=>{const n=dt("color"),l=dt("font"),o=dt("text"),i=dt("font-weight"),u=dt("tracking"),d=dt("leading"),m=dt("breakpoint"),p=dt("container"),g=dt("spacing"),h=dt("radius"),y=dt("shadow"),N=dt("inset-shadow"),C=dt("text-shadow"),E=dt("drop-shadow"),S=dt("blur"),k=dt("perspective"),T=dt("aspect"),A=dt("ease"),j=dt("animate"),M=()=>["auto","avoid","all","avoid-page","page","left","right","column"],$=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],W=()=>[...$(),ge,pe],ne=()=>["auto","hidden","clip","visible","scroll"],re=()=>["auto","contain","none"],I=()=>[ge,pe,g],oe=()=>[ks,"full","auto",...I()],te=()=>[gr,"none","subgrid",ge,pe],U=()=>["auto",{span:["full",gr,ge,pe]},gr,ge,pe],D=()=>[gr,"auto",ge,pe],Q=()=>["auto","min","max","fr",ge,pe],P=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],V=()=>["start","end","center","stretch","center-safe","end-safe"],w=()=>["auto",...I()],z=()=>[ks,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],q=()=>[n,ge,pe],de=()=>[...$(),Lh,zh,{position:[ge,pe]}],R=()=>["no-repeat",{repeat:["","x","y","space","round"]}],J=()=>["auto","cover","contain",Kv,qv,{size:[ge,pe]}],ie=()=>[Xc,_n,_r],B=()=>["","none","full",h,ge,pe],_=()=>["",Re,_n,_r],ee=()=>["solid","dashed","dotted","double"],Y=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],F=()=>[Re,Xc,Lh,zh],ue=()=>["","none",S,ge,pe],xe=()=>["none",Re,ge,pe],Ne=()=>["none",Re,ge,pe],ye=()=>[Re,ge,pe],Te=()=>[ks,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ha],breakpoint:[Ha],color:[Lv],container:[Ha],"drop-shadow":[Ha],ease:["in","out","in-out"],font:[Bv],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ha],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ha],shadow:[Ha],spacing:["px",Re],text:[Ha],"text-shadow":[Ha],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ks,pe,ge,T]}],container:["container"],columns:[{columns:[Re,pe,ge,p]}],"break-after":[{"break-after":M()}],"break-before":[{"break-before":M()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:W()}],overflow:[{overflow:ne()}],"overflow-x":[{"overflow-x":ne()}],"overflow-y":[{"overflow-y":ne()}],overscroll:[{overscroll:re()}],"overscroll-x":[{"overscroll-x":re()}],"overscroll-y":[{"overscroll-y":re()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:oe()}],"inset-x":[{"inset-x":oe()}],"inset-y":[{"inset-y":oe()}],start:[{start:oe()}],end:[{end:oe()}],top:[{top:oe()}],right:[{right:oe()}],bottom:[{bottom:oe()}],left:[{left:oe()}],visibility:["visible","invisible","collapse"],z:[{z:[gr,"auto",ge,pe]}],basis:[{basis:[ks,"full","auto",p,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Re,ks,"auto","initial","none",pe]}],grow:[{grow:["",Re,ge,pe]}],shrink:[{shrink:["",Re,ge,pe]}],order:[{order:[gr,"first","last","none",ge,pe]}],"grid-cols":[{"grid-cols":te()}],"col-start-end":[{col:U()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":te()}],"row-start-end":[{row:U()}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Q()}],"auto-rows":[{"auto-rows":Q()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...P(),"normal"]}],"justify-items":[{"justify-items":[...V(),"normal"]}],"justify-self":[{"justify-self":["auto",...V()]}],"align-content":[{content:["normal",...P()]}],"align-items":[{items:[...V(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...V(),{baseline:["","last"]}]}],"place-content":[{"place-content":P()}],"place-items":[{"place-items":[...V(),"baseline"]}],"place-self":[{"place-self":["auto",...V()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:w()}],mx:[{mx:w()}],my:[{my:w()}],ms:[{ms:w()}],me:[{me:w()}],mt:[{mt:w()}],mr:[{mr:w()}],mb:[{mb:w()}],ml:[{ml:w()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:z()}],w:[{w:[p,"screen",...z()]}],"min-w":[{"min-w":[p,"screen","none",...z()]}],"max-w":[{"max-w":[p,"screen","none","prose",{screen:[m]},...z()]}],h:[{h:["screen","lh",...z()]}],"min-h":[{"min-h":["screen","lh","none",...z()]}],"max-h":[{"max-h":["screen","lh",...z()]}],"font-size":[{text:["base",o,_n,_r]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,ge,Qc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Xc,pe]}],"font-family":[{font:[Gv,pe,l]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[u,ge,pe]}],"line-clamp":[{"line-clamp":[Re,"none",ge,Qc]}],leading:[{leading:[d,...I()]}],"list-image":[{"list-image":["none",ge,pe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ge,pe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:q()}],"text-color":[{text:q()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ee(),"wavy"]}],"text-decoration-thickness":[{decoration:[Re,"from-font","auto",ge,_r]}],"text-decoration-color":[{decoration:q()}],"underline-offset":[{"underline-offset":[Re,"auto",ge,pe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ge,pe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ge,pe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:de()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:J()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},gr,ge,pe],radial:["",ge,pe],conic:[gr,ge,pe]},Fv,Vv]}],"bg-color":[{bg:q()}],"gradient-from-pos":[{from:ie()}],"gradient-via-pos":[{via:ie()}],"gradient-to-pos":[{to:ie()}],"gradient-from":[{from:q()}],"gradient-via":[{via:q()}],"gradient-to":[{to:q()}],rounded:[{rounded:B()}],"rounded-s":[{"rounded-s":B()}],"rounded-e":[{"rounded-e":B()}],"rounded-t":[{"rounded-t":B()}],"rounded-r":[{"rounded-r":B()}],"rounded-b":[{"rounded-b":B()}],"rounded-l":[{"rounded-l":B()}],"rounded-ss":[{"rounded-ss":B()}],"rounded-se":[{"rounded-se":B()}],"rounded-ee":[{"rounded-ee":B()}],"rounded-es":[{"rounded-es":B()}],"rounded-tl":[{"rounded-tl":B()}],"rounded-tr":[{"rounded-tr":B()}],"rounded-br":[{"rounded-br":B()}],"rounded-bl":[{"rounded-bl":B()}],"border-w":[{border:_()}],"border-w-x":[{"border-x":_()}],"border-w-y":[{"border-y":_()}],"border-w-s":[{"border-s":_()}],"border-w-e":[{"border-e":_()}],"border-w-t":[{"border-t":_()}],"border-w-r":[{"border-r":_()}],"border-w-b":[{"border-b":_()}],"border-w-l":[{"border-l":_()}],"divide-x":[{"divide-x":_()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":_()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ee(),"hidden","none"]}],"divide-style":[{divide:[...ee(),"hidden","none"]}],"border-color":[{border:q()}],"border-color-x":[{"border-x":q()}],"border-color-y":[{"border-y":q()}],"border-color-s":[{"border-s":q()}],"border-color-e":[{"border-e":q()}],"border-color-t":[{"border-t":q()}],"border-color-r":[{"border-r":q()}],"border-color-b":[{"border-b":q()}],"border-color-l":[{"border-l":q()}],"divide-color":[{divide:q()}],"outline-style":[{outline:[...ee(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Re,ge,pe]}],"outline-w":[{outline:["",Re,_n,_r]}],"outline-color":[{outline:q()}],shadow:[{shadow:["","none",y,fo,uo]}],"shadow-color":[{shadow:q()}],"inset-shadow":[{"inset-shadow":["none",N,fo,uo]}],"inset-shadow-color":[{"inset-shadow":q()}],"ring-w":[{ring:_()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:q()}],"ring-offset-w":[{"ring-offset":[Re,_r]}],"ring-offset-color":[{"ring-offset":q()}],"inset-ring-w":[{"inset-ring":_()}],"inset-ring-color":[{"inset-ring":q()}],"text-shadow":[{"text-shadow":["none",C,fo,uo]}],"text-shadow-color":[{"text-shadow":q()}],opacity:[{opacity:[Re,ge,pe]}],"mix-blend":[{"mix-blend":[...Y(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Y()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Re]}],"mask-image-linear-from-pos":[{"mask-linear-from":F()}],"mask-image-linear-to-pos":[{"mask-linear-to":F()}],"mask-image-linear-from-color":[{"mask-linear-from":q()}],"mask-image-linear-to-color":[{"mask-linear-to":q()}],"mask-image-t-from-pos":[{"mask-t-from":F()}],"mask-image-t-to-pos":[{"mask-t-to":F()}],"mask-image-t-from-color":[{"mask-t-from":q()}],"mask-image-t-to-color":[{"mask-t-to":q()}],"mask-image-r-from-pos":[{"mask-r-from":F()}],"mask-image-r-to-pos":[{"mask-r-to":F()}],"mask-image-r-from-color":[{"mask-r-from":q()}],"mask-image-r-to-color":[{"mask-r-to":q()}],"mask-image-b-from-pos":[{"mask-b-from":F()}],"mask-image-b-to-pos":[{"mask-b-to":F()}],"mask-image-b-from-color":[{"mask-b-from":q()}],"mask-image-b-to-color":[{"mask-b-to":q()}],"mask-image-l-from-pos":[{"mask-l-from":F()}],"mask-image-l-to-pos":[{"mask-l-to":F()}],"mask-image-l-from-color":[{"mask-l-from":q()}],"mask-image-l-to-color":[{"mask-l-to":q()}],"mask-image-x-from-pos":[{"mask-x-from":F()}],"mask-image-x-to-pos":[{"mask-x-to":F()}],"mask-image-x-from-color":[{"mask-x-from":q()}],"mask-image-x-to-color":[{"mask-x-to":q()}],"mask-image-y-from-pos":[{"mask-y-from":F()}],"mask-image-y-to-pos":[{"mask-y-to":F()}],"mask-image-y-from-color":[{"mask-y-from":q()}],"mask-image-y-to-color":[{"mask-y-to":q()}],"mask-image-radial":[{"mask-radial":[ge,pe]}],"mask-image-radial-from-pos":[{"mask-radial-from":F()}],"mask-image-radial-to-pos":[{"mask-radial-to":F()}],"mask-image-radial-from-color":[{"mask-radial-from":q()}],"mask-image-radial-to-color":[{"mask-radial-to":q()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":$()}],"mask-image-conic-pos":[{"mask-conic":[Re]}],"mask-image-conic-from-pos":[{"mask-conic-from":F()}],"mask-image-conic-to-pos":[{"mask-conic-to":F()}],"mask-image-conic-from-color":[{"mask-conic-from":q()}],"mask-image-conic-to-color":[{"mask-conic-to":q()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:de()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:J()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ge,pe]}],filter:[{filter:["","none",ge,pe]}],blur:[{blur:ue()}],brightness:[{brightness:[Re,ge,pe]}],contrast:[{contrast:[Re,ge,pe]}],"drop-shadow":[{"drop-shadow":["","none",E,fo,uo]}],"drop-shadow-color":[{"drop-shadow":q()}],grayscale:[{grayscale:["",Re,ge,pe]}],"hue-rotate":[{"hue-rotate":[Re,ge,pe]}],invert:[{invert:["",Re,ge,pe]}],saturate:[{saturate:[Re,ge,pe]}],sepia:[{sepia:["",Re,ge,pe]}],"backdrop-filter":[{"backdrop-filter":["","none",ge,pe]}],"backdrop-blur":[{"backdrop-blur":ue()}],"backdrop-brightness":[{"backdrop-brightness":[Re,ge,pe]}],"backdrop-contrast":[{"backdrop-contrast":[Re,ge,pe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Re,ge,pe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Re,ge,pe]}],"backdrop-invert":[{"backdrop-invert":["",Re,ge,pe]}],"backdrop-opacity":[{"backdrop-opacity":[Re,ge,pe]}],"backdrop-saturate":[{"backdrop-saturate":[Re,ge,pe]}],"backdrop-sepia":[{"backdrop-sepia":["",Re,ge,pe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ge,pe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Re,"initial",ge,pe]}],ease:[{ease:["linear","initial",A,ge,pe]}],delay:[{delay:[Re,ge,pe]}],animate:[{animate:["none",j,ge,pe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,ge,pe]}],"perspective-origin":[{"perspective-origin":W()}],rotate:[{rotate:xe()}],"rotate-x":[{"rotate-x":xe()}],"rotate-y":[{"rotate-y":xe()}],"rotate-z":[{"rotate-z":xe()}],scale:[{scale:Ne()}],"scale-x":[{"scale-x":Ne()}],"scale-y":[{"scale-y":Ne()}],"scale-z":[{"scale-z":Ne()}],"scale-3d":["scale-3d"],skew:[{skew:ye()}],"skew-x":[{"skew-x":ye()}],"skew-y":[{"skew-y":ye()}],transform:[{transform:[ge,pe,"","none","gpu","cpu"]}],"transform-origin":[{origin:W()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Te()}],"translate-x":[{"translate-x":Te()}],"translate-y":[{"translate-y":Te()}],"translate-z":[{"translate-z":Te()}],"translate-none":["translate-none"],accent:[{accent:q()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:q()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ge,pe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ge,pe]}],fill:[{fill:["none",...q()]}],"stroke-w":[{stroke:[Re,_n,_r,Qc]}],stroke:[{stroke:["none",...q()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Xv=Av(Yv);function qa(...n){return Xv(pv(n))}const Qv=({message:n,type:l="info",duration:o=3e3,onClose:i,visible:u})=>{const{t:d}=ve();b.useEffect(()=>{if(u){const h=setTimeout(()=>{i()},o);return()=>clearTimeout(h)}},[u,o,i]);const m={success:r.jsx(Yn,{className:"w-5 h-5 text-green-500"}),error:r.jsx(Vn,{className:"w-5 h-5 text-red-500"}),info:r.jsx("svg",{className:"w-5 h-5 text-blue-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),warning:r.jsx("svg",{className:"w-5 h-5 text-yellow-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})},p={success:"bg-green-50 border-green-200",error:"bg-red-50 border-red-200",info:"bg-blue-50 border-blue-200",warning:"bg-yellow-50 border-yellow-200"},g={success:"text-green-800",error:"text-red-800",info:"text-blue-800",warning:"text-yellow-800"};return r.jsx("div",{className:qa("fixed top-4 right-4 z-50 max-w-sm p-4 rounded-md shadow-lg border",p[l],"transform transition-all duration-300 ease-in-out",u?"translate-x-0 opacity-100":"translate-x-full opacity-0"),children:r.jsxs("div",{className:"flex items-start",children:[r.jsx("div",{className:"flex-shrink-0",children:m[l]}),r.jsx("div",{className:"ml-3",children:r.jsx("p",{className:qa("text-sm font-medium",g[l]),children:n})}),r.jsx("div",{className:"ml-auto pl-3",children:r.jsx("div",{className:"-mx-1.5 -my-1.5",children:r.jsxs("button",{onClick:i,className:qa("inline-flex rounded-md p-1.5",`hover:bg-${l}-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-${l}-500`),children:[r.jsx("span",{className:"sr-only",children:d("common.dismiss")}),r.jsx(Vn,{className:"h-5 w-5"})]})})})]})})},Ip=b.createContext(void 0),Xn=()=>{const n=b.useContext(Ip);if(!n)throw new Error("useToast must be used within a ToastProvider");return n},Zv=({children:n})=>{const[l,o]=b.useState({message:"",type:"info",visible:!1,duration:3e3}),i=b.useCallback((d,m="info",p=3e3)=>{o({message:d,type:m,visible:!0,duration:p})},[]),u=b.useCallback(()=>{o(d=>({...d,visible:!1}))},[]);return r.jsxs(Ip.Provider,{value:{showToast:i},children:[n,r.jsx(Qv,{message:l.message,type:l.type,duration:l.duration,onClose:u,visible:l.visible})]})},Yp=b.createContext(void 0),Jv=()=>{const n=b.useContext(Yp);if(!n)throw new Error("useTheme must be used within a ThemeProvider");return n},Wv=({children:n})=>{const[l,o]=b.useState(()=>localStorage.getItem("theme")||"system"),[i,u]=b.useState("light"),d=m=>{o(m),localStorage.setItem("theme",m)};return b.useEffect(()=>{const m=()=>{const g=window.document.documentElement,h=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",y=l==="system"?h:l;u(y),y==="dark"?(console.log("Applying dark mode to HTML root element"),g.classList.add("dark"),document.body.style.backgroundColor="#111827"):(console.log("Removing dark mode from HTML root element"),g.classList.remove("dark"),document.body.style.backgroundColor="")},p=window.matchMedia("(prefers-color-scheme: dark)");return p.addEventListener("change",m),m(),()=>{p.removeEventListener("change",m)}},[l]),r.jsx(Yp.Provider,{value:{theme:l,setTheme:d,resolvedTheme:i},children:n})},mo={startup:{maxAttempts:60,pollingInterval:3e3},normal:{pollingInterval:1e4}},Xp=b.createContext(void 0),e1=({children:n})=>{const{t:l}=ve(),{auth:o}=Br(),[i,u]=b.useState([]),[d,m]=b.useState(null),[p,g]=b.useState(0),[h,y]=b.useState(!0),[N,C]=b.useState(0),E=b.useRef(null),S=b.useRef(0),k=b.useRef(0),T=3e3,A=()=>{E.current&&(clearInterval(E.current),E.current=null)},j=b.useCallback(te=>{const U=(te==null?void 0:te.immediate)??!0;A();const D=async()=>{try{console.log("[ServerContext] Fetching servers from API...");const Q=await Ye("/servers");k.current=Date.now(),Q&&Q.success&&Array.isArray(Q.data)?u(Q.data):Q&&Array.isArray(Q)?u(Q):(console.error("Invalid server data format:",Q),u([])),m(null)}catch(Q){console.error("Error fetching servers during normal polling:",Q),navigator.onLine?Q instanceof TypeError&&(Q.message.includes("NetworkError")||Q.message.includes("Failed to fetch"))?m(l("errors.serverConnection")):m(l("errors.serverFetch")):m(l("errors.network"))}};U&&D(),E.current=setInterval(D,mo.normal.pollingInterval)},[l]);b.useEffect(()=>{o.isAuthenticated?(console.log("[ServerContext] User authenticated, triggering refresh"),g(te=>te+1)):(console.log("[ServerContext] User not authenticated, clearing data and stopping polling"),A(),u([]),y(!1),m(null))},[o.isAuthenticated]),b.useEffect(()=>{if(!o.isAuthenticated){console.log("[ServerContext] User not authenticated, skipping polling setup");return}p>0&&(S.current=0,C(0));const te=async()=>{try{console.log("[ServerContext] Initial fetch - attempt",S.current+1);const U=await Ye("/servers");return k.current=Date.now(),U&&U.success&&Array.isArray(U.data)?(u(U.data),y(!1),j({immediate:!1}),!0):U&&Array.isArray(U)?(u(U),y(!1),j({immediate:!1}),!0):(console.error("Invalid server data format:",U),u([]),y(!1),j({immediate:!1}),!0)}catch(U){return S.current+=1,console.error(`Initial loading attempt ${S.current} failed:`,U),C(S.current),navigator.onLine?m(l("errors.initialStartup")):m(l("errors.network")),S.current>=mo.startup.maxAttempts&&(console.log("Maximum startup attempts reached, switching to normal polling"),y(!1),A(),j()),!1}};return h?(A(),te(),E.current=setInterval(te,mo.startup.pollingInterval),console.log(`Started initial polling with interval: ${mo.startup.pollingInterval}ms`)):j(),()=>{A()}},[p,l,h,j]);const M=b.useCallback(()=>{A(),h&&(y(!0),S.current=0,C(0)),g(te=>te+1)},[h]),$=b.useCallback(()=>{const U=Date.now()-k.current;console.log("[ServerContext] refreshIfNeeded called, time since last fetch:",U,"ms"),U>=T?(console.log("[ServerContext] Triggering refresh (exceeded MIN_REFRESH_INTERVAL:",T,"ms)"),M()):console.log("[ServerContext] Skipping refresh (MIN_REFRESH_INTERVAL:",T,"ms, time since last:",U,"ms)")},[M]),W=b.useCallback(()=>{g(te=>te+1)},[]),ne=b.useCallback(async te=>{try{const U=await Ye("/settings");if(U&&U.success&&U.data&&U.data.mcpServers&&U.data.mcpServers[te.name]){const D=U.data.mcpServers[te.name];return{name:te.name,status:te.status,tools:te.tools||[],config:D}}else return console.error("Failed to get server config from settings:",U),m(l("server.invalidConfig",{serverName:te.name})),null}catch(U){return console.error("Error fetching server settings:",U),m(U instanceof Error?U.message:String(U)),null}},[l]),re=b.useCallback(async te=>{try{const U=await qn(`/servers/${te}`);return!U||!U.success?(m((U==null?void 0:U.message)||l("server.deleteError",{serverName:te})),!1):(g(D=>D+1),!0)}catch(U){return m(l("errors.general")+": "+(U instanceof Error?U.message:String(U))),!1}},[l]),I=b.useCallback(async(te,U)=>{try{const D=await St(`/servers/${te.name}/toggle`,{enabled:U});return!D||!D.success?(console.error("Failed to toggle server:",D),m((D==null?void 0:D.message)||l("server.toggleError",{serverName:te.name})),!1):(g(Q=>Q+1),!0)}catch(D){return console.error("Error toggling server:",D),m(D instanceof Error?D.message:String(D)),!1}},[l]),oe={servers:i,error:d,setError:m,isLoading:h,fetchAttempts:N,triggerRefresh:M,refreshIfNeeded:$,handleServerAdd:W,handleServerEdit:ne,handleServerRemove:re,handleServerToggle:I};return r.jsx(Xp.Provider,{value:oe,children:n})},t1=()=>{const n=b.useContext(Xp);if(n===void 0)throw new Error("useServerContext must be used within a ServerProvider");return n},Qp=()=>{const{t:n}=ve(),{theme:l,setTheme:o}=Jv(),i=()=>{o(l==="light"?"dark":"light")};return r.jsx("button",{onClick:i,className:"p-2 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 focus:outline-none",title:n(l==="light"?"theme.dark":"theme.light"),"aria-label":n(l==="light"?"theme.dark":"theme.light"),children:l==="light"?r.jsx(ev,{className:"h-5 w-5"}):r.jsx(iv,{className:"h-5 w-5"})})},a1=n=>{const{t:l}=ve();return r.jsxs("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",stroke:"currentColor",strokeWidth:2,...n,children:[r.jsx("title",{children:l("common.language")}),r.jsx("circle",{cx:"12",cy:"12",r:"10"}),r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2 12h20"}),r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z"})]})},Zp=()=>{const{i18n:n}=ve(),[l,o]=b.useState(!1),[i,u]=b.useState(n.language),d=[{code:"en",label:"English"},{code:"zh",label:"中文"},{code:"fr",label:"Français"}];b.useEffect(()=>{u(n.language)},[n.language]),b.useEffect(()=>{const g=h=>{h.target.closest(".language-dropdown")||o(!1)};return l&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g)}},[l]);const m=g=>{localStorage.setItem("i18nextLng",g),o(!1),window.location.reload()},p=()=>{o(!l)};return r.jsxs("div",{className:"relative language-dropdown",children:[r.jsx("button",{onClick:p,className:"p-2 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 focus:outline-none","aria-label":"Language Switcher",children:r.jsx(a1,{className:"h-5 w-5"})}),l&&r.jsx("div",{className:"absolute right-0 mt-2 w-24 bg-white dark:bg-gray-800 rounded-md shadow-lg border border-gray-200 dark:border-gray-700 z-50",children:r.jsx("div",{children:d.map(g=>r.jsx("button",{onClick:()=>m(g.code),className:`flex items-center w-full px-4 py-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-700 ${i.startsWith(g.code)?"bg-blue-50 text-blue-700":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-100"}`,children:g.label},g.code))})})]})},r1=n=>{const{t:l}=ve();return r.jsxs("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",...n,children:[r.jsx("title",{children:l("common.github")}),r.jsx("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})]})},s1=({onToggleSidebar:n})=>{const{t:l}=ve();return r.jsx("header",{className:"bg-white dark:bg-gray-800 shadow-sm z-10",children:r.jsxs("div",{className:"flex justify-between items-center px-3 py-3",children:[r.jsxs("div",{className:"flex items-center",children:[r.jsx("button",{onClick:n,className:"p-2 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 focus:outline-none","aria-label":l("app.toggleSidebar"),children:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),r.jsx("h1",{className:"ml-4 text-xl font-bold text-gray-900 dark:text-white",children:l("app.title")})]}),r.jsxs("div",{className:"flex items-center space-x-1",children:[r.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400 mr-2",children:"v0.9.12"}),r.jsx("a",{href:"https://github.com/samanhappy/mcphub",target:"_blank",rel:"noopener noreferrer",className:"p-2 rounded-md text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700","aria-label":"GitHub Repository",children:r.jsx(r1,{className:"h-5 w-5"})}),r.jsx(Qp,{}),r.jsx(Zp,{})]})]})})},ho=({permissions:n,fallback:l=null,children:o})=>Jp(n)?r.jsx(r.Fragment,{children:o}):r.jsx(r.Fragment,{children:l}),Jp=n=>{const{auth:l}=Br();if(!l.isAuthenticated||!l.user)return!1;const o=l.user.permissions||[];return n==="x"&&!o.includes("x")?!1:o.includes("*")||l.user.isAdmin?!0:(Array.isArray(n)?n:[n]).some(u=>o.includes(u))},n1="https://registry.npmjs.org",l1="@samanhappy/mcphub",Wp=async()=>{try{const n=await fetch(`${n1}/${l1}/latest`);if(!n.ok)throw new Error(`Failed to fetch latest version: ${n.status}`);return(await n.json()).version||null}catch(n){return console.error("Error checking for latest version:",n),null}},eg=(n,l)=>{if(n==="dev")return-1;const o=n.split(".").map(Number),i=l.split(".").map(Number);for(let u=0;u<3;u++){const d=o[u]||0,m=i[u]||0;if(d>m)return-1;if(d<m)return 1}return 0},o1=({isOpen:n,onClose:l,version:o})=>{const{t:i}=ve(),[u,d]=b.useState(!1),[m,p]=b.useState(""),[g,h]=b.useState(!1),y=async()=>{h(!0);try{const N=await Wp();N&&(p(N),d(eg(o,N)>0))}catch(N){console.error("Failed to check for updates:",N)}finally{h(!1)}};return b.useEffect(()=>{n&&y()},[n,o]),n?r.jsx("div",{className:"fixed inset-0 bg-black/50 bg-opacity-30 z-50 flex items-center justify-center p-4",children:r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg max-w-md w-full",children:r.jsxs("div",{className:"p-6 relative",children:[r.jsx("button",{onClick:l,className:"absolute top-4 right-4 text-gray-400 hover:text-gray-500 dark:text-gray-500 dark:hover:text-gray-400","aria-label":i("common.close"),children:r.jsx(Vn,{className:"h-5 w-5"})}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-4",children:i("about.title")}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"text-gray-700 dark:text-gray-300",children:[i("about.currentVersion"),":"]}),r.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-100",children:o})]}),u&&m&&r.jsx("div",{className:"bg-blue-50 dark:bg-blue-900 p-3 rounded",children:r.jsxs("div",{className:"flex items-start",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),r.jsxs("div",{className:"ml-3 flex-1 text-sm text-blue-700 dark:text-blue-300",children:[r.jsx("p",{children:i("about.newVersionAvailable",{version:m})}),r.jsx("p",{className:"mt-1",children:r.jsx("a",{href:"https://github.com/samanhappy/mcphub",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 dark:text-blue-400 hover:underline",children:i("about.viewOnGitHub")})})]})]})}),r.jsxs("button",{onClick:y,disabled:g,className:`mt-4 inline-flex items-center px-4 py-2 border border-gray-200 dark:border-gray-600 rounded-md shadow-sm text-sm font-medium btn-secondary
|
|
191
|
+
${g?"text-gray-400 dark:text-gray-500 bg-gray-100 dark:bg-gray-800":"text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600"} focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500`,children:[r.jsx(rv,{className:`h-4 w-4 mr-2 ${g?"animate-spin":""}`}),i(g?"about.checking":"about.checkForUpdates")]})]})]})})}):null},i1=({open:n,onOpenChange:l})=>{const{i18n:o,t:i}=ve();return n?r.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg max-w-md w-full",children:r.jsxs("div",{className:"p-6 relative",children:[r.jsx("button",{onClick:()=>l(!1),className:"absolute top-4 right-4 text-gray-400 hover:text-gray-500 dark:text-gray-500 dark:hover:text-gray-400","aria-label":i("common.close"),children:r.jsx(Vn,{className:"h-5 w-5"})}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-4",children:i("sponsor.title")}),r.jsx("div",{className:"flex flex-col items-center justify-center py-4",children:o.language==="zh"?r.jsx("img",{src:"./assets/reward.png",alt:i("sponsor.rewardAlt"),className:"max-w-full h-auto",style:{maxHeight:"400px"}}):r.jsxs("div",{className:"text-center",children:[r.jsx("p",{className:"mb-4 text-gray-700 dark:text-gray-300",children:i("sponsor.supportMessage")}),r.jsx("a",{href:"https://ko-fi.com/samanhappy",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center bg-[#13C3FF] text-white px-4 py-2 rounded-md hover:bg-[#00A5E5] transition-colors",children:i("sponsor.supportButton")})]})})]})})}):null},c1=({open:n,onOpenChange:l})=>{const{t:o}=ve();return n?r.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:r.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-lg max-w-md w-full",children:r.jsxs("div",{className:"p-6 relative",children:[r.jsx("button",{onClick:()=>l(!1),className:"absolute top-4 right-4 text-gray-400 hover:text-gray-500 dark:text-gray-500 dark:hover:text-gray-400","aria-label":o("common.close"),children:r.jsx(Vn,{className:"h-5 w-5"})}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-100 mb-4",children:o("wechat.title")}),r.jsxs("div",{className:"flex flex-col items-center justify-center py-4",children:[r.jsx("img",{src:"./assets/wexin.png",alt:o("wechat.qrCodeAlt"),className:"max-w-full h-auto",style:{maxHeight:"400px"}}),r.jsx("p",{className:"mt-4 text-center text-gray-700 dark:text-gray-300",children:o("wechat.scanMessage")})]})]})})}):null},u1=n=>{const{t:l}=ve();return r.jsxs("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",...n,children:[r.jsx("title",{children:l("common.wechat")}),r.jsx("path",{d:"M8.691 2.188C3.891 2.188 0 5.476 0 9.53c0 2.212 1.17 4.203 3.002 5.55a.59.59 0 0 1 .213.665l-.39 1.48c-.019.07-.048.141-.048.213 0 .163.13.295.29.295a.326.326 0 0 0 .167-.054l1.903-1.114a.864.864 0 0 1 .717-.098 10.16 10.16 0 0 0 2.837.403c.276 0 .543-.027.811-.05-.857-2.578.157-4.972 1.932-6.446 1.703-1.415 3.882-1.98 5.853-1.838-.576-3.583-4.196-6.348-8.596-6.348zM5.785 5.991c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178A1.17 1.17 0 0 1 4.623 7.17c0-.651.52-1.18 1.162-1.18zm5.813 0c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178 1.17 1.17 0 0 1-1.162-1.178c0-.651.52-1.18 1.162-1.18zm5.34 2.867c-1.797-.052-3.746.512-5.28 1.786-1.72 1.428-2.687 3.72-1.78 6.22.942 2.453 3.666 4.229 6.884 4.229.826 0 1.622-.12 2.361-.336a.722.722 0 0 1 .598.082l1.584.926a.272.272 0 0 0 .14.047c.134 0 .24-.111.24-.247 0-.06-.023-.12-.038-.177l-.327-1.233a.582.582 0 0 1-.023-.156.49.49 0 0 1 .201-.398C23.024 18.48 24 16.82 24 14.98c0-3.21-2.931-5.837-6.656-6.088V8.89c-.135-.01-.27-.027-.407-.03zm-2.53 3.274c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983.976.976 0 0 1-.969-.983c0-.542.434-.982.97-.982zm4.844 0c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983.976.976 0 0 1-.969-.983c0-.542.434-.982.969-.982z"})]})},d1=n=>{const{t:l}=ve();return r.jsxs("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",...n,children:[r.jsx("title",{children:l("common.discord")}),r.jsx("path",{d:"M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z"})]})},f1=n=>{const{t:l}=ve();return r.jsxs("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",...n,children:[r.jsx("title",{children:l("sponsor.label")}),r.jsx("path",{d:"M17.625 1.499c-2.32 0-4.354 1.203-5.625 3.03-1.271-1.827-3.305-3.03-5.625-3.03C3.129 1.499 0 4.253 0 8.249c0 4.275 3.068 7.847 5.828 10.227a33.14 33.14 0 0 0 5.616 3.876l.028.017.008.003-.001.003c.163.085.342.126.521.125.179.001.358-.041.521-.125l-.001-.003.008-.003.028-.017a33.14 33.14 0 0 0 5.616-3.876C20.932 16.096 24 12.524 24 8.249c0-3.996-3.129-6.75-6.375-6.75zm-.919 15.275a30.766 30.766 0 0 1-4.703 3.316l-.004-.002-.004.002a30.955 30.955 0 0 1-4.703-3.316c-2.677-2.307-5.047-5.298-5.047-8.523 0-2.754 2.121-4.5 4.125-4.5 2.06 0 3.914 1.479 4.544 3.684.143.495.596.797 1.086.796.49.001.943-.302 1.085-.796.63-2.205 2.484-3.684 4.544-3.684 2.004 0 4.125 1.746 4.125 4.5 0 3.225-2.37 6.216-5.048 8.523z"})]})},m1=({collapsed:n,version:l})=>{var re;const{t:o,i18n:i}=ve(),u=Ka(),{auth:d,logout:m}=Br(),[p,g]=b.useState(!1),[h,y]=b.useState(!1),[N,C]=b.useState(!1),[E,S]=b.useState(!1),[k,T]=b.useState(!1),A=b.useRef(null);b.useEffect(()=>{(async()=>{try{const oe=await Wp();oe&&y(eg(l,oe)>0)}catch(oe){console.error("Error checking for new version:",oe)}})()},[l]),b.useEffect(()=>{const I=oe=>{A.current&&!A.current.contains(oe.target)&&g(!1)};return document.addEventListener("mousedown",I),()=>{document.removeEventListener("mousedown",I)}},[]);const j=()=>{u("/settings"),g(!1)},M=()=>{m(),u("/login")},$=()=>{C(!0),g(!1)},W=()=>{S(!0),g(!1)},ne=()=>{T(!0),g(!1)};return r.jsxs("div",{ref:A,className:"relative",children:[r.jsxs("button",{onClick:()=>g(!p),className:`flex ${n?"justify-center":"items-center"} w-full p-2 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors rounded-md ${p?"bg-gray-100 dark:bg-gray-700":""}`,children:[r.jsxs("div",{className:"flex-shrink-0 relative",children:[r.jsx("div",{className:"w-5 h-5 flex items-center justify-center rounded-full border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-700",children:r.jsx(dv,{className:"h-4 w-4 text-gray-700 dark:text-gray-300"})}),h&&r.jsx("span",{className:"absolute -top-1 -right-1 block w-2 h-2 bg-red-500 rounded-full"})]}),!n&&r.jsx("div",{className:"ml-3 flex flex-col items-start",children:r.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:((re=d.user)==null?void 0:re.username)||o("auth.user")})})]}),p&&r.jsxs("div",{className:"absolute top-0 transform -translate-y-full left-0 w-full min-w-max bg-white border border-gray-200 dark:bg-gray-800 z-50",children:[r.jsxs("button",{onClick:W,className:"flex items-center w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700",children:[r.jsx(f1,{className:"h-4 w-4 mr-2"}),o("sponsor.label")]}),i.language==="zh"?r.jsxs("button",{onClick:ne,className:"flex items-center w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700",children:[r.jsx(u1,{className:"h-4 w-4 mr-2"}),o("wechat.label")]}):r.jsxs("a",{href:"https://discord.gg/qMKNsn5Q",target:"_blank",rel:"noopener noreferrer",className:"flex items-center w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700",children:[r.jsx(d1,{className:"h-4 w-4 mr-2"}),o("discord.label")]}),r.jsxs("button",{onClick:j,className:"flex items-center w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700",children:[r.jsx(nv,{className:"h-4 w-4 mr-2"}),o("nav.settings")]}),r.jsxs("button",{onClick:$,className:"flex items-center w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 relative",children:[r.jsx(Ib,{className:"h-4 w-4 mr-2"}),o("about.title"),h&&r.jsx("span",{className:"absolute top-2 right-4 block w-2 h-2 bg-red-500 rounded-full"})]}),r.jsx("div",{className:"border-t border-gray-200 dark:border-gray-600"}),r.jsxs("button",{onClick:M,className:"flex items-center w-full px-4 py-2 text-left text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700",children:[r.jsx(Jb,{className:"h-4 w-4 mr-2"}),o("app.logout")]})]}),r.jsx(o1,{isOpen:N,onClose:()=>C(!1),version:l}),r.jsx(i1,{open:E,onOpenChange:S}),r.jsx(c1,{open:k,onOpenChange:T})]})},h1=({collapsed:n})=>{var d;const{t:l}=ve(),{auth:o}=Br(),i="0.9.12",u=[{path:"/",label:l("nav.dashboard"),icon:r.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:[r.jsx("path",{d:"M2 10a8 8 0 018-8v8h8a8 8 0 11-16 0z"}),r.jsx("path",{d:"M12 2.252A8.014 8.014 0 0117.748 8H12V2.252z"})]})},{path:"/servers",label:l("nav.servers"),icon:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:r.jsx("path",{fillRule:"evenodd",d:"M2 5a2 2 0 012-2h12a2 2 0 012 2v2a2 2 0 01-2 2H4a2 2 0 01-2-2V5zm14 1a1 1 0 11-2 0 1 1 0 012 0zM2 13a2 2 0 012-2h12a2 2 0 012 2v2a2 2 0 01-2 2H4a2 2 0 01-2-2v-2zm14 1a1 1 0 11-2 0 1 1 0 012 0z",clipRule:"evenodd"})})},{path:"/groups",label:l("nav.groups"),icon:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:r.jsx("path",{d:"M13 6a3 3 0 11-6 0 3 3 0 016 0zM18 8a2 2 0 11-4 0 2 2 0 014 0zM14 15a4 4 0 00-8 0v3h8v-3zM6 8a2 2 0 11-4 0 2 2 0 014 0zM16 18v-3a5.972 5.972 0 00-.75-2.906A3.005 3.005 0 0119 15v3h-3zM4.75 12.094A5.973 5.973 0 004 15v3H1v-3a3 3 0 013.75-2.906z"})})},...(d=o.user)!=null&&d.isAdmin&&Jp("x")?[{path:"/users",label:l("nav.users"),icon:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:r.jsx("path",{d:"M9 6a3 3 0 11-6 0 3 3 0 016 0zM17 6a3 3 0 11-6 0 3 3 0 016 0zM12.93 17c.046-.327.07-.66.07-1a6.97 6.97 0 00-1.5-4.33A5 5 0 0119 16v1h-6.07zM6 11a5 5 0 015 5v1H1v-1a5 5 0 015-5z"})})}]:[],{path:"/market",label:l("nav.market"),icon:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:r.jsx("path",{d:"M3 1a1 1 0 000 2h1.22l.305 1.222a.997.997 0 00.01.042l1.358 5.43-.893.892C3.74 11.846 4.632 14 6.414 14H15a1 1 0 000-2H6.414l1-1H14a1 1 0 00.894-.553l3-6A1 1 0 0017 3H6.28l-.31-1.243A1 1 0 005 1H3zM16 16.5a1.5 1.5 0 11-3 0 1.5 1.5 0 013 0zM6.5 18a1.5 1.5 0 100-3 1.5 1.5 0 000 3z"})})},{path:"/logs",label:l("nav.logs"),icon:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:r.jsx("path",{fillRule:"evenodd",d:"M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4zm2 6a1 1 0 011-1h6a1 1 0 110 2H7a1 1 0 01-1-1zm1 3a1 1 0 100 2h6a1 1 0 100-2H7z",clipRule:"evenodd"})})}];return r.jsxs("aside",{className:`bg-white dark:bg-gray-800 shadow-sm transition-all duration-300 ease-in-out flex flex-col h-full relative ${n?"w-16":"w-64"}`,children:[r.jsx("div",{className:"overflow-y-auto flex-grow",children:r.jsx("nav",{className:"p-3 space-y-1",children:u.map(m=>r.jsxs(Np,{to:m.path,className:({isActive:p})=>`flex items-center px-2.5 py-2 rounded-lg transition-colors duration-200
|
|
192
192
|
${p?"bg-blue-50 text-blue-700":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-100"}`,end:m.path==="/",children:[r.jsx("span",{className:"flex-shrink-0",children:m.icon}),!n&&r.jsx("span",{className:"ml-3",children:m.label})]},m.path))})}),r.jsx("div",{className:"p-3 bg-white dark:bg-gray-800",children:r.jsx(m1,{collapsed:n,version:i})})]})},p1=({children:n})=>r.jsx("main",{className:"flex-1 overflow-auto p-6 bg-gray-100 dark:bg-gray-900",children:r.jsx("div",{className:"container mx-auto",children:n})}),g1=()=>{const[n,l]=Ms.useState(!1),o=()=>{l(!n)};return r.jsxs("div",{className:"flex flex-col h-screen bg-gray-100 dark:bg-gray-900",children:[r.jsx(s1,{onToggleSidebar:o}),r.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[r.jsx(h1,{collapsed:n}),r.jsx(p1,{children:r.jsx(xp,{})})]})]})},x1=({redirectPath:n="/login"})=>{const{t:l}=ve(),{auth:o}=Br();return o.loading?r.jsx("div",{className:"flex items-center justify-center h-screen",children:l("app.loading")}):o.isAuthenticated?r.jsx(xp,{}):r.jsx(jo,{to:n,replace:!0})},y1=()=>{const{t:n}=ve(),[l,o]=b.useState(""),[i,u]=b.useState(""),[d,m]=b.useState(null),[p,g]=b.useState(!1),{login:h}=Br(),y=Ka(),N=async C=>{C.preventDefault(),m(null),g(!0);try{if(!l||!i){m(n("auth.emptyFields")),g(!1);return}await h(l,i)?y("/"):m(n("auth.loginFailed"))}catch{m(n("auth.loginError"))}finally{g(!1)}};return r.jsxs("div",{className:"relative min-h-screen w-full overflow-hidden bg-gray-50 dark:bg-gray-950",children:[r.jsxs("div",{className:"absolute top-4 right-4 z-20 flex items-center gap-2",children:[r.jsx(Qp,{}),r.jsx(Zp,{})]}),r.jsx("div",{className:"pointer-events-none absolute inset-0 -z-10 opacity-60 dark:opacity-70",style:{backgroundImage:"radial-gradient(60rem 60rem at 20% -10%, rgba(99,102,241,0.25), transparent), radial-gradient(50rem 50rem at 120% 10%, rgba(168,85,247,0.15), transparent)"}}),r.jsx("div",{className:"pointer-events-none absolute inset-0 -z-10",children:r.jsxs("svg",{className:"h-full w-full opacity-[0.08] dark:opacity-[0.12]",xmlns:"http://www.w3.org/2000/svg",children:[r.jsx("defs",{children:r.jsx("pattern",{id:"grid",width:"32",height:"32",patternUnits:"userSpaceOnUse",children:r.jsx("path",{d:"M 32 0 L 0 0 0 32",fill:"none",stroke:"currentColor",strokeWidth:"0.5"})})}),r.jsx("rect",{width:"100%",height:"100%",fill:"url(#grid)",className:"text-gray-400 dark:text-gray-300"})]})}),r.jsx("div",{className:"relative mx-auto flex min-h-screen w-full max-w-md items-center justify-center px-6 py-16",children:r.jsxs("div",{className:"w-full space-y-16",children:[r.jsx("div",{className:"flex justify-center w-full",children:r.jsx("h1",{className:"text-5xl sm:text-5xl font-extrabold leading-tight tracking-tight text-gray-900 dark:text-white whitespace-nowrap",children:r.jsx("span",{className:"bg-gradient-to-r from-indigo-400 via-cyan-400 to-emerald-400 bg-clip-text text-transparent",children:n("auth.slogan")})})}),r.jsxs("div",{className:"login-card relative w-full rounded-2xl border border-white/10 bg-white/60 p-8 shadow-xl backdrop-blur-md transition dark:border-white/10 dark:bg-gray-900/60",children:[r.jsx("div",{className:"absolute -top-24 right-12 h-40 w-40 -translate-y-6 rounded-full bg-indigo-500/30 blur-3xl"}),r.jsx("div",{className:"absolute -bottom-24 -left-12 h-40 w-40 translate-y-6 rounded-full bg-cyan-500/20 blur-3xl"}),r.jsxs("form",{className:"mt-4 space-y-4",onSubmit:N,children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{htmlFor:"username",className:"sr-only",children:n("auth.username")}),r.jsx("input",{id:"username",name:"username",type:"text",autoComplete:"username",required:!0,className:"login-input appearance-none relative block w-full rounded-md border border-gray-300/60 bg-white/70 px-3 py-3 text-gray-900 shadow-sm outline-none ring-0 transition-all placeholder:text-gray-500 focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500 dark:border-gray-700/60 dark:bg-gray-800/70 dark:text-white dark:placeholder:text-gray-400",placeholder:n("auth.username"),value:l,onChange:C=>o(C.target.value)})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:"password",className:"sr-only",children:n("auth.password")}),r.jsx("input",{id:"password",name:"password",type:"password",autoComplete:"current-password",required:!0,className:"login-input appearance-none relative block w-full rounded-md border border-gray-300/60 bg-white/70 px-3 py-3 text-gray-900 shadow-sm outline-none ring-0 transition-all placeholder:text-gray-500 focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500 dark:border-gray-700/60 dark:bg-gray-800/70 dark:text-white dark:placeholder:text-gray-400",placeholder:n("auth.password"),value:i,onChange:C=>u(C.target.value)})]})]}),d&&r.jsx("div",{className:"error-box rounded border border-red-500/20 bg-red-500/10 p-2 text-center text-sm text-red-600 dark:text-red-400",children:d}),r.jsx("div",{children:r.jsx("button",{type:"submit",disabled:p,className:"login-button btn-primary group relative flex w-full items-center justify-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white transition-all hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-70",children:n(p?"auth.loggingIn":"auth.login")})})]})]})]})})]})},Qn=n=>{const l=t1(),{refreshIfNeeded:o}=l;return b.useEffect(()=>{n!=null&&n.refreshOnMount&&o()},[n==null?void 0:n.refreshOnMount,o]),l},b1=()=>{const{t:n}=ve(),{servers:l,error:o,setError:i,isLoading:u}=Qn({refreshOnMount:!0}),d={total:l.length,online:l.filter(p=>p.status==="connected").length,offline:l.filter(p=>p.status==="disconnected").length,connecting:l.filter(p=>p.status==="connecting").length},m={connected:"status.online",disconnected:"status.offline",connecting:"status.connecting"};return r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-8",children:n("pages.dashboard.title")}),o&&r.jsx("div",{className:"mb-6 bg-red-50 border-l-4 border-red-500 p-4 rounded shadow-sm error-box",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-status-red text-lg font-medium",children:n("app.error")}),r.jsx("p",{className:"text-gray-600 mt-1",children:o})]}),r.jsx("button",{onClick:()=>i(null),className:"ml-4 text-gray-500 hover:text-gray-700 transition-colors duration-200","aria-label":n("app.closeButton"),children:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:r.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 011.414 0L10 8.586l4.293-4.293a1 1 111.414 1.414L11.414 10l4.293 4.293a1 1 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 01-1.414-1.414L8.586 10 4.293 5.707a1 1 010-1.414z",clipRule:"evenodd"})})})]})}),u&&r.jsx("div",{className:"bg-white shadow rounded-lg p-6 flex items-center justify-center loading-container",children:r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsxs("svg",{className:"animate-spin h-10 w-10 text-blue-500 mb-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[r.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),r.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),r.jsx("p",{className:"text-gray-600",children:n("app.loading")})]})}),!u&&r.jsxs("div",{className:"grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-4",children:[r.jsx("div",{className:"bg-white rounded-lg shadow p-6 dashboard-card",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-3 rounded-full bg-blue-100 text-blue-800 icon-container status-icon-blue",children:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"})})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("h2",{className:"text-xl font-semibold text-gray-700",children:n("pages.dashboard.totalServers")}),r.jsx("p",{className:"text-3xl font-bold text-gray-900",children:d.total})]})]})}),r.jsx("div",{className:"bg-white rounded-lg shadow p-6 dashboard-card",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-3 rounded-full bg-green-100 text-green-800 icon-container status-icon-green",children:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("h2",{className:"text-xl font-semibold text-gray-700",children:n("pages.dashboard.onlineServers")}),r.jsx("p",{className:"text-3xl font-bold text-gray-900",children:d.online})]})]})}),r.jsx("div",{className:"bg-white rounded-lg shadow p-6 dashboard-card",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-3 rounded-full bg-red-100 text-red-800 icon-container status-icon-red",children:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"})})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("h2",{className:"text-xl font-semibold text-gray-700",children:n("pages.dashboard.offlineServers")}),r.jsx("p",{className:"text-3xl font-bold text-gray-900",children:d.offline})]})]})}),r.jsx("div",{className:"bg-white rounded-lg shadow p-6 dashboard-card",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("div",{className:"p-3 rounded-full bg-yellow-100 text-yellow-800 icon-container status-icon-yellow",children:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})})}),r.jsxs("div",{className:"ml-4",children:[r.jsx("h2",{className:"text-xl font-semibold text-gray-700",children:n("pages.dashboard.connectingServers")}),r.jsx("p",{className:"text-3xl font-bold text-gray-900",children:d.connecting})]})]})})]}),l.length>0&&!u&&r.jsxs("div",{className:"mt-8",children:[r.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-4",children:n("pages.dashboard.recentServers")}),r.jsx("div",{className:"bg-white shadow rounded-lg overflow-hidden table-container",children:r.jsxs("table",{className:"min-w-full",children:[r.jsx("thead",{className:"bg-gray-50 border-b border-gray-200",children:r.jsxs("tr",{children:[r.jsx("th",{scope:"col",className:"px-6 py-5 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:n("server.name")}),r.jsx("th",{scope:"col",className:"px-6 py-5 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:n("server.status")}),r.jsx("th",{scope:"col",className:"px-6 py-5 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:n("server.tools")}),r.jsx("th",{scope:"col",className:"px-6 py-5 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:n("server.prompts")}),r.jsx("th",{scope:"col",className:"px-6 py-5 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:n("server.enabled")})]})}),r.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:l.slice(0,5).map((p,g)=>{var h,y;return r.jsxs("tr",{children:[r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900",children:p.name}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:r.jsx("span",{className:`px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full ${p.status==="connected"?"status-badge-online":p.status==="disconnected"?"status-badge-offline":"status-badge-connecting"}`,children:n(m[p.status]||p.status)})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:((h=p.tools)==null?void 0:h.length)||0}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:((y=p.prompts)==null?void 0:y.length)||0}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:p.enabled!==!1?r.jsx("span",{className:"text-green-600",children:"✓"}):r.jsx("span",{className:"text-status-red",children:"✗"})})]},g)})})]})})]})]})},v1="modulepreload",w1=function(n,l){return new URL(n,l).href},_h={},Ph=function(l,o,i){let u=Promise.resolve();if(o&&o.length>0){let m=function(y){return Promise.all(y.map(N=>Promise.resolve(N).then(C=>({status:"fulfilled",value:C}),C=>({status:"rejected",reason:C}))))};const p=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),h=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));u=m(o.map(y=>{if(y=w1(y,i),y in _h)return;_h[y]=!0;const N=y.endsWith(".css"),C=N?'[rel="stylesheet"]':"";if(!!i)for(let k=p.length-1;k>=0;k--){const T=p[k];if(T.href===y&&(!N||T.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${y}"]${C}`))return;const S=document.createElement("link");if(S.rel=N?"stylesheet":v1,N||(S.as="script"),S.crossOrigin="",S.href=y,h&&S.setAttribute("nonce",h),document.head.appendChild(S),N)return new Promise((k,T)=>{S.addEventListener("load",k),S.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${y}`)))})}))}function d(m){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=m,window.dispatchEvent(p),!p.defaultPrevented)throw m}return u.then(m=>{for(const p of m||[])p.status==="rejected"&&d(p.reason);return l().catch(d)})},j1={default:"bg-blue-500 text-white hover:bg-blue-600",secondary:"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600",outline:"bg-transparent border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",destructive:"bg-red-500 text-white hover:bg-red-600"};function po({children:n,variant:l="default",className:o,onClick:i}){return r.jsx("span",{className:qa("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold transition-colors",j1[l],i?"cursor-pointer":"",o),onClick:i,children:n})}const N1=({status:n})=>{const{t:l}=ve(),o={connecting:"status-badge-connecting",connected:"status-badge-online",disconnected:"status-badge-offline"},i={connected:"status.online",disconnected:"status.offline",connecting:"status.connecting"};return r.jsx("span",{className:`px-2 inline-flex text-xs leading-5 font-semibold rounded-full ${o[n]}`,children:l(i[n]||n)})},tg=async(n,l)=>{try{const o=l?`/tools/${l}/${n.toolName}`:"/tools/call",i=await St(o,n.arguments,{headers:{Authorization:`Bearer ${localStorage.getItem("mcphub_token")}`}});return i.success===!1?{success:!1,error:i.message||"Tool call failed"}:{success:!0,content:(i==null?void 0:i.content)||[]}}catch(o){return console.error("Error calling tool:",o),{success:!1,error:o instanceof Error?o.message:"Unknown error occurred"}}},S1=async(n,l,o)=>{try{const i=await St(`/servers/${n}/tools/${l}/toggle`,{enabled:o},{headers:{Authorization:`Bearer ${localStorage.getItem("mcphub_token")}`}});return{success:i.success,error:i.success?void 0:i.message}}catch(i){return console.error("Error toggling tool:",i),{success:!1,error:i instanceof Error?i.message:"Unknown error occurred"}}},ag=async(n,l,o)=>{try{const i=await Ut(`/servers/${n}/tools/${l}/description`,{description:o},{headers:{Authorization:`Bearer ${localStorage.getItem("mcphub_token")}`}});return{success:i.success,error:i.success?void 0:i.message}}catch(i){return console.error("Error updating tool description:",i),{success:!1,error:i instanceof Error?i.message:"Unknown error occurred"}}},C1=Object.freeze(Object.defineProperty({__proto__:null,callTool:tg,toggleTool:S1,updateToolDescription:ag},Symbol.toStringTag,{value:"Module"})),_s=()=>{const{t:n}=ve(),{showToast:l}=Xn(),[o,i]=b.useState({enableGlobalRoute:!0,enableGroupNameRoute:!0,enableBearerAuth:!1,bearerAuthKey:"",skipAuth:!1}),[u,d]=b.useState({bearerAuthKey:""}),[m,p]=b.useState({pythonIndexUrl:"",npmRegistry:"",baseUrl:"http://localhost:3000"}),[g,h]=b.useState({enabled:!1,dbUrl:"",openaiApiBaseUrl:"",openaiApiKey:"",openaiApiEmbeddingModel:""}),[y,N]=b.useState({apiKey:"",referer:"https://www.mcphubx.com",title:"MCPHub",baseUrl:"https://api.mcprouter.to/v1"}),[C,E]=b.useState("-"),[S,k]=b.useState(!1),[T,A]=b.useState(null),[j,M]=b.useState(0),$=b.useCallback(()=>{M(P=>P+1)},[]),W=b.useCallback(async()=>{var P,V,w,z,q,de,R,J,ie,B;k(!0),A(null);try{const _=await Ye("/settings");_.success&&((V=(P=_.data)==null?void 0:P.systemConfig)!=null&&V.routing)&&i({enableGlobalRoute:_.data.systemConfig.routing.enableGlobalRoute??!0,enableGroupNameRoute:_.data.systemConfig.routing.enableGroupNameRoute??!0,enableBearerAuth:_.data.systemConfig.routing.enableBearerAuth??!1,bearerAuthKey:_.data.systemConfig.routing.bearerAuthKey||"",skipAuth:_.data.systemConfig.routing.skipAuth??!1}),_.success&&((z=(w=_.data)==null?void 0:w.systemConfig)!=null&&z.install)&&p({pythonIndexUrl:_.data.systemConfig.install.pythonIndexUrl||"",npmRegistry:_.data.systemConfig.install.npmRegistry||"",baseUrl:_.data.systemConfig.install.baseUrl||"http://localhost:3000"}),_.success&&((de=(q=_.data)==null?void 0:q.systemConfig)!=null&&de.smartRouting)&&h({enabled:_.data.systemConfig.smartRouting.enabled??!1,dbUrl:_.data.systemConfig.smartRouting.dbUrl||"",openaiApiBaseUrl:_.data.systemConfig.smartRouting.openaiApiBaseUrl||"",openaiApiKey:_.data.systemConfig.smartRouting.openaiApiKey||"",openaiApiEmbeddingModel:_.data.systemConfig.smartRouting.openaiApiEmbeddingModel||""}),_.success&&((J=(R=_.data)==null?void 0:R.systemConfig)!=null&&J.mcpRouter)&&N({apiKey:_.data.systemConfig.mcpRouter.apiKey||"",referer:_.data.systemConfig.mcpRouter.referer||"https://www.mcphubx.com",title:_.data.systemConfig.mcpRouter.title||"MCPHub",baseUrl:_.data.systemConfig.mcpRouter.baseUrl||"https://api.mcprouter.to/v1"}),_.success&&((B=(ie=_.data)==null?void 0:ie.systemConfig)==null?void 0:B.nameSeparator)!==void 0&&E(_.data.systemConfig.nameSeparator)}catch(_){console.error("Failed to fetch settings:",_),A(_ instanceof Error?_.message:"Failed to fetch settings"),l(n("errors.failedToFetchSettings"))}finally{k(!1)}},[n]),ne=async(P,V)=>{k(!0),A(null);try{const w=await Ut("/system-config",{routing:{[P]:V}});return w.success?(i({...o,[P]:V}),l(n("settings.systemConfigUpdated")),!0):(l(w.message||n("errors.failedToUpdateRouteConfig")),!1)}catch(w){return console.error("Failed to update routing config:",w),A(w instanceof Error?w.message:"Failed to update routing config"),l(n("errors.failedToUpdateRouteConfig")),!1}finally{k(!1)}},re=async(P,V)=>{k(!0),A(null);try{const w=await Ut("/system-config",{install:{[P]:V}});return w.success?(p({...m,[P]:V}),l(n("settings.systemConfigUpdated")),!0):(l(w.message||n("errors.failedToUpdateSystemConfig")),!1)}catch(w){return console.error("Failed to update system config:",w),A(w instanceof Error?w.message:"Failed to update system config"),l(n("errors.failedToUpdateSystemConfig")),!1}finally{k(!1)}},I=async(P,V)=>{k(!0),A(null);try{const w=await Ut("/system-config",{smartRouting:{[P]:V}});return w.success?(h({...g,[P]:V}),l(n("settings.systemConfigUpdated")),!0):(l(w.message||n("errors.failedToUpdateSmartRoutingConfig")),!1)}catch(w){console.error("Failed to update smart routing config:",w);const z=w instanceof Error?w.message:"Failed to update smart routing config";return A(z),l(z),!1}finally{k(!1)}},oe=async P=>{k(!0),A(null);try{const V=await Ut("/system-config",{smartRouting:P});return V.success?(h({...g,...P}),l(n("settings.systemConfigUpdated")),!0):(l(V.message||n("errors.failedToUpdateSmartRoutingConfig")),!1)}catch(V){console.error("Failed to update smart routing config:",V);const w=V instanceof Error?V.message:"Failed to update smart routing config";return A(w),l(w),!1}finally{k(!1)}},te=async P=>{k(!0),A(null);try{const V=await Ut("/system-config",{routing:P});return V.success?(i({...o,...P}),l(n("settings.systemConfigUpdated")),!0):(l(V.message||n("errors.failedToUpdateRouteConfig")),!1)}catch(V){return console.error("Failed to update routing config:",V),A(V instanceof Error?V.message:"Failed to update routing config"),l(n("errors.failedToUpdateRouteConfig")),!1}finally{k(!1)}},U=async(P,V)=>{k(!0),A(null);try{const w=await Ut("/system-config",{mcpRouter:{[P]:V}});return w.success?(N({...y,[P]:V}),l(n("settings.systemConfigUpdated")),!0):(l(w.message||n("errors.failedToUpdateSystemConfig")),!1)}catch(w){console.error("Failed to update MCPRouter config:",w);const z=w instanceof Error?w.message:"Failed to update MCPRouter config";return A(z),l(z),!1}finally{k(!1)}},D=async P=>{k(!0),A(null);try{const V=await Ut("/system-config",{mcpRouter:P});return V.success?(N({...y,...P}),l(n("settings.systemConfigUpdated")),!0):(l(V.message||n("errors.failedToUpdateSystemConfig")),!1)}catch(V){console.error("Failed to update MCPRouter config:",V);const w=V instanceof Error?V.message:"Failed to update MCPRouter config";return A(w),l(w),!1}finally{k(!1)}},Q=async P=>{k(!0),A(null);try{const V=await Ut("/system-config",{nameSeparator:P});return V.success?(E(P),l(n("settings.restartRequired"),"info"),!0):(l(V.message||n("errors.failedToUpdateSystemConfig")),!1)}catch(V){console.error("Failed to update name separator:",V);const w=V instanceof Error?V.message:"Failed to update name separator";return A(w),l(w),!1}finally{k(!1)}};return b.useEffect(()=>{W()},[W,j]),b.useEffect(()=>{o&&d({bearerAuthKey:o.bearerAuthKey})},[o]),{routingConfig:o,tempRoutingConfig:u,setTempRoutingConfig:d,installConfig:m,smartRoutingConfig:g,mcpRouterConfig:y,nameSeparator:C,loading:S,error:T,setError:A,triggerRefresh:$,fetchSettings:W,updateRoutingConfig:ne,updateInstallConfig:re,updateSmartRoutingConfig:I,updateSmartRoutingConfigBatch:oe,updateRoutingConfigBatch:te,updateMCPRouterConfig:U,updateMCPRouterConfigBatch:D,updateNameSeparator:Q}},Pr=({checked:n,onCheckedChange:l,disabled:o=!1})=>r.jsx("button",{type:"button",role:"switch","aria-checked":n,disabled:o,className:qa("relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500",n?"bg-blue-200":"bg-gray-100",o?"opacity-50 cursor-not-allowed":"cursor-pointer"),onClick:()=>!o&&l(!n),children:r.jsx("span",{className:qa("inline-block h-4 w-4 transform rounded-full bg-white transition-transform",n?"translate-x-6":"translate-x-1")})}),rg=({schema:n,onSubmit:l,onCancel:o,loading:i=!1,storageKey:u,title:d})=>{const{t:m}=ve(),[p,g]=b.useState({}),[h,y]=b.useState({}),[N,C]=b.useState(!1),[E,S]=b.useState(""),[k,T]=b.useState(""),A=b.useMemo(()=>(D=>{const Q=P=>{if(typeof P=="object"&&P!==null){const V=P;return{type:V.type||"string",description:V.description,enum:V.enum,default:V.default,properties:V.properties?Object.fromEntries(Object.entries(V.properties).map(([w,z])=>[w,Q(z)])):void 0,required:V.required,items:V.items?Q(V.items):void 0}}return{type:"string"}};return{type:D.type,properties:D.properties?Object.fromEntries(Object.entries(D.properties).map(([P,V])=>[P,Q(V)])):void 0,required:D.required}})(n),[n]);b.useEffect(()=>{const U=(Q,P="")=>{const V={};return Q.type==="object"&&Q.properties&&Object.entries(Q.properties).forEach(([w,z])=>{const q=P?`${P}.${w}`:w;z.default!==void 0?V[w]=z.default:z.type==="string"?V[w]="":z.type==="number"||z.type==="integer"?V[w]=0:z.type==="boolean"?V[w]=!1:z.type==="array"?V[w]=[]:z.type==="object"&&(z.properties?V[w]=U(z,q):V[w]={})}),V};let D=U(A);if(u)try{const Q=localStorage.getItem(u);if(Q){const P=JSON.parse(Q);D={...D,...P}}}catch(Q){console.warn("Failed to load saved form data:",Q)}g(D)},[A,u]),b.useEffect(()=>{N&&Object.keys(p).length>0&&(S(JSON.stringify(p,null,2)),T(""))},[N,p]);const j=U=>{S(U),T("");try{const D=JSON.parse(U);if(g(D),u)try{localStorage.setItem(u,JSON.stringify(D))}catch(Q){console.warn("Failed to save form data to localStorage:",Q)}}catch{T(m("tool.invalidJsonFormat"))}},M=()=>{S(JSON.stringify(p,null,2)),T(""),C(!0)},$=()=>{if(E.trim())try{const U=JSON.parse(E);g(U),T(""),C(!1)}catch{T(m("tool.fixJsonBeforeSwitching"));return}else C(!1)},W=(U,D)=>{g(Q=>{const P={...Q},V=U.split(".");let w=P;for(let z=0;z<V.length-1;z++)w[V[z]]||(w[V[z]]={}),w=w[V[z]];if(w[V[V.length-1]]=D,u)try{localStorage.setItem(u,JSON.stringify(P))}catch(z){console.warn("Failed to save form data to localStorage:",z)}return P}),h[U]&&y(Q=>{const P={...Q};return delete P[U],P})},ne=()=>{const U={},D=(Q,P,V="")=>{Q.type==="object"&&Q.properties&&Object.entries(Q.properties).forEach(([w,z])=>{var R;const q=V?`${V}.${w}`:w,de=I(P,q);if((R=Q.required)!=null&&R.includes(w)&&(de==null||de==="")){U[q]=`${w} is required`;return}de!=null&&de!==""&&(z.type==="string"&&typeof de!="string"?U[q]=`${w} must be a string`:z.type==="number"&&typeof de!="number"?U[q]=`${w} must be a number`:z.type==="integer"&&(!Number.isInteger(de)||typeof de!="number")?U[q]=`${w} must be an integer`:z.type==="boolean"&&typeof de!="boolean"?U[q]=`${w} must be a boolean`:z.type==="array"&&Array.isArray(de)?z.items&&de.forEach((J,ie)=>{var B;((B=z.items)==null?void 0:B.type)==="object"&&z.items.properties&&D(z.items,J,`${q}.${ie}`)}):z.type==="object"&&typeof de=="object"&&D(z,de,q))})};return D(A,p),y(U),Object.keys(U).length===0},re=U=>{U.preventDefault(),ne()&&l(p)},I=(U,D)=>D.split(".").reduce((Q,P)=>Q==null?void 0:Q[P],U),oe=(U,D,Q,P)=>{const V=Q==null?void 0:Q[U];return D.type==="string"?D.enum?r.jsxs("select",{value:V||"",onChange:w=>P(w.target.value),className:"w-full border rounded-md px-2 py-1 text-sm border-gray-300 focus:outline-none focus:ring-1 focus:ring-blue-500",children:[r.jsx("option",{value:"",children:m("tool.selectOption")}),D.enum.map((w,z)=>r.jsx("option",{value:w,children:w},z))]}):r.jsx("input",{type:"text",value:V||"",onChange:w=>P(w.target.value),className:"w-full border rounded-md px-2 py-1 text-sm border-gray-300 focus:outline-none focus:ring-1 focus:ring-blue-500 form-input",placeholder:D.description||m("tool.enterKey",{key:U})}):D.type==="number"||D.type==="integer"?r.jsx("input",{type:"number",step:D.type==="integer"?"1":"any",value:V??"",onChange:w=>{const z=w.target.value===""?"":D.type==="integer"?parseInt(w.target.value):parseFloat(w.target.value);P(z)},className:"w-full border rounded-md px-2 py-1 text-sm border-gray-300 focus:outline-none focus:ring-1 focus:ring-blue-500 form-input"}):D.type==="boolean"?r.jsx("input",{type:"checkbox",checked:V||!1,onChange:w=>P(w.target.checked),className:"h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded"}):r.jsx("input",{type:"text",value:V||"",onChange:w=>P(w.target.value),className:"w-full border rounded-md px-2 py-1 text-sm border-gray-300 focus:outline-none focus:ring-1 focus:ring-blue-500 form-input",placeholder:D.description||m("tool.enterKey",{key:U})})},te=(U,D,Q="")=>{var z,q,de,R,J,ie,B,_,ee,Y,F,ue,xe,Ne;const P=Q?`${Q}.${U}`:U,V=I(p,P),w=h[P];if(D.type==="array"){const ye=I(p,P)||[];return r.jsxs("div",{className:"mb-6",children:[r.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:[U,(Q?(q=(z=I(A,Q))==null?void 0:z.required)==null?void 0:q.includes(U):(de=A.required)==null?void 0:de.includes(U))&&r.jsx("span",{className:"text-status-red ml-1",children:"*"})]}),D.description&&r.jsx("p",{className:"text-xs text-gray-500 mb-2",children:D.description}),r.jsxs("div",{className:"border border-gray-200 rounded-md p-3 bg-gray-50",children:[ye.map((Te,He)=>{var lt,wa,ca;return r.jsxs("div",{className:"mb-3 p-3 bg-white border rounded-md",children:[r.jsxs("div",{className:"flex justify-between items-center mb-2",children:[r.jsx("span",{className:"text-sm font-medium text-gray-600",children:m("tool.item",{index:He+1})}),r.jsx("button",{type:"button",onClick:()=>{const ze=[...ye];ze.splice(He,1),W(P,ze)},className:"text-status-red hover:text-red-700 text-sm",children:m("common.remove")})]}),((lt=D.items)==null?void 0:lt.type)==="string"&&D.items.enum?r.jsxs("select",{value:Te||"",onChange:ze=>{const vt=[...ye];vt[He]=ze.target.value,W(P,vt)},className:"w-full border rounded-md px-3 py-2 border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500",children:[r.jsx("option",{value:"",children:m("tool.selectOption")}),D.items.enum.map((ze,vt)=>r.jsx("option",{value:ze,children:ze},vt))]}):((wa=D.items)==null?void 0:wa.type)==="object"&&D.items.properties?r.jsx("div",{className:"space-y-3",children:Object.entries(D.items.properties).map(([ze,vt])=>{var ua,da;return r.jsxs("div",{children:[r.jsxs("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:[ze,((da=(ua=D.items)==null?void 0:ua.required)==null?void 0:da.includes(ze))&&r.jsx("span",{className:"text-status-red ml-1",children:"*"})]}),oe(ze,vt,Te,Ft=>{const fa=[...ye];fa[He]={...fa[He],[ze]:Ft},W(P,fa)})]},ze)})}):r.jsx("input",{type:"text",value:Te||"",onChange:ze=>{const vt=[...ye];vt[He]=ze.target.value,W(P,vt)},className:"w-full border rounded-md px-3 py-2 border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 form-input",placeholder:m("tool.enterValue",{type:((ca=D.items)==null?void 0:ca.type)||"value"})})]},He)}),r.jsx("button",{type:"button",onClick:()=>{var He;const Te=((He=D.items)==null?void 0:He.type)==="object"?{}:"";W(P,[...ye,Te])},className:"w-full mt-2 px-3 py-2 text-sm text-blue-600 border border-blue-300 rounded-md hover:bg-blue-50",children:m("tool.addItem",{key:U})})]}),w&&r.jsx("p",{className:"text-status-red text-xs mt-1",children:w})]},P)}return D.type==="object"?D.properties?r.jsxs("div",{className:"mb-6",children:[r.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:[U,(Q?(J=(R=I(A,Q))==null?void 0:R.required)==null?void 0:J.includes(U):(ie=A.required)==null?void 0:ie.includes(U))&&r.jsx("span",{className:"text-status-red ml-1",children:"*"})]}),D.description&&r.jsx("p",{className:"text-xs text-gray-500 mb-2",children:D.description}),r.jsx("div",{className:"border border-gray-200 rounded-md p-4 bg-gray-50",children:Object.entries(D.properties).map(([ye,Te])=>te(ye,Te,P))}),w&&r.jsx("p",{className:"text-status-red text-xs mt-1",children:w})]},P):r.jsxs("div",{className:"mb-4",children:[r.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:[U,(Q?(_=(B=I(A,Q))==null?void 0:B.required)==null?void 0:_.includes(U):(ee=A.required)==null?void 0:ee.includes(U))&&r.jsx("span",{className:"text-status-red ml-1",children:"*"}),r.jsx("span",{className:"text-xs text-gray-500 ml-1",children:"(JSON object)"})]}),D.description&&r.jsx("p",{className:"text-xs text-gray-500 mb-2",children:D.description}),r.jsx("textarea",{value:typeof V=="object"?JSON.stringify(V,null,2):V||"{}",onChange:ye=>{try{const Te=JSON.parse(ye.target.value);W(P,Te)}catch{W(P,ye.target.value)}},placeholder:`{
|
|
193
193
|
"key": "value"
|
|
194
194
|
}`,className:`w-full border rounded-md px-3 py-2 font-mono text-sm ${w?"border-red-500":"border-gray-300"} focus:outline-none focus:ring-2 focus:ring-blue-500`,rows:4}),w&&r.jsx("p",{className:"text-status-red text-xs mt-1",children:w})]},P):D.type==="string"?D.enum?r.jsxs("div",{className:"mb-4",children:[r.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:[U,(Q?!1:(Y=A.required)==null?void 0:Y.includes(U))&&r.jsx("span",{className:"text-status-red ml-1",children:"*"})]}),D.description&&r.jsx("p",{className:"text-xs text-gray-500 mb-2",children:D.description}),r.jsxs("select",{value:V||"",onChange:ye=>W(P,ye.target.value),className:`w-full border rounded-md px-3 py-2 ${w?"border-red-500":"border-gray-300"} focus:outline-none focus:ring-2 focus:ring-blue-500`,children:[r.jsx("option",{value:"",children:m("tool.selectOption")}),D.enum.map((ye,Te)=>r.jsx("option",{value:ye,children:ye},Te))]}),w&&r.jsx("p",{className:"text-status-red text-xs mt-1",children:w})]},P):r.jsxs("div",{className:"mb-4",children:[r.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:[U,(Q?!1:(F=A.required)==null?void 0:F.includes(U))&&r.jsx("span",{className:"text-status-red ml-1",children:"*"})]}),D.description&&r.jsx("p",{className:"text-xs text-gray-500 mb-2",children:D.description}),r.jsx("input",{type:"text",value:V||"",onChange:ye=>W(P,ye.target.value),className:`w-full border rounded-md px-3 py-2 ${w?"border-red":"border-gray-200"} focus:outline-none form-input`}),w&&r.jsx("p",{className:"text-status-red text-xs mt-1",children:w})]},P):D.type==="number"||D.type==="integer"?r.jsxs("div",{className:"mb-4",children:[r.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:[U,(Q?!1:(ue=A.required)==null?void 0:ue.includes(U))&&r.jsx("span",{className:"text-status-red ml-1",children:"*"})]}),D.description&&r.jsx("p",{className:"text-xs text-gray-500 mb-2",children:D.description}),r.jsx("input",{type:"number",step:D.type==="integer"?"1":"any",value:V??"",onChange:ye=>{const Te=ye.target.value===""?"":D.type==="integer"?parseInt(ye.target.value):parseFloat(ye.target.value);W(P,Te)},className:`w-full border rounded-md px-3 py-2 form-input ${w?"border-red-500":"border-gray-300"} focus:outline-none focus:ring-2 focus:ring-blue-500`}),w&&r.jsx("p",{className:"text-status-red text-xs mt-1",children:w})]},P):D.type==="boolean"?r.jsxs("div",{className:"mb-4",children:[r.jsxs("div",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",checked:V||!1,onChange:ye=>W(P,ye.target.checked),className:"h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded"}),r.jsxs("label",{className:"ml-2 block text-sm text-gray-700",children:[U,(Q?!1:(xe=A.required)==null?void 0:xe.includes(U))&&r.jsx("span",{className:"text-status-red ml-1",children:"*"})]})]}),D.description&&r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:D.description}),w&&r.jsx("p",{className:"text-status-red text-xs mt-1",children:w})]},P):r.jsxs("div",{className:"mb-4",children:[r.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:[U,(Q?!1:(Ne=A.required)==null?void 0:Ne.includes(U))&&r.jsx("span",{className:"text-status-red ml-1",children:"*"}),r.jsxs("span",{className:"text-xs text-gray-500 ml-1",children:["(",D.type,")"]})]}),D.description&&r.jsx("p",{className:"text-xs text-gray-500 mb-2",children:D.description}),r.jsx("input",{type:"text",value:V||"",onChange:ye=>W(P,ye.target.value),placeholder:m("tool.enterValue",{type:D.type}),className:`w-full border rounded-md px-3 py-2 ${w?"border-red-500":"border-gray-300"} focus:outline-none focus:ring-2 focus:ring-blue-500 form-input`}),w&&r.jsx("p",{className:"text-status-red text-xs mt-1",children:w})]},P)};return A.properties?r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex justify-between items-center pb-3",children:[r.jsx("h6",{className:"text-md font-medium text-gray-900",children:d}),r.jsxs("div",{className:"flex space-x-2",children:[r.jsx("button",{type:"button",onClick:$,className:`px-3 py-1 text-sm rounded-md transition-colors ${N?"text-sm text-gray-600 bg-gray-200 rounded hover:bg-gray-300 btn-secondary":"bg-blue-100 text-blue-800 rounded hover:bg-blue-200 text-sm btn-primary"}`,children:m("tool.formMode")}),r.jsx("button",{type:"button",onClick:M,className:`px-3 py-1 text-sm rounded-md transition-colors ${N?"px-4 py-1 bg-blue-100 text-blue-800 rounded hover:bg-blue-200 text-sm btn-primary":"text-sm text-gray-600 bg-gray-200 rounded hover:bg-gray-300 btn-secondary"}`,children:m("tool.jsonMode")})]})]}),N?r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:m("tool.jsonConfiguration")}),r.jsx("textarea",{value:E,onChange:U=>j(U.target.value),placeholder:`{
|
|
@@ -209,4 +209,4 @@ Please change the parent <Route path="${M}"> to <Route path="${M==="/"?"*":`${M}
|
|
|
209
209
|
}
|
|
210
210
|
}`,required:p==="openapi"&&((ua=h.openapi)==null?void 0:ua.inputMode)==="schema"}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:d("server.openapi.schemaHelp")})]}),r.jsxs("div",{className:"mb-4",children:[r.jsx("label",{className:"block text-gray-700 text-sm font-bold mb-2",children:d("server.openapi.security")}),r.jsxs("select",{value:((da=h.openapi)==null?void 0:da.securityType)||"none",onChange:fe=>y(ce=>{var me;return{...ce,openapi:{...ce.openapi,securityType:fe.target.value,url:((me=ce.openapi)==null?void 0:me.url)||""}}}),className:"shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline form-input",children:[r.jsx("option",{value:"none",children:d("server.openapi.securityNone")}),r.jsx("option",{value:"apiKey",children:d("server.openapi.securityApiKey")}),r.jsx("option",{value:"http",children:d("server.openapi.securityHttp")}),r.jsx("option",{value:"oauth2",children:d("server.openapi.securityOAuth2")}),r.jsx("option",{value:"openIdConnect",children:d("server.openapi.securityOpenIdConnect")})]})]}),((Ft=h.openapi)==null?void 0:Ft.securityType)==="apiKey"&&r.jsxs("div",{className:"mb-4 p-4 border border-gray-200 rounded bg-gray-50",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-3",children:d("server.openapi.apiKeyConfig")}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:d("server.openapi.apiKeyName")}),r.jsx("input",{type:"text",value:((fa=h.openapi)==null?void 0:fa.apiKeyName)||"",onChange:fe=>y(ce=>{var me;return{...ce,openapi:{...ce.openapi,apiKeyName:fe.target.value,url:((me=ce.openapi)==null?void 0:me.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm form-input focus:outline-none",placeholder:"Authorization"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:d("server.openapi.apiKeyIn")}),r.jsxs("select",{value:((xr=h.openapi)==null?void 0:xr.apiKeyIn)||"header",onChange:fe=>y(ce=>{var me;return{...ce,openapi:{...ce.openapi,apiKeyIn:fe.target.value,url:((me=ce.openapi)==null?void 0:me.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",children:[r.jsx("option",{value:"header",children:d("server.openapi.apiKeyInHeader")}),r.jsx("option",{value:"query",children:d("server.openapi.apiKeyInQuery")}),r.jsx("option",{value:"cookie",children:d("server.openapi.apiKeyInCookie")})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:d("server.openapi.apiKeyValue")}),r.jsx("input",{type:"password",value:((Ie=h.openapi)==null?void 0:Ie.apiKeyValue)||"",onChange:fe=>y(ce=>{var me;return{...ce,openapi:{...ce.openapi,apiKeyValue:fe.target.value,url:((me=ce.openapi)==null?void 0:me.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"your-api-key"})]})]})]}),((yr=h.openapi)==null?void 0:yr.securityType)==="http"&&r.jsxs("div",{className:"mb-4 p-4 border border-gray-200 rounded bg-gray-50",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-3",children:d("server.openapi.httpAuthConfig")}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:d("server.openapi.httpScheme")}),r.jsxs("select",{value:((zt=h.openapi)==null?void 0:zt.httpScheme)||"bearer",onChange:fe=>y(ce=>{var me;return{...ce,openapi:{...ce.openapi,httpScheme:fe.target.value,url:((me=ce.openapi)==null?void 0:me.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",children:[r.jsx("option",{value:"basic",children:d("server.openapi.httpSchemeBasic")}),r.jsx("option",{value:"bearer",children:d("server.openapi.httpSchemeBearer")}),r.jsx("option",{value:"digest",children:d("server.openapi.httpSchemeDigest")})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:d("server.openapi.httpCredentials")}),r.jsx("input",{type:"password",value:((ot=h.openapi)==null?void 0:ot.httpCredentials)||"",onChange:fe=>y(ce=>{var me;return{...ce,openapi:{...ce.openapi,httpCredentials:fe.target.value,url:((me=ce.openapi)==null?void 0:me.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:((At=h.openapi)==null?void 0:At.httpScheme)==="basic"?"base64-encoded-credentials":"bearer-token"})]})]})]}),((rt=h.openapi)==null?void 0:rt.securityType)==="oauth2"&&r.jsxs("div",{className:"mb-4 p-4 border border-gray-200 rounded bg-gray-50",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-3",children:d("server.openapi.oauth2Config")}),r.jsx("div",{className:"grid grid-cols-1 gap-3",children:r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:d("server.openapi.oauth2Token")}),r.jsx("input",{type:"password",value:((qr=h.openapi)==null?void 0:qr.oauth2Token)||"",onChange:fe=>y(ce=>{var me;return{...ce,openapi:{...ce.openapi,oauth2Token:fe.target.value,url:((me=ce.openapi)==null?void 0:me.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"access-token"})]})})]}),((Fa=h.openapi)==null?void 0:Fa.securityType)==="openIdConnect"&&r.jsxs("div",{className:"mb-4 p-4 border border-gray-200 rounded bg-gray-50",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-3",children:d("server.openapi.openIdConnectConfig")}),r.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:d("server.openapi.openIdConnectUrl")}),r.jsx("input",{type:"url",value:((Vr=h.openapi)==null?void 0:Vr.openIdConnectUrl)||"",onChange:fe=>y(ce=>{var me;return{...ce,openapi:{...ce.openapi,openIdConnectUrl:fe.target.value,url:((me=ce.openapi)==null?void 0:me.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"https://example.com/.well-known/openid_configuration"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:d("server.openapi.openIdConnectToken")}),r.jsx("input",{type:"password",value:((Lt=h.openapi)==null?void 0:Lt.openIdConnectToken)||"",onChange:fe=>y(ce=>{var me;return{...ce,openapi:{...ce.openapi,openIdConnectToken:fe.target.value,url:((me=ce.openapi)==null?void 0:me.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"id-token"})]})]})]}),r.jsxs("div",{className:"mb-4",children:[r.jsx("label",{className:"block text-gray-700 text-sm font-bold mb-2",children:d("server.openapi.passthroughHeaders")}),r.jsx("input",{type:"text",value:((ja=h.openapi)==null?void 0:ja.passthroughHeaders)||"",onChange:fe=>y(ce=>{var me;return{...ce,openapi:{...ce.openapi,passthroughHeaders:fe.target.value,url:((me=ce.openapi)==null?void 0:me.url)||""}}}),className:"shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline form-input",placeholder:"Authorization, X-API-Key, X-Custom-Header"}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:d("server.openapi.passthroughHeadersHelp")})]}),r.jsxs("div",{className:"mb-4",children:[r.jsxs("div",{className:"flex justify-between items-center mb-2",children:[r.jsx("label",{className:"block text-gray-700 text-sm font-bold",children:d("server.headers")}),r.jsx("button",{type:"button",onClick:U,className:"bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium py-1 px-2 rounded text-sm flex items-center justify-center min-w-[30px] min-h-[30px] btn-primary",children:"+"})]}),E.map((fe,ce)=>r.jsxs("div",{className:"flex items-center mb-2",children:[r.jsxs("div",{className:"flex items-center space-x-2 flex-grow",children:[r.jsx("input",{type:"text",value:fe.key,onChange:me=>te(ce,"key",me.target.value),className:"shadow appearance-none border rounded py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline w-1/2 form-input",placeholder:"Authorization"}),r.jsx("span",{className:"flex items-center",children:":"}),r.jsx("input",{type:"text",value:fe.value,onChange:me=>te(ce,"value",me.target.value),className:"shadow appearance-none border rounded py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline w-1/2 form-input",placeholder:"Bearer token..."})]}),r.jsx("button",{type:"button",onClick:()=>D(ce),className:"bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium py-1 px-2 rounded text-sm flex items-center justify-center min-w-[30px] min-h-[30px] ml-2 btn-danger",children:"-"})]},ce))]})]}):p==="sse"||p==="streamable-http"?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"mb-4",children:[r.jsx("label",{className:"block text-gray-700 text-sm font-bold mb-2",htmlFor:"url",children:d("server.url")}),r.jsx("input",{type:"url",name:"url",id:"url",value:h.url,onChange:$,className:"shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline form-input",placeholder:p==="streamable-http"?"e.g.: http://localhost:3000/mcp":"e.g.: http://localhost:3000/sse",required:p==="sse"||p==="streamable-http"})]}),r.jsxs("div",{className:"mb-4",children:[r.jsxs("div",{className:"flex justify-between items-center mb-2",children:[r.jsx("label",{className:"block text-gray-700 text-sm font-bold",children:d("server.headers")}),r.jsx("button",{type:"button",onClick:U,className:"bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium py-1 px-2 rounded text-sm flex items-center justify-center min-w-[30px] min-h-[30px] btn-primary",children:"+"})]}),E.map((fe,ce)=>r.jsxs("div",{className:"flex items-center mb-2",children:[r.jsxs("div",{className:"flex items-center space-x-2 flex-grow",children:[r.jsx("input",{type:"text",value:fe.key,onChange:me=>te(ce,"key",me.target.value),className:"shadow appearance-none border rounded py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline w-1/2 form-input",placeholder:"Authorization"}),r.jsx("span",{className:"flex items-center",children:":"}),r.jsx("input",{type:"text",value:fe.value,onChange:me=>te(ce,"value",me.target.value),className:"shadow appearance-none border rounded py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline w-1/2 form-input",placeholder:"Bearer token..."})]}),r.jsx("button",{type:"button",onClick:()=>D(ce),className:"bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium py-1 px-2 rounded text-sm flex items-center justify-center min-w-[30px] min-h-[30px] ml-2 btn-danger",children:"-"})]},ce))]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"mb-4",children:[r.jsx("label",{className:"block text-gray-700 text-sm font-bold mb-2",htmlFor:"command",children:d("server.command")}),r.jsx("input",{type:"text",name:"command",id:"command",value:h.command,onChange:$,className:"shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline form-input",placeholder:"e.g.: npx",required:p==="stdio"})]}),r.jsxs("div",{className:"mb-4",children:[r.jsx("label",{className:"block text-gray-700 text-sm font-bold mb-2",htmlFor:"arguments",children:d("server.arguments")}),r.jsx("input",{type:"text",name:"arguments",id:"arguments",value:h.arguments,onChange:fe=>W(fe.target.value),className:"shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline form-input",placeholder:"e.g.: -y time-mcp",required:p==="stdio"})]}),r.jsxs("div",{className:"mb-4",children:[r.jsxs("div",{className:"flex justify-between items-center mb-2",children:[r.jsx("label",{className:"block text-gray-700 text-sm font-bold",children:d("server.envVars")}),r.jsx("button",{type:"button",onClick:I,className:"bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium py-1 px-2 rounded text-sm flex items-center justify-center min-w-[30px] min-h-[30px] btn-primary",children:"+"})]}),N.map((fe,ce)=>r.jsxs("div",{className:"flex items-center mb-2",children:[r.jsxs("div",{className:"flex items-center space-x-2 flex-grow",children:[r.jsx("input",{type:"text",value:fe.key,onChange:me=>re(ce,"key",me.target.value),className:"shadow appearance-none border rounded py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline w-1/2 form-input",placeholder:d("server.key")}),r.jsx("span",{className:"flex items-center",children:":"}),r.jsx("input",{type:"text",value:fe.value,onChange:me=>re(ce,"value",me.target.value),className:"shadow appearance-none border rounded py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline w-1/2 form-input",placeholder:d("server.value")})]}),r.jsx("button",{type:"button",onClick:()=>oe(ce),className:"bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium py-1 px-2 rounded text-sm flex items-center justify-center min-w-[30px] min-h-[30px] ml-2 btn-danger",children:"-"})]},ce))]})]}),p!=="openapi"&&r.jsxs("div",{className:"mb-4",children:[r.jsxs("div",{className:"flex items-center justify-between cursor-pointer bg-gray-50 hover:bg-gray-100 p-3 rounded border border-gray-200",onClick:()=>T(!k),children:[r.jsx("label",{className:"text-gray-700 text-sm font-bold",children:d("server.requestOptions")}),r.jsx("span",{className:"text-gray-500 text-sm",children:k?"▼":"▶"})]}),k&&r.jsxs("div",{className:"border border-gray-200 rounded-b p-4 bg-gray-50 border-t-0",children:[r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-gray-600 text-sm font-medium mb-1",htmlFor:"timeout",children:d("server.timeout")}),r.jsx("input",{type:"number",id:"timeout",value:((wt=h.options)==null?void 0:wt.timeout)||6e4,onChange:fe=>Q("timeout",parseInt(fe.target.value)||6e4),className:"shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline form-input",placeholder:"30000",min:"1000",max:"300000"}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:d("server.timeoutDescription")})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-gray-600 text-sm font-medium mb-1",htmlFor:"maxTotalTimeout",children:d("server.maxTotalTimeout")}),r.jsx("input",{type:"number",id:"maxTotalTimeout",value:((Ee=h.options)==null?void 0:Ee.maxTotalTimeout)||"",onChange:fe=>Q("maxTotalTimeout",fe.target.value?parseInt(fe.target.value):void 0),className:"shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline form-input",placeholder:"Optional",min:"1000"}),r.jsx("p",{className:"text-xs text-gray-500 mt-1",children:d("server.maxTotalTimeoutDescription")})]})]}),r.jsxs("div",{className:"mt-3",children:[r.jsxs("label",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",checked:((Le=h.options)==null?void 0:Le.resetTimeoutOnProgress)||!1,onChange:fe=>Q("resetTimeoutOnProgress",fe.target.checked),className:"mr-2"}),r.jsx("span",{className:"text-gray-600 text-sm",children:d("server.resetTimeoutOnProgress")})]}),r.jsx("p",{className:"text-xs text-gray-500 mt-1 ml-6",children:d("server.resetTimeoutOnProgressDescription")})]})]})]}),r.jsxs("div",{className:"flex justify-end mt-6",children:[r.jsx("button",{type:"button",onClick:l,className:"bg-gray-300 hover:bg-gray-400 text-gray-800 font-medium py-2 px-4 rounded mr-2 btn-secondary",children:d("server.cancel")}),r.jsx("button",{type:"submit",className:"bg-blue-500 hover:bg-blue-600 text-white font-medium py-2 px-4 rounded btn-primary",children:d(M?"server.save":"server.add")})]})]})]})},ng=n=>{const l=new Set,o=/\$\{([^}]+)\}/g,i=d=>{let m;for(;(m=o.exec(d))!==null;)l.add(m[1])},u=(d,m="")=>{typeof d=="string"?i(d):Array.isArray(d)?d.forEach((p,g)=>u(p,`${m}[${g}]`)):d&&typeof d=="object"&&Object.entries(d).forEach(([p,g])=>{u(g,m?`${m}.${p}`:p)})};return u(n),Array.from(l)},D1=({onAdd:n})=>{const{t:l}=ve(),[o,i]=b.useState(!1),[u,d]=b.useState(null),[m,p]=b.useState(!1),[g,h]=b.useState(null),[y,N]=b.useState([]),C=()=>{i(!o),d(null),p(!1),h(null)},E=async()=>{g&&(await S(g),p(!1),h(null))},S=async T=>{try{d(null);const A=await St("/servers",T);if(!A.success){A&&A.message?d(A.message):d(l("server.addError"));return}i(!1),n()}catch(A){console.error("Error adding server:",A),navigator.onLine?A instanceof TypeError&&(A.message.includes("NetworkError")||A.message.includes("Failed to fetch"))?d(l("errors.serverConnection")):d(l("errors.serverAdd")):d(l("errors.network"))}},k=async T=>{try{const A=ng(T);A.length>0?(N(A),h(T),p(!0)):await S(T)}catch(A){console.error("Error processing server submission:",A),d(l("errors.serverAdd"))}};return r.jsxs("div",{children:[r.jsxs("button",{onClick:C,className:"w-full bg-blue-100 text-blue-800 rounded hover:bg-blue-200 py-2 px-4 flex items-center justify-center btn-primary",children:[r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 mr-2",viewBox:"0 0 20 20",fill:"currentColor",children:r.jsx("path",{fillRule:"evenodd",d:"M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z",clipRule:"evenodd"})}),l("server.add")]}),o&&r.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:r.jsx(Oo,{onSubmit:k,onCancel:C,modalTitle:l("server.addServer"),formError:u})}),m&&r.jsx("div",{className:"fixed inset-0 bg-black/50 z-[60] flex items-center justify-center p-4",children:r.jsxs("div",{className:"bg-white rounded-lg p-6 w-full max-w-md",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:l("server.confirmVariables")}),r.jsx("p",{className:"text-gray-600 mb-4",children:l("server.variablesDetected")}),r.jsx("div",{className:"bg-yellow-50 border border-yellow-200 rounded p-3 mb-4",children:r.jsxs("div",{className:"flex items-start",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx("svg",{className:"h-5 w-5 text-yellow-400",viewBox:"0 0 20 20",fill:"currentColor",children:r.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})})}),r.jsxs("div",{className:"ml-3",children:[r.jsxs("h4",{className:"text-sm font-medium text-yellow-800",children:[l("server.detectedVariables"),":"]}),r.jsx("ul",{className:"mt-1 text-sm text-yellow-700",children:y.map((T,A)=>r.jsxs("li",{className:"font-mono",children:["$",`{${T}}`]},A))})]})]})}),r.jsx("p",{className:"text-gray-600 text-sm mb-6",children:l("server.confirmVariablesMessage")}),r.jsxs("div",{className:"flex justify-end space-x-3",children:[r.jsx("button",{onClick:()=>{p(!1),h(null)},className:"px-4 py-2 text-gray-600 border border-gray-300 rounded hover:bg-gray-50 btn-secondary",children:l("common.cancel")}),r.jsx("button",{onClick:E,className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 btn-primary",children:l("server.confirmAndAdd")})]})]})})]})},U1=({server:n,onEdit:l,onCancel:o})=>{const{t:i}=ve(),[u,d]=b.useState(null),m=async p=>{try{d(null);const g=await Ut(`/servers/${n.name}`,p);if(!g.success){g&&g.message?d(g.message):d(i("server.updateError",{serverName:n.name}));return}l()}catch(g){console.error("Error updating server:",g),navigator.onLine?g instanceof TypeError&&(g.message.includes("NetworkError")||g.message.includes("Failed to fetch"))?d(i("errors.serverConnection")):d(i("errors.serverUpdate",{serverName:n.name})):d(i("errors.network"))}};return r.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:r.jsx(Oo,{onSubmit:m,onCancel:o,initialData:n,modalTitle:i("server.editTitle",{serverName:n.name}),formError:u})})},z1=({isOpen:n,onClose:l,onConfirm:o,title:i,message:u,confirmText:d,cancelText:m,variant:p="warning"})=>{const{t:g}=ve();if(!n)return null;const h=()=>{switch(p){case"danger":return{icon:r.jsx("svg",{className:"w-6 h-6 text-red-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"})}),confirmClass:"bg-red-600 hover:bg-red-700 text-white"};case"warning":return{icon:r.jsx("svg",{className:"w-6 h-6 text-yellow-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"})}),confirmClass:"bg-yellow-600 hover:bg-yellow-700 text-white"};case"info":return{icon:r.jsx("svg",{className:"w-6 h-6 text-blue-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),confirmClass:"bg-blue-600 hover:bg-blue-700 text-white"};default:return{icon:null,confirmClass:"bg-blue-600 hover:bg-blue-700 text-white"}}},{icon:y,confirmClass:N}=h(),C=S=>{S.target===S.currentTarget&&l()},E=S=>{S.key==="Escape"?l():S.key==="Enter"&&o()};return r.jsx("div",{className:"fixed inset-0 bg-black/50 z-[100] flex items-center justify-center p-4",onClick:C,onKeyDown:E,tabIndex:-1,children:r.jsx("div",{className:"bg-white rounded-lg shadow-xl max-w-md w-full transform transition-all duration-200 ease-out",role:"dialog","aria-modal":"true","aria-labelledby":"confirm-dialog-title","aria-describedby":"confirm-dialog-message",children:r.jsxs("div",{className:"p-6",children:[r.jsxs("div",{className:"flex items-start space-x-3",children:[y&&r.jsx("div",{className:"flex-shrink-0",children:y}),r.jsxs("div",{className:"flex-1",children:[i&&r.jsx("h3",{id:"confirm-dialog-title",className:"text-lg font-medium text-gray-900 mb-2",children:i}),r.jsx("p",{id:"confirm-dialog-message",className:"text-gray-600 leading-relaxed",children:u})]})]}),r.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[r.jsx("button",{onClick:l,className:"px-4 py-2 text-gray-600 hover:text-gray-800 hover:bg-gray-100 rounded-md transition-colors duration-150 btn-secondary",autoFocus:!0,children:m||g("common.cancel")}),r.jsx("button",{onClick:o,className:`px-4 py-2 rounded-md transition-colors duration-150 focus:outline-none focus:ring-2 focus:ring-offset-2 ${N} ${p==="danger"?"btn-danger":p==="warning"?"btn-warning":"btn-primary"}`,children:d||g("common.confirm")})]})]})})})},L1=({onSuccess:n,onCancel:l})=>{const{t:o}=ve(),[i,u]=b.useState(!1),[d,m]=b.useState(!1),[p,g]=b.useState(null),[h,y]=b.useState(null),[N,C]=b.useState(!1),[E,S]=b.useState(null),[k,T]=b.useState(""),[A,j]=b.useState(!1),[M,$]=b.useState(""),W=P=>{P.preventDefault(),u(!0)},ne=P=>{P.preventDefault(),u(!1)},re=P=>{P.preventDefault(),u(!1);const V=P.dataTransfer.files;if(V.length>0){const w=V[0];w.name.endsWith(".dxt")?(y(w),g(null)):g(o("dxt.invalidFileType"))}},I=P=>{const V=P.target.files;if(V&&V.length>0){const w=V[0];w.name.endsWith(".dxt")?(y(w),g(null)):g(o("dxt.invalidFileType"))}},oe=async()=>{if(!h){g(o("dxt.noFileSelected"));return}m(!0),g(null);try{const P=new FormData;P.append("dxtFile",h);const V=await wu(vu("/dxt/upload"),{method:"POST",body:P}),w=await V.json();if(!V.ok)throw new Error(w.message||`HTTP error! Status: ${V.status}`);if(w.success&&w.data)S(w.data.manifest),T(w.data.extractDir),C(!0);else throw new Error(w.message||o("dxt.uploadFailed"))}catch(P){console.error("DXT upload error:",P),g(P instanceof Error?P.message:o("dxt.uploadFailed"))}finally{m(!1)}},te=async(P,V=!1)=>{var w;m(!0),g(null);try{const z=Q(E,k,P);if(!V){const de=await Ye("/servers");if(de.success&&((w=de.data)==null?void 0:w.find(J=>J.name===P))){$(P),j(!0),m(!1);return}}let q;if(V?q=await Ut(`/servers/${encodeURIComponent(P)}`,{name:P,config:z}):q=await St("/servers",{name:P,config:z}),q.success)n(z);else throw new Error(q.message||o("dxt.installFailed"))}catch(z){console.error("DXT install error:",z),g(z instanceof Error?z.message:o("dxt.installFailed")),m(!1)}},U=()=>{j(!1),M&&te(M,!0)},D=()=>{j(!1),$(""),m(!1)},Q=(P,V,w)=>{var de;const z=((de=P.server)==null?void 0:de.mcp_config)||{},q={type:"stdio",command:z.command||"node",args:(z.args||[]).map(R=>R.replace("${__dirname}",V))};return z.env&&Object.keys(z.env).length>0&&(q.env={...z.env},Object.keys(q.env).forEach(R=>{typeof q.env[R]=="string"&&(q.env[R]=q.env[R].replace("${__dirname}",V))})),q};return N&&E?r.jsxs(r.Fragment,{children:[r.jsx(z1,{isOpen:A,onClose:D,onConfirm:U,title:o("dxt.serverExistsTitle"),message:o("dxt.serverExistsConfirm",{serverName:M}),confirmText:o("dxt.override"),cancelText:o("common.cancel"),variant:"warning"}),r.jsx("div",{className:`fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4 ${A?"opacity-50 pointer-events-none":""}`,children:r.jsxs("div",{className:"bg-white shadow rounded-lg p-6 w-full max-w-2xl max-h-screen overflow-y-auto",children:[r.jsxs("div",{className:"flex justify-between items-center mb-6",children:[r.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:o("dxt.installServer")}),r.jsx("button",{onClick:l,className:"text-gray-500 hover:text-gray-700",children:"✕"})]}),p&&r.jsx("div",{className:"mb-4 bg-red-50 border-l-4 border-red-500 p-4 rounded",children:r.jsx("p",{className:"text-red-700",children:p})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg",children:[r.jsx("h3",{className:"font-medium text-gray-900 mb-2",children:o("dxt.extensionInfo")}),r.jsxs("div",{className:"space-y-2 text-sm",children:[r.jsxs("div",{children:[r.jsxs("strong",{children:[o("dxt.name"),":"]})," ",E.display_name||E.name]}),r.jsxs("div",{children:[r.jsxs("strong",{children:[o("dxt.version"),":"]})," ",E.version]}),r.jsxs("div",{children:[r.jsxs("strong",{children:[o("dxt.description"),":"]})," ",E.description]}),E.author&&r.jsxs("div",{children:[r.jsxs("strong",{children:[o("dxt.author"),":"]})," ",E.author.name]}),E.tools&&E.tools.length>0&&r.jsxs("div",{children:[r.jsxs("strong",{children:[o("dxt.tools"),":"]}),r.jsx("ul",{className:"list-disc list-inside ml-4",children:E.tools.map((P,V)=>r.jsxs("li",{children:[P.name," - ",P.description]},V))})]})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:o("dxt.serverName")}),r.jsx("input",{type:"text",id:"serverName",defaultValue:E.name,className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 form-input",placeholder:o("dxt.serverNamePlaceholder")})]}),r.jsxs("div",{className:"flex justify-end space-x-4",children:[r.jsx("button",{onClick:l,disabled:d,className:"px-4 py-2 text-gray-700 bg-gray-200 rounded hover:bg-gray-300 disabled:opacity-50 btn-secondary",children:o("common.cancel")}),r.jsx("button",{onClick:()=>{const P=document.getElementById("serverName"),V=(P==null?void 0:P.value.trim())||E.name;te(V)},disabled:d,className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 disabled:opacity-50 flex items-center btn-primary",children:d?r.jsxs(r.Fragment,{children:[r.jsxs("svg",{className:"animate-spin h-4 w-4 mr-2",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[r.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),r.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),o("dxt.installing")]}):o("dxt.install")})]})]})]})})]}):r.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:r.jsxs("div",{className:"bg-white shadow rounded-lg p-6 w-full max-w-lg",children:[r.jsxs("div",{className:"flex justify-between items-center mb-6",children:[r.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:o("dxt.uploadTitle")}),r.jsx("button",{onClick:l,className:"text-gray-500 hover:text-gray-700",children:"✕"})]}),p&&r.jsx("div",{className:"mb-4 bg-red-50 border-l-4 border-red-500 p-4 rounded",children:r.jsx("p",{className:"text-red-700",children:p})}),r.jsxs("div",{className:`relative border-2 border-dashed rounded-lg p-8 text-center transition-colors ${i?"border-blue-500 bg-blue-50":h?"border-gray-500 ":"border-gray-300 hover:border-gray-400"}`,onDragOver:W,onDragLeave:ne,onDrop:re,children:[h?r.jsxs("div",{className:"space-y-2",children:[r.jsx("svg",{className:"mx-auto h-12 w-12 text-green-200",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),r.jsx("p",{className:"text-sm text-gray-900 font-medium",children:h.name}),r.jsxs("p",{className:"text-xs text-gray-500",children:[(h.size/1024/1024).toFixed(2)," MB"]})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx("svg",{className:"mx-auto h-12 w-12 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-gray-900",children:o("dxt.dropFileHere")}),r.jsx("p",{className:"text-xs text-gray-500",children:o("dxt.orClickToSelect")})]})]}),r.jsx("input",{type:"file",accept:".dxt",onChange:I,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer"})]}),r.jsxs("div",{className:"mt-6 flex justify-end space-x-4",children:[r.jsx("button",{onClick:l,disabled:d,className:"px-4 py-2 text-gray-700 bg-gray-200 rounded hover:bg-gray-300 disabled:opacity-50 btn-secondary",children:o("common.cancel")}),r.jsx("button",{onClick:oe,disabled:!h||d,className:"px-4 py-2 text-white rounded hover:bg-blue-700 disabled:opacity-50 flex items-center btn-primary",children:d?r.jsxs(r.Fragment,{children:[r.jsxs("svg",{className:"animate-spin h-4 w-4 mr-2",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[r.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),r.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),o("dxt.uploading")]}):o("dxt.upload")})]})]})})},_1=()=>{const{t:n}=ve(),l=Ka(),{servers:o,error:i,setError:u,isLoading:d,handleServerAdd:m,handleServerEdit:p,handleServerRemove:g,handleServerToggle:h,triggerRefresh:y}=Qn({refreshOnMount:!0}),[N,C]=b.useState(null),[E,S]=b.useState(!1),[k,T]=b.useState(!1),A=async W=>{const ne=await p(W);ne&&C(ne)},j=()=>{C(null),y()},M=async()=>{S(!0);try{y(),await new Promise(W=>setTimeout(W,500))}finally{S(!1)}},$=W=>{T(!1),y()};return r.jsxs("div",{children:[r.jsxs("div",{className:"flex justify-between items-center mb-8",children:[r.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:n("pages.servers.title")}),r.jsxs("div",{className:"flex space-x-4",children:[r.jsxs("button",{onClick:()=>l("/market"),className:"px-4 py-2 bg-blue-100 text-blue-800 rounded hover:bg-blue-200 flex items-center btn-primary transition-all duration-200",children:[r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 mr-2",viewBox:"0 0 20 20",fill:"currentColor",children:r.jsx("path",{d:"M3 1a1 1 0 000 2h1.22l.305 1.222a.997.997 0 00.01.042l1.358 5.43-.893.892C3.74 11.846 4.632 14 6.414 14H15a1 1 0 000-2H6.414l1-1H14a1 1 0 00.894-.553l3-6A1 1 0 0017 3H6.28l-.31-1.243A1 1 0 005 1H3z"})}),n("nav.market")]}),r.jsx(D1,{onAdd:m}),r.jsxs("button",{onClick:()=>T(!0),className:"px-4 py-2 bg-blue-100 text-blue-800 rounded hover:bg-blue-200 flex items-center btn-primary transition-all duration-200",children:[r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 mr-2",viewBox:"0 0 20 20",fill:"currentColor",children:r.jsx("path",{d:"M5.5 13a3.5 3.5 0 01-.369-6.98 4 4 0 117.753-1.977A4.5 4.5 0 1113.5 13H11V9.413l1.293 1.293a1 1 0 001.414-1.414l-3-3a1 1 0 00-1.414 0l-3 3a1 1 0 001.414 1.414L9 9.413V13H5.5z"})}),n("dxt.upload")]}),r.jsxs("button",{onClick:M,disabled:E,className:`px-4 py-2 bg-blue-100 text-blue-800 rounded hover:bg-blue-200 flex items-center btn-primary transition-all duration-200 ${E?"opacity-70 cursor-not-allowed":""}`,children:[E?r.jsxs("svg",{className:"animate-spin h-4 w-4 mr-2",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[r.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),r.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 mr-2",viewBox:"0 0 20 20",fill:"currentColor",children:r.jsx("path",{fillRule:"evenodd",d:"M4 2a1 1 0 011 1v2.101a7.002 7.002 0 0111.601 2.566 1 1 0 11-1.885.666A5.002 5.002 0 005.999 7H9a1 1 0 010 2H4a1 1 0 01-1-1V3a1 1 0 011-1zm.008 9.057a1 1 0 011.276.61A5.002 5.002 0 0014.001 13H11a1 1 0 110-2h5a1 1 0 011 1v5a1 1 0 11-2 0v-2.101a7.002 7.002 0 01-11.601-2.566 1 1 0 01.61-1.276z",clipRule:"evenodd"})}),n("common.refresh")]})]})]}),i&&r.jsx("div",{className:"mb-6 bg-red-50 border-l-4 border-red-500 p-4 rounded shadow-sm error-box",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{children:r.jsx("p",{className:"text-gray-600 mt-1",children:i})}),r.jsx("button",{onClick:()=>u(null),className:"ml-4 text-gray-500 hover:text-gray-700 transition-colors duration-200 btn-secondary","aria-label":n("app.closeButton"),children:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:r.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 011.414 0L10 8.586l4.293-4.293a1 1 111.414 1.414L11.414 10l4.293 4.293a1 1 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 01-1.414-1.414L8.586 10 4.293 5.707a1 1 010-1.414z",clipRule:"evenodd"})})})]})}),d?r.jsx("div",{className:"bg-white shadow rounded-lg p-6 flex items-center justify-center loading-container",children:r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsxs("svg",{className:"animate-spin h-10 w-10 text-blue-500 mb-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[r.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),r.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),r.jsx("p",{className:"text-gray-600",children:n("app.loading")})]})}):o.length===0?r.jsx("div",{className:"bg-white shadow rounded-lg p-6 empty-state",children:r.jsx("p",{className:"text-gray-600",children:n("app.noServers")})}):r.jsx("div",{className:"space-y-6",children:o.map((W,ne)=>r.jsx(O1,{server:W,onRemove:g,onEdit:A,onToggle:h,onRefresh:y},ne))}),N&&r.jsx(U1,{server:N,onEdit:j,onCancel:()=>C(null)}),k&&r.jsx(L1,{onSuccess:$,onCancel:()=>T(!1)})]})},ku=()=>{const{t:n}=ve(),[l,o]=b.useState([]),[i,u]=b.useState(!0),[d,m]=b.useState(null),[p,g]=b.useState(0),h=b.useCallback(async()=>{try{u(!0);const A=await Ye("/groups");A&&A.success&&Array.isArray(A.data)?o(A.data):(console.error("Invalid group data format:",A),o([])),m(null)}catch(A){console.error("Error fetching groups:",A),m(A instanceof Error?A.message:"Failed to fetch groups"),o([])}finally{u(!1)}},[]),y=b.useCallback(()=>{g(A=>A+1)},[]),N=async(A,j,M=[])=>{try{const $=await St("/groups",{name:A,description:j,servers:M});return console.log("Group created successfully:",$),!$||!$.success?(m(($==null?void 0:$.message)||n("groups.createError")),$):(y(),$||null)}catch($){return m($ instanceof Error?$.message:"Failed to create group"),null}},C=async(A,j)=>{try{const M=await Ut(`/groups/${A}`,j);return!M||!M.success?(m((M==null?void 0:M.message)||n("groups.updateError")),M):(y(),M||null)}catch(M){return m(M instanceof Error?M.message:"Failed to update group"),null}},E=async(A,j)=>{try{const M=await Ut(`/groups/${A}/servers/batch`,{servers:j});return!M||!M.success?(m((M==null?void 0:M.message)||n("groups.updateError")),null):(y(),M.data||null)}catch(M){return m(M instanceof Error?M.message:"Failed to update group servers"),null}},S=async A=>{try{const j=await qn(`/groups/${A}`);return!j||!j.success?(m((j==null?void 0:j.message)||n("groups.deleteError")),j):(y(),j)}catch(j){return m(j instanceof Error?j.message:"Failed to delete group"),null}},k=async(A,j)=>{try{const M=await St(`/groups/${A}/servers`,{serverName:j});return!M||!M.success?(m((M==null?void 0:M.message)||n("groups.serverAddError")),null):(y(),M.data||null)}catch(M){return m(M instanceof Error?M.message:"Failed to add server to group"),null}},T=async(A,j)=>{try{const M=await qn(`/groups/${A}/servers/${j}`);return!M||!M.success?(m((M==null?void 0:M.message)||n("groups.serverRemoveError")),null):(y(),M.data||null)}catch(M){return m(M instanceof Error?M.message:"Failed to remove server from group"),null}};return b.useEffect(()=>{h()},[h,p]),{groups:l,loading:i,error:d,setError:m,triggerRefresh:y,createGroup:N,updateGroup:C,updateGroupServers:E,deleteGroup:S,addServerToGroup:k,removeServerFromGroup:T}},lg=({servers:n,value:l,onChange:o,className:i})=>{const{t:u}=ve(),{nameSeparator:d}=_s(),[m,p]=b.useState(new Set),g=Ms.useMemo(()=>l.map(j=>typeof j=="string"?{name:j,tools:"all"}:{...j,tools:j.tools||"all"}),[l]),h=Ms.useMemo(()=>n.filter(j=>j.enabled!==!1),[n]);Ms.useEffect(()=>{const j=new Set(g.map($=>$.name)),M=new Set(h.map($=>$.name));p($=>{const W=new Set;return $.forEach(ne=>{(j.has(ne)||M.has(ne))&&W.add(ne)}),W})},[g,h]);const y=j=>{if(g.findIndex($=>$.name===j)>=0){const $=g.filter(W=>W.name!==j);o($)}else{const $=[...g,{name:j,tools:"all"}];o($)}},N=j=>{p(M=>{const $=new Set(M);return $.has(j)?$.delete(j):$.add(j),$})},C=(j,M,$=!1)=>{if(Array.isArray(M)&&M.length===0){const W=g.filter(ne=>ne.name!==j);o(W),$||p(ne=>{const re=new Set(ne);return re.delete(j),re})}else if(g.findIndex(ne=>ne.name===j)>=0){const ne=g.map(re=>re.name===j?{...re,tools:M}:re);o(ne)}else{const ne=[...g,{name:j,tools:M}];o(ne)}},E=(j,M)=>{var re;const $=h.find(I=>I.name===j);if(!$)return;const W=((re=$.tools)==null?void 0:re.map(I=>I.name.replace(`${j}${d}`,"")))||[],ne=g.find(I=>I.name===j);if(!ne){const I=[...g,{name:j,tools:[M]}];o(I);return}if(ne.tools==="all"){const I=W.filter(oe=>oe!==M);C(j,I)}else if(Array.isArray(ne.tools)){const I=ne.tools;if(I.includes(M)){const oe=I.filter(te=>te!==M);C(j,oe)}else{const oe=[...I,M];oe.length===W.length?C(j,"all"):C(j,oe)}}},S=j=>{const M=g.find($=>$.name===j);return M?M.tools==="all":!1},k=j=>{const M=g.find($=>$.name===j);return M?Array.isArray(M.tools)&&M.tools.length>0:!1},T=(j,M)=>{const $=g.find(W=>W.name===j);return $?$.tools==="all"?!0:Array.isArray($.tools)?$.tools.includes(M):!1:!1},A=j=>{const M=h.find($=>$.name===j);return(M==null?void 0:M.tools)||[]};return r.jsxs("div",{className:qa("space-y-4",i),children:[r.jsx("div",{className:"space-y-3",children:h.map(j=>{const M=S(j.name),$=k(j.name),W=m.has(j.name),ne=A(j.name),re=g.find(I=>I.name===j.name);return r.jsxs("div",{className:"border border-gray-200 rounded-lg hover:border-gray-300 hover:bg-gray-50 transition-colors",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 cursor-pointer rounded-lg transition-colors",onClick:()=>N(j.name),children:[r.jsxs("div",{className:"flex items-center space-x-3",onClick:I=>{I.stopPropagation(),y(j.name)},children:[r.jsx("input",{type:"checkbox",checked:M||$,onChange:()=>y(j.name),className:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500"}),r.jsx("span",{className:"font-medium text-gray-900 cursor-pointer select-none",children:j.name})]}),r.jsxs("div",{className:"flex items-center space-x-3",children:[re&&re.tools!=="all"&&Array.isArray(re.tools)&&r.jsxs("span",{className:"text-sm text-green-600",children:["(",u("groups.toolsSelected")," ",re.tools.length,"/",ne.length,")"]}),re&&re.tools==="all"&&r.jsxs("span",{className:"text-sm text-green-600",children:["(",u("groups.allTools")," ",ne.length,"/",ne.length,")"]}),ne.length>0&&r.jsx("button",{type:"button",className:"p-1 text-gray-400 hover:text-gray-600 transition-colors",children:r.jsx("svg",{className:qa("w-5 h-5 transition-transform",W&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]})]}),W&&ne.length>0&&r.jsxs("div",{className:"border-t border-gray-200 bg-gray-50 p-3",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsx("span",{className:"text-sm font-medium text-gray-700",children:u("groups.toolSelection")}),r.jsx("button",{type:"button",onClick:()=>{(re==null?void 0:re.tools)==="all"||Array.isArray(re==null?void 0:re.tools)&&re.tools.length===ne.length?C(j.name,[],!0):C(j.name,"all")},className:"text-sm text-blue-600 hover:text-blue-800 transition-colors",children:(re==null?void 0:re.tools)==="all"||Array.isArray(re==null?void 0:re.tools)&&re.tools.length===ne.length?u("groups.selectNone"):u("groups.selectAll")})]}),r.jsx("div",{className:"grid grid-cols-1 gap-2 max-h-32 overflow-y-auto",children:ne.map(I=>{const oe=I.name.replace(`${j.name}${d}`,""),te=T(j.name,oe);return r.jsxs("label",{className:"flex items-center space-x-2 text-sm",children:[r.jsx("input",{type:"checkbox",checked:te,onChange:()=>E(j.name,oe),className:"w-3 h-3 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500"}),r.jsx("span",{className:"text-gray-700",children:oe}),I.description&&r.jsx("span",{className:"text-gray-400 text-xs truncate",children:I.description})]},I.name)})})]})]},j.name)})}),h.length===0&&r.jsx("p",{className:"text-gray-500 text-sm",children:u("groups.noServerOptions")})]})},P1=({onAdd:n,onCancel:l})=>{const{t:o}=ve(),{createGroup:i}=ku(),{servers:u}=Qn(),[d,m]=b.useState([]),[p,g]=b.useState(null),[h,y]=b.useState(!1),[N,C]=b.useState({name:"",description:"",servers:[]});b.useEffect(()=>{m(u.filter(k=>k.enabled!==!1))},[u]);const E=k=>{const{name:T,value:A}=k.target;C(j=>({...j,[T]:A}))},S=async k=>{k.preventDefault(),y(!0),g(null);try{if(!N.name.trim()){g(o("groups.nameRequired")),y(!1);return}const T=await i(N.name,N.description,N.servers);if(!T||!T.success){g((T==null?void 0:T.message)||o("groups.createError")),y(!1);return}n()}catch(T){g(T instanceof Error?T.message:String(T)),y(!1)}};return r.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:r.jsxs("div",{className:"bg-white rounded-lg shadow-lg max-w-2xl w-full max-h-[90vh] flex flex-col",children:[r.jsxs("div",{className:"p-6 flex-shrink-0",children:[r.jsx("h2",{className:"text-xl font-semibold text-gray-800 mb-4",children:o("groups.addNew")}),p&&r.jsx("div",{className:"mb-4 p-3 bg-red-100 text-red-700 rounded-md border border-gray-200",children:p})]}),r.jsxs("form",{onSubmit:S,className:"flex flex-col flex-1 min-h-0",children:[r.jsx("div",{className:"flex-1 overflow-y-auto px-6",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsxs("label",{className:"block text-gray-700 text-sm font-bold mb-2",htmlFor:"name",children:[o("groups.name")," *"]}),r.jsx("input",{type:"text",id:"name",name:"name",value:N.name,onChange:E,className:"w-full border border-gray-300 rounded-md px-3 py-2 text-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:o("groups.namePlaceholder"),required:!0})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-gray-700 text-sm font-bold mb-2",children:o("groups.configureTools")}),r.jsx(lg,{servers:d,value:N.servers,onChange:k=>C(T=>({...T,servers:k})),className:"border border-gray-200 rounded-lg p-4 bg-gray-50"})]})]})}),r.jsxs("div",{className:"flex justify-end space-x-3 p-6 pt-4 border-t border-gray-200 flex-shrink-0",children:[r.jsx("button",{type:"button",onClick:l,className:"px-4 py-2 text-gray-600 hover:text-gray-800 border border-gray-300 rounded-md hover:bg-gray-50 transition-colors",disabled:h,children:o("common.cancel")}),r.jsx("button",{type:"submit",className:"px-4 py-2 bg-blue-500 text-white rounded-md hover:bg-blue-600 disabled:opacity-50 transition-colors",disabled:h,children:o(h?"common.submitting":"common.create")})]})]})]})})},H1=({group:n,onEdit:l,onCancel:o})=>{const{t:i}=ve(),{updateGroup:u}=ku(),{servers:d}=Qn(),[m,p]=b.useState([]),[g,h]=b.useState(null),[y,N]=b.useState(!1),[C,E]=b.useState({name:n.name,description:n.description||"",servers:n.servers||[]});b.useEffect(()=>{p(d.filter(T=>T.enabled!==!1))},[d]);const S=T=>{const{name:A,value:j}=T.target;E(M=>({...M,[A]:j}))},k=async T=>{T.preventDefault(),N(!0),h(null);try{if(!C.name.trim()){h(i("groups.nameRequired")),N(!1);return}const A=await u(n.id,{name:C.name,description:C.description,servers:C.servers});if(!A||!A.success){h((A==null?void 0:A.message)||i("groups.updateError")),N(!1);return}l()}catch(A){h(A instanceof Error?A.message:String(A)),N(!1)}};return r.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:r.jsxs("div",{className:"bg-white rounded-lg shadow-lg max-w-2xl w-full max-h-[90vh] flex flex-col",children:[r.jsxs("div",{className:"p-6 flex-shrink-0",children:[r.jsx("h2",{className:"text-xl font-semibold text-gray-800 mb-4",children:i("groups.edit")}),g&&r.jsx("div",{className:"mb-4 p-3 bg-red-100 text-red-700 rounded-md border border-gray-200",children:g})]}),r.jsxs("form",{onSubmit:k,className:"flex flex-col flex-1 min-h-0",children:[r.jsx("div",{className:"flex-1 overflow-y-auto px-6",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsxs("label",{className:"block text-gray-700 text-sm font-bold mb-2",htmlFor:"name",children:[i("groups.name")," *"]}),r.jsx("input",{type:"text",id:"name",name:"name",value:C.name,onChange:S,className:"w-full border border-gray-300 rounded-md px-3 py-2 text-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:i("groups.namePlaceholder"),required:!0})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-gray-700 text-sm font-bold mb-2",children:i("groups.configureTools")}),r.jsx(lg,{servers:m,value:C.servers,onChange:T=>E(A=>({...A,servers:T})),className:"border border-gray-200 rounded-lg p-4 bg-gray-50"})]})]})}),r.jsxs("div",{className:"flex justify-end space-x-3 p-6 pt-4 border-t border-gray-200 flex-shrink-0",children:[r.jsx("button",{type:"button",onClick:o,className:"px-4 py-2 text-gray-600 hover:text-gray-800 border border-gray-300 rounded-md hover:bg-gray-50 transition-colors",disabled:y,children:i("common.cancel")}),r.jsx("button",{type:"submit",className:"px-4 py-2 bg-blue-500 text-white rounded-md hover:bg-blue-600 disabled:opacity-50 transition-colors",disabled:y,children:i(y?"common.submitting":"common.save")})]})]})]})})},B1=({group:n,servers:l,onEdit:o,onDelete:i})=>{const{t:u}=ve(),{showToast:d}=Xn(),{installConfig:m}=_s(),[p,g]=b.useState(!1),[h,y]=b.useState(!1),[N,C]=b.useState(!1),[E,S]=b.useState(null),k=b.useRef(null);b.useEffect(()=>{const U=D=>{k.current&&!k.current.contains(D.target)&&C(!1)};return document.addEventListener("mousedown",U),()=>{document.removeEventListener("mousedown",U)}},[]);const T=()=>{o(n)},A=()=>{g(!0)},j=()=>{i(n.id),g(!1)},M=U=>{if(navigator.clipboard&&window.isSecureContext)navigator.clipboard.writeText(U).then(()=>{y(!0),C(!1),d(u("common.copySuccess"),"success"),setTimeout(()=>y(!1),2e3)});else{const D=document.createElement("textarea");D.value=U,D.style.position="fixed",D.style.left="-9999px",document.body.appendChild(D),D.focus(),D.select();try{document.execCommand("copy"),y(!0),C(!1),d(u("common.copySuccess"),"success"),setTimeout(()=>y(!1),2e3)}catch(Q){d(u("common.copyFailed")||"Copy failed","error"),console.error("Copy to clipboard failed:",Q)}document.body.removeChild(D)}},$=()=>{M(n.id)},W=()=>{M(`${m.baseUrl}/mcp/${n.id}`)},ne=()=>{const U={mcpServers:{mcphub:{url:`${m.baseUrl}/mcp/${n.id}`,headers:{Authorization:"Bearer <your-access-token>"}}}};M(JSON.stringify(U,null,2))},re=U=>U.map(D=>typeof D=="string"?D:D.name),I=U=>{const D=n.servers.find(Q=>typeof Q=="string"?Q===U:Q.name===U);return typeof D=="string"?{name:D,tools:"all"}:D},oe=re(n.servers),te=l.filter(U=>oe.includes(U.name));return r.jsxs("div",{className:"bg-white shadow rounded-lg p-6 ",children:[r.jsxs("div",{className:"flex justify-between items-center mb-4",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center",children:[r.jsx("h2",{className:"text-xl font-semibold text-gray-800",children:n.name}),r.jsxs("div",{className:"flex items-center ml-3",children:[r.jsx("span",{className:"text-xs text-gray-500 mr-1",children:n.id}),r.jsxs("div",{className:"relative",ref:k,children:[r.jsxs("button",{onClick:()=>C(!N),className:"p-1 text-gray-400 hover:text-gray-600 transition-colors flex items-center",title:u("common.copy"),children:[h?r.jsx(Yn,{size:14,className:"text-green-500"}):r.jsx(su,{size:14}),r.jsx(Ro,{size:12,className:"ml-1"})]}),N&&r.jsxs("div",{className:"absolute top-full left-0 mt-1 bg-white shadow-lg rounded-md border border-gray-200 py-1 z-10 min-w-[140px]",children:[r.jsxs("button",{onClick:$,className:"w-full px-3 py-2 text-left text-sm text-gray-700 hover:bg-gray-100 flex items-center",children:[r.jsx(su,{size:12,className:"mr-2"}),u("common.copyId")]}),r.jsxs("button",{onClick:W,className:"w-full px-3 py-2 text-left text-sm text-gray-700 hover:bg-gray-100 flex items-center",children:[r.jsx(Xb,{size:12,className:"mr-2"}),u("common.copyUrl")]}),r.jsxs("button",{onClick:ne,className:"w-full px-3 py-2 text-left text-sm text-gray-700 hover:bg-gray-100 flex items-center",children:[r.jsx(Fb,{size:12,className:"mr-2"}),u("common.copyJson")]})]})]})]})]}),n.description&&r.jsx("p",{className:"text-gray-600 text-sm mt-1",children:n.description})]}),r.jsxs("div",{className:"flex items-center space-x-3",children:[r.jsx("div",{className:"bg-blue-50 text-blue-700 px-3 py-1 rounded-full text-sm btn-secondary",children:u("groups.serverCount",{count:n.servers.length})}),r.jsx("button",{onClick:T,className:"text-gray-500 hover:text-gray-700",title:u("groups.edit"),children:r.jsx(Mo,{size:18})}),r.jsx("button",{onClick:A,className:"text-gray-500 hover:text-red-600",title:u("groups.delete"),children:r.jsx(zp,{size:18})})]})]}),r.jsx("div",{className:"mt-4",children:te.length===0?r.jsx("p",{className:"text-gray-500 italic",children:u("groups.noServers")}):r.jsx("div",{className:"flex flex-wrap gap-2",children:te.map(U=>{var q;const D=I(U.name),Q=D&&D.tools!=="all"&&Array.isArray(D.tools),P=Q&&Array.isArray(D==null?void 0:D.tools)?D.tools.length:((q=U.tools)==null?void 0:q.length)||0,V=E===U.name,w=()=>Q&&Array.isArray(D==null?void 0:D.tools)?D.tools:U.tools&&U.tools.length>0?U.tools.map(de=>de.name):[],z=()=>{S(V?null:U.name)};return r.jsxs("div",{className:"relative",children:[r.jsxs("div",{className:"flex items-center space-x-2 bg-gray-50 rounded-lg px-3 py-2 cursor-pointer hover:bg-gray-100 transition-colors",onClick:z,children:[r.jsx("span",{className:"font-medium text-gray-700 text-sm",children:U.name}),r.jsx("span",{className:`inline-block h-2 w-2 rounded-full ${U.status==="connected"?"bg-green-500":U.status==="connecting"?"bg-yellow-500":"bg-red-500"}`}),P>0&&r.jsxs("span",{className:"text-xs text-blue-600 bg-blue-100 px-2 py-0.5 rounded flex items-center gap-1",children:[r.jsx(mv,{size:12}),P]})]}),V&&r.jsxs("div",{className:"absolute top-full left-0 mt-1 bg-white shadow-lg rounded-md border border-gray-200 p-3 z-10 min-w-[300px] max-w-[400px]",children:[r.jsxs("div",{className:"text-gray-600 text-xs mb-2",children:[u(Q?"groups.selectedTools":"groups.allTools"),":"]}),r.jsx("div",{className:"flex flex-wrap gap-1",children:w().map((de,R)=>r.jsx("span",{className:"inline-block bg-gray-100 text-gray-700 px-2 py-1 rounded text-xs",children:de},R))})]})]},U.name)})})}),r.jsx(Eu,{isOpen:p,onClose:()=>g(!1),onConfirm:j,serverName:n.name,isGroup:!0})]})},q1=()=>{const{t:n}=ve(),{groups:l,loading:o,error:i,setError:u,deleteGroup:d,triggerRefresh:m}=ku(),{servers:p}=Qn({refreshOnMount:!0}),[g,h]=b.useState(null),[y,N]=b.useState(!1),C=A=>{h(A)},E=()=>{h(null),m()},S=async A=>{const j=await d(A);(!j||!j.success)&&u((j==null?void 0:j.message)||n("groups.deleteError"))},k=()=>{N(!0)},T=()=>{N(!1),m()};return r.jsxs("div",{children:[r.jsxs("div",{className:"flex justify-between items-center mb-8",children:[r.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:n("pages.groups.title")}),r.jsx("div",{className:"flex space-x-4",children:r.jsxs("button",{onClick:k,className:"px-4 py-2 bg-blue-100 text-blue-800 rounded hover:bg-blue-200 flex items-center btn-primary transition-all duration-200",children:[r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 mr-2",viewBox:"0 0 20 20",fill:"currentColor",children:r.jsx("path",{fillRule:"evenodd",d:"M10 3a1 1 0 00-1 1v5H4a1 1 0 100 2h5v5a1 1 0 102 0v-5h5a1 1 0 100-2h-5V4a1 1 0 00-1-1z",clipRule:"evenodd"})}),n("groups.add")]})})]}),i&&r.jsx("div",{className:"bg-red-100 border-l-4 border-red-500 text-red-700 p-4 mb-6 error-box rounded-lg",children:r.jsx("p",{children:i})}),o?r.jsx("div",{className:"bg-white shadow rounded-lg p-6 loading-container",children:r.jsxs("div",{className:"flex flex-col items-center justify-center",children:[r.jsxs("svg",{className:"animate-spin h-10 w-10 text-blue-500 mb-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[r.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),r.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),r.jsx("p",{className:"text-gray-600",children:n("app.loading")})]})}):l.length===0?r.jsx("div",{className:"bg-white shadow rounded-lg p-6 empty-state",children:r.jsx("p",{className:"text-gray-600",children:n("groups.noGroups")})}):r.jsx("div",{className:"space-y-6",children:l.map(A=>r.jsx(B1,{group:A,servers:p,onEdit:C,onDelete:S},A.id))}),y&&r.jsx(P1,{onAdd:T,onCancel:T}),g&&r.jsx(H1,{group:g,onEdit:E,onCancel:()=>h(null)})]})},Tu=()=>{const{t:n}=ve(),[l,o]=b.useState([]),[i,u]=b.useState(!0),[d,m]=b.useState(null),[p,g]=b.useState(0),h=b.useCallback(async()=>{try{u(!0);const S=await Ye("/users");if(!S.success){m(S.message||n("users.fetchError"));return}S&&S.success&&Array.isArray(S.data)?o(S.data):(console.error("Invalid user data format:",S),o([])),m(null)}catch(S){console.error("Error fetching users:",S),m(S instanceof Error?S.message:"Failed to fetch users"),o([])}finally{u(!1)}},[]),y=b.useCallback(()=>{g(S=>S+1)},[]),N=async S=>{try{const k=await St("/users",S);return y(),k}catch(k){return m(k instanceof Error?k.message:"Failed to create user"),null}},C=async(S,k)=>{try{const T=await Ut(`/users/${S}`,k);return y(),T||null}catch(T){return m(T instanceof Error?T.message:"Failed to update user"),null}},E=async S=>{try{const k=await qn(`/users/${S}`);return k!=null&&k.success?(y(),k):(m((k==null?void 0:k.message)||n("users.deleteError")),k)}catch(k){return m(k instanceof Error?k.message:"Failed to delete user"),!1}};return b.useEffect(()=>{h()},[h,p]),{users:l,loading:i,error:d,setError:m,triggerRefresh:y,createUser:N,updateUser:C,deleteUser:E}},V1=({onAdd:n,onCancel:l})=>{const{t:o}=ve(),{createUser:i}=Tu(),[u,d]=b.useState(null),[m,p]=b.useState(!1),[g,h]=b.useState({username:"",password:"",isAdmin:!1}),y=async C=>{if(C.preventDefault(),d(null),!g.username.trim()){d(o("users.usernameRequired"));return}if(!g.password.trim()){d(o("users.passwordRequired"));return}if(g.password.length<6){d(o("users.passwordTooShort"));return}p(!0);try{const E=await i(g);E!=null&&E.success?n():d((E==null?void 0:E.message)||o("users.createError"))}catch(E){d(E instanceof Error?E.message:o("users.createError"))}finally{p(!1)}},N=C=>{const{name:E,value:S,type:k,checked:T}=C.target;h(A=>({...A,[E]:k==="checkbox"?T:S}))};return r.jsx("div",{className:"fixed inset-0 bg-gray-600 bg-opacity-50 overflow-y-auto h-full w-full flex items-center justify-center z-50",children:r.jsx("div",{className:"bg-white p-8 rounded-lg shadow-xl max-w-md w-full mx-4",children:r.jsxs("form",{onSubmit:y,children:[r.jsx("h2",{className:"text-xl font-semibold text-gray-800 mb-4",children:o("users.addNew")}),u&&r.jsx("div",{className:"bg-red-100 border-l-4 border-red-500 text-red-700 p-3 mb-4",children:r.jsx("p",{className:"text-sm",children:u})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsxs("label",{htmlFor:"username",className:"block text-sm font-medium text-gray-700 mb-1",children:[o("users.username")," *"]}),r.jsx("input",{type:"text",id:"username",name:"username",value:g.username,onChange:N,placeholder:o("users.usernamePlaceholder"),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0,disabled:m})]}),r.jsxs("div",{children:[r.jsxs("label",{htmlFor:"password",className:"block text-sm font-medium text-gray-700 mb-1",children:[o("users.password")," *"]}),r.jsx("input",{type:"password",id:"password",name:"password",value:g.password,onChange:N,placeholder:o("users.passwordPlaceholder"),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0,disabled:m,minLength:6})]}),r.jsxs("div",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",id:"isAdmin",name:"isAdmin",checked:g.isAdmin,onChange:N,className:"h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded",disabled:m}),r.jsx("label",{htmlFor:"isAdmin",className:"ml-2 block text-sm text-gray-700",children:o("users.adminRole")})]})]}),r.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[r.jsx("button",{type:"button",onClick:l,className:"px-4 py-2 text-gray-700 bg-gray-200 rounded hover:bg-gray-300 transition-colors duration-200",disabled:m,children:o("common.cancel")}),r.jsx("button",{type:"submit",className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition-colors duration-200 disabled:opacity-50 disabled:cursor-not-allowed",disabled:m,children:o(m?"common.creating":"users.create")})]})]})})})},G1=({user:n,onEdit:l,onCancel:o})=>{const{t:i}=ve(),{updateUser:u}=Tu(),[d,m]=b.useState(null),[p,g]=b.useState(!1),[h,y]=b.useState({isAdmin:n.isAdmin,newPassword:"",confirmPassword:""}),N=async E=>{if(E.preventDefault(),m(null),h.newPassword&&h.newPassword!==h.confirmPassword){m(i("users.passwordMismatch"));return}if(h.newPassword&&h.newPassword.length<6){m(i("users.passwordTooShort"));return}g(!0);try{const S={isAdmin:h.isAdmin};h.newPassword&&(S.newPassword=h.newPassword);const k=await u(n.username,S);k!=null&&k.success?l():m((k==null?void 0:k.message)||i("users.updateError"))}catch(S){m(S instanceof Error?S.message:i("users.updateError"))}finally{g(!1)}},C=E=>{const{name:S,value:k,type:T,checked:A}=E.target;y(j=>({...j,[S]:T==="checkbox"?A:k}))};return r.jsx("div",{className:"fixed inset-0 bg-gray-600 bg-opacity-50 overflow-y-auto h-full w-full flex items-center justify-center z-50",children:r.jsx("div",{className:"bg-white p-8 rounded-lg shadow-xl max-w-md w-full mx-4",children:r.jsxs("form",{onSubmit:N,children:[r.jsxs("h2",{className:"text-xl font-semibold text-gray-800 mb-4",children:[i("users.edit")," - ",n.username]}),d&&r.jsx("div",{className:"bg-red-100 border-l-4 border-red-500 text-red-700 p-3 mb-4",children:r.jsx("p",{className:"text-sm",children:d})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center",children:[r.jsx("input",{type:"checkbox",id:"isAdmin",name:"isAdmin",checked:h.isAdmin,onChange:C,className:"h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded",disabled:p}),r.jsx("label",{htmlFor:"isAdmin",className:"ml-2 block text-sm text-gray-700",children:i("users.adminRole")})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:"newPassword",className:"block text-sm font-medium text-gray-700 mb-1",children:i("users.newPassword")}),r.jsx("input",{type:"password",id:"newPassword",name:"newPassword",value:h.newPassword,onChange:C,placeholder:i("users.newPasswordPlaceholder"),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",disabled:p,minLength:6})]}),h.newPassword&&r.jsxs("div",{children:[r.jsx("label",{htmlFor:"confirmPassword",className:"block text-sm font-medium text-gray-700 mb-1",children:i("users.confirmPassword")}),r.jsx("input",{type:"password",id:"confirmPassword",name:"confirmPassword",value:h.confirmPassword,onChange:C,placeholder:i("users.confirmPasswordPlaceholder"),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",disabled:p,minLength:6})]})]}),r.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[r.jsx("button",{type:"button",onClick:o,className:"px-4 py-2 text-gray-700 bg-gray-200 rounded hover:bg-gray-300 transition-colors duration-200",disabled:p,children:i("common.cancel")}),r.jsx("button",{type:"submit",className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition-colors duration-200 disabled:opacity-50 disabled:cursor-not-allowed",disabled:p,children:i(p?"common.updating":"users.update")})]})]})})})},K1=({user:n,currentUser:l,onEdit:o,onDelete:i})=>{const{t:u}=ve(),[d,m]=b.useState(!1),p=()=>{m(!0)},g=()=>{i(n.username),m(!1)},h=(l==null?void 0:l.username)===n.username,y=!h;return r.jsxs("div",{className:"bg-white shadow rounded-lg p-6",children:[r.jsxs("div",{className:"flex justify-between items-start",children:[r.jsx("div",{className:"flex-1",children:r.jsxs("div",{className:"flex items-center space-x-3 mb-2",children:[r.jsx("div",{className:"w-10 h-10 bg-blue-500 rounded-full flex items-center justify-center",children:r.jsx("span",{className:"text-white font-medium text-sm",children:n.username.charAt(0).toUpperCase()})}),r.jsxs("div",{children:[r.jsxs("h3",{className:"text-lg font-semibold text-gray-900",children:[n.username,h&&r.jsx("span",{className:"ml-2 px-2 py-1 text-xs bg-blue-100 text-blue-800 rounded",children:u("users.currentUser")})]}),r.jsx("div",{className:"flex items-center space-x-2",children:r.jsx("span",{className:`px-2 py-1 text-xs font-medium rounded ${n.isAdmin?"bg-red-100 text-red-800":"bg-gray-100 text-gray-800"}`,children:n.isAdmin?u("users.admin"):u("users.user")})})]})]})}),r.jsxs("div",{className:"flex space-x-2",children:[r.jsx("button",{onClick:()=>o(n),className:"text-gray-500 hover:text-gray-700",title:u("users.edit"),children:r.jsx(Mo,{size:18})}),y&&r.jsx("button",{onClick:p,className:"text-gray-500 hover:text-red-600",title:u("users.delete"),children:r.jsx(zp,{size:18})})]})]}),r.jsx(Eu,{isOpen:d,onClose:()=>m(!1),onConfirm:g,serverName:n.username,isGroup:!1,isUser:!0})]})},F1=()=>{const{t:n}=ve(),{auth:l}=Br(),o=l.user,{users:i,loading:u,error:d,setError:m,deleteUser:p,triggerRefresh:g}=Tu(),[h,y]=b.useState(null),[N,C]=b.useState(!1);if(!(o!=null&&o.isAdmin))return r.jsx("div",{className:"bg-white shadow rounded-lg p-6",children:r.jsx("p",{className:"text-red-600",children:n("users.adminRequired")})});const E=j=>{y(j)},S=()=>{y(null),g()},k=async j=>{const M=await p(j);M!=null&&M.success||m((M==null?void 0:M.message)||n("users.deleteError"))},T=()=>{C(!0)},A=()=>{C(!1),g()};return r.jsxs("div",{children:[r.jsxs("div",{className:"flex justify-between items-center mb-8",children:[r.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:n("pages.users.title")}),r.jsx("div",{className:"flex space-x-4",children:r.jsxs("button",{onClick:T,className:"px-4 py-2 bg-blue-100 text-blue-800 rounded hover:bg-blue-200 flex items-center btn-primary transition-all duration-200",children:[r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 mr-2",viewBox:"0 0 20 20",fill:"currentColor",children:r.jsx("path",{fillRule:"evenodd",d:"M10 3a1 1 0 00-1 1v5H4a1 1 0 100 2h5v5a1 1 0 102 0v-5h5a1 1 0 100-2h-5V4a1 1 0 00-1-1z",clipRule:"evenodd"})}),n("users.add")]})})]}),d&&r.jsx("div",{className:"bg-red-100 border-l-4 border-red-500 text-red-700 p-4 mb-6 error-box rounded-lg",children:r.jsx("p",{children:d})}),u?r.jsx("div",{className:"bg-white shadow rounded-lg p-6 loading-container",children:r.jsxs("div",{className:"flex flex-col items-center justify-center",children:[r.jsxs("svg",{className:"animate-spin h-10 w-10 text-blue-500 mb-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[r.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),r.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),r.jsx("p",{className:"text-gray-600",children:n("app.loading")})]})}):i.length===0?r.jsx("div",{className:"bg-white shadow rounded-lg p-6 empty-state",children:r.jsx("p",{className:"text-gray-600",children:n("users.noUsers")})}):r.jsx("div",{className:"space-y-6",children:i.map(j=>r.jsx(K1,{user:j,currentUser:o,onEdit:E,onDelete:k},j.username))}),N&&r.jsx(V1,{onAdd:A,onCancel:A}),h&&r.jsx(G1,{user:h,onEdit:S,onCancel:()=>y(null)})]})},$1=({onSuccess:n,onCancel:l})=>{const{t:o}=ve(),[i,u]=b.useState({currentPassword:"",newPassword:""}),[d,m]=b.useState(""),[p,g]=b.useState(!1),[h,y]=b.useState(null),[N,C]=b.useState(!1),E=k=>{const{name:T,value:A}=k.target;T==="confirmPassword"?m(A):u(j=>({...j,[T]:A}))},S=async k=>{if(k.preventDefault(),y(null),i.newPassword!==d){y(o("auth.passwordsNotMatch"));return}g(!0);try{const T=await mb(i);T.success?(C(!0),n&&n()):y(T.message||o("auth.changePasswordError"))}catch{y(o("auth.changePasswordError"))}finally{g(!1)}};return r.jsxs("div",{className:"p-6 bg-white rounded-lg shadow-md",children:[r.jsx("h2",{className:"text-xl font-bold mb-4",children:o("auth.changePassword")}),N?r.jsx("div",{className:"bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded mb-4",children:o("auth.changePasswordSuccess")}):r.jsxs("form",{onSubmit:S,children:[h&&r.jsx("div",{className:"bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-4",children:h}),r.jsxs("div",{className:"mb-4",children:[r.jsx("label",{className:"block text-gray-700 text-sm font-bold mb-2",htmlFor:"currentPassword",children:o("auth.currentPassword")}),r.jsx("input",{type:"password",id:"currentPassword",name:"currentPassword",className:"w-full p-2 border rounded focus:outline-none focus:ring-2 focus:ring-blue-500 form-input",value:i.currentPassword,onChange:E,required:!0})]}),r.jsxs("div",{className:"mb-4",children:[r.jsx("label",{className:"block text-gray-700 text-sm font-bold mb-2",htmlFor:"newPassword",children:o("auth.newPassword")}),r.jsx("input",{type:"password",id:"newPassword",name:"newPassword",className:"w-full p-2 border rounded focus:outline-none focus:ring-2 focus:ring-blue-500 form-input",value:i.newPassword,onChange:E,required:!0,minLength:6})]}),r.jsxs("div",{className:"mb-6",children:[r.jsx("label",{className:"block text-gray-700 text-sm font-bold mb-2",htmlFor:"confirmPassword",children:o("auth.confirmPassword")}),r.jsx("input",{type:"password",id:"confirmPassword",name:"confirmPassword",className:"w-full p-2 border rounded focus:outline-none focus:ring-2 focus:ring-blue-500 form-input",value:d,onChange:E,required:!0,minLength:6})]}),r.jsxs("div",{className:"flex justify-end space-x-2",children:[l&&r.jsx("button",{type:"button",onClick:l,disabled:p,className:"py-2 px-4 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500",children:o("common.cancel")}),r.jsx("button",{type:"submit",disabled:p,className:"py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 btn-primary",children:p?r.jsxs("span",{className:"flex items-center",children:[r.jsxs("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[r.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),r.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),o("common.save")]}):o("common.save")})]})]})]})};function I1(n=32){const l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",o=new Uint8Array(n);return crypto.getRandomValues(o),Array.from(o).map(i=>l.charAt(i%l.length)).join("")}const go={SETTINGS_SMART_ROUTING:"settings:smart_routing",SETTINGS_SKIP_AUTH:"settings:skip_auth",SETTINGS_INSTALL_CONFIG:"settings:install_config"},Y1=()=>{const{t:n}=ve(),l=Ka(),{showToast:o}=Xn(),[i,u]=b.useState({pythonIndexUrl:"",npmRegistry:"",baseUrl:"http://localhost:3000"}),[d,m]=b.useState({dbUrl:"",openaiApiBaseUrl:"",openaiApiKey:"",openaiApiEmbeddingModel:""}),[p,g]=b.useState({apiKey:"",referer:"https://www.mcphubx.com",title:"MCPHub",baseUrl:"https://api.mcprouter.to/v1"}),[h,y]=b.useState("-"),{routingConfig:N,tempRoutingConfig:C,setTempRoutingConfig:E,installConfig:S,smartRoutingConfig:k,mcpRouterConfig:T,nameSeparator:A,loading:j,updateRoutingConfig:M,updateRoutingConfigBatch:$,updateInstallConfig:W,updateSmartRoutingConfig:ne,updateSmartRoutingConfigBatch:re,updateMCPRouterConfig:I,updateNameSeparator:oe}=_s();b.useEffect(()=>{S&&u(S)},[S]),b.useEffect(()=>{k&&m({dbUrl:k.dbUrl||"",openaiApiBaseUrl:k.openaiApiBaseUrl||"",openaiApiKey:k.openaiApiKey||"",openaiApiEmbeddingModel:k.openaiApiEmbeddingModel||""})},[k]),b.useEffect(()=>{T&&g({apiKey:T.apiKey||"",referer:T.referer||"https://www.mcphubx.com",title:T.title||"MCPHub",baseUrl:T.baseUrl||"https://api.mcprouter.to/v1"})},[T]),b.useEffect(()=>{y(A)},[A]);const[te,U]=b.useState({routingConfig:!1,installConfig:!1,smartRoutingConfig:!1,mcpRouterConfig:!1,nameSeparator:!1,password:!1}),D=ee=>{U(Y=>({...Y,[ee]:!Y[ee]}))},Q=async(ee,Y)=>{if(ee==="enableBearerAuth"&&Y===!0&&!C.bearerAuthKey&&!N.bearerAuthKey){const F=I1();P(F),await $({enableBearerAuth:!0,bearerAuthKey:F})&&E(xe=>({...xe,bearerAuthKey:F}));return}await M(ee,Y)},P=ee=>{E(Y=>({...Y,bearerAuthKey:ee}))},V=async()=>{await M("bearerAuthKey",C.bearerAuthKey)},w=(ee,Y)=>{u({...i,[ee]:Y})},z=async ee=>{await W(ee,i[ee])},q=(ee,Y)=>{m({...d,[ee]:Y})},de=async ee=>{await ne(ee,d[ee])},R=(ee,Y)=>{g({...p,[ee]:Y})},J=async ee=>{await I(ee,p[ee])},ie=async()=>{await oe(h)},B=async ee=>{if(ee){const Y=d.dbUrl||k.dbUrl,F=d.openaiApiKey||k.openaiApiKey;if(!Y||!F){const xe=[];Y||xe.push(n("settings.dbUrl")),F||xe.push(n("settings.openaiApiKey")),o(n("settings.smartRoutingValidationError",{fields:xe.join(", ")}));return}const ue={enabled:ee};d.dbUrl!==k.dbUrl&&(ue.dbUrl=d.dbUrl),d.openaiApiBaseUrl!==k.openaiApiBaseUrl&&(ue.openaiApiBaseUrl=d.openaiApiBaseUrl),d.openaiApiKey!==k.openaiApiKey&&(ue.openaiApiKey=d.openaiApiKey),d.openaiApiEmbeddingModel!==k.openaiApiEmbeddingModel&&(ue.openaiApiEmbeddingModel=d.openaiApiEmbeddingModel),await re(ue)}else await ne("enabled",ee)},_=()=>{setTimeout(()=>{l("/")},2e3)};return r.jsxs("div",{className:"container mx-auto",children:[r.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-8",children:n("pages.settings.title")}),r.jsx(ho,{permissions:go.SETTINGS_SMART_ROUTING,children:r.jsxs("div",{className:"bg-white shadow rounded-lg py-4 px-6 mb-6 page-card dashboard-card",children:[r.jsxs("div",{className:"flex justify-between items-center cursor-pointer transition-colors duration-200 hover:text-blue-600",onClick:()=>D("smartRoutingConfig"),children:[r.jsx("h2",{className:"font-semibold text-gray-800",children:n("pages.settings.smartRouting")}),r.jsx("span",{className:"text-gray-500 transition-transform duration-200",children:te.smartRoutingConfig?"▼":"►"})]}),te.smartRoutingConfig&&r.jsxs("div",{className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-md",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-medium text-gray-700",children:n("settings.enableSmartRouting")}),r.jsx("p",{className:"text-sm text-gray-500",children:n("settings.enableSmartRoutingDescription")})]}),r.jsx(Pr,{disabled:j,checked:k.enabled,onCheckedChange:ee=>B(ee)})]}),r.jsxs("div",{className:"p-3 bg-gray-50 rounded-md",children:[r.jsx("div",{className:"mb-2",children:r.jsxs("h3",{className:"font-medium text-gray-700",children:[r.jsx("span",{className:"text-red-500 px-1",children:"*"}),n("settings.dbUrl")]})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("input",{type:"text",value:d.dbUrl,onChange:ee=>q("dbUrl",ee.target.value),placeholder:n("settings.dbUrlPlaceholder"),className:"flex-1 mt-1 block w-full py-2 px-3 border rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm border-gray-300 form-input",disabled:j}),r.jsx("button",{onClick:()=>de("dbUrl"),disabled:j,className:"mt-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium disabled:opacity-50 btn-primary",children:n("common.save")})]})]}),r.jsxs("div",{className:"p-3 bg-gray-50 rounded-md",children:[r.jsx("div",{className:"mb-2",children:r.jsxs("h3",{className:"font-medium text-gray-700",children:[r.jsx("span",{className:"text-red-500 px-1",children:"*"}),n("settings.openaiApiKey")]})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("input",{type:"password",value:d.openaiApiKey,onChange:ee=>q("openaiApiKey",ee.target.value),placeholder:n("settings.openaiApiKeyPlaceholder"),className:"flex-1 mt-1 block w-full py-2 px-3 border rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm border-gray-300",disabled:j}),r.jsx("button",{onClick:()=>de("openaiApiKey"),disabled:j,className:"mt-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium disabled:opacity-50 btn-primary",children:n("common.save")})]})]}),r.jsxs("div",{className:"p-3 bg-gray-50 rounded-md",children:[r.jsx("div",{className:"mb-2",children:r.jsx("h3",{className:"font-medium text-gray-700",children:n("settings.openaiApiBaseUrl")})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("input",{type:"text",value:d.openaiApiBaseUrl,onChange:ee=>q("openaiApiBaseUrl",ee.target.value),placeholder:n("settings.openaiApiBaseUrlPlaceholder"),className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input",disabled:j}),r.jsx("button",{onClick:()=>de("openaiApiBaseUrl"),disabled:j,className:"mt-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium disabled:opacity-50 btn-primary",children:n("common.save")})]})]}),r.jsxs("div",{className:"p-3 bg-gray-50 rounded-md",children:[r.jsx("div",{className:"mb-2",children:r.jsx("h3",{className:"font-medium text-gray-700",children:n("settings.openaiApiEmbeddingModel")})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("input",{type:"text",value:d.openaiApiEmbeddingModel,onChange:ee=>q("openaiApiEmbeddingModel",ee.target.value),placeholder:n("settings.openaiApiEmbeddingModelPlaceholder"),className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input",disabled:j}),r.jsx("button",{onClick:()=>de("openaiApiEmbeddingModel"),disabled:j,className:"mt-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium disabled:opacity-50 btn-primary",children:n("common.save")})]})]})]})]})}),r.jsx(ho,{permissions:go.SETTINGS_INSTALL_CONFIG,children:r.jsxs("div",{className:"bg-white shadow rounded-lg py-4 px-6 mb-6 page-card dashboard-card",children:[r.jsxs("div",{className:"flex justify-between items-center cursor-pointer transition-colors duration-200 hover:text-blue-600",onClick:()=>D("mcpRouterConfig"),children:[r.jsx("h2",{className:"font-semibold text-gray-800",children:n("settings.mcpRouterConfig")}),r.jsx("span",{className:"text-gray-500 transition-transform duration-200",children:te.mcpRouterConfig?"▼":"►"})]}),te.mcpRouterConfig&&r.jsxs("div",{className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"p-3 bg-gray-50 rounded-md",children:[r.jsxs("div",{className:"mb-2",children:[r.jsx("h3",{className:"font-medium text-gray-700",children:n("settings.mcpRouterApiKey")}),r.jsx("p",{className:"text-sm text-gray-500",children:n("settings.mcpRouterApiKeyDescription")})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("input",{type:"password",value:p.apiKey,onChange:ee=>R("apiKey",ee.target.value),placeholder:n("settings.mcpRouterApiKeyPlaceholder"),className:"flex-1 mt-1 block w-full py-2 px-3 border rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm border-gray-300 form-input",disabled:j}),r.jsx("button",{onClick:()=>J("apiKey"),disabled:j,className:"mt-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium disabled:opacity-50 btn-primary",children:n("common.save")})]})]}),r.jsxs("div",{className:"p-3 bg-gray-50 rounded-md",children:[r.jsxs("div",{className:"mb-2",children:[r.jsx("h3",{className:"font-medium text-gray-700",children:n("settings.mcpRouterBaseUrl")}),r.jsx("p",{className:"text-sm text-gray-500",children:n("settings.mcpRouterBaseUrlDescription")})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("input",{type:"text",value:p.baseUrl,onChange:ee=>R("baseUrl",ee.target.value),placeholder:n("settings.mcpRouterBaseUrlPlaceholder"),className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input",disabled:j}),r.jsx("button",{onClick:()=>J("baseUrl"),disabled:j,className:"mt-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium disabled:opacity-50 btn-primary",children:n("common.save")})]})]})]})]})}),r.jsxs("div",{className:"bg-white shadow rounded-lg py-4 px-6 mb-6 dashboard-card",children:[r.jsxs("div",{className:"flex justify-between items-center cursor-pointer",onClick:()=>D("nameSeparator"),children:[r.jsx("h2",{className:"font-semibold text-gray-800",children:n("settings.systemSettings")}),r.jsx("span",{className:"text-gray-500",children:te.nameSeparator?"▼":"►"})]}),te.nameSeparator&&r.jsx("div",{className:"space-y-4 mt-4",children:r.jsxs("div",{className:"p-3 bg-gray-50 rounded-md",children:[r.jsxs("div",{className:"mb-2",children:[r.jsx("h3",{className:"font-medium text-gray-700",children:n("settings.nameSeparatorLabel")}),r.jsx("p",{className:"text-sm text-gray-500",children:n("settings.nameSeparatorDescription")})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("input",{type:"text",value:h,onChange:ee=>y(ee.target.value),placeholder:"-",className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input",disabled:j,maxLength:5}),r.jsx("button",{onClick:ie,disabled:j,className:"mt-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium disabled:opacity-50 btn-primary",children:n("common.save")})]})]})})]}),r.jsxs("div",{className:"bg-white shadow rounded-lg py-4 px-6 mb-6 dashboard-card",children:[r.jsxs("div",{className:"flex justify-between items-center cursor-pointer",onClick:()=>D("routingConfig"),children:[r.jsx("h2",{className:"font-semibold text-gray-800",children:n("pages.settings.routeConfig")}),r.jsx("span",{className:"text-gray-500",children:te.routingConfig?"▼":"►"})]}),te.routingConfig&&r.jsxs("div",{className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-md",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-medium text-gray-700",children:n("settings.enableBearerAuth")}),r.jsx("p",{className:"text-sm text-gray-500",children:n("settings.enableBearerAuthDescription")})]}),r.jsx(Pr,{disabled:j,checked:N.enableBearerAuth,onCheckedChange:ee=>Q("enableBearerAuth",ee)})]}),N.enableBearerAuth&&r.jsxs("div",{className:"p-3 bg-gray-50 rounded-md",children:[r.jsxs("div",{className:"mb-2",children:[r.jsx("h3",{className:"font-medium text-gray-700",children:n("settings.bearerAuthKey")}),r.jsx("p",{className:"text-sm text-gray-500",children:n("settings.bearerAuthKeyDescription")})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("input",{type:"text",value:C.bearerAuthKey,onChange:ee=>P(ee.target.value),placeholder:n("settings.bearerAuthKeyPlaceholder"),className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input",disabled:j||!N.enableBearerAuth}),r.jsx("button",{onClick:V,disabled:j||!N.enableBearerAuth,className:"mt-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium disabled:opacity-50 btn-primary",children:n("common.save")})]})]}),r.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-md",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-medium text-gray-700",children:n("settings.enableGlobalRoute")}),r.jsx("p",{className:"text-sm text-gray-500",children:n("settings.enableGlobalRouteDescription")})]}),r.jsx(Pr,{disabled:j,checked:N.enableGlobalRoute,onCheckedChange:ee=>Q("enableGlobalRoute",ee)})]}),r.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-md",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-medium text-gray-700",children:n("settings.enableGroupNameRoute")}),r.jsx("p",{className:"text-sm text-gray-500",children:n("settings.enableGroupNameRouteDescription")})]}),r.jsx(Pr,{disabled:j,checked:N.enableGroupNameRoute,onCheckedChange:ee=>Q("enableGroupNameRoute",ee)})]}),r.jsx(ho,{permissions:go.SETTINGS_SKIP_AUTH,children:r.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-md",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-medium text-gray-700",children:n("settings.skipAuth")}),r.jsx("p",{className:"text-sm text-gray-500",children:n("settings.skipAuthDescription")})]}),r.jsx(Pr,{disabled:j,checked:N.skipAuth,onCheckedChange:ee=>Q("skipAuth",ee)})]})})]})]}),r.jsx(ho,{permissions:go.SETTINGS_INSTALL_CONFIG,children:r.jsxs("div",{className:"bg-white shadow rounded-lg py-4 px-6 mb-6 dashboard-card",children:[r.jsxs("div",{className:"flex justify-between items-center cursor-pointer",onClick:()=>D("installConfig"),children:[r.jsx("h2",{className:"font-semibold text-gray-800",children:n("settings.installConfig")}),r.jsx("span",{className:"text-gray-500",children:te.installConfig?"▼":"►"})]}),te.installConfig&&r.jsxs("div",{className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"p-3 bg-gray-50 rounded-md",children:[r.jsxs("div",{className:"mb-2",children:[r.jsx("h3",{className:"font-medium text-gray-700",children:n("settings.baseUrl")}),r.jsx("p",{className:"text-sm text-gray-500",children:n("settings.baseUrlDescription")})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("input",{type:"text",value:i.baseUrl,onChange:ee=>w("baseUrl",ee.target.value),placeholder:n("settings.baseUrlPlaceholder"),className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input",disabled:j}),r.jsx("button",{onClick:()=>z("baseUrl"),disabled:j,className:"mt-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium disabled:opacity-50 btn-primary",children:n("common.save")})]})]}),r.jsxs("div",{className:"p-3 bg-gray-50 rounded-md",children:[r.jsxs("div",{className:"mb-2",children:[r.jsx("h3",{className:"font-medium text-gray-700",children:n("settings.pythonIndexUrl")}),r.jsx("p",{className:"text-sm text-gray-500",children:n("settings.pythonIndexUrlDescription")})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("input",{type:"text",value:i.pythonIndexUrl,onChange:ee=>w("pythonIndexUrl",ee.target.value),placeholder:n("settings.pythonIndexUrlPlaceholder"),className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input",disabled:j}),r.jsx("button",{onClick:()=>z("pythonIndexUrl"),disabled:j,className:"mt-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium disabled:opacity-50 btn-primary",children:n("common.save")})]})]}),r.jsxs("div",{className:"p-3 bg-gray-50 rounded-md",children:[r.jsxs("div",{className:"mb-2",children:[r.jsx("h3",{className:"font-medium text-gray-700",children:n("settings.npmRegistry")}),r.jsx("p",{className:"text-sm text-gray-500",children:n("settings.npmRegistryDescription")})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("input",{type:"text",value:i.npmRegistry,onChange:ee=>w("npmRegistry",ee.target.value),placeholder:n("settings.npmRegistryPlaceholder"),className:"flex-1 mt-1 block w-full py-2 px-3 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm form-input",disabled:j}),r.jsx("button",{onClick:()=>z("npmRegistry"),disabled:j,className:"mt-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md text-sm font-medium disabled:opacity-50 btn-primary",children:n("common.save")})]})]})]})]})}),r.jsxs("div",{className:"bg-white shadow rounded-lg py-4 px-6 mb-6 dashboard-card",children:[r.jsxs("div",{className:"flex justify-between items-center cursor-pointer",onClick:()=>D("password"),children:[r.jsx("h2",{className:"font-semibold text-gray-800",children:n("auth.changePassword")}),r.jsx("span",{className:"text-gray-500",children:te.password?"▼":"►"})]}),te.password&&r.jsx("div",{className:"max-w-lg mt-4",children:r.jsx($1,{onSuccess:_})})]})]})},X1=()=>{const{t:n}=ve(),[l,o]=b.useState([]),[i,u]=b.useState([]),[d,m]=b.useState([]),[p,g]=b.useState([]),[h,y]=b.useState(""),[N,C]=b.useState(""),[E,S]=b.useState(""),[k,T]=b.useState(!0),[A,j]=b.useState(null),[M,$]=b.useState(null),[W,ne]=b.useState([]),[re,I]=b.useState(1),[oe,te]=b.useState(9),[U,D]=b.useState(1),Q=b.useCallback(async()=>{try{T(!0);const Y=await Ye("/market/servers");Y&&Y.success&&Array.isArray(Y.data)?(u(Y.data),P(Y.data,re)):(console.error("Invalid market servers data format:",Y),j(n("market.fetchError")))}catch(Y){console.error("Error fetching market servers:",Y),j(Y instanceof Error?Y.message:String(Y))}finally{T(!1)}},[n]),P=b.useCallback((Y,F,ue=oe)=>{const xe=Y.length,Ne=Math.ceil(xe/ue);D(Ne);const ye=Math.max(1,Math.min(F,Ne));ye!==F&&I(ye);const Te=(ye-1)*ue,He=Y.slice(Te,Te+ue);o(He)},[oe]),V=b.useCallback(Y=>{I(Y),P(i,Y,oe)},[i,P,oe]),w=b.useCallback(async()=>{try{const Y=await Ye("/market/categories");Y&&Y.success&&Array.isArray(Y.data)?m(Y.data):console.error("Invalid categories data format:",Y)}catch(Y){console.error("Error fetching categories:",Y)}},[]),z=b.useCallback(async()=>{try{const Y=await Ye("/market/tags");Y&&Y.success&&Array.isArray(Y.data)?g(Y.data):console.error("Invalid tags data format:",Y)}catch(Y){console.error("Error fetching tags:",Y)}},[]),q=b.useCallback(async Y=>{try{T(!0);const F=await Ye(`/market/servers/${Y}`);return F&&F.success&&F.data?($(F.data),F.data):(console.error("Invalid server data format:",F),j(n("market.serverNotFound")),null)}catch(F){return console.error(`Error fetching server ${Y}:`,F),j(F instanceof Error?F.message:String(F)),null}finally{T(!1)}},[n]),de=b.useCallback(async Y=>{try{if(T(!0),S(Y),!Y.trim()){Q();return}const F=await Ye(`/market/servers/search?query=${encodeURIComponent(Y)}`);F&&F.success&&Array.isArray(F.data)?(u(F.data),I(1),P(F.data,1)):(console.error("Invalid search results format:",F),j(n("market.searchError")))}catch(F){console.error("Error searching servers:",F),j(F instanceof Error?F.message:String(F))}finally{T(!1)}},[n,i,P,Q]),R=b.useCallback(async Y=>{try{if(T(!0),y(Y),C(""),!Y){Q();return}const F=await Ye(`/market/categories/${encodeURIComponent(Y)}`);F&&F.success&&Array.isArray(F.data)?(u(F.data),I(1),P(F.data,1)):(console.error("Invalid category filter results format:",F),j(n("market.filterError")))}catch(F){console.error("Error filtering servers by category:",F),j(F instanceof Error?F.message:String(F))}finally{T(!1)}},[n,Q,P]),J=b.useCallback(async Y=>{try{if(T(!0),C(Y),y(""),!Y){Q();return}const F=await Ye(`/market/tags/${encodeURIComponent(Y)}`);F&&F.success&&Array.isArray(F.data)?(u(F.data),I(1),P(F.data,1)):(console.error("Invalid tag filter results format:",F),j(n("market.tagFilterError")))}catch(F){console.error("Error filtering servers by tag:",F),j(F instanceof Error?F.message:String(F))}finally{T(!1)}},[n,Q,P]),ie=b.useCallback(async()=>{try{const Y=await Ye("/servers");if(Y&&Y.success&&Array.isArray(Y.data)){const F=Y.data.map(ue=>ue.name);ne(F)}}catch(Y){console.error("Error fetching installed servers:",Y)}},[]),B=b.useCallback(Y=>W.includes(Y),[W]),_=b.useCallback(async(Y,F)=>{var ue,xe;try{const Ne=(ue=Y.installations)!=null&&ue.npm?"npm":Object.keys(Y.installations||{}).length>0?Object.keys(Y.installations)[0]:null;if(!Ne||!((xe=Y.installations)!=null&&xe[Ne]))return j(n("market.noInstallationMethod")),!1;const ye=Y.installations[Ne],Te={name:Y.name,config:F.type==="stdio"?{command:F.command||ye.command||"",args:F.args||ye.args||[],env:{...ye.env,...F.env}}:F},He=await St("/servers",Te);if(!He.success)throw new Error(He.message||"Failed to install server");return await ie(),!0}catch(Ne){return console.error("Error installing server:",Ne),j(Ne instanceof Error?Ne.message:String(Ne)),!1}},[n,ie]),ee=b.useCallback(Y=>{te(Y),I(1),P(i,1,Y)},[i,P]);return b.useEffect(()=>{Q(),w(),z(),ie()},[Q,w,z,ie]),{servers:l,allServers:i,categories:d,tags:p,selectedCategory:h,selectedTag:N,searchQuery:E,loading:k,error:A,setError:j,currentServer:M,fetchMarketServers:Q,fetchServerByName:q,searchServers:de,filterByCategory:R,filterByTag:J,installServer:_,currentPage:re,totalPages:U,serversPerPage:oe,changePage:V,changeServersPerPage:ee,isServerInstalled:B}},Q1=()=>{const{t:n}=ve(),[l,o]=b.useState([]),[i,u]=b.useState([]),[d,m]=b.useState([]),[p,g]=b.useState([]),[h,y]=b.useState(""),[N,C]=b.useState(""),[E,S]=b.useState(""),[k,T]=b.useState(!0),[A,j]=b.useState(null),[M,$]=b.useState(null),[W,ne]=b.useState(1),[re,I]=b.useState(9),[oe,te]=b.useState(1),U=b.useCallback(async()=>{try{T(!0);const B=await Ye("/cloud/servers");B&&B.success&&Array.isArray(B.data)?(u(B.data),D(B.data,W)):(console.error("Invalid cloud market servers data format:",B),j(n("cloud.fetchError")))}catch(B){console.error("Error fetching cloud market servers:",B);const _=B instanceof Error?B.message:String(B);_==="MCPROUTER_API_KEY_NOT_CONFIGURED"||_.toLowerCase().includes("mcprouter api key not configured"),j(_)}finally{T(!1)}},[n]),D=b.useCallback((B,_,ee=re)=>{const Y=B.length,F=Math.ceil(Y/ee);te(F);const ue=Math.max(1,Math.min(_,F));ue!==_&&ne(ue);const xe=(ue-1)*ee,Ne=B.slice(xe,xe+ee);o(Ne)},[re]),Q=b.useCallback(B=>{ne(B),D(i,B,re)},[i,D,re]),P=b.useCallback(async()=>{try{const B=await Ye("/cloud/categories");B&&B.success&&Array.isArray(B.data)?m(B.data):console.error("Invalid cloud market categories data format:",B)}catch(B){console.error("Error fetching cloud market categories:",B)}},[]),V=b.useCallback(async()=>{try{const B=await Ye("/cloud/tags");B&&B.success&&Array.isArray(B.data)?g(B.data):console.error("Invalid cloud market tags data format:",B)}catch(B){console.error("Error fetching cloud market tags:",B)}},[]),w=b.useCallback(async B=>{try{T(!0);const _=await Ye(`/cloud/servers/${B}`);return _&&_.success&&_.data?($(_.data),_.data):(console.error("Invalid cloud server data format:",_),j(n("cloud.serverNotFound")),null)}catch(_){console.error(`Error fetching cloud server ${B}:`,_);const ee=_ instanceof Error?_.message:String(_);return ee==="MCPROUTER_API_KEY_NOT_CONFIGURED"||ee.toLowerCase().includes("mcprouter api key not configured"),j(ee),null}finally{T(!1)}},[n]),z=b.useCallback(async B=>{try{if(T(!0),S(B),!B.trim()){U();return}const _=await Ye(`/cloud/servers/search?query=${encodeURIComponent(B)}`);_&&_.success&&Array.isArray(_.data)?(u(_.data),ne(1),D(_.data,1)):(console.error("Invalid cloud search results format:",_),j(n("cloud.searchError")))}catch(_){console.error("Error searching cloud servers:",_),j(_ instanceof Error?_.message:String(_))}finally{T(!1)}},[n,i,D,U]),q=b.useCallback(async B=>{try{if(T(!0),y(B),C(""),!B){U();return}const _=await Ye(`/cloud/categories/${encodeURIComponent(B)}`);_&&_.success&&Array.isArray(_.data)?(u(_.data),ne(1),D(_.data,1)):(console.error("Invalid cloud category filter results format:",_),j(n("cloud.filterError")))}catch(_){console.error("Error filtering cloud servers by category:",_),j(_ instanceof Error?_.message:String(_))}finally{T(!1)}},[n,U,D]),de=b.useCallback(async B=>{try{if(T(!0),C(B),y(""),!B){U();return}const _=await Ye(`/cloud/tags/${encodeURIComponent(B)}`);_&&_.success&&Array.isArray(_.data)?(u(_.data),ne(1),D(_.data,1)):(console.error("Invalid cloud tag filter results format:",_),j(n("cloud.tagFilterError")))}catch(_){console.error("Error filtering cloud servers by tag:",_),j(_ instanceof Error?_.message:String(_))}finally{T(!1)}},[n,U,D]),R=b.useCallback(async B=>{try{const _=await Ye(`/cloud/servers/${B}/tools`);if(!_.success)throw console.error("Failed to fetch cloud server tools:",_),new Error(_.message||"Failed to fetch cloud server tools");return _&&_.success&&Array.isArray(_.data)?_.data:(console.error("Invalid cloud server tools data format:",_),[])}catch(_){console.error(`Error fetching tools for cloud server ${B}:`,_);const ee=_ instanceof Error?_.message:String(_);if(ee==="MCPROUTER_API_KEY_NOT_CONFIGURED"||ee.toLowerCase().includes("mcprouter api key not configured"))throw _;return[]}},[]),J=b.useCallback(async(B,_,ee)=>{try{const Y=await St(`/cloud/servers/${B}/tools/${_}/call`,{arguments:ee});if(Y&&Y.success)return Y.data;throw new Error(Y.message||"Failed to call tool")}catch(Y){throw console.error(`Error calling tool ${_} on cloud server ${B}:`,Y),Y}},[]),ie=b.useCallback(B=>{I(B),ne(1),D(i,1,B)},[i,D]);return b.useEffect(()=>{U(),P(),V()},[U,P,V]),{servers:l,allServers:i,categories:d,tags:p,selectedCategory:h,selectedTag:N,searchQuery:E,loading:k,error:A,setError:j,currentServer:M,fetchCloudServers:U,fetchServerByName:w,searchServers:z,filterByCategory:q,filterByTag:de,fetchServerTools:R,callServerTool:J,currentPage:W,totalPages:oe,serversPerPage:re,changePage:Q,changeServersPerPage:ie}},Z1=({server:n,onClick:l})=>{var g,h,y,N;const{t:o}=ve(),i=C=>C.split(" ").map(E=>E.charAt(0)).join("").toUpperCase().slice(0,2),u=()=>{if(!n.tags||n.tags.length===0)return{tagsToShow:[],hasMore:!1,moreCount:0};const C=28,E=M=>M.length+3;let S=0,k=0;const T=[...n.tags].sort((M,$)=>M.length-$.length);for(k=0;k<T.length;k++){const M=E(T[k]);if(S+M>C)break;if(S+=M,k===T.length-1)return{tagsToShow:T,hasMore:!1,moreCount:0}}k===0&&T.length>0&&(k=1);const A=T.length-k,j=3+String(A).length+o("market.moreTags").length;return S+j<=C||k<1?{tagsToShow:T.slice(0,k),hasMore:!0,moreCount:A}:{tagsToShow:T.slice(0,Math.max(1,k-1)),hasMore:!0,moreCount:A+1}},{tagsToShow:d,hasMore:m,moreCount:p}=u();return r.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-4 hover:shadow-lg hover:border-blue-400 hover:-translate-y-1 transition-all duration-300 cursor-pointer group relative overflow-hidden h-full flex flex-col",onClick:()=>l(n),children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-50/0 to-purple-50/0 group-hover:from-blue-50/30 group-hover:to-purple-50/30 transition-all duration-300 pointer-events-none"}),r.jsxs("div",{className:"relative z-10 flex-1 flex flex-col",children:[r.jsxs("div",{className:"flex items-start justify-between mb-2",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"text-lg font-bold text-gray-900 group-hover:text-blue-600 transition-colors duration-200 mb-1 line-clamp-1 mr-2",children:n.display_name}),r.jsxs("div",{className:"flex items-center space-x-2 mb-1",children:[r.jsx("div",{className:"w-6 h-6 bg-gradient-to-br from-blue-500 to-purple-600 rounded-full flex items-center justify-center text-white text-xs font-semibold",children:i(((g=n.author)==null?void 0:g.name)||o("market.unknown"))}),r.jsx("div",{children:r.jsx("p",{className:"text-xs font-medium text-gray-700",children:((h=n.author)==null?void 0:h.name)||o("market.unknown")})})]})]}),r.jsx("div",{className:"flex flex-col items-end space-y-2",children:n.is_official&&r.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800",children:o("market.official")})})]}),r.jsx("div",{className:"mb-2 flex-1",children:r.jsx("p",{className:"text-gray-600 text-sm leading-relaxed line-clamp-2 min-h-[36px]",children:n.description})}),r.jsx("div",{className:"mb-2",children:r.jsx("div",{className:"flex flex-wrap gap-1 min-h-[24px]",children:((y=n.categories)==null?void 0:y.length)>0?n.categories.map((C,E)=>r.jsx("span",{className:"bg-gray-100 text-gray-800 text-xs px-2 py-1 rounded whitespace-nowrap",children:C},E)):r.jsx("span",{className:"text-xs text-gray-400 py-1",children:"-"})})}),r.jsx("div",{className:"mb-2",children:r.jsx("div",{className:"relative min-h-[24px] overflow-x-auto",children:((N=n.tags)==null?void 0:N.length)>0?r.jsxs("div",{className:"flex gap-1 items-center whitespace-nowrap",children:[d.map((C,E)=>r.jsxs("span",{className:"bg-green-50 text-green-700 text-xs px-2 py-1 rounded flex-shrink-0",children:["#",C]},E)),m&&r.jsxs("span",{className:"bg-gray-100 text-gray-600 text-xs px-1.5 py-1 rounded flex-shrink-0",children:["+",p," ",o("market.moreTags")]})]}):r.jsx("span",{className:"text-xs text-gray-400 py-1",children:"-"})})})]})]})},J1=({server:n,onBack:l,onInstall:o,installing:i=!1,isInstalled:u=!1})=>{var oe,te;const{t:d}=ve(),[m,p]=b.useState(!1),[g,h]=b.useState(null),[y,N]=b.useState(!1),[C,E]=b.useState(null),[S,k]=b.useState([]),T=()=>u?{className:"bg-green-600 cursor-default px-4 py-2 rounded text-sm font-medium text-white",disabled:!0,text:d("market.installed")}:i?{className:"bg-gray-400 cursor-not-allowed px-4 py-2 rounded text-sm font-medium text-white",disabled:!0,text:d("market.installing")}:{className:"bg-blue-600 hover:bg-blue-700 px-4 py-2 rounded text-sm font-medium text-white btn-primary",disabled:!1,text:d("market.install")},A=()=>{p(!m),h(null),N(!1),E(null)},j=async()=>{C&&(await M(C),N(!1),E(null))},M=async U=>{try{h(null),o(n,U.config),p(!1)}catch(D){console.error("Error installing server:",D),h(d("errors.serverInstall"))}},$=()=>{u||A()},W=()=>{if(!n.installations)return;if(n.installations.npm)return n.installations.npm;if(n.installations.uvx)return n.installations.uvx;if(n.installations.default)return n.installations.default;const U=Object.keys(n.installations);if(U.length>0)return n.installations[U[0]]},ne=async U=>{try{const D=ng(U);D.length>0?(k(D),E(U),N(!0)):await M(U)}catch(D){console.error("Error processing server installation:",D),h(d("errors.serverInstall"))}},re=T(),I=W();return r.jsxs("div",{className:"bg-white rounded-lg shadow-md p-6",children:[r.jsx("div",{className:"mb-4",children:r.jsxs("button",{onClick:l,className:"text-gray-600 hover:text-gray-900 flex items-center",children:[r.jsx("svg",{className:"h-5 w-5 mr-1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:r.jsx("path",{fillRule:"evenodd",d:"M9.707 16.707a1 1 0 01-1.414 0l-6-6a1 1 0 010-1.414l6-6a1 1 0 011.414 1.414L5.414 9H17a1 1 0 110 2H5.414l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})}),d("market.backToList")]})}),r.jsxs("div",{className:"flex justify-between items-start mb-4",children:[r.jsx("div",{children:r.jsxs("h2",{className:"text-2xl font-bold text-gray-900 flex items-center flex-wrap",children:[n.display_name,r.jsxs("span",{className:"text-sm font-normal text-gray-500 ml-2",children:["(",n.name,")"]}),r.jsxs("span",{className:"text-sm font-normal text-gray-600 ml-4",children:[d("market.author"),": ",n.author.name," • ",d("market.license"),": ",n.license," •",r.jsx("a",{href:n.repository.url,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:underline ml-1",children:d("market.repository")})]})]})}),r.jsxs("div",{className:"flex items-center",children:[n.is_official&&r.jsx("span",{className:"bg-blue-100 text-blue-800 text-sm font-normal px-4 py-2 rounded mr-2 flex items-center label-primary",children:d("market.official")}),r.jsx("button",{onClick:$,disabled:re.disabled,className:re.className,children:re.text})]})]}),r.jsx("p",{className:"text-gray-700 mb-6",children:n.description}),r.jsxs("div",{className:"mb-6",children:[r.jsxs("h3",{className:"text-lg font-semibold mb-3",children:[d("market.categories")," & ",d("market.tags")]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[(oe=n.categories)==null?void 0:oe.map((U,D)=>r.jsx("span",{className:"bg-gray-100 text-gray-800 px-3 py-1 rounded",children:U},`cat-${D}`)),n.tags&&n.tags.map((U,D)=>r.jsxs("span",{className:"bg-gray-100 text-green-700 px-2 py-1 rounded text-sm",children:["#",U]},`tag-${D}`))]})]}),n.arguments&&Object.keys(n.arguments).length>0&&r.jsxs("div",{className:"mb-6",children:[r.jsx("h3",{className:"text-lg font-semibold mb-3",children:d("market.arguments")}),r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[r.jsx("thead",{className:"bg-gray-50 border-b border-gray-200",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider whitespace-nowrap",children:d("market.argumentName")}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider whitespace-nowrap",children:d("market.description")}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider whitespace-nowrap",children:d("market.required")}),r.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider whitespace-nowrap",children:d("market.example")})]})}),r.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:Object.entries(n.arguments).map(([U,D],Q)=>r.jsxs("tr",{children:[r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900",children:U}),r.jsx("td",{className:"px-6 py-4 text-sm text-gray-500",children:D.description}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:D.required?r.jsx("span",{className:"text-green-600",children:"✓"}):r.jsx("span",{className:"text-gray-600",children:"✗"})}),r.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:r.jsx("code",{className:"bg-gray-100 px-2 py-1 rounded",children:D.example})})]},Q))})]})})]}),r.jsxs("div",{className:"mb-6",children:[r.jsx("h3",{className:"text-lg font-semibold mb-3",children:d("market.tools")}),r.jsx("div",{className:"space-y-4",children:(te=n.tools)==null?void 0:te.map((U,D)=>r.jsxs("div",{className:"border border-gray-200 rounded p-4",children:[r.jsxs("h4",{className:"font-medium mb-2",children:[U.name,r.jsx("button",{type:"button",onClick:()=>{const Q=document.getElementById(`schema-${D}`);Q&&Q.classList.toggle("hidden")},className:"text-sm text-blue-500 font-normal hover:underline focus:outline-none ml-2",children:d("market.viewSchema")})]}),r.jsx("p",{className:"text-gray-600 mb-2",children:U.description}),r.jsx("div",{className:"mt-2",children:r.jsx("pre",{id:`schema-${D}`,className:"hidden bg-gray-50 p-3 rounded text-sm overflow-auto mt-2",children:JSON.stringify(U.inputSchema,null,2)})})]},D))})]}),n.examples&&n.examples.length>0&&r.jsxs("div",{className:"mb-6",children:[r.jsx("h3",{className:"text-lg font-semibold mb-3",children:d("market.examples")}),r.jsx("div",{className:"space-y-4",children:n.examples.map((U,D)=>r.jsxs("div",{className:"border border-gray-200 rounded p-4",children:[r.jsx("h4",{className:"font-medium mb-2",children:U.title}),r.jsx("p",{className:"text-gray-600 mb-2",children:U.description}),r.jsx("pre",{className:"bg-gray-50 p-3 rounded text-sm overflow-auto",children:U.prompt})]},D))})]}),r.jsx("div",{className:"mt-6 flex justify-end",children:r.jsx("button",{onClick:$,disabled:re.disabled,className:re.className,children:re.text})}),m&&r.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:r.jsx(Oo,{onSubmit:ne,onCancel:A,modalTitle:d("market.installServer",{name:n.display_name}),formError:g,initialData:{name:n.name,status:"disconnected",config:I?{command:I.command||"",args:I.args||[],env:I.env||{}}:void 0}})}),y&&r.jsx("div",{className:"fixed inset-0 bg-black/50 z-[60] flex items-center justify-center p-4",children:r.jsxs("div",{className:"bg-white rounded-lg p-6 w-full max-w-md",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-4",children:d("server.confirmVariables")}),r.jsx("p",{className:"text-gray-600 mb-4",children:d("server.variablesDetected")}),r.jsx("div",{className:"bg-yellow-50 border border-yellow-200 rounded p-3 mb-4",children:r.jsxs("div",{className:"flex items-start",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx("svg",{className:"h-5 w-5 text-yellow-400",viewBox:"0 0 20 20",fill:"currentColor",children:r.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})})}),r.jsxs("div",{className:"ml-3",children:[r.jsxs("h4",{className:"text-sm font-medium text-yellow-800",children:[d("server.detectedVariables"),":"]}),r.jsx("ul",{className:"mt-1 text-sm text-yellow-700",children:S.map((U,D)=>r.jsxs("li",{className:"font-mono",children:["$",`{${U}}`]},D))})]})]})}),r.jsx("p",{className:"text-gray-600 text-sm mb-6",children:d("market.confirmVariablesMessage")}),r.jsxs("div",{className:"flex justify-end space-x-3",children:[r.jsx("button",{onClick:()=>{N(!1),E(null)},className:"px-4 py-2 text-gray-600 border border-gray-300 rounded hover:bg-gray-50 btn-secondary",children:d("common.cancel")}),r.jsx("button",{onClick:j,className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 btn-primary",children:d("market.confirmAndInstall")})]})]})})]})},W1=({server:n,onClick:l})=>{const{t:o}=ve(),i=()=>{l(n)},u=()=>{if(n.description&&n.description.length<=150)return n.description;if(n.content){const p=n.content.split(`
|
|
211
211
|
`).filter(g=>g.trim());for(const g of p)if(g.length>50&&g.length<=150)return g}return n.description?n.description.slice(0,150)+"...":o("cloud.noDescription")},d=p=>{try{const g=new Date(p),h=g.getFullYear(),y=(g.getMonth()+1).toString().padStart(2,"0"),N=g.getDate().toString().padStart(2,"0");return`${h}/${y}/${N}`}catch{return""}},m=p=>p.split(" ").map(g=>g.charAt(0)).join("").toUpperCase().slice(0,2);return r.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-4 hover:shadow-lg hover:border-blue-400 hover:-translate-y-1 transition-all duration-300 cursor-pointer group relative overflow-hidden h-full flex flex-col",onClick:i,children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-50/0 to-purple-50/0 group-hover:from-blue-50/30 group-hover:to-purple-50/30 transition-all duration-300 pointer-events-none"}),r.jsxs("div",{className:"relative z-10 flex-1 flex flex-col",children:[r.jsxs("div",{className:"flex items-start justify-between mb-3",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"text-lg font-bold text-gray-900 group-hover:text-blue-600 transition-colors duration-200 mb-2 line-clamp-2",children:n.title||n.name}),r.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[r.jsx("div",{className:"w-7 h-7 bg-gradient-to-br from-blue-500 to-purple-600 rounded-full flex items-center justify-center text-white text-xs font-semibold",children:m(n.author_name)}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-gray-700",children:n.author_name}),n.updated_at&&r.jsxs("p",{className:"text-xs text-gray-500",children:[o("cloud.updated")," ",d(n.updated_at)]})]})]})]}),r.jsx("div",{className:"flex flex-col items-end space-y-2",children:r.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800",children:"MCP Server"})})]}),r.jsx("div",{className:"mb-3 flex-1",children:r.jsx("p",{className:"text-gray-600 text-sm leading-relaxed line-clamp-2",children:u()})}),n.tools&&n.tools.length>0&&r.jsx("div",{className:"mb-3",children:r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsxs("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),r.jsxs("span",{className:"text-sm text-gray-600 font-medium",children:[n.tools.length," ",n.tools.length===1?o("cloud.tool"):o("cloud.tools")]})]})}),r.jsxs("div",{className:"flex items-center justify-between pt-3 border-t border-gray-100 mt-auto",children:[r.jsxs("div",{className:"flex items-center space-x-2 text-xs text-gray-500",children:[r.jsx("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z",clipRule:"evenodd"})}),r.jsx("span",{children:d(n.created_at)})]}),r.jsxs("div",{className:"flex items-center text-blue-600 text-sm font-medium group-hover:text-blue-700 transition-colors",children:[r.jsx("span",{children:o("cloud.viewDetails")}),r.jsx("svg",{className:"w-4 h-4 ml-1 transform group-hover:translate-x-1 transition-transform",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})]})]})]})},iu=()=>{const{t:n}=ve(),l=Ka(),o=()=>{l("/settings")},i=()=>{window.open("https://mcprouter.co","_blank","noopener,noreferrer")};return r.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-6 mb-6",children:r.jsxs("div",{className:"flex items-start",children:[r.jsx("div",{className:"flex-shrink-0",children:r.jsx("svg",{className:"h-5 w-5 text-amber-400",viewBox:"0 0 20 20",fill:"currentColor",children:r.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})})}),r.jsxs("div",{className:"ml-3 flex-1",children:[r.jsx("h3",{className:"text-sm font-medium text-amber-800",children:n("cloud.apiKeyNotConfigured")}),r.jsx("div",{className:"mt-2 text-sm text-amber-700",children:r.jsx("p",{children:n("cloud.apiKeyNotConfiguredDescription")})}),r.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[r.jsxs("button",{onClick:i,className:"inline-flex items-center px-3 py-2 text-sm font-medium text-white bg-blue-600 rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-colors duration-200",children:[r.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),n("cloud.getApiKey")]}),r.jsxs("button",{onClick:o,className:"inline-flex items-center px-3 py-2 text-sm font-medium text-amber-800 bg-amber-100 border border-amber-300 rounded-md hover:bg-amber-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-amber-500 transition-colors duration-200",children:[r.jsxs("svg",{className:"w-4 h-4 mr-1.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),n("cloud.configureInSettings")]})]})]})]})})},e2=({serverName:n,onBack:l,onCallTool:o,fetchServerTools:i,onInstall:u,installing:d=!1,isInstalled:m=!1})=>{const{t:p}=ve(),{mcpRouterConfig:g}=_s(),[h,y]=b.useState(null),[N,C]=b.useState(!0),[E,S]=b.useState(null),[k,T]=b.useState([]),[A,j]=b.useState(!1),[M,$]=b.useState(!1),[W,ne]=b.useState(null),[re,I]=b.useState({}),[oe,te]=b.useState({}),[U,D]=b.useState({}),[Q,P]=b.useState(!1),[V,w]=b.useState(null),z=F=>(console.error("Checking for MCPRouter API key error:",F),F==="MCPROUTER_API_KEY_NOT_CONFIGURED"||F.toLowerCase().includes("mcprouter api key not configured")),q=()=>m?{className:"bg-green-600 cursor-default px-4 py-2 rounded text-sm font-medium text-white",disabled:!0,text:p("market.installed")}:d?{className:"bg-gray-400 cursor-not-allowed px-4 py-2 rounded text-sm font-medium text-white",disabled:!0,text:p("market.installing")}:{className:"bg-blue-600 hover:bg-blue-700 px-4 py-2 rounded text-sm font-medium text-white transition-colors",disabled:!1,text:p("market.install")},de=()=>{!m&&u&&(P(!0),w(null))},R=()=>{P(!1),w(null)},J=async F=>{try{if(!h||!u)return;w(null),u(h,F.config),P(!1)}catch(ue){console.error("Error installing server:",ue),w(p("errors.serverInstall"))}};b.useEffect(()=>{(async()=>{try{C(!0),S(null);const ue=await Ye(`/cloud/servers/${n}`);ue&&ue.success&&ue.data?(y(ue.data),T(ue.data.tools||[])):S(p("cloud.serverNotFound"))}catch(ue){console.error("Failed to load server details:",ue),S(ue instanceof Error?ue.message:String(ue))}finally{C(!1)}})()},[n,p]),b.useEffect(()=>{(async()=>{if(h&&(!h.tools||h.tools.length===0)&&i){j(!0),$(!1);try{const ue=await i(h.name);T(ue)}catch(ue){console.error("Failed to load tools:",ue);const xe=ue instanceof Error?ue.message:String(ue);z(xe)&&$(!0)}finally{j(!1)}}})()},[h==null?void 0:h.name,h==null?void 0:h.tools,i]);const ie=F=>{try{const ue=new Date(F),xe=ue.getFullYear(),Ne=String(ue.getMonth()+1).padStart(2,"0"),ye=String(ue.getDate()).padStart(2,"0"),Te=String(ue.getHours()).padStart(2,"0"),He=String(ue.getMinutes()).padStart(2,"0"),lt=String(ue.getSeconds()).padStart(2,"0");return`${xe}-${Ne}-${ye} ${Te}:${He}:${lt}`}catch{return F}},B=(F,ue,xe)=>{te(Ne=>({...Ne,[F]:{...Ne[F],[ue]:xe}}))},_=async F=>{if(!(!o||!h)){ne(F);try{const ue=oe[F]||{},xe=await o(h.server_key,F,ue);I(Ne=>({...Ne,[F]:xe}))}catch(ue){console.error("Tool call failed:",ue);const xe=ue instanceof Error?ue.message:String(ue);I(Ne=>({...Ne,[F]:{error:xe}}))}finally{ne(null)}}},ee=F=>{D(ue=>({...ue,[F]:!ue[F]}))},Y=(F,ue,xe)=>{var Te;const Ne=((Te=oe[F.name])==null?void 0:Te[ue])||"",ye=He=>{let lt=He.target.value;xe.type==="number"||xe.type==="integer"?lt=lt===""?void 0:Number(lt):xe.type==="boolean"&&(lt=He.target.value==="true"),B(F.name,ue,lt)};return xe.type==="boolean"?r.jsxs("select",{value:Ne===!0?"true":Ne===!1?"false":"",onChange:ye,className:"w-full border rounded-md px-3 py-2 border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 form-input",children:[r.jsx("option",{value:""}),r.jsx("option",{value:"true",children:p("common.true")}),r.jsx("option",{value:"false",children:p("common.false")})]}):xe.type==="number"||xe.type==="integer"?r.jsx("input",{type:"number",step:xe.type==="integer"?"1":"any",value:Ne||"",onChange:ye,className:"w-full border rounded-md px-3 py-2 border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 form-input"}):r.jsx("input",{type:"text",value:Ne||"",onChange:ye,className:"w-full border rounded-md px-3 py-2 border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 form-input"})};return r.jsxs("div",{className:"bg-white rounded-lg shadow-md p-6",children:[r.jsx("div",{className:"mb-6",children:r.jsxs("button",{onClick:l,className:"inline-flex items-center text-gray-600 hover:text-gray-900 transition-colors group",children:[r.jsx("svg",{className:"h-5 w-5 mr-2 transform group-hover:-translate-x-1 transition-transform",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:r.jsx("path",{fillRule:"evenodd",d:"M9.707 16.707a1 1 0 01-1.414 0l-6-6a1 1 0 010-1.414l6-6a1 1 0 011.414 1.414L5.414 9H17a1 1 0 110 2H5.414l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})}),p("cloud.backToList")]})}),N?r.jsx("div",{className:"bg-white rounded-xl shadow-sm p-12",children:r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsxs("svg",{className:"animate-spin h-12 w-12 text-blue-500 mb-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[r.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),r.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),r.jsx("p",{className:"text-gray-600 text-lg",children:p("app.loading")})]})}):E&&!z(E)?r.jsx("div",{className:"bg-white rounded-xl shadow-sm p-6",children:r.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4",children:r.jsxs("div",{className:"flex items-center",children:[r.jsx("svg",{className:"h-5 w-5 text-red-400 mr-3",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})}),r.jsx("p",{className:"text-red-700",children:E})]})})}):h?r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"bg-white rounded-xl shadow-sm overflow-hidden",children:r.jsx("div",{className:"bg-gradient-to-r from-gray-100 to-gray-200 px-6 py-4",children:r.jsxs("div",{className:"flex justify-between items-end",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("h1",{className:"text-2xl font-bold text-gray-800 mb-2",children:h.title||h.name}),r.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-gray-600",children:[r.jsx("span",{className:"text-sm bg-white/60 text-gray-700 px-3 py-1 rounded-full",children:h.name}),r.jsxs("div",{className:"flex items-center",children:[r.jsx("svg",{className:"h-4 w-4 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z",clipRule:"evenodd"})}),p("cloud.by")," ",h.author_name]})]})]}),r.jsxs("div",{className:"text-right flex flex-col items-end gap-3",children:[r.jsxs("div",{className:"text-xs text-gray-500",children:[p("cloud.updated"),": ",ie(h.updated_at)]}),u&&!z(E||"")&&!M&&r.jsx("button",{onClick:de,disabled:q().disabled,className:q().className,children:q().text})]})]})})}),r.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-6",children:[r.jsxs("h2",{className:"text-xl font-semibold text-gray-900 mb-4 flex items-center",children:[r.jsx("svg",{className:"h-5 w-5 text-gray-500 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),p("cloud.description")]}),r.jsx("p",{className:"text-gray-700 leading-relaxed",children:h.description})]}),h.content&&r.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-6",children:[r.jsxs("h2",{className:"text-xl font-semibold text-gray-900 mb-4 flex items-center",children:[r.jsx("svg",{className:"h-5 w-5 text-gray-500 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})}),p("cloud.details")]}),r.jsx("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-4 overflow-auto",children:r.jsx("pre",{className:"text-sm text-gray-800 whitespace-pre-wrap",children:h.content})})]}),r.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-6",children:[r.jsxs("h2",{className:"text-xl font-semibold text-gray-900 mb-4 flex items-center",children:[r.jsxs("svg",{className:"h-5 w-5 text-gray-500 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),p("cloud.tools"),k.length>0&&r.jsx("span",{className:"ml-2 bg-blue-100 text-blue-800 text-sm font-medium px-2.5 py-0.5 rounded-full",children:k.length})]}),M&&r.jsx(iu,{}),A?r.jsxs("div",{className:"flex items-center justify-center py-12",children:[r.jsxs("svg",{className:"animate-spin h-8 w-8 text-blue-500 mr-3",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[r.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),r.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),r.jsx("span",{className:"text-gray-600",children:p("cloud.loadingTools")})]}):k.length===0&&!M?r.jsxs("div",{className:"text-center py-12",children:[r.jsx("svg",{className:"h-12 w-12 text-gray-400 mx-auto mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"})}),r.jsx("p",{className:"text-gray-600",children:p("cloud.noTools")})]}):k.length>0?r.jsx("div",{className:"space-y-4",children:k.map((F,ue)=>r.jsxs("div",{className:"border border-gray-200 rounded-lg p-6 hover:border-gray-300 transition-colors",children:[r.jsxs("div",{className:"flex justify-between items-start mb-4",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("h3",{className:"text-lg font-medium text-gray-900 mb-2 flex items-center",children:[r.jsx("span",{className:"bg-blue-100 text-blue-800 text-xs font-medium px-2 py-1 rounded mr-3",children:"TOOL"}),F.name]}),r.jsx("p",{className:"text-gray-600 leading-relaxed whitespace-pre-wrap",children:F.description})]}),o&&r.jsx("button",{onClick:()=>_(F.name),disabled:W===F.name,className:"ml-4 bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors flex items-center min-w-[100px] justify-center",children:W===F.name?r.jsxs(r.Fragment,{children:[r.jsxs("svg",{className:"animate-spin h-4 w-4 mr-2",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[r.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),r.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),p("cloud.calling")]}):r.jsxs(r.Fragment,{children:[r.jsx("svg",{className:"h-4 w-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14.828 14.828a4 4 0 01-5.656 0M9 10h6m2 8l4-4H7l4 4z"})}),p("cloud.callTool")]})})]}),F.inputSchema&&F.inputSchema.properties&&Object.keys(F.inputSchema.properties).length>0&&r.jsxs("div",{className:"border-t border-gray-100 pt-4",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700",children:p("cloud.parameters")}),r.jsxs("button",{onClick:()=>ee(F.name),className:"text-sm text-blue-600 hover:text-blue-800 focus:outline-none flex items-center gap-1 transition-colors",children:[p("cloud.viewSchema"),r.jsx("svg",{className:`h-3 w-3 transition-transform duration-200 ${U[F.name]?"rotate-90":"rotate-0"}`,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:r.jsx("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"})})]})]}),U[F.name]&&r.jsx("div",{className:"mb-4",children:r.jsx("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-3 overflow-auto",children:r.jsx("pre",{className:"text-sm text-gray-800",children:JSON.stringify(F.inputSchema,null,2)})})}),r.jsx("div",{className:"space-y-4",children:Object.entries(F.inputSchema.properties).map(([xe,Ne])=>{var ye;return r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:"block text-sm font-medium text-gray-700",children:[xe,((ye=F.inputSchema.required)==null?void 0:ye.includes(xe))&&r.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),Ne.description&&r.jsx("p",{className:"text-xs text-gray-500",children:Ne.description}),Y(F,xe,Ne)]},xe)})})]}),re[F.name]&&r.jsx("div",{className:"border-t border-gray-100 pt-4 mt-4",children:re[F.name].error?r.jsx(r.Fragment,{children:z(re[F.name].error)?r.jsx(iu,{}):r.jsxs(r.Fragment,{children:[r.jsxs("h4",{className:"text-sm font-medium text-red-600 mb-3 flex items-center",children:[r.jsx("svg",{className:"h-4 w-4 text-red-500 mr-2",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})}),p("cloud.error")]}),r.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4",children:r.jsx("pre",{className:"text-sm text-red-800 whitespace-pre-wrap overflow-auto",children:re[F.name].error})})]})}):r.jsxs(r.Fragment,{children:[r.jsxs("h4",{className:"text-sm font-medium text-gray-700 mb-3 flex items-center",children:[r.jsx("svg",{className:"h-4 w-4 text-green-500 mr-2",fill:"currentColor",viewBox:"0 0 20 20",children:r.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),p("cloud.result")]}),r.jsx("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-4",children:r.jsx("pre",{className:"text-sm text-gray-800 whitespace-pre-wrap overflow-auto",children:JSON.stringify(re[F.name],null,2)})})]})})]},ue))}):null]})]}):r.jsx("div",{className:"bg-white rounded-xl shadow-sm p-12",children:r.jsxs("div",{className:"text-center",children:[r.jsx("svg",{className:"h-12 w-12 text-gray-400 mx-auto mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M9.172 16.172a4 4 0 015.656 0M9 12h6m-6-4h6m2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})}),r.jsx("p",{className:"text-gray-600 text-lg",children:p("cloud.serverNotFound")})]})}),Q&&h&&r.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",children:r.jsx(Oo,{onSubmit:J,onCancel:R,modalTitle:p("cloud.installServer",{name:h.title||h.name}),formError:V,initialData:{name:h.name,status:"disconnected",config:{type:"streamable-http",url:h.server_url,headers:{Authorization:`Bearer ${g.apiKey||"<MCPROUTER_API_KEY>"}`,"HTTP-Referer":g.referer||"<YOUR_APP_URL>","X-Title":g.title||"<YOUR_APP_NAME>"}}}})})]})},t2=({currentPage:n,totalPages:l,onPageChange:o})=>{const i=()=>{const u=[];u.push(r.jsx("button",{onClick:()=>o(1),className:`px-3 py-1 mx-1 rounded ${n===1?"bg-blue-500 text-white btn-primary":"bg-gray-200 hover:bg-gray-300 text-gray-700 btn-secondary"}`,children:"1"},"first"));const m=Math.max(2,n-Math.floor(5/2));m>2&&u.push(r.jsx("span",{className:"px-3 py-1",children:"..."},"ellipsis1"));for(let p=m;p<=Math.min(l-1,m+5-3);p++)u.push(r.jsx("button",{onClick:()=>o(p),className:`px-3 py-1 mx-1 rounded ${n===p?"bg-blue-500 text-white btn-primary":"bg-gray-200 hover:bg-gray-300 text-gray-700 btn-secondary"}`,children:p},p));return m+5-3<l-1&&u.push(r.jsx("span",{className:"px-3 py-1",children:"..."},"ellipsis2")),l>1&&u.push(r.jsx("button",{onClick:()=>o(l),className:`px-3 py-1 mx-1 rounded ${n===l?"bg-blue-500 text-white btn-primary":"bg-gray-200 hover:bg-gray-300 text-gray-700 btn-secondary"}`,children:l},"last")),u};return l<=1?null:r.jsxs("div",{className:"flex justify-center items-center my-6",children:[r.jsx("button",{onClick:()=>o(Math.max(1,n-1)),disabled:n===1,className:`px-3 py-1 rounded mr-2 ${n===1?"bg-gray-100 text-gray-400 cursor-not-allowed":"bg-gray-200 hover:bg-gray-300 text-gray-700 btn-secondary"}`,children:"« Prev"}),r.jsx("div",{className:"flex",children:i()}),r.jsx("button",{onClick:()=>o(Math.min(l,n+1)),disabled:n===l,className:`px-3 py-1 rounded ml-2 ${n===l?"bg-gray-100 text-gray-400 cursor-not-allowed":"bg-gray-200 hover:bg-gray-300 text-gray-700 btn-secondary"}`,children:"Next »"})]})},Bh=()=>{const{t:n}=ve(),l=Ka(),{serverName:o}=hp(),{showToast:i}=Xn(),[u,d]=Jy(),m=u.get("tab")||"cloud",{servers:p,allServers:g,categories:h,loading:y,error:N,setError:C,searchServers:E,filterByCategory:S,filterByTag:k,selectedCategory:T,selectedTag:A,installServer:j,fetchServerByName:M,isServerInstalled:$,currentPage:W,totalPages:ne,changePage:re,serversPerPage:I,changeServersPerPage:oe}=X1(),{servers:te,allServers:U,loading:D,error:Q,setError:P,fetchServerTools:V,callServerTool:w,currentPage:z,totalPages:q,changePage:de,serversPerPage:R,changeServersPerPage:J}=Q1(),[ie,B]=b.useState(null),[_,ee]=b.useState(null),[Y,F]=b.useState(""),[ue,xe]=b.useState(!1),[Ne,ye]=b.useState(new Set);b.useEffect(()=>{(async()=>{if(o)if(m==="cloud"){const Le=te.find(fe=>fe.name===o);Le?ee(Le):l("/market?tab=cloud")}else{const Le=await M(o);Le?B(Le):l("/market?tab=local")}else B(null),ee(null)})()},[o,m,te,M,l]);const Te=Ee=>{const Le=new URLSearchParams(u);Le.set("tab",Ee),d(Le),o&&l("/market?"+Le.toString())},He=Ee=>{Ee.preventDefault(),m==="local"&&E(Y)},lt=Ee=>{m==="local"&&S(Ee)},wa=()=>{F(""),m==="local"&&(S(""),k(""))},ca=Ee=>{l(m==="cloud"?`/market/${Ee.name}?tab=cloud`:`/market/${Ee.name}?tab=local`)},ze=()=>{l(`/market?tab=${m}`)},vt=async(Ee,Le)=>{try{xe(!0),await j(Ee,Le)&&i(n("market.installSuccess",{serverName:Ee.display_name}),"success")}finally{xe(!1)}},ua=async(Ee,Le)=>{try{xe(!0);const fe={name:Ee.name,config:Le},ce=await St("/servers",fe);if(!ce.success){const me=(ce==null?void 0:ce.message)||n("server.addError");i(me,"error");return}ye(me=>new Set(me).add(Ee.name)),i(n("cloud.installSuccess",{name:Ee.title||Ee.name}),"success")}catch(fe){console.error("Error installing cloud server:",fe);const ce=fe instanceof Error?fe.message:String(fe);i(n("cloud.installError",{error:ce}),"error")}finally{xe(!1)}},da=async(Ee,Le,fe)=>{try{const ce=await w(Ee,Le,fe);return i(n("cloud.toolCallSuccess",{toolName:Le}),"success"),ce}catch(ce){const me=ce instanceof Error?ce.message:String(ce);throw Ft(me)||i(n("cloud.toolCallError",{toolName:Le,error:me}),"error"),ce}},Ft=Ee=>Ee==="MCPROUTER_API_KEY_NOT_CONFIGURED"||Ee.toLowerCase().includes("mcprouter api key not configured"),fa=Ee=>{m==="local"?re(Ee):de(Ee),window.scrollTo({top:0,behavior:"smooth"})},xr=Ee=>{const Le=parseInt(Ee.target.value,10);m==="local"?oe(Le):J(Le)};if(ie)return r.jsx(J1,{server:ie,onBack:ze,onInstall:vt,installing:ue,isInstalled:$(ie.name)});if(_)return r.jsx(e2,{serverName:_.name,onBack:ze,onCallTool:da,fetchServerTools:V,onInstall:ua,installing:ue,isInstalled:Ne.has(_.name)});const Ie=m==="local",yr=Ie?p:te,zt=Ie?g:U,ot=Ie?h:[],At=Ie?y:D,rt=Ie?N:Q,qr=Ie?C:P,Fa=Ie?T:"",Vr=Ie?A:"",Lt=Ie?W:z,ja=Ie?ne:q,wt=Ie?I:R;return r.jsxs("div",{children:[r.jsx("div",{className:"mb-6",children:r.jsx("div",{className:"border-b border-gray-200",children:r.jsxs("nav",{className:"-mb-px flex space-x-3",children:[r.jsxs("button",{onClick:()=>Te("cloud"),className:`py-2 px-1 border-b-2 font-medium text-lg hover:cursor-pointer transition-colors duration-200 ${Ie?"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300":"border-blue-500 text-blue-600"}`,children:[n("cloud.title"),r.jsxs("span",{className:"text-xs text-gray-400 font-normal ml-1",children:["(",r.jsx("a",{href:"https://mcprouter.co",target:"_blank",rel:"noopener noreferrer",className:"external-link",children:"MCPRouter"}),")"]})]}),r.jsxs("button",{onClick:()=>Te("local"),className:`py-2 px-1 border-b-2 font-medium text-lg hover:cursor-pointer transition-colors duration-200 ${Ie?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:[n("market.title"),r.jsxs("span",{className:"text-xs text-gray-400 font-normal ml-1",children:["(",r.jsx("a",{href:"https://mcpm.sh",target:"_blank",rel:"noopener noreferrer",className:"external-link",children:"MCPM"}),")"]})]})]})})}),rt&&r.jsx(r.Fragment,{children:!Ie&&Ft(rt)?r.jsx(iu,{}):r.jsx("div",{className:"bg-red-100 border-l-4 border-red-500 text-red-700 p-4 mb-6 error-box rounded-lg",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{children:rt}),r.jsx("button",{onClick:()=>qr(null),className:"text-red-700 hover:text-red-900 transition-colors duration-200",children:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:r.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 011.414 0L10 8.586l4.293-4.293a1 1 01.414 1.414L11.414 10l4.293 4.293a1 1 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 01-1.414-1.414L8.586 10 4.293 5.707a1 1 010-1.414z",clipRule:"evenodd"})})})]})})}),Ie&&r.jsx("div",{className:"bg-white shadow rounded-lg p-6 mb-6 page-card",children:r.jsxs("form",{onSubmit:He,className:"flex space-x-4 mb-0",children:[r.jsx("div",{className:"flex-grow",children:r.jsx("input",{type:"text",value:Y,onChange:Ee=>F(Ee.target.value),placeholder:n("market.searchPlaceholder"),className:"shadow appearance-none border border-gray-200 rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline form-input"})}),r.jsx("button",{type:"submit",className:"px-4 py-2 bg-blue-100 text-blue-800 rounded hover:bg-blue-200 flex items-center btn-primary transition-all duration-200",children:n("market.search")}),(Y||Fa||Vr)&&r.jsx("button",{type:"button",onClick:wa,className:"border border-gray-300 text-gray-700 font-medium py-2 px-4 rounded hover:bg-gray-50 btn-secondary transition-all duration-200",children:n("market.clearFilters")})]})}),r.jsxs("div",{className:"flex flex-col md:flex-row gap-6",children:[Ie&&r.jsx("div",{className:"md:w-48 flex-shrink-0",children:r.jsx("div",{className:"bg-white shadow rounded-lg p-4 mb-6 sticky top-4 page-card",children:ot.length>0?r.jsxs("div",{className:"mb-6",children:[r.jsxs("div",{className:"flex justify-between items-center mb-3",children:[r.jsx("h3",{className:"font-medium text-gray-900",children:n("market.categories")}),Fa&&r.jsx("span",{className:"text-xs text-blue-600 cursor-pointer hover:underline transition-colors duration-200",onClick:()=>S(""),children:n("market.clearCategoryFilter")})]}),r.jsx("div",{className:"flex flex-col gap-2",children:ot.map(Ee=>r.jsx("button",{onClick:()=>lt(Ee),className:`px-3 py-2 rounded text-sm text-left transition-all duration-200 ${Fa===Ee?"bg-blue-100 text-blue-800 font-medium btn-primary":"bg-gray-100 text-gray-800 hover:bg-gray-200 btn-secondary"}`,children:Ee},Ee))})]}):At?r.jsxs("div",{className:"mb-6",children:[r.jsx("div",{className:"mb-3",children:r.jsx("h3",{className:"font-medium text-gray-900",children:n("market.categories")})}),r.jsxs("div",{className:"flex flex-col gap-2 items-center py-4 loading-container",children:[r.jsxs("svg",{className:"animate-spin h-6 w-6 text-blue-500 mb-2",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[r.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),r.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),r.jsx("p",{className:"text-sm text-gray-600",children:n("app.loading")})]})]}):r.jsxs("div",{className:"mb-6",children:[r.jsx("div",{className:"mb-3",children:r.jsx("h3",{className:"font-medium text-gray-900",children:n("market.categories")})}),r.jsx("p",{className:"text-sm text-gray-600 py-2",children:n("market.noCategories")})]})})}),r.jsx("div",{className:"flex-grow",children:At?r.jsx("div",{className:"bg-white shadow rounded-lg p-6 flex items-center justify-center",children:r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsxs("svg",{className:"animate-spin h-10 w-10 text-blue-500 mb-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[r.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),r.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),r.jsx("p",{className:"text-gray-600",children:n("app.loading")})]})}):yr.length===0?r.jsx("div",{className:"bg-white shadow rounded-lg p-6",children:r.jsx("p",{className:"text-gray-600",children:n(Ie?"market.noServers":"cloud.noServers")})}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-2 xl:grid-cols-3 gap-6",children:yr.map((Ee,Le)=>Ie?r.jsx(Z1,{server:Ee,onClick:ca},Le):r.jsx(W1,{server:Ee,onClick:ca},Le))}),r.jsxs("div",{className:"flex justify-between items-center mb-4",children:[r.jsx("div",{className:"text-sm text-gray-500",children:Ie?n("market.showing",{from:(Lt-1)*wt+1,to:Math.min(Lt*wt,zt.length),total:zt.length}):n("cloud.showing",{from:(Lt-1)*wt+1,to:Math.min(Lt*wt,zt.length),total:zt.length})}),r.jsx(t2,{currentPage:Lt,totalPages:ja,onPageChange:fa}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsxs("label",{htmlFor:"perPage",className:"text-sm text-gray-600",children:[n(Ie?"market.perPage":"cloud.perPage"),":"]}),r.jsxs("select",{id:"perPage",value:wt,onChange:xr,className:"border rounded p-1 text-sm btn-secondary outline-none",children:[r.jsx("option",{value:"6",children:"6"}),r.jsx("option",{value:"9",children:"9"}),r.jsx("option",{value:"12",children:"12"}),r.jsx("option",{value:"24",children:"24"})]})]})]}),r.jsx("div",{className:"mt-6"})]})})]})]})},a2={default:"bg-blue-500 text-white hover:bg-blue-600 focus:ring-blue-500",outline:"border border-gray-300 dark:border-gray-700 bg-transparent hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-300",ghost:"bg-transparent hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-700 dark:text-gray-300",link:"bg-transparent underline-offset-4 hover:underline text-blue-500 hover:text-blue-600",destructive:"bg-red-500 text-white hover:bg-red-600 focus:ring-red-500"},r2={default:"h-10 py-2 px-4",sm:"h-8 px-3 text-sm",lg:"h-12 px-6",icon:"h-10 w-10 p-0"};function s2({variant:n="default",size:l="default",className:o,disabled:i,children:u,...d}){return r.jsx("button",{className:qa("rounded-md inline-flex items-center justify-center font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none",a2[n],r2[l],o),disabled:i,...d,children:u})}const n2=({logs:n,isLoading:l=!1,error:o=null,onClear:i})=>{const{t:u}=ve(),d=b.useRef(null),[m,p]=b.useState(!0),[g,h]=b.useState(""),[y,N]=b.useState(["info","error","warn","debug"]),[C,E]=b.useState(["main","child"]);b.useEffect(()=>{m&&d.current&&(d.current.scrollTop=d.current.scrollHeight)},[n,m]);const S=n.filter(j=>{const M=g?j.message.toLowerCase().includes(g.toLowerCase()):!0,$=y.includes(j.type),W=C.includes(j.source);return M&&$&&W}),k=j=>new Date(j).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),T=j=>{switch(j){case"error":return"bg-red-400/80 text-white";case"warn":return"bg-yellow-400/80 text-gray-900";case"debug":return"bg-purple-400/80 text-white";case"info":return"bg-blue-400/80 text-white";default:return"bg-blue-400/80 text-white"}},A=j=>{switch(j){case"main":return"bg-green-400/80 text-white";case"child":return"bg-orange-400/80 text-white";default:return"bg-gray-400/80 text-white"}};return r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:"bg-card p-3 rounded-t-md flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("span",{className:"font-semibold text-sm",children:[u("logs.filters"),":"]}),r.jsx("input",{type:"text",placeholder:u("logs.search"),className:"shadow appearance-none border border-gray-200 rounded py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline form-input",value:g,onChange:j=>h(j.target.value)}),r.jsx("div",{className:"flex gap-1 items-center",children:["debug","info","error","warn"].map(j=>r.jsx(po,{variant:y.includes(j)?"default":"outline",className:`cursor-pointer ${y.includes(j)?T(j):""}`,onClick:()=>{y.includes(j)?N(M=>M.filter($=>$!==j)):N(M=>[...M,j])},children:j},j))}),r.jsx("div",{className:"flex gap-1 items-center ml-2",children:["main","child"].map(j=>r.jsx(po,{variant:C.includes(j)?"default":"outline",className:`cursor-pointer ${C.includes(j)?A(j):""}`,onClick:()=>{C.includes(j)?E(M=>M.filter($=>$!==j)):E(M=>[...M,j])},children:u(j==="main"?"logs.mainProcess":"logs.childProcess")},j))})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("label",{className:"flex items-center gap-1 text-sm",children:[r.jsx("input",{type:"checkbox",checked:m,onChange:()=>p(!m),className:"form-checkbox h-4 w-4"}),u("logs.autoScroll")]}),r.jsx(s2,{variant:"outline",size:"sm",onClick:i,className:"btn-secondary",disabled:l||n.length===0,children:u("logs.clearLogs")})]})]}),r.jsx("div",{ref:d,className:"flex-grow p-2 overflow-auto bg-card rounded-b-md font-mono text-sm",style:{maxHeight:"calc(100vh - 300px)"},children:l?r.jsx("div",{className:"flex justify-center items-center h-full",children:r.jsx("span",{children:u("logs.loading")})}):o?r.jsx("div",{className:"text-red-500 p-2",children:o.message}):S.length===0?r.jsx("div",{className:"text-center text-muted-foreground p-8",children:g||y.length<4||C.length<2?u("logs.noMatch"):u("logs.noLogs")}):S.map((j,M)=>r.jsxs("div",{className:`py-1 ${j.type==="error"?"text-red-500":j.type==="warn"?"text-yellow-500":""}`,children:[r.jsxs("span",{className:"text-gray-400",children:["[",k(j.timestamp),"]"]}),r.jsx(po,{className:`ml-2 mr-1 ${T(j.type)}`,children:j.type}),r.jsxs(po,{variant:"default",className:`mr-2 ${A(j.source)}`,children:[j.source==="main"?u("logs.main"):u("logs.child"),j.processId?` (${j.processId})`:""]}),r.jsx("span",{className:"whitespace-pre-wrap",children:j.message})]},`${j.timestamp}-${M}`))})]})},l2=async()=>{try{const n=await qn("/logs");if(!n.success)throw new Error(n.error||"Failed to clear logs")}catch(n){throw console.error("Error clearing logs:",n),n}},o2=()=>{const[n,l]=b.useState([]),[o,i]=b.useState(!0),[u,d]=b.useState(null);return b.useEffect(()=>{let p=null,g=!0;const h=()=>{try{p&&p.close();const y=In();p=new EventSource(vu(`/logs/stream?token=${y}`)),p.onmessage=N=>{if(g)try{const C=JSON.parse(N.data);C.type==="initial"?(l(C.logs),i(!1)):C.type==="log"&&l(E=>[...E,C.log])}catch(C){console.error("Error parsing SSE message:",C)}},p.onerror=()=>{g&&(p&&(p.close(),setTimeout(h,5e3)),d(new Error("Connection to log stream lost, attempting to reconnect...")))}}catch(y){if(!g)return;d(y instanceof Error?y:new Error("Failed to connect to log stream")),i(!1)}};return h(),()=>{g=!1,p&&p.close()}},[]),{logs:n,loading:o,error:u,clearLogs:async()=>{try{await l2(),l([])}catch(p){d(p instanceof Error?p:new Error("Failed to clear logs"))}}}},i2=()=>{const{t:n}=ve(),{logs:l,loading:o,error:i,clearLogs:u}=o2();return r.jsxs("div",{className:"container mx-auto p-4",children:[r.jsx("div",{className:"flex justify-between items-center mb-4",children:r.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:n("pages.logs.title")})}),r.jsx("div",{className:"bg-card rounded-md shadow-sm border border-gray-200 page-card",children:r.jsx(n2,{logs:l,isLoading:o,error:i,onClear:u})})]})},c2=()=>{const{serverName:n}=hp();return r.jsx(jo,{to:`/market/${n}?tab=cloud`,replace:!0})};function qh(){const n=bu();return r.jsx(Wv,{children:r.jsx(gb,{children:r.jsx(e1,{children:r.jsx(Zv,{children:r.jsx(Yy,{basename:n,children:r.jsxs(Sy,{children:[r.jsx(Tt,{path:"/login",element:r.jsx(y1,{})}),r.jsx(Tt,{element:r.jsx(x1,{}),children:r.jsxs(Tt,{element:r.jsx(g1,{}),children:[r.jsx(Tt,{path:"/",element:r.jsx(b1,{})}),r.jsx(Tt,{path:"/servers",element:r.jsx(_1,{})}),r.jsx(Tt,{path:"/groups",element:r.jsx(q1,{})}),r.jsx(Tt,{path:"/users",element:r.jsx(F1,{})}),r.jsx(Tt,{path:"/market",element:r.jsx(Bh,{})}),r.jsx(Tt,{path:"/market/:serverName",element:r.jsx(Bh,{})}),r.jsx(Tt,{path:"/cloud",element:r.jsx(jo,{to:"/market?tab=cloud",replace:!0})}),r.jsx(Tt,{path:"/cloud/:serverName",element:r.jsx(c2,{})}),r.jsx(Tt,{path:"/logs",element:r.jsx(i2,{})}),r.jsx(Tt,{path:"/settings",element:r.jsx(Y1,{})})]})}),r.jsx(Tt,{path:"*",element:r.jsx(jo,{to:"/"})})]})})})})})})}const Ce=n=>typeof n=="string",Pn=()=>{let n,l;const o=new Promise((i,u)=>{n=i,l=u});return o.resolve=n,o.reject=l,o},Vh=n=>n==null?"":""+n,u2=(n,l,o)=>{n.forEach(i=>{l[i]&&(o[i]=l[i])})},d2=/###/g,Gh=n=>n&&n.indexOf("###")>-1?n.replace(d2,"."):n,Kh=n=>!n||Ce(n),Hn=(n,l,o)=>{const i=Ce(l)?l.split("."):l;let u=0;for(;u<i.length-1;){if(Kh(n))return{};const d=Gh(i[u]);!n[d]&&o&&(n[d]=new o),Object.prototype.hasOwnProperty.call(n,d)?n=n[d]:n={},++u}return Kh(n)?{}:{obj:n,k:Gh(i[u])}},Fh=(n,l,o)=>{const{obj:i,k:u}=Hn(n,l,Object);if(i!==void 0||l.length===1){i[u]=o;return}let d=l[l.length-1],m=l.slice(0,l.length-1),p=Hn(n,m,Object);for(;p.obj===void 0&&m.length;)d=`${m[m.length-1]}.${d}`,m=m.slice(0,m.length-1),p=Hn(n,m,Object),p!=null&&p.obj&&typeof p.obj[`${p.k}.${d}`]<"u"&&(p.obj=void 0);p.obj[`${p.k}.${d}`]=o},f2=(n,l,o,i)=>{const{obj:u,k:d}=Hn(n,l,Object);u[d]=u[d]||[],u[d].push(o)},So=(n,l)=>{const{obj:o,k:i}=Hn(n,l);if(o&&Object.prototype.hasOwnProperty.call(o,i))return o[i]},m2=(n,l,o)=>{const i=So(n,o);return i!==void 0?i:So(l,o)},og=(n,l,o)=>{for(const i in l)i!=="__proto__"&&i!=="constructor"&&(i in n?Ce(n[i])||n[i]instanceof String||Ce(l[i])||l[i]instanceof String?o&&(n[i]=l[i]):og(n[i],l[i],o):n[i]=l[i]);return n},Ts=n=>n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var h2={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const p2=n=>Ce(n)?n.replace(/[&<>"'\/]/g,l=>h2[l]):n;class g2{constructor(l){this.capacity=l,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(l){const o=this.regExpMap.get(l);if(o!==void 0)return o;const i=new RegExp(l);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(l,i),this.regExpQueue.push(l),i}}const x2=[" ",",","?","!",";"],y2=new g2(20),b2=(n,l,o)=>{l=l||"",o=o||"";const i=x2.filter(m=>l.indexOf(m)<0&&o.indexOf(m)<0);if(i.length===0)return!0;const u=y2.getRegExp(`(${i.map(m=>m==="?"?"\\?":m).join("|")})`);let d=!u.test(n);if(!d){const m=n.indexOf(o);m>0&&!u.test(n.substring(0,m))&&(d=!0)}return d},cu=(n,l,o=".")=>{if(!n)return;if(n[l])return Object.prototype.hasOwnProperty.call(n,l)?n[l]:void 0;const i=l.split(o);let u=n;for(let d=0;d<i.length;){if(!u||typeof u!="object")return;let m,p="";for(let g=d;g<i.length;++g)if(g!==d&&(p+=o),p+=i[g],m=u[p],m!==void 0){if(["string","number","boolean"].indexOf(typeof m)>-1&&g<i.length-1)continue;d+=g-d+1;break}u=m}return u},Gn=n=>n==null?void 0:n.replace("_","-"),v2={type:"logger",log(n){this.output("log",n)},warn(n){this.output("warn",n)},error(n){this.output("error",n)},output(n,l){var o,i;(i=(o=console==null?void 0:console[n])==null?void 0:o.apply)==null||i.call(o,console,l)}};class Co{constructor(l,o={}){this.init(l,o)}init(l,o={}){this.prefix=o.prefix||"i18next:",this.logger=l||v2,this.options=o,this.debug=o.debug}log(...l){return this.forward(l,"log","",!0)}warn(...l){return this.forward(l,"warn","",!0)}error(...l){return this.forward(l,"error","")}deprecate(...l){return this.forward(l,"warn","WARNING DEPRECATED: ",!0)}forward(l,o,i,u){return u&&!this.debug?null:(Ce(l[0])&&(l[0]=`${i}${this.prefix} ${l[0]}`),this.logger[o](l))}create(l){return new Co(this.logger,{prefix:`${this.prefix}:${l}:`,...this.options})}clone(l){return l=l||this.options,l.prefix=l.prefix||this.prefix,new Co(this.logger,l)}}var va=new Co;class Do{constructor(){this.observers={}}on(l,o){return l.split(" ").forEach(i=>{this.observers[i]||(this.observers[i]=new Map);const u=this.observers[i].get(o)||0;this.observers[i].set(o,u+1)}),this}off(l,o){if(this.observers[l]){if(!o){delete this.observers[l];return}this.observers[l].delete(o)}}emit(l,...o){this.observers[l]&&Array.from(this.observers[l].entries()).forEach(([u,d])=>{for(let m=0;m<d;m++)u(...o)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([u,d])=>{for(let m=0;m<d;m++)u.apply(u,[l,...o])})}}class $h extends Do{constructor(l,o={ns:["translation"],defaultNS:"translation"}){super(),this.data=l||{},this.options=o,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(l){this.options.ns.indexOf(l)<0&&this.options.ns.push(l)}removeNamespaces(l){const o=this.options.ns.indexOf(l);o>-1&&this.options.ns.splice(o,1)}getResource(l,o,i,u={}){var h,y;const d=u.keySeparator!==void 0?u.keySeparator:this.options.keySeparator,m=u.ignoreJSONStructure!==void 0?u.ignoreJSONStructure:this.options.ignoreJSONStructure;let p;l.indexOf(".")>-1?p=l.split("."):(p=[l,o],i&&(Array.isArray(i)?p.push(...i):Ce(i)&&d?p.push(...i.split(d)):p.push(i)));const g=So(this.data,p);return!g&&!o&&!i&&l.indexOf(".")>-1&&(l=p[0],o=p[1],i=p.slice(2).join(".")),g||!m||!Ce(i)?g:cu((y=(h=this.data)==null?void 0:h[l])==null?void 0:y[o],i,d)}addResource(l,o,i,u,d={silent:!1}){const m=d.keySeparator!==void 0?d.keySeparator:this.options.keySeparator;let p=[l,o];i&&(p=p.concat(m?i.split(m):i)),l.indexOf(".")>-1&&(p=l.split("."),u=o,o=p[1]),this.addNamespaces(o),Fh(this.data,p,u),d.silent||this.emit("added",l,o,i,u)}addResources(l,o,i,u={silent:!1}){for(const d in i)(Ce(i[d])||Array.isArray(i[d]))&&this.addResource(l,o,d,i[d],{silent:!0});u.silent||this.emit("added",l,o,i)}addResourceBundle(l,o,i,u,d,m={silent:!1,skipCopy:!1}){let p=[l,o];l.indexOf(".")>-1&&(p=l.split("."),u=i,i=o,o=p[1]),this.addNamespaces(o);let g=So(this.data,p)||{};m.skipCopy||(i=JSON.parse(JSON.stringify(i))),u?og(g,i,d):g={...g,...i},Fh(this.data,p,g),m.silent||this.emit("added",l,o,i)}removeResourceBundle(l,o){this.hasResourceBundle(l,o)&&delete this.data[l][o],this.removeNamespaces(o),this.emit("removed",l,o)}hasResourceBundle(l,o){return this.getResource(l,o)!==void 0}getResourceBundle(l,o){return o||(o=this.options.defaultNS),this.getResource(l,o)}getDataByLanguage(l){return this.data[l]}hasLanguageSomeTranslations(l){const o=this.getDataByLanguage(l);return!!(o&&Object.keys(o)||[]).find(u=>o[u]&&Object.keys(o[u]).length>0)}toJSON(){return this.data}}var ig={processors:{},addPostProcessor(n){this.processors[n.name]=n},handle(n,l,o,i,u){return n.forEach(d=>{var m;l=((m=this.processors[d])==null?void 0:m.process(l,o,i,u))??l}),l}};const cg=Symbol("i18next/PATH_KEY");function w2(){const n=[],l=Object.create(null);let o;return l.get=(i,u)=>{var d;return(d=o==null?void 0:o.revoke)==null||d.call(o),u===cg?n:(n.push(u),o=Proxy.revocable(i,l),o.proxy)},Proxy.revocable(Object.create(null),l).proxy}function uu(n,l){const{[cg]:o}=n(w2());return o.join((l==null?void 0:l.keySeparator)??".")}const Ih={},Yh=n=>!Ce(n)&&typeof n!="boolean"&&typeof n!="number";class Eo extends Do{constructor(l,o={}){super(),u2(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],l,this),this.options=o,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=va.create("translator")}changeLanguage(l){l&&(this.language=l)}exists(l,o={interpolation:{}}){const i={...o};if(l==null)return!1;const u=this.resolve(l,i);return(u==null?void 0:u.res)!==void 0}extractFromKey(l,o){let i=o.nsSeparator!==void 0?o.nsSeparator:this.options.nsSeparator;i===void 0&&(i=":");const u=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let d=o.ns||this.options.defaultNS||[];const m=i&&l.indexOf(i)>-1,p=!this.options.userDefinedKeySeparator&&!o.keySeparator&&!this.options.userDefinedNsSeparator&&!o.nsSeparator&&!b2(l,i,u);if(m&&!p){const g=l.match(this.interpolator.nestingRegexp);if(g&&g.length>0)return{key:l,namespaces:Ce(d)?[d]:d};const h=l.split(i);(i!==u||i===u&&this.options.ns.indexOf(h[0])>-1)&&(d=h.shift()),l=h.join(u)}return{key:l,namespaces:Ce(d)?[d]:d}}translate(l,o,i){let u=typeof o=="object"?{...o}:o;if(typeof u!="object"&&this.options.overloadTranslationOptionHandler&&(u=this.options.overloadTranslationOptionHandler(arguments)),typeof u=="object"&&(u={...u}),u||(u={}),l==null)return"";typeof l=="function"&&(l=uu(l,{...this.options,...u})),Array.isArray(l)||(l=[String(l)]);const d=u.returnDetails!==void 0?u.returnDetails:this.options.returnDetails,m=u.keySeparator!==void 0?u.keySeparator:this.options.keySeparator,{key:p,namespaces:g}=this.extractFromKey(l[l.length-1],u),h=g[g.length-1];let y=u.nsSeparator!==void 0?u.nsSeparator:this.options.nsSeparator;y===void 0&&(y=":");const N=u.lng||this.language,C=u.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((N==null?void 0:N.toLowerCase())==="cimode")return C?d?{res:`${h}${y}${p}`,usedKey:p,exactUsedKey:p,usedLng:N,usedNS:h,usedParams:this.getUsedParamsDetails(u)}:`${h}${y}${p}`:d?{res:p,usedKey:p,exactUsedKey:p,usedLng:N,usedNS:h,usedParams:this.getUsedParamsDetails(u)}:p;const E=this.resolve(l,u);let S=E==null?void 0:E.res;const k=(E==null?void 0:E.usedKey)||p,T=(E==null?void 0:E.exactUsedKey)||p,A=["[object Number]","[object Function]","[object RegExp]"],j=u.joinArrays!==void 0?u.joinArrays:this.options.joinArrays,M=!this.i18nFormat||this.i18nFormat.handleAsObject,$=u.count!==void 0&&!Ce(u.count),W=Eo.hasDefaultValue(u),ne=$?this.pluralResolver.getSuffix(N,u.count,u):"",re=u.ordinal&&$?this.pluralResolver.getSuffix(N,u.count,{ordinal:!1}):"",I=$&&!u.ordinal&&u.count===0,oe=I&&u[`defaultValue${this.options.pluralSeparator}zero`]||u[`defaultValue${ne}`]||u[`defaultValue${re}`]||u.defaultValue;let te=S;M&&!S&&W&&(te=oe);const U=Yh(te),D=Object.prototype.toString.apply(te);if(M&&te&&U&&A.indexOf(D)<0&&!(Ce(j)&&Array.isArray(te))){if(!u.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const Q=this.options.returnedObjectHandler?this.options.returnedObjectHandler(k,te,{...u,ns:g}):`key '${p} (${this.language})' returned an object instead of string.`;return d?(E.res=Q,E.usedParams=this.getUsedParamsDetails(u),E):Q}if(m){const Q=Array.isArray(te),P=Q?[]:{},V=Q?T:k;for(const w in te)if(Object.prototype.hasOwnProperty.call(te,w)){const z=`${V}${m}${w}`;W&&!S?P[w]=this.translate(z,{...u,defaultValue:Yh(oe)?oe[w]:void 0,joinArrays:!1,ns:g}):P[w]=this.translate(z,{...u,joinArrays:!1,ns:g}),P[w]===z&&(P[w]=te[w])}S=P}}else if(M&&Ce(j)&&Array.isArray(S))S=S.join(j),S&&(S=this.extendTranslation(S,l,u,i));else{let Q=!1,P=!1;!this.isValidLookup(S)&&W&&(Q=!0,S=oe),this.isValidLookup(S)||(P=!0,S=p);const w=(u.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&P?void 0:S,z=W&&oe!==S&&this.options.updateMissing;if(P||Q||z){if(this.logger.log(z?"updateKey":"missingKey",N,h,p,z?oe:S),m){const J=this.resolve(p,{...u,keySeparator:!1});J&&J.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let q=[];const de=this.languageUtils.getFallbackCodes(this.options.fallbackLng,u.lng||this.language);if(this.options.saveMissingTo==="fallback"&&de&&de[0])for(let J=0;J<de.length;J++)q.push(de[J]);else this.options.saveMissingTo==="all"?q=this.languageUtils.toResolveHierarchy(u.lng||this.language):q.push(u.lng||this.language);const R=(J,ie,B)=>{var ee;const _=W&&B!==S?B:w;this.options.missingKeyHandler?this.options.missingKeyHandler(J,h,ie,_,z,u):(ee=this.backendConnector)!=null&&ee.saveMissing&&this.backendConnector.saveMissing(J,h,ie,_,z,u),this.emit("missingKey",J,h,ie,S)};this.options.saveMissing&&(this.options.saveMissingPlurals&&$?q.forEach(J=>{const ie=this.pluralResolver.getSuffixes(J,u);I&&u[`defaultValue${this.options.pluralSeparator}zero`]&&ie.indexOf(`${this.options.pluralSeparator}zero`)<0&&ie.push(`${this.options.pluralSeparator}zero`),ie.forEach(B=>{R([J],p+B,u[`defaultValue${B}`]||oe)})}):R(q,p,oe))}S=this.extendTranslation(S,l,u,E,i),P&&S===p&&this.options.appendNamespaceToMissingKey&&(S=`${h}${y}${p}`),(P||Q)&&this.options.parseMissingKeyHandler&&(S=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${h}${y}${p}`:p,Q?S:void 0,u))}return d?(E.res=S,E.usedParams=this.getUsedParamsDetails(u),E):S}extendTranslation(l,o,i,u,d){var g,h;if((g=this.i18nFormat)!=null&&g.parse)l=this.i18nFormat.parse(l,{...this.options.interpolation.defaultVariables,...i},i.lng||this.language||u.usedLng,u.usedNS,u.usedKey,{resolved:u});else if(!i.skipInterpolation){i.interpolation&&this.interpolator.init({...i,interpolation:{...this.options.interpolation,...i.interpolation}});const y=Ce(l)&&(((h=i==null?void 0:i.interpolation)==null?void 0:h.skipOnVariables)!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let N;if(y){const E=l.match(this.interpolator.nestingRegexp);N=E&&E.length}let C=i.replace&&!Ce(i.replace)?i.replace:i;if(this.options.interpolation.defaultVariables&&(C={...this.options.interpolation.defaultVariables,...C}),l=this.interpolator.interpolate(l,C,i.lng||this.language||u.usedLng,i),y){const E=l.match(this.interpolator.nestingRegexp),S=E&&E.length;N<S&&(i.nest=!1)}!i.lng&&u&&u.res&&(i.lng=this.language||u.usedLng),i.nest!==!1&&(l=this.interpolator.nest(l,(...E)=>(d==null?void 0:d[0])===E[0]&&!i.context?(this.logger.warn(`It seems you are nesting recursively key: ${E[0]} in key: ${o[0]}`),null):this.translate(...E,o),i)),i.interpolation&&this.interpolator.reset()}const m=i.postProcess||this.options.postProcess,p=Ce(m)?[m]:m;return l!=null&&(p!=null&&p.length)&&i.applyPostProcessor!==!1&&(l=ig.handle(p,l,o,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...u,usedParams:this.getUsedParamsDetails(i)},...i}:i,this)),l}resolve(l,o={}){let i,u,d,m,p;return Ce(l)&&(l=[l]),l.forEach(g=>{if(this.isValidLookup(i))return;const h=this.extractFromKey(g,o),y=h.key;u=y;let N=h.namespaces;this.options.fallbackNS&&(N=N.concat(this.options.fallbackNS));const C=o.count!==void 0&&!Ce(o.count),E=C&&!o.ordinal&&o.count===0,S=o.context!==void 0&&(Ce(o.context)||typeof o.context=="number")&&o.context!=="",k=o.lngs?o.lngs:this.languageUtils.toResolveHierarchy(o.lng||this.language,o.fallbackLng);N.forEach(T=>{var A,j;this.isValidLookup(i)||(p=T,!Ih[`${k[0]}-${T}`]&&((A=this.utils)!=null&&A.hasLoadedNamespace)&&!((j=this.utils)!=null&&j.hasLoadedNamespace(p))&&(Ih[`${k[0]}-${T}`]=!0,this.logger.warn(`key "${u}" for languages "${k.join(", ")}" won't get resolved as namespace "${p}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),k.forEach(M=>{var ne;if(this.isValidLookup(i))return;m=M;const $=[y];if((ne=this.i18nFormat)!=null&&ne.addLookupKeys)this.i18nFormat.addLookupKeys($,y,M,T,o);else{let re;C&&(re=this.pluralResolver.getSuffix(M,o.count,o));const I=`${this.options.pluralSeparator}zero`,oe=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(C&&(o.ordinal&&re.indexOf(oe)===0&&$.push(y+re.replace(oe,this.options.pluralSeparator)),$.push(y+re),E&&$.push(y+I)),S){const te=`${y}${this.options.contextSeparator||"_"}${o.context}`;$.push(te),C&&(o.ordinal&&re.indexOf(oe)===0&&$.push(te+re.replace(oe,this.options.pluralSeparator)),$.push(te+re),E&&$.push(te+I))}}let W;for(;W=$.pop();)this.isValidLookup(i)||(d=W,i=this.getResource(M,T,W,o))}))})}),{res:i,usedKey:u,exactUsedKey:d,usedLng:m,usedNS:p}}isValidLookup(l){return l!==void 0&&!(!this.options.returnNull&&l===null)&&!(!this.options.returnEmptyString&&l==="")}getResource(l,o,i,u={}){var d;return(d=this.i18nFormat)!=null&&d.getResource?this.i18nFormat.getResource(l,o,i,u):this.resourceStore.getResource(l,o,i,u)}getUsedParamsDetails(l={}){const o=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],i=l.replace&&!Ce(l.replace);let u=i?l.replace:l;if(i&&typeof l.count<"u"&&(u.count=l.count),this.options.interpolation.defaultVariables&&(u={...this.options.interpolation.defaultVariables,...u}),!i){u={...u};for(const d of o)delete u[d]}return u}static hasDefaultValue(l){const o="defaultValue";for(const i in l)if(Object.prototype.hasOwnProperty.call(l,i)&&o===i.substring(0,o.length)&&l[i]!==void 0)return!0;return!1}}class Xh{constructor(l){this.options=l,this.supportedLngs=this.options.supportedLngs||!1,this.logger=va.create("languageUtils")}getScriptPartFromCode(l){if(l=Gn(l),!l||l.indexOf("-")<0)return null;const o=l.split("-");return o.length===2||(o.pop(),o[o.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(o.join("-"))}getLanguagePartFromCode(l){if(l=Gn(l),!l||l.indexOf("-")<0)return l;const o=l.split("-");return this.formatLanguageCode(o[0])}formatLanguageCode(l){if(Ce(l)&&l.indexOf("-")>-1){let o;try{o=Intl.getCanonicalLocales(l)[0]}catch{}return o&&this.options.lowerCaseLng&&(o=o.toLowerCase()),o||(this.options.lowerCaseLng?l.toLowerCase():l)}return this.options.cleanCode||this.options.lowerCaseLng?l.toLowerCase():l}isSupportedCode(l){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(l=this.getLanguagePartFromCode(l)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(l)>-1}getBestMatchFromCodes(l){if(!l)return null;let o;return l.forEach(i=>{if(o)return;const u=this.formatLanguageCode(i);(!this.options.supportedLngs||this.isSupportedCode(u))&&(o=u)}),!o&&this.options.supportedLngs&&l.forEach(i=>{if(o)return;const u=this.getScriptPartFromCode(i);if(this.isSupportedCode(u))return o=u;const d=this.getLanguagePartFromCode(i);if(this.isSupportedCode(d))return o=d;o=this.options.supportedLngs.find(m=>{if(m===d)return m;if(!(m.indexOf("-")<0&&d.indexOf("-")<0)&&(m.indexOf("-")>0&&d.indexOf("-")<0&&m.substring(0,m.indexOf("-"))===d||m.indexOf(d)===0&&d.length>1))return m})}),o||(o=this.getFallbackCodes(this.options.fallbackLng)[0]),o}getFallbackCodes(l,o){if(!l)return[];if(typeof l=="function"&&(l=l(o)),Ce(l)&&(l=[l]),Array.isArray(l))return l;if(!o)return l.default||[];let i=l[o];return i||(i=l[this.getScriptPartFromCode(o)]),i||(i=l[this.formatLanguageCode(o)]),i||(i=l[this.getLanguagePartFromCode(o)]),i||(i=l.default),i||[]}toResolveHierarchy(l,o){const i=this.getFallbackCodes((o===!1?[]:o)||this.options.fallbackLng||[],l),u=[],d=m=>{m&&(this.isSupportedCode(m)?u.push(m):this.logger.warn(`rejecting language code not found in supportedLngs: ${m}`))};return Ce(l)&&(l.indexOf("-")>-1||l.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&d(this.formatLanguageCode(l)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&d(this.getScriptPartFromCode(l)),this.options.load!=="currentOnly"&&d(this.getLanguagePartFromCode(l))):Ce(l)&&d(this.formatLanguageCode(l)),i.forEach(m=>{u.indexOf(m)<0&&d(this.formatLanguageCode(m))}),u}}const Qh={zero:0,one:1,two:2,few:3,many:4,other:5},Zh={select:n=>n===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class j2{constructor(l,o={}){this.languageUtils=l,this.options=o,this.logger=va.create("pluralResolver"),this.pluralRulesCache={}}addRule(l,o){this.rules[l]=o}clearCache(){this.pluralRulesCache={}}getRule(l,o={}){const i=Gn(l==="dev"?"en":l),u=o.ordinal?"ordinal":"cardinal",d=JSON.stringify({cleanedCode:i,type:u});if(d in this.pluralRulesCache)return this.pluralRulesCache[d];let m;try{m=new Intl.PluralRules(i,{type:u})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),Zh;if(!l.match(/-|_/))return Zh;const g=this.languageUtils.getLanguagePartFromCode(l);m=this.getRule(g,o)}return this.pluralRulesCache[d]=m,m}needsPlural(l,o={}){let i=this.getRule(l,o);return i||(i=this.getRule("dev",o)),(i==null?void 0:i.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(l,o,i={}){return this.getSuffixes(l,i).map(u=>`${o}${u}`)}getSuffixes(l,o={}){let i=this.getRule(l,o);return i||(i=this.getRule("dev",o)),i?i.resolvedOptions().pluralCategories.sort((u,d)=>Qh[u]-Qh[d]).map(u=>`${this.options.prepend}${o.ordinal?`ordinal${this.options.prepend}`:""}${u}`):[]}getSuffix(l,o,i={}){const u=this.getRule(l,i);return u?`${this.options.prepend}${i.ordinal?`ordinal${this.options.prepend}`:""}${u.select(o)}`:(this.logger.warn(`no plural rule found for: ${l}`),this.getSuffix("dev",o,i))}}const Jh=(n,l,o,i=".",u=!0)=>{let d=m2(n,l,o);return!d&&u&&Ce(o)&&(d=cu(n,o,i),d===void 0&&(d=cu(l,o,i))),d},Zc=n=>n.replace(/\$/g,"$$$$");class N2{constructor(l={}){var o;this.logger=va.create("interpolator"),this.options=l,this.format=((o=l==null?void 0:l.interpolation)==null?void 0:o.format)||(i=>i),this.init(l)}init(l={}){l.interpolation||(l.interpolation={escapeValue:!0});const{escape:o,escapeValue:i,useRawValueToEscape:u,prefix:d,prefixEscaped:m,suffix:p,suffixEscaped:g,formatSeparator:h,unescapeSuffix:y,unescapePrefix:N,nestingPrefix:C,nestingPrefixEscaped:E,nestingSuffix:S,nestingSuffixEscaped:k,nestingOptionsSeparator:T,maxReplaces:A,alwaysFormat:j}=l.interpolation;this.escape=o!==void 0?o:p2,this.escapeValue=i!==void 0?i:!0,this.useRawValueToEscape=u!==void 0?u:!1,this.prefix=d?Ts(d):m||"{{",this.suffix=p?Ts(p):g||"}}",this.formatSeparator=h||",",this.unescapePrefix=y?"":N||"-",this.unescapeSuffix=this.unescapePrefix?"":y||"",this.nestingPrefix=C?Ts(C):E||Ts("$t("),this.nestingSuffix=S?Ts(S):k||Ts(")"),this.nestingOptionsSeparator=T||",",this.maxReplaces=A||1e3,this.alwaysFormat=j!==void 0?j:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const l=(o,i)=>(o==null?void 0:o.source)===i?(o.lastIndex=0,o):new RegExp(i,"g");this.regexp=l(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=l(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=l(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(l,o,i,u){var E;let d,m,p;const g=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},h=S=>{if(S.indexOf(this.formatSeparator)<0){const j=Jh(o,g,S,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(j,void 0,i,{...u,...o,interpolationkey:S}):j}const k=S.split(this.formatSeparator),T=k.shift().trim(),A=k.join(this.formatSeparator).trim();return this.format(Jh(o,g,T,this.options.keySeparator,this.options.ignoreJSONStructure),A,i,{...u,...o,interpolationkey:T})};this.resetRegExp();const y=(u==null?void 0:u.missingInterpolationHandler)||this.options.missingInterpolationHandler,N=((E=u==null?void 0:u.interpolation)==null?void 0:E.skipOnVariables)!==void 0?u.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:S=>Zc(S)},{regex:this.regexp,safeValue:S=>this.escapeValue?Zc(this.escape(S)):Zc(S)}].forEach(S=>{for(p=0;d=S.regex.exec(l);){const k=d[1].trim();if(m=h(k),m===void 0)if(typeof y=="function"){const A=y(l,d,u);m=Ce(A)?A:""}else if(u&&Object.prototype.hasOwnProperty.call(u,k))m="";else if(N){m=d[0];continue}else this.logger.warn(`missed to pass in variable ${k} for interpolating ${l}`),m="";else!Ce(m)&&!this.useRawValueToEscape&&(m=Vh(m));const T=S.safeValue(m);if(l=l.replace(d[0],T),N?(S.regex.lastIndex+=m.length,S.regex.lastIndex-=d[0].length):S.regex.lastIndex=0,p++,p>=this.maxReplaces)break}}),l}nest(l,o,i={}){let u,d,m;const p=(g,h)=>{const y=this.nestingOptionsSeparator;if(g.indexOf(y)<0)return g;const N=g.split(new RegExp(`${y}[ ]*{`));let C=`{${N[1]}`;g=N[0],C=this.interpolate(C,m);const E=C.match(/'/g),S=C.match(/"/g);(((E==null?void 0:E.length)??0)%2===0&&!S||S.length%2!==0)&&(C=C.replace(/'/g,'"'));try{m=JSON.parse(C),h&&(m={...h,...m})}catch(k){return this.logger.warn(`failed parsing options string in nesting for key ${g}`,k),`${g}${y}${C}`}return m.defaultValue&&m.defaultValue.indexOf(this.prefix)>-1&&delete m.defaultValue,g};for(;u=this.nestingRegexp.exec(l);){let g=[];m={...i},m=m.replace&&!Ce(m.replace)?m.replace:m,m.applyPostProcessor=!1,delete m.defaultValue;const h=/{.*}/.test(u[1])?u[1].lastIndexOf("}")+1:u[1].indexOf(this.formatSeparator);if(h!==-1&&(g=u[1].slice(h).split(this.formatSeparator).map(y=>y.trim()).filter(Boolean),u[1]=u[1].slice(0,h)),d=o(p.call(this,u[1].trim(),m),m),d&&u[0]===l&&!Ce(d))return d;Ce(d)||(d=Vh(d)),d||(this.logger.warn(`missed to resolve ${u[1]} for nesting ${l}`),d=""),g.length&&(d=g.reduce((y,N)=>this.format(y,N,i.lng,{...i,interpolationkey:u[1].trim()}),d.trim())),l=l.replace(u[0],d),this.regexp.lastIndex=0}return l}}const S2=n=>{let l=n.toLowerCase().trim();const o={};if(n.indexOf("(")>-1){const i=n.split("(");l=i[0].toLowerCase().trim();const u=i[1].substring(0,i[1].length-1);l==="currency"&&u.indexOf(":")<0?o.currency||(o.currency=u.trim()):l==="relativetime"&&u.indexOf(":")<0?o.range||(o.range=u.trim()):u.split(";").forEach(m=>{if(m){const[p,...g]=m.split(":"),h=g.join(":").trim().replace(/^'+|'+$/g,""),y=p.trim();o[y]||(o[y]=h),h==="false"&&(o[y]=!1),h==="true"&&(o[y]=!0),isNaN(h)||(o[y]=parseInt(h,10))}})}return{formatName:l,formatOptions:o}},Wh=n=>{const l={};return(o,i,u)=>{let d=u;u&&u.interpolationkey&&u.formatParams&&u.formatParams[u.interpolationkey]&&u[u.interpolationkey]&&(d={...d,[u.interpolationkey]:void 0});const m=i+JSON.stringify(d);let p=l[m];return p||(p=n(Gn(i),u),l[m]=p),p(o)}},C2=n=>(l,o,i)=>n(Gn(o),i)(l);class E2{constructor(l={}){this.logger=va.create("formatter"),this.options=l,this.init(l)}init(l,o={interpolation:{}}){this.formatSeparator=o.interpolation.formatSeparator||",";const i=o.cacheInBuiltFormats?Wh:C2;this.formats={number:i((u,d)=>{const m=new Intl.NumberFormat(u,{...d});return p=>m.format(p)}),currency:i((u,d)=>{const m=new Intl.NumberFormat(u,{...d,style:"currency"});return p=>m.format(p)}),datetime:i((u,d)=>{const m=new Intl.DateTimeFormat(u,{...d});return p=>m.format(p)}),relativetime:i((u,d)=>{const m=new Intl.RelativeTimeFormat(u,{...d});return p=>m.format(p,d.range||"day")}),list:i((u,d)=>{const m=new Intl.ListFormat(u,{...d});return p=>m.format(p)})}}add(l,o){this.formats[l.toLowerCase().trim()]=o}addCached(l,o){this.formats[l.toLowerCase().trim()]=Wh(o)}format(l,o,i,u={}){const d=o.split(this.formatSeparator);if(d.length>1&&d[0].indexOf("(")>1&&d[0].indexOf(")")<0&&d.find(p=>p.indexOf(")")>-1)){const p=d.findIndex(g=>g.indexOf(")")>-1);d[0]=[d[0],...d.splice(1,p)].join(this.formatSeparator)}return d.reduce((p,g)=>{var N;const{formatName:h,formatOptions:y}=S2(g);if(this.formats[h]){let C=p;try{const E=((N=u==null?void 0:u.formatParams)==null?void 0:N[u.interpolationkey])||{},S=E.locale||E.lng||u.locale||u.lng||i;C=this.formats[h](p,S,{...y,...u,...E})}catch(E){this.logger.warn(E)}return C}else this.logger.warn(`there was no format function for ${h}`);return p},l)}}const k2=(n,l)=>{n.pending[l]!==void 0&&(delete n.pending[l],n.pendingCount--)};class T2 extends Do{constructor(l,o,i,u={}){var d,m;super(),this.backend=l,this.store=o,this.services=i,this.languageUtils=i.languageUtils,this.options=u,this.logger=va.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=u.maxParallelReads||10,this.readingCalls=0,this.maxRetries=u.maxRetries>=0?u.maxRetries:5,this.retryTimeout=u.retryTimeout>=1?u.retryTimeout:350,this.state={},this.queue=[],(m=(d=this.backend)==null?void 0:d.init)==null||m.call(d,i,u.backend,u)}queueLoad(l,o,i,u){const d={},m={},p={},g={};return l.forEach(h=>{let y=!0;o.forEach(N=>{const C=`${h}|${N}`;!i.reload&&this.store.hasResourceBundle(h,N)?this.state[C]=2:this.state[C]<0||(this.state[C]===1?m[C]===void 0&&(m[C]=!0):(this.state[C]=1,y=!1,m[C]===void 0&&(m[C]=!0),d[C]===void 0&&(d[C]=!0),g[N]===void 0&&(g[N]=!0)))}),y||(p[h]=!0)}),(Object.keys(d).length||Object.keys(m).length)&&this.queue.push({pending:m,pendingCount:Object.keys(m).length,loaded:{},errors:[],callback:u}),{toLoad:Object.keys(d),pending:Object.keys(m),toLoadLanguages:Object.keys(p),toLoadNamespaces:Object.keys(g)}}loaded(l,o,i){const u=l.split("|"),d=u[0],m=u[1];o&&this.emit("failedLoading",d,m,o),!o&&i&&this.store.addResourceBundle(d,m,i,void 0,void 0,{skipCopy:!0}),this.state[l]=o?-1:2,o&&i&&(this.state[l]=0);const p={};this.queue.forEach(g=>{f2(g.loaded,[d],m),k2(g,l),o&&g.errors.push(o),g.pendingCount===0&&!g.done&&(Object.keys(g.loaded).forEach(h=>{p[h]||(p[h]={});const y=g.loaded[h];y.length&&y.forEach(N=>{p[h][N]===void 0&&(p[h][N]=!0)})}),g.done=!0,g.errors.length?g.callback(g.errors):g.callback())}),this.emit("loaded",p),this.queue=this.queue.filter(g=>!g.done)}read(l,o,i,u=0,d=this.retryTimeout,m){if(!l.length)return m(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:l,ns:o,fcName:i,tried:u,wait:d,callback:m});return}this.readingCalls++;const p=(h,y)=>{if(this.readingCalls--,this.waitingReads.length>0){const N=this.waitingReads.shift();this.read(N.lng,N.ns,N.fcName,N.tried,N.wait,N.callback)}if(h&&y&&u<this.maxRetries){setTimeout(()=>{this.read.call(this,l,o,i,u+1,d*2,m)},d);return}m(h,y)},g=this.backend[i].bind(this.backend);if(g.length===2){try{const h=g(l,o);h&&typeof h.then=="function"?h.then(y=>p(null,y)).catch(p):p(null,h)}catch(h){p(h)}return}return g(l,o,p)}prepareLoading(l,o,i={},u){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),u&&u();Ce(l)&&(l=this.languageUtils.toResolveHierarchy(l)),Ce(o)&&(o=[o]);const d=this.queueLoad(l,o,i,u);if(!d.toLoad.length)return d.pending.length||u(),null;d.toLoad.forEach(m=>{this.loadOne(m)})}load(l,o,i){this.prepareLoading(l,o,{},i)}reload(l,o,i){this.prepareLoading(l,o,{reload:!0},i)}loadOne(l,o=""){const i=l.split("|"),u=i[0],d=i[1];this.read(u,d,"read",void 0,void 0,(m,p)=>{m&&this.logger.warn(`${o}loading namespace ${d} for language ${u} failed`,m),!m&&p&&this.logger.log(`${o}loaded namespace ${d} for language ${u}`,p),this.loaded(l,m,p)})}saveMissing(l,o,i,u,d,m={},p=()=>{}){var g,h,y,N,C;if((h=(g=this.services)==null?void 0:g.utils)!=null&&h.hasLoadedNamespace&&!((N=(y=this.services)==null?void 0:y.utils)!=null&&N.hasLoadedNamespace(o))){this.logger.warn(`did not save key "${i}" as the namespace "${o}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(i==null||i==="")){if((C=this.backend)!=null&&C.create){const E={...m,isUpdate:d},S=this.backend.create.bind(this.backend);if(S.length<6)try{let k;S.length===5?k=S(l,o,i,u,E):k=S(l,o,i,u),k&&typeof k.then=="function"?k.then(T=>p(null,T)).catch(p):p(null,k)}catch(k){p(k)}else S(l,o,i,u,p,E)}!l||!l[0]||this.store.addResource(l[0],o,i,u)}}}const ep=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:n=>{let l={};if(typeof n[1]=="object"&&(l=n[1]),Ce(n[1])&&(l.defaultValue=n[1]),Ce(n[2])&&(l.tDescription=n[2]),typeof n[2]=="object"||typeof n[3]=="object"){const o=n[3]||n[2];Object.keys(o).forEach(i=>{l[i]=o[i]})}return l},interpolation:{escapeValue:!0,format:n=>n,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),tp=n=>{var l,o;return Ce(n.ns)&&(n.ns=[n.ns]),Ce(n.fallbackLng)&&(n.fallbackLng=[n.fallbackLng]),Ce(n.fallbackNS)&&(n.fallbackNS=[n.fallbackNS]),((o=(l=n.supportedLngs)==null?void 0:l.indexOf)==null?void 0:o.call(l,"cimode"))<0&&(n.supportedLngs=n.supportedLngs.concat(["cimode"])),typeof n.initImmediate=="boolean"&&(n.initAsync=n.initImmediate),n},xo=()=>{},A2=n=>{Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach(o=>{typeof n[o]=="function"&&(n[o]=n[o].bind(n))})};class Kn extends Do{constructor(l={},o){if(super(),this.options=tp(l),this.services={},this.logger=va,this.modules={external:[]},A2(this),o&&!this.isInitialized&&!l.isClone){if(!this.options.initAsync)return this.init(l,o),this;setTimeout(()=>{this.init(l,o)},0)}}init(l={},o){this.isInitializing=!0,typeof l=="function"&&(o=l,l={}),l.defaultNS==null&&l.ns&&(Ce(l.ns)?l.defaultNS=l.ns:l.ns.indexOf("translation")<0&&(l.defaultNS=l.ns[0]));const i=ep();this.options={...i,...this.options,...tp(l)},this.options.interpolation={...i.interpolation,...this.options.interpolation},l.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=l.keySeparator),l.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=l.nsSeparator);const u=h=>h?typeof h=="function"?new h:h:null;if(!this.options.isClone){this.modules.logger?va.init(u(this.modules.logger),this.options):va.init(null,this.options);let h;this.modules.formatter?h=this.modules.formatter:h=E2;const y=new Xh(this.options);this.store=new $h(this.options.resources,this.options);const N=this.services;N.logger=va,N.resourceStore=this.store,N.languageUtils=y,N.pluralResolver=new j2(y,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==i.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),h&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(N.formatter=u(h),N.formatter.init&&N.formatter.init(N,this.options),this.options.interpolation.format=N.formatter.format.bind(N.formatter)),N.interpolator=new N2(this.options),N.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},N.backendConnector=new T2(u(this.modules.backend),N.resourceStore,N,this.options),N.backendConnector.on("*",(E,...S)=>{this.emit(E,...S)}),this.modules.languageDetector&&(N.languageDetector=u(this.modules.languageDetector),N.languageDetector.init&&N.languageDetector.init(N,this.options.detection,this.options)),this.modules.i18nFormat&&(N.i18nFormat=u(this.modules.i18nFormat),N.i18nFormat.init&&N.i18nFormat.init(this)),this.translator=new Eo(this.services,this.options),this.translator.on("*",(E,...S)=>{this.emit(E,...S)}),this.modules.external.forEach(E=>{E.init&&E.init(this)})}if(this.format=this.options.interpolation.format,o||(o=xo),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const h=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);h.length>0&&h[0]!=="dev"&&(this.options.lng=h[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(h=>{this[h]=(...y)=>this.store[h](...y)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(h=>{this[h]=(...y)=>(this.store[h](...y),this)});const p=Pn(),g=()=>{const h=(y,N)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),p.resolve(N),o(y,N)};if(this.languages&&!this.isInitialized)return h(null,this.t.bind(this));this.changeLanguage(this.options.lng,h)};return this.options.resources||!this.options.initAsync?g():setTimeout(g,0),p}loadResources(l,o=xo){var d,m;let i=o;const u=Ce(l)?l:this.language;if(typeof l=="function"&&(i=l),!this.options.resources||this.options.partialBundledLanguages){if((u==null?void 0:u.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return i();const p=[],g=h=>{if(!h||h==="cimode")return;this.services.languageUtils.toResolveHierarchy(h).forEach(N=>{N!=="cimode"&&p.indexOf(N)<0&&p.push(N)})};u?g(u):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(y=>g(y)),(m=(d=this.options.preload)==null?void 0:d.forEach)==null||m.call(d,h=>g(h)),this.services.backendConnector.load(p,this.options.ns,h=>{!h&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),i(h)})}else i(null)}reloadResources(l,o,i){const u=Pn();return typeof l=="function"&&(i=l,l=void 0),typeof o=="function"&&(i=o,o=void 0),l||(l=this.languages),o||(o=this.options.ns),i||(i=xo),this.services.backendConnector.reload(l,o,d=>{u.resolve(),i(d)}),u}use(l){if(!l)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!l.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return l.type==="backend"&&(this.modules.backend=l),(l.type==="logger"||l.log&&l.warn&&l.error)&&(this.modules.logger=l),l.type==="languageDetector"&&(this.modules.languageDetector=l),l.type==="i18nFormat"&&(this.modules.i18nFormat=l),l.type==="postProcessor"&&ig.addPostProcessor(l),l.type==="formatter"&&(this.modules.formatter=l),l.type==="3rdParty"&&this.modules.external.push(l),this}setResolvedLanguage(l){if(!(!l||!this.languages)&&!(["cimode","dev"].indexOf(l)>-1)){for(let o=0;o<this.languages.length;o++){const i=this.languages[o];if(!(["cimode","dev"].indexOf(i)>-1)&&this.store.hasLanguageSomeTranslations(i)){this.resolvedLanguage=i;break}}!this.resolvedLanguage&&this.languages.indexOf(l)<0&&this.store.hasLanguageSomeTranslations(l)&&(this.resolvedLanguage=l,this.languages.unshift(l))}}changeLanguage(l,o){this.isLanguageChangingTo=l;const i=Pn();this.emit("languageChanging",l);const u=p=>{this.language=p,this.languages=this.services.languageUtils.toResolveHierarchy(p),this.resolvedLanguage=void 0,this.setResolvedLanguage(p)},d=(p,g)=>{g?this.isLanguageChangingTo===l&&(u(g),this.translator.changeLanguage(g),this.isLanguageChangingTo=void 0,this.emit("languageChanged",g),this.logger.log("languageChanged",g)):this.isLanguageChangingTo=void 0,i.resolve((...h)=>this.t(...h)),o&&o(p,(...h)=>this.t(...h))},m=p=>{var y,N;!l&&!p&&this.services.languageDetector&&(p=[]);const g=Ce(p)?p:p&&p[0],h=this.store.hasLanguageSomeTranslations(g)?g:this.services.languageUtils.getBestMatchFromCodes(Ce(p)?[p]:p);h&&(this.language||u(h),this.translator.language||this.translator.changeLanguage(h),(N=(y=this.services.languageDetector)==null?void 0:y.cacheUserLanguage)==null||N.call(y,h)),this.loadResources(h,C=>{d(C,h)})};return!l&&this.services.languageDetector&&!this.services.languageDetector.async?m(this.services.languageDetector.detect()):!l&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(m):this.services.languageDetector.detect(m):m(l),i}getFixedT(l,o,i){const u=(d,m,...p)=>{let g;typeof m!="object"?g=this.options.overloadTranslationOptionHandler([d,m].concat(p)):g={...m},g.lng=g.lng||u.lng,g.lngs=g.lngs||u.lngs,g.ns=g.ns||u.ns,g.keyPrefix!==""&&(g.keyPrefix=g.keyPrefix||i||u.keyPrefix);const h=this.options.keySeparator||".";let y;return g.keyPrefix&&Array.isArray(d)?y=d.map(N=>(typeof N=="function"&&(N=uu(N,{...this.options,...m})),`${g.keyPrefix}${h}${N}`)):(typeof d=="function"&&(d=uu(d,{...this.options,...m})),y=g.keyPrefix?`${g.keyPrefix}${h}${d}`:d),this.t(y,g)};return Ce(l)?u.lng=l:u.lngs=l,u.ns=o,u.keyPrefix=i,u}t(...l){var o;return(o=this.translator)==null?void 0:o.translate(...l)}exists(...l){var o;return(o=this.translator)==null?void 0:o.exists(...l)}setDefaultNamespace(l){this.options.defaultNS=l}hasLoadedNamespace(l,o={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const i=o.lng||this.resolvedLanguage||this.languages[0],u=this.options?this.options.fallbackLng:!1,d=this.languages[this.languages.length-1];if(i.toLowerCase()==="cimode")return!0;const m=(p,g)=>{const h=this.services.backendConnector.state[`${p}|${g}`];return h===-1||h===0||h===2};if(o.precheck){const p=o.precheck(this,m);if(p!==void 0)return p}return!!(this.hasResourceBundle(i,l)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||m(i,l)&&(!u||m(d,l)))}loadNamespaces(l,o){const i=Pn();return this.options.ns?(Ce(l)&&(l=[l]),l.forEach(u=>{this.options.ns.indexOf(u)<0&&this.options.ns.push(u)}),this.loadResources(u=>{i.resolve(),o&&o(u)}),i):(o&&o(),Promise.resolve())}loadLanguages(l,o){const i=Pn();Ce(l)&&(l=[l]);const u=this.options.preload||[],d=l.filter(m=>u.indexOf(m)<0&&this.services.languageUtils.isSupportedCode(m));return d.length?(this.options.preload=u.concat(d),this.loadResources(m=>{i.resolve(),o&&o(m)}),i):(o&&o(),Promise.resolve())}dir(l){var u,d;if(l||(l=this.resolvedLanguage||(((u=this.languages)==null?void 0:u.length)>0?this.languages[0]:this.language)),!l)return"rtl";try{const m=new Intl.Locale(l);if(m&&m.getTextInfo){const p=m.getTextInfo();if(p&&p.direction)return p.direction}}catch{}const o=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],i=((d=this.services)==null?void 0:d.languageUtils)||new Xh(ep());return l.toLowerCase().indexOf("-latn")>1?"ltr":o.indexOf(i.getLanguagePartFromCode(l))>-1||l.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(l={},o){return new Kn(l,o)}cloneInstance(l={},o=xo){const i=l.forkResourceStore;i&&delete l.forkResourceStore;const u={...this.options,...l,isClone:!0},d=new Kn(u);if((l.debug!==void 0||l.prefix!==void 0)&&(d.logger=d.logger.clone(l)),["store","services","language"].forEach(p=>{d[p]=this[p]}),d.services={...this.services},d.services.utils={hasLoadedNamespace:d.hasLoadedNamespace.bind(d)},i){const p=Object.keys(this.store.data).reduce((g,h)=>(g[h]={...this.store.data[h]},g[h]=Object.keys(g[h]).reduce((y,N)=>(y[N]={...g[h][N]},y),g[h]),g),{});d.store=new $h(p,u),d.services.resourceStore=d.store}return d.translator=new Eo(d.services,u),d.translator.on("*",(p,...g)=>{d.emit(p,...g)}),d.init(u,o),d.translator.options=u,d.translator.backendConnector.services.utils={hasLoadedNamespace:d.hasLoadedNamespace.bind(d)},d}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Ct=Kn.createInstance();Ct.createInstance=Kn.createInstance;Ct.createInstance;Ct.dir;Ct.init;Ct.loadResources;Ct.reloadResources;Ct.use;Ct.changeLanguage;Ct.getFixedT;Ct.t;Ct.exists;Ct.setDefaultNamespace;Ct.hasLoadedNamespace;Ct.loadNamespaces;Ct.loadLanguages;const{slice:R2,forEach:M2}=[];function O2(n){return M2.call(R2.call(arguments,1),l=>{if(l)for(const o in l)n[o]===void 0&&(n[o]=l[o])}),n}function D2(n){return typeof n!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(o=>o.test(n))}const ap=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,U2=function(n,l){const i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},u=encodeURIComponent(l);let d=`${n}=${u}`;if(i.maxAge>0){const m=i.maxAge-0;if(Number.isNaN(m))throw new Error("maxAge should be a Number");d+=`; Max-Age=${Math.floor(m)}`}if(i.domain){if(!ap.test(i.domain))throw new TypeError("option domain is invalid");d+=`; Domain=${i.domain}`}if(i.path){if(!ap.test(i.path))throw new TypeError("option path is invalid");d+=`; Path=${i.path}`}if(i.expires){if(typeof i.expires.toUTCString!="function")throw new TypeError("option expires is invalid");d+=`; Expires=${i.expires.toUTCString()}`}if(i.httpOnly&&(d+="; HttpOnly"),i.secure&&(d+="; Secure"),i.sameSite)switch(typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite){case!0:d+="; SameSite=Strict";break;case"lax":d+="; SameSite=Lax";break;case"strict":d+="; SameSite=Strict";break;case"none":d+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return i.partitioned&&(d+="; Partitioned"),d},rp={create(n,l,o,i){let u=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};o&&(u.expires=new Date,u.expires.setTime(u.expires.getTime()+o*60*1e3)),i&&(u.domain=i),document.cookie=U2(n,l,u)},read(n){const l=`${n}=`,o=document.cookie.split(";");for(let i=0;i<o.length;i++){let u=o[i];for(;u.charAt(0)===" ";)u=u.substring(1,u.length);if(u.indexOf(l)===0)return u.substring(l.length,u.length)}return null},remove(n,l){this.create(n,"",-1,l)}};var z2={name:"cookie",lookup(n){let{lookupCookie:l}=n;if(l&&typeof document<"u")return rp.read(l)||void 0},cacheUserLanguage(n,l){let{lookupCookie:o,cookieMinutes:i,cookieDomain:u,cookieOptions:d}=l;o&&typeof document<"u"&&rp.create(o,n,i,u,d)}},L2={name:"querystring",lookup(n){var i;let{lookupQuerystring:l}=n,o;if(typeof window<"u"){let{search:u}=window.location;!window.location.search&&((i=window.location.hash)==null?void 0:i.indexOf("?"))>-1&&(u=window.location.hash.substring(window.location.hash.indexOf("?")));const m=u.substring(1).split("&");for(let p=0;p<m.length;p++){const g=m[p].indexOf("=");g>0&&m[p].substring(0,g)===l&&(o=m[p].substring(g+1))}}return o}},_2={name:"hash",lookup(n){var u;let{lookupHash:l,lookupFromHashIndex:o}=n,i;if(typeof window<"u"){const{hash:d}=window.location;if(d&&d.length>2){const m=d.substring(1);if(l){const p=m.split("&");for(let g=0;g<p.length;g++){const h=p[g].indexOf("=");h>0&&p[g].substring(0,h)===l&&(i=p[g].substring(h+1))}}if(i)return i;if(!i&&o>-1){const p=d.match(/\/([a-zA-Z-]*)/g);return Array.isArray(p)?(u=p[typeof o=="number"?o:0])==null?void 0:u.replace("/",""):void 0}}}return i}};let As=null;const sp=()=>{if(As!==null)return As;try{if(As=typeof window<"u"&&window.localStorage!==null,!As)return!1;const n="i18next.translate.boo";window.localStorage.setItem(n,"foo"),window.localStorage.removeItem(n)}catch{As=!1}return As};var P2={name:"localStorage",lookup(n){let{lookupLocalStorage:l}=n;if(l&&sp())return window.localStorage.getItem(l)||void 0},cacheUserLanguage(n,l){let{lookupLocalStorage:o}=l;o&&sp()&&window.localStorage.setItem(o,n)}};let Rs=null;const np=()=>{if(Rs!==null)return Rs;try{if(Rs=typeof window<"u"&&window.sessionStorage!==null,!Rs)return!1;const n="i18next.translate.boo";window.sessionStorage.setItem(n,"foo"),window.sessionStorage.removeItem(n)}catch{Rs=!1}return Rs};var H2={name:"sessionStorage",lookup(n){let{lookupSessionStorage:l}=n;if(l&&np())return window.sessionStorage.getItem(l)||void 0},cacheUserLanguage(n,l){let{lookupSessionStorage:o}=l;o&&np()&&window.sessionStorage.setItem(o,n)}},B2={name:"navigator",lookup(n){const l=[];if(typeof navigator<"u"){const{languages:o,userLanguage:i,language:u}=navigator;if(o)for(let d=0;d<o.length;d++)l.push(o[d]);i&&l.push(i),u&&l.push(u)}return l.length>0?l:void 0}},q2={name:"htmlTag",lookup(n){let{htmlTag:l}=n,o;const i=l||(typeof document<"u"?document.documentElement:null);return i&&typeof i.getAttribute=="function"&&(o=i.getAttribute("lang")),o}},V2={name:"path",lookup(n){var u;let{lookupFromPathIndex:l}=n;if(typeof window>"u")return;const o=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(o)?(u=o[typeof l=="number"?l:0])==null?void 0:u.replace("/",""):void 0}},G2={name:"subdomain",lookup(n){var u,d;let{lookupFromSubdomainIndex:l}=n;const o=typeof l=="number"?l+1:1,i=typeof window<"u"&&((d=(u=window.location)==null?void 0:u.hostname)==null?void 0:d.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(i)return i[o]}};let ug=!1;try{document.cookie,ug=!0}catch{}const dg=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];ug||dg.splice(1,1);const K2=()=>({order:dg,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:n=>n});class fg{constructor(l){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(l,o)}init(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=l,this.options=O2(o,this.options||{},K2()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=u=>u.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(z2),this.addDetector(L2),this.addDetector(P2),this.addDetector(H2),this.addDetector(B2),this.addDetector(q2),this.addDetector(V2),this.addDetector(G2),this.addDetector(_2)}addDetector(l){return this.detectors[l.name]=l,this}detect(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,o=[];return l.forEach(i=>{if(this.detectors[i]){let u=this.detectors[i].lookup(this.options);u&&typeof u=="string"&&(u=[u]),u&&(o=o.concat(u))}}),o=o.filter(i=>i!=null&&!D2(i)).map(i=>this.options.convertDetectedLanguage(i)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?o:o.length>0?o[0]:null}cacheUserLanguage(l){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;o&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(l)>-1||o.forEach(i=>{this.detectors[i]&&this.detectors[i].cacheUserLanguage(l,this.options)}))}}fg.type="languageDetector";const F2={title:"MCPHub Dashboard",error:"Error",closeButton:"Close",noServers:"No MCP servers available",loading:"Loading...",logout:"Logout",profile:"Profile",changePassword:"Change Password",toggleSidebar:"Toggle Sidebar",welcomeUser:"Welcome, {{username}}",name:"MCPHub"},$2={title:"About",versionInfo:"MCPHub Version: {{version}}",newVersion:"New version available!",currentVersion:"Current version",newVersionAvailable:"New version {{version}} is available",viewOnGitHub:"View on GitHub",checkForUpdates:"Check for Updates",checking:"Checking for updates..."},I2={viewProfile:"View profile",userCenter:"User Center"},Y2={label:"Sponsor",title:"Support the Project",rewardAlt:"Reward QR Code",supportMessage:"Support the development of MCPHub by buying me a coffee!",supportButton:"Support on Ko-fi"},X2={label:"WeChat",title:"Connect via WeChat",qrCodeAlt:"WeChat QR Code",scanMessage:"Scan this QR code to connect with us on WeChat"},Q2={label:"Discord",title:"Join our Discord server",community:"Join our growing community on Discord for support, discussions, and updates!"},Z2={title:"Theme",light:"Light",dark:"Dark",system:"System"},J2={login:"Login",loginTitle:"Login to MCPHub",slogan:"The Unified Hub for MCP Servers",subtitle:"Centralized management platform for Model Context Protocol servers. Organize, monitor, and scale multiple MCP servers with flexible routing strategies.",username:"Username",password:"Password",loggingIn:"Logging in...",emptyFields:"Username and password cannot be empty",loginFailed:"Login failed, please check your username and password",loginError:"An error occurred during login",currentPassword:"Current Password",newPassword:"New Password",confirmPassword:"Confirm Password",passwordsNotMatch:"New password and confirmation do not match",changePasswordSuccess:"Password changed successfully",changePasswordError:"Failed to change password",changePassword:"Change Password",passwordChanged:"Password changed successfully",passwordChangeError:"Failed to change password"},W2={addServer:"Add Server",add:"Add",edit:"Edit",delete:"Delete",confirmDelete:"Are you sure you want to delete this server?",deleteWarning:"Deleting server '{{name}}' will remove it and all its data. This action cannot be undone.",status:"Status",tools:"Tools",prompts:"Prompts",name:"Server Name",url:"Server URL",apiKey:"API Key",save:"Save",cancel:"Cancel",invalidConfig:"Could not find configuration data for {{serverName}}",addError:"Failed to add server",editError:"Failed to edit server {{serverName}}",deleteError:"Failed to delete server {{serverName}}",updateError:"Failed to update server",editTitle:"Edit Server: {{serverName}}",type:"Server Type",typeStdio:"STDIO",typeSse:"SSE",typeStreamableHttp:"Streamable HTTP",typeOpenapi:"OpenAPI",command:"Command",arguments:"Arguments",envVars:"Environment Variables",headers:"HTTP Headers",key:"key",value:"value",enabled:"Enabled",enable:"Enable",disable:"Disable",requestOptions:"Configuration",timeout:"Request Timeout",timeoutDescription:"Timeout for requests to the MCP server (ms)",maxTotalTimeout:"Maximum Total Timeout",maxTotalTimeoutDescription:"Maximum total timeout for requests sent to the MCP server (ms) (Use with progress notifications)",resetTimeoutOnProgress:"Reset Timeout on Progress",resetTimeoutOnProgressDescription:"Reset timeout on progress notifications",remove:"Remove",toggleError:"Failed to toggle server {{serverName}}",alreadyExists:"Server {{serverName}} already exists",invalidData:"Invalid server data provided",notFound:"Server {{serverName}} not found",namePlaceholder:"Enter server name",urlPlaceholder:"Enter server URL",commandPlaceholder:"Enter command",argumentsPlaceholder:"Enter arguments",errorDetails:"Error Details",viewErrorDetails:"View error details",confirmVariables:"Confirm Variable Configuration",variablesDetected:"Variables detected in configuration. Please confirm these variables are properly configured:",detectedVariables:"Detected Variables",confirmVariablesMessage:"Please ensure these variables are properly defined in your runtime environment. Continue adding server?",confirmAndAdd:"Confirm and Add",openapi:{inputMode:"Input Mode",inputModeUrl:"Specification URL",inputModeSchema:"JSON Schema",specUrl:"OpenAPI Specification URL",schema:"OpenAPI JSON Schema",schemaHelp:"Paste your complete OpenAPI JSON schema here",security:"Security Type",securityNone:"None",securityApiKey:"API Key",securityHttp:"HTTP Authentication",securityOAuth2:"OAuth 2.0",securityOpenIdConnect:"OpenID Connect",apiKeyConfig:"API Key Configuration",apiKeyName:"Header/Parameter Name",apiKeyIn:"Location",apiKeyValue:"API Key Value",httpAuthConfig:"HTTP Authentication Configuration",httpScheme:"Authentication Scheme",httpCredentials:"Credentials",httpSchemeBasic:"Basic",httpSchemeBearer:"Bearer",httpSchemeDigest:"Digest",oauth2Config:"OAuth 2.0 Configuration",oauth2Token:"Access Token",openIdConnectConfig:"OpenID Connect Configuration",openIdConnectUrl:"Discovery URL",openIdConnectToken:"ID Token",apiKeyInHeader:"Header",apiKeyInQuery:"Query",apiKeyInCookie:"Cookie",passthroughHeaders:"Passthrough Headers",passthroughHeadersHelp:"Comma-separated list of header names to pass through from tool call requests to upstream OpenAPI endpoints (e.g., Authorization, X-API-Key)"}},ew={online:"Online",offline:"Offline",connecting:"Connecting"},tw={general:"Something went wrong",network:"Network connection error. Please check your internet connection",serverConnection:"Unable to connect to the server. Please check if the server is running",serverAdd:"Failed to add server. Please check the server status",serverUpdate:"Failed to edit server {{serverName}}. Please check the server status",serverFetch:"Failed to retrieve server data. Please try again later",initialStartup:"The server might be starting up. Please wait a moment as this process can take some time on first launch...",serverInstall:"Failed to install server",failedToFetchSettings:"Failed to fetch settings",failedToUpdateRouteConfig:"Failed to update route configuration",failedToUpdateSmartRoutingConfig:"Failed to update smart routing configuration"},aw={processing:"Processing...",save:"Save",cancel:"Cancel",refresh:"Refresh",create:"Create",creating:"Creating...",update:"Update",updating:"Updating...",submitting:"Submitting...",delete:"Delete",remove:"Remove",copy:"Copy",copyId:"Copy ID",copyUrl:"Copy URL",copyJson:"Copy JSON",copySuccess:"Copied to clipboard",copyFailed:"Copy failed",close:"Close",confirm:"Confirm",language:"Language",true:"True",false:"False",dismiss:"Dismiss",github:"GitHub",wechat:"WeChat",discord:"Discord"},rw={dashboard:"Dashboard",servers:"Servers",groups:"Groups",users:"Users",settings:"Settings",changePassword:"Change Password",market:"Market",cloud:"Cloud Market",logs:"Logs"},sw={dashboard:{title:"Dashboard",totalServers:"Total",onlineServers:"Online",offlineServers:"Offline",connectingServers:"Connecting",recentServers:"Recent Servers"},servers:{title:"Servers Management"},groups:{title:"Group Management"},users:{title:"User Management"},settings:{title:"Settings",language:"Language",account:"Account Settings",password:"Change Password",appearance:"Appearance",routeConfig:"Security",installConfig:"Installation",smartRouting:"Smart Routing"},market:{title:"Market Hub - Local and Cloud Markets"},logs:{title:"System Logs"}},nw={filters:"Filters",search:"Search logs...",autoScroll:"Auto-scroll",clearLogs:"Clear logs",loading:"Loading logs...",noLogs:"No logs available.",noMatch:"No logs match the current filters.",mainProcess:"Main Process",childProcess:"Child Process",main:"Main",child:"Child"},lw={add:"Add",addNew:"Add New Group",edit:"Edit Group",delete:"Delete",confirmDelete:"Are you sure you want to delete this group?",deleteWarning:"Deleting group '{{name}}' will remove it and all its server associations. This action cannot be undone.",name:"Group Name",namePlaceholder:"Enter group name",nameRequired:"Group name is required",description:"Description",descriptionPlaceholder:"Enter group description (optional)",createError:"Failed to create group",updateError:"Failed to update group",deleteError:"Failed to delete group",serverAddError:"Failed to add server to group",serverRemoveError:"Failed to remove server from group",addServer:"Add Server to Group",selectServer:"Select a server to add",servers:"Servers in Group",remove:"Remove",noGroups:"No groups available. Create a new group to get started.",noServers:"No servers in this group.",noServerOptions:"No servers available",serverCount:"{{count}} Servers",toolSelection:"Tool Selection",toolsSelected:"Selected",allTools:"All",selectedTools:"Selected tools",selectAll:"Select All",selectNone:"Select None",configureTools:"Configure Tools"},ow={title:"Local Installation",official:"Official",by:"By",unknown:"Unknown",tools:"tools",search:"Search",searchPlaceholder:"Search for servers by name, category, or tags",clearFilters:"Clear",clearCategoryFilter:"",clearTagFilter:"",categories:"Categories",tags:"Tags",showTags:"Show tags",hideTags:"Hide tags",moreTags:"",noServers:"No servers found matching your search",backToList:"Back to list",install:"Install",installing:"Installing...",installed:"Installed",installServer:"Install Server: {{name}}",installSuccess:"Server {{serverName}} installed successfully",author:"Author",license:"License",repository:"Repository",examples:"Examples",arguments:"Arguments",argumentName:"Name",description:"Description",required:"Required",example:"Example",viewSchema:"View schema",fetchError:"Error fetching market servers",serverNotFound:"Server not found",searchError:"Error searching servers",filterError:"Error filtering servers by category",tagFilterError:"Error filtering servers by tag",noInstallationMethod:"No installation method available for this server",showing:"Showing {{from}}-{{to}} of {{total}} servers",perPage:"Per page",confirmVariablesMessage:"Please ensure these variables are properly defined in your runtime environment. Continue installing server?",confirmAndInstall:"Confirm and Install"},iw={title:"Cloud Support",subtitle:"Powered by MCPRouter",by:"By",server:"Server",config:"Config",created:"Created",updated:"Updated",available:"Available",description:"Description",details:"Details",tools:"Tools",tool:"tool",toolsAvailable:"{{count}} tool available||{{count}} tools available",loadingTools:"Loading tools...",noTools:"No tools available for this server",noDescription:"No description available",viewDetails:"View Details",parameters:"Parameters",result:"Result",error:"Error",callTool:"Call",calling:"Calling...",toolCallSuccess:"Tool {{toolName}} executed successfully",toolCallError:"Failed to call tool {{toolName}}: {{error}}",viewSchema:"View Schema",backToList:"Back to Cloud Market",search:"Search",searchPlaceholder:"Search cloud servers by name, title, or author",clearFilters:"Clear Filters",clearCategoryFilter:"Clear",clearTagFilter:"Clear",categories:"Categories",tags:"Tags",noCategories:"No categories found",noTags:"No tags found",noServers:"No cloud servers found",fetchError:"Error fetching cloud servers",serverNotFound:"Cloud server not found",searchError:"Error searching cloud servers",filterError:"Error filtering cloud servers by category",tagFilterError:"Error filtering cloud servers by tag",showing:"Showing {{from}}-{{to}} of {{total}} cloud servers",perPage:"Per page",apiKeyNotConfigured:"MCPRouter API key not configured",apiKeyNotConfiguredDescription:"To use cloud servers, you need to configure your MCPRouter API key.",getApiKey:"Get API Key",configureInSettings:"Configure in Settings",installServer:"Install {{name}}",installSuccess:"Server {{name}} installed successfully",installError:"Failed to install server: {{error}}"},cw={run:"Run",running:"Running...",runTool:"Run Tool",cancel:"Cancel",noDescription:"No description available",inputSchema:"Input Schema:",runToolWithName:"Run Tool: {{name}}",execution:"Tool Execution",successful:"Successful",failed:"Failed",result:"Result:",error:"Error",errorDetails:"Error Details:",noContent:"Tool executed successfully but returned no content.",unknownError:"Unknown error occurred",jsonResponse:"JSON Response:",toolResult:"Tool result",noParameters:"This tool does not require any parameters.",selectOption:"Select an option",enterValue:"Enter {{type}} value",enabled:"Enabled",enableSuccess:"Tool {{name}} enabled successfully",disableSuccess:"Tool {{name}} disabled successfully",toggleFailed:"Failed to toggle tool status",parameters:"Tool Parameters",formMode:"Form Mode",jsonMode:"JSON Mode",jsonConfiguration:"JSON Configuration",invalidJsonFormat:"Invalid JSON format",fixJsonBeforeSwitching:"Please fix JSON format before switching to form mode",item:"Item {{index}}",addItem:"Add {{key}} item",enterKey:"Enter {{key}}"},uw={run:"Get",running:"Getting...",result:"Prompt Result",error:"Prompt Error",execution:"Prompt Execution",successful:"Successful",failed:"Failed",errorDetails:"Error Details:",noContent:"Prompt executed successfully but returned no content.",unknownError:"Unknown error occurred",jsonResponse:"JSON Response:",description:"Description",messages:"Messages",noDescription:"No description available",runPromptWithName:"Get Prompt: {{name}}"},dw={enableGlobalRoute:"Enable Global Route",enableGlobalRouteDescription:"Allow connections to /sse endpoint without specifying a group ID",enableGroupNameRoute:"Enable Group Name Route",enableGroupNameRouteDescription:"Allow connections to /sse endpoint using group names instead of just group IDs",enableBearerAuth:"Enable Bearer Authentication",enableBearerAuthDescription:"Require bearer token authentication for MCP requests",bearerAuthKey:"Bearer Authentication Key",bearerAuthKeyDescription:"The authentication key that will be required in the Bearer token",bearerAuthKeyPlaceholder:"Enter bearer authentication key",skipAuth:"Skip Authentication",skipAuthDescription:"Bypass login requirement for frontend and API access (DEFAULT OFF for security)",pythonIndexUrl:"Python Package Repository URL",pythonIndexUrlDescription:"Set UV_DEFAULT_INDEX environment variable for Python package installation",pythonIndexUrlPlaceholder:"e.g. https://pypi.org/simple",npmRegistry:"NPM Registry URL",npmRegistryDescription:"Set npm_config_registry environment variable for NPM package installation",npmRegistryPlaceholder:"e.g. https://registry.npmjs.org/",baseUrl:"Base URL",baseUrlDescription:"Base URL for MCP requests",baseUrlPlaceholder:"e.g. http://localhost:3000",installConfig:"Installation",systemConfigUpdated:"System configuration updated successfully",enableSmartRouting:"Enable Smart Routing",enableSmartRoutingDescription:"Enable smart routing feature to search the most suitable tool based on input (using $smart group name)",dbUrl:"PostgreSQL URL (requires pgvector support)",dbUrlPlaceholder:"e.g. postgresql://user:password@localhost:5432/dbname",openaiApiBaseUrl:"OpenAI API Base URL",openaiApiBaseUrlPlaceholder:"https://api.openai.com/v1",openaiApiKey:"OpenAI API Key",openaiApiKeyPlaceholder:"Enter OpenAI API key",openaiApiEmbeddingModel:"OpenAI Embedding Model",openaiApiEmbeddingModelPlaceholder:"text-embedding-3-small",smartRoutingConfigUpdated:"Smart routing configuration updated successfully",smartRoutingRequiredFields:"Database URL and OpenAI API Key are required to enable smart routing",smartRoutingValidationError:"Please fill in the required fields before enabling Smart Routing: {{fields}}",mcpRouterConfig:"Cloud Market",mcpRouterApiKey:"MCPRouter API Key",mcpRouterApiKeyDescription:"API key for accessing MCPRouter cloud market services",mcpRouterApiKeyPlaceholder:"Enter MCPRouter API key",mcpRouterReferer:"Referer",mcpRouterRefererDescription:"Referer header for MCPRouter API requests",mcpRouterRefererPlaceholder:"https://www.mcphubx.com",mcpRouterTitle:"Title",mcpRouterTitleDescription:"Title header for MCPRouter API requests",mcpRouterTitlePlaceholder:"MCPHub",mcpRouterBaseUrl:"Base URL",mcpRouterBaseUrlDescription:"Base URL for MCPRouter API",mcpRouterBaseUrlPlaceholder:"https://api.mcprouter.to/v1",systemSettings:"System Settings",nameSeparatorLabel:"Name Separator",nameSeparatorDescription:"Character used to separate server name and tool/prompt name (default: -)",restartRequired:"Configuration saved. It is recommended to restart the application to ensure all services load the new settings correctly."},fw={upload:"Upload",uploadTitle:"Upload DXT Extension",dropFileHere:"Drop your .dxt file here",orClickToSelect:"or click to select from your computer",invalidFileType:"Please select a valid .dxt file",noFileSelected:"Please select a .dxt file to upload",uploading:"Uploading...",uploadFailed:"Failed to upload DXT file",installServer:"Install MCP Server from DXT",extensionInfo:"Extension Information",name:"Name",version:"Version",description:"Description",author:"Author",tools:"Tools",serverName:"Server Name",serverNamePlaceholder:"Enter a name for this server",install:"Install",installing:"Installing...",installFailed:"Failed to install server from DXT",serverExistsTitle:"Server Already Exists",serverExistsConfirm:"Server '{{serverName}}' already exists. Do you want to override it with the new version?",override:"Override"},mw={add:"Add User",addNew:"Add New User",edit:"Edit User",delete:"Delete User",create:"Create User",update:"Update User",username:"Username",password:"Password",newPassword:"New Password",confirmPassword:"Confirm Password",adminRole:"Administrator",admin:"Admin",user:"User",permissions:"Permissions",adminPermissions:"Full system access",userPermissions:"Limited access",currentUser:"You",noUsers:"No users found",adminRequired:"Administrator access required to manage users",usernameRequired:"Username is required",passwordRequired:"Password is required",passwordTooShort:"Password must be at least 6 characters long",passwordMismatch:"Passwords do not match",usernamePlaceholder:"Enter username",passwordPlaceholder:"Enter password",newPasswordPlaceholder:"Leave empty to keep current password",confirmPasswordPlaceholder:"Confirm new password",createError:"Failed to create user",updateError:"Failed to update user",deleteError:"Failed to delete user",statsError:"Failed to fetch user statistics",deleteConfirmation:"Are you sure you want to delete user '{{username}}'? This action cannot be undone.",confirmDelete:"Delete User",deleteWarning:"Are you sure you want to delete user '{{username}}'? This action cannot be undone."},hw={errors:{readonly:"Readonly for demo environment",invalid_credentials:"Invalid username or password",serverNameRequired:"Server name is required",serverConfigRequired:"Server configuration is required",serverConfigInvalid:"Server configuration must include either a URL, OpenAPI specification URL or schema, or command with arguments",serverTypeInvalid:"Server type must be one of: stdio, sse, streamable-http, openapi",urlRequiredForType:"URL is required for {{type}} server type",openapiSpecRequired:"OpenAPI specification URL or schema is required for openapi server type",headersInvalidFormat:"Headers must be an object",headersNotSupportedForStdio:"Headers are not supported for stdio server type",serverNotFound:"Server not found",failedToRemoveServer:"Server not found or failed to remove",internalServerError:"Internal server error",failedToGetServers:"Failed to get servers information",failedToGetServerSettings:"Failed to get server settings",failedToGetServerConfig:"Failed to get server configuration",failedToSaveSettings:"Failed to save settings",toolNameRequired:"Server name and tool name are required",descriptionMustBeString:"Description must be a string",groupIdRequired:"Group ID is required",groupNameRequired:"Group name is required",groupNotFound:"Group not found",groupIdAndServerNameRequired:"Group ID and server name are required",groupOrServerNotFound:"Group or server not found",toolsMustBeAllOrArray:'Tools must be "all" or an array of strings',serverNameAndToolNameRequired:"Server name and tool name are required",usernameRequired:"Username is required",userNotFound:"User not found",failedToGetUsers:"Failed to get users information",failedToGetUserInfo:"Failed to get user information",failedToGetUserStats:"Failed to get user statistics",marketServerNameRequired:"Server name is required",marketServerNotFound:"Market server not found",failedToGetMarketServers:"Failed to get market servers information",failedToGetMarketServer:"Failed to get market server information",failedToGetMarketCategories:"Failed to get market categories",failedToGetMarketTags:"Failed to get market tags",failedToSearchMarketServers:"Failed to search market servers",failedToFilterMarketServers:"Failed to filter market servers",failedToProcessDxtFile:"Failed to process DXT file"},success:{serverCreated:"Server created successfully",serverUpdated:"Server updated successfully",serverRemoved:"Server removed successfully",serverToggled:"Server status toggled successfully",toolToggled:"Tool {{name}} {{action}} successfully",toolDescriptionUpdated:"Tool {{name}} description updated successfully",systemConfigUpdated:"System configuration updated successfully",groupCreated:"Group created successfully",groupUpdated:"Group updated successfully",groupDeleted:"Group deleted successfully",serverAddedToGroup:"Server added to group successfully",serverRemovedFromGroup:"Server removed from group successfully",serverToolsUpdated:"Server tools updated successfully"}},pw={app:F2,about:$2,profile:I2,sponsor:Y2,wechat:X2,discord:Q2,theme:Z2,auth:J2,server:W2,status:ew,errors:tw,common:aw,nav:rw,pages:sw,logs:nw,groups:lw,market:ow,cloud:iw,tool:cw,prompt:uw,settings:dw,dxt:fw,users:mw,api:hw},gw={title:"MCPHub 控制面板",error:"错误",closeButton:"关闭",noServers:"没有可用的 MCP 服务器",loading:"加载中...",logout:"退出登录",profile:"个人资料",changePassword:"修改密码",toggleSidebar:"切换侧边栏",welcomeUser:"欢迎, {{username}}",name:"MCPHub"},xw={title:"关于",versionInfo:"MCPHub 版本: {{version}}",newVersion:"有新版本可用!",currentVersion:"当前版本",newVersionAvailable:"新版本 {{version}} 已发布",viewOnGitHub:"在 GitHub 上查看",checkForUpdates:"检查更新",checking:"检查更新中..."},yw={viewProfile:"查看个人中心",userCenter:"个人中心"},bw={label:"赞助",title:"支持项目",rewardAlt:"赞赏码",supportMessage:"通过捐赠支持 MCPHub 的开发!",supportButton:"在 Ko-fi 上支持"},vw={label:"微信",title:"微信联系",qrCodeAlt:"微信二维码",scanMessage:"扫描二维码添加微信"},ww={label:"Discord",title:"加入我们的 Discord 服务器",community:"加入我们不断壮大的 Discord 社区,获取支持、参与讨论并了解最新动态!"},jw={title:"主题",light:"浅色",dark:"深色",system:"系统"},Nw={login:"登录",loginTitle:"登录 MCPHub",slogan:"统一的 MCP 服务器管理平台",subtitle:"模型上下文协议服务器的集中管理平台,通过灵活的路由策略组织、监控和扩展多个 MCP 服务器。",username:"用户名",password:"密码",loggingIn:"登录中...",emptyFields:"用户名和密码不能为空",loginFailed:"登录失败,请检查用户名和密码",loginError:"登录过程中出现错误",currentPassword:"当前密码",newPassword:"新密码",confirmPassword:"确认密码",passwordsNotMatch:"新密码与确认密码不一致",changePasswordSuccess:"密码修改成功",changePasswordError:"修改密码失败",changePassword:"修改密码",passwordChanged:"密码修改成功",passwordChangeError:"修改密码失败"},Sw={addServer:"添加服务器",add:"添加",edit:"编辑",delete:"删除",confirmDelete:"您确定要删除此服务器吗?",deleteWarning:"删除服务器 '{{name}}' 将会移除该服务器及其所有数据。此操作无法撤销。",status:"状态",tools:"工具",prompts:"提示词",name:"服务器名称",url:"服务器 URL",apiKey:"API 密钥",save:"保存",cancel:"取消",addError:"添加服务器失败",editError:"编辑服务器 {{serverName}} 失败",invalidConfig:"无法找到 {{serverName}} 的配置数据",deleteError:"删除服务器 {{serverName}} 失败",updateError:"更新服务器失败",editTitle:"编辑服务器: {{serverName}}",type:"服务器类型",typeStdio:"STDIO",typeSse:"SSE",typeStreamableHttp:"流式 HTTP",typeOpenapi:"OpenAPI",command:"命令",arguments:"参数",envVars:"环境变量",headers:"HTTP 请求头",key:"键",value:"值",enabled:"已启用",enable:"启用",disable:"禁用",requestOptions:"配置",timeout:"请求超时",timeoutDescription:"请求超时时间(毫秒)",maxTotalTimeout:"最大总超时",maxTotalTimeoutDescription:"无论是否有进度通知的最大总超时时间(毫秒)",resetTimeoutOnProgress:"收到进度通知时重置超时",resetTimeoutOnProgressDescription:"适用于发送周期性进度更新的长时间运行操作",remove:"移除",toggleError:"切换服务器 {{serverName}} 状态失败",alreadyExists:"服务器 {{serverName}} 已经存在",invalidData:"提供的服务器数据无效",notFound:"找不到服务器 {{serverName}}",namePlaceholder:"请输入服务器名称",urlPlaceholder:"请输入服务器URL",commandPlaceholder:"请输入命令",argumentsPlaceholder:"请输入参数",errorDetails:"错误详情",viewErrorDetails:"查看错误详情",confirmVariables:"确认变量配置",variablesDetected:"检测到配置中包含变量,请确认这些变量是否已正确配置:",detectedVariables:"检测到的变量",confirmVariablesMessage:"请确保这些变量在运行环境中已正确定义。是否继续添加服务器?",confirmAndAdd:"确认并添加",openapi:{inputMode:"输入模式",inputModeUrl:"规范 URL",inputModeSchema:"JSON 模式",specUrl:"OpenAPI 规范 URL",schema:"OpenAPI JSON 模式",schemaHelp:"请在此处粘贴完整的 OpenAPI JSON 模式",security:"安全类型",securityNone:"无",securityApiKey:"API 密钥",securityHttp:"HTTP 认证",securityOAuth2:"OAuth 2.0",securityOpenIdConnect:"OpenID Connect",apiKeyConfig:"API 密钥配置",apiKeyName:"请求头/参数名称",apiKeyIn:"位置",apiKeyValue:"API 密钥值",httpAuthConfig:"HTTP 认证配置",httpScheme:"认证方案",httpCredentials:"凭据",httpSchemeBasic:"Basic",httpSchemeBearer:"Bearer",httpSchemeDigest:"Digest",oauth2Config:"OAuth 2.0 配置",oauth2Token:"访问令牌",openIdConnectConfig:"OpenID Connect 配置",openIdConnectUrl:"发现 URL",openIdConnectToken:"ID 令牌",apiKeyInHeader:"请求头",apiKeyInQuery:"查询",apiKeyInCookie:"Cookie",passthroughHeaders:"透传请求头",passthroughHeadersHelp:"要从工具调用请求透传到上游OpenAPI接口的请求头名称列表,用逗号分隔(如:Authorization, X-API-Key)"}},Cw={online:"在线",offline:"离线",connecting:"连接中"},Ew={general:"发生错误",network:"网络连接错误,请检查您的互联网连接",serverConnection:"无法连接到服务器,请检查服务器是否正在运行",serverAdd:"添加服务器失败,请检查服务器状态",serverUpdate:"编辑服务器 {{serverName}} 失败,请检查服务器状态",serverFetch:"获取服务器数据失败,请稍后重试",initialStartup:"服务器可能正在启动中。首次启动可能需要一些时间,请耐心等候...",serverInstall:"安装服务器失败",failedToFetchSettings:"获取设置失败",failedToUpdateSystemConfig:"更新系统配置失败",failedToUpdateRouteConfig:"更新路由配置失败",failedToUpdateSmartRoutingConfig:"更新智能路由配置失败"},kw={processing:"处理中...",save:"保存",cancel:"取消",refresh:"刷新",create:"创建",creating:"创建中...",update:"更新",updating:"更新中...",submitting:"提交中...",delete:"删除",remove:"移除",copy:"复制",copyId:"复制ID",copyUrl:"复制URL",copyJson:"复制JSON",copySuccess:"已复制到剪贴板",copyFailed:"复制失败",close:"关闭",confirm:"确认",language:"语言",true:"是",false:"否",dismiss:"忽略",github:"GitHub",wechat:"微信",discord:"Discord"},Tw={dashboard:"仪表盘",servers:"服务器",settings:"设置",changePassword:"修改密码",groups:"分组",users:"用户",market:"市场",cloud:"云端市场",logs:"日志"},Aw={dashboard:{title:"仪表盘",totalServers:"总数",onlineServers:"在线",offlineServers:"离线",connectingServers:"连接中",recentServers:"最近的服务器"},servers:{title:"服务器管理"},settings:{title:"设置",language:"语言",account:"账户设置",password:"修改密码",appearance:"外观",routeConfig:"安全配置",installConfig:"安装",smartRouting:"智能路由"},groups:{title:"分组管理"},users:{title:"用户管理"},market:{title:"市场中心 - 本地市场和云端市场"},logs:{title:"系统日志"}},Rw={filters:"筛选",search:"搜索日志...",autoScroll:"自动滚动",clearLogs:"清除日志",loading:"加载日志中...",noLogs:"暂无日志。",noMatch:"没有匹配当前筛选条件的日志。",mainProcess:"主进程",childProcess:"子进程",main:"主",child:"子"},Mw={add:"添加",addNew:"添加新分组",edit:"编辑分组",delete:"删除",confirmDelete:"您确定要删除此分组吗?",deleteWarning:"删除分组 '{{name}}' 将会移除该分组及其所有服务器关联。此操作无法撤销。",name:"分组名称",namePlaceholder:"请输入分组名称",nameRequired:"分组名称不能为空",description:"描述",descriptionPlaceholder:"请输入分组描述(可选)",createError:"创建分组失败",updateError:"更新分组失败",deleteError:"删除分组失败",serverAddError:"向分组添加服务器失败",serverRemoveError:"从分组移除服务器失败",addServer:"添加服务器到分组",selectServer:"选择要添加的服务器",servers:"分组中的服务器",remove:"移除",noGroups:"暂无可用分组。创建一个新分组以开始使用。",noServers:"此分组中没有服务器。",noServerOptions:"没有可用的服务器",serverCount:"{{count}} 台服务器",toolSelection:"工具选择",toolsSelected:"选择",allTools:"全部",selectedTools:"选中的工具",selectAll:"全选",selectNone:"全不选",configureTools:"配置工具"},Ow={title:"本地安装",official:"官方",by:"作者",unknown:"未知",tools:"工具",search:"搜索",searchPlaceholder:"搜索服务器名称、分类或标签",clearFilters:"清除",clearCategoryFilter:"",clearTagFilter:"",categories:"分类",tags:"标签",showTags:"显示标签",hideTags:"隐藏标签",moreTags:"",noServers:"未找到匹配的服务器",backToList:"返回列表",install:"安装",installing:"安装中...",installed:"已安装",installServer:"安装服务器: {{name}}",installSuccess:"服务器 {{serverName}} 安装成功",author:"作者",license:"许可证",repository:"代码仓库",examples:"示例",arguments:"参数",argumentName:"名称",description:"描述",required:"必填",example:"示例",viewSchema:"查看结构",fetchError:"获取本地市场服务器数据失败",serverNotFound:"未找到服务器",searchError:"搜索服务器失败",filterError:"按分类筛选服务器失败",tagFilterError:"按标签筛选服务器失败",noInstallationMethod:"该服务器没有可用的安装方法",showing:"显示 {{from}}-{{to}}/{{total}} 个服务器",perPage:"每页显示",confirmVariablesMessage:"请确保这些变量在运行环境中已正确定义。是否继续安装服务器?",confirmAndInstall:"确认并安装"},Dw={title:"云端支持",subtitle:"由 MCPRouter 提供支持",by:"作者",server:"服务器",config:"配置",created:"创建时间",updated:"更新时间",available:"可用",description:"描述",details:"详细信息",tools:"工具",tool:"个工具",toolsAvailable:"{{count}} 个工具可用",loadingTools:"加载工具中...",noTools:"该服务器没有可用工具",noDescription:"无描述信息",viewDetails:"查看详情",parameters:"参数",result:"结果",error:"错误",callTool:"调用",calling:"调用中...",toolCallSuccess:"工具 {{toolName}} 执行成功",toolCallError:"调用工具 {{toolName}} 失败:{{error}}",viewSchema:"查看结构",backToList:"返回云端市场",search:"搜索",searchPlaceholder:"搜索云端服务器名称、标题或作者",clearFilters:"清除筛选",clearCategoryFilter:"清除",clearTagFilter:"清除",categories:"分类",tags:"标签",noCategories:"未找到分类",noTags:"未找到标签",noServers:"未找到云端服务器",fetchError:"获取云端服务器失败",serverNotFound:"未找到云端服务器",searchError:"搜索云端服务器失败",filterError:"按分类筛选云端服务器失败",tagFilterError:"按标签筛选云端服务器失败",showing:"显示 {{from}}-{{to}}/{{total}} 个云端服务器",perPage:"每页显示",apiKeyNotConfigured:"MCPRouter API 密钥未配置",apiKeyNotConfiguredDescription:"要使用云端服务器,您需要配置 MCPRouter API 密钥。",getApiKey:"获取 API 密钥",configureInSettings:"在设置中配置",installServer:"安装 {{name}}",installSuccess:"服务器 {{name}} 安装成功",installError:"安装服务器失败:{{error}}"},Uw={run:"运行",running:"运行中...",runTool:"运行",cancel:"取消",noDescription:"无描述信息",inputSchema:"输入模式:",runToolWithName:"运行工具:{{name}}",execution:"工具执行",successful:"成功",failed:"失败",result:"结果:",error:"错误",errorDetails:"错误详情:",noContent:"工具执行成功但未返回内容。",unknownError:"发生未知错误",jsonResponse:"JSON 响应:",toolResult:"工具结果",noParameters:"此工具不需要任何参数。",selectOption:"选择一个选项",enterValue:"输入{{type}}值",enabled:"已启用",enableSuccess:"工具 {{name}} 启用成功",disableSuccess:"工具 {{name}} 禁用成功",toggleFailed:"切换工具状态失败",parameters:"工具参数",formMode:"表单模式",jsonMode:"JSON 模式",jsonConfiguration:"JSON 配置",invalidJsonFormat:"无效的 JSON 格式",fixJsonBeforeSwitching:"请修复 JSON 格式后再切换到表单模式",item:"项目 {{index}}",addItem:"添加 {{key}} 项目",enterKey:"输入 {{key}}"},zw={run:"获取",running:"获取中...",result:"提示词结果",error:"提示词错误",execution:"提示词执行",successful:"成功",failed:"失败",errorDetails:"错误详情:",noContent:"提示词执行成功但未返回内容。",unknownError:"发生未知错误",jsonResponse:"JSON 响应:",description:"描述",messages:"消息",noDescription:"无描述信息",runPromptWithName:"获取提示词: {{name}}"},Lw={enableGlobalRoute:"启用全局路由",enableGlobalRouteDescription:"允许不指定组 ID 就连接到 /sse 端点",enableGroupNameRoute:"启用组名路由",enableGroupNameRouteDescription:"允许使用组名而不仅仅是组 ID 连接到 /sse 端点",enableBearerAuth:"启用 Bearer 认证",enableBearerAuthDescription:"对 MCP 请求启用 Bearer 令牌认证",bearerAuthKey:"Bearer 认证密钥",bearerAuthKeyDescription:"Bearer 令牌中需要携带的认证密钥",bearerAuthKeyPlaceholder:"请输入 Bearer 认证密钥",skipAuth:"免登录开关",skipAuthDescription:"跳过前端和 API 访问的登录要求(默认关闭确保安全性)",pythonIndexUrl:"Python 包仓库地址",pythonIndexUrlDescription:"设置 UV_DEFAULT_INDEX 环境变量,用于 Python 包安装",pythonIndexUrlPlaceholder:"例如: https://mirrors.aliyun.com/pypi/simple",npmRegistry:"NPM 仓库地址",npmRegistryDescription:"设置 npm_config_registry 环境变量,用于 NPM 包安装",npmRegistryPlaceholder:"例如: https://registry.npmmirror.com/",baseUrl:"基础地址",baseUrlDescription:"用于 MCP 请求的基础地址",baseUrlPlaceholder:"例如: http://localhost:3000",installConfig:"安装配置",systemConfigUpdated:"系统配置更新成功",enableSmartRouting:"启用智能路由",enableSmartRoutingDescription:"开启智能路由功能,根据输入自动搜索最合适的工具(使用 $smart 分组)",dbUrl:"PostgreSQL 连接地址(必须支持 pgvector)",dbUrlPlaceholder:"例如: postgresql://user:password@localhost:5432/dbname",openaiApiBaseUrl:"OpenAI API 基础地址",openaiApiBaseUrlPlaceholder:"https://api.openai.com/v1",openaiApiKey:"OpenAI API 密钥",openaiApiKeyDescription:"用于访问 OpenAI API 的密钥",openaiApiKeyPlaceholder:"请输入 OpenAI API 密钥",openaiApiEmbeddingModel:"OpenAI 嵌入模型",openaiApiEmbeddingModelPlaceholder:"text-embedding-3-small",smartRoutingConfigUpdated:"智能路由配置更新成功",smartRoutingRequiredFields:"启用智能路由需要填写数据库连接地址和 OpenAI API 密钥",smartRoutingValidationError:"启用智能路由前请先填写必要字段:{{fields}}",mcpRouterConfig:"云端市场",mcpRouterApiKey:"MCPRouter API 密钥",mcpRouterApiKeyDescription:"用于访问 MCPRouter 云端市场服务的 API 密钥",mcpRouterApiKeyPlaceholder:"请输入 MCPRouter API 密钥",mcpRouterReferer:"引用地址",mcpRouterRefererDescription:"MCPRouter API 请求的引用地址头",mcpRouterRefererPlaceholder:"https://www.mcphubx.com",mcpRouterTitle:"标题",mcpRouterTitleDescription:"MCPRouter API 请求的标题头",mcpRouterTitlePlaceholder:"MCPHub",mcpRouterBaseUrl:"基础地址",mcpRouterBaseUrlDescription:"MCPRouter API 的基础地址",mcpRouterBaseUrlPlaceholder:"https://api.mcprouter.to/v1",systemSettings:"系统设置",nameSeparatorLabel:"名称分隔符",nameSeparatorDescription:"用于分隔服务器名称和工具/提示名称(默认:-)",restartRequired:"配置已保存。为确保所有服务正确加载新设置,建议重启应用。"},_w={upload:"上传",uploadTitle:"上传 DXT 扩展",dropFileHere:"将 .dxt 文件拖拽到此处",orClickToSelect:"或点击从计算机选择",invalidFileType:"请选择有效的 .dxt 文件",noFileSelected:"请选择要上传的 .dxt 文件",uploading:"上传中...",uploadFailed:"上传 DXT 文件失败",installServer:"从 DXT 安装 MCP 服务器",extensionInfo:"扩展信息",name:"名称",version:"版本",description:"描述",author:"作者",tools:"工具",serverName:"服务器名称",serverNamePlaceholder:"为此服务器输入名称",install:"安装",installing:"安装中...",installFailed:"从 DXT 安装服务器失败",serverExistsTitle:"服务器已存在",serverExistsConfirm:"服务器 '{{serverName}}' 已存在。是否要用新版本覆盖它?",override:"覆盖"},Pw={add:"添加",addNew:"添加新用户",edit:"编辑用户",delete:"删除用户",create:"创建",update:"更新",username:"用户名",password:"密码",newPassword:"新密码",confirmPassword:"确认密码",adminRole:"管理员",admin:"管理员",user:"用户",permissions:"权限",adminPermissions:"完全系统访问权限",userPermissions:"受限访问权限",currentUser:"当前用户",noUsers:"没有找到用户",adminRequired:"需要管理员权限才能管理用户",usernameRequired:"用户名是必需的",passwordRequired:"密码是必需的",passwordTooShort:"密码至少需要6个字符",passwordMismatch:"密码不匹配",usernamePlaceholder:"输入用户名",passwordPlaceholder:"输入密码",newPasswordPlaceholder:"留空保持当前密码",confirmPasswordPlaceholder:"确认新密码",createError:"创建用户失败",updateError:"更新用户失败",deleteError:"删除用户失败",statsError:"获取用户统计失败",deleteConfirmation:"您确定要删除用户 '{{username}}' 吗?此操作无法撤消。",confirmDelete:"删除用户",deleteWarning:"您确定要删除用户 '{{username}}' 吗?此操作无法撤消。"},Hw={errors:{readonly:"演示环境无法修改数据",invalid_credentials:"用户名或密码错误",serverNameRequired:"服务器名称是必需的",serverConfigRequired:"服务器配置是必需的",serverConfigInvalid:"服务器配置必须包含 URL、OpenAPI 规范 URL 或模式,或者带参数的命令",serverTypeInvalid:"服务器类型必须是以下之一:stdio、sse、streamable-http、openapi",urlRequiredForType:"{{type}} 服务器类型需要 URL",openapiSpecRequired:"openapi 服务器类型需要 OpenAPI 规范 URL 或模式",headersInvalidFormat:"请求头必须是对象格式",headersNotSupportedForStdio:"stdio 服务器类型不支持请求头",serverNotFound:"找不到服务器",failedToRemoveServer:"找不到服务器或删除失败",internalServerError:"服务器内部错误",failedToGetServers:"获取服务器信息失败",failedToGetServerSettings:"获取服务器设置失败",failedToGetServerConfig:"获取服务器配置失败",failedToSaveSettings:"保存设置失败",toolNameRequired:"服务器名称和工具名称是必需的",descriptionMustBeString:"描述必须是字符串",groupIdRequired:"分组 ID 是必需的",groupNameRequired:"分组名称是必需的",groupNotFound:"找不到分组",groupIdAndServerNameRequired:"分组 ID 和服务器名称是必需的",groupOrServerNotFound:"找不到分组或服务器",toolsMustBeAllOrArray:'工具必须是 "all" 或字符串数组',serverNameAndToolNameRequired:"服务器名称和工具名称是必需的",usernameRequired:"用户名是必需的",userNotFound:"找不到用户",failedToGetUsers:"获取用户信息失败",failedToGetUserInfo:"获取用户信息失败",failedToGetUserStats:"获取用户统计信息失败",marketServerNameRequired:"服务器名称是必需的",marketServerNotFound:"找不到市场服务器",failedToGetMarketServers:"获取市场服务器信息失败",failedToGetMarketServer:"获取市场服务器信息失败",failedToGetMarketCategories:"获取市场类别失败",failedToGetMarketTags:"获取市场标签失败",failedToSearchMarketServers:"搜索市场服务器失败",failedToFilterMarketServers:"过滤市场服务器失败",failedToProcessDxtFile:"处理 DXT 文件失败"},success:{serverCreated:"服务器创建成功",serverUpdated:"服务器更新成功",serverRemoved:"服务器删除成功",serverToggled:"服务器状态切换成功",toolToggled:"工具 {{name}} {{action}} 成功",toolDescriptionUpdated:"工具 {{name}} 描述更新成功",systemConfigUpdated:"系统配置更新成功",groupCreated:"分组创建成功",groupUpdated:"分组更新成功",groupDeleted:"分组删除成功",serverAddedToGroup:"服务器添加到分组成功",serverRemovedFromGroup:"服务器从分组移除成功",serverToolsUpdated:"服务器工具更新成功"}},Bw={app:gw,about:xw,profile:yw,sponsor:bw,wechat:vw,discord:ww,theme:jw,auth:Nw,server:Sw,status:Cw,errors:Ew,common:kw,nav:Tw,pages:Aw,logs:Rw,groups:Mw,market:Ow,cloud:Dw,tool:Uw,prompt:zw,settings:Lw,dxt:_w,users:Pw,api:Hw},qw={title:"Tableau de bord MCPHub",error:"Erreur",closeButton:"Fermer",noServers:"Aucun serveur MCP disponible",loading:"Chargement...",logout:"Déconnexion",profile:"Profil",changePassword:"Changer le mot de passe",toggleSidebar:"Basculer la barre latérale",welcomeUser:"Bienvenue, {{username}}",name:"MCPHub"},Vw={title:"À propos",versionInfo:"Version MCPHub : {{version}}",newVersion:"Nouvelle version disponible !",currentVersion:"Version actuelle",newVersionAvailable:"La nouvelle version {{version}} est disponible",viewOnGitHub:"Voir sur GitHub",checkForUpdates:"Vérifier les mises à jour",checking:"Vérification des mises à jour..."},Gw={viewProfile:"Voir le profil",userCenter:"Centre utilisateur"},Kw={label:"Sponsor",title:"Soutenir le projet",rewardAlt:"QR Code de récompense",supportMessage:"Soutenez le développement de MCPHub en m'offrant un café !",supportButton:"Soutenir sur Ko-fi"},Fw={label:"WeChat",title:"Se connecter via WeChat",qrCodeAlt:"QR Code WeChat",scanMessage:"Scannez ce QR code pour nous contacter sur WeChat"},$w={label:"Discord",title:"Rejoignez notre serveur Discord",community:"Rejoignez notre communauté grandissante sur Discord pour du support, des discussions et des mises à jour !"},Iw={title:"Thème",light:"Clair",dark:"Sombre",system:"Système"},Yw={login:"Connexion",loginTitle:"Se connecter à MCPHub",slogan:"Le Hub unifié pour les serveurs MCP",subtitle:"Plateforme de gestion centralisée pour les serveurs Model Context Protocol. Organisez, surveillez et mettez à l'échelle plusieurs serveurs MCP avec des stratégies de routage flexibles.",username:"Nom d'utilisateur",password:"Mot de passe",loggingIn:"Connexion en cours...",emptyFields:"Le nom d'utilisateur et le mot de passe ne peuvent pas être vides",loginFailed:"Échec de la connexion, veuillez vérifier votre nom d'utilisateur et votre mot de passe",loginError:"Une erreur est survenue lors de la connexion",currentPassword:"Mot de passe actuel",newPassword:"Nouveau mot de passe",confirmPassword:"Confirmer le mot de passe",passwordsNotMatch:"Le nouveau mot de passe et la confirmation ne correspondent pas",changePasswordSuccess:"Mot de passe changé avec succès",changePasswordError:"Échec du changement de mot de passe",changePassword:"Changer le mot de passe",passwordChanged:"Mot de passe changé avec succès",passwordChangeError:"Échec du changement de mot de passe"},Xw={addServer:"Ajouter un serveur",add:"Ajouter",edit:"Modifier",delete:"Supprimer",confirmDelete:"Êtes-vous sûr de vouloir supprimer ce serveur ?",deleteWarning:"La suppression du serveur '{{name}}' le supprimera ainsi que toutes ses données. Cette action est irréversible.",status:"Statut",tools:"Outils",prompts:"Invites",name:"Nom du serveur",url:"URL du serveur",apiKey:"Clé API",save:"Enregistrer",cancel:"Annuler",invalidConfig:"Impossible de trouver les données de configuration pour {{serverName}}",addError:"Échec de l'ajout du serveur",editError:"Échec de la modification du serveur {{serverName}}",deleteError:"Échec de la suppression du serveur {{serverName}}",updateError:"Échec de la mise à jour du serveur",editTitle:"Modifier le serveur : {{serverName}}",type:"Type de serveur",typeStdio:"STDIO",typeSse:"SSE",typeStreamableHttp:"HTTP diffusable",typeOpenapi:"OpenAPI",command:"Commande",arguments:"Arguments",envVars:"Variables d'environnement",headers:"En-têtes HTTP",key:"clé",value:"valeur",enabled:"Activé",enable:"Activer",disable:"Désactiver",requestOptions:"Configuration",timeout:"Délai d'attente de la requête",timeoutDescription:"Délai d'attente pour les requêtes vers le serveur MCP (ms)",maxTotalTimeout:"Délai d'attente total maximum",maxTotalTimeoutDescription:"Délai d'attente total maximum pour les requêtes envoyées au serveur MCP (ms) (à utiliser avec les notifications de progression)",resetTimeoutOnProgress:"Réinitialiser le délai d'attente en cas de progression",resetTimeoutOnProgressDescription:"Réinitialiser le délai d'attente lors des notifications de progression",remove:"Retirer",toggleError:"Échec du basculement du serveur {{serverName}}",alreadyExists:"Le serveur {{serverName}} existe déjà",invalidData:"Données de serveur invalides fournies",notFound:"Serveur {{serverName}} non trouvé",namePlaceholder:"Entrez le nom du serveur",urlPlaceholder:"Entrez l'URL du serveur",commandPlaceholder:"Entrez la commande",argumentsPlaceholder:"Entrez les arguments",errorDetails:"Détails de l'erreur",viewErrorDetails:"Voir les détails de l'erreur",confirmVariables:"Confirmer la configuration des variables",variablesDetected:"Variables détectées dans la configuration. Veuillez confirmer que ces variables sont correctement configurées :",detectedVariables:"Variables détectées",confirmVariablesMessage:"Veuillez vous assurer que ces variables sont correctement définies dans votre environnement d'exécution. Continuer l'ajout du serveur ?",confirmAndAdd:"Confirmer et ajouter",openapi:{inputMode:"Mode de saisie",inputModeUrl:"URL de la spécification",inputModeSchema:"Schéma JSON",specUrl:"URL de la spécification OpenAPI",schema:"Schéma JSON OpenAPI",schemaHelp:"Collez votre schéma JSON OpenAPI complet ici",security:"Type de sécurité",securityNone:"Aucun",securityApiKey:"Clé API",securityHttp:"Authentification HTTP",securityOAuth2:"OAuth 2.0",securityOpenIdConnect:"OpenID Connect",apiKeyConfig:"Configuration de la clé API",apiKeyName:"Nom de l'en-tête/paramètre",apiKeyIn:"Emplacement",apiKeyValue:"Valeur de la clé API",httpAuthConfig:"Configuration de l'authentification HTTP",httpScheme:"Schéma d'authentification",httpCredentials:"Identifiants",httpSchemeBasic:"Basic",httpSchemeBearer:"Bearer",httpSchemeDigest:"Digest",oauth2Config:"Configuration OAuth 2.0",oauth2Token:"Jeton d'accès",openIdConnectConfig:"Configuration OpenID Connect",openIdConnectUrl:"URL de découverte",openIdConnectToken:"Jeton d'identification",apiKeyInHeader:"En-tête",apiKeyInQuery:"Requête",apiKeyInCookie:"Cookie",passthroughHeaders:"En-têtes de transmission",passthroughHeadersHelp:"Liste séparée par des virgules des noms d'en-têtes à transmettre des requêtes d'appel d'outils vers les points de terminaison OpenAPI en amont (par ex. : Authorization, X-API-Key)"}},Qw={online:"En ligne",offline:"Hors ligne",connecting:"Connexion en cours"},Zw={general:"Une erreur est survenue",network:"Erreur de connexion réseau. Veuillez vérifier votre connexion Internet",serverConnection:"Impossible de se connecter au serveur. Veuillez vérifier si le serveur est en cours d'exécution",serverAdd:"Échec de l'ajout du serveur. Veuillez vérifier l'état du serveur",serverUpdate:"Échec de la modification du serveur {{serverName}}. Veuillez vérifier l'état du serveur",serverFetch:"Échec de la récupération des données du serveur. Veuillez réessayer plus tard",initialStartup:"Le serveur est peut-être en cours de démarrage. Veuillez patienter un instant car ce processus peut prendre du temps au premier lancement...",serverInstall:"Échec de l'installation du serveur",failedToFetchSettings:"Échec de la récupération des paramètres",failedToUpdateRouteConfig:"Échec de la mise à jour de la configuration de routage",failedToUpdateSmartRoutingConfig:"Échec de la mise à jour de la configuration du routage intelligent"},Jw={processing:"En cours de traitement...",save:"Enregistrer",cancel:"Annuler",refresh:"Actualiser",create:"Créer",creating:"Création en cours...",update:"Mettre à jour",updating:"Mise à jour en cours...",submitting:"Envoi en cours...",delete:"Supprimer",remove:"Retirer",copy:"Copier",copyId:"Copier l'ID",copyUrl:"Copier l'URL",copyJson:"Copier le JSON",copySuccess:"Copié dans le presse-papiers",copyFailed:"Échec de la copie",close:"Fermer",confirm:"Confirmer",language:"Langue",true:"Vrai",false:"Faux",dismiss:"Rejeter",github:"GitHub",wechat:"WeChat",discord:"Discord"},Ww={dashboard:"Tableau de bord",servers:"Serveurs",groups:"Groupes",users:"Utilisateurs",settings:"Paramètres",changePassword:"Changer le mot de passe",market:"Marché",cloud:"Marché Cloud",logs:"Journaux"},ej={dashboard:{title:"Tableau de bord",totalServers:"Total",onlineServers:"En ligne",offlineServers:"Hors ligne",connectingServers:"En connexion",recentServers:"Serveurs récents"},servers:{title:"Gestion des serveurs"},groups:{title:"Gestion des groupes"},users:{title:"Gestion des utilisateurs"},settings:{title:"Paramètres",language:"Langue",account:"Paramètres du compte",password:"Changer le mot de passe",appearance:"Apparence",routeConfig:"Sécurité",installConfig:"Installation",smartRouting:"Routage intelligent"},market:{title:"Marché Hub - Marchés locaux et Cloud"},logs:{title:"Journaux système"}},tj={filters:"Filtres",search:"Rechercher dans les journaux...",autoScroll:"Défilement automatique",clearLogs:"Effacer les journaux",loading:"Chargement des journaux...",noLogs:"Aucun journal disponible.",noMatch:"Aucun journal ne correspond aux filtres actuels.",mainProcess:"Processus principal",childProcess:"Processus enfant",main:"Principal",child:"Enfant"},aj={add:"Ajouter",addNew:"Ajouter un nouveau groupe",edit:"Modifier le groupe",delete:"Supprimer",confirmDelete:"Êtes-vous sûr de vouloir supprimer ce groupe ?",deleteWarning:"La suppression du groupe '{{name}}' le supprimera ainsi que toutes ses associations de serveurs. Cette action est irréversible.",name:"Nom du groupe",namePlaceholder:"Entrez le nom du groupe",nameRequired:"Le nom du groupe est requis",description:"Description",descriptionPlaceholder:"Entrez la description du groupe (facultatif)",createError:"Échec de la création du groupe",updateError:"Échec de la mise à jour du groupe",deleteError:"Échec de la suppression du groupe",serverAddError:"Échec de l'ajout du serveur au groupe",serverRemoveError:"Échec de la suppression du serveur du groupe",addServer:"Ajouter un serveur au groupe",selectServer:"Sélectionnez un serveur à ajouter",servers:"Serveurs dans le groupe",remove:"Retirer",noGroups:"Aucun groupe disponible. Créez un nouveau groupe pour commencer.",noServers:"Aucun serveur dans ce groupe.",noServerOptions:"Aucun serveur disponible",serverCount:"{{count}} serveurs",toolSelection:"Sélection d'outils",toolsSelected:"Sélectionné",allTools:"Tous",selectedTools:"Outils sélectionnés",selectAll:"Tout sélectionner",selectNone:"Ne rien sélectionner",configureTools:"Configurer les outils"},rj={title:"Installation locale",official:"Officiel",by:"Par",unknown:"Inconnu",tools:"outils",search:"Rechercher",searchPlaceholder:"Rechercher des serveurs par nom, catégorie ou tags",clearFilters:"Effacer",clearCategoryFilter:"",clearTagFilter:"",categories:"Catégories",tags:"Tags",showTags:"Afficher les tags",hideTags:"Masquer les tags",moreTags:"",noServers:"Aucun serveur trouvé correspondant à votre recherche",backToList:"Retour à la liste",install:"Installer",installing:"Installation en cours...",installed:"Installé",installServer:"Installer le serveur : {{name}}",installSuccess:"Serveur {{serverName}} installé avec succès",author:"Auteur",license:"Licence",repository:"Dépôt",examples:"Exemples",arguments:"Arguments",argumentName:"Nom",description:"Description",required:"Requis",example:"Exemple",viewSchema:"Voir le schéma",fetchError:"Erreur lors de la récupération des serveurs du marché",serverNotFound:"Serveur non trouvé",searchError:"Erreur lors de la recherche de serveurs",filterError:"Erreur lors du filtrage des serveurs par catégorie",tagFilterError:"Erreur lors du filtrage des serveurs par tag",noInstallationMethod:"Aucune méthode d'installation disponible pour ce serveur",showing:"Affichage de {{from}}-{{to}} sur {{total}} serveurs",perPage:"Par page",confirmVariablesMessage:"Veuillez vous assurer que ces variables sont correctement définies dans votre environnement d'exécution. Continuer l'installation du serveur ?",confirmAndInstall:"Confirmer et installer"},sj={title:"Support Cloud",subtitle:"Propulsé par MCPRouter",by:"Par",server:"Serveur",config:"Config",created:"Créé",updated:"Mis à jour",available:"Disponible",description:"Description",details:"Détails",tools:"Outils",tool:"outil",toolsAvailable:"{{count}} outil disponible||{{count}} outils disponibles",loadingTools:"Chargement des outils...",noTools:"Aucun outil disponible pour ce serveur",noDescription:"Aucune description disponible",viewDetails:"Voir les détails",parameters:"Paramètres",result:"Résultat",error:"Erreur",callTool:"Appeler",calling:"Appel en cours...",toolCallSuccess:"L'outil {{toolName}} a été exécuté avec succès",toolCallError:"Échec de l'appel de l'outil {{toolName}} : {{error}}",viewSchema:"Voir le schéma",backToList:"Retour au marché Cloud",search:"Rechercher",searchPlaceholder:"Rechercher des serveurs cloud par nom, titre ou auteur",clearFilters:"Effacer les filtres",clearCategoryFilter:"Effacer",clearTagFilter:"Effacer",categories:"Catégories",tags:"Tags",noCategories:"Aucune catégorie trouvée",noTags:"Aucun tag trouvé",noServers:"Aucun serveur cloud trouvé",fetchError:"Erreur lors de la récupération des serveurs cloud",serverNotFound:"Serveur cloud non trouvé",searchError:"Erreur lors de la recherche de serveurs cloud",filterError:"Erreur lors du filtrage des serveurs cloud par catégorie",tagFilterError:"Erreur lors du filtrage des serveurs cloud par tag",showing:"Affichage de {{from}}-{{to}} sur {{total}} serveurs cloud",perPage:"Par page",apiKeyNotConfigured:"Clé API MCPRouter non configurée",apiKeyNotConfiguredDescription:"Pour utiliser les serveurs cloud, vous devez configurer votre clé API MCPRouter.",getApiKey:"Obtenir une clé API",configureInSettings:"Configurer dans les paramètres",installServer:"Installer {{name}}",installSuccess:"Serveur {{name}} installé avec succès",installError:"Échec de l'installation du serveur : {{error}}"},nj={run:"Exécuter",running:"Exécution en cours...",runTool:"Exécuter l'outil",cancel:"Annuler",noDescription:"Aucune description disponible",inputSchema:"Schéma d'entrée :",runToolWithName:"Exécuter l'outil : {{name}}",execution:"Exécution de l'outil",successful:"Réussi",failed:"Échoué",result:"Résultat :",error:"Erreur",errorDetails:"Détails de l'erreur :",noContent:"L'outil a été exécuté avec succès mais n'a renvoyé aucun contenu.",unknownError:"Une erreur inconnue est survenue",jsonResponse:"Réponse JSON :",toolResult:"Résultat de l'outil",noParameters:"Cet outil ne nécessite aucun paramètre.",selectOption:"Sélectionnez une option",enterValue:"Entrez la valeur {{type}}",enabled:"Activé",enableSuccess:"Outil {{name}} activé avec succès",disableSuccess:"Outil {{name}} désactivé avec succès",toggleFailed:"Échec du basculement de l'état de l'outil",parameters:"Paramètres de l'outil",formMode:"Mode formulaire",jsonMode:"Mode JSON",jsonConfiguration:"Configuration JSON",invalidJsonFormat:"Format JSON invalide",fixJsonBeforeSwitching:"Veuillez corriger le format JSON avant de passer en mode formulaire",item:"Élément {{index}}",addItem:"Ajouter un élément {{key}}",enterKey:"Entrez {{key}}"},lj={run:"Obtenir",running:"Obtention en cours...",result:"Résultat de l'invite",error:"Erreur de l'invite",execution:"Exécution de l'invite",successful:"Réussi",failed:"Échoué",errorDetails:"Détails de l'erreur :",noContent:"L'invite a été exécutée avec succès mais n'a renvoyé aucun contenu.",unknownError:"Une erreur inconnue est survenue",jsonResponse:"Réponse JSON :",description:"Description",messages:"Messages",noDescription:"Aucune description disponible",runPromptWithName:"Obtenir l'invite : {{name}}"},oj={enableGlobalRoute:"Activer la route globale",enableGlobalRouteDescription:"Autoriser les connexions au point de terminaison /sse sans spécifier d'ID de groupe",enableGroupNameRoute:"Activer la route par nom de groupe",enableGroupNameRouteDescription:"Autoriser les connexions au point de terminaison /sse en utilisant les noms de groupe au lieu des ID de groupe",enableBearerAuth:"Activer l'authentification Bearer",enableBearerAuthDescription:"Exiger une authentification par jeton Bearer pour les requêtes MCP",bearerAuthKey:"Clé d'authentification Bearer",bearerAuthKeyDescription:"La clé d'authentification qui sera requise dans le jeton Bearer",bearerAuthKeyPlaceholder:"Entrez la clé d'authentification Bearer",skipAuth:"Ignorer l'authentification",skipAuthDescription:"Contourner l'exigence de connexion pour l'accès au frontend et à l'API (DÉSACTIVÉ PAR DÉFAUT pour des raisons de sécurité)",pythonIndexUrl:"URL du dépôt de paquets Python",pythonIndexUrlDescription:"Définir la variable d'environnement UV_DEFAULT_INDEX pour l'installation de paquets Python",pythonIndexUrlPlaceholder:"ex. https://pypi.org/simple",npmRegistry:"URL du registre NPM",npmRegistryDescription:"Définir la variable d'environnement npm_config_registry pour l'installation de paquets NPM",npmRegistryPlaceholder:"ex. https://registry.npmjs.org/",baseUrl:"URL de base",baseUrlDescription:"URL de base pour les requêtes MCP",baseUrlPlaceholder:"ex. http://localhost:3000",installConfig:"Installation",systemConfigUpdated:"Configuration système mise à jour avec succès",enableSmartRouting:"Activer le routage intelligent",enableSmartRoutingDescription:"Activer la fonctionnalité de routage intelligent pour rechercher l'outil le plus approprié en fonction de l'entrée (en utilisant le nom de groupe $smart)",dbUrl:"URL PostgreSQL (nécessite le support de pgvector)",dbUrlPlaceholder:"ex. postgresql://user:password@localhost:5432/dbname",openaiApiBaseUrl:"URL de base de l'API OpenAI",openaiApiBaseUrlPlaceholder:"https://api.openai.com/v1",openaiApiKey:"Clé API OpenAI",openaiApiKeyPlaceholder:"Entrez la clé API OpenAI",openaiApiEmbeddingModel:"Modèle d'intégration OpenAI",openaiApiEmbeddingModelPlaceholder:"text-embedding-3-small",smartRoutingConfigUpdated:"Configuration du routage intelligent mise à jour avec succès",smartRoutingRequiredFields:"L'URL de la base de données et la clé API OpenAI sont requises pour activer le routage intelligent",smartRoutingValidationError:"Veuillez remplir les champs obligatoires avant d'activer le routage intelligent : {{fields}}",mcpRouterConfig:"Marché Cloud",mcpRouterApiKey:"Clé API MCPRouter",mcpRouterApiKeyDescription:"Clé API pour accéder aux services du marché cloud MCPRouter",mcpRouterApiKeyPlaceholder:"Entrez la clé API MCPRouter",mcpRouterReferer:"Référent",mcpRouterRefererDescription:"En-tête Referer pour les requêtes API MCPRouter",mcpRouterRefererPlaceholder:"https://www.mcphubx.com",mcpRouterTitle:"Titre",mcpRouterTitleDescription:"En-tête Title pour les requêtes API MCPRouter",mcpRouterTitlePlaceholder:"MCPHub",mcpRouterBaseUrl:"URL de base",mcpRouterBaseUrlDescription:"URL de base pour l'API MCPRouter",mcpRouterBaseUrlPlaceholder:"https://api.mcprouter.to/v1",systemSettings:"Paramètres système",nameSeparatorLabel:"Séparateur de noms",nameSeparatorDescription:"Caractère utilisé pour séparer le nom du serveur et le nom de l'outil/prompt (par défaut : -)",restartRequired:"Configuration enregistrée. Il est recommandé de redémarrer l'application pour s'assurer que tous les services chargent correctement les nouveaux paramètres."},ij={upload:"Télécharger",uploadTitle:"Télécharger l'extension DXT",dropFileHere:"Déposez votre fichier .dxt ici",orClickToSelect:"ou cliquez pour sélectionner depuis votre ordinateur",invalidFileType:"Veuillez sélectionner un fichier .dxt valide",noFileSelected:"Veuillez sélectionner un fichier .dxt à télécharger",uploading:"Téléchargement en cours...",uploadFailed:"Échec du téléchargement du fichier DXT",installServer:"Installer le serveur MCP depuis DXT",extensionInfo:"Informations sur l'extension",name:"Nom",version:"Version",description:"Description",author:"Auteur",tools:"Outils",serverName:"Nom du serveur",serverNamePlaceholder:"Entrez un nom pour ce serveur",install:"Installer",installing:"Installation en cours...",installFailed:"Échec de l'installation du serveur depuis DXT",serverExistsTitle:"Le serveur existe déjà",serverExistsConfirm:"Le serveur '{{serverName}}' existe déjà. Voulez-vous le remplacer par la nouvelle version ?",override:"Remplacer"},cj={add:"Ajouter un utilisateur",addNew:"Ajouter un nouvel utilisateur",edit:"Modifier l'utilisateur",delete:"Supprimer l'utilisateur",create:"Créer un utilisateur",update:"Mettre à jour l'utilisateur",username:"Nom d'utilisateur",password:"Mot de passe",newPassword:"Nouveau mot de passe",confirmPassword:"Confirmer le mot de passe",adminRole:"Administrateur",admin:"Admin",user:"Utilisateur",permissions:"Permissions",adminPermissions:"Accès complet au système",userPermissions:"Accès limité",currentUser:"Vous",noUsers:"Aucun utilisateur trouvé",adminRequired:"Un accès administrateur est requis pour gérer les utilisateurs",usernameRequired:"Le nom d'utilisateur est requis",passwordRequired:"Le mot de passe est requis",passwordTooShort:"Le mot de passe doit comporter au moins 6 caractères",passwordMismatch:"Les mots de passe ne correspondent pas",usernamePlaceholder:"Entrez le nom d'utilisateur",passwordPlaceholder:"Entrez le mot de passe",newPasswordPlaceholder:"Laissez vide pour conserver le mot de passe actuel",confirmPasswordPlaceholder:"Confirmez le nouveau mot de passe",createError:"Échec de la création de l'utilisateur",updateError:"Échec de la mise à jour de l'utilisateur",deleteError:"Échec de la suppression de l'utilisateur",statsError:"Échec de la récupération des statistiques utilisateur",deleteConfirmation:"Êtes-vous sûr de vouloir supprimer l'utilisateur '{{username}}' ? Cette action est irréversible.",confirmDelete:"Supprimer l'utilisateur",deleteWarning:"Êtes-vous sûr de vouloir supprimer l'utilisateur '{{username}}' ? Cette action est irréversible."},uj={errors:{readonly:"Lecture seule pour l'environnement de démonstration",invalid_credentials:"Nom d'utilisateur ou mot de passe invalide",serverNameRequired:"Le nom du serveur est requis",serverConfigRequired:"La configuration du serveur est requise",serverConfigInvalid:"La configuration du serveur doit inclure une URL, une URL de spécification OpenAPI ou un schéma, ou une commande avec des arguments",serverTypeInvalid:"Le type de serveur doit être l'un des suivants : stdio, sse, streamable-http, openapi",urlRequiredForType:"L'URL est requise pour le type de serveur {{type}}",openapiSpecRequired:"L'URL de la spécification OpenAPI ou le schéma est requis pour le type de serveur openapi",headersInvalidFormat:"Les en-têtes doivent être un objet",headersNotSupportedForStdio:"Les en-têtes ne sont pas pris en charge pour le type de serveur stdio",serverNotFound:"Serveur non trouvé",failedToRemoveServer:"Serveur non trouvé ou échec de la suppression",internalServerError:"Erreur interne du serveur",failedToGetServers:"Échec de la récupération des informations sur les serveurs",failedToGetServerSettings:"Échec de la récupération des paramètres du serveur",failedToGetServerConfig:"Échec de la récupération de la configuration du serveur",failedToSaveSettings:"Échec de l'enregistrement des paramètres",toolNameRequired:"Le nom du serveur et le nom de l'outil sont requis",descriptionMustBeString:"La description doit être une chaîne de caractères",groupIdRequired:"L'ID de groupe est requis",groupNameRequired:"Le nom du groupe est requis",groupNotFound:"Groupe non trouvé",groupIdAndServerNameRequired:"L'ID de groupe和le nom du serveur sont requis",groupOrServerNotFound:"Groupe ou serveur non trouvé",toolsMustBeAllOrArray:'Les outils doivent être "all" ou un tableau de chaînes de caractères',serverNameAndToolNameRequired:"Le nom du serveur et le nom de l'outil sont requis",usernameRequired:"Le nom d'utilisateur est requis",userNotFound:"Utilisateur non trouvé",failedToGetUsers:"Échec de la récupération des informations sur les utilisateurs",failedToGetUserInfo:"Échec de la récupération des informations sur l'utilisateur",failedToGetUserStats:"Échec de la récupération des statistiques de l'utilisateur",marketServerNameRequired:"Le nom du serveur du marché est requis",marketServerNotFound:"Serveur du marché non trouvé",failedToGetMarketServers:"Échec de la récupération des informations sur les serveurs du marché",failedToGetMarketServer:"Échec de la récupération des informations sur le serveur du marché",failedToGetMarketCategories:"Échec de la récupération des catégories du marché",failedToGetMarketTags:"Échec de la récupération des tags du marché",failedToSearchMarketServers:"Échec de la recherche des serveurs du marché",failedToFilterMarketServers:"Échec du filtrage des serveurs du marché",failedToProcessDxtFile:"Échec du traitement du fichier DXT"},success:{serverCreated:"Serveur créé avec succès",serverUpdated:"Serveur mis à jour avec succès",serverRemoved:"Serveur supprimé avec succès",serverToggled:"État du serveur basculé avec succès",toolToggled:"Outil {{name}} {{action}} avec succès",toolDescriptionUpdated:"Description de l'outil {{name}} mise à jour avec succès",systemConfigUpdated:"Configuration système mise à jour avec succès",groupCreated:"Groupe créé avec succès",groupUpdated:"Groupe mis à jour avec succès",groupDeleted:"Groupe supprimé avec succès",serverAddedToGroup:"Serveur ajouté au groupe avec succès",serverRemovedFromGroup:"Serveur supprimé du groupe avec succès",serverToolsUpdated:"Outils du serveur mis à jour avec succès"}},dj={app:qw,about:Vw,profile:Gw,sponsor:Kw,wechat:Fw,discord:$w,theme:Iw,auth:Yw,server:Xw,status:Qw,errors:Zw,common:Jw,nav:Ww,pages:ej,logs:tj,groups:aj,market:rj,cloud:sj,tool:nj,prompt:lj,settings:oj,dxt:ij,users:cj,api:uj};Ct.use(fg).use(Tb).init({resources:{en:{translation:pw},zh:{translation:Bw},fr:{translation:dj}},fallbackLng:"en",debug:!1,defaultNS:"translation",interpolation:{escapeValue:!1},detection:{order:["localStorage","cookie","htmlTag","navigator"],caches:["localStorage","cookie"]}});const fj=()=>{cb()};fj();async function mj(){try{console.log("Loading runtime configuration...");const n=await lb();console.log("Runtime configuration loaded:",n),window.__MCPHUB_CONFIG__=n,Sh.createRoot(document.getElementById("root")).render(r.jsx(Ms.StrictMode,{children:r.jsx(qh,{})}))}catch(n){console.error("Failed to initialize app:",n),console.log("Starting app with default configuration..."),window.__MCPHUB_CONFIG__={basePath:"",version:"dev",name:"mcphub"},Sh.createRoot(document.getElementById("root")).render(r.jsx(Ms.StrictMode,{children:r.jsx(qh,{})}))}}mj();
|
|
212
|
-
//# sourceMappingURL=index-
|
|
212
|
+
//# sourceMappingURL=index-CSwGPdCR.js.map
|