skill-base 2.0.9 → 2.0.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skill-base",
3
- "version": "2.0.9",
3
+ "version": "2.0.10",
4
4
  "description": "Skill Base - 内网轻量版 Skill 管理平台",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -206,4 +206,4 @@ https://github.com/highlightjs/highlight.js/issues/2277`),gt=fe,je=Ne),Pe===void
206
206
  `+n),r.b("</div>"),r.fl()},partials:{},subs:{}});St["tag-file-added"]=new mt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('<span class="d2h-tag d2h-added d2h-added-tag">ADDED</span>'),r.fl()},partials:{},subs:{}});St["tag-file-changed"]=new mt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span>'),r.fl()},partials:{},subs:{}});St["tag-file-deleted"]=new mt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('<span class="d2h-tag d2h-deleted d2h-deleted-tag">DELETED</span>'),r.fl()},partials:{},subs:{}});St["tag-file-renamed"]=new mt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('<span class="d2h-tag d2h-moved d2h-moved-tag">RENAMED</span>'),r.fl()},partials:{},subs:{}});class sL{constructor({compiledTemplates:e={},rawTemplates:n={}}){const r=Object.entries(n).reduce((i,[a,s])=>{const o=mt.compile(s,{asString:!1});return Object.assign(Object.assign({},i),{[a]:o})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},St),e),r)}static compile(e){return mt.compile(e,{asString:!1})}render(e,n,r,i,a){const s=this.templateKey(e,n);try{return this.preCompiledTemplates[s].render(r,i,a)}catch{throw new Error(`Could not find template to render '${s}'`)}}template(e,n){return this.preCompiledTemplates[this.templateKey(e,n)]}templateKey(e,n){return`${e}-${n}`}}const yS=Object.assign(Object.assign(Object.assign({},RS),CS),{outputFormat:ww.LINE_BY_LINE,drawFileList:!0});function oL(t,e={}){const n=Object.assign(Object.assign({},yS),e),r=typeof t=="string"?Yw(t,n):t,i=new sL(n),{colorScheme:a}=n,s={colorScheme:a},o=n.drawFileList?new Qw(i,s).render(r):"",l=n.outputFormat==="side-by-side"?new nL(i,n).render(r):new jw(i,n).render(r);return o+l}const lL=Object.assign(Object.assign({},yS),{synchronisedScroll:!0,highlight:!0,fileListToggle:!0,fileListStartVisible:!1,highlightLanguages:new Map,smartSelection:!0,fileContentToggle:!0,stickyFileHeaders:!0});let cL=class{constructor(e,n,r={},i){this.hljs=null,this.currentSelectionColumnId=-1,this.config=Object.assign(Object.assign({},lL),r),this.diffHtml=n!==void 0?oL(n,this.config):e.innerHTML,this.targetElement=e,i!==void 0&&(this.hljs=i)}draw(){this.targetElement.innerHTML=this.diffHtml,this.config.synchronisedScroll&&this.synchronisedScroll(),this.config.highlight&&this.highlightCode(),this.config.fileListToggle&&this.fileListToggle(this.config.fileListStartVisible),this.config.fileContentToggle&&this.fileContentToggle(),this.config.stickyFileHeaders&&this.stickyFileHeaders()}synchronisedScroll(){this.targetElement.querySelectorAll(".d2h-file-wrapper").forEach(e=>{const[n,r]=Array().slice.call(e.querySelectorAll(".d2h-file-side-diff"));if(n===void 0||r===void 0)return;const i=a=>{a===null||a.target===null||(a.target===n?(r.scrollTop=n.scrollTop,r.scrollLeft=n.scrollLeft):(n.scrollTop=r.scrollTop,n.scrollLeft=r.scrollLeft))};n.addEventListener("scroll",i),r.addEventListener("scroll",i)})}fileListToggle(e){const n=this.targetElement.querySelector(".d2h-show"),r=this.targetElement.querySelector(".d2h-hide"),i=this.targetElement.querySelector(".d2h-file-list");if(n===null||r===null||i===null)return;const a=()=>{n.style.display="none",r.style.display="inline",i.style.display="block"},s=()=>{n.style.display="inline",r.style.display="none",i.style.display="none"};n.addEventListener("click",()=>a()),r.addEventListener("click",()=>s());const o=this.getHashTag();o==="files-summary-show"?a():o==="files-summary-hide"?s():e?a():s()}fileContentToggle(){this.targetElement.querySelectorAll(".d2h-file-collapse").forEach(e=>{e.style.display="flex";const n=i=>{var a;const s=(a=e.closest(".d2h-file-wrapper"))===null||a===void 0?void 0:a.querySelector(i);s!=null&&(e.classList.toggle("d2h-selected"),s.classList.toggle("d2h-d-none"))},r=i=>{e!==i.target&&(n(".d2h-file-diff"),n(".d2h-files-diff"))};e.addEventListener("click",i=>r(i))})}highlightCode(){const e=this.hljs;if(e===null)throw new Error("Missing a `highlight.js` implementation. Please provide one when instantiating Diff2HtmlUI.");this.targetElement.querySelectorAll(".d2h-file-wrapper").forEach(r=>{const i=r.getAttribute("data-lang");this.config.highlightLanguages instanceof Map||(this.config.highlightLanguages=new Map(Object.entries(this.config.highlightLanguages)));let a=i&&this.config.highlightLanguages.has(i)?this.config.highlightLanguages.get(i):i?Dw(i):"plaintext";e.getLanguage(a)===void 0&&(a="plaintext"),r.querySelectorAll(".d2h-code-line-ctn").forEach(o=>{const l=o.textContent,c=o.parentNode;if(l===null||c===null||!this.isElement(c))return;const d=Iw(e.highlight(l,{language:a,ignoreIllegals:!0})),u=_f(o);if(u.length){const p=document.createElementNS("http://www.w3.org/1999/xhtml","div");p.innerHTML=d.value,d.value=Aw(u,_f(p),l)}o.classList.add("hljs"),d.language&&o.classList.add(d.language),o.innerHTML=d.value})})}stickyFileHeaders(){this.targetElement.querySelectorAll(".d2h-file-header").forEach(e=>{e.classList.add("d2h-sticky-header")})}smartSelection(){console.warn("Smart selection is now enabled by default with CSS. No need to call this method anymore.")}getHashTag(){const e=document.URL,n=e.indexOf("#");let r=null;return n!==-1&&(r=e.substr(n+1)),r}isElement(e){return e!==null&&e?.classList!==void 0}};class dL extends cL{constructor(e,n,r={}){super(e,n,r,fS)}}const uL={class:"min-h-screen pt-24 pb-12 px-4 sm:px-6 lg:px-8"},_L={class:"max-w-7xl mx-auto"},pL={key:0,class:"flex items-center justify-center py-20"},mL={key:1,class:"text-center py-20"},gL={class:"text-xl font-semibold text-white mb-2"},fL={class:"text-base-400 mb-6"},EL={class:"text-sm text-base-400 font-mono mb-6 flex items-center gap-2"},SL={class:"card p-6 mb-6 relative"},bL={class:"flex flex-wrap items-center gap-4"},hL={class:"flex items-center gap-2"},TL={class:"text-xs font-mono text-base-400"},vL={value:""},RL=["value"],CL={class:"flex items-center gap-2"},yL={class:"text-xs font-mono text-base-400"},NL={value:""},OL=["value"],AL=["disabled"],IL={key:0,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},xL={key:1,class:"spinner spinner-sm"},DL={class:"flex flex-wrap items-center justify-between mt-6 pt-6 border-t border-base-800 gap-4"},wL={class:"flex items-center gap-3"},LL={class:"text-xs font-mono text-base-400"},ML={class:"text-xs font-mono px-2 py-1 rounded bg-base-950 border border-base-800 text-neon-400"},kL={class:"flex rounded-lg overflow-hidden border border-base-800"},PL={key:0,class:"flex items-center gap-6 py-3 px-4 mb-6 text-xs bg-base-950 border border-base-800 rounded-lg"},UL={class:"text-green-400 font-mono"},FL={class:"text-red-400 font-mono"},BL={class:"text-base-400 font-mono"},GL={key:1,class:"card mb-6"},YL={class:"max-h-64 overflow-y-auto"},qL=["onClick"],HL={class:"text-sm font-mono text-base-400"},VL={class:"card overflow-hidden min-h-[300px]"},zL={key:0,class:"flex flex-col items-center justify-center py-24"},$L={class:"text-sm text-base-400 font-mono"},WL=["innerHTML"],KL={key:2,class:"flex flex-col items-center justify-center py-24 opacity-50"},QL={class:"text-xs font-mono text-base-400"},XL={class:"mt-8 pb-16"},ZL=Pt({__name:"DiffView",setup(t){const e=ya(),n=Mr(),r=Ld(),{t:i}=on(),a=me(!0),s=me(!1),o=me(""),l=me(null),c=me(""),d=me([]),u=me(""),p=me(""),_=me(""),f=me("side-by-side"),g=me(""),S=me([]),b=me(-1),h=me({added:0,removed:0}),v=me(null);let C=null,y=null;const D={added:i("diff.added"),deleted:i("diff.deleted"),modified:i("diff.modified")},L=new Set([".png",".jpg",".jpeg",".gif",".bmp",".ico",".webp",".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".zip",".tar",".gz",".rar",".7z",".exe",".dll",".so",".dylib",".mp3",".mp4",".wav",".avi",".mov",".ttf",".otf",".woff",".woff2"]);function O(H){const q="."+H.split(".").pop()?.toLowerCase();return L.has(q)}async function N(){a.value=!0,o.value="";try{if(c.value=e.query.id,u.value=e.query.version_a||"",p.value=e.query.version_b||"",_.value=e.query.path||"",!c.value){o.value=i("diff.missingId");return}await r.fetchSkill(c.value),l.value=r.currentSkill;const H=await r.fetchVersions(c.value);d.value=H||[],u.value&&p.value&&await B()}catch(H){o.value=H.message||i("diff.loadFailed")}finally{a.value=!1}}async function B(){if(!u.value||!p.value){rt.warning(i("diff.selectBoth"));return}if(u.value===p.value){rt.warning(i("diff.selectBoth"));return}s.value=!0,g.value="",S.value=[],b.value=-1;try{const[H,q]=await Promise.all([fetch(Rr.downloadUrl(c.value,u.value),{credentials:"include"}).then(te=>{if(!te.ok)throw new Error(`${i("diff.loadFailed")} ${u.value}`);return te.arrayBuffer()}),fetch(Rr.downloadUrl(c.value,p.value),{credentials:"include"}).then(te=>{if(!te.ok)throw new Error(`${i("diff.loadFailed")} ${p.value}`);return te.arrayBuffer()})]);C=await Cr.loadAsync(H),y=await Cr.loadAsync(q),_.value?await K(_.value):await I(),U()}catch(H){console.error("Diff failed:",H),g.value=`<div class="flex flex-col items-center justify-center py-24"><div class="text-4xl mb-4">❌</div><p class="text-base-400">${H.message}</p></div>`}finally{s.value=!1}}async function K(H){if(O(H)){g.value=`<div class="flex flex-col items-center justify-center py-24"><div class="text-4xl mb-4">📦</div><p class="text-base-400">${i("diff.binaryDiff")}: ${H}</p></div>`,h.value={added:0,removed:0};return}const q=C.file(H),te=y.file(H),M=q?await q.async("string"):"",G=te?await te.async("string"):"";if(M===G){g.value=`<div class="flex flex-col items-center justify-center py-24"><div class="text-4xl mb-4">✅</div><p class="text-base-400">${i("state.noData")}</p></div>`,h.value={added:0,removed:0};return}const j=uf(H,M,G,`Version ${u.value}`,`Version ${p.value}`);W(j),T(j)}async function I(){const H=new Set,q=new Set;C.forEach((j,oe)=>{oe.dir||H.add(j)}),y.forEach((j,oe)=>{oe.dir||q.add(j)});const te=new Set([...H,...q]),M=[];for(const j of te){const oe=H.has(j),ie=q.has(j);let Ee;if(!oe&&ie)Ee="added";else if(oe&&!ie)Ee="deleted";else{const Z=await C.file(j)?.async("string")??"",ne=await y.file(j)?.async("string")??"";if(Z!==ne)Ee="modified";else continue}M.push({file:j,status:Ee})}if(M.sort((j,oe)=>{const ie={added:0,deleted:1,modified:2};return ie[j.status]!==ie[oe.status]?ie[j.status]-ie[oe.status]:j.file.localeCompare(oe.file)}),S.value=M,M.length===0){g.value=`<div class="flex flex-col items-center justify-center py-24"><div class="text-4xl mb-4">✅</div><p class="text-base-400">${i("state.noData")}</p></div>`,h.value={added:0,removed:0};return}let G="";for(const j of M){if(O(j.file)){G+=`diff --git a/${j.file} b/${j.file}
207
207
  `,G+=`Binary files differ
208
208
  `;continue}const oe=await C.file(j.file)?.async("string")??"",ie=await y.file(j.file)?.async("string")??"",Ee=uf(j.file,oe,ie,`Version ${u.value}`,`Version ${p.value}`);G+=Ee}W(G),T(G,M.length)}function W(H){const q=document.createElement("div"),te={drawFileList:!1,matching:"lines",outputFormat:f.value,renderNothingWhenEmpty:!1};new dL(q,H,te).draw(),g.value=q.innerHTML}function T(H,q){let te=0,M=0;H.split(`
209
- `).forEach(G=>{G.startsWith("+")&&!G.startsWith("+++")&&te++,G.startsWith("-")&&!G.startsWith("---")&&M++}),h.value={added:te,removed:M}}async function w(H,q){b.value=q,_.value=H,U(),await K(H)}function ce(){_.value="",b.value=-1,U(),C&&y&&I()}function U(){const H={id:c.value,version_a:u.value,version_b:p.value};_.value&&(H.path=_.value),n.replace({path:"/diff",query:H})}return or(f,()=>{C&&y&&(_.value?K(_.value):S.value.length>0&&B())}),Ht(()=>{N()}),(H,q)=>{const te=Bn("router-link");return le(),de("div",uL,[m("div",_L,[a.value?(le(),de("div",pL,[...q[4]||(q[4]=[m("div",{class:"spinner"},null,-1)])])):o.value?(le(),de("div",mL,[q[5]||(q[5]=m("div",{class:"w-20 h-20 mx-auto mb-6 rounded-full bg-base-800 flex items-center justify-center"},[m("svg",{class:"w-10 h-10 text-base-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})])],-1)),m("h3",gL,X(J(i)("diff.loadFailed")),1),m("p",fL,X(o.value),1),Ue(te,{to:"/",class:"btn-primary px-6 py-3 rounded-lg"},{default:it(()=>[he(X(J(i)("diff.backToHome")),1)]),_:1})])):(le(),de(ke,{key:2},[m("div",EL,[q[7]||(q[7]=m("span",{class:"text-neon-400"},"~",-1)),q[8]||(q[8]=m("span",{class:"opacity-50"},"/",-1)),Ue(te,{to:"/",class:"hover:text-white transition-colors"},{default:it(()=>[...q[6]||(q[6]=[he("home",-1)])]),_:1}),q[9]||(q[9]=m("span",{class:"opacity-50"},"/",-1)),Ue(te,{to:`/skills/${c.value}`,class:"hover:text-white transition-colors"},{default:it(()=>[he(X(l.value?.name||c.value),1)]),_:1},8,["to"]),q[10]||(q[10]=m("span",{class:"opacity-50"},"/",-1)),q[11]||(q[11]=m("span",{class:"text-white"},"diff",-1))]),m("div",SL,[q[14]||(q[14]=m("div",{class:"absolute top-0 right-0 bg-base-800 text-base-400 text-[10px] font-mono px-2 py-1 rounded-bl-lg opacity-50 select-none"},"GIT-DIFF",-1)),m("div",bL,[m("div",hL,[m("span",TL,X(J(i)("diff.old")),1),Ye(m("select",{"onUpdate:modelValue":q[0]||(q[0]=M=>u.value=M),class:"bg-base-950 border border-base-800 text-white font-mono text-xs rounded-lg px-3 py-2 focus:border-neon-500 focus:outline-none w-48"},[m("option",vL,X(J(i)("diff.selectVersion")),1),(le(!0),de(ke,null,Rt(d.value,(M,G)=>(le(),de("option",{key:M.version,value:M.version},X(M.version)+" "+X(G===0?J(i)("skill.latestTag"):""),9,RL))),128))],512),[[Ir,u.value]])]),q[13]||(q[13]=m("span",{class:"font-mono text-base-600"},"->",-1)),m("div",CL,[m("span",yL,X(J(i)("diff.new")),1),Ye(m("select",{"onUpdate:modelValue":q[1]||(q[1]=M=>p.value=M),class:"bg-base-950 border border-base-800 text-white font-mono text-xs rounded-lg px-3 py-2 focus:border-neon-500 focus:outline-none w-48"},[m("option",NL,X(J(i)("diff.selectVersion")),1),(le(!0),de(ke,null,Rt(d.value,(M,G)=>(le(),de("option",{key:M.version,value:M.version},X(M.version)+" "+X(G===0?J(i)("skill.latestTag"):""),9,OL))),128))],512),[[Ir,p.value]])]),m("button",{onClick:B,class:"btn-primary flex items-center gap-2 ml-2 text-xs px-4 py-2",disabled:s.value},[s.value?(le(),de("div",xL)):(le(),de("svg",IL,[...q[12]||(q[12]=[m("polyline",{points:"23 4 23 10 17 10"},null,-1),m("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"},null,-1)])])),he(" "+X(s.value?J(i)("diff.computingDiff"):"Diff"),1)],8,AL)]),m("div",DL,[m("div",wL,[m("span",LL,X(J(i)("diff.file")),1),m("span",ML,X(_.value||J(i)("diff.allFiles")),1),_.value?(le(),de("button",{key:0,onClick:ce,class:"text-xs text-base-400 hover:text-white"},X(J(i)("diff.clearSelection")),1)):ze("",!0)]),m("div",kL,[m("button",{onClick:q[2]||(q[2]=M=>f.value="side-by-side"),class:Fe(["px-4 py-1.5 text-xs font-mono transition-colors",f.value==="side-by-side"?"bg-neon-400/10 border-neon-500 text-neon-400 border":"bg-transparent text-base-400 hover:text-white"])},X(J(i)("diff.split")),3),m("button",{onClick:q[3]||(q[3]=M=>f.value="line-by-line"),class:Fe(["px-4 py-1.5 text-xs font-mono transition-colors border-l border-base-800",f.value==="line-by-line"?"bg-neon-400/10 border-neon-500 text-neon-400 border":"bg-transparent text-base-400 hover:text-white"])},X(J(i)("diff.unifiedView")),3)])])]),h.value.added>0||h.value.removed>0?(le(),de("div",PL,[m("span",UL,"+"+X(h.value.added)+" "+X(J(i)("diff.linesAdded")),1),m("span",FL,"-"+X(h.value.removed)+" "+X(J(i)("diff.linesRemoved")),1),m("span",BL,X(S.value.length)+X(J(i)("diff.filesChanged")),1)])):ze("",!0),S.value.length>0&&!_.value?(le(),de("div",GL,[q[15]||(q[15]=m("div",{class:"px-4 py-3 bg-base-950/50 border-b border-base-800 flex items-center gap-2 text-xs"},[m("span",{class:"text-neon-400"},"ls"),m("span",{class:"opacity-50"},"--changed")],-1)),m("div",YL,[(le(!0),de(ke,null,Rt(S.value,(M,G)=>(le(),de("div",{key:M.file,onClick:j=>w(M.file,G),class:Fe(["flex items-center gap-3 px-4 py-3 border-b border-base-800 cursor-pointer hover:bg-white/5 transition-colors",{"bg-neon-400/5":b.value===G}])},[m("span",{class:Fe(["text-xs px-2 py-0.5 rounded",{"bg-green-500/10 text-green-400":M.status==="added","bg-red-500/10 text-red-400":M.status==="deleted","bg-orange-500/10 text-orange-400":M.status==="modified"}])},X(D[M.status]),3),m("span",HL,X(M.file),1)],10,qL))),128))])])):ze("",!0),m("div",VL,[s.value?(le(),de("div",zL,[q[16]||(q[16]=m("div",{class:"spinner mb-4"},null,-1)),m("p",$L,X(J(i)("diff.computing")),1)])):g.value?(le(),de("div",{key:1,ref_key:"diffOutputRef",ref:v,class:"diff-output",innerHTML:g.value},null,8,WL)):(le(),de("div",KL,[q[17]||(q[17]=m("div",{class:"font-mono text-4xl mb-4"},"_",-1)),m("p",QL,X(J(i)("diff.empty")),1)]))]),m("div",XL,[Ue(te,{to:`/skills/${c.value}`,class:"btn-secondary flex items-center gap-2 text-sm px-4 py-2 w-fit"},{default:it(()=>[q[18]||(q[18]=m("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[m("line",{x1:"19",y1:"12",x2:"5",y2:"12"}),m("polyline",{points:"12 19 5 12 12 5"})],-1)),he(" "+X(J(i)("diff.back")),1)]),_:1},8,["to"])])],64))])])}}}),jL=Tn(ZL,[["__scopeId","data-v-90ff69f8"]]),JL={class:"max-w-5xl mx-auto px-4 sm:px-6 lg:px-8 pt-8 pb-16"},eM={class:"text-sm text-base-400 font-mono mb-6 flex items-center gap-2"},tM={class:"skill-card p-8 relative overflow-hidden"},nM={class:"mb-8 border-b border-base-800 pb-6"},rM={class:"text-2xl font-bold text-white mb-2 flex items-center gap-3"},iM={class:"text-base-400 text-sm font-mono"},aM={class:"flex items-center justify-between mb-8 flex-wrap gap-4"},sM={class:"flex items-center gap-2 text-lg font-semibold text-white pb-3 border-b border-base-800 font-mono mb-0"},oM={class:"flex gap-4 mb-6 flex-wrap items-center"},lM={class:"flex-1 min-w-[200px]"},cM={class:"relative"},dM=["placeholder"],uM={value:""},_M={value:"active"},pM={value:"disabled"},mM={class:"border border-base-800 rounded-xl overflow-hidden"},gM={class:"w-full"},fM={class:"bg-base-950"},EM={class:"px-4 py-3 text-left text-xs font-semibold text-base-400 font-mono uppercase tracking-wider"},SM={class:"px-4 py-3 text-left text-xs font-semibold text-base-400 font-mono uppercase tracking-wider"},bM={class:"px-4 py-3 text-left text-xs font-semibold text-base-400 font-mono uppercase tracking-wider"},hM={class:"px-4 py-3 text-left text-xs font-semibold text-base-400 font-mono uppercase tracking-wider"},TM={class:"px-4 py-3 text-left text-xs font-semibold text-base-400 font-mono uppercase tracking-wider"},vM={class:"px-4 py-3 text-left text-xs font-semibold text-base-400 font-mono uppercase tracking-wider"},RM={key:1,class:"border-t border-base-800"},CM={colspan:"6",class:"px-4 py-12 text-center"},yM={class:"text-base-400 font-mono"},NM={class:"px-4 py-4 font-mono text-white"},OM={class:"px-4 py-4 font-mono text-white"},AM={class:"px-4 py-4"},IM={key:0,width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},xM={key:1,width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},DM={class:"px-4 py-4 font-mono"},wM={class:"px-4 py-4 font-mono text-base-400 text-sm"},LM={class:"px-4 py-4"},MM=["onClick","title"],kM={key:0,class:"flex items-center justify-center gap-4 px-4 py-4 border-t border-base-800"},PM=["disabled"],UM={class:"text-base-400 font-mono text-sm"},FM=["disabled"],BM={class:"bg-base-900 border border-base-800 rounded-xl shadow-2xl w-full max-w-md mx-4 transform transition-all"},GM={class:"flex items-center justify-between px-6 py-4 border-b border-base-800"},YM={class:"text-lg font-semibold text-white font-mono flex items-center gap-2"},qM={class:"relative"},HM=["type"],VM={class:"absolute right-2 top-1/2 -translate-y-1/2 flex gap-1"},zM={key:0,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},$M={key:1,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},WM={class:"font-mono text-base-400 mb-3 block text-sm"},KM={class:"flex gap-6"},QM={class:"flex items-center gap-2 cursor-pointer"},XM={class:"text-white font-mono text-sm"},ZM={class:"flex items-center gap-2 cursor-pointer"},jM={class:"text-white font-mono text-sm"},JM={class:"flex items-center justify-end gap-3 pt-4 border-t border-base-800"},ek=["disabled"],tk={key:0,class:"spinner spinner-sm"},nk={class:"bg-base-900 border border-base-800 rounded-xl shadow-2xl w-full max-w-md mx-4 transform transition-all"},rk={class:"flex items-center justify-between px-6 py-4 border-b border-base-800"},ik={class:"text-lg font-semibold text-white font-mono flex items-center gap-2"},ak=["value"],sk={class:"font-mono text-base-400 mb-3 block text-sm"},ok={class:"flex gap-6"},lk={class:"flex items-center gap-2 cursor-pointer"},ck={class:"text-white font-mono text-sm"},dk={class:"flex items-center gap-2 cursor-pointer"},uk={class:"text-white font-mono text-sm"},_k={class:"border-t border-base-800 pt-5"},pk={class:"flex items-center justify-between"},mk={class:"font-mono text-base-400 block text-sm"},gk={class:"text-xs text-base-500 font-mono mt-1"},fk={class:"relative inline-flex items-center cursor-pointer"},Ek={class:"border-t border-base-800 pt-5"},Sk={class:"flex items-center justify-between"},bk={class:"font-mono text-base-400 block text-sm"},hk={class:"text-xs text-base-500 font-mono mt-1"},Tk={key:0,class:"mt-4"},vk={class:"relative"},Rk=["type","placeholder"],Ck={class:"absolute right-2 top-1/2 -translate-y-1/2 flex gap-1"},yk={key:0,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Nk={key:1,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Ok={class:"flex items-center justify-end gap-3 pt-4 border-t border-base-800"},Ak=["disabled"],Ik={key:0,class:"spinner spinner-sm"},qc=10,xk=Pt({__name:"UserManagementView",setup(t){const{t:e,currentLang:n}=on();Ht(()=>{a()});const r=me([]),i=me(!1);async function a(){i.value=!0;try{const T=await Vi.list();r.value=T.users}catch(T){rt.error(e("admin.fetchError")+": "+T.message)}finally{i.value=!1}}const s=me(""),o=me(""),l=Ie(()=>{let T=r.value;if(s.value){const w=s.value.toLowerCase();T=T.filter(ce=>ce.username.toLowerCase().includes(w)||ce.name&&ce.name.toLowerCase().includes(w))}return o.value&&(o.value==="active"?T=T.filter(w=>!w.disabled):o.value==="disabled"&&(T=T.filter(w=>w.disabled))),T}),c=me(1),d=Ie(()=>Math.ceil(l.value.length/qc)),u=Ie(()=>{const T=(c.value-1)*qc,w=T+qc;return l.value.slice(T,w)}),p=me(!1),_=me(!1),f=me(!1),g=me({username:"",password:"",name:"",role:"user"});function S(){g.value={username:"",password:"",name:"",role:"user"},_.value=!1,p.value=!0}function b(){p.value=!1}function h(){const T="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*";let w="";for(let ce=0;ce<12;ce++)w+=T.charAt(Math.floor(Math.random()*T.length));g.value.password=w,_.value=!0}async function v(){f.value=!0;try{await Vi.create(g.value),await a(),b(),rt.success(e("admin.addSuccess"))}catch(T){rt.error(e("admin.addError")+": "+T.message)}finally{f.value=!1}}const C=me(!1),y=me(!1),D=me(!1),L=me(!1),O=me({id:0,username:"",name:"",role:"user",disabled:!1,newPassword:""});function N(T){O.value={id:T.id,username:T.username,name:T.name||"",role:T.role,disabled:T.disabled||!1,newPassword:""},y.value=!1,D.value=!1,C.value=!0}function B(){C.value=!1}function K(){const T="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*";let w="";for(let ce=0;ce<12;ce++)w+=T.charAt(Math.floor(Math.random()*T.length));O.value.newPassword=w,y.value=!0}async function I(){L.value=!0;try{await Vi.update(O.value.id,{name:O.value.name,role:O.value.role}),O.value.newPassword,await a(),B(),rt.success(e("admin.editSuccess"))}catch(T){rt.error(e("admin.editError")+": "+T.message)}finally{L.value=!1}}function W(T){return new Date(T).toLocaleDateString(n.value==="zh"?"zh-CN":"en-US",{year:"numeric",month:"2-digit",day:"2-digit"})}return(T,w)=>{const ce=Bn("router-link");return le(),de("main",JL,[m("div",eM,[w[18]||(w[18]=m("span",{class:"text-neon-400"},"~",-1)),w[19]||(w[19]=m("span",{class:"opacity-50"},"/",-1)),Ue(ce,{to:"/",class:"hover:text-white transition-colors"},{default:it(()=>[he(X(J(e)("nav.home")),1)]),_:1}),w[20]||(w[20]=m("span",{class:"opacity-50"},"/",-1)),w[21]||(w[21]=m("span",{class:"text-white"},"admin",-1)),w[22]||(w[22]=m("span",{class:"opacity-50"},"/",-1)),w[23]||(w[23]=m("span",{class:"text-white"},"users",-1))]),m("div",tM,[w[34]||(w[34]=m("div",{class:"absolute top-0 right-0 bg-base-800 text-base-400 text-[10px] font-mono px-2 py-1 rounded-bl-lg opacity-50 select-none"},"ADMIN-USERS",-1)),m("div",nM,[m("h1",rM,[w[24]||(w[24]=m("span",{class:"text-neon-400 font-mono font-normal opacity-70"},">",-1)),m("span",null,X(J(e)("admin.heading")),1)]),m("p",iM,X(J(e)("admin.subtitle")),1)]),m("div",aM,[m("h2",sM,[w[25]||(w[25]=m("span",{class:"text-neon-400"},"#",-1)),he(" "+X(J(e)("admin.userList")),1)]),m("button",{class:"btn-primary px-4 py-2.5 rounded-lg font-mono flex items-center gap-2",onClick:S},[w[26]||(w[26]=m("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[m("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),m("line",{x1:"5",y1:"12",x2:"19",y2:"12"})],-1)),m("span",null,X(J(e)("admin.addUser")),1)])]),m("div",oM,[m("div",lM,[m("div",cM,[Ye(m("input",{type:"text","onUpdate:modelValue":w[0]||(w[0]=U=>s.value=U),placeholder:J(e)("admin.searchPlaceholder"),class:"w-full bg-base-950 border border-base-800 rounded-lg px-4 py-2.5 font-mono text-white focus:border-neon-400 focus:outline-none focus:ring-1 focus:ring-neon-400 transition-colors pl-10"},null,8,dM),[[at,s.value]]),w[28]||(w[28]=m("span",{class:"absolute left-3 top-1/2 -translate-y-1/2 text-base-400"},[m("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[m("circle",{cx:"11",cy:"11",r:"8"}),m("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})])],-1)),s.value?(le(),de("button",{key:0,type:"button",class:"absolute right-3 top-1/2 -translate-y-1/2 text-base-400 hover:text-white transition-colors",onClick:w[1]||(w[1]=U=>s.value="")},[...w[27]||(w[27]=[m("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[m("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),m("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])):ze("",!0)])]),Ye(m("select",{"onUpdate:modelValue":w[2]||(w[2]=U=>o.value=U),class:"bg-base-950 border border-base-800 rounded-lg px-4 py-2.5 font-mono text-white focus:border-neon-400 focus:outline-none focus:ring-1 focus:ring-neon-400 transition-colors min-w-[140px] appearance-none cursor-pointer",style:{"background-image":"url('data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 fill=%27none%27 viewBox=%270 0 24 24%27 stroke=%27%23a1a1aa%27%3E%3Cpath stroke-linecap=%27round%27 stroke-linejoin=%27round%27 stroke-width=%272%27 d=%27M19 9l-7 7-7-7%27/%3E%3C/svg%3E')","background-repeat":"no-repeat","background-position":"right 0.75rem center","background-size":"1rem","padding-right":"2.5rem"}},[m("option",uM,X(J(e)("admin.allStatus")),1),m("option",_M,X(J(e)("admin.active")),1),m("option",pM,X(J(e)("admin.disabled")),1)],512),[[Ir,o.value]])]),m("div",mM,[m("table",gM,[m("thead",null,[m("tr",fM,[m("th",EM,X(J(e)("admin.thUsername")),1),m("th",SM,X(J(e)("admin.thName")),1),m("th",bM,X(J(e)("admin.thRole")),1),m("th",hM,X(J(e)("admin.thStatus")),1),m("th",TM,X(J(e)("admin.thCreatedAt")),1),m("th",vM,X(J(e)("admin.thActions")),1)])]),m("tbody",null,[i.value?(le(),de(ke,{key:0},Rt(5,U=>m("tr",{key:U,class:"border-t border-base-800"},[(le(),de(ke,null,Rt(6,H=>m("td",{key:H,class:"px-4 py-4"},[...w[29]||(w[29]=[m("div",{class:"h-4 bg-base-800 rounded animate-pulse"},null,-1)])])),64))])),64)):u.value.length===0?(le(),de("tr",RM,[m("td",CM,[w[30]||(w[30]=m("div",{class:"text-4xl mb-4 opacity-30"},"📦",-1)),m("p",yM,X(J(e)("admin.emptyState")),1)])])):(le(!0),de(ke,{key:2},Rt(u.value,U=>(le(),de("tr",{key:U.id,class:"border-t border-base-800 hover:bg-white/5 transition-colors"},[m("td",NM,X(U.username),1),m("td",OM,X(U.name||"-"),1),m("td",AM,[m("span",{class:Fe(["inline-flex items-center gap-1 px-3 py-1 text-xs font-medium rounded-full font-mono",U.role==="admin"?"bg-neon-400/10 text-neon-400 border border-neon-400/30":"bg-blue-500/10 text-blue-400 border border-blue-500/30"])},[U.role==="admin"?(le(),de("svg",IM,[...w[31]||(w[31]=[m("path",{d:"M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"},null,-1)])])):(le(),de("svg",xM,[...w[32]||(w[32]=[m("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"},null,-1),m("circle",{cx:"12",cy:"7",r:"4"},null,-1)])])),he(" "+X(U.role==="admin"?J(e)("admin.roleAdmin"):J(e)("admin.roleUser")),1)],2)]),m("td",DM,[m("span",{class:Fe(U.disabled?"text-red-400":"text-neon-400")},X(U.disabled?J(e)("admin.disabled"):J(e)("admin.active")),3)]),m("td",wM,X(W(U.created_at)),1),m("td",LM,[m("button",{class:"p-2 text-base-400 hover:text-neon-400 hover:bg-neon-400/10 rounded-lg transition-colors",onClick:H=>N(U),title:J(e)("admin.editUser")},[...w[33]||(w[33]=[m("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[m("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),m("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})],-1)])],8,MM)])]))),128))])]),d.value>1?(le(),de("div",kM,[m("button",{class:"px-4 py-2 rounded-lg font-mono text-sm border border-base-800 text-base-400 hover:border-neon-400 hover:text-neon-400 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",disabled:c.value===1,onClick:w[3]||(w[3]=U=>c.value--)},X(J(e)("admin.prevPage")),9,PM),m("span",UM,X(c.value)+" / "+X(d.value),1),m("button",{class:"px-4 py-2 rounded-lg font-mono text-sm border border-base-800 text-base-400 hover:border-neon-400 hover:text-neon-400 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",disabled:c.value===d.value,onClick:w[4]||(w[4]=U=>c.value++)},X(J(e)("admin.nextPage")),9,FM)])):ze("",!0)])]),p.value?(le(),de("div",{key:0,class:"fixed inset-0 bg-black/80 flex items-center justify-center z-50",onClick:At(b,["self"])},[m("div",BM,[m("div",GM,[m("h3",YM,[w[35]||(w[35]=m("span",{class:"text-neon-400 opacity-70"},">",-1)),he(" "+X(J(e)("admin.addModal")),1)]),m("button",{class:"text-base-400 hover:text-white transition-colors",onClick:b},[...w[36]||(w[36]=[m("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[m("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),m("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),m("form",{onSubmit:At(v,["prevent"]),class:"p-6 space-y-5"},[m("div",null,[w[37]||(w[37]=m("label",{class:"font-mono text-base-400 mb-2 block text-sm"},[m("span",{class:"text-neon-400 opacity-70"},"let"),he(),m("span",{class:"text-white"},"username"),he(),m("span",{class:"text-neon-400 opacity-70"},"=")],-1)),Ye(m("input",{type:"text","onUpdate:modelValue":w[5]||(w[5]=U=>g.value.username=U),required:"",autocomplete:"off",class:"w-full bg-base-950 border border-base-800 rounded-lg px-4 py-3 font-mono text-white focus:border-neon-400 focus:outline-none focus:ring-1 focus:ring-neon-400 transition-colors"},null,512),[[at,g.value.username]])]),m("div",null,[w[41]||(w[41]=m("label",{class:"font-mono text-base-400 mb-2 block text-sm"},[m("span",{class:"text-neon-400 opacity-70"},"let"),he(),m("span",{class:"text-white"},"password"),he(),m("span",{class:"text-neon-400 opacity-70"},"=")],-1)),m("div",qM,[Ye(m("input",{type:_.value?"text":"password","onUpdate:modelValue":w[6]||(w[6]=U=>g.value.password=U),required:"",autocomplete:"new-password",class:"w-full bg-base-950 border border-base-800 rounded-lg px-4 py-3 font-mono text-white focus:border-neon-400 focus:outline-none focus:ring-1 focus:ring-neon-400 transition-colors pr-20"},null,8,HM),[[e_,g.value.password]]),m("div",VM,[m("button",{type:"button",class:"p-1.5 text-base-400 hover:text-neon-400 rounded transition-colors",onClick:w[7]||(w[7]=U=>_.value=!_.value)},[_.value?(le(),de("svg",zM,[...w[38]||(w[38]=[m("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"},null,-1),m("circle",{cx:"12",cy:"12",r:"3"},null,-1)])])):(le(),de("svg",$M,[...w[39]||(w[39]=[m("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"},null,-1),m("line",{x1:"1",y1:"1",x2:"23",y2:"23"},null,-1)])]))]),m("button",{type:"button",class:"p-1.5 text-base-400 hover:text-neon-400 rounded transition-colors",onClick:h,title:"Generate password"},[...w[40]||(w[40]=[dr('<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="2" width="20" height="20" rx="2" ry="2"></rect><circle cx="8" cy="8" r="1.5" fill="currentColor" stroke="none"></circle><circle cx="16" cy="8" r="1.5" fill="currentColor" stroke="none"></circle><circle cx="8" cy="16" r="1.5" fill="currentColor" stroke="none"></circle><circle cx="16" cy="16" r="1.5" fill="currentColor" stroke="none"></circle></svg>',1)])])])])]),m("div",null,[w[42]||(w[42]=m("label",{class:"font-mono text-base-400 mb-2 block text-sm"},[m("span",{class:"text-neon-400 opacity-70"},"let"),he(),m("span",{class:"text-white"},"name"),he(),m("span",{class:"text-neon-400 opacity-70"},"=")],-1)),Ye(m("input",{type:"text","onUpdate:modelValue":w[8]||(w[8]=U=>g.value.name=U),class:"w-full bg-base-950 border border-base-800 rounded-lg px-4 py-3 font-mono text-white focus:border-neon-400 focus:outline-none focus:ring-1 focus:ring-neon-400 transition-colors"},null,512),[[at,g.value.name]])]),m("div",null,[m("label",WM,X(J(e)("admin.roleLabel")),1),m("div",KM,[m("label",QM,[Ye(m("input",{type:"radio","onUpdate:modelValue":w[9]||(w[9]=U=>g.value.role=U),value:"user",class:"w-4 h-4 accent-neon-400"},null,512),[[jr,g.value.role]]),m("span",XM,X(J(e)("admin.roleUser")),1)]),m("label",ZM,[Ye(m("input",{type:"radio","onUpdate:modelValue":w[10]||(w[10]=U=>g.value.role=U),value:"admin",class:"w-4 h-4 accent-neon-400"},null,512),[[jr,g.value.role]]),m("span",jM,X(J(e)("admin.roleAdmin")),1)])])]),m("div",JM,[m("button",{type:"button",class:"px-4 py-2 rounded-lg font-mono text-sm border border-base-800 text-base-400 hover:border-white hover:text-white transition-colors",onClick:b},X(J(e)("admin.cancel")),1),m("button",{type:"submit",disabled:f.value,class:"btn-primary px-4 py-2 rounded-lg font-mono text-sm flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed"},[f.value?(le(),de("span",tk)):(le(),de(ke,{key:1},[he(X(J(e)("admin.confirmAdd")),1)],64))],8,ek)])],32)])])):ze("",!0),C.value?(le(),de("div",{key:1,class:"fixed inset-0 bg-black/80 flex items-center justify-center z-50",onClick:At(B,["self"])},[m("div",nk,[m("div",rk,[m("h3",ik,[w[43]||(w[43]=m("span",{class:"text-neon-400 opacity-70"},">",-1)),he(" "+X(J(e)("admin.editModal")),1)]),m("button",{class:"text-base-400 hover:text-white transition-colors",onClick:B},[...w[44]||(w[44]=[m("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[m("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),m("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),m("form",{onSubmit:At(I,["prevent"]),class:"p-6 space-y-5"},[m("div",null,[w[45]||(w[45]=m("label",{class:"font-mono text-base-400 mb-2 block text-sm"},[m("span",{class:"text-neon-400 opacity-70"},"let"),he(),m("span",{class:"text-white"},"username"),he(),m("span",{class:"text-neon-400 opacity-70"},"=")],-1)),m("input",{type:"text",value:O.value.username,disabled:"",class:"w-full bg-base-950 border border-base-800 rounded-lg px-4 py-3 font-mono text-base-400 cursor-not-allowed"},null,8,ak)]),m("div",null,[w[46]||(w[46]=m("label",{class:"font-mono text-base-400 mb-2 block text-sm"},[m("span",{class:"text-neon-400 opacity-70"},"let"),he(),m("span",{class:"text-white"},"name"),he(),m("span",{class:"text-neon-400 opacity-70"},"=")],-1)),Ye(m("input",{type:"text","onUpdate:modelValue":w[11]||(w[11]=U=>O.value.name=U),autocomplete:"off",class:"w-full bg-base-950 border border-base-800 rounded-lg px-4 py-3 font-mono text-white focus:border-neon-400 focus:outline-none focus:ring-1 focus:ring-neon-400 transition-colors"},null,512),[[at,O.value.name]])]),m("div",null,[m("label",sk,X(J(e)("admin.roleLabel")),1),m("div",ok,[m("label",lk,[Ye(m("input",{type:"radio","onUpdate:modelValue":w[12]||(w[12]=U=>O.value.role=U),value:"user",class:"w-4 h-4 accent-neon-400"},null,512),[[jr,O.value.role]]),m("span",ck,X(J(e)("admin.roleUser")),1)]),m("label",dk,[Ye(m("input",{type:"radio","onUpdate:modelValue":w[13]||(w[13]=U=>O.value.role=U),value:"admin",class:"w-4 h-4 accent-neon-400"},null,512),[[jr,O.value.role]]),m("span",uk,X(J(e)("admin.roleAdmin")),1)])])]),m("div",_k,[m("div",pk,[m("div",null,[m("label",mk,X(J(e)("admin.statusLabel")),1),m("p",gk,X(O.value.disabled?J(e)("admin.statusDisabled"):J(e)("admin.statusActive")),1)]),m("label",fk,[Ye(m("input",{type:"checkbox","onUpdate:modelValue":w[14]||(w[14]=U=>O.value.disabled=U),class:"sr-only peer"},null,512),[[FE,O.value.disabled]]),w[47]||(w[47]=m("div",{class:"w-12 h-6 bg-base-800 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-base-400 after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-neon-400 peer-checked:after:bg-base-950"},null,-1))])])]),m("div",Ek,[m("div",Sk,[m("div",null,[m("label",bk,X(J(e)("admin.resetPassword")),1),m("p",hk,X(J(e)("admin.resetPasswordHint")),1)]),m("button",{type:"button",class:"px-3 py-1.5 rounded-lg font-mono text-xs border border-base-800 text-base-400 hover:border-neon-400 hover:text-neon-400 transition-colors",onClick:w[15]||(w[15]=U=>D.value=!D.value)},X(D.value?J(e)("admin.cancelReset"):J(e)("admin.doReset")),1)]),D.value?(le(),de("div",Tk,[m("div",vk,[Ye(m("input",{type:y.value?"text":"password","onUpdate:modelValue":w[16]||(w[16]=U=>O.value.newPassword=U),placeholder:J(e)("admin.newPasswordPlaceholder"),autocomplete:"new-password",class:"w-full bg-base-950 border border-base-800 rounded-lg px-4 py-3 font-mono text-white focus:border-neon-400 focus:outline-none focus:ring-1 focus:ring-neon-400 transition-colors pr-16"},null,8,Rk),[[e_,O.value.newPassword]]),m("div",Ck,[m("button",{type:"button",class:"p-1.5 text-base-400 hover:text-neon-400 rounded transition-colors",onClick:w[17]||(w[17]=U=>y.value=!y.value)},[y.value?(le(),de("svg",yk,[...w[48]||(w[48]=[m("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"},null,-1),m("circle",{cx:"12",cy:"12",r:"3"},null,-1)])])):(le(),de("svg",Nk,[...w[49]||(w[49]=[m("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"},null,-1),m("line",{x1:"1",y1:"1",x2:"23",y2:"23"},null,-1)])]))]),m("button",{type:"button",class:"p-1.5 text-base-400 hover:text-neon-400 rounded transition-colors",onClick:K,title:"Generate password"},[...w[50]||(w[50]=[dr('<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="2" width="20" height="20" rx="2" ry="2"></rect><circle cx="8" cy="8" r="1.5" fill="currentColor" stroke="none"></circle><circle cx="16" cy="8" r="1.5" fill="currentColor" stroke="none"></circle><circle cx="8" cy="16" r="1.5" fill="currentColor" stroke="none"></circle><circle cx="16" cy="16" r="1.5" fill="currentColor" stroke="none"></circle></svg>',1)])])])])])):ze("",!0)]),m("div",Ok,[m("button",{type:"button",class:"px-4 py-2 rounded-lg font-mono text-sm border border-base-800 text-base-400 hover:border-white hover:text-white transition-colors",onClick:B},X(J(e)("admin.cancel")),1),m("button",{type:"submit",disabled:L.value,class:"btn-primary px-4 py-2 rounded-lg font-mono text-sm flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed"},[L.value?(le(),de("span",Ik)):(le(),de(ke,{key:1},[he(X(J(e)("admin.confirmSave")),1)],64))],8,Ak)])],32)])])):ze("",!0)])}}}),NS=Nv({history:iv(ta),routes:[{path:"/",name:"",component:xR},{path:"/login",name:"login",component:$R},{path:"/skills/:id",name:"skill-detail",component:tx},{path:"/publish",name:"publish",component:Zx,meta:{requiresAuth:!0}},{path:"/settings",name:"settings",component:RD,meta:{requiresAuth:!0}},{path:"/cli-code",name:"cli-code",component:KD},{path:"/setup",name:"setup",component:mw},{path:"/diff",name:"diff",component:jL},{path:"/admin/users",name:"user-management",component:xk,meta:{requiresAuth:!0,requiresAdmin:!0}}]});NS.beforeEach(async t=>{if(!t.meta.requiresAuth&&!t.meta.requiresAdmin)return!0;const e=vi();return await e.fetchUser({force:!0})?t.meta.requiresAdmin&&!e.isAdmin?{path:"/"}:!0:{path:"/login",query:{redirect:t.fullPath}}});const Qd=_T(_R);Qd.use(gT());Qd.use(NS);Qd.mount("#app");
209
+ `).forEach(G=>{G.startsWith("+")&&!G.startsWith("+++")&&te++,G.startsWith("-")&&!G.startsWith("---")&&M++}),h.value={added:te,removed:M}}async function w(H,q){b.value=q,_.value=H,U(),await K(H)}function ce(){_.value="",b.value=-1,U(),C&&y&&I()}function U(){const H={id:c.value,version_a:u.value,version_b:p.value};_.value&&(H.path=_.value),n.replace({path:"/diff",query:H})}return or(f,()=>{C&&y&&(_.value?K(_.value):S.value.length>0&&B())}),Ht(()=>{N()}),(H,q)=>{const te=Bn("router-link");return le(),de("div",uL,[m("div",_L,[a.value?(le(),de("div",pL,[...q[4]||(q[4]=[m("div",{class:"spinner"},null,-1)])])):o.value?(le(),de("div",mL,[q[5]||(q[5]=m("div",{class:"w-20 h-20 mx-auto mb-6 rounded-full bg-base-800 flex items-center justify-center"},[m("svg",{class:"w-10 h-10 text-base-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[m("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})])],-1)),m("h3",gL,X(J(i)("diff.loadFailed")),1),m("p",fL,X(o.value),1),Ue(te,{to:"/",class:"btn-primary px-6 py-3 rounded-lg"},{default:it(()=>[he(X(J(i)("diff.backToHome")),1)]),_:1})])):(le(),de(ke,{key:2},[m("div",EL,[q[7]||(q[7]=m("span",{class:"text-neon-400"},"~",-1)),q[8]||(q[8]=m("span",{class:"opacity-50"},"/",-1)),Ue(te,{to:"/",class:"hover:text-white transition-colors"},{default:it(()=>[...q[6]||(q[6]=[he("home",-1)])]),_:1}),q[9]||(q[9]=m("span",{class:"opacity-50"},"/",-1)),Ue(te,{to:`/skills/${c.value}`,class:"hover:text-white transition-colors"},{default:it(()=>[he(X(l.value?.name||c.value),1)]),_:1},8,["to"]),q[10]||(q[10]=m("span",{class:"opacity-50"},"/",-1)),q[11]||(q[11]=m("span",{class:"text-white"},"diff",-1))]),m("div",SL,[q[14]||(q[14]=m("div",{class:"absolute top-0 right-0 bg-base-800 text-base-400 text-[10px] font-mono px-2 py-1 rounded-bl-lg opacity-50 select-none"},"GIT-DIFF",-1)),m("div",bL,[m("div",hL,[m("span",TL,X(J(i)("diff.old")),1),Ye(m("select",{"onUpdate:modelValue":q[0]||(q[0]=M=>u.value=M),class:"bg-base-950 border border-base-800 text-white font-mono text-xs rounded-lg px-3 py-2 focus:border-neon-500 focus:outline-none w-48"},[m("option",vL,X(J(i)("diff.selectVersion")),1),(le(!0),de(ke,null,Rt(d.value,(M,G)=>(le(),de("option",{key:M.version,value:M.version},X(M.version)+" "+X(G===0?J(i)("skill.latestTag"):""),9,RL))),128))],512),[[Ir,u.value]])]),q[13]||(q[13]=m("span",{class:"font-mono text-base-600"},"->",-1)),m("div",CL,[m("span",yL,X(J(i)("diff.new")),1),Ye(m("select",{"onUpdate:modelValue":q[1]||(q[1]=M=>p.value=M),class:"bg-base-950 border border-base-800 text-white font-mono text-xs rounded-lg px-3 py-2 focus:border-neon-500 focus:outline-none w-48"},[m("option",NL,X(J(i)("diff.selectVersion")),1),(le(!0),de(ke,null,Rt(d.value,(M,G)=>(le(),de("option",{key:M.version,value:M.version},X(M.version)+" "+X(G===0?J(i)("skill.latestTag"):""),9,OL))),128))],512),[[Ir,p.value]])]),m("button",{onClick:B,class:"btn-primary flex items-center gap-2 ml-2 text-xs px-4 py-2",disabled:s.value},[s.value?(le(),de("div",xL)):(le(),de("svg",IL,[...q[12]||(q[12]=[m("polyline",{points:"23 4 23 10 17 10"},null,-1),m("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"},null,-1)])])),he(" "+X(s.value?J(i)("diff.computingDiff"):"Diff"),1)],8,AL)]),m("div",DL,[m("div",wL,[m("span",LL,X(J(i)("diff.file")),1),m("span",ML,X(_.value||J(i)("diff.allFiles")),1),_.value?(le(),de("button",{key:0,onClick:ce,class:"text-xs text-base-400 hover:text-white"},X(J(i)("diff.clearSelection")),1)):ze("",!0)]),m("div",kL,[m("button",{onClick:q[2]||(q[2]=M=>f.value="side-by-side"),class:Fe(["px-4 py-1.5 text-xs font-mono transition-colors",f.value==="side-by-side"?"bg-neon-400/10 border-neon-500 text-neon-400 border":"bg-transparent text-base-400 hover:text-white"])},X(J(i)("diff.split")),3),m("button",{onClick:q[3]||(q[3]=M=>f.value="line-by-line"),class:Fe(["px-4 py-1.5 text-xs font-mono transition-colors border-l border-base-800",f.value==="line-by-line"?"bg-neon-400/10 border-neon-500 text-neon-400 border":"bg-transparent text-base-400 hover:text-white"])},X(J(i)("diff.unifiedView")),3)])])]),h.value.added>0||h.value.removed>0?(le(),de("div",PL,[m("span",UL,"+"+X(h.value.added)+" "+X(J(i)("diff.linesAdded")),1),m("span",FL,"-"+X(h.value.removed)+" "+X(J(i)("diff.linesRemoved")),1),m("span",BL,X(S.value.length)+X(J(i)("diff.filesChanged")),1)])):ze("",!0),S.value.length>0&&!_.value?(le(),de("div",GL,[q[15]||(q[15]=m("div",{class:"px-4 py-3 bg-base-950/50 border-b border-base-800 flex items-center gap-2 text-xs"},[m("span",{class:"text-neon-400"},"ls"),m("span",{class:"opacity-50"},"--changed")],-1)),m("div",YL,[(le(!0),de(ke,null,Rt(S.value,(M,G)=>(le(),de("div",{key:M.file,onClick:j=>w(M.file,G),class:Fe(["flex items-center gap-3 px-4 py-3 border-b border-base-800 cursor-pointer hover:bg-white/5 transition-colors",{"bg-neon-400/5":b.value===G}])},[m("span",{class:Fe(["text-xs px-2 py-0.5 rounded",{"bg-green-500/10 text-green-400":M.status==="added","bg-red-500/10 text-red-400":M.status==="deleted","bg-orange-500/10 text-orange-400":M.status==="modified"}])},X(D[M.status]),3),m("span",HL,X(M.file),1)],10,qL))),128))])])):ze("",!0),m("div",VL,[s.value?(le(),de("div",zL,[q[16]||(q[16]=m("div",{class:"spinner mb-4"},null,-1)),m("p",$L,X(J(i)("diff.computing")),1)])):g.value?(le(),de("div",{key:1,ref_key:"diffOutputRef",ref:v,class:"diff-output",innerHTML:g.value},null,8,WL)):(le(),de("div",KL,[q[17]||(q[17]=m("div",{class:"font-mono text-4xl mb-4"},"_",-1)),m("p",QL,X(J(i)("diff.empty")),1)]))]),m("div",XL,[Ue(te,{to:`/skills/${c.value}`,class:"btn-secondary flex items-center gap-2 text-sm px-4 py-2 w-fit"},{default:it(()=>[q[18]||(q[18]=m("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[m("line",{x1:"19",y1:"12",x2:"5",y2:"12"}),m("polyline",{points:"12 19 5 12 12 5"})],-1)),he(" "+X(J(i)("diff.back")),1)]),_:1},8,["to"])])],64))])])}}}),jL=Tn(ZL,[["__scopeId","data-v-90ff69f8"]]),JL={class:"max-w-5xl mx-auto px-4 sm:px-6 lg:px-8 pt-8 pb-16"},eM={class:"text-sm text-base-400 font-mono mb-6 flex items-center gap-2"},tM={class:"skill-card p-8 relative overflow-hidden"},nM={class:"mb-8 border-b border-base-800 pb-6"},rM={class:"text-2xl font-bold text-white mb-2 flex items-center gap-3"},iM={class:"text-base-400 text-sm font-mono"},aM={class:"flex items-center justify-between mb-8 flex-wrap gap-4"},sM={class:"flex items-center gap-2 text-lg font-semibold text-white pb-3 border-b border-base-800 font-mono mb-0"},oM={class:"flex gap-4 mb-6 flex-wrap items-center"},lM={class:"flex-1 min-w-[200px]"},cM={class:"relative"},dM=["placeholder"],uM={value:""},_M={value:"active"},pM={value:"disabled"},mM={class:"border border-base-800 rounded-xl overflow-hidden"},gM={class:"w-full"},fM={class:"bg-base-950"},EM={class:"px-4 py-3 text-left text-xs font-semibold text-base-400 font-mono uppercase tracking-wider"},SM={class:"px-4 py-3 text-left text-xs font-semibold text-base-400 font-mono uppercase tracking-wider"},bM={class:"px-4 py-3 text-left text-xs font-semibold text-base-400 font-mono uppercase tracking-wider"},hM={class:"px-4 py-3 text-left text-xs font-semibold text-base-400 font-mono uppercase tracking-wider"},TM={class:"px-4 py-3 text-left text-xs font-semibold text-base-400 font-mono uppercase tracking-wider"},vM={class:"px-4 py-3 text-left text-xs font-semibold text-base-400 font-mono uppercase tracking-wider"},RM={key:1,class:"border-t border-base-800"},CM={colspan:"6",class:"px-4 py-12 text-center"},yM={class:"text-base-400 font-mono"},NM={class:"px-4 py-4 font-mono text-white"},OM={class:"px-4 py-4 font-mono text-white"},AM={class:"px-4 py-4"},IM={key:0,width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},xM={key:1,width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},DM={class:"px-4 py-4 font-mono"},wM={class:"px-4 py-4 font-mono text-base-400 text-sm"},LM={class:"px-4 py-4"},MM=["onClick","title"],kM={key:0,class:"flex items-center justify-center gap-4 px-4 py-4 border-t border-base-800"},PM=["disabled"],UM={class:"text-base-400 font-mono text-sm"},FM=["disabled"],BM={class:"bg-base-900 border border-base-800 rounded-xl shadow-2xl w-full max-w-md mx-4 transform transition-all"},GM={class:"flex items-center justify-between px-6 py-4 border-b border-base-800"},YM={class:"text-lg font-semibold text-white font-mono flex items-center gap-2"},qM={class:"relative"},HM=["type"],VM={class:"absolute right-2 top-1/2 -translate-y-1/2 flex gap-1"},zM={key:0,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},$M={key:1,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},WM={class:"font-mono text-base-400 mb-3 block text-sm"},KM={class:"flex gap-6"},QM={class:"flex items-center gap-2 cursor-pointer"},XM={class:"text-white font-mono text-sm"},ZM={class:"flex items-center gap-2 cursor-pointer"},jM={class:"text-white font-mono text-sm"},JM={class:"flex items-center justify-end gap-3 pt-4 border-t border-base-800"},ek=["disabled"],tk={key:0,class:"spinner spinner-sm"},nk={class:"bg-base-900 border border-base-800 rounded-xl shadow-2xl w-full max-w-md mx-4 transform transition-all"},rk={class:"flex items-center justify-between px-6 py-4 border-b border-base-800"},ik={class:"text-lg font-semibold text-white font-mono flex items-center gap-2"},ak=["value"],sk={class:"font-mono text-base-400 mb-3 block text-sm"},ok={class:"flex gap-6"},lk={class:"flex items-center gap-2 cursor-pointer"},ck={class:"text-white font-mono text-sm"},dk={class:"flex items-center gap-2 cursor-pointer"},uk={class:"text-white font-mono text-sm"},_k={class:"border-t border-base-800 pt-5"},pk={class:"flex items-center justify-between"},mk={class:"font-mono text-base-400 block text-sm"},gk={class:"text-xs text-base-500 font-mono mt-1"},fk={class:"relative inline-flex items-center cursor-pointer"},Ek={class:"border-t border-base-800 pt-5"},Sk={class:"flex items-center justify-between"},bk={class:"font-mono text-base-400 block text-sm"},hk={class:"text-xs text-base-500 font-mono mt-1"},Tk={key:0,class:"mt-4"},vk={class:"relative"},Rk=["type","placeholder"],Ck={class:"absolute right-2 top-1/2 -translate-y-1/2 flex gap-1"},yk={key:0,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Nk={key:1,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Ok={class:"flex items-center justify-end gap-3 pt-4 border-t border-base-800"},Ak=["disabled"],Ik={key:0,class:"spinner spinner-sm"},qc=10,xk=Pt({__name:"UserManagementView",setup(t){const{t:e,currentLang:n}=on();Ht(()=>{a()});const r=me([]),i=me(!1);async function a(){i.value=!0;try{const T=await Vi.list();r.value=T.users}catch(T){rt.error(e("admin.fetchError")+": "+T.message)}finally{i.value=!1}}const s=me(""),o=me(""),l=Ie(()=>{let T=r.value;if(s.value){const w=s.value.toLowerCase();T=T.filter(ce=>ce.username.toLowerCase().includes(w)||ce.name&&ce.name.toLowerCase().includes(w))}return o.value&&(o.value==="active"?T=T.filter(w=>!w.disabled):o.value==="disabled"&&(T=T.filter(w=>w.disabled))),T}),c=me(1),d=Ie(()=>Math.ceil(l.value.length/qc)),u=Ie(()=>{const T=(c.value-1)*qc,w=T+qc;return l.value.slice(T,w)}),p=me(!1),_=me(!1),f=me(!1),g=me({username:"",password:"",name:"",role:"developer"});function S(){g.value={username:"",password:"",name:"",role:"developer"},_.value=!1,p.value=!0}function b(){p.value=!1}function h(){const T="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*";let w="";for(let ce=0;ce<12;ce++)w+=T.charAt(Math.floor(Math.random()*T.length));g.value.password=w,_.value=!0}async function v(){f.value=!0;try{await Vi.create(g.value),await a(),b(),rt.success(e("admin.addSuccess"))}catch(T){rt.error(e("admin.addError")+": "+T.message)}finally{f.value=!1}}const C=me(!1),y=me(!1),D=me(!1),L=me(!1),O=me({id:0,username:"",name:"",role:"developer",disabled:!1,newPassword:""});function N(T){O.value={id:T.id,username:T.username,name:T.name||"",role:T.role,disabled:T.disabled||!1,newPassword:""},y.value=!1,D.value=!1,C.value=!0}function B(){C.value=!1}function K(){const T="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*";let w="";for(let ce=0;ce<12;ce++)w+=T.charAt(Math.floor(Math.random()*T.length));O.value.newPassword=w,y.value=!0}async function I(){L.value=!0;try{await Vi.update(O.value.id,{name:O.value.name,role:O.value.role}),O.value.newPassword,await a(),B(),rt.success(e("admin.editSuccess"))}catch(T){rt.error(e("admin.editError")+": "+T.message)}finally{L.value=!1}}function W(T){return new Date(T).toLocaleDateString(n.value==="zh"?"zh-CN":"en-US",{year:"numeric",month:"2-digit",day:"2-digit"})}return(T,w)=>{const ce=Bn("router-link");return le(),de("main",JL,[m("div",eM,[w[18]||(w[18]=m("span",{class:"text-neon-400"},"~",-1)),w[19]||(w[19]=m("span",{class:"opacity-50"},"/",-1)),Ue(ce,{to:"/",class:"hover:text-white transition-colors"},{default:it(()=>[he(X(J(e)("nav.home")),1)]),_:1}),w[20]||(w[20]=m("span",{class:"opacity-50"},"/",-1)),w[21]||(w[21]=m("span",{class:"text-white"},"admin",-1)),w[22]||(w[22]=m("span",{class:"opacity-50"},"/",-1)),w[23]||(w[23]=m("span",{class:"text-white"},"users",-1))]),m("div",tM,[w[34]||(w[34]=m("div",{class:"absolute top-0 right-0 bg-base-800 text-base-400 text-[10px] font-mono px-2 py-1 rounded-bl-lg opacity-50 select-none"},"ADMIN-USERS",-1)),m("div",nM,[m("h1",rM,[w[24]||(w[24]=m("span",{class:"text-neon-400 font-mono font-normal opacity-70"},">",-1)),m("span",null,X(J(e)("admin.heading")),1)]),m("p",iM,X(J(e)("admin.subtitle")),1)]),m("div",aM,[m("h2",sM,[w[25]||(w[25]=m("span",{class:"text-neon-400"},"#",-1)),he(" "+X(J(e)("admin.userList")),1)]),m("button",{class:"btn-primary px-4 py-2.5 rounded-lg font-mono flex items-center gap-2",onClick:S},[w[26]||(w[26]=m("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[m("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),m("line",{x1:"5",y1:"12",x2:"19",y2:"12"})],-1)),m("span",null,X(J(e)("admin.addUser")),1)])]),m("div",oM,[m("div",lM,[m("div",cM,[Ye(m("input",{type:"text","onUpdate:modelValue":w[0]||(w[0]=U=>s.value=U),placeholder:J(e)("admin.searchPlaceholder"),class:"w-full bg-base-950 border border-base-800 rounded-lg px-4 py-2.5 font-mono text-white focus:border-neon-400 focus:outline-none focus:ring-1 focus:ring-neon-400 transition-colors pl-10"},null,8,dM),[[at,s.value]]),w[28]||(w[28]=m("span",{class:"absolute left-3 top-1/2 -translate-y-1/2 text-base-400"},[m("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[m("circle",{cx:"11",cy:"11",r:"8"}),m("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})])],-1)),s.value?(le(),de("button",{key:0,type:"button",class:"absolute right-3 top-1/2 -translate-y-1/2 text-base-400 hover:text-white transition-colors",onClick:w[1]||(w[1]=U=>s.value="")},[...w[27]||(w[27]=[m("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[m("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),m("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])):ze("",!0)])]),Ye(m("select",{"onUpdate:modelValue":w[2]||(w[2]=U=>o.value=U),class:"bg-base-950 border border-base-800 rounded-lg px-4 py-2.5 font-mono text-white focus:border-neon-400 focus:outline-none focus:ring-1 focus:ring-neon-400 transition-colors min-w-[140px] appearance-none cursor-pointer",style:{"background-image":"url('data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 fill=%27none%27 viewBox=%270 0 24 24%27 stroke=%27%23a1a1aa%27%3E%3Cpath stroke-linecap=%27round%27 stroke-linejoin=%27round%27 stroke-width=%272%27 d=%27M19 9l-7 7-7-7%27/%3E%3C/svg%3E')","background-repeat":"no-repeat","background-position":"right 0.75rem center","background-size":"1rem","padding-right":"2.5rem"}},[m("option",uM,X(J(e)("admin.allStatus")),1),m("option",_M,X(J(e)("admin.active")),1),m("option",pM,X(J(e)("admin.disabled")),1)],512),[[Ir,o.value]])]),m("div",mM,[m("table",gM,[m("thead",null,[m("tr",fM,[m("th",EM,X(J(e)("admin.thUsername")),1),m("th",SM,X(J(e)("admin.thName")),1),m("th",bM,X(J(e)("admin.thRole")),1),m("th",hM,X(J(e)("admin.thStatus")),1),m("th",TM,X(J(e)("admin.thCreatedAt")),1),m("th",vM,X(J(e)("admin.thActions")),1)])]),m("tbody",null,[i.value?(le(),de(ke,{key:0},Rt(5,U=>m("tr",{key:U,class:"border-t border-base-800"},[(le(),de(ke,null,Rt(6,H=>m("td",{key:H,class:"px-4 py-4"},[...w[29]||(w[29]=[m("div",{class:"h-4 bg-base-800 rounded animate-pulse"},null,-1)])])),64))])),64)):u.value.length===0?(le(),de("tr",RM,[m("td",CM,[w[30]||(w[30]=m("div",{class:"text-4xl mb-4 opacity-30"},"📦",-1)),m("p",yM,X(J(e)("admin.emptyState")),1)])])):(le(!0),de(ke,{key:2},Rt(u.value,U=>(le(),de("tr",{key:U.id,class:"border-t border-base-800 hover:bg-white/5 transition-colors"},[m("td",NM,X(U.username),1),m("td",OM,X(U.name||"-"),1),m("td",AM,[m("span",{class:Fe(["inline-flex items-center gap-1 px-3 py-1 text-xs font-medium rounded-full font-mono",U.role==="admin"?"bg-neon-400/10 text-neon-400 border border-neon-400/30":"bg-blue-500/10 text-blue-400 border border-blue-500/30"])},[U.role==="admin"?(le(),de("svg",IM,[...w[31]||(w[31]=[m("path",{d:"M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"},null,-1)])])):(le(),de("svg",xM,[...w[32]||(w[32]=[m("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"},null,-1),m("circle",{cx:"12",cy:"7",r:"4"},null,-1)])])),he(" "+X(U.role==="admin"?J(e)("admin.roleAdmin"):J(e)("admin.roleUser")),1)],2)]),m("td",DM,[m("span",{class:Fe(U.disabled?"text-red-400":"text-neon-400")},X(U.disabled?J(e)("admin.disabled"):J(e)("admin.active")),3)]),m("td",wM,X(W(U.created_at)),1),m("td",LM,[m("button",{class:"p-2 text-base-400 hover:text-neon-400 hover:bg-neon-400/10 rounded-lg transition-colors",onClick:H=>N(U),title:J(e)("admin.editUser")},[...w[33]||(w[33]=[m("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[m("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),m("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})],-1)])],8,MM)])]))),128))])]),d.value>1?(le(),de("div",kM,[m("button",{class:"px-4 py-2 rounded-lg font-mono text-sm border border-base-800 text-base-400 hover:border-neon-400 hover:text-neon-400 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",disabled:c.value===1,onClick:w[3]||(w[3]=U=>c.value--)},X(J(e)("admin.prevPage")),9,PM),m("span",UM,X(c.value)+" / "+X(d.value),1),m("button",{class:"px-4 py-2 rounded-lg font-mono text-sm border border-base-800 text-base-400 hover:border-neon-400 hover:text-neon-400 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",disabled:c.value===d.value,onClick:w[4]||(w[4]=U=>c.value++)},X(J(e)("admin.nextPage")),9,FM)])):ze("",!0)])]),p.value?(le(),de("div",{key:0,class:"fixed inset-0 bg-black/80 flex items-center justify-center z-50",onClick:At(b,["self"])},[m("div",BM,[m("div",GM,[m("h3",YM,[w[35]||(w[35]=m("span",{class:"text-neon-400 opacity-70"},">",-1)),he(" "+X(J(e)("admin.addModal")),1)]),m("button",{class:"text-base-400 hover:text-white transition-colors",onClick:b},[...w[36]||(w[36]=[m("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[m("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),m("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),m("form",{onSubmit:At(v,["prevent"]),class:"p-6 space-y-5"},[m("div",null,[w[37]||(w[37]=m("label",{class:"font-mono text-base-400 mb-2 block text-sm"},[m("span",{class:"text-neon-400 opacity-70"},"let"),he(),m("span",{class:"text-white"},"username"),he(),m("span",{class:"text-neon-400 opacity-70"},"=")],-1)),Ye(m("input",{type:"text","onUpdate:modelValue":w[5]||(w[5]=U=>g.value.username=U),required:"",autocomplete:"off",class:"w-full bg-base-950 border border-base-800 rounded-lg px-4 py-3 font-mono text-white focus:border-neon-400 focus:outline-none focus:ring-1 focus:ring-neon-400 transition-colors"},null,512),[[at,g.value.username]])]),m("div",null,[w[41]||(w[41]=m("label",{class:"font-mono text-base-400 mb-2 block text-sm"},[m("span",{class:"text-neon-400 opacity-70"},"let"),he(),m("span",{class:"text-white"},"password"),he(),m("span",{class:"text-neon-400 opacity-70"},"=")],-1)),m("div",qM,[Ye(m("input",{type:_.value?"text":"password","onUpdate:modelValue":w[6]||(w[6]=U=>g.value.password=U),required:"",autocomplete:"new-password",class:"w-full bg-base-950 border border-base-800 rounded-lg px-4 py-3 font-mono text-white focus:border-neon-400 focus:outline-none focus:ring-1 focus:ring-neon-400 transition-colors pr-20"},null,8,HM),[[e_,g.value.password]]),m("div",VM,[m("button",{type:"button",class:"p-1.5 text-base-400 hover:text-neon-400 rounded transition-colors",onClick:w[7]||(w[7]=U=>_.value=!_.value)},[_.value?(le(),de("svg",zM,[...w[38]||(w[38]=[m("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"},null,-1),m("circle",{cx:"12",cy:"12",r:"3"},null,-1)])])):(le(),de("svg",$M,[...w[39]||(w[39]=[m("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"},null,-1),m("line",{x1:"1",y1:"1",x2:"23",y2:"23"},null,-1)])]))]),m("button",{type:"button",class:"p-1.5 text-base-400 hover:text-neon-400 rounded transition-colors",onClick:h,title:"Generate password"},[...w[40]||(w[40]=[dr('<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="2" width="20" height="20" rx="2" ry="2"></rect><circle cx="8" cy="8" r="1.5" fill="currentColor" stroke="none"></circle><circle cx="16" cy="8" r="1.5" fill="currentColor" stroke="none"></circle><circle cx="8" cy="16" r="1.5" fill="currentColor" stroke="none"></circle><circle cx="16" cy="16" r="1.5" fill="currentColor" stroke="none"></circle></svg>',1)])])])])]),m("div",null,[w[42]||(w[42]=m("label",{class:"font-mono text-base-400 mb-2 block text-sm"},[m("span",{class:"text-neon-400 opacity-70"},"let"),he(),m("span",{class:"text-white"},"name"),he(),m("span",{class:"text-neon-400 opacity-70"},"=")],-1)),Ye(m("input",{type:"text","onUpdate:modelValue":w[8]||(w[8]=U=>g.value.name=U),class:"w-full bg-base-950 border border-base-800 rounded-lg px-4 py-3 font-mono text-white focus:border-neon-400 focus:outline-none focus:ring-1 focus:ring-neon-400 transition-colors"},null,512),[[at,g.value.name]])]),m("div",null,[m("label",WM,X(J(e)("admin.roleLabel")),1),m("div",KM,[m("label",QM,[Ye(m("input",{type:"radio","onUpdate:modelValue":w[9]||(w[9]=U=>g.value.role=U),value:"developer",class:"w-4 h-4 accent-neon-400"},null,512),[[jr,g.value.role]]),m("span",XM,X(J(e)("admin.roleUser")),1)]),m("label",ZM,[Ye(m("input",{type:"radio","onUpdate:modelValue":w[10]||(w[10]=U=>g.value.role=U),value:"admin",class:"w-4 h-4 accent-neon-400"},null,512),[[jr,g.value.role]]),m("span",jM,X(J(e)("admin.roleAdmin")),1)])])]),m("div",JM,[m("button",{type:"button",class:"px-4 py-2 rounded-lg font-mono text-sm border border-base-800 text-base-400 hover:border-white hover:text-white transition-colors",onClick:b},X(J(e)("admin.cancel")),1),m("button",{type:"submit",disabled:f.value,class:"btn-primary px-4 py-2 rounded-lg font-mono text-sm flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed"},[f.value?(le(),de("span",tk)):(le(),de(ke,{key:1},[he(X(J(e)("admin.confirmAdd")),1)],64))],8,ek)])],32)])])):ze("",!0),C.value?(le(),de("div",{key:1,class:"fixed inset-0 bg-black/80 flex items-center justify-center z-50",onClick:At(B,["self"])},[m("div",nk,[m("div",rk,[m("h3",ik,[w[43]||(w[43]=m("span",{class:"text-neon-400 opacity-70"},">",-1)),he(" "+X(J(e)("admin.editModal")),1)]),m("button",{class:"text-base-400 hover:text-white transition-colors",onClick:B},[...w[44]||(w[44]=[m("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[m("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),m("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),m("form",{onSubmit:At(I,["prevent"]),class:"p-6 space-y-5"},[m("div",null,[w[45]||(w[45]=m("label",{class:"font-mono text-base-400 mb-2 block text-sm"},[m("span",{class:"text-neon-400 opacity-70"},"let"),he(),m("span",{class:"text-white"},"username"),he(),m("span",{class:"text-neon-400 opacity-70"},"=")],-1)),m("input",{type:"text",value:O.value.username,disabled:"",class:"w-full bg-base-950 border border-base-800 rounded-lg px-4 py-3 font-mono text-base-400 cursor-not-allowed"},null,8,ak)]),m("div",null,[w[46]||(w[46]=m("label",{class:"font-mono text-base-400 mb-2 block text-sm"},[m("span",{class:"text-neon-400 opacity-70"},"let"),he(),m("span",{class:"text-white"},"name"),he(),m("span",{class:"text-neon-400 opacity-70"},"=")],-1)),Ye(m("input",{type:"text","onUpdate:modelValue":w[11]||(w[11]=U=>O.value.name=U),autocomplete:"off",class:"w-full bg-base-950 border border-base-800 rounded-lg px-4 py-3 font-mono text-white focus:border-neon-400 focus:outline-none focus:ring-1 focus:ring-neon-400 transition-colors"},null,512),[[at,O.value.name]])]),m("div",null,[m("label",sk,X(J(e)("admin.roleLabel")),1),m("div",ok,[m("label",lk,[Ye(m("input",{type:"radio","onUpdate:modelValue":w[12]||(w[12]=U=>O.value.role=U),value:"developer",class:"w-4 h-4 accent-neon-400"},null,512),[[jr,O.value.role]]),m("span",ck,X(J(e)("admin.roleUser")),1)]),m("label",dk,[Ye(m("input",{type:"radio","onUpdate:modelValue":w[13]||(w[13]=U=>O.value.role=U),value:"admin",class:"w-4 h-4 accent-neon-400"},null,512),[[jr,O.value.role]]),m("span",uk,X(J(e)("admin.roleAdmin")),1)])])]),m("div",_k,[m("div",pk,[m("div",null,[m("label",mk,X(J(e)("admin.statusLabel")),1),m("p",gk,X(O.value.disabled?J(e)("admin.statusDisabled"):J(e)("admin.statusActive")),1)]),m("label",fk,[Ye(m("input",{type:"checkbox","onUpdate:modelValue":w[14]||(w[14]=U=>O.value.disabled=U),class:"sr-only peer"},null,512),[[FE,O.value.disabled]]),w[47]||(w[47]=m("div",{class:"w-12 h-6 bg-base-800 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-base-400 after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-neon-400 peer-checked:after:bg-base-950"},null,-1))])])]),m("div",Ek,[m("div",Sk,[m("div",null,[m("label",bk,X(J(e)("admin.resetPassword")),1),m("p",hk,X(J(e)("admin.resetPasswordHint")),1)]),m("button",{type:"button",class:"px-3 py-1.5 rounded-lg font-mono text-xs border border-base-800 text-base-400 hover:border-neon-400 hover:text-neon-400 transition-colors",onClick:w[15]||(w[15]=U=>D.value=!D.value)},X(D.value?J(e)("admin.cancelReset"):J(e)("admin.doReset")),1)]),D.value?(le(),de("div",Tk,[m("div",vk,[Ye(m("input",{type:y.value?"text":"password","onUpdate:modelValue":w[16]||(w[16]=U=>O.value.newPassword=U),placeholder:J(e)("admin.newPasswordPlaceholder"),autocomplete:"new-password",class:"w-full bg-base-950 border border-base-800 rounded-lg px-4 py-3 font-mono text-white focus:border-neon-400 focus:outline-none focus:ring-1 focus:ring-neon-400 transition-colors pr-16"},null,8,Rk),[[e_,O.value.newPassword]]),m("div",Ck,[m("button",{type:"button",class:"p-1.5 text-base-400 hover:text-neon-400 rounded transition-colors",onClick:w[17]||(w[17]=U=>y.value=!y.value)},[y.value?(le(),de("svg",yk,[...w[48]||(w[48]=[m("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"},null,-1),m("circle",{cx:"12",cy:"12",r:"3"},null,-1)])])):(le(),de("svg",Nk,[...w[49]||(w[49]=[m("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"},null,-1),m("line",{x1:"1",y1:"1",x2:"23",y2:"23"},null,-1)])]))]),m("button",{type:"button",class:"p-1.5 text-base-400 hover:text-neon-400 rounded transition-colors",onClick:K,title:"Generate password"},[...w[50]||(w[50]=[dr('<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="2" width="20" height="20" rx="2" ry="2"></rect><circle cx="8" cy="8" r="1.5" fill="currentColor" stroke="none"></circle><circle cx="16" cy="8" r="1.5" fill="currentColor" stroke="none"></circle><circle cx="8" cy="16" r="1.5" fill="currentColor" stroke="none"></circle><circle cx="16" cy="16" r="1.5" fill="currentColor" stroke="none"></circle></svg>',1)])])])])])):ze("",!0)]),m("div",Ok,[m("button",{type:"button",class:"px-4 py-2 rounded-lg font-mono text-sm border border-base-800 text-base-400 hover:border-white hover:text-white transition-colors",onClick:B},X(J(e)("admin.cancel")),1),m("button",{type:"submit",disabled:L.value,class:"btn-primary px-4 py-2 rounded-lg font-mono text-sm flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed"},[L.value?(le(),de("span",Ik)):(le(),de(ke,{key:1},[he(X(J(e)("admin.confirmSave")),1)],64))],8,Ak)])],32)])])):ze("",!0)])}}}),NS=Nv({history:iv(ta),routes:[{path:"/",name:"",component:xR},{path:"/login",name:"login",component:$R},{path:"/skills/:id",name:"skill-detail",component:tx},{path:"/publish",name:"publish",component:Zx,meta:{requiresAuth:!0}},{path:"/settings",name:"settings",component:RD,meta:{requiresAuth:!0}},{path:"/cli-code",name:"cli-code",component:KD},{path:"/setup",name:"setup",component:mw},{path:"/diff",name:"diff",component:jL},{path:"/admin/users",name:"user-management",component:xk,meta:{requiresAuth:!0,requiresAdmin:!0}}]});NS.beforeEach(async t=>{if(!t.meta.requiresAuth&&!t.meta.requiresAdmin)return!0;const e=vi();return await e.fetchUser({force:!0})?t.meta.requiresAdmin&&!e.isAdmin?{path:"/"}:!0:{path:"/login",query:{redirect:t.fullPath}}});const Qd=_T(_R);Qd.use(gT());Qd.use(NS);Qd.mount("#app");
package/static/index.html CHANGED
@@ -12,7 +12,7 @@
12
12
  <link rel="preconnect" href="https://fonts.googleapis.com">
13
13
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
14
14
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap" rel="stylesheet">
15
- <script type="module" crossorigin src="./assets/index-BsB1le6_.js"></script>
15
+ <script type="module" crossorigin src="./assets/index-hw1ANzea.js"></script>
16
16
  <link rel="stylesheet" crossorigin href="./assets/index-CxLQPZK_.css">
17
17
  </head>
18
18
  <body>