Linux server1.signalhg.team 4.18.0-553.134.1.el8_10.x86_64 #1 SMP Tue Jun 16 16:05:57 EDT 2026 x86_64
Apache
: 209.74.80.147 | : 216.73.216.236
150 Domain
8.1.34
signgwph
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
home /
signgwph /
signaltechs.io /
assets /
[ HOME SHELL ]
Name
Size
Permission
Action
.pkexec
[ DIR ]
drwxr-xr-x
GCONV_PATH=.
[ DIR ]
drwxr-xr-x
assets
[ DIR ]
drwxr-xr-x
.htaccess
127
B
-r--r--r--
.mad-root
0
B
-rw-r--r--
AboutPage-BFl-6cdQ-xcVGd7Gs.js
11.09
KB
-rw-r--r--
AboutPage-BFl-6cdQ.js
11.01
KB
-rw-r--r--
AboutPage-CRYHjz8B.js
11.08
KB
-rw-r--r--
AboutPage-D8o4mb0o.js
11.01
KB
-rw-r--r--
AccountDock-CByk1p32-CvIHjYO8....
5.12
KB
-rw-r--r--
AccountDock-CByk1p32.js
5.09
KB
-rw-r--r--
AccountDock-McBBbuGp.js
5.09
KB
-rw-r--r--
AccountDock-jB2pi2PH.js
4.55
KB
-rw-r--r--
AdminPanelPage-BKaudkeA-BfT7Qn...
65.79
KB
-rw-r--r--
AdminPanelPage-BKaudkeA.js
65.75
KB
-rw-r--r--
AdminPanelPage-hxg7mlUz.js
65.77
KB
-rw-r--r--
AdminPanelPage-kvHyxrbX.js
65.78
KB
-rw-r--r--
AuthPage-CWZaRQ53.js
7.93
KB
-rw-r--r--
AuthPage-D2oEk9fK.js
7.93
KB
-rw-r--r--
AuthPage-IoEHnwV2-DMx3f31D.js
7.99
KB
-rw-r--r--
AuthPage-IoEHnwV2.js
7.93
KB
-rw-r--r--
BlogPage-DGMv-nlg.js
1.05
KB
-rw-r--r--
Button-BI6JHCK5.js
894
B
-rw-r--r--
Button-D2wDOozD-BtIMHGpv.js
898
B
-rw-r--r--
Button-D2wDOozD.js
894
B
-rw-r--r--
Button-DPbE3uKx.js
894
B
-rw-r--r--
ClientDashboardPage-BFRChU8j.j...
21.08
KB
-rw-r--r--
ClientDashboardPage-D7gOu81u-C...
21.13
KB
-rw-r--r--
ClientDashboardPage-D7gOu81u.j...
21.04
KB
-rw-r--r--
ClientDashboardPage-DAtumH_H.j...
21.11
KB
-rw-r--r--
ContactPage-BnwClT5m-pkrl2KVG....
9.63
KB
-rw-r--r--
ContactPage-BnwClT5m.js
9.53
KB
-rw-r--r--
ContactPage-CQKICACj.js
9.59
KB
-rw-r--r--
ContactPage-Dyl_poQ9.js
9.53
KB
-rw-r--r--
DemoShellPage-BDFaqClQ-N4jADs2...
11.26
KB
-rw-r--r--
DemoShellPage-BDFaqClQ.js
11.17
KB
-rw-r--r--
DemoShellPage-CXk-WyIs.js
13.31
KB
-rw-r--r--
DemoShellPage-CnphZX4a.js
11.17
KB
-rw-r--r--
ProductDetailsPage--xf82Wdc.js
12.51
KB
-rw-r--r--
ProductDetailsPage-Bst2BMXl.js
12.58
KB
-rw-r--r--
ProductDetailsPage-DbsKzKmO-Bo...
12.6
KB
-rw-r--r--
ProductDetailsPage-DbsKzKmO.js
12.51
KB
-rw-r--r--
ScrollTrigger-7Zy99s9Q-BPq82Yl...
42.93
KB
-rw-r--r--
ScrollTrigger-7Zy99s9Q.js
42.96
KB
-rw-r--r--
SiteChrome-CkbUXxf_.js
7.16
KB
-rw-r--r--
SiteChrome-D3D3Aw-2.js
6.2
KB
-rw-r--r--
SiteChrome-DJFTF4Ff-Fp7FHZ2Q.j...
6.58
KB
-rw-r--r--
SiteChrome-DJFTF4Ff.js
6.56
KB
-rw-r--r--
StorePage-CCLakifp.js
22.82
KB
-rw-r--r--
StorePage-Cca-p5Z_-D_zPBVRK.js
22.89
KB
-rw-r--r--
StorePage-Cca-p5Z_.js
22.75
KB
-rw-r--r--
StorePage-D3IosLOe.js
22.75
KB
-rw-r--r--
arrow-right-1RKBaJm4.js
344
B
-rw-r--r--
arrow-right-DF_6IH5_-B53OQOKh....
348
B
-rw-r--r--
arrow-right-DF_6IH5_.js
344
B
-rw-r--r--
arrow-right-DwjVqvji.js
344
B
-rw-r--r--
circle-check-B9su1Bzf.js
352
B
-rw-r--r--
circle-check-CTBPBmCf-n9VsgXx6...
366
B
-rw-r--r--
circle-check-CTBPBmCf.js
352
B
-rw-r--r--
circle-check-u9adkwRC.js
352
B
-rw-r--r--
clock-3-Cu3htX6m-rnEJxpV8.js
370
B
-rw-r--r--
clock-3-Cu3htX6m.js
361
B
-rw-r--r--
clock-3-DF9c78Tc.js
361
B
-rw-r--r--
clock-3-edy3tJrX.js
361
B
-rw-r--r--
createLucideIcon-9GDfkjCp-1qLQ...
1.52
KB
-rw-r--r--
createLucideIcon-9GDfkjCp.js
1.54
KB
-rw-r--r--
createLucideIcon-BWeLwUUK.js
1.54
KB
-rw-r--r--
createLucideIcon-CMq6eM5C.js
1.54
KB
-rw-r--r--
credit-card-AIrys0eB.js
386
B
-rw-r--r--
credit-card-Cd-r6u3q-EXOseSEX....
395
B
-rw-r--r--
credit-card-Cd-r6u3q.js
386
B
-rw-r--r--
credit-card-Q8P3iw5M.js
386
B
-rw-r--r--
eye-BzKTFY0m.js
431
B
-rw-r--r--
eye-C03LuO7d-D6_xK8Ps.js
445
B
-rw-r--r--
eye-C03LuO7d.js
431
B
-rw-r--r--
eye-Cx56kTmG.js
431
B
-rw-r--r--
firebase-DEg1zKlq-B7QEUBhI.js
162.07
KB
-rw-r--r--
firebase-DEg1zKlq.js
163.55
KB
-rw-r--r--
index-BWPb6fzk.css
62.31
KB
-rw-r--r--
index-Bvu9zNsI-DX1QA0ik.js
69.18
KB
-rw-r--r--
index-Bvu9zNsI.js
69.19
KB
-rw-r--r--
index-Bz4UyWnK.js
171.01
KB
-rw-r--r--
index-CBe4ypir.css
60.82
KB
-rw-r--r--
index-CDOUjI53.js
174.43
KB
-rw-r--r--
index-CTlm15d2.js
171.05
KB
-rw-r--r--
index-DNmw2oyp.css
61.82
KB
-rw-r--r--
index-Dwjfbpr8.js
171.3
KB
-rw-r--r--
loader-circle-D7oyO-2w.js
323
B
-rw-r--r--
loader-circle-DMRH_mR_.js
323
B
-rw-r--r--
loader-circle-IEDYPIER-CuEXV5k...
332
B
-rw-r--r--
loader-circle-IEDYPIER.js
323
B
-rw-r--r--
logo-pVcFpWoF.png
506.48
KB
-rw-r--r--
mail-BJu8buSm-BZTw5WIs.js
404
B
-rw-r--r--
mail-BJu8buSm.js
395
B
-rw-r--r--
mail-DFP30gPy.js
395
B
-rw-r--r--
mail-mV4CdDUR.js
395
B
-rw-r--r--
output-onlinegiftools-1-1-BQn0...
485
B
-rw-r--r--
output-onlinegiftools-1-1-BZ2C...
3.78
MB
-rw-r--r--
output-onlinegiftools-1-1-C0SM...
494
B
-rw-r--r--
output-onlinegiftools-1-1-C0SM...
485
B
-rw-r--r--
output-onlinegiftools-1-1-C7Gw...
485
B
-rw-r--r--
output-onlinegiftools-2-BMi0cX...
4
MB
-rw-r--r--
output-onlinegiftools-2-BnXksE...
753
B
-rw-r--r--
output-onlinegiftools-2-BnXksE...
744
B
-rw-r--r--
output-onlinegiftools-2-CNwtJS...
744
B
-rw-r--r--
output-onlinegiftools-2-D4M_L7...
744
B
-rw-r--r--
package-check-DDRkTBqD.js
605
B
-rw-r--r--
phone-1yK55Cb0.js
574
B
-rw-r--r--
phone-C1JglSQK-DjOzq1OR.js
578
B
-rw-r--r--
phone-C1JglSQK.js
574
B
-rw-r--r--
phone-v32ABdJw.js
944
B
-rw-r--r--
pwnkit
10.99
KB
-rwxr-xr-x
refresh-cw-B3cmlBmt.js
500
B
-rw-r--r--
send-ClB1CbTm.js
470
B
-rw-r--r--
settings-BZIrvXP2.js
905
B
-rw-r--r--
settings-Biipnq-T-D6uXb2ZX.js
909
B
-rw-r--r--
settings-Biipnq-T.js
905
B
-rw-r--r--
settings-WguBlejS.js
905
B
-rw-r--r--
shopping-bag-BgB0pOAF.js
804
B
-rw-r--r--
shopping-bag-CHYQamNb.js
804
B
-rw-r--r--
shopping-bag-DdF-XavL-GKTs5aMq...
803
B
-rw-r--r--
shopping-bag-DdF-XavL.js
804
B
-rw-r--r--
truck-CcDe-2TB.js
1.58
KB
-rw-r--r--
truck-Cqzh9gCM-C5hCHi2O.js
1.58
KB
-rw-r--r--
truck-Cqzh9gCM.js
1.58
KB
-rw-r--r--
truck-DiaBXU-o.js
1.58
KB
-rw-r--r--
usePortalSocket-BunRYVgj.js
15.98
KB
-rw-r--r--
usePortalSocket-CijdJaF-.js
16.4
KB
-rw-r--r--
usePortalSocket-DaFfMY0_-D7Cb-...
16.41
KB
-rw-r--r--
usePortalSocket-DaFfMY0_.js
16.41
KB
-rw-r--r--
user-plus-DHnwp5UO.js
868
B
-rw-r--r--
user-plus-DVissIdY.js
868
B
-rw-r--r--
user-plus-DoawIM15--VPezORf.js
867
B
-rw-r--r--
user-plus-DoawIM15.js
868
B
-rw-r--r--
user-round-CppNcdCW-BRXg1PZR.j...
1.54
KB
-rw-r--r--
user-round-CppNcdCW.js
1.55
KB
-rw-r--r--
user-round-D64-Xj15.js
1.15
KB
-rw-r--r--
user-round-DU-BBHF0.js
1.55
KB
-rw-r--r--
x-BmeVBLEj.js
334
B
-rw-r--r--
x-COYnIX-z-_goiIEX7.js
343
B
-rw-r--r--
x-COYnIX-z.js
334
B
-rw-r--r--
x-DgvKnt-9.js
334
B
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : AdminPanelPage-BKaudkeA.js
import{r as n,c as v,j as e,u as ct,b as ot,L as ue}from"./index-Bz4UyWnK.js";import{u as mt,M as Me,W as st,R as xt,O as pt}from"./usePortalSocket-DaFfMY0_.js";import{B as X,A as Te}from"./Button-D2wDOozD.js";import{L as $}from"./loader-circle-IEDYPIER.js";import{U as ut,S as ht,L as qe}from"./user-round-CppNcdCW.js";import{C as fe}from"./credit-card-Cd-r6u3q.js";import{C as We}from"./circle-check-CTBPBmCf.js";import{c as T}from"./createLucideIcon-9GDfkjCp.js";import{L as bt,S as ke}from"./shopping-bag-DdF-XavL.js";import{C as ge}from"./clock-3-Cu3htX6m.js";import{M as Ee}from"./mail-BJu8buSm.js";import{S as gt}from"./settings-Biipnq-T.js";import{E as Ke}from"./eye-C03LuO7d.js";import{A as ft}from"./arrow-right-DF_6IH5_.js";import{X as yt}from"./x-COYnIX-z.js";/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jt=T("ChevronsUp",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nt=T("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wt=T("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ve=T("ImagePlus",[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Oe=T("Images",[["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"m22 13-1.296-1.296a2.41 2.41 0 0 0-3.408 0L11 18",key:"nf6bnh"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["rect",{width:"16",height:"16",x:"6",y:"2",rx:"2",key:"12espp"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kt=T("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vt=T("MonitorPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const St=T("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pe=T("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ct=T("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pt=T("TimerOff",[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M4.6 11a8 8 0 0 0 1.7 8.7 8 8 0 0 0 8.7 1.7",key:"10he05"}],["path",{d:"M7.4 7.4a8 8 0 0 1 10.3 1 8 8 0 0 1 .9 10.2",key:"15f7sh"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M12 12v-2",key:"fwoke6"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fe=T("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const At=T("UserCheck",[["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"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Je=T("UserCog",[["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m21.7 16.4-.9-.3",key:"12j9ji"}],["path",{d:"m15.2 13.9-.9-.3",key:"1fdjdi"}],["path",{d:"m16.6 18.7.3-.9",key:"heedtr"}],["path",{d:"m19.1 12.2.3-.9",key:"1af3ki"}],["path",{d:"m19.6 18.7-.4-1",key:"1x9vze"}],["path",{d:"m16.8 12.3-.4-1",key:"vqeiwj"}],["path",{d:"m14.3 16.6 1-.4",key:"1qlj63"}],["path",{d:"m20.7 13.8 1-.4",key:"1v5t8k"}]]);/** * @license lucide-react v0.468.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const De=T("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"}]]);function It(t){return t==null||t===""?"Not priced":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(t)}function Ae(t){return t?new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(t)):"No date"}function he(t){return{pending_review:"Pending review",awaiting_payment:"Payment process",completed:"Finished",active:"Active",cancelled:"Cancelled",expired:"Expired"}[t]||t}function Ie(t){return{pending_review:"border-amber-200 bg-amber-50 text-amber-800",awaiting_payment:"border-cyan-200 bg-cyan-50 text-cyan-800",completed:"border-emerald-200 bg-emerald-50 text-emerald-800",active:"border-emerald-200 bg-emerald-50 text-emerald-800",cancelled:"border-slate-200 bg-slate-50 text-slate-600",expired:"border-red-200 bg-red-50 text-red-700"}[t]||"border-slate-200 bg-slate-50 text-slate-700"}function Ue(t,l){return(t.some(p=>p.id===l.id)?t.map(p=>p.id===l.id?{...p,...l}:p):[l,...t]).sort((p,g)=>new Date(g.updatedAt||g.createdAt)-new Date(p.updatedAt||p.createdAt))}function Ge(t,l){return t.filter(o=>o.id!==l)}function Qe(t,l){const o=t.messages||[];return o.some(x=>x.id===l.id)?t:{...t,messages:[...o,l],updatedAt:l.createdAt}}function Ut(t){var o,x;const l=(t==null?void 0:t.formData)||{};return[["Client",`${((o=t==null?void 0:t.client)==null?void 0:o.name)||"Client"} - ${((x=t==null?void 0:t.client)==null?void 0:x.email)||""}`],["Project",l.projectName],["Business",l.businessType],["Timeline",l.timeline],["Budget",l.budgetRange],["Contact",l.contactPreference]].filter(([,p])=>p)}function zt(t){return`${(t==null?void 0:t.userId)||""}:${(t==null?void 0:t.productId)||""}`}function Mt(t){return(t==null?void 0:t.status)==="completed"||!!(t!=null&&t.paidAt||t!=null&&t.deliveryUnlockedAt)}function we(t,l){return Mt(t)&&l.get(zt(t))||null}function Tt(t){var o,x,p;const l=(t==null?void 0:t.formData)||{};return[(o=t==null?void 0:t.product)==null?void 0:o.title,(x=t==null?void 0:t.client)==null?void 0:x.name,(p=t==null?void 0:t.client)==null?void 0:p.email,l.projectName,l.businessType,l.budgetRange,l.contactPreference].filter(Boolean).join(" ").toLowerCase()}function Et({user:t}){var Ne,pe;const[l,o]=n.useState([]),[x,p]=n.useState(""),[g,N]=n.useState(null),[S,P]=n.useState([]),[U,k]=n.useState("all"),[M,L]=n.useState(""),[_,K]=n.useState(!0),[te,ie]=n.useState(""),[R,A]=n.useState(""),[V,f]=n.useState(""),[J,F]=n.useState(""),[ve,m]=n.useState(()=>new Set),[re,de]=n.useState(!1),[Se,ce]=n.useState({}),q=n.useRef({}),I=n.useMemo(()=>l.filter(s=>s.status==="pending_review").length,[l]),C=n.useMemo(()=>l.filter(s=>s.status==="awaiting_payment").length,[l]),oe=n.useMemo(()=>l.filter(s=>s.status==="completed").length,[l]),me=n.useMemo(()=>S.filter(s=>s.status==="active").length,[S]),le=n.useMemo(()=>S.filter(s=>s.status==="expired").length,[S]),G=n.useMemo(()=>new Map(S.map(s=>[`${s.userId}:${s.productId}`,s])),[S]),xe=n.useMemo(()=>l.filter(s=>!!we(s,G)).length,[l,G]),u=n.useMemo(()=>{const s=M.trim().toLowerCase();return l.filter(d=>{const c=we(d,G),b=U==="all"||U==="pending"&&d.status==="pending_review"||U==="payment"&&d.status==="awaiting_payment"||U==="finished"&&d.status==="completed"||U==="subscription"&&!!c,y=!s||Tt(d).includes(s);return b&&y})},[U,l,M,G]),D=g?we(g,G):null,ye=[["all","All",l.length],["pending","Pending",I],["payment","Payment process",C],["finished","Finished",oe],["subscription","Subscription",xe]],w=n.useCallback(async(s={})=>{const d=(s==null?void 0:s.silent)===!0;d||(K(!0),f(""),F(""));try{const[c,b]=await Promise.all([v("/api/admin/orders"),v("/api/admin/subscriptions")]),y=c.orders||[];o(y),P(b.subscriptions||[]),p(W=>{var ae;return y.some(Ce=>Ce.id===W)?W:((ae=y[0])==null?void 0:ae.id)||""})}catch(c){d||f(c.message)}finally{d||K(!1)}},[]),Y=n.useCallback(async(s,d={})=>{if(!s){N(null);return}try{const c=await v(`/api/admin/orders/${s}`);N(c.order),o(b=>Ue(b,c.order)),(d==null?void 0:d.preservePrice)!==!0&&ie(c.order.negotiatedPrice||"")}catch(c){(d==null?void 0:d.silent)!==!0&&f(c.message)}},[]),Z=n.useCallback((s,d)=>{ce(c=>{const b={...c[s]||{}};if(delete b[d],Object.keys(b).length===0){const y={...c};return delete y[s],y}return{...c,[s]:b}})},[]),Q=n.useCallback((s,d)=>{var y;const c=(y=s.payload)==null?void 0:y.user;if(!s.orderId||!(c!=null&&c.id)||c.id===(t==null?void 0:t.id))return;const b=`${s.orderId}:${c.id}`;if(window.clearTimeout(q.current[b]),!d){delete q.current[b],Z(s.orderId,c.id);return}ce(W=>({...W,[s.orderId]:{...W[s.orderId]||{},[c.id]:c.name||"Client"}})),q.current[b]=window.setTimeout(()=>{delete q.current[b],Z(s.orderId,c.id)},3200)},[Z,t==null?void 0:t.id]),E=n.useCallback(s=>{var d,c;if(s.type==="connected"&&m(new Set(((d=s.payload)==null?void 0:d.onlineUserIds)||[])),s.type==="presence.updated"&&m(b=>{var W,ae;const y=new Set(b);return(W=s.payload)!=null&&W.online?y.add(s.payload.userId):y.delete((ae=s.payload)==null?void 0:ae.userId),y}),(s.type==="order.created"||s.type==="order.updated")&&(o(b=>Ue(b,s.payload.order)),s.orderId===x&&(N(s.payload.order),Y(s.orderId))),s.type==="order.deleted"){const b=((c=s.payload)==null?void 0:c.orderId)||s.orderId;o(y=>Ge(y,b)),N(y=>(y==null?void 0:y.id)===b?null:y),p(y=>y===b?"":y)}s.type==="chat.message"&&s.orderId===x&&N(b=>b&&Qe(b,s.payload.message)),s.type==="subscription.updated"&&w(),s.type==="typing.start"&&Q(s,!0),s.type==="typing.stop"&&Q(s,!1)},[w,Y,Q,x]),{connected:se,sendJson:H}=mt(!!t,E);n.useEffect(()=>{if(!t)return;let s=!1;async function d(){var b;try{const y=await v("/api/admin/presence",{method:"POST",body:JSON.stringify({})});s||(de(!0),m(new Set(((b=y.presence)==null?void 0:b.onlineUserIds)||[])))}catch{s||de(!1)}}d();const c=window.setInterval(d,2e4);return()=>{s=!0,window.clearInterval(c)}},[t]),n.useEffect(()=>{if(!t||se)return;const s=window.setInterval(()=>{w({silent:!0}),x&&Y(x,{preservePrice:!0,silent:!0})},3500);return()=>window.clearInterval(s)},[w,Y,x,se,t]),n.useEffect(()=>()=>{Object.values(q.current).forEach(s=>window.clearTimeout(s)),q.current={}},[]),n.useEffect(()=>{w()},[w]),n.useEffect(()=>{Y(x)},[Y,x]),n.useEffect(()=>{if(!_){if(u.length===0){x&&p("");return}u.some(s=>s.id===x)||p(u[0].id)}},[u,_,x]);async function B(s){if(s.preventDefault(),!!g){A("complete"),f(""),F("");try{const d=await v(`/api/admin/orders/${g.id}/complete-work`,{method:"POST",body:JSON.stringify({negotiatedPrice:te})});N(d.order),o(c=>Ue(c,d.order)),F("Order price saved and payment action is ready for the client.")}catch(d){f(d.message)}finally{A("")}}}async function je(){if(!g||!window.confirm("Are you sure you want to delete this order? This cannot be undone."))return;const d=g.id;A("delete"),f(""),F("");try{await v(`/api/admin/orders/${d}`,{method:"DELETE"}),o(c=>Ge(c,d)),N(null),p(""),F("Order deleted.")}catch(c){f(c.message)}finally{A("")}}return _?e.jsx("section",{className:"mx-auto grid max-w-[1500px] place-items-center px-4 pb-10 sm:px-6 lg:px-8",children:e.jsx("div",{className:"rounded-lg border border-slate-200 bg-white p-8 shadow-xl",children:e.jsx($,{className:"animate-spin text-cyan-700","aria-hidden":"true"})})}):e.jsxs("section",{className:"mx-auto max-w-[1500px] px-4 pb-10 sm:px-6 lg:px-8",children:[e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 xl:grid-cols-5",children:[["Incoming orders",l.length,Me],["Pending review",I,ut],["Payment process",C,fe],["Finished",oe,We],["Active packages",me,st]].map(([s,d,c])=>e.jsxs("div",{className:"rounded-lg border border-slate-200 bg-white p-4 shadow-sm",children:[e.jsxs("span",{className:"inline-flex items-center gap-2 text-xs font-black uppercase text-slate-500",children:[e.jsx(c,{size:15,"aria-hidden":"true"}),s]}),e.jsx("strong",{className:"mt-2 block text-3xl font-black text-slate-950",children:d})]},s))}),e.jsx("div",{className:"mt-5 rounded-lg border border-slate-200 bg-white p-4 shadow-sm",children:e.jsxs("div",{className:"flex flex-col gap-3 xl:flex-row xl:items-center xl:justify-between",children:[e.jsx("div",{className:"grid grid-cols-2 gap-2 sm:flex sm:flex-wrap",children:ye.map(([s,d,c])=>e.jsxs("button",{type:"button",onClick:()=>k(s),className:`inline-flex min-h-10 items-center justify-center gap-2 rounded-md border px-3 text-xs font-black transition ${U===s?"border-slate-950 bg-slate-950 text-white":"border-slate-300 bg-white text-slate-700 hover:border-cyan-600 hover:text-cyan-800"}`,children:[e.jsx("span",{children:d}),e.jsx("span",{className:`rounded-full px-2 py-0.5 ${U===s?"bg-white/15 text-white":"bg-slate-100 text-slate-600"}`,children:c})]},s))}),e.jsxs("label",{className:"relative block w-full xl:max-w-sm",children:[e.jsx(Ct,{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-slate-400",size:16,"aria-hidden":"true"}),e.jsx("input",{value:M,onChange:s=>L(s.target.value),className:"h-11 w-full rounded-md border border-slate-300 bg-white pl-9 pr-3 text-sm font-semibold text-slate-800",placeholder:"Search client, product, project"})]})]})}),e.jsxs("div",{className:"mt-5 grid gap-6 xl:grid-cols-[340px_minmax(0,1fr)] 2xl:grid-cols-[380px_minmax(0,1fr)]",children:[e.jsxs("aside",{className:"rounded-lg border border-slate-200 bg-white p-4 shadow-xl shadow-slate-200/70",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("span",{className:"inline-flex items-center gap-2 text-sm font-black uppercase text-cyan-800",children:[e.jsx(Me,{size:16,"aria-hidden":"true"}),"Orders (",u.length,")"]}),e.jsx("button",{type:"button",onClick:w,className:"grid h-9 w-9 place-items-center rounded-md border border-slate-300 text-slate-700 transition hover:border-slate-500","aria-label":"Refresh orders",children:e.jsx(xt,{size:15,"aria-hidden":"true"})})]}),e.jsxs("div",{className:"mt-4 grid max-h-[720px] gap-3 overflow-y-auto",children:[u.map(s=>{var c,b,y;const d=we(s,G);return e.jsxs("button",{type:"button",onClick:()=>p(s.id),className:`w-full rounded-lg border p-3 text-left transition ${x===s.id?"border-cyan-500 bg-cyan-50":"border-slate-200 bg-white hover:border-slate-400"}`,children:[e.jsx("span",{className:"clamp-2 block text-sm font-black leading-5 text-slate-950",children:(c=s.product)==null?void 0:c.title}),e.jsxs("span",{className:"mt-1 block truncate text-xs font-semibold text-slate-600",children:[(b=s.client)==null?void 0:b.name," - ",(y=s.client)==null?void 0:y.email]}),e.jsx("span",{className:`mt-2 inline-flex rounded-full border px-2 py-1 text-xs font-black uppercase ${Ie(s.status)}`,children:he(s.status)}),d&&e.jsxs("span",{className:"ml-2 mt-2 inline-flex rounded-full border border-violet-200 bg-violet-50 px-2 py-1 text-xs font-black uppercase text-violet-800",children:["Subscription ",he(d.status)]})]},s.id)}),u.length===0&&e.jsx("div",{className:"rounded-lg border border-slate-200 bg-slate-50 p-5 text-sm font-semibold text-slate-600",children:"No orders match this filter."})]})]}),e.jsxs("section",{className:"min-w-0 overflow-hidden rounded-lg border border-slate-200 bg-white shadow-xl shadow-slate-200/70",children:[!g&&e.jsx("div",{className:"p-6 text-sm font-semibold text-slate-600",children:"Select an order to open the consultation workspace."}),g&&e.jsxs("div",{className:"grid min-h-[720px] xl:grid-cols-[340px_minmax(0,1fr)]",children:[e.jsxs("aside",{className:"border-b border-slate-200 p-5 lg:border-b-0 lg:border-r",children:[e.jsx("span",{className:`inline-flex rounded-full border px-3 py-1 text-xs font-black uppercase ${Ie(g.status)}`,children:he(g.status)}),e.jsx("h2",{className:"mt-4 text-2xl font-black leading-tight text-slate-950",children:(Ne=g.product)==null?void 0:Ne.title}),e.jsxs("p",{className:"mt-2 text-sm font-semibold text-slate-600",children:["Submitted ",Ae(g.createdAt)]}),e.jsx("div",{className:"mt-5 grid gap-3",children:Ut(g).map(([s,d])=>e.jsxs("div",{className:"rounded-lg border border-slate-200 bg-slate-50 p-3",children:[e.jsx("span",{className:"block text-xs font-black uppercase text-slate-500",children:s}),e.jsx("span",{className:"mt-1 block break-words text-sm font-semibold text-slate-800",children:d})]},s))}),e.jsxs("div",{className:"mt-4 rounded-lg border border-slate-200 p-3",children:[e.jsx("span",{className:"block text-xs font-black uppercase text-slate-500",children:"Negotiated price"}),e.jsx("strong",{className:"mt-1 block text-2xl font-black text-slate-950",children:It(g.negotiatedPrice)})]}),e.jsxs("button",{type:"button",onClick:je,disabled:R==="delete",className:"mt-4 inline-flex min-h-11 w-full items-center justify-center gap-2 rounded-md border border-red-200 px-3 text-sm font-black text-red-700 transition hover:bg-red-50 disabled:opacity-60",children:[R==="delete"?e.jsx($,{className:"animate-spin",size:16,"aria-hidden":"true"}):e.jsx(Fe,{size:16,"aria-hidden":"true"}),"Delete Order"]}),D&&e.jsxs("div",{className:"mt-4 rounded-lg border border-violet-200 bg-violet-50 p-3",children:[e.jsx("span",{className:"block text-xs font-black uppercase text-violet-700",children:"Management subscription"}),e.jsx("strong",{className:"mt-1 block text-sm font-black text-violet-950",children:he(D.status)}),e.jsx("p",{className:"mt-1 text-xs font-semibold uppercase text-violet-700",children:D.provider||"Provider pending"}),D.status==="active"&&e.jsxs("p",{className:"mt-1 text-xs font-black uppercase text-violet-700",children:[D.daysRemaining," day",D.daysRemaining===1?"":"s"," left"]}),D.expiresAt&&e.jsxs("p",{className:"mt-1 text-xs font-semibold text-violet-700",children:["Expires ",Ae(D.expiresAt)]})]})]}),e.jsx(pt,{order:g,currentUser:t,title:"Client chat",placeholder:"Message the client",counterpartLabel:((pe=g.client)==null?void 0:pe.name)||"Client",counterpartOnline:ve.has(g.userId),counterpartStatus:"Online now",typingUsers:Object.values(Se[g.id]||{}),socketConnected:se||re,sendSocketEvent:H,messageEndpoint:s=>`/api/admin/orders/${s}/messages`,onMessageSent:s=>N(d=>d&&Qe(d,s)),minHeightClass:"h-[620px] max-h-[calc(100vh-120px)] sm:h-[680px] xl:h-[720px] xl:max-h-none",actionBar:e.jsxs("form",{onSubmit:B,className:"grid gap-3 border-t border-cyan-200 bg-cyan-50 p-4 md:grid-cols-[1fr_auto] md:items-end",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1 block text-xs font-black uppercase text-cyan-900",children:"Final negotiated price"}),e.jsx("input",{type:"number",min:"1",step:"1",value:te,onChange:s=>ie(s.target.value),className:"h-11 w-full rounded-md border border-cyan-200 px-3 text-sm",required:!0})]}),e.jsxs(X,{type:"submit",className:"rounded-xl bg-slate-950 hover:bg-slate-800",disabled:R==="complete",children:[R==="complete"?e.jsx($,{className:"animate-spin",size:17,"aria-hidden":"true"}):e.jsx(fe,{size:17,"aria-hidden":"true"}),"Complete Work"]})]})})]})]})]}),e.jsxs("section",{className:"mt-6 rounded-lg border border-slate-200 bg-white p-5 shadow-sm",children:[e.jsxs("span",{className:"inline-flex items-center gap-2 text-sm font-black uppercase text-cyan-800",children:[e.jsx(We,{size:16,"aria-hidden":"true"}),"Monthly management packages"]}),e.jsx("div",{className:"mt-3 grid gap-3 sm:grid-cols-3",children:[["All packages",S.length],["Active",me],["Expired",le]].map(([s,d])=>e.jsxs("div",{className:"rounded-lg border border-slate-200 bg-slate-50 p-3",children:[e.jsx("span",{className:"block text-xs font-black uppercase text-slate-500",children:s}),e.jsx("strong",{className:"mt-1 block text-2xl font-black text-slate-950",children:d})]},s))}),e.jsxs("div",{className:"mt-4 grid gap-3",children:[S.map(s=>{var d,c,b;return e.jsxs("div",{className:"grid gap-2 rounded-lg border border-slate-200 p-3 md:grid-cols-[1fr_auto] md:items-center",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-black text-slate-950",children:(d=s.product)==null?void 0:d.title}),e.jsxs("p",{className:"mt-1 text-sm text-slate-600",children:[(c=s.client)==null?void 0:c.name," - ",(b=s.client)==null?void 0:b.email]}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-2 text-xs font-black uppercase text-slate-500",children:[e.jsx("span",{children:s.provider||"Provider pending"}),s.status==="active"&&e.jsxs("span",{children:[s.daysRemaining," day",s.daysRemaining===1?"":"s"," left"]}),s.expiresAt&&e.jsxs("span",{children:["Expires ",Ae(s.expiresAt)]})]})]}),e.jsx("span",{className:`inline-flex w-fit rounded-full border px-3 py-1 text-xs font-black uppercase ${Ie(s.status)}`,children:he(s.status)})]},s.id)}),S.length===0&&e.jsx("div",{className:"rounded-lg border border-slate-200 bg-slate-50 p-5 text-sm font-semibold text-slate-600",children:"No management subscriptions yet."})]})]}),(V||J)&&e.jsx("div",{className:`mt-4 rounded-lg border p-4 text-sm font-semibold ${V?"border-red-200 bg-red-50 text-red-700":"border-emerald-200 bg-emerald-50 text-emerald-800"}`,children:V||J})]})}const Xe={title:"",category:"SOFTWARE",price:50,defaultSubscriptionPrice:99,assetsUrl:"",description:"",screenshots:[],demoFrontendUrl:"",demoAdminUrl:"",demoUsername:"store-demo-admin",demoEmail:"store.admin@example.com",demoPassword:"StoreAdmin#48"},Ot=[["SOFTWARE","Software"],["WEBSITE","Website"]];function $e(t){return t==="WEBSITE"?"WEBSITE":"SOFTWARE"}const Le={appName:"Signalhg Tech",currency:"usd",paypal:{enabled:!1,environment:"live",clientId:"",clientSecret:"",hasClientSecret:!1,configured:!1},stripe:{enabled:!1,secretKey:"",webhookSecret:"",hasSecretKey:!1,hasWebhookSecret:!1,configured:!1}},Ft=[["products","Products",ke],["orders","Orders",Me],["messages","Messages",Ee],["payments","Payments",fe],["homepage","Home Images",Oe],["users","Users",De],["timing","Timing",ge]];function Dt(t){var l,o,x,p,g;return{title:(t==null?void 0:t.title)||"",category:$e(t==null?void 0:t.category),price:(t==null?void 0:t.price)??0,defaultSubscriptionPrice:(t==null?void 0:t.defaultSubscriptionPrice)??0,assetsUrl:(t==null?void 0:t.assetsUrl)||"",description:(t==null?void 0:t.description)||"",screenshots:(t==null?void 0:t.screenshots)||[],demoFrontendUrl:((l=t==null?void 0:t.demoConfig)==null?void 0:l.demoFrontendUrl)||"",demoAdminUrl:((o=t==null?void 0:t.demoConfig)==null?void 0:o.demoAdminUrl)||"",demoUsername:((x=t==null?void 0:t.demoConfig)==null?void 0:x.demoUsername)||"store-demo-admin",demoEmail:((p=t==null?void 0:t.demoConfig)==null?void 0:p.demoEmail)||"store.admin@example.com",demoPassword:((g=t==null?void 0:t.demoConfig)==null?void 0:g.demoPassword)||"StoreAdmin#48"}}function Ye(t){var l,o,x,p,g,N,S,P,U;return{appName:(t==null?void 0:t.appName)||Le.appName,currency:(t==null?void 0:t.currency)||Le.currency,paypal:{enabled:!!((l=t==null?void 0:t.paypal)!=null&&l.enabled),environment:((o=t==null?void 0:t.paypal)==null?void 0:o.environment)||"live",clientId:((x=t==null?void 0:t.paypal)==null?void 0:x.clientId)||"",clientSecret:"",hasClientSecret:!!((p=t==null?void 0:t.paypal)!=null&&p.hasClientSecret),configured:!!((g=t==null?void 0:t.paypal)!=null&&g.configured)},stripe:{enabled:!!((N=t==null?void 0:t.stripe)!=null&&N.enabled),secretKey:"",webhookSecret:"",hasSecretKey:!!((S=t==null?void 0:t.stripe)!=null&&S.hasSecretKey),hasWebhookSecret:!!((P=t==null?void 0:t.stripe)!=null&&P.hasWebhookSecret),configured:!!((U=t==null?void 0:t.stripe)!=null&&U.configured)}}}function $t(t){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(t||0)}function Ze(t){return t?new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(t)):"No date"}function be(t){var x,p,g;const l=(g=(p=(x=t==null?void 0:t.payload)==null?void 0:x.error)==null?void 0:p.details)==null?void 0:g.fieldErrors,o=l?Object.entries(l).flatMap(([N,S])=>(S||[]).map(P=>`${N}: ${P}`)).filter(Boolean):[];return o.length?o.join(" "):t.message}function Lt(t){return t.isActive&&!t.isExpired?"Active":"Inactive"}function et({label:t,busy:l,onFiles:o}){return e.jsxs("label",{className:`flex min-h-32 flex-col items-center justify-center rounded-lg border-2 border-dashed border-cyan-200 bg-cyan-50/60 p-5 text-center transition hover:border-cyan-500 hover:bg-cyan-50 ${l?"cursor-wait opacity-80":"cursor-pointer"}`,children:[e.jsx("input",{type:"file",accept:"image/jpeg,image/png,image/webp,image/gif,image/avif",multiple:!0,disabled:l,className:"sr-only",onChange:x=>{o(x.target.files),x.target.value=""}}),e.jsx("span",{className:"grid h-12 w-12 place-items-center rounded-full bg-cyan-700 text-white",children:l?e.jsx($,{className:"animate-spin",size:22,"aria-hidden":"true"}):e.jsx(Nt,{size:22,"aria-hidden":"true"})}),e.jsx("span",{className:"mt-3 text-sm font-black text-slate-950",children:l?"Uploading...":t}),e.jsx("span",{className:"mt-1 text-xs font-bold text-slate-500",children:"JPG, PNG, WebP, GIF, or AVIF"})]})}function Rt(t,l,o){if(l===o||l<0||o<0||l>=t.length||o>=t.length)return t;const x=[...t],[p]=x.splice(l,1);return x.splice(o,0,p),x}function ze({children:t,disabled:l,label:o,onClick:x}){return e.jsx("button",{type:"button",onClick:x,disabled:l,title:o,className:"grid h-8 w-8 place-items-center rounded-full bg-white/95 text-slate-800 shadow-lg transition hover:bg-cyan-700 hover:text-white disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-white/95 disabled:hover:text-slate-800","aria-label":o,children:t})}function tt({images:t,onRemove:l,onMove:o,emptyText:x,fit:p="contain"}){const[g,N]=n.useState(null);if(!t.length)return e.jsx("div",{className:"rounded-lg border border-slate-200 bg-slate-50 p-5 text-sm font-semibold text-slate-600",children:x});const S=p==="cover"?"aspect-[4/3] w-full object-cover":"aspect-[16/10] w-full object-contain p-2",P=!!o&&t.length>1;return e.jsx("div",{className:"grid grid-cols-2 gap-3 md:grid-cols-3",children:t.map((U,k)=>e.jsxs("figure",{draggable:P,onDragStart:M=>{P&&(N(k),M.dataTransfer.effectAllowed="move",M.dataTransfer.setData("text/plain",String(k)))},onDragOver:M=>{P&&M.preventDefault()},onDrop:M=>{if(!P)return;M.preventDefault();const L=M.dataTransfer.getData("text/plain"),_=L===""?g:Number(L);Number.isInteger(_)&&o(_,k),N(null)},onDragEnd:()=>N(null),className:`group relative overflow-hidden rounded-lg border bg-slate-100 transition ${g===k?"border-cyan-600 opacity-70 ring-2 ring-cyan-100":"border-slate-200"} ${P?"cursor-grab active:cursor-grabbing":""}`,children:[e.jsx("img",{src:U,alt:"",className:S}),k===0&&e.jsx("span",{className:"absolute left-2 top-2 rounded-full bg-cyan-700 px-2.5 py-1 text-xs font-black text-white shadow-lg",children:"Primary"}),P&&e.jsxs("div",{className:"absolute bottom-2 left-2 flex items-center gap-1.5 opacity-100 transition md:opacity-0 md:group-hover:opacity-100",children:[e.jsx("span",{title:"Drag to reorder",className:"grid h-8 w-8 place-items-center rounded-full bg-slate-950/85 text-white shadow-lg","aria-hidden":"true",children:e.jsx(wt,{size:15})}),e.jsx(ze,{label:"Move image to first",disabled:k===0,onClick:()=>o(k,0),children:e.jsx(jt,{size:15,"aria-hidden":"true"})}),e.jsx(ze,{label:"Move image earlier",disabled:k===0,onClick:()=>o(k,k-1),children:e.jsx(Te,{size:15,"aria-hidden":"true"})}),e.jsx(ze,{label:"Move image later",disabled:k===t.length-1,onClick:()=>o(k,k+1),children:e.jsx(ft,{size:15,"aria-hidden":"true"})})]}),e.jsx("button",{type:"button",onClick:()=>l(k),className:"absolute right-2 top-2 grid h-8 w-8 place-items-center rounded-full bg-slate-950/85 text-white opacity-100 shadow-lg transition hover:bg-red-600 md:opacity-0 md:group-hover:opacity-100","aria-label":"Remove image",children:e.jsx(yt,{size:16,"aria-hidden":"true"})})]},`${U}-${k}`))})}function ss(){const t=ct(),{user:l,loading:o,logout:x}=ot(),[p,g]=n.useState("products"),[N,S]=n.useState([]),[P,U]=n.useState([]),[k,M]=n.useState([]),[L,_]=n.useState([]),[K,te]=n.useState([]),[ie,R]=n.useState(""),[A,V]=n.useState(!1),[f,J]=n.useState(Xe),[F,ve]=n.useState({userId:"",productId:"",hours:48}),[m,re]=n.useState(Le),[de,Se]=n.useState({}),[ce,q]=n.useState(!0),[I,C]=n.useState(!1),[oe,me]=n.useState(""),[le,G]=n.useState(""),[xe,u]=n.useState(""),[D,ye]=n.useState(""),w=n.useMemo(()=>N.find(a=>a.id===ie)||N[0]||null,[N,ie]),Y=n.useMemo(()=>k.filter(a=>a.isActive&&!a.isExpired).length,[k]),Z=n.useMemo(()=>L.filter(a=>!a.isRead).length,[L]),Q=n.useCallback(async()=>{var a;if(o||!l||l.role!=="ADMIN"){q(!1);return}q(!0);try{const[r,i,h,j,z,O]=await Promise.all([v("/api/admin/products"),v("/api/admin/homepage"),v("/api/admin/users"),v("/api/admin/demo-sessions"),v("/api/admin/payment-settings"),v("/api/admin/contact-messages")]),ee=(r==null?void 0:r.products)||[],ne=((a=i==null?void 0:i.homepage)==null?void 0:a.images)||[];S(ee),te(ne),U((h==null?void 0:h.users)||[]),M((j==null?void 0:j.sessions)||[]),_((O==null?void 0:O.submissions)||[]),re(Ye(z==null?void 0:z.payment)),R(Be=>{var _e;return ee.some(dt=>dt.id===Be)?Be:((_e=ee[0])==null?void 0:_e.id)||""}),V(ee.length===0),u("")}catch(r){u(r.message)}finally{q(!1)}},[o,l]);n.useEffect(()=>{Q()},[Q]),n.useEffect(()=>{!A&&w&&(R(w.id),J(Dt(w)))},[A,w==null?void 0:w.id]);function E(a){const{name:r,value:i}=a.target;J(h=>({...h,[r]:i}))}function se(a){const{name:r,value:i}=a.target;ve(h=>({...h,[r]:i}))}function H(a){const{name:r,type:i,checked:h,value:j}=a.target,z=i==="checkbox"?h:j;if(!r.includes(".")){re(ne=>({...ne,[r]:z}));return}const[O,ee]=r.split(".");re(ne=>({...ne,[O]:{...ne[O],[ee]:z}}))}function B(a){ye(a),window.setTimeout(()=>ye(""),2400)}function je(){V(!0),R(""),J(Xe),g("products"),u("")}function Ne(a){V(!1),R(a),u("")}async function pe(){await x(),t("/")}async function s(a,r,i){const h=Array.from(r||[]);if(h.length===0)return;const j=new FormData;h.forEach(z=>j.append("images",z)),me(a),u("");try{const O=((await v(`/api/admin/uploads?scope=${a}`,{method:"POST",body:j})).images||[]).map(ee=>ee.url);i(O),B(`${O.length} image${O.length===1?"":"s"} uploaded.`)}catch(z){u(z.message)}finally{me("")}}function d(a){J(r=>({...r,screenshots:r.screenshots.filter((i,h)=>h!==a)}))}function c(a,r){J(i=>({...i,screenshots:Rt(i.screenshots,a,r)}))}function b(a){te(r=>r.filter((i,h)=>h!==a))}function y(a){const r=Array.from(a||[]),i=12-f.screenshots.length;if(i<=0){u("Each product can have up to 12 images.");return}s("products",r.slice(0,i),h=>J(j=>({...j,screenshots:[...j.screenshots,...h]})))}function W(a){const r=Array.from(a||[]),i=40-K.length;if(i<=0){u("The homepage can have up to 40 background images.");return}s("homepage",r.slice(0,i),h=>te(j=>[...j,...h]))}async function ae(a){a.preventDefault();const r=f.screenshots;if(r.length===0){u("Upload at least one product image before saving.");return}const i=Number(f.price);if(!Number.isFinite(i)||i<0){u("Enter a valid product price.");return}const h=Number(f.defaultSubscriptionPrice);if(!Number.isFinite(h)||h<0){u("Enter a valid monthly management price.");return}C(!0),u("");try{const j=await v(A?"/api/admin/products":`/api/admin/products/${w.id}`,{method:A?"POST":"PATCH",body:JSON.stringify({title:f.title.trim(),category:$e(f.category),price:i,defaultSubscriptionPrice:h,assetsUrl:f.assetsUrl.trim(),description:f.description.trim(),screenshots:r,demoFrontendUrl:f.demoFrontendUrl.trim(),demoAdminUrl:f.demoAdminUrl.trim(),demoUsername:f.demoUsername.trim(),demoEmail:f.demoEmail.trim(),demoPassword:f.demoPassword})});S(z=>A?[...z,j.product]:z.map(O=>O.id===j.product.id?j.product:O)),V(!1),R(j.product.id),B(A?"Product added.":"Product saved.")}catch(j){u(be(j))}finally{C(!1)}}async function Ce(){var a;if(!(!w||!window.confirm(`Delete ${w.title}?`))){C(!0),u("");try{await v(`/api/admin/products/${w.id}`,{method:"DELETE"});const r=N.filter(i=>i.id!==w.id);S(r),R(((a=r[0])==null?void 0:a.id)||""),V(r.length===0),B("Product deleted.")}catch(r){u(be(r))}finally{C(!1)}}}async function at(a,r){C(!0),u("");try{const i=await v(`/api/admin/contact-messages/${a}`,{method:"PATCH",body:JSON.stringify({isRead:r})});_(h=>h.map(j=>j.id===i.submission.id?i.submission:j)),B(r?"Message marked read.":"Message marked unread.")}catch(i){u(be(i))}finally{C(!1)}}async function rt(a){const r=L.find(i=>i.id===a);if(!(!r||!window.confirm(`Delete message from ${r.name}?`))){C(!0),u("");try{await v(`/api/admin/contact-messages/${a}`,{method:"DELETE"}),_(i=>i.filter(h=>h.id!==a)),B("Message deleted.")}catch(i){u(be(i))}finally{C(!1)}}}async function lt(a){if(a.preventDefault(),K.length===0){u("Upload at least one homepage background image before saving.");return}C(!0),u("");try{const r=await v("/api/admin/homepage",{method:"PATCH",body:JSON.stringify({images:K})});te(r.homepage.images),B("Homepage background images saved.")}catch(r){u(r.message)}finally{C(!1)}}async function nt(a){a.preventDefault();const r=m.paypal.clientSecret.trim()||m.paypal.hasClientSecret,i=m.stripe.secretKey.trim()||m.stripe.hasSecretKey;if(m.paypal.enabled&&(!m.paypal.clientId.trim()||!r)){u("Add the PayPal client ID and secret before enabling PayPal.");return}if(m.stripe.enabled&&!i){u("Add the Stripe secret key before enabling Stripe.");return}C(!0),u("");try{const h=await v("/api/admin/payment-settings",{method:"PATCH",body:JSON.stringify({appName:m.appName.trim(),currency:m.currency.trim().toLowerCase(),paypal:{enabled:m.paypal.enabled,environment:m.paypal.environment,clientId:m.paypal.clientId.trim(),clientSecret:m.paypal.clientSecret.trim()},stripe:{enabled:m.stripe.enabled,secretKey:m.stripe.secretKey.trim(),webhookSecret:m.stripe.webhookSecret.trim()}})});re(Ye(h.payment)),B("Payment settings saved.")}catch(h){u(be(h))}finally{C(!1)}}async function Re(a){if(w){G(a),u("");try{const r=await v("/api/demo/activate",{method:"POST",body:JSON.stringify({productId:w.id})});t(`/demo/${r.session.id}?tab=${a}`)}catch(r){u(r.message)}finally{G("")}}}async function it(a){a.preventDefault(),C(!0),u("");try{const r=await v("/api/admin/demo-sessions",{method:"POST",body:JSON.stringify({userId:F.userId,productId:F.productId,hours:Number(F.hours)})});M(i=>i.some(j=>j.id===r.session.id)?i.map(j=>j.id===r.session.id?r.session:j):[r.session,...i]),B("Product timing activated."),Q()}catch(r){u(r.message)}finally{C(!1)}}async function He(a,r){C(!0),u("");try{const i=await v(`/api/admin/demo-sessions/${a.id}`,{method:"PATCH",body:JSON.stringify({action:r,hours:Number(de[a.id]||48)})});M(h=>h.map(j=>j.id===i.session.id?i.session:j)),B(r==="force-expire"?"Timing deactivated.":"Timing reactivated."),Q()}catch(i){u(i.message)}finally{C(!1)}}return o||ce?e.jsx("main",{className:"grid min-h-screen place-items-center bg-slate-950 text-white",children:e.jsx($,{className:"animate-spin","aria-hidden":"true"})}):l?l.role!=="ADMIN"?e.jsx("main",{className:"grid min-h-screen place-items-center bg-[#f5efe6] px-4",children:e.jsxs("section",{className:"w-full max-w-lg rounded-lg border border-slate-200 bg-white p-7 shadow-xl",children:[e.jsx("span",{className:"grid h-14 w-14 place-items-center rounded-full bg-red-100 text-red-700",children:e.jsx(ht,{size:26,"aria-hidden":"true"})}),e.jsx("h1",{className:"mt-5 text-3xl font-black text-slate-950",children:"Admin Access Only"}),e.jsxs("p",{className:"mt-3 text-sm leading-6 text-slate-600",children:["You are logged in as ",l.email,". Please use the administrator account to continue."]}),e.jsxs("div",{className:"mt-6 flex flex-wrap gap-3",children:[e.jsxs(X,{onClick:pe,variant:"danger",className:"rounded-xl",children:[e.jsx(qe,{size:17,"aria-hidden":"true"}),"Logout"]}),e.jsx(ue,{to:"/auth?mode=login&returnTo=/admin",children:e.jsxs(X,{variant:"light",className:"rounded-xl",children:[e.jsx(Je,{size:17,"aria-hidden":"true"}),"Admin Login"]})})]})]})}):e.jsxs("main",{className:"min-h-screen overflow-x-hidden bg-[#f5efe6]",children:[e.jsx("section",{className:"bg-slate-950 px-4 py-6 text-white sm:px-6 sm:py-8 lg:px-8",children:e.jsxs("div",{className:"mx-auto flex max-w-7xl flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs(ue,{to:"/",className:"inline-flex items-center gap-2 text-sm font-bold text-cyan-100 hover:text-white",children:[e.jsx(Te,{size:16,"aria-hidden":"true"}),"Back to Store"]}),e.jsx("h1",{className:"mt-4 text-3xl font-black leading-tight sm:text-5xl",children:"Advanced Admin Panel"}),e.jsx("p",{className:"mt-3 max-w-2xl text-sm leading-6 text-zinc-300",children:"Products, orders, contact messages, payments, homepage images, users, demo credentials, and product timing controls."})]}),e.jsxs("div",{className:"rounded-lg border border-white/15 bg-white/10 p-4 text-sm backdrop-blur",children:[e.jsx("p",{className:"font-black",children:l.name}),e.jsx("p",{className:"text-cyan-100",children:l.email}),e.jsxs("button",{type:"button",onClick:pe,className:"mt-3 inline-flex min-h-9 items-center gap-2 rounded-md border border-white/30 px-3 text-xs font-black transition hover:border-red-200 hover:text-red-100",children:[e.jsx(qe,{size:15,"aria-hidden":"true"}),"Logout"]})]})]})}),e.jsxs("section",{className:"mx-auto max-w-7xl px-4 py-6 sm:px-6 lg:px-8",children:[e.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-5",children:[["Products",N.length,ke],["Users",P.length,De],["Active timing",Y,ge],["Unread messages",Z,Ee],["Home images",K.length,Oe]].map(([a,r,i])=>e.jsxs("div",{className:"rounded-lg border border-slate-200 bg-white p-4 shadow-sm",children:[e.jsxs("span",{className:"inline-flex items-center gap-2 text-xs font-black uppercase text-slate-500",children:[e.jsx(i,{size:15,"aria-hidden":"true"}),a]}),e.jsx("strong",{className:"mt-2 block text-3xl font-black text-slate-950",children:r})]},a))}),e.jsx("div",{className:"mt-5 grid grid-cols-2 gap-2 sm:flex sm:flex-wrap",children:Ft.map(([a,r,i])=>e.jsxs("button",{type:"button",onClick:()=>g(a),className:`inline-flex min-h-11 items-center justify-center gap-2 rounded-md px-3 text-sm font-black transition sm:px-4 ${p===a?"bg-slate-950 text-white":"border border-slate-300 bg-white text-slate-700 hover:border-slate-500"}`,children:[e.jsx(i,{size:16,"aria-hidden":"true"}),r,a==="messages"&&Z>0&&e.jsx("span",{className:`grid h-5 min-w-5 place-items-center rounded-full px-1.5 text-[0.68rem] ${p===a?"bg-white text-slate-950":"bg-cyan-700 text-white"}`,children:Z})]},a))}),(xe||D)&&e.jsxs("div",{className:"mt-5 grid gap-3",children:[xe&&e.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 p-3 text-sm font-semibold text-red-700",children:xe}),D&&e.jsx("div",{className:"rounded-md border border-cyan-200 bg-cyan-50 p-3 text-sm font-semibold text-cyan-800",children:D})]})]}),p==="products"&&e.jsxs("section",{className:"mx-auto grid max-w-screen-2xl gap-6 px-4 pb-10 sm:px-6 lg:grid-cols-[minmax(320px,420px)_minmax(0,1fr)] lg:px-8",children:[e.jsxs("aside",{className:"min-w-0 rounded-lg border border-slate-200 bg-white p-5 shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("span",{className:"inline-flex items-center gap-2 text-sm font-black uppercase text-cyan-800",children:[e.jsx(ke,{size:16,"aria-hidden":"true"}),"Products"]}),e.jsxs("button",{type:"button",onClick:je,className:"inline-flex min-h-9 items-center gap-2 rounded-md bg-cyan-700 px-3 text-xs font-black text-white transition hover:bg-cyan-800",children:[e.jsx(St,{size:15,"aria-hidden":"true"}),"Add"]})]}),e.jsxs("div",{className:"mt-4 space-y-3",children:[N.map(a=>{var r;return e.jsxs("button",{type:"button",onClick:()=>Ne(a.id),className:`flex w-full items-center gap-3 rounded-lg border p-3 text-left transition ${!A&&(w==null?void 0:w.id)===a.id?"border-cyan-700 bg-cyan-50":"border-slate-200 bg-white hover:border-slate-400"}`,children:[e.jsx("img",{src:(r=a.screenshots)==null?void 0:r[0],alt:"",className:"h-14 w-14 rounded-md bg-slate-100 object-contain p-1"}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block truncate text-sm font-black text-slate-950",children:a.title}),e.jsxs("span",{className:"mt-1 flex flex-wrap items-center gap-2 text-xs font-bold text-slate-500",children:[e.jsx("span",{children:$t(a.price)}),e.jsx("span",{className:"rounded-full bg-slate-100 px-2 py-0.5 text-[10px] font-black uppercase text-cyan-800",children:$e(a.category).toLowerCase()})]})]})]},a.id)}),N.length===0&&e.jsxs("button",{type:"button",onClick:je,className:"flex w-full items-center justify-center gap-2 rounded-lg border border-dashed border-cyan-300 bg-cyan-50 p-6 text-sm font-black text-cyan-800",children:[e.jsx(Ve,{size:18,"aria-hidden":"true"}),"Add first product"]})]})]}),e.jsx("section",{className:"min-w-0 rounded-lg border border-slate-200 bg-white p-5 shadow-xl shadow-slate-200/70 sm:p-6",children:(A||w)&&e.jsxs("form",{onSubmit:ae,className:"min-w-0 space-y-5",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("span",{className:"inline-flex items-center gap-2 text-sm font-black uppercase text-cyan-800",children:[e.jsx(gt,{size:16,"aria-hidden":"true"}),A?"Add Product":"Edit Product"]}),e.jsx("h2",{className:"mt-2 break-words text-xl font-black leading-tight text-slate-950 sm:text-2xl",children:A?"New product":w.title})]}),!A&&e.jsxs("div",{className:"grid w-full gap-2 sm:w-auto sm:grid-cols-2",children:[e.jsxs("button",{type:"button",onClick:()=>Re("frontend"),className:"inline-flex min-h-11 items-center justify-center gap-2 rounded-md border border-slate-300 px-4 py-2 text-sm font-black text-slate-950 transition hover:border-cyan-700 hover:text-cyan-800 disabled:opacity-60",disabled:le==="frontend",children:[le==="frontend"?e.jsx($,{className:"animate-spin",size:17,"aria-hidden":"true"}):e.jsx(Ke,{size:17,"aria-hidden":"true"}),"Preview App"]}),e.jsxs("button",{type:"button",onClick:()=>Re("admin"),className:"inline-flex min-h-11 items-center justify-center gap-2 rounded-md bg-slate-950 px-4 py-2 text-sm font-black text-white transition hover:bg-slate-800 disabled:opacity-60",disabled:le==="admin",children:[le==="admin"?e.jsx($,{className:"animate-spin",size:17,"aria-hidden":"true"}):e.jsx(vt,{size:17,"aria-hidden":"true"}),"Preview Admin"]})]})]}),e.jsxs("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1fr)_minmax(140px,180px)_minmax(140px,180px)_minmax(170px,220px)]",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1 block text-sm font-bold text-slate-700",children:"Product title"}),e.jsx("input",{name:"title",value:f.title,onChange:E,className:"h-11 w-full rounded-md border border-slate-300 px-3 text-sm",required:!0})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1 block text-sm font-bold text-slate-700",children:"Category"}),e.jsx("select",{name:"category",value:f.category,onChange:E,className:"h-11 w-full rounded-md border border-slate-300 px-3 text-sm",required:!0,children:Ot.map(([a,r])=>e.jsx("option",{value:a,children:r},a))})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1 block text-sm font-bold text-slate-700",children:"Price"}),e.jsx("input",{type:"number",name:"price",value:f.price,onChange:E,className:"h-11 w-full rounded-md border border-slate-300 px-3 text-sm",min:"0",step:"1",required:!0})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1 block text-sm font-bold text-slate-700",children:"Monthly management"}),e.jsx("input",{type:"number",name:"defaultSubscriptionPrice",value:f.defaultSubscriptionPrice,onChange:E,className:"h-11 w-full rounded-md border border-slate-300 px-3 text-sm",min:"0",step:"1",required:!0})]})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1 block text-sm font-bold text-slate-700",children:"Description"}),e.jsx("textarea",{name:"description",value:f.description,onChange:E,className:"min-h-28 w-full rounded-md border border-slate-300 p-3 text-sm leading-6",required:!0})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("span",{className:"block text-sm font-bold text-slate-700",children:"Product images"}),e.jsx(et,{label:"Upload product images",busy:oe==="products",onFiles:y}),e.jsx(tt,{images:f.screenshots,onRemove:d,onMove:c,emptyText:"No product images uploaded yet."})]}),e.jsxs("div",{className:"rounded-lg border border-slate-200 bg-slate-50 p-4",children:[e.jsxs("span",{className:"inline-flex items-center gap-2 text-sm font-black uppercase text-cyan-800",children:[e.jsx(kt,{size:16,"aria-hidden":"true"}),"Hidden demo links"]}),e.jsxs("div",{className:"mt-4 grid gap-4 xl:grid-cols-3",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1 block text-sm font-bold text-slate-700",children:"Frontend website link"}),e.jsx("input",{type:"url",name:"demoFrontendUrl",value:f.demoFrontendUrl,onChange:E,className:"h-11 w-full rounded-md border border-slate-300 px-3 text-sm",placeholder:"https://example.com"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1 block text-sm font-bold text-slate-700",children:"Admin panel link"}),e.jsx("input",{type:"url",name:"demoAdminUrl",value:f.demoAdminUrl,onChange:E,className:"h-11 w-full rounded-md border border-slate-300 px-3 text-sm",placeholder:"https://example.com/admin"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1 block text-sm font-bold text-slate-700",children:"Delivery assets URL"}),e.jsx("input",{type:"url",name:"assetsUrl",value:f.assetsUrl,onChange:E,className:"h-11 w-full rounded-md border border-slate-300 px-3 text-sm",placeholder:"https://example.com/client-delivery"})]})]})]}),e.jsxs("div",{className:"grid gap-4 xl:grid-cols-3",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1 block text-sm font-bold text-slate-700",children:"Demo username"}),e.jsx("input",{name:"demoUsername",value:f.demoUsername,onChange:E,className:"h-11 w-full rounded-md border border-slate-300 px-3 text-sm",required:!0})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1 block text-sm font-bold text-slate-700",children:"Demo email"}),e.jsx("input",{name:"demoEmail",value:f.demoEmail,onChange:E,className:"h-11 w-full rounded-md border border-slate-300 px-3 text-sm",required:!0})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1 block text-sm font-bold text-slate-700",children:"Demo password"}),e.jsx("input",{name:"demoPassword",value:f.demoPassword,onChange:E,className:"h-11 w-full rounded-md border border-slate-300 px-3 text-sm",required:!0})]})]}),e.jsxs("div",{className:"grid gap-3 sm:flex sm:flex-wrap sm:items-center",children:[e.jsxs(X,{type:"submit",className:"w-full rounded-xl px-6 sm:w-auto",disabled:I,children:[I?e.jsx($,{className:"animate-spin",size:17,"aria-hidden":"true"}):e.jsx(Pe,{size:17,"aria-hidden":"true"}),A?"Create Product":"Save Product"]}),!A&&e.jsxs(e.Fragment,{children:[e.jsxs(ue,{to:`/products/${w.id}`,className:"inline-flex min-h-11 w-full items-center justify-center gap-2 rounded-xl border border-slate-300 px-4 py-2 text-sm font-black text-slate-950 transition hover:border-cyan-700 hover:text-cyan-800 sm:w-auto",children:[e.jsx(ke,{size:17,"aria-hidden":"true"}),"View Public Page"]}),e.jsxs("button",{type:"button",onClick:Ce,className:"inline-flex min-h-11 w-full items-center justify-center gap-2 rounded-xl border border-red-200 px-4 py-2 text-sm font-black text-red-700 transition hover:bg-red-50 disabled:opacity-60 sm:w-auto",disabled:I,children:[e.jsx(Fe,{size:17,"aria-hidden":"true"}),"Delete"]})]})]})]})})]}),p==="orders"&&e.jsx(Et,{user:l}),p==="messages"&&e.jsx("section",{className:"mx-auto max-w-7xl px-4 pb-10 sm:px-6 lg:px-8",children:e.jsxs("section",{className:"rounded-lg border border-slate-200 bg-white p-5 shadow-xl shadow-slate-200/70 sm:p-6",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"inline-flex items-center gap-2 text-sm font-black uppercase text-cyan-800",children:[e.jsx(Ee,{size:16,"aria-hidden":"true"}),"Contact Messages"]}),e.jsxs("h2",{className:"mt-2 text-2xl font-black text-slate-950",children:[Z," unread of ",L.length]})]}),e.jsxs("button",{type:"button",onClick:Q,className:"inline-flex min-h-10 items-center justify-center gap-2 rounded-md border border-slate-300 px-4 py-2 text-sm font-black text-slate-950 transition hover:border-cyan-700 hover:text-cyan-800 disabled:opacity-60",disabled:I,children:[e.jsx($,{className:ce?"animate-spin":"",size:16,"aria-hidden":"true"}),"Refresh"]})]}),e.jsxs("div",{className:"mt-5 grid gap-4",children:[L.map(a=>e.jsxs("article",{className:`rounded-lg border p-5 shadow-sm ${a.isRead?"border-slate-200 bg-white":"border-cyan-300 bg-cyan-50/70"}`,children:[e.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-start",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:`rounded-full px-2.5 py-1 text-xs font-black uppercase ${a.isRead?"bg-slate-100 text-slate-600":"bg-cyan-700 text-white"}`,children:a.isRead?"Read":"Unread"}),e.jsx("span",{className:"text-xs font-bold uppercase text-slate-500",children:Ze(a.createdAt)})]}),e.jsx("h3",{className:"mt-3 break-words text-xl font-black text-slate-950",children:a.name}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-x-4 gap-y-1 text-sm font-semibold text-slate-600",children:[e.jsx("a",{href:`mailto:${a.email}`,className:"break-all text-cyan-800 hover:text-cyan-950",children:a.email}),a.company&&e.jsx("span",{className:"break-words",children:a.company})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 lg:justify-end",children:[e.jsxs("button",{type:"button",onClick:()=>at(a.id,!a.isRead),className:"inline-flex min-h-10 items-center gap-2 rounded-md border border-slate-300 px-3 text-xs font-black text-slate-700 transition hover:border-cyan-700 hover:text-cyan-800 disabled:opacity-60",disabled:I,children:[e.jsx(Ke,{size:15,"aria-hidden":"true"}),a.isRead?"Mark Unread":"Mark Read"]}),e.jsxs("button",{type:"button",onClick:()=>rt(a.id),className:"inline-flex min-h-10 items-center gap-2 rounded-md border border-red-200 px-3 text-xs font-black text-red-700 transition hover:bg-red-50 disabled:opacity-60",disabled:I,children:[e.jsx(Fe,{size:15,"aria-hidden":"true"}),"Delete"]})]})]}),e.jsx("p",{className:"mt-4 whitespace-pre-wrap break-words rounded-lg border border-slate-200 bg-white/75 p-4 text-sm font-semibold leading-7 text-slate-700",children:a.message})]},a.id)),L.length===0&&e.jsx("div",{className:"rounded-lg border border-dashed border-slate-300 bg-slate-50 p-8 text-center text-sm font-semibold text-slate-600",children:"No contact messages have been submitted yet."})]})]})}),p==="payments"&&e.jsx("section",{className:"mx-auto max-w-7xl px-4 pb-10 sm:px-6 lg:px-8",children:e.jsxs("form",{onSubmit:nt,className:"rounded-lg border border-slate-200 bg-white p-5 shadow-xl shadow-slate-200/70 sm:p-6",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"inline-flex items-center gap-2 text-sm font-black uppercase text-cyan-800",children:[e.jsx(fe,{size:16,"aria-hidden":"true"}),"Payment Gateways"]}),e.jsx("h2",{className:"mt-2 text-2xl font-black text-slate-950",children:m.appName||"Checkout"})]}),e.jsxs(X,{type:"submit",className:"w-full rounded-xl px-6 sm:w-auto",disabled:I,children:[I?e.jsx($,{className:"animate-spin",size:17,"aria-hidden":"true"}):e.jsx(Pe,{size:17,"aria-hidden":"true"}),"Save Payments"]})]}),e.jsxs("div",{className:"mt-6 grid gap-4 md:grid-cols-[minmax(0,1fr)_180px]",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1 block text-sm font-bold text-slate-700",children:"Checkout display name"}),e.jsx("input",{name:"appName",value:m.appName,onChange:H,className:"h-11 w-full rounded-md border border-slate-300 px-3 text-sm",required:!0})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1 block text-sm font-bold text-slate-700",children:"Currency"}),e.jsx("input",{name:"currency",value:m.currency,onChange:H,className:"h-11 w-full rounded-md border border-slate-300 px-3 text-sm uppercase",maxLength:3,pattern:"[A-Za-z]{3}",required:!0})]})]}),e.jsxs("section",{className:"mt-7 border-t border-slate-200 pt-6",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("span",{className:"inline-flex items-center gap-2 text-sm font-black uppercase text-cyan-800",children:[e.jsx(st,{size:16,"aria-hidden":"true"}),"PayPal"]}),e.jsx("span",{className:`inline-flex rounded-full border px-3 py-1 text-xs font-black uppercase ${m.paypal.enabled&&m.paypal.configured?"border-emerald-200 bg-emerald-50 text-emerald-800":"border-slate-200 bg-slate-50 text-slate-600"}`,children:m.paypal.enabled&&m.paypal.configured?"Enabled":"Disabled"})]}),e.jsxs("div",{className:"mt-4 grid gap-4 lg:grid-cols-[220px_220px_minmax(0,1fr)]",children:[e.jsxs("label",{className:"flex min-h-11 items-center gap-3 rounded-md border border-slate-300 px-3 text-sm font-black text-slate-800",children:[e.jsx("input",{type:"checkbox",name:"paypal.enabled",checked:m.paypal.enabled,onChange:H,className:"h-4 w-4 rounded border-slate-300 text-cyan-700"}),"Enable PayPal"]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1 block text-sm font-bold text-slate-700",children:"Environment"}),e.jsxs("select",{name:"paypal.environment",value:m.paypal.environment,onChange:H,className:"h-11 w-full rounded-md border border-slate-300 px-3 text-sm",children:[e.jsx("option",{value:"sandbox",children:"Sandbox"}),e.jsx("option",{value:"live",children:"Live"})]})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1 block text-sm font-bold text-slate-700",children:"Client ID"}),e.jsx("input",{name:"paypal.clientId",value:m.paypal.clientId,onChange:H,className:"h-11 w-full rounded-md border border-slate-300 px-3 text-sm",autoComplete:"off"})]})]}),e.jsxs("label",{className:"mt-4 block",children:[e.jsxs("span",{className:"mb-1 flex flex-wrap items-center gap-2 text-sm font-bold text-slate-700",children:["Secret key",m.paypal.hasClientSecret&&e.jsx("span",{className:"rounded-full bg-emerald-50 px-2 py-0.5 text-xs font-black uppercase text-emerald-700",children:"Saved"})]}),e.jsx("input",{type:"password",name:"paypal.clientSecret",value:m.paypal.clientSecret,onChange:H,className:"h-11 w-full rounded-md border border-slate-300 px-3 text-sm",placeholder:m.paypal.hasClientSecret?"Saved secret":"",autoComplete:"new-password"})]})]}),e.jsxs("section",{className:"mt-7 border-t border-slate-200 pt-6",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("span",{className:"inline-flex items-center gap-2 text-sm font-black uppercase text-cyan-800",children:[e.jsx(fe,{size:16,"aria-hidden":"true"}),"Stripe"]}),e.jsx("span",{className:`inline-flex rounded-full border px-3 py-1 text-xs font-black uppercase ${m.stripe.enabled&&m.stripe.configured?"border-emerald-200 bg-emerald-50 text-emerald-800":"border-slate-200 bg-slate-50 text-slate-600"}`,children:m.stripe.enabled&&m.stripe.configured?"Enabled":"Disabled"})]}),e.jsxs("div",{className:"mt-4 grid gap-4 lg:grid-cols-[220px_minmax(0,1fr)]",children:[e.jsxs("label",{className:"flex min-h-11 items-center gap-3 rounded-md border border-slate-300 px-3 text-sm font-black text-slate-800",children:[e.jsx("input",{type:"checkbox",name:"stripe.enabled",checked:m.stripe.enabled,onChange:H,className:"h-4 w-4 rounded border-slate-300 text-cyan-700"}),"Enable Stripe"]}),e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"mb-1 flex flex-wrap items-center gap-2 text-sm font-bold text-slate-700",children:["Secret key",m.stripe.hasSecretKey&&e.jsx("span",{className:"rounded-full bg-emerald-50 px-2 py-0.5 text-xs font-black uppercase text-emerald-700",children:"Saved"})]}),e.jsx("input",{type:"password",name:"stripe.secretKey",value:m.stripe.secretKey,onChange:H,className:"h-11 w-full rounded-md border border-slate-300 px-3 text-sm",placeholder:m.stripe.hasSecretKey?"Saved secret key":"",autoComplete:"new-password"})]})]}),e.jsxs("label",{className:"mt-4 block",children:[e.jsxs("span",{className:"mb-1 flex flex-wrap items-center gap-2 text-sm font-bold text-slate-700",children:["Webhook secret",m.stripe.hasWebhookSecret&&e.jsx("span",{className:"rounded-full bg-emerald-50 px-2 py-0.5 text-xs font-black uppercase text-emerald-700",children:"Saved"})]}),e.jsx("input",{type:"password",name:"stripe.webhookSecret",value:m.stripe.webhookSecret,onChange:H,className:"h-11 w-full rounded-md border border-slate-300 px-3 text-sm",placeholder:m.stripe.hasWebhookSecret?"Saved webhook secret":"",autoComplete:"new-password"})]})]})]})}),p==="homepage"&&e.jsxs("section",{className:"mx-auto grid max-w-7xl gap-6 px-4 pb-10 sm:px-6 lg:grid-cols-[0.55fr_0.45fr] lg:px-8",children:[e.jsxs("form",{onSubmit:lt,className:"rounded-lg border border-slate-200 bg-white p-5 shadow-xl shadow-slate-200/70 sm:p-6",children:[e.jsxs("span",{className:"inline-flex items-center gap-2 text-sm font-black uppercase text-amber-700",children:[e.jsx(Oe,{size:16,"aria-hidden":"true"}),"Homepage Background Pictures"]}),e.jsxs("div",{className:"mt-5 space-y-4",children:[e.jsx(et,{label:"Upload homepage images",busy:oe==="homepage",onFiles:W}),e.jsx(tt,{images:K,onRemove:b,emptyText:"No homepage background images uploaded yet.",fit:"cover"})]}),e.jsx("div",{className:"mt-4",children:e.jsxs(X,{type:"submit",className:"w-full rounded-xl px-6 sm:w-auto",disabled:I,children:[I?e.jsx($,{className:"animate-spin",size:17,"aria-hidden":"true"}):e.jsx(Pe,{size:17,"aria-hidden":"true"}),"Save Home Images"]})})]}),e.jsxs("section",{className:"rounded-lg border border-slate-200 bg-white p-5 shadow-sm",children:[e.jsxs("span",{className:"inline-flex items-center gap-2 text-sm font-black uppercase text-cyan-800",children:[e.jsx(Ve,{size:16,"aria-hidden":"true"}),"Preview"]}),e.jsx("div",{className:"mt-5 grid grid-cols-2 gap-3",children:K.map((a,r)=>e.jsx("img",{src:a,alt:"",className:"aspect-[4/3] w-full rounded-md object-cover"},`${a}-${r}`))})]})]}),p==="users"&&e.jsxs("section",{className:"mx-auto grid max-w-7xl gap-6 px-4 pb-10 sm:px-6 lg:grid-cols-[0.58fr_0.42fr] lg:px-8",children:[e.jsxs("section",{className:"rounded-lg border border-slate-200 bg-white p-5 shadow-xl shadow-slate-200/70 sm:p-6",children:[e.jsxs("span",{className:"inline-flex items-center gap-2 text-sm font-black uppercase text-cyan-800",children:[e.jsx(De,{size:16,"aria-hidden":"true"}),"Users"]}),e.jsx("div",{className:"mt-5 overflow-x-auto rounded-lg border border-slate-200",children:e.jsxs("table",{className:"w-full border-collapse text-left text-sm",children:[e.jsx("thead",{className:"bg-slate-50 text-xs uppercase text-slate-500",children:e.jsxs("tr",{children:[e.jsx("th",{className:"p-3",children:"Name"}),e.jsx("th",{className:"p-3",children:"Email"}),e.jsx("th",{className:"p-3",children:"Role"}),e.jsx("th",{className:"p-3",children:"Active"})]})}),e.jsx("tbody",{children:P.map(a=>e.jsxs("tr",{className:"border-t border-slate-200",children:[e.jsx("td",{className:"p-3 font-black text-slate-950",children:a.name}),e.jsx("td",{className:"p-3 text-slate-600",children:a.email}),e.jsx("td",{className:"p-3 text-slate-600",children:a.role}),e.jsx("td",{className:"p-3 font-black text-cyan-800",children:a.activeSessions})]},a.id))})]})})]}),e.jsxs("form",{onSubmit:it,className:"rounded-lg border border-slate-200 bg-white p-5 shadow-sm",children:[e.jsxs("span",{className:"inline-flex items-center gap-2 text-sm font-black uppercase text-amber-700",children:[e.jsx(At,{size:16,"aria-hidden":"true"}),"Activate Product Timing"]}),e.jsxs("label",{className:"mt-5 block",children:[e.jsx("span",{className:"mb-1 block text-sm font-bold text-slate-700",children:"User"}),e.jsxs("select",{name:"userId",value:F.userId,onChange:se,className:"h-11 w-full rounded-md border border-slate-300 px-3 text-sm",required:!0,children:[e.jsx("option",{value:"",children:"Select user"}),P.map(a=>e.jsxs("option",{value:a.id,children:[a.name," - ",a.email]},a.id))]})]}),e.jsxs("label",{className:"mt-4 block",children:[e.jsx("span",{className:"mb-1 block text-sm font-bold text-slate-700",children:"Product"}),e.jsxs("select",{name:"productId",value:F.productId,onChange:se,className:"h-11 w-full rounded-md border border-slate-300 px-3 text-sm",required:!0,children:[e.jsx("option",{value:"",children:"Select product"}),N.map(a=>e.jsx("option",{value:a.id,children:a.title},a.id))]})]}),e.jsxs("label",{className:"mt-4 block",children:[e.jsx("span",{className:"mb-1 block text-sm font-bold text-slate-700",children:"Hours"}),e.jsx("input",{type:"number",name:"hours",value:F.hours,onChange:se,min:"1",max:"720",className:"h-11 w-full rounded-md border border-slate-300 px-3 text-sm",required:!0})]}),e.jsxs(X,{type:"submit",className:"mt-5 rounded-xl px-6",disabled:I||N.length===0||P.length===0,children:[I?e.jsx($,{className:"animate-spin",size:17,"aria-hidden":"true"}):e.jsx(ge,{size:17,"aria-hidden":"true"}),"Activate Timing"]})]})]}),p==="timing"&&e.jsx("section",{className:"mx-auto max-w-7xl px-4 pb-10 sm:px-6 lg:px-8",children:e.jsxs("section",{className:"rounded-lg border border-slate-200 bg-white p-5 shadow-xl shadow-slate-200/70 sm:p-6",children:[e.jsxs("span",{className:"inline-flex items-center gap-2 text-sm font-black uppercase text-cyan-800",children:[e.jsx(ge,{size:16,"aria-hidden":"true"}),"Demo Timing"]}),e.jsxs("div",{className:"mt-5 grid gap-3",children:[k.map(a=>{var r,i,h;return e.jsxs("div",{className:"grid gap-3 rounded-lg border border-slate-200 p-4 md:grid-cols-[1fr_0.7fr_auto] md:items-center",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-black text-slate-950",children:(r=a.product)==null?void 0:r.title}),e.jsxs("p",{className:"mt-1 text-sm text-slate-600",children:[(i=a.user)==null?void 0:i.name," - ",(h=a.user)==null?void 0:h.email]}),e.jsxs("p",{className:"mt-1 text-xs font-bold uppercase text-slate-500",children:[Lt(a)," until ",Ze(a.expiresAt)]})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1 block text-xs font-bold uppercase text-slate-500",children:"Reactivate hours"}),e.jsx("input",{type:"number",min:"1",max:"720",value:de[a.id]??48,onChange:j=>Se(z=>({...z,[a.id]:j.target.value})),className:"h-10 w-full rounded-md border border-slate-300 px-3 text-sm"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 md:justify-end",children:[e.jsxs("button",{type:"button",onClick:()=>He(a,"reactivate"),className:"inline-flex min-h-10 items-center gap-2 rounded-md bg-cyan-700 px-3 text-xs font-black text-white transition hover:bg-cyan-800 disabled:opacity-60",disabled:I,children:[e.jsx(ge,{size:15,"aria-hidden":"true"}),"Activate"]}),e.jsxs("button",{type:"button",onClick:()=>He(a,"force-expire"),className:"inline-flex min-h-10 items-center gap-2 rounded-md border border-red-200 px-3 text-xs font-black text-red-700 transition hover:bg-red-50 disabled:opacity-60",disabled:I,children:[e.jsx(Pt,{size:15,"aria-hidden":"true"}),"Deactivate"]})]})]},a.id)}),k.length===0&&e.jsx("div",{className:"rounded-lg border border-slate-200 bg-slate-50 p-6 text-sm font-semibold text-slate-600",children:"No demo timing has been created yet. Use Users to activate product timing."})]})]})})]}):e.jsx("main",{className:"grid min-h-screen place-items-center bg-slate-950 px-4 text-white",children:e.jsxs("section",{className:"w-full max-w-lg rounded-lg border border-white/15 bg-white/10 p-7 shadow-2xl backdrop-blur",children:[e.jsx("span",{className:"grid h-14 w-14 place-items-center rounded-full bg-amber-400 text-slate-950",children:e.jsx(bt,{size:26,"aria-hidden":"true"})}),e.jsx("h1",{className:"mt-5 text-3xl font-black",children:"Admin Login Required"}),e.jsx("p",{className:"mt-3 text-sm leading-6 text-zinc-200",children:"The admin panel is private. Login with the administrator account to manage products."}),e.jsxs("div",{className:"mt-6 flex flex-wrap gap-3",children:[e.jsx(ue,{to:"/auth?mode=login&returnTo=/admin",children:e.jsxs(X,{className:"rounded-xl",children:[e.jsx(Je,{size:17,"aria-hidden":"true"}),"Login to Admin"]})}),e.jsx(ue,{to:"/",children:e.jsxs(X,{variant:"light",className:"rounded-xl",children:[e.jsx(Te,{size:17,"aria-hidden":"true"}),"Store"]})})]})]})})}export{ss as AdminPanelPage};
Close