26 lines
26 KiB
JavaScript
26 lines
26 KiB
JavaScript
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[436],{5977:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});/**
|
|
* @license lucide-react v0.344.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/let r=(0,a(4297).Z)("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]])},5180:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/console",function(){return a(1137)}])},1137:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return v}});var r=a(5893),s=a(7294),n=a(3982),i=a(4297);/**
|
|
* @license lucide-react v0.344.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/let o=(0,i.Z)("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);var l=a(5977),d=a(7338),c=a(8051);/**
|
|
* @license lucide-react v0.344.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/let x=(0,i.Z)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]),u=(0,i.Z)("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);var m=a(7764);/**
|
|
* @license lucide-react v0.344.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/let p=(0,i.Z)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);var h=a(3696);/**
|
|
* @license lucide-react v0.344.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/let b=(0,i.Z)("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);var g=a(5675),f=a.n(g),S=a(9008),N=a.n(S);function v(){let[e,t]=(0,s.useState)(!1),[a,i]=(0,s.useState)(""),[g,S]=(0,s.useState)(""),[v,E]=(0,s.useState)(!1),[w,y]=(0,s.useState)(""),[A,j]=(0,s.useState)("USERS"),[R,D]=(0,s.useState)([]),[O,T]=(0,s.useState)(null),[I,C]=(0,s.useState)([]),[M,k]=(0,s.useState)("MOCK"),U=(0,s.useRef)(null);(0,s.useEffect)(()=>{k(n.D.getMode())},[]),(0,s.useEffect)(()=>{if(e)return L(),_()},[e]),(0,s.useEffect)(()=>{U.current&&(U.current.scrollTop=U.current.scrollHeight)},[I]);let _=()=>{if("REAL"===n.D.getMode())return C(["[SYSTEM] Attempting to connect to live backend log stream...","[WARN] Log streaming over WebSocket not fully implemented in Preview"]),()=>{};let e=["Connection pool optimized...","User u_002 requested packet 0x4F...","Analysing traffic pattern...","Database heartbeat: STABLE","WARNING: High latency on node US-EAST-4","Backing up sector 7...","New material indexed successfully."],t=setInterval(()=>{let t=e[Math.floor(Math.random()*e.length)],a=new Date().toISOString().split("T")[1].replace("Z","");C(e=>[...e.slice(-20),"[".concat(a,"] ").concat(t)])},2e3);return()=>clearInterval(t)},L=async()=>{try{let e=await n.D.getAllUsers();D(e);let t=await n.D.getSystemConfig();T(t)}catch(e){C(t=>[...t,"[ERROR] Failed to fetch data: ".concat(e)])}},P=async e=>{e.preventDefault(),E(!0),y(""),await n.D.verifyAdmin(a,g)?(t(!0),C(["[SYSTEM] Root access granted.","[SYSTEM] Initializing admin daemon..."])):y("ACCESS_DENIED // INVALID_CREDENTIALS"),E(!1)},B=async()=>{if(O){E(!0);try{await n.D.updateSystemConfig(O),C(e=>[...e,"[SYSTEM] Database configuration updated. Restarting services..."]),alert("SYSTEM CONFIG UPDATED.")}catch(e){alert("Failed to update config.")}E(!1)}},V=async e=>{let t=await n.D.toggleUserStatus(e);t&&(D(R.map(a=>a.id===e?t:a)),C(e=>[...e,"[ADMIN] User ".concat(t.username," status changed to ").concat(t.status)]))},Z=async(e,t)=>{try{let a=await n.D.updateUserRole(e,t);D(t=>t.map(t=>t.id===e?a:t)),C(e=>[...e,"[ADMIN] Role of ".concat(a.username," -> ").concat(a.role)])}catch(e){C(t=>[...t,"[ERROR] Failed to update role: ".concat(e)])}},G=e=>{("REAL"!==e||confirm("WARNING: Switching to REAL mode will attempt to connect to a running MySQL backend at localhost:3000. \n\nContinue?"))&&((0,n.i)(e),k(e))};return e?(0,r.jsxs)("div",{className:"min-h-screen bg-[#050000] text-red-500 font-mono flex flex-col",children:[(0,r.jsx)(N(),{children:(0,r.jsx)("title",{children:"NEXUS_MAT.OS"})}),(0,r.jsxs)("header",{className:"h-16 border-b border-red-900/50 bg-black/50 flex items-center justify-between px-6 backdrop-blur",children:[(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsx)(d.Z,{size:24}),(0,r.jsxs)("span",{className:"text-xl font-bold tracking-tighter text-white",children:["CORE",(0,r.jsx)("span",{className:"text-red-600",children:".CONSOLE"})]}),(0,r.jsx)("span",{className:"px-2 py-0.5 text-[10px] border border-red-800 rounded bg-red-900/20 text-red-400",children:"ADMIN_MODE"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsxs)("div",{className:"hidden md:flex items-center gap-2 text-xs ".concat("REAL"===M?"text-green-500":"text-yellow-500"),children:[(0,r.jsx)("span",{className:"animate-pulse",children:"●"})," ","REAL"===M?"LIVE_DATABASE":"SIMULATION_MODE"]}),(0,r.jsx)("button",{onClick:()=>window.location.href="/",className:"p-2 hover:bg-red-900/20 rounded border border-transparent hover:border-red-900 transition-colors",title:"Exit to App",children:(0,r.jsx)(c.Z,{size:18})})]})]}),(0,r.jsxs)("div",{className:"flex flex-1 overflow-hidden",children:[(0,r.jsxs)("aside",{className:"w-64 border-r border-red-900/30 bg-red-950/5 hidden md:flex flex-col",children:[(0,r.jsxs)("nav",{className:"p-4 space-y-2",children:[(0,r.jsxs)("button",{onClick:()=>j("USERS"),className:"w-full flex items-center gap-3 p-3 text-sm transition-all ".concat("USERS"===A?"bg-red-900/20 border-l-2 border-red-500 text-white":"text-red-800 hover:text-red-400"),children:[(0,r.jsx)(x,{size:18})," USER_REGISTRY"]}),(0,r.jsxs)("button",{onClick:()=>j("DB"),className:"w-full flex items-center gap-3 p-3 text-sm transition-all ".concat("DB"===A?"bg-red-900/20 border-l-2 border-red-500 text-white":"text-red-800 hover:text-red-400"),children:[(0,r.jsx)(u,{size:18})," DATABASE_CONFIG"]}),(0,r.jsxs)("button",{onClick:()=>j("LOGS"),className:"w-full flex items-center gap-3 p-3 text-sm transition-all ".concat("LOGS"===A?"bg-red-900/20 border-l-2 border-red-500 text-white":"text-red-800 hover:text-red-400"),children:[(0,r.jsx)(d.Z,{size:18})," SYSTEM_LOGS"]})]}),(0,r.jsx)("div",{className:"mt-auto p-4 border-t border-red-900/30",children:(0,r.jsxs)("div",{className:"text-[10px] text-red-900",children:["SERVER_UPTIME: 489h 22m",(0,r.jsx)("br",{}),"MEMORY: 64TB / 128TB"]})})]}),(0,r.jsxs)("main",{className:"flex-1 overflow-y-auto p-8 relative",children:[(0,r.jsx)("div",{className:"absolute top-0 right-0 p-10 opacity-10 pointer-events-none",children:(0,r.jsx)(u,{size:200})}),"USERS"===A&&(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"flex justify-between items-end border-b border-red-900/30 pb-4",children:[(0,r.jsx)("h2",{className:"text-2xl font-bold text-white",children:"USER_DATABASE"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("input",{placeholder:"SEARCH_ID...",className:"bg-black border border-red-900 p-1 text-xs text-red-500 w-40 focus:outline-none"}),(0,r.jsx)("button",{className:"p-1 bg-red-900/20 border border-red-900",children:(0,r.jsx)(m.Z,{size:14})})]})]}),(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsxs)("table",{className:"w-full text-left text-sm",children:[(0,r.jsx)("thead",{className:"text-xs text-red-700 uppercase tracking-wider bg-red-950/10",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{className:"p-3",children:"AVATAR"}),(0,r.jsx)("th",{className:"p-3",children:"IDENTIFIER"}),(0,r.jsx)("th",{className:"p-3",children:"ROLE"}),(0,r.jsx)("th",{className:"p-3",children:"STATUS"}),(0,r.jsx)("th",{className:"p-3",children:"CREATED"}),(0,r.jsx)("th",{className:"p-3 text-right",children:"ACTIONS"})]})}),(0,r.jsx)("tbody",{className:"divide-y divide-red-900/20",children:R.map(e=>(0,r.jsxs)("tr",{className:"hover:bg-red-900/5 transition-colors group",children:[(0,r.jsx)("td",{className:"p-3",children:(0,r.jsx)(f(),{src:e.avatarUrl,alt:"avatar",width:32,height:32,className:"w-8 h-8 rounded-sm grayscale group-hover:grayscale-0 transition-all border border-red-900/50"})}),(0,r.jsxs)("td",{className:"p-3 font-bold text-gray-300",children:[e.username,(0,r.jsx)("br",{}),(0,r.jsx)("span",{className:"text-[10px] text-red-800",children:e.id})]}),(0,r.jsx)("td",{className:"p-3 text-xs",children:(0,r.jsxs)("select",{value:e.role,onChange:t=>Z(e.id,t.target.value),className:"bg-black border border-red-900 text-red-500 text-xs p-1",children:[(0,r.jsx)("option",{value:"USER",children:"USER"}),(0,r.jsx)("option",{value:"CREATOR",children:"CREATOR"}),(0,r.jsx)("option",{value:"MANAGER",children:"MANAGER"}),(0,r.jsx)("option",{value:"ADMIN",children:"ADMIN"})]})}),(0,r.jsx)("td",{className:"p-3",children:(0,r.jsx)("span",{className:"px-2 py-0.5 text-[10px] border ".concat("ACTIVE"===e.status?"border-green-900 text-green-500":"border-red-500 text-red-500 animate-pulse"),children:e.status})}),(0,r.jsx)("td",{className:"p-3 text-xs text-red-800",children:new Date(e.createdAt).toLocaleDateString()}),(0,r.jsx)("td",{className:"p-3 text-right",children:(0,r.jsx)("button",{onClick:()=>V(e.id),className:"px-3 py-1 border border-red-900 hover:bg-red-500 hover:text-black transition-colors text-xs",children:"ACTIVE"===e.status?"BAN_USER":"RESTORE"})})]},e.id))})]})})]}),"DB"===A&&O&&(0,r.jsxs)("div",{className:"max-w-2xl space-y-8",children:[(0,r.jsxs)("h2",{className:"text-2xl font-bold text-white border-b border-red-900/30 pb-4 flex items-center justify-between",children:["MYSQL_CONFIGURATION",(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsx)("span",{className:"text-xs font-normal text-gray-400",children:"DATA_SOURCE_MODE:"}),(0,r.jsxs)("div",{className:"flex border border-red-900 rounded overflow-hidden",children:[(0,r.jsx)("button",{onClick:()=>G("MOCK"),className:"px-3 py-1 text-xs transition-colors ".concat("MOCK"===M?"bg-red-600 text-black font-bold":"hover:bg-red-900/20 text-red-500"),children:"SIMULATION"}),(0,r.jsx)("button",{onClick:()=>G("REAL"),className:"px-3 py-1 text-xs transition-colors ".concat("REAL"===M?"bg-red-600 text-black font-bold":"hover:bg-red-900/20 text-red-500"),children:"LIVE_MYSQL"})]})]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 ".concat("MOCK"===M?"opacity-50 pointer-events-none grayscale":""),children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("label",{className:"text-xs text-red-700",children:"HOST_ADDRESS"}),(0,r.jsx)("input",{value:O.dbHost,onChange:e=>T({...O,dbHost:e.target.value}),className:"w-full bg-black border border-red-900 p-3 text-white focus:border-red-500 outline-none"})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("label",{className:"text-xs text-red-700",children:"PORT"}),(0,r.jsx)("input",{value:O.dbPort,onChange:e=>T({...O,dbPort:e.target.value}),className:"w-full bg-black border border-red-900 p-3 text-white focus:border-red-500 outline-none"})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("label",{className:"text-xs text-red-700",children:"ROOT_USER"}),(0,r.jsx)("input",{value:O.dbUser,onChange:e=>T({...O,dbUser:e.target.value}),className:"w-full bg-black border border-red-900 p-3 text-white focus:border-red-500 outline-none"})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("label",{className:"text-xs text-red-700",children:"ENCRYPTED_PASS"}),(0,r.jsx)("input",{type:"password",value:O.dbPass,onChange:e=>T({...O,dbPass:e.target.value}),className:"w-full bg-black border border-red-900 p-3 text-white focus:border-red-500 outline-none"})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("label",{className:"text-xs text-red-700",children:"DATABASE_NAME"}),(0,r.jsx)("input",{value:O.dbName,onChange:e=>T({...O,dbName:e.target.value}),className:"w-full bg-black border border-red-900 p-3 text-white focus:border-red-500 outline-none"})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("label",{className:"text-xs text-red-700",children:"MAX_UPLOAD_MB"}),(0,r.jsx)("input",{value:O.maxUploadMB,onChange:e=>T({...O,maxUploadMB:Number(e.target.value)||0}),className:"w-full bg-black border border-red-900 p-3 text-white focus:border-red-500 outline-none"})]})]}),"MOCK"===M&&(0,r.jsxs)("div",{className:"p-4 border border-yellow-800 bg-yellow-900/10 text-yellow-600 text-xs font-mono",children:["[INFO] Currently running in SIMULATION MODE.",(0,r.jsx)("br",{}),"Configuration editing is disabled.",(0,r.jsx)("br",{}),"Switch to LIVE_MYSQL to configure connection string."]}),(0,r.jsxs)("div",{className:"flex items-center gap-4 pt-6 border-t border-red-900/30",children:[(0,r.jsxs)("button",{onClick:B,disabled:v||"MOCK"===M,className:"flex items-center gap-2 px-6 py-3 bg-red-600 text-black font-bold hover:bg-white transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[v?(0,r.jsx)(p,{className:"animate-spin",size:18}):(0,r.jsx)(h.Z,{size:18}),"COMMIT_CHANGES"]}),(0,r.jsxs)("button",{className:"px-6 py-3 border border-red-900 text-red-500 hover:bg-red-900/20 transition-colors flex items-center gap-2",children:[(0,r.jsx)(b,{size:18})," SHUTDOWN_DB"]})]})]}),"LOGS"===A&&(0,r.jsxs)("div",{className:"h-full flex flex-col",children:[(0,r.jsx)("h2",{className:"text-2xl font-bold text-white border-b border-red-900/30 pb-4 mb-4",children:"KERNEL_LOGS"}),(0,r.jsx)("div",{ref:U,className:"flex-1 bg-black/50 border border-red-900/50 p-4 font-mono text-xs overflow-y-auto font-light",children:I.map((e,t)=>(0,r.jsxs)("div",{className:"mb-1 text-red-400 hover:text-white transition-colors cursor-default",children:[(0,r.jsx)("span",{className:"opacity-50 mr-2",children:t.toString().padStart(4,"0")}),e]},t))})]})]})]})]}):(0,r.jsxs)("div",{className:"min-h-screen bg-black text-red-600 font-mono flex items-center justify-center p-4 relative overflow-hidden",children:[(0,r.jsx)(N(),{children:(0,r.jsx)("title",{children:"NEXUS_MAT.OS"})}),(0,r.jsx)("div",{className:"absolute inset-0 z-0 opacity-20 pointer-events-none",style:{backgroundImage:"linear-gradient(rgba(255, 0, 0, 0.1) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 0, 0, 0.1) 1px, transparent 1px)",backgroundSize:"20px 20px"}}),(0,r.jsxs)("div",{className:"w-full max-w-md z-10 border border-red-900 bg-black/80 backdrop-blur-sm p-8 shadow-[0_0_50px_rgba(220,38,38,0.2)]",children:[(0,r.jsx)("div",{className:"flex justify-center mb-8",children:(0,r.jsx)(o,{size:64,className:"animate-pulse"})}),(0,r.jsxs)("h1",{className:"text-3xl font-bold text-center mb-2 tracking-widest",children:["NEXUS",(0,r.jsx)("span",{className:"text-white",children:"_CORE"})]}),(0,r.jsx)("p",{className:"text-center text-xs text-red-800 mb-8",children:"RESTRICTED AREA // AUTHORIZED PERSONNEL ONLY"}),(0,r.jsxs)("form",{onSubmit:P,className:"space-y-6",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("label",{className:"text-xs",children:"IDENTIFIER"}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("input",{type:"text",value:a,onChange:e=>i(e.target.value),className:"w-full bg-red-950/20 border border-red-900 p-3 text-red-500 focus:outline-none focus:border-red-500 transition-colors",placeholder:"admin"}),(0,r.jsx)(l.Z,{className:"absolute right-3 top-3 text-red-900",size:16})]})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("label",{className:"text-xs",children:"KEY_PHRASE"}),(0,r.jsx)("div",{className:"relative",children:(0,r.jsx)("input",{type:"password",value:g,onChange:e=>S(e.target.value),className:"w-full bg-red-950/20 border border-red-900 p-3 text-red-500 focus:outline-none focus:border-red-500 transition-colors",placeholder:"••••••••"})})]}),w&&(0,r.jsx)("div",{className:"text-xs bg-red-950/50 border border-red-500 p-2 text-center animate-pulse",children:w}),(0,r.jsx)("button",{disabled:v,className:"w-full py-4 bg-red-700 hover:bg-red-600 text-black font-bold tracking-widest transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:v?"AUTHENTICATING...":"ESTABLISH_CONNECTION"})]}),(0,r.jsxs)("div",{className:"mt-8 text-[10px] text-center text-red-900",children:["SYSTEM_ID: 0x8842-ALPHA ",(0,r.jsx)("br",{})," IP_LOGGED: 127.0.0.1"]})]})]})}},3982:function(e,t,a){"use strict";a.d(t,{D:function(){return u},i:function(){return i}});var r=a(3789);let s="NEXUS_DATA_MODE",n=()=>localStorage.getItem(s)||"MOCK",i=e=>{localStorage.setItem(s,e),window.location.reload()},o={id:"u_001",username:"Neo_Architect",avatarUrl:"https://picsum.photos/seed/neo/200/200",role:r.i.CREATOR,status:"ACTIVE",createdAt:new Date(2023,10,15).toISOString(),lastLogin:new Date().toISOString()},l=[o,{id:"u_002",username:"Visual_Drift",avatarUrl:"https://picsum.photos/seed/drift/200/200",role:r.i.CREATOR,status:"ACTIVE",createdAt:new Date(2023,11,1).toISOString(),lastLogin:new Date().toISOString()},{id:"u_003",username:"Poly_Master",avatarUrl:"https://picsum.photos/seed/poly/200/200",role:r.i.USER,status:"FLAGGED",createdAt:new Date(2024,0,10).toISOString(),lastLogin:new Date().toISOString()},{id:"u_004",username:"Script_Kiddie",avatarUrl:"https://picsum.photos/seed/kiddie/200/200",role:r.i.USER,status:"BANNED",createdAt:new Date(2024,1,20).toISOString(),lastLogin:new Date(2024,2,1).toISOString()}],d=[{id:"m_001",title:"Cyberpunk HUD Interface React",description:"A complete React component set for building sci-fi interfaces. Includes glitch effects and holographic transitions.",type:r.x.CODE,codeSnippet:'const CyberButton = ({ children }) => (\n <button className="border border-neon-500 text-neon-500 hover:bg-neon-500 hover:text-black transition-all duration-300 uppercase tracking-widest px-6 py-2">\n {children}\n </button>\n);',language:"tsx",author:o,stats:{views:1204,downloads:450,favorites:89},tags:["react","ui","cyberpunk","animation"],createdAt:new Date(Date.now()-1728e5).toISOString(),comments:[]},{id:"m_002",title:"Neon City Ambience Loop",description:"4K loop of a futuristic city rain scene. Perfect for background assets.",type:r.x.VIDEO,contentUrl:"https://media.w3.org/2010/05/sintel/trailer.mp4",author:l[1],stats:{views:5320,downloads:1200,favorites:432},tags:["video","loop","background","4k"],createdAt:new Date(Date.now()-432e6).toISOString(),comments:[{id:"c_1",content:"The lighting on this is insane!",author:o,createdAt:new Date().toISOString()}]},{id:"m_003",title:"Industrial 3D Assets Pack",description:"Low-poly mechanical parts for game dev. GLB format + Textures.",type:r.x.ASSET_ZIP,contentUrl:"#",author:l[2],stats:{views:800,downloads:120,favorites:45},tags:["3d","blender","game-assets"],createdAt:new Date(Date.now()-864e5).toISOString(),comments:[]}];if(d.length<40){let e=d.length,t=[r.x.CODE,r.x.ASSET_ZIP,r.x.VIDEO];for(let a=e;a<40;a++){let e="m_".concat((a+1).toString().padStart(3,"0")),s=l[a%l.length],n=t[a%t.length],i=new Date(Date.now()-a%10*864e5).toISOString(),o={views:Math.floor(1e3*Math.random()),downloads:Math.floor(200*Math.random()),favorites:Math.floor(50*Math.random())},c={id:e,title:n===r.x.CODE?"Test Code Snippet #".concat(a+1):n===r.x.ASSET_ZIP?"Assets Pack #".concat(a+1):"Demo Video #".concat(a+1),description:"Auto-generated demo material.",type:n,author:s,stats:o,tags:n===r.x.CODE?["test","code"]:n===r.x.ASSET_ZIP?["assets"]:["video"],createdAt:i,comments:[]};n===r.x.CODE?d.push({...c,codeSnippet:"function test".concat(a,"(){return ").concat(a,";}"),language:"ts"}):n===r.x.ASSET_ZIP?d.push({...c,contentUrl:"#"}):d.push({...c,contentUrl:"https://media.w3.org/2010/05/sintel/trailer.mp4"})}}let c={dbHost:"127.0.0.1",dbPort:"3306",dbUser:"root",dbPass:"admin123",dbName:"nexus_db",maintenanceMode:!1,maxUploadMB:3};async function x(e,t){try{let a=await fetch("/api/v1".concat(e),{...t,headers:{"Content-Type":"application/json",...null==t?void 0:t.headers}}),r=await a.json();if(!a.ok)throw Error(r.error||a.statusText||"Request failed");return r.data}catch(e){throw console.error("API Call Failed:",e),e}}let u={getMode:n,setApiMode:i,getCurrentUser:async()=>{if("REAL"===n())try{return await x("/auth/me")}catch(e){return console.log("User not authenticated"),null}return new Promise(e=>setTimeout(()=>e(o),500))},updateUserProfile:async(e,t)=>"REAL"===n()?x("/users/me",{method:"PATCH",body:JSON.stringify(t)}):new Promise(a=>{o.id===e&&(t.username&&(o.username=t.username),t.avatarUrl&&(o.avatarUrl=t.avatarUrl)),setTimeout(()=>a({...o}),800)}),getMaterials:async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:20,a=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,s=new URLSearchParams({page:String(e),limit:String(t)});if(a&&"ALL"!==a&&s.append("type",String(a)),r&&r.trim()&&s.append("q",r.trim()),"REAL"===n())return x("/materials?".concat(s.toString()));let i=a&&"ALL"!==a?d.filter(e=>e.type===a):d;if(r&&r.trim()){let e=r.trim().toLowerCase();i=i.filter(t=>{let a=t.title.toLowerCase().includes(e),r=t.description.toLowerCase().includes(e),s=t.tags.some(t=>t.toLowerCase().includes(e));return a||r||s})}let o=(e-1)*t,l=i.slice(o,o+t),c=i.length,u=e*t<c;return new Promise(a=>setTimeout(()=>a({items:l,total:c,page:e,limit:t,hasNext:u}),400))},getUserMaterials:async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:20;if("REAL"===n())return x("/users/me/materials?page=".concat(e,"&limit=").concat(t));let a=d.filter(e=>e.author.id===o.id),r=(e-1)*t,s=a.slice(r,r+t),i=a.length,l=e*t<i;return new Promise(a=>setTimeout(()=>a({items:s,total:i,page:e,limit:t,hasNext:l}),300))},getUserFavorites:async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:20;if("REAL"===n())return x("/users/me/favorites?page=".concat(e,"&limit=").concat(t));let a=d.filter(e=>e.stats.favorites>0),r=(e-1)*t,s=a.slice(r,r+t),i=a.length,o=e*t<i;return new Promise(a=>setTimeout(()=>a({items:s,total:i,page:e,limit:t,hasNext:o}),300))},getMaterialById:async e=>"REAL"===n()?x("/materials/".concat(e)):new Promise(t=>{let a=d.find(t=>t.id===e);setTimeout(()=>t(a),400)}),createMaterial:async e=>"REAL"===n()?x("/materials",{method:"POST",body:JSON.stringify(e)}):new Promise(t=>{let a={id:"m_".concat(Date.now()),title:e.title||"Untitled",description:e.description||"",type:e.type||r.x.CODE,codeSnippet:e.codeSnippet,contentUrl:e.contentUrl,language:e.language||"text",author:o,stats:{views:0,downloads:0,favorites:0},tags:e.tags||[],createdAt:new Date().toISOString(),comments:[]};d.unshift(a),setTimeout(()=>t(a),1e3)}),deleteMaterial:async e=>{if("REAL"===n())return await x("/materials/".concat(e),{method:"DELETE"}),!0;let t=d.findIndex(t=>t.id===e);return t>-1&&(d.splice(t,1),!0)},addComment:async(e,t)=>{if("REAL"===n())return x("/materials/".concat(e,"/comments"),{method:"POST",body:JSON.stringify({content:t})});let a=d.find(t=>t.id===e);if(!a)throw Error("Material not found");let r={id:"c_".concat(Date.now()),content:t,author:o,createdAt:new Date().toISOString()};return a.comments.push(r),r},toggleFavorite:async e=>{if("REAL"===n())return(await x("/materials/".concat(e,"/favorite"),{method:"POST"})).favorites;let t=d.find(t=>t.id===e);return t?(t.stats.favorites+=1,t.stats.favorites):0},uploadZip:async(e,t)=>{let a=new FormData;a.append("file",e),(null==t?void 0:t.title)&&a.append("title",t.title),(null==t?void 0:t.description)&&a.append("description",t.description),(null==t?void 0:t.tags)&&a.append("tags",t.tags.join(","));let r=await fetch("/api/v1/materials/upload-zip",{method:"POST",body:a});if(!(r.headers.get("content-type")||"").includes("application/json"))throw Error(await r.text()||"Upload failed (".concat(r.status,")"));let s=await r.json();if(!r.ok||!s.success)throw Error(s.error||"Upload failed (".concat(r.status,")"));return s.data},uploadVideo:async(e,t)=>{let a=new FormData;a.append("file",e),(null==t?void 0:t.title)&&a.append("title",t.title),(null==t?void 0:t.description)&&a.append("description",t.description),(null==t?void 0:t.tags)&&a.append("tags",t.tags.join(","));let r=await fetch("/api/v1/materials/upload-video",{method:"POST",body:a});if(!(r.headers.get("content-type")||"").includes("application/json"))throw Error(await r.text()||"Upload failed (".concat(r.status,")"));let s=await r.json();if(!r.ok||!s.success)throw Error(s.error||"Upload failed (".concat(r.status,")"));return s.data},verifyAdmin:async(e,t)=>new Promise(a=>{setTimeout(()=>{a("admin"===e&&"wx1998WX"===t)},1e3)}),getAllUsers:async()=>"REAL"===n()?x("/admin/users"):new Promise(e=>setTimeout(()=>e(l),600)),updateUserRole:async(e,t)=>{if("REAL"===n())return x("/admin/users/".concat(e,"/role"),{method:"POST",body:JSON.stringify({role:t})});let a=l.find(t=>t.id===e);if(!a)throw Error("User not found");return a.role=t,new Promise(e=>setTimeout(()=>e({...a}),400))},getSystemConfig:async()=>"REAL"===n()?x("/admin/config"):c,updateSystemConfig:async e=>{if("REAL"===n()){await x("/admin/config",{method:"PUT",body:JSON.stringify({maxUploadMB:e.maxUploadMB})});return}return c=e,new Promise(e=>setTimeout(e,1500))},toggleUserStatus:async e=>{if("REAL"===n())return x("/admin/users/".concat(e,"/toggle-status"),{method:"POST"});let t=l.find(t=>t.id===e);if(t)return t.status="ACTIVE"===t.status?"BANNED":"ACTIVE",t}}},3789:function(e,t,a){"use strict";var r,s,n,i;a.d(t,{i:function(){return r},x:function(){return s}}),(n=r||(r={})).USER="USER",n.ADMIN="ADMIN",n.CREATOR="CREATOR",n.MANAGER="MANAGER",(i=s||(s={})).CODE="CODE",i.ASSET_ZIP="ASSET_ZIP",i.VIDEO="VIDEO"}},function(e){e.O(0,[221,888,774,179],function(){return e(e.s=5180)}),_N_E=e.O()}]); |